@stigmer/cli 3.12.5 → 3.12.7
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/agent-exec-flags.d.ts +1 -0
- package/commands/agent-exec-flags.d.ts.map +1 -1
- package/commands/agent-exec-flags.js +3 -1
- package/commands/agent-exec-flags.js.map +1 -1
- package/commands/setup.d.ts.map +1 -1
- package/commands/setup.js +38 -18
- package/commands/setup.js.map +1 -1
- package/local/daemon/components.d.ts.map +1 -1
- package/local/daemon/components.js +11 -1
- package/local/daemon/components.js.map +1 -1
- package/local/daemon/env.d.ts +6 -0
- package/local/daemon/env.d.ts.map +1 -1
- package/local/daemon/env.js +8 -0
- package/local/daemon/env.js.map +1 -1
- package/local/daemon/launch.d.ts.map +1 -1
- package/local/daemon/launch.js +15 -0
- package/local/daemon/launch.js.map +1 -1
- package/local/operator-config.d.ts +28 -0
- package/local/operator-config.d.ts.map +1 -0
- package/local/operator-config.js +77 -0
- package/local/operator-config.js.map +1 -0
- package/local/setup/wizard.d.ts +16 -3
- package/local/setup/wizard.d.ts.map +1 -1
- package/local/setup/wizard.js +72 -13
- package/local/setup/wizard.js.map +1 -1
- package/package.json +5 -5
- package/resources/run/agent-exec.d.ts.map +1 -1
- package/resources/run/agent-exec.js +1 -0
- package/resources/run/agent-exec.js.map +1 -1
- package/resources/run/create.d.ts +2 -1
- package/resources/run/create.d.ts.map +1 -1
- package/resources/run/create.js +11 -6
- package/resources/run/create.js.map +1 -1
- package/resources/run/prepare.d.ts +15 -0
- package/resources/run/prepare.d.ts.map +1 -1
- package/resources/run/prepare.js +14 -0
- package/resources/run/prepare.js.map +1 -1
- package/resources/task-configs.js +10 -1
- package/resources/task-configs.js.map +1 -1
- package/src/commands/agent-exec-flags.ts +5 -2
- package/src/commands/setup.ts +48 -18
- package/src/local/daemon/components.test.ts +20 -0
- package/src/local/daemon/components.ts +9 -1
- package/src/local/daemon/env.test.ts +21 -0
- package/src/local/daemon/env.ts +14 -0
- package/src/local/daemon/launch.ts +17 -0
- package/src/local/operator-config.test.ts +72 -0
- package/src/local/operator-config.ts +95 -0
- package/src/local/setup/wizard.test.ts +46 -1
- package/src/local/setup/wizard.ts +82 -13
- package/src/resources/run/agent-exec.test.ts +1 -0
- package/src/resources/run/agent-exec.ts +1 -0
- package/src/resources/run/create.test.ts +48 -1
- package/src/resources/run/create.ts +11 -6
- package/src/resources/run/prepare.test.ts +14 -1
- package/src/resources/run/prepare.ts +25 -0
- package/src/resources/task-configs.ts +10 -1
|
@@ -10,7 +10,7 @@ import type { Client } from "@connectrpc/connect";
|
|
|
10
10
|
import { create, type DescService } from "@bufbuild/protobuf";
|
|
11
11
|
import { type AgentExecution, AgentExecutionSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
12
12
|
import { AgentExecutionCommandController } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/command_pb";
|
|
13
|
-
import { InteractionMode, ServiceTier } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
13
|
+
import { InteractionMode, ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
14
14
|
import type { Attachment } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
|
|
15
15
|
import {
|
|
16
16
|
AgentExecutionSpecSchema,
|
|
@@ -29,7 +29,7 @@ import { WorkflowExecutionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/
|
|
|
29
29
|
import { ExecutionValueSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
|
|
30
30
|
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
31
31
|
import type { RuntimeEnv } from "./env.js";
|
|
32
|
-
import type { RunMode, ServiceTierFlag } from "./prepare.js";
|
|
32
|
+
import type { RunMode, ServiceTierFlag, ThinkingFlag } from "./prepare.js";
|
|
33
33
|
|
|
34
34
|
const API_VERSION = "agentic.stigmer.ai/v1";
|
|
35
35
|
|
|
@@ -58,6 +58,7 @@ export interface CreateAgentExecutionInput {
|
|
|
58
58
|
readonly model: string;
|
|
59
59
|
readonly mode: RunMode;
|
|
60
60
|
readonly serviceTier: ServiceTierFlag;
|
|
61
|
+
readonly thinking: ThinkingFlag;
|
|
61
62
|
readonly autoApproveAll: boolean;
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -84,7 +85,7 @@ export async function createAgentExecution(
|
|
|
84
85
|
input.workspaceEntries.length > 0
|
|
85
86
|
? create(SessionSpecSchema, { workspaceEntries: [...input.workspaceEntries] })
|
|
86
87
|
: undefined,
|
|
87
|
-
executionConfig: buildExecutionConfig(input.model, input.mode, input.serviceTier),
|
|
88
|
+
executionConfig: buildExecutionConfig(input.model, input.mode, input.serviceTier, input.thinking),
|
|
88
89
|
}),
|
|
89
90
|
});
|
|
90
91
|
return controller(AgentExecutionCommandController).create(execution);
|
|
@@ -123,19 +124,23 @@ export async function createWorkflowExecution(
|
|
|
123
124
|
// Build ExecutionConfig, or undefined when no flag is set so the backend
|
|
124
125
|
// applies its defaults. Mirrors Go's buildExecutionConfig (only "plan" maps to a
|
|
125
126
|
// non-default InteractionMode; "agent"/"" leave it unspecified). An explicit
|
|
126
|
-
// --service-tier value maps to the enum even for
|
|
127
|
-
//
|
|
127
|
+
// --service-tier or --thinking value maps to the enum even for the base
|
|
128
|
+
// choice ("standard"/"disabled"): unspecified vs explicit is a load-bearing
|
|
129
|
+
// ledger distinction (#357/#772).
|
|
128
130
|
function buildExecutionConfig(
|
|
129
131
|
model: string,
|
|
130
132
|
mode: RunMode,
|
|
131
133
|
serviceTier: ServiceTierFlag,
|
|
134
|
+
thinking: ThinkingFlag,
|
|
132
135
|
): ExecutionConfig | undefined {
|
|
133
|
-
if (model === "" && mode === "" && serviceTier === "") return undefined;
|
|
136
|
+
if (model === "" && mode === "" && serviceTier === "" && thinking === "") return undefined;
|
|
134
137
|
const cfg = create(ExecutionConfigSchema);
|
|
135
138
|
if (model !== "") cfg.modelName = model;
|
|
136
139
|
if (mode === "plan") cfg.interactionMode = InteractionMode.PLAN;
|
|
137
140
|
if (serviceTier === "fast") cfg.serviceTier = ServiceTier.FAST;
|
|
138
141
|
else if (serviceTier === "standard") cfg.serviceTier = ServiceTier.STANDARD;
|
|
142
|
+
if (thinking === "enabled") cfg.thinkingMode = ThinkingMode.ENABLED;
|
|
143
|
+
else if (thinking === "disabled") cfg.thinkingMode = ThinkingMode.DISABLED;
|
|
139
144
|
return cfg;
|
|
140
145
|
}
|
|
141
146
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { describe, expect, it } from "vitest";
|
|
6
6
|
import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
7
7
|
import type { Stigmer } from "@stigmer/sdk";
|
|
8
|
-
import { type AgentExecFlags, parseApprovalAction, prepareAgentExec, validateMode, validateServiceTier } from "./prepare.js";
|
|
8
|
+
import { type AgentExecFlags, parseApprovalAction, prepareAgentExec, validateMode, validateServiceTier, validateThinking } from "./prepare.js";
|
|
9
9
|
|
|
10
10
|
describe("parseApprovalAction", () => {
|
|
11
11
|
it("maps each accepted value (case-insensitive)", () => {
|
|
@@ -47,6 +47,18 @@ describe("validateServiceTier", () => {
|
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
describe("validateThinking", () => {
|
|
51
|
+
it("accepts empty, disabled, and enabled", () => {
|
|
52
|
+
expect(() => validateThinking("")).not.toThrow();
|
|
53
|
+
expect(() => validateThinking("disabled")).not.toThrow();
|
|
54
|
+
expect(() => validateThinking("enabled")).not.toThrow();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("rejects anything else before a network round trip", () => {
|
|
58
|
+
expect(() => validateThinking("harder")).toThrow(/must be "disabled" or "enabled"/);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
50
62
|
const BASE_FLAGS: AgentExecFlags = {
|
|
51
63
|
message: "hi",
|
|
52
64
|
attach: [],
|
|
@@ -64,6 +76,7 @@ const BASE_FLAGS: AgentExecFlags = {
|
|
|
64
76
|
autoApprove: false,
|
|
65
77
|
mode: "",
|
|
66
78
|
serviceTier: "",
|
|
79
|
+
thinking: "",
|
|
67
80
|
};
|
|
68
81
|
|
|
69
82
|
// prepareAgentExec only touches client.agentExecution for attachment uploads;
|
|
@@ -26,6 +26,12 @@ export type RunMode = "" | "agent" | "plan";
|
|
|
26
26
|
*/
|
|
27
27
|
export type ServiceTierFlag = "" | "standard" | "fast";
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* The `--thinking` flag's value space (#772), the tier's twin: empty means
|
|
31
|
+
* unset — distinct from an explicit "disabled" for the same ledger reason.
|
|
32
|
+
*/
|
|
33
|
+
export type ThinkingFlag = "" | "disabled" | "enabled";
|
|
34
|
+
|
|
29
35
|
/** Raw agent-execution flags shared by `run` and `draft` (Go's agentExecFlags). */
|
|
30
36
|
export interface AgentExecFlags {
|
|
31
37
|
readonly message: string;
|
|
@@ -44,6 +50,7 @@ export interface AgentExecFlags {
|
|
|
44
50
|
readonly autoApprove: boolean;
|
|
45
51
|
readonly mode: RunMode;
|
|
46
52
|
readonly serviceTier: ServiceTierFlag;
|
|
53
|
+
readonly thinking: ThinkingFlag;
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
/**
|
|
@@ -63,6 +70,7 @@ export interface PreparedRun {
|
|
|
63
70
|
readonly autoApproveAll: boolean;
|
|
64
71
|
readonly mode: RunMode;
|
|
65
72
|
readonly serviceTier: ServiceTierFlag;
|
|
73
|
+
readonly thinking: ThinkingFlag;
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
/** Optional behavior switches for {@link prepareAgentExec}. */
|
|
@@ -91,6 +99,7 @@ export async function prepareAgentExec(
|
|
|
91
99
|
const defaultAction = parseApprovalAction(flags.approveDefault);
|
|
92
100
|
validateMode(flags.mode);
|
|
93
101
|
validateServiceTier(flags.serviceTier);
|
|
102
|
+
validateThinking(flags.thinking);
|
|
94
103
|
|
|
95
104
|
// Layered model seed (oss#293 Phase 1.5): an explicit --model always wins;
|
|
96
105
|
// an omitted one fills from the account preference on cloud. `run` and
|
|
@@ -134,6 +143,7 @@ export async function prepareAgentExec(
|
|
|
134
143
|
autoApproveAll: flags.autoApprove,
|
|
135
144
|
mode: flags.mode,
|
|
136
145
|
serviceTier: flags.serviceTier,
|
|
146
|
+
thinking: flags.thinking,
|
|
137
147
|
};
|
|
138
148
|
}
|
|
139
149
|
|
|
@@ -202,3 +212,18 @@ export function validateServiceTier(tier: string): asserts tier is ServiceTierFl
|
|
|
202
212
|
);
|
|
203
213
|
}
|
|
204
214
|
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Validate the `--thinking` flag, the tier check's twin (#772). Empty means
|
|
218
|
+
* "platform default" (which resolves to disabled — never the provider
|
|
219
|
+
* account default). The server refuses enabled on models without the
|
|
220
|
+
* registry thinking capability; this check only catches spelling errors
|
|
221
|
+
* before a network round trip.
|
|
222
|
+
*/
|
|
223
|
+
export function validateThinking(mode: string): asserts mode is ThinkingFlag {
|
|
224
|
+
if (mode !== "" && mode !== "disabled" && mode !== "enabled") {
|
|
225
|
+
throw new UsageError(
|
|
226
|
+
`invalid --thinking value "${mode}": must be "disabled" or "enabled"`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -100,7 +100,7 @@ export function decodeWorkflowTaskConfigs(workflow: Workflow): void {
|
|
|
100
100
|
/**
|
|
101
101
|
* Rewrites user-friendly DSL forms to the shapes the proto decode expects —
|
|
102
102
|
* the twin of the server's `normalizeEnumShorthands` (unmarshal.go): agent_call
|
|
103
|
-
* harness shorthands ("cursor" → "HARNESS_CURSOR"), run_config service-tier
|
|
103
|
+
* harness shorthands ("cursor" → "HARNESS_CURSOR"), run_config service-tier/thinking-mode
|
|
104
104
|
* shorthands ("fast" → "SERVICE_TIER_FAST"), and the environment_refs kind
|
|
105
105
|
* default (an omitted kind means environment). Without this twin the offline
|
|
106
106
|
* decode would be STRICTER than a real apply and fail valid manifests.
|
|
@@ -123,6 +123,10 @@ function normalizeTaskConfigShorthands(kind: WorkflowTaskKind, config: JsonValue
|
|
|
123
123
|
const tier = SERVICE_TIER_SHORTHANDS[runConfig.service_tier.toLowerCase()];
|
|
124
124
|
if (tier !== undefined) runConfig.service_tier = tier;
|
|
125
125
|
}
|
|
126
|
+
if (typeof runConfig.thinking_mode === "string") {
|
|
127
|
+
const mode = THINKING_MODE_SHORTHANDS[runConfig.thinking_mode.toLowerCase()];
|
|
128
|
+
if (mode !== undefined) runConfig.thinking_mode = mode;
|
|
129
|
+
}
|
|
126
130
|
normalized.run_config = runConfig;
|
|
127
131
|
}
|
|
128
132
|
|
|
@@ -145,6 +149,11 @@ const SERVICE_TIER_SHORTHANDS: Record<string, string> = {
|
|
|
145
149
|
fast: "SERVICE_TIER_FAST",
|
|
146
150
|
};
|
|
147
151
|
|
|
152
|
+
const THINKING_MODE_SHORTHANDS: Record<string, string> = {
|
|
153
|
+
disabled: "THINKING_MODE_DISABLED",
|
|
154
|
+
enabled: "THINKING_MODE_ENABLED",
|
|
155
|
+
};
|
|
156
|
+
|
|
148
157
|
function isJsonObject(value: JsonValue | undefined): value is Record<string, JsonValue> {
|
|
149
158
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
150
159
|
}
|