@dxos/assistant 0.8.4-main.fffef41 → 0.9.0

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 (174) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +2 -1
  3. package/dist/lib/{browser → neutral}/extraction/index.mjs +42 -59
  4. package/dist/lib/neutral/extraction/index.mjs.map +7 -0
  5. package/dist/lib/neutral/index.mjs +1886 -0
  6. package/dist/lib/neutral/index.mjs.map +7 -0
  7. package/dist/lib/neutral/meta.json +1 -0
  8. package/dist/types/src/extraction/extraction-ner-function/index.d.ts +0 -1
  9. package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -1
  10. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
  11. package/dist/types/src/extraction/extraction.d.ts +1649 -317
  12. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  13. package/dist/types/src/extraction/index.d.ts +0 -1
  14. package/dist/types/src/extraction/index.d.ts.map +1 -1
  15. package/dist/types/src/extraction/quotes.d.ts +2 -2
  16. package/dist/types/src/extraction/quotes.d.ts.map +1 -1
  17. package/dist/types/src/functions/services.d.ts +14 -16
  18. package/dist/types/src/functions/services.d.ts.map +1 -1
  19. package/dist/types/src/index.d.ts +2 -5
  20. package/dist/types/src/index.d.ts.map +1 -1
  21. package/dist/types/src/request/AiRequest.d.ts +308 -0
  22. package/dist/types/src/request/AiRequest.d.ts.map +1 -0
  23. package/dist/types/src/{session → request}/artifact-diff.d.ts +4 -4
  24. package/dist/types/src/request/artifact-diff.d.ts.map +1 -0
  25. package/dist/types/src/request/format.d.ts +15 -0
  26. package/dist/types/src/request/format.d.ts.map +1 -0
  27. package/dist/types/src/request/index.d.ts +4 -0
  28. package/dist/types/src/request/index.d.ts.map +1 -0
  29. package/dist/types/src/{session → request}/observer.d.ts +4 -3
  30. package/dist/types/src/request/observer.d.ts.map +1 -0
  31. package/dist/types/src/{session → request}/version-pin.d.ts +4 -4
  32. package/dist/types/src/request/version-pin.d.ts.map +1 -0
  33. package/dist/types/src/session/AiContext.d.ts +178 -0
  34. package/dist/types/src/session/AiContext.d.ts.map +1 -0
  35. package/dist/types/src/session/AiContext.test.d.ts +2 -0
  36. package/dist/types/src/session/AiContext.test.d.ts.map +1 -0
  37. package/dist/types/src/session/AiSession.d.ts +79 -0
  38. package/dist/types/src/session/AiSession.d.ts.map +1 -0
  39. package/dist/types/src/session/AiSession.test.d.ts +2 -0
  40. package/dist/types/src/session/AiSession.test.d.ts.map +1 -0
  41. package/dist/types/src/session/SessionLink.d.ts +17 -0
  42. package/dist/types/src/session/SessionLink.d.ts.map +1 -0
  43. package/dist/types/src/session/SessionLoader.d.ts +15 -0
  44. package/dist/types/src/session/SessionLoader.d.ts.map +1 -0
  45. package/dist/types/src/session/SessionLoader.test.d.ts +2 -0
  46. package/dist/types/src/session/SessionLoader.test.d.ts.map +1 -0
  47. package/dist/types/src/session/index.d.ts +4 -5
  48. package/dist/types/src/session/index.d.ts.map +1 -1
  49. package/dist/types/src/session/toolkit.d.ts +10 -9
  50. package/dist/types/src/session/toolkit.d.ts.map +1 -1
  51. package/dist/types/src/templates/system.d.ts +12 -3
  52. package/dist/types/src/templates/system.d.ts.map +1 -1
  53. package/dist/types/src/util/artifact.d.ts +18 -0
  54. package/dist/types/src/util/artifact.d.ts.map +1 -0
  55. package/dist/types/src/{diff.d.ts → util/diff.d.ts} +4 -2
  56. package/dist/types/src/util/diff.d.ts.map +1 -0
  57. package/dist/types/src/{diff.test.d.ts.map → util/diff.test.d.ts.map} +1 -1
  58. package/dist/types/src/util/error-handling.d.ts.map +1 -0
  59. package/dist/types/src/{errors.d.ts → util/errors.d.ts} +24 -28
  60. package/dist/types/src/util/errors.d.ts.map +1 -0
  61. package/dist/types/src/{execution-graph.d.ts → util/execution-graph.d.ts} +2 -2
  62. package/dist/types/src/util/execution-graph.d.ts.map +1 -0
  63. package/dist/types/src/util/execution-graph.test.d.ts.map +1 -0
  64. package/dist/types/src/util/index.d.ts +7 -0
  65. package/dist/types/src/util/index.d.ts.map +1 -0
  66. package/dist/types/src/util/tracing.d.ts +296 -0
  67. package/dist/types/src/util/tracing.d.ts.map +1 -0
  68. package/dist/types/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +36 -44
  70. package/src/extraction/extraction-ner-function/index.ts +0 -1
  71. package/src/extraction/extraction.ts +47 -18
  72. package/src/extraction/index.ts +0 -1
  73. package/src/extraction/quotes.test.ts +2 -2
  74. package/src/extraction/quotes.ts +6 -8
  75. package/src/functions/services.ts +129 -63
  76. package/src/index.ts +2 -5
  77. package/src/request/AiRequest.ts +387 -0
  78. package/src/{session → request}/artifact-diff.ts +4 -4
  79. package/src/{session → request}/format.ts +28 -25
  80. package/src/request/index.ts +8 -0
  81. package/src/{session → request}/observer.ts +4 -1
  82. package/src/{session → request}/version-pin.ts +6 -5
  83. package/src/session/AiContext.test.ts +49 -0
  84. package/src/session/AiContext.ts +420 -0
  85. package/src/session/AiSession.test.ts +111 -0
  86. package/src/session/AiSession.ts +328 -0
  87. package/src/session/SessionLink.ts +23 -0
  88. package/src/session/SessionLoader.test.ts +115 -0
  89. package/src/session/SessionLoader.ts +55 -0
  90. package/src/session/index.ts +4 -5
  91. package/src/session/toolkit.ts +27 -28
  92. package/src/templates/instructions/format.tpl +0 -4
  93. package/src/templates/instructions/system.tpl +50 -2
  94. package/src/templates/system.ts +7 -6
  95. package/src/util/artifact.ts +96 -0
  96. package/src/util/diff.test.ts +74 -0
  97. package/src/{diff.ts → util/diff.ts} +14 -5
  98. package/src/{session → util}/error-handling.ts +3 -2
  99. package/src/util/errors.ts +15 -0
  100. package/src/{execution-graph.test.ts → util/execution-graph.test.ts} +4 -4
  101. package/src/{execution-graph.ts → util/execution-graph.ts} +30 -19
  102. package/src/util/index.ts +10 -0
  103. package/src/util/tracing.ts +60 -0
  104. package/dist/lib/browser/extraction/index.mjs.map +0 -7
  105. package/dist/lib/browser/index.mjs +0 -1290
  106. package/dist/lib/browser/index.mjs.map +0 -7
  107. package/dist/lib/browser/meta.json +0 -1
  108. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  109. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  110. package/dist/lib/node-esm/extraction/index.mjs +0 -226
  111. package/dist/lib/node-esm/extraction/index.mjs.map +0 -7
  112. package/dist/lib/node-esm/index.mjs +0 -1291
  113. package/dist/lib/node-esm/index.mjs.map +0 -7
  114. package/dist/lib/node-esm/meta.json +0 -1
  115. package/dist/types/src/conversation/context.d.ts +0 -103
  116. package/dist/types/src/conversation/context.d.ts.map +0 -1
  117. package/dist/types/src/conversation/conversation.d.ts +0 -41
  118. package/dist/types/src/conversation/conversation.d.ts.map +0 -1
  119. package/dist/types/src/conversation/index.d.ts +0 -3
  120. package/dist/types/src/conversation/index.d.ts.map +0 -1
  121. package/dist/types/src/diff.d.ts.map +0 -1
  122. package/dist/types/src/errors.d.ts.map +0 -1
  123. package/dist/types/src/execution-graph.d.ts.map +0 -1
  124. package/dist/types/src/execution-graph.test.d.ts.map +0 -1
  125. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
  126. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
  127. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
  128. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
  129. package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
  130. package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
  131. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -345
  132. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
  133. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
  134. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
  135. package/dist/types/src/session/GenericToolkit.d.ts +0 -84
  136. package/dist/types/src/session/GenericToolkit.d.ts.map +0 -1
  137. package/dist/types/src/session/artifact-diff.d.ts.map +0 -1
  138. package/dist/types/src/session/error-handling.d.ts.map +0 -1
  139. package/dist/types/src/session/format.d.ts +0 -12
  140. package/dist/types/src/session/format.d.ts.map +0 -1
  141. package/dist/types/src/session/format.test.d.ts +0 -2
  142. package/dist/types/src/session/format.test.d.ts.map +0 -1
  143. package/dist/types/src/session/observer.d.ts.map +0 -1
  144. package/dist/types/src/session/session.d.ts +0 -51
  145. package/dist/types/src/session/session.d.ts.map +0 -1
  146. package/dist/types/src/session/session.test.d.ts +0 -2
  147. package/dist/types/src/session/session.test.d.ts.map +0 -1
  148. package/dist/types/src/session/version-pin.d.ts.map +0 -1
  149. package/dist/types/src/types/artifact.d.ts +0 -20
  150. package/dist/types/src/types/artifact.d.ts.map +0 -1
  151. package/dist/types/src/types/index.d.ts +0 -2
  152. package/dist/types/src/types/index.d.ts.map +0 -1
  153. package/src/conversation/context.ts +0 -186
  154. package/src/conversation/conversation.ts +0 -128
  155. package/src/conversation/index.ts +0 -6
  156. package/src/diff.test.ts +0 -43
  157. package/src/errors.ts +0 -15
  158. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
  159. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -62
  160. package/src/extraction/extraction-llm-function/index.ts +0 -5
  161. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -116
  162. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -56
  163. package/src/session/GenericToolkit.ts +0 -130
  164. package/src/session/format.test.ts +0 -61
  165. package/src/session/session.conversations.json +0 -1
  166. package/src/session/session.test.ts +0 -149
  167. package/src/session/session.ts +0 -213
  168. package/src/types/artifact.ts +0 -71
  169. package/src/types/index.ts +0 -5
  170. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  171. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
  172. /package/dist/types/src/{diff.test.d.ts → util/diff.test.d.ts} +0 -0
  173. /package/dist/types/src/{session → util}/error-handling.d.ts +0 -0
  174. /package/dist/types/src/{execution-graph.test.d.ts → util/execution-graph.test.d.ts} +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,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,eAAO,MAAM,eAAe;;;;;;;;;;;;+BAoBJ,CAAC;;wBACG,CAAC;0BAIT,CAAC;yBAKc,CAAA;2BACd,CAAA;4BACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAvBf,CAAC;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;CAAG;AAEtF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;+BAQL,CAAC;;wBACG,CAAC;0BAIT,CAAC;yBAKc,CAAA;2BACd,CAAA;4BACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAjBf,CAAC;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAStC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAShC,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;AAI1D,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,20 +1,18 @@
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 } from '@dxos/echo-db';
6
- import { FunctionDefinition, FunctionInvocationService } from '@dxos/functions';
7
- /**
8
- * Constructs a `ToolResolverService` whose `resolve(id)` looks up tools in the following order:
9
- * 1. Toolkit: return an existing tool from the provided `toolkit` if one is present under `id`.
10
- * 2. Functions in DB: query `FunctionType` by `key=id`; if found, deserialize and project to a tool
11
- * (propagating any `deployedFunctionId` discovered in the object's metadata).
12
- * 3. Functions passed in: fall back to a matching `FunctionDefinition` from the `functions` array.
13
- *
14
- * If none of the above yield a match, the effect fails with `AiToolNotFoundError`.
15
- *
16
- * Requires `DatabaseService` in the environment.
17
- */
18
- export declare const makeToolResolverFromFunctions: (functions: FunctionDefinition.Any[], toolkit: Toolkit.Toolkit<any>) => Layer.Layer<ToolResolverService, never, DatabaseService>;
19
- 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 } from '@dxos/compute';
8
+ import { Registry } from '@dxos/echo';
9
+ export declare const makeToolResolverFromOperations: <R = never>({ toolkit: extraToolkit, }?: {
10
+ toolkit?: OpaqueToolkit.OpaqueToolkit<never, never, R>;
11
+ }) => Layer.Layer<ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Registry.Service | R>;
12
+ export declare const makeToolExecutionService: <E, R>(opts: {
13
+ invoke: (tool: Tool.Any, input: unknown) => Effect.Effect<unknown>;
14
+ }) => Layer.Layer<ToolExecutionService, never, OpaqueToolkit.OpaqueToolkitProvider>;
15
+ export declare const makeToolExecutionServiceFromOperationInvoker: () => Layer.Layer<ToolExecutionService, never, Operation.Service | OpaqueToolkit.OpaqueToolkitProvider>;
16
+ export declare const ToolExecutionServices: Layer.Layer<ToolExecutionService | ToolResolverService, never, OpaqueToolkit.OpaqueToolkitProvider | Registry.Service | Operation.Service>;
17
+ export declare const getOperationFromTool: (tool: Tool.Any) => Option.Option<Operation.Definition.Any>;
20
18
  //# 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,EAAE,MAAM,eAAe,CAAC;AAChD,OAA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,QAAQ,CAAC,OAAO,GAAG,CAAC,CA8B3D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,CAAC,EAAE,CAAC,QAAQ;IACnD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACpE,KAAG,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,EAAE,aAAa,CAAC,qBAAqB,CAkC7E,CAAC;AAEJ,eAAO,MAAM,4CAA4C,QAAO,KAAK,CAAC,KAAK,CACzE,oBAAoB,EACpB,KAAK,EACL,SAAS,CAAC,OAAO,GAAG,aAAa,CAAC,qBAAqB,CAgBxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,4IAGjC,CAAC;AAOF,eAAO,MAAM,oBAAoB,SAAU,IAAI,CAAC,GAAG,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAE3F,CAAC"}
