@dxos/plugin-script 0.8.1-main.303c73a → 0.8.1-main.a06ad20

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-QGF55ZZJ.mjs → ScriptContainer-P7SZ65VN.mjs} +3 -3
  2. package/dist/lib/browser/{chunk-LYOFJ3FM.mjs → chunk-4FWN55UF.mjs} +3 -3
  3. package/dist/lib/browser/chunk-4FWN55UF.mjs.map +7 -0
  4. package/dist/lib/browser/{chunk-THELDT6E.mjs → chunk-6P4LZSOU.mjs} +2 -2
  5. package/dist/lib/browser/{chunk-35UHX7XH.mjs → chunk-NJTRYUO3.mjs} +2 -2
  6. package/dist/lib/browser/index.mjs +5 -5
  7. package/dist/lib/browser/{intent-resolver-NWAKTBZC.mjs → intent-resolver-5BRHMSBN.mjs} +2 -2
  8. package/dist/lib/browser/meta.json +1 -1
  9. package/dist/lib/browser/{react-surface-6CYOO66B.mjs → react-surface-ZLM32TTL.mjs} +4 -4
  10. package/dist/lib/node/{ScriptContainer-XSYHQ4MZ.cjs → ScriptContainer-2LYA3N3F.cjs} +14 -14
  11. package/dist/lib/node/{chunk-QYIAUPWY.cjs → chunk-I57SKIAA.cjs} +6 -6
  12. package/dist/lib/node/chunk-I57SKIAA.cjs.map +7 -0
  13. package/dist/lib/node/{chunk-RGHRAT2U.cjs → chunk-M2DJ5RXU.cjs} +5 -5
  14. package/dist/lib/node/{chunk-DA6RBNFV.cjs → chunk-OSRFLW5T.cjs} +7 -7
  15. package/dist/lib/node/index.cjs +10 -10
  16. package/dist/lib/node/{intent-resolver-WZVIHKA7.cjs → intent-resolver-L4WJAAV3.cjs} +6 -6
  17. package/dist/lib/node/meta.json +1 -1
  18. package/dist/lib/node/{react-surface-I7V6DSYF.cjs → react-surface-TQ4OKBUS.cjs} +13 -13
  19. package/dist/lib/node-esm/{ScriptContainer-5OTO5SJM.mjs → ScriptContainer-OYGIGGMK.mjs} +3 -3
  20. package/dist/lib/node-esm/{chunk-YSOCSUGC.mjs → chunk-HZPDX247.mjs} +2 -2
  21. package/dist/lib/node-esm/{chunk-2D6G2Y2O.mjs → chunk-J5LF4LOZ.mjs} +3 -3
  22. package/dist/lib/node-esm/chunk-J5LF4LOZ.mjs.map +7 -0
  23. package/dist/lib/node-esm/{chunk-34AL6Y3D.mjs → chunk-YDYGIELP.mjs} +2 -2
  24. package/dist/lib/node-esm/index.mjs +5 -5
  25. package/dist/lib/node-esm/{intent-resolver-E4EOZUBH.mjs → intent-resolver-HFXJQI5Y.mjs} +2 -2
  26. package/dist/lib/node-esm/meta.json +1 -1
  27. package/dist/lib/node-esm/{react-surface-FQ4K7UST.mjs → react-surface-3NCY6ISW.mjs} +4 -4
  28. package/package.json +47 -47
  29. package/src/templates/discord.ts +3 -3
  30. package/src/templates/forex-effect.ts +2 -2
  31. package/dist/lib/browser/chunk-LYOFJ3FM.mjs.map +0 -7
  32. package/dist/lib/node/chunk-QYIAUPWY.cjs.map +0 -7
  33. package/dist/lib/node-esm/chunk-2D6G2Y2O.mjs.map +0 -7
  34. /package/dist/lib/browser/{ScriptContainer-QGF55ZZJ.mjs.map → ScriptContainer-P7SZ65VN.mjs.map} +0 -0
  35. /package/dist/lib/browser/{chunk-THELDT6E.mjs.map → chunk-6P4LZSOU.mjs.map} +0 -0
  36. /package/dist/lib/browser/{chunk-35UHX7XH.mjs.map → chunk-NJTRYUO3.mjs.map} +0 -0
  37. /package/dist/lib/browser/{intent-resolver-NWAKTBZC.mjs.map → intent-resolver-5BRHMSBN.mjs.map} +0 -0
  38. /package/dist/lib/browser/{react-surface-6CYOO66B.mjs.map → react-surface-ZLM32TTL.mjs.map} +0 -0
  39. /package/dist/lib/node/{ScriptContainer-XSYHQ4MZ.cjs.map → ScriptContainer-2LYA3N3F.cjs.map} +0 -0
  40. /package/dist/lib/node/{chunk-RGHRAT2U.cjs.map → chunk-M2DJ5RXU.cjs.map} +0 -0
  41. /package/dist/lib/node/{chunk-DA6RBNFV.cjs.map → chunk-OSRFLW5T.cjs.map} +0 -0
  42. /package/dist/lib/node/{intent-resolver-WZVIHKA7.cjs.map → intent-resolver-L4WJAAV3.cjs.map} +0 -0
  43. /package/dist/lib/node/{react-surface-I7V6DSYF.cjs.map → react-surface-TQ4OKBUS.cjs.map} +0 -0
  44. /package/dist/lib/node-esm/{ScriptContainer-5OTO5SJM.mjs.map → ScriptContainer-OYGIGGMK.mjs.map} +0 -0
  45. /package/dist/lib/node-esm/{chunk-YSOCSUGC.mjs.map → chunk-HZPDX247.mjs.map} +0 -0
  46. /package/dist/lib/node-esm/{chunk-34AL6Y3D.mjs.map → chunk-YDYGIELP.mjs.map} +0 -0
  47. /package/dist/lib/node-esm/{intent-resolver-E4EOZUBH.mjs.map → intent-resolver-HFXJQI5Y.mjs.map} +0 -0
  48. /package/dist/lib/node-esm/{react-surface-FQ4K7UST.mjs.map → react-surface-3NCY6ISW.mjs.map} +0 -0
