@smithers-orchestrator/engine 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 +50 -0
- package/src/AlertHumanRequestOptions.ts +8 -0
- package/src/AlertRuntimeServices.ts +10 -0
- package/src/ChildWorkflowDefinition.ts +5 -0
- package/src/ChildWorkflowExecuteOptions.ts +14 -0
- package/src/ContinuationRequest.ts +3 -0
- package/src/HijackState.ts +19 -0
- package/src/HumanRequestKind.ts +1 -0
- package/src/HumanRequestStatus.ts +1 -0
- package/src/PlanNode.ts +29 -0
- package/src/RalphMeta.ts +7 -0
- package/src/RalphState.ts +4 -0
- package/src/RalphStateMap.ts +3 -0
- package/src/ScheduleResult.ts +15 -0
- package/src/SignalRunOptions.ts +5 -0
- package/src/alert-runtime.js +22 -0
- package/src/approvals.js +220 -0
- package/src/child-workflow.js +163 -0
- package/src/effect/ApprovalDeferredResolution.ts +13 -0
- package/src/effect/ApprovalDurableDeferredResolution.ts +11 -0
- package/src/effect/ApprovalPayload.ts +7 -0
- package/src/effect/ApprovalResult.ts +6 -0
- package/src/effect/BuilderNode.ts +52 -0
- package/src/effect/BuilderStepHandle.ts +47 -0
- package/src/effect/CancelPayload.ts +3 -0
- package/src/effect/CancelResult.ts +4 -0
- package/src/effect/DeferredResolution.ts +7 -0
- package/src/effect/DiffBundle.ts +7 -0
- package/src/effect/ExecuteTaskActivityOptions.ts +7 -0
- package/src/effect/FilePatch.ts +6 -0
- package/src/effect/GetRunPayload.ts +3 -0
- package/src/effect/GetRunResult.ts +3 -0
- package/src/effect/LegacyExecuteTaskFn.ts +24 -0
- package/src/effect/ListRunsPayload.ts +6 -0
- package/src/effect/RunStatusSchema.ts +9 -0
- package/src/effect/RunSummary.ts +23 -0
- package/src/effect/SignalPayload.ts +7 -0
- package/src/effect/SignalResult.ts +6 -0
- package/src/effect/SmithersSqliteOptions.ts +3 -0
- package/src/effect/SqlMessageStorageEventHistoryQuery.ts +7 -0
- package/src/effect/TaggedWorkerError.ts +46 -0
- package/src/effect/TaskActivityContext.ts +4 -0
- package/src/effect/TaskActivityRetryOptions.ts +4 -0
- package/src/effect/TaskBridgeToolConfig.ts +6 -0
- package/src/effect/TaskFailure.ts +3 -0
- package/src/effect/TaskResult.ts +5 -0
- package/src/effect/UnknownWorkerError.ts +5 -0
- package/src/effect/WaitForEventDurableDeferredResolution.ts +11 -0
- package/src/effect/WorkerDispatchKind.ts +1 -0
- package/src/effect/WorkerTask.ts +14 -0
- package/src/effect/WorkerTaskError.ts +4 -0
- package/src/effect/WorkerTaskKind.ts +1 -0
- package/src/effect/WorkflowPatchDecisionRecord.ts +4 -0
- package/src/effect/WorkflowPatchDecisions.ts +1 -0
- package/src/effect/WorkflowVersioningRuntime.ts +7 -0
- package/src/effect/activity-bridge.js +131 -0
- package/src/effect/bridge-utils.js +45 -0
- package/src/effect/builder.js +837 -0
- package/src/effect/compute-task-bridge.js +734 -0
- package/src/effect/deferred-bridge.js +63 -0
- package/src/effect/deferred-state-bridge.js +1343 -0
- package/src/effect/diff-bundle.js +352 -0
- package/src/effect/durable-deferred-bridge.js +282 -0
- package/src/effect/entity-worker.js +154 -0
- package/src/effect/http-runner.js +86 -0
- package/src/effect/rpc-schema.js +101 -0
- package/src/effect/single-runner.js +189 -0
- package/src/effect/sql-message-storage.js +817 -0
- package/src/effect/static-task-bridge.js +308 -0
- package/src/effect/versioning.js +123 -0
- package/src/effect/workflow-bridge.js +260 -0
- package/src/effect/workflow-make-bridge.js +233 -0
- package/src/engine.js +6933 -0
- package/src/events.js +237 -0
- package/src/external/json-schema-to-zod.js +214 -0
- package/src/getDefinedToolMetadata.js +10 -0
- package/src/hot/HotReloadEvent.ts +21 -0
- package/src/hot/HotWorkflowController.js +220 -0
- package/src/hot/OverlayOptions.ts +4 -0
- package/src/hot/WatchTreeOptions.ts +6 -0
- package/src/hot/index.js +9 -0
- package/src/hot/overlay.js +177 -0
- package/src/hot/watch.js +174 -0
- package/src/human-requests.js +120 -0
- package/src/index.d.ts +1597 -0
- package/src/index.js +41 -0
- package/src/runtime-owner.js +36 -0
- package/src/scheduler.js +31 -0
- package/src/signals.js +82 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,1597 @@
|
|
|
1
|
+
import * as _smithers_components_SmithersWorkflow from '@smithers-orchestrator/components/SmithersWorkflow';
|
|
2
|
+
import { SmithersWorkflow as SmithersWorkflow$2 } from '@smithers-orchestrator/components/SmithersWorkflow';
|
|
3
|
+
import * as _smithers_scheduler_SmithersWorkflowOptions from '@smithers-orchestrator/scheduler/SmithersWorkflowOptions';
|
|
4
|
+
import * as _smithers_db_adapter from '@smithers-orchestrator/db/adapter';
|
|
5
|
+
import { SmithersDb } from '@smithers-orchestrator/db/adapter';
|
|
6
|
+
import * as effect from 'effect';
|
|
7
|
+
import { Schema, Effect, Layer, ManagedRuntime, Exit, Scope } from 'effect';
|
|
8
|
+
import * as _smithers_errors_SmithersError from '@smithers-orchestrator/errors/SmithersError';
|
|
9
|
+
import { SmithersError } from '@smithers-orchestrator/errors/SmithersError';
|
|
10
|
+
import * as _smithers_driver_RunResult from '@smithers-orchestrator/driver/RunResult';
|
|
11
|
+
import * as _smithers_observability_SmithersEvent from '@smithers-orchestrator/observability/SmithersEvent';
|
|
12
|
+
import * as _smithers_observability_correlation from '@smithers-orchestrator/observability/correlation';
|
|
13
|
+
import { EventEmitter } from 'node:events';
|
|
14
|
+
import * as _smithers_graph_XmlNode from '@smithers-orchestrator/graph/XmlNode';
|
|
15
|
+
import * as _smithers_graph_TaskDescriptor from '@smithers-orchestrator/graph/TaskDescriptor';
|
|
16
|
+
import { TaskDescriptor } from '@smithers-orchestrator/graph/TaskDescriptor';
|
|
17
|
+
import * as _smithers_scheduler from '@smithers-orchestrator/scheduler';
|
|
18
|
+
export { Scheduler, SchedulerLive, buildStateKey, cloneTaskStateMap, isTerminalState, parseStateKey } from '@smithers-orchestrator/scheduler';
|
|
19
|
+
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
20
|
+
import { SQLiteTable as SQLiteTable$1 } from 'drizzle-orm/sqlite-core';
|
|
21
|
+
import * as drizzle_orm_bun_sqlite from 'drizzle-orm/bun-sqlite';
|
|
22
|
+
import { BunSQLiteDatabase as BunSQLiteDatabase$3 } from 'drizzle-orm/bun-sqlite';
|
|
23
|
+
import { TaskAborted } from '@smithers-orchestrator/errors/TaskAborted';
|
|
24
|
+
import * as _smithers_scheduler_RetryPolicy from '@smithers-orchestrator/scheduler/RetryPolicy';
|
|
25
|
+
import { RetryPolicy as RetryPolicy$1 } from '@smithers-orchestrator/scheduler/RetryPolicy';
|
|
26
|
+
import { CachePolicy } from '@smithers-orchestrator/scheduler/CachePolicy';
|
|
27
|
+
import * as _smithers_driver_RunOptions from '@smithers-orchestrator/driver/RunOptions';
|
|
28
|
+
import * as _smithers_graph_GraphSnapshot from '@smithers-orchestrator/graph/GraphSnapshot';
|
|
29
|
+
import { SmithersCtx } from '@smithers-orchestrator/driver/SmithersCtx';
|
|
30
|
+
import * as _smithers_errors_toSmithersError from '@smithers-orchestrator/errors/toSmithersError';
|
|
31
|
+
import { Database } from 'bun:sqlite';
|
|
32
|
+
|
|
33
|
+
type ChildWorkflowDefinition$1 = SmithersWorkflow$2<unknown> | (() => SmithersWorkflow$2<unknown> | unknown);
|
|
34
|
+
|
|
35
|
+
type AlertHumanRequestOptions$1 = {
|
|
36
|
+
runId: string;
|
|
37
|
+
nodeId: string;
|
|
38
|
+
iteration: number;
|
|
39
|
+
kind: "ask" | "confirm" | "select" | "json";
|
|
40
|
+
prompt: string;
|
|
41
|
+
linkedAlertId?: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type AlertRuntimeServices$1 = {
|
|
45
|
+
runId: string;
|
|
46
|
+
adapter: unknown;
|
|
47
|
+
eventBus: unknown;
|
|
48
|
+
requestCancel: () => void;
|
|
49
|
+
createHumanRequest: (options: AlertHumanRequestOptions$1) => Promise<void>;
|
|
50
|
+
pauseScheduler: (reason: string) => void;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** @typedef {import("./AlertHumanRequestOptions.ts").AlertHumanRequestOptions} AlertHumanRequestOptions */
|
|
54
|
+
/** @typedef {import("./AlertRuntimeServices.ts").AlertRuntimeServices} AlertRuntimeServices */
|
|
55
|
+
/** @typedef {import("@smithers-orchestrator/scheduler/SmithersWorkflowOptions").SmithersAlertPolicy} SmithersAlertPolicy */
|
|
56
|
+
declare class AlertRuntime {
|
|
57
|
+
/**
|
|
58
|
+
* @param {SmithersAlertPolicy} policy
|
|
59
|
+
* @param {AlertRuntimeServices} services
|
|
60
|
+
*/
|
|
61
|
+
constructor(policy: SmithersAlertPolicy, services: AlertRuntimeServices);
|
|
62
|
+
/** @type {SmithersAlertPolicy} */
|
|
63
|
+
policy: SmithersAlertPolicy;
|
|
64
|
+
/** @type {AlertRuntimeServices} */
|
|
65
|
+
services: AlertRuntimeServices;
|
|
66
|
+
start(): void;
|
|
67
|
+
stop(): void;
|
|
68
|
+
}
|
|
69
|
+
type AlertHumanRequestOptions = AlertHumanRequestOptions$1;
|
|
70
|
+
type AlertRuntimeServices = AlertRuntimeServices$1;
|
|
71
|
+
type SmithersAlertPolicy = _smithers_scheduler_SmithersWorkflowOptions.SmithersAlertPolicy;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @param {SmithersDb} adapter
|
|
75
|
+
* @param {string} runId
|
|
76
|
+
* @param {string} nodeId
|
|
77
|
+
* @param {number} iteration
|
|
78
|
+
* @param {string} [note]
|
|
79
|
+
* @param {string} [decidedBy]
|
|
80
|
+
* @param {unknown} [decision]
|
|
81
|
+
* @param {boolean} [autoApproved]
|
|
82
|
+
* @returns {Effect.Effect<void, SmithersError, never>}
|
|
83
|
+
*/
|
|
84
|
+
declare function approveNode(adapter: SmithersDb, runId: string, nodeId: string, iteration: number, note?: string, decidedBy?: string, decision?: unknown, autoApproved?: boolean): Effect.Effect<void, SmithersError, never>;
|
|
85
|
+
/**
|
|
86
|
+
* @param {SmithersDb} adapter
|
|
87
|
+
* @param {string} runId
|
|
88
|
+
* @param {string} nodeId
|
|
89
|
+
* @param {number} iteration
|
|
90
|
+
* @param {string} [note]
|
|
91
|
+
* @param {string} [decidedBy]
|
|
92
|
+
* @param {unknown} [decision]
|
|
93
|
+
* @returns {Effect.Effect<void, SmithersError, never>}
|
|
94
|
+
*/
|
|
95
|
+
declare function denyNode(adapter: SmithersDb, runId: string, nodeId: string, iteration: number, note?: string, decidedBy?: string, decision?: unknown): Effect.Effect<void, SmithersError, never>;
|
|
96
|
+
|
|
97
|
+
type ChildWorkflowExecuteOptions$1 = {
|
|
98
|
+
workflow: ChildWorkflowDefinition$1;
|
|
99
|
+
input?: unknown;
|
|
100
|
+
runId?: string;
|
|
101
|
+
parentRunId?: string;
|
|
102
|
+
rootDir?: string;
|
|
103
|
+
allowNetwork?: boolean;
|
|
104
|
+
maxOutputBytes?: number;
|
|
105
|
+
toolTimeoutMs?: number;
|
|
106
|
+
workflowPath?: string;
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {import("@smithers-orchestrator/components/SmithersWorkflow").SmithersWorkflow<any> | undefined} parentWorkflow
|
|
112
|
+
* @param {ChildWorkflowExecuteOptions} options
|
|
113
|
+
* @returns {Promise<{ runId: string; status: RunResult["status"]; output: unknown; }>}
|
|
114
|
+
*/
|
|
115
|
+
declare function executeChildWorkflow(parentWorkflow: _smithers_components_SmithersWorkflow.SmithersWorkflow<any> | undefined, options: ChildWorkflowExecuteOptions): Promise<{
|
|
116
|
+
runId: string;
|
|
117
|
+
status: RunResult$2["status"];
|
|
118
|
+
output: unknown;
|
|
119
|
+
}>;
|
|
120
|
+
type ChildWorkflowExecuteOptions = ChildWorkflowExecuteOptions$1;
|
|
121
|
+
type RunResult$2 = _smithers_driver_RunResult.RunResult;
|
|
122
|
+
|
|
123
|
+
/** @typedef {import("@smithers-orchestrator/observability/correlation").CorrelationContext} CorrelationContext */
|
|
124
|
+
/**
|
|
125
|
+
* @typedef {SmithersEvent & { correlation?: CorrelationContext; }} CorrelatedSmithersEvent
|
|
126
|
+
*/
|
|
127
|
+
/** @typedef {import("@smithers-orchestrator/observability/SmithersEvent").SmithersEvent} SmithersEvent */
|
|
128
|
+
/** @typedef {import("drizzle-orm/bun-sqlite").BunSQLiteDatabase<Record<string, unknown>>} _BunSQLiteDatabase */
|
|
129
|
+
declare class EventBus extends EventEmitter<any> {
|
|
130
|
+
/**
|
|
131
|
+
* @param {{ db?: BunSQLiteDatabase; logDir?: string; startSeq?: number }} opts
|
|
132
|
+
*/
|
|
133
|
+
constructor(opts: {
|
|
134
|
+
db?: BunSQLiteDatabase;
|
|
135
|
+
logDir?: string;
|
|
136
|
+
startSeq?: number;
|
|
137
|
+
});
|
|
138
|
+
seq: number;
|
|
139
|
+
logDir: string | undefined;
|
|
140
|
+
db: any;
|
|
141
|
+
persistTail: Promise<void>;
|
|
142
|
+
persistError: null;
|
|
143
|
+
/**
|
|
144
|
+
* @param {SmithersEvent} event
|
|
145
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
146
|
+
*/
|
|
147
|
+
emitEvent(event: SmithersEvent): Effect.Effect<void, unknown>;
|
|
148
|
+
/**
|
|
149
|
+
* @param {SmithersEvent} event
|
|
150
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
151
|
+
*/
|
|
152
|
+
emitEventWithPersist(event: SmithersEvent): Effect.Effect<void, unknown>;
|
|
153
|
+
/**
|
|
154
|
+
* @param {SmithersEvent} event
|
|
155
|
+
* @returns {Promise<void>}
|
|
156
|
+
*/
|
|
157
|
+
emitEventQueued(event: SmithersEvent): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
160
|
+
*/
|
|
161
|
+
flush(): Effect.Effect<void, unknown>;
|
|
162
|
+
/**
|
|
163
|
+
* @param {CorrelatedSmithersEvent} event
|
|
164
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
165
|
+
*/
|
|
166
|
+
persist(event: CorrelatedSmithersEvent): Effect.Effect<void, unknown>;
|
|
167
|
+
/**
|
|
168
|
+
* @param {CorrelatedSmithersEvent} event
|
|
169
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
170
|
+
*/
|
|
171
|
+
emitAndTrack(event: CorrelatedSmithersEvent): Effect.Effect<void, unknown>;
|
|
172
|
+
/**
|
|
173
|
+
* @param {CorrelatedSmithersEvent} event
|
|
174
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
175
|
+
*/
|
|
176
|
+
enqueuePersist(event: CorrelatedSmithersEvent): Effect.Effect<void, unknown>;
|
|
177
|
+
/**
|
|
178
|
+
* @param {CorrelatedSmithersEvent} event
|
|
179
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
180
|
+
*/
|
|
181
|
+
persistDb(event: CorrelatedSmithersEvent): Effect.Effect<void, unknown>;
|
|
182
|
+
/**
|
|
183
|
+
* @param {string} label
|
|
184
|
+
* @param {(row: any) => unknown} method
|
|
185
|
+
* @param {any} row
|
|
186
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
187
|
+
*/
|
|
188
|
+
callDbPersistence(label: string, method: (row: any) => unknown, row: any): Effect.Effect<void, unknown>;
|
|
189
|
+
/**
|
|
190
|
+
* @param {CorrelatedSmithersEvent} event
|
|
191
|
+
* @returns {Effect.Effect<void, unknown>}
|
|
192
|
+
*/
|
|
193
|
+
persistLog(event: CorrelatedSmithersEvent): Effect.Effect<void, unknown>;
|
|
194
|
+
/**
|
|
195
|
+
* @param {SmithersEvent} event
|
|
196
|
+
* @returns {CorrelatedSmithersEvent}
|
|
197
|
+
*/
|
|
198
|
+
attachCorrelation(event: SmithersEvent): CorrelatedSmithersEvent;
|
|
199
|
+
/**
|
|
200
|
+
* @param {CorrelatedSmithersEvent} event
|
|
201
|
+
*/
|
|
202
|
+
eventLogAnnotations(event: CorrelatedSmithersEvent): {
|
|
203
|
+
runId: string;
|
|
204
|
+
eventType: "SupervisorStarted" | "SupervisorPollCompleted" | "RunAutoResumed" | "RunAutoResumeSkipped" | "RunStarted" | "RunStatusChanged" | "RunStateChanged" | "RunFinished" | "RunFailed" | "RunCancelled" | "RunContinuedAsNew" | "RunHijackRequested" | "RunHijacked" | "SandboxCreated" | "SandboxShipped" | "SandboxHeartbeat" | "SandboxBundleReceived" | "SandboxCompleted" | "SandboxFailed" | "SandboxDiffReviewRequested" | "SandboxDiffAccepted" | "SandboxDiffRejected" | "FrameCommitted" | "NodePending" | "NodeStarted" | "TaskHeartbeat" | "TaskHeartbeatTimeout" | "NodeFinished" | "NodeFailed" | "NodeCancelled" | "NodeSkipped" | "NodeRetrying" | "NodeWaitingApproval" | "NodeWaitingTimer" | "ApprovalRequested" | "ApprovalGranted" | "ApprovalAutoApproved" | "ApprovalDenied" | "ToolCallStarted" | "ToolCallFinished" | "NodeOutput" | "AgentEvent" | "RetryTaskStarted" | "RetryTaskFinished" | "RevertStarted" | "RevertFinished" | "TimeTravelStarted" | "TimeTravelFinished" | "TimeTravelJumped" | "WorkflowReloadDetected" | "WorkflowReloaded" | "WorkflowReloadFailed" | "WorkflowReloadUnsafe" | "ScorerStarted" | "ScorerFinished" | "ScorerFailed" | "TokenUsageReported" | "SnapshotCaptured" | "RunForked" | "ReplayStarted" | "MemoryFactSet" | "MemoryRecalled" | "MemoryMessageSaved" | "OpenApiToolCalled" | "TimerCreated" | "TimerFired" | "TimerCancelled";
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
type CorrelationContext = _smithers_observability_correlation.CorrelationContext;
|
|
208
|
+
type CorrelatedSmithersEvent = SmithersEvent & {
|
|
209
|
+
correlation?: CorrelationContext;
|
|
210
|
+
};
|
|
211
|
+
type SmithersEvent = _smithers_observability_SmithersEvent.SmithersEvent;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @param {unknown} value
|
|
215
|
+
* @returns {| { name: string; sideEffect: boolean; idempotent: boolean; } | null}
|
|
216
|
+
*/
|
|
217
|
+
declare function getDefinedToolMetadata(value: unknown): {
|
|
218
|
+
name: string;
|
|
219
|
+
sideEffect: boolean;
|
|
220
|
+
idempotent: boolean;
|
|
221
|
+
} | null;
|
|
222
|
+
|
|
223
|
+
type HumanRequestStatus$1 = "pending" | "answered" | "cancelled" | "expired";
|
|
224
|
+
|
|
225
|
+
type HumanRequestKind$1 = "ask" | "confirm" | "select" | "json";
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @param {string} runId
|
|
229
|
+
* @param {string} nodeId
|
|
230
|
+
* @param {number} iteration
|
|
231
|
+
* @returns {string}
|
|
232
|
+
*/
|
|
233
|
+
declare function buildHumanRequestId(runId: string, nodeId: string, iteration: number): string;
|
|
234
|
+
/**
|
|
235
|
+
* @param {Record<string, unknown> | null | undefined} meta
|
|
236
|
+
* @returns {boolean}
|
|
237
|
+
*/
|
|
238
|
+
declare function isHumanTaskMeta(meta: Record<string, unknown> | null | undefined): boolean;
|
|
239
|
+
/**
|
|
240
|
+
* @param {Record<string, unknown> | null | undefined} meta
|
|
241
|
+
* @param {string} fallback
|
|
242
|
+
* @returns {string}
|
|
243
|
+
*/
|
|
244
|
+
declare function getHumanTaskPrompt(meta: Record<string, unknown> | null | undefined, fallback: string): string;
|
|
245
|
+
/**
|
|
246
|
+
* @param {{ timeoutAtMs?: number | null } | null | undefined} request
|
|
247
|
+
* @returns {boolean}
|
|
248
|
+
*/
|
|
249
|
+
declare function isHumanRequestPastTimeout(request: {
|
|
250
|
+
timeoutAtMs?: number | null;
|
|
251
|
+
} | null | undefined, nowMs?: number): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* @param {{ requestId: string; schemaJson: string | null }} request
|
|
254
|
+
* @param {unknown} value
|
|
255
|
+
* @returns {HumanRequestSchemaValidation}
|
|
256
|
+
*/
|
|
257
|
+
declare function validateHumanRequestValue(request: {
|
|
258
|
+
requestId: string;
|
|
259
|
+
schemaJson: string | null;
|
|
260
|
+
}, value: unknown): HumanRequestSchemaValidation;
|
|
261
|
+
/**
|
|
262
|
+
* @typedef {{ ok: true; } | { ok: false; code: "HUMAN_REQUEST_SCHEMA_INVALID" | "HUMAN_REQUEST_VALIDATION_FAILED"; message: string; }} HumanRequestSchemaValidation
|
|
263
|
+
*/
|
|
264
|
+
/** @type {readonly ["ask", "confirm", "select", "json"]} */
|
|
265
|
+
declare const HUMAN_REQUEST_KINDS: readonly ["ask", "confirm", "select", "json"];
|
|
266
|
+
/** @type {readonly ["pending", "answered", "cancelled", "expired"]} */
|
|
267
|
+
declare const HUMAN_REQUEST_STATUSES: readonly ["pending", "answered", "cancelled", "expired"];
|
|
268
|
+
type HumanRequestKind = HumanRequestKind$1;
|
|
269
|
+
type HumanRequestStatus = HumanRequestStatus$1;
|
|
270
|
+
type HumanRequestSchemaValidation = {
|
|
271
|
+
ok: true;
|
|
272
|
+
} | {
|
|
273
|
+
ok: false;
|
|
274
|
+
code: "HUMAN_REQUEST_SCHEMA_INVALID" | "HUMAN_REQUEST_VALIDATION_FAILED";
|
|
275
|
+
message: string;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @param {string | null | undefined} runtimeOwnerId
|
|
280
|
+
* @returns {number | null}
|
|
281
|
+
*/
|
|
282
|
+
declare function parseRuntimeOwnerPid(runtimeOwnerId: string | null | undefined): number | null;
|
|
283
|
+
/**
|
|
284
|
+
* @param {number} pid
|
|
285
|
+
* @returns {boolean}
|
|
286
|
+
*/
|
|
287
|
+
declare function isPidAlive(pid: number): boolean;
|
|
288
|
+
|
|
289
|
+
type RalphMeta$1 = {
|
|
290
|
+
id: string;
|
|
291
|
+
until: boolean;
|
|
292
|
+
maxIterations: number;
|
|
293
|
+
onMaxReached: "fail" | "return-last";
|
|
294
|
+
continueAsNewEvery?: number;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
type ContinuationRequest$1 = {
|
|
298
|
+
stateJson?: string;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
type ScheduleResult$1 = {
|
|
302
|
+
runnable: TaskDescriptor[];
|
|
303
|
+
pendingExists: boolean;
|
|
304
|
+
waitingApprovalExists: boolean;
|
|
305
|
+
waitingEventExists: boolean;
|
|
306
|
+
waitingTimerExists: boolean;
|
|
307
|
+
readyRalphs: RalphMeta$1[];
|
|
308
|
+
continuation?: ContinuationRequest$1;
|
|
309
|
+
nextRetryAtMs?: number;
|
|
310
|
+
fatalError?: string;
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
type RalphState$1 = {
|
|
314
|
+
iteration: number;
|
|
315
|
+
done: boolean;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
type RalphStateMap$1 = Map<string, RalphState$1>;
|
|
319
|
+
|
|
320
|
+
type PlanNode$1 = {
|
|
321
|
+
kind: "task";
|
|
322
|
+
nodeId: string;
|
|
323
|
+
} | {
|
|
324
|
+
kind: "sequence";
|
|
325
|
+
children: PlanNode$1[];
|
|
326
|
+
} | {
|
|
327
|
+
kind: "parallel";
|
|
328
|
+
children: PlanNode$1[];
|
|
329
|
+
} | {
|
|
330
|
+
kind: "ralph";
|
|
331
|
+
id: string;
|
|
332
|
+
children: PlanNode$1[];
|
|
333
|
+
until: boolean;
|
|
334
|
+
maxIterations: number;
|
|
335
|
+
onMaxReached: "fail" | "return-last";
|
|
336
|
+
continueAsNewEvery?: number;
|
|
337
|
+
} | {
|
|
338
|
+
kind: "continue-as-new";
|
|
339
|
+
stateJson?: string;
|
|
340
|
+
} | {
|
|
341
|
+
kind: "group";
|
|
342
|
+
children: PlanNode$1[];
|
|
343
|
+
} | {
|
|
344
|
+
kind: "saga";
|
|
345
|
+
id: string;
|
|
346
|
+
actionChildren: PlanNode$1[];
|
|
347
|
+
compensationChildren: PlanNode$1[];
|
|
348
|
+
onFailure: "compensate" | "compensate-and-fail" | "fail";
|
|
349
|
+
} | {
|
|
350
|
+
kind: "try-catch-finally";
|
|
351
|
+
id: string;
|
|
352
|
+
tryChildren: PlanNode$1[];
|
|
353
|
+
catchChildren: PlanNode$1[];
|
|
354
|
+
finallyChildren: PlanNode$1[];
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @type {(xml: XmlNode | null, ralphState?: RalphStateMap) => { plan: PlanNode | null; ralphs: RalphMeta[] }}
|
|
359
|
+
*/
|
|
360
|
+
declare const buildPlanTree: (xml: XmlNode | null, ralphState?: RalphStateMap) => {
|
|
361
|
+
plan: PlanNode | null;
|
|
362
|
+
ralphs: RalphMeta[];
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* @type {(plan: PlanNode | null, states: TaskStateMap, descriptors: Map<string, _TaskDescriptor>, ralphState: RalphStateMap, retryWait: Map<string, number>, nowMs: number) => ScheduleResult}
|
|
366
|
+
*/
|
|
367
|
+
declare const scheduleTasks: (plan: PlanNode | null, states: TaskStateMap, descriptors: Map<string, _TaskDescriptor$6>, ralphState: RalphStateMap, retryWait: Map<string, number>, nowMs: number) => ScheduleResult;
|
|
368
|
+
type ContinuationRequest = ContinuationRequest$1;
|
|
369
|
+
type PlanNode = PlanNode$1;
|
|
370
|
+
type RalphMeta = RalphMeta$1;
|
|
371
|
+
type RalphState = RalphState$1;
|
|
372
|
+
type RalphStateMap = RalphStateMap$1;
|
|
373
|
+
type ReadonlyTaskStateMap = _smithers_scheduler.ReadonlyTaskStateMap;
|
|
374
|
+
type RetryWaitMap = _smithers_scheduler.RetryWaitMap;
|
|
375
|
+
type ScheduleResult = ScheduleResult$1;
|
|
376
|
+
type ScheduleSnapshot = _smithers_scheduler.ScheduleSnapshot;
|
|
377
|
+
type TaskRecord = _smithers_scheduler.TaskRecord;
|
|
378
|
+
type TaskState = _smithers_scheduler.TaskState;
|
|
379
|
+
type TaskStateMap = _smithers_scheduler.TaskStateMap;
|
|
380
|
+
type _TaskDescriptor$6 = _smithers_graph_TaskDescriptor.TaskDescriptor;
|
|
381
|
+
type XmlNode = _smithers_graph_XmlNode.XmlNode;
|
|
382
|
+
|
|
383
|
+
type SignalRunOptions$1 = {
|
|
384
|
+
correlationId?: string | null;
|
|
385
|
+
receivedBy?: string | null;
|
|
386
|
+
timestampMs?: number;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* @param {SmithersDb} adapter
|
|
391
|
+
* @param {string} runId
|
|
392
|
+
* @param {string} signalName
|
|
393
|
+
* @param {unknown} payload
|
|
394
|
+
* @param {SignalRunOptions} [options]
|
|
395
|
+
* @returns {Effect.Effect<{ runId: string; seq: number; signalName: string; correlationId: string | null; receivedAtMs: number }, SmithersError, never>}
|
|
396
|
+
*/
|
|
397
|
+
declare function signalRun(adapter: SmithersDb, runId: string, signalName: string, payload: unknown, options?: SignalRunOptions): Effect.Effect<{
|
|
398
|
+
runId: string;
|
|
399
|
+
seq: number;
|
|
400
|
+
signalName: string;
|
|
401
|
+
correlationId: string | null;
|
|
402
|
+
receivedAtMs: number;
|
|
403
|
+
}, SmithersError, never>;
|
|
404
|
+
type SignalRunOptions = SignalRunOptions$1;
|
|
405
|
+
|
|
406
|
+
type WatchTreeOptions$2 = {
|
|
407
|
+
/** Patterns to ignore (directory basenames) */
|
|
408
|
+
ignore?: string[];
|
|
409
|
+
/** Debounce interval in ms (default: 100) */
|
|
410
|
+
debounceMs?: number;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
type OverlayOptions$2 = {
|
|
414
|
+
/** Directory basenames to exclude from overlay */
|
|
415
|
+
exclude?: string[];
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
type HotReloadEvent$2 = {
|
|
419
|
+
type: "reloaded";
|
|
420
|
+
generation: number;
|
|
421
|
+
changedFiles: string[];
|
|
422
|
+
newBuild: SmithersWorkflow$2<unknown>["build"];
|
|
423
|
+
} | {
|
|
424
|
+
type: "failed";
|
|
425
|
+
generation: number;
|
|
426
|
+
changedFiles: string[];
|
|
427
|
+
error: unknown;
|
|
428
|
+
} | {
|
|
429
|
+
type: "unsafe";
|
|
430
|
+
generation: number;
|
|
431
|
+
changedFiles: string[];
|
|
432
|
+
reason: string;
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
declare class WatchTree {
|
|
436
|
+
/**
|
|
437
|
+
* @param {string} rootDir
|
|
438
|
+
* @param {WatchTreeOptions} [opts]
|
|
439
|
+
*/
|
|
440
|
+
constructor(rootDir: string, opts?: WatchTreeOptions$1);
|
|
441
|
+
watchers: any[];
|
|
442
|
+
rootDir: string;
|
|
443
|
+
ignore: string[];
|
|
444
|
+
debounceMs: number;
|
|
445
|
+
changedFiles: Set<any>;
|
|
446
|
+
debounceTimer: null;
|
|
447
|
+
waitResolve: null;
|
|
448
|
+
closed: boolean;
|
|
449
|
+
/** Start watching. Call once. */
|
|
450
|
+
start(): Promise<void>;
|
|
451
|
+
/**
|
|
452
|
+
* Returns a promise that resolves with changed file paths
|
|
453
|
+
* the next time file changes are detected (after debounce).
|
|
454
|
+
* Can be called repeatedly.
|
|
455
|
+
*/
|
|
456
|
+
wait(): Promise<any>;
|
|
457
|
+
/** Stop all watchers and clean up. */
|
|
458
|
+
close(): void;
|
|
459
|
+
startEffect(): Effect.Effect<void, _smithers_errors_toSmithersError.SmithersError, never>;
|
|
460
|
+
waitEffect(): Effect.Effect<any, never, never>;
|
|
461
|
+
/**
|
|
462
|
+
* @param {string} name
|
|
463
|
+
* @returns {boolean}
|
|
464
|
+
*/
|
|
465
|
+
shouldIgnore(name: string): boolean;
|
|
466
|
+
/**
|
|
467
|
+
* @param {string} dir
|
|
468
|
+
* @returns {Promise<void>}
|
|
469
|
+
*/
|
|
470
|
+
watchDir(dir: string): Promise<void>;
|
|
471
|
+
/**
|
|
472
|
+
* @param {string} filePath
|
|
473
|
+
*/
|
|
474
|
+
onFileChange(filePath: string): void;
|
|
475
|
+
flush(): void;
|
|
476
|
+
}
|
|
477
|
+
type WatchTreeOptions$1 = WatchTreeOptions$2;
|
|
478
|
+
|
|
479
|
+
declare class HotWorkflowController {
|
|
480
|
+
/**
|
|
481
|
+
* @param {string} entryPath
|
|
482
|
+
* @param {HotReloadOptions} [opts]
|
|
483
|
+
*/
|
|
484
|
+
constructor(entryPath: string, opts?: HotReloadOptions);
|
|
485
|
+
entryPath: string;
|
|
486
|
+
hotRoot: string;
|
|
487
|
+
outDir: string;
|
|
488
|
+
maxGenerations: number;
|
|
489
|
+
watcher: WatchTree;
|
|
490
|
+
generation: number;
|
|
491
|
+
closed: boolean;
|
|
492
|
+
/** Initialize: start file watchers. Call once before using wait/reload. */
|
|
493
|
+
init(): Promise<void>;
|
|
494
|
+
/** Current generation number. */
|
|
495
|
+
get gen(): number;
|
|
496
|
+
/**
|
|
497
|
+
* Wait for the next file change event.
|
|
498
|
+
* Returns the list of changed file paths.
|
|
499
|
+
* Use this in Promise.race with inflight tasks to wake the engine loop.
|
|
500
|
+
*/
|
|
501
|
+
wait(): Promise<any>;
|
|
502
|
+
/**
|
|
503
|
+
* Perform a hot reload:
|
|
504
|
+
* 1. Build a new generation overlay
|
|
505
|
+
* 2. Import the workflow module from the overlay
|
|
506
|
+
* 3. Validate the module
|
|
507
|
+
* 4. Return the result (reloaded, failed, or unsafe)
|
|
508
|
+
*
|
|
509
|
+
* The caller is responsible for swapping workflow.build on success.
|
|
510
|
+
*
|
|
511
|
+
* @param {string[]} changedFiles
|
|
512
|
+
* @returns {Promise<HotReloadEvent>}
|
|
513
|
+
*/
|
|
514
|
+
reload(changedFiles: string[]): Promise<HotReloadEvent$1>;
|
|
515
|
+
initEffect(): Effect.Effect<void, SmithersError, never>;
|
|
516
|
+
waitEffect(): Effect.Effect<any, never, never>;
|
|
517
|
+
/**
|
|
518
|
+
* @param {string[]} changedFiles
|
|
519
|
+
*/
|
|
520
|
+
reloadEffect(changedFiles: string[]): Effect.Effect<{
|
|
521
|
+
type: string;
|
|
522
|
+
generation: number;
|
|
523
|
+
changedFiles: string[];
|
|
524
|
+
error: SmithersError;
|
|
525
|
+
newBuild?: undefined;
|
|
526
|
+
} | {
|
|
527
|
+
type: string;
|
|
528
|
+
generation: number;
|
|
529
|
+
changedFiles: string[];
|
|
530
|
+
newBuild: any;
|
|
531
|
+
error?: undefined;
|
|
532
|
+
} | {
|
|
533
|
+
type: string;
|
|
534
|
+
generation: number;
|
|
535
|
+
changedFiles: string[];
|
|
536
|
+
reason: string;
|
|
537
|
+
error?: undefined;
|
|
538
|
+
} | {
|
|
539
|
+
type: string;
|
|
540
|
+
generation: number;
|
|
541
|
+
changedFiles: string[];
|
|
542
|
+
error: SmithersError;
|
|
543
|
+
reason?: undefined;
|
|
544
|
+
}, never, never>;
|
|
545
|
+
/** Stop watchers and clean up overlay directory. */
|
|
546
|
+
close(): Promise<void>;
|
|
547
|
+
closeEffect(): Effect.Effect<any, any, any>;
|
|
548
|
+
}
|
|
549
|
+
type HotReloadEvent$1 = HotReloadEvent$2;
|
|
550
|
+
type HotReloadOptions = _smithers_driver_RunOptions.HotReloadOptions;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* @param {string} hotRoot
|
|
554
|
+
* @param {string} outDir
|
|
555
|
+
* @param {number} generation
|
|
556
|
+
* @param {OverlayOptions} [opts]
|
|
557
|
+
* @returns {Promise<string>}
|
|
558
|
+
*/
|
|
559
|
+
declare function buildOverlay(hotRoot: string, outDir: string, generation: number, opts?: OverlayOptions$1): Promise<string>;
|
|
560
|
+
/**
|
|
561
|
+
* @param {string} outDir
|
|
562
|
+
* @param {number} keepLast
|
|
563
|
+
* @returns {Promise<void>}
|
|
564
|
+
*/
|
|
565
|
+
declare function cleanupGenerations(outDir: string, keepLast: number): Promise<void>;
|
|
566
|
+
/**
|
|
567
|
+
* Resolve the overlay entry path given the original entry path,
|
|
568
|
+
* the hot root, and the overlay generation directory.
|
|
569
|
+
*
|
|
570
|
+
* @param {string} entryPath
|
|
571
|
+
* @param {string} hotRoot
|
|
572
|
+
* @param {string} genDir
|
|
573
|
+
* @returns {string}
|
|
574
|
+
*/
|
|
575
|
+
declare function resolveOverlayEntry(entryPath: string, hotRoot: string, genDir: string): string;
|
|
576
|
+
type OverlayOptions$1 = OverlayOptions$2;
|
|
577
|
+
|
|
578
|
+
type HotReloadEvent = HotReloadEvent$2;
|
|
579
|
+
type OverlayOptions = OverlayOptions$2;
|
|
580
|
+
type WatchTreeOptions = WatchTreeOptions$2;
|
|
581
|
+
|
|
582
|
+
type TaskActivityContext$1 = {
|
|
583
|
+
attempt: number;
|
|
584
|
+
idempotencyKey: string;
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
type TaskBridgeToolConfig$1 = {
|
|
588
|
+
rootDir: string;
|
|
589
|
+
allowNetwork: boolean;
|
|
590
|
+
maxOutputBytes: number;
|
|
591
|
+
toolTimeoutMs: number;
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
type HijackCompletion = {
|
|
595
|
+
requestedAtMs: number;
|
|
596
|
+
nodeId: string;
|
|
597
|
+
iteration: number;
|
|
598
|
+
attempt: number;
|
|
599
|
+
engine: string;
|
|
600
|
+
mode: "native-cli" | "conversation";
|
|
601
|
+
resume?: string;
|
|
602
|
+
messages?: unknown[];
|
|
603
|
+
cwd: string;
|
|
604
|
+
};
|
|
605
|
+
type HijackState$1 = {
|
|
606
|
+
request: {
|
|
607
|
+
requestedAtMs: number;
|
|
608
|
+
target?: string | null;
|
|
609
|
+
} | null;
|
|
610
|
+
completion: HijackCompletion | null;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
type LegacyExecuteTaskFn$1 = (adapter: SmithersDb, db: BunSQLiteDatabase$3<Record<string, unknown>>, runId: string, desc: TaskDescriptor, descriptorMap: Map<string, TaskDescriptor>, inputTable: SQLiteTable$1, eventBus: EventBus, toolConfig: TaskBridgeToolConfig$1, workflowName: string, cacheEnabled: boolean, signal?: AbortSignal, disabledAgents?: Set<string>, runAbortController?: AbortController, hijackState?: HijackState$1) => Promise<void>;
|
|
614
|
+
|
|
615
|
+
declare function makeDurableDeferredBridgeExecutionId(adapter: _SmithersDb$4, runId: string, nodeId: string, iteration: number): string;
|
|
616
|
+
declare function makeApprovalDurableDeferred(nodeId: string): any;
|
|
617
|
+
declare function makeWaitForEventDurableDeferred(nodeId: string): any;
|
|
618
|
+
declare function awaitApprovalDurableDeferred(adapter: _SmithersDb$4, runId: string, nodeId: string, iteration: number): Promise<BridgeDeferredResult>;
|
|
619
|
+
declare function awaitWaitForEventDurableDeferred(adapter: _SmithersDb$4, runId: string, nodeId: string, iteration: number): Promise<BridgeDeferredResult>;
|
|
620
|
+
declare function bridgeApprovalResolve(adapter: _SmithersDb$4, runId: string, nodeId: string, iteration: number, resolution: {
|
|
621
|
+
approved: boolean;
|
|
622
|
+
note?: string | null;
|
|
623
|
+
decidedBy?: string | null;
|
|
624
|
+
decisionJson?: string | null;
|
|
625
|
+
autoApproved?: boolean;
|
|
626
|
+
}): Promise<void>;
|
|
627
|
+
declare function bridgeWaitForEventResolve(adapter: _SmithersDb$4, runId: string, nodeId: string, iteration: number, signal: WaitForEventSignalInput): Promise<void>;
|
|
628
|
+
declare function bridgeSignalResolve(adapter: _SmithersDb$4, runId: string, signal: WaitForEventSignalInput): Promise<void>;
|
|
629
|
+
type BridgeDeferredResult = {
|
|
630
|
+
_tag: "Complete";
|
|
631
|
+
exit: Exit.Exit<any, any>;
|
|
632
|
+
} | {
|
|
633
|
+
_tag: "Pending";
|
|
634
|
+
};
|
|
635
|
+
type _SmithersDb$4 = _smithers_db_adapter.SmithersDb;
|
|
636
|
+
type WaitForEventSignalInput = {
|
|
637
|
+
signalName: string;
|
|
638
|
+
correlationId: string | null;
|
|
639
|
+
payloadJson: string;
|
|
640
|
+
seq: number;
|
|
641
|
+
receivedAtMs: number;
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* @param {_TaskDescriptor} desc
|
|
646
|
+
* @returns {boolean}
|
|
647
|
+
*/
|
|
648
|
+
declare function isBridgeManagedTimerTask(desc: _TaskDescriptor$5): boolean;
|
|
649
|
+
/**
|
|
650
|
+
* @param {_TaskDescriptor} desc
|
|
651
|
+
* @returns {boolean}
|
|
652
|
+
*/
|
|
653
|
+
declare function isBridgeManagedWaitForEventTask(desc: _TaskDescriptor$5): boolean;
|
|
654
|
+
/**
|
|
655
|
+
* @param {_SmithersDb} adapter
|
|
656
|
+
* @param {BunSQLiteDatabase} db
|
|
657
|
+
* @param {string} runId
|
|
658
|
+
* @param {_TaskDescriptor} desc
|
|
659
|
+
* @param {EventBus} eventBus
|
|
660
|
+
* @param {DeferredBridgeStateEmitter} [emitStateEvent]
|
|
661
|
+
* @returns {Promise<DeferredBridgeResolution>}
|
|
662
|
+
*/
|
|
663
|
+
declare function resolveDeferredTaskStateBridge(adapter: _SmithersDb$3, db: BunSQLiteDatabase$2, runId: string, desc: _TaskDescriptor$5, eventBus: EventBus, emitStateEvent?: DeferredBridgeStateEmitter): Promise<DeferredBridgeResolution>;
|
|
664
|
+
/**
|
|
665
|
+
* @param {_SmithersDb} adapter
|
|
666
|
+
* @param {string} runId
|
|
667
|
+
* @param {EventBus} eventBus
|
|
668
|
+
* @param {string} reason
|
|
669
|
+
*/
|
|
670
|
+
declare function cancelPendingTimersBridge(adapter: _SmithersDb$3, runId: string, eventBus: EventBus, reason: string): Promise<void>;
|
|
671
|
+
type DeferredBridgeState = "pending" | "waiting-approval" | "waiting-event" | "waiting-timer" | "finished" | "failed" | "skipped";
|
|
672
|
+
type DeferredBridgeResolution = {
|
|
673
|
+
handled: false;
|
|
674
|
+
} | {
|
|
675
|
+
handled: true;
|
|
676
|
+
state: DeferredBridgeState;
|
|
677
|
+
};
|
|
678
|
+
type DeferredBridgeStateEmitter = (state: "pending" | "failed" | "skipped") => Promise<void>;
|
|
679
|
+
type _SmithersDb$3 = _smithers_db_adapter.SmithersDb;
|
|
680
|
+
type _TaskDescriptor$5 = _smithers_graph_TaskDescriptor.TaskDescriptor;
|
|
681
|
+
type BunSQLiteDatabase$2 = drizzle_orm_bun_sqlite.BunSQLiteDatabase<Record<string, unknown>>;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* @template T
|
|
685
|
+
* @param {WorkflowMakeBridgeRuntime} runtime
|
|
686
|
+
* @param {() => T} execute
|
|
687
|
+
* @returns {T}
|
|
688
|
+
*/
|
|
689
|
+
declare function withWorkflowMakeBridgeRuntime<T>(runtime: WorkflowMakeBridgeRuntime, execute: () => T): T;
|
|
690
|
+
/**
|
|
691
|
+
* @returns {| WorkflowMakeBridgeRuntime | undefined}
|
|
692
|
+
*/
|
|
693
|
+
declare function getWorkflowMakeBridgeRuntime(): WorkflowMakeBridgeRuntime | undefined;
|
|
694
|
+
/**
|
|
695
|
+
* @returns {SchedulerWakeQueue}
|
|
696
|
+
*/
|
|
697
|
+
declare function createSchedulerWakeQueue(): SchedulerWakeQueue;
|
|
698
|
+
/**
|
|
699
|
+
* @template Schema
|
|
700
|
+
* @param {SmithersWorkflow<Schema>} workflow
|
|
701
|
+
* @param {RunOptions & { runId: string }} opts
|
|
702
|
+
* @param {RunBodyExecutor} executeBody
|
|
703
|
+
* @returns {Promise<RunResult>}
|
|
704
|
+
*/
|
|
705
|
+
declare function runWorkflowWithMakeBridge<Schema>(workflow: SmithersWorkflow$1<Schema>, opts: RunOptions$1 & {
|
|
706
|
+
runId: string;
|
|
707
|
+
}, executeBody: RunBodyExecutor): Promise<RunResult$1>;
|
|
708
|
+
type RunBodyResult = RunResult$1 | (RunResult$1 & {
|
|
709
|
+
status: "continued";
|
|
710
|
+
nextRunId: string;
|
|
711
|
+
});
|
|
712
|
+
type RunBodyExecutor = <Schema>(workflow: SmithersWorkflow$1<Schema>, opts: RunOptions$1) => Promise<RunBodyResult>;
|
|
713
|
+
type RunOptions$1 = _smithers_driver_RunOptions.RunOptions;
|
|
714
|
+
type RunResult$1 = _smithers_driver_RunResult.RunResult;
|
|
715
|
+
type SchedulerWakeQueue = {
|
|
716
|
+
notify(): void;
|
|
717
|
+
wait(): Promise<void>;
|
|
718
|
+
};
|
|
719
|
+
type SmithersWorkflow$1 = any;
|
|
720
|
+
type WorkflowEngineContext = effect.Context.Context<WorkflowEngine.WorkflowEngine>;
|
|
721
|
+
type WorkflowMakeBridgeRuntime = {
|
|
722
|
+
readonly engineContext: WorkflowEngineContext;
|
|
723
|
+
readonly scope: Scope.CloseableScope;
|
|
724
|
+
readonly parentInstance: WorkflowEngine.WorkflowInstance["Type"];
|
|
725
|
+
readonly executeBody: RunBodyExecutor;
|
|
726
|
+
executeChildWorkflow: <Schema>(workflow: SmithersWorkflow$1<Schema>, opts: RunOptions$1 & {
|
|
727
|
+
runId: string;
|
|
728
|
+
}) => Promise<RunResult$1>;
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
type SqlMessageStorageEventHistoryQuery$1 = {
|
|
732
|
+
afterSeq?: number;
|
|
733
|
+
limit?: number;
|
|
734
|
+
nodeId?: string;
|
|
735
|
+
types?: readonly string[];
|
|
736
|
+
sinceTimestampMs?: number;
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* @param {BunSQLiteDatabase<any> | Database} db
|
|
741
|
+
* @returns {SqlMessageStorage}
|
|
742
|
+
*/
|
|
743
|
+
declare function getSqlMessageStorage(db: BunSQLiteDatabase$1<any> | Database): SqlMessageStorage;
|
|
744
|
+
/**
|
|
745
|
+
* @param {BunSQLiteDatabase<any> | Database} db
|
|
746
|
+
* @returns {Effect.Effect<void, never>}
|
|
747
|
+
*/
|
|
748
|
+
declare function ensureSqlMessageStorageEffect(db: BunSQLiteDatabase$1<any> | Database): Effect.Effect<void, never>;
|
|
749
|
+
/**
|
|
750
|
+
* @param {BunSQLiteDatabase<any> | Database} db
|
|
751
|
+
* @returns {Promise<void>}
|
|
752
|
+
*/
|
|
753
|
+
declare function ensureSqlMessageStorage(db: BunSQLiteDatabase$1<any> | Database): Promise<void>;
|
|
754
|
+
declare class SqlMessageStorage {
|
|
755
|
+
/**
|
|
756
|
+
* @param {BunSQLiteDatabase<any> | Database} db
|
|
757
|
+
*/
|
|
758
|
+
constructor(db: BunSQLiteDatabase$1<any> | Database);
|
|
759
|
+
sqlite: Database;
|
|
760
|
+
runtime: ManagedRuntime.ManagedRuntime<any, never>;
|
|
761
|
+
tableColumnsCache: Map<any, any>;
|
|
762
|
+
/**
|
|
763
|
+
* @param {string} table
|
|
764
|
+
* @returns {Set<string>}
|
|
765
|
+
*/
|
|
766
|
+
getTableColumns(table: string): Set<string>;
|
|
767
|
+
/**
|
|
768
|
+
* @param {string} table
|
|
769
|
+
* @param {Record<string, unknown>} row
|
|
770
|
+
* @returns {Record<string, unknown>}
|
|
771
|
+
*/
|
|
772
|
+
filterKnownColumns(table: string, row: Record<string, unknown>): Record<string, unknown>;
|
|
773
|
+
/**
|
|
774
|
+
* @template A, E
|
|
775
|
+
* @param {Effect.Effect<A, E, SqlClient.SqlClient>} effect
|
|
776
|
+
* @returns {Promise<A>}
|
|
777
|
+
*/
|
|
778
|
+
runEffect<A, E>(effect: Effect.Effect<A, E, SqlClient.SqlClient>): Promise<A>;
|
|
779
|
+
/**
|
|
780
|
+
* @template A
|
|
781
|
+
* @param {(connection: Connection) => Effect.Effect<A, SqlError>} f
|
|
782
|
+
* @returns {Promise<A>}
|
|
783
|
+
*/
|
|
784
|
+
withConnection<A>(f: (connection: Connection) => Effect.Effect<A, SqlError>): Promise<A>;
|
|
785
|
+
/**
|
|
786
|
+
* @returns {Effect.Effect<void, never>}
|
|
787
|
+
*/
|
|
788
|
+
ensureSchemaEffect(): Effect.Effect<void, never>;
|
|
789
|
+
/**
|
|
790
|
+
* @returns {Promise<void>}
|
|
791
|
+
*/
|
|
792
|
+
ensureSchema(): Promise<void>;
|
|
793
|
+
/**
|
|
794
|
+
* @template T
|
|
795
|
+
* @param {string} statement
|
|
796
|
+
* @param {ReadonlyArray<SqliteParam>} [params]
|
|
797
|
+
* @param {{ booleanColumns?: readonly string[] }} [options]
|
|
798
|
+
* @returns {Promise<Array<T>>}
|
|
799
|
+
*/
|
|
800
|
+
queryAll<T>(statement: string, params?: ReadonlyArray<SqliteParam>, options?: {
|
|
801
|
+
booleanColumns?: readonly string[];
|
|
802
|
+
}): Promise<Array<T>>;
|
|
803
|
+
/**
|
|
804
|
+
* @template T
|
|
805
|
+
* @param {string} statement
|
|
806
|
+
* @param {ReadonlyArray<SqliteParam>} [params]
|
|
807
|
+
* @param {{ booleanColumns?: readonly string[] }} [options]
|
|
808
|
+
* @returns {Promise<T | undefined>}
|
|
809
|
+
*/
|
|
810
|
+
queryOne<T>(statement: string, params?: ReadonlyArray<SqliteParam>, options?: {
|
|
811
|
+
booleanColumns?: readonly string[];
|
|
812
|
+
}): Promise<T | undefined>;
|
|
813
|
+
/**
|
|
814
|
+
* @param {string} statement
|
|
815
|
+
* @param {ReadonlyArray<SqliteParam>} [params]
|
|
816
|
+
* @returns {Promise<void>}
|
|
817
|
+
*/
|
|
818
|
+
execute(statement: string, params?: ReadonlyArray<SqliteParam>): Promise<void>;
|
|
819
|
+
/**
|
|
820
|
+
* @param {string} table
|
|
821
|
+
* @param {Record<string, unknown>} row
|
|
822
|
+
* @returns {Promise<void>}
|
|
823
|
+
*/
|
|
824
|
+
insertIgnore(table: string, row: Record<string, unknown>): Promise<void>;
|
|
825
|
+
/**
|
|
826
|
+
* @param {string} table
|
|
827
|
+
* @param {Record<string, unknown>} row
|
|
828
|
+
* @param {readonly string[]} conflictColumns
|
|
829
|
+
* @param {readonly string[]} [updateColumns]
|
|
830
|
+
* @returns {Promise<void>}
|
|
831
|
+
*/
|
|
832
|
+
upsert(table: string, row: Record<string, unknown>, conflictColumns: readonly string[], updateColumns?: readonly string[]): Promise<void>;
|
|
833
|
+
/**
|
|
834
|
+
* @param {string} table
|
|
835
|
+
* @param {Record<string, unknown>} patch
|
|
836
|
+
* @param {string} whereSql
|
|
837
|
+
* @param {ReadonlyArray<SqliteParam>} [params]
|
|
838
|
+
* @returns {Promise<void>}
|
|
839
|
+
*/
|
|
840
|
+
updateWhere(table: string, patch: Record<string, unknown>, whereSql: string, params?: ReadonlyArray<SqliteParam>): Promise<void>;
|
|
841
|
+
/**
|
|
842
|
+
* @param {string} table
|
|
843
|
+
* @param {string} whereSql
|
|
844
|
+
* @param {ReadonlyArray<SqliteParam>} [params]
|
|
845
|
+
* @returns {Promise<void>}
|
|
846
|
+
*/
|
|
847
|
+
deleteWhere(table: string, whereSql: string, params?: ReadonlyArray<SqliteParam>): Promise<void>;
|
|
848
|
+
/**
|
|
849
|
+
* @param {string} runId
|
|
850
|
+
* @param {SqlMessageStorageEventHistoryQuery} [query]
|
|
851
|
+
* @returns {{ whereSql: string; params: Array<SqliteParam> }}
|
|
852
|
+
*/
|
|
853
|
+
buildEventHistoryWhere(runId: string, query?: SqlMessageStorageEventHistoryQuery): {
|
|
854
|
+
whereSql: string;
|
|
855
|
+
params: Array<SqliteParam>;
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* @param {string} runId
|
|
859
|
+
* @param {SqlMessageStorageEventHistoryQuery} [query]
|
|
860
|
+
* @returns {Promise<Array<Record<string, unknown>>>}
|
|
861
|
+
*/
|
|
862
|
+
listEventHistory(runId: string, query?: SqlMessageStorageEventHistoryQuery): Promise<Array<Record<string, unknown>>>;
|
|
863
|
+
/**
|
|
864
|
+
* @param {string} runId
|
|
865
|
+
* @param {SqlMessageStorageEventHistoryQuery} [query]
|
|
866
|
+
* @returns {Promise<number>}
|
|
867
|
+
*/
|
|
868
|
+
countEventHistory(runId: string, query?: SqlMessageStorageEventHistoryQuery): Promise<number>;
|
|
869
|
+
/**
|
|
870
|
+
* @param {string} runId
|
|
871
|
+
* @returns {Promise<number | undefined>}
|
|
872
|
+
*/
|
|
873
|
+
getLastEventSeq(runId: string): Promise<number | undefined>;
|
|
874
|
+
/**
|
|
875
|
+
* @param {string} runId
|
|
876
|
+
* @param {string} type
|
|
877
|
+
* @returns {Promise<Array<Record<string, unknown>>>}
|
|
878
|
+
*/
|
|
879
|
+
listEventsByType(runId: string, type: string): Promise<Array<Record<string, unknown>>>;
|
|
880
|
+
/**
|
|
881
|
+
* @param {string} runId
|
|
882
|
+
* @returns {Promise<number | undefined>}
|
|
883
|
+
*/
|
|
884
|
+
getLastSignalSeq(runId: string): Promise<number | undefined>;
|
|
885
|
+
}
|
|
886
|
+
type BunSQLiteDatabase$1 = drizzle_orm_bun_sqlite.BunSQLiteDatabase;
|
|
887
|
+
type SqlMessageStorageEventHistoryQuery = SqlMessageStorageEventHistoryQuery$1;
|
|
888
|
+
type SqliteParam = string | number | bigint | boolean | Uint8Array | null | undefined;
|
|
889
|
+
|
|
890
|
+
declare const DockerSandboxExecutorLive: Layer.Layer<any, never, never>;
|
|
891
|
+
declare const CodeplaneSandboxExecutorLive: Layer.Layer<any, never, never>;
|
|
892
|
+
declare const SandboxHttpRunner: any;
|
|
893
|
+
|
|
894
|
+
type UnknownWorkerError = {
|
|
895
|
+
_tag: "UnknownWorkerError";
|
|
896
|
+
errorId: string;
|
|
897
|
+
message: string;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
type TaggedWorkerError = {
|
|
901
|
+
_tag: "TaskAborted";
|
|
902
|
+
message: string;
|
|
903
|
+
details?: Record<string, unknown>;
|
|
904
|
+
name?: string;
|
|
905
|
+
} | {
|
|
906
|
+
_tag: "TaskTimeout";
|
|
907
|
+
message: string;
|
|
908
|
+
nodeId: string;
|
|
909
|
+
attempt: number;
|
|
910
|
+
timeoutMs: number;
|
|
911
|
+
} | {
|
|
912
|
+
_tag: "TaskHeartbeatTimeout";
|
|
913
|
+
message: string;
|
|
914
|
+
nodeId: string;
|
|
915
|
+
iteration: number;
|
|
916
|
+
attempt: number;
|
|
917
|
+
timeoutMs: number;
|
|
918
|
+
staleForMs: number;
|
|
919
|
+
lastHeartbeatAtMs: number;
|
|
920
|
+
} | {
|
|
921
|
+
_tag: "RunNotFound";
|
|
922
|
+
message: string;
|
|
923
|
+
runId: string;
|
|
924
|
+
} | {
|
|
925
|
+
_tag: "InvalidInput";
|
|
926
|
+
message: string;
|
|
927
|
+
details?: Record<string, unknown>;
|
|
928
|
+
} | {
|
|
929
|
+
_tag: "DbWriteFailed";
|
|
930
|
+
message: string;
|
|
931
|
+
details?: Record<string, unknown>;
|
|
932
|
+
} | {
|
|
933
|
+
_tag: "AgentCliError";
|
|
934
|
+
message: string;
|
|
935
|
+
details?: Record<string, unknown>;
|
|
936
|
+
} | {
|
|
937
|
+
_tag: "WorkflowFailed";
|
|
938
|
+
message: string;
|
|
939
|
+
details?: Record<string, unknown>;
|
|
940
|
+
status?: number;
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
type WorkerTaskError = TaggedWorkerError | UnknownWorkerError;
|
|
944
|
+
|
|
945
|
+
type TaskResult$1 = {
|
|
946
|
+
_tag: "Success";
|
|
947
|
+
executionId: string;
|
|
948
|
+
terminal: boolean;
|
|
949
|
+
} | {
|
|
950
|
+
_tag: "Failure";
|
|
951
|
+
executionId: string;
|
|
952
|
+
error: WorkerTaskError;
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
type TaskFailure$1 = Extract<TaskResult$1, {
|
|
956
|
+
_tag: "Failure";
|
|
957
|
+
}>;
|
|
958
|
+
|
|
959
|
+
type WorkerTaskKind$1 = "agent" | "compute" | "static";
|
|
960
|
+
|
|
961
|
+
type WorkerDispatchKind$1 = "compute" | "static" | "legacy";
|
|
962
|
+
|
|
963
|
+
type WorkerTask$2 = {
|
|
964
|
+
executionId: string;
|
|
965
|
+
bridgeKey: string;
|
|
966
|
+
workflowName: string;
|
|
967
|
+
runId: string;
|
|
968
|
+
nodeId: string;
|
|
969
|
+
iteration: number;
|
|
970
|
+
retries: number;
|
|
971
|
+
taskKind: WorkerTaskKind$1;
|
|
972
|
+
dispatchKind: WorkerDispatchKind$1;
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* @param {string} bridgeKey
|
|
977
|
+
* @param {string} workflowName
|
|
978
|
+
* @param {string} runId
|
|
979
|
+
* @param {_TaskDescriptor} desc
|
|
980
|
+
* @param {WorkerDispatchKind} dispatchKind
|
|
981
|
+
* @returns {WorkerTask}
|
|
982
|
+
*/
|
|
983
|
+
declare function makeWorkerTask(bridgeKey: string, workflowName: string, runId: string, desc: _TaskDescriptor$4, dispatchKind: WorkerDispatchKind): WorkerTask$1;
|
|
984
|
+
/**
|
|
985
|
+
* @param {TaskResult} result
|
|
986
|
+
* @returns {result is TaskFailure}
|
|
987
|
+
*/
|
|
988
|
+
declare function isTaskResultFailure(result: TaskResult): result is TaskFailure;
|
|
989
|
+
type WorkerTaskKind = WorkerTaskKind$1;
|
|
990
|
+
/** @typedef {import("@smithers-orchestrator/graph/TaskDescriptor").TaskDescriptor} _TaskDescriptor */
|
|
991
|
+
declare const WorkerTaskKind: Schema.Literal<["agent", "compute", "static"]>;
|
|
992
|
+
type WorkerDispatchKind = WorkerDispatchKind$1;
|
|
993
|
+
declare const WorkerDispatchKind: Schema.Literal<["compute", "static", "legacy"]>;
|
|
994
|
+
type WorkerTask$1 = WorkerTask$2;
|
|
995
|
+
declare const WorkerTask$1: Schema.Struct<{
|
|
996
|
+
executionId: typeof Schema.String;
|
|
997
|
+
bridgeKey: typeof Schema.String;
|
|
998
|
+
workflowName: typeof Schema.String;
|
|
999
|
+
runId: typeof Schema.String;
|
|
1000
|
+
nodeId: typeof Schema.String;
|
|
1001
|
+
iteration: typeof Schema.Number;
|
|
1002
|
+
retries: typeof Schema.Number;
|
|
1003
|
+
taskKind: Schema.Literal<["agent", "compute", "static"]>;
|
|
1004
|
+
dispatchKind: Schema.Literal<["compute", "static", "legacy"]>;
|
|
1005
|
+
}>;
|
|
1006
|
+
type TaskResult = TaskResult$1;
|
|
1007
|
+
declare const TaskResult: Schema.Union<[Schema.Struct<{
|
|
1008
|
+
_tag: Schema.Literal<["Success"]>;
|
|
1009
|
+
executionId: typeof Schema.String;
|
|
1010
|
+
terminal: typeof Schema.Boolean;
|
|
1011
|
+
}>, Schema.Struct<{
|
|
1012
|
+
_tag: Schema.Literal<["Failure"]>;
|
|
1013
|
+
executionId: typeof Schema.String;
|
|
1014
|
+
error: Schema.Union<[Schema.Union<[Schema.Struct<{
|
|
1015
|
+
_tag: Schema.Literal<["TaskAborted"]>;
|
|
1016
|
+
message: typeof Schema.String;
|
|
1017
|
+
details: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
1018
|
+
name: Schema.optional<typeof Schema.String>;
|
|
1019
|
+
}>, Schema.Struct<{
|
|
1020
|
+
_tag: Schema.Literal<["TaskTimeout"]>;
|
|
1021
|
+
message: typeof Schema.String;
|
|
1022
|
+
nodeId: typeof Schema.String;
|
|
1023
|
+
attempt: typeof Schema.Number;
|
|
1024
|
+
timeoutMs: typeof Schema.Number;
|
|
1025
|
+
}>, Schema.Struct<{
|
|
1026
|
+
_tag: Schema.Literal<["TaskHeartbeatTimeout"]>;
|
|
1027
|
+
message: typeof Schema.String;
|
|
1028
|
+
nodeId: typeof Schema.String;
|
|
1029
|
+
iteration: typeof Schema.Number;
|
|
1030
|
+
attempt: typeof Schema.Number;
|
|
1031
|
+
timeoutMs: typeof Schema.Number;
|
|
1032
|
+
staleForMs: typeof Schema.Number;
|
|
1033
|
+
lastHeartbeatAtMs: typeof Schema.Number;
|
|
1034
|
+
}>, Schema.Struct<{
|
|
1035
|
+
_tag: Schema.Literal<["RunNotFound"]>;
|
|
1036
|
+
message: typeof Schema.String;
|
|
1037
|
+
runId: typeof Schema.String;
|
|
1038
|
+
}>, Schema.Struct<{
|
|
1039
|
+
_tag: Schema.Literal<["InvalidInput"]>;
|
|
1040
|
+
message: typeof Schema.String;
|
|
1041
|
+
details: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
1042
|
+
}>, Schema.Struct<{
|
|
1043
|
+
_tag: Schema.Literal<["DbWriteFailed"]>;
|
|
1044
|
+
message: typeof Schema.String;
|
|
1045
|
+
details: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
1046
|
+
}>, Schema.Struct<{
|
|
1047
|
+
_tag: Schema.Literal<["AgentCliError"]>;
|
|
1048
|
+
message: typeof Schema.String;
|
|
1049
|
+
details: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
1050
|
+
}>, Schema.Struct<{
|
|
1051
|
+
_tag: Schema.Literal<["WorkflowFailed"]>;
|
|
1052
|
+
message: typeof Schema.String;
|
|
1053
|
+
details: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
1054
|
+
status: Schema.optional<typeof Schema.Number>;
|
|
1055
|
+
}>]>, Schema.Struct<{
|
|
1056
|
+
_tag: Schema.Literal<["UnknownWorkerError"]>;
|
|
1057
|
+
errorId: typeof Schema.String;
|
|
1058
|
+
message: typeof Schema.String;
|
|
1059
|
+
}>]>;
|
|
1060
|
+
}>]>;
|
|
1061
|
+
declare const TaskWorkerEntity: any;
|
|
1062
|
+
type TaskFailure = TaskFailure$1;
|
|
1063
|
+
type _TaskDescriptor$4 = _smithers_graph_TaskDescriptor.TaskDescriptor;
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* @param {WorkerTask} task
|
|
1067
|
+
* @param {() => Promise<WorkerExecutionResult>} execute
|
|
1068
|
+
* @returns {Promise<WorkerExecutionResult>}
|
|
1069
|
+
*/
|
|
1070
|
+
declare function dispatchWorkerTask(task: WorkerTask, execute: () => Promise<WorkerExecutionResult>): Promise<WorkerExecutionResult>;
|
|
1071
|
+
/**
|
|
1072
|
+
* @param {TaskWorkerDispatchSubscriber} subscriber
|
|
1073
|
+
* @returns {() => void}
|
|
1074
|
+
*/
|
|
1075
|
+
declare function subscribeTaskWorkerDispatches(subscriber: TaskWorkerDispatchSubscriber): () => void;
|
|
1076
|
+
type TaskWorkerDispatchSubscriber = (task: WorkerTask) => void;
|
|
1077
|
+
type WorkerExecutionResult = {
|
|
1078
|
+
terminal: boolean;
|
|
1079
|
+
};
|
|
1080
|
+
type WorkerTask = WorkerTask$2;
|
|
1081
|
+
|
|
1082
|
+
declare function executeTaskBridge(adapter: SmithersDb, db: _BunSQLiteDatabase$1, runId: string, desc: _TaskDescriptor$3, descriptorMap: Map<string, _TaskDescriptor$3>, inputTable: SQLiteTable, eventBus: EventBus, toolConfig: TaskBridgeToolConfig, workflowName: string, cacheEnabled: boolean, signal?: AbortSignal, disabledAgents?: Set<string>, runAbortController?: AbortController, hijackState?: HijackState, legacyExecuteTaskFn?: LegacyExecuteTaskFn): Promise<void>;
|
|
1083
|
+
declare function executeTaskBridgeEffect(adapter: SmithersDb, db: _BunSQLiteDatabase$1, runId: string, desc: _TaskDescriptor$3, descriptorMap: Map<string, _TaskDescriptor$3>, inputTable: SQLiteTable, eventBus: EventBus, toolConfig: TaskBridgeToolConfig, workflowName: string, cacheEnabled: boolean, signal?: AbortSignal, disabledAgents?: Set<string>, runAbortController?: AbortController, hijackState?: HijackState, legacyExecuteTaskFn?: LegacyExecuteTaskFn): Effect.Effect<void, _smithers_errors_SmithersError.SmithersError, never>;
|
|
1084
|
+
type HijackState = HijackState$1;
|
|
1085
|
+
type LegacyExecuteTaskFn = LegacyExecuteTaskFn$1;
|
|
1086
|
+
type TaskBridgeToolConfig = TaskBridgeToolConfig$1;
|
|
1087
|
+
type _TaskDescriptor$3 = _smithers_graph_TaskDescriptor.TaskDescriptor;
|
|
1088
|
+
type _TaskActivityContext = TaskActivityContext$1;
|
|
1089
|
+
type _BunSQLiteDatabase$1 = drizzle_orm_bun_sqlite.BunSQLiteDatabase<Record<string, unknown>>;
|
|
1090
|
+
type SQLiteTable = drizzle_orm_sqlite_core.SQLiteTable;
|
|
1091
|
+
type BridgeManagedTaskKind = "compute" | "static" | "legacy";
|
|
1092
|
+
|
|
1093
|
+
type TaskActivityRetryOptions$1 = {
|
|
1094
|
+
times: number;
|
|
1095
|
+
while?: (error: unknown) => boolean;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
type ExecuteTaskActivityOptions$1 = {
|
|
1099
|
+
initialAttempt?: number;
|
|
1100
|
+
retry?: false | TaskActivityRetryOptions$1;
|
|
1101
|
+
includeAttemptInIdempotencyKey?: boolean;
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1104
|
+
declare class RetriableTaskFailure extends Error {
|
|
1105
|
+
/**
|
|
1106
|
+
* @param {string} nodeId
|
|
1107
|
+
* @param {number} attempt
|
|
1108
|
+
*/
|
|
1109
|
+
constructor(nodeId: string, attempt: number);
|
|
1110
|
+
nodeId: string;
|
|
1111
|
+
attempt: number;
|
|
1112
|
+
}
|
|
1113
|
+
declare function makeTaskBridgeKey(adapter: _SmithersDb$2, workflowName: string, runId: string, desc: _TaskDescriptor$2): string;
|
|
1114
|
+
declare function makeTaskActivity<A>(desc: _TaskDescriptor$2, executeFn: (context: TaskActivityContext) => Promise<A> | A, options?: Pick<ExecuteTaskActivityOptions, "includeAttemptInIdempotencyKey">): any;
|
|
1115
|
+
declare function executeTaskActivity<A>(adapter: _SmithersDb$2, workflowName: string, runId: string, desc: _TaskDescriptor$2, executeFn: (context: TaskActivityContext) => Promise<A> | A, options?: ExecuteTaskActivityOptions): Promise<A>;
|
|
1116
|
+
type TaskActivityRetryOptions = TaskActivityRetryOptions$1;
|
|
1117
|
+
type ExecuteTaskActivityOptions = ExecuteTaskActivityOptions$1;
|
|
1118
|
+
type TaskActivityContext = TaskActivityContext$1;
|
|
1119
|
+
type _SmithersDb$2 = _smithers_db_adapter.SmithersDb;
|
|
1120
|
+
type _TaskDescriptor$2 = _smithers_graph_TaskDescriptor.TaskDescriptor;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* @returns {TaskAborted}
|
|
1124
|
+
*/
|
|
1125
|
+
declare function makeAbortError(message?: string): TaskAborted;
|
|
1126
|
+
/**
|
|
1127
|
+
* @param {AbortController} controller
|
|
1128
|
+
* @param {AbortSignal} [signal]
|
|
1129
|
+
*/
|
|
1130
|
+
declare function wireAbortSignal(controller: AbortController, signal?: AbortSignal): () => void;
|
|
1131
|
+
/**
|
|
1132
|
+
* @param {string | null} [metaJson]
|
|
1133
|
+
* @returns {Record<string, unknown>}
|
|
1134
|
+
*/
|
|
1135
|
+
declare function parseAttemptMetaJson(metaJson?: string | null): Record<string, unknown>;
|
|
1136
|
+
|
|
1137
|
+
type SmithersSqliteOptions$1 = {
|
|
1138
|
+
filename: string;
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
type AnySchema$1 = Schema.Schema<unknown, unknown, never>;
|
|
1142
|
+
type AnyEffect = unknown | Promise<unknown> | Effect.Effect<unknown, unknown, unknown>;
|
|
1143
|
+
type BuilderStepContext$1 = Record<string, unknown> & {
|
|
1144
|
+
input: unknown;
|
|
1145
|
+
executionId: string;
|
|
1146
|
+
stepId: string;
|
|
1147
|
+
attempt: number;
|
|
1148
|
+
signal: AbortSignal;
|
|
1149
|
+
iteration: number;
|
|
1150
|
+
heartbeat: (data?: unknown) => void;
|
|
1151
|
+
lastHeartbeat: unknown | null;
|
|
1152
|
+
};
|
|
1153
|
+
type ApprovalOptions$1 = {
|
|
1154
|
+
needs?: Record<string, BuilderStepHandle$1>;
|
|
1155
|
+
request: (ctx: Record<string, unknown>) => {
|
|
1156
|
+
title: string;
|
|
1157
|
+
summary?: string | null;
|
|
1158
|
+
};
|
|
1159
|
+
onDeny?: "fail" | "continue" | "skip";
|
|
1160
|
+
};
|
|
1161
|
+
type BuilderStepHandle$1 = {
|
|
1162
|
+
kind: "step" | "approval";
|
|
1163
|
+
id: string;
|
|
1164
|
+
localId: string;
|
|
1165
|
+
tableKey: string;
|
|
1166
|
+
tableName: string;
|
|
1167
|
+
table: SQLiteTable$1;
|
|
1168
|
+
output: AnySchema$1;
|
|
1169
|
+
needs: Record<string, BuilderStepHandle$1>;
|
|
1170
|
+
run?: (ctx: BuilderStepContext$1) => AnyEffect;
|
|
1171
|
+
request?: ApprovalOptions$1["request"];
|
|
1172
|
+
onDeny?: "fail" | "continue" | "skip";
|
|
1173
|
+
retries: number;
|
|
1174
|
+
retryPolicy?: RetryPolicy$1;
|
|
1175
|
+
timeoutMs: number | null;
|
|
1176
|
+
skipIf?: (ctx: BuilderStepContext$1) => boolean;
|
|
1177
|
+
loopId?: string;
|
|
1178
|
+
cache?: CachePolicy;
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
type SequenceNode = {
|
|
1182
|
+
kind: "sequence";
|
|
1183
|
+
children: BuilderNode$1[];
|
|
1184
|
+
};
|
|
1185
|
+
type ParallelNode = {
|
|
1186
|
+
kind: "parallel";
|
|
1187
|
+
children: BuilderNode$1[];
|
|
1188
|
+
maxConcurrency?: number;
|
|
1189
|
+
};
|
|
1190
|
+
type LoopNode = {
|
|
1191
|
+
kind: "loop";
|
|
1192
|
+
id?: string;
|
|
1193
|
+
children: BuilderNode$1;
|
|
1194
|
+
until: (outputs: Record<string, unknown>) => boolean;
|
|
1195
|
+
maxIterations?: number;
|
|
1196
|
+
onMaxReached?: "fail" | "return-last";
|
|
1197
|
+
handles?: BuilderStepHandle$1[];
|
|
1198
|
+
};
|
|
1199
|
+
type MatchNode = {
|
|
1200
|
+
kind: "match";
|
|
1201
|
+
source: BuilderStepHandle$1;
|
|
1202
|
+
when: (value: unknown) => boolean;
|
|
1203
|
+
then: BuilderNode$1;
|
|
1204
|
+
else?: BuilderNode$1;
|
|
1205
|
+
};
|
|
1206
|
+
type BranchNode = {
|
|
1207
|
+
kind: "branch";
|
|
1208
|
+
condition: (ctx: Record<string, unknown>) => boolean;
|
|
1209
|
+
needs?: Record<string, BuilderStepHandle$1>;
|
|
1210
|
+
then: BuilderNode$1;
|
|
1211
|
+
else?: BuilderNode$1;
|
|
1212
|
+
};
|
|
1213
|
+
type WorktreeNode = {
|
|
1214
|
+
kind: "worktree";
|
|
1215
|
+
id?: string;
|
|
1216
|
+
path: string;
|
|
1217
|
+
branch?: string;
|
|
1218
|
+
skipIf?: (ctx: Record<string, unknown>) => boolean;
|
|
1219
|
+
needs?: Record<string, BuilderStepHandle$1>;
|
|
1220
|
+
children: BuilderNode$1;
|
|
1221
|
+
};
|
|
1222
|
+
type BuilderNode$1 = BuilderStepHandle$1 | SequenceNode | ParallelNode | LoopNode | MatchNode | BranchNode | WorktreeNode;
|
|
1223
|
+
|
|
1224
|
+
/** @type {{ sqlite: typeof sqlite }} */
|
|
1225
|
+
declare const Smithers: {
|
|
1226
|
+
sqlite: typeof sqlite;
|
|
1227
|
+
};
|
|
1228
|
+
type AnySchema = effect.Schema.Schema<unknown, unknown, never>;
|
|
1229
|
+
type ApprovalOptions = {
|
|
1230
|
+
needs?: Record<string, BuilderStepHandle>;
|
|
1231
|
+
request: (ctx: Record<string, unknown>) => {
|
|
1232
|
+
title: string;
|
|
1233
|
+
summary?: string | null;
|
|
1234
|
+
};
|
|
1235
|
+
onDeny?: "fail" | "continue" | "skip";
|
|
1236
|
+
};
|
|
1237
|
+
type BuilderNode = BuilderNode$1;
|
|
1238
|
+
type BuilderStepContext = Record<string, unknown> & {
|
|
1239
|
+
input: unknown;
|
|
1240
|
+
executionId: string;
|
|
1241
|
+
stepId: string;
|
|
1242
|
+
attempt: number;
|
|
1243
|
+
signal: AbortSignal;
|
|
1244
|
+
iteration: number;
|
|
1245
|
+
heartbeat: (data?: unknown) => void;
|
|
1246
|
+
lastHeartbeat: unknown | null;
|
|
1247
|
+
};
|
|
1248
|
+
type BuilderStepHandle = BuilderStepHandle$1;
|
|
1249
|
+
type RetryPolicy = _smithers_scheduler_RetryPolicy.RetryPolicy;
|
|
1250
|
+
type SmithersSqliteOptions = SmithersSqliteOptions$1;
|
|
1251
|
+
/**
|
|
1252
|
+
* @param {SmithersSqliteOptions} options
|
|
1253
|
+
*/
|
|
1254
|
+
declare function sqlite(options: SmithersSqliteOptions): Layer.Layer<any, never, never>;
|
|
1255
|
+
|
|
1256
|
+
declare function canExecuteBridgeManagedComputeTask(desc: _TaskDescriptor$1, cacheEnabled: boolean): boolean;
|
|
1257
|
+
declare function executeComputeTaskBridge(adapter: _SmithersDb$1, db: _BunSQLiteDatabase, runId: string, desc: _TaskDescriptor$1, eventBus: EventBus, toolConfig: ComputeTaskBridgeToolConfig, workflowName: string, signal?: AbortSignal): Promise<void>;
|
|
1258
|
+
type ComputeTaskBridgeToolConfig = {
|
|
1259
|
+
rootDir: string;
|
|
1260
|
+
};
|
|
1261
|
+
type _SmithersDb$1 = _smithers_db_adapter.SmithersDb;
|
|
1262
|
+
type _TaskDescriptor$1 = _smithers_graph_TaskDescriptor.TaskDescriptor;
|
|
1263
|
+
type _BunSQLiteDatabase = drizzle_orm_bun_sqlite.BunSQLiteDatabase<Record<string, unknown>>;
|
|
1264
|
+
|
|
1265
|
+
type FilePatch$1 = {
|
|
1266
|
+
path: string;
|
|
1267
|
+
operation: "add" | "modify" | "delete";
|
|
1268
|
+
diff: string;
|
|
1269
|
+
binaryContent?: string;
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
type DiffBundle$1 = {
|
|
1273
|
+
seq: number;
|
|
1274
|
+
baseRef: string;
|
|
1275
|
+
patches: FilePatch$1[];
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Compute a diff bundle strictly between two immutable refs.
|
|
1280
|
+
*
|
|
1281
|
+
* Unlike {@link computeDiffBundle}, this variant does NOT read the working
|
|
1282
|
+
* tree or untracked files. It is the preferred entry point for historical
|
|
1283
|
+
* diffs (e.g. the `getNodeDiff` RPC) because it is read-only and cannot be
|
|
1284
|
+
* contaminated by concurrent runs mutating the checkout.
|
|
1285
|
+
*
|
|
1286
|
+
* @param {string} baseRef
|
|
1287
|
+
* @param {string} targetRef
|
|
1288
|
+
* @param {string} currentDir
|
|
1289
|
+
* @param {number} [seq]
|
|
1290
|
+
* @returns {Promise<DiffBundle>}
|
|
1291
|
+
*/
|
|
1292
|
+
declare function computeDiffBundleBetweenRefs(baseRef: string, targetRef: string, currentDir: string, seq?: number): Promise<DiffBundle>;
|
|
1293
|
+
/**
|
|
1294
|
+
* @param {string} baseRef
|
|
1295
|
+
* @param {string} currentDir
|
|
1296
|
+
* @returns {Promise<DiffBundle>}
|
|
1297
|
+
*/
|
|
1298
|
+
declare function computeDiffBundle(baseRef: string, currentDir: string, seq?: number): Promise<DiffBundle>;
|
|
1299
|
+
/**
|
|
1300
|
+
* @param {DiffBundle} bundle
|
|
1301
|
+
* @param {string} targetDir
|
|
1302
|
+
* @returns {Promise<void>}
|
|
1303
|
+
*/
|
|
1304
|
+
declare function applyDiffBundle(bundle: DiffBundle, targetDir: string): Promise<void>;
|
|
1305
|
+
type DiffBundle = DiffBundle$1;
|
|
1306
|
+
type FilePatch = FilePatch$1;
|
|
1307
|
+
|
|
1308
|
+
type SignalResult$1 = {
|
|
1309
|
+
runId: string;
|
|
1310
|
+
signalName: string;
|
|
1311
|
+
delivered: boolean;
|
|
1312
|
+
status: "signalled" | "ignored";
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
type SignalPayload$1 = {
|
|
1316
|
+
runId: string;
|
|
1317
|
+
signalName: string;
|
|
1318
|
+
data?: unknown;
|
|
1319
|
+
correlationId?: string;
|
|
1320
|
+
sentBy?: string;
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
type RunStatusSchema$1 = "running" | "waiting-approval" | "waiting-event" | "waiting-timer" | "finished" | "continued" | "failed" | "cancelled";
|
|
1324
|
+
|
|
1325
|
+
type RunSummary$1 = {
|
|
1326
|
+
runId: string;
|
|
1327
|
+
parentRunId: string | null;
|
|
1328
|
+
workflowName: string;
|
|
1329
|
+
workflowPath: string | null;
|
|
1330
|
+
workflowHash: string | null;
|
|
1331
|
+
status: RunStatusSchema$1;
|
|
1332
|
+
createdAtMs: number;
|
|
1333
|
+
startedAtMs: number | null;
|
|
1334
|
+
finishedAtMs: number | null;
|
|
1335
|
+
heartbeatAtMs: number | null;
|
|
1336
|
+
runtimeOwnerId: string | null;
|
|
1337
|
+
cancelRequestedAtMs: number | null;
|
|
1338
|
+
hijackRequestedAtMs: number | null;
|
|
1339
|
+
hijackTarget: string | null;
|
|
1340
|
+
vcsType: string | null;
|
|
1341
|
+
vcsRoot: string | null;
|
|
1342
|
+
vcsRevision: string | null;
|
|
1343
|
+
errorJson: string | null;
|
|
1344
|
+
configJson: string | null;
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
type ListRunsPayload$1 = {
|
|
1348
|
+
limit?: number;
|
|
1349
|
+
status?: RunStatusSchema$1;
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
type GetRunResult$1 = RunSummary$1 | null;
|
|
1353
|
+
|
|
1354
|
+
type GetRunPayload$1 = {
|
|
1355
|
+
runId: string;
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
type CancelResult$1 = {
|
|
1359
|
+
runId: string;
|
|
1360
|
+
status: "cancelling" | "cancelled";
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1363
|
+
type CancelPayload$1 = {
|
|
1364
|
+
runId: string;
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
type ApprovalResult$1 = {
|
|
1368
|
+
runId: string;
|
|
1369
|
+
nodeId: string;
|
|
1370
|
+
iteration: number;
|
|
1371
|
+
approved: boolean;
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
type ApprovalPayload$1 = {
|
|
1375
|
+
runId: string;
|
|
1376
|
+
nodeId: string;
|
|
1377
|
+
iteration?: number;
|
|
1378
|
+
note?: string;
|
|
1379
|
+
decidedBy?: string;
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
type RunStatusSchema = RunStatusSchema$1;
|
|
1383
|
+
declare const RunStatusSchema: Schema.Literal<["running", "waiting-approval", "waiting-event", "waiting-timer", "finished", "continued", "failed", "cancelled"]>;
|
|
1384
|
+
declare const ApprovalPayloadSchema: Schema.Struct<{
|
|
1385
|
+
runId: typeof Schema.String;
|
|
1386
|
+
nodeId: typeof Schema.String;
|
|
1387
|
+
iteration: Schema.optional<typeof Schema.Number>;
|
|
1388
|
+
note: Schema.optional<typeof Schema.String>;
|
|
1389
|
+
decidedBy: Schema.optional<typeof Schema.String>;
|
|
1390
|
+
}>;
|
|
1391
|
+
declare const ApprovalResultSchema: Schema.Struct<{
|
|
1392
|
+
runId: typeof Schema.String;
|
|
1393
|
+
nodeId: typeof Schema.String;
|
|
1394
|
+
iteration: typeof Schema.Number;
|
|
1395
|
+
approved: typeof Schema.Boolean;
|
|
1396
|
+
}>;
|
|
1397
|
+
declare const CancelPayloadSchema: Schema.Struct<{
|
|
1398
|
+
runId: typeof Schema.String;
|
|
1399
|
+
}>;
|
|
1400
|
+
declare const CancelResultSchema: Schema.Struct<{
|
|
1401
|
+
runId: typeof Schema.String;
|
|
1402
|
+
status: Schema.Literal<["cancelling", "cancelled"]>;
|
|
1403
|
+
}>;
|
|
1404
|
+
declare const SignalPayloadSchema: Schema.Struct<{
|
|
1405
|
+
runId: typeof Schema.String;
|
|
1406
|
+
signalName: typeof Schema.String;
|
|
1407
|
+
data: Schema.optional<typeof Schema.Unknown>;
|
|
1408
|
+
correlationId: Schema.optional<typeof Schema.String>;
|
|
1409
|
+
sentBy: Schema.optional<typeof Schema.String>;
|
|
1410
|
+
}>;
|
|
1411
|
+
declare const SignalResultSchema: Schema.Struct<{
|
|
1412
|
+
runId: typeof Schema.String;
|
|
1413
|
+
signalName: typeof Schema.String;
|
|
1414
|
+
delivered: typeof Schema.Boolean;
|
|
1415
|
+
status: Schema.Literal<["signalled", "ignored"]>;
|
|
1416
|
+
}>;
|
|
1417
|
+
declare const ListRunsPayloadSchema: Schema.Struct<{
|
|
1418
|
+
limit: Schema.optional<typeof Schema.Number>;
|
|
1419
|
+
status: Schema.optional<Schema.Literal<["running", "waiting-approval", "waiting-event", "waiting-timer", "finished", "continued", "failed", "cancelled"]>>;
|
|
1420
|
+
}>;
|
|
1421
|
+
declare const RunSummarySchema: Schema.Struct<{
|
|
1422
|
+
runId: typeof Schema.String;
|
|
1423
|
+
parentRunId: Schema.NullOr<typeof Schema.String>;
|
|
1424
|
+
workflowName: typeof Schema.String;
|
|
1425
|
+
workflowPath: Schema.NullOr<typeof Schema.String>;
|
|
1426
|
+
workflowHash: Schema.NullOr<typeof Schema.String>;
|
|
1427
|
+
status: Schema.Literal<["running", "waiting-approval", "waiting-event", "waiting-timer", "finished", "continued", "failed", "cancelled"]>;
|
|
1428
|
+
createdAtMs: typeof Schema.Number;
|
|
1429
|
+
startedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1430
|
+
finishedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1431
|
+
heartbeatAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1432
|
+
runtimeOwnerId: Schema.NullOr<typeof Schema.String>;
|
|
1433
|
+
cancelRequestedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1434
|
+
hijackRequestedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1435
|
+
hijackTarget: Schema.NullOr<typeof Schema.String>;
|
|
1436
|
+
vcsType: Schema.NullOr<typeof Schema.String>;
|
|
1437
|
+
vcsRoot: Schema.NullOr<typeof Schema.String>;
|
|
1438
|
+
vcsRevision: Schema.NullOr<typeof Schema.String>;
|
|
1439
|
+
errorJson: Schema.NullOr<typeof Schema.String>;
|
|
1440
|
+
configJson: Schema.NullOr<typeof Schema.String>;
|
|
1441
|
+
}>;
|
|
1442
|
+
declare const GetRunPayloadSchema: Schema.Struct<{
|
|
1443
|
+
runId: typeof Schema.String;
|
|
1444
|
+
}>;
|
|
1445
|
+
declare const GetRunResultSchema: Schema.NullOr<Schema.Struct<{
|
|
1446
|
+
runId: typeof Schema.String;
|
|
1447
|
+
parentRunId: Schema.NullOr<typeof Schema.String>;
|
|
1448
|
+
workflowName: typeof Schema.String;
|
|
1449
|
+
workflowPath: Schema.NullOr<typeof Schema.String>;
|
|
1450
|
+
workflowHash: Schema.NullOr<typeof Schema.String>;
|
|
1451
|
+
status: Schema.Literal<["running", "waiting-approval", "waiting-event", "waiting-timer", "finished", "continued", "failed", "cancelled"]>;
|
|
1452
|
+
createdAtMs: typeof Schema.Number;
|
|
1453
|
+
startedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1454
|
+
finishedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1455
|
+
heartbeatAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1456
|
+
runtimeOwnerId: Schema.NullOr<typeof Schema.String>;
|
|
1457
|
+
cancelRequestedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1458
|
+
hijackRequestedAtMs: Schema.NullOr<typeof Schema.Number>;
|
|
1459
|
+
hijackTarget: Schema.NullOr<typeof Schema.String>;
|
|
1460
|
+
vcsType: Schema.NullOr<typeof Schema.String>;
|
|
1461
|
+
vcsRoot: Schema.NullOr<typeof Schema.String>;
|
|
1462
|
+
vcsRevision: Schema.NullOr<typeof Schema.String>;
|
|
1463
|
+
errorJson: Schema.NullOr<typeof Schema.String>;
|
|
1464
|
+
configJson: Schema.NullOr<typeof Schema.String>;
|
|
1465
|
+
}>>;
|
|
1466
|
+
declare const approve: any;
|
|
1467
|
+
declare const cancel: any;
|
|
1468
|
+
declare const signal: any;
|
|
1469
|
+
declare const listRuns: any;
|
|
1470
|
+
declare const getRun: any;
|
|
1471
|
+
declare const SmithersRpcGroup: any;
|
|
1472
|
+
type ApprovalPayload = ApprovalPayload$1;
|
|
1473
|
+
type ApprovalResult = ApprovalResult$1;
|
|
1474
|
+
type CancelPayload = CancelPayload$1;
|
|
1475
|
+
type CancelResult = CancelResult$1;
|
|
1476
|
+
type GetRunPayload = GetRunPayload$1;
|
|
1477
|
+
type GetRunResult = GetRunResult$1;
|
|
1478
|
+
type ListRunsPayload = ListRunsPayload$1;
|
|
1479
|
+
type RunSummary = RunSummary$1;
|
|
1480
|
+
type SignalPayload = SignalPayload$1;
|
|
1481
|
+
type SignalResult = SignalResult$1;
|
|
1482
|
+
|
|
1483
|
+
declare function canExecuteBridgeManagedStaticTask(desc: _TaskDescriptor, cacheEnabled: boolean): boolean;
|
|
1484
|
+
declare function executeStaticTaskBridge(adapter: _SmithersDb, runId: string, desc: _TaskDescriptor, eventBus: EventBus, toolConfig: StaticTaskBridgeToolConfig, workflowName: string, signal?: AbortSignal): Promise<void>;
|
|
1485
|
+
type _SmithersDb = _smithers_db_adapter.SmithersDb;
|
|
1486
|
+
type StaticTaskBridgeToolConfig = {
|
|
1487
|
+
rootDir: string;
|
|
1488
|
+
};
|
|
1489
|
+
type _TaskDescriptor = _smithers_graph_TaskDescriptor.TaskDescriptor;
|
|
1490
|
+
|
|
1491
|
+
type WorkflowPatchDecisions$1 = Record<string, boolean>;
|
|
1492
|
+
|
|
1493
|
+
type WorkflowVersioningRuntime$1 = {
|
|
1494
|
+
resolve(patchId: string): boolean;
|
|
1495
|
+
flush(): Promise<void>;
|
|
1496
|
+
snapshot(): WorkflowPatchDecisions$1;
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
type WorkflowPatchDecisionRecord$1 = {
|
|
1500
|
+
patchId: string;
|
|
1501
|
+
decision: boolean;
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* @param {WorkflowVersioningRuntimeOptions} options
|
|
1506
|
+
* @returns {WorkflowVersioningRuntime}
|
|
1507
|
+
*/
|
|
1508
|
+
declare function createWorkflowVersioningRuntime(options: WorkflowVersioningRuntimeOptions): WorkflowVersioningRuntime;
|
|
1509
|
+
/**
|
|
1510
|
+
* @template T
|
|
1511
|
+
* @param {WorkflowVersioningRuntime} runtime
|
|
1512
|
+
* @param {() => T} execute
|
|
1513
|
+
* @returns {T}
|
|
1514
|
+
*/
|
|
1515
|
+
declare function withWorkflowVersioningRuntime<T>(runtime: WorkflowVersioningRuntime, execute: () => T): T;
|
|
1516
|
+
/**
|
|
1517
|
+
* @returns {| WorkflowVersioningRuntime | undefined}
|
|
1518
|
+
*/
|
|
1519
|
+
declare function getWorkflowVersioningRuntime(): WorkflowVersioningRuntime | undefined;
|
|
1520
|
+
/**
|
|
1521
|
+
* @param {Record<string, unknown> | null | undefined} config
|
|
1522
|
+
* @returns {WorkflowPatchDecisions}
|
|
1523
|
+
*/
|
|
1524
|
+
declare function getWorkflowPatchDecisions(config: Record<string, unknown> | null | undefined): WorkflowPatchDecisions;
|
|
1525
|
+
/**
|
|
1526
|
+
* @param {string} patchId
|
|
1527
|
+
* @returns {boolean}
|
|
1528
|
+
*/
|
|
1529
|
+
declare function usePatched(patchId: string): boolean;
|
|
1530
|
+
type WorkflowPatchDecisionRecord = WorkflowPatchDecisionRecord$1;
|
|
1531
|
+
type WorkflowPatchDecisions = WorkflowPatchDecisions$1;
|
|
1532
|
+
type WorkflowVersioningRuntime = WorkflowVersioningRuntime$1;
|
|
1533
|
+
type WorkflowVersioningRuntimeOptions = {
|
|
1534
|
+
baseConfig: Record<string, unknown>;
|
|
1535
|
+
initialDecisions?: WorkflowPatchDecisions;
|
|
1536
|
+
isNewRun: boolean;
|
|
1537
|
+
persist: (config: Record<string, unknown>) => Promise<void>;
|
|
1538
|
+
recordDecision?: (record: WorkflowPatchDecisionRecord) => Promise<void>;
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* @typedef {Record<string, any>} JsonSchema
|
|
1543
|
+
*/
|
|
1544
|
+
/**
|
|
1545
|
+
* Convert a JSON Schema to a Zod object schema.
|
|
1546
|
+
*
|
|
1547
|
+
* @param {JsonSchema} rootSchema
|
|
1548
|
+
* @returns {z.ZodObject<any>}
|
|
1549
|
+
*/
|
|
1550
|
+
declare function jsonSchemaToZod(rootSchema: JsonSchema): z.ZodObject<any>;
|
|
1551
|
+
type JsonSchema = Record<string, any>;
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
* @param {{ status?: string | null; heartbeatAtMs?: number | null } | null | undefined} run
|
|
1555
|
+
* @returns {boolean}
|
|
1556
|
+
*/
|
|
1557
|
+
declare function isRunHeartbeatFresh(run: {
|
|
1558
|
+
status?: string | null;
|
|
1559
|
+
heartbeatAtMs?: number | null;
|
|
1560
|
+
} | null | undefined, now?: number): boolean;
|
|
1561
|
+
/**
|
|
1562
|
+
* @param {{ _?: { fullSchema?: Record<string, unknown>; schema?: Record<string, unknown> }; schema?: Record<string, unknown> }} db
|
|
1563
|
+
* @returns {Record<string, unknown>}
|
|
1564
|
+
*/
|
|
1565
|
+
declare function resolveSchema(db: {
|
|
1566
|
+
_?: {
|
|
1567
|
+
fullSchema?: Record<string, unknown>;
|
|
1568
|
+
schema?: Record<string, unknown>;
|
|
1569
|
+
};
|
|
1570
|
+
schema?: Record<string, unknown>;
|
|
1571
|
+
}): Record<string, unknown>;
|
|
1572
|
+
/**
|
|
1573
|
+
* @template Schema
|
|
1574
|
+
* @param {SmithersWorkflow<Schema>} workflow
|
|
1575
|
+
* @param {SmithersCtx<unknown>} ctx
|
|
1576
|
+
* @param {{ baseRootDir?: string; workflowPath?: string | null }} [opts]
|
|
1577
|
+
* @returns {Effect.Effect<GraphSnapshot, SmithersError>}
|
|
1578
|
+
*/
|
|
1579
|
+
declare function renderFrame<Schema>(workflow: SmithersWorkflow<Schema>, ctx: SmithersCtx<unknown>, opts?: {
|
|
1580
|
+
baseRootDir?: string;
|
|
1581
|
+
workflowPath?: string | null;
|
|
1582
|
+
}): Effect.Effect<GraphSnapshot, SmithersError>;
|
|
1583
|
+
/**
|
|
1584
|
+
* @template Schema
|
|
1585
|
+
* @param {SmithersWorkflow<Schema>} workflow
|
|
1586
|
+
* @param {RunOptions} opts
|
|
1587
|
+
* @returns {Effect.Effect<RunResult, SmithersError>}
|
|
1588
|
+
*/
|
|
1589
|
+
declare function runWorkflow<Schema>(workflow: SmithersWorkflow<Schema>, opts: RunOptions): Effect.Effect<RunResult, SmithersError>;
|
|
1590
|
+
type GraphSnapshot = _smithers_graph_GraphSnapshot.GraphSnapshot;
|
|
1591
|
+
type RunOptions = _smithers_driver_RunOptions.RunOptions;
|
|
1592
|
+
type RunResult = _smithers_driver_RunResult.RunResult;
|
|
1593
|
+
type SmithersWorkflow = any;
|
|
1594
|
+
|
|
1595
|
+
type ChildWorkflowDefinition = ChildWorkflowDefinition$1;
|
|
1596
|
+
|
|
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 };
|