@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.
- package/dist/lib/browser/{ScriptContainer-LGW52UAJ.mjs → ScriptContainer-QI4NQT7V.mjs} +29 -4
- package/dist/lib/browser/ScriptContainer-QI4NQT7V.mjs.map +7 -0
- package/dist/lib/browser/artifact-3UZZBCZ2.mjs +243 -0
- package/dist/lib/browser/artifact-3UZZBCZ2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2UXYECEH.mjs → chunk-F22QPQ6G.mjs} +4 -4
- package/dist/lib/browser/{chunk-2UXYECEH.mjs.map → chunk-F22QPQ6G.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +8 -2
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-XACNR5NR.mjs → react-surface-YR4YO746.mjs} +2 -2
- package/dist/lib/node/{ScriptContainer-UI2MDBYG.cjs → ScriptContainer-FSKWJR6Z.cjs} +32 -7
- package/dist/lib/node/ScriptContainer-FSKWJR6Z.cjs.map +7 -0
- package/dist/lib/node/artifact-A2QXHFGS.cjs +262 -0
- package/dist/lib/node/artifact-A2QXHFGS.cjs.map +7 -0
- package/dist/lib/node/{chunk-73345ZL6.cjs → chunk-JSANQCTA.cjs} +6 -6
- package/dist/lib/node/{chunk-73345ZL6.cjs.map → chunk-JSANQCTA.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +12 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-Y3RD5FW7.cjs → react-surface-MFTICFI5.cjs} +9 -9
- package/dist/lib/node-esm/{ScriptContainer-F7SNP53Z.mjs → ScriptContainer-MNETNTNQ.mjs} +29 -4
- package/dist/lib/node-esm/ScriptContainer-MNETNTNQ.mjs.map +7 -0
- package/dist/lib/node-esm/artifact-RFZQ2AJJ.mjs +245 -0
- package/dist/lib/node-esm/artifact-RFZQ2AJJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PRGBYF4B.mjs → chunk-FGO5DVO2.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-PRGBYF4B.mjs.map → chunk-FGO5DVO2.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +8 -2
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-PKUVZH4S.mjs → react-surface-NAK6LMCY.mjs} +2 -2
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact.d.ts +11 -0
- package/dist/types/src/capabilities/artifact.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +1 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/package.json +44 -42
- package/src/ScriptPlugin.tsx +6 -1
- package/src/capabilities/artifact.ts +219 -0
- package/src/capabilities/index.ts +1 -0
- package/src/components/ScriptSettingsPanel.tsx +2 -2
- package/src/hooks/deploy.ts +12 -1
- package/dist/lib/browser/ScriptContainer-LGW52UAJ.mjs.map +0 -7
- package/dist/lib/node/ScriptContainer-UI2MDBYG.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-F7SNP53Z.mjs.map +0 -7
- /package/dist/lib/browser/{react-surface-XACNR5NR.mjs.map → react-surface-YR4YO746.mjs.map} +0 -0
- /package/dist/lib/node/{react-surface-Y3RD5FW7.cjs.map → react-surface-MFTICFI5.cjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-PKUVZH4S.mjs.map → react-surface-NAK6LMCY.mjs.map} +0 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var artifact_A2QXHFGS_exports = {};
|
|
20
|
+
__export(artifact_A2QXHFGS_exports, {
|
|
21
|
+
default: () => artifact_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(artifact_A2QXHFGS_exports);
|
|
24
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
25
|
+
var import_artifact = require("@dxos/artifact");
|
|
26
|
+
var import_assistant = require("@dxos/assistant");
|
|
27
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
28
|
+
var import_functions = require("@dxos/functions");
|
|
29
|
+
var import_invariant = require("@dxos/invariant");
|
|
30
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
31
|
+
var import_schema = require("@dxos/schema");
|
|
32
|
+
var import_types = require("@dxos/plugin-space/types");
|
|
33
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/capabilities/artifact.ts";
|
|
34
|
+
var artifact_default = () => {
|
|
35
|
+
const definition = (0, import_artifact.defineArtifact)({
|
|
36
|
+
id: "plugin-script",
|
|
37
|
+
// TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
|
|
38
|
+
// we should offload the work of synthesizing the code to a separate model.
|
|
39
|
+
// The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
|
|
40
|
+
instructions: `
|
|
41
|
+
If the user explicitly requests you to write a script, you can create one.
|
|
42
|
+
If the user requests you to change one of the existing script, you can update it.
|
|
43
|
+
Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.
|
|
44
|
+
Each script must follow as strict shape for the definition but the body can contain any valid executable code.
|
|
45
|
+
Scripts are written in JavaScript or TypeScript.
|
|
46
|
+
Each script must define an input schema and output schema.
|
|
47
|
+
Each script must have its own detailed description.
|
|
48
|
+
|
|
49
|
+
Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.
|
|
50
|
+
|
|
51
|
+
Description:
|
|
52
|
+
The description is a detailed description of the script.
|
|
53
|
+
It is used to describe the script's purpose, input, and output.
|
|
54
|
+
The description is used to generate the script's documentation.
|
|
55
|
+
The description is also goes into the script metadata.
|
|
56
|
+
The description is used by AI to understand the script and its purpose.
|
|
57
|
+
The description must provide cases on when the script should be used.
|
|
58
|
+
|
|
59
|
+
Schema:
|
|
60
|
+
The schema is defined using a schema-DSL library called Effect Schema.
|
|
61
|
+
The input schema describes the arguments that the script accepts.
|
|
62
|
+
The output schema describes the result that the script produces.
|
|
63
|
+
The schema is used to validate the script's input and output.
|
|
64
|
+
The schema is also goes into the script metadata.
|
|
65
|
+
The properties in the schema must have valid descriptions.
|
|
66
|
+
The input and output schemas must both be a struct of fields.
|
|
67
|
+
|
|
68
|
+
Restricts:
|
|
69
|
+
The scripts can only import code from "dxos:functions" module. No other modules are allowed.
|
|
70
|
+
Some web APIs are available - like fetch.
|
|
71
|
+
|
|
72
|
+
Reasoning:
|
|
73
|
+
Before writing a script, synthesize the following information:
|
|
74
|
+
- Description
|
|
75
|
+
- What APIs will be used.
|
|
76
|
+
- Detailed input schema
|
|
77
|
+
- Detailed output schema
|
|
78
|
+
|
|
79
|
+
<apis>
|
|
80
|
+
export function defineFunction(params: {
|
|
81
|
+
description: string,
|
|
82
|
+
inputSchema: S.Schema,
|
|
83
|
+
outputSchema: S.Schema,
|
|
84
|
+
handler: (params: { event: { data: TInput } }) => Promise<TOutput>
|
|
85
|
+
}): FunctionDefinition
|
|
86
|
+
/**
|
|
87
|
+
* Effect Schema
|
|
88
|
+
*/
|
|
89
|
+
export const S;
|
|
90
|
+
|
|
91
|
+
// Examples:
|
|
92
|
+
|
|
93
|
+
S.String
|
|
94
|
+
S.Number
|
|
95
|
+
S.Boolean
|
|
96
|
+
S.Struct({
|
|
97
|
+
from: S.String.annotations({ description: 'The source currency' }),
|
|
98
|
+
to: S.String.annotations({ description: 'The target currency' }),
|
|
99
|
+
})
|
|
100
|
+
S.Array(S.String)
|
|
101
|
+
S.Union(S.String, S.Number)
|
|
102
|
+
S.Optional(S.String)
|
|
103
|
+
S.String.annotations({ description: 'The source currency' })
|
|
104
|
+
</apis>
|
|
105
|
+
|
|
106
|
+
<handler_function>
|
|
107
|
+
Async function that takes the argument in the form of:
|
|
108
|
+
|
|
109
|
+
type HandlerFunctionParam = {
|
|
110
|
+
event: {
|
|
111
|
+
data: T // The input schema
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
The function must return the result that matches the output schema.
|
|
116
|
+
</handler_function>
|
|
117
|
+
|
|
118
|
+
<example>
|
|
119
|
+
import { defineFunction, S } from 'dxos:functions';
|
|
120
|
+
|
|
121
|
+
export default defineFunction({
|
|
122
|
+
description: 'Returns the exchange rate between two currencies.',
|
|
123
|
+
|
|
124
|
+
inputSchema: S.Struct({
|
|
125
|
+
from: S.String.annotations({ description: 'The source currency' }),
|
|
126
|
+
to: S.String.annotations({ description: 'The target currency' }),
|
|
127
|
+
}),
|
|
128
|
+
|
|
129
|
+
outputSchema: S.Struct({
|
|
130
|
+
rate: S.String.annotations({ description: 'The exchange rate' }),
|
|
131
|
+
}),
|
|
132
|
+
|
|
133
|
+
handler: async ({
|
|
134
|
+
event: {
|
|
135
|
+
data: { from, to },
|
|
136
|
+
},
|
|
137
|
+
}: any) => {
|
|
138
|
+
const res = await fetch(\`https://free.ratesdb.com/v1/rates?from=\${from}&to=\${to}\`);
|
|
139
|
+
const {
|
|
140
|
+
data: { rates },
|
|
141
|
+
} = await res.json();
|
|
142
|
+
|
|
143
|
+
return { rate: rates[to].toString() };
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
</example>
|
|
147
|
+
`,
|
|
148
|
+
schema: import_functions.ScriptType,
|
|
149
|
+
tools: [
|
|
150
|
+
(0, import_artifact.defineTool)({
|
|
151
|
+
name: "script_new",
|
|
152
|
+
description: "Create a new script. Returns the artifact definition for the script",
|
|
153
|
+
schema: import_echo_schema.S.Struct({
|
|
154
|
+
name: import_echo_schema.S.String.annotations({
|
|
155
|
+
description: "The name of the script"
|
|
156
|
+
}),
|
|
157
|
+
code: import_echo_schema.S.String.annotations({
|
|
158
|
+
description: "The full code of the script in JavaScript or TypeScript. Must be valid executable code."
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
execute: async ({ name, code }, { extensions }) => {
|
|
162
|
+
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
163
|
+
F: __dxlog_file,
|
|
164
|
+
L: 149,
|
|
165
|
+
S: void 0,
|
|
166
|
+
A: [
|
|
167
|
+
"extensions?.space",
|
|
168
|
+
"'No space'"
|
|
169
|
+
]
|
|
170
|
+
});
|
|
171
|
+
(0, import_invariant.invariant)(extensions?.dispatch, "No intent dispatcher", {
|
|
172
|
+
F: __dxlog_file,
|
|
173
|
+
L: 150,
|
|
174
|
+
S: void 0,
|
|
175
|
+
A: [
|
|
176
|
+
"extensions?.dispatch",
|
|
177
|
+
"'No intent dispatcher'"
|
|
178
|
+
]
|
|
179
|
+
});
|
|
180
|
+
const script = (0, import_echo.create)(import_functions.ScriptType, {
|
|
181
|
+
name,
|
|
182
|
+
source: (0, import_echo.makeRef)((0, import_echo.create)(import_schema.TextType, {
|
|
183
|
+
content: code
|
|
184
|
+
}))
|
|
185
|
+
});
|
|
186
|
+
extensions.space.db.add(script);
|
|
187
|
+
await extensions.space.db.flush();
|
|
188
|
+
const intent = (0, import_app_framework.createIntent)(import_types.SpaceAction.AddObject, {
|
|
189
|
+
target: extensions.space,
|
|
190
|
+
object: script
|
|
191
|
+
});
|
|
192
|
+
const { data, error } = await extensions.dispatch(intent);
|
|
193
|
+
if (!data || error) {
|
|
194
|
+
return import_artifact.ToolResult.Error(error?.message ?? "Failed to create chess game");
|
|
195
|
+
}
|
|
196
|
+
return import_artifact.ToolResult.Success((0, import_assistant.createArtifactElement)(script.id));
|
|
197
|
+
}
|
|
198
|
+
}),
|
|
199
|
+
(0, import_artifact.defineTool)({
|
|
200
|
+
name: "script_inspect",
|
|
201
|
+
description: "Inspect a script. Returns the artifact definition for the script",
|
|
202
|
+
schema: import_echo_schema.S.Struct({
|
|
203
|
+
id: import_echo_schema.ObjectId
|
|
204
|
+
}),
|
|
205
|
+
execute: async ({ id }, { extensions }) => {
|
|
206
|
+
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
207
|
+
F: __dxlog_file,
|
|
208
|
+
L: 178,
|
|
209
|
+
S: void 0,
|
|
210
|
+
A: [
|
|
211
|
+
"extensions?.space",
|
|
212
|
+
"'No space'"
|
|
213
|
+
]
|
|
214
|
+
});
|
|
215
|
+
const script = await extensions.space.db.query({
|
|
216
|
+
id
|
|
217
|
+
}).first();
|
|
218
|
+
const { content } = await script.source.load();
|
|
219
|
+
return import_artifact.ToolResult.Success({
|
|
220
|
+
name: script.name,
|
|
221
|
+
code: content
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}),
|
|
225
|
+
(0, import_artifact.defineTool)({
|
|
226
|
+
name: "script_update",
|
|
227
|
+
description: "Update a script. Returns the artifact definition for the script",
|
|
228
|
+
schema: import_echo_schema.S.Struct({
|
|
229
|
+
id: import_echo_schema.ObjectId,
|
|
230
|
+
code: import_echo_schema.S.String.annotations({
|
|
231
|
+
description: "The full code of the script in JavaScript or TypeScript. Must be valid executable code."
|
|
232
|
+
})
|
|
233
|
+
}),
|
|
234
|
+
execute: async ({ id, code }, { extensions }) => {
|
|
235
|
+
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
236
|
+
F: __dxlog_file,
|
|
237
|
+
L: 199,
|
|
238
|
+
S: void 0,
|
|
239
|
+
A: [
|
|
240
|
+
"extensions?.space",
|
|
241
|
+
"'No space'"
|
|
242
|
+
]
|
|
243
|
+
});
|
|
244
|
+
const script = await extensions.space.db.query({
|
|
245
|
+
id
|
|
246
|
+
}).first();
|
|
247
|
+
const source = await script.source.load();
|
|
248
|
+
if (!source) {
|
|
249
|
+
return import_artifact.ToolResult.Error("Script not found");
|
|
250
|
+
}
|
|
251
|
+
source.content = code;
|
|
252
|
+
await extensions.space?.db.flush();
|
|
253
|
+
return import_artifact.ToolResult.Success({
|
|
254
|
+
name: script.name
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
]
|
|
259
|
+
});
|
|
260
|
+
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.ArtifactDefinition, definition);
|
|
261
|
+
};
|
|
262
|
+
//# sourceMappingURL=artifact-A2QXHFGS.cjs.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,2BAAsF;AACtF,sBAAuD;AACvD,uBAAsC;AACtC,yBAA4B;AAC5B,uBAA2B;AAC3B,uBAA0B;AAC1B,kBAA4C;AAC5C,oBAAyB;AACzB,mBAA4B;;AAU5B,IAAA,mBAAe,MAAA;AACb,QAAMA,iBAAaC,gCAAe;IAChCC,IAAI;;;;IAIJC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4GdC,QAAQC;IACRC,OAAO;UACLC,4BAAW;QACTC,MAAM;QACNC,aAAa;QACbL,QAAQM,qBAAEC,OAAO;UACfH,MAAME,qBAAEE,OAAOC,YAAY;YAAEJ,aAAa;UAAyB,CAAA;UACnEK,MAAMJ,qBAAEE,OAAOC,YAAY;YACzBJ,aAAa;UACf,CAAA;QACF,CAAA;QACAM,SAAS,OAAO,EAAEP,MAAMM,KAAI,GAAI,EAAEE,WAAU,MAAE;AAC5CC,0CAAUD,YAAYE,OAAO,YAAA;;;;;;;;;AAC7BD,0CAAUD,YAAYG,UAAU,wBAAA;;;;;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AYE,OAAO,YAAA;;;;;;;;;AAE7B,gBAAME,SAAU,MAAMJ,WAAWE,MAAMQ,GAAGiB,MAAM;YAAEzC;UAAG,CAAA,EAAG0C,MAAK;AAC7D,gBAAMtB,SAAS,MAAMF,OAAOE,OAAOuB,KAAI;AACvC,cAAI,CAACvB,QAAQ;AACX,mBAAOe,2BAAWC,MAAM,kBAAA;UAC1B;AAEAhB,iBAAOG,UAAUX;AACjB,gBAAME,WAAWE,OAAOQ,GAAGE,MAAAA;AAE3B,iBAAOS,2BAAWG,QAAQ;YACxBhC,MAAMY,OAAOZ;UACf,CAAA;QACF;MACF,CAAA;;EAEJ,CAAA;AAEA,aAAOsC,kCAAYC,kCAAaC,oBAAoBhD,UAAAA;AACtD;",
|
|
6
|
+
"names": ["definition", "defineArtifact", "id", "instructions", "schema", "ScriptType", "tools", "defineTool", "name", "description", "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,14 +26,14 @@ 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_JSANQCTA_exports = {};
|
|
30
|
+
__export(chunk_JSANQCTA_exports, {
|
|
31
31
|
AutomationPanel: () => AutomationPanel,
|
|
32
32
|
ScriptContainer: () => ScriptContainer,
|
|
33
33
|
ScriptSettings: () => ScriptSettings,
|
|
34
34
|
ScriptSettingsPanel: () => ScriptSettingsPanel
|
|
35
35
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
36
|
+
module.exports = __toCommonJS(chunk_JSANQCTA_exports);
|
|
37
37
|
var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
|
|
38
38
|
var import_react = __toESM(require("react"));
|
|
39
39
|
var import_react_client = require("@dxos/react-client");
|
|
@@ -138,7 +138,7 @@ var ScriptSettingsPanel = ({ script }) => {
|
|
|
138
138
|
githubToken,
|
|
139
139
|
gistKey
|
|
140
140
|
]);
|
|
141
|
-
const [binding, setBinding] = (0, import_react_ui2.
|
|
141
|
+
const [binding, setBinding] = (0, import_react_ui2.useControlledState)(fn?.binding ?? "");
|
|
142
142
|
const handleBindingChange = (0, import_react2.useCallback)((event) => {
|
|
143
143
|
setBinding(event.target.value);
|
|
144
144
|
}, [
|
|
@@ -253,7 +253,7 @@ var ScriptSettingsPanel = ({ script }) => {
|
|
|
253
253
|
}, t(publishing ? "publishing label" : "publish label")))));
|
|
254
254
|
};
|
|
255
255
|
var AutomationPanel = (0, import_react3.lazy)(() => import("./AutomationPanel-4M55FURO.cjs"));
|
|
256
|
-
var ScriptContainer = (0, import_react3.lazy)(() => import("./ScriptContainer-
|
|
256
|
+
var ScriptContainer = (0, import_react3.lazy)(() => import("./ScriptContainer-FSKWJR6Z.cjs"));
|
|
257
257
|
// Annotate the CommonJS export names for ESM import in node:
|
|
258
258
|
0 && (module.exports = {
|
|
259
259
|
AutomationPanel,
|
|
@@ -261,4 +261,4 @@ var ScriptContainer = (0, import_react3.lazy)(() => import("./ScriptContainer-UI
|
|
|
261
261
|
ScriptSettings,
|
|
262
262
|
ScriptSettingsPanel
|
|
263
263
|
});
|
|
264
|
-
//# sourceMappingURL=chunk-
|
|
264
|
+
//# sourceMappingURL=chunk-JSANQCTA.cjs.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,
|
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAGlB,0BAA0B;AAC1B,sB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CAAA,CAAA,GAG/C4D,eACCxC,8BAAAA,QAAA,cAACuG,OAAAA;IAAIE,WAAU;KACZ3D,WAAW9C,8BAAAA,QAAA,cAACkH,2BAAUC,YAAU;IAAC3G,OAAOsC;MACzC9C,8BAAAA,QAAA,cAACI,iBAAAA,QAAAA;IAAO6G,UAAUtB;IAAYtF,SAASwF;KACpCjH,EAAE+G,aAAa,qBAAqB,eAAA,CAAA,CAAA,CAAA,CAAA;AAOnD;AClLO,IAAM4B,sBAAkBC,oBAAK,MAAM,OAAO,gCAAA,CAAA;AAC1C,IAAMC,sBAAkBD,oBAAK,MAAM,OAAO,gCAAA,CAAA;",
|
|
6
|
-
"names": ["import_react", "import_react_client", "import_react_ui", "ScriptSettings", "settings", "t", "useTranslation", "SCRIPT_PLUGIN", "client", "useClient", "handleAuthenticate", "identityKey", "halo", "identity", "get", "writeCredentials", "issuer", "issuanceDate", "Date", "subject", "id", "assertion", "serverName", "serverKey", "capabilities", "React", "DeprecatedFormContainer", "DeprecatedFormInput", "label", "Button", "onClick", "Select", "Root", "value", "editorInputMode", "onValueChange", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "EditorInputModes", "map", "mode", "Option", "key", "kebabize", "str", "replace", "$", "ofs", "toLowerCase", "ScriptSettingsPanel", "script", "dispatchPromise", "dispatch", "useIntentDispatcher", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "source", "githubToken", "AccessTokenType", "gistKey", "getMeta", "keys", "find", "gistUrl", "setGistUrl", "useState", "useEffect", "token", "gistId", "undefined", "timeout", "setTimeout", "octokit", "Octokit", "auth", "response", "request", "gist_id", "data", "html_url", "err", "log", "catch", "clearTimeout", "binding", "setBinding", "
|
|
6
|
+
"names": ["import_react", "import_react_client", "import_react_ui", "ScriptSettings", "settings", "t", "useTranslation", "SCRIPT_PLUGIN", "client", "useClient", "handleAuthenticate", "identityKey", "halo", "identity", "get", "writeCredentials", "issuer", "issuanceDate", "Date", "subject", "id", "assertion", "serverName", "serverKey", "capabilities", "React", "DeprecatedFormContainer", "DeprecatedFormInput", "label", "Button", "onClick", "Select", "Root", "value", "editorInputMode", "onValueChange", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "EditorInputModes", "map", "mode", "Option", "key", "kebabize", "str", "replace", "$", "ofs", "toLowerCase", "ScriptSettingsPanel", "script", "dispatchPromise", "dispatch", "useIntentDispatcher", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "source", "githubToken", "AccessTokenType", "gistKey", "getMeta", "keys", "find", "gistUrl", "setGistUrl", "useState", "useEffect", "token", "gistId", "undefined", "timeout", "setTimeout", "octokit", "Octokit", "auth", "response", "request", "gist_id", "data", "html_url", "err", "log", "catch", "clearTimeout", "binding", "setBinding", "useControlledState", "handleBindingChange", "useCallback", "event", "target", "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", "div", "role", "className", "Input", "Label", "TextInput", "description", "onChange", "Separator", "h2", "disabled", "Clipboard", "IconButton", "onBlur", "p", "span", "AutomationPanel", "lazy", "ScriptContainer"]
|
|
7
7
|
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,20 +28,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
-
AutomationPanel: () =>
|
|
31
|
+
AutomationPanel: () => import_chunk_JSANQCTA.AutomationPanel,
|
|
32
32
|
Bundler: () => import_chunk_T4TXCRN5.Bundler,
|
|
33
33
|
SCRIPT_PLUGIN: () => import_chunk_5UH3F7TA.SCRIPT_PLUGIN,
|
|
34
34
|
ScriptCapabilities: () => import_chunk_ALY3N6PW.ScriptCapabilities,
|
|
35
|
-
ScriptContainer: () =>
|
|
35
|
+
ScriptContainer: () => import_chunk_JSANQCTA.ScriptContainer,
|
|
36
36
|
ScriptPlugin: () => ScriptPlugin,
|
|
37
|
-
ScriptSettings: () =>
|
|
38
|
-
ScriptSettingsPanel: () =>
|
|
37
|
+
ScriptSettings: () => import_chunk_JSANQCTA.ScriptSettings,
|
|
38
|
+
ScriptSettingsPanel: () => import_chunk_JSANQCTA.ScriptSettingsPanel,
|
|
39
39
|
initializeBundler: () => import_chunk_T4TXCRN5.initializeBundler,
|
|
40
40
|
meta: () => import_chunk_5UH3F7TA.meta
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(node_exports);
|
|
43
43
|
var import_chunk_T4TXCRN5 = require("./chunk-T4TXCRN5.cjs");
|
|
44
|
-
var
|
|
44
|
+
var import_chunk_JSANQCTA = require("./chunk-JSANQCTA.cjs");
|
|
45
45
|
var import_chunk_ALY3N6PW = require("./chunk-ALY3N6PW.cjs");
|
|
46
46
|
var import_chunk_DJGLGRQV = require("./chunk-DJGLGRQV.cjs");
|
|
47
47
|
var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
|
|
@@ -53,8 +53,9 @@ var import_plugin_client = require("@dxos/plugin-client");
|
|
|
53
53
|
var import_functions2 = require("@dxos/functions");
|
|
54
54
|
var Compiler = (0, import_app_framework.lazy)(() => import("./compiler-P2HQB22H.cjs"));
|
|
55
55
|
var IntentResolver = (0, import_app_framework.lazy)(() => import("./intent-resolver-V5ASU5DW.cjs"));
|
|
56
|
-
var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-
|
|
56
|
+
var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-MFTICFI5.cjs"));
|
|
57
57
|
var ScriptSettings2 = (0, import_app_framework.lazy)(() => import("./settings-SZFSMSKM.cjs"));
|
|
58
|
+
var Artifact = (0, import_app_framework.lazy)(() => import("./artifact-A2QXHFGS.cjs"));
|
|
58
59
|
var translations_default = [
|
|
59
60
|
{
|
|
60
61
|
"en-US": {
|
|
@@ -165,6 +166,11 @@ var ScriptPlugin = () => (0, import_app_framework2.definePlugin)(import_chunk_5U
|
|
|
165
166
|
id: `${import_chunk_5UH3F7TA.meta.id}/module/intent-resolver`,
|
|
166
167
|
activatesOn: import_app_framework2.Events.SetupIntents,
|
|
167
168
|
activate: IntentResolver
|
|
169
|
+
}),
|
|
170
|
+
(0, import_app_framework2.defineModule)({
|
|
171
|
+
id: `${import_chunk_5UH3F7TA.meta.id}/module/artifact`,
|
|
172
|
+
activatesOn: import_app_framework2.Events.Startup,
|
|
173
|
+
activate: Artifact
|
|
168
174
|
})
|
|
169
175
|
]);
|
|
170
176
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -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,2BAAqB;ACErB,IAAAA,wBAA4F;AAE5F,uBAAyC;AACzC,yBAAyB;AACzB,2BAAiD;ACNjD,IAAAC,oBAA2B;AFEpB,IAAMC,eAAWC,2BAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,qBAAiBD,2BAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,mBAAeF,2BAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMG,sBAAiBH,2BAAK,MAAM,OAAO,yBAAA,CAAA;
|
|
6
|
-
"names": ["import_app_framework", "import_functions", "Compiler", "lazy", "IntentResolver", "ReactSurface", "ScriptSettings", "ScriptType", "typename", "SCRIPT_PLUGIN", "ScriptPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupSettings", "activate", "Startup", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "metadata", "creationSchema", "ScriptAction", "CreateScriptSchema", "createObject", "props", "space", "createIntent", "Create", "placeholder", "ns", "icon", "loadReferences", "script", "RefArray", "loadAll", "source", "ClientEvents", "SetupSchema", "ClientCapabilities", "SystemSchema", "FunctionType", "Schema", "SetupSurfaces", "SetupIntents"]
|
|
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,2BAAqB;ACErB,IAAAA,wBAA4F;AAE5F,uBAAyC;AACzC,yBAAyB;AACzB,2BAAiD;ACNjD,IAAAC,oBAA2B;AFEpB,IAAMC,eAAWC,2BAAK,MAAM,OAAO,yBAAA,CAAA;AACnC,IAAMC,qBAAiBD,2BAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,mBAAeF,2BAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMG,sBAAiBH,2BAAK,MAAM,OAAO,yBAAA,CAAA;AACzC,IAAMI,eAAWJ,2BAAK,MAAM,OAAO,yBAAA,CAAA;AEF1C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACK,6BAAWC,QAAQ,GAAG;QACrB,kBAAkB;MACpB;MACA,CAACC,mCAAAA,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,uCA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BAAAA;OAAW;;EAEvD,CAAA;MACAM,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOkC;IACpBhC,UAAUd;EACZ,CAAA;MACAS,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOmC;IACpBjC,UAAUf;EACZ,CAAA;MACAU,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaC,6BAAOG;IACpBD,UAAUZ;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["import_app_framework", "import_functions", "Compiler", "lazy", "IntentResolver", "ReactSurface", "ScriptSettings", "Artifact", "ScriptType", "typename", "SCRIPT_PLUGIN", "ScriptPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupSettings", "activate", "Startup", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "metadata", "creationSchema", "ScriptAction", "CreateScriptSchema", "createObject", "props", "space", "createIntent", "Create", "placeholder", "ns", "icon", "loadReferences", "script", "RefArray", "loadAll", "source", "ClientEvents", "SetupSchema", "ClientCapabilities", "SystemSchema", "FunctionType", "Schema", "SetupSurfaces", "SetupIntents"]
|
|
7
7
|
}
|