@dxos/assistant 0.8.2-main.5885341 → 0.8.2-main.600d381

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 (157) hide show
  1. package/dist/lib/browser/{chunk-DEIGOD4U.mjs → chunk-YSYP7S4W.mjs} +706 -242
  2. package/dist/lib/browser/chunk-YSYP7S4W.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +4 -443
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +64 -27
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node/{chunk-7VH7NMIM.cjs → chunk-FTIDW4BA.cjs} +716 -259
  9. package/dist/lib/node/chunk-FTIDW4BA.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +34 -470
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +53 -18
  14. package/dist/lib/node/testing/index.cjs.map +4 -4
  15. package/dist/lib/node-esm/{chunk-7JI4MDGL.mjs → chunk-GCJNPQDJ.mjs} +706 -242
  16. package/dist/lib/node-esm/chunk-GCJNPQDJ.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +4 -443
  18. package/dist/lib/node-esm/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +64 -27
  21. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  22. package/dist/types/src/ai-service/parser.d.ts.map +1 -1
  23. package/dist/types/src/ai-service/stream.d.ts.map +1 -1
  24. package/dist/types/src/ai-service/testing/test-stream.d.ts.map +1 -1
  25. package/dist/types/src/ai-service/types.d.ts +130 -130
  26. package/dist/types/src/ai-service/types.d.ts.map +1 -1
  27. package/dist/types/src/ai-service/util/sse.d.ts.map +1 -1
  28. package/dist/types/src/{conversation → experimental/conversation}/conversation.d.ts +2 -18
  29. package/dist/types/src/experimental/conversation/conversation.d.ts.map +1 -0
  30. package/dist/types/src/experimental/conversation/conversation.test.d.ts.map +1 -0
  31. package/dist/types/src/experimental/conversation/index.d.ts.map +1 -0
  32. package/dist/types/src/{conversation → experimental/conversation}/types.d.ts +9 -9
  33. package/dist/types/src/experimental/conversation/types.d.ts.map +1 -0
  34. package/dist/types/src/experimental/cypher/ast.d.ts.map +1 -0
  35. package/dist/types/src/experimental/cypher/combinators.d.ts.map +1 -0
  36. package/dist/types/src/experimental/cypher/combinators.test.d.ts.map +1 -0
  37. package/dist/types/src/experimental/cypher/echo-data-source.d.ts.map +1 -0
  38. package/dist/types/src/experimental/cypher/execution-plan.d.ts.map +1 -0
  39. package/dist/types/src/experimental/cypher/execution-plan.test.d.ts.map +1 -0
  40. package/dist/types/src/experimental/cypher/index.d.ts.map +1 -0
  41. package/dist/types/src/experimental/cypher/parjs.d.ts.map +1 -0
  42. package/dist/types/src/experimental/cypher/parser.d.ts.map +1 -0
  43. package/dist/types/src/experimental/cypher/query-executor.d.ts.map +1 -0
  44. package/dist/types/src/experimental/cypher/query-executor.test.d.ts.map +1 -0
  45. package/dist/types/src/experimental/cypher/schema.d.ts.map +1 -0
  46. package/dist/types/src/experimental/cypher/schema.test.d.ts.map +1 -0
  47. package/dist/types/src/experimental/index.d.ts +3 -0
  48. package/dist/types/src/experimental/index.d.ts.map +1 -0
  49. package/dist/types/src/experimental/ner/ner.test.d.ts +2 -0
  50. package/dist/types/src/experimental/ner/ner.test.d.ts.map +1 -0
  51. package/dist/types/src/experimental/research/exa.d.ts +6 -0
  52. package/dist/types/src/experimental/research/exa.d.ts.map +1 -0
  53. package/dist/types/src/experimental/research/research.test.d.ts +2 -0
  54. package/dist/types/src/experimental/research/research.test.d.ts.map +1 -0
  55. package/dist/types/src/index.d.ts +1 -2
  56. package/dist/types/src/index.d.ts.map +1 -1
  57. package/dist/types/src/session/index.d.ts +1 -0
  58. package/dist/types/src/session/index.d.ts.map +1 -1
  59. package/dist/types/src/session/session.d.ts +4 -3
  60. package/dist/types/src/session/session.d.ts.map +1 -1
  61. package/dist/types/src/session/tools.d.ts +18 -0
  62. package/dist/types/src/session/tools.d.ts.map +1 -0
  63. package/dist/types/src/session/version-pin.d.ts +5 -0
  64. package/dist/types/src/session/version-pin.d.ts.map +1 -1
  65. package/dist/types/src/testing/index.d.ts +1 -0
  66. package/dist/types/src/testing/index.d.ts.map +1 -1
  67. package/dist/types/src/testing/logger.d.ts +1 -1
  68. package/dist/types/src/testing/logger.d.ts.map +1 -1
  69. package/dist/types/src/testing/ollama.d.ts.map +1 -1
  70. package/dist/types/src/testing/printer.d.ts +6 -0
  71. package/dist/types/src/testing/printer.d.ts.map +1 -0
  72. package/dist/types/src/testing/query-promts.d.ts +4 -4
  73. package/dist/types/src/testing/query-promts.d.ts.map +1 -1
  74. package/dist/types/src/testing/test-data.d.ts +5 -5
  75. package/dist/types/src/testing/test-data.d.ts.map +1 -1
  76. package/dist/types/src/testing/test-schema.d.ts +25 -23
  77. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  78. package/dist/types/src/util/trim.d.ts.map +1 -1
  79. package/dist/types/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +19 -13
  81. package/src/ai-service/client.test.ts +5 -5
  82. package/src/ai-service/ollama-client.ts +8 -8
  83. package/src/ai-service/types.ts +14 -14
  84. package/src/bin/chat.ts +1 -1
  85. package/src/{conversation → experimental/conversation}/conversation.test.ts +5 -5
  86. package/src/{conversation → experimental/conversation}/conversation.ts +3 -112
  87. package/src/{conversation → experimental/conversation}/types.ts +10 -10
  88. package/src/{cypher → experimental/cypher}/echo-data-source.ts +7 -5
  89. package/src/{cypher → experimental/cypher}/query-executor.test.ts +1 -1
  90. package/src/{cypher → experimental/cypher}/schema.test.ts +1 -1
  91. package/src/{cypher → experimental/cypher}/schema.ts +1 -1
  92. package/src/experimental/index.ts +6 -0
  93. package/src/experimental/ner/ner.test.ts +163 -0
  94. package/src/experimental/research/exa.ts +38 -0
  95. package/src/experimental/research/instructions.tpl +64 -0
  96. package/src/experimental/research/research.test.ts +263 -0
  97. package/src/index.ts +3 -2
  98. package/src/session/index.ts +1 -0
  99. package/src/session/session.test.ts +28 -57
  100. package/src/session/session.ts +25 -15
  101. package/src/session/tools.ts +117 -0
  102. package/src/session/version-pin.ts +6 -0
  103. package/src/testing/artifacts.test.ts +22 -22
  104. package/src/testing/index.ts +1 -0
  105. package/src/testing/logger.ts +1 -1
  106. package/src/testing/printer.ts +41 -0
  107. package/src/testing/query-promts.ts +6 -6
  108. package/src/testing/query.test.ts +1 -2
  109. package/src/testing/test-data.ts +5 -5
  110. package/src/testing/test-schema.ts +27 -28
  111. package/src/typedefs.d.ts +8 -0
  112. package/dist/lib/browser/chunk-DEIGOD4U.mjs.map +0 -7
  113. package/dist/lib/node/chunk-7VH7NMIM.cjs.map +0 -7
  114. package/dist/lib/node-esm/chunk-7JI4MDGL.mjs.map +0 -7
  115. package/dist/types/src/conversation/conversation.d.ts.map +0 -1
  116. package/dist/types/src/conversation/conversation.test.d.ts.map +0 -1
  117. package/dist/types/src/conversation/index.d.ts.map +0 -1
  118. package/dist/types/src/conversation/types.d.ts.map +0 -1
  119. package/dist/types/src/cypher/ast.d.ts.map +0 -1
  120. package/dist/types/src/cypher/combinators.d.ts.map +0 -1
  121. package/dist/types/src/cypher/combinators.test.d.ts.map +0 -1
  122. package/dist/types/src/cypher/echo-data-source.d.ts.map +0 -1
  123. package/dist/types/src/cypher/execution-plan.d.ts.map +0 -1
  124. package/dist/types/src/cypher/execution-plan.test.d.ts.map +0 -1
  125. package/dist/types/src/cypher/index.d.ts.map +0 -1
  126. package/dist/types/src/cypher/parjs.d.ts.map +0 -1
  127. package/dist/types/src/cypher/parser.d.ts.map +0 -1
  128. package/dist/types/src/cypher/query-executor.d.ts.map +0 -1
  129. package/dist/types/src/cypher/query-executor.test.d.ts.map +0 -1
  130. package/dist/types/src/cypher/schema.d.ts.map +0 -1
  131. package/dist/types/src/cypher/schema.test.d.ts.map +0 -1
  132. /package/dist/types/src/{conversation → experimental/conversation}/conversation.test.d.ts +0 -0
  133. /package/dist/types/src/{conversation → experimental/conversation}/index.d.ts +0 -0
  134. /package/dist/types/src/{cypher → experimental/cypher}/ast.d.ts +0 -0
  135. /package/dist/types/src/{cypher → experimental/cypher}/combinators.d.ts +0 -0
  136. /package/dist/types/src/{cypher → experimental/cypher}/combinators.test.d.ts +0 -0
  137. /package/dist/types/src/{cypher → experimental/cypher}/echo-data-source.d.ts +0 -0
  138. /package/dist/types/src/{cypher → experimental/cypher}/execution-plan.d.ts +0 -0
  139. /package/dist/types/src/{cypher → experimental/cypher}/execution-plan.test.d.ts +0 -0
  140. /package/dist/types/src/{cypher → experimental/cypher}/index.d.ts +0 -0
  141. /package/dist/types/src/{cypher → experimental/cypher}/parjs.d.ts +0 -0
  142. /package/dist/types/src/{cypher → experimental/cypher}/parser.d.ts +0 -0
  143. /package/dist/types/src/{cypher → experimental/cypher}/query-executor.d.ts +0 -0
  144. /package/dist/types/src/{cypher → experimental/cypher}/query-executor.test.d.ts +0 -0
  145. /package/dist/types/src/{cypher → experimental/cypher}/schema.d.ts +0 -0
  146. /package/dist/types/src/{cypher → experimental/cypher}/schema.test.d.ts +0 -0
  147. /package/src/{conversation → experimental/conversation}/index.ts +0 -0
  148. /package/src/{cypher → experimental/cypher}/ast.ts +0 -0
  149. /package/src/{cypher → experimental/cypher}/combinators.test.ts +0 -0
  150. /package/src/{cypher → experimental/cypher}/combinators.ts +0 -0
  151. /package/src/{cypher → experimental/cypher}/execution-plan.test.ts +0 -0
  152. /package/src/{cypher → experimental/cypher}/execution-plan.ts +0 -0
  153. /package/src/{cypher → experimental/cypher}/index.ts +0 -0
  154. /package/src/{cypher → experimental/cypher}/parjs-shims.d.ts +0 -0
  155. /package/src/{cypher → experimental/cypher}/parjs.ts +0 -0
  156. /package/src/{cypher → experimental/cypher}/parser.ts +0 -0
  157. /package/src/{cypher → experimental/cypher}/query-executor.ts +0 -0
