@swirls/looms 0.10.0 → 0.11.1
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 +32 -0
- package/dist/actor/cell.d.ts +3 -1
- package/dist/actor/cell.js +1 -0
- package/dist/actor/host.d.ts +3 -1
- package/dist/actor/host.js +1 -0
- package/dist/agent/effects.d.ts +256 -256
- package/dist/agent/module.d.ts +512 -512
- package/dist/agent/signals.d.ts +6 -2
- package/dist/agent/signals.js +7 -3
- package/dist/agent/threads.js +3 -0
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.js +47 -12
- package/dist/client/client.d.ts +20 -21
- package/dist/client/client.js +2 -1
- package/dist/cloudflare/delete-terminal-run-storage.d.ts +39 -0
- package/dist/cloudflare/delete-terminal-run-storage.js +98 -0
- package/dist/cloudflare/durable-object.d.ts +11 -1
- package/dist/cloudflare/durable-object.js +23 -0
- package/dist/cloudflare/index.d.ts +1 -0
- package/dist/cloudflare/index.js +1 -0
- package/dist/core/run-context.d.ts +50 -0
- package/dist/core/run-context.js +21 -1
- package/dist/debugger/app/assets/{index-D-2Q7ecG.js → index-BPu-NBr5.js} +2 -2
- package/dist/debugger/app/assets/{routes-lvmllT60.js → routes-FLQryDcz.js} +3 -3
- package/dist/debugger/app/index.html +1 -1
- package/dist/projectors/event-log-ops.d.ts +0 -6
- package/dist/projectors/event-log-ops.js +2 -12
- package/dist/projectors/event-log.d.ts +10 -5
- package/dist/projectors/event-log.js +26 -22
- package/dist/projectors/replica/columns.d.ts +41 -0
- package/dist/projectors/replica/columns.js +77 -0
- package/dist/projectors/replica/drizzle.d.ts +328 -57
- package/dist/projectors/replica/drizzle.js +18 -14
- package/dist/projectors/replica/migrations.d.ts +25 -5
- package/dist/projectors/replica/migrations.js +62 -14
- package/dist/projectors/replica/postgres.d.ts +12 -11
- package/dist/projectors/replica/postgres.js +12 -26
- package/dist/projectors/replica/sqlite-bun.d.ts +3 -1
- package/dist/projectors/replica/sqlite-bun.js +6 -2
- package/dist/projectors/replica/sqlite-migrations.d.ts +5 -5
- package/dist/projectors/replica/sqlite-migrations.js +22 -9
- package/dist/projectors/replica/sqlite.d.ts +12 -11
- package/dist/projectors/replica/sqlite.js +23 -16
- package/dist/runtime/looms.d.ts +27 -36
- package/dist/runtime/looms.js +1 -0
- package/dist/runtime/runtime.js +7 -1
- package/dist/runtime/server/http.js +4 -2
- package/dist/runtime/types.d.ts +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @swirls/looms
|
|
2
2
|
|
|
3
|
+
## 0.11.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2ff6701: Wake idle agents on a non-interrupt steer. Queued steers still wait for open tool calls to finish, so in-flight work is not abandoned.
|
|
8
|
+
|
|
9
|
+
## 0.11.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 7f412db: Declare your own run attributes and give them replica columns, and clear Durable Object storage for terminal runs.
|
|
14
|
+
|
|
15
|
+
**Breaking:** the replica and `postgresEventLog` no longer have built-in `tenant`, `project`, and `org` columns. Declare the attributes you need with `defineRunAttributes` and pass them as `additionalFields`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const attributes = defineRunAttributes({
|
|
19
|
+
tenantId: { required: true, index: true },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
createLooms({ modules, attributes });
|
|
23
|
+
postgresReplica({ url, additionalFields: attributes });
|
|
24
|
+
loomsReplicaTables({ additionalFields: attributes });
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Each attribute is a text column named in snake_case unless `fieldName` is set. `index: true` adds an index. Each column and index is its own migration, and a new column is backfilled from the `attributes` JSON. `postgresEventLog` records these migrations in `looms_schema_migrations` and applies each one once.
|
|
28
|
+
- Once attributes are declared, `start`, `startRun`, `launchRun`, and the client only accept declared keys, and `required` keys must be passed. The host refuses other starts with `InvalidRunAttributesError`, which `POST /runs` reports as 400.
|
|
29
|
+
- `replica.purge({ finishedBefore, where })` filters on declared attributes.
|
|
30
|
+
- `looms replica generate`, `migrate`, and `status` take `--config <module>` to read the declaration.
|
|
31
|
+
- `deleteTerminalRunStorage` deletes a terminal run's Durable Object storage once the listed projectors attached to the object have caught up.
|
|
32
|
+
|
|
33
|
+
Replicas created by an earlier version keep their `tenant`, `project`, and `org` columns, and Looms stops writing them. On Postgres, declaring an attribute with one of those column names reuses the column. On SQLite, use another `fieldName` or drop the old column first.
|
|
34
|
+
|
|
3
35
|
## 0.10.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
package/dist/actor/cell.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnyRuntimeModule, type DefinitionResolver, type EventInput, type EventStore, type EventStoreTrimCoverage, type LaunchRunArgs, type RunLauncher, type RunState, type RunStatusSnapshot, type SnapshotStore } from '@swirls/looms/core';
|
|
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
2
|
import { type Authorize, type EffectWorker, type LoomsRuntime, 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;
|
|
@@ -24,6 +24,8 @@ export interface ActorCellOptions<TModules extends readonly AnyRuntimeModule[] =
|
|
|
24
24
|
* Cloudflare Queue producer). Without it, worker effects cannot leave the object.
|
|
25
25
|
*/
|
|
26
26
|
readonly worker?: EffectWorker;
|
|
27
|
+
/** Declared run attributes. See `CreateRuntimeOptions`. */
|
|
28
|
+
readonly attributes?: RunAttributeFields;
|
|
27
29
|
}
|
|
28
30
|
export interface ActorCell<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
29
31
|
readonly runId: string;
|
package/dist/actor/cell.js
CHANGED
|
@@ -20,6 +20,7 @@ export function createActorCell(options) {
|
|
|
20
20
|
maxPendingRunOperations: options.maxPendingRunOperations,
|
|
21
21
|
snapshotStore: options.snapshotStore,
|
|
22
22
|
trimAfterSnapshot: options.trimAfterSnapshot,
|
|
23
|
+
attributes: options.attributes,
|
|
23
24
|
});
|
|
24
25
|
const provide = (effect) => Effect.runPromise(Effect.provideService(effect, EventStoreTag, store));
|
|
25
26
|
const fetchHandler = createFetchHandler({ runtime, store, authorize: options.authorize });
|
package/dist/actor/host.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyRuntimeModule, DefinitionResolver, EventInput, EventStore, EventStoreTrimCoverage, RunLauncher, RunState, SnapshotStore } from '@swirls/looms/core';
|
|
1
|
+
import type { AnyRuntimeModule, DefinitionResolver, EventInput, EventStore, EventStoreTrimCoverage, RunAttributeFields, RunLauncher, RunState, SnapshotStore } from '@swirls/looms/core';
|
|
2
2
|
import { type Authorize, 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[]> {
|
|
@@ -6,6 +6,8 @@ export interface LocalActorHostOptions<TModules extends readonly AnyRuntimeModul
|
|
|
6
6
|
readonly modules: TModules;
|
|
7
7
|
/** Loads definitions that were not registered on a module. See `CreateRuntimeOptions`. */
|
|
8
8
|
readonly definitionResolver?: DefinitionResolver;
|
|
9
|
+
/** Declared run attributes. See `CreateRuntimeOptions`. */
|
|
10
|
+
readonly attributes?: RunAttributeFields;
|
|
9
11
|
readonly snapshotStore?: SnapshotStore;
|
|
10
12
|
readonly snapshotEvery?: number;
|
|
11
13
|
readonly maxWakeIterations?: number;
|
package/dist/actor/host.js
CHANGED
|
@@ -59,6 +59,7 @@ export function createLocalActorHost(options) {
|
|
|
59
59
|
scheduler,
|
|
60
60
|
modules: options.modules,
|
|
61
61
|
definitionResolver: options.definitionResolver,
|
|
62
|
+
attributes: options.attributes,
|
|
62
63
|
snapshotStore: options.snapshotStore,
|
|
63
64
|
snapshotEvery: options.snapshotEvery,
|
|
64
65
|
maxWakeIterations: options.maxWakeIterations,
|
package/dist/agent/effects.d.ts
CHANGED
|
@@ -23,248 +23,6 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
23
23
|
readonly alreadyCompacted?: boolean | undefined;
|
|
24
24
|
readonly consumedSteerMessageIds?: readonly string[] | undefined;
|
|
25
25
|
}, AgentDefinitionsTag | LlmTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
26
|
-
readonly type: "agent.context.compacted";
|
|
27
|
-
readonly payload: {
|
|
28
|
-
readonly turn: number;
|
|
29
|
-
readonly originalCount: number;
|
|
30
|
-
readonly compactedCount: number;
|
|
31
|
-
readonly summary?: string | undefined;
|
|
32
|
-
readonly reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
33
|
-
readonly messages?: readonly {
|
|
34
|
-
readonly role: "assistant" | "system" | "tool" | "user";
|
|
35
|
-
readonly content: string;
|
|
36
|
-
readonly toolCallId?: string | undefined;
|
|
37
|
-
readonly name?: string | undefined;
|
|
38
|
-
readonly toolCalls?: {
|
|
39
|
-
readonly id: string;
|
|
40
|
-
readonly name: string;
|
|
41
|
-
readonly arguments: Schema.Json;
|
|
42
|
-
}[] | undefined;
|
|
43
|
-
}[] | undefined;
|
|
44
|
-
};
|
|
45
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
46
|
-
readonly type: "agent.effects.requested";
|
|
47
|
-
readonly payload: {
|
|
48
|
-
readonly toolCallId: string;
|
|
49
|
-
readonly effects: readonly ({
|
|
50
|
-
readonly type: "runtime.spawn";
|
|
51
|
-
readonly childThreadId: string;
|
|
52
|
-
readonly kind: string;
|
|
53
|
-
readonly definitionName: string;
|
|
54
|
-
readonly definitionVersion: string;
|
|
55
|
-
readonly input: Schema.Json;
|
|
56
|
-
} | {
|
|
57
|
-
readonly type: "runtime.wait";
|
|
58
|
-
readonly waitId: string;
|
|
59
|
-
readonly on: {
|
|
60
|
-
readonly type: string | readonly string[];
|
|
61
|
-
readonly match?: Schema.Json | undefined;
|
|
62
|
-
} | {
|
|
63
|
-
readonly timerAt: number;
|
|
64
|
-
};
|
|
65
|
-
readonly tag?: Schema.Json | undefined;
|
|
66
|
-
} | {
|
|
67
|
-
readonly type: "runtime.emit";
|
|
68
|
-
readonly event: {
|
|
69
|
-
readonly type: string;
|
|
70
|
-
readonly payload: Schema.Json;
|
|
71
|
-
readonly threadId?: string | null | undefined;
|
|
72
|
-
readonly parentThreadId?: string | null | undefined;
|
|
73
|
-
readonly causationId?: string | null | undefined;
|
|
74
|
-
readonly correlationId?: string | null | undefined;
|
|
75
|
-
readonly effectId?: string | null | undefined;
|
|
76
|
-
readonly origin?: {
|
|
77
|
-
readonly type: "thread";
|
|
78
|
-
readonly threadId: string;
|
|
79
|
-
} | {
|
|
80
|
-
readonly type: "external";
|
|
81
|
-
readonly actorId?: string | undefined;
|
|
82
|
-
} | {
|
|
83
|
-
readonly type: "system";
|
|
84
|
-
} | {
|
|
85
|
-
readonly type: "run";
|
|
86
|
-
readonly runId: string;
|
|
87
|
-
} | undefined;
|
|
88
|
-
readonly ephemeral?: boolean | undefined;
|
|
89
|
-
readonly id?: string | undefined;
|
|
90
|
-
readonly ts?: number | undefined;
|
|
91
|
-
readonly idempotencyKey?: string | null | undefined;
|
|
92
|
-
};
|
|
93
|
-
readonly tag?: string | undefined;
|
|
94
|
-
} | {
|
|
95
|
-
readonly type: "runtime.complete";
|
|
96
|
-
readonly output: Schema.Json;
|
|
97
|
-
} | {
|
|
98
|
-
readonly type: "runtime.fail";
|
|
99
|
-
readonly error: string;
|
|
100
|
-
} | {
|
|
101
|
-
readonly type: "runtime.cancel";
|
|
102
|
-
readonly threadId: string;
|
|
103
|
-
readonly tag?: string | undefined;
|
|
104
|
-
} | {
|
|
105
|
-
readonly type: "runtime.launch";
|
|
106
|
-
readonly runId: string;
|
|
107
|
-
readonly kind: string;
|
|
108
|
-
readonly definitionName: string;
|
|
109
|
-
readonly definitionVersion: string;
|
|
110
|
-
readonly input: Schema.Json;
|
|
111
|
-
readonly close: "terminate" | "wait";
|
|
112
|
-
readonly tag?: string | undefined;
|
|
113
|
-
} | {
|
|
114
|
-
readonly type: "runtime.cancelRun";
|
|
115
|
-
readonly runId: string;
|
|
116
|
-
readonly tag?: string | undefined;
|
|
117
|
-
} | {
|
|
118
|
-
readonly type: string;
|
|
119
|
-
readonly input: Schema.Json;
|
|
120
|
-
readonly tag?: string | undefined;
|
|
121
|
-
readonly at?: number | undefined;
|
|
122
|
-
})[];
|
|
123
|
-
readonly waitOn?: {
|
|
124
|
-
readonly type: string | readonly string[];
|
|
125
|
-
readonly match?: Schema.Json | undefined;
|
|
126
|
-
} | undefined;
|
|
127
|
-
};
|
|
128
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
129
|
-
readonly type: "agent.lineage";
|
|
130
|
-
readonly payload: {
|
|
131
|
-
readonly depth: number;
|
|
132
|
-
};
|
|
133
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
134
|
-
readonly type: "agent.message";
|
|
135
|
-
readonly payload: {
|
|
136
|
-
readonly turn: number;
|
|
137
|
-
readonly message: {
|
|
138
|
-
readonly role: "assistant" | "system" | "tool" | "user";
|
|
139
|
-
readonly content: string;
|
|
140
|
-
readonly toolCallId?: string | undefined;
|
|
141
|
-
readonly name?: string | undefined;
|
|
142
|
-
readonly toolCalls?: {
|
|
143
|
-
readonly id: string;
|
|
144
|
-
readonly name: string;
|
|
145
|
-
readonly arguments: Schema.Json;
|
|
146
|
-
}[] | undefined;
|
|
147
|
-
};
|
|
148
|
-
readonly usage?: {
|
|
149
|
-
readonly input: number;
|
|
150
|
-
readonly output: number;
|
|
151
|
-
} | undefined;
|
|
152
|
-
};
|
|
153
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
154
|
-
readonly type: "agent.message.received";
|
|
155
|
-
readonly payload: {
|
|
156
|
-
readonly message: {
|
|
157
|
-
readonly role: "assistant" | "system" | "tool" | "user";
|
|
158
|
-
readonly content: string;
|
|
159
|
-
readonly toolCallId?: string | undefined;
|
|
160
|
-
readonly name?: string | undefined;
|
|
161
|
-
readonly toolCalls?: {
|
|
162
|
-
readonly id: string;
|
|
163
|
-
readonly name: string;
|
|
164
|
-
readonly arguments: Schema.Json;
|
|
165
|
-
}[] | undefined;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
169
|
-
readonly type: "agent.session.cancel.requested";
|
|
170
|
-
readonly payload: {};
|
|
171
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
172
|
-
readonly type: "agent.session.message.submitted";
|
|
173
|
-
readonly payload: {
|
|
174
|
-
readonly messageId: string;
|
|
175
|
-
readonly text: string;
|
|
176
|
-
readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
|
|
177
|
-
readonly activeChildThreadId?: string | undefined;
|
|
178
|
-
};
|
|
179
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
180
|
-
readonly type: "agent.session.steer.delivered";
|
|
181
|
-
readonly payload: {
|
|
182
|
-
readonly messageId: string;
|
|
183
|
-
readonly activeMessageId: string;
|
|
184
|
-
};
|
|
185
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
186
|
-
readonly type: "agent.session.turn.closed";
|
|
187
|
-
readonly payload: {
|
|
188
|
-
readonly messageId: string;
|
|
189
|
-
readonly status: "cancelled" | "completed" | "failed";
|
|
190
|
-
readonly error?: string | undefined;
|
|
191
|
-
};
|
|
192
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
193
|
-
readonly type: "agent.session.turn.started";
|
|
194
|
-
readonly payload: {
|
|
195
|
-
readonly messageId: string;
|
|
196
|
-
readonly childThreadId: string;
|
|
197
|
-
};
|
|
198
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
199
|
-
readonly type: "agent.spawn.requested";
|
|
200
|
-
readonly payload: {
|
|
201
|
-
readonly childThreadId: string;
|
|
202
|
-
readonly kind: string;
|
|
203
|
-
readonly definitionName: string;
|
|
204
|
-
readonly definitionVersion: string;
|
|
205
|
-
readonly toolCallId: string;
|
|
206
|
-
readonly input: Schema.Json;
|
|
207
|
-
readonly depth?: number | undefined;
|
|
208
|
-
};
|
|
209
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
210
|
-
readonly type: "agent.steered";
|
|
211
|
-
readonly payload: {
|
|
212
|
-
readonly turn: number;
|
|
213
|
-
readonly messageId?: string | undefined;
|
|
214
|
-
readonly message: {
|
|
215
|
-
readonly role: "assistant" | "system" | "tool" | "user";
|
|
216
|
-
readonly content: string;
|
|
217
|
-
readonly toolCallId?: string | undefined;
|
|
218
|
-
readonly name?: string | undefined;
|
|
219
|
-
readonly toolCalls?: {
|
|
220
|
-
readonly id: string;
|
|
221
|
-
readonly name: string;
|
|
222
|
-
readonly arguments: Schema.Json;
|
|
223
|
-
}[] | undefined;
|
|
224
|
-
};
|
|
225
|
-
readonly interrupt?: boolean | undefined;
|
|
226
|
-
};
|
|
227
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
228
|
-
readonly type: "agent.tool.result";
|
|
229
|
-
readonly payload: {
|
|
230
|
-
readonly turn: number;
|
|
231
|
-
readonly toolCallId: string;
|
|
232
|
-
readonly name: string;
|
|
233
|
-
readonly result: Schema.Json;
|
|
234
|
-
readonly error: string | null;
|
|
235
|
-
};
|
|
236
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
237
|
-
readonly type: "agent.tool_call.requested";
|
|
238
|
-
readonly payload: {
|
|
239
|
-
readonly turn: number;
|
|
240
|
-
readonly toolCall: {
|
|
241
|
-
readonly id: string;
|
|
242
|
-
readonly name: string;
|
|
243
|
-
readonly arguments: Schema.Json;
|
|
244
|
-
};
|
|
245
|
-
};
|
|
246
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
247
|
-
readonly type: "agent.turn.started";
|
|
248
|
-
readonly payload: {
|
|
249
|
-
readonly turn: number;
|
|
250
|
-
};
|
|
251
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
252
|
-
readonly type: "agent.turn.stopped";
|
|
253
|
-
readonly payload: {};
|
|
254
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
255
|
-
readonly type: "agent.turn.text_delta";
|
|
256
|
-
readonly payload: {
|
|
257
|
-
readonly turn: number;
|
|
258
|
-
readonly delta: string;
|
|
259
|
-
};
|
|
260
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
261
|
-
readonly type: "agent.turn.usage";
|
|
262
|
-
readonly payload: {
|
|
263
|
-
readonly turn: number;
|
|
264
|
-
readonly input: number;
|
|
265
|
-
readonly output: number;
|
|
266
|
-
};
|
|
267
|
-
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
268
26
|
readonly type: "runtime.child.close.requested";
|
|
269
27
|
readonly payload: {
|
|
270
28
|
readonly policy: "terminate" | "wait";
|
|
@@ -510,19 +268,7 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEf
|
|
|
510
268
|
readonly payload: Schema.Json;
|
|
511
269
|
};
|
|
512
270
|
};
|
|
513
|
-
})
|
|
514
|
-
export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").LocalEffectDefinition<{
|
|
515
|
-
readonly turn: number;
|
|
516
|
-
readonly definitionName?: string | undefined;
|
|
517
|
-
readonly definitionVersion: string;
|
|
518
|
-
readonly toolCall: {
|
|
519
|
-
readonly id: string;
|
|
520
|
-
readonly name: string;
|
|
521
|
-
readonly arguments: Schema.Json;
|
|
522
|
-
};
|
|
523
|
-
readonly input?: Schema.Json | undefined;
|
|
524
|
-
readonly depth?: number | undefined;
|
|
525
|
-
}, AgentDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
271
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
526
272
|
readonly type: "agent.context.compacted";
|
|
527
273
|
readonly payload: {
|
|
528
274
|
readonly turn: number;
|
|
@@ -764,7 +510,19 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Loc
|
|
|
764
510
|
readonly input: number;
|
|
765
511
|
readonly output: number;
|
|
766
512
|
};
|
|
767
|
-
})
|
|
513
|
+
})>>;
|
|
514
|
+
export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").LocalEffectDefinition<{
|
|
515
|
+
readonly turn: number;
|
|
516
|
+
readonly definitionName?: string | undefined;
|
|
517
|
+
readonly definitionVersion: string;
|
|
518
|
+
readonly toolCall: {
|
|
519
|
+
readonly id: string;
|
|
520
|
+
readonly name: string;
|
|
521
|
+
readonly arguments: Schema.Json;
|
|
522
|
+
};
|
|
523
|
+
readonly input?: Schema.Json | undefined;
|
|
524
|
+
readonly depth?: number | undefined;
|
|
525
|
+
}, AgentDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
768
526
|
readonly type: "runtime.child.close.requested";
|
|
769
527
|
readonly payload: {
|
|
770
528
|
readonly policy: "terminate" | "wait";
|
|
@@ -1010,5 +768,247 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Loc
|
|
|
1010
768
|
readonly payload: Schema.Json;
|
|
1011
769
|
};
|
|
1012
770
|
};
|
|
771
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
772
|
+
readonly type: "agent.context.compacted";
|
|
773
|
+
readonly payload: {
|
|
774
|
+
readonly turn: number;
|
|
775
|
+
readonly originalCount: number;
|
|
776
|
+
readonly compactedCount: number;
|
|
777
|
+
readonly summary?: string | undefined;
|
|
778
|
+
readonly reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
779
|
+
readonly messages?: readonly {
|
|
780
|
+
readonly role: "assistant" | "system" | "tool" | "user";
|
|
781
|
+
readonly content: string;
|
|
782
|
+
readonly toolCallId?: string | undefined;
|
|
783
|
+
readonly name?: string | undefined;
|
|
784
|
+
readonly toolCalls?: {
|
|
785
|
+
readonly id: string;
|
|
786
|
+
readonly name: string;
|
|
787
|
+
readonly arguments: Schema.Json;
|
|
788
|
+
}[] | undefined;
|
|
789
|
+
}[] | undefined;
|
|
790
|
+
};
|
|
791
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
792
|
+
readonly type: "agent.effects.requested";
|
|
793
|
+
readonly payload: {
|
|
794
|
+
readonly toolCallId: string;
|
|
795
|
+
readonly effects: readonly ({
|
|
796
|
+
readonly type: "runtime.spawn";
|
|
797
|
+
readonly childThreadId: string;
|
|
798
|
+
readonly kind: string;
|
|
799
|
+
readonly definitionName: string;
|
|
800
|
+
readonly definitionVersion: string;
|
|
801
|
+
readonly input: Schema.Json;
|
|
802
|
+
} | {
|
|
803
|
+
readonly type: "runtime.wait";
|
|
804
|
+
readonly waitId: string;
|
|
805
|
+
readonly on: {
|
|
806
|
+
readonly type: string | readonly string[];
|
|
807
|
+
readonly match?: Schema.Json | undefined;
|
|
808
|
+
} | {
|
|
809
|
+
readonly timerAt: number;
|
|
810
|
+
};
|
|
811
|
+
readonly tag?: Schema.Json | undefined;
|
|
812
|
+
} | {
|
|
813
|
+
readonly type: "runtime.emit";
|
|
814
|
+
readonly event: {
|
|
815
|
+
readonly type: string;
|
|
816
|
+
readonly payload: Schema.Json;
|
|
817
|
+
readonly threadId?: string | null | undefined;
|
|
818
|
+
readonly parentThreadId?: string | null | undefined;
|
|
819
|
+
readonly causationId?: string | null | undefined;
|
|
820
|
+
readonly correlationId?: string | null | undefined;
|
|
821
|
+
readonly effectId?: string | null | undefined;
|
|
822
|
+
readonly origin?: {
|
|
823
|
+
readonly type: "thread";
|
|
824
|
+
readonly threadId: string;
|
|
825
|
+
} | {
|
|
826
|
+
readonly type: "external";
|
|
827
|
+
readonly actorId?: string | undefined;
|
|
828
|
+
} | {
|
|
829
|
+
readonly type: "system";
|
|
830
|
+
} | {
|
|
831
|
+
readonly type: "run";
|
|
832
|
+
readonly runId: string;
|
|
833
|
+
} | undefined;
|
|
834
|
+
readonly ephemeral?: boolean | undefined;
|
|
835
|
+
readonly id?: string | undefined;
|
|
836
|
+
readonly ts?: number | undefined;
|
|
837
|
+
readonly idempotencyKey?: string | null | undefined;
|
|
838
|
+
};
|
|
839
|
+
readonly tag?: string | undefined;
|
|
840
|
+
} | {
|
|
841
|
+
readonly type: "runtime.complete";
|
|
842
|
+
readonly output: Schema.Json;
|
|
843
|
+
} | {
|
|
844
|
+
readonly type: "runtime.fail";
|
|
845
|
+
readonly error: string;
|
|
846
|
+
} | {
|
|
847
|
+
readonly type: "runtime.cancel";
|
|
848
|
+
readonly threadId: string;
|
|
849
|
+
readonly tag?: string | undefined;
|
|
850
|
+
} | {
|
|
851
|
+
readonly type: "runtime.launch";
|
|
852
|
+
readonly runId: string;
|
|
853
|
+
readonly kind: string;
|
|
854
|
+
readonly definitionName: string;
|
|
855
|
+
readonly definitionVersion: string;
|
|
856
|
+
readonly input: Schema.Json;
|
|
857
|
+
readonly close: "terminate" | "wait";
|
|
858
|
+
readonly tag?: string | undefined;
|
|
859
|
+
} | {
|
|
860
|
+
readonly type: "runtime.cancelRun";
|
|
861
|
+
readonly runId: string;
|
|
862
|
+
readonly tag?: string | undefined;
|
|
863
|
+
} | {
|
|
864
|
+
readonly type: string;
|
|
865
|
+
readonly input: Schema.Json;
|
|
866
|
+
readonly tag?: string | undefined;
|
|
867
|
+
readonly at?: number | undefined;
|
|
868
|
+
})[];
|
|
869
|
+
readonly waitOn?: {
|
|
870
|
+
readonly type: string | readonly string[];
|
|
871
|
+
readonly match?: Schema.Json | undefined;
|
|
872
|
+
} | undefined;
|
|
873
|
+
};
|
|
874
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
875
|
+
readonly type: "agent.lineage";
|
|
876
|
+
readonly payload: {
|
|
877
|
+
readonly depth: number;
|
|
878
|
+
};
|
|
879
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
880
|
+
readonly type: "agent.message";
|
|
881
|
+
readonly payload: {
|
|
882
|
+
readonly turn: number;
|
|
883
|
+
readonly message: {
|
|
884
|
+
readonly role: "assistant" | "system" | "tool" | "user";
|
|
885
|
+
readonly content: string;
|
|
886
|
+
readonly toolCallId?: string | undefined;
|
|
887
|
+
readonly name?: string | undefined;
|
|
888
|
+
readonly toolCalls?: {
|
|
889
|
+
readonly id: string;
|
|
890
|
+
readonly name: string;
|
|
891
|
+
readonly arguments: Schema.Json;
|
|
892
|
+
}[] | undefined;
|
|
893
|
+
};
|
|
894
|
+
readonly usage?: {
|
|
895
|
+
readonly input: number;
|
|
896
|
+
readonly output: number;
|
|
897
|
+
} | undefined;
|
|
898
|
+
};
|
|
899
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
900
|
+
readonly type: "agent.message.received";
|
|
901
|
+
readonly payload: {
|
|
902
|
+
readonly message: {
|
|
903
|
+
readonly role: "assistant" | "system" | "tool" | "user";
|
|
904
|
+
readonly content: string;
|
|
905
|
+
readonly toolCallId?: string | undefined;
|
|
906
|
+
readonly name?: string | undefined;
|
|
907
|
+
readonly toolCalls?: {
|
|
908
|
+
readonly id: string;
|
|
909
|
+
readonly name: string;
|
|
910
|
+
readonly arguments: Schema.Json;
|
|
911
|
+
}[] | undefined;
|
|
912
|
+
};
|
|
913
|
+
};
|
|
914
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
915
|
+
readonly type: "agent.session.cancel.requested";
|
|
916
|
+
readonly payload: {};
|
|
917
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
918
|
+
readonly type: "agent.session.message.submitted";
|
|
919
|
+
readonly payload: {
|
|
920
|
+
readonly messageId: string;
|
|
921
|
+
readonly text: string;
|
|
922
|
+
readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
|
|
923
|
+
readonly activeChildThreadId?: string | undefined;
|
|
924
|
+
};
|
|
925
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
926
|
+
readonly type: "agent.session.steer.delivered";
|
|
927
|
+
readonly payload: {
|
|
928
|
+
readonly messageId: string;
|
|
929
|
+
readonly activeMessageId: string;
|
|
930
|
+
};
|
|
931
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
932
|
+
readonly type: "agent.session.turn.closed";
|
|
933
|
+
readonly payload: {
|
|
934
|
+
readonly messageId: string;
|
|
935
|
+
readonly status: "cancelled" | "completed" | "failed";
|
|
936
|
+
readonly error?: string | undefined;
|
|
937
|
+
};
|
|
938
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
939
|
+
readonly type: "agent.session.turn.started";
|
|
940
|
+
readonly payload: {
|
|
941
|
+
readonly messageId: string;
|
|
942
|
+
readonly childThreadId: string;
|
|
943
|
+
};
|
|
944
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
945
|
+
readonly type: "agent.spawn.requested";
|
|
946
|
+
readonly payload: {
|
|
947
|
+
readonly childThreadId: string;
|
|
948
|
+
readonly kind: string;
|
|
949
|
+
readonly definitionName: string;
|
|
950
|
+
readonly definitionVersion: string;
|
|
951
|
+
readonly toolCallId: string;
|
|
952
|
+
readonly input: Schema.Json;
|
|
953
|
+
readonly depth?: number | undefined;
|
|
954
|
+
};
|
|
955
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
956
|
+
readonly type: "agent.steered";
|
|
957
|
+
readonly payload: {
|
|
958
|
+
readonly turn: number;
|
|
959
|
+
readonly messageId?: string | undefined;
|
|
960
|
+
readonly message: {
|
|
961
|
+
readonly role: "assistant" | "system" | "tool" | "user";
|
|
962
|
+
readonly content: string;
|
|
963
|
+
readonly toolCallId?: string | undefined;
|
|
964
|
+
readonly name?: string | undefined;
|
|
965
|
+
readonly toolCalls?: {
|
|
966
|
+
readonly id: string;
|
|
967
|
+
readonly name: string;
|
|
968
|
+
readonly arguments: Schema.Json;
|
|
969
|
+
}[] | undefined;
|
|
970
|
+
};
|
|
971
|
+
readonly interrupt?: boolean | undefined;
|
|
972
|
+
};
|
|
973
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
974
|
+
readonly type: "agent.tool.result";
|
|
975
|
+
readonly payload: {
|
|
976
|
+
readonly turn: number;
|
|
977
|
+
readonly toolCallId: string;
|
|
978
|
+
readonly name: string;
|
|
979
|
+
readonly result: Schema.Json;
|
|
980
|
+
readonly error: string | null;
|
|
981
|
+
};
|
|
982
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
983
|
+
readonly type: "agent.tool_call.requested";
|
|
984
|
+
readonly payload: {
|
|
985
|
+
readonly turn: number;
|
|
986
|
+
readonly toolCall: {
|
|
987
|
+
readonly id: string;
|
|
988
|
+
readonly name: string;
|
|
989
|
+
readonly arguments: Schema.Json;
|
|
990
|
+
};
|
|
991
|
+
};
|
|
992
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
993
|
+
readonly type: "agent.turn.started";
|
|
994
|
+
readonly payload: {
|
|
995
|
+
readonly turn: number;
|
|
996
|
+
};
|
|
997
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
998
|
+
readonly type: "agent.turn.stopped";
|
|
999
|
+
readonly payload: {};
|
|
1000
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
1001
|
+
readonly type: "agent.turn.text_delta";
|
|
1002
|
+
readonly payload: {
|
|
1003
|
+
readonly turn: number;
|
|
1004
|
+
readonly delta: string;
|
|
1005
|
+
};
|
|
1006
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
1007
|
+
readonly type: "agent.turn.usage";
|
|
1008
|
+
readonly payload: {
|
|
1009
|
+
readonly turn: number;
|
|
1010
|
+
readonly input: number;
|
|
1011
|
+
readonly output: number;
|
|
1012
|
+
};
|
|
1013
1013
|
})>>;
|
|
1014
1014
|
export declare function readToolCall(value: JsonValue): ToolCall | null;
|