@stigmer/runner 3.1.0 → 3.1.2

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 (111) hide show
  1. package/dist/.build-fingerprint +1 -1
  2. package/dist/activities/execute-cursor/attachment-resolver.d.ts +49 -8
  3. package/dist/activities/execute-cursor/attachment-resolver.js +83 -26
  4. package/dist/activities/execute-cursor/attachment-resolver.js.map +1 -1
  5. package/dist/activities/execute-cursor/cas-observations.d.ts +13 -0
  6. package/dist/activities/execute-cursor/cas-observations.js +39 -5
  7. package/dist/activities/execute-cursor/cas-observations.js.map +1 -1
  8. package/dist/activities/execute-cursor/hook-script.js +19 -1
  9. package/dist/activities/execute-cursor/hook-script.js.map +1 -1
  10. package/dist/activities/execute-cursor/index.d.ts +5 -0
  11. package/dist/activities/execute-cursor/index.js +102 -22
  12. package/dist/activities/execute-cursor/index.js.map +1 -1
  13. package/dist/activities/execute-cursor/message-translator.js +10 -1
  14. package/dist/activities/execute-cursor/message-translator.js.map +1 -1
  15. package/dist/activities/execute-cursor/prompt-builder.d.ts +32 -7
  16. package/dist/activities/execute-cursor/prompt-builder.js +38 -20
  17. package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
  18. package/dist/activities/execute-cursor/skill-resolver.d.ts +1 -10
  19. package/dist/activities/execute-cursor/skill-resolver.js +3 -55
  20. package/dist/activities/execute-cursor/skill-resolver.js.map +1 -1
  21. package/dist/activities/execute-cursor/stigmer-link.d.ts +35 -0
  22. package/dist/activities/execute-cursor/stigmer-link.js +73 -0
  23. package/dist/activities/execute-cursor/stigmer-link.js.map +1 -0
  24. package/dist/activities/execute-cursor/workspace-provision.d.ts +3 -2
  25. package/dist/activities/execute-cursor/workspace-provision.js +5 -3
  26. package/dist/activities/execute-cursor/workspace-provision.js.map +1 -1
  27. package/dist/activities/execute-deep-agent/index.js +59 -2
  28. package/dist/activities/execute-deep-agent/index.js.map +1 -1
  29. package/dist/activities/execute-deep-agent/prompt-builder.d.ts +17 -0
  30. package/dist/activities/execute-deep-agent/prompt-builder.js +16 -0
  31. package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
  32. package/dist/activities/execute-deep-agent/setup.js +22 -16
  33. package/dist/activities/execute-deep-agent/setup.js.map +1 -1
  34. package/dist/config.d.ts +7 -0
  35. package/dist/config.js +9 -0
  36. package/dist/config.js.map +1 -1
  37. package/dist/middleware/approval-gate.js +36 -6
  38. package/dist/middleware/approval-gate.js.map +1 -1
  39. package/dist/runner-manager.d.ts +2 -0
  40. package/dist/runner-manager.js +2 -1
  41. package/dist/runner-manager.js.map +1 -1
  42. package/dist/runner.d.ts +2 -0
  43. package/dist/runner.js +2 -1
  44. package/dist/runner.js.map +1 -1
  45. package/dist/shared/artifact-storage.d.ts +32 -0
  46. package/dist/shared/artifact-storage.js +74 -1
  47. package/dist/shared/artifact-storage.js.map +1 -1
  48. package/dist/shared/implement-plan-prompt.d.ts +42 -0
  49. package/dist/shared/implement-plan-prompt.js +66 -0
  50. package/dist/shared/implement-plan-prompt.js.map +1 -0
  51. package/dist/shared/plan-mode-prompt.d.ts +30 -0
  52. package/dist/shared/plan-mode-prompt.js +51 -0
  53. package/dist/shared/plan-mode-prompt.js.map +1 -0
  54. package/dist/shared/status.d.ts +11 -0
  55. package/dist/shared/status.js +12 -2
  56. package/dist/shared/status.js.map +1 -1
  57. package/dist/shared/tool-row.d.ts +30 -1
  58. package/dist/shared/tool-row.js +53 -4
  59. package/dist/shared/tool-row.js.map +1 -1
  60. package/dist/shared/workspace/session-root.d.ts +35 -0
  61. package/dist/shared/workspace/session-root.js +53 -0
  62. package/dist/shared/workspace/session-root.js.map +1 -0
  63. package/dist/shared/workspace/workspace-lock.d.ts +86 -0
  64. package/dist/shared/workspace/workspace-lock.js +187 -0
  65. package/dist/shared/workspace/workspace-lock.js.map +1 -0
  66. package/package.json +7 -5
  67. package/src/__tests__/config.test.ts +8 -0
  68. package/src/activities/__tests__/classify-tool-approvals.test.ts +1 -0
  69. package/src/activities/__tests__/discover-mcp-server.test.ts +1 -0
  70. package/src/activities/execute-cursor/__tests__/attachment-resolver.test.ts +161 -0
  71. package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +125 -2
  72. package/src/activities/execute-cursor/__tests__/cas-observations.test.ts +55 -0
  73. package/src/activities/execute-cursor/__tests__/hitl-ledger.test.ts +28 -0
  74. package/src/activities/execute-cursor/__tests__/hook-script.test.ts +63 -4
  75. package/src/activities/execute-cursor/__tests__/workspace-provision.test.ts +36 -2
  76. package/src/activities/execute-cursor/attachment-resolver.ts +116 -34
  77. package/src/activities/execute-cursor/cas-observations.ts +41 -5
  78. package/src/activities/execute-cursor/hook-script.ts +19 -1
  79. package/src/activities/execute-cursor/index.ts +114 -26
  80. package/src/activities/execute-cursor/message-translator.ts +9 -1
  81. package/src/activities/execute-cursor/prompt-builder.ts +60 -22
  82. package/src/activities/execute-cursor/skill-resolver.ts +3 -59
  83. package/src/activities/execute-cursor/stigmer-link.ts +78 -0
  84. package/src/activities/execute-cursor/workspace-provision.ts +5 -3
  85. package/src/activities/execute-deep-agent/__tests__/hitl-resume-approve-all.test.ts +7 -2
  86. package/src/activities/execute-deep-agent/__tests__/hitl-resume-history.test.ts +7 -2
  87. package/src/activities/execute-deep-agent/__tests__/index.test.ts +4 -1
  88. package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +88 -0
  89. package/src/activities/execute-deep-agent/__tests__/sequential-gate-resume.test.ts +7 -2
  90. package/src/activities/execute-deep-agent/index.ts +70 -2
  91. package/src/activities/execute-deep-agent/prompt-builder.ts +39 -0
  92. package/src/activities/execute-deep-agent/setup.ts +25 -17
  93. package/src/config.ts +17 -0
  94. package/src/middleware/__tests__/approval-gate.test.ts +77 -12
  95. package/src/middleware/approval-gate.ts +39 -7
  96. package/src/runner-manager.ts +6 -1
  97. package/src/runner.ts +6 -1
  98. package/src/shared/__tests__/artifact-storage.test.ts +111 -1
  99. package/src/shared/__tests__/implement-plan-prompt.test.ts +48 -0
  100. package/src/shared/__tests__/secret-leak-scan.test.ts +105 -0
  101. package/src/shared/__tests__/status.test.ts +7 -2
  102. package/src/shared/__tests__/tool-row.test.ts +136 -1
  103. package/src/shared/artifact-storage.ts +83 -1
  104. package/src/shared/implement-plan-prompt.ts +73 -0
  105. package/src/shared/plan-mode-prompt.ts +51 -0
  106. package/src/shared/status.ts +11 -1
  107. package/src/shared/tool-row.ts +58 -5
  108. package/src/shared/workspace/__tests__/session-root.test.ts +42 -0
  109. package/src/shared/workspace/__tests__/workspace-lock.test.ts +200 -0
  110. package/src/shared/workspace/session-root.ts +60 -0
  111. package/src/shared/workspace/workspace-lock.ts +241 -0
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-storage.js","sourceRoot":"","sources":["../../src/shared/artifact-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAwB1C,wEAAwE;AAExE,MAAM,OAAO,oBAAoB;IACd,QAAQ,CAAS;IACjB,YAAY,CAAS;IAEtC,YAAY,QAAgB,EAAE,YAAoB;QAChD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,OAAe,EAAE,YAAqB;QAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC1C,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CA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ACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,GAA0B,EAC1B,GAA4B;IAE5B,IAAI,OAAwB,CAAC;IAC7B,IAAI,CAAC;QACH,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CACV,0EAA0E;YAC1E,kDAAkD,GAAG,CAAC,WAAW,IAAI;YACrE,QAAQ,GAAG,CAAC,IAAI,WAAW,GAAG,EAAE,CACjC,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,MAAM,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,CAAC,IAAI,CACV,4EAA4E;YAC5E,4DAA4D,GAAG,CAAC,WAAW,IAAI;YAC/E,QAAQ,GAAG,CAAC,SAAS,EAAE,CACxB,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The Build-from-plan prompt directive, shared by both harnesses.
3
+ *
4
+ * When the user approves a plan and clicks "Build from plan", the client
5
+ * submits an execution with `spec.execution_config.build_from_plan` set and a
6
+ * short human-readable message ("Build from plan") — it does NOT embed
7
+ * implement instructions in the message text. The runner owns the agent-facing
8
+ * instruction, injected from this module, so the chat thread can render the
9
+ * turn as a compact chip while the model still receives the full contract.
10
+ *
11
+ * The directive has two variants, chosen by whether the approved plan document
12
+ * actually materialized in the workspace:
13
+ * - Attached (the normal case): the client uploaded the approved plan text
14
+ * (edited or not) and attached it, mounted at `.stigmer/inputs/plan.md`.
15
+ * The directive points the model at that file and names it authoritative —
16
+ * the user may have refined the document after the plan turn, so the
17
+ * conversation's version can be stale.
18
+ * - Conversation-only (the client's upload failed): the directive falls back
19
+ * to the plan as proposed in the conversation.
20
+ *
21
+ * Like `PLAN_MODE_DIRECTIVE` (plan-mode-prompt.ts), this module is the single
22
+ * source of truth for the words; each harness wraps them in its own prompt
23
+ * framing (XML-tag section for Cursor, markdown heading for the native
24
+ * harness).
25
+ */
26
+ /**
27
+ * Find the approved plan document among the workspace paths the harness
28
+ * injected for this execution's attachments. Detection keys on the canonical
29
+ * plan filename — the same convention the UI uses to detect the plan artifact.
30
+ * Returns `undefined` when no plan attachment landed (upload failed, or the
31
+ * attachment itself failed to inject), which selects the conversation-only
32
+ * directive variant.
33
+ */
34
+ export declare function findApprovedPlanPath(attachmentPaths: readonly string[]): string | undefined;
35
+ /**
36
+ * Build the implement-plan directive body for a Build-from-plan execution.
37
+ *
38
+ * @param planPath - Workspace-relative path of the attached approved plan
39
+ * (from {@link findApprovedPlanPath}), or `undefined` when the plan exists
40
+ * only in the conversation.
41
+ */
42
+ export declare function buildImplementPlanDirective(planPath?: string): string;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The Build-from-plan prompt directive, shared by both harnesses.
3
+ *
4
+ * When the user approves a plan and clicks "Build from plan", the client
5
+ * submits an execution with `spec.execution_config.build_from_plan` set and a
6
+ * short human-readable message ("Build from plan") — it does NOT embed
7
+ * implement instructions in the message text. The runner owns the agent-facing
8
+ * instruction, injected from this module, so the chat thread can render the
9
+ * turn as a compact chip while the model still receives the full contract.
10
+ *
11
+ * The directive has two variants, chosen by whether the approved plan document
12
+ * actually materialized in the workspace:
13
+ * - Attached (the normal case): the client uploaded the approved plan text
14
+ * (edited or not) and attached it, mounted at `.stigmer/inputs/plan.md`.
15
+ * The directive points the model at that file and names it authoritative —
16
+ * the user may have refined the document after the plan turn, so the
17
+ * conversation's version can be stale.
18
+ * - Conversation-only (the client's upload failed): the directive falls back
19
+ * to the plan as proposed in the conversation.
20
+ *
21
+ * Like `PLAN_MODE_DIRECTIVE` (plan-mode-prompt.ts), this module is the single
22
+ * source of truth for the words; each harness wraps them in its own prompt
23
+ * framing (XML-tag section for Cursor, markdown heading for the native
24
+ * harness).
25
+ */
26
+ import { PLAN_ARTIFACT_NAME } from "./plan-artifact.js";
27
+ /**
28
+ * Find the approved plan document among the workspace paths the harness
29
+ * injected for this execution's attachments. Detection keys on the canonical
30
+ * plan filename — the same convention the UI uses to detect the plan artifact.
31
+ * Returns `undefined` when no plan attachment landed (upload failed, or the
32
+ * attachment itself failed to inject), which selects the conversation-only
33
+ * directive variant.
34
+ */
35
+ export function findApprovedPlanPath(attachmentPaths) {
36
+ return attachmentPaths.find((p) => p.split("/").pop() === PLAN_ARTIFACT_NAME);
37
+ }
38
+ /**
39
+ * Build the implement-plan directive body for a Build-from-plan execution.
40
+ *
41
+ * @param planPath - Workspace-relative path of the attached approved plan
42
+ * (from {@link findApprovedPlanPath}), or `undefined` when the plan exists
43
+ * only in the conversation.
44
+ */
45
+ export function buildImplementPlanDirective(planPath) {
46
+ if (planPath) {
47
+ return [
48
+ "IMPORTANT: This turn implements a plan the user has reviewed and " +
49
+ "APPROVED.",
50
+ "",
51
+ `The approved plan document is attached at \`${planPath}\`. Read it ` +
52
+ "FIRST, then implement it step by step.",
53
+ "",
54
+ "That document is the authoritative version of the plan — the user may " +
55
+ "have edited it after it was proposed, so where it differs from the " +
56
+ "conversation above, follow the document.",
57
+ ].join("\n");
58
+ }
59
+ return [
60
+ "IMPORTANT: This turn implements a plan the user has reviewed and " +
61
+ "APPROVED.",
62
+ "",
63
+ "Implement the plan proposed in the conversation above, step by step.",
64
+ ].join("\n");
65
+ }
66
+ //# sourceMappingURL=implement-plan-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"implement-plan-prompt.js","sourceRoot":"","sources":["../../src/shared/implement-plan-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,eAAkC;IAElC,OAAO,eAAe,CAAC,IAAI,CACzB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,kBAAkB,CACjD,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAAiB;IAC3D,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,mEAAmE;gBACjE,WAAW;YACb,EAAE;YACF,+CAA+C,QAAQ,cAAc;gBACnE,wCAAwC;YAC1C,EAAE;YACF,wEAAwE;gBACtE,qEAAqE;gBACrE,0CAA0C;SAC7C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,OAAO;QACL,mEAAmE;YACjE,WAAW;QACb,EAAE;QACF,sEAAsE;KACvE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The Plan-mode prompt directive, shared by both harnesses.
3
+ *
4
+ * Plan mode's output contract spans three components that must agree:
5
+ * - the model produces the plan as its FINAL message (this directive),
6
+ * - the runner publishes that final message verbatim as a `plan.md` artifact
7
+ * (`plan-artifact.ts` — `extractFinalPlanText`),
8
+ * - the SDK promotes the same message to a first-class plan document in the
9
+ * thread and offers "Build from plan".
10
+ *
11
+ * This module is the single source of truth for how the model is told to
12
+ * behave, so the two harnesses can never drift apart on the contract. Each
13
+ * harness wraps the directive in its own prompt framing (the Cursor harness
14
+ * uses XML-tag sections, the native harness markdown headings) — the framing
15
+ * is house style; the words are shared.
16
+ *
17
+ * Enforcement is separate from instruction: the native harness ALSO denies
18
+ * filesystem writes at the tool layer (see execute-deep-agent/setup.ts), so
19
+ * for it this directive is guidance toward a well-formed plan, not the
20
+ * enforcement mechanism. The Cursor harness has no tool-level lever (the
21
+ * Cursor SDK exposes no mode parameter), so there this directive is the
22
+ * enforcement — a documented stopgap.
23
+ */
24
+ /**
25
+ * Directive body injected into the system prompt of every Plan-mode
26
+ * execution. Deliberately explicit about the deliverable's shape: the final
27
+ * message is published verbatim as `plan.md`, so a fenced or chat-suffixed
28
+ * plan degrades the reviewable document the user sees.
29
+ */
30
+ export declare const PLAN_MODE_DIRECTIVE: string;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The Plan-mode prompt directive, shared by both harnesses.
3
+ *
4
+ * Plan mode's output contract spans three components that must agree:
5
+ * - the model produces the plan as its FINAL message (this directive),
6
+ * - the runner publishes that final message verbatim as a `plan.md` artifact
7
+ * (`plan-artifact.ts` — `extractFinalPlanText`),
8
+ * - the SDK promotes the same message to a first-class plan document in the
9
+ * thread and offers "Build from plan".
10
+ *
11
+ * This module is the single source of truth for how the model is told to
12
+ * behave, so the two harnesses can never drift apart on the contract. Each
13
+ * harness wraps the directive in its own prompt framing (the Cursor harness
14
+ * uses XML-tag sections, the native harness markdown headings) — the framing
15
+ * is house style; the words are shared.
16
+ *
17
+ * Enforcement is separate from instruction: the native harness ALSO denies
18
+ * filesystem writes at the tool layer (see execute-deep-agent/setup.ts), so
19
+ * for it this directive is guidance toward a well-formed plan, not the
20
+ * enforcement mechanism. The Cursor harness has no tool-level lever (the
21
+ * Cursor SDK exposes no mode parameter), so there this directive is the
22
+ * enforcement — a documented stopgap.
23
+ */
24
+ /**
25
+ * Directive body injected into the system prompt of every Plan-mode
26
+ * execution. Deliberately explicit about the deliverable's shape: the final
27
+ * message is published verbatim as `plan.md`, so a fenced or chat-suffixed
28
+ * plan degrades the reviewable document the user sees.
29
+ */
30
+ export const PLAN_MODE_DIRECTIVE = [
31
+ "IMPORTANT: You are in Plan mode — a read-only analysis turn whose " +
32
+ "deliverable is an implementation plan.",
33
+ "",
34
+ "Constraints:",
35
+ "- Do NOT create, edit, or delete any files.",
36
+ "- Do NOT run commands that modify the filesystem or any external state.",
37
+ "- Only read, search, and analyze.",
38
+ "",
39
+ "Deliverable — your FINAL message IS the plan. It is published verbatim " +
40
+ "as a `plan.md` document that the user reviews and builds from, so:",
41
+ "- Write it as a complete, well-structured markdown document: start with " +
42
+ "a single `#` title and organize the work under `##` section headings. " +
43
+ "Use lists and tables where they aid scanning.",
44
+ "- Reference concrete file paths and describe the specific changes " +
45
+ "planned for each.",
46
+ "- Do NOT wrap the document in a code fence.",
47
+ '- Do NOT end with conversational closers ("Let me know...", "Shall I ' +
48
+ 'proceed?") — the next step is the user\'s Build action, and trailing ' +
49
+ "chat would be published as part of the document.",
50
+ ].join("\n");
51
+ //# sourceMappingURL=plan-mode-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-mode-prompt.js","sourceRoot":"","sources":["../../src/shared/plan-mode-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,oEAAoE;QAClE,wCAAwC;IAC1C,EAAE;IACF,cAAc;IACd,6CAA6C;IAC7C,yEAAyE;IACzE,mCAAmC;IACnC,EAAE;IACF,yEAAyE;QACvE,oEAAoE;IACtE,0EAA0E;QACxE,wEAAwE;QACxE,+CAA+C;IACjD,oEAAoE;QAClE,mBAAmB;IACrB,6CAA6C;IAC7C,uEAAuE;QACrE,uEAAuE;QACvE,kDAAkD;CACrD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -51,6 +51,17 @@ export declare function persistStatus(client: StigmerClient, executionId: string
51
51
  /**
52
52
  * Report a setup progress phase (e.g. "Resolving MCP servers") so the
53
53
  * frontend can display a spinner with context.
54
+ *
55
+ * Deliberately carries NO execution phase (UNSPECIFIED = "leave unchanged"):
56
+ * the server keeps `setup_progress` only while the merged phase is still
57
+ * PENDING (update_status.go / AgentExecutionUpdateStatusHandler clear it the
58
+ * moment the phase leaves PENDING), and the UI renders the label only in
59
+ * that window (SetupProgress.tsx: "Server-driven — preferred during
60
+ * PENDING"). Sending IN_PROGRESS here flipped the phase on the very first
61
+ * setup report, so every label self-destructed on arrival and the user saw
62
+ * a generic spinner instead. The genuine PENDING→IN_PROGRESS transition
63
+ * belongs to the streaming path, which persists it when the agent actually
64
+ * starts producing output.
54
65
  */
55
66
  export declare function reportSetupProgress(client: StigmerClient, executionId: string, phase: string): Promise<void>;
56
67
  /**
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { create, toJson } from "@bufbuild/protobuf";
11
11
  import { AgentExecutionStatusSchema, SetupProgressSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
12
- import { ExecutionControlSignal, ExecutionPhase, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
12
+ import { ExecutionControlSignal, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
13
13
  import { offloadOversizedToolOutputs, offloadCandidateChangesToFit, enforceStatusSizeLimit, STATUS_PAYLOAD_HARD_LIMIT_BYTES, } from "./status-offload.js";
14
14
  import { isRetryableError, isTerminalError, } from "./grpc-retry.js";
15
15
  export function utcTimestamp() {
@@ -137,10 +137,20 @@ export async function persistStatus(client, executionId, status, options = {}) {
137
137
  /**
138
138
  * Report a setup progress phase (e.g. "Resolving MCP servers") so the
139
139
  * frontend can display a spinner with context.
140
+ *
141
+ * Deliberately carries NO execution phase (UNSPECIFIED = "leave unchanged"):
142
+ * the server keeps `setup_progress` only while the merged phase is still
143
+ * PENDING (update_status.go / AgentExecutionUpdateStatusHandler clear it the
144
+ * moment the phase leaves PENDING), and the UI renders the label only in
145
+ * that window (SetupProgress.tsx: "Server-driven — preferred during
146
+ * PENDING"). Sending IN_PROGRESS here flipped the phase on the very first
147
+ * setup report, so every label self-destructed on arrival and the user saw
148
+ * a generic spinner instead. The genuine PENDING→IN_PROGRESS transition
149
+ * belongs to the streaming path, which persists it when the agent actually
150
+ * starts producing output.
140
151
  */
141
152
  export async function reportSetupProgress(client, executionId, phase) {
142
153
  const status = create(AgentExecutionStatusSchema, {
143
- phase: ExecutionPhase.EXECUTION_IN_PROGRESS,
144
154
  setupProgress: create(SetupProgressSchema, { currentPhase: phase }),
145
155
  });
146
156
  await persistStatus(client, executionId, status);
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/shared/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,6DAA6D,CAAC;AAErE,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,8DAA8D,CAAC;AAEtE,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,sBAAsB,EACtB,+BAA+B,GAEhC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,eAAe,GAEhB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,GAAY;IACrC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAC7D,IAAK,GAA0B,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IAC1D,CAAC;IACD,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,0CAA0C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9D,CAAC;AAkBD;;;;GAIG;AACH,MAAM,qBAAqB,GAAG;IAC5B,WAAW,EAAE,GAAG;IAChB,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;CACL,CAAC;AAEX,SAAS,YAAY,CAAC,EAAU;IAC9B,OAA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AAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAA0B;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,0BAA0B,EAAE;QAC9C,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;KACxC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;IACtD,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,IAA+B,CAAC;QAChD,MAAM,QAAQ,GAAG,kBAAkB,IAAI,OAAO,CAAC;QAC/C,OAAO,CAAC,GAAG,CACT,+CAA+C;YAC/C,yCAAyC,QAAQ,IAAI;YACrD,cAAc,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC/C,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -16,7 +16,7 @@
16
16
  * collapse consumer — a superseded same-turn denial twin — and as the render
17
17
  * shape of legacy (pre-stamping) sessions whose flowed edit rows were hidden.
18
18
  */
19
- import type { ToolCall } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
19
+ import type { AgentMessage, ToolCall } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
20
20
  import type { SubAgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/subagent_pb";
21
21
  /**
22
22
  * Stamp a flowed file-edit row with the change set that captured its turn.
@@ -43,6 +43,35 @@ import type { SubAgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agent
43
43
  * path cannot be determined is stripped rather than trusted.
44
44
  */
45
45
  export declare function stampFileEditRow(tc: ToolCall, changeSetId: string): void;
46
+ /**
47
+ * Withhold a file-mutating row's CONTENT while keeping its path visible: reduce
48
+ * `args` to `{ path }` (or `undefined` when the path cannot be determined) and
49
+ * clear `args_preview`. `result` and `status` are left untouched — a caller that
50
+ * needs the diff dropped clears it explicitly (see {@link stampFileEditRow}).
51
+ * Returns whether the row was secret-like (and therefore withheld).
52
+ *
53
+ * The single primitive behind the never-persist-secret-contents contract (design
54
+ * doc 12, D4): a file-mutating tool's `args` holds the full write body, which for
55
+ * a secret-like path must never reach the transcript / Temporal history. A
56
+ * filename is not itself the secret, so the path is kept. Fail-closed: an
57
+ * undeterminable path is treated as secret-like ({@link isSecretLikePath} of "").
58
+ */
59
+ export declare function withholdSecretFileContent(tc: ToolCall): boolean;
60
+ /**
61
+ * Universal backstop (DD-26 follow-up #2): withhold secret content from every
62
+ * built-in file-WRITE row in a transcript (top-level + each sub-agent's), across
63
+ * BOTH harnesses, right before the status is persisted.
64
+ *
65
+ * This is the ONLY guarantee that survives `spec.auto_approve_all`, where the
66
+ * approval gate / deny-gate is never installed, so no per-harness hard-block runs
67
+ * — yet a secret write still flows and its content lands on the streamed row. It
68
+ * is a no-op in capture mode (the flowed rows are already content-less after
69
+ * {@link stampFileEditRow}, which shares {@link withholdSecretFileContent}), and
70
+ * is the deny-gate analog of the capture-mode stamping pass, which does not run
71
+ * when there is no change set. Scoped to `write` (FILE_WRITE/FILE_EDIT) because a
72
+ * delete carries no content.
73
+ */
74
+ export declare function withholdSecretContentFromMessages(messages: readonly AgentMessage[], subAgents?: readonly SubAgentExecution[]): void;
46
75
  /**
47
76
  * Collapse a tool-call row to the hidden shape the SDK renders as absent: a
48
77
  * SKIPPED row with no approval state, result, error, preview, or args.
@@ -19,6 +19,7 @@
19
19
  import { ToolCallStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
20
20
  import { extractFilePath } from "./file-tools.js";
21
21
  import { isSecretLikePath } from "./filereview/secret-paths.js";
22
+ import { toolApprovalCategory } from "./tool-kind.js";
22
23
  import { utcTimestamp } from "./status.js";
23
24
  /**
24
25
  * Stamp a flowed file-edit row with the change set that captured its turn.
@@ -48,11 +49,59 @@ export function stampFileEditRow(tc, changeSetId) {
48
49
  if (tc.fileChangeSetId)
49
50
  return;
50
51
  tc.fileChangeSetId = changeSetId;
51
- const path = extractFilePath((tc.args ?? {})) ?? "";
52
- if (isSecretLikePath(path)) {
53
- tc.args = path ? { path } : undefined;
52
+ if (withholdSecretFileContent(tc)) {
53
+ // A FLOWED row's `result` is the tool's own output — for an edit that can
54
+ // echo the changed lines so drop it too. withholdSecretFileContent keeps
55
+ // `result` intact because the deny-gate path (below) uses it for the safe
56
+ // "blocked for security" message; here the row actually ran, so clear it.
54
57
  tc.result = "";
55
- tc.argsPreview = "";
58
+ }
59
+ }
60
+ /**
61
+ * Withhold a file-mutating row's CONTENT while keeping its path visible: reduce
62
+ * `args` to `{ path }` (or `undefined` when the path cannot be determined) and
63
+ * clear `args_preview`. `result` and `status` are left untouched — a caller that
64
+ * needs the diff dropped clears it explicitly (see {@link stampFileEditRow}).
65
+ * Returns whether the row was secret-like (and therefore withheld).
66
+ *
67
+ * The single primitive behind the never-persist-secret-contents contract (design
68
+ * doc 12, D4): a file-mutating tool's `args` holds the full write body, which for
69
+ * a secret-like path must never reach the transcript / Temporal history. A
70
+ * filename is not itself the secret, so the path is kept. Fail-closed: an
71
+ * undeterminable path is treated as secret-like ({@link isSecretLikePath} of "").
72
+ */
73
+ export function withholdSecretFileContent(tc) {
74
+ const path = extractFilePath((tc.args ?? {})) ?? "";
75
+ if (!isSecretLikePath(path))
76
+ return false;
77
+ tc.args = path ? { path } : undefined;
78
+ tc.argsPreview = "";
79
+ return true;
80
+ }
81
+ /**
82
+ * Universal backstop (DD-26 follow-up #2): withhold secret content from every
83
+ * built-in file-WRITE row in a transcript (top-level + each sub-agent's), across
84
+ * BOTH harnesses, right before the status is persisted.
85
+ *
86
+ * This is the ONLY guarantee that survives `spec.auto_approve_all`, where the
87
+ * approval gate / deny-gate is never installed, so no per-harness hard-block runs
88
+ * — yet a secret write still flows and its content lands on the streamed row. It
89
+ * is a no-op in capture mode (the flowed rows are already content-less after
90
+ * {@link stampFileEditRow}, which shares {@link withholdSecretFileContent}), and
91
+ * is the deny-gate analog of the capture-mode stamping pass, which does not run
92
+ * when there is no change set. Scoped to `write` (FILE_WRITE/FILE_EDIT) because a
93
+ * delete carries no content.
94
+ */
95
+ export function withholdSecretContentFromMessages(messages, subAgents) {
96
+ for (const msg of messages) {
97
+ for (const tc of msg.toolCalls) {
98
+ if (toolApprovalCategory(tc.name) === "write") {
99
+ withholdSecretFileContent(tc);
100
+ }
101
+ }
102
+ }
103
+ for (const sa of subAgents ?? []) {
104
+ withholdSecretContentFromMessages(sa.messages);
56
105
  }
57
106
  }
58
107
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tool-row.js","sourceRoot":"","sources":["../../src/shared/tool-row.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAG9F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAY,EAAE,WAAmB;IAChE,IAAI,EAAE,CAAC,eAAe;QAAE,OAAO;IAC/B,EAAE,CAAC,eAAe,GAAG,WAAW,CAAC;IAEjC,MAAM,IAAI,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC,IAAI,EAAE,CAAC;IAC/E,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,EAAE,CA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,EAAE,CAAC,MAAM;QACV,CAAC,EAAE,CAAC,KAAK,CACV,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAAuC;IAEvC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;YAC9B,KAAK,MAAM,EAAE,IAAI,GAAG,CAAC,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Session workspace-root resolution — shared by both executors (Cursor and
3
+ * deep-agent) so their placement rules can never drift.
4
+ *
5
+ * SessionSpec.workspace_entries promises: "When empty, the session uses an
6
+ * empty workspace directory." Handing every no-entry session the shared
7
+ * `config.workspaceRootDir` broke that contract twice over: a "new" session
8
+ * started amid every prior session's leftovers, and — under the per-workspace
9
+ * turn lock (workspace-lock.ts) — unrelated no-entry sessions would falsely
10
+ * serialize against each other. A per-session directory honors the contract,
11
+ * isolates the default quickstart case, and removes the false contention.
12
+ *
13
+ * Sessions WITH entries keep the shared root: their content identity is the
14
+ * entry source (a git URL clones idempotently, a localPath IS the user's
15
+ * directory), and cross-session sharing of that content is intentional —
16
+ * that sharing is exactly what the turn lock serializes.
17
+ */
18
+ /**
19
+ * Resolve (and create) the working-tree root for a session.
20
+ *
21
+ * - No workspace entries → `{workspaceRootDir}/sessions/{sessionId}`, created
22
+ * on demand. Deterministic from sessionId alone, so it is stable across
23
+ * turns, HITL reinvocations, and Temporal retries with no persisted state.
24
+ * - One or more entries → the shared `workspaceRootDir`, where the
25
+ * provisioner materializes each entry (in place, or per-entry subdirs).
26
+ *
27
+ * The `sessions/` namespace lives under the configured workspace root (the
28
+ * volume operators size and mount for workspace content), not under $HOME.
29
+ * It can coexist with a single-entry clone at the root: cloneInPlace
30
+ * (sources/git.ts) tolerates non-empty targets, colliding only if the repo
31
+ * itself ships a root-level `sessions` path — a strictly smaller surface
32
+ * than the old behavior, where any file a no-entry session dropped at the
33
+ * root could break the checkout.
34
+ */
35
+ export declare function resolveSessionWorkspaceRoot(workspaceRootDir: string, workspaceEntries: readonly unknown[], sessionId: string): Promise<string>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Session workspace-root resolution — shared by both executors (Cursor and
3
+ * deep-agent) so their placement rules can never drift.
4
+ *
5
+ * SessionSpec.workspace_entries promises: "When empty, the session uses an
6
+ * empty workspace directory." Handing every no-entry session the shared
7
+ * `config.workspaceRootDir` broke that contract twice over: a "new" session
8
+ * started amid every prior session's leftovers, and — under the per-workspace
9
+ * turn lock (workspace-lock.ts) — unrelated no-entry sessions would falsely
10
+ * serialize against each other. A per-session directory honors the contract,
11
+ * isolates the default quickstart case, and removes the false contention.
12
+ *
13
+ * Sessions WITH entries keep the shared root: their content identity is the
14
+ * entry source (a git URL clones idempotently, a localPath IS the user's
15
+ * directory), and cross-session sharing of that content is intentional —
16
+ * that sharing is exactly what the turn lock serializes.
17
+ */
18
+ import { join } from "node:path";
19
+ import { mkdir } from "node:fs/promises";
20
+ /**
21
+ * Resolve (and create) the working-tree root for a session.
22
+ *
23
+ * - No workspace entries → `{workspaceRootDir}/sessions/{sessionId}`, created
24
+ * on demand. Deterministic from sessionId alone, so it is stable across
25
+ * turns, HITL reinvocations, and Temporal retries with no persisted state.
26
+ * - One or more entries → the shared `workspaceRootDir`, where the
27
+ * provisioner materializes each entry (in place, or per-entry subdirs).
28
+ *
29
+ * The `sessions/` namespace lives under the configured workspace root (the
30
+ * volume operators size and mount for workspace content), not under $HOME.
31
+ * It can coexist with a single-entry clone at the root: cloneInPlace
32
+ * (sources/git.ts) tolerates non-empty targets, colliding only if the repo
33
+ * itself ships a root-level `sessions` path — a strictly smaller surface
34
+ * than the old behavior, where any file a no-entry session dropped at the
35
+ * root could break the checkout.
36
+ */
37
+ export async function resolveSessionWorkspaceRoot(workspaceRootDir, workspaceEntries, sessionId) {
38
+ if (workspaceEntries.length > 0) {
39
+ return workspaceRootDir;
40
+ }
41
+ if (!sessionId) {
42
+ // Same invariant as resolvePlatformOptions: an empty sessionId would
43
+ // collapse every no-entry session onto one directory — the exact leakage
44
+ // this function exists to prevent.
45
+ throw new Error("resolveSessionWorkspaceRoot: sessionId is required for a session with " +
46
+ "no workspace entries; an empty value would collapse every such session " +
47
+ "onto one shared directory.");
48
+ }
49
+ const sessionRoot = join(workspaceRootDir, "sessions", sessionId);
50
+ await mkdir(sessionRoot, { recursive: true });
51
+ return sessionRoot;
52
+ }
53
+ //# sourceMappingURL=session-root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-root.js","sourceRoot":"","sources":["../../../src/shared/workspace/session-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,gBAAwB,EACxB,gBAAoC,EACpC,SAAiB;IAEjB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,qEAAqE;QACrE,yEAAyE;QACzE,mCAAmC;QACnC,MAAM,IAAI,KAAK,CACb,wEAAwE;YACxE,yEAAyE;YACzE,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAClE,MAAM,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Per-workspace turn lock — serializes agent-execution turns that share a
3
+ * working tree.
4
+ *
5
+ * Why this exists: the file-review substrate (shared/filereview) computes a
6
+ * turn's change set as `git diff baselineTree candidateTree`, where both trees
7
+ * are live snapshots of the working directory at turn start/end. That model is
8
+ * correct for a single writer, but nothing scopes a working tree to one
9
+ * execution: sessions declaring the same `localPath` (or sharing the runner's
10
+ * `workspaceRootDir`) resolve to the SAME directory, and the runner happily
11
+ * runs activities concurrently. A concurrent turn's write landing between
12
+ * another turn's baseline and candidate gets misattributed to that other turn
13
+ * (observed in prod: aex_01kwpzhmvbvwqdez9cb331nekr reviewed a notes.md it
14
+ * never wrote). The same race lets a reject-reconcile in one session silently
15
+ * revert a file another session's user just approved.
16
+ *
17
+ * Why a FILE lock and not in-process/server-side coordination: the shared
18
+ * resource is a directory on one host. A `localPath` entry resolves to the
19
+ * user's literal directory in ANY runner process on the machine — the CLI
20
+ * daemon and the desktop app's embedded runner can contend on one tree while
21
+ * answering to DIFFERENT control planes, so no single server can see all
22
+ * contenders and no in-process mutex can exclude a sibling process. Mutual
23
+ * exclusion must live where the collision happens: the filesystem.
24
+ *
25
+ * Mechanics (proper-lockfile):
26
+ * - The lock artifact lives under `~/.stigmer/workspace-locks/{key}.lock`,
27
+ * NEVER inside the user's workspace (issue #173: attaching a real repo must
28
+ * leave no Stigmer droppings). The key is sha256(realpath(workspaceRoot)),
29
+ * so symlink aliases of one directory converge on one lock — the same
30
+ * keying pattern as getHitlGateDir in platform-dir.ts.
31
+ * - While held, proper-lockfile refreshes the artifact's mtime on an interval;
32
+ * if the holder process dies, refreshing stops and the artifact goes stale,
33
+ * so the next waiter simply takes over. A crashed runner can never deadlock
34
+ * a workspace, and no human ever has to delete a lock file.
35
+ * - Deadlock-free by construction: an activity holds at most ONE lock (its
36
+ * primary workspace root), and a turn that pauses for human approval ENDS
37
+ * its activity — releasing the lock — so a change set sitting unreviewed
38
+ * never blocks the workspace.
39
+ */
40
+ /**
41
+ * Default bound on how long an execution waits for a contended workspace
42
+ * before failing with {@link WorkspaceLockTimeoutError}. Generous — an agent
43
+ * turn legitimately runs for minutes — but finite, so a pathological holder
44
+ * produces an explicit, actionable failure instead of an invisible hang.
45
+ */
46
+ export declare const DEFAULT_WORKSPACE_LOCK_TIMEOUT_MS: number;
47
+ /** The acquisition wait exceeded its bound — the workspace stayed busy. */
48
+ export declare class WorkspaceLockTimeoutError extends Error {
49
+ constructor(workspaceRoot: string, waitedMs: number);
50
+ }
51
+ /** The acquisition wait was cancelled (e.g. the user cancelled the execution). */
52
+ export declare class WorkspaceLockCancelledError extends Error {
53
+ constructor(workspaceRoot: string);
54
+ }
55
+ export interface AcquireWorkspaceLockOptions {
56
+ /**
57
+ * Invoked once, when the first acquisition attempt finds the workspace
58
+ * held by another turn — the hook for surfacing a visible "waiting for
59
+ * workspace" state to the user. Never invoked on an uncontended acquire.
60
+ */
61
+ readonly onWaiting?: () => void | Promise<void>;
62
+ /** Invoked on every poll while waiting (Temporal activity liveness). */
63
+ readonly heartbeat?: () => void;
64
+ /** Aborts the wait immediately (Temporal activity cancellation). */
65
+ readonly signal?: AbortSignal;
66
+ /** Max wait before {@link WorkspaceLockTimeoutError}. */
67
+ readonly timeoutMs?: number;
68
+ /** Poll interval override (tests). */
69
+ readonly pollIntervalMs?: number;
70
+ /** Staleness bound override (tests). */
71
+ readonly staleMs?: number;
72
+ /** Lock-artifact directory override (tests). */
73
+ readonly lockDir?: string;
74
+ }
75
+ /** Idempotent releaser returned by {@link acquireWorkspaceLock}. */
76
+ export type ReleaseWorkspaceLock = () => Promise<void>;
77
+ /**
78
+ * Acquire the exclusive turn lock for a workspace working tree, waiting (with
79
+ * heartbeats and cancellation) while another turn holds it.
80
+ *
81
+ * The caller must hold the lock across the turn's ENTIRE tree-mutating window
82
+ * — decision reconcile, HITL gate install, the agent's own writes, and the
83
+ * candidate capture — and release it in a `finally` as the last
84
+ * workspace-touching step.
85
+ */
86
+ export declare function acquireWorkspaceLock(workspaceRoot: string, options?: AcquireWorkspaceLockOptions): Promise<ReleaseWorkspaceLock>;