@dxos/plugin-script 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced

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 (564) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/{browser/DeploymentDialog-LGEGIX64.mjs → neutral/DeploymentDialog-6DBF3V6C.mjs} +15 -27
  3. package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
  4. package/dist/lib/{browser/NotebookContainer-CC3G32Q5.mjs → neutral/NotebookArticle-VBBVX4BW.mjs} +48 -135
  5. package/dist/lib/neutral/NotebookArticle-VBBVX4BW.mjs.map +7 -0
  6. package/dist/lib/{browser/ScriptContainer-Z3MCPN2D.mjs → neutral/ScriptArticle-UBT27SB6.mjs} +10 -26
  7. package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs.map +7 -0
  8. package/dist/lib/neutral/ScriptPlugin.mjs +39 -0
  9. package/dist/lib/neutral/ScriptPlugin.mjs.map +7 -0
  10. package/dist/lib/neutral/ScriptPlugin.node.mjs +27 -0
  11. package/dist/lib/neutral/ScriptPlugin.node.mjs.map +7 -0
  12. package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
  13. package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
  14. package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
  15. package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
  16. package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs +297 -0
  17. package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
  18. package/dist/lib/{browser/TestContainer-ACNQMKVU.mjs → neutral/TestContainer-AFVTBYSJ.mjs} +9 -26
  19. package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
  20. package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs +52 -0
  21. package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs.map +7 -0
  22. package/dist/lib/{browser/blueprint-definition-MC264VR5.mjs → neutral/blueprint-definition-T33SBPP2.mjs} +4 -6
  23. package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
  24. package/dist/lib/{browser → neutral}/blueprints/index.mjs +3 -1
  25. package/dist/lib/neutral/capabilities/index.mjs +21 -0
  26. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  27. package/dist/lib/neutral/capabilities/node.mjs +17 -0
  28. package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
  29. package/dist/lib/{node-esm/chunk-JGN7TDJH.mjs → neutral/chunk-2REUEDUA.mjs} +10 -23
  30. package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
  31. package/dist/lib/{browser/chunk-37XPSUAH.mjs → neutral/chunk-436PZKYX.mjs} +2 -1
  32. package/dist/lib/neutral/chunk-436PZKYX.mjs.map +7 -0
  33. package/dist/lib/neutral/chunk-4OWPUMGN.mjs +8 -0
  34. package/dist/lib/neutral/chunk-4OWPUMGN.mjs.map +7 -0
  35. package/dist/lib/neutral/chunk-A4LRH25S.mjs +105 -0
  36. package/dist/lib/neutral/chunk-A4LRH25S.mjs.map +7 -0
  37. package/dist/lib/neutral/chunk-BDRB6ZX2.mjs +52 -0
  38. package/dist/lib/neutral/chunk-BDRB6ZX2.mjs.map +7 -0
  39. package/dist/lib/neutral/chunk-BMO5VOKL.mjs +125 -0
  40. package/dist/lib/neutral/chunk-BMO5VOKL.mjs.map +7 -0
  41. package/dist/lib/neutral/chunk-MI6X5CTJ.mjs +336 -0
  42. package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +7 -0
  43. package/dist/lib/neutral/chunk-SNUWHNEW.mjs +8 -0
  44. package/dist/lib/neutral/chunk-SNUWHNEW.mjs.map +7 -0
  45. package/dist/lib/{browser/chunk-E6BQ4P6L.mjs → neutral/chunk-VXDJH6OL.mjs} +21 -50
  46. package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
  47. package/dist/lib/{browser/compiler-MZKFKYCG.mjs → neutral/compiler-ODK4UA2N.mjs} +24 -21
  48. package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
  49. package/dist/lib/{node-esm/chunk-SV742UH7.mjs → neutral/components/index.mjs} +75 -97
  50. package/dist/lib/neutral/components/index.mjs.map +7 -0
  51. package/dist/lib/neutral/containers/index.mjs +17 -0
  52. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  53. package/dist/lib/neutral/create-ZUHIXCBS.mjs +46 -0
  54. package/dist/lib/neutral/create-ZUHIXCBS.mjs.map +7 -0
  55. package/dist/lib/neutral/create-object-F2NWICFV.mjs +44 -0
  56. package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +7 -0
  57. package/dist/lib/{browser/create-script-Z7J4HDV2.mjs → neutral/create-script-H5S4AO47.mjs} +6 -8
  58. package/dist/lib/neutral/create-script-H5S4AO47.mjs.map +7 -0
  59. package/dist/lib/neutral/delete-PAUWA2QM.mjs +21 -0
  60. package/dist/lib/neutral/delete-PAUWA2QM.mjs.map +7 -0
  61. package/dist/lib/neutral/deploy-M73G7HMP.mjs +63 -0
  62. package/dist/lib/neutral/deploy-M73G7HMP.mjs.map +7 -0
  63. package/dist/lib/{browser/chunk-DBEYGFVF.mjs → neutral/hooks/index.mjs} +49 -80
  64. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  65. package/dist/lib/neutral/index.mjs +41 -0
  66. package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs +59 -0
  67. package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs.map +7 -0
  68. package/dist/lib/neutral/install-function-MSWSC244.mjs +49 -0
  69. package/dist/lib/neutral/install-function-MSWSC244.mjs.map +7 -0
  70. package/dist/lib/neutral/invoke-V6XYXKLD.mjs +32 -0
  71. package/dist/lib/neutral/invoke-V6XYXKLD.mjs.map +7 -0
  72. package/dist/lib/neutral/meta.json +1 -0
  73. package/dist/lib/neutral/meta.mjs +10 -0
  74. package/dist/lib/neutral/operation-handler-KIZ7XZ5G.mjs +18 -0
  75. package/dist/lib/neutral/operation-handler-KIZ7XZ5G.mjs.map +7 -0
  76. package/dist/lib/neutral/operations/index.mjs +8 -0
  77. package/dist/lib/neutral/plugin.mjs +16 -0
  78. package/dist/lib/neutral/plugin.mjs.map +7 -0
  79. package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs +34 -0
  80. package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs.map +7 -0
  81. package/dist/lib/neutral/react-surface-K4SSUR57.mjs +120 -0
  82. package/dist/lib/neutral/react-surface-K4SSUR57.mjs.map +7 -0
  83. package/dist/lib/neutral/read-FFOSK6A3.mjs +26 -0
  84. package/dist/lib/neutral/read-FFOSK6A3.mjs.map +7 -0
  85. package/dist/lib/{browser/settings-BV3KXROF.mjs → neutral/settings-VJBW4OMK.mjs} +6 -11
  86. package/dist/lib/neutral/settings-VJBW4OMK.mjs.map +7 -0
  87. package/dist/lib/{browser → neutral}/templates/index.mjs +1 -1
  88. package/dist/lib/neutral/translations.mjs +104 -0
  89. package/dist/lib/neutral/translations.mjs.map +7 -0
  90. package/dist/lib/neutral/types/index.mjs +17 -0
  91. package/dist/lib/neutral/update-PJS5GG3Y.mjs +63 -0
  92. package/dist/lib/neutral/update-PJS5GG3Y.mjs.map +7 -0
  93. package/dist/types/src/ScriptPlugin.d.ts +1 -0
  94. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  95. package/dist/types/src/ScriptPlugin.node.d.ts +4 -0
  96. package/dist/types/src/ScriptPlugin.node.d.ts.map +1 -0
  97. package/dist/types/src/ScriptPlugin.test.d.ts +2 -0
  98. package/dist/types/src/ScriptPlugin.test.d.ts.map +1 -0
  99. package/dist/types/src/ScriptPlugin.workerd.d.ts +4 -0
  100. package/dist/types/src/ScriptPlugin.workerd.d.ts.map +1 -0
  101. package/dist/types/src/blueprints/functions/create.d.ts +11 -0
  102. package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
  103. package/dist/types/src/blueprints/functions/definitions.d.ts +129 -0
  104. package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
  105. package/dist/types/src/blueprints/functions/delete.d.ts +16 -0
  106. package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
  107. package/dist/types/src/blueprints/functions/deploy.d.ts +20 -0
  108. package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
  109. package/dist/types/src/blueprints/functions/index.d.ts +4 -0
  110. package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
  111. package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +27 -0
  112. package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
  113. package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
  114. package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
  115. package/dist/types/src/blueprints/functions/invoke.d.ts +20 -0
  116. package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
  117. package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
  118. package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
  119. package/dist/types/src/blueprints/functions/read.d.ts +20 -0
  120. package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
  121. package/dist/types/src/blueprints/functions/update.d.ts +25 -0
  122. package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
  123. package/dist/types/src/blueprints/script-blueprint.d.ts +2 -2
  124. package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
  125. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  126. package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
  127. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  128. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  129. package/dist/types/src/capabilities/compiler.d.ts +6 -0
  130. package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
  131. package/dist/types/src/capabilities/create-object.d.ts +16 -0
  132. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  133. package/dist/types/src/capabilities/index.d.ts +19 -6
  134. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  135. package/dist/types/src/capabilities/node.d.ts +18 -0
  136. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  137. package/dist/types/src/capabilities/{operation-handler/operation-handler.d.ts → operation-handler.d.ts} +1 -1
  138. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  139. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  140. package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -5
  141. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  142. package/dist/types/src/compiler/compiler.d.ts.map +1 -1
  143. package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +1 -1
  144. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +1 -1
  145. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
  146. package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +1 -1
  147. package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
  148. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +2 -6
  149. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  150. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -231
  151. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
  152. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
  153. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -1
  154. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
  155. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
  156. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts +241 -0
  157. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
  158. package/dist/types/src/components/ScriptPluginSettings/index.d.ts +2 -0
  159. package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
  160. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +3 -7
  161. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  162. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -231
  163. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
  164. package/dist/types/src/components/TestPanel/TestPanel.d.ts +1 -5
  165. package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
  166. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +3 -6
  167. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  168. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -5
  169. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
  170. package/dist/types/src/components/index.d.ts +2 -0
  171. package/dist/types/src/components/index.d.ts.map +1 -1
  172. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
  173. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +219 -231
  174. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
  175. package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -2
  176. package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -1
  177. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +7 -0
  178. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
  179. package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
  180. package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
  181. package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
  182. package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -0
  183. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +10 -0
  184. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
  185. package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +242 -0
  186. package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
  187. package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
  188. package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
  189. package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +7 -0
  190. package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
  191. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
  192. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
  193. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
  194. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
  195. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +4 -5
  196. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
  197. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +242 -0
  198. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -0
  199. package/dist/types/src/containers/ScriptProperties/index.d.ts +1 -2
  200. package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
  201. package/dist/types/src/containers/TestContainer/TestContainer.d.ts +1 -1
  202. package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -1
  203. package/dist/types/src/containers/TestContainer/index.d.ts +1 -2
  204. package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
  205. package/dist/types/src/containers/index.d.ts +2 -4
  206. package/dist/types/src/containers/index.d.ts.map +1 -1
  207. package/dist/types/src/hooks/deploy.d.ts +14 -5
  208. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  209. package/dist/types/src/hooks/format.d.ts +1 -1
  210. package/dist/types/src/hooks/format.d.ts.map +1 -1
  211. package/dist/types/src/hooks/template.d.ts +1 -1
  212. package/dist/types/src/hooks/template.d.ts.map +1 -1
  213. package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
  214. package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
  215. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
  216. package/dist/types/src/index.d.ts +2 -4
  217. package/dist/types/src/index.d.ts.map +1 -1
  218. package/dist/types/src/meta.d.ts.map +1 -1
  219. package/dist/types/src/notebook/compute-graph.d.ts +1 -1
  220. package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
  221. package/dist/types/src/notebook/eval.d.ts.map +1 -1
  222. package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -1
  223. package/dist/types/src/operations/create-script.d.ts +3 -3
  224. package/dist/types/src/operations/create-script.d.ts.map +1 -1
  225. package/dist/types/src/operations/index.d.ts +1 -2
  226. package/dist/types/src/operations/index.d.ts.map +1 -1
  227. package/dist/types/src/plugin.d.ts +4 -0
  228. package/dist/types/src/plugin.d.ts.map +1 -0
  229. package/dist/types/src/templates/anthropic.d.ts +1 -1
  230. package/dist/types/src/templates/anthropic.d.ts.map +1 -1
  231. package/dist/types/src/templates/chat.d.ts.map +1 -1
  232. package/dist/types/src/templates/chess-bot.d.ts +5 -11
  233. package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
  234. package/dist/types/src/templates/commentary.d.ts +5 -11
  235. package/dist/types/src/templates/commentary.d.ts.map +1 -1
  236. package/dist/types/src/templates/data-generator.d.ts.map +1 -1
  237. package/dist/types/src/templates/discord.d.ts.map +1 -1
  238. package/dist/types/src/templates/email.d.ts.map +1 -1
  239. package/dist/types/src/templates/forex-effect.d.ts +1 -1
  240. package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
  241. package/dist/types/src/templates/forex.d.ts +1 -1
  242. package/dist/types/src/templates/forex.d.ts.map +1 -1
  243. package/dist/types/src/templates/gmail.d.ts.map +1 -1
  244. package/dist/types/src/templates/index.d.ts +29 -29
  245. package/dist/types/src/templates/index.d.ts.map +1 -1
  246. package/dist/types/src/templates/ping.d.ts +1 -1
  247. package/dist/types/src/templates/ping.d.ts.map +1 -1
  248. package/dist/types/src/testing/index.d.ts +2 -1
  249. package/dist/types/src/testing/index.d.ts.map +1 -1
  250. package/dist/types/src/testing/test-notebook.d.ts +3 -0
  251. package/dist/types/src/testing/test-notebook.d.ts.map +1 -0
  252. package/dist/types/src/testing/test-script.d.ts +7 -0
  253. package/dist/types/src/testing/test-script.d.ts.map +1 -0
  254. package/dist/types/src/translations.d.ts +222 -94
  255. package/dist/types/src/translations.d.ts.map +1 -1
  256. package/dist/types/src/types/Notebook.d.ts +37 -29
  257. package/dist/types/src/types/Notebook.d.ts.map +1 -1
  258. package/dist/types/src/types/ScriptCapabilities.d.ts +6 -0
  259. package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -0
  260. package/dist/types/src/types/ScriptEvents.d.ts +3 -0
  261. package/dist/types/src/types/ScriptEvents.d.ts.map +1 -0
  262. package/dist/types/src/types/ScriptOperation.d.ts +29 -0
  263. package/dist/types/src/types/ScriptOperation.d.ts.map +1 -0
  264. package/dist/types/src/types/Settings.d.ts +7 -0
  265. package/dist/types/src/types/Settings.d.ts.map +1 -0
  266. package/dist/types/src/types/index.d.ts +4 -3
  267. package/dist/types/src/types/index.d.ts.map +1 -1
  268. package/dist/types/src/types/types.d.ts +1 -5
  269. package/dist/types/src/types/types.d.ts.map +1 -1
  270. package/dist/types/src/util/deploy.d.ts +1 -2
  271. package/dist/types/src/util/deploy.d.ts.map +1 -1
  272. package/dist/types/src/util/functions.d.ts +1 -2
  273. package/dist/types/src/util/functions.d.ts.map +1 -1
  274. package/dist/types/tsconfig.tsbuildinfo +1 -1
  275. package/package.json +153 -113
  276. package/src/ScriptPlugin.node.ts +21 -0
  277. package/src/ScriptPlugin.test.ts +31 -0
  278. package/src/ScriptPlugin.tsx +9 -56
  279. package/src/ScriptPlugin.workerd.ts +18 -0
  280. package/src/blueprints/functions/create.ts +47 -0
  281. package/src/blueprints/functions/definitions.ts +323 -0
  282. package/src/blueprints/functions/delete.ts +23 -0
  283. package/src/blueprints/functions/deploy.ts +71 -0
  284. package/src/blueprints/functions/index.ts +19 -0
  285. package/src/blueprints/functions/inspect-invocations.ts +56 -0
  286. package/src/blueprints/functions/install-function.ts +56 -0
  287. package/src/blueprints/functions/invoke.ts +34 -0
  288. package/src/blueprints/functions/query-deployed-functions.ts +35 -0
  289. package/src/blueprints/functions/read.ts +29 -0
  290. package/src/blueprints/functions/update.ts +68 -0
  291. package/src/blueprints/script-blueprint.ts +32 -5
  292. package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +13 -22
  293. package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +4 -5
  294. package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
  295. package/src/capabilities/{compiler/compiler.ts → compiler.ts} +17 -9
  296. package/src/capabilities/create-object.ts +48 -0
  297. package/src/capabilities/index.ts +14 -6
  298. package/src/capabilities/node.ts +16 -0
  299. package/src/capabilities/operation-handler.ts +21 -0
  300. package/src/capabilities/react-surface.tsx +130 -0
  301. package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
  302. package/src/compiler/compiler.ts +12 -1
  303. package/src/components/NotebookStack/NotebookCell.tsx +22 -11
  304. package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
  305. package/src/components/NotebookStack/NotebookStack.stories.tsx +4 -4
  306. package/src/components/NotebookStack/NotebookStack.tsx +4 -4
  307. package/src/components/QueryEditor/QueryEditor.stories.tsx +3 -3
  308. package/src/components/QueryEditor/QueryEditor.tsx +3 -1
  309. package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
  310. package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +42 -0
  311. package/src/components/ScriptPluginSettings/index.ts +5 -0
  312. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +6 -6
  313. package/src/components/ScriptToolbar/ScriptToolbar.tsx +4 -4
  314. package/src/components/TestPanel/TestPanel.tsx +5 -9
  315. package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +3 -3
  316. package/src/components/TypescriptEditor/TypescriptEditor.tsx +2 -2
  317. package/src/components/index.ts +4 -0
  318. package/src/constants.ts +1 -1
  319. package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +4 -4
  320. package/src/containers/DeploymentDialog/DeploymentDialog.tsx +14 -13
  321. package/src/containers/DeploymentDialog/index.ts +1 -3
  322. package/src/containers/{NotebookContainer/NotebookContainer.stories.tsx → NotebookArticle/NotebookArticle.stories.tsx} +15 -14
  323. package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +32 -45
  324. package/src/containers/NotebookArticle/index.ts +5 -0
  325. package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +107 -0
  326. package/src/containers/{ScriptContainer/ScriptContainer.tsx → ScriptArticle/ScriptArticle.tsx} +12 -12
  327. package/src/containers/ScriptArticle/index.ts +5 -0
  328. package/src/containers/ScriptProperties/BlueprintEditor.tsx +102 -0
  329. package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
  330. package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
  331. package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +76 -0
  332. package/src/containers/ScriptProperties/ScriptProperties.tsx +12 -21
  333. package/src/containers/ScriptProperties/index.ts +1 -3
  334. package/src/containers/TestContainer/TestContainer.tsx +7 -8
  335. package/src/containers/TestContainer/index.ts +1 -3
  336. package/src/containers/index.ts +2 -4
  337. package/src/e2e/ai.test.ts +2 -2
  338. package/src/e2e/deploy.test.ts +3 -2
  339. package/src/hooks/deploy.ts +8 -7
  340. package/src/hooks/format.ts +4 -4
  341. package/src/hooks/template.ts +6 -5
  342. package/src/hooks/useCompiler.ts +3 -2
  343. package/src/hooks/useCreateAndDeployScriptTemplates.ts +4 -3
  344. package/src/index.ts +2 -5
  345. package/src/meta.ts +1 -0
  346. package/src/notebook/compute-graph.test.ts +7 -7
  347. package/src/notebook/compute-graph.ts +1 -1
  348. package/src/notebook/vfs-parser.ts +10 -3
  349. package/src/operations/create-script.ts +3 -4
  350. package/src/operations/index.ts +2 -7
  351. package/src/plugin.ts +11 -0
  352. package/src/templates/anthropic.ts +1 -1
  353. package/src/templates/chess-bot.ts +11 -9
  354. package/src/templates/commentary.ts +27 -22
  355. package/src/templates/discord.ts +1 -1
  356. package/src/templates/forex-effect.ts +1 -1
  357. package/src/templates/forex.ts +1 -1
  358. package/src/templates/gmail.ts +1 -1
  359. package/src/templates/ping.ts +1 -1
  360. package/src/testing/index.ts +2 -1
  361. package/src/testing/simulator.test.ts +3 -4
  362. package/src/testing/{data.ts → test-notebook.ts} +11 -12
  363. package/src/testing/test-script.ts +28 -0
  364. package/src/translations.ts +86 -89
  365. package/src/types/Notebook.ts +3 -3
  366. package/src/types/ScriptCapabilities.ts +18 -0
  367. package/src/types/ScriptEvents.ts +11 -0
  368. package/src/{operations/definitions.ts → types/ScriptOperation.ts} +5 -3
  369. package/src/types/Settings.ts +20 -0
  370. package/src/types/index.ts +5 -3
  371. package/src/types/types.ts +1 -11
  372. package/src/util/deploy.ts +7 -7
  373. package/src/util/functions.ts +11 -11
  374. package/dist/lib/browser/DeploymentDialog-LGEGIX64.mjs.map +0 -7
  375. package/dist/lib/browser/NotebookContainer-CC3G32Q5.mjs.map +0 -7
  376. package/dist/lib/browser/ScriptContainer-Z3MCPN2D.mjs.map +0 -7
  377. package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs +0 -297
  378. package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs.map +0 -7
  379. package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs +0 -55
  380. package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs.map +0 -7
  381. package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs +0 -28
  382. package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs.map +0 -7
  383. package/dist/lib/browser/TestContainer-ACNQMKVU.mjs.map +0 -7
  384. package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs +0 -36
  385. package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs.map +0 -7
  386. package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs +0 -63
  387. package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs.map +0 -7
  388. package/dist/lib/browser/blueprint-definition-MC264VR5.mjs.map +0 -7
  389. package/dist/lib/browser/chunk-37XPSUAH.mjs.map +0 -7
  390. package/dist/lib/browser/chunk-4XJSGCAS.mjs +0 -742
  391. package/dist/lib/browser/chunk-4XJSGCAS.mjs.map +0 -7
  392. package/dist/lib/browser/chunk-7JI376EM.mjs +0 -20
  393. package/dist/lib/browser/chunk-7JI376EM.mjs.map +0 -7
  394. package/dist/lib/browser/chunk-ATTZUDT7.mjs +0 -67
  395. package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +0 -7
  396. package/dist/lib/browser/chunk-BHRCZLLU.mjs +0 -105
  397. package/dist/lib/browser/chunk-BHRCZLLU.mjs.map +0 -7
  398. package/dist/lib/browser/chunk-CMHREENI.mjs +0 -8
  399. package/dist/lib/browser/chunk-CMHREENI.mjs.map +0 -7
  400. package/dist/lib/browser/chunk-DBEYGFVF.mjs.map +0 -7
  401. package/dist/lib/browser/chunk-E6BQ4P6L.mjs.map +0 -7
  402. package/dist/lib/browser/chunk-GB2HL4ZE.mjs +0 -26
  403. package/dist/lib/browser/chunk-GB2HL4ZE.mjs.map +0 -7
  404. package/dist/lib/browser/chunk-NQJRENSK.mjs +0 -75
  405. package/dist/lib/browser/chunk-NQJRENSK.mjs.map +0 -7
  406. package/dist/lib/browser/chunk-QLFFA4Y4.mjs +0 -52
  407. package/dist/lib/browser/chunk-QLFFA4Y4.mjs.map +0 -7
  408. package/dist/lib/browser/chunk-X44CJ7F5.mjs +0 -11
  409. package/dist/lib/browser/chunk-X44CJ7F5.mjs.map +0 -7
  410. package/dist/lib/browser/compiler-MZKFKYCG.mjs.map +0 -7
  411. package/dist/lib/browser/create-script-Z7J4HDV2.mjs.map +0 -7
  412. package/dist/lib/browser/index.mjs +0 -268
  413. package/dist/lib/browser/index.mjs.map +0 -7
  414. package/dist/lib/browser/meta.json +0 -1
  415. package/dist/lib/browser/operation-handler-76AHUB5G.mjs +0 -18
  416. package/dist/lib/browser/operation-handler-76AHUB5G.mjs.map +0 -7
  417. package/dist/lib/browser/operations/index.mjs +0 -14
  418. package/dist/lib/browser/react-surface-2VVUIV66.mjs +0 -145
  419. package/dist/lib/browser/react-surface-2VVUIV66.mjs.map +0 -7
  420. package/dist/lib/browser/settings-BV3KXROF.mjs.map +0 -7
  421. package/dist/lib/browser/types/index.mjs +0 -15
  422. package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs +0 -125
  423. package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs.map +0 -7
  424. package/dist/lib/node-esm/NotebookContainer-LNWMJD2D.mjs +0 -851
  425. package/dist/lib/node-esm/NotebookContainer-LNWMJD2D.mjs.map +0 -7
  426. package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs +0 -96
  427. package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs.map +0 -7
  428. package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs +0 -298
  429. package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs.map +0 -7
  430. package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs +0 -56
  431. package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs.map +0 -7
  432. package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs +0 -29
  433. package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs.map +0 -7
  434. package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs +0 -62
  435. package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs.map +0 -7
  436. package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs +0 -37
  437. package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs.map +0 -7
  438. package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs +0 -64
  439. package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs.map +0 -7
  440. package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs +0 -18
  441. package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs.map +0 -7
  442. package/dist/lib/node-esm/blueprints/index.mjs +0 -9
  443. package/dist/lib/node-esm/chunk-2NGQCFVE.mjs +0 -28
  444. package/dist/lib/node-esm/chunk-2NGQCFVE.mjs.map +0 -7
  445. package/dist/lib/node-esm/chunk-4YAEFFW2.mjs +0 -12
  446. package/dist/lib/node-esm/chunk-4YAEFFW2.mjs.map +0 -7
  447. package/dist/lib/node-esm/chunk-C3GH2SDF.mjs +0 -76
  448. package/dist/lib/node-esm/chunk-C3GH2SDF.mjs.map +0 -7
  449. package/dist/lib/node-esm/chunk-CKYUNEE5.mjs +0 -10
  450. package/dist/lib/node-esm/chunk-CKYUNEE5.mjs.map +0 -7
  451. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  452. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  453. package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +0 -7
  454. package/dist/lib/node-esm/chunk-L3JLWXB5.mjs +0 -33
  455. package/dist/lib/node-esm/chunk-L3JLWXB5.mjs.map +0 -7
  456. package/dist/lib/node-esm/chunk-L55OBVT5.mjs +0 -53
  457. package/dist/lib/node-esm/chunk-L55OBVT5.mjs.map +0 -7
  458. package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs +0 -22
  459. package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs.map +0 -7
  460. package/dist/lib/node-esm/chunk-RN2SMYCL.mjs +0 -401
  461. package/dist/lib/node-esm/chunk-RN2SMYCL.mjs.map +0 -7
  462. package/dist/lib/node-esm/chunk-RTM3D4T5.mjs +0 -181
  463. package/dist/lib/node-esm/chunk-RTM3D4T5.mjs.map +0 -7
  464. package/dist/lib/node-esm/chunk-SV742UH7.mjs.map +0 -7
  465. package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs +0 -107
  466. package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs.map +0 -7
  467. package/dist/lib/node-esm/compiler-QBWP7ERK.mjs +0 -99
  468. package/dist/lib/node-esm/compiler-QBWP7ERK.mjs.map +0 -7
  469. package/dist/lib/node-esm/create-script-TAJHVROB.mjs +0 -48
  470. package/dist/lib/node-esm/create-script-TAJHVROB.mjs.map +0 -7
  471. package/dist/lib/node-esm/index.mjs +0 -269
  472. package/dist/lib/node-esm/index.mjs.map +0 -7
  473. package/dist/lib/node-esm/meta.json +0 -1
  474. package/dist/lib/node-esm/operation-handler-OUROH3T7.mjs +0 -19
  475. package/dist/lib/node-esm/operation-handler-OUROH3T7.mjs.map +0 -7
  476. package/dist/lib/node-esm/operations/index.mjs +0 -15
  477. package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs +0 -146
  478. package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs.map +0 -7
  479. package/dist/lib/node-esm/settings-2TK3XPLD.mjs +0 -36
  480. package/dist/lib/node-esm/settings-2TK3XPLD.mjs.map +0 -7
  481. package/dist/lib/node-esm/templates/index.mjs +0 -11
  482. package/dist/lib/node-esm/templates/index.mjs.map +0 -7
  483. package/dist/lib/node-esm/types/index.mjs +0 -16
  484. package/dist/lib/node-esm/types/index.mjs.map +0 -7
  485. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  486. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  487. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  488. package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
  489. package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
  490. package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
  491. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
  492. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
  493. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
  494. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
  495. package/dist/types/src/capabilities/compiler/compiler.d.ts +0 -6
  496. package/dist/types/src/capabilities/compiler/compiler.d.ts.map +0 -1
  497. package/dist/types/src/capabilities/compiler/index.d.ts +0 -3
  498. package/dist/types/src/capabilities/compiler/index.d.ts.map +0 -1
  499. package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -4
  500. package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
  501. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
  502. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  503. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  504. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  505. package/dist/types/src/capabilities/settings/index.d.ts +0 -7
  506. package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
  507. package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
  508. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +0 -7
  509. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +0 -1
  510. package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +0 -7
  511. package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +0 -1
  512. package/dist/types/src/containers/NotebookContainer/index.d.ts +0 -3
  513. package/dist/types/src/containers/NotebookContainer/index.d.ts.map +0 -1
  514. package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +0 -10
  515. package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +0 -1
  516. package/dist/types/src/containers/ScriptContainer/index.d.ts +0 -3
  517. package/dist/types/src/containers/ScriptContainer/index.d.ts.map +0 -1
  518. package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +0 -7
  519. package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +0 -1
  520. package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +0 -3
  521. package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +0 -1
  522. package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +0 -8
  523. package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +0 -1
  524. package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +0 -3
  525. package/dist/types/src/containers/ScriptPluginSettings/index.d.ts.map +0 -1
  526. package/dist/types/src/operations/access-token-created.d.ts +0 -5
  527. package/dist/types/src/operations/access-token-created.d.ts.map +0 -1
  528. package/dist/types/src/operations/definitions.d.ts +0 -28
  529. package/dist/types/src/operations/definitions.d.ts.map +0 -1
  530. package/dist/types/src/testing/data.d.ts +0 -3
  531. package/dist/types/src/testing/data.d.ts.map +0 -1
  532. package/dist/types/src/types/capabilities.d.ts +0 -12
  533. package/dist/types/src/types/capabilities.d.ts.map +0 -1
  534. package/dist/types/src/types/events.d.ts +0 -5
  535. package/dist/types/src/types/events.d.ts.map +0 -1
  536. package/src/capabilities/app-graph-builder/index.ts +0 -7
  537. package/src/capabilities/artifact-definition/index.ts +0 -7
  538. package/src/capabilities/blueprint-definition/index.ts +0 -7
  539. package/src/capabilities/compiler/index.ts +0 -7
  540. package/src/capabilities/operation-handler/index.ts +0 -11
  541. package/src/capabilities/operation-handler/operation-handler.ts +0 -16
  542. package/src/capabilities/react-surface/index.ts +0 -7
  543. package/src/capabilities/react-surface/react-surface.tsx +0 -138
  544. package/src/capabilities/settings/index.ts +0 -7
  545. package/src/containers/NotebookContainer/index.ts +0 -7
  546. package/src/containers/ScriptContainer/index.ts +0 -7
  547. package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +0 -295
  548. package/src/containers/ScriptObjectSettings/index.ts +0 -7
  549. package/src/containers/ScriptPluginSettings/ScriptPluginSettings.tsx +0 -66
  550. package/src/containers/ScriptPluginSettings/index.ts +0 -7
  551. package/src/operations/access-token-created.ts +0 -36
  552. package/src/types/capabilities.ts +0 -17
  553. package/src/types/events.ts +0 -11
  554. /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
  555. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  556. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
  557. /package/dist/lib/{browser/operations → neutral}/index.mjs.map +0 -0
  558. /package/dist/lib/{browser/templates/index.mjs.map → neutral/meta.mjs.map} +0 -0
  559. /package/dist/lib/{browser/types → neutral/operations}/index.mjs.map +0 -0
  560. /package/dist/lib/{node-esm/blueprints → neutral/templates}/index.mjs.map +0 -0
  561. /package/dist/lib/{node-esm/operations → neutral/types}/index.mjs.map +0 -0
  562. /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
  563. /package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +0 -0
  564. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
