@dxos/plugin-assistant 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a
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/{BlueprintContainer-H7H4BQ2C.mjs → BlueprintContainer-WX2SSDVI.mjs} +6 -7
- package/dist/lib/browser/{BlueprintContainer-H7H4BQ2C.mjs.map → BlueprintContainer-WX2SSDVI.mjs.map} +3 -3
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs +150 -0
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-OUVSX5V5.mjs → ChatContainer-RYGNN73X.mjs} +20 -23
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-P4FLEOHG.mjs → ChatDialog-MVHH2U66.mjs} +12 -12
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-627OQ557.mjs → SequenceContainer-2FEWMQGW.mjs} +6 -19
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-AVHHQ3KV.mjs → app-graph-builder-2U7SLCRX.mjs} +22 -34
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-CMGIZAOW.mjs → chunk-2CE2KPKZ.mjs} +69 -40
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs +216 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs.map +7 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs +16 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs +18 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +7 -0
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs +296 -0
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HRLMD35M.mjs → chunk-FP56WB24.mjs} +36 -15
- package/dist/lib/browser/chunk-FP56WB24.mjs.map +7 -0
- package/dist/lib/browser/chunk-JZRZVB2A.mjs +170 -0
- package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +7 -0
- package/dist/lib/browser/chunk-WRJGOT5P.mjs +1794 -0
- package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +127 -54
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-MVOIEJXZ.mjs → intent-resolver-3GOJMBXJ.mjs} +48 -15
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-4HXS3YLT.mjs → react-surface-FTKCE6GG.mjs} +20 -76
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +7 -0
- package/dist/lib/browser/{settings-G2EZXMWT.mjs → settings-HBF32KV6.mjs} +5 -5
- package/dist/lib/browser/{settings-G2EZXMWT.mjs.map → settings-HBF32KV6.mjs.map} +1 -1
- package/dist/lib/browser/state-LXTS54DI.mjs +21 -0
- package/dist/lib/browser/state-LXTS54DI.mjs.map +7 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +199 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs → BlueprintContainer-4MKN6ZRB.mjs} +6 -7
- package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs.map → BlueprintContainer-4MKN6ZRB.mjs.map} +3 -3
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs +151 -0
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-D5FABDNE.mjs → ChatContainer-UTJGCQXF.mjs} +20 -23
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-NKWVXHJP.mjs → ChatDialog-QEYZ4IOV.mjs} +12 -12
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-EQ5NP2PG.mjs → SequenceContainer-PGGJUQ46.mjs} +6 -19
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-RMOUJMMG.mjs → app-graph-builder-OKNLR7H2.mjs} +22 -34
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs +20 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs +217 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs +297 -0
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +171 -0
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-F7RXCX5Y.mjs → chunk-TNR46C3L.mjs} +36 -15
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-AEWYMW6I.mjs → chunk-U2NYUS2N.mjs} +69 -39
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs +1795 -0
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-X6AANUHZ.mjs → chunk-XQGWSZ4T.mjs} +4 -4
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +127 -54
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-DTDNCX3C.mjs → intent-resolver-6XLVTRDJ.mjs} +48 -15
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-V6JNEZVO.mjs → react-surface-K7ZXQLAP.mjs} +20 -76
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-AIP5FOJG.mjs → settings-CWP6MTWP.mjs} +5 -5
- package/dist/lib/node-esm/{settings-AIP5FOJG.mjs.map → settings-CWP6MTWP.mjs.map} +1 -1
- package/dist/lib/node-esm/state-BO6GUFLB.mjs +22 -0
- package/dist/lib/node-esm/state-BO6GUFLB.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +200 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +2 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +8 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +2 -3
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +7 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +2 -3
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +16 -10
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +3 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +11 -4
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -4
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +112 -56
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +264 -3
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +262 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +259 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +263 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/list.d.ts.map +1 -1
- package/dist/types/src/functions/load.d.ts +1 -1
- package/dist/types/src/functions/load.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +4 -4
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +4 -10
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -5
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +2 -2
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +27 -16
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +16 -5
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +23 -6
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +21 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +90 -96
- package/src/AssistantPlugin.tsx +138 -116
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +39 -45
- package/src/capabilities/blueprint-definition.ts +51 -19
- package/src/capabilities/capabilities.ts +8 -12
- package/src/capabilities/edge-model-resolver.ts +17 -21
- package/src/capabilities/index.ts +5 -2
- package/src/capabilities/intent-resolver.ts +38 -15
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +9 -63
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +93 -31
- package/src/components/AssistantSettings/AssistantSettings.tsx +82 -75
- package/src/components/BlueprintContainer.tsx +2 -2
- package/src/components/Chat/Chat.tsx +167 -172
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +136 -0
- package/src/components/ChatContainer.tsx +13 -31
- package/src/components/ChatDialog.tsx +11 -11
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +200 -34
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +29 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatThread/ChatThread.stories.tsx +74 -205
- package/src/components/ChatThread/ChatThread.tsx +69 -29
- package/src/components/ChatThread/Link.tsx +8 -21
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +184 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/PromptSettings.tsx +1 -0
- package/src/components/SequenceContainer.tsx +27 -29
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +8 -6
- package/src/components/SequenceEditor/SequenceEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +17 -13
- package/src/components/TemplateEditor/TemplateEditor.tsx +16 -50
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +6 -8
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -1
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbar/Toolbar.tsx +21 -0
- package/src/components/{Timeline → Toolbar}/index.ts +1 -1
- package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +9 -12
- package/src/components/Toolbox/Toolbox.tsx +10 -16
- package/src/components/index.ts +3 -1
- package/src/functions/analysis.ts +6 -4
- package/src/functions/list.ts +9 -3
- package/src/functions/load.ts +8 -5
- package/src/hooks/index.ts +4 -5
- package/src/hooks/useBlueprintRegistry.ts +24 -9
- package/src/hooks/useChatProcessor.ts +19 -26
- package/src/hooks/useChatServices.ts +30 -53
- package/src/hooks/useContextBinder.ts +30 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/usePresets.ts +4 -5
- package/src/index.ts +2 -0
- package/src/meta.ts +4 -6
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +10 -3
- package/src/processor/processor.test.ts +81 -0
- package/src/processor/processor.ts +302 -0
- package/src/queue-logger.ts +5 -5
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +1 -26
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +29 -17
- package/src/types/Assistant.ts +9 -4
- package/src/types/AssistantAction.ts +11 -3
- package/src/types/service.ts +15 -7
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +0 -7
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +0 -22
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BRLHDHOF.mjs +0 -244
- package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +0 -7
- package/dist/lib/browser/chunk-HRLMD35M.mjs.map +0 -7
- package/dist/lib/browser/chunk-LKP65RPA.mjs +0 -20
- package/dist/lib/browser/chunk-LKP65RPA.mjs.map +0 -7
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs +0 -89
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +0 -7
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +0 -16
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-VEBVAHNM.mjs +0 -2231
- package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +0 -24
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +0 -7
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs +0 -105
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-LDD32477.mjs +0 -23
- package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs +0 -2232
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs +0 -90
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +0 -22
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RD755HN3.mjs +0 -245
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +0 -25
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +0 -106
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +0 -7
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -18
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/Timeline.d.ts +0 -24
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +0 -9
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/index.d.ts +0 -2
- package/dist/types/src/components/Timeline/index.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -72
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/errors.d.ts +0 -4
- package/dist/types/src/hooks/errors.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
- package/dist/types/src/hooks/useResolveRef.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -268
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -5
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -5
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -5
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +0 -8
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -5
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -8
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/index.d.ts +0 -3
- package/dist/types/src/stories/hooks/index.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useFlush.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +0 -3
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -142
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -26
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/src/components/ChatThread/ChatMessage.tsx +0 -282
- package/src/components/ChatThread/ToolBlock.tsx +0 -125
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/Timeline/Timeline.stories.tsx +0 -53
- package/src/components/Timeline/Timeline.tsx +0 -159
- package/src/hooks/chat-processor.ts +0 -260
- package/src/hooks/errors.ts +0 -8
- package/src/hooks/useResolveRef.ts +0 -33
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -74
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -317
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -80
- package/src/stories/components/GraphContainer.tsx +0 -118
- package/src/stories/components/LoggingContainer.tsx +0 -22
- package/src/stories/components/SurfaceContainer.tsx +0 -62
- package/src/stories/components/TasksContainer.tsx +0 -51
- package/src/stories/components/index.ts +0 -12
- package/src/stories/components/types.ts +0 -11
- package/src/stories/hooks/index.ts +0 -6
- package/src/stories/hooks/useMatcherExtension.ts +0 -45
- package/src/stories/testing/data.ts +0 -130
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/testing.tsx +0 -162
- package/src/testing/test-functions.ts +0 -16
- package/src/tools/function.ts +0 -49
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -219
- package/src/tools/openapi.ts +0 -341
- package/src/typings.d.ts +0 -9
- /package/dist/types/src/{stories/hooks → hooks}/useFlush.d.ts +0 -0
- /package/src/{stories/hooks → hooks}/useFlush.ts +0 -0
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Capabilities,
|
|
7
|
-
Events,
|
|
8
|
-
IntentPlugin,
|
|
9
|
-
type Plugin,
|
|
10
|
-
SettingsPlugin,
|
|
11
|
-
contributes,
|
|
12
|
-
defineModule,
|
|
13
|
-
definePlugin,
|
|
14
|
-
} from '@dxos/app-framework';
|
|
15
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
16
|
-
import { AiContextBinder } from '@dxos/assistant';
|
|
17
|
-
import {
|
|
18
|
-
DESIGN_BLUEPRINT,
|
|
19
|
-
PLANNING_BLUEPRINT,
|
|
20
|
-
RESEARCH_BLUEPRINT,
|
|
21
|
-
readDocument,
|
|
22
|
-
readTasks,
|
|
23
|
-
remoteServiceEndpoints,
|
|
24
|
-
research,
|
|
25
|
-
updateDocument,
|
|
26
|
-
updateTasks,
|
|
27
|
-
} from '@dxos/assistant-testing';
|
|
28
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
29
|
-
import { type Space } from '@dxos/client/echo';
|
|
30
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
31
|
-
import { log } from '@dxos/log';
|
|
32
|
-
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
33
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
34
|
-
import { type ClientPluginOptions } from '@dxos/plugin-client/types';
|
|
35
|
-
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
36
|
-
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
37
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
38
|
-
import { Config } from '@dxos/react-client';
|
|
39
|
-
import { type DataType } from '@dxos/schema';
|
|
40
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
41
|
-
|
|
42
|
-
import { AssistantPlugin } from '../../AssistantPlugin';
|
|
43
|
-
import { Assistant } from '../../types';
|
|
44
|
-
|
|
45
|
-
// TODO(burdon): Factor out.
|
|
46
|
-
export const config = {
|
|
47
|
-
remote: new Config({
|
|
48
|
-
runtime: {
|
|
49
|
-
services: {
|
|
50
|
-
ai: {
|
|
51
|
-
// TODO(burdon): Normalize props ('url'?)
|
|
52
|
-
server: remoteServiceEndpoints.ai,
|
|
53
|
-
},
|
|
54
|
-
edge: {
|
|
55
|
-
url: remoteServiceEndpoints.edge,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
}),
|
|
60
|
-
persistent: new Config({
|
|
61
|
-
runtime: {
|
|
62
|
-
client: {
|
|
63
|
-
storage: {
|
|
64
|
-
persistent: true,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
services: {
|
|
68
|
-
ai: {
|
|
69
|
-
server: remoteServiceEndpoints.ai,
|
|
70
|
-
},
|
|
71
|
-
edge: {
|
|
72
|
-
url: remoteServiceEndpoints.edge,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
}),
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
type DecoratorsProps = Omit<ClientPluginOptions, 'onClientInitialized' | 'onSpacesReady'> & {
|
|
80
|
-
plugins?: Plugin[];
|
|
81
|
-
accessTokens?: DataType.AccessToken[];
|
|
82
|
-
onInit?: (props: { space: Space; chat: Assistant.Chat; binder: AiContextBinder }) => Promise<void>;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Create storybook decorators.
|
|
87
|
-
*/
|
|
88
|
-
export const getDecorators = ({ types = [], plugins = [], accessTokens = [], onInit, ...props }: DecoratorsProps) => [
|
|
89
|
-
withPluginManager({
|
|
90
|
-
plugins: [
|
|
91
|
-
// System plugins.
|
|
92
|
-
AttentionPlugin(),
|
|
93
|
-
GraphPlugin(),
|
|
94
|
-
IntentPlugin(),
|
|
95
|
-
SettingsPlugin(),
|
|
96
|
-
SpacePlugin(),
|
|
97
|
-
ClientPlugin({
|
|
98
|
-
types: [Markdown.Document, Assistant.Chat, Blueprint.Blueprint, ...types],
|
|
99
|
-
onClientInitialized: async ({ client }) => {
|
|
100
|
-
log.info('onClientInitialized', { identity: client.halo.identity.get()?.did });
|
|
101
|
-
// Abort if already initialized.
|
|
102
|
-
if (client.halo.identity.get()) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
await client.halo.createIdentity();
|
|
107
|
-
await client.spaces.waitUntilReady();
|
|
108
|
-
|
|
109
|
-
const space = client.spaces.default;
|
|
110
|
-
// TODO(burdon): Should not require this.
|
|
111
|
-
// ERROR: invariant violation: Database was not initialized with root object.
|
|
112
|
-
// TODO(burdon): onSpacesReady is never called.
|
|
113
|
-
await space.waitUntilReady();
|
|
114
|
-
|
|
115
|
-
// Add tokens.
|
|
116
|
-
for (const accessToken of accessTokens) {
|
|
117
|
-
space.db.add(Obj.clone(accessToken));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Create chat and queue.
|
|
121
|
-
const chat = space.db.add(
|
|
122
|
-
Obj.make(Assistant.Chat, {
|
|
123
|
-
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
124
|
-
}),
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
await space.db.flush({ indexes: true });
|
|
128
|
-
await onInit?.({ space, chat, binder: new AiContextBinder(await chat.queue.load()) });
|
|
129
|
-
await space.db.flush({ indexes: true });
|
|
130
|
-
},
|
|
131
|
-
...props,
|
|
132
|
-
}),
|
|
133
|
-
|
|
134
|
-
// User plugins.
|
|
135
|
-
AssistantPlugin(),
|
|
136
|
-
|
|
137
|
-
// Custom.
|
|
138
|
-
definePlugin({ id: 'example.com/plugin/testing', name: 'Testing' }, [
|
|
139
|
-
defineModule({
|
|
140
|
-
id: 'example.com/plugin/testing/module/testing',
|
|
141
|
-
activatesOn: Events.SetupArtifactDefinition,
|
|
142
|
-
activate: () => [
|
|
143
|
-
contributes(Capabilities.BlueprintDefinition, DESIGN_BLUEPRINT),
|
|
144
|
-
contributes(Capabilities.BlueprintDefinition, PLANNING_BLUEPRINT),
|
|
145
|
-
contributes(Capabilities.BlueprintDefinition, RESEARCH_BLUEPRINT),
|
|
146
|
-
contributes(Capabilities.Functions, [readDocument, updateDocument]),
|
|
147
|
-
contributes(Capabilities.Functions, [readTasks, updateTasks]),
|
|
148
|
-
contributes(Capabilities.Functions, [research]),
|
|
149
|
-
],
|
|
150
|
-
}),
|
|
151
|
-
]),
|
|
152
|
-
|
|
153
|
-
// Test-specific.
|
|
154
|
-
...plugins,
|
|
155
|
-
],
|
|
156
|
-
}),
|
|
157
|
-
withLayout({
|
|
158
|
-
fullscreen: true,
|
|
159
|
-
classNames: 'justify-center bg-deckSurface',
|
|
160
|
-
}),
|
|
161
|
-
withTheme,
|
|
162
|
-
];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { DEFAULT_EDGE_MODEL } from '@dxos/ai';
|
|
6
|
-
import { createSystemPrompt } from '@dxos/assistant';
|
|
7
|
-
|
|
8
|
-
import { type AiChatProcessorOptions } from '../hooks';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
*/
|
|
13
|
-
export const createProcessorOptions = (): Pick<AiChatProcessorOptions, 'model' | 'system'> => ({
|
|
14
|
-
model: DEFAULT_EDGE_MODEL,
|
|
15
|
-
system: createSystemPrompt({}),
|
|
16
|
-
});
|
package/src/tools/function.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// ISSUE(burdon): deprecated types: ToolResult
|
|
6
|
-
|
|
7
|
-
import { type ExecutableTool, ToolResult, createTool } from '@dxos/ai';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';
|
|
10
|
-
import { type FunctionType } from '@dxos/functions';
|
|
11
|
-
import { log } from '@dxos/log';
|
|
12
|
-
import { type SpaceId } from '@dxos/react-client/echo';
|
|
13
|
-
import { getMeta } from '@dxos/react-client/echo';
|
|
14
|
-
|
|
15
|
-
// TODO(burdon): Move to @dxos/ai.
|
|
16
|
-
export const convertFunctionToTool = (
|
|
17
|
-
fn: FunctionType,
|
|
18
|
-
edgeUrl: string,
|
|
19
|
-
spaceId?: SpaceId | undefined,
|
|
20
|
-
): ExecutableTool | undefined => {
|
|
21
|
-
if (!fn.description || !fn.inputSchema) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
const existingFunctionUrl = getUserFunctionUrlInMetadata(getMeta(fn));
|
|
25
|
-
if (!existingFunctionUrl) {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const url = getInvocationUrl(existingFunctionUrl, edgeUrl, { spaceId });
|
|
30
|
-
|
|
31
|
-
// TODO(burdon): Should be DXN?
|
|
32
|
-
return createTool('user-function', {
|
|
33
|
-
name: fn.name,
|
|
34
|
-
description: fn.description,
|
|
35
|
-
schema: Type.toEffectSchema(fn.inputSchema),
|
|
36
|
-
execute: async (input) => {
|
|
37
|
-
log.info('execute function tool', { name: fn.name, url, input });
|
|
38
|
-
const response = await fetch(url, {
|
|
39
|
-
method: 'POST',
|
|
40
|
-
headers: {
|
|
41
|
-
'Content-Type': 'application/json',
|
|
42
|
-
},
|
|
43
|
-
body: JSON.stringify(input),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return ToolResult.Success(await response.text());
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
};
|
package/src/tools/index.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, expect, test } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { log } from '@dxos/log';
|
|
8
|
-
|
|
9
|
-
import { AiChatProcessor } from '../hooks';
|
|
10
|
-
import { type ApiAuthorization } from '../types';
|
|
11
|
-
|
|
12
|
-
import { createToolsFromApi, resolveAuthorization } from './openapi';
|
|
13
|
-
|
|
14
|
-
describe.skip('openapi', () => {
|
|
15
|
-
describe.skip('mapping', () => {
|
|
16
|
-
test('amadeus flight availabilities', async () => {
|
|
17
|
-
const tools = await createToolsFromApi(FLIGHT_SEARCH_API);
|
|
18
|
-
log.info('tools', { tools });
|
|
19
|
-
// for (const tool of tools) {
|
|
20
|
-
// const schema = tool.parameters;
|
|
21
|
-
// // log.info('schema', { schema });
|
|
22
|
-
// }
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('amadeus hotel search', async () => {
|
|
26
|
-
const tools = await createToolsFromApi(HOTEL_SEARCH_API);
|
|
27
|
-
log.info('tools', { tools });
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('amadeus hotel name autocomplete', async () => {
|
|
31
|
-
const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API);
|
|
32
|
-
log.info('tools', { tools });
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('weather', async () => {
|
|
36
|
-
const tools = await createToolsFromApi(WEATHER_API, { authorization: VISUAL_CROSSING_CREDENTIALS });
|
|
37
|
-
log.info('tools', { tools });
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe.skip('invoke tools', () => {
|
|
42
|
-
test('amadeus hotel name autocomplete', async () => {
|
|
43
|
-
const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API, { authorization: AMADEUS_AUTH });
|
|
44
|
-
const result = await tools[0].execute(
|
|
45
|
-
{
|
|
46
|
-
keyword: 'William Vale Brooklyn',
|
|
47
|
-
subType: ['HOTEL_LEISURE', 'HOTEL_GDS'],
|
|
48
|
-
countryCode: 'US',
|
|
49
|
-
},
|
|
50
|
-
{},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
log.info('result', { result });
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('weather API', async () => {
|
|
57
|
-
const tools = await createToolsFromApi(WEATHER_API, { authorization: VISUAL_CROSSING_CREDENTIALS });
|
|
58
|
-
const forecastTool = tools.find((tool) => tool.name.includes('forecast'));
|
|
59
|
-
const result = await forecastTool?.execute(
|
|
60
|
-
{
|
|
61
|
-
locations: 'Brooklyn, NY',
|
|
62
|
-
aggregateHours: '24',
|
|
63
|
-
},
|
|
64
|
-
{},
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
log.info('result', { result });
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// ISSUE(burdon): tools
|
|
72
|
-
describe.skip('AI uses tools', () => {
|
|
73
|
-
test('amadeus flight availabilities', { timeout: 60_000 }, async () => {
|
|
74
|
-
const tools = await createToolsFromApi(FLIGHT_SEARCH_API, { authorization: AMADEUS_AUTH });
|
|
75
|
-
// const aiClient = new Edge AiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
76
|
-
// TODO(dmaretskyi): FIX ME.
|
|
77
|
-
const processor = new AiChatProcessor(null as any, null as any);
|
|
78
|
-
const reply = await processor.request(
|
|
79
|
-
`What is the cheapest flight from New York to Paris? going on ${new Date().toISOString()} and returning after a week. 1 adult traveler`,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
log.info('reply', { reply });
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// TODO(dmaretskyi): Doesn't work.
|
|
86
|
-
test('amadeus hotel name autocomplete', { timeout: 60_000 }, async () => {
|
|
87
|
-
const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API, { authorization: AMADEUS_AUTH });
|
|
88
|
-
// const aiClient = new Edge AiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
89
|
-
// TODO(dmaretskyi): FIX ME.
|
|
90
|
-
const processor = new AiChatProcessor(null as any, null as any);
|
|
91
|
-
const reply = await processor.request('Find me the William Wale in Brooklyn New York');
|
|
92
|
-
|
|
93
|
-
log.info('reply', { reply });
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test.only('weather forecast', { timeout: 60_000 }, async () => {
|
|
97
|
-
const tools = await createToolsFromApi(WEATHER_API, {
|
|
98
|
-
authorization: VISUAL_CROSSING_CREDENTIALS,
|
|
99
|
-
instructions: WEATHER_INSTRUCTIONS,
|
|
100
|
-
});
|
|
101
|
-
// const aiClient = new Edge AiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
102
|
-
// TODO(dmaretskyi): FIX ME.
|
|
103
|
-
const processor = new AiChatProcessor(null as any, null as any);
|
|
104
|
-
const reply = await processor.request(
|
|
105
|
-
`Today's date is ${new Date().toISOString().split('T')[0]}. Give me weather forecast for Warsaw for next 5 days.`,
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
log.info('reply', { reply });
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe.skip('invoke api directly', { timeout: 10_000 }, () => {
|
|
113
|
-
test('amadeus flight availabilities', async () => {
|
|
114
|
-
const response = await fetch('https://test.api.amadeus.com/v1/shopping/availability/flight-availabilities', {
|
|
115
|
-
method: 'POST',
|
|
116
|
-
headers: {
|
|
117
|
-
accept: 'application/vnd.amadeus+json',
|
|
118
|
-
'X-HTTP-Method-Override': 'GET',
|
|
119
|
-
'Content-Type': 'application/vnd.amadeus+json',
|
|
120
|
-
Authorization: await resolveAuthorization(AMADEUS_AUTH),
|
|
121
|
-
},
|
|
122
|
-
body: JSON.stringify({
|
|
123
|
-
originDestinations: [
|
|
124
|
-
{
|
|
125
|
-
departureDateTime: {
|
|
126
|
-
date: new Date().toISOString().split('T')[0],
|
|
127
|
-
time: new Date().toTimeString().split(' ')[0],
|
|
128
|
-
},
|
|
129
|
-
destinationLocationCode: 'MAD',
|
|
130
|
-
id: '1',
|
|
131
|
-
originLocationCode: 'BOS',
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
sources: ['GDS'],
|
|
135
|
-
travelers: [
|
|
136
|
-
{
|
|
137
|
-
id: '1',
|
|
138
|
-
travelerType: 'ADULT',
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
}),
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
log.info('response', { status: response.status, body: await response.json() });
|
|
145
|
-
expect(response.status).toBe(200);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test.only('amadeus hotel name autocomplete', async () => {
|
|
149
|
-
const response = await fetch(
|
|
150
|
-
'https://test.api.amadeus.com/v1/reference-data/locations/hotel?keyword=PARI&subtype=HOTEL_LEISURE,HOTEL_GDS',
|
|
151
|
-
{
|
|
152
|
-
method: 'GET',
|
|
153
|
-
headers: {
|
|
154
|
-
// accept: 'application/vnd.amadeus+json',
|
|
155
|
-
// 'X-HTTP-Method-Override': 'GET',
|
|
156
|
-
Authorization: await resolveAuthorization(AMADEUS_AUTH),
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
log.info('response', { status: response.status, body: await response.json() });
|
|
162
|
-
expect(response.status).toBe(200);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe.skip('rapidapi', () => {
|
|
167
|
-
test('amadeus flight availabilities', async () => {
|
|
168
|
-
const departureDate = new Date().toISOString().split('T')[0];
|
|
169
|
-
const arrivalDate = new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
|
170
|
-
|
|
171
|
-
const url = `https://amadeus-api2.p.rapidapi.com/serpapi-flight-search?departure_id=PEK&arrival_id=AUS&outbound_date=${departureDate}&return_date=${arrivalDate}¤cy=USD&hl=en`;
|
|
172
|
-
const options = {
|
|
173
|
-
method: 'GET',
|
|
174
|
-
headers: {
|
|
175
|
-
'x-rapidapi-key': RAPID_API_CREDENTIALS.key,
|
|
176
|
-
'x-rapidapi-host': 'amadeus-api2.p.rapidapi.com',
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const response = await fetch(url, options);
|
|
181
|
-
log.info('response', { status: response.status, body: await response.json() });
|
|
182
|
-
expect(response.status).toBe(200);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
const FLIGHT_SEARCH_API =
|
|
188
|
-
'https://api.apis.guru/v2/specs/amadeus.com/amadeus-flight-availabilities-search/1.0.2/swagger.json';
|
|
189
|
-
const HOTEL_SEARCH_API = 'https://api.apis.guru/v2/specs/amadeus.com/amadeus-hotel-search/3.0.8/swagger.json';
|
|
190
|
-
const HOTEL_NAME_AUTOCOMPLETE_API =
|
|
191
|
-
'https://api.apis.guru/v2/specs/amadeus.com/amadeus-hotel-name-autocomplete/1.0.3/swagger.json';
|
|
192
|
-
const WEATHER_API = 'https://api.apis.guru/v2/specs/visualcrossing.com/weather/4.6/openapi.json';
|
|
193
|
-
|
|
194
|
-
const WEATHER_INSTRUCTIONS = `
|
|
195
|
-
If the user doesn't provide a date, use today's date.
|
|
196
|
-
Make sure to provide the start and end dates when possible to reduce the amount of data returned.
|
|
197
|
-
Use the tool that accepts the date parameters.
|
|
198
|
-
`;
|
|
199
|
-
|
|
200
|
-
const AMADEUS_AUTH: ApiAuthorization = {
|
|
201
|
-
type: 'oauth',
|
|
202
|
-
clientId: 'BOEnpLd1sMyKjAPGKYeAPFFy60u53QEG',
|
|
203
|
-
clientSecret: 'n4qldSN7usvD57gm',
|
|
204
|
-
tokenUrl: 'https://test.api.amadeus.com/v1/security/oauth2/token',
|
|
205
|
-
grantType: 'client_credentials',
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
const VISUAL_CROSSING_CREDENTIALS: ApiAuthorization = {
|
|
209
|
-
type: 'api-key',
|
|
210
|
-
key: 'FDPRVS953KB4GQQLD25GRT975',
|
|
211
|
-
placement: {
|
|
212
|
-
type: 'query',
|
|
213
|
-
name: 'key',
|
|
214
|
-
},
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
const RAPID_API_CREDENTIALS = {
|
|
218
|
-
key: '92271b6740msh32fd821d70f050dp16665bjsna69195c9e838',
|
|
219
|
-
};
|