@dxos/plugin-script 0.6.14-staging.934c9de → 0.6.14-staging.9b873ce

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 (105) hide show
  1. package/dist/lib/browser/{AutomationPanel-MDPZ5WAC.mjs → AutomationPanel-F2SAN67R.mjs} +5 -5
  2. package/dist/lib/browser/{ScriptContainer-B3CPWXRE.mjs → ScriptContainer-F2DFCOHF.mjs} +24 -21
  3. package/dist/lib/browser/ScriptContainer-F2DFCOHF.mjs.map +7 -0
  4. package/dist/lib/browser/{chunk-G6H56WFS.mjs → chunk-4UTRJLQ3.mjs} +11 -3
  5. package/dist/lib/browser/chunk-4UTRJLQ3.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-KHNN3F7J.mjs → chunk-5GGRYRS4.mjs} +5 -5
  7. package/dist/lib/browser/{chunk-KHNN3F7J.mjs.map → chunk-5GGRYRS4.mjs.map} +2 -2
  8. package/dist/lib/browser/{chunk-SGQHRB4P.mjs → chunk-C7VBULMK.mjs} +4 -3
  9. package/dist/lib/browser/{chunk-SGQHRB4P.mjs.map → chunk-C7VBULMK.mjs.map} +3 -3
  10. package/dist/lib/browser/{chunk-KXVQPS4Y.mjs → chunk-JBXEMQ6S.mjs} +5 -4
  11. package/dist/lib/browser/chunk-JBXEMQ6S.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-G66MXS4T.mjs → chunk-NCZUJKJE.mjs} +6 -18
  13. package/dist/lib/browser/chunk-NCZUJKJE.mjs.map +7 -0
  14. package/dist/lib/browser/edge/index.mjs +1 -1
  15. package/dist/lib/browser/index.mjs +106 -13
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/meta.json +1 -1
  18. package/dist/lib/browser/meta.mjs +1 -1
  19. package/dist/lib/browser/types/index.mjs +2 -2
  20. package/dist/lib/node/{AutomationPanel-SANUE5X4.cjs → AutomationPanel-M5UHEMPG.cjs} +15 -15
  21. package/dist/lib/node/{ScriptContainer-BV7HMUY5.cjs → ScriptContainer-X76C7OD2.cjs} +40 -37
  22. package/dist/lib/node/ScriptContainer-X76C7OD2.cjs.map +7 -0
  23. package/dist/lib/node/{chunk-EJC55SDD.cjs → chunk-6LYX73ZT.cjs} +7 -6
  24. package/dist/lib/node/chunk-6LYX73ZT.cjs.map +7 -0
  25. package/dist/lib/node/{chunk-JWKMTYYH.cjs → chunk-BJ4WIWCP.cjs} +9 -21
  26. package/dist/lib/node/chunk-BJ4WIWCP.cjs.map +7 -0
  27. package/dist/lib/node/{chunk-ACLCRWDB.cjs → chunk-WPP65EYS.cjs} +14 -6
  28. package/dist/lib/node/chunk-WPP65EYS.cjs.map +7 -0
  29. package/dist/lib/node/{chunk-FY5KKL5N.cjs → chunk-XS6GEYYH.cjs} +8 -8
  30. package/dist/lib/node/{chunk-FY5KKL5N.cjs.map → chunk-XS6GEYYH.cjs.map} +2 -2
  31. package/dist/lib/node/{chunk-25PQE7FL.cjs → chunk-ZTUFXDTH.cjs} +8 -7
  32. package/dist/lib/node/chunk-ZTUFXDTH.cjs.map +7 -0
  33. package/dist/lib/node/edge/index.cjs +10 -10
  34. package/dist/lib/node/edge/index.cjs.map +1 -1
  35. package/dist/lib/node/index.cjs +122 -33
  36. package/dist/lib/node/index.cjs.map +4 -4
  37. package/dist/lib/node/meta.cjs +3 -3
  38. package/dist/lib/node/meta.cjs.map +1 -1
  39. package/dist/lib/node/meta.json +1 -1
  40. package/dist/lib/node/types/index.cjs +5 -5
  41. package/dist/lib/node/types/index.cjs.map +1 -1
  42. package/dist/lib/node-esm/{AutomationPanel-H2IKE53E.mjs → AutomationPanel-JQ2NLXYS.mjs} +5 -5
  43. package/dist/lib/node-esm/{ScriptContainer-HSIOGVP3.mjs → ScriptContainer-KXUHDS5D.mjs} +24 -21
  44. package/dist/lib/node-esm/ScriptContainer-KXUHDS5D.mjs.map +7 -0
  45. package/dist/lib/node-esm/{chunk-7EDYDVQH.mjs → chunk-3QSMHAWD.mjs} +5 -4
  46. package/dist/lib/node-esm/chunk-3QSMHAWD.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-LDLNTVAK.mjs → chunk-4SRPREUK.mjs} +11 -3
  48. package/dist/lib/node-esm/chunk-4SRPREUK.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-3QHVR4VV.mjs → chunk-DXWSRDEN.mjs} +6 -18
  50. package/dist/lib/node-esm/chunk-DXWSRDEN.mjs.map +7 -0
  51. package/dist/lib/node-esm/{chunk-GO7HYFM5.mjs → chunk-SLTZMY34.mjs} +4 -3
  52. package/dist/lib/node-esm/{chunk-GO7HYFM5.mjs.map → chunk-SLTZMY34.mjs.map} +3 -3
  53. package/dist/lib/node-esm/{chunk-QMTTZYLF.mjs → chunk-V74XKPLC.mjs} +5 -5
  54. package/dist/lib/node-esm/{chunk-QMTTZYLF.mjs.map → chunk-V74XKPLC.mjs.map} +2 -2
  55. package/dist/lib/node-esm/edge/index.mjs +1 -1
  56. package/dist/lib/node-esm/index.mjs +106 -13
  57. package/dist/lib/node-esm/index.mjs.map +4 -4
  58. package/dist/lib/node-esm/meta.json +1 -1
  59. package/dist/lib/node-esm/meta.mjs +1 -1
  60. package/dist/lib/node-esm/types/index.mjs +2 -2
  61. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  62. package/dist/types/src/bundler/bundler.d.ts.map +1 -1
  63. package/dist/types/src/components/DebugPanel/DebugPanel.d.ts +1 -4
  64. package/dist/types/src/components/DebugPanel/DebugPanel.d.ts.map +1 -1
  65. package/dist/types/src/components/ScriptEditor.d.ts.map +1 -1
  66. package/dist/types/src/components/ScriptSettingsPanel.d.ts +7 -0
  67. package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -0
  68. package/dist/types/src/components/index.d.ts +1 -0
  69. package/dist/types/src/components/index.d.ts.map +1 -1
  70. package/dist/types/src/edge/functions.d.ts +4 -1
  71. package/dist/types/src/edge/functions.d.ts.map +1 -1
  72. package/dist/types/src/meta.d.ts +2 -1
  73. package/dist/types/src/meta.d.ts.map +1 -1
  74. package/dist/types/src/translations.d.ts +5 -0
  75. package/dist/types/src/translations.d.ts.map +1 -1
  76. package/dist/types/src/types/script.d.ts +3 -1
  77. package/dist/types/src/types/script.d.ts.map +1 -1
  78. package/package.json +36 -36
  79. package/src/ScriptPlugin.tsx +10 -2
  80. package/src/bundler/bundler.ts +4 -0
  81. package/src/components/DebugPanel/DebugPanel.tsx +2 -29
  82. package/src/components/ScriptEditor.tsx +10 -18
  83. package/src/components/ScriptSettings/ScriptSettings.tsx +3 -3
  84. package/src/components/ScriptSettingsPanel.tsx +105 -0
  85. package/src/components/index.ts +1 -0
  86. package/src/edge/functions.ts +4 -1
  87. package/src/meta.ts +2 -1
  88. package/src/translations.ts +5 -0
  89. package/src/types/script.ts +2 -1
  90. package/dist/lib/browser/ScriptContainer-B3CPWXRE.mjs.map +0 -7
  91. package/dist/lib/browser/chunk-G66MXS4T.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-G6H56WFS.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-KXVQPS4Y.mjs.map +0 -7
  94. package/dist/lib/node/ScriptContainer-BV7HMUY5.cjs.map +0 -7
  95. package/dist/lib/node/chunk-25PQE7FL.cjs.map +0 -7
  96. package/dist/lib/node/chunk-ACLCRWDB.cjs.map +0 -7
  97. package/dist/lib/node/chunk-EJC55SDD.cjs.map +0 -7
  98. package/dist/lib/node/chunk-JWKMTYYH.cjs.map +0 -7
  99. package/dist/lib/node-esm/ScriptContainer-HSIOGVP3.mjs.map +0 -7
  100. package/dist/lib/node-esm/chunk-3QHVR4VV.mjs.map +0 -7
  101. package/dist/lib/node-esm/chunk-7EDYDVQH.mjs.map +0 -7
  102. package/dist/lib/node-esm/chunk-LDLNTVAK.mjs.map +0 -7
  103. /package/dist/lib/browser/{AutomationPanel-MDPZ5WAC.mjs.map → AutomationPanel-F2SAN67R.mjs.map} +0 -0
  104. /package/dist/lib/node/{AutomationPanel-SANUE5X4.cjs.map → AutomationPanel-M5UHEMPG.cjs.map} +0 -0
  105. /package/dist/lib/node-esm/{AutomationPanel-H2IKE53E.mjs.map → AutomationPanel-JQ2NLXYS.mjs.map} +0 -0
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { type ScriptType } from '../types';
3
+ export type ScriptSettingsPanelProps = {
4
+ script: ScriptType;
5
+ };
6
+ export declare const ScriptSettingsPanel: ({ script }: ScriptSettingsPanelProps) => React.JSX.Element;
7
+ //# sourceMappingURL=ScriptSettingsPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScriptSettingsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/ScriptSettingsPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAQ7D,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,wBAAwB,sBAsFvE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './ScriptSettings';
2
+ export * from './ScriptSettingsPanel';
2
3
  export declare const AutomationPanel: import("react").LazyExoticComponent<({ subject }: import("./AutomationPanel").AutomationPanelProps) => import("react").JSX.Element>;
