@dxos/plugin-script 0.7.5-labs.071a3e2 → 0.7.5-labs.8a82073

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.
Files changed (48) hide show
  1. package/dist/lib/browser/{ScriptContainer-LGW52UAJ.mjs → ScriptContainer-QI4NQT7V.mjs} +29 -4
  2. package/dist/lib/browser/ScriptContainer-QI4NQT7V.mjs.map +7 -0
  3. package/dist/lib/browser/artifact-3UZZBCZ2.mjs +243 -0
  4. package/dist/lib/browser/artifact-3UZZBCZ2.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-2UXYECEH.mjs → chunk-F22QPQ6G.mjs} +4 -4
  6. package/dist/lib/browser/{chunk-2UXYECEH.mjs.map → chunk-F22QPQ6G.mjs.map} +2 -2
  7. package/dist/lib/browser/index.mjs +8 -2
  8. package/dist/lib/browser/index.mjs.map +3 -3
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/{react-surface-XACNR5NR.mjs → react-surface-YR4YO746.mjs} +2 -2
  11. package/dist/lib/node/{ScriptContainer-UI2MDBYG.cjs → ScriptContainer-FSKWJR6Z.cjs} +32 -7
  12. package/dist/lib/node/ScriptContainer-FSKWJR6Z.cjs.map +7 -0
  13. package/dist/lib/node/artifact-A2QXHFGS.cjs +262 -0
  14. package/dist/lib/node/artifact-A2QXHFGS.cjs.map +7 -0
  15. package/dist/lib/node/{chunk-73345ZL6.cjs → chunk-JSANQCTA.cjs} +6 -6
  16. package/dist/lib/node/{chunk-73345ZL6.cjs.map → chunk-JSANQCTA.cjs.map} +2 -2
  17. package/dist/lib/node/index.cjs +12 -6
  18. package/dist/lib/node/index.cjs.map +3 -3
  19. package/dist/lib/node/meta.json +1 -1
  20. package/dist/lib/node/{react-surface-Y3RD5FW7.cjs → react-surface-MFTICFI5.cjs} +9 -9
  21. package/dist/lib/node-esm/{ScriptContainer-F7SNP53Z.mjs → ScriptContainer-MNETNTNQ.mjs} +29 -4
  22. package/dist/lib/node-esm/ScriptContainer-MNETNTNQ.mjs.map +7 -0
  23. package/dist/lib/node-esm/artifact-RFZQ2AJJ.mjs +245 -0
  24. package/dist/lib/node-esm/artifact-RFZQ2AJJ.mjs.map +7 -0
  25. package/dist/lib/node-esm/{chunk-PRGBYF4B.mjs → chunk-FGO5DVO2.mjs} +4 -4
  26. package/dist/lib/node-esm/{chunk-PRGBYF4B.mjs.map → chunk-FGO5DVO2.mjs.map} +2 -2
  27. package/dist/lib/node-esm/index.mjs +8 -2
  28. package/dist/lib/node-esm/index.mjs.map +3 -3
  29. package/dist/lib/node-esm/meta.json +1 -1
  30. package/dist/lib/node-esm/{react-surface-PKUVZH4S.mjs → react-surface-NAK6LMCY.mjs} +2 -2
  31. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  32. package/dist/types/src/capabilities/artifact.d.ts +11 -0
  33. package/dist/types/src/capabilities/artifact.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/index.d.ts +1 -0
  35. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  36. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  37. package/package.json +44 -42
  38. package/src/ScriptPlugin.tsx +6 -1
  39. package/src/capabilities/artifact.ts +219 -0
  40. package/src/capabilities/index.ts +1 -0
  41. package/src/components/ScriptSettingsPanel.tsx +2 -2
  42. package/src/hooks/deploy.ts +12 -1
  43. package/dist/lib/browser/ScriptContainer-LGW52UAJ.mjs.map +0 -7
  44. package/dist/lib/node/ScriptContainer-UI2MDBYG.cjs.map +0 -7
  45. package/dist/lib/node-esm/ScriptContainer-F7SNP53Z.mjs.map +0 -7
  46. /package/dist/lib/browser/{react-surface-XACNR5NR.mjs.map → react-surface-YR4YO746.mjs.map} +0 -0
  47. /package/dist/lib/node/{react-surface-Y3RD5FW7.cjs.map → react-surface-MFTICFI5.cjs.map} +0 -0
  48. /package/dist/lib/node-esm/{react-surface-PKUVZH4S.mjs.map → react-surface-NAK6LMCY.mjs.map} +0 -0
