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.
- package/README.md +12 -11
- package/dist/base-process-manager.d.ts +30 -0
- package/dist/budget.d.ts +315 -0
- package/dist/checkpoint-git.d.ts +98 -0
- package/dist/claude-agent-sdk-manager.d.ts +144 -0
- package/dist/claude-log-parser.d.ts +63 -0
- package/dist/claude-runtime-extractor.d.ts +73 -0
- package/dist/codex-runtime-extractor.d.ts +107 -0
- package/dist/codon-runner.d.ts +278 -0
- package/dist/config-validation/model-validator.d.ts +16 -0
- package/dist/config-validation/sentinel.schema.d.ts +6967 -0
- package/dist/config.d.ts +40815 -0
- package/dist/cost-tracker.d.ts +72 -0
- package/dist/execution-planner.d.ts +62 -0
- package/dist/execution-thread.d.ts +71 -0
- package/dist/exports/schemas.d.ts +9 -0
- package/dist/exports/schemas.js +1019 -0
- package/dist/exports/types.d.ts +15 -0
- package/dist/exports/types.js +60 -0
- package/dist/file-resolver.d.ts +33 -0
- package/dist/index.js +380 -293
- package/dist/index.js.map +33 -29
- package/dist/llm/llm-provider-registry.d.ts +207 -0
- package/dist/llm/models-dev-schema.d.ts +679 -0
- package/dist/llm/provider-config.d.ts +30 -0
- package/dist/prompt-builder.d.ts +75 -0
- package/dist/prompt-frontmatter.d.ts +61 -0
- package/dist/replay-process-manager.d.ts +82 -0
- package/dist/runtime-extractor-base.d.ts +120 -0
- package/dist/schemas/event-schemas.d.ts +8389 -0
- package/dist/schemas/websocket-log-schemas.d.ts +4502 -0
- package/dist/shim-process-manager.d.ts +98 -0
- package/dist/shim-runtime-extractor.d.ts +51 -0
- package/dist/shims/codex/README.md +129 -0
- package/dist/shims/codex/THIRDPARTY.md +18 -0
- package/dist/shims/codex/VERSION +1 -0
- package/dist/shims/codex/common/package.json +24 -0
- package/dist/shims/codex/index.js +1154 -970
- package/dist/shims/codex/package.json +46 -0
- package/dist/shims/codex/tsup.config.ts +16 -0
- package/dist/shims/gemini/README.md +59 -0
- package/dist/shims/gemini/THIRDPARTY.md +32 -0
- package/dist/shims/gemini/VERSION +1 -0
- package/dist/shims/gemini/common/package.json +24 -0
- package/dist/shims/gemini/index.js +1359 -30
- package/dist/shims/gemini/package.json +37 -0
- package/dist/shims/opencode/README.md +82 -0
- package/dist/shims/opencode/THIRDPARTY.md +32 -0
- package/dist/shims/opencode/VERSION +1 -0
- package/dist/shims/opencode/common/package.json +24 -0
- package/dist/shims/opencode/index.js +1476 -0
- package/dist/shims/opencode/package.json +38 -0
- package/dist/shims/pi/README.md +87 -0
- package/dist/shims/pi/THIRDPARTY.md +24 -0
- package/dist/shims/pi/VERSION +1 -0
- package/dist/shims/pi/common/package.json +24 -0
- package/dist/shims/pi/index.js +249832 -0
- package/dist/shims/pi/package.json +53 -0
- package/dist/state-manager.d.ts +161 -0
- package/dist/state-transition-guards.d.ts +37 -0
- package/dist/telemetry/telemetry-types.d.ts +206 -0
- package/dist/typed-event-emitter.d.ts +57 -0
- package/dist/types/branded-types.d.ts +15 -0
- package/dist/types/budget-types.d.ts +82 -0
- package/dist/types/claude-session-schema.d.ts +2430 -0
- package/dist/types/error-types.d.ts +44 -0
- package/dist/types/input-ai-types.d.ts +1070 -0
- package/dist/types/llm-call-types.d.ts +3829 -0
- package/dist/types/sentinel-types.d.ts +66 -0
- package/dist/types/state-types.d.ts +1099 -0
- package/dist/types/tool-types.d.ts +86 -0
- package/dist/types/types.d.ts +367 -0
- package/dist/types/websocket-log-types.d.ts +7 -0
- package/dist/utils.d.ts +452 -0
- package/package.json +15 -2
- package/schemas/hank.schema.json +158 -3
- package/schemas/hankweave.schema.json +17 -1
- package/shims/codex/index.js +0 -1583
- package/shims/gemini/index.js +0 -31
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strongly typed tool input definitions for Claude tools.
|
|
3
|
+
* These match the expected input schemas for each tool.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This is not an exhaustive list. Claude may use additional tools
|
|
6
|
+
* that are not defined here. The server handles unknown tools gracefully
|
|
7
|
+
* by passing them through in events without type validation.
|
|
8
|
+
*/
|
|
9
|
+
export interface WriteToolInput {
|
|
10
|
+
file_path: string;
|
|
11
|
+
content: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ReadToolInput {
|
|
14
|
+
file_path: string;
|
|
15
|
+
}
|
|
16
|
+
export interface EditToolInput {
|
|
17
|
+
file_path: string;
|
|
18
|
+
old_str: string;
|
|
19
|
+
new_str: string;
|
|
20
|
+
view_range?: [number, number];
|
|
21
|
+
}
|
|
22
|
+
export interface MultiEditToolInput {
|
|
23
|
+
file_path: string;
|
|
24
|
+
edits: Array<{
|
|
25
|
+
old_str: string;
|
|
26
|
+
new_str: string;
|
|
27
|
+
view_range?: [number, number];
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface LSToolInput {
|
|
31
|
+
path: string;
|
|
32
|
+
}
|
|
33
|
+
export interface GlobToolInput {
|
|
34
|
+
pattern: string;
|
|
35
|
+
}
|
|
36
|
+
export interface GrepToolInput {
|
|
37
|
+
pattern: string;
|
|
38
|
+
path?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface BashToolInput {
|
|
41
|
+
command: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface TaskToolInput {
|
|
45
|
+
title: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface NotebookReadToolInput {
|
|
49
|
+
path: string;
|
|
50
|
+
}
|
|
51
|
+
export interface NotebookEditToolInput {
|
|
52
|
+
path: string;
|
|
53
|
+
cell_index: number;
|
|
54
|
+
new_content: string;
|
|
55
|
+
}
|
|
56
|
+
export interface WebFetchToolInput {
|
|
57
|
+
url: string;
|
|
58
|
+
}
|
|
59
|
+
export interface WebSearchToolInput {
|
|
60
|
+
query: string;
|
|
61
|
+
}
|
|
62
|
+
export interface TodoWriteToolInput {
|
|
63
|
+
content: string;
|
|
64
|
+
}
|
|
65
|
+
export type ToolInputMap = {
|
|
66
|
+
Write: WriteToolInput;
|
|
67
|
+
Read: ReadToolInput;
|
|
68
|
+
Edit: EditToolInput;
|
|
69
|
+
MultiEdit: MultiEditToolInput;
|
|
70
|
+
LS: LSToolInput;
|
|
71
|
+
Glob: GlobToolInput;
|
|
72
|
+
Grep: GrepToolInput;
|
|
73
|
+
Bash: BashToolInput;
|
|
74
|
+
Task: TaskToolInput;
|
|
75
|
+
NotebookRead: NotebookReadToolInput;
|
|
76
|
+
NotebookEdit: NotebookEditToolInput;
|
|
77
|
+
WebFetch: WebFetchToolInput;
|
|
78
|
+
WebSearch: WebSearchToolInput;
|
|
79
|
+
TodoWrite: TodoWriteToolInput;
|
|
80
|
+
exit_plan_mode: Record<string, never>;
|
|
81
|
+
};
|
|
82
|
+
export type ToolName = keyof ToolInputMap;
|
|
83
|
+
/**
|
|
84
|
+
* Type guard to check if a tool name is valid
|
|
85
|
+
*/
|
|
86
|
+
export declare function isValidToolName(name: string): name is ToolName;
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { ServerEvent } from "../schemas/event-schemas.js";
|
|
3
|
+
import type { CodonId } from "./branded-types.js";
|
|
4
|
+
import type { logMessageSchema } from "./claude-session-schema.js";
|
|
5
|
+
import type { SentinelConfig } from "./sentinel-types.js";
|
|
6
|
+
export type { Codon, CodonConfig, HankFile, HankMeta, HankOverrides, HankweaveConfig, Loop, LoopTermination, RigSetupItem, RigShellCommand, RuntimeConfig, ShellCommand, } from "../config.js";
|
|
7
|
+
export type ModelName = "sonnet" | "opus" | (string & {});
|
|
8
|
+
export type ContinuationMode = "fresh" | "continue-previous";
|
|
9
|
+
/**
|
|
10
|
+
* Client access modes for different capabilities
|
|
11
|
+
*/
|
|
12
|
+
export declare enum ClientMode {
|
|
13
|
+
READONLY = "readonly",
|
|
14
|
+
READANDWRITE = "readandwrite"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Cursor for paginating through event history
|
|
18
|
+
*/
|
|
19
|
+
export interface EventCursor {
|
|
20
|
+
timestamp: string;
|
|
21
|
+
eventId: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Direction for pagination through event history
|
|
25
|
+
*/
|
|
26
|
+
export type PaginationDirection = "forward" | "backward";
|
|
27
|
+
/**
|
|
28
|
+
* Handshake request sent by client to establish connection mode
|
|
29
|
+
*/
|
|
30
|
+
export interface HandshakeRequest {
|
|
31
|
+
type: "handshake";
|
|
32
|
+
data: {
|
|
33
|
+
mode: ClientMode;
|
|
34
|
+
sendPreviousEvents?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handshake response sent by server after processing request
|
|
39
|
+
*/
|
|
40
|
+
export interface HandshakeResponse {
|
|
41
|
+
type: "handshake.response";
|
|
42
|
+
data: {
|
|
43
|
+
clientId: string;
|
|
44
|
+
mode: ClientMode;
|
|
45
|
+
eventHistory: ServerEvent[];
|
|
46
|
+
totalEvents: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Client metadata stored with each WebSocket connection.
|
|
51
|
+
* Provides connection tracking and activity monitoring.
|
|
52
|
+
*/
|
|
53
|
+
export type ClientData = {
|
|
54
|
+
id: string;
|
|
55
|
+
connectionTime: Date;
|
|
56
|
+
lastActivity: Date;
|
|
57
|
+
handshakeComplete: false;
|
|
58
|
+
} | {
|
|
59
|
+
id: string;
|
|
60
|
+
connectionTime: Date;
|
|
61
|
+
lastActivity: Date;
|
|
62
|
+
mode: ClientMode;
|
|
63
|
+
handshakeComplete: true;
|
|
64
|
+
};
|
|
65
|
+
export type ClaudeMessageId = `msg_${string}`;
|
|
66
|
+
export type UUIDMessageId = string;
|
|
67
|
+
export type MessageId = ClaudeMessageId | UUIDMessageId;
|
|
68
|
+
export declare const CHECKPOINT_STATUS: {
|
|
69
|
+
readonly RIG_SETUP: "rig-setup";
|
|
70
|
+
readonly COMPLETED: "completed";
|
|
71
|
+
readonly ERROR: "error";
|
|
72
|
+
readonly EXIT: "exit";
|
|
73
|
+
readonly SKIPPED: "skipped";
|
|
74
|
+
};
|
|
75
|
+
export type CheckpointStatus = (typeof CHECKPOINT_STATUS)[keyof typeof CHECKPOINT_STATUS];
|
|
76
|
+
/**
|
|
77
|
+
* Single codon configuration - represents one executable codon.
|
|
78
|
+
* Codon-level sentinel entry.
|
|
79
|
+
* Wraps sentinel config with codon-specific settings.
|
|
80
|
+
*
|
|
81
|
+
* This separation keeps sentinel configs reusable across codons
|
|
82
|
+
* while allowing codon-specific configuration.
|
|
83
|
+
*/
|
|
84
|
+
export interface CodonSentinelEntry {
|
|
85
|
+
/**
|
|
86
|
+
* Sentinel configuration.
|
|
87
|
+
* Can be:
|
|
88
|
+
* - File path (string): "./sentinels/narrator.json"
|
|
89
|
+
* - Inline config (object): Full SentinelConfig
|
|
90
|
+
*/
|
|
91
|
+
sentinelConfig: string | SentinelConfig;
|
|
92
|
+
/**
|
|
93
|
+
* Codon-specific settings for this sentinel.
|
|
94
|
+
*/
|
|
95
|
+
settings?: {
|
|
96
|
+
/**
|
|
97
|
+
* Fail the codon if this sentinel fails to load.
|
|
98
|
+
*
|
|
99
|
+
* IMPORTANT: This only affects LOAD-TIME failures (config errors, file not found, etc).
|
|
100
|
+
* Does NOT fail the codon if:
|
|
101
|
+
* - Sentinel needs to be unloaded mid-execution (due to errors)
|
|
102
|
+
* - Sentinel LLM calls fail (those are handled by error thresholds)
|
|
103
|
+
* - Sentinel queue overflows
|
|
104
|
+
*
|
|
105
|
+
* Use for mission-critical sentinels where codon cannot proceed without them.
|
|
106
|
+
* Default: false (sentinels are optional)
|
|
107
|
+
*/
|
|
108
|
+
failCodonIfNotLoaded?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Output file paths for this sentinel in this codon.
|
|
111
|
+
* If omitted, sentinel auto-generates paths in .hankweave/sentinel-outputs/
|
|
112
|
+
* You can use filenames to join together logs from different sentinels.
|
|
113
|
+
* Path convention:
|
|
114
|
+
* - Filename only (no '/'): .hankweave/sentinel-outputs/{id}/{filename}
|
|
115
|
+
* - Path with '/': {executionPath}/{path}
|
|
116
|
+
*/
|
|
117
|
+
outputPaths?: {
|
|
118
|
+
logFile?: string;
|
|
119
|
+
lastValueFile?: string;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Override sentinel's reportToWebsocket settings for this codon.
|
|
123
|
+
* Codon-level settings take precedence over sentinel-level settings.
|
|
124
|
+
*
|
|
125
|
+
* Controls which sentinel events are emitted to the WebSocket stream:
|
|
126
|
+
* - lifecycle: sentinel.loaded, sentinel.unloaded (default: true)
|
|
127
|
+
* - errors: sentinel.error events (default: true)
|
|
128
|
+
* - outputs: sentinel.output events with full content (default: true)
|
|
129
|
+
* - triggers: sentinel.triggered events (default: false - verbose)
|
|
130
|
+
*
|
|
131
|
+
* Example: Disable verbose output events for this codon only:
|
|
132
|
+
* ```json
|
|
133
|
+
* "reportToWebsocket": { "outputs": false, "triggers": false }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
reportToWebsocket?: {
|
|
137
|
+
lifecycle?: boolean;
|
|
138
|
+
errors?: boolean;
|
|
139
|
+
outputs?: boolean;
|
|
140
|
+
triggers?: boolean;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Information for creating a checkpoint commit in the shadow git repository.
|
|
146
|
+
*
|
|
147
|
+
* The checkpoint system creates a shadow git repo in `.hankweave/checkpoints/` that tracks
|
|
148
|
+
* files matching the `checkpointAndWatch` patterns. Each checkpoint creates a commit
|
|
149
|
+
* with detailed metadata about the codon state.
|
|
150
|
+
*/
|
|
151
|
+
export interface CheckpointInfo {
|
|
152
|
+
/** The type of checkpoint being created */
|
|
153
|
+
status: CheckpointStatus;
|
|
154
|
+
/** Unique identifier of the codon (e.g., "codon-1") */
|
|
155
|
+
codonId: CodonId;
|
|
156
|
+
/** Human-readable name of the codon */
|
|
157
|
+
codonName: string;
|
|
158
|
+
/** Unique identifier for this Hankweave runtime run */
|
|
159
|
+
runId: string;
|
|
160
|
+
/** ISO timestamp when the checkpoint was created */
|
|
161
|
+
timestamp: string;
|
|
162
|
+
/** Duration in milliseconds (only for completed/error/skipped codons) */
|
|
163
|
+
duration?: number;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Token usage tracking for Claude API calls.
|
|
167
|
+
* Used to calculate costs and monitor usage across codons.
|
|
168
|
+
*/
|
|
169
|
+
export interface TokenUsage {
|
|
170
|
+
/** Standard input tokens processed */
|
|
171
|
+
inputTokens: number;
|
|
172
|
+
/** Generated output tokens */
|
|
173
|
+
outputTokens: number;
|
|
174
|
+
/** Tokens used to create prompt cache */
|
|
175
|
+
cacheCreationTokens: number;
|
|
176
|
+
/** Tokens read from existing cache */
|
|
177
|
+
cacheReadTokens: number;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Individual check result from a shim's self-test.
|
|
181
|
+
* Each check verifies a specific aspect of the environment setup.
|
|
182
|
+
*/
|
|
183
|
+
export interface ShimSelfTestCheck {
|
|
184
|
+
/** Name of the check (e.g., "gemini_cli_found", "api_key") */
|
|
185
|
+
name: string;
|
|
186
|
+
/** Whether this check passed */
|
|
187
|
+
passed: boolean;
|
|
188
|
+
/** Human-readable message describing the check result */
|
|
189
|
+
message: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Complete self-test result from a shim.
|
|
193
|
+
* Shims use --self-test flag to verify their environment is properly configured.
|
|
194
|
+
*/
|
|
195
|
+
export interface ShimSelfTestResult {
|
|
196
|
+
/** Information about the shim itself */
|
|
197
|
+
shim: {
|
|
198
|
+
/** Name of the shim (e.g., "gemini-cli-shim") */
|
|
199
|
+
name: string;
|
|
200
|
+
/** Version of the shim */
|
|
201
|
+
version: string;
|
|
202
|
+
};
|
|
203
|
+
/** Information about the underlying agent/CLI */
|
|
204
|
+
agent: {
|
|
205
|
+
/** Name of the agent (e.g., "gemini-cli") */
|
|
206
|
+
name: string;
|
|
207
|
+
/** Version of the agent (or "unknown" if not found) */
|
|
208
|
+
version: string;
|
|
209
|
+
/** Whether the agent was found in the system */
|
|
210
|
+
found: boolean;
|
|
211
|
+
};
|
|
212
|
+
/** Array of individual check results */
|
|
213
|
+
checks: ShimSelfTestCheck[];
|
|
214
|
+
/** Overall test result */
|
|
215
|
+
overall: {
|
|
216
|
+
/** Whether all checks passed */
|
|
217
|
+
passed: boolean;
|
|
218
|
+
/** Overall status message */
|
|
219
|
+
message: string;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Synthetic timeout message structure.
|
|
224
|
+
* Claude sends these special messages when API requests time out.
|
|
225
|
+
* They have a specific structure that needs special handling.
|
|
226
|
+
*/
|
|
227
|
+
export interface SyntheticTimeoutMessage {
|
|
228
|
+
type: "assistant";
|
|
229
|
+
message: {
|
|
230
|
+
id: string;
|
|
231
|
+
type: "message";
|
|
232
|
+
role: "assistant";
|
|
233
|
+
model: "<synthetic>";
|
|
234
|
+
content: "API Error: Request timed out.";
|
|
235
|
+
usage?: never;
|
|
236
|
+
stop_reason: null;
|
|
237
|
+
stop_sequence: null;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Type guard to check if an assistant message is a synthetic timeout.
|
|
242
|
+
* These messages need special handling as they indicate API failures.
|
|
243
|
+
*/
|
|
244
|
+
export declare function isSyntheticTimeout(msg: ClaudeLogMessage): msg is SyntheticTimeoutMessage;
|
|
245
|
+
/**
|
|
246
|
+
* Type guard to check if a log message indicates a context exceeded error.
|
|
247
|
+
* Detects two patterns:
|
|
248
|
+
* - Pattern 1: Synthetic assistant message with "API Error: terminated" or output token maximum exceeded
|
|
249
|
+
* - Pattern 2: Result message with "exceeded the...output token maximum"
|
|
250
|
+
*/
|
|
251
|
+
export declare function isContextExceeded(msg: ClaudeLogMessage): boolean;
|
|
252
|
+
export type ClaudeLogMessage = z.infer<typeof logMessageSchema>;
|
|
253
|
+
export type { AssistantActionEvent, BudgetSummaryEvent, CheckpointListEvent, CheckpointQueryInfo, CodonCompletedEvent, CodonExecution, CodonStartedEvent, ErrorEvent, FailureReason, FileNode, FileTreeUpdatedEvent, FileUpdatedEvent, HistoryBatchEvent, IncompleteCodonEvent, InfoEvent, ProcessExit, RollbackCodonCheckpointEvent, RollbackCompletedEvent, RollbackProgressEvent, RollbackRigCleanupEvent, RollbackStartedEvent, ServerEvent, ServerIdleEvent, ServerReadyEvent, StateSnapshotEvent, TokenUsageEvent, ToolResultEvent, } from "../schemas/event-schemas.js";
|
|
254
|
+
/**
|
|
255
|
+
* Start a specific codon by ID.
|
|
256
|
+
* Can optionally skip pre-start commands for retry scenarios.
|
|
257
|
+
*/
|
|
258
|
+
export interface StartCodonCommand {
|
|
259
|
+
/** Unique ID for this command (for request/response correlation) */
|
|
260
|
+
id: string;
|
|
261
|
+
type: "codon.start";
|
|
262
|
+
data: {
|
|
263
|
+
/** ID of the codon to start */
|
|
264
|
+
codonId: string;
|
|
265
|
+
/** If true, skip the codon's preStart command */
|
|
266
|
+
skipPreCommands?: boolean;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Start the next codon in sequence.
|
|
271
|
+
* Determines next codon based on completion history.
|
|
272
|
+
*/
|
|
273
|
+
export interface NextCodonCommand {
|
|
274
|
+
id: string;
|
|
275
|
+
type: "codon.next";
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Skip the currently running codon.
|
|
279
|
+
* Terminates the Claude process and marks codon as skipped.
|
|
280
|
+
*/
|
|
281
|
+
export interface SkipCodonCommand {
|
|
282
|
+
id: string;
|
|
283
|
+
type: "codon.skip";
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Re-run the last completed codon.
|
|
287
|
+
* Useful for retrying failed codons or regenerating outputs.
|
|
288
|
+
*/
|
|
289
|
+
export interface RedoCodonCommand {
|
|
290
|
+
id: string;
|
|
291
|
+
type: "codon.redo";
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Gracefully shutdown the server.
|
|
295
|
+
* Cleans up all resources and removes lock file.
|
|
296
|
+
*/
|
|
297
|
+
export interface ShutdownCommand {
|
|
298
|
+
id: string;
|
|
299
|
+
type: "server.shutdown";
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Force stop the current running codon.
|
|
303
|
+
*/
|
|
304
|
+
export interface ForceStopCommand {
|
|
305
|
+
id: string;
|
|
306
|
+
type: "codon.forceStop";
|
|
307
|
+
data?: {
|
|
308
|
+
/** Optional reason for force stopping */
|
|
309
|
+
reason?: string;
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* List available checkpoints.
|
|
314
|
+
*/
|
|
315
|
+
export interface ListCheckpointsCommand {
|
|
316
|
+
id: string;
|
|
317
|
+
type: "checkpoint.list";
|
|
318
|
+
data?: {
|
|
319
|
+
/** Optional run ID to list checkpoints for */
|
|
320
|
+
runId?: string;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Rollback to a specific checkpoint.
|
|
325
|
+
*/
|
|
326
|
+
export interface RollbackToCheckpointCommand {
|
|
327
|
+
id: string;
|
|
328
|
+
type: "rollback.toCheckpoint";
|
|
329
|
+
data: {
|
|
330
|
+
/** Checkpoint SHA (can be partial) */
|
|
331
|
+
checkpointSha: string;
|
|
332
|
+
/** Whether to auto-restart after rollback */
|
|
333
|
+
autoRestart?: boolean;
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Rollback to a codon with specific checkpoint type.
|
|
338
|
+
*/
|
|
339
|
+
export interface RollbackToCodonCommand {
|
|
340
|
+
id: string;
|
|
341
|
+
type: "rollback.toCodon";
|
|
342
|
+
data: {
|
|
343
|
+
/** Codon ID to rollback to */
|
|
344
|
+
codonId: string;
|
|
345
|
+
/** Checkpoint type within that codon */
|
|
346
|
+
checkpointType: "start" | "end" | "rig-setup" | "completed" | "error" | "skipped";
|
|
347
|
+
/** Whether to auto-restart after rollback */
|
|
348
|
+
autoRestart?: boolean;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Rollback to last successful codon.
|
|
353
|
+
*/
|
|
354
|
+
export interface RollbackToLastSuccessCommand {
|
|
355
|
+
id: string;
|
|
356
|
+
type: "rollback.toLastSuccess";
|
|
357
|
+
data?: {
|
|
358
|
+
/** Whether to auto-restart after rollback */
|
|
359
|
+
autoRestart?: boolean;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Discriminated union of all client-to-server command types.
|
|
364
|
+
* Use this instead of generic command interfaces for better type safety.
|
|
365
|
+
* TypeScript will automatically narrow the type based on the `type` field.
|
|
366
|
+
*/
|
|
367
|
+
export type ClientCommand = StartCodonCommand | NextCodonCommand | SkipCodonCommand | RedoCodonCommand | ShutdownCommand | ForceStopCommand | ListCheckpointsCommand | RollbackToCheckpointCommand | RollbackToCodonCommand | RollbackToLastSuccessCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated This file is deprecated. Use server/schemas/websocket-log-schemas.ts instead.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports from the new Zod-based schema file for backward compatibility.
|
|
5
|
+
*/
|
|
6
|
+
export type { ClientCommand, ServerEvent } from "../schemas/event-schemas.js";
|
|
7
|
+
export { extractMessageContext, getMessageType, isClientCommand, isServerEvent, parseWebSocketLogEntry, safeParseWebSocketLogEntry, type WebSocketLogEntry, webSocketLogEntrySchema, } from "../schemas/websocket-log-schemas.js";
|