@dxos/assistant 0.8.3 → 0.8.4-main.2e9d522

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 (103) hide show
  1. package/dist/lib/browser/index.mjs +760 -1087
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +760 -1087
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/context/binder.d.ts +34 -0
  8. package/dist/types/src/context/binder.d.ts.map +1 -0
  9. package/dist/types/src/context/binding.d.ts +56 -0
  10. package/dist/types/src/context/binding.d.ts.map +1 -0
  11. package/dist/types/src/context/index.d.ts +3 -0
  12. package/dist/types/src/context/index.d.ts.map +1 -0
  13. package/dist/types/src/conversation/conversation.d.ts +38 -0
  14. package/dist/types/src/conversation/conversation.d.ts.map +1 -0
  15. package/dist/types/src/conversation/index.d.ts +2 -0
  16. package/dist/types/src/conversation/index.d.ts.map +1 -0
  17. package/dist/types/src/errors.d.ts +38 -0
  18. package/dist/types/src/errors.d.ts.map +1 -0
  19. package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -1
  20. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +135 -41
  21. package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
  22. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts +1 -1
  23. package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -1
  24. package/dist/types/src/extraction/extraction.d.ts +100 -42
  25. package/dist/types/src/extraction/extraction.d.ts.map +1 -1
  26. package/dist/types/src/functions/index.d.ts +2 -0
  27. package/dist/types/src/functions/index.d.ts.map +1 -0
  28. package/dist/types/src/functions/services.d.ts +6 -0
  29. package/dist/types/src/functions/services.d.ts.map +1 -0
  30. package/dist/types/src/index.d.ts +4 -1
  31. package/dist/types/src/index.d.ts.map +1 -1
  32. package/dist/types/src/research/exa.d.ts +10 -5
  33. package/dist/types/src/research/exa.d.ts.map +1 -1
  34. package/dist/types/src/research/graph.d.ts +18 -8
  35. package/dist/types/src/research/graph.d.ts.map +1 -1
  36. package/dist/types/src/research/research.d.ts +1 -1
  37. package/dist/types/src/research/research.d.ts.map +1 -1
  38. package/dist/types/src/session/session.d.ts +183 -184
  39. package/dist/types/src/session/session.d.ts.map +1 -1
  40. package/dist/types/src/session/version-pin.d.ts +2 -2
  41. package/dist/types/src/session/version-pin.d.ts.map +1 -1
  42. package/dist/types/src/templates/index.d.ts +2 -0
  43. package/dist/types/src/templates/index.d.ts.map +1 -0
  44. package/dist/types/src/templates/prompt.d.ts +30 -0
  45. package/dist/types/src/templates/prompt.d.ts.map +1 -0
  46. package/dist/types/src/types.d.ts +10 -0
  47. package/dist/types/src/types.d.ts.map +1 -1
  48. package/dist/types/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +29 -30
  50. package/src/context/binder.ts +103 -0
  51. package/src/context/binding.ts +32 -0
  52. package/src/context/index.ts +6 -0
  53. package/src/conversation/conversation.ts +96 -0
  54. package/src/conversation/index.ts +5 -0
  55. package/src/errors.ts +10 -0
  56. package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +6 -18
  57. package/src/extraction/extraction-llm-function/extraction-llm-function.ts +19 -14
  58. package/src/extraction/extraction-ner-function/extraction-ner-function.ts +6 -3
  59. package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +2 -2
  60. package/src/extraction/extraction-ner-function/named-entity-recognition.ts +1 -1
  61. package/src/functions/index.ts +5 -0
  62. package/src/functions/services.ts +139 -0
  63. package/src/index.ts +4 -1
  64. package/src/research/exa.ts +56 -59
  65. package/src/research/graph.test.ts +50 -1
  66. package/src/research/graph.ts +85 -53
  67. package/src/research/instructions-research.tpl +1 -0
  68. package/src/research/research.test.ts +27 -27
  69. package/src/research/research.ts +50 -52
  70. package/src/session/__snapshots__/session.test.ts.snap +32 -0
  71. package/src/session/session.test.ts +99 -18
  72. package/src/session/session.ts +230 -443
  73. package/src/session/version-pin.test.ts +2 -21
  74. package/src/session/version-pin.ts +5 -5
  75. package/src/summarization/summarization.test.ts +75 -88
  76. package/src/templates/assistant.tpl +111 -0
  77. package/src/templates/index.ts +5 -0
  78. package/src/templates/prompt.ts +45 -0
  79. package/src/types.ts +40 -1
  80. package/dist/lib/node/index.cjs +0 -2178
  81. package/dist/lib/node/index.cjs.map +0 -7
  82. package/dist/lib/node/meta.json +0 -1
  83. package/dist/types/src/blueprint/ai.test.d.ts +0 -2
  84. package/dist/types/src/blueprint/ai.test.d.ts.map +0 -1
  85. package/dist/types/src/blueprint/blueprint.d.ts +0 -55
  86. package/dist/types/src/blueprint/blueprint.d.ts.map +0 -1
  87. package/dist/types/src/blueprint/blueprint.test.d.ts +0 -2
  88. package/dist/types/src/blueprint/blueprint.test.d.ts.map +0 -1
  89. package/dist/types/src/blueprint/index.d.ts +0 -4
  90. package/dist/types/src/blueprint/index.d.ts.map +0 -1
  91. package/dist/types/src/blueprint/logger.d.ts +0 -25
  92. package/dist/types/src/blueprint/logger.d.ts.map +0 -1
  93. package/dist/types/src/blueprint/machine.d.ts +0 -143
  94. package/dist/types/src/blueprint/machine.d.ts.map +0 -1
  95. package/dist/types/src/blueprint/test-data.d.ts +0 -3
  96. package/dist/types/src/blueprint/test-data.d.ts.map +0 -1
  97. package/src/blueprint/ai.test.ts +0 -156
  98. package/src/blueprint/blueprint.test.ts +0 -151
  99. package/src/blueprint/blueprint.ts +0 -75
  100. package/src/blueprint/index.ts +0 -7
  101. package/src/blueprint/logger.ts +0 -155
  102. package/src/blueprint/machine.ts +0 -251
  103. package/src/blueprint/test-data.ts +0 -55
