@dxos/assistant 0.8.0 → 0.8.1-main.013e445
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.
- package/dist/lib/browser/chunk-BDMTBYIM.mjs +2285 -0
- package/dist/lib/browser/chunk-BDMTBYIM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +328 -1206
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +17 -3
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/chunk-A44NGSCM.cjs +2296 -0
- package/dist/lib/node/chunk-A44NGSCM.cjs.map +7 -0
- package/dist/lib/node/index.cjs +335 -1206
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +40 -29
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/lib/node-esm/chunk-J6DMSFSZ.mjs +2287 -0
- package/dist/lib/node-esm/chunk-J6DMSFSZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +328 -1206
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +17 -3
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/ai-service/defs.d.ts +8 -2
- package/dist/types/src/ai-service/defs.d.ts.map +1 -1
- package/dist/types/src/ai-service/edge-client.d.ts +19 -0
- package/dist/types/src/ai-service/edge-client.d.ts.map +1 -0
- package/dist/types/src/ai-service/index.d.ts +4 -1
- package/dist/types/src/ai-service/index.d.ts.map +1 -1
- package/dist/types/src/ai-service/message-collector.d.ts +88 -0
- package/dist/types/src/ai-service/message-collector.d.ts.map +1 -0
- package/dist/types/src/ai-service/ollama-client.d.ts +39 -0
- package/dist/types/src/ai-service/ollama-client.d.ts.map +1 -0
- package/dist/types/src/ai-service/parser.d.ts +11 -9
- package/dist/types/src/ai-service/parser.d.ts.map +1 -1
- package/dist/types/src/ai-service/service.d.ts +9 -0
- package/dist/types/src/ai-service/service.d.ts.map +1 -0
- package/dist/types/src/ai-service/stream.d.ts +2 -1
- package/dist/types/src/ai-service/stream.d.ts.map +1 -1
- package/dist/types/src/ai-service/testing/mock.d.ts +2 -2
- package/dist/types/src/ai-service/testing/mock.d.ts.map +1 -1
- package/dist/types/src/ai-service/types.d.ts +91 -157
- package/dist/types/src/ai-service/types.d.ts.map +1 -1
- package/dist/types/src/conversation/conversation.d.ts +11 -9
- package/dist/types/src/conversation/conversation.d.ts.map +1 -1
- package/dist/types/src/conversation/types.d.ts +1 -1
- package/dist/types/src/conversation/types.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/session/index.d.ts +2 -0
- package/dist/types/src/session/index.d.ts.map +1 -0
- package/dist/types/src/session/session.d.ts +215 -0
- package/dist/types/src/session/session.d.ts.map +1 -0
- package/dist/types/src/session/session.test.d.ts +2 -0
- package/dist/types/src/session/session.test.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/ollama.d.ts +6 -0
- package/dist/types/src/testing/ollama.d.ts.map +1 -0
- package/dist/types/src/testing/query-promts.d.ts +1 -1
- package/dist/types/src/testing/query-promts.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +1 -1
- package/dist/types/src/testing/test-data.d.ts.map +1 -1
- package/dist/types/src/testing/test-schema.d.ts +1 -1
- package/dist/types/src/testing/test-schema.d.ts.map +1 -1
- package/package.json +17 -14
- package/src/ai-service/client.test.ts +100 -13
- package/src/ai-service/defs.ts +18 -3
- package/src/ai-service/{client.ts → edge-client.ts} +18 -26
- package/src/ai-service/index.ts +4 -1
- package/src/ai-service/message-collector.ts +84 -0
- package/src/ai-service/ollama-client.ts +499 -0
- package/src/ai-service/parser.ts +8 -2
- package/src/ai-service/service.ts +15 -0
- package/src/ai-service/stream.ts +5 -3
- package/src/ai-service/testing/mock.ts +7 -2
- package/src/ai-service/types.ts +3 -3
- package/src/bin/chat.ts +3 -3
- package/src/conversation/conversation.test.ts +5 -5
- package/src/conversation/conversation.ts +3 -2
- package/src/conversation/types.ts +1 -1
- package/src/index.ts +1 -0
- package/src/session/index.ts +5 -0
- package/src/session/session.test.ts +256 -0
- package/src/session/session.ts +369 -0
- package/src/testing/artifacts.test.ts +4 -4
- package/src/testing/index.ts +1 -0
- package/src/testing/object-extraction.test.ts +1 -1
- package/src/testing/ollama.ts +15 -0
- package/src/testing/query-promts.ts +1 -1
- package/src/testing/query.test.ts +4 -4
- package/src/testing/test-data.ts +1 -1
- package/src/testing/test-schema.ts +1 -1
- package/dist/lib/browser/chunk-AXUUNA7O.mjs +0 -565
- package/dist/lib/browser/chunk-AXUUNA7O.mjs.map +0 -7
- package/dist/lib/node/chunk-QPHGQINW.cjs +0 -577
- package/dist/lib/node/chunk-QPHGQINW.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-GOVFOBIB.mjs +0 -567
- package/dist/lib/node-esm/chunk-GOVFOBIB.mjs.map +0 -7
- package/dist/types/src/ai-service/client.d.ts +0 -25
- package/dist/types/src/ai-service/client.d.ts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Schema as S } from '
|
|
1
|
+
import { Schema as S } from 'effect';
|
|
2
2
|
import { Message, type MessageContentBlock } from '@dxos/artifact';
|
|
3
3
|
import { ObjectId } from '@dxos/echo-schema';
|
|
4
4
|
export declare const createArtifactElement: (id: ObjectId) => string;
|
|
5
|
-
export declare const LLMModel: S.
|
|
5
|
+
export declare const LLMModel: S.Literal<["@anthropic/claude-3-5-haiku-20241022", "@anthropic/claude-3-5-sonnet-20241022", "@anthropic/claude-3-7-sonnet-20250219", "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b", "@hf/nousresearch/hermes-2-pro-mistral-7b", "@ollama/llama-3-1-nemotron-70b-instruct", "@ollama/llama-3-1-nemotron-mini-4b-instruct", "@ollama/llama-3-2-3b", "llama3.2:1b", "llama3:70b", "deepseek-r1:latest"]>;
|
|
6
6
|
export type LLMModel = S.Schema.Type<typeof LLMModel>;
|
|
7
7
|
export declare const ToolTypes: Readonly<{
|
|
8
8
|
TextToImage: "text_to_image";
|
|
@@ -16,7 +16,7 @@ export declare const GenerateRequest: S.Struct<{
|
|
|
16
16
|
/**
|
|
17
17
|
* Preferred model or system default.
|
|
18
18
|
*/
|
|
19
|
-
model: S.optional<S.
|
|
19
|
+
model: S.optional<S.Literal<["@anthropic/claude-3-5-haiku-20241022", "@anthropic/claude-3-5-sonnet-20241022", "@anthropic/claude-3-7-sonnet-20250219", "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b", "@hf/nousresearch/hermes-2-pro-mistral-7b", "@ollama/llama-3-1-nemotron-70b-instruct", "@ollama/llama-3-1-nemotron-mini-4b-instruct", "@ollama/llama-3-2-3b", "llama3.2:1b", "llama3:70b", "deepseek-r1:latest"]>>;
|
|
20
20
|
/**
|
|
21
21
|
* Tools available for the LLM.
|
|
22
22
|
*/
|
|
@@ -37,163 +37,97 @@ export declare const GenerateRequest: S.Struct<{
|
|
|
37
37
|
/**
|
|
38
38
|
* History of messages to include in the context window.
|
|
39
39
|
*/
|
|
40
|
-
history: S.optional<S.Array$<S.
|
|
41
|
-
|
|
42
|
-
spaceId
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
pending
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
text: string;
|
|
85
|
-
disposition?: string | undefined;
|
|
86
|
-
} | {
|
|
87
|
-
pending?: boolean | undefined;
|
|
88
|
-
type: "json";
|
|
89
|
-
disposition?: string | undefined;
|
|
90
|
-
json: string;
|
|
91
|
-
} | {
|
|
92
|
-
pending?: boolean | undefined;
|
|
93
|
-
id?: string | undefined;
|
|
94
|
-
type: "image";
|
|
95
|
-
source?: {
|
|
96
|
-
type: "base64";
|
|
97
|
-
mediaType: string;
|
|
98
|
-
data: string;
|
|
99
|
-
} | undefined;
|
|
100
|
-
} | {
|
|
101
|
-
pending?: boolean | undefined;
|
|
102
|
-
id: string;
|
|
103
|
-
type: "tool_use";
|
|
104
|
-
name: string;
|
|
105
|
-
input: unknown;
|
|
106
|
-
} | {
|
|
107
|
-
pending?: boolean | undefined;
|
|
108
|
-
type: "tool_result";
|
|
109
|
-
toolUseId: string;
|
|
110
|
-
content: string;
|
|
111
|
-
isError?: boolean | undefined;
|
|
112
|
-
})[];
|
|
113
|
-
threadId?: string | undefined;
|
|
114
|
-
foreignId?: string | undefined;
|
|
115
|
-
role: "user" | "assistant";
|
|
116
|
-
}, never>>>;
|
|
40
|
+
history: S.optional<S.Array$<import("@dxos/echo-schema").EchoObjectSchema<S.Struct<{
|
|
41
|
+
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
42
|
+
spaceId: S.optional<S.Schema<import("@dxos/keys").SpaceId, string, never>>;
|
|
43
|
+
threadId: S.optional<import("@dxos/echo-schema").ObjectIdClass>;
|
|
44
|
+
foreignId: S.optional<typeof S.String>;
|
|
45
|
+
role: S.refine<"user" | "assistant", S.Schema<string, string, never>>;
|
|
46
|
+
content: S.mutable<S.Array$<S.Union<[S.mutable<S.extend<S.Struct<{
|
|
47
|
+
pending: S.optional<typeof S.Boolean>;
|
|
48
|
+
}>, S.Struct<{
|
|
49
|
+
type: S.Literal<["text"]>;
|
|
50
|
+
disposition: S.optional<typeof S.String>;
|
|
51
|
+
text: typeof S.String;
|
|
52
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
53
|
+
pending: S.optional<typeof S.Boolean>;
|
|
54
|
+
}>, S.Struct<{
|
|
55
|
+
type: S.Literal<["json"]>;
|
|
56
|
+
disposition: S.optional<typeof S.String>;
|
|
57
|
+
json: typeof S.String;
|
|
58
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
59
|
+
pending: S.optional<typeof S.Boolean>;
|
|
60
|
+
}>, S.Struct<{
|
|
61
|
+
type: S.Literal<["image"]>;
|
|
62
|
+
id: S.optional<typeof S.String>;
|
|
63
|
+
source: S.optional<S.mutable<S.Struct<{
|
|
64
|
+
type: S.Literal<["base64"]>;
|
|
65
|
+
mediaType: typeof S.String;
|
|
66
|
+
data: typeof S.String;
|
|
67
|
+
}>>>;
|
|
68
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
69
|
+
pending: S.optional<typeof S.Boolean>;
|
|
70
|
+
}>, S.Struct<{
|
|
71
|
+
type: S.Literal<["tool_use"]>;
|
|
72
|
+
id: typeof S.String;
|
|
73
|
+
name: typeof S.String;
|
|
74
|
+
input: typeof S.Unknown;
|
|
75
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
76
|
+
pending: S.optional<typeof S.Boolean>;
|
|
77
|
+
}>, S.Struct<{
|
|
78
|
+
type: S.Literal<["tool_result"]>;
|
|
79
|
+
toolUseId: typeof S.String;
|
|
80
|
+
content: typeof S.String;
|
|
81
|
+
isError: S.optional<typeof S.Boolean>;
|
|
82
|
+
}>>>]>>>;
|
|
83
|
+
}>>>>;
|
|
117
84
|
/**
|
|
118
85
|
* Current request.
|
|
119
86
|
*/
|
|
120
|
-
prompt: S.optional<S.
|
|
121
|
-
|
|
122
|
-
spaceId
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
pending
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
text: string;
|
|
165
|
-
disposition?: string | undefined;
|
|
166
|
-
} | {
|
|
167
|
-
pending?: boolean | undefined;
|
|
168
|
-
type: "json";
|
|
169
|
-
disposition?: string | undefined;
|
|
170
|
-
json: string;
|
|
171
|
-
} | {
|
|
172
|
-
pending?: boolean | undefined;
|
|
173
|
-
id?: string | undefined;
|
|
174
|
-
type: "image";
|
|
175
|
-
source?: {
|
|
176
|
-
type: "base64";
|
|
177
|
-
mediaType: string;
|
|
178
|
-
data: string;
|
|
179
|
-
} | undefined;
|
|
180
|
-
} | {
|
|
181
|
-
pending?: boolean | undefined;
|
|
182
|
-
id: string;
|
|
183
|
-
type: "tool_use";
|
|
184
|
-
name: string;
|
|
185
|
-
input: unknown;
|
|
186
|
-
} | {
|
|
187
|
-
pending?: boolean | undefined;
|
|
188
|
-
type: "tool_result";
|
|
189
|
-
toolUseId: string;
|
|
190
|
-
content: string;
|
|
191
|
-
isError?: boolean | undefined;
|
|
192
|
-
})[];
|
|
193
|
-
threadId?: string | undefined;
|
|
194
|
-
foreignId?: string | undefined;
|
|
195
|
-
role: "user" | "assistant";
|
|
196
|
-
}, never>>;
|
|
87
|
+
prompt: S.optional<import("@dxos/echo-schema").EchoObjectSchema<S.Struct<{
|
|
88
|
+
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
89
|
+
spaceId: S.optional<S.Schema<import("@dxos/keys").SpaceId, string, never>>;
|
|
90
|
+
threadId: S.optional<import("@dxos/echo-schema").ObjectIdClass>;
|
|
91
|
+
foreignId: S.optional<typeof S.String>;
|
|
92
|
+
role: S.refine<"user" | "assistant", S.Schema<string, string, never>>;
|
|
93
|
+
content: S.mutable<S.Array$<S.Union<[S.mutable<S.extend<S.Struct<{
|
|
94
|
+
pending: S.optional<typeof S.Boolean>;
|
|
95
|
+
}>, S.Struct<{
|
|
96
|
+
type: S.Literal<["text"]>;
|
|
97
|
+
disposition: S.optional<typeof S.String>;
|
|
98
|
+
text: typeof S.String;
|
|
99
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
100
|
+
pending: S.optional<typeof S.Boolean>;
|
|
101
|
+
}>, S.Struct<{
|
|
102
|
+
type: S.Literal<["json"]>;
|
|
103
|
+
disposition: S.optional<typeof S.String>;
|
|
104
|
+
json: typeof S.String;
|
|
105
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
106
|
+
pending: S.optional<typeof S.Boolean>;
|
|
107
|
+
}>, S.Struct<{
|
|
108
|
+
type: S.Literal<["image"]>;
|
|
109
|
+
id: S.optional<typeof S.String>;
|
|
110
|
+
source: S.optional<S.mutable<S.Struct<{
|
|
111
|
+
type: S.Literal<["base64"]>;
|
|
112
|
+
mediaType: typeof S.String;
|
|
113
|
+
data: typeof S.String;
|
|
114
|
+
}>>>;
|
|
115
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
116
|
+
pending: S.optional<typeof S.Boolean>;
|
|
117
|
+
}>, S.Struct<{
|
|
118
|
+
type: S.Literal<["tool_use"]>;
|
|
119
|
+
id: typeof S.String;
|
|
120
|
+
name: typeof S.String;
|
|
121
|
+
input: typeof S.Unknown;
|
|
122
|
+
}>>>, S.mutable<S.extend<S.Struct<{
|
|
123
|
+
pending: S.optional<typeof S.Boolean>;
|
|
124
|
+
}>, S.Struct<{
|
|
125
|
+
type: S.Literal<["tool_result"]>;
|
|
126
|
+
toolUseId: typeof S.String;
|
|
127
|
+
content: typeof S.String;
|
|
128
|
+
isError: S.optional<typeof S.Boolean>;
|
|
129
|
+
}>>>]>>>;
|
|
130
|
+
}>>>;
|
|
197
131
|
}>;
|
|
198
132
|
export type GenerateRequest = S.Schema.Type<typeof GenerateRequest>;
|
|
199
133
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAQ,OAAO,EAAE,KAAK,mBAAmB,EAAiB,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,eAAO,MAAM,qBAAqB,OAAQ,QAAQ,WAA4B,CAAC;AAE/E,eAAO,MAAM,QAAQ,wYAA8D,CAAC;AAEpF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEtD,eAAO,MAAM,SAAS;;EAIpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;IAI1B;;OAEG;;IAGH;;OAEG;;qBA4BuB,EAAE,MAC9B;mBAAgB,EAAG,QAAQ,QAAO,EAChC,MACD;kBAAgB,EAAG,QAAQ,QAAO,EAAG,MAAM;cAgBxB,EAAG,QAAQ,QAC3B,EACF,MAAG;iBAIG,EAAE,QACJ,QAAO,EAAG,MAAM;qBAIH,EAAG,Q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|
history: {
|
|
25
25
|
readonly id: string;
|
|
26
26
|
spaceId?: SpaceId | undefined;
|
|
27
|
+
threadId?: string | undefined;
|
|
28
|
+
foreignId?: string | undefined;
|
|
29
|
+
role: "user" | "assistant";
|
|
27
30
|
content: ({
|
|
28
31
|
pending?: boolean | undefined;
|
|
29
32
|
type: "text";
|
|
30
|
-
text: string;
|
|
31
33
|
disposition?: string | undefined;
|
|
34
|
+
text: string;
|
|
32
35
|
} | {
|
|
33
36
|
pending?: boolean | undefined;
|
|
34
37
|
type: "json";
|
|
@@ -36,8 +39,8 @@ export declare const runLLM: (params: CreateLLMConversationParams) => Promise<{
|
|
|
36
39
|
json: string;
|
|
37
40
|
} | {
|
|
38
41
|
pending?: boolean | undefined;
|
|
39
|
-
id?: string | undefined;
|
|
40
42
|
type: "image";
|
|
43
|
+
id?: string | undefined;
|
|
41
44
|
source?: {
|
|
42
45
|
type: "base64";
|
|
43
46
|
mediaType: string;
|
|
@@ -45,23 +48,22 @@ export declare const runLLM: (params: CreateLLMConversationParams) => Promise<{
|
|
|
45
48
|
} | undefined;
|
|
46
49
|
} | {
|
|
47
50
|
pending?: boolean | undefined;
|
|
48
|
-
id: string;
|
|
49
|
-
type: "tool_use";
|
|
50
51
|
name: string;
|
|
52
|
+
type: "tool_use";
|
|
53
|
+
id: string;
|
|
51
54
|
input: unknown;
|
|
52
55
|
} | {
|
|
53
56
|
pending?: boolean | undefined;
|
|
54
57
|
type: "tool_result";
|
|
55
|
-
toolUseId: string;
|
|
56
58
|
content: string;
|
|
59
|
+
toolUseId: string;
|
|
57
60
|
isError?: boolean | undefined;
|
|
58
61
|
})[];
|
|
59
|
-
threadId?: string | undefined;
|
|
60
|
-
foreignId?: string | undefined;
|
|
61
|
-
role: "user" | "assistant";
|
|
62
62
|
}[];
|
|
63
63
|
}>;
|
|
64
|
-
export declare const isToolUse: (message: Message
|
|
64
|
+
export declare const isToolUse: (message: Message, { onlyToolNames }?: {
|
|
65
|
+
onlyToolNames?: string[];
|
|
66
|
+
}) => boolean;
|
|
65
67
|
export type RunToolsOptions = {
|
|
66
68
|
message: Message;
|
|
67
69
|
tools: Tool[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/conversation/conversation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAc,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAgB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEhG,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,QAAQ,CAAC;IAEhB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,GACD,qBAAqB,CAAC;AAG1B,eAAO,MAAM,MAAM,WAAkB,2BAA2B
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/conversation/conversation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAc,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAgB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAA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C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/conversation/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/conversation/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAgB,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,eAAO,MAAM,iBAAiB,YAAa,OAAO,YAAY,QAAQ,QAAQ,MAAM,KAAG,OAMrF,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;EAKzB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CAClF,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,qBAAqB;KAAG;CACnC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAAE,GAClF;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvC,eAAO,MAAM,UAAU;IACrB;;;OAGG;sBACe,OAAO,yBAAyB,mBAAmB,EAAE,KAAG,UAAU;qBAMnE,MAAM,KAAG,UAAU;IACpC;;OAEG;oBACa,OAAO,KAAG,UAAU;EACpC,CAAC;AAEH,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,CAAC,CAAC,MAAM,CAAC,YAAY,IAAI;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CAChG,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,MAAM,SAAS,CAAC,CAAC,MAAM,CAAC,YAAY,2CAK5D,gBAAgB,CAAC,MAAM,CAAC,KAAG,cAU7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/session/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { Schema as S } from 'effect';
|
|
2
|
+
import { Message, type ArtifactDefinition, type Tool } from '@dxos/artifact';
|
|
3
|
+
import { Event } from '@dxos/async';
|
|
4
|
+
import { type AIServiceClient, type GenerateRequest } from '../ai-service';
|
|
5
|
+
/**
|
|
6
|
+
* Contains message history, tools, current context.
|
|
7
|
+
* Current context means the state of the app, time of day, and other contextual information.
|
|
8
|
+
* It makes requests to the model, its a state machine.
|
|
9
|
+
* It keeps track of the current goal.
|
|
10
|
+
* It manages the context window.
|
|
11
|
+
* Tracks the success criteria of reaching the goal, exposing metrics (stretch)
|
|
12
|
+
* Could be run locally in the app or remotely.
|
|
13
|
+
* Could be personal or shared.
|
|
14
|
+
*/
|
|
15
|
+
export type SessionRunOptions = {
|
|
16
|
+
client: AIServiceClient;
|
|
17
|
+
artifacts: ArtifactDefinition[];
|
|
18
|
+
/**
|
|
19
|
+
* Non-artifact specific tools.
|
|
20
|
+
*/
|
|
21
|
+
tools: Tool[];
|
|
22
|
+
history: Message[];
|
|
23
|
+
prompt: string;
|
|
24
|
+
generationOptions?: Pick<GenerateRequest, 'model' | 'systemPrompt'>;
|
|
25
|
+
extensions?: ToolContextExtensions;
|
|
26
|
+
/**
|
|
27
|
+
* Pre-require artifacts.
|
|
28
|
+
*/
|
|
29
|
+
requiredArtifactIds?: string[];
|
|
30
|
+
};
|
|
31
|
+
type OperationModel = 'planning' | 'immediate';
|
|
32
|
+
export type AiSessionOptions = {
|
|
33
|
+
/**
|
|
34
|
+
* In planning mode, the model will create a plan before executing the user's request.
|
|
35
|
+
* The plan will determine the artifacts that will be used to perform the actions.
|
|
36
|
+
* In require mode, the model will select the artifacts that will be used to perform the actions.
|
|
37
|
+
*/
|
|
38
|
+
operationModel: OperationModel;
|
|
39
|
+
};
|
|
40
|
+
export declare class AISession {
|
|
41
|
+
private readonly _options;
|
|
42
|
+
/** SSE stream parser. */
|
|
43
|
+
private readonly _parser;
|
|
44
|
+
/** Pending messages (incl. the current user request). */
|
|
45
|
+
private _pending;
|
|
46
|
+
/** Current streaming response. */
|
|
47
|
+
private _stream;
|
|
48
|
+
/** Prior history from queue. */
|
|
49
|
+
private _history;
|
|
50
|
+
/**
|
|
51
|
+
* New message.
|
|
52
|
+
*/
|
|
53
|
+
readonly message: Event<{
|
|
54
|
+
readonly id: string;
|
|
55
|
+
spaceId?: import("@dxos/keys").SpaceId | undefined;
|
|
56
|
+
threadId?: string | undefined;
|
|
57
|
+
foreignId?: string | undefined;
|
|
58
|
+
role: "user" | "assistant";
|
|
59
|
+
content: ({
|
|
60
|
+
pending?: boolean | undefined;
|
|
61
|
+
type: "text";
|
|
62
|
+
disposition?: string | undefined;
|
|
63
|
+
text: string;
|
|
64
|
+
} | {
|
|
65
|
+
pending?: boolean | undefined;
|
|
66
|
+
type: "json";
|
|
67
|
+
disposition?: string | undefined;
|
|
68
|
+
json: string;
|
|
69
|
+
} | {
|
|
70
|
+
pending?: boolean | undefined;
|
|
71
|
+
type: "image";
|
|
72
|
+
id?: string | undefined;
|
|
73
|
+
source?: {
|
|
74
|
+
type: "base64";
|
|
75
|
+
mediaType: string;
|
|
76
|
+
data: string;
|
|
77
|
+
} | undefined;
|
|
78
|
+
} | {
|
|
79
|
+
pending?: boolean | undefined;
|
|
80
|
+
name: string;
|
|
81
|
+
type: "tool_use";
|
|
82
|
+
id: string;
|
|
83
|
+
input: unknown;
|
|
84
|
+
} | {
|
|
85
|
+
pending?: boolean | undefined;
|
|
86
|
+
type: "tool_result";
|
|
87
|
+
content: string;
|
|
88
|
+
toolUseId: string;
|
|
89
|
+
isError?: boolean | undefined;
|
|
90
|
+
})[];
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Complete block added to Message.
|
|
94
|
+
*/
|
|
95
|
+
readonly block: Event<{
|
|
96
|
+
pending?: boolean | undefined;
|
|
97
|
+
type: "text";
|
|
98
|
+
disposition?: string | undefined;
|
|
99
|
+
text: string;
|
|
100
|
+
} | {
|
|
101
|
+
pending?: boolean | undefined;
|
|
102
|
+
type: "json";
|
|
103
|
+
disposition?: string | undefined;
|
|
104
|
+
json: string;
|
|
105
|
+
} | {
|
|
106
|
+
pending?: boolean | undefined;
|
|
107
|
+
type: "image";
|
|
108
|
+
id?: string | undefined;
|
|
109
|
+
source?: {
|
|
110
|
+
type: "base64";
|
|
111
|
+
mediaType: string;
|
|
112
|
+
data: string;
|
|
113
|
+
} | undefined;
|
|
114
|
+
} | {
|
|
115
|
+
pending?: boolean | undefined;
|
|
116
|
+
name: string;
|
|
117
|
+
type: "tool_use";
|
|
118
|
+
id: string;
|
|
119
|
+
input: unknown;
|
|
120
|
+
} | {
|
|
121
|
+
pending?: boolean | undefined;
|
|
122
|
+
type: "tool_result";
|
|
123
|
+
content: string;
|
|
124
|
+
toolUseId: string;
|
|
125
|
+
isError?: boolean | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Update partial block (while streaming).
|
|
129
|
+
*/
|
|
130
|
+
readonly update: Event<{
|
|
131
|
+
pending?: boolean | undefined;
|
|
132
|
+
type: "text";
|
|
133
|
+
disposition?: string | undefined;
|
|
134
|
+
text: string;
|
|
135
|
+
} | {
|
|
136
|
+
pending?: boolean | undefined;
|
|
137
|
+
type: "json";
|
|
138
|
+
disposition?: string | undefined;
|
|
139
|
+
json: string;
|
|
140
|
+
} | {
|
|
141
|
+
pending?: boolean | undefined;
|
|
142
|
+
type: "image";
|
|
143
|
+
id?: string | undefined;
|
|
144
|
+
source?: {
|
|
145
|
+
type: "base64";
|
|
146
|
+
mediaType: string;
|
|
147
|
+
data: string;
|
|
148
|
+
} | undefined;
|
|
149
|
+
} | {
|
|
150
|
+
pending?: boolean | undefined;
|
|
151
|
+
name: string;
|
|
152
|
+
type: "tool_use";
|
|
153
|
+
id: string;
|
|
154
|
+
input: unknown;
|
|
155
|
+
} | {
|
|
156
|
+
pending?: boolean | undefined;
|
|
157
|
+
type: "tool_result";
|
|
158
|
+
content: string;
|
|
159
|
+
toolUseId: string;
|
|
160
|
+
isError?: boolean | undefined;
|
|
161
|
+
}>;
|
|
162
|
+
readonly streamEvent: Event<import("..").GenerationStreamEvent>;
|
|
163
|
+
/**
|
|
164
|
+
* User prompt or tool result.
|
|
165
|
+
*/
|
|
166
|
+
readonly userMessage: Event<{
|
|
167
|
+
readonly id: string;
|
|
168
|
+
spaceId?: import("@dxos/keys").SpaceId | undefined;
|
|
169
|
+
threadId?: string | undefined;
|
|
170
|
+
foreignId?: string | undefined;
|
|
171
|
+
role: "user" | "assistant";
|
|
172
|
+
content: ({
|
|
173
|
+
pending?: boolean | undefined;
|
|
174
|
+
type: "text";
|
|
175
|
+
disposition?: string | undefined;
|
|
176
|
+
text: string;
|
|
177
|
+
} | {
|
|
178
|
+
pending?: boolean | undefined;
|
|
179
|
+
type: "json";
|
|
180
|
+
disposition?: string | undefined;
|
|
181
|
+
json: string;
|
|
182
|
+
} | {
|
|
183
|
+
pending?: boolean | undefined;
|
|
184
|
+
type: "image";
|
|
185
|
+
id?: string | undefined;
|
|
186
|
+
source?: {
|
|
187
|
+
type: "base64";
|
|
188
|
+
mediaType: string;
|
|
189
|
+
data: string;
|
|
190
|
+
} | undefined;
|
|
191
|
+
} | {
|
|
192
|
+
pending?: boolean | undefined;
|
|
193
|
+
name: string;
|
|
194
|
+
type: "tool_use";
|
|
195
|
+
id: string;
|
|
196
|
+
input: unknown;
|
|
197
|
+
} | {
|
|
198
|
+
pending?: boolean | undefined;
|
|
199
|
+
type: "tool_result";
|
|
200
|
+
content: string;
|
|
201
|
+
toolUseId: string;
|
|
202
|
+
isError?: boolean | undefined;
|
|
203
|
+
})[];
|
|
204
|
+
}>;
|
|
205
|
+
constructor(_options: AiSessionOptions);
|
|
206
|
+
run(options: SessionRunOptions): Promise<Message[]>;
|
|
207
|
+
abort(): void;
|
|
208
|
+
}
|
|
209
|
+
declare const AIServiecOverloadedError_base: S.TaggedErrorClass<AIServiecOverloadedError, "AIServiecOverloadedError", {
|
|
210
|
+
readonly _tag: S.tag<"AIServiecOverloadedError">;
|
|
211
|
+
}>;
|
|
212
|
+
export declare class AIServiecOverloadedError extends AIServiecOverloadedError_base {
|
|
213
|
+
}
|
|
214
|
+
export {};
|
|
215
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAc,OAAO,EAAc,KAAK,kBAAkB,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,KAAK,EAAgB,MAAM,aAAa,CAAC;AAKlD,OAAO,EAAqB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAyB,MAAM,eAAe,CAAC;AAErH;;;;;;;;;GASG;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,eAAe,CAAC;IAExB,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,IAAI,EAAE,CAAC;IAEd,OAAO,EAAE,OAAO,EAAE,CAAC;IAEnB,MAAM,EAAE,MAAM,CAAC;IAEf,iBAAiB,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,cAAc,CAAC,CAAC;IAEpE,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAEnC;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,KAAK,cAAc,GAAG,UAAU,GAAG,WAAW,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,qBAAa,SAAS;IAmCR,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAlCrC,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IAEnD,yDAAyD;IACzD,OAAO,CAAC,QAAQ,CAAiB;IAEjC,kCAAkC;IAClC,OAAO,CAAC,OAAO,CAA+B;IAE9C,gCAAgC;IAChC,OAAO,CAAC,QAAQ,CAAiB;IAEjC;;OAEG;IACH,SAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAwB;IAE/C;;OAEG;IACH,SAAgB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAsB;IAE3C;;OAEG;IACH,SAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAuB;IAE7C,SAAgB,WAAW,4CAA4B;IAEvD;;OAEG;IACH,SAAgB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAwB;gBAEtB,QAAQ,EAAE,gBAAgB;IAQjD,GAAG,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA8NzD,KAAK;CAGN;;;;AAqCD,qBAAa,wBAAyB,SAAQ,6BAG7C;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.test.d.ts","sourceRoot":"","sources":["../../../../src/session/session.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OllamaClient, type OllamaClientParams } from '../ai-service';
|
|
2
|
+
/**
|
|
3
|
+
* Create a test client with small local model and no temperature for predictable results.
|
|
4
|
+
*/
|
|
5
|
+
export declare const createTestOllamaClient: (options?: Pick<OllamaClientParams, "tools">) => OllamaClient;
|
|
6
|
+
//# sourceMappingURL=ollama.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../src/testing/ollama.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE5F;;GAEG;AACH,eAAO,MAAM,sBAAsB,aAAc,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,iBAKjF,CAAC"}
|