@gajae-code/coding-agent 0.12.7 → 0.12.10

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 (117) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/types/cli/notify-cli.d.ts +1 -0
  3. package/dist/types/commands/notify.d.ts +4 -0
  4. package/dist/types/commands/sdk.d.ts +23 -0
  5. package/dist/types/config/file-lock.d.ts +3 -0
  6. package/dist/types/config/model-discovery-manager.d.ts +6 -1
  7. package/dist/types/config/model-registry.d.ts +2 -0
  8. package/dist/types/config/resolve-config-value.d.ts +2 -1
  9. package/dist/types/config/settings-schema.d.ts +17 -1
  10. package/dist/types/discovery/agents-md.d.ts +11 -1
  11. package/dist/types/main.d.ts +1 -0
  12. package/dist/types/modes/components/hook-selector.d.ts +20 -0
  13. package/dist/types/modes/components/notifications-settings-editor.d.ts +53 -4
  14. package/dist/types/modes/controllers/extension-ui-controller.d.ts +1 -1
  15. package/dist/types/modes/controllers/selector-controller.d.ts +4 -2
  16. package/dist/types/modes/types.d.ts +6 -0
  17. package/dist/types/sdk/broker/broker.d.ts +5 -1
  18. package/dist/types/sdk/broker/lifecycle-ledger.d.ts +1 -0
  19. package/dist/types/sdk/bus/chat-daemon-control.d.ts +11 -1
  20. package/dist/types/sdk/bus/config.d.ts +75 -113
  21. package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
  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 +54 -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 +8 -1
  31. package/dist/types/sdk/client/discovery.d.ts +2 -1
  32. package/dist/types/sdk/host/query/handlers.d.ts +2 -0
  33. package/dist/types/sdk/index.d.ts +1 -0
  34. package/dist/types/sdk/providers.d.ts +22 -0
  35. package/dist/types/sdk/session-directory.d.ts +1 -1
  36. package/dist/types/session/internal/managed-session-scope.d.ts +17 -1
  37. package/dist/types/session/internal/managed-session-storage.d.ts +19 -1
  38. package/dist/types/session/internal/native-publish-outcome.d.ts +3 -2
  39. package/dist/types/session/internal/session-open-errors.d.ts +5 -0
  40. package/dist/types/session/session-manager.d.ts +3 -1
  41. package/dist/types/session/session-storage.d.ts +2 -0
  42. package/dist/types/system-prompt.d.ts +12 -1
  43. package/dist/types/tools/composer-bash-policy.d.ts +9 -1
  44. package/package.json +10 -8
  45. package/scripts/build-sdk-package-smoke.ts +51 -0
  46. package/scripts/capture-notifications-settings-showcase.ts +1 -1
  47. package/scripts/verify-gjc-sdk-canonicalization.ts +14 -1
  48. package/src/cli/notify-cli.ts +215 -99
  49. package/src/commands/notify.ts +19 -8
  50. package/src/commands/sdk.ts +54 -0
  51. package/src/config/file-lock.ts +6 -0
  52. package/src/config/model-discovery-manager.ts +50 -8
  53. package/src/config/model-profiles.ts +8 -0
  54. package/src/config/model-registry.ts +866 -76
  55. package/src/config/resolve-config-value.ts +10 -8
  56. package/src/config/settings-schema.ts +25 -15
  57. package/src/config/settings.ts +15 -15
  58. package/src/discovery/agents-md.ts +76 -19
  59. package/src/gjc-runtime/psmux-detect.ts +12 -16
  60. package/src/gjc-runtime/session-state-sidecar.ts +12 -2
  61. package/src/gjc-runtime/tmux-sessions.ts +8 -1
  62. package/src/internal-urls/docs-index.generated.ts +10 -9
  63. package/src/main.ts +43 -7
  64. package/src/modes/DESIGN.md +11 -11
  65. package/src/modes/components/extensions/inspector-panel.ts +9 -5
  66. package/src/modes/components/hook-selector.ts +155 -44
  67. package/src/modes/components/model-selector.ts +242 -49
  68. package/src/modes/components/notifications-settings-editor.ts +631 -85
  69. package/src/modes/controllers/extension-ui-controller.ts +114 -15
  70. package/src/modes/controllers/selector-controller.ts +525 -93
  71. package/src/modes/print-mode.ts +3 -0
  72. package/src/modes/types.ts +6 -0
  73. package/src/prompts/system/system-prompt.md +1 -0
  74. package/src/sdk/broker/broker.ts +54 -10
  75. package/src/sdk/broker/lifecycle-ledger.ts +34 -1
  76. package/src/sdk/broker/lifecycle.ts +47 -50
  77. package/src/sdk/bus/chat-daemon-cli.ts +12 -5
  78. package/src/sdk/bus/chat-daemon-control.ts +35 -6
  79. package/src/sdk/bus/chat-daemon-runtime.ts +16 -2
  80. package/src/sdk/bus/config.ts +534 -286
  81. package/src/sdk/bus/daemon-paths.ts +2 -0
  82. package/src/sdk/bus/discord-live-provider.ts +57 -2
  83. package/src/sdk/bus/discord-provider.ts +21 -0
  84. package/src/sdk/bus/index.ts +97 -35
  85. package/src/sdk/bus/notification-orchestration.ts +371 -68
  86. package/src/sdk/bus/notification-service.ts +571 -137
  87. package/src/sdk/bus/session-control.ts +119 -44
  88. package/src/sdk/bus/slack-live-provider.ts +78 -2
  89. package/src/sdk/bus/slack-provider.ts +24 -0
  90. package/src/sdk/bus/telegram-daemon-cli.ts +9 -2
  91. package/src/sdk/bus/telegram-daemon-contract.ts +8 -1
  92. package/src/sdk/bus/telegram-daemon-control.ts +3 -3
  93. package/src/sdk/bus/telegram-daemon.ts +23 -15
  94. package/src/sdk/client/discovery.ts +10 -4
  95. package/src/sdk/host/query/handlers.ts +20 -1
  96. package/src/sdk/index.ts +1 -0
  97. package/src/sdk/protocol/operation-inventory.generated.json +18 -0
  98. package/src/sdk/protocol/operation-registry.ts +5 -2
  99. package/src/sdk/providers.ts +51 -0
  100. package/src/sdk/session-directory.ts +1 -0
  101. package/src/sdk/session.ts +34 -14
  102. package/src/session/agent-session.ts +109 -37
  103. package/src/session/internal/managed-session-scope.ts +981 -450
  104. package/src/session/internal/managed-session-storage.ts +418 -47
  105. package/src/session/internal/native-publish-outcome.ts +15 -3
  106. package/src/session/internal/session-open-errors.ts +11 -0
  107. package/src/session/session-manager.ts +27 -3
  108. package/src/session/session-storage.ts +72 -5
  109. package/src/slash-commands/builtin-registry.ts +117 -15
  110. package/src/system-prompt.ts +28 -15
  111. package/src/task/index.ts +9 -3
  112. package/src/tools/ask.ts +1 -1
  113. package/src/tools/bash.ts +4 -2
  114. package/src/tools/composer-bash-policy.ts +21 -5
  115. package/src/tools/telegram-send.ts +4 -2
  116. package/src/utils/command-args.ts +19 -30
  117. package/src/utils/lang-from-path.ts +2 -4
