@gajae-code/coding-agent 0.11.7 → 0.11.9

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 (213) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/dist/types/cli/args.d.ts +0 -2
  3. package/dist/types/cli.d.ts +1 -0
  4. package/dist/types/config/keybindings.d.ts +33 -3
  5. package/dist/types/config/model-profile-activation.d.ts +4 -3
  6. package/dist/types/config/model-profile-contract.d.ts +38 -0
  7. package/dist/types/config/model-profiles.d.ts +2 -3
  8. package/dist/types/config/settings-schema.d.ts +15 -2
  9. package/dist/types/edit/modes/patch.d.ts +13 -0
  10. package/dist/types/edit/path-mutation-lock.d.ts +15 -0
  11. package/dist/types/eval/py/executor.d.ts +1 -1
  12. package/dist/types/eval/py/tool-bridge.d.ts +1 -2
  13. package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +12 -5
  14. package/dist/types/gjc-runtime/deep-interview-draft.d.ts +8 -0
  15. package/dist/types/gjc-runtime/deep-interview-payload.d.ts +41 -0
  16. package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +32 -17
  17. package/dist/types/gjc-runtime/deep-interview-repair.d.ts +17 -0
  18. package/dist/types/gjc-runtime/deep-interview-state.d.ts +135 -4
  19. package/dist/types/gjc-runtime/repository-binding.d.ts +63 -0
  20. package/dist/types/gjc-runtime/state-writer.d.ts +44 -0
  21. package/dist/types/gjc-runtime/ultragoal-guard.d.ts +1 -0
  22. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +24 -0
  23. package/dist/types/gjc-runtime/workflow-manifest.d.ts +5 -3
  24. package/dist/types/main.d.ts +8 -0
  25. package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +2 -1
  26. package/dist/types/modes/components/tool-status-header.d.ts +3 -2
  27. package/dist/types/modes/components/welcome.d.ts +4 -0
  28. package/dist/types/modes/controllers/command-controller.d.ts +2 -0
  29. package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
  30. package/dist/types/modes/interactive-mode.d.ts +5 -2
  31. package/dist/types/modes/prompt-action-autocomplete.d.ts +6 -1
  32. package/dist/types/modes/prompt-suggestion-controller.d.ts +35 -0
  33. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +2 -2
  34. package/dist/types/modes/types.d.ts +3 -0
  35. package/dist/types/modes/utils/hotkeys-markdown.d.ts +2 -1
  36. package/dist/types/runtime-mcp/manager.d.ts +1 -1
  37. package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -5
  38. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +14 -0
  39. package/dist/types/runtime-mcp/redaction.d.ts +2 -0
  40. package/dist/types/sdk/broker/broker.d.ts +2 -0
  41. package/dist/types/sdk/broker/lifecycle.d.ts +6 -0
  42. package/dist/types/sdk/bus/chat-daemon-control.d.ts +7 -1
  43. package/dist/types/sdk/bus/config-commands.d.ts +2 -2
  44. package/dist/types/sdk/bus/config.d.ts +2 -0
  45. package/dist/types/sdk/bus/conversation-store.d.ts +1 -0
  46. package/dist/types/sdk/bus/index.d.ts +25 -0
  47. package/dist/types/sdk/bus/notification-orchestration.d.ts +1 -0
  48. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +105 -0
  49. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +15 -3
  50. package/dist/types/sdk/bus/telegram-daemon-control.d.ts +5 -1
  51. package/dist/types/sdk/bus/telegram-daemon.d.ts +128 -1
  52. package/dist/types/sdk/bus/telegram-reference.d.ts +2 -0
  53. package/dist/types/sdk/host/control/operations.d.ts +1 -1
  54. package/dist/types/sdk/host/host.d.ts +1 -1
  55. package/dist/types/sdk/host/query/handlers.d.ts +9 -0
  56. package/dist/types/sdk/index.d.ts +2 -0
  57. package/dist/types/sdk/prompt-status.d.ts +88 -0
  58. package/dist/types/sdk/session-directory.d.ts +1 -1
  59. package/dist/types/sdk/startup-capability.d.ts +3 -0
  60. package/dist/types/session/agent-session.d.ts +2 -0
  61. package/dist/types/session/internal/managed-session-scope.d.ts +22 -3
  62. package/dist/types/session/internal/managed-session-storage.d.ts +24 -4
  63. package/dist/types/session/internal/native-publish-outcome.d.ts +48 -0
  64. package/dist/types/session/session-manager.d.ts +5 -1
  65. package/dist/types/session/session-storage.d.ts +31 -0
  66. package/dist/types/skill-state/active-state.d.ts +4 -0
  67. package/dist/types/task/index.d.ts +3 -1
  68. package/dist/types/task/receipt.d.ts +2 -0
  69. package/dist/types/task/types.d.ts +94 -0
  70. package/dist/types/tools/ask.d.ts +454 -174
  71. package/dist/types/tools/image-gen.d.ts +47 -1
  72. package/dist/types/tools/index.d.ts +4 -0
  73. package/dist/types/utils/prompt-suggestion.d.ts +33 -0
  74. package/package.json +8 -8
  75. package/scripts/capture-platform-shortcut-labels-showcase.ts +342 -0
  76. package/scripts/dogfood-repository-binding.ts +209 -0
  77. package/scripts/generate-sdk-operation-inventory.ts +2 -0
  78. package/scripts/run-test-manifest.ts +4 -4
  79. package/src/cli/args.ts +2 -92
  80. package/src/cli/mcp-cli.ts +4 -21
  81. package/src/cli/notify-cli.ts +5 -38
  82. package/src/cli.ts +50 -0
  83. package/src/commands/deep-interview.ts +9 -4
  84. package/src/commands/sdk.ts +2 -2
  85. package/src/commit/agentic/index.ts +3 -3
  86. package/src/commit/map-reduce/index.ts +2 -2
  87. package/src/config/keybindings.ts +157 -24
  88. package/src/config/model-profile-activation.ts +7 -18
  89. package/src/config/model-profile-contract.ts +161 -0
  90. package/src/config/model-profiles.ts +2 -3
  91. package/src/config/model-registry.ts +11 -1
  92. package/src/config/settings-schema.ts +17 -2
  93. package/src/coordinator-mcp/model-preset.ts +21 -74
  94. package/src/defaults/gjc/skills/deep-interview/SKILL.md +80 -165
  95. package/src/defaults/gjc/skills/ralplan/SKILL.md +3 -1
  96. package/src/edit/index.ts +3 -6
  97. package/src/edit/modes/patch.ts +38 -1
  98. package/src/edit/modes/replace.ts +42 -0
  99. package/src/edit/path-mutation-lock.ts +112 -0
  100. package/src/eval/py/executor.ts +30 -11
  101. package/src/eval/py/prelude.py +2 -2
  102. package/src/eval/py/tool-bridge.ts +34 -18
  103. package/src/extensibility/gjc-plugins/runtime-adapters.ts +2 -1
  104. package/src/gjc-runtime/deep-interview-ambiguity.ts +68 -47
  105. package/src/gjc-runtime/deep-interview-draft.ts +842 -0
  106. package/src/gjc-runtime/deep-interview-payload.ts +262 -0
  107. package/src/gjc-runtime/deep-interview-recorder.ts +294 -226
  108. package/src/gjc-runtime/deep-interview-repair.ts +1674 -0
  109. package/src/gjc-runtime/deep-interview-runtime.ts +264 -103
  110. package/src/gjc-runtime/deep-interview-state.ts +916 -4
  111. package/src/gjc-runtime/launch-tmux.ts +1 -1
  112. package/src/gjc-runtime/managed-owner-supervisor.ts +83 -4
  113. package/src/gjc-runtime/ralplan-runtime.ts +78 -4
  114. package/src/gjc-runtime/repository-binding.ts +267 -0
  115. package/src/gjc-runtime/session-state-sidecar.ts +25 -9
  116. package/src/gjc-runtime/state-writer.ts +166 -2
  117. package/src/gjc-runtime/tmux-owner-isolation.ts +2 -1
  118. package/src/gjc-runtime/tmux-sessions.ts +45 -6
  119. package/src/gjc-runtime/ultragoal-guard.ts +5 -5
  120. package/src/gjc-runtime/ultragoal-runtime.ts +181 -19
  121. package/src/gjc-runtime/workflow-manifest.generated.json +386 -1
  122. package/src/gjc-runtime/workflow-manifest.ts +191 -5
  123. package/src/internal-urls/docs-index.generated.ts +8 -6
  124. package/src/internal-urls/local-protocol.ts +33 -16
  125. package/src/internal-urls/mcp-protocol.ts +73 -11
  126. package/src/main.ts +25 -10
  127. package/src/modes/DESIGN.md +5 -0
  128. package/src/modes/acp/acp-agent.ts +50 -16
  129. package/src/modes/components/model-selector.ts +42 -8
  130. package/src/modes/components/plan-preview-overlay.ts +1 -1
  131. package/src/modes/components/runtime-mcp-add-wizard.ts +5 -0
  132. package/src/modes/components/tool-status-header.ts +20 -4
  133. package/src/modes/components/welcome.ts +32 -20
  134. package/src/modes/controllers/command-controller.ts +97 -54
  135. package/src/modes/controllers/event-controller.ts +10 -0
  136. package/src/modes/controllers/input-controller.ts +7 -2
  137. package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -6
  138. package/src/modes/controllers/selector-controller.ts +46 -54
  139. package/src/modes/interactive-mode.ts +70 -36
  140. package/src/modes/prompt-action-autocomplete.ts +32 -13
  141. package/src/modes/prompt-suggestion-controller.ts +96 -0
  142. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +2 -2
  143. package/src/modes/types.ts +3 -0
  144. package/src/modes/utils/hotkeys-markdown.ts +64 -36
  145. package/src/modes/utils/ui-helpers.ts +5 -3
  146. package/src/prompts/agents/architect.md +0 -1
  147. package/src/prompts/agents/critic.md +0 -1
  148. package/src/prompts/system/prompt-suggestion-system.md +32 -0
  149. package/src/prompts/system/system-prompt.md +7 -4
  150. package/src/prompts/tools/cron.md +3 -1
  151. package/src/runtime-mcp/json-rpc.ts +7 -4
  152. package/src/runtime-mcp/manager.ts +51 -53
  153. package/src/runtime-mcp/oauth-flow.ts +0 -72
  154. package/src/runtime-mcp/plugin-network-boundary.ts +101 -0
  155. package/src/runtime-mcp/redaction.ts +30 -0
  156. package/src/runtime-mcp/transports/http.ts +13 -6
  157. package/src/sdk/broker/broker.ts +34 -20
  158. package/src/sdk/broker/lifecycle.ts +185 -36
  159. package/src/sdk/broker/session-index.ts +11 -1
  160. package/src/sdk/bus/chat-daemon-control.ts +20 -5
  161. package/src/sdk/bus/config-commands.ts +2 -2
  162. package/src/sdk/bus/config.ts +9 -1
  163. package/src/sdk/bus/conversation-store.ts +40 -6
  164. package/src/sdk/bus/index.ts +240 -65
  165. package/src/sdk/bus/lifecycle-commands.ts +47 -3
  166. package/src/sdk/bus/lifecycle-control-runtime.ts +11 -2
  167. package/src/sdk/bus/lifecycle-orchestrator.ts +32 -1
  168. package/src/sdk/bus/notification-orchestration.ts +12 -0
  169. package/src/sdk/bus/notification-service.ts +27 -2
  170. package/src/sdk/bus/prompt-reconciliation.ts +239 -0
  171. package/src/sdk/bus/recent-activity.ts +90 -26
  172. package/src/sdk/bus/telegram-daemon-contract.ts +15 -3
  173. package/src/sdk/bus/telegram-daemon-control.ts +145 -33
  174. package/src/sdk/bus/telegram-daemon.ts +853 -112
  175. package/src/sdk/bus/telegram-reference.ts +20 -2
  176. package/src/sdk/cli/session-cli.ts +15 -2
  177. package/src/sdk/host/control/dispatch.ts +1 -1
  178. package/src/sdk/host/control/operations.ts +1 -1
  179. package/src/sdk/host/host.ts +2 -6
  180. package/src/sdk/host/query/handlers.ts +70 -5
  181. package/src/sdk/index.ts +12 -0
  182. package/src/sdk/prompt-status.ts +97 -0
  183. package/src/sdk/protocol/operation-inventory.generated.json +47 -0
  184. package/src/sdk/protocol/operation-registry.ts +18 -4
  185. package/src/sdk/session-directory.ts +5 -1
  186. package/src/sdk/session.ts +2 -0
  187. package/src/sdk/startup-capability.ts +9 -1
  188. package/src/session/agent-session.ts +138 -5
  189. package/src/session/blob-store.ts +7 -2
  190. package/src/session/internal/managed-session-scope.ts +998 -133
  191. package/src/session/internal/managed-session-storage.ts +268 -203
  192. package/src/session/internal/native-publish-outcome.ts +266 -0
  193. package/src/session/session-manager.ts +406 -360
  194. package/src/session/session-storage.ts +151 -11
  195. package/src/skill-state/active-state.ts +10 -0
  196. package/src/task/executor.ts +13 -5
  197. package/src/task/gjc-command.ts +2 -2
  198. package/src/task/index.ts +121 -15
  199. package/src/task/receipt.ts +3 -0
  200. package/src/task/types.ts +34 -3
  201. package/src/tools/ask.ts +199 -88
  202. package/src/tools/ast-edit.ts +2 -2
  203. package/src/tools/bash-pty-selection.ts +2 -2
  204. package/src/tools/browser/screenshot-format.ts +6 -1
  205. package/src/tools/cron.ts +1 -1
  206. package/src/tools/image-gen.ts +178 -6
  207. package/src/tools/index.ts +4 -0
  208. package/src/tools/render-utils.ts +7 -1
  209. package/src/utils/edit-mode.ts +2 -2
  210. package/src/utils/prompt-suggestion.ts +265 -0
  211. package/src/utils/sixel.ts +3 -3
  212. package/src/web/insane/url-guard.ts +3 -1
  213. package/src/web/scrapers/docs-rs.ts +30 -5
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Public DTO contract for Q26 `turn.prompt_status` and the `clientRef`
3
+ * correlation field on `turn.prompt`.
4
+ *
5
+ * Semantics:
6
+ * - `turn.prompt` remains ordered and non-idempotent. An envelope
7
+ * `idempotencyKey` is ignored for replay/conflict purposes on ordered
8
+ * operations (no replay cache, no `idempotency_conflict`).
9
+ * - `clientRef` is a caller-chosen correlation key (trimmed, non-empty,
10
+ * 1..PROMPT_CLIENT_REF_MAX_LENGTH chars; one fresh value per logical prompt)
11
+ * mapped to the generated commandId/turnId at preflight acceptance so a
12
+ * caller can reconcile after a lost acknowledgement frame.
13
+ * - The clientRef index is scoped to one live session runtime: identical refs
14
+ * may coexist in different sessions, lookups never cross sessions, a ref
15
+ * conflicts only while its record is retained (`client_ref_conflict`), and
16
+ * after terminal TTL/capacity eviction a ref may be admitted again with the
17
+ * prior outcome unknown — callers MUST NOT reuse a clientRef as a retry
18
+ * mechanism and MUST treat `unknown` as uncertainty, not proof of
19
+ * non-execution.
20
+ * - The durability floor is the live session process: after restart or
21
+ * retained-record eviction, a lookup honestly reports `unknown`.
22
+ * - Q26 tracks prompts accepted through the SDK control surface (which always
23
+ * carries a requesting connection); submissions without a delivery owner are
24
+ * outside the reconciliation contract and hold no reservation.
25
+ */
26
+ export declare const PROMPT_CLIENT_REF_MAX_LENGTH = 128;
27
+ export interface TurnPromptImageInput {
28
+ data: string;
29
+ mimeType?: string;
30
+ }
31
+ /** Public input contract for ordered `turn.prompt`. */
32
+ export interface TurnPromptInput {
33
+ text: string;
34
+ images?: TurnPromptImageInput[];
35
+ clientRef?: string;
36
+ }
37
+ /** Terminal outcome is preserved exactly; active records never age into terminal. */
38
+ export type PromptReconciliationStatus = "accepted" | "in_flight" | "terminal_ok" | "failed";
39
+ /** Exactly one selector per lookup. */
40
+ export type TurnPromptStatusSelector = {
41
+ clientRef: string;
42
+ } | {
43
+ commandId: string;
44
+ turnId: string;
45
+ };
46
+ interface TurnPromptReconciliationIdentity {
47
+ commandId: string;
48
+ turnId: string;
49
+ clientRef?: string;
50
+ /** Epoch milliseconds of preflight acceptance. */
51
+ acceptedAt: number;
52
+ }
53
+ export interface TurnPromptReconciliationAccepted extends TurnPromptReconciliationIdentity {
54
+ status: "accepted";
55
+ }
56
+ export interface TurnPromptReconciliationInFlight extends TurnPromptReconciliationIdentity {
57
+ status: "in_flight";
58
+ /** Epoch milliseconds of the agent_start transition. */
59
+ startedAt: number;
60
+ }
61
+ export interface TurnPromptReconciliationTerminalOk extends TurnPromptReconciliationIdentity {
62
+ status: "terminal_ok";
63
+ startedAt?: number;
64
+ /** Epoch milliseconds of the terminal transition. */
65
+ terminalAt: number;
66
+ }
67
+ export interface TurnPromptReconciliationFailed extends TurnPromptReconciliationIdentity {
68
+ status: "failed";
69
+ startedAt?: number;
70
+ terminalAt: number;
71
+ /** Bounded, sanitized failure detail (code safe-token ≤64, message ≤512). */
72
+ error: {
73
+ code: string;
74
+ message: string;
75
+ };
76
+ }
77
+ export interface TurnPromptReconciliationUnknown {
78
+ status: "unknown";
79
+ }
80
+ export type TurnPromptReconciliation = TurnPromptReconciliationAccepted | TurnPromptReconciliationInFlight | TurnPromptReconciliationTerminalOk | TurnPromptReconciliationFailed | TurnPromptReconciliationUnknown;
81
+ /** Result of a successful `turn.prompt` preflight acknowledgement. */
82
+ export interface TurnPromptAcceptedResult {
83
+ commandId: string;
84
+ turnId: string;
85
+ accepted: true;
86
+ clientRef?: string;
87
+ }
88
+ export {};
@@ -20,7 +20,7 @@ export type ResolveManagedSessionScopeResult = {
20
20
  scope: ManagedSessionScope;
21
21
  } | {
22
22
  kind: "error";
23
- code: "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid";
23
+ code: "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "atomic_unavailable" | "durability_not_provable" | "durability_failed" | "invalid_request";
24
24
  message: string;
25
25
  };