@@ -0,0 +1,245 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/plugins/experimental/plugin-script/src/capabilities/artifact.ts
4
+ import { Capabilities, contributes, createIntent } from "@dxos/app-framework";
5
+ import { defineArtifact, defineTool, ToolResult } from "@dxos/artifact";
6
+ import { createArtifactElement } from "@dxos/assistant";
7
+ import { ObjectId, S } from "@dxos/echo-schema";
8
+ import { ScriptType } from "@dxos/functions";
9
+ import { invariant } from "@dxos/invariant";
10
+ import { create, makeRef } from "@dxos/react-client/echo";
11
+ import { TextType } from "@dxos/schema";
12
+ import { SpaceAction } from "@dxos/plugin-space/types";
13
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/capabilities/artifact.ts";
14
+ var artifact_default = () => {
15
+ const definition = defineArtifact({
16
+ id: "plugin-script",
17
+ // TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
18
+ // we should offload the work of synthesizing the code to a separate model.
19
+ // The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
20
+ instructions: `
21
+ If the user explicitly requests you to write a script, you can create one.
22
+ If the user requests you to change one of the existing script, you can update it.
23
+ Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.
24
+ Each script must follow as strict shape for the definition but the body can contain any valid executable code.
25
+ Scripts are written in JavaScript or TypeScript.
26
+ Each script must define an input schema and output schema.
27
+ Each script must have its own detailed description.
28
+
29
+ Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.
30
+
31
+ Description:
32
+ The description is a detailed description of the script.
33
+ It is used to describe the script's purpose, input, and output.
34
+ The description is used to generate the script's documentation.
35
+ The description is also goes into the script metadata.
36
+ The description is used by AI to understand the script and its purpose.
37
+ The description must provide cases on when the script should be used.
38
+
39
+ Schema:
40
+ The schema is defined using a schema-DSL library called Effect Schema.
41
+ The input schema describes the arguments that the script accepts.
42
+ The output schema describes the result that the script produces.
43
+ The schema is used to validate the script's input and output.
44
+ The schema is also goes into the script metadata.
45
+ The properties in the schema must have valid descriptions.
46
+ The input and output schemas must both be a struct of fields.
47
+
48
+ Restricts:
49
+ The scripts can only import code from "dxos:functions" module. No other modules are allowed.
50
+ Some web APIs are available - like fetch.
51
+
52
+ Reasoning:
53
+ Before writing a script, synthesize the following information:
54
+ - Description
55
+ - What APIs will be used.
56
+ - Detailed input schema
57
+ - Detailed output schema
58
+
59
+ <apis>
60
+ export function defineFunction(params: {
61
+ description: string,
62
+ inputSchema: S.Schema,
63
+ outputSchema: S.Schema,
64
+ handler: (params: { event: { data: TInput } }) => Promise<TOutput>
65
+ }): FunctionDefinition
66
+ /**
67
+ * Effect Schema
68
+ */
69
+ export const S;
70
+
71
+ // Examples:
72
+
73
+ S.String
74
+ S.Number
75
+ S.Boolean
76
+ S.Struct({
77
+ from: S.String.annotations({ description: 'The source currency' }),
78
+ to: S.String.annotations({ description: 'The target currency' }),
79
+ })
80
+ S.Array(S.String)
81
+ S.Union(S.String, S.Number)
82
+ S.Optional(S.String)
83
+ S.String.annotations({ description: 'The source currency' })
84
+ </apis>
85
+
86
+ <handler_function>
87
+ Async function that takes the argument in the form of:
88
+
89
+ type HandlerFunctionParam = {
90
+ event: {
91
+ data: T // The input schema
92
+ },
93
+ }
94
+
95
+ The function must return the result that matches the output schema.
96
+ </handler_function>
97
+
98
+ <example>
99
+ import { defineFunction, S } from 'dxos:functions';
100
+
101
+ export default defineFunction({
102
+ description: 'Returns the exchange rate between two currencies.',
103
+
104
+ inputSchema: S.Struct({
105
+ from: S.String.annotations({ description: 'The source currency' }),
106
+ to: S.String.annotations({ description: 'The target currency' }),
107
+ }),
108
+
109
+ outputSchema: S.Struct({
110
+ rate: S.String.annotations({ description: 'The exchange rate' }),
111
+ }),
112
+
113
+ handler: async ({
114
+ event: {
115
+ data: { from, to },
116
+ },
117
+ }: any) => {
118
+ const res = await fetch(\`https://free.ratesdb.com/v1/rates?from=\${from}&to=\${to}\`);
119
+ const {
120
+ data: { rates },
121
+ } = await res.json();
122
+
123
+ return { rate: rates[to].toString() };
124
+ },
125
+ });
126
+ </example>
127
+ `,
128
+ schema: ScriptType,
129
+ tools: [
130
+ defineTool({
131
+ name: "script_new",
132
+ description: "Create a new script. Returns the artifact definition for the script",
133
+ schema: S.Struct({
134
+ name: S.String.annotations({
135
+ description: "The name of the script"
136
+ }),
137
+ code: S.String.annotations({
138
+ description: "The full code of the script in JavaScript or TypeScript. Must be valid executable code."
139
+ })
140
+ }),
141
+ execute: async ({ name, code }, { extensions }) => {
142
+ invariant(extensions?.space, "No space", {
143
+ F: __dxlog_file,
144
+ L: 149,
145
+ S: void 0,
146
+ A: [
147
+ "extensions?.space",
148
+ "'No space'"
149
+ ]
150
+ });
151
+ invariant(extensions?.dispatch, "No intent dispatcher", {
152
+ F: __dxlog_file,
153
+ L: 150,
154
+ S: void 0,
155
+ A: [
156
+ "extensions?.dispatch",
157
+ "'No intent dispatcher'"
158
+ ]
159
+ });
160
+ const script = create(ScriptType, {
161
+ name,
162
+ source: makeRef(create(TextType, {
163
+ content: code
164
+ }))
165
+ });
166
+ extensions.space.db.add(script);
167
+ await extensions.space.db.flush();
168
+ const intent = createIntent(SpaceAction.AddObject, {
169
+ target: extensions.space,
170
+ object: script
171
+ });
172
+ const { data, error } = await extensions.dispatch(intent);
173
+ if (!data || error) {
174
+ return ToolResult.Error(error?.message ?? "Failed to create chess game");
175
+ }
176
+ return ToolResult.Success(createArtifactElement(script.id));
177
+ }
178
+ }),
179
+ defineTool({
180
+ name: "script_inspect",
181
+ description: "Inspect a script. Returns the artifact definition for the script",
182
+ schema: S.Struct({
183
+ id: ObjectId
184
+ }),
185
+ execute: async ({ id }, { extensions }) => {
186
+ invariant(extensions?.space, "No space", {
187
+ F: __dxlog_file,
188
+ L: 178,
189
+ S: void 0,
190
+ A: [
191
+ "extensions?.space",
192
+ "'No space'"
193
+ ]
194
+ });
195
+ const script = await extensions.space.db.query({
196
+ id
197
+ }).first();
198
+ const { content } = await script.source.load();
199
+ return ToolResult.Success({
200
+ name: script.name,
201
+ code: content
202
+ });
203
+ }
204
+ }),
205
+ defineTool({
206
+ name: "script_update",
207
+ description: "Update a script. Returns the artifact definition for the script",
208
+ schema: S.Struct({
209
+ id: ObjectId,
210
+ code: S.String.annotations({
211
+ description: "The full code of the script in JavaScript or TypeScript. Must be valid executable code."
212
+ })
213
+ }),
214
+ execute: async ({ id, code }, { extensions }) => {
215
+ invariant(extensions?.space, "No space", {
216
+ F: __dxlog_file,
217
+ L: 199,
218
+ S: void 0,
219
+ A: [
220
+ "extensions?.space",
221
+ "'No space'"
222
+ ]
223
+ });
224
+ const script = await extensions.space.db.query({
225
+ id
226
+ }).first();
227
+ const source = await script.source.load();
228
+ if (!source) {
229
+ return ToolResult.Error("Script not found");
230
+ }
231
+ source.content = code;
232
+ await extensions.space?.db.flush();
233
+ return ToolResult.Success({
234
+ name: script.name
235
+ });
236
+ }
237
+ })
238
+ ]
239
+ });
240
+ return contributes(Capabilities.ArtifactDefinition, definition);
241
+ };
242
+ export {
243
+ artifact_default as default
244
+ };
245
+ //# sourceMappingURL=artifact-RFZQ2AJJ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/artifact.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';\nimport { invariant } from '@dxos/invariant';\nimport { create, makeRef, type Space } from '@dxos/react-client/echo';\nimport { TextType } from '@dxos/schema';\nimport { SpaceAction } from '@dxos/plugin-space/types';\n\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: 'plugin-script',\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 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({\n name: 'script_new',\n description: 'Create a new script. Returns the artifact definition for the 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({\n name: 'script_inspect',\n description: 'Inspect a script. Returns the artifact definition for the 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({\n name: 'script_update',\n description: 'Update a script. Returns the artifact definition for the 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": ";;;AAIA,SAASA,cAAcC,aAAaC,oBAAkD;AACtF,SAASC,gBAAgBC,YAAYC,kBAAkB;AACvD,SAASC,6BAA6B;AACtC,SAASC,UAAUC,SAAS;AAC5B,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,eAA2B;AAC5C,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;;AAU5B,IAAA,mBAAe,MAAA;AACb,QAAMC,aAAaZ,eAAe;IAChCa,IAAI;;;;IAIJC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4GdC,QAAQT;IACRU,OAAO;MACLf,WAAW;QACTgB,MAAM;QACNC,aAAa;QACbH,QAAQV,EAAEc,OAAO;UACfF,MAAMZ,EAAEe,OAAOC,YAAY;YAAEH,aAAa;UAAyB,CAAA;UACnEI,MAAMjB,EAAEe,OAAOC,YAAY;YACzBH,aAAa;UACf,CAAA;QACF,CAAA;QACAK,SAAS,OAAO,EAAEN,MAAMK,KAAI,GAAI,EAAEE,WAAU,MAAE;AAC5CjB,oBAAUiB,YAAYC,OAAO,YAAA;;;;;;;;;AAC7BlB,oBAAUiB,YAAYE,UAAU,wBAAA;;;;;;;;;AAChC,gBAAMC,SAASnB,OAAOF,YAAY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,WAAWC,MAAMK,GAAGY,MAAM;YAAE7B;UAAG,CAAA,EAAG8B,MAAK;AAC7D,gBAAMf,SAAS,MAAMD,OAAOC,OAAOgB,KAAI;AACvC,cAAI,CAAChB,QAAQ;AACX,mBAAO1B,WAAWqC,MAAM,kBAAA;UAC1B;AAEAX,iBAAOC,UAAUP;AACjB,gBAAME,WAAWC,OAAOK,GAAGE,MAAAA;AAE3B,iBAAO9B,WAAWuC,QAAQ;YACxBxB,MAAMU,OAAOV;UACf,CAAA;QACF;MACF,CAAA;;EAEJ,CAAA;AAEA,SAAOnB,YAAYD,aAAagD,oBAAoBjC,UAAAA;AACtD;",
6
+ "names": ["Capabilities", "contributes", "createIntent", "defineArtifact", "defineTool", "ToolResult", "createArtifactElement", "ObjectId", "S", "ScriptType", "invariant", "create", "makeRef", "TextType", "SpaceAction", "definition", "id", "instructions", "schema", "tools", "name", "description", "Struct", "String", "annotations", "code", "execute", "extensions", "space", "dispatch", "script", "source", "content", "db", "add", "flush", "intent", "AddObject", "target", "object", "data", "error", "Error", "message", "Success", "query", "first", "load", "ArtifactDefinition"]
7
+ }
@@ -60,7 +60,7 @@ import { FunctionType, getInvocationUrl, getUserFunctionUrlInMetadata } from "@d
60
60
  import { log } from "@dxos/log";