3
4
  export declare const ScriptContainer: import("react").LazyExoticComponent<({ script, ...props }: import("./ScriptEditor").ScriptEditorProps) => import("react").JSX.Element>;
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;AAEjC,eAAO,MAAM,eAAe,qIAA0C,CAAC;AACvE,eAAO,MAAM,eAAe,wIAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAEtC,eAAO,MAAM,eAAe,qIAA0C,CAAC;AACvE,eAAO,MAAM,eAAe,wIAA0C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type DID } from 'iso-did/types';
2
2
  import { type Config } from '@dxos/client';
3
3
  import { type Halo } from '@dxos/client-protocol';
4
- import { type ObjectMeta } from '@dxos/echo-schema';
4
+ import { type JsonSchemaType, type ObjectMeta } from '@dxos/echo-schema';
5
5
  import type { SpaceId } from '@dxos/keys';
6
6
  export declare const USERFUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
7
7
  export type UserFunctionUploadResult = {
@@ -9,6 +9,9 @@ export type UserFunctionUploadResult = {
9
9
  errorMessage?: string;
10
10
  functionId?: string;
11
11
  functionVersionNumber?: number;
12
+ meta: {
13
+ inputSchema?: JsonSchemaType;
14
+ };
12
15
  };
13
16
  export type UploadWorkerProps = {
14
17
  clientConfig: Config;
@@ -1 +1 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAS1C,eAAO,MAAM,6BAA6B,qCAAqC,CAAC;AAIhF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAeF,eAAO,MAAM,oBAAoB,uFAQ9B,iBAAiB,sCAwBnB,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAoCF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC"}
1
+ {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAS1C,eAAO,MAAM,6BAA6B,qCAAqC,CAAC;AAIhF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,cAAc,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAeF,eAAO,MAAM,oBAAoB,uFAQ9B,iBAAiB,sCAwBnB,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAoCF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC"}
@@ -3,8 +3,9 @@ declare const _default: {
3
3
  id: string;
4
4
  name: string;
5
5
  description: string;
6
- tags: string[];
7
6
  icon: string;
7
+ source: string;
8
+ tags: string[];
8
9
  };
9
10
  export default _default;
10
11
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC;;;;;;;;AAEtD,wBAMuB"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC;;;;;;;;;AAEtD,wBAOuB"}
@@ -15,6 +15,11 @@ declare const _default: {
15
15
  'toggle details label': string;
16
16
  'authenticate action label': string;
17
17
  'authenticate button label': string;
18
+ 'name label': string;
19
+ 'remote function settings heading': string;
20
+ 'function url label': string;
21
+ 'function binding label': string;
22
+ 'function binding placeholder': string;
18
23
  };
19
24
  };
20
25
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,wBAqBE"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBA0BE"}
@@ -1,4 +1,4 @@
1
- import { ref, S } from '@dxos/echo-schema';
1
+ import { JsonSchemaType, ref, S } from '@dxos/echo-schema';
2
2
  declare const ScriptType_base: import("@dxos/echo-schema").AbstractTypedObject<{
3
3
  name?: string | undefined;
4
4
  description?: string | undefined;
@@ -41,6 +41,7 @@ declare const FunctionType_base: import("@dxos/echo-schema").AbstractTypedObject
41
41
  }>;
