@swirls/looms 0.0.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -2
- package/dist/actor/cell.d.ts +9 -4
- package/dist/actor/cell.js +7 -11
- package/dist/actor/host.d.ts +7 -3
- package/dist/actor/host.js +57 -33
- package/dist/actor/index.d.ts +1 -1
- package/dist/actor/index.js +1 -1
- package/dist/actor/routing.d.ts +12 -1
- package/dist/actor/routing.js +57 -51
- package/dist/agent/agent-session.d.ts +5 -0
- package/dist/agent/agent-session.js +270 -0
- package/dist/agent/debugger/agent-chat.d.ts +2 -0
- package/dist/agent/debugger/agent-chat.js +176 -0
- package/dist/agent/debugger/index.d.ts +5 -0
- package/dist/agent/debugger/index.js +19 -0
- package/dist/agent/debugger/summarize.d.ts +2 -0
- package/dist/agent/debugger/summarize.js +51 -0
- package/dist/agent/debugger/token-usage.d.ts +3 -0
- package/dist/agent/debugger/token-usage.js +11 -0
- package/dist/agent/definitions-store.d.ts +2 -3
- package/dist/agent/definitions-store.js +2 -4
- package/dist/agent/definitions.d.ts +47 -29
- package/dist/agent/definitions.js +39 -12
- package/dist/agent/effects.d.ts +359 -2
- package/dist/agent/effects.js +60 -34
- package/dist/agent/events.d.ts +175 -19
- package/dist/agent/events.js +45 -10
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +1 -0
- package/dist/agent/llm.d.ts +11 -2
- package/dist/agent/llm.js +13 -3
- package/dist/agent/module.d.ts +812 -78
- package/dist/agent/module.js +16 -4
- package/dist/agent/scope.d.ts +174 -18
- package/dist/agent/signals.d.ts +26 -1
- package/dist/agent/signals.js +79 -0
- package/dist/agent/threads.d.ts +3 -33
- package/dist/agent/threads.js +20 -25
- package/dist/agent/tool-schema.d.ts +1 -17
- package/dist/agent/tool-schema.js +3 -43
- package/dist/agent/types.d.ts +49 -4
- package/dist/agent/types.js +5 -5
- package/dist/ai-vercel/index.d.ts +1 -0
- package/dist/ai-vercel/index.js +1 -0
- package/dist/ai-vercel/messages.js +22 -7
- package/dist/ai-vercel/vercel-evaluator.d.ts +36 -0
- package/dist/ai-vercel/vercel-evaluator.js +73 -0
- package/dist/ai-vercel/vercel-llm.js +64 -44
- package/dist/approval/debugger/approvals-view.d.ts +3 -0
- package/dist/approval/debugger/approvals-view.js +16 -0
- package/dist/approval/debugger/index.d.ts +4 -0
- package/dist/approval/debugger/index.js +11 -0
- package/dist/approval/debugger/summarize.d.ts +2 -0
- package/dist/approval/debugger/summarize.js +17 -0
- package/dist/approval/effects.d.ts +89 -0
- package/dist/approval/module.d.ts +179 -29
- package/dist/approval/projections.d.ts +0 -14
- package/dist/approval/projections.js +20 -3
- package/dist/approval/signals.d.ts +2 -0
- package/dist/approval/signals.js +18 -2
- package/dist/cli/cli.js +2 -0
- package/dist/cli/commands.js +12 -16
- package/dist/client/client.d.ts +1213 -18
- package/dist/client/client.js +120 -120
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/sse.d.ts +13 -0
- package/dist/client/sse.js +38 -44
- package/dist/cloudflare/alarm-scheduler.d.ts +12 -2
- package/dist/cloudflare/alarm-scheduler.js +34 -7
- package/dist/cloudflare/durable-object.d.ts +10 -2
- package/dist/cloudflare/durable-object.js +59 -28
- package/dist/cloudflare/event-store.d.ts +7 -2
- package/dist/cloudflare/event-store.js +8 -7
- package/dist/cloudflare/index.d.ts +2 -2
- package/dist/cloudflare/index.js +2 -2
- package/dist/cloudflare/router.d.ts +1 -1
- package/dist/cloudflare/router.js +15 -16
- package/dist/core/catalog.d.ts +3 -3
- package/dist/core/catalog.js +2 -5
- package/dist/core/coalesce.js +5 -3
- package/dist/core/compose.d.ts +2 -1
- package/dist/core/compose.js +19 -2
- package/dist/core/debugger-host.d.ts +16 -0
- package/dist/core/debugger-host.js +1 -0
- package/dist/core/definition-store.d.ts +11 -0
- package/dist/core/definition-store.js +6 -0
- package/dist/core/effects.d.ts +127 -15
- package/dist/core/effects.js +89 -17
- package/dist/core/envelope.d.ts +27 -7
- package/dist/core/envelope.js +20 -6
- package/dist/core/event-codec.d.ts +4 -2
- package/dist/core/event-codec.js +10 -5
- package/dist/core/event-index.js +1 -3
- package/dist/core/fold.d.ts +3 -0
- package/dist/core/fold.js +171 -24
- package/dist/core/ids.d.ts +5 -0
- package/dist/core/ids.js +35 -2
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.js +6 -1
- package/dist/core/kind.d.ts +22 -0
- package/dist/core/kind.js +17 -0
- package/dist/core/limits.d.ts +34 -0
- package/dist/core/limits.js +46 -0
- package/dist/core/match.d.ts +1 -0
- package/dist/core/match.js +10 -1
- package/dist/core/module-scope.d.ts +22 -20
- package/dist/core/module-scope.js +38 -28
- package/dist/core/module.d.ts +18 -5
- package/dist/core/module.js +4 -0
- package/dist/core/projection.d.ts +13 -13
- package/dist/core/projection.js +9 -5
- package/dist/core/protocol.d.ts +68 -11
- package/dist/core/protocol.js +82 -11
- package/dist/core/published.d.ts +43 -0
- package/dist/core/published.js +44 -0
- package/dist/core/replay.d.ts +312 -3
- package/dist/core/replay.js +11 -1
- package/dist/core/schema.d.ts +11 -20
- package/dist/core/schema.js +63 -80
- package/dist/core/serialize.js +2 -4
- package/dist/core/snapshot-store.d.ts +6 -1
- package/dist/core/snapshot-store.js +15 -2
- package/dist/core/snapshots.d.ts +5 -1
- package/dist/core/snapshots.js +10 -15
- package/dist/core/sqlite-store.js +95 -11
- package/dist/core/state.d.ts +142 -4
- package/dist/core/state.js +78 -0
- package/dist/core/store.d.ts +38 -3
- package/dist/core/store.js +77 -22
- package/dist/core/thread.d.ts +10 -9
- package/dist/core/types.d.ts +5 -8
- package/dist/core/types.js +28 -24
- package/dist/core/validate-event.js +14 -4
- package/dist/core/worker-callback.d.ts +17 -0
- package/dist/core/worker-callback.js +1 -0
- package/dist/debugger/app/assets/index-B3Ah8WAE.css +2 -0
- package/dist/debugger/app/assets/index-Qb371t_O.js +22 -0
- package/dist/debugger/app/assets/rolldown-runtime-CbXtAM7H.js +1 -0
- package/dist/debugger/app/assets/routes-CjtEHgPQ.js +47 -0
- package/dist/debugger/app/index.html +14 -0
- package/dist/debugger/components/composer.d.ts +17 -0
- package/dist/debugger/components/composer.js +25 -0
- package/dist/debugger/components/debugger-split.d.ts +2 -1
- package/dist/debugger/components/debugger-split.js +2 -2
- package/dist/debugger/components/event-inspector.d.ts +2 -1
- package/dist/debugger/components/event-inspector.js +25 -16
- package/dist/debugger/components/event-stream.d.ts +2 -1
- package/dist/debugger/components/event-stream.js +14 -74
- package/dist/debugger/components/follow-list.d.ts +19 -0
- package/dist/debugger/components/follow-list.js +96 -0
- package/dist/debugger/components/json-tree.d.ts +11 -0
- package/dist/debugger/components/json-tree.js +120 -0
- package/dist/debugger/components/json-view.js +2 -2
- package/dist/debugger/components/run-tree.js +53 -20
- package/dist/debugger/components/status-dot.d.ts +4 -0
- package/dist/debugger/components/status-dot.js +6 -2
- package/dist/debugger/context.d.ts +14 -0
- package/dist/debugger/context.js +17 -0
- package/dist/debugger/contracts.d.ts +7 -4
- package/dist/debugger/events/builtin-families.d.ts +3 -0
- package/dist/debugger/events/builtin-families.js +9 -0
- package/dist/debugger/events/catalog.d.ts +3 -4
- package/dist/debugger/events/catalog.js +27 -17
- package/dist/debugger/events/protocol-summarize.d.ts +1 -2
- package/dist/debugger/events/protocol-summarize.js +42 -24
- package/dist/debugger/index.d.ts +20 -6
- package/dist/debugger/index.js +19 -5
- package/dist/debugger/lib/cn.d.ts +1 -0
- package/dist/debugger/lib/cn.js +3 -0
- package/dist/debugger/lib/event-meta.d.ts +2 -3
- package/dist/debugger/lib/event-meta.js +6 -12
- package/dist/debugger/lib/json.d.ts +25 -0
- package/dist/debugger/lib/json.js +87 -0
- package/dist/debugger/lib/payload.d.ts +7 -0
- package/dist/debugger/lib/payload.js +11 -0
- package/dist/debugger/lib/time.d.ts +3 -0
- package/dist/debugger/lib/time.js +24 -0
- package/dist/debugger/plugin.d.ts +36 -0
- package/dist/debugger/plugin.js +14 -0
- package/dist/debugger/server/index.d.ts +14 -0
- package/dist/debugger/server/index.js +114 -0
- package/dist/debugger/shell/debugger-shell.d.ts +15 -0
- package/dist/debugger/shell/debugger-shell.js +43 -0
- package/dist/debugger/shell/definition-key.d.ts +3 -0
- package/dist/debugger/shell/definition-key.js +4 -0
- package/dist/debugger/shell/events-pane.d.ts +12 -0
- package/dist/debugger/shell/events-pane.js +25 -0
- package/dist/debugger/shell/projections-panel.d.ts +4 -0
- package/dist/debugger/shell/projections-panel.js +59 -0
- package/dist/debugger/shell/run-controls.d.ts +4 -0
- package/dist/debugger/shell/run-controls.js +72 -0
- package/dist/debugger/shell/run-search.d.ts +6 -0
- package/dist/debugger/shell/run-search.js +102 -0
- package/dist/debugger/shell/run-type-menu.d.ts +6 -0
- package/dist/debugger/shell/run-type-menu.js +11 -0
- package/dist/debugger/shell/schema-form.d.ts +31 -0
- package/dist/debugger/shell/schema-form.js +117 -0
- package/dist/debugger/shell/start-form.d.ts +3 -0
- package/dist/debugger/shell/start-form.js +75 -0
- package/dist/debugger/shell/use-start-run.d.ts +14 -0
- package/dist/debugger/shell/use-start-run.js +32 -0
- package/dist/debugger/shell/workspace.d.ts +6 -0
- package/dist/debugger/shell/workspace.js +15 -0
- package/dist/debugger/styles.css +111 -27
- package/dist/debugger/ui/button.d.ts +24 -0
- package/dist/debugger/ui/button.js +24 -0
- package/dist/debugger/ui/command.d.ts +9 -0
- package/dist/debugger/ui/command.js +24 -0
- package/dist/debugger/ui/dropdown-menu.d.ts +13 -0
- package/dist/debugger/ui/dropdown-menu.js +37 -0
- package/dist/debugger/ui/panel.d.ts +14 -0
- package/dist/debugger/ui/panel.js +16 -0
- package/dist/debugger/ui/popover.d.ts +7 -0
- package/dist/debugger/ui/popover.js +17 -0
- package/dist/debugger/ui/resizable.d.ts +7 -0
- package/dist/debugger/ui/resizable.js +14 -0
- package/dist/debugger/ui/scroll-area.d.ts +2 -1
- package/dist/debugger/ui/scroll-area.js +5 -3
- package/dist/debugger/ui/select.d.ts +10 -0
- package/dist/debugger/ui/select.js +21 -0
- package/dist/debugger/ui/tabs.js +2 -2
- package/dist/debugger/ui/textarea.d.ts +3 -0
- package/dist/debugger/ui/textarea.js +7 -0
- package/dist/evaluator/definitions-store.d.ts +11 -0
- package/dist/evaluator/definitions-store.js +8 -0
- package/dist/evaluator/definitions.d.ts +18 -0
- package/dist/evaluator/definitions.js +4 -0
- package/dist/evaluator/effects.d.ts +226 -0
- package/dist/evaluator/effects.js +132 -0
- package/dist/evaluator/evaluator.d.ts +24 -0
- package/dist/evaluator/evaluator.js +67 -0
- package/dist/evaluator/events.d.ts +59 -0
- package/dist/evaluator/events.js +21 -0
- package/dist/evaluator/index.d.ts +11 -0
- package/dist/evaluator/index.js +11 -0
- package/dist/evaluator/module.d.ts +606 -0
- package/dist/evaluator/module.js +25 -0
- package/dist/evaluator/projections.d.ts +50 -0
- package/dist/evaluator/projections.js +20 -0
- package/dist/evaluator/scope.d.ts +59 -0
- package/dist/evaluator/scope.js +7 -0
- package/dist/evaluator/signals.d.ts +3 -0
- package/dist/evaluator/signals.js +17 -0
- package/dist/evaluator/threads.d.ts +62 -0
- package/dist/evaluator/threads.js +117 -0
- package/dist/evaluator/types.d.ts +125 -0
- package/dist/evaluator/types.js +51 -0
- package/dist/projectors/delivery.d.ts +83 -0
- package/dist/projectors/delivery.js +182 -0
- package/dist/projectors/index-model.d.ts +1 -1
- package/dist/projectors/index-model.js +4 -6
- package/dist/projectors/index.d.ts +2 -0
- package/dist/projectors/index.js +2 -0
- package/dist/projectors/memory.d.ts +1 -1
- package/dist/projectors/memory.js +10 -8
- package/dist/projectors/postgres.js +44 -58
- package/dist/projectors/projector.d.ts +17 -0
- package/dist/projectors/projector.js +26 -1
- package/dist/projectors/sqlite-delivery.d.ts +4 -0
- package/dist/projectors/sqlite-delivery.js +147 -0
- package/dist/projectors/sqlite.js +23 -23
- package/dist/projectors/with-projectors.d.ts +7 -2
- package/dist/projectors/with-projectors.js +27 -28
- package/dist/react/notify.js +11 -8
- package/dist/react/react.d.ts +2 -3
- package/dist/react/react.js +14 -30
- package/dist/react/sse.d.ts +1 -1
- package/dist/react/sse.js +1 -1
- package/dist/react/store.d.ts +3 -3
- package/dist/react/store.js +109 -119
- package/dist/runtime/cancellation.d.ts +16 -0
- package/dist/runtime/cancellation.js +129 -0
- package/dist/runtime/deadline-transition-planner.d.ts +31 -0
- package/dist/runtime/deadline-transition-planner.js +139 -0
- package/dist/runtime/dispatch-effect.d.ts +3 -2
- package/dist/runtime/dispatch-effect.js +7 -13
- package/dist/runtime/errors.d.ts +51 -0
- package/dist/runtime/errors.js +39 -0
- package/dist/runtime/{runtime-helpers.d.ts → helpers.d.ts} +24 -4
- package/dist/runtime/{runtime-helpers.js → helpers.js} +56 -19
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +3 -3
- package/dist/runtime/ingress.d.ts +15 -0
- package/dist/runtime/ingress.js +42 -0
- package/dist/runtime/local-effect-executor.d.ts +21 -0
- package/dist/runtime/local-effect-executor.js +137 -0
- package/dist/runtime/looms.d.ts +30 -4
- package/dist/runtime/looms.js +57 -37
- package/dist/runtime/observer.d.ts +45 -0
- package/dist/runtime/observer.js +11 -0
- package/dist/runtime/repository.d.ts +55 -0
- package/dist/runtime/repository.js +293 -0
- package/dist/runtime/retry-policy.d.ts +16 -0
- package/dist/runtime/retry-policy.js +29 -0
- package/dist/runtime/run-execution-context.d.ts +30 -0
- package/dist/runtime/run-execution-context.js +56 -0
- package/dist/runtime/run-start.d.ts +4 -0
- package/dist/runtime/run-start.js +44 -0
- package/dist/runtime/runtime.d.ts +6 -87
- package/dist/runtime/runtime.js +248 -470
- package/dist/runtime/server/auth.d.ts +41 -0
- package/dist/runtime/server/auth.js +45 -0
- package/dist/runtime/server/debugger-host.d.ts +11 -0
- package/dist/runtime/server/debugger-host.js +32 -0
- package/dist/runtime/server/fetch-handler.d.ts +18 -0
- package/dist/runtime/server/fetch-handler.js +62 -0
- package/dist/runtime/server/http.d.ts +38 -0
- package/dist/runtime/server/http.js +66 -0
- package/dist/runtime/server/route-table.d.ts +55 -0
- package/dist/runtime/server/route-table.js +74 -0
- package/dist/runtime/server/routes/definitions.d.ts +3 -0
- package/dist/runtime/server/routes/definitions.js +20 -0
- package/dist/runtime/server/routes/effects.d.ts +3 -0
- package/dist/runtime/server/routes/effects.js +59 -0
- package/dist/runtime/server/routes/operations.d.ts +3 -0
- package/dist/runtime/server/routes/operations.js +14 -0
- package/dist/runtime/server/routes/runs.d.ts +3 -0
- package/dist/runtime/server/routes/runs.js +199 -0
- package/dist/runtime/server.d.ts +4 -8
- package/dist/runtime/server.js +6 -211
- package/dist/runtime/sse.d.ts +2 -1
- package/dist/runtime/sse.js +24 -17
- package/dist/runtime/types.d.ts +117 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/wake-engine.d.ts +20 -0
- package/dist/runtime/wake-engine.js +311 -0
- package/dist/runtime/wake-scheduler.d.ts +3 -4
- package/dist/runtime/wake-scheduler.js +25 -31
- package/dist/runtime/worker-callbacks.d.ts +16 -0
- package/dist/runtime/worker-callbacks.js +167 -0
- package/dist/runtime/worker-effect-dispatch.d.ts +36 -0
- package/dist/runtime/worker-effect-dispatch.js +126 -0
- package/dist/s2/config.d.ts +1 -1
- package/dist/s2/config.js +1 -1
- package/dist/s2/lite.js +70 -82
- package/dist/s2/pagination.d.ts +15 -0
- package/dist/s2/pagination.js +36 -0
- package/dist/s2/projector.js +6 -5
- package/dist/s2/snapshot-store.js +188 -161
- package/dist/s2/store.d.ts +3 -21
- package/dist/s2/store.js +71 -165
- package/dist/testing/index.d.ts +15 -0
- package/dist/testing/index.js +53 -16
- package/dist/workflow/debugger/index.d.ts +4 -0
- package/dist/workflow/debugger/index.js +11 -0
- package/dist/workflow/debugger/nodes-view.d.ts +3 -0
- package/dist/workflow/debugger/nodes-view.js +13 -0
- package/dist/workflow/debugger/summarize.d.ts +2 -0
- package/dist/workflow/debugger/summarize.js +30 -0
- package/dist/workflow/definitions-store.d.ts +2 -3
- package/dist/workflow/definitions-store.js +2 -2
- package/dist/workflow/definitions.d.ts +78 -22
- package/dist/workflow/definitions.js +80 -14
- package/dist/workflow/effects.d.ts +453 -107
- package/dist/workflow/effects.js +214 -115
- package/dist/workflow/events.d.ts +149 -5
- package/dist/workflow/events.js +27 -5
- package/dist/workflow/graph.d.ts +56 -0
- package/dist/workflow/graph.js +207 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +1 -0
- package/dist/workflow/module.d.ts +1047 -266
- package/dist/workflow/projections.d.ts +14 -12
- package/dist/workflow/projections.js +30 -8
- package/dist/workflow/scope.d.ts +146 -4
- package/dist/workflow/threads.d.ts +383 -155
- package/dist/workflow/threads.js +308 -110
- package/package.json +26 -2
- package/dist/debugger/events/domain-summarize.d.ts +0 -3
- package/dist/debugger/events/domain-summarize.js +0 -107
- package/dist/debugger/events/family.d.ts +0 -8
- package/dist/debugger/events/family.js +0 -44
- package/dist/runtime/events-api.d.ts +0 -4
- package/dist/runtime/events-api.js +0 -84
package/dist/agent/module.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Layer } from 'effect';
|
|
2
|
-
import { defineModule } from '@swirls/looms/core';
|
|
1
|
+
import { Layer, Predicate } from 'effect';
|
|
2
|
+
import { defineModule, makeDefinitionStore } from '@swirls/looms/core';
|
|
3
|
+
import { createAgentSessionThread } from './agent-session.js';
|
|
3
4
|
import { AgentDefinitionsLive } from './definitions-store.js';
|
|
4
5
|
import { callLlmEffect, executeToolEffect } from './effects.js';
|
|
5
6
|
import { llmFromAdapter, LlmTag, StubLlmLive } from './llm.js';
|
|
@@ -8,12 +9,17 @@ import { agentModule } from './scope.js';
|
|
|
8
9
|
import { agentThread } from './threads.js';
|
|
9
10
|
export function agent(options = {}) {
|
|
10
11
|
const definitions = options.definitions ?? [];
|
|
12
|
+
const agentDefinitions = definitions.filter((definition) => definition.kind === 'agent');
|
|
13
|
+
const sessionDefinitions = makeDefinitionStore('agent-session', definitions.filter((definition) => definition.kind === 'agent-session'));
|
|
11
14
|
const llmLayer = options.llm
|
|
12
15
|
? Layer.succeed(LlmTag, llmFromAdapter(options.llm))
|
|
13
16
|
: StubLlmLive(options.llmPolicy);
|
|
14
17
|
return defineModule(agentModule, () => ({
|
|
15
18
|
definitions,
|
|
16
|
-
threads: {
|
|
19
|
+
threads: {
|
|
20
|
+
agent: agentThread,
|
|
21
|
+
'agent-session': createAgentSessionThread(sessionDefinitions),
|
|
22
|
+
},
|
|
17
23
|
effects: {
|
|
18
24
|
callLLM: callLlmEffect,
|
|
19
25
|
executeTool: executeToolEffect,
|
|
@@ -22,6 +28,12 @@ export function agent(options = {}) {
|
|
|
22
28
|
conversation,
|
|
23
29
|
tokenUsage,
|
|
24
30
|
},
|
|
25
|
-
services: () => Layer.merge(llmLayer, AgentDefinitionsLive(
|
|
31
|
+
services: () => Layer.merge(llmLayer, AgentDefinitionsLive(agentDefinitions)),
|
|
32
|
+
interruptsOnSignal: (event) => event.type === 'agent.steered' &&
|
|
33
|
+
Predicate.isObject(event.payload) &&
|
|
34
|
+
event.payload.interrupt === true &&
|
|
35
|
+
event.threadId
|
|
36
|
+
? [event.threadId]
|
|
37
|
+
: [],
|
|
26
38
|
}));
|
|
27
39
|
}
|
package/dist/agent/scope.d.ts
CHANGED
|
@@ -14,14 +14,14 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
14
14
|
}>;
|
|
15
15
|
}>;
|
|
16
16
|
'turn.started': import("effect/Schema").Struct<{
|
|
17
|
-
readonly turn: import("effect/Schema").
|
|
17
|
+
readonly turn: import("effect/Schema").Finite;
|
|
18
18
|
}>;
|
|
19
19
|
'turn.text_delta': import("effect/Schema").Struct<{
|
|
20
|
-
readonly turn: import("effect/Schema").
|
|
20
|
+
readonly turn: import("effect/Schema").Finite;
|
|
21
21
|
readonly delta: import("effect/Schema").String;
|
|
22
22
|
}>;
|
|
23
23
|
message: import("effect/Schema").Struct<{
|
|
24
|
-
readonly turn: import("effect/Schema").
|
|
24
|
+
readonly turn: import("effect/Schema").Finite;
|
|
25
25
|
readonly message: import("effect/Schema").Struct<{
|
|
26
26
|
readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
|
|
27
27
|
readonly content: import("effect/Schema").String;
|
|
@@ -34,12 +34,12 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
34
34
|
}>>>>;
|
|
35
35
|
}>;
|
|
36
36
|
readonly usage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
37
|
-
readonly input: import("effect/Schema").
|
|
38
|
-
readonly output: import("effect/Schema").
|
|
37
|
+
readonly input: import("effect/Schema").Finite;
|
|
38
|
+
readonly output: import("effect/Schema").Finite;
|
|
39
39
|
}>>;
|
|
40
40
|
}>;
|
|
41
41
|
'tool_call.requested': import("effect/Schema").Struct<{
|
|
42
|
-
readonly turn: import("effect/Schema").
|
|
42
|
+
readonly turn: import("effect/Schema").Finite;
|
|
43
43
|
readonly toolCall: import("effect/Schema").Struct<{
|
|
44
44
|
readonly id: import("effect/Schema").String;
|
|
45
45
|
readonly name: import("effect/Schema").String;
|
|
@@ -47,14 +47,15 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
47
47
|
}>;
|
|
48
48
|
}>;
|
|
49
49
|
'tool.result': import("effect/Schema").Struct<{
|
|
50
|
-
readonly turn: import("effect/Schema").
|
|
50
|
+
readonly turn: import("effect/Schema").Finite;
|
|
51
51
|
readonly toolCallId: import("effect/Schema").String;
|
|
52
52
|
readonly name: import("effect/Schema").String;
|
|
53
53
|
readonly result: import("effect/Schema").NullOr<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
|
54
54
|
readonly error: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
55
55
|
}>;
|
|
56
56
|
steered: import("effect/Schema").Struct<{
|
|
57
|
-
readonly turn: import("effect/Schema").
|
|
57
|
+
readonly turn: import("effect/Schema").Finite;
|
|
58
|
+
readonly messageId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
58
59
|
readonly message: import("effect/Schema").Struct<{
|
|
59
60
|
readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
|
|
60
61
|
readonly content: import("effect/Schema").String;
|
|
@@ -68,16 +69,93 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
68
69
|
}>;
|
|
69
70
|
readonly interrupt: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
70
71
|
}>;
|
|
72
|
+
'session.message.submitted': import("effect/Schema").Struct<{
|
|
73
|
+
readonly messageId: import("effect/Schema").String;
|
|
74
|
+
readonly text: import("effect/Schema").String;
|
|
75
|
+
readonly delivery: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"steer">, import("effect/Schema").Literal<"followUp">, import("effect/Schema").Literal<"nextTurn">]>>;
|
|
76
|
+
readonly activeChildThreadId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
77
|
+
}>;
|
|
78
|
+
'session.steer.delivered': import("effect/Schema").Struct<{
|
|
79
|
+
readonly messageId: import("effect/Schema").String;
|
|
80
|
+
readonly activeMessageId: import("effect/Schema").String;
|
|
81
|
+
}>;
|
|
82
|
+
'session.turn.started': import("effect/Schema").Struct<{
|
|
83
|
+
readonly messageId: import("effect/Schema").String;
|
|
84
|
+
readonly childThreadId: import("effect/Schema").String;
|
|
85
|
+
}>;
|
|
86
|
+
'session.turn.closed': import("effect/Schema").Struct<{
|
|
87
|
+
readonly messageId: import("effect/Schema").String;
|
|
88
|
+
readonly status: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"completed">, import("effect/Schema").Literal<"failed">, import("effect/Schema").Literal<"cancelled">]>;
|
|
89
|
+
readonly error: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
90
|
+
}>;
|
|
91
|
+
'session.cancel.requested': import("effect/Schema").Struct<{}>;
|
|
71
92
|
'spawn.requested': import("effect/Schema").Struct<{
|
|
72
93
|
readonly childThreadId: import("effect/Schema").String;
|
|
73
94
|
readonly kind: import("effect/Schema").String;
|
|
74
95
|
readonly definitionName: import("effect/Schema").String;
|
|
96
|
+
readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
|
|
75
97
|
readonly toolCallId: import("effect/Schema").String;
|
|
76
98
|
readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
77
99
|
}>;
|
|
78
100
|
'effects.requested': import("effect/Schema").Struct<{
|
|
79
101
|
readonly toolCallId: import("effect/Schema").String;
|
|
80
|
-
readonly effects: import("effect/Schema").$Array<import("effect/Schema").
|
|
102
|
+
readonly effects: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
103
|
+
readonly type: import("effect/Schema").Literal<"runtime.spawn">;
|
|
104
|
+
readonly childThreadId: import("effect/Schema").String;
|
|
105
|
+
readonly kind: import("effect/Schema").String;
|
|
106
|
+
readonly definitionName: import("effect/Schema").String;
|
|
107
|
+
readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
|
|
108
|
+
readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
109
|
+
}>, import("effect/Schema").Struct<{
|
|
110
|
+
readonly type: import("effect/Schema").Literal<"runtime.wait">;
|
|
111
|
+
readonly waitId: import("effect/Schema").String;
|
|
112
|
+
readonly on: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
113
|
+
readonly type: import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>]>;
|
|
114
|
+
readonly match: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
|
115
|
+
}>, import("effect/Schema").Struct<{
|
|
116
|
+
readonly timerAt: import("effect/Schema").Finite;
|
|
117
|
+
}>]>;
|
|
118
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
|
119
|
+
}>, import("effect/Schema").Struct<{
|
|
120
|
+
readonly type: import("effect/Schema").Literal<"runtime.emit">;
|
|
121
|
+
readonly event: import("effect/Schema").Struct<{
|
|
122
|
+
readonly type: import("effect/Schema").String;
|
|
123
|
+
readonly payload: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
124
|
+
readonly threadId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
125
|
+
readonly parentThreadId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
126
|
+
readonly causationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
127
|
+
readonly correlationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
128
|
+
readonly effectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
129
|
+
readonly origin: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
130
|
+
readonly type: import("effect/Schema").Literal<"thread">;
|
|
131
|
+
readonly threadId: import("effect/Schema").String;
|
|
132
|
+
}>, import("effect/Schema").Struct<{
|
|
133
|
+
readonly type: import("effect/Schema").Literal<"external">;
|
|
134
|
+
readonly actorId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
135
|
+
}>, import("effect/Schema").Struct<{
|
|
136
|
+
readonly type: import("effect/Schema").Literal<"system">;
|
|
137
|
+
}>]>>;
|
|
138
|
+
readonly ephemeral: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
139
|
+
readonly id: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
140
|
+
readonly ts: import("effect/Schema").optional<import("effect/Schema").Finite>;
|
|
141
|
+
readonly idempotencyKey: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
142
|
+
}>;
|
|
143
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
144
|
+
}>, import("effect/Schema").Struct<{
|
|
145
|
+
readonly type: import("effect/Schema").Literal<"runtime.complete">;
|
|
146
|
+
readonly output: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
147
|
+
}>, import("effect/Schema").Struct<{
|
|
148
|
+
readonly type: import("effect/Schema").Literal<"runtime.fail">;
|
|
149
|
+
readonly error: import("effect/Schema").String;
|
|
150
|
+
}>, import("effect/Schema").Struct<{
|
|
151
|
+
readonly type: import("effect/Schema").Literal<"runtime.cancel">;
|
|
152
|
+
readonly threadId: import("effect/Schema").String;
|
|
153
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
154
|
+
}>, import("effect/Schema").Struct<{
|
|
155
|
+
readonly type: import("effect/Schema").String;
|
|
156
|
+
readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
157
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
158
|
+
}>]>>;
|
|
81
159
|
readonly waitOn: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
82
160
|
readonly type: import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>]>;
|
|
83
161
|
readonly match: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
|
@@ -98,14 +176,14 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
98
176
|
}>;
|
|
99
177
|
}>;
|
|
100
178
|
'turn.started': import("effect/Schema").Struct<{
|
|
101
|
-
readonly turn: import("effect/Schema").
|
|
179
|
+
readonly turn: import("effect/Schema").Finite;
|
|
102
180
|
}>;
|
|
103
181
|
'turn.text_delta': import("effect/Schema").Struct<{
|
|
104
|
-
readonly turn: import("effect/Schema").
|
|
182
|
+
readonly turn: import("effect/Schema").Finite;
|
|
105
183
|
readonly delta: import("effect/Schema").String;
|
|
106
184
|
}>;
|
|
107
185
|
message: import("effect/Schema").Struct<{
|
|
108
|
-
readonly turn: import("effect/Schema").
|
|
186
|
+
readonly turn: import("effect/Schema").Finite;
|
|
109
187
|
readonly message: import("effect/Schema").Struct<{
|
|
110
188
|
readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
|
|
111
189
|
readonly content: import("effect/Schema").String;
|
|
@@ -118,12 +196,12 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
118
196
|
}>>>>;
|
|
119
197
|
}>;
|
|
120
198
|
readonly usage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
121
|
-
readonly input: import("effect/Schema").
|
|
122
|
-
readonly output: import("effect/Schema").
|
|
199
|
+
readonly input: import("effect/Schema").Finite;
|
|
200
|
+
readonly output: import("effect/Schema").Finite;
|
|
123
201
|
}>>;
|
|
124
202
|
}>;
|
|
125
203
|
'tool_call.requested': import("effect/Schema").Struct<{
|
|
126
|
-
readonly turn: import("effect/Schema").
|
|
204
|
+
readonly turn: import("effect/Schema").Finite;
|
|
127
205
|
readonly toolCall: import("effect/Schema").Struct<{
|
|
128
206
|
readonly id: import("effect/Schema").String;
|
|
129
207
|
readonly name: import("effect/Schema").String;
|
|
@@ -131,14 +209,15 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
131
209
|
}>;
|
|
132
210
|
}>;
|
|
133
211
|
'tool.result': import("effect/Schema").Struct<{
|
|
134
|
-
readonly turn: import("effect/Schema").
|
|
212
|
+
readonly turn: import("effect/Schema").Finite;
|
|
135
213
|
readonly toolCallId: import("effect/Schema").String;
|
|
136
214
|
readonly name: import("effect/Schema").String;
|
|
137
215
|
readonly result: import("effect/Schema").NullOr<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
|
138
216
|
readonly error: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
139
217
|
}>;
|
|
140
218
|
steered: import("effect/Schema").Struct<{
|
|
141
|
-
readonly turn: import("effect/Schema").
|
|
219
|
+
readonly turn: import("effect/Schema").Finite;
|
|
220
|
+
readonly messageId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
142
221
|
readonly message: import("effect/Schema").Struct<{
|
|
143
222
|
readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
|
|
144
223
|
readonly content: import("effect/Schema").String;
|
|
@@ -152,16 +231,93 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
152
231
|
}>;
|
|
153
232
|
readonly interrupt: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
154
233
|
}>;
|
|
234
|
+
'session.message.submitted': import("effect/Schema").Struct<{
|
|
235
|
+
readonly messageId: import("effect/Schema").String;
|
|
236
|
+
readonly text: import("effect/Schema").String;
|
|
237
|
+
readonly delivery: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"steer">, import("effect/Schema").Literal<"followUp">, import("effect/Schema").Literal<"nextTurn">]>>;
|
|
238
|
+
readonly activeChildThreadId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
239
|
+
}>;
|
|
240
|
+
'session.steer.delivered': import("effect/Schema").Struct<{
|
|
241
|
+
readonly messageId: import("effect/Schema").String;
|
|
242
|
+
readonly activeMessageId: import("effect/Schema").String;
|
|
243
|
+
}>;
|
|
244
|
+
'session.turn.started': import("effect/Schema").Struct<{
|
|
245
|
+
readonly messageId: import("effect/Schema").String;
|
|
246
|
+
readonly childThreadId: import("effect/Schema").String;
|
|
247
|
+
}>;
|
|
248
|
+
'session.turn.closed': import("effect/Schema").Struct<{
|
|
249
|
+
readonly messageId: import("effect/Schema").String;
|
|
250
|
+
readonly status: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"completed">, import("effect/Schema").Literal<"failed">, import("effect/Schema").Literal<"cancelled">]>;
|
|
251
|
+
readonly error: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
252
|
+
}>;
|
|
253
|
+
'session.cancel.requested': import("effect/Schema").Struct<{}>;
|
|
155
254
|
'spawn.requested': import("effect/Schema").Struct<{
|
|
156
255
|
readonly childThreadId: import("effect/Schema").String;
|
|
157
256
|
readonly kind: import("effect/Schema").String;
|
|
158
257
|
readonly definitionName: import("effect/Schema").String;
|
|
258
|
+
readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
|
|
159
259
|
readonly toolCallId: import("effect/Schema").String;
|
|
160
260
|
readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
161
261
|
}>;
|
|
162
262
|
'effects.requested': import("effect/Schema").Struct<{
|
|
163
263
|
readonly toolCallId: import("effect/Schema").String;
|
|
164
|
-
readonly effects: import("effect/Schema").$Array<import("effect/Schema").
|
|
264
|
+
readonly effects: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
265
|
+
readonly type: import("effect/Schema").Literal<"runtime.spawn">;
|
|
266
|
+
readonly childThreadId: import("effect/Schema").String;
|
|
267
|
+
readonly kind: import("effect/Schema").String;
|
|
268
|
+
readonly definitionName: import("effect/Schema").String;
|
|
269
|
+
readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
|
|
270
|
+
readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
271
|
+
}>, import("effect/Schema").Struct<{
|
|
272
|
+
readonly type: import("effect/Schema").Literal<"runtime.wait">;
|
|
273
|
+
readonly waitId: import("effect/Schema").String;
|
|
274
|
+
readonly on: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
275
|
+
readonly type: import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>]>;
|
|
276
|
+
readonly match: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
|
277
|
+
}>, import("effect/Schema").Struct<{
|
|
278
|
+
readonly timerAt: import("effect/Schema").Finite;
|
|
279
|
+
}>]>;
|
|
280
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
|
281
|
+
}>, import("effect/Schema").Struct<{
|
|
282
|
+
readonly type: import("effect/Schema").Literal<"runtime.emit">;
|
|
283
|
+
readonly event: import("effect/Schema").Struct<{
|
|
284
|
+
readonly type: import("effect/Schema").String;
|
|
285
|
+
readonly payload: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
286
|
+
readonly threadId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
287
|
+
readonly parentThreadId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
288
|
+
readonly causationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
289
|
+
readonly correlationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
290
|
+
readonly effectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
291
|
+
readonly origin: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
292
|
+
readonly type: import("effect/Schema").Literal<"thread">;
|
|
293
|
+
readonly threadId: import("effect/Schema").String;
|
|
294
|
+
}>, import("effect/Schema").Struct<{
|
|
295
|
+
readonly type: import("effect/Schema").Literal<"external">;
|
|
296
|
+
readonly actorId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
297
|
+
}>, import("effect/Schema").Struct<{
|
|
298
|
+
readonly type: import("effect/Schema").Literal<"system">;
|
|
299
|
+
}>]>>;
|
|
300
|
+
readonly ephemeral: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
301
|
+
readonly id: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
302
|
+
readonly ts: import("effect/Schema").optional<import("effect/Schema").Finite>;
|
|
303
|
+
readonly idempotencyKey: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
304
|
+
}>;
|
|
305
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
306
|
+
}>, import("effect/Schema").Struct<{
|
|
307
|
+
readonly type: import("effect/Schema").Literal<"runtime.complete">;
|
|
308
|
+
readonly output: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
309
|
+
}>, import("effect/Schema").Struct<{
|
|
310
|
+
readonly type: import("effect/Schema").Literal<"runtime.fail">;
|
|
311
|
+
readonly error: import("effect/Schema").String;
|
|
312
|
+
}>, import("effect/Schema").Struct<{
|
|
313
|
+
readonly type: import("effect/Schema").Literal<"runtime.cancel">;
|
|
314
|
+
readonly threadId: import("effect/Schema").String;
|
|
315
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
316
|
+
}>, import("effect/Schema").Struct<{
|
|
317
|
+
readonly type: import("effect/Schema").String;
|
|
318
|
+
readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
|
|
319
|
+
readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
320
|
+
}>]>>;
|
|
165
321
|
readonly waitOn: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
166
322
|
readonly type: import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>]>;
|
|
167
323
|
readonly match: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
|
package/dist/agent/signals.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EventInput } from '@swirls/looms/core';
|
|
1
|
+
import type { EventInput, JsonValue } from '@swirls/looms/core';
|
|
2
|
+
import type { AgentMessageDelivery } from './types';
|
|
2
3
|
export interface AgentSignalOptions {
|
|
3
4
|
/** Target thread. Defaults to the run's root thread when omitted. */
|
|
4
5
|
readonly threadId?: string;
|
|
@@ -15,3 +16,27 @@ export declare function userMessage(content: string, options?: AgentSignalOption
|
|
|
15
16
|
export declare function steer(content: string, options?: AgentSignalOptions & {
|
|
16
17
|
readonly interrupt?: boolean;
|
|
17
18
|
}): EventInput;
|
|
19
|
+
export interface AgentSessionMessageOptions extends AgentSignalOptions {
|
|
20
|
+
readonly delivery?: AgentMessageDelivery;
|
|
21
|
+
/** Set by the client helper when a steer is aimed at an active child. */
|
|
22
|
+
readonly activeChildThreadId?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function submitAgentMessage(messageId: string, text: string, options?: AgentSessionMessageOptions): EventInput;
|
|
25
|
+
export declare function cancelAgentTurn(childThreadId: string, options?: AgentSignalOptions): EventInput[];
|
|
26
|
+
interface AgentSessionSignalClient<Result> {
|
|
27
|
+
getRun(runId: string): Promise<{
|
|
28
|
+
rootThreadId: string | null;
|
|
29
|
+
threads: {
|
|
30
|
+
[threadId: string]: {
|
|
31
|
+
state: JsonValue;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
signal(runId: string, events: ReadonlyArray<EventInput>): Promise<Result>;
|
|
36
|
+
cancel?(runId: string, threadId?: string): Promise<Result>;
|
|
37
|
+
}
|
|
38
|
+
/** Events for one session message. A steer aimed at `activeChildThreadId` interrupts that turn in the same batch. */
|
|
39
|
+
export declare function agentSessionMessageEvents(messageId: string, text: string, options?: AgentSessionMessageOptions): EventInput[];
|
|
40
|
+
export declare function sendAgentSessionMessage<Result>(client: AgentSessionSignalClient<Result>, runId: string, messageId: string, text: string, options?: Omit<AgentSessionMessageOptions, 'activeChildThreadId'>): Promise<Result>;
|
|
41
|
+
export declare function cancelActiveAgentTurn<Result>(client: AgentSessionSignalClient<Result>, runId: string, options?: AgentSignalOptions): Promise<Result | Awaited<ReturnType<AgentSessionSignalClient<Result>['getRun']>>>;
|
|
42
|
+
export {};
|
package/dist/agent/signals.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Predicate } from 'effect';
|
|
1
2
|
import { agentModule } from './scope.js';
|
|
2
3
|
/**
|
|
3
4
|
* Build the `agent.message.received` event for a conversational agent.
|
|
@@ -17,3 +18,81 @@ export function steer(content, options = {}) {
|
|
|
17
18
|
message: { role: 'user', content },
|
|
18
19
|
}, { threadId: options.threadId });
|
|
19
20
|
}
|
|
21
|
+
export function submitAgentMessage(messageId, text, options = {}) {
|
|
22
|
+
return agentModule.input('session.message.submitted', {
|
|
23
|
+
messageId,
|
|
24
|
+
text,
|
|
25
|
+
delivery: options.delivery,
|
|
26
|
+
activeChildThreadId: options.activeChildThreadId,
|
|
27
|
+
}, {
|
|
28
|
+
threadId: options.threadId,
|
|
29
|
+
idempotencyKey: `agent-session-message:${messageId}`,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function cancelAgentTurn(childThreadId, options = {}) {
|
|
33
|
+
return [
|
|
34
|
+
agentModule.input('session.cancel.requested', {}, { threadId: options.threadId }),
|
|
35
|
+
{
|
|
36
|
+
type: 'runtime.thread.cancel.requested',
|
|
37
|
+
payload: { threadId: childThreadId },
|
|
38
|
+
threadId: options.threadId,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
function activeTurnFrom(value) {
|
|
43
|
+
if (!Predicate.isObject(value) || !Predicate.isObject(value.activeTurn)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const activeTurn = value.activeTurn;
|
|
47
|
+
return Predicate.isString(activeTurn.messageId) &&
|
|
48
|
+
Predicate.isString(activeTurn.childThreadId) &&
|
|
49
|
+
Predicate.isString(activeTurn.text)
|
|
50
|
+
? {
|
|
51
|
+
messageId: activeTurn.messageId,
|
|
52
|
+
childThreadId: activeTurn.childThreadId,
|
|
53
|
+
text: activeTurn.text,
|
|
54
|
+
}
|
|
55
|
+
: null;
|
|
56
|
+
}
|
|
57
|
+
/** Events for one session message. A steer aimed at `activeChildThreadId` interrupts that turn in the same batch. */
|
|
58
|
+
export function agentSessionMessageEvents(messageId, text, options = {}) {
|
|
59
|
+
const events = [submitAgentMessage(messageId, text, options)];
|
|
60
|
+
if (options.delivery === 'steer' && options.activeChildThreadId) {
|
|
61
|
+
events.push(agentModule.input('steered', {
|
|
62
|
+
turn: 0,
|
|
63
|
+
messageId,
|
|
64
|
+
message: { role: 'user', content: text },
|
|
65
|
+
interrupt: true,
|
|
66
|
+
}, { threadId: options.activeChildThreadId }));
|
|
67
|
+
}
|
|
68
|
+
return events;
|
|
69
|
+
}
|
|
70
|
+
export function sendAgentSessionMessage(client, runId, messageId, text, options = {}) {
|
|
71
|
+
return client.getRun(runId).then((run) => {
|
|
72
|
+
const threadId = options.threadId ?? run.rootThreadId ?? undefined;
|
|
73
|
+
const active = options.delivery === 'steer' && threadId ? activeTurnFrom(run.threads[threadId]?.state) : null;
|
|
74
|
+
return client.signal(runId, agentSessionMessageEvents(messageId, text, {
|
|
75
|
+
...options,
|
|
76
|
+
threadId,
|
|
77
|
+
activeChildThreadId: active?.childThreadId,
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function cancelActiveAgentTurn(client, runId, options = {}) {
|
|
82
|
+
return client.getRun(runId).then((run) => {
|
|
83
|
+
const threadId = options.threadId ?? run.rootThreadId ?? undefined;
|
|
84
|
+
const active = threadId ? activeTurnFrom(run.threads[threadId]?.state) : null;
|
|
85
|
+
if (!active) {
|
|
86
|
+
return run;
|
|
87
|
+
}
|
|
88
|
+
if (client.cancel) {
|
|
89
|
+
const cancel = (targetRunId, childThreadId) => client.cancel(targetRunId, childThreadId);
|
|
90
|
+
const requested = client.signal(runId, [
|
|
91
|
+
agentModule.input('session.cancel.requested', {}, { threadId }),
|
|
92
|
+
]);
|
|
93
|
+
const cancelled = cancel(runId, active.childThreadId);
|
|
94
|
+
return Promise.all([requested, cancelled]).then(([, result]) => result);
|
|
95
|
+
}
|
|
96
|
+
return client.signal(runId, cancelAgentTurn(active.childThreadId, { threadId }));
|
|
97
|
+
});
|
|
98
|
+
}
|
package/dist/agent/threads.d.ts
CHANGED
|
@@ -1,34 +1,4 @@
|
|
|
1
|
-
import { type EventEnvelope, type
|
|
2
|
-
import
|
|
3
|
-
export declare const agentThread: import("@swirls/looms/core").ThreadDefinition<
|
|
4
|
-
definitionName?: string;
|
|
5
|
-
lines: Message[];
|
|
6
|
-
pendingToolCalls: ToolCall[];
|
|
7
|
-
executingToolCalls: ToolCall[];
|
|
8
|
-
needsLlmCall: boolean;
|
|
9
|
-
turn: number;
|
|
10
|
-
maxTurns: number;
|
|
11
|
-
pendingSteer: Message | null;
|
|
12
|
-
input: JsonValue;
|
|
13
|
-
output: JsonValue | null;
|
|
14
|
-
pendingEffectTools: {
|
|
15
|
-
[causingSeq: string]: import("./types").PendingEffectTool;
|
|
16
|
-
};
|
|
17
|
-
pendingSpawns: import("./types").AgentPendingSpawn[];
|
|
18
|
-
pendingEffects: import("./types").AgentPendingEffects[];
|
|
19
|
-
pendingEmits: (import("./types").AgentPendingEmit | {
|
|
20
|
-
id: string;
|
|
21
|
-
event: {
|
|
22
|
-
type: string;
|
|
23
|
-
payload: {
|
|
24
|
-
turn: number;
|
|
25
|
-
toolCallId: string;
|
|
26
|
-
name: string;
|
|
27
|
-
result: string | number | boolean | import("effect/Schema").JsonArray | import("effect/Schema").JsonObject | null;
|
|
28
|
-
error: string | null;
|
|
29
|
-
};
|
|
30
|
-
threadId: string;
|
|
31
|
-
};
|
|
32
|
-
})[];
|
|
33
|
-
}>;
|
|
1
|
+
import { type EventEnvelope, type RuntimeEffect } from '@swirls/looms/core';
|
|
2
|
+
import type { AgentState } from './types';
|
|
3
|
+
export declare const agentThread: import("@swirls/looms/core").ThreadDefinition<AgentState>;
|
|
34
4
|
export declare function satisfiedToToolResult(event: EventEnvelope): RuntimeEffect | null;
|