@gajae-code/coding-agent 0.12.6 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/types/async/job-manager.d.ts +36 -1
  3. package/dist/types/eval/backend.d.ts +2 -2
  4. package/dist/types/exec/bash-executor.d.ts +8 -10
  5. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +0 -36
  6. package/dist/types/internal-urls/registry-helpers.d.ts +0 -18
  7. package/dist/types/sdk/bus/chat-daemon-control.d.ts +1 -3
  8. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +2 -4
  9. package/dist/types/sdk/host/host.d.ts +2 -23
  10. package/dist/types/sdk/host/reverse-leases.d.ts +4 -7
  11. package/dist/types/session/artifacts.d.ts +5 -8
  12. package/dist/types/session/client-bridge.d.ts +0 -14
  13. package/dist/types/session/internal/managed-session-storage.d.ts +2 -5
  14. package/dist/types/session/messages.d.ts +1 -4
  15. package/dist/types/session/session-manager.d.ts +4 -5
  16. package/dist/types/session/streaming-output.d.ts +0 -32
  17. package/dist/types/task/receipt.d.ts +1 -2
  18. package/dist/types/task/types.d.ts +43 -178
  19. package/dist/types/tools/bash.d.ts +1 -1
  20. package/dist/types/tools/fetch.d.ts +0 -3
  21. package/dist/types/tools/output-meta.d.ts +5 -37
  22. package/dist/types/tools/subagent.d.ts +15 -0
  23. package/dist/types/tools/todo-write.d.ts +3 -0
  24. package/dist/types/tools/tool-result.d.ts +0 -1
  25. package/package.json +8 -8
  26. package/src/async/job-manager.ts +430 -46
  27. package/src/cursor.ts +13 -20
  28. package/src/defaults/gjc/skills/ultragoal/SKILL.md +2 -3
  29. package/src/eval/backend.ts +2 -2
  30. package/src/exec/bash-executor.ts +151 -425
  31. package/src/gjc-runtime/ultragoal-runtime.ts +3 -280
  32. package/src/gjc-runtime/workflow-manifest.generated.json +1 -40
  33. package/src/gjc-runtime/workflow-manifest.ts +0 -12
  34. package/src/internal-urls/agent-protocol.ts +38 -98
  35. package/src/internal-urls/artifact-protocol.ts +17 -28
  36. package/src/internal-urls/docs-index.generated.ts +1 -1
  37. package/src/internal-urls/registry-helpers.ts +0 -62
  38. package/src/modes/acp/acp-agent.ts +0 -24
  39. package/src/modes/acp/acp-client-bridge.ts +11 -154
  40. package/src/prompts/tools/bash.md +2 -2
  41. package/src/sdk/acp/adapter.ts +9 -200
  42. package/src/sdk/bus/chat-daemon-control.ts +3 -5
  43. package/src/sdk/bus/index.ts +8 -324
  44. package/src/sdk/bus/telegram-daemon-contract.ts +2 -4
  45. package/src/sdk/host/host.ts +9 -187
  46. package/src/sdk/host/reverse-leases.ts +42 -249
  47. package/src/session/agent-session.ts +15 -178
  48. package/src/session/artifacts.ts +74 -211
  49. package/src/session/client-bridge.ts +0 -15
  50. package/src/session/internal/managed-session-storage.ts +5 -104
  51. package/src/session/messages.ts +7 -32
  52. package/src/session/session-manager.ts +21 -12
  53. package/src/session/streaming-output.ts +40 -198
  54. package/src/task/index.ts +230 -64
  55. package/src/task/receipt.ts +2 -4
  56. package/src/task/render.ts +0 -30
  57. package/src/task/types.ts +10 -34
  58. package/src/tools/bash.ts +239 -818
  59. package/src/tools/eval.ts +4 -99
  60. package/src/tools/fetch.ts +15 -77
  61. package/src/tools/find.ts +3 -7
  62. package/src/tools/output-meta.ts +114 -696
  63. package/src/tools/search.ts +4 -9
  64. package/src/tools/subagent.ts +97 -75
  65. package/src/tools/todo-write.ts +47 -0
  66. package/src/tools/tool-result.ts +0 -1
  67. package/dist/types/gjc-runtime/ultragoal-review-source.d.ts +0 -83
  68. package/dist/types/utils/artifact-id.d.ts +0 -2
  69. package/src/gjc-runtime/ultragoal-review-source.ts +0 -378
  70. package/src/utils/artifact-id.ts +0 -6
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.12.7] - 2026-07-31
6
+
5
7
  ## [0.12.6] - 2026-07-31
6
8
  ### Added
7
9
 
@@ -10,6 +12,7 @@
10
12
  ### Fixed
11
13
 
