@stigmer/cli 3.4.0 → 3.4.1
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/setup.d.ts.map +1 -1
- package/commands/setup.js +11 -16
- package/commands/setup.js.map +1 -1
- package/local/daemon/components.d.ts.map +1 -1
- package/local/daemon/components.js +3 -2
- package/local/daemon/components.js.map +1 -1
- package/local/daemon/env.d.ts +0 -3
- package/local/daemon/env.d.ts.map +1 -1
- package/local/daemon/env.js +4 -8
- package/local/daemon/env.js.map +1 -1
- package/local/daemon/launch.d.ts.map +1 -1
- package/local/daemon/launch.js +9 -17
- package/local/daemon/launch.js.map +1 -1
- package/local/llm-config.d.ts +7 -7
- package/local/llm-config.d.ts.map +1 -1
- package/local/llm-config.js +29 -42
- package/local/llm-config.js.map +1 -1
- package/local/setup/wizard.d.ts +16 -7
- package/local/setup/wizard.d.ts.map +1 -1
- package/local/setup/wizard.js +41 -44
- package/local/setup/wizard.js.map +1 -1
- package/local/status.d.ts.map +1 -1
- package/local/status.js +16 -15
- package/local/status.js.map +1 -1
- package/package.json +5 -5
- package/resources/list.d.ts.map +1 -1
- package/resources/list.js +70 -4
- package/resources/list.js.map +1 -1
- package/src/commands/setup.ts +13 -20
- package/src/local/daemon/components.test.ts +8 -2
- package/src/local/daemon/components.ts +3 -1
- package/src/local/daemon/env.test.ts +13 -6
- package/src/local/daemon/env.ts +10 -13
- package/src/local/daemon/launch.ts +9 -17
- package/src/local/llm-config.test.ts +16 -27
- package/src/local/llm-config.ts +27 -41
- package/src/local/setup/wizard.test.ts +19 -11
- package/src/local/setup/wizard.ts +42 -47
- package/src/local/status.test.ts +20 -0
- package/src/local/status.ts +17 -15
- package/src/resources/list.ts +76 -4
- package/src/resources/read-verbs.integration.test.ts +127 -3
package/local/setup/wizard.js
CHANGED
|
@@ -1,65 +1,62 @@
|
|
|
1
1
|
// LLM provider selection for `stigmer setup`.
|
|
2
2
|
//
|
|
3
3
|
// The decision logic is a pure function (`buildLlmForChoice`) shared by the
|
|
4
|
-
// non-interactive flag path and the interactive
|
|
5
|
-
// config and the rules are unit-testable in isolation.
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
// non-interactive flag path and the interactive prompt, so both produce
|
|
5
|
+
// identical config and the rules are unit-testable in isolation.
|
|
6
|
+
//
|
|
7
|
+
// Local agent execution is Anthropic-only (the native runner only constructs
|
|
8
|
+
// Anthropic clients and the registry's native entries are Anthropic models),
|
|
9
|
+
// so the interactive flow is a single API-key prompt rather than a provider
|
|
10
|
+
// menu. The model is deliberately NOT asked for: the platform model registry
|
|
11
|
+
// owns the execution default, and an explicit override is a power-user flag
|
|
12
|
+
// (`stigmer setup --model …`), not a setup question.
|
|
13
|
+
import { setLlm } from "../llm-config.js";
|
|
14
|
+
import { promptSecret } from "./prompt.js";
|
|
15
|
+
/**
|
|
16
|
+
* The providers `stigmer setup` accepts. This is the single source of truth
|
|
17
|
+
* for the CLI's local-provider surface — `setup --provider` validates against
|
|
18
|
+
* it and a regression test pins it, because every entry here promises an
|
|
19
|
+
* execution path the native runner must actually serve.
|
|
20
|
+
*/
|
|
21
|
+
export const PROVIDER_CHOICES = ["anthropic", "skip"];
|
|
10
22
|
/**
|
|
11
23
|
* Resolve a provider choice (plus optional overrides) to the LLM settings to
|
|
12
|
-
* persist. "skip" yields `undefined`, which clears the section.
|
|
24
|
+
* persist. "skip" yields `undefined`, which clears the section. An omitted
|
|
25
|
+
* model is stored as absent — meaning "platform default", resolved from the
|
|
26
|
+
* model registry at execution time.
|
|
13
27
|
*/
|
|
14
28
|
export function buildLlmForChoice(choice, inputs = {}) {
|
|
15
29
|
if (choice === "skip")
|
|
16
30
|
return undefined;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
model
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
const settings = { provider: choice };
|
|
32
|
+
if (inputs.model)
|
|
33
|
+
settings.model = inputs.model;
|
|
34
|
+
if (inputs.apiKey)
|
|
35
|
+
settings.api_key = inputs.apiKey;
|
|
36
|
+
return settings;
|
|
23
37
|
}
|
|
24
38
|
/** Apply a provider choice to a config, returning the updated copy. */
|
|
25
39
|
export function applyChoice(config, choice, inputs = {}) {
|
|
26
40
|
return setLlm(config, buildLlmForChoice(choice, inputs));
|
|
27
41
|
}
|
|
28
42
|
/**
|
|
29
|
-
* Run the interactive
|
|
30
|
-
*
|
|
31
|
-
*
|
|
43
|
+
* Run the interactive setup against the current terminal: one Anthropic
|
|
44
|
+
* API-key prompt. A key already in the environment is used without prompting
|
|
45
|
+
* (and never persisted — env precedence makes a copy redundant); an empty
|
|
46
|
+
* entry is an explicit skip.
|
|
32
47
|
*/
|
|
33
48
|
export async function runInteractiveWizard(config, env = process.env) {
|
|
34
|
-
process.stderr.write("\
|
|
35
|
-
process.stderr.write("
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
for (;;) {
|
|
40
|
-
const choice = (await promptLine("Select [1-4]: ")).trim();
|
|
41
|
-
switch (choice) {
|
|
42
|
-
case "1":
|
|
43
|
-
return applyChoice(config, "anthropic", { apiKey: await resolveCloudKey("anthropic", env) });
|
|
44
|
-
case "2":
|
|
45
|
-
return applyChoice(config, "openai", { apiKey: await resolveCloudKey("openai", env) });
|
|
46
|
-
case "3":
|
|
47
|
-
return applyChoice(config, "ollama");
|
|
48
|
-
case "4":
|
|
49
|
-
return applyChoice(config, "skip");
|
|
50
|
-
default:
|
|
51
|
-
process.stderr.write("Invalid choice. Please enter 1, 2, 3, or 4.\n");
|
|
52
|
-
}
|
|
49
|
+
process.stderr.write("\nStigmer runs local agents on Anthropic Claude models.\n");
|
|
50
|
+
process.stderr.write("The model is chosen automatically from the platform model registry.\n\n");
|
|
51
|
+
if (env.ANTHROPIC_API_KEY) {
|
|
52
|
+
process.stderr.write("Using ANTHROPIC_API_KEY from environment\n");
|
|
53
|
+
return applyChoice(config, "anthropic");
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (existing) {
|
|
59
|
-
process.stderr.write(`Using ${envVar} from environment\n`);
|
|
60
|
-
return undefined; // env var takes precedence; do not persist a copy
|
|
55
|
+
const key = (await promptSecret("Enter your Anthropic API key (press Enter to skip)")).trim();
|
|
56
|
+
if (key === "") {
|
|
57
|
+
process.stderr.write("Skipped. Agents won't execute until a provider is configured (stigmer setup).\n");
|
|
58
|
+
return applyChoice(config, "skip");
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
return key === "" ? undefined : key;
|
|
60
|
+
return applyChoice(config, "anthropic", { apiKey: key });
|
|
64
61
|
}
|
|
65
62
|
//# sourceMappingURL=wizard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard.js","sourceRoot":"","sources":["../../../src/local/setup/wizard.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"wizard.js","sourceRoot":"","sources":["../../../src/local/setup/wizard.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,iEAAiE;AACjE,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,qDAAqD;AAGrD,OAAO,EAAoB,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,CAAU,CAAC;AAS/D;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAsB,EAAE,SAA0B,EAAE;IACpF,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,QAAQ,GAAgB,EAAE,QAAQ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
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/local/status.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAkB5D;wEACwE;AACxE,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAI3D,oEAAoE;AACpE,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,MAAkB,EAAE,KAAK,GAAE,SAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmCzH;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/local/status.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAkB5D;wEACwE;AACxE,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAI3D,oEAAoE;AACpE,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,MAAkB,EAAE,KAAK,GAAE,SAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmCzH;AAsGD,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAWjD"}
|
package/local/status.js
CHANGED
|
@@ -73,7 +73,7 @@ function addComponentSection(result, name, label, component) {
|
|
|
73
73
|
const state = component.state || "unknown";
|
|
74
74
|
let status = `${displayState(state)} ${symbolFor(state)}`;
|
|
75
75
|
// The runner reports observed readiness (it polls its Temporal queue) on top
|
|
76
|
-
// of mere liveness —
|
|
76
|
+
// of mere liveness — a live process that hasn't connected yet is "starting".
|
|
77
77
|
if (name === "runner" && state === "running") {
|
|
78
78
|
status += component.ready === true ? " (polling)" : " (starting)";
|
|
79
79
|
}
|
|
@@ -101,21 +101,22 @@ function addLlmSection(result, home) {
|
|
|
101
101
|
result.hint("Configure a provider: stigmer setup");
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
section.field("Provider", provider === "anthropic" ? "Anthropic (Cloud)" : "OpenAI (Cloud)");
|
|
113
|
-
section.field("Model", model);
|
|
114
|
-
section.field("API Key", resolveApiKey(config) !== "" ? "Configured ✓" : "Not configured ✗");
|
|
115
|
-
break;
|
|
116
|
-
default:
|
|
117
|
-
section.field("Provider", `Unknown (${provider})`);
|
|
104
|
+
// Anthropic is the only provider local execution supports. Anything else in
|
|
105
|
+
// the config (hand-edited, or left over from an older CLI) is reported as
|
|
106
|
+
// unknown rather than pretended to work.
|
|
107
|
+
if (provider !== "anthropic") {
|
|
108
|
+
section.field("Provider", `Unknown (${provider})`);
|
|
109
|
+
section.field("Status", "Agents will not execute");
|
|
110
|
+
result.hint("Reconfigure the provider: stigmer setup");
|
|
111
|
+
return;
|
|
118
112
|
}
|
|
113
|
+
// An unset model is not a gap: the platform model registry picks the
|
|
114
|
+
// execution default, so the CLI reports that truthfully instead of asserting
|
|
115
|
+
// a version it does not control.
|
|
116
|
+
const model = resolveModel(config);
|
|
117
|
+
section.field("Provider", "Anthropic (Cloud)");
|
|
118
|
+
section.field("Model", model !== "" ? model : "Auto (platform default)");
|
|
119
|
+
section.field("API Key", resolveApiKey(config) !== "" ? "Configured ✓" : "Not configured ✗");
|
|
119
120
|
}
|
|
120
121
|
function addWebUiSection(result, health) {
|
|
121
122
|
const temporalRunning = health.components.temporal?.state === "running";
|
package/local/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/local/status.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,6BAA6B;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,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AAK,CAAC,CAAC,YAAY,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,YAAY,GAAG,EAAE,CAAC;IAElC,IAAI,IAAI,GAAG,CAAC;QAAE,OAAO,GAAG,IAAI,KAAK,KAAK,GAAG,CAAC;IAC1C,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,GAAG,KAAK,KAAK,OAAO,GAAG,CAAC;IAC9C,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,GAAG,OAAO,KAAK,OAAO,GAAG,CAAC;IAClD,OAAO,GAAG,OAAO,GAAG,CAAC;AACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/cli",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
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,10 +35,10 @@
|
|
|
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.4.
|
|
39
|
-
"@stigmer/mcp-server": "3.4.
|
|
40
|
-
"@stigmer/protos": "3.4.
|
|
41
|
-
"@stigmer/sdk": "3.4.
|
|
38
|
+
"@stigmer/ink": "3.4.1",
|
|
39
|
+
"@stigmer/mcp-server": "3.4.1",
|
|
40
|
+
"@stigmer/protos": "3.4.1",
|
|
41
|
+
"@stigmer/sdk": "3.4.1",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"fflate": "^0.8.3",
|
|
44
44
|
"ink": "^7.0.0",
|
package/resources/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/resources/list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/resources/list.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAKtH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAqD,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAkBjG,wBAAsB,aAAa,CACjC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAGD,eAAO,MAAM,YAAY,EAAE,UAS1B,CAAC"}
|
package/resources/list.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
// `list` dispatch: render a collection of resources for a kind.
|
|
2
2
|
//
|
|
3
3
|
// Most registry kinds are search-indexed and list through the unified
|
|
4
|
-
// SearchService
|
|
5
|
-
// API keys,
|
|
6
|
-
// dedicated find/list RPCs.
|
|
4
|
+
// SearchService. Kinds that are deliberately not search-indexed
|
|
5
|
+
// (organizations, API keys, agent instances, agent channels, channel apps)
|
|
6
|
+
// use their dedicated find/list RPCs with bespoke table shapes.
|
|
7
7
|
import { create } from "@bufbuild/protobuf";
|
|
8
|
+
import { AgentChannelSchema } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/api_pb";
|
|
9
|
+
import { ListAgentChannelsRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/io_pb";
|
|
8
10
|
import { AgentInstanceSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/api_pb";
|
|
9
11
|
import { ListAgentInstancesRequestSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/io_pb";
|
|
12
|
+
import { ChannelAppSchema } from "@stigmer/protos/ai/stigmer/agentic/channelapp/v1/api_pb";
|
|
13
|
+
import { ListChannelAppsByOrgInputSchema } from "@stigmer/protos/ai/stigmer/agentic/channelapp/v1/io_pb";
|
|
10
14
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
11
15
|
import { PageInfoSchema } from "@stigmer/protos/ai/stigmer/commons/rpc/pagination_pb";
|
|
12
16
|
import { ApiKeySchema } from "@stigmer/protos/ai/stigmer/iam/apikey/v1/api_pb";
|
|
@@ -14,7 +18,12 @@ import { SearchResultSchema } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
|
|
|
14
18
|
import { OrganizationSchema } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
15
19
|
import { UsageError } from "../errors/index.js";
|
|
16
20
|
import { bool, obj, renderCollection, str } from "./render.js";
|
|
17
|
-
// Kinds
|
|
21
|
+
// Kinds that list through the SearchService (list mode: empty query, org
|
|
22
|
+
// scope). Must stay in step with the server's SearchableKinds allowlist
|
|
23
|
+
// (backend/services/stigmer-server/pkg/query/search/valueobject/
|
|
24
|
+
// search_criteria.go): a kind present here but absent there silently lists
|
|
25
|
+
// as empty. agent_channel and channel_app are deliberately NOT here — they
|
|
26
|
+
// are not_search_indexed by design and take dedicated-RPC branches below.
|
|
18
27
|
const SEARCH_KINDS = new Set([
|
|
19
28
|
ApiResourceKind.agent,
|
|
20
29
|
ApiResourceKind.workflow,
|
|
@@ -22,6 +31,7 @@ const SEARCH_KINDS = new Set([
|
|
|
22
31
|
ApiResourceKind.project,
|
|
23
32
|
ApiResourceKind.skill,
|
|
24
33
|
ApiResourceKind.datastore,
|
|
34
|
+
ApiResourceKind.environment,
|
|
25
35
|
]);
|
|
26
36
|
export async function listResources(client, kind, org, limit, format) {
|
|
27
37
|
if (kind === ApiResourceKind.organization) {
|
|
@@ -36,6 +46,17 @@ export async function listResources(client, kind, org, limit, format) {
|
|
|
36
46
|
const result = await client.agentInstance.list(create(ListAgentInstancesRequestSchema, { org, pageInfo: create(PageInfoSchema, { num: 1, size: limit }) }));
|
|
37
47
|
return renderCollection(AgentInstanceSchema, result.items, format, INSTANCE_TABLE);
|
|
38
48
|
}
|
|
49
|
+
if (kind === ApiResourceKind.agent_channel) {
|
|
50
|
+
const result = await client.agentChannel.list(create(ListAgentChannelsRequestSchema, { org, pageInfo: create(PageInfoSchema, { num: 1, size: limit }) }));
|
|
51
|
+
return renderCollection(AgentChannelSchema, result.items, format, AGENT_CHANNEL_TABLE);
|
|
52
|
+
}
|
|
53
|
+
if (kind === ApiResourceKind.channel_app) {
|
|
54
|
+
// listByOrg has no pagination on its contract (the per-org set is small
|
|
55
|
+
// by design); the limit is applied client-side so --limit stays honest.
|
|
56
|
+
// `channelapp` (not `channelApp`) is a recorded SDK codegen naming quirk.
|
|
57
|
+
const result = await client.channelapp.listByOrg(create(ListChannelAppsByOrgInputSchema, { org }));
|
|
58
|
+
return renderCollection(ChannelAppSchema, result.entries.slice(0, limit), format, CHANNEL_APP_TABLE);
|
|
59
|
+
}
|
|
39
60
|
if (!SEARCH_KINDS.has(kind)) {
|
|
40
61
|
throw new UsageError("list is not implemented for this resource type");
|
|
41
62
|
}
|
|
@@ -67,6 +88,51 @@ const INSTANCE_TABLE = {
|
|
|
67
88
|
];
|
|
68
89
|
},
|
|
69
90
|
};
|
|
91
|
+
// A channel serves traffic only when installed AND enabled (the install
|
|
92
|
+
// lifecycle and the owner's serving switch are deliberately distinct), so
|
|
93
|
+
// the table surfaces both signals side by side.
|
|
94
|
+
const AGENT_CHANNEL_TABLE = {
|
|
95
|
+
resourceName: "agent channels",
|
|
96
|
+
headers: ["ID", "SLUG", "AGENT", "PROVIDER", "STATE", "ENABLED"],
|
|
97
|
+
row: (json) => {
|
|
98
|
+
const metadata = obj(json, "metadata");
|
|
99
|
+
const spec = obj(json, "spec");
|
|
100
|
+
const agentRef = obj(spec, "agent_ref");
|
|
101
|
+
return [
|
|
102
|
+
str(metadata, "id"),
|
|
103
|
+
str(metadata, "slug"),
|
|
104
|
+
`${str(agentRef, "org")}/${str(agentRef, "slug")}`,
|
|
105
|
+
providerOf(spec),
|
|
106
|
+
// Zero-valued enums are omitted from protojson; a channel is
|
|
107
|
+
// initialized to pending_install on create, so "-" is the rare
|
|
108
|
+
// unspecified case, matching the date() empty convention.
|
|
109
|
+
str(obj(json, "status"), "install_state") || "-",
|
|
110
|
+
bool(spec, "enabled") ? "true" : "false",
|
|
111
|
+
];
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
// Secret fields never reach this table: list responses are redacted
|
|
115
|
+
// server-side in both editions (the RedactChannelApp pipeline).
|
|
116
|
+
const CHANNEL_APP_TABLE = {
|
|
117
|
+
resourceName: "channel apps",
|
|
118
|
+
headers: ["ID", "SLUG", "PROVIDER", "CREATED"],
|
|
119
|
+
row: (json) => {
|
|
120
|
+
const metadata = obj(json, "metadata");
|
|
121
|
+
return [
|
|
122
|
+
str(metadata, "id"),
|
|
123
|
+
str(metadata, "slug"),
|
|
124
|
+
providerOf(obj(json, "spec")),
|
|
125
|
+
date(str(obj(obj(obj(json, "status"), "audit"), "spec_audit"), "created_at")),
|
|
126
|
+
];
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
// The provider_config oneof serializes as exactly one provider-named key in
|
|
130
|
+
// protojson (AgentChannelSpec and ChannelAppSpec share the same oneof
|
|
131
|
+
// shape). Extend this list when a new provider arm lands in the protos.
|
|
132
|
+
const PROVIDER_KEYS = ["slack", "whatsapp"];
|
|
133
|
+
function providerOf(spec) {
|
|
134
|
+
return PROVIDER_KEYS.find((key) => key in spec) ?? "-";
|
|
135
|
+
}
|
|
70
136
|
const ORG_TABLE = {
|
|
71
137
|
resourceName: "organizations",
|
|
72
138
|
headers: ["NAME", "SLUG", "ID"],
|
package/resources/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/resources/list.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,sEAAsE;AACtE,2EAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/resources/list.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,sEAAsE;AACtE,gEAAgE;AAChE,2EAA2E;AAC3E,gEAAgE;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC/F,OAAO,EAAE,8BAA8B,EAAE,MAAM,0DAA0D,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AACjG,OAAO,EAAE,+BAA+B,EAAE,MAAM,2DAA2D,CAAC;AAC5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAmB,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAmB,MAAM,aAAa,CAAC;AAEjG,yEAAyE;AACzE,wEAAwE;AACxE,iEAAiE;AACjE,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AAC1E,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AAC;SACnB,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,IAAgB;IACpC,IAAI,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC;QAAE,OAAO,OAAO,CAAC;IAChD,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC1C,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,OAAO,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;AACnF,CAAC;AAED,SAAS,IAAI,CAAC,SAAiB;IAC7B,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACzD,CAAC"}
|
package/src/commands/setup.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// `stigmer setup` — configure the LLM provider used for agent execution.
|
|
2
2
|
//
|
|
3
3
|
// Two paths share one decision core (local/setup/wizard.ts): a non-interactive
|
|
4
|
-
// flag path (`--provider`, `--api-key`,
|
|
5
|
-
// interactive
|
|
6
|
-
// backend.local.llm, preserving every other config field.
|
|
4
|
+
// flag path (`--provider`, `--api-key`, `--model`) for scripts and CI, and an
|
|
5
|
+
// interactive API-key prompt when no provider flag is given. Both write to
|
|
6
|
+
// backend.local.llm, preserving every other config field. The valid provider
|
|
7
|
+
// set is owned by wizard.ts's PROVIDER_CHOICES (Anthropic-only + skip — the
|
|
8
|
+
// only story the native runner serves).
|
|
7
9
|
|
|
8
10
|
import type { Command } from "commander";
|
|
9
11
|
import { homedir } from "node:os";
|
|
@@ -14,51 +16,42 @@ interface SetupFlags extends OutputFlags {
|
|
|
14
16
|
provider?: string;
|
|
15
17
|
model?: string;
|
|
16
18
|
apiKey?: string;
|
|
17
|
-
baseUrl?: string;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
const PROVIDERS = ["anthropic", "openai", "ollama", "skip"] as const;
|
|
21
|
-
|
|
22
21
|
export function registerSetup(program: Command): void {
|
|
23
22
|
const setup = program
|
|
24
23
|
.command("setup")
|
|
25
24
|
.description("configure the LLM provider for agent execution")
|
|
26
|
-
.option("--provider <name>", "provider: anthropic,
|
|
27
|
-
.option("--model <name>", "model
|
|
28
|
-
.option("--api-key <key>", "API key
|
|
29
|
-
.option("--base-url <url>", "custom base URL (e.g. an Ollama endpoint)")
|
|
25
|
+
.option("--provider <name>", "provider: anthropic, or skip to clear (non-interactive)")
|
|
26
|
+
.option("--model <name>", "pin a specific model (defaults to the platform-selected model)")
|
|
27
|
+
.option("--api-key <key>", "Anthropic API key")
|
|
30
28
|
.action((options: SetupFlags) => runSetup(options));
|
|
31
29
|
addResultFlags(setup);
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
async function runSetup(options: SetupFlags): Promise<void> {
|
|
35
33
|
const { load, save } = await import("../config/config.js");
|
|
36
|
-
const { applyChoice, runInteractiveWizard } = await import("../local/setup/wizard.js");
|
|
34
|
+
const { PROVIDER_CHOICES, applyChoice, runInteractiveWizard } = await import("../local/setup/wizard.js");
|
|
37
35
|
const { isRunning } = await import("../local/daemon/launch.js");
|
|
38
36
|
const { CliExitError } = await import("../errors/cli-exit-error.js");
|
|
39
37
|
const { ExitCode } = await import("../errors/exit-codes.js");
|
|
40
38
|
|
|
41
39
|
const config = load();
|
|
42
40
|
|
|
43
|
-
let updated: typeof config
|
|
41
|
+
let updated: typeof config;
|
|
44
42
|
if (options.provider !== undefined) {
|
|
45
43
|
const provider = options.provider.toLowerCase();
|
|
46
|
-
if (!
|
|
44
|
+
if (!(PROVIDER_CHOICES as readonly string[]).includes(provider)) {
|
|
47
45
|
throw new CliExitError(`unknown provider: ${options.provider}`, ExitCode.Usage, [
|
|
48
|
-
`Valid providers: ${
|
|
46
|
+
`Valid providers: ${PROVIDER_CHOICES.join(", ")}`,
|
|
49
47
|
]);
|
|
50
48
|
}
|
|
51
|
-
updated = applyChoice(config, provider as (typeof
|
|
49
|
+
updated = applyChoice(config, provider as (typeof PROVIDER_CHOICES)[number], {
|
|
52
50
|
model: options.model,
|
|
53
51
|
apiKey: options.apiKey,
|
|
54
|
-
baseUrl: options.baseUrl,
|
|
55
52
|
});
|
|
56
53
|
} else {
|
|
57
54
|
updated = await runInteractiveWizard(config);
|
|
58
|
-
if (updated === null) {
|
|
59
|
-
renderResult(CommandResult.warning("Setup cancelled"), resultFormat(options));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
55
|
}
|
|
63
56
|
|
|
64
57
|
save(updated);
|
|
@@ -47,10 +47,9 @@ describe("buildRunnerEnv", () => {
|
|
|
47
47
|
expect(withKey.STIGMER_ACTIVITY_ROUTING).toBe("session");
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
it("forwards
|
|
50
|
+
it("forwards the Anthropic key only when set, resolved value winning over the base env", () => {
|
|
51
51
|
const bare = buildRunnerEnv(config, {});
|
|
52
52
|
expect(bare.ANTHROPIC_API_KEY).toBeUndefined();
|
|
53
|
-
expect(bare.OPENAI_API_KEY).toBeUndefined();
|
|
54
53
|
|
|
55
54
|
// The contract value is authoritative: the launcher already applied the
|
|
56
55
|
// env > config precedence, so whatever sits in the child's base env must
|
|
@@ -62,6 +61,13 @@ describe("buildRunnerEnv", () => {
|
|
|
62
61
|
expect(env.ANTHROPIC_API_KEY).toBe("sk-ant-resolved");
|
|
63
62
|
});
|
|
64
63
|
|
|
64
|
+
// Anthropic is the only key with a contract slot; other provider keys (for
|
|
65
|
+
// advanced per-agent overrides) flow through shell-env inheritance untouched.
|
|
66
|
+
it("passes other shell-exported provider keys through via the base env spread", () => {
|
|
67
|
+
const env = buildRunnerEnv(config, { OPENAI_API_KEY: "sk-oai-shell" });
|
|
68
|
+
expect(env.OPENAI_API_KEY).toBe("sk-oai-shell");
|
|
69
|
+
});
|
|
70
|
+
|
|
65
71
|
// The regression guard for the queue bug: the server dispatches to, and the
|
|
66
72
|
// runner polls, the exact same queue.
|
|
67
73
|
it("pins the runner's poll queue to the server's dispatch queue", () => {
|
|
@@ -53,8 +53,10 @@ export function buildRunnerEnv(config: DaemonConfig, base: NodeJS.ProcessEnv = p
|
|
|
53
53
|
if (config.cursorApiKey !== undefined) env.CURSOR_API_KEY = config.cursorApiKey;
|
|
54
54
|
// Explicit set (after the base spread) so the launcher-resolved key wins over any
|
|
55
55
|
// stale inherited value — the delivery path for a `stigmer setup`-persisted key.
|
|
56
|
+
// Anthropic only: it is the sole provider local execution supports. Other keys
|
|
57
|
+
// (e.g. a shell-exported OPENAI_API_KEY for advanced per-agent gpt-* overrides)
|
|
58
|
+
// still reach the runner through the base env spread above.
|
|
56
59
|
if (config.anthropicApiKey !== undefined) env.ANTHROPIC_API_KEY = config.anthropicApiKey;
|
|
57
|
-
if (config.openaiApiKey !== undefined) env.OPENAI_API_KEY = config.openaiApiKey;
|
|
58
60
|
if (config.activityRouting !== undefined) env.STIGMER_ACTIVITY_ROUTING = config.activityRouting;
|
|
59
61
|
return env;
|
|
60
62
|
}
|
|
@@ -27,7 +27,6 @@ describe("buildDaemonEnv + readDaemonConfig", () => {
|
|
|
27
27
|
runner: { nodeBin: "/usr/bin/node", entryPath: "/repo/runner/dist/main.js", appDir: "/repo/runner" },
|
|
28
28
|
cursorApiKey: undefined,
|
|
29
29
|
anthropicApiKey: undefined,
|
|
30
|
-
openaiApiKey: undefined,
|
|
31
30
|
activityRouting: undefined,
|
|
32
31
|
});
|
|
33
32
|
});
|
|
@@ -48,18 +47,26 @@ describe("buildDaemonEnv + readDaemonConfig", () => {
|
|
|
48
47
|
|
|
49
48
|
// The config-file-only delivery path: a key from `stigmer setup` is not in the
|
|
50
49
|
// shell env, so the launcher must write it into the contract explicitly.
|
|
51
|
-
|
|
50
|
+
// Anthropic is the only provider with this path — the local stack executes
|
|
51
|
+
// on Anthropic only.
|
|
52
|
+
it("delivers a launcher-resolved Anthropic key with no help from the base env", () => {
|
|
52
53
|
const env = buildDaemonEnv({ ...baseInputs, anthropicApiKey: "sk-ant-cfg" }, {});
|
|
53
54
|
const config = readDaemonConfig(env);
|
|
54
55
|
expect(config.anthropicApiKey).toBe("sk-ant-cfg");
|
|
55
|
-
expect(config.openaiApiKey).toBeUndefined();
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
it("passes shell-exported
|
|
59
|
-
const env = buildDaemonEnv(baseInputs, { ANTHROPIC_API_KEY: "sk-ant-env"
|
|
58
|
+
it("passes a shell-exported Anthropic key through from the base env", () => {
|
|
59
|
+
const env = buildDaemonEnv(baseInputs, { ANTHROPIC_API_KEY: "sk-ant-env" });
|
|
60
60
|
const config = readDaemonConfig(env);
|
|
61
61
|
expect(config.anthropicApiKey).toBe("sk-ant-env");
|
|
62
|
-
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Other provider keys have no contract slot; they reach the runner solely via
|
|
65
|
+
// shell-env inheritance (the child env spreads the base env).
|
|
66
|
+
it("leaves shell-exported non-Anthropic keys in the env without parsing them", () => {
|
|
67
|
+
const env = buildDaemonEnv(baseInputs, { OPENAI_API_KEY: "sk-oai-env" });
|
|
68
|
+
expect(env.OPENAI_API_KEY).toBe("sk-oai-env");
|
|
69
|
+
expect(readDaemonConfig(env)).not.toHaveProperty("openaiApiKey");
|
|
63
70
|
});
|
|
64
71
|
|
|
65
72
|
it("requires the data dir and server binary", () => {
|
package/src/local/daemon/env.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The foreground launcher hands the supervised daemon everything it needs to
|
|
2
|
-
// run through the environment
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// run through the environment. Centralizing the variable names and the
|
|
3
|
+
// (de)serialization here keeps that contract in one place: the launcher writes
|
|
4
|
+
// it with buildDaemonEnv, the daemon reads it with readDaemonConfig, and
|
|
5
|
+
// nothing in between guesses at string keys.
|
|
6
6
|
|
|
7
7
|
/** Environment variable names that make up the launcher -> daemon contract. */
|
|
8
8
|
export const DaemonEnvVar = {
|
|
@@ -18,7 +18,6 @@ export const DaemonEnvVar = {
|
|
|
18
18
|
RunnerAppDir: "STIGMER_RUNNER_APP_DIR",
|
|
19
19
|
CursorApiKey: "CURSOR_API_KEY",
|
|
20
20
|
AnthropicApiKey: "ANTHROPIC_API_KEY",
|
|
21
|
-
OpenAiApiKey: "OPENAI_API_KEY",
|
|
22
21
|
ActivityRouting: "STIGMER_ACTIVITY_ROUTING",
|
|
23
22
|
} as const;
|
|
24
23
|
|
|
@@ -41,7 +40,6 @@ export interface DaemonConfig {
|
|
|
41
40
|
runner?: RunnerLaunch;
|
|
42
41
|
cursorApiKey?: string;
|
|
43
42
|
anthropicApiKey?: string;
|
|
44
|
-
openaiApiKey?: string;
|
|
45
43
|
activityRouting?: string;
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -55,12 +53,13 @@ export interface DaemonEnvInputs {
|
|
|
55
53
|
noWeb: boolean;
|
|
56
54
|
serverBin: string;
|
|
57
55
|
runner?: RunnerLaunch;
|
|
58
|
-
//
|
|
59
|
-
// into the daemon env explicitly: unlike a shell-exported key, a key
|
|
60
|
-
// `stigmer setup` exists only in the config file and would
|
|
61
|
-
// the runner.
|
|
56
|
+
// Anthropic API key resolved by the launcher (env > config file). Must be
|
|
57
|
+
// written into the daemon env explicitly: unlike a shell-exported key, a key
|
|
58
|
+
// persisted by `stigmer setup` exists only in the config file and would
|
|
59
|
+
// otherwise never reach the runner. Anthropic is the only provider with a
|
|
60
|
+
// persisted delivery path — other keys (OPENAI_API_KEY, CURSOR_API_KEY)
|
|
61
|
+
// reach the runner solely via shell-env inheritance.
|
|
62
62
|
anthropicApiKey?: string;
|
|
63
|
-
openaiApiKey?: string;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
/**
|
|
@@ -83,7 +82,6 @@ export function buildDaemonEnv(inputs: DaemonEnvInputs, base: NodeJS.ProcessEnv
|
|
|
83
82
|
env[DaemonEnvVar.RunnerAppDir] = inputs.runner.appDir;
|
|
84
83
|
}
|
|
85
84
|
if (inputs.anthropicApiKey !== undefined) env[DaemonEnvVar.AnthropicApiKey] = inputs.anthropicApiKey;
|
|
86
|
-
if (inputs.openaiApiKey !== undefined) env[DaemonEnvVar.OpenAiApiKey] = inputs.openaiApiKey;
|
|
87
85
|
return env;
|
|
88
86
|
}
|
|
89
87
|
|
|
@@ -106,7 +104,6 @@ export function readDaemonConfig(env: NodeJS.ProcessEnv = process.env): DaemonCo
|
|
|
106
104
|
runner: serverOnly ? undefined : runner,
|
|
107
105
|
cursorApiKey: nonEmpty(env[DaemonEnvVar.CursorApiKey]),
|
|
108
106
|
anthropicApiKey: nonEmpty(env[DaemonEnvVar.AnthropicApiKey]),
|
|
109
|
-
openaiApiKey: nonEmpty(env[DaemonEnvVar.OpenAiApiKey]),
|
|
110
107
|
activityRouting: nonEmpty(env[DaemonEnvVar.ActivityRouting]),
|
|
111
108
|
};
|
|
112
109
|
}
|