@swirls/looms 0.13.2 → 0.15.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 +16 -0
- package/dist/actor/cell.d.ts +3 -9
- package/dist/actor/host.d.ts +2 -4
- package/dist/agent/agent-session.js +12 -11
- package/dist/agent/effects.d.ts +77 -0
- package/dist/agent/events.d.ts +70 -0
- package/dist/agent/events.js +2 -1
- package/dist/agent/module.d.ts +329 -0
- package/dist/agent/projections.d.ts +7 -0
- package/dist/agent/projections.js +2 -1
- package/dist/agent/scope.d.ts +70 -0
- package/dist/agent/signals.d.ts +63 -0
- package/dist/agent/signals.js +7 -4
- package/dist/agent/threads.js +8 -11
- package/dist/agent/types.d.ts +49 -0
- package/dist/agent/types.js +33 -0
- package/dist/ai-vercel/index.d.ts +1 -1
- package/dist/ai-vercel/index.js +1 -1
- package/dist/ai-vercel/messages.d.ts +19 -2
- package/dist/ai-vercel/messages.js +60 -2
- package/dist/ai-vercel/vercel-llm.d.ts +6 -0
- package/dist/ai-vercel/vercel-llm.js +9 -2
- package/dist/cloudflare/durable-object.d.ts +5 -17
- package/dist/core/event-codec.js +3 -0
- package/dist/debugger/app/assets/{index-Dqg2e5oY.js → index-CZwbkhFX.js} +3 -3
- package/dist/debugger/app/assets/routes-CSuFE23L.js +47 -0
- package/dist/debugger/app/index.html +1 -1
- package/dist/react/derived.d.ts +5 -2
- package/dist/react/derived.js +27 -4
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/react.d.ts +16 -4
- package/dist/react/react.js +20 -10
- package/dist/react/store.d.ts +43 -1
- package/dist/react/store.js +201 -24
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/looms.d.ts +2 -4
- package/dist/runtime/runtime.d.ts +1 -1
- package/dist/runtime/runtime.js +7 -1
- package/dist/runtime/server/http.d.ts +6 -0
- package/dist/runtime/server/http.js +13 -0
- package/dist/runtime/server/routes/runs.js +22 -5
- package/dist/runtime/types.d.ts +15 -8
- package/package.json +1 -1
- package/dist/debugger/app/assets/routes-DMDW7tFG.js +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @swirls/looms
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 890bacc: `store.commit` in `@swirls/looms/react` can show its events before the host confirms them. Pass `{ optimistic: true }`, or set `optimistic` on `createLoomsStore`: the events are folded into projections and live folds at once, after every confirmed event, replaced by the host's copies when those arrive, and removed if the commit fails, in which case `commit` rejects. `store.pending()` lists the events still waiting and `isPendingEvent` identifies one. `commit` also takes an `idempotencyKey` and a `send` function for writes that go through a route of your own. Events decoded from the wire now keep their `idempotencyKey`, which is how a pending event is matched to its confirmed one.
|
|
8
|
+
|
|
9
|
+
The store also reports when it has caught up: `store.synced()` and `useRunSummary(store).synced` are false until it holds everything the log had when it connected. `LoomsProvider` and `useRunStore` take `retainMs`, how long a store stays connected after its last component unmounts, and `useRunStore` and `createLoomsStore` take `fromSeq` to follow a run from a later point in its log.
|
|
10
|
+
|
|
11
|
+
- 890bacc: A signal can be answered as soon as its events are committed, without waiting for the run to finish acting on them. Pass `{ wake: 'schedule' }` to `signal` on the runtime, `createLooms`, an actor host or a Durable Object stub: it resolves once the events are on the log and leaves the wake to the scheduler, as `launchRun` does. Over HTTP, `POST /runs/:id/events` and `POST /runs/:id/signals/:namespace/:name` do the same when sent with `Prefer: respond-async` or `?respond=async`, and answer `202`. The `state` in that answer is the one the events were committed against; follow the event stream for what the run does next. `store.commit` in `@swirls/looms/react` now asks for this, so it resolves when the event is committed and no longer stays open for the length of an agent turn.
|
|
12
|
+
|
|
13
|
+
## 0.14.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 9e870dc: Agent messages can carry attachments: images, recordings, documents and other files. A message's `attachments` is a list of references (`id`, `mediaType`, and optionally `name`, `size` and `url`), so the event log never holds the bytes. `userMessage`, `steer` and agent session messages accept `attachments`, and an agent started with input shaped `{ text, attachments }` begins on a message that has them. `vercelLlm` takes a `resolveAttachment` option that reads an attachment's bytes for a model call; images are sent as image parts and everything else as file parts. An attachment the resolver returns `null` for is sent by its `url` when it has one and is named in the message text otherwise. Adapters that build their own model call can use `resolveAttachments` with `toModelMessages(messages, { attachments })`.
|
|
18
|
+
|
|
3
19
|
## 0.13.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/actor/cell.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AnyRuntimeModule, type DefinitionResolver, type EventInput, type EventStore, type EventStoreTrimCoverage, type LaunchRunArgs, type RunAttributeFields, type RunLauncher, type RunState, type RunStatusSnapshot, type SnapshotStore } from '@swirls/looms/core';
|
|
2
|
-
import { type Authorize, type EffectWorker, type LoomsRuntime, type StartResult, type StartRunArgs, type WakeScheduler } from '@swirls/looms/runtime';
|
|
2
|
+
import { type Authorize, type EffectWorker, type LoomsRuntime, type RunSignalOptions, type StartResult, type StartRunArgs, type WakeScheduler } from '@swirls/looms/runtime';
|
|
3
3
|
export interface ActorCellOptions<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
4
4
|
readonly runId: string;
|
|
5
5
|
readonly store: EventStore;
|
|
@@ -41,15 +41,9 @@ export interface ActorCell<TModules extends readonly AnyRuntimeModule[] = readon
|
|
|
41
41
|
launch(args: LaunchRunArgs): Promise<void>;
|
|
42
42
|
status(): Promise<RunStatusSnapshot | null>;
|
|
43
43
|
startRun(args: StartRunArgs): Promise<StartResult>;
|
|
44
|
-
signal(events: ReadonlyArray<EventInput>, options?:
|
|
45
|
-
idempotencyKey?: string;
|
|
46
|
-
coalesce?: boolean;
|
|
47
|
-
}): Promise<RunState>;
|
|
44
|
+
signal(events: ReadonlyArray<EventInput>, options?: RunSignalOptions): Promise<RunState>;
|
|
48
45
|
/** Append runtime-originated events. Not the client signal path. */
|
|
49
|
-
accept(events: ReadonlyArray<EventInput>, options?:
|
|
50
|
-
idempotencyKey?: string;
|
|
51
|
-
coalesce?: boolean;
|
|
52
|
-
}): Promise<RunState>;
|
|
46
|
+
accept(events: ReadonlyArray<EventInput>, options?: RunSignalOptions): Promise<RunState>;
|
|
53
47
|
cancel(): Promise<void>;
|
|
54
48
|
getRun(): Promise<RunState>;
|
|
55
49
|
}
|
package/dist/actor/host.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyRuntimeModule, DefinitionResolver, EventInput, EventStore, EventStoreTrimCoverage, RunAttributeFields, RunLauncher, RunState, SnapshotStore } from '@swirls/looms/core';
|
|
2
|
-
import { type Authorize, type StartResult, type StartRunArgs } from '@swirls/looms/runtime';
|
|
2
|
+
import { type Authorize, type RunSignalOptions, type StartResult, type StartRunArgs } from '@swirls/looms/runtime';
|
|
3
3
|
import { type ActorCell } from './cell';
|
|
4
4
|
export interface LocalActorHostOptions<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
5
5
|
readonly createStore: (runId: string) => EventStore | Promise<EventStore>;
|
|
@@ -27,9 +27,7 @@ export interface LocalActorHost<TModules extends readonly AnyRuntimeModule[] = r
|
|
|
27
27
|
getCell(runId: string): Promise<ActorCell<TModules>>;
|
|
28
28
|
readonly launcher: RunLauncher;
|
|
29
29
|
startRun(args: StartRunArgs): Promise<StartResult>;
|
|
30
|
-
signal(runId: string, events: ReadonlyArray<EventInput>, options?:
|
|
31
|
-
idempotencyKey?: string;
|
|
32
|
-
}): Promise<RunState>;
|
|
30
|
+
signal(runId: string, events: ReadonlyArray<EventInput>, options?: RunSignalOptions): Promise<RunState>;
|
|
33
31
|
getRun(runId: string): Promise<RunState>;
|
|
34
32
|
fetch(req: Request): Promise<Response | null>;
|
|
35
33
|
dispose(): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Predicate } from 'effect';
|
|
2
2
|
import { cancel, createWaitId, deterministicThreadId, emit, spawn, wait, } from '@swirls/looms/core';
|
|
3
3
|
import { agentModule } from './scope.js';
|
|
4
|
+
import { attachmentsField, userLine } from './types.js';
|
|
4
5
|
function objectPayload(event) {
|
|
5
6
|
return Predicate.isObject(event.payload) ? event.payload : {};
|
|
6
7
|
}
|
|
@@ -10,6 +11,7 @@ function messageFrom(value) {
|
|
|
10
11
|
? {
|
|
11
12
|
messageId: payload.messageId,
|
|
12
13
|
text: payload.text,
|
|
14
|
+
...attachmentsField(payload.attachments),
|
|
13
15
|
delivery: payload.delivery === 'steer' ||
|
|
14
16
|
payload.delivery === 'followUp' ||
|
|
15
17
|
payload.delivery === 'nextTurn'
|
|
@@ -113,17 +115,16 @@ export function createAgentSessionThread(definitions) {
|
|
|
113
115
|
case 'agent.session.turn.started': {
|
|
114
116
|
const messageId = event.payload.messageId;
|
|
115
117
|
const admitted = state.pendingMessages.find((message) => message.messageId === messageId);
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
const turnMessages = [...state.nextTurnMessages, ...(admitted ? [admitted] : [])];
|
|
119
|
+
const text = turnMessages.map((message) => message.text).join('\n');
|
|
120
|
+
const attachments = turnMessages.flatMap((message) => message.attachments ?? []);
|
|
121
|
+
const activeTurn = attachments.length > 0
|
|
122
|
+
? { messageId, childThreadId: event.payload.childThreadId, text, attachments }
|
|
123
|
+
: { messageId, childThreadId: event.payload.childThreadId, text };
|
|
119
124
|
return {
|
|
120
125
|
...state,
|
|
121
126
|
pendingMessages: state.pendingMessages.filter((message) => message.messageId !== messageId),
|
|
122
|
-
activeTurn
|
|
123
|
-
messageId,
|
|
124
|
-
childThreadId: event.payload.childThreadId,
|
|
125
|
-
text,
|
|
126
|
-
},
|
|
127
|
+
activeTurn,
|
|
127
128
|
nextTurnMessages: [],
|
|
128
129
|
lastSequence: state.lastSequence + 1,
|
|
129
130
|
cancelling: false,
|
|
@@ -198,12 +199,12 @@ export function createAgentSessionThread(definitions) {
|
|
|
198
199
|
effects.push(emit(agentModule.input('steered', {
|
|
199
200
|
turn: 0,
|
|
200
201
|
messageId: message.messageId,
|
|
201
|
-
message:
|
|
202
|
+
message: userLine(message.text, message.attachments),
|
|
202
203
|
interrupt: true,
|
|
203
204
|
}, { threadId: state.activeTurn.childThreadId }), `session_steer_${message.messageId}`), emit(agentModule.input('session.steer.delivered', { messageId: message.messageId, activeMessageId: state.activeTurn.messageId }, { threadId: ctx.threadId }), `session_steer_delivered_${message.messageId}`));
|
|
204
205
|
}
|
|
205
206
|
if (state.activeTurn) {
|
|
206
|
-
const { childThreadId: turnThreadId, messageId, text } = state.activeTurn;
|
|
207
|
+
const { childThreadId: turnThreadId, messageId, text, attachments } = state.activeTurn;
|
|
207
208
|
const definition = definitions.get(state.definitionName, state.definitionVersion);
|
|
208
209
|
if (state.cancelling) {
|
|
209
210
|
effects.push(cancel(turnThreadId));
|
|
@@ -214,7 +215,7 @@ export function createAgentSessionThread(definitions) {
|
|
|
214
215
|
kind: 'agent',
|
|
215
216
|
definitionName: definition.agent.name,
|
|
216
217
|
definitionVersion: definition.agent.version,
|
|
217
|
-
input: { text },
|
|
218
|
+
input: attachments ? { text, attachments: [...attachments] } : { text },
|
|
218
219
|
}));
|
|
219
220
|
}
|
|
220
221
|
// The turn wait must survive cancellation: the child's cancelled event is what closes it.
|
package/dist/agent/effects.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
11
11
|
readonly messages?: readonly {
|
|
12
12
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
13
13
|
readonly content: string;
|
|
14
|
+
readonly attachments?: readonly {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly mediaType: string;
|
|
17
|
+
readonly name?: string | undefined;
|
|
18
|
+
readonly size?: number | undefined;
|
|
19
|
+
readonly url?: string | undefined;
|
|
20
|
+
}[] | undefined;
|
|
14
21
|
readonly toolCallId?: string | undefined;
|
|
15
22
|
readonly name?: string | undefined;
|
|
16
23
|
readonly toolCalls?: {
|
|
@@ -34,6 +41,13 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
34
41
|
readonly messages?: readonly {
|
|
35
42
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
36
43
|
readonly content: string;
|
|
44
|
+
readonly attachments?: readonly {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly mediaType: string;
|
|
47
|
+
readonly name?: string | undefined;
|
|
48
|
+
readonly size?: number | undefined;
|
|
49
|
+
readonly url?: string | undefined;
|
|
50
|
+
}[] | undefined;
|
|
37
51
|
readonly toolCallId?: string | undefined;
|
|
38
52
|
readonly name?: string | undefined;
|
|
39
53
|
readonly toolCalls?: {
|
|
@@ -138,6 +152,13 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
138
152
|
readonly message: {
|
|
139
153
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
140
154
|
readonly content: string;
|
|
155
|
+
readonly attachments?: readonly {
|
|
156
|
+
readonly id: string;
|
|
157
|
+
readonly mediaType: string;
|
|
158
|
+
readonly name?: string | undefined;
|
|
159
|
+
readonly size?: number | undefined;
|
|
160
|
+
readonly url?: string | undefined;
|
|
161
|
+
}[] | undefined;
|
|
141
162
|
readonly toolCallId?: string | undefined;
|
|
142
163
|
readonly name?: string | undefined;
|
|
143
164
|
readonly toolCalls?: {
|
|
@@ -157,6 +178,13 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
157
178
|
readonly message: {
|
|
158
179
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
159
180
|
readonly content: string;
|
|
181
|
+
readonly attachments?: readonly {
|
|
182
|
+
readonly id: string;
|
|
183
|
+
readonly mediaType: string;
|
|
184
|
+
readonly name?: string | undefined;
|
|
185
|
+
readonly size?: number | undefined;
|
|
186
|
+
readonly url?: string | undefined;
|
|
187
|
+
}[] | undefined;
|
|
160
188
|
readonly toolCallId?: string | undefined;
|
|
161
189
|
readonly name?: string | undefined;
|
|
162
190
|
readonly toolCalls?: {
|
|
@@ -174,6 +202,13 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
174
202
|
readonly payload: {
|
|
175
203
|
readonly messageId: string;
|
|
176
204
|
readonly text: string;
|
|
205
|
+
readonly attachments?: readonly {
|
|
206
|
+
readonly id: string;
|
|
207
|
+
readonly mediaType: string;
|
|
208
|
+
readonly name?: string | undefined;
|
|
209
|
+
readonly size?: number | undefined;
|
|
210
|
+
readonly url?: string | undefined;
|
|
211
|
+
}[] | undefined;
|
|
177
212
|
readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
|
|
178
213
|
readonly activeChildThreadId?: string | undefined;
|
|
179
214
|
};
|
|
@@ -215,6 +250,13 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
215
250
|
readonly message: {
|
|
216
251
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
217
252
|
readonly content: string;
|
|
253
|
+
readonly attachments?: readonly {
|
|
254
|
+
readonly id: string;
|
|
255
|
+
readonly mediaType: string;
|
|
256
|
+
readonly name?: string | undefined;
|
|
257
|
+
readonly size?: number | undefined;
|
|
258
|
+
readonly url?: string | undefined;
|
|
259
|
+
}[] | undefined;
|
|
218
260
|
readonly toolCallId?: string | undefined;
|
|
219
261
|
readonly name?: string | undefined;
|
|
220
262
|
readonly toolCalls?: {
|
|
@@ -540,6 +582,13 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Loc
|
|
|
540
582
|
readonly messages?: readonly {
|
|
541
583
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
542
584
|
readonly content: string;
|
|
585
|
+
readonly attachments?: readonly {
|
|
586
|
+
readonly id: string;
|
|
587
|
+
readonly mediaType: string;
|
|
588
|
+
readonly name?: string | undefined;
|
|
589
|
+
readonly size?: number | undefined;
|
|
590
|
+
readonly url?: string | undefined;
|
|
591
|
+
}[] | undefined;
|
|
543
592
|
readonly toolCallId?: string | undefined;
|
|
544
593
|
readonly name?: string | undefined;
|
|
545
594
|
readonly toolCalls?: {
|
|
@@ -644,6 +693,13 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Loc
|
|
|
644
693
|
readonly message: {
|
|
645
694
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
646
695
|
readonly content: string;
|
|
696
|
+
readonly attachments?: readonly {
|
|
697
|
+
readonly id: string;
|
|
698
|
+
readonly mediaType: string;
|
|
699
|
+
readonly name?: string | undefined;
|
|
700
|
+
readonly size?: number | undefined;
|
|
701
|
+
readonly url?: string | undefined;
|
|
702
|
+
}[] | undefined;
|
|
647
703
|
readonly toolCallId?: string | undefined;
|
|
648
704
|
readonly name?: string | undefined;
|
|
649
705
|
readonly toolCalls?: {
|
|
@@ -663,6 +719,13 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Loc
|
|
|
663
719
|
readonly message: {
|
|
664
720
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
665
721
|
readonly content: string;
|
|
722
|
+
readonly attachments?: readonly {
|
|
723
|
+
readonly id: string;
|
|
724
|
+
readonly mediaType: string;
|
|
725
|
+
readonly name?: string | undefined;
|
|
726
|
+
readonly size?: number | undefined;
|
|
727
|
+
readonly url?: string | undefined;
|
|
728
|
+
}[] | undefined;
|
|
666
729
|
readonly toolCallId?: string | undefined;
|
|
667
730
|
readonly name?: string | undefined;
|
|
668
731
|
readonly toolCalls?: {
|
|
@@ -680,6 +743,13 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Loc
|
|
|
680
743
|
readonly payload: {
|
|
681
744
|
readonly messageId: string;
|
|
682
745
|
readonly text: string;
|
|
746
|
+
readonly attachments?: readonly {
|
|
747
|
+
readonly id: string;
|
|
748
|
+
readonly mediaType: string;
|
|
749
|
+
readonly name?: string | undefined;
|
|
750
|
+
readonly size?: number | undefined;
|
|
751
|
+
readonly url?: string | undefined;
|
|
752
|
+
}[] | undefined;
|
|
683
753
|
readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
|
|
684
754
|
readonly activeChildThreadId?: string | undefined;
|
|
685
755
|
};
|
|
@@ -721,6 +791,13 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Loc
|
|
|
721
791
|
readonly message: {
|
|
722
792
|
readonly role: "assistant" | "system" | "tool" | "user";
|
|
723
793
|
readonly content: string;
|
|
794
|
+
readonly attachments?: readonly {
|
|
795
|
+
readonly id: string;
|
|
796
|
+
readonly mediaType: string;
|
|
797
|
+
readonly name?: string | undefined;
|
|
798
|
+
readonly size?: number | undefined;
|
|
799
|
+
readonly url?: string | undefined;
|
|
800
|
+
}[] | undefined;
|
|
724
801
|
readonly toolCallId?: string | undefined;
|
|
725
802
|
readonly name?: string | undefined;
|
|
726
803
|
readonly toolCalls?: {
|
package/dist/agent/events.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ export declare const AgentMessageReceivedPayloadSchema: Schema.Struct<{
|
|
|
3
3
|
readonly message: Schema.Struct<{
|
|
4
4
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
5
5
|
readonly content: Schema.String;
|
|
6
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
7
|
+
readonly id: Schema.String;
|
|
8
|
+
readonly mediaType: Schema.String;
|
|
9
|
+
readonly name: Schema.optional<Schema.String>;
|
|
10
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
11
|
+
readonly url: Schema.optional<Schema.String>;
|
|
12
|
+
}>>>;
|
|
6
13
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
7
14
|
readonly name: Schema.optional<Schema.String>;
|
|
8
15
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
@@ -29,6 +36,13 @@ export declare const AgentMessageEventPayloadSchema: Schema.Struct<{
|
|
|
29
36
|
readonly message: Schema.Struct<{
|
|
30
37
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
31
38
|
readonly content: Schema.String;
|
|
39
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
40
|
+
readonly id: Schema.String;
|
|
41
|
+
readonly mediaType: Schema.String;
|
|
42
|
+
readonly name: Schema.optional<Schema.String>;
|
|
43
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
44
|
+
readonly url: Schema.optional<Schema.String>;
|
|
45
|
+
}>>>;
|
|
32
46
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
33
47
|
readonly name: Schema.optional<Schema.String>;
|
|
34
48
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
@@ -63,6 +77,13 @@ export declare const AgentSteeredPayloadSchema: Schema.Struct<{
|
|
|
63
77
|
readonly message: Schema.Struct<{
|
|
64
78
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
65
79
|
readonly content: Schema.String;
|
|
80
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
81
|
+
readonly id: Schema.String;
|
|
82
|
+
readonly mediaType: Schema.String;
|
|
83
|
+
readonly name: Schema.optional<Schema.String>;
|
|
84
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
85
|
+
readonly url: Schema.optional<Schema.String>;
|
|
86
|
+
}>>>;
|
|
66
87
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
67
88
|
readonly name: Schema.optional<Schema.String>;
|
|
68
89
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
@@ -78,6 +99,13 @@ export declare const AgentTurnStoppedPayloadSchema: Schema.Struct<{}>;
|
|
|
78
99
|
export declare const AgentSessionMessageSubmittedPayloadSchema: Schema.Struct<{
|
|
79
100
|
readonly messageId: Schema.String;
|
|
80
101
|
readonly text: Schema.String;
|
|
102
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
103
|
+
readonly id: Schema.String;
|
|
104
|
+
readonly mediaType: Schema.String;
|
|
105
|
+
readonly name: Schema.optional<Schema.String>;
|
|
106
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
107
|
+
readonly url: Schema.optional<Schema.String>;
|
|
108
|
+
}>>>;
|
|
81
109
|
readonly delivery: Schema.optional<Schema.Union<readonly [Schema.Literal<"steer">, Schema.Literal<"followUp">, Schema.Literal<"nextTurn">]>>;
|
|
82
110
|
readonly activeChildThreadId: Schema.optional<Schema.String>;
|
|
83
111
|
}>;
|
|
@@ -117,6 +145,13 @@ export declare const AgentContextCompactedPayloadSchema: Schema.Struct<{
|
|
|
117
145
|
readonly messages: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
118
146
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
119
147
|
readonly content: Schema.String;
|
|
148
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
149
|
+
readonly id: Schema.String;
|
|
150
|
+
readonly mediaType: Schema.String;
|
|
151
|
+
readonly name: Schema.optional<Schema.String>;
|
|
152
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
153
|
+
readonly url: Schema.optional<Schema.String>;
|
|
154
|
+
}>>>;
|
|
120
155
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
121
156
|
readonly name: Schema.optional<Schema.String>;
|
|
122
157
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
@@ -217,6 +252,13 @@ export declare const agentCatalog: import("@swirls/looms/core").EventCatalog<"ag
|
|
|
217
252
|
readonly message: Schema.Struct<{
|
|
218
253
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
219
254
|
readonly content: Schema.String;
|
|
255
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
256
|
+
readonly id: Schema.String;
|
|
257
|
+
readonly mediaType: Schema.String;
|
|
258
|
+
readonly name: Schema.optional<Schema.String>;
|
|
259
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
260
|
+
readonly url: Schema.optional<Schema.String>;
|
|
261
|
+
}>>>;
|
|
220
262
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
221
263
|
readonly name: Schema.optional<Schema.String>;
|
|
222
264
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
@@ -243,6 +285,13 @@ export declare const agentCatalog: import("@swirls/looms/core").EventCatalog<"ag
|
|
|
243
285
|
readonly message: Schema.Struct<{
|
|
244
286
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
245
287
|
readonly content: Schema.String;
|
|
288
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
289
|
+
readonly id: Schema.String;
|
|
290
|
+
readonly mediaType: Schema.String;
|
|
291
|
+
readonly name: Schema.optional<Schema.String>;
|
|
292
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
293
|
+
readonly url: Schema.optional<Schema.String>;
|
|
294
|
+
}>>>;
|
|
246
295
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
247
296
|
readonly name: Schema.optional<Schema.String>;
|
|
248
297
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
@@ -277,6 +326,13 @@ export declare const agentCatalog: import("@swirls/looms/core").EventCatalog<"ag
|
|
|
277
326
|
readonly message: Schema.Struct<{
|
|
278
327
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
279
328
|
readonly content: Schema.String;
|
|
329
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
330
|
+
readonly id: Schema.String;
|
|
331
|
+
readonly mediaType: Schema.String;
|
|
332
|
+
readonly name: Schema.optional<Schema.String>;
|
|
333
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
334
|
+
readonly url: Schema.optional<Schema.String>;
|
|
335
|
+
}>>>;
|
|
280
336
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
281
337
|
readonly name: Schema.optional<Schema.String>;
|
|
282
338
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
|
@@ -291,6 +347,13 @@ export declare const agentCatalog: import("@swirls/looms/core").EventCatalog<"ag
|
|
|
291
347
|
'session.message.submitted': Schema.Struct<{
|
|
292
348
|
readonly messageId: Schema.String;
|
|
293
349
|
readonly text: Schema.String;
|
|
350
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
351
|
+
readonly id: Schema.String;
|
|
352
|
+
readonly mediaType: Schema.String;
|
|
353
|
+
readonly name: Schema.optional<Schema.String>;
|
|
354
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
355
|
+
readonly url: Schema.optional<Schema.String>;
|
|
356
|
+
}>>>;
|
|
294
357
|
readonly delivery: Schema.optional<Schema.Union<readonly [Schema.Literal<"steer">, Schema.Literal<"followUp">, Schema.Literal<"nextTurn">]>>;
|
|
295
358
|
readonly activeChildThreadId: Schema.optional<Schema.String>;
|
|
296
359
|
}>;
|
|
@@ -410,6 +473,13 @@ export declare const agentCatalog: import("@swirls/looms/core").EventCatalog<"ag
|
|
|
410
473
|
readonly messages: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
411
474
|
readonly role: Schema.Union<readonly [Schema.Literal<"system">, Schema.Literal<"user">, Schema.Literal<"assistant">, Schema.Literal<"tool">]>;
|
|
412
475
|
readonly content: Schema.String;
|
|
476
|
+
readonly attachments: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
477
|
+
readonly id: Schema.String;
|
|
478
|
+
readonly mediaType: Schema.String;
|
|
479
|
+
readonly name: Schema.optional<Schema.String>;
|
|
480
|
+
readonly size: Schema.optional<Schema.Finite>;
|
|
481
|
+
readonly url: Schema.optional<Schema.String>;
|
|
482
|
+
}>>>;
|
|
413
483
|
readonly toolCallId: Schema.optional<Schema.String>;
|
|
414
484
|
readonly name: Schema.optional<Schema.String>;
|
|
415
485
|
readonly toolCalls: Schema.optional<Schema.mutable<Schema.$Array<Schema.Struct<{
|
package/dist/agent/events.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Schema } from 'effect';
|
|
2
2
|
import { DEFAULT_DEFINITION_VERSION, defineEventCatalog, RuntimeEffectSchema } from '@swirls/looms/core';
|
|
3
|
-
import { MessageSchema, TokenUsageSchema, ToolCallSchema } from './types.js';
|
|
3
|
+
import { AttachmentSchema, MessageSchema, TokenUsageSchema, ToolCallSchema } from './types.js';
|
|
4
4
|
export const AgentMessageReceivedPayloadSchema = Schema.Struct({
|
|
5
5
|
message: MessageSchema,
|
|
6
6
|
});
|
|
@@ -47,6 +47,7 @@ export const AgentTurnStoppedPayloadSchema = Schema.Struct({});
|
|
|
47
47
|
export const AgentSessionMessageSubmittedPayloadSchema = Schema.Struct({
|
|
48
48
|
messageId: Schema.String,
|
|
49
49
|
text: Schema.String,
|
|
50
|
+
attachments: Schema.optional(Schema.Array(AttachmentSchema)),
|
|
50
51
|
delivery: Schema.optional(AgentSessionDeliverySchema),
|
|
51
52
|
activeChildThreadId: Schema.optional(Schema.String),
|
|
52
53
|
});
|