@@ -18,478 +18,42 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var node_exports = {};
20
20
  __export(node_exports, {
21
- AIServiceEdgeClient: () => import_chunk_7VH7NMIM.AIServiceEdgeClient,
22
- AIServiecOverloadedError: () => AIServiecOverloadedError,
23
- AISession: () => AISession,
24
- DEFAULT_EDGE_MODEL: () => import_chunk_7VH7NMIM.DEFAULT_EDGE_MODEL,
25
- DEFAULT_EDGE_MODELS: () => import_chunk_7VH7NMIM.DEFAULT_EDGE_MODELS,
26
- DEFAULT_OLLAMA_ENDPOINT: () => import_chunk_7VH7NMIM.DEFAULT_OLLAMA_ENDPOINT,
27
- DEFAULT_OLLAMA_MODEL: () => import_chunk_7VH7NMIM.DEFAULT_OLLAMA_MODEL,
28
- DEFAULT_OLLAMA_MODELS: () => import_chunk_7VH7NMIM.DEFAULT_OLLAMA_MODELS,
29
- EchoDataSource: () => import_chunk_7VH7NMIM.EchoDataSource,
30
- GenerateRequest: () => import_chunk_7VH7NMIM.GenerateRequest,
31
- GenerateResponse: () => import_chunk_7VH7NMIM.GenerateResponse,
32
- GenerationStreamImpl: () => import_chunk_7VH7NMIM.GenerationStreamImpl,
33
- LLMModel: () => import_chunk_7VH7NMIM.LLMModel,
34
- MessageCollector: () => import_chunk_7VH7NMIM.MessageCollector,
35
- MixedStreamParser: () => import_chunk_7VH7NMIM.MixedStreamParser,
36
- OllamaClient: () => import_chunk_7VH7NMIM.OllamaClient,
37
- StreamTransform: () => import_chunk_7VH7NMIM.StreamTransform,
38
- ToolTypes: () => import_chunk_7VH7NMIM.ToolTypes,
39
- VersionPin: () => VersionPin,
40
- createArtifactElement: () => import_chunk_7VH7NMIM.createArtifactElement,
41
- createGenerationStream: () => import_chunk_7VH7NMIM.createGenerationStream,
42
- emitMessageAsEvents: () => import_chunk_7VH7NMIM.emitMessageAsEvents,
43
- executeQuery: () => import_chunk_7VH7NMIM.executeQuery,
44
- executeQueryPlan: () => import_chunk_7VH7NMIM.executeQueryPlan,
45
- formatInferredRelationshipLabel: () => import_chunk_7VH7NMIM.formatInferredRelationshipLabel,
46
- formatJsonSchemaForLLM: () => import_chunk_7VH7NMIM.formatJsonSchemaForLLM,
47
- formatNodeLabel: () => import_chunk_7VH7NMIM.formatNodeLabel,
48
- isReference: () => import_chunk_7VH7NMIM.isReference,
49
- isToolUse: () => import_chunk_7VH7NMIM.isToolUse,
50
- mergeMessageBlock: () => import_chunk_7VH7NMIM.mergeMessageBlock,
51
- parseCypherQuery: () => import_chunk_7VH7NMIM.parseCypherQuery,
52
- runLLM: () => import_chunk_7VH7NMIM.runLLM,
53
- runTools: () => import_chunk_7VH7NMIM.runTools
21
+ AIServiceEdgeClient: () => import_chunk_FTIDW4BA.AIServiceEdgeClient,
22
+ AIServiecOverloadedError: () => import_chunk_FTIDW4BA.AIServiecOverloadedError,
23
+ AISession: () => import_chunk_FTIDW4BA.AISession,
24
+ DEFAULT_EDGE_MODEL: () => import_chunk_FTIDW4BA.DEFAULT_EDGE_MODEL,
25
+ DEFAULT_EDGE_MODELS: () => import_chunk_FTIDW4BA.DEFAULT_EDGE_MODELS,
26
+ DEFAULT_OLLAMA_ENDPOINT: () => import_chunk_FTIDW4BA.DEFAULT_OLLAMA_ENDPOINT,
27
+ DEFAULT_OLLAMA_MODEL: () => import_chunk_FTIDW4BA.DEFAULT_OLLAMA_MODEL,
28
+ DEFAULT_OLLAMA_MODELS: () => import_chunk_FTIDW4BA.DEFAULT_OLLAMA_MODELS,
29
+ EchoDataSource: () => import_chunk_FTIDW4BA.EchoDataSource,
30
+ GenerateRequest: () => import_chunk_FTIDW4BA.GenerateRequest,
31
+ GenerateResponse: () => import_chunk_FTIDW4BA.GenerateResponse,
32
+ GenerationStreamImpl: () => import_chunk_FTIDW4BA.GenerationStreamImpl,
33
+ LLMModel: () => import_chunk_FTIDW4BA.LLMModel,
34
+ MessageCollector: () => import_chunk_FTIDW4BA.MessageCollector,
35
+ MixedStreamParser: () => import_chunk_FTIDW4BA.MixedStreamParser,
36
+ OllamaClient: () => import_chunk_FTIDW4BA.OllamaClient,
37
+ StreamTransform: () => import_chunk_FTIDW4BA.StreamTransform,
38
+ ToolTypes: () => import_chunk_FTIDW4BA.ToolTypes,
39
+ VersionPin: () => import_chunk_FTIDW4BA.VersionPin,
40
+ createArtifactElement: () => import_chunk_FTIDW4BA.createArtifactElement,
41
+ createGenerationStream: () => import_chunk_FTIDW4BA.createGenerationStream,
42
+ emitMessageAsEvents: () => import_chunk_FTIDW4BA.emitMessageAsEvents,
43
+ executeQuery: () => import_chunk_FTIDW4BA.executeQuery,
44
+ executeQueryPlan: () => import_chunk_FTIDW4BA.executeQueryPlan,
45
+ formatInferredRelationshipLabel: () => import_chunk_FTIDW4BA.formatInferredRelationshipLabel,
46
+ formatJsonSchemaForLLM: () => import_chunk_FTIDW4BA.formatJsonSchemaForLLM,
47
+ formatNodeLabel: () => import_chunk_FTIDW4BA.formatNodeLabel,
48
+ isReference: () => import_chunk_FTIDW4BA.isReference,
49
+ isToolUse: () => import_chunk_FTIDW4BA.isToolUse,
50
+ mergeMessageBlock: () => import_chunk_FTIDW4BA.mergeMessageBlock,
51
+ parseCypherQuery: () => import_chunk_FTIDW4BA.parseCypherQuery,
52
+ runLLM: () => import_chunk_FTIDW4BA.runLLM,
53
+ runTools: () => import_chunk_FTIDW4BA.runTools
54
54
  });
