@gajae-code/coding-agent 0.11.7 → 0.11.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 (180) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/types/cli/args.d.ts +0 -2
  3. package/dist/types/config/keybindings.d.ts +33 -3
  4. package/dist/types/config/model-profile-activation.d.ts +4 -3
  5. package/dist/types/config/model-profile-contract.d.ts +38 -0
  6. package/dist/types/config/settings-schema.d.ts +15 -2
  7. package/dist/types/edit/modes/patch.d.ts +13 -0
  8. package/dist/types/edit/path-mutation-lock.d.ts +15 -0
  9. package/dist/types/eval/py/executor.d.ts +1 -1
  10. package/dist/types/eval/py/tool-bridge.d.ts +1 -2
  11. package/dist/types/gjc-runtime/repository-binding.d.ts +63 -0
  12. package/dist/types/gjc-runtime/ultragoal-guard.d.ts +1 -0
  13. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +24 -0
  14. package/dist/types/main.d.ts +8 -0
  15. package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +2 -1
  16. package/dist/types/modes/components/tool-status-header.d.ts +3 -2
  17. package/dist/types/modes/components/welcome.d.ts +2 -0
  18. package/dist/types/modes/controllers/command-controller.d.ts +2 -0
  19. package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
  20. package/dist/types/modes/interactive-mode.d.ts +5 -2
  21. package/dist/types/modes/prompt-action-autocomplete.d.ts +6 -1
  22. package/dist/types/modes/prompt-suggestion-controller.d.ts +35 -0
  23. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +2 -2
  24. package/dist/types/modes/types.d.ts +3 -0
  25. package/dist/types/modes/utils/hotkeys-markdown.d.ts +2 -1
  26. package/dist/types/runtime-mcp/manager.d.ts +1 -1
  27. package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -5
  28. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +14 -0
  29. package/dist/types/sdk/broker/broker.d.ts +2 -0
  30. package/dist/types/sdk/broker/lifecycle.d.ts +6 -0
  31. package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -1
  32. package/dist/types/sdk/bus/config-commands.d.ts +2 -2
  33. package/dist/types/sdk/bus/config.d.ts +2 -0
  34. package/dist/types/sdk/bus/conversation-store.d.ts +1 -0
  35. package/dist/types/sdk/bus/index.d.ts +25 -0
  36. package/dist/types/sdk/bus/notification-orchestration.d.ts +1 -0
  37. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +105 -0
  38. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +13 -3
  39. package/dist/types/sdk/bus/telegram-daemon-control.d.ts +5 -1
  40. package/dist/types/sdk/bus/telegram-daemon.d.ts +128 -1
  41. package/dist/types/sdk/bus/telegram-reference.d.ts +2 -0
  42. package/dist/types/sdk/host/control/operations.d.ts +1 -1
  43. package/dist/types/sdk/host/host.d.ts +1 -1
  44. package/dist/types/sdk/host/query/handlers.d.ts +9 -0
  45. package/dist/types/sdk/index.d.ts +2 -0
  46. package/dist/types/sdk/prompt-status.d.ts +88 -0
  47. package/dist/types/sdk/session-directory.d.ts +1 -1
  48. package/dist/types/sdk/startup-capability.d.ts +3 -0
  49. package/dist/types/session/agent-session.d.ts +2 -0
  50. package/dist/types/session/internal/managed-session-scope.d.ts +11 -2
  51. package/dist/types/session/internal/managed-session-storage.d.ts +17 -2
  52. package/dist/types/session/internal/native-publish-outcome.d.ts +48 -0
  53. package/dist/types/session/session-storage.d.ts +18 -0
  54. package/dist/types/task/index.d.ts +3 -1
  55. package/dist/types/task/receipt.d.ts +2 -0
  56. package/dist/types/task/types.d.ts +94 -0
  57. package/dist/types/tools/ask.d.ts +454 -174
  58. package/dist/types/tools/image-gen.d.ts +47 -1
  59. package/dist/types/tools/index.d.ts +4 -0
  60. package/dist/types/utils/prompt-suggestion.d.ts +33 -0
  61. package/package.json +8 -8
  62. package/scripts/capture-platform-shortcut-labels-showcase.ts +342 -0
  63. package/scripts/dogfood-repository-binding.ts +209 -0
  64. package/scripts/generate-sdk-operation-inventory.ts +2 -0
  65. package/scripts/run-test-manifest.ts +4 -4
  66. package/src/cli/args.ts +2 -92
  67. package/src/cli/notify-cli.ts +5 -38
  68. package/src/cli.ts +18 -0
  69. package/src/commands/sdk.ts +2 -2
  70. package/src/config/keybindings.ts +157 -24
  71. package/src/config/model-profile-activation.ts +7 -18
  72. package/src/config/model-profile-contract.ts +161 -0
  73. package/src/config/model-registry.ts +11 -1
  74. package/src/config/settings-schema.ts +17 -2
  75. package/src/coordinator-mcp/model-preset.ts +21 -74
  76. package/src/defaults/gjc/skills/deep-interview/SKILL.md +2 -2
  77. package/src/defaults/gjc/skills/ralplan/SKILL.md +3 -1
  78. package/src/edit/index.ts +3 -6
  79. package/src/edit/modes/patch.ts +38 -1
  80. package/src/edit/modes/replace.ts +42 -0
  81. package/src/edit/path-mutation-lock.ts +112 -0
  82. package/src/eval/py/executor.ts +30 -11
  83. package/src/eval/py/prelude.py +2 -2
  84. package/src/eval/py/tool-bridge.ts +34 -18
  85. package/src/extensibility/gjc-plugins/runtime-adapters.ts +2 -1
  86. package/src/gjc-runtime/launch-tmux.ts +1 -1
  87. package/src/gjc-runtime/managed-owner-supervisor.ts +83 -4
  88. package/src/gjc-runtime/ralplan-runtime.ts +75 -3
  89. package/src/gjc-runtime/repository-binding.ts +267 -0
  90. package/src/gjc-runtime/session-state-sidecar.ts +25 -9
  91. package/src/gjc-runtime/tmux-owner-isolation.ts +2 -1
  92. package/src/gjc-runtime/tmux-sessions.ts +45 -6
  93. package/src/gjc-runtime/ultragoal-guard.ts +5 -5
  94. package/src/gjc-runtime/ultragoal-runtime.ts +181 -19
  95. package/src/internal-urls/docs-index.generated.ts +6 -5
  96. package/src/internal-urls/local-protocol.ts +33 -16
  97. package/src/internal-urls/mcp-protocol.ts +73 -11
  98. package/src/main.ts +25 -10
  99. package/src/modes/DESIGN.md +5 -0
  100. package/src/modes/acp/acp-agent.ts +50 -16
  101. package/src/modes/components/model-selector.ts +42 -8
  102. package/src/modes/components/plan-preview-overlay.ts +1 -1
  103. package/src/modes/components/runtime-mcp-add-wizard.ts +5 -0
  104. package/src/modes/components/tool-status-header.ts +20 -4
  105. package/src/modes/components/welcome.ts +22 -18
  106. package/src/modes/controllers/command-controller.ts +97 -54
  107. package/src/modes/controllers/event-controller.ts +10 -0
  108. package/src/modes/controllers/input-controller.ts +7 -2
  109. package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -6
  110. package/src/modes/controllers/selector-controller.ts +46 -54
  111. package/src/modes/interactive-mode.ts +41 -27
  112. package/src/modes/prompt-action-autocomplete.ts +32 -13
  113. package/src/modes/prompt-suggestion-controller.ts +96 -0
  114. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +2 -2
  115. package/src/modes/types.ts +3 -0
  116. package/src/modes/utils/hotkeys-markdown.ts +64 -36
  117. package/src/modes/utils/ui-helpers.ts +5 -3
  118. package/src/prompts/agents/architect.md +0 -1
  119. package/src/prompts/agents/critic.md +0 -1
  120. package/src/prompts/system/prompt-suggestion-system.md +32 -0
  121. package/src/prompts/system/system-prompt.md +6 -4
  122. package/src/prompts/tools/cron.md +3 -1
  123. package/src/runtime-mcp/manager.ts +51 -53
  124. package/src/runtime-mcp/oauth-flow.ts +0 -72
  125. package/src/runtime-mcp/plugin-network-boundary.ts +101 -0
  126. package/src/runtime-mcp/transports/http.ts +13 -6
  127. package/src/sdk/broker/broker.ts +34 -20
  128. package/src/sdk/broker/lifecycle.ts +185 -36
  129. package/src/sdk/bus/chat-daemon-control.ts +18 -5
  130. package/src/sdk/bus/config-commands.ts +2 -2
  131. package/src/sdk/bus/config.ts +9 -1
  132. package/src/sdk/bus/conversation-store.ts +40 -6
  133. package/src/sdk/bus/index.ts +240 -65
  134. package/src/sdk/bus/lifecycle-commands.ts +47 -3
  135. package/src/sdk/bus/lifecycle-control-runtime.ts +11 -2
  136. package/src/sdk/bus/lifecycle-orchestrator.ts +32 -1
  137. package/src/sdk/bus/notification-orchestration.ts +12 -0
  138. package/src/sdk/bus/notification-service.ts +27 -2
  139. package/src/sdk/bus/prompt-reconciliation.ts +239 -0
  140. package/src/sdk/bus/recent-activity.ts +90 -26
  141. package/src/sdk/bus/telegram-daemon-contract.ts +13 -3
  142. package/src/sdk/bus/telegram-daemon-control.ts +145 -33
  143. package/src/sdk/bus/telegram-daemon.ts +835 -110
  144. package/src/sdk/bus/telegram-reference.ts +20 -2
  145. package/src/sdk/cli/session-cli.ts +15 -2
  146. package/src/sdk/host/control/dispatch.ts +1 -1
  147. package/src/sdk/host/control/operations.ts +1 -1
  148. package/src/sdk/host/host.ts +2 -6
  149. package/src/sdk/host/query/handlers.ts +70 -5
  150. package/src/sdk/index.ts +12 -0
  151. package/src/sdk/prompt-status.ts +97 -0
  152. package/src/sdk/protocol/operation-inventory.generated.json +47 -0
  153. package/src/sdk/protocol/operation-registry.ts +18 -4
  154. package/src/sdk/session-directory.ts +5 -1
  155. package/src/sdk/session.ts +2 -0
  156. package/src/sdk/startup-capability.ts +9 -1
  157. package/src/session/agent-session.ts +52 -5
  158. package/src/session/blob-store.ts +7 -2
  159. package/src/session/internal/managed-session-scope.ts +854 -84
  160. package/src/session/internal/managed-session-storage.ts +251 -199
  161. package/src/session/internal/native-publish-outcome.ts +266 -0
  162. package/src/session/session-manager.ts +310 -327
  163. package/src/session/session-storage.ts +128 -11
  164. package/src/task/gjc-command.ts +2 -2
  165. package/src/task/index.ts +121 -15
  166. package/src/task/receipt.ts +3 -0
  167. package/src/task/types.ts +34 -3
  168. package/src/tools/ask.ts +198 -88
  169. package/src/tools/ast-edit.ts +2 -2
  170. package/src/tools/bash-pty-selection.ts +2 -2
  171. package/src/tools/browser/screenshot-format.ts +6 -1
  172. package/src/tools/cron.ts +1 -1
  173. package/src/tools/image-gen.ts +178 -6
  174. package/src/tools/index.ts +4 -0
  175. package/src/tools/render-utils.ts +7 -1
  176. package/src/utils/edit-mode.ts +2 -2
  177. package/src/utils/prompt-suggestion.ts +265 -0
  178. package/src/utils/sixel.ts +3 -3
  179. package/src/web/insane/url-guard.ts +3 -1
  180. package/src/web/scrapers/docs-rs.ts +30 -5
