@gajae-code/coding-agent 0.12.4 → 0.12.6

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 (139) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +4 -1
  3. package/dist/types/async/job-manager.d.ts +9 -1
  4. package/dist/types/eval/backend.d.ts +2 -2
  5. package/dist/types/exec/bash-executor.d.ts +10 -8
  6. package/dist/types/extensibility/extensions/runner.d.ts +9 -7
  7. package/dist/types/gjc-runtime/launch-tmux.d.ts +22 -3
  8. package/dist/types/gjc-runtime/psmux-detect.d.ts +3 -0
  9. package/dist/types/gjc-runtime/team-launch.d.ts +3 -1
  10. package/dist/types/gjc-runtime/team-runtime.d.ts +14 -2
  11. package/dist/types/gjc-runtime/team-store.d.ts +0 -4
  12. package/dist/types/gjc-runtime/team-workers.d.ts +5 -0
  13. package/dist/types/gjc-runtime/tmux-common.d.ts +1 -0
  14. package/dist/types/gjc-runtime/tmux-provider-context.d.ts +57 -0
  15. package/dist/types/gjc-runtime/tmux-sessions.d.ts +8 -1
  16. package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +3 -0
  17. package/dist/types/gjc-runtime/ultragoal-review-source.d.ts +83 -0
  18. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +57 -4
  19. package/dist/types/internal-urls/registry-helpers.d.ts +18 -0
  20. package/dist/types/modes/components/gjc-bundle-settings.d.ts +1 -0
  21. package/dist/types/modes/components/plugin-settings.d.ts +2 -0
  22. package/dist/types/modes/components/settings-selector.d.ts +2 -0
  23. package/dist/types/sdk/broker/broker.d.ts +18 -0
  24. package/dist/types/sdk/broker/lifecycle-ledger.d.ts +13 -0
  25. package/dist/types/sdk/broker/lifecycle.d.ts +1 -0
  26. package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -2
  27. package/dist/types/sdk/bus/index.d.ts +4 -0
  28. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +7 -3
  29. package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -3
  30. package/dist/types/sdk/bus/topic-registry.d.ts +63 -3
  31. package/dist/types/sdk/host/host.d.ts +23 -2
  32. package/dist/types/sdk/host/reverse-leases.d.ts +7 -4
  33. package/dist/types/session/agent-session.d.ts +5 -4
  34. package/dist/types/session/artifacts.d.ts +8 -5
  35. package/dist/types/session/attempt-record-store.d.ts +19 -0
  36. package/dist/types/session/client-bridge.d.ts +14 -0
  37. package/dist/types/session/internal/managed-session-storage.d.ts +7 -23
  38. package/dist/types/session/messages.d.ts +4 -1
  39. package/dist/types/session/session-manager.d.ts +7 -5
  40. package/dist/types/session/session-storage.d.ts +8 -0
  41. package/dist/types/session/streaming-output.d.ts +32 -0
  42. package/dist/types/task/executor.d.ts +1 -1
  43. package/dist/types/task/index.d.ts +2 -1
  44. package/dist/types/task/receipt.d.ts +3 -0
  45. package/dist/types/task/types.d.ts +194 -0
  46. package/dist/types/task/worktree.d.ts +13 -6
  47. package/dist/types/tools/bash.d.ts +1 -1
  48. package/dist/types/tools/fetch.d.ts +3 -0
  49. package/dist/types/tools/output-meta.d.ts +37 -5
  50. package/dist/types/tools/subagent.d.ts +2 -0
  51. package/dist/types/tools/tool-result.d.ts +1 -0
  52. package/dist/types/utils/artifact-id.d.ts +2 -0
  53. package/dist/types/utils/git.d.ts +1 -0
  54. package/package.json +8 -8
  55. package/scripts/capture-sticky-viewport-showcase.ts +131 -5
  56. package/scripts/verify-gjc-sdk-canonicalization.ts +128 -183
  57. package/scripts/verify-sticky-viewport-showcase.ts +620 -93
  58. package/src/async/job-manager.ts +13 -5
  59. package/src/config/model-profiles.ts +8 -0
  60. package/src/config/settings-schema.ts +17 -3
  61. package/src/cursor.ts +20 -13
  62. package/src/defaults/gjc/skills/ultragoal/SKILL.md +5 -2
  63. package/src/eval/backend.ts +2 -2
  64. package/src/exec/bash-executor.ts +425 -151
  65. package/src/extensibility/extensions/runner.ts +80 -6
  66. package/src/extensibility/extensions/wrapper.ts +22 -15
  67. package/src/extensibility/runtime-skill-discovery.ts +4 -6
  68. package/src/gjc-runtime/launch-tmux.ts +309 -293
  69. package/src/gjc-runtime/managed-owner-supervisor.ts +6 -2
  70. package/src/gjc-runtime/psmux-detect.ts +52 -6
  71. package/src/gjc-runtime/team-launch.ts +50 -2
  72. package/src/gjc-runtime/team-runtime.ts +716 -251
  73. package/src/gjc-runtime/team-store.ts +25 -7
  74. package/src/gjc-runtime/team-workers.ts +161 -1
  75. package/src/gjc-runtime/tmux-common.ts +16 -4
  76. package/src/gjc-runtime/tmux-gc.ts +37 -5
  77. package/src/gjc-runtime/tmux-owner-isolation.ts +2 -0
  78. package/src/gjc-runtime/tmux-provider-context.ts +451 -0
  79. package/src/gjc-runtime/tmux-sessions.ts +409 -156
  80. package/src/gjc-runtime/ultragoal-change-set.ts +90 -44
  81. package/src/gjc-runtime/ultragoal-receipt-freshness.ts +7 -0
  82. package/src/gjc-runtime/ultragoal-review-source.ts +378 -0
  83. package/src/gjc-runtime/ultragoal-runtime.ts +640 -159
  84. package/src/gjc-runtime/workflow-manifest.generated.json +40 -1
  85. package/src/gjc-runtime/workflow-manifest.ts +12 -0
  86. package/src/internal-urls/agent-protocol.ts +98 -38
  87. package/src/internal-urls/artifact-protocol.ts +28 -17
  88. package/src/internal-urls/docs-index.generated.ts +6 -6
  89. package/src/internal-urls/local-protocol.ts +39 -18
  90. package/src/internal-urls/registry-helpers.ts +62 -0
  91. package/src/modes/acp/acp-agent.ts +51 -13
  92. package/src/modes/acp/acp-client-bridge.ts +154 -11
  93. package/src/modes/components/gjc-bundle-settings.ts +2 -0
  94. package/src/modes/components/plugin-settings.ts +5 -0
  95. package/src/modes/components/settings-selector.ts +4 -0
  96. package/src/modes/controllers/selector-controller.ts +1 -0
  97. package/src/prompts/tools/bash.md +2 -2
  98. package/src/prompts/tools/monitor.md +4 -4
  99. package/src/sdk/acp/adapter.ts +200 -9
  100. package/src/sdk/broker/broker.ts +93 -10
  101. package/src/sdk/broker/lifecycle-ledger.ts +227 -11
  102. package/src/sdk/broker/lifecycle.ts +692 -98
  103. package/src/sdk/bus/chat-daemon-control.ts +33 -5
  104. package/src/sdk/bus/index.ts +347 -14
  105. package/src/sdk/bus/telegram-daemon-contract.ts +7 -3
  106. package/src/sdk/bus/telegram-daemon.ts +283 -44
  107. package/src/sdk/bus/topic-registry.ts +133 -10
  108. package/src/sdk/host/host.ts +187 -9
  109. package/src/sdk/host/reverse-leases.ts +249 -42
  110. package/src/sdk/session.ts +8 -6
  111. package/src/session/agent-session.ts +930 -354
  112. package/src/session/artifacts.ts +211 -74
  113. package/src/session/attempt-record-store.ts +106 -0
  114. package/src/session/client-bridge.ts +15 -0
  115. package/src/session/internal/managed-session-scope.ts +332 -198
  116. package/src/session/internal/managed-session-storage.ts +162 -450
  117. package/src/session/messages.ts +32 -7
  118. package/src/session/session-manager.ts +31 -28
  119. package/src/session/session-storage.ts +190 -53
  120. package/src/session/streaming-output.ts +198 -40
  121. package/src/task/executor.ts +5 -2
  122. package/src/task/index.ts +277 -64
  123. package/src/task/provider-retry-status.ts +4 -1
  124. package/src/task/receipt.ts +26 -2
  125. package/src/task/render.ts +42 -1
  126. package/src/task/types.ts +52 -0
  127. package/src/task/worktree.ts +122 -43
  128. package/src/tools/bash.ts +818 -239
  129. package/src/tools/eval.ts +99 -4
  130. package/src/tools/fetch.ts +77 -15
  131. package/src/tools/find.ts +7 -3
  132. package/src/tools/monitor.ts +7 -1
  133. package/src/tools/output-meta.ts +706 -116
  134. package/src/tools/search.ts +9 -4
  135. package/src/tools/subagent-render.ts +5 -2
  136. package/src/tools/subagent.ts +8 -0
  137. package/src/tools/tool-result.ts +1 -0
  138. package/src/utils/artifact-id.ts +6 -0
  139. package/src/utils/git.ts +2 -0