55
55
  module.exports = __toCommonJS(node_exports);
56
- var import_chunk_7VH7NMIM = require("./chunk-7VH7NMIM.cjs");
57
- var import_effect = require("effect");
58
- var import_artifact = require("@dxos/artifact");
59
- var import_async = require("@dxos/async");
60
- var import_echo_db = require("@dxos/echo-db");
61
- var import_echo_schema = require("@dxos/echo-schema");
62
- var import_invariant = require("@dxos/invariant");
63
- var import_log = require("@dxos/log");
64
- var import_effect2 = require("effect");
65
- var import_echo_db2 = require("@dxos/echo-db");
66
- var import_echo_schema2 = require("@dxos/echo-schema");
67
- var ObjectVersionSchema = import_effect2.Schema.Unknown;
68
- var VersionPinSchema = import_effect2.Schema.Struct({
69
- // TODO(dmaretskyi): Use Ref when those support encoding.
70
- objectId: import_echo_schema2.ObjectId,
71
- // TODO(dmaretskyi): Could be opaque
72
- version: ObjectVersionSchema
73
- });
74
- var VersionPin = class extends VersionPinSchema {
75
- static {
76
- this.DISPOSITION = "version-pin";
77
- }
78
- static fromObject(object) {
79
- return VersionPin.make({
80
- objectId: object.id,
81
- version: (0, import_echo_db2.getVersion)(object)
82
- });
83
- }
84
- static createBlock(pin) {
85
- return {
86
- type: "json",
87
- disposition: VersionPin.DISPOSITION,
88
- json: JSON.stringify(pin)
89
- };
90
- }
91
- };
92
- function _ts_decorate(decorators, target, key, desc) {
93
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
94
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
95
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
96
- return c > 3 && r && Object.defineProperty(target, key, r), r;
97
- }
98
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/experimental/assistant/src/session/session.ts";
99
- var AISession = class _AISession {
100
- constructor(_options) {
101
- this._options = _options;
102
- this._parser = new import_chunk_7VH7NMIM.MixedStreamParser();
103
- this._pending = [];
104
- this._history = [];
105
- this.message = this._parser.message;
106
- this.block = this._parser.block;
107
- this.update = this._parser.update;
108
- this.streamEvent = this._parser.streamEvent;
109
- this.userMessage = new import_async.Event();
110
- this._parser.message.on((message) => {
111
- this._pending.push(message);
112
- });
113
- }
114
- async run(options) {
115
- const systemTools = [];
116
- switch (this._options.operationModel) {
117
- case "planning":
118
- systemTools.push(this._createQueryArtifactsTool(options.artifacts), this._createPlanningTool(options));
119
- break;
120
- case "importing":
121
- systemTools.push(this._createQueryArtifactsTool(options.artifacts), this._createRequireTool(options.artifacts, (artifactDefinitionIds) => {
122
- for (const artifactDefinitionId of artifactDefinitionIds) {
123
- requiredArtifactIds.add(artifactDefinitionId);
124
- }
125
- }));
126
- break;
127
- case "configured":
128
- break;
129
- default:
130
- throw new TypeError(`Invalid operation model: ${this._options.operationModel}`);
131
- }
132
- this._history = [
133
- ...options.history
134
- ];
135
- this._pending = [
136
- await this._formatUserPrompt(options.artifactDiffResolver, options.prompt, options.history)
137
- ];
138
- this.userMessage.emit(this._pending.at(-1));
139
- this._stream = void 0;
140
- let error;
141
- const requiredArtifactIds = new Set(options.requiredArtifactIds ?? []);
142
- try {
143
- let more = false;
144
- do {
145
- const tools = [
146
- ...systemTools,
147
- ...options.tools,
148
- ...options.artifacts.filter((artifact) => requiredArtifactIds.has(artifact.id)).flatMap((artifact) => artifact.tools)
149
- ];
150
- (0, import_log.log)("request", {
151
- pending: this._pending.length,
152
- history: this._history.length,
153
- tools: tools.map((tool) => tool.name)
154
- }, {
155
- F: __dxlog_file,
156
- L: 180,
157
- S: this,
158
- C: (f, a) => f(...a)
159
- });
160
- this._stream = await options.client.execStream({
161
- ...options.generationOptions ?? {},
162
- // TODO(burdon): Rename messages or separate history/message.
163
- history: [
164
- ...this._history,
165
- ...this._pending
166
- ],
167
- tools,
168
- systemPrompt: options.systemPrompt ?? createBaseInstructions({
169
- availableArtifacts: Array.from(requiredArtifactIds),
170
- operationModel: this._options.operationModel
171
- })
172
- });
173
- await this._parser.parse(this._stream);
174
- await this._stream.complete();
175
- (0, import_log.log)("response", {
176
- pending: this._pending
177
- }, {
178
- F: __dxlog_file,
179
- L: 205,
180
- S: this,
181
- C: (f, a) => f(...a)
182
- });
183
- more = false;
184
- const message = this._pending.at(-1);
185
- (0, import_invariant.invariant)(message, void 0, {
186
- F: __dxlog_file,
187
- L: 210,
188
- S: this,
189
- A: [
190
- "message",
191
- ""
192
- ]
193
- });
194
- if ((0, import_chunk_7VH7NMIM.isToolUse)(message)) {
195
- (0, import_log.log)("tool request...", void 0, {
196
- F: __dxlog_file,
197
- L: 212,
198
- S: this,
199
- C: (f, a) => f(...a)
200
- });
201
- const response = await (0, import_chunk_7VH7NMIM.runTools)({
202
- message: this._pending.at(-1),
203
- tools,
204
- extensions: options.extensions ?? {}
205
- });
206
- (0, import_log.log)("tool response", {
207
- response
208
- }, {
209
- F: __dxlog_file,
210
- L: 219,
211
- S: this,
212
- C: (f, a) => f(...a)
213
- });
214
- switch (response.type) {
215
- case "continue": {
216
- this._pending = [
217
- ...this._pending,
218
- response.message
219
- ];
220
- this.userMessage.emit(response.message);
221
- more = true;
222
- break;
223
- }
224
- }
225
- }
226
- } while (more);
227
- } catch (err) {
228
- import_log.log.catch(err, void 0, {
229
- F: __dxlog_file,
230
- L: 231,
231
- S: this,
232
- C: (f, a) => f(...a)
233
- });
234
- if (err instanceof Error && err.message.includes("Overloaded")) {
235
- error = new AIServiecOverloadedError("AI service overloaded", {
236
- cause: err
237
- });
238
- } else {
239
- error = new Error("AI service error", {
240
- cause: err
241
- });
242
- }
243
- } finally {
244
- this._stream = void 0;
245
- }
246
- if (error) {
247
- throw error;
248
- }
249
- return this._pending;
250
- }
251
- async _formatUserPrompt(artifactDiffResolver, prompt, history) {
252
- const prelude = [];
253
- if (artifactDiffResolver) {
254
- const versions = gatherObjectVersions(history);
255
- const artifactDiff = await artifactDiffResolver(Array.from(versions.entries()).map(([id, version]) => ({
256
- id,
257
- lastVersion: version
258
- })));
259
- import_log.log.info("vision", {
260
- artifactDiff,
261
- versions
262
- }, {
263
- F: __dxlog_file,
264
- L: 262,
265
- S: this,
266
- C: (f, a) => f(...a)
267
- });
268
- for (const [id, { version }] of [
269
- ...artifactDiff.entries()
270
- ]) {
271
- if (import_echo_db.ObjectVersion.equals(version, versions.get(id))) {
272
- artifactDiff.delete(id);
273
- continue;
274
- }
275
- prelude.push(VersionPin.createBlock(VersionPin.make({
276
- objectId: id,
277
- version
278
- })));
279
- }
280
- if (artifactDiff.size > 0) {
281
- prelude.push(createArtifactUpdateBlock(artifactDiff));
282
- }
283
- }
284
- return (0, import_echo_schema.create)(import_artifact.Message, {
285
- role: "user",
286
- content: [
287
- ...prelude,
288
- {
289
- type: "text",
290
- text: prompt
291
- }
292
- ]
293
- });
294
- }
295
- _createQueryArtifactsTool(artifacts) {
296
- return (0, import_artifact.defineTool)("system", {
297
- name: "query_artifact_definitions",
298
- description: "Query the available artifact definitions",
299
- schema: import_effect.Schema.Struct({}),
300
- execute: async () => {
301
- return import_artifact.ToolResult.Success({
302
- artifactDefinitions: artifacts.map((artifact) => ({
303
- id: artifact.id,
304
- name: artifact.name,
305
- description: artifact.description
306
- }))
307
- });
308
- }
309
- });
310
- }
311
- _createRequireTool(artifacts, onRequire) {
312
- return (0, import_artifact.defineTool)("system", {
313
- name: "require_artifact_definitions",
314
- description: "Require the use of specific artifact definitions. This will allow the model to interact with artifact definitions and use their tools.",
315
- schema: import_effect.Schema.Struct({
316
- artifactDefinitionIds: import_effect.Schema.Array(import_effect.Schema.String).annotations({
317
- description: "The ids of the artifact definitions to require",
318
- examples: [
319
- [
320
- "artifact:dxos.org/example/Test"
321
- ]
322
- ]
323
- })
324
- }),
325
- execute: async ({ artifactDefinitionIds }) => {
326
- const missingArtifactDefinitionIds = artifactDefinitionIds.filter((artifactId) => !artifacts.some((artifact) => artifact.id === artifactId));
327
- if (missingArtifactDefinitionIds.length > 0) {
328
- return import_artifact.ToolResult.Error(`One or more artifact definition ids are invalid: ${missingArtifactDefinitionIds.join(", ")}`);
329
- }
330
- onRequire(artifactDefinitionIds);
331
- return import_artifact.ToolResult.Success({});
332
- }
333
- });
334
- }
335
- _createPlanningTool(options) {
336
- return (0, import_artifact.defineTool)("system", {
337
- name: "create_plan",
338
- description: "Create a plan. Make sure that each step is independent and can be executed solely on the data returned by the previous step. The steps only share the data that is specified in the plan.",
339
- schema: import_effect.Schema.Struct({
340
- goal: import_effect.Schema.String.annotations({
341
- description: "The goal that the plan will achieve."
342
- }),
343
- steps: import_effect.Schema.Array(import_effect.Schema.Struct({
344
- action: import_effect.Schema.String.annotations({
345
- description: "Complete, detailed action to perform."
346
- }),
347
- input: import_effect.Schema.String.annotations({
348
- description: "The required input data for this step. First step must not require any data."
349
- }),
350
- output: import_effect.Schema.String.annotations({
351
- description: "The output data from this step. This is passed to the next step as input."
352
- }),
353
- requiredArtifactIds: import_effect.Schema.Array(import_effect.Schema.String).annotations({
354
- description: "The ids of the artifacts required to perform this step.",
355
- examples: [
356
- [
357
- "artifact:dxos.org/example/Test"
358
- ]
359
- ]
360
- })
361
- })).annotations({
362
- description: "Steps"
363
- })
364
- }),
365
- execute: async ({ goal, steps }) => {
366
- const missingArtifactIds = steps.flatMap((step) => step.requiredArtifactIds).filter((artifactId) => !options.artifacts.some((artifact) => artifact.id === artifactId));
367
- if (missingArtifactIds.length > 0) {
368
- return import_artifact.ToolResult.Error(`One or more artifact ids are invalid: ${missingArtifactIds.join(", ")}`);
369
- }
370
- const stepResults = [];
371
- for (const step of steps) {
372
- (0, import_log.log)("executing step", {
373
- action: step.action
374
- }, {
375
- F: __dxlog_file,
376
- L: 369,
377
- S: this,
378
- C: (f, a) => f(...a)
379
- });
380
- const session = new _AISession({
381
- operationModel: "importing"
382
- });
383
- session.message.on((ev) => this.message.emit(ev));
384
- session.block.on((ev) => this.block.emit(ev));
385
- session.update.on((ev) => this.update.emit(ev));
386
- session.streamEvent.on((ev) => this.streamEvent.emit(ev));
387
- session.userMessage.on((ev) => this.userMessage.emit(ev));
388
- const messages = await session.run({
389
- client: options.client,
390
- artifacts: options.artifacts,
391
- tools: options.tools,
392
- history: options.history,
393
- extensions: options.extensions,
394
- generationOptions: options.generationOptions,
395
- requiredArtifactIds: step.requiredArtifactIds.slice(),
396
- artifactDiffResolver: options.artifactDiffResolver,
397
- prompt: `
398
- You are an agent that executes the subtask in a plan.
399
-
400
- While you know the plan's goal only focus on your subtask
401
- Use the data from the previous step to complete your task.
402
- Return all of the data from "output" in your last message.
403
-
404
- Current step (that you need to complete):
405
- ${JSON.stringify({
406
- goal,
407
- input: step.input,
408
- output: step.output,
409
- yourTask: step.action
410
- }, null, 2)}
411
-
412
- Previous step results:
413
- ${JSON.stringify(stepResults.at(-1))}.
414
- `
415
- });
416
- const result = messages.at(-1);
417
- stepResults.push(result);
418
- }
419
- return import_artifact.ToolResult.Success({
420
- stepResults
421
- });
422
- }
423
- });
424
- }
425
- abort() {
426
- this._stream?.abort();
427
- }
428
- };
429
- _ts_decorate([
430
- import_async.synchronized
431
- ], AISession.prototype, "run", null);
432
- var createBaseInstructions = ({ availableArtifacts, operationModel }) => `
433
- You are a friendly, advanced AI assistant capable of creating and managing artifacts from available data and tools.
434
- Your task is to process user commands and questions and decide how best to respond.
435
- In some cases, you will need to create or reference data objects called artifacts.
436
-
437
- Follow these guidelines carefully:
438
-
439
- Decision-making:
440
-
441
- - Analyze the structure and type of the content in the user's message.
442
-
443
-
444
- ${operationModel === "planning" ? `
445
- - Can you complete the task using the available artifacts?
446
- - If you can't complete the task using the available artifacts, query the list of available artifacts using the appropriate tool.
447
- - Identify which artifacts are relevant to the user's request.
448
- - Break down the user's request into a step-by-step plan that you will use to execute the user's request, the plan items should include artifacts which will be used to perform the actions.
449
- ` : ""}
450
- ${operationModel === "importing" ? `
451
- - Can you complete the task using the available artifacts?
452
- - If you can't complete the task using the available artifacts, query the list of available artifacts using the appropriate tool.
453
- - Identify which artifacts are relevant to the user's request.
454
- - Are the required artifacts already available?
455
- - If not, select which artifact(s) will be the most relevant and require them using the require_artifacts tool.
456
- - The require'd artifact tools will be available for use after require.
457
- ` : ""}
458
- ${operationModel === "configured" ? `
459
- - Select the most relevant artifact(s) to complete the task.
460
- - Call the appropriate tool to use the artifact(s).
461
- ` : ""}
462
-
463
- ${availableArtifacts.length > 0 ? `Artifacts already in context: ${availableArtifacts.join("\n")}` : ""}
464
- `;
465
- var AIServiecOverloadedError = class extends import_effect.Schema.TaggedError()("AIServiecOverloadedError", {}) {
466
- };
467
- var gatherObjectVersions = (messages) => {
468
- const artifactIds = /* @__PURE__ */ new Map();
469
- for (const message of messages) {
470
- for (const block of message.content) {
471
- if (block.type === "json" && block.disposition === VersionPin.DISPOSITION) {
472
- const pin = VersionPin.pipe(import_effect.Schema.decodeOption)(JSON.parse(block.json)).pipe(import_effect.Option.getOrUndefined);
473
- if (!pin) {
474
- continue;
475
- }
476
- artifactIds.set(pin.objectId, pin.version);
477
- }
478
- }
479
- }
480
- return artifactIds;
481
- };
482
- var createArtifactUpdateBlock = (artifactDiff) => {
483
- return {
484
- type: "text",
485
- disposition: "artifact-update",
486
- text: `
487
- The following artifacts have been updated since the last message:
488
- ${Array.from(artifactDiff.entries()).map(([id, { diff }]) => `<changed-artifact id="${id}">${diff ? `
489
- ${diff}` : ""}</changed-artifact>`).join("\n")}
490
- `
491
- };
492
- };
56
+ var import_chunk_FTIDW4BA = require("./chunk-FTIDW4BA.cjs");
493
57
  // Annotate the CommonJS export names for ESM import in node:
