@swirls/looms 0.0.2 → 0.2.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/CHANGELOG.md +24 -2
- package/dist/actor/cell.d.ts +9 -4
- package/dist/actor/cell.js +7 -11
- package/dist/actor/host.d.ts +7 -3
- package/dist/actor/host.js +57 -33
- package/dist/actor/index.d.ts +1 -1
- package/dist/actor/index.js +1 -1
- package/dist/actor/routing.d.ts +12 -1
- package/dist/actor/routing.js +57 -51
- package/dist/agent/agent-session.d.ts +5 -0
- package/dist/agent/agent-session.js +270 -0
- package/dist/agent/debugger/agent-chat.d.ts +2 -0
- package/dist/agent/debugger/agent-chat.js +176 -0
- package/dist/agent/debugger/index.d.ts +5 -0
- package/dist/agent/debugger/index.js +19 -0
- package/dist/agent/debugger/summarize.d.ts +2 -0
- package/dist/agent/debugger/summarize.js +51 -0
- package/dist/agent/debugger/token-usage.d.ts +3 -0
- package/dist/agent/debugger/token-usage.js +11 -0
- package/dist/agent/definitions-store.d.ts +2 -3
- package/dist/agent/definitions-store.js +2 -4
- package/dist/agent/definitions.d.ts +47 -29
- package/dist/agent/definitions.js +39 -12
- package/dist/agent/effects.d.ts +359 -2
- package/dist/agent/effects.js +60 -34
- package/dist/agent/events.d.ts +175 -19
- package/dist/agent/events.js +45 -10
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +1 -0
- package/dist/agent/llm.d.ts +11 -2
- package/dist/agent/llm.js +13 -3
- package/dist/agent/module.d.ts +812 -78
- package/dist/agent/module.js +16 -4
- package/dist/agent/scope.d.ts +174 -18
- package/dist/agent/signals.d.ts +26 -1
- package/dist/agent/signals.js +79 -0
- package/dist/agent/threads.d.ts +3 -33
- package/dist/agent/threads.js +20 -25
- package/dist/agent/tool-schema.d.ts +1 -17
- package/dist/agent/tool-schema.js +3 -43
- package/dist/agent/types.d.ts +49 -4
- package/dist/agent/types.js +5 -5
- package/dist/ai-vercel/index.d.ts +1 -0
- package/dist/ai-vercel/index.js +1 -0
- package/dist/ai-vercel/messages.js +22 -7
- package/dist/ai-vercel/vercel-evaluator.d.ts +36 -0
- package/dist/ai-vercel/vercel-evaluator.js +73 -0
- package/dist/ai-vercel/vercel-llm.js +64 -44
- package/dist/approval/debugger/approvals-view.d.ts +3 -0
- package/dist/approval/debugger/approvals-view.js +16 -0
- package/dist/approval/debugger/index.d.ts +4 -0
- package/dist/approval/debugger/index.js +11 -0
- package/dist/approval/debugger/summarize.d.ts +2 -0
- package/dist/approval/debugger/summarize.js +17 -0
- package/dist/approval/effects.d.ts +89 -0
- package/dist/approval/module.d.ts +179 -29
- package/dist/approval/projections.d.ts +0 -14
- package/dist/approval/projections.js +20 -3
- package/dist/approval/signals.d.ts +2 -0
- package/dist/approval/signals.js +18 -2
- package/dist/cli/cli.js +2 -0
- package/dist/cli/commands.js +12 -16
- package/dist/client/client.d.ts +1213 -18
- package/dist/client/client.js +120 -120
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/sse.d.ts +13 -0
- package/dist/client/sse.js +38 -44
- package/dist/cloudflare/alarm-scheduler.d.ts +12 -2
- package/dist/cloudflare/alarm-scheduler.js +34 -7
- package/dist/cloudflare/durable-object.d.ts +10 -2
- package/dist/cloudflare/durable-object.js +59 -28
- package/dist/cloudflare/event-store.d.ts +7 -2
- package/dist/cloudflare/event-store.js +8 -7
- package/dist/cloudflare/index.d.ts +2 -2
- package/dist/cloudflare/index.js +2 -2
- package/dist/cloudflare/router.d.ts +1 -1
- package/dist/cloudflare/router.js +15 -16
- package/dist/core/catalog.d.ts +3 -3
- package/dist/core/catalog.js +2 -5
- package/dist/core/coalesce.js +5 -3
- package/dist/core/compose.d.ts +2 -1
- package/dist/core/compose.js +19 -2
- package/dist/core/debugger-host.d.ts +16 -0
- package/dist/core/debugger-host.js +1 -0
- package/dist/core/definition-store.d.ts +11 -0
- package/dist/core/definition-store.js +6 -0
- package/dist/core/effects.d.ts +127 -15
- package/dist/core/effects.js +89 -17
- package/dist/core/envelope.d.ts +27 -7
- package/dist/core/envelope.js +20 -6
- package/dist/core/event-codec.d.ts +4 -2
- package/dist/core/event-codec.js +10 -5
- package/dist/core/event-index.js +1 -3
- package/dist/core/fold.d.ts +3 -0
- package/dist/core/fold.js +171 -24
- package/dist/core/ids.d.ts +5 -0
- package/dist/core/ids.js +35 -2
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.js +6 -1
- package/dist/core/kind.d.ts +22 -0
- package/dist/core/kind.js +17 -0
- package/dist/core/limits.d.ts +34 -0
- package/dist/core/limits.js +46 -0
- package/dist/core/match.d.ts +1 -0
- package/dist/core/match.js +10 -1
- package/dist/core/module-scope.d.ts +22 -20
- package/dist/core/module-scope.js +38 -28
- package/dist/core/module.d.ts +18 -5
- package/dist/core/module.js +4 -0
- package/dist/core/projection.d.ts +13 -13
- package/dist/core/projection.js +9 -5
- package/dist/core/protocol.d.ts +68 -11
- package/dist/core/protocol.js +82 -11
- package/dist/core/published.d.ts +43 -0
- package/dist/core/published.js +44 -0
- package/dist/core/replay.d.ts +312 -3
- package/dist/core/replay.js +11 -1
- package/dist/core/schema.d.ts +11 -20
- package/dist/core/schema.js +63 -80
- package/dist/core/serialize.js +2 -4
- package/dist/core/snapshot-store.d.ts +6 -1
- package/dist/core/snapshot-store.js +15 -2
- package/dist/core/snapshots.d.ts +5 -1
- package/dist/core/snapshots.js +10 -15
- package/dist/core/sqlite-store.js +95 -11
- package/dist/core/state.d.ts +142 -4
- package/dist/core/state.js +78 -0
- package/dist/core/store.d.ts +38 -3
- package/dist/core/store.js +77 -22
- package/dist/core/thread.d.ts +10 -9
- package/dist/core/types.d.ts +5 -8
- package/dist/core/types.js +28 -24
- package/dist/core/validate-event.js +14 -4
- package/dist/core/worker-callback.d.ts +17 -0
- package/dist/core/worker-callback.js +1 -0
- package/dist/debugger/app/assets/index-B3Ah8WAE.css +2 -0
- package/dist/debugger/app/assets/index-Qb371t_O.js +22 -0
- package/dist/debugger/app/assets/rolldown-runtime-CbXtAM7H.js +1 -0
- package/dist/debugger/app/assets/routes-CjtEHgPQ.js +47 -0
- package/dist/debugger/app/index.html +14 -0
- package/dist/debugger/components/composer.d.ts +17 -0
- package/dist/debugger/components/composer.js +25 -0
- package/dist/debugger/components/debugger-split.d.ts +2 -1
- package/dist/debugger/components/debugger-split.js +2 -2
- package/dist/debugger/components/event-inspector.d.ts +2 -1
- package/dist/debugger/components/event-inspector.js +25 -16
- package/dist/debugger/components/event-stream.d.ts +2 -1
- package/dist/debugger/components/event-stream.js +14 -74
- package/dist/debugger/components/follow-list.d.ts +19 -0
- package/dist/debugger/components/follow-list.js +96 -0
- package/dist/debugger/components/json-tree.d.ts +11 -0
- package/dist/debugger/components/json-tree.js +120 -0
- package/dist/debugger/components/json-view.js +2 -2
- package/dist/debugger/components/run-tree.js +53 -20
- package/dist/debugger/components/status-dot.d.ts +4 -0
- package/dist/debugger/components/status-dot.js +6 -2
- package/dist/debugger/context.d.ts +14 -0
- package/dist/debugger/context.js +17 -0
- package/dist/debugger/contracts.d.ts +7 -4
- package/dist/debugger/events/builtin-families.d.ts +3 -0
- package/dist/debugger/events/builtin-families.js +9 -0
- package/dist/debugger/events/catalog.d.ts +3 -4
- package/dist/debugger/events/catalog.js +27 -17
- package/dist/debugger/events/protocol-summarize.d.ts +1 -2
- package/dist/debugger/events/protocol-summarize.js +42 -24
- package/dist/debugger/index.d.ts +20 -6
- package/dist/debugger/index.js +19 -5
- package/dist/debugger/lib/cn.d.ts +1 -0
- package/dist/debugger/lib/cn.js +3 -0
- package/dist/debugger/lib/event-meta.d.ts +2 -3
- package/dist/debugger/lib/event-meta.js +6 -12
- package/dist/debugger/lib/json.d.ts +25 -0
- package/dist/debugger/lib/json.js +87 -0
- package/dist/debugger/lib/payload.d.ts +7 -0
- package/dist/debugger/lib/payload.js +11 -0
- package/dist/debugger/lib/time.d.ts +3 -0
- package/dist/debugger/lib/time.js +24 -0
- package/dist/debugger/plugin.d.ts +36 -0
- package/dist/debugger/plugin.js +14 -0
- package/dist/debugger/server/index.d.ts +14 -0
- package/dist/debugger/server/index.js +114 -0
- package/dist/debugger/shell/debugger-shell.d.ts +15 -0
- package/dist/debugger/shell/debugger-shell.js +43 -0
- package/dist/debugger/shell/definition-key.d.ts +3 -0
- package/dist/debugger/shell/definition-key.js +4 -0
- package/dist/debugger/shell/events-pane.d.ts +12 -0
- package/dist/debugger/shell/events-pane.js +25 -0
- package/dist/debugger/shell/projections-panel.d.ts +4 -0
- package/dist/debugger/shell/projections-panel.js +59 -0
- package/dist/debugger/shell/run-controls.d.ts +4 -0
- package/dist/debugger/shell/run-controls.js +72 -0
- package/dist/debugger/shell/run-search.d.ts +6 -0
- package/dist/debugger/shell/run-search.js +102 -0
- package/dist/debugger/shell/run-type-menu.d.ts +6 -0
- package/dist/debugger/shell/run-type-menu.js +11 -0
- package/dist/debugger/shell/schema-form.d.ts +31 -0
- package/dist/debugger/shell/schema-form.js +117 -0
- package/dist/debugger/shell/start-form.d.ts +3 -0
- package/dist/debugger/shell/start-form.js +75 -0
- package/dist/debugger/shell/use-start-run.d.ts +14 -0
- package/dist/debugger/shell/use-start-run.js +32 -0
- package/dist/debugger/shell/workspace.d.ts +6 -0
- package/dist/debugger/shell/workspace.js +15 -0
- package/dist/debugger/styles.css +111 -27
- package/dist/debugger/ui/button.d.ts +24 -0
- package/dist/debugger/ui/button.js +24 -0
- package/dist/debugger/ui/command.d.ts +9 -0
- package/dist/debugger/ui/command.js +24 -0
- package/dist/debugger/ui/dropdown-menu.d.ts +13 -0
- package/dist/debugger/ui/dropdown-menu.js +37 -0
- package/dist/debugger/ui/panel.d.ts +14 -0
- package/dist/debugger/ui/panel.js +16 -0
- package/dist/debugger/ui/popover.d.ts +7 -0
- package/dist/debugger/ui/popover.js +17 -0
- package/dist/debugger/ui/resizable.d.ts +7 -0
- package/dist/debugger/ui/resizable.js +14 -0
- package/dist/debugger/ui/scroll-area.d.ts +2 -1
- package/dist/debugger/ui/scroll-area.js +5 -3
- package/dist/debugger/ui/select.d.ts +10 -0
- package/dist/debugger/ui/select.js +21 -0
- package/dist/debugger/ui/tabs.js +2 -2
- package/dist/debugger/ui/textarea.d.ts +3 -0
- package/dist/debugger/ui/textarea.js +7 -0
- package/dist/evaluator/definitions-store.d.ts +11 -0
- package/dist/evaluator/definitions-store.js +8 -0
- package/dist/evaluator/definitions.d.ts +18 -0
- package/dist/evaluator/definitions.js +4 -0
- package/dist/evaluator/effects.d.ts +226 -0
- package/dist/evaluator/effects.js +132 -0
- package/dist/evaluator/evaluator.d.ts +24 -0
- package/dist/evaluator/evaluator.js +67 -0
- package/dist/evaluator/events.d.ts +59 -0
- package/dist/evaluator/events.js +21 -0
- package/dist/evaluator/index.d.ts +11 -0
- package/dist/evaluator/index.js +11 -0
- package/dist/evaluator/module.d.ts +606 -0
- package/dist/evaluator/module.js +25 -0
- package/dist/evaluator/projections.d.ts +50 -0
- package/dist/evaluator/projections.js +20 -0
- package/dist/evaluator/scope.d.ts +59 -0
- package/dist/evaluator/scope.js +7 -0
- package/dist/evaluator/signals.d.ts +3 -0
- package/dist/evaluator/signals.js +17 -0
- package/dist/evaluator/threads.d.ts +62 -0
- package/dist/evaluator/threads.js +117 -0
- package/dist/evaluator/types.d.ts +125 -0
- package/dist/evaluator/types.js +51 -0
- package/dist/projectors/delivery.d.ts +83 -0
- package/dist/projectors/delivery.js +182 -0
- package/dist/projectors/index-model.d.ts +1 -1
- package/dist/projectors/index-model.js +4 -6
- package/dist/projectors/index.d.ts +2 -0
- package/dist/projectors/index.js +2 -0
- package/dist/projectors/memory.d.ts +1 -1
- package/dist/projectors/memory.js +10 -8
- package/dist/projectors/postgres.js +44 -58
- package/dist/projectors/projector.d.ts +17 -0
- package/dist/projectors/projector.js +26 -1
- package/dist/projectors/sqlite-delivery.d.ts +4 -0
- package/dist/projectors/sqlite-delivery.js +147 -0
- package/dist/projectors/sqlite.js +23 -23
- package/dist/projectors/with-projectors.d.ts +7 -2
- package/dist/projectors/with-projectors.js +27 -28
- package/dist/react/notify.js +11 -8
- package/dist/react/react.d.ts +2 -3
- package/dist/react/react.js +14 -30
- package/dist/react/sse.d.ts +1 -1
- package/dist/react/sse.js +1 -1
- package/dist/react/store.d.ts +3 -3
- package/dist/react/store.js +109 -119
- package/dist/runtime/cancellation.d.ts +16 -0
- package/dist/runtime/cancellation.js +129 -0
- package/dist/runtime/deadline-transition-planner.d.ts +31 -0
- package/dist/runtime/deadline-transition-planner.js +139 -0
- package/dist/runtime/dispatch-effect.d.ts +3 -2
- package/dist/runtime/dispatch-effect.js +7 -13
- package/dist/runtime/errors.d.ts +51 -0
- package/dist/runtime/errors.js +39 -0
- package/dist/runtime/{runtime-helpers.d.ts → helpers.d.ts} +24 -4
- package/dist/runtime/{runtime-helpers.js → helpers.js} +56 -19
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +3 -3
- package/dist/runtime/ingress.d.ts +15 -0
- package/dist/runtime/ingress.js +42 -0
- package/dist/runtime/local-effect-executor.d.ts +21 -0
- package/dist/runtime/local-effect-executor.js +137 -0
- package/dist/runtime/looms.d.ts +30 -4
- package/dist/runtime/looms.js +57 -37
- package/dist/runtime/observer.d.ts +45 -0
- package/dist/runtime/observer.js +11 -0
- package/dist/runtime/repository.d.ts +55 -0
- package/dist/runtime/repository.js +293 -0
- package/dist/runtime/retry-policy.d.ts +16 -0
- package/dist/runtime/retry-policy.js +29 -0
- package/dist/runtime/run-execution-context.d.ts +30 -0
- package/dist/runtime/run-execution-context.js +56 -0
- package/dist/runtime/run-start.d.ts +4 -0
- package/dist/runtime/run-start.js +44 -0
- package/dist/runtime/runtime.d.ts +6 -87
- package/dist/runtime/runtime.js +248 -470
- package/dist/runtime/server/auth.d.ts +41 -0
- package/dist/runtime/server/auth.js +45 -0
- package/dist/runtime/server/debugger-host.d.ts +11 -0
- package/dist/runtime/server/debugger-host.js +32 -0
- package/dist/runtime/server/fetch-handler.d.ts +18 -0
- package/dist/runtime/server/fetch-handler.js +62 -0
- package/dist/runtime/server/http.d.ts +38 -0
- package/dist/runtime/server/http.js +66 -0
- package/dist/runtime/server/route-table.d.ts +55 -0
- package/dist/runtime/server/route-table.js +74 -0
- package/dist/runtime/server/routes/definitions.d.ts +3 -0
- package/dist/runtime/server/routes/definitions.js +20 -0
- package/dist/runtime/server/routes/effects.d.ts +3 -0
- package/dist/runtime/server/routes/effects.js +59 -0
- package/dist/runtime/server/routes/operations.d.ts +3 -0
- package/dist/runtime/server/routes/operations.js +14 -0
- package/dist/runtime/server/routes/runs.d.ts +3 -0
- package/dist/runtime/server/routes/runs.js +199 -0
- package/dist/runtime/server.d.ts +4 -8
- package/dist/runtime/server.js +6 -211
- package/dist/runtime/sse.d.ts +2 -1
- package/dist/runtime/sse.js +24 -17
- package/dist/runtime/types.d.ts +117 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/wake-engine.d.ts +20 -0
- package/dist/runtime/wake-engine.js +311 -0
- package/dist/runtime/wake-scheduler.d.ts +3 -4
- package/dist/runtime/wake-scheduler.js +25 -31
- package/dist/runtime/worker-callbacks.d.ts +16 -0
- package/dist/runtime/worker-callbacks.js +167 -0
- package/dist/runtime/worker-effect-dispatch.d.ts +36 -0
- package/dist/runtime/worker-effect-dispatch.js +126 -0
- package/dist/s2/config.d.ts +1 -1
- package/dist/s2/config.js +1 -1
- package/dist/s2/lite.js +70 -82
- package/dist/s2/pagination.d.ts +15 -0
- package/dist/s2/pagination.js +36 -0
- package/dist/s2/projector.js +6 -5
- package/dist/s2/snapshot-store.js +188 -161
- package/dist/s2/store.d.ts +3 -21
- package/dist/s2/store.js +71 -165
- package/dist/testing/index.d.ts +15 -0
- package/dist/testing/index.js +53 -16
- package/dist/workflow/debugger/index.d.ts +4 -0
- package/dist/workflow/debugger/index.js +11 -0
- package/dist/workflow/debugger/nodes-view.d.ts +3 -0
- package/dist/workflow/debugger/nodes-view.js +13 -0
- package/dist/workflow/debugger/summarize.d.ts +2 -0
- package/dist/workflow/debugger/summarize.js +30 -0
- package/dist/workflow/definitions-store.d.ts +2 -3
- package/dist/workflow/definitions-store.js +2 -2
- package/dist/workflow/definitions.d.ts +78 -22
- package/dist/workflow/definitions.js +80 -14
- package/dist/workflow/effects.d.ts +453 -107
- package/dist/workflow/effects.js +214 -115
- package/dist/workflow/events.d.ts +149 -5
- package/dist/workflow/events.js +27 -5
- package/dist/workflow/graph.d.ts +56 -0
- package/dist/workflow/graph.js +207 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +1 -0
- package/dist/workflow/module.d.ts +1047 -266
- package/dist/workflow/projections.d.ts +14 -12
- package/dist/workflow/projections.js +30 -8
- package/dist/workflow/scope.d.ts +146 -4
- package/dist/workflow/threads.d.ts +383 -155
- package/dist/workflow/threads.js +308 -110
- package/package.json +26 -2
- package/dist/debugger/events/domain-summarize.d.ts +0 -3
- package/dist/debugger/events/domain-summarize.js +0 -107
- package/dist/debugger/events/family.d.ts +0 -8
- package/dist/debugger/events/family.js +0 -44
- package/dist/runtime/events-api.d.ts +0 -4
- package/dist/runtime/events-api.js +0 -84
package/dist/client/client.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { type DefinitionInput, type DefinitionRef, type EventEnvelope, type EventInput, type JsonValue, type RunState, type WorkerCallbackInput } from '@swirls/looms/core';
|
|
2
3
|
export interface LoomsClientOptions {
|
|
3
4
|
baseUrl?: string;
|
|
4
5
|
fetch?: typeof fetch;
|
|
6
|
+
workerCallbackToken?: string;
|
|
5
7
|
}
|
|
6
8
|
export interface StartResult {
|
|
7
9
|
runId: string;
|
|
@@ -16,42 +18,1234 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
16
18
|
startRun: (args: {
|
|
17
19
|
kind: string;
|
|
18
20
|
definitionName: string;
|
|
21
|
+
definitionVersion?: string;
|
|
19
22
|
input?: JsonValue;
|
|
20
23
|
runId?: string;
|
|
21
|
-
}) => Promise<
|
|
24
|
+
}) => Promise<{
|
|
25
|
+
readonly runId: string;
|
|
26
|
+
readonly threadId: string;
|
|
27
|
+
readonly state: {
|
|
28
|
+
readonly runId: string;
|
|
29
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
30
|
+
readonly rootThreadId: string | null;
|
|
31
|
+
readonly startIdentity: {
|
|
32
|
+
readonly kind: string;
|
|
33
|
+
readonly definitionName: string;
|
|
34
|
+
readonly definitionVersion: string;
|
|
35
|
+
readonly input: Schema.Json;
|
|
36
|
+
readonly requestedThreadId: string | null;
|
|
37
|
+
readonly idempotencyKey: string | null;
|
|
38
|
+
readonly rootThreadId: string;
|
|
39
|
+
} | null;
|
|
40
|
+
readonly threads: {
|
|
41
|
+
readonly [x: string]: {
|
|
42
|
+
readonly threadId: string;
|
|
43
|
+
readonly kind: string;
|
|
44
|
+
readonly definitionName: string;
|
|
45
|
+
readonly definitionVersion: string;
|
|
46
|
+
readonly parentThreadId: string | null;
|
|
47
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
48
|
+
readonly input: Schema.Json;
|
|
49
|
+
readonly output: Schema.Json;
|
|
50
|
+
readonly error: string | null;
|
|
51
|
+
readonly state: Schema.Json;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly waits: {
|
|
55
|
+
readonly [x: string]: {
|
|
56
|
+
readonly waitId: string;
|
|
57
|
+
readonly threadId: string;
|
|
58
|
+
readonly on: {
|
|
59
|
+
readonly type: string | readonly string[];
|
|
60
|
+
readonly match?: Schema.Json | undefined;
|
|
61
|
+
} | {
|
|
62
|
+
readonly timerAt: number;
|
|
63
|
+
};
|
|
64
|
+
readonly tag?: Schema.Json | undefined;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly outstandingEffects: readonly {
|
|
68
|
+
readonly effectId: string;
|
|
69
|
+
readonly threadId: string;
|
|
70
|
+
readonly causingSeq: number;
|
|
71
|
+
readonly causingEventId: string;
|
|
72
|
+
readonly effect: {
|
|
73
|
+
readonly type: "runtime.spawn";
|
|
74
|
+
readonly childThreadId: string;
|
|
75
|
+
readonly kind: string;
|
|
76
|
+
readonly definitionName: string;
|
|
77
|
+
readonly definitionVersion: string;
|
|
78
|
+
readonly input: Schema.Json;
|
|
79
|
+
} | {
|
|
80
|
+
readonly type: "runtime.wait";
|
|
81
|
+
readonly waitId: string;
|
|
82
|
+
readonly on: {
|
|
83
|
+
readonly type: string | readonly string[];
|
|
84
|
+
readonly match?: Schema.Json | undefined;
|
|
85
|
+
} | {
|
|
86
|
+
readonly timerAt: number;
|
|
87
|
+
};
|
|
88
|
+
readonly tag?: Schema.Json | undefined;
|
|
89
|
+
} | {
|
|
90
|
+
readonly type: "runtime.emit";
|
|
91
|
+
readonly event: {
|
|
92
|
+
readonly type: string;
|
|
93
|
+
readonly payload: Schema.Json;
|
|
94
|
+
readonly threadId?: string | null | undefined;
|
|
95
|
+
readonly parentThreadId?: string | null | undefined;
|
|
96
|
+
readonly causationId?: string | null | undefined;
|
|
97
|
+
readonly correlationId?: string | null | undefined;
|
|
98
|
+
readonly effectId?: string | null | undefined;
|
|
99
|
+
readonly origin?: {
|
|
100
|
+
readonly type: "thread";
|
|
101
|
+
readonly threadId: string;
|
|
102
|
+
} | {
|
|
103
|
+
readonly type: "external";
|
|
104
|
+
readonly actorId?: string | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
readonly type: "system";
|
|
107
|
+
} | undefined;
|
|
108
|
+
readonly ephemeral?: boolean | undefined;
|
|
109
|
+
readonly id?: string | undefined;
|
|
110
|
+
readonly ts?: number | undefined;
|
|
111
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
112
|
+
};
|
|
113
|
+
readonly tag?: string | undefined;
|
|
114
|
+
} | {
|
|
115
|
+
readonly type: "runtime.complete";
|
|
116
|
+
readonly output: Schema.Json;
|
|
117
|
+
} | {
|
|
118
|
+
readonly type: "runtime.fail";
|
|
119
|
+
readonly error: string;
|
|
120
|
+
} | {
|
|
121
|
+
readonly type: "runtime.cancel";
|
|
122
|
+
readonly threadId: string;
|
|
123
|
+
readonly tag?: string | undefined;
|
|
124
|
+
} | {
|
|
125
|
+
readonly type: string;
|
|
126
|
+
readonly input: Schema.Json;
|
|
127
|
+
readonly tag?: string | undefined;
|
|
128
|
+
};
|
|
129
|
+
}[];
|
|
130
|
+
readonly effectExecutions: {
|
|
131
|
+
readonly [x: string]: {
|
|
132
|
+
readonly effectId: string;
|
|
133
|
+
readonly attempt: number;
|
|
134
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
135
|
+
readonly nextAttemptAt: number | null;
|
|
136
|
+
readonly deadlineAt: number | null;
|
|
137
|
+
readonly startedAt: number | null;
|
|
138
|
+
readonly lastHeartbeatAt: number | null;
|
|
139
|
+
readonly lastError: string | null;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
readonly completedEffectIds: readonly string[];
|
|
143
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
144
|
+
};
|
|
145
|
+
}>;
|
|
22
146
|
/** Start a run from a definition object (agent, workflow, or your own kind). */
|
|
23
|
-
start: <TDef extends DefinitionRef>(definition: TDef, input?: DefinitionInput<TDef>) => Promise<
|
|
147
|
+
start: <TDef extends DefinitionRef>(definition: TDef, input?: DefinitionInput<TDef>) => Promise<{
|
|
148
|
+
readonly runId: string;
|
|
149
|
+
readonly threadId: string;
|
|
150
|
+
readonly state: {
|
|
151
|
+
readonly runId: string;
|
|
152
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
153
|
+
readonly rootThreadId: string | null;
|
|
154
|
+
readonly startIdentity: {
|
|
155
|
+
readonly kind: string;
|
|
156
|
+
readonly definitionName: string;
|
|
157
|
+
readonly definitionVersion: string;
|
|
158
|
+
readonly input: Schema.Json;
|
|
159
|
+
readonly requestedThreadId: string | null;
|
|
160
|
+
readonly idempotencyKey: string | null;
|
|
161
|
+
readonly rootThreadId: string;
|
|
162
|
+
} | null;
|
|
163
|
+
readonly threads: {
|
|
164
|
+
readonly [x: string]: {
|
|
165
|
+
readonly threadId: string;
|
|
166
|
+
readonly kind: string;
|
|
167
|
+
readonly definitionName: string;
|
|
168
|
+
readonly definitionVersion: string;
|
|
169
|
+
readonly parentThreadId: string | null;
|
|
170
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
171
|
+
readonly input: Schema.Json;
|
|
172
|
+
readonly output: Schema.Json;
|
|
173
|
+
readonly error: string | null;
|
|
174
|
+
readonly state: Schema.Json;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
readonly waits: {
|
|
178
|
+
readonly [x: string]: {
|
|
179
|
+
readonly waitId: string;
|
|
180
|
+
readonly threadId: string;
|
|
181
|
+
readonly on: {
|
|
182
|
+
readonly type: string | readonly string[];
|
|
183
|
+
readonly match?: Schema.Json | undefined;
|
|
184
|
+
} | {
|
|
185
|
+
readonly timerAt: number;
|
|
186
|
+
};
|
|
187
|
+
readonly tag?: Schema.Json | undefined;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
readonly outstandingEffects: readonly {
|
|
191
|
+
readonly effectId: string;
|
|
192
|
+
readonly threadId: string;
|
|
193
|
+
readonly causingSeq: number;
|
|
194
|
+
readonly causingEventId: string;
|
|
195
|
+
readonly effect: {
|
|
196
|
+
readonly type: "runtime.spawn";
|
|
197
|
+
readonly childThreadId: string;
|
|
198
|
+
readonly kind: string;
|
|
199
|
+
readonly definitionName: string;
|
|
200
|
+
readonly definitionVersion: string;
|
|
201
|
+
readonly input: Schema.Json;
|
|
202
|
+
} | {
|
|
203
|
+
readonly type: "runtime.wait";
|
|
204
|
+
readonly waitId: string;
|
|
205
|
+
readonly on: {
|
|
206
|
+
readonly type: string | readonly string[];
|
|
207
|
+
readonly match?: Schema.Json | undefined;
|
|
208
|
+
} | {
|
|
209
|
+
readonly timerAt: number;
|
|
210
|
+
};
|
|
211
|
+
readonly tag?: Schema.Json | undefined;
|
|
212
|
+
} | {
|
|
213
|
+
readonly type: "runtime.emit";
|
|
214
|
+
readonly event: {
|
|
215
|
+
readonly type: string;
|
|
216
|
+
readonly payload: Schema.Json;
|
|
217
|
+
readonly threadId?: string | null | undefined;
|
|
218
|
+
readonly parentThreadId?: string | null | undefined;
|
|
219
|
+
readonly causationId?: string | null | undefined;
|
|
220
|
+
readonly correlationId?: string | null | undefined;
|
|
221
|
+
readonly effectId?: string | null | undefined;
|
|
222
|
+
readonly origin?: {
|
|
223
|
+
readonly type: "thread";
|
|
224
|
+
readonly threadId: string;
|
|
225
|
+
} | {
|
|
226
|
+
readonly type: "external";
|
|
227
|
+
readonly actorId?: string | undefined;
|
|
228
|
+
} | {
|
|
229
|
+
readonly type: "system";
|
|
230
|
+
} | undefined;
|
|
231
|
+
readonly ephemeral?: boolean | undefined;
|
|
232
|
+
readonly id?: string | undefined;
|
|
233
|
+
readonly ts?: number | undefined;
|
|
234
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
235
|
+
};
|
|
236
|
+
readonly tag?: string | undefined;
|
|
237
|
+
} | {
|
|
238
|
+
readonly type: "runtime.complete";
|
|
239
|
+
readonly output: Schema.Json;
|
|
240
|
+
} | {
|
|
241
|
+
readonly type: "runtime.fail";
|
|
242
|
+
readonly error: string;
|
|
243
|
+
} | {
|
|
244
|
+
readonly type: "runtime.cancel";
|
|
245
|
+
readonly threadId: string;
|
|
246
|
+
readonly tag?: string | undefined;
|
|
247
|
+
} | {
|
|
248
|
+
readonly type: string;
|
|
249
|
+
readonly input: Schema.Json;
|
|
250
|
+
readonly tag?: string | undefined;
|
|
251
|
+
};
|
|
252
|
+
}[];
|
|
253
|
+
readonly effectExecutions: {
|
|
254
|
+
readonly [x: string]: {
|
|
255
|
+
readonly effectId: string;
|
|
256
|
+
readonly attempt: number;
|
|
257
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
258
|
+
readonly nextAttemptAt: number | null;
|
|
259
|
+
readonly deadlineAt: number | null;
|
|
260
|
+
readonly startedAt: number | null;
|
|
261
|
+
readonly lastHeartbeatAt: number | null;
|
|
262
|
+
readonly lastError: string | null;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
readonly completedEffectIds: readonly string[];
|
|
266
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
267
|
+
};
|
|
268
|
+
}>;
|
|
24
269
|
getRun: (runId: string) => Promise<{
|
|
25
|
-
runId: string;
|
|
26
|
-
state:
|
|
270
|
+
readonly runId: string;
|
|
271
|
+
readonly state: {
|
|
272
|
+
readonly runId: string;
|
|
273
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
274
|
+
readonly rootThreadId: string | null;
|
|
275
|
+
readonly startIdentity: {
|
|
276
|
+
readonly kind: string;
|
|
277
|
+
readonly definitionName: string;
|
|
278
|
+
readonly definitionVersion: string;
|
|
279
|
+
readonly input: Schema.Json;
|
|
280
|
+
readonly requestedThreadId: string | null;
|
|
281
|
+
readonly idempotencyKey: string | null;
|
|
282
|
+
readonly rootThreadId: string;
|
|
283
|
+
} | null;
|
|
284
|
+
readonly threads: {
|
|
285
|
+
readonly [x: string]: {
|
|
286
|
+
readonly threadId: string;
|
|
287
|
+
readonly kind: string;
|
|
288
|
+
readonly definitionName: string;
|
|
289
|
+
readonly definitionVersion: string;
|
|
290
|
+
readonly parentThreadId: string | null;
|
|
291
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
292
|
+
readonly input: Schema.Json;
|
|
293
|
+
readonly output: Schema.Json;
|
|
294
|
+
readonly error: string | null;
|
|
295
|
+
readonly state: Schema.Json;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
readonly waits: {
|
|
299
|
+
readonly [x: string]: {
|
|
300
|
+
readonly waitId: string;
|
|
301
|
+
readonly threadId: string;
|
|
302
|
+
readonly on: {
|
|
303
|
+
readonly type: string | readonly string[];
|
|
304
|
+
readonly match?: Schema.Json | undefined;
|
|
305
|
+
} | {
|
|
306
|
+
readonly timerAt: number;
|
|
307
|
+
};
|
|
308
|
+
readonly tag?: Schema.Json | undefined;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
readonly outstandingEffects: readonly {
|
|
312
|
+
readonly effectId: string;
|
|
313
|
+
readonly threadId: string;
|
|
314
|
+
readonly causingSeq: number;
|
|
315
|
+
readonly causingEventId: string;
|
|
316
|
+
readonly effect: {
|
|
317
|
+
readonly type: "runtime.spawn";
|
|
318
|
+
readonly childThreadId: string;
|
|
319
|
+
readonly kind: string;
|
|
320
|
+
readonly definitionName: string;
|
|
321
|
+
readonly definitionVersion: string;
|
|
322
|
+
readonly input: Schema.Json;
|
|
323
|
+
} | {
|
|
324
|
+
readonly type: "runtime.wait";
|
|
325
|
+
readonly waitId: string;
|
|
326
|
+
readonly on: {
|
|
327
|
+
readonly type: string | readonly string[];
|
|
328
|
+
readonly match?: Schema.Json | undefined;
|
|
329
|
+
} | {
|
|
330
|
+
readonly timerAt: number;
|
|
331
|
+
};
|
|
332
|
+
readonly tag?: Schema.Json | undefined;
|
|
333
|
+
} | {
|
|
334
|
+
readonly type: "runtime.emit";
|
|
335
|
+
readonly event: {
|
|
336
|
+
readonly type: string;
|
|
337
|
+
readonly payload: Schema.Json;
|
|
338
|
+
readonly threadId?: string | null | undefined;
|
|
339
|
+
readonly parentThreadId?: string | null | undefined;
|
|
340
|
+
readonly causationId?: string | null | undefined;
|
|
341
|
+
readonly correlationId?: string | null | undefined;
|
|
342
|
+
readonly effectId?: string | null | undefined;
|
|
343
|
+
readonly origin?: {
|
|
344
|
+
readonly type: "thread";
|
|
345
|
+
readonly threadId: string;
|
|
346
|
+
} | {
|
|
347
|
+
readonly type: "external";
|
|
348
|
+
readonly actorId?: string | undefined;
|
|
349
|
+
} | {
|
|
350
|
+
readonly type: "system";
|
|
351
|
+
} | undefined;
|
|
352
|
+
readonly ephemeral?: boolean | undefined;
|
|
353
|
+
readonly id?: string | undefined;
|
|
354
|
+
readonly ts?: number | undefined;
|
|
355
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
356
|
+
};
|
|
357
|
+
readonly tag?: string | undefined;
|
|
358
|
+
} | {
|
|
359
|
+
readonly type: "runtime.complete";
|
|
360
|
+
readonly output: Schema.Json;
|
|
361
|
+
} | {
|
|
362
|
+
readonly type: "runtime.fail";
|
|
363
|
+
readonly error: string;
|
|
364
|
+
} | {
|
|
365
|
+
readonly type: "runtime.cancel";
|
|
366
|
+
readonly threadId: string;
|
|
367
|
+
readonly tag?: string | undefined;
|
|
368
|
+
} | {
|
|
369
|
+
readonly type: string;
|
|
370
|
+
readonly input: Schema.Json;
|
|
371
|
+
readonly tag?: string | undefined;
|
|
372
|
+
};
|
|
373
|
+
}[];
|
|
374
|
+
readonly effectExecutions: {
|
|
375
|
+
readonly [x: string]: {
|
|
376
|
+
readonly effectId: string;
|
|
377
|
+
readonly attempt: number;
|
|
378
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
379
|
+
readonly nextAttemptAt: number | null;
|
|
380
|
+
readonly deadlineAt: number | null;
|
|
381
|
+
readonly startedAt: number | null;
|
|
382
|
+
readonly lastHeartbeatAt: number | null;
|
|
383
|
+
readonly lastError: string | null;
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
readonly completedEffectIds: readonly string[];
|
|
387
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
388
|
+
};
|
|
27
389
|
}>;
|
|
28
390
|
getState: (runId: string) => Promise<{
|
|
29
|
-
runId: string;
|
|
30
|
-
state:
|
|
391
|
+
readonly runId: string;
|
|
392
|
+
readonly state: {
|
|
393
|
+
readonly runId: string;
|
|
394
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
395
|
+
readonly rootThreadId: string | null;
|
|
396
|
+
readonly startIdentity: {
|
|
397
|
+
readonly kind: string;
|
|
398
|
+
readonly definitionName: string;
|
|
399
|
+
readonly definitionVersion: string;
|
|
400
|
+
readonly input: Schema.Json;
|
|
401
|
+
readonly requestedThreadId: string | null;
|
|
402
|
+
readonly idempotencyKey: string | null;
|
|
403
|
+
readonly rootThreadId: string;
|
|
404
|
+
} | null;
|
|
405
|
+
readonly threads: {
|
|
406
|
+
readonly [x: string]: {
|
|
407
|
+
readonly threadId: string;
|
|
408
|
+
readonly kind: string;
|
|
409
|
+
readonly definitionName: string;
|
|
410
|
+
readonly definitionVersion: string;
|
|
411
|
+
readonly parentThreadId: string | null;
|
|
412
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
413
|
+
readonly input: Schema.Json;
|
|
414
|
+
readonly output: Schema.Json;
|
|
415
|
+
readonly error: string | null;
|
|
416
|
+
readonly state: Schema.Json;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
readonly waits: {
|
|
420
|
+
readonly [x: string]: {
|
|
421
|
+
readonly waitId: string;
|
|
422
|
+
readonly threadId: string;
|
|
423
|
+
readonly on: {
|
|
424
|
+
readonly type: string | readonly string[];
|
|
425
|
+
readonly match?: Schema.Json | undefined;
|
|
426
|
+
} | {
|
|
427
|
+
readonly timerAt: number;
|
|
428
|
+
};
|
|
429
|
+
readonly tag?: Schema.Json | undefined;
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
readonly outstandingEffects: readonly {
|
|
433
|
+
readonly effectId: string;
|
|
434
|
+
readonly threadId: string;
|
|
435
|
+
readonly causingSeq: number;
|
|
436
|
+
readonly causingEventId: string;
|
|
437
|
+
readonly effect: {
|
|
438
|
+
readonly type: "runtime.spawn";
|
|
439
|
+
readonly childThreadId: string;
|
|
440
|
+
readonly kind: string;
|
|
441
|
+
readonly definitionName: string;
|
|
442
|
+
readonly definitionVersion: string;
|
|
443
|
+
readonly input: Schema.Json;
|
|
444
|
+
} | {
|
|
445
|
+
readonly type: "runtime.wait";
|
|
446
|
+
readonly waitId: string;
|
|
447
|
+
readonly on: {
|
|
448
|
+
readonly type: string | readonly string[];
|
|
449
|
+
readonly match?: Schema.Json | undefined;
|
|
450
|
+
} | {
|
|
451
|
+
readonly timerAt: number;
|
|
452
|
+
};
|
|
453
|
+
readonly tag?: Schema.Json | undefined;
|
|
454
|
+
} | {
|
|
455
|
+
readonly type: "runtime.emit";
|
|
456
|
+
readonly event: {
|
|
457
|
+
readonly type: string;
|
|
458
|
+
readonly payload: Schema.Json;
|
|
459
|
+
readonly threadId?: string | null | undefined;
|
|
460
|
+
readonly parentThreadId?: string | null | undefined;
|
|
461
|
+
readonly causationId?: string | null | undefined;
|
|
462
|
+
readonly correlationId?: string | null | undefined;
|
|
463
|
+
readonly effectId?: string | null | undefined;
|
|
464
|
+
readonly origin?: {
|
|
465
|
+
readonly type: "thread";
|
|
466
|
+
readonly threadId: string;
|
|
467
|
+
} | {
|
|
468
|
+
readonly type: "external";
|
|
469
|
+
readonly actorId?: string | undefined;
|
|
470
|
+
} | {
|
|
471
|
+
readonly type: "system";
|
|
472
|
+
} | undefined;
|
|
473
|
+
readonly ephemeral?: boolean | undefined;
|
|
474
|
+
readonly id?: string | undefined;
|
|
475
|
+
readonly ts?: number | undefined;
|
|
476
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
477
|
+
};
|
|
478
|
+
readonly tag?: string | undefined;
|
|
479
|
+
} | {
|
|
480
|
+
readonly type: "runtime.complete";
|
|
481
|
+
readonly output: Schema.Json;
|
|
482
|
+
} | {
|
|
483
|
+
readonly type: "runtime.fail";
|
|
484
|
+
readonly error: string;
|
|
485
|
+
} | {
|
|
486
|
+
readonly type: "runtime.cancel";
|
|
487
|
+
readonly threadId: string;
|
|
488
|
+
readonly tag?: string | undefined;
|
|
489
|
+
} | {
|
|
490
|
+
readonly type: string;
|
|
491
|
+
readonly input: Schema.Json;
|
|
492
|
+
readonly tag?: string | undefined;
|
|
493
|
+
};
|
|
494
|
+
}[];
|
|
495
|
+
readonly effectExecutions: {
|
|
496
|
+
readonly [x: string]: {
|
|
497
|
+
readonly effectId: string;
|
|
498
|
+
readonly attempt: number;
|
|
499
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
500
|
+
readonly nextAttemptAt: number | null;
|
|
501
|
+
readonly deadlineAt: number | null;
|
|
502
|
+
readonly startedAt: number | null;
|
|
503
|
+
readonly lastHeartbeatAt: number | null;
|
|
504
|
+
readonly lastError: string | null;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
readonly completedEffectIds: readonly string[];
|
|
508
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
509
|
+
};
|
|
31
510
|
}>;
|
|
32
511
|
getEvents: (runId: string, opts?: {
|
|
33
512
|
fromSeq?: number;
|
|
34
513
|
limit?: number;
|
|
35
514
|
}) => Promise<{
|
|
36
|
-
runId: string;
|
|
37
|
-
events:
|
|
515
|
+
readonly runId: string;
|
|
516
|
+
readonly events: readonly {
|
|
517
|
+
readonly id: string;
|
|
518
|
+
readonly runId: string;
|
|
519
|
+
readonly seq: number;
|
|
520
|
+
readonly ts: number;
|
|
521
|
+
readonly type: string;
|
|
522
|
+
readonly payload: Schema.Json;
|
|
523
|
+
readonly threadId: string | null;
|
|
524
|
+
readonly parentThreadId?: string | null | undefined;
|
|
525
|
+
readonly causationId?: string | null | undefined;
|
|
526
|
+
readonly correlationId?: string | null | undefined;
|
|
527
|
+
readonly effectId?: string | null | undefined;
|
|
528
|
+
readonly origin: {
|
|
529
|
+
readonly type: "thread";
|
|
530
|
+
readonly threadId: string;
|
|
531
|
+
} | {
|
|
532
|
+
readonly type: "external";
|
|
533
|
+
readonly actorId?: string | undefined;
|
|
534
|
+
} | {
|
|
535
|
+
readonly type: "system";
|
|
536
|
+
};
|
|
537
|
+
readonly ephemeral?: boolean | undefined;
|
|
538
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
539
|
+
}[];
|
|
38
540
|
}>;
|
|
39
541
|
signal: (runId: string, events: ReadonlyArray<EventInput>) => Promise<{
|
|
40
|
-
runId: string;
|
|
41
|
-
state:
|
|
542
|
+
readonly runId: string;
|
|
543
|
+
readonly state: {
|
|
544
|
+
readonly runId: string;
|
|
545
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
546
|
+
readonly rootThreadId: string | null;
|
|
547
|
+
readonly startIdentity: {
|
|
548
|
+
readonly kind: string;
|
|
549
|
+
readonly definitionName: string;
|
|
550
|
+
readonly definitionVersion: string;
|
|
551
|
+
readonly input: Schema.Json;
|
|
552
|
+
readonly requestedThreadId: string | null;
|
|
553
|
+
readonly idempotencyKey: string | null;
|
|
554
|
+
readonly rootThreadId: string;
|
|
555
|
+
} | null;
|
|
556
|
+
readonly threads: {
|
|
557
|
+
readonly [x: string]: {
|
|
558
|
+
readonly threadId: string;
|
|
559
|
+
readonly kind: string;
|
|
560
|
+
readonly definitionName: string;
|
|
561
|
+
readonly definitionVersion: string;
|
|
562
|
+
readonly parentThreadId: string | null;
|
|
563
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
564
|
+
readonly input: Schema.Json;
|
|
565
|
+
readonly output: Schema.Json;
|
|
566
|
+
readonly error: string | null;
|
|
567
|
+
readonly state: Schema.Json;
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
readonly waits: {
|
|
571
|
+
readonly [x: string]: {
|
|
572
|
+
readonly waitId: string;
|
|
573
|
+
readonly threadId: string;
|
|
574
|
+
readonly on: {
|
|
575
|
+
readonly type: string | readonly string[];
|
|
576
|
+
readonly match?: Schema.Json | undefined;
|
|
577
|
+
} | {
|
|
578
|
+
readonly timerAt: number;
|
|
579
|
+
};
|
|
580
|
+
readonly tag?: Schema.Json | undefined;
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
readonly outstandingEffects: readonly {
|
|
584
|
+
readonly effectId: string;
|
|
585
|
+
readonly threadId: string;
|
|
586
|
+
readonly causingSeq: number;
|
|
587
|
+
readonly causingEventId: string;
|
|
588
|
+
readonly effect: {
|
|
589
|
+
readonly type: "runtime.spawn";
|
|
590
|
+
readonly childThreadId: string;
|
|
591
|
+
readonly kind: string;
|
|
592
|
+
readonly definitionName: string;
|
|
593
|
+
readonly definitionVersion: string;
|
|
594
|
+
readonly input: Schema.Json;
|
|
595
|
+
} | {
|
|
596
|
+
readonly type: "runtime.wait";
|
|
597
|
+
readonly waitId: string;
|
|
598
|
+
readonly on: {
|
|
599
|
+
readonly type: string | readonly string[];
|
|
600
|
+
readonly match?: Schema.Json | undefined;
|
|
601
|
+
} | {
|
|
602
|
+
readonly timerAt: number;
|
|
603
|
+
};
|
|
604
|
+
readonly tag?: Schema.Json | undefined;
|
|
605
|
+
} | {
|
|
606
|
+
readonly type: "runtime.emit";
|
|
607
|
+
readonly event: {
|
|
608
|
+
readonly type: string;
|
|
609
|
+
readonly payload: Schema.Json;
|
|
610
|
+
readonly threadId?: string | null | undefined;
|
|
611
|
+
readonly parentThreadId?: string | null | undefined;
|
|
612
|
+
readonly causationId?: string | null | undefined;
|
|
613
|
+
readonly correlationId?: string | null | undefined;
|
|
614
|
+
readonly effectId?: string | null | undefined;
|
|
615
|
+
readonly origin?: {
|
|
616
|
+
readonly type: "thread";
|
|
617
|
+
readonly threadId: string;
|
|
618
|
+
} | {
|
|
619
|
+
readonly type: "external";
|
|
620
|
+
readonly actorId?: string | undefined;
|
|
621
|
+
} | {
|
|
622
|
+
readonly type: "system";
|
|
623
|
+
} | undefined;
|
|
624
|
+
readonly ephemeral?: boolean | undefined;
|
|
625
|
+
readonly id?: string | undefined;
|
|
626
|
+
readonly ts?: number | undefined;
|
|
627
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
628
|
+
};
|
|
629
|
+
readonly tag?: string | undefined;
|
|
630
|
+
} | {
|
|
631
|
+
readonly type: "runtime.complete";
|
|
632
|
+
readonly output: Schema.Json;
|
|
633
|
+
} | {
|
|
634
|
+
readonly type: "runtime.fail";
|
|
635
|
+
readonly error: string;
|
|
636
|
+
} | {
|
|
637
|
+
readonly type: "runtime.cancel";
|
|
638
|
+
readonly threadId: string;
|
|
639
|
+
readonly tag?: string | undefined;
|
|
640
|
+
} | {
|
|
641
|
+
readonly type: string;
|
|
642
|
+
readonly input: Schema.Json;
|
|
643
|
+
readonly tag?: string | undefined;
|
|
644
|
+
};
|
|
645
|
+
}[];
|
|
646
|
+
readonly effectExecutions: {
|
|
647
|
+
readonly [x: string]: {
|
|
648
|
+
readonly effectId: string;
|
|
649
|
+
readonly attempt: number;
|
|
650
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
651
|
+
readonly nextAttemptAt: number | null;
|
|
652
|
+
readonly deadlineAt: number | null;
|
|
653
|
+
readonly startedAt: number | null;
|
|
654
|
+
readonly lastHeartbeatAt: number | null;
|
|
655
|
+
readonly lastError: string | null;
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
readonly completedEffectIds: readonly string[];
|
|
659
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
660
|
+
};
|
|
42
661
|
}>;
|
|
43
662
|
wake: (runId: string) => Promise<{
|
|
44
|
-
runId: string;
|
|
45
|
-
state:
|
|
663
|
+
readonly runId: string;
|
|
664
|
+
readonly state: {
|
|
665
|
+
readonly runId: string;
|
|
666
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
667
|
+
readonly rootThreadId: string | null;
|
|
668
|
+
readonly startIdentity: {
|
|
669
|
+
readonly kind: string;
|
|
670
|
+
readonly definitionName: string;
|
|
671
|
+
readonly definitionVersion: string;
|
|
672
|
+
readonly input: Schema.Json;
|
|
673
|
+
readonly requestedThreadId: string | null;
|
|
674
|
+
readonly idempotencyKey: string | null;
|
|
675
|
+
readonly rootThreadId: string;
|
|
676
|
+
} | null;
|
|
677
|
+
readonly threads: {
|
|
678
|
+
readonly [x: string]: {
|
|
679
|
+
readonly threadId: string;
|
|
680
|
+
readonly kind: string;
|
|
681
|
+
readonly definitionName: string;
|
|
682
|
+
readonly definitionVersion: string;
|
|
683
|
+
readonly parentThreadId: string | null;
|
|
684
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
685
|
+
readonly input: Schema.Json;
|
|
686
|
+
readonly output: Schema.Json;
|
|
687
|
+
readonly error: string | null;
|
|
688
|
+
readonly state: Schema.Json;
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
readonly waits: {
|
|
692
|
+
readonly [x: string]: {
|
|
693
|
+
readonly waitId: string;
|
|
694
|
+
readonly threadId: string;
|
|
695
|
+
readonly on: {
|
|
696
|
+
readonly type: string | readonly string[];
|
|
697
|
+
readonly match?: Schema.Json | undefined;
|
|
698
|
+
} | {
|
|
699
|
+
readonly timerAt: number;
|
|
700
|
+
};
|
|
701
|
+
readonly tag?: Schema.Json | undefined;
|
|
702
|
+
};
|
|
703
|
+
};
|
|
704
|
+
readonly outstandingEffects: readonly {
|
|
705
|
+
readonly effectId: string;
|
|
706
|
+
readonly threadId: string;
|
|
707
|
+
readonly causingSeq: number;
|
|
708
|
+
readonly causingEventId: string;
|
|
709
|
+
readonly effect: {
|
|
710
|
+
readonly type: "runtime.spawn";
|
|
711
|
+
readonly childThreadId: string;
|
|
712
|
+
readonly kind: string;
|
|
713
|
+
readonly definitionName: string;
|
|
714
|
+
readonly definitionVersion: string;
|
|
715
|
+
readonly input: Schema.Json;
|
|
716
|
+
} | {
|
|
717
|
+
readonly type: "runtime.wait";
|
|
718
|
+
readonly waitId: string;
|
|
719
|
+
readonly on: {
|
|
720
|
+
readonly type: string | readonly string[];
|
|
721
|
+
readonly match?: Schema.Json | undefined;
|
|
722
|
+
} | {
|
|
723
|
+
readonly timerAt: number;
|
|
724
|
+
};
|
|
725
|
+
readonly tag?: Schema.Json | undefined;
|
|
726
|
+
} | {
|
|
727
|
+
readonly type: "runtime.emit";
|
|
728
|
+
readonly event: {
|
|
729
|
+
readonly type: string;
|
|
730
|
+
readonly payload: Schema.Json;
|
|
731
|
+
readonly threadId?: string | null | undefined;
|
|
732
|
+
readonly parentThreadId?: string | null | undefined;
|
|
733
|
+
readonly causationId?: string | null | undefined;
|
|
734
|
+
readonly correlationId?: string | null | undefined;
|
|
735
|
+
readonly effectId?: string | null | undefined;
|
|
736
|
+
readonly origin?: {
|
|
737
|
+
readonly type: "thread";
|
|
738
|
+
readonly threadId: string;
|
|
739
|
+
} | {
|
|
740
|
+
readonly type: "external";
|
|
741
|
+
readonly actorId?: string | undefined;
|
|
742
|
+
} | {
|
|
743
|
+
readonly type: "system";
|
|
744
|
+
} | undefined;
|
|
745
|
+
readonly ephemeral?: boolean | undefined;
|
|
746
|
+
readonly id?: string | undefined;
|
|
747
|
+
readonly ts?: number | undefined;
|
|
748
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
749
|
+
};
|
|
750
|
+
readonly tag?: string | undefined;
|
|
751
|
+
} | {
|
|
752
|
+
readonly type: "runtime.complete";
|
|
753
|
+
readonly output: Schema.Json;
|
|
754
|
+
} | {
|
|
755
|
+
readonly type: "runtime.fail";
|
|
756
|
+
readonly error: string;
|
|
757
|
+
} | {
|
|
758
|
+
readonly type: "runtime.cancel";
|
|
759
|
+
readonly threadId: string;
|
|
760
|
+
readonly tag?: string | undefined;
|
|
761
|
+
} | {
|
|
762
|
+
readonly type: string;
|
|
763
|
+
readonly input: Schema.Json;
|
|
764
|
+
readonly tag?: string | undefined;
|
|
765
|
+
};
|
|
766
|
+
}[];
|
|
767
|
+
readonly effectExecutions: {
|
|
768
|
+
readonly [x: string]: {
|
|
769
|
+
readonly effectId: string;
|
|
770
|
+
readonly attempt: number;
|
|
771
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
772
|
+
readonly nextAttemptAt: number | null;
|
|
773
|
+
readonly deadlineAt: number | null;
|
|
774
|
+
readonly startedAt: number | null;
|
|
775
|
+
readonly lastHeartbeatAt: number | null;
|
|
776
|
+
readonly lastError: string | null;
|
|
777
|
+
};
|
|
778
|
+
};
|
|
779
|
+
readonly completedEffectIds: readonly string[];
|
|
780
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
781
|
+
};
|
|
782
|
+
}>;
|
|
783
|
+
workerCallback: (runId: string, input: WorkerCallbackInput) => Promise<{
|
|
784
|
+
readonly runId: string;
|
|
785
|
+
readonly state: {
|
|
786
|
+
readonly runId: string;
|
|
787
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
788
|
+
readonly rootThreadId: string | null;
|
|
789
|
+
readonly startIdentity: {
|
|
790
|
+
readonly kind: string;
|
|
791
|
+
readonly definitionName: string;
|
|
792
|
+
readonly definitionVersion: string;
|
|
793
|
+
readonly input: Schema.Json;
|
|
794
|
+
readonly requestedThreadId: string | null;
|
|
795
|
+
readonly idempotencyKey: string | null;
|
|
796
|
+
readonly rootThreadId: string;
|
|
797
|
+
} | null;
|
|
798
|
+
readonly threads: {
|
|
799
|
+
readonly [x: string]: {
|
|
800
|
+
readonly threadId: string;
|
|
801
|
+
readonly kind: string;
|
|
802
|
+
readonly definitionName: string;
|
|
803
|
+
readonly definitionVersion: string;
|
|
804
|
+
readonly parentThreadId: string | null;
|
|
805
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
806
|
+
readonly input: Schema.Json;
|
|
807
|
+
readonly output: Schema.Json;
|
|
808
|
+
readonly error: string | null;
|
|
809
|
+
readonly state: Schema.Json;
|
|
810
|
+
};
|
|
811
|
+
};
|
|
812
|
+
readonly waits: {
|
|
813
|
+
readonly [x: string]: {
|
|
814
|
+
readonly waitId: string;
|
|
815
|
+
readonly threadId: string;
|
|
816
|
+
readonly on: {
|
|
817
|
+
readonly type: string | readonly string[];
|
|
818
|
+
readonly match?: Schema.Json | undefined;
|
|
819
|
+
} | {
|
|
820
|
+
readonly timerAt: number;
|
|
821
|
+
};
|
|
822
|
+
readonly tag?: Schema.Json | undefined;
|
|
823
|
+
};
|
|
824
|
+
};
|
|
825
|
+
readonly outstandingEffects: readonly {
|
|
826
|
+
readonly effectId: string;
|
|
827
|
+
readonly threadId: string;
|
|
828
|
+
readonly causingSeq: number;
|
|
829
|
+
readonly causingEventId: string;
|
|
830
|
+
readonly effect: {
|
|
831
|
+
readonly type: "runtime.spawn";
|
|
832
|
+
readonly childThreadId: string;
|
|
833
|
+
readonly kind: string;
|
|
834
|
+
readonly definitionName: string;
|
|
835
|
+
readonly definitionVersion: string;
|
|
836
|
+
readonly input: Schema.Json;
|
|
837
|
+
} | {
|
|
838
|
+
readonly type: "runtime.wait";
|
|
839
|
+
readonly waitId: string;
|
|
840
|
+
readonly on: {
|
|
841
|
+
readonly type: string | readonly string[];
|
|
842
|
+
readonly match?: Schema.Json | undefined;
|
|
843
|
+
} | {
|
|
844
|
+
readonly timerAt: number;
|
|
845
|
+
};
|
|
846
|
+
readonly tag?: Schema.Json | undefined;
|
|
847
|
+
} | {
|
|
848
|
+
readonly type: "runtime.emit";
|
|
849
|
+
readonly event: {
|
|
850
|
+
readonly type: string;
|
|
851
|
+
readonly payload: Schema.Json;
|
|
852
|
+
readonly threadId?: string | null | undefined;
|
|
853
|
+
readonly parentThreadId?: string | null | undefined;
|
|
854
|
+
readonly causationId?: string | null | undefined;
|
|
855
|
+
readonly correlationId?: string | null | undefined;
|
|
856
|
+
readonly effectId?: string | null | undefined;
|
|
857
|
+
readonly origin?: {
|
|
858
|
+
readonly type: "thread";
|
|
859
|
+
readonly threadId: string;
|
|
860
|
+
} | {
|
|
861
|
+
readonly type: "external";
|
|
862
|
+
readonly actorId?: string | undefined;
|
|
863
|
+
} | {
|
|
864
|
+
readonly type: "system";
|
|
865
|
+
} | undefined;
|
|
866
|
+
readonly ephemeral?: boolean | undefined;
|
|
867
|
+
readonly id?: string | undefined;
|
|
868
|
+
readonly ts?: number | undefined;
|
|
869
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
870
|
+
};
|
|
871
|
+
readonly tag?: string | undefined;
|
|
872
|
+
} | {
|
|
873
|
+
readonly type: "runtime.complete";
|
|
874
|
+
readonly output: Schema.Json;
|
|
875
|
+
} | {
|
|
876
|
+
readonly type: "runtime.fail";
|
|
877
|
+
readonly error: string;
|
|
878
|
+
} | {
|
|
879
|
+
readonly type: "runtime.cancel";
|
|
880
|
+
readonly threadId: string;
|
|
881
|
+
readonly tag?: string | undefined;
|
|
882
|
+
} | {
|
|
883
|
+
readonly type: string;
|
|
884
|
+
readonly input: Schema.Json;
|
|
885
|
+
readonly tag?: string | undefined;
|
|
886
|
+
};
|
|
887
|
+
}[];
|
|
888
|
+
readonly effectExecutions: {
|
|
889
|
+
readonly [x: string]: {
|
|
890
|
+
readonly effectId: string;
|
|
891
|
+
readonly attempt: number;
|
|
892
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
893
|
+
readonly nextAttemptAt: number | null;
|
|
894
|
+
readonly deadlineAt: number | null;
|
|
895
|
+
readonly startedAt: number | null;
|
|
896
|
+
readonly lastHeartbeatAt: number | null;
|
|
897
|
+
readonly lastError: string | null;
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
readonly completedEffectIds: readonly string[];
|
|
901
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
902
|
+
};
|
|
903
|
+
}>;
|
|
904
|
+
listRunSummaries: () => Promise<{
|
|
905
|
+
readonly runs: readonly {
|
|
906
|
+
readonly runId: string;
|
|
907
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
908
|
+
readonly kind: string | null;
|
|
909
|
+
readonly definitionName: string | null;
|
|
910
|
+
}[];
|
|
911
|
+
}>;
|
|
912
|
+
listDefinitions: () => Promise<{
|
|
913
|
+
readonly definitions: readonly {
|
|
914
|
+
readonly kind: string;
|
|
915
|
+
readonly name: string;
|
|
916
|
+
readonly version: string;
|
|
917
|
+
readonly description?: string | undefined;
|
|
918
|
+
readonly inputSchema?: Schema.Json | undefined;
|
|
919
|
+
}[];
|
|
920
|
+
readonly projections: readonly string[];
|
|
46
921
|
}>;
|
|
47
922
|
replayTo: (runId: string, seq: number) => Promise<{
|
|
48
|
-
runId: string;
|
|
49
|
-
step:
|
|
923
|
+
readonly runId: string;
|
|
924
|
+
readonly step: {
|
|
925
|
+
readonly seq: number;
|
|
926
|
+
readonly event: {
|
|
927
|
+
readonly id: string;
|
|
928
|
+
readonly runId: string;
|
|
929
|
+
readonly seq: number;
|
|
930
|
+
readonly ts: number;
|
|
931
|
+
readonly type: string;
|
|
932
|
+
readonly payload: Schema.Json;
|
|
933
|
+
readonly threadId: string | null;
|
|
934
|
+
readonly parentThreadId?: string | null | undefined;
|
|
935
|
+
readonly causationId?: string | null | undefined;
|
|
936
|
+
readonly correlationId?: string | null | undefined;
|
|
937
|
+
readonly effectId?: string | null | undefined;
|
|
938
|
+
readonly origin: {
|
|
939
|
+
readonly type: "thread";
|
|
940
|
+
readonly threadId: string;
|
|
941
|
+
} | {
|
|
942
|
+
readonly type: "external";
|
|
943
|
+
readonly actorId?: string | undefined;
|
|
944
|
+
} | {
|
|
945
|
+
readonly type: "system";
|
|
946
|
+
};
|
|
947
|
+
readonly ephemeral?: boolean | undefined;
|
|
948
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
949
|
+
};
|
|
950
|
+
readonly before: {
|
|
951
|
+
readonly runId: string;
|
|
952
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
953
|
+
readonly rootThreadId: string | null;
|
|
954
|
+
readonly startIdentity: {
|
|
955
|
+
readonly kind: string;
|
|
956
|
+
readonly definitionName: string;
|
|
957
|
+
readonly definitionVersion: string;
|
|
958
|
+
readonly input: Schema.Json;
|
|
959
|
+
readonly requestedThreadId: string | null;
|
|
960
|
+
readonly idempotencyKey: string | null;
|
|
961
|
+
readonly rootThreadId: string;
|
|
962
|
+
} | null;
|
|
963
|
+
readonly threads: {
|
|
964
|
+
readonly [x: string]: {
|
|
965
|
+
readonly threadId: string;
|
|
966
|
+
readonly kind: string;
|
|
967
|
+
readonly definitionName: string;
|
|
968
|
+
readonly definitionVersion: string;
|
|
969
|
+
readonly parentThreadId: string | null;
|
|
970
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
971
|
+
readonly input: Schema.Json;
|
|
972
|
+
readonly output: Schema.Json;
|
|
973
|
+
readonly error: string | null;
|
|
974
|
+
readonly state: Schema.Json;
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
readonly waits: {
|
|
978
|
+
readonly [x: string]: {
|
|
979
|
+
readonly waitId: string;
|
|
980
|
+
readonly threadId: string;
|
|
981
|
+
readonly on: {
|
|
982
|
+
readonly type: string | readonly string[];
|
|
983
|
+
readonly match?: Schema.Json | undefined;
|
|
984
|
+
} | {
|
|
985
|
+
readonly timerAt: number;
|
|
986
|
+
};
|
|
987
|
+
readonly tag?: Schema.Json | undefined;
|
|
988
|
+
};
|
|
989
|
+
};
|
|
990
|
+
readonly outstandingEffects: readonly {
|
|
991
|
+
readonly effectId: string;
|
|
992
|
+
readonly threadId: string;
|
|
993
|
+
readonly causingSeq: number;
|
|
994
|
+
readonly causingEventId: string;
|
|
995
|
+
readonly effect: {
|
|
996
|
+
readonly type: "runtime.spawn";
|
|
997
|
+
readonly childThreadId: string;
|
|
998
|
+
readonly kind: string;
|
|
999
|
+
readonly definitionName: string;
|
|
1000
|
+
readonly definitionVersion: string;
|
|
1001
|
+
readonly input: Schema.Json;
|
|
1002
|
+
} | {
|
|
1003
|
+
readonly type: "runtime.wait";
|
|
1004
|
+
readonly waitId: string;
|
|
1005
|
+
readonly on: {
|
|
1006
|
+
readonly type: string | readonly string[];
|
|
1007
|
+
readonly match?: Schema.Json | undefined;
|
|
1008
|
+
} | {
|
|
1009
|
+
readonly timerAt: number;
|
|
1010
|
+
};
|
|
1011
|
+
readonly tag?: Schema.Json | undefined;
|
|
1012
|
+
} | {
|
|
1013
|
+
readonly type: "runtime.emit";
|
|
1014
|
+
readonly event: {
|
|
1015
|
+
readonly type: string;
|
|
1016
|
+
readonly payload: Schema.Json;
|
|
1017
|
+
readonly threadId?: string | null | undefined;
|
|
1018
|
+
readonly parentThreadId?: string | null | undefined;
|
|
1019
|
+
readonly causationId?: string | null | undefined;
|
|
1020
|
+
readonly correlationId?: string | null | undefined;
|
|
1021
|
+
readonly effectId?: string | null | undefined;
|
|
1022
|
+
readonly origin?: {
|
|
1023
|
+
readonly type: "thread";
|
|
1024
|
+
readonly threadId: string;
|
|
1025
|
+
} | {
|
|
1026
|
+
readonly type: "external";
|
|
1027
|
+
readonly actorId?: string | undefined;
|
|
1028
|
+
} | {
|
|
1029
|
+
readonly type: "system";
|
|
1030
|
+
} | undefined;
|
|
1031
|
+
readonly ephemeral?: boolean | undefined;
|
|
1032
|
+
readonly id?: string | undefined;
|
|
1033
|
+
readonly ts?: number | undefined;
|
|
1034
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
1035
|
+
};
|
|
1036
|
+
readonly tag?: string | undefined;
|
|
1037
|
+
} | {
|
|
1038
|
+
readonly type: "runtime.complete";
|
|
1039
|
+
readonly output: Schema.Json;
|
|
1040
|
+
} | {
|
|
1041
|
+
readonly type: "runtime.fail";
|
|
1042
|
+
readonly error: string;
|
|
1043
|
+
} | {
|
|
1044
|
+
readonly type: "runtime.cancel";
|
|
1045
|
+
readonly threadId: string;
|
|
1046
|
+
readonly tag?: string | undefined;
|
|
1047
|
+
} | {
|
|
1048
|
+
readonly type: string;
|
|
1049
|
+
readonly input: Schema.Json;
|
|
1050
|
+
readonly tag?: string | undefined;
|
|
1051
|
+
};
|
|
1052
|
+
}[];
|
|
1053
|
+
readonly effectExecutions: {
|
|
1054
|
+
readonly [x: string]: {
|
|
1055
|
+
readonly effectId: string;
|
|
1056
|
+
readonly attempt: number;
|
|
1057
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1058
|
+
readonly nextAttemptAt: number | null;
|
|
1059
|
+
readonly deadlineAt: number | null;
|
|
1060
|
+
readonly startedAt: number | null;
|
|
1061
|
+
readonly lastHeartbeatAt: number | null;
|
|
1062
|
+
readonly lastError: string | null;
|
|
1063
|
+
};
|
|
1064
|
+
};
|
|
1065
|
+
readonly completedEffectIds: readonly string[];
|
|
1066
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
1067
|
+
};
|
|
1068
|
+
readonly after: {
|
|
1069
|
+
readonly runId: string;
|
|
1070
|
+
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
1071
|
+
readonly rootThreadId: string | null;
|
|
1072
|
+
readonly startIdentity: {
|
|
1073
|
+
readonly kind: string;
|
|
1074
|
+
readonly definitionName: string;
|
|
1075
|
+
readonly definitionVersion: string;
|
|
1076
|
+
readonly input: Schema.Json;
|
|
1077
|
+
readonly requestedThreadId: string | null;
|
|
1078
|
+
readonly idempotencyKey: string | null;
|
|
1079
|
+
readonly rootThreadId: string;
|
|
1080
|
+
} | null;
|
|
1081
|
+
readonly threads: {
|
|
1082
|
+
readonly [x: string]: {
|
|
1083
|
+
readonly threadId: string;
|
|
1084
|
+
readonly kind: string;
|
|
1085
|
+
readonly definitionName: string;
|
|
1086
|
+
readonly definitionVersion: string;
|
|
1087
|
+
readonly parentThreadId: string | null;
|
|
1088
|
+
readonly status: "cancelled" | "completed" | "failed" | "running" | "waiting";
|
|
1089
|
+
readonly input: Schema.Json;
|
|
1090
|
+
readonly output: Schema.Json;
|
|
1091
|
+
readonly error: string | null;
|
|
1092
|
+
readonly state: Schema.Json;
|
|
1093
|
+
};
|
|
1094
|
+
};
|
|
1095
|
+
readonly waits: {
|
|
1096
|
+
readonly [x: string]: {
|
|
1097
|
+
readonly waitId: string;
|
|
1098
|
+
readonly threadId: string;
|
|
1099
|
+
readonly on: {
|
|
1100
|
+
readonly type: string | readonly string[];
|
|
1101
|
+
readonly match?: Schema.Json | undefined;
|
|
1102
|
+
} | {
|
|
1103
|
+
readonly timerAt: number;
|
|
1104
|
+
};
|
|
1105
|
+
readonly tag?: Schema.Json | undefined;
|
|
1106
|
+
};
|
|
1107
|
+
};
|
|
1108
|
+
readonly outstandingEffects: readonly {
|
|
1109
|
+
readonly effectId: string;
|
|
1110
|
+
readonly threadId: string;
|
|
1111
|
+
readonly causingSeq: number;
|
|
1112
|
+
readonly causingEventId: string;
|
|
1113
|
+
readonly effect: {
|
|
1114
|
+
readonly type: "runtime.spawn";
|
|
1115
|
+
readonly childThreadId: string;
|
|
1116
|
+
readonly kind: string;
|
|
1117
|
+
readonly definitionName: string;
|
|
1118
|
+
readonly definitionVersion: string;
|
|
1119
|
+
readonly input: Schema.Json;
|
|
1120
|
+
} | {
|
|
1121
|
+
readonly type: "runtime.wait";
|
|
1122
|
+
readonly waitId: string;
|
|
1123
|
+
readonly on: {
|
|
1124
|
+
readonly type: string | readonly string[];
|
|
1125
|
+
readonly match?: Schema.Json | undefined;
|
|
1126
|
+
} | {
|
|
1127
|
+
readonly timerAt: number;
|
|
1128
|
+
};
|
|
1129
|
+
readonly tag?: Schema.Json | undefined;
|
|
1130
|
+
} | {
|
|
1131
|
+
readonly type: "runtime.emit";
|
|
1132
|
+
readonly event: {
|
|
1133
|
+
readonly type: string;
|
|
1134
|
+
readonly payload: Schema.Json;
|
|
1135
|
+
readonly threadId?: string | null | undefined;
|
|
1136
|
+
readonly parentThreadId?: string | null | undefined;
|
|
1137
|
+
readonly causationId?: string | null | undefined;
|
|
1138
|
+
readonly correlationId?: string | null | undefined;
|
|
1139
|
+
readonly effectId?: string | null | undefined;
|
|
1140
|
+
readonly origin?: {
|
|
1141
|
+
readonly type: "thread";
|
|
1142
|
+
readonly threadId: string;
|
|
1143
|
+
} | {
|
|
1144
|
+
readonly type: "external";
|
|
1145
|
+
readonly actorId?: string | undefined;
|
|
1146
|
+
} | {
|
|
1147
|
+
readonly type: "system";
|
|
1148
|
+
} | undefined;
|
|
1149
|
+
readonly ephemeral?: boolean | undefined;
|
|
1150
|
+
readonly id?: string | undefined;
|
|
1151
|
+
readonly ts?: number | undefined;
|
|
1152
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
1153
|
+
};
|
|
1154
|
+
readonly tag?: string | undefined;
|
|
1155
|
+
} | {
|
|
1156
|
+
readonly type: "runtime.complete";
|
|
1157
|
+
readonly output: Schema.Json;
|
|
1158
|
+
} | {
|
|
1159
|
+
readonly type: "runtime.fail";
|
|
1160
|
+
readonly error: string;
|
|
1161
|
+
} | {
|
|
1162
|
+
readonly type: "runtime.cancel";
|
|
1163
|
+
readonly threadId: string;
|
|
1164
|
+
readonly tag?: string | undefined;
|
|
1165
|
+
} | {
|
|
1166
|
+
readonly type: string;
|
|
1167
|
+
readonly input: Schema.Json;
|
|
1168
|
+
readonly tag?: string | undefined;
|
|
1169
|
+
};
|
|
1170
|
+
}[];
|
|
1171
|
+
readonly effectExecutions: {
|
|
1172
|
+
readonly [x: string]: {
|
|
1173
|
+
readonly effectId: string;
|
|
1174
|
+
readonly attempt: number;
|
|
1175
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1176
|
+
readonly nextAttemptAt: number | null;
|
|
1177
|
+
readonly deadlineAt: number | null;
|
|
1178
|
+
readonly startedAt: number | null;
|
|
1179
|
+
readonly lastHeartbeatAt: number | null;
|
|
1180
|
+
readonly lastError: string | null;
|
|
1181
|
+
};
|
|
1182
|
+
};
|
|
1183
|
+
readonly completedEffectIds: readonly string[];
|
|
1184
|
+
readonly processedIdempotencyKeys: readonly string[];
|
|
1185
|
+
};
|
|
1186
|
+
readonly effects: readonly ({
|
|
1187
|
+
readonly type: "runtime.spawn";
|
|
1188
|
+
readonly childThreadId: string;
|
|
1189
|
+
readonly kind: string;
|
|
1190
|
+
readonly definitionName: string;
|
|
1191
|
+
readonly definitionVersion: string;
|
|
1192
|
+
readonly input: Schema.Json;
|
|
1193
|
+
} | {
|
|
1194
|
+
readonly type: "runtime.wait";
|
|
1195
|
+
readonly waitId: string;
|
|
1196
|
+
readonly on: {
|
|
1197
|
+
readonly type: string | readonly string[];
|
|
1198
|
+
readonly match?: Schema.Json | undefined;
|
|
1199
|
+
} | {
|
|
1200
|
+
readonly timerAt: number;
|
|
1201
|
+
};
|
|
1202
|
+
readonly tag?: Schema.Json | undefined;
|
|
1203
|
+
} | {
|
|
1204
|
+
readonly type: "runtime.emit";
|
|
1205
|
+
readonly event: {
|
|
1206
|
+
readonly type: string;
|
|
1207
|
+
readonly payload: Schema.Json;
|
|
1208
|
+
readonly threadId?: string | null | undefined;
|
|
1209
|
+
readonly parentThreadId?: string | null | undefined;
|
|
1210
|
+
readonly causationId?: string | null | undefined;
|
|
1211
|
+
readonly correlationId?: string | null | undefined;
|
|
1212
|
+
readonly effectId?: string | null | undefined;
|
|
1213
|
+
readonly origin?: {
|
|
1214
|
+
readonly type: "thread";
|
|
1215
|
+
readonly threadId: string;
|
|
1216
|
+
} | {
|
|
1217
|
+
readonly type: "external";
|
|
1218
|
+
readonly actorId?: string | undefined;
|
|
1219
|
+
} | {
|
|
1220
|
+
readonly type: "system";
|
|
1221
|
+
} | undefined;
|
|
1222
|
+
readonly ephemeral?: boolean | undefined;
|
|
1223
|
+
readonly id?: string | undefined;
|
|
1224
|
+
readonly ts?: number | undefined;
|
|
1225
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
1226
|
+
};
|
|
1227
|
+
readonly tag?: string | undefined;
|
|
1228
|
+
} | {
|
|
1229
|
+
readonly type: "runtime.complete";
|
|
1230
|
+
readonly output: Schema.Json;
|
|
1231
|
+
} | {
|
|
1232
|
+
readonly type: "runtime.fail";
|
|
1233
|
+
readonly error: string;
|
|
1234
|
+
} | {
|
|
1235
|
+
readonly type: "runtime.cancel";
|
|
1236
|
+
readonly threadId: string;
|
|
1237
|
+
readonly tag?: string | undefined;
|
|
1238
|
+
} | {
|
|
1239
|
+
readonly type: string;
|
|
1240
|
+
readonly input: Schema.Json;
|
|
1241
|
+
readonly tag?: string | undefined;
|
|
1242
|
+
})[];
|
|
1243
|
+
} | null;
|
|
50
1244
|
}>;
|
|
51
1245
|
project: (runId: string, name: string) => Promise<{
|
|
52
|
-
runId: string;
|
|
53
|
-
name: string;
|
|
54
|
-
value: unknown;
|
|
1246
|
+
readonly runId: string;
|
|
1247
|
+
readonly name: string;
|
|
1248
|
+
readonly value: unknown;
|
|
55
1249
|
}>;
|
|
56
1250
|
subscribeEvents: (runId: string, onEvent: (event: EventEnvelope) => void, reconnectDelayMs?: number) => () => void;
|
|
57
1251
|
/**
|
|
@@ -61,6 +1255,7 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
61
1255
|
streamRun: (args: {
|
|
62
1256
|
kind: string;
|
|
63
1257
|
definitionName: string;
|
|
1258
|
+
definitionVersion?: string;
|
|
64
1259
|
input?: JsonValue;
|
|
65
1260
|
runId?: string;
|
|
66
1261
|
}) => StreamHandle;
|