@dxos/assistant-toolkit 0.8.4-main.cb12b3f963 → 0.8.4-main.dfabb4ec29
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/neutral/{add-artifact-TWTWAY3H.mjs → add-artifact-ZUJ5DMSY.mjs} +3 -3
- package/dist/lib/neutral/{agent-7ROVDSSY.mjs → agent-5NIKAYUK.mjs} +3 -3
- package/dist/lib/neutral/{chunk-2Q63LLSY.mjs → chunk-246ACKSH.mjs} +6 -6
- package/dist/lib/neutral/chunk-246ACKSH.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-43U4ZAOZ.mjs → chunk-FIGO6CA6.mjs} +2 -2
- package/dist/lib/neutral/{chunk-J37DYY7A.mjs → chunk-GV66MKAQ.mjs} +12 -3
- package/dist/lib/neutral/chunk-GV66MKAQ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-CVUA23QI.mjs → chunk-IKBIORQX.mjs} +14 -14
- package/dist/lib/neutral/chunk-IKBIORQX.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-DN4LTRFN.mjs → chunk-P4ZMYO4K.mjs} +27 -26
- package/dist/lib/neutral/chunk-P4ZMYO4K.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-2XK7EWKJ.mjs → chunk-QO5SU37C.mjs} +5 -5
- package/dist/lib/neutral/{chunk-2XK7EWKJ.mjs.map → chunk-QO5SU37C.mjs.map} +3 -3
- package/dist/lib/neutral/{chunk-OHDGJMVE.mjs → chunk-XUF53B6B.mjs} +2 -2
- package/dist/lib/neutral/{context-add-IIDPRRVB.mjs → context-add-VB7AOY3G.mjs} +2 -2
- package/dist/lib/neutral/{context-remove-RDYV4PD4.mjs → context-remove-VCM3VPSO.mjs} +2 -2
- package/dist/lib/neutral/{create-project-WEQYCL7A.mjs → create-project-EIF4OJMY.mjs} +5 -5
- package/dist/lib/neutral/{get-context-S735CUYM.mjs → get-context-TN7X7U2H.mjs} +3 -3
- package/dist/lib/neutral/index.mjs +31 -19
- package/dist/lib/neutral/index.mjs.map +3 -3
- package/dist/lib/neutral/{load-LI7HHVD6.mjs → load-ALP3TK2E.mjs} +2 -2
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/{object-create-ZRBHR72E.mjs → object-create-Z57Y3X6Y.mjs} +2 -2
- package/dist/lib/neutral/{object-delete-I266YAXI.mjs → object-delete-X53LS37B.mjs} +2 -2
- package/dist/lib/neutral/{object-update-HY4GI7LA.mjs → object-update-GVKSBR7T.mjs} +2 -2
- package/dist/lib/neutral/{project-KEZSS5UM.mjs → project-HPHTZ2CI.mjs} +4 -4
- package/dist/lib/neutral/{project-rules-UGFRHIX7.mjs → project-rules-IVDHKSKI.mjs} +3 -3
- package/dist/lib/neutral/{prompt-NPOR2MVC.mjs → prompt-Y7NN7M5D.mjs} +8 -5
- package/dist/lib/neutral/{prompt-NPOR2MVC.mjs.map → prompt-Y7NN7M5D.mjs.map} +3 -3
- package/dist/lib/neutral/{qualifier-NW5VBP64.mjs → qualifier-VDOY5CWU.mjs} +3 -3
- package/dist/lib/neutral/{query-B3NOYFCK.mjs → query-PPJU5622.mjs} +2 -2
- package/dist/lib/neutral/{relation-create-E7VOVXHU.mjs → relation-create-XJ2IX6X3.mjs} +2 -2
- package/dist/lib/neutral/{relation-delete-LXY7W2YO.mjs → relation-delete-EP4KXAFL.mjs} +2 -2
- package/dist/lib/neutral/{schema-add-4TXJO2V7.mjs → schema-add-Z5CY6P24.mjs} +2 -2
- package/dist/lib/neutral/{schema-list-PJS5AFZ3.mjs → schema-list-W326VPVX.mjs} +2 -2
- package/dist/lib/neutral/{sync-triggers-RFM3YGKG.mjs → sync-triggers-CDMJVW6E.mjs} +4 -4
- package/dist/lib/neutral/{tag-add-5NOHUTIE.mjs → tag-add-VNIIOVJA.mjs} +2 -2
- package/dist/lib/neutral/{tag-remove-QTKYDJAW.mjs → tag-remove-6R2R27W3.mjs} +2 -2
- package/dist/lib/neutral/{update-tasks-QN2EMFUU.mjs → update-tasks-H7SWIFQL.mjs} +3 -3
- package/dist/types/src/blueprints/blueprint-manager/functions/definitions.d.ts +8 -4
- package/dist/types/src/blueprints/blueprint-manager/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/blueprints/blueprint-manager/functions/enable-blueprints.d.ts +4 -2
- package/dist/types/src/blueprints/blueprint-manager/functions/query-blueprints.d.ts +4 -2
- package/dist/types/src/blueprints/database/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/blueprints/project/functions/definitions.d.ts +4 -4
- package/dist/types/src/blueprints/project/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/blueprints/project/functions/qualifier.d.ts +2 -2
- package/dist/types/src/blueprints/project-wizard/functions/create-project.d.ts +2 -2
- package/dist/types/src/blueprints/project-wizard/functions/definitions.d.ts +4 -4
- package/dist/types/src/blueprints/project-wizard/functions/sync-triggers.d.ts +2 -2
- package/dist/types/src/functions/agent/definitions.d.ts +6 -4
- package/dist/types/src/functions/agent/definitions.d.ts.map +1 -1
- package/dist/types/src/types/Agent.d.ts +2 -2
- package/dist/types/src/types/Agent.d.ts.map +1 -1
- package/dist/types/src/types/McpServer.d.ts +4 -1
- package/dist/types/src/types/McpServer.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -25
- package/src/blueprints/automation/blueprint.ts +1 -1
- package/src/blueprints/blueprint-manager/blueprint.ts +2 -2
- package/src/blueprints/browser/blueprint.test.ts +3 -3
- package/src/blueprints/browser/blueprint.ts +1 -1
- package/src/blueprints/database/blueprint.ts +1 -1
- package/src/blueprints/database/functions/definitions.ts +13 -13
- package/src/blueprints/discord/blueprint.ts +1 -1
- package/src/blueprints/linear/blueprint.ts +1 -1
- package/src/blueprints/memory/blueprint.ts +1 -1
- package/src/blueprints/project/blueprint.test.ts +4 -4
- package/src/blueprints/project/blueprint.ts +2 -2
- package/src/blueprints/project/functions/definitions.ts +4 -4
- package/src/functions/agent/definitions.ts +7 -2
- package/src/functions/agent/prompt.ts +4 -1
- package/src/types/Agent.ts +19 -18
- package/src/types/McpServer.ts +5 -5
- package/dist/lib/neutral/chunk-2Q63LLSY.mjs.map +0 -7
- package/dist/lib/neutral/chunk-CVUA23QI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-DN4LTRFN.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J37DYY7A.mjs.map +0 -7
- /package/dist/lib/neutral/{add-artifact-TWTWAY3H.mjs.map → add-artifact-ZUJ5DMSY.mjs.map} +0 -0
- /package/dist/lib/neutral/{agent-7ROVDSSY.mjs.map → agent-5NIKAYUK.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-43U4ZAOZ.mjs.map → chunk-FIGO6CA6.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-OHDGJMVE.mjs.map → chunk-XUF53B6B.mjs.map} +0 -0
- /package/dist/lib/neutral/{context-add-IIDPRRVB.mjs.map → context-add-VB7AOY3G.mjs.map} +0 -0
- /package/dist/lib/neutral/{context-remove-RDYV4PD4.mjs.map → context-remove-VCM3VPSO.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-project-WEQYCL7A.mjs.map → create-project-EIF4OJMY.mjs.map} +0 -0
- /package/dist/lib/neutral/{get-context-S735CUYM.mjs.map → get-context-TN7X7U2H.mjs.map} +0 -0
- /package/dist/lib/neutral/{load-LI7HHVD6.mjs.map → load-ALP3TK2E.mjs.map} +0 -0
- /package/dist/lib/neutral/{object-create-ZRBHR72E.mjs.map → object-create-Z57Y3X6Y.mjs.map} +0 -0
- /package/dist/lib/neutral/{object-delete-I266YAXI.mjs.map → object-delete-X53LS37B.mjs.map} +0 -0
- /package/dist/lib/neutral/{object-update-HY4GI7LA.mjs.map → object-update-GVKSBR7T.mjs.map} +0 -0
- /package/dist/lib/neutral/{project-KEZSS5UM.mjs.map → project-HPHTZ2CI.mjs.map} +0 -0
- /package/dist/lib/neutral/{project-rules-UGFRHIX7.mjs.map → project-rules-IVDHKSKI.mjs.map} +0 -0
- /package/dist/lib/neutral/{qualifier-NW5VBP64.mjs.map → qualifier-VDOY5CWU.mjs.map} +0 -0
- /package/dist/lib/neutral/{query-B3NOYFCK.mjs.map → query-PPJU5622.mjs.map} +0 -0
- /package/dist/lib/neutral/{relation-create-E7VOVXHU.mjs.map → relation-create-XJ2IX6X3.mjs.map} +0 -0
- /package/dist/lib/neutral/{relation-delete-LXY7W2YO.mjs.map → relation-delete-EP4KXAFL.mjs.map} +0 -0
- /package/dist/lib/neutral/{schema-add-4TXJO2V7.mjs.map → schema-add-Z5CY6P24.mjs.map} +0 -0
- /package/dist/lib/neutral/{schema-list-PJS5AFZ3.mjs.map → schema-list-W326VPVX.mjs.map} +0 -0
- /package/dist/lib/neutral/{sync-triggers-RFM3YGKG.mjs.map → sync-triggers-CDMJVW6E.mjs.map} +0 -0
- /package/dist/lib/neutral/{tag-add-5NOHUTIE.mjs.map → tag-add-VNIIOVJA.mjs.map} +0 -0
- /package/dist/lib/neutral/{tag-remove-QTKYDJAW.mjs.map → tag-remove-6R2R27W3.mjs.map} +0 -0
- /package/dist/lib/neutral/{update-tasks-QN2EMFUU.mjs.map → update-tasks-H7SWIFQL.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/assistant-toolkit",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.dfabb4ec29",
|
|
4
4
|
"description": "Assistant toolkit, definitions, and utilities.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -33,40 +33,40 @@
|
|
|
33
33
|
"@effect/platform": "0.94.4",
|
|
34
34
|
"dfx": "^0.127.0",
|
|
35
35
|
"exa-js": "^1.5.12",
|
|
36
|
-
"@dxos/assistant": "0.8.4-main.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/echo
|
|
41
|
-
"@dxos/echo": "0.8.4-main.
|
|
42
|
-
"@dxos/effect": "0.8.4-main.
|
|
43
|
-
"@dxos/echo-
|
|
44
|
-
"@dxos/errors": "0.8.4-main.
|
|
45
|
-
"@dxos/functions": "0.8.4-main.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/log": "0.8.4-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
36
|
+
"@dxos/assistant": "0.8.4-main.dfabb4ec29",
|
|
37
|
+
"@dxos/client-protocol": "0.8.4-main.dfabb4ec29",
|
|
38
|
+
"@dxos/compute": "0.8.4-main.dfabb4ec29",
|
|
39
|
+
"@dxos/ai": "0.8.4-main.dfabb4ec29",
|
|
40
|
+
"@dxos/echo": "0.8.4-main.dfabb4ec29",
|
|
41
|
+
"@dxos/echo-db": "0.8.4-main.dfabb4ec29",
|
|
42
|
+
"@dxos/effect": "0.8.4-main.dfabb4ec29",
|
|
43
|
+
"@dxos/echo-protocol": "0.8.4-main.dfabb4ec29",
|
|
44
|
+
"@dxos/errors": "0.8.4-main.dfabb4ec29",
|
|
45
|
+
"@dxos/functions-runtime": "0.8.4-main.dfabb4ec29",
|
|
46
|
+
"@dxos/invariant": "0.8.4-main.dfabb4ec29",
|
|
47
|
+
"@dxos/app-framework": "0.8.4-main.dfabb4ec29",
|
|
48
|
+
"@dxos/functions": "0.8.4-main.dfabb4ec29",
|
|
49
|
+
"@dxos/log": "0.8.4-main.dfabb4ec29",
|
|
50
|
+
"@dxos/keys": "0.8.4-main.dfabb4ec29",
|
|
51
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.dfabb4ec29",
|
|
52
|
+
"@dxos/schema": "0.8.4-main.dfabb4ec29",
|
|
53
|
+
"@dxos/react-ui": "0.8.4-main.dfabb4ec29",
|
|
54
|
+
"@dxos/types": "0.8.4-main.dfabb4ec29",
|
|
55
|
+
"@dxos/util": "0.8.4-main.dfabb4ec29"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"effect": "3.20.0",
|
|
59
59
|
"react": "~19.2.3",
|
|
60
60
|
"react-dom": "~19.2.3",
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
61
|
+
"@dxos/client-protocol": "0.8.4-main.dfabb4ec29",
|
|
62
|
+
"@dxos/plugin-markdown": "0.8.4-main.dfabb4ec29",
|
|
63
|
+
"@dxos/ui-theme": "0.8.4-main.dfabb4ec29"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"effect": "3.20.0",
|
|
67
67
|
"react": "~19.2.3",
|
|
68
68
|
"react-dom": "~19.2.3",
|
|
69
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
69
|
+
"@dxos/ui-theme": "0.8.4-main.dfabb4ec29"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
@@ -14,10 +14,10 @@ import { AgentService } from '@dxos/functions-runtime';
|
|
|
14
14
|
import { AssistantTestLayerWithTriggers } from '@dxos/functions-runtime/testing';
|
|
15
15
|
import { ObjectId } from '@dxos/keys';
|
|
16
16
|
import { log } from '@dxos/log';
|
|
17
|
-
import { MarkdownBlueprint } from '@dxos/plugin-markdown
|
|
18
|
-
import {
|
|
17
|
+
import { MarkdownBlueprint } from '@dxos/plugin-markdown';
|
|
18
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
19
|
+
import { MarkdownOperationHandlerSet } from '@dxos/plugin-markdown/plugin';
|
|
19
20
|
import { WithProperties } from '@dxos/plugin-markdown/testing';
|
|
20
|
-
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
21
21
|
import { Person } from '@dxos/types';
|
|
22
22
|
|
|
23
23
|
import { DatabaseBlueprint, DatabaseHandlers } from '../database';
|
|
@@ -37,7 +37,7 @@ const make = () =>
|
|
|
37
37
|
description: 'Query and manipulate objects in the ECHO database.',
|
|
38
38
|
agentCanEnable: true,
|
|
39
39
|
instructions: {
|
|
40
|
-
source: Ref.make(Text.make(instructions)),
|
|
40
|
+
source: Ref.make(Text.make({ content: instructions })),
|
|
41
41
|
},
|
|
42
42
|
tools: Blueprint.toolDefinitions({
|
|
43
43
|
operations: [
|
|
@@ -101,7 +101,7 @@ export const Query = Operation.make({
|
|
|
101
101
|
}),
|
|
102
102
|
output: Schema.Array(Schema.Unknown),
|
|
103
103
|
services: [Database.Service],
|
|
104
|
-
});
|
|
104
|
+
}).pipe(Operation.intrinsic);
|
|
105
105
|
|
|
106
106
|
export const Load = Operation.make({
|
|
107
107
|
meta: {
|
|
@@ -121,7 +121,7 @@ export const Load = Operation.make({
|
|
|
121
121
|
}),
|
|
122
122
|
output: Schema.Unknown,
|
|
123
123
|
services: [Database.Service],
|
|
124
|
-
});
|
|
124
|
+
}).pipe(Operation.intrinsic);
|
|
125
125
|
|
|
126
126
|
export const ObjectCreate = Operation.make({
|
|
127
127
|
meta: {
|
|
@@ -140,7 +140,7 @@ export const ObjectCreate = Operation.make({
|
|
|
140
140
|
}),
|
|
141
141
|
output: Schema.Unknown,
|
|
142
142
|
services: [Database.Service],
|
|
143
|
-
});
|
|
143
|
+
}).pipe(Operation.intrinsic);
|
|
144
144
|
|
|
145
145
|
export const ObjectUpdate = Operation.make({
|
|
146
146
|
meta: {
|
|
@@ -158,7 +158,7 @@ export const ObjectUpdate = Operation.make({
|
|
|
158
158
|
}),
|
|
159
159
|
output: Schema.Unknown,
|
|
160
160
|
services: [Database.Service],
|
|
161
|
-
});
|
|
161
|
+
}).pipe(Operation.intrinsic);
|
|
162
162
|
|
|
163
163
|
export const ObjectDelete = Operation.make({
|
|
164
164
|
meta: {
|
|
@@ -173,7 +173,7 @@ export const ObjectDelete = Operation.make({
|
|
|
173
173
|
}),
|
|
174
174
|
output: Schema.Void,
|
|
175
175
|
services: [Database.Service],
|
|
176
|
-
});
|
|
176
|
+
}).pipe(Operation.intrinsic);
|
|
177
177
|
|
|
178
178
|
export const SchemaAdd = Operation.make({
|
|
179
179
|
meta: {
|
|
@@ -193,7 +193,7 @@ export const SchemaAdd = Operation.make({
|
|
|
193
193
|
}),
|
|
194
194
|
output: Schema.Void,
|
|
195
195
|
services: [Database.Service],
|
|
196
|
-
});
|
|
196
|
+
}).pipe(Operation.intrinsic);
|
|
197
197
|
|
|
198
198
|
export const SchemaList = Operation.make({
|
|
199
199
|
meta: {
|
|
@@ -208,7 +208,7 @@ export const SchemaList = Operation.make({
|
|
|
208
208
|
}),
|
|
209
209
|
output: Schema.Array(Schema.Unknown),
|
|
210
210
|
services: [Database.Service],
|
|
211
|
-
});
|
|
211
|
+
}).pipe(Operation.intrinsic);
|
|
212
212
|
|
|
213
213
|
export const ContextAdd = Operation.make({
|
|
214
214
|
meta: {
|
|
@@ -226,7 +226,7 @@ export const ContextAdd = Operation.make({
|
|
|
226
226
|
}),
|
|
227
227
|
output: Schema.Void,
|
|
228
228
|
services: [AiContextService],
|
|
229
|
-
});
|
|
229
|
+
}).pipe(Operation.intrinsic);
|
|
230
230
|
|
|
231
231
|
export const ContextRemove = Operation.make({
|
|
232
232
|
meta: {
|
|
@@ -244,7 +244,7 @@ export const ContextRemove = Operation.make({
|
|
|
244
244
|
}),
|
|
245
245
|
output: Schema.Void,
|
|
246
246
|
services: [AiContextService],
|
|
247
|
-
});
|
|
247
|
+
}).pipe(Operation.intrinsic);
|
|
248
248
|
|
|
249
249
|
export const RelationCreate = Operation.make({
|
|
250
250
|
meta: {
|
|
@@ -265,7 +265,7 @@ export const RelationCreate = Operation.make({
|
|
|
265
265
|
}),
|
|
266
266
|
output: Schema.Unknown,
|
|
267
267
|
services: [Database.Service],
|
|
268
|
-
});
|
|
268
|
+
}).pipe(Operation.intrinsic);
|
|
269
269
|
|
|
270
270
|
export const RelationDelete = Operation.make({
|
|
271
271
|
meta: {
|
|
@@ -280,7 +280,7 @@ export const RelationDelete = Operation.make({
|
|
|
280
280
|
}),
|
|
281
281
|
output: Schema.Void,
|
|
282
282
|
services: [Database.Service],
|
|
283
|
-
});
|
|
283
|
+
}).pipe(Operation.intrinsic);
|
|
284
284
|
|
|
285
285
|
export const TagAdd = Operation.make({
|
|
286
286
|
meta: {
|
|
@@ -298,7 +298,7 @@ export const TagAdd = Operation.make({
|
|
|
298
298
|
}),
|
|
299
299
|
output: Schema.Unknown,
|
|
300
300
|
services: [Database.Service],
|
|
301
|
-
});
|
|
301
|
+
}).pipe(Operation.intrinsic);
|
|
302
302
|
|
|
303
303
|
export const TagRemove = Operation.make({
|
|
304
304
|
meta: {
|
|
@@ -315,4 +315,4 @@ export const TagRemove = Operation.make({
|
|
|
315
315
|
}),
|
|
316
316
|
output: Schema.Unknown,
|
|
317
317
|
services: [Database.Service],
|
|
318
|
-
});
|
|
318
|
+
}).pipe(Operation.intrinsic);
|
|
@@ -28,7 +28,7 @@ const make = () =>
|
|
|
28
28
|
name: 'Discord',
|
|
29
29
|
description: 'Discord integration.',
|
|
30
30
|
instructions: {
|
|
31
|
-
source: Ref.make(Text.make(instructions)),
|
|
31
|
+
source: Ref.make(Text.make({ content: instructions })),
|
|
32
32
|
},
|
|
33
33
|
tools: Blueprint.toolDefinitions({ operations: [FetchMessages] }),
|
|
34
34
|
});
|
|
@@ -29,7 +29,7 @@ const make = () =>
|
|
|
29
29
|
name: 'Linear',
|
|
30
30
|
description: 'Syncs Linear workspaces.',
|
|
31
31
|
instructions: {
|
|
32
|
-
source: Ref.make(Text.make(instructions)),
|
|
32
|
+
source: Ref.make(Text.make({ content: instructions })),
|
|
33
33
|
},
|
|
34
34
|
tools: Blueprint.toolDefinitions({ operations: [SyncIssues] }),
|
|
35
35
|
});
|
|
@@ -28,7 +28,7 @@ const make = () =>
|
|
|
28
28
|
description: 'Persistent memory storage and retrieval.',
|
|
29
29
|
agentCanEnable: true,
|
|
30
30
|
instructions: {
|
|
31
|
-
source: Ref.make(Text.make(instructions)),
|
|
31
|
+
source: Ref.make(Text.make({ content: instructions })),
|
|
32
32
|
},
|
|
33
33
|
tools: Blueprint.toolDefinitions({ operations: [SaveMemory, QueryMemories, DeleteMemory] }),
|
|
34
34
|
});
|
|
@@ -19,10 +19,10 @@ import { TriggerDispatcher } from '@dxos/functions-runtime';
|
|
|
19
19
|
import { AssistantTestLayerWithTriggers } from '@dxos/functions-runtime/testing';
|
|
20
20
|
import { invariant } from '@dxos/invariant';
|
|
21
21
|
import { ObjectId } from '@dxos/keys';
|
|
22
|
-
import { MarkdownBlueprint } from '@dxos/plugin-markdown
|
|
23
|
-
import {
|
|
22
|
+
import { MarkdownBlueprint } from '@dxos/plugin-markdown';
|
|
23
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
24
|
+
import { MarkdownOperationHandlerSet } from '@dxos/plugin-markdown/plugin';
|
|
24
25
|
import { WithProperties } from '@dxos/plugin-markdown/testing';
|
|
25
|
-
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
26
26
|
import { Text } from '@dxos/schema';
|
|
27
27
|
import { Message } from '@dxos/types';
|
|
28
28
|
import { trim } from '@dxos/util';
|
|
@@ -85,7 +85,7 @@ describe('Agent', () => {
|
|
|
85
85
|
const document = yield* Database.add(
|
|
86
86
|
Obj.make(Markdown.Document, {
|
|
87
87
|
name: 'Test Document',
|
|
88
|
-
content: Ref.make(Text.make('This is a test document with some content.')),
|
|
88
|
+
content: Ref.make(Text.make({ content: 'This is a test document with some content.' })),
|
|
89
89
|
}),
|
|
90
90
|
);
|
|
91
91
|
yield* Database.flush();
|
|
@@ -33,7 +33,7 @@ export const AgentWorker = Operation.make({
|
|
|
33
33
|
Trace.TraceService,
|
|
34
34
|
OpaqueToolkit.OpaqueToolkitProvider,
|
|
35
35
|
],
|
|
36
|
-
});
|
|
36
|
+
}).pipe(Operation.intrinsic);
|
|
37
37
|
|
|
38
38
|
export const Qualifier = Operation.make({
|
|
39
39
|
meta: {
|
|
@@ -48,7 +48,7 @@ export const Qualifier = Operation.make({
|
|
|
48
48
|
}),
|
|
49
49
|
output: Schema.Void,
|
|
50
50
|
services: [AiService.AiService, Database.Service],
|
|
51
|
-
});
|
|
51
|
+
}).pipe(Operation.intrinsic);
|
|
52
52
|
|
|
53
53
|
export const GetContext = Operation.make({
|
|
54
54
|
meta: {
|
|
@@ -71,7 +71,7 @@ export const GetContext = Operation.make({
|
|
|
71
71
|
),
|
|
72
72
|
}),
|
|
73
73
|
services: [AiContextService, Database.Service],
|
|
74
|
-
});
|
|
74
|
+
}).pipe(Operation.intrinsic);
|
|
75
75
|
|
|
76
76
|
export const AddArtifact = Operation.make({
|
|
77
77
|
meta: {
|
|
@@ -89,4 +89,4 @@ export const AddArtifact = Operation.make({
|
|
|
89
89
|
}),
|
|
90
90
|
output: Schema.Void,
|
|
91
91
|
services: [AiContextService, Database.Service],
|
|
92
|
-
});
|
|
92
|
+
}).pipe(Operation.intrinsic);
|
|
@@ -7,13 +7,15 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
import { AiService, OpaqueToolkit, ModelName } from '@dxos/ai';
|
|
8
8
|
import { Routine, Trace, Operation, OperationRegistry } from '@dxos/compute';
|
|
9
9
|
import { Database, Feed, Ref } from '@dxos/echo';
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
10
11
|
|
|
11
12
|
import * as Chat from '../../types/Chat';
|
|
12
13
|
|
|
14
|
+
// TODO(dmaretskyi): Rename to RunRoutine.
|
|
13
15
|
export const AgentPrompt = Operation.make({
|
|
14
16
|
meta: {
|
|
15
17
|
key: 'org.dxos.function.prompt',
|
|
16
|
-
name: '
|
|
18
|
+
name: 'Run Routine',
|
|
17
19
|
description: 'Agentic worker that executes a provided prompt using blueprints and tools.',
|
|
18
20
|
},
|
|
19
21
|
input: Schema.Struct({
|
|
@@ -40,6 +42,9 @@ export const AgentPrompt = Operation.make({
|
|
|
40
42
|
}),
|
|
41
43
|
}),
|
|
42
44
|
output: Schema.Any,
|
|
45
|
+
// ECHO types that the handler loads via Database.load(). Declaring them here ensures the
|
|
46
|
+
// runtime registers their schema before remote invocation (e.g. via the EDGE function service).
|
|
47
|
+
types: [Routine.Routine, Text.Text, Feed.Feed, Chat.Chat],
|
|
43
48
|
services: [
|
|
44
49
|
AiService.AiService,
|
|
45
50
|
Database.Service,
|
|
@@ -48,4 +53,4 @@ export const AgentPrompt = Operation.make({
|
|
|
48
53
|
OperationRegistry.Service,
|
|
49
54
|
Trace.TraceService,
|
|
50
55
|
],
|
|
51
|
-
});
|
|
56
|
+
}).pipe(Operation.intrinsic);
|
|
@@ -149,8 +149,11 @@ export default AgentPrompt.pipe(
|
|
|
149
149
|
),
|
|
150
150
|
);
|
|
151
151
|
},
|
|
152
|
+
Effect.tapBoth({
|
|
153
|
+
onSuccess: () => Database.flush(),
|
|
154
|
+
onFailure: () => Database.flush(),
|
|
155
|
+
}),
|
|
152
156
|
Effect.scoped,
|
|
153
|
-
Effect.provide(Trace.writerLayerNoop),
|
|
154
157
|
),
|
|
155
158
|
),
|
|
156
159
|
Operation.opaqueHandler,
|
package/src/types/Agent.ts
CHANGED
|
@@ -13,11 +13,11 @@ import { type Blueprint } from '@dxos/compute';
|
|
|
13
13
|
import { Annotation, Database, Feed, Format, Obj, Ref, Relation, Type } from '@dxos/echo';
|
|
14
14
|
import { Queue } from '@dxos/echo-db';
|
|
15
15
|
import { type ObjectNotFoundError } from '@dxos/echo/Err';
|
|
16
|
-
import { FormInputAnnotation
|
|
16
|
+
import { FormInputAnnotation } from '@dxos/echo/internal';
|
|
17
17
|
import { acquireReleaseResource } from '@dxos/effect';
|
|
18
18
|
import { QueueService } from '@dxos/functions';
|
|
19
19
|
import { invariant } from '@dxos/invariant';
|
|
20
|
-
import {
|
|
20
|
+
import { Text } from '@dxos/schema';
|
|
21
21
|
|
|
22
22
|
import * as Chat from './Chat';
|
|
23
23
|
import * as Plan from './Plan';
|
|
@@ -64,24 +64,29 @@ export const Agent = Schema.Struct({
|
|
|
64
64
|
}),
|
|
65
65
|
).pipe(FormInputAnnotation.set(false)),
|
|
66
66
|
|
|
67
|
-
/**
|
|
68
|
-
* Input feed for subscriptions.
|
|
69
|
-
*/
|
|
70
|
-
// TODO(burdon): Rename to Feed?
|
|
71
|
-
// NOTE: Named `queue` to conform to subscribable schema (see QueueAnnotation).
|
|
72
|
-
queue: Schema.optional(Ref.Ref(Queue).pipe(FormInputAnnotation.set(false))),
|
|
73
|
-
|
|
74
67
|
/**
|
|
75
68
|
* References to objects with a canonical queue property.
|
|
76
69
|
* Schema must have the QueueAnnotation.
|
|
77
70
|
*/
|
|
71
|
+
// Change to trigger.
|
|
78
72
|
// TODO(dmaretskyi): Turn into an array of objects when form-data
|
|
79
73
|
subscriptions: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(FormInputAnnotation.set(false)),
|
|
80
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Cron expression for a timer trigger that invokes the agent worker on a schedule.
|
|
77
|
+
* The timer trigger bypasses the qualifier and goes straight to the agent worker.
|
|
78
|
+
*/
|
|
79
|
+
// Change to trigger.
|
|
80
|
+
cron: Schema.optional(Schema.String).annotations({
|
|
81
|
+
title: 'Cron',
|
|
82
|
+
description: 'Cron expression for a timer trigger that invokes the agent on a schedule.',
|
|
83
|
+
}),
|
|
84
|
+
|
|
81
85
|
/**
|
|
82
86
|
* Allow the agent to filter events.
|
|
83
87
|
* Related events will be added to the input queue of the agent.
|
|
84
88
|
* It is recommended to enable this.
|
|
89
|
+
* @deprecated
|
|
85
90
|
*/
|
|
86
91
|
filterEvents: Schema.optional(Schema.Boolean).annotations({
|
|
87
92
|
title: 'Filter events',
|
|
@@ -89,20 +94,16 @@ export const Agent = Schema.Struct({
|
|
|
89
94
|
}),
|
|
90
95
|
|
|
91
96
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
97
|
+
* Input feed for subscriptions.
|
|
98
|
+
* @deprecated Subscriptions will write directly to the agent.
|
|
94
99
|
*/
|
|
95
|
-
|
|
96
|
-
title: 'Cron',
|
|
97
|
-
description: 'Cron expression for a timer trigger that invokes the agent on a schedule.',
|
|
98
|
-
}),
|
|
100
|
+
queue: Schema.optional(Ref.Ref(Queue).pipe(FormInputAnnotation.set(false))),
|
|
99
101
|
}).pipe(
|
|
100
102
|
Type.object({
|
|
101
103
|
typename: 'org.dxos.type.agent',
|
|
102
104
|
version: '0.1.0',
|
|
103
105
|
}),
|
|
104
|
-
LabelAnnotation.set(['name']),
|
|
105
|
-
QueueAnnotation.set(true),
|
|
106
|
+
Annotation.LabelAnnotation.set(['name']),
|
|
106
107
|
Annotation.IconAnnotation.set({
|
|
107
108
|
icon: 'ph--drone--regular',
|
|
108
109
|
hue: 'sky',
|
|
@@ -130,7 +131,7 @@ export const makeInitialized = (
|
|
|
130
131
|
Effect.gen(function* () {
|
|
131
132
|
const agent = Obj.make(Agent, {
|
|
132
133
|
...props,
|
|
133
|
-
instructions: Ref.make(Text.make(props.instructions)),
|
|
134
|
+
instructions: Ref.make(Text.make({ content: props.instructions })),
|
|
134
135
|
plan: Ref.make(Plan.makePlan({ tasks: [] })),
|
|
135
136
|
artifacts: props.artifacts ?? [],
|
|
136
137
|
subscriptions: props.subscriptions ?? [],
|
package/src/types/McpServer.ts
CHANGED
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
|
+
import { McpServer as McpServerSpec } from '@dxos/compute';
|
|
9
10
|
import { Annotation, Type } from '@dxos/echo';
|
|
10
11
|
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* MCP server configuration stored as a space-level ECHO object.
|
|
14
15
|
*
|
|
16
|
+
* Composes the canonical connection spec from `@dxos/compute` (`url`, `protocol`, `apiKey`)
|
|
17
|
+
* and adds instance-level fields (`name`, `enabled`) plus ECHO annotations.
|
|
18
|
+
*
|
|
15
19
|
* NOTE: `apiKey` is stored in plaintext and replicated to all peers with access to the space.
|
|
16
20
|
* A future iteration should move secrets to per-device credential storage or use envelope encryption.
|
|
17
21
|
*/
|
|
18
22
|
export const McpServer = Schema.Struct({
|
|
19
|
-
|
|
20
|
-
url: Schema.String,
|
|
21
|
-
protocol: Schema.Union(Schema.Literal('sse'), Schema.Literal('http')),
|
|
22
|
-
/** Stored in plaintext; replicated to all peers in the space. */
|
|
23
|
-
apiKey: Schema.optional(Schema.String),
|
|
23
|
+
...McpServerSpec.McpServer.fields,
|
|
24
24
|
enabled: Schema.optional(Schema.Boolean),
|
|
25
25
|
}).pipe(
|
|
26
26
|
Type.object({
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/blueprints/project/functions/definitions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { AiService, OpaqueToolkit } from '@dxos/ai';\nimport { AiContextService } from '@dxos/assistant';\nimport { Trace, TriggerEvent, Operation, OperationRegistry } from '@dxos/compute';\nimport { Database, Feed, Obj, Ref } from '@dxos/echo';\nimport { QueueService } from '@dxos/functions';\n\nimport { Agent } from '../../../types';\n\nexport const AgentWorker = Operation.make({\n meta: {\n key: 'org.dxos.function.agent.worker',\n name: 'Agent Worker',\n description: 'Agentic worker that drives the agent autonomously.',\n },\n input: Schema.Struct({\n agent: Schema.suspend(() => Ref.Ref(Agent.Agent)),\n prompt: Schema.optional(Schema.String),\n event: Schema.optional(TriggerEvent.TriggerEvent),\n }),\n output: Schema.Void,\n services: [\n AiService.AiService,\n Database.Service,\n QueueService,\n Feed.FeedService,\n OperationRegistry.Service,\n Trace.TraceService,\n OpaqueToolkit.OpaqueToolkitProvider,\n ],\n});\n\nexport const Qualifier = Operation.make({\n meta: {\n key: 'org.dxos.function.agent.qualifier',\n name: 'Agent Qualifier',\n description:\n 'Qualifier that determines if the event is relevant to the agent. Puts the data into the input queue of the agent.',\n },\n input: Schema.Struct({\n agent: Schema.suspend(() => Ref.Ref(Agent.Agent)),\n event: TriggerEvent.TriggerEvent,\n }),\n output: Schema.Void,\n services: [AiService.AiService, Database.Service],\n});\n\nexport const GetContext = Operation.make({\n meta: {\n key: 'org.dxos.function.agent.get-context',\n name: 'Get Agent Context',\n description: 'Get the context of an agent.',\n },\n input: Schema.Struct({}),\n output: Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n instructions: Schema.String,\n plan: Schema.String,\n artifacts: Schema.Array(\n Schema.Struct({\n name: Schema.String,\n type: Schema.optional(Schema.String),\n dxn: Schema.optional(Schema.String),\n }),\n ),\n }),\n services: [AiContextService, Database.Service],\n});\n\nexport const AddArtifact = Operation.make({\n meta: {\n key: 'org.dxos.function.agent.add-artifact',\n name: 'Add artifact',\n description: 'Adds a new artifact.',\n },\n input: Schema.Struct({\n name: Schema.String.annotations({\n description: 'The name of the artifact to add.',\n }),\n artifact: Ref.Ref(Obj.Unknown).annotations({\n description: 'The artifact to add. Do NOT guess or try to generate the ID.',\n }),\n }),\n output: Schema.Void,\n services: [AiContextService, Database.Service],\n});\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,WAAWC,qBAAqB;AACzC,SAASC,wBAAwB;AACjC,SAASC,OAAOC,cAAcC,WAAWC,yBAAyB;AAClE,SAASC,UAAUC,MAAMC,KAAKC,WAAW;AACzC,SAASC,oBAAoB;AAItB,IAAMC,cAAcC,UAAUC,KAAK;EACxCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBC,OAAcC,eAAQ,MAAMC,IAAIA,IAAIC,cAAMA,KAAK,CAAA;IAC/CC,QAAeC,gBAAgBC,aAAM;IACrCC,OAAcF,gBAASG,aAAaA,YAAY;EAClD,CAAA;EACAC,QAAeC;EACfC,UAAU;IACRC,UAAUA;IACVC,SAASC;IACTC;IACAC,KAAKC;IACLC,kBAAkBJ;IAClBK,MAAMC;IACNC,cAAcC;;AAElB,CAAA;AAEO,IAAMC,YAAY/B,UAAUC,KAAK;EACtCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aACE;EACJ;EACAC,OAAcC,cAAO;IACnBC,OAAcC,eAAQ,MAAMC,IAAIA,IAAIC,cAAMA,KAAK,CAAA;IAC/CI,OAAOC,aAAaA;EACtB,CAAA;EACAC,QAAeC;EACfC,UAAU;IAACC,UAAUA;IAAWC,SAASC;;AAC3C,CAAA;AAEO,IAAMU,aAAahC,UAAUC,KAAK;EACvCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO,CAAC,CAAA;EACtBU,QAAeV,cAAO;IACpB0B,IAAWnB;IACXV,MAAaU;IACboB,cAAqBpB;IACrBqB,MAAarB;IACbsB,WAAkBC,aACT9B,cAAO;MACZH,MAAaU;MACbwB,MAAazB,gBAAgBC,aAAM;MACnCyB,KAAY1B,gBAAgBC,aAAM;IACpC,CAAA,CAAA;EAEJ,CAAA;EACAK,UAAU;IAACqB;IAAkBnB,SAASC;;AACxC,CAAA;AAEO,IAAMmB,cAAczC,UAAUC,KAAK;EACxCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBH,MAAaU,cAAO4B,YAAY;MAC9BrC,aAAa;IACf,CAAA;IACAsC,UAAUjC,IAAIA,IAAIkC,IAAIC,OAAO,EAAEH,YAAY;MACzCrC,aAAa;IACf,CAAA;EACF,CAAA;EACAY,QAAeC;EACfC,UAAU;IAACqB;IAAkBnB,SAASC;;AACxC,CAAA;",
|
|
6
|
-
"names": ["Schema", "AiService", "OpaqueToolkit", "AiContextService", "Trace", "TriggerEvent", "Operation", "OperationRegistry", "Database", "Feed", "Obj", "Ref", "QueueService", "AgentWorker", "Operation", "make", "meta", "key", "name", "description", "input", "Struct", "agent", "suspend", "Ref", "Agent", "prompt", "optional", "String", "event", "TriggerEvent", "output", "Void", "services", "AiService", "Database", "Service", "QueueService", "Feed", "FeedService", "OperationRegistry", "Trace", "TraceService", "OpaqueToolkit", "OpaqueToolkitProvider", "Qualifier", "GetContext", "id", "instructions", "plan", "artifacts", "Array", "type", "dxn", "AiContextService", "AddArtifact", "annotations", "artifact", "Obj", "Unknown"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/blueprints/database/functions/definitions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { AiContextService } from '@dxos/assistant';\nimport { Operation } from '@dxos/compute';\nimport { Database, Obj, Ref, Relation, Tag } from '@dxos/echo';\nimport { trim } from '@dxos/util';\n\nexport const Query = Operation.make({\n meta: {\n key: 'org.dxos.function.database.query',\n name: 'Query',\n description: trim`\n Query for objects in ECHO.\n Use this tool when searching for information in the space (both automerge and queues).\n Currently, two types of queries are supported:\n - Full-text search - terms may appear anywhere in the object.\n - Type-based search - objects of a specific type.\n You can use them together, for example, to search for objects of a specific type that match a full-text query.\n Important: Whem querying by typename, make sure to list the schema first, to get the exact typename.\n\n Omit both typename and text to search for all objects.\n\n <output_format>\n You can choose to either return the full object data, or just the DXN, type and label.\n When expecting a lot of results, run with includeContent=false to not pollute the context, and then load specific objects using the load tool.\n\n You can choose to get the content right away, if you don't expect a lot of results.\n To load content right away, run with includeContent=true.\n When loading content, set an appropriate limit on the number of results to avoid overwhelming the context.\n </output_format>\n\n <example description=\"All tasks related to Cyberdyne and Bob\">\n {\n \"typename\": \"org.dxos.type.task\",\n \"text\": \"cyberdyne bob\",\n }\n </example>\n\n <example description=\"Financial report Q1 2026\">\n {\n \"typename\": \"org.dxos.type.document\",\n \"text\": \"financial report Q1 2026\",\n \"includeContent\": true\n \"limit\": 3\n }\n </example>\n\n <example description=\"Emails from specific mailboxes\">\n {\n \"in\": [{\"/\" : \"dxn:echo:@:YYYYYY\"}, {\"/\" : \"dxn:echo:@:XXXXXXX\"}],\n \"typename\": \"org.dxos.type.email\",\n \"includeContent\": true,\n \"limit\": 20\n }\n </example>\n `,\n },\n input: Schema.Struct({\n in: Schema.optional(\n Schema.Array(Ref.Ref(Obj.Unknown)).annotations({\n description:\n 'Scope the query to children of specific objects (transitively). ' +\n 'Use this to query items within containers such as feeds or folders. ' +\n 'For example, to find emails use `in: [mailbox1.feed, mailbox2.feed]`.',\n }),\n ),\n typename: Schema.optional(\n Schema.String.annotations({\n description: 'The typename of the objects to list.',\n example: 'org.dxos.type.task',\n }),\n ),\n text: Schema.optional(\n Schema.String.annotations({\n description: 'Full text search query.',\n example: 'email cyberdyne bob',\n }),\n ),\n includeContent: Schema.optional(\n Schema.Boolean.annotations({\n description: 'Include the full object data in the response.',\n default: false,\n }),\n ),\n limit: Schema.optional(\n Schema.Number.annotations({\n description: 'The maximum number of results to return.',\n default: 10,\n }),\n ),\n includeQueues: Schema.optional(\n Schema.Boolean.annotations({\n description: 'Search in queues as well as spaces. Only use this if searching for emails.',\n default: false,\n }),\n ),\n }),\n output: Schema.Array(Schema.Unknown),\n services: [Database.Service],\n});\n\nexport const Load = Operation.make({\n meta: {\n key: 'org.dxos.function.database.load',\n name: 'Load object',\n description: trim`\n Loads the object or relation content.\n Can load multiple objects at at time.\n Use the to read the data when you have a DXN.\n Call this tool with an array of one or more DXNs or object IDs.\n When use see a reference ({ '/': 'dxn:...' }), you can call this function to load the object.\n Note that returned data is only a snapshot in time, and might have changed since the object was last loaded.\n `,\n },\n input: Schema.Struct({\n refs: Schema.Array(Ref.Ref(Obj.Unknown)),\n }),\n output: Schema.Unknown,\n services: [Database.Service],\n});\n\nexport const ObjectCreate = Operation.make({\n meta: {\n key: 'org.dxos.function.database.object-create',\n name: 'Create object',\n description: trim`\n Creates a new object and adds it to the current space.\n Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.\n References are provided in the following format: { \"/\": \"dxn:...\" }.\n Reference examples: { \"/\": \"dxn:echo:@:01KG7R1ZXWFMWQ4DA1Q6TN1DG4\" }, { \"/\": \"dxn:queue:data:01KG7R1ZXWFMWQ4DA1Q6TN1DG4:01KG7R1ZXWFMWQ4DA1Q6TN1DG4\" }\n `,\n },\n input: Schema.Struct({\n typename: Schema.String,\n data: Schema.Any,\n }),\n output: Schema.Unknown,\n services: [Database.Service],\n});\n\nexport const ObjectUpdate = Operation.make({\n meta: {\n key: 'org.dxos.function.database.object-update',\n name: 'Update object',\n description: trim`\n Updates the object properties.\n References are provided in the following format: { \"/\": \"dxn:...\" }.\n Reference examples: { \"/\": \"dxn:echo:@:01KG7R1ZXWFMWQ4DA1Q6TN1DG4\" }, { \"/\": \"dxn:queue:data:01KG7R1ZXWFMWQ4DA1Q6TN1DG4:01KG7R1ZXWFMWQ4DA1Q6TN1DG4\" }\n `,\n },\n input: Schema.Struct({\n obj: Ref.Ref(Obj.Unknown),\n properties: Schema.Record({ key: Schema.String, value: Schema.Any }),\n }),\n output: Schema.Unknown,\n services: [Database.Service],\n});\n\nexport const ObjectDelete = Operation.make({\n meta: {\n key: 'org.dxos.function.database.object-delete',\n name: 'Delete object',\n description: trim`\n Deletes the object.\n `,\n },\n input: Schema.Struct({\n obj: Ref.Ref(Obj.Unknown),\n }),\n output: Schema.Void,\n services: [Database.Service],\n});\n\nexport const SchemaAdd = Operation.make({\n meta: {\n key: 'org.dxos.function.database.schema-add',\n name: 'Add schema',\n description: trim`\n Adds a schema to the space.\n The name will be used when displayed to the user.\n `,\n },\n input: Schema.Struct({\n name: Schema.String,\n typename: Schema.String.annotations({\n description: 'The typename of the schema in the format of \"com.example.type.type\".',\n }),\n jsonSchema: Schema.Any,\n }),\n output: Schema.Void,\n services: [Database.Service],\n});\n\nexport const SchemaList = Operation.make({\n meta: {\n key: 'org.dxos.function.database.schema-list',\n name: 'List schemas',\n description: trim`\n Lists schemas definitions.\n `,\n },\n input: Schema.Struct({\n limit: Schema.optional(Schema.Number),\n }),\n output: Schema.Array(Schema.Unknown),\n services: [Database.Service],\n});\n\nexport const ContextAdd = Operation.make({\n meta: {\n key: 'org.dxos.function.database.context-add',\n name: 'Add to context',\n description: trim`\n Adds the object to the chat context.\n Use this it for objects that are useful long-term for the conversation.\n `,\n },\n input: Schema.Struct({\n obj: Ref.Ref(Obj.Unknown).annotations({\n description: 'Object to add to the chat context.',\n }),\n }),\n output: Schema.Void,\n services: [AiContextService],\n});\n\nexport const ContextRemove = Operation.make({\n meta: {\n key: 'org.dxos.function.database.context-remove',\n name: 'Remove from context',\n description: trim`\n Removes the object from the chat context.\n Use this it for objects that are no longer useful for the conversation.\n `,\n },\n input: Schema.Struct({\n obj: Ref.Ref(Obj.Unknown).annotations({\n description: 'Object to remove from the chat context.',\n }),\n }),\n output: Schema.Void,\n services: [AiContextService],\n});\n\nexport const RelationCreate = Operation.make({\n meta: {\n key: 'org.dxos.function.database.relation-create',\n name: 'Create relation',\n description: trim`\n Creates a new relation and adds it to the current space.\n Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.\n `,\n },\n input: Schema.Struct({\n typename: Schema.String,\n source: Ref.Ref(Obj.Unknown),\n target: Ref.Ref(Obj.Unknown),\n properties: Schema.Any.annotations({\n description: 'The data to be stored in the relation.',\n }),\n }),\n output: Schema.Unknown,\n services: [Database.Service],\n});\n\nexport const RelationDelete = Operation.make({\n meta: {\n key: 'org.dxos.function.database.relation-delete',\n name: 'Delete relation',\n description: trim`\n Deletes the relation.\n `,\n },\n input: Schema.Struct({\n rel: Ref.Ref(Relation.Unknown),\n }),\n output: Schema.Void,\n services: [Database.Service],\n});\n\nexport const TagAdd = Operation.make({\n meta: {\n key: 'org.dxos.function.database.tag-add',\n name: 'Add tag',\n description: trim`\n Adds a tag to an object.\n Tags are objects of type ${Tag.Tag.typename}.\n You must search database for available tags, or create a new one.\n `,\n },\n input: Schema.Struct({\n tag: Ref.Ref(Obj.Unknown),\n obj: Ref.Ref(Obj.Unknown),\n }),\n output: Schema.Unknown,\n services: [Database.Service],\n});\n\nexport const TagRemove = Operation.make({\n meta: {\n key: 'org.dxos.function.database.tag-remove',\n name: 'Remove tag',\n description: trim`\n Removes a tag from an object.\n Tags are objects of type ${Tag.Tag.typename}.\n `,\n },\n input: Schema.Struct({\n tag: Ref.Ref(Obj.Unknown),\n obj: Ref.Ref(Obj.Unknown),\n }),\n output: Schema.Unknown,\n services: [Database.Service],\n});\n"],
|
|
5
|
-
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,wBAAwB;AACjC,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,KAAKC,KAAKC,UAAUC,WAAW;AAClD,SAASC,YAAY;AAEd,IAAMC,QAAQP,UAAUQ,KAAK;EAClCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAaN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6Cf;EACAO,OAAcC,cAAO;IACnBC,IAAWC,gBACFC,aAAMd,IAAIA,IAAID,IAAIgB,OAAO,CAAA,EAAGC,YAAY;MAC7CP,aACE;IAGJ,CAAA,CAAA;IAEFQ,UAAiBJ,gBACRK,cAAOF,YAAY;MACxBP,aAAa;MACbU,SAAS;IACX,CAAA,CAAA;IAEFC,MAAaP,gBACJK,cAAOF,YAAY;MACxBP,aAAa;MACbU,SAAS;IACX,CAAA,CAAA;IAEFE,gBAAuBR,gBACdS,eAAQN,YAAY;MACzBP,aAAa;MACbc,SAAS;IACX,CAAA,CAAA;IAEFC,OAAcX,gBACLY,cAAOT,YAAY;MACxBP,aAAa;MACbc,SAAS;IACX,CAAA,CAAA;IAEFG,eAAsBb,gBACbS,eAAQN,YAAY;MACzBP,aAAa;MACbc,SAAS;IACX,CAAA,CAAA;EAEJ,CAAA;EACAI,QAAeb,aAAaC,cAAO;EACnCa,UAAU;IAAC9B,SAAS+B;;AACtB,CAAA;AAEO,IAAMC,OAAOjC,UAAU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AC/B,CAAA;EACAY,QAAec;EACfb,UAAU;IAAC9B,SAAS+B;;AACtB,CAAA;AAEO,IAAMuB,SAASvD,UAAUQ,KAAK;EACnCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAaN;;iCAEgBD,IAAIA,IAAIe,QAAQ;;;EAG/C;EACAP,OAAcC,cAAO;IACnB0C,KAAKrD,IAAIA,IAAID,IAAIgB,OAAO;IACxBqB,KAAKpC,IAAIA,IAAID,IAAIgB,OAAO;EAC1B,CAAA;EACAY,QAAeZ;EACfa,UAAU;IAAC9B,SAAS+B;;AACtB,CAAA;AAEO,IAAMyB,YAAYzD,UAAUQ,KAAK;EACtCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAaN;;iCAEgBD,IAAIA,IAAIe,QAAQ;;EAE/C;EACAP,OAAcC,cAAO;IACnB0C,KAAKrD,IAAIA,IAAID,IAAIgB,OAAO;IACxBqB,KAAKpC,IAAIA,IAAID,IAAIgB,OAAO;EAC1B,CAAA;EACAY,QAAeZ;EACfa,UAAU;IAAC9B,SAAS+B;;AACtB,CAAA;",
|
|
6
|
-
"names": ["Schema", "AiContextService", "Operation", "Database", "Obj", "Ref", "Relation", "Tag", "trim", "Query", "make", "meta", "key", "name", "description", "input", "Struct", "in", "optional", "Array", "Unknown", "annotations", "typename", "String", "example", "text", "includeContent", "Boolean", "default", "limit", "Number", "includeQueues", "output", "services", "Service", "Load", "refs", "ObjectCreate", "data", "Any", "ObjectUpdate", "obj", "properties", "Record", "value", "ObjectDelete", "Void", "SchemaAdd", "jsonSchema", "SchemaList", "ContextAdd", "ContextRemove", "RelationCreate", "source", "target", "RelationDelete", "rel", "TagAdd", "tag", "TagRemove"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/Plan.ts", "../../../src/types/Agent.ts", "../../../src/types/McpServer.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Ref, Type } from '@dxos/echo';\n\nimport * as Chat from './Chat';\n\nexport const TaskId = Schema.String.pipe(Schema.brand('@dxos/assistant-toolkit/TaskId'));\nexport type TaskId = Schema.Schema.Type<typeof TaskId>;\n\nexport const Task = Schema.Struct({\n /**\n * Short task ID unique within the plan.\n */\n id: TaskId,\n\n title: Schema.String.annotations({\n description: 'Task title and description.',\n }),\n\n status: Schema.Literal('todo', 'in-progress', 'done'),\n\n /**\n * Parent task ID.\n */\n parent: Schema.optional(TaskId).annotations({\n description: 'Parent task ID.',\n }),\n\n /**\n * Chat object that this task is associated with.\n */\n chat: Schema.optional(Ref.Ref(Chat.Chat)),\n});\nexport interface Task extends Schema.Schema.Type<typeof Task> {}\n\n/**\n * Hierarchical collection of tasks for humans and agents to track progress.\n */\nexport const Plan = Schema.Struct({\n tasks: Schema.Array(Task),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.plan',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\nexport interface Plan extends Schema.Schema.Type<typeof Plan> {}\n\nexport const generateTaskId = (plan: Plan): TaskId => {\n const existingIds = plan.tasks\n .map((task) => {\n const [num, letter] = task.id.split('-');\n return parseInt(num);\n })\n .filter((_) => !isNaN(_));\n let newId;\n if (existingIds.length === 0) {\n newId = 1;\n } else {\n newId = Math.max(...existingIds) + 1;\n }\n // Add random suffix to avoid collisions.\n return TaskId.make(`${newId}-${crypto.randomUUID().slice(0, 2)}`);\n};\n\n/**\n * Add new tasks to a plan, generating IDs for new tasks.\n * Use inside an `Obj.update` callback.\n */\nexport const addTasks = (\n plan: Obj.Mutable<Plan>,\n tasks: (Pick<Task, 'title'> & Partial<Pick<Task, 'status' | 'parent' | 'chat'>>)[],\n) => {\n for (const task of tasks) {\n const taskId = generateTaskId(plan);\n plan.tasks.push({ id: taskId, ...task, status: task.status ?? 'todo' });\n }\n return plan;\n};\n\ninterface MakePlanProps {\n tasks: {\n title: string;\n status?: 'todo' | 'in-progress' | 'done';\n }[];\n}\n\nexport const makePlan = (props: MakePlanProps): Plan => {\n const plan = Obj.make(Plan, { tasks: [] });\n Obj.update(plan, (plan) => {\n addTasks(plan, props.tasks);\n });\n return plan;\n};\n\n/**\n * Formats plan to markdown format.\n */\nexport const formatPlan = (plan: Plan): string => {\n return plan.tasks\n .map((task) => `- **${task.status?.toLocaleUpperCase()}**: ${task.title ?? 'No title'} <!-- id=${task.id} -->`)\n .join('\\n');\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\nimport * as Schema from 'effect/Schema';\n\nimport { AiContextBinder, AiContextService } from '@dxos/assistant';\nimport { type Blueprint } from '@dxos/compute';\nimport { Annotation, Database, Feed, Format, Obj, Ref, Relation, Type } from '@dxos/echo';\nimport { Queue } from '@dxos/echo-db';\nimport { type ObjectNotFoundError } from '@dxos/echo/Err';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { acquireReleaseResource } from '@dxos/effect';\nimport { QueueService } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { QueueAnnotation, Text } from '@dxos/schema';\n\nimport * as Chat from './Chat';\nimport * as Plan from './Plan';\n\n/**\n * Agent schema definition.\n */\nexport const Agent = Schema.Struct({\n name: Schema.optional(Schema.String),\n\n /**\n * When false, agent triggers are disabled after sync-triggers runs.\n */\n enabled: Schema.optional(Schema.Boolean).annotations({\n title: 'Enabled',\n description: 'Master switch for agent automation; propagated to all triggers on sync.',\n }),\n\n /**\n * Instructions for the agent.\n */\n instructions: Ref.Ref(Text.Text).pipe(\n Format.FormatAnnotation.set(Format.TypeFormat.Markdown),\n Schema.annotations({ title: 'Instructions' }),\n ),\n\n /**\n * Primary chat for the agent.\n */\n // TODO(dmaretskyi): Multiple chats; RB: branching hierarchy.\n chat: Schema.optional(Ref.Ref(Chat.Chat).pipe(FormInputAnnotation.set(false))),\n\n // TODO(burdon): Is this used? Should it be an artifact?\n // Format.FormatAnnotation.set(Format.TypeFormat.Markdown)\n plan: Ref.Ref(Plan.Plan).pipe(FormInputAnnotation.set(false)),\n\n // TODO(burdon): Currently Memory.Memory objects are global to the space; make them artifacts?\n artifacts: Schema.Array(\n Schema.Struct({\n // TODO(dmaretskyi): Consider gettings names from the artifact itself using Obj.getLabel.\n name: Schema.String,\n // TODO(burdon): Rename object.\n data: Ref.Ref(Obj.Unknown),\n }),\n ).pipe(FormInputAnnotation.set(false)),\n\n /**\n * Input feed for subscriptions.\n */\n // TODO(burdon): Rename to Feed?\n // NOTE: Named `queue` to conform to subscribable schema (see QueueAnnotation).\n queue: Schema.optional(Ref.Ref(Queue).pipe(FormInputAnnotation.set(false))),\n\n /**\n * References to objects with a canonical queue property.\n * Schema must have the QueueAnnotation.\n */\n // TODO(dmaretskyi): Turn into an array of objects when form-data\n subscriptions: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(FormInputAnnotation.set(false)),\n\n /**\n * Allow the agent to filter events.\n * Related events will be added to the input queue of the agent.\n * It is recommended to enable this.\n */\n filterEvents: Schema.optional(Schema.Boolean).annotations({\n title: 'Filter events',\n description: 'Allow the agent to filter events.',\n }),\n\n /**\n * Cron expression for a timer trigger that invokes the agent worker on a schedule.\n * The timer trigger bypasses the qualifier and goes straight to the agent worker.\n */\n cron: Schema.optional(Schema.String).annotations({\n title: 'Cron',\n description: 'Cron expression for a timer trigger that invokes the agent on a schedule.',\n }),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.agent',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n QueueAnnotation.set(true),\n Annotation.IconAnnotation.set({\n icon: 'ph--drone--regular',\n hue: 'sky',\n }),\n);\n\nexport interface Agent extends Schema.Schema.Type<typeof Agent> {}\n\n/**\n * Creates a fully initialized Agent with chat, queue, and context bindings.\n *\n * @param props - Agent properties including spec, plan, blueprints, and context objects.\n * @param blueprint - The blueprint to use for the agent context.\n * @returns An Effect that yields the initialized Agent.\n */\nexport const makeInitialized = (\n props: Omit<Obj.MakeProps<typeof Agent>, 'instructions' | 'plan' | 'artifacts' | 'subscriptions' | 'chat'> &\n Partial<Pick<Obj.MakeProps<typeof Agent>, 'artifacts' | 'subscriptions'>> & {\n instructions: string;\n blueprints?: Ref.Ref<Blueprint.Blueprint>[];\n contextObjects?: Ref.Ref<Obj.Any>[];\n },\n blueprint: Blueprint.Blueprint,\n): Effect.Effect<Agent, never, QueueService | Feed.FeedService | Database.Service> =>\n Effect.gen(function* () {\n const agent = Obj.make(Agent, {\n ...props,\n instructions: Ref.make(Text.make(props.instructions)),\n plan: Ref.make(Plan.makePlan({ tasks: [] })),\n artifacts: props.artifacts ?? [],\n subscriptions: props.subscriptions ?? [],\n filterEvents: props.filterEvents ?? true,\n enabled: props.enabled ?? true,\n });\n yield* Database.add(agent);\n const feed = yield* Database.add(Feed.make());\n const runtime = yield* Effect.runtime<Feed.FeedService>();\n const contextBinder = new AiContextBinder({ feed, runtime });\n // TODO(dmaretskyi): Blueprint registry.\n const agentBlueprint = yield* Database.add(Obj.clone(blueprint, { deep: true }));\n yield* Effect.promise(() =>\n contextBinder.bind({\n blueprints: [Ref.make(agentBlueprint), ...(props.blueprints ?? [])],\n objects: [Ref.make(agent), ...(props.contextObjects ?? [])],\n }),\n );\n const chat = yield* Database.add(\n Chat.make({\n [Obj.Parent]: agent,\n feed: Ref.make(feed),\n }),\n );\n Obj.setParent(feed, chat);\n yield* Database.add(\n Relation.make(Chat.CompanionTo, {\n [Relation.Source]: chat,\n [Relation.Target]: agent,\n }),\n );\n\n const inputQueue = yield* QueueService.createQueue();\n\n Obj.update(agent, (agent) => {\n agent.chat = Ref.make(chat);\n agent.queue = Ref.fromDXN(inputQueue.dxn);\n });\n\n return agent;\n });\n\n/**\n * Resets the agent chat history by rebuilding the chat context.\n * Preserves the existing blueprints and objects from the current chat context.\n *\n * @param agent - The agent whose chat history should be reset. Must have an existing chat.\n * @returns An Effect that resets the chat history.\n */\nexport const resetChatHistory = (\n agent: Agent,\n): Effect.Effect<void, ObjectNotFoundError, Feed.FeedService | Database.Service> =>\n Effect.gen(function* () {\n invariant(agent.chat, 'Agent must have an existing chat to reset.');\n\n const existingFeed = yield* agent.chat.pipe(Database.load).pipe(\n Effect.map((_) => _.feed),\n Effect.flatMap(Database.load),\n );\n const runtime = yield* Effect.runtime<Feed.FeedService>();\n const existingContextBinder = yield* acquireReleaseResource(\n () =>\n new AiContextBinder({\n feed: existingFeed,\n runtime,\n }),\n );\n const blueprints = existingContextBinder.getBlueprints().map((blueprint) => Ref.make(blueprint));\n const objects = existingContextBinder.getObjects().map((object) => Ref.make(object));\n\n const feed = yield* Database.add(Feed.make());\n const contextBinder = new AiContextBinder({ feed, runtime });\n yield* Effect.promise(() =>\n contextBinder.bind({\n blueprints,\n objects,\n }),\n );\n\n const chat = yield* Database.add(\n Chat.make({\n feed: Ref.make(feed),\n }),\n );\n Obj.setParent(feed, chat);\n Obj.update(agent, (agent) => {\n agent.chat = Ref.make(chat);\n });\n\n yield* Database.add(\n Relation.make(Chat.CompanionTo, {\n [Relation.Source]: chat,\n [Relation.Target]: agent,\n }),\n );\n }).pipe(Effect.scoped);\n\nexport const getFromChatContext: Effect.Effect<Agent, Error, AiContextService> = Effect.gen(function* () {\n const agents = yield* Function.pipe(AiContextService.findObjects(Agent));\n if (agents.length !== 1) {\n return yield* Effect.fail(new Error(`There should be exactly one agent in context. Got: ${agents.length}`));\n }\n\n const agent = agents[0];\n return agent;\n});\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Type } from '@dxos/echo';\nimport { LabelAnnotation } from '@dxos/echo/internal';\n\n/**\n * MCP server configuration stored as a space-level ECHO object.\n *\n * NOTE: `apiKey` is stored in plaintext and replicated to all peers with access to the space.\n * A future iteration should move secrets to per-device credential storage or use envelope encryption.\n */\nexport const McpServer = Schema.Struct({\n name: Schema.String,\n url: Schema.String,\n protocol: Schema.Union(Schema.Literal('sse'), Schema.Literal('http')),\n /** Stored in plaintext; replicated to all peers in the space. */\n apiKey: Schema.optional(Schema.String),\n enabled: Schema.optional(Schema.Boolean),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.assistant.mcpServer',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--plugs-connected--regular',\n hue: 'sky',\n }),\n);\n\nexport interface McpServer extends Schema.Schema.Type<typeof McpServer> {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAAA;;;;;;;;;;AAMA,YAAYA,YAAY;AAExB,SAASC,YAAYC,KAAKC,KAAKC,YAAY;AAIpC,IAAMC,SAAgBC,cAAOC,KAAYC,aAAM,gCAAA,CAAA;AAG/C,IAAMC,OAAcC,cAAO;;;;EAIhCC,IAAIN;EAEJO,OAAcN,cAAOO,YAAY;IAC/BC,aAAa;EACf,CAAA;EAEAC,QAAeC,eAAQ,QAAQ,eAAe,MAAA;;;;EAK9CC,QAAeC,gBAASb,MAAAA,EAAQQ,YAAY;IAC1CC,aAAa;EACf,CAAA;;;;EAKAK,MAAaD,gBAASE,IAAIA,IAASC,IAAI,CAAA;AACzC,CAAA;AAMO,IAAMC,OAAcZ,cAAO;EAChCa,OAAcC,aAAMf,IAAAA;AACtB,CAAA,EAAGF,KACDkB,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,WAAWC,qBAAqBC,IAAI,IAAA,CAAA;AAI/B,IAAMC,iBAAiB,CAACC,SAAAA;AAC7B,QAAMC,cAAcD,KAAKV,MACtBY,IAAI,CAACC,SAAAA;AACJ,UAAM,CAACC,KAAKC,MAAAA,IAAUF,KAAKzB,GAAG4B,MAAM,GAAA;AACpC,WAAOC,SAASH,GAAAA;EAClB,CAAA,EACCI,OAAO,CAACC,MAAM,CAACC,MAAM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iBC,cAAaC,gBAAQ,KAAA,GAAeA,gBAAQ,MAAA,CAAA;;EAE7DC,QAAeC,iBAAgBN,cAAM;EACrCO,SAAgBD,iBAAgBE,eAAO;AACzC,CAAA,EAAGC,KACDd,MAAKe,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAhB,iBAAgBiB,IAAI;EAAC;CAAO,GAC5BnB,YAAWoB,eAAeD,IAAI;EAC5BE,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;",
|
|
6
|
-
"names": ["Schema", "Annotation", "Obj", "Ref", "Type", "TaskId", "String", "pipe", "brand", "Task", "Struct", "id", "title", "annotations", "description", "status", "Literal", "parent", "optional", "chat", "Ref", "Chat", "Plan", "tasks", "Array", "Type", "object", "typename", "version", "Annotation", "SystemTypeAnnotation", "set", "generateTaskId", "plan", "existingIds", "map", "task", "num", "letter", "split", "parseInt", "filter", "_", "isNaN", "newId", "length", "Math", "max", "make", "crypto", "randomUUID", "slice", "addTasks", "taskId", "push", "makePlan", "props", "Obj", "update", "formatPlan", "toLocaleUpperCase", "join", "Effect", "Function", "Schema", "AiContextBinder", "AiContextService", "Annotation", "Database", "Feed", "Format", "Obj", "Ref", "Relation", "Type", "Queue", "FormInputAnnotation", "LabelAnnotation", "acquireReleaseResource", "QueueService", "invariant", "QueueAnnotation", "Text", "Ref", "artifacts", "Array", "Schema", "String", "data", "Obj", "description", "Type", "typename", "version", "LabelAnnotation", "QueueAnnotation", "set", "icon", "hue", "Annotation", "props", "instructions", "make", "Text", "plan", "subscriptions", "filterEvents", "enabled", "Database", "agent", "runtime", "Effect", "contextBinder", "AiContextBinder", "feed", "agentBlueprint", "objects", "chat", "setParent", "Source", "Relation", "Target", "inputQueue", "queue", "fromDXN", "existingFeed", "pipe", "existingContextBinder", "acquireReleaseResource", "blueprints", "add", "scoped", "agents", "Error", "Schema", "Annotation", "Type", "LabelAnnotation", "McpServer", "Struct", "name", "String", "url", "protocol", "Union", "Literal", "apiKey", "optional", "enabled", "Boolean", "pipe", "object", "typename", "version", "set", "IconAnnotation", "icon", "hue"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/functions/agent/definitions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { AiService, OpaqueToolkit, ModelName } from '@dxos/ai';\nimport { Routine, Trace, Operation, OperationRegistry } from '@dxos/compute';\nimport { Database, Feed, Ref } from '@dxos/echo';\n\nimport * as Chat from '../../types/Chat';\n\nexport const AgentPrompt = Operation.make({\n meta: {\n key: 'org.dxos.function.prompt',\n name: 'Agent',\n description: 'Agentic worker that executes a provided prompt using blueprints and tools.',\n },\n input: Schema.Struct({\n prompt: Ref.Ref(Routine.Routine),\n\n /**\n * When set, runs in this chat (history, queue, and bound context). Routine blueprints and context objects are merged into the conversation for this request.\n */\n chat: Schema.optional(Ref.Ref(Chat.Chat)),\n\n /**\n * @default @anthropic/claude-opus-4-6\n */\n\n model: Schema.optional(ModelName),\n /**\n * Input object or data.\n * References get auto-resolved.\n */\n input: Schema.Any.pipe(Schema.annotations({ title: 'Input' })),\n\n systemInstructions: Schema.optional(Schema.String).annotations({\n description: 'Additional system instructions to add to the system prompt.',\n }),\n }),\n output: Schema.Any,\n services: [\n AiService.AiService,\n Database.Service,\n Feed.FeedService,\n OpaqueToolkit.OpaqueToolkitProvider,\n OperationRegistry.Service,\n Trace.TraceService,\n ],\n});\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,WAAWC,eAAeC,iBAAiB;AACpD,SAASC,SAASC,OAAOC,WAAWC,yBAAyB;AAC7D,SAASC,UAAUC,MAAMC,WAAW;AAI7B,IAAMC,cAAcC,UAAUC,KAAK;EACxCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBC,QAAQC,IAAIA,IAAIC,QAAQA,OAAO;;;;IAK/BC,MAAaC,gBAASH,IAAIA,IAASI,IAAI,CAAA;;;;IAMvCC,OAAcF,gBAASG,SAAAA;;;;;IAKvBT,OAAcU,WAAIC,KAAYC,mBAAY;MAAEC,OAAO;IAAQ,CAAA,CAAA;IAE3DC,oBAA2BR,gBAAgBS,aAAM,EAAEH,YAAY;MAC7Db,aAAa;IACf,CAAA;EACF,CAAA;EACAiB,QAAeN;EACfO,UAAU;IACRC,UAAUA;IACVC,SAASC;IACTC,KAAKC;IACLC,cAAcC;IACdC,kBAAkBL;IAClBM,MAAMC;;AAEV,CAAA;",
|
|
6
|
-
"names": ["Schema", "AiService", "OpaqueToolkit", "ModelName", "Routine", "Trace", "Operation", "OperationRegistry", "Database", "Feed", "Ref", "AgentPrompt", "Operation", "make", "meta", "key", "name", "description", "input", "Struct", "prompt", "Ref", "Routine", "chat", "optional", "Chat", "model", "ModelName", "Any", "pipe", "annotations", "title", "systemInstructions", "String", "output", "services", "AiService", "Database", "Service", "Feed", "FeedService", "OpaqueToolkit", "OpaqueToolkitProvider", "OperationRegistry", "Trace", "TraceService"]
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|