@@ -3,7 +3,7 @@ import type { CompactionOutcome } from "@gajae-code/agent-core/compaction";
3
3
  import type { AssistantMessage, ImageContent, Message, UsageReport } from "@gajae-code/ai";
4
4
  import type { Component, EditorTheme, SlashCommand } from "@gajae-code/tui";
5
5
  import { Container, Loader, Spacer, Text, TUI } from "@gajae-code/tui";
6
- import { KeybindingsManager } from "../config/keybindings";
6
+ import { KeybindingsManager, type KeyDisplayContext } from "../config/keybindings";
7
7
  import { type Settings } from "../config/settings";
8
8
  import type { ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetContent, ExtensionWidgetOptions } from "../extensibility/extensions";
9
9
  import type { CompactOptions } from "../extensibility/extensions/types";
@@ -30,9 +30,11 @@ import { GoalModeController } from "./controllers/goal-mode-controller";
30
30
  import { PlanModeController } from "./controllers/plan-mode-controller";
31
31
  import { IrcObservationLedger } from "./irc-observation-ledger";
32
32
  import { OAuthManualInputManager } from "./oauth-manual-input";
33
+ import { PromptSuggestionController } from "./prompt-suggestion-controller";
33
34
  import type { Theme } from "./theme/theme";
34
35
  import { type CompactionQueuedMessage, type ComposerSubmissionOptions, type InteractiveModeContext, type IrcArrivalSnapshot, type SubmittedUserInput, type TodoItem, type TodoPhase, type TranscriptRebuildPolicy } from "./types";