42
42
  version: number;
43
43
  binding?: string | undefined;
44
+ inputSchema?: JsonSchemaType | undefined;
44
45
  } & {
45
46
  id: string;
46
47
  }, S.Struct.Encoded<{
@@ -59,6 +60,7 @@ declare const FunctionType_base: import("@dxos/echo-schema").AbstractTypedObject
59
60
  } & {
60
61
  id: string;
61
62
  }>>;
63
+ inputSchema: S.optional<S.Schema<JsonSchemaType, JsonSchemaType, never>>;
62
64
  }>>;
63
65
  /**
64
66
  * Function deployment.
@@ -1 +1 @@
1
- {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../../src/types/script.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;AAKxD;;GAEG;AACH,qBAAa,UAAW,SAAQ,eAQ9B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAQhC;CAAG"}
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../../src/types/script.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;AAKxE;;GAEG;AACH,qBAAa,UAAW,SAAQ,eAQ9B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAShC;CAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-script",
3
- "version": "0.6.14-staging.934c9de",
3
+ "version": "0.6.14-staging.9b873ce",
4
4
  "description": "Braneframe notebook plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -67,32 +67,32 @@
67
67
  "prettier": "^3.2.4",
68
68
  "react-syntax-highlighter": "^15.5.0",
69
69
  "typescript": "^5.6.2",
70
- "@dxos/app-framework": "0.6.14-staging.934c9de",
71
- "@dxos/async": "0.6.14-staging.934c9de",
72
- "@dxos/client-protocol": "0.6.14-staging.934c9de",
73
- "@dxos/client": "0.6.14-staging.934c9de",
74
- "@dxos/crypto": "0.6.14-staging.934c9de",
75
- "@dxos/debug": "0.6.14-staging.934c9de",
76
- "@dxos/echo-schema": "0.6.14-staging.934c9de",
77
- "@dxos/invariant": "0.6.14-staging.934c9de",
78
- "@dxos/keys": "0.6.14-staging.934c9de",
79
- "@dxos/log": "0.6.14-staging.934c9de",
80
- "@dxos/plugin-explorer": "0.6.14-staging.934c9de",
81
- "@dxos/plugin-graph": "0.6.14-staging.934c9de",
82
- "@dxos/plugin-client": "0.6.14-staging.934c9de",
83
- "@dxos/plugin-markdown": "0.6.14-staging.934c9de",
84
- "@dxos/plugin-theme": "0.6.14-staging.934c9de",
85
- "@dxos/plugin-space": "0.6.14-staging.934c9de",
86
- "@dxos/plugin-stack": "0.6.14-staging.934c9de",
87
- "@dxos/protocols": "0.6.14-staging.934c9de",
88
- "@dxos/react-client": "0.6.14-staging.934c9de",
89
- "@dxos/react-ui-attention": "0.6.14-staging.934c9de",
90
- "@dxos/react-ui-editor": "0.6.14-staging.934c9de",
91
- "@dxos/rpc": "0.6.14-staging.934c9de",
92
- "@dxos/react-ui-data": "0.6.14-staging.934c9de",
93
- "@dxos/rpc-tunnel": "0.6.14-staging.934c9de",
94
- "@dxos/react-ui-syntax-highlighter": "0.6.14-staging.934c9de",
95
- "@dxos/util": "0.6.14-staging.934c9de"
70
+ "@dxos/app-framework": "0.6.14-staging.9b873ce",
71
+ "@dxos/client": "0.6.14-staging.9b873ce",
72
+ "@dxos/async": "0.6.14-staging.9b873ce",
73
+ "@dxos/client-protocol": "0.6.14-staging.9b873ce",
74
+ "@dxos/crypto": "0.6.14-staging.9b873ce",
75
+ "@dxos/debug": "0.6.14-staging.9b873ce",
76
+ "@dxos/echo-schema": "0.6.14-staging.9b873ce",
77
+ "@dxos/invariant": "0.6.14-staging.9b873ce",
78
+ "@dxos/log": "0.6.14-staging.9b873ce",
79
+ "@dxos/keys": "0.6.14-staging.9b873ce",
80
+ "@dxos/plugin-client": "0.6.14-staging.9b873ce",
81
+ "@dxos/plugin-explorer": "0.6.14-staging.9b873ce",
82
+ "@dxos/plugin-graph": "0.6.14-staging.9b873ce",
83
+ "@dxos/plugin-markdown": "0.6.14-staging.9b873ce",
84
+ "@dxos/plugin-space": "0.6.14-staging.9b873ce",
85
+ "@dxos/plugin-stack": "0.6.14-staging.9b873ce",
86
+ "@dxos/plugin-theme": "0.6.14-staging.9b873ce",
87
+ "@dxos/protocols": "0.6.14-staging.9b873ce",
88
+ "@dxos/react-client": "0.6.14-staging.9b873ce",
89
+ "@dxos/react-ui-attention": "0.6.14-staging.9b873ce",
90
+ "@dxos/react-ui-data": "0.6.14-staging.9b873ce",
91
+ "@dxos/react-ui-editor": "0.6.14-staging.9b873ce",
92
+ "@dxos/react-ui-syntax-highlighter": "0.6.14-staging.9b873ce",
93
+ "@dxos/rpc": "0.6.14-staging.9b873ce",
94
+ "@dxos/rpc-tunnel": "0.6.14-staging.9b873ce",
95
+ "@dxos/util": "0.6.14-staging.9b873ce"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@phosphor-icons/react": "^2.1.5",
@@ -102,20 +102,20 @@
102
102
  "react": "~18.2.0",
103
103
  "react-dom": "~18.2.0",
104
104
  "vite": "5.4.7",
105
- "@dxos/echo-generator": "0.6.14-staging.934c9de",
106
- "@dxos/random": "0.6.14-staging.934c9de",
107
- "@dxos/react-ui": "0.6.14-staging.934c9de",
108
- "@dxos/react-ui-mosaic": "0.6.14-staging.934c9de",
109
- "@dxos/react-ui-theme": "0.6.14-staging.934c9de",
110
- "@dxos/storybook-utils": "0.6.14-staging.934c9de"
105
+ "@dxos/echo-generator": "0.6.14-staging.9b873ce",
106
+ "@dxos/react-ui": "0.6.14-staging.9b873ce",
107
+ "@dxos/react-ui-mosaic": "0.6.14-staging.9b873ce",
108
+ "@dxos/random": "0.6.14-staging.9b873ce",
109
+ "@dxos/react-ui-theme": "0.6.14-staging.9b873ce",
110
+ "@dxos/storybook-utils": "0.6.14-staging.9b873ce"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "@phosphor-icons/react": "^2.1.5",
114
114
  "react": "~18.2.0",
115
115
  "react-dom": "~18.2.0",
116
- "@dxos/react-ui": "0.6.14-staging.934c9de",
117
- "@dxos/react-ui-mosaic": "0.6.14-staging.934c9de",
118
- "@dxos/react-ui-theme": "0.6.14-staging.934c9de"
116
+ "@dxos/react-ui": "0.6.14-staging.9b873ce",
117
+ "@dxos/react-ui-mosaic": "0.6.14-staging.9b873ce",
118
+ "@dxos/react-ui-theme": "0.6.14-staging.9b873ce"
119
119
  },
120
120
  "publishConfig": {
121
121
  "access": "public"
@@ -16,7 +16,7 @@ import { loadObjectReferences } from '@dxos/react-client/echo';
16
16
 
17
17
  import { initializeBundler } from './bundler';
18
18
  import { Compiler } from './compiler';
19
- import { AutomationPanel, ScriptContainer, ScriptSettings } from './components';
19
+ import { AutomationPanel, ScriptContainer, ScriptSettings, ScriptSettingsPanel } from './components';
20
20
  import meta, { SCRIPT_PLUGIN } from './meta';
21
21
  import { templates } from './templates';
22
22
  import translations from './translations';
@@ -122,12 +122,20 @@ export const ScriptPlugin = (): PluginDefinition<ScriptPluginProvides> => {
122
122
  }
123
123
 
124
124
  case 'complementary--automation': {
125
- if (data.object instanceof ScriptType) {
125
+ if (data.subject instanceof ScriptType) {
126
126
  return {
127
127
  node: <AutomationPanel subject={data.subject as any} />,
128
128
  disposition: 'hoist',
129
129
  };
130
130
  }
131
+ break;
132
+ }
133
+
134
+ case 'complementary--settings': {
135
+ if (data.subject instanceof ScriptType) {
136
+ return <ScriptSettingsPanel script={data.subject} />;
137
+ }
138
+ break;
131
139
  }
132
140
  }
133
141
 
@@ -78,6 +78,10 @@ export class Bundler {
78
78
  return { path, external: true };
79
79
  });
80
80
 
81
+ build.onResolve({ filter: /^dxos:functions$/ }, ({ path }) => {
82
+ return { path: './runtime.js', external: true };
83
+ });
84
+
81
85
  build.onResolve({ filter: /^memory:/ }, ({ path }) => {
82
86
  return { path: path.split(':')[1], namespace: 'memory' };
83
87
  });
@@ -5,7 +5,7 @@
5
5
  import React, { useEffect, useRef, useState } from 'react';
6
6
 
7
7
  import { log } from '@dxos/log';
8
- import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useControlledValue, useTranslation } from '@dxos/react-ui';
8
+ import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
9
9
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
10
10
  import { mx } from '@dxos/react-ui-theme';
11
11
 
@@ -20,26 +20,11 @@ type Message = { type: 'request' | 'response'; text?: string; data?: any; error?
20
20
 
21
21
  export type DebugPanelProps = ThemedClassName<{
22
22
  functionUrl?: string;
23
- binding?: string;
24
- onBindingChange?: (binding: string) => void;
25
- showBindingConfig?: boolean;
26
23
  }>;
27
24
 
28
- export const DebugPanel = ({
29
- classNames,
30
- functionUrl,
31
- binding: _binding,
32
- onBindingChange,
33
- showBindingConfig = false,
34
- }: DebugPanelProps) => {
25
+ export const DebugPanel = ({ classNames, functionUrl }: DebugPanelProps) => {
35
26
  const { t } = useTranslation(SCRIPT_PLUGIN);
36
27
 
37
- const bindingInputRef = useRef<HTMLInputElement>(null);
38
- const [binding, setBinding] = useControlledValue(_binding ?? '');
39
- const handleBlur = () => {
40
- onBindingChange?.(binding);
41
- };
42
-
43
28
  const inputRef = useRef<HTMLInputElement>(null);
44
29
  const [input, setInput] = useState('');
45
30
  const [result, setResult] = useState('');
@@ -190,18 +175,6 @@ export const DebugPanel = ({
190
175
  onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}
191
176
  />
192
177
  </Input.Root>
193
- {showBindingConfig && (
194
- <Input.Root>
195
- <Input.TextInput
196
- ref={bindingInputRef}
197
- classNames='!w-[10rem]'
198
- placeholder={t('binding placeholder')}
199
- value={binding}
200
- onChange={(ev) => setBinding(ev.target.value.toUpperCase())}
201
- onBlur={handleBlur}
202
- />
203
- </Input.Root>
204
- )}
205
178
  <Toolbar.Button onClick={() => handleRequest(input)}>
206
179
  <Icon icon='ph--play--regular' size={4} />
207
180
  </Toolbar.Button>
@@ -72,13 +72,6 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
72
72
  const existingFunctionUrl = fn && getUserFunctionUrlInMetadata(getMeta(fn));
73
73
  const [error, setError] = useState<string>();
74
74
 
75
- const handleBindingChange = useCallback(
76
- (binding: string) => {
77
- fn.binding = binding;
78
- },
79
- [fn],
80
- );
81
-
82
75
  const handleFormat = useCallback(async () => {
83
76
  if (!script.source) {
84
77
  return;
@@ -130,7 +123,7 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
130
123
  throw buildResult.error;
131
124
  }
132
125
 
133
- const { result, functionId, functionVersionNumber, errorMessage } = await uploadWorkerFunction({
126
+ const { result, functionId, functionVersionNumber, errorMessage, meta } = await uploadWorkerFunction({
134
127
  clientConfig: client.config,
135
128
  halo: client.halo,
136
129
  ownerDid,
@@ -148,9 +141,15 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
148
141
 
149
142
  const deployedFunction =
150
143
  fn ?? space.db.add(create(FunctionType, { version: functionVersionNumber, source: script }));
151
- const meta = getMeta(deployedFunction);
152
144
  script.changed = false;
153
- setUserFunctionUrlInMetadata(meta, `/${ownerDid}/${functionId}`);
145
+
146
+ if (meta.inputSchema) {
147
+ deployedFunction.inputSchema = meta.inputSchema;
148
+ } else {
149
+ log.verbose('no input schema in function metadata', { functionId });
150
+ }
151
+ setUserFunctionUrlInMetadata(getMeta(deployedFunction), `/${ownerDid}/${functionId}`);
152
+
154
153
  setView('split');
155
154
  } catch (err: any) {
156
155
  log.catch(err);
@@ -192,14 +191,7 @@ export const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) =>
192
191
  />
193
192
  )}
194
193
 
195
- {view !== 'editor' && (
196
- <DebugPanel
197
- functionUrl={functionUrl}
198
- showBindingConfig
199
- binding={fn?.binding}
200
- onBindingChange={handleBindingChange}
201
- />
202
- )}
194
+ {view !== 'editor' && <DebugPanel functionUrl={functionUrl} />}
203
195
  </div>
204
196
  );
205
197
  };
@@ -7,7 +7,7 @@ import React from 'react';
7
7
  import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
8
8
  import { useClient } from '@dxos/react-client';
9
9
  import { Button, useTranslation } from '@dxos/react-ui';
10
- import { FormInput } from '@dxos/react-ui-data';
10
+ import { DeprecatedFormInput } from '@dxos/react-ui-data';
11
11
 
12
12
  import { SCRIPT_PLUGIN } from '../../meta';
13
13
  import { type ScriptSettingsProps } from '../../types';
@@ -39,9 +39,9 @@ export const ScriptSettings = ({ settings }: { settings: ScriptSettingsProps })
39
39
 
40
40
  return (
41
41
  <>
42
- <FormInput label={t('authenticate action label')}>
42
+ <DeprecatedFormInput label={t('authenticate action label')}>
43
43
  <Button onClick={handleAuthenticate}>{t('authenticate button label')}</Button>
44
- </FormInput>
44
+ </DeprecatedFormInput>
45
45
  </>
46
46
  );
47
47
  };
@@ -0,0 +1,105 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { type ChangeEvent, useCallback } from 'react';
6
+
7
+ import { useClient } from '@dxos/react-client';
8
+ import { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';
9
+ import { Button, Icon, Input, useControlledValue, useTranslation } from '@dxos/react-ui';
10
+
11
+ import { getInvocationUrl, getUserFunctionUrlInMetadata } from '../edge';
12
+ import { SCRIPT_PLUGIN } from '../meta';
13
+ import { FunctionType, type ScriptType } from '../types';
14
+
15
+ export type ScriptSettingsPanelProps = {
16
+ script: ScriptType;
17
+ };
18
+
19
+ export const ScriptSettingsPanel = ({ script }: ScriptSettingsPanelProps) => {
20
+ const { t } = useTranslation(SCRIPT_PLUGIN);
21
+ const client = useClient();
22
+ const space = getSpace(script);
23
+ // TODO(dmaretskyi): Parametric query.
24
+ const [fn] = useQuery(
25
+ space,
26
+ Filter.schema(FunctionType, (fn) => fn.source === script),
27
+ );
28
+
29
+ const handleNameChange = useCallback(
30
+ (event: ChangeEvent<HTMLInputElement>) => {
31
+ script.name = event.target.value;
32
+ },
33
+ [script],
34
+ );
35
+
36
+ const [binding, setBinding] = useControlledValue(fn?.binding ?? '');
37
+ const handleBindingChange = useCallback(
38
+ (event: ChangeEvent<HTMLInputElement>) => {
39
+ setBinding(event.target.value);
40
+ },
41
+ [setBinding],
42
+ );
43
+ const handleBindingBlur = useCallback(() => {
44
+ fn.binding = binding;
45
+ }, [fn, binding]);
46
+
47
+ const functionPath = fn && getUserFunctionUrlInMetadata(getMeta(fn));
48
+ const functionUrl =
49
+ functionPath &&
50
+ getInvocationUrl(functionPath, client.config.values.runtime?.services?.edge?.url ?? '', {
51
+ spaceId: space?.id,
52
+ });
53
+
54
+ // TODO(wittjosiah): Use ClipboardProvider.
55
+ const handleCopy = useCallback(() => functionUrl && navigator.clipboard.writeText(functionUrl), [functionUrl]);
56
+
57
+ return (
58
+ <div role='form' className='flex flex-col w-full p-2 gap-4'>
59
+ <Input.Root>
60
+ <div role='none' className='flex flex-col gap-1'>
61
+ <Input.Label>{t('name label')}</Input.Label>
62
+ <Input.TextInput
63
+ placeholder={t('object title placeholder')}
64
+ value={script.name ?? ''}
65
+ onChange={handleNameChange}
66
+ />
67
+ </div>
68
+ </Input.Root>
69
+ {fn && (
70
+ <>
71
+ <hr className='border-separator' />
72
+ <h2>{t('remote function settings heading')}</h2>
73
+ <Input.Root>
74
+ <div role='none' className='flex flex-col gap-1'>
75
+ <Input.Label>{t('function url label')}</Input.Label>
76
+ <div role='none' className='flex gap-1'>
77
+ <Input.TextInput
78
+ disabled
79
+ value={functionUrl}
80
+ onChange={(event) => {
81
+ fn.name = event.target.value;
82
+ }}
83
+ />
84
+ <Button onClick={handleCopy}>
85
+ <Icon icon='ph--copy--regular' size={4} />
86
+ </Button>
87
+ </div>
88
+ </div>
89
+ </Input.Root>
90
+ <Input.Root>
91
+ <div role='none' className='flex flex-col gap-1'>
92
+ <Input.Label>{t('function binding label')}</Input.Label>
93
+ <Input.TextInput
94
+ placeholder={t('function binding placeholder')}
95
+ value={binding}
96
+ onChange={handleBindingChange}
97
+ onBlur={handleBindingBlur}
98
+ />
99
+ </div>
100
+ </Input.Root>
101
+ </>
102
+ )}
103
+ </div>
104
+ );
105
+ };
@@ -5,6 +5,7 @@
5
5
  import { lazy } from 'react';
6
6
 
7
7
  export * from './ScriptSettings';
8
+ export * from './ScriptSettingsPanel';
8
9
 
9
10
  export const AutomationPanel = lazy(() => import('./AutomationPanel'));
10
11
  export const ScriptContainer = lazy(() => import('./ScriptContainer'));
@@ -7,7 +7,7 @@ import { type DID } from 'iso-did/types';
7
7
  import { Trigger } from '@dxos/async';
8
8
  import { type Config } from '@dxos/client';
9
9
  import { type Halo } from '@dxos/client-protocol';
10
- import { type ObjectMeta } from '@dxos/echo-schema';
10
+ import { type JsonSchemaType, type ObjectMeta } from '@dxos/echo-schema';
11
11
  import { invariant } from '@dxos/invariant';
12
12
  import type { SpaceId } from '@dxos/keys';
13
13
  import { log } from '@dxos/log';
@@ -27,6 +27,9 @@ export type UserFunctionUploadResult = {
27
27
  errorMessage?: string;
28
28
  functionId?: string;
29
29
  functionVersionNumber?: number;
30
+ meta: {
31
+ inputSchema?: JsonSchemaType;
32
+ };
30
33
  };
31
34
 
32
35
  export type UploadWorkerProps = {
package/src/meta.ts CHANGED
@@ -10,6 +10,7 @@ export default {
10
10
  id: SCRIPT_PLUGIN,
11
11
  name: 'Scripts',
12
12
  description: 'Distributed functions.',
13
- tags: ['experimental'],
14
13
  icon: 'ph--code--regular',
14
+ source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer',
15
+ tags: ['experimental'],
15
16
  } satisfies PluginMeta;
@@ -22,6 +22,11 @@ export default [
22
22
  'toggle details label': 'Toggle details panel',
23
23
  'authenticate action label': 'Authenticate functions service',
24
24
  'authenticate button label': 'Authenticate',
25
+ 'name label': 'Name',
26
+ 'remote function settings heading': 'Remote Function',
27
+ 'function url label': 'Invocation URL',
28
+ 'function binding label': 'Function binding',
29
+ 'function binding placeholder': 'BINDING',
25
30
  },
26
31
  },
27
32
  },
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { ref, S, TypedObject } from '@dxos/echo-schema';
5
+ import { JsonSchemaType, ref, S, TypedObject } from '@dxos/echo-schema';
6
6
  import { TextType } from '@dxos/plugin-markdown/types';
7
7
 
8
8
  // TODO(burdon): Which is the outer type? I.e., in the navbar?
@@ -31,4 +31,5 @@ export class FunctionType extends TypedObject({ typename: 'dxos.org/type/Functio
31
31
  binding: S.optional(S.String),
32
32
  // Reference to a source script if it exists within ECHO.
33
33
  source: S.optional(ref(ScriptType)),
34
+ inputSchema: S.optional(JsonSchemaType),
34
35
  }) {}