@dxos/assistant 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (152) hide show
  1. package/README.md +1 -0
  2. package/dist/lib/neutral/extraction/index.mjs +202 -0
  3. package/dist/lib/neutral/extraction/index.mjs.map +7 -0
  4. package/dist/lib/neutral/index.mjs +1736 -0
  5. package/dist/lib/neutral/index.mjs.map +7 -0
  6. package/dist/lib/neutral/meta.json +1 -0
  7. package/dist/types/src/conversation/context.d.ts +124 -64
  8. package/dist/types/src/conversation/context.d.ts.map +1 -1
  9. package/dist/types/src/conversation/context.test.d.ts +2 -0
  10. package/dist/types/src/conversation/context.test.d.ts.map +1 -0
  11. package/dist/types/src/conversation/index.d.ts +1 -1
  12. package/dist/types/src/conversation/index.d.ts.map +1 -1
  13. package/dist/types/src/conversation/session.d.ts +73 -0
  14. package/dist/types/src/conversation/session.d.ts.map +1 -0
  15. package/dist/types/src/diff.d.ts +3 -1
  16. package/dist/types/src/diff.d.ts.map +1 -1
  17. package/dist/types/src/errors.d.ts +40 -48
  18. package/dist/types/src/errors.d.ts.map +1 -1
  19. package/dist/types/src/execution-graph.d.ts +85 -0
  20. package/dist/types/src/execution-graph.d.ts.map +1 -0
  21. package/dist/types/src/execution-graph.test.d.ts +2 -0
  22. package/dist/types/src/execution-graph.test.d.ts.map +1 -0
  23. package/dist/types/src/extraction/extraction-ner-function/index.d.ts +0 -1
  24. package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -1
  25. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
  26. package/dist/types/src/extraction/extraction.d.ts +1066 -303
  27. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  28. package/dist/types/src/extraction/index.d.ts +0 -1
  29. package/dist/types/src/extraction/index.d.ts.map +1 -1
  30. package/dist/types/src/extraction/quotes.d.ts +3 -3
  31. package/dist/types/src/extraction/quotes.d.ts.map +1 -1
  32. package/dist/types/src/functions/services.d.ts +15 -5
  33. package/dist/types/src/functions/services.d.ts.map +1 -1
  34. package/dist/types/src/index.d.ts +3 -1
  35. package/dist/types/src/index.d.ts.map +1 -1
  36. package/dist/types/src/session/artifact-diff.d.ts +2 -2
  37. package/dist/types/src/session/artifact-diff.d.ts.map +1 -1
  38. package/dist/types/src/session/error-handling.d.ts +2 -2
  39. package/dist/types/src/session/error-handling.d.ts.map +1 -1
  40. package/dist/types/src/session/format.d.ts +8 -175
  41. package/dist/types/src/session/format.d.ts.map +1 -1
  42. package/dist/types/src/session/index.d.ts +2 -1
  43. package/dist/types/src/session/index.d.ts.map +1 -1
  44. package/dist/types/src/session/observer.d.ts +7 -6
  45. package/dist/types/src/session/observer.d.ts.map +1 -1
  46. package/dist/types/src/session/request.d.ts +104 -0
  47. package/dist/types/src/session/request.d.ts.map +1 -0
  48. package/dist/types/src/session/toolkit.d.ts +11 -9
  49. package/dist/types/src/session/toolkit.d.ts.map +1 -1
  50. package/dist/types/src/session/version-pin.d.ts +4 -4
  51. package/dist/types/src/session/version-pin.d.ts.map +1 -1
  52. package/dist/types/src/templates/system.d.ts +1 -2
  53. package/dist/types/src/templates/system.d.ts.map +1 -1
  54. package/dist/types/src/tracing.d.ts +233 -0
  55. package/dist/types/src/tracing.d.ts.map +1 -0
  56. package/dist/types/src/types/artifact.d.ts +28 -0
  57. package/dist/types/src/types/artifact.d.ts.map +1 -0
  58. package/dist/types/src/types/index.d.ts +2 -0
  59. package/dist/types/src/types/index.d.ts.map +1 -0
  60. package/dist/types/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +35 -46
  62. package/src/conversation/context.test.ts +52 -0
  63. package/src/conversation/context.ts +324 -75
  64. package/src/conversation/index.ts +1 -1
  65. package/src/conversation/session.ts +323 -0
  66. package/src/diff.test.ts +37 -6
  67. package/src/diff.ts +18 -4
  68. package/src/errors.ts +4 -4
  69. package/src/execution-graph.test.ts +740 -0
  70. package/src/execution-graph.ts +519 -0
  71. package/src/extraction/extraction-ner-function/index.ts +0 -1
  72. package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +12 -6
  73. package/src/extraction/extraction.ts +44 -15
  74. package/src/extraction/index.ts +0 -1
  75. package/src/extraction/quotes.test.ts +2 -2
  76. package/src/extraction/quotes.ts +6 -7
  77. package/src/functions/services.ts +156 -61
  78. package/src/index.ts +3 -1
  79. package/src/session/artifact-diff.ts +2 -2
  80. package/src/session/error-handling.ts +11 -6
  81. package/src/session/format.ts +35 -27
  82. package/src/session/index.ts +2 -1
  83. package/src/session/observer.ts +8 -4
  84. package/src/session/request.ts +347 -0
  85. package/src/session/toolkit.ts +32 -27
  86. package/src/session/version-pin.ts +7 -7
  87. package/src/templates/{format.tpl → instructions/format.tpl} +1 -4
  88. package/src/templates/instructions/system.tpl +96 -0
  89. package/src/templates/system.ts +9 -8
  90. package/src/tracing.ts +57 -0
  91. package/src/{types.ts → types/artifact.ts} +44 -7
  92. package/src/types/index.ts +5 -0
  93. package/dist/lib/browser/chunk-5GJYG2ML.mjs +0 -396
  94. package/dist/lib/browser/chunk-5GJYG2ML.mjs.map +0 -7
  95. package/dist/lib/browser/chunk-UB26N5UF.mjs +0 -89
  96. package/dist/lib/browser/chunk-UB26N5UF.mjs.map +0 -7
  97. package/dist/lib/browser/extraction/index.mjs +0 -268
  98. package/dist/lib/browser/extraction/index.mjs.map +0 -7
  99. package/dist/lib/browser/index.mjs +0 -469
  100. package/dist/lib/browser/index.mjs.map +0 -7
  101. package/dist/lib/browser/meta.json +0 -1
  102. package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs +0 -13
  103. package/dist/lib/browser/named-entity-recognition-QPYHML66.mjs.map +0 -7
  104. package/dist/lib/node-esm/chunk-BCFXTNSK.mjs +0 -91
  105. package/dist/lib/node-esm/chunk-BCFXTNSK.mjs.map +0 -7
  106. package/dist/lib/node-esm/chunk-FLFCEB4P.mjs +0 -398
  107. package/dist/lib/node-esm/chunk-FLFCEB4P.mjs.map +0 -7
  108. package/dist/lib/node-esm/extraction/index.mjs +0 -269
  109. package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
  110. package/dist/lib/node-esm/index.mjs +0 -470
  111. package/dist/lib/node-esm/index.mjs.map +0 -7
  112. package/dist/lib/node-esm/meta.json +0 -1
  113. package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs +0 -14
  114. package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs.map +0 -7
  115. package/dist/types/src/conversation/conversation.d.ts +0 -42
  116. package/dist/types/src/conversation/conversation.d.ts.map +0 -1
  117. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
  118. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
  119. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
  120. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
  121. package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
  122. package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
  123. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -337
  124. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
  125. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
  126. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
  127. package/dist/types/src/session/format.test.d.ts +0 -2
  128. package/dist/types/src/session/format.test.d.ts.map +0 -1
  129. package/dist/types/src/session/session.d.ts +0 -47
  130. package/dist/types/src/session/session.d.ts.map +0 -1
  131. package/dist/types/src/session/session.test.d.ts +0 -2
  132. package/dist/types/src/session/session.test.d.ts.map +0 -1
  133. package/dist/types/src/session/version-pin.test.d.ts +0 -2
  134. package/dist/types/src/session/version-pin.test.d.ts.map +0 -1
  135. package/dist/types/src/summarization/summarization.test.d.ts +0 -2
  136. package/dist/types/src/summarization/summarization.test.d.ts.map +0 -1
  137. package/dist/types/src/types.d.ts +0 -16
  138. package/dist/types/src/types.d.ts.map +0 -1
  139. package/src/conversation/conversation.ts +0 -123
  140. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
  141. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -70
  142. package/src/extraction/extraction-llm-function/index.ts +0 -5
  143. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -115
  144. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -62
  145. package/src/session/__snapshots__/session.test.ts.snap +0 -32
  146. package/src/session/format.test.ts +0 -60
  147. package/src/session/session.test.ts +0 -308
  148. package/src/session/session.ts +0 -201
  149. package/src/session/version-pin.test.ts +0 -7
  150. package/src/summarization/summarization.test.ts +0 -197
  151. package/src/templates/system.tpl +0 -50
  152. /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
