hankweave 0.5.7 → 0.6.2

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 (79) hide show
  1. package/README.md +12 -11
  2. package/dist/base-process-manager.d.ts +30 -0
  3. package/dist/budget.d.ts +315 -0
  4. package/dist/checkpoint-git.d.ts +98 -0
  5. package/dist/claude-agent-sdk-manager.d.ts +144 -0
  6. package/dist/claude-log-parser.d.ts +63 -0
  7. package/dist/claude-runtime-extractor.d.ts +73 -0
  8. package/dist/codex-runtime-extractor.d.ts +107 -0
  9. package/dist/codon-runner.d.ts +278 -0
  10. package/dist/config-validation/model-validator.d.ts +16 -0
  11. package/dist/config-validation/sentinel.schema.d.ts +6967 -0
  12. package/dist/config.d.ts +40815 -0
  13. package/dist/cost-tracker.d.ts +72 -0
  14. package/dist/execution-planner.d.ts +62 -0
  15. package/dist/execution-thread.d.ts +71 -0
  16. package/dist/exports/schemas.d.ts +9 -0
  17. package/dist/exports/schemas.js +1019 -0
  18. package/dist/exports/types.d.ts +15 -0
  19. package/dist/exports/types.js +60 -0
  20. package/dist/file-resolver.d.ts +33 -0
  21. package/dist/index.js +380 -293
  22. package/dist/index.js.map +33 -29
  23. package/dist/llm/llm-provider-registry.d.ts +207 -0
  24. package/dist/llm/models-dev-schema.d.ts +679 -0
  25. package/dist/llm/provider-config.d.ts +30 -0
  26. package/dist/prompt-builder.d.ts +75 -0
  27. package/dist/prompt-frontmatter.d.ts +61 -0
  28. package/dist/replay-process-manager.d.ts +82 -0
  29. package/dist/runtime-extractor-base.d.ts +120 -0
  30. package/dist/schemas/event-schemas.d.ts +8389 -0
  31. package/dist/schemas/websocket-log-schemas.d.ts +4502 -0
  32. package/dist/shim-process-manager.d.ts +98 -0
  33. package/dist/shim-runtime-extractor.d.ts +51 -0
  34. package/dist/shims/codex/README.md +129 -0
  35. package/dist/shims/codex/THIRDPARTY.md +18 -0
  36. package/dist/shims/codex/VERSION +1 -0
  37. package/dist/shims/codex/common/package.json +24 -0
  38. package/dist/shims/codex/index.js +1154 -970
  39. package/dist/shims/codex/package.json +46 -0
  40. package/dist/shims/codex/tsup.config.ts +16 -0
  41. package/dist/shims/gemini/README.md +59 -0
  42. package/dist/shims/gemini/THIRDPARTY.md +32 -0
  43. package/dist/shims/gemini/VERSION +1 -0
  44. package/dist/shims/gemini/common/package.json +24 -0
  45. package/dist/shims/gemini/index.js +1359 -30
  46. package/dist/shims/gemini/package.json +37 -0
  47. package/dist/shims/opencode/README.md +82 -0
  48. package/dist/shims/opencode/THIRDPARTY.md +32 -0
  49. package/dist/shims/opencode/VERSION +1 -0
  50. package/dist/shims/opencode/common/package.json +24 -0
  51. package/dist/shims/opencode/index.js +1476 -0
  52. package/dist/shims/opencode/package.json +38 -0
  53. package/dist/shims/pi/README.md +87 -0
  54. package/dist/shims/pi/THIRDPARTY.md +24 -0
  55. package/dist/shims/pi/VERSION +1 -0
  56. package/dist/shims/pi/common/package.json +24 -0
  57. package/dist/shims/pi/index.js +249832 -0
  58. package/dist/shims/pi/package.json +53 -0
  59. package/dist/state-manager.d.ts +161 -0
  60. package/dist/state-transition-guards.d.ts +37 -0
  61. package/dist/telemetry/telemetry-types.d.ts +206 -0
  62. package/dist/typed-event-emitter.d.ts +57 -0
  63. package/dist/types/branded-types.d.ts +15 -0
  64. package/dist/types/budget-types.d.ts +82 -0
  65. package/dist/types/claude-session-schema.d.ts +2430 -0
  66. package/dist/types/error-types.d.ts +44 -0
  67. package/dist/types/input-ai-types.d.ts +1070 -0
  68. package/dist/types/llm-call-types.d.ts +3829 -0
  69. package/dist/types/sentinel-types.d.ts +66 -0
  70. package/dist/types/state-types.d.ts +1099 -0
  71. package/dist/types/tool-types.d.ts +86 -0
  72. package/dist/types/types.d.ts +367 -0
  73. package/dist/types/websocket-log-types.d.ts +7 -0
  74. package/dist/utils.d.ts +452 -0
  75. package/package.json +15 -2
  76. package/schemas/hank.schema.json +158 -3
  77. package/schemas/hankweave.schema.json +17 -1
  78. package/shims/codex/index.js +0 -1583
  79. package/shims/gemini/index.js +0 -31
