@smithers-orchestrator/time-travel 0.16.0
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/LICENSE +21 -0
- package/package.json +68 -0
- package/src/BranchInfo.ts +11 -0
- package/src/ForkParams.ts +11 -0
- package/src/JUMP_MAX_FRAME_NO.js +1 -0
- package/src/JUMP_RUN_ID_PATTERN.js +1 -0
- package/src/JumpResult.ts +9 -0
- package/src/JumpStepName.ts +10 -0
- package/src/JumpToFrameError.js +23 -0
- package/src/JumpToFrameInput.ts +36 -0
- package/src/NodeChange.ts +7 -0
- package/src/NodeSnapshot.ts +8 -0
- package/src/OutputChange.ts +5 -0
- package/src/ParsedSnapshot.ts +18 -0
- package/src/REWIND_RATE_LIMIT_MAX.js +1 -0
- package/src/REWIND_RATE_LIMIT_WINDOW_MS.js +1 -0
- package/src/RalphChange.ts +7 -0
- package/src/RalphSnapshot.ts +5 -0
- package/src/ReplayParams.ts +12 -0
- package/src/ReplayResult.ts +11 -0
- package/src/RetryTaskOptions.ts +10 -0
- package/src/RetryTaskResult.ts +5 -0
- package/src/RevertOptions.ts +9 -0
- package/src/RevertResult.ts +5 -0
- package/src/RewindAuditResult.ts +5 -0
- package/src/RewindLockHandle.ts +4 -0
- package/src/RunTimeline.ts +11 -0
- package/src/SnapshotDiff.ts +18 -0
- package/src/TimeTravelOptions.ts +11 -0
- package/src/TimeTravelResult.ts +7 -0
- package/src/TimelineFrame.ts +11 -0
- package/src/TimelineTree.ts +9 -0
- package/src/acquireRewindLock.js +32 -0
- package/src/countRecentRewindAuditRows.js +27 -0
- package/src/diff.js +189 -0
- package/src/evaluateRewindRateLimit.js +41 -0
- package/src/fork/_helpers.js +28 -0
- package/src/fork/forkRunEffect.js +147 -0
- package/src/fork/getBranchInfoEffect.js +26 -0
- package/src/fork/index.js +41 -0
- package/src/fork/listBranchesEffect.js +25 -0
- package/src/hasRewindLock.js +11 -0
- package/src/index.d.ts +1170 -0
- package/src/index.js +43 -0
- package/src/jumpToFrame.js +1077 -0
- package/src/listRewindAuditRows.js +83 -0
- package/src/metrics.js +4 -0
- package/src/recoverInProgressRewindAudits.js +72 -0
- package/src/replay.js +22 -0
- package/src/replayFromCheckpointEffect.js +59 -0
- package/src/replaysStarted.js +2 -0
- package/src/resetRewindLocksForTests.js +8 -0
- package/src/resolveRewindAuditClient.js +38 -0
- package/src/retry-task.js +215 -0
- package/src/revert.js +68 -0
- package/src/rewindAudit.js +9 -0
- package/src/rewindLock.js +7 -0
- package/src/rewindLockStore.js +8 -0
- package/src/rewindRateLimit.js +3 -0
- package/src/runForksCreated.js +2 -0
- package/src/schema.js +46 -0
- package/src/snapshot/Snapshot.ts +15 -0
- package/src/snapshot/SnapshotData.ts +19 -0
- package/src/snapshot/captureSnapshotEffect.js +70 -0
- package/src/snapshot/index.js +57 -0
- package/src/snapshot/listSnapshotsEffect.js +32 -0
- package/src/snapshot/loadSnapshotEffect.js +46 -0
- package/src/snapshot/parseSnapshot.js +31 -0
- package/src/snapshotDuration.js +7 -0
- package/src/snapshotsCaptured.js +2 -0
- package/src/timeline/_helpers.js +7 -0
- package/src/timeline/buildTimelineEffect.js +38 -0
- package/src/timeline/buildTimelineTreeEffect.js +30 -0
- package/src/timeline/formatTimelineAsJson.js +23 -0
- package/src/timeline/formatTimelineForTui.js +31 -0
- package/src/timeline/index.js +31 -0
- package/src/timetravel.js +247 -0
- package/src/types.ts +15 -0
- package/src/updateRewindAuditRow.js +35 -0
- package/src/validateJumpFrameNo.js +23 -0
- package/src/validateJumpRunId.js +18 -0
- package/src/vcs-version/VcsTag.ts +9 -0
- package/src/vcs-version/index.js +61 -0
- package/src/vcs-version/loadVcsTagEffect.js +27 -0
- package/src/vcs-version/rerunAtRevisionEffect.js +25 -0
- package/src/vcs-version/resolveWorkflowAtRevisionEffect.js +32 -0
- package/src/vcs-version/tagSnapshotVcsEffect.js +56 -0
- package/src/writeRewindAuditRow.js +46 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,1170 @@
|
|
|
1
|
+
import * as _smithers_db_adapter from '@smithers-orchestrator/db/adapter';
|
|
2
|
+
import { SmithersDb as SmithersDb$b } from '@smithers-orchestrator/db/adapter';
|
|
3
|
+
import { SmithersEvent } from '@smithers-orchestrator/observability/SmithersEvent';
|
|
4
|
+
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
5
|
+
|
|
6
|
+
type RewindAuditResult$4 = "success" | "failed" | "partial" | "in_progress";
|
|
7
|
+
|
|
8
|
+
type RewindLockHandle$2 = {
|
|
9
|
+
runId: string;
|
|
10
|
+
release: () => boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type JumpStepName$1 = "snapshot-pre-jump" | "pause-event-loop" | "revert-sandboxes" | "truncate-frames" | "truncate-attempts" | "truncate-outputs" | "invalidate-diffs" | "rebuild-reconciler" | "resume-event-loop";
|
|
14
|
+
|
|
15
|
+
type JumpToFrameInput$2 = {
|
|
16
|
+
adapter: SmithersDb$b;
|
|
17
|
+
runId: unknown;
|
|
18
|
+
frameNo: unknown;
|
|
19
|
+
confirm?: unknown;
|
|
20
|
+
caller?: string;
|
|
21
|
+
pauseRunLoop?: () => Promise<void> | void;
|
|
22
|
+
resumeRunLoop?: () => Promise<void> | void;
|
|
23
|
+
captureReconcilerState?: () => Promise<unknown> | unknown;
|
|
24
|
+
restoreReconcilerState?: (snapshot: unknown) => Promise<void> | void;
|
|
25
|
+
rebuildReconcilerState?: (xmlJson: string) => Promise<void> | void;
|
|
26
|
+
emitEvent?: (event: SmithersEvent) => Promise<void> | void;
|
|
27
|
+
getCurrentPointerImpl?: (cwd?: string) => Promise<string | null>;
|
|
28
|
+
revertToPointerImpl?: (pointer: string, cwd?: string) => Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
error?: string;
|
|
31
|
+
}>;
|
|
32
|
+
nowMs?: () => number;
|
|
33
|
+
rateLimit?: {
|
|
34
|
+
maxPerWindow?: number;
|
|
35
|
+
windowMs?: number;
|
|
36
|
+
};
|
|
37
|
+
hooks?: {
|
|
38
|
+
beforeStep?: (step: JumpStepName$1) => Promise<void> | void;
|
|
39
|
+
afterStep?: (step: JumpStepName$1) => Promise<void> | void;
|
|
40
|
+
};
|
|
41
|
+
onLog?: (level: "info" | "warn" | "error", message: string, fields?: Record<string, unknown>) => Promise<void> | void;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type JumpResult$2 = {
|
|
45
|
+
ok: true;
|
|
46
|
+
newFrameNo: number;
|
|
47
|
+
revertedSandboxes: number;
|
|
48
|
+
deletedFrames: number;
|
|
49
|
+
deletedAttempts: number;
|
|
50
|
+
invalidatedDiffs: number;
|
|
51
|
+
durationMs: number;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type VcsTag$2 = {
|
|
55
|
+
runId: string;
|
|
56
|
+
frameNo: number;
|
|
57
|
+
vcsType: string;
|
|
58
|
+
vcsPointer: string;
|
|
59
|
+
vcsRoot: string | null;
|
|
60
|
+
jjOperationId: string | null;
|
|
61
|
+
createdAtMs: number;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Branch metadata.
|
|
66
|
+
*/
|
|
67
|
+
type BranchInfo$2 = {
|
|
68
|
+
runId: string;
|
|
69
|
+
parentRunId: string;
|
|
70
|
+
parentFrameNo: number;
|
|
71
|
+
branchLabel: string | null;
|
|
72
|
+
forkDescription: string | null;
|
|
73
|
+
createdAtMs: number;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Timeline entry for a single frame in a run.
|
|
78
|
+
*/
|
|
79
|
+
type TimelineFrame$1 = {
|
|
80
|
+
frameNo: number;
|
|
81
|
+
createdAtMs: number;
|
|
82
|
+
contentHash: string;
|
|
83
|
+
forkPoints: BranchInfo$2[];
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Timeline for a single run.
|
|
88
|
+
*/
|
|
89
|
+
type RunTimeline$2 = {
|
|
90
|
+
runId: string;
|
|
91
|
+
frames: TimelineFrame$1[];
|
|
92
|
+
branch: BranchInfo$2 | null;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Recursive timeline tree including forks.
|
|
97
|
+
*/
|
|
98
|
+
type TimelineTree$4 = {
|
|
99
|
+
timeline: RunTimeline$2;
|
|
100
|
+
children: TimelineTree$4[];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type NodeSnapshot$1 = {
|
|
104
|
+
nodeId: string;
|
|
105
|
+
iteration: number;
|
|
106
|
+
state: string;
|
|
107
|
+
lastAttempt: number | null;
|
|
108
|
+
outputTable: string;
|
|
109
|
+
label: string | null;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
type NodeChange$1 = {
|
|
113
|
+
nodeId: string;
|
|
114
|
+
from: NodeSnapshot$1;
|
|
115
|
+
to: NodeSnapshot$1;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type OutputChange$1 = {
|
|
119
|
+
key: string;
|
|
120
|
+
from: unknown;
|
|
121
|
+
to: unknown;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
type RalphSnapshot$1 = {
|
|
125
|
+
ralphId: string;
|
|
126
|
+
iteration: number;
|
|
127
|
+
done: boolean;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type RalphChange$1 = {
|
|
131
|
+
ralphId: string;
|
|
132
|
+
from: RalphSnapshot$1;
|
|
133
|
+
to: RalphSnapshot$1;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Structured diff between two snapshots.
|
|
138
|
+
*/
|
|
139
|
+
type SnapshotDiff$2 = {
|
|
140
|
+
nodesAdded: string[];
|
|
141
|
+
nodesRemoved: string[];
|
|
142
|
+
nodesChanged: NodeChange$1[];
|
|
143
|
+
outputsAdded: string[];
|
|
144
|
+
outputsRemoved: string[];
|
|
145
|
+
outputsChanged: OutputChange$1[];
|
|
146
|
+
ralphChanged: RalphChange$1[];
|
|
147
|
+
inputChanged: boolean;
|
|
148
|
+
vcsPointerChanged: boolean;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
type SnapshotData$2 = {
|
|
152
|
+
nodes: Array<{
|
|
153
|
+
nodeId: string;
|
|
154
|
+
iteration: number;
|
|
155
|
+
state: string;
|
|
156
|
+
lastAttempt: number | null;
|
|
157
|
+
outputTable: string;
|
|
158
|
+
label: string | null;
|
|
159
|
+
}>;
|
|
160
|
+
outputs: Record<string, unknown>;
|
|
161
|
+
ralph: Array<{
|
|
162
|
+
ralphId: string;
|
|
163
|
+
iteration: number;
|
|
164
|
+
done: boolean;
|
|
165
|
+
}>;
|
|
166
|
+
input: Record<string, unknown>;
|
|
167
|
+
vcsPointer?: string | null;
|
|
168
|
+
workflowHash?: string | null;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Serialized snapshot of workflow state at a specific frame.
|
|
173
|
+
*/
|
|
174
|
+
type Snapshot$5 = {
|
|
175
|
+
runId: string;
|
|
176
|
+
frameNo: number;
|
|
177
|
+
nodesJson: string;
|
|
178
|
+
outputsJson: string;
|
|
179
|
+
ralphJson: string;
|
|
180
|
+
inputJson: string;
|
|
181
|
+
vcsPointer: string | null;
|
|
182
|
+
workflowHash: string | null;
|
|
183
|
+
contentHash: string;
|
|
184
|
+
createdAtMs: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
type ReplayResult$2 = {
|
|
188
|
+
runId: string;
|
|
189
|
+
branch: BranchInfo$2;
|
|
190
|
+
snapshot: Snapshot$5;
|
|
191
|
+
vcsRestored: boolean;
|
|
192
|
+
vcsPointer: string | null;
|
|
193
|
+
vcsError?: string;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Parameters for replaying from a checkpoint.
|
|
198
|
+
*/
|
|
199
|
+
type ReplayParams$2 = {
|
|
200
|
+
parentRunId: string;
|
|
201
|
+
frameNo: number;
|
|
202
|
+
inputOverrides?: Record<string, unknown>;
|
|
203
|
+
resetNodes?: string[];
|
|
204
|
+
branchLabel?: string;
|
|
205
|
+
restoreVcs?: boolean;
|
|
206
|
+
cwd?: string;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Parsed snapshot data for diffing and display.
|
|
211
|
+
*/
|
|
212
|
+
type ParsedSnapshot$3 = {
|
|
213
|
+
runId: string;
|
|
214
|
+
frameNo: number;
|
|
215
|
+
nodes: Record<string, NodeSnapshot$1>;
|
|
216
|
+
outputs: Record<string, unknown>;
|
|
217
|
+
ralph: Record<string, RalphSnapshot$1>;
|
|
218
|
+
input: Record<string, unknown>;
|
|
219
|
+
vcsPointer: string | null;
|
|
220
|
+
workflowHash: string | null;
|
|
221
|
+
contentHash: string;
|
|
222
|
+
createdAtMs: number;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Parameters for forking a run.
|
|
227
|
+
*/
|
|
228
|
+
type ForkParams$2 = {
|
|
229
|
+
parentRunId: string;
|
|
230
|
+
frameNo: number;
|
|
231
|
+
inputOverrides?: Record<string, unknown>;
|
|
232
|
+
resetNodes?: string[];
|
|
233
|
+
branchLabel?: string;
|
|
234
|
+
forkDescription?: string;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
238
|
+
/** @typedef {import("./ReplayParams.ts").ReplayParams} ReplayParams */
|
|
239
|
+
/**
|
|
240
|
+
* Fork a run from a checkpoint and optionally restore the VCS working copy.
|
|
241
|
+
*
|
|
242
|
+
* @param {SmithersDb} adapter
|
|
243
|
+
* @param {ReplayParams} params
|
|
244
|
+
* @returns {Promise<ReplayResult>}
|
|
245
|
+
*/
|
|
246
|
+
declare function replayFromCheckpoint(adapter: SmithersDb$a, params: ReplayParams$1): Promise<ReplayResult$1>;
|
|
247
|
+
|
|
248
|
+
type SmithersDb$a = _smithers_db_adapter.SmithersDb;
|
|
249
|
+
type ReplayParams$1 = ReplayParams$2;
|
|
250
|
+
type ReplayResult$1 = ReplayResult$2;
|
|
251
|
+
|
|
252
|
+
declare const snapshotsCaptured: any;
|
|
253
|
+
|
|
254
|
+
declare const runForksCreated: any;
|
|
255
|
+
|
|
256
|
+
declare const replaysStarted: any;
|
|
257
|
+
|
|
258
|
+
declare const snapshotDuration: any;
|
|
259
|
+
|
|
260
|
+
/** @typedef {import("../ParsedSnapshot.ts").ParsedSnapshot} ParsedSnapshot */
|
|
261
|
+
/** @typedef {import("./Snapshot.ts").Snapshot} Snapshot */
|
|
262
|
+
/**
|
|
263
|
+
* @param {Snapshot} snapshot
|
|
264
|
+
* @returns {ParsedSnapshot}
|
|
265
|
+
*/
|
|
266
|
+
declare function parseSnapshot(snapshot: Snapshot$4): ParsedSnapshot$2;
|
|
267
|
+
type ParsedSnapshot$2 = ParsedSnapshot$3;
|
|
268
|
+
type Snapshot$4 = Snapshot$5;
|
|
269
|
+
|
|
270
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
271
|
+
/**
|
|
272
|
+
* Capture a snapshot row for a run at a given frame.
|
|
273
|
+
*
|
|
274
|
+
* @param {SmithersDb} adapter
|
|
275
|
+
* @param {string} runId
|
|
276
|
+
* @param {number} frameNo
|
|
277
|
+
* @param {SnapshotData} data
|
|
278
|
+
* @returns {Promise<Snapshot>}
|
|
279
|
+
*/
|
|
280
|
+
declare function captureSnapshot(adapter: SmithersDb$9, runId: string, frameNo: number, data: SnapshotData$1): Promise<Snapshot$3>;
|
|
281
|
+
/**
|
|
282
|
+
* Load a specific snapshot row for a run/frame.
|
|
283
|
+
*
|
|
284
|
+
* @param {SmithersDb} adapter
|
|
285
|
+
* @param {string} runId
|
|
286
|
+
* @param {number} frameNo
|
|
287
|
+
* @returns {Promise<Snapshot | undefined>}
|
|
288
|
+
*/
|
|
289
|
+
declare function loadSnapshot(adapter: SmithersDb$9, runId: string, frameNo: number): Promise<Snapshot$3 | undefined>;
|
|
290
|
+
/**
|
|
291
|
+
* Load the most recent snapshot row for a run.
|
|
292
|
+
*
|
|
293
|
+
* @param {SmithersDb} adapter
|
|
294
|
+
* @param {string} runId
|
|
295
|
+
* @returns {Promise<Snapshot | undefined>}
|
|
296
|
+
*/
|
|
297
|
+
declare function loadLatestSnapshot(adapter: SmithersDb$9, runId: string): Promise<Snapshot$3 | undefined>;
|
|
298
|
+
/**
|
|
299
|
+
* List lightweight snapshot index rows for a run.
|
|
300
|
+
*
|
|
301
|
+
* @param {SmithersDb} adapter
|
|
302
|
+
* @param {string} runId
|
|
303
|
+
* @returns {Promise<Array<Pick<Snapshot, "runId" | "frameNo" | "contentHash" | "createdAtMs" | "vcsPointer">>>}
|
|
304
|
+
*/
|
|
305
|
+
declare function listSnapshots(adapter: SmithersDb$9, runId: string): Promise<Array<Pick<Snapshot$3, "runId" | "frameNo" | "contentHash" | "createdAtMs" | "vcsPointer">>>;
|
|
306
|
+
|
|
307
|
+
type SmithersDb$9 = _smithers_db_adapter.SmithersDb;
|
|
308
|
+
type Snapshot$3 = Snapshot$5;
|
|
309
|
+
type SnapshotData$1 = SnapshotData$2;
|
|
310
|
+
|
|
311
|
+
/** @typedef {import("./ParsedSnapshot.ts").ParsedSnapshot} ParsedSnapshot */
|
|
312
|
+
/** @typedef {import("./snapshot/Snapshot.ts").Snapshot} Snapshot */
|
|
313
|
+
/** @typedef {import("./SnapshotDiff.ts").SnapshotDiff} SnapshotDiff */
|
|
314
|
+
/**
|
|
315
|
+
* Compute a structured diff between two parsed snapshots.
|
|
316
|
+
*
|
|
317
|
+
* @param {ParsedSnapshot} a
|
|
318
|
+
* @param {ParsedSnapshot} b
|
|
319
|
+
* @returns {SnapshotDiff}
|
|
320
|
+
*/
|
|
321
|
+
declare function diffSnapshots(a: ParsedSnapshot$1, b: ParsedSnapshot$1): SnapshotDiff$1;
|
|
322
|
+
/**
|
|
323
|
+
* Convenience: diff two raw Snapshot rows.
|
|
324
|
+
*
|
|
325
|
+
* @param {Snapshot} a
|
|
326
|
+
* @param {Snapshot} b
|
|
327
|
+
* @returns {SnapshotDiff}
|
|
328
|
+
*/
|
|
329
|
+
declare function diffRawSnapshots(a: Snapshot$2, b: Snapshot$2): SnapshotDiff$1;
|
|
330
|
+
/**
|
|
331
|
+
* Colorized terminal output for a snapshot diff.
|
|
332
|
+
*
|
|
333
|
+
* @param {SnapshotDiff} diff
|
|
334
|
+
* @returns {string}
|
|
335
|
+
*/
|
|
336
|
+
declare function formatDiffForTui(diff: SnapshotDiff$1): string;
|
|
337
|
+
/**
|
|
338
|
+
* Structured JSON output for a snapshot diff.
|
|
339
|
+
*
|
|
340
|
+
* @param {SnapshotDiff} diff
|
|
341
|
+
* @returns {SnapshotDiff}
|
|
342
|
+
*/
|
|
343
|
+
declare function formatDiffAsJson(diff: SnapshotDiff$1): SnapshotDiff$1;
|
|
344
|
+
type ParsedSnapshot$1 = ParsedSnapshot$3;
|
|
345
|
+
type Snapshot$2 = Snapshot$5;
|
|
346
|
+
type SnapshotDiff$1 = SnapshotDiff$2;
|
|
347
|
+
|
|
348
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
349
|
+
/** @typedef {import("../BranchInfo.ts").BranchInfo} BranchInfo */
|
|
350
|
+
/** @typedef {import("../ForkParams.ts").ForkParams} ForkParams */
|
|
351
|
+
/** @typedef {import("../snapshot/Snapshot.ts").Snapshot} Snapshot */
|
|
352
|
+
/**
|
|
353
|
+
* Fork a run at the given frame, returning the child run metadata.
|
|
354
|
+
*
|
|
355
|
+
* @param {SmithersDb} adapter
|
|
356
|
+
* @param {ForkParams} params
|
|
357
|
+
* @returns {Promise<{ runId: string; branch: BranchInfo; snapshot: Snapshot }>}
|
|
358
|
+
*/
|
|
359
|
+
declare function forkRun(adapter: SmithersDb$8, params: ForkParams$1): Promise<{
|
|
360
|
+
runId: string;
|
|
361
|
+
branch: BranchInfo$1;
|
|
362
|
+
snapshot: Snapshot$1;
|
|
363
|
+
}>;
|
|
364
|
+
/**
|
|
365
|
+
* List branches that were forked from the given parent run.
|
|
366
|
+
*
|
|
367
|
+
* @param {SmithersDb} adapter
|
|
368
|
+
* @param {string} parentRunId
|
|
369
|
+
* @returns {Promise<BranchInfo[]>}
|
|
370
|
+
*/
|
|
371
|
+
declare function listBranches(adapter: SmithersDb$8, parentRunId: string): Promise<BranchInfo$1[]>;
|
|
372
|
+
/**
|
|
373
|
+
* Get the branch record for a run, if any.
|
|
374
|
+
*
|
|
375
|
+
* @param {SmithersDb} adapter
|
|
376
|
+
* @param {string} runId
|
|
377
|
+
* @returns {Promise<BranchInfo | undefined>}
|
|
378
|
+
*/
|
|
379
|
+
declare function getBranchInfo(adapter: SmithersDb$8, runId: string): Promise<BranchInfo$1 | undefined>;
|
|
380
|
+
type SmithersDb$8 = _smithers_db_adapter.SmithersDb;
|
|
381
|
+
type BranchInfo$1 = BranchInfo$2;
|
|
382
|
+
type ForkParams$1 = ForkParams$2;
|
|
383
|
+
type Snapshot$1 = Snapshot$5;
|
|
384
|
+
|
|
385
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
386
|
+
/**
|
|
387
|
+
* Record the current VCS revision for a run/frame pair.
|
|
388
|
+
*
|
|
389
|
+
* @param {SmithersDb} adapter
|
|
390
|
+
* @param {string} runId
|
|
391
|
+
* @param {number} frameNo
|
|
392
|
+
* @param {{ cwd?: string }} [opts]
|
|
393
|
+
* @returns {Promise<VcsTag | null>}
|
|
394
|
+
*/
|
|
395
|
+
declare function tagSnapshotVcs(adapter: SmithersDb$7, runId: string, frameNo: number, opts?: {
|
|
396
|
+
cwd?: string;
|
|
397
|
+
}): Promise<VcsTag$1 | null>;
|
|
398
|
+
/**
|
|
399
|
+
* Load the VCS revision tag for a run/frame pair, if any.
|
|
400
|
+
*
|
|
401
|
+
* @param {SmithersDb} adapter
|
|
402
|
+
* @param {string} runId
|
|
403
|
+
* @param {number} frameNo
|
|
404
|
+
* @returns {Promise<VcsTag | undefined>}
|
|
405
|
+
*/
|
|
406
|
+
declare function loadVcsTag(adapter: SmithersDb$7, runId: string, frameNo: number): Promise<VcsTag$1 | undefined>;
|
|
407
|
+
/**
|
|
408
|
+
* Create a jj workspace at the revision recorded for a run/frame pair.
|
|
409
|
+
*
|
|
410
|
+
* @param {SmithersDb} adapter
|
|
411
|
+
* @param {string} runId
|
|
412
|
+
* @param {number} frameNo
|
|
413
|
+
* @param {string} workspacePath
|
|
414
|
+
* @returns {Promise<{ workspacePath: string; vcsPointer: string } | null>}
|
|
415
|
+
*/
|
|
416
|
+
declare function resolveWorkflowAtRevision(adapter: SmithersDb$7, runId: string, frameNo: number, workspacePath: string): Promise<{
|
|
417
|
+
workspacePath: string;
|
|
418
|
+
vcsPointer: string;
|
|
419
|
+
} | null>;
|
|
420
|
+
/**
|
|
421
|
+
* Revert the working copy to the VCS revision for a run/frame pair.
|
|
422
|
+
*
|
|
423
|
+
* @param {SmithersDb} adapter
|
|
424
|
+
* @param {string} runId
|
|
425
|
+
* @param {number} frameNo
|
|
426
|
+
* @param {{ cwd?: string }} [opts]
|
|
427
|
+
* @returns {Promise<{ restored: boolean; vcsPointer: string | null; error?: string }>}
|
|
428
|
+
*/
|
|
429
|
+
declare function rerunAtRevision(adapter: SmithersDb$7, runId: string, frameNo: number, opts?: {
|
|
430
|
+
cwd?: string;
|
|
431
|
+
}): Promise<{
|
|
432
|
+
restored: boolean;
|
|
433
|
+
vcsPointer: string | null;
|
|
434
|
+
error?: string;
|
|
435
|
+
}>;
|
|
436
|
+
type SmithersDb$7 = _smithers_db_adapter.SmithersDb;
|
|
437
|
+
type VcsTag$1 = VcsTag$2;
|
|
438
|
+
|
|
439
|
+
/** @typedef {import("../TimelineTree.ts").TimelineTree} TimelineTree */
|
|
440
|
+
/**
|
|
441
|
+
* @param {TimelineTree} tree
|
|
442
|
+
* @returns {string}
|
|
443
|
+
*/
|
|
444
|
+
declare function formatTimelineForTui(tree: TimelineTree$3, indent?: number): string;
|
|
445
|
+
type TimelineTree$3 = TimelineTree$4;
|
|
446
|
+
|
|
447
|
+
/** @typedef {import("../TimelineTree.ts").TimelineTree} TimelineTree */
|
|
448
|
+
/**
|
|
449
|
+
* @param {TimelineTree} tree
|
|
450
|
+
* @returns {object}
|
|
451
|
+
*/
|
|
452
|
+
declare function formatTimelineAsJson(tree: TimelineTree$2): object;
|
|
453
|
+
type TimelineTree$2 = TimelineTree$4;
|
|
454
|
+
|
|
455
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
456
|
+
/** @typedef {import("../RunTimeline.ts").RunTimeline} RunTimeline */
|
|
457
|
+
/** @typedef {import("../TimelineTree.ts").TimelineTree} TimelineTree */
|
|
458
|
+
/**
|
|
459
|
+
* Build the flat timeline (snapshots + branches) for a run.
|
|
460
|
+
*
|
|
461
|
+
* @param {SmithersDb} adapter
|
|
462
|
+
* @param {string} runId
|
|
463
|
+
* @returns {Promise<RunTimeline>}
|
|
464
|
+
*/
|
|
465
|
+
declare function buildTimeline(adapter: SmithersDb$6, runId: string): Promise<RunTimeline$1>;
|
|
466
|
+
/**
|
|
467
|
+
* Build the recursive timeline tree (run + all descendants) for a run.
|
|
468
|
+
*
|
|
469
|
+
* @param {SmithersDb} adapter
|
|
470
|
+
* @param {string} runId
|
|
471
|
+
* @returns {Promise<TimelineTree>}
|
|
472
|
+
*/
|
|
473
|
+
declare function buildTimelineTree(adapter: SmithersDb$6, runId: string): Promise<TimelineTree$1>;
|
|
474
|
+
|
|
475
|
+
type SmithersDb$6 = _smithers_db_adapter.SmithersDb;
|
|
476
|
+
type RunTimeline$1 = RunTimeline$2;
|
|
477
|
+
type TimelineTree$1 = TimelineTree$4;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Full state snapshot captured at each frame commit.
|
|
481
|
+
* PK: (run_id, frame_no)
|
|
482
|
+
*/
|
|
483
|
+
declare const smithersSnapshots: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
484
|
+
name: "_smithers_snapshots";
|
|
485
|
+
schema: undefined;
|
|
486
|
+
columns: {
|
|
487
|
+
runId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
488
|
+
name: "run_id";
|
|
489
|
+
tableName: "_smithers_snapshots";
|
|
490
|
+
dataType: "string";
|
|
491
|
+
columnType: "SQLiteText";
|
|
492
|
+
data: string;
|
|
493
|
+
driverParam: string;
|
|
494
|
+
notNull: true;
|
|
495
|
+
hasDefault: false;
|
|
496
|
+
isPrimaryKey: false;
|
|
497
|
+
isAutoincrement: false;
|
|
498
|
+
hasRuntimeDefault: false;
|
|
499
|
+
enumValues: [string, ...string[]];
|
|
500
|
+
baseColumn: never;
|
|
501
|
+
identity: undefined;
|
|
502
|
+
generated: undefined;
|
|
503
|
+
}, {}, {
|
|
504
|
+
length: number | undefined;
|
|
505
|
+
}>;
|
|
506
|
+
frameNo: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
507
|
+
name: "frame_no";
|
|
508
|
+
tableName: "_smithers_snapshots";
|
|
509
|
+
dataType: "number";
|
|
510
|
+
columnType: "SQLiteInteger";
|
|
511
|
+
data: number;
|
|
512
|
+
driverParam: number;
|
|
513
|
+
notNull: true;
|
|
514
|
+
hasDefault: false;
|
|
515
|
+
isPrimaryKey: false;
|
|
516
|
+
isAutoincrement: false;
|
|
517
|
+
hasRuntimeDefault: false;
|
|
518
|
+
enumValues: undefined;
|
|
519
|
+
baseColumn: never;
|
|
520
|
+
identity: undefined;
|
|
521
|
+
generated: undefined;
|
|
522
|
+
}, {}, {}>;
|
|
523
|
+
nodesJson: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
524
|
+
name: "nodes_json";
|
|
525
|
+
tableName: "_smithers_snapshots";
|
|
526
|
+
dataType: "string";
|
|
527
|
+
columnType: "SQLiteText";
|
|
528
|
+
data: string;
|
|
529
|
+
driverParam: string;
|
|
530
|
+
notNull: true;
|
|
531
|
+
hasDefault: false;
|
|
532
|
+
isPrimaryKey: false;
|
|
533
|
+
isAutoincrement: false;
|
|
534
|
+
hasRuntimeDefault: false;
|
|
535
|
+
enumValues: [string, ...string[]];
|
|
536
|
+
baseColumn: never;
|
|
537
|
+
identity: undefined;
|
|
538
|
+
generated: undefined;
|
|
539
|
+
}, {}, {
|
|
540
|
+
length: number | undefined;
|
|
541
|
+
}>;
|
|
542
|
+
outputsJson: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
543
|
+
name: "outputs_json";
|
|
544
|
+
tableName: "_smithers_snapshots";
|
|
545
|
+
dataType: "string";
|
|
546
|
+
columnType: "SQLiteText";
|
|
547
|
+
data: string;
|
|
548
|
+
driverParam: string;
|
|
549
|
+
notNull: true;
|
|
550
|
+
hasDefault: false;
|
|
551
|
+
isPrimaryKey: false;
|
|
552
|
+
isAutoincrement: false;
|
|
553
|
+
hasRuntimeDefault: false;
|
|
554
|
+
enumValues: [string, ...string[]];
|
|
555
|
+
baseColumn: never;
|
|
556
|
+
identity: undefined;
|
|
557
|
+
generated: undefined;
|
|
558
|
+
}, {}, {
|
|
559
|
+
length: number | undefined;
|
|
560
|
+
}>;
|
|
561
|
+
ralphJson: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
562
|
+
name: "ralph_json";
|
|
563
|
+
tableName: "_smithers_snapshots";
|
|
564
|
+
dataType: "string";
|
|
565
|
+
columnType: "SQLiteText";
|
|
566
|
+
data: string;
|
|
567
|
+
driverParam: string;
|
|
568
|
+
notNull: true;
|
|
569
|
+
hasDefault: false;
|
|
570
|
+
isPrimaryKey: false;
|
|
571
|
+
isAutoincrement: false;
|
|
572
|
+
hasRuntimeDefault: false;
|
|
573
|
+
enumValues: [string, ...string[]];
|
|
574
|
+
baseColumn: never;
|
|
575
|
+
identity: undefined;
|
|
576
|
+
generated: undefined;
|
|
577
|
+
}, {}, {
|
|
578
|
+
length: number | undefined;
|
|
579
|
+
}>;
|
|
580
|
+
inputJson: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
581
|
+
name: "input_json";
|
|
582
|
+
tableName: "_smithers_snapshots";
|
|
583
|
+
dataType: "string";
|
|
584
|
+
columnType: "SQLiteText";
|
|
585
|
+
data: string;
|
|
586
|
+
driverParam: string;
|
|
587
|
+
notNull: true;
|
|
588
|
+
hasDefault: false;
|
|
589
|
+
isPrimaryKey: false;
|
|
590
|
+
isAutoincrement: false;
|
|
591
|
+
hasRuntimeDefault: false;
|
|
592
|
+
enumValues: [string, ...string[]];
|
|
593
|
+
baseColumn: never;
|
|
594
|
+
identity: undefined;
|
|
595
|
+
generated: undefined;
|
|
596
|
+
}, {}, {
|
|
597
|
+
length: number | undefined;
|
|
598
|
+
}>;
|
|
599
|
+
vcsPointer: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
600
|
+
name: "vcs_pointer";
|
|
601
|
+
tableName: "_smithers_snapshots";
|
|
602
|
+
dataType: "string";
|
|
603
|
+
columnType: "SQLiteText";
|
|
604
|
+
data: string;
|
|
605
|
+
driverParam: string;
|
|
606
|
+
notNull: false;
|
|
607
|
+
hasDefault: false;
|
|
608
|
+
isPrimaryKey: false;
|
|
609
|
+
isAutoincrement: false;
|
|
610
|
+
hasRuntimeDefault: false;
|
|
611
|
+
enumValues: [string, ...string[]];
|
|
612
|
+
baseColumn: never;
|
|
613
|
+
identity: undefined;
|
|
614
|
+
generated: undefined;
|
|
615
|
+
}, {}, {
|
|
616
|
+
length: number | undefined;
|
|
617
|
+
}>;
|
|
618
|
+
workflowHash: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
619
|
+
name: "workflow_hash";
|
|
620
|
+
tableName: "_smithers_snapshots";
|
|
621
|
+
dataType: "string";
|
|
622
|
+
columnType: "SQLiteText";
|
|
623
|
+
data: string;
|
|
624
|
+
driverParam: string;
|
|
625
|
+
notNull: false;
|
|
626
|
+
hasDefault: false;
|
|
627
|
+
isPrimaryKey: false;
|
|
628
|
+
isAutoincrement: false;
|
|
629
|
+
hasRuntimeDefault: false;
|
|
630
|
+
enumValues: [string, ...string[]];
|
|
631
|
+
baseColumn: never;
|
|
632
|
+
identity: undefined;
|
|
633
|
+
generated: undefined;
|
|
634
|
+
}, {}, {
|
|
635
|
+
length: number | undefined;
|
|
636
|
+
}>;
|
|
637
|
+
contentHash: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
638
|
+
name: "content_hash";
|
|
639
|
+
tableName: "_smithers_snapshots";
|
|
640
|
+
dataType: "string";
|
|
641
|
+
columnType: "SQLiteText";
|
|
642
|
+
data: string;
|
|
643
|
+
driverParam: string;
|
|
644
|
+
notNull: true;
|
|
645
|
+
hasDefault: false;
|
|
646
|
+
isPrimaryKey: false;
|
|
647
|
+
isAutoincrement: false;
|
|
648
|
+
hasRuntimeDefault: false;
|
|
649
|
+
enumValues: [string, ...string[]];
|
|
650
|
+
baseColumn: never;
|
|
651
|
+
identity: undefined;
|
|
652
|
+
generated: undefined;
|
|
653
|
+
}, {}, {
|
|
654
|
+
length: number | undefined;
|
|
655
|
+
}>;
|
|
656
|
+
createdAtMs: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
657
|
+
name: "created_at_ms";
|
|
658
|
+
tableName: "_smithers_snapshots";
|
|
659
|
+
dataType: "number";
|
|
660
|
+
columnType: "SQLiteInteger";
|
|
661
|
+
data: number;
|
|
662
|
+
driverParam: number;
|
|
663
|
+
notNull: true;
|
|
664
|
+
hasDefault: false;
|
|
665
|
+
isPrimaryKey: false;
|
|
666
|
+
isAutoincrement: false;
|
|
667
|
+
hasRuntimeDefault: false;
|
|
668
|
+
enumValues: undefined;
|
|
669
|
+
baseColumn: never;
|
|
670
|
+
identity: undefined;
|
|
671
|
+
generated: undefined;
|
|
672
|
+
}, {}, {}>;
|
|
673
|
+
};
|
|
674
|
+
dialect: "sqlite";
|
|
675
|
+
}>;
|
|
676
|
+
/**
|
|
677
|
+
* Parent-child fork relationships between runs.
|
|
678
|
+
* PK: run_id (the child run)
|
|
679
|
+
*/
|
|
680
|
+
declare const smithersBranches: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
681
|
+
name: "_smithers_branches";
|
|
682
|
+
schema: undefined;
|
|
683
|
+
columns: {
|
|
684
|
+
runId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
685
|
+
name: "run_id";
|
|
686
|
+
tableName: "_smithers_branches";
|
|
687
|
+
dataType: "string";
|
|
688
|
+
columnType: "SQLiteText";
|
|
689
|
+
data: string;
|
|
690
|
+
driverParam: string;
|
|
691
|
+
notNull: true;
|
|
692
|
+
hasDefault: false;
|
|
693
|
+
isPrimaryKey: true;
|
|
694
|
+
isAutoincrement: false;
|
|
695
|
+
hasRuntimeDefault: false;
|
|
696
|
+
enumValues: [string, ...string[]];
|
|
697
|
+
baseColumn: never;
|
|
698
|
+
identity: undefined;
|
|
699
|
+
generated: undefined;
|
|
700
|
+
}, {}, {
|
|
701
|
+
length: number | undefined;
|
|
702
|
+
}>;
|
|
703
|
+
parentRunId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
704
|
+
name: "parent_run_id";
|
|
705
|
+
tableName: "_smithers_branches";
|
|
706
|
+
dataType: "string";
|
|
707
|
+
columnType: "SQLiteText";
|
|
708
|
+
data: string;
|
|
709
|
+
driverParam: string;
|
|
710
|
+
notNull: true;
|
|
711
|
+
hasDefault: false;
|
|
712
|
+
isPrimaryKey: false;
|
|
713
|
+
isAutoincrement: false;
|
|
714
|
+
hasRuntimeDefault: false;
|
|
715
|
+
enumValues: [string, ...string[]];
|
|
716
|
+
baseColumn: never;
|
|
717
|
+
identity: undefined;
|
|
718
|
+
generated: undefined;
|
|
719
|
+
}, {}, {
|
|
720
|
+
length: number | undefined;
|
|
721
|
+
}>;
|
|
722
|
+
parentFrameNo: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
723
|
+
name: "parent_frame_no";
|
|
724
|
+
tableName: "_smithers_branches";
|
|
725
|
+
dataType: "number";
|
|
726
|
+
columnType: "SQLiteInteger";
|
|
727
|
+
data: number;
|
|
728
|
+
driverParam: number;
|
|
729
|
+
notNull: true;
|
|
730
|
+
hasDefault: false;
|
|
731
|
+
isPrimaryKey: false;
|
|
732
|
+
isAutoincrement: false;
|
|
733
|
+
hasRuntimeDefault: false;
|
|
734
|
+
enumValues: undefined;
|
|
735
|
+
baseColumn: never;
|
|
736
|
+
identity: undefined;
|
|
737
|
+
generated: undefined;
|
|
738
|
+
}, {}, {}>;
|
|
739
|
+
branchLabel: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
740
|
+
name: "branch_label";
|
|
741
|
+
tableName: "_smithers_branches";
|
|
742
|
+
dataType: "string";
|
|
743
|
+
columnType: "SQLiteText";
|
|
744
|
+
data: string;
|
|
745
|
+
driverParam: string;
|
|
746
|
+
notNull: false;
|
|
747
|
+
hasDefault: false;
|
|
748
|
+
isPrimaryKey: false;
|
|
749
|
+
isAutoincrement: false;
|
|
750
|
+
hasRuntimeDefault: false;
|
|
751
|
+
enumValues: [string, ...string[]];
|
|
752
|
+
baseColumn: never;
|
|
753
|
+
identity: undefined;
|
|
754
|
+
generated: undefined;
|
|
755
|
+
}, {}, {
|
|
756
|
+
length: number | undefined;
|
|
757
|
+
}>;
|
|
758
|
+
forkDescription: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
759
|
+
name: "fork_description";
|
|
760
|
+
tableName: "_smithers_branches";
|
|
761
|
+
dataType: "string";
|
|
762
|
+
columnType: "SQLiteText";
|
|
763
|
+
data: string;
|
|
764
|
+
driverParam: string;
|
|
765
|
+
notNull: false;
|
|
766
|
+
hasDefault: false;
|
|
767
|
+
isPrimaryKey: false;
|
|
768
|
+
isAutoincrement: false;
|
|
769
|
+
hasRuntimeDefault: false;
|
|
770
|
+
enumValues: [string, ...string[]];
|
|
771
|
+
baseColumn: never;
|
|
772
|
+
identity: undefined;
|
|
773
|
+
generated: undefined;
|
|
774
|
+
}, {}, {
|
|
775
|
+
length: number | undefined;
|
|
776
|
+
}>;
|
|
777
|
+
createdAtMs: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
778
|
+
name: "created_at_ms";
|
|
779
|
+
tableName: "_smithers_branches";
|
|
780
|
+
dataType: "number";
|
|
781
|
+
columnType: "SQLiteInteger";
|
|
782
|
+
data: number;
|
|
783
|
+
driverParam: number;
|
|
784
|
+
notNull: true;
|
|
785
|
+
hasDefault: false;
|
|
786
|
+
isPrimaryKey: false;
|
|
787
|
+
isAutoincrement: false;
|
|
788
|
+
hasRuntimeDefault: false;
|
|
789
|
+
enumValues: undefined;
|
|
790
|
+
baseColumn: never;
|
|
791
|
+
identity: undefined;
|
|
792
|
+
generated: undefined;
|
|
793
|
+
}, {}, {}>;
|
|
794
|
+
};
|
|
795
|
+
dialect: "sqlite";
|
|
796
|
+
}>;
|
|
797
|
+
/**
|
|
798
|
+
* VCS revision metadata per snapshot.
|
|
799
|
+
* PK: (run_id, frame_no)
|
|
800
|
+
*/
|
|
801
|
+
declare const smithersVcsTags: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
802
|
+
name: "_smithers_vcs_tags";
|
|
803
|
+
schema: undefined;
|
|
804
|
+
columns: {
|
|
805
|
+
runId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
806
|
+
name: "run_id";
|
|
807
|
+
tableName: "_smithers_vcs_tags";
|
|
808
|
+
dataType: "string";
|
|
809
|
+
columnType: "SQLiteText";
|
|
810
|
+
data: string;
|
|
811
|
+
driverParam: string;
|
|
812
|
+
notNull: true;
|
|
813
|
+
hasDefault: false;
|
|
814
|
+
isPrimaryKey: false;
|
|
815
|
+
isAutoincrement: false;
|
|
816
|
+
hasRuntimeDefault: false;
|
|
817
|
+
enumValues: [string, ...string[]];
|
|
818
|
+
baseColumn: never;
|
|
819
|
+
identity: undefined;
|
|
820
|
+
generated: undefined;
|
|
821
|
+
}, {}, {
|
|
822
|
+
length: number | undefined;
|
|
823
|
+
}>;
|
|
824
|
+
frameNo: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
825
|
+
name: "frame_no";
|
|
826
|
+
tableName: "_smithers_vcs_tags";
|
|
827
|
+
dataType: "number";
|
|
828
|
+
columnType: "SQLiteInteger";
|
|
829
|
+
data: number;
|
|
830
|
+
driverParam: number;
|
|
831
|
+
notNull: true;
|
|
832
|
+
hasDefault: false;
|
|
833
|
+
isPrimaryKey: false;
|
|
834
|
+
isAutoincrement: false;
|
|
835
|
+
hasRuntimeDefault: false;
|
|
836
|
+
enumValues: undefined;
|
|
837
|
+
baseColumn: never;
|
|
838
|
+
identity: undefined;
|
|
839
|
+
generated: undefined;
|
|
840
|
+
}, {}, {}>;
|
|
841
|
+
vcsType: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
842
|
+
name: "vcs_type";
|
|
843
|
+
tableName: "_smithers_vcs_tags";
|
|
844
|
+
dataType: "string";
|
|
845
|
+
columnType: "SQLiteText";
|
|
846
|
+
data: string;
|
|
847
|
+
driverParam: string;
|
|
848
|
+
notNull: true;
|
|
849
|
+
hasDefault: false;
|
|
850
|
+
isPrimaryKey: false;
|
|
851
|
+
isAutoincrement: false;
|
|
852
|
+
hasRuntimeDefault: false;
|
|
853
|
+
enumValues: [string, ...string[]];
|
|
854
|
+
baseColumn: never;
|
|
855
|
+
identity: undefined;
|
|
856
|
+
generated: undefined;
|
|
857
|
+
}, {}, {
|
|
858
|
+
length: number | undefined;
|
|
859
|
+
}>;
|
|
860
|
+
vcsPointer: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
861
|
+
name: "vcs_pointer";
|
|
862
|
+
tableName: "_smithers_vcs_tags";
|
|
863
|
+
dataType: "string";
|
|
864
|
+
columnType: "SQLiteText";
|
|
865
|
+
data: string;
|
|
866
|
+
driverParam: string;
|
|
867
|
+
notNull: true;
|
|
868
|
+
hasDefault: false;
|
|
869
|
+
isPrimaryKey: false;
|
|
870
|
+
isAutoincrement: false;
|
|
871
|
+
hasRuntimeDefault: false;
|
|
872
|
+
enumValues: [string, ...string[]];
|
|
873
|
+
baseColumn: never;
|
|
874
|
+
identity: undefined;
|
|
875
|
+
generated: undefined;
|
|
876
|
+
}, {}, {
|
|
877
|
+
length: number | undefined;
|
|
878
|
+
}>;
|
|
879
|
+
vcsRoot: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
880
|
+
name: "vcs_root";
|
|
881
|
+
tableName: "_smithers_vcs_tags";
|
|
882
|
+
dataType: "string";
|
|
883
|
+
columnType: "SQLiteText";
|
|
884
|
+
data: string;
|
|
885
|
+
driverParam: string;
|
|
886
|
+
notNull: false;
|
|
887
|
+
hasDefault: false;
|
|
888
|
+
isPrimaryKey: false;
|
|
889
|
+
isAutoincrement: false;
|
|
890
|
+
hasRuntimeDefault: false;
|
|
891
|
+
enumValues: [string, ...string[]];
|
|
892
|
+
baseColumn: never;
|
|
893
|
+
identity: undefined;
|
|
894
|
+
generated: undefined;
|
|
895
|
+
}, {}, {
|
|
896
|
+
length: number | undefined;
|
|
897
|
+
}>;
|
|
898
|
+
jjOperationId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
899
|
+
name: "jj_operation_id";
|
|
900
|
+
tableName: "_smithers_vcs_tags";
|
|
901
|
+
dataType: "string";
|
|
902
|
+
columnType: "SQLiteText";
|
|
903
|
+
data: string;
|
|
904
|
+
driverParam: string;
|
|
905
|
+
notNull: false;
|
|
906
|
+
hasDefault: false;
|
|
907
|
+
isPrimaryKey: false;
|
|
908
|
+
isAutoincrement: false;
|
|
909
|
+
hasRuntimeDefault: false;
|
|
910
|
+
enumValues: [string, ...string[]];
|
|
911
|
+
baseColumn: never;
|
|
912
|
+
identity: undefined;
|
|
913
|
+
generated: undefined;
|
|
914
|
+
}, {}, {
|
|
915
|
+
length: number | undefined;
|
|
916
|
+
}>;
|
|
917
|
+
createdAtMs: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
918
|
+
name: "created_at_ms";
|
|
919
|
+
tableName: "_smithers_vcs_tags";
|
|
920
|
+
dataType: "number";
|
|
921
|
+
columnType: "SQLiteInteger";
|
|
922
|
+
data: number;
|
|
923
|
+
driverParam: number;
|
|
924
|
+
notNull: true;
|
|
925
|
+
hasDefault: false;
|
|
926
|
+
isPrimaryKey: false;
|
|
927
|
+
isAutoincrement: false;
|
|
928
|
+
hasRuntimeDefault: false;
|
|
929
|
+
enumValues: undefined;
|
|
930
|
+
baseColumn: never;
|
|
931
|
+
identity: undefined;
|
|
932
|
+
generated: undefined;
|
|
933
|
+
}, {}, {}>;
|
|
934
|
+
};
|
|
935
|
+
dialect: "sqlite";
|
|
936
|
+
}>;
|
|
937
|
+
|
|
938
|
+
declare class JumpToFrameError extends Error {
|
|
939
|
+
/**
|
|
940
|
+
* @param {string} code
|
|
941
|
+
* @param {string} message
|
|
942
|
+
* @param {{ hint?: string; details?: Record<string, unknown> }} [options]
|
|
943
|
+
*/
|
|
944
|
+
constructor(code: string, message: string, options?: {
|
|
945
|
+
hint?: string;
|
|
946
|
+
details?: Record<string, unknown>;
|
|
947
|
+
});
|
|
948
|
+
/** @type {string} */
|
|
949
|
+
code: string;
|
|
950
|
+
/** @type {string | undefined} */
|
|
951
|
+
hint: string | undefined;
|
|
952
|
+
/** @type {Record<string, unknown> | undefined} */
|
|
953
|
+
details: Record<string, unknown> | undefined;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Validate a jump run id argument.
|
|
958
|
+
*
|
|
959
|
+
* @param {unknown} runId
|
|
960
|
+
* @returns {string}
|
|
961
|
+
*/
|
|
962
|
+
declare function validateJumpRunId(runId: unknown): string;
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Validate a jump frame number argument.
|
|
966
|
+
*
|
|
967
|
+
* @param {unknown} frameNo
|
|
968
|
+
* @returns {number}
|
|
969
|
+
*/
|
|
970
|
+
declare function validateJumpFrameNo(frameNo: unknown): number;
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Rewind a run to a previous frame and make it resumable from that point.
|
|
974
|
+
*
|
|
975
|
+
* @param {JumpToFrameInput} input
|
|
976
|
+
* @returns {Promise<JumpResult>}
|
|
977
|
+
*/
|
|
978
|
+
declare function jumpToFrame(input: JumpToFrameInput$1): Promise<JumpResult$1>;
|
|
979
|
+
type JumpResult$1 = JumpResult$2;
|
|
980
|
+
type JumpToFrameInput$1 = JumpToFrameInput$2;
|
|
981
|
+
|
|
982
|
+
/** @typedef {import("./RewindLockHandle.ts").RewindLockHandle} RewindLockHandle */
|
|
983
|
+
/**
|
|
984
|
+
* Acquire a single-flight lock for one run.
|
|
985
|
+
* Returns null when another rewind for this run is already in progress.
|
|
986
|
+
*
|
|
987
|
+
* @param {string} runId
|
|
988
|
+
* @returns {RewindLockHandle | null}
|
|
989
|
+
*/
|
|
990
|
+
declare function acquireRewindLock(runId: string): RewindLockHandle$1 | null;
|
|
991
|
+
type RewindLockHandle$1 = RewindLockHandle$2;
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* Check whether a run currently holds a rewind lock.
|
|
995
|
+
*
|
|
996
|
+
* @param {string} runId
|
|
997
|
+
* @returns {boolean}
|
|
998
|
+
*/
|
|
999
|
+
declare function hasRewindLock(runId: string): boolean;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Reset lock state for tests.
|
|
1003
|
+
*/
|
|
1004
|
+
declare function resetRewindLocksForTests(): void;
|
|
1005
|
+
|
|
1006
|
+
declare const REWIND_RATE_LIMIT_MAX: 10;
|
|
1007
|
+
|
|
1008
|
+
declare const REWIND_RATE_LIMIT_WINDOW_MS: number;
|
|
1009
|
+
|
|
1010
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
1011
|
+
/**
|
|
1012
|
+
* Evaluate caller-scoped rewind quota for one run.
|
|
1013
|
+
*
|
|
1014
|
+
* @param {{
|
|
1015
|
+
* adapter: SmithersDb;
|
|
1016
|
+
* runId: string;
|
|
1017
|
+
* caller: string;
|
|
1018
|
+
* nowMs?: () => number;
|
|
1019
|
+
* maxPerWindow?: number;
|
|
1020
|
+
* windowMs?: number;
|
|
1021
|
+
* }} input
|
|
1022
|
+
*/
|
|
1023
|
+
declare function evaluateRewindRateLimit(input: {
|
|
1024
|
+
adapter: SmithersDb$5;
|
|
1025
|
+
runId: string;
|
|
1026
|
+
caller: string;
|
|
1027
|
+
nowMs?: () => number;
|
|
1028
|
+
maxPerWindow?: number;
|
|
1029
|
+
windowMs?: number;
|
|
1030
|
+
}): Promise<{
|
|
1031
|
+
limited: boolean;
|
|
1032
|
+
used: number;
|
|
1033
|
+
remaining: number;
|
|
1034
|
+
max: number;
|
|
1035
|
+
windowMs: number;
|
|
1036
|
+
windowStartedAtMs: number;
|
|
1037
|
+
}>;
|
|
1038
|
+
type SmithersDb$5 = _smithers_db_adapter.SmithersDb;
|
|
1039
|
+
|
|
1040
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
1041
|
+
/** @typedef {import("./RewindAuditResult.ts").RewindAuditResult} RewindAuditResult */
|
|
1042
|
+
/**
|
|
1043
|
+
* Persist one audit row for a jump-to-frame attempt.
|
|
1044
|
+
*
|
|
1045
|
+
* @param {SmithersDb} adapter
|
|
1046
|
+
* @param {{
|
|
1047
|
+
* runId: string;
|
|
1048
|
+
* fromFrameNo: number;
|
|
1049
|
+
* toFrameNo: number;
|
|
1050
|
+
* caller: string;
|
|
1051
|
+
* timestampMs: number;
|
|
1052
|
+
* result: RewindAuditResult;
|
|
1053
|
+
* durationMs?: number | null;
|
|
1054
|
+
* }} row
|
|
1055
|
+
* @returns {Promise<number | null>}
|
|
1056
|
+
*/
|
|
1057
|
+
declare function writeRewindAuditRow(adapter: SmithersDb$4, row: {
|
|
1058
|
+
runId: string;
|
|
1059
|
+
fromFrameNo: number;
|
|
1060
|
+
toFrameNo: number;
|
|
1061
|
+
caller: string;
|
|
1062
|
+
timestampMs: number;
|
|
1063
|
+
result: RewindAuditResult$3;
|
|
1064
|
+
durationMs?: number | null;
|
|
1065
|
+
}): Promise<number | null>;
|
|
1066
|
+
type SmithersDb$4 = _smithers_db_adapter.SmithersDb;
|
|
1067
|
+
type RewindAuditResult$3 = RewindAuditResult$4;
|
|
1068
|
+
|
|
1069
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
1070
|
+
/** @typedef {import("./RewindAuditResult.ts").RewindAuditResult} RewindAuditResult */
|
|
1071
|
+
/**
|
|
1072
|
+
* Update an existing rewind audit row's result and duration.
|
|
1073
|
+
* Used to mark an `in_progress` row as `success`, `failed`, or `partial`.
|
|
1074
|
+
*
|
|
1075
|
+
* @param {SmithersDb} adapter
|
|
1076
|
+
* @param {{ id: number; result: RewindAuditResult; durationMs?: number | null; fromFrameNo?: number }} row
|
|
1077
|
+
*/
|
|
1078
|
+
declare function updateRewindAuditRow(adapter: SmithersDb$3, row: {
|
|
1079
|
+
id: number;
|
|
1080
|
+
result: RewindAuditResult$2;
|
|
1081
|
+
durationMs?: number | null;
|
|
1082
|
+
fromFrameNo?: number;
|
|
1083
|
+
}): Promise<void>;
|
|
1084
|
+
type SmithersDb$3 = _smithers_db_adapter.SmithersDb;
|
|
1085
|
+
type RewindAuditResult$2 = RewindAuditResult$4;
|
|
1086
|
+
|
|
1087
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
1088
|
+
/**
|
|
1089
|
+
* Count audit rows for one caller and run in a time window.
|
|
1090
|
+
* Only counts terminal (non-in_progress) rows so that a live attempt
|
|
1091
|
+
* does not itself blow the rate-limit quota.
|
|
1092
|
+
*
|
|
1093
|
+
* @param {SmithersDb} adapter
|
|
1094
|
+
* @param {{ runId: string; caller: string; sinceMs: number; }} input
|
|
1095
|
+
* @returns {Promise<number>}
|
|
1096
|
+
*/
|
|
1097
|
+
declare function countRecentRewindAuditRows(adapter: SmithersDb$2, input: {
|
|
1098
|
+
runId: string;
|
|
1099
|
+
caller: string;
|
|
1100
|
+
sinceMs: number;
|
|
1101
|
+
}): Promise<number>;
|
|
1102
|
+
type SmithersDb$2 = _smithers_db_adapter.SmithersDb;
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Fetch audit rows for tests and diagnostics.
|
|
1106
|
+
*
|
|
1107
|
+
* @param {SmithersDb} adapter
|
|
1108
|
+
* @param {{ runId?: string; limit?: number; }} [input]
|
|
1109
|
+
* @returns {Promise<Array<RewindAuditRow>>}
|
|
1110
|
+
*/
|
|
1111
|
+
declare function listRewindAuditRows(adapter: SmithersDb$1, input?: {
|
|
1112
|
+
runId?: string;
|
|
1113
|
+
limit?: number;
|
|
1114
|
+
}): Promise<Array<RewindAuditRow>>;
|
|
1115
|
+
type SmithersDb$1 = _smithers_db_adapter.SmithersDb;
|
|
1116
|
+
type RewindAuditResult$1 = RewindAuditResult$4;
|
|
1117
|
+
type RewindAuditRow = {
|
|
1118
|
+
id: number;
|
|
1119
|
+
runId: string;
|
|
1120
|
+
fromFrameNo: number;
|
|
1121
|
+
toFrameNo: number;
|
|
1122
|
+
caller: string;
|
|
1123
|
+
timestampMs: number;
|
|
1124
|
+
result: RewindAuditResult$1;
|
|
1125
|
+
durationMs: number | null;
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
/** @typedef {import("@smithers-orchestrator/db/adapter").SmithersDb} SmithersDb */
|
|
1129
|
+
/**
|
|
1130
|
+
* On startup, find rewind audit rows left in `in_progress` by a prior crash,
|
|
1131
|
+
* mark them as `partial`, and flag the associated runs as `needs_attention`.
|
|
1132
|
+
*
|
|
1133
|
+
* @param {SmithersDb} adapter
|
|
1134
|
+
* @param {{ nowMs?: () => number }} [options]
|
|
1135
|
+
* @returns {Promise<{ recovered: Array<{ id: number; runId: string }> }>}
|
|
1136
|
+
*/
|
|
1137
|
+
declare function recoverInProgressRewindAudits(adapter: SmithersDb, options?: {
|
|
1138
|
+
nowMs?: () => number;
|
|
1139
|
+
}): Promise<{
|
|
1140
|
+
recovered: Array<{
|
|
1141
|
+
id: number;
|
|
1142
|
+
runId: string;
|
|
1143
|
+
}>;
|
|
1144
|
+
}>;
|
|
1145
|
+
type SmithersDb = _smithers_db_adapter.SmithersDb;
|
|
1146
|
+
|
|
1147
|
+
type BranchInfo = BranchInfo$2;
|
|
1148
|
+
type ForkParams = ForkParams$2;
|
|
1149
|
+
type NodeChange = NodeChange$1;
|
|
1150
|
+
type NodeSnapshot = NodeSnapshot$1;
|
|
1151
|
+
type OutputChange = OutputChange$1;
|
|
1152
|
+
type ParsedSnapshot = ParsedSnapshot$3;
|
|
1153
|
+
type RalphChange = RalphChange$1;
|
|
1154
|
+
type RalphSnapshot = RalphSnapshot$1;
|
|
1155
|
+
type ReplayParams = ReplayParams$2;
|
|
1156
|
+
type ReplayResult = ReplayResult$2;
|
|
1157
|
+
type RunTimeline = RunTimeline$2;
|
|
1158
|
+
type Snapshot = Snapshot$5;
|
|
1159
|
+
type SnapshotData = SnapshotData$2;
|
|
1160
|
+
type SnapshotDiff = SnapshotDiff$2;
|
|
1161
|
+
type TimelineFrame = TimelineFrame$1;
|
|
1162
|
+
type TimelineTree = TimelineTree$4;
|
|
1163
|
+
type VcsTag = VcsTag$2;
|
|
1164
|
+
type JumpResult = JumpResult$2;
|
|
1165
|
+
type JumpToFrameInput = JumpToFrameInput$2;
|
|
1166
|
+
type JumpStepName = JumpStepName$1;
|
|
1167
|
+
type RewindLockHandle = RewindLockHandle$2;
|
|
1168
|
+
type RewindAuditResult = RewindAuditResult$4;
|
|
1169
|
+
|
|
1170
|
+
export { type BranchInfo, type ForkParams, type JumpResult, type JumpStepName, JumpToFrameError, type JumpToFrameInput, type NodeChange, type NodeSnapshot, type OutputChange, type ParsedSnapshot, REWIND_RATE_LIMIT_MAX, REWIND_RATE_LIMIT_WINDOW_MS, type RalphChange, type RalphSnapshot, type ReplayParams, type ReplayResult, type RewindAuditResult, type RewindLockHandle, type RunTimeline, type Snapshot, type SnapshotData, type SnapshotDiff, type TimelineFrame, type TimelineTree, type VcsTag, acquireRewindLock, buildTimeline, buildTimelineTree, captureSnapshot, countRecentRewindAuditRows, diffRawSnapshots, diffSnapshots, evaluateRewindRateLimit, forkRun, formatDiffAsJson, formatDiffForTui, formatTimelineAsJson, formatTimelineForTui, getBranchInfo, hasRewindLock, jumpToFrame, listBranches, listRewindAuditRows, listSnapshots, loadLatestSnapshot, loadSnapshot, loadVcsTag, parseSnapshot, recoverInProgressRewindAudits, replayFromCheckpoint, replaysStarted, rerunAtRevision, resetRewindLocksForTests, resolveWorkflowAtRevision, runForksCreated, smithersBranches, smithersSnapshots, smithersVcsTags, snapshotDuration, snapshotsCaptured, tagSnapshotVcs, updateRewindAuditRow, validateJumpFrameNo, validateJumpRunId, writeRewindAuditRow };
|