12
14
  - Settings now requests a repaint after asynchronous GJC bundle and plugin views rebuild, so loaded content and mutation results appear without an extra keypress (#3643).
15
+ - `todo_write` now rejects unsupported operation keys and treats a bare `done` or `drop` as an error instead of completing or abandoning every task (#3640).
13
16
  - Deferred `agent_end` publication again settles public session readiness before slow extension handlers finish, while retaining exact cancellation leases through queued extension delivery and draining that delivery before session shutdown.
14
17
  - Ultragoal validation-batch hydration now fails closed unless deferred and final-close evidence exactly matches a complete authoritative cumulative Git/CI inventory and durable batch tuple. Explicit malformed, partial, unknown, reordered, or stale receipt data is rejected; Git path capture is byte-safe, NUL-delimited, and includes untracked files; incomplete capture conservatively requires computer-control QA; shared settings and tool registries cannot use partial diffs to bypass that suite; validate/checkpoint replacement hydration is identical; and current/replacement receipts are byte-bound to ledger payloads (#3541).
15
18
  - Fixture quality gates that complete intermediate Ultragoal stories now write file-backed adversarial artifact proof; skill-state hooks and computer red-team fixtures match the unconditional adversarial path check so #3543 CI stays fail-closed without weakening hydration exactness (#3543).
@@ -68,7 +71,6 @@
68
71
  - The interactive `Working…` indicator now remains visible and explicitly labels owner-scoped detached background work across foreground completion, provider errors, pending-submission aborts, and job completion, without resurrecting after TUI disposal (#3479).
69
72
  - Activity-indicator suspension now detaches and restores the exact owned loader instead of stopping foreign transition UI; optimistic pre-init prompts still show and clear their spinner, context clear retains its eager teardown contract, and resume cancellation preserves transient state until session mutation actually begins.
70
73
  - Activity-indicator stop and suspension helpers now fail safely for lightweight controller contexts with absent or partial status rails, while full interactive contexts retain exact loader detach/restore ownership.
71
- - Bash now uses bounded core-to-native and N-API callback backpressure plus a 64 KiB terminal tail after the core 8 MiB stream budget, emits at most one typed aggregate loss marker, carries source-loss evidence through merged and raw stream cancellation/error paths, bounds ACP terminal lifecycle/output RPC settlement, cleans settled native sessions, labels every combined omission honestly through inline backstops and failure paths, omits false source ranges, and rejects malformed artifact IDs/counts.
72
74
 
73
75
  ## [0.12.1] - 2026-07-29
74
76
 
@@ -1,6 +1,7 @@
1
1
  import type { AgentProgress, AgentSource } from "../task/types";
2
2
  export interface AsyncJob {
3
3
  id: string;
4
+ readonly generation: string;
4
5
  type: "bash" | "task";
5
6
  status: "running" | "completed" | "failed" | "cancelled" | "paused";
6
7
  startTime: number;
@@ -41,6 +42,8 @@ export interface AsyncJobMetadata {
41
42
  agentSource: AgentSource;
42
43
  description?: string;
43
44
  assignment?: string;
45
+ duplicateIdentity?: string;
46
+ duplicateDisposition?: "warned" | "superseded";
44
47
  };
45
48
  /** True when this bash job was started by the `monitor` tool (vs plain async bash). */
46
49
  monitor?: boolean;
@@ -136,6 +139,11 @@ export interface SubagentRecord {
136
139
  modelFellBack?: boolean;
137
140
  /** True when the effective subagent provider is in fast mode. */
138
141
  fastMode?: boolean;
142
+ duplicateIdentity?: string;
143
+ duplicateDisposition?: "warned" | "superseded";
144
+ terminalGeneration?: string;
145
+ /** Generation of currentJobId, preventing stale ID reuse from mutating this record. */
146
+ currentJobGeneration?: string;
139
147
  }
140
148
  /** Lightweight, manager-owned resume payload. The async layer treats `data` as opaque. */
141
149
  export interface ResumeDescriptor {
@@ -200,6 +208,31 @@ export interface AsyncJobRegisterOptions {
200
208
  export interface AsyncJobFilter {
201
209
  ownerId?: string;
202
210
  }
211
+ export type AsyncJobWaitCondition = "all_terminal" | "any_terminal";
212
+ export type AsyncJobWaitOutcome = "completed" | "timed_out_wait" | "interrupted";
213
+ export interface AsyncJobWaitTarget {
214
+ targetId: string;
215
+ jobId: string | null;
216
+ subagentId?: string;
217
+ generation: string;
218
+ ownerId?: string;
219
+ initialStatus: AsyncJob["status"] | "queued" | "not_found";
220
+ }
221
+ export interface AsyncJobWaitResult {
222
+ outcome: AsyncJobWaitOutcome;
223
+ condition: AsyncJobWaitCondition;
224
+ terminalJobIds: string[];
225
+ pendingJobIds: string[];
226
+ }
227
+ export interface AsyncJobWaitHandle {
228
+ readonly token: string;
229
+ readonly result: Promise<AsyncJobWaitResult>;
230
+ acknowledge(targetIds?: readonly string[]): {
231
+ acknowledged: boolean;
232
+ jobIds: string[];
233
+ };
234
+ close(): void;
235
+ }
203
236
  /**
204
237
  * A slice of process-stream output for a background job, as recorded by
205
238
  * `appendOutput` / read by `readOutputSince`.
@@ -229,6 +262,8 @@ export declare class AsyncJobManager {
229
262
  static setInstance(value: AsyncJobManager | undefined): void;
230
263
  /** Reset the process-global instance. Test-only. */
231
264
  static resetForTests(): void;
265
+ resolveSubagentWaitTarget(id: string, filter?: AsyncJobFilter): AsyncJobWaitTarget | undefined;
266
+ subscribeTerminalWait(targets: readonly AsyncJobWaitTarget[], condition?: AsyncJobWaitCondition): AsyncJobWaitHandle;
232
267
  constructor(options: AsyncJobManagerOptions);
233
268
  /**
234
269
  * Subscribe to live-job-set change events. Returns an unsubscribe function.
@@ -385,5 +420,5 @@ export declare class AsyncJobManager {
385
420
  dispose(options?: {
386
421
  timeoutMs?: number;
387
422
  }): Promise<boolean>;
388
- isDeliverySuppressed(jobId: string): boolean;
423
+ isDeliverySuppressed(jobId: string, generation?: string): boolean;
389
424
  }
@@ -10,8 +10,8 @@ export interface ExecutorBackendExecOptions {
10
10
  session: ToolSession;
11
11
  deadlineMs: number;
12
12
  reset: boolean;
13
- artifactPath?: string;
14
- artifactId?: string;
13
+ artifactPath: string | undefined;
14
+ artifactId: string | undefined;
15
15
  onChunk: (chunk: string) => void;
16
16
  }
17
17
  /** Result returned by a backend's execute(). */
@@ -6,7 +6,7 @@ export interface BashArtifactSaveSummary {
6
6
  complete: boolean;
7
7
  omittedBytes?: number;
8
8
  }
9
- export type BashMinimizedSaveReturn = BashArtifactSaveResult | BashArtifactSaveSummary | undefined;
9
+ export type BashMinimizedSaveReturn = BashArtifactSaveResult | BashArtifactSaveSummary | string | undefined;
10
10
  export type BashArtifactSaveResult = {
11
11
  status: "saved";
12
12
  artifactId: string;
@@ -23,7 +23,7 @@ export type BashArtifactSaveResult = {
23
23
  status: "failed";
24
24
  diagnostic: string;
25
25
  };
26
- export declare function normalizeMinimizedSaveResultForTests(value: unknown, _originalText?: string): BashArtifactSaveResult;
26
+ export declare function normalizeMinimizedSaveResultForTests(value: BashMinimizedSaveReturn, originalText: string): BashArtifactSaveResult;
27
27
  export interface BashExecutorOptions {
28
28
  /**
29
29
  * Invoked when the native minimizer rewrote the command's output, giving
@@ -80,18 +80,16 @@ export interface BashResult {
80
80
  outputBytes: number;
81
81
  artifactId?: string;
82
82
  artifactTruncatedBytes?: number;
83
- /** Bytes dropped before the Bash executor received the native output stream. */
84
- sourceTruncatedBytes?: number;
85
- /** Exact source capture completeness could not be proven. */
86
- sourceCaptureIncomplete?: boolean;
87
83
  artifactFailureDiagnostic?: string;
88
84
  }
89
- /** Number of persistent and retiring shell sessions currently retained (owner gauge). */
85
+ /** Number of persistent shell sessions currently retained (owner gauge). */
90
86
  export declare function getShellSessionCount(): number;
91
87
  /**
92
- * Dispose all persistent shell sessions without waiting forever on a native
93
- * abort that failed to settle. Quarantine entries are owner-scoped so a late
94
- * finalizer cannot erase a successor shell's quarantine.
88
+ * Dispose all persistent shell sessions: abort in-flight work and drop the
89
+ * strong references so the native shells can be finalized. Healthy persistent
90
+ * sessions are otherwise retained for the whole process lifetime (MEM-7). This
91
+ * is registered as a postmortem cleanup so shutdown/signals release native
92
+ * shell resources, and is also callable directly (e.g. on owner teardown).
95
93
  */
96
94
  export declare function disposeAllShellSessions(): Promise<void>;
97
95
  /** Translate `ShellMinimizerSettings` into native `MinimizerOptions`, or `undefined` when disabled. */
@@ -3,7 +3,6 @@ import { type RepositoryBinding } from "./repository-binding";
3
3
  import { type CriticVerdict } from "./ultragoal-receipt-freshness";
4
4
  export { CRITIC_GATE_HARD_STOP_EVENT, CRITIC_GATE_OVERRIDE_EVENT, CRITIC_VERDICT_EVENT, type CriticVerdict, computeUltragoalPlanGeneration, countTerminalCriticVerdicts, receiptRelevantGoals, TERMINAL_CRITIC_CEILING, terminalCriticCeilingReached, terminalCriticGateOverridden, } from "./ultragoal-receipt-freshness";
5
5
  export { captureUltragoalRecoverySnapshot, parseStrictTerminalTranscript, persistUltragoalRecoveryDecision, planUltragoalOwnerLossRecovery, type UltragoalOwnerLossReceipt, type UltragoalRecoveryBinding, type UltragoalRecoveryDecision, type UltragoalRecoverySnapshot, validateOwnerLossBinding, validateRawUltragoalEvidence, validateRecoveryAdmission, validateRecoveryPath, } from "./ultragoal-owner-loss-recovery";
6
- import { createReviewSourceDispatch, type ReviewDeliveryDisposition, type ReviewSourceCohort, type ReviewSourceLane } from "./ultragoal-review-source";
7
6
  export type UltragoalGjcGoalMode = "aggregate" | "per-story";
8
7
  export type UltragoalGoalStatus = "pending" | "active" | "complete" | "failed" | "blocked" | "review_blocked" | "superseded";
9
8
  export interface UltragoalValidationBatchMetadata extends JsonObject {
@@ -43,7 +42,6 @@ export interface UltragoalPlan {
43
42
  goals: UltragoalGoal[];
44
43
  /** Authoritative repository identity for multi-repo fail-closed spawn (#2901). */
45
44
  repositoryBinding?: RepositoryBinding;
46
- reviewCohorts?: ReviewSourceCohort[];
47
45
  createdAt: string;
48
46
  updatedAt: string;
49
47
  [key: string]: unknown;
@@ -377,40 +375,6 @@ export declare function addUltragoalSubgoal(input: {
377
375
  evidence: string;
378
376
  rationale: string;
379
377
  }): Promise<UltragoalPlan>;
380
- export declare function validateUltragoalReviewDispatch(input: {
381
- cwd: string;
382
- dispatchId: string;
383
- cohortId: string;
384
- taskId: string;
385
- lane: ReviewSourceLane;
386
- snapshotId: string;
387
- generation: number;
388
- repositoryBindingDigest: string;
389
- stateRevision: number;
390
- rerunCommand: string;
391
- taskSourceTaskId: string;
392
- createdAt: string;
393
- }): Promise<void>;
394
- export declare function freezeUltragoalReviewCohort(input: {
395
- cwd: string;
396
- workflow?: "ultragoal" | "ralplan";
397
- }): Promise<ReviewSourceCohort>;
398
- export declare function dispatchUltragoalReviewLane(input: {
399
- cwd: string;
400
- cohortId: string;
401
- taskId: string;
402
- lane: ReviewSourceLane;
403
- rerunCommand: string;
404
- }): Promise<ReturnType<typeof createReviewSourceDispatch>>;
405
- export declare function classifyUltragoalReviewDelivery(input: {
406
- cwd: string;
407
- cohortId: string;
408
- dispatchId: string;
409
- observedDisposition: ReviewDeliveryDisposition;
410
- }): Promise<{
411
- disposition: ReviewDeliveryDisposition;
412
- deliveryId: string;
413
- }>;
414
378
  export declare function recordUltragoalReviewBlockers(input: {
415
379
  cwd: string;
416
380
  goalId: string;
@@ -1,8 +1,3 @@
1
- /**
2
- * Shared helpers for internal-url protocol handlers that resolve session-scoped
3
- * artifact IDs.
4
- */
5
- import { type RecoveryFsRoot } from "@gajae-code/natives";
6
1
  import type { ResolveContext } from "./types";
7
2
  /**
8
3
  * Snapshot of artifacts dirs explicitly authorized for the calling session.
@@ -14,16 +9,3 @@ import type { ResolveContext } from "./types";
14
9
  * not an authorization source.
15
10
  */
16
11
  export declare function authorizedArtifactsDirsFromContext(context?: ResolveContext): string[];
17
- export interface AuthorizedArtifactsRoot {
18
- readonly directory: string;
19
- readonly dev: bigint;
20
- readonly ino: bigint;
21
- readonly authority: RecoveryFsRoot;
22
- }
23
- export interface AuthorizedArtifactSnapshot {
24
- bytes: Buffer;
25
- size: number;
26
- }
27
- export declare function openAuthorizedArtifactsRoot(directory: string): AuthorizedArtifactsRoot;
28
- export declare function closeAuthorizedArtifactsRoot(root: AuthorizedArtifactsRoot): void;
29
- export declare function readAuthorizedArtifactFile(root: AuthorizedArtifactsRoot, filename: string, maxBytes: number): AuthorizedArtifactSnapshot | null;
@@ -21,9 +21,7 @@ export type ChatDaemonAction = "stop" | "reload";
21
21
  * daemon transports. Generation 16 applies Telegram sound-policy configuration
22
22
  * through shared notification parsing. Generation 17 bound managed-session
23
23
  * replacement to exact native filesystem authority; generation 18 retired that
24
- * binding, generation 19 bound exact cleanup to parent/link-count authority,
25
- * generation 20 refreshed retained cleanup semantics, and generation 21 hardens
26
- * exact Bash process-tree ownership shared by chat daemon cleanup.
24
+ * binding, and generation 19 binds exact cleanup to parent/link-count authority.
27
25
  */
28
26
  export declare const CHAT_DAEMON_GENERATIONS: Readonly<Record<ChatDaemonKind, number>>;
29
27
  export declare function chatDaemonGeneration(kind: ChatDaemonKind): number;
@@ -47,11 +47,9 @@ export declare const NOTIFICATION_PROTOCOL_VERSION = 3;
47
47
  * user-created topic adoption (forum-topic folder picker). Generation 36 bound
48
48
  * managed-session replacement to exact native filesystem authority; generation
49
49
  * 37 retires that binding (revert of #3489, which stalled POSIX artifact
50
- * cleanup); generation 38 binds exact cleanup to parent and link-count authority;
51
- * generation 39 hardens exact Bash process-tree ownership, settlement, and
52
- * descendant cleanup authority.
50
+ * cleanup); generation 38 binds exact cleanup to parent and link-count authority.
53
51
  */
54
- export declare const DAEMON_GENERATION = 39;
52
+ export declare const DAEMON_GENERATION = 38;
55
53
  /**
56
54
  * Serving-compatibility boundary for daemon lifecycle requests. Epoch 1 covers
57
55
  * all builds published before this field existed; epoch 2 covered generation 29;
@@ -1,26 +1,17 @@
1
1
  import { type EventFrame, SessionEventStream } from "./events";
2
- import { type ProviderLease, ReverseLeaseRuntime } from "./reverse-leases";
2
+ import { ReverseLeaseRuntime } from "./reverse-leases";
3
3
  import type { BrokerIndexWriter, HostEndpointAdapters, SdkFrame } from "./types";
4
4
  export type SdkRequestObserver = (kind: "control" | "query", connectionId: string, frame: SdkFrame) => void;
5
- export interface ProviderLeaseIdentity {
6
- leaseId: string;
7
- connectionId: string;
8
- connectionGeneration: number;
9
- fence: string;
10
- }
11
- export type ProviderLeaseFence = (identity: ProviderLeaseIdentity, reason?: string) => boolean;
12
5
  export interface SessionSdkHostOptions extends HostEndpointAdapters {
13
6
  control?: (connectionId: string, frame: SdkFrame) => unknown | Promise<unknown>;
14
7
  query?: (connectionId: string, frame: SdkFrame) => unknown | Promise<unknown>;
15
8
  /** Best-effort diagnostic observation of accepted control/query frames. */
16
9
  onRequest?: SdkRequestObserver;
17
- onFrameOverflow?: (connectionId: string) => void;
18
10
  /** Runs before a control response is sent; identity transitions use sendTerminal. */
19
11
  beforeControlResponse?: (connectionId: string, request: SdkFrame, response: SdkFrame, sendTerminal: () => Promise<void>) => void | Promise<void>;
20
12
  /** Runs only after a successful control response has been sent to the client. */
21
13
  afterControlResponse?: (connectionId: string, request: SdkFrame, response: SdkFrame) => void | Promise<void>;
22
- onProviderLeaseRegistered?: (lease: ProviderLease, connectionGeneration: number) => void;
23
- installProviderDefinitions?: (capability: string, definitions: unknown, leaseId: string, connectionId: string, connectionGeneration: number) => void;
14
+ installProviderDefinitions?: (capability: string, definitions: unknown) => void;
24
15
  onProviderDefinitionsRemoved?: (capability: string) => void;
25
16
  onReverseCancel?: (requestId: string, reason: "provider_disconnected" | "lease_released") => void;
26
17
  /** Best-effort capabilities mirrored from the native transport for out-of-band consumers. */
@@ -38,20 +29,8 @@ export declare class SessionSdkHost {
38
29
  get generation(): number;
39
30
  /** Current installed definitions for a live provider capability. */
40
31
  getProviderDefinitions(capability: string): unknown | undefined;
41
- /** Mark a transport connection live and return its stable generation. */
42
- handleConnect(connectionId: string): number;
43
- /** Current generation for a transport connection, if it has been observed. */
44
- connectionGeneration(connectionId: string): number;
45
- isConnectionOpen(connectionId: string, generation?: number): boolean;
46
32
  /** Release reverse leases after the transport reports a WebSocket disconnect. */
47
33
  handleDisconnect(connectionId: string): void;
48
- /**
49
- * Fences one exact provider lease after uncertain terminal cleanup. The fence
50
- * is idempotent for the same identity and never affects a newer generation.
51
- */
52
- quarantineProviderLease(identity: ProviderLeaseIdentity, _reason?: string): boolean;
53
- /** Dispatch a frame through bounded per-connection asynchronous admission. */
54
- dispatchFrame(connectionId: string, frame: SdkFrame): Promise<void>;
55
34
  /** Adds an event to the resumable event ring. Transport delivery is owned by bus wiring. */
56
35
  emitEvent(frame: SdkFrame): EventFrame;
57
36
  start(): Promise<"started" | "already">;
@@ -3,10 +3,7 @@ export declare const REVERSE_HEARTBEAT_MS = 5000;
3
3
  export declare const REVERSE_LEASE_TTL_MS = 15000;
4
4
  export declare const REVERSE_RECLAIM_GRACE_MS = 15000;
5
5
  export declare const MAX_REVERSE_OUTSTANDING = 64;
6
- export declare const MAX_REVERSE_CLEANUP_OUTSTANDING = 2;
7
6
  export declare const MAX_REVERSE_PAYLOAD_BYTES: number;
8
- export declare const MAX_REVERSE_TERMINAL_OUTPUT_BYTES: number;
9
- export declare const MAX_REVERSE_TERMINAL_OUTPUT_PAYLOAD_BYTES: number;
10
7
  export declare class ReverseLeaseError extends Error {
11
8
  readonly code: "lease_unavailable" | "lease_expired" | "provider_lease_conflict" | "provider_required" | "not_lease_owner" | "payload_too_large" | "too_many_outstanding" | "unknown_request" | "idempotency_conflict";
12
9
  constructor(code: "lease_unavailable" | "lease_expired" | "provider_lease_conflict" | "provider_required" | "not_lease_owner" | "payload_too_large" | "too_many_outstanding" | "unknown_request" | "idempotency_conflict", message?: "idempotency_conflict" | "lease_expired" | "lease_unavailable" | "not_lease_owner" | "payload_too_large" | "provider_lease_conflict" | "provider_required" | "too_many_outstanding" | "unknown_request");
@@ -24,7 +21,7 @@ export interface ReverseLeaseOptions {
24
21
  now?: () => number;
25
22
  leaseTtlMs?: number;
26
23
  sendFrame: (connectionId: string, frame: SdkFrame) => void | Promise<void>;
27
- installDefinitions?: (capability: string, definitions: unknown, leaseId: string, connectionId: string, connectionGeneration: number) => void;
24
+ installDefinitions?: (capability: string, definitions: unknown) => void;
28
25
  onCancel?: (requestId: string, reason: "provider_disconnected" | "lease_released") => void;
29
26
  onDefinitionsRemoved?: (capability: string) => void;
30
27
  }
@@ -32,15 +29,15 @@ export interface ReverseLeaseOptions {
32
29
  export declare class ReverseLeaseRuntime {
33
30
  #private;
34
31
  constructor(options: ReverseLeaseOptions);
35
- registerProvider(connectionId: string, capability: string, definitions: unknown, expectedLeaseId?: string, idempotencyKey?: string, connectionGeneration?: number): ProviderLease;
32
+ registerProvider(connectionId: string, capability: string, definitions: unknown, expectedLeaseId?: string, idempotencyKey?: string): ProviderLease;
36
33
  heartbeat(connectionId: string, leaseId: string): ProviderLease;
37
34
  release(connectionId: string, leaseId: string, handoffTo?: string): ProviderLease;
38
35
  disconnect(connectionId: string): void;
39
- request(capability: string, method: string, payload: unknown, signal?: AbortSignal, expectedLeaseId?: string, cleanup?: boolean, expectedConnectionId?: string): Promise<unknown>;
36
+ request(capability: string, method: string, payload: unknown, signal?: AbortSignal): Promise<unknown>;
40
37
  respond(connectionId: string, id: string, leaseId: string, result: unknown, error?: {
41
38
  code: string;
42
39
  message: string;
43
- }, wireEnvelope?: unknown): void;
40
+ }): void;
44
41
  getLease(capability: string): ProviderLease | undefined;
45
42
  /** Installed definitions are observable only while their provider lease is live. */
46
43
  getInstalledDefinitions(capability: string): unknown | undefined;
@@ -16,11 +16,6 @@ export interface ManagedOutputGeneration {
16
16
  export interface ArtifactSaveOptions {
17
17
  maxBytes?: number;
18
18
  }
19
- export interface ArtifactSaveReceipt {
20
- id: string;
21
- complete: boolean;
22
- omittedBytes?: number;
23
- }
24
19
  /**
25
20
  * Manages artifact storage for a session.
26
21
  *
@@ -73,9 +68,11 @@ export declare class ArtifactManager {
73
68
  id: string;
74
69
  path?: string;
75
70
  }>;
76
- /** Save content and return the artifact ID plus exact storage completeness evidence. */
77
- saveWithReceipt(content: string, toolType: string, options?: ArtifactSaveOptions): Promise<ArtifactSaveReceipt>;
78
- /** Save content as an artifact and return the artifact ID. */
71
+ /**
72
+ * Save content as an artifact and return the artifact ID.
73
+ * Content is written to a private temporary inode, synced, and linked into
74
+ * the artifact directory only after the complete terminal payload exists.
75
+ */
79
76
  save(content: string, toolType: string, options?: ArtifactSaveOptions): Promise<string>;
80
77
  /**
81
78
  * Check if an artifact exists.
@@ -55,23 +55,12 @@ 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;
60
58
  waitForExit(): Promise<ClientBridgeTerminalExitStatus>;
61
59
  currentOutput(): Promise<ClientBridgeTerminalOutput>;
62
60
  kill(): Promise<void>;
63
61
  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;
72
62
  }
73
63
  export interface ClientBridgeCreateTerminalParams {
74
- toolCallId: string;
75
64
  command: string;
76
65
  args?: string[];
77
66
  env?: Array<{
@@ -80,7 +69,6 @@ export interface ClientBridgeCreateTerminalParams {
80
69
  }>;
81
70
  cwd?: string;
82
71
  outputByteLimit?: number;
83
- signal?: AbortSignal;
84
72
  }
85
73
  export interface ClientBridge {
86
74
  readonly capabilities: ClientBridgeCapabilities;
@@ -96,7 +84,5 @@ export interface ClientBridge {
96
84
  content: string;
97
85
  }): Promise<void>;
98
86
  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>;
101
87
  requestPermission?(toolCall: ClientBridgePermissionToolCall, options: ClientBridgePermissionOption[], signal?: AbortSignal): Promise<ClientBridgePermissionOutcome>;
102
88
  }
@@ -63,8 +63,6 @@ export declare class ManagedSessionDescendantStore {
63
63
  get rootAuthority(): ManagedDirectoryRoot;
64
64
  get subtreeRootAuthority(): ManagedDirectoryRoot;
65
65
  get securityPolicy(): ManagedSessionSecurityPolicy;
66
- get hasRetainedAuthority(): boolean;
67
- acquireMutationFence(name: string): Promise<ManagedStorageLock | undefined>;
68
66
  get profileAgentDir(): string;
69
67
  deriveSubtree(relativePath: string): ManagedSessionDescendantStore;
70
68
  retainAuthority(): RecoveryFsRoot | undefined;
@@ -79,7 +77,6 @@ export declare class ManagedSessionDescendantStore {
79
77
  publishNoReplace(relativePath: string, bytes: Uint8Array): Promise<void>;
80
78
  publishNoReplaceSync(relativePath: string, bytes: Uint8Array): void;
81
79
  replace(relativePath: string, bytes: Uint8Array): Promise<void>;
82
- replaceExpected(relativePath: string, bytes: Uint8Array, expected: ManagedFileSnapshot): void;
83
80
  replaceSync(relativePath: string, bytes: Uint8Array): void;
84
81
  appendSync(relativePath: string, bytes: Uint8Array): void;
85
82
  /** Read an exact managed file without exposing its pathname as authority. */
@@ -107,9 +104,9 @@ export declare function captureManagedFilePrefixNoFollow(pathname: string, maxBy
107
104
  export declare function captureManagedFileNoFollow(pathname: string): ManagedFileSnapshot;
108
105
  /** Atomically publishes bytes without replacing an existing destination. */
109
106
  export declare function publishManagedFileNoReplace(destination: string, bytes: Uint8Array, assertOwned?: () => void, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
110
- export declare function publishManagedFileNoReplaceSync(destination: string, bytes: Uint8Array, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy, assertOwned?: () => void): void;
107
+ export declare function publishManagedFileNoReplaceSync(destination: string, bytes: Uint8Array, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
111
108
  /** 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;
109
+ export declare function replaceManagedFileSync(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
113
110
  export declare function replaceManagedFile(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
114
111
  /** Copy the exact bytes captured from one no-follow source descriptor. */
115
112
  export declare function copyManagedFileNoReplace(source: string, destination: string, snapshot?: ManagedFileSnapshot, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
@@ -73,10 +73,7 @@ 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, options?: {
77
- maxInlineBytes?: number;
78
- fullOutput?: boolean;
79
- }): string;
76
+ export declare function createPreAdmissionArtifactSpillPreview(fullText: string, artifactId: string, digest: string): string;
80
77
  /**
81
78
  * Message type for bash executions via the ! command.
82
79
  */
@@ -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, type ArtifactSaveReceipt } from "./artifacts";
7
+ import { ArtifactManager } 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";
@@ -485,7 +485,7 @@ export interface ReadonlySessionManager {
485
485
  /** Creates an immutable facade that never exposes SessionManager mutation authority. */
486
486
  export declare function createReadonlySessionManager(manager: SessionManager): ReadonlySessionManager;
487
487
  /** Internal artifact-writing capability. Read-only facades expose it only through a private weak-map lookup. */
488
- export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "getArtifactPath" | "putBlob">>;
488
+ export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "putBlob">>;
489
489
  /**
490
490
  * Returns the artifact capability for a concrete persistence owner or one of its
491
491
  * immutable read-only facades. Structural lookalikes remain unauthorized.
@@ -757,11 +757,10 @@ export declare class SessionManager {
757
757
  path?: string;
758
758
  }>;
759
759
  /**
760
- * Save artifact content under the current persisted session and return its artifact ID.
761
- * In-memory sessions cannot produce protocol-resolvable artifact references.
760
+ * Save artifact content under the current session and return artifact ID.
761
+ * Returns an artifact ID for all sessions (file-backed for persistent, in-memory fallback otherwise).
762
762
  */
763
763
  saveArtifact(content: string, toolType: string): Promise<string | undefined>;
764
- saveArtifactReceipt(content: string, toolType: string): Promise<ArtifactSaveReceipt | undefined>;
765
764
  /**
766
765
  * Resolve an artifact ID to an on-disk path for the current session.
767
766
  * Returns null when missing or when the session is not persisted.
@@ -37,40 +37,17 @@ 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;
53
40
  /** Bytes dropped by the per-line column cap (sum across all lines). */
54
41
  columnDroppedBytes?: number;
55
42
  /** Number of distinct lines that hit the per-line column cap. */
56
43
  columnTruncatedLines?: number;
57
- /** Configured per-line byte/column cap that caused visible omission. */
58
- columnMax?: number;
59
44
  /** Artifact ID for internal URL access (artifact://<id>) when output was persisted. */
60
45
  artifactId?: string;
61
- /** Artifact existence was proven by successful publication or file finalization. */
62
- artifactVerified?: boolean;
63
46
  /** Bytes omitted from artifact storage after the artifact hard cap was reached. */
64
47
  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;
69
48
  /** Bounded diagnostic when artifact writer or terminal publisher creation, write, finalization, or publication failed. */
70
49
  artifactFailureDiagnostic?: string;
71
50
  }
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;
74
51
  export interface OutputSinkOptions {
75
52
  /**
76
53
  * Deprecated managed artifact pathname. Bare paths are deliberately ignored:
@@ -135,16 +112,7 @@ export interface TruncationResult {
135
112
  elidedBytes?: number;
136
113
  /** Lines elided from the middle (truncateMiddle only). */
137
114
  elidedLines?: number;
138
- headRange?: {
139
- start: number;
140
- end: number;
141
- };
142
- tailRange?: {
143
- start: number;
144
- end: number;
145
- };
146
115
  lastLinePartial?: boolean;
147
- firstLinePartial?: boolean;
148
116
  firstLineExceedsLimit?: boolean;
149
117
  lastLineExceedsLimit?: boolean;
150
118
  }
@@ -43,6 +43,7 @@ export interface TaskResultReceipt {
43
43
  summary: string;
44
44
  };
45
45
  errorSummary?: string;
46
+ duplicateDisposition?: SingleResult["duplicateDisposition"];
46
47
  abortSummary?: string;
47
48
  preview: string;
48
49
  previewTruncated: boolean;
@@ -70,8 +71,6 @@ export interface TaskResultReceipt {
70
71
  forkContextAdvisory?: SingleResult["forkContextAdvisory"];
71
72
  /** Resolved repository identity for this delegated lane (#2901). */
72
73
  repositoryBinding?: SingleResult["repositoryBinding"];
73
- /** Runtime-derived review source disposition and rerun guidance (#3469). */
74
- reviewSource?: SingleResult["reviewSource"];
75
74
  roi?: TaskRoi;
76
75
  }
77
76
  /**