@smithers-orchestrator/engine 0.17.0 → 0.19.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/package.json +15 -15
- package/src/effect/builder.js +43 -3
- package/src/effect/workflow-bridge.js +5 -1
- package/src/engine.js +74 -18
- package/src/index.d.ts +62 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithers-orchestrator/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Concrete Smithers workflow execution engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"react": "^19.2.5",
|
|
34
34
|
"react-dom": "^19.2.5",
|
|
35
35
|
"zod": "^4.3.6",
|
|
36
|
-
"@smithers-orchestrator/
|
|
37
|
-
"@smithers-orchestrator/
|
|
38
|
-
"@smithers-orchestrator/
|
|
39
|
-
"@smithers-orchestrator/
|
|
40
|
-
"@smithers-orchestrator/
|
|
41
|
-
"@smithers-orchestrator/graph": "0.
|
|
42
|
-
"@smithers-orchestrator/memory": "0.
|
|
43
|
-
"@smithers-orchestrator/
|
|
44
|
-
"@smithers-orchestrator/
|
|
45
|
-
"@smithers-orchestrator/sandbox": "0.
|
|
46
|
-
"@smithers-orchestrator/scheduler": "0.
|
|
47
|
-
"@smithers-orchestrator/scorers": "0.
|
|
48
|
-
"@smithers-orchestrator/time-travel": "0.
|
|
49
|
-
"@smithers-orchestrator/vcs": "0.
|
|
36
|
+
"@smithers-orchestrator/components": "0.19.0",
|
|
37
|
+
"@smithers-orchestrator/agents": "0.19.0",
|
|
38
|
+
"@smithers-orchestrator/db": "0.19.0",
|
|
39
|
+
"@smithers-orchestrator/errors": "0.19.0",
|
|
40
|
+
"@smithers-orchestrator/driver": "0.19.0",
|
|
41
|
+
"@smithers-orchestrator/graph": "0.19.0",
|
|
42
|
+
"@smithers-orchestrator/memory": "0.19.0",
|
|
43
|
+
"@smithers-orchestrator/observability": "0.19.0",
|
|
44
|
+
"@smithers-orchestrator/react-reconciler": "0.19.0",
|
|
45
|
+
"@smithers-orchestrator/sandbox": "0.19.0",
|
|
46
|
+
"@smithers-orchestrator/scheduler": "0.19.0",
|
|
47
|
+
"@smithers-orchestrator/scorers": "0.19.0",
|
|
48
|
+
"@smithers-orchestrator/time-travel": "0.19.0",
|
|
49
|
+
"@smithers-orchestrator/vcs": "0.19.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/bun": "latest",
|
package/src/effect/builder.js
CHANGED
|
@@ -14,6 +14,9 @@ import { SmithersError } from "@smithers-orchestrator/errors/SmithersError";
|
|
|
14
14
|
/**
|
|
15
15
|
* @typedef {import("effect").Schema.Schema<unknown, unknown, never>} AnySchema
|
|
16
16
|
*/
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {unknown | Promise<unknown> | import("effect").Effect.Effect<unknown, unknown, unknown>} AnyEffect
|
|
19
|
+
*/
|
|
17
20
|
/**
|
|
18
21
|
* @typedef {{ needs?: Record<string, BuilderStepHandle>; request: (ctx: Record<string, unknown>) => { title: string; summary?: string | null; }; onDeny?: "fail" | "continue" | "skip"; }} ApprovalOptions
|
|
19
22
|
*/
|
|
@@ -24,6 +27,41 @@ import { SmithersError } from "@smithers-orchestrator/errors/SmithersError";
|
|
|
24
27
|
/** @typedef {import("./BuilderStepHandle.ts").BuilderStepHandle} BuilderStepHandle */
|
|
25
28
|
/** @typedef {import("@smithers-orchestrator/scheduler/RetryPolicy").RetryPolicy} RetryPolicy */
|
|
26
29
|
/** @typedef {import("./SmithersSqliteOptions.ts").SmithersSqliteOptions} SmithersSqliteOptions */
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {{
|
|
32
|
+
* output: AnySchema;
|
|
33
|
+
* needs?: Record<string, BuilderStepHandle>;
|
|
34
|
+
* run?: (ctx: BuilderStepContext) => AnyEffect;
|
|
35
|
+
* retry?: unknown;
|
|
36
|
+
* retryPolicy?: RetryPolicy;
|
|
37
|
+
* timeout?: unknown;
|
|
38
|
+
* skipIf?: (ctx: BuilderStepContext) => boolean;
|
|
39
|
+
* cache?: import("@smithers-orchestrator/scheduler/CachePolicy").CachePolicy;
|
|
40
|
+
* }} StepOptions
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {{
|
|
44
|
+
* step: (id: string, options: StepOptions) => BuilderStepHandle;
|
|
45
|
+
* approval: (id: string, options: ApprovalOptions) => BuilderStepHandle;
|
|
46
|
+
* sequence: (...nodes: BuilderNode[]) => BuilderNode;
|
|
47
|
+
* parallel: (...nodesOrOptions: [...BuilderNode[], { maxConcurrency?: number }] | BuilderNode[]) => BuilderNode;
|
|
48
|
+
* loop: (options: { id?: string; children: BuilderNode; until: (outputs: Record<string, unknown>) => boolean; maxIterations?: number; onMaxReached?: "fail" | "return-last"; }) => BuilderNode;
|
|
49
|
+
* match: (source: BuilderStepHandle, options: { when: (value: unknown) => boolean; then: () => BuilderNode; else?: () => BuilderNode; }) => BuilderNode;
|
|
50
|
+
* component: (instanceId: string, definition: ComponentDefinition, params?: Record<string, unknown>) => BuilderNode;
|
|
51
|
+
* }} BuilderApi
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {{ execute: (input: unknown, opts?: Omit<Parameters<typeof runWorkflow>[1], "input">) => import("effect").Effect.Effect<unknown, unknown, unknown> }} BuiltSmithersWorkflow
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {{ build: (buildGraph: ($: BuilderApi) => BuilderNode) => BuiltSmithersWorkflow }} WorkflowDefinitionBuilder
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* @typedef {{ kind: "component-definition"; name: string; buildWithPrefix: (prefix: string, params?: Record<string, unknown>) => BuilderNode }} ComponentDefinition
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {{ build: (buildGraph: ($: BuilderApi, params?: Record<string, unknown>) => BuilderNode) => ComponentDefinition }} ComponentDefinitionBuilder
|
|
64
|
+
*/
|
|
27
65
|
|
|
28
66
|
const SmithersSqlite = Context.GenericTag("smithers/effect/sqlite");
|
|
29
67
|
class ApprovalDecision extends Schema.Class("ApprovalDecision")({
|
|
@@ -754,7 +792,7 @@ function normalizeExecutionError(result) {
|
|
|
754
792
|
/**
|
|
755
793
|
* @param {{ name: string; input: AnySchema }} options
|
|
756
794
|
*/
|
|
757
|
-
function
|
|
795
|
+
export function createWorkflow(options) {
|
|
758
796
|
return {
|
|
759
797
|
/**
|
|
760
798
|
* @param {($: BuilderApi) => BuilderNode} buildGraph
|
|
@@ -804,7 +842,7 @@ function _createWorkflow(options) {
|
|
|
804
842
|
/**
|
|
805
843
|
* @param {{ name: string; params?: Record<string, unknown> }} options
|
|
806
844
|
*/
|
|
807
|
-
function
|
|
845
|
+
export function createComponent(options) {
|
|
808
846
|
return {
|
|
809
847
|
/**
|
|
810
848
|
* @param {($: BuilderApi, params: Record<string, unknown>) => BuilderNode} buildGraph
|
|
@@ -831,7 +869,9 @@ function _createComponent(options) {
|
|
|
831
869
|
function sqlite(options) {
|
|
832
870
|
return Layer.succeed(SmithersSqlite, options);
|
|
833
871
|
}
|
|
834
|
-
/** @type {{ sqlite: typeof sqlite }} */
|
|
872
|
+
/** @type {{ sqlite: typeof sqlite; createWorkflow: typeof createWorkflow; createComponent: typeof createComponent }} */
|
|
835
873
|
export const Smithers = {
|
|
836
874
|
sqlite,
|
|
875
|
+
createWorkflow,
|
|
876
|
+
createComponent,
|
|
837
877
|
};
|
|
@@ -72,8 +72,12 @@ function isRetryableBridgeTaskFailure(attempt) {
|
|
|
72
72
|
if (meta?.failureRetryable === false) {
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
|
+
const errorCode = parseAttemptErrorCode(attempt?.errorJson);
|
|
76
|
+
if (errorCode === "AGENT_CONFIG_INVALID") {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
75
79
|
const kind = typeof meta?.kind === "string" ? meta.kind : null;
|
|
76
|
-
return !(kind !== "agent" &&
|
|
80
|
+
return !(kind !== "agent" && errorCode === "INVALID_OUTPUT");
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
79
83
|
* @param {SmithersDb} adapter
|
package/src/engine.js
CHANGED
|
@@ -25,7 +25,7 @@ import { findVcsRoot } from "@smithers-orchestrator/vcs/find-root";
|
|
|
25
25
|
import * as BunContext from "@effect/platform-bun/BunContext";
|
|
26
26
|
import { eq, getTableName } from "drizzle-orm";
|
|
27
27
|
import { getTableColumns } from "drizzle-orm/utils";
|
|
28
|
-
import { Chunk, Duration, Effect, Fiber, Metric, Queue, Schedule } from "effect";
|
|
28
|
+
import { Cause, Chunk, Duration, Effect, Exit, Fiber, Metric, Queue, Schedule } from "effect";
|
|
29
29
|
import { attemptDuration, cacheHits, cacheMisses, nodeDuration, promptSizeBytes, responseSizeBytes, runDuration, runsResumedTotal, schedulerConcurrencyUtilization, schedulerQueueDepth, schedulerWaitDuration, trackEvent, } from "@smithers-orchestrator/observability/metrics";
|
|
30
30
|
import { runScorersAsync } from "@smithers-orchestrator/scorers/run-scorers";
|
|
31
31
|
import { dirname, resolve } from "node:path";
|
|
@@ -287,6 +287,25 @@ function isHeartbeatPayloadValidationError(err) {
|
|
|
287
287
|
return (code === "HEARTBEAT_PAYLOAD_NOT_JSON_SERIALIZABLE" ||
|
|
288
288
|
code === "HEARTBEAT_PAYLOAD_TOO_LARGE");
|
|
289
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Effect.runPromise rejects with a FiberFailure wrapper. For task execution we
|
|
292
|
+
* need the original failure so retry metadata can read SmithersError fields.
|
|
293
|
+
*
|
|
294
|
+
* @template A
|
|
295
|
+
* @param {Effect.Effect<A, unknown>} effect
|
|
296
|
+
* @returns {Promise<A>}
|
|
297
|
+
*/
|
|
298
|
+
async function runPromisePreservingFailure(effect) {
|
|
299
|
+
const exit = await Effect.runPromiseExit(effect);
|
|
300
|
+
if (Exit.isSuccess(exit)) {
|
|
301
|
+
return exit.value;
|
|
302
|
+
}
|
|
303
|
+
const failure = Cause.failureOption(exit.cause);
|
|
304
|
+
if (failure._tag === "Some") {
|
|
305
|
+
throw failure.value;
|
|
306
|
+
}
|
|
307
|
+
throw Cause.squash(exit.cause);
|
|
308
|
+
}
|
|
290
309
|
/**
|
|
291
310
|
* @param {Record<string, unknown>} meta
|
|
292
311
|
* @param {string} engine
|
|
@@ -1784,6 +1803,7 @@ function resolveTaskOutputs(tasks, workflow) {
|
|
|
1784
1803
|
if (isTimerTask(task)) {
|
|
1785
1804
|
continue;
|
|
1786
1805
|
}
|
|
1806
|
+
const hasAmbiguousOutputRef = Boolean(task.outputRef && workflow.ambiguousZodSchemas?.has(task.outputRef));
|
|
1787
1807
|
// Already resolved (has a table)
|
|
1788
1808
|
if (task.outputTable) {
|
|
1789
1809
|
if (!task.outputSchema && task.outputTableName && workflow.schemaRegistry) {
|
|
@@ -1807,10 +1827,14 @@ function resolveTaskOutputs(tasks, workflow) {
|
|
|
1807
1827
|
}
|
|
1808
1828
|
}
|
|
1809
1829
|
if (!task.outputTable) {
|
|
1830
|
+
if (hasAmbiguousOutputRef) {
|
|
1831
|
+
throw new SmithersError("UNKNOWN_OUTPUT_SCHEMA", `Task "${task.nodeId}" uses an output schema that is registered under multiple keys. Use createSmithers(...).outputs.<key> or a string output key instead of the shared raw Zod object.`);
|
|
1832
|
+
}
|
|
1810
1833
|
throw new SmithersError("UNKNOWN_OUTPUT_SCHEMA", `Task "${task.nodeId}" uses an output ZodObject that is not registered in createSmithers()`);
|
|
1811
1834
|
}
|
|
1812
1835
|
}
|
|
1813
1836
|
const raw = task.outputSchema;
|
|
1837
|
+
const hasAmbiguousOutputSchema = Boolean(raw && typeof raw === "object" && workflow.ambiguousZodSchemas?.has(raw));
|
|
1814
1838
|
// Resolve ZodObject via outputSchema when no outputRef resolved.
|
|
1815
1839
|
if (!task.outputTable && raw && typeof raw === "object" && workflow.zodToKeyName) {
|
|
1816
1840
|
const keyName = workflow.zodToKeyName.get(raw);
|
|
@@ -1824,6 +1848,9 @@ function resolveTaskOutputs(tasks, workflow) {
|
|
|
1824
1848
|
}
|
|
1825
1849
|
}
|
|
1826
1850
|
if (!task.outputTable) {
|
|
1851
|
+
if (hasAmbiguousOutputSchema) {
|
|
1852
|
+
throw new SmithersError("UNKNOWN_OUTPUT_SCHEMA", `Task "${task.nodeId}" uses an output schema that is registered under multiple keys. Use createSmithers(...).outputs.<key> or a string output key instead of the shared raw Zod object.`);
|
|
1853
|
+
}
|
|
1827
1854
|
throw new SmithersError("UNKNOWN_OUTPUT_SCHEMA", `Task "${task.nodeId}" uses an output ZodObject that is not registered in createSmithers()`);
|
|
1828
1855
|
}
|
|
1829
1856
|
}
|
|
@@ -2554,6 +2581,7 @@ async function legacyExecuteTask(adapter, db, runId, desc, descriptorMap, inputT
|
|
|
2554
2581
|
let cacheJjBase = null;
|
|
2555
2582
|
let responseText = null;
|
|
2556
2583
|
let effectiveAgent = null;
|
|
2584
|
+
let supportsNativeStructuredOutput = false;
|
|
2557
2585
|
// Resolve effective root once so both caching and execution share it.
|
|
2558
2586
|
const taskRoot = desc.worktreePath ?? toolConfig.rootDir;
|
|
2559
2587
|
const stepCacheEnabled = cacheEnabled || Boolean(desc.cachePolicy);
|
|
@@ -2874,7 +2902,8 @@ async function legacyExecuteTask(adapter, db, runId, desc, descriptorMap, inputT
|
|
|
2874
2902
|
maybeCompleteHijack();
|
|
2875
2903
|
};
|
|
2876
2904
|
let effectivePrompt = desc.prompt ?? "";
|
|
2877
|
-
|
|
2905
|
+
supportsNativeStructuredOutput = effectiveAgent.supportsNativeStructuredOutput === true;
|
|
2906
|
+
if (desc.outputTable && !supportsNativeStructuredOutput) {
|
|
2878
2907
|
const schemaDesc = describeSchemaShape(desc.outputTable, desc.outputSchema);
|
|
2879
2908
|
const jsonInstructions = [
|
|
2880
2909
|
"**REQUIRED OUTPUT** — You MUST end your response with a JSON object in a code fence matching this schema:",
|
|
@@ -3026,7 +3055,7 @@ async function legacyExecuteTask(adapter, db, runId, desc, descriptorMap, inputT
|
|
|
3026
3055
|
// Use fallback agent on retry attempts when available
|
|
3027
3056
|
let result;
|
|
3028
3057
|
try {
|
|
3029
|
-
result = await
|
|
3058
|
+
result = await runPromisePreservingFailure(withSmithersSpan(smithersSpanNames.agent, Effect.tryPromise({
|
|
3030
3059
|
try: () => {
|
|
3031
3060
|
const agentCall = guidedResumeMessages?.length
|
|
3032
3061
|
? {
|
|
@@ -3486,17 +3515,25 @@ async function legacyExecuteTask(adapter, db, runId, desc, descriptorMap, inputT
|
|
|
3486
3515
|
const zodIssues = validation.error?.issues
|
|
3487
3516
|
?.map((iss) => ` - ${(iss.path ?? []).join(".")}: ${iss.message}`)
|
|
3488
3517
|
.join("\n") ?? "Unknown validation error";
|
|
3489
|
-
const schemaRetryPrompt =
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3518
|
+
const schemaRetryPrompt = supportsNativeStructuredOutput
|
|
3519
|
+
? [
|
|
3520
|
+
`Your structured output didn't match the required schema. Validation errors:`,
|
|
3521
|
+
zodIssues,
|
|
3522
|
+
``,
|
|
3523
|
+
`Return corrected structured data matching this schema:`,
|
|
3524
|
+
schemaDesc,
|
|
3525
|
+
].join("\n")
|
|
3526
|
+
: [
|
|
3527
|
+
`Your output didn't match the required schema. Validation errors:`,
|
|
3528
|
+
zodIssues,
|
|
3529
|
+
``,
|
|
3530
|
+
`Please return valid JSON matching the schema exactly.`,
|
|
3531
|
+
``,
|
|
3532
|
+
`You MUST output ONLY a valid JSON object with exactly these fields and types:`,
|
|
3533
|
+
schemaDesc,
|
|
3534
|
+
``,
|
|
3535
|
+
`Output ONLY the JSON object, no other text.`,
|
|
3536
|
+
].join("\n");
|
|
3500
3537
|
logInfo("schema validation retry", {
|
|
3501
3538
|
runId,
|
|
3502
3539
|
nodeId: desc.nodeId,
|
|
@@ -3526,6 +3563,9 @@ async function legacyExecuteTask(adapter, db, runId, desc, descriptorMap, inputT
|
|
|
3526
3563
|
recordInternalHeartbeat();
|
|
3527
3564
|
emitOutput(text, "stderr");
|
|
3528
3565
|
},
|
|
3566
|
+
...(supportsNativeStructuredOutput
|
|
3567
|
+
? { outputSchema: desc.outputSchema }
|
|
3568
|
+
: {}),
|
|
3529
3569
|
});
|
|
3530
3570
|
const retryText = (schemaRetryResult.text ?? "").trim();
|
|
3531
3571
|
responseText = retryText || responseText;
|
|
@@ -3547,8 +3587,24 @@ async function legacyExecuteTask(adapter, db, runId, desc, descriptorMap, inputT
|
|
|
3547
3587
|
cloneJsonValue(schemaRetryMessages) ?? schemaRetryMessages;
|
|
3548
3588
|
// Try to parse the retry response
|
|
3549
3589
|
let retryOutput;
|
|
3590
|
+
if (supportsNativeStructuredOutput) {
|
|
3591
|
+
try {
|
|
3592
|
+
if (schemaRetryResult._output !== undefined &&
|
|
3593
|
+
schemaRetryResult._output !== null) {
|
|
3594
|
+
retryOutput = schemaRetryResult._output;
|
|
3595
|
+
}
|
|
3596
|
+
else if (schemaRetryResult.output !== undefined &&
|
|
3597
|
+
schemaRetryResult.output !== null) {
|
|
3598
|
+
retryOutput = schemaRetryResult.output;
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
catch {
|
|
3602
|
+
// Structured output access threw; fall back to text parsing.
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3550
3605
|
try {
|
|
3551
|
-
if (
|
|
3606
|
+
if (retryOutput === undefined &&
|
|
3607
|
+
(retryText.startsWith("{") || retryText.startsWith("["))) {
|
|
3552
3608
|
retryOutput = JSON.parse(retryText);
|
|
3553
3609
|
}
|
|
3554
3610
|
}
|
|
@@ -3743,9 +3799,9 @@ async function legacyExecuteTask(adapter, db, runId, desc, descriptorMap, inputT
|
|
|
3743
3799
|
if (effectiveError &&
|
|
3744
3800
|
typeof effectiveError === "object" &&
|
|
3745
3801
|
// @ts-ignore — duck-type on SmithersError shape
|
|
3746
|
-
effectiveError.details
|
|
3747
|
-
|
|
3748
|
-
|
|
3802
|
+
(effectiveError.details?.failureRetryable === false ||
|
|
3803
|
+
// @ts-ignore
|
|
3804
|
+
effectiveError.code === "AGENT_CONFIG_INVALID")) {
|
|
3749
3805
|
attemptMeta.failureRetryable = false;
|
|
3750
3806
|
}
|
|
3751
3807
|
// Honour `discardResumeSession: true` from agent-side errors (e.g. kimi
|
package/src/index.d.ts
CHANGED
|
@@ -1220,10 +1220,63 @@ type WorktreeNode = {
|
|
|
1220
1220
|
children: BuilderNode$1;
|
|
1221
1221
|
};
|
|
1222
1222
|
type BuilderNode$1 = BuilderStepHandle$1 | SequenceNode | ParallelNode | LoopNode | MatchNode | BranchNode | WorktreeNode;
|
|
1223
|
-
|
|
1224
|
-
|
|
1223
|
+
type StepOptions = {
|
|
1224
|
+
output: AnySchema$1;
|
|
1225
|
+
needs?: Record<string, BuilderStepHandle$1>;
|
|
1226
|
+
run?: (ctx: BuilderStepContext$1) => AnyEffect;
|
|
1227
|
+
retry?: unknown;
|
|
1228
|
+
retryPolicy?: RetryPolicy$1;
|
|
1229
|
+
timeout?: unknown;
|
|
1230
|
+
skipIf?: (ctx: BuilderStepContext$1) => boolean;
|
|
1231
|
+
cache?: CachePolicy;
|
|
1232
|
+
};
|
|
1233
|
+
type ComponentDefinition = {
|
|
1234
|
+
kind: "component-definition";
|
|
1235
|
+
name: string;
|
|
1236
|
+
buildWithPrefix: (prefix: string, params?: Record<string, unknown>) => BuilderNode$1;
|
|
1237
|
+
};
|
|
1238
|
+
type BuilderApi = {
|
|
1239
|
+
step: (id: string, options: StepOptions) => BuilderStepHandle$1;
|
|
1240
|
+
approval: (id: string, options: ApprovalOptions$1) => BuilderStepHandle$1;
|
|
1241
|
+
sequence: (...nodes: BuilderNode$1[]) => BuilderNode$1;
|
|
1242
|
+
parallel: (...nodesOrOptions: Array<BuilderNode$1 | {
|
|
1243
|
+
maxConcurrency?: number;
|
|
1244
|
+
}>) => BuilderNode$1;
|
|
1245
|
+
loop: (options: {
|
|
1246
|
+
id?: string;
|
|
1247
|
+
children: BuilderNode$1;
|
|
1248
|
+
until: (outputs: Record<string, unknown>) => boolean;
|
|
1249
|
+
maxIterations?: number;
|
|
1250
|
+
onMaxReached?: "fail" | "return-last";
|
|
1251
|
+
}) => BuilderNode$1;
|
|
1252
|
+
match: (source: BuilderStepHandle$1, options: {
|
|
1253
|
+
when: (value: unknown) => boolean;
|
|
1254
|
+
then: () => BuilderNode$1;
|
|
1255
|
+
else?: () => BuilderNode$1;
|
|
1256
|
+
}) => BuilderNode$1;
|
|
1257
|
+
component: (instanceId: string, definition: ComponentDefinition, params?: Record<string, unknown>) => BuilderNode$1;
|
|
1258
|
+
};
|
|
1259
|
+
type BuiltSmithersWorkflow = {
|
|
1260
|
+
execute: (input: unknown, opts?: Omit<Parameters<typeof runWorkflow>[1], "input">) => Effect.Effect<unknown, unknown, unknown>;
|
|
1261
|
+
};
|
|
1262
|
+
type WorkflowDefinitionBuilder = {
|
|
1263
|
+
build: (buildGraph: ($: BuilderApi) => BuilderNode$1) => BuiltSmithersWorkflow;
|
|
1264
|
+
};
|
|
1265
|
+
type ComponentDefinitionBuilder = {
|
|
1266
|
+
build: (buildGraph: ($: BuilderApi, params?: Record<string, unknown>) => BuilderNode$1) => ComponentDefinition;
|
|
1267
|
+
};
|
|
1268
|
+
declare function createWorkflow(options: {
|
|
1269
|
+
name: string;
|
|
1270
|
+
input: AnySchema$1;
|
|
1271
|
+
}): WorkflowDefinitionBuilder;
|
|
1272
|
+
declare function createComponent(options: {
|
|
1273
|
+
name: string;
|
|
1274
|
+
params?: Record<string, unknown>;
|
|
1275
|
+
}): ComponentDefinitionBuilder;
|
|
1225
1276
|
declare const Smithers: {
|
|
1226
1277
|
sqlite: typeof sqlite;
|
|
1278
|
+
createWorkflow: typeof createWorkflow;
|
|
1279
|
+
createComponent: typeof createComponent;
|
|
1227
1280
|
};
|
|
1228
1281
|
type AnySchema = effect.Schema.Schema<unknown, unknown, never>;
|
|
1229
1282
|
type ApprovalOptions = {
|
|
@@ -1234,6 +1287,12 @@ type ApprovalOptions = {
|
|
|
1234
1287
|
};
|
|
1235
1288
|
onDeny?: "fail" | "continue" | "skip";
|
|
1236
1289
|
};
|
|
1290
|
+
type BuiltSmithersWorkflow$1 = BuiltSmithersWorkflow;
|
|
1291
|
+
type BuilderApi$1 = BuilderApi;
|
|
1292
|
+
type ComponentDefinition$1 = ComponentDefinition;
|
|
1293
|
+
type ComponentDefinitionBuilder$1 = ComponentDefinitionBuilder;
|
|
1294
|
+
type StepOptions$1 = StepOptions;
|
|
1295
|
+
type WorkflowDefinitionBuilder$1 = WorkflowDefinitionBuilder;
|
|
1237
1296
|
type BuilderNode = BuilderNode$1;
|
|
1238
1297
|
type BuilderStepContext = Record<string, unknown> & {
|
|
1239
1298
|
input: unknown;
|
|
@@ -1594,4 +1653,4 @@ type SmithersWorkflow = any;
|
|
|
1594
1653
|
|
|
1595
1654
|
type ChildWorkflowDefinition = ChildWorkflowDefinition$1;
|
|
1596
1655
|
|
|
1597
|
-
export { type AlertHumanRequestOptions, AlertRuntime, type AlertRuntimeServices, type AnySchema, type ApprovalOptions, type ApprovalPayload, ApprovalPayloadSchema, type ApprovalResult, ApprovalResultSchema, type BridgeManagedTaskKind, type BuilderNode, type BuilderStepContext, type BuilderStepHandle, type CancelPayload, CancelPayloadSchema, type CancelResult, CancelResultSchema, type ChildWorkflowDefinition, type ChildWorkflowExecuteOptions, CodeplaneSandboxExecutorLive, type ComputeTaskBridgeToolConfig, type ContinuationRequest, type CorrelatedSmithersEvent, type CorrelationContext, type DiffBundle, DockerSandboxExecutorLive, EventBus, type ExecuteTaskActivityOptions, type FilePatch, type GetRunPayload, GetRunPayloadSchema, type GetRunResult, GetRunResultSchema, HUMAN_REQUEST_KINDS, HUMAN_REQUEST_STATUSES, type HijackState, type HotReloadEvent, HotWorkflowController, type HumanRequestKind, type HumanRequestSchemaValidation, type HumanRequestStatus, type JsonSchema, type LegacyExecuteTaskFn, type ListRunsPayload, ListRunsPayloadSchema, type OverlayOptions, type PlanNode, type RalphMeta, type RalphState, type RalphStateMap, type ReadonlyTaskStateMap, RetriableTaskFailure, type RetryPolicy, type RetryWaitMap, type RunResult$2 as RunResult, RunStatusSchema, type RunSummary, RunSummarySchema, type SQLiteTable, SandboxHttpRunner, type ScheduleResult, type ScheduleSnapshot, type SignalPayload, SignalPayloadSchema, type SignalResult, SignalResultSchema, type SignalRunOptions, Smithers, type SmithersAlertPolicy, type SmithersEvent, SmithersRpcGroup, type SmithersSqliteOptions, SqlMessageStorage, type StaticTaskBridgeToolConfig, type TaskActivityContext, type TaskActivityRetryOptions, type TaskBridgeToolConfig, type TaskRecord, TaskResult, type TaskState, type TaskStateMap, TaskWorkerEntity, WatchTree, type WatchTreeOptions, WorkerDispatchKind, WorkerTask$1 as WorkerTask, WorkerTaskKind, type WorkflowPatchDecisionRecord, type WorkflowPatchDecisions, type WorkflowVersioningRuntime, type WorkflowVersioningRuntimeOptions, type XmlNode, type _TaskActivityContext, applyDiffBundle, approve, approveNode, awaitApprovalDurableDeferred, awaitWaitForEventDurableDeferred, bridgeApprovalResolve, bridgeSignalResolve, bridgeWaitForEventResolve, buildHumanRequestId, buildOverlay, buildPlanTree, canExecuteBridgeManagedComputeTask, canExecuteBridgeManagedStaticTask, cancel, cancelPendingTimersBridge, cleanupGenerations, computeDiffBundle, computeDiffBundleBetweenRefs, createSchedulerWakeQueue, createWorkflowVersioningRuntime, denyNode, dispatchWorkerTask, ensureSqlMessageStorage, ensureSqlMessageStorageEffect, executeChildWorkflow, executeComputeTaskBridge, executeStaticTaskBridge, executeTaskActivity, executeTaskBridge, executeTaskBridgeEffect, getDefinedToolMetadata, getHumanTaskPrompt, getRun, getSqlMessageStorage, getWorkflowMakeBridgeRuntime, getWorkflowPatchDecisions, getWorkflowVersioningRuntime, isBridgeManagedTimerTask, isBridgeManagedWaitForEventTask, isHumanRequestPastTimeout, isHumanTaskMeta, isPidAlive, isRunHeartbeatFresh, isTaskResultFailure, jsonSchemaToZod, listRuns, makeAbortError, makeApprovalDurableDeferred, makeDurableDeferredBridgeExecutionId, makeTaskActivity, makeTaskBridgeKey, makeWaitForEventDurableDeferred, makeWorkerTask, parseAttemptMetaJson, parseRuntimeOwnerPid, renderFrame, resolveDeferredTaskStateBridge, resolveOverlayEntry, resolveSchema, runWorkflow, runWorkflowWithMakeBridge, scheduleTasks, signal, signalRun, subscribeTaskWorkerDispatches, usePatched, validateHumanRequestValue, wireAbortSignal, withWorkflowMakeBridgeRuntime, withWorkflowVersioningRuntime };
|
|
1656
|
+
export { type AlertHumanRequestOptions, AlertRuntime, type AlertRuntimeServices, type AnySchema, type ApprovalOptions, type ApprovalPayload, ApprovalPayloadSchema, type ApprovalResult, ApprovalResultSchema, type BridgeManagedTaskKind, type BuilderApi$1 as BuilderApi, type BuilderNode, type BuilderStepContext, type BuilderStepHandle, type BuiltSmithersWorkflow$1 as BuiltSmithersWorkflow, type CancelPayload, CancelPayloadSchema, type CancelResult, CancelResultSchema, type ChildWorkflowDefinition, type ChildWorkflowExecuteOptions, CodeplaneSandboxExecutorLive, type ComponentDefinition$1 as ComponentDefinition, type ComponentDefinitionBuilder$1 as ComponentDefinitionBuilder, type ComputeTaskBridgeToolConfig, type ContinuationRequest, type CorrelatedSmithersEvent, type CorrelationContext, type DiffBundle, DockerSandboxExecutorLive, EventBus, type ExecuteTaskActivityOptions, type FilePatch, type GetRunPayload, GetRunPayloadSchema, type GetRunResult, GetRunResultSchema, HUMAN_REQUEST_KINDS, HUMAN_REQUEST_STATUSES, type HijackState, type HotReloadEvent, HotWorkflowController, type HumanRequestKind, type HumanRequestSchemaValidation, type HumanRequestStatus, type JsonSchema, type LegacyExecuteTaskFn, type ListRunsPayload, ListRunsPayloadSchema, type OverlayOptions, type PlanNode, type RalphMeta, type RalphState, type RalphStateMap, type ReadonlyTaskStateMap, RetriableTaskFailure, type RetryPolicy, type RetryWaitMap, type RunResult$2 as RunResult, RunStatusSchema, type RunSummary, RunSummarySchema, type SQLiteTable, SandboxHttpRunner, type ScheduleResult, type ScheduleSnapshot, type SignalPayload, SignalPayloadSchema, type SignalResult, SignalResultSchema, type SignalRunOptions, Smithers, type SmithersAlertPolicy, type SmithersEvent, SmithersRpcGroup, type SmithersSqliteOptions, SqlMessageStorage, type StaticTaskBridgeToolConfig, type StepOptions$1 as StepOptions, type TaskActivityContext, type TaskActivityRetryOptions, type TaskBridgeToolConfig, type TaskRecord, TaskResult, type TaskState, type TaskStateMap, TaskWorkerEntity, WatchTree, type WatchTreeOptions, WorkerDispatchKind, WorkerTask$1 as WorkerTask, WorkerTaskKind, type WorkflowDefinitionBuilder$1 as WorkflowDefinitionBuilder, type WorkflowPatchDecisionRecord, type WorkflowPatchDecisions, type WorkflowVersioningRuntime, type WorkflowVersioningRuntimeOptions, type XmlNode, type _TaskActivityContext, applyDiffBundle, approve, approveNode, awaitApprovalDurableDeferred, awaitWaitForEventDurableDeferred, bridgeApprovalResolve, bridgeSignalResolve, bridgeWaitForEventResolve, buildHumanRequestId, buildOverlay, buildPlanTree, canExecuteBridgeManagedComputeTask, canExecuteBridgeManagedStaticTask, cancel, cancelPendingTimersBridge, cleanupGenerations, computeDiffBundle, computeDiffBundleBetweenRefs, createComponent, createSchedulerWakeQueue, createWorkflow, createWorkflowVersioningRuntime, denyNode, dispatchWorkerTask, ensureSqlMessageStorage, ensureSqlMessageStorageEffect, executeChildWorkflow, executeComputeTaskBridge, executeStaticTaskBridge, executeTaskActivity, executeTaskBridge, executeTaskBridgeEffect, getDefinedToolMetadata, getHumanTaskPrompt, getRun, getSqlMessageStorage, getWorkflowMakeBridgeRuntime, getWorkflowPatchDecisions, getWorkflowVersioningRuntime, isBridgeManagedTimerTask, isBridgeManagedWaitForEventTask, isHumanRequestPastTimeout, isHumanTaskMeta, isPidAlive, isRunHeartbeatFresh, isTaskResultFailure, jsonSchemaToZod, listRuns, makeAbortError, makeApprovalDurableDeferred, makeDurableDeferredBridgeExecutionId, makeTaskActivity, makeTaskBridgeKey, makeWaitForEventDurableDeferred, makeWorkerTask, parseAttemptMetaJson, parseRuntimeOwnerPid, renderFrame, resolveDeferredTaskStateBridge, resolveOverlayEntry, resolveSchema, runWorkflow, runWorkflowWithMakeBridge, scheduleTasks, signal, signalRun, subscribeTaskWorkerDispatches, usePatched, validateHumanRequestValue, wireAbortSignal, withWorkflowMakeBridgeRuntime, withWorkflowVersioningRuntime };
|