@@ -1,851 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- NotebookMenu,
4
- NotebookStack
5
- } from "./chunk-SV742UH7.mjs";
6
- import "./chunk-JGN7TDJH.mjs";
7
- import "./chunk-RN2SMYCL.mjs";
8
- import "./chunk-RTM3D4T5.mjs";
9
- import "./chunk-CKYUNEE5.mjs";
10
- import "./chunk-C3GH2SDF.mjs";
11
- import "./chunk-L55OBVT5.mjs";
12
- import {
13
- meta
14
- } from "./chunk-L3JLWXB5.mjs";
15
- import "./chunk-Y5VWHRVU.mjs";
16
- import "./chunk-HSLMI22Q.mjs";
17
-
18
- // src/containers/NotebookContainer/NotebookContainer.tsx
19
- import { RegistryContext } from "@effect-atom/atom-react";
20
- import * as Cause from "effect/Cause";
21
- import * as Effect from "effect/Effect";
22
- import * as Exit from "effect/Exit";
23
- import React, { useCallback, useContext, useMemo, useState } from "react";
24
- import { AgentPrompt } from "@dxos/assistant-toolkit";
25
- import { Blueprint, Prompt } from "@dxos/blueprints";
26
- import { Filter, Obj, Query, Ref } from "@dxos/echo";
27
- import { QueryBuilder } from "@dxos/echo-query";
28
- import { FunctionInvocationService, TracingService } from "@dxos/functions";
29
- import { invariant as invariant2 } from "@dxos/invariant";
30
- import { log as log2 } from "@dxos/log";
31
- import { useComputeRuntimeCallback } from "@dxos/plugin-automation";
32
- import { Graph } from "@dxos/plugin-explorer/types";
33
- import { DropdownMenu, IconButton, Panel, Toolbar, useTranslation } from "@dxos/react-ui";
34
- import { useAttention } from "@dxos/react-ui-attention";
35
- import { Text, ViewModel } from "@dxos/schema";
36
- import { isNonNullable } from "@dxos/util";
37
-
38
- // src/notebook/compute-graph.ts
39
- import { Atom } from "@effect-atom/atom-react";
40
- import { log } from "@dxos/log";
41
-
42
- // src/notebook/eval.ts
43
- import { trim } from "@dxos/util";
44
- var evalScript = async (code, deps = {}) => {
45
- const sandbox = {
46
- ...deps,
47
- // Block access to global objects.
48
- console: void 0,
49
- document: void 0,
50
- global: void 0,
51
- globalThis: void 0,
52
- self: void 0,
53
- window: void 0,
54
- // Allow some safe globals.
55
- Array,
56
- Boolean,
57
- Date,
58
- Error,
59
- JSON,
60
- Map,
61
- Math,
62
- Number,
63
- Object,
64
- Promise,
65
- RegExp,
66
- Set,
67
- String,
68
- // Functions.
69
- isFinite,
70
- isNaN,
71
- parseFloat,
72
- parseInt
73
- };
74
- const sandboxKeys = Object.keys(sandbox);
75
- const sandboxValues = Object.values(sandbox);
76
- const fn2 = new Function(...sandboxKeys, trim`
77
- 'use strict';
78
- return ${code};
79
- `);
80
- return fn2(...sandboxValues);
81
- };
82
- var builtIns = /* @__PURE__ */ new Set([
83
- // Types.
84
- "Array",
85
- "Date",
86
- "Error",
87
- "JSON",
88
- "Map",
89
- "Math",
90
- "Number",
91
- "Object",
92
- "Promise",
93
- "RegExp",
94
- "Set",
95
- "String",
96
- // Functions.
97
- "isFinite",
98
- "isNaN",
99
- "parseFloat",
100
- "parseInt"
101
- ]);
102
- var systemDefinitions = trim`
103
- interface Array<T> { length: number; [n: number]: T; }
104
- interface Boolean {}
105
- interface Function {}
106
- interface IArguments {}
107
- interface Number {}
108
- interface Object {}
109
- interface RegExp {}
110
- interface String { length: number; }
111
-
112
- interface CallableFunction extends Function {}
113
- interface NewableFunction extends Function {}
114
-
115
- declare var console: { log(...args: any[]): void };
116
- `;
117
-
118
- // src/notebook/vfs-parser.ts
119
- import { createSystem, createVirtualTypeScriptEnvironment } from "@typescript/vfs";
120
- import ts from "typescript";
121
- import { invariant } from "@dxos/invariant";
122
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/notebook/vfs-parser.ts";
123
- var systemFiles = [
124
- {
125
- filename: "/lib.d.ts",
126
- content: systemDefinitions
127
- }
128
- ];
129
- var VirtualTypeScriptParser = class {
130
- compilerOptions = {
131
- target: ts.ScriptTarget.ES2020,
132
- module: ts.ModuleKind.ESNext,
133
- strict: true,
134
- esModuleInterop: true,
135
- skipLibCheck: true,
136
- forceConsistentCasingInfilenames: true,
137
- jsx: ts.JsxEmit.React,
138
- noLib: true
139
- };
140
- /**
141
- * Parse a single expression or statement.
142
- */
143
- parseExpression(input) {
144
- invariant(input.trim() !== "", "input must not be empty", {
145
- F: __dxlog_file,
146
- L: 57,
147
- S: this,
148
- A: [
149
- "input.trim() !== ''",
150
- "'input must not be empty'"
151
- ]
152
- });
153
- const files = [
154
- {
155
- filename: "/temp.ts",
156
- content: input
157
- }
158
- ];
159
- const analysis = this.analyzeFiles(files);
160
- if (analysis.length === 0) {
161
- const sourcefilename = "/temp.ts";
162
- const env = this.createEnvironment([
163
- {
164
- filename: sourcefilename,
165
- content: input
166
- }
167
- ]);
168
- const sourceFile = env.getSourceFile(sourcefilename);
169
- const typeChecker = env.languageService.getProgram()?.getTypeChecker();
170
- if (sourceFile && typeChecker) {
171
- const assignmentInfo = this.findAssignmentExpression(sourceFile, typeChecker);
172
- if (assignmentInfo) {
173
- return assignmentInfo;
174
- }
175
- const references = this.findAllReferences(sourceFile, typeChecker);
176
- return {
177
- references
178
- };
179
- }
180
- }
181
- return analysis[0];
182
- }
183
- /**
184
- * Analyze multiple files with full type information.
185
- */
186
- analyzeFiles(files) {
187
- const env = this.createEnvironment(files);
188
- const results = [];
189
- const typeChecker = env.languageService.getProgram()?.getTypeChecker();
190
- files.forEach((file) => {
191
- const sourceFile = env.getSourceFile(file.filename);
192
- if (!sourceFile || !typeChecker) return;
193
- const fileResults = this.analyzeSourceFile(sourceFile, typeChecker);
194
- results.push(...fileResults);
195
- });
196
- return results;
197
- }
198
- /**
199
- * Analyze a source file with type information.
200
- */
201
- analyzeSourceFile(sourceFile, typeChecker) {
202
- const results = [];
203
- const visit = (node) => {
204
- if (ts.isFunctionDeclaration(node) && node.name) {
205
- const symbol = typeChecker.getSymbolAtLocation(node.name);
206
- const type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, node);
207
- const signature = type && typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call)[0];
208
- results.push({
209
- name: node.name.text,
210
- type: "function",
211
- parameters: this.extractParameters(signature, typeChecker),
212
- returnType: signature ? typeChecker.typeToString(signature.getReturnType()) : "any",
213
- references: this.findReferences(node, sourceFile, typeChecker)
214
- });
215
- } else if (ts.isVariableStatement(node)) {
216
- node.declarationList.declarations.forEach((declaration) => {
217
- if (ts.isIdentifier(declaration.name)) {
218
- const symbol = typeChecker.getSymbolAtLocation(declaration.name);
219
- const type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);
220
- let kind = "variable";
221
- let parameters;
222
- let returnType;
223
- let value;
224
- const typeString = type ? typeChecker.typeToString(type) : "any";
225
- if (declaration.initializer) {
226
- if (ts.isArrowFunction(declaration.initializer) || ts.isFunctionExpression(declaration.initializer)) {
227
- kind = "function";
228
- const funcType = typeChecker.getTypeAtLocation(declaration.initializer);
229
- const signature = typeChecker.getSignaturesOfType(funcType, ts.SignatureKind.Call)[0];
230
- if (signature) {
231
- parameters = this.extractParameters(signature, typeChecker);
232
- returnType = typeChecker.typeToString(signature.getReturnType());
233
- }
234
- } else {
235
- if (ts.isNumericLiteral(declaration.initializer)) {
236
- value = Number(declaration.initializer.text);
237
- } else if (ts.isStringLiteral(declaration.initializer)) {
238
- value = declaration.initializer.text;
239
- }
240
- }
241
- }
242
- const refs = declaration.initializer ? this.findReferences(declaration.initializer, sourceFile, typeChecker) : [];
243
- results.push({
244
- name: declaration.name.text,
245
- type: kind,
246
- valueType: typeString,
247
- value,
248
- parameters,
249
- returnType,
250
- references: refs
251
- });
252
- }
253
- });
254
- } else if (ts.isClassDeclaration(node) && node.name) {
255
- results.push({
256
- name: node.name.text,
257
- type: "class",
258
- references: this.findReferences(node, sourceFile, typeChecker)
259
- });
260
- } else if (ts.isInterfaceDeclaration(node)) {
261
- results.push({
262
- name: node.name.text,
263
- type: "interface",
264
- references: this.findReferences(node, sourceFile, typeChecker)
265
- });
266
- }
267
- ts.forEachChild(node, visit);
268
- };
269
- visit(sourceFile);
270
- return results;
271
- }
272
- /**
273
- * Extract parameter information from a signature.
274
- */
275
- extractParameters(signature, typeChecker) {
276
- if (!signature) return [];
277
- return signature.parameters.map((param) => ({
278
- name: param.getName(),
279
- type: typeChecker.typeToString(typeChecker.getTypeOfSymbolAtLocation(param, param.valueDeclaration))
280
- }));
281
- }
282
- /**
283
- * Find all references to variables used in a node.
284
- */
285
- findReferences(node, _sourceFile, _typeChecker) {
286
- const references = /* @__PURE__ */ new Set();
287
- const localSymbols = /* @__PURE__ */ new Set();
288
- const collectLocalSymbols = (node2) => {
289
- if (ts.isFunctionDeclaration(node2) || ts.isArrowFunction(node2) || ts.isFunctionExpression(node2)) {
290
- node2.parameters.forEach((param) => {
291
- if (ts.isIdentifier(param.name)) {
292
- localSymbols.add(param.name.text);
293
- }
294
- });
295
- }
296
- if (ts.isVariableDeclaration(node2) && ts.isIdentifier(node2.name)) {
297
- localSymbols.add(node2.name.text);
298
- }
299
- ts.forEachChild(node2, collectLocalSymbols);
300
- };
301
- collectLocalSymbols(node);
302
- const findRefs = (node2) => {
303
- if (ts.isIdentifier(node2)) {
304
- if (!localSymbols.has(node2.text)) {
305
- const parent = node2.parent;
306
- const isDeclaration = ts.isVariableDeclaration(parent) && parent.name === node2 || ts.isFunctionDeclaration(parent) && parent.name === node2 || ts.isParameter(parent) && parent.name === node2;
307
- if (!isDeclaration && !this.isBuiltIn(node2.text)) {
308
- references.add(node2.text);
309
- }
310
- }
311
- }
312
- ts.forEachChild(node2, findRefs);
313
- };
314
- findRefs(node);
315
- return Array.from(references);
316
- }
317
- /**
318
- * Check if a name is a built-in global.
319
- */
320
- isBuiltIn(name) {
321
- return builtIns.has(name);
322
- }
323
- /**
324
- * Find assignment expressions in a source file.
325
- */
326
- findAssignmentExpression(sourceFile, typeChecker) {
327
- let result = null;
328
- const visit = (node) => {
329
- if (ts.isExpressionStatement(node) && ts.isBinaryExpression(node.expression)) {
330
- const expr = node.expression;
331
- if (expr.operatorToken.kind === ts.SyntaxKind.EqualsToken && ts.isIdentifier(expr.left)) {
332
- const type = typeChecker.getTypeAtLocation(expr.right);
333
- const typeString = typeChecker.typeToString(type);
334
- let value;
335
- if (ts.isNumericLiteral(expr.right)) {
336
- value = Number(expr.right.text);
337
- } else if (ts.isStringLiteral(expr.right)) {
338
- value = expr.right.text;
339
- }
340
- const references = this.findReferences(expr.right, sourceFile, typeChecker);
341
- result = {
342
- name: expr.left.text,
343
- type: "variable",
344
- valueType: typeString,
345
- value,
346
- references
347
- };
348
- }
349
- }
350
- if (!result) {
351
- ts.forEachChild(node, visit);
352
- }
353
- };
354
- visit(sourceFile);
355
- return result;
356
- }
357
- /**
358
- * Find all identifier references in a source file.
359
- */
360
- findAllReferences(sourceFile, _typeChecker) {
361
- const references = /* @__PURE__ */ new Set();
362
- const visit = (node) => {
363
- if (ts.isIdentifier(node)) {
364
- const parent = node.parent;
365
- const isDeclaration = ts.isVariableDeclaration(parent) && parent.name === node || ts.isFunctionDeclaration(parent) && parent.name === node || ts.isParameter(parent) && parent.name === node;
366
- const isAssignmentTarget = ts.isBinaryExpression(parent) && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken && parent.left === node;
367
- if (!isDeclaration && !isAssignmentTarget && !this.isBuiltIn(node.text)) {
368
- references.add(node.text);
369
- }
370
- }
371
- ts.forEachChild(node, visit);
372
- };
373
- visit(sourceFile);
374
- return Array.from(references);
375
- }
376
- createEnvironment(files) {
377
- const allFiles = [
378
- ...systemFiles,
379
- ...files
380
- ];
381
- const fileMap = /* @__PURE__ */ new Map();
382
- allFiles.forEach(({ filename, content }) => {
383
- fileMap.set(filename, content);
384
- });
385
- const system = createSystem(fileMap);
386
- return createVirtualTypeScriptEnvironment(system, allFiles.map(({ filename }) => filename), ts, this.compilerOptions);
387
- }
388
- };
389
-
390
- // src/notebook/compute-graph.ts
391
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/notebook/compute-graph.ts";
392
- var ComputeGraph = class {
393
- _notebook;
394
- _registry;
395
- _parser = new VirtualTypeScriptParser();
396
- _expressionsAtom = Atom.make({});
397
- _valuesByCellIdAtom = Atom.make({});
398
- _valuesByNameAtom = Atom.make({});
399
- constructor(_notebook, _registry) {
400
- this._notebook = _notebook;
401
- this._registry = _registry;
402
- }
403
- /**
404
- * Atom for parsed expressions by cell ID.
405
- */
406
- get expressions() {
407
- return this._expressionsAtom;
408
- }
409
- /**
410
- * Get current expressions by cell ID.
411
- */
412
- getExpressions() {
413
- return this._registry.get(this._expressionsAtom);
414
- }
415
- /**
416
- * Atom for computed values by cell ID.
417
- */
418
- get values() {
419
- return this._valuesByCellIdAtom;
420
- }
421
- /**
422
- * Get computed values by cell ID.
423
- */
424
- getValues() {
425
- return this._registry.get(this._valuesByCellIdAtom);
426
- }
427
- /**
428
- * Atom for computed values by name.
429
- */
430
- get valuesByName() {
431
- return this._valuesByNameAtom;
432
- }
433
- /**
434
- * Get current values by name.
435
- */
436
- getValuesByName() {
437
- return this._registry.get(this._valuesByNameAtom);
438
- }
439
- /**
440
- * Get computed value by cell ID.
441
- */
442
- getValue(cellId) {
443
- return this._registry.get(this._valuesByCellIdAtom)[cellId];
444
- }
445
- /**
446
- * Compute values.
447
- */
448
- async evaluate() {
449
- const { expressions, dependencyGraph } = this.parse();
450
- this._registry.set(this._valuesByCellIdAtom, {});
451
- this._registry.set(this._valuesByNameAtom, {});
452
- const cellExpressions = /* @__PURE__ */ new Map();
453
- Object.entries(expressions).forEach(([id, expr]) => {
454
- cellExpressions.set(id, expr);
455
- });
456
- const evaluationOrder = this.topologicalSort(Object.keys(expressions), dependencyGraph);
457
- const valuesByName = {};
458
- const valuesByCellId = {};
459
- for (const cellId of evaluationOrder) {
460
- const expr = cellExpressions.get(cellId);
461
- if (!expr) {
462
- log.error("no expression for cell", {
463
- cellId
464
- }, {
465
- F: __dxlog_file2,
466
- L: 105,
467
- S: this,
468
- C: (f, a) => f(...a)
469
- });
470
- continue;
471
- }
472
- const cellSource = this._notebook.cells.find((cell) => cell.id === cellId)?.source?.target?.content;
473
- if (!cellSource) {
474
- log.error("no source for cell", {
475
- cellId
476
- }, {
477
- F: __dxlog_file2,
478
- L: 111,
479
- S: this,
480
- C: (f, a) => f(...a)
481
- });
482
- continue;
483
- }
484
- try {
485
- if (expr.name && expr.value !== void 0) {
486
- valuesByName[expr.name] = expr.value;
487
- valuesByCellId[cellId] = expr.value;
488
- } else if (expr.name) {
489
- const equalIndex = cellSource.indexOf("=");
490
- if (equalIndex !== -1) {
491
- let rhs = cellSource.substring(equalIndex + 1).trim();
492
- if (rhs.endsWith(";")) {
493
- rhs = rhs.slice(0, -1).trim();
494
- }
495
- const result = await this.eval(rhs, valuesByName);
496
- valuesByName[expr.name] = result;
497
- if (typeof result !== "function") {
498
- valuesByCellId[cellId] = result;
499
- }
500
- }
501
- } else {
502
- const result = await this.eval(cellSource, valuesByName);
503
- valuesByCellId[cellId] = result;
504
- }
505
- } catch (error) {
506
- log.error("error evaluating cell", {
507
- cellId,
508
- error
509
- }, {
510
- F: __dxlog_file2,
511
- L: 147,
512
- S: this,
513
- C: (f, a) => f(...a)
514
- });
515
- }
516
- }
517
- this._registry.set(this._valuesByCellIdAtom, valuesByCellId);
518
- this._registry.set(this._valuesByNameAtom, valuesByName);
519
- return valuesByCellId;
520
- }
521
- async eval(source, values) {
522
- return evalScript(source, values);
523
- }
524
- /**
525
- * Parse expressions.
526
- */
527
- parse() {
528
- const expressions = this._notebook.cells.filter((cell) => cell.type === "script").reduce((acc, cell) => {
529
- const text = cell.source?.target?.content.trim();
530
- if (text) {
531
- const parsed = this._parser.parseExpression(text);
532
- acc[cell.id] = parsed;
533
- }
534
- return acc;
535
- }, {});
536
- const dependencyGraph = this.buildDependencyGraph(expressions);
537
- this._registry.set(this._expressionsAtom, expressions);
538
- return {
539
- expressions,
540
- dependencyGraph
541
- };
542
- }
543
- topologicalSort(nodes, dependencies) {
544
- const visited = /* @__PURE__ */ new Set();
545
- const result = [];
546
- const visit = (node) => {
547
- if (visited.has(node)) {
548
- return;
549
- }
550
- visited.add(node);
551
- const deps = dependencies[node] || [];
552
- deps.forEach((dep) => visit(dep));
553
- result.push(node);
554
- };
555
- nodes.forEach((node) => visit(node));
556
- return result;
557
- }
558
- buildDependencyGraph(expressions) {
559
- const nameToCellId = /* @__PURE__ */ new Map();
560
- Object.entries(expressions).forEach(([id, expr]) => {
561
- if (expr.name) {
562
- nameToCellId.set(expr.name, id);
563
- }
564
- });
565
- const graph = {};
566
- Object.entries(expressions).forEach(([id, expr]) => {
567
- if (expr.references && expr.references.length > 0) {
568
- const dependencyCellIds = expr.references.map((ref) => nameToCellId.get(ref)).filter((cellId) => cellId !== void 0 && cellId !== id);
569
- if (dependencyCellIds.length > 0) {
570
- graph[id] = dependencyCellIds;
571
- }
572
- }
573
- });
574
- return graph;
575
- }
576
- };
577
-
578
- // src/containers/NotebookContainer/NotebookContainer.tsx
579
- var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/containers/NotebookContainer/NotebookContainer.tsx";
580
- var INCLUDE_BLUEPRINTS = [
581
- "org.dxos.blueprint.assistant",
582
- "org.dxos.blueprint.database",
583
- "org.dxos.blueprint.markdown"
584
- ];
585
- var NotebookContainer = ({ role, subject: notebook, attendableId, env }) => {
586
- const { t } = useTranslation(meta.id);
587
- const registry = useContext(RegistryContext);
588
- const db = Obj.getDatabase(notebook);
589
- const { hasAttention } = useAttention(attendableId);
590
- const graph = useMemo(() => notebook && new ComputeGraph(notebook, registry), [
591
- notebook,
592
- registry
593
- ]);
594
- const [queryValues, setQueryValues] = useState({});
595
- const handleExecQueries = useCallback(async () => {
596
- invariant2(db, void 0, {
597
- F: __dxlog_file3,
598
- L: 55,
599
- S: void 0,
600
- A: [
601
- "db",
602
- ""
603
- ]
604
- });
605
- const builder = new QueryBuilder();
606
- for (const cell of notebook?.cells ?? []) {
607
- if (cell.type === "query") {
608
- if (cell.source?.target) {
609
- const source = cell.source.target.content;
610
- const { name, filter } = builder.build(source);
611
- if (filter) {
612
- const ast = Query.select(filter).ast;
613
- const graph2 = cell.graph?.target;
614
- if (!graph2) {
615
- const { view } = await ViewModel.makeFromDatabase({
616
- db
617
- });
618
- const newGraph = Graph.make({
619
- query: {
620
- ast
621
- },
622
- view
623
- });
624
- Obj.change(notebook, (obj) => {
625
- const c = obj.cells.find((c2) => c2.id === cell.id);
626
- if (c) {
627
- c.graph = Ref.make(newGraph);
628
- c.name = name;
629
- }
630
- });
631
- } else {
632
- Obj.change(graph2, (obj) => {
633
- obj.query.ast = ast;
634
- });
635
- }
636
- }
637
- }
638
- if (cell.name && cell.graph?.target) {
639
- const graph2 = Obj.getSnapshot(cell.graph?.target);
640
- const query = Query.fromAst(graph2.query.ast);
641
- const objects = await db.query(query).run();
642
- const objectIds = objects?.map((obj) => obj.id);
643
- setQueryValues((prev) => ({
644
- ...prev,
645
- [cell.name]: objectIds
646
- }));
647
- }
648
- }
649
- }
650
- }, [
651
- db,
652
- notebook,
653
- graph
654
- ]);
655
- const [promptResults, setPromptResults] = useState({});
656
- const handleExecPrompts = useComputeRuntimeCallback(db?.spaceId, Effect.fnUntraced(function* () {
657
- invariant2(graph, void 0, {
658
- F: __dxlog_file3,
659
- L: 99,
660
- S: this,
661
- A: [
662
- "graph",
663
- ""
664
- ]
665
- });
666
- const prompts = notebook?.cells.filter((cell) => cell.type === "prompt").map((cell) => cell.prompt).filter(isNonNullable) ?? [];
667
- for (const prompt of prompts) {
668
- yield* runPrompt({
669
- prompt,
670
- input: {
671
- ...queryValues,
672
- ...graph.getValuesByName()
673
- },
674
- onResult: (result) => setPromptResults((prev) => ({
675
- ...prev,
676
- [prompt.dxn.toString()]: result
677
- }))
678
- });
679
- }
680
- }), [
681
- notebook,
682
- graph,
683
- queryValues
684
- ]);
685
- const handleCompute = useCallback(async () => {
686
- await graph?.evaluate();
687
- await handleExecQueries();
688
- await handleExecPrompts();
689
- }, [
690
- graph,
691
- handleExecQueries,
692
- handleExecPrompts
693
- ]);
694
- const handleRearrange = useCallback((source, target) => {
695
- invariant2(notebook, void 0, {
696
- F: __dxlog_file3,
697
- L: 132,
698
- S: void 0,
699
- A: [
700
- "notebook",
701
- ""
702
- ]
703
- });
704
- const from = notebook.cells.findIndex((cell) => cell.id === source.id);
705
- const to = notebook.cells.findIndex((cell) => cell.id === target.id);
706
- if (from != null && to != null) {
707
- Obj.change(notebook, (obj) => {
708
- const cell = obj.cells.splice(from, 1)[0];
709
- if (cell) {
710
- obj.cells.splice(to, 0, cell);
711
- }
712
- });
713
- }
714
- }, [
715
- notebook
716
- ]);
717
- const handleCellInsert = useCallback(async (type, after) => {
718
- invariant2(notebook, void 0, {
719
- F: __dxlog_file3,
720
- L: 149,
721
- S: void 0,
722
- A: [
723
- "notebook",
724
- ""
725
- ]
726
- });
727
- const cell = {
728
- id: crypto.randomUUID(),
729
- type
730
- };
731
- switch (type) {
732
- case "markdown":
733
- case "script":
734
- case "query": {
735
- cell.source = Ref.make(Text.make());
736
- break;
737
- }
738
- case "prompt": {
739
- if (db) {
740
- const objects = await db.query(Query.select(Filter.type(Blueprint.Blueprint))).run();
741
- const blueprints = objects.filter((blueprint) => INCLUDE_BLUEPRINTS.includes(blueprint.key)).map((blueprint) => Ref.make(blueprint));
742
- cell.prompt = Ref.make(Prompt.make({
743
- instructions: "",
744
- blueprints
745
- }));
746
- }
747
- break;
748
- }
749
- }
750
- const idx = after ? notebook.cells.findIndex((cell2) => cell2.id === after) : notebook.cells.length;
751
- Obj.change(notebook, (obj) => {
752
- obj.cells.splice(idx, 0, cell);
753
- });
754
- }, [
755
- db,
756
- notebook
757
- ]);
758
- const handleCellDelete = useCallback((id) => {
759
- invariant2(notebook, void 0, {
760
- F: __dxlog_file3,
761
- L: 181,
762
- S: void 0,
763
- A: [
764
- "notebook",
765
- ""
766
- ]
767
- });
768
- const idx = notebook.cells.findIndex((cell) => cell.id === id);
769
- if (idx !== -1) {
770
- Obj.change(notebook, (obj) => {
771
- obj.cells.splice(idx, 1);
772
- });
773
- }
774
- }, [
775
- notebook
776
- ]);
777
- return /* @__PURE__ */ React.createElement(Panel.Root, {
778
- role,
779
- className: "dx-document"
780
- }, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
781
- asChild: true
782
- }, /* @__PURE__ */ React.createElement(Toolbar.Root, {
783
- disabled: !hasAttention
784
- }, /* @__PURE__ */ React.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React.createElement(DropdownMenu.Trigger, {
785
- asChild: true
786
- }, /* @__PURE__ */ React.createElement(IconButton, {
787
- icon: "ph--plus--regular",
788
- iconOnly: true,
789
- label: t("notebook cell insert label")
790
- })), /* @__PURE__ */ React.createElement(NotebookMenu, {
791
- onCellInsert: handleCellInsert
792
- })), /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
793
- icon: "ph--play--fill",
794
- iconOnly: true,
795
- label: t("compute label"),
796
- classNames: "text-success-text",
797
- onClick: handleCompute
798
- }))), /* @__PURE__ */ React.createElement(Panel.Content, {
799
- asChild: true
800
- }, /* @__PURE__ */ React.createElement(NotebookStack, {
801
- db,
802
- notebook,
803
- graph,
804
- env,
805
- promptResults,
806
- onRearrange: handleRearrange,
807
- onCellInsert: handleCellInsert,
808
- onCellDelete: handleCellDelete
809
- })));
810
- };
811
- var runPrompt = Effect.fn(function* ({ prompt, input, onResult }) {
812
- const inputData = {
813
- prompt,
814
- input
815
- };
816
- const tracer = yield* TracingService;
817
- const trace = yield* tracer.traceInvocationStart({
818
- target: void 0,
819
- payload: {
820
- data: {}
821
- }
822
- });
823
- const result = yield* FunctionInvocationService.invokeFunction(AgentPrompt, inputData).pipe(Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop), Effect.exit);
824
- Exit.match(result, {
825
- onFailure: (cause) => {
826
- const error = Cause.prettyErrors(cause)[0];
827
- log2.error(error.message, error.cause ?? error.stack, {
828
- F: __dxlog_file3,
829
- L: 255,
830
- S: this,
831
- C: (f, a) => f(...a)
832
- });
833
- onResult(error.message);
834
- },
835
- onSuccess: (result2) => {
836
- onResult(result2.note);
837
- }
838
- });
839
- yield* tracer.traceInvocationEnd({
840
- trace,
841
- // TODO(dmaretskyi): Might miss errors.
842
- exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : void 0
843
- });
844
- });
845
-
846
- // src/containers/NotebookContainer/index.ts
847
- var NotebookContainer_default = NotebookContainer;
848
- export {
849
- NotebookContainer_default as default
850
- };
851
- //# sourceMappingURL=NotebookContainer-LNWMJD2D.mjs.map