@@ -1,9 +1,6 @@
1
- export * from './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,308 @@
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 } from '@dxos/compute';
6
+ import { Database, Obj, Registry } 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 | Registry.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
+ readonly operationKey?: string | undefined;
84
+ readonly operationName?: string | undefined;
85
+ readonly operationIcon?: string | undefined;
86
+ };
87
+ message: {
88
+ readonly id: string;
89
+ readonly parentMessage?: string | undefined;
90
+ readonly threadId?: string | undefined;
91
+ readonly created: string;
92
+ readonly sender: {
93
+ readonly role?: "assistant" | "tool" | "user" | undefined;
94
+ readonly contact?: import("@dxos/echo/internal").Ref<{
95
+ readonly fullName?: string | undefined;
96
+ readonly preferredName?: string | undefined;
97
+ readonly nickname?: string | undefined;
98
+ readonly image?: string | undefined;
99
+ readonly organization?: import("@dxos/echo/internal").Ref<{
100
+ readonly name?: string | undefined;
101
+ readonly description?: string | undefined;
102
+ readonly status?: "active" | "commit" | "prospect" | "qualified" | "reject" | undefined;
103
+ readonly image?: string | undefined;
104
+ readonly website?: string | undefined;
105
+ } & {
106
+ readonly location?: readonly [number, number, (number | undefined)?] | undefined;
107
+ } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
108
+ readonly jobTitle?: string | undefined;
109
+ readonly department?: string | undefined;
110
+ readonly notes?: string | undefined;
111
+ readonly emails?: readonly {
112
+ readonly label?: string | undefined;
113
+ readonly value: string;
114
+ }[] | undefined;
115
+ readonly identities?: readonly {
116
+ readonly label?: string | undefined;
117
+ readonly value: string;
118
+ }[] | undefined;
119
+ readonly phoneNumbers?: readonly {
120
+ readonly label?: string | undefined;
121
+ readonly value: string;
122
+ }[] | undefined;
123
+ readonly addresses?: readonly {
124
+ readonly label?: string | undefined;
125
+ readonly value: {
126
+ readonly street?: string | undefined;
127
+ readonly extended?: string | undefined;
128
+ readonly locality?: string | undefined;
129
+ readonly region?: string | undefined;
130
+ readonly postalCode?: string | undefined;
131
+ readonly postOfficeBoxNumber?: string | undefined;
132
+ readonly country?: string | undefined;
133
+ };
134
+ }[] | undefined;
135
+ readonly urls?: readonly {
136
+ readonly label?: string | undefined;
137
+ readonly value: string;
138
+ }[] | undefined;
139
+ readonly birthday?: string | undefined;
140
+ readonly fields?: readonly {
141
+ readonly category?: string | undefined;
142
+ readonly label: string;
143
+ readonly value: string;
144
+ }[] | undefined;
145
+ } & {
146
+ readonly location?: readonly [number, number, (number | undefined)?] | undefined;
147
+ } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
148
+ readonly identityDid?: string | undefined;
149
+ readonly identityKey?: string | undefined;
150
+ readonly email?: string | undefined;
151
+ readonly name?: string | undefined;
152
+ };
153
+ readonly blocks: readonly ({
154
+ readonly _tag: "anchor";
155
+ readonly pending?: boolean | undefined;
156
+ readonly objectId: string;
157
+ readonly version: unknown;
158
+ } | {
159
+ readonly _tag: "file";
160
+ readonly pending?: boolean | undefined;
161
+ readonly url: string;
162
+ readonly name?: string | undefined;
163
+ readonly mediaType?: string | undefined;
164
+ } | {
165
+ readonly _tag: "image";
166
+ readonly pending?: boolean | undefined;
167
+ readonly id?: string | undefined;
168
+ readonly source?: {
169
+ readonly type: "base64";
170
+ readonly mediaType: string;
171
+ readonly data: string;
172
+ } | {
173
+ readonly type: "http";
174
+ readonly url: string;
175
+ } | undefined;
176
+ } | {
177
+ readonly _tag: "json";
178
+ readonly pending?: boolean | undefined;
179
+ readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
180
+ readonly data: string;
181
+ } | {
182
+ readonly _tag: "proposal";
183
+ readonly pending?: boolean | undefined;
184
+ readonly text: string;
185
+ } | {
186
+ readonly _tag: "reasoning";
187
+ readonly pending?: boolean | undefined;
188
+ readonly reasoningText?: string | undefined;
189
+ readonly redactedText?: string | undefined;
190
+ readonly signature?: string | undefined;
191
+ } | {
192
+ readonly _tag: "reference";
193
+ readonly pending?: boolean | undefined;
194
+ readonly reference: import("@dxos/echo/internal").Ref<Obj.Unknown>;
195
+ } | {
196
+ readonly _tag: "select";
197
+ readonly pending?: boolean | undefined;
198
+ readonly options: string[];
199
+ } | {
200
+ readonly _tag: "status";
201
+ readonly pending?: boolean | undefined;
202
+ readonly statusText: string;
203
+ } | {
204
+ readonly _tag: "suggestion";
205
+ readonly pending?: boolean | undefined;
206
+ readonly text: string;
207
+ } | {
208
+ readonly _tag: "stats";
209
+ readonly pending?: boolean | undefined;
210
+ readonly mimeType?: string | undefined;
211
+ readonly message?: string | undefined;
212
+ readonly model?: string | undefined;
213
+ readonly usage?: {
214
+ readonly inputTokens?: number | undefined;
215
+ readonly outputTokens?: number | undefined;
216
+ readonly totalTokens?: number | undefined;
217
+ } | undefined;
218
+ readonly toolCalls?: number | undefined;
219
+ readonly errors?: number | undefined;
220
+ readonly duration?: number | undefined;
221
+ } | {
222
+ readonly _tag: "text";
223
+ readonly pending?: boolean | undefined;
224
+ readonly mimeType?: string | undefined;
225
+ readonly text: string;
226
+ readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
227
+ } | {
228
+ readonly _tag: "summary";
229
+ readonly pending?: boolean | undefined;
230
+ readonly content: string;
231
+ } | {
232
+ readonly _tag: "toolkit";
233
+ readonly pending?: boolean | undefined;
234
+ } | {
235
+ readonly _tag: "toolCall";
236
+ readonly pending?: boolean | undefined;
237
+ readonly toolCallId: string;
238
+ readonly name: string;
239
+ readonly input: string;
240
+ readonly providerExecuted: boolean;
241
+ readonly operationKey?: string | undefined;
242
+ readonly operationName?: string | undefined;
243
+ readonly operationIcon?: string | undefined;
244
+ } | {
245
+ readonly _tag: "toolResult";
246
+ readonly pending?: boolean | undefined;
247
+ readonly toolCallId: string;
248
+ readonly name: string;
249
+ readonly result?: string | {
250
+ readonly _tag: "~@dxos/types/ContentBlock.ContentBlockResult";
251
+ readonly content: readonly ({
252
+ readonly _tag: "file";
253
+ readonly pending?: boolean | undefined;
254
+ readonly url: string;
255
+ readonly name?: string | undefined;
256
+ readonly mediaType?: string | undefined;
257
+ } | {
258
+ readonly _tag: "image";
259
+ readonly pending?: boolean | undefined;
260
+ readonly id?: string | undefined;
261
+ readonly source?: {
262
+ readonly type: "base64";
263
+ readonly mediaType: string;
264
+ readonly data: string;
265
+ } | {
266
+ readonly type: "http";
267
+ readonly url: string;
268
+ } | undefined;
269
+ } | {
270
+ readonly _tag: "text";
271
+ readonly pending?: boolean | undefined;
272
+ readonly mimeType?: string | undefined;
273
+ readonly text: string;
274
+ readonly disposition?: "cot" | "synthetic" | "user" | "version-pin" | undefined;
275
+ })[];
276
+ } | undefined;
277
+ readonly error?: string | undefined;
278
+ readonly providerExecuted: boolean;
279
+ } | {
280
+ readonly _tag: "transcript";
281
+ readonly pending?: boolean | undefined;
282
+ readonly started: string;
283
+ readonly text: string;
284
+ })[];
285
+ readonly properties?: {
286
+ readonly [x: string]: any;
287
+ } | undefined;
288
+ } & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>;
289
+ }[];
290
+ /**
291
+ * Initialize a session: set up history, perform summarization if needed, and submit the user prompt.
292
+ * Must be called before `runTurn()`.
293
+ */
294
+ begin: ({ prompt, system, history, blueprints, objects, }: BeginProps) => Effect.Effect<void, RunError, RunRequirements>;
295
+ /**
296
+ * Execute a single turn: one LLM generation followed by tool execution.
297
+ * The toolkit and system prompt can be updated between turns to reflect context changes (e.g. dynamically enabled blueprints).
298
+ */
299
+ runAgentTurn: <const R = never>({ system, toolkit: opaqueToolkit, }: TurnProps<R>) => Effect.Effect<TurnResult, RunError, RunRequirements | R>;
300
+ runTools: <const R = never>({ toolkit: opaqueToolkit, }: {
301
+ toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
302
+ }) => Effect.Effect<void, RunError, RunRequirements | R>;
303
+ /**
304
+ * Run a full conversation turn loop. Equivalent to calling `begin()` then `runTurn()` in a loop.
305
+ */
306
+ run: <const R = never>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, }: RunProps<R>) => Effect.Effect<Message.Message[], RunError, RunRequirements | R>;
307
+ }
308
+ //# 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;AAI1D,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,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGpD,OA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAQR;IAEJ;;;OAGG;IACH,KAAK,sDAMF,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,CA4ErB;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
- import { type ObjectVersion } from '@dxos/echo-db';
2
+ import { type ObjectVersion } from '@dxos/echo-client';
3
+ import { type EntityId } 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.
@@ -15,9 +15,9 @@ export declare class ArtifactDiffResolver extends ArtifactDiffResolver_base {
15
15
  export declare namespace ArtifactDiffResolver {
16
16
  type Service = {
17
17
  resolve: (artifacts: {
18
- id: ObjectId;
18
+ id: EntityId;
19
19
  lastVersion: ObjectVersion;
20
- }[]) => Promise<Map<ObjectId, {
20
+ }[]) => Promise<Map<EntityId, {
21
21
  version: ObjectVersion;
22
22
  diff?: string;
23
23
  }>>;
@@ -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,mBAAmB,CAAC;AACvD,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 } from '@dxos/compute';
3
+ import { type Database, type Registry } from '@dxos/echo';
4
+ import { type EntityNotFoundError } 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 | EntityNotFoundError, Database.Service | Registry.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,EAAY,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,KAAK,QAAQ,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/D,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,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAuCT,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,10 +1,11 @@
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
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.
@@ -13,10 +14,10 @@ export interface GenerationObserver extends AiParser.ParseResponseCallbacks {
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,9 +1,9 @@
1
1
  import * as Schema from 'effect/Schema';
2
- import { type AnyEchoObject } from '@dxos/echo/internal';
3
- import { type ObjectVersion } from '@dxos/echo-db';
2
+ import { type Obj } from '@dxos/echo';
3
+ import { type ObjectVersion } from '@dxos/echo-client';
4
4
  import { type ContentBlock } from '@dxos/types';
5
5
  declare const VersionPinSchema: Schema.Struct<{
6
- objectId: import("@dxos/keys").ObjectIdClass;
6
+ objectId: import("@dxos/keys").EntityIdClass;
7
7
  version: Schema.Schema<ObjectVersion, ObjectVersion, never>;
8
8
  }>;
9
9
  /**
@@ -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,mBAAmB,CAAC;AAEnE,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"}