@stigmer/cli 3.20.0 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/run.d.ts.map +1 -1
- package/commands/run.js +22 -3
- package/commands/run.js.map +1 -1
- package/local/plugins/defaults.d.ts.map +1 -1
- package/local/plugins/defaults.js +3 -2
- package/local/plugins/defaults.js.map +1 -1
- package/package.json +7 -7
- package/resources/picker/ink.d.ts +14 -4
- package/resources/picker/ink.d.ts.map +1 -1
- package/resources/picker/ink.js +4 -4
- package/resources/picker/ink.js.map +1 -1
- package/resources/run/agent-exec.d.ts +2 -1
- package/resources/run/agent-exec.d.ts.map +1 -1
- package/resources/run/agent-exec.js +8 -4
- package/resources/run/agent-exec.js.map +1 -1
- package/resources/run/create.d.ts +4 -3
- package/resources/run/create.d.ts.map +1 -1
- package/resources/run/create.js.map +1 -1
- package/src/commands/bootstrap.test.ts +12 -31
- package/src/commands/marketplace.test.ts +3 -3
- package/src/commands/run.ts +24 -4
- package/src/local/plugins/defaults.ts +3 -2
- package/src/marketplace/read.test.ts +4 -4
- package/src/resources/picker/ink.tsx +15 -6
- package/src/resources/run/agent-exec.test.ts +26 -2
- package/src/resources/run/agent-exec.ts +10 -5
- package/src/resources/run/create.ts +4 -3
package/commands/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAelD"}
|
package/commands/run.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
// reference (smart 0/1/2-arg dispatch mirroring Go's run.go + run_picker.go),
|
|
4
4
|
// then delegate to the shared run stack. Heavy modules (backend client, Ink,
|
|
5
5
|
// the differ) load lazily inside the action so `--help` stays fast (DD-001).
|
|
6
|
+
//
|
|
7
|
+
// No reference at all is the built-in assistant: `stigmer run -m "..."` runs
|
|
8
|
+
// it at once (the person said what to say, so there is nothing to pick), and
|
|
9
|
+
// a bare `stigmer run` on a terminal opens the agent picker with the
|
|
10
|
+
// assistant as its first row. Off a terminal with no message there is
|
|
11
|
+
// nothing to run and the guidance names both forms.
|
|
6
12
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
7
13
|
import { ensureAuthenticated, resolveOrganization } from "../config/index.js";
|
|
8
14
|
import { UsageError } from "../errors/index.js";
|
|
@@ -30,8 +36,13 @@ async function runRun(type, reference, options, command) {
|
|
|
30
36
|
" stigmer run --org <org> ...");
|
|
31
37
|
}
|
|
32
38
|
const outputMode = options.json === true ? "json" : "inline";
|
|
33
|
-
// 0 args →
|
|
39
|
+
// 0 args → the built-in assistant when a message was given; else the
|
|
40
|
+
// interactive agent picker on a TTY; otherwise actionable guidance.
|
|
34
41
|
if (type === undefined) {
|
|
42
|
+
if ((options.message ?? "") !== "") {
|
|
43
|
+
await runResolvedAgent(undefined, options, org, outputMode, client);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
35
46
|
if (interactiveBrowseEnabled(outputMode)) {
|
|
36
47
|
await browseAndRunAgent("", options, org, outputMode, client);
|
|
37
48
|
return;
|
|
@@ -106,6 +117,8 @@ async function runAgent(agentId, options, org, outputMode, client) {
|
|
|
106
117
|
const agent = await resolveAgentRef(client.stigmer, agentId, org);
|
|
107
118
|
await runResolvedAgent(agent, options, org, outputMode, client);
|
|
108
119
|
}
|
|
120
|
+
// `agent` undefined is the built-in assistant: the execution names no agent
|
|
121
|
+
// and the backend creates a session with no instance.
|
|
109
122
|
async function runResolvedAgent(agent, options, org, outputMode, client) {
|
|
110
123
|
const { prepareAgentExec } = await import("../resources/run/prepare.js");
|
|
111
124
|
const { executeResolvedAgent } = await import("../resources/run/agent-exec.js");
|
|
@@ -188,7 +201,11 @@ async function browseAndRunAgent(initialQuery, options, org, outputMode, client)
|
|
|
188
201
|
});
|
|
189
202
|
if (selected === undefined)
|
|
190
203
|
return;
|
|
191
|
-
|
|
204
|
+
if (selected.kind === "built-in-assistant") {
|
|
205
|
+
await runResolvedAgent(undefined, options, org, outputMode, client);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
await runAgent(selected.agent.id, options, org, outputMode, client);
|
|
192
209
|
}
|
|
193
210
|
// Off a TTY (pipes, CI, --json), the interactive picker can't run, so 0-arg and
|
|
194
211
|
// unresolved references produce actionable guidance instead of a browse UI.
|
|
@@ -196,9 +213,11 @@ function browseUnavailableError(query) {
|
|
|
196
213
|
const head = query === ""
|
|
197
214
|
? "Interactive agent browsing requires an interactive terminal"
|
|
198
215
|
: `No agent found for "${query}"`;
|
|
216
|
+
const assistantHint = query === "" ? " stigmer run -m <message> (the built-in assistant, no agent)\n" : "";
|
|
199
217
|
return new UsageError(`${head}\n\n` +
|
|
200
218
|
"Specify a full agent reference:\n" +
|
|
201
219
|
" stigmer run <org/slug>\n" +
|
|
202
|
-
" stigmer run <agent-id
|
|
220
|
+
" stigmer run <agent-id>\n" +
|
|
221
|
+
assistantHint);
|
|
203
222
|
}
|
|
204
223
|
//# sourceMappingURL=run.js.map
|
package/commands/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAC7E,EAAE;A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,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACpE,OAAO;IACT,CAAC;IACD,MAAM,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AACtE,CAAC;AAED,gFAAgF;AAChF,4EAA4E;AAC5E,SAAS,sBAAsB,CAAC,KAAa;IAC3C,MAAM,IAAI,GACR,KAAK,KAAK,EAAE;QACV,CAAC,CAAC,6DAA6D;QAC/D,CAAC,CAAC,uBAAuB,KAAK,GAAG,CAAC;IACtC,MAAM,aAAa,GACjB,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,sEAAsE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7F,OAAO,IAAI,UAAU,CACnB,GAAG,IAAI,MAAM;QACX,mCAAmC;QACnC,4BAA4B;QAC5B,4BAA4B;QAC5B,aAAa,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/local/plugins/defaults.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/local/plugins/defaults.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,cAAc,CAAC;AAOxD,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,mBAAmB,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;AAED,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED,MAAM,MAAM,oBAAoB,GAC5B;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEN,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACnD,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,CAAC,EAAE,sBAAsB,GAChC,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAerC;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,oBAAoB,CAAC,CA2B/B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The default plugins a backend is bootstrapped with: the `defaults` list of
|
|
2
2
|
// the official marketplace, installed in order into the system org as
|
|
3
|
-
// public
|
|
4
|
-
//
|
|
3
|
+
// public. The official list is empty today (a session with no agent runs
|
|
4
|
+
// the built-in assistant, so a fresh install needs no default content);
|
|
5
|
+
// the mechanism stays until the bootstrap is re-scoped.
|
|
5
6
|
//
|
|
6
7
|
// Two phases, deliberately separate. Preparing (resolve the official tree,
|
|
7
8
|
// which may acquire `@stigmer/plugins` at the CLI's version; walk, zip and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/local/plugins/defaults.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,sEAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/local/plugins/defaults.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,sEAAsE;AACtE,yEAAyE;AACzE,wEAAwE;AACxE,wDAAwD;AACxD,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,mEAAmE;AACnE,0EAA0E;AAC1E,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,yEAAyE;AACzE,0EAA0E;AAC1E,gCAAgC;AAEhC,OAAO,EAAgB,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,wDAAwD,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAEL,0BAA0B,GAC3B,MAAM,+BAA+B,C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C,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,kBAAkB,CAC/B,OAAgB,EAChB,GAAW,EACX,QAA4B;IAE5B,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;YAC7C,GAAG;YACH,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI;SAC3B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACpC,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CACL,QAAQ,CAAC,MAAM,EAAE,MAAM,KAAK,QAAQ,CAAC,MAAM;QAC3C,QAAQ,CAAC,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK;QAC3C,QAAQ,CAAC,QAAQ,EAAE,UAAU,KAAK,qBAAqB,CAAC,iBAAiB,CAC1E,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"description": "Stigmer command-line interface — manage agents, workflows, MCP servers, skills, and executions from the terminal",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"@connectrpc/connect": "^2.0.0",
|
|
36
36
|
"@connectrpc/connect-node": "^2.1.1",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
38
|
-
"@stigmer/ink": "3.
|
|
39
|
-
"@stigmer/mcp-server": "3.
|
|
40
|
-
"@stigmer/plugin-package": "3.
|
|
41
|
-
"@stigmer/protos": "3.
|
|
42
|
-
"@stigmer/sdk": "3.
|
|
43
|
-
"@stigmer/zip-structure": "3.
|
|
38
|
+
"@stigmer/ink": "3.21.0",
|
|
39
|
+
"@stigmer/mcp-server": "3.21.0",
|
|
40
|
+
"@stigmer/plugin-package": "3.21.0",
|
|
41
|
+
"@stigmer/protos": "3.21.0",
|
|
42
|
+
"@stigmer/sdk": "3.21.0",
|
|
43
|
+
"@stigmer/zip-structure": "3.21.0",
|
|
44
44
|
"commander": "^12.1.0",
|
|
45
45
|
"fflate": "^0.8.3",
|
|
46
46
|
"ink": "^7.0.0",
|
|
@@ -13,11 +13,21 @@ export interface PickAgentOptions {
|
|
|
13
13
|
readonly deploymentMode?: DeploymentMode;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* process — the caller decides what to do with the selection.
|
|
16
|
+
* What the agent picker resolved with: an agent the search found, or the
|
|
17
|
+
* built-in assistant (the first row; a session with no agent).
|
|
19
18
|
*/
|
|
20
|
-
export
|
|
19
|
+
export type PickedAgent = {
|
|
20
|
+
readonly kind: "agent";
|
|
21
|
+
readonly agent: SearchResult;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "built-in-assistant";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Render the agent picker and resolve with the choice, or `undefined` when
|
|
27
|
+
* the user cancels (Esc / Ctrl+C). Never throws and never exits the process
|
|
28
|
+
* — the caller decides what to do with the selection.
|
|
29
|
+
*/
|
|
30
|
+
export declare function pickAgent(opts: PickAgentOptions): Promise<PickedAgent | undefined>;
|
|
21
31
|
/** Options for {@link pickSession}. */
|
|
22
32
|
export interface PickSessionOptions {
|
|
23
33
|
/** The CLI's configured, refreshing-token client (backend.stigmer). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.d.ts","sourceRoot":"","sources":["../../../src/resources/picker/ink.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sDAAsD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,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAcxF;AAED,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAYxF"}
|
package/resources/picker/ink.js
CHANGED
|
@@ -2,12 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { render } from "ink";
|
|
3
3
|
import { AgentPicker, InkStigmerProvider, SessionPicker } from "@stigmer/ink";
|
|
4
4
|
/**
|
|
5
|
-
* Render the agent picker and resolve with the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Render the agent picker and resolve with the choice, or `undefined` when
|
|
6
|
+
* the user cancels (Esc / Ctrl+C). Never throws and never exits the process
|
|
7
|
+
* — the caller decides what to do with the selection.
|
|
8
8
|
*/
|
|
9
9
|
export async function pickAgent(opts) {
|
|
10
|
-
return runPicker((resolve) => (_jsx(AgentPicker, { org: opts.org, initialQuery: opts.initialQuery, onSelect: (agent) => resolve(agent), onCancel: () => resolve(undefined) })), opts.client, opts.deploymentMode);
|
|
10
|
+
return runPicker((resolve) => (_jsx(AgentPicker, { org: opts.org, initialQuery: opts.initialQuery, onSelect: (agent) => resolve({ kind: "agent", agent }), onSelectBuiltInAssistant: () => resolve({ kind: "built-in-assistant" }), onCancel: () => resolve(undefined) })), opts.client, opts.deploymentMode);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Render the session picker and resolve with the chosen session, or `undefined`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../../../src/resources/picker/ink.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../../../src/resources/picker/ink.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAyB9E;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAsB;IACpD,OAAO,SAAS,CACd,CAAC,OAAO,EAAE,EAAE,CAAC,CACX,KAAC,WAAW,IACV,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EACtD,wBAAwB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC,EACvE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAClC,CACH,EACD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,cAAc,CACpB,CAAC;AACJ,CAAC;AAYD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAwB;IACxD,OAAO,SAAS,CACd,CAAC,OAAO,EAAE,EAAE,CAAC,CACX,KAAC,aAAa,IACZ,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EACvC,QAAQ,EAAE,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"}
|
|
@@ -3,7 +3,8 @@ import type { BackendClient } from "../../client/index.js";
|
|
|
3
3
|
import type { PreparedRun } from "./prepare.js";
|
|
4
4
|
import { type RunOutputMode } from "./stream.js";
|
|
5
5
|
export interface ResolvedAgentExecInput {
|
|
6
|
-
|
|
6
|
+
/** The agent to run; undefined is the built-in assistant. */
|
|
7
|
+
readonly agent: Agent | undefined;
|
|
7
8
|
readonly prepared: PreparedRun;
|
|
8
9
|
readonly org: string;
|
|
9
10
|
/** Artifact download directory; "" skips download. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-exec.d.ts","sourceRoot":"","sources":["../../../src/resources/run/agent-exec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-exec.d.ts","sourceRoot":"","sources":["../../../src/resources/run/agent-exec.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAEhF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAChC;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmEvF"}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// run_agent_exec.go): create the agent execution (one call — a workspace rides
|
|
3
3
|
// the embedded session_spec and the backend bootstraps the session), then
|
|
4
4
|
// either detach (print header + re-attach hint) or stream and optionally
|
|
5
|
-
// download artifacts, for `run`.
|
|
5
|
+
// download artifacts, for `run`. With no agent the same flow runs the
|
|
6
|
+
// built-in assistant: the execution names no agent, the backend creates a
|
|
7
|
+
// session with no instance, and the header shows the assistant's name.
|
|
8
|
+
import { BUILT_IN_ASSISTANT_NAME } from "@stigmer/sdk";
|
|
6
9
|
import { downloadExecutionArtifacts } from "../download.js";
|
|
7
10
|
import { createAgentExecution } from "./create.js";
|
|
8
11
|
import { renderSessionHeader, workspaceNames } from "./header.js";
|
|
@@ -15,9 +18,10 @@ export async function executeResolvedAgent(input) {
|
|
|
15
18
|
// One call: workspace entries ride the embedded session_spec
|
|
16
19
|
// (stigmer/stigmer#249), so the backend bootstraps the session — resolving
|
|
17
20
|
// the agent's default instance server-side (auto-creating it if missing,
|
|
18
|
-
// which a client-side lookup could not)
|
|
21
|
+
// which a client-side lookup could not), or binding no agent at all for
|
|
22
|
+
// the built-in assistant — and dispatches the message.
|
|
19
23
|
const execution = await createAgentExecution(controller, {
|
|
20
|
-
agentId: input.agent
|
|
24
|
+
agentId: input.agent?.metadata?.id,
|
|
21
25
|
orgId: org,
|
|
22
26
|
message: prepared.message,
|
|
23
27
|
runtimeEnv: prepared.runtimeEnv,
|
|
@@ -35,7 +39,7 @@ export async function executeResolvedAgent(input) {
|
|
|
35
39
|
// records the id on the returned execution spec.
|
|
36
40
|
const sessionId = execution.spec?.sessionId ?? "";
|
|
37
41
|
const header = {
|
|
38
|
-
agentName: input.agent
|
|
42
|
+
agentName: input.agent?.metadata?.name ?? BUILT_IN_ASSISTANT_NAME,
|
|
39
43
|
sessionId,
|
|
40
44
|
model: prepared.model,
|
|
41
45
|
mode: prepared.mode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-exec.js","sourceRoot":"","sources":["../../../src/resources/run/agent-exec.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IAAI,KAAK,CAAC,WAAW,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9E,MAAM,0BAA0B,CAC9B,MAAM,CAAC,OAAO,EACd,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,EAC5B,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,EAClD,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,2EAA2E;AAC3E,SAAS,cAAc;IACrB,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IACnD,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -8,9 +8,10 @@ import type { RuntimeEnv } from "./env.js";
|
|
|
8
8
|
import type { HarnessFlag, RunMode, ServiceTierFlag, ThinkingFlag } from "./prepare.js";
|
|
9
9
|
export type ControllerFn = <Desc extends DescService>(service: Desc) => Client<Desc>;
|
|
10
10
|
/**
|
|
11
|
-
* Inputs for creating an agent execution.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Inputs for creating an agent execution. agentId-only starts a new
|
|
12
|
+
* backend-managed session, sessionId threads a follow-up, both pins the agent
|
|
13
|
+
* within an existing session, and neither starts a new session with no agent:
|
|
14
|
+
* the built-in assistant.
|
|
14
15
|
*
|
|
15
16
|
* workspaceEntries ride the one-call bootstrap (spec.session_spec,
|
|
16
17
|
* stigmer/stigmer#249) and shape the auto-created session; they are mutually
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/resources/run/create.ts"],"names":[],"mappings":"AAQA,O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AAC,iBAAiB,CAAC,CAY5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/resources/run/create.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,iFAAiF;AACjF,4EAA4E;AAC5E,kFAAkF;AAGlF,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAuB,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACxH,OAAO,EAAE,+BAA+B,EAAE,MAAM,iEAAiE,CAAC;AAClH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAC;AAE1H,OAAO,EACL,wBAAwB,EAExB,qBAAqB,GACtB,MAAM,8DAA8D,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,uDAAuD,CAAC;AAChF,OAAO,EAAoB,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE5G,OAAO,EAEL,uBAAuB,GACxB,MAAM,gEAAgE,CAAC;AACxE,OAAO,EAAE,kCAAkC,EAAE,MAAM,oEAAoE,CAAC;AACxH,OAAO,EAAE,2BAA2B,EAAE,MAAM,iEAAiE,CAAC;AAC9G,OAAO,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAC;AACtG,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAIvG,MAAM,WAAW,GAAG,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/resources/run/create.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,iFAAiF;AACjF,4EAA4E;AAC5E,kFAAkF;AAGlF,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAuB,oBAAoB,EAAE,MAAM,6DAA6D,CAA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AQ,KAAK,SAAS;QAAE,GAAG,CAAC,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC;SAC/D,IAAI,QAAQ,KAAK,UAAU;QAAE,GAAG,CAAC,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC;IAC3E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,qEAAqE;AACrE,SAAS,iBAAiB,CAAC,GAAe;IACxC,MAAM,GAAG,GAAmC,EAAE,CAAC;IAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,gFAAgF;AAChF,uDAAuD;AACvD,SAAS,aAAa;IACpB,OAAO,aAAa,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// Command-level contract for `stigmer bootstrap`: against the configured
|
|
2
|
-
// backend it ensures the system org and installs the official defaults
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
2
|
+
// backend it ensures the system org and installs the official defaults (the
|
|
3
|
+
// repo tree's catalogue in dev), whose list is EMPTY — a fresh install needs
|
|
4
|
+
// no default content because a session with no agent runs the built-in
|
|
5
|
+
// assistant — so the command creates the organization, pushes nothing, and
|
|
6
|
+
// renders both outcomes; a second run over a converged backend reports the
|
|
7
|
+
// org present and still pushes nothing. The failing-default arm is pinned at
|
|
8
|
+
// the function level (local/bootstrap.test.ts), where a synthetic list can
|
|
9
|
+
// stage it. A real Connect backend over h2c serves the org and plugin
|
|
7
10
|
// controllers; the config file (HOME redirected) points a selfhost backend
|
|
8
11
|
// at it.
|
|
9
12
|
|
|
@@ -57,7 +60,6 @@ const openSessions = new Set<ServerHttp2Session>();
|
|
|
57
60
|
let orgs: Map<string, Organization>;
|
|
58
61
|
let plugins: Map<string, Plugin>;
|
|
59
62
|
let pushes: number;
|
|
60
|
-
let refusePush: boolean;
|
|
61
63
|
|
|
62
64
|
let home: string;
|
|
63
65
|
let originalHome: string | undefined;
|
|
@@ -85,9 +87,6 @@ beforeAll(async () => {
|
|
|
85
87
|
router.service(PluginCommandController, {
|
|
86
88
|
push: (req) => {
|
|
87
89
|
pushes += 1;
|
|
88
|
-
if (refusePush) {
|
|
89
|
-
throw new ConnectError("catalogue is read-only", Code.PermissionDenied);
|
|
90
|
-
}
|
|
91
90
|
const digest = createHash("sha256").update(req.artifact).digest("hex");
|
|
92
91
|
const slug = nameByDigest.get(digest);
|
|
93
92
|
if (slug === undefined) {
|
|
@@ -132,7 +131,6 @@ beforeEach(() => {
|
|
|
132
131
|
orgs = new Map();
|
|
133
132
|
plugins = new Map();
|
|
134
133
|
pushes = 0;
|
|
135
|
-
refusePush = false;
|
|
136
134
|
originalHome = process.env.HOME;
|
|
137
135
|
home = mkdtempSync(join(tmpdir(), "stigmer-bootstrap-cmd-"));
|
|
138
136
|
process.env.HOME = home;
|
|
@@ -200,11 +198,11 @@ function section(payload: { sections?: JsonSection[] }, title: string) {
|
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
describe("bootstrap", () => {
|
|
203
|
-
it("creates the system org, installs
|
|
201
|
+
it("creates the system org, installs nothing (the catalogue has no defaults), and reports both", async () => {
|
|
204
202
|
const outcome = await run("--json");
|
|
205
203
|
expect(outcome.exitCode).toBe(ExitCode.Success);
|
|
206
204
|
expect(orgs.has(SYSTEM_ORG)).toBe(true);
|
|
207
|
-
expect(pushes).
|
|
205
|
+
expect(pushes).toBe(0);
|
|
208
206
|
|
|
209
207
|
const payload = JSON.parse(outcome.stdout);
|
|
210
208
|
expect(payload.status).toBe("success");
|
|
@@ -213,12 +211,10 @@ describe("bootstrap", () => {
|
|
|
213
211
|
{ key: "Slug", value: SYSTEM_ORG },
|
|
214
212
|
{ key: "State", value: "created" },
|
|
215
213
|
]);
|
|
216
|
-
|
|
217
|
-
expect(defaults.length).toBe(pushes);
|
|
218
|
-
expect(defaults.every((f) => f.value === "installed")).toBe(true);
|
|
214
|
+
expect(section(payload, "Default plugins")?.fields ?? []).toEqual([]);
|
|
219
215
|
});
|
|
220
216
|
|
|
221
|
-
it("is a no-op the second time: org present,
|
|
217
|
+
it("is a no-op the second time: org present, nothing pushed", async () => {
|
|
222
218
|
await run("--json");
|
|
223
219
|
const pushedFirst = pushes;
|
|
224
220
|
const outcome = await run("--json");
|
|
@@ -235,19 +231,4 @@ describe("bootstrap", () => {
|
|
|
235
231
|
),
|
|
236
232
|
).toBe(true);
|
|
237
233
|
});
|
|
238
|
-
|
|
239
|
-
it("renders the outcomes and then exits non-zero when a default did not land", async () => {
|
|
240
|
-
refusePush = true;
|
|
241
|
-
const outcome = await run("--json");
|
|
242
|
-
expect(outcome.exitCode).toBe(ExitCode.General);
|
|
243
|
-
expect(outcome.message).toMatch(/^default plugins? not installed: /);
|
|
244
|
-
const payload = JSON.parse(outcome.stdout);
|
|
245
|
-
expect(payload.status).toBe("warning");
|
|
246
|
-
const defaults = section(payload, "Default plugins")?.fields ?? [];
|
|
247
|
-
expect(defaults.length).toBeGreaterThan(0);
|
|
248
|
-
expect(defaults.every((f) => f.value.startsWith("failed: "))).toBe(true);
|
|
249
|
-
expect(payload.hints).toEqual([
|
|
250
|
-
"Fix the cause named above and run 'stigmer bootstrap' again.",
|
|
251
|
-
]);
|
|
252
|
-
});
|
|
253
234
|
});
|
|
@@ -169,13 +169,13 @@ describe("marketplace show", () => {
|
|
|
169
169
|
expect(payload.data.warnings[0].subject).toBe("ghost");
|
|
170
170
|
});
|
|
171
171
|
|
|
172
|
-
it("shows the built-in marketplace
|
|
172
|
+
it("shows the built-in marketplace, which installs nothing by default", async () => {
|
|
173
173
|
const outcome = await run("show", "stigmer", "--json");
|
|
174
174
|
expect(outcome.exitCode).toBe(ExitCode.Success);
|
|
175
175
|
const payload = JSON.parse(outcome.stdout);
|
|
176
|
-
expect(payload.data.marketplace.defaults).toEqual([
|
|
176
|
+
expect(payload.data.marketplace.defaults).toEqual([]);
|
|
177
177
|
expect(payload.data.plugins.map((p: { name: string }) => p.name)).toContain(
|
|
178
|
-
"
|
|
178
|
+
"linear",
|
|
179
179
|
);
|
|
180
180
|
});
|
|
181
181
|
|
package/src/commands/run.ts
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
// reference (smart 0/1/2-arg dispatch mirroring Go's run.go + run_picker.go),
|
|
4
4
|
// then delegate to the shared run stack. Heavy modules (backend client, Ink,
|
|
5
5
|
// the differ) load lazily inside the action so `--help` stays fast (DD-001).
|
|
6
|
+
//
|
|
7
|
+
// No reference at all is the built-in assistant: `stigmer run -m "..."` runs
|
|
8
|
+
// it at once (the person said what to say, so there is nothing to pick), and
|
|
9
|
+
// a bare `stigmer run` on a terminal opens the agent picker with the
|
|
10
|
+
// assistant as its first row. Off a terminal with no message there is
|
|
11
|
+
// nothing to run and the guidance names both forms.
|
|
6
12
|
|
|
7
13
|
import type { Command } from "commander";
|
|
8
14
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
@@ -58,8 +64,13 @@ async function runRun(
|
|
|
58
64
|
|
|
59
65
|
const outputMode = options.json === true ? "json" : "inline";
|
|
60
66
|
|
|
61
|
-
// 0 args →
|
|
67
|
+
// 0 args → the built-in assistant when a message was given; else the
|
|
68
|
+
// interactive agent picker on a TTY; otherwise actionable guidance.
|
|
62
69
|
if (type === undefined) {
|
|
70
|
+
if ((options.message ?? "") !== "") {
|
|
71
|
+
await runResolvedAgent(undefined, options, org, outputMode, client);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
63
74
|
if (interactiveBrowseEnabled(outputMode)) {
|
|
64
75
|
await browseAndRunAgent("", options, org, outputMode, client);
|
|
65
76
|
return;
|
|
@@ -171,8 +182,10 @@ async function runAgent(
|
|
|
171
182
|
await runResolvedAgent(agent, options, org, outputMode, client);
|
|
172
183
|
}
|
|
173
184
|
|
|
185
|
+
// `agent` undefined is the built-in assistant: the execution names no agent
|
|
186
|
+
// and the backend creates a session with no instance.
|
|
174
187
|
async function runResolvedAgent(
|
|
175
|
-
agent: import("@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb").Agent,
|
|
188
|
+
agent: import("@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb").Agent | undefined,
|
|
176
189
|
options: RunFlags,
|
|
177
190
|
org: string,
|
|
178
191
|
outputMode: "inline" | "json",
|
|
@@ -301,7 +314,11 @@ async function browseAndRunAgent(
|
|
|
301
314
|
initialQuery,
|
|
302
315
|
});
|
|
303
316
|
if (selected === undefined) return;
|
|
304
|
-
|
|
317
|
+
if (selected.kind === "built-in-assistant") {
|
|
318
|
+
await runResolvedAgent(undefined, options, org, outputMode, client);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
await runAgent(selected.agent.id, options, org, outputMode, client);
|
|
305
322
|
}
|
|
306
323
|
|
|
307
324
|
// Off a TTY (pipes, CI, --json), the interactive picker can't run, so 0-arg and
|
|
@@ -311,10 +328,13 @@ function browseUnavailableError(query: string): UsageError {
|
|
|
311
328
|
query === ""
|
|
312
329
|
? "Interactive agent browsing requires an interactive terminal"
|
|
313
330
|
: `No agent found for "${query}"`;
|
|
331
|
+
const assistantHint =
|
|
332
|
+
query === "" ? " stigmer run -m <message> (the built-in assistant, no agent)\n" : "";
|
|
314
333
|
return new UsageError(
|
|
315
334
|
`${head}\n\n` +
|
|
316
335
|
"Specify a full agent reference:\n" +
|
|
317
336
|
" stigmer run <org/slug>\n" +
|
|
318
|
-
" stigmer run <agent-id
|
|
337
|
+
" stigmer run <agent-id>\n" +
|
|
338
|
+
assistantHint,
|
|
319
339
|
);
|
|
320
340
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The default plugins a backend is bootstrapped with: the `defaults` list of
|
|
2
2
|
// the official marketplace, installed in order into the system org as
|
|
3
|
-
// public
|
|
4
|
-
//
|
|
3
|
+
// public. The official list is empty today (a session with no agent runs
|
|
4
|
+
// the built-in assistant, so a fresh install needs no default content);
|
|
5
|
+
// the mechanism stays until the bootstrap is re-scoped.
|
|
5
6
|
//
|
|
6
7
|
// Two phases, deliberately separate. Preparing (resolve the official tree,
|
|
7
8
|
// which may acquire `@stigmer/plugins` at the CLI's version; walk, zip and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Pins the CLI's edge for the marketplace reader: a tree read through the one
|
|
2
2
|
// walker, the refusal shape, entry lookup and directory resolution, and the
|
|
3
|
-
// official tree in this repository reading clean with
|
|
3
|
+
// official tree in this repository reading clean with an empty defaults list.
|
|
4
4
|
|
|
5
5
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
@@ -81,14 +81,14 @@ describe("findEntry and entryDirectory", () => {
|
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
describe("the official tree in this repository", () => {
|
|
84
|
-
it("reads clean through the CLI walker and
|
|
84
|
+
it("reads clean through the CLI walker and installs nothing by default", () => {
|
|
85
85
|
const official = resolveOfficialMarketplace();
|
|
86
86
|
expect(official.source).toBe("repo");
|
|
87
87
|
const tree = readMarketplaceTree(official.dir);
|
|
88
88
|
expect(tree.marketplace.name).toBe("stigmer");
|
|
89
89
|
expect(tree.marketplace.dialect).toBe("stigmer");
|
|
90
90
|
expect(tree.warnings).toEqual([]);
|
|
91
|
-
expect(tree.marketplace.defaults).toEqual([
|
|
92
|
-
expect(findEntry(tree.marketplace, "
|
|
91
|
+
expect(tree.marketplace.defaults).toEqual([]);
|
|
92
|
+
expect(findEntry(tree.marketplace, "linear")?.dir).toBe("linear");
|
|
93
93
|
});
|
|
94
94
|
});
|
|
@@ -28,17 +28,26 @@ export interface PickAgentOptions {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* process — the caller decides what to do with the selection.
|
|
31
|
+
* What the agent picker resolved with: an agent the search found, or the
|
|
32
|
+
* built-in assistant (the first row; a session with no agent).
|
|
34
33
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
34
|
+
export type PickedAgent =
|
|
35
|
+
| { readonly kind: "agent"; readonly agent: SearchResult }
|
|
36
|
+
| { readonly kind: "built-in-assistant" };
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Render the agent picker and resolve with the choice, or `undefined` when
|
|
40
|
+
* the user cancels (Esc / Ctrl+C). Never throws and never exits the process
|
|
41
|
+
* — the caller decides what to do with the selection.
|
|
42
|
+
*/
|
|
43
|
+
export async function pickAgent(opts: PickAgentOptions): Promise<PickedAgent | undefined> {
|
|
44
|
+
return runPicker<PickedAgent>(
|
|
37
45
|
(resolve) => (
|
|
38
46
|
<AgentPicker
|
|
39
47
|
org={opts.org}
|
|
40
48
|
initialQuery={opts.initialQuery}
|
|
41
|
-
onSelect={(agent) => resolve(agent)}
|
|
49
|
+
onSelect={(agent) => resolve({ kind: "agent", agent })}
|
|
50
|
+
onSelectBuiltInAssistant={() => resolve({ kind: "built-in-assistant" })}
|
|
42
51
|
onCancel={() => resolve(undefined)}
|
|
43
52
|
/>
|
|
44
53
|
),
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// contract (stigmer/stigmer#249). A workspace-bearing run must issue exactly
|
|
3
3
|
// one create RPC — the AgentExecution carrying session_spec — instead of the
|
|
4
4
|
// old session.create + agentExecution.create pair, and the flow must read the
|
|
5
|
-
// canonical session id back from the returned execution spec.
|
|
6
|
-
//
|
|
5
|
+
// canonical session id back from the returned execution spec. The built-in
|
|
6
|
+
// assistant rides the same flow with no agent at all. Runs use detach mode
|
|
7
|
+
// so no streaming machinery is exercised.
|
|
7
8
|
|
|
8
9
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
9
10
|
import { create } from "@bufbuild/protobuf";
|
|
@@ -130,6 +131,29 @@ describe("executeResolvedAgent", () => {
|
|
|
130
131
|
expect(sent[0]?.spec?.agentId).toBe("agt_1");
|
|
131
132
|
});
|
|
132
133
|
|
|
134
|
+
it("runs the built-in assistant with no agent: an all-empty target and the assistant's name in the header", async () => {
|
|
135
|
+
const { client, creates } = fakeBackend();
|
|
136
|
+
|
|
137
|
+
await executeResolvedAgent({
|
|
138
|
+
agent: undefined,
|
|
139
|
+
prepared: makePrepared({ detach: true }),
|
|
140
|
+
org: "acme",
|
|
141
|
+
downloadDir: "",
|
|
142
|
+
outputMode: "inline",
|
|
143
|
+
client,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const sent = creates();
|
|
147
|
+
expect(sent).toHaveLength(1);
|
|
148
|
+
// Neither an agent nor a session nor a session_spec instance: the backend
|
|
149
|
+
// creates a session with no agent and the runner answers as the assistant.
|
|
150
|
+
expect(sent[0]?.spec?.agentId).toBe("");
|
|
151
|
+
expect(sent[0]?.spec?.sessionId).toBe("");
|
|
152
|
+
expect(sent[0]?.spec?.sessionSpec?.agentInstanceId ?? "").toBe("");
|
|
153
|
+
expect(stderrLines.join("")).toContain("Assistant");
|
|
154
|
+
expect(stderrLines.join("")).toContain("stigmer resume ses_srv");
|
|
155
|
+
});
|
|
156
|
+
|
|
133
157
|
it("threads the resolved harness onto the wire and surfaces it in the header (oss#293)", async () => {
|
|
134
158
|
// The revert-detection seam: if the prepared→create threading is ever
|
|
135
159
|
// dropped, this wire assertion fails — not just a flag-parsing test.
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
// run_agent_exec.go): create the agent execution (one call — a workspace rides
|
|
3
3
|
// the embedded session_spec and the backend bootstraps the session), then
|
|
4
4
|
// either detach (print header + re-attach hint) or stream and optionally
|
|
5
|
-
// download artifacts, for `run`.
|
|
5
|
+
// download artifacts, for `run`. With no agent the same flow runs the
|
|
6
|
+
// built-in assistant: the execution names no agent, the backend creates a
|
|
7
|
+
// session with no instance, and the header shows the assistant's name.
|
|
6
8
|
|
|
7
9
|
import type { Agent } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
10
|
+
import { BUILT_IN_ASSISTANT_NAME } from "@stigmer/sdk";
|
|
8
11
|
import type { BackendClient } from "../../client/index.js";
|
|
9
12
|
import { downloadExecutionArtifacts } from "../download.js";
|
|
10
13
|
import { createAgentExecution } from "./create.js";
|
|
@@ -13,7 +16,8 @@ import type { PreparedRun } from "./prepare.js";
|
|
|
13
16
|
import { streamAgentExecution, type RunOutputMode } from "./stream.js";
|
|
14
17
|
|
|
15
18
|
export interface ResolvedAgentExecInput {
|
|
16
|
-
|
|
19
|
+
/** The agent to run; undefined is the built-in assistant. */
|
|
20
|
+
readonly agent: Agent | undefined;
|
|
17
21
|
readonly prepared: PreparedRun;
|
|
18
22
|
readonly org: string;
|
|
19
23
|
/** Artifact download directory; "" skips download. */
|
|
@@ -31,9 +35,10 @@ export async function executeResolvedAgent(input: ResolvedAgentExecInput): Promi
|
|
|
31
35
|
// One call: workspace entries ride the embedded session_spec
|
|
32
36
|
// (stigmer/stigmer#249), so the backend bootstraps the session — resolving
|
|
33
37
|
// the agent's default instance server-side (auto-creating it if missing,
|
|
34
|
-
// which a client-side lookup could not)
|
|
38
|
+
// which a client-side lookup could not), or binding no agent at all for
|
|
39
|
+
// the built-in assistant — and dispatches the message.
|
|
35
40
|
const execution = await createAgentExecution(controller, {
|
|
36
|
-
agentId: input.agent
|
|
41
|
+
agentId: input.agent?.metadata?.id,
|
|
37
42
|
orgId: org,
|
|
38
43
|
message: prepared.message,
|
|
39
44
|
runtimeEnv: prepared.runtimeEnv,
|
|
@@ -53,7 +58,7 @@ export async function executeResolvedAgent(input: ResolvedAgentExecInput): Promi
|
|
|
53
58
|
const sessionId = execution.spec?.sessionId ?? "";
|
|
54
59
|
|
|
55
60
|
const header: SessionHeaderInfo = {
|
|
56
|
-
agentName: input.agent
|
|
61
|
+
agentName: input.agent?.metadata?.name ?? BUILT_IN_ASSISTANT_NAME,
|
|
57
62
|
sessionId,
|
|
58
63
|
model: prepared.model,
|
|
59
64
|
mode: prepared.mode,
|
|
@@ -39,9 +39,10 @@ const API_VERSION = "agentic.stigmer.ai/v1";
|
|
|
39
39
|
export type ControllerFn = <Desc extends DescService>(service: Desc) => Client<Desc>;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Inputs for creating an agent execution.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* Inputs for creating an agent execution. agentId-only starts a new
|
|
43
|
+
* backend-managed session, sessionId threads a follow-up, both pins the agent
|
|
44
|
+
* within an existing session, and neither starts a new session with no agent:
|
|
45
|
+
* the built-in assistant.
|
|
45
46
|
*
|
|
46
47
|
* workspaceEntries ride the one-call bootstrap (spec.session_spec,
|
|
47
48
|
* stigmer/stigmer#249) and shape the auto-created session; they are mutually
|