@dxos/assistant 0.8.4-main.ae835ea → 0.8.4-main.bc2380dfbc

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 (172) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +2 -1
  3. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  4. package/dist/lib/neutral/extraction/index.mjs +204 -0
  5. package/dist/lib/neutral/extraction/index.mjs.map +7 -0
  6. package/dist/lib/neutral/index.mjs +1755 -0
  7. package/dist/lib/neutral/index.mjs.map +7 -0
  8. package/dist/lib/neutral/meta.json +1 -0
  9. package/dist/types/src/extraction/extraction-ner-function/index.d.ts +0 -1
  10. package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -1
  11. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
  12. package/dist/types/src/extraction/extraction.d.ts +1065 -312
  13. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  14. package/dist/types/src/extraction/index.d.ts +0 -1
  15. package/dist/types/src/extraction/index.d.ts.map +1 -1
  16. package/dist/types/src/extraction/quotes.d.ts +2 -2
  17. package/dist/types/src/extraction/quotes.d.ts.map +1 -1
  18. package/dist/types/src/functions/services.d.ts +13 -15
  19. package/dist/types/src/functions/services.d.ts.map +1 -1
  20. package/dist/types/src/index.d.ts +2 -5
  21. package/dist/types/src/index.d.ts.map +1 -1
  22. package/dist/types/src/request/AiRequest.d.ts +104 -0
  23. package/dist/types/src/request/AiRequest.d.ts.map +1 -0
  24. package/dist/types/src/{session → request}/artifact-diff.d.ts +1 -1
  25. package/dist/types/src/request/artifact-diff.d.ts.map +1 -0
  26. package/dist/types/src/request/format.d.ts +15 -0
  27. package/dist/types/src/request/format.d.ts.map +1 -0
  28. package/dist/types/src/request/index.d.ts +4 -0
  29. package/dist/types/src/request/index.d.ts.map +1 -0
  30. package/dist/types/src/{session → request}/observer.d.ts +6 -5
  31. package/dist/types/src/request/observer.d.ts.map +1 -0
  32. package/dist/types/src/{session → request}/version-pin.d.ts +3 -3
  33. package/dist/types/src/request/version-pin.d.ts.map +1 -0
  34. package/dist/types/src/session/AiContext.d.ts +154 -0
  35. package/dist/types/src/session/AiContext.d.ts.map +1 -0
  36. package/dist/types/src/session/AiContext.test.d.ts +2 -0
  37. package/dist/types/src/session/AiContext.test.d.ts.map +1 -0
  38. package/dist/types/src/session/AiSession.d.ts +73 -0
  39. package/dist/types/src/session/AiSession.d.ts.map +1 -0
  40. package/dist/types/src/session/index.d.ts +2 -4
  41. package/dist/types/src/session/index.d.ts.map +1 -1
  42. package/dist/types/src/session/toolkit.d.ts +10 -9
  43. package/dist/types/src/session/toolkit.d.ts.map +1 -1
  44. package/dist/types/src/templates/system.d.ts +1 -2
  45. package/dist/types/src/templates/system.d.ts.map +1 -1
  46. package/dist/types/src/util/artifact.d.ts +27 -0
  47. package/dist/types/src/util/artifact.d.ts.map +1 -0
  48. package/dist/types/src/{diff.d.ts → util/diff.d.ts} +3 -1
  49. package/dist/types/src/util/diff.d.ts.map +1 -0
  50. package/dist/types/src/{diff.test.d.ts.map → util/diff.test.d.ts.map} +1 -1
  51. package/dist/types/src/util/error-handling.d.ts.map +1 -0
  52. package/dist/types/src/{errors.d.ts → util/errors.d.ts} +32 -40
  53. package/dist/types/src/util/errors.d.ts.map +1 -0
  54. package/dist/types/src/{execution-graph.d.ts → util/execution-graph.d.ts} +5 -2
  55. package/dist/types/src/util/execution-graph.d.ts.map +1 -0
  56. package/dist/types/src/util/execution-graph.test.d.ts.map +1 -0
  57. package/dist/types/src/util/index.d.ts +7 -0
  58. package/dist/types/src/util/index.d.ts.map +1 -0
  59. package/dist/types/src/util/tracing.d.ts +233 -0
  60. package/dist/types/src/util/tracing.d.ts.map +1 -0
  61. package/dist/types/tsconfig.tsbuildinfo +1 -1
  62. package/package.json +36 -42
  63. package/src/extraction/extraction-ner-function/index.ts +0 -1
  64. package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +10 -5
  65. package/src/extraction/extraction.ts +43 -14
  66. package/src/extraction/index.ts +0 -1
  67. package/src/extraction/quotes.ts +4 -5
  68. package/src/functions/services.ts +119 -63
  69. package/src/index.ts +2 -5
  70. package/src/request/AiRequest.ts +348 -0
  71. package/src/{session → request}/artifact-diff.ts +1 -1
  72. package/src/{session → request}/format.ts +29 -24
  73. package/src/request/index.ts +8 -0
  74. package/src/{session → request}/observer.ts +6 -3
  75. package/src/{session → request}/version-pin.ts +6 -6
  76. package/src/session/AiContext.test.ts +53 -0
  77. package/src/session/AiContext.ts +403 -0
  78. package/src/session/AiSession.ts +324 -0
  79. package/src/session/index.ts +3 -4
  80. package/src/session/toolkit.ts +27 -28
  81. package/src/templates/{format.tpl → instructions/format.tpl} +1 -4
  82. package/src/templates/{system.tpl → instructions/system.tpl} +50 -2
  83. package/src/templates/system.ts +9 -8
  84. package/src/{types → util}/artifact.ts +42 -6
  85. package/src/util/diff.test.ts +74 -0
  86. package/src/{diff.ts → util/diff.ts} +13 -4
  87. package/src/{session → util}/error-handling.ts +3 -2
  88. package/src/util/errors.ts +15 -0
  89. package/src/{execution-graph.test.ts → util/execution-graph.test.ts} +47 -45
  90. package/src/{execution-graph.ts → util/execution-graph.ts} +41 -22
  91. package/src/util/index.ts +10 -0
  92. package/src/util/tracing.ts +57 -0
  93. package/dist/lib/browser/chunk-4VIJTKPM.mjs +0 -354
  94. package/dist/lib/browser/chunk-4VIJTKPM.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 -272
  98. package/dist/lib/browser/extraction/index.mjs.map +0 -7
  99. package/dist/lib/browser/index.mjs +0 -900
  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/node-esm/chunk-AUUC7II4.mjs +0 -356
  104. package/dist/lib/node-esm/chunk-AUUC7II4.mjs.map +0 -7
  105. package/dist/lib/node-esm/chunk-BCFXTNSK.mjs +0 -91
  106. package/dist/lib/node-esm/chunk-BCFXTNSK.mjs.map +0 -7
  107. package/dist/lib/node-esm/extraction/index.mjs +0 -273
  108. package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
  109. package/dist/lib/node-esm/index.mjs +0 -901
  110. package/dist/lib/node-esm/index.mjs.map +0 -7
  111. package/dist/lib/node-esm/meta.json +0 -1
  112. package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs +0 -14
  113. package/dist/lib/node-esm/named-entity-recognition-2HDF46YX.mjs.map +0 -7
  114. package/dist/types/src/conversation/context.d.ts +0 -103
  115. package/dist/types/src/conversation/context.d.ts.map +0 -1
  116. package/dist/types/src/conversation/conversation.d.ts +0 -41
  117. package/dist/types/src/conversation/conversation.d.ts.map +0 -1
  118. package/dist/types/src/conversation/index.d.ts +0 -3
  119. package/dist/types/src/conversation/index.d.ts.map +0 -1
  120. package/dist/types/src/diff.d.ts.map +0 -1
  121. package/dist/types/src/errors.d.ts.map +0 -1
  122. package/dist/types/src/execution-graph.d.ts.map +0 -1
  123. package/dist/types/src/execution-graph.test.d.ts.map +0 -1
  124. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
  125. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
  126. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
  127. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
  128. package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
  129. package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
  130. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -345
  131. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
  132. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
  133. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
  134. package/dist/types/src/session/artifact-diff.d.ts.map +0 -1
  135. package/dist/types/src/session/error-handling.d.ts.map +0 -1
  136. package/dist/types/src/session/format.d.ts +0 -186
  137. package/dist/types/src/session/format.d.ts.map +0 -1
  138. package/dist/types/src/session/format.test.d.ts +0 -2
  139. package/dist/types/src/session/format.test.d.ts.map +0 -1
  140. package/dist/types/src/session/observer.d.ts.map +0 -1
  141. package/dist/types/src/session/session.d.ts +0 -51
  142. package/dist/types/src/session/session.d.ts.map +0 -1
  143. package/dist/types/src/session/session.test.d.ts +0 -2
  144. package/dist/types/src/session/session.test.d.ts.map +0 -1
  145. package/dist/types/src/session/version-pin.d.ts.map +0 -1
  146. package/dist/types/src/summarization/summarization.test.d.ts +0 -2
  147. package/dist/types/src/summarization/summarization.test.d.ts.map +0 -1
  148. package/dist/types/src/types/artifact.d.ts +0 -16
  149. package/dist/types/src/types/artifact.d.ts.map +0 -1
  150. package/dist/types/src/types/index.d.ts +0 -2
  151. package/dist/types/src/types/index.d.ts.map +0 -1
  152. package/src/conversation/context.ts +0 -186
  153. package/src/conversation/conversation.ts +0 -128
  154. package/src/conversation/index.ts +0 -6
  155. package/src/diff.test.ts +0 -43
  156. package/src/errors.ts +0 -15
  157. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
  158. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -72
  159. package/src/extraction/extraction-llm-function/index.ts +0 -5
  160. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -115
  161. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -64
  162. package/src/session/format.test.ts +0 -60
  163. package/src/session/session.conversations.json +0 -1
  164. package/src/session/session.test.ts +0 -149
  165. package/src/session/session.ts +0 -213
  166. package/src/summarization/summarization.test.ts +0 -202
  167. package/src/types/index.ts +0 -5
  168. /package/dist/lib/{browser/named-entity-recognition-QPYHML66.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  169. /package/dist/types/src/{diff.test.d.ts → util/diff.test.d.ts} +0 -0
  170. /package/dist/types/src/{session → util}/error-handling.d.ts +0 -0
  171. /package/dist/types/src/{execution-graph.test.d.ts → util/execution-graph.test.d.ts} +0 -0
  172. /package/src/extraction/extraction-llm-function/{instructions.tpl → transcription-instructions.tpl} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../../src/extraction/extraction.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIjF,eAAO,MAAM,eAAe;;;;;;;;;;;;;+BA+D8jc,CAAC;wBAA0C,CAAC;0BAA4C,CAAC;yBAA8F,CAAC;2BAA6C,CAAC;4BAA8C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAtD72c,CAAC;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;CAAG;AAEtF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;+BAmD6jc,CAAC;wBAA0C,CAAC;0BAA4C,CAAC;yBAA8F,CAAC;2BAA6C,CAAC;4BAA8C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAQhC,CAAC;AAEH;;GAEG;AAEH,eAAO,MAAM,wBAAwB,WAAkB,6BAA6B,KAAG,OAAO,CAAC,gBAAgB,CAqB9G,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export * from './extraction';
2
- export * from './extraction-llm-function';
3
2
  export * from './extraction-ner-function';
4
3
  export * from './quotes';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extraction/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extraction/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import * as Schema from 'effect/Schema';
2
- import { type EchoDatabase } from '@dxos/echo-db';
2
+ import { type Database } from '@dxos/echo';
3
3
  export declare const ReferencedQuotes: Schema.Struct<{
4
4
  references: Schema.mutable<Schema.Array$<Schema.Struct<{
5
5
  id: typeof Schema.String;
@@ -7,7 +7,7 @@ export declare const ReferencedQuotes: Schema.Struct<{
7
7
  }>>>;
8
8
  }>;
9
9
  export type ReferencedQuotes = Schema.Schema.Type<typeof ReferencedQuotes>;
10
- export declare const findQuotes: (quotes: string[], db: EchoDatabase) => Promise<ReferencedQuotes>;
10
+ export declare const findQuotes: (quotes: string[], db: Database.Database) => Promise<ReferencedQuotes>;
11
11
  /**
12
12
  * Finds and replaces all quotes with DXNs references.
13
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../../../src/extraction/quotes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,eAAO,MAAM,gBAAgB;;;;;EAe3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E,eAAO,MAAM,UAAU,GAAU,QAAQ,MAAM,EAAE,EAAE,IAAI,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAS7F,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,QAAQ,gBAAgB,WAYtE,CAAC"}
1
+ {"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../../../src/extraction/quotes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAK1D,eAAO,MAAM,gBAAgB;;;;;EAe3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E,eAAO,MAAM,UAAU,WAAkB,MAAM,EAAE,MAAM,QAAQ,CAAC,QAAQ,KAAG,OAAO,CAAC,gBAAgB,CASlG,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,gBAAgB,SAAU,MAAM,UAAU,gBAAgB,WAYtE,CAAC"}
@@ -1,19 +1,17 @@
1
1
  import * as Tool from '@effect/ai/Tool';
2
- import type * as Toolkit from '@effect/ai/Toolkit';
2
+ import * as Effect from 'effect/Effect';
3
3
  import * as Layer from 'effect/Layer';
4
+ import * as Option from 'effect/Option';
4
5
  import { ToolExecutionService, ToolResolverService } from '@dxos/ai';
5
- import { DatabaseService, FunctionDefinition, FunctionInvocationService } from '@dxos/functions';
6
- /**
7
- * Constructs a `ToolResolverService` whose `resolve(id)` looks up tools in the following order:
8
- * 1. Toolkit: return an existing tool from the provided `toolkit` if one is present under `id`.
9
- * 2. Functions in DB: query `FunctionType` by `key=id`; if found, deserialize and project to a tool
10
- * (propagating any `deployedFunctionId` discovered in the object's metadata).
11
- * 3. Functions passed in: fall back to a matching `FunctionDefinition` from the `functions` array.
12
- *
13
- * If none of the above yield a match, the effect fails with `AiToolNotFoundError`.
14
- *
15
- * Requires `DatabaseService` in the environment.
16
- */
17
- export declare const makeToolResolverFromFunctions: (functions: FunctionDefinition<any, any>[], toolkit: Toolkit.Toolkit<any>) => Layer.Layer<ToolResolverService, never, DatabaseService>;
18
- export declare const makeToolExecutionServiceFromFunctions: (toolkit: Toolkit.Toolkit<any>, handlersLayer: Layer.Layer<Tool.Handler<any>, never, never>) => Layer.Layer<ToolExecutionService, never, FunctionInvocationService>;
6
+ import { OpaqueToolkit } from '@dxos/ai';
7
+ import { Operation, OperationRegistry } from '@dxos/compute';
8
+ export declare const makeToolResolverFromOperations: <R = never>({ toolkit: extraToolkit, }?: {
9
+ toolkit?: OpaqueToolkit.OpaqueToolkit<never, never, R>;
10
+ }) => Layer.Layer<ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | OperationRegistry.Service | R>;
11
+ export declare const makeToolExecutionService: <E, R>(opts: {
12
+ invoke: (tool: Tool.Any, input: unknown) => Effect.Effect<unknown>;
13
+ }) => Layer.Layer<ToolExecutionService, never, OpaqueToolkit.OpaqueToolkitProvider>;
14
+ export declare const makeToolExecutionServiceFromOperationInvoker: () => Layer.Layer<ToolExecutionService, never, Operation.Service | OpaqueToolkit.OpaqueToolkitProvider>;
15
+ export declare const ToolExecutionServices: Layer.Layer<ToolExecutionService | ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Operation.Service | OperationRegistry.Service>;
16
+ export declare const getOperationFromTool: (tool: Tool.Any) => Option.Option<Operation.Definition.Any>;
19
17
  //# sourceMappingURL=services.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/functions/services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAuB,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG1F,OAAO,EAAE,eAAe,EAAY,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAG3G;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,GACxC,WAAW,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EACzC,SAAS,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAC5B,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,EAAE,eAAe,CA8BzD,CAAC;AAEF,eAAO,MAAM,qCAAqC,GAChD,SAAS,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAC7B,eAAe,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAC1D,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,EAAE,yBAAyB,CAmCpE,CAAC"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/functions/services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,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conversation';
2
- export * from './diff';
3
- export * from './errors';
4
- export * from './execution-graph';
5
1
  export * from './functions';
2
+ export * from './request';
6
3
  export * from './session';
7
4
  export * from './templates';
8
- export * from './types';
5
+ export * from './util';
9
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,104 @@
1
+ import type * as AiError from '@effect/ai/AiError';
2
+ import * as LanguageModel from '@effect/ai/LanguageModel';
3
+ import * as Effect from 'effect/Effect';
4
+ import { type AiToolNotFoundError, type OpaqueToolkit, type PromptPreprocessingError, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
5
+ import { type Blueprint, Trace, Operation, OperationRegistry } from '@dxos/compute';
6
+ import { Database, Obj } from '@dxos/echo';
7
+ import { ContentBlock, Message } from '@dxos/types';
8
+ import { type AiAssistantError } from '../util';
9
+ import { GenerationObserver } from './observer';
10
+ export type RunError = AiError.AiError | PromptPreprocessingError | AiToolNotFoundError | AiAssistantError;
11
+ export type RunRequirements = LanguageModel.LanguageModel | ToolExecutionService | ToolResolverService | Database.Service | Operation.Service | OperationRegistry.Service | Trace.TraceService;
12
+ export type Options = {
13
+ /**
14
+ * Summarize before executing the prompt if the existing history exceeds this threshold.
15
+ */
16
+ summarizationThreshold?: number;
17
+ observer?: GenerationObserver;
18
+ /**
19
+ * Callback for when a message is received from the user, model, or tool.
20
+ * This is useful for streaming the output to a queue.
21
+ */
22
+ onOutput?: (message: Message.Message) => Effect.Effect<void, never, never>;
23
+ };
24
+ export type RunProps<R = never> = {
25
+ prompt: string | ContentBlock.Any[];
26
+ system?: string;
27
+ history?: Message.Message[];
28
+ objects?: Obj.Unknown[];
29
+ blueprints?: readonly Blueprint.Blueprint[];
30
+ toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
31
+ };
32
+ export type BeginProps = {
33
+ prompt: string | ContentBlock.Any[];
34
+ system?: string;
35
+ history?: Message.Message[];
36
+ objects?: Obj.Unknown[];
37
+ blueprints?: readonly Blueprint.Blueprint[];
38
+ };
39
+ export type TurnProps<R = never> = {
40
+ system: string;
41
+ toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
42
+ };
43
+ export type TurnResult = {
44
+ messages: Message.Message[];
45
+ done: boolean;
46
+ };
47
+ /**
48
+ * Contains message history, tools, current context.
49
+ * Current context means the state of the app, time of day, and other contextual information.
50
+ * It makes requests to the model, its a state machine.
51
+ * It keeps track of the current goal.
52
+ * It manages the context window.
53
+ * Tracks the success criteria of reaching the goal, exposing metrics (stretch).
54
+ * Could be run locally in the app or remotely.
55
+ * Could be personal or shared.
56
+ */
57
+ export declare class Request {
58
+ private readonly _options;
59
+ /** Prevents concurrent execution of session. */
60
+ private readonly _semaphore;
61
+ private readonly _observer;
62
+ private readonly _onOutput;
63
+ /** Message history from queue. */
64
+ private _history;
65
+ /** Pending messages for this session (incl. the current prompt). */
66
+ private _pending;
67
+ private _started;
68
+ private _ended;
69
+ private _toolCalls;
70
+ constructor(_options?: Options);
71
+ get duration(): number;
72
+ get toolCalls(): number;
73
+ get pending(): readonly Message.Message[];
74
+ private _submitMessage;
75
+ getToolCalls: () => {
76
+ block: {
77
+ readonly _tag: "toolCall";
78
+ readonly pending?: boolean | undefined;
79
+ readonly toolCallId: string;
80
+ readonly name: string;
81
+ readonly input: string;
82
+ readonly providerExecuted: boolean;
83
+ };
84
+ message: Message.Message;
85
+ }[];
86
+ /**
87
+ * Initialize a session: set up history, perform summarization if needed, and submit the user prompt.
88
+ * Must be called before `runTurn()`.
89
+ */
90
+ begin: ({ prompt, system, history, blueprints, objects, }: BeginProps) => Effect.Effect<void, RunError, RunRequirements>;
91
+ /**
92
+ * Execute a single turn: one LLM generation followed by tool execution.
93
+ * The toolkit and system prompt can be updated between turns to reflect context changes (e.g. dynamically enabled blueprints).
94
+ */
95
+ runAgentTurn: <const R = never>({ system, toolkit: opaqueToolkit, }: TurnProps<R>) => Effect.Effect<TurnResult, RunError, RunRequirements | R>;
96
+ runTools: <const R = never>({ toolkit: opaqueToolkit, }: {
97
+ toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
98
+ }) => Effect.Effect<void, RunError, RunRequirements | R>;
99
+ /**
100
+ * Run a full conversation turn loop. Equivalent to calling `begin()` then `runTurn()` in a loop.
101
+ */
102
+ run: <const R = never>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, }: RunProps<R>) => Effect.Effect<Message.Message[], RunError, RunRequirements | R>;
103
+ }
104
+ //# sourceMappingURL=AiRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiRequest.d.ts","sourceRoot":"","sources":["../../../../src/request/AiRequest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAG1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,EAIL,KAAK,mBAAmB,EAExB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAEzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EA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DAMF,UAAU,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,CAAC,CAqBhB;IAE9C;;;OAGG;IACH,YAAY,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,uCAG5B,SAAS,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CA2ErB;IAErD,QAAQ,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,+BAExB;QACD,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;KAC1C,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAoBL;IAEjD;;OAEG;IACH,GAAG,GAAI,KAAK,CAAC,CAAC,GAAG,KAAK,8EAOnB,QAAQ,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAgBJ;CAC7E"}
@@ -1,6 +1,6 @@
1
1
  import * as Context from 'effect/Context';
2
- import { type ObjectId } from '@dxos/echo/internal';
3
2
  import { type ObjectVersion } from '@dxos/echo-db';
3
+ import { type ObjectId } from '@dxos/keys';
4
4
  declare const ArtifactDiffResolver_base: Context.TagClass<ArtifactDiffResolver, "@dxos/assistant/ArtifactDiffResolver", ArtifactDiffResolver.Service>;
5
5
  /**
6
6
  * Resolves artifact ids to their versions.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-diff.d.ts","sourceRoot":"","sources":["../../../../src/request/artifact-diff.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;;AAE3C;;;;;;;GAOG;AAEH,qBAAa,oBAAqB,SAAQ,yBAGvC;CAAG;AAEN,yBAAiB,oBAAoB,CAAC,CAAC;IACrC,KAAY,OAAO,GAAG;QACpB,OAAO,EAAE,CACP,SAAS,EAAE;YACT,EAAE,EAAE,QAAQ,CAAC;YACb,WAAW,EAAE,aAAa,CAAC;SAC5B,EAAE,KACA,OAAO,CACV,GAAG,CACD,QAAQ,EACR;YACE,OAAO,EAAE,aAAa,CAAC;YACvB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CACF,CACF,CAAC;KACH,CAAC;CACH"}
@@ -0,0 +1,15 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import { type FunctionNotFoundError, type Operation, type OperationRegistry } from '@dxos/compute';
3
+ import { type Database } from '@dxos/echo';
4
+ import { type ObjectNotFoundError } from '@dxos/echo/Err';
5
+ import { Message } from '@dxos/types';
6
+ import type * as AiRequest from './AiRequest';
7
+ /**
8
+ * Formats the system prompt.
9
+ */
10
+ export declare const formatSystemPrompt: ({ system, blueprints, objects, }: Pick<AiRequest.RunProps, 'system' | 'blueprints' | 'objects'>) => Effect.Effect<string, FunctionNotFoundError | ObjectNotFoundError, Database.Service | OperationRegistry.Service | Operation.Service>;
11
+ /**
12
+ * Formats the user prompt.
13
+ */
14
+ export declare const formatUserPrompt: ({ prompt, history, }: Pick<AiRequest.RunProps, 'prompt' | 'history'>) => Effect.Effect<Message.Message, AiRequest.RunError>;
15
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/request/format.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAY,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,KAAK,QAAQ,EAAO,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAIzD,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAG9C;;GAEG;AAEH,eAAO,MAAM,kBAAkB,qCAI5B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAC9E,MAAM,EACN,qBAAqB,GAAG,mBAAmB,EAC3C,QAAQ,CAAC,OAAO,GAAG,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAuClB,CAAC;AAEjD;;GAEG;AAGH,eAAO,MAAM,gBAAgB,yBAG1B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAoCvD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './format';
2
+ export * from './observer';
3
+ export * as AiRequest from './AiRequest';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/request/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAE3B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC"}
@@ -1,22 +1,23 @@
1
+ import type * as Tool from '@effect/ai/Tool';
1
2
  import * as Effect from 'effect/Effect';
2
3
  import { type AiParser, type ConsolePrinter } from '@dxos/ai';
3
- import { type DataType } from '@dxos/schema';
4
+ import { type Message } from '@dxos/types';
4
5
  /**
5
6
  * Live observer of the generation process.
6
7
  */
7
- export interface GenerationObserver extends AiParser.ParseResponseCallbacks {
8
+ export interface GenerationObserver<Tools extends Record<string, Tool.Any> = any> extends AiParser.ParseResponseCallbacks<Tools> {
8
9
  /**
9
10
  * Complete messages fired during the session, both from the model and from the user.
10
11
  * This message will contain all message blocks emitted through the `onBlock` callback.
11
12
  */
12
- onMessage: (message: DataType.Message) => Effect.Effect<void>;
13
+ onMessage: (message: Message.Message) => Effect.Effect<void>;
13
14
  }
14
15
  export declare const GenerationObserver: Readonly<{
15
16
  make: ({ onBegin, onPart, onBlock, onEnd, onMessage, }?: Partial<GenerationObserver>) => GenerationObserver;
16
- noop: () => GenerationObserver;
17
+ noop: () => GenerationObserver<any>;
17
18
  /**
18
19
  * Debug printer to be used in unit-tests and browser devtools.
19
20
  */
20
- fromPrinter: (printer: ConsolePrinter) => GenerationObserver;
21
+ fromPrinter: (printer: ConsolePrinter) => GenerationObserver<any>;
21
22
  }>;
22
23
  //# sourceMappingURL=observer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../../src/request/observer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,kBAAkB,CACjC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAC5C,SAAQ,QAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC;IAC9C;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,eAAO,MAAM,kBAAkB;6DAO1B,OAAO,CAAC,kBAAkB,CAAC,KAAQ,kBAAkB;;IAUxD;;OAEG;2BACoB,cAAc;EAiBrC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import * as Schema from 'effect/Schema';
2
- import { type AnyEchoObject } from '@dxos/echo/internal';
2
+ import { type Obj } from '@dxos/echo';
3
3
  import { type ObjectVersion } from '@dxos/echo-db';
4
- import { type ContentBlock } from '@dxos/schema';
4
+ import { type ContentBlock } from '@dxos/types';
5
5
  declare const VersionPinSchema: Schema.Struct<{
6
6
  objectId: import("@dxos/keys").ObjectIdClass;
7
7
  version: Schema.Schema<ObjectVersion, ObjectVersion, never>;
@@ -14,7 +14,7 @@ export interface VersionPin extends Schema.Schema.Type<typeof VersionPinSchema>
14
14
  }
15
15
  export declare const VersionPin: typeof VersionPinSchema & {
16
16
  DISPOSITION: 'version-pin';
17
- fromObject: (object: AnyEchoObject) => VersionPin;
17
+ fromObject: (object: Obj.Unknown) => VersionPin;
18
18
  createBlock: (pin: VersionPin) => ContentBlock.Any;
19
19
  };
20
20
  export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/request/version-pin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,QAAA,MAAM,gBAAgB;;;EAKpB,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AAElF,eAAO,MAAM,UAAU,EAAE,OAAO,gBAAgB,GAAG;IACjD,WAAW,EAAE,aAAa,CAAC;IAC3B,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC;IAChD,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,YAAY,CAAC,GAAG,CAAC;CAiBpD,CAAC"}
@@ -0,0 +1,154 @@
1
+ import { Atom, Registry } from '@effect-atom/atom-react';
2
+ import * as Context from 'effect/Context';
3
+ import * as Effect from 'effect/Effect';
4
+ import * as Runtime from 'effect/Runtime';
5
+ import * as Schema from 'effect/Schema';
6
+ import { Blueprint } from '@dxos/compute';
7
+ import { Resource } from '@dxos/context';
8
+ import { DXN, Feed, Obj, Ref, Type } from '@dxos/echo';
9
+ import { ComplexSet } from '@dxos/util';
10
+ /**
11
+ * Thread message that binds or unbinds contextual objects to a conversation.
12
+ */
13
+ export declare const Binding: Type.Obj<{
14
+ readonly blueprints: {
15
+ readonly added: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
16
+ readonly name: string;
17
+ readonly description?: string | undefined;
18
+ readonly instructions: {
19
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
20
+ readonly name?: string | undefined;
21
+ readonly content: string;
22
+ }>;
23
+ readonly inputs?: readonly {
24
+ readonly name: string;
25
+ readonly kind: "operation" | "value";
26
+ readonly default?: any;
27
+ readonly operation?: string | undefined;
28
+ }[] | undefined;
29
+ };
30
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
31
+ readonly agentCanEnable?: boolean | undefined;
32
+ readonly mcpServers?: readonly {
33
+ readonly name?: string | undefined;
34
+ readonly url: string;
35
+ readonly protocol: "http" | "sse";
36
+ readonly apiKey?: string | undefined;
37
+ }[] | undefined;
38
+ }>[];
39
+ readonly removed: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
40
+ readonly name: string;
41
+ readonly description?: string | undefined;
42
+ readonly instructions: {
43
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
44
+ readonly name?: string | undefined;
45
+ readonly content: string;
46
+ }>;
47
+ readonly inputs?: readonly {
48
+ readonly name: string;
49
+ readonly kind: "operation" | "value";
50
+ readonly default?: any;
51
+ readonly operation?: string | undefined;
52
+ }[] | undefined;
53
+ };
54
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
55
+ readonly agentCanEnable?: boolean | undefined;
56
+ readonly mcpServers?: readonly {
57
+ readonly name?: string | undefined;
58
+ readonly url: string;
59
+ readonly protocol: "http" | "sse";
60
+ readonly apiKey?: string | undefined;
61
+ }[] | undefined;
62
+ }>[];
63
+ };
64
+ readonly objects: {
65
+ readonly added: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
66
+ readonly removed: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
67
+ };
68
+ }, Schema.Struct.Fields>;
69
+ export interface Binding extends Schema.Schema.Type<typeof Binding> {
70
+ }
71
+ export type BindingProps = Partial<{
72
+ blueprints: Ref.Ref<Blueprint.Blueprint>[];
73
+ objects: Ref.Ref<Obj.Unknown>[];
74
+ }>;
75
+ export declare class Bindings {
76
+ readonly blueprints: ComplexSet<Ref.Ref<Blueprint.Blueprint>>;
77
+ readonly objects: ComplexSet<Ref.Ref<Obj.Unknown>>;
78
+ toJSON(): {
79
+ blueprints: DXN.String[];
80
+ objects: DXN.String[];
81
+ };
82
+ }
83
+ export type BinderOptions = {
84
+ feed: Feed.Feed;
85
+ runtime: Runtime.Runtime<Feed.FeedService>;
86
+ registry?: Registry.Registry;
87
+ };
88
+ /**
89
+ * Manages bindings of blueprints and objects to a conversation.
90
+ */
91
+ export declare class Binder extends Resource {
92
+ #private;
93
+ private readonly _blueprints;
94
+ private readonly _objects;
95
+ private readonly _registry;
96
+ private readonly _feed;
97
+ private readonly _runtime;
98
+ constructor(options: BinderOptions);
99
+ /**
100
+ * Returns the blueprints atom for subscription.
101
+ */
102
+ get blueprints(): Atom.Atom<Blueprint.Blueprint[]>;
103
+ /**
104
+ * Returns the objects atom for subscription.
105
+ */
106
+ get objects(): Atom.Atom<Obj.Unknown[]>;
107
+ /**
108
+ * Gets the current blueprints value.
109
+ */
110
+ getBlueprints(): Blueprint.Blueprint[];
111
+ /**
112
+ * Gets the current objects value.
113
+ */
114
+ getObjects(): Obj.Unknown[];
115
+ /**
116
+ * Subscribe to changes in blueprints.
117
+ */
118
+ subscribeBlueprints(cb: (blueprints: Blueprint.Blueprint[]) => void): () => void;
119
+ /**
120
+ * Subscribe to changes in objects.
121
+ */
122
+ subscribeObjects(cb: (objects: Obj.Unknown[]) => void): () => void;
123
+ protected _open(): Promise<void>;
124
+ /**
125
+ * Re-reads bindings from the feed to pick up changes made by other processes.
126
+ */
127
+ sync(): Promise<void>;
128
+ private _updateBindings;
129
+ protected _close(): Promise<void>;
130
+ bind({ blueprints, objects }: BindingProps): Promise<void>;
131
+ unbind({ blueprints, objects }: BindingProps): Promise<void>;
132
+ /**
133
+ * Process bindings to filter duplicates and determine next state.
134
+ */
135
+ private _processBindings;
136
+ /**
137
+ * Reduce results into sets of blueprints and objects.
138
+ */
139
+ private _reduce;
140
+ /**
141
+ * Merge resolved items into the current set, adding only items not already present (by DXN).
142
+ */
143
+ private _mergeInto;
144
+ private _resolve;
145
+ }
146
+ declare const Service_base: Context.TagClass<Service, "@dxos/assistant/AiContextService", {
147
+ binder: Binder;
148
+ }>;
149
+ export declare class Service extends Service_base {
150
+ static bindContext: ({ blueprints, objects }: BindingProps) => Effect.Effect<void, never, Service>;
151
+ static findObjects: <T extends Type.AnyEntity>(type: T) => Effect.Effect<Schema.Schema.Type<T>[], never, Service>;
152
+ }
153
+ export {};
154
+ //# sourceMappingURL=AiContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiContext.d.ts","sourceRoot":"","sources":["../../../../src/session/AiContext.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,QA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AI,CAAC,CAsCjE;IAED;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA8BxB;;OAEG;IACH,OAAO,CAAC,OAAO;IAqBf;;OAEG;IACH,OAAO,CAAC,UAAU;YAgBJ,QAAQ;CAmBvB;;YAKW,MAAM;;AAHlB,qBAAa,OAAQ,SAAQ,YAK1B;IACD,MAAM,CAAC,WAAW,4BAA6B,YAAY,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAI5F;IAEL,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,IAAI,CAAC,SAAS,QAAQ,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAK9G;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AiContext.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiContext.test.d.ts","sourceRoot":"","sources":["../../../../src/session/AiContext.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,73 @@
1
+ import { type Registry } from '@effect-atom/atom-react';
2
+ import * as Context from 'effect/Context';
3
+ import * as Effect from 'effect/Effect';
4
+ import * as Layer from 'effect/Layer';
5
+ import * as Runtime from 'effect/Runtime';
6
+ import { type OpaqueToolkit, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
7
+ import { type OperationRegistry, McpServer, Operation } from '@dxos/compute';
8
+ import { Resource } from '@dxos/context';
9
+ import { Database, Feed } from '@dxos/echo';
10
+ import { Message, type ContentBlock } from '@dxos/types';
11
+ import { AiRequest, type GenerationObserver } from '../request';
12
+ import * as AiContext from './AiContext';
13
+ export type RunProps<R = never> = {
14
+ prompt: string | ContentBlock.Any[];
15
+ system?: string;
16
+ observer?: GenerationObserver;
17
+ toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
18
+ /**
19
+ * Space-level MCP servers to connect alongside blueprint-defined ones.
20
+ */
21
+ mcpServers?: readonly McpServer.McpServer[];
22
+ };
23
+ export type Options = {
24
+ feed: Feed.Feed;
25
+ runtime: Runtime.Runtime<Feed.FeedService>;
26
+ registry?: Registry.Registry;
27
+ };
28
+ /**
29
+ * Durable conversation state (initiated by users and agents) backed by a Feed.
30
+ * Executes tools based on AI responses and supports cancellation of in-progress requests.
31
+ */
32
+ export declare class Session extends Resource {
33
+ /**
34
+ * Blueprints and objects bound to the session.
35
+ */
36
+ private readonly _binder;
37
+ private readonly _feed;
38
+ private readonly _runtime;
39
+ constructor(options: Options);
40
+ protected _open(): Promise<void>;
41
+ get feed(): Feed.Feed;
42
+ get context(): AiContext.Binder;
43
+ getHistory(): Promise<Message.Message[]>;
44
+ getTools(): Effect.Effect<Record<string, import('@effect/ai/Tool').Any>, never, ToolExecutionService | ToolResolverService>;
45
+ /**
46
+ * Not provided by default, since users might want to override them.
47
+ */
48
+ makeToolExecutionServices(): Layer.Layer<ToolExecutionService | ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Operation.Service | OperationRegistry.Service>;
49
+ /**
50
+ * Creates a new cancelable request effect.
51
+ */
52
+ createRequest<R = never>(params: RunProps<R>): Effect.Effect<Message.Message[], AiRequest.RunError, AiRequest.RunRequirements | R>;
53
+ }
54
+ declare const Service_base: Context.TagClass<Service, "@dxos/assistant/AiSessionService", Session>;
55
+ /**
56
+ * Gives access to the ai session.
57
+ */
58
+ export declare class Service extends Service_base {
59
+ /**
60
+ * Create a new session layer from options.
61
+ */
62
+ static layer: (options: Options) => Layer.Layer<Service | AiContext.Service>;
63
+ /**
64
+ * Create a new session with a new feed.
65
+ */
66
+ static layerNewFeed: (options?: Omit<Options, 'feed' | 'runtime'>) => Layer.Layer<Service | AiContext.Service, never, Database.Service | Feed.FeedService>;
67
+ /**
68
+ * Run a prompt in the current session.
69
+ */
70
+ static run: <R = never>(params: RunProps<R>) => Effect.Effect<Message.Message[], AiRequest.RunError, AiRequest.RunRequirements | Service | R>;
71
+ }
72
+ export {};
73
+ //# sourceMappingURL=AiSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSession.d.ts","sourceRoot":"","sources":["../../../../src/session/AiSession.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACnG,OAAO,EAAkB,KAAK,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAS,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAe,MAAM,YAAY,CAAC;AAKzD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAAsB,MAAM,YAAY,CAAC;AAEpF,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,KAAK,IAAI;IAChC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEzC;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,SAAS,CAAC,SAAS,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,OAAO,GAA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Aa,OAAO,KAAG,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAWvE;IAEJ;;OAEG;IACH,MAAM,CAAC,YAAY,aACP,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,KAC1C,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,CAOnF;IAEJ;;OAEG;IACH,MAAM,CAAC,GAAG,GAAI,CAAC,GAAG,KAAK,UACb,QAAQ,CAAC,CAAC,CAAC,KAClB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,eAAe,GAAG,OAAO,GAAG,CAAC,CAAC,CAI3F;CACN"}
@@ -1,6 +1,4 @@
1
- export * from './artifact-diff';
2
- export * from './observer';
3
- export * from './session';
4
1
  export * from './toolkit';
5
- export * from './version-pin';
2
+ export * as AiContext from './AiContext';
3
+ export * as AiSession from './AiSession';
6
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC"}
@@ -1,15 +1,16 @@
1
- import type * as Tool from '@effect/ai/Tool';
2
- import * as Toolkit from '@effect/ai/Toolkit';
3
1
  import * as Effect from 'effect/Effect';
4
- import { type AiToolNotFoundError, ToolExecutionService, type ToolId, ToolResolverService } from '@dxos/ai';
5
- import { type Blueprint } from '@dxos/blueprints';
6
- export type ToolkitParams<Tools extends Record<string, Tool.Any>> = {
7
- toolkit?: Toolkit.Toolkit<Tools>;
8
- toolIds?: ToolId[];
9
- blueprints?: Blueprint.Blueprint[];
2
+ import { type AiToolNotFoundError, OpaqueToolkit, ToolExecutionService, ToolResolverService } from '@dxos/ai';
3
+ import { type Blueprint } from '@dxos/compute';
4
+ export type CreateToolkitProps = {
5
+ toolkit?: OpaqueToolkit.Any;
6
+ blueprints?: readonly Blueprint.Blueprint[];
7
+ /**
8
+ * Self-contained with handlers toolkits.
9
+ */
10
+ opaqueToolkits?: readonly OpaqueToolkit.Any[];
10
11
  };
11
12
  /**
12
13
  * Build a combined toolkit from the blueprint tools and the provided toolkit.
13
14
  */
14
- export declare const createToolkit: <Tools extends Record<string, Tool.Any> = {}>({ toolkit: toolkitParam, toolIds, blueprints, }: ToolkitParams<Tools>) => Effect.Effect<Toolkit.WithHandler<any>, AiToolNotFoundError, ToolResolverService | ToolExecutionService | Tool.HandlersFor<Tools>>;
15
+ export declare const createToolkit: ({ toolkit: toolkitProp, blueprints, opaqueToolkits, }: CreateToolkitProps) => Effect.Effect<OpaqueToolkit.OpaqueToolkit, AiToolNotFoundError, ToolResolverService | ToolExecutionService>;
15
16
  //# sourceMappingURL=toolkit.d.ts.map