61
61
  import { useClient as useClient2 } from "@dxos/react-client";
62
62
  import { Filter, getMeta, getSpace, useQuery } from "@dxos/react-client/echo";
63
- import { Button as Button2, Clipboard, Input, Separator, useControlledValue, useTranslation as useTranslation2 } from "@dxos/react-ui";
63
+ import { Button as Button2, Clipboard, Input, Separator, useControlledState, useTranslation as useTranslation2 } from "@dxos/react-ui";
64
64
  import { AccessTokenType } from "@dxos/schema";
65
65
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/components/ScriptSettingsPanel.tsx";
66
66
  var kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
@@ -108,7 +108,7 @@ var ScriptSettingsPanel = ({ script }) => {
108
108
  githubToken,
109
109
  gistKey
110
110
  ]);
111
- const [binding, setBinding] = useControlledValue(fn?.binding ?? "");
111
+ const [binding, setBinding] = useControlledState(fn?.binding ?? "");
112
112
  const handleBindingChange = useCallback((event) => {
113
113
  setBinding(event.target.value);
114
114
  }, [
@@ -226,7 +226,7 @@ var ScriptSettingsPanel = ({ script }) => {
226
226
  // packages/plugins/experimental/plugin-script/src/components/index.ts
227
227
  import { lazy } from "react";
228
228
  var AutomationPanel = lazy(() => import("./AutomationPanel-W6SKG35R.mjs"));
229
- var ScriptContainer = lazy(() => import("./ScriptContainer-F7SNP53Z.mjs"));
229
+ var ScriptContainer = lazy(() => import("./ScriptContainer-MNETNTNQ.mjs"));
230
230
 
231
231
  export {
232
232
  ScriptSettings,
@@ -234,4 +234,4 @@ export {
234
234
  AutomationPanel,
235
235
  ScriptContainer
236
236
  };
237
- //# sourceMappingURL=chunk-PRGBYF4B.mjs.map
237
+ //# sourceMappingURL=chunk-FGO5DVO2.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/ScriptSettings/ScriptSettings.tsx", "../../../src/components/ScriptSettingsPanel.tsx", "../../../src/components/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\nimport { useClient } from '@dxos/react-client';\nimport { Button, Select, useTranslation } from '@dxos/react-ui';\nimport { type EditorInputMode, EditorInputModes } from '@dxos/react-ui-editor';\nimport { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';\n\nimport { SCRIPT_PLUGIN } from '../../meta';\nimport { type ScriptSettingsProps } from '../../types';\n\nexport const ScriptSettings = ({ settings }: { settings: ScriptSettingsProps }) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const client = useClient();\n\n // TODO(burdon): Check token.\n const handleAuthenticate = async () => {\n const { identityKey } = client.halo.identity.get()!;\n await client.halo.writeCredentials([\n {\n issuer: identityKey,\n issuanceDate: new Date(),\n subject: {\n id: identityKey,\n assertion: {\n '@type': 'dxos.halo.credentials.ServiceAccess',\n serverName: 'hub.dxos.network',\n serverKey: identityKey,\n identityKey,\n capabilities: ['composer:beta'],\n },\n },\n } satisfies Credential,\n ]);\n };\n\n return (\n <DeprecatedFormContainer>\n {/* TODO(wittjosiah): Hide outside of dev environments. */}\n <DeprecatedFormInput label={t('authenticate action label')}>\n <Button onClick={handleAuthenticate}>{t('authenticate button label')}</Button>\n </DeprecatedFormInput>\n\n <DeprecatedFormInput label={t('editor input mode label')}>\n <Select.Root\n value={settings.editorInputMode ?? 'default'}\n onValueChange={(value) => {\n settings.editorInputMode = value as EditorInputMode;\n }}\n >\n <Select.TriggerButton placeholder={t('select editor input mode placeholder')} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {EditorInputModes.map((mode) => (\n <Select.Option key={mode} value={mode}>\n {t(`settings editor input mode ${mode} label`)}\n </Select.Option>\n ))}\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n </DeprecatedFormInput>\n </DeprecatedFormContainer>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Octokit } from '@octokit/core';\nimport React, { type ChangeEvent, useCallback, useEffect, useState } from 'react';\n\nimport { createIntent, SettingsAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { FunctionType, type ScriptType, getInvocationUrl, 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 { Button, Clipboard, Input, Separator, useControlledValue, useTranslation } from '@dxos/react-ui';\nimport { AccessTokenType } from '@dxos/schema';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\n// TODO(wittjosiah): Factor out.\n// From https://stackoverflow.com/a/67243723/2804332\nconst kebabize = (str: string) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());\n\nexport type ScriptSettingsPanelProps = {\n script: ScriptType;\n};\n\nexport const ScriptSettingsPanel = ({ script }: ScriptSettingsPanelProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n const space = getSpace(script);\n const [fn] = useQuery(space, Filter.schema(FunctionType, { source: script }));\n const [githubToken] = useQuery(space, Filter.schema(AccessTokenType, { source: 'github.com' }));\n const gistKey = getMeta(script).keys.find(({ source }) => source === 'github.com');\n const [gistUrl, setGistUrl] = useState<string | undefined>();\n\n useEffect(() => {\n const token = githubToken?.token;\n const gistId = gistKey?.id;\n if (!token || !gistId) {\n setGistUrl(undefined);\n return;\n }\n\n const timeout = setTimeout(async () => {\n try {\n const octokit = new Octokit({ auth: githubToken.token });\n const response = await octokit.request('GET /gists/{gist_id}', {\n gist_id: gistId,\n });\n setGistUrl(response.data.html_url);\n } catch (err) {\n log.catch(err);\n setGistUrl(undefined);\n }\n });\n\n return () => clearTimeout(timeout);\n }, [githubToken, gistKey]);\n\n const [binding, setBinding] = useControlledValue(fn?.binding ?? '');\n const handleBindingChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setBinding(event.target.value);\n },\n [setBinding],\n );\n const handleBindingBlur = useCallback(() => {\n fn.binding = binding;\n }, [fn, binding]);\n\n const functionPath = fn && getUserFunctionUrlInMetadata(getMeta(fn));\n const functionUrl =\n functionPath &&\n getInvocationUrl(functionPath, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n });\n\n const handleOpenTokenManager = useCallback(\n () => dispatch(createIntent(SettingsAction.Open, { plugin: 'dxos.org/plugin/token-manager' })),\n [],\n );\n\n const [publishing, setPublishing] = useState(false);\n const handlePublish = useCallback(async () => {\n setPublishing(true);\n const octokit = new Octokit({ auth: githubToken.token });\n const source = await script.source.load();\n const filename = script.name ? kebabize(script.name) : 'composer-script';\n const files = { [`${filename}.ts`]: { content: source.content } };\n\n try {\n // TODO(wittjosiah): Factor out to intent.\n const meta = getMeta(script);\n const githubKey = meta.keys.find(({ source }) => source === 'github.com');\n const gistId = githubKey?.id;\n if (gistId) {\n await octokit.request('PATCH /gists/{gist_id}', {\n gist_id: gistId,\n files,\n });\n } else {\n const response = await octokit.request('POST /gists', {\n public: true,\n files,\n });\n if (response.data.id) {\n meta.keys.push({ source: 'github.com', id: response.data.id });\n }\n }\n } finally {\n setPublishing(false);\n }\n }, [script, githubToken]);\n\n return (\n <>\n <div role='form' className='flex flex-col w-full p-2 gap-4'>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('description label')}</Input.Label>\n <Input.TextInput\n placeholder={t('description placeholder')}\n value={script.description ?? ''}\n onChange={(event) => {\n script.description = event.target.value;\n }}\n />\n </div>\n </Input.Root>\n </div>\n {fn && functionUrl && (\n <>\n <Separator />\n <div role='form' className='flex flex-col w-full p-2 gap-4'>\n <h2>{t('remote function settings heading')}</h2>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('function url label')}</Input.Label>\n <div role='none' className='flex gap-1'>\n <Input.TextInput\n disabled\n value={functionUrl}\n onChange={(event) => {\n fn.name = event.target.value;\n }}\n />\n <Clipboard.IconButton value={functionUrl} />\n </div>\n </div>\n </Input.Root>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('function binding label')}</Input.Label>\n <Input.TextInput\n placeholder={t('function binding placeholder')}\n value={binding}\n onChange={handleBindingChange}\n onBlur={handleBindingBlur}\n />\n </div>\n </Input.Root>\n </div>\n </>\n )}\n <Separator />\n <div className='flex flex-col w-full p-2 gap-4'>\n <div>\n <h2>{t('script publish settings label')}</h2>\n <p className='text-description text-sm'>{t('script publish settings description')}</p>\n </div>\n {!githubToken && (\n <div className='flex flex-col items-center justify-center gap-2'>\n <span>{t('no github token label')}</span>\n <Button onClick={handleOpenTokenManager}>{t('open token manager label')}</Button>\n </div>\n )}\n {githubToken && (\n <div className='flex justify-end gap-2'>\n {gistUrl && <Clipboard.IconButton value={gistUrl} />}\n <Button disabled={publishing} onClick={handlePublish}>\n {t(publishing ? 'publishing label' : 'publish label')}\n </Button>\n </div>\n )}\n </div>\n </>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './ScriptSettings';\nexport * from './ScriptSettingsPanel';\n\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const ScriptContainer = lazy(() => import('./ScriptContainer'));\n"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\nimport { useClient } from '@dxos/react-client';\nimport { Button, Select, useTranslation } from '@dxos/react-ui';\nimport { type EditorInputMode, EditorInputModes } from '@dxos/react-ui-editor';\nimport { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';\n\nimport { SCRIPT_PLUGIN } from '../../meta';\nimport { type ScriptSettingsProps } from '../../types';\n\nexport const ScriptSettings = ({ settings }: { settings: ScriptSettingsProps }) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const client = useClient();\n\n // TODO(burdon): Check token.\n const handleAuthenticate = async () => {\n const { identityKey } = client.halo.identity.get()!;\n await client.halo.writeCredentials([\n {\n issuer: identityKey,\n issuanceDate: new Date(),\n subject: {\n id: identityKey,\n assertion: {\n '@type': 'dxos.halo.credentials.ServiceAccess',\n serverName: 'hub.dxos.network',\n serverKey: identityKey,\n identityKey,\n capabilities: ['composer:beta'],\n },\n },\n } satisfies Credential,\n ]);\n };\n\n return (\n <DeprecatedFormContainer>\n {/* TODO(wittjosiah): Hide outside of dev environments. */}\n <DeprecatedFormInput label={t('authenticate action label')}>\n <Button onClick={handleAuthenticate}>{t('authenticate button label')}</Button>\n </DeprecatedFormInput>\n\n <DeprecatedFormInput label={t('editor input mode label')}>\n <Select.Root\n value={settings.editorInputMode ?? 'default'}\n onValueChange={(value) => {\n settings.editorInputMode = value as EditorInputMode;\n }}\n >\n <Select.TriggerButton placeholder={t('select editor input mode placeholder')} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {EditorInputModes.map((mode) => (\n <Select.Option key={mode} value={mode}>\n {t(`settings editor input mode ${mode} label`)}\n </Select.Option>\n ))}\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n </DeprecatedFormInput>\n </DeprecatedFormContainer>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Octokit } from '@octokit/core';\nimport React, { type ChangeEvent, useCallback, useEffect, useState } from 'react';\n\nimport { createIntent, SettingsAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { FunctionType, type ScriptType, getInvocationUrl, 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 { Button, Clipboard, Input, Separator, useControlledState, useTranslation } from '@dxos/react-ui';\nimport { AccessTokenType } from '@dxos/schema';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\n// TODO(wittjosiah): Factor out.\n// From https://stackoverflow.com/a/67243723/2804332\nconst kebabize = (str: string) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());\n\nexport type ScriptSettingsPanelProps = {\n script: ScriptType;\n};\n\nexport const ScriptSettingsPanel = ({ script }: ScriptSettingsPanelProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n const space = getSpace(script);\n const [fn] = useQuery(space, Filter.schema(FunctionType, { source: script }));\n const [githubToken] = useQuery(space, Filter.schema(AccessTokenType, { source: 'github.com' }));\n const gistKey = getMeta(script).keys.find(({ source }) => source === 'github.com');\n const [gistUrl, setGistUrl] = useState<string | undefined>();\n\n useEffect(() => {\n const token = githubToken?.token;\n const gistId = gistKey?.id;\n if (!token || !gistId) {\n setGistUrl(undefined);\n return;\n }\n\n const timeout = setTimeout(async () => {\n try {\n const octokit = new Octokit({ auth: githubToken.token });\n const response = await octokit.request('GET /gists/{gist_id}', {\n gist_id: gistId,\n });\n setGistUrl(response.data.html_url);\n } catch (err) {\n log.catch(err);\n setGistUrl(undefined);\n }\n });\n\n return () => clearTimeout(timeout);\n }, [githubToken, gistKey]);\n\n const [binding, setBinding] = useControlledState(fn?.binding ?? '');\n const handleBindingChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setBinding(event.target.value);\n },\n [setBinding],\n );\n const handleBindingBlur = useCallback(() => {\n fn.binding = binding;\n }, [fn, binding]);\n\n const functionPath = fn && getUserFunctionUrlInMetadata(getMeta(fn));\n const functionUrl =\n functionPath &&\n getInvocationUrl(functionPath, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n });\n\n const handleOpenTokenManager = useCallback(\n () => dispatch(createIntent(SettingsAction.Open, { plugin: 'dxos.org/plugin/token-manager' })),\n [],\n );\n\n const [publishing, setPublishing] = useState(false);\n const handlePublish = useCallback(async () => {\n setPublishing(true);\n const octokit = new Octokit({ auth: githubToken.token });\n const source = await script.source.load();\n const filename = script.name ? kebabize(script.name) : 'composer-script';\n const files = { [`${filename}.ts`]: { content: source.content } };\n\n try {\n // TODO(wittjosiah): Factor out to intent.\n const meta = getMeta(script);\n const githubKey = meta.keys.find(({ source }) => source === 'github.com');\n const gistId = githubKey?.id;\n if (gistId) {\n await octokit.request('PATCH /gists/{gist_id}', {\n gist_id: gistId,\n files,\n });\n } else {\n const response = await octokit.request('POST /gists', {\n public: true,\n files,\n });\n if (response.data.id) {\n meta.keys.push({ source: 'github.com', id: response.data.id });\n }\n }\n } finally {\n setPublishing(false);\n }\n }, [script, githubToken]);\n\n return (\n <>\n <div role='form' className='flex flex-col w-full p-2 gap-4'>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('description label')}</Input.Label>\n <Input.TextInput\n placeholder={t('description placeholder')}\n value={script.description ?? ''}\n onChange={(event) => {\n script.description = event.target.value;\n }}\n />\n </div>\n </Input.Root>\n </div>\n {fn && functionUrl && (\n <>\n <Separator />\n <div role='form' className='flex flex-col w-full p-2 gap-4'>\n <h2>{t('remote function settings heading')}</h2>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('function url label')}</Input.Label>\n <div role='none' className='flex gap-1'>\n <Input.TextInput\n disabled\n value={functionUrl}\n onChange={(event) => {\n fn.name = event.target.value;\n }}\n />\n <Clipboard.IconButton value={functionUrl} />\n </div>\n </div>\n </Input.Root>\n <Input.Root>\n <div role='none' className='flex flex-col gap-1'>\n <Input.Label>{t('function binding label')}</Input.Label>\n <Input.TextInput\n placeholder={t('function binding placeholder')}\n value={binding}\n onChange={handleBindingChange}\n onBlur={handleBindingBlur}\n />\n </div>\n </Input.Root>\n </div>\n </>\n )}\n <Separator />\n <div className='flex flex-col w-full p-2 gap-4'>\n <div>\n <h2>{t('script publish settings label')}</h2>\n <p className='text-description text-sm'>{t('script publish settings description')}</p>\n </div>\n {!githubToken && (\n <div className='flex flex-col items-center justify-center gap-2'>\n <span>{t('no github token label')}</span>\n <Button onClick={handleOpenTokenManager}>{t('open token manager label')}</Button>\n </div>\n )}\n {githubToken && (\n <div className='flex justify-end gap-2'>\n {gistUrl && <Clipboard.IconButton value={gistUrl} />}\n <Button disabled={publishing} onClick={handlePublish}>\n {t(publishing ? 'publishing label' : 'publish label')}\n </Button>\n </div>\n )}\n </div>\n </>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport * from './ScriptSettings';\nexport * from './ScriptSettingsPanel';\n\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\nexport const ScriptContainer = lazy(() => import('./ScriptContainer'));\n"],
5
5
  "mappings": ";;;;;;A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,gBAAAiE,OAAA,cAACC,OAAAA;IAAIE,WAAU;KACZ9D,WAAW,gBAAA2D,OAAA,cAACc,UAAUC,YAAU;IAAC7C,OAAO7B;MACzC,gBAAA2D,OAAA,cAACmB,SAAAA;IAAON,UAAUzB;IAAYgC,SAAS9B;KACpCvE,EAAEqE,aAAa,qBAAqB,eAAA,CAAA,CAAA,CAAA,CAAA;AAOnD;;;ACvLA,SAASiC,YAAY;AAKd,IAAMC,kBAAkBC,KAAK,MAAM,OAAO,gCAAA,CAAA;AAC1C,IAAMC,kBAAkBD,KAAK,MAAM,OAAO,gCAAA,CAAA;",
6
- "names": ["React", "useClient", "Button", "Select", "useTranslation", "EditorInputModes", "DeprecatedFormContainer", "DeprecatedFormInput", "ScriptSettings", "settings", "t", "useTranslation", "SCRIPT_PLUGIN", "client", "useClient", "handleAuthenticate", "identityKey", "halo", "identity", "get", "writeCredentials", "issuer", "issuanceDate", "Date", "subject", "id", "assertion", "serverName", "serverKey", "capabilities", "DeprecatedFormContainer", "DeprecatedFormInput", "label", "Button", "onClick", "Select", "Root", "value", "editorInputMode", "onValueChange", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "EditorInputModes", "map", "mode", "Option", "key", "Octokit", "React", "useCallback", "useEffect", "useState", "createIntent", "SettingsAction", "useIntentDispatcher", "FunctionType", "getInvocationUrl", "getUserFunctionUrlInMetadata", "log", "useClient", "Filter", "getMeta", "getSpace", "useQuery", "Button", "Clipboard", "Input", "Separator", "useControlledValue", "useTranslation", "AccessTokenType", "kebabize", "str", "replace", "$", "ofs", "toLowerCase", "ScriptSettingsPanel", "script", "t", "useTranslation", "SCRIPT_PLUGIN", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "source", "githubToken", "AccessTokenType", "gistKey", "getMeta", "keys", "find", "gistUrl", "setGistUrl", "useState", "useEffect", "token", "gistId", "id", "undefined", "timeout", "setTimeout", "octokit", "Octokit", "auth", "response", "request", "gist_id", "data", "html_url", "err", "log", "catch", "clearTimeout", "binding", "setBinding", "useControlledValue", "handleBindingChange", "useCallback", "event", "target", "value", "handleBindingBlur", "functionPath", "getUserFunctionUrlInMetadata", "functionUrl", "getInvocationUrl", "config", "values", "runtime", "services", "edge", "url", "spaceId", "handleOpenTokenManager", "createIntent", "SettingsAction", "Open", "plugin", "publishing", "setPublishing", "handlePublish", "load", "filename", "name", "files", "content", "meta", "githubKey", "public", "push", "React", "div", "role", "className", "Input", "Root", "Label", "TextInput", "placeholder", "description", "onChange", "Separator", "h2", "disabled", "Clipboard", "IconButton", "onBlur", "p", "span", "Button", "onClick", "lazy", "AutomationPanel", "lazy", "ScriptContainer"]
6
+ "names": ["React", "useClient", "Button", "Select", "useTranslation", "EditorInputModes", "DeprecatedFormContainer", "DeprecatedFormInput", "ScriptSettings", "settings", "t", "useTranslation", "SCRIPT_PLUGIN", "client", "useClient", "handleAuthenticate", "identityKey", "halo", "identity", "get", "writeCredentials", "issuer", "issuanceDate", "Date", "subject", "id", "assertion", "serverName", "serverKey", "capabilities", "DeprecatedFormContainer", "DeprecatedFormInput", "label", "Button", "onClick", "Select", "Root", "value", "editorInputMode", "onValueChange", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "EditorInputModes", "map", "mode", "Option", "key", "Octokit", "React", "useCallback", "useEffect", "useState", "createIntent", "SettingsAction", "useIntentDispatcher", "FunctionType", "getInvocationUrl", "getUserFunctionUrlInMetadata", "log", "useClient", "Filter", "getMeta", "getSpace", "useQuery", "Button", "Clipboard", "Input", "Separator", "useControlledState", "useTranslation", "AccessTokenType", "kebabize", "str", "replace", "$", "ofs", "toLowerCase", "ScriptSettingsPanel", "script", "t", "useTranslation", "SCRIPT_PLUGIN", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "source", "githubToken", "AccessTokenType", "gistKey", "getMeta", "keys", "find", "gistUrl", "setGistUrl", "useState", "useEffect", "token", "gistId", "id", "undefined", "timeout", "setTimeout", "octokit", "Octokit", "auth", "response", "request", "gist_id", "data", "html_url", "err", "log", "catch", "clearTimeout", "binding", "setBinding", "useControlledState", "handleBindingChange", "useCallback", "event", "target", "value", "handleBindingBlur", "functionPath", "getUserFunctionUrlInMetadata", "functionUrl", "getInvocationUrl", "config", "values", "runtime", "services", "edge", "url", "spaceId", "handleOpenTokenManager", "createIntent", "SettingsAction", "Open", "plugin", "publishing", "setPublishing", "handlePublish", "load", "filename", "name", "files", "content", "meta", "githubKey", "public", "push", "React", "div", "role", "className", "Input", "Root", "Label", "TextInput", "placeholder", "description", "onChange", "Separator", "h2", "disabled", "Clipboard", "IconButton", "onBlur", "p", "span", "Button", "onClick", "lazy", "AutomationPanel", "lazy", "ScriptContainer"]
7
7
  }
@@ -8,7 +8,7 @@ import {
8
8
  ScriptContainer,
9
9
  ScriptSettings,
10
10
  ScriptSettingsPanel
11
- } from "./chunk-PRGBYF4B.mjs";
11
+ } from "./chunk-FGO5DVO2.mjs";
12
12
  import {
13
13
  ScriptCapabilities
14
14
  } from "./chunk-CP5LXTK5.mjs";
@@ -24,8 +24,9 @@ import {
24
24
  import { lazy } from "@dxos/app-framework";
25
25
  var Compiler = lazy(() => import("./compiler-PDN46H4Y.mjs"));
26
26
  var IntentResolver = lazy(() => import("./intent-resolver-75BHFRUK.mjs"));
27
- var ReactSurface = lazy(() => import("./react-surface-PKUVZH4S.mjs"));
27
+ var ReactSurface = lazy(() => import("./react-surface-NAK6LMCY.mjs"));
28
28
  var ScriptSettings2 = lazy(() => import("./settings-GR4O2WHZ.mjs"));
29
+ var Artifact = lazy(() => import("./artifact-RFZQ2AJJ.mjs"));
29
30
 
30
31
  // packages/plugins/experimental/plugin-script/src/ScriptPlugin.tsx
31
32
  import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from "@dxos/app-framework";
@@ -147,6 +148,11 @@ var ScriptPlugin = () => definePlugin(meta, [
147
148
  id: `${meta.id}/module/intent-resolver`,
148
149
  activatesOn: Events.SetupIntents,
149
150
  activate: IntentResolver
151
+ }),
152
+ defineModule({
153
+ id: `${meta.id}/module/artifact`,
154
+ activatesOn: Events.Startup,
155
+ activate: Artifact
150
156
  })
151
157
  ]);
152
158
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/capabilities/index.ts", "../../../src/ScriptPlugin.tsx", "../../../src/translations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Compiler = lazy(() => import('./compiler'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\nexport const ScriptSettings = lazy(() => import('./settings'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// @ts-ignore\n\nimport { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { type Space } from '@dxos/client/echo';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { RefArray } from '@dxos/live-object';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { Compiler, IntentResolver, ReactSurface, ScriptSettings } from './capabilities';\nimport { meta, SCRIPT_PLUGIN } from './meta';\nimport translations from './translations';\nimport { ScriptAction } from './types';\n\nexport const ScriptPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/settings`,\n activatesOn: Events.SetupSettings,\n activate: ScriptSettings,\n }),\n defineModule({\n id: `${meta.id}/module/compiler`,\n activatesOn: Events.Startup,\n activate: Compiler,\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: ScriptType.typename,\n metadata: {\n creationSchema: ScriptAction.CreateScriptSchema,\n createObject: (props: ScriptAction.CreateScriptProps, { space }: { space: Space }) =>\n createIntent(ScriptAction.Create, { ...props, space }),\n placeholder: ['object title placeholder', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--code--regular',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: async (script: ScriptType) => await RefArray.loadAll([script.source]),\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => [\n contributes(ClientCapabilities.SystemSchema, [FunctionType]),\n contributes(ClientCapabilities.Schema, [ScriptType]),\n ],\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupSurfaces,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: IntentResolver,\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ScriptType } from '@dxos/functions';\n\nimport { SCRIPT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [ScriptType.typename]: {\n 'typename label': 'Script',\n },\n [SCRIPT_PLUGIN]: {\n 'plugin name': 'Scripts',\n 'object title placeholder': 'New script',\n 'create object label': 'Create script',\n 'create stack section label': 'Create script',\n 'description label': 'Description',\n 'description placeholder': 'Describe what the script does.',\n 'binding placeholder': 'Function name',\n 'function request placeholder': 'Function request',\n 'deploy label': 'Deploy',\n 'deployed label': 'Current version of the script is deployed',\n 'upload failed label': 'Upload failed',\n 'copy link label': 'Copy function link',\n 'format label': 'Format',\n 'toggle details label': 'Toggle details panel',\n 'authenticate action label': 'Authenticate functions service',\n 'authenticate button label': 'Authenticate',\n 'name label': 'Name',\n 'remote function settings heading': 'Remote Function',\n 'function url label': 'Invocation URL',\n 'function binding label': 'Function binding',\n 'function binding placeholder': 'BINDING',\n 'script publish settings label': 'Publishing',\n 'script publish settings description': 'Scripts can be shared publicly as Github gists.',\n 'no github token label': 'This space has no Github access token available.',\n 'open token manager label': 'Open Token Manager',\n 'publish label': 'Publish',\n 'publishing label': 'Publishing',\n 'editor input mode label': 'Editor input mode',\n 'select editor input mode placeholder': 'Select editor input mode…',\n 'settings editor input mode default label': 'Default',\n 'settings editor input mode vim label': 'Vim',\n 'settings editor input mode vscode label': 'VS Code',\n 'view group label': 'View',\n 'view editor label': 'Editor',\n 'view split label': 'Split',\n 'view debug label': 'Debug',\n 'template select group label': 'Select template',\n },\n },\n },\n];\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,YAAY;AAEd,IAAMC,WAAWC,KAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,eAAeF,KAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMG,kBAAiBH,KAAK,MAAM,OAAO,yBAAA,CAAA;;;ACHhD,SAASI,cAAcC,aAAaC,cAAcC,cAAcC,cAAcC,cAAc;AAE5F,SAASC,cAAcC,cAAAA,mBAAkB;AACzC,SAASC,gBAAgB;AACzB,SAASC,oBAAoBC,oBAAoB;;;ACNjD,SAASC,kBAAkB;AAI3B,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,WAAWC,QAAQ,GAAG;QACrB,kBAAkB;MACpB;MACA,CAACC,aAAAA,GAAgB;QACf,eAAe;QACf,4BAA4B;QAC5B,uBAAuB;QACvB,8BAA8B;QAC9B,qBAAqB;QACrB,2BAA2B;QAC3B,uBAAuB;QACvB,gCAAgC;QAChC,gBAAgB;QAChB,kBAAkB;QAClB,uBAAuB;QACvB,mBAAmB;QACnB,gBAAgB;QAChB,wBAAwB;QACxB,6BAA6B;QAC7B,6BAA6B;QAC7B,cAAc;QACd,oCAAoC;QACpC,sBAAsB;QACtB,0BAA0B;QAC1B,gCAAgC;QAChC,iCAAiC;QACjC,uCAAuC;QACvC,yBAAyB;QACzB,4BAA4B;QAC5B,iBAAiB;QACjB,oBAAoB;QACpB,2BAA2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aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOyC;IACpBvC,UAAUwC;EACZ,CAAA;CACD;",
6
- "names": ["lazy", "Compiler", "lazy", "IntentResolver", "ReactSurface", "ScriptSettings", "Capabilities", "contributes", "createIntent", "defineModule", "definePlugin", "Events", "FunctionType", "ScriptType", "RefArray", "ClientCapabilities", "ClientEvents", "ScriptType", "ScriptType", "typename", "SCRIPT_PLUGIN", "ScriptPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupSettings", "activate", "ScriptSettings", "Startup", "Compiler", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "ScriptType", "typename", "metadata", "creationSchema", "ScriptAction", "CreateScriptSchema", "createObject", "props", "space", "createIntent", "Create", "placeholder", "ns", "SCRIPT_PLUGIN", "icon", "loadReferences", "script", "RefArray", "loadAll", "source", "ClientEvents", "SetupSchema", "ClientCapabilities", "SystemSchema", "FunctionType", "Schema", "SetupSurfaces", "ReactSurface", "SetupIntents", "IntentResolver"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const Compiler = lazy(() => import('./compiler'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\nexport const ScriptSettings = lazy(() => import('./settings'));\nexport const Artifact = lazy(() => import('./artifact'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// @ts-ignore\n\nimport { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { type Space } from '@dxos/client/echo';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { RefArray } from '@dxos/live-object';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { Artifact, Compiler, IntentResolver, ReactSurface, ScriptSettings } from './capabilities';\nimport { meta, SCRIPT_PLUGIN } from './meta';\nimport translations from './translations';\nimport { ScriptAction } from './types';\n\nexport const ScriptPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/settings`,\n activatesOn: Events.SetupSettings,\n activate: ScriptSettings,\n }),\n defineModule({\n id: `${meta.id}/module/compiler`,\n activatesOn: Events.Startup,\n activate: Compiler,\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: ScriptType.typename,\n metadata: {\n creationSchema: ScriptAction.CreateScriptSchema,\n createObject: (props: ScriptAction.CreateScriptProps, { space }: { space: Space }) =>\n createIntent(ScriptAction.Create, { ...props, space }),\n placeholder: ['object title placeholder', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--code--regular',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: async (script: ScriptType) => await RefArray.loadAll([script.source]),\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => [\n contributes(ClientCapabilities.SystemSchema, [FunctionType]),\n contributes(ClientCapabilities.Schema, [ScriptType]),\n ],\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupSurfaces,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: IntentResolver,\n }),\n defineModule({\n id: `${meta.id}/module/artifact`,\n activatesOn: Events.Startup,\n activate: Artifact,\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ScriptType } from '@dxos/functions';\n\nimport { SCRIPT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [ScriptType.typename]: {\n 'typename label': 'Script',\n },\n [SCRIPT_PLUGIN]: {\n 'plugin name': 'Scripts',\n 'object title placeholder': 'New script',\n 'create object label': 'Create script',\n 'create stack section label': 'Create script',\n 'description label': 'Description',\n 'description placeholder': 'Describe what the script does.',\n 'binding placeholder': 'Function name',\n 'function request placeholder': 'Function request',\n 'deploy label': 'Deploy',\n 'deployed label': 'Current version of the script is deployed',\n 'upload failed label': 'Upload failed',\n 'copy link label': 'Copy function link',\n 'format label': 'Format',\n 'toggle details label': 'Toggle details panel',\n 'authenticate action label': 'Authenticate functions service',\n 'authenticate button label': 'Authenticate',\n 'name label': 'Name',\n 'remote function settings heading': 'Remote Function',\n 'function url label': 'Invocation URL',\n 'function binding label': 'Function binding',\n 'function binding placeholder': 'BINDING',\n 'script publish settings label': 'Publishing',\n 'script publish settings description': 'Scripts can be shared publicly as Github gists.',\n 'no github token label': 'This space has no Github access token available.',\n 'open token manager label': 'Open Token Manager',\n 'publish label': 'Publish',\n 'publishing label': 'Publishing',\n 'editor input mode label': 'Editor input mode',\n 'select editor input mode placeholder': 'Select editor input mode…',\n 'settings editor input mode default label': 'Default',\n 'settings editor input mode vim label': 'Vim',\n 'settings editor input mode vscode label': 'VS Code',\n 'view group label': 'View',\n 'view editor label': 'Editor',\n 'view split label': 'Split',\n 'view debug label': 'Debug',\n 'template select group label': 'Select template',\n },\n },\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,YAAY;AAEd,IAAMC,WAAWC,KAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,eAAeF,KAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMG,kBAAiBH,KAAK,MAAM,OAAO,yBAAA,CAAA;AACzC,IAAMI,WAAWJ,KAAK,MAAM,OAAO,yBAAA,CAAA;;;ACJ1C,SAASK,cAAcC,aAAaC,cAAcC,cAAcC,cAAcC,cAAc;AAE5F,SAASC,cAAcC,cAAAA,mBAAkB;AACzC,SAASC,gBAAgB;AACzB,SAASC,oBAAoBC,oBAAoB;;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AuC,EAAEC,MAAK,MAC3DC,aAAaL,aAAaM,QAAQ;UAAE,GAAGH;UAAOC;QAAM,CAAA;QACtDG,aAAa;UAAC;UAA4B;YAAEC,IAAIC;UAAc;;QAC9DC,MAAM;;QAENC,gBAAgB,OAAOC,WAAuB,MAAMC,SAASC,QAAQ;UAACF,OAAOG;SAAO;MACtF;IACF,CAAA;EACJ,CAAA;EACAnC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAakC,aAAaC;IAC1BhC,UAAU,MAAM;MACdK,YAAY4B,mBAAmBC,cAAc;QAACC;OAAa;MAC3D9B,YAAY4B,mBAAmBG,QAAQ;QAACzB;OAAW;;EAEvD,CAAA;EACAhB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOuC;IACpBrC,UAAUsC;EACZ,CAAA;EACA3C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOyC;IACpBvC,UAAUwC;EACZ,CAAA;EACA7C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOI;IACpBF,UAAUyC;EACZ,CAAA;CACD;",
6
+ "names": ["lazy", "Compiler", "lazy", "IntentResolver", "ReactSurface", "ScriptSettings", "Artifact", "Capabilities", "contributes", "createIntent", "defineModule", "definePlugin", "Events", "FunctionType", "ScriptType", "RefArray", "ClientCapabilities", "ClientEvents", "ScriptType", "ScriptType", "typename", "SCRIPT_PLUGIN", "ScriptPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupSettings", "activate", "ScriptSettings", "Startup", "Compiler", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "ScriptType", "typename", "metadata", "creationSchema", "ScriptAction", "CreateScriptSchema", "createObject", "props", "space", "createIntent", "Create", "placeholder", "ns", "SCRIPT_PLUGIN", "icon", "loadReferences", "script", "RefArray", "loadAll", "source", "ClientEvents", "SetupSchema", "ClientCapabilities", "SystemSchema", "FunctionType", "Schema", "SetupSurfaces", "ReactSurface", "SetupIntents", "IntentResolver", "Artifact"]
7
7
  }