@stigmer/runner 3.36.0 → 3.37.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.
Files changed (78) hide show
  1. package/dist/.build-fingerprint +1 -1
  2. package/dist/__test-utils__/hermetic-activity.d.ts +9 -4
  3. package/dist/__test-utils__/hermetic-activity.js +17 -5
  4. package/dist/__test-utils__/hermetic-activity.js.map +1 -1
  5. package/dist/activities/execute-deep-agent/engine-tools.d.ts +32 -0
  6. package/dist/activities/execute-deep-agent/engine-tools.js +32 -0
  7. package/dist/activities/execute-deep-agent/engine-tools.js.map +1 -0
  8. package/dist/activities/execute-deep-agent/prompt-builder.d.ts +5 -4
  9. package/dist/activities/execute-deep-agent/prompt-builder.js +66 -64
  10. package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
  11. package/dist/activities/execute-deep-agent/subagent-transformer.d.ts +5 -2
  12. package/dist/activities/execute-deep-agent/subagent-transformer.js +27 -14
  13. package/dist/activities/execute-deep-agent/subagent-transformer.js.map +1 -1
  14. package/dist/activities/execute-deep-agent/todo-list.d.ts +40 -0
  15. package/dist/activities/execute-deep-agent/todo-list.js +51 -0
  16. package/dist/activities/execute-deep-agent/todo-list.js.map +1 -0
  17. package/dist/activities/execute-deep-agent/turn-setup.js +11 -7
  18. package/dist/activities/execute-deep-agent/turn-setup.js.map +1 -1
  19. package/dist/harness/run-turn.js +13 -13
  20. package/dist/harness/run-turn.js.map +1 -1
  21. package/dist/harness/terminal-table.d.ts +20 -5
  22. package/dist/harness/terminal-table.js +22 -8
  23. package/dist/harness/terminal-table.js.map +1 -1
  24. package/dist/middleware/error-hints.js +3 -3
  25. package/dist/middleware/error-hints.js.map +1 -1
  26. package/dist/middleware/path-normalization.d.ts +18 -4
  27. package/dist/middleware/path-normalization.js +42 -13
  28. package/dist/middleware/path-normalization.js.map +1 -1
  29. package/dist/shared/model-client.d.ts +10 -2
  30. package/dist/shared/model-client.js +1 -1
  31. package/dist/shared/model-client.js.map +1 -1
  32. package/dist/shared/subagent-gate.d.ts +6 -0
  33. package/dist/shared/subagent-gate.js +6 -1
  34. package/dist/shared/subagent-gate.js.map +1 -1
  35. package/dist/shared/worker-shutdown.d.ts +10 -5
  36. package/dist/shared/worker-shutdown.js +3 -3
  37. package/dist/shared/worker-shutdown.js.map +1 -1
  38. package/dist/shared/workspace/sources/local-path.js +5 -1
  39. package/dist/shared/workspace/sources/local-path.js.map +1 -1
  40. package/dist/tools/think-tool.d.ts +7 -0
  41. package/dist/tools/think-tool.js +10 -11
  42. package/dist/tools/think-tool.js.map +1 -1
  43. package/package.json +5 -5
  44. package/src/__test-utils__/harness-contract/runtime-contract.ts +27 -16
  45. package/src/__test-utils__/hermetic-activity.ts +16 -5
  46. package/src/activities/execute-cursor/__tests__/hermetic/goldens/pause.status.json +0 -6
  47. package/src/activities/execute-cursor/__tests__/hermetic/pause-vs-shutdown.test.ts +28 -21
  48. package/src/activities/execute-deep-agent/__tests__/engine-tools.test.ts +96 -0
  49. package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.build-from-plan.prompt.md +22 -35
  50. package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.everything.prompt.md +23 -35
  51. package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.minimal.prompt.md +11 -23
  52. package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.plan-mode.prompt.md +22 -35
  53. package/src/activities/execute-deep-agent/__tests__/goldens/system-prompt.skills-below-threshold.prompt.md +22 -34
  54. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.after-tool.status.json +0 -6
  55. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.mid-tool.status.json +0 -6
  56. package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-parallel-gates.test.ts +132 -0
  57. package/src/activities/execute-deep-agent/__tests__/hermetic/pause-vs-shutdown.test.ts +27 -21
  58. package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +20 -2
  59. package/src/activities/execute-deep-agent/__tests__/prompt-goldens.test.ts +9 -0
  60. package/src/activities/execute-deep-agent/engine-tools.ts +33 -0
  61. package/src/activities/execute-deep-agent/prompt-builder.ts +73 -69
  62. package/src/activities/execute-deep-agent/subagent-transformer.ts +28 -13
  63. package/src/activities/execute-deep-agent/todo-list.ts +56 -0
  64. package/src/activities/execute-deep-agent/turn-setup.ts +11 -7
  65. package/src/harness/run-turn.ts +13 -13
  66. package/src/harness/terminal-table.ts +23 -8
  67. package/src/middleware/__tests__/path-normalization.test.ts +32 -0
  68. package/src/middleware/error-hints.ts +3 -3
  69. package/src/middleware/path-normalization.ts +41 -13
  70. package/src/shared/__tests__/model-client-sampling.test.ts +56 -0
  71. package/src/shared/__tests__/model-client.test.ts +15 -0
  72. package/src/shared/__tests__/worker-shutdown.test.ts +2 -2
  73. package/src/shared/model-client.ts +11 -3
  74. package/src/shared/subagent-gate.ts +6 -1
  75. package/src/shared/worker-shutdown.ts +11 -6
  76. package/src/shared/workspace/sources/local-path.ts +5 -1
  77. package/src/tools/__tests__/think-tool.test.ts +3 -2
  78. package/src/tools/think-tool.ts +10 -11