26
26
  export interface LogicalSessionCandidate {
@@ -1,9 +1,12 @@
1
+ import { type ModelProfileErrorCode, type ModelProfileErrorDetails } from "../config/model-profile-contract";
1
2
  export type SdkStartupPhase = "registration" | "startup";
2
3
  export type SdkStartupReason = "disabled" | "ineligible" | "factory_absent" | "runner_absent" | "pending" | "failed";
3
4
  export interface SdkStartupFailure {
4
5
  phase: SdkStartupPhase;
5
6
  reason: SdkStartupReason;
6
7
  message: string;
8
+ code?: ModelProfileErrorCode;
9
+ details?: ModelProfileErrorDetails;
7
10
  }
8
11
  export type SdkStartupResult = {
9
12
  status: "started";
@@ -542,6 +542,8 @@ export declare class AgentSession {
542
542
  * recorded or the mode-state file is missing/unreadable; callers should
543
543
  * treat undefined as a non-terminal phase (refuses to chain). */
544
544
  getActiveSkillPhase(): string | undefined;
545
+ /** Provider-facing ask metadata must expose only the active deep-interview phase. */
546
+ getDeepInterviewAskStage(): "topology" | "post-topology" | undefined;
545
547
  /** Peek the in-flight directive's invocation handler for use by the resolve tool. */
546
548
  peekQueueInvoker(): ((input: unknown) => Promise<unknown> | unknown) | undefined;
547
549
  peekStandingResolveHandler(): ((input: unknown) => Promise<unknown> | unknown) | undefined;
@@ -1,6 +1,7 @@
1
1
  import * as native from "@gajae-code/natives";
2
2
  import type { ResumeSessionIdentity } from "../session-manager";
3
- import { type ManagedDirectoryRoot, type ManagedSessionSecurityPolicy } from "./managed-session-storage";
3
+ import { type NativeDirectoryTreeSnapshot } from "../session-storage";
4
+ import { type ManagedDirectoryRoot, type ManagedSessionSecurityPolicy, type ManagedStorageLock } from "./managed-session-storage";
4
5
  export declare const MANAGED_SESSION_LAYOUT_VERSION: 2;
5
6
  export declare const MANAGED_SESSION_IDENTITY_VERSION: 1;
6
7
  export declare const MANAGED_SESSION_BINDING_FILE = ".gjc-managed-session-scope.v2.json";
@@ -33,7 +34,7 @@ export declare function managedDirectoryIdentityForScope(scope: ManagedScope): {
33
34
  };
34
35
  export declare function managedRootForScope(scope: ManagedScope): ManagedDirectoryRoot;
35
36
  export type ManagedMigrationPolicy = "copy-retain" | "disabled";
36
- export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid";
37
+ export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "atomic_unavailable" | "invalid_request" | "durability_failed" | "durability_not_provable";
37
38
  export type ManagedScopeResolution = {
38
39
  kind: "resolved";
39
40
  scope: ManagedScope;
@@ -41,6 +42,10 @@ export type ManagedScopeResolution = {
41
42
  kind: "error";
42
43
  code: ManagedScopeErrorCode;
43
44
  message: string;
45
+ cause?: {
46
+ readonly classification: string;
47
+ readonly diagnostic?: string;
48
+ };
44
49
  };
45
50
  export interface ManagedCandidate {
46
51
  sessionId: string;
@@ -63,7 +68,7 @@ export type ManagedCandidateListing = {
63
68
  code: "scan_failed" | "unsafe_root" | "invalid_candidate";
64
69
  message: string;
65
70
  };
66
- export type ManagedOpenFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "durability_failed" | "migration_retired" | "legacy_migration_disabled" | "managed_storage_unsupported";
71
+ export type ManagedOpenFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "artifact_capacity_exceeded" | "durability_failed" | "atomic_unavailable" | "invalid_request" | "durability_not_provable" | "migration_retired" | "legacy_migration_disabled" | "managed_storage_unsupported";
67
72
  export type ManagedOpenCandidateResult = {
68
73
  kind: "opened";
69
74
  path: string;
@@ -80,6 +85,11 @@ export type ManagedDeleteCandidateResult = {
80
85
  } | {
81
86
  kind: "already_deleted";
82
87
  tombstonePath: string;
88
+ } | {
89
+ kind: "cleanup_pending";
90
+ tombstonePath: string;
91
+ phase: "artifacts" | "transcript";
92
+ message: string;
83
93
  } | {
84
94
  kind: "error";
85
95
  code: ManagedOpenFailure;
@@ -105,10 +115,19 @@ interface ManagedScopeInput {
105
115
  export declare function resolveManagedScope(input: ManagedScopeInput): ManagedScopeResolution;
106
116
  /** Resolve a scope for a synchronous write without mutating an existing ACL mismatch. */
107
117
  export declare function resolveManagedScopeForWrite(input: ManagedScopeInput): ManagedScopeResolution;
118
+ export declare function canonicalBindingOpenFlags(platform?: NodeJS.Platform): number;
119
+ export declare function fsyncCanonicalBinding(bindingPath: string, expected: string): void;
108
120
  export declare function ensureManagedScope(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy): Promise<ManagedScopeResolution>;
109
121
  /** Synchronously create and validate the v2 binding before a default session writer exists. */
110
122
  export declare function prepareManagedSessionScopeForWriteSync(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy, authority?: ManagedCandidateWriteAuthority): ManagedScopeResolution;
111
123
  export declare function listManagedCandidates(scope: ManagedScope): ManagedCandidateListing;
124
+ export declare function matchesMigrationArtifactRoot(pathname: string, identity: {
125
+ dev: bigint;
126
+ ino: bigint;
127
+ size: bigint;
128
+ mtimeNs: bigint;
129
+ }, expectedTree: NativeDirectoryTreeSnapshot, platform?: NodeJS.Platform): boolean;
130
+ export declare function restorePreparedArtifactRoot(scope: ManagedScope, source: ManagedCandidate, lock?: ManagedStorageLock): void;
112
131
  /** Resume tombstoned cleanup under its original operation lease without restoring retired candidates. */
113
132
  export declare function reconcileManagedTombstones(scope: ManagedScope): Promise<void>;
114
133
  /** Create the v2 binding and private write protocol directories before managed writes. */
@@ -1,10 +1,19 @@
1
1
  import { type NativeDirectoryTreeSnapshot, type NativeOwnerOnlySecurityResult, type RecoveryFsRoot } from "@gajae-code/natives";
2
+ import { type NativePublishOutcome } from "./native-publish-outcome";
2
3
  export declare const MANAGED_ARTIFACT_MAX_DEPTH = 32;
3
- export declare const MANAGED_ARTIFACT_MAX_FILES = 10000;
4
+ export declare const MANAGED_ARTIFACT_MAX_FILES = 50000;
4
5
  export declare const MANAGED_ARTIFACT_MAX_FILE_BYTES: number;
5
6
  export declare const MANAGED_ARTIFACT_MAX_TOTAL_BYTES: number;
7
+ export declare const MANAGED_ARTIFACT_COPY_BATCH_SIZE = 256;
8
+ export declare class ManagedPublishError extends Error {
9
+ readonly classification: "destination_conflict" | "atomic_unavailable" | "invalid_request" | "durability_not_provable" | "identity_mismatch" | "io_error" | "durability_failed";
10
+ readonly diagnostic: string;
11
+ constructor(classification: ManagedPublishError["classification"], outcome: NativePublishOutcome);
12
+ }
13
+ /** Cleanup is safe only when the native move reports that it did not commit. */
14
+ export declare function mayCleanManagedTreeStaging(error: unknown): boolean;
6
15
  export type ManagedSessionSecurityPolicy = "default" | "windows-existing-verify-first";
7
- export type ManagedStorageFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "durability_failed" | "migration_retired" | "managed_storage_unsupported";
16
+ export type ManagedStorageFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "artifact_capacity_exceeded" | "durability_failed" | "atomic_unavailable" | "durability_not_provable" | "migration_retired" | "managed_storage_unsupported";
8
17
  export interface ManagedStorageLock {
9
18
  path: string;
10
19
  attemptId: string;
@@ -29,6 +38,13 @@ export interface ManagedDirectoryRoot {
29
38
  readonly dev: bigint;
30
39
  readonly ino: bigint;
31
40
  }
41
+ /**
42
+ * Establish the first managed directory beneath a potentially shared ancestor.
43
+ * The ancestor is used only to create the managed chain; every component from
44
+ * `configuredRoot` downward is independently type, symlink, owner, mode, and
45
+ * ACL checked. This deliberately does not impose owner-only policy on `/tmp`.
46
+ */
47
+ export declare function prepareManagedDirectoryRoot(configuredRoot: string, policy?: ManagedSessionSecurityPolicy): ManagedDirectoryRoot;
32
48
  export declare function managedDirectoryRoot(configuredRoot: string): ManagedDirectoryRoot;
33
49
  export declare function retainManagedDirectoryAuthority(root: ManagedDirectoryRoot, directory: string, expected?: {
34
50
  dev: bigint;
@@ -68,7 +84,7 @@ export declare class ManagedSessionDescendantStore {
68
84
  captureTree(relativePath: string): NativeDirectoryTreeSnapshot;
69
85
  /** Copy an exact captured tree into an absent managed destination. */
70
86
  importTree(sourceRelativePath: string, destinationRelativePath: string, snapshot: NativeDirectoryTreeSnapshot): Promise<void>;
71
- moveTreeNoReplace(sourceRelativePath: string, destinationRelativePath: string, expected: NativeDirectoryTreeSnapshot): void;
87
+ moveTreeNoReplace(sourceRelativePath: string, destinationRelativePath: string, expected: NativeDirectoryTreeSnapshot): NativeDirectoryTreeSnapshot;
72
88
  removeTreeExpected(relativePath: string, expected: NativeDirectoryTreeSnapshot): void;
73
89
  fsyncTree(): NativeDirectoryTreeSnapshot;
74
90
  }
@@ -89,8 +105,12 @@ export declare function replaceManagedFile(destination: string, bytes: Uint8Arra
89
105
  export declare function copyManagedFileNoReplace(source: string, destination: string, snapshot?: ManagedFileSnapshot, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
90
106
  /** Acquire a lease lock with bounded wait, heartbeats, conservative stale reclaim, and fencing. */
91
107
  export declare function acquireManagedLock(locksDirectory: string, name: string, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<ManagedStorageLock>;
108
+ export interface ManagedArtifactTreeLimits {
109
+ maxFiles?: number;
110
+ maxTotalBytes?: number;
111
+ }
92
112
  /** Bounds a no-follow artifact tree before it can be copied or deleted. */
93
- export declare function validateManagedArtifactTree(root: string): void;
113
+ export declare function validateManagedArtifactTree(root: string, limits?: ManagedArtifactTreeLimits): void;
94
114
  /** Flush a copied managed artifact tree, including empty directories, before publishing its receipt. */
95
115
  export declare function fsyncManagedArtifactTree(root: string): NativeDirectoryTreeSnapshot;
96
116
  export declare function publishManagedTombstone(destination: string, record: Record<string, unknown>, assertOwned?: () => void): Promise<void>;
@@ -0,0 +1,48 @@
1
+ export type NativePublishMutationState = "not_committed" | "committed" | "unknown";
2
+ export type NativePublishDurabilityState = "not_attempted" | "proven" | "not_provable";
3
+ export type NativePublishReason = "none" | "destination_exists" | "atomic_unavailable" | "cross_device" | "permission_denied" | "io_failure" | "interrupted" | "invalid_request" | "identity_violation" | "durability_not_provable" | "unknown";
4
+ export type NativePublishOperation = "direct_rename" | "retained_file" | "retained_tree";
5
+ export type NativePublishPrimitive = "renameat2_noreplace" | "renameatx_np_excl" | "windows_rename_noreplace" | "unsupported" | "unknown";
6
+ export type NativePublishPhase = "preflight" | "file_sync" | "rename" | "source_parent_sync" | "destination_parent_sync" | "terminal_identity" | "complete" | "unknown";
7
+ type SyncFailure = {
8
+ phase: Exclude<NativePublishPhase, "preflight" | "file_sync" | "rename" | "complete" | "unknown">;
9
+ parentRole: "source" | "destination" | "shared" | "staged_file";
10
+ osCode?: number;
11
+ kind: "unsupported" | "io" | "permission" | "other";
12
+ };
13
+ type PublishDiagnostic = {
14
+ schemaVersion: 1;
15
+ collectionState: "complete" | "partial" | "unavailable";
16
+ osCode?: number;
17
+ syncFailures?: readonly SyncFailure[];
18
+ };
19
+ export type NativePublishIdentity = {
20
+ readonly dev: string;
21
+ readonly ino: string;
22
+ readonly size: string;
23
+ readonly mtimeNs: string;
24
+ readonly ctimeNs: string;
25
+ readonly sha256?: string;
26
+ };
27
+ export type NativePublishOutcome = {
28
+ readonly ok: boolean;
29
+ readonly code?: string;
30
+ readonly identity?: NativePublishIdentity;
31
+ readonly mutationState: NativePublishMutationState;
32
+ readonly durabilityState: NativePublishDurabilityState;
33
+ readonly reason: NativePublishReason;
34
+ readonly primitive: NativePublishPrimitive;
35
+ readonly phase: NativePublishPhase;
36
+ readonly diagnostic: PublishDiagnostic;
37
+ };
38
+ /**
39
+ * Treat incompatible native results as an unknown mutation; never infer safety from legacy fields.
40
+ * Retained descriptor operations have a stricter contract than direct rename: a reported success
41
+ * includes the terminal identity and all required durability evidence.
42
+ */
43
+ export declare function classifyNativePublishOutcome(value: unknown, operation?: NativePublishOperation): NativePublishOutcome;
44
+ /** Only a fully validated pre-mutation result permits exact cleanup of current staging. */
45
+ export declare function mayCleanCurrentStaging(outcome: NativePublishOutcome): boolean;
46
+ /** Stable, bounded text for startup errors. Native paths and messages are intentionally excluded. */
47
+ export declare function formatNativePublishDiagnostic(outcome: NativePublishOutcome): string;
48
+ export {};
@@ -327,6 +327,9 @@ export declare class SessionMigrationPolicyError extends Error {
327
327
  readonly code = "legacy_migration_disabled";
328
328
  constructor();
329
329
  }
330
+ export declare class SessionArtifactCapacityError extends Error {
331
+ constructor(message: string);
332
+ }
330
333
  export type ResumeTailInspection = ResumeTailResumable | ResumeTailTerminal | ResumeTailError;
331
334
  export interface StrictSessionOpenSuccess {
332
335
  kind: "opened";
@@ -334,7 +337,8 @@ export interface StrictSessionOpenSuccess {
334
337
  }
335
338
  export interface StrictSessionOpenFailure {
336
339
  kind: "error";
337
- reason: ResumeTailError["reason"] | "identity-mismatch" | "migration-required";
340
+ reason: ResumeTailError["reason"] | "identity-mismatch" | "migration-required" | "artifact_capacity_exceeded";
341
+ message?: string;
338
342
  }
339
343
  /** Exact transcript bytes and authority captured from one descriptor-bound read. */
340
344
  export interface CapturedSessionTranscriptSnapshot {
@@ -112,6 +112,11 @@ export interface SessionStorage {
112
112
  readSnapshotSync?(path: string): SessionStorageSnapshot;
113
113
  statSync(path: string): SessionStorageStat;
114
114
  listFilesSync(dir: string, pattern: string): string[];
115
+ /** List matching files with mtimes without issuing one JavaScript stat call per path. */
116
+ listFilesByMtime?(dir: string, pattern: string): Promise<Array<{
117
+ path: string;
118
+ mtimeMs: number;
119
+ }>>;
115
120
  /**
116
121
  * Strict directory scan that never suppresses scan/root errors. Used by strict
117
122
  * authorization inventory; the forgiving {@link listFilesSync} stays display-only.
@@ -184,6 +189,18 @@ export interface VerifiedSessionDeleteTarget {
184
189
  detachedArtifactsPath?: string;
185
190
  /** Identity-bound quarantine path retained when transcript unlink deferred cleanup. */
186
191
  detachedTranscriptPath?: string;
192
+ /** Native-retained publisher successor observed during transcript cleanup. */
193
+ retainedTranscriptSuccessorPath?: string;
194
+ /** Native-retained exchange placeholder observed during transcript cleanup. */
195
+ retainedTranscriptPlaceholderPath?: string;
196
+ /** Native-retained transcript entry whose identity could not be verified. */
197
+ retainedTranscriptUnknownPath?: string;
198
+ /** Native-retained publisher successor observed during cleanup. */
199
+ retainedArtifactsSuccessorPath?: string;
200
+ /** Native-retained exchange placeholder observed during cleanup. */
201
+ retainedArtifactsPlaceholderPath?: string;
202
+ /** Native-retained entry whose identity could not be verified. */
203
+ retainedArtifactsUnknownPath?: string;
187
204
  /** Caller-published, no-replace quarantine pathname for the next artifact detach. */
188
205
  plannedArtifactsPath?: string;
189
206
  /** Caller-published, no-replace quarantine pathname for the next transcript detach. */
@@ -215,6 +232,9 @@ export type VerifiedSessionDeleteResult = {
215
232
  artifactsTree: NativeDirectoryTreeSnapshot;
216
233
  /** Transcript identity (unchanged) for retry binding. */
217
234
  transcriptIdentity: SessionStorageFileIdentity;
235
+ retainedSuccessorPath?: string;
236
+ retainedPlaceholderPath?: string;
237
+ retainedUnknownPath?: string;
218
238
  } | {
219
239
  kind: "cleanup_pending";
220
240
  phase: "transcript";
@@ -223,6 +243,9 @@ export type VerifiedSessionDeleteResult = {
223
243
  transcriptIdentity: SessionStorageFileIdentity;
224
244
  /** Optional identity-bound transcript quarantine path for restart cleanup. */
225
245
  detachedTranscriptPath?: string;
246
+ retainedSuccessorPath?: string;
247
+ retainedPlaceholderPath?: string;
248
+ retainedUnknownPath?: string;
226
249
  };
227
250
  type NativeDirectoryTreeEntry = {
228
251
  relativePath: string;
@@ -249,6 +272,10 @@ export declare class FileSessionStorage implements SessionStorage {
249
272
  readSnapshotSync(fpath: string): SessionStorageSnapshot;
250
273
  statSync(path: string): SessionStorageStat;
251
274
  listFilesSync(dir: string, pattern: string): string[];
275
+ listFilesByMtime(dir: string, pattern: string): Promise<Array<{
276
+ path: string;
277
+ mtimeMs: number;
278
+ }>>;
252
279
  listFilesStrictSync(dir: string, pattern: string): string[];
253
280
  exists(path: string): Promise<boolean>;
254
281
  readText(path: string): Promise<string>;
@@ -281,6 +308,10 @@ export declare class MemorySessionStorage implements SessionStorage {
281
308
  readSnapshotSync(path: string): SessionStorageSnapshot;
282
309
  statSync(path: string): SessionStorageStat;
283
310
  listFilesSync(dir: string, pattern: string): string[];
311
+ listFilesByMtime(dir: string, pattern: string): Promise<Array<{
312
+ path: string;
313
+ mtimeMs: number;
314
+ }>>;
284
315
  listFilesStrictSync(dir: string, pattern: string): string[];
285
316
  exists(path: string): Promise<boolean>;
286
317
  readText(path: string): Promise<string>;
@@ -45,6 +45,8 @@ export interface SkillActiveEntry {
45
45
  handoff_at?: string;
46
46
  active_subskills?: ActiveSubskillEntry[];
47
47
  source_state_revision?: number;
48
+ /** Durable ordering token from the source workflow mode-state, not this cache file's revision. */
49
+ committed_mode_state_revision?: number;
48
50
  }
49
51
  export interface SkillActiveState {
50
52
  version?: number;
@@ -85,6 +87,8 @@ export interface SyncSkillActiveStateOptions {
85
87
  handoff_at?: string;
86
88
  active_subskills?: ActiveSubskillEntry[];
87
89
  sourceRevision?: number;
90
+ /** Durable ordering token from the source workflow mode-state, not this cache file's revision. */
91
+ committedModeRevision?: number;
88
92
  }
89
93
  export declare function normalizeWorkflowHudSummary(raw: unknown): WorkflowHudSummary | undefined;
90
94
  export declare function isCanonicalGjcWorkflowSkill(skill: string): skill is CanonicalGjcWorkflowSkill;
@@ -36,7 +36,9 @@ export declare class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskT
36
36
  get description(): string;
37
37
  private constructor();
38
38
  /**
39
- * Create a TaskTool instance with async agent discovery.
39
+ * Create a TaskTool instance.
40
+ * Repository authority is captured from session cwd *before* agent discovery so
41
+ * multi-repo workspaces fail closed prior to context/discovery (#2901).
40
42
  */
41
43
  static create(session: ToolSession): Promise<TaskTool>;
42
44
  execute(_toolCallId: string, rawParams: unknown, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<TaskToolDetails>): Promise<AgentToolResult<TaskToolDetails>>;
@@ -59,6 +59,8 @@ export interface TaskResultReceipt {
59
59
  extractedToolCounts?: Record<string, number>;
60
60
  forkContext?: SingleResult["forkContext"];
61
61
  forkContextAdvisory?: SingleResult["forkContextAdvisory"];
62
+ /** Resolved repository identity for this delegated lane (#2901). */
63
+ repositoryBinding?: SingleResult["repositoryBinding"];
62
64
  roi?: TaskRoi;
63
65
  }
64
66
  /**
@@ -52,6 +52,15 @@ export declare const taskItemSchema: z.ZodObject<{
52
52
  none: "none";
53
53
  receipt: "receipt";
54
54
  }>>;
55
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
56
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
57
+ worktreeRoot: z.ZodString;
58
+ commonDir: z.ZodNullable<z.ZodString>;
59
+ relativeSubdir: z.ZodOptional<z.ZodString>;
60
+ displayPath: z.ZodOptional<z.ZodString>;
61
+ head: z.ZodOptional<z.ZodString>;
62
+ branch: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strict>>;
55
64
  }, z.core.$strip>;
56
65
  export type TaskItem = z.infer<typeof taskItemSchema>;
57
66
  export declare const taskSchema: z.ZodObject<{
@@ -67,6 +76,15 @@ export declare const taskSchema: z.ZodObject<{
67
76
  none: "none";
68
77
  receipt: "receipt";
69
78
  }>>;
79
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
80
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
81
+ worktreeRoot: z.ZodString;
82
+ commonDir: z.ZodNullable<z.ZodString>;
83
+ relativeSubdir: z.ZodOptional<z.ZodString>;
84
+ displayPath: z.ZodOptional<z.ZodString>;
85
+ head: z.ZodOptional<z.ZodString>;
86
+ branch: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strict>>;
70
88
  }, z.core.$strip>>;
71
89
  spawnPlan: z.ZodOptional<z.ZodObject<{
72
90
  whyParallel: z.ZodString;
@@ -89,6 +107,15 @@ export declare const taskSchemaNoIsolation: z.ZodObject<{
89
107
  none: "none";
90
108
  receipt: "receipt";
91
109
  }>>;
110
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
111
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
112
+ worktreeRoot: z.ZodString;
113
+ commonDir: z.ZodNullable<z.ZodString>;
114
+ relativeSubdir: z.ZodOptional<z.ZodString>;
115
+ displayPath: z.ZodOptional<z.ZodString>;
116
+ head: z.ZodOptional<z.ZodString>;
117
+ branch: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strict>>;
92
119
  }, z.core.$strip>>;
93
120
  spawnPlan: z.ZodOptional<z.ZodObject<{
94
121
  whyParallel: z.ZodString;
@@ -111,6 +138,15 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
111
138
  none: "none";
112
139
  receipt: "receipt";
113
140
  }>>;
141
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
142
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
143
+ worktreeRoot: z.ZodString;
144
+ commonDir: z.ZodNullable<z.ZodString>;
145
+ relativeSubdir: z.ZodOptional<z.ZodString>;
146
+ displayPath: z.ZodOptional<z.ZodString>;
147
+ head: z.ZodOptional<z.ZodString>;
148
+ branch: z.ZodOptional<z.ZodString>;
149
+ }, z.core.$strict>>;
114
150
  }, z.core.$strip>>;
115
151
  spawnPlan: z.ZodOptional<z.ZodObject<{
116
152
  whyParallel: z.ZodString;
@@ -132,6 +168,15 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
132
168
  none: "none";
133
169
  receipt: "receipt";
134
170
  }>>;
171
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
172
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
173
+ worktreeRoot: z.ZodString;
174
+ commonDir: z.ZodNullable<z.ZodString>;
175
+ relativeSubdir: z.ZodOptional<z.ZodString>;
176
+ displayPath: z.ZodOptional<z.ZodString>;
177
+ head: z.ZodOptional<z.ZodString>;
178
+ branch: z.ZodOptional<z.ZodString>;
179
+ }, z.core.$strict>>;
135
180
  }, z.core.$strip>>;
136
181
  spawnPlan: z.ZodOptional<z.ZodObject<{
137
182
  whyParallel: z.ZodString;
@@ -153,6 +198,15 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
153
198
  none: "none";
154
199
  receipt: "receipt";
155
200
  }>>;
201
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
202
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
203
+ worktreeRoot: z.ZodString;
204
+ commonDir: z.ZodNullable<z.ZodString>;
205
+ relativeSubdir: z.ZodOptional<z.ZodString>;
206
+ displayPath: z.ZodOptional<z.ZodString>;
207
+ head: z.ZodOptional<z.ZodString>;
208
+ branch: z.ZodOptional<z.ZodString>;
209
+ }, z.core.$strict>>;
156
210
  }, z.core.$strip>>;
157
211
  spawnPlan: z.ZodOptional<z.ZodObject<{
158
212
  whyParallel: z.ZodString;
@@ -174,6 +228,15 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
174
228
  none: "none";
175
229
  receipt: "receipt";
176
230
  }>>;
231
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
232
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
233
+ worktreeRoot: z.ZodString;
234
+ commonDir: z.ZodNullable<z.ZodString>;
235
+ relativeSubdir: z.ZodOptional<z.ZodString>;
236
+ displayPath: z.ZodOptional<z.ZodString>;
237
+ head: z.ZodOptional<z.ZodString>;
238
+ branch: z.ZodOptional<z.ZodString>;
239
+ }, z.core.$strict>>;
177
240
  }, z.core.$strip>>;
178
241
  spawnPlan: z.ZodOptional<z.ZodObject<{
179
242
  whyParallel: z.ZodString;
@@ -195,6 +258,15 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
195
258
  none: "none";
196
259
  receipt: "receipt";
197
260
  }>>;
261
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
262
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
263
+ worktreeRoot: z.ZodString;
264
+ commonDir: z.ZodNullable<z.ZodString>;
265
+ relativeSubdir: z.ZodOptional<z.ZodString>;
266
+ displayPath: z.ZodOptional<z.ZodString>;
267
+ head: z.ZodOptional<z.ZodString>;
268
+ branch: z.ZodOptional<z.ZodString>;
269
+ }, z.core.$strict>>;
198
270
  }, z.core.$strip>>;
199
271
  spawnPlan: z.ZodOptional<z.ZodObject<{
200
272
  whyParallel: z.ZodString;
@@ -216,6 +288,15 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
216
288
  none: "none";
217
289
  receipt: "receipt";
218
290
  }>>;
291
+ repositoryBinding: z.ZodOptional<z.ZodObject<{
292
+ schema: z.ZodLiteral<"gjc.repository_binding.v1">;
293
+ worktreeRoot: z.ZodString;
294
+ commonDir: z.ZodNullable<z.ZodString>;
295
+ relativeSubdir: z.ZodOptional<z.ZodString>;
296
+ displayPath: z.ZodOptional<z.ZodString>;
297
+ head: z.ZodOptional<z.ZodString>;
298
+ branch: z.ZodOptional<z.ZodString>;
299
+ }, z.core.$strict>>;
219
300
  }, z.core.$strip>>;
220
301
  spawnPlan: z.ZodOptional<z.ZodObject<{
221
302
  whyParallel: z.ZodString;
@@ -431,6 +512,19 @@ export interface SingleResult {
431
512
  recommendedMode: ForkContextMode;
432
513
  reasons: string[];
433
514
  };
515
+ /**
516
+ * Resolved repository identity used for this task after pre-discovery stamping
517
+ * and fail-closed validation (#2901).
518
+ */
519
+ repositoryBinding?: {
520
+ schema: "gjc.repository_binding.v1";
521
+ worktreeRoot: string;
522
+ commonDir: string | null;
523
+ relativeSubdir?: string;
524
+ displayPath?: string;
525
+ head?: string;
526
+ branch?: string;
527
+ };
434
528
  }
435
529
  /** True only for complete, factual five-bucket cost accounting. */
436
530
  export declare function hasCompleteUsageCostBreakdown(usage: unknown): boolean;