@dxos/plugin-script 0.8.1-main.303c73a → 0.8.1-main.81238a8
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-QGF55ZZJ.mjs → ScriptContainer-7PTOJ4KY.mjs} +13 -18
- package/dist/lib/browser/ScriptContainer-7PTOJ4KY.mjs.map +7 -0
- package/dist/lib/browser/{artifact-definition-4LWPD3DH.mjs → artifact-definition-GYCZJGR4.mjs} +8 -7
- package/dist/lib/browser/artifact-definition-GYCZJGR4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FVVCAWNP.mjs → chunk-27LV6ARH.mjs} +1 -1
- package/dist/lib/browser/chunk-27LV6ARH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LYOFJ3FM.mjs → chunk-4SSKJNMZ.mjs} +3 -3
- package/dist/lib/browser/chunk-4SSKJNMZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2H6QBQ5Q.mjs → chunk-AJNRPWAA.mjs} +3 -3
- package/dist/lib/browser/{chunk-2H6QBQ5Q.mjs.map → chunk-AJNRPWAA.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-THELDT6E.mjs → chunk-DZB4KWOI.mjs} +29 -49
- package/dist/lib/browser/chunk-DZB4KWOI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6MOQ4BP3.mjs → chunk-FG66JYON.mjs} +2 -2
- package/dist/lib/browser/{chunk-35UHX7XH.mjs → chunk-QHE53FDV.mjs} +4 -4
- package/dist/lib/browser/{chunk-35UHX7XH.mjs.map → chunk-QHE53FDV.mjs.map} +1 -1
- package/dist/lib/browser/{compiler-YY2XSKHQ.mjs → compiler-ZQLHHJ5P.mjs} +3 -3
- package/dist/lib/browser/index.mjs +17 -15
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-NWAKTBZC.mjs → intent-resolver-3B3Z67FP.mjs} +5 -5
- package/dist/lib/browser/{intent-resolver-NWAKTBZC.mjs.map → intent-resolver-3B3Z67FP.mjs.map} +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-6CYOO66B.mjs → react-surface-GQD6LJDJ.mjs} +13 -13
- package/dist/lib/browser/react-surface-GQD6LJDJ.mjs.map +7 -0
- package/dist/lib/browser/{settings-LRHZSUEJ.mjs → settings-467GVEBU.mjs} +3 -3
- package/dist/lib/browser/types.mjs +2 -2
- package/dist/lib/node/{ScriptContainer-XSYHQ4MZ.cjs → ScriptContainer-VHHYWC3A.cjs} +22 -27
- package/dist/lib/node/ScriptContainer-VHHYWC3A.cjs.map +7 -0
- package/dist/lib/node/{artifact-definition-BXQCFPAH.cjs → artifact-definition-3SNVJ34V.cjs} +20 -19
- package/dist/lib/node/artifact-definition-3SNVJ34V.cjs.map +7 -0
- package/dist/lib/node/{chunk-5UH3F7TA.cjs → chunk-2XX4L67K.cjs} +4 -4
- package/dist/lib/node/chunk-2XX4L67K.cjs.map +7 -0
- package/dist/lib/node/{chunk-ALY3N6PW.cjs → chunk-AOKGOI5J.cjs} +6 -6
- package/dist/lib/node/{chunk-DA6RBNFV.cjs → chunk-MSH4SVCN.cjs} +43 -63
- package/dist/lib/node/chunk-MSH4SVCN.cjs.map +7 -0
- package/dist/lib/node/{chunk-RGHRAT2U.cjs → chunk-W4U3OWKO.cjs} +13 -13
- package/dist/lib/node/{chunk-RGHRAT2U.cjs.map → chunk-W4U3OWKO.cjs.map} +2 -2
- package/dist/lib/node/{chunk-QYIAUPWY.cjs → chunk-XCQNFRZ6.cjs} +6 -6
- package/dist/lib/node/chunk-XCQNFRZ6.cjs.map +7 -0
- package/dist/lib/node/{chunk-3ICET6JB.cjs → chunk-XFB6JL2G.cjs} +8 -8
- package/dist/lib/node/{chunk-3ICET6JB.cjs.map → chunk-XFB6JL2G.cjs.map} +2 -2
- package/dist/lib/node/{compiler-UIBLKJKG.cjs → compiler-5ALLTH2B.cjs} +7 -7
- package/dist/lib/node/index.cjs +46 -44
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-WZVIHKA7.cjs → intent-resolver-CN5WMMAD.cjs} +11 -11
- package/dist/lib/node/intent-resolver-CN5WMMAD.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-I7V6DSYF.cjs → react-surface-VV7J7PQN.cjs} +28 -28
- package/dist/lib/node/react-surface-VV7J7PQN.cjs.map +7 -0
- package/dist/lib/node/{settings-TR2CA4IH.cjs → settings-WLYT2XQF.cjs} +9 -9
- package/dist/lib/node/types.cjs +4 -4
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{ScriptContainer-5OTO5SJM.mjs → ScriptContainer-A4J44DZD.mjs} +13 -18
- package/dist/lib/node-esm/ScriptContainer-A4J44DZD.mjs.map +7 -0
- package/dist/lib/node-esm/{artifact-definition-KT4DK2LQ.mjs → artifact-definition-VAFNV62U.mjs} +8 -7
- package/dist/lib/node-esm/artifact-definition-VAFNV62U.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YSOCSUGC.mjs → chunk-2RKD5MCW.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-YSOCSUGC.mjs.map → chunk-2RKD5MCW.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-2D6G2Y2O.mjs → chunk-4YUSGXJ2.mjs} +3 -3
- package/dist/lib/node-esm/chunk-4YUSGXJ2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-P2V2Y5LV.mjs → chunk-5S2KBIMH.mjs} +1 -1
- package/dist/lib/node-esm/chunk-5S2KBIMH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CP5LXTK5.mjs → chunk-MFXRE7ZD.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-34AL6Y3D.mjs → chunk-QHZ6KA5J.mjs} +29 -49
- package/dist/lib/node-esm/chunk-QHZ6KA5J.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-N52CCVF5.mjs → chunk-WQ4YIZ2L.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-N52CCVF5.mjs.map → chunk-WQ4YIZ2L.mjs.map} +1 -1
- package/dist/lib/node-esm/{compiler-XTXFGZJM.mjs → compiler-K7GYROAO.mjs} +3 -3
- package/dist/lib/node-esm/index.mjs +17 -15
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-E4EOZUBH.mjs → intent-resolver-6F7CVQEX.mjs} +5 -5
- package/dist/lib/node-esm/{intent-resolver-E4EOZUBH.mjs.map → intent-resolver-6F7CVQEX.mjs.map} +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-FQ4K7UST.mjs → react-surface-RPNDRJVD.mjs} +13 -13
- package/dist/lib/node-esm/react-surface-RPNDRJVD.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-Q6B4K7LO.mjs → settings-DR3B6GHE.mjs} +3 -3
- package/dist/lib/node-esm/types.mjs +2 -2
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/LogsPanel/LogsPanel.d.ts +1 -1
- package/dist/types/src/components/LogsPanel/LogsPanel.d.ts.map +1 -1
- package/dist/types/src/components/ScriptContainer.d.ts +3 -2
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts +1 -1
- package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +7 -6
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +1 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +1 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarAction.d.ts +1 -1
- package/dist/types/src/hooks/useToolbarAction.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +2 -8
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/hooks/view.d.ts +3 -15
- package/dist/types/src/hooks/view.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +8 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +47 -47
- package/src/ScriptPlugin.tsx +3 -2
- package/src/capabilities/artifact-definition.ts +2 -1
- package/src/capabilities/intent-resolver.ts +1 -1
- package/src/capabilities/react-surface.tsx +16 -6
- package/src/components/LogsPanel/LogsPanel.tsx +4 -9
- package/src/components/ScriptContainer.tsx +12 -10
- package/src/components/ScriptSettingsPanel.tsx +1 -1
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -0
- package/src/hooks/deploy.ts +1 -2
- package/src/hooks/format.ts +1 -1
- package/src/hooks/template.ts +1 -1
- package/src/hooks/useToolbarAction.ts +13 -4
- package/src/hooks/useToolbarState.ts +2 -2
- package/src/hooks/view.ts +6 -20
- package/src/meta.ts +2 -2
- package/src/templates/discord.ts +15 -8
- package/src/templates/forex-effect.ts +2 -2
- package/src/translations.ts +2 -1
- package/src/types.ts +1 -1
- package/dist/lib/browser/ScriptContainer-QGF55ZZJ.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-4LWPD3DH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FVVCAWNP.mjs.map +0 -7
- package/dist/lib/browser/chunk-LYOFJ3FM.mjs.map +0 -7
- package/dist/lib/browser/chunk-THELDT6E.mjs.map +0 -7
- package/dist/lib/browser/react-surface-6CYOO66B.mjs.map +0 -7
- package/dist/lib/node/ScriptContainer-XSYHQ4MZ.cjs.map +0 -7
- package/dist/lib/node/artifact-definition-BXQCFPAH.cjs.map +0 -7
- package/dist/lib/node/chunk-5UH3F7TA.cjs.map +0 -7
- package/dist/lib/node/chunk-DA6RBNFV.cjs.map +0 -7
- package/dist/lib/node/chunk-QYIAUPWY.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-WZVIHKA7.cjs.map +0 -7
- package/dist/lib/node/react-surface-I7V6DSYF.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-5OTO5SJM.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-KT4DK2LQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2D6G2Y2O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-34AL6Y3D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P2V2Y5LV.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FQ4K7UST.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-6MOQ4BP3.mjs.map → chunk-FG66JYON.mjs.map} +0 -0
- /package/dist/lib/browser/{compiler-YY2XSKHQ.mjs.map → compiler-ZQLHHJ5P.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-LRHZSUEJ.mjs.map → settings-467GVEBU.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-ALY3N6PW.cjs.map → chunk-AOKGOI5J.cjs.map} +0 -0
- /package/dist/lib/node/{compiler-UIBLKJKG.cjs.map → compiler-5ALLTH2B.cjs.map} +0 -0
- /package/dist/lib/node/{settings-TR2CA4IH.cjs.map → settings-WLYT2XQF.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-CP5LXTK5.mjs.map → chunk-MFXRE7ZD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{compiler-XTXFGZJM.mjs.map → compiler-K7GYROAO.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-Q6B4K7LO.mjs.map → settings-DR3B6GHE.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ScriptContainer.tsx", "../../../src/components/ScriptToolbar/ScriptToolbar.tsx", "../../../src/components/TypescriptEditor/TypescriptEditor.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useMemo } from 'react';\n\nimport { type ScriptType } from '@dxos/functions/types';\nimport { createDocAccessor, getSpace } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { createDataExtensions, listener, stackItemContentEditorClassNames } from '@dxos/react-ui-editor';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { LogsPanel } from './LogsPanel';\nimport { ScriptToolbar } from './ScriptToolbar';\nimport { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';\nimport { useDeployState, useToolbarState } from '../hooks';\nimport { type ScriptSettingsProps } from '../types';\n\nexport type ScriptEditorProps = ThemedClassName<{\n script: ScriptType;\n variant?: 'logs';\n settings?: ScriptSettingsProps;\n role?: string;\n}> &\n Pick<TypescriptEditorProps, 'env'>;\n\nexport const ScriptContainer = ({\n role,\n classNames,\n script,\n variant,\n settings = { editorInputMode: 'vscode' },\n env,\n}: ScriptEditorProps) => {\n const identity = useIdentity();\n const space = getSpace(script);\n\n const extensions = useMemo(\n () => [\n listener({\n onChange: (text) => {\n if (script.source.target && script.source.target.content !== text) {\n script.changed = true;\n }\n },\n }),\n createDataExtensions({\n id: script.id,\n text: script.source.target && createDocAccessor(script.source.target, ['content']),\n space,\n identity,\n }),\n ],\n [script, script.source.target, space, identity],\n );\n\n const state = useToolbarState();\n useDeployState({ state, script });\n\n if (!space) {\n return null;\n }\n\n return (\n <StackItem.Content toolbar={variant !== 'logs'}>\n {variant === 'logs' ? (\n <LogsPanel script={script} />\n ) : (\n <>\n <ScriptToolbar state={state} role={role} script={script} />\n <TypescriptEditor\n id={script.id}\n env={env}\n initialValue={script.source?.target?.content}\n extensions={extensions}\n className={mx(stackItemContentEditorClassNames(role), 'grow')}\n inputMode={settings.editorInputMode}\n toolbar\n />\n </>\n )}\n </StackItem.Content>\n );\n};\n\nexport default ScriptContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { type ScriptType } from '@dxos/functions/types';\nimport { fullyQualifiedId } from '@dxos/react-client/echo';\nimport { ElevationProvider, type ThemedClassName } from '@dxos/react-ui';\nimport { stackItemContentToolbarClassNames } from '@dxos/react-ui-editor';\nimport { createGapSeparator, MenuProvider, ToolbarMenu, useMenuActions } from '@dxos/react-ui-menu';\n\nimport {\n type ScriptToolbarState,\n createDeploy,\n createFormat,\n createTemplateSelect,\n createView,\n useToolbarAction,\n} from '../../hooks';\n\nexport type ScriptToolbarProps = ThemedClassName<{\n role?: string;\n script: ScriptType;\n state: ScriptToolbarState;\n}>;\n\nconst createToolbar = (state: ScriptToolbarState) => {\n const templateSelect = createTemplateSelect();\n const format = createFormat();\n const gap = createGapSeparator();\n const deploy = createDeploy(state);\n const view = createView(state);\n return {\n nodes: [...templateSelect.nodes, ...format.nodes, ...gap.nodes, ...deploy.nodes, ...view.nodes],\n edges: [...templateSelect.edges, ...format.edges, ...gap.edges, ...deploy.edges, ...view.edges],\n };\n};\n\nexport const ScriptToolbar = ({ script, role, state, classNames }: ScriptToolbarProps) => {\n const handleAction = useToolbarAction({ state, script });\n const toolbarCreator = useCallback(() => createToolbar(state), [state]);\n const menu = useMenuActions(toolbarCreator);\n return (\n <div role='none' className={stackItemContentToolbarClassNames(role)}>\n <ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>\n <MenuProvider {...menu} onAction={handleAction} attendableId={fullyQualifiedId(script)}>\n <ToolbarMenu classNames={classNames} />\n </MenuProvider>\n </ElevationProvider>\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { javascript } from '@codemirror/lang-javascript';\nimport { defaultHighlightStyle } from '@codemirror/language';\nimport { Prec } from '@codemirror/state';\nimport { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';\nimport { keymap } from '@codemirror/view';\nimport { tags } from '@lezer/highlight';\nimport { type VirtualTypeScriptEnvironment } from '@typescript/vfs';\nimport { continueKeymap } from '@valtown/codemirror-continue';\nimport { tsSync, tsFacet, tsLinter, tsAutocomplete, tsHover, type HoverInfo } from '@valtown/codemirror-ts';\nimport React from 'react';\n\nimport { type ThemeMode, useThemeContext } from '@dxos/react-ui';\nimport {\n autocomplete,\n createBasicExtensions,\n createThemeExtensions,\n editorFullWidth,\n type EditorInputMode,\n editorMonospace,\n EditorView,\n folding,\n InputModeExtensions,\n useTextEditor,\n type UseTextEditorProps,\n} from '@dxos/react-ui-editor';\nimport { isNonNullable } from '@dxos/util';\n\nexport type TypescriptEditorProps = {\n id: string;\n inputMode?: EditorInputMode;\n env?: VirtualTypeScriptEnvironment;\n toolbar?: boolean;\n} & Pick<UseTextEditorProps, 'className' | 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>;\n\nexport const TypescriptEditor = ({\n id,\n env,\n className,\n initialValue,\n extensions,\n scrollTo,\n selection,\n toolbar,\n inputMode = 'vscode',\n}: TypescriptEditorProps) => {\n const { themeMode } = useThemeContext();\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n initialValue,\n extensions: [\n extensions,\n createBasicExtensions({\n highlightActiveLine: true,\n indentWithTab: true,\n lineNumbers: true,\n lineWrapping: false,\n scrollPastEnd: true,\n }),\n createThemeExtensions({\n themeMode,\n syntaxHighlighting: true,\n slots: {\n content: { className: editorFullWidth },\n },\n }),\n // NOTE: Not using default editor gutter because folding for code works best right beside text.\n EditorView.theme({\n '.cm-gutters': {\n // Match margin from content.\n marginTop: '16px',\n background: 'var(--dx-baseSurface)',\n },\n }),\n InputModeExtensions[inputMode],\n folding(),\n // Continues block comments when you hit Enter.\n Prec.high(keymap.of(continueKeymap)),\n // TODO(burdon): Factor out.\n [\n editorMonospace,\n javascript({ typescript: true }),\n // https://github.com/val-town/codemirror-ts\n autocomplete({ override: env ? [tsAutocomplete()] : [] }),\n env\n ? [\n tsFacet.of({ env, path: `/src/${id}.ts` }),\n tsSync(),\n tsLinter(),\n tsHover({ renderTooltip: createTooltipRenderer(themeMode) }),\n ]\n : [],\n ],\n ].filter(isNonNullable),\n selection,\n scrollTo,\n }),\n [id, extensions, themeMode, inputMode, selection, scrollTo],\n );\n\n return (\n <div ref={parentRef} data-toolbar={toolbar ? 'enabled' : 'disabled'} className={className} {...focusAttributes} />\n );\n};\n\nconst createTooltipRenderer = (themeMode: ThemeMode) => {\n const theme = themeMode === 'dark' ? oneDarkHighlightStyle : defaultHighlightStyle;\n\n const classFromKind = (_kind: string) => {\n // E.g., localName, methodName, parameterName, etc.\n const kind = _kind.endsWith('Name') ? 'name' : _kind;\n const validTag = kind in tags;\n if (!validTag) {\n return '';\n }\n\n const tag = tags[kind as keyof typeof tags];\n if (typeof tag === 'function') {\n return '';\n }\n\n return theme.style([tag]) ?? '';\n };\n\n return (info: HoverInfo) => {\n const div = document.createElement('div');\n div.className = 'p-1 rounded border border-separator bg-baseSurface xs:max-w-80 max-w-lg';\n\n if (info.quickInfo?.displayParts) {\n for (const part of info.quickInfo.displayParts) {\n const span = div.appendChild(document.createElement('span'));\n span.className = classFromKind(part.kind);\n span.innerText = part.text;\n }\n }\n\n return { dom: div };\n };\n};\n\nexport default TypescriptEditor;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA+B;AAG/B,kBAA4C;AAC5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AQA,OAAOyG,OAAOC;IAAQN;IAAOF;GAAS;AAGjD,QAAMhH,YAAQ4H,uCAAAA;AACdC,4CAAe;IAAE7H;IAAOc;EAAO,CAAA;AAE/B,MAAI,CAACoG,OAAO;AACV,WAAO;EACT;AAEA,SACE3F,6BAAAA,QAAA,cAACuG,gCAAUC,SAAO;IAACtF,SAASoE,YAAY;KACrCA,YAAY,SACXtF,6BAAAA,QAAA,cAACyG,iCAAAA;IAAUlH;OAEXS,6BAAAA,QAAA,cAAAA,aAAAA,QAAA,UAAA,MACEA,6BAAAA,QAAA,cAACV,eAAAA;IAAcb;IAAce;IAAYD;MACzCS,6BAAAA,QAAA,cAACW,kBAAAA;IACCC,IAAIrB,OAAOqB;IACXC;IACAC,cAAcvB,OAAOyG,QAAQC,QAAQ/D;IACrCnB;IACAb,eAAWwG,8BAAGC,yDAAiCnH,IAAAA,GAAO,MAAA;IACtD2B,WAAWoE,SAASC;IACpBtE,SAAAA;;AAMZ;AAEA,IAAA,0BAAemE;",
|
|
6
|
+
"names": ["import_react", "import_echo", "import_react_ui_editor", "import_react_ui", "createToolbar", "state", "templateSelect", "createTemplateSelect", "format", "createFormat", "gap", "createGapSeparator", "deploy", "createDeploy", "view", "createView", "nodes", "edges", "ScriptToolbar", "script", "role", "classNames", "handleAction", "useToolbarAction", "toolbarCreator", "useCallback", "menu", "useMenuActions", "React", "div", "className", "stackItemContentToolbarClassNames", "ElevationProvider", "elevation", "MenuProvider", "onAction", "attendableId", "fullyQualifiedId", "ToolbarMenu", "TypescriptEditor", "id", "env", "initialValue", "extensions", "scrollTo", "selection", "toolbar", "inputMode", "themeMode", "useThemeContext", "parentRef", "focusAttributes", "useTextEditor", "createBasicExtensions", "highlightActiveLine", "indentWithTab", "lineNumbers", "lineWrapping", "scrollPastEnd", "createThemeExtensions", "syntaxHighlighting", "slots", "content", "editorFullWidth", "EditorView", "theme", "marginTop", "background", "InputModeExtensions", "folding", "Prec", "high", "keymap", "of", "continueKeymap", "editorMonospace", "javascript", "typescript", "autocomplete", "override", "tsAutocomplete", "tsFacet", "path", "tsSync", "tsLinter", "tsHover", "renderTooltip", "createTooltipRenderer", "filter", "isNonNullable", "ref", "data-toolbar", "oneDarkHighlightStyle", "defaultHighlightStyle", "classFromKind", "_kind", "kind", "endsWith", "validTag", "tags", "tag", "style", "info", "document", "createElement", "quickInfo", "displayParts", "part", "span", "appendChild", "innerText", "text", "dom", "ScriptContainer", "variant", "settings", "editorInputMode", "identity", "useIdentity", "space", "getSpace", "useMemo", "listener", "onChange", "source", "target", "changed", "createDataExtensions", "createDocAccessor", "useToolbarState", "useDeployState", "StackItem", "Content", "LogsPanel", "mx", "stackItemContentEditorClassNames"]
|
|
7
|
+
}
|
|
@@ -16,32 +16,33 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var artifact_definition_3SNVJ34V_exports = {};
|
|
20
|
+
__export(artifact_definition_3SNVJ34V_exports, {
|
|
21
21
|
default: () => artifact_definition_default
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(artifact_definition_3SNVJ34V_exports);
|
|
24
|
+
var import_chunk_2XX4L67K = require("./chunk-2XX4L67K.cjs");
|
|
25
25
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
26
|
var import_artifact = require("@dxos/artifact");
|
|
27
27
|
var import_assistant = require("@dxos/assistant");
|
|
28
28
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
29
|
-
var
|
|
29
|
+
var import_types = require("@dxos/functions/types");
|
|
30
30
|
var import_invariant = require("@dxos/invariant");
|
|
31
|
-
var
|
|
31
|
+
var import_types2 = require("@dxos/plugin-space/types");
|
|
32
32
|
var import_echo = require("@dxos/react-client/echo");
|
|
33
33
|
var import_schema = require("@dxos/schema");
|
|
34
34
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/capabilities/artifact-definition.ts";
|
|
35
35
|
var artifact_definition_default = () => {
|
|
36
36
|
const definition = (0, import_artifact.defineArtifact)({
|
|
37
|
-
id:
|
|
38
|
-
name:
|
|
37
|
+
id: import_chunk_2XX4L67K.meta.id,
|
|
38
|
+
name: import_chunk_2XX4L67K.meta.name,
|
|
39
39
|
// TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
|
|
40
40
|
// we should offload the work of synthesizing the code to a separate model.
|
|
41
41
|
// The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
|
|
42
42
|
instructions: `
|
|
43
43
|
If the user explicitly requests you to write a script, you can create one.
|
|
44
44
|
If the user requests you to change one of the existing script, you can update it.
|
|
45
|
+
You must not create a script unless the user explicitly requests it.
|
|
45
46
|
Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.
|
|
46
47
|
Each script must follow as strict shape for the definition but the body can contain any valid executable code.
|
|
47
48
|
Scripts are written in JavaScript or TypeScript.
|
|
@@ -147,9 +148,9 @@ var artifact_definition_default = () => {
|
|
|
147
148
|
});
|
|
148
149
|
</example>
|
|
149
150
|
`,
|
|
150
|
-
schema:
|
|
151
|
+
schema: import_types.ScriptType,
|
|
151
152
|
tools: [
|
|
152
|
-
(0, import_artifact.defineTool)(
|
|
153
|
+
(0, import_artifact.defineTool)(import_chunk_2XX4L67K.meta.id, {
|
|
153
154
|
name: "create",
|
|
154
155
|
description: "Create a new script. Returns the artifact definition for the script",
|
|
155
156
|
caption: "Creating script...",
|
|
@@ -164,7 +165,7 @@ var artifact_definition_default = () => {
|
|
|
164
165
|
execute: async ({ name, code }, { extensions }) => {
|
|
165
166
|
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
166
167
|
F: __dxlog_file,
|
|
167
|
-
L:
|
|
168
|
+
L: 153,
|
|
168
169
|
S: void 0,
|
|
169
170
|
A: [
|
|
170
171
|
"extensions?.space",
|
|
@@ -173,14 +174,14 @@ var artifact_definition_default = () => {
|
|
|
173
174
|
});
|
|
174
175
|
(0, import_invariant.invariant)(extensions?.dispatch, "No intent dispatcher", {
|
|
175
176
|
F: __dxlog_file,
|
|
176
|
-
L:
|
|
177
|
+
L: 154,
|
|
177
178
|
S: void 0,
|
|
178
179
|
A: [
|
|
179
180
|
"extensions?.dispatch",
|
|
180
181
|
"'No intent dispatcher'"
|
|
181
182
|
]
|
|
182
183
|
});
|
|
183
|
-
const script = (0, import_echo.create)(
|
|
184
|
+
const script = (0, import_echo.create)(import_types.ScriptType, {
|
|
184
185
|
name,
|
|
185
186
|
source: (0, import_echo.makeRef)((0, import_echo.create)(import_schema.TextType, {
|
|
186
187
|
content: code
|
|
@@ -188,7 +189,7 @@ var artifact_definition_default = () => {
|
|
|
188
189
|
});
|
|
189
190
|
extensions.space.db.add(script);
|
|
190
191
|
await extensions.space.db.flush();
|
|
191
|
-
const intent = (0, import_app_framework.createIntent)(
|
|
192
|
+
const intent = (0, import_app_framework.createIntent)(import_types2.SpaceAction.AddObject, {
|
|
192
193
|
target: extensions.space,
|
|
193
194
|
object: script
|
|
194
195
|
});
|
|
@@ -199,7 +200,7 @@ var artifact_definition_default = () => {
|
|
|
199
200
|
return import_artifact.ToolResult.Success((0, import_assistant.createArtifactElement)(script.id));
|
|
200
201
|
}
|
|
201
202
|
}),
|
|
202
|
-
(0, import_artifact.defineTool)(
|
|
203
|
+
(0, import_artifact.defineTool)(import_chunk_2XX4L67K.meta.id, {
|
|
203
204
|
name: "inspect",
|
|
204
205
|
description: "Inspect a script. Returns the artifact definition for the script",
|
|
205
206
|
caption: "Inspecting script...",
|
|
@@ -209,7 +210,7 @@ var artifact_definition_default = () => {
|
|
|
209
210
|
execute: async ({ id }, { extensions }) => {
|
|
210
211
|
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
211
212
|
F: __dxlog_file,
|
|
212
|
-
L:
|
|
213
|
+
L: 183,
|
|
213
214
|
S: void 0,
|
|
214
215
|
A: [
|
|
215
216
|
"extensions?.space",
|
|
@@ -226,7 +227,7 @@ var artifact_definition_default = () => {
|
|
|
226
227
|
});
|
|
227
228
|
}
|
|
228
229
|
}),
|
|
229
|
-
(0, import_artifact.defineTool)(
|
|
230
|
+
(0, import_artifact.defineTool)(import_chunk_2XX4L67K.meta.id, {
|
|
230
231
|
name: "update",
|
|
231
232
|
description: "Update a script. Returns the artifact definition for the script",
|
|
232
233
|
caption: "Updating script...",
|
|
@@ -239,7 +240,7 @@ var artifact_definition_default = () => {
|
|
|
239
240
|
execute: async ({ id, code }, { extensions }) => {
|
|
240
241
|
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
241
242
|
F: __dxlog_file,
|
|
242
|
-
L:
|
|
243
|
+
L: 205,
|
|
243
244
|
S: void 0,
|
|
244
245
|
A: [
|
|
245
246
|
"extensions?.space",
|
|
@@ -264,4 +265,4 @@ var artifact_definition_default = () => {
|
|
|
264
265
|
});
|
|
265
266
|
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.ArtifactDefinition, definition);
|
|
266
267
|
};
|
|
267
|
-
//# sourceMappingURL=artifact-definition-
|
|
268
|
+
//# sourceMappingURL=artifact-definition-3SNVJ34V.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/artifact-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';\nimport { defineArtifact, defineTool, ToolResult } from '@dxos/artifact';\nimport { createArtifactElement } from '@dxos/assistant';\nimport { ObjectId, S } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions/types';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { create, makeRef, type Space } from '@dxos/react-client/echo';\nimport { TextType } from '@dxos/schema';\n\nimport { meta } from '../meta';\n// TODO(burdon): Factor out.\ndeclare global {\n interface ToolContextExtensions {\n space?: Space;\n dispatch?: PromiseIntentDispatcher;\n }\n}\n\nexport default () => {\n const definition = defineArtifact({\n id: meta.id,\n name: meta.name,\n // TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,\n // we should offload the work of synthesizing the code to a separate model.\n // The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.\n instructions: `\n If the user explicitly requests you to write a script, you can create one.\n If the user requests you to change one of the existing script, you can update it.\n You must not create a script unless the user explicitly requests it.\n Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.\n Each script must follow as strict shape for the definition but the body can contain any valid executable code.\n Scripts are written in JavaScript or TypeScript.\n Each script must define an input schema and output schema.\n Each script must have its own detailed description.\n\n Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.\n\n Description:\n The description is a detailed description of the script.\n It is used to describe the script's purpose, input, and output.\n The description is used to generate the script's documentation.\n The description is also goes into the script metadata.\n The description is used by AI to understand the script and its purpose.\n The description must provide cases on when the script should be used.\n\n Schema: \n The schema is defined using a schema-DSL library called Effect Schema.\n The input schema describes the arguments that the script accepts.\n The output schema describes the result that the script produces.\n The schema is used to validate the script's input and output.\n The schema is also goes into the script metadata.\n The properties in the schema must have valid descriptions.\n The input and output schemas must both be a struct of fields.\n\n Restricts:\n The scripts can only import code from \"dxos:functions\" module. No other modules are allowed.\n Some web APIs are available - like fetch.\n\n Reasoning:\n Before writing a script, synthesize the following information:\n - Description\n - What APIs will be used.\n - Detailed input schema\n - Detailed output schema\n\n <apis>\n export function defineFunction(params: { \n description: string, \n inputSchema: S.Schema, \n outputSchema: S.Schema, \n handler: (params: { event: { data: TInput } }) => Promise<TOutput> \n }): FunctionDefinition\n /**\n * Effect Schema\n */\n export const S; \n\n // Examples: \n\n S.String\n S.Number\n S.Boolean\n S.Struct({\n from: S.String.annotations({ description: 'The source currency' }),\n to: S.String.annotations({ description: 'The target currency' }),\n })\n S.Array(S.String)\n S.Union(S.String, S.Number)\n S.optional(S.String)\n S.String.annotations({ description: 'The source currency' })\n </apis>\n\n <handler_function>\n Async function that takes the argument in the form of:\n\n type HandlerFunctionParam = {\n event: {\n data: T // The input schema\n },\n }\n\n The function must return the result that matches the output schema.\n </handler_function>\n \n <example>\n import { defineFunction, S } from 'dxos:functions';\n\n export default defineFunction({\n description: 'Returns the exchange rate between two currencies.',\n\n inputSchema: S.Struct({\n from: S.String.annotations({ description: 'The source currency' }),\n to: S.String.annotations({ description: 'The target currency' }),\n }),\n\n outputSchema: S.Struct({\n rate: S.String.annotations({ description: 'The exchange rate' }),\n }),\n\n handler: async ({\n event: {\n data: { from, to },\n },\n }: any) => {\n const res = await fetch(\\`https://free.ratesdb.com/v1/rates?from=\\${from}&to=\\${to}\\`);\n const {\n data: { rates },\n } = await res.json();\n\n return { rate: rates[to].toString() };\n },\n });\n </example>\n `,\n schema: ScriptType,\n tools: [\n defineTool(meta.id, {\n name: 'create',\n description: 'Create a new script. Returns the artifact definition for the script',\n caption: 'Creating script...',\n schema: S.Struct({\n name: S.String.annotations({ description: 'The name of the script' }),\n code: S.String.annotations({\n description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',\n }),\n }),\n execute: async ({ name, code }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n invariant(extensions?.dispatch, 'No intent dispatcher');\n const script = create(ScriptType, {\n name,\n source: makeRef(\n create(TextType, {\n content: code,\n }),\n ),\n });\n extensions.space.db.add(script);\n await extensions.space.db.flush();\n\n const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });\n const { data, error } = await extensions.dispatch(intent);\n if (!data || error) {\n return ToolResult.Error(error?.message ?? 'Failed to create chess game');\n }\n\n return ToolResult.Success(createArtifactElement(script.id));\n },\n }),\n defineTool(meta.id, {\n name: 'inspect',\n description: 'Inspect a script. Returns the artifact definition for the script',\n caption: 'Inspecting script...',\n schema: S.Struct({\n id: ObjectId,\n }),\n execute: async ({ id }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n\n const script = (await extensions.space.db.query({ id }).first()) as ScriptType;\n const { content } = await script.source.load();\n\n return ToolResult.Success({\n name: script.name,\n code: content,\n });\n },\n }),\n defineTool(meta.id, {\n name: 'update',\n description: 'Update a script. Returns the artifact definition for the script',\n caption: 'Updating script...',\n schema: S.Struct({\n id: ObjectId,\n code: S.String.annotations({\n description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',\n }),\n }),\n execute: async ({ id, code }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n\n const script = (await extensions.space.db.query({ id }).first()) as ScriptType;\n const source = await script.source.load();\n if (!source) {\n return ToolResult.Error('Script not found');\n }\n\n source.content = code;\n await extensions.space?.db.flush();\n\n return ToolResult.Success({\n name: script.name,\n });\n },\n }),\n ],\n });\n\n return contributes(Capabilities.ArtifactDefinition, definition);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAAsF;AACtF,sBAAuD;AACvD,uBAAsC;AACtC,yBAA4B;AAC5B,mBAA2B;AAC3B,uBAA0B;AAC1B,IAAAA,gBAA4B;AAC5B,kBAA4C;AAC5C,oBAAyB;;AAWzB,IAAA,8BAAe,MAAA;AACb,QAAMC,iBAAaC,gCAAe;IAChCC,IAAIC,2BAAKD;IACTE,MAAMD,2BAAKC;;;;IAIXC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6GdC,QAAQC;IACRC,OAAO;UACLC,4BAAWN,2BAAKD,IAAI;QAClBE,MAAM;QACNM,aAAa;QACbC,SAAS;QACTL,QAAQM,qBAAEC,OAAO;UACfT,MAAMQ,qBAAEE,OAAOC,YAAY;YAAEL,aAAa;UAAyB,CAAA;UACnEM,MAAMJ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AA;UACAlB,4BAAWN,2BAAKD,IAAI;QAClBE,MAAM;QACNM,aAAa;QACbC,SAAS;QACTL,QAAQM,qBAAEC,OAAO;UACfX,IAAI0C;UACJ5B,MAAMJ,qBAAEE,OAAOC,YAAY;YACzBL,aAAa;UACf,CAAA;QACF,CAAA;QACAO,SAAS,OAAO,EAAEf,IAAIc,KAAI,GAAI,EAAEE,WAAU,MAAE;AAC1CC,0CAAUD,YAAYE,OAAO,YAAA;;;;;;;;;AAE7B,gBAAME,SAAU,MAAMJ,WAAWE,MAAMQ,GAAGiB,MAAM;YAAE3C;UAAG,CAAA,EAAG4C,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;YACxBtC,MAAMkB,OAAOlB;UACf,CAAA;QACF;MACF,CAAA;;EAEJ,CAAA;AAEA,aAAO4C,kCAAYC,kCAAaC,oBAAoBlD,UAAAA;AACtD;",
|
|
6
|
+
"names": ["import_types", "definition", "defineArtifact", "id", "meta", "name", "instructions", "schema", "ScriptType", "tools", "defineTool", "description", "caption", "S", "Struct", "String", "annotations", "code", "execute", "extensions", "invariant", "space", "dispatch", "script", "create", "source", "makeRef", "TextType", "content", "db", "add", "flush", "intent", "createIntent", "SpaceAction", "AddObject", "target", "object", "data", "error", "ToolResult", "Error", "message", "Success", "createArtifactElement", "ObjectId", "query", "first", "load", "contributes", "Capabilities", "ArtifactDefinition"]
|
|
7
|
+
}
|
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_2XX4L67K_exports = {};
|
|
20
|
+
__export(chunk_2XX4L67K_exports, {
|
|
21
21
|
SCRIPT_PLUGIN: () => SCRIPT_PLUGIN,
|
|
22
22
|
meta: () => meta
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(chunk_2XX4L67K_exports);
|
|
25
25
|
var SCRIPT_PLUGIN = "dxos.org/plugin/script";
|
|
26
26
|
var meta = {
|
|
27
27
|
id: SCRIPT_PLUGIN,
|
|
@@ -41,4 +41,4 @@ var meta = {
|
|
|
41
41
|
SCRIPT_PLUGIN,
|
|
42
42
|
meta
|
|
43
43
|
});
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-2XX4L67K.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SCRIPT_PLUGIN = 'dxos.org/plugin/script';\n\nexport const meta: PluginMeta = {\n id: SCRIPT_PLUGIN,\n name: 'Scripts',\n description:\n 'Scripts in Composer allow you to deploy custom functions that run on the edge. These functions can be referenced by your AI agent and called inside of cells in any Sheet. Use scripts to interact with API’s or external data inside of Composer.',\n icon: 'ph--code--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer',\n tags: ['experimental'],\n screenshots: ['https://dxos.network/plugin-details-scripts-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,gBAAgB;AAEtB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
|
+
"names": ["SCRIPT_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags", "screenshots"]
|
|
7
|
+
}
|
|
@@ -16,19 +16,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_AOKGOI5J_exports = {};
|
|
20
|
+
__export(chunk_AOKGOI5J_exports, {
|
|
21
21
|
ScriptCapabilities: () => ScriptCapabilities
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_AOKGOI5J_exports);
|
|
24
|
+
var import_chunk_2XX4L67K = require("./chunk-2XX4L67K.cjs");
|
|
25
25
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
26
|
var ScriptCapabilities;
|
|
27
27
|
(function(ScriptCapabilities2) {
|
|
28
|
-
ScriptCapabilities2.Compiler = (0, import_app_framework.defineCapability)(`${
|
|
28
|
+
ScriptCapabilities2.Compiler = (0, import_app_framework.defineCapability)(`${import_chunk_2XX4L67K.SCRIPT_PLUGIN}/capability/compiler`);
|
|
29
29
|
})(ScriptCapabilities || (ScriptCapabilities = {}));
|
|
30
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
31
|
0 && (module.exports = {
|
|
32
32
|
ScriptCapabilities
|
|
33
33
|
});
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-AOKGOI5J.cjs.map
|
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_MSH4SVCN_exports = {};
|
|
30
|
+
__export(chunk_MSH4SVCN_exports, {
|
|
31
31
|
LogsPanel: () => LogsPanel,
|
|
32
32
|
createDeploy: () => createDeploy,
|
|
33
33
|
createFormat: () => createFormat,
|
|
@@ -37,9 +37,9 @@ __export(chunk_DA6RBNFV_exports, {
|
|
|
37
37
|
useToolbarAction: () => useToolbarAction,
|
|
38
38
|
useToolbarState: () => useToolbarState
|
|
39
39
|
});
|
|
40
|
-
module.exports = __toCommonJS(
|
|
41
|
-
var
|
|
42
|
-
var
|
|
40
|
+
module.exports = __toCommonJS(chunk_MSH4SVCN_exports);
|
|
41
|
+
var import_chunk_XCQNFRZ6 = require("./chunk-XCQNFRZ6.cjs");
|
|
42
|
+
var import_chunk_2XX4L67K = require("./chunk-2XX4L67K.cjs");
|
|
43
43
|
var import_react = require("react");
|
|
44
44
|
var import_functions = require("@dxos/functions");
|
|
45
45
|
var import_bundler = require("@dxos/functions/bundler");
|
|
@@ -57,15 +57,18 @@ var import_react3 = require("react");
|
|
|
57
57
|
var import_log2 = require("@dxos/log");
|
|
58
58
|
var import_react_ui_menu2 = require("@dxos/react-ui-menu");
|
|
59
59
|
var import_react4 = require("react");
|
|
60
|
-
var
|
|
60
|
+
var import_types = require("@dxos/functions/types");
|
|
61
61
|
var import_live_object2 = require("@dxos/live-object");
|
|
62
62
|
var import_react_ui_menu3 = require("@dxos/react-ui-menu");
|
|
63
63
|
var import_react_ui_menu4 = require("@dxos/react-ui-menu");
|
|
64
64
|
var import_react5 = require("react");
|
|
65
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
65
66
|
var import_log3 = require("@dxos/log");
|
|
67
|
+
var import_types2 = require("@dxos/plugin-deck/types");
|
|
68
|
+
var import_echo2 = require("@dxos/react-client/echo");
|
|
66
69
|
var import_react6 = __toESM(require("react"));
|
|
67
70
|
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
68
|
-
var
|
|
71
|
+
var import_echo3 = require("@dxos/react-client/echo");
|
|
69
72
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
70
73
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
71
74
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/hooks/deploy.ts";
|
|
@@ -74,7 +77,7 @@ var createDeploy = (state) => {
|
|
|
74
77
|
label: state.error ?? [
|
|
75
78
|
"no error label",
|
|
76
79
|
{
|
|
77
|
-
ns:
|
|
80
|
+
ns: import_chunk_2XX4L67K.SCRIPT_PLUGIN
|
|
78
81
|
}
|
|
79
82
|
],
|
|
80
83
|
icon: "ph--warning-circle--regular",
|
|
@@ -85,7 +88,7 @@ var createDeploy = (state) => {
|
|
|
85
88
|
label: [
|
|
86
89
|
state.deploying ? "pending label" : "deploy label",
|
|
87
90
|
{
|
|
88
|
-
ns:
|
|
91
|
+
ns: import_chunk_2XX4L67K.SCRIPT_PLUGIN
|
|
89
92
|
}
|
|
90
93
|
],
|
|
91
94
|
icon: state.deploying ? "ph--spinner-gap--regular" : "ph--cloud-arrow-up--regular",
|
|
@@ -97,7 +100,7 @@ var createDeploy = (state) => {
|
|
|
97
100
|
label: [
|
|
98
101
|
"copy link label",
|
|
99
102
|
{
|
|
100
|
-
ns:
|
|
103
|
+
ns: import_chunk_2XX4L67K.SCRIPT_PLUGIN
|
|
101
104
|
}
|
|
102
105
|
],
|
|
103
106
|
icon: "ph--link--regular",
|
|
@@ -167,7 +170,7 @@ var useDeployHandler = ({ state, script }) => {
|
|
|
167
170
|
const { space, fn, client, existingFunctionUrl } = useDeployDeps({
|
|
168
171
|
script
|
|
169
172
|
});
|
|
170
|
-
const { t } = (0, import_react_ui.useTranslation)(
|
|
173
|
+
const { t } = (0, import_react_ui.useTranslation)(import_chunk_2XX4L67K.SCRIPT_PLUGIN);
|
|
171
174
|
return (0, import_react.useCallback)(async () => {
|
|
172
175
|
if (!script.source || !space) {
|
|
173
176
|
return;
|
|
@@ -248,17 +251,16 @@ var useDeployHandler = ({ state, script }) => {
|
|
|
248
251
|
functionId
|
|
249
252
|
}, {
|
|
250
253
|
F: __dxlog_file,
|
|
251
|
-
L:
|
|
254
|
+
L: 150,
|
|
252
255
|
S: void 0,
|
|
253
256
|
C: (f, a) => f(...a)
|
|
254
257
|
});
|
|
255
258
|
}
|
|
256
259
|
(0, import_functions.setUserFunctionUrlInMetadata)((0, import_echo.getMeta)(deployedFunction), `/${space.id}/${functionId}`);
|
|
257
|
-
state.view = "split";
|
|
258
260
|
} catch (err) {
|
|
259
261
|
import_log.log.catch(err, void 0, {
|
|
260
262
|
F: __dxlog_file,
|
|
261
|
-
L:
|
|
263
|
+
L: 155,
|
|
262
264
|
S: void 0,
|
|
263
265
|
C: (f, a) => f(...a)
|
|
264
266
|
});
|
|
@@ -293,7 +295,7 @@ var createFormat = () => {
|
|
|
293
295
|
label: [
|
|
294
296
|
"format label",
|
|
295
297
|
{
|
|
296
|
-
ns:
|
|
298
|
+
ns: import_chunk_2XX4L67K.SCRIPT_PLUGIN
|
|
297
299
|
}
|
|
298
300
|
],
|
|
299
301
|
icon: "ph--magic-wand--regular"
|
|
@@ -340,14 +342,14 @@ var createTemplateSelectGroup = () => {
|
|
|
340
342
|
label: [
|
|
341
343
|
"template select group label",
|
|
342
344
|
{
|
|
343
|
-
ns:
|
|
345
|
+
ns: import_chunk_2XX4L67K.SCRIPT_PLUGIN
|
|
344
346
|
}
|
|
345
347
|
],
|
|
346
348
|
variant: "dropdownMenu"
|
|
347
349
|
});
|
|
348
350
|
};
|
|
349
351
|
var createTemplateSelectActions = () => {
|
|
350
|
-
return
|
|
352
|
+
return import_chunk_XCQNFRZ6.templates.map((template) => {
|
|
351
353
|
return (0, import_react_ui_menu3.createMenuAction)(`template--${template.id}`, {
|
|
352
354
|
label: template.name,
|
|
353
355
|
value: template.id,
|
|
@@ -377,18 +379,18 @@ var createTemplateSelect = () => {
|
|
|
377
379
|
};
|
|
378
380
|
var useTemplateSelectHandler = ({ script }) => {
|
|
379
381
|
return (0, import_react4.useCallback)((templateId) => {
|
|
380
|
-
const template =
|
|
382
|
+
const template = import_chunk_XCQNFRZ6.templates.find((template2) => template2.id === templateId);
|
|
381
383
|
if (template) {
|
|
382
384
|
script.name = template.name;
|
|
383
385
|
script.source.target.content = template.source;
|
|
384
386
|
const metaKeys = (0, import_live_object2.getMeta)(script).keys;
|
|
385
|
-
const oldPresetIndex = metaKeys.findIndex((key) => key.source ===
|
|
387
|
+
const oldPresetIndex = metaKeys.findIndex((key) => key.source === import_types.FUNCTIONS_PRESET_META_KEY);
|
|
386
388
|
if (oldPresetIndex >= 0) {
|
|
387
389
|
metaKeys.splice(oldPresetIndex, 1);
|
|
388
390
|
}
|
|
389
391
|
if (template.presetId) {
|
|
390
392
|
metaKeys.push({
|
|
391
|
-
source:
|
|
393
|
+
source: import_types.FUNCTIONS_PRESET_META_KEY,
|
|
392
394
|
id: template.presetId
|
|
393
395
|
});
|
|
394
396
|
}
|
|
@@ -398,23 +400,10 @@ var useTemplateSelectHandler = ({ script }) => {
|
|
|
398
400
|
]);
|
|
399
401
|
};
|
|
400
402
|
var views = {
|
|
401
|
-
editor:
|
|
402
|
-
split:
|
|
403
|
+
// editor: 'ph--code--regular',
|
|
404
|
+
// split: 'ph--square-split-vertical--regular',
|
|
403
405
|
logs: "ph--clock-counter-clockwise--regular"
|
|
404
406
|
};
|
|
405
|
-
var createViewGroupItem = (state) => {
|
|
406
|
-
return (0, import_react_ui_menu4.createMenuItemGroup)("view", {
|
|
407
|
-
label: [
|
|
408
|
-
"view group label",
|
|
409
|
-
{
|
|
410
|
-
ns: import_chunk_5UH3F7TA.SCRIPT_PLUGIN
|
|
411
|
-
}
|
|
412
|
-
],
|
|
413
|
-
variant: "dropdownMenu",
|
|
414
|
-
applyActive: true,
|
|
415
|
-
value: state.view
|
|
416
|
-
});
|
|
417
|
-
};
|
|
418
407
|
var createViewActions = (state) => {
|
|
419
408
|
return Object.entries(views).map(([viewType, icon]) => {
|
|
420
409
|
return (0, import_react_ui_menu4.createMenuAction)(`view--${viewType}`, {
|
|
@@ -423,32 +412,21 @@ var createViewActions = (state) => {
|
|
|
423
412
|
label: [
|
|
424
413
|
`view ${viewType} label`,
|
|
425
414
|
{
|
|
426
|
-
ns:
|
|
415
|
+
ns: import_chunk_2XX4L67K.SCRIPT_PLUGIN
|
|
427
416
|
}
|
|
428
417
|
],
|
|
429
|
-
icon
|
|
430
|
-
checked: state.view === viewType
|
|
418
|
+
icon
|
|
431
419
|
});
|
|
432
420
|
});
|
|
433
421
|
};
|
|
434
422
|
var createView = (state) => {
|
|
435
|
-
const viewGroupItem = createViewGroupItem(state);
|
|
436
423
|
const viewActions = createViewActions(state);
|
|
437
424
|
return {
|
|
438
|
-
nodes:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
{
|
|
444
|
-
source: "root",
|
|
445
|
-
target: "view"
|
|
446
|
-
},
|
|
447
|
-
...viewActions.map((action) => ({
|
|
448
|
-
source: "view",
|
|
449
|
-
target: action.id
|
|
450
|
-
}))
|
|
451
|
-
]
|
|
425
|
+
nodes: viewActions,
|
|
426
|
+
edges: viewActions.map((action) => ({
|
|
427
|
+
source: "root",
|
|
428
|
+
target: action.id
|
|
429
|
+
}))
|
|
452
430
|
};
|
|
453
431
|
};
|
|
454
432
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/hooks/useToolbarAction.ts";
|
|
@@ -457,14 +435,18 @@ var useToolbarAction = (props) => {
|
|
|
457
435
|
const handleFormat = useFormatHandler(props);
|
|
458
436
|
const handleDeploy = useDeployHandler(props);
|
|
459
437
|
const handleCopy = useCopyHandler(props);
|
|
438
|
+
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
460
439
|
return (0, import_react5.useCallback)((action) => {
|
|
461
440
|
switch (action.properties.type) {
|
|
441
|
+
case "view":
|
|
442
|
+
void dispatch((0, import_app_framework.createIntent)(import_types2.DeckAction.ChangeCompanion, {
|
|
443
|
+
primary: (0, import_echo2.fullyQualifiedId)(props.script),
|
|
444
|
+
companion: (0, import_types2.surfaceVariant)("logs")
|
|
445
|
+
}));
|
|
446
|
+
break;
|
|
462
447
|
case "template":
|
|
463
448
|
handleTemplateSelect(action.properties.value);
|
|
464
449
|
break;
|
|
465
|
-
case "view":
|
|
466
|
-
props.state.view = action.properties.value;
|
|
467
|
-
break;
|
|
468
450
|
case "format":
|
|
469
451
|
void handleFormat();
|
|
470
452
|
break;
|
|
@@ -477,7 +459,7 @@ var useToolbarAction = (props) => {
|
|
|
477
459
|
default:
|
|
478
460
|
import_log3.log.error("Unknown action type", action, {
|
|
479
461
|
F: __dxlog_file3,
|
|
480
|
-
L:
|
|
462
|
+
L: 58,
|
|
481
463
|
S: void 0,
|
|
482
464
|
C: (f, a) => f(...a)
|
|
483
465
|
});
|
|
@@ -490,12 +472,11 @@ var useToolbarAction = (props) => {
|
|
|
490
472
|
]);
|
|
491
473
|
};
|
|
492
474
|
var LogsPanel = ({ script, classNames }) => {
|
|
493
|
-
const { t } = (0, import_react_ui2.useTranslation)(
|
|
475
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_2XX4L67K.SCRIPT_PLUGIN);
|
|
494
476
|
const { space, existingFunctionUrl } = useDeployDeps({
|
|
495
477
|
script
|
|
496
478
|
});
|
|
497
|
-
const
|
|
498
|
-
const invocationTraceQueue = (0, import_react_edge_client.useQueue)(edgeClient, space?.properties.invocationTraceQueue?.dxn, {
|
|
479
|
+
const invocationTraceQueue = (0, import_echo3.useQueue)(space?.properties.invocationTraceQueue?.dxn, {
|
|
499
480
|
pollInterval: 500
|
|
500
481
|
});
|
|
501
482
|
const [selected, setSelected] = (0, import_react6.useState)();
|
|
@@ -516,8 +497,7 @@ var LogsPanel = ({ script, classNames }) => {
|
|
|
516
497
|
})));
|
|
517
498
|
};
|
|
518
499
|
var InvocationTraceItem = ({ trace, open, setOpen }) => {
|
|
519
|
-
const
|
|
520
|
-
const eventQueue = (0, import_react_edge_client.useQueue)(edgeClient, open ? (0, import_echo_protocol.decodeReference)(trace.invocationTraceQueue).dxn : void 0);
|
|
500
|
+
const eventQueue = (0, import_echo3.useQueue)(open ? (0, import_echo_protocol.decodeReference)(trace.invocationTraceQueue).dxn : void 0);
|
|
521
501
|
const handleOpenChange = (0, import_react6.useCallback)((open2) => {
|
|
522
502
|
setOpen?.(trace, open2);
|
|
523
503
|
}, [
|
|
@@ -561,4 +541,4 @@ var InvocationTraceItem = ({ trace, open, setOpen }) => {
|
|
|
561
541
|
useToolbarAction,
|
|
562
542
|
useToolbarState
|
|
563
543
|
});
|
|
564
|
-
//# sourceMappingURL=chunk-
|
|
544
|
+
//# sourceMappingURL=chunk-MSH4SVCN.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/deploy.ts", "../../../src/hooks/useToolbarState.ts", "../../../src/hooks/format.ts", "../../../src/hooks/template.ts", "../../../src/hooks/view.ts", "../../../src/hooks/useToolbarAction.ts", "../../../src/components/LogsPanel/LogsPanel.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useEffect, useMemo } from 'react';\n\nimport {\n FunctionType,\n type ScriptType,\n getInvocationUrl,\n getUserFunctionUrlInMetadata,\n incrementSemverPatch,\n setUserFunctionUrlInMetadata,\n uploadWorkerFunction,\n} from '@dxos/functions';\nimport { Bundler } from '@dxos/functions/bundler';\nimport { log } from '@dxos/log';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, create, getMeta, getSpace, makeRef, useQuery } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { type ViewState } from './view';\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };\n\nexport type DeployState = ViewState & {\n deploying: boolean;\n deployed: boolean;\n functionUrl: string;\n error: string;\n};\n\nexport const createDeploy = (state: Partial<DeployState>) => {\n const errorItem = createMenuAction('error', {\n label: state.error ?? ['no error label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--warning-circle--regular',\n hidden: !state.error,\n });\n\n const deployAction = createMenuAction<DeployActionProperties>('deploy', {\n type: 'deploy',\n label: [state.deploying ? 'pending label' : 'deploy label', { ns: SCRIPT_PLUGIN }],\n icon: state.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',\n disabled: state.deploying,\n classNames: state.deploying ? '[&_svg]:animate-spin' : '',\n });\n\n const copyAction = createMenuAction<DeployActionProperties>('copy', {\n type: 'copy',\n label: ['copy link label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--link--regular',\n disabled: !state.functionUrl,\n });\n\n return {\n nodes: [errorItem, deployAction, copyAction],\n edges: [\n { source: 'root', target: 'error' },\n { source: 'root', target: 'deploy' },\n { source: 'root', target: 'copy' },\n ],\n };\n};\n\nexport const useDeployDeps = ({ script }: { script: ScriptType }) => {\n const space = getSpace(script);\n const [fn] = useQuery(space, Filter.schema(FunctionType, { source: script }));\n const client = useClient();\n const existingFunctionUrl = useMemo(() => fn && getUserFunctionUrlInMetadata(getMeta(fn)), [fn]);\n return { space, fn, client, existingFunctionUrl };\n};\n\nexport const useDeployState = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, client, existingFunctionUrl } = useDeployDeps({ script });\n useEffect(() => {\n if (!existingFunctionUrl) {\n return;\n }\n\n state.functionUrl = getInvocationUrl(existingFunctionUrl, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n });\n }, [existingFunctionUrl, space]);\n\n useEffect(() => {\n state.deployed = Boolean(existingFunctionUrl) && !script.changed;\n }, [script.changed, existingFunctionUrl]);\n};\n\nexport const useDeployHandler = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, fn, client, existingFunctionUrl } = useDeployDeps({ script });\n const { t } = useTranslation(SCRIPT_PLUGIN);\n\n return useCallback(async () => {\n if (!script.source || !space) {\n return;\n }\n\n state.error = undefined;\n state.deploying = true;\n\n try {\n const existingFunctionId = existingFunctionUrl?.split('/').at(-1);\n\n const bundler = new Bundler({ platform: 'browser', sandboxedModules: [], remoteModules: {} });\n const buildResult = await bundler.bundle({ source: script.source.target!.content });\n if (buildResult.error || !buildResult.bundle) {\n throw buildResult.error;\n }\n\n const { functionId, version, meta } = await uploadWorkerFunction({\n client,\n spaceId: space.id,\n version: fn ? incrementSemverPatch(fn.version) : '0.0.1',\n functionId: existingFunctionId,\n source: buildResult.bundle,\n });\n if (functionId === undefined || version === undefined) {\n throw new Error(`Upload didn't return expected data: functionId=${functionId}, version=${version}`);\n }\n\n log.info('function uploaded', { functionId, version });\n if (fn) {\n fn.version = version;\n }\n\n const deployedFunction =\n fn ?? space.db.add(create(FunctionType, { name: functionId, version, source: makeRef(script) }));\n\n script.changed = false;\n if (script.description !== undefined && script.description.trim() !== '') {\n deployedFunction.description = script.description;\n } else if (meta.description) {\n deployedFunction.description = meta.description;\n } else {\n log.verbose('no description in function metadata', { functionId });\n }\n\n if (meta.inputSchema) {\n deployedFunction.inputSchema = meta.inputSchema;\n } else {\n log.verbose('no input schema in function metadata', { functionId });\n }\n\n if (meta.outputSchema) {\n deployedFunction.outputSchema = meta.outputSchema;\n } else {\n log.verbose('no output schema in function metadata', { functionId });\n }\n\n setUserFunctionUrlInMetadata(getMeta(deployedFunction), `/${space.id}/${functionId}`);\n } catch (err: any) {\n log.catch(err);\n state.error = t('upload failed label');\n }\n state.deploying = false;\n }, [fn, client, t, existingFunctionUrl, script, script.name, script.source, space?.id ?? null]);\n};\n\nexport const useCopyHandler = ({ state }: { state: Partial<DeployState> }) =>\n useCallback(async () => {\n if (!state.functionUrl) {\n return;\n }\n await navigator.clipboard.writeText(state.functionUrl);\n }, [state.functionUrl]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { create } from '@dxos/live-object';\n\nimport { type DeployState } from './deploy';\n\nexport type ScriptToolbarState = Partial<DeployState>;\n\n// TODO(burdon): Replace with context provider?\nexport const useToolbarState = (initialState: ScriptToolbarState = {}) => {\n return useMemo(() => create<ScriptToolbarState>(initialState), []);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { format } from 'prettier';\nimport prettierPluginEstree from 'prettier/plugins/estree';\nimport prettierPluginTypescript from 'prettier/plugins/typescript';\nimport { useCallback } from 'react';\n\nimport { type ScriptType } from '@dxos/functions/types';\nimport { log } from '@dxos/log';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type FormatActionProperties = { type: 'format' };\n\nexport const createFormat = () => {\n const formatAction = createMenuAction('format', {\n label: ['format label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n });\n\n return {\n nodes: [formatAction],\n edges: [{ source: 'root', target: 'format' }],\n };\n};\n\nexport const useFormatHandler = ({ script }: { script: ScriptType }) =>\n useCallback(async () => {\n if (!script.source) {\n return;\n }\n\n try {\n script.source.target!.content = await format(script.source.target!.content, {\n parser: 'typescript',\n plugins: [prettierPluginEstree, prettierPluginTypescript],\n semi: true,\n singleQuote: true,\n });\n } catch (err: any) {\n // TODO(wittjosiah): Show error in UI.\n log.catch(err);\n }\n }, [script.source]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { FUNCTIONS_PRESET_META_KEY, type ScriptType } from '@dxos/functions/types';\nimport { getMeta } from '@dxos/live-object';\nimport { createMenuItemGroup, createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { templates } from '../templates';\n\nexport type TemplateActionProperties = { type: 'template'; value: string };\n\nconst createTemplateSelectGroup = () => {\n return createMenuItemGroup('template-select', {\n label: ['template select group label', { ns: SCRIPT_PLUGIN }],\n variant: 'dropdownMenu',\n });\n};\n\nconst createTemplateSelectActions = () => {\n return templates.map((template) => {\n return createMenuAction<TemplateActionProperties>(`template--${template.id}`, {\n label: template.name,\n value: template.id,\n type: 'template',\n });\n });\n};\n\nexport const createTemplateSelect = () => {\n const templateSelectGroup = createTemplateSelectGroup();\n const templateSelectActions = createTemplateSelectActions();\n return {\n nodes: [templateSelectGroup, ...templateSelectActions],\n edges: [\n { source: 'root', target: 'template-select' },\n ...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id })),\n ],\n };\n};\n\nexport const useTemplateSelectHandler = ({ script }: { script: ScriptType }) => {\n return useCallback(\n (templateId: string) => {\n const template = templates.find((template) => template.id === templateId);\n if (template) {\n script.name = template.name;\n script.source!.target!.content = template.source;\n const metaKeys = getMeta(script).keys;\n const oldPresetIndex = metaKeys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);\n if (oldPresetIndex >= 0) {\n metaKeys.splice(oldPresetIndex, 1);\n }\n if (template.presetId) {\n metaKeys.push({ source: FUNCTIONS_PRESET_META_KEY, id: template.presetId });\n }\n }\n },\n [script],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type ViewType = /* 'editor' | 'split' | */ 'logs';\n\nexport type ViewState = { view: ViewType };\n\nexport type ViewActionProperties = { type: 'view'; value: ViewType };\n\nconst views: Record<ViewType, string> = {\n // editor: 'ph--code--regular',\n // split: 'ph--square-split-vertical--regular',\n logs: 'ph--clock-counter-clockwise--regular',\n};\n\nconst createViewActions = (state: Partial<ViewState>) => {\n return Object.entries(views).map(([viewType, icon]) => {\n return createMenuAction<ViewActionProperties>(`view--${viewType}`, {\n type: 'view',\n value: viewType as ViewType,\n label: [`view ${viewType} label`, { ns: SCRIPT_PLUGIN }],\n icon,\n });\n });\n};\n\nexport const createView = (state: Partial<ViewState>) => {\n const viewActions = createViewActions(state);\n return {\n nodes: viewActions,\n edges: viewActions.map((action) => ({ source: 'root', target: action.id })),\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { type ScriptType } from '@dxos/functions/types';\nimport { log } from '@dxos/log';\nimport { DeckAction, surfaceVariant } from '@dxos/plugin-deck/types';\nimport { fullyQualifiedId } from '@dxos/react-client/echo';\nimport { type MenuAction, type MenuActionHandler } from '@dxos/react-ui-menu';\n\nimport { type DeployActionProperties, useDeployHandler, useCopyHandler } from './deploy';\nimport { type FormatActionProperties, useFormatHandler } from './format';\nimport { type TemplateActionProperties, useTemplateSelectHandler } from './template';\nimport { type ScriptToolbarState } from './useToolbarState';\nimport { type ViewActionProperties } from './view';\n\nexport type ScriptToolbarActionProperties =\n | TemplateActionProperties\n | ViewActionProperties\n | FormatActionProperties\n | DeployActionProperties;\n\nexport type ScriptToolbarAction = MenuAction<ScriptToolbarActionProperties>;\n\nexport const useToolbarAction = (props: { state: ScriptToolbarState; script: ScriptType }) => {\n const handleTemplateSelect = useTemplateSelectHandler(props);\n const handleFormat = useFormatHandler(props);\n const handleDeploy = useDeployHandler(props);\n const handleCopy = useCopyHandler(props);\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n return useCallback(\n ((action: ScriptToolbarAction) => {\n switch (action.properties.type) {\n case 'view':\n void dispatch(\n createIntent(DeckAction.ChangeCompanion, {\n primary: fullyQualifiedId(props.script),\n companion: surfaceVariant('logs'),\n }),\n );\n break;\n case 'template':\n handleTemplateSelect(action.properties.value);\n break;\n case 'format':\n void handleFormat();\n break;\n case 'deploy':\n void handleDeploy();\n break;\n case 'copy':\n void handleCopy();\n break;\n default:\n log.error('Unknown action type', action);\n }\n }) as MenuActionHandler,\n [handleTemplateSelect, handleFormat, handleDeploy, handleCopy],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { decodeReference } from '@dxos/echo-protocol';\nimport { type InvocationTraceEvent, type ScriptType, type TraceEvent } from '@dxos/functions/types';\nimport { useQueue } from '@dxos/react-client/echo';\nimport { Icon, List, ListItem, useTranslation, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { useDeployDeps } from '../../hooks';\nimport { SCRIPT_PLUGIN } from '../../meta';\n\nexport type LogsPanelProps = ThemedClassName<{\n script: ScriptType;\n}>;\n\nexport const LogsPanel = ({ script, classNames }: LogsPanelProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n // TODO(wittjosiah): Refactor these hooks.\n const { space, existingFunctionUrl } = useDeployDeps({ script });\n const invocationTraceQueue = useQueue<InvocationTraceEvent>(space?.properties.invocationTraceQueue?.dxn, {\n pollInterval: 500,\n });\n const [selected, setSelected] = useState<InvocationTraceEvent>();\n const workerDxn = `dxn:worker:${existingFunctionUrl?.split('/').at(-1)}`;\n\n if (!invocationTraceQueue) {\n return <div>{t('no invocations message')}</div>;\n }\n\n const handleOpenChange = useCallback((trace: InvocationTraceEvent, open: boolean) => {\n setSelected(open ? trace : undefined);\n }, []);\n\n return (\n <List classNames={mx('overflow-y-auto', classNames)}>\n {invocationTraceQueue.items\n .filter((trace) => decodeReference(trace.invocationTarget).dxn?.toString() === workerDxn)\n .map((trace) => (\n <InvocationTraceItem\n key={trace.id}\n trace={trace}\n open={selected?.id === trace.id}\n setOpen={handleOpenChange}\n />\n ))}\n </List>\n );\n};\n\nconst InvocationTraceItem = ({\n trace,\n open,\n setOpen,\n}: {\n trace: InvocationTraceEvent;\n open?: boolean;\n setOpen?: (trace: InvocationTraceEvent, open: boolean) => void;\n}) => {\n const eventQueue = useQueue<TraceEvent>(open ? decodeReference(trace.invocationTraceQueue).dxn : undefined);\n\n const handleOpenChange = useCallback(\n (open: boolean) => {\n setOpen?.(trace, open);\n },\n [trace, setOpen],\n );\n\n const logs = useMemo(() => eventQueue?.items.flatMap((event) => event.logs), [eventQueue?.items]);\n const heading =\n 'bodyText' in trace.input && typeof trace.input.bodyText === 'string'\n ? trace.input.bodyText\n : JSON.stringify(trace.input);\n\n return (\n <ListItem.Root key={trace.id} collapsible open={open} onOpenChange={handleOpenChange}>\n <div className='flex items-center gap-2'>\n <ListItem.OpenTrigger />\n <ListItem.Endcap classNames='flex items-center justify-center'>\n <Icon icon={trace.outcome === 'success' ? 'ph--check--regular' : 'ph--x--regular'} size={5} />\n </ListItem.Endcap>\n <ListItem.Heading classNames='flex-1 flex items-center gap-2 truncate'>\n <span>{new Date(trace.timestampMs).toLocaleString()}</span>\n <span>{heading}</span>\n </ListItem.Heading>\n </div>\n {logs && (\n <ListItem.CollapsibleContent>\n <div className='flex items-center gap-2'>\n <span>Duration:</span>\n <span>{trace.durationMs}ms</span>\n </div>\n <pre>\n <div>{JSON.stringify(trace.input, null, 2)}</div>\n {logs.map((log, index) => {\n return <div key={index}>{JSON.stringify(log, null, 2)}</div>;\n })}\n </pre>\n </ListItem.CollapsibleContent>\n )}\n </ListItem.Root>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAgD;AAEhD,uBAQO;AACP,qBAAwB;AACxB,iBAAoB;AACpB,0BAA0B;AAC1B,kBAAqE;AACrE,sBAA+B;AAC/B,2BAAiC;AChBjC,IAAAA,gBAAwB;AAExB,yBAAuB;ACFvB,sBAAuB;AACvB,oBAAiC;AACjC,wBAAqC;AACrC,IAAAA,gBAA4B;AAG5B,IAAAC,cAAoB;AACpB,IAAAC,wBAAiC;ACPjC,IAAAF,gBAA4B;AAE5B,mBAA2D;AAC3D,IAAAG,sBAAwB;AACxB,IAAAD,wBAAsD;ACJtD,IAAAA,wBAAiC;ACAjC,IAAAF,gBAA4B;AAE5B,2BAAkD;AAElD,IAAAC,cAAoB;AACpB,IAAAG,gBAA2C;AAC3C,IAAAC,eAAiC;ACNjC,IAAAL,gBAAsD;AAEtD,2BAAgC;AAEhC,IAAAK,eAAyB;AACzB,IAAAC,mBAA2E;AAC3E,4BAAm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A,CAAA,CAAA,CAAA;AAMZ;",
|
|
6
|
+
"names": ["import_react", "import_log", "import_react_ui_menu", "import_live_object", "import_types", "import_echo", "import_react_ui", "createDeploy", "state", "errorItem", "createMenuAction", "label", "error", "ns", "SCRIPT_PLUGIN", "icon", "hidden", "deployAction", "type", "deploying", "disabled", "classNames", "copyAction", "functionUrl", "nodes", "edges", "source", "target", "useDeployDeps", "script", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "client", "useClient", "existingFunctionUrl", "useMemo", "getUserFunctionUrlInMetadata", "getMeta", "useDeployState", "useEffect", "getInvocationUrl", "config", "values", "runtime", "services", "edge", "url", "spaceId", "id", "deployed", "Boolean", "changed", "useDeployHandler", "t", "useTranslation", "useCallback", "undefined", "existingFunctionId", "split", "at", "bundler", "Bundler", "platform", "sandboxedModules", "remoteModules", "buildResult", "bundle", "content", "functionId", "version", "meta", "uploadWorkerFunction", "incrementSemverPatch", "Error", "log", "info", "deployedFunction", "db", "add", "create", "name", "makeRef", "description", "trim", "verbose", "inputSchema", "outputSchema", "setUserFunctionUrlInMetadata", "err", "catch", "useCopyHandler", "navigator", "clipboard", "writeText", "useToolbarState", "initialState", "createFormat", "formatAction", "useFormatHandler", "format", "parser", "plugins", "prettierPluginEstree", "prettierPluginTypescript", "semi", "singleQuote", "createTemplateSelectGroup", "createMenuItemGroup", "variant", "createTemplateSelectActions", "templates", "map", "template", "value", "createTemplateSelect", "templateSelectGroup", "templateSelectActions", "action", "useTemplateSelectHandler", "templateId", "find", "metaKeys", "keys", "oldPresetIndex", "findIndex", "key", "FUNCTIONS_PRESET_META_KEY", "splice", "presetId", "push", "views", "logs", "createViewActions", "Object", "entries", "viewType", "createView", "viewActions", "useToolbarAction", "props", "handleTemplateSelect", "handleFormat", "handleDeploy", "handleCopy", "dispatchPromise", "dispatch", "useIntentDispatcher", "properties", "createIntent", "DeckAction", "ChangeCompanion", "primary", "fullyQualifiedId", "companion", "surfaceVariant", "LogsPanel", "invocationTraceQueue", "useQueue", "dxn", "pollInterval", "selected", "setSelected", "useState", "workerDxn", "React", "div", "handleOpenChange", "trace", "open", "List", "mx", "items", "filter", "decodeReference", "invocationTarget", "toString", "InvocationTraceItem", "setOpen", "eventQueue", "flatMap", "event", "heading", "input", "bodyText", "JSON", "stringify", "ListItem", "Root", "collapsible", "onOpenChange", "className", "OpenTrigger", "Endcap", "Icon", "outcome", "size", "Heading", "span", "Date", "timestampMs", "toLocaleString", "CollapsibleContent", "durationMs", "pre", "index"]
|
|
7
|
+
}
|