494
58
  0 && (module.exports = {
495
59
  AIServiceEdgeClient,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/session/session.ts", "../../../src/session/version-pin.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Option, Schema as S } from 'effect';\n\nimport {\n defineTool,\n Message,\n ToolResult,\n type ArtifactDefinition,\n type MessageContentBlock,\n type Tool,\n} from '@dxos/artifact';\nimport { Event, synchronized } from '@dxos/async';\nimport { ObjectVersion } from '@dxos/echo-db';\nimport { create, type ObjectId } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport { VersionPin } from './version-pin';\nimport { MixedStreamParser, type AIServiceClient, type GenerateRequest, type GenerationStream } from '../ai-service';\nimport { isToolUse, runTools } from '../conversation';\n\n/**\n * Contains message history, tools, current context.\n * Current context means the state of the app, time of day, and other contextual information.\n * It makes requests to the model, its a state machine.\n * It keeps track of the current goal.\n * It manages the context window.\n * Tracks the success criteria of reaching the goal, exposing metrics (stretch)\n * Could be run locally in the app or remotely.\n * Could be personal or shared.\n */\n\n/**\n * Resolves artifact ids to their versions.\n * Used to give the model a sense of the changes to the artifacts made by users during the conversation.\n * The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,\n * a diff is inserted into the conversation.\n */\nexport type ArtifactDiffResolver = (artifacts: { id: ObjectId; lastVersion: ObjectVersion }[]) => Promise<\n Map<\n ObjectId,\n {\n version: ObjectVersion;\n diff?: string;\n }\n >\n>;\n\nexport type SessionRunOptions = {\n client: AIServiceClient;\n\n artifacts: ArtifactDefinition[];\n\n /**\n * Non-artifact specific tools.\n */\n tools: Tool[];\n\n history: Message[];\n\n prompt: string;\n\n generationOptions?: Pick<GenerateRequest, 'model'>;\n\n extensions?: ToolContextExtensions;\n\n systemPrompt?: string;\n\n /**\n * Pre-require artifacts.\n */\n requiredArtifactIds?: string[];\n\n /**\n * @see ArtifactDiffResolver\n */\n artifactDiffResolver?: ArtifactDiffResolver;\n};\n\ntype OperationModel = 'planning' | 'importing' | 'configured';\n\nexport type AiSessionOptions = {\n /**\n * Determines the agent's handling of the artifacts definitions:\n *\n * - `planning`: The model will create a plan with required artifacts for each step.\n * - `importing`: The model can query registry and only pull in the artifacts that are required to complete the task.\n * - `configured`: The available artifacts are pre-selected and the model cannot select additional artifacts.\n */\n operationModel: OperationModel;\n};\n\nexport class AISession {\n /** SSE stream parser. */\n private readonly _parser = new MixedStreamParser();\n\n /** Pending messages (incl. the current user request). */\n private _pending: Message[] = [];\n\n /** Current streaming response. */\n private _stream: GenerationStream | undefined;\n\n /** Prior history from queue. */\n private _history: Message[] = [];\n\n /**\n * New message.\n */\n public readonly message = this._parser.message;\n\n /**\n * Complete block added to Message.\n */\n public readonly block = this._parser.block;\n\n /**\n * Update partial block (while streaming).\n */\n public readonly update = this._parser.update;\n\n public readonly streamEvent = this._parser.streamEvent;\n\n /**\n * User prompt or tool result.\n */\n public readonly userMessage = new Event<Message>();\n\n constructor(private readonly _options: AiSessionOptions) {\n // Message complete.\n this._parser.message.on((message) => {\n this._pending.push(message);\n });\n }\n\n @synchronized\n async run(options: SessionRunOptions): Promise<Message[]> {\n const systemTools: Tool[] = [];\n switch (this._options.operationModel) {\n case 'planning':\n systemTools.push(this._createQueryArtifactsTool(options.artifacts), this._createPlanningTool(options));\n break;\n case 'importing':\n systemTools.push(\n this._createQueryArtifactsTool(options.artifacts),\n this._createRequireTool(options.artifacts, (artifactDefinitionIds) => {\n for (const artifactDefinitionId of artifactDefinitionIds) {\n requiredArtifactIds.add(artifactDefinitionId);\n }\n }),\n );\n break;\n case 'configured':\n // no system tools\n break;\n default:\n throw new TypeError(`Invalid operation model: ${this._options.operationModel}`);\n }\n\n this._history = [...options.history];\n this._pending = [await this._formatUserPrompt(options.artifactDiffResolver, options.prompt, options.history)];\n this.userMessage.emit(this._pending.at(-1)!);\n this._stream = undefined;\n let error: Error | undefined;\n\n const requiredArtifactIds = new Set<string>(options.requiredArtifactIds ?? []);\n try {\n let more = false;\n do {\n const tools = [\n ...systemTools,\n ...options.tools,\n ...options.artifacts\n .filter((artifact) => requiredArtifactIds.has(artifact.id))\n .flatMap((artifact) => artifact.tools),\n ];\n\n log('request', {\n pending: this._pending.length,\n history: this._history.length,\n tools: tools.map((tool) => tool.name),\n });\n\n // Open request stream.\n this._stream = await options.client.execStream({\n ...(options.generationOptions ?? {}),\n // TODO(burdon): Rename messages or separate history/message.\n history: [...this._history, ...this._pending],\n tools,\n systemPrompt:\n options.systemPrompt ??\n createBaseInstructions({\n availableArtifacts: Array.from(requiredArtifactIds),\n operationModel: this._options.operationModel,\n }),\n });\n\n // Wait until complete.\n await this._parser.parse(this._stream);\n await this._stream.complete();\n\n // Add messages.\n log('response', { pending: this._pending });\n\n // Resolve tool use locally.\n more = false;\n const message = this._pending.at(-1);\n invariant(message);\n if (isToolUse(message)) {\n log('tool request...');\n const response = await runTools({\n message: this._pending.at(-1)!,\n tools,\n extensions: options.extensions ?? {},\n });\n\n log('tool response', { response });\n switch (response.type) {\n case 'continue': {\n this._pending = [...this._pending, response.message];\n this.userMessage.emit(response.message);\n more = true;\n break;\n }\n }\n }\n } while (more);\n } catch (err) {\n log.catch(err);\n if (err instanceof Error && err.message.includes('Overloaded')) {\n error = new AIServiecOverloadedError('AI service overloaded', { cause: err } as any); // TODO(dmaretskyi): Schema errors cant have cause\n } else {\n error = new Error('AI service error', { cause: err });\n }\n } finally {\n this._stream = undefined;\n }\n\n if (error) {\n throw error;\n }\n\n return this._pending;\n }\n\n private async _formatUserPrompt(\n artifactDiffResolver: ArtifactDiffResolver | undefined,\n prompt: string,\n history: Message[],\n ) {\n const prelude: MessageContentBlock[] = [];\n\n if (artifactDiffResolver) {\n const versions = gatherObjectVersions(history);\n\n const artifactDiff = await artifactDiffResolver(\n Array.from(versions.entries()).map(([id, version]) => ({ id, lastVersion: version })),\n );\n\n log.info('vision', {\n artifactDiff,\n versions,\n });\n\n for (const [id, { version }] of [...artifactDiff.entries()]) {\n if (ObjectVersion.equals(version, versions.get(id)!)) {\n artifactDiff.delete(id);\n continue;\n }\n\n prelude.push(VersionPin.createBlock(VersionPin.make({ objectId: id, version })));\n }\n if (artifactDiff.size > 0) {\n prelude.push(createArtifactUpdateBlock(artifactDiff));\n }\n }\n\n return create(Message, {\n role: 'user',\n content: [...prelude, { type: 'text', text: prompt }],\n });\n }\n\n private _createQueryArtifactsTool(artifacts: ArtifactDefinition[]) {\n return defineTool('system', {\n name: 'query_artifact_definitions',\n description: 'Query the available artifact definitions',\n schema: S.Struct({}),\n execute: async () => {\n return ToolResult.Success({\n artifactDefinitions: artifacts.map((artifact) => ({\n id: artifact.id,\n name: artifact.name,\n description: artifact.description,\n })),\n });\n },\n });\n }\n\n private _createRequireTool(\n artifacts: ArtifactDefinition[],\n onRequire: (artifactDefinitionIds: readonly string[]) => void,\n ) {\n return defineTool('system', {\n name: 'require_artifact_definitions',\n description:\n 'Require the use of specific artifact definitions. This will allow the model to interact with artifact definitions and use their tools.',\n schema: S.Struct({\n artifactDefinitionIds: S.Array(S.String).annotations({\n description: 'The ids of the artifact definitions to require',\n examples: [['artifact:dxos.org/example/Test']],\n }),\n }),\n execute: async ({ artifactDefinitionIds }) => {\n const missingArtifactDefinitionIds = artifactDefinitionIds.filter(\n (artifactId) => !artifacts.some((artifact) => artifact.id === artifactId),\n );\n if (missingArtifactDefinitionIds.length > 0) {\n return ToolResult.Error(\n `One or more artifact definition ids are invalid: ${missingArtifactDefinitionIds.join(', ')}`,\n );\n }\n\n onRequire(artifactDefinitionIds);\n\n return ToolResult.Success({});\n },\n });\n }\n\n private _createPlanningTool(options: SessionRunOptions) {\n return defineTool('system', {\n name: 'create_plan',\n description:\n 'Create a plan. Make sure that each step is independent and can be executed solely on the data returned by the previous step. The steps only share the data that is specified in the plan.',\n schema: S.Struct({\n goal: S.String.annotations({ description: 'The goal that the plan will achieve.' }),\n steps: S.Array(\n S.Struct({\n action: S.String.annotations({\n description: 'Complete, detailed action to perform.',\n }),\n input: S.String.annotations({\n description: 'The required input data for this step. First step must not require any data.',\n }),\n output: S.String.annotations({\n description: 'The output data from this step. This is passed to the next step as input.',\n }),\n requiredArtifactIds: S.Array(S.String).annotations({\n description: 'The ids of the artifacts required to perform this step.',\n examples: [['artifact:dxos.org/example/Test']],\n }),\n }),\n ).annotations({ description: 'Steps' }),\n }),\n execute: async ({ goal, steps }) => {\n const missingArtifactIds = steps\n .flatMap((step) => step.requiredArtifactIds)\n .filter((artifactId) => !options.artifacts.some((artifact) => artifact.id === artifactId));\n if (missingArtifactIds.length > 0) {\n return ToolResult.Error(`One or more artifact ids are invalid: ${missingArtifactIds.join(', ')}`);\n }\n\n const stepResults: any[] = [];\n for (const step of steps) {\n log('executing step', { action: step.action });\n const session = new AISession({ operationModel: 'importing' });\n session.message.on((ev) => this.message.emit(ev));\n session.block.on((ev) => this.block.emit(ev));\n session.update.on((ev) => this.update.emit(ev));\n session.streamEvent.on((ev) => this.streamEvent.emit(ev));\n session.userMessage.on((ev) => this.userMessage.emit(ev));\n\n const messages = await session.run({\n client: options.client,\n artifacts: options.artifacts,\n tools: options.tools,\n history: options.history,\n extensions: options.extensions,\n generationOptions: options.generationOptions,\n requiredArtifactIds: step.requiredArtifactIds.slice(),\n artifactDiffResolver: options.artifactDiffResolver,\n prompt: `\n You are an agent that executes the subtask in a plan.\n \n While you know the plan's goal only focus on your subtask\n Use the data from the previous step to complete your task.\n Return all of the data from \"output\" in your last message.\n \n Current step (that you need to complete):\n ${JSON.stringify(\n {\n goal,\n input: step.input,\n output: step.output,\n yourTask: step.action,\n },\n null,\n 2,\n )}\n \n Previous step results:\n ${JSON.stringify(stepResults.at(-1))}.\n `,\n });\n const result = messages.at(-1);\n stepResults.push(result);\n }\n\n return ToolResult.Success({ stepResults });\n },\n });\n }\n\n abort() {\n this._stream?.abort();\n }\n}\n\n// TODO(burdon): Use handlebars template with effect-schema input.\nconst createBaseInstructions = ({\n availableArtifacts,\n operationModel,\n}: {\n availableArtifacts: string[];\n operationModel: OperationModel;\n}) => `\n You are a friendly, advanced AI assistant capable of creating and managing artifacts from available data and tools. \n Your task is to process user commands and questions and decide how best to respond.\n In some cases, you will need to create or reference data objects called artifacts.\n\n Follow these guidelines carefully:\n\n Decision-making:\n\n - Analyze the structure and type of the content in the user's message.\n \n \n ${\n operationModel === 'planning'\n ? `\n - Can you complete the task using the available artifacts?\n - If you can't complete the task using the available artifacts, query the list of available artifacts using the appropriate tool.\n - Identify which artifacts are relevant to the user's request.\n - Break down the user's request into a step-by-step plan that you will use to execute the user's request, the plan items should include artifacts which will be used to perform the actions.\n `\n : ''\n }\n ${\n operationModel === 'importing'\n ? `\n - Can you complete the task using the available artifacts?\n - If you can't complete the task using the available artifacts, query the list of available artifacts using the appropriate tool.\n - Identify which artifacts are relevant to the user's request.\n - Are the required artifacts already available?\n - If not, select which artifact(s) will be the most relevant and require them using the require_artifacts tool.\n - The require'd artifact tools will be available for use after require.\n `\n : ''\n }\n ${\n operationModel === 'configured'\n ? `\n - Select the most relevant artifact(s) to complete the task.\n - Call the appropriate tool to use the artifact(s).\n `\n : ''\n }\n\n ${availableArtifacts.length > 0 ? `Artifacts already in context: ${availableArtifacts.join('\\n')}` : ''}\n`;\n\nexport class AIServiecOverloadedError extends S.TaggedError<AIServiecOverloadedError>()(\n 'AIServiecOverloadedError',\n {},\n) {}\n\nconst gatherObjectVersions = (messages: Message[]): Map<ObjectId, ObjectVersion> => {\n const artifactIds = new Map<ObjectId, ObjectVersion>();\n for (const message of messages) {\n for (const block of message.content) {\n if (block.type === 'json' && block.disposition === VersionPin.DISPOSITION) {\n const pin = VersionPin.pipe(S.decodeOption)(JSON.parse(block.json)).pipe(Option.getOrUndefined);\n if (!pin) {\n continue;\n }\n artifactIds.set(pin.objectId, pin.version);\n }\n }\n }\n\n return artifactIds;\n};\n\nconst createArtifactUpdateBlock = (\n artifactDiff: Map<ObjectId, { version: ObjectVersion; diff?: string }>,\n): MessageContentBlock => {\n return {\n type: 'text',\n disposition: 'artifact-update',\n text: `\n The following artifacts have been updated since the last message:\n ${Array.from(artifactDiff.entries())\n .map(([id, { diff }]) => `<changed-artifact id=\"${id}\">${diff ? `\\n${diff}` : ''}</changed-artifact>`)\n .join('\\n')}\n `,\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport type { MessageContentBlock } from '@dxos/artifact';\nimport type { ObjectVersion } from '@dxos/echo-db';\nimport { getVersion } from '@dxos/echo-db';\nimport { ObjectId, type BaseEchoObject } from '@dxos/echo-schema';\n\n// TODO(dmaretskyi): Extract.\nconst ObjectVersionSchema = Schema.Unknown as Schema.Schema<ObjectVersion>;\n\nconst VersionPinSchema = Schema.Struct({\n // TODO(dmaretskyi): Use Ref when those support encoding.\n objectId: ObjectId,\n // TODO(dmaretskyi): Could be opaque\n version: ObjectVersionSchema,\n});\nexport interface VersionPin extends Schema.Schema.Type<typeof VersionPinSchema> {}\n\nexport const VersionPin: typeof VersionPinSchema & {\n DISPOSITION: 'version-pin';\n fromObject: (object: BaseEchoObject) => VersionPin;\n createBlock: (pin: VersionPin) => MessageContentBlock;\n} = class extends VersionPinSchema {\n static readonly DISPOSITION = 'version-pin';\n static fromObject(object: BaseEchoObject): VersionPin {\n return VersionPin.make({\n objectId: object.id,\n version: getVersion(object),\n });\n }\n\n static createBlock(pin: VersionPin): MessageContentBlock {\n return {\n type: 'json',\n disposition: VersionPin.DISPOSITION,\n json: JSON.stringify(pin),\n };\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAAoC;AAEpC,sBAOO;AACP,mBAAoC;AACpC,qBAA8B;AAC9B,yBAAsC;AACtC,uBAA0B;AAC1B,iBAAoB;ACdpB,IAAAA,iBAAuB;AAIvB,IAAAC,kBAA2B;AAC3B,IAAAC,sBAA8C;AAG9C,IAAMC,sBAAsBC,sBAAOC;AAEnC,IAAMC,mBAAmBF,sBAAOG,OAAO;;EAErCC,UAAUC;;EAEVC,SAASP;AACX,CAAA;AAGO,IAAMQ,aAIT,cAAcL,iBAAAA;EAChB,OAAA;SAAgBM,cAAc;;EAC9B,OAAOC,WAAWC,QAAoC;AACpD,WAAOH,WAAWI,KAAK;MACrBP,UAAUM,OAAOE;MACjBN,aAASO,4BAAWH,MAAAA;IACtB,CAAA;EACF;EAEA,OAAOI,YAAYC,KAAsC;AACvD,WAAO;MACLC,MAAM;MACNC,aAAaV,WAAWC;MACxBU,MAAMC,KAAKC,UAAUL,GAAAA;IACvB;EACF;AACF;;;;;;;;ADqDO,IAAMM,YAAN,MAAMA,WAAAA;EAmCXC,YAA6BC,UAA4B;SAA5BA,WAAAA;SAjCZC,UAAU,IAAIC,wCAAAA;SAGvBC,WAAsB,CAAA;SAMtBC,WAAsB,CAAA;SAKdC,UAAU,KAAKJ,QAAQI;SAKvBC,QAAQ,KAAKL,QAAQK;SAKrBC,SAAS,KAAKN,QAAQM;SAEtBC,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I,KAAKhC,cAAAA,OAAEiC,YAAY,EAAE/H,KAAK4D,MAAMlD,MAAMX,IAAI,CAAA,EAAG+H,KAAKE,qBAAOC,cAAc;AAC9F,YAAI,CAACrI,KAAK;AACR;QACF;AACAgI,oBAAYM,IAAItI,IAAIX,UAAUW,IAAIT,OAAO;MAC3C;IACF;EACF;AAEA,SAAOyI;AACT;AAEA,IAAMvC,4BAA4B,CAChCT,iBAAAA;AAEA,SAAO;IACL/E,MAAM;IACNC,aAAa;IACb4F,MAAM;;QAEFhC,MAAMC,KAAKiB,aAAaC,QAAO,CAAA,EAC9B5B,IAAI,CAAC,CAACxD,IAAI,EAAE0I,KAAI,CAAE,MAAM,yBAAyB1I,EAAAA,KAAO0I,OAAO;EAAKA,IAAAA,KAAS,EAAA,qBAAuB,EACpGzB,KAAK,IAAA,CAAA;;EAEZ;AACF;",
6
- "names": ["import_effect", "import_echo_db", "import_echo_schema", "ObjectVersionSchema", "Schema", "Unknown", "VersionPinSchema", "Struct", "objectId", "ObjectId", "version", "VersionPin", "DISPOSITION", "fromObject", "object", "make", "id", "getVersion", "createBlock", "pin", "type", "disposition", "json", "JSON", "stringify", "AISession", "constructor", "_options", "_parser", "MixedStreamParser", "_pending", "_history", "message", "block", "update", "streamEvent", "userMessage", "Event", "on", "push", "run", "options", "systemTools", "operationModel", "_createQueryArtifactsTool", "artifacts", "_createPlanningTool", "_createRequireTool", "artifactDefinitionIds", "artifactDefinitionId", "requiredArtifactIds", "add", "TypeError", "history", "_formatUserPrompt", "artifactDiffResolver", "prompt", "emit", "at", "_stream", "undefined", "error", "Set", "more", "tools", "filter", "artifact", "has", "flatMap", "log", "pending", "length", "map", "tool", "name", "client", "execStream", "generationOptions", "systemPrompt", "createBaseInstructions", "availableArtifacts", "Array", "from", "parse", "complete", "invariant", "isToolUse", "response", "runTools", "extensions", "err", "catch", "Error", "includes", "AIServiecOverloadedError", "cause", "prelude", "versions", "gatherObjectVersions", "artifactDiff", "entries", "lastVersion", "info", "ObjectVersion", "equals", "get", "delete", "size", "createArtifactUpdateBlock", "create", "Message", "role", "content", "text", "defineTool", "description", "schema", "S", "execute", "ToolResult", "Success", "artifactDefinitions", "onRequire", "String", "annotations", "examples", "missingArtifactDefinitionIds", "artifactId", "some", "join", "goal", "steps", "action", "input", "output", "missingArtifactIds", "step", "stepResults", "session", "ev", "messages", "slice", "yourTask", "result", "abort", "synchronized", "TaggedError", "artifactIds", "Map", "pipe", "decodeOption", "Option", "getOrUndefined", "set", "diff"]
3
+ "sources": ["index.cjs"],
4
+ "sourcesContent": ["import {\n AIServiceEdgeClient,\n AIServiecOverloadedError,\n AISession,\n DEFAULT_EDGE_MODEL,\n DEFAULT_EDGE_MODELS,\n DEFAULT_OLLAMA_ENDPOINT,\n DEFAULT_OLLAMA_MODEL,\n DEFAULT_OLLAMA_MODELS,\n EchoDataSource,\n GenerateRequest,\n GenerateResponse,\n GenerationStreamImpl,\n LLMModel,\n MessageCollector,\n MixedStreamParser,\n OllamaClient,\n StreamTransform,\n ToolTypes,\n VersionPin,\n createArtifactElement,\n createGenerationStream,\n emitMessageAsEvents,\n executeQuery,\n executeQueryPlan,\n formatInferredRelationshipLabel,\n formatJsonSchemaForLLM,\n formatNodeLabel,\n isReference,\n isToolUse,\n mergeMessageBlock,\n parseCypherQuery,\n runLLM,\n runTools\n} from \"./chunk-FTIDW4BA.cjs\";\nexport {\n AIServiceEdgeClient,\n AIServiecOverloadedError,\n AISession,\n DEFAULT_EDGE_MODEL,\n DEFAULT_EDGE_MODELS,\n DEFAULT_OLLAMA_ENDPOINT,\n DEFAULT_OLLAMA_MODEL,\n DEFAULT_OLLAMA_MODELS,\n EchoDataSource,\n GenerateRequest,\n GenerateResponse,\n GenerationStreamImpl,\n LLMModel,\n MessageCollector,\n MixedStreamParser,\n OllamaClient,\n StreamTransform,\n ToolTypes,\n VersionPin,\n createArtifactElement,\n createGenerationStream,\n emitMessageAsEvents,\n executeQuery,\n executeQueryPlan,\n formatInferredRelationshipLabel,\n formatJsonSchemaForLLM,\n formatNodeLabel,\n isReference,\n isToolUse,\n mergeMessageBlock,\n parseCypherQuery,\n runLLM,\n runTools\n};\n//# sourceMappingURL=index.cjs.map\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAkCO;",
6
+ "names": []
7
7
  }