35
36
  import type { ParsedIrcMessage } from "./utils/irc-message";
37
+ export declare function getDefaultComposerPlaceholder(context?: KeyDisplayContext): string;
36
38
  export declare const DEFAULT_COMPOSER_PLACEHOLDER: string;
37
39
  export declare function getWelcomeTranscriptReservedRows(chatContainer: Container, width: number): number;
38
40
  export type WelcomeBannerSettingMode = "auto" | "unicode" | "square" | "ascii";
@@ -115,12 +117,13 @@ export declare class InteractiveMode implements InteractiveModeContext {
115
117
  fileSlashCommands: Set<string>;
116
118
  skillCommands: Map<string, Skill>;
117
119
  oauthManualInput: OAuthManualInputManager;
120
+ promptSuggestion: PromptSuggestionController;
118
121
  readonly lspServers: LspStartupServerInfo[] | undefined;
119
122
  mcpManager?: import("../runtime-mcp").MCPManager;
120
123
  /** Direct controller capabilities for consumers that coordinate mode transitions. */
121
124
  get planModeController(): PlanModeController;
122
125
  get goalModeController(): GoalModeController;
123
- constructor(session: AgentSession, version: string, changelogMarkdown?: string | undefined, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers?: LspStartupServerInfo[] | undefined, mcpManager?: import("../runtime-mcp").MCPManager, eventBus?: EventBus);
126
+ constructor(session: AgentSession, version: string, changelogMarkdown?: string | undefined, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers?: LspStartupServerInfo[] | undefined, mcpManager?: import("../runtime-mcp").MCPManager, eventBus?: EventBus, keyDisplayContext?: KeyDisplayContext);
124
127
  getCurrentSessionNotificationStatus(): NotificationSessionStatus | undefined;
125
128
  setCurrentSessionNotificationsEnabled(enabled: boolean): Promise<NotificationSessionReconcileResult | undefined>;
126
129
  init(): Promise<void>;
@@ -22,10 +22,15 @@ interface PromptActionAutocompleteOptions {
22
22
  moveCursorToMessageStart: () => void;
23
23
  moveCursorToLineStart: () => void;
24
24
  moveCursorToLineEnd: () => void;
25
+ /**
26
+ * Ghost-text next-prompt prediction shown in the empty composer as a dim
27
+ * inline hint (Tab accepts it via the editor's onTab handler).
28
+ */
29
+ getPromptSuggestion?: () => string | null;
25
30
  }
26
31
  export declare class PromptActionAutocompleteProvider implements AutocompleteProvider {
27
32
  #private;
28
- constructor(commands: SlashCommand[], basePath: string, actions: PromptActionDefinition[]);
33
+ constructor(commands: SlashCommand[], basePath: string, actions: PromptActionDefinition[], getPromptSuggestion?: () => string | null);
29
34
  getSuggestions(lines: string[], cursorLine: number, cursorCol: number): Promise<{
30
35
  items: AutocompleteItem[];
31
36
  prefix: string;
@@ -0,0 +1,35 @@
1
+ import type { InteractiveModeContext } from "./types";
2
+ /**
3
+ * Owns the ghost-text next-prompt prediction lifecycle for interactive mode.
4
+ *
5
+ * After each agent turn ends (and only when `promptSuggestions` is enabled
6
+ * and the composer is empty), a smol-model prediction of the user's next
7
+ * prompt is generated in the background. The result renders as dim ghost
8
+ * text in the empty composer via the autocomplete provider's inline hint;
9
+ * Tab accepts it, typing dismisses it, and a new turn clears it.
10
+ */
11
+ export declare class PromptSuggestionController {
12
+ #private;
13
+ constructor(ctx: InteractiveModeContext);
14
+ /** Current suggestion to render as ghost text, or null. */
15
+ get current(): string | null;
16
+ /** Drop the current suggestion and invalidate any in-flight generation. */
17
+ clear(): void;
18
+ /** A new agent turn started; any pending suggestion is stale. */
19
+ onAgentStart(): void;
20
+ /**
21
+ * Editor content changed. A non-empty composer means the user is writing
22
+ * their own prompt: dismiss the suggestion and cancel pending generation.
23
+ */
24
+ notifyEditorChanged(text: string): void;
25
+ /**
26
+ * Agent turn ended; kick off background generation when the feature is
27
+ * enabled and the composer is idle and empty.
28
+ */
29
+ onAgentEnd(): void;
30
+ /**
31
+ * Tab handler for the composer: accept the suggestion when the composer
32
+ * is empty. Returns true when Tab was consumed.
33
+ */
34
+ tryAcceptOnTab(text: string): boolean;
35
+ }
@@ -59,7 +59,7 @@ export interface AskSelectedAckRecoveryParticipant {
59
59
  }
60
60
  /** SDK-native surface for emitting a workflow gate and awaiting its answer. */
61
61
  export interface WorkflowGateEmitter {
62
- isUnattended(): boolean;
62
+ supportsRemoteGateAnswers(): boolean;
63
63
  emitGate(input: OpenGateInput): Promise<unknown>;
64
64
  onGateEmitted?(listener: (gate: WorkflowGate) => void): () => void;
65
65
  resolveGate?(response: WorkflowGateResponse): Promise<WorkflowGateResolution>;
@@ -96,7 +96,7 @@ export interface WorkflowGateEmitter {
96
96
  export declare class BrokerWorkflowGateEmitter implements WorkflowGateEmitter {
97
97
  #private;
98
98
  constructor(runId: string, store: GateStore, emitterHooks?: Pick<BrokerHooks, "advance">);
99
- isUnattended(): boolean;
99
+ supportsRemoteGateAnswers(): boolean;
100
100
  setRuntimeTurnProvider(provider: (() => string | undefined) | null): void;
101
101
  emitGate(input: OpenGateInput): Promise<unknown>;
102
102
  onGateEmitted(listener: (gate: WorkflowGate) => void): () => void;
@@ -27,6 +27,7 @@ import type { ToolExecutionHandle } from "./components/tool-execution";
27
27
  import type { StatusLineComponent } from "./components/tool-status-header";
28
28
  import type { IrcObservationLedger } from "./irc-observation-ledger";
29
29
  import type { OAuthManualInputManager } from "./oauth-manual-input";
30
+ import type { PromptSuggestionController } from "./prompt-suggestion-controller";
30
31
  import type { Theme } from "./theme/theme";
31
32
  import type { ParsedIrcMessage } from "./utils/irc-message";
32
33
  export type TranscriptRebuildPolicy = "replace-identity" | "reconcile-same-transcript";
@@ -133,6 +134,8 @@ export interface InteractiveModeContext {
133
134
  skillCommands: Map<string, Skill>;
134
135
  oauthManualInput: OAuthManualInputManager;
135
136
  todoPhases: TodoPhase[];
137
+ /** Ghost-text next-prompt prediction; absent in ACP/lightweight test contexts. */
138
+ promptSuggestion?: PromptSuggestionController;
136
139
  init(): Promise<void>;
137
140
  shutdown(): Promise<void>;
138
141
  checkShutdownRequested(): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import type { KeybindingsManager } from "../../config/keybindings";
2
2
  export interface HotkeysMarkdownBindings {
3
- keybindings: Pick<KeybindingsManager, "getDisplayString">;
3
+ keybindings: Pick<KeybindingsManager, "formatAccessibleKeyHint" | "getAccessibleDisplayString">;
4
4
  }
5
+ export declare function formatHotkeyMarkdownCode(label: string, escapeTablePipes?: boolean): string;
5
6
  export declare function buildHotkeysMarkdown(bindings: HotkeysMarkdownBindings): string;
@@ -1,4 +1,4 @@
1
- import type { TSchema } from "@gajae-code/ai";
1
+ import { type TSchema } from "@gajae-code/ai";
2
2
  import type { SourceMeta } from "../capability/types";
3
3
  import type { CustomTool } from "../extensibility/custom-tools/types";
4
4
  import type { AuthStorage } from "../session/auth-storage";
@@ -52,8 +52,3 @@ export declare class MCPOAuthFlow extends OAuthCallbackFlow {
52
52
  }>;
53
53
  exchangeToken(code: string, _state: string, redirectUri: string): Promise<OAuthCredentials>;
54
54
  }
55
- /**
56
- * Refresh an MCP OAuth token using the standard refresh_token grant.
57
- * Returns updated credentials; preserves the old refresh token if the server doesn't rotate it.
58
- */
59
- export declare function refreshMCPOAuthToken(tokenUrl: string, refreshToken: string, clientId?: string, clientSecret?: string): Promise<OAuthCredentials>;
@@ -0,0 +1,14 @@
1
+ import { type AddressResolver } from "../web/insane/url-guard";
2
+ import type { MCPHttpServerConfig, MCPSseServerConfig } from "./types";
3
+ /** Mark an in-memory plugin-bundle remote MCP config for connection-bound public-network enforcement. */
4
+ export declare function bindPluginMcpToPublicNetwork<T extends MCPHttpServerConfig | MCPSseServerConfig>(config: T): T;
5
+ /** The marker is an internal symbol, so persisted user MCP configs cannot opt into or forge this path. */
6
+ export declare function isPluginMcpPublicNetworkBound(config: MCPHttpServerConfig | MCPSseServerConfig): boolean;
7
+ /**
8
+ * Fetch a plugin-bundle MCP request through a DNS-pinned public address. Every
9
+ * redirect is handled manually and revalidated before the next connection.
10
+ */
11
+ export declare function fetchPluginMcpRequest(rawUrl: string, init: BunFetchRequestInit, options?: {
12
+ resolver?: AddressResolver;
13
+ maxRedirects?: number;
14
+ }): Promise<Response>;
@@ -1,4 +1,5 @@
1
1
  import type { NativeDirectoryTreeSnapshot } from "@gajae-code/natives";
2
+ import type { ModelProfileErrorDetails } from "../../config/model-profile-contract";
2
3
  import { type DirectoryMigrationPolicy } from "../session-directory";
3
4
  import { type BrokerDiscovery, type RedactedBrokerDiscovery } from "./discovery";
4
5
  import { type LifecycleDurableEffectsReceipt, LifecycleLedger, type LifecycleStartupFailureReceipt } from "./lifecycle-ledger";
@@ -93,6 +94,7 @@ export type BrokerResponse = {
93
94
  error: {
94
95
  code: BrokerErrorCode;
95
96
  message: string;
97
+ details?: ModelProfileErrorDetails;
96
98
  endpoint?: "unavailable";
97
99
  cleanup?: BrokerCleanupEvidence;
98
100
  };
@@ -70,6 +70,7 @@ export interface SessionLifecycleLaunchRequest {
70
70
  }
71
71
  export declare function readSessionLifecycleLaunchRequest(value: string | undefined, now?: number): SessionLifecycleLaunchRequest;
72
72
  type CleanupEvidence = BrokerCleanupEvidence;
73
+ export declare function validateBrokerModelPresetForTest(agentDir: string, requestedProfile: string): string | BrokerResponse;
73
74
  export declare function setProcessIncarnationForTest(broker: Broker, value: ((pid: number) => string | undefined) | undefined): void;
74
75
  /** The child writes this only after its endpoint and semantic ready event are both live. */
75
76
  export declare function writeSessionLifecycleReady(root: string, id: string, effectMarker: string): Promise<void>;
@@ -79,6 +80,11 @@ export interface LifecycleTranscriptEvidence {
79
80
  }
80
81
  /** The child writes bounded startup diagnostics before exiting without readiness. */
81
82
  export declare function writeSessionLifecycleFailure(root: string, id: string, effectMarker: string, failure: SdkStartupFailure, rollback: SdkStartupRollbackResult, transcript?: LifecycleTranscriptEvidence, ownerIncarnation?: string): Promise<void>;
83
+ export declare function readSessionLifecycleFailureForTest(root: string, id: string, expected: {
84
+ pid: number;
85
+ effectMarker: string;
86
+ incarnation: string;
87
+ }): Promise<SdkStartupFailure | undefined>;
82
88
  export interface LifecycleExecutionOutcome {
83
89
  response: BrokerResponse;
84
90
  durableEffects?: LifecycleDurableEffectsReceipt;
@@ -9,7 +9,11 @@ export type ChatDaemonAction = "stop" | "reload";
9
9
  * Generation 7 restores macOS daemon signaling (kill(2) with a start-time
10
10
  * incarnation recheck) so a live/hung owner can be replaced without an external
11
11
  * `kill -9`. Generation 8 adopts Windows expected-identity ACL verification and
12
- * repair for shared native authority.
12
+ * repair for shared native authority. Generation 9 refreshes the shared native
13
+ * authority declaration contract with bounded frame-delivery acknowledgement.
14
+ * Generation 11 accepts typed retained exact-unlink cleanup authority — a
15
+ * concrete detached quarantine plus a proven-absent canonical lock pathname —
16
+ * when deleting an observed owner-lock lease.
13
17
  */
14
18
  export declare const CHAT_DAEMON_GENERATIONS: Readonly<Record<ChatDaemonKind, number>>;
15
19
  export declare function chatDaemonGeneration(kind: ChatDaemonKind): number;
@@ -5,8 +5,8 @@
5
5
  * removed), but the user can still adjust per-surface behaviour from inside a
6
6
  * session thread with small slash commands:
7
7
  *
8
- * - `/verbose` switch the mirror to bounded tool-owned summaries + provider-displayable reasoning summaries
9
- * - `/lean` switch back to lean (assistant text + tool names)
8
+ * - `/verbose` switch the mirror to per-turn assistant text + tool summaries + reasoning summaries
9
+ * - `/lean` settled assistant answer at idle + immediate ask lead-ins (no intermediate tool-turn flood)
10
10
  * - `/verbosity lean|verbose`
11
11
  * - `/redact on|off` toggle redaction of streamed content
12
12
  *
@@ -287,6 +287,8 @@ export interface RedactableAction {
287
287
  question?: string;
288
288
  options?: string[];
289
289
  summary?: string;
290
+ /** Optional zero-based recommendation into the authoritative raw options. */
291
+ recommendedIndex?: number;
290
292
  }
291
293
  /**
292
294
  * When redact is true, strip sensitive content for remote delivery:
@@ -56,6 +56,7 @@ export declare class ConversationStore<T extends ConversationRecord> {
56
56
  pidAlive?: (pid: number) => boolean;
57
57
  sleep?: (ms: number) => Promise<void>;
58
58
  lockTimeoutMs?: number;
59
+ platform?: NodeJS.Platform;
59
60
  });
60
61
  get filePath(): string;
61
62
  load(): Promise<ConversationStoreDocument<T>>;
@@ -204,6 +204,7 @@ interface UnattendedGatePresentation {
204
204
  question: string;
205
205
  options: string[];
206
206
  controls: readonly AskRemoteControl[];
207
+ recommendedIndex?: number;
207
208
  multi: boolean;
208
209
  allowEmpty: boolean;
209
210
  navigationLabel?: "Next" | "Done";
@@ -343,6 +344,21 @@ interface SessionRuntime {
343
344
  commandId: string;
344
345
  turnId: string;
345
346
  } | undefined) => boolean;
347
+ /** Transitions the authoritative reconciliation record at lifecycle ingress; terminal outcomes settle once. */
348
+ notePromptReconciliation: (correlation: {
349
+ commandId: string;
350
+ turnId: string;
351
+ } | undefined, frame: {
352
+ type: "agent_start" | "agent_end";
353
+ } | {
354
+ type: "agent_failed";
355
+ error: unknown;
356
+ }) => void;
357
+ /** Settles and emits one sanitized correlated prompt failure. */
358
+ emitPromptFailure: (correlation: {
359
+ commandId: string;
360
+ turnId: string;
361
+ }, error: unknown) => void;
346
362
  /** Records correlated lifecycle frames for replay and delivers them only to the accepted requester after acknowledgement. */
347
363
  emitPromptLifecycle: (correlation: {
348
364
  commandId: string;
@@ -385,6 +401,15 @@ interface SessionRuntime {
385
401
  text?: string;
386
402
  messageRef?: string;
387
403
  };
404
+ /**
405
+ * Lean-mode deferred final answer: latest assistant text observed at `turn_end`,
406
+ * emitted once at `agent_end` so intermediate tool-turn narration does not flood
407
+ * remote clients. Cleared after flush or when replaced by a newer turn.
408
+ */
409
+ pendingSettled?: {
410
+ text: string;
411
+ messageRef?: string;
412
+ };
388
413
  /** Durable gates emitted while ownership is provisional; presented only after stable activation. */
389
414
  deferredGatePresentations: Array<() => void>;
390
415
  /** SDK control frames received during provisional ownership; replayed only after stable activation. */
@@ -30,6 +30,7 @@ export interface ProposedTelegramIdentityPreflightInput {
30
30
  deps?: {
31
31
  fs?: TelegramDaemonFs;
32
32
  pidAlive?: (pid: number) => boolean;
33
+ pidIncarnation?: (pid: number) => string | undefined;
33
34
  };
34
35
  }
35
36
  /**
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Bounded authoritative reconciliation state for Q26 `turn.prompt_status`.
3
+ *
4
+ * Separate from the lifecycle delivery buffers (promptSubmissions /
5
+ * promptTerminalTombstones), which exist to deliver frames and intentionally
6
+ * forget outcomes. This record preserves accepted/in_flight/terminal_ok/failed
7
+ * plus bounded sanitized failure metadata so a caller can reconcile a prior
8
+ * `turn.prompt` after disconnect/reconnect.
9
+ *
10
+ * Semantics (public contract, mirrored in sdk/prompt-status.ts):
11
+ * - Active records are NEVER converted to terminal by age or capacity.
12
+ * - Terminal records are retained for TERMINAL_TTL_MS and bounded to
13
+ * TERMINAL_CAPACITY, evicted oldest-terminal-first by terminalAt; only then
14
+ * does a lookup honestly report `unknown`.
15
+ * - The durability floor is the live session process: restart means `unknown`.
16
+ * - The clientRef index is session-runtime scoped; a ref conflicts only while
17
+ * retained and must never be reused as a retry mechanism.
18
+ * - Terminal transitions settle once: the first terminal outcome wins.
19
+ */
20
+ export declare const PROMPT_RECONCILIATION_ACTIVE_CAPACITY = 128;
21
+ export declare const PROMPT_RECONCILIATION_TERMINAL_CAPACITY = 256;
22
+ export declare const PROMPT_RECONCILIATION_TERMINAL_TTL_MS: number;
23
+ export declare const PROMPT_FAILURE_CODE_MAX = 64;
24
+ export type PromptReconciliationStatus = "accepted" | "in_flight" | "terminal_ok" | "failed";
25
+ export interface PromptCorrelation {
26
+ commandId: string;
27
+ turnId: string;
28
+ }
29
+ export interface PromptReconciliationRecord extends PromptCorrelation {
30
+ clientRef?: string;
31
+ status: PromptReconciliationStatus;
32
+ error?: {
33
+ code: string;
34
+ message: string;
35
+ };
36
+ acceptedAt: number;
37
+ startedAt?: number;
38
+ terminalAt?: number;
39
+ }
40
+ export type TurnPromptReconciliation = {
41
+ status: "accepted";
42
+ commandId: string;
43
+ turnId: string;
44
+ clientRef?: string;
45
+ acceptedAt: number;
46
+ } | {
47
+ status: "in_flight";
48
+ commandId: string;
49
+ turnId: string;
50
+ clientRef?: string;
51
+ acceptedAt: number;
52
+ startedAt: number;
53
+ } | {
54
+ status: "terminal_ok";
55
+ commandId: string;
56
+ turnId: string;
57
+ clientRef?: string;
58
+ acceptedAt: number;
59
+ startedAt?: number;
60
+ terminalAt: number;
61
+ } | {
62
+ status: "failed";
63
+ commandId: string;
64
+ turnId: string;
65
+ clientRef?: string;
66
+ acceptedAt: number;
67
+ startedAt?: number;
68
+ terminalAt: number;
69
+ error: {
70
+ code: string;
71
+ message: string;
72
+ };
73
+ } | {
74
+ status: "unknown";
75
+ };
76
+ export interface PromptReconciliation {
77
+ /** Fail-closed admission BEFORE any execution; holds an identity-bound reservation. */
78
+ admit(clientRef?: string): void;
79
+ /** Discard one admission reservation without creating a record (rejection/cancellation). */
80
+ releaseAdmission(clientRef?: string): void;
81
+ /** Transition a reservation into the accepted record at preflight acceptance. */
82
+ noteAccepted(correlation: PromptCorrelation, clientRef?: string): void;
83
+ /** Lifecycle transition; terminal outcomes settle exactly once. */
84
+ noteTransition(correlation: PromptCorrelation | undefined, frame: {
85
+ type: "agent_start" | "agent_end";
86
+ } | {
87
+ type: "agent_failed";
88
+ error: unknown;
89
+ }): void;
90
+ lookup(selector: {
91
+ commandId?: string;
92
+ turnId?: string;
93
+ clientRef?: string;
94
+ }): TurnPromptReconciliation;
95
+ cleanup(): void;
96
+ activeCount(): number;
97
+ }
98
+ /** Safe-token code capped at 64; arbitrary failure text is never retained. */
99
+ export declare function sanitizePromptFailure(error: unknown): {
100
+ code: string;
101
+ message: string;
102
+ };
103
+ export declare function createPromptReconciliation(options?: {
104
+ now?: () => number;
105
+ }): PromptReconciliation;
@@ -24,7 +24,17 @@ export declare const NOTIFICATION_PROTOCOL_VERSION = 3;
24
24
  * legacy stopped-lock reclamation in generation 14, Windows expected-identity
25
25
  * ACL verification and repair in generation 15, identity-fenced stale endpoint
26
26
  * startup recovery in generation 16, Telegram topic recovery authority fencing
27
- * in generation 17, and fail-closed blank-token validation plus lifecycle-startup
28
- * stop fencing in generation 18.
27
+ * in generation 17, fail-closed blank-token validation plus lifecycle-startup
28
+ * stop fencing in generation 18, recommended ask metadata rendering in
29
+ * generation 19, authoritative terminal session-close delivery and cleanup
30
+ * fencing, attested generation-bearing pre-incarnation owner handoff in
31
+ * generation 20, guarded modern generation-absent predecessor signaling in
32
+ * generation 21, dead Windows v0.10 owner replacement in generation 22, and
33
+ * retained native cleanup authority revalidation in generation 23, and typed
34
+ * retained exact-unlink cleanup authority acceptance (concrete detached
35
+ * quarantine plus proven canonical absence) in generation 24.
36
+ * Generation 25 adds startup dead-root prune + leak-artifact self-heal
37
+ * on TelegramNotificationDaemon.run (#2958). Generation 26 adds bounded reload
38
+ * cooldown and lazy Telegram topic lifecycle safeguards (#2956, #2960, #2984).
29
39
  */
30
- export declare const DAEMON_GENERATION = 18;
40
+ export declare const DAEMON_GENERATION = 26;
@@ -24,8 +24,11 @@ export declare function writeTelegramControlRequest(settings: Settings, request:
24
24
  export declare function clearTelegramControlRequest(settings: Settings, requestId?: string, fsImpl?: TelegramDaemonFs): Promise<void>;
25
25
  export interface DaemonProcessReference {
26
26
  incarnation: string;
27
+ /** Whether the platform delivers the requested signal cooperatively or as a hard termination. */
28
+ termination: "cooperative" | "hard";
27
29
  signalRoot(signal: NodeJS.Signals): void;
28
30
  }
31
+ export declare function defaultProcessReference(pid: number, platform?: NodeJS.Platform): DaemonProcessReference | undefined;
29
32
  export interface TelegramDaemonControlDeps {
30
33
  fs?: TelegramDaemonFs;
31
34
  now?: () => number;
@@ -58,6 +61,7 @@ export type TelegramGenerationReloadResult = {
58
61
  operation: DaemonOperationResult;
59
62
  };
60
63
  export declare class TelegramDaemonController implements BuiltInDaemonController {
64
+ #private;
61
65
  private readonly settings;
62
66
  private readonly deps;
63
67
  readonly kind: "telegram";
@@ -81,7 +85,7 @@ export declare class TelegramDaemonController implements BuiltInDaemonController
81
85
  private signalCapturedOwner;
82
86
  private result;
83
87
  reload(opts?: DaemonOperationOptions): Promise<DaemonOperationResult>;
84
- reloadForGenerationUpgrade(opts?: DaemonOperationOptions): Promise<TelegramGenerationReloadResult>;
88
+ reloadForGenerationUpgrade(opts?: DaemonOperationOptions, attestedLegacyUpgrade?: boolean): Promise<TelegramGenerationReloadResult>;
85
89
  stop(opts?: DaemonOperationOptions): Promise<DaemonOperationResult>;
86
90
  private stopOrReload;
87
91
  /** Clear only our exact control request; a successor request must survive. */