@@ -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 ScriptContainer_XSYHQ4MZ_exports = {};
30
- __export(ScriptContainer_XSYHQ4MZ_exports, {
29
+ var ScriptContainer_2LYA3N3F_exports = {};
30
+ __export(ScriptContainer_2LYA3N3F_exports, {
31
31
  ScriptContainer: () => ScriptContainer,
32
32
  default: () => ScriptContainer_default
33
33
  });
34
- module.exports = __toCommonJS(ScriptContainer_XSYHQ4MZ_exports);
35
- var import_chunk_DA6RBNFV = require("./chunk-DA6RBNFV.cjs");
36
- var import_chunk_QYIAUPWY = require("./chunk-QYIAUPWY.cjs");
34
+ module.exports = __toCommonJS(ScriptContainer_2LYA3N3F_exports);
35
+ var import_chunk_OSRFLW5T = require("./chunk-OSRFLW5T.cjs");
36
+ var import_chunk_I57SKIAA = require("./chunk-I57SKIAA.cjs");
37
37
  var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
38
38
  var import_react = __toESM(require("react"));
39
39
  var import_echo = require("@dxos/react-client/echo");
@@ -59,11 +59,11 @@ var import_react_ui2 = require("@dxos/react-ui");
59
59
  var import_react_ui_editor3 = require("@dxos/react-ui-editor");
60
60
  var import_util = require("@dxos/util");
61
61
  var createToolbar = (state) => {
62
- const templateSelect = (0, import_chunk_DA6RBNFV.createTemplateSelect)();
63
- const format = (0, import_chunk_DA6RBNFV.createFormat)();
62
+ const templateSelect = (0, import_chunk_OSRFLW5T.createTemplateSelect)();
63
+ const format = (0, import_chunk_OSRFLW5T.createFormat)();
64
64
  const gap = (0, import_react_ui_menu.createGapSeparator)();
65
- const deploy = (0, import_chunk_DA6RBNFV.createDeploy)(state);
66
- const view = (0, import_chunk_DA6RBNFV.createView)(state);
65
+ const deploy = (0, import_chunk_OSRFLW5T.createDeploy)(state);
66
+ const view = (0, import_chunk_OSRFLW5T.createView)(state);
67
67
  return {
68
68
  nodes: [
69
69
  ...templateSelect.nodes,
@@ -82,7 +82,7 @@ var createToolbar = (state) => {
82
82
  };
83
83
  };
84
84
  var ScriptToolbar = ({ script, role, state, classNames }) => {
85
- const handleAction = (0, import_chunk_DA6RBNFV.useToolbarAction)({
85
+ const handleAction = (0, import_chunk_OSRFLW5T.useToolbarAction)({
86
86
  state,
87
87
  script
88
88
  });
@@ -237,10 +237,10 @@ var ScriptContainer = ({ role, classNames, script, settings = {
237
237
  space,
238
238
  identity
239
239
  ]);
240
- const state = (0, import_chunk_DA6RBNFV.useToolbarState)({
240
+ const state = (0, import_chunk_OSRFLW5T.useToolbarState)({
241
241
  view: "editor"
242
242
  });
243
- (0, import_chunk_DA6RBNFV.useDeployState)({
243
+ (0, import_chunk_OSRFLW5T.useDeployState)({
244
244
  state,
245
245
  script
246
246
  });
@@ -264,7 +264,7 @@ var ScriptContainer = ({ role, classNames, script, settings = {
264
264
  className: (0, import_react_ui_theme.mx)((0, import_react_ui_editor.stackItemContentEditorClassNames)(role), "grow"),
265
265
  inputMode: settings.editorInputMode,
266
266
  toolbar: true
267
- }), state.view !== "editor" && /* @__PURE__ */ import_react.default.createElement(import_chunk_DA6RBNFV.LogsPanel, {
267
+ }), state.view !== "editor" && /* @__PURE__ */ import_react.default.createElement(import_chunk_OSRFLW5T.LogsPanel, {
268
268
  script,
269
269
  classNames: "grow"
270
270
  })));
@@ -274,4 +274,4 @@ var ScriptContainer_default = ScriptContainer;
274
274
  0 && (module.exports = {
275
275
  ScriptContainer
276
276
  });
277
- //# sourceMappingURL=ScriptContainer-XSYHQ4MZ.cjs.map
277
+ //# sourceMappingURL=ScriptContainer-2LYA3N3F.cjs.map
@@ -16,17 +16,17 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_QYIAUPWY_exports = {};
20
- __export(chunk_QYIAUPWY_exports, {
19
+ var chunk_I57SKIAA_exports = {};
20
+ __export(chunk_I57SKIAA_exports, {
21
21
  templates: () => templates
22
22
  });
23
- module.exports = __toCommonJS(chunk_QYIAUPWY_exports);
23
+ module.exports = __toCommonJS(chunk_I57SKIAA_exports);
24
24
  var chat_default = "//\n// Copyright 2024 DXOS.org\n//\n\n// @ts-ignore\nimport { transformServerSentEvents } from 'https://esm.sh/@dxos/script-toolbox';\n\n/**\n * Chatbot that answers questions based on the context data.\n */\nexport default async ({\n event: {\n data: { request },\n },\n context: { space, ai },\n}: any) => {\n const textBody = await request.text();\n let parsedRequest: any;\n try {\n parsedRequest = JSON.parse(textBody);\n } catch (err) {\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: true,\n prompt: `\n Using only the context data below to answer the user's question.\n If you cannot answer the question from the provided content, then reply with \"I don't know.\"\n\n CONTEXT:\n ${await getContext({ space })}\n\n QUESTION:\n ${textBody}\n `,\n });\n return new Response(transformServerSentEvents(answer));\n }\n\n const promptId = parsedRequest.trigger.promptId;\n const promptObject = await space.crud.query({ id: promptId }).first();\n\n if (parsedRequest.data.objects.length !== 1) {\n return new Response('Message batches not supported.');\n }\n\n const messageId = parsedRequest.data.objects[0];\n let message;\n try {\n message = await space.crud.query({ id: messageId }).first();\n } catch (err) {\n return new Response('Message not replicated yet.', { status: 409 });\n }\n\n if (message.text.includes('--------')) {\n return new Response('Message was already processed.');\n }\n\n let prompt = promptObject.template;\n for (const input of promptObject.inputs) {\n let value: string | null = null;\n if (input.type === TemplateInputType.VALUE) {\n value = String(input.value);\n } else if (input.type === TemplateInputType.RETRIEVER) {\n value = await getContext({ space });\n } else if (input.type === TemplateInputType.PASS_THROUGH) {\n value = message.text;\n }\n if (value) {\n prompt = prompt.replaceAll(`{${input.name}}`, value);\n }\n }\n\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: false,\n prompt,\n });\n const response = { response: answer.response, prompt, message };\n const textWithAnswer = message.text + '\\n--------\\n\\n' + answer.response;\n await space.crud.update({ id: messageId }, { text: textWithAnswer });\n\n return new Response(JSON.stringify(response));\n};\n\nconst getContext = async ({ space }: any) => {\n let context = '';\n const { objects: docs } = await space.crud.query({ __typename: 'dxos.org/type/Document' }).run();\n for (const doc of docs) {\n const { content } = await space.crud.query({ id: doc.content }).first();\n context += content + '\\n\\n';\n }\n return context;\n};\n\nenum TemplateInputType {\n VALUE = 0,\n PASS_THROUGH = 1,\n RETRIEVER = 2,\n FUNCTION = 3,\n QUERY = 4,\n RESOLVER = 5,\n CONTEXT = 6,\n SCHEMA = 7,\n}\n";
25
25
  var chess_default = "// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\n// @ts-ignore\nimport { Chess } from 'https://esm.sh/chess.js@0.13.1';\n\nexport default defineFunction({\n description: 'Plays a random move in a chess game.',\n\n inputSchema: S.Struct({\n changedObjectId: S.String.annotations({\n description: 'The objects to play the game on.',\n }),\n player: S.optional(S.Literal('w', 'b')).annotations({\n description: 'The player to play the game as.',\n }),\n }),\n\n outputSchema: S.Struct({\n state: S.String.annotations({\n description: 'The state of the game as an ASCII art board.',\n }),\n }),\n\n handler: async ({\n event: {\n data: { changedObjectId, player = 'b' },\n },\n context: { space },\n }: any) => {\n const { pgn } = await space.db.query({ id: changedObjectId }).first();\n const game = new Chess();\n game.load_pgn(pgn);\n if (game.turn() !== player) {\n return new Response('Invalid turn', { status: 409 });\n }\n\n const moves = game.moves();\n const move = moves[Math.floor(Math.random() * moves.length)];\n if (!move) {\n return new Response('No legal moves', { status: 406 });\n }\n\n game.move(move);\n const newPgn = game.pgn();\n await space.db.update({ id: changedObjectId }, { pgn: newPgn, fen: game.fen() });\n return { state: game.ascii() };\n },\n});\n";
26
- var discord_default = "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { createStatic, EchoObject, defineFunction, DXN, Filter, ObjectId, S } from 'dxos:functions';\nimport {\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.12.12';\n// @ts-ignore\nimport { DiscordConfig, DiscordREST, DiscordRESTMemoryLive } from 'https://esm.sh/dfx@0.113.0?deps=effect@3.12.12';\n// @ts-ignore\nimport { Effect, Config, Redacted, Ref } from 'https://esm.sh/effect@3.12.12';\n\nconst MessageSchema = S.Struct({\n id: S.String,\n foreignId: S.Any, // bigint?\n from: S.String,\n created: S.String,\n content: S.String,\n}).pipe(EchoObject('example.com/type/Message', '0.1.0'));\n\nconst DEFAULT_AFTER = 1704067200; // 2024-01-01\n\nconst generateSnowflake = (unixTimestamp: number): bigint => {\n const discordEpoch = 1420070400000n; // Discord Epoch (ms)\n return (BigInt(unixTimestamp * 1000) - discordEpoch) << 22n;\n};\n\nexport default defineFunction({\n inputSchema: S.Struct({\n // TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.\n tick: S.optional(S.String),\n channelId: S.String,\n after: S.optional(S.Number),\n pageSize: S.optional(S.Number),\n queueId: S.String,\n }),\n\n outputSchema: S.Struct({\n newMessages: S.Number,\n }),\n\n handler: ({\n event: {\n data: { channelId, queueId, after = DEFAULT_AFTER, pageSize = 5 },\n },\n context: { space },\n }: any) =>\n Effect.gen(function* () {\n const { token } = yield* Effect.tryPromise(() =>\n space.db.query(Filter.typename('dxos.org/type/AccessToken', { source: 'discord.com' })).first(),\n );\n const { objects } = yield* Effect.tryPromise(() => space.queues.queryQueue(DXN.parse(queueId)));\n const backfill = objects.length === 0;\n const newMessages = yield* Ref.make(0);\n const lastMessage = yield* Ref.make(objects.at(-1));\n\n const enqueueMessages = Effect.gen(function* () {\n const rest = yield* DiscordREST;\n\n while (true) {\n const last = yield* Ref.get(lastMessage);\n const options = {\n after: backfill && !last ? `${generateSnowflake(after)}` : last?.foreignId,\n limit: pageSize,\n };\n const messages = yield* rest.getChannelMessages(channelId, options).pipe((res: any) => res.json);\n const queueMessages = messages\n .map((message: any) =>\n createStatic(MessageSchema, {\n id: ObjectId.random(),\n foreignId: message.id,\n from: message.author.username,\n created: message.timestamp,\n content: message.content,\n }),\n )\n .toReversed();\n if (queueMessages.length > 0) {\n yield* Effect.tryPromise(() => space.queues.insertIntoQueue(DXN.parse(queueId), queueMessages));\n yield* Ref.update(newMessages, (n: any) => n + queueMessages.length);\n yield* Ref.update(lastMessage, (m: any) => queueMessages.at(-1));\n }\n if (messages.length < pageSize) {\n break;\n }\n }\n }).pipe(\n Effect.provide(DiscordRESTMemoryLive),\n Effect.provide(\n DiscordConfig.layerConfig({\n token: Config.succeed(Redacted.make(token)),\n }),\n ),\n Effect.provide(FetchHttpClient.layer),\n );\n\n yield* enqueueMessages;\n return { newMessages: yield* Ref.get(newMessages) };\n }),\n});\n";
26
+ var discord_default = "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { createStatic, EchoObject, defineFunction, DXN, Filter, ObjectId, S } from 'dxos:functions';\nimport {\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.13.3';\n// @ts-ignore\nimport { DiscordConfig, DiscordREST, DiscordRESTMemoryLive } from 'https://esm.sh/dfx@0.113.0?deps=effect@3.13.3';\n// @ts-ignore\nimport { Effect, Config, Redacted, Ref } from 'https://esm.sh/effect@3.13.3';\n\nconst MessageSchema = S.Struct({\n id: S.String,\n foreignId: S.Any, // bigint?\n from: S.String,\n created: S.String,\n content: S.String,\n}).pipe(EchoObject('example.com/type/Message', '0.1.0'));\n\nconst DEFAULT_AFTER = 1704067200; // 2024-01-01\n\nconst generateSnowflake = (unixTimestamp: number): bigint => {\n const discordEpoch = 1420070400000n; // Discord Epoch (ms)\n return (BigInt(unixTimestamp * 1000) - discordEpoch) << 22n;\n};\n\nexport default defineFunction({\n inputSchema: S.Struct({\n // TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.\n tick: S.optional(S.String),\n channelId: S.String,\n after: S.optional(S.Number),\n pageSize: S.optional(S.Number),\n queueId: S.String,\n }),\n\n outputSchema: S.Struct({\n newMessages: S.Number,\n }),\n\n handler: ({\n event: {\n data: { channelId, queueId, after = DEFAULT_AFTER, pageSize = 5 },\n },\n context: { space },\n }: any) =>\n Effect.gen(function* () {\n const { token } = yield* Effect.tryPromise(() =>\n space.db.query(Filter.typename('dxos.org/type/AccessToken', { source: 'discord.com' })).first(),\n );\n const { objects } = yield* Effect.tryPromise(() => space.queues.queryQueue(DXN.parse(queueId)));\n const backfill = objects.length === 0;\n const newMessages = yield* Ref.make(0);\n const lastMessage = yield* Ref.make(objects.at(-1));\n\n const enqueueMessages = Effect.gen(function* () {\n const rest = yield* DiscordREST;\n\n while (true) {\n const last = yield* Ref.get(lastMessage);\n const options = {\n after: backfill && !last ? `${generateSnowflake(after)}` : last?.foreignId,\n limit: pageSize,\n };\n const messages = yield* rest.getChannelMessages(channelId, options).pipe((res: any) => res.json);\n const queueMessages = messages\n .map((message: any) =>\n createStatic(MessageSchema, {\n id: ObjectId.random(),\n foreignId: message.id,\n from: message.author.username,\n created: message.timestamp,\n content: message.content,\n }),\n )\n .toReversed();\n if (queueMessages.length > 0) {\n yield* Effect.tryPromise(() => space.queues.insertIntoQueue(DXN.parse(queueId), queueMessages));\n yield* Ref.update(newMessages, (n: any) => n + queueMessages.length);\n yield* Ref.update(lastMessage, (m: any) => queueMessages.at(-1));\n }\n if (messages.length < pageSize) {\n break;\n }\n }\n }).pipe(\n Effect.provide(DiscordRESTMemoryLive),\n Effect.provide(\n DiscordConfig.layerConfig({\n token: Config.succeed(Redacted.make(token)),\n }),\n ),\n Effect.provide(FetchHttpClient.layer),\n );\n\n yield* enqueueMessages;\n return { newMessages: yield* Ref.get(newMessages) };\n }),\n});\n";
27
27
  var echo_default = "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Echos the request data.\n */\nexport default async ({\n event: {\n data: { request },\n },\n}: any) => {\n const data = await request.json();\n return new Response(JSON.stringify(data ?? {}), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n};\n";
28
28
  var email_default = "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Appends a message to the end of a Document configured through a trigger.\n * Trigger must have a targetDocumentId field set in Meta.\n */\nexport default async ({\n event: {\n data: { request },\n },\n context: { space },\n}: any) => {\n const { data, trigger } = (await request.json()) as RequestPayload;\n\n const documentId = trigger.meta.targetDocumentId;\n const document = await space.db.query({ id: documentId }, { format: 'plain' }).first();\n\n const contentId = document.content['/'].split(':')[3];\n const documentContent = await space.db.query({ id: contentId }, { format: 'plain' }).first();\n const modifiedContent = [\n documentContent.content,\n '',\n '---',\n `**From:** ${data.from}`,\n `**Subject:** ${data.subject}`,\n `**Date:** ${data.created}`,\n '',\n data.body,\n ].join('\\n');\n\n await space.db.update({ id: contentId }, { content: modifiedContent });\n\n return new Response(JSON.stringify({ success: true }));\n};\n\ntype RequestPayload = {\n data: { from: string; subject: string; created: string; body: string };\n trigger: { meta: { targetDocumentId: string } };\n};\n";
29
- var forex_effect_default = "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\nimport {\n HttpClient,\n HttpClientRequest,\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.12.12';\n// @ts-ignore\nimport { Effect, Schedule } from 'https://esm.sh/effect@3.12.12';\n\nexport 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.String.annotations({ description: 'The exchange rate between the two currencies' }),\n\n handler: async ({\n event: {\n data: { from, to },\n },\n }: any) =>\n Effect.gen(function* () {\n const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(\n HttpClient.execute,\n Effect.flatMap((res: any) => res.json),\n Effect.timeout('1 second'),\n Effect.retry(Schedule.exponential(1000).pipe(Schedule.compose(Schedule.recurs(3)))),\n Effect.scoped,\n );\n return res.data.rates[to].toString();\n }).pipe(Effect.provide(FetchHttpClient.layer)),\n});\n";
29
+ var forex_effect_default = "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\nimport {\n HttpClient,\n HttpClientRequest,\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.13.3';\n// @ts-ignore\nimport { Effect, Schedule } from 'https://esm.sh/effect@3.13.3';\n\nexport 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.String.annotations({ description: 'The exchange rate between the two currencies' }),\n\n handler: async ({\n event: {\n data: { from, to },\n },\n }: any) =>\n Effect.gen(function* () {\n const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(\n HttpClient.execute,\n Effect.flatMap((res: any) => res.json),\n Effect.timeout('1 second'),\n Effect.retry(Schedule.exponential(1000).pipe(Schedule.compose(Schedule.recurs(3)))),\n Effect.scoped,\n );\n return res.data.rates[to].toString();\n }).pipe(Effect.provide(FetchHttpClient.layer)),\n});\n";
30
30
  var forex_default = "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\n\nexport 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 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 rates[to].toString();\n },\n});\n";
31
31
  var removeHeader = (str) => str.split("\n").slice(4).join("\n");
32
32
  var templates = [
@@ -74,4 +74,4 @@ var templates = [
74
74
  0 && (module.exports = {
75
75
  templates
76
76
  });
77
- //# sourceMappingURL=chunk-QYIAUPWY.cjs.map
77
+ //# sourceMappingURL=chunk-I57SKIAA.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["raw-loader:./chat.ts?raw", "raw-loader:./chess.ts?raw", "raw-loader:./discord.ts?raw", "raw-loader:./echo.ts?raw", "raw-loader:./email.ts?raw", "raw-loader:./forex-effect.ts?raw", "raw-loader:./forex.ts?raw", "../../../src/templates/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\n// @ts-ignore\nimport { transformServerSentEvents } from 'https://esm.sh/@dxos/script-toolbox';\n\n/**\n * Chatbot that answers questions based on the context data.\n */\nexport default async ({\n event: {\n data: { request },\n },\n context: { space, ai },\n}: any) => {\n const textBody = await request.text();\n let parsedRequest: any;\n try {\n parsedRequest = JSON.parse(textBody);\n } catch (err) {\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: true,\n prompt: `\n Using only the context data below to answer the user's question.\n If you cannot answer the question from the provided content, then reply with \"I don't know.\"\n\n CONTEXT:\n ${await getContext({ space })}\n\n QUESTION:\n ${textBody}\n `,\n });\n return new Response(transformServerSentEvents(answer));\n }\n\n const promptId = parsedRequest.trigger.promptId;\n const promptObject = await space.crud.query({ id: promptId }).first();\n\n if (parsedRequest.data.objects.length !== 1) {\n return new Response('Message batches not supported.');\n }\n\n const messageId = parsedRequest.data.objects[0];\n let message;\n try {\n message = await space.crud.query({ id: messageId }).first();\n } catch (err) {\n return new Response('Message not replicated yet.', { status: 409 });\n }\n\n if (message.text.includes('--------')) {\n return new Response('Message was already processed.');\n }\n\n let prompt = promptObject.template;\n for (const input of promptObject.inputs) {\n let value: string | null = null;\n if (input.type === TemplateInputType.VALUE) {\n value = String(input.value);\n } else if (input.type === TemplateInputType.RETRIEVER) {\n value = await getContext({ space });\n } else if (input.type === TemplateInputType.PASS_THROUGH) {\n value = message.text;\n }\n if (value) {\n prompt = prompt.replaceAll(`{${input.name}}`, value);\n }\n }\n\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: false,\n prompt,\n });\n const response = { response: answer.response, prompt, message };\n const textWithAnswer = message.text + '\\n--------\\n\\n' + answer.response;\n await space.crud.update({ id: messageId }, { text: textWithAnswer });\n\n return new Response(JSON.stringify(response));\n};\n\nconst getContext = async ({ space }: any) => {\n let context = '';\n const { objects: docs } = await space.crud.query({ __typename: 'dxos.org/type/Document' }).run();\n for (const doc of docs) {\n const { content } = await space.crud.query({ id: doc.content }).first();\n context += content + '\\n\\n';\n }\n return context;\n};\n\nenum TemplateInputType {\n VALUE = 0,\n PASS_THROUGH = 1,\n RETRIEVER = 2,\n FUNCTION = 3,\n QUERY = 4,\n RESOLVER = 5,\n CONTEXT = 6,\n SCHEMA = 7,\n}\n", "// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\n// @ts-ignore\nimport { Chess } from 'https://esm.sh/chess.js@0.13.1';\n\nexport default defineFunction({\n description: 'Plays a random move in a chess game.',\n\n inputSchema: S.Struct({\n changedObjectId: S.String.annotations({\n description: 'The objects to play the game on.',\n }),\n player: S.optional(S.Literal('w', 'b')).annotations({\n description: 'The player to play the game as.',\n }),\n }),\n\n outputSchema: S.Struct({\n state: S.String.annotations({\n description: 'The state of the game as an ASCII art board.',\n }),\n }),\n\n handler: async ({\n event: {\n data: { changedObjectId, player = 'b' },\n },\n context: { space },\n }: any) => {\n const { pgn } = await space.db.query({ id: changedObjectId }).first();\n const game = new Chess();\n game.load_pgn(pgn);\n if (game.turn() !== player) {\n return new Response('Invalid turn', { status: 409 });\n }\n\n const moves = game.moves();\n const move = moves[Math.floor(Math.random() * moves.length)];\n if (!move) {\n return new Response('No legal moves', { status: 406 });\n }\n\n game.move(move);\n const newPgn = game.pgn();\n await space.db.update({ id: changedObjectId }, { pgn: newPgn, fen: game.fen() });\n return { state: game.ascii() };\n },\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { createStatic, EchoObject, defineFunction, DXN, Filter, ObjectId, S } from 'dxos:functions';\nimport {\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.13.3';\n// @ts-ignore\nimport { DiscordConfig, DiscordREST, DiscordRESTMemoryLive } from 'https://esm.sh/dfx@0.113.0?deps=effect@3.13.3';\n// @ts-ignore\nimport { Effect, Config, Redacted, Ref } from 'https://esm.sh/effect@3.13.3';\n\nconst MessageSchema = S.Struct({\n id: S.String,\n foreignId: S.Any, // bigint?\n from: S.String,\n created: S.String,\n content: S.String,\n}).pipe(EchoObject('example.com/type/Message', '0.1.0'));\n\nconst DEFAULT_AFTER = 1704067200; // 2024-01-01\n\nconst generateSnowflake = (unixTimestamp: number): bigint => {\n const discordEpoch = 1420070400000n; // Discord Epoch (ms)\n return (BigInt(unixTimestamp * 1000) - discordEpoch) << 22n;\n};\n\nexport default defineFunction({\n inputSchema: S.Struct({\n // TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.\n tick: S.optional(S.String),\n channelId: S.String,\n after: S.optional(S.Number),\n pageSize: S.optional(S.Number),\n queueId: S.String,\n }),\n\n outputSchema: S.Struct({\n newMessages: S.Number,\n }),\n\n handler: ({\n event: {\n data: { channelId, queueId, after = DEFAULT_AFTER, pageSize = 5 },\n },\n context: { space },\n }: any) =>\n Effect.gen(function* () {\n const { token } = yield* Effect.tryPromise(() =>\n space.db.query(Filter.typename('dxos.org/type/AccessToken', { source: 'discord.com' })).first(),\n );\n const { objects } = yield* Effect.tryPromise(() => space.queues.queryQueue(DXN.parse(queueId)));\n const backfill = objects.length === 0;\n const newMessages = yield* Ref.make(0);\n const lastMessage = yield* Ref.make(objects.at(-1));\n\n const enqueueMessages = Effect.gen(function* () {\n const rest = yield* DiscordREST;\n\n while (true) {\n const last = yield* Ref.get(lastMessage);\n const options = {\n after: backfill && !last ? `${generateSnowflake(after)}` : last?.foreignId,\n limit: pageSize,\n };\n const messages = yield* rest.getChannelMessages(channelId, options).pipe((res: any) => res.json);\n const queueMessages = messages\n .map((message: any) =>\n createStatic(MessageSchema, {\n id: ObjectId.random(),\n foreignId: message.id,\n from: message.author.username,\n created: message.timestamp,\n content: message.content,\n }),\n )\n .toReversed();\n if (queueMessages.length > 0) {\n yield* Effect.tryPromise(() => space.queues.insertIntoQueue(DXN.parse(queueId), queueMessages));\n yield* Ref.update(newMessages, (n: any) => n + queueMessages.length);\n yield* Ref.update(lastMessage, (m: any) => queueMessages.at(-1));\n }\n if (messages.length < pageSize) {\n break;\n }\n }\n }).pipe(\n Effect.provide(DiscordRESTMemoryLive),\n Effect.provide(\n DiscordConfig.layerConfig({\n token: Config.succeed(Redacted.make(token)),\n }),\n ),\n Effect.provide(FetchHttpClient.layer),\n );\n\n yield* enqueueMessages;\n return { newMessages: yield* Ref.get(newMessages) };\n }),\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Echos the request data.\n */\nexport default async ({\n event: {\n data: { request },\n },\n}: any) => {\n const data = await request.json();\n return new Response(JSON.stringify(data ?? {}), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Appends a message to the end of a Document configured through a trigger.\n * Trigger must have a targetDocumentId field set in Meta.\n */\nexport default async ({\n event: {\n data: { request },\n },\n context: { space },\n}: any) => {\n const { data, trigger } = (await request.json()) as RequestPayload;\n\n const documentId = trigger.meta.targetDocumentId;\n const document = await space.db.query({ id: documentId }, { format: 'plain' }).first();\n\n const contentId = document.content['/'].split(':')[3];\n const documentContent = await space.db.query({ id: contentId }, { format: 'plain' }).first();\n const modifiedContent = [\n documentContent.content,\n '',\n '---',\n `**From:** ${data.from}`,\n `**Subject:** ${data.subject}`,\n `**Date:** ${data.created}`,\n '',\n data.body,\n ].join('\\n');\n\n await space.db.update({ id: contentId }, { content: modifiedContent });\n\n return new Response(JSON.stringify({ success: true }));\n};\n\ntype RequestPayload = {\n data: { from: string; subject: string; created: string; body: string };\n trigger: { meta: { targetDocumentId: string } };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\nimport {\n HttpClient,\n HttpClientRequest,\n FetchHttpClient,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.77.2?deps=effect@3.13.3';\n// @ts-ignore\nimport { Effect, Schedule } from 'https://esm.sh/effect@3.13.3';\n\nexport 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.String.annotations({ description: 'The exchange rate between the two currencies' }),\n\n handler: async ({\n event: {\n data: { from, to },\n },\n }: any) =>\n Effect.gen(function* () {\n const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(\n HttpClient.execute,\n Effect.flatMap((res: any) => res.json),\n Effect.timeout('1 second'),\n Effect.retry(Schedule.exponential(1000).pipe(Schedule.compose(Schedule.recurs(3)))),\n Effect.scoped,\n );\n return res.data.rates[to].toString();\n }).pipe(Effect.provide(FetchHttpClient.layer)),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { defineFunction, S } from 'dxos:functions';\n\nexport 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 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 rates[to].toString();\n },\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport chat from './chat.ts?raw';\nimport chess from './chess.ts?raw';\nimport discord from './discord.ts?raw';\nimport echo from './echo.ts?raw';\nimport email from './email.ts?raw';\nimport forexEffect from './forex-effect.ts?raw';\nimport forex from './forex.ts?raw';\n\nconst removeHeader = (str: string) => str.split('\\n').slice(4).join('\\n');\n\nexport type Template = {\n id: string;\n name: string;\n source: string;\n presetId?: string;\n};\n\nexport const templates: Template[] = [\n {\n id: 'dxos.org/script/echo',\n name: 'Echo',\n source: removeHeader(echo),\n },\n {\n id: 'dxos.org/script/forex',\n name: 'Forex',\n source: removeHeader(forex),\n },\n {\n id: 'dxos.org/script/forex-effect',\n name: 'Forex (Effect)',\n source: removeHeader(forexEffect),\n },\n {\n id: 'dxos.org/script/gpt',\n name: 'Gpt',\n source: removeHeader(chat),\n presetId: 'dxos.org/function/gpt',\n },\n {\n id: 'dxos.org/script/chess',\n name: 'Chess',\n source: removeHeader(chess),\n presetId: 'dxos.org/function/chess',\n },\n {\n id: 'dxos.org/script/email',\n name: 'Email',\n source: removeHeader(email),\n presetId: 'dxos.org/function/email',\n },\n {\n id: 'dxos.org/script/discord',\n name: 'Discord',\n source: removeHeader(discord),\n presetId: 'dxos.org/function/discord',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,eAAA;ACAA,IAAA,gBAAA;ACAA,IAAA,kBAAA;ACAA,IAAA,eAAA;ACAA,IAAA,gBAAA;ACAA,IAAA,uBAAA;ACAA,IAAA,gBAAA;ACYA,IAAMA,eAAe,CAACC,QAAgBA,IAAIC,MAAM,IAAA,EAAMC,MAAM,CAAA,EAAGC,KAAK,IAAA;AAS7D,IAAMC,YAAwB;EACnC;IACEC,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaS,YAAAA;EACvB;EACA;IACEH,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaU,aAAAA;EACvB;EACA;IACEJ,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaW,oBAAAA;EACvB;EACA;IACEL,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAaY,YAAAA;IACrBC,UAAU;EACZ;EACA;IACEP,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAac,aAAAA;IACrBD,UAAU;EACZ;EACA;IACEP,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAae,aAAAA;IACrBF,UAAU;EACZ;EACA;IACEP,IAAI;IACJC,MAAM;IACNC,QAAQR,aAAagB,eAAAA;IACrBH,UAAU;EACZ;;",
6
+ "names": ["removeHeader", "str", "split", "slice", "join", "templates", "id", "name", "source", "echo", "forex", "forexEffect", "chat", "presetId", "chess", "email", "discord"]
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 chunk_RGHRAT2U_exports = {};
30
- __export(chunk_RGHRAT2U_exports, {
29
+ var chunk_M2DJ5RXU_exports = {};
30
+ __export(chunk_M2DJ5RXU_exports, {
31
31
  DebugPanel: () => DebugPanel,
32
32
  ScriptContainer: () => ScriptContainer,
33
33
  ScriptSettings: () => ScriptSettings,
34
34
  ScriptSettingsPanel: () => ScriptSettingsPanel
35
35
  });
36
- module.exports = __toCommonJS(chunk_RGHRAT2U_exports);
36
+ module.exports = __toCommonJS(chunk_M2DJ5RXU_exports);
37
37
  var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
38
38
  var import_react = __toESM(require("react"));
39
39
  var import_log = require("@dxos/log");
@@ -482,7 +482,7 @@ var ScriptSettingsPanel = ({ script }) => {
482
482
  onClick: handlePublish
483
483
  }, t(publishing ? "publishing label" : "publish label")))));
484
484
  };
485
- var ScriptContainer = (0, import_react4.lazy)(() => import("./ScriptContainer-XSYHQ4MZ.cjs"));
485
+ var ScriptContainer = (0, import_react4.lazy)(() => import("./ScriptContainer-2LYA3N3F.cjs"));
486
486
  // Annotate the CommonJS export names for ESM import in node:
487
487
  0 && (module.exports = {
488
488
  DebugPanel,
@@ -490,4 +490,4 @@ var ScriptContainer = (0, import_react4.lazy)(() => import("./ScriptContainer-XS
490
490
  ScriptSettings,
491
491
  ScriptSettingsPanel
492
492
  });
493
- //# sourceMappingURL=chunk-RGHRAT2U.cjs.map
493
+ //# sourceMappingURL=chunk-M2DJ5RXU.cjs.map
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_DA6RBNFV_exports = {};
30
- __export(chunk_DA6RBNFV_exports, {
29
+ var chunk_OSRFLW5T_exports = {};
30
+ __export(chunk_OSRFLW5T_exports, {
31
31
  LogsPanel: () => LogsPanel,
32
32
  createDeploy: () => createDeploy,
33
33
  createFormat: () => createFormat,
@@ -37,8 +37,8 @@ __export(chunk_DA6RBNFV_exports, {
37
37
  useToolbarAction: () => useToolbarAction,
38
38
  useToolbarState: () => useToolbarState
39
39
  });
40
- module.exports = __toCommonJS(chunk_DA6RBNFV_exports);
41
- var import_chunk_QYIAUPWY = require("./chunk-QYIAUPWY.cjs");
40
+ module.exports = __toCommonJS(chunk_OSRFLW5T_exports);
41
+ var import_chunk_I57SKIAA = require("./chunk-I57SKIAA.cjs");
42
42
  var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
43
43
  var import_react = require("react");
44
44
  var import_functions = require("@dxos/functions");
@@ -347,7 +347,7 @@ var createTemplateSelectGroup = () => {
347
347
  });
348
348
  };
349
349
  var createTemplateSelectActions = () => {
350
- return import_chunk_QYIAUPWY.templates.map((template) => {
350
+ return import_chunk_I57SKIAA.templates.map((template) => {
351
351
  return (0, import_react_ui_menu3.createMenuAction)(`template--${template.id}`, {
352
352
  label: template.name,
353
353
  value: template.id,
@@ -377,7 +377,7 @@ var createTemplateSelect = () => {
377
377
  };
378
378
  var useTemplateSelectHandler = ({ script }) => {
379
379
  return (0, import_react4.useCallback)((templateId) => {
380
- const template = import_chunk_QYIAUPWY.templates.find((template2) => template2.id === templateId);
380
+ const template = import_chunk_I57SKIAA.templates.find((template2) => template2.id === templateId);
381
381
  if (template) {
382
382
  script.name = template.name;
383
383
  script.source.target.content = template.source;
@@ -561,4 +561,4 @@ var InvocationTraceItem = ({ trace, open, setOpen }) => {
561
561
  useToolbarAction,
562
562
  useToolbarState
563
563
  });
564
- //# sourceMappingURL=chunk-DA6RBNFV.cjs.map
564
+ //# sourceMappingURL=chunk-OSRFLW5T.cjs.map
@@ -28,21 +28,21 @@ 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
- DebugPanel: () => import_chunk_RGHRAT2U.DebugPanel,
32
- LogsPanel: () => import_chunk_DA6RBNFV.LogsPanel,
31
+ DebugPanel: () => import_chunk_M2DJ5RXU.DebugPanel,
32
+ LogsPanel: () => import_chunk_OSRFLW5T.LogsPanel,
33
33
  SCRIPT_PLUGIN: () => import_chunk_5UH3F7TA.SCRIPT_PLUGIN,
34
34
  ScriptCapabilities: () => import_chunk_ALY3N6PW.ScriptCapabilities,
35
- ScriptContainer: () => import_chunk_RGHRAT2U.ScriptContainer,
35
+ ScriptContainer: () => import_chunk_M2DJ5RXU.ScriptContainer,
36
36
  ScriptPlugin: () => ScriptPlugin,
37
- ScriptSettings: () => import_chunk_RGHRAT2U.ScriptSettings,
38
- ScriptSettingsPanel: () => import_chunk_RGHRAT2U.ScriptSettingsPanel,
37
+ ScriptSettings: () => import_chunk_M2DJ5RXU.ScriptSettings,
38
+ ScriptSettingsPanel: () => import_chunk_M2DJ5RXU.ScriptSettingsPanel,
39
39
  meta: () => import_chunk_5UH3F7TA.meta
40
40
  });
41
41
  module.exports = __toCommonJS(node_exports);
42
- var import_chunk_RGHRAT2U = require("./chunk-RGHRAT2U.cjs");
42
+ var import_chunk_M2DJ5RXU = require("./chunk-M2DJ5RXU.cjs");
43
43
  var import_chunk_ALY3N6PW = require("./chunk-ALY3N6PW.cjs");
44
- var import_chunk_DA6RBNFV = require("./chunk-DA6RBNFV.cjs");
45
- var import_chunk_QYIAUPWY = require("./chunk-QYIAUPWY.cjs");
44
+ var import_chunk_OSRFLW5T = require("./chunk-OSRFLW5T.cjs");
45
+ var import_chunk_I57SKIAA = require("./chunk-I57SKIAA.cjs");
46
46
  var import_chunk_3ICET6JB = require("./chunk-3ICET6JB.cjs");
47
47
  var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
48
48
  var import_app_framework = require("@dxos/app-framework");
@@ -57,8 +57,8 @@ var import_echo = require("@dxos/react-client/echo");
57
57
  var import_app_framework3 = require("@dxos/app-framework");
58
58
  var import_functions2 = require("@dxos/functions");
59
59
  var Compiler = (0, import_app_framework.lazy)(() => import("./compiler-UIBLKJKG.cjs"));
60
- var IntentResolver = (0, import_app_framework.lazy)(() => import("./intent-resolver-WZVIHKA7.cjs"));
61
- var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-I7V6DSYF.cjs"));
60
+ var IntentResolver = (0, import_app_framework.lazy)(() => import("./intent-resolver-L4WJAAV3.cjs"));
61
+ var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-TQ4OKBUS.cjs"));
62
62
  var ScriptSettings2 = (0, import_app_framework.lazy)(() => import("./settings-TR2CA4IH.cjs"));
63
63
  var ArtifactDefinition = (0, import_app_framework.lazy)(() => import("./artifact-definition-BXQCFPAH.cjs"));
64
64
  var ScriptEvents;
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var intent_resolver_WZVIHKA7_exports = {};
20
- __export(intent_resolver_WZVIHKA7_exports, {
19
+ var intent_resolver_L4WJAAV3_exports = {};
20
+ __export(intent_resolver_L4WJAAV3_exports, {
21
21
  default: () => intent_resolver_default
22
22
  });
23
- module.exports = __toCommonJS(intent_resolver_WZVIHKA7_exports);
24
- var import_chunk_QYIAUPWY = require("./chunk-QYIAUPWY.cjs");
23
+ module.exports = __toCommonJS(intent_resolver_L4WJAAV3_exports);
24
+ var import_chunk_I57SKIAA = require("./chunk-I57SKIAA.cjs");
25
25
  var import_chunk_3ICET6JB = require("./chunk-3ICET6JB.cjs");
26
26
  var import_chunk_5UH3F7TA = require("./chunk-5UH3F7TA.cjs");
27
27
  var import_core = require("@octokit/core");
@@ -32,7 +32,7 @@ var import_schema = require("@dxos/schema");
32
32
  var intent_resolver_default = () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.IntentResolver, (0, import_app_framework.createResolver)({
33
33
  intent: import_chunk_3ICET6JB.ScriptAction.Create,
34
34
  resolve: async ({ name, gistUrl }) => {
35
- let content = import_chunk_QYIAUPWY.templates[0].source;
35
+ let content = import_chunk_I57SKIAA.templates[0].source;
36
36
  const gistId = gistUrl?.split("/").at(-1);
37
37
  if (gistId) {
38
38
  const octokit = new import_core.Octokit();
@@ -56,4 +56,4 @@ var intent_resolver_default = () => (0, import_app_framework.contributes)(import
56
56
  };
57
57
  }
58
58
  }));
59
- //# sourceMappingURL=intent-resolver-WZVIHKA7.cjs.map
59
+ //# sourceMappingURL=intent-resolver-L4WJAAV3.cjs.map