@dxos/plugin-script 0.8.2-main.f11618f → 0.8.2-staging.7ac8446
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/DeploymentDialog-AEPYJKPO.mjs +12 -0
- package/dist/lib/browser/{ScriptContainer-ATBYTIFH.mjs → ScriptContainer-R25PRK2D.mjs} +6 -6
- package/dist/lib/browser/{app-graph-builder-2GIBRQLV.mjs → app-graph-builder-RRLY67QC.mjs} +2 -2
- package/dist/lib/browser/{artifact-definition-OEDM2SCN.mjs → artifact-definition-WXFYD2V5.mjs} +5 -5
- package/dist/lib/browser/artifact-definition-WXFYD2V5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QNXJNXQZ.mjs → chunk-2CGZFDCR.mjs} +4 -4
- package/dist/lib/browser/{chunk-A4VOGQ2P.mjs → chunk-4VD3K3PY.mjs} +2 -2
- package/dist/lib/browser/{chunk-OZEMT3NO.mjs → chunk-CSZXPLYY.mjs} +3 -3
- package/dist/lib/browser/{chunk-EGDYE5MW.mjs → chunk-KLEOGVXY.mjs} +6 -6
- package/dist/lib/browser/chunk-KLEOGVXY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SXS6PUU5.mjs → chunk-MQZQB5VD.mjs} +10 -9
- package/dist/lib/browser/chunk-MQZQB5VD.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZFTDU4WS.mjs → chunk-R2CHVWJ2.mjs} +2 -2
- package/dist/lib/browser/chunk-SUCBNCEQ.mjs +87 -0
- package/dist/lib/browser/chunk-SUCBNCEQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KJMVDGRB.mjs → chunk-WSK3YQXI.mjs} +1 -2
- package/dist/lib/browser/{chunk-KJMVDGRB.mjs.map → chunk-WSK3YQXI.mjs.map} +2 -2
- package/dist/lib/browser/{compiler-O4FJK7RR.mjs → compiler-56LTBEQB.mjs} +3 -3
- package/dist/lib/browser/index.mjs +13 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-C5D6TNPC.mjs → intent-resolver-WCVXKRBR.mjs} +10 -10
- package/dist/lib/browser/intent-resolver-WCVXKRBR.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-XJCN7XXF.mjs → react-surface-WXZVPNGI.mjs} +9 -9
- package/dist/lib/browser/{settings-NK4XVS2E.mjs → settings-Z7B37V2I.mjs} +5 -5
- package/dist/lib/browser/settings-Z7B37V2I.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/{DeploymentDialog-NUKZNILK.cjs → DeploymentDialog-O4MU4OMF.cjs} +10 -10
- package/dist/lib/node/DeploymentDialog-O4MU4OMF.cjs.map +7 -0
- package/dist/lib/node/{ScriptContainer-OHHMLPUE.cjs → ScriptContainer-5KY6ZOQD.cjs} +15 -15
- package/dist/lib/node/{app-graph-builder-LNI22TZF.cjs → app-graph-builder-6I2BWD46.cjs} +9 -9
- package/dist/lib/node/{artifact-definition-SEGATFNH.cjs → artifact-definition-6NVXEHJD.cjs} +12 -12
- package/dist/lib/node/artifact-definition-6NVXEHJD.cjs.map +7 -0
- package/dist/lib/node/{chunk-PMGWL64F.cjs → chunk-65MIJR3Q.cjs} +17 -17
- package/dist/lib/node/{chunk-UUGLBCMY.cjs → chunk-F4DP7WON.cjs} +19 -19
- package/dist/lib/node/{chunk-UUGLBCMY.cjs.map → chunk-F4DP7WON.cjs.map} +3 -3
- package/dist/lib/node/{chunk-KFJQVOGS.cjs → chunk-JICWAOWZ.cjs} +6 -6
- package/dist/lib/node/{chunk-ZZ4HK5KM.cjs → chunk-SLDJM45C.cjs} +12 -12
- package/dist/lib/node/{chunk-DSFCLQ5F.cjs → chunk-VYBEBLDO.cjs} +12 -11
- package/dist/lib/node/chunk-VYBEBLDO.cjs.map +7 -0
- package/dist/lib/node/chunk-X7MHLHHS.cjs +91 -0
- package/dist/lib/node/chunk-X7MHLHHS.cjs.map +7 -0
- package/dist/lib/node/{chunk-PGEGRJP3.cjs → chunk-XFZPWFEG.cjs} +6 -6
- package/dist/lib/node/{chunk-NO5Y74F3.cjs → chunk-YJQZHKKA.cjs} +4 -5
- package/dist/lib/node/{chunk-NO5Y74F3.cjs.map → chunk-YJQZHKKA.cjs.map} +2 -2
- package/dist/lib/node/{compiler-FBC6ELQN.cjs → compiler-W2RU3M7U.cjs} +7 -7
- package/dist/lib/node/index.cjs +37 -38
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-BQPBRVHM.cjs → intent-resolver-J4NBDNFH.cjs} +17 -17
- package/dist/lib/node/intent-resolver-J4NBDNFH.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-5XHS5WYW.cjs → react-surface-27KTUBIZ.cjs} +31 -31
- package/dist/lib/node/{settings-7PVJBWC4.cjs → settings-EI6VPNKN.cjs} +9 -9
- package/dist/lib/node/settings-EI6VPNKN.cjs.map +7 -0
- package/dist/lib/node/types.cjs +5 -5
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{DeploymentDialog-BIXZ5Q57.mjs → DeploymentDialog-SSQSWLHX.mjs} +5 -5
- package/dist/lib/node-esm/{ScriptContainer-4YWGWPY7.mjs → ScriptContainer-W2F4FGDV.mjs} +6 -6
- package/dist/lib/node-esm/{app-graph-builder-NNUXXXMZ.mjs → app-graph-builder-H5XLRVX3.mjs} +2 -2
- package/dist/lib/node-esm/{artifact-definition-5UHIXXHW.mjs → artifact-definition-KQ64AYBP.mjs} +5 -5
- package/dist/lib/node-esm/artifact-definition-KQ64AYBP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4ISQLIIH.mjs → chunk-4MTPYMV2.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-HKJUN636.mjs → chunk-EB5DSAD4.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-TN35DSTF.mjs → chunk-F4HA5C34.mjs} +10 -9
- package/dist/lib/node-esm/chunk-F4HA5C34.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-H7FRB3M7.mjs → chunk-FDEAVT67.mjs} +1 -2
- package/dist/lib/node-esm/{chunk-H7FRB3M7.mjs.map → chunk-FDEAVT67.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-GR4VTXVM.mjs → chunk-MU3JKVL2.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-NNQXJQBG.mjs → chunk-PBGVTGL2.mjs} +6 -6
- package/dist/lib/node-esm/chunk-PBGVTGL2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QDYGTY4L.mjs +89 -0
- package/dist/lib/node-esm/chunk-QDYGTY4L.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KGYTIL33.mjs → chunk-RW2APVMV.mjs} +2 -2
- package/dist/lib/node-esm/{compiler-3NG4T5LH.mjs → compiler-VT5C2Z3T.mjs} +3 -3
- package/dist/lib/node-esm/index.mjs +13 -14
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-PPJKPHUQ.mjs → intent-resolver-PDZ2A26X.mjs} +10 -10
- package/dist/lib/node-esm/intent-resolver-PDZ2A26X.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-7ELFL7IO.mjs → react-surface-UCUVDVSH.mjs} +9 -9
- package/dist/lib/node-esm/{settings-SJYC4JLT.mjs → settings-HU5UEFRF.mjs} +5 -5
- package/dist/lib/node-esm/settings-HU5UEFRF.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +2 -2
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/templates/data-generator.d.ts +7 -0
- package/dist/types/src/templates/data-generator.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/package.json +47 -47
- package/src/ScriptPlugin.tsx +1 -3
- package/src/capabilities/artifact-definition.ts +3 -3
- package/src/capabilities/intent-resolver.ts +3 -3
- package/src/capabilities/settings.ts +2 -2
- package/src/hooks/useToolbarState.ts +2 -2
- package/src/meta.ts +0 -1
- package/src/templates/data-generator.ts +45 -25
- package/src/templates/discord.ts +2 -2
- package/src/templates/gmail.ts +2 -2
- package/src/util/deploy.ts +7 -4
- package/dist/lib/browser/DeploymentDialog-QEKJ54ZB.mjs +0 -12
- package/dist/lib/browser/artifact-definition-OEDM2SCN.mjs.map +0 -7
- package/dist/lib/browser/chunk-EGDYE5MW.mjs.map +0 -7
- package/dist/lib/browser/chunk-SXS6PUU5.mjs.map +0 -7
- package/dist/lib/browser/chunk-XEPVXV72.mjs +0 -87
- package/dist/lib/browser/chunk-XEPVXV72.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-C5D6TNPC.mjs.map +0 -7
- package/dist/lib/browser/settings-NK4XVS2E.mjs.map +0 -7
- package/dist/lib/node/DeploymentDialog-NUKZNILK.cjs.map +0 -7
- package/dist/lib/node/artifact-definition-SEGATFNH.cjs.map +0 -7
- package/dist/lib/node/chunk-4K23KEYT.cjs +0 -91
- package/dist/lib/node/chunk-4K23KEYT.cjs.map +0 -7
- package/dist/lib/node/chunk-DSFCLQ5F.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-BQPBRVHM.cjs.map +0 -7
- package/dist/lib/node/settings-7PVJBWC4.cjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-5UHIXXHW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NNQXJQBG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TN35DSTF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X64SI6XO.mjs +0 -89
- package/dist/lib/node-esm/chunk-X64SI6XO.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-PPJKPHUQ.mjs.map +0 -7
- package/dist/lib/node-esm/settings-SJYC4JLT.mjs.map +0 -7
- /package/dist/lib/browser/{DeploymentDialog-QEKJ54ZB.mjs.map → DeploymentDialog-AEPYJKPO.mjs.map} +0 -0
- /package/dist/lib/browser/{ScriptContainer-ATBYTIFH.mjs.map → ScriptContainer-R25PRK2D.mjs.map} +0 -0
- /package/dist/lib/browser/{app-graph-builder-2GIBRQLV.mjs.map → app-graph-builder-RRLY67QC.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-QNXJNXQZ.mjs.map → chunk-2CGZFDCR.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-A4VOGQ2P.mjs.map → chunk-4VD3K3PY.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-OZEMT3NO.mjs.map → chunk-CSZXPLYY.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-ZFTDU4WS.mjs.map → chunk-R2CHVWJ2.mjs.map} +0 -0
- /package/dist/lib/browser/{compiler-O4FJK7RR.mjs.map → compiler-56LTBEQB.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-XJCN7XXF.mjs.map → react-surface-WXZVPNGI.mjs.map} +0 -0
- /package/dist/lib/node/{ScriptContainer-OHHMLPUE.cjs.map → ScriptContainer-5KY6ZOQD.cjs.map} +0 -0
- /package/dist/lib/node/{app-graph-builder-LNI22TZF.cjs.map → app-graph-builder-6I2BWD46.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-PMGWL64F.cjs.map → chunk-65MIJR3Q.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-KFJQVOGS.cjs.map → chunk-JICWAOWZ.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-ZZ4HK5KM.cjs.map → chunk-SLDJM45C.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-PGEGRJP3.cjs.map → chunk-XFZPWFEG.cjs.map} +0 -0
- /package/dist/lib/node/{compiler-FBC6ELQN.cjs.map → compiler-W2RU3M7U.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-5XHS5WYW.cjs.map → react-surface-27KTUBIZ.cjs.map} +0 -0
- /package/dist/lib/node-esm/{DeploymentDialog-BIXZ5Q57.mjs.map → DeploymentDialog-SSQSWLHX.mjs.map} +0 -0
- /package/dist/lib/node-esm/{ScriptContainer-4YWGWPY7.mjs.map → ScriptContainer-W2F4FGDV.mjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-NNUXXXMZ.mjs.map → app-graph-builder-H5XLRVX3.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-4ISQLIIH.mjs.map → chunk-4MTPYMV2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-HKJUN636.mjs.map → chunk-EB5DSAD4.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-GR4VTXVM.mjs.map → chunk-MU3JKVL2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-KGYTIL33.mjs.map → chunk-RW2APVMV.mjs.map} +0 -0
- /package/dist/lib/node-esm/{compiler-3NG4T5LH.mjs.map → compiler-VT5C2Z3T.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-7ELFL7IO.mjs.map → react-surface-UCUVDVSH.mjs.map} +0 -0
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var app_graph_builder_6I2BWD46_exports = {};
|
|
20
|
+
__export(app_graph_builder_6I2BWD46_exports, {
|
|
21
21
|
default: () => app_graph_builder_default
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(app_graph_builder_6I2BWD46_exports);
|
|
24
|
+
var import_chunk_YJQZHKKA = require("./chunk-YJQZHKKA.cjs");
|
|
25
25
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
26
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
27
27
|
var import_functions = require("@dxos/functions");
|
|
@@ -29,7 +29,7 @@ var import_types = require("@dxos/plugin-deck/types");
|
|
|
29
29
|
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
30
30
|
var app_graph_builder_default = (context) => (0, import_app_framework.contributes)(import_app_framework.Capabilities.AppGraphBuilder, [
|
|
31
31
|
(0, import_plugin_graph.createExtension)({
|
|
32
|
-
id: `${
|
|
32
|
+
id: `${import_chunk_YJQZHKKA.meta.id}/execute`,
|
|
33
33
|
filter: (node) => (0, import_echo_schema.isInstanceOf)(import_functions.ScriptType, node.data),
|
|
34
34
|
connector: ({ node }) => [
|
|
35
35
|
{
|
|
@@ -43,7 +43,7 @@ var app_graph_builder_default = (context) => (0, import_app_framework.contribute
|
|
|
43
43
|
label: [
|
|
44
44
|
"script test label",
|
|
45
45
|
{
|
|
46
|
-
ns:
|
|
46
|
+
ns: import_chunk_YJQZHKKA.meta.id
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
49
|
icon: "ph--terminal--regular",
|
|
@@ -53,7 +53,7 @@ var app_graph_builder_default = (context) => (0, import_app_framework.contribute
|
|
|
53
53
|
]
|
|
54
54
|
}),
|
|
55
55
|
(0, import_plugin_graph.createExtension)({
|
|
56
|
-
id: `${
|
|
56
|
+
id: `${import_chunk_YJQZHKKA.meta.id}/logs`,
|
|
57
57
|
filter: (node) => (0, import_echo_schema.isInstanceOf)(import_functions.ScriptType, node.data),
|
|
58
58
|
connector: ({ node }) => [
|
|
59
59
|
{
|
|
@@ -67,7 +67,7 @@ var app_graph_builder_default = (context) => (0, import_app_framework.contribute
|
|
|
67
67
|
label: [
|
|
68
68
|
"script logs label",
|
|
69
69
|
{
|
|
70
|
-
ns:
|
|
70
|
+
ns: import_chunk_YJQZHKKA.meta.id
|
|
71
71
|
}
|
|
72
72
|
],
|
|
73
73
|
icon: "ph--clock-countdown--regular",
|
|
@@ -77,4 +77,4 @@ var app_graph_builder_default = (context) => (0, import_app_framework.contribute
|
|
|
77
77
|
]
|
|
78
78
|
})
|
|
79
79
|
]);
|
|
80
|
-
//# sourceMappingURL=app-graph-builder-
|
|
80
|
+
//# sourceMappingURL=app-graph-builder-6I2BWD46.cjs.map
|
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var artifact_definition_6NVXEHJD_exports = {};
|
|
20
|
+
__export(artifact_definition_6NVXEHJD_exports, {
|
|
21
21
|
default: () => artifact_definition_default
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(artifact_definition_6NVXEHJD_exports);
|
|
24
|
+
var import_chunk_YJQZHKKA = require("./chunk-YJQZHKKA.cjs");
|
|
25
25
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
26
|
var import_artifact = require("@dxos/artifact");
|
|
27
27
|
var import_assistant = require("@dxos/assistant");
|
|
@@ -34,8 +34,8 @@ var import_schema = require("@dxos/schema");
|
|
|
34
34
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-script/src/capabilities/artifact-definition.ts";
|
|
35
35
|
var artifact_definition_default = () => {
|
|
36
36
|
const definition = (0, import_artifact.defineArtifact)({
|
|
37
|
-
id: `artifact:${
|
|
38
|
-
name:
|
|
37
|
+
id: `artifact:${import_chunk_YJQZHKKA.meta.id}`,
|
|
38
|
+
name: import_chunk_YJQZHKKA.meta.name,
|
|
39
39
|
// TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
|
|
40
40
|
// we should offload the work of synthesizing the code to a separate model.
|
|
41
41
|
// The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
|
|
@@ -150,7 +150,7 @@ var artifact_definition_default = () => {
|
|
|
150
150
|
`,
|
|
151
151
|
schema: import_types.ScriptType,
|
|
152
152
|
tools: [
|
|
153
|
-
(0, import_artifact.defineTool)(
|
|
153
|
+
(0, import_artifact.defineTool)(import_chunk_YJQZHKKA.meta.id, {
|
|
154
154
|
name: "create",
|
|
155
155
|
description: "Create a new script. Returns the artifact definition for the script",
|
|
156
156
|
caption: "Creating script...",
|
|
@@ -181,9 +181,9 @@ var artifact_definition_default = () => {
|
|
|
181
181
|
"'No intent dispatcher'"
|
|
182
182
|
]
|
|
183
183
|
});
|
|
184
|
-
const script = (0, import_echo.
|
|
184
|
+
const script = (0, import_echo.create)(import_types.ScriptType, {
|
|
185
185
|
name,
|
|
186
|
-
source: (0, import_echo.makeRef)((0, import_echo.
|
|
186
|
+
source: (0, import_echo.makeRef)((0, import_echo.create)(import_schema.TextType, {
|
|
187
187
|
content: code
|
|
188
188
|
}))
|
|
189
189
|
});
|
|
@@ -200,7 +200,7 @@ var artifact_definition_default = () => {
|
|
|
200
200
|
return import_artifact.ToolResult.Success((0, import_assistant.createArtifactElement)(script.id));
|
|
201
201
|
}
|
|
202
202
|
}),
|
|
203
|
-
(0, import_artifact.defineTool)(
|
|
203
|
+
(0, import_artifact.defineTool)(import_chunk_YJQZHKKA.meta.id, {
|
|
204
204
|
name: "inspect",
|
|
205
205
|
description: "Inspect a script. Returns the artifact definition for the script",
|
|
206
206
|
caption: "Inspecting script...",
|
|
@@ -227,7 +227,7 @@ var artifact_definition_default = () => {
|
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
}),
|
|
230
|
-
(0, import_artifact.defineTool)(
|
|
230
|
+
(0, import_artifact.defineTool)(import_chunk_YJQZHKKA.meta.id, {
|
|
231
231
|
name: "update",
|
|
232
232
|
description: "Update a script. Returns the artifact definition for the script",
|
|
233
233
|
caption: "Updating script...",
|
|
@@ -265,4 +265,4 @@ var artifact_definition_default = () => {
|
|
|
265
265
|
});
|
|
266
266
|
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.ArtifactDefinition, definition);
|
|
267
267
|
};
|
|
268
|
-
//# sourceMappingURL=artifact-definition-
|
|
268
|
+
//# sourceMappingURL=artifact-definition-6NVXEHJD.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/artifact-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';\nimport { defineArtifact, defineTool, ToolResult } from '@dxos/artifact';\nimport { createArtifactElement } from '@dxos/assistant';\nimport { ObjectId, S } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions/types';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { create, makeRef, type Space } from '@dxos/react-client/echo';\nimport { TextType } from '@dxos/schema';\n\nimport { meta } from '../meta';\n// TODO(burdon): Factor out.\ndeclare global {\n interface ToolContextExtensions {\n space?: Space;\n dispatch?: PromiseIntentDispatcher;\n }\n}\n\nexport default () => {\n const definition = defineArtifact({\n id: `artifact:${meta.id}`,\n name: meta.name,\n // TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,\n // we should offload the work of synthesizing the code to a separate model.\n // The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.\n instructions: `\n If the user explicitly requests you to write a script, you can create one.\n If the user requests you to change one of the existing script, you can update it.\n You must not create a script unless the user explicitly requests it.\n Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.\n Each script must follow as strict shape for the definition but the body can contain any valid executable code.\n Scripts are written in JavaScript or TypeScript.\n Each script must define an input schema and output schema.\n Each script must have its own detailed description.\n\n Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.\n\n Description:\n The description is a detailed description of the script.\n It is used to describe the script's purpose, input, and output.\n The description is used to generate the script's documentation.\n The description is also goes into the script metadata.\n The description is used by AI to understand the script and its purpose.\n The description must provide cases on when the script should be used.\n\n Schema: \n The schema is defined using a schema-DSL library called Effect Schema.\n The input schema describes the arguments that the script accepts.\n The output schema describes the result that the script produces.\n The schema is used to validate the script's input and output.\n The schema is also goes into the script metadata.\n The properties in the schema must have valid descriptions.\n The input and output schemas must both be a struct of fields.\n\n Restricts:\n The scripts can only import code from \"dxos:functions\" module. No other modules are allowed.\n Some web APIs are available - like fetch.\n\n Reasoning:\n Before writing a script, synthesize the following information:\n - Description\n - What APIs will be used.\n - Detailed input schema\n - Detailed output schema\n\n <apis>\n export function defineFunction(params: { \n description: string, \n inputSchema: S.Schema, \n outputSchema: S.Schema, \n handler: (params: { event: { data: TInput } }) => Promise<TOutput> \n }): FunctionDefinition\n /**\n * Effect Schema\n */\n export const S; \n\n // Examples: \n\n S.String\n S.Number\n S.Boolean\n S.Struct({\n from: S.String.annotations({ description: 'The source currency' }),\n to: S.String.annotations({ description: 'The target currency' }),\n })\n S.Array(S.String)\n S.Union(S.String, S.Number)\n S.optional(S.String)\n S.String.annotations({ description: 'The source currency' })\n </apis>\n\n <handler_function>\n Async function that takes the argument in the form of:\n\n type HandlerFunctionParam = {\n event: {\n data: T // The input schema\n },\n }\n\n The function must return the result that matches the output schema.\n </handler_function>\n \n <example>\n import { defineFunction, S } from 'dxos:functions';\n\n export default defineFunction({\n description: 'Returns the exchange rate between two currencies.',\n\n inputSchema: S.Struct({\n from: S.String.annotations({ description: 'The source currency' }),\n to: S.String.annotations({ description: 'The target currency' }),\n }),\n\n outputSchema: S.Struct({\n rate: S.String.annotations({ description: 'The exchange rate' }),\n }),\n\n handler: async ({\n event: {\n data: { from, to },\n },\n }: any) => {\n const res = await fetch(\\`https://free.ratesdb.com/v1/rates?from=\\${from}&to=\\${to}\\`);\n const {\n data: { rates },\n } = await res.json();\n\n return { rate: rates[to].toString() };\n },\n });\n </example>\n `,\n schema: ScriptType,\n tools: [\n defineTool(meta.id, {\n name: 'create',\n description: 'Create a new script. Returns the artifact definition for the script',\n caption: 'Creating script...',\n schema: S.Struct({\n name: S.String.annotations({ description: 'The name of the script' }),\n code: S.String.annotations({\n description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',\n }),\n }),\n execute: async ({ name, code }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n invariant(extensions?.dispatch, 'No intent dispatcher');\n const script = create(ScriptType, {\n name,\n source: makeRef(\n create(TextType, {\n content: code,\n }),\n ),\n });\n extensions.space.db.add(script);\n await extensions.space.db.flush();\n\n const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });\n const { data, error } = await extensions.dispatch(intent);\n if (!data || error) {\n return ToolResult.Error(error?.message ?? 'Failed to create chess game');\n }\n\n return ToolResult.Success(createArtifactElement(script.id));\n },\n }),\n defineTool(meta.id, {\n name: 'inspect',\n description: 'Inspect a script. Returns the artifact definition for the script',\n caption: 'Inspecting script...',\n schema: S.Struct({\n id: ObjectId,\n }),\n execute: async ({ id }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n\n const script = (await extensions.space.db.query({ id }).first()) as ScriptType;\n const { content } = await script.source.load();\n\n return ToolResult.Success({\n name: script.name,\n code: content,\n });\n },\n }),\n defineTool(meta.id, {\n name: 'update',\n description: 'Update a script. Returns the artifact definition for the script',\n caption: 'Updating script...',\n schema: S.Struct({\n id: ObjectId,\n code: S.String.annotations({\n description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',\n }),\n }),\n execute: async ({ id, code }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n\n const script = (await extensions.space.db.query({ id }).first()) as ScriptType;\n const source = await script.source.load();\n if (!source) {\n return ToolResult.Error('Script not found');\n }\n\n source.content = code;\n await extensions.space?.db.flush();\n\n return ToolResult.Success({\n name: script.name,\n });\n },\n }),\n ],\n });\n\n return contributes(Capabilities.ArtifactDefinition, definition);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AA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;UACf,CAAA;QACF;MACF,CAAA;;EAEJ,CAAA;AAEA,aAAO4C,kCAAYC,kCAAaC,oBAAoBlD,UAAAA;AACtD;",
|
|
6
|
+
"names": ["import_types", "definition", "defineArtifact", "id", "meta", "name", "instructions", "schema", "ScriptType", "tools", "defineTool", "description", "caption", "S", "Struct", "String", "annotations", "code", "execute", "extensions", "invariant", "space", "dispatch", "script", "create", "source", "makeRef", "TextType", "content", "db", "add", "flush", "intent", "createIntent", "SpaceAction", "AddObject", "target", "object", "data", "error", "ToolResult", "Error", "message", "Success", "createArtifactElement", "ObjectId", "query", "first", "load", "contributes", "Capabilities", "ArtifactDefinition"]
|
|
7
|
+
}
|
|
@@ -26,52 +26,52 @@ 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_65MIJR3Q_exports = {};
|
|
30
|
+
__export(chunk_65MIJR3Q_exports, {
|
|
31
31
|
DEPLOYMENT_DIALOG: () => DEPLOYMENT_DIALOG,
|
|
32
32
|
DeploymentDialog_default: () => DeploymentDialog_default
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
-
var
|
|
36
|
-
var
|
|
34
|
+
module.exports = __toCommonJS(chunk_65MIJR3Q_exports);
|
|
35
|
+
var import_chunk_VYBEBLDO = require("./chunk-VYBEBLDO.cjs");
|
|
36
|
+
var import_chunk_YJQZHKKA = require("./chunk-YJQZHKKA.cjs");
|
|
37
37
|
var import_react = __toESM(require("react"));
|
|
38
38
|
var import_app_framework = require("@dxos/app-framework");
|
|
39
39
|
var import_echo = require("@dxos/react-client/echo");
|
|
40
40
|
var import_react_ui = require("@dxos/react-ui");
|
|
41
|
-
var DEPLOYMENT_DIALOG = `${
|
|
41
|
+
var DEPLOYMENT_DIALOG = `${import_chunk_YJQZHKKA.SCRIPT_PLUGIN}/deployment/dialog`;
|
|
42
42
|
var DeploymentDialog = ({ accessToken, scriptTemplates }) => {
|
|
43
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
43
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_YJQZHKKA.SCRIPT_PLUGIN);
|
|
44
44
|
const space = (0, import_react.useMemo)(() => (0, import_echo.getSpace)(accessToken), [
|
|
45
45
|
accessToken
|
|
46
46
|
]);
|
|
47
|
-
const { handleCreateAndDeployScripts, status } = (0,
|
|
47
|
+
const { handleCreateAndDeployScripts, status } = (0, import_chunk_VYBEBLDO.useCreateAndDeployScriptTemplates)(space, scriptTemplates);
|
|
48
48
|
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
49
49
|
(0, import_react.useEffect)(() => {
|
|
50
50
|
if (status === "success") {
|
|
51
51
|
void dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.AddToast, {
|
|
52
52
|
part: "toast",
|
|
53
53
|
subject: {
|
|
54
|
-
id: `${
|
|
54
|
+
id: `${import_chunk_YJQZHKKA.SCRIPT_PLUGIN}/deployment-success`,
|
|
55
55
|
icon: "ph--check--regular",
|
|
56
56
|
duration: Infinity,
|
|
57
57
|
title: [
|
|
58
58
|
"script deployment toast label",
|
|
59
59
|
{
|
|
60
|
-
ns:
|
|
60
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN,
|
|
61
61
|
count: scriptTemplates.length
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
64
|
description: [
|
|
65
65
|
"script deployment toast description",
|
|
66
66
|
{
|
|
67
|
-
ns:
|
|
67
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN,
|
|
68
68
|
count: scriptTemplates.length
|
|
69
69
|
}
|
|
70
70
|
],
|
|
71
71
|
closeLabel: [
|
|
72
72
|
"script deployment toast close label",
|
|
73
73
|
{
|
|
74
|
-
ns:
|
|
74
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN,
|
|
75
75
|
count: scriptTemplates.length
|
|
76
76
|
}
|
|
77
77
|
]
|
|
@@ -94,27 +94,27 @@ var DeploymentDialog = ({ accessToken, scriptTemplates }) => {
|
|
|
94
94
|
void dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.AddToast, {
|
|
95
95
|
part: "toast",
|
|
96
96
|
subject: {
|
|
97
|
-
id: `${
|
|
97
|
+
id: `${import_chunk_YJQZHKKA.SCRIPT_PLUGIN}/deployment-error`,
|
|
98
98
|
icon: "ph--warning--regular",
|
|
99
99
|
duration: Infinity,
|
|
100
100
|
title: [
|
|
101
101
|
"script deployment error toast label",
|
|
102
102
|
{
|
|
103
|
-
ns:
|
|
103
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN,
|
|
104
104
|
count: scriptTemplates.length
|
|
105
105
|
}
|
|
106
106
|
],
|
|
107
107
|
description: [
|
|
108
108
|
"script deployment error toast description",
|
|
109
109
|
{
|
|
110
|
-
ns:
|
|
110
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN,
|
|
111
111
|
count: scriptTemplates.length
|
|
112
112
|
}
|
|
113
113
|
],
|
|
114
114
|
closeLabel: [
|
|
115
115
|
"script deployment error toast close label",
|
|
116
116
|
{
|
|
117
|
-
ns:
|
|
117
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN,
|
|
118
118
|
count: scriptTemplates.length
|
|
119
119
|
}
|
|
120
120
|
]
|
|
@@ -170,4 +170,4 @@ var DeploymentDialog_default = DeploymentDialog;
|
|
|
170
170
|
DEPLOYMENT_DIALOG,
|
|
171
171
|
DeploymentDialog_default
|
|
172
172
|
});
|
|
173
|
-
//# sourceMappingURL=chunk-
|
|
173
|
+
//# sourceMappingURL=chunk-65MIJR3Q.cjs.map
|
|
@@ -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_F4DP7WON_exports = {};
|
|
30
|
+
__export(chunk_F4DP7WON_exports, {
|
|
31
31
|
createDeploy: () => createDeploy,
|
|
32
32
|
createFormat: () => createFormat,
|
|
33
33
|
createTemplateSelect: () => createTemplateSelect,
|
|
@@ -35,10 +35,10 @@ __export(chunk_UUGLBCMY_exports, {
|
|
|
35
35
|
useToolbarAction: () => useToolbarAction,
|
|
36
36
|
useToolbarState: () => useToolbarState
|
|
37
37
|
});
|
|
38
|
-
module.exports = __toCommonJS(
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
38
|
+
module.exports = __toCommonJS(chunk_F4DP7WON_exports);
|
|
39
|
+
var import_chunk_X7MHLHHS = require("./chunk-X7MHLHHS.cjs");
|
|
40
|
+
var import_chunk_VYBEBLDO = require("./chunk-VYBEBLDO.cjs");
|
|
41
|
+
var import_chunk_YJQZHKKA = require("./chunk-YJQZHKKA.cjs");
|
|
42
42
|
var import_react = require("react");
|
|
43
43
|
var import_functions = require("@dxos/functions");
|
|
44
44
|
var import_log = require("@dxos/log");
|
|
@@ -67,7 +67,7 @@ var createDeploy = (state) => {
|
|
|
67
67
|
label: state.error ?? [
|
|
68
68
|
"no error label",
|
|
69
69
|
{
|
|
70
|
-
ns:
|
|
70
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN
|
|
71
71
|
}
|
|
72
72
|
],
|
|
73
73
|
icon: "ph--warning-circle--regular",
|
|
@@ -79,7 +79,7 @@ var createDeploy = (state) => {
|
|
|
79
79
|
label: [
|
|
80
80
|
state.deploying ? "pending label" : "deploy label",
|
|
81
81
|
{
|
|
82
|
-
ns:
|
|
82
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN
|
|
83
83
|
}
|
|
84
84
|
],
|
|
85
85
|
icon: state.deploying ? "ph--spinner-gap--regular" : "ph--cloud-arrow-up--regular",
|
|
@@ -91,7 +91,7 @@ var createDeploy = (state) => {
|
|
|
91
91
|
label: [
|
|
92
92
|
"copy link label",
|
|
93
93
|
{
|
|
94
|
-
ns:
|
|
94
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN
|
|
95
95
|
}
|
|
96
96
|
],
|
|
97
97
|
icon: "ph--link--regular",
|
|
@@ -127,7 +127,7 @@ var useDeployState = ({ state, script }) => {
|
|
|
127
127
|
if (!existingFunctionUrl) {
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
state.functionUrl = (0,
|
|
130
|
+
state.functionUrl = (0, import_chunk_VYBEBLDO.getFunctionUrl)({
|
|
131
131
|
script,
|
|
132
132
|
fn,
|
|
133
133
|
edgeUrl: client.config.values.runtime?.services?.edge?.url ?? ""
|
|
@@ -140,7 +140,7 @@ var useDeployState = ({ state, script }) => {
|
|
|
140
140
|
client.config.values.runtime?.services?.edge?.url
|
|
141
141
|
]);
|
|
142
142
|
(0, import_react.useEffect)(() => {
|
|
143
|
-
state.deployed = (0,
|
|
143
|
+
state.deployed = (0, import_chunk_VYBEBLDO.isScriptDeployed)({
|
|
144
144
|
script,
|
|
145
145
|
fn
|
|
146
146
|
});
|
|
@@ -171,14 +171,14 @@ var useDeployHandler = ({ state, script }) => {
|
|
|
171
171
|
const { space, fn, client, existingFunctionUrl } = useDeployDeps({
|
|
172
172
|
script
|
|
173
173
|
});
|
|
174
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
174
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_YJQZHKKA.SCRIPT_PLUGIN);
|
|
175
175
|
return (0, import_react.useCallback)(async () => {
|
|
176
176
|
if (!script.source || !space) {
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
state.error = void 0;
|
|
180
180
|
state.deploying = true;
|
|
181
|
-
const result = await (0,
|
|
181
|
+
const result = await (0, import_chunk_VYBEBLDO.deployScript)({
|
|
182
182
|
script,
|
|
183
183
|
client,
|
|
184
184
|
space,
|
|
@@ -213,7 +213,7 @@ var useCopyHandler = ({ state }) => (0, import_react.useCallback)(async () => {
|
|
|
213
213
|
state.functionUrl
|
|
214
214
|
]);
|
|
215
215
|
var useToolbarState = (initialState = {}) => {
|
|
216
|
-
return (0, import_react2.useMemo)(() => (0, import_live_object.
|
|
216
|
+
return (0, import_react2.useMemo)(() => (0, import_live_object.create)(initialState), []);
|
|
217
217
|
};
|
|
218
218
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-script/src/hooks/format.ts";
|
|
219
219
|
var createFormat = () => {
|
|
@@ -221,7 +221,7 @@ var createFormat = () => {
|
|
|
221
221
|
label: [
|
|
222
222
|
"format label",
|
|
223
223
|
{
|
|
224
|
-
ns:
|
|
224
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN
|
|
225
225
|
}
|
|
226
226
|
],
|
|
227
227
|
icon: "ph--magic-wand--regular"
|
|
@@ -268,14 +268,14 @@ var createTemplateSelectGroup = () => {
|
|
|
268
268
|
label: [
|
|
269
269
|
"template select group label",
|
|
270
270
|
{
|
|
271
|
-
ns:
|
|
271
|
+
ns: import_chunk_YJQZHKKA.SCRIPT_PLUGIN
|
|
272
272
|
}
|
|
273
273
|
],
|
|
274
274
|
variant: "dropdownMenu"
|
|
275
275
|
});
|
|
276
276
|
};
|
|
277
277
|
var createTemplateSelectActions = () => {
|
|
278
|
-
return
|
|
278
|
+
return import_chunk_X7MHLHHS.templates.map((template) => {
|
|
279
279
|
return (0, import_react_ui_menu3.createMenuAction)(`template--${template.id}`, {
|
|
280
280
|
label: template.name,
|
|
281
281
|
value: template.id,
|
|
@@ -305,7 +305,7 @@ var createTemplateSelect = () => {
|
|
|
305
305
|
};
|
|
306
306
|
var useTemplateSelectHandler = ({ script }) => {
|
|
307
307
|
return (0, import_react4.useCallback)((templateId) => {
|
|
308
|
-
const template =
|
|
308
|
+
const template = import_chunk_X7MHLHHS.templates.find((template2) => template2.id === templateId);
|
|
309
309
|
if (template) {
|
|
310
310
|
script.name = template.name;
|
|
311
311
|
script.source.target.content = template.source;
|
|
@@ -369,4 +369,4 @@ var useToolbarAction = (props) => {
|
|
|
369
369
|
useToolbarAction,
|
|
370
370
|
useToolbarState
|
|
371
371
|
});
|
|
372
|
-
//# sourceMappingURL=chunk-
|
|
372
|
+
//# sourceMappingURL=chunk-F4DP7WON.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/deploy.ts", "../../../src/hooks/useToolbarState.ts", "../../../src/hooks/format.ts", "../../../src/hooks/template.ts", "../../../src/hooks/useToolbarAction.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useEffect, useMemo } from 'react';\n\nimport { FunctionType, type ScriptType, getUserFunctionUrlInMetadata } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { createMenuAction } from '@dxos/react-ui-menu';\nimport { errorMessageColors } from '@dxos/react-ui-theme';\n\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { deployScript, getFunctionUrl, isScriptDeployed } from '../util';\n\nexport type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };\n\nexport type DeployState = {\n deploying: boolean;\n deployed: boolean;\n functionUrl: string;\n error: string;\n};\n\nexport const createDeploy = (state: Partial<DeployState>) => {\n const errorItem = createMenuAction('error', {\n label: state.error ?? ['no error label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--warning-circle--regular',\n hidden: !state.error,\n classNames: state.error && errorMessageColors,\n });\n\n const deployAction = createMenuAction<DeployActionProperties>('deploy', {\n type: 'deploy',\n label: [state.deploying ? 'pending label' : 'deploy label', { ns: SCRIPT_PLUGIN }],\n icon: state.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',\n disabled: state.deploying,\n classNames: state.deploying ? '[&_svg]:animate-spin' : '',\n });\n\n const copyAction = createMenuAction<DeployActionProperties>('copy', {\n type: 'copy',\n label: ['copy link label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--link--regular',\n disabled: !state.functionUrl,\n });\n\n return {\n nodes: [errorItem, deployAction, copyAction],\n edges: [\n { source: 'root', target: 'error' },\n { source: 'root', target: 'deploy' },\n { source: 'root', target: 'copy' },\n ],\n };\n};\n\nexport const useDeployState = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, client, fn, existingFunctionUrl } = useDeployDeps({ script });\n useEffect(() => {\n if (!existingFunctionUrl) {\n return;\n }\n\n state.functionUrl = getFunctionUrl({\n script,\n fn,\n edgeUrl: client.config.values.runtime?.services?.edge?.url ?? '',\n });\n }, [existingFunctionUrl, space, fn, script, client.config.values.runtime?.services?.edge?.url]);\n\n useEffect(() => {\n state.deployed = isScriptDeployed({ script, fn });\n }, [script.changed, existingFunctionUrl, fn, script]);\n};\n\nexport const useDeployDeps = ({ script }: { script: ScriptType }) => {\n const space = getSpace(script);\n const [fn] = useQuery(space, Filter.schema(FunctionType, { source: script }));\n const client = useClient();\n const existingFunctionUrl = useMemo(() => fn && getUserFunctionUrlInMetadata(getMeta(fn)), [fn]);\n return { space, fn, client, existingFunctionUrl };\n};\n\n/**\n * Manage EDGE function deployment.\n */\nexport const useDeployHandler = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, fn, client, existingFunctionUrl } = useDeployDeps({ script });\n const { t } = useTranslation(SCRIPT_PLUGIN);\n\n return useCallback(async () => {\n if (!script.source || !space) {\n return;\n }\n\n state.error = undefined;\n state.deploying = true;\n\n const result = await deployScript({ script, client, space, fn, existingFunctionUrl });\n\n if (!result.success) {\n log.catch(result.error);\n state.error = t('upload failed label');\n }\n\n state.deploying = false;\n }, [fn, client, t, existingFunctionUrl, script, space]);\n};\n\nexport const useCopyHandler = ({ state }: { state: Partial<DeployState> }) =>\n useCallback(async () => {\n if (!state.functionUrl) {\n return;\n }\n await navigator.clipboard.writeText(state.functionUrl);\n }, [state.functionUrl]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAgD;AAEhD,uBAA4E;AAC5E,iBAAoB;AACpB,0BAA0B;AAC1B,kBAAoD;AACpD,sBAA+B;AAC/B,2BAAiC;AACjC,4BAAmC;ACRnC,IAAAA,gBAAwB;AAExB,
|
|
6
|
-
"names": ["import_react", "import_log", "import_react_ui_menu", "import_live_object", "createDeploy", "state", "errorItem", "createMenuAction", "label", "error", "ns", "SCRIPT_PLUGIN", "icon", "hidden", "classNames", "errorMessageColors", "deployAction", "type", "deploying", "disabled", "copyAction", "functionUrl", "nodes", "edges", "source", "target", "useDeployState", "script", "space", "client", "fn", "existingFunctionUrl", "useDeployDeps", "useEffect", "getFunctionUrl", "edgeUrl", "config", "values", "runtime", "services", "edge", "url", "deployed", "isScriptDeployed", "changed", "getSpace", "useQuery", "Filter", "schema", "FunctionType", "useClient", "useMemo", "getUserFunctionUrlInMetadata", "getMeta", "useDeployHandler", "t", "useTranslation", "useCallback", "undefined", "result", "deployScript", "success", "log", "catch", "useCopyHandler", "navigator", "clipboard", "writeText", "useToolbarState", "initialState", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useEffect, useMemo } from 'react';\n\nimport { FunctionType, type ScriptType, getUserFunctionUrlInMetadata } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { createMenuAction } from '@dxos/react-ui-menu';\nimport { errorMessageColors } from '@dxos/react-ui-theme';\n\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { deployScript, getFunctionUrl, isScriptDeployed } from '../util';\n\nexport type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };\n\nexport type DeployState = {\n deploying: boolean;\n deployed: boolean;\n functionUrl: string;\n error: string;\n};\n\nexport const createDeploy = (state: Partial<DeployState>) => {\n const errorItem = createMenuAction('error', {\n label: state.error ?? ['no error label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--warning-circle--regular',\n hidden: !state.error,\n classNames: state.error && errorMessageColors,\n });\n\n const deployAction = createMenuAction<DeployActionProperties>('deploy', {\n type: 'deploy',\n label: [state.deploying ? 'pending label' : 'deploy label', { ns: SCRIPT_PLUGIN }],\n icon: state.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',\n disabled: state.deploying,\n classNames: state.deploying ? '[&_svg]:animate-spin' : '',\n });\n\n const copyAction = createMenuAction<DeployActionProperties>('copy', {\n type: 'copy',\n label: ['copy link label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--link--regular',\n disabled: !state.functionUrl,\n });\n\n return {\n nodes: [errorItem, deployAction, copyAction],\n edges: [\n { source: 'root', target: 'error' },\n { source: 'root', target: 'deploy' },\n { source: 'root', target: 'copy' },\n ],\n };\n};\n\nexport const useDeployState = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, client, fn, existingFunctionUrl } = useDeployDeps({ script });\n useEffect(() => {\n if (!existingFunctionUrl) {\n return;\n }\n\n state.functionUrl = getFunctionUrl({\n script,\n fn,\n edgeUrl: client.config.values.runtime?.services?.edge?.url ?? '',\n });\n }, [existingFunctionUrl, space, fn, script, client.config.values.runtime?.services?.edge?.url]);\n\n useEffect(() => {\n state.deployed = isScriptDeployed({ script, fn });\n }, [script.changed, existingFunctionUrl, fn, script]);\n};\n\nexport const useDeployDeps = ({ script }: { script: ScriptType }) => {\n const space = getSpace(script);\n const [fn] = useQuery(space, Filter.schema(FunctionType, { source: script }));\n const client = useClient();\n const existingFunctionUrl = useMemo(() => fn && getUserFunctionUrlInMetadata(getMeta(fn)), [fn]);\n return { space, fn, client, existingFunctionUrl };\n};\n\n/**\n * Manage EDGE function deployment.\n */\nexport const useDeployHandler = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, fn, client, existingFunctionUrl } = useDeployDeps({ script });\n const { t } = useTranslation(SCRIPT_PLUGIN);\n\n return useCallback(async () => {\n if (!script.source || !space) {\n return;\n }\n\n state.error = undefined;\n state.deploying = true;\n\n const result = await deployScript({ script, client, space, fn, existingFunctionUrl });\n\n if (!result.success) {\n log.catch(result.error);\n state.error = t('upload failed label');\n }\n\n state.deploying = false;\n }, [fn, client, t, existingFunctionUrl, script, space]);\n};\n\nexport const useCopyHandler = ({ state }: { state: Partial<DeployState> }) =>\n useCallback(async () => {\n if (!state.functionUrl) {\n return;\n }\n await navigator.clipboard.writeText(state.functionUrl);\n }, [state.functionUrl]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { create } from '@dxos/live-object';\n\nimport { type DeployState } from './deploy';\n\nexport type ScriptToolbarState = Partial<DeployState>;\n\n// TODO(burdon): Replace with context provider?\nexport const useToolbarState = (initialState: ScriptToolbarState = {}) => {\n return useMemo(() => create<ScriptToolbarState>(initialState), []);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { format } from 'prettier';\nimport prettierPluginEstree from 'prettier/plugins/estree';\nimport prettierPluginTypescript from 'prettier/plugins/typescript';\nimport { useCallback } from 'react';\n\nimport { type ScriptType } from '@dxos/functions/types';\nimport { log } from '@dxos/log';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type FormatActionProperties = { type: 'format' };\n\nexport const createFormat = () => {\n const formatAction = createMenuAction('format', {\n label: ['format label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n });\n\n return {\n nodes: [formatAction],\n edges: [{ source: 'root', target: 'format' }],\n };\n};\n\nexport const useFormatHandler = ({ script }: { script: ScriptType }) =>\n useCallback(async () => {\n if (!script.source) {\n return;\n }\n\n try {\n script.source.target!.content = await format(script.source.target!.content, {\n parser: 'typescript',\n plugins: [prettierPluginEstree, prettierPluginTypescript],\n semi: true,\n singleQuote: true,\n });\n } catch (err: any) {\n // TODO(wittjosiah): Show error in UI.\n log.catch(err);\n }\n }, [script.source]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { FUNCTIONS_PRESET_META_KEY, type ScriptType } from '@dxos/functions/types';\nimport { getMeta } from '@dxos/live-object';\nimport { createMenuItemGroup, createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { templates } from '../templates';\n\nexport type TemplateActionProperties = { type: 'template'; value: string };\n\nconst createTemplateSelectGroup = () => {\n return createMenuItemGroup('template-select', {\n label: ['template select group label', { ns: SCRIPT_PLUGIN }],\n variant: 'dropdownMenu',\n });\n};\n\nconst createTemplateSelectActions = () => {\n return templates.map((template) => {\n return createMenuAction<TemplateActionProperties>(`template--${template.id}`, {\n label: template.name,\n value: template.id,\n type: 'template',\n });\n });\n};\n\nexport const createTemplateSelect = () => {\n const templateSelectGroup = createTemplateSelectGroup();\n const templateSelectActions = createTemplateSelectActions();\n return {\n nodes: [templateSelectGroup, ...templateSelectActions],\n edges: [\n { source: 'root', target: 'template-select' },\n ...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id })),\n ],\n };\n};\n\nexport const useTemplateSelectHandler = ({ script }: { script: ScriptType }) => {\n return useCallback(\n (templateId: string) => {\n const template = templates.find((template) => template.id === templateId);\n if (template) {\n script.name = template.name;\n script.source!.target!.content = template.source;\n const metaKeys = getMeta(script).keys;\n const oldPresetIndex = metaKeys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);\n if (oldPresetIndex >= 0) {\n metaKeys.splice(oldPresetIndex, 1);\n }\n if (template.presetId) {\n metaKeys.push({ source: FUNCTIONS_PRESET_META_KEY, id: template.presetId });\n }\n }\n },\n [script],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type ScriptType } from '@dxos/functions/types';\nimport { log } from '@dxos/log';\nimport { type MenuAction, type MenuActionHandler } from '@dxos/react-ui-menu';\n\nimport { type DeployActionProperties, useDeployHandler, useCopyHandler } from './deploy';\nimport { type FormatActionProperties, useFormatHandler } from './format';\nimport { type TemplateActionProperties, useTemplateSelectHandler } from './template';\nimport { type ScriptToolbarState } from './useToolbarState';\n\nexport type ScriptToolbarActionProperties = TemplateActionProperties | FormatActionProperties | DeployActionProperties;\n\nexport type ScriptToolbarAction = MenuAction<ScriptToolbarActionProperties>;\n\nexport const useToolbarAction = (props: {\n state: ScriptToolbarState;\n script: ScriptType;\n}): MenuActionHandler<ScriptToolbarAction> => {\n const handleTemplateSelect = useTemplateSelectHandler(props);\n const handleFormat = useFormatHandler(props);\n const handleDeploy = useDeployHandler(props);\n const handleCopy = useCopyHandler(props);\n\n return useCallback<MenuActionHandler<ScriptToolbarAction>>(\n (action: ScriptToolbarAction) => {\n switch (action.properties.type) {\n case 'template':\n handleTemplateSelect(action.properties.value);\n break;\n case 'format':\n void handleFormat();\n break;\n case 'deploy':\n void handleDeploy();\n break;\n case 'copy':\n void handleCopy();\n break;\n default:\n log.error('Unknown action type', action);\n }\n },\n [handleTemplateSelect, handleFormat, handleDeploy, handleCopy],\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAgD;AAEhD,uBAA4E;AAC5E,iBAAoB;AACpB,0BAA0B;AAC1B,kBAAoD;AACpD,sBAA+B;AAC/B,2BAAiC;AACjC,4BAAmC;ACRnC,IAAAA,gBAAwB;AAExB,yBAAuB;ACFvB,sBAAuB;AACvB,oBAAiC;AACjC,wBAAqC;AACrC,IAAAA,gBAA4B;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C,aAAOrD,cAAAA,aACL,CAACuC,WAAAA;AACC,YAAQA,OAAOmB,WAAWlG,MAAI;MAC5B,KAAK;AACH8F,6BAAqBf,OAAOmB,WAAWvB,KAAK;AAC5C;MACF,KAAK;AACH,aAAKoB,aAAAA;AACL;MACF,KAAK;AACH,aAAKC,aAAAA;AACL;MACF,KAAK;AACH,aAAKC,WAAAA;AACL;MACF;AACEpD,oBAAAA,IAAIrD,MAAM,uBAAuBuF,QAAAA;;;;;;IACrC;EACF,GACA;IAACe;IAAsBC;IAAcC;IAAcC;GAAW;AAElE;",
|
|
6
|
+
"names": ["import_react", "import_log", "import_react_ui_menu", "import_live_object", "createDeploy", "state", "errorItem", "createMenuAction", "label", "error", "ns", "SCRIPT_PLUGIN", "icon", "hidden", "classNames", "errorMessageColors", "deployAction", "type", "deploying", "disabled", "copyAction", "functionUrl", "nodes", "edges", "source", "target", "useDeployState", "script", "space", "client", "fn", "existingFunctionUrl", "useDeployDeps", "useEffect", "getFunctionUrl", "edgeUrl", "config", "values", "runtime", "services", "edge", "url", "deployed", "isScriptDeployed", "changed", "getSpace", "useQuery", "Filter", "schema", "FunctionType", "useClient", "useMemo", "getUserFunctionUrlInMetadata", "getMeta", "useDeployHandler", "t", "useTranslation", "useCallback", "undefined", "result", "deployScript", "success", "log", "catch", "useCopyHandler", "navigator", "clipboard", "writeText", "useToolbarState", "initialState", "create", "createFormat", "formatAction", "useFormatHandler", "content", "format", "parser", "plugins", "prettierPluginEstree", "prettierPluginTypescript", "semi", "singleQuote", "err", "createTemplateSelectGroup", "createMenuItemGroup", "variant", "createTemplateSelectActions", "templates", "map", "template", "id", "name", "value", "createTemplateSelect", "templateSelectGroup", "templateSelectActions", "action", "useTemplateSelectHandler", "templateId", "find", "metaKeys", "keys", "oldPresetIndex", "findIndex", "key", "FUNCTIONS_PRESET_META_KEY", "splice", "presetId", "push", "useToolbarAction", "props", "handleTemplateSelect", "handleFormat", "handleDeploy", "handleCopy", "properties"]
|
|
7
7
|
}
|
|
@@ -16,19 +16,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_JICWAOWZ_exports = {};
|
|
20
|
+
__export(chunk_JICWAOWZ_exports, {
|
|
21
21
|
ScriptCapabilities: () => ScriptCapabilities
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_JICWAOWZ_exports);
|
|
24
|
+
var import_chunk_YJQZHKKA = require("./chunk-YJQZHKKA.cjs");
|
|
25
25
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
26
|
var ScriptCapabilities;
|
|
27
27
|
(function(ScriptCapabilities2) {
|
|
28
|
-
ScriptCapabilities2.Compiler = (0, import_app_framework.defineCapability)(`${
|
|
28
|
+
ScriptCapabilities2.Compiler = (0, import_app_framework.defineCapability)(`${import_chunk_YJQZHKKA.meta.id}/capability/compiler`);
|
|
29
29
|
})(ScriptCapabilities || (ScriptCapabilities = {}));
|
|
30
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
31
|
0 && (module.exports = {
|
|
32
32
|
ScriptCapabilities
|
|
33
33
|
});
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-JICWAOWZ.cjs.map
|
|
@@ -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_SLDJM45C_exports = {};
|
|
30
|
+
__export(chunk_SLDJM45C_exports, {
|
|
31
31
|
DeploymentDialog: () => DeploymentDialog,
|
|
32
32
|
ScriptContainer: () => ScriptContainer,
|
|
33
33
|
ScriptObjectSettings: () => ScriptObjectSettings,
|
|
@@ -35,8 +35,8 @@ __export(chunk_ZZ4HK5KM_exports, {
|
|
|
35
35
|
ScriptProperties: () => ScriptProperties,
|
|
36
36
|
TestPanel: () => TestPanel
|
|
37
37
|
});
|
|
38
|
-
module.exports = __toCommonJS(
|
|
39
|
-
var
|
|
38
|
+
module.exports = __toCommonJS(chunk_SLDJM45C_exports);
|
|
39
|
+
var import_chunk_YJQZHKKA = require("./chunk-YJQZHKKA.cjs");
|
|
40
40
|
var import_core = require("@octokit/core");
|
|
41
41
|
var import_react = __toESM(require("react"));
|
|
42
42
|
var import_app_framework = require("@dxos/app-framework");
|
|
@@ -66,7 +66,7 @@ var ScriptObjectSettings = ({ object }) => {
|
|
|
66
66
|
}));
|
|
67
67
|
};
|
|
68
68
|
var ScriptProperties = ({ object }) => {
|
|
69
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
69
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_YJQZHKKA.SCRIPT_PLUGIN);
|
|
70
70
|
return /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Root, null, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.Label, null, t("description label")), /* @__PURE__ */ import_react.default.createElement(import_react_ui.Input.TextInput, {
|
|
71
71
|
placeholder: t("description placeholder"),
|
|
72
72
|
value: object.description ?? "",
|
|
@@ -76,7 +76,7 @@ var ScriptProperties = ({ object }) => {
|
|
|
76
76
|
}));
|
|
77
77
|
};
|
|
78
78
|
var Binding = ({ object }) => {
|
|
79
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
79
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_YJQZHKKA.SCRIPT_PLUGIN);
|
|
80
80
|
const client = (0, import_react_client.useClient)();
|
|
81
81
|
const space = (0, import_echo.getSpace)(object);
|
|
82
82
|
const [fn] = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_types.FunctionType, {
|
|
@@ -129,7 +129,7 @@ var Binding = ({ object }) => {
|
|
|
129
129
|
}))));
|
|
130
130
|
};
|
|
131
131
|
var Publishing = ({ object }) => {
|
|
132
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
132
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_YJQZHKKA.SCRIPT_PLUGIN);
|
|
133
133
|
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
134
134
|
const space = (0, import_echo.getSpace)(object);
|
|
135
135
|
const [githubToken] = (0, import_echo.useQuery)(space, import_echo.Filter.schema(import_schema.AccessTokenType, {
|
|
@@ -231,7 +231,7 @@ var Publishing = ({ object }) => {
|
|
|
231
231
|
};
|
|
232
232
|
var kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
233
233
|
var ScriptPluginSettings = ({ settings }) => {
|
|
234
|
-
const { t } = (0, import_react_ui2.useTranslation)(
|
|
234
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_YJQZHKKA.meta.id);
|
|
235
235
|
const client = (0, import_react_client2.useClient)();
|
|
236
236
|
const handleAuthenticate = async () => {
|
|
237
237
|
const { identityKey } = client.halo.identity.get();
|
|
@@ -274,7 +274,7 @@ var ScriptPluginSettings = ({ settings }) => {
|
|
|
274
274
|
};
|
|
275
275
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
276
276
|
var TestPanel = ({ classNames, functionUrl }) => {
|
|
277
|
-
const { t } = (0, import_react_ui3.useTranslation)(
|
|
277
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_YJQZHKKA.SCRIPT_PLUGIN);
|
|
278
278
|
const inputRef = (0, import_react3.useRef)(null);
|
|
279
279
|
const [input, setInput] = (0, import_react3.useState)("");
|
|
280
280
|
const [result, setResult] = (0, import_react3.useState)("");
|
|
@@ -493,8 +493,8 @@ var RobotAvatar = () => /* @__PURE__ */ import_react3.default.createElement(impo
|
|
|
493
493
|
variant: "circle",
|
|
494
494
|
icon: "ph--robot--regular"
|
|
495
495
|
}));
|
|
496
|
-
var ScriptContainer = (0, import_react4.lazy)(() => import("./ScriptContainer-
|
|
497
|
-
var DeploymentDialog = (0, import_react4.lazy)(() => import("./DeploymentDialog-
|
|
496
|
+
var ScriptContainer = (0, import_react4.lazy)(() => import("./ScriptContainer-5KY6ZOQD.cjs"));
|
|
497
|
+
var DeploymentDialog = (0, import_react4.lazy)(() => import("./DeploymentDialog-O4MU4OMF.cjs"));
|
|
498
498
|
// Annotate the CommonJS export names for ESM import in node:
|
|
499
499
|
0 && (module.exports = {
|
|
500
500
|
DeploymentDialog,
|
|
@@ -504,4 +504,4 @@ var DeploymentDialog = (0, import_react4.lazy)(() => import("./DeploymentDialog-
|
|
|
504
504
|
ScriptProperties,
|
|
505
505
|
TestPanel
|
|
506
506
|
});
|
|
507
|
-
//# sourceMappingURL=chunk-
|
|
507
|
+
//# sourceMappingURL=chunk-SLDJM45C.cjs.map
|