@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
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
import type { EvaluatorDefinition } from './definitions';
|
|
2
|
+
import { EvaluatorTag, type StubEvaluatorPolicy } from './evaluator';
|
|
3
|
+
import type { EvaluatorAdapter } from './types';
|
|
4
|
+
export interface EvaluatorModuleOptions {
|
|
5
|
+
readonly definitions?: readonly EvaluatorDefinition[];
|
|
6
|
+
/** Model adapter used for every evaluation. Defaults to a deterministic stub. */
|
|
7
|
+
readonly evaluator?: EvaluatorAdapter;
|
|
8
|
+
readonly evaluatorPolicy?: StubEvaluatorPolicy;
|
|
9
|
+
}
|
|
10
|
+
export declare function evaluator(options?: EvaluatorModuleOptions): import("@swirls/looms/core").RuntimeModule<"evaluator", import("@swirls/looms/core").EventCatalog<"evaluator", {
|
|
11
|
+
requested: import("effect/Schema").Struct<{
|
|
12
|
+
readonly evaluationId: import("effect/Schema").String;
|
|
13
|
+
readonly definitionName: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
14
|
+
readonly state: import("effect/Schema").String;
|
|
15
|
+
readonly model: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
16
|
+
}>;
|
|
17
|
+
evaluated: import("effect/Schema").Struct<{
|
|
18
|
+
readonly evaluationId: import("effect/Schema").String;
|
|
19
|
+
readonly definitionName: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
20
|
+
readonly answers: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
21
|
+
readonly type: import("effect/Schema").Literal<"boolean">;
|
|
22
|
+
readonly value: import("effect/Schema").Boolean;
|
|
23
|
+
readonly probability: import("effect/Schema").Finite;
|
|
24
|
+
}>, import("effect/Schema").Struct<{
|
|
25
|
+
readonly type: import("effect/Schema").Literal<"choice">;
|
|
26
|
+
readonly value: import("effect/Schema").String;
|
|
27
|
+
}>, import("effect/Schema").Struct<{
|
|
28
|
+
readonly type: import("effect/Schema").Literal<"score">;
|
|
29
|
+
readonly value: import("effect/Schema").Finite;
|
|
30
|
+
}>]>>;
|
|
31
|
+
readonly route: import("effect/Schema").String;
|
|
32
|
+
readonly reason: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"model">, import("effect/Schema").Literal<"uncertain">, import("effect/Schema").Literal<"skipped">, import("effect/Schema").Literal<"unavailable">]>;
|
|
33
|
+
readonly usage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
34
|
+
readonly input: import("effect/Schema").Finite;
|
|
35
|
+
readonly output: import("effect/Schema").Finite;
|
|
36
|
+
}>>;
|
|
37
|
+
}>;
|
|
38
|
+
}>, {
|
|
39
|
+
evaluate: import("@swirls/looms/core").EffectDefinition<{
|
|
40
|
+
readonly evaluationId: string;
|
|
41
|
+
readonly definitionName?: string | undefined;
|
|
42
|
+
readonly input?: import("effect/Schema").Json | undefined;
|
|
43
|
+
}, import("./definitions-store").EvaluatorDefinitionsTag | EvaluatorTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
44
|
+
readonly type: "evaluator.evaluated";
|
|
45
|
+
readonly payload: {
|
|
46
|
+
readonly evaluationId: string;
|
|
47
|
+
readonly definitionName?: string | undefined;
|
|
48
|
+
readonly answers: {
|
|
49
|
+
readonly [x: string]: {
|
|
50
|
+
readonly type: "boolean";
|
|
51
|
+
readonly value: boolean;
|
|
52
|
+
readonly probability: number;
|
|
53
|
+
} | {
|
|
54
|
+
readonly type: "choice";
|
|
55
|
+
readonly value: string;
|
|
56
|
+
} | {
|
|
57
|
+
readonly type: "score";
|
|
58
|
+
readonly value: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly route: string;
|
|
62
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
63
|
+
readonly usage?: {
|
|
64
|
+
readonly input: number;
|
|
65
|
+
readonly output: number;
|
|
66
|
+
} | undefined;
|
|
67
|
+
};
|
|
68
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
69
|
+
readonly type: "evaluator.requested";
|
|
70
|
+
readonly payload: {
|
|
71
|
+
readonly evaluationId: string;
|
|
72
|
+
readonly definitionName?: string | undefined;
|
|
73
|
+
readonly state: string;
|
|
74
|
+
readonly model?: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
77
|
+
readonly type: "runtime.effect.ambiguous";
|
|
78
|
+
readonly payload: {
|
|
79
|
+
readonly effectId: string;
|
|
80
|
+
readonly attempt: number;
|
|
81
|
+
readonly error: string;
|
|
82
|
+
};
|
|
83
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
84
|
+
readonly type: "runtime.effect.attempt.started";
|
|
85
|
+
readonly payload: {
|
|
86
|
+
readonly effectId: string;
|
|
87
|
+
readonly attempt: number;
|
|
88
|
+
};
|
|
89
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
90
|
+
readonly type: "runtime.effect.cancel.requested";
|
|
91
|
+
readonly payload: {
|
|
92
|
+
readonly effectId: string;
|
|
93
|
+
readonly attempt: number;
|
|
94
|
+
readonly deadlineAt: number | null;
|
|
95
|
+
};
|
|
96
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
97
|
+
readonly type: "runtime.effect.cancelled";
|
|
98
|
+
readonly payload: {
|
|
99
|
+
readonly effectId: string;
|
|
100
|
+
readonly attempt: number;
|
|
101
|
+
};
|
|
102
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
103
|
+
readonly type: "runtime.effect.completed";
|
|
104
|
+
readonly payload: {
|
|
105
|
+
readonly effectId: string;
|
|
106
|
+
readonly attempt: number;
|
|
107
|
+
};
|
|
108
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
109
|
+
readonly type: "runtime.effect.dispatched";
|
|
110
|
+
readonly payload: {
|
|
111
|
+
readonly effectId: string;
|
|
112
|
+
readonly attempt: number;
|
|
113
|
+
readonly deadlineAt: number | null;
|
|
114
|
+
};
|
|
115
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
116
|
+
readonly type: "runtime.effect.failed";
|
|
117
|
+
readonly payload: {
|
|
118
|
+
readonly effectId: string;
|
|
119
|
+
readonly error: string;
|
|
120
|
+
};
|
|
121
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
122
|
+
readonly type: "runtime.effect.heartbeat";
|
|
123
|
+
readonly payload: {
|
|
124
|
+
readonly effectId: string;
|
|
125
|
+
readonly attempt: number;
|
|
126
|
+
readonly heartbeatAt: number;
|
|
127
|
+
readonly deadlineAt: number | null;
|
|
128
|
+
};
|
|
129
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
130
|
+
readonly type: "runtime.effect.queued";
|
|
131
|
+
readonly payload: {
|
|
132
|
+
readonly effectId: string;
|
|
133
|
+
readonly attempt: number;
|
|
134
|
+
readonly deadlineAt: number | null;
|
|
135
|
+
};
|
|
136
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
137
|
+
readonly type: "runtime.effect.retry.scheduled";
|
|
138
|
+
readonly payload: {
|
|
139
|
+
readonly effectId: string;
|
|
140
|
+
readonly attempt: number;
|
|
141
|
+
readonly nextAttemptAt: number;
|
|
142
|
+
readonly error: string;
|
|
143
|
+
};
|
|
144
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
145
|
+
readonly type: "runtime.effect.timed_out";
|
|
146
|
+
readonly payload: {
|
|
147
|
+
readonly effectId: string;
|
|
148
|
+
readonly attempt: number;
|
|
149
|
+
readonly timeout: string;
|
|
150
|
+
};
|
|
151
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
152
|
+
readonly type: "runtime.effect.worker.started";
|
|
153
|
+
readonly payload: {
|
|
154
|
+
readonly effectId: string;
|
|
155
|
+
readonly attempt: number;
|
|
156
|
+
readonly deadlineAt: number | null;
|
|
157
|
+
};
|
|
158
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
159
|
+
readonly type: "runtime.run.cancelled";
|
|
160
|
+
readonly payload: {
|
|
161
|
+
readonly reason?: string | undefined;
|
|
162
|
+
};
|
|
163
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
164
|
+
readonly type: "runtime.run.completed";
|
|
165
|
+
readonly payload: {
|
|
166
|
+
readonly output: import("effect/Schema").Json;
|
|
167
|
+
readonly error: string | null;
|
|
168
|
+
};
|
|
169
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
170
|
+
readonly type: "runtime.run.started";
|
|
171
|
+
readonly payload: {
|
|
172
|
+
readonly rootThreadId?: string | undefined;
|
|
173
|
+
readonly kind: string;
|
|
174
|
+
readonly definitionName: string;
|
|
175
|
+
readonly definitionVersion: string;
|
|
176
|
+
readonly input: import("effect/Schema").Json;
|
|
177
|
+
readonly requestedThreadId?: string | null | undefined;
|
|
178
|
+
};
|
|
179
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
180
|
+
readonly type: "runtime.signal.received";
|
|
181
|
+
readonly payload: {
|
|
182
|
+
readonly signalType: string;
|
|
183
|
+
};
|
|
184
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
185
|
+
readonly type: "runtime.snapshot.taken";
|
|
186
|
+
readonly payload: {
|
|
187
|
+
readonly seq: number;
|
|
188
|
+
readonly stateHash: string;
|
|
189
|
+
readonly state?: import("effect/Schema").Json | undefined;
|
|
190
|
+
};
|
|
191
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
192
|
+
readonly type: "runtime.thread.cancel.requested";
|
|
193
|
+
readonly payload: {
|
|
194
|
+
readonly threadId: string;
|
|
195
|
+
};
|
|
196
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
197
|
+
readonly type: "runtime.thread.cancelled";
|
|
198
|
+
readonly payload: {
|
|
199
|
+
readonly threadId: string;
|
|
200
|
+
readonly reason?: string | undefined;
|
|
201
|
+
};
|
|
202
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
203
|
+
readonly type: "runtime.thread.completed";
|
|
204
|
+
readonly payload: {
|
|
205
|
+
readonly threadId: string;
|
|
206
|
+
readonly output: import("effect/Schema").Json;
|
|
207
|
+
};
|
|
208
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
209
|
+
readonly type: "runtime.thread.failed";
|
|
210
|
+
readonly payload: {
|
|
211
|
+
readonly threadId: string;
|
|
212
|
+
readonly error: string;
|
|
213
|
+
};
|
|
214
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
215
|
+
readonly type: "runtime.thread.started";
|
|
216
|
+
readonly payload: {
|
|
217
|
+
readonly threadId: string;
|
|
218
|
+
readonly kind: string;
|
|
219
|
+
readonly definitionName: string;
|
|
220
|
+
readonly definitionVersion: string;
|
|
221
|
+
readonly input: import("effect/Schema").Json;
|
|
222
|
+
readonly parentThreadId: string | null;
|
|
223
|
+
};
|
|
224
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
225
|
+
readonly type: "runtime.timer.fired";
|
|
226
|
+
readonly payload: {
|
|
227
|
+
readonly timerId: string;
|
|
228
|
+
readonly waitId: string;
|
|
229
|
+
};
|
|
230
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
231
|
+
readonly type: "runtime.timer.set";
|
|
232
|
+
readonly payload: {
|
|
233
|
+
readonly timerId: string;
|
|
234
|
+
readonly waitId: string;
|
|
235
|
+
readonly wakeAt: number;
|
|
236
|
+
};
|
|
237
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
238
|
+
readonly type: "runtime.wait.registered";
|
|
239
|
+
readonly payload: {
|
|
240
|
+
readonly waitId: string;
|
|
241
|
+
readonly threadId?: string | undefined;
|
|
242
|
+
readonly on: {
|
|
243
|
+
readonly type: string | readonly string[];
|
|
244
|
+
readonly match?: import("effect/Schema").Json | undefined;
|
|
245
|
+
} | {
|
|
246
|
+
readonly timerAt: number;
|
|
247
|
+
};
|
|
248
|
+
readonly tag?: import("effect/Schema").Json | undefined;
|
|
249
|
+
};
|
|
250
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
251
|
+
readonly type: "runtime.wait.satisfied";
|
|
252
|
+
readonly payload: {
|
|
253
|
+
readonly waitId: string;
|
|
254
|
+
readonly tag?: import("effect/Schema").Json | undefined;
|
|
255
|
+
readonly event: {
|
|
256
|
+
readonly id: string;
|
|
257
|
+
readonly type: string;
|
|
258
|
+
readonly payload: import("effect/Schema").Json;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
})>;
|
|
262
|
+
}, {
|
|
263
|
+
evaluator: import("@swirls/looms/core").ThreadDefinition<{
|
|
264
|
+
readonly definitionName?: string | undefined;
|
|
265
|
+
readonly input: import("effect/Schema").Json;
|
|
266
|
+
readonly evaluationId: string;
|
|
267
|
+
readonly dispatched: boolean;
|
|
268
|
+
readonly status: "completed" | "failed" | "pending";
|
|
269
|
+
readonly output: {
|
|
270
|
+
readonly evaluationId: string;
|
|
271
|
+
readonly definitionName?: string | undefined;
|
|
272
|
+
readonly answers: {
|
|
273
|
+
readonly [x: string]: {
|
|
274
|
+
readonly type: "boolean";
|
|
275
|
+
readonly value: boolean;
|
|
276
|
+
readonly probability: number;
|
|
277
|
+
} | {
|
|
278
|
+
readonly type: "choice";
|
|
279
|
+
readonly value: string;
|
|
280
|
+
} | {
|
|
281
|
+
readonly type: "score";
|
|
282
|
+
readonly value: number;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
readonly route: string;
|
|
286
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
287
|
+
readonly usage?: {
|
|
288
|
+
readonly input: number;
|
|
289
|
+
readonly output: number;
|
|
290
|
+
} | undefined;
|
|
291
|
+
} | null;
|
|
292
|
+
readonly error: string | null;
|
|
293
|
+
}>;
|
|
294
|
+
}, {
|
|
295
|
+
evaluations: import("@swirls/looms/core").ProjectionDefinition<{
|
|
296
|
+
readonly items: {
|
|
297
|
+
readonly evaluationId: string;
|
|
298
|
+
readonly definitionName?: string | undefined;
|
|
299
|
+
readonly answers: {
|
|
300
|
+
readonly [x: string]: {
|
|
301
|
+
readonly type: "boolean";
|
|
302
|
+
readonly value: boolean;
|
|
303
|
+
readonly probability: number;
|
|
304
|
+
} | {
|
|
305
|
+
readonly type: "choice";
|
|
306
|
+
readonly value: string;
|
|
307
|
+
} | {
|
|
308
|
+
readonly type: "score";
|
|
309
|
+
readonly value: number;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
readonly route: string;
|
|
313
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
314
|
+
readonly usage?: {
|
|
315
|
+
readonly input: number;
|
|
316
|
+
readonly output: number;
|
|
317
|
+
} | undefined;
|
|
318
|
+
}[];
|
|
319
|
+
}>;
|
|
320
|
+
}, import("effect/Context").Service.Any> & {
|
|
321
|
+
readonly effects: {
|
|
322
|
+
evaluate: import("@swirls/looms/core").EffectDefinition<{
|
|
323
|
+
readonly evaluationId: string;
|
|
324
|
+
readonly definitionName?: string | undefined;
|
|
325
|
+
readonly input?: import("effect/Schema").Json | undefined;
|
|
326
|
+
}, import("./definitions-store").EvaluatorDefinitionsTag | EvaluatorTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
327
|
+
readonly type: "evaluator.evaluated";
|
|
328
|
+
readonly payload: {
|
|
329
|
+
readonly evaluationId: string;
|
|
330
|
+
readonly definitionName?: string | undefined;
|
|
331
|
+
readonly answers: {
|
|
332
|
+
readonly [x: string]: {
|
|
333
|
+
readonly type: "boolean";
|
|
334
|
+
readonly value: boolean;
|
|
335
|
+
readonly probability: number;
|
|
336
|
+
} | {
|
|
337
|
+
readonly type: "choice";
|
|
338
|
+
readonly value: string;
|
|
339
|
+
} | {
|
|
340
|
+
readonly type: "score";
|
|
341
|
+
readonly value: number;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
readonly route: string;
|
|
345
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
346
|
+
readonly usage?: {
|
|
347
|
+
readonly input: number;
|
|
348
|
+
readonly output: number;
|
|
349
|
+
} | undefined;
|
|
350
|
+
};
|
|
351
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
352
|
+
readonly type: "evaluator.requested";
|
|
353
|
+
readonly payload: {
|
|
354
|
+
readonly evaluationId: string;
|
|
355
|
+
readonly definitionName?: string | undefined;
|
|
356
|
+
readonly state: string;
|
|
357
|
+
readonly model?: string | undefined;
|
|
358
|
+
};
|
|
359
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
360
|
+
readonly type: "runtime.effect.ambiguous";
|
|
361
|
+
readonly payload: {
|
|
362
|
+
readonly effectId: string;
|
|
363
|
+
readonly attempt: number;
|
|
364
|
+
readonly error: string;
|
|
365
|
+
};
|
|
366
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
367
|
+
readonly type: "runtime.effect.attempt.started";
|
|
368
|
+
readonly payload: {
|
|
369
|
+
readonly effectId: string;
|
|
370
|
+
readonly attempt: number;
|
|
371
|
+
};
|
|
372
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
373
|
+
readonly type: "runtime.effect.cancel.requested";
|
|
374
|
+
readonly payload: {
|
|
375
|
+
readonly effectId: string;
|
|
376
|
+
readonly attempt: number;
|
|
377
|
+
readonly deadlineAt: number | null;
|
|
378
|
+
};
|
|
379
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
380
|
+
readonly type: "runtime.effect.cancelled";
|
|
381
|
+
readonly payload: {
|
|
382
|
+
readonly effectId: string;
|
|
383
|
+
readonly attempt: number;
|
|
384
|
+
};
|
|
385
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
386
|
+
readonly type: "runtime.effect.completed";
|
|
387
|
+
readonly payload: {
|
|
388
|
+
readonly effectId: string;
|
|
389
|
+
readonly attempt: number;
|
|
390
|
+
};
|
|
391
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
392
|
+
readonly type: "runtime.effect.dispatched";
|
|
393
|
+
readonly payload: {
|
|
394
|
+
readonly effectId: string;
|
|
395
|
+
readonly attempt: number;
|
|
396
|
+
readonly deadlineAt: number | null;
|
|
397
|
+
};
|
|
398
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
399
|
+
readonly type: "runtime.effect.failed";
|
|
400
|
+
readonly payload: {
|
|
401
|
+
readonly effectId: string;
|
|
402
|
+
readonly error: string;
|
|
403
|
+
};
|
|
404
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
405
|
+
readonly type: "runtime.effect.heartbeat";
|
|
406
|
+
readonly payload: {
|
|
407
|
+
readonly effectId: string;
|
|
408
|
+
readonly attempt: number;
|
|
409
|
+
readonly heartbeatAt: number;
|
|
410
|
+
readonly deadlineAt: number | null;
|
|
411
|
+
};
|
|
412
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
413
|
+
readonly type: "runtime.effect.queued";
|
|
414
|
+
readonly payload: {
|
|
415
|
+
readonly effectId: string;
|
|
416
|
+
readonly attempt: number;
|
|
417
|
+
readonly deadlineAt: number | null;
|
|
418
|
+
};
|
|
419
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
420
|
+
readonly type: "runtime.effect.retry.scheduled";
|
|
421
|
+
readonly payload: {
|
|
422
|
+
readonly effectId: string;
|
|
423
|
+
readonly attempt: number;
|
|
424
|
+
readonly nextAttemptAt: number;
|
|
425
|
+
readonly error: string;
|
|
426
|
+
};
|
|
427
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
428
|
+
readonly type: "runtime.effect.timed_out";
|
|
429
|
+
readonly payload: {
|
|
430
|
+
readonly effectId: string;
|
|
431
|
+
readonly attempt: number;
|
|
432
|
+
readonly timeout: string;
|
|
433
|
+
};
|
|
434
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
435
|
+
readonly type: "runtime.effect.worker.started";
|
|
436
|
+
readonly payload: {
|
|
437
|
+
readonly effectId: string;
|
|
438
|
+
readonly attempt: number;
|
|
439
|
+
readonly deadlineAt: number | null;
|
|
440
|
+
};
|
|
441
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
442
|
+
readonly type: "runtime.run.cancelled";
|
|
443
|
+
readonly payload: {
|
|
444
|
+
readonly reason?: string | undefined;
|
|
445
|
+
};
|
|
446
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
447
|
+
readonly type: "runtime.run.completed";
|
|
448
|
+
readonly payload: {
|
|
449
|
+
readonly output: import("effect/Schema").Json;
|
|
450
|
+
readonly error: string | null;
|
|
451
|
+
};
|
|
452
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
453
|
+
readonly type: "runtime.run.started";
|
|
454
|
+
readonly payload: {
|
|
455
|
+
readonly rootThreadId?: string | undefined;
|
|
456
|
+
readonly kind: string;
|
|
457
|
+
readonly definitionName: string;
|
|
458
|
+
readonly definitionVersion: string;
|
|
459
|
+
readonly input: import("effect/Schema").Json;
|
|
460
|
+
readonly requestedThreadId?: string | null | undefined;
|
|
461
|
+
};
|
|
462
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
463
|
+
readonly type: "runtime.signal.received";
|
|
464
|
+
readonly payload: {
|
|
465
|
+
readonly signalType: string;
|
|
466
|
+
};
|
|
467
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
468
|
+
readonly type: "runtime.snapshot.taken";
|
|
469
|
+
readonly payload: {
|
|
470
|
+
readonly seq: number;
|
|
471
|
+
readonly stateHash: string;
|
|
472
|
+
readonly state?: import("effect/Schema").Json | undefined;
|
|
473
|
+
};
|
|
474
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
475
|
+
readonly type: "runtime.thread.cancel.requested";
|
|
476
|
+
readonly payload: {
|
|
477
|
+
readonly threadId: string;
|
|
478
|
+
};
|
|
479
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
480
|
+
readonly type: "runtime.thread.cancelled";
|
|
481
|
+
readonly payload: {
|
|
482
|
+
readonly threadId: string;
|
|
483
|
+
readonly reason?: string | undefined;
|
|
484
|
+
};
|
|
485
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
486
|
+
readonly type: "runtime.thread.completed";
|
|
487
|
+
readonly payload: {
|
|
488
|
+
readonly threadId: string;
|
|
489
|
+
readonly output: import("effect/Schema").Json;
|
|
490
|
+
};
|
|
491
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
492
|
+
readonly type: "runtime.thread.failed";
|
|
493
|
+
readonly payload: {
|
|
494
|
+
readonly threadId: string;
|
|
495
|
+
readonly error: string;
|
|
496
|
+
};
|
|
497
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
498
|
+
readonly type: "runtime.thread.started";
|
|
499
|
+
readonly payload: {
|
|
500
|
+
readonly threadId: string;
|
|
501
|
+
readonly kind: string;
|
|
502
|
+
readonly definitionName: string;
|
|
503
|
+
readonly definitionVersion: string;
|
|
504
|
+
readonly input: import("effect/Schema").Json;
|
|
505
|
+
readonly parentThreadId: string | null;
|
|
506
|
+
};
|
|
507
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
508
|
+
readonly type: "runtime.timer.fired";
|
|
509
|
+
readonly payload: {
|
|
510
|
+
readonly timerId: string;
|
|
511
|
+
readonly waitId: string;
|
|
512
|
+
};
|
|
513
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
514
|
+
readonly type: "runtime.timer.set";
|
|
515
|
+
readonly payload: {
|
|
516
|
+
readonly timerId: string;
|
|
517
|
+
readonly waitId: string;
|
|
518
|
+
readonly wakeAt: number;
|
|
519
|
+
};
|
|
520
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
521
|
+
readonly type: "runtime.wait.registered";
|
|
522
|
+
readonly payload: {
|
|
523
|
+
readonly waitId: string;
|
|
524
|
+
readonly threadId?: string | undefined;
|
|
525
|
+
readonly on: {
|
|
526
|
+
readonly type: string | readonly string[];
|
|
527
|
+
readonly match?: import("effect/Schema").Json | undefined;
|
|
528
|
+
} | {
|
|
529
|
+
readonly timerAt: number;
|
|
530
|
+
};
|
|
531
|
+
readonly tag?: import("effect/Schema").Json | undefined;
|
|
532
|
+
};
|
|
533
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
534
|
+
readonly type: "runtime.wait.satisfied";
|
|
535
|
+
readonly payload: {
|
|
536
|
+
readonly waitId: string;
|
|
537
|
+
readonly tag?: import("effect/Schema").Json | undefined;
|
|
538
|
+
readonly event: {
|
|
539
|
+
readonly id: string;
|
|
540
|
+
readonly type: string;
|
|
541
|
+
readonly payload: import("effect/Schema").Json;
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
})>;
|
|
545
|
+
};
|
|
546
|
+
readonly threads: {
|
|
547
|
+
evaluator: import("@swirls/looms/core").ThreadDefinition<{
|
|
548
|
+
readonly definitionName?: string | undefined;
|
|
549
|
+
readonly input: import("effect/Schema").Json;
|
|
550
|
+
readonly evaluationId: string;
|
|
551
|
+
readonly dispatched: boolean;
|
|
552
|
+
readonly status: "completed" | "failed" | "pending";
|
|
553
|
+
readonly output: {
|
|
554
|
+
readonly evaluationId: string;
|
|
555
|
+
readonly definitionName?: string | undefined;
|
|
556
|
+
readonly answers: {
|
|
557
|
+
readonly [x: string]: {
|
|
558
|
+
readonly type: "boolean";
|
|
559
|
+
readonly value: boolean;
|
|
560
|
+
readonly probability: number;
|
|
561
|
+
} | {
|
|
562
|
+
readonly type: "choice";
|
|
563
|
+
readonly value: string;
|
|
564
|
+
} | {
|
|
565
|
+
readonly type: "score";
|
|
566
|
+
readonly value: number;
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
readonly route: string;
|
|
570
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
571
|
+
readonly usage?: {
|
|
572
|
+
readonly input: number;
|
|
573
|
+
readonly output: number;
|
|
574
|
+
} | undefined;
|
|
575
|
+
} | null;
|
|
576
|
+
readonly error: string | null;
|
|
577
|
+
}>;
|
|
578
|
+
};
|
|
579
|
+
readonly projections: {
|
|
580
|
+
evaluations: import("@swirls/looms/core").ProjectionDefinition<{
|
|
581
|
+
readonly items: {
|
|
582
|
+
readonly evaluationId: string;
|
|
583
|
+
readonly definitionName?: string | undefined;
|
|
584
|
+
readonly answers: {
|
|
585
|
+
readonly [x: string]: {
|
|
586
|
+
readonly type: "boolean";
|
|
587
|
+
readonly value: boolean;
|
|
588
|
+
readonly probability: number;
|
|
589
|
+
} | {
|
|
590
|
+
readonly type: "choice";
|
|
591
|
+
readonly value: string;
|
|
592
|
+
} | {
|
|
593
|
+
readonly type: "score";
|
|
594
|
+
readonly value: number;
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
readonly route: string;
|
|
598
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
599
|
+
readonly usage?: {
|
|
600
|
+
readonly input: number;
|
|
601
|
+
readonly output: number;
|
|
602
|
+
} | undefined;
|
|
603
|
+
}[];
|
|
604
|
+
}>;
|
|
605
|
+
};
|
|
606
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Layer } from 'effect';
|
|
2
|
+
import { defineModule } from '@swirls/looms/core';
|
|
3
|
+
import { EvaluatorDefinitionsLive } from './definitions-store.js';
|
|
4
|
+
import { evaluateEffect } from './effects.js';
|
|
5
|
+
import { evaluatorFromAdapter, EvaluatorTag, StubEvaluatorLive, } from './evaluator.js';
|
|
6
|
+
import { evaluations } from './projections.js';
|
|
7
|
+
import { evaluatorModule } from './scope.js';
|
|
8
|
+
import { evaluatorThread } from './threads.js';
|
|
9
|
+
export function evaluator(options = {}) {
|
|
10
|
+
const definitions = options.definitions ?? [];
|
|
11
|
+
const evaluatorLayer = options.evaluator
|
|
12
|
+
? Layer.succeed(EvaluatorTag, evaluatorFromAdapter(options.evaluator))
|
|
13
|
+
: StubEvaluatorLive(options.evaluatorPolicy);
|
|
14
|
+
return defineModule(evaluatorModule, () => ({
|
|
15
|
+
definitions,
|
|
16
|
+
threads: { evaluator: evaluatorThread },
|
|
17
|
+
effects: {
|
|
18
|
+
evaluate: evaluateEffect,
|
|
19
|
+
},
|
|
20
|
+
projections: {
|
|
21
|
+
evaluations,
|
|
22
|
+
},
|
|
23
|
+
services: () => Layer.merge(evaluatorLayer, EvaluatorDefinitionsLive(definitions)),
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
export declare const EvaluationsSchema: Schema.Struct<{
|
|
3
|
+
readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
4
|
+
readonly evaluationId: Schema.String;
|
|
5
|
+
readonly definitionName: Schema.optional<Schema.String>;
|
|
6
|
+
readonly answers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
|
|
7
|
+
readonly type: Schema.Literal<"boolean">;
|
|
8
|
+
readonly value: Schema.Boolean;
|
|
9
|
+
readonly probability: Schema.Finite;
|
|
10
|
+
}>, Schema.Struct<{
|
|
11
|
+
readonly type: Schema.Literal<"choice">;
|
|
12
|
+
readonly value: Schema.String;
|
|
13
|
+
}>, Schema.Struct<{
|
|
14
|
+
readonly type: Schema.Literal<"score">;
|
|
15
|
+
readonly value: Schema.Finite;
|
|
16
|
+
}>]>>;
|
|
17
|
+
readonly route: Schema.String;
|
|
18
|
+
readonly reason: Schema.Union<readonly [Schema.Literal<"model">, Schema.Literal<"uncertain">, Schema.Literal<"skipped">, Schema.Literal<"unavailable">]>;
|
|
19
|
+
readonly usage: Schema.optional<Schema.Struct<{
|
|
20
|
+
readonly input: Schema.Finite;
|
|
21
|
+
readonly output: Schema.Finite;
|
|
22
|
+
}>>;
|
|
23
|
+
}>>>;
|
|
24
|
+
}>;
|
|
25
|
+
export type EvaluationsState = Schema.Schema.Type<typeof EvaluationsSchema>;
|
|
26
|
+
export declare const evaluations: import("@swirls/looms/core").ProjectionDefinition<{
|
|
27
|
+
readonly items: {
|
|
28
|
+
readonly evaluationId: string;
|
|
29
|
+
readonly definitionName?: string | undefined;
|
|
30
|
+
readonly answers: {
|
|
31
|
+
readonly [x: string]: {
|
|
32
|
+
readonly type: "boolean";
|
|
33
|
+
readonly value: boolean;
|
|
34
|
+
readonly probability: number;
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "choice";
|
|
37
|
+
readonly value: string;
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: "score";
|
|
40
|
+
readonly value: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly route: string;
|
|
44
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
45
|
+
readonly usage?: {
|
|
46
|
+
readonly input: number;
|
|
47
|
+
readonly output: number;
|
|
48
|
+
} | undefined;
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|