@dxos/assistant-toolkit 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +366 -264
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +43 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +366 -264
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +44 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/blueprints/design/design-blueprint.d.ts +17 -3
- package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/design/index.d.ts +1 -1
- package/dist/types/src/blueprints/design/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +9 -10
- package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/discord/index.d.ts +1 -1
- package/dist/types/src/blueprints/discord/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/linear/index.d.ts +1 -1
- package/dist/types/src/blueprints/linear/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +9 -10
- package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/planning/index.d.ts +1 -1
- package/dist/types/src/blueprints/planning/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +17 -3
- package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/research/index.d.ts +1 -1
- package/dist/types/src/blueprints/research/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/research/research-blueprint.d.ts +17 -3
- package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/testing.d.ts +2 -2
- package/dist/types/src/blueprints/testing.d.ts.map +1 -1
- package/dist/types/src/blueprints/websearch/index.d.ts +1 -1
- package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +17 -3
- package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +1 -1
- package/dist/types/src/crud/graph.d.ts +14 -11
- package/dist/types/src/crud/graph.d.ts.map +1 -1
- package/dist/types/src/functions/agent/prompt.d.ts +71 -4
- package/dist/types/src/functions/agent/prompt.d.ts.map +1 -1
- package/dist/types/src/functions/document/read.d.ts.map +1 -1
- package/dist/types/src/functions/document/update.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +93 -91
- package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -1
- package/dist/types/src/functions/entity-extraction/index.d.ts +93 -91
- package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -1
- package/dist/types/src/functions/exa/data/exa-search-1748337321991.d.ts.map +1 -0
- package/dist/types/src/functions/exa/data/exa-search-1748337331526.d.ts.map +1 -0
- package/dist/types/src/functions/exa/data/exa-search-1748337344119.d.ts.map +1 -0
- package/dist/types/src/functions/exa/data/index.d.ts.map +1 -0
- package/dist/types/src/functions/github/fetch-prs.d.ts.map +1 -1
- package/dist/types/src/functions/linear/index.d.ts +1 -1
- package/dist/types/src/functions/linear/sync-issues.d.ts +1 -1
- package/dist/types/src/functions/linear/sync-issues.d.ts.map +1 -1
- package/dist/types/src/functions/research/document-create.d.ts.map +1 -1
- package/dist/types/src/functions/research/research-graph.d.ts +8 -7
- package/dist/types/src/functions/research/research-graph.d.ts.map +1 -1
- package/dist/types/src/functions/research/research.d.ts.map +1 -1
- package/dist/types/src/functions/tasks/read.d.ts.map +1 -1
- package/dist/types/src/functions/tasks/update.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/initiative/Initiative.d.ts +84 -0
- package/dist/types/src/initiative/Initiative.d.ts.map +1 -0
- package/dist/types/src/initiative/InitiativeSchema.d.ts +19 -0
- package/dist/types/src/initiative/InitiativeSchema.d.ts.map +1 -0
- package/dist/types/src/initiative/functions/agent.d.ts +37 -0
- package/dist/types/src/initiative/functions/agent.d.ts.map +1 -0
- package/dist/types/src/initiative/functions/getContext.d.ts +17 -0
- package/dist/types/src/initiative/functions/getContext.d.ts.map +1 -0
- package/dist/types/src/initiative/functions/index.d.ts +4 -0
- package/dist/types/src/initiative/functions/index.d.ts.map +1 -0
- package/dist/types/src/initiative/functions/update.d.ts +7 -0
- package/dist/types/src/initiative/functions/update.d.ts.map +1 -0
- package/dist/types/src/initiative/index.d.ts +1 -0
- package/dist/types/src/initiative/index.d.ts.map +1 -0
- package/dist/types/src/initiative/initiative.test.d.ts +2 -0
- package/dist/types/src/initiative/initiative.test.d.ts.map +1 -0
- package/dist/types/src/sync/sync.d.ts +3 -3
- package/dist/types/src/sync/sync.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/plugins.d.ts +19 -0
- package/dist/types/src/testing/plugins.d.ts.map +1 -0
- package/dist/types/src/toolkits/AssistantToolkit.d.ts +31 -5
- package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +1 -1
- package/dist/types/src/toolkits/SystemToolkit.d.ts +42 -10
- package/dist/types/src/toolkits/SystemToolkit.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -35
- package/src/blueprints/design/design-blueprint.test.ts +10 -8
- package/src/blueprints/design/design-blueprint.ts +2 -4
- package/src/blueprints/design/index.ts +1 -1
- package/src/blueprints/discord/discord-blueprint.ts +2 -4
- package/src/blueprints/discord/index.ts +1 -1
- package/src/blueprints/linear/index.ts +1 -1
- package/src/blueprints/linear/linear-blueprint.ts +2 -4
- package/src/blueprints/planning/index.ts +1 -1
- package/src/blueprints/planning/planning-blueprint.test.ts +8 -6
- package/src/blueprints/planning/planning-blueprint.ts +2 -4
- package/src/blueprints/research/index.ts +1 -1
- package/src/blueprints/research/research-blueprint.ts +2 -4
- package/src/blueprints/testing.ts +2 -2
- package/src/blueprints/websearch/index.ts +2 -1
- package/src/blueprints/websearch/websearch-blueprint.ts +2 -4
- package/src/crud/graph.test.ts +4 -27
- package/src/crud/graph.ts +21 -23
- package/src/experimental/feed.test.ts +1 -1
- package/src/functions/agent/prompt.ts +17 -13
- package/src/functions/discord/fetch-messages.test.ts +1 -1
- package/src/functions/discord/fetch-messages.ts +1 -1
- package/src/functions/document/read.ts +4 -3
- package/src/functions/document/update.ts +7 -4
- package/src/functions/entity-extraction/entity-extraction.conversations.json +6597 -1
- package/src/functions/entity-extraction/entity-extraction.test.ts +7 -6
- package/src/functions/entity-extraction/entity-extraction.ts +38 -19
- package/src/functions/exa/mock.ts +1 -1
- package/src/functions/github/fetch-prs.ts +3 -2
- package/src/functions/linear/linear.test.ts +11 -10
- package/src/functions/linear/sync-issues.ts +7 -5
- package/src/functions/research/document-create.ts +7 -6
- package/src/functions/research/research-graph.ts +11 -11
- package/src/functions/research/research.conversations.json +1 -1
- package/src/functions/research/research.test.ts +24 -32
- package/src/functions/research/research.ts +8 -9
- package/src/functions/tasks/read.ts +4 -3
- package/src/functions/tasks/update.ts +4 -3
- package/src/index.ts +0 -1
- package/src/initiative/Initiative.ts +99 -0
- package/src/initiative/InitiativeSchema.ts +37 -0
- package/src/initiative/functions/agent.ts +57 -0
- package/src/initiative/functions/getContext.ts +74 -0
- package/src/initiative/functions/index.ts +7 -0
- package/src/initiative/functions/update.ts +63 -0
- package/src/initiative/index.ts +3 -0
- package/src/initiative/initiative.conversations.json +1 -0
- package/src/initiative/initiative.test.ts +485 -0
- package/src/sync/sync.ts +38 -30
- package/src/testing/index.ts +1 -1
- package/src/{plugins.tsx → testing/plugins.tsx} +13 -13
- package/src/toolkits/AssistantToolkit.conversations.json +1 -1
- package/src/toolkits/AssistantToolkit.test.ts +17 -11
- package/src/toolkits/AssistantToolkit.ts +31 -8
- package/src/toolkits/SystemToolkit.ts +100 -32
- package/dist/types/src/plugins.d.ts +0 -19
- package/dist/types/src/plugins.d.ts.map +0 -1
- package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +0 -1
- package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +0 -1
- package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +0 -1
- package/dist/types/src/testing/data/index.d.ts.map +0 -1
- /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337321991.d.ts +0 -0
- /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337331526.d.ts +0 -0
- /package/dist/types/src/{testing → functions/exa}/data/exa-search-1748337344119.d.ts +0 -0
- /package/dist/types/src/{testing → functions/exa}/data/index.d.ts +0 -0
- /package/src/{testing → functions/exa}/data/exa-search-1748337321991.ts +0 -0
- /package/src/{testing → functions/exa}/data/exa-search-1748337331526.ts +0 -0
- /package/src/{testing → functions/exa}/data/exa-search-1748337344119.ts +0 -0
- /package/src/{testing → functions/exa}/data/index.ts +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/assistant-toolkit",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.937b3ca",
|
|
4
4
|
"description": "Assistant toolkit, definitions, and utilities.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"type": "module",
|
|
@@ -13,55 +17,65 @@
|
|
|
13
17
|
"types": "./dist/types/src/index.d.ts",
|
|
14
18
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
19
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./testing": {
|
|
22
|
+
"source": "./src/testing/index.ts",
|
|
23
|
+
"types": "./dist/types/src/testing/index.d.ts",
|
|
24
|
+
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
25
|
+
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
16
26
|
}
|
|
17
27
|
},
|
|
18
28
|
"types": "dist/types/src/index.d.ts",
|
|
19
29
|
"typesVersions": {
|
|
20
|
-
"*": {
|
|
30
|
+
"*": {
|
|
31
|
+
"testing": [
|
|
32
|
+
"./dist/types/src/testing/index.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
21
35
|
},
|
|
22
36
|
"files": [
|
|
23
37
|
"dist",
|
|
24
38
|
"src"
|
|
25
39
|
],
|
|
26
40
|
"dependencies": {
|
|
27
|
-
"@effect/ai": "0.
|
|
28
|
-
"@effect/ai-anthropic": "0.
|
|
29
|
-
"@effect/experimental": "0.
|
|
30
|
-
"@effect/platform": "
|
|
31
|
-
"dfx": "^0.
|
|
41
|
+
"@effect/ai": "0.32.1",
|
|
42
|
+
"@effect/ai-anthropic": "0.22.0",
|
|
43
|
+
"@effect/experimental": "0.57.11",
|
|
44
|
+
"@effect/platform": "0.93.6",
|
|
45
|
+
"dfx": "^0.127.0",
|
|
32
46
|
"exa-js": "^1.5.12",
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/echo-
|
|
41
|
-
"@dxos/echo-
|
|
42
|
-
"@dxos/edge-client": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/plugin-markdown": "0.8.4-main.
|
|
51
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.
|
|
52
|
-
"@dxos/schema": "0.8.4-main.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
47
|
+
"@dxos/app-framework": "0.8.4-main.937b3ca",
|
|
48
|
+
"@dxos/ai": "0.8.4-main.937b3ca",
|
|
49
|
+
"@dxos/assistant": "0.8.4-main.937b3ca",
|
|
50
|
+
"@dxos/blueprints": "0.8.4-main.937b3ca",
|
|
51
|
+
"@dxos/conductor": "0.8.4-main.937b3ca",
|
|
52
|
+
"@dxos/context": "0.8.4-main.937b3ca",
|
|
53
|
+
"@dxos/echo": "0.8.4-main.937b3ca",
|
|
54
|
+
"@dxos/echo-db": "0.8.4-main.937b3ca",
|
|
55
|
+
"@dxos/echo-protocol": "0.8.4-main.937b3ca",
|
|
56
|
+
"@dxos/edge-client": "0.8.4-main.937b3ca",
|
|
57
|
+
"@dxos/effect": "0.8.4-main.937b3ca",
|
|
58
|
+
"@dxos/errors": "0.8.4-main.937b3ca",
|
|
59
|
+
"@dxos/functions": "0.8.4-main.937b3ca",
|
|
60
|
+
"@dxos/keys": "0.8.4-main.937b3ca",
|
|
61
|
+
"@dxos/log": "0.8.4-main.937b3ca",
|
|
62
|
+
"@dxos/functions-runtime": "0.8.4-main.937b3ca",
|
|
63
|
+
"@dxos/invariant": "0.8.4-main.937b3ca",
|
|
64
|
+
"@dxos/plugin-markdown": "0.8.4-main.937b3ca",
|
|
65
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.937b3ca",
|
|
66
|
+
"@dxos/schema": "0.8.4-main.937b3ca",
|
|
67
|
+
"@dxos/util": "0.8.4-main.937b3ca",
|
|
68
|
+
"@dxos/types": "0.8.4-main.937b3ca"
|
|
55
69
|
},
|
|
56
70
|
"devDependencies": {
|
|
57
|
-
"effect": "3.
|
|
58
|
-
"react": "~19.2.
|
|
59
|
-
"react-dom": "~19.2.
|
|
71
|
+
"effect": "3.19.11",
|
|
72
|
+
"react": "~19.2.3",
|
|
73
|
+
"react-dom": "~19.2.3"
|
|
60
74
|
},
|
|
61
75
|
"peerDependencies": {
|
|
62
|
-
"effect": "
|
|
63
|
-
"react": "
|
|
64
|
-
"react-dom": "
|
|
76
|
+
"effect": "3.19.11",
|
|
77
|
+
"react": "~19.2.3",
|
|
78
|
+
"react-dom": "~19.2.3"
|
|
65
79
|
},
|
|
66
80
|
"publishConfig": {
|
|
67
81
|
"access": "public"
|
|
@@ -17,8 +17,10 @@ import {
|
|
|
17
17
|
} from '@dxos/assistant';
|
|
18
18
|
import { Blueprint } from '@dxos/blueprints';
|
|
19
19
|
import { Obj, Ref } from '@dxos/echo';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { Database } from '@dxos/echo';
|
|
21
|
+
import { acquireReleaseResource } from '@dxos/effect';
|
|
22
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
23
|
+
import { QueueService, TracingService } from '@dxos/functions';
|
|
22
24
|
import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
23
25
|
import { log } from '@dxos/log';
|
|
24
26
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
@@ -29,7 +31,7 @@ import { trim } from '@dxos/util';
|
|
|
29
31
|
import { Document } from '../../functions';
|
|
30
32
|
import { testToolkit } from '../testing';
|
|
31
33
|
|
|
32
|
-
import blueprint from './design-blueprint';
|
|
34
|
+
import { blueprint } from './design-blueprint';
|
|
33
35
|
|
|
34
36
|
describe('Design Blueprint', { timeout: 120_000 }, () => {
|
|
35
37
|
it.scoped(
|
|
@@ -38,21 +40,21 @@ describe('Design Blueprint', { timeout: 120_000 }, () => {
|
|
|
38
40
|
function* ({ expect }) {
|
|
39
41
|
const observer = GenerationObserver.fromPrinter(new ConsolePrinter());
|
|
40
42
|
const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
|
|
41
|
-
const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
|
|
43
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
42
44
|
|
|
43
|
-
yield*
|
|
45
|
+
yield* Database.Service.add(blueprint);
|
|
44
46
|
yield* Effect.promise(() =>
|
|
45
47
|
conversation.context.bind({
|
|
46
48
|
blueprints: [Ref.make(blueprint)],
|
|
47
49
|
}),
|
|
48
50
|
);
|
|
49
51
|
|
|
50
|
-
const artifact = yield*
|
|
52
|
+
const artifact = yield* Database.Service.add(Markdown.make({ content: 'Hello, world!' }));
|
|
51
53
|
let prevContent = artifact.content;
|
|
52
54
|
|
|
53
55
|
{
|
|
54
56
|
const prompt = trim`
|
|
55
|
-
I want to design a new feature for our product.
|
|
57
|
+
I want to design a new feature for our product.
|
|
56
58
|
|
|
57
59
|
We need to add a user profile system with the following requirements:
|
|
58
60
|
1. Users should be able to create and edit their profiles
|
|
@@ -72,7 +74,7 @@ describe('Design Blueprint', { timeout: 120_000 }, () => {
|
|
|
72
74
|
|
|
73
75
|
{
|
|
74
76
|
const prompt = trim`
|
|
75
|
-
I want this to be built on top of Durable Objects and SQLite database.
|
|
77
|
+
I want this to be built on top of Durable Objects and SQLite database.
|
|
76
78
|
Adjust the spec to reflect this.
|
|
77
79
|
`;
|
|
78
80
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { ToolId } from '@dxos/ai';
|
|
6
6
|
import { Blueprint } from '@dxos/blueprints';
|
|
7
|
-
import {
|
|
7
|
+
import { Ref } from '@dxos/echo';
|
|
8
8
|
import { Text } from '@dxos/schema';
|
|
9
9
|
import { trim } from '@dxos/util';
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ const instructions = trim`
|
|
|
20
20
|
Do not announce when you read or write the design spec document.
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
|
-
const blueprint
|
|
23
|
+
export const blueprint = Blueprint.make({
|
|
24
24
|
key: 'dxos.org/blueprint/design',
|
|
25
25
|
name: 'Design Spec',
|
|
26
26
|
description: 'Preserve the conversation in the design spec.',
|
|
@@ -29,5 +29,3 @@ const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
|
|
|
29
29
|
},
|
|
30
30
|
tools: [Document.read, Document.update].map((fn) => ToolId.make(fn.key)),
|
|
31
31
|
});
|
|
32
|
-
|
|
33
|
-
export default blueprint;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { ToolId } from '@dxos/ai';
|
|
6
6
|
import { Blueprint } from '@dxos/blueprints';
|
|
7
|
-
import {
|
|
7
|
+
import { Ref } from '@dxos/echo';
|
|
8
8
|
import { Text } from '@dxos/schema';
|
|
9
9
|
import { trim } from '@dxos/util';
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ const instructions = trim`
|
|
|
21
21
|
DXOS serverId: 837138313172353095
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
export const blueprint =
|
|
24
|
+
export const blueprint = Blueprint.make({
|
|
25
25
|
key: 'dxos.org/blueprint/discord',
|
|
26
26
|
name: 'Discord',
|
|
27
27
|
description: 'Discord integration.',
|
|
@@ -30,5 +30,3 @@ export const blueprint = Obj.make(Blueprint.Blueprint, {
|
|
|
30
30
|
},
|
|
31
31
|
tools: [ToolId.make(Discord.fetch.key)],
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
export default blueprint;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { ToolId } from '@dxos/ai';
|
|
6
6
|
import { Blueprint } from '@dxos/blueprints';
|
|
7
|
-
import {
|
|
7
|
+
import { Ref } from '@dxos/echo';
|
|
8
8
|
import { Text } from '@dxos/schema';
|
|
9
9
|
import { trim } from '@dxos/util';
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ const instructions = trim`
|
|
|
22
22
|
DXOS teamId: 1127c63a-6f77-4725-9229-50f6cd47321c
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
export const blueprint =
|
|
25
|
+
export const blueprint = Blueprint.make({
|
|
26
26
|
key: 'dxos.org/blueprint/linear',
|
|
27
27
|
name: 'Linear',
|
|
28
28
|
description: 'Syncs Linear workspaces.',
|
|
@@ -31,5 +31,3 @@ export const blueprint = Obj.make(Blueprint.Blueprint, {
|
|
|
31
31
|
},
|
|
32
32
|
tools: [Linear.sync].map((tool) => ToolId.make(tool.key)),
|
|
33
33
|
});
|
|
34
|
-
|
|
35
|
-
export default blueprint;
|
|
@@ -16,8 +16,10 @@ import {
|
|
|
16
16
|
} from '@dxos/assistant';
|
|
17
17
|
import { Blueprint } from '@dxos/blueprints';
|
|
18
18
|
import { Obj, Ref } from '@dxos/echo';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { Database } from '@dxos/echo';
|
|
20
|
+
import { acquireReleaseResource } from '@dxos/effect';
|
|
21
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
22
|
+
import { QueueService, TracingService } from '@dxos/functions';
|
|
21
23
|
import { FunctionImplementationResolver } from '@dxos/functions-runtime';
|
|
22
24
|
import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
23
25
|
import { log } from '@dxos/log';
|
|
@@ -29,7 +31,7 @@ import { trim } from '@dxos/util';
|
|
|
29
31
|
import { Tasks } from '../../functions';
|
|
30
32
|
import { type TestStep, runSteps, testToolkit } from '../testing';
|
|
31
33
|
|
|
32
|
-
import blueprint from './planning-blueprint';
|
|
34
|
+
import { blueprint } from './planning-blueprint';
|
|
33
35
|
|
|
34
36
|
describe('Planning Blueprint', { timeout: 120_000 }, () => {
|
|
35
37
|
it.scoped(
|
|
@@ -37,16 +39,16 @@ describe('Planning Blueprint', { timeout: 120_000 }, () => {
|
|
|
37
39
|
Effect.fn(
|
|
38
40
|
function* ({ expect }) {
|
|
39
41
|
const queue = yield* QueueService.createQueue<Message.Message | ContextBinding>();
|
|
40
|
-
const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
|
|
42
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
41
43
|
|
|
42
|
-
yield*
|
|
44
|
+
yield* Database.Service.add(blueprint);
|
|
43
45
|
yield* Effect.promise(() =>
|
|
44
46
|
conversation.context.bind({
|
|
45
47
|
blueprints: [Ref.make(blueprint)],
|
|
46
48
|
}),
|
|
47
49
|
);
|
|
48
50
|
|
|
49
|
-
const artifact = yield*
|
|
51
|
+
const artifact = yield* Database.Service.add(Markdown.make());
|
|
50
52
|
let prevContent = artifact.content;
|
|
51
53
|
const matchList =
|
|
52
54
|
({ includes = [], excludes = [] }: { includes: RegExp[]; excludes?: RegExp[] }) =>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { ToolId } from '@dxos/ai';
|
|
6
6
|
import { Blueprint } from '@dxos/blueprints';
|
|
7
|
-
import {
|
|
7
|
+
import { Ref } from '@dxos/echo';
|
|
8
8
|
import { Text } from '@dxos/schema';
|
|
9
9
|
import { trim } from '@dxos/util';
|
|
10
10
|
|
|
@@ -85,7 +85,7 @@ const instructions = trim`
|
|
|
85
85
|
- Be precise with task descriptions and hierarchy levels
|
|
86
86
|
`;
|
|
87
87
|
|
|
88
|
-
export const blueprint
|
|
88
|
+
export const blueprint = Blueprint.make({
|
|
89
89
|
key: 'dxos.org/blueprint/planning',
|
|
90
90
|
name: 'Planning',
|
|
91
91
|
description: 'Plans and tracks complex tasks with artifact management.',
|
|
@@ -94,5 +94,3 @@ export const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
|
|
|
94
94
|
},
|
|
95
95
|
tools: [Tasks.read, Tasks.update].map((fn) => ToolId.make(fn.key)),
|
|
96
96
|
});
|
|
97
|
-
|
|
98
|
-
export default blueprint;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { ToolId } from '@dxos/ai';
|
|
6
6
|
import { Blueprint } from '@dxos/blueprints';
|
|
7
|
-
import {
|
|
7
|
+
import { Ref } from '@dxos/echo';
|
|
8
8
|
import { Text } from '@dxos/schema';
|
|
9
9
|
import { trim } from '@dxos/util';
|
|
10
10
|
|
|
@@ -40,7 +40,7 @@ const instructions = trim`
|
|
|
40
40
|
</unstructured_mode>
|
|
41
41
|
`;
|
|
42
42
|
|
|
43
|
-
export const blueprint
|
|
43
|
+
export const blueprint = Blueprint.make({
|
|
44
44
|
key: 'dxos.org/blueprint/research',
|
|
45
45
|
name: 'Research',
|
|
46
46
|
description: 'Researches the web and creates structured data.',
|
|
@@ -49,5 +49,3 @@ export const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
|
|
|
49
49
|
},
|
|
50
50
|
tools: [Research.create, Research.research].map((fn) => ToolId.make(fn.key)),
|
|
51
51
|
});
|
|
52
|
-
|
|
53
|
-
export default blueprint;
|
|
@@ -6,10 +6,10 @@ import * as Toolkit from '@effect/ai/Toolkit';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
8
|
import { ConsolePrinter } from '@dxos/ai';
|
|
9
|
-
import { type AiConversation, type
|
|
9
|
+
import { type AiConversation, type AiConversationRunProps, GenerationObserver } from '@dxos/assistant';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
|
|
12
|
-
export type TestStep = Pick<
|
|
12
|
+
export type TestStep = Pick<AiConversationRunProps, 'prompt' | 'system'> & {
|
|
13
13
|
test?: () => Promise<void>;
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { ToolId } from '@dxos/ai';
|
|
6
6
|
import { Blueprint } from '@dxos/blueprints';
|
|
7
|
-
import {
|
|
7
|
+
import { Ref } from '@dxos/echo';
|
|
8
8
|
import { Text } from '@dxos/schema';
|
|
9
9
|
|
|
10
|
-
const blueprint
|
|
10
|
+
export const blueprint = Blueprint.make({
|
|
11
11
|
key: 'dxos.org/blueprint/web-search',
|
|
12
12
|
name: 'Web Search',
|
|
13
13
|
description: 'Search the web.',
|
|
@@ -16,5 +16,3 @@ const blueprint: Blueprint.Blueprint = Obj.make(Blueprint.Blueprint, {
|
|
|
16
16
|
},
|
|
17
17
|
tools: [ToolId.make('AnthropicWebSearch')],
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
export default blueprint;
|
package/src/crud/graph.test.ts
CHANGED
|
@@ -2,42 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as AnthropicClient from '@effect/ai-anthropic/AnthropicClient';
|
|
6
|
-
import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
|
|
7
5
|
import { describe, it } from '@effect/vitest';
|
|
8
|
-
import * as Config from 'effect/Config';
|
|
9
6
|
import * as Effect from 'effect/Effect';
|
|
10
|
-
import * as Function from 'effect/Function';
|
|
11
7
|
import * as Layer from 'effect/Layer';
|
|
12
8
|
|
|
13
|
-
import { AiService, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
14
|
-
import * as AiServiceRouter from '@dxos/ai/AiServiceRouter';
|
|
15
|
-
import { tapHttpErrors } from '@dxos/ai/testing';
|
|
16
9
|
import { AiSession } from '@dxos/assistant';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
10
|
+
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
11
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
19
12
|
import { log } from '@dxos/log';
|
|
20
13
|
import { Project } from '@dxos/types';
|
|
21
14
|
|
|
22
15
|
import { makeGraphWriterHandler, makeGraphWriterToolkit } from './graph';
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const TestLayer = Function.pipe(
|
|
27
|
-
AiService.model('@anthropic/claude-3-5-sonnet-20241022'),
|
|
28
|
-
Layer.provideMerge(DatabaseService.notAvailable),
|
|
29
|
-
Layer.provideMerge(ToolResolverService.layerEmpty),
|
|
30
|
-
Layer.provideMerge(ToolExecutionService.layerEmpty),
|
|
31
|
-
Layer.provide(AiServiceRouter.AiServiceRouter),
|
|
32
|
-
Layer.provide(
|
|
33
|
-
AnthropicClient.layerConfig({
|
|
34
|
-
apiKey: Config.redacted('ANTHROPIC_API_KEY'),
|
|
35
|
-
transformClient: tapHttpErrors,
|
|
36
|
-
}),
|
|
37
|
-
),
|
|
38
|
-
Layer.provide(FetchHttpClient.layer),
|
|
39
|
-
Layer.provideMerge(TracingService.layerNoop),
|
|
40
|
-
);
|
|
17
|
+
const TestLayer = AssistantTestLayer({});
|
|
41
18
|
|
|
42
19
|
describe('graph', () => {
|
|
43
20
|
// let builder: EchoTestBuilder;
|
|
@@ -63,7 +40,7 @@ describe('graph', () => {
|
|
|
63
40
|
log.info('response', { response });
|
|
64
41
|
},
|
|
65
42
|
Effect.provide(Layer.mergeAll(TestLayer, ToolkitLayer)),
|
|
66
|
-
TestHelpers.
|
|
43
|
+
TestHelpers.provideTestContext,
|
|
67
44
|
),
|
|
68
45
|
);
|
|
69
46
|
});
|
package/src/crud/graph.ts
CHANGED
|
@@ -12,6 +12,7 @@ import * as Schema from 'effect/Schema';
|
|
|
12
12
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
13
13
|
|
|
14
14
|
import { Entity, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
15
|
+
import { Database } from '@dxos/echo';
|
|
15
16
|
import {
|
|
16
17
|
ReferenceAnnotationId,
|
|
17
18
|
RelationSourceDXNId,
|
|
@@ -22,10 +23,10 @@ import {
|
|
|
22
23
|
getTypeAnnotation,
|
|
23
24
|
getTypeIdentifierAnnotation,
|
|
24
25
|
} from '@dxos/echo/internal';
|
|
25
|
-
import { type
|
|
26
|
+
import { type Queue } from '@dxos/echo-db';
|
|
26
27
|
import { isEncodedReference } from '@dxos/echo-protocol';
|
|
27
28
|
import { mapAst } from '@dxos/effect';
|
|
28
|
-
import { ContextQueueService
|
|
29
|
+
import { ContextQueueService } from '@dxos/functions';
|
|
29
30
|
import { DXN, ObjectId } from '@dxos/keys';
|
|
30
31
|
import { log } from '@dxos/log';
|
|
31
32
|
import { deepMapValues, isNonNullable, trim } from '@dxos/util';
|
|
@@ -39,7 +40,7 @@ export const Subgraph = Schema.Struct({
|
|
|
39
40
|
export interface Subgraph extends Schema.Schema.Type<typeof Subgraph> {}
|
|
40
41
|
|
|
41
42
|
export type RelatedSchema = {
|
|
42
|
-
schema:
|
|
43
|
+
schema: Type.Entity.Any;
|
|
43
44
|
kind: 'reference' | 'relation';
|
|
44
45
|
};
|
|
45
46
|
|
|
@@ -50,12 +51,9 @@ export type RelatedSchema = {
|
|
|
50
51
|
* @param schema
|
|
51
52
|
* @returns
|
|
52
53
|
*/
|
|
53
|
-
export const findRelatedSchema = async (
|
|
54
|
-
db: EchoDatabase,
|
|
55
|
-
anchor: Schema.Schema.AnyNoContext,
|
|
56
|
-
): Promise<RelatedSchema[]> => {
|
|
54
|
+
export const findRelatedSchema = async (db: Database.Database, anchor: Type.Entity.Any): Promise<RelatedSchema[]> => {
|
|
57
55
|
// TODO(dmaretskyi): Query stored schemas.
|
|
58
|
-
const allSchemas =
|
|
56
|
+
const allSchemas = await db.graph.schemaRegistry.query().run();
|
|
59
57
|
|
|
60
58
|
// TODO(dmaretskyi): Also do references.
|
|
61
59
|
return allSchemas
|
|
@@ -71,8 +69,8 @@ export const findRelatedSchema = async (
|
|
|
71
69
|
})
|
|
72
70
|
.map(
|
|
73
71
|
(schema): RelatedSchema => ({
|
|
74
|
-
schema,
|
|
75
72
|
kind: 'relation',
|
|
73
|
+
schema,
|
|
76
74
|
}),
|
|
77
75
|
);
|
|
78
76
|
};
|
|
@@ -81,7 +79,7 @@ export const findRelatedSchema = async (
|
|
|
81
79
|
* Non-strict DXN comparison.
|
|
82
80
|
* Returns true if the DXN could be resolved to the schema.
|
|
83
81
|
*/
|
|
84
|
-
const isSchemaAddressableByDxn = (schema:
|
|
82
|
+
const isSchemaAddressableByDxn = (schema: Type.Entity.Any, dxn: DXN): boolean => {
|
|
85
83
|
if (getTypeIdentifierAnnotation(schema) === dxn.toString()) {
|
|
86
84
|
return true;
|
|
87
85
|
}
|
|
@@ -108,13 +106,13 @@ export const LocalSearchToolkit = Toolkit.make(
|
|
|
108
106
|
},
|
|
109
107
|
success: Schema.Unknown,
|
|
110
108
|
failure: Schema.Never,
|
|
111
|
-
dependencies: [
|
|
109
|
+
dependencies: [Database.Service],
|
|
112
110
|
}),
|
|
113
111
|
);
|
|
114
112
|
|
|
115
113
|
export const LocalSearchHandler = LocalSearchToolkit.toLayer({
|
|
116
114
|
search_local_search: Effect.fn(function* ({ query }) {
|
|
117
|
-
const
|
|
115
|
+
const objects = yield* Database.Service.runQuery(Query.select(Filter.text(query, { type: 'vector' })));
|
|
118
116
|
const results = [...objects];
|
|
119
117
|
|
|
120
118
|
const option = yield* Effect.serviceOption(ContextQueueService);
|
|
@@ -138,21 +136,21 @@ export const LocalSearchHandler = LocalSearchToolkit.toLayer({
|
|
|
138
136
|
class GraphWriterSchema extends Context.Tag('@dxos/assistant/GraphWriterSchema')<
|
|
139
137
|
GraphWriterSchema,
|
|
140
138
|
{
|
|
141
|
-
schema:
|
|
139
|
+
schema: Type.Entity.Any[];
|
|
142
140
|
}
|
|
143
141
|
>() {}
|
|
144
142
|
|
|
145
143
|
/**
|
|
146
144
|
* Forms typed objects that can be written to the graph database.
|
|
147
145
|
*/
|
|
148
|
-
export const makeGraphWriterToolkit = ({ schema }: { schema:
|
|
146
|
+
export const makeGraphWriterToolkit = ({ schema }: { schema: Type.Entity.Any[] }) => {
|
|
149
147
|
return Toolkit.make(
|
|
150
148
|
Tool.make('graph_writer', {
|
|
151
149
|
description: 'Write to the local graph database',
|
|
152
150
|
parameters: createExtractionSchema(schema).fields,
|
|
153
151
|
success: Schema.Unknown,
|
|
154
152
|
failure: Schema.Never,
|
|
155
|
-
dependencies: [
|
|
153
|
+
dependencies: [Database.Service, ContextQueueService],
|
|
156
154
|
}).annotateContext(Context.make(GraphWriterSchema, { schema })),
|
|
157
155
|
);
|
|
158
156
|
};
|
|
@@ -172,10 +170,10 @@ export const makeGraphWriterHandler = (
|
|
|
172
170
|
|
|
173
171
|
return toolkit.toLayer({
|
|
174
172
|
graph_writer: Effect.fn(function* (input) {
|
|
175
|
-
const { db } = yield*
|
|
173
|
+
const { db } = yield* Database.Service;
|
|
176
174
|
const { queue } = yield* ContextQueueService;
|
|
177
175
|
const data = yield* Effect.promise(() => sanitizeObjects(schema, input as any, db, queue));
|
|
178
|
-
yield* Effect.promise(() => queue.append(data as Obj.
|
|
176
|
+
yield* Effect.promise(() => queue.append(data as Obj.Unknown[]));
|
|
179
177
|
|
|
180
178
|
const dxns = data.map((obj) => Obj.getDXN(obj));
|
|
181
179
|
onAppend?.(dxns);
|
|
@@ -187,7 +185,7 @@ export const makeGraphWriterHandler = (
|
|
|
187
185
|
/**
|
|
188
186
|
* Create a schema for structured data extraction.
|
|
189
187
|
*/
|
|
190
|
-
export const createExtractionSchema = (types:
|
|
188
|
+
export const createExtractionSchema = (types: Type.Entity.Any[]) => {
|
|
191
189
|
return Schema.Struct({
|
|
192
190
|
...Object.fromEntries(
|
|
193
191
|
types.map(preprocessSchema).map((schema, index) => [
|
|
@@ -200,18 +198,18 @@ export const createExtractionSchema = (types: Schema.Schema.AnyNoContext[]) => {
|
|
|
200
198
|
});
|
|
201
199
|
};
|
|
202
200
|
|
|
203
|
-
export const getSanitizedSchemaName = (schema:
|
|
201
|
+
export const getSanitizedSchemaName = (schema: Type.Entity.Any) => {
|
|
204
202
|
return Type.getDXN(schema)!
|
|
205
203
|
.asTypeDXN()!
|
|
206
204
|
.type.replaceAll(/[^a-zA-Z0-9]+/g, '_');
|
|
207
205
|
};
|
|
208
206
|
|
|
209
207
|
export const sanitizeObjects = async (
|
|
210
|
-
types:
|
|
208
|
+
types: Type.Entity.Any[],
|
|
211
209
|
data: Record<string, readonly unknown[]>,
|
|
212
|
-
db:
|
|
210
|
+
db: Database.Database,
|
|
213
211
|
queue?: Queue,
|
|
214
|
-
): Promise<Obj.
|
|
212
|
+
): Promise<Obj.Unknown[]> => {
|
|
215
213
|
const entries = types
|
|
216
214
|
.map(
|
|
217
215
|
(type) =>
|
|
@@ -292,7 +290,7 @@ export const sanitizeObjects = async (
|
|
|
292
290
|
.filter((object) => !existingIds.has(object.data.id)); // TODO(dmaretskyi): This dissallows updating existing objects.
|
|
293
291
|
|
|
294
292
|
// TODO(dmaretskyi): Use ref resolver.
|
|
295
|
-
const
|
|
293
|
+
const dbObjects = await db.query(Query.select(Filter.id(...existingIds))).run();
|
|
296
294
|
const queueObjects = (await queue?.getObjectsById([...existingIds])) ?? [];
|
|
297
295
|
const objects = [...dbObjects, ...queueObjects].filter(isNonNullable);
|
|
298
296
|
|
|
@@ -13,7 +13,7 @@ import * as Redacted from 'effect/Redacted';
|
|
|
13
13
|
import { AiService } from '@dxos/ai';
|
|
14
14
|
import { AiServiceTestingPreset, EXA_API_KEY } from '@dxos/ai/testing';
|
|
15
15
|
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
16
|
-
import { TestHelpers } from '@dxos/effect';
|
|
16
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
17
17
|
import { CredentialsService, FunctionInvocationService } from '@dxos/functions';
|
|
18
18
|
import { TracingServiceExt } from '@dxos/functions-runtime';
|
|
19
19
|
import {
|