From 743e40c2f89dcd5a96c8919c0d38c51ffb4e0050 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Mon, 17 Aug 2026 10:52:53 +0200 Subject: [PATCH] selectable workflow in new session --- cmd/olliesrv/internal/fs/spec.go | 7 ++++++- kde/gui/NewSessionDialog.qml | 24 +++++++++++++++++++++++- kde/gui/ollie9pclient.cpp | 3 ++- kde/gui/ollie9pclient.h | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/cmd/olliesrv/internal/fs/spec.go b/cmd/olliesrv/internal/fs/spec.go index 9e0be90..f243698 100644 --- a/cmd/olliesrv/internal/fs/spec.go +++ b/cmd/olliesrv/internal/fs/spec.go @@ -189,7 +189,7 @@ func buildTreeSpec(cfg *Config) virtfs.FsNodeDecl { virtfs.Doc("Create session"), virtfs.Rdwr(func(_ context.Context, data []byte) ([]byte, error) { args := strings.Fields(string(data)) - name, remote := "", "" + name, remote, workflow := "", "", "" for _, arg := range args { if k, v, ok := strings.Cut(arg, "="); ok { switch k { @@ -197,6 +197,8 @@ func buildTreeSpec(cfg *Config) virtfs.FsNodeDecl { name = v case "remote": remote = v + case "workflow": + workflow = v } } } @@ -204,6 +206,9 @@ func buildTreeSpec(cfg *Config) virtfs.FsNodeDecl { if err != nil { return nil, err } + if workflow != "" { + sess.SetWorkflow(workflow) + } return []byte(sess.Name() + "\n"), nil }), ), diff --git a/kde/gui/NewSessionDialog.qml b/kde/gui/NewSessionDialog.qml index 33941f5..014e0ef 100644 --- a/kde/gui/NewSessionDialog.qml +++ b/kde/gui/NewSessionDialog.qml @@ -94,6 +94,25 @@ Dialog { placeholderText: "user@host (optional)" } } + + RowLayout { + Layout.fillWidth: true + Label { text: "Workflow:"; Layout.preferredWidth: 80 } + ComboBox { + id: workflowCombo + Layout.fillWidth: true + enabled: ollie.rootAgentsLoaded + model: ollie.availableAgents + currentIndex: { + var idx = ollie.availableAgents.indexOf("conductor") + return idx >= 0 ? idx : 0 + } + } + } + + Component.onCompleted: { + if (!ollie.rootAgentsLoaded) ollie.loadRootAgents() + } } footer: RowLayout { @@ -107,7 +126,8 @@ Dialog { var name = nameField.text.trim() var remote = remoteField.text.trim() - var err = ollie.createSession(name, remote) + var workflow = workflowCombo.currentText + var err = ollie.createSession(name, remote, workflow) if (err === "") { ollie.refreshSessions() root.sessionCreated() @@ -130,5 +150,7 @@ Dialog { errorLabel.text = "" nameField.text = "" remoteField.text = "" + var idx = ollie.availableAgents.indexOf("conductor") + workflowCombo.currentIndex = idx >= 0 ? idx : 0 } } diff --git a/kde/gui/ollie9pclient.cpp b/kde/gui/ollie9pclient.cpp index 0fb64cc..8910e16 100644 --- a/kde/gui/ollie9pclient.cpp +++ b/kde/gui/ollie9pclient.cpp @@ -570,13 +570,14 @@ bool Ollie9pClient::createQuickSession() return !result.isEmpty() || m_9p->lastError().isEmpty(); } -QString Ollie9pClient::createSession(const QString &name, const QString &remote) +QString Ollie9pClient::createSession(const QString &name, const QString &remote, const QString &workflow) { if (!m_9p || !m_9p->isConnected()) return QStringLiteral("not connected"); QStringList args; if (!name.isEmpty()) args << "name=" + name; if (!remote.isEmpty()) args << "remote=" + remote; + if (!workflow.isEmpty()) args << "workflow=" + workflow; QByteArray result = m_9p->rdwr(QStringLiteral("session/new"), (args.join(" ") + "\n").toUtf8()); QString err = m_9p->lastError(); diff --git a/kde/gui/ollie9pclient.h b/kde/gui/ollie9pclient.h index 8544c38..142f8b5 100644 --- a/kde/gui/ollie9pclient.h +++ b/kde/gui/ollie9pclient.h @@ -80,7 +80,7 @@ public: Q_INVOKABLE void loadRootAgents(); Q_INVOKABLE QStringList getAvailableModels(const QString &backend) const; Q_INVOKABLE bool createQuickSession(); - Q_INVOKABLE QString createSession(const QString &name, const QString &remote); + Q_INVOKABLE QString createSession(const QString &name, const QString &remote, const QString &workflow = QString()); Q_INVOKABLE QString createAgent(const QString &sessionId, const QString &cwd, const QString &backend, const QString &model, const QString &agent, const QString &remote, const QString &agentAlias); Q_INVOKABLE bool killAgent(const QString &sessionId, const QString &agentId); Q_INVOKABLE bool renameSession(const QString &sessionId, const QString &newName);