@a5c-ai/babysitter-sdk 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/main.d.ts +5 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +1343 -0
- package/dist/cli/nodeTaskRunner.d.ts +16 -0
- package/dist/cli/nodeTaskRunner.d.ts.map +1 -0
- package/dist/cli/nodeTaskRunner.js +46 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/runner/env.d.ts +58 -0
- package/dist/runner/env.d.ts.map +1 -0
- package/dist/runner/env.js +113 -0
- package/dist/runner/index.d.ts +3 -0
- package/dist/runner/index.d.ts.map +1 -0
- package/dist/runner/index.js +18 -0
- package/dist/runner/nodeRunner.d.ts +60 -0
- package/dist/runner/nodeRunner.d.ts.map +1 -0
- package/dist/runner/nodeRunner.js +354 -0
- package/dist/runtime/commitEffectResult.d.ts +3 -0
- package/dist/runtime/commitEffectResult.d.ts.map +1 -0
- package/dist/runtime/commitEffectResult.js +172 -0
- package/dist/runtime/constants.d.ts +2 -0
- package/dist/runtime/constants.d.ts.map +1 -0
- package/dist/runtime/constants.js +5 -0
- package/dist/runtime/createRun.d.ts +3 -0
- package/dist/runtime/createRun.d.ts.map +1 -0
- package/dist/runtime/createRun.js +81 -0
- package/dist/runtime/errorUtils.d.ts +10 -0
- package/dist/runtime/errorUtils.d.ts.map +1 -0
- package/dist/runtime/errorUtils.js +42 -0
- package/dist/runtime/exceptions.d.ts +45 -0
- package/dist/runtime/exceptions.d.ts.map +1 -0
- package/dist/runtime/exceptions.js +99 -0
- package/dist/runtime/index.d.ts +12 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +34 -0
- package/dist/runtime/instrumentation.d.ts +6 -0
- package/dist/runtime/instrumentation.d.ts.map +1 -0
- package/dist/runtime/instrumentation.js +14 -0
- package/dist/runtime/intrinsics/breakpoint.d.ts +4 -0
- package/dist/runtime/intrinsics/breakpoint.d.ts.map +1 -0
- package/dist/runtime/intrinsics/breakpoint.js +42 -0
- package/dist/runtime/intrinsics/index.d.ts +7 -0
- package/dist/runtime/intrinsics/index.d.ts.map +1 -0
- package/dist/runtime/intrinsics/index.js +15 -0
- package/dist/runtime/intrinsics/orchestratorTask.d.ts +4 -0
- package/dist/runtime/intrinsics/orchestratorTask.d.ts.map +1 -0
- package/dist/runtime/intrinsics/orchestratorTask.js +28 -0
- package/dist/runtime/intrinsics/parallel.d.ts +5 -0
- package/dist/runtime/intrinsics/parallel.d.ts.map +1 -0
- package/dist/runtime/intrinsics/parallel.js +45 -0
- package/dist/runtime/intrinsics/sleep.d.ts +4 -0
- package/dist/runtime/intrinsics/sleep.d.ts.map +1 -0
- package/dist/runtime/intrinsics/sleep.js +70 -0
- package/dist/runtime/intrinsics/task.d.ts +20 -0
- package/dist/runtime/intrinsics/task.d.ts.map +1 -0
- package/dist/runtime/intrinsics/task.js +237 -0
- package/dist/runtime/invocation/hashInvocationKey.d.ts +12 -0
- package/dist/runtime/invocation/hashInvocationKey.d.ts.map +1 -0
- package/dist/runtime/invocation/hashInvocationKey.js +12 -0
- package/dist/runtime/invocation/index.d.ts +3 -0
- package/dist/runtime/invocation/index.d.ts.map +1 -0
- package/dist/runtime/invocation/index.js +5 -0
- package/dist/runtime/orchestrateIteration.d.ts +3 -0
- package/dist/runtime/orchestrateIteration.d.ts.map +1 -0
- package/dist/runtime/orchestrateIteration.js +195 -0
- package/dist/runtime/processContext.d.ts +19 -0
- package/dist/runtime/processContext.d.ts.map +1 -0
- package/dist/runtime/processContext.js +55 -0
- package/dist/runtime/replay/createReplayEngine.d.ts +31 -0
- package/dist/runtime/replay/createReplayEngine.d.ts.map +1 -0
- package/dist/runtime/replay/createReplayEngine.js +82 -0
- package/dist/runtime/replay/effectIndex.d.ts +34 -0
- package/dist/runtime/replay/effectIndex.d.ts.map +1 -0
- package/dist/runtime/replay/effectIndex.js +241 -0
- package/dist/runtime/replay/index.d.ts +7 -0
- package/dist/runtime/replay/index.d.ts.map +1 -0
- package/dist/runtime/replay/index.js +19 -0
- package/dist/runtime/replay/replayCursor.d.ts +7 -0
- package/dist/runtime/replay/replayCursor.d.ts.map +1 -0
- package/dist/runtime/replay/replayCursor.js +22 -0
- package/dist/runtime/replay/stateCache.d.ts +48 -0
- package/dist/runtime/replay/stateCache.d.ts.map +1 -0
- package/dist/runtime/replay/stateCache.js +211 -0
- package/dist/runtime/types.d.ts +147 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/storage/atomic.d.ts +2 -0
- package/dist/storage/atomic.d.ts.map +1 -0
- package/dist/storage/atomic.js +54 -0
- package/dist/storage/cleanup.d.ts +4 -0
- package/dist/storage/cleanup.d.ts.map +1 -0
- package/dist/storage/cleanup.js +96 -0
- package/dist/storage/clock.d.ts +6 -0
- package/dist/storage/clock.d.ts.map +1 -0
- package/dist/storage/clock.js +29 -0
- package/dist/storage/createRunDir.d.ts +6 -0
- package/dist/storage/createRunDir.d.ts.map +1 -0
- package/dist/storage/createRunDir.js +59 -0
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +28 -0
- package/dist/storage/journal.d.ts +4 -0
- package/dist/storage/journal.d.ts.map +1 -0
- package/dist/storage/journal.js +103 -0
- package/dist/storage/lock.d.ts +5 -0
- package/dist/storage/lock.d.ts.map +1 -0
- package/dist/storage/lock.js +41 -0
- package/dist/storage/paths.d.ts +19 -0
- package/dist/storage/paths.d.ts.map +1 -0
- package/dist/storage/paths.js +46 -0
- package/dist/storage/runFiles.d.ts +5 -0
- package/dist/storage/runFiles.d.ts.map +1 -0
- package/dist/storage/runFiles.js +39 -0
- package/dist/storage/snapshotState.d.ts +10 -0
- package/dist/storage/snapshotState.d.ts.map +1 -0
- package/dist/storage/snapshotState.js +15 -0
- package/dist/storage/storeTaskArtifacts.d.ts +6 -0
- package/dist/storage/storeTaskArtifacts.d.ts.map +1 -0
- package/dist/storage/storeTaskArtifacts.js +58 -0
- package/dist/storage/tasks.d.ts +17 -0
- package/dist/storage/tasks.d.ts.map +1 -0
- package/dist/storage/tasks.js +82 -0
- package/dist/storage/types.d.ts +112 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +2 -0
- package/dist/storage/ulids.d.ts +11 -0
- package/dist/storage/ulids.d.ts.map +1 -0
- package/dist/storage/ulids.js +25 -0
- package/dist/tasks/batching.d.ts +29 -0
- package/dist/tasks/batching.d.ts.map +1 -0
- package/dist/tasks/batching.js +66 -0
- package/dist/tasks/context.d.ts +11 -0
- package/dist/tasks/context.d.ts.map +1 -0
- package/dist/tasks/context.js +181 -0
- package/dist/tasks/defineTask.d.ts +9 -0
- package/dist/tasks/defineTask.d.ts.map +1 -0
- package/dist/tasks/defineTask.js +58 -0
- package/dist/tasks/index.d.ts +8 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +23 -0
- package/dist/tasks/kinds/index.d.ts +7 -0
- package/dist/tasks/kinds/index.d.ts.map +1 -0
- package/dist/tasks/kinds/index.js +333 -0
- package/dist/tasks/registry.d.ts +53 -0
- package/dist/tasks/registry.d.ts.map +1 -0
- package/dist/tasks/registry.js +145 -0
- package/dist/tasks/serializer.d.ts +60 -0
- package/dist/tasks/serializer.d.ts.map +1 -0
- package/dist/tasks/serializer.js +193 -0
- package/dist/tasks/types.d.ts +148 -0
- package/dist/tasks/types.d.ts.map +1 -0
- package/dist/tasks/types.js +2 -0
- package/dist/test-fixtures/kinds/index.d.ts +56 -0
- package/dist/test-fixtures/kinds/index.d.ts.map +1 -0
- package/dist/test-fixtures/kinds/index.js +44 -0
- package/dist/testing/deterministic.d.ts +90 -0
- package/dist/testing/deterministic.d.ts.map +1 -0
- package/dist/testing/deterministic.js +449 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +23 -0
- package/dist/testing/runHarness.d.ts +64 -0
- package/dist/testing/runHarness.d.ts.map +1 -0
- package/dist/testing/runHarness.js +161 -0
- package/dist/testing/snapshots.d.ts +17 -0
- package/dist/testing/snapshots.d.ts.map +1 -0
- package/dist/testing/snapshots.js +24 -0
- package/package.json +35 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RESULT_SCHEMA_VERSION = exports.TASK_SCHEMA_VERSION = void 0;
|
|
7
|
+
exports.serializeAndWriteTaskDefinition = serializeAndWriteTaskDefinition;
|
|
8
|
+
exports.serializeTaskDefinition = serializeTaskDefinition;
|
|
9
|
+
exports.serializeAndWriteTaskResult = serializeAndWriteTaskResult;
|
|
10
|
+
exports.serializeTaskResult = serializeTaskResult;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
14
|
+
const tasks_1 = require("../storage/tasks");
|
|
15
|
+
const paths_1 = require("../storage/paths");
|
|
16
|
+
const atomic_1 = require("../storage/atomic");
|
|
17
|
+
exports.TASK_SCHEMA_VERSION = "2026.01.tasks-v1";
|
|
18
|
+
exports.RESULT_SCHEMA_VERSION = "2026.01.results-v1";
|
|
19
|
+
const BLOB_THRESHOLD_BYTES = 1024 * 1024; // 1 MiB
|
|
20
|
+
async function serializeAndWriteTaskDefinition(options) {
|
|
21
|
+
const serialized = await serializeTaskDefinition(options);
|
|
22
|
+
const taskRef = await (0, tasks_1.writeTaskDefinition)(options.runDir, options.effectId, serialized);
|
|
23
|
+
return {
|
|
24
|
+
taskRef,
|
|
25
|
+
inputsRef: serialized.inputsRef,
|
|
26
|
+
serialized,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async function serializeTaskDefinition(options) {
|
|
30
|
+
const normalized = normalizeTaskDef(options.task);
|
|
31
|
+
const serialized = {
|
|
32
|
+
schemaVersion: exports.TASK_SCHEMA_VERSION,
|
|
33
|
+
effectId: options.effectId,
|
|
34
|
+
taskId: options.taskId,
|
|
35
|
+
invocationKey: options.invocationKey,
|
|
36
|
+
stepId: options.stepId,
|
|
37
|
+
kind: normalized.kind,
|
|
38
|
+
title: normalized.title,
|
|
39
|
+
description: normalized.description,
|
|
40
|
+
labels: normalized.labels,
|
|
41
|
+
io: normalized.io,
|
|
42
|
+
node: normalized.node,
|
|
43
|
+
breakpoint: normalized.breakpoint,
|
|
44
|
+
orchestratorTask: normalized.orchestratorTask,
|
|
45
|
+
sleep: normalized.sleep,
|
|
46
|
+
metadata: normalized.metadata,
|
|
47
|
+
};
|
|
48
|
+
if (options.inputs !== undefined) {
|
|
49
|
+
const spill = await maybeSpillLargeValue({
|
|
50
|
+
runDir: options.runDir,
|
|
51
|
+
effectId: options.effectId,
|
|
52
|
+
name: "inputs",
|
|
53
|
+
value: options.inputs,
|
|
54
|
+
});
|
|
55
|
+
serialized.inputs = spill.value;
|
|
56
|
+
serialized.inputsRef = spill.ref;
|
|
57
|
+
}
|
|
58
|
+
return serialized;
|
|
59
|
+
}
|
|
60
|
+
async function serializeAndWriteTaskResult(options) {
|
|
61
|
+
const serialized = await serializeTaskResult(options);
|
|
62
|
+
const { resultRef, stdoutRef, stderrRef } = await (0, tasks_1.writeTaskResult)({
|
|
63
|
+
runDir: options.runDir,
|
|
64
|
+
effectId: options.effectId,
|
|
65
|
+
result: serialized,
|
|
66
|
+
stdout: options.payload.stdout,
|
|
67
|
+
stderr: options.payload.stderr,
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
resultRef,
|
|
71
|
+
stdoutRef,
|
|
72
|
+
stderrRef,
|
|
73
|
+
serialized,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function serializeTaskResult(options) {
|
|
77
|
+
const serialized = {
|
|
78
|
+
schemaVersion: exports.RESULT_SCHEMA_VERSION,
|
|
79
|
+
effectId: options.effectId,
|
|
80
|
+
taskId: options.taskId,
|
|
81
|
+
invocationKey: options.invocationKey,
|
|
82
|
+
status: options.payload.status,
|
|
83
|
+
result: undefined,
|
|
84
|
+
resultRef: undefined,
|
|
85
|
+
error: normalizeError(options.payload.error),
|
|
86
|
+
stdoutRef: options.payload.stdoutRef,
|
|
87
|
+
stderrRef: options.payload.stderrRef,
|
|
88
|
+
startedAt: options.payload.startedAt,
|
|
89
|
+
finishedAt: options.payload.finishedAt,
|
|
90
|
+
metadata: options.payload.metadata ? stableClone(options.payload.metadata) : undefined,
|
|
91
|
+
};
|
|
92
|
+
if (options.payload.status === "ok") {
|
|
93
|
+
const spill = await maybeSpillLargeValue({
|
|
94
|
+
runDir: options.runDir,
|
|
95
|
+
effectId: options.effectId,
|
|
96
|
+
name: "result",
|
|
97
|
+
value: options.payload.result,
|
|
98
|
+
});
|
|
99
|
+
serialized.result = spill.value;
|
|
100
|
+
serialized.value = spill.value;
|
|
101
|
+
serialized.resultRef = spill.ref;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
serialized.error = normalizeError(options.payload.error);
|
|
105
|
+
}
|
|
106
|
+
return serialized;
|
|
107
|
+
}
|
|
108
|
+
function normalizeTaskDef(task) {
|
|
109
|
+
if (!task || typeof task !== "object") {
|
|
110
|
+
throw new Error("Task serializer requires a TaskDef object");
|
|
111
|
+
}
|
|
112
|
+
if (!task.kind || typeof task.kind !== "string") {
|
|
113
|
+
throw new Error("TaskDef.kind must be a non-empty string");
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
kind: task.kind,
|
|
117
|
+
title: typeof task.title === "string" ? task.title : undefined,
|
|
118
|
+
description: typeof task.description === "string" ? task.description : undefined,
|
|
119
|
+
labels: normalizeLabels(task.labels),
|
|
120
|
+
io: normalizeJson(task.io),
|
|
121
|
+
node: normalizeJson(task.node),
|
|
122
|
+
breakpoint: normalizeJson(task.breakpoint),
|
|
123
|
+
orchestratorTask: normalizeJson(task.orchestratorTask),
|
|
124
|
+
sleep: normalizeJson(task.sleep),
|
|
125
|
+
metadata: normalizeJson(task.metadata),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function normalizeLabels(labels) {
|
|
129
|
+
if (!Array.isArray(labels) || labels.length === 0)
|
|
130
|
+
return undefined;
|
|
131
|
+
const trimmed = labels
|
|
132
|
+
.filter((value) => typeof value === "string")
|
|
133
|
+
.map((label) => label.trim())
|
|
134
|
+
.filter(Boolean);
|
|
135
|
+
if (!trimmed.length)
|
|
136
|
+
return undefined;
|
|
137
|
+
const unique = Array.from(new Set(trimmed));
|
|
138
|
+
unique.sort((a, b) => a.localeCompare(b));
|
|
139
|
+
return unique;
|
|
140
|
+
}
|
|
141
|
+
function normalizeJson(value) {
|
|
142
|
+
if (!value || typeof value !== "object") {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
if (Array.isArray(value)) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
return stableClone(value);
|
|
149
|
+
}
|
|
150
|
+
async function maybeSpillLargeValue(options) {
|
|
151
|
+
if (options.value === undefined) {
|
|
152
|
+
return {};
|
|
153
|
+
}
|
|
154
|
+
const clone = stableClone(options.value);
|
|
155
|
+
const json = JSON.stringify(clone, null, 2) + "\n";
|
|
156
|
+
if (Buffer.byteLength(json, "utf8") <= BLOB_THRESHOLD_BYTES) {
|
|
157
|
+
return { value: clone };
|
|
158
|
+
}
|
|
159
|
+
const blobDir = path_1.default.join((0, paths_1.getTasksDir)(options.runDir), options.effectId, "blobs");
|
|
160
|
+
await fs_1.promises.mkdir(blobDir, { recursive: true });
|
|
161
|
+
const hash = crypto_1.default.createHash("sha256").update(json).digest("hex");
|
|
162
|
+
const blobPath = path_1.default.join(blobDir, `${options.name}-${hash}.json`);
|
|
163
|
+
await fs_1.promises.mkdir(path_1.default.dirname(blobPath), { recursive: true });
|
|
164
|
+
await (0, atomic_1.writeFileAtomic)(blobPath, json);
|
|
165
|
+
return {
|
|
166
|
+
ref: toRunRelative(options.runDir, blobPath),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function toRunRelative(runDir, absolutePath) {
|
|
170
|
+
const relative = path_1.default.relative(runDir, absolutePath);
|
|
171
|
+
return relative.split(path_1.default.sep).join("/");
|
|
172
|
+
}
|
|
173
|
+
function stableClone(value) {
|
|
174
|
+
if (Array.isArray(value)) {
|
|
175
|
+
return value.map((entry) => stableClone(entry));
|
|
176
|
+
}
|
|
177
|
+
if (value && typeof value === "object") {
|
|
178
|
+
const entries = Object.keys(value).sort((a, b) => a.localeCompare(b));
|
|
179
|
+
const clone = {};
|
|
180
|
+
for (const key of entries) {
|
|
181
|
+
const child = value[key];
|
|
182
|
+
clone[key] = stableClone(child);
|
|
183
|
+
}
|
|
184
|
+
return clone;
|
|
185
|
+
}
|
|
186
|
+
return value;
|
|
187
|
+
}
|
|
188
|
+
function normalizeError(error) {
|
|
189
|
+
if (!error || typeof error !== "object") {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
return stableClone(error);
|
|
193
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { JsonRecord } from "../storage/types";
|
|
2
|
+
export type TaskKind = "node" | "breakpoint" | "orchestrator_task" | "sleep" | string;
|
|
3
|
+
export interface TaskIOHints {
|
|
4
|
+
inputJsonPath?: string;
|
|
5
|
+
outputJsonPath?: string;
|
|
6
|
+
stdoutPath?: string;
|
|
7
|
+
stderrPath?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface NodeTaskOptions {
|
|
10
|
+
entry: string;
|
|
11
|
+
args?: string[];
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
cwd?: string;
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface BreakpointTaskOptions {
|
|
17
|
+
payload?: unknown;
|
|
18
|
+
confirmationRequired?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface OrchestratorTaskOptions {
|
|
21
|
+
payload?: JsonRecord;
|
|
22
|
+
resumeCommand?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SleepTaskOptions {
|
|
25
|
+
iso: string;
|
|
26
|
+
targetEpochMs: number;
|
|
27
|
+
}
|
|
28
|
+
export interface TaskDef {
|
|
29
|
+
kind: TaskKind;
|
|
30
|
+
title?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
labels?: string[];
|
|
33
|
+
io?: TaskIOHints;
|
|
34
|
+
metadata?: JsonRecord;
|
|
35
|
+
node?: NodeTaskOptions;
|
|
36
|
+
breakpoint?: BreakpointTaskOptions;
|
|
37
|
+
orchestratorTask?: OrchestratorTaskOptions;
|
|
38
|
+
sleep?: SleepTaskOptions;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
export interface BlobWriteOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Optional content-type metadata (reserved for future integrations).
|
|
44
|
+
*/
|
|
45
|
+
contentType?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Text encoding to use when serializing string payloads (default: utf8).
|
|
48
|
+
*/
|
|
49
|
+
encoding?: BufferEncoding;
|
|
50
|
+
/**
|
|
51
|
+
* Force JSON serialization (default: true for objects, false for strings/Buffers).
|
|
52
|
+
*/
|
|
53
|
+
asJson?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface TaskBuildContext {
|
|
56
|
+
effectId: string;
|
|
57
|
+
invocationKey: string;
|
|
58
|
+
/**
|
|
59
|
+
* Stable id returned from defineTask (used for serialization + hashing).
|
|
60
|
+
*/
|
|
61
|
+
taskId: string;
|
|
62
|
+
/**
|
|
63
|
+
* Active run identifier (matches run.json:id).
|
|
64
|
+
*/
|
|
65
|
+
runId: string;
|
|
66
|
+
/**
|
|
67
|
+
* Absolute path to the run directory containing journal/tasks/etc.
|
|
68
|
+
*/
|
|
69
|
+
runDir: string;
|
|
70
|
+
/**
|
|
71
|
+
* Absolute path to the effect-specific task directory (runs/<id>/tasks/<effectId>).
|
|
72
|
+
*/
|
|
73
|
+
taskDir: string;
|
|
74
|
+
/**
|
|
75
|
+
* Absolute path to the run-level tasks directory (runs/<id>/tasks).
|
|
76
|
+
* @deprecated Use taskDir instead.
|
|
77
|
+
*/
|
|
78
|
+
tasksDir: string;
|
|
79
|
+
/**
|
|
80
|
+
* Optional label provided at invocation time.
|
|
81
|
+
*/
|
|
82
|
+
label?: string;
|
|
83
|
+
labels: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Writes the provided payload under tasks/<effectId>/blobs and returns a run-relative POSIX path.
|
|
86
|
+
*/
|
|
87
|
+
createBlobRef(name: string, value: unknown, options?: BlobWriteOptions): Promise<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Resolves a task-scoped relative path to a run-relative POSIX string.
|
|
90
|
+
*/
|
|
91
|
+
toTaskRelativePath(relativePath: string): string;
|
|
92
|
+
}
|
|
93
|
+
export type TaskValueFactory<TArgs, TValue> = (args: TArgs, ctx: TaskBuildContext) => TValue | Promise<TValue>;
|
|
94
|
+
export type TaskValueOrFactory<TArgs, TValue> = TValue | TaskValueFactory<TArgs, TValue>;
|
|
95
|
+
export type TaskImpl<TArgs = unknown, TResult = unknown> = (args: TArgs, ctx: TaskBuildContext) => TaskDef | Promise<TaskDef>;
|
|
96
|
+
export interface DefinedTask<TArgs = unknown, TResult = unknown> {
|
|
97
|
+
id: string;
|
|
98
|
+
build(args: TArgs, ctx: TaskBuildContext): TaskDef | Promise<TaskDef>;
|
|
99
|
+
}
|
|
100
|
+
export interface TaskInvokeOptions {
|
|
101
|
+
label?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface TaskSerializerContext {
|
|
104
|
+
runDir: string;
|
|
105
|
+
effectId: string;
|
|
106
|
+
taskId: string;
|
|
107
|
+
invocationKey: string;
|
|
108
|
+
stepId?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface NodeTaskDefinitionOptions<TArgs = unknown> {
|
|
111
|
+
entry: TaskValueOrFactory<TArgs, string>;
|
|
112
|
+
title?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
113
|
+
description?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
114
|
+
labels?: TaskValueOrFactory<TArgs, string[] | undefined>;
|
|
115
|
+
metadata?: TaskValueOrFactory<TArgs, JsonRecord | undefined>;
|
|
116
|
+
io?: TaskValueOrFactory<TArgs, TaskIOHints | undefined>;
|
|
117
|
+
env?: TaskValueOrFactory<TArgs, Record<string, string | undefined> | undefined>;
|
|
118
|
+
cwd?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
119
|
+
args?: TaskValueOrFactory<TArgs, string[] | undefined>;
|
|
120
|
+
timeoutMs?: TaskValueOrFactory<TArgs, number | undefined>;
|
|
121
|
+
}
|
|
122
|
+
export interface BreakpointTaskDefinitionOptions<TArgs = unknown> {
|
|
123
|
+
title?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
124
|
+
description?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
125
|
+
labels?: TaskValueOrFactory<TArgs, string[] | undefined>;
|
|
126
|
+
metadata?: TaskValueOrFactory<TArgs, JsonRecord | undefined>;
|
|
127
|
+
payload?: TaskValueOrFactory<TArgs, unknown>;
|
|
128
|
+
confirmationRequired?: TaskValueOrFactory<TArgs, boolean | undefined>;
|
|
129
|
+
}
|
|
130
|
+
export interface OrchestratorTaskDefinitionOptions<TArgs = JsonRecord> {
|
|
131
|
+
title?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
132
|
+
description?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
133
|
+
labels?: TaskValueOrFactory<TArgs, string[] | undefined>;
|
|
134
|
+
metadata?: TaskValueOrFactory<TArgs, JsonRecord | undefined>;
|
|
135
|
+
payload?: TaskValueOrFactory<TArgs, JsonRecord | undefined>;
|
|
136
|
+
resumeCommand?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
137
|
+
}
|
|
138
|
+
export interface SleepTaskBuilderArgs {
|
|
139
|
+
iso: string;
|
|
140
|
+
targetEpochMs: number;
|
|
141
|
+
}
|
|
142
|
+
export interface SleepTaskDefinitionOptions<TArgs extends SleepTaskBuilderArgs = SleepTaskBuilderArgs> {
|
|
143
|
+
title?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
144
|
+
description?: TaskValueOrFactory<TArgs, string | undefined>;
|
|
145
|
+
labels?: TaskValueOrFactory<TArgs, string[] | undefined>;
|
|
146
|
+
metadata?: TaskValueOrFactory<TArgs, JsonRecord | undefined>;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tasks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,YAAY,GAAG,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtF,MAAM,WAAW,WAAW;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC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heKey: string;
|
|
6
|
+
};
|
|
7
|
+
helperLabels: string[];
|
|
8
|
+
metadata: {
|
|
9
|
+
subsystem: string;
|
|
10
|
+
};
|
|
11
|
+
env: {
|
|
12
|
+
sample: {
|
|
13
|
+
NODE_AUTH_TOKEN: string;
|
|
14
|
+
CI_SECRET: string;
|
|
15
|
+
GITHUB_TOKEN: string;
|
|
16
|
+
DB_PASSWORD: string;
|
|
17
|
+
PUBLIC_URL: string;
|
|
18
|
+
LOG_LEVEL: string;
|
|
19
|
+
};
|
|
20
|
+
expectedSafe: {
|
|
21
|
+
PUBLIC_URL: string;
|
|
22
|
+
LOG_LEVEL: string;
|
|
23
|
+
};
|
|
24
|
+
expectedRedacted: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const breakpointKindFixtures: {
|
|
28
|
+
id: string;
|
|
29
|
+
payload: {
|
|
30
|
+
reason: string;
|
|
31
|
+
branch: string;
|
|
32
|
+
};
|
|
33
|
+
metadata: {
|
|
34
|
+
severity: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const orchestratorKindFixtures: {
|
|
38
|
+
id: string;
|
|
39
|
+
payload: {
|
|
40
|
+
op: string;
|
|
41
|
+
stage: string;
|
|
42
|
+
};
|
|
43
|
+
metadata: {
|
|
44
|
+
iteration: number;
|
|
45
|
+
};
|
|
46
|
+
resumeCommand: string;
|
|
47
|
+
};
|
|
48
|
+
export declare const sleepKindFixtures: {
|
|
49
|
+
id: string;
|
|
50
|
+
args: {
|
|
51
|
+
iso: string;
|
|
52
|
+
targetEpochMs: number;
|
|
53
|
+
};
|
|
54
|
+
helperLabels: string[];
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-fixtures/kinds/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;CAoB5B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;CAIlC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;CAKpC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAO7B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sleepKindFixtures = exports.orchestratorKindFixtures = exports.breakpointKindFixtures = exports.nodeKindFixtures = void 0;
|
|
4
|
+
const sleepIso = "2026-02-15T12:00:00.000Z";
|
|
5
|
+
exports.nodeKindFixtures = {
|
|
6
|
+
id: "fixtures.node.example",
|
|
7
|
+
args: { target: "web-app", cacheKey: "demo" },
|
|
8
|
+
helperLabels: ["node-helper"],
|
|
9
|
+
metadata: { subsystem: "build" },
|
|
10
|
+
env: {
|
|
11
|
+
sample: {
|
|
12
|
+
NODE_AUTH_TOKEN: "token-123",
|
|
13
|
+
CI_SECRET: "ci-secret",
|
|
14
|
+
GITHUB_TOKEN: "ghp_example",
|
|
15
|
+
DB_PASSWORD: "hunter2",
|
|
16
|
+
PUBLIC_URL: "https://example.test",
|
|
17
|
+
LOG_LEVEL: "info",
|
|
18
|
+
},
|
|
19
|
+
expectedSafe: {
|
|
20
|
+
PUBLIC_URL: "https://example.test",
|
|
21
|
+
LOG_LEVEL: "info",
|
|
22
|
+
},
|
|
23
|
+
expectedRedacted: ["CI_SECRET", "DB_PASSWORD", "GITHUB_TOKEN", "NODE_AUTH_TOKEN"],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
exports.breakpointKindFixtures = {
|
|
27
|
+
id: "fixtures.breakpoint.example",
|
|
28
|
+
payload: { reason: "inspect diff", branch: "feature/123" },
|
|
29
|
+
metadata: { severity: "high" },
|
|
30
|
+
};
|
|
31
|
+
exports.orchestratorKindFixtures = {
|
|
32
|
+
id: "fixtures.orchestrator.example",
|
|
33
|
+
payload: { op: "plan", stage: "compile" },
|
|
34
|
+
metadata: { iteration: 3 },
|
|
35
|
+
resumeCommand: "pnpm babysitter run:continue",
|
|
36
|
+
};
|
|
37
|
+
exports.sleepKindFixtures = {
|
|
38
|
+
id: "fixtures.sleep.example",
|
|
39
|
+
args: {
|
|
40
|
+
iso: sleepIso,
|
|
41
|
+
targetEpochMs: Date.parse(sleepIso),
|
|
42
|
+
},
|
|
43
|
+
helperLabels: ["sleep-helper"],
|
|
44
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { JsonRecord } from "../storage/types";
|
|
2
|
+
import { type StateCacheSnapshot } from "../runtime/replay/stateCache";
|
|
3
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
4
|
+
type ClockValue = string | number | Date;
|
|
5
|
+
export type ClockSequenceInput = ClockValue | readonly ClockValue[];
|
|
6
|
+
export interface SnapshotJournalEntry {
|
|
7
|
+
seq: number;
|
|
8
|
+
ulid: string;
|
|
9
|
+
recordedAt: string;
|
|
10
|
+
type: string;
|
|
11
|
+
data: JsonRecord;
|
|
12
|
+
}
|
|
13
|
+
export interface SnapshotStateSummary {
|
|
14
|
+
savedAt: string;
|
|
15
|
+
stateVersion: number;
|
|
16
|
+
journalHead: StateCacheSnapshot["journalHead"];
|
|
17
|
+
pendingEffectsByKind: StateCacheSnapshot["pendingEffectsByKind"];
|
|
18
|
+
effectsByInvocation: StateCacheSnapshot["effectsByInvocation"];
|
|
19
|
+
rebuildReason: StateCacheSnapshot["rebuildReason"];
|
|
20
|
+
}
|
|
21
|
+
export interface DeterministicRunSnapshot {
|
|
22
|
+
journal: SnapshotJournalEntry[];
|
|
23
|
+
state: SnapshotStateSummary | null;
|
|
24
|
+
}
|
|
25
|
+
export interface TempDeterministicRun {
|
|
26
|
+
runDir: string;
|
|
27
|
+
cleanup(): Promise<void>;
|
|
28
|
+
restore(): void;
|
|
29
|
+
}
|
|
30
|
+
export interface TempDeterministicRunOptions {
|
|
31
|
+
processSource: string;
|
|
32
|
+
inputs?: unknown;
|
|
33
|
+
runId?: string;
|
|
34
|
+
request?: string;
|
|
35
|
+
clock?: ClockSequenceInput;
|
|
36
|
+
ulids?: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
export interface FixedClockOptions {
|
|
39
|
+
start?: ClockValue;
|
|
40
|
+
stepMs?: number;
|
|
41
|
+
sequence?: ClockSequenceInput;
|
|
42
|
+
}
|
|
43
|
+
export interface FixedClockHandle {
|
|
44
|
+
now(): Date;
|
|
45
|
+
advance(ms?: number): Date;
|
|
46
|
+
reset(): void;
|
|
47
|
+
timestamp(): number;
|
|
48
|
+
apply(): () => void;
|
|
49
|
+
restore(): void;
|
|
50
|
+
}
|
|
51
|
+
export interface DeterministicUlidOptions {
|
|
52
|
+
preset?: readonly string[];
|
|
53
|
+
epochMs?: number;
|
|
54
|
+
incrementMs?: number;
|
|
55
|
+
randomnessSeed?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface DeterministicUlidHandle {
|
|
58
|
+
issued: readonly string[];
|
|
59
|
+
next(): string;
|
|
60
|
+
reset(): void;
|
|
61
|
+
apply(): () => void;
|
|
62
|
+
restore(): void;
|
|
63
|
+
}
|
|
64
|
+
export interface DeterministicRunHarnessOptions {
|
|
65
|
+
processPath?: string;
|
|
66
|
+
processSource?: string;
|
|
67
|
+
inputs?: unknown;
|
|
68
|
+
runId?: string;
|
|
69
|
+
request?: string;
|
|
70
|
+
exportName?: string;
|
|
71
|
+
clock?: FixedClockOptions;
|
|
72
|
+
ulids?: DeterministicUlidOptions;
|
|
73
|
+
}
|
|
74
|
+
export interface DeterministicRunHarness {
|
|
75
|
+
runId: string;
|
|
76
|
+
runDir: string;
|
|
77
|
+
runsRoot: string;
|
|
78
|
+
clock: FixedClockHandle;
|
|
79
|
+
ulids: DeterministicUlidHandle;
|
|
80
|
+
cleanup(): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
export declare function withDeterministicIds<T>(sequence: readonly string[], fn: () => MaybePromise<T>): Promise<T>;
|
|
83
|
+
export declare function withFixedClock<T>(sequenceOrValue: ClockSequenceInput, fn: () => MaybePromise<T>): Promise<T>;
|
|
84
|
+
export declare function createTempDeterministicRun(options: TempDeterministicRunOptions): Promise<TempDeterministicRun>;
|
|
85
|
+
export declare function snapshotRunState(runDir: string): Promise<DeterministicRunSnapshot>;
|
|
86
|
+
export declare function installFixedClock(options?: FixedClockOptions): FixedClockHandle;
|
|
87
|
+
export declare function installDeterministicUlids(options?: DeterministicUlidOptions): DeterministicUlidHandle;
|
|
88
|
+
export declare function createDeterministicRunHarness(options: DeterministicRunHarnessOptions): Promise<DeterministicRunHarness>;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=deterministic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deterministic.d.ts","sourceRoot":"","sources":["../../src/testing/deterministic.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAOvF,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AACzC,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,UAAU,EAAE,CAAC;AAIpE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAC/C,oBAAoB,EAAE,kBAAkB,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