@smithers-orchestrator/engine 0.18.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/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/errors": "0.
|
|
40
|
-
"@smithers-orchestrator/
|
|
41
|
-
"@smithers-orchestrator/
|
|
42
|
-
"@smithers-orchestrator/
|
|
43
|
-
"@smithers-orchestrator/
|
|
44
|
-
"@smithers-orchestrator/
|
|
45
|
-
"@smithers-orchestrator/
|
|
46
|
-
"@smithers-orchestrator/
|
|
47
|
-
"@smithers-orchestrator/
|
|
48
|
-
"@smithers-orchestrator/
|
|
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
|
};
|
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 };
|