@dxos/assistant 0.8.4-main.c85a9c8dae → 0.8.4-main.d05539e30a

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 (156) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  4. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  5. package/dist/lib/neutral/extraction/index.mjs +31 -50
  6. package/dist/lib/neutral/extraction/index.mjs.map +4 -4
  7. package/dist/lib/neutral/index.mjs +1531 -1080
  8. package/dist/lib/neutral/index.mjs.map +4 -4
  9. package/dist/lib/neutral/meta.json +1 -1
  10. package/dist/types/src/extraction/extraction-ner-function/index.d.ts +0 -1
  11. package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -1
  12. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
  13. package/dist/types/src/extraction/extraction.d.ts +879 -153
  14. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  15. package/dist/types/src/extraction/index.d.ts +0 -1
  16. package/dist/types/src/extraction/index.d.ts.map +1 -1
  17. package/dist/types/src/extraction/quotes.d.ts.map +1 -1
  18. package/dist/types/src/functions/services.d.ts +14 -16
  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 +106 -0
  23. package/dist/types/src/request/AiRequest.d.ts.map +1 -0
  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.map +1 -1
  30. package/dist/types/src/{session → request}/version-pin.d.ts.map +1 -1
  31. package/dist/types/src/{conversation/context.d.ts → session/AiContext.d.ts} +41 -33
  32. package/dist/types/src/session/AiContext.d.ts.map +1 -0
  33. package/dist/types/src/session/AiContext.test.d.ts +2 -0
  34. package/dist/types/src/session/AiContext.test.d.ts.map +1 -0
  35. package/dist/types/src/session/AiSession.d.ts +73 -0
  36. package/dist/types/src/session/AiSession.d.ts.map +1 -0
  37. package/dist/types/src/session/index.d.ts +2 -5
  38. package/dist/types/src/session/index.d.ts.map +1 -1
  39. package/dist/types/src/session/toolkit.d.ts +5 -7
  40. package/dist/types/src/session/toolkit.d.ts.map +1 -1
  41. package/dist/types/src/templates/system.d.ts +1 -2
  42. package/dist/types/src/templates/system.d.ts.map +1 -1
  43. package/dist/types/src/{types → util}/artifact.d.ts +1 -2
  44. package/dist/types/src/util/artifact.d.ts.map +1 -0
  45. package/dist/types/src/util/diff.d.ts.map +1 -0
  46. package/dist/types/src/{diff.test.d.ts.map → util/diff.test.d.ts.map} +1 -1
  47. package/dist/types/src/util/error-handling.d.ts.map +1 -0
  48. package/dist/types/src/{errors.d.ts → util/errors.d.ts} +12 -12
  49. package/dist/types/src/util/errors.d.ts.map +1 -0
  50. package/dist/types/src/util/execution-graph.d.ts.map +1 -0
  51. package/dist/types/src/util/execution-graph.test.d.ts.map +1 -0
  52. package/dist/types/src/util/index.d.ts +7 -0
  53. package/dist/types/src/util/index.d.ts.map +1 -0
  54. package/dist/types/src/util/tracing.d.ts +237 -0
  55. package/dist/types/src/util/tracing.d.ts.map +1 -0
  56. package/dist/types/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +25 -41
  58. package/src/extraction/extraction-ner-function/index.ts +0 -1
  59. package/src/extraction/extraction.ts +36 -8
  60. package/src/extraction/index.ts +0 -1
  61. package/src/functions/services.ts +58 -53
  62. package/src/index.ts +2 -5
  63. package/src/request/AiRequest.ts +386 -0
  64. package/src/{session → request}/format.ts +15 -11
  65. package/src/request/index.ts +8 -0
  66. package/src/session/AiContext.test.ts +53 -0
  67. package/src/{conversation/context.ts → session/AiContext.ts} +145 -72
  68. package/src/session/AiSession.ts +324 -0
  69. package/src/session/index.ts +3 -5
  70. package/src/session/toolkit.ts +18 -15
  71. package/src/templates/instructions/system.tpl +50 -2
  72. package/src/templates/system.ts +7 -6
  73. package/src/{types → util}/artifact.ts +2 -3
  74. package/src/{diff.test.ts → util/diff.test.ts} +3 -3
  75. package/src/{session → util}/error-handling.ts +3 -2
  76. package/src/{execution-graph.test.ts → util/execution-graph.test.ts} +1 -1
  77. package/src/{execution-graph.ts → util/execution-graph.ts} +16 -6
  78. package/src/util/index.ts +10 -0
  79. package/src/util/tracing.ts +57 -0
  80. package/dist/lib/neutral/chunk-BE6SRJ4N.mjs +0 -193
  81. package/dist/lib/neutral/chunk-BE6SRJ4N.mjs.map +0 -7
  82. package/dist/lib/neutral/testing/index.mjs +0 -38
  83. package/dist/lib/neutral/testing/index.mjs.map +0 -7
  84. package/dist/types/src/conversation/context.d.ts.map +0 -1
  85. package/dist/types/src/conversation/context.test.d.ts +0 -2
  86. package/dist/types/src/conversation/context.test.d.ts.map +0 -1
  87. package/dist/types/src/conversation/conversation.d.ts +0 -66
  88. package/dist/types/src/conversation/conversation.d.ts.map +0 -1
  89. package/dist/types/src/conversation/conversation.test.d.ts +0 -2
  90. package/dist/types/src/conversation/conversation.test.d.ts.map +0 -1
  91. package/dist/types/src/conversation/index.d.ts +0 -3
  92. package/dist/types/src/conversation/index.d.ts.map +0 -1
  93. package/dist/types/src/diff.d.ts.map +0 -1
  94. package/dist/types/src/errors.d.ts.map +0 -1
  95. package/dist/types/src/execution-graph.d.ts.map +0 -1
  96. package/dist/types/src/execution-graph.test.d.ts.map +0 -1
  97. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +0 -4
  98. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +0 -1
  99. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +0 -2
  100. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +0 -1
  101. package/dist/types/src/extraction/extraction-llm-function/index.d.ts +0 -2
  102. package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +0 -1
  103. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +0 -355
  104. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +0 -1
  105. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +0 -2
  106. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +0 -1
  107. package/dist/types/src/functions.test.d.ts +0 -2
  108. package/dist/types/src/functions.test.d.ts.map +0 -1
  109. package/dist/types/src/session/artifact-diff.d.ts.map +0 -1
  110. package/dist/types/src/session/error-handling.d.ts.map +0 -1
  111. package/dist/types/src/session/format.d.ts +0 -12
  112. package/dist/types/src/session/format.d.ts.map +0 -1
  113. package/dist/types/src/session/format.test.d.ts +0 -2
  114. package/dist/types/src/session/format.test.d.ts.map +0 -1
  115. package/dist/types/src/session/session.d.ts +0 -61
  116. package/dist/types/src/session/session.d.ts.map +0 -1
  117. package/dist/types/src/session/session.test.d.ts +0 -2
  118. package/dist/types/src/session/session.test.d.ts.map +0 -1
  119. package/dist/types/src/testing/index.d.ts +0 -2
  120. package/dist/types/src/testing/index.d.ts.map +0 -1
  121. package/dist/types/src/testing/layer.d.ts +0 -22
  122. package/dist/types/src/testing/layer.d.ts.map +0 -1
  123. package/dist/types/src/types/artifact.d.ts.map +0 -1
  124. package/dist/types/src/types/index.d.ts +0 -2
  125. package/dist/types/src/types/index.d.ts.map +0 -1
  126. package/src/conversation/context.test.ts +0 -46
  127. package/src/conversation/conversation.test.ts +0 -65
  128. package/src/conversation/conversation.ts +0 -247
  129. package/src/conversation/index.ts +0 -6
  130. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +0 -84
  131. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +0 -62
  132. package/src/extraction/extraction-llm-function/index.ts +0 -5
  133. package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +0 -116
  134. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +0 -56
  135. package/src/functions.conversations.json +0 -1
  136. package/src/functions.test.ts +0 -74
  137. package/src/session/format.test.ts +0 -124
  138. package/src/session/session.conversations.json +0 -1
  139. package/src/session/session.test.ts +0 -191
  140. package/src/session/session.ts +0 -251
  141. package/src/testing/index.ts +0 -5
  142. package/src/testing/layer.ts +0 -85
  143. package/src/types/index.ts +0 -5
  144. /package/dist/types/src/{session → request}/artifact-diff.d.ts +0 -0
  145. /package/dist/types/src/{session → request}/observer.d.ts +0 -0
  146. /package/dist/types/src/{session → request}/version-pin.d.ts +0 -0
  147. /package/dist/types/src/{diff.d.ts → util/diff.d.ts} +0 -0
  148. /package/dist/types/src/{diff.test.d.ts → util/diff.test.d.ts} +0 -0
  149. /package/dist/types/src/{session → util}/error-handling.d.ts +0 -0
  150. /package/dist/types/src/{execution-graph.d.ts → util/execution-graph.d.ts} +0 -0
  151. /package/dist/types/src/{execution-graph.test.d.ts → util/execution-graph.test.d.ts} +0 -0
  152. /package/src/{session → request}/artifact-diff.ts +0 -0
  153. /package/src/{session → request}/observer.ts +0 -0
  154. /package/src/{session → request}/version-pin.ts +0 -0
  155. /package/src/{diff.ts → util/diff.ts} +0 -0
  156. /package/src/{errors.ts → util/errors.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,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,eAAO,MAAM,eAAe;;;;;;yBAAC,CAAA;yBACJ,CAAC;4BAEd,CAAC;8BAMZ,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;;;SAQtC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 +1 @@
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,GAAU,QAAQ,MAAM,EAAE,EAAE,IAAI,QAAQ,CAAC,QAAQ,KAAG,OAAO,CAAC,gBAAgB,CASlG,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
+ import * as Tool from '@effect/ai/Tool';
2
+ import * as Effect from 'effect/Effect';
1
3
  import * as Layer from 'effect/Layer';
4
+ import * as Option from 'effect/Option';
2
5
  import { ToolExecutionService, ToolResolverService } from '@dxos/ai';
3
- import { GenericToolkit } from '@dxos/ai';
4
- import { FunctionInvocationService } from '@dxos/functions';
5
- /**
6
- * Constructs a `ToolResolverService` whose `resolve(id)` looks up tools in the following order:
7
- * 1. Toolkit: return an existing tool from the provided `toolkit` if one is present under `id`.
8
- * 2. Functions in DB: query `FunctionType` by `key=id`; if found, deserialize and project to a tool
9
- * (propagating any `deployedFunctionId` discovered in the object's metadata).
10
- * 3. Functions passed in: fall back to a matching `FunctionDefinition` from the `functions` array.
11
- *
12
- * If none of the above yield a match, the effect fails with `AiToolNotFoundError`.
13
- *
14
- * Requires `Database.Service` in the environment.
15
- */
16
- export declare const makeToolResolverFromFunctions: () => Layer.Layer<ToolResolverService, never, GenericToolkit.Provider | FunctionInvocationService>;
17
- export declare const makeToolExecutionServiceFromFunctions: () => Layer.Layer<ToolExecutionService, never, FunctionInvocationService | GenericToolkit.Provider>;
18
- export declare const ToolExecutionServices: Layer.Layer<ToolExecutionService | ToolResolverService, never, FunctionInvocationService | GenericToolkit.Provider>;
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":"AAQA,OAAO,KAAK,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;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,qJAGjC,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,106 @@
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
+ readonly operationKey?: string | undefined;
84
+ readonly operationName?: string | undefined;
85
+ };
86
+ message: Message.Message;
87
+ }[];
88
+ /**
89
+ * Initialize a session: set up history, perform summarization if needed, and submit the user prompt.
90
+ * Must be called before `runTurn()`.
91
+ */
92
+ begin: ({ prompt, system, history, blueprints, objects, }: BeginProps) => Effect.Effect<void, RunError, RunRequirements>;
93
+ /**
94
+ * Execute a single turn: one LLM generation followed by tool execution.
95
+ * The toolkit and system prompt can be updated between turns to reflect context changes (e.g. dynamically enabled blueprints).
96
+ */
97
+ runAgentTurn: <const R = never>({ system, toolkit: opaqueToolkit, }: TurnProps<R>) => Effect.Effect<TurnResult, RunError, RunRequirements | R>;
98
+ runTools: <const R = never>({ toolkit: opaqueToolkit, }: {
99
+ toolkit?: OpaqueToolkit.OpaqueToolkit<R>;
100
+ }) => Effect.Effect<void, RunError, RunRequirements | R>;
101
+ /**
102
+ * Run a full conversation turn loop. Equivalent to calling `begin()` then `runTurn()` in a loop.
103
+ */
104
+ run: <const R = never>({ prompt, system: systemTemplate, history, objects, blueprints, toolkit, }: RunProps<R>) => Effect.Effect<Message.Message[], RunError, RunRequirements | R>;
105
+ }
106
+ //# 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,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,KAAK,gBAAgB,EAA+B,MAAM,SAAS,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,GAAG,wBAAwB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAE3G,MAAM,MAAM,eAAe,GACvB,aAAa,CAAC,aAAa,GAC3B,oBAAoB,GACpB,mBAAmB,GACnB,QAAQ,CAAC,OAAO,GAChB,SAAS,CAAC,OAAO,GACjB,iBAAiB,CAAC,OAAO,GACzB,KAAK,CAAC,YAAY,CAAC;AAEvB,MAAM,MAAM,OAAO,GAAG;IACpB;;OAEG;IACH,sBAAsB,CAA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CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,CAAC,CAgBJ;CAC7E"}
@@ -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 +1 @@
1
- {"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../../../src/session/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
+ {"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 +1 @@
1
- {"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/session/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"}
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"}
@@ -1,57 +1,63 @@
1
1
  import { Atom, Registry } from '@effect-atom/atom-react';
2
2
  import * as Context from 'effect/Context';
3
3
  import * as Effect from 'effect/Effect';
4
+ import * as Runtime from 'effect/Runtime';
4
5
  import * as Schema from 'effect/Schema';
5
- import { Blueprint } from '@dxos/blueprints';
6
+ import { Blueprint } from '@dxos/compute';
6
7
  import { Resource } from '@dxos/context';
7
- import { DXN, Obj, Ref, Type } from '@dxos/echo';
8
- import { type Queue } from '@dxos/echo-db';
8
+ import { DXN, Feed, Obj, Ref, Type } from '@dxos/echo';
9
9
  import { ComplexSet } from '@dxos/util';
10
10
  /**
11
11
  * Thread message that binds or unbinds contextual objects to a conversation.
12
12
  */
13
- export declare const ContextBinding: Type.Obj<{
13
+ export declare const Binding: Type.Obj<{
14
14
  readonly blueprints: {
15
15
  readonly added: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
16
- readonly description?: string | undefined;
17
16
  readonly name: string;
18
- readonly key: string;
17
+ readonly description?: string | undefined;
19
18
  readonly instructions: {
20
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
21
  readonly content: string;
22
22
  }>;
23
23
  readonly inputs?: readonly {
24
- readonly function?: string | undefined;
25
24
  readonly name: string;
26
- readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
25
+ readonly kind: "operation" | "value";
27
26
  readonly default?: any;
27
+ readonly operation?: string | undefined;
28
28
  }[] | undefined;
29
29
  };
30
30
  readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
31
+ readonly agentCanEnable?: boolean | undefined;
31
32
  readonly mcpServers?: readonly {
33
+ readonly name?: string | undefined;
32
34
  readonly url: string;
33
- readonly protocol: "sse" | "http";
35
+ readonly protocol: "http" | "sse";
36
+ readonly apiKey?: string | undefined;
34
37
  }[] | undefined;
35
38
  }>[];
36
39
  readonly removed: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
37
- readonly description?: string | undefined;
38
40
  readonly name: string;
39
- readonly key: string;
41
+ readonly description?: string | undefined;
40
42
  readonly instructions: {
41
43
  readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
44
+ readonly name?: string | undefined;
42
45
  readonly content: string;
43
46
  }>;
44
47
  readonly inputs?: readonly {
45
- readonly function?: string | undefined;
46
48
  readonly name: string;
47
- readonly kind?: "function" | "value" | "pass-through" | "retriever" | "query" | "resolver" | "context" | "schema" | undefined;
49
+ readonly kind: "operation" | "value";
48
50
  readonly default?: any;
51
+ readonly operation?: string | undefined;
49
52
  }[] | undefined;
50
53
  };
51
54
  readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
55
+ readonly agentCanEnable?: boolean | undefined;
52
56
  readonly mcpServers?: readonly {
57
+ readonly name?: string | undefined;
53
58
  readonly url: string;
54
- readonly protocol: "sse" | "http";
59
+ readonly protocol: "http" | "sse";
60
+ readonly apiKey?: string | undefined;
55
61
  }[] | undefined;
56
62
  }>[];
57
63
  };
