@swirls/looms 0.0.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.
Files changed (270) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +9 -0
  3. package/dist/actor/cell.d.ts +27 -0
  4. package/dist/actor/cell.js +41 -0
  5. package/dist/actor/host.d.ts +27 -0
  6. package/dist/actor/host.js +82 -0
  7. package/dist/actor/index.d.ts +3 -0
  8. package/dist/actor/index.js +3 -0
  9. package/dist/actor/routing.d.ts +15 -0
  10. package/dist/actor/routing.js +80 -0
  11. package/dist/agent/definitions-store.d.ts +11 -0
  12. package/dist/agent/definitions-store.js +10 -0
  13. package/dist/agent/definitions.d.ts +152 -0
  14. package/dist/agent/definitions.js +74 -0
  15. package/dist/agent/effects.d.ts +425 -0
  16. package/dist/agent/effects.js +318 -0
  17. package/dist/agent/events.d.ts +170 -0
  18. package/dist/agent/events.js +61 -0
  19. package/dist/agent/index.d.ts +13 -0
  20. package/dist/agent/index.js +13 -0
  21. package/dist/agent/llm.d.ts +35 -0
  22. package/dist/agent/llm.js +48 -0
  23. package/dist/agent/module.d.ts +1037 -0
  24. package/dist/agent/module.js +27 -0
  25. package/dist/agent/projections.d.ts +17 -0
  26. package/dist/agent/projections.js +81 -0
  27. package/dist/agent/scope.d.ts +171 -0
  28. package/dist/agent/scope.js +7 -0
  29. package/dist/agent/signals.d.ts +17 -0
  30. package/dist/agent/signals.js +19 -0
  31. package/dist/agent/stop-when.d.ts +12 -0
  32. package/dist/agent/stop-when.js +6 -0
  33. package/dist/agent/threads.d.ts +34 -0
  34. package/dist/agent/threads.js +407 -0
  35. package/dist/agent/tool-schema.d.ts +21 -0
  36. package/dist/agent/tool-schema.js +67 -0
  37. package/dist/agent/types.d.ts +87 -0
  38. package/dist/agent/types.js +32 -0
  39. package/dist/ai-vercel/index.d.ts +2 -0
  40. package/dist/ai-vercel/index.js +2 -0
  41. package/dist/ai-vercel/messages.d.ts +9 -0
  42. package/dist/ai-vercel/messages.js +68 -0
  43. package/dist/ai-vercel/vercel-llm.d.ts +8 -0
  44. package/dist/ai-vercel/vercel-llm.js +98 -0
  45. package/dist/approval/effects.d.ts +133 -0
  46. package/dist/approval/effects.js +13 -0
  47. package/dist/approval/events.d.ts +52 -0
  48. package/dist/approval/events.js +28 -0
  49. package/dist/approval/index.d.ts +6 -0
  50. package/dist/approval/index.js +6 -0
  51. package/dist/approval/module.d.ts +342 -0
  52. package/dist/approval/module.js +10 -0
  53. package/dist/approval/projections.d.ts +42 -0
  54. package/dist/approval/projections.js +57 -0
  55. package/dist/approval/scope.d.ts +45 -0
  56. package/dist/approval/scope.js +7 -0
  57. package/dist/approval/signals.d.ts +19 -0
  58. package/dist/approval/signals.js +34 -0
  59. package/dist/cli/cli.d.ts +2 -0
  60. package/dist/cli/cli.js +6 -0
  61. package/dist/cli/commands.d.ts +13 -0
  62. package/dist/cli/commands.js +133 -0
  63. package/dist/cli/index.d.ts +1 -0
  64. package/dist/cli/index.js +1 -0
  65. package/dist/client/client.d.ts +69 -0
  66. package/dist/client/client.js +179 -0
  67. package/dist/client/index.d.ts +2 -0
  68. package/dist/client/index.js +2 -0
  69. package/dist/client/sse.d.ts +10 -0
  70. package/dist/client/sse.js +103 -0
  71. package/dist/cloudflare/alarm-scheduler.d.ts +9 -0
  72. package/dist/cloudflare/alarm-scheduler.js +13 -0
  73. package/dist/cloudflare/durable-object.d.ts +24 -0
  74. package/dist/cloudflare/durable-object.js +43 -0
  75. package/dist/cloudflare/event-store.d.ts +10 -0
  76. package/dist/cloudflare/event-store.js +18 -0
  77. package/dist/cloudflare/index.d.ts +4 -0
  78. package/dist/cloudflare/index.js +4 -0
  79. package/dist/cloudflare/router.d.ts +12 -0
  80. package/dist/cloudflare/router.js +26 -0
  81. package/dist/core/bun-sqlite.d.ts +13 -0
  82. package/dist/core/bun-sqlite.js +19 -0
  83. package/dist/core/catalog.d.ts +49 -0
  84. package/dist/core/catalog.js +39 -0
  85. package/dist/core/coalesce.d.ts +21 -0
  86. package/dist/core/coalesce.js +178 -0
  87. package/dist/core/compose.d.ts +59 -0
  88. package/dist/core/compose.js +97 -0
  89. package/dist/core/cursor.d.ts +16 -0
  90. package/dist/core/cursor.js +46 -0
  91. package/dist/core/effects.d.ts +110 -0
  92. package/dist/core/effects.js +99 -0
  93. package/dist/core/envelope.d.ts +79 -0
  94. package/dist/core/envelope.js +68 -0
  95. package/dist/core/event-codec.d.ts +8 -0
  96. package/dist/core/event-codec.js +82 -0
  97. package/dist/core/event-index.d.ts +28 -0
  98. package/dist/core/event-index.js +86 -0
  99. package/dist/core/fold.d.ts +19 -0
  100. package/dist/core/fold.js +362 -0
  101. package/dist/core/ids.d.ts +11 -0
  102. package/dist/core/ids.js +47 -0
  103. package/dist/core/index.d.ts +26 -0
  104. package/dist/core/index.js +25 -0
  105. package/dist/core/match.d.ts +8 -0
  106. package/dist/core/match.js +58 -0
  107. package/dist/core/module-scope.d.ts +99 -0
  108. package/dist/core/module-scope.js +72 -0
  109. package/dist/core/module.d.ts +74 -0
  110. package/dist/core/module.js +3 -0
  111. package/dist/core/projection.d.ts +83 -0
  112. package/dist/core/projection.js +241 -0
  113. package/dist/core/protocol.d.ts +99 -0
  114. package/dist/core/protocol.js +101 -0
  115. package/dist/core/replay.d.ts +13 -0
  116. package/dist/core/replay.js +34 -0
  117. package/dist/core/schema.d.ts +35 -0
  118. package/dist/core/schema.js +130 -0
  119. package/dist/core/serialize.d.ts +14 -0
  120. package/dist/core/serialize.js +42 -0
  121. package/dist/core/snapshot-store.d.ts +39 -0
  122. package/dist/core/snapshot-store.js +53 -0
  123. package/dist/core/snapshots.d.ts +26 -0
  124. package/dist/core/snapshots.js +100 -0
  125. package/dist/core/sqlite-store.d.ts +31 -0
  126. package/dist/core/sqlite-store.js +328 -0
  127. package/dist/core/state.d.ts +43 -0
  128. package/dist/core/state.js +31 -0
  129. package/dist/core/store.d.ts +146 -0
  130. package/dist/core/store.js +229 -0
  131. package/dist/core/thread.d.ts +41 -0
  132. package/dist/core/thread.js +13 -0
  133. package/dist/core/types.d.ts +27 -0
  134. package/dist/core/types.js +42 -0
  135. package/dist/core/validate-event.d.ts +19 -0
  136. package/dist/core/validate-event.js +42 -0
  137. package/dist/debugger/components/debugger-split.d.ts +23 -0
  138. package/dist/debugger/components/debugger-split.js +25 -0
  139. package/dist/debugger/components/event-inspector.d.ts +5 -0
  140. package/dist/debugger/components/event-inspector.js +38 -0
  141. package/dist/debugger/components/event-stream.d.ts +13 -0
  142. package/dist/debugger/components/event-stream.js +119 -0
  143. package/dist/debugger/components/json-view.d.ts +5 -0
  144. package/dist/debugger/components/json-view.js +5 -0
  145. package/dist/debugger/components/run-tree.d.ts +14 -0
  146. package/dist/debugger/components/run-tree.js +38 -0
  147. package/dist/debugger/components/status-dot.d.ts +3 -0
  148. package/dist/debugger/components/status-dot.js +5 -0
  149. package/dist/debugger/contracts.d.ts +22 -0
  150. package/dist/debugger/contracts.js +1 -0
  151. package/dist/debugger/events/catalog.d.ts +6 -0
  152. package/dist/debugger/events/catalog.js +27 -0
  153. package/dist/debugger/events/domain-summarize.d.ts +3 -0
  154. package/dist/debugger/events/domain-summarize.js +107 -0
  155. package/dist/debugger/events/family.d.ts +8 -0
  156. package/dist/debugger/events/family.js +44 -0
  157. package/dist/debugger/events/protocol-summarize.d.ts +3 -0
  158. package/dist/debugger/events/protocol-summarize.js +70 -0
  159. package/dist/debugger/index.d.ts +17 -0
  160. package/dist/debugger/index.js +16 -0
  161. package/dist/debugger/lib/cn.d.ts +5 -0
  162. package/dist/debugger/lib/cn.js +17 -0
  163. package/dist/debugger/lib/event-counts.d.ts +5 -0
  164. package/dist/debugger/lib/event-counts.js +23 -0
  165. package/dist/debugger/lib/event-meta.d.ts +8 -0
  166. package/dist/debugger/lib/event-meta.js +20 -0
  167. package/dist/debugger/lib/project-run.d.ts +9 -0
  168. package/dist/debugger/lib/project-run.js +14 -0
  169. package/dist/debugger/lib/status.d.ts +3 -0
  170. package/dist/debugger/lib/status.js +31 -0
  171. package/dist/debugger/lib/visible-events.d.ts +8 -0
  172. package/dist/debugger/lib/visible-events.js +21 -0
  173. package/dist/debugger/styles.css +71 -0
  174. package/dist/debugger/ui/checkbox.d.ts +4 -0
  175. package/dist/debugger/ui/checkbox.js +9 -0
  176. package/dist/debugger/ui/input.d.ts +3 -0
  177. package/dist/debugger/ui/input.js +7 -0
  178. package/dist/debugger/ui/scroll-area.d.ts +9 -0
  179. package/dist/debugger/ui/scroll-area.js +10 -0
  180. package/dist/debugger/ui/tabs.d.ts +7 -0
  181. package/dist/debugger/ui/tabs.js +17 -0
  182. package/dist/index.d.ts +2 -0
  183. package/dist/index.js +2 -0
  184. package/dist/projectors/index-model.d.ts +56 -0
  185. package/dist/projectors/index-model.js +117 -0
  186. package/dist/projectors/index.d.ts +4 -0
  187. package/dist/projectors/index.js +3 -0
  188. package/dist/projectors/memory.d.ts +5 -0
  189. package/dist/projectors/memory.js +77 -0
  190. package/dist/projectors/postgres.d.ts +9 -0
  191. package/dist/projectors/postgres.js +108 -0
  192. package/dist/projectors/projector.d.ts +11 -0
  193. package/dist/projectors/projector.js +1 -0
  194. package/dist/projectors/schema.d.ts +5 -0
  195. package/dist/projectors/schema.js +43 -0
  196. package/dist/projectors/sqlite.d.ts +9 -0
  197. package/dist/projectors/sqlite.js +103 -0
  198. package/dist/projectors/with-projectors.d.ts +17 -0
  199. package/dist/projectors/with-projectors.js +55 -0
  200. package/dist/react/derived.d.ts +19 -0
  201. package/dist/react/derived.js +50 -0
  202. package/dist/react/index.d.ts +6 -0
  203. package/dist/react/index.js +5 -0
  204. package/dist/react/materialize.d.ts +3 -0
  205. package/dist/react/materialize.js +86 -0
  206. package/dist/react/notify.d.ts +18 -0
  207. package/dist/react/notify.js +80 -0
  208. package/dist/react/react.d.ts +61 -0
  209. package/dist/react/react.js +187 -0
  210. package/dist/react/register.d.ts +31 -0
  211. package/dist/react/register.js +1 -0
  212. package/dist/react/sse.d.ts +1 -0
  213. package/dist/react/sse.js +1 -0
  214. package/dist/react/store.d.ts +56 -0
  215. package/dist/react/store.js +340 -0
  216. package/dist/react/tables.d.ts +21 -0
  217. package/dist/react/tables.js +6 -0
  218. package/dist/runtime/dispatch-effect.d.ts +3 -0
  219. package/dist/runtime/dispatch-effect.js +113 -0
  220. package/dist/runtime/events-api.d.ts +4 -0
  221. package/dist/runtime/events-api.js +84 -0
  222. package/dist/runtime/index.d.ts +5 -0
  223. package/dist/runtime/index.js +5 -0
  224. package/dist/runtime/looms.d.ts +74 -0
  225. package/dist/runtime/looms.js +109 -0
  226. package/dist/runtime/runtime-helpers.d.ts +51 -0
  227. package/dist/runtime/runtime-helpers.js +230 -0
  228. package/dist/runtime/runtime.d.ts +91 -0
  229. package/dist/runtime/runtime.js +531 -0
  230. package/dist/runtime/server.d.ts +17 -0
  231. package/dist/runtime/server.js +226 -0
  232. package/dist/runtime/sse.d.ts +15 -0
  233. package/dist/runtime/sse.js +96 -0
  234. package/dist/runtime/wake-scheduler.d.ts +8 -0
  235. package/dist/runtime/wake-scheduler.js +38 -0
  236. package/dist/s2/config.d.ts +27 -0
  237. package/dist/s2/config.js +54 -0
  238. package/dist/s2/index.d.ts +6 -0
  239. package/dist/s2/index.js +6 -0
  240. package/dist/s2/lite.d.ts +26 -0
  241. package/dist/s2/lite.js +150 -0
  242. package/dist/s2/projector.d.ts +8 -0
  243. package/dist/s2/projector.js +28 -0
  244. package/dist/s2/serialize.d.ts +1 -0
  245. package/dist/s2/serialize.js +1 -0
  246. package/dist/s2/snapshot-store.d.ts +17 -0
  247. package/dist/s2/snapshot-store.js +320 -0
  248. package/dist/s2/store.d.ts +35 -0
  249. package/dist/s2/store.js +337 -0
  250. package/dist/testing/index.d.ts +11 -0
  251. package/dist/testing/index.js +63 -0
  252. package/dist/workflow/definitions-store.d.ts +11 -0
  253. package/dist/workflow/definitions-store.js +8 -0
  254. package/dist/workflow/definitions.d.ts +82 -0
  255. package/dist/workflow/definitions.js +32 -0
  256. package/dist/workflow/effects.d.ts +305 -0
  257. package/dist/workflow/effects.js +208 -0
  258. package/dist/workflow/events.d.ts +60 -0
  259. package/dist/workflow/events.js +39 -0
  260. package/dist/workflow/index.d.ts +8 -0
  261. package/dist/workflow/index.js +8 -0
  262. package/dist/workflow/module.d.ts +926 -0
  263. package/dist/workflow/module.js +19 -0
  264. package/dist/workflow/projections.d.ts +30 -0
  265. package/dist/workflow/projections.js +43 -0
  266. package/dist/workflow/scope.d.ts +61 -0
  267. package/dist/workflow/scope.js +7 -0
  268. package/dist/workflow/threads.d.ts +171 -0
  269. package/dist/workflow/threads.js +287 -0
  270. package/package.json +183 -0