@@ -1,7 +1,8 @@
1
+ import { AiTool, AiToolkit } from '@effect/ai';
1
2
  import { Schema } from 'effect';
2
- import type { Obj } from '@dxos/echo';
3
3
  import { type EchoDatabase, type Queue } from '@dxos/echo-db';
4
4
  import { type BaseObject } from '@dxos/echo-schema';
5
+ import { DatabaseService } from '@dxos/functions';
5
6
  export declare const Subgraph: Schema.Struct<{
6
7
  /** Objects and relations. */
7
8
  objects: Schema.Array$<typeof Schema.Any>;
@@ -20,10 +21,24 @@ export type RelatedSchema = {
20
21
  * @returns
21
22
  */
22
23
  export declare const findRelatedSchema: (db: EchoDatabase, anchor: Schema.Schema.AnyNoContext) => Promise<RelatedSchema[]>;
24
+ declare const LocalSearchToolkit_base: AiToolkit.AiToolkit<AiTool.AiTool<"search_local_search", Schema.Struct<{
25
+ query: Schema.SchemaClass<string, string, never>;
26
+ }>, typeof Schema.Unknown, typeof Schema.Never, DatabaseService>>;
23
27
  /**
24
28
  * Perform vector search in the local database.
25
29
  */
26
- export declare const createLocalSearchTool: (db: EchoDatabase, queue?: Queue) => import("@dxos/ai").ExecutableTool;
30
+ export declare class LocalSearchToolkit extends LocalSearchToolkit_base {
31
+ }
32
+ export declare const LocalSearchHandler: import("effect/Layer").Layer<AiTool.Handler<"search_local_search">, never, never>;
33
+ /**
34
+ * Forms typed objects that can be written to the graph database.
35
+ */
36
+ export declare const makeGraphWriterToolkit: ({ schema }: {
37
+ schema: Schema.Schema.AnyNoContext[];
38
+ }) => AiToolkit.AiToolkit<AiTool.AiTool<"graph_writer", Schema.Struct<Readonly<{
39
+ [k: string]: Schema.optional<Schema.Array$<Schema.Schema.AnyNoContext>>;
40
+ }>>, typeof Schema.Unknown, typeof Schema.Never, DatabaseService>>;
41
+ export declare const makeGraphWriterHandler: (toolkit: ReturnType<typeof makeGraphWriterToolkit>) => import("effect/Layer").Layer<AiTool.Handler<"graph_writer">, never, never>;
27
42
  /**
28
43
  * Create a schema for structured data extraction.
29
44
  */
@@ -32,10 +47,5 @@ export declare const createExtractionSchema: (types: Schema.Schema.AnyNoContext[
32
47
  }>;
33
48
  export declare const getSanitizedSchemaName: (schema: Schema.Schema.AnyNoContext) => string;
34
49
  export declare const sanitizeObjects: (types: Schema.Schema.AnyNoContext[], data: Record<string, readonly unknown[]>, db: EchoDatabase, queue?: Queue) => Promise<BaseObject[]>;
35
- export declare const createGraphWriterTool: ({ db, queue, schema, onDone, }: {
36
- db: EchoDatabase;
37
- queue?: Queue;
38
- schema: Schema.Schema.AnyNoContext[];
39
- onDone?: (data: Obj.Any[]) => Promise<any>;
40
- }) => import("@dxos/ai").ExecutableTool;
50
+ export {};
41
51
  //# sourceMappingURL=graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../src/research/graph.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAA+B,MAAM,QAAQ,CAAC;AAG7D,OAAO,KAAK,EAAE,GAAG,EAAY,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAUL,KAAK,UAAU,EAKhB,MAAM,mBAAmB,CAAC;AAO3B,eAAO,MAAM,QAAQ;IACnB,6BAA6B;;EAE7B,CAAC;AACH,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACnC,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,IAAI,YAAY,EAChB,QAAQ,MAAM,CAAC,MAAM,CAAC,YAAY,KACjC,OAAO,CAAC,aAAa,EAAE,CAsBzB,CAAC;AAmBF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,IAAI,YAAY,EAAE,QAAQ,KAAK,sCAyBpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;;EAWzE,C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CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,IAAI,YAAY,EAChB,QAAQ,MAAM,CAAC,MAAM,CAAC,YAAY,KACjC,OAAO,CAAC,aAAa,EAAE,CAsBzB,CAAC;;;;AAmBF;;GAEG;AAEH,qBAAa,kBAAmB,SAAQ,uBAWvC;CAAG;AAEJ,eAAO,MAAM,kBAAkB,mFAkB7B,CAAC;AAUH;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,YAAY;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;CAAE;;kEAW1F,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,UAAU,CAAC,OAAO,sBAAsB,CAAC,+EAexF,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;;EAWzE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,CAAC,MAAM,CAAC,YAAY,WAIxE,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EACnC,MAAM,MAAM,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,EACxC,IAAI,YAAY,EAChB,QAAQ,KAAK,KACZ,OAAO,CAAC,UAAU,EAAE,CAyHtB,CAAC"}
@@ -5,6 +5,6 @@ export declare const researchFn: import("@dxos/functions").FunctionDefinition<{
5
5
  readonly query: string;
6
6
  readonly mockSearch?: boolean | undefined;
7
7
  }, {
8
- result: any;
8
+ readonly result: unknown;
9
9
  }>;
10
10
  //# sourceMappingURL=research.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../../src/research/research.ts"],"names":[],"mappings":"AAkBA;;GAEG;AAEH,eAAO,MAAM,UAAU;;;;YAsDC,GAAG;EAYzB,CAAC"}
1
+ {"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../../src/research/research.ts"],"names":[],"mappings":"AAqBA;;GAEG;AAEH,eAAO,MAAM,UAAU;;;;;EA6DrB,CAAC"}
@@ -1,68 +1,33 @@
1
- import { Schema } from 'effect';
2
- import { type AgentStatus, type AiServiceClient, type GenerateRequest, Message, type ExecutableTool } from '@dxos/ai';
3
- import { type ArtifactDefinition } from '@dxos/artifact';
1
+ import { AiLanguageModel, AiToolkit, type AiError, type AiResponse, type AiTool } from '@effect/ai';
2
+ import { Context, Effect, type Schema } from 'effect';
3
+ import { ToolExecutionService, ToolResolverService, type AgentStatus, type AiInputPreprocessingError, type AiToolNotFoundError } from '@dxos/ai';
4
4
  import { Event } from '@dxos/async';
5
+ import { type Blueprint } from '@dxos/blueprints';
5
6
  import { ObjectVersion } from '@dxos/echo-db';
6
7
  import { type ObjectId } from '@dxos/echo-schema';
8
+ import { DataType } from '@dxos/schema';
9
+ import { AiAssistantError } from '../errors';
10
+ export type AiSessionOptions = {};
11
+ export type SessionRunOptions<Tools extends AiTool.Any> = {
12
+ prompt: string;
13
+ history: DataType.Message[];
14
+ systemPrompt?: string;
15
+ toolkit?: AiToolkit.AiToolkit<Tools>;
16
+ blueprints?: Blueprint.Blueprint[];
17
+ };
7
18
  /**
8
19
  * Contains message history, tools, current context.
9
20
  * Current context means the state of the app, time of day, and other contextual information.
10
21
  * It makes requests to the model, its a state machine.
11
22
  * It keeps track of the current goal.
12
23
  * It manages the context window.
13
- * Tracks the success criteria of reaching the goal, exposing metrics (stretch)
24
+ * Tracks the success criteria of reaching the goal, exposing metrics (stretch).
14
25
  * Could be run locally in the app or remotely.
15
26
  * Could be personal or shared.
16
27
  */
17
- /**
18
- * Resolves artifact ids to their versions.
19
- * Used to give the model a sense of the changes to the artifacts made by users during the conversation.
20
- * The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
21
- * a diff is inserted into the conversation.
22
- */
23
- export type ArtifactDiffResolver = (artifacts: {
24
- id: ObjectId;
25
- lastVersion: ObjectVersion;
26
- }[]) => Promise<Map<ObjectId, {
27
- version: ObjectVersion;
28
- diff?: string;
29
- }>>;
30
- export type SessionRunOptions = {
31
- client: AiServiceClient;
32
- artifacts: ArtifactDefinition[];
33
- /**
34
- * Non-artifact specific tools.
35
- */
36
- tools: ExecutableTool[];
37
- history: Message[];
38
- prompt: string;
39
- generationOptions?: Pick<GenerateRequest, 'model'>;
40
- extensions?: ToolContextExtensions;
41
- systemPrompt?: string;
42
- /**
43
- * Pre-require artifacts.
44
- */
45
- requiredArtifactIds?: string[];
46
- /**
47
- * @see ArtifactDiffResolver
48
- */
49
- artifactDiffResolver?: ArtifactDiffResolver;
50
- };
51
- type OperationModel = 'planning' | 'importing' | 'configured';
52
- export type AiSessionOptions = {
53
- /**
54
- * Determines the agent's handling of the artifacts definitions:
55
- *
56
- * - `planning`: The model will create a plan with required artifacts for each step.
57
- * - `importing`: The model can query registry and only pull in the artifacts that are required to complete the task.
58
- * - `configured`: The available artifacts are pre-selected and the model cannot select additional artifacts.
59
- */
60
- operationModel: OperationModel;
61
- };
62
- export declare class AISession {
28
+ export declare class AiSession {
63
29
  private readonly _options;
64
- /** SSE stream parser. */
65
- private readonly _parser;
30
+ private readonly _semaphore;
66
31
  /** Pending messages (incl. the current user request). */
67
32
  private _pending;
68
33
  /** Current streaming response. */
@@ -72,190 +37,224 @@ export declare class AISession {
72
37
  /**
73
38
  * New message.
74
39
  */
75
- readonly message: Event<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
76
- id: string;
77
- content: ({
78
- pending?: boolean | undefined;
79
- type: "text";
80
- text: string;
81
- disposition?: string | undefined;
82
- } | {
83
- pending?: boolean | undefined;
84
- type: "json";
85
- disposition?: string | undefined;
86
- json: string;
87
- } | {
88
- pending?: boolean | undefined;
89
- id?: string | undefined;
90
- type: "image";
91
- source?: {
92
- type: "base64";
93
- mediaType: string;
94
- data: string;
95
- } | undefined;
96
- } | {
97
- pending?: boolean | undefined;
98
- id: string;
99
- type: "tool_use";
100
- name: string;
101
- input: unknown;
102
- currentStatus?: {
103
- readonly id: string;
104
- message: string;
105
- } | undefined;
106
- } | {
107
- pending?: boolean | undefined;
108
- type: "tool_result";
109
- toolUseId: string;
110
- content: string;
111
- isError?: boolean | undefined;
112
- })[];
113
- role: "user" | "assistant";
114
- }>;
40
+ readonly message: Event<import("@dxos/schema").Message>;
115
41
  /**
116
42
  * Complete block added to Message.
117
43
  */
118
44
  readonly block: Event<{
45
+ version: unknown;
46
+ _tag: "anchor";
119
47
  pending?: boolean | undefined;
120
- type: "text";
121
- text: string;
122
- disposition?: string | undefined;
48
+ objectId: string;
123
49
  } | {
50
+ name?: string | undefined;
51
+ _tag: "file";
124
52
  pending?: boolean | undefined;
125
- type: "json";
126
- disposition?: string | undefined;
127
- json: string;
53
+ url: string;
54
+ mediaType?: string | undefined;
128
55
  } | {
129
- pending?: boolean | undefined;
130
56
  id?: string | undefined;
131
- type: "image";
132
57
  source?: {
133
58
  type: "base64";
134
59
  mediaType: string;
135
60
  data: string;
61
+ } | {
62
+ type: "http";
63
+ url: string;
136
64
  } | undefined;
65
+ _tag: "image";
66
+ pending?: boolean | undefined;
67
+ } | {
68
+ _tag: "json";
69
+ pending?: boolean | undefined;
70
+ data: string;
71
+ disposition?: string | undefined;
72
+ } | {
73
+ text: string;
74
+ _tag: "proposal";
75
+ pending?: boolean | undefined;
76
+ } | {
77
+ _tag: "reasoning";
78
+ pending?: boolean | undefined;
79
+ reasoningText?: string | undefined;
80
+ redactedText?: string | undefined;
81
+ signature?: string | undefined;
82
+ } | {
83
+ reference: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").Expando>;
84
+ _tag: "reference";
85
+ pending?: boolean | undefined;
86
+ } | {
87
+ _tag: "select";
88
+ pending?: boolean | undefined;
89
+ options: readonly string[];
90
+ } | {
91
+ _tag: "status";
92
+ pending?: boolean | undefined;
93
+ statusText: string;
137
94
  } | {
95
+ text: string;
96
+ _tag: "suggest";
97
+ pending?: boolean | undefined;
98
+ } | {
99
+ text: string;
100
+ _tag: "text";
138
101
  pending?: boolean | undefined;
139
- id: string;
140
- type: "tool_use";
102
+ disposition?: string | undefined;
103
+ mimeType?: string | undefined;
104
+ } | {
141
105
  name: string;
142
106
  input: unknown;
143
- currentStatus?: {
144
- readonly id: string;
145
- message: string;
146
- } | undefined;
107
+ _tag: "toolCall";
108
+ pending?: boolean | undefined;
109
+ toolCallId: string;
147
110
  } | {
111
+ _tag: "toolList";
112
+ pending?: boolean | undefined;
113
+ } | {
114
+ name: string;
115
+ _tag: "toolResult";
148
116
  pending?: boolean | undefined;
149
- type: "tool_result";
150
- toolUseId: string;
151
- content: string;
152
- isError?: boolean | undefined;
117
+ toolCallId: string;
118
+ result: unknown;
119
+ } | {
120
+ text: string;
121
+ _tag: "transcript";
122
+ pending?: boolean | undefined;
123
+ started: string;
153
124
  }>;
154
125
  /**
155
126
  * Update partial block (while streaming).
156
127
  */
157
128
  readonly update: Event<{
129
+ version: unknown;
130
+ _tag: "anchor";
158
131
  pending?: boolean | undefined;
159
- type: "text";
160
- text: string;
161
- disposition?: string | undefined;
132
+ objectId: string;
162
133
  } | {
134
+ name?: string | undefined;
135
+ _tag: "file";
163
136
  pending?: boolean | undefined;
164
- type: "json";
165
- disposition?: string | undefined;
166
- json: string;
137
+ url: string;
138
+ mediaType?: string | undefined;
167
139
  } | {
168
- pending?: boolean | undefined;
169
140
  id?: string | undefined;
170
- type: "image";
171
141
  source?: {
172
142
  type: "base64";
173
143
  mediaType: string;
174
144
  data: string;
145
+ } | {
146
+ type: "http";
147
+ url: string;
175
148
  } | undefined;
149
+ _tag: "image";
150
+ pending?: boolean | undefined;
151
+ } | {
152
+ _tag: "json";
153
+ pending?: boolean | undefined;
154
+ data: string;
155
+ disposition?: string | undefined;
156
+ } | {
157
+ text: string;
158
+ _tag: "proposal";
159
+ pending?: boolean | undefined;
160
+ } | {
161
+ _tag: "reasoning";
162
+ pending?: boolean | undefined;
163
+ reasoningText?: string | undefined;
164
+ redactedText?: string | undefined;
165
+ signature?: string | undefined;
166
+ } | {
167
+ reference: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").Expando>;
168
+ _tag: "reference";
169
+ pending?: boolean | undefined;
170
+ } | {
171
+ _tag: "select";
172
+ pending?: boolean | undefined;
173
+ options: readonly string[];
176
174
  } | {
175
+ _tag: "status";
177
176
  pending?: boolean | undefined;
178
- id: string;
179
- type: "tool_use";
177
+ statusText: string;
178
+ } | {
179
+ text: string;
180
+ _tag: "suggest";
181
+ pending?: boolean | undefined;
182
+ } | {
183
+ text: string;
184
+ _tag: "text";
185
+ pending?: boolean | undefined;
186
+ disposition?: string | undefined;
187
+ mimeType?: string | undefined;
188
+ } | {
180
189
  name: string;
181
190
  input: unknown;
182
- currentStatus?: {
183
- readonly id: string;
184
- message: string;
185
- } | undefined;
191
+ _tag: "toolCall";
192
+ pending?: boolean | undefined;
193
+ toolCallId: string;
194
+ } | {
195
+ _tag: "toolList";
196
+ pending?: boolean | undefined;
197
+ } | {
198
+ name: string;
199
+ _tag: "toolResult";
200
+ pending?: boolean | undefined;
201
+ toolCallId: string;
202
+ result: unknown;
186
203
  } | {
204
+ text: string;
205
+ _tag: "transcript";
187
206
  pending?: boolean | undefined;
188
- type: "tool_result";
189
- toolUseId: string;
190
- content: string;
191
- isError?: boolean | undefined;
207
+ started: string;
192
208
  }>;
193
- readonly streamEvent: Event<import("@dxos/ai").GenerationStreamEvent>;
209
+ /**
210
+ * Unparsed events from the underlying generation stream.
211
+ */
212
+ readonly streamEvent: Event<AiResponse.TextPart | AiResponse.ReasoningPart | AiResponse.RedactedReasoningPart | AiResponse.ToolCallPart | AiResponse.MetadataPart | AiResponse.FinishPart>;
194
213
  /**
195
214
  * User prompt or tool result.
196
215
  */
197
- readonly userMessage: Event<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
198
- id: string;
199
- role: "user" | "assistant";
200
- content: ({
201
- pending?: boolean | undefined;
202
- type: "text";
203
- disposition?: string | undefined;
204
- text: string;
205
- } | {
206
- pending?: boolean | undefined;
207
- type: "json";
208
- disposition?: string | undefined;
209
- json: string;
210
- } | {
211
- pending?: boolean | undefined;
212
- id?: string | undefined;
213
- type: "image";
214
- source?: {
215
- type: "base64";
216
- mediaType: string;
217
- data: string;
218
- } | undefined;
219
- } | {
220
- pending?: boolean | undefined;
221
- id: string;
222
- name: string;
223
- type: "tool_use";
224
- input: unknown;
225
- currentStatus?: {
226
- readonly id: string;
227
- message: string;
228
- } | undefined;
229
- } | {
230
- pending?: boolean | undefined;
231
- type: "tool_result";
232
- content: string;
233
- toolUseId: string;
234
- isError?: boolean | undefined;
235
- })[];
236
- }>;
216
+ readonly userMessage: Event<import("@dxos/schema").Message>;
237
217
  /**
238
218
  * Agent self-reporting its status.
219
+ * Triggered by the model.
239
220
  */
240
221
  readonly statusReport: Event<AgentStatus>;
241
- readonly toolStatusReport: Event<{
242
- message: Message;
243
- status: AgentStatus;
244
- }>;
245
- constructor(_options: AiSessionOptions);
246
- run(options: SessionRunOptions): Promise<Message[]>;
247
- runStructured<S extends Schema.Schema.AnyNoContext>(schema: S, options: SessionRunOptions): Promise<Schema.Schema.Type<S>>;
222
+ /**
223
+ * Emits when the session is done.
224
+ */
225
+ readonly done: Event<void>;
226
+ constructor(_options?: AiSessionOptions);
227
+ /**
228
+ * Runs the AI model loop interacting with tools and artifacts.
229
+ * @param options - The session options.
230
+ * @returns The messages generated by the session, including the user's prompt.
231
+ */
232
+ run: <Tools extends AiTool.Any>(options: SessionRunOptions<Tools>) => Effect.Effect<DataType.Message[], AiAssistantError | AiInputPreprocessingError | AiToolNotFoundError | AiError.AiError, AiLanguageModel.AiLanguageModel | ToolResolverService | ToolExecutionService | AiTool.ToHandler<Tools>>;
233
+ runStructured<S extends Schema.Schema.AnyNoContext>(schema: S, options: SessionRunOptions<AiTool.Any>): Promise<Schema.Schema.Type<S>>;
248
234
  private _formatUserPrompt;
249
- private _createQueryArtifactsTool;
250
- private _createRequireTool;
251
- private _createPlanningTool;
252
- private _onToolStatusReport;
253
235
  abort(): void;
254
236
  }
255
- declare const AIServiecOverloadedError_base: Schema.TaggedErrorClass<AIServiecOverloadedError, "AIServiecOverloadedError", {
256
- readonly _tag: Schema.tag<"AIServiecOverloadedError">;
257
- }>;
258
- export declare class AIServiecOverloadedError extends AIServiecOverloadedError_base {
237
+ declare const ArtifactDiffResolver_base: Context.TagClass<ArtifactDiffResolver, "ArtifactDiffResolver", ArtifactDiffResolver.Service>;
238
+ /**
239
+ * Resolves artifact ids to their versions.
240
+ * Used to give the model a sense of the changes to the artifacts made by users during the conversation.
241
+ * The artifacts versions are pinned in the history, and whenever the artifact changes in-between assistant's steps,
242
+ * a diff is inserted into the conversation.
243
+ *
244
+ * Can be optionally provided to the session run call.
245
+ */
246
+ export declare class ArtifactDiffResolver extends ArtifactDiffResolver_base {
247
+ }
248
+ export declare namespace ArtifactDiffResolver {
249
+ type Service = {
250
+ resolve: (artifacts: {
251
+ id: ObjectId;
252
+ lastVersion: ObjectVersion;
253
+ }[]) => Promise<Map<ObjectId, {
254
+ version: ObjectVersion;
255
+ diff?: string;
256
+ }>>;
257
+ };
259
258
  }
260
259
  export {};
261
260
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAIL,KAAK,WAAW,EAEhB,KAAK,eAAe,EAEpB,KAAK,eAAe,EACpB,OAAO,EAKP,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAgB,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAU,KAAK,Q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S,EAAE;YAAE,EAAE,EAAE,QAAQ,CAAC;YAAC,WAAW,EAAE,aAAa,CAAA;SAAE,EAAE,KAAK,OAAO,CAC7E,GAAG,CACD,QAAQ,EACR;YACE,OAAO,EAAE,aAAa,CAAC;YACvB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CACF,CACF,CAAC;KACH,CAAC;CACH"}
@@ -1,7 +1,7 @@
1
1
  import { Schema } from 'effect';
2
- import { type MessageContentBlock } from '@dxos/ai';
3
2
  import { type ObjectVersion } from '@dxos/echo-db';
4
3
  import { type BaseEchoObject } from '@dxos/echo-schema';
4
+ import { type ContentBlock } from '@dxos/schema';
5
5
  declare const VersionPinSchema: Schema.Struct<{
6
6
  objectId: import("@dxos/keys").ObjectIdClass;
7
7
  version: Schema.Schema<ObjectVersion, ObjectVersion, never>;
@@ -15,7 +15,7 @@ export interface VersionPin extends Schema.Schema.Type<typeof VersionPinSchema>
15
15
  export declare const VersionPin: typeof VersionPinSchema & {
16
16
  DISPOSITION: 'version-pin';
17
17
  fromObject: (object: BaseEchoObject) => VersionPin;
18
- createBlock: (pin: VersionPin) => MessageContentBlock;
18
+ createBlock: (pin: VersionPin) => ContentBlock.Any;
19
19
  };
20
20
  export {};
21
21
  //# sourceMappingURL=version-pin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKlE,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,cAAc,KAAK,UAAU,CAAC;IACnD,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,mBAAmB,CAAC;CAiBvD,CAAC"}
1
+ {"version":3,"file":"version-pin.d.ts","sourceRoot":"","sources":["../../../../src/session/version-pin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,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,cAAc,KAAK,UAAU,CAAC;IACnD,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,YAAY,CAAC,GAAG,CAAC;CAiBpD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './prompt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { type AssociatedArtifact } from '@dxos/blueprints';
2
+ /**
3
+ * Type for assistant prompt variables.
4
+ */
5
+ export type AssistantPromptOptions = {
6
+ /**
7
+ * Instructions for each artifact.
8
+ */
9
+ artifacts?: string[];
10
+ /**
11
+ * Associated artifact to include in the prompt.
12
+ * @deprecated
13
+ */
14
+ artifact?: AssociatedArtifact;
15
+ /**
16
+ * Whether to include suggestions in the prompt.
17
+ */
18
+ suggestions?: boolean;
19
+ /**
20
+ * Additional instructions to include in the prompt.
21
+ */
22
+ instructions?: string;
23
+ /**
24
+ * Emit chain-of-thought inside <cot> tag.
25
+ * Should be `false` for models with built-in reasoning: Claude, deepseek, o1.
26
+ */
27
+ cot?: boolean;
28
+ };
29
+ export declare const createSystemPrompt: (options: AssistantPromptOptions) => string;
30
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/templates/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAAY,MAAM,kBAAkB,CAAC;AAIrE;;GAEG;AAEH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,SAAS,sBAAsB,WAEjE,CAAC"}
@@ -1,3 +1,13 @@
1
+ import { Schema } from 'effect';
1
2
  import { type ObjectId } from '@dxos/echo-schema';
3
+ import { DXN, type SpaceId } from '@dxos/keys';
2
4
  export declare const createArtifactElement: (id: ObjectId) => string;
5
+ /**
6
+ * A model-friendly way to reference an object.
7
+ * Supports vairous formats that will be normalized to a DXN.
8
+ */
9
+ export declare const ArtifactId: Schema.Schema<string> & {
10
+ toDXN: (reference: ArtifactId, owningSpaceId?: SpaceId) => DXN;
11
+ };
12
+ export type ArtifactId = Schema.Schema.Type<typeof ArtifactId>;
3
13
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,eAAO,MAAM,qBAAqB,GAAI,IAAI,QAAQ,WAA4B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAmB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,qBAAqB,GAAI,IAAI,QAAQ,WAA4B,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG;IAC/C,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,GAAG,CAAC;CA4BhE,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC"}