@gajae-code/coding-agent 0.12.6 → 0.12.8

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 (150) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/dist/types/async/job-manager.d.ts +36 -1
  3. package/dist/types/commands/notify.d.ts +4 -0
  4. package/dist/types/config/file-lock.d.ts +3 -0
  5. package/dist/types/config/model-discovery-manager.d.ts +6 -1
  6. package/dist/types/config/model-registry.d.ts +2 -0
  7. package/dist/types/config/resolve-config-value.d.ts +2 -1
  8. package/dist/types/config/settings-schema.d.ts +17 -1
  9. package/dist/types/eval/backend.d.ts +2 -2
  10. package/dist/types/exec/bash-executor.d.ts +8 -10
  11. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +0 -36
  12. package/dist/types/internal-urls/registry-helpers.d.ts +0 -18
  13. package/dist/types/main.d.ts +1 -0
  14. package/dist/types/modes/components/hook-selector.d.ts +20 -0
  15. package/dist/types/modes/components/notifications-settings-editor.d.ts +53 -4
  16. package/dist/types/modes/controllers/extension-ui-controller.d.ts +1 -1
  17. package/dist/types/modes/controllers/selector-controller.d.ts +4 -2
  18. package/dist/types/sdk/broker/broker.d.ts +5 -1
  19. package/dist/types/sdk/broker/lifecycle-ledger.d.ts +1 -0
  20. package/dist/types/sdk/bus/chat-daemon-control.d.ts +11 -3
  21. package/dist/types/sdk/bus/config.d.ts +75 -113
  22. package/dist/types/sdk/bus/discord-live-provider.d.ts +8 -2
  23. package/dist/types/sdk/bus/discord-provider.d.ts +19 -0
  24. package/dist/types/sdk/bus/index.d.ts +1 -1
  25. package/dist/types/sdk/bus/notification-orchestration.d.ts +127 -18
  26. package/dist/types/sdk/bus/notification-service.d.ts +31 -4
  27. package/dist/types/sdk/bus/session-control.d.ts +8 -3
  28. package/dist/types/sdk/bus/slack-live-provider.d.ts +9 -2
  29. package/dist/types/sdk/bus/slack-provider.d.ts +22 -0
  30. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +9 -4
  31. package/dist/types/sdk/client/discovery.d.ts +2 -1
  32. package/dist/types/sdk/host/host.d.ts +2 -23
  33. package/dist/types/sdk/host/query/handlers.d.ts +2 -0
  34. package/dist/types/sdk/host/reverse-leases.d.ts +4 -7
  35. package/dist/types/sdk/index.d.ts +1 -0
  36. package/dist/types/sdk/providers.d.ts +22 -0
  37. package/dist/types/sdk/session-directory.d.ts +1 -1
  38. package/dist/types/session/artifacts.d.ts +5 -8
  39. package/dist/types/session/client-bridge.d.ts +0 -14
  40. package/dist/types/session/internal/managed-session-scope.d.ts +17 -1
  41. package/dist/types/session/internal/managed-session-storage.d.ts +11 -4
  42. package/dist/types/session/internal/native-publish-outcome.d.ts +1 -0
  43. package/dist/types/session/internal/session-open-errors.d.ts +5 -0
  44. package/dist/types/session/messages.d.ts +1 -4
  45. package/dist/types/session/session-manager.d.ts +7 -6
  46. package/dist/types/session/session-storage.d.ts +2 -0
  47. package/dist/types/session/streaming-output.d.ts +0 -32
  48. package/dist/types/task/receipt.d.ts +1 -2
  49. package/dist/types/task/types.d.ts +43 -178
  50. package/dist/types/tools/bash.d.ts +1 -1
  51. package/dist/types/tools/fetch.d.ts +0 -3
  52. package/dist/types/tools/output-meta.d.ts +5 -37
  53. package/dist/types/tools/subagent.d.ts +15 -0
  54. package/dist/types/tools/todo-write.d.ts +3 -0
  55. package/dist/types/tools/tool-result.d.ts +0 -1
  56. package/package.json +10 -8
  57. package/scripts/build-sdk-package-smoke.ts +51 -0
  58. package/scripts/capture-notifications-settings-showcase.ts +1 -1
  59. package/src/async/job-manager.ts +430 -46
  60. package/src/cli/notify-cli.ts +204 -94
  61. package/src/commands/notify.ts +19 -8
  62. package/src/config/file-lock.ts +6 -0
  63. package/src/config/model-discovery-manager.ts +50 -8
  64. package/src/config/model-registry.ts +862 -75
  65. package/src/config/resolve-config-value.ts +10 -8
  66. package/src/config/settings-schema.ts +25 -15
  67. package/src/config/settings.ts +15 -15
  68. package/src/cursor.ts +13 -20
  69. package/src/defaults/gjc/skills/ultragoal/SKILL.md +2 -3
  70. package/src/eval/backend.ts +2 -2
  71. package/src/exec/bash-executor.ts +151 -425
  72. package/src/gjc-runtime/session-state-sidecar.ts +12 -2
  73. package/src/gjc-runtime/ultragoal-runtime.ts +3 -280
  74. package/src/gjc-runtime/workflow-manifest.generated.json +1 -40
  75. package/src/gjc-runtime/workflow-manifest.ts +0 -12
  76. package/src/internal-urls/agent-protocol.ts +38 -98
  77. package/src/internal-urls/artifact-protocol.ts +17 -28
  78. package/src/internal-urls/docs-index.generated.ts +7 -7
  79. package/src/internal-urls/registry-helpers.ts +0 -62
  80. package/src/main.ts +43 -7
  81. package/src/modes/DESIGN.md +11 -11
  82. package/src/modes/acp/acp-agent.ts +0 -24
  83. package/src/modes/acp/acp-client-bridge.ts +11 -154
  84. package/src/modes/components/hook-selector.ts +155 -44
  85. package/src/modes/components/model-selector.ts +242 -49
  86. package/src/modes/components/notifications-settings-editor.ts +631 -85
  87. package/src/modes/controllers/extension-ui-controller.ts +114 -15
  88. package/src/modes/controllers/selector-controller.ts +464 -50
  89. package/src/prompts/tools/bash.md +2 -2
  90. package/src/sdk/acp/adapter.ts +9 -200
  91. package/src/sdk/broker/broker.ts +54 -10
  92. package/src/sdk/broker/lifecycle-ledger.ts +34 -1
  93. package/src/sdk/broker/lifecycle.ts +47 -50
  94. package/src/sdk/bus/chat-daemon-cli.ts +12 -5
  95. package/src/sdk/bus/chat-daemon-control.ts +35 -8
  96. package/src/sdk/bus/chat-daemon-runtime.ts +16 -2
  97. package/src/sdk/bus/config.ts +534 -286
  98. package/src/sdk/bus/discord-live-provider.ts +57 -2
  99. package/src/sdk/bus/discord-provider.ts +21 -0
  100. package/src/sdk/bus/index.ts +105 -359
  101. package/src/sdk/bus/notification-orchestration.ts +371 -68
  102. package/src/sdk/bus/notification-service.ts +431 -130
  103. package/src/sdk/bus/session-control.ts +119 -44
  104. package/src/sdk/bus/slack-live-provider.ts +78 -2
  105. package/src/sdk/bus/slack-provider.ts +24 -0
  106. package/src/sdk/bus/telegram-daemon-cli.ts +9 -2
  107. package/src/sdk/bus/telegram-daemon-contract.ts +9 -4
  108. package/src/sdk/bus/telegram-daemon-control.ts +3 -3
  109. package/src/sdk/bus/telegram-daemon.ts +23 -15
  110. package/src/sdk/client/discovery.ts +10 -4
  111. package/src/sdk/host/host.ts +9 -187
  112. package/src/sdk/host/query/handlers.ts +20 -1
  113. package/src/sdk/host/reverse-leases.ts +42 -249
  114. package/src/sdk/index.ts +1 -0
  115. package/src/sdk/protocol/operation-inventory.generated.json +18 -0
  116. package/src/sdk/protocol/operation-registry.ts +5 -2
  117. package/src/sdk/providers.ts +51 -0
  118. package/src/sdk/session-directory.ts +1 -0
  119. package/src/sdk/session.ts +10 -7
  120. package/src/session/agent-session.ts +59 -202
  121. package/src/session/artifacts.ts +74 -211
  122. package/src/session/client-bridge.ts +0 -15
  123. package/src/session/internal/managed-session-scope.ts +981 -450
  124. package/src/session/internal/managed-session-storage.ts +362 -124
  125. package/src/session/internal/native-publish-outcome.ts +3 -1
  126. package/src/session/internal/session-open-errors.ts +11 -0
  127. package/src/session/messages.ts +7 -32
  128. package/src/session/session-manager.ts +48 -15
  129. package/src/session/session-storage.ts +72 -5
  130. package/src/session/streaming-output.ts +40 -198
  131. package/src/slash-commands/builtin-registry.ts +82 -4
  132. package/src/task/index.ts +237 -65
  133. package/src/task/receipt.ts +2 -4
  134. package/src/task/render.ts +0 -30
  135. package/src/task/types.ts +10 -34
  136. package/src/tools/ask.ts +1 -1
  137. package/src/tools/bash.ts +239 -818
  138. package/src/tools/eval.ts +4 -99
  139. package/src/tools/fetch.ts +15 -77
  140. package/src/tools/find.ts +3 -7
  141. package/src/tools/output-meta.ts +114 -696
  142. package/src/tools/search.ts +4 -9
  143. package/src/tools/subagent.ts +97 -75
  144. package/src/tools/telegram-send.ts +4 -2
  145. package/src/tools/todo-write.ts +47 -0
  146. package/src/tools/tool-result.ts +0 -1
  147. package/dist/types/gjc-runtime/ultragoal-review-source.d.ts +0 -83
  148. package/dist/types/utils/artifact-id.d.ts +0 -2
  149. package/src/gjc-runtime/ultragoal-review-source.ts +0 -378
  150. package/src/utils/artifact-id.ts +0 -6