@@ -60,7 +66,7 @@ export declare const ContextBinding: Type.Obj<{
60
66
  readonly removed: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>[];
61
67
  };
62
68
  }, Schema.Struct.Fields>;
63
- export interface ContextBinding extends Schema.Schema.Type<typeof ContextBinding> {
69
+ export interface Binding extends Schema.Schema.Type<typeof Binding> {
64
70
  }
65
71
  export type BindingProps = Partial<{
66
72
  blueprints: Ref.Ref<Blueprint.Blueprint>[];
@@ -74,19 +80,22 @@ export declare class Bindings {
74
80
  objects: DXN.String[];
75
81
  };
76
82
  }
77
- export type AiContextBinderOptions = {
78
- queue: Queue;
83
+ export type BinderOptions = {
84
+ feed: Feed.Feed;
85
+ runtime: Runtime.Runtime<Feed.FeedService>;
79
86
  registry?: Registry.Registry;
80
87
  };
81
88
  /**
82
89
  * Manages bindings of blueprints and objects to a conversation.
83
90
  */
84
- export declare class AiContextBinder extends Resource {
91
+ export declare class Binder extends Resource {
92
+ #private;
85
93
  private readonly _blueprints;
86
94
  private readonly _objects;
87
95
  private readonly _registry;
88
- private readonly _queue;
89
- constructor(options: AiContextBinderOptions);
96
+ private readonly _feed;
97
+ private readonly _runtime;
98
+ constructor(options: BinderOptions);
90
99
  /**
91
100
  * Returns the blueprints atom for subscription.
92
101
  */
@@ -112,6 +121,10 @@ export declare class AiContextBinder extends Resource {
112
121
  */
113
122
  subscribeObjects(cb: (objects: Obj.Unknown[]) => void): () => void;
114
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>;
115
128
  private _updateBindings;
116
129
  protected _close(): Promise<void>;
117
130
  bind({ blueprints, objects }: BindingProps): Promise<void>;
@@ -125,22 +138,17 @@ export declare class AiContextBinder extends Resource {
125
138
  */
126
139
  private _reduce;
127
140
  /**
128
- * Resolve references to objects, loading them first if needed and falling back to existing objects.
141
+ * Merge resolved items into the current set, adding only items not already present (by DXN).
129
142
  */
143
+ private _mergeInto;
130
144
  private _resolve;
131
145
  }
132
- declare const AiContextService_base: Context.TagClass<AiContextService, "@dxos/assistant/AiContextService", {
133
- binder: AiContextBinder;
146
+ declare const Service_base: Context.TagClass<Service, "@dxos/assistant/AiContextService", {
147
+ binder: Binder;
134
148
  }>;
135
- export declare class AiContextService extends AiContextService_base {
136
- static bindContext: ({ blueprints, objects }: BindingProps) => Effect.Effect<void, never, AiContextService>;
137
- static findObjects: <T extends Type.AnyEntity>(type: T) => Effect.Effect<Schema.Schema.Type<T>[], never, AiContextService>;
138
- /**
139
- * Glorified type cast until we figure out function service typing.
140
- * For context, the AiContextService is provided to functions called from tool calls, but it's not implemented in types yet.
141
- * @deprecated
142
- */
143
- static fixFunctionHandlerType: <A, E, R>(eff: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, AiContextService>>;
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>;
144
152
  }
145
153
  export {};
146
- //# sourceMappingURL=context.d.ts.map
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,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,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AC,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,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AI,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,7 +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';
6
- export * from './format';
2
+ export * as AiContext from './AiContext';
3
+ export * as AiSession from './AiSession';
7
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;AAC9B,cAAc,UAAU,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,18 +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, GenericToolkit, ToolExecutionService, ToolResolverService } from '@dxos/ai';
5
- import { type Blueprint } from '@dxos/blueprints';
2
+ import { type AiToolNotFoundError, OpaqueToolkit, ToolExecutionService, ToolResolverService } from '@dxos/ai';
3
+ import { type Blueprint } from '@dxos/compute';
6
4
  export type CreateToolkitProps = {
7
- toolkit?: Toolkit.Any;
5
+ toolkit?: OpaqueToolkit.Any;
8
6
  blueprints?: readonly Blueprint.Blueprint[];
9
7
  /**
10
8
  * Self-contained with handlers toolkits.
11
9
  */
12
- genericToolkits?: readonly GenericToolkit.GenericToolkit[];
10
+ opaqueToolkits?: readonly OpaqueToolkit.Any[];
13
11
  };
14
12
  /**
15
13
  * Build a combined toolkit from the blueprint tools and the provided toolkit.
16
14
  */
17
- export declare const createToolkit: ({ toolkit: toolkitProp, blueprints, genericToolkits, }: CreateToolkitProps) => Effect.Effect<Toolkit.WithHandler<any>, AiToolNotFoundError, ToolResolverService | ToolExecutionService | Tool.HandlersFor<any>>;
15
+ export declare const createToolkit: ({ toolkit: toolkitProp, blueprints, opaqueToolkits, }: CreateToolkitProps) => Effect.Effect<OpaqueToolkit.OpaqueToolkit, AiToolNotFoundError, ToolResolverService | ToolExecutionService>;
18
16
  //# sourceMappingURL=toolkit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,mBAAmB,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,SAAS,CAAC,SAAS,EAAE,CAAC;IAC5C;;OAEG;IACH,eAAe,CAAC,EAAE,SAAS,cAAc,CAAC,cAAc,EAAE,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,wDAI3B,kBAAkB,KAAG,MAAM,CAAC,MAAM,CACnC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,EACxB,mBAAmB,EACnB,mBAAmB,GAAG,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAYhE,CAAC"}
1
+ {"version":3,"file":"toolkit.d.ts","sourceRoot":"","sources":["../../../../src/session/toolkit.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,mBAAmB,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,SAAS,CAAC,SAAS,EAAE,CAAC;IAC5C;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,aAAa,CAAC,GAAG,EAAE,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,0DAIvB,kBAAkB,KAAG,MAAM,CAAC,MAAM,CACnC,aAAa,CAAC,aAAa,EAC3B,mBAAmB,EACnB,mBAAmB,GAAG,oBAAoB,CAeuE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type ModelCapabilities } from '@dxos/ai';
2
- import { Template } from '@dxos/blueprints';
2
+ import { Template } from '@dxos/compute';
3
3
  /**
4
4
  * System template variables.
5
5
  */
@@ -12,7 +12,6 @@ export type SystemPromptOptions = ModelCapabilities & {
12
12
  */
13
13
  export declare const createSystemPrompt: (options?: Partial<SystemPromptOptions>) => string;
14
14
  export declare const templates: {
15
- /** Editable system prompt.*/
16
15
  system: Template.Template;
17
16
  };
18
17
  //# sourceMappingURL=system.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/templates/system.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK5C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IACpD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAS,OAAO,CAAC,mBAAmB,CAAM,WAM1E,CAAC;AAEJ,eAAO,MAAM,SAAS;IACpB,6BAA6B;;CAQ9B,CAAC"}
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/templates/system.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IACpD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAAa,OAAO,CAAC,mBAAmB,CAAC,WAMrE,CAAC;AAOJ,eAAO,MAAM,SAAS;IACpB,MAAM;CAIP,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import type * as Effect from 'effect/Effect';
2
2
  import * as Schema from 'effect/Schema';
3
- import { type Err, Obj, Ref, type Type } from '@dxos/echo';
4
- import { Database } from '@dxos/echo';
3
+ import { Database, type Err, Obj, Ref, type Type } from '@dxos/echo';
5
4
  import { DXN, type ObjectId, type SpaceId } from '@dxos/keys';
6
5
  /**
7
6
  * @deprecated
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../../../src/util/artifact.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,IA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AAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,UAAW,SAAS,MAAM,EAAE,KAAG,IAAI,EA0B1D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,CAAC,YAAY,WAAW,CAAC,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE;;;GAU5F,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,YAChB,WAAW,CAAC,CAAC,CAAC,SACjB,SAAS,MAAM,EAAE,wBACK;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,KACzD,MAoBF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"diff.test.d.ts","sourceRoot":"","sources":["../../../src/diff.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"diff.test.d.ts","sourceRoot":"","sources":["../../../../src/util/diff.test.ts"],"names":[],"mappings":""}