@@ -0,0 +1,63 @@
1
+ import { type AssistantMessage, type ResultMessage, type SystemMessage, type UserMessage } from "./types/claude-session-schema.js";
2
+ import type { Logger } from "./utils.js";
3
+ /**
4
+ * Configuration options for Claude log parser.
5
+ */
6
+ export interface ClaudeLogParserOptions {
7
+ /** Path to the Claude JSONL log file to parse */
8
+ logPath: string;
9
+ /** ID of the codon being parsed (for context) */
10
+ codonId: string;
11
+ /** Callback for system messages (init, info) */
12
+ onSystemMessage?: (msg: SystemMessage) => void;
13
+ /** Callback for assistant messages (Claude's responses) */
14
+ onAssistantMessage?: (msg: AssistantMessage) => void;
15
+ /** Callback for user messages (tool results) */
16
+ onUserMessage?: (msg: UserMessage) => void;
17
+ /** Callback for result messages (success/error) */
18
+ onResultMessage?: (msg: ResultMessage) => void;
19
+ /** How often to check for new log entries (milliseconds) */
20
+ parsingInterval: number;
21
+ /** Optional logger for diagnostic output */
22
+ logger?: Logger;
23
+ }
24
+ /**
25
+ * Real-time parser for Claude's JSON log output.
26
+ *
27
+ * Watches a log file and parses new lines as they're written,
28
+ * validating them against the Claude session schema and calling
29
+ * appropriate callbacks for each message type.
30
+ *
31
+ * Uses both file watching and periodic polling to ensure no
32
+ * messages are missed.
33
+ */
34
+ export declare class ClaudeLogParser {
35
+ private options;
36
+ private buffer;
37
+ private lastPosition;
38
+ private logTimer?;
39
+ private isFirstParse;
40
+ constructor(options: ClaudeLogParserOptions);
41
+ start(): void;
42
+ stop(): void;
43
+ /**
44
+ * Get all parsed messages from the log file.
45
+ * Re-parses the entire log file to collect all messages.
46
+ * Useful for analyzing the entire conversation at process completion.
47
+ */
48
+ getAllMessages(): Array<SystemMessage | AssistantMessage | UserMessage | ResultMessage>;
49
+ /**
50
+ * Force an immediate parse of the log file.
51
+ * Useful when we need to ensure all messages are processed before process termination.
52
+ */
53
+ parseNow(): void;
54
+ /**
55
+ * Parse the log file and return all parsed messages.
56
+ * Supports both incremental parsing (with buffer management) and full file parsing.
57
+ *
58
+ * @param options.noEmit - If true, don't fire callbacks (default: false)
59
+ * @param options.fullParse - If true, parse entire file from scratch (default: false)
60
+ */
61
+ private parseLogFile;
62
+ private parseLogLine;
63
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Claude Runtime Extractor
3
+ *
4
+ * This module handles the extraction of bundled Claude Agent SDK files
5
+ * at runtime for standalone executables. When compiled with Bun, the CLI
6
+ * files are embedded in the executable and need to be extracted to disk
7
+ * before they can be spawned as subprocesses.
8
+ *
9
+ * The extraction is done to a versioned directory to avoid re-extraction
10
+ * on every run and to handle SDK updates cleanly.
11
+ *
12
+ * Build Process:
13
+ * The build script (scripts/build-executable.ts) embeds the SDK files using:
14
+ * bun build --compile --embed node_modules/@anthropic-ai/claude-agent-sdk/cli.js ...
15
+ *
16
+ * At runtime, these embedded files are accessible via Bun.file() using their
17
+ * original paths.
18
+ */
19
+ export declare const CLAUDE_SDK_VERSION = "0.1.70";
20
+ /**
21
+ * Get the extraction directory path.
22
+ * Uses ~/.hankweave/claude-sdk/<version>/ by default.
23
+ */
24
+ export declare function getExtractionDir(): string;
25
+ /**
26
+ * Get the path to the extracted cli.js file.
27
+ */
28
+ export declare function getExtractedCliPath(): string;
29
+ /**
30
+ * Check if embedded files are available (async check).
31
+ * This actually tries to access an embedded file to verify.
32
+ */
33
+ export declare function hasEmbeddedFiles(): Promise<boolean>;
34
+ /**
35
+ * Check if extraction is needed.
36
+ * Returns true if the files don't exist or are outdated.
37
+ */
38
+ export declare function needsExtraction(): boolean;
39
+ /**
40
+ * Extract embedded Claude SDK files to disk.
41
+ *
42
+ * This function reads files that were embedded during compilation using Bun's
43
+ * --embed flag, then extracts them to a versioned directory on first run.
44
+ *
45
+ * The embedded files are accessed using their original paths that were
46
+ * specified during build (e.g., "node_modules/@anthropic-ai/claude-agent-sdk/cli.js").
47
+ *
48
+ * Files extracted:
49
+ * - cli.js - The main Claude Code CLI
50
+ * - resvg.wasm - SVG rendering WASM module
51
+ * - tree-sitter.wasm - Syntax parsing WASM module
52
+ * - tree-sitter-bash.wasm - Bash syntax WASM module
53
+ * - vendor/ripgrep/<platform>/ - Platform-specific ripgrep binaries
54
+ */
55
+ export declare function extractClaudeSdkFiles(): Promise<string>;
56
+ /**
57
+ * Ensure Claude SDK files are available, extracting if necessary.
58
+ *
59
+ * @deprecated Use ClaudeAgentSDKManager.ensureSdkAvailable() instead.
60
+ * This function is kept for backward compatibility.
61
+ *
62
+ * @returns SDK info object with path, version, and cached status
63
+ * @throws Error if extraction fails or extracted file doesn't exist
64
+ */
65
+ export declare function ensureClaudeSdkAvailable(): Promise<{
66
+ path: string | null;
67
+ version: string;
68
+ cached: boolean;
69
+ }>;
70
+ /**
71
+ * Validate the extracted cli.js works by running a simple command.
72
+ */
73
+ export declare function validateExtractedCli(cliPath: string): Promise<boolean>;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Codex Runtime Extractor
3
+ *
4
+ * This module handles the detection and extraction of Codex binaries
5
+ * for different execution contexts. The @openai/codex-sdk package ships
6
+ * with platform-specific binaries in its vendor directory.
7
+ *
8
+ * Execution contexts:
9
+ * 1. Source/NPM mode: Use binary from node_modules/@openai/codex-sdk/vendor/
10
+ * 2. Compiled executable: Extract embedded binary to ~/.hankweave/codex-sdk/
11
+ *
12
+ * The extraction is done to a versioned directory to avoid re-extraction
13
+ * on every run and to handle SDK updates cleanly.
14
+ */
15
+ export declare const CODEX_SDK_VERSION = "0.104.0";
16
+ /**
17
+ * Platform identifier matching @openai/codex-sdk vendor directory structure
18
+ */
19
+ type CodexPlatform = "aarch64-apple-darwin" | "x86_64-apple-darwin" | "aarch64-unknown-linux-musl" | "x86_64-unknown-linux-musl" | "aarch64-pc-windows-msvc" | "x86_64-pc-windows-msvc";
20
+ /**
21
+ * Determine platform identifier matching codex-sdk structure.
22
+ *
23
+ * @param target - Optional build target string (e.g., "linux-x64", "darwin-arm64").
24
+ * If not provided, uses current platform.
25
+ * @throws Error if platform is unsupported
26
+ */
27
+ export declare function getCodexPlatform(target?: string): CodexPlatform;
28
+ /**
29
+ * Get the codex binary filename for the current platform.
30
+ */
31
+ export declare function getCodexBinaryName(): string;
32
+ /**
33
+ * Get the extraction directory path for codex binaries.
34
+ * Uses ~/.hankweave/codex-sdk/<version>/ by default.
35
+ */
36
+ export declare function getCodexExtractionDir(): string;
37
+ /**
38
+ * Get the path to the extracted codex binary.
39
+ */
40
+ export declare function getExtractedCodexPath(): string;
41
+ /**
42
+ * Ensure a binary file has execute permissions on Unix.
43
+ * No-op on Windows. Deno's npm cache may not preserve +x bits.
44
+ */
45
+ export declare function ensureExecutable(binaryPath: string): void;
46
+ /**
47
+ * Locate codex binary using import.meta.resolve.
48
+ *
49
+ * This is a universal fallback that works across all runtimes (Deno, Node.js 20.6+, Bun).
50
+ * It asks the runtime's own module resolver where @openai/codex-sdk (or the platform-specific
51
+ * package) lives, then navigates from the resolved entry point to the vendor binary.
52
+ *
53
+ * This is critical for Deno, which stores npm packages in a global cache rather than
54
+ * in a project-local node_modules/ directory.
55
+ *
56
+ * @returns Path to codex binary, or null if not found
57
+ */
58
+ export declare function locateCodexViaImportResolve(): string | null;
59
+ /**
60
+ * Locate codex binary in node_modules (npm/npx mode).
61
+ * Searches up the directory tree from the module's location to find node_modules/@openai/codex-sdk.
62
+ *
63
+ * This works in both normal installs and npx scenarios:
64
+ * - Normal install: module is in project/node_modules/@southbridgeai/hankweave
65
+ * - NPX: module is in ~/.npm/_npx/.../node_modules/@southbridgeai/hankweave
66
+ * In both cases, @openai/codex-sdk will be found by walking up from the module location.
67
+ *
68
+ * @returns Path to codex binary, or null if not found
69
+ */
70
+ export declare function locateCodexInNodeModules(): string | null;
71
+ /**
72
+ * Check if extraction is needed.
73
+ * Returns true if the binary doesn't exist or is outdated.
74
+ */
75
+ export declare function needsCodexExtraction(): boolean;
76
+ /**
77
+ * Extract embedded codex binary to disk.
78
+ *
79
+ * This function reads the binary that was embedded during compilation using Bun's
80
+ * --embed flag, then extracts it to a versioned directory on first run.
81
+ *
82
+ * @returns Path to extracted codex binary
83
+ * @throws Error if extraction fails
84
+ */
85
+ export declare function extractCodexBinary(): Promise<string>;
86
+ /**
87
+ * Ensure codex binary is available, extracting if necessary.
88
+ *
89
+ * This is the main entry point for getting a codex binary path.
90
+ * Handles both npm/npx mode (use node_modules) and binary mode (extract embedded).
91
+ *
92
+ * @returns Path to codex binary
93
+ * @throws Error if binary cannot be found or extracted
94
+ */
95
+ export declare function ensureCodexAvailable(): Promise<{
96
+ path: string;
97
+ version: string;
98
+ cached: boolean;
99
+ }>;
100
+ /**
101
+ * Validate that the codex binary exists and is executable.
102
+ *
103
+ * @param codexPath - Path to codex binary to validate
104
+ * @returns true if valid, false otherwise
105
+ */
106
+ export declare function validateCodexBinary(codexPath: string): boolean;
107
+ export {};
@@ -0,0 +1,278 @@
1
+ import type { Budget } from "./budget.js";
2
+ import type { LlmProviderRegistry } from "./llm/llm-provider-registry.js";
3
+ import type { ModelInfo } from "./llm/models-dev-schema.js";
4
+ import type { StateManager } from "./state-manager.js";
5
+ import { TypedEventEmitter } from "./typed-event-emitter.js";
6
+ import type { CodonId, RunId, SessionId } from "./types/branded-types.js";
7
+ import type { AssistantMessage, ResultMessage, SystemMessage, UserMessage } from "./types/claude-session-schema.js";
8
+ import type { Codon, ShimSelfTestResult, TokenUsage } from "./types/types.js";
9
+ import { type Logger } from "./utils.js";
10
+ /**
11
+ * Information about an extension, passed to the onExtension callback
12
+ */
13
+ export interface ExtensionInfo {
14
+ extensionNumber: number;
15
+ sessionId: SessionId;
16
+ previousExitCode: number;
17
+ wasContextExceeded: boolean;
18
+ /** The prompt being used for this extension */
19
+ exhaustWithPrompt: string;
20
+ }
21
+ /**
22
+ * Events emitted by CodonRunner during execution
23
+ */
24
+ export interface CodonRunnerEvents extends Record<string, unknown[]> {
25
+ exit: [code: number, contextExceeded: boolean, extensionCount: number];
26
+ error: [error: Error];
27
+ systemMessage: [msg: SystemMessage];
28
+ assistantMessage: [msg: AssistantMessage];
29
+ userMessage: [msg: UserMessage];
30
+ resultMessage: [msg: ResultMessage];
31
+ costIncremented: [
32
+ data: {
33
+ codonId: string;
34
+ tokens: TokenUsage;
35
+ totalCost: number;
36
+ modelId?: string;
37
+ }
38
+ ];
39
+ finalCostSet: [
40
+ data: {
41
+ codonId: string;
42
+ tokens: TokenUsage;
43
+ totalCost: number;
44
+ modelUsage?: unknown;
45
+ modelId?: string;
46
+ }
47
+ ];
48
+ stdout: [data: string];
49
+ stderr: [data: string];
50
+ }
51
+ /**
52
+ * Extension configuration for codons that support context exhaustion
53
+ */
54
+ export interface ExtensionConfig {
55
+ /** Prompt to send for each extension */
56
+ exhaustWithPrompt: string;
57
+ /** Maximum number of extensions before forcing completion (default: 100) */
58
+ maxExtensions: number;
59
+ }
60
+ /**
61
+ * Base configuration shared by all CodonRunner instances
62
+ */
63
+ interface BaseCodonRunnerConfig {
64
+ codon: Codon;
65
+ codonId: CodonId;
66
+ runId: RunId;
67
+ stateManager: StateManager;
68
+ executionPath: string;
69
+ agentRootPath: string;
70
+ logger: Logger;
71
+ llmRegistry: LlmProviderRegistry;
72
+ logParsingInterval?: number;
73
+ anthropicBaseUrl?: string;
74
+ logPath: string;
75
+ globalSystemPrompt?: string | null;
76
+ shimIdleTimeout?: number;
77
+ budget: Budget;
78
+ /** If provided, use ReplayProcessManager instead of real process managers */
79
+ replayConfig?: {
80
+ /** Absolute path to the source JSONL log file to replay */
81
+ sourceLogPath: string;
82
+ /** Delay in ms between writing lines (default: 5) */
83
+ replaySpeed?: number;
84
+ };
85
+ }
86
+ /**
87
+ * Configuration for a CodonRunner without extension support
88
+ */
89
+ interface CodonRunnerConfigWithoutExtension extends BaseCodonRunnerConfig {
90
+ extensionConfig?: undefined;
91
+ shouldInterrupt?: undefined;
92
+ onExtension?: undefined;
93
+ }
94
+ /**
95
+ * Configuration for a CodonRunner with extension support.
96
+ * When extensions are enabled, interrupt check and event callbacks are required.
97
+ */
98
+ interface CodonRunnerConfigWithExtension extends BaseCodonRunnerConfig {
99
+ /** Extension configuration - enables automatic re-running until context exhaustion */
100
+ extensionConfig: ExtensionConfig;
101
+ /** Required: Check if user requested skip/force-stop */
102
+ shouldInterrupt: () => boolean;
103
+ /** Required: Called on each extension to emit events and update state */
104
+ onExtension: (info: ExtensionInfo) => void;
105
+ }
106
+ /**
107
+ * Configuration for creating a CodonRunner.
108
+ *
109
+ * Uses discriminated union: when extensionConfig is provided,
110
+ * shouldInterrupt and onExtension become required.
111
+ */
112
+ export type CodonRunnerConfig = CodonRunnerConfigWithoutExtension | CodonRunnerConfigWithExtension;
113
+ /**
114
+ * CodonRunner encapsulates all logic needed to execute a single codon.
115
+ *
116
+ * Responsibilities:
117
+ * - Create and manage ClaudeLogParser for this codon
118
+ * - Create and manage ShimProcessManager for this codon
119
+ * - Forward events from parser and process manager
120
+ * - Provide clean lifecycle: construct → run → cleanup
121
+ *
122
+ * The runner owns both the LogParser and ProcessManager instances,
123
+ * ensuring they are created together, used together, and cleaned up together.
124
+ */
125
+ /**
126
+ * Failure reasons that prevent extension
127
+ */
128
+ type FailureReason = {
129
+ type: "timeout";
130
+ retriable: boolean;
131
+ } | {
132
+ type: "rate-limit";
133
+ retriable: boolean;
134
+ } | {
135
+ type: "api-error";
136
+ retriable: boolean;
137
+ } | {
138
+ type: "unknown";
139
+ retriable: boolean;
140
+ };
141
+ /**
142
+ * Determines whether a codon should extend based on exit conditions.
143
+ * Pure function for unit testing.
144
+ *
145
+ * Extension triggers when ALL conditions are met:
146
+ * - Extension config provided
147
+ * - Not interrupted (skip/force-stop)
148
+ * - Under max extensions
149
+ * - Exit code 0
150
+ * - Result message received
151
+ * - No failure reason
152
+ * - Context not yet exceeded
153
+ */
154
+ export declare function shouldExtendCodon(params: {
155
+ exitCode: number;
156
+ resultMessageReceived: boolean;
157
+ isContextExceeded: boolean;
158
+ extensionConfig: ExtensionConfig | undefined;
159
+ extensionCount: number;
160
+ isInterrupted: boolean;
161
+ failureReason: FailureReason | undefined;
162
+ isBudgetExceeded?: boolean;
163
+ }): boolean;
164
+ export declare class CodonRunner extends TypedEventEmitter<CodonRunnerEvents> {
165
+ private readonly config;
166
+ private readonly logParser;
167
+ private readonly costTracker;
168
+ private processManager;
169
+ private readonly logPath;
170
+ private readonly budgetExceededListener;
171
+ private isCleanedUp;
172
+ private successResultReceived;
173
+ private extensionCount;
174
+ private resultMessageReceived;
175
+ private failureReason;
176
+ private currentSessionId;
177
+ constructor(config: CodonRunnerConfig);
178
+ /**
179
+ * Check if a model can be run by CodonRunner.
180
+ *
181
+ * CodonRunner supports:
182
+ * - Anthropic models via ClaudeAgentSDKManager
183
+ * - Google models via ShimProcessManager (gemini shim)
184
+ * - OpenAI models via ShimProcessManager (codex shim)
185
+ *
186
+ * @param model - The ModelInfo to check
187
+ * @returns true if the model can be executed, false otherwise
188
+ */
189
+ static canRun(model: ModelInfo): boolean;
190
+ /**
191
+ * Run self-test for a model without creating a full CodonRunner instance.
192
+ * Useful for validation and testing where you only have model info.
193
+ *
194
+ * @param modelInfo - The model to test
195
+ * @param executionPath - Temporary execution path for the test
196
+ * @param logger - Logger instance for recording test progress
197
+ * @param anthropicBaseUrl - Optional custom Anthropic API base URL
198
+ * @returns Promise resolving to self-test results
199
+ */
200
+ static runSelfTestForModel(modelInfo: ModelInfo, executionPath: string, logger: Logger, anthropicBaseUrl?: string): Promise<ShimSelfTestResult>;
201
+ /**
202
+ * Create ClaudeLogParser for this codon with event forwarding
203
+ */
204
+ private createLogParser;
205
+ /**
206
+ * Create process manager (SDK, Shim, or Replay) based on model type with event forwarding
207
+ */
208
+ private createProcessManager;
209
+ /**
210
+ * Handle process exit - implements internal extension loop.
211
+ *
212
+ * When the process exits, this checks if we should extend:
213
+ * - If yes: calls onExtension callback, resets state, and re-runs
214
+ * - If no: emits final "exit" event with extensionCount
215
+ */
216
+ private handleProcessExit;
217
+ /**
218
+ * Perform an extension: notify callback, reset state, re-run with prompt override.
219
+ *
220
+ * Parameters are passed explicitly to avoid type narrowing issues with class properties.
221
+ */
222
+ private performExtension;
223
+ /**
224
+ * Spawn the underlying process manager using a unified adapter.
225
+ * ShimProcessManager requires a runtime command array; SDK/Replay do not.
226
+ */
227
+ private spawnCodonProcess;
228
+ /**
229
+ * Internal method to run an extension (resume session with exhaustion prompt).
230
+ *
231
+ * Uses the same spawn() method as initial run, but with exhaustionPrompt option.
232
+ * This activates exhaustion mode: appends to log, forces resume.
233
+ */
234
+ private runExtension;
235
+ /**
236
+ * Start executing the codon.
237
+ *
238
+ * If extensionConfig is provided, the runner will automatically extend
239
+ * until context is exhausted or maxExtensions is reached.
240
+ *
241
+ * @param previousSessionId - Optional session ID to continue from
242
+ */
243
+ run(previousSessionId?: SessionId): Promise<void>;
244
+ /**
245
+ * Get the current extension count.
246
+ * Returns 0 if no extensions have occurred.
247
+ */
248
+ getExtensionCount(): number;
249
+ /**
250
+ * Kill the running process gracefully (SIGTERM with wait and SIGKILL escalation).
251
+ */
252
+ kill(signal?: NodeJS.Signals): Promise<void>;
253
+ /**
254
+ * Force-kill the running process immediately (SIGKILL for shims, abort for SDK).
255
+ * Used by forceShutdown() when the user presses q/Ctrl+C a second time.
256
+ */
257
+ forceKill(): Promise<void>;
258
+ /**
259
+ * Check if the process is currently running
260
+ */
261
+ isRunning(): boolean;
262
+ /**
263
+ * Get the process ID (if running)
264
+ */
265
+ getPid(): number | undefined;
266
+ /**
267
+ * Get the prompt frontmatter (if any was parsed from the prompt file)
268
+ */
269
+ getPromptFrontmatter(): import("./prompt-frontmatter.js").PromptFrontmatter | undefined;
270
+ /**
271
+ * Clean up all resources owned by this runner
272
+ *
273
+ * This should be called when the codon execution is complete
274
+ * (whether successful, failed, or skipped)
275
+ */
276
+ cleanup(): Promise<void>;
277
+ }
278
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { LlmProviderRegistry } from "../llm/llm-provider-registry.js";
2
+ import type { ModelInfo } from "../llm/models-dev-schema.js";
3
+ /**
4
+ * Result of model validation
5
+ */
6
+ export interface ModelValidationResult {
7
+ /** Whether the model is valid and can be used */
8
+ valid: boolean;
9
+ /** The resolved ModelInfo if validation succeeded */
10
+ modelInfo?: ModelInfo;
11
+ /** Human-readable reason if validation failed */
12
+ reason?: string;
13
+ /** Type of match that was found (if any) */
14
+ matchType?: "exact" | "exact-with-inferred-provider" | "fuzzy";
15
+ }
16
+ export declare function validateModel(model: string, registry: LlmProviderRegistry, providerId?: string): ModelValidationResult;