@@ -1,469 +0,0 @@
1
- import {
2
- AiAssistantError,
3
- AiSession,
4
- AnthropicError,
5
- ArtifactDiffResolver,
6
- GenerationObserver,
7
- VersionPin,
8
- createToolkit
9
- } from "./chunk-5GJYG2ML.mjs";
10
-
11
- // src/conversation/context.ts
12
- import { computed } from "@preact/signals-core";
13
- import { Context, Schema } from "effect";
14
- import { Array, pipe } from "effect";
15
- import { Blueprint } from "@dxos/blueprints";
16
- import { DXN, Obj, Type } from "@dxos/echo";
17
- import { ComplexSet } from "@dxos/util";
18
- function _define_property(obj, key, value) {
19
- if (key in obj) {
20
- Object.defineProperty(obj, key, {
21
- value,
22
- enumerable: true,
23
- configurable: true,
24
- writable: true
25
- });
26
- } else {
27
- obj[key] = value;
28
- }
29
- return obj;
30
- }
31
- var ContextBinding = Schema.Struct({
32
- blueprints: Schema.Struct({
33
- added: Schema.Array(Type.Ref(Blueprint.Blueprint)),
34
- removed: Schema.Array(Type.Ref(Blueprint.Blueprint))
35
- }),
36
- // TODO(burdon): Type.Expando => Type.Obj (or Obj.Any?)
37
- objects: Schema.Struct({
38
- added: Schema.Array(Type.Ref(Type.Expando)),
39
- removed: Schema.Array(Type.Ref(Type.Expando))
40
- })
41
- }).pipe(Type.Obj({
42
- typename: "dxos.org/type/ContextBinding",
43
- version: "0.1.0"
44
- }));
45
- var Bindings = class {
46
- toJSON() {
47
- return {
48
- blueprints: Array.fromIterable(this.blueprints).map((ref) => ref.dxn.toString()),
49
- objects: Array.fromIterable(this.objects).map((ref) => ref.dxn.toString())
50
- };
51
- }
52
- constructor() {
53
- _define_property(this, "blueprints", new ComplexSet((ref) => ref.dxn.toString()));
54
- _define_property(this, "objects", new ComplexSet((ref) => ref.dxn.asEchoDXN()?.echoId));
55
- }
56
- };
57
- var AiContextBinder = class {
58
- /**
59
- * Asynchronous query of all bindings.
60
- */
61
- async query() {
62
- const queueItems = await this._queue.queryObjects();
63
- return this._reduce(queueItems);
64
- }
65
- // TODO(burdon): Pass in Blueprint obj (from registry?) and create reference.
66
- async bind(props) {
67
- if (!props.blueprints?.length && !props.objects?.length) {
68
- return;
69
- }
70
- const blueprints = props.blueprints?.filter((ref) => !this.blueprints.peek().find((b) => b.dxn.toString() === ref.dxn.toString())) ?? [];
71
- const objects = props.objects?.filter((ref) => !this.objects.peek().find((o) => o.dxn.toString() === ref.dxn.toString())) ?? [];
72
- await this._queue.append([
73
- Obj.make(ContextBinding, {
74
- blueprints: {
75
- added: blueprints,
76
- removed: []
77
- },
78
- objects: {
79
- added: objects,
80
- removed: []
81
- }
82
- })
83
- ]);
84
- }
85
- async unbind(props) {
86
- if (!props.blueprints?.length && !props.objects?.length) {
87
- return;
88
- }
89
- await this._queue.append([
90
- Obj.make(ContextBinding, {
91
- blueprints: {
92
- added: [],
93
- removed: props.blueprints ?? []
94
- },
95
- objects: {
96
- added: [],
97
- removed: props.objects ?? []
98
- }
99
- })
100
- ]);
101
- }
102
- _reduce(items) {
103
- return pipe(items, Array.filter(Obj.instanceOf(ContextBinding)), Array.reduce(new Bindings(), (context, item) => {
104
- item.blueprints.removed.forEach((ref) => context.blueprints.delete(ref));
105
- item.blueprints.added.forEach((ref) => context.blueprints.add(ref));
106
- item.objects.removed.forEach((ref) => {
107
- for (const obj of context.objects) {
108
- if (DXN.equalsEchoId(obj.dxn, ref.dxn)) {
109
- context.objects.delete(obj);
110
- }
111
- }
112
- });
113
- item.objects.added.forEach((ref) => context.objects.add(ref));
114
- return context;
115
- }));
116
- }
117
- constructor(_queue) {
118
- _define_property(this, "_queue", void 0);
119
- _define_property(this, "bindings", void 0);
120
- _define_property(this, "blueprints", void 0);
121
- _define_property(this, "objects", void 0);
122
- this._queue = _queue;
123
- this.bindings = computed(() => this._reduce(this._queue.objects));
124
- this.blueprints = computed(() => [
125
- ...this.bindings.value.blueprints
126
- ]);
127
- this.objects = computed(() => [
128
- ...this.bindings.value.objects
129
- ]);
130
- }
131
- };
132
- var AiContextService = class extends Context.Tag("@dxos/assistant/AiContextService")() {
133
- };
134
-
135
- // src/conversation/conversation.ts
136
- import { Array as Array2, Effect, Option } from "effect";
137
- import { Obj as Obj2 } from "@dxos/echo";
138
- import { DatabaseService } from "@dxos/functions";
139
- import { log } from "@dxos/log";
140
- import { DataType } from "@dxos/schema";
141
- function _define_property2(obj, key, value) {
142
- if (key in obj) {
143
- Object.defineProperty(obj, key, {
144
- value,
145
- enumerable: true,
146
- configurable: true,
147
- writable: true
148
- });
149
- } else {
150
- obj[key] = value;
151
- }
152
- return obj;
153
- }
154
- var __dxlog_file = "/__w/dxos/dxos/packages/core/assistant/src/conversation/conversation.ts";
155
- var AiConversation = class {
156
- get context() {
157
- return this._context;
158
- }
159
- get toolkit() {
160
- return this._toolkit;
161
- }
162
- async getHistory() {
163
- const queueItems = await this._queue.queryObjects();
164
- return queueItems.filter(Obj2.instanceOf(DataType.Message));
165
- }
166
- /**
167
- * Creates a new cancelable request effect.
168
- */
169
- createRequest(params) {
170
- return Effect.gen(this, function* () {
171
- const session = new AiSession();
172
- const history = yield* Effect.promise(() => this.getHistory());
173
- const context = yield* Effect.promise(() => this.context.query());
174
- const blueprints = yield* Effect.forEach(context.blueprints.values(), DatabaseService.loadOption).pipe(Effect.map(Array2.filter(Option.isSome)), Effect.map(Array2.map((option) => option.value)));
175
- const objects = yield* Effect.forEach(context.objects.values(), DatabaseService.loadOption).pipe(Effect.map(Array2.filter(Option.isSome)), Effect.map(Array2.map((option) => option.value)));
176
- const toolkit = yield* createToolkit({
177
- blueprints
178
- });
179
- this._toolkit = toolkit;
180
- const start = Date.now();
181
- log("run", {
182
- history: history.length,
183
- blueprints: blueprints.length,
184
- objects: objects.length,
185
- tools: this._toolkit?.tools.length ?? 0
186
- }, {
187
- F: __dxlog_file,
188
- L: 102,
189
- S: this,
190
- C: (f, a) => f(...a)
191
- });
192
- const messages = yield* session.run({
193
- history,
194
- blueprints,
195
- objects,
196
- toolkit,
197
- ...params
198
- }).pipe(Effect.provideService(AiContextService, {
199
- binder: this.context
200
- }));
201
- log("result", {
202
- messages: messages.length,
203
- duration: Date.now() - start
204
- }, {
205
- F: __dxlog_file,
206
- L: 116,
207
- S: this,
208
- C: (f, a) => f(...a)
209
- });
210
- yield* Effect.promise(() => this._queue.append(messages));
211
- return messages;
212
- }).pipe(Effect.withSpan("AiConversation.request"));
213
- }
214
- constructor(options) {
215
- _define_property2(this, "_queue", void 0);
216
- _define_property2(this, "_context", void 0);
217
- _define_property2(this, "_toolkit", void 0);
218
- this._queue = options.queue;
219
- this._context = new AiContextBinder(this._queue);
220
- }
221
- };
222
-
223
- // src/diff.ts
224
- import { next as A } from "@automerge/automerge";
225
- import { DocAccessor, toCursorRange } from "@dxos/echo-db";
226
- import { log as log2 } from "@dxos/log";
227
- import { isNonNullable } from "@dxos/util";
228
- var __dxlog_file2 = "/__w/dxos/dxos/packages/core/assistant/src/diff.ts";
229
- var reduceDiffs = (diffs) => {
230
- return diffs.reduce((acc, diff) => {
231
- const current = acc[acc.length - 1];
232
- const [op, ...rest] = diff.split(" ");
233
- switch (op) {
234
- case "-": {
235
- if (current && !current.match) {
236
- current.match += rest.join(" ");
237
- } else {
238
- acc.push({
239
- match: rest.join(" "),
240
- replace: ""
241
- });
242
- }
243
- return acc;
244
- }
245
- case "+": {
246
- if (current && !current.replace) {
247
- current.replace += rest.join(" ");
248
- } else {
249
- acc.push({
250
- match: "",
251
- replace: rest.join(" ")
252
- });
253
- }
254
- return acc;
255
- }
256
- }
257
- return acc;
258
- }, []);
259
- };
260
- var computeDiffsWithCursors = (accessor, diffs) => {
261
- return reduceDiffs(diffs).map((diff) => {
262
- const text = DocAccessor.getValue(accessor);
263
- const idx = text.indexOf(diff.match);
264
- if (idx !== -1) {
265
- return {
266
- cursor: toCursorRange(accessor, idx, idx + diff.match.length),
267
- text: diff.replace
268
- };
269
- }
270
- }).filter(isNonNullable);
271
- };
272
- var applyDiffs = (accessor, diffs) => {
273
- for (const diff of reduceDiffs(diffs)) {
274
- accessor.handle.change((doc) => {
275
- const text = DocAccessor.getValue(accessor);
276
- const idx = text.indexOf(diff.match);
277
- if (idx !== -1) {
278
- A.splice(doc, accessor.path, idx, diff.match.length, diff.replace);
279
- } else {
280
- log2.warn("diff not found", diff, {
281
- F: __dxlog_file2,
282
- L: 73,
283
- S: void 0,
284
- C: (f, a) => f(...a)
285
- });
286
- }
287
- });
288
- }
289
- return DocAccessor.getValue(accessor);
290
- };
291
-
292
- // src/functions/services.ts
293
- import { AiTool } from "@effect/ai";
294
- import { Context as Context2, Effect as Effect2, Layer, Record, Schema as Schema2 } from "effect";
295
- import { AiToolNotFoundError, ToolExecutionService, ToolResolverService } from "@dxos/ai";
296
- import { todo } from "@dxos/debug";
297
- import { LocalFunctionExecutionService } from "@dxos/functions";
298
- import { invariant } from "@dxos/invariant";
299
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/assistant/src/functions/services.ts";
300
- var makeToolResolverFromFunctions = (functions, toolkit) => {
301
- return Layer.succeed(ToolResolverService, {
302
- resolve: Effect2.fn("resolveTool")(function* (id) {
303
- const tool = toolkit.tools[id];
304
- if (tool) {
305
- return tool;
306
- }
307
- const functionDef = functions.find((fn) => fn.name === id);
308
- if (!functionDef) {
309
- return yield* Effect2.fail(new AiToolNotFoundError(id));
310
- }
311
- return projectFunctionToTool(functionDef);
312
- })
313
- });
314
- };
315
- var makeToolExecutionServiceFromFunctions = (functions, toolkit, handlersLayer) => {
316
- return Layer.effect(ToolExecutionService, Effect2.gen(function* () {
317
- const toolkitHandler = yield* toolkit.pipe(Effect2.provide(handlersLayer));
318
- const localFunctionExecutionService = yield* LocalFunctionExecutionService;
319
- return {
320
- handlersFor: (toolkit2) => {
321
- const makeHandler = (tool) => {
322
- return Effect2.fn("toolFunctionHandler")(function* (input) {
323
- if (toolkitHandler.tools.find((t) => t.name === tool.name)) {
324
- return yield* toolkitHandler.handle(tool.name, input);
325
- }
326
- const { functionName } = Context2.get(FunctionToolAnnotation)(tool.annotations);
327
- const functionDef = functions.find((fn) => fn.name === functionName);
328
- if (!functionDef) {
329
- return yield* Effect2.fail(new AiToolNotFoundError(tool.name));
330
- }
331
- return yield* localFunctionExecutionService.invokeFunction(functionDef, input).pipe(Effect2.catchAllDefect((defect) => Effect2.fail(defect)));
332
- });
333
- };
334
- return toolkit2.of(Record.map(toolkit2.tools, (tool, _name) => makeHandler(tool)));
335
- }
336
- };
337
- }));
338
- };
339
- var FunctionToolAnnotation = class extends Context2.Tag("@dxos/assisatnt/FunctionToolAnnotation")() {
340
- };
341
- var toolCache = /* @__PURE__ */ new WeakMap();
342
- var projectFunctionToTool = (fn) => {
343
- if (toolCache.has(fn)) {
344
- return toolCache.get(fn);
345
- }
346
- const tool = AiTool.make(makeToolName(fn.name), {
347
- description: fn.description,
348
- parameters: createStructFieldsFromSchema(fn.inputSchema),
349
- // TODO(dmaretskyi): Include output schema.
350
- failure: Schema2.Any
351
- }).annotate(FunctionToolAnnotation, {
352
- functionName: fn.name
353
- });
354
- toolCache.set(fn, tool);
355
- return tool;
356
- };
357
- var makeToolName = (name) => {
358
- const toolName = name.replace(/[^a-zA-Z0-9]/g, "_");
359
- invariant(toolName.match(/^[a-zA-Z_][a-zA-Z0-9-_]*$/), void 0, {
360
- F: __dxlog_file3,
361
- L: 105,
362
- S: void 0,
363
- A: [
364
- "toolName.match(/^[a-zA-Z_][a-zA-Z0-9-_]*$/)",
365
- ""
366
- ]
367
- });
368
- return toolName;
369
- };
370
- var createStructFieldsFromSchema = (schema) => {
371
- switch (schema.ast._tag) {
372
- case "TypeLiteral":
373
- return Object.fromEntries(schema.ast.propertySignatures.map((prop) => [
374
- prop.name,
375
- Schema2.make(prop.type)
376
- ]));
377
- case "VoidKeyword":
378
- return {};
379
- default:
380
- return todo(`Unsupported schema AST: ${schema.ast._tag}`);
381
- }
382
- };
383
-
384
- // src/templates/system.ts
385
- import defaultsDeep from "lodash.defaultsdeep";
386
- import { Template } from "@dxos/blueprints";
387
-
388
- // raw-loader:./format.tpl?raw
389
- var format_default = "{{! System Core }}\n\n## Input Formats\n\n### Blueprints\n\nYou may be provided with Blueprint definitions that include specific instructions and tools for a given set of tasks.\nBlue print instructions will be enclosed in a <blueprint> tag.\n\n### Context objects\n\nYou may be provided with references to objects that are relevant to the current prompt.\nObjects will be in the form of a <object> tag with a <dxn> element that is the unique key of the object required by many tools.\nThe <typename> element is the type of the object.\n\n<object>\n <dxn>object-id</dxn>\n <typename>example.com/type/TypeName</typename>\n</object>\n\n## Response Formats\n\nIt is very important to respond in the correct format.\nYou response must be valid Markdown.\nIn some cases you should respond with well-formed XML tags along with the content.\nCode snippets should use 2-space indents.\n\n{{#if cot}}\nBefore responding, explain your reasoning and include your detailed chain-of-thought enclosed in a <cot> tag.\nThe <cot> tag should be the first thing in your response.\n{{/if}}\n\n## Block references\n\nYou can reply with a block reference for objects if you have the DXN. For example:\n\n<object>\n <dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n<object>\n <dxn>dxn:echo:@:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n\n### Suggestions\n\nEach suggestion must in the form of a proposed action enclosed in a <suggestion> tag.\nExample: <suggestion>Show on a map</suggestion>\n\n### Multiple choice questions\n\nYou may ask multiple choice questions by wrapping consise options inside <option> tags inside a well formed <select> tag.\nExample: <select><option>Yes</option><option>No</option></select>\n\n## Toolkit\n\nIf the user asks for a list of tools, then just emit a single self-closing <toolkit/> tag instead of listing the tools.\n\n## Context\n\nThe current date and time is {{DATETIME}}.\n";
390
-
391
- // raw-loader:./system.tpl?raw
392
- var system_default = "{{! System Prompt }}\n\nYou are a helpful assistant called Kai. \nYour name is Kai and you are powered by different language models.\nYou were created by DXOS and operate in Composer and on the DXOS EDGE network.\nIn your initial greeting state your name and make some suggestions based on the current context objects.\n\nYou are an advanced AI assistant capable of creating and managing artifacts from provided data and tools.\nYour task is to process user commands and questions and decide how best to respond.\nIn general be concise and direct.\n\nFollow these instructions carefully.\n\n## Include the following steps\n\n- Analyze the structure and type of the content in the user's message.\n- Determine if you complete the task using the available blueprint definitions?\n- If you can't complete the task using the available blueprint definitions, query the list of available blueprint definitions using the appropriate tool.\n- Identify which blueprint definitions are relevant to the user's request.\n- Evaluate the potential benefits of creating an artifact vs. normal processing for each identified element.\n- Make a final decision on whether to create an artifact and explain your reasoning.\n- Are the required blueprint definitions already available?\n- If not, select which blueprint definition(s) will be the most relevant and require them using the require_artifact_definitions tool.\n- The require'd artifact tools will be available for use after require.\n- If creating an artifact, outline how you will structure it within the response.\n- Decide if the artifact needs to be shown to the user.\n- Call the show tool to show the artifact to the user.\n- Your reasoning must include: whether to use artifacts or not, to create one or query, whether to show the artifact to the user, and how to structure the response.\n\n## Blueprints\n\n- Determine if the interaction involves an artifact. Prefer artifacts for tables, lists, spreadsheets, kanbans, games, images, and other structured data.\n- Determine if the user is explicitly talking about creating a new artifact, or wants to use an existing artifact.\n- If it is ambiguous, query for existing artifacts first and then decide.\n- If you decide to create an artifact, call the associated tool to create the artifact.\n- Artifacts are stored in the database. Tools are used to create and query artifacts.\n- If you are unsure about creating an artifact ask the user for clarification.\n- Artifacts are mutable objects that can change over the course of the conversation.\n- Always re-query the artifact using the tool (like query or inspect) to get the latest state of the artifact before answering the user.\n- You must never generate the id of the artifact; only recall the ids that are already in the history.\n- Artifacts are created by requiring the specific artifact using the require_artifact tool and creating it by calling the associated tool.\n- You can add suggested actions at the end of your response.\n- Suggested actions should be very concise and start with a verb and be phrased as a command to an agent -- not a question to the user.\n- Suggested actions must be in the form of a user instruction that you can follow.\n- Suggested actions could include actions that create artifacts.\n- After creating an artifact use a tool to add it to the chat context.\n\n## Context\n\nToday is {{DATETIME}}.\n";
393
-
394
- // src/templates/system.ts
395
- var createSystemPrompt = (options = {}) => Template.process(format_default, defaultsDeep(options, {
396
- DATETIME: (/* @__PURE__ */ new Date()).toISOString()
397
- }));
398
- var templates = {
399
- /** Editable system prompt.*/
400
- system: Template.make({
401
- /**
402
- * NOTE: We are forbidden from accessing randomness at model level in cloudflare, so we have to have pre-generated ids.
403
- */
404
- id: "01K2J2FZWH39F55CS7B26GP1Q3",
405
- source: system_default
406
- })
407
- };
408
-
409
- // src/types.ts
410
- import { Schema as Schema3 } from "effect";
411
- import { DXN as DXN2, LOCAL_SPACE_TAG } from "@dxos/keys";
412
- import { trim } from "@dxos/util";
413
- var createArtifactElement = (id) => `<artifact id=${id} />`;
414
- var ArtifactId = class extends Schema3.String.annotations({
415
- description: trim`
416
- The ID of the referenced object. Formats accepted:
417
- - DXN (dxn:echo:@:XXXXX). DXNs can be prepended with an @ symbol for compatibility with in-text references.
418
- - space ID, object ID tuple (spaceID:objectID)
419
- - Only object ID that is assumed to be in the current space (XXXXX)
420
- `,
421
- examples: [
422
- "dxn:echo:@:XXXXX",
423
- "@dxn:echo:@:XXXXX",
424
- "spaceID:objectID",
425
- "XXXXX"
426
- ]
427
- }) {
428
- static toDXN(reference, owningSpaceId) {
429
- if (reference.startsWith("@dxn:")) {
430
- return DXN2.parse(reference.slice(1));
431
- } else if (reference.startsWith("dxn:")) {
432
- return DXN2.parse(reference);
433
- } else if (/^[A-Z0-9]+:[A-Z0-9]+$/.test(reference)) {
434
- const [spaceId, objectId] = reference.split(":");
435
- return new DXN2(DXN2.kind.ECHO, [
436
- spaceId === owningSpaceId ? LOCAL_SPACE_TAG : spaceId,
437
- objectId
438
- ]);
439
- } else if (/^[A-Z0-9]+$/.test(reference)) {
440
- return DXN2.fromLocalObjectId(reference);
441
- } else {
442
- throw new Error(`Unable to parse object reference: ${reference}`);
443
- }
444
- }
445
- };
446
- export {
447
- AiAssistantError,
448
- AiContextBinder,
449
- AiContextService,
450
- AiConversation,
451
- AiSession,
452
- AnthropicError,
453
- ArtifactDiffResolver,
454
- ArtifactId,
455
- Bindings,
456
- ContextBinding,
457
- GenerationObserver,
458
- VersionPin,
459
- applyDiffs,
460
- computeDiffsWithCursors,
461
- createArtifactElement,
462
- createSystemPrompt,
463
- createToolkit,
464
- makeToolExecutionServiceFromFunctions,
465
- makeToolResolverFromFunctions,
466
- reduceDiffs,
467
- templates
468
- };
469
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/conversation/context.ts", "../../../src/conversation/conversation.ts", "../../../src/diff.ts", "../../../src/functions/services.ts", "../../../src/templates/system.ts", "raw-loader:./format.tpl?raw", "raw-loader:./system.tpl?raw", "../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ReadonlySignal, computed } from '@preact/signals-core';\nimport { Context, Schema } from 'effect';\nimport { Array, pipe } from 'effect';\n\nimport { Blueprint } from '@dxos/blueprints';\nimport { DXN, Obj, type Ref, type Relation, Type } from '@dxos/echo';\nimport { type Queue } from '@dxos/echo-db';\nimport { ComplexSet } from '@dxos/util';\n\n/**\n * Thread message that binds or unbinds contextual objects to a conversation.\n */\n// TODO(burdon): Move to @dxos/schema ContentBlock?\nexport const ContextBinding = Schema.Struct({\n blueprints: Schema.Struct({\n added: Schema.Array(Type.Ref(Blueprint.Blueprint)),\n removed: Schema.Array(Type.Ref(Blueprint.Blueprint)),\n }),\n\n // TODO(burdon): Type.Expando => Type.Obj (or Obj.Any?)\n objects: Schema.Struct({\n added: Schema.Array(Type.Ref(Type.Expando)),\n removed: Schema.Array(Type.Ref(Type.Expando)),\n }),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/ContextBinding',\n version: '0.1.0',\n }),\n);\n\nexport interface ContextBinding extends Schema.Schema.Type<typeof ContextBinding> {}\n\nexport type BindingProps = Partial<{\n blueprints: Ref.Ref<Blueprint.Blueprint>[];\n objects: Ref.Ref<Type.Expando>[];\n}>;\n\nexport class Bindings {\n readonly blueprints = new ComplexSet<Ref.Ref<Blueprint.Blueprint>>((ref) => ref.dxn.toString());\n // TODO(burdon): Some DXNs have the Space prefix so only compare the object ID.\n readonly objects = new ComplexSet<Ref.Ref<Type.Expando>>((ref) => ref.dxn.asEchoDXN()?.echoId);\n\n toJSON() {\n return {\n blueprints: Array.fromIterable(this.blueprints).map((ref) => ref.dxn.toString()),\n objects: Array.fromIterable(this.objects).map((ref) => ref.dxn.toString()),\n };\n }\n}\n\n/**\n * Manages bindings of blueprints and objects to a conversation.\n */\n// TODO(burdon): Context should manage ephemeral state of bindings until prompt is issued?\nexport class AiContextBinder {\n /**\n * Reactive query of all bindings.\n */\n // TODO(burdon): Cache value?\n readonly bindings: ReadonlySignal<Bindings> = computed(() => this._reduce(this._queue.objects));\n\n readonly blueprints: ReadonlySignal<Ref.Ref<Blueprint.Blueprint>[]> = computed(() => [\n ...this.bindings.value.blueprints,\n ]);\n\n readonly objects: ReadonlySignal<Ref.Ref<Type.Expando>[]> = computed(() => [...this.bindings.value.objects]);\n\n constructor(private readonly _queue: Queue) {}\n\n /**\n * Asynchronous query of all bindings.\n */\n async query(): Promise<Bindings> {\n const queueItems = await this._queue.queryObjects();\n return this._reduce(queueItems);\n }\n\n // TODO(burdon): Pass in Blueprint obj (from registry?) and create reference.\n async bind(props: BindingProps): Promise<void> {\n if (!props.blueprints?.length && !props.objects?.length) {\n return;\n }\n\n const blueprints =\n props.blueprints?.filter((ref) => !this.blueprints.peek().find((b) => b.dxn.toString() === ref.dxn.toString())) ??\n [];\n const objects =\n props.objects?.filter((ref) => !this.objects.peek().find((o) => o.dxn.toString() === ref.dxn.toString())) ?? [];\n\n await this._queue.append([\n Obj.make(ContextBinding, {\n blueprints: {\n added: blueprints,\n removed: [],\n },\n objects: {\n added: objects,\n removed: [],\n },\n }),\n ]);\n }\n\n async unbind(props: BindingProps): Promise<void> {\n if (!props.blueprints?.length && !props.objects?.length) {\n return;\n }\n\n await this._queue.append([\n Obj.make(ContextBinding, {\n blueprints: {\n added: [],\n removed: props.blueprints ?? [],\n },\n objects: {\n added: [],\n removed: props.objects ?? [],\n },\n }),\n ]);\n }\n\n private _reduce(items: (Obj.Any | Relation.Any)[]): Bindings {\n return pipe(\n items,\n Array.filter(Obj.instanceOf(ContextBinding)),\n Array.reduce(new Bindings(), (context, item) => {\n item.blueprints.removed.forEach((ref) => context.blueprints.delete(ref));\n item.blueprints.added.forEach((ref) => context.blueprints.add(ref));\n item.objects.removed.forEach((ref) => {\n for (const obj of context.objects) {\n if (DXN.equalsEchoId(obj.dxn, ref.dxn)) {\n context.objects.delete(obj);\n }\n }\n });\n item.objects.added.forEach((ref) => context.objects.add(ref));\n return context;\n }),\n );\n }\n}\n\nexport class AiContextService extends Context.Tag('@dxos/assistant/AiContextService')<\n AiContextService,\n {\n binder: AiContextBinder;\n }\n>() {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type AiTool, type AiToolkit } from '@effect/ai';\nimport { Array, Effect, Option } from 'effect';\n\nimport { Obj } from '@dxos/echo';\nimport { type Queue } from '@dxos/echo-db';\nimport { DatabaseService } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { DataType } from '@dxos/schema';\n\nimport {\n AiSession,\n type AiSessionRunError,\n type AiSessionRunRequirements,\n type GenerationObserver,\n createToolkit,\n} from '../session';\n\nimport { AiContextBinder, AiContextService, type ContextBinding } from './context';\n\nexport type AiConversationRunRequirements<Tools extends AiTool.Any> =\n | AiSessionRunRequirements\n | AiTool.ToHandler<Tools>;\n\nexport interface AiConversationRunParams {\n prompt: string;\n system?: string;\n observer?: GenerationObserver;\n}\n\nexport type AiConversationOptions = {\n queue: Queue<DataType.Message | ContextBinding>;\n};\n\n/**\n * Durable conversation state (initiated by users and agents) backed by a Queue.\n * Executes tools based on AI responses and supports cancellation of in-progress requests.\n */\nexport class AiConversation {\n /**\n * Message and binding queue.\n */\n private readonly _queue: Queue<DataType.Message | ContextBinding>;\n\n /**\n * Blueprints bound to the conversation.\n */\n private readonly _context: AiContextBinder;\n\n /**\n * Toolkit from the current session request.\n */\n private _toolkit: AiToolkit.ToHandler<AiTool.Any> | undefined;\n\n public constructor(options: AiConversationOptions) {\n this._queue = options.queue;\n this._context = new AiContextBinder(this._queue);\n }\n\n public get context() {\n return this._context;\n }\n\n public get toolkit() {\n return this._toolkit;\n }\n\n public async getHistory(): Promise<DataType.Message[]> {\n const queueItems = await this._queue.queryObjects();\n return queueItems.filter(Obj.instanceOf(DataType.Message));\n }\n\n /**\n * Creates a new cancelable request effect.\n */\n createRequest<Tools extends AiTool.Any>(\n params: AiConversationRunParams,\n ): Effect.Effect<DataType.Message[], AiSessionRunError, AiConversationRunRequirements<Tools>> {\n return Effect.gen(this, function* () {\n const session = new AiSession();\n const history = yield* Effect.promise(() => this.getHistory());\n\n // Get context objects.\n const context = yield* Effect.promise(() => this.context.query());\n const blueprints = yield* Effect.forEach(context.blueprints.values(), DatabaseService.loadOption).pipe(\n Effect.map(Array.filter(Option.isSome)),\n Effect.map(Array.map((option) => option.value)),\n );\n const objects = yield* Effect.forEach(context.objects.values(), DatabaseService.loadOption).pipe(\n Effect.map(Array.filter(Option.isSome)),\n Effect.map(Array.map((option) => option.value)),\n );\n\n // Create toolkit.\n const toolkit = yield* createToolkit<Tools>({ blueprints });\n this._toolkit = toolkit;\n\n const start = Date.now();\n log('run', {\n history: history.length,\n blueprints: blueprints.length,\n objects: objects.length,\n tools: this._toolkit?.tools.length ?? 0,\n });\n\n // Process request.\n const messages = yield* session.run<Tools>({ history, blueprints, objects, toolkit, ...params }).pipe(\n Effect.provideService(AiContextService, {\n binder: this.context,\n }),\n );\n\n log('result', { messages: messages.length, duration: Date.now() - start });\n\n // Append to queue.\n yield* Effect.promise(() => this._queue.append(messages));\n return messages;\n }).pipe(Effect.withSpan('AiConversation.request'));\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { next as A, type Doc } from '@automerge/automerge';\n\nimport { DocAccessor, toCursorRange } from '@dxos/echo-db';\nimport { log } from '@dxos/log';\nimport { isNonNullable } from '@dxos/util';\n\n// Relevant info:\n// https://github.com/Minahil-official/GPT-4.1-Promting-Guide?tab=readme-ov-file#-apply-patch-tool-format-v4a-diff\n\n// TOOD(burdon): Support append to end (no \"-\").\n\nexport type Diff = {\n match: string;\n replace: string;\n};\n\n/**\n * Convert a list of diffs into a list of operations.\n */\nexport const reduceDiffs = (diffs: readonly string[]): Diff[] => {\n return diffs.reduce<Diff[]>((acc, diff) => {\n const current = acc[acc.length - 1];\n const [op, ...rest] = diff.split(' ');\n switch (op) {\n case '-': {\n if (current && !current.match) {\n current.match += rest.join(' ');\n } else {\n acc.push({ match: rest.join(' '), replace: '' });\n }\n return acc;\n }\n case '+': {\n if (current && !current.replace) {\n current.replace += rest.join(' ');\n } else {\n acc.push({ match: '', replace: rest.join(' ') });\n }\n return acc;\n }\n }\n\n return acc;\n }, []);\n};\n\nexport const computeDiffsWithCursors = <T>(accessor: DocAccessor<T>, diffs: readonly string[]) => {\n return reduceDiffs(diffs)\n .map((diff) => {\n const text = DocAccessor.getValue<string>(accessor);\n const idx = text.indexOf(diff.match);\n if (idx !== -1) {\n return { cursor: toCursorRange(accessor, idx, idx + diff.match.length), text: diff.replace };\n }\n })\n .filter(isNonNullable);\n};\n\nexport const applyDiffs = <T>(accessor: DocAccessor<T>, diffs: readonly string[]): string => {\n for (const diff of reduceDiffs(diffs)) {\n accessor.handle.change((doc: Doc<T>) => {\n const text = DocAccessor.getValue<string>(accessor);\n const idx = text.indexOf(diff.match);\n if (idx !== -1) {\n // TODO(burdon): Replace smallest substring.\n // NOTE: This only replaces the first match.\n A.splice(doc, accessor.path as A.Prop[], idx, diff.match.length, diff.replace);\n } else {\n log.warn('diff not found', diff);\n }\n });\n }\n\n return DocAccessor.getValue<string>(accessor);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { AiTool, type AiToolkit } from '@effect/ai';\nimport { Context, Effect, Layer, Record, Schema } from 'effect';\n\nimport { AiToolNotFoundError, ToolExecutionService, ToolResolverService } from '@dxos/ai';\nimport { todo } from '@dxos/debug';\nimport { type FunctionDefinition, LocalFunctionExecutionService } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\n\nexport const makeToolResolverFromFunctions = (\n functions: FunctionDefinition<any, any>[],\n toolkit: AiToolkit.Any,\n): Layer.Layer<ToolResolverService> => {\n return Layer.succeed(ToolResolverService, {\n resolve: Effect.fn('resolveTool')(function* (id) {\n const tool = toolkit.tools[id];\n if (tool) {\n return tool;\n }\n\n const functionDef = functions.find((fn) => fn.name === id);\n if (!functionDef) {\n return yield* Effect.fail(new AiToolNotFoundError(id));\n }\n\n return projectFunctionToTool(functionDef);\n }),\n });\n};\n\nexport const makeToolExecutionServiceFromFunctions = (\n functions: FunctionDefinition<any, any>[],\n toolkit: AiToolkit.AiToolkit<AiTool.Any>,\n handlersLayer: Layer.Layer<AiTool.ToHandler<AiTool.AiTool<any>>, never, never>,\n): Layer.Layer<ToolExecutionService, never, LocalFunctionExecutionService> => {\n return Layer.effect(\n ToolExecutionService,\n Effect.gen(function* () {\n const toolkitHandler = yield* toolkit.pipe(Effect.provide(handlersLayer));\n const localFunctionExecutionService = yield* LocalFunctionExecutionService;\n\n return {\n handlersFor: (toolkit) => {\n const makeHandler = (tool: AiTool.Any): ((params: unknown) => Effect.Effect<unknown, any, any>) => {\n return Effect.fn('toolFunctionHandler')(function* (input: any) {\n if (toolkitHandler.tools.find((t: AiTool.Any) => t.name === tool.name)) {\n // TODO(wittjosiah): Everything is `never` here.\n return yield* (toolkitHandler.handle as any)(tool.name, input);\n }\n\n const { functionName } = Context.get(FunctionToolAnnotation)(tool.annotations as any);\n const functionDef = functions.find((fn) => fn.name === functionName);\n if (!functionDef) {\n return yield* Effect.fail(new AiToolNotFoundError(tool.name));\n }\n\n return yield* localFunctionExecutionService\n .invokeFunction(functionDef, input)\n .pipe(Effect.catchAllDefect((defect) => Effect.fail(defect)));\n });\n };\n\n return toolkit.of(Record.map(toolkit.tools, (tool, _name) => makeHandler(tool)) as any) as any;\n },\n };\n }),\n );\n};\n\n/**\n * Tools that are projected from functions have this annotation.\n */\nclass FunctionToolAnnotation extends Context.Tag('@dxos/assisatnt/FunctionToolAnnotation')<\n FunctionToolAnnotation,\n {\n functionName: string;\n }\n>() {}\n\nconst toolCache = new WeakMap<FunctionDefinition<any, any>, AiTool.Any>();\n\nconst projectFunctionToTool = (fn: FunctionDefinition<any, any>): AiTool.Any => {\n if (toolCache.has(fn)) {\n return toolCache.get(fn)!;\n }\n\n const tool = AiTool.make(makeToolName(fn.name), {\n description: fn.description,\n parameters: createStructFieldsFromSchema(fn.inputSchema),\n // TODO(dmaretskyi): Include output schema.\n failure: Schema.Any, // TODO(dmaretskyi): Better type for the failure?\n }).annotate(FunctionToolAnnotation, { functionName: fn.name });\n toolCache.set(fn, tool);\n return tool;\n};\n\n/**\n * @returns Tool name produced from function name by escaping invalid characters.\n */\nconst makeToolName = (name: string) => {\n const toolName = name.replace(/[^a-zA-Z0-9]/g, '_');\n invariant(toolName.match(/^[a-zA-Z_][a-zA-Z0-9-_]*$/));\n return toolName;\n};\n\n// TODO(dmaretskyi): Factor out.\nconst createStructFieldsFromSchema = (schema: Schema.Schema<any, any>): Record<string, Schema.Schema<any, any>> => {\n switch (schema.ast._tag) {\n case 'TypeLiteral':\n return Object.fromEntries(schema.ast.propertySignatures.map((prop) => [prop.name, Schema.make(prop.type)]));\n case 'VoidKeyword':\n return {};\n default:\n return todo(`Unsupported schema AST: ${schema.ast._tag}`);\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { type ModelCapabilities } from '@dxos/ai';\nimport { Template } from '@dxos/blueprints';\n\nimport FORMAT from './format.tpl?raw';\nimport SYSTEM from './system.tpl?raw';\n\n/**\n * System template variables.\n */\nexport type SystemPromptOptions = ModelCapabilities & {\n DATETIME: string;\n};\n\n/**\n * Base system prompt.\n * NOTE: This contains protocol instructions that can not be dynamically edited.\n */\nexport const createSystemPrompt = (options: Partial<SystemPromptOptions> = {}) =>\n Template.process<SystemPromptOptions>(\n FORMAT,\n defaultsDeep(options, {\n DATETIME: new Date().toISOString(),\n }),\n );\n\nexport const templates = {\n /** Editable system prompt.*/\n system: Template.make({\n /**\n * NOTE: We are forbidden from accessing randomness at model level in cloudflare, so we have to have pre-generated ids.\n */\n id: '01K2J2FZWH39F55CS7B26GP1Q3',\n source: SYSTEM,\n }),\n};\n", "{{! System Core }}\n\n## Input Formats\n\n### Blueprints\n\nYou may be provided with Blueprint definitions that include specific instructions and tools for a given set of tasks.\nBlue print instructions will be enclosed in a <blueprint> tag.\n\n### Context objects\n\nYou may be provided with references to objects that are relevant to the current prompt.\nObjects will be in the form of a <object> tag with a <dxn> element that is the unique key of the object required by many tools.\nThe <typename> element is the type of the object.\n\n<object>\n <dxn>object-id</dxn>\n <typename>example.com/type/TypeName</typename>\n</object>\n\n## Response Formats\n\nIt is very important to respond in the correct format.\nYou response must be valid Markdown.\nIn some cases you should respond with well-formed XML tags along with the content.\nCode snippets should use 2-space indents.\n\n{{#if cot}}\nBefore responding, explain your reasoning and include your detailed chain-of-thought enclosed in a <cot> tag.\nThe <cot> tag should be the first thing in your response.\n{{/if}}\n\n## Block references\n\nYou can reply with a block reference for objects if you have the DXN. For example:\n\n<object>\n <dxn>dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n<object>\n <dxn>dxn:echo:@:01K24XPK464FSCKVQJAB2H662M</dxn>\n</object>\n\n### Suggestions\n\nEach suggestion must in the form of a proposed action enclosed in a <suggestion> tag.\nExample: <suggestion>Show on a map</suggestion>\n\n### Multiple choice questions\n\nYou may ask multiple choice questions by wrapping consise options inside <option> tags inside a well formed <select> tag.\nExample: <select><option>Yes</option><option>No</option></select>\n\n## Toolkit\n\nIf the user asks for a list of tools, then just emit a single self-closing <toolkit/> tag instead of listing the tools.\n\n## Context\n\nThe current date and time is {{DATETIME}}.\n", "{{! System Prompt }}\n\nYou are a helpful assistant called Kai. \nYour name is Kai and you are powered by different language models.\nYou were created by DXOS and operate in Composer and on the DXOS EDGE network.\nIn your initial greeting state your name and make some suggestions based on the current context objects.\n\nYou are an advanced AI assistant capable of creating and managing artifacts from provided data and tools.\nYour task is to process user commands and questions and decide how best to respond.\nIn general be concise and direct.\n\nFollow these instructions carefully.\n\n## Include the following steps\n\n- Analyze the structure and type of the content in the user's message.\n- Determine if you complete the task using the available blueprint definitions?\n- If you can't complete the task using the available blueprint definitions, query the list of available blueprint definitions using the appropriate tool.\n- Identify which blueprint definitions are relevant to the user's request.\n- Evaluate the potential benefits of creating an artifact vs. normal processing for each identified element.\n- Make a final decision on whether to create an artifact and explain your reasoning.\n- Are the required blueprint definitions already available?\n- If not, select which blueprint definition(s) will be the most relevant and require them using the require_artifact_definitions tool.\n- The require'd artifact tools will be available for use after require.\n- If creating an artifact, outline how you will structure it within the response.\n- Decide if the artifact needs to be shown to the user.\n- Call the show tool to show the artifact to the user.\n- Your reasoning must include: whether to use artifacts or not, to create one or query, whether to show the artifact to the user, and how to structure the response.\n\n## Blueprints\n\n- Determine if the interaction involves an artifact. Prefer artifacts for tables, lists, spreadsheets, kanbans, games, images, and other structured data.\n- Determine if the user is explicitly talking about creating a new artifact, or wants to use an existing artifact.\n- If it is ambiguous, query for existing artifacts first and then decide.\n- If you decide to create an artifact, call the associated tool to create the artifact.\n- Artifacts are stored in the database. Tools are used to create and query artifacts.\n- If you are unsure about creating an artifact ask the user for clarification.\n- Artifacts are mutable objects that can change over the course of the conversation.\n- Always re-query the artifact using the tool (like query or inspect) to get the latest state of the artifact before answering the user.\n- You must never generate the id of the artifact; only recall the ids that are already in the history.\n- Artifacts are created by requiring the specific artifact using the require_artifact tool and creating it by calling the associated tool.\n- You can add suggested actions at the end of your response.\n- Suggested actions should be very concise and start with a verb and be phrased as a command to an agent -- not a question to the user.\n- Suggested actions must be in the form of a user instruction that you can follow.\n- Suggested actions could include actions that create artifacts.\n- After creating an artifact use a tool to add it to the chat context.\n\n## Context\n\nToday is {{DATETIME}}.\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { type ObjectId } from '@dxos/echo-schema';\nimport { DXN, LOCAL_SPACE_TAG, type SpaceId } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\n/**\n * @deprecated\n */\nexport const createArtifactElement = (id: ObjectId) => `<artifact id=${id} />`;\n\n/**\n * A model-friendly way to reference an object.\n * Supports vairous formats that will be normalized to a DXN.\n */\n// TODO(burdon): Rename ObjectReference?\nexport const ArtifactId: Schema.Schema<string> & {\n toDXN: (reference: ArtifactId, owningSpaceId?: SpaceId) => DXN;\n} = class extends Schema.String.annotations({\n description: trim`\n The ID of the referenced object. Formats accepted:\n - DXN (dxn:echo:@:XXXXX). DXNs can be prepended with an @ symbol for compatibility with in-text references.\n - space ID, object ID tuple (spaceID:objectID)\n - Only object ID that is assumed to be in the current space (XXXXX)\n `,\n examples: ['dxn:echo:@:XXXXX', '@dxn:echo:@:XXXXX', 'spaceID:objectID', 'XXXXX'],\n}) {\n static toDXN(reference: ArtifactId, owningSpaceId?: SpaceId): DXN {\n // Allow @dxn: prefix for compatibility with in-text references.\n if (reference.startsWith('@dxn:')) {\n return DXN.parse(reference.slice(1));\n } else if (reference.startsWith('dxn:')) {\n return DXN.parse(reference);\n } else if (/^[A-Z0-9]+:[A-Z0-9]+$/.test(reference)) {\n const [spaceId, objectId] = reference.split(':');\n // This is a workaround because the current Filter API doesn't work with fully qualified Echo DXNs.\n // We check if the space ID is the same as the owning space and then use LOCAL_SPACE_TAG for local references.\n // TODO(dmaretskyi): Fix this in the Echo and Filter API to properly handle fully qualified DXNs.\n return new DXN(DXN.kind.ECHO, [spaceId === owningSpaceId ? LOCAL_SPACE_TAG : spaceId, objectId]);\n } else if (/^[A-Z0-9]+$/.test(reference)) {\n return DXN.fromLocalObjectId(reference);\n } else {\n throw new Error(`Unable to parse object reference: ${reference}`);\n }\n }\n};\n\nexport type ArtifactId = Schema.Schema.Type<typeof ArtifactId>;\n"],
5
- "mappings": ";;;;;;;;;;;AAIA,SAA8BA,gBAAgB;AAC9C,SAASC,SAASC,cAAc;AAChC,SAASC,OAAOC,YAAY;AAE5B,SAASC,iBAAiB;AAC1B,SAASC,KAAKC,KAA8BC,YAAY;AAExD,SAASC,kBAAkB;;;;;;;;;;;;;;AAMpB,IAAMC,iBAAiBC,OAAOC,OAAO;EAC1CC,YAAYF,OAAOC,OAAO;IACxBE,OAAOH,OAAOI,MAAMC,KAAKC,IAAIC,UAAUA,SAAS,CAAA;IAChDC,SAASR,OAAOI,MAAMC,KAAKC,IAAIC,UAAUA,SAAS,CAAA;EACpD,CAAA;;EAGAE,SAAST,OAAOC,OAAO;IACrBE,OAAOH,OAAOI,MAAMC,KAAKC,IAAID,KAAKK,OAAO,CAAA;IACzCF,SAASR,OAAOI,MAAMC,KAAKC,IAAID,KAAKK,OAAO,CAAA;EAC7C,CAAA;AACF,CAAA,EAAGC,KACDN,KAAKO,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;AAUK,IAAMC,WAAN,MAAMA;EA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,KAAKN,SAAAA,GAAY;AAClD,YAAM,CAACO,SAASC,QAAAA,IAAYR,UAAUS,MAAM,GAAA;AAI5C,aAAO,IAAIN,KAAIA,KAAIO,KAAKC,MAAM;QAACJ,YAAYN,gBAAgBW,kBAAkBL;QAASC;OAAS;IACjG,WAAW,cAAcF,KAAKN,SAAAA,GAAY;AACxC,aAAOG,KAAIU,kBAAkBb,SAAAA;IAC/B,OAAO;AACL,YAAM,IAAIc,MAAM,qCAAqCd,SAAAA,EAAW;IAClE;EACF;AACF;",
6
- "names": ["computed", "Context", "Schema", "Array", "pipe", "Blueprint", "DXN", "Obj", "Type", "ComplexSet", "ContextBinding", "Schema", "Struct", "blueprints", "added", "Array", "Type", "Ref", "Blueprint", "removed", "objects", "Expando", "pipe", "Obj", "typename", "version", "Bindings", "toJSON", "fromIterable", "map", "ref", "dxn", "toString", "ComplexSet", "asEchoDXN", "echoId", "AiContextBinder", "query", "queueItems", "_queue", "queryObjects", "_reduce", "bind", "props", "length", "filter", "peek", "find", "b", "o", "append", "make", "unbind", "items", "instanceOf", "reduce", "context", "item", "forEach", "delete", "add", "obj", "DXN", "equalsEchoId", "bindings", "computed", "value", "AiContextService", "Context", "Tag", "Array", "Effect", "Option", "Obj", "DatabaseService", "log", "DataType", "AiConversation", "context", "_context", "toolkit", "_toolkit", "getHistory", "queueItems", "_queue", "queryObjects", "filter", "Obj", "instanceOf", "DataType", "Message", "createRequest", "params", "Effect", "gen", "session", "AiSession", "history", "promise", "query", "blueprints", "forEach", "values", "DatabaseService", "loadOption", "pipe", "map", "Array", "Option", "isSome", "option", "value", "objects", "createToolkit", "start", "Date", "now", "log", "length", "tools", "messages", "run", "provideService", "AiContextService", "binder", "duration", "append", "withSpan", "options", "_define_property", "queue", "AiContextBinder", "next", "A", "DocAccessor", "toCursorRange", "log", "isNonNullable", "reduceDiffs", "diffs", "reduce", "acc", "diff", "current", "length", "op", "rest", "split", "match", "join", "push", "replace", "computeDiffsWithCursors", "accessor", "map", "text", "getValue", "idx", "indexOf", "cursor", "filter", "applyDiffs", "handle", "change", "doc", "splice", "path", "warn", "AiTool", "Context", "Effect", "Layer", "Record", "Schema", "AiToolNotFoundError", "ToolExecutionService", "ToolResolverService", "todo", "LocalFunctionExecutionService", "invariant", "makeToolResolverFromFunctions", "functions", "toolkit", "succeed", "resolve", "fn", "id", "tool", "tools", "functionDef", "find", "name", "fail", "projectFunctionToTool", "makeToolExecutionServiceFromFunctions", "handlersLayer", "effect", "gen", "toolkitHandler", "pipe", "provide", "localFunctionExecutionService", "handlersFor", "makeHandler", "input", "t", "handle", "functionName", "get", "FunctionToolAnnotation", "annotations", "invokeFunction", "catchAllDefect", "defect", "of", "map", "_name", "Tag", "toolCache", "WeakMap", "has", "make", "makeToolName", "description", "parameters", "createStructFieldsFromSchema", "inputSchema", "failure", "Any", "annotate", "set", "toolName", "replace", "match", "schema", "ast", "_tag", "Object", "fromEntries", "propertySignatures", "prop", "type", "defaultsDeep", "Template", "createSystemPrompt", "options", "Template", "process", "FORMAT", "defaultsDeep", "DATETIME", "Date", "toISOString", "templates", "system", "make", "id", "source", "SYSTEM", "Schema", "DXN", "LOCAL_SPACE_TAG", "trim", "createArtifactElement", "id", "ArtifactId", "Schema", "String", "annotations", "description", "trim", "examples", "toDXN", "reference", "owningSpaceId", "startsWith", "DXN", "parse", "slice", "test", "spaceId", "objectId", "split", "kind", "ECHO", "LOCAL_SPACE_TAG", "fromLocalObjectId", "Error"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/conversation/context.ts":{"bytes":16750,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/session/artifact-diff.ts":{"bytes":2575,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/session/observer.ts":{"bytes":5294,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/errors.ts":{"bytes":1335,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/session/error-handling.ts":{"bytes":4547,"imports":[{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"@effect/platform","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"}],"format":"esm"},"src/session/format.ts":{"bytes":16583,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/session/artifact-diff.ts","kind":"import-statement","original":"./artifact-diff"}],"format":"esm"},"src/session/session.ts":{"bytes":22852,"imports":[{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"src/session/error-handling.ts","kind":"import-statement","original":"./error-handling"},{"path":"src/session/format.ts","kind":"import-statement","original":"./format"},{"path":"src/session/observer.ts","kind":"import-statement","original":"./observer"}],"format":"esm"},"src/session/toolkit.ts":{"bytes":4171,"imports":[{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/session/version-pin.ts":{"bytes":4556,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"src/session/index.ts":{"bytes":832,"imports":[{"path":"src/session/artifact-diff.ts","kind":"import-statement","original":"./artifact-diff"},{"path":"src/session/observer.ts","kind":"import-statement","original":"./observer"},{"path":"src/session/session.ts","kind":"import-statement","original":"./session"},{"path":"src/session/toolkit.ts","kind":"import-statement","original":"./toolkit"},{"path":"src/session/version-pin.ts","kind":"import-statement","original":"./version-pin"}],"format":"esm"},"src/conversation/conversation.ts":{"bytes":12652,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"src/session/index.ts","kind":"import-statement","original":"../session"},{"path":"src/conversation/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/conversation/index.ts":{"bytes":562,"imports":[{"path":"src/conversation/context.ts","kind":"import-statement","original":"./context"},{"path":"src/conversation/conversation.ts","kind":"import-statement","original":"./conversation"}],"format":"esm"},"src/diff.ts":{"bytes":8472,"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/functions/services.ts":{"bytes":14583,"imports":[{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/functions/index.ts":{"bytes":460,"imports":[{"path":"src/functions/services.ts","kind":"import-statement","original":"./services"}],"format":"esm"},"raw-loader:./format.tpl?raw":{"bytes":1915,"imports":[]},"raw-loader:./system.tpl?raw":{"bytes":3337,"imports":[]},"src/templates/system.ts":{"bytes":3127,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"raw-loader:./format.tpl?raw","kind":"import-statement","original":"./format.tpl?raw"},{"path":"raw-loader:./system.tpl?raw","kind":"import-statement","original":"./system.tpl?raw"}],"format":"esm"},"src/templates/index.ts":{"bytes":458,"imports":[{"path":"src/templates/system.ts","kind":"import-statement","original":"./system"}],"format":"esm"},"src/types.ts":{"bytes":6867,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":974,"imports":[{"path":"src/conversation/index.ts","kind":"import-statement","original":"./conversation"},{"path":"src/diff.ts","kind":"import-statement","original":"./diff"},{"path":"src/functions/index.ts","kind":"import-statement","original":"./functions"},{"path":"src/session/index.ts","kind":"import-statement","original":"./session"},{"path":"src/templates/index.ts","kind":"import-statement","original":"./templates"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"},"src/extraction/extraction.ts":{"bytes":6822,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/extraction/quotes.ts":{"bytes":7110,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"raw-loader:./instructions.tpl?raw":{"bytes":1318,"imports":[]},"src/extraction/extraction-llm-function/extraction-llm-function.ts":{"bytes":8479,"imports":[{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"src/session/index.ts","kind":"import-statement","original":"../../session"},{"path":"src/extraction/extraction.ts","kind":"import-statement","original":"../extraction"},{"path":"src/extraction/quotes.ts","kind":"import-statement","original":"../quotes"},{"path":"raw-loader:./instructions.tpl?raw","kind":"import-statement","original":"./instructions.tpl?raw"}],"format":"esm"},"src/extraction/extraction-llm-function/index.ts":{"bytes":524,"imports":[{"path":"src/extraction/extraction-llm-function/extraction-llm-function.ts","kind":"import-statement","original":"./extraction-llm-function"}],"format":"esm"},"src/extraction/extraction-ner-function/named-entity-recognition.ts":{"bytes":10067,"imports":[{"path":"@xenova/transformers","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/extraction/extraction-ner-function/extraction-ner-function.ts":{"bytes":9052,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"src/extraction/extraction.ts","kind":"import-statement","original":"../extraction"},{"path":"src/extraction/quotes.ts","kind":"import-statement","original":"../quotes"},{"path":"src/extraction/extraction-ner-function/named-entity-recognition.ts","kind":"dynamic-import","original":"./named-entity-recognition"}],"format":"esm"},"src/extraction/extraction-ner-function/index.ts":{"bytes":652,"imports":[{"path":"src/extraction/extraction-ner-function/extraction-ner-function.ts","kind":"import-statement","original":"./extraction-ner-function"},{"path":"src/extraction/extraction-ner-function/named-entity-recognition.ts","kind":"import-statement","original":"./named-entity-recognition"}],"format":"esm"},"src/extraction/index.ts":{"bytes":803,"imports":[{"path":"src/extraction/extraction.ts","kind":"import-statement","original":"./extraction"},{"path":"src/extraction/extraction-llm-function/index.ts","kind":"import-statement","original":"./extraction-llm-function"},{"path":"src/extraction/extraction-ner-function/index.ts","kind":"import-statement","original":"./extraction-ner-function"},{"path":"src/extraction/quotes.ts","kind":"import-statement","original":"./quotes"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":36935},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-5GJYG2ML.mjs","kind":"import-statement"},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["AiAssistantError","AiContextBinder","AiContextService","AiConversation","AiSession","AnthropicError","ArtifactDiffResolver","ArtifactId","Bindings","ContextBinding","GenerationObserver","VersionPin","applyDiffs","computeDiffsWithCursors","createArtifactElement","createSystemPrompt","createToolkit","makeToolExecutionServiceFromFunctions","makeToolResolverFromFunctions","reduceDiffs","templates"],"entryPoint":"src/index.ts","inputs":{"src/conversation/context.ts":{"bytesInOutput":3877},"src/conversation/index.ts":{"bytesInOutput":0},"src/conversation/conversation.ts":{"bytesInOutput":2807},"src/index.ts":{"bytesInOutput":0},"src/diff.ts":{"bytesInOutput":1899},"src/functions/services.ts":{"bytesInOutput":3431},"src/functions/index.ts":{"bytesInOutput":0},"src/templates/system.ts":{"bytesInOutput":540},"raw-loader:./format.tpl?raw":{"bytesInOutput":2000},"raw-loader:./system.tpl?raw":{"bytesInOutput":3412},"src/templates/index.ts":{"bytesInOutput":0},"src/types.ts":{"bytesInOutput":1334}},"bytes":20184},"dist/lib/browser/extraction/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16934},"dist/lib/browser/extraction/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-5GJYG2ML.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-UB26N5UF.mjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"dist/lib/browser/named-entity-recognition-QPYHML66.mjs","kind":"dynamic-import"}],"exports":["ExtractionInput","ExtractionOutput","ReferencedQuotes","combineNerTokens","createTokenGroups","extractFullEntities","extractionAnthropicFunction","extractionNerFunction","findQuotes","getNer","insertReferences","processTranscriptMessage"],"entryPoint":"src/extraction/index.ts","inputs":{"src/extraction/extraction.ts":{"bytesInOutput":1370},"src/extraction/index.ts":{"bytesInOutput":0},"src/extraction/extraction-llm-function/extraction-llm-function.ts":{"bytesInOutput":1766},"src/extraction/quotes.ts":{"bytesInOutput":1673},"raw-loader:./instructions.tpl?raw":{"bytesInOutput":1376},"src/extraction/extraction-llm-function/index.ts":{"bytesInOutput":0},"src/extraction/extraction-ner-function/extraction-ner-function.ts":{"bytesInOutput":2656},"src/extraction/extraction-ner-function/index.ts":{"bytesInOutput":0}},"bytes":9615},"dist/lib/browser/chunk-5GJYG2ML.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":30966},"dist/lib/browser/chunk-5GJYG2ML.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"@effect/platform","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/blueprints","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@effect/ai","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["AiAssistantError","AiSession","AnthropicError","ArtifactDiffResolver","GenerationObserver","VersionPin","createToolkit"],"inputs":{"src/session/artifact-diff.ts":{"bytesInOutput":134},"src/session/observer.ts":{"bytesInOutput":874},"src/errors.ts":{"bytesInOutput":199},"src/session/session.ts":{"bytesInOutput":4674},"src/session/error-handling.ts":{"bytesInOutput":929},"src/session/format.ts":{"bytesInOutput":3763},"src/session/toolkit.ts":{"bytesInOutput":745},"src/session/version-pin.ts":{"bytesInOutput":1043},"src/session/index.ts":{"bytesInOutput":0}},"bytes":12795},"dist/lib/browser/named-entity-recognition-QPYHML66.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/named-entity-recognition-QPYHML66.mjs":{"imports":[{"path":"dist/lib/browser/chunk-UB26N5UF.mjs","kind":"import-statement"}],"exports":["combineNerTokens","createTokenGroups","extractFullEntities","getNer"],"entryPoint":"src/extraction/extraction-ner-function/named-entity-recognition.ts","inputs":{},"bytes":261},"dist/lib/browser/chunk-UB26N5UF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5245},"dist/lib/browser/chunk-UB26N5UF.mjs":{"imports":[{"path":"@xenova/transformers","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["combineNerTokens","createTokenGroups","extractFullEntities","getNer"],"inputs":{"src/extraction/extraction-ner-function/named-entity-recognition.ts":{"bytesInOutput":2265}},"bytes":2465}}}