@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,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/defs.ts", "../../../../src/testing/logger.ts", "../../../../src/testing/ollama.ts", "../../../../src/testing/printer.ts", "../../../../src/testing/query-promts.ts", "../../../../src/testing/test-data.ts", "../../../../src/testing/test-schema.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(burdon): Remove/Reconcile with @dxos/assistant-testing.\nexport const AI_SERVICE_ENDPOINT = {\n LOCAL: 'http://localhost:8788',\n REMOTE: 'https://ai-service.dxos.workers.dev',\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { ImageSource, MessageContentBlock } from '@dxos/artifact';\n\nimport type { ConversationEvent } from '../experimental';\n\nexport const createLogger = ({\n stream,\n filter,\n onImage,\n}: {\n stream?: boolean;\n filter?: (event: ConversationEvent) => boolean;\n onImage?: (img: { id: string; description?: string; source: ImageSource }) => void;\n} = {}) => {\n const images: Record<string, any> = {};\n let currentText = '';\n\n return (event: ConversationEvent) => {\n if (typeof filter === 'function' && !filter(event)) {\n return;\n }\n\n const printContentBlock = (content: MessageContentBlock) => {\n switch (content.type) {\n case 'text':\n process.stdout.write(content.text);\n break;\n case 'tool_use':\n process.stdout.write(`⚙️ [Tool Use] ${content.name}\\n`);\n break;\n case 'image': {\n if (content.id && content.source) {\n images[content.id] = content.source;\n }\n process.stdout.write(`[Image id=${content.id} mediaType=${content.source?.mediaType}]`);\n break;\n }\n }\n };\n\n const onTextBlockPrinted = (text: string) => {\n const imageMatch = text.match(/<image id=\"([^\"]+)\"(?:\\s+prompt=\"([^\"]+)\")?\\s*\\/>/);\n if (imageMatch && onImage && images[imageMatch[1]]) {\n onImage({\n id: imageMatch[1],\n description: imageMatch[2], // Extract prompt as description if present\n source: images[imageMatch[1]],\n });\n }\n };\n\n if (stream) {\n switch (event.type) {\n case 'message_start': {\n process.stdout.write(`${event.message.role.toUpperCase()}\\n\\n`);\n for (const content of event.message.content) {\n printContentBlock(content);\n }\n break;\n }\n case 'content_block_start': {\n currentText = '';\n printContentBlock(event.content);\n break;\n }\n case 'content_block_delta': {\n switch (event.delta.type) {\n case 'text_delta': {\n currentText += event.delta.text;\n process.stdout.write(event.delta.text);\n break;\n }\n case 'input_json_delta': {\n process.stdout.write(event.delta.partial_json);\n break;\n }\n }\n break;\n }\n case 'content_block_stop': {\n process.stdout.write('\\n');\n onTextBlockPrinted(currentText);\n currentText = '';\n break;\n }\n case 'message_delta': {\n break;\n }\n case 'message_stop': {\n process.stdout.write('\\n\\n');\n break;\n }\n }\n }\n\n switch (event.type) {\n case 'message': {\n if (!stream || event.message.role !== 'assistant') {\n process.stdout.write(`${event.message.role.toUpperCase()}\\n\\n`);\n for (const block of event.message.content) {\n switch (block.type) {\n case 'text':\n process.stdout.write(block.text + '\\n');\n onTextBlockPrinted(block.text);\n break;\n case 'tool_use':\n process.stdout.write(`⚙️ [Tool Use] ${block.name}\\n`);\n process.stdout.write(` ${JSON.stringify(block.input)}\\n`);\n break;\n case 'tool_result':\n if (block.isError) {\n process.stdout.write('❌ [Tool Error]\\n');\n process.stdout.write(block.content + '\\n');\n } else {\n process.stdout.write('✅ [Tool Success]\\n');\n process.stdout.write(block.content + '\\n');\n }\n }\n process.stdout.write('\\n\\n');\n }\n }\n break;\n }\n }\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { DEFAULT_OLLAMA_MODEL, OllamaClient, type OllamaClientParams } from '../ai-service';\n\n/**\n * Create a test client with small local model and no temperature for predictable results.\n */\nexport const createTestOllamaClient = (options?: Pick<OllamaClientParams, 'tools'>) => {\n return new OllamaClient({\n tools: options?.tools,\n overrides: { model: DEFAULT_OLLAMA_MODEL, temperature: 0 },\n });\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nimport type { Message, MessageContentBlock } from '@dxos/artifact';\n\nexport class ConsolePrinter {\n printMessage = (message: Message) => {\n // eslint-disable-next-line no-console\n console.log(`${message.role.toUpperCase()}\\n`);\n for (const content of message.content) {\n this.printContentBlock(content);\n }\n };\n\n printContentBlock = (content: MessageContentBlock) => {\n switch (content.type) {\n case 'text':\n // eslint-disable-next-line no-console\n console.log(content.text);\n break;\n case 'tool_use':\n // eslint-disable-next-line no-console\n console.log(`⚙️ [Tool Use] ${content.name} ${inspect(content.input, { depth: null, colors: true })}`);\n break;\n case 'tool_result': {\n let data: any;\n try {\n data = JSON.parse(content.content);\n } catch {\n data = content.content;\n }\n // eslint-disable-next-line no-console\n console.log(`⚙️ [Tool Result] ${content.toolUseId} ${inspect(data, { depth: null, colors: true })}`);\n break;\n }\n }\n };\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { defineTool, ToolResult } from '@dxos/artifact';\nimport { toJsonSchema } from '@dxos/echo-schema';\nimport { log } from '@dxos/log';\n\nimport { executeQuery, formatJsonSchemaForLLM, type DataSource } from '../experimental';\nimport { trim } from '../util';\n\nexport const createCypherTool = (dataSource: DataSource, schemaTypes: Schema.Schema.Any[] = []) =>\n defineTool('dxos.org/echo', {\n name: 'query',\n description:\n 'Query the ECHO graph database in cypher query language. Returns data from the database.' +\n (schemaTypes.length > 0 ? `\\n\\n${createSystemPrompt(schemaTypes)}` : ''),\n schema: Schema.Struct({\n query: Schema.String.annotations({\n description: `\n A valid cypher query string to execute.\n Query must have one MATCH clause.\n Match clause can have multiple patterns but they must all be connected via a relationship chain.\n Query might have zero or one WHERE clauses.\n Query must have one RETURN clause.\n RETURN clause can have multiple expressions separated by commas.\n DISTINCT keyword is not allowed.\n\n <example>\n MATCH (n:Person) RETURN n.name\n </example>\n\n <example>\n MATCH (s:Studio)-[:PRODUCED]->(m:Movie)-[:PRODUCED_IN]->(c:City {name: \"Las Vegas\"}) RETURN s\n </example>\n \n <example>\n 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\n </example>\n `,\n }),\n }),\n execute: async ({ query }) => {\n try {\n log('cypher query', { query });\n const results = await executeQuery(dataSource, query);\n log('query complete', { results });\n return ToolResult.Success(results);\n } catch (e: any) {\n log.catch(e);\n return ToolResult.Error(e.message);\n }\n },\n });\n\nexport const createSystemPrompt = (schemaTypes: Schema.Schema.Any[]) => trim`\n You have access to ECHO graph database. You can query the database to get data to satisfy user prompts.\n\n Database schema is defined in pseud-cypher syntax. The schema is:\n\n <schema>\n ${formatJsonSchemaForLLM(schemaTypes.map((schema) => toJsonSchema(schema)))}\n <schema>\n\n Before replying always think step-by-step on how to proceed.\n Print your thoughts inside <cot> tags.\n \n <example>\n <cot>To answer the question I need to ...</cot>\n </example>\n\n Before answering the user's question, decide what tools you need to use to answer the question.\n`;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Schema } from 'effect';\n\nimport { raise } from '@dxos/debug';\nimport type { EchoDatabase } from '@dxos/echo-db';\nimport {\n JSON_SCHEMA_ECHO_REF_ID,\n ObjectId,\n toJsonSchema,\n type JsonSchemaType,\n type Ref,\n Ref as RefImpl,\n} from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { live } from '@dxos/live-object';\n\nimport {\n type DataSource,\n type Node,\n type Relationship,\n formatInferredRelationshipLabel,\n formatNodeLabel,\n} from '../experimental';\nimport { Contact, Organization, Project, Task } from '../testing';\n\nexport const seedTestData = (db: EchoDatabase) => {\n const contactRich = db.add(\n live(Contact, {\n name: 'Rich',\n }),\n );\n const contactJosiah = db.add(\n live(Contact, {\n name: 'Josiah',\n }),\n );\n const contactDima = db.add(\n live(Contact, {\n name: 'Dima',\n }),\n );\n const contactFred = db.add(\n live(Contact, {\n name: 'Fred',\n }),\n );\n\n const projectComposer = db.add(\n live(Project, {\n name: 'Composer',\n }),\n );\n const projectEcho = db.add(\n live(Project, {\n name: 'ECHO',\n }),\n );\n const projectDoodles = db.add(\n live(Project, {\n name: 'Doodles',\n }),\n );\n\n const _taskComposer1 = db.add(\n live(Task, {\n name: 'Optimize startup performance',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactJosiah),\n }),\n );\n const _taskComposer2 = db.add(\n live(Task, {\n name: 'Create form builder',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactRich),\n }),\n );\n const _taskComposer3 = db.add(\n live(Task, {\n name: 'Add support for custom themes',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactJosiah),\n }),\n );\n const _taskComposer5 = db.add(\n live(Task, {\n name: 'Implement community plugin',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactFred),\n }),\n );\n const _taskComposer4 = db.add(\n live(Task, {\n name: 'Implement dark mode',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactRich),\n }),\n );\n const _taskEcho1 = db.add(\n live(Task, {\n name: 'Implement cypher query engine',\n project: RefImpl.make(projectEcho),\n assignee: RefImpl.make(contactDima),\n }),\n );\n const _taskEcho2 = db.add(\n live(Task, {\n name: 'Add schema editor',\n project: RefImpl.make(projectEcho),\n assignee: RefImpl.make(contactRich),\n }),\n );\n const _taskDoodles1 = db.add(\n live(Task, {\n name: 'Add support for custom themes',\n project: RefImpl.make(projectDoodles),\n assignee: RefImpl.make(contactFred),\n }),\n );\n const _taskDoodles2 = db.add(\n live(Task, {\n name: 'Implement dark mode',\n project: RefImpl.make(projectDoodles),\n assignee: RefImpl.make(contactJosiah),\n }),\n );\n\n const _orgDxos = db.add(\n live(Organization, {\n name: 'DXOS',\n employees: [RefImpl.make(contactRich), RefImpl.make(contactJosiah), RefImpl.make(contactDima)],\n projects: [RefImpl.make(projectEcho)],\n }),\n );\n const _orgBraneframe = db.add(\n live(Organization, {\n name: 'Braneframe',\n employees: [RefImpl.make(contactJosiah), RefImpl.make(contactRich)],\n projects: [RefImpl.make(projectComposer)],\n }),\n );\n};\n\n// TODO(burdon): Use schema/testing.\nexport const createTestData = (): MockDataSource => {\n const dataSource = new MockDataSource();\n\n const contactRich = dataSource.add(Contact, {\n id: ObjectId.random(),\n name: 'Rich',\n });\n const contactJosiah = dataSource.add(Contact, {\n id: ObjectId.random(),\n name: 'Josiah',\n });\n const contactDima = dataSource.add(Contact, {\n id: ObjectId.random(),\n name: 'Dima',\n });\n const contactFred = dataSource.add(Contact, {\n id: ObjectId.random(),\n name: 'Fred',\n });\n\n const projectComposer = dataSource.add(Project, {\n id: ObjectId.random(),\n name: 'Composer',\n });\n const projectEcho = dataSource.add(Project, {\n id: ObjectId.random(),\n name: 'ECHO',\n });\n const projectDoodles = dataSource.add(Project, {\n id: ObjectId.random(),\n name: 'Doodles',\n });\n\n const _taskComposer1 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Optimize startup performance',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactJosiah),\n });\n const _taskComposer2 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Create form builder',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactRich),\n });\n const _taskComposer3 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Add support for custom themes',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactJosiah),\n });\n const _taskComposer5 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement community plugin',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactFred),\n });\n const _taskComposer4 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement dark mode',\n project: RefImpl.make(projectComposer),\n assignee: RefImpl.make(contactRich),\n });\n const _taskEcho1 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement cypher query engine',\n project: RefImpl.make(projectEcho),\n assignee: RefImpl.make(contactDima),\n });\n const _taskEcho2 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Add schema editor',\n project: RefImpl.make(projectEcho),\n assignee: RefImpl.make(contactRich),\n });\n const _taskDoodles1 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Add support for custom themes',\n project: RefImpl.make(projectDoodles),\n assignee: RefImpl.make(contactFred),\n });\n const _taskDoodles2 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement dark mode',\n project: RefImpl.make(projectDoodles),\n assignee: RefImpl.make(contactJosiah),\n });\n\n const _orgDxos = dataSource.add(Organization, {\n id: ObjectId.random(),\n name: 'DXOS',\n employees: [RefImpl.make(contactRich), RefImpl.make(contactJosiah), RefImpl.make(contactDima)],\n projects: [RefImpl.make(projectEcho)],\n });\n const _orgBraneframe = dataSource.add(Organization, {\n id: ObjectId.random(),\n name: 'Braneframe',\n employees: [RefImpl.make(contactJosiah), RefImpl.make(contactRich)],\n projects: [RefImpl.make(projectComposer)],\n });\n dataSource.computeGraph();\n\n return dataSource;\n};\n\nexport class MockDataSource implements DataSource {\n objects: Record<\n string,\n {\n schema: Schema.Schema.All;\n typeDxn: string;\n id: string;\n data: unknown;\n }\n > = {};\n\n schema: Record<\n string,\n {\n json: JsonSchemaType;\n instance: Schema.Schema.All;\n }\n > = {};\n\n nodes: Node[] = [];\n relationships: Relationship[] = [];\n\n async getNodes({ label }: { label?: string }) {\n return this.nodes.filter((node) => !label || node.label === label);\n }\n\n async getRelationships({ label }: { label?: string }) {\n return this.relationships.filter((relationship) => !label || relationship.label === label);\n }\n\n add<S extends Schema.Schema.All>(schema: S, data: Schema.Schema.Type<S>) {\n invariant(typeof data.id === 'string', 'Data must have an id');\n const jsonSchema = toJsonSchema(schema);\n if (!this.schema[jsonSchema.$id!]) {\n this.schema[jsonSchema.$id!] = {\n json: jsonSchema,\n instance: schema,\n };\n }\n\n const typenameDxn = jsonSchema.$id ?? raise(new Error('Schema must have $id'));\n\n this.objects[data.id] = {\n schema,\n id: data.id,\n typeDxn: typenameDxn,\n data,\n };\n\n return data;\n }\n\n computeGraph() {\n this.nodes = [];\n this.relationships = [];\n\n for (const object of Object.values(this.objects)) {\n this.nodes.push({\n kind: 'node',\n id: object.id,\n label: formatNodeLabel(object.typeDxn),\n properties: object.data as any,\n });\n }\n\n for (const object of Object.values(this.objects)) {\n const schema = this.schema[object.typeDxn].json;\n const typenameDxn = schema.$id ?? raise(new Error('Schema must have $id'));\n\n for (const [name, propSchema] of Object.entries(schema.properties!)) {\n if (propSchema.$id === JSON_SCHEMA_ECHO_REF_ID) {\n const label = formatInferredRelationshipLabel(typenameDxn, name);\n\n const source = this.nodes.find((node) => node.id === object.id);\n if (!source) {\n continue;\n }\n\n const { id: targetId } = (object.data as any)[name].target;\n\n const target = this.nodes.find((node) => node.id === targetId);\n if (!target) {\n continue;\n }\n\n this.relationships.push({\n kind: 'relationship',\n id: `${object.id}-${name}-${target.id}`,\n label,\n properties: {},\n source,\n target,\n });\n } else if (\n propSchema.type === 'array' &&\n propSchema.items &&\n typeof propSchema.items === 'object' &&\n '$id' in propSchema.items &&\n propSchema.items.$id === JSON_SCHEMA_ECHO_REF_ID\n ) {\n const label = formatInferredRelationshipLabel(typenameDxn, name);\n\n const source = this.nodes.find((node) => node.id === object.id);\n if (!source) {\n continue;\n }\n\n for (const { id: targetId } of (object.data as any)[name].map((x: Ref<any>) => x.target)) {\n const target = this.nodes.find((node) => node.id === targetId);\n if (!target) {\n continue;\n }\n\n this.relationships.push({\n kind: 'relationship',\n id: `${object.id}-${name}-${targetId}`,\n label,\n properties: {},\n source,\n target,\n });\n }\n }\n }\n }\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { EntityKind, TypeAnnotationId, Ref, ObjectId } from '@dxos/echo-schema';\n\n// TODO(burdon): Remove (use @dxos/schema DataType).\n\n/** @deprecated */\nexport const Contact = Schema.Struct({\n id: ObjectId,\n name: Schema.String.annotations({ description: 'The name of the person.' }),\n email: Schema.optional(Schema.String).annotations({ description: 'Email address.' }),\n})\n .pipe(Schema.mutable)\n .annotations({\n [TypeAnnotationId]: {\n kind: EntityKind.Object,\n typename: 'example.com/type/Contact',\n version: '0.1.0',\n },\n description: 'Contact information.',\n });\nexport interface Contact extends Schema.Schema.Type<typeof Contact> {}\n\n/** @deprecated */\nexport const Project = Schema.Struct({\n id: ObjectId,\n name: Schema.String.annotations({ description: 'The name of the project.' }),\n description: Schema.optional(Schema.String).annotations({ description: 'The description of the project.' }),\n})\n .pipe(Schema.mutable)\n .annotations({\n [TypeAnnotationId]: {\n kind: EntityKind.Object,\n typename: 'example.com/type/Project',\n version: '0.1.0',\n },\n description: 'Contact information.',\n });\nexport interface Project extends Schema.Schema.Type<typeof Project> {}\n\nexport const Task = Schema.Struct({\n id: ObjectId,\n name: Schema.String.annotations({ description: 'The name of the task.' }),\n description: Schema.optional(Schema.String).annotations({ description: 'The description of the task.' }),\n project: Ref(Project),\n assignee: Ref(Contact),\n})\n .pipe(Schema.mutable)\n .annotations({\n [TypeAnnotationId]: {\n kind: EntityKind.Object,\n typename: 'example.com/type/Task',\n version: '0.1.0',\n },\n description: 'Contact information.',\n });\nexport interface Task extends Schema.Schema.Type<typeof Task> {}\n\n/** @deprecated */\nexport const Organization = Schema.Struct({\n id: ObjectId,\n name: Schema.String.annotations({ description: 'The name of the organization.' }),\n projects: Schema.Array(Ref(Project)),\n employees: Schema.Array(Ref(Contact)),\n})\n .pipe(Schema.mutable)\n .annotations({\n [TypeAnnotationId]: {\n kind: EntityKind.Object,\n typename: 'example.com/type/Organization',\n version: '0.1.0',\n },\n description: 'Contact information.',\n });\nexport interface Organization extends Schema.Schema.Type<typeof Organization> {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAKO,IAAMA,sBAAsB;EACjCC,OAAO;EACPC,QAAQ;AACV;;;ACAO,IAAMC,eAAe,CAAC,EAC3BC,QACAC,QACAC,QAAO,IAKL,CAAC,MAAC;AACJ,QAAMC,SAA8B,CAAC;AACrC,MAAIC,cAAc;AAElB,SAAO,CAACC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ACX;EACAV,aAAa;AACf,CAAA;",
|
|
6
|
-
"names": ["AI_SERVICE_ENDPOINT", "LOCAL", "REMOTE", "createLogger", "stream", "filter", "onImage", "images", "currentText", "event", "printContentBlock", "content", "type", "process", "stdout", "write", "text", "name", "id", "source", "mediaType", "onTextBlockPrinted", "imageMatch", "match", "description", "message", "role", "toUpperCase", "delta", "partial_json", "block", "JSON", "stringify", "input", "isError", "createTestOllamaClient", "options", "OllamaClient", "tools", "overrides", "model", "DEFAULT_OLLAMA_MODEL", "temperature", "inspect", "ConsolePrinter", "printMessage", "message", "console", "log", "role", "toUpperCase", "content", "printContentBlock", "type", "text", "name", "inspect", "input", "depth", "colors", "data", "JSON", "parse", "toolUseId", "Schema", "defineTool", "ToolResult", "toJsonSchema", "log", "createCypherTool", "dataSource", "schemaTypes", "defineTool", "name", "description", "length", "createSystemPrompt", "schema", "Schema", "Struct", "query", "String", "annotations", "execute", "log", "results", "executeQuery", "ToolResult", "Success", "e", "catch", "Error", "message", "trim", "formatJsonSchemaForLLM", "map", "toJsonSchema", "raise", "JSON_SCHEMA_ECHO_REF_ID", "ObjectId", "toJsonSchema", "Ref", "RefImpl", "invariant", "live", "seedTestData", "db", "contactRich", "add", "live", "Contact", "name", "contactJosiah", "contactDima", "contactFred", "projectComposer", "Project", "projectEcho", "projectDoodles", "_taskComposer1", "Task", "project", "RefImpl", "make", "assignee", "_taskComposer2", "_taskComposer3", "_taskComposer5", "_taskComposer4", "_taskEcho1", "_taskEcho2", "_taskDoodles1", "_taskDoodles2", "_orgDxos", "Organization", "employees", "projects", "_orgBraneframe", "createTestData", "dataSource", "MockDataSource", "id", "ObjectId", "random", "computeGraph", "objects", "schema", "nodes", "relationships", "getNodes", "label", "filter", "node", "getRelationships", "relationship", "data", "invariant", "jsonSchema", "toJsonSchema", "$id", "json", "instance", "typenameDxn", "raise", "Error", "typeDxn", "object", "Object", "values", "push", "kind", "formatNodeLabel", "properties", "propSchema", "entries", "JSON_SCHEMA_ECHO_REF_ID", "formatInferredRelationshipLabel", "source", "find", "targetId", "target", "type", "items", "map", "x", "Schema", "EntityKind", "TypeAnnotationId", "Ref", "ObjectId", "Contact", "Schema", "Struct", "id", "ObjectId", "name", "String", "annotations", "description", "email", "optional", "pipe", "mutable", "TypeAnnotationId", "kind", "EntityKind", "Object", "typename", "version", "Project", "Task", "project", "Ref", "assignee", "Organization", "projects", "Array", "employees"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_EDGE_MODEL = "@anthropic/claude-3-5-sonnet-20241022";
|
|
2
|
-
export declare const DEFAULT_EDGE_MODELS: readonly ["@anthropic/claude-3-5-haiku-20241022", "@anthropic/claude-3-5-sonnet-20241022", "@anthropic/claude-3-7-sonnet-20250219", "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b", "@hf/nousresearch/hermes-2-pro-mistral-7b", "@ollama/llama-3-1-nemotron-70b-instruct", "@ollama/llama-3-1-nemotron-mini-4b-instruct", "@ollama/llama-3-2-3b"];
|
|
3
|
-
export declare const DEFAULT_OLLAMA_ENDPOINT = "http://localhost:11434";
|
|
4
|
-
export declare const DEFAULT_OLLAMA_MODEL = "llama3.2:1b";
|
|
5
|
-
/**
|
|
6
|
-
* https://ollama.com/library
|
|
7
|
-
*/
|
|
8
|
-
export declare const DEFAULT_OLLAMA_MODELS: readonly ["llama3.2:1b", "llama3:70b", "deepseek-r1:latest"];
|
|
9
|
-
//# sourceMappingURL=defs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/defs.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,kBAAkB,0CAA0C,CAAC;AAE1E,eAAO,MAAM,mBAAmB,mVActB,CAAC;AAGX,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAEhE,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,qBAAqB,8DAKxB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AIServiceClient, GenerationStream } from './service';
|
|
2
|
-
import { type GenerateRequest, type GenerateResponse } from './types';
|
|
3
|
-
export type AIServiceEdgeClientOptions = {
|
|
4
|
-
endpoint: string;
|
|
5
|
-
};
|
|
6
|
-
export declare class AIServiceEdgeClient implements AIServiceClient {
|
|
7
|
-
private readonly _endpoint;
|
|
8
|
-
constructor({ endpoint }: AIServiceEdgeClientOptions);
|
|
9
|
-
/**
|
|
10
|
-
* Generate non-streaming response.
|
|
11
|
-
*/
|
|
12
|
-
exec(request: GenerateRequest): Promise<GenerateResponse>;
|
|
13
|
-
/**
|
|
14
|
-
* Process request and open message stream.
|
|
15
|
-
*/
|
|
16
|
-
execStream(request: GenerateRequest): Promise<GenerationStream>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=edge-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge-client.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/edge-client.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtE,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAAa,mBAAoB,YAAW,eAAe;IACzD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,EAAE,QAAQ,EAAE,EAAE,0BAA0B;IAKpD;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI/D;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAsBtE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './defs';
|
|
2
|
-
export * from './edge-client';
|
|
3
|
-
export * from './message-collector';
|
|
4
|
-
export * from './ollama-client';
|
|
5
|
-
export * from './parser';
|
|
6
|
-
export * from './service';
|
|
7
|
-
export * from './stream';
|
|
8
|
-
export * from './transform';
|
|
9
|
-
export * from './types';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { Message } from '@dxos/artifact';
|
|
2
|
-
import type { GenerationStreamEvent } from './types';
|
|
3
|
-
export declare class MessageCollector {
|
|
4
|
-
private _messages;
|
|
5
|
-
private _pendingMessage?;
|
|
6
|
-
get messages(): {
|
|
7
|
-
readonly id: string;
|
|
8
|
-
role: "user" | "assistant";
|
|
9
|
-
content: ({
|
|
10
|
-
pending?: boolean | undefined;
|
|
11
|
-
type: "text";
|
|
12
|
-
disposition?: string | undefined;
|
|
13
|
-
text: string;
|
|
14
|
-
} | {
|
|
15
|
-
pending?: boolean | undefined;
|
|
16
|
-
type: "json";
|
|
17
|
-
disposition?: string | undefined;
|
|
18
|
-
json: string;
|
|
19
|
-
} | {
|
|
20
|
-
pending?: boolean | undefined;
|
|
21
|
-
type: "image";
|
|
22
|
-
id?: string | undefined;
|
|
23
|
-
source?: {
|
|
24
|
-
type: "base64";
|
|
25
|
-
mediaType: string;
|
|
26
|
-
data: string;
|
|
27
|
-
} | undefined;
|
|
28
|
-
} | {
|
|
29
|
-
pending?: boolean | undefined;
|
|
30
|
-
name: string;
|
|
31
|
-
type: "tool_use";
|
|
32
|
-
id: string;
|
|
33
|
-
input: unknown;
|
|
34
|
-
} | {
|
|
35
|
-
pending?: boolean | undefined;
|
|
36
|
-
type: "tool_result";
|
|
37
|
-
content: string;
|
|
38
|
-
toolUseId: string;
|
|
39
|
-
isError?: boolean | undefined;
|
|
40
|
-
})[];
|
|
41
|
-
}[];
|
|
42
|
-
get pendingMessage(): {
|
|
43
|
-
readonly id: string;
|
|
44
|
-
role: "user" | "assistant";
|
|
45
|
-
content: ({
|
|
46
|
-
pending?: boolean | undefined;
|
|
47
|
-
type: "text";
|
|
48
|
-
disposition?: string | undefined;
|
|
49
|
-
text: string;
|
|
50
|
-
} | {
|
|
51
|
-
pending?: boolean | undefined;
|
|
52
|
-
type: "json";
|
|
53
|
-
disposition?: string | undefined;
|
|
54
|
-
json: string;
|
|
55
|
-
} | {
|
|
56
|
-
pending?: boolean | undefined;
|
|
57
|
-
type: "image";
|
|
58
|
-
id?: string | undefined;
|
|
59
|
-
source?: {
|
|
60
|
-
type: "base64";
|
|
61
|
-
mediaType: string;
|
|
62
|
-
data: string;
|
|
63
|
-
} | undefined;
|
|
64
|
-
} | {
|
|
65
|
-
pending?: boolean | undefined;
|
|
66
|
-
name: string;
|
|
67
|
-
type: "tool_use";
|
|
68
|
-
id: string;
|
|
69
|
-
input: unknown;
|
|
70
|
-
} | {
|
|
71
|
-
pending?: boolean | undefined;
|
|
72
|
-
type: "tool_result";
|
|
73
|
-
content: string;
|
|
74
|
-
toolUseId: string;
|
|
75
|
-
isError?: boolean | undefined;
|
|
76
|
-
})[];
|
|
77
|
-
} | undefined;
|
|
78
|
-
push(event: GenerationStreamEvent): void;
|
|
79
|
-
pushMessage(message: Message): void;
|
|
80
|
-
}
|
|
81
|
-
export declare function emitMessageAsEvents(message: Message): Iterable<GenerationStreamEvent>;
|
|
82
|
-
//# sourceMappingURL=message-collector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message-collector.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/message-collector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,eAAe,CAAC,CAAsB;IAE9C,IAAW,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAElB;IAED,IAAW,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAExB;IAED,IAAI,CAAC,KAAK,EAAE,qBAAqB;IAkDjC,WAAW,CAAC,OAAO,EAAE,OAAO;CAG7B;AAED,wBAAiB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAQtF"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type Tool } from '@dxos/artifact';
|
|
2
|
-
import { type AIServiceClient, type GenerationStream } from './service';
|
|
3
|
-
import { type GenerateRequest, type GenerateResponse } from './types';
|
|
4
|
-
export type OllamaClientParams = {
|
|
5
|
-
endpoint?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Tools that are executed within the client.
|
|
8
|
-
*/
|
|
9
|
-
tools?: Tool[];
|
|
10
|
-
/**
|
|
11
|
-
* Override generation parameters.
|
|
12
|
-
*/
|
|
13
|
-
overrides?: {
|
|
14
|
-
model?: string;
|
|
15
|
-
temperature?: number;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Maximum number of tool invocations in a single request that is allowed to run.
|
|
19
|
-
* @default 3
|
|
20
|
-
*/
|
|
21
|
-
maxToolInvocations?: number;
|
|
22
|
-
};
|
|
23
|
-
export declare class OllamaClient implements AIServiceClient {
|
|
24
|
-
/**
|
|
25
|
-
* Check if Ollama server is running and accessible.
|
|
26
|
-
* @returns Promise that resolves to true if Ollama is running, false otherwise.
|
|
27
|
-
*/
|
|
28
|
-
static isRunning(): Promise<boolean>;
|
|
29
|
-
private readonly _endpoint;
|
|
30
|
-
private readonly _tools;
|
|
31
|
-
private readonly _modelOverride?;
|
|
32
|
-
private readonly _temperatureOverride?;
|
|
33
|
-
private readonly _maxToolInvocations;
|
|
34
|
-
constructor({ endpoint, tools, overrides, maxToolInvocations }?: OllamaClientParams);
|
|
35
|
-
private _getEmbededTools;
|
|
36
|
-
private _generateStream;
|
|
37
|
-
/**
|
|
38
|
-
* Generate non-streaming response.
|
|
39
|
-
*/
|
|
40
|
-
exec(request: GenerateRequest): Promise<GenerateResponse>;
|
|
41
|
-
execStream(request: GenerateRequest): Promise<GenerationStream>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=ollama-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ollama-client.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/ollama-client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAwC,KAAK,IAAI,EAAc,MAAM,gBAAgB,CAAC;AAO7F,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,EAAa,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAA8B,MAAM,SAAS,CAAC;AAG7G,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAEf;;OAEG;IAEH,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF;;;OAGG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AEhD;;OAEG;IACI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAoC;IAE1C,WAAW,+BAAsC;IAExD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,CAAsB;IAEvC,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,WAAW;IAQnB;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAqM1D;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,mBAAmB,EACjC,aAAa,WAAW,KACvB,mBAAmB,GAAG,SAkGxB,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type GenerateRequest, type GenerationStreamEvent, type GenerateResponse } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Interface for AI service.
|
|
4
|
-
* Generates chat completions, supports, history and tools.
|
|
5
|
-
*/
|
|
6
|
-
export interface AIServiceClient {
|
|
7
|
-
/**
|
|
8
|
-
* Generate chat completions, supports, history and tools.
|
|
9
|
-
* Generate non-streaming response.
|
|
10
|
-
*/
|
|
11
|
-
exec(request: GenerateRequest): Promise<GenerateResponse>;
|
|
12
|
-
/**
|
|
13
|
-
* Generate chat completions, supports, history and tools.
|
|
14
|
-
* Process request and open message stream.
|
|
15
|
-
*/
|
|
16
|
-
execStream(request: GenerateRequest): Promise<GenerationStream>;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Streaming chat completion stream.
|
|
20
|
-
*/
|
|
21
|
-
export interface GenerationStream extends AsyncIterable<GenerationStreamEvent> {
|
|
22
|
-
abort(): void;
|
|
23
|
-
complete(): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElG;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE1D;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IAC5E,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { GenerationStream } from './service';
|
|
2
|
-
import { type GenerationStreamEvent } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a stream from an SSE response.
|
|
5
|
-
*/
|
|
6
|
-
export declare const createGenerationStream: (response: Response, controller?: AbortController) => GenerationStream;
|
|
7
|
-
/**
|
|
8
|
-
* Server-Sent Events (SSE) stream from the AI service.
|
|
9
|
-
* https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events
|
|
10
|
-
*/
|
|
11
|
-
export declare class GenerationStreamImpl implements GenerationStream {
|
|
12
|
-
private readonly _controller;
|
|
13
|
-
private readonly _getIterator;
|
|
14
|
-
/**
|
|
15
|
-
* Trigger event when the stream is done.
|
|
16
|
-
*/
|
|
17
|
-
private readonly _done;
|
|
18
|
-
/**
|
|
19
|
-
* Iterator over the stream.
|
|
20
|
-
*/
|
|
21
|
-
private _iterator?;
|
|
22
|
-
constructor(_controller: AbortController, _getIterator: () => AsyncIterableIterator<GenerationStreamEvent>);
|
|
23
|
-
/**
|
|
24
|
-
* Returns an iterator over the stream.
|
|
25
|
-
*/
|
|
26
|
-
[Symbol.asyncIterator](): AsyncIterator<GenerationStreamEvent>;
|
|
27
|
-
/**
|
|
28
|
-
* Aborts the stream.
|
|
29
|
-
*/
|
|
30
|
-
abort(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Returns the complete message list generated by the AI service.
|
|
33
|
-
*/
|
|
34
|
-
complete(): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Creates an iterator over the stream.
|
|
37
|
-
*/
|
|
38
|
-
private _createIterator;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/stream.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrD;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,QAAQ,EAAE,4BAAkC,KAAG,gBAuC/F,CAAC;AAEF;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAYzD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAZ/B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IAEvC;;OAEG;IACH,OAAO,CAAC,SAAS,CAAC,CAAmD;gBAGlD,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,MAAM,qBAAqB,CAAC,qBAAqB,CAAC;IAGnF;;OAEG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,qBAAqB,CAAC;IAI9D;;OAEG;IACH,KAAK;IAIL;;OAEG;IACG,QAAQ;IAId;;OAEG;IACH,OAAO,CAAC,eAAe;CAkBxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream.test.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/stream.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type GenerationStream, type AIServiceClient, type GenerateRequest, type GenerateResponse } from '@dxos/assistant';
|
|
2
|
-
export declare class MockAIService implements AIServiceClient {
|
|
3
|
-
private readonly _responses;
|
|
4
|
-
constructor(_responses: string[]);
|
|
5
|
-
/**
|
|
6
|
-
* Generate non-streaming response.
|
|
7
|
-
*/
|
|
8
|
-
exec(request: GenerateRequest): Promise<GenerateResponse>;
|
|
9
|
-
execStream(request: GenerateRequest): Promise<GenerationStream>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/testing/mock.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAIzB,qBAAa,aAAc,YAAW,eAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,MAAM,EAAE;IAEjD;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAMzD,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-stream.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/testing/test-stream.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EACzB,cAAsB;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;CAAO,KAC5D,cA8EF,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parsed block.
|
|
3
|
-
*/
|
|
4
|
-
export type StreamBlock = {
|
|
5
|
-
type: 'tag';
|
|
6
|
-
tag: string;
|
|
7
|
-
attributes?: Record<string, string>;
|
|
8
|
-
content: StreamBlock[];
|
|
9
|
-
closing?: boolean;
|
|
10
|
-
selfClosing?: boolean;
|
|
11
|
-
} | {
|
|
12
|
-
type: 'text';
|
|
13
|
-
content: string;
|
|
14
|
-
} | {
|
|
15
|
-
type: 'json';
|
|
16
|
-
disposition?: string;
|
|
17
|
-
content: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Permissive streaming transformer that processes mixed content (plain text and XML fragments) from the AI service.
|
|
21
|
-
*/
|
|
22
|
-
export declare class StreamTransform {
|
|
23
|
-
private _buffer;
|
|
24
|
-
transform(chunk: string): StreamBlock[];
|
|
25
|
-
flush(): StreamBlock[];
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/transform.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAiE5D;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAM;IAErB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE;IAkBvC,KAAK,IAAI,WAAW,EAAE;CAYvB"}
|