@@ -0,0 +1,1037 @@
1
+ import type { AgentDefinition } from './definitions';
2
+ import { LlmTag, type LlmAdapter, type StubLlmPolicy } from './llm';
3
+ export interface AgentModuleOptions {
4
+ readonly definitions?: readonly AgentDefinition[];
5
+ /** Model adapter used for every agent turn. Defaults to a deterministic stub for tests and scripted agents. */
6
+ readonly llm?: LlmAdapter;
7
+ readonly llmPolicy?: StubLlmPolicy;
8
+ }
9
+ export declare function agent(options?: AgentModuleOptions): import("@swirls/looms/core").RuntimeModule<"agent", import("@swirls/looms/core").EventCatalog<"agent", {
10
+ 'message.received': import("effect/Schema").Struct<{
11
+ readonly message: import("effect/Schema").Struct<{
12
+ readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
13
+ readonly content: import("effect/Schema").String;
14
+ readonly toolCallId: import("effect/Schema").optional<import("effect/Schema").String>;
15
+ readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
16
+ readonly toolCalls: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
17
+ readonly id: import("effect/Schema").String;
18
+ readonly name: import("effect/Schema").String;
19
+ readonly arguments: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
20
+ }>>>>;
21
+ }>;
22
+ }>;
23
+ 'turn.started': import("effect/Schema").Struct<{
24
+ readonly turn: import("effect/Schema").Number;
25
+ }>;
26
+ 'turn.text_delta': import("effect/Schema").Struct<{
27
+ readonly turn: import("effect/Schema").Number;
28
+ readonly delta: import("effect/Schema").String;
29
+ }>;
30
+ message: import("effect/Schema").Struct<{
31
+ readonly turn: import("effect/Schema").Number;
32
+ readonly message: import("effect/Schema").Struct<{
33
+ readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
34
+ readonly content: import("effect/Schema").String;
35
+ readonly toolCallId: import("effect/Schema").optional<import("effect/Schema").String>;
36
+ readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
37
+ readonly toolCalls: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
38
+ readonly id: import("effect/Schema").String;
39
+ readonly name: import("effect/Schema").String;
40
+ readonly arguments: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
41
+ }>>>>;
42
+ }>;
43
+ readonly usage: import("effect/Schema").optional<import("effect/Schema").Struct<{
44
+ readonly input: import("effect/Schema").Number;
45
+ readonly output: import("effect/Schema").Number;
46
+ }>>;
47
+ }>;
48
+ 'tool_call.requested': import("effect/Schema").Struct<{
49
+ readonly turn: import("effect/Schema").Number;
50
+ readonly toolCall: import("effect/Schema").Struct<{
51
+ readonly id: import("effect/Schema").String;
52
+ readonly name: import("effect/Schema").String;
53
+ readonly arguments: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
54
+ }>;
55
+ }>;
56
+ 'tool.result': import("effect/Schema").Struct<{
57
+ readonly turn: import("effect/Schema").Number;
58
+ readonly toolCallId: import("effect/Schema").String;
59
+ readonly name: import("effect/Schema").String;
60
+ readonly result: import("effect/Schema").NullOr<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
61
+ readonly error: import("effect/Schema").NullOr<import("effect/Schema").String>;
62
+ }>;
63
+ steered: import("effect/Schema").Struct<{
64
+ readonly turn: import("effect/Schema").Number;
65
+ readonly message: import("effect/Schema").Struct<{
66
+ readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
67
+ readonly content: import("effect/Schema").String;
68
+ readonly toolCallId: import("effect/Schema").optional<import("effect/Schema").String>;
69
+ readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
70
+ readonly toolCalls: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
71
+ readonly id: import("effect/Schema").String;
72
+ readonly name: import("effect/Schema").String;
73
+ readonly arguments: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
74
+ }>>>>;
75
+ }>;
76
+ readonly interrupt: import("effect/Schema").optional<import("effect/Schema").Boolean>;
77
+ }>;
78
+ 'spawn.requested': import("effect/Schema").Struct<{
79
+ readonly childThreadId: import("effect/Schema").String;
80
+ readonly kind: import("effect/Schema").String;
81
+ readonly definitionName: import("effect/Schema").String;
82
+ readonly toolCallId: import("effect/Schema").String;
83
+ readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
84
+ }>;
85
+ 'effects.requested': import("effect/Schema").Struct<{
86
+ readonly toolCallId: import("effect/Schema").String;
87
+ readonly effects: import("effect/Schema").$Array<import("effect/Schema").Schema<import("@swirls/looms/core").RuntimeEffect>>;
88
+ readonly waitOn: import("effect/Schema").optional<import("effect/Schema").Struct<{
89
+ readonly type: import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>]>;
90
+ readonly match: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
91
+ }>>;
92
+ }>;
93
+ }>, {
94
+ callLLM: import("@swirls/looms/core").EffectDefinition<{
95
+ readonly turn: number;
96
+ readonly definitionName?: string | undefined;
97
+ readonly messages?: readonly {
98
+ readonly role: "assistant" | "system" | "tool" | "user";
99
+ readonly content: string;
100
+ readonly toolCallId?: string | undefined;
101
+ readonly name?: string | undefined;
102
+ readonly toolCalls?: {
103
+ readonly id: string;
104
+ readonly name: string;
105
+ readonly arguments: import("effect/Schema").Json;
106
+ }[] | undefined;
107
+ }[] | undefined;
108
+ readonly input?: import("effect/Schema").Json | undefined;
109
+ }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
110
+ readonly type: "agent.effects.requested";
111
+ readonly payload: {
112
+ readonly toolCallId: string;
113
+ readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
114
+ readonly waitOn?: {
115
+ readonly type: string | readonly string[];
116
+ readonly match?: import("effect/Schema").Json | undefined;
117
+ } | undefined;
118
+ };
119
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
120
+ readonly type: "agent.message";
121
+ readonly payload: {
122
+ readonly turn: number;
123
+ readonly message: {
124
+ readonly role: "assistant" | "system" | "tool" | "user";
125
+ readonly content: string;
126
+ readonly toolCallId?: string | undefined;
127
+ readonly name?: string | undefined;
128
+ readonly toolCalls?: {
129
+ readonly id: string;
130
+ readonly name: string;
131
+ readonly arguments: import("effect/Schema").Json;
132
+ }[] | undefined;
133
+ };
134
+ readonly usage?: {
135
+ readonly input: number;
136
+ readonly output: number;
137
+ } | undefined;
138
+ };
139
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
140
+ readonly type: "agent.message.received";
141
+ readonly payload: {
142
+ readonly message: {
143
+ readonly role: "assistant" | "system" | "tool" | "user";
144
+ readonly content: string;
145
+ readonly toolCallId?: string | undefined;
146
+ readonly name?: string | undefined;
147
+ readonly toolCalls?: {
148
+ readonly id: string;
149
+ readonly name: string;
150
+ readonly arguments: import("effect/Schema").Json;
151
+ }[] | undefined;
152
+ };
153
+ };
154
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
155
+ readonly type: "agent.spawn.requested";
156
+ readonly payload: {
157
+ readonly childThreadId: string;
158
+ readonly kind: string;
159
+ readonly definitionName: string;
160
+ readonly toolCallId: string;
161
+ readonly input: import("effect/Schema").Json;
162
+ };
163
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
164
+ readonly type: "agent.steered";
165
+ readonly payload: {
166
+ readonly turn: number;
167
+ readonly message: {
168
+ readonly role: "assistant" | "system" | "tool" | "user";
169
+ readonly content: string;
170
+ readonly toolCallId?: string | undefined;
171
+ readonly name?: string | undefined;
172
+ readonly toolCalls?: {
173
+ readonly id: string;
174
+ readonly name: string;
175
+ readonly arguments: import("effect/Schema").Json;
176
+ }[] | undefined;
177
+ };
178
+ readonly interrupt?: boolean | undefined;
179
+ };
180
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
181
+ readonly type: "agent.tool.result";
182
+ readonly payload: {
183
+ readonly turn: number;
184
+ readonly toolCallId: string;
185
+ readonly name: string;
186
+ readonly result: import("effect/Schema").Json;
187
+ readonly error: string | null;
188
+ };
189
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
190
+ readonly type: "agent.tool_call.requested";
191
+ readonly payload: {
192
+ readonly turn: number;
193
+ readonly toolCall: {
194
+ readonly id: string;
195
+ readonly name: string;
196
+ readonly arguments: import("effect/Schema").Json;
197
+ };
198
+ };
199
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
200
+ readonly type: "agent.turn.started";
201
+ readonly payload: {
202
+ readonly turn: number;
203
+ };
204
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
205
+ readonly type: "agent.turn.text_delta";
206
+ readonly payload: {
207
+ readonly turn: number;
208
+ readonly delta: string;
209
+ };
210
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
211
+ readonly type: "runtime.effect.failed";
212
+ readonly payload: {
213
+ readonly effectId: string;
214
+ readonly error: string;
215
+ };
216
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
217
+ readonly type: "runtime.run.completed";
218
+ readonly payload: {
219
+ readonly output: import("effect/Schema").Json;
220
+ readonly error: string | null;
221
+ };
222
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
223
+ readonly type: "runtime.run.started";
224
+ readonly payload: {
225
+ readonly rootThreadId?: string | undefined;
226
+ readonly kind: string;
227
+ readonly definitionName: string;
228
+ readonly input: import("effect/Schema").Json;
229
+ };
230
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
231
+ readonly type: "runtime.signal.received";
232
+ readonly payload: {
233
+ readonly signalType: string;
234
+ };
235
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
236
+ readonly type: "runtime.snapshot.taken";
237
+ readonly payload: {
238
+ readonly seq: number;
239
+ readonly stateHash: string;
240
+ readonly state?: import("effect/Schema").Json | undefined;
241
+ };
242
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
243
+ readonly type: "runtime.thread.cancelled";
244
+ readonly payload: {
245
+ readonly threadId: string;
246
+ readonly reason?: string | undefined;
247
+ };
248
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
249
+ readonly type: "runtime.thread.completed";
250
+ readonly payload: {
251
+ readonly threadId: string;
252
+ readonly output: import("effect/Schema").Json;
253
+ };
254
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
255
+ readonly type: "runtime.thread.failed";
256
+ readonly payload: {
257
+ readonly threadId: string;
258
+ readonly error: string;
259
+ };
260
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
261
+ readonly type: "runtime.thread.started";
262
+ readonly payload: {
263
+ readonly threadId: string;
264
+ readonly kind: string;
265
+ readonly definitionName: string;
266
+ readonly input: import("effect/Schema").Json;
267
+ readonly parentThreadId: string | null;
268
+ };
269
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
270
+ readonly type: "runtime.timer.fired";
271
+ readonly payload: {
272
+ readonly timerId: string;
273
+ readonly waitId: string;
274
+ };
275
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
276
+ readonly type: "runtime.timer.set";
277
+ readonly payload: {
278
+ readonly timerId: string;
279
+ readonly waitId: string;
280
+ readonly wakeAt: number;
281
+ };
282
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
283
+ readonly type: "runtime.wait.registered";
284
+ readonly payload: {
285
+ readonly waitId: string;
286
+ readonly threadId?: string | undefined;
287
+ readonly on: {
288
+ readonly type: string | readonly string[];
289
+ readonly match?: import("effect/Schema").Json | undefined;
290
+ } | {
291
+ readonly timerAt: number;
292
+ };
293
+ readonly tag?: import("effect/Schema").Json | undefined;
294
+ };
295
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
296
+ readonly type: "runtime.wait.satisfied";
297
+ readonly payload: {
298
+ readonly waitId: string;
299
+ readonly tag?: import("effect/Schema").Json | undefined;
300
+ readonly event: {
301
+ readonly id: string;
302
+ readonly type: string;
303
+ readonly payload: import("effect/Schema").Json;
304
+ };
305
+ };
306
+ })>;
307
+ executeTool: import("@swirls/looms/core").EffectDefinition<{
308
+ readonly turn: number;
309
+ readonly definitionName?: string | undefined;
310
+ readonly toolCall: {
311
+ readonly id: string;
312
+ readonly name: string;
313
+ readonly arguments: import("effect/Schema").Json;
314
+ };
315
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
316
+ readonly type: "agent.effects.requested";
317
+ readonly payload: {
318
+ readonly toolCallId: string;
319
+ readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
320
+ readonly waitOn?: {
321
+ readonly type: string | readonly string[];
322
+ readonly match?: import("effect/Schema").Json | undefined;
323
+ } | undefined;
324
+ };
325
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
326
+ readonly type: "agent.message";
327
+ readonly payload: {
328
+ readonly turn: number;
329
+ readonly message: {
330
+ readonly role: "assistant" | "system" | "tool" | "user";
331
+ readonly content: string;
332
+ readonly toolCallId?: string | undefined;
333
+ readonly name?: string | undefined;
334
+ readonly toolCalls?: {
335
+ readonly id: string;
336
+ readonly name: string;
337
+ readonly arguments: import("effect/Schema").Json;
338
+ }[] | undefined;
339
+ };
340
+ readonly usage?: {
341
+ readonly input: number;
342
+ readonly output: number;
343
+ } | undefined;
344
+ };
345
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
346
+ readonly type: "agent.message.received";
347
+ readonly payload: {
348
+ readonly message: {
349
+ readonly role: "assistant" | "system" | "tool" | "user";
350
+ readonly content: string;
351
+ readonly toolCallId?: string | undefined;
352
+ readonly name?: string | undefined;
353
+ readonly toolCalls?: {
354
+ readonly id: string;
355
+ readonly name: string;
356
+ readonly arguments: import("effect/Schema").Json;
357
+ }[] | undefined;
358
+ };
359
+ };
360
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
361
+ readonly type: "agent.spawn.requested";
362
+ readonly payload: {
363
+ readonly childThreadId: string;
364
+ readonly kind: string;
365
+ readonly definitionName: string;
366
+ readonly toolCallId: string;
367
+ readonly input: import("effect/Schema").Json;
368
+ };
369
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
370
+ readonly type: "agent.steered";
371
+ readonly payload: {
372
+ readonly turn: number;
373
+ readonly message: {
374
+ readonly role: "assistant" | "system" | "tool" | "user";
375
+ readonly content: string;
376
+ readonly toolCallId?: string | undefined;
377
+ readonly name?: string | undefined;
378
+ readonly toolCalls?: {
379
+ readonly id: string;
380
+ readonly name: string;
381
+ readonly arguments: import("effect/Schema").Json;
382
+ }[] | undefined;
383
+ };
384
+ readonly interrupt?: boolean | undefined;
385
+ };
386
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
387
+ readonly type: "agent.tool.result";
388
+ readonly payload: {
389
+ readonly turn: number;
390
+ readonly toolCallId: string;
391
+ readonly name: string;
392
+ readonly result: import("effect/Schema").Json;
393
+ readonly error: string | null;
394
+ };
395
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
396
+ readonly type: "agent.tool_call.requested";
397
+ readonly payload: {
398
+ readonly turn: number;
399
+ readonly toolCall: {
400
+ readonly id: string;
401
+ readonly name: string;
402
+ readonly arguments: import("effect/Schema").Json;
403
+ };
404
+ };
405
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
406
+ readonly type: "agent.turn.started";
407
+ readonly payload: {
408
+ readonly turn: number;
409
+ };
410
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
411
+ readonly type: "agent.turn.text_delta";
412
+ readonly payload: {
413
+ readonly turn: number;
414
+ readonly delta: string;
415
+ };
416
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
417
+ readonly type: "runtime.effect.failed";
418
+ readonly payload: {
419
+ readonly effectId: string;
420
+ readonly error: string;
421
+ };
422
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
423
+ readonly type: "runtime.run.completed";
424
+ readonly payload: {
425
+ readonly output: import("effect/Schema").Json;
426
+ readonly error: string | null;
427
+ };
428
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
429
+ readonly type: "runtime.run.started";
430
+ readonly payload: {
431
+ readonly rootThreadId?: string | undefined;
432
+ readonly kind: string;
433
+ readonly definitionName: string;
434
+ readonly input: import("effect/Schema").Json;
435
+ };
436
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
437
+ readonly type: "runtime.signal.received";
438
+ readonly payload: {
439
+ readonly signalType: string;
440
+ };
441
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
442
+ readonly type: "runtime.snapshot.taken";
443
+ readonly payload: {
444
+ readonly seq: number;
445
+ readonly stateHash: string;
446
+ readonly state?: import("effect/Schema").Json | undefined;
447
+ };
448
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
449
+ readonly type: "runtime.thread.cancelled";
450
+ readonly payload: {
451
+ readonly threadId: string;
452
+ readonly reason?: string | undefined;
453
+ };
454
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
455
+ readonly type: "runtime.thread.completed";
456
+ readonly payload: {
457
+ readonly threadId: string;
458
+ readonly output: import("effect/Schema").Json;
459
+ };
460
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
461
+ readonly type: "runtime.thread.failed";
462
+ readonly payload: {
463
+ readonly threadId: string;
464
+ readonly error: string;
465
+ };
466
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
467
+ readonly type: "runtime.thread.started";
468
+ readonly payload: {
469
+ readonly threadId: string;
470
+ readonly kind: string;
471
+ readonly definitionName: string;
472
+ readonly input: import("effect/Schema").Json;
473
+ readonly parentThreadId: string | null;
474
+ };
475
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
476
+ readonly type: "runtime.timer.fired";
477
+ readonly payload: {
478
+ readonly timerId: string;
479
+ readonly waitId: string;
480
+ };
481
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
482
+ readonly type: "runtime.timer.set";
483
+ readonly payload: {
484
+ readonly timerId: string;
485
+ readonly waitId: string;
486
+ readonly wakeAt: number;
487
+ };
488
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
489
+ readonly type: "runtime.wait.registered";
490
+ readonly payload: {
491
+ readonly waitId: string;
492
+ readonly threadId?: string | undefined;
493
+ readonly on: {
494
+ readonly type: string | readonly string[];
495
+ readonly match?: import("effect/Schema").Json | undefined;
496
+ } | {
497
+ readonly timerAt: number;
498
+ };
499
+ readonly tag?: import("effect/Schema").Json | undefined;
500
+ };
501
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
502
+ readonly type: "runtime.wait.satisfied";
503
+ readonly payload: {
504
+ readonly waitId: string;
505
+ readonly tag?: import("effect/Schema").Json | undefined;
506
+ readonly event: {
507
+ readonly id: string;
508
+ readonly type: string;
509
+ readonly payload: import("effect/Schema").Json;
510
+ };
511
+ };
512
+ })>;
513
+ }, {
514
+ agent: import("@swirls/looms/core").ThreadDefinition<{
515
+ definitionName?: string;
516
+ lines: import("./types").Message[];
517
+ pendingToolCalls: import("./types").ToolCall[];
518
+ executingToolCalls: import("./types").ToolCall[];
519
+ needsLlmCall: boolean;
520
+ turn: number;
521
+ maxTurns: number;
522
+ pendingSteer: import("./types").Message | null;
523
+ input: import("@swirls/looms/core").JsonValue;
524
+ output: import("@swirls/looms/core").JsonValue | null;
525
+ pendingEffectTools: {
526
+ [causingSeq: string]: import("./types").PendingEffectTool;
527
+ };
528
+ pendingSpawns: import("./types").AgentPendingSpawn[];
529
+ pendingEffects: import("./types").AgentPendingEffects[];
530
+ pendingEmits: (import("./types").AgentPendingEmit | {
531
+ id: string;
532
+ event: {
533
+ type: string;
534
+ payload: {
535
+ turn: number;
536
+ toolCallId: string;
537
+ name: string;
538
+ result: string | number | boolean | import("effect/Schema").JsonArray | import("effect/Schema").JsonObject | null;
539
+ error: string | null;
540
+ };
541
+ threadId: string;
542
+ };
543
+ })[];
544
+ }>;
545
+ }, {
546
+ conversation: import("@swirls/looms/core").ProjectionDefinition<{
547
+ readonly lines: {
548
+ readonly role: "assistant" | "system" | "tool" | "user";
549
+ readonly content: string;
550
+ readonly toolCallId?: string | undefined;
551
+ readonly name?: string | undefined;
552
+ readonly toolCalls?: {
553
+ readonly id: string;
554
+ readonly name: string;
555
+ readonly arguments: import("effect/Schema").Json;
556
+ }[] | undefined;
557
+ }[];
558
+ }>;
559
+ tokenUsage: import("@swirls/looms/core").ProjectionDefinition<{
560
+ readonly input: number;
561
+ readonly output: number;
562
+ }>;
563
+ }, any> & {
564
+ readonly effects: {
565
+ callLLM: import("@swirls/looms/core").EffectDefinition<{
566
+ readonly turn: number;
567
+ readonly definitionName?: string | undefined;
568
+ readonly messages?: readonly {
569
+ readonly role: "assistant" | "system" | "tool" | "user";
570
+ readonly content: string;
571
+ readonly toolCallId?: string | undefined;
572
+ readonly name?: string | undefined;
573
+ readonly toolCalls?: {
574
+ readonly id: string;
575
+ readonly name: string;
576
+ readonly arguments: import("effect/Schema").Json;
577
+ }[] | undefined;
578
+ }[] | undefined;
579
+ readonly input?: import("effect/Schema").Json | undefined;
580
+ }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
581
+ readonly type: "agent.effects.requested";
582
+ readonly payload: {
583
+ readonly toolCallId: string;
584
+ readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
585
+ readonly waitOn?: {
586
+ readonly type: string | readonly string[];
587
+ readonly match?: import("effect/Schema").Json | undefined;
588
+ } | undefined;
589
+ };
590
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
591
+ readonly type: "agent.message";
592
+ readonly payload: {
593
+ readonly turn: number;
594
+ readonly message: {
595
+ readonly role: "assistant" | "system" | "tool" | "user";
596
+ readonly content: string;
597
+ readonly toolCallId?: string | undefined;
598
+ readonly name?: string | undefined;
599
+ readonly toolCalls?: {
600
+ readonly id: string;
601
+ readonly name: string;
602
+ readonly arguments: import("effect/Schema").Json;
603
+ }[] | undefined;
604
+ };
605
+ readonly usage?: {
606
+ readonly input: number;
607
+ readonly output: number;
608
+ } | undefined;
609
+ };
610
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
611
+ readonly type: "agent.message.received";
612
+ readonly payload: {
613
+ readonly message: {
614
+ readonly role: "assistant" | "system" | "tool" | "user";
615
+ readonly content: string;
616
+ readonly toolCallId?: string | undefined;
617
+ readonly name?: string | undefined;
618
+ readonly toolCalls?: {
619
+ readonly id: string;
620
+ readonly name: string;
621
+ readonly arguments: import("effect/Schema").Json;
622
+ }[] | undefined;
623
+ };
624
+ };
625
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
626
+ readonly type: "agent.spawn.requested";
627
+ readonly payload: {
628
+ readonly childThreadId: string;
629
+ readonly kind: string;
630
+ readonly definitionName: string;
631
+ readonly toolCallId: string;
632
+ readonly input: import("effect/Schema").Json;
633
+ };
634
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
635
+ readonly type: "agent.steered";
636
+ readonly payload: {
637
+ readonly turn: number;
638
+ readonly message: {
639
+ readonly role: "assistant" | "system" | "tool" | "user";
640
+ readonly content: string;
641
+ readonly toolCallId?: string | undefined;
642
+ readonly name?: string | undefined;
643
+ readonly toolCalls?: {
644
+ readonly id: string;
645
+ readonly name: string;
646
+ readonly arguments: import("effect/Schema").Json;
647
+ }[] | undefined;
648
+ };
649
+ readonly interrupt?: boolean | undefined;
650
+ };
651
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
652
+ readonly type: "agent.tool.result";
653
+ readonly payload: {
654
+ readonly turn: number;
655
+ readonly toolCallId: string;
656
+ readonly name: string;
657
+ readonly result: import("effect/Schema").Json;
658
+ readonly error: string | null;
659
+ };
660
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
661
+ readonly type: "agent.tool_call.requested";
662
+ readonly payload: {
663
+ readonly turn: number;
664
+ readonly toolCall: {
665
+ readonly id: string;
666
+ readonly name: string;
667
+ readonly arguments: import("effect/Schema").Json;
668
+ };
669
+ };
670
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
671
+ readonly type: "agent.turn.started";
672
+ readonly payload: {
673
+ readonly turn: number;
674
+ };
675
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
676
+ readonly type: "agent.turn.text_delta";
677
+ readonly payload: {
678
+ readonly turn: number;
679
+ readonly delta: string;
680
+ };
681
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
682
+ readonly type: "runtime.effect.failed";
683
+ readonly payload: {
684
+ readonly effectId: string;
685
+ readonly error: string;
686
+ };
687
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
688
+ readonly type: "runtime.run.completed";
689
+ readonly payload: {
690
+ readonly output: import("effect/Schema").Json;
691
+ readonly error: string | null;
692
+ };
693
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
694
+ readonly type: "runtime.run.started";
695
+ readonly payload: {
696
+ readonly rootThreadId?: string | undefined;
697
+ readonly kind: string;
698
+ readonly definitionName: string;
699
+ readonly input: import("effect/Schema").Json;
700
+ };
701
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
702
+ readonly type: "runtime.signal.received";
703
+ readonly payload: {
704
+ readonly signalType: string;
705
+ };
706
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
707
+ readonly type: "runtime.snapshot.taken";
708
+ readonly payload: {
709
+ readonly seq: number;
710
+ readonly stateHash: string;
711
+ readonly state?: import("effect/Schema").Json | undefined;
712
+ };
713
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
714
+ readonly type: "runtime.thread.cancelled";
715
+ readonly payload: {
716
+ readonly threadId: string;
717
+ readonly reason?: string | undefined;
718
+ };
719
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
720
+ readonly type: "runtime.thread.completed";
721
+ readonly payload: {
722
+ readonly threadId: string;
723
+ readonly output: import("effect/Schema").Json;
724
+ };
725
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
726
+ readonly type: "runtime.thread.failed";
727
+ readonly payload: {
728
+ readonly threadId: string;
729
+ readonly error: string;
730
+ };
731
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
732
+ readonly type: "runtime.thread.started";
733
+ readonly payload: {
734
+ readonly threadId: string;
735
+ readonly kind: string;
736
+ readonly definitionName: string;
737
+ readonly input: import("effect/Schema").Json;
738
+ readonly parentThreadId: string | null;
739
+ };
740
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
741
+ readonly type: "runtime.timer.fired";
742
+ readonly payload: {
743
+ readonly timerId: string;
744
+ readonly waitId: string;
745
+ };
746
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
747
+ readonly type: "runtime.timer.set";
748
+ readonly payload: {
749
+ readonly timerId: string;
750
+ readonly waitId: string;
751
+ readonly wakeAt: number;
752
+ };
753
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
754
+ readonly type: "runtime.wait.registered";
755
+ readonly payload: {
756
+ readonly waitId: string;
757
+ readonly threadId?: string | undefined;
758
+ readonly on: {
759
+ readonly type: string | readonly string[];
760
+ readonly match?: import("effect/Schema").Json | undefined;
761
+ } | {
762
+ readonly timerAt: number;
763
+ };
764
+ readonly tag?: import("effect/Schema").Json | undefined;
765
+ };
766
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
767
+ readonly type: "runtime.wait.satisfied";
768
+ readonly payload: {
769
+ readonly waitId: string;
770
+ readonly tag?: import("effect/Schema").Json | undefined;
771
+ readonly event: {
772
+ readonly id: string;
773
+ readonly type: string;
774
+ readonly payload: import("effect/Schema").Json;
775
+ };
776
+ };
777
+ })>;
778
+ executeTool: import("@swirls/looms/core").EffectDefinition<{
779
+ readonly turn: number;
780
+ readonly definitionName?: string | undefined;
781
+ readonly toolCall: {
782
+ readonly id: string;
783
+ readonly name: string;
784
+ readonly arguments: import("effect/Schema").Json;
785
+ };
786
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
787
+ readonly type: "agent.effects.requested";
788
+ readonly payload: {
789
+ readonly toolCallId: string;
790
+ readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
791
+ readonly waitOn?: {
792
+ readonly type: string | readonly string[];
793
+ readonly match?: import("effect/Schema").Json | undefined;
794
+ } | undefined;
795
+ };
796
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
797
+ readonly type: "agent.message";
798
+ readonly payload: {
799
+ readonly turn: number;
800
+ readonly message: {
801
+ readonly role: "assistant" | "system" | "tool" | "user";
802
+ readonly content: string;
803
+ readonly toolCallId?: string | undefined;
804
+ readonly name?: string | undefined;
805
+ readonly toolCalls?: {
806
+ readonly id: string;
807
+ readonly name: string;
808
+ readonly arguments: import("effect/Schema").Json;
809
+ }[] | undefined;
810
+ };
811
+ readonly usage?: {
812
+ readonly input: number;
813
+ readonly output: number;
814
+ } | undefined;
815
+ };
816
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
817
+ readonly type: "agent.message.received";
818
+ readonly payload: {
819
+ readonly message: {
820
+ readonly role: "assistant" | "system" | "tool" | "user";
821
+ readonly content: string;
822
+ readonly toolCallId?: string | undefined;
823
+ readonly name?: string | undefined;
824
+ readonly toolCalls?: {
825
+ readonly id: string;
826
+ readonly name: string;
827
+ readonly arguments: import("effect/Schema").Json;
828
+ }[] | undefined;
829
+ };
830
+ };
831
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
832
+ readonly type: "agent.spawn.requested";
833
+ readonly payload: {
834
+ readonly childThreadId: string;
835
+ readonly kind: string;
836
+ readonly definitionName: string;
837
+ readonly toolCallId: string;
838
+ readonly input: import("effect/Schema").Json;
839
+ };
840
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
841
+ readonly type: "agent.steered";
842
+ readonly payload: {
843
+ readonly turn: number;
844
+ readonly message: {
845
+ readonly role: "assistant" | "system" | "tool" | "user";
846
+ readonly content: string;
847
+ readonly toolCallId?: string | undefined;
848
+ readonly name?: string | undefined;
849
+ readonly toolCalls?: {
850
+ readonly id: string;
851
+ readonly name: string;
852
+ readonly arguments: import("effect/Schema").Json;
853
+ }[] | undefined;
854
+ };
855
+ readonly interrupt?: boolean | undefined;
856
+ };
857
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
858
+ readonly type: "agent.tool.result";
859
+ readonly payload: {
860
+ readonly turn: number;
861
+ readonly toolCallId: string;
862
+ readonly name: string;
863
+ readonly result: import("effect/Schema").Json;
864
+ readonly error: string | null;
865
+ };
866
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
867
+ readonly type: "agent.tool_call.requested";
868
+ readonly payload: {
869
+ readonly turn: number;
870
+ readonly toolCall: {
871
+ readonly id: string;
872
+ readonly name: string;
873
+ readonly arguments: import("effect/Schema").Json;
874
+ };
875
+ };
876
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
877
+ readonly type: "agent.turn.started";
878
+ readonly payload: {
879
+ readonly turn: number;
880
+ };
881
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
882
+ readonly type: "agent.turn.text_delta";
883
+ readonly payload: {
884
+ readonly turn: number;
885
+ readonly delta: string;
886
+ };
887
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
888
+ readonly type: "runtime.effect.failed";
889
+ readonly payload: {
890
+ readonly effectId: string;
891
+ readonly error: string;
892
+ };
893
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
894
+ readonly type: "runtime.run.completed";
895
+ readonly payload: {
896
+ readonly output: import("effect/Schema").Json;
897
+ readonly error: string | null;
898
+ };
899
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
900
+ readonly type: "runtime.run.started";
901
+ readonly payload: {
902
+ readonly rootThreadId?: string | undefined;
903
+ readonly kind: string;
904
+ readonly definitionName: string;
905
+ readonly input: import("effect/Schema").Json;
906
+ };
907
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
908
+ readonly type: "runtime.signal.received";
909
+ readonly payload: {
910
+ readonly signalType: string;
911
+ };
912
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
913
+ readonly type: "runtime.snapshot.taken";
914
+ readonly payload: {
915
+ readonly seq: number;
916
+ readonly stateHash: string;
917
+ readonly state?: import("effect/Schema").Json | undefined;
918
+ };
919
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
920
+ readonly type: "runtime.thread.cancelled";
921
+ readonly payload: {
922
+ readonly threadId: string;
923
+ readonly reason?: string | undefined;
924
+ };
925
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
926
+ readonly type: "runtime.thread.completed";
927
+ readonly payload: {
928
+ readonly threadId: string;
929
+ readonly output: import("effect/Schema").Json;
930
+ };
931
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
932
+ readonly type: "runtime.thread.failed";
933
+ readonly payload: {
934
+ readonly threadId: string;
935
+ readonly error: string;
936
+ };
937
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
938
+ readonly type: "runtime.thread.started";
939
+ readonly payload: {
940
+ readonly threadId: string;
941
+ readonly kind: string;
942
+ readonly definitionName: string;
943
+ readonly input: import("effect/Schema").Json;
944
+ readonly parentThreadId: string | null;
945
+ };
946
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
947
+ readonly type: "runtime.timer.fired";
948
+ readonly payload: {
949
+ readonly timerId: string;
950
+ readonly waitId: string;
951
+ };
952
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
953
+ readonly type: "runtime.timer.set";
954
+ readonly payload: {
955
+ readonly timerId: string;
956
+ readonly waitId: string;
957
+ readonly wakeAt: number;
958
+ };
959
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
960
+ readonly type: "runtime.wait.registered";
961
+ readonly payload: {
962
+ readonly waitId: string;
963
+ readonly threadId?: string | undefined;
964
+ readonly on: {
965
+ readonly type: string | readonly string[];
966
+ readonly match?: import("effect/Schema").Json | undefined;
967
+ } | {
968
+ readonly timerAt: number;
969
+ };
970
+ readonly tag?: import("effect/Schema").Json | undefined;
971
+ };
972
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
973
+ readonly type: "runtime.wait.satisfied";
974
+ readonly payload: {
975
+ readonly waitId: string;
976
+ readonly tag?: import("effect/Schema").Json | undefined;
977
+ readonly event: {
978
+ readonly id: string;
979
+ readonly type: string;
980
+ readonly payload: import("effect/Schema").Json;
981
+ };
982
+ };
983
+ })>;
984
+ };
985
+ readonly threads: {
986
+ agent: import("@swirls/looms/core").ThreadDefinition<{
987
+ definitionName?: string;
988
+ lines: import("./types").Message[];
989
+ pendingToolCalls: import("./types").ToolCall[];
990
+ executingToolCalls: import("./types").ToolCall[];
991
+ needsLlmCall: boolean;
992
+ turn: number;
993
+ maxTurns: number;
994
+ pendingSteer: import("./types").Message | null;
995
+ input: import("@swirls/looms/core").JsonValue;
996
+ output: import("@swirls/looms/core").JsonValue | null;
997
+ pendingEffectTools: {
998
+ [causingSeq: string]: import("./types").PendingEffectTool;
999
+ };
1000
+ pendingSpawns: import("./types").AgentPendingSpawn[];
1001
+ pendingEffects: import("./types").AgentPendingEffects[];
1002
+ pendingEmits: (import("./types").AgentPendingEmit | {
1003
+ id: string;
1004
+ event: {
1005
+ type: string;
1006
+ payload: {
1007
+ turn: number;
1008
+ toolCallId: string;
1009
+ name: string;
1010
+ result: string | number | boolean | import("effect/Schema").JsonArray | import("effect/Schema").JsonObject | null;
1011
+ error: string | null;
1012
+ };
1013
+ threadId: string;
1014
+ };
1015
+ })[];
1016
+ }>;
1017
+ };
1018
+ readonly projections: {
1019
+ conversation: import("@swirls/looms/core").ProjectionDefinition<{
1020
+ readonly lines: {
1021
+ readonly role: "assistant" | "system" | "tool" | "user";
1022
+ readonly content: string;
1023
+ readonly toolCallId?: string | undefined;
1024
+ readonly name?: string | undefined;
1025
+ readonly toolCalls?: {
1026
+ readonly id: string;
1027
+ readonly name: string;
1028
+ readonly arguments: import("effect/Schema").Json;
1029
+ }[] | undefined;
1030
+ }[];
1031
+ }>;
1032
+ tokenUsage: import("@swirls/looms/core").ProjectionDefinition<{
1033
+ readonly input: number;
1034
+ readonly output: number;
1035
+ }>;
1036
+ };
1037
+ };