@@ -1,11 +1,29 @@
1
1
  import type { WriteFileOptions } from "node:fs";
2
2
  import type { Settings } from "../../config/settings";
3
+ import { type NotificationProvider, type NotificationRuntime, type ProviderResolution } from "./config";
4
+ import type { DiscordDiagnosticProvider } from "./discord-provider";
5
+ import type { SlackDiagnosticProvider } from "./slack-provider";
3
6
  /**
4
7
  * Strip secrets from a human-facing diagnostic string. Redacts the configured
5
8
  * bot token (exact match) and any token-shaped substring so health/test details
6
9
  * can never leak a credential regardless of where the string originated.
7
10
  */
8
11
  export declare function sanitizeDiagnostic(text: string, token?: string): string;
12
+ export interface NotificationDiagnosticEvent {
13
+ timestamp: string;
14
+ operation: string;
15
+ phase: string;
16
+ outcome: string;
17
+ reason: string;
18
+ pid?: number;
19
+ incarnation?: string;
20
+ ageMs?: number;
21
+ detail?: string;
22
+ }
23
+ /** Append a bounded, private, secret-safe daemon diagnostic event. */
24
+ export declare function writeNotificationDiagnostic(settings: Pick<Settings, "getAgentDir">, event: Omit<NotificationDiagnosticEvent, "timestamp"> & {
25
+ timestamp?: string;
26
+ }): Promise<void>;
9
27
  /** Identity evidence required to remove precisely the endpoint that was inspected. */
