@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,7 @@
|
|
|
1
|
+
import { Popover as PopoverPrimitive } from 'radix-ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare function Popover(props: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function PopoverTrigger(props: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function PopoverAnchor(props: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
|
|
6
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
7
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as PopoverPrimitive } from 'radix-ui';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
function Popover(props) {
|
|
6
|
+
return _jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
7
|
+
}
|
|
8
|
+
function PopoverTrigger(props) {
|
|
9
|
+
return _jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
10
|
+
}
|
|
11
|
+
function PopoverAnchor(props) {
|
|
12
|
+
return _jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
13
|
+
}
|
|
14
|
+
function PopoverContent({ className, align = 'center', sideOffset = 6, ...props }) {
|
|
15
|
+
return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn('debugger-pop bg-card text-card-foreground border-border z-50 w-72 rounded-lg border p-3 shadow-xl shadow-black/30 outline-none', className), ...props }) }));
|
|
16
|
+
}
|
|
17
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { Group, Panel, Separator } from 'react-resizable-panels';
|
|
3
|
+
declare function ResizablePanelGroup({ className, ...props }: ComponentProps<typeof Group>): import("react").JSX.Element;
|
|
4
|
+
declare function ResizablePanel(props: ComponentProps<typeof Panel>): import("react").JSX.Element;
|
|
5
|
+
/** A hairline divider with a wider invisible hit area that brightens while hovered or dragged. */
|
|
6
|
+
declare function ResizableHandle({ className, ...props }: ComponentProps<typeof Separator>): import("react").JSX.Element;
|
|
7
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Group, Panel, Separator } from 'react-resizable-panels';
|
|
3
|
+
import { cn } from '../lib/cn.js';
|
|
4
|
+
function ResizablePanelGroup({ className, ...props }) {
|
|
5
|
+
return (_jsx(Group, { "data-slot": "resizable-panel-group", className: cn('flex size-full aria-[orientation=vertical]:flex-col', className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
function ResizablePanel(props) {
|
|
8
|
+
return _jsx(Panel, { "data-slot": "resizable-panel", ...props });
|
|
9
|
+
}
|
|
10
|
+
/** A hairline divider with a wider invisible hit area that brightens while hovered or dragged. */
|
|
11
|
+
function ResizableHandle({ className, ...props }) {
|
|
12
|
+
return (_jsx(Separator, { "data-slot": "resizable-handle", className: cn('bg-border relative w-px shrink-0 outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2', 'data-[separator=active]:bg-ring data-[separator=focus]:bg-ring data-[separator=hover]:bg-ring/60 transition-colors duration-150', className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
|
|
2
2
|
import type { ComponentProps, Ref, UIEventHandler } from 'react';
|
|
3
|
-
declare function ScrollArea({ className, children, viewportRef, onViewportScroll, horizontal, ...props }: ComponentProps<typeof ScrollAreaPrimitive.Root> & {
|
|
3
|
+
declare function ScrollArea({ className, children, viewportRef, viewportClassName, onViewportScroll, horizontal, ...props }: ComponentProps<typeof ScrollAreaPrimitive.Root> & {
|
|
4
4
|
viewportRef?: Ref<HTMLDivElement>;
|
|
5
|
+
viewportClassName?: string;
|
|
5
6
|
onViewportScroll?: UIEventHandler<HTMLDivElement>;
|
|
6
7
|
horizontal?: boolean;
|
|
7
8
|
}): import("react").JSX.Element;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
|
|
3
3
|
import { cn } from '../lib/cn.js';
|
|
4
|
-
function ScrollArea({ className, children, viewportRef, onViewportScroll, horizontal = false, ...props }) {
|
|
5
|
-
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", type: "
|
|
4
|
+
function ScrollArea({ className, children, viewportRef, viewportClassName, onViewportScroll, horizontal = false, ...props }) {
|
|
5
|
+
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", type: "hover", scrollHideDelay: 400, className: cn('relative overflow-hidden', className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { ref: viewportRef, "data-slot": "scroll-area-viewport", className: cn(
|
|
6
|
+
// Radix wraps content in `display: table`, which lets long lines widen the viewport.
|
|
7
|
+
'size-full overscroll-contain rounded-[inherit] outline-none [&>div]:block!', viewportClassName), onScroll: onViewportScroll, children: children }), _jsx(ScrollBar, {}), horizontal ? _jsx(ScrollBar, { orientation: "horizontal" }) : null, _jsx(ScrollAreaPrimitive.Corner, {})] }));
|
|
6
8
|
}
|
|
7
9
|
function ScrollBar({ className, orientation = 'vertical', ...props }) {
|
|
8
|
-
return (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { "data-slot": "scroll-area-scrollbar", orientation: orientation, className: cn('flex touch-none p-px select-none', orientation === 'vertical' && 'h-full w-2 border-l border-l-transparent', orientation === 'horizontal' && 'h-2 flex-col border-t border-t-transparent', className), ...props, children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { "data-slot": "scroll-area-thumb", className: "bg-
|
|
10
|
+
return (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { "data-slot": "scroll-area-scrollbar", orientation: orientation, className: cn('z-10 flex touch-none p-px transition-opacity duration-150 select-none data-[state=hidden]:opacity-0', orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent', orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent', className), ...props, children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { "data-slot": "scroll-area-thumb", className: "bg-foreground/15 hover:bg-foreground/25 relative flex-1 rounded-full transition-colors" }) }));
|
|
9
11
|
}
|
|
10
12
|
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'radix-ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare function Select(props: React.ComponentProps<typeof SelectPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function SelectValue(props: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
|
|
5
|
+
declare function SelectTrigger({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger>): React.JSX.Element;
|
|
6
|
+
declare function SelectContent({ className, children, position, sideOffset, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element;
|
|
7
|
+
declare function SelectItem({ className, children, description, ...props }: React.ComponentProps<typeof SelectPrimitive.Item> & {
|
|
8
|
+
description?: string;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check, ChevronDown } from 'lucide-react';
|
|
3
|
+
import { Select as SelectPrimitive } from 'radix-ui';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '../lib/cn.js';
|
|
6
|
+
function Select(props) {
|
|
7
|
+
return _jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
8
|
+
}
|
|
9
|
+
function SelectValue(props) {
|
|
10
|
+
return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
11
|
+
}
|
|
12
|
+
function SelectTrigger({ className, children, ...props }) {
|
|
13
|
+
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", className: cn('text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring/50 data-[state=open]:bg-accent data-[state=open]:text-foreground flex h-7 items-center gap-1 rounded-md px-2 text-xs whitespace-nowrap transition-colors outline-none focus-visible:ring-[3px] disabled:opacity-50', className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "size-3 opacity-60" }) })] }));
|
|
14
|
+
}
|
|
15
|
+
function SelectContent({ className, children, position = 'popper', sideOffset = 6, ...props }) {
|
|
16
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsx(SelectPrimitive.Content, { "data-slot": "select-content", position: position, sideOffset: sideOffset, className: cn('debugger-pop bg-card text-card-foreground border-border z-50 min-w-40 overflow-hidden rounded-lg border p-1 shadow-xl shadow-black/30', className), ...props, children: _jsx(SelectPrimitive.Viewport, { children: children }) }) }));
|
|
17
|
+
}
|
|
18
|
+
function SelectItem({ className, children, description, ...props }) {
|
|
19
|
+
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn('focus:bg-accent relative flex cursor-default flex-col items-start rounded-sm py-1.5 pr-2 pl-7 text-xs outline-none select-none data-disabled:opacity-50', className), ...props, children: [_jsx("span", { className: "absolute top-2 left-2 flex size-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { className: "size-3.5" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children }), description ? (_jsx("span", { className: "text-muted-foreground text-[11px]", children: description })) : null] }));
|
|
20
|
+
}
|
|
21
|
+
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
|
package/dist/debugger/ui/tabs.js
CHANGED
|
@@ -6,10 +6,10 @@ function Tabs({ className, ...props }) {
|
|
|
6
6
|
return (_jsx(TabsPrimitive.Root, { "data-slot": "tabs", className: cn('flex flex-col gap-2', className), ...props }));
|
|
7
7
|
}
|
|
8
8
|
function TabsList({ className, ...props }) {
|
|
9
|
-
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", className: cn('bg-secondary text-muted-foreground inline-flex h-
|
|
9
|
+
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", className: cn('bg-secondary/70 text-muted-foreground inline-flex h-7 w-fit shrink-0 items-center justify-center rounded-md p-0.5', className), ...props }));
|
|
10
10
|
}
|
|
11
11
|
function TabsTrigger({ className, ...props }) {
|
|
12
|
-
return (_jsx(TabsPrimitive.Trigger, { "data-slot": "tabs-trigger", className: cn('focus-visible:ring-ring/50 data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex h-
|
|
12
|
+
return (_jsx(TabsPrimitive.Trigger, { "data-slot": "tabs-trigger", className: cn('focus-visible:ring-ring/50 hover:text-foreground data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex h-6 items-center justify-center rounded-sm px-2 text-[11px] font-medium whitespace-nowrap transition-colors focus-visible:ring-[3px] focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm', className), ...props }));
|
|
13
13
|
}
|
|
14
14
|
function TabsContent({ className, ...props }) {
|
|
15
15
|
return (_jsx(TabsPrimitive.Content, { "data-slot": "tabs-content", className: cn('min-h-0 flex-1 outline-none', className), ...props }));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../lib/cn.js';
|
|
4
|
+
function Textarea({ className, ...props }) {
|
|
5
|
+
return (_jsx("textarea", { "data-slot": "textarea", className: cn('border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-2.5 py-2 text-[13px] leading-relaxed transition-[border-color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
export { Textarea };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Context, Layer } from 'effect';
|
|
2
|
+
import type { EvaluatorDefinition } from './definitions';
|
|
3
|
+
export interface EvaluatorDefinitionStore {
|
|
4
|
+
get(name: string): EvaluatorDefinition | undefined;
|
|
5
|
+
}
|
|
6
|
+
declare const EvaluatorDefinitionsTag_base: Context.ServiceClass<EvaluatorDefinitionsTag, "looms/EvaluatorDefinitions", EvaluatorDefinitionStore>;
|
|
7
|
+
export declare class EvaluatorDefinitionsTag extends EvaluatorDefinitionsTag_base {
|
|
8
|
+
}
|
|
9
|
+
export declare function makeEvaluatorDefinitionStore(definitions: ReadonlyArray<EvaluatorDefinition>): EvaluatorDefinitionStore;
|
|
10
|
+
export declare const EvaluatorDefinitionsLive: (definitions: ReadonlyArray<EvaluatorDefinition>) => Layer.Layer<EvaluatorDefinitionsTag, never, never>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Context, Layer } from 'effect';
|
|
2
|
+
export class EvaluatorDefinitionsTag extends Context.Service()('looms/EvaluatorDefinitions') {
|
|
3
|
+
}
|
|
4
|
+
export function makeEvaluatorDefinitionStore(definitions) {
|
|
5
|
+
const map = new Map(definitions.map((def) => [def.name, def]));
|
|
6
|
+
return { get: (name) => map.get(name) };
|
|
7
|
+
}
|
|
8
|
+
export const EvaluatorDefinitionsLive = (definitions) => Layer.succeed(EvaluatorDefinitionsTag, makeEvaluatorDefinitionStore(definitions));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import type { Schema } from 'effect';
|
|
3
|
+
import { type JsonValue } from '@swirls/looms/core';
|
|
4
|
+
import type { EvaluatorQuestions, EvaluatorRouteArgs, EvaluatorRouteDecision, EvaluatorSkipResult } from './types';
|
|
5
|
+
export interface EvaluatorDefinition<TName extends string = string, TInput = JsonValue> {
|
|
6
|
+
readonly kind: 'evaluator';
|
|
7
|
+
readonly name: TName;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
/** Provider model id. Omit it to use the adapter default. */
|
|
10
|
+
readonly model?: string;
|
|
11
|
+
readonly input?: StandardSchemaV1<any, TInput> | Schema.ConstraintDecoder<TInput>;
|
|
12
|
+
readonly questions: EvaluatorQuestions;
|
|
13
|
+
state?(this: void, input: TInput): string;
|
|
14
|
+
skipModel?(this: void, input: TInput): EvaluatorSkipResult | undefined;
|
|
15
|
+
route?(this: void, args: EvaluatorRouteArgs): EvaluatorRouteDecision;
|
|
16
|
+
}
|
|
17
|
+
export type AnyEvaluatorDefinition = EvaluatorDefinition;
|
|
18
|
+
export declare function defineEvaluator<TName extends string, TInput = JsonValue>(def: Omit<EvaluatorDefinition<TName, TInput>, 'kind'>): EvaluatorDefinition<TName, TInput>;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { EvaluatorDefinitionsTag } from './definitions-store';
|
|
3
|
+
import { EvaluatorTag } from './evaluator';
|
|
4
|
+
export declare const evaluateEffect: NoInfer<import("@swirls/looms/core").EffectDefinition<{
|
|
5
|
+
readonly evaluationId: string;
|
|
6
|
+
readonly definitionName?: string | undefined;
|
|
7
|
+
readonly input?: Schema.Json | undefined;
|
|
8
|
+
}, EvaluatorDefinitionsTag | EvaluatorTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
9
|
+
readonly type: "evaluator.evaluated";
|
|
10
|
+
readonly payload: {
|
|
11
|
+
readonly evaluationId: string;
|
|
12
|
+
readonly definitionName?: string | undefined;
|
|
13
|
+
readonly answers: {
|
|
14
|
+
readonly [x: string]: {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly value: boolean;
|
|
17
|
+
readonly probability: number;
|
|
18
|
+
} | {
|
|
19
|
+
readonly type: "choice";
|
|
20
|
+
readonly value: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly type: "score";
|
|
23
|
+
readonly value: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly route: string;
|
|
27
|
+
readonly reason: "model" | "skipped" | "unavailable" | "uncertain";
|
|
28
|
+
readonly usage?: {
|
|
29
|
+
readonly input: number;
|
|
30
|
+
readonly output: number;
|
|
31
|
+
} | undefined;
|
|
32
|
+
};
|
|
33
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
34
|
+
readonly type: "evaluator.requested";
|
|
35
|
+
readonly payload: {
|
|
36
|
+
readonly evaluationId: string;
|
|
37
|
+
readonly definitionName?: string | undefined;
|
|
38
|
+
readonly state: string;
|
|
39
|
+
readonly model?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
42
|
+
readonly type: "runtime.effect.ambiguous";
|
|
43
|
+
readonly payload: {
|
|
44
|
+
readonly effectId: string;
|
|
45
|
+
readonly attempt: number;
|
|
46
|
+
readonly error: string;
|
|
47
|
+
};
|
|
48
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
49
|
+
readonly type: "runtime.effect.attempt.started";
|
|
50
|
+
readonly payload: {
|
|
51
|
+
readonly effectId: string;
|
|
52
|
+
readonly attempt: number;
|
|
53
|
+
};
|
|
54
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
55
|
+
readonly type: "runtime.effect.cancel.requested";
|
|
56
|
+
readonly payload: {
|
|
57
|
+
readonly effectId: string;
|
|
58
|
+
readonly attempt: number;
|
|
59
|
+
readonly deadlineAt: number | null;
|
|
60
|
+
};
|
|
61
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
62
|
+
readonly type: "runtime.effect.cancelled";
|
|
63
|
+
readonly payload: {
|
|
64
|
+
readonly effectId: string;
|
|
65
|
+
readonly attempt: number;
|
|
66
|
+
};
|
|
67
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
68
|
+
readonly type: "runtime.effect.completed";
|
|
69
|
+
readonly payload: {
|
|
70
|
+
readonly effectId: string;
|
|
71
|
+
readonly attempt: number;
|
|
72
|
+
};
|
|
73
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
74
|
+
readonly type: "runtime.effect.dispatched";
|
|
75
|
+
readonly payload: {
|
|
76
|
+
readonly effectId: string;
|
|
77
|
+
readonly attempt: number;
|
|
78
|
+
readonly deadlineAt: number | null;
|
|
79
|
+
};
|
|
80
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
81
|
+
readonly type: "runtime.effect.failed";
|
|
82
|
+
readonly payload: {
|
|
83
|
+
readonly effectId: string;
|
|
84
|
+
readonly error: string;
|
|
85
|
+
};
|
|
86
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
87
|
+
readonly type: "runtime.effect.heartbeat";
|
|
88
|
+
readonly payload: {
|
|
89
|
+
readonly effectId: string;
|
|
90
|
+
readonly attempt: number;
|
|
91
|
+
readonly heartbeatAt: number;
|
|
92
|
+
readonly deadlineAt: number | null;
|
|
93
|
+
};
|
|
94
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
95
|
+
readonly type: "runtime.effect.queued";
|
|
96
|
+
readonly payload: {
|
|
97
|
+
readonly effectId: string;
|
|
98
|
+
readonly attempt: number;
|
|
99
|
+
readonly deadlineAt: number | null;
|
|
100
|
+
};
|
|
101
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
102
|
+
readonly type: "runtime.effect.retry.scheduled";
|
|
103
|
+
readonly payload: {
|
|
104
|
+
readonly effectId: string;
|
|
105
|
+
readonly attempt: number;
|
|
106
|
+
readonly nextAttemptAt: number;
|
|
107
|
+
readonly error: string;
|
|
108
|
+
};
|
|
109
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
110
|
+
readonly type: "runtime.effect.timed_out";
|
|
111
|
+
readonly payload: {
|
|
112
|
+
readonly effectId: string;
|
|
113
|
+
readonly attempt: number;
|
|
114
|
+
readonly timeout: string;
|
|
115
|
+
};
|
|
116
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
117
|
+
readonly type: "runtime.effect.worker.started";
|
|
118
|
+
readonly payload: {
|
|
119
|
+
readonly effectId: string;
|
|
120
|
+
readonly attempt: number;
|
|
121
|
+
readonly deadlineAt: number | null;
|
|
122
|
+
};
|
|
123
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
124
|
+
readonly type: "runtime.run.cancelled";
|
|
125
|
+
readonly payload: {
|
|
126
|
+
readonly reason?: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
129
|
+
readonly type: "runtime.run.completed";
|
|
130
|
+
readonly payload: {
|
|
131
|
+
readonly output: Schema.Json;
|
|
132
|
+
readonly error: string | null;
|
|
133
|
+
};
|
|
134
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
135
|
+
readonly type: "runtime.run.started";
|
|
136
|
+
readonly payload: {
|
|
137
|
+
readonly rootThreadId?: string | undefined;
|
|
138
|
+
readonly kind: string;
|
|
139
|
+
readonly definitionName: string;
|
|
140
|
+
readonly definitionVersion: string;
|
|
141
|
+
readonly input: Schema.Json;
|
|
142
|
+
readonly requestedThreadId?: string | null | undefined;
|
|
143
|
+
};
|
|
144
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
145
|
+
readonly type: "runtime.signal.received";
|
|
146
|
+
readonly payload: {
|
|
147
|
+
readonly signalType: string;
|
|
148
|
+
};
|
|
149
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
150
|
+
readonly type: "runtime.snapshot.taken";
|
|
151
|
+
readonly payload: {
|
|
152
|
+
readonly seq: number;
|
|
153
|
+
readonly stateHash: string;
|
|
154
|
+
readonly state?: Schema.Json | undefined;
|
|
155
|
+
};
|
|
156
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
157
|
+
readonly type: "runtime.thread.cancel.requested";
|
|
158
|
+
readonly payload: {
|
|
159
|
+
readonly threadId: string;
|
|
160
|
+
};
|
|
161
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
162
|
+
readonly type: "runtime.thread.cancelled";
|
|
163
|
+
readonly payload: {
|
|
164
|
+
readonly threadId: string;
|
|
165
|
+
readonly reason?: string | undefined;
|
|
166
|
+
};
|
|
167
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
168
|
+
readonly type: "runtime.thread.completed";
|
|
169
|
+
readonly payload: {
|
|
170
|
+
readonly threadId: string;
|
|
171
|
+
readonly output: Schema.Json;
|
|
172
|
+
};
|
|
173
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
174
|
+
readonly type: "runtime.thread.failed";
|
|
175
|
+
readonly payload: {
|
|
176
|
+
readonly threadId: string;
|
|
177
|
+
readonly error: string;
|
|
178
|
+
};
|
|
179
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
180
|
+
readonly type: "runtime.thread.started";
|
|
181
|
+
readonly payload: {
|
|
182
|
+
readonly threadId: string;
|
|
183
|
+
readonly kind: string;
|
|
184
|
+
readonly definitionName: string;
|
|
185
|
+
readonly definitionVersion: string;
|
|
186
|
+
readonly input: Schema.Json;
|
|
187
|
+
readonly parentThreadId: string | null;
|
|
188
|
+
};
|
|
189
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
190
|
+
readonly type: "runtime.timer.fired";
|
|
191
|
+
readonly payload: {
|
|
192
|
+
readonly timerId: string;
|
|
193
|
+
readonly waitId: string;
|
|
194
|
+
};
|
|
195
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
196
|
+
readonly type: "runtime.timer.set";
|
|
197
|
+
readonly payload: {
|
|
198
|
+
readonly timerId: string;
|
|
199
|
+
readonly waitId: string;
|
|
200
|
+
readonly wakeAt: number;
|
|
201
|
+
};
|
|
202
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
203
|
+
readonly type: "runtime.wait.registered";
|
|
204
|
+
readonly payload: {
|
|
205
|
+
readonly waitId: string;
|
|
206
|
+
readonly threadId?: string | undefined;
|
|
207
|
+
readonly on: {
|
|
208
|
+
readonly type: string | readonly string[];
|
|
209
|
+
readonly match?: Schema.Json | undefined;
|
|
210
|
+
} | {
|
|
211
|
+
readonly timerAt: number;
|
|
212
|
+
};
|
|
213
|
+
readonly tag?: Schema.Json | undefined;
|
|
214
|
+
};
|
|
215
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
216
|
+
readonly type: "runtime.wait.satisfied";
|
|
217
|
+
readonly payload: {
|
|
218
|
+
readonly waitId: string;
|
|
219
|
+
readonly tag?: Schema.Json | undefined;
|
|
220
|
+
readonly event: {
|
|
221
|
+
readonly id: string;
|
|
222
|
+
readonly type: string;
|
|
223
|
+
readonly payload: Schema.Json;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
})>>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Effect, Schema } from 'effect';
|
|
2
|
+
import { stringifyJson, validateInputEffect } from '@swirls/looms/core';
|
|
3
|
+
import { EvaluatorDefinitionsTag } from './definitions-store.js';
|
|
4
|
+
import { EvaluatorTag } from './evaluator.js';
|
|
5
|
+
import { evaluatorModule } from './scope.js';
|
|
6
|
+
const EvaluateInput = Schema.Struct({
|
|
7
|
+
evaluationId: Schema.String,
|
|
8
|
+
definitionName: Schema.optional(Schema.String),
|
|
9
|
+
input: Schema.optional(Schema.Json),
|
|
10
|
+
});
|
|
11
|
+
function errorMessage(cause) {
|
|
12
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
13
|
+
}
|
|
14
|
+
function capture(run) {
|
|
15
|
+
return Effect.try({
|
|
16
|
+
try: run,
|
|
17
|
+
catch: errorMessage,
|
|
18
|
+
}).pipe(Effect.match({
|
|
19
|
+
onFailure: (error) => ({ ok: false, error }),
|
|
20
|
+
onSuccess: (value) => ({ ok: true, value }),
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
function failed(threadId, error) {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
type: 'runtime.thread.failed',
|
|
27
|
+
payload: { threadId, error },
|
|
28
|
+
threadId,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
export const evaluateEffect = evaluatorModule.effect({
|
|
33
|
+
type: 'evaluator.evaluate',
|
|
34
|
+
input: EvaluateInput,
|
|
35
|
+
execute: (input, ctx) => Effect.gen(function* () {
|
|
36
|
+
const threadId = ctx.threadId;
|
|
37
|
+
const definitions = yield* EvaluatorDefinitionsTag;
|
|
38
|
+
const evaluator = yield* EvaluatorTag;
|
|
39
|
+
const definition = input.definitionName ? definitions.get(input.definitionName) : undefined;
|
|
40
|
+
if (!definition) {
|
|
41
|
+
const name = input.definitionName ?? 'unknown';
|
|
42
|
+
return failed(threadId, `Unknown evaluator definition for ${name}`);
|
|
43
|
+
}
|
|
44
|
+
const rawInput = input.input ?? null;
|
|
45
|
+
const validated = definition.input
|
|
46
|
+
? yield* validateInputEffect(definition.input, rawInput).pipe(Effect.match({
|
|
47
|
+
onFailure: (error) => ({ ok: false, error: error.message }),
|
|
48
|
+
onSuccess: (value) => ({ ok: true, value }),
|
|
49
|
+
}))
|
|
50
|
+
: { ok: true, value: rawInput };
|
|
51
|
+
if (!validated.ok) {
|
|
52
|
+
return failed(threadId, validated.error);
|
|
53
|
+
}
|
|
54
|
+
const subject = validated.value;
|
|
55
|
+
if (Object.keys(definition.questions).length === 0) {
|
|
56
|
+
return failed(threadId, 'Evaluator is missing questions');
|
|
57
|
+
}
|
|
58
|
+
const renderState = definition.state;
|
|
59
|
+
const stateText = renderState
|
|
60
|
+
? yield* capture(() => renderState(subject))
|
|
61
|
+
: { ok: true, value: stringifyJson(subject) };
|
|
62
|
+
if (!stateText.ok) {
|
|
63
|
+
return failed(threadId, stateText.error);
|
|
64
|
+
}
|
|
65
|
+
const events = [
|
|
66
|
+
{
|
|
67
|
+
type: 'evaluator.requested',
|
|
68
|
+
payload: {
|
|
69
|
+
evaluationId: input.evaluationId,
|
|
70
|
+
definitionName: input.definitionName,
|
|
71
|
+
state: stateText.value,
|
|
72
|
+
model: definition.model,
|
|
73
|
+
},
|
|
74
|
+
threadId,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
const skipModel = definition.skipModel;
|
|
78
|
+
const skipped = skipModel
|
|
79
|
+
? yield* capture(() => skipModel(subject))
|
|
80
|
+
: { ok: true, value: undefined };
|
|
81
|
+
if (!skipped.ok) {
|
|
82
|
+
return failed(threadId, skipped.error);
|
|
83
|
+
}
|
|
84
|
+
let answers = {};
|
|
85
|
+
let usage;
|
|
86
|
+
let decision = { route: 'continue', reason: 'unavailable' };
|
|
87
|
+
if (skipped.value) {
|
|
88
|
+
answers = skipped.value.answers ?? {};
|
|
89
|
+
decision = { route: skipped.value.route, reason: skipped.value.reason };
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const evaluated = yield* evaluator
|
|
93
|
+
.evaluate({
|
|
94
|
+
model: definition.model,
|
|
95
|
+
state: stateText.value,
|
|
96
|
+
questions: definition.questions,
|
|
97
|
+
})
|
|
98
|
+
.pipe(Effect.match({
|
|
99
|
+
onFailure: () => ({ ok: false }),
|
|
100
|
+
onSuccess: (value) => ({ ok: true, value }),
|
|
101
|
+
}));
|
|
102
|
+
if (evaluated.ok) {
|
|
103
|
+
answers = evaluated.value.answers;
|
|
104
|
+
usage = evaluated.value.usage;
|
|
105
|
+
const route = definition.route;
|
|
106
|
+
if (route) {
|
|
107
|
+
const routed = yield* capture(() => route({ answers, input: subject }));
|
|
108
|
+
if (!routed.ok) {
|
|
109
|
+
return failed(threadId, routed.error);
|
|
110
|
+
}
|
|
111
|
+
decision = { route: routed.value.route, reason: routed.value.reason ?? 'model' };
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
decision = { route: 'continue', reason: 'model' };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
events.push({
|
|
119
|
+
type: 'evaluator.evaluated',
|
|
120
|
+
payload: {
|
|
121
|
+
evaluationId: input.evaluationId,
|
|
122
|
+
definitionName: input.definitionName,
|
|
123
|
+
answers,
|
|
124
|
+
route: decision.route,
|
|
125
|
+
reason: decision.reason,
|
|
126
|
+
usage,
|
|
127
|
+
},
|
|
128
|
+
threadId,
|
|
129
|
+
});
|
|
130
|
+
return events;
|
|
131
|
+
}),
|
|
132
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from 'effect';
|
|
2
|
+
import type { EvaluatorAdapter } from './types';
|
|
3
|
+
declare const EvaluatorError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
4
|
+
readonly _tag: "EvaluatorError";
|
|
5
|
+
} & Readonly<A>;
|
|
6
|
+
export declare class EvaluatorError extends EvaluatorError_base<{
|
|
7
|
+
readonly cause: unknown;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
}> {
|
|
10
|
+
constructor(cause: unknown);
|
|
11
|
+
}
|
|
12
|
+
export interface EvaluatorService {
|
|
13
|
+
readonly evaluate: (args: Parameters<EvaluatorAdapter['evaluate']>[0]) => Effect.Effect<Awaited<ReturnType<EvaluatorAdapter['evaluate']>>, EvaluatorError>;
|
|
14
|
+
}
|
|
15
|
+
export declare function evaluatorFromAdapter(adapter: EvaluatorAdapter): EvaluatorService;
|
|
16
|
+
declare const EvaluatorTag_base: Context.ServiceClass<EvaluatorTag, "looms/Evaluator", EvaluatorService>;
|
|
17
|
+
export declare class EvaluatorTag extends EvaluatorTag_base {
|
|
18
|
+
}
|
|
19
|
+
export interface StubEvaluatorPolicy {
|
|
20
|
+
evaluate?: EvaluatorAdapter['evaluate'];
|
|
21
|
+
}
|
|
22
|
+
export declare const makeStubEvaluator: (policy?: StubEvaluatorPolicy) => EvaluatorService;
|
|
23
|
+
export declare const StubEvaluatorLive: (policy?: StubEvaluatorPolicy) => Layer.Layer<EvaluatorTag, never, never>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Context, Data, Effect, Layer } from 'effect';
|
|
2
|
+
export class EvaluatorError extends Data.TaggedError('EvaluatorError') {
|
|
3
|
+
constructor(cause) {
|
|
4
|
+
super({
|
|
5
|
+
cause,
|
|
6
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
7
|
+
});
|
|
8
|
+
this.name = 'EvaluatorError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function evaluatorFromAdapter(adapter) {
|
|
12
|
+
return {
|
|
13
|
+
evaluate: (args) => Effect.tryPromise({
|
|
14
|
+
try: () => adapter.evaluate(args),
|
|
15
|
+
catch: (cause) => new EvaluatorError(cause),
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export class EvaluatorTag extends Context.Service()('looms/Evaluator') {
|
|
20
|
+
}
|
|
21
|
+
function defaultStubEvaluate(args) {
|
|
22
|
+
const text = args.state.toLowerCase();
|
|
23
|
+
const high = /\b(error|fail|fatal|dispute|urgent)\b/.test(text);
|
|
24
|
+
const low = /\b(routine|resolved|duplicate)\b/.test(text);
|
|
25
|
+
const answers = Object.fromEntries(Object.entries(args.questions).map(([name, question]) => {
|
|
26
|
+
if (question.type === 'boolean') {
|
|
27
|
+
return [
|
|
28
|
+
name,
|
|
29
|
+
{
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
value: high,
|
|
32
|
+
probability: high ? 0.95 : low ? 0.02 : 0.4,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
if (question.type === 'choice') {
|
|
37
|
+
const allowed = Object.keys(question.criteria);
|
|
38
|
+
const preferred = high ? ['critical', 'high'] : low ? ['low'] : ['normal'];
|
|
39
|
+
const value = preferred.find((item) => allowed.includes(item)) ?? allowed[0] ?? 'low';
|
|
40
|
+
return [
|
|
41
|
+
name,
|
|
42
|
+
{
|
|
43
|
+
type: 'choice',
|
|
44
|
+
value,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
return [
|
|
49
|
+
name,
|
|
50
|
+
{
|
|
51
|
+
type: 'score',
|
|
52
|
+
value: high ? 4 : low ? 0 : 2,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
}));
|
|
56
|
+
return {
|
|
57
|
+
answers,
|
|
58
|
+
usage: { input: 0, output: 0 },
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export const makeStubEvaluator = (policy = {}) => ({
|
|
62
|
+
evaluate: (args) => Effect.tryPromise({
|
|
63
|
+
try: () => Promise.resolve((policy.evaluate ?? defaultStubEvaluate)(args)),
|
|
64
|
+
catch: (cause) => new EvaluatorError(cause),
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
67
|
+
export const StubEvaluatorLive = (policy) => Layer.succeed(EvaluatorTag, makeStubEvaluator(policy));
|