@@ -55,12 +55,23 @@ export interface ClientBridgeTerminalOutput {
55
55
  }
56
56
  export interface ClientBridgeTerminalHandle {
57
57
  terminalId: string;
58
+ /** Exact provider lease/session identity that owns this terminal. */
59
+ providerLeaseId: string;
58
60
  waitForExit(): Promise<ClientBridgeTerminalExitStatus>;
59
61
  currentOutput(): Promise<ClientBridgeTerminalOutput>;
60
62
  kill(): Promise<void>;
61
63
  release(): Promise<void>;
64
+ /** Full authenticated provider identity, when supplied by the transport. */
65
+ providerLeaseIdentity?: ClientBridgeProviderLeaseIdentity;
66
+ }
67
+ export interface ClientBridgeProviderLeaseIdentity {
68
+ leaseId: string;
69
+ connectionId: string;
70
+ connectionGeneration: number;
71
+ fence: string;
62
72
  }
63
73
  export interface ClientBridgeCreateTerminalParams {
74
+ toolCallId: string;
64
75
  command: string;
65
76
  args?: string[];
66
77
  env?: Array<{
@@ -69,6 +80,7 @@ export interface ClientBridgeCreateTerminalParams {
69
80
  }>;
70
81
  cwd?: string;
71
82
  outputByteLimit?: number;
83
+ signal?: AbortSignal;
72
84
  }
73
85
  export interface ClientBridge {
74
86
  readonly capabilities: ClientBridgeCapabilities;
@@ -84,5 +96,7 @@ export interface ClientBridge {
84
96
  content: string;
85
97
  }): Promise<void>;
86
98
  createTerminal?(params: ClientBridgeCreateTerminalParams): Promise<ClientBridgeTerminalHandle>;
99
+ /** Fence the exact provider identity after cleanup ownership becomes uncertain. */
100
+ quarantineProviderLease?(providerLease: string | ClientBridgeProviderLeaseIdentity, reason: string): Promise<void>;
87
101
  requestPermission?(toolCall: ClientBridgePermissionToolCall, options: ClientBridgePermissionOption[], signal?: AbortSignal): Promise<ClientBridgePermissionOutcome>;
88
102
  }