@@ -19,7 +19,13 @@
19
19
  * filesystem paths that a model may still echo back;
20
20
  * - interior `..` segments that stay inside the root ("src/../notes.md" →
21
21
  * "/notes.md") — the virtual resolver rejects `..` outright, so a safe
22
- * interior collapse is repaired here rather than burning a tool round.
22
+ * interior collapse is repaired here rather than burning a tool round;
23
+ * - a `glob` PATTERN that opens with the real root ("{root}/src/*.go") to
24
+ * its virtual form ("/src/*.go"). deepagents strips a pattern's leading
25
+ * "/" and matches the rest under the search path, so a real-root pattern
26
+ * silently matches nothing and the model goes looking with `ls`; the
27
+ * benchmark's per-call record showed it doing so for three rounds. Only
28
+ * that exact prefix is rewritten, never the pattern's wildcards.
23
29
  *
24
30
  * Nothing becomes newly reachable: escaping relatives ("../x") and
25
31
  * `~`-carrying paths are left raw so the upstream refusal keeps speaking,
@@ -38,9 +44,9 @@
38
44
  *
39
45
  * Tool matching is by bare built-in name, the house doctrine (an MCP server
40
46
  * is not expected to shadow a built-in name — see shared/tool-kind.ts); the
41
- * rewrite touches only the tool's path-bearing argument, never glob/grep
42
- * patterns. Install FIRST in the stack so every downstream middleware
43
- * observes canonical paths.
47
+ * rewrite touches the tool's path-bearing argument and, for `glob`, a
48
+ * real-root prefix of the pattern; nothing else in a pattern. Install FIRST
49
+ * in the stack so every downstream middleware observes canonical paths.
44
50
  */
45
51
  import type { StigmerMiddleware } from "./types.js";
