@dxos/plugin-automation 0.7.5-labs.e27f9b9 → 0.7.5-labs.ea4b4c2
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/AutomationPanel-VW2XIUPU.mjs +8 -0
- package/dist/lib/browser/ChatContainer-5TAVTN3T.mjs +12 -0
- package/dist/lib/browser/{ai-client-AARXEMMJ.mjs → ai-client-5CNY6JBF.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-B4U34VSR.mjs → app-graph-builder-FZGK55G7.mjs} +39 -4
- package/dist/lib/browser/app-graph-builder-FZGK55G7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HZ4TA7HY.mjs → chunk-2H2EUYXL.mjs} +2 -2
- package/dist/lib/browser/{chunk-5SLV6AUA.mjs → chunk-DVE33EZL.mjs} +525 -290
- package/dist/lib/browser/chunk-DVE33EZL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IYSMXX6Q.mjs → chunk-MJK7GL5P.mjs} +68 -44
- package/dist/lib/browser/chunk-MJK7GL5P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RAVNWHNE.mjs → chunk-NQFZ6XRX.mjs} +6 -5
- package/dist/lib/browser/chunk-NQFZ6XRX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7XADMUOW.mjs → chunk-Q4IMHYGH.mjs} +21 -76
- package/dist/lib/browser/chunk-Q4IMHYGH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HKX3D3ZP.mjs → chunk-R4JH4TLE.mjs} +4 -2
- package/dist/lib/browser/chunk-R4JH4TLE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +21 -15
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-754MPV7H.mjs → intent-resolver-BWAXKT27.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-4QZ6AKBF.mjs → react-surface-ILBDBZCN.mjs} +17 -9
- package/dist/lib/browser/react-surface-ILBDBZCN.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -6
- package/dist/lib/node/{AutomationPanel-LRDEDGXI.cjs → AutomationPanel-G6EDDYWW.cjs} +7 -7
- package/dist/lib/node/{AutomationPanel-LRDEDGXI.cjs.map → AutomationPanel-G6EDDYWW.cjs.map} +2 -2
- package/dist/lib/node/{ChatContainer-6LZX4K2Z.cjs → ChatContainer-EN24W3K4.cjs} +10 -10
- package/dist/lib/node/ChatContainer-EN24W3K4.cjs.map +7 -0
- package/dist/lib/node/{ai-client-SA35GN5Q.cjs → ai-client-FKLPDELV.cjs} +7 -7
- package/dist/lib/node/{app-graph-builder-ENVDOPS4.cjs → app-graph-builder-T76NYV42.cjs} +48 -14
- package/dist/lib/node/app-graph-builder-T76NYV42.cjs.map +7 -0
- package/dist/lib/node/{chunk-6VMSH4P6.cjs → chunk-CJGJXNY3.cjs} +549 -327
- package/dist/lib/node/chunk-CJGJXNY3.cjs.map +7 -0
- package/dist/lib/node/{chunk-5VF5JKUN.cjs → chunk-EQYHOTGG.cjs} +8 -5
- package/dist/lib/node/chunk-EQYHOTGG.cjs.map +7 -0
- package/dist/lib/node/chunk-GB7245FH.cjs +173 -0
- package/dist/lib/node/chunk-GB7245FH.cjs.map +7 -0
- package/dist/lib/node/{chunk-HEYQONXC.cjs → chunk-HMBKP6VG.cjs} +82 -60
- package/dist/lib/node/chunk-HMBKP6VG.cjs.map +7 -0
- package/dist/lib/node/{chunk-WWU5FVAO.cjs → chunk-QXIHYOMF.cjs} +10 -9
- package/dist/lib/node/chunk-QXIHYOMF.cjs.map +7 -0
- package/dist/lib/node/{chunk-ZS5RZ7RM.cjs → chunk-U5Z7LFWB.cjs} +6 -6
- package/dist/lib/node/index.cjs +81 -75
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-CNVBSG4E.cjs → intent-resolver-C6OKFVEW.cjs} +8 -8
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-5HYLBDC3.cjs → react-surface-LWDY7SQG.cjs} +24 -18
- package/dist/lib/node/react-surface-LWDY7SQG.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +13 -13
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{AutomationPanel-ZV7VEEPP.mjs → AutomationPanel-V3IWQAMO.mjs} +3 -3
- package/dist/lib/node-esm/{ChatContainer-PPVMC2FC.mjs → ChatContainer-CNTY3C2D.mjs} +5 -5
- package/dist/lib/node-esm/{ai-client-2ZA4TYFZ.mjs → ai-client-XGNA6SJ5.mjs} +3 -3
- package/dist/lib/node-esm/{app-graph-builder-IYOUCQZT.mjs → app-graph-builder-IJQEN7WT.mjs} +39 -4
- package/dist/lib/node-esm/app-graph-builder-IJQEN7WT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MS7OIGVR.mjs → chunk-6HLBYDUI.mjs} +6 -5
- package/dist/lib/node-esm/chunk-6HLBYDUI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-EVTLHDM2.mjs → chunk-DNCXRGAF.mjs} +21 -76
- package/dist/lib/node-esm/chunk-DNCXRGAF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-X3LPRWIL.mjs → chunk-EMVA6QUT.mjs} +4 -2
- package/dist/lib/node-esm/chunk-EMVA6QUT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ISYLEDVU.mjs → chunk-IJRTDSKN.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-WISKXX7U.mjs → chunk-QP47VJT6.mjs} +525 -290
- package/dist/lib/node-esm/chunk-QP47VJT6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3KB5HRXA.mjs → chunk-ZLIAMW45.mjs} +68 -44
- package/dist/lib/node-esm/chunk-ZLIAMW45.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +21 -15
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-RQBXW442.mjs → intent-resolver-DCP4ZDBA.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-SS5WCRJ2.mjs → react-surface-SBDXFVIN.mjs} +17 -9
- package/dist/lib/node-esm/react-surface-SBDXFVIN.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -6
- package/dist/types/src/capabilities/app-graph-builder.d.ts +23 -22
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts +3 -0
- package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts.map +1 -0
- package/dist/types/src/components/AmbientChatDialog/index.d.ts +2 -0
- package/dist/types/src/components/AmbientChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/components/Box/StatusLine.d.ts.map +1 -0
- package/dist/types/src/components/Box/StatusLine.stories.d.ts.map +1 -0
- package/dist/types/src/components/Box/Tabbed.d.ts +15 -0
- package/dist/types/src/components/Box/Tabbed.d.ts.map +1 -0
- package/dist/types/src/components/Box/Tabbed.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Thread → Box}/ToggleContainer.d.ts +3 -3
- package/dist/types/src/components/Box/ToggleContainer.d.ts.map +1 -0
- package/dist/types/src/components/Box/ToggleContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/Box/index.d.ts +4 -0
- package/dist/types/src/components/Box/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +0 -1
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +7 -0
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +8 -0
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/index.d.ts +2 -0
- package/dist/types/src/components/Prompt/index.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts +20 -0
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts.map +1 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +1 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +1 -0
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +3 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/processor.d.ts +7 -2
- package/dist/types/src/hooks/processor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts +41 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -0
- package/dist/types/src/hooks/useServices.d.ts +7 -0
- package/dist/types/src/hooks/useServices.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/{testing.d.ts → test-functions.d.ts} +1 -1
- package/dist/types/src/testing/test-functions.d.ts.map +1 -0
- package/dist/types/src/testing/test-services.d.ts +5 -0
- package/dist/types/src/testing/test-services.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/registry.d.ts +7 -6
- package/dist/types/src/types/registry.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +94 -69
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/package.json +52 -50
- package/src/AutomationPlugin.tsx +7 -7
- package/src/capabilities/app-graph-builder.ts +34 -3
- package/src/capabilities/react-surface.tsx +12 -4
- package/src/components/AmbientChatDialog/AmbientChatDialog.tsx +26 -0
- package/src/components/AmbientChatDialog/index.ts +5 -0
- package/src/components/{Thread → Box}/StatusLine.tsx +1 -1
- package/src/components/{Thread → Box}/Tabbed.stories.tsx +2 -3
- package/src/components/Box/Tabbed.tsx +89 -0
- package/src/components/{Thread → Box}/ToggleContainer.stories.tsx +1 -2
- package/src/components/{Thread → Box}/ToggleContainer.tsx +28 -23
- package/src/components/Box/index.ts +7 -0
- package/src/components/ChatContainer/ChatContainer.tsx +15 -80
- package/src/components/Prompt/Prompt.stories.tsx +50 -0
- package/src/components/Prompt/Prompt.tsx +36 -0
- package/src/components/Prompt/index.ts +5 -0
- package/src/components/Prompt/prompt-autocomplete.ts +200 -0
- package/src/components/PromptEditor/PromptEditor.stories.tsx +3 -3
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +2 -1
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +7 -7
- package/src/components/Thread/Thread.stories.tsx +8 -1
- package/src/components/Thread/Thread.tsx +2 -2
- package/src/components/Thread/ThreadMessage.tsx +58 -28
- package/src/components/TriggerEditor/TriggerEditor.tsx +8 -5
- package/src/components/index.ts +1 -0
- package/src/hooks/index.ts +3 -1
- package/src/hooks/processor.ts +16 -7
- package/src/hooks/useChatProcessor.tsx +86 -0
- package/src/hooks/useMessageQueue.ts +23 -0
- package/src/hooks/{useServiceRegistry.ts → useServices.ts} +8 -2
- package/src/meta.ts +4 -1
- package/src/testing/index.ts +2 -1
- package/src/testing/test-services.ts +131 -0
- package/src/translations.ts +1 -0
- package/src/types/registry.ts +17 -80
- package/src/types/schema.ts +20 -8
- package/dist/lib/browser/AutomationPanel-WFJZAW4F.mjs +0 -8
- package/dist/lib/browser/ChatContainer-OFCOZ5T2.mjs +0 -12
- package/dist/lib/browser/app-graph-builder-B4U34VSR.mjs.map +0 -7
- package/dist/lib/browser/chunk-5SLV6AUA.mjs.map +0 -7
- package/dist/lib/browser/chunk-7XADMUOW.mjs.map +0 -7
- package/dist/lib/browser/chunk-HKX3D3ZP.mjs.map +0 -7
- package/dist/lib/browser/chunk-IYSMXX6Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-RAVNWHNE.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4QZ6AKBF.mjs.map +0 -7
- package/dist/lib/node/ChatContainer-6LZX4K2Z.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-ENVDOPS4.cjs.map +0 -7
- package/dist/lib/node/chunk-5VF5JKUN.cjs.map +0 -7
- package/dist/lib/node/chunk-6VMSH4P6.cjs.map +0 -7
- package/dist/lib/node/chunk-HEYQONXC.cjs.map +0 -7
- package/dist/lib/node/chunk-LU4HQWJD.cjs +0 -226
- package/dist/lib/node/chunk-LU4HQWJD.cjs.map +0 -7
- package/dist/lib/node/chunk-WWU5FVAO.cjs.map +0 -7
- package/dist/lib/node/react-surface-5HYLBDC3.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IYOUCQZT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3KB5HRXA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EVTLHDM2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS7OIGVR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WISKXX7U.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X3LPRWIL.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SS5WCRJ2.mjs.map +0 -7
- package/dist/types/src/components/Thread/ScrollContainer.d.ts +0 -15
- package/dist/types/src/components/Thread/ScrollContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/StatusLine.d.ts.map +0 -1
- package/dist/types/src/components/Thread/StatusLine.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Tabbed.d.ts +0 -9
- package/dist/types/src/components/Thread/Tabbed.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Tabbed.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToggleContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToggleContainer.stories.d.ts.map +0 -1
- package/dist/types/src/hooks/useServiceRegistry.d.ts +0 -3
- package/dist/types/src/hooks/useServiceRegistry.d.ts.map +0 -1
- package/dist/types/src/testing/testing.d.ts.map +0 -1
- package/src/components/Thread/ScrollContainer.tsx +0 -92
- package/src/components/Thread/Tabbed.tsx +0 -72
- /package/dist/lib/browser/{AutomationPanel-WFJZAW4F.mjs.map → AutomationPanel-VW2XIUPU.mjs.map} +0 -0
- /package/dist/lib/browser/{ChatContainer-OFCOZ5T2.mjs.map → ChatContainer-5TAVTN3T.mjs.map} +0 -0
- /package/dist/lib/browser/{ai-client-AARXEMMJ.mjs.map → ai-client-5CNY6JBF.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-HZ4TA7HY.mjs.map → chunk-2H2EUYXL.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-754MPV7H.mjs.map → intent-resolver-BWAXKT27.mjs.map} +0 -0
- /package/dist/lib/node/{ai-client-SA35GN5Q.cjs.map → ai-client-FKLPDELV.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-ZS5RZ7RM.cjs.map → chunk-U5Z7LFWB.cjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-CNVBSG4E.cjs.map → intent-resolver-C6OKFVEW.cjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-ZV7VEEPP.mjs.map → AutomationPanel-V3IWQAMO.mjs.map} +0 -0
- /package/dist/lib/node-esm/{ChatContainer-PPVMC2FC.mjs.map → ChatContainer-CNTY3C2D.mjs.map} +0 -0
- /package/dist/lib/node-esm/{ai-client-2ZA4TYFZ.mjs.map → ai-client-XGNA6SJ5.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-ISYLEDVU.mjs.map → chunk-IJRTDSKN.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-RQBXW442.mjs.map → intent-resolver-DCP4ZDBA.mjs.map} +0 -0
- /package/dist/types/src/components/{Thread → Box}/StatusLine.d.ts +0 -0
- /package/dist/types/src/components/{Thread → Box}/StatusLine.stories.d.ts +0 -0
- /package/dist/types/src/components/{Thread → Box}/Tabbed.stories.d.ts +0 -0
- /package/dist/types/src/components/{Thread → Box}/ToggleContainer.stories.d.ts +0 -0
- /package/src/components/{Thread → Box}/StatusLine.stories.tsx +0 -0
- /package/src/testing/{testing.ts → test-functions.ts} +0 -0
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_CJGJXNY3_exports = {};
|
|
30
|
+
__export(chunk_CJGJXNY3_exports, {
|
|
31
31
|
AiClient: () => AiClient,
|
|
32
32
|
AppGraphBuilder: () => AppGraphBuilder,
|
|
33
33
|
ChatContainer: () => ChatContainer,
|
|
@@ -36,88 +36,92 @@ __export(chunk_6VMSH4P6_exports, {
|
|
|
36
36
|
MarkdownViewer: () => MarkdownViewer,
|
|
37
37
|
ReactSurface: () => ReactSurface,
|
|
38
38
|
Thread: () => Thread,
|
|
39
|
-
|
|
39
|
+
useServices: () => useServices
|
|
40
40
|
});
|
|
41
|
-
module.exports = __toCommonJS(
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
41
|
+
module.exports = __toCommonJS(chunk_CJGJXNY3_exports);
|
|
42
|
+
var import_chunk_U5Z7LFWB = require("./chunk-U5Z7LFWB.cjs");
|
|
43
|
+
var import_chunk_GB7245FH = require("./chunk-GB7245FH.cjs");
|
|
44
|
+
var import_chunk_EQYHOTGG = require("./chunk-EQYHOTGG.cjs");
|
|
45
45
|
var import_react = __toESM(require("react"));
|
|
46
|
-
var import_app_framework = require("@dxos/app-framework");
|
|
47
|
-
var import_artifact = require("@dxos/artifact");
|
|
48
|
-
var import_functions = require("@dxos/functions");
|
|
49
46
|
var import_invariant = require("@dxos/invariant");
|
|
50
|
-
var import_keys = require("@dxos/keys");
|
|
51
|
-
var import_react_client = require("@dxos/react-client");
|
|
52
|
-
var import_echo = require("@dxos/react-client/echo");
|
|
53
|
-
var import_react_edge_client = require("@dxos/react-edge-client");
|
|
54
47
|
var import_react_ui_stack = require("@dxos/react-ui-stack");
|
|
55
|
-
var import_util = require("@dxos/util");
|
|
56
|
-
var import_app_framework2 = require("@dxos/app-framework");
|
|
57
48
|
var import_signals_core = require("@preact/signals-core");
|
|
58
|
-
var
|
|
49
|
+
var import_artifact = require("@dxos/artifact");
|
|
59
50
|
var import_assistant = require("@dxos/assistant");
|
|
60
51
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
61
52
|
var import_invariant2 = require("@dxos/invariant");
|
|
62
53
|
var import_log = require("@dxos/log");
|
|
63
54
|
var import_react2 = require("react");
|
|
55
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
56
|
+
var import_artifact2 = require("@dxos/artifact");
|
|
57
|
+
var import_functions = require("@dxos/functions");
|
|
58
|
+
var import_react_client = require("@dxos/react-client");
|
|
59
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
60
|
+
var import_util = require("@dxos/util");
|
|
61
|
+
var import_app_framework2 = require("@dxos/app-framework");
|
|
62
|
+
var import_artifact3 = require("@dxos/artifact");
|
|
63
|
+
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
64
|
+
var import_functions2 = require("@dxos/functions");
|
|
65
|
+
var import_log2 = require("@dxos/log");
|
|
66
|
+
var import_echo2 = require("@dxos/react-client/echo");
|
|
67
|
+
var import_jsonpointer = __toESM(require("jsonpointer"));
|
|
68
|
+
var import_artifact4 = require("@dxos/artifact");
|
|
69
|
+
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
70
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
71
|
+
var import_log3 = require("@dxos/log");
|
|
72
|
+
var import_util2 = require("@dxos/util");
|
|
64
73
|
var import_react3 = require("react");
|
|
65
74
|
var import_async = require("@dxos/async");
|
|
66
75
|
var import_context = require("@dxos/context");
|
|
67
|
-
var import_functions2 = require("@dxos/functions");
|
|
68
76
|
var import_functions3 = require("@dxos/functions");
|
|
69
|
-
var import_invariant3 = require("@dxos/invariant");
|
|
70
|
-
var import_log2 = require("@dxos/log");
|
|
71
|
-
var import_react_client2 = require("@dxos/react-client");
|
|
72
|
-
var import_echo2 = require("@dxos/react-client/echo");
|
|
73
|
-
var import_async2 = require("@dxos/async");
|
|
74
|
-
var import_echo_db = require("@dxos/echo-db");
|
|
75
77
|
var import_functions4 = require("@dxos/functions");
|
|
76
78
|
var import_invariant4 = require("@dxos/invariant");
|
|
77
|
-
var import_keys2 = require("@dxos/keys");
|
|
78
|
-
var import_log3 = require("@dxos/log");
|
|
79
|
-
var import_artifact3 = require("@dxos/artifact");
|
|
80
|
-
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
81
|
-
var import_functions5 = require("@dxos/functions");
|
|
82
79
|
var import_log4 = require("@dxos/log");
|
|
80
|
+
var import_react_client2 = require("@dxos/react-client");
|
|
83
81
|
var import_echo3 = require("@dxos/react-client/echo");
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
82
|
+
var import_async2 = require("@dxos/async");
|
|
83
|
+
var import_echo_db = require("@dxos/echo-db");
|
|
84
|
+
var import_functions5 = require("@dxos/functions");
|
|
87
85
|
var import_invariant5 = require("@dxos/invariant");
|
|
86
|
+
var import_keys = require("@dxos/keys");
|
|
88
87
|
var import_log5 = require("@dxos/log");
|
|
89
|
-
var
|
|
90
|
-
var
|
|
88
|
+
var import_react4 = require("react");
|
|
89
|
+
var import_keys2 = require("@dxos/keys");
|
|
90
|
+
var import_echo4 = require("@dxos/react-client/echo");
|
|
91
|
+
var import_react_edge_client = require("@dxos/react-edge-client");
|
|
92
|
+
var import_react5 = require("react");
|
|
93
|
+
var import_artifact5 = require("@dxos/artifact");
|
|
94
|
+
var import_echo_schema4 = require("@dxos/echo-schema");
|
|
95
|
+
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
96
|
+
var import_react6 = __toESM(require("react"));
|
|
91
97
|
var import_react_ui = require("@dxos/react-ui");
|
|
98
|
+
var import_react_ui_components = require("@dxos/react-ui-components");
|
|
92
99
|
var import_react_ui_sfx = require("@dxos/react-ui-sfx");
|
|
93
100
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
94
|
-
var
|
|
101
|
+
var import_react7 = __toESM(require("react"));
|
|
95
102
|
var import_invariant6 = require("@dxos/invariant");
|
|
96
|
-
var
|
|
97
|
-
var import_react6 = __toESM(require("react"));
|
|
98
|
-
var import_invariant7 = require("@dxos/invariant");
|
|
103
|
+
var import_log6 = require("@dxos/log");
|
|
99
104
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
100
105
|
var import_react_ui_syntax_highlighter = require("@dxos/react-ui-syntax-highlighter");
|
|
101
|
-
var
|
|
106
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
102
107
|
var import_util3 = require("@dxos/util");
|
|
103
|
-
var import_react7 = __toESM(require("react"));
|
|
104
|
-
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
105
108
|
var import_react8 = __toESM(require("react"));
|
|
109
|
+
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
110
|
+
var import_react9 = __toESM(require("react"));
|
|
106
111
|
var import_react_ui3 = require("@dxos/react-ui");
|
|
112
|
+
var import_react_ui_theme4 = require("@dxos/react-ui-theme");
|
|
113
|
+
var import_react10 = __toESM(require("react"));
|
|
114
|
+
var import_react_ui4 = require("@dxos/react-ui");
|
|
107
115
|
var import_react_ui_theme5 = require("@dxos/react-ui-theme");
|
|
108
|
-
var
|
|
116
|
+
var import_react11 = __toESM(require("react"));
|
|
109
117
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
110
118
|
var import_react_ui_syntax_highlighter2 = require("@dxos/react-ui-syntax-highlighter");
|
|
111
119
|
var import_react_ui_theme6 = require("@dxos/react-ui-theme");
|
|
112
120
|
var import_util4 = require("@dxos/util");
|
|
113
|
-
var AiClient = (0, import_app_framework2.lazy)(() => import("./ai-client-SA35GN5Q.cjs"));
|
|
114
|
-
var AppGraphBuilder = (0, import_app_framework2.lazy)(() => import("./app-graph-builder-ENVDOPS4.cjs"));
|
|
115
|
-
var IntentResolver = (0, import_app_framework2.lazy)(() => import("./intent-resolver-CNVBSG4E.cjs"));
|
|
116
|
-
var ReactSurface = (0, import_app_framework2.lazy)(() => import("./react-surface-5HYLBDC3.cjs"));
|
|
117
121
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/hooks/processor.ts";
|
|
118
122
|
var defaultOptions = {
|
|
119
123
|
model: "@anthropic/claude-3-5-sonnet-20241022",
|
|
120
|
-
systemPrompt: ""
|
|
124
|
+
systemPrompt: "you are a helpful assistant"
|
|
121
125
|
};
|
|
122
126
|
var ChatProcessor = class {
|
|
123
127
|
constructor(_client, _tools, _extensions, _options = defaultOptions) {
|
|
@@ -138,7 +142,7 @@ var ChatProcessor = class {
|
|
|
138
142
|
const current = messages.pop();
|
|
139
143
|
(0, import_invariant2.invariant)(current, void 0, {
|
|
140
144
|
F: __dxlog_file,
|
|
141
|
-
L:
|
|
145
|
+
L: 78,
|
|
142
146
|
S: this,
|
|
143
147
|
A: [
|
|
144
148
|
"current",
|
|
@@ -173,13 +177,19 @@ var ChatProcessor = class {
|
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
179
|
/**
|
|
180
|
+
* Update tools.
|
|
181
|
+
*/
|
|
182
|
+
setTools(tools) {
|
|
183
|
+
this._tools = tools;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
176
186
|
* Make GPT request.
|
|
177
187
|
*/
|
|
178
188
|
async request(message, options = {}) {
|
|
179
189
|
(0, import_signals_core.batch)(() => {
|
|
180
190
|
this._history = options.history ?? [];
|
|
181
191
|
this._pending.value = [
|
|
182
|
-
(0, import_echo_schema.createStatic)(
|
|
192
|
+
(0, import_echo_schema.createStatic)(import_artifact.Message, {
|
|
183
193
|
role: "user",
|
|
184
194
|
content: [
|
|
185
195
|
{
|
|
@@ -202,7 +212,7 @@ var ChatProcessor = class {
|
|
|
202
212
|
async cancel() {
|
|
203
213
|
import_log.log.info("cancelling...", void 0, {
|
|
204
214
|
F: __dxlog_file,
|
|
205
|
-
L:
|
|
215
|
+
L: 141,
|
|
206
216
|
S: this,
|
|
207
217
|
C: (f, a) => f(...a)
|
|
208
218
|
});
|
|
@@ -231,7 +241,7 @@ var ChatProcessor = class {
|
|
|
231
241
|
messages: this._pending.value.length
|
|
232
242
|
}, {
|
|
233
243
|
F: __dxlog_file,
|
|
234
|
-
L:
|
|
244
|
+
L: 165,
|
|
235
245
|
S: this,
|
|
236
246
|
C: (f, a) => f(...a)
|
|
237
247
|
});
|
|
@@ -250,7 +260,7 @@ var ChatProcessor = class {
|
|
|
250
260
|
messages: this._pending.value
|
|
251
261
|
}, {
|
|
252
262
|
F: __dxlog_file,
|
|
253
|
-
L:
|
|
263
|
+
L: 178,
|
|
254
264
|
S: this,
|
|
255
265
|
C: (f, a) => f(...a)
|
|
256
266
|
});
|
|
@@ -258,7 +268,7 @@ var ChatProcessor = class {
|
|
|
258
268
|
const message = this._pending.value.at(-1);
|
|
259
269
|
(0, import_invariant2.invariant)(message, void 0, {
|
|
260
270
|
F: __dxlog_file,
|
|
261
|
-
L:
|
|
271
|
+
L: 183,
|
|
262
272
|
S: this,
|
|
263
273
|
A: [
|
|
264
274
|
"message",
|
|
@@ -268,7 +278,7 @@ var ChatProcessor = class {
|
|
|
268
278
|
if ((0, import_assistant.isToolUse)(message)) {
|
|
269
279
|
import_log.log.info("tool request...", void 0, {
|
|
270
280
|
F: __dxlog_file,
|
|
271
|
-
L:
|
|
281
|
+
L: 185,
|
|
272
282
|
S: this,
|
|
273
283
|
C: (f, a) => f(...a)
|
|
274
284
|
});
|
|
@@ -281,7 +291,7 @@ var ChatProcessor = class {
|
|
|
281
291
|
response
|
|
282
292
|
}, {
|
|
283
293
|
F: __dxlog_file,
|
|
284
|
-
L:
|
|
294
|
+
L: 192,
|
|
285
295
|
S: this,
|
|
286
296
|
C: (f, a) => f(...a)
|
|
287
297
|
});
|
|
@@ -302,14 +312,14 @@ var ChatProcessor = class {
|
|
|
302
312
|
err
|
|
303
313
|
}, {
|
|
304
314
|
F: __dxlog_file,
|
|
305
|
-
L:
|
|
315
|
+
L: 204,
|
|
306
316
|
S: this,
|
|
307
317
|
C: (f, a) => f(...a)
|
|
308
318
|
});
|
|
309
319
|
} finally {
|
|
310
320
|
import_log.log.info("done", void 0, {
|
|
311
321
|
F: __dxlog_file,
|
|
312
|
-
L:
|
|
322
|
+
L: 206,
|
|
313
323
|
S: this,
|
|
314
324
|
C: (f, a) => f(...a)
|
|
315
325
|
});
|
|
@@ -317,32 +327,20 @@ var ChatProcessor = class {
|
|
|
317
327
|
}
|
|
318
328
|
}
|
|
319
329
|
};
|
|
320
|
-
var
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const t = setTimeout(async () => {
|
|
325
|
-
const services2 = await registry.queryServices(query);
|
|
326
|
-
setServices(services2);
|
|
327
|
-
});
|
|
328
|
-
return () => clearTimeout(t);
|
|
329
|
-
}, [
|
|
330
|
-
query,
|
|
331
|
-
registry
|
|
332
|
-
]);
|
|
333
|
-
return services;
|
|
334
|
-
};
|
|
335
|
-
var registerTriggersMutex = new import_async.Mutex();
|
|
330
|
+
var AiClient = (0, import_app_framework2.lazy)(() => import("./ai-client-FKLPDELV.cjs"));
|
|
331
|
+
var AppGraphBuilder = (0, import_app_framework2.lazy)(() => import("./app-graph-builder-T76NYV42.cjs"));
|
|
332
|
+
var IntentResolver = (0, import_app_framework2.lazy)(() => import("./intent-resolver-C6OKFVEW.cjs"));
|
|
333
|
+
var ReactSurface = (0, import_app_framework2.lazy)(() => import("./react-surface-LWDY7SQG.cjs"));
|
|
336
334
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/tools/function.ts";
|
|
337
335
|
var covertFunctionToTool = (fn, edgeUrl, spaceId) => {
|
|
338
336
|
if (!fn.description || !fn.inputSchema) {
|
|
339
337
|
return void 0;
|
|
340
338
|
}
|
|
341
|
-
const existingFunctionUrl = (0,
|
|
339
|
+
const existingFunctionUrl = (0, import_functions2.getUserFunctionUrlInMetadata)((0, import_echo2.getMeta)(fn));
|
|
342
340
|
if (!existingFunctionUrl) {
|
|
343
341
|
return void 0;
|
|
344
342
|
}
|
|
345
|
-
const url = (0,
|
|
343
|
+
const url = (0, import_functions2.getInvocationUrl)(existingFunctionUrl, edgeUrl, {
|
|
346
344
|
spaceId
|
|
347
345
|
});
|
|
348
346
|
return (0, import_artifact3.defineTool)({
|
|
@@ -350,7 +348,7 @@ var covertFunctionToTool = (fn, edgeUrl, spaceId) => {
|
|
|
350
348
|
description: fn.description,
|
|
351
349
|
schema: (0, import_echo_schema2.toEffectSchema)(fn.inputSchema),
|
|
352
350
|
execute: async (input) => {
|
|
353
|
-
|
|
351
|
+
import_log2.log.info("execute function tool", {
|
|
354
352
|
name: fn.name,
|
|
355
353
|
url,
|
|
356
354
|
input
|
|
@@ -373,7 +371,7 @@ var covertFunctionToTool = (fn, edgeUrl, spaceId) => {
|
|
|
373
371
|
};
|
|
374
372
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/tools/openapi.ts";
|
|
375
373
|
var createToolsFromService = async (service) => {
|
|
376
|
-
(0,
|
|
374
|
+
(0, import_invariant3.invariant)(service.interfaces?.length === 1 && service.interfaces[0].kind === "api", void 0, {
|
|
377
375
|
F: __dxlog_file3,
|
|
378
376
|
L: 22,
|
|
379
377
|
S: void 0,
|
|
@@ -383,7 +381,7 @@ var createToolsFromService = async (service) => {
|
|
|
383
381
|
]
|
|
384
382
|
});
|
|
385
383
|
const iface = service.interfaces[0];
|
|
386
|
-
(0,
|
|
384
|
+
(0, import_invariant3.invariant)(iface.schemaUrl, void 0, {
|
|
387
385
|
F: __dxlog_file3,
|
|
388
386
|
L: 24,
|
|
389
387
|
S: void 0,
|
|
@@ -392,7 +390,7 @@ var createToolsFromService = async (service) => {
|
|
|
392
390
|
""
|
|
393
391
|
]
|
|
394
392
|
});
|
|
395
|
-
(0,
|
|
393
|
+
(0, import_invariant3.invariant)(iface.schemaUrl, void 0, {
|
|
396
394
|
F: __dxlog_file3,
|
|
397
395
|
L: 25,
|
|
398
396
|
S: void 0,
|
|
@@ -408,7 +406,7 @@ var createToolsFromService = async (service) => {
|
|
|
408
406
|
var createToolsFromApi = async (url, options) => {
|
|
409
407
|
const res = await fetch(url);
|
|
410
408
|
const spec = await res.json();
|
|
411
|
-
(0,
|
|
409
|
+
(0, import_log3.log)("spec", {
|
|
412
410
|
spec
|
|
413
411
|
}, {
|
|
414
412
|
F: __dxlog_file3,
|
|
@@ -424,7 +422,7 @@ var createToolsFromApi = async (url, options) => {
|
|
|
424
422
|
const { ...methods } = pathItem;
|
|
425
423
|
for (const [method, m] of Object.entries(methods)) {
|
|
426
424
|
const methodItem = m;
|
|
427
|
-
(0,
|
|
425
|
+
(0, import_log3.log)("methodItem", {
|
|
428
426
|
path,
|
|
429
427
|
method,
|
|
430
428
|
methodItem
|
|
@@ -444,7 +442,7 @@ var createToolsFromApi = async (url, options) => {
|
|
|
444
442
|
};
|
|
445
443
|
const endpointParameters = [];
|
|
446
444
|
for (const parameter of parametersResolved) {
|
|
447
|
-
(0,
|
|
445
|
+
(0, import_log3.log)("parameter", {
|
|
448
446
|
parameter
|
|
449
447
|
}, {
|
|
450
448
|
F: __dxlog_file3,
|
|
@@ -467,7 +465,7 @@ var createToolsFromApi = async (url, options) => {
|
|
|
467
465
|
}
|
|
468
466
|
}
|
|
469
467
|
}
|
|
470
|
-
(0,
|
|
468
|
+
(0, import_log3.log)("inputSchema", {
|
|
471
469
|
inputSchema
|
|
472
470
|
}, {
|
|
473
471
|
F: __dxlog_file3,
|
|
@@ -478,7 +476,7 @@ var createToolsFromApi = async (url, options) => {
|
|
|
478
476
|
import_echo_schema3.S.validateSync(import_echo_schema3.JsonSchemaType)(inputSchema);
|
|
479
477
|
const description = methodItem.description ?? methodItem.summary;
|
|
480
478
|
if (!description) {
|
|
481
|
-
|
|
479
|
+
import_log3.log.warn("no description", {
|
|
482
480
|
path,
|
|
483
481
|
method
|
|
484
482
|
}, {
|
|
@@ -553,7 +551,7 @@ var GENERIC_WORDS = [
|
|
|
553
551
|
"endpoint"
|
|
554
552
|
];
|
|
555
553
|
var callApiEndpoint = async (endpoint, input) => {
|
|
556
|
-
|
|
554
|
+
import_log3.log.info("endpoint", {
|
|
557
555
|
method: endpoint.method,
|
|
558
556
|
name: endpoint.path,
|
|
559
557
|
input
|
|
@@ -613,7 +611,7 @@ var callApiEndpoint = async (endpoint, input) => {
|
|
|
613
611
|
request.body = JSON.stringify(body);
|
|
614
612
|
request.headers["Content-Type"] = "application/json";
|
|
615
613
|
}
|
|
616
|
-
|
|
614
|
+
import_log3.log.info("request", {
|
|
617
615
|
url,
|
|
618
616
|
request
|
|
619
617
|
}, {
|
|
@@ -623,7 +621,7 @@ var callApiEndpoint = async (endpoint, input) => {
|
|
|
623
621
|
C: (f, a) => f(...a)
|
|
624
622
|
});
|
|
625
623
|
const response = await fetch(url, request);
|
|
626
|
-
|
|
624
|
+
import_log3.log.info("response", {
|
|
627
625
|
ok: response.ok,
|
|
628
626
|
status: response.status,
|
|
629
627
|
statusText: response.statusText
|
|
@@ -649,7 +647,7 @@ var callApiEndpoint = async (endpoint, input) => {
|
|
|
649
647
|
} catch {
|
|
650
648
|
error = responseBody;
|
|
651
649
|
}
|
|
652
|
-
|
|
650
|
+
import_log3.log.error("error", {
|
|
653
651
|
error
|
|
654
652
|
}, {
|
|
655
653
|
F: __dxlog_file3,
|
|
@@ -660,7 +658,7 @@ var callApiEndpoint = async (endpoint, input) => {
|
|
|
660
658
|
throw new Error(error.message);
|
|
661
659
|
} else {
|
|
662
660
|
const error = await response.text();
|
|
663
|
-
|
|
661
|
+
import_log3.log.error("error", {
|
|
664
662
|
error
|
|
665
663
|
}, {
|
|
666
664
|
F: __dxlog_file3,
|
|
@@ -677,7 +675,7 @@ var getEndpointUrl = (endpoint) => {
|
|
|
677
675
|
if (isV3_1(endpoint.document) && endpoint.document.servers && endpoint.document.servers.length > 0) {
|
|
678
676
|
url = endpoint.document.servers[0].url;
|
|
679
677
|
} else {
|
|
680
|
-
(0,
|
|
678
|
+
(0, import_invariant3.invariant)(!isV3_1(endpoint.document), void 0, {
|
|
681
679
|
F: __dxlog_file3,
|
|
682
680
|
L: 272,
|
|
683
681
|
S: void 0,
|
|
@@ -697,7 +695,7 @@ var getEndpointUrl = (endpoint) => {
|
|
|
697
695
|
var resolveAuthorization = async (authorization) => {
|
|
698
696
|
switch (authorization.type) {
|
|
699
697
|
case "api-key": {
|
|
700
|
-
(0,
|
|
698
|
+
(0, import_invariant3.invariant)(authorization.placement.type === "authorization-header", void 0, {
|
|
701
699
|
F: __dxlog_file3,
|
|
702
700
|
L: 288,
|
|
703
701
|
S: void 0,
|
|
@@ -732,7 +730,7 @@ var resolveJsonSchema = (schema, base) => {
|
|
|
732
730
|
if (resolved) {
|
|
733
731
|
return recurse(resolved);
|
|
734
732
|
} else {
|
|
735
|
-
|
|
733
|
+
import_log3.log.warn("unresolved", {
|
|
736
734
|
ref: value.$ref,
|
|
737
735
|
base
|
|
738
736
|
}, {
|
|
@@ -750,87 +748,215 @@ var resolveJsonSchema = (schema, base) => {
|
|
|
750
748
|
var isV3_1 = (document) => {
|
|
751
749
|
return document.openapi === "3.0.1";
|
|
752
750
|
};
|
|
753
|
-
var
|
|
754
|
-
|
|
755
|
-
const
|
|
756
|
-
const
|
|
757
|
-
(0,
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
""
|
|
766
|
-
]
|
|
767
|
-
});
|
|
768
|
-
containerRef.current.scrollTo({
|
|
769
|
-
top: containerRef.current.scrollHeight,
|
|
770
|
-
behavior: "smooth"
|
|
771
|
-
});
|
|
772
|
-
autoScrollRef.current = false;
|
|
773
|
-
}
|
|
774
|
-
}), []);
|
|
775
|
-
const [sticky, setSticky] = (0, import_react5.useState)(true);
|
|
776
|
-
(0, import_react5.useEffect)(() => {
|
|
777
|
-
if (!sticky || !containerRef.current) {
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
autoScrollRef.current = true;
|
|
781
|
-
containerRef.current.scrollTo({
|
|
782
|
-
top: containerRef.current.scrollHeight,
|
|
783
|
-
behavior: "smooth"
|
|
751
|
+
var useChatProcessor = (chat) => {
|
|
752
|
+
const aiClient = (0, import_app_framework.useCapability)(import_chunk_U5Z7LFWB.AutomationCapabilities.AiClient);
|
|
753
|
+
const globalTools = (0, import_app_framework.useCapabilities)(import_app_framework.Capabilities.Tools);
|
|
754
|
+
const artifactDefinitions = (0, import_app_framework.useCapabilities)(import_app_framework.Capabilities.ArtifactDefinition);
|
|
755
|
+
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
756
|
+
const space = (0, import_echo.getSpace)(chat);
|
|
757
|
+
const services = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_chunk_GB7245FH.ServiceType));
|
|
758
|
+
const [serviceTools, setServiceTools] = (0, import_react2.useState)([]);
|
|
759
|
+
(0, import_react2.useEffect)(() => {
|
|
760
|
+
queueMicrotask(async () => {
|
|
761
|
+
const tools2 = await Promise.all(services.map((service) => createToolsFromService(service)));
|
|
762
|
+
setServiceTools(tools2.flat());
|
|
784
763
|
});
|
|
785
764
|
}, [
|
|
786
|
-
|
|
765
|
+
services
|
|
787
766
|
]);
|
|
767
|
+
const config = (0, import_react_client.useConfig)();
|
|
768
|
+
const functions2 = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_functions.FunctionType));
|
|
769
|
+
const tools = (0, import_react2.useMemo)(() => [
|
|
770
|
+
...globalTools.flat(),
|
|
771
|
+
...artifactDefinitions.flatMap((definition) => definition.tools),
|
|
772
|
+
...serviceTools,
|
|
773
|
+
...functions2.map((fn) => covertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? "", space?.id)).filter(import_util.isNotNullOrUndefined)
|
|
774
|
+
], [
|
|
775
|
+
globalTools,
|
|
776
|
+
artifactDefinitions,
|
|
777
|
+
serviceTools,
|
|
778
|
+
functions2,
|
|
779
|
+
space?.id
|
|
780
|
+
]);
|
|
781
|
+
const systemPrompt = (0, import_react2.useMemo)(() => (0, import_artifact2.createSystemPrompt)({
|
|
782
|
+
artifacts: artifactDefinitions.map((definition) => definition.instructions)
|
|
783
|
+
}), [
|
|
784
|
+
artifactDefinitions
|
|
785
|
+
]);
|
|
786
|
+
const processor = (0, import_react2.useMemo)(() => new ChatProcessor(aiClient, tools, {
|
|
787
|
+
space,
|
|
788
|
+
dispatch
|
|
789
|
+
}, {
|
|
790
|
+
model: "@anthropic/claude-3-5-sonnet-20241022",
|
|
791
|
+
systemPrompt
|
|
792
|
+
}), [
|
|
793
|
+
aiClient,
|
|
794
|
+
tools,
|
|
795
|
+
space,
|
|
796
|
+
dispatch,
|
|
797
|
+
systemPrompt
|
|
798
|
+
]);
|
|
799
|
+
return processor;
|
|
800
|
+
};
|
|
801
|
+
var registerTriggersMutex = new import_async.Mutex();
|
|
802
|
+
var useMessageQueue = (chat) => {
|
|
803
|
+
const edgeClient = (0, import_react_edge_client.useEdgeClient)();
|
|
804
|
+
const space = (0, import_echo4.getSpace)(chat);
|
|
805
|
+
const queueDxn = (0, import_react4.useMemo)(() => new import_keys2.DXN(import_keys2.DXN.kind.QUEUE, [
|
|
806
|
+
import_keys2.QueueSubspaceTags.DATA,
|
|
807
|
+
space.id,
|
|
808
|
+
chat.queue.dxn.parts.at(-1)
|
|
809
|
+
]), [
|
|
810
|
+
chat.queue.dxn
|
|
811
|
+
]);
|
|
812
|
+
return (0, import_react_edge_client.useQueue)(edgeClient, queueDxn);
|
|
813
|
+
};
|
|
814
|
+
var functions = [
|
|
815
|
+
{
|
|
816
|
+
name: "example.com/function/chess",
|
|
817
|
+
version: "0.1.0",
|
|
818
|
+
inputSchema: (0, import_echo_schema4.toJsonSchema)(import_echo_schema4.S.Struct({
|
|
819
|
+
level: import_echo_schema4.S.Number.annotations({
|
|
820
|
+
[import_echo_schema4.AST.TitleAnnotationId]: "Level"
|
|
821
|
+
})
|
|
822
|
+
}))
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: "example.com/function/forex",
|
|
826
|
+
version: "0.1.0",
|
|
827
|
+
binding: "FOREX",
|
|
828
|
+
inputSchema: (0, import_echo_schema4.toJsonSchema)(import_echo_schema4.S.Struct({
|
|
829
|
+
from: import_echo_schema4.S.String.annotations({
|
|
830
|
+
[import_echo_schema4.AST.TitleAnnotationId]: "Currency from"
|
|
831
|
+
}),
|
|
832
|
+
to: import_echo_schema4.S.String.annotations({
|
|
833
|
+
[import_echo_schema4.AST.TitleAnnotationId]: "Currency to"
|
|
834
|
+
})
|
|
835
|
+
}))
|
|
836
|
+
}
|
|
837
|
+
];
|
|
838
|
+
var MockServiceRegistry = class {
|
|
839
|
+
async queryServices(query) {
|
|
840
|
+
return TEST_SERVICES;
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
var AMADEUS_AUTH = {
|
|
844
|
+
type: "oauth",
|
|
845
|
+
clientId: "BOEnpLd1sMyKjAPGKYeAPFFy60u53QEG",
|
|
846
|
+
clientSecret: "n4qldSN7usvD57gm",
|
|
847
|
+
tokenUrl: "https://test.api.amadeus.com/v1/security/oauth2/token",
|
|
848
|
+
grantType: "client_credentials"
|
|
849
|
+
};
|
|
850
|
+
var VISUAL_CROSSING_CREDENTIALS = {
|
|
851
|
+
type: "api-key",
|
|
852
|
+
key: "FDPRVS953KB4GQQLD25GRT975",
|
|
853
|
+
placement: {
|
|
854
|
+
type: "query",
|
|
855
|
+
name: "key"
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
var TEST_SERVICES = [
|
|
859
|
+
(0, import_echo_schema5.createStatic)(import_chunk_GB7245FH.ServiceType, {
|
|
860
|
+
serviceId: "amadeus.com/service/FlightSearch",
|
|
861
|
+
name: "Amadeus Flight Search",
|
|
862
|
+
description: "Search for local and international flights.",
|
|
863
|
+
category: "travel",
|
|
864
|
+
interfaces: [
|
|
865
|
+
{
|
|
866
|
+
kind: "api",
|
|
867
|
+
schemaUrl: "https://api.apis.guru/v2/specs/amadeus.com/amadeus-flight-availabilities-search/1.0.2/swagger.json",
|
|
868
|
+
authorization: AMADEUS_AUTH
|
|
869
|
+
}
|
|
870
|
+
]
|
|
871
|
+
}),
|
|
872
|
+
(0, import_echo_schema5.createStatic)(import_chunk_GB7245FH.ServiceType, {
|
|
873
|
+
serviceId: "amadeus.com/service/HotelSearch",
|
|
874
|
+
name: "Amadeus Hotel Search",
|
|
875
|
+
description: "Search for local and international hotels.",
|
|
876
|
+
category: "travel",
|
|
877
|
+
interfaces: [
|
|
878
|
+
{
|
|
879
|
+
kind: "api",
|
|
880
|
+
schemaUrl: "https://api.apis.guru/v2/specs/amadeus.com/amadeus-hotel-search/3.0.8/swagger.json",
|
|
881
|
+
authorization: AMADEUS_AUTH
|
|
882
|
+
}
|
|
883
|
+
]
|
|
884
|
+
}),
|
|
885
|
+
(0, import_echo_schema5.createStatic)(import_chunk_GB7245FH.ServiceType, {
|
|
886
|
+
serviceId: "visualcrossing.com/service/Weather",
|
|
887
|
+
name: "Visual Crossing Weather",
|
|
888
|
+
description: "Search for global weather forecasts.",
|
|
889
|
+
category: "weather",
|
|
890
|
+
interfaces: [
|
|
891
|
+
{
|
|
892
|
+
kind: "api",
|
|
893
|
+
schemaUrl: "https://api.apis.guru/v2/specs/visualcrossing.com/weather/4.6/openapi.json",
|
|
894
|
+
authorization: VISUAL_CROSSING_CREDENTIALS
|
|
895
|
+
}
|
|
896
|
+
]
|
|
897
|
+
}),
|
|
898
|
+
// TODO(burdon): Needs auth.
|
|
899
|
+
(0, import_echo_schema5.createStatic)(import_chunk_GB7245FH.ServiceType, {
|
|
900
|
+
serviceId: "abstractapi.com/service/GeoLocation",
|
|
901
|
+
name: "Abstract GeoLocation",
|
|
902
|
+
description: "Get the location of any IP address.",
|
|
903
|
+
category: "geolocation",
|
|
904
|
+
interfaces: [
|
|
905
|
+
{
|
|
906
|
+
kind: "api",
|
|
907
|
+
schemaUrl: "https://api.apis.guru/v2/specs/abstractapi.com/geolocation/1.0.0/openapi.json"
|
|
908
|
+
}
|
|
909
|
+
]
|
|
910
|
+
}),
|
|
911
|
+
//
|
|
912
|
+
// Testing
|
|
913
|
+
//
|
|
914
|
+
...Array.from({
|
|
915
|
+
length: 20
|
|
916
|
+
}, (_, i) => (0, import_echo_schema5.createStatic)(import_chunk_GB7245FH.ServiceType, {
|
|
917
|
+
serviceId: `example.com/service/test-${i}`,
|
|
918
|
+
name: `Test ${i}`,
|
|
919
|
+
description: `Test ${i}`,
|
|
920
|
+
category: Object.keys(import_chunk_GB7245FH.categoryIcons)[Math.floor(Math.random() * Object.keys(import_chunk_GB7245FH.categoryIcons).length)],
|
|
921
|
+
interfaces: [
|
|
922
|
+
{
|
|
923
|
+
kind: "api",
|
|
924
|
+
schemaUrl: "https://petstore.swagger.io/v2/swagger.json"
|
|
925
|
+
}
|
|
926
|
+
]
|
|
927
|
+
}))
|
|
928
|
+
];
|
|
929
|
+
var useServices = (space, query) => {
|
|
930
|
+
const registry = (0, import_react5.useMemo)(() => new MockServiceRegistry(), []);
|
|
931
|
+
const [services, setServices] = (0, import_react5.useState)([]);
|
|
788
932
|
(0, import_react5.useEffect)(() => {
|
|
789
|
-
(
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
S: void 0,
|
|
793
|
-
A: [
|
|
794
|
-
"containerRef.current",
|
|
795
|
-
""
|
|
796
|
-
]
|
|
933
|
+
const t = setTimeout(async () => {
|
|
934
|
+
const services2 = await registry.queryServices(query);
|
|
935
|
+
setServices(services2);
|
|
797
936
|
});
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
if (autoScrollRef.current) {
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
const { scrollTop, clientHeight, scrollHeight } = ev.currentTarget;
|
|
809
|
-
const sticky2 = scrollTop + clientHeight >= scrollHeight;
|
|
810
|
-
setSticky(sticky2);
|
|
811
|
-
}, []);
|
|
812
|
-
return /* @__PURE__ */ import_react5.default.createElement("div", {
|
|
813
|
-
ref: containerRef,
|
|
814
|
-
onScroll: handleScroll,
|
|
815
|
-
className: (0, import_react_ui_theme2.mx)("flex flex-col grow overflow-y-scroll scrollbar-none", classNames)
|
|
816
|
-
}, children);
|
|
817
|
-
});
|
|
937
|
+
return () => clearTimeout(t);
|
|
938
|
+
}, [
|
|
939
|
+
query,
|
|
940
|
+
registry
|
|
941
|
+
]);
|
|
942
|
+
return services;
|
|
943
|
+
};
|
|
818
944
|
var emptyLines = [];
|
|
819
945
|
var StatusLine = ({ classNames, line = -1, lines = emptyLines, transition = 300, advance = 1e3, autoAdvance }) => {
|
|
820
|
-
const containerRef = (0,
|
|
821
|
-
const [currentLine, setCurrentLine] = (0,
|
|
822
|
-
(0,
|
|
946
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
947
|
+
const [currentLine, setCurrentLine] = (0, import_react8.useState)(line);
|
|
948
|
+
(0, import_react8.useEffect)(() => {
|
|
823
949
|
setCurrentLine(line);
|
|
824
950
|
}, [
|
|
825
951
|
line
|
|
826
952
|
]);
|
|
827
|
-
(0,
|
|
953
|
+
(0, import_react8.useEffect)(() => {
|
|
828
954
|
if (!autoAdvance) {
|
|
829
955
|
return;
|
|
830
956
|
}
|
|
831
957
|
const next = () => {
|
|
832
958
|
setCurrentLine((prev) => {
|
|
833
|
-
if (prev
|
|
959
|
+
if (prev >= lines.length - 1) {
|
|
834
960
|
clearInterval(interval);
|
|
835
961
|
return prev;
|
|
836
962
|
}
|
|
@@ -845,7 +971,7 @@ var StatusLine = ({ classNames, line = -1, lines = emptyLines, transition = 300,
|
|
|
845
971
|
autoAdvance,
|
|
846
972
|
advance
|
|
847
973
|
]);
|
|
848
|
-
(0,
|
|
974
|
+
(0, import_react8.useEffect)(() => {
|
|
849
975
|
if (containerRef.current) {
|
|
850
976
|
containerRef.current.style.transition = `transform ${transition}ms ease-in-out`;
|
|
851
977
|
containerRef.current.style.transform = `translateY(-${currentLine * 24}px)`;
|
|
@@ -853,27 +979,118 @@ var StatusLine = ({ classNames, line = -1, lines = emptyLines, transition = 300,
|
|
|
853
979
|
}, [
|
|
854
980
|
currentLine
|
|
855
981
|
]);
|
|
856
|
-
return /* @__PURE__ */
|
|
857
|
-
className: (0,
|
|
858
|
-
}, /* @__PURE__ */
|
|
982
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
983
|
+
className: (0, import_react_ui_theme3.mx)("relative h-[24px] overflow-hidden", classNames)
|
|
984
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
859
985
|
ref: containerRef,
|
|
860
986
|
className: "h-[24px]"
|
|
861
|
-
}, /* @__PURE__ */
|
|
987
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
862
988
|
className: "flex flex-col"
|
|
863
|
-
}, lines.map((line2, i) => /* @__PURE__ */
|
|
989
|
+
}, lines.map((line2, i) => /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
864
990
|
key: i,
|
|
865
|
-
className: (0,
|
|
866
|
-
}, /* @__PURE__ */
|
|
991
|
+
className: (0, import_react_ui_theme3.mx)("flex h-[24px] items-center")
|
|
992
|
+
}, /* @__PURE__ */ import_react8.default.createElement("span", {
|
|
867
993
|
className: "truncate"
|
|
868
994
|
}, line2))))));
|
|
869
995
|
};
|
|
870
|
-
var
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
996
|
+
var numbers = [
|
|
997
|
+
{
|
|
998
|
+
regular: "ph--number-circle-zero--thin",
|
|
999
|
+
active: "ph--number-circle-zero--duotone"
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
regular: "ph--number-circle-one--thin",
|
|
1003
|
+
active: "ph--number-circle-one--duotone"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
regular: "ph--number-circle-two--thin",
|
|
1007
|
+
active: "ph--number-circle-two--duotone"
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
regular: "ph--number-circle-three--thin",
|
|
1011
|
+
active: "ph--number-circle-three--duotone"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
regular: "ph--number-circle-four--thin",
|
|
1015
|
+
active: "ph--number-circle-four--duotone"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
regular: "ph--number-circle-five--thin",
|
|
1019
|
+
active: "ph--number-circle-five--duotone"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
regular: "ph--number-circle-six--thin",
|
|
1023
|
+
active: "ph--number-circle-six--duotone"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
regular: "ph--number-circle-seven--thin",
|
|
1027
|
+
active: "ph--number-circle-seven--duotone"
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
regular: "ph--number-circle-eight--thin",
|
|
1031
|
+
active: "ph--number-circle-eight--duotone"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
regular: "ph--number-circle-nine--thin",
|
|
1035
|
+
active: "ph--number-circle-nine--duotone"
|
|
1036
|
+
}
|
|
1037
|
+
];
|
|
1038
|
+
var Tabs = /* @__PURE__ */ (0, import_react9.forwardRef)(({ classNames, length, selected = 0, onSelect }, forwardedRef) => {
|
|
1039
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1040
|
+
ref: forwardedRef,
|
|
1041
|
+
className: (0, import_react_ui_theme4.mx)("flex flex-col overflow-hidden outline-none", classNames),
|
|
1042
|
+
tabIndex: -1,
|
|
1043
|
+
onKeyDown: (ev) => {
|
|
1044
|
+
switch (ev.key) {
|
|
1045
|
+
case "ArrowDown":
|
|
1046
|
+
case "ArrowRight": {
|
|
1047
|
+
ev.preventDefault();
|
|
1048
|
+
ev.stopPropagation();
|
|
1049
|
+
if (selected < length - 1) {
|
|
1050
|
+
onSelect?.(selected + 1);
|
|
1051
|
+
}
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
case "ArrowUp":
|
|
1055
|
+
case "ArrowLeft": {
|
|
1056
|
+
ev.preventDefault();
|
|
1057
|
+
ev.stopPropagation();
|
|
1058
|
+
if (selected > 0) {
|
|
1059
|
+
onSelect?.(selected - 1);
|
|
1060
|
+
}
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
case "Enter": {
|
|
1064
|
+
ev.preventDefault();
|
|
1065
|
+
ev.stopPropagation();
|
|
1066
|
+
onSelect?.(selected);
|
|
1067
|
+
break;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}, Array.from({
|
|
1072
|
+
length
|
|
1073
|
+
}).map((_, i) => {
|
|
1074
|
+
const icon = numbers[i + 1];
|
|
1075
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1076
|
+
key: i,
|
|
1077
|
+
className: (0, import_react_ui_theme4.mx)("relative flex w-[24px] h-[28px] justify-center cursor-pointer text-subdued", selected === i && "!text-cyan-550 !dark:text-cyan-300")
|
|
1078
|
+
}, i < length - 1 && /* @__PURE__ */ import_react9.default.createElement("div", {
|
|
1079
|
+
className: "absolute left-[11.5px] top-[21px] w-[1px] h-[10px] bg-neutral-400"
|
|
1080
|
+
}), /* @__PURE__ */ import_react9.default.createElement(import_react_ui3.Icon, {
|
|
1081
|
+
icon: selected === i ? icon.regular : icon.regular,
|
|
1082
|
+
classNames: "z-10 !p-0 !w-[24px] !h-[24px] outline-none",
|
|
1083
|
+
onClick: () => onSelect?.(i)
|
|
1084
|
+
}));
|
|
1085
|
+
}));
|
|
1086
|
+
});
|
|
1087
|
+
var ToggleContainer = ({ classNames, title, icon, open: _open, duration = 400, shrinkX = false, children, onChangeOpen }) => {
|
|
1088
|
+
const [open, setOpen] = (0, import_react_ui4.useControlledState)(_open);
|
|
1089
|
+
const [expandX, setExpandX] = (0, import_react10.useState)(shrinkX ? open : true);
|
|
1090
|
+
const [expandY, setExpandY] = (0, import_react10.useState)(open);
|
|
1091
|
+
(0, import_react10.useEffect)(() => {
|
|
875
1092
|
let t;
|
|
876
|
-
if (
|
|
1093
|
+
if (open) {
|
|
877
1094
|
if (shrinkX) {
|
|
878
1095
|
setExpandX(true);
|
|
879
1096
|
}
|
|
@@ -890,16 +1107,23 @@ var ToggleContainer = ({ title, icon, toggle, defaultOpen, duration = 400, shrin
|
|
|
890
1107
|
}
|
|
891
1108
|
return () => clearTimeout(t);
|
|
892
1109
|
}, [
|
|
893
|
-
|
|
1110
|
+
open
|
|
894
1111
|
]);
|
|
895
|
-
|
|
1112
|
+
const handleToggle = () => {
|
|
1113
|
+
if (onChangeOpen) {
|
|
1114
|
+
onChangeOpen(!open);
|
|
1115
|
+
} else {
|
|
1116
|
+
setOpen((open2) => !open2);
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
896
1120
|
className: (0, import_react_ui_theme5.mx)("overflow-hidden", classNames)
|
|
897
|
-
}, title && /* @__PURE__ */
|
|
1121
|
+
}, title && /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
898
1122
|
className: "flex gap-1 py-1 items-center text-sm text-subdued cursor-pointer select-none",
|
|
899
|
-
onClick:
|
|
900
|
-
},
|
|
1123
|
+
onClick: handleToggle
|
|
1124
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
901
1125
|
className: "flex w-[24px] h-[24px] items-center justify-center"
|
|
902
|
-
}, /* @__PURE__ */
|
|
1126
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui4.Icon, {
|
|
903
1127
|
size: 4,
|
|
904
1128
|
icon: "ph--caret-right--regular",
|
|
905
1129
|
style: {
|
|
@@ -907,63 +1131,63 @@ var ToggleContainer = ({ title, icon, toggle, defaultOpen, duration = 400, shrin
|
|
|
907
1131
|
},
|
|
908
1132
|
classNames: [
|
|
909
1133
|
"transition transition-transform ease-in-out",
|
|
910
|
-
|
|
1134
|
+
open ? "rotate-90" : "transform-none"
|
|
911
1135
|
]
|
|
912
|
-
})), /* @__PURE__ */
|
|
1136
|
+
})), /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
913
1137
|
className: "flex-1 pis-1 pie-1 truncate"
|
|
914
|
-
}, title), icon), /* @__PURE__ */
|
|
1138
|
+
}, title), icon), /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
915
1139
|
style: {
|
|
916
1140
|
transitionDuration: `${duration}ms`
|
|
917
1141
|
},
|
|
918
1142
|
className: (0, import_react_ui_theme5.mx)("grid transition-[grid-template-columns] ease-in-out", expandX ? "grid-cols-[1fr]" : "grid-cols-[0fr]")
|
|
919
|
-
}, /* @__PURE__ */
|
|
1143
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
920
1144
|
className: "overflow-hidden"
|
|
921
|
-
}, /* @__PURE__ */
|
|
1145
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
922
1146
|
style: {
|
|
923
1147
|
transitionDuration: `${duration}ms`
|
|
924
1148
|
},
|
|
925
1149
|
className: (0, import_react_ui_theme5.mx)("grid transition-[grid-template-rows] ease-in-out", expandY ? "grid-rows-[1fr]" : "grid-rows-[0fr]")
|
|
926
|
-
}, /* @__PURE__ */
|
|
1150
|
+
}, /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
927
1151
|
className: (0, import_react_ui_theme5.mx)("flex overflow-hidden transition-opacity")
|
|
928
1152
|
}, children)))));
|
|
929
1153
|
};
|
|
930
1154
|
var MarkdownViewer = ({ classNames, content = "" }) => {
|
|
931
|
-
return /* @__PURE__ */
|
|
1155
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
932
1156
|
className: (0, import_react_ui_theme6.mx)("space-y-2", classNames)
|
|
933
|
-
}, /* @__PURE__ */
|
|
1157
|
+
}, /* @__PURE__ */ import_react11.default.createElement(import_react_markdown.default, {
|
|
934
1158
|
components: {
|
|
935
|
-
a: ({ node, children, href, ...props }) => /* @__PURE__ */
|
|
1159
|
+
a: ({ node, children, href, ...props }) => /* @__PURE__ */ import_react11.default.createElement("a", {
|
|
936
1160
|
href,
|
|
937
1161
|
className: "text-primary-500 hover:text-primary-500",
|
|
938
1162
|
target: "_blank",
|
|
939
1163
|
rel: "noopener noreferrer",
|
|
940
1164
|
...props
|
|
941
1165
|
}, children),
|
|
942
|
-
ol: ({ node, children, ...props }) => /* @__PURE__ */
|
|
1166
|
+
ol: ({ node, children, ...props }) => /* @__PURE__ */ import_react11.default.createElement("ol", {
|
|
943
1167
|
className: "leading-tight list-decimal pl-6",
|
|
944
1168
|
...(0, import_util4.omit)(props, [
|
|
945
1169
|
"ordered"
|
|
946
1170
|
])
|
|
947
1171
|
}, children),
|
|
948
|
-
ul: ({ node, children, ...props }) => /* @__PURE__ */
|
|
1172
|
+
ul: ({ node, children, ...props }) => /* @__PURE__ */ import_react11.default.createElement("ul", {
|
|
949
1173
|
className: "leading-tight list-disc pl-6",
|
|
950
1174
|
...(0, import_util4.omit)(props, [
|
|
951
1175
|
"ordered"
|
|
952
1176
|
])
|
|
953
1177
|
}, children),
|
|
954
|
-
li: ({ node, children, ...props }) => /* @__PURE__ */
|
|
1178
|
+
li: ({ node, children, ...props }) => /* @__PURE__ */ import_react11.default.createElement("li", {
|
|
955
1179
|
className: "",
|
|
956
1180
|
...(0, import_util4.omit)(props, [
|
|
957
1181
|
"ordered"
|
|
958
1182
|
])
|
|
959
1183
|
}, children),
|
|
960
|
-
blockquote: ({ node, children, ...props }) => /* @__PURE__ */
|
|
1184
|
+
blockquote: ({ node, children, ...props }) => /* @__PURE__ */ import_react11.default.createElement("blockquote", {
|
|
961
1185
|
className: "border-l-4 border-primary-500 pl-4 my-4 text-primary-500",
|
|
962
1186
|
...props
|
|
963
1187
|
}, children),
|
|
964
1188
|
code: ({ children, className }) => {
|
|
965
1189
|
const [_, language] = /language-(\w+)/.exec(className || "") || [];
|
|
966
|
-
return /* @__PURE__ */
|
|
1190
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react_ui_syntax_highlighter2.SyntaxHighlighter, {
|
|
967
1191
|
PreTag: "div",
|
|
968
1192
|
language,
|
|
969
1193
|
className: "p-0"
|
|
@@ -972,59 +1196,74 @@ var MarkdownViewer = ({ classNames, content = "" }) => {
|
|
|
972
1196
|
}
|
|
973
1197
|
}, content));
|
|
974
1198
|
};
|
|
975
|
-
var
|
|
1199
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/components/Thread/ThreadMessage.tsx";
|
|
976
1200
|
var ThreadMessage = ({ classNames, message, collapse, debug, onSuggest, onDelete }) => {
|
|
977
1201
|
if (typeof message !== "object") {
|
|
978
|
-
return /* @__PURE__ */
|
|
979
|
-
className: (0,
|
|
1202
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1203
|
+
className: (0, import_react_ui_theme2.mx)(classNames)
|
|
980
1204
|
}, message);
|
|
981
1205
|
}
|
|
982
1206
|
const { role, content = [] } = message;
|
|
983
|
-
const
|
|
984
|
-
if (collapse &&
|
|
1207
|
+
const toolBlocks = content.filter((block) => block.type === "tool_use" || block.type === "tool_result");
|
|
1208
|
+
if (collapse && toolBlocks.length > 0) {
|
|
985
1209
|
let request;
|
|
986
|
-
const
|
|
987
|
-
switch (
|
|
1210
|
+
const items = toolBlocks.map((block) => {
|
|
1211
|
+
switch (block.type) {
|
|
988
1212
|
case "tool_use": {
|
|
989
|
-
request =
|
|
990
|
-
return
|
|
1213
|
+
request = block;
|
|
1214
|
+
return {
|
|
1215
|
+
title: `Calling ${block.name}...`,
|
|
1216
|
+
block
|
|
1217
|
+
};
|
|
991
1218
|
}
|
|
992
1219
|
case "tool_result": {
|
|
993
1220
|
if (!request) {
|
|
994
|
-
|
|
1221
|
+
import_log6.log.warn("unexpected message", {
|
|
1222
|
+
block
|
|
1223
|
+
}, {
|
|
1224
|
+
F: __dxlog_file4,
|
|
1225
|
+
L: 54,
|
|
1226
|
+
S: void 0,
|
|
1227
|
+
C: (f, a) => f(...a)
|
|
1228
|
+
});
|
|
1229
|
+
return {
|
|
1230
|
+
title: "Error",
|
|
1231
|
+
block
|
|
1232
|
+
};
|
|
995
1233
|
}
|
|
996
|
-
return
|
|
1234
|
+
return {
|
|
1235
|
+
title: `Processed ${request.name}`,
|
|
1236
|
+
block
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
default: {
|
|
1240
|
+
request = void 0;
|
|
1241
|
+
return {
|
|
1242
|
+
title: "Error",
|
|
1243
|
+
block
|
|
1244
|
+
};
|
|
997
1245
|
}
|
|
998
|
-
default:
|
|
999
|
-
return "Error";
|
|
1000
1246
|
}
|
|
1001
1247
|
});
|
|
1002
|
-
return /* @__PURE__ */
|
|
1003
|
-
className: (0,
|
|
1004
|
-
}, /* @__PURE__ */
|
|
1005
|
-
className: "w-full p-1 px-2 overflow-hidden rounded-md bg-
|
|
1006
|
-
}, /* @__PURE__ */
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
autoAdvance: true
|
|
1010
|
-
}),
|
|
1011
|
-
toggle: true
|
|
1012
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_syntax_highlighter.Json, {
|
|
1013
|
-
data: content[content.length - 1],
|
|
1014
|
-
classNames: "!p-1 text-xs"
|
|
1015
|
-
}))));
|
|
1248
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1249
|
+
className: (0, import_react_ui_theme2.mx)("flex", classNames)
|
|
1250
|
+
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1251
|
+
className: "w-full p-1 px-2 overflow-hidden rounded-md bg-baseSurface"
|
|
1252
|
+
}, /* @__PURE__ */ import_react7.default.createElement(TabbedContainer, {
|
|
1253
|
+
items
|
|
1254
|
+
})));
|
|
1016
1255
|
}
|
|
1017
|
-
return /* @__PURE__ */
|
|
1018
|
-
className: (0,
|
|
1019
|
-
}, debug && /* @__PURE__ */
|
|
1256
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1257
|
+
className: (0, import_react_ui_theme2.mx)("flex flex-col shrink-0 gap-2")
|
|
1258
|
+
}, debug && /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1020
1259
|
className: "text-xs text-subdued"
|
|
1021
|
-
}, message.id, " ", onDelete && /* @__PURE__ */
|
|
1260
|
+
}, message.id, " ", onDelete && /* @__PURE__ */ import_react7.default.createElement("span", {
|
|
1022
1261
|
className: "cursor-pointer underline",
|
|
1023
1262
|
onClick: () => onDelete(message.id)
|
|
1024
|
-
}, "delete")), content.map((block, idx) => /* @__PURE__ */
|
|
1263
|
+
}, "delete")), content.map((block, idx) => /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1025
1264
|
key: idx,
|
|
1026
|
-
className: (0,
|
|
1027
|
-
}, /* @__PURE__ */
|
|
1265
|
+
className: (0, import_react_ui_theme2.mx)("flex", classNames, block.type === "text" && role === "user" && "justify-end")
|
|
1266
|
+
}, /* @__PURE__ */ import_react7.default.createElement(Block, {
|
|
1028
1267
|
role,
|
|
1029
1268
|
block,
|
|
1030
1269
|
onSuggest: onSuggest ?? (() => {
|
|
@@ -1033,24 +1272,23 @@ var ThreadMessage = ({ classNames, message, collapse, debug, onSuggest, onDelete
|
|
|
1033
1272
|
};
|
|
1034
1273
|
var Block = ({ block, role, onSuggest }) => {
|
|
1035
1274
|
const Component = componentMap[block.type] ?? componentMap.default;
|
|
1036
|
-
return /* @__PURE__ */
|
|
1037
|
-
className: (0,
|
|
1038
|
-
}, /* @__PURE__ */
|
|
1275
|
+
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1276
|
+
className: (0, import_react_ui_theme2.mx)("p-1 px-2 overflow-hidden rounded-md", (block.type !== "text" || block.disposition) && "w-full bg-baseSurface", block.type === "text" && role === "user" && "bg-primary-200 dark:bg-primary-500")
|
|
1277
|
+
}, /* @__PURE__ */ import_react7.default.createElement(Component, {
|
|
1039
1278
|
block,
|
|
1040
1279
|
onSuggest
|
|
1041
1280
|
}));
|
|
1042
1281
|
};
|
|
1043
1282
|
var titles = {
|
|
1044
1283
|
["cot"]: "Chain of thought",
|
|
1045
|
-
|
|
1284
|
+
["artifact"]: "Artifact",
|
|
1046
1285
|
["tool_use"]: "Tool request",
|
|
1047
|
-
["tool_result"]: "Tool result"
|
|
1048
|
-
["artifact"]: "Artifact"
|
|
1286
|
+
["tool_result"]: "Tool result"
|
|
1049
1287
|
};
|
|
1050
1288
|
var componentMap = {
|
|
1051
1289
|
text: ({ block }) => {
|
|
1052
|
-
(0,
|
|
1053
|
-
F:
|
|
1290
|
+
(0, import_invariant6.invariant)(block.type === "text", void 0, {
|
|
1291
|
+
F: __dxlog_file4,
|
|
1054
1292
|
L: 128,
|
|
1055
1293
|
S: void 0,
|
|
1056
1294
|
A: [
|
|
@@ -1060,23 +1298,22 @@ var componentMap = {
|
|
|
1060
1298
|
});
|
|
1061
1299
|
const title = block.disposition ? titles[block.disposition] : void 0;
|
|
1062
1300
|
if (!title) {
|
|
1063
|
-
return /* @__PURE__ */
|
|
1301
|
+
return /* @__PURE__ */ import_react7.default.createElement(MarkdownViewer, {
|
|
1064
1302
|
content: block.text,
|
|
1065
1303
|
classNames: [
|
|
1066
1304
|
block.disposition === "cot" && "text-sm text-subdued"
|
|
1067
1305
|
]
|
|
1068
1306
|
});
|
|
1069
1307
|
}
|
|
1070
|
-
return /* @__PURE__ */
|
|
1308
|
+
return /* @__PURE__ */ import_react7.default.createElement(ToggleContainer, {
|
|
1071
1309
|
title,
|
|
1072
|
-
icon: block.pending ? /* @__PURE__ */
|
|
1310
|
+
icon: block.pending ? /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Icon, {
|
|
1073
1311
|
icon: "ph--circle-notch--regular",
|
|
1074
1312
|
classNames: "text-subdued ml-2 animate-spin",
|
|
1075
1313
|
size: 4
|
|
1076
1314
|
}) : void 0,
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
}, /* @__PURE__ */ import_react6.default.createElement(MarkdownViewer, {
|
|
1315
|
+
open: block.disposition === "cot"
|
|
1316
|
+
}, /* @__PURE__ */ import_react7.default.createElement(MarkdownViewer, {
|
|
1080
1317
|
content: block.text,
|
|
1081
1318
|
classNames: [
|
|
1082
1319
|
block.disposition === "cot" && "text-sm text-subdued"
|
|
@@ -1084,9 +1321,9 @@ var componentMap = {
|
|
|
1084
1321
|
}));
|
|
1085
1322
|
},
|
|
1086
1323
|
json: ({ block, onSuggest }) => {
|
|
1087
|
-
(0,
|
|
1088
|
-
F:
|
|
1089
|
-
L:
|
|
1324
|
+
(0, import_invariant6.invariant)(block.type === "json", void 0, {
|
|
1325
|
+
F: __dxlog_file4,
|
|
1326
|
+
L: 152,
|
|
1090
1327
|
S: void 0,
|
|
1091
1328
|
A: [
|
|
1092
1329
|
"block.type === 'json'",
|
|
@@ -1096,23 +1333,22 @@ var componentMap = {
|
|
|
1096
1333
|
switch (block.disposition) {
|
|
1097
1334
|
case "suggest": {
|
|
1098
1335
|
const { text = "" } = (0, import_util3.safeParseJson)(block.json ?? "{}") ?? {};
|
|
1099
|
-
return /* @__PURE__ */
|
|
1336
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Button, {
|
|
1100
1337
|
onClick: () => onSuggest(text)
|
|
1101
1338
|
}, text);
|
|
1102
1339
|
}
|
|
1103
1340
|
case "select": {
|
|
1104
1341
|
const { options = [] } = (0, import_util3.safeParseJson)(block.json ?? "{}") ?? {};
|
|
1105
|
-
return /* @__PURE__ */
|
|
1342
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.ButtonGroup, null, options.map((option) => /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Button, {
|
|
1106
1343
|
key: option,
|
|
1107
1344
|
onClick: () => onSuggest(option)
|
|
1108
1345
|
}, option)));
|
|
1109
1346
|
}
|
|
1110
1347
|
default: {
|
|
1111
1348
|
const title = block.disposition ? titles[block.disposition] : void 0;
|
|
1112
|
-
return /* @__PURE__ */
|
|
1113
|
-
title: title ?? "JSON"
|
|
1114
|
-
|
|
1115
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_syntax_highlighter.Json, {
|
|
1349
|
+
return /* @__PURE__ */ import_react7.default.createElement(ToggleContainer, {
|
|
1350
|
+
title: title ?? "JSON"
|
|
1351
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui_syntax_highlighter.Json, {
|
|
1116
1352
|
data: (0, import_util3.safeParseJson)(block.json ?? block),
|
|
1117
1353
|
classNames: "!p-1 text-xs"
|
|
1118
1354
|
}));
|
|
@@ -1124,20 +1360,57 @@ var componentMap = {
|
|
|
1124
1360
|
if (block.type === "tool_use") {
|
|
1125
1361
|
title = `Tool [${block.name}]`;
|
|
1126
1362
|
}
|
|
1127
|
-
return /* @__PURE__ */
|
|
1128
|
-
title: title ?? "JSON"
|
|
1129
|
-
|
|
1130
|
-
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_syntax_highlighter.Json, {
|
|
1363
|
+
return /* @__PURE__ */ import_react7.default.createElement(ToggleContainer, {
|
|
1364
|
+
title: title ?? "JSON"
|
|
1365
|
+
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui_syntax_highlighter.Json, {
|
|
1131
1366
|
data: block,
|
|
1132
1367
|
classNames: "!p-1 text-xs"
|
|
1133
1368
|
}));
|
|
1134
1369
|
}
|
|
1135
1370
|
};
|
|
1371
|
+
var TabbedContainer = ({ items }) => {
|
|
1372
|
+
const lines = items.map((item) => item.title);
|
|
1373
|
+
const tabsRef = (0, import_react7.useRef)(null);
|
|
1374
|
+
const [selected, setSelected] = (0, import_react7.useState)(0);
|
|
1375
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
1376
|
+
(0, import_react7.useEffect)(() => {
|
|
1377
|
+
if (open) {
|
|
1378
|
+
tabsRef.current?.focus();
|
|
1379
|
+
}
|
|
1380
|
+
}, [
|
|
1381
|
+
open
|
|
1382
|
+
]);
|
|
1383
|
+
const handleSelect = (index) => {
|
|
1384
|
+
if (index === selected) {
|
|
1385
|
+
setOpen(false);
|
|
1386
|
+
} else {
|
|
1387
|
+
setSelected(index);
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
return /* @__PURE__ */ import_react7.default.createElement(ToggleContainer, {
|
|
1391
|
+
title: /* @__PURE__ */ import_react7.default.createElement(StatusLine, {
|
|
1392
|
+
lines,
|
|
1393
|
+
autoAdvance: true
|
|
1394
|
+
}),
|
|
1395
|
+
open,
|
|
1396
|
+
onChangeOpen: setOpen
|
|
1397
|
+
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
1398
|
+
className: "flex gap-2 w-full"
|
|
1399
|
+
}, /* @__PURE__ */ import_react7.default.createElement(Tabs, {
|
|
1400
|
+
ref: tabsRef,
|
|
1401
|
+
length: items.length,
|
|
1402
|
+
selected,
|
|
1403
|
+
onSelect: handleSelect
|
|
1404
|
+
}), /* @__PURE__ */ import_react7.default.createElement(import_react_ui_syntax_highlighter.Json, {
|
|
1405
|
+
data: items[selected].block,
|
|
1406
|
+
classNames: "!p-1 text-xs"
|
|
1407
|
+
})));
|
|
1408
|
+
};
|
|
1136
1409
|
var Thread = ({ messages, streaming, collapse, debug, onSubmit, onStop, onSuggest, onDelete }) => {
|
|
1137
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
1138
|
-
const scroller = (0,
|
|
1139
|
-
const [text, setText] = (0,
|
|
1140
|
-
const handleKeyDown = (0,
|
|
1410
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_EQYHOTGG.AUTOMATION_PLUGIN);
|
|
1411
|
+
const scroller = (0, import_react6.useRef)(null);
|
|
1412
|
+
const [text, setText] = (0, import_react6.useState)("");
|
|
1413
|
+
const handleKeyDown = (0, import_react6.useCallback)((ev) => {
|
|
1141
1414
|
switch (ev.key) {
|
|
1142
1415
|
case "Escape": {
|
|
1143
1416
|
setText("");
|
|
@@ -1156,7 +1429,7 @@ var Thread = ({ messages, streaming, collapse, debug, onSubmit, onStop, onSugges
|
|
|
1156
1429
|
}, [
|
|
1157
1430
|
text
|
|
1158
1431
|
]);
|
|
1159
|
-
const { messages: lines = [] } = (0,
|
|
1432
|
+
const { messages: lines = [] } = (0, import_react6.useMemo)(() => {
|
|
1160
1433
|
if (!collapse) {
|
|
1161
1434
|
return {
|
|
1162
1435
|
messages: messages ?? []
|
|
@@ -1214,12 +1487,12 @@ var Thread = ({ messages, streaming, collapse, debug, onSubmit, onStop, onSugges
|
|
|
1214
1487
|
messages,
|
|
1215
1488
|
collapse
|
|
1216
1489
|
]);
|
|
1217
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
1218
1491
|
className: "flex flex-col grow overflow-hidden"
|
|
1219
|
-
}, /* @__PURE__ */
|
|
1492
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_components.ScrollContainer, {
|
|
1220
1493
|
ref: scroller,
|
|
1221
1494
|
classNames: "py-2 gap-2 overflow-x-hidden"
|
|
1222
|
-
}, lines.map((message) => /* @__PURE__ */
|
|
1495
|
+
}, lines.map((message) => /* @__PURE__ */ import_react6.default.createElement(ThreadMessage, {
|
|
1223
1496
|
key: message.id,
|
|
1224
1497
|
classNames: "px-4",
|
|
1225
1498
|
message,
|
|
@@ -1227,18 +1500,18 @@ var Thread = ({ messages, streaming, collapse, debug, onSubmit, onStop, onSugges
|
|
|
1227
1500
|
debug,
|
|
1228
1501
|
onSuggest,
|
|
1229
1502
|
onDelete
|
|
1230
|
-
}))), onSubmit && /* @__PURE__ */
|
|
1503
|
+
}))), onSubmit && /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
1231
1504
|
className: "flex p-4 gap-3 items-center"
|
|
1232
|
-
}, /* @__PURE__ */
|
|
1505
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui_sfx.Spinner, {
|
|
1233
1506
|
active: streaming
|
|
1234
|
-
}), /* @__PURE__ */
|
|
1507
|
+
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui.Input.Root, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui.Input.TextInput, {
|
|
1235
1508
|
autoFocus: true,
|
|
1236
|
-
classNames: "px-2
|
|
1509
|
+
classNames: "px-2 baseSurface rounded",
|
|
1237
1510
|
placeholder: t("chat input placeholder"),
|
|
1238
1511
|
value: text,
|
|
1239
1512
|
onChange: (ev) => setText(ev.target.value),
|
|
1240
1513
|
onKeyDown: handleKeyDown
|
|
1241
|
-
})), onStop && /* @__PURE__ */
|
|
1514
|
+
})), onStop && /* @__PURE__ */ import_react6.default.createElement(import_react_ui.IconButton, {
|
|
1242
1515
|
disabled: !streaming,
|
|
1243
1516
|
classNames: (0, import_react_ui_theme.mx)("!p-1 !opacity-20 transition", streaming && "!opacity-80"),
|
|
1244
1517
|
variant: "ghost",
|
|
@@ -1249,81 +1522,28 @@ var Thread = ({ messages, streaming, collapse, debug, onSubmit, onStop, onSugges
|
|
|
1249
1522
|
iconOnly: true
|
|
1250
1523
|
})));
|
|
1251
1524
|
};
|
|
1252
|
-
var
|
|
1525
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-automation/src/components/ChatContainer/ChatContainer.tsx";
|
|
1253
1526
|
var ChatContainer = ({ chat, role }) => {
|
|
1254
|
-
const
|
|
1255
|
-
const
|
|
1256
|
-
const aiClient = (0, import_app_framework.useCapability)(import_chunk_ZS5RZ7RM.AutomationCapabilities.AiClient);
|
|
1257
|
-
const artifactDefinitions = (0, import_app_framework.useCapabilities)(import_app_framework.Capabilities.ArtifactDefinition);
|
|
1258
|
-
const globalTools = (0, import_app_framework.useCapabilities)(import_app_framework.Capabilities.Tools);
|
|
1259
|
-
const functions = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_functions.FunctionType));
|
|
1260
|
-
const serviceRegistry = (0, import_react.useMemo)(() => new import_chunk_LU4HQWJD.MockServiceRegistry(), []);
|
|
1261
|
-
const [serviceTools, setServiceTools] = (0, import_react.useState)([]);
|
|
1262
|
-
(0, import_react.useEffect)(() => {
|
|
1263
|
-
queueMicrotask(async () => {
|
|
1264
|
-
const services = await serviceRegistry.queryServices({});
|
|
1265
|
-
const tools2 = await Promise.all(services.map((service) => createToolsFromService(service)));
|
|
1266
|
-
setServiceTools(tools2.flat());
|
|
1267
|
-
});
|
|
1268
|
-
}, []);
|
|
1269
|
-
const tools = (0, import_react.useMemo)(() => [
|
|
1270
|
-
...globalTools.flat(),
|
|
1271
|
-
...artifactDefinitions.flatMap((definition) => definition.tools),
|
|
1272
|
-
...functions.map((fn) => covertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? "", space?.id)).filter(import_util.isNotNullOrUndefined),
|
|
1273
|
-
...serviceTools
|
|
1274
|
-
], [
|
|
1275
|
-
globalTools,
|
|
1276
|
-
artifactDefinitions,
|
|
1277
|
-
functions,
|
|
1278
|
-
serviceTools,
|
|
1279
|
-
space?.id
|
|
1280
|
-
]);
|
|
1281
|
-
const systemPrompt = (0, import_react.useMemo)(() => (0, import_artifact.createSystemPrompt)({
|
|
1282
|
-
artifacts: artifactDefinitions.map((definition) => definition.instructions)
|
|
1283
|
-
}), [
|
|
1284
|
-
artifactDefinitions
|
|
1285
|
-
]);
|
|
1286
|
-
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
1287
|
-
const processor = (0, import_react.useMemo)(() => new ChatProcessor(aiClient, tools, {
|
|
1288
|
-
space,
|
|
1289
|
-
dispatch
|
|
1290
|
-
}, {
|
|
1291
|
-
model: "@anthropic/claude-3-5-sonnet-20241022",
|
|
1292
|
-
systemPrompt
|
|
1293
|
-
}), [
|
|
1294
|
-
aiClient,
|
|
1295
|
-
tools,
|
|
1296
|
-
space,
|
|
1297
|
-
dispatch,
|
|
1298
|
-
systemPrompt
|
|
1299
|
-
]);
|
|
1300
|
-
const queueDxn = (0, import_react.useMemo)(() => new import_keys.DXN(import_keys.DXN.kind.QUEUE, [
|
|
1301
|
-
import_keys.QueueSubspaceTags.DATA,
|
|
1302
|
-
space.id,
|
|
1303
|
-
chat.queue.dxn.parts.at(-1)
|
|
1304
|
-
]), [
|
|
1305
|
-
chat.queue.dxn
|
|
1306
|
-
]);
|
|
1307
|
-
const edgeClient = (0, import_react_edge_client.useEdgeClient)();
|
|
1308
|
-
const messageQueue = (0, import_react_edge_client.useQueue)(edgeClient, queueDxn);
|
|
1527
|
+
const processor = useChatProcessor(chat);
|
|
1528
|
+
const messageQueue = useMessageQueue(chat);
|
|
1309
1529
|
const messages = [
|
|
1310
1530
|
...messageQueue?.items ?? [],
|
|
1311
1531
|
...processor.messages.value
|
|
1312
1532
|
];
|
|
1313
|
-
const handleSubmit = (0, import_react.useCallback)(async (
|
|
1533
|
+
const handleSubmit = (0, import_react.useCallback)(async (text) => {
|
|
1314
1534
|
if (processor.streaming.value) {
|
|
1315
1535
|
await processor.cancel();
|
|
1316
1536
|
}
|
|
1317
1537
|
(0, import_invariant.invariant)(messageQueue, void 0, {
|
|
1318
|
-
F:
|
|
1319
|
-
L:
|
|
1538
|
+
F: __dxlog_file5,
|
|
1539
|
+
L: 25,
|
|
1320
1540
|
S: void 0,
|
|
1321
1541
|
A: [
|
|
1322
1542
|
"messageQueue",
|
|
1323
1543
|
""
|
|
1324
1544
|
]
|
|
1325
1545
|
});
|
|
1326
|
-
await processor.request(
|
|
1546
|
+
await processor.request(text, {
|
|
1327
1547
|
history: messageQueue.items,
|
|
1328
1548
|
onComplete: (messages2) => messageQueue.append(messages2)
|
|
1329
1549
|
});
|
|
@@ -1344,7 +1564,9 @@ var ChatContainer = ({ chat, role }) => {
|
|
|
1344
1564
|
}, /* @__PURE__ */ import_react.default.createElement(Thread, {
|
|
1345
1565
|
messages,
|
|
1346
1566
|
streaming: processor.streaming.value,
|
|
1567
|
+
collapse: true,
|
|
1347
1568
|
onSubmit: handleSubmit,
|
|
1569
|
+
onSuggest: handleSubmit,
|
|
1348
1570
|
onStop: handleStop
|
|
1349
1571
|
}));
|
|
1350
1572
|
};
|
|
@@ -1359,6 +1581,6 @@ var ChatContainer_default = ChatContainer;
|
|
|
1359
1581
|
MarkdownViewer,
|
|
1360
1582
|
ReactSurface,
|
|
1361
1583
|
Thread,
|
|
1362
|
-
|
|
1584
|
+
useServices
|
|
1363
1585
|
});
|
|
1364
|
-
//# sourceMappingURL=chunk-
|
|
1586
|
+
//# sourceMappingURL=chunk-CJGJXNY3.cjs.map
|