@swirls/looms 0.1.0 → 0.3.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 +37 -0
- package/dist/actor/host.js +4 -5
- package/dist/actor/index.d.ts +1 -1
- package/dist/actor/index.js +1 -1
- package/dist/actor/routing.d.ts +5 -0
- package/dist/actor/routing.js +14 -0
- package/dist/agent/agent-session.js +1 -0
- package/dist/agent/debugger/agent-chat.d.ts +2 -0
- package/dist/agent/debugger/agent-chat.js +210 -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 +53 -0
- package/dist/agent/debugger/token-usage.d.ts +3 -0
- package/dist/agent/debugger/token-usage.js +11 -0
- package/dist/agent/definitions.d.ts +3 -11
- package/dist/agent/definitions.js +5 -6
- package/dist/agent/effects.d.ts +30 -0
- package/dist/agent/events.d.ts +2 -0
- package/dist/agent/events.js +2 -0
- package/dist/agent/llm.js +1 -8
- package/dist/agent/module.d.ts +604 -534
- package/dist/agent/module.js +11 -7
- package/dist/agent/projections.d.ts +5 -0
- package/dist/agent/projections.js +43 -2
- package/dist/agent/scope.d.ts +2 -0
- package/dist/agent/signals.d.ts +7 -0
- package/dist/agent/signals.js +25 -16
- package/dist/agent/threads.js +35 -21
- package/dist/agent/tool-schema.d.ts +1 -17
- package/dist/agent/tool-schema.js +3 -42
- package/dist/agent/transcript.d.ts +7 -0
- package/dist/agent/transcript.js +19 -0
- package/dist/agent/types.d.ts +10 -0
- package/dist/agent/types.js +4 -0
- package/dist/ai-vercel/index.d.ts +1 -1
- package/dist/ai-vercel/vercel-evaluator.d.ts +21 -8
- package/dist/ai-vercel/vercel-evaluator.js +7 -2
- package/dist/approval/debugger/approvals-view.d.ts +3 -0
- package/dist/approval/debugger/approvals-view.js +18 -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 +12 -0
- package/dist/approval/module.d.ts +24 -0
- package/dist/client/client.d.ts +310 -0
- package/dist/client/client.js +20 -2
- package/dist/cloudflare/router.d.ts +1 -1
- package/dist/cloudflare/router.js +6 -8
- package/dist/core/compose.js +1 -0
- package/dist/core/debugger-host.d.ts +16 -0
- package/dist/core/debugger-host.js +1 -0
- package/dist/core/effects.d.ts +7 -0
- package/dist/core/effects.js +1 -0
- package/dist/core/fold.js +12 -6
- package/dist/core/fork.d.ts +35 -0
- package/dist/core/fork.js +129 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +2 -0
- package/dist/core/module-scope.d.ts +1 -0
- package/dist/core/module.d.ts +4 -2
- package/dist/core/projection.js +1 -0
- package/dist/core/protocol.d.ts +10 -1
- package/dist/core/protocol.js +11 -0
- package/dist/core/published.d.ts +43 -0
- package/dist/core/published.js +44 -0
- package/dist/core/replay.d.ts +8 -0
- package/dist/core/schema.d.ts +3 -1
- package/dist/core/schema.js +38 -0
- package/dist/core/snapshot-store.d.ts +4 -0
- package/dist/core/snapshot-store.js +7 -0
- package/dist/core/snapshots.js +3 -17
- package/dist/core/sqlite-store.js +39 -0
- package/dist/core/state.d.ts +14 -0
- package/dist/core/state.js +25 -2
- package/dist/core/store.d.ts +1 -0
- package/dist/debugger/app/assets/index-BevQYa-U.js +22 -0
- package/dist/debugger/app/assets/index-CgDzWJg7.css +2 -0
- package/dist/debugger/app/assets/rolldown-runtime-CbXtAM7H.js +1 -0
- package/dist/debugger/app/assets/routes-B17Om93i.js +47 -0
- package/dist/debugger/app/index.html +14 -0
- package/dist/debugger/components/composer.d.ts +20 -0
- package/dist/debugger/components/composer.js +26 -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 +12 -71
- 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 +50 -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 +25 -17
- package/dist/debugger/events/protocol-summarize.d.ts +1 -2
- package/dist/debugger/events/protocol-summarize.js +36 -37
- 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-counts.d.ts +2 -2
- package/dist/debugger/lib/event-counts.js +5 -9
- package/dist/debugger/lib/event-meta.d.ts +2 -3
- package/dist/debugger/lib/event-meta.js +6 -11
- 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 +5 -0
- package/dist/debugger/shell/run-controls.js +99 -0
- package/dist/debugger/shell/run-search.d.ts +6 -0
- package/dist/debugger/shell/run-search.js +100 -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/effects.d.ts +12 -0
- package/dist/evaluator/module.d.ts +24 -0
- package/dist/projectors/index-model.d.ts +13 -7
- package/dist/projectors/index-model.js +21 -26
- package/dist/projectors/memory.js +19 -11
- package/dist/projectors/postgres.js +20 -19
- package/dist/projectors/schema.js +20 -18
- package/dist/projectors/sqlite.js +32 -27
- package/dist/react/materialize.js +16 -11
- package/dist/react/react.d.ts +6 -2
- package/dist/react/react.js +5 -2
- package/dist/react/store.d.ts +1 -1
- package/dist/react/store.js +1 -1
- package/dist/react/tables.d.ts +3 -2
- package/dist/runtime/cancellation.js +14 -27
- package/dist/runtime/errors.d.ts +39 -0
- package/dist/runtime/errors.js +32 -0
- package/dist/runtime/helpers.d.ts +2 -0
- package/dist/runtime/helpers.js +23 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/looms.d.ts +13 -1
- package/dist/runtime/looms.js +5 -2
- package/dist/runtime/repository.js +16 -1
- package/dist/runtime/run-start.js +1 -3
- package/dist/runtime/runtime.d.ts +1 -1
- package/dist/runtime/runtime.js +60 -18
- package/dist/runtime/server/auth.d.ts +1 -0
- package/dist/runtime/server/auth.js +5 -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 +5 -1
- package/dist/runtime/server/fetch-handler.js +24 -13
- package/dist/runtime/server/http.d.ts +3 -0
- package/dist/runtime/server/http.js +21 -2
- package/dist/runtime/server/routes/definitions.d.ts +3 -0
- package/dist/runtime/server/routes/definitions.js +20 -0
- package/dist/runtime/server/routes/runs.js +43 -3
- package/dist/runtime/server.d.ts +3 -1
- package/dist/runtime/server.js +3 -1
- package/dist/runtime/types.d.ts +11 -1
- package/dist/runtime/wake-engine.js +5 -2
- package/dist/s2/snapshot-store.js +45 -7
- 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/effects.d.ts +24 -0
- package/dist/workflow/effects.js +1 -0
- package/dist/workflow/module.d.ts +48 -0
- package/package.json +20 -1
- 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/agent/module.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createAgentSessionThread } from './agent-session.js';
|
|
|
4
4
|
import { AgentDefinitionsLive } from './definitions-store.js';
|
|
5
5
|
import { callLlmEffect, executeToolEffect } from './effects.js';
|
|
6
6
|
import { llmFromAdapter, LlmTag, StubLlmLive } from './llm.js';
|
|
7
|
-
import { conversation, tokenUsage } from './projections.js';
|
|
7
|
+
import { conversation, tokenUsage, turnActivity } from './projections.js';
|
|
8
8
|
import { agentModule } from './scope.js';
|
|
9
9
|
import { agentThread } from './threads.js';
|
|
10
10
|
export function agent(options = {}) {
|
|
@@ -27,13 +27,17 @@ export function agent(options = {}) {
|
|
|
27
27
|
projections: {
|
|
28
28
|
conversation,
|
|
29
29
|
tokenUsage,
|
|
30
|
+
turnActivity,
|
|
30
31
|
},
|
|
31
32
|
services: () => Layer.merge(llmLayer, AgentDefinitionsLive(agentDefinitions)),
|
|
32
|
-
interruptsOnSignal
|
|
33
|
-
Predicate.isObject(event.payload) &&
|
|
34
|
-
event.payload.interrupt === true &&
|
|
35
|
-
event.threadId
|
|
36
|
-
? [event.threadId]
|
|
37
|
-
: [],
|
|
33
|
+
interruptsOnSignal,
|
|
38
34
|
}));
|
|
39
35
|
}
|
|
36
|
+
/** A stop or an interrupting steer abandons the turn in progress on its thread. */
|
|
37
|
+
function interruptsOnSignal(event) {
|
|
38
|
+
const abandonsTurn = event.type === 'agent.turn.stopped' ||
|
|
39
|
+
(event.type === 'agent.steered' &&
|
|
40
|
+
Predicate.isObject(event.payload) &&
|
|
41
|
+
event.payload.interrupt === true);
|
|
42
|
+
return abandonsTurn && event.threadId ? [event.threadId] : [];
|
|
43
|
+
}
|
|
@@ -11,6 +11,11 @@ export declare const conversation: import("@swirls/looms/core").ProjectionDefini
|
|
|
11
11
|
}[] | undefined;
|
|
12
12
|
}[];
|
|
13
13
|
}>;
|
|
14
|
+
/** Whether the run's root agent or session has a turn in progress that `stopAgentTurn` can end. */
|
|
15
|
+
export declare const turnActivity: import("@swirls/looms/core").ProjectionDefinition<{
|
|
16
|
+
readonly rootThreadId: string | null;
|
|
17
|
+
readonly active: boolean;
|
|
18
|
+
}>;
|
|
14
19
|
export declare const tokenUsage: import("@swirls/looms/core").ProjectionDefinition<{
|
|
15
20
|
readonly input: number;
|
|
16
21
|
readonly output: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Predicate } from 'effect';
|
|
2
2
|
import { agentModule } from './scope.js';
|
|
3
|
-
import {
|
|
3
|
+
import { closeOpenToolCalls } from './transcript.js';
|
|
4
|
+
import { ConversationSchema, TokenUsageSchema, TurnActivitySchema, } from './types.js';
|
|
4
5
|
export const conversation = agentModule.projection({
|
|
5
6
|
name: 'conversation',
|
|
6
7
|
shape: ConversationSchema,
|
|
@@ -40,7 +41,8 @@ export const conversation = agentModule.projection({
|
|
|
40
41
|
name: raw.name ?? undefined,
|
|
41
42
|
toolCalls,
|
|
42
43
|
};
|
|
43
|
-
|
|
44
|
+
const interrupted = event.type === 'agent.steered' && event.payload.interrupt === true;
|
|
45
|
+
return { lines: [...(interrupted ? closeOpenToolCalls(state.lines) : state.lines), line] };
|
|
44
46
|
}
|
|
45
47
|
case 'agent.tool.result': {
|
|
46
48
|
const { error, result, toolCallId, name } = event.payload;
|
|
@@ -56,6 +58,45 @@ export const conversation = agentModule.projection({
|
|
|
56
58
|
lines: [...state.lines, toolLine],
|
|
57
59
|
};
|
|
58
60
|
}
|
|
61
|
+
case 'agent.turn.stopped':
|
|
62
|
+
return { lines: closeOpenToolCalls(state.lines) };
|
|
63
|
+
default:
|
|
64
|
+
return state;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
/** Whether the run's root agent or session has a turn in progress that `stopAgentTurn` can end. */
|
|
69
|
+
export const turnActivity = agentModule.projection({
|
|
70
|
+
name: 'turnActivity',
|
|
71
|
+
shape: TurnActivitySchema,
|
|
72
|
+
initialState: { rootThreadId: null, active: false },
|
|
73
|
+
reduce(state, event) {
|
|
74
|
+
if (event.type === 'runtime.run.started') {
|
|
75
|
+
return { ...state, rootThreadId: event.payload.rootThreadId ?? null };
|
|
76
|
+
}
|
|
77
|
+
if (event.threadId === null || event.threadId !== state.rootThreadId) {
|
|
78
|
+
return state;
|
|
79
|
+
}
|
|
80
|
+
switch (event.type) {
|
|
81
|
+
case 'runtime.thread.started':
|
|
82
|
+
return { ...state, active: event.payload.kind === 'agent' };
|
|
83
|
+
case 'agent.message.received':
|
|
84
|
+
case 'agent.tool_call.requested':
|
|
85
|
+
case 'agent.session.turn.started':
|
|
86
|
+
return { ...state, active: true };
|
|
87
|
+
case 'agent.steered':
|
|
88
|
+
return event.payload.interrupt === true ? { ...state, active: true } : state;
|
|
89
|
+
case 'agent.message':
|
|
90
|
+
case 'agent.turn.stopped':
|
|
91
|
+
case 'runtime.thread.completed':
|
|
92
|
+
case 'runtime.thread.failed':
|
|
93
|
+
case 'runtime.thread.cancelled':
|
|
94
|
+
return { ...state, active: false };
|
|
95
|
+
case 'runtime.wait.satisfied':
|
|
96
|
+
return Predicate.isObject(event.payload.tag) &&
|
|
97
|
+
event.payload.tag.kind === 'agent-session-turn'
|
|
98
|
+
? { ...state, active: false }
|
|
99
|
+
: state;
|
|
59
100
|
default:
|
|
60
101
|
return state;
|
|
61
102
|
}
|
package/dist/agent/scope.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
69
69
|
}>;
|
|
70
70
|
readonly interrupt: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
71
71
|
}>;
|
|
72
|
+
'turn.stopped': import("effect/Schema").Struct<{}>;
|
|
72
73
|
'session.message.submitted': import("effect/Schema").Struct<{
|
|
73
74
|
readonly messageId: import("effect/Schema").String;
|
|
74
75
|
readonly text: import("effect/Schema").String;
|
|
@@ -231,6 +232,7 @@ export declare const agentModule: import("@swirls/looms/core").ModuleScope<"agen
|
|
|
231
232
|
}>;
|
|
232
233
|
readonly interrupt: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
233
234
|
}>;
|
|
235
|
+
'turn.stopped': import("effect/Schema").Struct<{}>;
|
|
234
236
|
'session.message.submitted': import("effect/Schema").Struct<{
|
|
235
237
|
readonly messageId: import("effect/Schema").String;
|
|
236
238
|
readonly text: import("effect/Schema").String;
|
package/dist/agent/signals.d.ts
CHANGED
|
@@ -16,6 +16,11 @@ export declare function userMessage(content: string, options?: AgentSignalOption
|
|
|
16
16
|
export declare function steer(content: string, options?: AgentSignalOptions & {
|
|
17
17
|
readonly interrupt?: boolean;
|
|
18
18
|
}): EventInput;
|
|
19
|
+
/**
|
|
20
|
+
* Build the `agent.turn.stopped` event. A conversational agent aborts its in-flight turn and
|
|
21
|
+
* waits for the next message; an agent session cancels its active turn and stays open.
|
|
22
|
+
*/
|
|
23
|
+
export declare function stopAgentTurn(options?: AgentSignalOptions): EventInput;
|
|
19
24
|
export interface AgentSessionMessageOptions extends AgentSignalOptions {
|
|
20
25
|
readonly delivery?: AgentMessageDelivery;
|
|
21
26
|
/** Set by the client helper when a steer is aimed at an active child. */
|
|
@@ -35,6 +40,8 @@ interface AgentSessionSignalClient<Result> {
|
|
|
35
40
|
signal(runId: string, events: ReadonlyArray<EventInput>): Promise<Result>;
|
|
36
41
|
cancel?(runId: string, threadId?: string): Promise<Result>;
|
|
37
42
|
}
|
|
43
|
+
/** Events for one session message. A steer aimed at `activeChildThreadId` interrupts that turn in the same batch. */
|
|
44
|
+
export declare function agentSessionMessageEvents(messageId: string, text: string, options?: AgentSessionMessageOptions): EventInput[];
|
|
38
45
|
export declare function sendAgentSessionMessage<Result>(client: AgentSessionSignalClient<Result>, runId: string, messageId: string, text: string, options?: Omit<AgentSessionMessageOptions, 'activeChildThreadId'>): Promise<Result>;
|
|
39
46
|
export declare function cancelActiveAgentTurn<Result>(client: AgentSessionSignalClient<Result>, runId: string, options?: AgentSignalOptions): Promise<Result | Awaited<ReturnType<AgentSessionSignalClient<Result>['getRun']>>>;
|
|
40
47
|
export {};
|
package/dist/agent/signals.js
CHANGED
|
@@ -18,6 +18,13 @@ export function steer(content, options = {}) {
|
|
|
18
18
|
message: { role: 'user', content },
|
|
19
19
|
}, { threadId: options.threadId });
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Build the `agent.turn.stopped` event. A conversational agent aborts its in-flight turn and
|
|
23
|
+
* waits for the next message; an agent session cancels its active turn and stays open.
|
|
24
|
+
*/
|
|
25
|
+
export function stopAgentTurn(options = {}) {
|
|
26
|
+
return agentModule.input('turn.stopped', {}, { threadId: options.threadId });
|
|
27
|
+
}
|
|
21
28
|
export function submitAgentMessage(messageId, text, options = {}) {
|
|
22
29
|
return agentModule.input('session.message.submitted', {
|
|
23
30
|
messageId,
|
|
@@ -54,26 +61,28 @@ function activeTurnFrom(value) {
|
|
|
54
61
|
}
|
|
55
62
|
: null;
|
|
56
63
|
}
|
|
64
|
+
/** Events for one session message. A steer aimed at `activeChildThreadId` interrupts that turn in the same batch. */
|
|
65
|
+
export function agentSessionMessageEvents(messageId, text, options = {}) {
|
|
66
|
+
const events = [submitAgentMessage(messageId, text, options)];
|
|
67
|
+
if (options.delivery === 'steer' && options.activeChildThreadId) {
|
|
68
|
+
events.push(agentModule.input('steered', {
|
|
69
|
+
turn: 0,
|
|
70
|
+
messageId,
|
|
71
|
+
message: { role: 'user', content: text },
|
|
72
|
+
interrupt: true,
|
|
73
|
+
}, { threadId: options.activeChildThreadId }));
|
|
74
|
+
}
|
|
75
|
+
return events;
|
|
76
|
+
}
|
|
57
77
|
export function sendAgentSessionMessage(client, runId, messageId, text, options = {}) {
|
|
58
78
|
return client.getRun(runId).then((run) => {
|
|
59
79
|
const threadId = options.threadId ?? run.rootThreadId ?? undefined;
|
|
60
80
|
const active = options.delivery === 'steer' && threadId ? activeTurnFrom(run.threads[threadId]?.state) : null;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}),
|
|
67
|
-
];
|
|
68
|
-
if (active) {
|
|
69
|
-
events.push(agentModule.input('steered', {
|
|
70
|
-
turn: 0,
|
|
71
|
-
messageId,
|
|
72
|
-
message: { role: 'user', content: text },
|
|
73
|
-
interrupt: true,
|
|
74
|
-
}, { threadId: active.childThreadId }));
|
|
75
|
-
}
|
|
76
|
-
return client.signal(runId, events);
|
|
81
|
+
return client.signal(runId, agentSessionMessageEvents(messageId, text, {
|
|
82
|
+
...options,
|
|
83
|
+
threadId,
|
|
84
|
+
activeChildThreadId: active?.childThreadId,
|
|
85
|
+
}));
|
|
77
86
|
});
|
|
78
87
|
}
|
|
79
88
|
export function cancelActiveAgentTurn(client, runId, options = {}) {
|
package/dist/agent/threads.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Predicate } from 'effect';
|
|
2
|
-
import { createWaitId, DEFAULT_DEFINITION_VERSION, emit, invoke, isWithdrawnError, parseEffectId, spawn, wait, waitOutcome, } from '@swirls/looms/core';
|
|
2
|
+
import { cancel, createWaitId, DEFAULT_DEFINITION_VERSION, emit, invoke, isWithdrawnError, parseEffectId, spawn, wait, waitOutcome, } from '@swirls/looms/core';
|
|
3
3
|
import { callLlmEffect, executeToolEffect } from './effects.js';
|
|
4
4
|
import { agentModule } from './scope.js';
|
|
5
|
+
import { closeOpenToolCalls } from './transcript.js';
|
|
5
6
|
function inputToLine(input) {
|
|
6
7
|
if (input === null) {
|
|
7
8
|
return null;
|
|
@@ -26,20 +27,31 @@ function inputToLine(input) {
|
|
|
26
27
|
return { role: 'user', content: JSON.stringify(input) };
|
|
27
28
|
}
|
|
28
29
|
function attachToolCall(lines, toolCall) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
const existing = line.toolCalls ?? [];
|
|
35
|
-
if (existing.some((item) => item.id === toolCall.id)) {
|
|
36
|
-
return [...lines];
|
|
37
|
-
}
|
|
38
|
-
const next = [...lines];
|
|
39
|
-
next[index] = { ...line, toolCalls: [...existing, toolCall] };
|
|
40
|
-
return next;
|
|
30
|
+
const index = lines.findLastIndex((line) => line.role === 'assistant');
|
|
31
|
+
const line = lines[index];
|
|
32
|
+
if (!line || line.toolCalls?.some((item) => item.id === toolCall.id)) {
|
|
33
|
+
return [...lines];
|
|
41
34
|
}
|
|
42
|
-
return [...
|
|
35
|
+
return lines.with(index, { ...line, toolCalls: [...(line.toolCalls ?? []), toolCall] });
|
|
36
|
+
}
|
|
37
|
+
/** Drop the turn in progress: answer its open tool calls and cancel the children they started. */
|
|
38
|
+
function abandonTurn(state) {
|
|
39
|
+
return {
|
|
40
|
+
...state,
|
|
41
|
+
lines: closeOpenToolCalls(state.lines),
|
|
42
|
+
pendingSteer: null,
|
|
43
|
+
pendingToolCalls: [],
|
|
44
|
+
executingToolCalls: [],
|
|
45
|
+
pendingSpawns: [],
|
|
46
|
+
pendingEffects: [],
|
|
47
|
+
pendingEmits: [],
|
|
48
|
+
pendingEffectTools: {},
|
|
49
|
+
needsLlmCall: false,
|
|
50
|
+
abandonedChildThreadIds: [
|
|
51
|
+
...(state.abandonedChildThreadIds ?? []),
|
|
52
|
+
...state.pendingSpawns.map((item) => item.childThreadId),
|
|
53
|
+
],
|
|
54
|
+
};
|
|
43
55
|
}
|
|
44
56
|
export const agentThread = agentModule.thread({
|
|
45
57
|
kind: 'agent',
|
|
@@ -86,6 +98,7 @@ export const agentThread = agentModule.thread({
|
|
|
86
98
|
turn: event.payload.turn,
|
|
87
99
|
needsLlmCall: false,
|
|
88
100
|
pendingSteer: null,
|
|
101
|
+
abandonedChildThreadIds: [],
|
|
89
102
|
};
|
|
90
103
|
}
|
|
91
104
|
case 'agent.message.received': {
|
|
@@ -148,15 +161,11 @@ export const agentThread = agentModule.thread({
|
|
|
148
161
|
? [...state.consumedSteerMessageIds, messageId]
|
|
149
162
|
: state.consumedSteerMessageIds;
|
|
150
163
|
if (interrupt) {
|
|
164
|
+
const abandoned = abandonTurn(state);
|
|
151
165
|
return {
|
|
152
|
-
...
|
|
153
|
-
lines: [...
|
|
166
|
+
...abandoned,
|
|
167
|
+
lines: [...abandoned.lines, message],
|
|
154
168
|
pendingSteer: message,
|
|
155
|
-
pendingToolCalls: [],
|
|
156
|
-
executingToolCalls: [],
|
|
157
|
-
pendingSpawns: [],
|
|
158
|
-
pendingEffects: [],
|
|
159
|
-
pendingEmits: [],
|
|
160
169
|
needsLlmCall: true,
|
|
161
170
|
consumedSteerMessageIds,
|
|
162
171
|
};
|
|
@@ -168,6 +177,8 @@ export const agentThread = agentModule.thread({
|
|
|
168
177
|
consumedSteerMessageIds,
|
|
169
178
|
};
|
|
170
179
|
}
|
|
180
|
+
case 'agent.turn.stopped':
|
|
181
|
+
return abandonTurn(state);
|
|
171
182
|
case 'agent.spawn.requested': {
|
|
172
183
|
const { childThreadId, kind, definitionName, definitionVersion, toolCallId, input } = event.payload;
|
|
173
184
|
return {
|
|
@@ -370,6 +381,9 @@ export const agentThread = agentModule.thread({
|
|
|
370
381
|
for (const emitReq of state.pendingEmits) {
|
|
371
382
|
effects.push(emit(emitReq.event));
|
|
372
383
|
}
|
|
384
|
+
for (const childThreadId of state.abandonedChildThreadIds ?? []) {
|
|
385
|
+
effects.push(cancel(childThreadId));
|
|
386
|
+
}
|
|
373
387
|
return effects;
|
|
374
388
|
},
|
|
375
389
|
});
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { JsonValue, SchemaInput } from '@swirls/looms/core';
|
|
1
|
+
import { type JsonValue } from '@swirls/looms/core';
|
|
3
2
|
import { type AgentToolEntry, type ToolLike } from './definitions';
|
|
4
3
|
import type { LlmToolSpec } from './llm';
|
|
5
|
-
interface StandardJsonSchemaConverter {
|
|
6
|
-
readonly input: (options: {
|
|
7
|
-
target: string;
|
|
8
|
-
}) => JsonValue;
|
|
9
|
-
}
|
|
10
|
-
interface StandardJsonSchemaHolder {
|
|
11
|
-
readonly '~standard': {
|
|
12
|
-
readonly jsonSchema?: {
|
|
13
|
-
readonly input?: StandardJsonSchemaConverter['input'];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
type SchemaCandidate = SchemaInput | StandardJsonSchemaHolder | Schema.Codec<JsonValue>;
|
|
18
4
|
export declare function toolJsonSchema(tool: ToolLike): JsonValue;
|
|
19
5
|
export declare function toolSpecs(tools?: ReadonlyArray<AgentToolEntry>): LlmToolSpec[];
|
|
20
|
-
export declare function jsonSchemaFromStandard(schema: SchemaCandidate | null | undefined): JsonValue;
|
|
21
|
-
export {};
|
|
@@ -1,43 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsonSchemaOfInput } from '@swirls/looms/core';
|
|
2
2
|
import { normalizeTools } from './definitions.js';
|
|
3
3
|
const EMPTY_OBJECT_SCHEMA = { type: 'object' };
|
|
4
|
-
function
|
|
5
|
-
return '~standard' in value;
|
|
6
|
-
}
|
|
7
|
-
function fromStandardJsonSchema(schema) {
|
|
8
|
-
if (!isStandardJsonSchemaHolder(schema)) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
const input = schema['~standard'].jsonSchema?.input;
|
|
12
|
-
if (!input) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
return input({ target: 'draft-2020-12' });
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function fromEffectSchema(schema) {
|
|
23
|
-
if (!Schema.isSchema(schema)) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
const standard = Schema.toStandardJSONSchemaV1(schema);
|
|
28
|
-
return fromStandardJsonSchema(standard);
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function fromInputCandidate(input) {
|
|
35
|
-
if (!input) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
return fromStandardJsonSchema(input) ?? fromEffectSchema(input);
|
|
39
|
-
}
|
|
40
|
-
function toolInputCandidate(tool) {
|
|
4
|
+
function toolInput(tool) {
|
|
41
5
|
switch (tool.kind) {
|
|
42
6
|
case 'function':
|
|
43
7
|
return tool.input;
|
|
@@ -52,7 +16,7 @@ function toolInputCandidate(tool) {
|
|
|
52
16
|
}
|
|
53
17
|
}
|
|
54
18
|
export function toolJsonSchema(tool) {
|
|
55
|
-
return
|
|
19
|
+
return jsonSchemaOfInput(toolInput(tool)) ?? EMPTY_OBJECT_SCHEMA;
|
|
56
20
|
}
|
|
57
21
|
export function toolSpecs(tools = []) {
|
|
58
22
|
return normalizeTools(tools).map((tool) => ({
|
|
@@ -61,6 +25,3 @@ export function toolSpecs(tools = []) {
|
|
|
61
25
|
inputJsonSchema: toolJsonSchema(tool),
|
|
62
26
|
}));
|
|
63
27
|
}
|
|
64
|
-
export function jsonSchemaFromStandard(schema) {
|
|
65
|
-
return fromInputCandidate(schema ?? undefined) ?? EMPTY_OBJECT_SCHEMA;
|
|
66
|
-
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Message } from './types';
|
|
2
|
+
export declare const STOPPED_TOOL_RESULT = "Stopped before the tool returned a result.";
|
|
3
|
+
/**
|
|
4
|
+
* Answer every assistant tool call that has no tool result yet. Model APIs reject a transcript
|
|
5
|
+
* whose tool calls are left unanswered, so a stopped turn closes them before the next turn.
|
|
6
|
+
*/
|
|
7
|
+
export declare function closeOpenToolCalls(lines: readonly Message[]): Message[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const STOPPED_TOOL_RESULT = 'Stopped before the tool returned a result.';
|
|
2
|
+
/**
|
|
3
|
+
* Answer every assistant tool call that has no tool result yet. Model APIs reject a transcript
|
|
4
|
+
* whose tool calls are left unanswered, so a stopped turn closes them before the next turn.
|
|
5
|
+
*/
|
|
6
|
+
export function closeOpenToolCalls(lines) {
|
|
7
|
+
const answered = new Set(lines.flatMap((line) => (line.toolCallId ? [line.toolCallId] : [])));
|
|
8
|
+
const closing = lines.flatMap((line) => line.role === 'assistant'
|
|
9
|
+
? (line.toolCalls ?? [])
|
|
10
|
+
.filter((call) => !answered.has(call.id))
|
|
11
|
+
.map((call) => ({
|
|
12
|
+
role: 'tool',
|
|
13
|
+
content: STOPPED_TOOL_RESULT,
|
|
14
|
+
toolCallId: call.id,
|
|
15
|
+
name: call.name,
|
|
16
|
+
}))
|
|
17
|
+
: []);
|
|
18
|
+
return closing.length === 0 ? [...lines] : [...lines, ...closing];
|
|
19
|
+
}
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -39,6 +39,11 @@ export declare const TokenUsageSchema: Schema.Struct<{
|
|
|
39
39
|
readonly output: Schema.Finite;
|
|
40
40
|
}>;
|
|
41
41
|
export type TokenUsage = Schema.Schema.Type<typeof TokenUsageSchema>;
|
|
42
|
+
export declare const TurnActivitySchema: Schema.Struct<{
|
|
43
|
+
readonly rootThreadId: Schema.NullOr<Schema.String>;
|
|
44
|
+
readonly active: Schema.Boolean;
|
|
45
|
+
}>;
|
|
46
|
+
export type TurnActivity = Schema.Schema.Type<typeof TurnActivitySchema>;
|
|
42
47
|
export declare const ThreadStartedPayloadSchema: Schema.Struct<{
|
|
43
48
|
readonly definitionName: Schema.optional<Schema.String>;
|
|
44
49
|
readonly definitionVersion: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
@@ -87,6 +92,11 @@ export interface AgentState {
|
|
|
87
92
|
[causingSeq: string]: PendingEffectTool;
|
|
88
93
|
};
|
|
89
94
|
consumedSteerMessageIds: string[];
|
|
95
|
+
/**
|
|
96
|
+
* Children of an abandoned turn that still need cancelling, cleared when the next turn starts.
|
|
97
|
+
* Optional so snapshots taken before turns could be abandoned still fold.
|
|
98
|
+
*/
|
|
99
|
+
abandonedChildThreadIds?: string[];
|
|
90
100
|
}
|
|
91
101
|
export type AgentMessageDelivery = 'steer' | 'followUp' | 'nextTurn';
|
|
92
102
|
export type AgentSessionTurnStatus = 'completed' | 'failed' | 'cancelled';
|
package/dist/agent/types.js
CHANGED
|
@@ -25,6 +25,10 @@ export const TokenUsageSchema = Schema.Struct({
|
|
|
25
25
|
input: Schema.Finite,
|
|
26
26
|
output: Schema.Finite,
|
|
27
27
|
});
|
|
28
|
+
export const TurnActivitySchema = Schema.Struct({
|
|
29
|
+
rootThreadId: Schema.NullOr(Schema.String),
|
|
30
|
+
active: Schema.Boolean,
|
|
31
|
+
});
|
|
28
32
|
export const ThreadStartedPayloadSchema = Schema.Struct({
|
|
29
33
|
definitionName: Schema.optional(Schema.String),
|
|
30
34
|
definitionVersion: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed(DEFAULT_DEFINITION_VERSION))),
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { vercelLlm, type VercelLlmOptions } from './vercel-llm';
|
|
2
|
-
export { toEvaluatorAnswers, vercelEvaluator, type VercelEvaluatorOptions, } from './vercel-evaluator';
|
|
2
|
+
export { toEvaluatorAnswers, vercelEvaluator, type EvaluationModelProvider, type VercelEvaluatorOptions, } from './vercel-evaluator';
|
|
3
3
|
export { toLoomsToolCalls, toModelMessages } from './messages';
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
+
import { experimental_evaluate } from 'ai';
|
|
1
2
|
import type { EvaluatorAdapter, EvaluatorAnswers, EvaluatorQuestions } from '@swirls/looms/evaluator';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type EvaluateOptions = Parameters<typeof experimental_evaluate>[0];
|
|
4
|
+
type EvaluationModel = Exclude<EvaluateOptions['model'], string>;
|
|
5
|
+
/** An AI SDK provider with evaluation models, such as `createTypeSafeAi({ apiKey })`. */
|
|
6
|
+
export interface EvaluationModelProvider {
|
|
7
|
+
readonly evaluationModel: (modelId: string) => EvaluationModel;
|
|
8
|
+
}
|
|
9
|
+
interface VercelEvaluatorBaseOptions {
|
|
5
10
|
/** Abort the hosted call after this many milliseconds. Defaults to 2000. */
|
|
6
11
|
readonly timeoutMs?: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly zeroDataRetention?: boolean;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
+
/** Defaults to AI Gateway zero data retention when no `provider` is set. */
|
|
13
|
+
readonly providerOptions?: EvaluateOptions['providerOptions'];
|
|
12
14
|
}
|
|
15
|
+
export type VercelEvaluatorOptions = VercelEvaluatorBaseOptions & ({
|
|
16
|
+
/** AI Gateway model id. Defaults to TypeSafe Jev (`typesafe-ai/jev`). */
|
|
17
|
+
readonly model?: string;
|
|
18
|
+
readonly provider?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
/** Default model id for `provider`. A definition's own `model` takes precedence. */
|
|
21
|
+
readonly model: string;
|
|
22
|
+
/** Resolves model ids with your own provider and key instead of the AI Gateway. */
|
|
23
|
+
readonly provider: EvaluationModelProvider;
|
|
24
|
+
});
|
|
13
25
|
interface EvaluateAnswer {
|
|
26
|
+
readonly type?: 'boolean' | 'choice' | 'score';
|
|
14
27
|
readonly probability?: number;
|
|
15
28
|
readonly choice?: string;
|
|
16
29
|
readonly score?: number;
|
|
@@ -44,11 +44,16 @@ export function toEvaluatorAnswers(questions, raw) {
|
|
|
44
44
|
}
|
|
45
45
|
export function vercelEvaluator(options = {}) {
|
|
46
46
|
const timeoutMs = options.timeoutMs ?? 2000;
|
|
47
|
-
const providerOptions = options.providerOptions ??
|
|
47
|
+
const providerOptions = options.providerOptions ??
|
|
48
|
+
(options.provider ? undefined : { gateway: { zeroDataRetention: true } });
|
|
49
|
+
function resolveModel(modelId) {
|
|
50
|
+
const id = modelId ?? options.model ?? DEFAULT_EVALUATOR_MODEL;
|
|
51
|
+
return options.provider ? options.provider.evaluationModel(id) : id;
|
|
52
|
+
}
|
|
48
53
|
return {
|
|
49
54
|
evaluate: (args) => Effect.runPromise(Effect.tryPromise({
|
|
50
55
|
try: () => experimental_evaluate({
|
|
51
|
-
model: args.model
|
|
56
|
+
model: resolveModel(args.model),
|
|
52
57
|
state: args.state,
|
|
53
58
|
abortSignal: abortSignalFor(timeoutMs, args.signal),
|
|
54
59
|
maxRetries: 0,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, StatusBadge, useDebugger } from '@swirls/looms/debugger';
|
|
3
|
+
import { useProjection, useRunStore, useRunSummary } from '@swirls/looms/react';
|
|
4
|
+
import { pendingApprovals } from '../projections.js';
|
|
5
|
+
import { decision } from '../signals.js';
|
|
6
|
+
export function ApprovalsView({ runId }) {
|
|
7
|
+
const { client } = useDebugger();
|
|
8
|
+
const store = useRunStore(runId);
|
|
9
|
+
const state = useProjection(store, pendingApprovals);
|
|
10
|
+
const { finished } = useRunSummary(store);
|
|
11
|
+
if (state.items.length === 0) {
|
|
12
|
+
return _jsx("p", { className: "text-muted-foreground text-xs", children: "No approvals requested." });
|
|
13
|
+
}
|
|
14
|
+
function decide(approvalId, outcome) {
|
|
15
|
+
void client.signal(runId, [decision(approvalId, outcome)]);
|
|
16
|
+
}
|
|
17
|
+
return (_jsx("ul", { className: "grid gap-2", children: state.items.map((item) => (_jsxs("li", { className: "border-border bg-card/60 rounded-lg border p-2.5", children: [_jsxs("div", { className: "flex items-center gap-2 text-xs", children: [_jsx("span", { className: "min-w-0 flex-1 truncate font-medium", children: item.title || item.approvalId }), _jsx(StatusBadge, { status: item.status })] }), item.status === 'pending' && !finished ? (_jsxs("div", { className: "mt-2 flex gap-1.5", children: [_jsx(Button, { size: "xs", onClick: () => decide(item.approvalId, 'approve'), children: "Approve" }), _jsx(Button, { size: "xs", variant: "outline", onClick: () => decide(item.approvalId, 'reject'), children: "Reject" })] })) : null] }, item.approvalId))) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { pendingApprovals } from '../projections.js';
|
|
2
|
+
import { ApprovalsView } from './approvals-view.js';
|
|
3
|
+
import { summarizeApprovalEvent } from './summarize.js';
|
|
4
|
+
export const approvalDebugger = {
|
|
5
|
+
name: 'approval',
|
|
6
|
+
families: [
|
|
7
|
+
{ family: 'approval', color: 'oklch(0.72 0.15 45)', summarize: summarizeApprovalEvent },
|
|
8
|
+
],
|
|
9
|
+
projections: [{ name: pendingApprovals.name, component: ApprovalsView }],
|
|
10
|
+
};
|
|
11
|
+
export { ApprovalsView };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsonFields, jsonText } from '@swirls/looms/debugger';
|
|
2
|
+
export function summarizeApprovalEvent(event) {
|
|
3
|
+
const payload = jsonFields(event.payload);
|
|
4
|
+
switch (event.type) {
|
|
5
|
+
case 'approval.requested':
|
|
6
|
+
return { title: 'approval requested', detail: jsonText(payload.title) };
|
|
7
|
+
case 'approval.decided':
|
|
8
|
+
return {
|
|
9
|
+
title: `approval ${jsonText(payload.outcome) ?? 'decided'}`,
|
|
10
|
+
detail: jsonText(payload.approvalId),
|
|
11
|
+
};
|
|
12
|
+
case 'approval.timed_out':
|
|
13
|
+
return { title: 'approval timed out', detail: jsonText(payload.approvalId) };
|
|
14
|
+
default:
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -116,6 +116,11 @@ export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core")
|
|
|
116
116
|
readonly attempt: number;
|
|
117
117
|
readonly deadlineAt: number | null;
|
|
118
118
|
};
|
|
119
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
120
|
+
readonly type: "runtime.fork.elided";
|
|
121
|
+
readonly payload: {
|
|
122
|
+
readonly type: string;
|
|
123
|
+
};
|
|
119
124
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
120
125
|
readonly type: "runtime.run.cancelled";
|
|
121
126
|
readonly payload: {
|
|
@@ -127,6 +132,12 @@ export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core")
|
|
|
127
132
|
readonly output: import("effect/Schema").Json;
|
|
128
133
|
readonly error: string | null;
|
|
129
134
|
};
|
|
135
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
136
|
+
readonly type: "runtime.run.forked";
|
|
137
|
+
readonly payload: {
|
|
138
|
+
readonly sourceRunId: string;
|
|
139
|
+
readonly sourceSeq: number;
|
|
140
|
+
};
|
|
130
141
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
131
142
|
readonly type: "runtime.run.started";
|
|
132
143
|
readonly payload: {
|
|
@@ -159,6 +170,7 @@ export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core")
|
|
|
159
170
|
readonly payload: {
|
|
160
171
|
readonly threadId: string;
|
|
161
172
|
readonly reason?: string | undefined;
|
|
173
|
+
readonly resumeSeq?: number | undefined;
|
|
162
174
|
};
|
|
163
175
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
164
176
|
readonly type: "runtime.thread.completed";
|