@gajae-code/coding-agent 0.11.4 → 0.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/types/cli/notify-cli.d.ts +5 -1
  3. package/dist/types/config/settings-schema.d.ts +31 -1
  4. package/dist/types/export/html/template.generated.d.ts +1 -1
  5. package/dist/types/gjc-runtime/deep-interview-state.d.ts +28 -0
  6. package/dist/types/gjc-runtime/launch-tmux.d.ts +3 -0
  7. package/dist/types/gjc-runtime/managed-owner-admission.d.ts +42 -0
  8. package/dist/types/gjc-runtime/managed-owner-supervisor.d.ts +41 -0
  9. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +9 -0
  10. package/dist/types/gjc-runtime/ultragoal-owner-loss-recovery.d.ts +94 -0
  11. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +1 -0
  12. package/dist/types/harness-control-plane/owner.d.ts +3 -1
  13. package/dist/types/internal-urls/local-protocol.d.ts +18 -0
  14. package/dist/types/main.d.ts +2 -2
  15. package/dist/types/modes/components/ansi-display-validator.d.ts +2 -0
  16. package/dist/types/modes/components/notifications-settings-editor.d.ts +4 -0
  17. package/dist/types/modes/components/session-observer-overlay.d.ts +3 -1
  18. package/dist/types/modes/components/settings-selector.d.ts +2 -0
  19. package/dist/types/modes/components/tool-transcript-format.d.ts +58 -0
  20. package/dist/types/modes/components/transcript-viewer-overlay.d.ts +3 -0
  21. package/dist/types/modes/controllers/goal-mode-controller.d.ts +8 -1
  22. package/dist/types/modes/controllers/selector-controller.d.ts +15 -0
  23. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +3 -0
  24. package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +16 -0
  25. package/dist/types/plan-mode/approved-plan.d.ts +1 -0
  26. package/dist/types/runtime-mcp/manager.d.ts +2 -0
  27. package/dist/types/runtime-mcp/oauth-discovery.d.ts +12 -1
  28. package/dist/types/sdk/bus/chat-daemon-cli.d.ts +3 -1
  29. package/dist/types/sdk/bus/chat-daemon-control.d.ts +42 -4
  30. package/dist/types/sdk/bus/config-commands.d.ts +8 -0
  31. package/dist/types/sdk/bus/config.d.ts +22 -0
  32. package/dist/types/sdk/bus/index.d.ts +162 -2
  33. package/dist/types/sdk/bus/notification-service.d.ts +71 -8
  34. package/dist/types/sdk/bus/session-control.d.ts +11 -8
  35. package/dist/types/sdk/bus/telegram-daemon-cli.d.ts +5 -0
  36. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +11 -3
  37. package/dist/types/sdk/bus/telegram-daemon-control.d.ts +23 -4
  38. package/dist/types/sdk/bus/telegram-daemon.d.ts +214 -20
  39. package/dist/types/sdk/session.d.ts +16 -1
  40. package/dist/types/secrets/index.d.ts +4 -2
  41. package/dist/types/secrets/obfuscator.d.ts +1 -1
  42. package/dist/types/session/agent-session.d.ts +31 -2
  43. package/dist/types/session/artifacts.d.ts +30 -8
  44. package/dist/types/session/internal/managed-session-scope.d.ts +7 -0
  45. package/dist/types/session/internal/managed-session-storage.d.ts +63 -6
  46. package/dist/types/session/session-manager.d.ts +98 -18
  47. package/dist/types/session/session-storage.d.ts +27 -0
  48. package/dist/types/session/streaming-output.d.ts +4 -0
  49. package/dist/types/session/yield-queue.d.ts +8 -0
  50. package/dist/types/task/executor.d.ts +9 -0
  51. package/dist/types/tool-discovery/tool-index.d.ts +2 -0
  52. package/dist/types/tools/ask.d.ts +48 -0
  53. package/dist/types/tools/bash-skill-urls.d.ts +2 -2
  54. package/dist/types/tools/index.d.ts +4 -0
  55. package/package.json +9 -9
  56. package/scripts/generate-sdk-operation-inventory.ts +3 -0
  57. package/src/cli/notify-cli.ts +40 -18
  58. package/src/commands/sdk.ts +7 -2
  59. package/src/config/settings-schema.ts +31 -1
  60. package/src/daemon/runtime.ts +2 -2
  61. package/src/defaults/gjc/skills/deep-interview/SKILL.md +70 -49
  62. package/src/defaults/gjc/skills/ralplan/SKILL.md +0 -6
  63. package/src/defaults/gjc/skills/team/SKILL.md +7 -9
  64. package/src/defaults/gjc/skills/ultragoal/SKILL.md +0 -2
  65. package/src/eval/py/index.ts +2 -2
  66. package/src/export/html/template.generated.ts +1 -1
  67. package/src/extensibility/plugins/marketplace/manager.ts +94 -10
  68. package/src/gjc-runtime/deep-interview-recorder.ts +7 -0
  69. package/src/gjc-runtime/deep-interview-runtime.ts +10 -0
  70. package/src/gjc-runtime/deep-interview-state.ts +127 -3
  71. package/src/gjc-runtime/launch-tmux.ts +61 -6
  72. package/src/gjc-runtime/managed-owner-admission.ts +352 -0
  73. package/src/gjc-runtime/managed-owner-supervisor.ts +162 -0
  74. package/src/gjc-runtime/state-runtime.ts +38 -12
  75. package/src/gjc-runtime/team-runtime.ts +1 -1
  76. package/src/gjc-runtime/tmux-owner-isolation.ts +117 -0
  77. package/src/gjc-runtime/ultragoal-owner-loss-recovery.ts +328 -0
  78. package/src/gjc-runtime/ultragoal-runtime.ts +14 -0
  79. package/src/harness-control-plane/owner.ts +59 -3
  80. package/src/hindsight/client.ts +65 -2
  81. package/src/internal-urls/agent-protocol.ts +76 -5
  82. package/src/internal-urls/docs-index.generated.ts +8 -7
  83. package/src/internal-urls/local-protocol.ts +416 -18
  84. package/src/lsp/index.ts +4 -88
  85. package/src/main.ts +36 -12
  86. package/src/modes/acp/acp-agent.ts +8 -0
  87. package/src/modes/components/ansi-display-validator.ts +54 -0
  88. package/src/modes/components/notifications-settings-editor.ts +26 -2
  89. package/src/modes/components/session-observer-overlay.ts +40 -24
  90. package/src/modes/components/settings-selector.ts +3 -1
  91. package/src/modes/components/tool-transcript-format.ts +321 -0
  92. package/src/modes/components/transcript-viewer-overlay.ts +39 -17
  93. package/src/modes/controllers/command-controller.ts +15 -0
  94. package/src/modes/controllers/extension-ui-controller.ts +14 -2
  95. package/src/modes/controllers/goal-mode-controller.ts +20 -1
  96. package/src/modes/controllers/plan-mode-controller.ts +2 -0
  97. package/src/modes/controllers/runtime-mcp-command-controller.ts +3 -0
  98. package/src/modes/controllers/selector-controller.ts +70 -8
  99. package/src/modes/interactive-mode.ts +1 -0
  100. package/src/modes/runtime-init.ts +16 -2
  101. package/src/modes/shared/agent-wire/deep-interview-gate.ts +31 -1
  102. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +17 -1
  103. package/src/modes/shared/agent-wire/workflow-gate-schema.ts +4 -2
  104. package/src/modes/shared/agent-wire/workflow-gate-types.ts +120 -3
  105. package/src/plan-mode/approved-plan.ts +3 -1
  106. package/src/prompts/agents/architect.md +1 -0
  107. package/src/prompts/agents/critic.md +1 -0
  108. package/src/prompts/system/custom-system-prompt.md +1 -1
  109. package/src/prompts/system/system-prompt.md +2 -1
  110. package/src/prompts/tools/lsp.md +3 -3
  111. package/src/runtime-mcp/manager.ts +16 -1
  112. package/src/runtime-mcp/oauth-discovery.ts +116 -26
  113. package/src/sdk/broker/session-index.ts +122 -64
  114. package/src/sdk/bus/chat-daemon-cli.ts +72 -10
  115. package/src/sdk/bus/chat-daemon-control.ts +538 -130
  116. package/src/sdk/bus/chat-daemon-runtime.ts +1 -0
  117. package/src/sdk/bus/config-commands.ts +22 -0
  118. package/src/sdk/bus/config.ts +37 -0
  119. package/src/sdk/bus/index.ts +388 -94
  120. package/src/sdk/bus/lifecycle-control-runtime.ts +53 -3
  121. package/src/sdk/bus/notification-service.ts +284 -62
  122. package/src/sdk/bus/recent-activity.ts +14 -5
  123. package/src/sdk/bus/session-control.ts +150 -44
  124. package/src/sdk/bus/telegram-daemon-cli.ts +20 -14
  125. package/src/sdk/bus/telegram-daemon-contract.ts +11 -3
  126. package/src/sdk/bus/telegram-daemon-control.ts +312 -76
  127. package/src/sdk/bus/telegram-daemon.ts +1916 -285
  128. package/src/sdk/host/control/dispatch.ts +14 -5
  129. package/src/sdk/protocol/operation-inventory.generated.json +29 -0
  130. package/src/sdk/session.ts +155 -27
  131. package/src/secrets/index.ts +53 -10
  132. package/src/secrets/obfuscator.ts +21 -18
  133. package/src/secrets/regex.ts +2 -0
  134. package/src/session/agent-session.ts +1447 -852
  135. package/src/session/artifacts.ts +188 -23
  136. package/src/session/context-estimation.ts +7 -2
  137. package/src/session/internal/managed-session-scope.ts +200 -38
  138. package/src/session/internal/managed-session-storage.ts +1152 -46
  139. package/src/session/session-manager.ts +1121 -148
  140. package/src/session/session-storage.ts +109 -11
  141. package/src/session/streaming-output.ts +6 -0
  142. package/src/session/yield-queue.ts +20 -0
  143. package/src/slash-commands/builtin-registry.ts +36 -0
  144. package/src/task/executor.ts +71 -26
  145. package/src/task/index.ts +63 -20
  146. package/src/tool-discovery/tool-index.ts +18 -0
  147. package/src/tools/ask-answer-registry.ts +15 -1
  148. package/src/tools/ask.ts +129 -32
  149. package/src/tools/bash-skill-urls.ts +14 -3
  150. package/src/tools/bash.ts +2 -2
  151. package/src/tools/index.ts +4 -0
  152. package/src/tools/plan-mode-guard.ts +1 -0
  153. package/src/tools/sqlite-reader.ts +3 -2
  154. package/src/tools/subagent.ts +2 -0