46
52
  export interface PathNormalizationConfig {
@@ -63,6 +69,14 @@ export interface PathNormalizationConfig {
63
69
  * honestly), and paths already in canonical virtual form.
64
70
  */
65
71
  export declare function normalizeWorkspacePathArg(raw: string, rootDir: string): string | undefined;
72
+ /**
73
+ * Rewrite a `glob` pattern that opens with the real workspace root to its
74
+ * virtual form, or return undefined to leave it untouched. Only a whole
75
+ * leading `{root}/` is replaced; a pattern that merely contains the root's
76
+ * text elsewhere, or is the root itself, is left as the model wrote it.
77
+ * Exported for direct unit testing.
78
+ */
79
+ export declare function normalizeGlobPattern(pattern: string, rootDir: string): string | undefined;
66
80
  /**
67
81
  * Create the dialect-repair middleware (see module header). Stateless per
68
82
  * request; safe on every graph.
@@ -19,7 +19,13 @@
19
19
  * filesystem paths that a model may still echo back;
20
20
  * - interior `..` segments that stay inside the root ("src/../notes.md" →
21
21
  * "/notes.md") — the virtual resolver rejects `..` outright, so a safe
22
- * interior collapse is repaired here rather than burning a tool round.
22
+ * interior collapse is repaired here rather than burning a tool round;
23
+ * - a `glob` PATTERN that opens with the real root ("{root}/src/*.go") to
24
+ * its virtual form ("/src/*.go"). deepagents strips a pattern's leading
25
+ * "/" and matches the rest under the search path, so a real-root pattern
26
+ * silently matches nothing and the model goes looking with `ls`; the
27
+ * benchmark's per-call record showed it doing so for three rounds. Only
28
+ * that exact prefix is rewritten, never the pattern's wildcards.
23
29
  *
24
30
  * Nothing becomes newly reachable: escaping relatives ("../x") and
25
31
  * `~`-carrying paths are left raw so the upstream refusal keeps speaking,
@@ -38,9 +44,9 @@
38
44
  *
39
45
  * Tool matching is by bare built-in name, the house doctrine (an MCP server
40
46
  * is not expected to shadow a built-in name — see shared/tool-kind.ts); the
41
- * rewrite touches only the tool's path-bearing argument, never glob/grep
42
- * patterns. Install FIRST in the stack so every downstream middleware
43
- * observes canonical paths.
47
+ * rewrite touches the tool's path-bearing argument and, for `glob`, a
48
+ * real-root prefix of the pattern; nothing else in a pattern. Install FIRST
49
+ * in the stack so every downstream middleware observes canonical paths.
44
50
  */
45
51
  import { isAbsolute, relative, posix } from "node:path";
46
52
  /**
@@ -56,6 +62,9 @@ const PATH_ARG_BY_TOOL = new Map([
56
62
  ["write_file", "file_path"],
57
63
  ["edit_file", "file_path"],
58
64
  ]);
65
+ /** The one built-in whose pattern can carry a path prefix, and its argument. */
66
+ const GLOB_TOOL = "glob";
67
+ const GLOB_PATTERN_ARG = "pattern";
59
68
  /**
60
69
  * Rewrite `raw` to its canonical virtual-absolute form, or return undefined
61
70
  * when the value must be left untouched. Exported for direct unit testing of
@@ -101,6 +110,19 @@ export function normalizeWorkspacePathArg(raw, rootDir) {
101
110
  const virtual = normalizedRel === "." ? "/" : `/${normalizedRel}`;
102
111
  return virtual === raw ? undefined : virtual;
103
112
  }
113
+ /**
114
+ * Rewrite a `glob` pattern that opens with the real workspace root to its
115
+ * virtual form, or return undefined to leave it untouched. Only a whole
116
+ * leading `{root}/` is replaced; a pattern that merely contains the root's
117
+ * text elsewhere, or is the root itself, is left as the model wrote it.
118
+ * Exported for direct unit testing.
119
+ */
120
+ export function normalizeGlobPattern(pattern, rootDir) {
121
+ const prefix = rootDir.endsWith("/") ? rootDir : `${rootDir}/`;
122
+ if (!pattern.startsWith(prefix) || pattern.length === prefix.length)
123
+ return undefined;
124
+ return `/${pattern.slice(prefix.length)}`;
125
+ }
104
126
  /**
105
127
  * Create the dialect-repair middleware (see module header). Stateless per
106
128
  * request; safe on every graph.
@@ -113,18 +135,25 @@ export function createPathNormalizationMiddleware(config) {
113
135
  const argKey = PATH_ARG_BY_TOOL.get(request.toolCall.name);
114
136
  if (!argKey)
115
137
  return handler(request);
116
- const raw = request.toolCall.args[argKey];
117
- if (typeof raw !== "string")
118
- return handler(request);
119
- const normalized = normalizeWorkspacePathArg(raw, rootDir);
120
- if (normalized === undefined)
138
+ const args = request.toolCall.args;
139
+ const rewritten = {};
140
+ const raw = args[argKey];
141
+ if (typeof raw === "string") {
142
+ const normalized = normalizeWorkspacePathArg(raw, rootDir);
143
+ if (normalized !== undefined)
144
+ rewritten[argKey] = normalized;
145
+ }
146
+ const pattern = args[GLOB_PATTERN_ARG];
147
+ if (request.toolCall.name === GLOB_TOOL && typeof pattern === "string") {
148
+ const normalized = normalizeGlobPattern(pattern, rootDir);
149
+ if (normalized !== undefined)
150
+ rewritten[GLOB_PATTERN_ARG] = normalized;
151
+ }
152
+ if (Object.keys(rewritten).length === 0)
121
153
  return handler(request);
122
154
  return handler({
123
155
  ...request,
124
- toolCall: {
125
- ...request.toolCall,
126
- args: { ...request.toolCall.args, [argKey]: normalized },
127
- },
156
+ toolCall: { ...request.toolCall, args: { ...args, ...rewritten } },
128
157
  });
129
158
  },
130
159
  };
@@ -1 +1 @@
1
- {"version":3,"file":"path-normalization.js","sourceRoot":"","sources":["../../src/middleware/path-normalization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGxD;;;;GAIG;AACH,MAAM,gBAAgB,GAAgC,IAAI,GAAG,CAAC;IAC5D,CAAC,IAAI,EAAE,MAAM,CAAC;IACd,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1B,CAAC,YAAY,EAAE,WAAW,CAAC;IAC3B,CAAC,WAAW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AAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC5B,MAAM,UAAU,GAAG,yBAAyB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBAC3D,IAAI,UAAU,KAAK,SAAS;oBAAE,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;YAC/D,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACvC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACvE,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC1D,IAAI,UAAU,KAAK,SAAS;oBAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAAC;YACzE,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;YAEjE,OAAO,OAAO,CAAC;gBACb,GAAG,OAAO;gBACV,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,EAAE;aACnE,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -27,8 +27,16 @@ export interface BuildChatModelOptions {
27
27
  mcpServerId?: string;
28
28
  workflowExecutionId?: string;
29
29
  };
30
- /** Defaults to 0. */
31
- readonly temperature?: number;
30
+ /**
31
+ * Defaults to 0. `null` sends no sampling override at all, so the
32
+ * provider's default applies: the native execution turn passes it,
33
+ * because current Anthropic models refuse a temperature other than their
34
+ * default (claude-opus-4.7 and later, claude-sonnet-5, claude-fable-5;
35
+ * @langchain/anthropic throws before the request for some of them) and
36
+ * the Cursor harness sends none either (stigmer/stigmer#1341). Utility
37
+ * calls keep their deterministic 0.
38
+ */
39
+ readonly temperature?: number | null;
32
40
  /**
33
41
  * Pass-through only; intentionally no default. Anthropic requires a value,
34
42
  * but callers differ (setup omits it, call-llm uses 4096), so the default
@@ -169,7 +169,7 @@ export async function buildChatModel(opts) {
169
169
  ? { maxRetries: opts.maxRetries ?? 0 }
170
170
  : {};
171
171
  const common = {
172
- temperature: opts.temperature ?? 0,
172
+ ...(opts.temperature === null ? {} : { temperature: opts.temperature ?? 0 }),
173
173
  apiKey,
174
174
  ...(maxTokens ? { maxTokens } : {}),
175
175
  ...maxRetries,
@@ -1 +1 @@
1
- {"version":3,"file":"model-client.js","sourceRoot":"","sources":["../../src/shared/model-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AA8C/D;;;;;GAKG;AACH,SAAS,uBAAuB;IAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACrF,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzC,CAAC;AAeD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,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EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBACxC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBAChD;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;QACJ,CAAC,CAAC,mBAAmB;YACnB,CAAC,CAAC,gEAAgE;gBAChE,mEAAmE;gBACnE,oEAAoE;gBACpE,mEAAmE;gBACnE,oEAAoE;gBACpE,wDAAwD;gBACxD,EAAE;gBACF,4DAA4D;gBAC5D,+DAA+D;gBAC/D,6DAA6D;gBAC7D,mEAAmE;gBACnE,iEAAiE;gBACjE,+DAA+D;gBAC/D,IAAI,aAAa,CAAC;oBAChB,KAAK,EAAE,WAAW;oBAClB,GAAG,MAAM;oBACT,GAAG,2BAA2B;oBAC9B,YAAY,EAAE,mBAAmB;iBAClC,CAAC;YACJ,CAAC,CAAC,IAAI,aAAa,CAAC;gBAChB,KAAK,EAAE,UAAU;gBACjB,GAAG,MAAM;gBACT,GAAG,yBAAyB;gBAC5B,GAAG,2BAA2B;aAC/B,CAAC,CAAC;IAET,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AACzC,CAAC"}
1
+ {"version":3,"file":"model-client.js","sourceRoot":"","sources":["../../src/shared/model-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,m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G,2BAA2B;aAC/B,CAAC,CAAC;IAET,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AACzC,CAAC"}
@@ -11,6 +11,12 @@
11
11
  * the LLM adapt when a sub-agent cannot be started.
12
12
  */
13
13
  import { RunnableLambda, type RunnableConfig } from "@langchain/core/runnables";
14
+ /**
15
+ * How many sub-agents run at once by default. The native prompt states this
16
+ * number to the model (`execute-deep-agent/prompt-builder.ts`), so it has one
17
+ * home: this constant.
18
+ */
19
+ export declare const DEFAULT_MAX_CONCURRENT = 3;
14
20
  export interface SubAgentGateOptions {
15
21
  readonly maxConcurrent?: number;
16
22
  }
@@ -11,7 +11,12 @@
11
11
  * the LLM adapt when a sub-agent cannot be started.
12
12
  */
13
13
  import { RunnableLambda } from "@langchain/core/runnables";
14
- const DEFAULT_MAX_CONCURRENT = 3;
14
+ /**
15
+ * How many sub-agents run at once by default. The native prompt states this
16
+ * number to the model (`execute-deep-agent/prompt-builder.ts`), so it has one
17
+ * home: this constant.
18
+ */
19
+ export const DEFAULT_MAX_CONCURRENT = 3;
15
20
  export class SubAgentGate {
16
21
  max;
17
22
  active = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-gate.js","sourceRoot":"","sources":["../../src/shared/subagent-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAuB,MAAM,2BAA2B,CAAC;AAEhF,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAMjC,MAAM,OAAO,YAAY;IACN,GAAG,CAAS;IACrB,MAAM,GAAG,CAAC,CAAC;IAEnB,YAAY,UAA+B,EAAE;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,aAAa,IAAI,sBAAsB,CAAC;QAC3D,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACrE,CA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QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC9C,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Per-task-queue worker-shutdown signals — the classification channel that
3
3
  * lets an in-flight activity distinguish "my worker is shutting down" from
4
- * "the orchestrator cancelled me" (a user pause).
4
+ * "the orchestrator cancelled me" (a user's Pause or Cancel).
5
5
  *
6
6
  * The signal carries NO lifecycle authority: aborting it never stops a
7
7
  * worker or an activity (Temporal's own drain does that). It exists purely
8
8
  * so the activity's cancellation handling can classify the interruption
9
- * honestly — a shutdown is not a pause, and must surface as the
9
+ * honestly — a shutdown is not a user's stop, and must surface as the
10
10
  * worker-shutdown failure shape the control planes recognize (issue #776).
11
11
  *
12
12
  * Ownership contract:
@@ -63,13 +63,18 @@ export interface TurnInterruptionEvidence {
63
63
  * How Temporal's cancellation reads to the turn:
64
64
  * - `worker-shutdown`: the runner is draining (the queue's signal, or the
65
65
  * SDK's own `WORKER_SHUTDOWN`); FAILED with the shutdown copy, thrown.
66
- * - `pause`: the workflow asked (`CANCELLED`, the Pause RPC's path);
67
- * PAUSED, thrown.
66
+ * - `orchestrator-stop`: the workflow asked (`CANCELLED`). That is a Pause
67
+ * or a Cancel, and the turn cannot tell which: both reach the activity
68
+ * as the same workflow-requested cancellation, and both RPCs signal the
69
+ * engine before they persist the phase, so no stored fact tells them
70
+ * apart in time. The turn settles its transcript with no phase and no
71
+ * row, thrown; the workflow, which knows which stop it runs, writes the
72
+ * phase and the stop row (stigmer#980).
68
73
  * - `infrastructure`: the platform cancelled for its own reason (a heartbeat
69
74
  * timeout, a closed run); FAILED with the unresponsive copy, thrown.
70
75
  * - `none`: nothing was delivered.
71
76
  */
72
- export type TurnInterruption = "worker-shutdown" | "pause" | "infrastructure" | "none";
77
+ export type TurnInterruption = "worker-shutdown" | "orchestrator-stop" | "infrastructure" | "none";
73
78
  /**
74
79
  * Classify how (whether) Temporal interrupted the turn, from the two live
75
80
  * facts: the reason on the cancellation signal and the queue's shutdown
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Per-task-queue worker-shutdown signals — the classification channel that
3
3
  * lets an in-flight activity distinguish "my worker is shutting down" from
4
- * "the orchestrator cancelled me" (a user pause).
4
+ * "the orchestrator cancelled me" (a user's Pause or Cancel).
5
5
  *
6
6
  * The signal carries NO lifecycle authority: aborting it never stops a
7
7
  * worker or an activity (Temporal's own drain does that). It exists purely
8
8
  * so the activity's cancellation handling can classify the interruption
9
- * honestly — a shutdown is not a pause, and must surface as the
9
+ * honestly — a shutdown is not a user's stop, and must surface as the
10
10
  * worker-shutdown failure shape the control planes recognize (issue #776).
11
11
  *
12
12
  * Ownership contract:
@@ -89,6 +89,6 @@ export function classifyTurnInterruption(evidence) {
89
89
  if (shutdownSignalAborted || cancellationReason === "WORKER_SHUTDOWN") {
90
90
  return "worker-shutdown";
91
91
  }
92
- return cancellationReason === "CANCELLED" ? "pause" : "infrastructure";
92
+ return cancellationReason === "CANCELLED" ? "orchestrator-stop" : "infrastructure";
93
93
  }
94
94
  //# sourceMappingURL=worker-shutdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-shutdown.js","sourceRoot":"","sources":["../../src/shared/worker-shutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,SAAiB;IAC5D,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACpC,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,yBAAyB,CAAC,SAAiB;IACzD,OA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iBAAiB,CAAC;IAC3B,CAAC;IACD,OAAO,kBAAkB,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC;AACrF,CAAC"}
@@ -33,7 +33,11 @@ export function provisionLocalPath(options) {
33
33
  rootDir: path,
34
34
  sourceType: "local_path",
35
35
  consumedKeys: [],
36
- workspaceDescription: `Your workspace is the user's project directory: ${path}\n` +
36
+ // No host path in the model's text: the native file tools see this
37
+ // directory as `/` and its commands run in it, so the path would only be
38
+ // echoed back where it cannot resolve (a glob pattern, a mistyped
39
+ // prefix). The directory is `rootDir`'s to carry.
40
+ workspaceDescription: "Your workspace is the user's project directory.\n" +
37
41
  "IMPORTANT: You are operating directly on the user's files. " +
38
42
  "Changes are immediate and persistent.\n" +
39
43
  "Use git to track and verify your changes before finalizing.",
@@ -1 +1 @@
1
- {"version":3,"file":"local-path.js","sourceRoot":"","sources":["../../../../src/shared/workspace/sources/local-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,uBAAuB,GAExB,MAAM,aAAa,CAAC;AASrB,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAEpE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,uBAAuB,CAC/B,YAAY,EACZ,mDAAmD;YACnD,qCAAqC,CACtC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,uBA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xB,YAAY,EAAE,EAAE;QAChB,mEAAmE;QACnE,yEAAyE;QACzE,kEAAkE;QAClE,kDAAkD;QAClD,oBAAoB,EAClB,mDAAmD;YACnD,6DAA6D;YAC7D,yCAAyC;YACzC,6DAA6D;QAC/D,SAAS,EAAE,EAAE;KACd,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,cAAsB,EAAE,YAAoB,EAAE,IAAY;IACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAEpD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC;YAAE,OAAO;QAC1D,UAAU,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,SAAS,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -8,6 +8,13 @@
8
8
  *
9
9
  * Follows the Anthropic "think tool" pattern:
10
10
  * https://www.anthropic.com/engineering/claude-think-tool
11
+ *
12
+ * The description says when a call is worth it, because every call is a
13
+ * model round of its own: the whole prompt re-sent for a thought. The
14
+ * earlier text suggested one "after reading files or tool output", and the
15
+ * benchmark's per-call record showed think rounds right after reads and
16
+ * right before the reply. Whether the tool is bound at all is the thinking
17
+ * mode's question, not this module's.
11
18
  */
12
19
  import { z } from "zod";
13
20
  export declare function createThinkTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
@@ -8,23 +8,22 @@
8
8
  *
9
9
  * Follows the Anthropic "think tool" pattern:
10
10
  * https://www.anthropic.com/engineering/claude-think-tool
11
+ *
12
+ * The description says when a call is worth it, because every call is a
13
+ * model round of its own: the whole prompt re-sent for a thought. The
14
+ * earlier text suggested one "after reading files or tool output", and the
15
+ * benchmark's per-call record showed think rounds right after reads and
16
+ * right before the reply. Whether the tool is bound at all is the thinking
17
+ * mode's question, not this module's.
11
18
  */
12
19
  import { tool } from "@langchain/core/tools";
13
20
  import { z } from "zod";
14
21
  export function createThinkTool() {
15
22
  return tool(async (_input) => "ok", {
16
23
  name: "think",
17
- description: "Use this tool to think through a problem step-by-step. " +
18
- "The think tool does not read files, execute commands, or make any changes — " +
19
- "it simply records your reasoning. Call it when you need to pause and work " +
20
- "something out before acting.\n\n" +
21
- "Good times to use think:\n" +
22
- "- After reading files or tool output, to analyse what you learned\n" +
23
- "- Before a complex or multi-step operation, to plan your approach\n" +
24
- "- When you need to choose between several possible strategies\n" +
25
- "- When debugging — to reason about what might have gone wrong\n\n" +
26
- "You do NOT need to use think for every step — only when genuine " +
27
- "reasoning will improve the quality of your next action.",
24
+ description: "Record your reasoning when a decision is genuinely hard: choosing between approaches, " +
25
+ "or working out why something failed. It reads nothing and changes nothing. Do not use it " +
26
+ "to restate a tool result or to announce your next step; take the step.",
28
27
  schema: z.object({
29
28
  thought: z.string().describe("Your reasoning, analysis, or plan."),
30
29
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"think-tool.js","sourceRoot":"","sources":["../../src/tools/think-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CACT,KAAK,EAAE,MAA2B,EAAE,EAAE,CAAC,IAAI,EAC3C;QACE,IAAI,EAAE,OAAO;QACb,WAAW,EACT,yDAAyD;YACzD,8EAA8E;YAC9E,4EAA4E;YAC5E,kCAAkC;YAClC,4BAA4B;YAC5B,qEAAqE;YACrE,qEAAqE;YACrE,iEAAiE;YACjE,mEAAmE;YACnE,kEAAkE;YAClE,yDAAyD;QAC3D,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;SACnE,CAAC;KACH,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"think-tool.js","sourceRoot":"","sources":["../../src/tools/think-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CACT,KAAK,EAAE,MAA2B,EAAE,EAAE,CAAC,IAAI,EAC3C;QACE,IAAI,EAAE,OAAO;QACb,WAAW,EACT,wFAAwF;YACxF,2FAA2F;YAC3F,wEAAwE;QAC1E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;YACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;SACnE,CAAC;KACH,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/runner",
3
- "version": "3.36.0",
3
+ "version": "3.37.1",
4
4
  "description": "Embeddable Temporal worker for the Stigmer AI agent platform — handles agent execution, workflow orchestration, and MCP server management",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -108,10 +108,10 @@
108
108
  "@opentelemetry/sdk-metrics": "^2.0.0",
109
109
  "@opentelemetry/sdk-trace-base": "^2.0.0",
110
110
  "@opentelemetry/sdk-trace-node": "^2.0.0",
111
- "@stigmer/outbound": "3.36.0",
112
- "@stigmer/protos": "3.36.0",
113
- "@stigmer/temporal-codecs": "3.36.0",
114
- "@stigmer/zip-structure": "3.36.0",
111
+ "@stigmer/outbound": "3.37.1",
112
+ "@stigmer/protos": "3.37.1",
113
+ "@stigmer/temporal-codecs": "3.37.1",
114
+ "@stigmer/zip-structure": "3.37.1",
115
115
  "@temporalio/activity": "1.16.2",
116
116
  "@temporalio/common": "1.16.2",
117
117
  "@temporalio/interceptors-opentelemetry": "1.16.2",
@@ -594,12 +594,17 @@ function hangingTurn(before: string): TurnScenario {
594
594
  }
595
595
 
596
596
  /**
597
- * A user pause: Temporal's cancellation delivered while the engine hangs
598
- * persists PAUSED with the pause row written exactly once, no error, no
599
- * `completedAt`, and THROWS the pause `CancelledFailure` so the workflow
600
- * knows to wait.
597
+ * An orchestrator stop (a user's Pause or Cancel, one cancellation to the
598
+ * turn): Temporal's cancellation delivered while the engine hangs settles
599
+ * the transcript into one write that carries no phase and no row (the
600
+ * workflow writes both, stigmer#980), no error, no `completedAt`, and
601
+ * THROWS the stop's `CancelledFailure` so the workflow sees the activity
602
+ * stop.
601
603
  */
602
- export async function assertPausePersistsAndThrows(harness: RuntimeContractHarness, label = "rt-pause"): Promise<RuntimeArmResult> {
604
+ export async function assertOrchestratorStopSettlesAndThrows(
605
+ harness: RuntimeContractHarness,
606
+ label = "rt-orchestrator-stop",
607
+ ): Promise<RuntimeArmResult> {
603
608
  const { subject } = harness;
604
609
  const driver = new RuntimeExecutionDriver(harness, label);
605
610
  let controls: InvocationControls | undefined;
@@ -607,16 +612,22 @@ export async function assertPausePersistsAndThrows(harness: RuntimeContractHarne
607
612
 
608
613
  const invocation = await driver.turn(hangingTurn("Starting on the parser."), { onControls: (c) => (controls = c) });
609
614
 
610
- expect(threwCancelledFailure(invocation.outcome), `${subject.name}: a pause THROWS a CancelledFailure`).toBe(true);
615
+ expect(threwCancelledFailure(invocation.outcome), `${subject.name}: an orchestrator stop THROWS a CancelledFailure`).toBe(true);
611
616
  if (!threwCancelledFailure(invocation.outcome)) throw new Error("unreachable");
612
- expect(invocation.outcome.error.message).toBe(TERMINAL_COPY.pause.throwMessage);
613
- expect(driver.record.persistedPhases.at(-1)).toBe(ExecutionPhase.EXECUTION_PAUSED);
614
- const final = finalStatusOf(harness, driver);
615
- expect(final.error, `${subject.name}: a pause is not an error`).toBe("");
616
- expect(final.completedAt, `${subject.name}: a paused turn is not complete`).toBe("");
617
- expect(systemMessages(final), `${subject.name}: the pause row, exactly once`).toEqual([TERMINAL_COPY.pause.row]);
618
- expect(aiMessages(final)).not.toContain(NEVER_SEEN);
619
- return { driver, invocations: [invocation], final };
617
+ expect(invocation.outcome.error.message).toBe(TERMINAL_COPY.orchestratorStop.throwMessage);
618
+ expect(
619
+ driver.record.persistedPhases.at(-1),
620
+ `${subject.name}: the stop writes no phase; the last phase is the turn's own`,
621
+ ).toBe(ExecutionPhase.EXECUTION_IN_PROGRESS);
622
+ const settle = driver.record.persisted.at(-1);
623
+ if (!settle) throw new Error(`${subject.name}: the runtime persisted nothing`);
624
+ expect(settle.phase, `${subject.name}: the settle write carries no phase`).toBe(ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED);
625
+ assertTranscriptStreamsNothing(subject.name, settle);
626
+ expect(settle.error, `${subject.name}: a stop is not an error`).toBe("");
627
+ expect(settle.completedAt, `${subject.name}: a stopped turn is not complete`).toBe("");
628
+ expect(systemMessages(settle), `${subject.name}: no stop row; the workflow writes it`).toEqual([]);
629
+ expect(aiMessages(settle)).not.toContain(NEVER_SEEN);
630
+ return { driver, invocations: [invocation], final: settle };
620
631
  }
621
632
 
622
633
  /**
@@ -970,9 +981,9 @@ export function describeHarnessRuntimeContract(harness: RuntimeContractHarness,
970
981
  await assertNonExecutingDecisionSettlesSkipped(harness, action);
971
982
  });
972
983
  }
973
- it("a user pause persists PAUSED with the pause row once and throws the pause CancelledFailure", async () => {
984
+ it("an orchestrator stop settles the transcript with no phase and no row, and throws the stop's CancelledFailure", async () => {
974
985
  clock.reset();
975
- await assertPausePersistsAndThrows(harness);
986
+ await assertOrchestratorStopSettlesAndThrows(harness);
976
987
  });
977
988
  it("a worker shutdown persists FAILED with the shutdown copy once and throws the shutdown CancelledFailure", async () => {
978
989
  clock.reset();
@@ -303,10 +303,12 @@ export class ExecutionRecord {
303
303
  * the tool call the runner wrote. The runner owns `status`; the server owns
304
304
  * `approval_action` (field ownership, 005 mandate 2) — so this is the ONE
305
305
  * place a test writes it, and the status stays WAITING_APPROVAL until the
306
- * resumed turn runs the tool, exactly as in production.
306
+ * resumed turn runs the tool, exactly as in production. `onlyId` decides one
307
+ * of several calls paused in the same round and leaves the rest waiting, as
308
+ * a user deciding them one at a time does.
307
309
  */
308
- decideWaitingToolCalls(action: ApprovalAction, decidedAt: string): number {
309
- const waiting = this.waitingToolCalls();
310
+ decideWaitingToolCalls(action: ApprovalAction, decidedAt: string, onlyId?: string): number {
311
+ const waiting = this.waitingToolCalls().filter((tc) => onlyId === undefined || tc.id === onlyId);
310
312
  for (const tc of waiting) {
311
313
  tc.approvalAction = action;
312
314
  tc.approvalDecidedAt = decidedAt;
@@ -329,8 +331,11 @@ export class ExecutionRecord {
329
331
 
330
332
  /**
331
333
  * Apply one `UpdateStatus` write and answer the control signal the server
332
- * would. A setup-progress report never carries a signal (the runner ignores
333
- * the response there; the server has nothing to say about a label).
334
+ * would. A write with no phase never carries a signal (the runner ignores
335
+ * the response there). It is a setup-progress report, or the transcript an
336
+ * orchestrator stop settles (the runtime writes no phase for it; the
337
+ * workflow does, stigmer#980): the server's merge applies the transcript and
338
+ * leaves the phase to its writers, so the double keeps the held phase.
334
339
  */
335
340
  applyStatusUpdate(status: AgentExecutionStatus): ExecutionControlSignal {
336
341
  const snapshot = clone(AgentExecutionStatusSchema, status);
@@ -339,6 +344,12 @@ export class ExecutionRecord {
339
344
  if (snapshot.setupProgress?.currentPhase) {
340
345
  this.setupProgress.push(snapshot.setupProgress.currentPhase);
341
346
  }
347
+ if (snapshot.messages.length > 0) {
348
+ const heldPhase = this.execution.status?.phase ?? ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED;
349
+ this.execution.status = clone(AgentExecutionStatusSchema, snapshot);
350
+ this.execution.status.phase = heldPhase;
351
+ for (const listener of [...this.persistListeners]) listener();
352
+ }
342
353
  return ExecutionControlSignal.UNSPECIFIED;
343
354
  }
344
355
  this.execution.status = clone(AgentExecutionStatusSchema, snapshot);
@@ -4,14 +4,8 @@
4
4
  "type": "MESSAGE_AI",
5
5
  "content": "Starting on the parser.",
6
6
  "timestamp": "2026-01-01T00:00:02.000Z"
7
- },
8
- {
9
- "type": "MESSAGE_SYSTEM",
10
- "content": "Execution paused by user. Use resume to continue.",
11
- "timestamp": "2026-01-01T00:00:03.000Z"
12
7
  }
13
8
  ],
14
- "phase": "EXECUTION_PAUSED",
15
9
  "startedAt": "2026-01-01T00:00:00.000Z",
16
10
  "fileReviewEventStream": {
17
11
  "executionId": "aex_hermetic_0001",