@sayknow-cli/coding-agent 0.3.12 → 0.3.15
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.
- package/dist/types/autoresearch/tools/init-experiment.d.ts +1 -1
- package/dist/types/autoresearch/tools/log-experiment.d.ts +2 -2
- package/dist/types/cli/classify-install-target.d.ts +0 -10
- package/dist/types/cli/daemon-cli.d.ts +2 -0
- package/dist/types/cli/initial-message.d.ts +1 -1
- package/dist/types/cli/malloc-env-guard.d.ts +65 -0
- package/dist/types/cli/malloc-env-guard.test.d.ts +1 -0
- package/dist/types/cli/notify-cli.d.ts +3 -1
- package/dist/types/cli/session-picker.d.ts +4 -3
- package/dist/types/cli/update-cli.d.ts +22 -3
- package/dist/types/cli.d.ts +5 -0
- package/dist/types/commands/daemon.d.ts +6 -2
- package/dist/types/commands/launch.d.ts +1 -0
- package/dist/types/commands/notify.d.ts +6 -0
- package/dist/types/commands/web-search.d.ts +1 -1
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +4 -4
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +9 -9
- package/dist/types/commit/agentic/tools/schemas.d.ts +9 -9
- package/dist/types/commit/agentic/tools/split-commit.d.ts +9 -9
- package/dist/types/commit/analysis/conventional.d.ts +1 -1
- package/dist/types/commit/analysis/summary.d.ts +1 -1
- package/dist/types/commit/changelog/generate.d.ts +3 -3
- package/dist/types/commit/changelog/index.d.ts +2 -2
- package/dist/types/commit/map-reduce/map-phase.d.ts +1 -1
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +1 -1
- package/dist/types/commit/shared-llm.d.ts +9 -9
- package/dist/types/config/keybindings.d.ts +134 -129
- package/dist/types/config/model-profile-activation.d.ts +1 -0
- package/dist/types/config/model-registry.d.ts +35 -35
- package/dist/types/config/models-config-schema.d.ts +111 -111
- package/dist/types/config/settings-schema.d.ts +56 -16
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/coordinator/contract.d.ts +1 -1
- package/dist/types/coordinator-mcp/model-preset.d.ts +45 -0
- package/dist/types/coordinator-mcp/policy.d.ts +3 -0
- package/dist/types/coordinator-mcp/server.d.ts +79 -6
- package/dist/types/coordinator-mcp/session-reaper.d.ts +53 -0
- package/dist/types/daemon/control-types.d.ts +10 -0
- package/dist/types/daemon/operator-contract.d.ts +47 -0
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/models/catalog.d.ts +4 -0
- package/dist/types/defaults/skc/extensions/grok-cli-vendor/src/shared/errors.d.ts +12 -12
- package/dist/types/discovery/helpers.d.ts +1 -1
- package/dist/types/discovery/substitute-plugin-root.d.ts +0 -4
- package/dist/types/edit/modes/patch.d.ts +2 -2
- package/dist/types/extensibility/extensions/types.d.ts +3 -1
- package/dist/types/goals/tools/goal-tool.d.ts +6 -6
- package/dist/types/i18n/messages/en.d.ts +8 -8
- package/dist/types/internal-urls/local-protocol.d.ts +13 -9
- package/dist/types/lsp/index.d.ts +9 -9
- package/dist/types/lsp/types.d.ts +9 -9
- package/dist/types/main.d.ts +66 -2
- package/dist/types/modes/acp/acp-agent.d.ts +19 -2
- package/dist/types/modes/acp/acp-mode.d.ts +12 -0
- package/dist/types/modes/components/assistant-message.d.ts +1 -1
- package/dist/types/modes/components/custom-editor.d.ts +2 -0
- package/dist/types/modes/components/hook-selector.d.ts +5 -0
- package/dist/types/modes/components/irc-sidebar.d.ts +32 -0
- package/dist/types/modes/components/pet-selector.d.ts +11 -0
- package/dist/types/modes/components/sayknow-pet-widget.d.ts +59 -0
- package/dist/types/modes/components/session-selector.d.ts +22 -9
- package/dist/types/modes/components/settings-selector.d.ts +2 -0
- package/dist/types/modes/components/status-line/types.d.ts +1 -1
- package/dist/types/modes/components/status-line.d.ts +0 -10
- package/dist/types/modes/components/tool-execution.d.ts +1 -0
- package/dist/types/modes/components/user-message.d.ts +2 -1
- package/dist/types/modes/controllers/event-controller.d.ts +4 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +24 -2
- package/dist/types/modes/irc-observation-ledger.d.ts +22 -0
- package/dist/types/modes/print-mode.d.ts +3 -4
- package/dist/types/modes/rpc/rpc-client.d.ts +7 -1
- package/dist/types/modes/rpc/rpc-mode.d.ts +2 -1
- package/dist/types/modes/rpc/rpc-types.d.ts +17 -1
- package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +8 -0
- package/dist/types/modes/shared/agent-wire/unattended-run-controller.d.ts +5 -0
- package/dist/types/modes/shared/agent-wire/unattended-session.d.ts +45 -0
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +42 -2
- package/dist/types/modes/theme/defaults/index.d.ts +568 -568
- package/dist/types/modes/types.d.ts +28 -2
- package/dist/types/modes/utils/abort-message.d.ts +1 -1
- package/dist/types/modes/utils/context-usage.d.ts +4 -19
- package/dist/types/modes/utils/irc-message.d.ts +38 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +13 -4
- package/dist/types/notifications/config.d.ts +34 -0
- package/dist/types/notifications/daemon-paths.d.ts +7 -0
- package/dist/types/notifications/index.d.ts +27 -0
- package/dist/types/notifications/lifecycle-control-runtime.d.ts +12 -4
- package/dist/types/notifications/notification-service.d.ts +144 -0
- package/dist/types/notifications/rate-limit-pool.d.ts +27 -9
- package/dist/types/notifications/telegram-daemon-control.d.ts +6 -0
- package/dist/types/notifications/telegram-daemon.d.ts +130 -3
- package/dist/types/notifications/telegram-reference.d.ts +19 -2
- package/dist/types/notifications/topic-registry.d.ts +24 -4
- package/dist/types/registry/agent-registry.d.ts +2 -0
- package/dist/types/rlm/index.d.ts +1 -1
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/secrets/obfuscator.d.ts +1 -1
- package/dist/types/session/agent-session.d.ts +40 -3
- package/dist/types/session/cache-economics.d.ts +79 -0
- package/dist/types/session/context-estimation.d.ts +31 -0
- package/dist/types/session/provider-safety-stop.d.ts +5 -0
- package/dist/types/session/session-manager.d.ts +124 -4
- package/dist/types/session/session-storage.d.ts +155 -13
- package/dist/types/setup/credential-auto-import.d.ts +2 -2
- package/dist/types/skc-runtime/session-state-sidecar.d.ts +34 -3
- package/dist/types/skc-runtime/state-schema.d.ts +19 -19
- package/dist/types/skc-runtime/tmux-common.d.ts +6 -0
- package/dist/types/skc-runtime/tmux-owner-isolation-cli.d.ts +5 -0
- package/dist/types/skc-runtime/tmux-owner-isolation.d.ts +309 -0
- package/dist/types/skc-runtime/tmux-sessions.d.ts +49 -17
- package/dist/types/task/agents.d.ts +2 -2
- package/dist/types/task/executor.d.ts +3 -0
- package/dist/types/task/receipt.d.ts +3 -1
- package/dist/types/task/types.d.ts +35 -27
- package/dist/types/tools/ask-answer-registry.d.ts +5 -0
- package/dist/types/tools/bash.d.ts +1 -1
- package/dist/types/tools/browser/tab-supervisor.d.ts +6 -0
- package/dist/types/tools/browser.d.ts +28 -28
- package/dist/types/tools/computer.d.ts +20 -20
- package/dist/types/tools/cron.d.ts +2 -2
- package/dist/types/tools/debug.d.ts +40 -40
- package/dist/types/tools/gh.d.ts +10 -10
- package/dist/types/tools/image-gen.d.ts +2 -2
- package/dist/types/tools/index.d.ts +58 -6
- package/dist/types/tools/monitor.d.ts +6 -6
- package/dist/types/tools/skill-discovery.d.ts +4 -4
- package/dist/types/tools/subagent.d.ts +12 -12
- package/dist/types/tools/telegram-send.d.ts +7 -0
- package/dist/types/tools/todo-write.d.ts +8 -8
- package/dist/types/utils/external-editor.d.ts +2 -0
- package/dist/types/web/insane/bridge.d.ts +9 -9
- package/dist/types/web/search/index.d.ts +4 -4
- package/package.json +8 -8
- package/scripts/g004-tmux-smoke.ts +196 -36
- package/src/cli/daemon-cli.ts +19 -29
- package/src/cli/malloc-env-guard.test.ts +104 -0
- package/src/cli/malloc-env-guard.ts +149 -0
- package/src/cli/notify-cli.ts +78 -14
- package/src/cli/session-picker.ts +23 -40
- package/src/cli/update-cli.ts +56 -37
- package/src/cli.ts +51 -10
- package/src/commands/daemon.ts +19 -5
- package/src/commands/harness.ts +515 -47
- package/src/commands/launch.ts +11 -3
- package/src/commands/notify.ts +5 -1
- package/src/commands/session.ts +6 -1
- package/src/config/keybindings.ts +5 -0
- package/src/config/model-profile-activation.ts +1 -1
- package/src/config/model-profiles.ts +14 -14
- package/src/config/settings-schema.ts +41 -1
- package/src/config/settings.ts +96 -45
- package/src/coordinator/contract.ts +1 -0
- package/src/coordinator-mcp/model-preset.ts +100 -0
- package/src/coordinator-mcp/policy.ts +30 -0
- package/src/coordinator-mcp/server.ts +2958 -430
- package/src/coordinator-mcp/session-reaper.ts +129 -0
- package/src/daemon/control-types.ts +11 -0
- package/src/daemon/operator-contract.ts +121 -0
- package/src/defaults/skc/extensions/grok-cli-vendor/src/models/catalog.ts +57 -17
- package/src/defaults/skc/extensions/grok-cli-vendor/src/payload/sanitize.ts +15 -2
- package/src/defaults/skc/extensions/grok-cli-vendor/src/provider/register.ts +5 -1
- package/src/extensibility/extensions/runner.ts +1 -1
- package/src/extensibility/extensions/types.ts +3 -1
- package/src/internal-urls/docs-index.generated.ts +10 -9
- package/src/internal-urls/local-protocol.ts +29 -10
- package/src/main.ts +301 -80
- package/src/modes/acp/acp-agent.ts +730 -100
- package/src/modes/acp/acp-mode.ts +29 -2
- package/src/modes/components/assistant-message.ts +32 -3
- package/src/modes/components/bash-execution.ts +43 -13
- package/src/modes/components/custom-editor.ts +5 -0
- package/src/modes/components/footer.ts +3 -3
- package/src/modes/components/hook-selector.ts +12 -0
- package/src/modes/components/irc-sidebar.ts +206 -0
- package/src/modes/components/pet-selector.ts +55 -0
- package/src/modes/components/sayknow-pet-widget.ts +360 -0
- package/src/modes/components/session-selector.ts +222 -221
- package/src/modes/components/settings-selector.ts +10 -0
- package/src/modes/components/status-line/segments.ts +14 -7
- package/src/modes/components/status-line/types.ts +1 -1
- package/src/modes/components/status-line.ts +4 -171
- package/src/modes/components/tool-execution.ts +47 -6
- package/src/modes/components/user-message.ts +26 -9
- package/src/modes/controllers/command-controller.ts +28 -2
- package/src/modes/controllers/event-controller.ts +159 -36
- package/src/modes/controllers/extension-ui-controller.ts +37 -18
- package/src/modes/controllers/input-controller.ts +8 -2
- package/src/modes/controllers/selector-controller.ts +62 -15
- package/src/modes/interactive-mode.ts +199 -7
- package/src/modes/irc-observation-ledger.ts +127 -0
- package/src/modes/print-mode.ts +228 -92
- package/src/modes/rpc/rpc-client.ts +58 -1
- package/src/modes/rpc/rpc-mode.ts +286 -85
- package/src/modes/rpc/rpc-types.ts +15 -1
- package/src/modes/shared/agent-wire/command-dispatch.ts +33 -1
- package/src/modes/shared/agent-wire/command-validation.ts +10 -0
- package/src/modes/shared/agent-wire/deep-interview-gate.ts +45 -2
- package/src/modes/shared/agent-wire/scopes.ts +1 -0
- package/src/modes/shared/agent-wire/unattended-session.ts +288 -1
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +130 -20
- package/src/modes/types.ts +34 -2
- package/src/modes/utils/context-usage.ts +56 -92
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/modes/utils/irc-message.ts +138 -0
- package/src/modes/utils/ui-helpers.ts +216 -50
- package/src/notifications/config.ts +44 -0
- package/src/notifications/daemon-paths.ts +8 -0
- package/src/notifications/index.ts +535 -75
- package/src/notifications/lifecycle-control-runtime.ts +930 -77
- package/src/notifications/notification-service.ts +710 -0
- package/src/notifications/rate-limit-pool.ts +46 -12
- package/src/notifications/telegram-daemon-control.ts +27 -2
- package/src/notifications/telegram-daemon.ts +635 -94
- package/src/notifications/telegram-reference.ts +73 -13
- package/src/notifications/topic-registry.ts +86 -9
- package/src/prompts/system/irc-peer-roster.md +1 -0
- package/src/prompts/system/subagent-system-prompt.md +1 -0
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/tools/irc.md +1 -1
- package/src/registry/agent-registry.ts +3 -0
- package/src/sdk.ts +52 -1
- package/src/secrets/obfuscator.ts +4 -2
- package/src/session/agent-session.ts +670 -217
- package/src/session/cache-economics.ts +275 -0
- package/src/session/context-estimation.ts +91 -0
- package/src/session/provider-safety-stop.ts +9 -0
- package/src/session/session-dump-format.ts +6 -0
- package/src/session/session-manager.ts +809 -39
- package/src/session/session-storage.ts +582 -38
- package/src/skc-runtime/session-state-sidecar.ts +756 -135
- package/src/skc-runtime/tmux-common.ts +26 -7
- package/src/skc-runtime/tmux-gc.ts +52 -9
- package/src/skc-runtime/tmux-owner-isolation-cli.ts +185 -0
- package/src/skc-runtime/tmux-owner-isolation.ts +2060 -0
- package/src/skc-runtime/tmux-sessions.ts +871 -68
- package/src/slash-commands/builtin-registry.ts +153 -9
- package/src/slash-commands/helpers/context-report.ts +26 -4
- package/src/task/executor.ts +12 -3
- package/src/task/index.ts +8 -0
- package/src/task/receipt.ts +7 -2
- package/src/task/types.ts +26 -0
- package/src/tools/ask-answer-registry.ts +25 -0
- package/src/tools/browser/tab-supervisor.ts +63 -6
- package/src/tools/browser.ts +8 -3
- package/src/tools/index.ts +81 -6
- package/src/tools/sqlite-reader.ts +8 -4
- package/src/tui/output-block.ts +18 -6
- package/src/utils/external-editor.ts +6 -1
|
@@ -21,13 +21,17 @@ import type { EvalExecutionComponent } from "./components/eval-execution";
|
|
|
21
21
|
import type { HookEditorComponent } from "./components/hook-editor";
|
|
22
22
|
import type { HookInputComponent } from "./components/hook-input";
|
|
23
23
|
import type { HookSelectorComponent } from "./components/hook-selector";
|
|
24
|
+
import { type PetMode, SayknowPetWidget } from "./components/sayknow-pet-widget";
|
|
24
25
|
import { StatusLineComponent } from "./components/status-line";
|
|
25
26
|
import type { ToolExecutionHandle } from "./components/tool-execution";
|
|
26
27
|
import { type WelcomeLogoMode } from "./components/welcome";
|
|
28
|
+
import { IrcObservationLedger } from "./irc-observation-ledger";
|
|
27
29
|
import { OAuthManualInputManager } from "./oauth-manual-input";
|
|
28
30
|
import type { Theme } from "./theme/theme";
|
|
29
|
-
import type { CompactionQueuedMessage, InteractiveModeContext, SubmittedUserInput, TodoItem, TodoPhase } from "./types";
|
|
31
|
+
import type { CompactionQueuedMessage, InteractiveModeContext, IrcArrivalSnapshot, SubmittedUserInput, TodoItem, TodoPhase, TranscriptRebuildPolicy } from "./types";
|
|
32
|
+
import type { ParsedIrcMessage } from "./utils/irc-message";
|
|
30
33
|
export declare const DEFAULT_COMPOSER_PLACEHOLDER: string;
|
|
34
|
+
export declare function getWelcomeTranscriptReservedRows(chatContainer: Container, width: number): number;
|
|
31
35
|
export type WelcomeBannerSettingMode = "auto" | "unicode" | "square" | "ascii";
|
|
32
36
|
export declare function resolveWelcomeLogoMode(mode: WelcomeBannerSettingMode, env?: Record<string, string | undefined>, platform?: NodeJS.Platform): WelcomeLogoMode;
|
|
33
37
|
/** Options for creating an InteractiveMode instance (for future API use) */
|
|
@@ -51,6 +55,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
51
55
|
keybindings: KeybindingsManager;
|
|
52
56
|
agent: Agent;
|
|
53
57
|
historyStorage?: HistoryStorage;
|
|
58
|
+
readonly ircLedger: IrcObservationLedger;
|
|
54
59
|
ui: TUI;
|
|
55
60
|
chatContainer: Container;
|
|
56
61
|
pendingMessagesContainer: Container;
|
|
@@ -61,6 +66,8 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
61
66
|
editorContainer: Container;
|
|
62
67
|
hookWidgetContainerAbove: Container;
|
|
63
68
|
hookWidgetContainerBelow: Container;
|
|
69
|
+
petFloorContainer: Container;
|
|
70
|
+
petWidget: SayknowPetWidget | undefined;
|
|
64
71
|
statusLine: StatusLineComponent;
|
|
65
72
|
isInitialized: boolean;
|
|
66
73
|
isBackgrounded: boolean;
|
|
@@ -132,7 +139,10 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
132
139
|
updateEditorChrome(): void;
|
|
133
140
|
updateEditorBorderColor(): void;
|
|
134
141
|
updateEditorTopBorder(): void;
|
|
135
|
-
|
|
142
|
+
setPetMode(mode: PetMode): void;
|
|
143
|
+
previewPetMode(mode: PetMode): void;
|
|
144
|
+
restoreComposer(): void;
|
|
145
|
+
rebuildChatFromMessages(policy: TranscriptRebuildPolicy): void;
|
|
136
146
|
/** Apply any deferred model switch after the current stream ends. */
|
|
137
147
|
flushPendingModelSwitch(): Promise<void>;
|
|
138
148
|
handlePlanModeCommand(initialPrompt?: string): Promise<void>;
|
|
@@ -166,15 +176,22 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
166
176
|
addMessageToChat(message: AgentMessage, options?: {
|
|
167
177
|
populateHistory?: boolean;
|
|
168
178
|
}): Component[];
|
|
179
|
+
addLiveIrcObservationToChat(message: ParsedIrcMessage, arrival: IrcArrivalSnapshot): Component[];
|
|
180
|
+
removeRenderedIrcInlineComponents(observationId: string): readonly Component[] | undefined;
|
|
181
|
+
resetRenderedIrcInlineComponents(): readonly (readonly Component[])[];
|
|
169
182
|
renderSessionContext(sessionContext: SessionContext, options?: {
|
|
170
183
|
updateFooter?: boolean;
|
|
171
184
|
populateHistory?: boolean;
|
|
172
185
|
}): void;
|
|
186
|
+
rebuildInitialMessages(policy: TranscriptRebuildPolicy, prebuiltContext?: SessionContext, options?: {
|
|
187
|
+
preserveExistingChat?: boolean;
|
|
188
|
+
}): void;
|
|
173
189
|
renderInitialMessages(prebuiltContext?: SessionContext, options?: {
|
|
174
190
|
preserveExistingChat?: boolean;
|
|
175
191
|
}): void;
|
|
176
192
|
getUserMessageText(message: Message): string;
|
|
177
193
|
findLastAssistantMessage(): AssistantMessage | undefined;
|
|
194
|
+
getAssistantViewportAnchorId(message: AssistantMessage): string;
|
|
178
195
|
extractAssistantText(message: AssistantMessage): string;
|
|
179
196
|
handleExportCommand(text: string): Promise<void>;
|
|
180
197
|
handleDumpCommand(): void;
|
|
@@ -213,6 +230,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
213
230
|
openInBrowser(urlOrPath: string): void;
|
|
214
231
|
showSettingsSelector(): void;
|
|
215
232
|
showThemeSelector(): void;
|
|
233
|
+
showPetSelector(): void;
|
|
216
234
|
showHistorySearch(): void;
|
|
217
235
|
showExtensionsDashboard(): void;
|
|
218
236
|
showAgentsDashboard(): void;
|
|
@@ -244,6 +262,10 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
244
262
|
}): Promise<void>;
|
|
245
263
|
toggleToolOutputExpansion(): void;
|
|
246
264
|
setToolsExpanded(expanded: boolean): void;
|
|
265
|
+
captureIrcArrivalSnapshot(): IrcArrivalSnapshot;
|
|
266
|
+
toggleIrcSidebar(): void;
|
|
267
|
+
applyIrcSidebarAvailability(enabled: boolean): void;
|
|
268
|
+
resetIrcSidebarSession(): void;
|
|
247
269
|
toggleThinkingBlockVisibility(): void;
|
|
248
270
|
toggleTodoExpansion(): void;
|
|
249
271
|
setTodos(todos: TodoItem[] | TodoPhase[]): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ParsedIrcMessage } from "./utils/irc-message";
|
|
2
|
+
type InlineMode = "persistent" | "ephemeral";
|
|
3
|
+
export type IrcObservationRecord = Readonly<ParsedIrcMessage & {
|
|
4
|
+
mode: InlineMode;
|
|
5
|
+
observedAt: number;
|
|
6
|
+
sequence: number;
|
|
7
|
+
expiresAt?: number;
|
|
8
|
+
retainedUtf8Bytes: number;
|
|
9
|
+
}>;
|
|
10
|
+
/** Runtime-only IRC observations. This intentionally has no persistence layer. */
|
|
11
|
+
export declare class IrcObservationLedger {
|
|
12
|
+
#private;
|
|
13
|
+
/** Inline observations expire after 10 seconds; closed-panel observations persist inline. */
|
|
14
|
+
observe(message: ParsedIrcMessage, panelVisibleAtObservation: boolean): IrcObservationRecord | undefined;
|
|
15
|
+
getRecord(observationId: string): IrcObservationRecord | undefined;
|
|
16
|
+
getSidebarRecords(): readonly IrcObservationRecord[];
|
|
17
|
+
getInlineProjection(now: number): readonly IrcObservationRecord[];
|
|
18
|
+
/** Returns and clears IDs whose retained payload was released. */
|
|
19
|
+
drainEvictedObservationIds(): readonly string[];
|
|
20
|
+
reset(): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -20,9 +20,8 @@ export interface PrintModeOptions {
|
|
|
20
20
|
/** Images to attach to the initial message */
|
|
21
21
|
initialImages?: ImageContent[];
|
|
22
22
|
/**
|
|
23
|
-
* When true,
|
|
24
|
-
*
|
|
25
|
-
* finalization/cleanup before the process exits.
|
|
23
|
+
* When true, a terminal assistant error/abort leaves process exit status
|
|
24
|
+
* untouched so the caller can run its own finalization and status handling.
|
|
26
25
|
*/
|
|
27
26
|
suppressProcessExit?: boolean;
|
|
28
27
|
}
|
|
@@ -37,7 +36,7 @@ export interface PrintModeOptions {
|
|
|
37
36
|
* events from the subscription and does not run this terminal-error branch, so
|
|
38
37
|
* it is intentionally NOT covered by this exit code.
|
|
39
38
|
*/
|
|
40
|
-
export declare const CONTEXT_OVERFLOW_EXIT_CODE =
|
|
39
|
+
export declare const CONTEXT_OVERFLOW_EXIT_CODE = 78;
|
|
41
40
|
/**
|
|
42
41
|
* Run in print (single-shot) mode.
|
|
43
42
|
* Sends prompts to the agent and outputs the result.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Spawns the agent in RPC mode and provides a typed API for all operations.
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
6
|
+
import { type AgentEvent, type AgentMessage, type AgentToolResult, type ResolvedThinkingLevel, ThinkingLevel } from "@sayknow-cli/agent-core";
|
|
7
7
|
import type { CompactionResult } from "@sayknow-cli/agent-core/compaction";
|
|
8
8
|
import type { ImageContent, Model } from "@sayknow-cli/ai";
|
|
9
9
|
import type { BashResult } from "../../exec/bash-executor";
|
|
@@ -36,6 +36,11 @@ export interface RpcClientOptions {
|
|
|
36
36
|
customTools?: RpcClientCustomTool[];
|
|
37
37
|
}
|
|
38
38
|
export type ModelInfo = Pick<Model, "provider" | "id" | "contextWindow" | "reasoning" | "thinking">;
|
|
39
|
+
export type RpcDefaultModelSelection = {
|
|
40
|
+
readonly provider: string;
|
|
41
|
+
readonly modelId: string;
|
|
42
|
+
readonly thinkingLevel: ResolvedThinkingLevel;
|
|
43
|
+
};
|
|
39
44
|
export type RpcEventListener = (event: AgentEvent) => void;
|
|
40
45
|
export type RpcSessionEventListener = (event: AgentSessionEvent) => void;
|
|
41
46
|
export interface RpcClientToolContext<TDetails = unknown> {
|
|
@@ -149,6 +154,7 @@ export declare class RpcClient {
|
|
|
149
154
|
provider: string;
|
|
150
155
|
id: string;
|
|
151
156
|
}>;
|
|
157
|
+
setDefaultModelSelection(provider: string, modelId: string, thinkingLevel: ResolvedThinkingLevel): Promise<RpcDefaultModelSelection>;
|
|
152
158
|
/**
|
|
153
159
|
* Cycle to next model.
|
|
154
160
|
*/
|
|
@@ -18,7 +18,7 @@ export type PendingExtensionRequest = {
|
|
|
18
18
|
resolve: (response: RpcExtensionUIResponse) => void;
|
|
19
19
|
reject: (error: Error) => void;
|
|
20
20
|
};
|
|
21
|
-
type RpcOutput = (obj: RpcResponse | RpcExtensionUIRequest | RpcHostToolCallRequest | RpcHostToolCancelRequest | RpcHostUriRequest | RpcHostUriCancelRequest | object) => void
|
|
21
|
+
type RpcOutput = (obj: RpcResponse | RpcExtensionUIRequest | RpcHostToolCallRequest | RpcHostToolCancelRequest | RpcHostUriRequest | RpcHostUriCancelRequest | object) => Promise<void>;
|
|
22
22
|
export declare function shouldEmitRpcTitlesForTest(): boolean;
|
|
23
23
|
/**
|
|
24
24
|
* Cancellation commands bypass the ordered serial chain because they must
|
|
@@ -63,6 +63,7 @@ export declare function isFastLaneRpcCommand(type: RpcCommand["type"]): boolean;
|
|
|
63
63
|
*/
|
|
64
64
|
export declare function createRpcCommandScheduler(run: (command: RpcCommand) => Promise<void>, track: (task: Promise<void>) => void): {
|
|
65
65
|
dispatch: (command: RpcCommand) => void;
|
|
66
|
+
close: () => void;
|
|
66
67
|
};
|
|
67
68
|
export { RpcListenRefusedError } from "./rpc-socket-security";
|
|
68
69
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Commands are sent as JSON lines on stdin.
|
|
5
5
|
* Responses and events are emitted as JSON lines on stdout.
|
|
6
6
|
*/
|
|
7
|
-
import type { AgentMessage, AgentToolResult, ThinkingLevel } from "@sayknow-cli/agent-core";
|
|
7
|
+
import type { AgentMessage, AgentToolResult, ResolvedThinkingLevel, ThinkingLevel } from "@sayknow-cli/agent-core";
|
|
8
8
|
import type { CompactionResult } from "@sayknow-cli/agent-core/compaction";
|
|
9
9
|
import type { Effort, ImageContent, Model } from "@sayknow-cli/ai";
|
|
10
10
|
import type { BashResult } from "../../exec/bash-executor";
|
|
@@ -69,6 +69,12 @@ export type RpcCommand = {
|
|
|
69
69
|
type: "set_model";
|
|
70
70
|
provider: string;
|
|
71
71
|
modelId: string;
|
|
72
|
+
} | {
|
|
73
|
+
id?: string;
|
|
74
|
+
type: "set_default_model_selection";
|
|
75
|
+
provider: string;
|
|
76
|
+
modelId: string;
|
|
77
|
+
thinkingLevel?: ResolvedThinkingLevel;
|
|
72
78
|
} | {
|
|
73
79
|
id?: string;
|
|
74
80
|
type: "cycle_model";
|
|
@@ -278,6 +284,16 @@ export type RpcResponse = {
|
|
|
278
284
|
command: "set_model";
|
|
279
285
|
success: true;
|
|
280
286
|
data: Model;
|
|
287
|
+
} | {
|
|
288
|
+
id?: string;
|
|
289
|
+
type: "response";
|
|
290
|
+
command: "set_default_model_selection";
|
|
291
|
+
success: true;
|
|
292
|
+
data: {
|
|
293
|
+
provider: string;
|
|
294
|
+
modelId: string;
|
|
295
|
+
thinkingLevel: ResolvedThinkingLevel;
|
|
296
|
+
};
|
|
281
297
|
} | {
|
|
282
298
|
id?: string;
|
|
283
299
|
type: "response";
|
|
@@ -42,6 +42,8 @@ export interface AskGateQuestion {
|
|
|
42
42
|
deepInterview?: AskGateDeepInterviewState;
|
|
43
43
|
/** Override the emitted workflow gate address for non-deep-interview ask prompts. */
|
|
44
44
|
workflowGate?: AskGateWorkflowGateMeta;
|
|
45
|
+
allowEmpty?: boolean;
|
|
46
|
+
navigationLabel?: "Next" | "Done";
|
|
45
47
|
}
|
|
46
48
|
export interface AskGateResult {
|
|
47
49
|
id: string;
|
|
@@ -90,5 +92,11 @@ export declare function questionToGate(question: AskGateQuestion): OpenGateInput
|
|
|
90
92
|
* semantically invalid answer.
|
|
91
93
|
*/
|
|
92
94
|
export declare function gateAnswerToResult(question: AskGateQuestion, answer: unknown): AskGateResult;
|
|
95
|
+
/**
|
|
96
|
+
* Classify an accepted ask-domain gate answer independently of its transport.
|
|
97
|
+
* Schema-invalid and semantically invalid answers throw, so callers leave the
|
|
98
|
+
* durable gate pending rather than treating them as a non-committing answer.
|
|
99
|
+
*/
|
|
100
|
+
export declare function classifyAskGateDisposition(gate: Pick<OpenGateInput, "context" | "options">, answer: unknown): "commit" | "resolve_without_commit";
|
|
93
101
|
/** Convenience: map a batch of ask questions to gate open-inputs. */
|
|
94
102
|
export declare function questionsToGates(questions: AskGateQuestion[]): OpenGateInput[];
|
|
@@ -156,6 +156,11 @@ export declare class UnattendedRunController {
|
|
|
156
156
|
/** Returns the in-flight/settled abort completion once aborting has begun. */
|
|
157
157
|
get abortCompletion(): Promise<void> | undefined;
|
|
158
158
|
private fireAbort;
|
|
159
|
+
/**
|
|
160
|
+
* Invoke every configured abort hook exactly once with per-hook isolation, so a
|
|
161
|
+
* failing hook never prevents the other cancellation surfaces from running.
|
|
162
|
+
* Returns the number of hooks that rejected.
|
|
163
|
+
*/
|
|
159
164
|
private runAbortHooks;
|
|
160
165
|
}
|
|
161
166
|
export {};
|
|
@@ -15,10 +15,45 @@
|
|
|
15
15
|
* RPC server can route `negotiate_unattended` + `workflow_gate_response` here.
|
|
16
16
|
*/
|
|
17
17
|
import type { Model } from "@sayknow-cli/ai";
|
|
18
|
+
import type { AskSelectedAckOutcome } from "../../../tools";
|
|
18
19
|
import type { RpcCommand, RpcUnattendedAccepted, RpcUnattendedDeclaration, RpcWorkflowGate, RpcWorkflowGateResolution, RpcWorkflowGateResponse } from "../../rpc/rpc-types";
|
|
19
20
|
import type { RpcUnattendedControlPlane } from "./command-dispatch";
|
|
20
21
|
import { type UnattendedAbortHooks, type UnattendedAuditEvent, UnattendedRunController } from "./unattended-run-controller";
|
|
21
22
|
import { type GateStore, type OpenGateInput } from "./workflow-gate-broker";
|
|
23
|
+
export interface WorkflowGateTerminalController {
|
|
24
|
+
completeGateInteractions(gateId: string): void | Promise<void>;
|
|
25
|
+
cancelGateInteractions(gateId: string, reason: string): void | Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export interface WorkflowGateTerminalEvent {
|
|
28
|
+
gateId: string;
|
|
29
|
+
kind: "accepted" | "cancelled";
|
|
30
|
+
origin?: "rpc" | "bridge" | "other" | "telegram_notification";
|
|
31
|
+
reason?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface NotificationGateResolutionOptions {
|
|
34
|
+
interactionActionId: string;
|
|
35
|
+
replyReceiptId: string;
|
|
36
|
+
answerJson: string;
|
|
37
|
+
idempotencyKey?: string;
|
|
38
|
+
requestSelectedAck(input: {
|
|
39
|
+
replyReceiptId: string;
|
|
40
|
+
actionId: string;
|
|
41
|
+
commitKey: string;
|
|
42
|
+
daemonDeadlineAt: number;
|
|
43
|
+
hostTimeoutMs: number;
|
|
44
|
+
}): Promise<AskSelectedAckOutcome>;
|
|
45
|
+
resolveClaim(): void;
|
|
46
|
+
closeClaimInvalid(reason: string): void;
|
|
47
|
+
}
|
|
48
|
+
export interface AskSelectedAckRecoveryParticipant {
|
|
49
|
+
requestRecoveredAskSelectedAck(input: {
|
|
50
|
+
sessionId: string;
|
|
51
|
+
actionId: string;
|
|
52
|
+
commitKey: string;
|
|
53
|
+
deadlineAt: number;
|
|
54
|
+
hostTimeoutMs: number;
|
|
55
|
+
}): Promise<AskSelectedAckOutcome>;
|
|
56
|
+
}
|
|
22
57
|
/**
|
|
23
58
|
* Derive an explicit `providerSupportsTokenCostMetrics` capability from the
|
|
24
59
|
* active model so unattended negotiation fails closed when token/cost usage
|
|
@@ -41,7 +76,10 @@ export interface WorkflowGateEmitter {
|
|
|
41
76
|
*/
|
|
42
77
|
onGateEmitted?(listener: (gate: RpcWorkflowGate) => void): () => void;
|
|
43
78
|
resolveGate?(response: RpcWorkflowGateResponse): Promise<RpcWorkflowGateResolution>;
|
|
79
|
+
resolveGateFromNotification?(response: RpcWorkflowGateResponse, options: NotificationGateResolutionOptions): Promise<RpcWorkflowGateResolution>;
|
|
80
|
+
registerGateTerminalController?(controller: WorkflowGateTerminalController): () => void;
|
|
44
81
|
listPendingGates?(): RpcWorkflowGate[];
|
|
82
|
+
setAckRecoveryParticipant?(participant: AskSelectedAckRecoveryParticipant | null): void;
|
|
45
83
|
}
|
|
46
84
|
export interface UnattendedSessionOptions {
|
|
47
85
|
runId: string;
|
|
@@ -72,10 +110,17 @@ export declare class UnattendedSessionControlPlane implements RpcUnattendedContr
|
|
|
72
110
|
/** Observe every emitted gate (e.g. so an extension can map an ask to its gate_id). */
|
|
73
111
|
onGateEmitted(listener: (gate: RpcWorkflowGate) => void): () => void;
|
|
74
112
|
get controller(): UnattendedRunController | undefined;
|
|
113
|
+
registerGateTerminalController(controller: WorkflowGateTerminalController): () => void;
|
|
114
|
+
setAckRecoveryParticipant(participant: AskSelectedAckRecoveryParticipant | null): void;
|
|
75
115
|
negotiate(declaration: RpcUnattendedDeclaration): RpcUnattendedAccepted;
|
|
76
116
|
preflightCommand(command: RpcCommand): void;
|
|
77
117
|
reconcileUsage(phase?: string): void;
|
|
78
118
|
resolveGate(response: RpcWorkflowGateResponse): Promise<RpcWorkflowGateResolution>;
|
|
119
|
+
resolveGateFromNotification(response: RpcWorkflowGateResponse, options: NotificationGateResolutionOptions): Promise<RpcWorkflowGateResolution>;
|
|
120
|
+
startRecoveryOnce(options?: {
|
|
121
|
+
participantGraceMs?: number;
|
|
122
|
+
}): Promise<void>;
|
|
123
|
+
dispose(reason?: string): void;
|
|
79
124
|
listPendingGates(): import("../../rpc/rpc-types").RpcWorkflowGate[];
|
|
80
125
|
emitGate(input: OpenGateInput): Promise<unknown>;
|
|
81
126
|
recover(): Promise<void>;
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AskSelectedAckOutcome } from "../../../tools";
|
|
2
|
+
import type { RpcWorkflowGate, RpcWorkflowGateContext, RpcWorkflowGateKind, RpcWorkflowGateOption, RpcWorkflowGateResolution, RpcWorkflowGateResponse, RpcWorkflowGateValidationError, RpcWorkflowStage } from "../../rpc/rpc-types";
|
|
3
|
+
export type PersistedSemanticDisposition = "commit" | "resolve_without_commit";
|
|
4
|
+
export type PersistedResolutionOrigin = {
|
|
5
|
+
kind: "generic";
|
|
6
|
+
channel: "rpc" | "bridge" | "other";
|
|
7
|
+
} | {
|
|
8
|
+
kind: "telegram_notification";
|
|
9
|
+
interactionActionId: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "legacy_unknown";
|
|
12
|
+
};
|
|
13
|
+
export type PersistedAckPolicy = {
|
|
14
|
+
kind: "none";
|
|
15
|
+
reason: "non_telegram" | "semantic_noncommit" | "legacy_unproven";
|
|
16
|
+
} | {
|
|
17
|
+
kind: "telegram_selected_v1";
|
|
18
|
+
commitKey: string;
|
|
19
|
+
actionId: string;
|
|
20
|
+
state: "pending" | "attempt_started" | "delivered" | "failed" | "unknown";
|
|
21
|
+
outcome?: AskSelectedAckOutcome;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
};
|
|
24
|
+
export interface GateResolutionOptions {
|
|
25
|
+
semanticDisposition?: PersistedSemanticDisposition;
|
|
26
|
+
resolutionOrigin?: PersistedResolutionOrigin;
|
|
27
|
+
ackPolicy?: PersistedAckPolicy;
|
|
28
|
+
beforeAdvance?: () => Promise<void>;
|
|
29
|
+
}
|
|
2
30
|
export interface PersistedGate {
|
|
3
31
|
gate: RpcWorkflowGate;
|
|
4
32
|
status: "pending" | "accepted";
|
|
@@ -8,6 +36,9 @@ export interface PersistedGate {
|
|
|
8
36
|
answer?: unknown;
|
|
9
37
|
resolution?: RpcWorkflowGateResolution;
|
|
10
38
|
advanced: boolean;
|
|
39
|
+
semanticDisposition?: PersistedSemanticDisposition;
|
|
40
|
+
resolutionOrigin?: PersistedResolutionOrigin;
|
|
41
|
+
ackPolicy?: PersistedAckPolicy;
|
|
11
42
|
}
|
|
12
43
|
export interface GateStore {
|
|
13
44
|
nextSeq(stage: RpcWorkflowStage): number;
|
|
@@ -74,6 +105,8 @@ export interface BrokerHooks {
|
|
|
74
105
|
* it for any gate left `accepted` but not `advanced` by a crash.
|
|
75
106
|
*/
|
|
76
107
|
advance?(gate: RpcWorkflowGate, answer: unknown): void | Promise<void>;
|
|
108
|
+
/** Runs after durable acceptance and before advance, including crash recovery. */
|
|
109
|
+
finalizeAccepted?(record: PersistedGate): Promise<void>;
|
|
77
110
|
/** Append-only audit sink. */
|
|
78
111
|
audit?(event: GateAuditEvent): void;
|
|
79
112
|
}
|
|
@@ -92,7 +125,13 @@ export declare class WorkflowGateBroker {
|
|
|
92
125
|
private readonly runId;
|
|
93
126
|
private readonly store;
|
|
94
127
|
private readonly hooks;
|
|
128
|
+
private readonly recovering;
|
|
129
|
+
private readonly gateLocks;
|
|
130
|
+
private withGateLock;
|
|
95
131
|
constructor(runId: string, store: GateStore, hooks?: BrokerHooks);
|
|
132
|
+
classifyDisposition(gateId: string, answer: unknown): PersistedSemanticDisposition;
|
|
133
|
+
validationError(gateId: string, keyword: string, message: string): RpcWorkflowGateValidationError;
|
|
134
|
+
updateAckPolicy(gateId: string, ackPolicy: PersistedAckPolicy): void;
|
|
96
135
|
private runShort;
|
|
97
136
|
/** Open and emit a gate. The pending record is persisted BEFORE emission. */
|
|
98
137
|
openGate(input: OpenGateInput): RpcWorkflowGate;
|
|
@@ -101,7 +140,8 @@ export declare class WorkflowGateBroker {
|
|
|
101
140
|
* On success the resolution is persisted BEFORE `advance` is invoked exactly
|
|
102
141
|
* once. Invalid answers leave the gate pending (per #315 acceptance).
|
|
103
142
|
*/
|
|
104
|
-
resolve(response: RpcWorkflowGateResponse): Promise<RpcWorkflowGateResolution>;
|
|
143
|
+
resolve(response: RpcWorkflowGateResponse, options?: GateResolutionOptions): Promise<RpcWorkflowGateResolution>;
|
|
144
|
+
private resolveUnlocked;
|
|
105
145
|
/**
|
|
106
146
|
* Recover any gate left `accepted` but not `advanced` by a crash between the
|
|
107
147
|
* durable accept and the advanced commit. Replays `advance` (which must be
|