@@ -127,6 +127,34 @@ export declare function mergeDeepInterviewEnvelope(existing: unknown, incoming:
127
127
  }): DeepInterviewStateEnvelope;
128
128
  export declare const DEEP_INTERVIEW_INTENT_CATEGORIES: readonly ["artifact", "surface", "integration", "constraint"];
129
129
  export type DeepInterviewIntentCategory = (typeof DEEP_INTERVIEW_INTENT_CATEGORIES)[number];
130
+ /**
131
+ * User-input fields that legitimately carry prose (goals, prompts, descriptions,
132
+ * answers). Shell metacharacters (`;`, `|`, `&`, backticks, `$()`) are valid prose
133
+ * here and must NOT be rejected as structural injection. Structural fields (ids,
134
+ * categories, hashes) stay strictly validated by their own guards.
135
+ */
136
+ export declare const DEEP_INTERVIEW_FREETEXT_FIELDS: ReadonlySet<string>;
137
+ /** DoS-prevention character-count caps, matching ask-schema string-length semantics. */
138
+ export declare const MAX_INITIAL_CONTEXT_LENGTH = 50000;
139
+ export declare const MAX_USER_RESPONSE_LENGTH = 10000;
140
+ /** Maximum serialized JavaScript-string length for one LLM-produced structured response. */
141
+ export declare const MAX_DEEP_INTERVIEW_STRUCTURED_RESPONSE_LENGTH = 100000;
142
+ /** Count Unicode code points without allocating an intermediate character array. */
143
+ export declare function deepInterviewCharacterCount(value: string): number;
144
+ export declare function isDeepInterviewFreeTextField(name: string): boolean;
145
+ /**
146
+ * Assert that one structured deep-interview response is JSON-serializable and
147
+ * bounded by JavaScript string length. This deliberately does not measure or
148
+ * cap accumulated persisted interview state.
149
+ */
150
+ export declare function assertDeepInterviewStructuredResponseWithinLimit(value: unknown): void;
151
+ /**
152
+ * Assert a free-text input is within its size cap. Never inspects content for shell
153
+ * metacharacters — free-text fields accept prose verbatim; this only bounds length.
154
+ */
155
+ export declare function assertDeepInterviewInputWithinLimit(value: string, max: number, fieldName?: string): void;
156
+ /** Validate user-supplied deep-interview prose before an envelope is persisted. */
157
+ export declare function assertDeepInterviewEnvelopeInputLimits(envelope: Record<string, unknown>): void;
130
158
  export interface DeepInterviewIntentItem {
131
159
  id: string;
132
160
  category: DeepInterviewIntentCategory;
@@ -76,6 +76,9 @@ export interface TmuxLaunchPlan {
76
76
  sessionStateFile?: string | null;
77
77
  /** Immutable Linux-managed owner provenance, assigned immediately before creation. */
78
78
  ownerGeneration?: string;
79
+ /** Immutable run and endpoint identities bound into the supervised command. */
80
+ ownerRunId?: string;
81
+ ownerIncarnation?: string;
79
82
  /** Generation state captured before owner-isolation planning; required for publication CAS. */
80
83
  ownerGenerationBaseline?: import("./tmux-owner-isolation").OwnerGenerationBaseline;
81
84
  /** Native tmux session identity emitted atomically by `new-session -P -F`. */
@@ -0,0 +1,42 @@
1
+ import { type ManagedOwnerBinding, type ManagedOwnerSigabrtReceipt } from "./managed-owner-supervisor";
2
+ import { type UltragoalRecoveryDecision } from "./ultragoal-owner-loss-recovery";
3
+ export declare const MANAGED_OWNER_PREDECESSOR_TOKEN_ENV = "GJC_MANAGED_OWNER_PREDECESSOR_TOKEN";
4
+ export declare const MANAGED_OWNER_PREDECESSOR_GENERATION_ENV = "GJC_MANAGED_OWNER_PREDECESSOR_GENERATION";
5
+ export declare const MANAGED_OWNER_PREDECESSOR_RUN_ID_ENV = "GJC_MANAGED_OWNER_PREDECESSOR_RUN_ID";
6
+ export declare const MANAGED_OWNER_PREDECESSOR_INCARNATION_ENV = "GJC_MANAGED_OWNER_PREDECESSOR_INCARNATION";
7
+ export declare const MANAGED_OWNER_TRANSCRIPT_PATH_ENV = "GJC_MANAGED_OWNER_TRANSCRIPT_PATH";
8
+ export interface ManagedOwnerRecoveryContext {
9
+ root: string;
10
+ binding: ManagedOwnerBinding;
11
+ receipt: ManagedOwnerSigabrtReceipt;
12
+ admission: {
13
+ session_id: string;
14
+ endpoint_incarnation: string;
15
+ owner_generation: string;
16
+ admitted: true;
17
+ };
18
+ decision: UltragoalRecoveryDecision;
19
+ }
20
+ export type ManagedOwnerAdmission = {
21
+ kind: "fresh" | "supervised";
22
+ } | {
23
+ kind: "recovery";
24
+ context: ManagedOwnerRecoveryContext;
25
+ } | {
26
+ kind: "blocked";
27
+ };
28
+ /**
29
+ * This is the pre-CLI barrier. A replacement is identified only by the exact
30
+ * predecessor token supplied by its launch binding; directory enumeration is
31
+ * deliberately never an authority source.
32
+ */
33
+ export declare function admitManagedOwnerBeforeCli(): Promise<ManagedOwnerAdmission>;
34
+ /**
35
+ * The ordinary CLI factory has no recovery-owned writer-lease or exact-child
36
+ * reconciliation capability. Do not route a recovered owner through it: first
37
+ * revalidate the immutable evidence and B0, then publish a terminal handoff.
38
+ */
39
+ export declare function completeManagedOwnerRecovery(context: ManagedOwnerRecoveryContext): Promise<{
40
+ kind: "handoff";
41
+ exitCode: 75;
42
+ }>;
@@ -0,0 +1,41 @@
1
+ export declare const MANAGED_OWNER_SUPERVISOR_ARG = "--internal-managed-owner-supervisor";
2
+ export declare const MANAGED_OWNER_CHILD_TOKEN_ENV = "GJC_MANAGED_OWNER_CHILD_TOKEN";
3
+ export declare const MANAGED_OWNER_COMMAND_ENV = "GJC_MANAGED_OWNER_COMMAND_JSON";
4
+ export declare const MANAGED_OWNER_SESSION_ID_ENV = "GJC_COORDINATOR_SESSION_ID";
5
+ export declare const MANAGED_OWNER_GENERATION_ENV = "GJC_TMUX_OWNER_GENERATION";
6
+ export declare const MANAGED_OWNER_STATE_DIR_ENV = "GJC_TMUX_OWNER_STATE_DIR";
7
+ export declare const MANAGED_OWNER_RUN_ID_ENV = "GJC_MANAGED_OWNER_RUN_ID";
8
+ export declare const MANAGED_OWNER_INCARNATION_ENV = "GJC_MANAGED_OWNER_INCARNATION";
9
+ export interface ManagedOwnerBinding {
10
+ schema_version: 2;
11
+ generation: string;
12
+ session_id: string;
13
+ run_id: string;
14
+ endpoint_incarnation: string;
15
+ child_token: string;
16
+ command: string[];
17
+ command_sha256: string;
18
+ supervisor_pid: number;
19
+ supervisor_start_time: string;
20
+ created_at: string;
21
+ }
22
+ export interface ManagedOwnerSigabrtReceipt {
23
+ schema_version: 2;
24
+ generation: string;
25
+ session_id: string;
26
+ run_id: string;
27
+ endpoint_incarnation: string;
28
+ child_token: string;
29
+ command_sha256: string;
30
+ supervisor_pid: number;
31
+ supervisor_start_time: string;
32
+ child_pid: number;
33
+ child_start_time: string;
34
+ signal: "SIGABRT";
35
+ signal_number: 6;
36
+ exit_code: number | null;
37
+ received_at: string;
38
+ }
39
+ export declare function isManagedOwnerSupervisorArgv(args: readonly string[]): boolean;
40
+ /** Runs one exact child and publishes authority only for a directly observed Linux signal 6. */
41
+ export declare function runManagedOwnerSupervisor(): Promise<void>;
@@ -277,6 +277,15 @@ export type OwnerGenerationBaseline = {
277
277
  session_id: string;
278
278
  published_at: string;
279
279
  };
280
+ export interface ManagedOwnerPredecessorEvidence {
281
+ generation: string;
282
+ sessionId: string;
283
+ runId: string;
284
+ incarnation: string;
285
+ predecessorToken: string;
286
+ }
287
+ /** Resolve one SIGABRT predecessor from the retained exact prior-generation root. */
288
+ export declare function resolveManagedOwnerPredecessorSync(stateDir: string, sessionId: string, baseline: OwnerGenerationBaseline): ManagedOwnerPredecessorEvidence | undefined;
280
289
  export declare function captureOwnerGenerationBaseline(stateDir: string, sessionId: string): Promise<OwnerGenerationBaseline>;
281
290
  /** Captures the full immutable generation record for a planned owner launch. */
282
291
  export declare function captureOwnerGenerationBaselineSync(stateDir: string, sessionId: string): OwnerGenerationBaseline;
@@ -0,0 +1,94 @@
1
+ import type { ManagedOwnerSigabrtReceipt } from "./managed-owner-supervisor";
2
+ /** Immutable identity supplied by the owner-loss monitor and coordinator admission. */
3
+ export interface UltragoalRecoveryBinding {
4
+ sessionId: string;
5
+ endpointIncarnation: string;
6
+ ownerGeneration: string;
7
+ cwd: string;
8
+ }
9
+ export interface UltragoalOwnerLossReceipt {
10
+ schema_version: 1;
11
+ session_id: string;
12
+ generation: string;
13
+ classification: "unexpected_owner_loss";
14
+ result: "signal" | "exit" | "unknown_terminal";
15
+ observed_at: string;
16
+ }
17
+ export type AuthoritativeOwnerLossReceipt = UltragoalOwnerLossReceipt | ManagedOwnerSigabrtReceipt;
18
+ export interface UltragoalRecoverySnapshot {
19
+ /** B0 is captured once before recovery writes. P is protected and never rewritten. */
20
+ b0: {
21
+ planSha256: string;
22
+ ledgerSha256: string;
23
+ capturedAt: string;
24
+ };
25
+ protectedPaths: string[];
26
+ /** Exact sanctioned deltas, never inferred from a worktree scan. */
27
+ sanctionedDeltas: string[];
28
+ /** Durable baseline-absent artifacts. */
29
+ absentArtifacts: string[];
30
+ /** Transient paths deliberately excluded from provenance. */
31
+ transientHistory: string[];
32
+ }
33
+ export type UltragoalRecoveryDisposition = "resume" | "handoff";
34
+ export interface UltragoalRecoveryDecision {
35
+ disposition: UltragoalRecoveryDisposition;
36
+ reason: string;
37
+ snapshot?: UltragoalRecoverySnapshot;
38
+ terminal?: {
39
+ yieldId: string;
40
+ result: Record<string, unknown>;
41
+ };
42
+ }
43
+ interface TranscriptYield {
44
+ type: "yield";
45
+ id: string;
46
+ parentId: string | null;
47
+ result: Record<string, unknown>;
48
+ }
49
+ /**
50
+ * Parse the complete transcript; partial rows, alternate terminal spellings, and
51
+ * duplicate/conflicting yields are intentionally invalid authority.
52
+ */
53
+ export declare function parseStrictTerminalTranscript(content: string): TranscriptYield | null;
54
+ /** Validate a path through a retained native root descriptor; path strings alone are never authority. */
55
+ export declare function validateRecoveryPath(root: string, candidate: string): Promise<string | null>;
56
+ export declare function validateOwnerLossBinding(binding: UltragoalRecoveryBinding, receipt: unknown): receipt is AuthoritativeOwnerLossReceipt;
57
+ /** Admission is valid only for this immutable coordinator endpoint incarnation. */
58
+ export declare function validateRecoveryAdmission(binding: UltragoalRecoveryBinding, admission: unknown): boolean;
59
+ /** Raw plan and ledger evidence must be complete before their B0 hashes are trusted. */
60
+ export declare function validateRawUltragoalEvidence(plan: Uint8Array, ledger: Uint8Array): boolean;
61
+ /** Build a B0 snapshot without consulting unrelated paths or mutable sidecars. */
62
+ export declare function captureUltragoalRecoverySnapshot(input: {
63
+ cwd: string;
64
+ sessionId: string;
65
+ protectedPaths: readonly string[];
66
+ sanctionedDeltas: readonly string[];
67
+ absentArtifacts: readonly string[];
68
+ transientHistory: readonly string[];
69
+ }): Promise<UltragoalRecoverySnapshot | null>;
70
+ /**
71
+ * Decide only from direct owner evidence plus a complete terminal transcript.
72
+ * All ambiguity maps to durable handoff; callers never guess a resume.
73
+ */
74
+ export declare function planUltragoalOwnerLossRecovery(input: {
75
+ binding: UltragoalRecoveryBinding;
76
+ receipt: unknown;
77
+ admission: unknown;
78
+ transcriptPath: string;
79
+ protectedPaths?: readonly string[];
80
+ sanctionedDeltas?: readonly string[];
81
+ absentArtifacts?: readonly string[];
82
+ transientHistory?: readonly string[];
83
+ }): Promise<UltragoalRecoveryDecision>;
84
+ /** Persist a monotonic replay journal and fail-closed handoff through sanctioned state writers. */
85
+ export declare function persistUltragoalRecoveryDecision(input: {
86
+ cwd: string;
87
+ sessionId: string;
88
+ binding: UltragoalRecoveryBinding;
89
+ decision: UltragoalRecoveryDecision;
90
+ }): Promise<{
91
+ handoffPath: string;
92
+ journalPath: string;
93
+ }>;
94
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { WorkflowHudSummary } from "../skill-state/active-state";
2
2
  export { computeUltragoalPlanGeneration, receiptRelevantGoals } from "./ultragoal-receipt-freshness";
3
+ export { captureUltragoalRecoverySnapshot, parseStrictTerminalTranscript, persistUltragoalRecoveryDecision, planUltragoalOwnerLossRecovery, type UltragoalOwnerLossReceipt, type UltragoalRecoveryBinding, type UltragoalRecoveryDecision, type UltragoalRecoverySnapshot, validateOwnerLossBinding, validateRawUltragoalEvidence, validateRecoveryAdmission, validateRecoveryPath, } from "./ultragoal-owner-loss-recovery";
3
4
  export type UltragoalGjcGoalMode = "aggregate" | "per-story";
4
5
  export type UltragoalGoalStatus = "pending" | "active" | "complete" | "failed" | "blocked" | "review_blocked" | "superseded";
5
6
  export type UltragoalPipelineMetadataSource = "original_plan_graph" | "legacy_brief_only" | "steering";
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import { ControlServer, type EndpointHandler } from "./control-endpoint";
14
14
  import { type FinalizeChecks, type ValidationCommandSpec } from "./finalize";
15
- import { releaseLease, type SessionLease } from "./session-lease";
15
+ import { heartbeat, releaseLease, type SessionLease } from "./session-lease";
16
16
  import { type HarnessSessionTransport } from "./session-transport";
17
17
  import { appendEvent, writeSessionState } from "./storage";
18
18
  export interface OwnerOptions {
@@ -30,6 +30,8 @@ export interface OwnerOptions {
30
30
  controlServerFactory?: (socketPath: string, handler: EndpointHandler) => ControlServer;
31
31
  /** Test seam for deterministic lease-release teardown failures. */
32
32
  leaseRelease?: typeof releaseLease;
33
+ /** Test seam for deterministic lease-heartbeat behavior (e.g. renewal barriers). */
34
+ leaseHeartbeat?: typeof heartbeat;
33
35
  /** Test seams for frame persistence failures. */
34
36
  framePersistence?: {
35
37
  appendEvent?: typeof appendEvent;
@@ -1,8 +1,26 @@
1
+ import { type NativeDirectoryTreeSnapshot } from "@gajae-code/natives";
1
2
  import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
3
+ export interface ManagedLegacyLocalMigrationEntry {
4
+ readonly relativePath: string;
5
+ readonly kind: "directory" | "file";
6
+ readonly bytes?: Uint8Array;
7
+ readonly sha256?: string;
8
+ }
9
+ /** Opaque authority for a managed session's legacy `local` artifact tree. */
10
+ export interface ManagedLegacyLocalMigrationSource {
11
+ capture(): Promise<{
12
+ readonly snapshot: NativeDirectoryTreeSnapshot;
13
+ readonly entries: readonly ManagedLegacyLocalMigrationEntry[];
14
+ } | null>;
15
+ retire(snapshot: NativeDirectoryTreeSnapshot): void;
16
+ }
2
17
  export interface LocalProtocolOptions {
3
18
  getArtifactsDir?: () => string | null;
19
+ isManagedDestination?: () => boolean;
20
+ getManagedLegacyLocalMigrationSource?: () => ManagedLegacyLocalMigrationSource | null;
4
21
  getSessionId?: () => string | null;
5
22
  }
23
+ export declare function initializeLocalRoot(options: LocalProtocolOptions): Promise<string>;
6
24
  export declare function resolveLocalRoot(options: LocalProtocolOptions): string;
7
25
  export declare function resolveLocalUrlToPath(input: string | InternalUrl, options: LocalProtocolOptions): string;
8
26
  /**
@@ -18,7 +18,7 @@ import type { SubmittedUserInput } from "./modes/types";
18
18
  import type { MCPManager } from "./runtime-mcp";
19
19
  import { type CreateAgentSessionOptions, createAgentSession, discoverAuthStorage } from "./sdk";
20
20
  import type { AgentSession } from "./session/agent-session";
21
- import { type ResumeSessionIdentity, type SessionDirectoryMigrationPolicy, type SessionInfo, SessionManager, type StrictSessionOpenResult } from "./session/session-manager";
21
+ import { type ResumeSessionIdentity, type SessionDestination, type SessionDirectoryMigrationPolicy, type SessionInfo, SessionManager, type StrictSessionOpenResult } from "./session/session-manager";
22
22
  import { runStartupCredentialAutoImportIfNeeded } from "./setup/credential-auto-import";
23
23
  import type { LspStartupServerInfo } from "./tools";
24
24
  import type { EventBus } from "./utils/event-bus";
@@ -87,7 +87,7 @@ type CreateInteractiveMode = (options: InteractiveModeFactoryOptions) => Interac
87
87
  type ResumePickerTerminalCheck = () => boolean;
88
88
  type ListForResumePickerReadOnly = (cwd: string, sessionDir?: string) => Promise<SessionInfo[]>;
89
89
  type SelectResumeSession = (sessions: SessionInfo[]) => Promise<SessionSelectionResult>;
90
- type OpenExistingSessionStrict = (identity: ResumeSessionIdentity, sessionDir?: string, migrationPolicy?: SessionDirectoryMigrationPolicy) => Promise<StrictSessionOpenResult>;
90
+ type OpenExistingSessionStrict = (identity: ResumeSessionIdentity, destination: SessionDestination, storage?: undefined, migrationPolicy?: SessionDirectoryMigrationPolicy) => Promise<StrictSessionOpenResult>;
91
91
  export declare const BARE_RESUME_CONFLICT_ERROR = "--resume without a session cannot be combined with --continue, --fork, or --no-session.";
92
92
  export declare const BARE_RESUME_INTERACTIVE_ERROR = "--resume requires an interactive terminal; use --resume <id>.";
93
93
  export declare const BARE_RESUME_OPEN_ERROR = "Could not open the selected session. Use --resume <id>.";
@@ -0,0 +1,2 @@
1
+ /** Removes every terminal control sequence except bounded SGR parameters (0-255). */
2
+ export declare function validateDisplayLine(line: string): string;
@@ -10,6 +10,8 @@ export interface NotificationsEditorPreferences {
10
10
  sessionScope: "all" | "primary";
11
11
  richEnabled: boolean;
12
12
  richDraftEnabled: boolean;
13
+ toolActivityEnabled: boolean;
14
+ streamingEnabled: boolean;
13
15
  }
14
16
  /** Secret-safe snapshot used to render the Notifications tab. */
15
17
  export interface NotificationsEditorState {
@@ -28,6 +30,7 @@ export interface NotificationsEditorSetupInput {
28
30
  chatId?: string;
29
31
  richEnabled: boolean;
30
32
  richDraftEnabled: boolean;
33
+ streamingEnabled: boolean;
31
34
  }
32
35
  /**
33
36
  * Secret-safe setup draft. The adapter may retain its private credential while
@@ -39,6 +42,7 @@ export interface PreparedTelegramConfiguration {
39
42
  tokenFingerprint?: string;
40
43
  richEnabled: boolean;
41
44
  richDraftEnabled: boolean;
45
+ streamingEnabled: boolean;
42
46
  }
43
47
  export interface NotificationsPreflightResult {
44
48
  status: "ready" | "aborted" | "cancelled" | "error";
@@ -1,6 +1,7 @@
1
1
  import type { KeyId } from "../../config/keybindings";
2
+ import type { SessionMessageEntry } from "../../session/session-manager";
2
3
  import type { SessionObserverRegistry } from "../session-observer-registry";
3
- import { TranscriptViewerOverlay } from "./transcript-viewer-overlay";
4
+ import { type TranscriptViewerEntry, TranscriptViewerOverlay } from "./transcript-viewer-overlay";
4
5
  /** Session-observer adapter. The shared viewer owns navigation and fold state. */
5
6
  export declare class SessionObserverOverlayComponent extends TranscriptViewerOverlay {
6
7
  #private;
@@ -8,3 +9,4 @@ export declare class SessionObserverOverlayComponent extends TranscriptViewerOve
8
9
  refreshFromRegistry(): void;
9
10
  handleInput(keyData: string): void;
10
11
  }
12
+ export declare function entriesFromMessages(entries: readonly SessionMessageEntry[]): TranscriptViewerEntry[];
@@ -22,6 +22,8 @@ export interface SettingsRuntimeContext {
22
22
  cwd: string;
23
23
  /** Whether this terminal can render the pet overlay. */
24
24
  petAvailable?: boolean;
25
+ /** Terminal environment used to select unavailable-pet guidance. Omitted in production to use Bun.env. */
26
+ terminalEnv?: NodeJS.ProcessEnv;
25
27
  }
26
28
  /** Status line settings subset for preview */
27
29
  export interface StatusLinePreviewSettings {
@@ -1,5 +1,63 @@
1
+ import type { Theme } from "../theme/theme";
1
2
  export declare const MAX_TOOL_ARGS_CHARS = 500;
2
3
  export declare const TOOL_RESULT_MAX_EXPANDED_LINES = 100;
4
+ export declare const INPUT_MAX_SOURCE_BYTES = 1048576;
5
+ export declare const INPUT_MAX_SOURCE_LINES = 50000;
6
+ export declare const INPUT_MAX_SCALAR_LEN = 8192;
7
+ export declare const INPUT_MAX_JSON_DEPTH = 32;
8
+ export declare const INPUT_MAX_JSON_NODES = 20000;
9
+ export type ToolDisplaySections = {
10
+ callLines: string[];
11
+ statusLines: string[];
12
+ resultText: string;
13
+ };
14
+ /**
15
+ * Produces final, terminal-safe rich display lines for an expanded tool entry.
16
+ * It owns validation, width-aware wrapping, and the result-only visible cap.
17
+ */
18
+ export declare function renderToolDisplayLines(descriptor: ToolTranscriptRenderDescriptor, contentWidth: number, theme: Theme): string[];
19
+ export type ToolTranscriptRenderDescriptor = Readonly<{
20
+ name: string;
21
+ args: Record<string, unknown>;
22
+ intent?: string;
23
+ resultContent: string;
24
+ details?: string;
25
+ detailsData?: unknown;
26
+ isError: boolean;
27
+ isPartial: boolean;
28
+ hasResult: boolean;
29
+ inputTruncated: boolean;
30
+ }>;
31
+ export type BuildToolTranscriptEntryInput = {
32
+ canonicalPayload: import("../transcript-item-registry").TranscriptSourcePayload;
33
+ renderDescriptor: ToolTranscriptRenderDescriptor;
34
+ capabilities: import("../transcript-item-registry").TranscriptItemCapabilities;
35
+ identity: {
36
+ id: string;
37
+ label: string;
38
+ display?: "full";
39
+ };
40
+ };
41
+ /**
42
+ * Shared tool projection for the main transcript and session observer.
43
+ * `payload` is canonical/copyable source; display is derived only from the
44
+ * sanitized, frozen descriptor. The observer's whole-entry 100-line cap and
45
+ * the main view's tool-only result cap intentionally remain surface-specific.
46
+ */
47
+ export declare function buildToolTranscriptEntry(input: BuildToolTranscriptEntryInput): import("./transcript-viewer-overlay").TranscriptViewerEntry;
48
+ /** Sanitizes and freezes all display-only values before tool formatting. */
49
+ export declare function createToolTranscriptRenderDescriptor(input: {
50
+ name: unknown;
51
+ args: unknown;
52
+ intent?: unknown;
53
+ resultContent: unknown;
54
+ details?: unknown;
55
+ detailsData?: unknown;
56
+ isError?: unknown;
57
+ isPartial?: unknown;
58
+ hasResult?: unknown;
59
+ inputTruncated?: unknown;
60
+ }): ToolTranscriptRenderDescriptor;
3
61
  type ToolCallFields = {
4
62
  name: string;
5
63
  args: Record<string, unknown>;
@@ -1,5 +1,6 @@
1
1
  import { Container, type MouseEvent } from "@gajae-code/tui";
2
2
  import type { TranscriptItemRegistry, TranscriptSourcePayload } from "../transcript-item-registry";
3
+ import { type ToolTranscriptRenderDescriptor } from "./tool-transcript-format";
3
4
  export type TranscriptViewerEntry = {
4
5
  id: string;
5
6
  kind: string;
@@ -9,6 +10,8 @@ export type TranscriptViewerEntry = {
9
10
  foldable?: boolean;
10
11
  rawViewable?: boolean;
11
12
  getDisplayText?: (expanded: boolean) => string;
13
+ renderDescriptor?: ToolTranscriptRenderDescriptor;
14
+ richRenderEligible?: boolean;
12
15
  };
13
16
  export type TranscriptViewerOverlayOptions = {
14
17
  title?: string;
@@ -45,7 +45,14 @@ export declare class GoalModeController {
45
45
  onPendingSubmissionFinished(customType?: string): void;
46
46
  onUserSubmission(): void;
47
47
  handleSessionEvent(event: AgentSessionEvent): Promise<void>;
48
- restoreFromSession(sessionContext: SessionContext): Promise<boolean>;
48
+ /**
49
+ * Restore durable goal state. Recovery hydration deliberately performs only
50
+ * in-memory restoration: it neither consumes a pending request nor repairs
51
+ * invalid persisted state by writing a fallback mode entry.
52
+ */
53
+ restoreFromSession(sessionContext: SessionContext, options?: {
54
+ recoveryHydration?: boolean;
55
+ }): Promise<boolean>;
49
56
  handleCommand(rest?: string): Promise<void>;
50
57
  enter(options: {
51
58
  objective?: string;
@@ -43,6 +43,21 @@ export interface NotificationsEditorOperationDependencies {
43
43
  saveTelegramInactive: typeof saveTelegramInactive;
44
44
  removeTelegramConfiguration: typeof removeTelegramConfiguration;
45
45
  unregisterNotificationRoot: typeof unregisterNotificationRoot;
46
+ reloadTelegramDaemon(settings: Settings): Promise<{
47
+ ok: boolean;
48
+ message: string;
49
+ }>;
50
+ restartTelegramDaemon(settings: Settings): Promise<{
51
+ ok: boolean;
52
+ message: string;
53
+ }>;
54
+ stopTelegramDaemon(settings: Settings): Promise<{
55
+ ok: boolean;
56
+ message: string;
57
+ before?: {
58
+ health?: string;
59
+ };
60
+ }>;
46
61
  }
47
62
  /**
48
63
  * Concrete service adapter for the direct Notifications settings tab. Secrets remain in this closure's
@@ -45,6 +45,9 @@ export interface NotificationGateResolutionOptions {
45
45
  resolveClaim(): void;
46
46
  closeClaimInvalid(reason: string): void;
47
47
  }
48
+ export declare class NotificationGatePolicyChangedError extends Error {
49
+ constructor();
50
+ }
48
51
  export interface AskSelectedAckRecoveryParticipant {
49
52
  requestRecoveredAskSelectedAck(input: {
50
53
  sessionId: string;
@@ -8,12 +8,27 @@ export declare const RESERVED_WORKFLOW_STAGES: readonly string[];
8
8
  export type WorkflowGateKind = "question" | "approval" | "execution";
9
9
  /** "Other (type your own)" sentinel, mirroring the interactive ask tool. */
10
10
  export declare const GATE_OTHER_OPTION = "Other (type your own)";
11
+ /**
12
+ * Structured adapter context queued at interview start. Non-behavioral:
13
+ * `confused_terms` and `references` MUST NOT alter the first question, are never
14
+ * inferred from vocabulary density, and referenced `url`/`excerpt` are inert
15
+ * strings that are never auto-fetched.
16
+ */
17
+ export interface AskGateReference {
18
+ reference_id: string;
19
+ label: string;
20
+ origin: string;
21
+ url?: string;
22
+ excerpt?: string;
23
+ }
11
24
  export interface AskGateDeepInterviewState {
12
25
  round_id?: string;
13
26
  round: number;
14
27
  component: string;
15
28
  dimension: string;
16
29
  ambiguity: number;
30
+ confused_terms?: string[];
31
+ references?: AskGateReference[];
17
32
  }
18
33
  export interface AskGateStageStateInput {
19
34
  id: string;
@@ -26,6 +41,7 @@ export interface AskGateStageStateInput {
26
41
  export interface AskGateSchemaInput {
27
42
  multi?: boolean;
28
43
  allowEmpty?: boolean;
44
+ customMaxLength?: number;
29
45
  }
30
46
  /** Rejects stage state that is not exactly compatible with the generic ask-gate producer. */
31
47
  export declare function validateAskGateStageState(value: unknown): asserts value is Record<string, unknown>;
@@ -43,6 +43,7 @@ interface RenameApprovedPlanFileOptions {
43
43
  planFilePath: string;
44
44
  finalPlanFilePath: string;
45
45
  getArtifactsDir: () => string | null;
46
+ isManagedDestination?: () => boolean;
46
47
  getSessionId: () => string | null;
47
48
  }
48
49
  export declare function renameApprovedPlanFile(options: RenameApprovedPlanFileOptions): Promise<void>;
@@ -64,6 +64,8 @@ export declare class MCPManager {
64
64
  static setInstance(value: MCPManager | undefined): void;
65
65
  /** Reset the process-global instance. Test-only. */
66
66
  static resetForTests(): void;
67
+ sealConnectionSet(): void;
68
+ isConnectionSetSealed(): boolean;
67
69
  constructor(cwd: string, toolCache?: MCPToolCache | null, options?: MCPManagerOptions);
68
70
  isToolsOnly(): boolean;
69
71
  /**
@@ -4,6 +4,7 @@
4
4
  * Automatically detects OAuth requirements from MCP server responses
5
5
  * and extracts authentication endpoints.
6
6
  */
7
+ import type { AddressResolver } from "../web/insane/url-guard";
7
8
  export interface OAuthEndpoints {
8
9
  authorizationUrl: string;
9
10
  tokenUrl: string;
@@ -17,6 +18,15 @@ export interface AuthDetectionResult {
17
18
  authServerUrl?: string;
18
19
  message?: string;
19
20
  }
21
+ interface OAuthDiscoveryOptions {
22
+ fetch?: (input: string | URL | Request, init?: BunFetchRequestInit) => Promise<Response>;
23
+ resolver?: AddressResolver;
24
+ maxRequests?: number;
25
+ maxNodes?: number;
26
+ maxRedirects?: number;
27
+ timeoutMs?: number;
28
+ signal?: AbortSignal;
29
+ }
20
30
  export declare function extractMcpAuthServerUrl(error: Error): string | undefined;
21
31
  /**
22
32
  * Detect if an error indicates authentication is required.
@@ -37,4 +47,5 @@ export declare function analyzeAuthError(error: Error): AuthDetectionResult;
37
47
  * Try to discover OAuth endpoints by querying the server's well-known endpoints.
38
48
  * This is a fallback when error responses don't include OAuth metadata.
39
49
  */
40
- export declare function discoverOAuthEndpoints(serverUrl: string, authServerUrl?: string): Promise<OAuthEndpoints | null>;
50
+ export declare function discoverOAuthEndpoints(serverUrl: string, authServerUrl?: string, options?: OAuthDiscoveryOptions): Promise<OAuthEndpoints | null>;
51
+ export {};
@@ -1,4 +1,4 @@
1
- import { type ChatDaemonKind } from "./chat-daemon-control";
1
+ import { type ChatDaemonKind, renewChatDaemonHeartbeat } from "./chat-daemon-control";
2
2
  import { type ChatDaemonRuntimeConfig } from "./chat-daemon-runtime";
3
3
  export interface ChatDaemonRuntimeHandle {
4
4
  start(): Promise<void>;
@@ -8,11 +8,13 @@ export interface ChatDaemonRuntimeHandle {
8
8
  export interface RunChatDaemonInternalDeps {
9
9
  processPid?: number;
10
10
  pidAlive?: (pid: number) => boolean;
11
+ pidIncarnation?: (pid: number) => string | undefined;
11
12
  createRuntime?: (input: {
12
13
  kind: ChatDaemonKind;
13
14
  agentDir: string;
14
15
  config: ChatDaemonConfig;
15
16
  }) => Promise<ChatDaemonRuntimeHandle> | ChatDaemonRuntimeHandle;
17
+ renewHeartbeat?: (input: Parameters<typeof renewChatDaemonHeartbeat>[0]) => Promise<boolean>;
16
18
  setInterval?: typeof setInterval;
17
19
  clearInterval?: typeof clearInterval;
18
20
  }