@@ -1,4 +1,4 @@
1
- import { type NotificationConfig } from "./config";
1
+ import { type GenericNotificationSessionSource, type NotificationConfig } from "./config";
2
2
  /** Minimal session-manager surface shared by extension, TUI, and headless hosts. */
3
3
  export interface NotificationSessionContext {
4
4
  sessionManager: {
@@ -29,6 +29,8 @@ export interface NotificationSessionRuntime<Context extends NotificationSessionC
29
29
  * emit a frame. `blocked_identity` is fail-closed and starts nothing.
30
30
  */
31
31
  ensureTelegramDaemon?(binding: BoundNotificationSession<Context>): Promise<TelegramDaemonPreflightResult>;
32
+ /** Rotates a running/default endpoint into Telegram-isolated chat scope. */
33
+ isolateTelegram?(binding: BoundNotificationSession<Context>): Promise<NotificationEndpointStartResult>;
32
34
  /** Refresh mutable delivery policy from the same configuration snapshot used for reconciliation. */
33
35
  refreshPolicy?(binding: BoundNotificationSession<Context>, policy: NotificationRuntimePolicy): void;
34
36
  /** Enables delivery only after the controller has committed a stable policy. */
@@ -37,9 +39,9 @@ export interface NotificationSessionRuntime<Context extends NotificationSessionC
37
39
  export interface NotificationSessionStatus {
38
40
  eligible: boolean;
39
41
  locallyEnabled: boolean;
40
- effectiveEnabled: boolean;
42
+ genericSessionEnabled: boolean;
43
+ genericEligibilitySource: GenericNotificationSessionSource;
41
44
  running: boolean;
42
- environment: "off" | "explicit" | "token" | "default";
43
45
  }
44
46
  export interface NotificationSessionReconcileResult {
45
47
  outcome: NotificationEndpointStartResult | "stopped";
@@ -48,6 +50,7 @@ export interface NotificationSessionReconcileResult {
48
50
  export interface NotificationRuntimePolicy {
49
51
  redact: boolean;
50
52
  verbosity: NotificationConfig["verbosity"];
53
+ /** Generic live-frame delivery policy; never proof of provider effectiveness. */
51
54
  stream: boolean;
52
55
  mode: "provisional" | "committed";
53
56
  }
@@ -58,6 +61,8 @@ export interface NotificationSessionControllerOptions {
58
61
  getConfig(): NotificationConfig;
59
62
  /** Kept as a reference so test and embedding hosts can supply their own environment. */
60
63
  env?: NodeJS.ProcessEnv;
64
+ /** This process was launched by a marked GJC child spawn site. */
65
+ spawnedByGjc?: boolean;
61
66
  }
62
67
  export declare class NotificationSessionController {
63
68
  #private;
@@ -1,4 +1,4 @@
1
- import type { SlackMessageSearchResult, SlackPostedMessage, SlackProviderClient, SlackSocketEnvelope } from "./slack-provider";
1
+ import type { SlackConfigurationProbeResult, SlackDiagnosticProvider, SlackMessageSearchResult, SlackOneShotTestResult, SlackPostedMessage, SlackProviderClient, SlackSocketEnvelope } from "./slack-provider";
2
2
  export type SlackProviderErrorCode = "connection" | "protocol" | "web_api" | "rate_limited";
3
3
  /** A Slack transport failure whose fields are safe to surface without credentials. */
4
4
  export declare class SlackProviderError extends Error {
@@ -38,10 +38,17 @@ export interface SlackLiveProviderOptions {
38
38
  * Production Socket Mode and Web API client. It keeps all connection state in
39
39
  * memory and deliberately never maintains a Slack cursor.
40
40
  */
41
- export declare class SlackLiveProvider implements SlackProviderClient {
41
+ export declare class SlackLiveProvider implements SlackProviderClient, SlackDiagnosticProvider {
42
42
  #private;
43
43
  get transportHealthy(): boolean;
44
44
  constructor(options: SlackLiveProviderOptions);
45
+ probeConfiguration(signal?: AbortSignal): Promise<SlackConfigurationProbeResult>;
46
+ sendOneShotTest(input: {
47
+ channel: string;
48
+ message: string;
49
+ idempotencyKey: string;
50
+ signal?: AbortSignal;
51
+ }): Promise<SlackOneShotTestResult>;
45
52
  start(onEnvelope: (envelope: SlackSocketEnvelope) => void | Promise<void>): Promise<void>;
46
53
  stop(): Promise<void>;
47
54
  ack(envelopeId: string): Promise<void>;
@@ -12,6 +12,28 @@ export interface SlackMessageSearchResult {
12
12
  ts: string;
13
13
  client_msg_id?: string;
14
14
  }
15
+ export interface SlackConfigurationProbeResult {
16
+ ok: boolean;
17
+ detail: string;
18
+ teamId?: string;
19
+ userId?: string;
20
+ }
21
+ export interface SlackOneShotTestResult {
22
+ ok: boolean;
23
+ detail: string;
24
+ channel?: string;
25
+ timestamp?: string;
26
+ uncertain?: boolean;
27
+ }
28
+ export interface SlackDiagnosticProvider {
29
+ probeConfiguration(signal?: AbortSignal): Promise<SlackConfigurationProbeResult>;
30
+ sendOneShotTest(input: {
31
+ channel: string;
32
+ message: string;
33
+ idempotencyKey: string;
34
+ signal?: AbortSignal;
35
+ }): Promise<SlackOneShotTestResult>;
36
+ }
15
37
  /** Minimal Socket Mode + Web API seam. Implementations may wrap the official Slack SDK. */
16
38
  export interface SlackProviderClient {
17
39
  start(onEnvelope: (envelope: SlackSocketEnvelope) => void | Promise<void>): Promise<void>;
@@ -47,11 +47,16 @@ 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.
51
+ * Generation 39 applies rustfmt and clippy-equivalent cleanup to the pi-shell
52
+ * process-tree authority (#3682); generation 40 hardens exact Bash process-tree
53
+ * ownership, settlement, and descendant cleanup authority. Generation 38 also
54
+ * adds durable provider-intent admission without changing owner, reclaim,
55
+ * signal, or spawn authority.
56
+ * Generation 41 applies first-class provider-settings admission to Telegram
57
+ * lifecycle controls.
53
58
  */
54
- export declare const DAEMON_GENERATION = 39;
59
+ export declare const DAEMON_GENERATION = 41;
55
60
  /**
56
61
  * Serving-compatibility boundary for daemon lifecycle requests. Epoch 1 covers
57
62
  * all builds published before this field existed; epoch 2 covered generation 29;
@@ -21,9 +21,10 @@ export declare class SdkDiscoveryError extends Error {
21
21
  readonly code = "discovery_error";
22
22
  constructor(path: string, message: string);
23
23
  }
24
+ export type SdkSessionEndpointScope = "default" | "chat";
24
25
  /** Lists endpoint files and returns individual malformed or unreadable records as warnings. */
25
26
  export declare function listSdkSessionEndpoints(repo: string): Promise<SdkSessionEndpointList>;
26
27
  /** Resolves one per-session SDK endpoint discovery file. */
27
- export declare function readSdkSessionEndpoint(repo: string, sessionId: string): Promise<SdkSessionEndpoint | null>;
28
+ export declare function readSdkSessionEndpoint(repo: string, sessionId: string, scope?: SdkSessionEndpointScope): Promise<SdkSessionEndpoint | null>;
28
29
  /** Reads the agent-global broker discovery record. */
29
30
  export declare function readSdkBrokerDiscovery(agentDir: string): Promise<BrokerDiscovery | null>;
@@ -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">;
@@ -1,3 +1,4 @@
1
+ import type { ActiveProviderDescriptor } from "../../providers.js";
1
2
  import { type CursorRegistry } from "./cursor.js";
2
3
  import type { RevisionStore } from "./revision-store.js";
3
4
  export declare const TARGET_PAGE_BYTES: number;
@@ -11,6 +12,7 @@ export interface SessionSurface {
11
12
  getUsage(): unknown | Promise<unknown>;
12
13
  getModels(): unknown | Promise<unknown>;
13
14
  getSkillState(): unknown | Promise<unknown>;
15
+ getActiveProviders?(): ActiveProviderDescriptor[] | Promise<ActiveProviderDescriptor[]>;
14
16
  /** Q12 rows preserve workflow gate fields and include stable durable gate metadata. */
15
17
  getGates(): unknown | Promise<unknown>;
16
18
  getConfigItems(): unknown | Promise<unknown>;
@@ -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;
@@ -5,5 +5,6 @@ export * as host from "./host";
5
5
  export * as mcp from "./mcp";
6
6
  export type { Q10CurrentThinkingLevel, Q10Model, Q10SettableThinkingLevel, Q10ThinkingCapabilities, Q10ThinkingEffort, Q10ThinkingMode, } from "./models";
7
7
  export * from "./prompt-status";
8
+ export type { ActiveProviderConnectionKind, ActiveProviderDescriptor } from "./providers";
8
9
  export * from "./session";
9
10
  export * from "./session-directory";
@@ -0,0 +1,22 @@
1
+ export type ActiveProviderConnectionKind = "credential" | "credentialless";
2
+ export interface ActiveProviderDescriptor {
3
+ provider: string;
4
+ connectionKind: ActiveProviderConnectionKind;
5
+ }
6
+ /**
7
+ * Project active-provider inputs to the exact public DTO shape.
8
+ *
9
+ * Connection credentials take precedence when the same provider is reported
10
+ * more than once. Provider IDs are sorted by their UTF-8 bytes without
11
+ * normalization.
12
+ */
13
+ export declare function projectActiveProviderDescriptors(descriptors: readonly {
14
+ provider: string;
15
+ connectionKind: unknown;
16
+ }[]): ActiveProviderDescriptor[];
17
+ export declare const ACTIVE_PROVIDER_RESOLUTION_ERROR_CODE: "internal";
18
+ export declare const ACTIVE_PROVIDER_RESOLUTION_ERROR_MESSAGE = "Unable to resolve active providers.";
19
+ export declare class ActiveProviderResolutionError extends Error {
20
+ readonly code: "internal";
21
+ constructor();
22
+ }
@@ -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" | "atomic_unavailable" | "durability_not_provable" | "durability_failed" | "invalid_request";
23
+ code: "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "migration_busy" | "atomic_unavailable" | "durability_not_provable" | "durability_failed" | "invalid_request";
24
24
  message: string;
25
25
  };
26
26
  export interface LogicalSessionCandidate {
@@ -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
  }
@@ -34,7 +34,7 @@ export declare function managedDirectoryIdentityForScope(scope: ManagedScope): {
34
34
  };
35
35
  export declare function managedRootForScope(scope: ManagedScope): ManagedDirectoryRoot;
36
36
  export type ManagedMigrationPolicy = "copy-retain" | "disabled";
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
+ export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "migration_busy" | "atomic_unavailable" | "invalid_request" | "durability_failed" | "durability_not_provable";
38
38
  export type ManagedScopeResolution = {
39
39
  kind: "resolved";
40
40
  scope: ManagedScope;
@@ -95,6 +95,19 @@ export type ManagedDeleteCandidateResult = {
95
95
  code: ManagedOpenFailure;
96
96
  message: string;
97
97
  };
98
+ export interface ManagedVerifiedDeleteTestEvent {
99
+ readonly flow: "direct" | "reconcile";
100
+ readonly stage: "initial" | "artifact-finalization" | "transcript-after-artifacts-removed";
101
+ }
102
+ export interface ManagedLockReleaseTestEvent {
103
+ readonly path: string;
104
+ readonly attemptId: string;
105
+ }
106
+ /** Test-only ordering seams for verified deletion and managed-lock release. */
107
+ export declare const ManagedSessionScopeTestHooks: {
108
+ beforeVerifiedDelete?: (event: ManagedVerifiedDeleteTestEvent) => void | Promise<void>;
109
+ beforeManagedLockRelease?: (event: ManagedLockReleaseTestEvent) => void | Promise<void>;
110
+ };
98
111
  declare function scopeDigest(platform: "posix" | "win32", canonicalPath: string): string;
99
112
  export declare const computeManagedScopeDigest: typeof scopeDigest;
100
113
  /**
@@ -121,6 +134,7 @@ export declare function ensureManagedScope(scope: ManagedScope, policy?: Managed
121
134
  /** Synchronously create and validate the v2 binding before a default session writer exists. */
122
135
  export declare function prepareManagedSessionScopeForWriteSync(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy, authority?: ManagedCandidateWriteAuthority): ManagedScopeResolution;
123
136
  export declare function listManagedCandidates(scope: ManagedScope): ManagedCandidateListing;
137
+ export declare function artifactTreeReplayCompatible(observed: NativeDirectoryTreeSnapshot, expected: NativeDirectoryTreeSnapshot): boolean;
124
138
  type DetachedArtifactRoot = {
125
139
  originalPath: string;
126
140
  detachedPath: string;
@@ -129,6 +143,8 @@ type DetachedArtifactRoot = {
129
143
  ino: bigint;
130
144
  size: bigint;
131
145
  mtimeNs: bigint;
146
+ parentDev: bigint;
147
+ parentIno: bigint;
132
148
  };
133
149
  tree: NativeDirectoryTreeSnapshot;
134
150
  };
@@ -25,6 +25,7 @@ export interface ManagedFileSnapshot {
25
25
  identity: {
26
26
  dev: bigint;
27
27
  ino: bigint;
28
+ nlink: bigint;
28
29
  size: number;
29
30
  mtimeNs: bigint;
30
31
  ctimeNs: bigint;
@@ -32,6 +33,14 @@ export interface ManagedFileSnapshot {
32
33
  };
33
34
  }
34
35
  export declare function validateNativeSecurityResult(value: unknown, operation: "apply" | "verify", kind: "directory" | "file"): NativeOwnerOnlySecurityResult;
36
+ export interface ManagedLockRetirementTestEvent {
37
+ readonly path: string;
38
+ readonly attemptId: string;
39
+ }
40
+ /** Test-only seam immediately before exact retirement of one observed lock identity. */
41
+ export declare const ManagedLockTestHooks: {
42
+ beforeObservedRetirement?: (event: ManagedLockRetirementTestEvent) => void;
43
+ };
35
44
  /** Captured configured-root authority for managed paths only. */
36
45
  export interface ManagedDirectoryRoot {
37
46
  readonly canonicalPath: string;
@@ -63,8 +72,6 @@ export declare class ManagedSessionDescendantStore {
63
72
  get rootAuthority(): ManagedDirectoryRoot;
64
73
  get subtreeRootAuthority(): ManagedDirectoryRoot;
65
74
  get securityPolicy(): ManagedSessionSecurityPolicy;
66
- get hasRetainedAuthority(): boolean;
67
- acquireMutationFence(name: string): Promise<ManagedStorageLock | undefined>;
68
75
  get profileAgentDir(): string;
69
76
  deriveSubtree(relativePath: string): ManagedSessionDescendantStore;
70
77
  retainAuthority(): RecoveryFsRoot | undefined;
@@ -107,9 +114,9 @@ export declare function captureManagedFilePrefixNoFollow(pathname: string, maxBy
107
114
  export declare function captureManagedFileNoFollow(pathname: string): ManagedFileSnapshot;
108
115
  /** Atomically publishes bytes without replacing an existing destination. */
109
116
  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;
117
+ export declare function publishManagedFileNoReplaceSync(destination: string, bytes: Uint8Array, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
111
118
  /** 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;
119
+ export declare function replaceManagedFileSync(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy, assertFence?: () => void, expectedDestination?: ManagedFileSnapshot["identity"]): void;
113
120
  export declare function replaceManagedFile(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
114
121
  /** Copy the exact bytes captured from one no-follow source descriptor. */
115
122
  export declare function copyManagedFileNoReplace(source: string, destination: string, snapshot?: ManagedFileSnapshot, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
@@ -20,6 +20,7 @@ export type NativePublishIdentity = {
20
20
  readonly dev: string;
21
21
  readonly ino: string;
22
22
  readonly size: string;
23
+ readonly nlink?: string;
23
24
  readonly mtimeNs: string;
24
25
  readonly ctimeNs: string;
25
26
  readonly sha256?: string;
@@ -0,0 +1,5 @@
1
+ export declare const SESSION_MIGRATION_BUSY_MESSAGE = "Another session migration is still active. Wait for it to finish, then retry.";
2
+ export declare class SessionMigrationBusyError extends Error {
3
+ readonly code = "migration_busy";
4
+ constructor();
5
+ }
@@ -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";
@@ -357,6 +357,7 @@ export declare class SessionMigrationPolicyError extends Error {
357
357
  constructor();
358
358
  }
359
359
  export declare class SessionArtifactCapacityError extends Error {
360
+ readonly code = "artifact_capacity_exceeded";
360
361
  constructor(message: string);
361
362
  }
362
363
  export type ResumeTailInspection = ResumeTailResumable | ResumeTailTerminal | ResumeTailError;
@@ -366,7 +367,7 @@ export interface StrictSessionOpenSuccess {
366
367
  }
367
368
  export interface StrictSessionOpenFailure {
368
369
  kind: "error";
369
- reason: ResumeTailError["reason"] | "identity-mismatch" | "migration-required" | "artifact_capacity_exceeded";
370
+ reason: ResumeTailError["reason"] | "identity-mismatch" | "migration-required" | "artifact_capacity_exceeded" | "migration_busy";
370
371
  message?: string;
371
372
  }
372
373
  /** Exact transcript bytes and authority captured from one descriptor-bound read. */
@@ -485,7 +486,7 @@ export interface ReadonlySessionManager {
485
486
  /** Creates an immutable facade that never exposes SessionManager mutation authority. */
486
487
  export declare function createReadonlySessionManager(manager: SessionManager): ReadonlySessionManager;
487
488
  /** 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">>;
489
+ export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "putBlob">>;
489
490
  /**
490
491
  * Returns the artifact capability for a concrete persistence owner or one of its
491
492
  * immutable read-only facades. Structural lookalikes remain unauthorized.
@@ -613,6 +614,7 @@ export declare const MATERIALIZED_CACHE_MAX_BYTES: number;
613
614
  export declare const SessionManagerTestHooks: {
614
615
  materializedCacheMaxBytesOverride?: number;
615
616
  beforeResidentTransitionIndexBuild?: () => void;
617
+ afterForkSnapshot?: () => void | Promise<void>;
616
618
  };
617
619
  export declare class SessionManager {
618
620
  #private;
@@ -757,11 +759,10 @@ export declare class SessionManager {
757
759
  path?: string;
758
760
  }>;
759
761
  /**
760
- * Save artifact content under the current persisted session and return its artifact ID.
761
- * In-memory sessions cannot produce protocol-resolvable artifact references.
762
+ * Save artifact content under the current session and return artifact ID.
763
+ * Returns an artifact ID for all sessions (file-backed for persistent, in-memory fallback otherwise).
762
764
  */
763
765
  saveArtifact(content: string, toolType: string): Promise<string | undefined>;
764
- saveArtifactReceipt(content: string, toolType: string): Promise<ArtifactSaveReceipt | undefined>;
765
766
  /**
766
767
  * Resolve an artifact ID to an on-disk path for the current session.
767
768
  * Returns null when missing or when the session is not persisted.
@@ -239,6 +239,7 @@ export type VerifiedSessionDeleteResult = {
239
239
  artifactsIdentity: SessionStorageFileIdentity | undefined;
240
240
  /** Identity-bound quarantine path retained when recursive cleanup failed. */
241
241
  detachedArtifactsPath: string;
242
+ artifactsPayloadDurable?: true;
242
243
  /** Native snapshot required for an identity-bound recursive retry. */
243
244
  artifactsTree: NativeDirectoryTreeSnapshot;
244
245
  /** Transcript identity (unchanged) for retry binding. */
@@ -254,6 +255,7 @@ export type VerifiedSessionDeleteResult = {
254
255
  transcriptIdentity: SessionStorageFileIdentity;
255
256
  /** Optional identity-bound transcript quarantine path for restart cleanup. */
256
257
  detachedTranscriptPath?: string;
258
+ transcriptPayloadDurable?: true;
257
259
  retainedSuccessorPath?: string;
258
260
  retainedPlaceholderPath?: string;
259
261
  retainedUnknownPath?: string;
@@ -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
  /**