10
28
  export interface NotificationEndpointFileIdentity {
11
29
  dev: bigint;
@@ -51,19 +69,37 @@ export interface NotificationServiceDeps {
51
69
  fs?: NotificationServiceFs;
52
70
  now?: () => number;
53
71
  pidAlive?: (pid: number) => boolean;
72
+ pidIncarnation?: (pid: number) => string | undefined;
54
73
  fetchImpl?: typeof fetch;
55
74
  apiBase?: string;
75
+ createDiscordDiagnostic?: (config: {
76
+ applicationId: string;
77
+ botToken: string;
78
+ }) => DiscordDiagnosticProvider;
79
+ createSlackDiagnostic?: (config: {
80
+ appToken: string;
81
+ botToken: string;
82
+ }) => SlackDiagnosticProvider;
83
+ providerRuntimeStatus?: (provider: NotificationProvider) => Promise<NotificationRuntime> | NotificationRuntime;
56
84
  }
57
85
  export interface AdapterConfigView {
58
86
  botTokenMasked: string;
59
87
  channel: string | undefined;
60
88
  configured: boolean;
89
+ quarantined: boolean;
90
+ desiredEnabled: boolean;
91
+ desiredSource: ProviderResolution["desiredSource"];
92
+ effectiveEnabled: boolean;
93
+ issues: ProviderResolution["issues"];
94
+ runtime?: NotificationRuntime;
61
95
  }
62
96
  export interface NotificationStatusReport {
63
97
  enabled: boolean;
64
98
  redact: boolean;
65
99
  verbosity: "lean" | "verbose";
66
100
  globallyConfigured: boolean;
101
+ anyProviderComplete: boolean;
102
+ anyProviderEffective: boolean;
67
103
  telegram: AdapterConfigView & {
68
104
  tokenFingerprint: string | undefined;
69
105
  };
@@ -139,6 +175,8 @@ export interface EndpointHealth {
139
175
  export interface NotificationHealthReport {
140
176
  overall: HealthLevel;
141
177
  configured: boolean;
178
+ provider?: NotificationProvider;
179
+ resolution?: ProviderResolution;
142
180
  checks: HealthCheck[];
143
181
  daemon: DaemonHealth;
144
182
  endpoints: EndpointHealth;
@@ -152,8 +190,10 @@ export interface HealthOptions {
152
190
  settings: Settings;
153
191
  stateRoot?: string;
154
192
  deps?: NotificationServiceDeps;
155
- /** When true and Telegram is configured, probe the Bot API (getMe) for reachability. */
193
+ provider?: NotificationProvider;
194
+ /** When true, use the selected provider's REST-only diagnostic path. */
156
195
  probe?: boolean;
196
+ signal?: AbortSignal;
157
197
  }
158
198
  /** Structural (offline-by-default) health of the notification subsystem. */
159
199
  export declare function checkNotificationHealth(opts: HealthOptions): Promise<NotificationHealthReport>;
@@ -161,16 +201,19 @@ export declare function checkNotificationHealth(opts: HealthOptions): Promise<No
161
201
  export declare function formatNotificationHealthReport(report: NotificationHealthReport): string;
162
202
  export interface NotificationTestResult {
163
203
  ok: boolean;
164
- adapter: "telegram";
165
- chatId: string | undefined;
204
+ adapter?: NotificationProvider;
205
+ destination?: string;
166
206
  detail: string;
207
+ uncertain?: boolean;
167
208
  }
168
209
  export interface TestOptions {
169
210
  settings: Settings;
170
211
  deps?: NotificationServiceDeps;
212
+ provider?: NotificationProvider;
171
213
  text?: string;
214
+ signal?: AbortSignal;
172
215
  }
173
- /** Send a one-off test notification through the configured Telegram adapter. */
216
+ /** Send a one-off test through exactly one durable, effective provider. */
174
217
  export declare function sendNotificationTest(opts: TestOptions): Promise<NotificationTestResult>;
175
218
  /** Render a test result as a single human-readable line (no secrets). */
176
219
  export declare function formatNotificationTestResult(result: NotificationTestResult): string;
@@ -196,6 +239,9 @@ export interface NotificationRecoveryReport {
196
239
  action: DaemonRecoveryAction;
197
240
  detail: string;
198
241
  ownerId: string | undefined;
242
+ blockingReason?: string;
243
+ markerAgeMs?: number;
244
+ forceCommand?: string;
199
245
  pid: number | undefined;
200
246
  };
201
247
  }
@@ -203,6 +249,7 @@ export interface RecoveryOptions {
203
249
  settings: Settings;
204
250
  stateRoot?: string;
205
251
  deps?: NotificationServiceDeps;
252
+ forceDaemonLock?: boolean;
206
253
  }
207
254
  export interface DaemonTransitionLock {
208
255
  pid: number;
@@ -216,6 +263,9 @@ type TransitionMarkerFs = {
216
263
  writeFile?(file: string, data: string, opts?: WriteFileOptions): Promise<void>;
217
264
  readEndpointFile?(file: string): Promise<NotificationEndpointFile>;
218
265
  exactUnlink?(file: string, identity: NotificationEndpointFileIdentity): Promise<NotificationExactUnlinkResult>;
266
+ stat?(file: string): Promise<{
267
+ mtimeMs: number;
268
+ }>;
219
269
  };
220
270
  /** True only while the exact transition acquisition still occupies the marker path. */
221
271
  export declare function daemonTransitionLockIsHeld(input: {
@@ -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>;
@@ -48,8 +48,15 @@ export declare const NOTIFICATION_PROTOCOL_VERSION = 3;
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
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 42 applies first-class provider-settings admission to Telegram
57
+ * lifecycle controls.
51
58
  */
52
- export declare const DAEMON_GENERATION = 38;
59
+ export declare const DAEMON_GENERATION = 42;
53
60
  /**
54
61
  * Serving-compatibility boundary for daemon lifecycle requests. Epoch 1 covers
55
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,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>;
@@ -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 {
@@ -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
  };
@@ -12,6 +12,14 @@ export declare class ManagedPublishError extends Error {
12
12
  }
13
13
  /** Cleanup is safe only when the native move reports that it did not commit. */
14
14
  export declare function mayCleanManagedTreeStaging(error: unknown): boolean;
15
+ /**
16
+ * A filesystem that implements no `renameat2` rename flag at all rejects the no-replace publish
17
+ * before mutating anything: NFS answers `EINVAL` (`invalid_request`) and kernels older than 3.15
18
+ * answer `ENOSYS` (`atomic_unavailable`). Only those two pre-mutation outcomes authorize the
19
+ * `linkat` stand-in; every other failure describes a publish that was actually attempted, and
20
+ * retrying it under a different primitive could publish twice.
21
+ */
22
+ export declare function renameFlagsUnsupported(outcome: NativePublishOutcome): boolean;
15
23
  export type ManagedSessionSecurityPolicy = "default" | "windows-existing-verify-first";
16
24
  export type ManagedStorageFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "artifact_capacity_exceeded" | "durability_failed" | "atomic_unavailable" | "durability_not_provable" | "migration_retired" | "managed_storage_unsupported";
17
25
  export interface ManagedStorageLock {
@@ -25,6 +33,7 @@ export interface ManagedFileSnapshot {
25
33
  identity: {
26
34
  dev: bigint;
27
35
  ino: bigint;
36
+ nlink: bigint;
28
37
  size: number;
29
38
  mtimeNs: bigint;
30
39
  ctimeNs: bigint;
@@ -32,6 +41,14 @@ export interface ManagedFileSnapshot {
32
41
  };
33
42
  }
34
43
  export declare function validateNativeSecurityResult(value: unknown, operation: "apply" | "verify", kind: "directory" | "file"): NativeOwnerOnlySecurityResult;
44
+ export interface ManagedLockRetirementTestEvent {
45
+ readonly path: string;
46
+ readonly attemptId: string;
47
+ }
48
+ /** Test-only seam immediately before exact retirement of one observed lock identity. */
49
+ export declare const ManagedLockTestHooks: {
50
+ beforeObservedRetirement?: (event: ManagedLockRetirementTestEvent) => void;
51
+ };
35
52
  /** Captured configured-root authority for managed paths only. */
36
53
  export interface ManagedDirectoryRoot {
37
54
  readonly canonicalPath: string;
@@ -77,6 +94,7 @@ export declare class ManagedSessionDescendantStore {
77
94
  publishNoReplace(relativePath: string, bytes: Uint8Array): Promise<void>;
78
95
  publishNoReplaceSync(relativePath: string, bytes: Uint8Array): void;
79
96
  replace(relativePath: string, bytes: Uint8Array): Promise<void>;
97
+ replaceExpected(relativePath: string, bytes: Uint8Array, expected: ManagedFileSnapshot): void;
80
98
  replaceSync(relativePath: string, bytes: Uint8Array): void;
81
99
  appendSync(relativePath: string, bytes: Uint8Array): void;
82
100
  /** Read an exact managed file without exposing its pathname as authority. */
@@ -106,7 +124,7 @@ export declare function captureManagedFileNoFollow(pathname: string): ManagedFil
106
124
  export declare function publishManagedFileNoReplace(destination: string, bytes: Uint8Array, assertOwned?: () => void, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
107
125
  export declare function publishManagedFileNoReplaceSync(destination: string, bytes: Uint8Array, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
108
126
  /** Replace one managed regular file while retaining the secured staging fd through publication. */
109
- export declare function replaceManagedFileSync(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
127
+ export declare function replaceManagedFileSync(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy, assertFence?: () => void, expectedDestination?: ManagedFileSnapshot["identity"]): void;
110
128
  export declare function replaceManagedFile(destination: string, bytes: Uint8Array, root: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
111
129
  /** Copy the exact bytes captured from one no-follow source descriptor. */
112
130
  export declare function copyManagedFileNoReplace(source: string, destination: string, snapshot?: ManagedFileSnapshot, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): Promise<void>;
@@ -2,8 +2,8 @@ export type NativePublishMutationState = "not_committed" | "committed" | "unknow
2
2
  export type NativePublishDurabilityState = "not_attempted" | "proven" | "not_provable";
3
3
  export type NativePublishReason = "none" | "destination_exists" | "atomic_unavailable" | "cross_device" | "permission_denied" | "io_failure" | "interrupted" | "invalid_request" | "identity_violation" | "durability_not_provable" | "unknown";
4
4
  export type NativePublishOperation = "direct_rename" | "retained_file" | "retained_tree";
5
- export type NativePublishPrimitive = "renameat2_noreplace" | "renameatx_np_excl" | "windows_rename_noreplace" | "unsupported" | "unknown";
6
- export type NativePublishPhase = "preflight" | "file_sync" | "rename" | "source_parent_sync" | "destination_parent_sync" | "terminal_identity" | "complete" | "unknown";
5
+ export type NativePublishPrimitive = "renameat2_noreplace" | "linkat_noreplace" | "mkdirat_renameat_noreplace" | "renameatx_np_excl" | "windows_rename_noreplace" | "unsupported" | "unknown";
6
+ export type NativePublishPhase = "preflight" | "file_sync" | "rename" | "source_unlink" | "source_parent_sync" | "destination_parent_sync" | "terminal_identity" | "complete" | "unknown";
7
7
  type SyncFailure = {
8
8
  phase: Exclude<NativePublishPhase, "preflight" | "file_sync" | "rename" | "complete" | "unknown">;
9
9
  parentRole: "source" | "destination" | "shared" | "staged_file";
@@ -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
+ }
@@ -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. */
@@ -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;
@@ -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;
@@ -16,6 +16,14 @@ export interface LoadContextFilesOptions {
16
16
  /** Working directory to start walking up from. Default: getProjectDir() */
17
17
  cwd?: string;
18
18
  }
19
+ export interface ProjectContextFilesResult {
20
+ contextFiles: Array<{
21
+ path: string;
22
+ content: string;
23
+ depth?: number;
24
+ }>;
25
+ warnings: string[];
26
+ }
19
27
  /**
20
28
  * Load all context files using the capability API.
21
29
  * Returns {path, content, depth} entries for all discovered context files.
@@ -24,6 +32,8 @@ export interface LoadContextFilesOptions {
24
32
  * prominent. User-home files from foreign providers (`~/.claude/CLAUDE.md`,
25
33
  * `~/.codex/AGENTS.md`, …) stay excluded — only gjc's own user config applies.
26
34
  */
35
+ export declare function loadProjectContextFilesResult(options?: LoadContextFilesOptions): Promise<ProjectContextFilesResult>;
36
+ /** Load project context files without exposing discovery diagnostics. */
27
37
  export declare function loadProjectContextFiles(options?: LoadContextFilesOptions): Promise<Array<{
28
38
  path: string;
29
39
  content: string;
@@ -93,10 +103,11 @@ export interface BuildSystemPromptOptions {
93
103
  */
94
104
  subagent?: boolean;
95
105
  }
96
- /** Result of building provider-facing system prompt messages. */
97
106
  export interface BuildSystemPromptResult {
98
107
  /** Ordered system prompt blocks. Providers should preserve entries as distinct messages/blocks. */
99
108
  systemPrompt: string[];
109
+ /** Context-file discovery warnings visible to SDK and session callers. */
110
+ warnings: string[];
100
111
  }
101
112
  export interface BuildVolatileProjectContextOptions {
102
113
  cwd?: string;
@@ -1,14 +1,22 @@
1
- export declare const COMPOSER_BASH_POLICY_ERROR = "Composer bash policy blocked repository file I/O. Use find, search, read, and edit tools for file discovery, file inspection, and file mutation.";
1
+ import { type ComposerBashPolicyToolSurface } from "@gajae-code/ai/providers/composer-discipline";
2
+ export declare const COMPOSER_BASH_POLICY_ERROR: string;
3
+ export declare const CURSOR_COMPOSER_BASH_POLICY_ERROR: string;
2
4
  type ComposerBashPolicyResult = {
3
5
  allowed: true;
4
6
  } | {
5
7
  allowed: false;
6
8
  reason: string;
7
9
  message: string;
10
+ surface: ComposerBashPolicyToolSurface;
8
11
  };
9
12
  export declare function isComposerBashPolicyModel(modelId: string | undefined): boolean;
13
+ export declare function resolveComposerBashPolicyToolSurface(input: {
14
+ modelId?: string;
15
+ provider?: string;
16
+ }): ComposerBashPolicyToolSurface;
10
17
  export declare function checkComposerBashPolicy(input: {
11
18
  modelId?: string;
19
+ provider?: string;
12
20
  commands: readonly string[];
13
21
  }): ComposerBashPolicyResult;
14
22
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/coding-agent",
4
- "version": "0.12.7",
4
+ "version": "0.12.10",
5
5
  "description": "Gajae Code CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo and Gajae Code Contributors",
@@ -53,13 +53,13 @@
53
53
  "@agentclientprotocol/sdk": "1.3.0",
54
54
  "@babel/parser": "^7.29.3",
55
55
  "@mozilla/readability": "^0.6.0",
56
- "@gajae-code/stats": "0.12.7",
57
- "@gajae-code/agent-core": "0.12.7",
58
- "@gajae-code/ai": "0.12.7",
59
- "@gajae-code/bridge-client": "0.12.7",
60
- "@gajae-code/natives": "0.12.7",
61
- "@gajae-code/tui": "0.12.7",
62
- "@gajae-code/utils": "0.12.7",
56
+ "@gajae-code/stats": "0.12.10",
57
+ "@gajae-code/agent-core": "0.12.10",
58
+ "@gajae-code/ai": "0.12.10",
59
+ "@gajae-code/bridge-client": "0.12.10",
60
+ "@gajae-code/natives": "0.12.10",
61
+ "@gajae-code/tui": "0.12.10",
62
+ "@gajae-code/utils": "0.12.10",
63
63
  "@puppeteer/browsers": "^2.13.0",
64
64
  "@types/turndown": "5.0.6",
65
65
  "@xterm/headless": "^6.0.0",
@@ -132,6 +132,8 @@
132
132
  },
133
133
  "./sdk/models": null,
134
134
  "./sdk/models.js": null,
135
+ "./sdk/providers": null,
136
+ "./sdk/providers.js": null,
135
137
  "./sdk/lifecycle-session": null,
136
138
  "./sdk/lifecycle-session.js": null,
137
139
  "./sdk/startup-capability": null,