@dxos/assistant 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +1983 -64
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1976 -63
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1984 -64
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/{src/bin → bin}/chat.d.ts.map +1 -1
- package/dist/types/src/blueprint/blueprint.d.ts +79 -0
- package/dist/types/src/blueprint/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprint/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprint/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprint/index.d.ts +4 -0
- package/dist/types/src/blueprint/index.d.ts.map +1 -0
- package/dist/types/src/blueprint/logger.d.ts +3 -0
- package/dist/types/src/blueprint/logger.d.ts.map +1 -0
- package/dist/types/src/{ai-service/parser.d.ts → blueprint/machine.d.ts} +46 -68
- package/dist/types/src/blueprint/machine.d.ts.map +1 -0
- package/dist/types/src/blueprint/test-data.d.ts +3 -0
- package/dist/types/src/blueprint/test-data.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +4 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +2 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts +2 -0
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +210 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +2 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts +3 -0
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts +14 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.test.d.ts +2 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction.d.ts +242 -0
- package/dist/types/src/extraction/extraction.d.ts.map +1 -0
- package/dist/types/src/extraction/index.d.ts +5 -0
- package/dist/types/src/extraction/index.d.ts.map +1 -0
- package/dist/types/src/extraction/quotes.d.ts +15 -0
- package/dist/types/src/extraction/quotes.d.ts.map +1 -0
- package/dist/types/src/extraction/quotes.test.d.ts +2 -0
- package/dist/types/src/extraction/quotes.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/research/exa.d.ts +7 -0
- package/dist/types/src/research/exa.d.ts.map +1 -0
- package/dist/types/src/research/graph.d.ts +39 -0
- package/dist/types/src/research/graph.d.ts.map +1 -0
- package/dist/types/src/research/graph.test.d.ts +2 -0
- package/dist/types/src/research/graph.test.d.ts.map +1 -0
- package/dist/types/src/research/index.d.ts +4 -0
- package/dist/types/src/research/index.d.ts.map +1 -0
- package/dist/types/src/research/research.d.ts +10 -0
- package/dist/types/src/research/research.d.ts.map +1 -0
- package/dist/types/src/research/research.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +0 -1
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +47 -22
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +3 -4
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/summarization/summarization.test.d.ts +2 -0
- package/dist/types/src/summarization/summarization.test.d.ts.map +1 -0
- package/dist/types/src/testing/exa-search-1748337321991.d.ts +38 -0
- package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +1 -0
- package/dist/types/src/testing/exa-search-1748337331526.d.ts +37 -0
- package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +1 -0
- package/dist/types/src/testing/exa-search-1748337344119.d.ts +58 -0
- package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -7
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +3 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/package.json +22 -38
- package/src/blueprint/blueprint.test.ts +142 -0
- package/src/blueprint/blueprint.ts +95 -0
- package/src/blueprint/index.ts +7 -0
- package/src/blueprint/logger.ts +66 -0
- package/src/blueprint/machine.ts +208 -0
- package/src/blueprint/test-data.ts +55 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +95 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +64 -0
- package/src/extraction/extraction-llm-function/index.ts +5 -0
- package/src/extraction/extraction-llm-function/instructions.tpl +28 -0
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +115 -0
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +54 -0
- package/src/extraction/extraction-ner-function/index.ts +6 -0
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +94 -0
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +97 -0
- package/src/extraction/extraction.ts +75 -0
- package/src/extraction/index.ts +8 -0
- package/src/extraction/quotes.test.ts +27 -0
- package/src/extraction/quotes.ts +57 -0
- package/src/index.ts +4 -4
- package/src/research/exa.ts +100 -0
- package/src/research/graph.test.ts +15 -0
- package/src/research/graph.ts +291 -0
- package/src/research/index.ts +7 -0
- package/src/research/instructions-research.tpl +97 -0
- package/src/research/research.test.ts +189 -0
- package/src/research/research.ts +89 -0
- package/src/session/index.ts +0 -1
- package/src/session/session.test.ts +7 -7
- package/src/session/session.ts +46 -19
- package/src/session/version-pin.ts +2 -3
- package/src/summarization/summarization.test.ts +216 -0
- package/src/testing/exa-search-1748337321991.ts +131 -0
- package/src/testing/exa-search-1748337331526.ts +144 -0
- package/src/testing/exa-search-1748337344119.ts +133 -0
- package/src/testing/index.ts +8 -8
- package/src/types.ts +8 -0
- package/src/typings.d.ts +8 -0
- package/dist/lib/browser/chunk-B4HAWUFW.mjs +0 -2786
- package/dist/lib/browser/chunk-B4HAWUFW.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -658
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/chunk-NOB7CIIC.cjs +0 -2791
- package/dist/lib/node/chunk-NOB7CIIC.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -672
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-SAWYU3V5.mjs +0 -2788
- package/dist/lib/node-esm/chunk-SAWYU3V5.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -659
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/ai-service/client.test.d.ts +0 -2
- package/dist/types/src/ai-service/client.test.d.ts.map +0 -1
- package/dist/types/src/ai-service/defs.d.ts +0 -9
- package/dist/types/src/ai-service/defs.d.ts.map +0 -1
- package/dist/types/src/ai-service/edge-client.d.ts +0 -18
- package/dist/types/src/ai-service/edge-client.d.ts.map +0 -1
- package/dist/types/src/ai-service/index.d.ts +0 -10
- package/dist/types/src/ai-service/index.d.ts.map +0 -1
- package/dist/types/src/ai-service/message-collector.d.ts +0 -82
- package/dist/types/src/ai-service/message-collector.d.ts.map +0 -1
- package/dist/types/src/ai-service/ollama-client.d.ts +0 -43
- package/dist/types/src/ai-service/ollama-client.d.ts.map +0 -1
- package/dist/types/src/ai-service/parser.d.ts.map +0 -1
- package/dist/types/src/ai-service/service.d.ts +0 -25
- package/dist/types/src/ai-service/service.d.ts.map +0 -1
- package/dist/types/src/ai-service/stream.d.ts +0 -40
- package/dist/types/src/ai-service/stream.d.ts.map +0 -1
- package/dist/types/src/ai-service/stream.test.d.ts +0 -2
- package/dist/types/src/ai-service/stream.test.d.ts.map +0 -1
- package/dist/types/src/ai-service/testing/index.d.ts +0 -3
- package/dist/types/src/ai-service/testing/index.d.ts.map +0 -1
- package/dist/types/src/ai-service/testing/mock.d.ts +0 -11
- package/dist/types/src/ai-service/testing/mock.d.ts.map +0 -1
- package/dist/types/src/ai-service/testing/test-stream.d.ts +0 -7
- package/dist/types/src/ai-service/testing/test-stream.d.ts.map +0 -1
- package/dist/types/src/ai-service/transform.d.ts +0 -27
- package/dist/types/src/ai-service/transform.d.ts.map +0 -1
- package/dist/types/src/ai-service/types.d.ts +0 -210
- package/dist/types/src/ai-service/types.d.ts.map +0 -1
- package/dist/types/src/ai-service/util/index.d.ts +0 -2
- package/dist/types/src/ai-service/util/index.d.ts.map +0 -1
- package/dist/types/src/ai-service/util/sse.d.ts +0 -39
- package/dist/types/src/ai-service/util/sse.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/conversation.d.ts +0 -61
- package/dist/types/src/experimental/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/conversation.test.d.ts +0 -2
- package/dist/types/src/experimental/conversation/conversation.test.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/index.d.ts +0 -2
- package/dist/types/src/experimental/conversation/index.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/types.d.ts +0 -78
- package/dist/types/src/experimental/conversation/types.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/ast.d.ts +0 -56
- package/dist/types/src/experimental/cypher/ast.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/combinators.d.ts +0 -14
- package/dist/types/src/experimental/cypher/combinators.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/combinators.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/combinators.test.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/echo-data-source.d.ts +0 -16
- package/dist/types/src/experimental/cypher/echo-data-source.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/execution-plan.d.ts +0 -49
- package/dist/types/src/experimental/cypher/execution-plan.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/execution-plan.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/execution-plan.test.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/index.d.ts +0 -5
- package/dist/types/src/experimental/cypher/index.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/parjs.d.ts +0 -4
- package/dist/types/src/experimental/cypher/parjs.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/parser.d.ts +0 -6
- package/dist/types/src/experimental/cypher/parser.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/query-executor.d.ts +0 -26
- package/dist/types/src/experimental/cypher/query-executor.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/query-executor.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/query-executor.test.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/schema.d.ts +0 -12
- package/dist/types/src/experimental/cypher/schema.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/schema.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/schema.test.d.ts.map +0 -1
- package/dist/types/src/experimental/index.d.ts +0 -3
- package/dist/types/src/experimental/index.d.ts.map +0 -1
- package/dist/types/src/experimental/ner/ner.test.d.ts +0 -2
- package/dist/types/src/experimental/ner/ner.test.d.ts.map +0 -1
- package/dist/types/src/experimental/research/exa.d.ts +0 -6
- package/dist/types/src/experimental/research/exa.d.ts.map +0 -1
- package/dist/types/src/experimental/research/research.test.d.ts.map +0 -1
- package/dist/types/src/session/tools.d.ts +0 -18
- package/dist/types/src/session/tools.d.ts.map +0 -1
- package/dist/types/src/testing/artifacts.test.d.ts +0 -1
- package/dist/types/src/testing/artifacts.test.d.ts.map +0 -1
- package/dist/types/src/testing/data.d.ts +0 -2
- package/dist/types/src/testing/data.d.ts.map +0 -1
- package/dist/types/src/testing/defs.d.ts +0 -5
- package/dist/types/src/testing/defs.d.ts.map +0 -1
- package/dist/types/src/testing/logger.d.ts +0 -12
- package/dist/types/src/testing/logger.d.ts.map +0 -1
- package/dist/types/src/testing/object-extraction.test.d.ts +0 -1
- package/dist/types/src/testing/object-extraction.test.d.ts.map +0 -1
- package/dist/types/src/testing/ollama.d.ts +0 -6
- package/dist/types/src/testing/ollama.d.ts.map +0 -1
- package/dist/types/src/testing/printer.d.ts +0 -6
- package/dist/types/src/testing/printer.d.ts.map +0 -1
- package/dist/types/src/testing/query-promts.d.ts +0 -5
- package/dist/types/src/testing/query-promts.d.ts.map +0 -1
- package/dist/types/src/testing/query.test.d.ts +0 -2
- package/dist/types/src/testing/query.test.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -29
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-schema.d.ts +0 -52
- package/dist/types/src/testing/test-schema.d.ts.map +0 -1
- package/dist/types/src/util/index.d.ts +0 -2
- package/dist/types/src/util/index.d.ts.map +0 -1
- package/dist/types/src/util/trim.d.ts +0 -5
- package/dist/types/src/util/trim.d.ts.map +0 -1
- package/src/ai-service/client.test.ts +0 -247
- package/src/ai-service/defs.ts +0 -39
- package/src/ai-service/edge-client.ts +0 -60
- package/src/ai-service/index.ts +0 -13
- package/src/ai-service/message-collector.ts +0 -84
- package/src/ai-service/ollama-client.ts +0 -506
- package/src/ai-service/parser.ts +0 -369
- package/src/ai-service/service.ts +0 -31
- package/src/ai-service/stream.test.ts +0 -125
- package/src/ai-service/stream.ts +0 -118
- package/src/ai-service/testing/index.ts +0 -6
- package/src/ai-service/testing/mock.ts +0 -30
- package/src/ai-service/testing/test-stream.ts +0 -93
- package/src/ai-service/transform.ts +0 -121
- package/src/ai-service/types.ts +0 -112
- package/src/ai-service/util/index.ts +0 -5
- package/src/ai-service/util/sse.ts +0 -341
- package/src/bin/chat.ts +0 -79
- package/src/experimental/conversation/conversation.test.ts +0 -73
- package/src/experimental/conversation/conversation.ts +0 -142
- package/src/experimental/conversation/index.ts +0 -5
- package/src/experimental/conversation/types.ts +0 -126
- package/src/experimental/cypher/ast.ts +0 -75
- package/src/experimental/cypher/combinators.test.ts +0 -137
- package/src/experimental/cypher/combinators.ts +0 -148
- package/src/experimental/cypher/echo-data-source.ts +0 -105
- package/src/experimental/cypher/execution-plan.test.ts +0 -44
- package/src/experimental/cypher/execution-plan.ts +0 -208
- package/src/experimental/cypher/index.ts +0 -8
- package/src/experimental/cypher/parjs-shims.d.ts +0 -10
- package/src/experimental/cypher/parjs.ts +0 -10
- package/src/experimental/cypher/parser.ts +0 -19
- package/src/experimental/cypher/query-executor.test.ts +0 -47
- package/src/experimental/cypher/query-executor.ts +0 -145
- package/src/experimental/cypher/schema.test.ts +0 -17
- package/src/experimental/cypher/schema.ts +0 -86
- package/src/experimental/index.ts +0 -6
- package/src/experimental/ner/ner.test.ts +0 -163
- package/src/experimental/research/exa.ts +0 -38
- package/src/experimental/research/instructions.tpl +0 -64
- package/src/experimental/research/research.test.ts +0 -263
- package/src/session/tools.ts +0 -117
- package/src/testing/artifacts.test.ts +0 -182
- package/src/testing/data.ts +0 -13
- package/src/testing/defs.ts +0 -9
- package/src/testing/logger.ts +0 -129
- package/src/testing/object-extraction.test.ts +0 -71
- package/src/testing/ollama.ts +0 -15
- package/src/testing/printer.ts +0 -41
- package/src/testing/query-promts.ts +0 -75
- package/src/testing/query.test.ts +0 -88
- package/src/testing/test-data.ts +0 -379
- package/src/testing/test-schema.ts +0 -79
- package/src/util/index.ts +0 -5
- package/src/util/trim.ts +0 -15
- package/vendor/parjs-browser.mjs +0 -4
- package/vendor/parjs-default.mjs +0 -8
- /package/dist/types/{src/bin → bin}/chat.d.ts +0 -0
- /package/dist/types/src/{experimental/research → research}/research.test.d.ts +0 -0
|
@@ -1,659 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_OLLAMA_MODEL,
|
|
4
|
-
OllamaClient,
|
|
5
|
-
executeQuery,
|
|
6
|
-
formatInferredRelationshipLabel,
|
|
7
|
-
formatJsonSchemaForLLM,
|
|
8
|
-
formatNodeLabel,
|
|
9
|
-
trim
|
|
10
|
-
} from "../chunk-SAWYU3V5.mjs";
|
|
11
|
-
|
|
12
|
-
// packages/experimental/assistant/src/testing/defs.ts
|
|
13
|
-
var AI_SERVICE_ENDPOINT = {
|
|
14
|
-
LOCAL: "http://localhost:8788",
|
|
15
|
-
REMOTE: "https://ai-service.dxos.workers.dev"
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// packages/experimental/assistant/src/testing/logger.ts
|
|
19
|
-
var createLogger = ({ stream, filter, onImage } = {}) => {
|
|
20
|
-
const images = {};
|
|
21
|
-
let currentText = "";
|
|
22
|
-
return (event) => {
|
|
23
|
-
if (typeof filter === "function" && !filter(event)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const printContentBlock = (content) => {
|
|
27
|
-
switch (content.type) {
|
|
28
|
-
case "text":
|
|
29
|
-
process.stdout.write(content.text);
|
|
30
|
-
break;
|
|
31
|
-
case "tool_use":
|
|
32
|
-
process.stdout.write(`\u2699\uFE0F [Tool Use] ${content.name}
|
|
33
|
-
`);
|
|
34
|
-
break;
|
|
35
|
-
case "image": {
|
|
36
|
-
if (content.id && content.source) {
|
|
37
|
-
images[content.id] = content.source;
|
|
38
|
-
}
|
|
39
|
-
process.stdout.write(`[Image id=${content.id} mediaType=${content.source?.mediaType}]`);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const onTextBlockPrinted = (text) => {
|
|
45
|
-
const imageMatch = text.match(/<image id="([^"]+)"(?:\s+prompt="([^"]+)")?\s*\/>/);
|
|
46
|
-
if (imageMatch && onImage && images[imageMatch[1]]) {
|
|
47
|
-
onImage({
|
|
48
|
-
id: imageMatch[1],
|
|
49
|
-
description: imageMatch[2],
|
|
50
|
-
source: images[imageMatch[1]]
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
if (stream) {
|
|
55
|
-
switch (event.type) {
|
|
56
|
-
case "message_start": {
|
|
57
|
-
process.stdout.write(`${event.message.role.toUpperCase()}
|
|
58
|
-
|
|
59
|
-
`);
|
|
60
|
-
for (const content of event.message.content) {
|
|
61
|
-
printContentBlock(content);
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case "content_block_start": {
|
|
66
|
-
currentText = "";
|
|
67
|
-
printContentBlock(event.content);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
case "content_block_delta": {
|
|
71
|
-
switch (event.delta.type) {
|
|
72
|
-
case "text_delta": {
|
|
73
|
-
currentText += event.delta.text;
|
|
74
|
-
process.stdout.write(event.delta.text);
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case "input_json_delta": {
|
|
78
|
-
process.stdout.write(event.delta.partial_json);
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
case "content_block_stop": {
|
|
85
|
-
process.stdout.write("\n");
|
|
86
|
-
onTextBlockPrinted(currentText);
|
|
87
|
-
currentText = "";
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
case "message_delta": {
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
case "message_stop": {
|
|
94
|
-
process.stdout.write("\n\n");
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
switch (event.type) {
|
|
100
|
-
case "message": {
|
|
101
|
-
if (!stream || event.message.role !== "assistant") {
|
|
102
|
-
process.stdout.write(`${event.message.role.toUpperCase()}
|
|
103
|
-
|
|
104
|
-
`);
|
|
105
|
-
for (const block of event.message.content) {
|
|
106
|
-
switch (block.type) {
|
|
107
|
-
case "text":
|
|
108
|
-
process.stdout.write(block.text + "\n");
|
|
109
|
-
onTextBlockPrinted(block.text);
|
|
110
|
-
break;
|
|
111
|
-
case "tool_use":
|
|
112
|
-
process.stdout.write(`\u2699\uFE0F [Tool Use] ${block.name}
|
|
113
|
-
`);
|
|
114
|
-
process.stdout.write(` ${JSON.stringify(block.input)}
|
|
115
|
-
`);
|
|
116
|
-
break;
|
|
117
|
-
case "tool_result":
|
|
118
|
-
if (block.isError) {
|
|
119
|
-
process.stdout.write("\u274C [Tool Error]\n");
|
|
120
|
-
process.stdout.write(block.content + "\n");
|
|
121
|
-
} else {
|
|
122
|
-
process.stdout.write("\u2705 [Tool Success]\n");
|
|
123
|
-
process.stdout.write(block.content + "\n");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
process.stdout.write("\n\n");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// packages/experimental/assistant/src/testing/ollama.ts
|
|
136
|
-
var createTestOllamaClient = (options) => {
|
|
137
|
-
return new OllamaClient({
|
|
138
|
-
tools: options?.tools,
|
|
139
|
-
overrides: {
|
|
140
|
-
model: DEFAULT_OLLAMA_MODEL,
|
|
141
|
-
temperature: 0
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// packages/experimental/assistant/src/testing/printer.ts
|
|
147
|
-
import { inspect } from "node:util";
|
|
148
|
-
var ConsolePrinter = class {
|
|
149
|
-
constructor() {
|
|
150
|
-
this.printMessage = (message) => {
|
|
151
|
-
console.log(`${message.role.toUpperCase()}
|
|
152
|
-
`);
|
|
153
|
-
for (const content of message.content) {
|
|
154
|
-
this.printContentBlock(content);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
this.printContentBlock = (content) => {
|
|
158
|
-
switch (content.type) {
|
|
159
|
-
case "text":
|
|
160
|
-
console.log(content.text);
|
|
161
|
-
break;
|
|
162
|
-
case "tool_use":
|
|
163
|
-
console.log(`\u2699\uFE0F [Tool Use] ${content.name} ${inspect(content.input, {
|
|
164
|
-
depth: null,
|
|
165
|
-
colors: true
|
|
166
|
-
})}`);
|
|
167
|
-
break;
|
|
168
|
-
case "tool_result": {
|
|
169
|
-
let data;
|
|
170
|
-
try {
|
|
171
|
-
data = JSON.parse(content.content);
|
|
172
|
-
} catch {
|
|
173
|
-
data = content.content;
|
|
174
|
-
}
|
|
175
|
-
console.log(`\u2699\uFE0F [Tool Result] ${content.toolUseId} ${inspect(data, {
|
|
176
|
-
depth: null,
|
|
177
|
-
colors: true
|
|
178
|
-
})}`);
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// packages/experimental/assistant/src/testing/query-promts.ts
|
|
187
|
-
import { Schema } from "effect";
|
|
188
|
-
import { defineTool, ToolResult } from "@dxos/artifact";
|
|
189
|
-
import { toJsonSchema } from "@dxos/echo-schema";
|
|
190
|
-
import { log } from "@dxos/log";
|
|
191
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/experimental/assistant/src/testing/query-promts.ts";
|
|
192
|
-
var createCypherTool = (dataSource, schemaTypes = []) => defineTool("dxos.org/echo", {
|
|
193
|
-
name: "query",
|
|
194
|
-
description: "Query the ECHO graph database in cypher query language. Returns data from the database." + (schemaTypes.length > 0 ? `
|
|
195
|
-
|
|
196
|
-
${createSystemPrompt(schemaTypes)}` : ""),
|
|
197
|
-
schema: Schema.Struct({
|
|
198
|
-
query: Schema.String.annotations({
|
|
199
|
-
description: `
|
|
200
|
-
A valid cypher query string to execute.
|
|
201
|
-
Query must have one MATCH clause.
|
|
202
|
-
Match clause can have multiple patterns but they must all be connected via a relationship chain.
|
|
203
|
-
Query might have zero or one WHERE clauses.
|
|
204
|
-
Query must have one RETURN clause.
|
|
205
|
-
RETURN clause can have multiple expressions separated by commas.
|
|
206
|
-
DISTINCT keyword is not allowed.
|
|
207
|
-
|
|
208
|
-
<example>
|
|
209
|
-
MATCH (n:Person) RETURN n.name
|
|
210
|
-
</example>
|
|
211
|
-
|
|
212
|
-
<example>
|
|
213
|
-
MATCH (s:Studio)-[:PRODUCED]->(m:Movie)-[:PRODUCED_IN]->(c:City {name: "Las Vegas"}) RETURN s
|
|
214
|
-
</example>
|
|
215
|
-
|
|
216
|
-
<example>
|
|
217
|
-
MATCH (a:Actor)-[:STARRED_IN]->(m:Movie)<-[:PRODUCED]-(s:Studio {name: "Cinema Pictures"}) WHERE m.name = "Once upon a time" RETURN m.name, a.name
|
|
218
|
-
</example>
|
|
219
|
-
`
|
|
220
|
-
})
|
|
221
|
-
}),
|
|
222
|
-
execute: async ({ query }) => {
|
|
223
|
-
try {
|
|
224
|
-
log("cypher query", {
|
|
225
|
-
query
|
|
226
|
-
}, {
|
|
227
|
-
F: __dxlog_file,
|
|
228
|
-
L: 47,
|
|
229
|
-
S: void 0,
|
|
230
|
-
C: (f, a) => f(...a)
|
|
231
|
-
});
|
|
232
|
-
const results = await executeQuery(dataSource, query);
|
|
233
|
-
log("query complete", {
|
|
234
|
-
results
|
|
235
|
-
}, {
|
|
236
|
-
F: __dxlog_file,
|
|
237
|
-
L: 49,
|
|
238
|
-
S: void 0,
|
|
239
|
-
C: (f, a) => f(...a)
|
|
240
|
-
});
|
|
241
|
-
return ToolResult.Success(results);
|
|
242
|
-
} catch (e) {
|
|
243
|
-
log.catch(e, void 0, {
|
|
244
|
-
F: __dxlog_file,
|
|
245
|
-
L: 52,
|
|
246
|
-
S: void 0,
|
|
247
|
-
C: (f, a) => f(...a)
|
|
248
|
-
});
|
|
249
|
-
return ToolResult.Error(e.message);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
var createSystemPrompt = (schemaTypes) => trim`
|
|
254
|
-
You have access to ECHO graph database. You can query the database to get data to satisfy user prompts.
|
|
255
|
-
|
|
256
|
-
Database schema is defined in pseud-cypher syntax. The schema is:
|
|
257
|
-
|
|
258
|
-
<schema>
|
|
259
|
-
${formatJsonSchemaForLLM(schemaTypes.map((schema) => toJsonSchema(schema)))}
|
|
260
|
-
<schema>
|
|
261
|
-
|
|
262
|
-
Before replying always think step-by-step on how to proceed.
|
|
263
|
-
Print your thoughts inside <cot> tags.
|
|
264
|
-
|
|
265
|
-
<example>
|
|
266
|
-
<cot>To answer the question I need to ...</cot>
|
|
267
|
-
</example>
|
|
268
|
-
|
|
269
|
-
Before answering the user's question, decide what tools you need to use to answer the question.
|
|
270
|
-
`;
|
|
271
|
-
|
|
272
|
-
// packages/experimental/assistant/src/testing/test-data.ts
|
|
273
|
-
import { raise } from "@dxos/debug";
|
|
274
|
-
import { JSON_SCHEMA_ECHO_REF_ID, ObjectId, toJsonSchema as toJsonSchema2, Ref as RefImpl } from "@dxos/echo-schema";
|
|
275
|
-
import { invariant } from "@dxos/invariant";
|
|
276
|
-
import { live } from "@dxos/live-object";
|
|
277
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/experimental/assistant/src/testing/test-data.ts";
|
|
278
|
-
var seedTestData = (db) => {
|
|
279
|
-
const contactRich = db.add(live(Contact, {
|
|
280
|
-
name: "Rich"
|
|
281
|
-
}));
|
|
282
|
-
const contactJosiah = db.add(live(Contact, {
|
|
283
|
-
name: "Josiah"
|
|
284
|
-
}));
|
|
285
|
-
const contactDima = db.add(live(Contact, {
|
|
286
|
-
name: "Dima"
|
|
287
|
-
}));
|
|
288
|
-
const contactFred = db.add(live(Contact, {
|
|
289
|
-
name: "Fred"
|
|
290
|
-
}));
|
|
291
|
-
const projectComposer = db.add(live(Project, {
|
|
292
|
-
name: "Composer"
|
|
293
|
-
}));
|
|
294
|
-
const projectEcho = db.add(live(Project, {
|
|
295
|
-
name: "ECHO"
|
|
296
|
-
}));
|
|
297
|
-
const projectDoodles = db.add(live(Project, {
|
|
298
|
-
name: "Doodles"
|
|
299
|
-
}));
|
|
300
|
-
const _taskComposer1 = db.add(live(Task, {
|
|
301
|
-
name: "Optimize startup performance",
|
|
302
|
-
project: RefImpl.make(projectComposer),
|
|
303
|
-
assignee: RefImpl.make(contactJosiah)
|
|
304
|
-
}));
|
|
305
|
-
const _taskComposer2 = db.add(live(Task, {
|
|
306
|
-
name: "Create form builder",
|
|
307
|
-
project: RefImpl.make(projectComposer),
|
|
308
|
-
assignee: RefImpl.make(contactRich)
|
|
309
|
-
}));
|
|
310
|
-
const _taskComposer3 = db.add(live(Task, {
|
|
311
|
-
name: "Add support for custom themes",
|
|
312
|
-
project: RefImpl.make(projectComposer),
|
|
313
|
-
assignee: RefImpl.make(contactJosiah)
|
|
314
|
-
}));
|
|
315
|
-
const _taskComposer5 = db.add(live(Task, {
|
|
316
|
-
name: "Implement community plugin",
|
|
317
|
-
project: RefImpl.make(projectComposer),
|
|
318
|
-
assignee: RefImpl.make(contactFred)
|
|
319
|
-
}));
|
|
320
|
-
const _taskComposer4 = db.add(live(Task, {
|
|
321
|
-
name: "Implement dark mode",
|
|
322
|
-
project: RefImpl.make(projectComposer),
|
|
323
|
-
assignee: RefImpl.make(contactRich)
|
|
324
|
-
}));
|
|
325
|
-
const _taskEcho1 = db.add(live(Task, {
|
|
326
|
-
name: "Implement cypher query engine",
|
|
327
|
-
project: RefImpl.make(projectEcho),
|
|
328
|
-
assignee: RefImpl.make(contactDima)
|
|
329
|
-
}));
|
|
330
|
-
const _taskEcho2 = db.add(live(Task, {
|
|
331
|
-
name: "Add schema editor",
|
|
332
|
-
project: RefImpl.make(projectEcho),
|
|
333
|
-
assignee: RefImpl.make(contactRich)
|
|
334
|
-
}));
|
|
335
|
-
const _taskDoodles1 = db.add(live(Task, {
|
|
336
|
-
name: "Add support for custom themes",
|
|
337
|
-
project: RefImpl.make(projectDoodles),
|
|
338
|
-
assignee: RefImpl.make(contactFred)
|
|
339
|
-
}));
|
|
340
|
-
const _taskDoodles2 = db.add(live(Task, {
|
|
341
|
-
name: "Implement dark mode",
|
|
342
|
-
project: RefImpl.make(projectDoodles),
|
|
343
|
-
assignee: RefImpl.make(contactJosiah)
|
|
344
|
-
}));
|
|
345
|
-
const _orgDxos = db.add(live(Organization, {
|
|
346
|
-
name: "DXOS",
|
|
347
|
-
employees: [
|
|
348
|
-
RefImpl.make(contactRich),
|
|
349
|
-
RefImpl.make(contactJosiah),
|
|
350
|
-
RefImpl.make(contactDima)
|
|
351
|
-
],
|
|
352
|
-
projects: [
|
|
353
|
-
RefImpl.make(projectEcho)
|
|
354
|
-
]
|
|
355
|
-
}));
|
|
356
|
-
const _orgBraneframe = db.add(live(Organization, {
|
|
357
|
-
name: "Braneframe",
|
|
358
|
-
employees: [
|
|
359
|
-
RefImpl.make(contactJosiah),
|
|
360
|
-
RefImpl.make(contactRich)
|
|
361
|
-
],
|
|
362
|
-
projects: [
|
|
363
|
-
RefImpl.make(projectComposer)
|
|
364
|
-
]
|
|
365
|
-
}));
|
|
366
|
-
};
|
|
367
|
-
var createTestData = () => {
|
|
368
|
-
const dataSource = new MockDataSource();
|
|
369
|
-
const contactRich = dataSource.add(Contact, {
|
|
370
|
-
id: ObjectId.random(),
|
|
371
|
-
name: "Rich"
|
|
372
|
-
});
|
|
373
|
-
const contactJosiah = dataSource.add(Contact, {
|
|
374
|
-
id: ObjectId.random(),
|
|
375
|
-
name: "Josiah"
|
|
376
|
-
});
|
|
377
|
-
const contactDima = dataSource.add(Contact, {
|
|
378
|
-
id: ObjectId.random(),
|
|
379
|
-
name: "Dima"
|
|
380
|
-
});
|
|
381
|
-
const contactFred = dataSource.add(Contact, {
|
|
382
|
-
id: ObjectId.random(),
|
|
383
|
-
name: "Fred"
|
|
384
|
-
});
|
|
385
|
-
const projectComposer = dataSource.add(Project, {
|
|
386
|
-
id: ObjectId.random(),
|
|
387
|
-
name: "Composer"
|
|
388
|
-
});
|
|
389
|
-
const projectEcho = dataSource.add(Project, {
|
|
390
|
-
id: ObjectId.random(),
|
|
391
|
-
name: "ECHO"
|
|
392
|
-
});
|
|
393
|
-
const projectDoodles = dataSource.add(Project, {
|
|
394
|
-
id: ObjectId.random(),
|
|
395
|
-
name: "Doodles"
|
|
396
|
-
});
|
|
397
|
-
const _taskComposer1 = dataSource.add(Task, {
|
|
398
|
-
id: ObjectId.random(),
|
|
399
|
-
name: "Optimize startup performance",
|
|
400
|
-
project: RefImpl.make(projectComposer),
|
|
401
|
-
assignee: RefImpl.make(contactJosiah)
|
|
402
|
-
});
|
|
403
|
-
const _taskComposer2 = dataSource.add(Task, {
|
|
404
|
-
id: ObjectId.random(),
|
|
405
|
-
name: "Create form builder",
|
|
406
|
-
project: RefImpl.make(projectComposer),
|
|
407
|
-
assignee: RefImpl.make(contactRich)
|
|
408
|
-
});
|
|
409
|
-
const _taskComposer3 = dataSource.add(Task, {
|
|
410
|
-
id: ObjectId.random(),
|
|
411
|
-
name: "Add support for custom themes",
|
|
412
|
-
project: RefImpl.make(projectComposer),
|
|
413
|
-
assignee: RefImpl.make(contactJosiah)
|
|
414
|
-
});
|
|
415
|
-
const _taskComposer5 = dataSource.add(Task, {
|
|
416
|
-
id: ObjectId.random(),
|
|
417
|
-
name: "Implement community plugin",
|
|
418
|
-
project: RefImpl.make(projectComposer),
|
|
419
|
-
assignee: RefImpl.make(contactFred)
|
|
420
|
-
});
|
|
421
|
-
const _taskComposer4 = dataSource.add(Task, {
|
|
422
|
-
id: ObjectId.random(),
|
|
423
|
-
name: "Implement dark mode",
|
|
424
|
-
project: RefImpl.make(projectComposer),
|
|
425
|
-
assignee: RefImpl.make(contactRich)
|
|
426
|
-
});
|
|
427
|
-
const _taskEcho1 = dataSource.add(Task, {
|
|
428
|
-
id: ObjectId.random(),
|
|
429
|
-
name: "Implement cypher query engine",
|
|
430
|
-
project: RefImpl.make(projectEcho),
|
|
431
|
-
assignee: RefImpl.make(contactDima)
|
|
432
|
-
});
|
|
433
|
-
const _taskEcho2 = dataSource.add(Task, {
|
|
434
|
-
id: ObjectId.random(),
|
|
435
|
-
name: "Add schema editor",
|
|
436
|
-
project: RefImpl.make(projectEcho),
|
|
437
|
-
assignee: RefImpl.make(contactRich)
|
|
438
|
-
});
|
|
439
|
-
const _taskDoodles1 = dataSource.add(Task, {
|
|
440
|
-
id: ObjectId.random(),
|
|
441
|
-
name: "Add support for custom themes",
|
|
442
|
-
project: RefImpl.make(projectDoodles),
|
|
443
|
-
assignee: RefImpl.make(contactFred)
|
|
444
|
-
});
|
|
445
|
-
const _taskDoodles2 = dataSource.add(Task, {
|
|
446
|
-
id: ObjectId.random(),
|
|
447
|
-
name: "Implement dark mode",
|
|
448
|
-
project: RefImpl.make(projectDoodles),
|
|
449
|
-
assignee: RefImpl.make(contactJosiah)
|
|
450
|
-
});
|
|
451
|
-
const _orgDxos = dataSource.add(Organization, {
|
|
452
|
-
id: ObjectId.random(),
|
|
453
|
-
name: "DXOS",
|
|
454
|
-
employees: [
|
|
455
|
-
RefImpl.make(contactRich),
|
|
456
|
-
RefImpl.make(contactJosiah),
|
|
457
|
-
RefImpl.make(contactDima)
|
|
458
|
-
],
|
|
459
|
-
projects: [
|
|
460
|
-
RefImpl.make(projectEcho)
|
|
461
|
-
]
|
|
462
|
-
});
|
|
463
|
-
const _orgBraneframe = dataSource.add(Organization, {
|
|
464
|
-
id: ObjectId.random(),
|
|
465
|
-
name: "Braneframe",
|
|
466
|
-
employees: [
|
|
467
|
-
RefImpl.make(contactJosiah),
|
|
468
|
-
RefImpl.make(contactRich)
|
|
469
|
-
],
|
|
470
|
-
projects: [
|
|
471
|
-
RefImpl.make(projectComposer)
|
|
472
|
-
]
|
|
473
|
-
});
|
|
474
|
-
dataSource.computeGraph();
|
|
475
|
-
return dataSource;
|
|
476
|
-
};
|
|
477
|
-
var MockDataSource = class {
|
|
478
|
-
constructor() {
|
|
479
|
-
this.objects = {};
|
|
480
|
-
this.schema = {};
|
|
481
|
-
this.nodes = [];
|
|
482
|
-
this.relationships = [];
|
|
483
|
-
}
|
|
484
|
-
async getNodes({ label }) {
|
|
485
|
-
return this.nodes.filter((node) => !label || node.label === label);
|
|
486
|
-
}
|
|
487
|
-
async getRelationships({ label }) {
|
|
488
|
-
return this.relationships.filter((relationship) => !label || relationship.label === label);
|
|
489
|
-
}
|
|
490
|
-
add(schema, data) {
|
|
491
|
-
invariant(typeof data.id === "string", "Data must have an id", {
|
|
492
|
-
F: __dxlog_file2,
|
|
493
|
-
L: 284,
|
|
494
|
-
S: this,
|
|
495
|
-
A: [
|
|
496
|
-
"typeof data.id === 'string'",
|
|
497
|
-
"'Data must have an id'"
|
|
498
|
-
]
|
|
499
|
-
});
|
|
500
|
-
const jsonSchema = toJsonSchema2(schema);
|
|
501
|
-
if (!this.schema[jsonSchema.$id]) {
|
|
502
|
-
this.schema[jsonSchema.$id] = {
|
|
503
|
-
json: jsonSchema,
|
|
504
|
-
instance: schema
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
const typenameDxn = jsonSchema.$id ?? raise(new Error("Schema must have $id"));
|
|
508
|
-
this.objects[data.id] = {
|
|
509
|
-
schema,
|
|
510
|
-
id: data.id,
|
|
511
|
-
typeDxn: typenameDxn,
|
|
512
|
-
data
|
|
513
|
-
};
|
|
514
|
-
return data;
|
|
515
|
-
}
|
|
516
|
-
computeGraph() {
|
|
517
|
-
this.nodes = [];
|
|
518
|
-
this.relationships = [];
|
|
519
|
-
for (const object of Object.values(this.objects)) {
|
|
520
|
-
this.nodes.push({
|
|
521
|
-
kind: "node",
|
|
522
|
-
id: object.id,
|
|
523
|
-
label: formatNodeLabel(object.typeDxn),
|
|
524
|
-
properties: object.data
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
for (const object of Object.values(this.objects)) {
|
|
528
|
-
const schema = this.schema[object.typeDxn].json;
|
|
529
|
-
const typenameDxn = schema.$id ?? raise(new Error("Schema must have $id"));
|
|
530
|
-
for (const [name, propSchema] of Object.entries(schema.properties)) {
|
|
531
|
-
if (propSchema.$id === JSON_SCHEMA_ECHO_REF_ID) {
|
|
532
|
-
const label = formatInferredRelationshipLabel(typenameDxn, name);
|
|
533
|
-
const source = this.nodes.find((node) => node.id === object.id);
|
|
534
|
-
if (!source) {
|
|
535
|
-
continue;
|
|
536
|
-
}
|
|
537
|
-
const { id: targetId } = object.data[name].target;
|
|
538
|
-
const target = this.nodes.find((node) => node.id === targetId);
|
|
539
|
-
if (!target) {
|
|
540
|
-
continue;
|
|
541
|
-
}
|
|
542
|
-
this.relationships.push({
|
|
543
|
-
kind: "relationship",
|
|
544
|
-
id: `${object.id}-${name}-${target.id}`,
|
|
545
|
-
label,
|
|
546
|
-
properties: {},
|
|
547
|
-
source,
|
|
548
|
-
target
|
|
549
|
-
});
|
|
550
|
-
} else if (propSchema.type === "array" && propSchema.items && typeof propSchema.items === "object" && "$id" in propSchema.items && propSchema.items.$id === JSON_SCHEMA_ECHO_REF_ID) {
|
|
551
|
-
const label = formatInferredRelationshipLabel(typenameDxn, name);
|
|
552
|
-
const source = this.nodes.find((node) => node.id === object.id);
|
|
553
|
-
if (!source) {
|
|
554
|
-
continue;
|
|
555
|
-
}
|
|
556
|
-
for (const { id: targetId } of object.data[name].map((x) => x.target)) {
|
|
557
|
-
const target = this.nodes.find((node) => node.id === targetId);
|
|
558
|
-
if (!target) {
|
|
559
|
-
continue;
|
|
560
|
-
}
|
|
561
|
-
this.relationships.push({
|
|
562
|
-
kind: "relationship",
|
|
563
|
-
id: `${object.id}-${name}-${targetId}`,
|
|
564
|
-
label,
|
|
565
|
-
properties: {},
|
|
566
|
-
source,
|
|
567
|
-
target
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
// packages/experimental/assistant/src/testing/test-schema.ts
|
|
577
|
-
import { Schema as Schema2 } from "effect";
|
|
578
|
-
import { EntityKind, TypeAnnotationId, Ref, ObjectId as ObjectId2 } from "@dxos/echo-schema";
|
|
579
|
-
var Contact = Schema2.Struct({
|
|
580
|
-
id: ObjectId2,
|
|
581
|
-
name: Schema2.String.annotations({
|
|
582
|
-
description: "The name of the person."
|
|
583
|
-
}),
|
|
584
|
-
email: Schema2.optional(Schema2.String).annotations({
|
|
585
|
-
description: "Email address."
|
|
586
|
-
})
|
|
587
|
-
}).pipe(Schema2.mutable).annotations({
|
|
588
|
-
[TypeAnnotationId]: {
|
|
589
|
-
kind: EntityKind.Object,
|
|
590
|
-
typename: "example.com/type/Contact",
|
|
591
|
-
version: "0.1.0"
|
|
592
|
-
},
|
|
593
|
-
description: "Contact information."
|
|
594
|
-
});
|
|
595
|
-
var Project = Schema2.Struct({
|
|
596
|
-
id: ObjectId2,
|
|
597
|
-
name: Schema2.String.annotations({
|
|
598
|
-
description: "The name of the project."
|
|
599
|
-
}),
|
|
600
|
-
description: Schema2.optional(Schema2.String).annotations({
|
|
601
|
-
description: "The description of the project."
|
|
602
|
-
})
|
|
603
|
-
}).pipe(Schema2.mutable).annotations({
|
|
604
|
-
[TypeAnnotationId]: {
|
|
605
|
-
kind: EntityKind.Object,
|
|
606
|
-
typename: "example.com/type/Project",
|
|
607
|
-
version: "0.1.0"
|
|
608
|
-
},
|
|
609
|
-
description: "Contact information."
|
|
610
|
-
});
|
|
611
|
-
var Task = Schema2.Struct({
|
|
612
|
-
id: ObjectId2,
|
|
613
|
-
name: Schema2.String.annotations({
|
|
614
|
-
description: "The name of the task."
|
|
615
|
-
}),
|
|
616
|
-
description: Schema2.optional(Schema2.String).annotations({
|
|
617
|
-
description: "The description of the task."
|
|
618
|
-
}),
|
|
619
|
-
project: Ref(Project),
|
|
620
|
-
assignee: Ref(Contact)
|
|
621
|
-
}).pipe(Schema2.mutable).annotations({
|
|
622
|
-
[TypeAnnotationId]: {
|
|
623
|
-
kind: EntityKind.Object,
|
|
624
|
-
typename: "example.com/type/Task",
|
|
625
|
-
version: "0.1.0"
|
|
626
|
-
},
|
|
627
|
-
description: "Contact information."
|
|
628
|
-
});
|
|
629
|
-
var Organization = Schema2.Struct({
|
|
630
|
-
id: ObjectId2,
|
|
631
|
-
name: Schema2.String.annotations({
|
|
632
|
-
description: "The name of the organization."
|
|
633
|
-
}),
|
|
634
|
-
projects: Schema2.Array(Ref(Project)),
|
|
635
|
-
employees: Schema2.Array(Ref(Contact))
|
|
636
|
-
}).pipe(Schema2.mutable).annotations({
|
|
637
|
-
[TypeAnnotationId]: {
|
|
638
|
-
kind: EntityKind.Object,
|
|
639
|
-
typename: "example.com/type/Organization",
|
|
640
|
-
version: "0.1.0"
|
|
641
|
-
},
|
|
642
|
-
description: "Contact information."
|
|
643
|
-
});
|
|
644
|
-
export {
|
|
645
|
-
AI_SERVICE_ENDPOINT,
|
|
646
|
-
ConsolePrinter,
|
|
647
|
-
Contact,
|
|
648
|
-
MockDataSource,
|
|
649
|
-
Organization,
|
|
650
|
-
Project,
|
|
651
|
-
Task,
|
|
652
|
-
createCypherTool,
|
|
653
|
-
createLogger,
|
|
654
|
-
createSystemPrompt,
|
|
655
|
-
createTestData,
|
|
656
|
-
createTestOllamaClient,
|
|
657
|
-
seedTestData
|
|
658
|
-
};
|
|
659
|
-
//# sourceMappingURL=index.mjs.map
|