@dxos/assistant 0.8.2-staging.7ac8446 → 0.8.3-main.672df60
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 +1909 -228
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1907 -229
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1910 -228
- 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 +51 -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 +12 -0
- package/dist/types/src/blueprint/logger.d.ts.map +1 -0
- package/dist/types/src/blueprint/machine.d.ts +122 -0
- 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 -3
- 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 +40 -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 +2 -0
- package/dist/types/src/research/research.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +1 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +80 -35
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +21 -0
- package/dist/types/src/session/version-pin.d.ts.map +1 -0
- package/dist/types/src/session/version-pin.test.d.ts +2 -0
- package/dist/types/src/session/version-pin.test.d.ts.map +1 -0
- 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 -6
- 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/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -35
- package/src/blueprint/blueprint.test.ts +149 -0
- package/src/blueprint/blueprint.ts +71 -0
- package/src/blueprint/index.ts +7 -0
- package/src/blueprint/logger.ts +109 -0
- package/src/blueprint/machine.ts +214 -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 -3
- package/src/research/exa.ts +100 -0
- package/src/research/graph.test.ts +15 -0
- package/src/research/graph.ts +339 -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 +1 -0
- package/src/session/session.test.ts +39 -67
- package/src/session/session.ts +328 -155
- package/src/session/version-pin.test.ts +26 -0
- package/src/session/version-pin.ts +48 -0
- 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 -7
- package/src/typedefs.d.ts +8 -0
- package/src/types.ts +8 -0
- package/src/typings.d.ts +8 -0
- package/dist/lib/browser/chunk-PND5VR6D.mjs +0 -2315
- package/dist/lib/browser/chunk-PND5VR6D.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -621
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/chunk-IBOBRBDF.cjs +0 -2326
- package/dist/lib/node/chunk-IBOBRBDF.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -637
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-DCQJOLSR.mjs +0 -2317
- package/dist/lib/node-esm/chunk-DCQJOLSR.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -622
- 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 -19
- 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 -88
- package/dist/types/src/ai-service/message-collector.d.ts.map +0 -1
- package/dist/types/src/ai-service/ollama-client.d.ts +0 -39
- package/dist/types/src/ai-service/ollama-client.d.ts.map +0 -1
- package/dist/types/src/ai-service/parser.d.ts +0 -138
- package/dist/types/src/ai-service/parser.d.ts.map +0 -1
- package/dist/types/src/ai-service/service.d.ts +0 -9
- 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 -7
- 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 -167
- 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/conversation/conversation.d.ts +0 -80
- package/dist/types/src/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/conversation/conversation.test.d.ts +0 -2
- package/dist/types/src/conversation/conversation.test.d.ts.map +0 -1
- package/dist/types/src/conversation/index.d.ts +0 -2
- package/dist/types/src/conversation/index.d.ts.map +0 -1
- package/dist/types/src/conversation/types.d.ts +0 -79
- package/dist/types/src/conversation/types.d.ts.map +0 -1
- package/dist/types/src/cypher/ast.d.ts +0 -56
- package/dist/types/src/cypher/ast.d.ts.map +0 -1
- package/dist/types/src/cypher/combinators.d.ts +0 -14
- package/dist/types/src/cypher/combinators.d.ts.map +0 -1
- package/dist/types/src/cypher/combinators.test.d.ts +0 -2
- package/dist/types/src/cypher/combinators.test.d.ts.map +0 -1
- package/dist/types/src/cypher/echo-data-source.d.ts +0 -16
- package/dist/types/src/cypher/echo-data-source.d.ts.map +0 -1
- package/dist/types/src/cypher/execution-plan.d.ts +0 -49
- package/dist/types/src/cypher/execution-plan.d.ts.map +0 -1
- package/dist/types/src/cypher/execution-plan.test.d.ts +0 -2
- package/dist/types/src/cypher/execution-plan.test.d.ts.map +0 -1
- package/dist/types/src/cypher/index.d.ts +0 -5
- package/dist/types/src/cypher/index.d.ts.map +0 -1
- package/dist/types/src/cypher/parjs.d.ts +0 -4
- package/dist/types/src/cypher/parjs.d.ts.map +0 -1
- package/dist/types/src/cypher/parser.d.ts +0 -6
- package/dist/types/src/cypher/parser.d.ts.map +0 -1
- package/dist/types/src/cypher/query-executor.d.ts +0 -26
- package/dist/types/src/cypher/query-executor.d.ts.map +0 -1
- package/dist/types/src/cypher/query-executor.test.d.ts +0 -2
- package/dist/types/src/cypher/query-executor.test.d.ts.map +0 -1
- package/dist/types/src/cypher/schema.d.ts +0 -12
- package/dist/types/src/cypher/schema.d.ts.map +0 -1
- package/dist/types/src/cypher/schema.test.d.ts +0 -2
- package/dist/types/src/cypher/schema.test.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/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 -50
- 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 -265
- package/src/ai-service/defs.ts +0 -39
- package/src/ai-service/edge-client.ts +0 -67
- 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 -499
- package/src/ai-service/parser.ts +0 -358
- package/src/ai-service/service.ts +0 -15
- 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 -22
- 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 -103
- 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/conversation/conversation.test.ts +0 -73
- package/src/conversation/conversation.ts +0 -257
- package/src/conversation/index.ts +0 -5
- package/src/conversation/types.ts +0 -129
- package/src/cypher/ast.ts +0 -75
- package/src/cypher/combinators.test.ts +0 -137
- package/src/cypher/combinators.ts +0 -148
- package/src/cypher/echo-data-source.ts +0 -105
- package/src/cypher/execution-plan.test.ts +0 -44
- package/src/cypher/execution-plan.ts +0 -208
- package/src/cypher/index.ts +0 -8
- package/src/cypher/parjs-shims.d.ts +0 -10
- package/src/cypher/parjs.ts +0 -10
- package/src/cypher/parser.ts +0 -19
- package/src/cypher/query-executor.test.ts +0 -47
- package/src/cypher/query-executor.ts +0 -145
- package/src/cypher/schema.test.ts +0 -17
- package/src/cypher/schema.ts +0 -86
- 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/query-promts.ts +0 -75
- package/src/testing/query.test.ts +0 -91
- package/src/testing/test-data.ts +0 -372
- package/src/testing/test-schema.ts +0 -80
- 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
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/defs.ts", "../../../../src/testing/logger.ts", "../../../../src/testing/ollama.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 '../conversation';\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 2024 DXOS.org\n//\n\nimport { Schema as S } 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 '../cypher';\nimport { trim } from '../util';\n\nexport const createCypherTool = (dataSource: DataSource, schemaTypes: S.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: S.Struct({\n query: S.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: S.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 as S } from 'effect';\n\nimport { raise } from '@dxos/debug';\nimport type { EchoDatabase } from '@dxos/echo-db';\nimport { JSON_SCHEMA_ECHO_REF_ID, ObjectId, toJsonSchema, type JsonSchemaType, type Ref } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { create, makeRef } from '@dxos/live-object';\n\nimport {\n type DataSource,\n type Node,\n type Relationship,\n formatInferredRelationshipLabel,\n formatNodeLabel,\n} from '../cypher';\nimport { Contact, Org, Project, Task } from '../testing';\n\nexport const seedTestData = (db: EchoDatabase) => {\n const contactRich = db.add(\n create(Contact, {\n name: 'Rich',\n }),\n );\n const contactJosiah = db.add(\n create(Contact, {\n name: 'Josiah',\n }),\n );\n const contactDima = db.add(\n create(Contact, {\n name: 'Dima',\n }),\n );\n const contactFred = db.add(\n create(Contact, {\n name: 'Fred',\n }),\n );\n\n const projectComposer = db.add(\n create(Project, {\n name: 'Composer',\n }),\n );\n const projectEcho = db.add(\n create(Project, {\n name: 'ECHO',\n }),\n );\n const projectDoodles = db.add(\n create(Project, {\n name: 'Doodles',\n }),\n );\n\n const _taskComposer1 = db.add(\n create(Task, {\n name: 'Optimize startup performance',\n project: makeRef(projectComposer),\n assignee: makeRef(contactJosiah),\n }),\n );\n const _taskComposer2 = db.add(\n create(Task, {\n name: 'Create form builder',\n project: makeRef(projectComposer),\n assignee: makeRef(contactRich),\n }),\n );\n const _taskComposer3 = db.add(\n create(Task, {\n name: 'Add support for custom themes',\n project: makeRef(projectComposer),\n assignee: makeRef(contactJosiah),\n }),\n );\n const _taskComposer5 = db.add(\n create(Task, {\n name: 'Implement community plugin',\n project: makeRef(projectComposer),\n assignee: makeRef(contactFred),\n }),\n );\n const _taskComposer4 = db.add(\n create(Task, {\n name: 'Implement dark mode',\n project: makeRef(projectComposer),\n assignee: makeRef(contactRich),\n }),\n );\n const _taskEcho1 = db.add(\n create(Task, {\n name: 'Implement cypher query engine',\n project: makeRef(projectEcho),\n assignee: makeRef(contactDima),\n }),\n );\n const _taskEcho2 = db.add(\n create(Task, {\n name: 'Add schema editor',\n project: makeRef(projectEcho),\n assignee: makeRef(contactRich),\n }),\n );\n const _taskDoodles1 = db.add(\n create(Task, {\n name: 'Add support for custom themes',\n project: makeRef(projectDoodles),\n assignee: makeRef(contactFred),\n }),\n );\n const _taskDoodles2 = db.add(\n create(Task, {\n name: 'Implement dark mode',\n project: makeRef(projectDoodles),\n assignee: makeRef(contactJosiah),\n }),\n );\n\n const _orgDxos = db.add(\n create(Org, {\n name: 'DXOS',\n employees: [makeRef(contactRich), makeRef(contactJosiah), makeRef(contactDima)],\n projects: [makeRef(projectEcho)],\n }),\n );\n const _orgBraneframe = db.add(\n create(Org, {\n name: 'Braneframe',\n employees: [makeRef(contactJosiah), makeRef(contactRich)],\n projects: [makeRef(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: makeRef(projectComposer),\n assignee: makeRef(contactJosiah),\n });\n const _taskComposer2 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Create form builder',\n project: makeRef(projectComposer),\n assignee: makeRef(contactRich),\n });\n const _taskComposer3 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Add support for custom themes',\n project: makeRef(projectComposer),\n assignee: makeRef(contactJosiah),\n });\n const _taskComposer5 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement community plugin',\n project: makeRef(projectComposer),\n assignee: makeRef(contactFred),\n });\n const _taskComposer4 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement dark mode',\n project: makeRef(projectComposer),\n assignee: makeRef(contactRich),\n });\n const _taskEcho1 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement cypher query engine',\n project: makeRef(projectEcho),\n assignee: makeRef(contactDima),\n });\n const _taskEcho2 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Add schema editor',\n project: makeRef(projectEcho),\n assignee: makeRef(contactRich),\n });\n const _taskDoodles1 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Add support for custom themes',\n project: makeRef(projectDoodles),\n assignee: makeRef(contactFred),\n });\n const _taskDoodles2 = dataSource.add(Task, {\n id: ObjectId.random(),\n name: 'Implement dark mode',\n project: makeRef(projectDoodles),\n assignee: makeRef(contactJosiah),\n });\n\n const _orgDxos = dataSource.add(Org, {\n id: ObjectId.random(),\n name: 'DXOS',\n employees: [makeRef(contactRich), makeRef(contactJosiah), makeRef(contactDima)],\n projects: [makeRef(projectEcho)],\n });\n const _orgBraneframe = dataSource.add(Org, {\n id: ObjectId.random(),\n name: 'Braneframe',\n employees: [makeRef(contactJosiah), makeRef(contactRich)],\n projects: [makeRef(projectComposer)],\n });\n dataSource.computeGraph();\n\n return dataSource;\n};\n\nexport class MockDataSource implements DataSource {\n objects: Record<\n string,\n {\n schema: S.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: S.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 S.Schema.All>(schema: S, data: S.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 as S } from 'effect';\n\nimport { EntityKind, TypeAnnotationId, Ref } from '@dxos/echo-schema';\n\n// TODO(burdon): Reconcile with sdk/schema/testing.\n// TODO(burdon): Convert interface to type.\n\n// TODO(dmaretskyi): Extract.\nexport const ObjectId = S.String.annotations({ description: 'The unique object identifier.' });\n\nexport const Contact = S.Struct({\n id: ObjectId,\n name: S.String.annotations({ description: 'The name of the person.' }),\n email: S.optional(S.String).annotations({ description: 'Email address.' }),\n})\n .pipe(S.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 S.Schema.Type<typeof Contact> {}\n\nexport const Project = S.Struct({\n id: ObjectId,\n name: S.String.annotations({ description: 'The name of the project.' }),\n description: S.optional(S.String).annotations({ description: 'The description of the project.' }),\n})\n .pipe(S.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 S.Schema.Type<typeof Project> {}\n\nexport const Task = S.Struct({\n id: ObjectId,\n name: S.String.annotations({ description: 'The name of the task.' }),\n description: S.optional(S.String).annotations({ description: 'The description of the task.' }),\n project: Ref(Project),\n assignee: Ref(Contact),\n})\n .pipe(S.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 S.Schema.Type<typeof Task> {}\n\nexport const Org = S.Struct({\n id: ObjectId,\n name: S.String.annotations({ description: 'The name of the organization.' }),\n projects: S.Array(Ref(Project)),\n employees: S.Array(Ref(Contact)),\n})\n .pipe(S.mutable)\n .annotations({\n [TypeAnnotationId]: {\n kind: EntityKind.Object,\n typename: 'example.com/type/Org',\n version: '0.1.0',\n },\n description: 'Contact information.',\n });\nexport interface Org extends S.Schema.Type<typeof Org> {}\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,UAAAA;AACN,QAAI,OAAOJ,WAAW,cAAc,CAACA,OAAOI,KAAAA,GAAQ;AAClD;IACF;AAEA,UAAMC,oBAAoB,CAACC,YAAAA;AACzB,cAAQA,QAAQC,MAAI;QAClB,KAAK;AACHC,kBAAQC,OAAOC,MAAMJ,QAAQK,IAAI;AACjC;QACF,KAAK;AACHH,kBAAQC,OAAOC,MAAM,2BAAiBJ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VICE_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", "Schema", "S", "defineTool", "ToolResult", "toJsonSchema", "log", "createCypherTool", "dataSource", "schemaTypes", "defineTool", "name", "description", "length", "createSystemPrompt", "schema", "S", "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", "invariant", "create", "makeRef", "seedTestData", "db", "contactRich", "add", "create", "Contact", "name", "contactJosiah", "contactDima", "contactFred", "projectComposer", "Project", "projectEcho", "projectDoodles", "_taskComposer1", "Task", "project", "makeRef", "assignee", "_taskComposer2", "_taskComposer3", "_taskComposer5", "_taskComposer4", "_taskEcho1", "_taskEcho2", "_taskDoodles1", "_taskDoodles2", "_orgDxos", "Org", "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", "S", "EntityKind", "TypeAnnotationId", "Ref", "ObjectId", "S", "String", "annotations", "description", "Contact", "Struct", "id", "name", "email", "optional", "pipe", "mutable", "TypeAnnotationId", "kind", "EntityKind", "Object", "typename", "version", "Project", "Task", "project", "Ref", "assignee", "Org", "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,19 +0,0 @@
|
|
|
1
|
-
import { Message } from '@dxos/artifact';
|
|
2
|
-
import type { AIServiceClient, GenerationStream } from './service';
|
|
3
|
-
import { type GenerateRequest } from './types';
|
|
4
|
-
export type AIServiceEdgeClientOptions = {
|
|
5
|
-
endpoint: string;
|
|
6
|
-
};
|
|
7
|
-
export declare class AIServiceEdgeClient implements AIServiceClient {
|
|
8
|
-
private readonly _endpoint;
|
|
9
|
-
constructor({ endpoint }: AIServiceEdgeClientOptions);
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
*/
|
|
13
|
-
appendMessages(messages: Message[]): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Process request and open message stream.
|
|
16
|
-
*/
|
|
17
|
-
exec(request: GenerateRequest): Promise<GenerationStream>;
|
|
18
|
-
}
|
|
19
|
-
//# 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":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAIzC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,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;IAEG,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAexD;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkBhE"}
|
|
@@ -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,88 +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
|
-
spaceId?: import("@dxos/keys").SpaceId | undefined;
|
|
9
|
-
threadId?: string | undefined;
|
|
10
|
-
foreignId?: string | undefined;
|
|
11
|
-
role: "user" | "assistant";
|
|
12
|
-
content: ({
|
|
13
|
-
pending?: boolean | undefined;
|
|
14
|
-
type: "text";
|
|
15
|
-
disposition?: string | undefined;
|
|
16
|
-
text: string;
|
|
17
|
-
} | {
|
|
18
|
-
pending?: boolean | undefined;
|
|
19
|
-
type: "json";
|
|
20
|
-
disposition?: string | undefined;
|
|
21
|
-
json: string;
|
|
22
|
-
} | {
|
|
23
|
-
pending?: boolean | undefined;
|
|
24
|
-
type: "image";
|
|
25
|
-
id?: string | undefined;
|
|
26
|
-
source?: {
|
|
27
|
-
type: "base64";
|
|
28
|
-
mediaType: string;
|
|
29
|
-
data: string;
|
|
30
|
-
} | undefined;
|
|
31
|
-
} | {
|
|
32
|
-
pending?: boolean | undefined;
|
|
33
|
-
name: string;
|
|
34
|
-
type: "tool_use";
|
|
35
|
-
id: string;
|
|
36
|
-
input: unknown;
|
|
37
|
-
} | {
|
|
38
|
-
pending?: boolean | undefined;
|
|
39
|
-
type: "tool_result";
|
|
40
|
-
content: string;
|
|
41
|
-
toolUseId: string;
|
|
42
|
-
isError?: boolean | undefined;
|
|
43
|
-
})[];
|
|
44
|
-
}[];
|
|
45
|
-
get pendingMessage(): {
|
|
46
|
-
readonly id: string;
|
|
47
|
-
spaceId?: import("@dxos/keys").SpaceId | undefined;
|
|
48
|
-
threadId?: string | undefined;
|
|
49
|
-
foreignId?: string | undefined;
|
|
50
|
-
role: "user" | "assistant";
|
|
51
|
-
content: ({
|
|
52
|
-
pending?: boolean | undefined;
|
|
53
|
-
type: "text";
|
|
54
|
-
disposition?: string | undefined;
|
|
55
|
-
text: string;
|
|
56
|
-
} | {
|
|
57
|
-
pending?: boolean | undefined;
|
|
58
|
-
type: "json";
|
|
59
|
-
disposition?: string | undefined;
|
|
60
|
-
json: string;
|
|
61
|
-
} | {
|
|
62
|
-
pending?: boolean | undefined;
|
|
63
|
-
type: "image";
|
|
64
|
-
id?: string | undefined;
|
|
65
|
-
source?: {
|
|
66
|
-
type: "base64";
|
|
67
|
-
mediaType: string;
|
|
68
|
-
data: string;
|
|
69
|
-
} | undefined;
|
|
70
|
-
} | {
|
|
71
|
-
pending?: boolean | undefined;
|
|
72
|
-
name: string;
|
|
73
|
-
type: "tool_use";
|
|
74
|
-
id: string;
|
|
75
|
-
input: unknown;
|
|
76
|
-
} | {
|
|
77
|
-
pending?: boolean | undefined;
|
|
78
|
-
type: "tool_result";
|
|
79
|
-
content: string;
|
|
80
|
-
toolUseId: string;
|
|
81
|
-
isError?: boolean | undefined;
|
|
82
|
-
})[];
|
|
83
|
-
} | undefined;
|
|
84
|
-
push(event: GenerationStreamEvent): void;
|
|
85
|
-
pushMessage(message: Message): void;
|
|
86
|
-
}
|
|
87
|
-
export declare function emitMessageAsEvents(message: Message): Iterable<GenerationStreamEvent>;
|
|
88
|
-
//# 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,39 +0,0 @@
|
|
|
1
|
-
import { type Tool } from '@dxos/artifact';
|
|
2
|
-
import { type AIServiceClient, type GenerationStream } from './service';
|
|
3
|
-
import { type GenerateRequest } 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
|
-
exec(request: GenerateRequest): Promise<GenerationStream>;
|
|
38
|
-
}
|
|
39
|
-
//# 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,EAA8B,MAAM,SAAS,CAAC;AAGtF,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;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,qBAAa,YAAa,YAAW,eAAe;IAClD;;;OAGG;WACU,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAgB1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAS;IAC/C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;gBAEjC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAE,kBAAuB;IAQvF,OAAO,CAAC,gBAAgB;YAST,eAAe;IAwNxB,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAgEhE"}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { Message, type MessageContentBlock } from '@dxos/artifact';
|
|
2
|
-
import { Event } from '@dxos/async';
|
|
3
|
-
import { type GenerationStream } from './service';
|
|
4
|
-
import { type StreamBlock } from './transform';
|
|
5
|
-
import type { GenerationStreamEvent } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Parse mixed content of plain text, XML fragments, and JSON blocks.
|
|
8
|
-
*/
|
|
9
|
-
export declare class MixedStreamParser {
|
|
10
|
-
/**
|
|
11
|
-
* New message.
|
|
12
|
-
*/
|
|
13
|
-
message: Event<{
|
|
14
|
-
readonly id: string;
|
|
15
|
-
spaceId?: import("@dxos/keys").SpaceId | undefined;
|
|
16
|
-
threadId?: string | undefined;
|
|
17
|
-
foreignId?: string | undefined;
|
|
18
|
-
role: "user" | "assistant";
|
|
19
|
-
content: ({
|
|
20
|
-
pending?: boolean | undefined;
|
|
21
|
-
type: "text";
|
|
22
|
-
disposition?: string | undefined;
|
|
23
|
-
text: string;
|
|
24
|
-
} | {
|
|
25
|
-
pending?: boolean | undefined;
|
|
26
|
-
type: "json";
|
|
27
|
-
disposition?: string | undefined;
|
|
28
|
-
json: string;
|
|
29
|
-
} | {
|
|
30
|
-
pending?: boolean | undefined;
|
|
31
|
-
type: "image";
|
|
32
|
-
id?: string | undefined;
|
|
33
|
-
source?: {
|
|
34
|
-
type: "base64";
|
|
35
|
-
mediaType: string;
|
|
36
|
-
data: string;
|
|
37
|
-
} | undefined;
|
|
38
|
-
} | {
|
|
39
|
-
pending?: boolean | undefined;
|
|
40
|
-
name: string;
|
|
41
|
-
type: "tool_use";
|
|
42
|
-
id: string;
|
|
43
|
-
input: unknown;
|
|
44
|
-
} | {
|
|
45
|
-
pending?: boolean | undefined;
|
|
46
|
-
type: "tool_result";
|
|
47
|
-
content: string;
|
|
48
|
-
toolUseId: string;
|
|
49
|
-
isError?: boolean | undefined;
|
|
50
|
-
})[];
|
|
51
|
-
}>;
|
|
52
|
-
/**
|
|
53
|
-
* Complete block added to Message.
|
|
54
|
-
*/
|
|
55
|
-
block: Event<{
|
|
56
|
-
pending?: boolean | undefined;
|
|
57
|
-
type: "text";
|
|
58
|
-
disposition?: string | undefined;
|
|
59
|
-
text: string;
|
|
60
|
-
} | {
|
|
61
|
-
pending?: boolean | undefined;
|
|
62
|
-
type: "json";
|
|
63
|
-
disposition?: string | undefined;
|
|
64
|
-
json: string;
|
|
65
|
-
} | {
|
|
66
|
-
pending?: boolean | undefined;
|
|
67
|
-
type: "image";
|
|
68
|
-
id?: string | undefined;
|
|
69
|
-
source?: {
|
|
70
|
-
type: "base64";
|
|
71
|
-
mediaType: string;
|
|
72
|
-
data: string;
|
|
73
|
-
} | undefined;
|
|
74
|
-
} | {
|
|
75
|
-
pending?: boolean | undefined;
|
|
76
|
-
name: string;
|
|
77
|
-
type: "tool_use";
|
|
78
|
-
id: string;
|
|
79
|
-
input: unknown;
|
|
80
|
-
} | {
|
|
81
|
-
pending?: boolean | undefined;
|
|
82
|
-
type: "tool_result";
|
|
83
|
-
content: string;
|
|
84
|
-
toolUseId: string;
|
|
85
|
-
isError?: boolean | undefined;
|
|
86
|
-
}>;
|
|
87
|
-
/**
|
|
88
|
-
* Update partial block (while streaming).
|
|
89
|
-
*/
|
|
90
|
-
update: Event<{
|
|
91
|
-
pending?: boolean | undefined;
|
|
92
|
-
type: "text";
|
|
93
|
-
disposition?: string | undefined;
|
|
94
|
-
text: string;
|
|
95
|
-
} | {
|
|
96
|
-
pending?: boolean | undefined;
|
|
97
|
-
type: "json";
|
|
98
|
-
disposition?: string | undefined;
|
|
99
|
-
json: string;
|
|
100
|
-
} | {
|
|
101
|
-
pending?: boolean | undefined;
|
|
102
|
-
type: "image";
|
|
103
|
-
id?: string | undefined;
|
|
104
|
-
source?: {
|
|
105
|
-
type: "base64";
|
|
106
|
-
mediaType: string;
|
|
107
|
-
data: string;
|
|
108
|
-
} | undefined;
|
|
109
|
-
} | {
|
|
110
|
-
pending?: boolean | undefined;
|
|
111
|
-
name: string;
|
|
112
|
-
type: "tool_use";
|
|
113
|
-
id: string;
|
|
114
|
-
input: unknown;
|
|
115
|
-
} | {
|
|
116
|
-
pending?: boolean | undefined;
|
|
117
|
-
type: "tool_result";
|
|
118
|
-
content: string;
|
|
119
|
-
toolUseId: string;
|
|
120
|
-
isError?: boolean | undefined;
|
|
121
|
-
}>;
|
|
122
|
-
streamEvent: Event<GenerationStreamEvent>;
|
|
123
|
-
/**
|
|
124
|
-
* Current message.
|
|
125
|
-
*/
|
|
126
|
-
private _message?;
|
|
127
|
-
private _emitBlock;
|
|
128
|
-
private _emitUpdate;
|
|
129
|
-
/**
|
|
130
|
-
* Parse stream until end.
|
|
131
|
-
*/
|
|
132
|
-
parse(stream: GenerationStream): Promise<Message[]>;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Convert stream block to message content block.
|
|
136
|
-
*/
|
|
137
|
-
export declare const mergeMessageBlock: (contentBlock: MessageContentBlock, streamBlock: StreamBlock) => MessageContentBlock | undefined;
|
|
138
|
-
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/parser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;OAEG;IACI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAwB;IAEtC;;OAEG;IACI,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAoC;IAEhD;;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,iBACd,mBAAmB,eACpB,WAAW,KACvB,mBAAmB,GAAG,SAuFxB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type GenerateRequest, type GenerationStreamEvent } from './types';
|
|
2
|
-
export interface AIServiceClient {
|
|
3
|
-
exec(request: GenerateRequest): Promise<GenerationStream>;
|
|
4
|
-
}
|
|
5
|
-
export interface GenerationStream extends AsyncIterable<GenerationStreamEvent> {
|
|
6
|
-
abort(): void;
|
|
7
|
-
complete(): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//# 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,MAAM,SAAS,CAAC;AAG3E,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC3D;AAED,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,aAAc,QAAQ,mCAAuC,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,7 +0,0 @@
|
|
|
1
|
-
import { type GenerationStream, type AIServiceClient, type GenerateRequest } from '@dxos/assistant';
|
|
2
|
-
export declare class MockAIService implements AIServiceClient {
|
|
3
|
-
private readonly _responses;
|
|
4
|
-
constructor(_responses: string[]);
|
|
5
|
-
exec(request: GenerateRequest): Promise<GenerationStream>;
|
|
6
|
-
}
|
|
7
|
-
//# 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,EAErB,MAAM,iBAAiB,CAAC;AAIzB,qBAAa,aAAc,YAAW,eAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,MAAM,EAAE;IAI3C,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGhE"}
|
|
@@ -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,SACxB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,gBACH;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,KACvD,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"}
|