@@ -7,7 +7,6 @@ export declare const MANAGED_ARTIFACT_MAX_TOTAL_BYTES: number;
7
7
  export declare const MANAGED_ARTIFACT_COPY_BATCH_SIZE = 256;
8
8
  export declare class ManagedPublishError extends Error {
9
9
  readonly classification: "destination_conflict" | "atomic_unavailable" | "invalid_request" | "durability_not_provable" | "identity_mismatch" | "io_error" | "durability_failed";
10
- readonly code: ManagedPublishError["classification"];
11
10
  readonly diagnostic: string;
12
11
  constructor(classification: ManagedPublishError["classification"], outcome: NativePublishOutcome);
13
12
  }
@@ -21,12 +20,6 @@ export interface ManagedStorageLock {
21
20
  assertOwned(): void;
22
21
  release(): Promise<void>;
23
22
  }
24
- export interface ManagedStorageLockSync {
25
- path: string;
26
- attemptId: string;
27
- assertOwned(): void;
28
- release(): void;
29
- }
30
23
  export interface ManagedFileSnapshot {
31
24
  bytes: Buffer;
32
25
  identity: {
@@ -38,13 +31,6 @@ export interface ManagedFileSnapshot {
38
31
  sha256: string;
39
32
  };
40
33
  }
41
- export declare const MANAGED_SESSION_SECURITY_CODES: readonly ["acl_denied", "acl_io_error", "acl_present", "acl_malformed", "acl_unknown", "acl_unavailable", "acl_apply_failed", "acl_verify_failed", "not_found", "not_directory", "network_unsupported", "reparse_point", "identity_unavailable", "identity_mismatch", "owner_mismatch", "mode_mismatch", "io_error"];
42
- export type ManagedSessionSecurityCode = (typeof MANAGED_SESSION_SECURITY_CODES)[number];
43
- export declare class ManagedSessionSecurityError extends Error {
44
- readonly code: ManagedSessionSecurityCode;
45
- constructor(code: ManagedSessionSecurityCode);
46
- }
47
- export declare function managedSessionSecurityCode(error: unknown): ManagedSessionSecurityCode | undefined;
48
34
  export declare function validateNativeSecurityResult(value: unknown, operation: "apply" | "verify", kind: "directory" | "file"): NativeOwnerOnlySecurityResult;
49
35
  /** Captured configured-root authority for managed paths only. */
50
36
  export interface ManagedDirectoryRoot {
@@ -77,6 +63,8 @@ export declare class ManagedSessionDescendantStore {
77
63
  get rootAuthority(): ManagedDirectoryRoot;
78
64
  get subtreeRootAuthority(): ManagedDirectoryRoot;
79
65
  get securityPolicy(): ManagedSessionSecurityPolicy;
66
+ get hasRetainedAuthority(): boolean;
67
+ acquireMutationFence(name: string): Promise<ManagedStorageLock | undefined>;
80
68
  get profileAgentDir(): string;
81
69
  deriveSubtree(relativePath: string): ManagedSessionDescendantStore;
82
70
  retainAuthority(): RecoveryFsRoot | undefined;
@@ -91,6 +79,7 @@ export declare class ManagedSessionDescendantStore {
91
79
  publishNoReplace(relativePath: string, bytes: Uint8Array): Promise<void>;
92
80
  publishNoReplaceSync(relativePath: string, bytes: Uint8Array): void;
93
81
  replace(relativePath: string, bytes: Uint8Array): Promise<void>;
82
+ replaceExpected(relativePath: string, bytes: Uint8Array, expected: ManagedFileSnapshot): void;
94
83
  replaceSync(relativePath: string, bytes: Uint8Array): void;
95
84
  appendSync(relativePath: string, bytes: Uint8Array): void;
96
85
  /** Read an exact managed file without exposing its pathname as authority. */
@@ -118,19 +107,14 @@ export declare function captureManagedFilePrefixNoFollow(pathname: string, maxBy
118
107
  export declare function captureManagedFileNoFollow(pathname: string): ManagedFileSnapshot;
119
108
  /** Atomically publishes bytes without replacing an existing destination. */
120
109
  export declare function publishManagedFileNoReplace(destination: string, bytes: Uint8Array, assertOwned?: () => void, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
121
- export declare function publishManagedFileNoReplaceSync(destination: string, bytes: Uint8Array, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
122
- /**
123
- * Atomically replace a managed file only when the destination is still the
124
- * exact captured object. Unlike `replaceManagedFileSync`, this never performs
125
- * an unconditional pathname rename.
126
- */
127
- export declare function replaceManagedFileExactSync(destination: string, bytes: Uint8Array, expected: Pick<ManagedFileSnapshot, "identity">, root: ManagedDirectoryRoot): void;
110
+ export declare function publishManagedFileNoReplaceSync(destination: string, bytes: Uint8Array, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy, assertOwned?: () => void): void;
111
+ /** Replace one managed regular file while retaining the secured staging fd through publication. */
112
+ export declare function replaceManagedFileSync(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy, assertFence?: () => void): void;
113
+ export declare function replaceManagedFile(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
128
114
  /** Copy the exact bytes captured from one no-follow source descriptor. */
129
115
  export declare function copyManagedFileNoReplace(source: string, destination: string, snapshot?: ManagedFileSnapshot, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
130
116
  /** Acquire a lease lock with bounded wait, heartbeats, conservative stale reclaim, and fencing. */
131
117
  export declare function acquireManagedLock(locksDirectory: string, name: string, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<ManagedStorageLock>;
132
- /** Acquire a synchronous lease lock for a short cross-process critical section. */
133
- export declare function acquireManagedLockSync(locksDirectory: string, name: string, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): ManagedStorageLockSync;
134
118
  export interface ManagedArtifactTreeLimits {
135
119
  maxFiles?: number;
136
120
  maxTotalBytes?: number;
@@ -73,7 +73,10 @@ export declare const PRE_ADMISSION_ARTIFACT_SPILL_TAIL_BYTES = 4096;
73
73
  * next provider context is constructed. Byte boundaries never split UTF-8
74
74
  * code points, so head/tail recovery remains readable for emoji and CJK text.
75
75
  */
76
- export declare function createPreAdmissionArtifactSpillPreview(fullText: string, artifactId: string, digest: string): string;
76
+ export declare function createPreAdmissionArtifactSpillPreview(fullText: string, artifactId: string, digest: string, options?: {
77
+ maxInlineBytes?: number;
78
+ fullOutput?: boolean;
79
+ }): string;
77
80
  /**
78
81
  * Message type for bash executions via the ! command.
79
82
  */
@@ -4,7 +4,7 @@ import type { ImageContent, Message, MessageAttribution, ServiceTier, TextConten
4
4
  import * as native from "@gajae-code/natives";
5
5
  import type { TtsrInjectionRecord } from "../export/ttsr";
6
6
  import type { ManagedLegacyLocalMigrationSource } from "../internal-urls/local-protocol";
7
- import { ArtifactManager } from "./artifacts";
7
+ import { ArtifactManager, type ArtifactSaveReceipt } from "./artifacts";
8
8
  import { type BlobPutResult, BlobStore } from "./blob-store";
9
9
  import { type ManagedMigrationPolicy } from "./internal/managed-session-scope";
10
10
  import { type ManagedDirectoryRoot, ManagedSessionDescendantStore } from "./internal/managed-session-storage";
@@ -329,6 +329,7 @@ export interface ResumeSessionIdentity {
329
329
  sessionId: string;
330
330
  dev: bigint;
331
331
  ino: bigint;
332
+ nlink?: bigint;
332
333
  size: number;
333
334
  mtimeMs: number;
334
335
  mtimeNs: bigint;
@@ -484,7 +485,7 @@ export interface ReadonlySessionManager {
484
485
  /** Creates an immutable facade that never exposes SessionManager mutation authority. */
485
486
  export declare function createReadonlySessionManager(manager: SessionManager): ReadonlySessionManager;
486
487
  /** Internal artifact-writing capability. Read-only facades expose it only through a private weak-map lookup. */
487
- export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "putBlob">>;
488
+ export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "getArtifactPath" | "putBlob">>;
488
489
  /**
489
490
  * Returns the artifact capability for a concrete persistence owner or one of its
490
491
  * immutable read-only facades. Structural lookalikes remain unauthorized.
@@ -756,10 +757,11 @@ export declare class SessionManager {
756
757
  path?: string;
757
758
  }>;
758
759
  /**
759
- * Save artifact content under the current session and return artifact ID.
760
- * Returns an artifact ID for all sessions (file-backed for persistent, in-memory fallback otherwise).
760
+ * Save artifact content under the current persisted session and return its artifact ID.
761
+ * In-memory sessions cannot produce protocol-resolvable artifact references.
761
762
  */
762
763
  saveArtifact(content: string, toolType: string): Promise<string | undefined>;
764
+ saveArtifactReceipt(content: string, toolType: string): Promise<ArtifactSaveReceipt | undefined>;
763
765
  /**
764
766
  * Resolve an artifact ID to an on-disk path for the current session.
765
767
  * Returns null when missing or when the session is not persisted.
@@ -986,7 +988,7 @@ export declare class SessionManager {
986
988
  * @param sessionDir Optional session directory for /new or /branch. If omitted, derives from file's parent.
987
989
  */
988
990
  static open(filePath: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<SessionManager>;
989
- static openNestedManaged(filePath: string, destination: SessionDestination, store: ManagedSessionDescendantStore, storage?: SessionStorage): Promise<SessionManager>;
991
+ static openNestedManaged(filePath: string, destination: SessionDestination, store: ManagedSessionDescendantStore, storage?: SessionStorage, cwdOverride?: string): Promise<SessionManager>;
990
992
  /**
991
993
  * List default-managed sessions for the resume picker without recovery or other
992
994
  * maintenance writes. This is the only picker inventory that includes legacy
@@ -3,6 +3,7 @@ import { type ManagedDirectoryRoot } from "./internal/managed-session-storage";
3
3
  export interface SessionStorageStat {
4
4
  dev: bigint;
5
5
  ino: bigint;
6
+ nlink?: bigint;
6
7
  size: number;
7
8
  mtimeMs: number;
8
9
  mtimeNs: bigint;
@@ -148,6 +149,7 @@ export interface SessionStorage {
148
149
  export interface SessionStorageFileIdentity {
149
150
  dev: bigint;
150
151
  ino: bigint;
152
+ nlink?: bigint;
151
153
  size: number;
152
154
  mtimeNs: bigint;
153
155
  sha256: string;
@@ -181,12 +183,17 @@ export interface VerifiedSessionDeleteTarget {
181
183
  cwd: string;
182
184
  /** Expected transcript file `(dev, ino)` captured at authorization. */
183
185
  transcriptIdentity: SessionStorageFileIdentity;
186
+ transcriptParentIdentity?: {
187
+ dev: bigint;
188
+ ino: bigint;
189
+ };
184
190
  /**
185
191
  * For retry after an `artifacts` `cleanup_pending`: the recorded artifact
186
192
  * directory identity to re-accept. A replacement/different artifact directory
187
193
  * fails closed. Omit on first attempt or to accept recorded absence.
188
194
  */
189
195
  expectedArtifactsIdentity?: SessionStorageFileIdentity;
196
+ artifactsAbsentAtAuthorization?: true;
190
197
  /** Stable native recursive-tree evidence captured before artifact detachment. */
191
198
  expectedArtifactsTree?: NativeDirectoryTreeSnapshot;
192
199
  /** Identity-bound quarantine path retained when recursive artifact cleanup failed. */
@@ -256,6 +263,7 @@ type NativeDirectoryTreeEntry = {
256
263
  kind: string;
257
264
  dev: string;
258
265
  ino: string;
266
+ nlink: string;
259
267
  size: string;
260
268
  mtimeNs: string;
261
269
  ctimeNs: string;
@@ -37,17 +37,40 @@ export interface OutputSummary {
37
37
  elidedBytes?: number;
38
38
  /** Lines elided from the middle when head-retain mode is active. */
39
39
  elidedLines?: number;
40
+ /** Exact source ranges retained by head/tail middle-elision windows. */
41
+ headRange?: {
42
+ start: number;
43
+ end: number;
44
+ };
45
+ tailRange?: {
46
+ start: number;
47
+ end: number;
48
+ };
49
+ /** The retained tail ends with only a byte fragment of its source line. */
50
+ lastLinePartial?: boolean;
51
+ /** The retained head ends with only a byte fragment of its source line. */
52
+ firstLinePartial?: boolean;
40
53
  /** Bytes dropped by the per-line column cap (sum across all lines). */
41
54
  columnDroppedBytes?: number;
42
55
  /** Number of distinct lines that hit the per-line column cap. */
43
56
  columnTruncatedLines?: number;
57
+ /** Configured per-line byte/column cap that caused visible omission. */
58
+ columnMax?: number;
44
59
  /** Artifact ID for internal URL access (artifact://<id>) when output was persisted. */
45
60
  artifactId?: string;
61
+ /** Artifact existence was proven by successful publication or file finalization. */
62
+ artifactVerified?: boolean;
46
63
  /** Bytes omitted from artifact storage after the artifact hard cap was reached. */
47
64
  artifactTruncatedBytes?: number;
65
+ /** Bytes dropped before the Bash executor received the native output stream. */
66
+ sourceTruncatedBytes?: number;
67
+ /** Exact source capture completeness could not be proven. */
68
+ sourceCaptureIncomplete?: boolean;
48
69
  /** Bounded diagnostic when artifact writer or terminal publisher creation, write, finalization, or publication failed. */
49
70
  artifactFailureDiagnostic?: string;
50
71
  }
72
+ /** Verify that this exact OutputSink summary came from a successful current-execution publication. */
73
+ export declare function hasCurrentExecutionArtifactProof(summary: OutputSummary, artifactId: string, payload?: string): boolean;
51
74
  export interface OutputSinkOptions {
52
75
  /**
53
76
  * Deprecated managed artifact pathname. Bare paths are deliberately ignored:
@@ -112,7 +135,16 @@ export interface TruncationResult {
112
135
  elidedBytes?: number;
113
136
  /** Lines elided from the middle (truncateMiddle only). */
114
137
  elidedLines?: number;
138
+ headRange?: {
139
+ start: number;
140
+ end: number;
141
+ };
142
+ tailRange?: {
143
+ start: number;
144
+ end: number;
145
+ };
115
146
  lastLinePartial?: boolean;
147
+ firstLinePartial?: boolean;
116
148
  firstLineExceedsLimit?: boolean;
117
149
  lastLineExceedsLimit?: boolean;
118
150
  }
@@ -107,7 +107,7 @@ export interface ExecutorOptions {
107
107
  export declare class ManagedTaskPersistence {
108
108
  #private;
109
109
  constructor(artifacts: ArtifactManager, taskId: string);
110
- openSession(): Promise<SessionManager>;
110
+ openSession(cwd: string): Promise<SessionManager>;
111
111
  publishOutput(rawOutput: string, metadata: Uint8Array): Promise<void>;
112
112
  }
113
113
  export declare function createManagedTaskPersistence(artifacts: ArtifactManager, taskId: string): ManagedTaskPersistence;
@@ -5,8 +5,9 @@ import { type SubagentRunOutcome } from "../async";
5
5
  import type { Theme } from "../modes/theme/theme";
6
6
  import { type SingleResult, type TaskToolDetails, type TaskToolSchemaInstance } from "./types";
7
7
  import "../tools/review";
8
+ import { type TaskResultReceipt } from "./receipt";
8
9
  import { renderResult, renderCall as renderTaskCall } from "./render";
9
- export declare function subagentRunOutcomeFromSingleResult(finalText: string, singleResult: Pick<SingleResult, "aborted" | "exitCode" | "paused" | "setupFailure"> | undefined): string | SubagentRunOutcome;
10
+ export declare function subagentRunOutcomeFromSingleResult(finalText: string, singleResult: (Pick<SingleResult, "aborted" | "exitCode" | "paused" | "setupFailure"> & Partial<Pick<TaskResultReceipt, "status">>) | undefined): string | SubagentRunOutcome;
10
11
  export { loadBundledAgents as BUNDLED_AGENTS } from "./agents";
11
12
  export { discoverCommands, expandCommand, getCommand } from "./commands";
12
13
  export { discoverAgents, getAgent } from "./discovery";
@@ -34,6 +34,7 @@ export interface TaskResultReceipt {
34
34
  cost?: number;
35
35
  usageCostBreakdownComplete?: true;
36
36
  branchName?: string;
37
+ persistence?: SingleResult["persistence"];
37
38
  retryFailure?: {
38
39
  attempt: number;
39
40
  errorSummary: string;
@@ -69,6 +70,8 @@ export interface TaskResultReceipt {
69
70
  forkContextAdvisory?: SingleResult["forkContextAdvisory"];
70
71
  /** Resolved repository identity for this delegated lane (#2901). */
71
72
  repositoryBinding?: SingleResult["repositoryBinding"];
73
+ /** Runtime-derived review source disposition and rerun guidance (#3469). */
74
+ reviewSource?: SingleResult["reviewSource"];
72
75
  roi?: TaskRoi;
73
76
  }
74
77
  /**
@@ -1,6 +1,7 @@
1
1
  import type { ThinkingLevel } from "@gajae-code/agent-core";
2
2
  import type { Usage } from "@gajae-code/ai";
3
3
  import * as z from "zod/v4";
4
+ import type { ReviewDeliveryDisposition, ReviewSourceLane } from "../gjc-runtime/ultragoal-review-source";
4
5
  import type { TaskResultReceipt } from "./receipt";
5
6
  import type { SpawnRoiReconciliation } from "./roi-reconciliation";
6
7
  import { type TaskSimpleMode } from "./simple-mode";
@@ -65,6 +66,24 @@ export declare const taskItemSchema: z.ZodObject<{
65
66
  head: z.ZodOptional<z.ZodString>;
66
67
  branch: z.ZodOptional<z.ZodString>;
67
68
  }, z.core.$strict>>;
69
+ reviewSource: z.ZodOptional<z.ZodObject<{
70
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
71
+ cohortId: z.ZodString;
72
+ generation: z.ZodNumber;
73
+ lane: z.ZodEnum<{
74
+ architect: "architect";
75
+ cleaner: "cleaner";
76
+ critic: "critic";
77
+ qa: "qa";
78
+ }>;
79
+ snapshotId: z.ZodString;
80
+ repositoryBindingDigest: z.ZodString;
81
+ stateRevision: z.ZodNumber;
82
+ dispatchId: z.ZodString;
83
+ rerunCommand: z.ZodString;
84
+ taskId: z.ZodString;
85
+ createdAt: z.ZodString;
86
+ }, z.core.$strict>>;
68
87
  }, z.core.$strip>;
69
88
  export type TaskItem = z.infer<typeof taskItemSchema>;
70
89
  export declare const taskSchema: z.ZodObject<{
@@ -93,6 +112,24 @@ export declare const taskSchema: z.ZodObject<{
93
112
  head: z.ZodOptional<z.ZodString>;
94
113
  branch: z.ZodOptional<z.ZodString>;
95
114
  }, z.core.$strict>>;
115
+ reviewSource: z.ZodOptional<z.ZodObject<{
116
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
117
+ cohortId: z.ZodString;
118
+ generation: z.ZodNumber;
119
+ lane: z.ZodEnum<{
120
+ architect: "architect";
121
+ cleaner: "cleaner";
122
+ critic: "critic";
123
+ qa: "qa";
124
+ }>;
125
+ snapshotId: z.ZodString;
126
+ repositoryBindingDigest: z.ZodString;
127
+ stateRevision: z.ZodNumber;
128
+ dispatchId: z.ZodString;
129
+ rerunCommand: z.ZodString;
130
+ taskId: z.ZodString;
131
+ createdAt: z.ZodString;
132
+ }, z.core.$strict>>;
96
133
  }, z.core.$strip>>;
97
134
  spawnPlan: z.ZodOptional<z.ZodObject<{
98
135
  whyParallel: z.ZodString;
@@ -128,6 +165,24 @@ export declare const taskSchemaNoIsolation: z.ZodObject<{
128
165
  head: z.ZodOptional<z.ZodString>;
129
166
  branch: z.ZodOptional<z.ZodString>;
130
167
  }, z.core.$strict>>;
168
+ reviewSource: z.ZodOptional<z.ZodObject<{
169
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
170
+ cohortId: z.ZodString;
171
+ generation: z.ZodNumber;
172
+ lane: z.ZodEnum<{
173
+ architect: "architect";
174
+ cleaner: "cleaner";
175
+ critic: "critic";
176
+ qa: "qa";
177
+ }>;
178
+ snapshotId: z.ZodString;
179
+ repositoryBindingDigest: z.ZodString;
180
+ stateRevision: z.ZodNumber;
181
+ dispatchId: z.ZodString;
182
+ rerunCommand: z.ZodString;
183
+ taskId: z.ZodString;
184
+ createdAt: z.ZodString;
185
+ }, z.core.$strict>>;
131
186
  }, z.core.$strip>>;
132
187
  spawnPlan: z.ZodOptional<z.ZodObject<{
133
188
  whyParallel: z.ZodString;
@@ -163,6 +218,24 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
163
218
  head: z.ZodOptional<z.ZodString>;
164
219
  branch: z.ZodOptional<z.ZodString>;
165
220
  }, z.core.$strict>>;
221
+ reviewSource: z.ZodOptional<z.ZodObject<{
222
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
223
+ cohortId: z.ZodString;
224
+ generation: z.ZodNumber;
225
+ lane: z.ZodEnum<{
226
+ architect: "architect";
227
+ cleaner: "cleaner";
228
+ critic: "critic";
229
+ qa: "qa";
230
+ }>;
231
+ snapshotId: z.ZodString;
232
+ repositoryBindingDigest: z.ZodString;
233
+ stateRevision: z.ZodNumber;
234
+ dispatchId: z.ZodString;
235
+ rerunCommand: z.ZodString;
236
+ taskId: z.ZodString;
237
+ createdAt: z.ZodString;
238
+ }, z.core.$strict>>;
166
239
  }, z.core.$strip>>;
167
240
  spawnPlan: z.ZodOptional<z.ZodObject<{
168
241
  whyParallel: z.ZodString;
@@ -197,6 +270,24 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
197
270
  head: z.ZodOptional<z.ZodString>;
198
271
  branch: z.ZodOptional<z.ZodString>;
199
272
  }, z.core.$strict>>;
273
+ reviewSource: z.ZodOptional<z.ZodObject<{
274
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
275
+ cohortId: z.ZodString;
276
+ generation: z.ZodNumber;
277
+ lane: z.ZodEnum<{
278
+ architect: "architect";
279
+ cleaner: "cleaner";
280
+ critic: "critic";
281
+ qa: "qa";
282
+ }>;
283
+ snapshotId: z.ZodString;
284
+ repositoryBindingDigest: z.ZodString;
285
+ stateRevision: z.ZodNumber;
286
+ dispatchId: z.ZodString;
287
+ rerunCommand: z.ZodString;
288
+ taskId: z.ZodString;
289
+ createdAt: z.ZodString;
290
+ }, z.core.$strict>>;
200
291
  }, z.core.$strip>>;
201
292
  spawnPlan: z.ZodOptional<z.ZodObject<{
202
293
  whyParallel: z.ZodString;
@@ -231,6 +322,24 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
231
322
  head: z.ZodOptional<z.ZodString>;
232
323
  branch: z.ZodOptional<z.ZodString>;
233
324
  }, z.core.$strict>>;
325
+ reviewSource: z.ZodOptional<z.ZodObject<{
326
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
327
+ cohortId: z.ZodString;
328
+ generation: z.ZodNumber;
329
+ lane: z.ZodEnum<{
330
+ architect: "architect";
331
+ cleaner: "cleaner";
332
+ critic: "critic";
333
+ qa: "qa";
334
+ }>;
335
+ snapshotId: z.ZodString;
336
+ repositoryBindingDigest: z.ZodString;
337
+ stateRevision: z.ZodNumber;
338
+ dispatchId: z.ZodString;
339
+ rerunCommand: z.ZodString;
340
+ taskId: z.ZodString;
341
+ createdAt: z.ZodString;
342
+ }, z.core.$strict>>;
234
343
  }, z.core.$strip>>;
235
344
  spawnPlan: z.ZodOptional<z.ZodObject<{
236
345
  whyParallel: z.ZodString;
@@ -265,6 +374,24 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
265
374
  head: z.ZodOptional<z.ZodString>;
266
375
  branch: z.ZodOptional<z.ZodString>;
267
376
  }, z.core.$strict>>;
377
+ reviewSource: z.ZodOptional<z.ZodObject<{
378
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
379
+ cohortId: z.ZodString;
380
+ generation: z.ZodNumber;
381
+ lane: z.ZodEnum<{
382
+ architect: "architect";
383
+ cleaner: "cleaner";
384
+ critic: "critic";
385
+ qa: "qa";
386
+ }>;
387
+ snapshotId: z.ZodString;
388
+ repositoryBindingDigest: z.ZodString;
389
+ stateRevision: z.ZodNumber;
390
+ dispatchId: z.ZodString;
391
+ rerunCommand: z.ZodString;
392
+ taskId: z.ZodString;
393
+ createdAt: z.ZodString;
394
+ }, z.core.$strict>>;
268
395
  }, z.core.$strip>>;
269
396
  spawnPlan: z.ZodOptional<z.ZodObject<{
270
397
  whyParallel: z.ZodString;
@@ -299,6 +426,24 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
299
426
  head: z.ZodOptional<z.ZodString>;
300
427
  branch: z.ZodOptional<z.ZodString>;
301
428
  }, z.core.$strict>>;
429
+ reviewSource: z.ZodOptional<z.ZodObject<{
430
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
431
+ cohortId: z.ZodString;
432
+ generation: z.ZodNumber;
433
+ lane: z.ZodEnum<{
434
+ architect: "architect";
435
+ cleaner: "cleaner";
436
+ critic: "critic";
437
+ qa: "qa";
438
+ }>;
439
+ snapshotId: z.ZodString;
440
+ repositoryBindingDigest: z.ZodString;
441
+ stateRevision: z.ZodNumber;
442
+ dispatchId: z.ZodString;
443
+ rerunCommand: z.ZodString;
444
+ taskId: z.ZodString;
445
+ createdAt: z.ZodString;
446
+ }, z.core.$strict>>;
302
447
  }, z.core.$strip>>;
303
448
  spawnPlan: z.ZodOptional<z.ZodObject<{
304
449
  whyParallel: z.ZodString;
@@ -333,6 +478,24 @@ declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
333
478
  head: z.ZodOptional<z.ZodString>;
334
479
  branch: z.ZodOptional<z.ZodString>;
335
480
  }, z.core.$strict>>;
481
+ reviewSource: z.ZodOptional<z.ZodObject<{
482
+ schema: z.ZodLiteral<"gjc.review_source_dispatch.v1">;
483
+ cohortId: z.ZodString;
484
+ generation: z.ZodNumber;
485
+ lane: z.ZodEnum<{
486
+ architect: "architect";
487
+ cleaner: "cleaner";
488
+ critic: "critic";
489
+ qa: "qa";
490
+ }>;
491
+ snapshotId: z.ZodString;
492
+ repositoryBindingDigest: z.ZodString;
493
+ stateRevision: z.ZodNumber;
494
+ dispatchId: z.ZodString;
495
+ rerunCommand: z.ZodString;
496
+ taskId: z.ZodString;
497
+ createdAt: z.ZodString;
498
+ }, z.core.$strict>>;
336
499
  }, z.core.$strip>>;
337
500
  spawnPlan: z.ZodOptional<z.ZodObject<{
338
501
  whyParallel: z.ZodString;
@@ -495,6 +658,18 @@ export interface SetupFailureSummary {
495
658
  }
496
659
  /** Create a bounded diagnostic that preserves a setup failure's cause without exposing credentials or local paths. */
497
660
  export declare function createSetupFailureSummary(error: unknown): SetupFailureSummary;
661
+ export interface TaskRecoveryArtifactRef {
662
+ uri: string;
663
+ sizeBytes: number;
664
+ sha256: string;
665
+ /** Recovery artifacts remain readable for the parent session lifetime. */
666
+ durability: "session";
667
+ }
668
+ export interface TaskPersistenceResult {
669
+ outcome: "applied" | "no_changes" | "recovery_available";
670
+ ownerWorktreeApplied: boolean;
671
+ recoveryRef?: TaskRecoveryArtifactRef;
672
+ }
498
673
  /** Result from a single agent execution */
499
674
  export interface SingleResult {
500
675
  index: number;
@@ -540,6 +715,10 @@ export interface SingleResult {
540
715
  nestedPatches?: NestedRepoPatch[];
541
716
  /** Whether isolated execution produced a non-empty root or nested patch. */
542
717
  producedChanges?: boolean;
718
+ /** Receipt-safe owner-worktree persistence result for isolated execution. */
719
+ persistence?: TaskPersistenceResult;
720
+ /** Identity-bound patch artifact captured before isolation cleanup. */
721
+ recoveryRef?: TaskRecoveryArtifactRef;
543
722
  /** Data extracted by registered subprocess tool handlers (keyed by tool name) */
544
723
  extractedToolData?: Record<string, unknown[]>;
545
724
  /** Full wrapper-owned review evidence, kept separate from caller completion data. */
@@ -587,6 +766,21 @@ export interface SingleResult {
587
766
  head?: string;
588
767
  branch?: string;
589
768
  };
769
+ /** Leader-issued immutable source identity for source-aware review lanes (#3469). */
770
+ reviewSource?: {
771
+ schema: "gjc.review_source_dispatch.v1";
772
+ cohortId: string;
773
+ generation: number;
774
+ lane: ReviewSourceLane;
775
+ snapshotId: string;
776
+ repositoryBindingDigest: string;
777
+ stateRevision: number;
778
+ dispatchId: string;
779
+ rerunCommand: string;
780
+ disposition: ReviewDeliveryDisposition;
781
+ currentSnapshotId?: string;
782
+ deliveryId?: string;
783
+ };
590
784
  }
591
785
  /** True only for complete, factual five-bucket cost accounting. */
592
786
  export declare function hasCompleteUsageCostBreakdown(usage: unknown): boolean;
@@ -22,6 +22,8 @@ export interface WorktreeBaseline {
22
22
  export declare function getRepoRoot(cwd: string): Promise<string>;
23
23
  export declare function getGitNoIndexNullPath(): string;
24
24
  export declare function captureBaseline(repoRoot: string): Promise<WorktreeBaseline>;
25
+ /** Confirm that applying patches to the captured owner baseline exactly matches the current owner worktree. */
26
+ export declare function verifyRootPatchesApplied(repoRoot: string, baseline: WorktreeBaseline, patches: readonly string[]): Promise<boolean>;
25
27
  export interface NestedRepoPatch {
26
28
  relativePath: string;
27
29
  patch: string;
@@ -29,14 +31,19 @@ export interface NestedRepoPatch {
29
31
  export interface DeltaPatchResult {
30
32
  rootPatch: string;
31
33
  nestedPatches: NestedRepoPatch[];
34
+ captureErrors?: string[];
32
35
  }
36
+ export interface RecoveryPatchBundle {
37
+ version: 1;
38
+ rootPatch: string;
39
+ nestedPatches: NestedRepoPatch[];
40
+ captureErrors?: string[];
41
+ }
42
+ export declare function serializeRecoveryPatchBundle(delta: DeltaPatchResult): string;
43
+ export declare function verifyNestedPatchesApplied(repoRoot: string, baseline: WorktreeBaseline, patches: readonly NestedRepoPatch[]): Promise<boolean>;
33
44
  export declare function captureDeltaPatch(isolationDir: string, baseline: WorktreeBaseline): Promise<DeltaPatchResult>;
34
- /**
35
- * Apply nested repo patches directly to their working directories after parent merge.
36
- * @param commitMessage Optional async function to generate a commit message from the combined diff.
37
- * If omitted or returns null, falls back to a generic message.
38
- */
39
- export declare function applyNestedPatches(repoRoot: string, patches: NestedRepoPatch[], commitMessage?: (diff: string) => Promise<string | null>): Promise<void>;
45
+ /** Preflight every nested delta, then roll back earlier repositories if a later apply fails. */
46
+ export declare function applyNestedPatches(repoRoot: string, patches: NestedRepoPatch[]): Promise<void>;
40
47
  /**
41
48
  * User-facing isolation mode names exposed by the `task.isolation.mode`
42
49
  * setting. Mapped to a backend-kind hint via {@link parseIsolationMode};
@@ -91,7 +91,7 @@ export declare class BashTool implements AgentTool<BashToolSchema, BashToolDetai
91
91
  label: string;
92
92
  commandCwd: string;
93
93
  }>;
94
- execute(_toolCallId: string, { command: rawCommand, env: rawEnv, timeout: rawTimeout, cwd, async: asyncRequested, pty, }: BashToolInput, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<BashToolDetails>, ctx?: AgentToolContext): Promise<AgentToolResult<BashToolDetails>>;
94
+ execute(toolCallId: string, { command: rawCommand, env: rawEnv, timeout: rawTimeout, cwd, async: asyncRequested, pty, }: BashToolInput, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<BashToolDetails>, ctx?: AgentToolContext): Promise<AgentToolResult<BashToolDetails>>;
95
95
  }
96
96
  export interface BashRenderArgs {
97
97
  command?: string;
@@ -49,6 +49,9 @@ export interface ReadUrlToolDetails {
49
49
  }
50
50
  interface ReadUrlCacheEntry {
51
51
  artifactId?: string;
52
+ artifactVerified?: boolean;
53
+ artifactFailureDiagnostic?: string;
54
+ artifactStorageIncomplete?: boolean;
52
55
  details: ReadUrlToolDetails;
53
56
  image?: FetchImagePayload;
54
57
  /** Complete URL output, including its preamble and body. */