selectable workflow in new session

This commit is contained in:
Levi Neely 2026-08-17 10:52:53 +02:00
parent 957617cee7
commit 743e40c2f8
4 changed files with 32 additions and 4 deletions

View File

@ -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
}),
),

View File

@ -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
}
}

View File

@ -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();

View File

@ -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);