@dxos/assistant 0.8.3-main.7f5a14c → 0.8.3
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/index.mjs +49 -28
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +53 -32
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +49 -28
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/blueprint/blueprint.d.ts +3 -2
- package/dist/types/src/blueprint/blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprint/machine.d.ts +10 -4
- package/dist/types/src/blueprint/machine.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +31 -33
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -1
- package/dist/types/src/extraction/extraction.d.ts +104 -100
- package/dist/types/src/extraction/extraction.d.ts.map +1 -1
- package/dist/types/src/extraction/quotes.d.ts.map +1 -1
- package/dist/types/src/research/graph.d.ts +3 -2
- package/dist/types/src/research/graph.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +6 -6
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/blueprint/ai.test.ts +1 -1
- package/src/blueprint/blueprint.test.ts +5 -5
- package/src/blueprint/logger.ts +6 -6
- package/src/blueprint/machine.ts +23 -18
- package/src/blueprint/test-data.ts +4 -4
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +2 -2
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +2 -1
- package/src/extraction/quotes.ts +2 -1
- package/src/research/graph.ts +3 -5
- package/src/research/research.test.ts +8 -7
- package/src/research/research.ts +1 -1
- package/src/session/session.test.ts +10 -10
- package/src/session/session.ts +4 -3
- package/src/summarization/summarization.test.ts +17 -12
|
@@ -2,62 +2,61 @@ import { Schema } from 'effect';
|
|
|
2
2
|
import { Expando } from '@dxos/echo-schema';
|
|
3
3
|
import { type FunctionDefinition, type FunctionExecutor } from '@dxos/functions';
|
|
4
4
|
export declare const ExtractionInput: Schema.Struct<{
|
|
5
|
-
message: import("@dxos/echo
|
|
5
|
+
message: import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
6
6
|
id: import("@dxos/keys").ObjectIdClass;
|
|
7
7
|
created: import("effect/Schema").SchemaClass<string, string, never>;
|
|
8
8
|
sender: import("effect/Schema").mutable<import("effect/Schema").Struct<{
|
|
9
|
-
contact: import("effect/Schema").optional<import("@dxos/echo
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}[] | undefined;
|
|
16
|
-
organization?: import("@dxos/echo-schema").Ref<{
|
|
17
|
-
readonly id: string;
|
|
9
|
+
contact: import("effect/Schema").optional<import("@dxos/echo/Type").ref<import("@dxos/echo/Type").obj<import("effect/Schema").Struct<{
|
|
10
|
+
fullName: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
11
|
+
preferredName: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
12
|
+
nickname: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
13
|
+
image: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
14
|
+
organization: import("effect/Schema").optional<import("effect/Schema").Schema<import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
18
15
|
description?: string | undefined;
|
|
16
|
+
id: string;
|
|
19
17
|
name?: string | undefined;
|
|
20
18
|
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
21
19
|
image?: string | undefined;
|
|
22
20
|
website?: string | undefined;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
21
|
+
}>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
22
|
+
jobTitle: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
23
|
+
department: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
24
|
+
notes: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
25
|
+
emails: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
26
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
27
|
+
value: import("effect/Schema").refine<string, typeof import("effect/Schema").String>;
|
|
28
|
+
}>>>>;
|
|
29
|
+
identities: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
30
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
31
|
+
value: typeof import("effect/Schema").String;
|
|
32
|
+
}>>>>;
|
|
33
|
+
phoneNumbers: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
34
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
35
|
+
value: typeof import("effect/Schema").String;
|
|
36
|
+
}>>>>;
|
|
37
|
+
addresses: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
38
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
39
|
+
value: import("effect/Schema").Struct<{
|
|
40
|
+
street: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
41
|
+
extended: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
42
|
+
locality: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
43
|
+
region: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
44
|
+
postalCode: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
45
|
+
postOfficeBoxNumber: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
46
|
+
country: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
47
|
+
}>;
|
|
48
|
+
}>>>>;
|
|
49
|
+
urls: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
50
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
51
|
+
value: import("effect/Schema").refine<string, typeof import("effect/Schema").String>;
|
|
52
|
+
}>>>>;
|
|
53
|
+
birthday: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").SchemaClass<string, string, never>>>;
|
|
54
|
+
fields: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
55
|
+
category: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
56
|
+
label: typeof import("effect/Schema").String;
|
|
57
|
+
value: typeof import("effect/Schema").String;
|
|
58
|
+
}>>>>;
|
|
59
|
+
}>>>>;
|
|
61
60
|
identityDid: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
62
61
|
identityKey: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
63
62
|
email: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
@@ -93,7 +92,10 @@ export declare const ExtractionInput: Schema.Struct<{
|
|
|
93
92
|
pending: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
|
|
94
93
|
}>, import("effect/Schema").Struct<{
|
|
95
94
|
type: import("effect/Schema").Literal<["reference"]>;
|
|
96
|
-
reference: import("@dxos/echo
|
|
95
|
+
reference: import("@dxos/echo/Type").ref<import("effect/Schema").Schema<import("@dxos/echo/Type").Expando, {
|
|
96
|
+
[x: string]: any;
|
|
97
|
+
id: string;
|
|
98
|
+
}, never>>;
|
|
97
99
|
}>>>, import("effect/Schema").mutable<import("effect/Schema").extend<import("effect/Schema").Struct<{
|
|
98
100
|
pending: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
|
|
99
101
|
}>, import("effect/Schema").Struct<{
|
|
@@ -102,7 +104,7 @@ export declare const ExtractionInput: Schema.Struct<{
|
|
|
102
104
|
text: typeof import("effect/Schema").String;
|
|
103
105
|
}>>>]>>>;
|
|
104
106
|
properties: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Record$<typeof import("effect/Schema").String, typeof import("effect/Schema").Any>>>;
|
|
105
|
-
}
|
|
107
|
+
}>>;
|
|
106
108
|
objects: Schema.optional<Schema.Array$<Schema.Schema<Expando, Expando, never>>>;
|
|
107
109
|
options: Schema.optional<Schema.Struct<{
|
|
108
110
|
timeout: Schema.optional<typeof Schema.Number>;
|
|
@@ -112,62 +114,61 @@ export declare const ExtractionInput: Schema.Struct<{
|
|
|
112
114
|
export interface ExtractionInput extends Schema.Schema.Type<typeof ExtractionInput> {
|
|
113
115
|
}
|
|
114
116
|
export declare const ExtractionOutput: Schema.Struct<{
|
|
115
|
-
message: import("@dxos/echo
|
|
117
|
+
message: import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
116
118
|
id: import("@dxos/keys").ObjectIdClass;
|
|
117
119
|
created: import("effect/Schema").SchemaClass<string, string, never>;
|
|
118
120
|
sender: import("effect/Schema").mutable<import("effect/Schema").Struct<{
|
|
119
|
-
contact: import("effect/Schema").optional<import("@dxos/echo
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}[] | undefined;
|
|
126
|
-
organization?: import("@dxos/echo-schema").Ref<{
|
|
127
|
-
readonly id: string;
|
|
121
|
+
contact: import("effect/Schema").optional<import("@dxos/echo/Type").ref<import("@dxos/echo/Type").obj<import("effect/Schema").Struct<{
|
|
122
|
+
fullName: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
123
|
+
preferredName: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
124
|
+
nickname: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
125
|
+
image: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
126
|
+
organization: import("effect/Schema").optional<import("effect/Schema").Schema<import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
128
127
|
description?: string | undefined;
|
|
128
|
+
id: string;
|
|
129
129
|
name?: string | undefined;
|
|
130
130
|
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
131
131
|
image?: string | undefined;
|
|
132
132
|
website?: string | undefined;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
133
|
+
}>, import("@dxos/echo-protocol").EncodedReference, never>>;
|
|
134
|
+
jobTitle: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
135
|
+
department: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
136
|
+
notes: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
137
|
+
emails: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
138
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
139
|
+
value: import("effect/Schema").refine<string, typeof import("effect/Schema").String>;
|
|
140
|
+
}>>>>;
|
|
141
|
+
identities: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
142
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
143
|
+
value: typeof import("effect/Schema").String;
|
|
144
|
+
}>>>>;
|
|
145
|
+
phoneNumbers: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
146
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
147
|
+
value: typeof import("effect/Schema").String;
|
|
148
|
+
}>>>>;
|
|
149
|
+
addresses: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
150
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
151
|
+
value: import("effect/Schema").Struct<{
|
|
152
|
+
street: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
153
|
+
extended: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
154
|
+
locality: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
155
|
+
region: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
156
|
+
postalCode: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
157
|
+
postOfficeBoxNumber: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
158
|
+
country: import("effect/Schema").optional<import("effect/Schema").SchemaClass<string, string, never>>;
|
|
159
|
+
}>;
|
|
160
|
+
}>>>>;
|
|
161
|
+
urls: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
162
|
+
label: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
163
|
+
value: import("effect/Schema").refine<string, typeof import("effect/Schema").String>;
|
|
164
|
+
}>>>>;
|
|
165
|
+
birthday: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").SchemaClass<string, string, never>>>;
|
|
166
|
+
fields: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Array$<import("effect/Schema").Struct<{
|
|
167
|
+
category: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
168
|
+
label: typeof import("effect/Schema").String;
|
|
169
|
+
value: typeof import("effect/Schema").String;
|
|
170
|
+
}>>>>;
|
|
171
|
+
}>>>>;
|
|
171
172
|
identityDid: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
172
173
|
identityKey: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
173
174
|
email: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
@@ -203,7 +204,10 @@ export declare const ExtractionOutput: Schema.Struct<{
|
|
|
203
204
|
pending: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
|
|
204
205
|
}>, import("effect/Schema").Struct<{
|
|
205
206
|
type: import("effect/Schema").Literal<["reference"]>;
|
|
206
|
-
reference: import("@dxos/echo
|
|
207
|
+
reference: import("@dxos/echo/Type").ref<import("effect/Schema").Schema<import("@dxos/echo/Type").Expando, {
|
|
208
|
+
[x: string]: any;
|
|
209
|
+
id: string;
|
|
210
|
+
}, never>>;
|
|
207
211
|
}>>>, import("effect/Schema").mutable<import("effect/Schema").extend<import("effect/Schema").Struct<{
|
|
208
212
|
pending: import("effect/Schema").optional<typeof import("effect/Schema").Boolean>;
|
|
209
213
|
}>, import("effect/Schema").Struct<{
|
|
@@ -212,7 +216,7 @@ export declare const ExtractionOutput: Schema.Struct<{
|
|
|
212
216
|
text: typeof import("effect/Schema").String;
|
|
213
217
|
}>>>]>>>;
|
|
214
218
|
properties: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").Record$<typeof import("effect/Schema").String, typeof import("effect/Schema").Any>>>;
|
|
215
|
-
}
|
|
219
|
+
}>>;
|
|
216
220
|
timeElapsed: typeof Schema.Number;
|
|
217
221
|
}>;
|
|
218
222
|
export interface ExtractionOutput extends Schema.Schema.Type<typeof ExtractionOutput> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../../src/extraction/extraction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIjF,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../../src/extraction/extraction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIjF,eAAO,MAAM,eAAe;;;;;;;;;;;+BA+Dq4iB,CAAC;;wBAA8E,CAAC;0BAAgD,CAAC;yBAAkG,CAAC;2BAAiD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAtDrrjB,CAAC;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;CAAG;AAEtF,eAAO,MAAM,gBAAgB;;;;;;;;;;;+BAmDo4iB,CAAC;;wBAA8E,CAAC;0BAAgD,CAAC;yBAAkG,CAAC;2BAAiD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAhDrrjB,CAAC;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC;CAAG;AAExF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAChE,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;;;WAIG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAEvF;;GAEG;AAEH,eAAO,MAAM,wBAAwB,GAAU,QAAQ,8BAA8B,KAAG,OAAO,CAAC,gBAAgB,CAkB/G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../../../src/extraction/quotes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../../../src/extraction/quotes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAKlD,eAAO,MAAM,gBAAgB;;;;;EAe3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E,eAAO,MAAM,UAAU,GAAU,QAAQ,MAAM,EAAE,EAAE,IAAI,YAAY,KAAG,OAAO,CAAC,gBAAgB,CAS7F,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,QAAQ,gBAAgB,WAYtE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
+
import type { Obj } from '@dxos/echo';
|
|
2
3
|
import { type EchoDatabase, type Queue } from '@dxos/echo-db';
|
|
3
|
-
import { type
|
|
4
|
+
import { type BaseObject } from '@dxos/echo-schema';
|
|
4
5
|
export declare const Subgraph: Schema.Struct<{
|
|
5
6
|
/** Objects and relations. */
|
|
6
7
|
objects: Schema.Array$<typeof Schema.Any>;
|
|
@@ -35,6 +36,6 @@ export declare const createGraphWriterTool: ({ db, queue, schema, onDone, }: {
|
|
|
35
36
|
db: EchoDatabase;
|
|
36
37
|
queue?: Queue;
|
|
37
38
|
schema: Schema.Schema.AnyNoContext[];
|
|
38
|
-
onDone?: (data:
|
|
39
|
+
onDone?: (data: Obj.Any[]) => Promise<any>;
|
|
39
40
|
}) => import("@dxos/ai").ExecutableTool;
|
|
40
41
|
//# 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;
|
|
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,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;AA2CF,eAAO,MAAM,qBAAqB,GAAI,gCAKnC;IACD,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC5C,sCAUA,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
-
import { type AgentStatus, type
|
|
2
|
+
import { type AgentStatus, type AiServiceClient, type GenerateRequest, Message, type ExecutableTool } from '@dxos/ai';
|
|
3
3
|
import { type ArtifactDefinition } from '@dxos/artifact';
|
|
4
4
|
import { Event } from '@dxos/async';
|
|
5
5
|
import { ObjectVersion } from '@dxos/echo-db';
|
|
@@ -28,7 +28,7 @@ export type ArtifactDiffResolver = (artifacts: {
|
|
|
28
28
|
diff?: string;
|
|
29
29
|
}>>;
|
|
30
30
|
export type SessionRunOptions = {
|
|
31
|
-
client:
|
|
31
|
+
client: AiServiceClient;
|
|
32
32
|
artifacts: ArtifactDefinition[];
|
|
33
33
|
/**
|
|
34
34
|
* Non-artifact specific tools.
|
|
@@ -72,8 +72,8 @@ export declare class AISession {
|
|
|
72
72
|
/**
|
|
73
73
|
* New message.
|
|
74
74
|
*/
|
|
75
|
-
readonly message: Event<{
|
|
76
|
-
|
|
75
|
+
readonly message: Event<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
76
|
+
id: string;
|
|
77
77
|
content: ({
|
|
78
78
|
pending?: boolean | undefined;
|
|
79
79
|
type: "text";
|
|
@@ -194,8 +194,8 @@ export declare class AISession {
|
|
|
194
194
|
/**
|
|
195
195
|
* User prompt or tool result.
|
|
196
196
|
*/
|
|
197
|
-
readonly userMessage: Event<{
|
|
198
|
-
|
|
197
|
+
readonly userMessage: Event<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
198
|
+
id: string;
|
|
199
199
|
role: "user" | "assistant";
|
|
200
200
|
content: ({
|
|
201
201
|
pending?: boolean | undefined;
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/session/session.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/assistant",
|
|
3
|
-
"version": "0.8.3
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Natural language interface to DXOS",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -25,25 +25,25 @@
|
|
|
25
25
|
"@xenova/transformers": "^2.17.2",
|
|
26
26
|
"chalk": "^4.1.0",
|
|
27
27
|
"exa-js": "^1.5.12",
|
|
28
|
-
"@dxos/ai": "0.8.3
|
|
29
|
-
"@dxos/artifact": "0.8.3
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/echo": "0.8.3
|
|
34
|
-
"@dxos/echo-
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/keys": "0.8.3
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/log": "0.8.3
|
|
44
|
-
"@dxos/node-std": "0.8.3
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
28
|
+
"@dxos/ai": "0.8.3",
|
|
29
|
+
"@dxos/artifact": "0.8.3",
|
|
30
|
+
"@dxos/context": "0.8.3",
|
|
31
|
+
"@dxos/async": "0.8.3",
|
|
32
|
+
"@dxos/debug": "0.8.3",
|
|
33
|
+
"@dxos/echo": "0.8.3",
|
|
34
|
+
"@dxos/echo-db": "0.8.3",
|
|
35
|
+
"@dxos/echo-protocol": "0.8.3",
|
|
36
|
+
"@dxos/echo-schema": "0.8.3",
|
|
37
|
+
"@dxos/functions": "0.8.3",
|
|
38
|
+
"@dxos/graph": "0.8.3",
|
|
39
|
+
"@dxos/effect": "0.8.3",
|
|
40
|
+
"@dxos/keys": "0.8.3",
|
|
41
|
+
"@dxos/invariant": "0.8.3",
|
|
42
|
+
"@dxos/live-object": "0.8.3",
|
|
43
|
+
"@dxos/log": "0.8.3",
|
|
44
|
+
"@dxos/node-std": "0.8.3",
|
|
45
|
+
"@dxos/util": "0.8.3",
|
|
46
|
+
"@dxos/schema": "0.8.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@effect/ai": "^0.19.4",
|
package/src/blueprint/ai.test.ts
CHANGED
|
@@ -107,7 +107,7 @@ describe.runIf(!process.env.CI)('AiLanguageModel', () => {
|
|
|
107
107
|
expect(result).toBeDefined();
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
// TODO(burdon): Is
|
|
110
|
+
// TODO(burdon): Is this the effectful way to do this?
|
|
111
111
|
const createChat = (prompt: string) =>
|
|
112
112
|
Effect.gen(function* () {
|
|
113
113
|
const chat = yield* AiChat.empty;
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
import { describe, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { EdgeAiServiceClient, ToolRegistry, ToolResult, createTool } from '@dxos/ai';
|
|
9
9
|
import { AI_SERVICE_ENDPOINT, EXA_API_KEY } from '@dxos/ai/testing';
|
|
10
10
|
import { ArtifactId } from '@dxos/artifact';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
11
12
|
import { EchoTestBuilder } from '@dxos/echo-db/testing';
|
|
12
|
-
import { create } from '@dxos/echo-schema';
|
|
13
13
|
import { DataType, DataTypes } from '@dxos/schema';
|
|
14
14
|
|
|
15
15
|
import { BlueprintBuilder } from './blueprint';
|
|
@@ -23,7 +23,7 @@ import { createExaTool } from '../research/exa';
|
|
|
23
23
|
|
|
24
24
|
// TODO(burdon): Don't run on CI.
|
|
25
25
|
describe.skip('Blueprint', () => {
|
|
26
|
-
const aiClient = new
|
|
26
|
+
const aiClient = new EdgeAiServiceClient({
|
|
27
27
|
endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
28
28
|
defaultGenerationOptions: {
|
|
29
29
|
// model: '@anthropic/claude-sonnet-4-20250514',
|
|
@@ -108,14 +108,14 @@ describe.skip('Blueprint', () => {
|
|
|
108
108
|
|
|
109
109
|
const [org1] = [
|
|
110
110
|
db.add(
|
|
111
|
-
|
|
111
|
+
Obj.make(DataType.Organization, {
|
|
112
112
|
name: 'Exa',
|
|
113
113
|
website: 'https://exa.ai',
|
|
114
114
|
description: 'An AI-powered search engine company building search infrastructure for AI agents',
|
|
115
115
|
}),
|
|
116
116
|
),
|
|
117
117
|
db.add(
|
|
118
|
-
|
|
118
|
+
Obj.make(DataType.Organization, {
|
|
119
119
|
name: 'Cresta',
|
|
120
120
|
website: 'https://cresta.ai',
|
|
121
121
|
description: 'A company that builds AI agents',
|
package/src/blueprint/logger.ts
CHANGED
|
@@ -57,22 +57,22 @@ export class BlueprintLoggerAdapter implements BlueprintLogger {
|
|
|
57
57
|
log(event: BlueprintEvent) {
|
|
58
58
|
switch (event.type) {
|
|
59
59
|
case 'begin':
|
|
60
|
-
this.logger.log('begin');
|
|
60
|
+
this.logger.log('begin', { invocationId: event.invocationId });
|
|
61
61
|
break;
|
|
62
62
|
case 'end':
|
|
63
|
-
this.logger.log('end');
|
|
63
|
+
this.logger.log('end', { invocationId: event.invocationId });
|
|
64
64
|
break;
|
|
65
65
|
case 'step-start':
|
|
66
|
-
this.logger.log('step-start', { step: event.step });
|
|
66
|
+
this.logger.log('step-start', { invocationId: event.invocationId, step: event.step });
|
|
67
67
|
break;
|
|
68
68
|
case 'step-complete':
|
|
69
|
-
this.logger.log('step-complete', { step: event.step });
|
|
69
|
+
this.logger.log('step-complete', { invocationId: event.invocationId, step: event.step });
|
|
70
70
|
break;
|
|
71
71
|
case 'message':
|
|
72
|
-
this.logger.log('message', { message: event.message });
|
|
72
|
+
this.logger.log('message', { invocationId: event.invocationId, message: event.message });
|
|
73
73
|
break;
|
|
74
74
|
case 'block':
|
|
75
|
-
this.logger.log('block', { block: event.block });
|
|
75
|
+
this.logger.log('block', { invocationId: event.invocationId, block: event.block });
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
}
|
package/src/blueprint/machine.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Match, Schema } from 'effect';
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
createTool,
|
|
9
|
-
type
|
|
9
|
+
type AiServiceClient,
|
|
10
10
|
Message,
|
|
11
11
|
type MessageContentBlock,
|
|
12
12
|
ToolResult,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type ToolRegistry,
|
|
15
15
|
} from '@dxos/ai';
|
|
16
16
|
import { Event } from '@dxos/async';
|
|
17
|
-
import {
|
|
17
|
+
import { Key, Obj } from '@dxos/echo';
|
|
18
18
|
import { type ObjectId } from '@dxos/keys';
|
|
19
19
|
import { log } from '@dxos/log';
|
|
20
20
|
import { isNonNullable } from '@dxos/util';
|
|
@@ -52,7 +52,7 @@ const INITIAL_STATE: BlueprintMachineState = {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
type ExecutionOptions = {
|
|
55
|
-
aiClient:
|
|
55
|
+
aiClient: AiServiceClient;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Input to the blueprint.
|
|
@@ -61,12 +61,12 @@ type ExecutionOptions = {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
export type BlueprintEvent =
|
|
64
|
-
| { type: 'begin' }
|
|
65
|
-
| { type: 'end' }
|
|
66
|
-
| { type: 'step-start'; step: BlueprintStep }
|
|
67
|
-
| { type: 'step-complete'; step: BlueprintStep }
|
|
68
|
-
| { type: 'message'; message: Message }
|
|
69
|
-
| { type: 'block'; block: MessageContentBlock };
|
|
64
|
+
| { type: 'begin'; invocationId: string }
|
|
65
|
+
| { type: 'end'; invocationId: string }
|
|
66
|
+
| { type: 'step-start'; invocationId: string; step: BlueprintStep }
|
|
67
|
+
| { type: 'step-complete'; invocationId: string; step: BlueprintStep }
|
|
68
|
+
| { type: 'message'; invocationId: string; message: Message }
|
|
69
|
+
| { type: 'block'; invocationId: string; block: MessageContentBlock };
|
|
70
70
|
|
|
71
71
|
export interface BlueprintLogger {
|
|
72
72
|
log(event: BlueprintEvent): void;
|
|
@@ -103,21 +103,22 @@ export class BlueprintMachine {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
async runToCompletion(options: ExecutionOptions): Promise<void> {
|
|
106
|
-
|
|
106
|
+
const invocationId = Key.ObjectId.random();
|
|
107
|
+
log.info('runToCompletion', { invocationId, options });
|
|
107
108
|
|
|
108
109
|
this.begin.emit();
|
|
109
|
-
this.logger?.log({ type: 'begin' });
|
|
110
|
+
this.logger?.log({ type: 'begin', invocationId });
|
|
110
111
|
|
|
111
112
|
let firstStep = true;
|
|
112
113
|
while (this._state.state !== 'done') {
|
|
113
114
|
const input = firstStep ? options.input : undefined;
|
|
114
115
|
firstStep = false;
|
|
115
116
|
|
|
116
|
-
this._state = await this._execStep(this._state, { input, aiClient: options.aiClient });
|
|
117
|
+
this._state = await this._execStep(invocationId, this._state, { input, aiClient: options.aiClient });
|
|
117
118
|
|
|
118
119
|
const step = this.blueprint.steps.find((step) => step.id === this._state.trace.at(-1)?.stepId)!;
|
|
119
120
|
this.stepComplete.emit(step);
|
|
120
|
-
this.logger?.log({ type: 'step-complete', step });
|
|
121
|
+
this.logger?.log({ type: 'step-complete', invocationId, step });
|
|
121
122
|
|
|
122
123
|
if (this._state.state === 'bail') {
|
|
123
124
|
throw new Error('Agent unable to follow the blueprint');
|
|
@@ -125,10 +126,14 @@ export class BlueprintMachine {
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
this.end.emit();
|
|
128
|
-
this.logger?.log({ type: 'end' });
|
|
129
|
+
this.logger?.log({ type: 'end', invocationId });
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
private async _execStep(
|
|
132
|
+
private async _execStep(
|
|
133
|
+
invocationId: string,
|
|
134
|
+
state: BlueprintMachineState,
|
|
135
|
+
options: ExecutionOptions,
|
|
136
|
+
): Promise<BlueprintMachineState> {
|
|
132
137
|
const prevStep = this.blueprint.steps.findIndex((step) => step.id === this._state.trace.at(-1)?.stepId);
|
|
133
138
|
if (prevStep === this.blueprint.steps.length - 1) {
|
|
134
139
|
throw new Error('Done execution blueprint');
|
|
@@ -138,7 +143,7 @@ export class BlueprintMachine {
|
|
|
138
143
|
const onLastStep = prevStep === this.blueprint.steps.length - 2;
|
|
139
144
|
|
|
140
145
|
this.stepStart.emit(nextStep);
|
|
141
|
-
this.logger?.log({ type: 'step-start', step: nextStep });
|
|
146
|
+
this.logger?.log({ type: 'step-start', invocationId, step: nextStep });
|
|
142
147
|
|
|
143
148
|
const ReportSchema = Schema.Struct({
|
|
144
149
|
status: Schema.Literal('done', 'bailed', 'skipped').annotations({
|
|
@@ -167,7 +172,7 @@ export class BlueprintMachine {
|
|
|
167
172
|
|
|
168
173
|
const inputMessages = options.input
|
|
169
174
|
? [
|
|
170
|
-
|
|
175
|
+
Obj.make(Message, {
|
|
171
176
|
role: 'user',
|
|
172
177
|
content: [taggedDataBlock('input', options.input)],
|
|
173
178
|
}),
|
|
@@ -175,7 +180,7 @@ export class BlueprintMachine {
|
|
|
175
180
|
: [];
|
|
176
181
|
inputMessages.forEach((message) => {
|
|
177
182
|
this.message.emit(message);
|
|
178
|
-
this.logger?.log({ type: 'message', message });
|
|
183
|
+
this.logger?.log({ type: 'message', invocationId, message });
|
|
179
184
|
});
|
|
180
185
|
|
|
181
186
|
// TODO(wittjosiah): Warn if tool is not found.
|