@theoremjs/studio 0.0.0-stage → 0.3.2

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 (473) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +295 -2
  3. package/agreement.d.ts +14 -0
  4. package/agreement.js +80 -0
  5. package/asks.d.ts +47 -0
  6. package/asks.js +54 -0
  7. package/browser-connection.d.ts +49 -0
  8. package/browser-connection.js +215 -0
  9. package/browser-engine.d.ts +11 -0
  10. package/browser-engine.js +11 -0
  11. package/browser-execution.d.ts +6 -0
  12. package/browser-execution.js +18 -0
  13. package/browser-live.d.ts +4 -0
  14. package/browser-live.js +132 -0
  15. package/browser-transport.d.ts +33 -0
  16. package/browser-transport.js +229 -0
  17. package/browser.d.ts +4 -0
  18. package/browser.js +4 -0
  19. package/canonical.d.ts +10 -0
  20. package/canonical.js +25 -0
  21. package/compile-workspace.d.ts +28 -0
  22. package/compile-workspace.js +295 -0
  23. package/compile.d.ts +65 -0
  24. package/compile.js +1605 -0
  25. package/concierge-demo.d.ts +17 -0
  26. package/concierge-demo.js +1230 -0
  27. package/conversation-key.d.ts +5 -0
  28. package/conversation-key.js +10 -0
  29. package/decision-example-images.d.ts +30 -0
  30. package/decision-example-images.js +30 -0
  31. package/deno.json +3 -0
  32. package/draft.d.ts +407 -0
  33. package/draft.js +505 -0
  34. package/editors.d.ts +29 -0
  35. package/editors.js +51 -0
  36. package/example-embedding-files.d.ts +11 -0
  37. package/example-embedding-files.js +20 -0
  38. package/example.d.ts +36 -0
  39. package/example.js +357 -0
  40. package/guardrail-probe.d.ts +100 -0
  41. package/guardrail-probe.js +722 -0
  42. package/held-credentials.d.ts +28 -0
  43. package/held-credentials.js +87 -0
  44. package/installed.mjs +40 -0
  45. package/lent-keys.d.ts +122 -0
  46. package/lent-keys.js +47 -0
  47. package/line-diff.d.ts +15 -0
  48. package/line-diff.js +41 -0
  49. package/live-connection.d.ts +22 -0
  50. package/live-connection.js +27 -0
  51. package/live-session-bridge.d.ts +15 -0
  52. package/live-session-bridge.js +202 -0
  53. package/map-line.d.ts +19 -0
  54. package/map-line.js +42 -0
  55. package/map.d.ts +154 -0
  56. package/map.js +525 -0
  57. package/media-accept.d.ts +19 -0
  58. package/media-accept.js +65 -0
  59. package/mod.d.ts +39 -0
  60. package/mod.js +33 -0
  61. package/origins.d.ts +52 -0
  62. package/origins.js +165 -0
  63. package/package.json +85 -4
  64. package/page/assets/Banner-BISz3nXA.js +2 -0
  65. package/page/assets/BottomSheet-BwfBDtje.js +1 -0
  66. package/page/assets/Card-Lp-0P5eL.js +1 -0
  67. package/page/assets/CardWall-CBRLdDZW.js +1 -0
  68. package/page/assets/Center-nHS1JSux.js +1 -0
  69. package/page/assets/CheckboxInput-Cj5pk-KI.js +2 -0
  70. package/page/assets/CodeBlock-C7XJ4ioE.js +51 -0
  71. package/page/assets/CollapsibleGroup-N7_SOjbm.js +2 -0
  72. package/page/assets/ContextMenu-CBu9H-9H.js +2 -0
  73. package/page/assets/DateInput-BGrQ5tPC.js +1 -0
  74. package/page/assets/Dialog-DELWQo-v.js +1 -0
  75. package/page/assets/EmptyState-C8W4JKBZ.js +1 -0
  76. package/page/assets/HoverCard-D1Y1ltWQ.js +1 -0
  77. package/page/assets/Icon-JrysT8aU.js +3 -0
  78. package/page/assets/IconAlertTriangle-BqAEqqdU.js +1 -0
  79. package/page/assets/IconButton-DlOGzJIX.js +1 -0
  80. package/page/assets/IconEye-BB5aY-wQ.js +1 -0
  81. package/page/assets/IconFileText-6zOFKKrF.js +1 -0
  82. package/page/assets/IconSearch-BTx66a40.js +1 -0
  83. package/page/assets/IconShield-DDOh7Gr5.js +1 -0
  84. package/page/assets/ItemSwipeLayer-Ckn4X6h9.js +1 -0
  85. package/page/assets/PaneState-BvA2tLQg.js +1 -0
  86. package/page/assets/PaneState-eUzUkNE8.css +1 -0
  87. package/page/assets/ScrollableArea-Ckugdj1N.js +1 -0
  88. package/page/assets/Section-DJ97F7QE.js +1 -0
  89. package/page/assets/SegmentedControlItem-h-aaXzyS.js +1 -0
  90. package/page/assets/SidePanel-BL32abk8.js +1 -0
  91. package/page/assets/StackItem-CQviqAfM.js +1 -0
  92. package/page/assets/Text-bum6zWWx.js +2 -0
  93. package/page/assets/TimestampHoverCard-DQIG0RZF.js +1 -0
  94. package/page/assets/ToolResultCharts-CgshSv9Q.js +1 -0
  95. package/page/assets/Tooltip-BH9xiRMl.js +1 -0
  96. package/page/assets/TraceInspector-_yZiz05W.js +1 -0
  97. package/page/assets/TraceOverview-BPO-HIYK.js +57 -0
  98. package/page/assets/VStack-CkVMcNiK.js +1 -0
  99. package/page/assets/_virtual_studio-type-sources-ByxqQaOG.js +12936 -0
  100. package/page/assets/arrive-DvbqpeRS.js +1 -0
  101. package/page/assets/browser-engine-CYq9DQAM.js +9 -0
  102. package/page/assets/browser-transport-D-2jDYe7.js +47 -0
  103. package/page/assets/codicon-DF1abBS2.ttf +0 -0
  104. package/page/assets/compile-egress-BSxOdX4K.js +23 -0
  105. package/page/assets/container.stylex-BmOi-8DQ.js +1 -0
  106. package/page/assets/createReactComponent-CZwsv6DD.js +1 -0
  107. package/page/assets/decision-example-images-CZGr7YIT.js +1 -0
  108. package/page/assets/devWarning-DxuplmRl.js +1 -0
  109. package/page/assets/editor-DjpsE8to.css +1 -0
  110. package/page/assets/editor.api-Cd3ViPQa.js +908 -0
  111. package/page/assets/editor.worker-6GY8RhDc.js +1 -0
  112. package/page/assets/editor.worker-BmdWdrHZ.js +33 -0
  113. package/page/assets/editors-BJX_S59A.js +1 -0
  114. package/page/assets/egress-automata-B5ZGE1mT.js +1 -0
  115. package/page/assets/embedding-space-view-CfQBPDxD.js +140 -0
  116. package/page/assets/encode-files-Bc3HJyAh.js +1 -0
  117. package/page/assets/export-agent-C3yyzXH8.js +43 -0
  118. package/page/assets/figtree-latin-400-normal-BD4aNku5.woff +0 -0
  119. package/page/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
  120. package/page/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
  121. package/page/assets/figtree-latin-500-normal-B_yy1phn.woff +0 -0
  122. package/page/assets/figtree-latin-600-normal-BM_oTo4n.woff +0 -0
  123. package/page/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
  124. package/page/assets/figtree-latin-700-normal-BCCt2T1q.woff +0 -0
  125. package/page/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
  126. package/page/assets/focusOutline.stylex-BT0kfa4t.js +1 -0
  127. package/page/assets/focusableSelector-DXZeMU85.js +1 -0
  128. package/page/assets/groupStyles-C7Ter7zC.js +1 -0
  129. package/page/assets/guardrail-tester-Gut5xK4a.js +9 -0
  130. package/page/assets/host-patterns-C9RMP16Q.js +1 -0
  131. package/page/assets/index-CvvmFKgS.js +105 -0
  132. package/page/assets/index-DOaHlqBo.css +1 -0
  133. package/page/assets/isRtlElement-BG33-k_H.js +1 -0
  134. package/page/assets/labels-provider-4TIWDvsE.js +3 -0
  135. package/page/assets/lent-keys-C32ems-I.js +1 -0
  136. package/page/assets/live-ingress-lDUGPwth.js +1 -0
  137. package/page/assets/live-messages-CnkL4GWi.js +1 -0
  138. package/page/assets/mergeProps-ptS-gIMz.js +1 -0
  139. package/page/assets/padding.stylex-B76907Zf.js +1 -0
  140. package/page/assets/preload-helper-DpV6A1kQ.js +1 -0
  141. package/page/assets/reader-BOCCYaRp.js +7 -0
  142. package/page/assets/register-CDgivxvX.js +2 -0
  143. package/page/assets/rolldown-runtime-hePW80VL.js +1 -0
  144. package/page/assets/schemas-BQ9Jydzb.js +56 -0
  145. package/page/assets/shaped-data-BcarWqd5.js +16 -0
  146. package/page/assets/sharedResizeObserver-4U9Xq5Oq.js +1 -0
  147. package/page/assets/stub-DhdcU_Ew.js +471 -0
  148. package/page/assets/studio-code-pane-C_SAbcOa.js +8 -0
  149. package/page/assets/studio-console-DZwlEsvr.js +3 -0
  150. package/page/assets/studio-decision-B0FnCAXA.js +1 -0
  151. package/page/assets/studio-embedding-CmA51HVo.js +2 -0
  152. package/page/assets/studio-host-console-By7hqu2l.js +2 -0
  153. package/page/assets/studio-live-BrcVQcyV.js +1 -0
  154. package/page/assets/studio-map-B_xSia-z.js +1 -0
  155. package/page/assets/studio-map-Bb06Tw1F.css +1 -0
  156. package/page/assets/studio-monaco-CbKf90i6.css +1 -0
  157. package/page/assets/studio-monaco-xfyfezQS.js +34 -0
  158. package/page/assets/studio-ts.worker-B-EXG4Sv.js +67741 -0
  159. package/page/assets/studio-ts.worker-BXtW3z-O.js +1 -0
  160. package/page/assets/studio-type-checker-BOvxudki.js +23 -0
  161. package/page/assets/themeProps-3IqahpCr.js +1 -0
  162. package/page/assets/tokens.stylex-DkHf0P9C.js +1 -0
  163. package/page/assets/tool-schema-idaOe2nI.js +18 -0
  164. package/page/assets/trace-patterns-DnYJa0nI.js +1 -0
  165. package/page/assets/trace-record-C3zNksA_.js +1 -0
  166. package/page/assets/trace-schema-9CdEyG6Q.js +1 -0
  167. package/page/assets/tree-DqyAMsbI.js +3 -0
  168. package/page/assets/turn-client-Du3Um3Mg.js +2 -0
  169. package/page/assets/types-BhfXQCLx.js +1 -0
  170. package/page/assets/typescript-20GgZ8PJ.js +1 -0
  171. package/page/assets/use-one-call-Hcs8YBp1.js +1 -0
  172. package/page/assets/useAdaptivePresentation-BzmPCddb.js +1 -0
  173. package/page/assets/useClipboard-BgGRxRMJ.js +1 -0
  174. package/page/assets/useContainerReveal-BFy8N_QU.js +1 -0
  175. package/page/assets/useDevWarning-Z9SoixOP.js +1 -0
  176. package/page/assets/useLayerDismissal-B_G7IWpC.js +1 -0
  177. package/page/assets/useMediaQuery-BCT0NUeZ.js +1 -0
  178. package/page/assets/useScrollLock-Dyf6PHJt.js +1 -0
  179. package/page/assets/useScrollableArea-0NzdiBCq.js +1 -0
  180. package/page/assets/useTooltip-CJM_xhLB.js +1 -0
  181. package/page/assets/workspace-DZALqEDX.js +1 -0
  182. package/page/assets/zip-DTcEfps6.js +1 -0
  183. package/page/index.html +90 -0
  184. package/page.mjs +49 -0
  185. package/people.d.ts +87 -0
  186. package/people.js +110 -0
  187. package/policy.d.ts +43 -0
  188. package/policy.js +102 -0
  189. package/ports.d.mts +32 -0
  190. package/ports.mjs +85 -0
  191. package/probe-battery.d.ts +13 -0
  192. package/probe-battery.js +404 -0
  193. package/providers.d.ts +149 -0
  194. package/providers.js +306 -0
  195. package/read-source.d.ts +48 -0
  196. package/read-source.js +1301 -0
  197. package/read-steps.d.ts +23 -0
  198. package/read-steps.js +2 -0
  199. package/reader.d.ts +11 -0
  200. package/reader.js +11 -0
  201. package/registrations.d.ts +83 -0
  202. package/registrations.js +1 -0
  203. package/requirements.d.ts +22 -0
  204. package/requirements.js +38 -0
  205. package/run-payload-core.d.ts +28 -0
  206. package/run-payload-core.js +123 -0
  207. package/run-payload.d.ts +32 -0
  208. package/run-payload.js +26 -0
  209. package/runtime-scope.d.ts +84 -0
  210. package/runtime-scope.js +308 -0
  211. package/runtime.d.ts +84 -0
  212. package/runtime.js +387 -0
  213. package/section-notes.d.ts +33 -0
  214. package/section-notes.js +38 -0
  215. package/serve-page.mjs +96 -0
  216. package/server/draft-decide.d.ts +72 -0
  217. package/server/draft-decide.js +111 -0
  218. package/server/draft-embedding.d.ts +3 -0
  219. package/server/draft-embedding.js +35 -0
  220. package/server/draft-handler.d.ts +82 -0
  221. package/server/draft-handler.js +213 -0
  222. package/server/draft-probe.d.ts +14 -0
  223. package/server/draft-probe.js +61 -0
  224. package/server/draft-replies.d.ts +22 -0
  225. package/server/draft-replies.js +46 -0
  226. package/server/edited-session.d.ts +28 -0
  227. package/server/edited-session.js +83 -0
  228. package/server/edits.d.ts +38 -0
  229. package/server/edits.js +195 -0
  230. package/server/handler.d.ts +133 -0
  231. package/server/handler.js +598 -0
  232. package/server/lent-draft.d.ts +19 -0
  233. package/server/lent-draft.js +23 -0
  234. package/server/live.d.ts +15 -0
  235. package/server/live.js +96 -0
  236. package/server/open-editor.d.ts +63 -0
  237. package/server/open-editor.js +115 -0
  238. package/server/origins.d.ts +18 -0
  239. package/server/origins.js +330 -0
  240. package/server/project-source.d.ts +208 -0
  241. package/server/project-source.js +1042 -0
  242. package/server/project.d.ts +22 -0
  243. package/server/project.js +56 -0
  244. package/server/run-traces.d.ts +20 -0
  245. package/server/run-traces.js +96 -0
  246. package/server/save-new.d.ts +29 -0
  247. package/server/save-new.js +514 -0
  248. package/server/save-plan.d.ts +46 -0
  249. package/server/save-plan.js +1134 -0
  250. package/server/save-remove.d.ts +21 -0
  251. package/server/save-remove.js +528 -0
  252. package/server/save-session.d.ts +96 -0
  253. package/server/save-session.js +418 -0
  254. package/server/save-wire.d.ts +235 -0
  255. package/server/save-wire.js +8 -0
  256. package/server/save.d.ts +52 -0
  257. package/server/save.js +209 -0
  258. package/server/serve.d.ts +23 -0
  259. package/server/serve.js +413 -0
  260. package/server/test-connection.d.ts +17 -0
  261. package/server/test-connection.js +362 -0
  262. package/server/test-key.d.ts +2 -0
  263. package/server/test-key.js +83 -0
  264. package/server/watch.d.ts +28 -0
  265. package/server/watch.js +93 -0
  266. package/server/zod-edit.d.ts +74 -0
  267. package/server/zod-edit.js +558 -0
  268. package/server.d.ts +8 -0
  269. package/server.js +8 -0
  270. package/setups.mjs +170 -0
  271. package/shared-carry.d.ts +114 -0
  272. package/shared-carry.js +523 -0
  273. package/shared-settings.d.ts +34 -0
  274. package/shared-settings.js +70 -0
  275. package/source.d.ts +75 -0
  276. package/source.js +414 -0
  277. package/start.mjs +169 -0
  278. package/stream-lines.d.ts +9 -0
  279. package/stream-lines.js +27 -0
  280. package/stub.d.ts +6 -0
  281. package/stub.js +33 -0
  282. package/surface.d.ts +53 -0
  283. package/surface.js +631 -0
  284. package/system-markup.d.ts +20 -0
  285. package/system-markup.js +51 -0
  286. package/tool-schema.d.ts +23 -0
  287. package/tool-schema.js +69 -0
  288. package/tools.d.ts +16 -0
  289. package/tools.js +91 -0
  290. package/traces.d.ts +24 -0
  291. package/traces.js +29 -0
  292. package/transport.d.ts +57 -0
  293. package/transport.js +187 -0
  294. package/tree.d.ts +32 -0
  295. package/tree.js +83 -0
  296. package/types.d.ts +62 -0
  297. package/types.js +6 -0
  298. package/ui/acting-as-button.d.ts +2 -0
  299. package/ui/acting-as-button.js +16 -0
  300. package/ui/add-provider.d.ts +13 -0
  301. package/ui/add-provider.js +20 -0
  302. package/ui/boot-mark.css +53 -0
  303. package/ui/boot-mark.d.ts +19 -0
  304. package/ui/boot-mark.js +128 -0
  305. package/ui/boot-paint.d.ts +8 -0
  306. package/ui/boot-paint.js +8 -0
  307. package/ui/brand-icons.d.ts +57 -0
  308. package/ui/brand-icons.js +148 -0
  309. package/ui/built/theme.css +830 -0
  310. package/ui/built/theme.css.d.ts +9 -0
  311. package/ui/built/theorem-studio.d.ts +13 -0
  312. package/ui/built/theorem-studio.js +705 -0
  313. package/ui/built/theorem-studio.variants.d.ts +28 -0
  314. package/ui/code/monaco-contributions.d.ts +45 -0
  315. package/ui/code/studio-code.d.ts +7 -0
  316. package/ui/code/studio-code.js +253 -0
  317. package/ui/code/studio-monaco.d.ts +44 -0
  318. package/ui/code/studio-monaco.js +48 -0
  319. package/ui/code/studio-ts.worker.d.ts +1 -0
  320. package/ui/code/studio-ts.worker.js +16 -0
  321. package/ui/code/studio-type-checker.d.ts +12 -0
  322. package/ui/code/studio-type-checker.js +308 -0
  323. package/ui/code/studio-type-sources.d.ts +26 -0
  324. package/ui/confirm-write.d.ts +12 -0
  325. package/ui/confirm-write.js +45 -0
  326. package/ui/diff-block.d.ts +21 -0
  327. package/ui/diff-block.js +17 -0
  328. package/ui/figtree.css +59 -0
  329. package/ui/file-place.d.ts +4 -0
  330. package/ui/file-place.js +26 -0
  331. package/ui/guardrail-tester.d.ts +18 -0
  332. package/ui/guardrail-tester.js +248 -0
  333. package/ui/inspector-context.d.ts +119 -0
  334. package/ui/inspector-context.js +84 -0
  335. package/ui/inspector.d.ts +247 -0
  336. package/ui/inspector.js +284 -0
  337. package/ui/lib/acting-as.d.ts +25 -0
  338. package/ui/lib/acting-as.js +90 -0
  339. package/ui/lib/boot-sequence.d.ts +32 -0
  340. package/ui/lib/boot-sequence.js +57 -0
  341. package/ui/lib/export-agent.d.ts +11 -0
  342. package/ui/lib/export-agent.js +335 -0
  343. package/ui/lib/facet-icons.d.ts +20 -0
  344. package/ui/lib/facet-icons.js +21 -0
  345. package/ui/lib/panel-motion.d.ts +8 -0
  346. package/ui/lib/panel-motion.js +74 -0
  347. package/ui/lib/project-address.d.ts +14 -0
  348. package/ui/lib/project-address.js +24 -0
  349. package/ui/lib/project-starting.d.ts +13 -0
  350. package/ui/lib/project-starting.js +30 -0
  351. package/ui/lib/project-traces.d.ts +17 -0
  352. package/ui/lib/project-traces.js +54 -0
  353. package/ui/lib/read-map.d.ts +30 -0
  354. package/ui/lib/read-map.js +173 -0
  355. package/ui/lib/read-progress.d.ts +14 -0
  356. package/ui/lib/read-progress.js +12 -0
  357. package/ui/lib/refusal-lines.d.ts +3 -0
  358. package/ui/lib/refusal-lines.js +8 -0
  359. package/ui/lib/studio-activity.d.ts +5 -0
  360. package/ui/lib/studio-activity.js +17 -0
  361. package/ui/lib/studio-console.d.ts +27 -0
  362. package/ui/lib/studio-console.js +9 -0
  363. package/ui/lib/studio-conversation.d.ts +20 -0
  364. package/ui/lib/studio-conversation.js +130 -0
  365. package/ui/lib/studio-examples.d.ts +31 -0
  366. package/ui/lib/studio-examples.js +25 -0
  367. package/ui/lib/studio-labels.d.ts +6 -0
  368. package/ui/lib/studio-labels.js +13 -0
  369. package/ui/lib/studio-map-kept.d.ts +17 -0
  370. package/ui/lib/studio-map-kept.js +48 -0
  371. package/ui/lib/studio-open.d.ts +22 -0
  372. package/ui/lib/studio-open.js +54 -0
  373. package/ui/lib/studio-page.d.ts +33 -0
  374. package/ui/lib/studio-page.js +121 -0
  375. package/ui/lib/studio-prefs.d.ts +26 -0
  376. package/ui/lib/studio-prefs.js +87 -0
  377. package/ui/lib/studio-project.d.ts +106 -0
  378. package/ui/lib/studio-project.js +177 -0
  379. package/ui/lib/studio-restore.d.ts +49 -0
  380. package/ui/lib/studio-restore.js +251 -0
  381. package/ui/lib/studio-run-open.d.ts +15 -0
  382. package/ui/lib/studio-run-open.js +16 -0
  383. package/ui/lib/studio-session.d.ts +34 -0
  384. package/ui/lib/studio-session.js +17 -0
  385. package/ui/lib/studio-settings.d.ts +15 -0
  386. package/ui/lib/studio-settings.js +48 -0
  387. package/ui/lib/studio-store.d.ts +64 -0
  388. package/ui/lib/studio-store.js +391 -0
  389. package/ui/lib/studio-watch.d.ts +12 -0
  390. package/ui/lib/studio-watch.js +27 -0
  391. package/ui/lib/tab-fills.d.ts +6 -0
  392. package/ui/lib/tab-fills.js +14 -0
  393. package/ui/lib/tool-credentials.d.ts +3 -0
  394. package/ui/lib/tool-credentials.js +23 -0
  395. package/ui/lib/tool-probe.d.ts +19 -0
  396. package/ui/lib/tool-probe.js +104 -0
  397. package/ui/lib/type-icons.d.ts +35 -0
  398. package/ui/lib/type-icons.js +38 -0
  399. package/ui/lib/when-idle.d.ts +5 -0
  400. package/ui/lib/when-idle.js +14 -0
  401. package/ui/lib/zip.d.ts +5 -0
  402. package/ui/lib/zip.js +8 -0
  403. package/ui/map-token.css +11 -0
  404. package/ui/map-token.d.ts +17 -0
  405. package/ui/map-token.js +29 -0
  406. package/ui/mcp-icon.d.ts +6 -0
  407. package/ui/mcp-icon.js +8 -0
  408. package/ui/motion.css +113 -0
  409. package/ui/pan.d.ts +32 -0
  410. package/ui/pan.js +90 -0
  411. package/ui/profile-editor.d.ts +33 -0
  412. package/ui/profile-editor.js +2638 -0
  413. package/ui/provider-editor.d.ts +15 -0
  414. package/ui/provider-editor.js +92 -0
  415. package/ui/read-map.css +48 -0
  416. package/ui/read-map.d.ts +7 -0
  417. package/ui/read-map.js +163 -0
  418. package/ui/refusal-detail.d.ts +4 -0
  419. package/ui/refusal-detail.js +21 -0
  420. package/ui/shared-change.d.ts +9 -0
  421. package/ui/shared-change.js +28 -0
  422. package/ui/shell-motion.css +121 -0
  423. package/ui/shell-motion.d.ts +73 -0
  424. package/ui/shell-motion.js +194 -0
  425. package/ui/studio-code-pane.d.ts +19 -0
  426. package/ui/studio-code-pane.js +44 -0
  427. package/ui/studio-compare.d.ts +80 -0
  428. package/ui/studio-compare.js +326 -0
  429. package/ui/studio-conflicts.d.ts +17 -0
  430. package/ui/studio-conflicts.js +87 -0
  431. package/ui/studio-connection.d.ts +64 -0
  432. package/ui/studio-connection.js +286 -0
  433. package/ui/studio-decision.d.ts +6 -0
  434. package/ui/studio-decision.js +49 -0
  435. package/ui/studio-embedding.d.ts +6 -0
  436. package/ui/studio-embedding.js +30 -0
  437. package/ui/studio-host-console.d.ts +6 -0
  438. package/ui/studio-host-console.js +17 -0
  439. package/ui/studio-host.d.ts +73 -0
  440. package/ui/studio-host.js +12 -0
  441. package/ui/studio-live.d.ts +17 -0
  442. package/ui/studio-live.js +26 -0
  443. package/ui/studio-map.css +273 -0
  444. package/ui/studio-map.d.ts +17 -0
  445. package/ui/studio-map.js +397 -0
  446. package/ui/studio-nav.d.ts +24 -0
  447. package/ui/studio-nav.js +17 -0
  448. package/ui/studio-no-project.d.ts +5 -0
  449. package/ui/studio-no-project.js +9 -0
  450. package/ui/studio-run.css +76 -0
  451. package/ui/studio-run.d.ts +14 -0
  452. package/ui/studio-run.js +119 -0
  453. package/ui/studio-runner.d.ts +45 -0
  454. package/ui/studio-runner.js +187 -0
  455. package/ui/studio-save.d.ts +49 -0
  456. package/ui/studio-save.js +307 -0
  457. package/ui/studio-screen.d.ts +61 -0
  458. package/ui/studio-screen.js +2078 -0
  459. package/ui/studio-settings.d.ts +31 -0
  460. package/ui/studio-settings.js +288 -0
  461. package/ui/studio-shell.css +27 -0
  462. package/ui/studio-shell.d.ts +43 -0
  463. package/ui/studio-shell.js +87 -0
  464. package/ui/studio-theme.d.ts +7 -0
  465. package/ui/studio-theme.js +94 -0
  466. package/ui/studio.css +427 -0
  467. package/ui/theorem-mark.css +84 -0
  468. package/ui/theorem-mark.d.ts +22 -0
  469. package/ui/theorem-mark.js +21 -0
  470. package/vite.d.mts +30 -0
  471. package/vite.mjs +277 -0
  472. package/workspace.d.ts +230 -0
  473. package/workspace.js +1054 -0
@@ -0,0 +1,247 @@
1
+ import type { InputStatus } from '@astryxdesign/core/Field';
2
+ import { type IconType } from '@astryxdesign/core/Icon';
3
+ import { type SelectorOptionType } from '@astryxdesign/core/Selector';
4
+ import { type ReactNode } from 'react';
5
+ import type { SettingOrigin } from '../server/save-wire.ts';
6
+ /**
7
+ * Controls the project's files set in code: they show their value and take no edit. A disabled
8
+ * fieldset turns off every control inside it, whatever kind it is.
9
+ */
10
+ export declare function SetInCode({ children }: {
11
+ children: ReactNode;
12
+ }): import("react").JSX.Element;
13
+ /**
14
+ * Under a value the files set in code: one quiet line saying what sets it. Clicking it opens that
15
+ * line in the builder's editor. Hovering shows the whole of it, with the full path to copy when
16
+ * no editor opens.
17
+ */
18
+ export declare function OriginLine({ origin, onOpen }: {
19
+ origin: SettingOrigin;
20
+ onOpen: () => void;
21
+ }): import("react").JSX.Element;
22
+ /**
23
+ * A captioned group of rows. The panel stays at zero padding and each section carries the gutter.
24
+ * Transparent, so the panel's own surface shows through. The title shows the catalog entry of the
25
+ * field the section edits (`path`) on hover, as a row's label does. Under it, `note`: only what
26
+ * the catalog does not say, such as how the editor or the studio treats the field.
27
+ */
28
+ export declare function InspectorSection({ title, path, note, children, }: {
29
+ title?: string;
30
+ path?: string;
31
+ note?: string;
32
+ children: ReactNode;
33
+ }): import("react").JSX.Element;
34
+ /**
35
+ * The name of a group of rows inside a section. Astryx's ladder, top down: the page title is 14
36
+ * bold, a section title 14 semibold, this 12 semibold in primary, a row label 12 regular in
37
+ * secondary. `hint` says what the group is, on hover.
38
+ */
39
+ export declare function InspectorGroupTitle({ title, hint }: {
40
+ title: string;
41
+ hint?: string;
42
+ }): import("react").JSX.Element;
43
+ /**
44
+ * One row: the label column, then the controls for it. `path` is the field's schema catalog path;
45
+ * `hasIssue` marks the row for the issue pill. With `hasNote`, a note sits under the control, so the
46
+ * label stays beside the control and not halfway down the note.
47
+ */
48
+ export declare function InspectorRow({ label, path, isRequired, hasIssue, hasNote, children, }: {
49
+ label: string;
50
+ path: string;
51
+ /** Notes "Required" under the label. */
52
+ isRequired?: boolean;
53
+ hasIssue?: boolean;
54
+ hasNote?: boolean;
55
+ children: ReactNode;
56
+ }): import("react").JSX.Element;
57
+ /** Says whether the row's field is required now, for one required only in some cases. */
58
+ export type IsRequired = {
59
+ isRequired?: boolean;
60
+ };
61
+ /** What a field row takes: its label, its catalog path, and the draft field whose issues show on it. */
62
+ export type FieldRowProps = {
63
+ label: string;
64
+ path: string;
65
+ /** The draft field whose issues show on this row. */
66
+ field?: string;
67
+ } & IsRequired;
68
+ /**
69
+ * Free text. Left blank, it shows `placeholder`, a value Tab takes up to edit (an example, or the
70
+ * default); else `hint`, or what leaving it out does.
71
+ */
72
+ export declare function TextRow(props: FieldRowProps & {
73
+ value: string;
74
+ status?: InputStatus;
75
+ placeholder?: string;
76
+ hint?: string;
77
+ /** The most characters the field takes; typing stops there. */
78
+ maxLength?: number;
79
+ onChange: (next: string) => void;
80
+ }): import("react").JSX.Element;
81
+ /**
82
+ * Longer text, under its label rather than beside it: wording and JSON. Left blank, it shows
83
+ * `placeholder` (for wording, the kernel's own default line) for Tab to take up, else `hint`.
84
+ */
85
+ export declare function TextAreaRow(props: FieldRowProps & {
86
+ value: string;
87
+ placeholder?: string;
88
+ hint?: string;
89
+ rows?: number;
90
+ hasSpellCheck?: boolean;
91
+ /** A status of the row's own, such as text that is not JSON; the field's issues win. */
92
+ status?: InputStatus;
93
+ onChange: (next: string) => void;
94
+ }): import("react").JSX.Element;
95
+ /** A number the kernel leaves unset when cleared: it gives `null`, shown as what leaving it out does. */
96
+ export declare function NumberRow(props: FieldRowProps & {
97
+ value: number | null;
98
+ min?: number;
99
+ max?: number;
100
+ step?: number;
101
+ isIntegerOnly?: boolean;
102
+ /** Shown at the end of the input, e.g. `ms`. */
103
+ units?: string;
104
+ /** Shown while blank, in place of what leaving it out does. */
105
+ hint?: string;
106
+ /** A note of the row's own, such as what the value set does; the field's issues win. */
107
+ status?: InputStatus;
108
+ onChange: (next: number | null) => void;
109
+ }): import("react").JSX.Element;
110
+ /**
111
+ * A slider's value: one that is always set, or one that can be blank, whose thumb sits at
112
+ * `fallback` while it is.
113
+ */
114
+ export type SliderValue = {
115
+ value: number;
116
+ fallback?: undefined;
117
+ onChange: (next: number) => void;
118
+ } | {
119
+ value: number | null;
120
+ fallback: number;
121
+ onChange: (next: number | null) => void;
122
+ };
123
+ /**
124
+ * A number on a slider, shown by `format` (compact by default). One that can be blank sits at
125
+ * `fallback`, where the provider puts it, and reads "Default" until moved; reset puts it back.
126
+ */
127
+ export declare function SliderRow(props: {
128
+ label: string;
129
+ path: string;
130
+ /** The draft field whose issues show on this row. */
131
+ field?: string;
132
+ min: number;
133
+ max: number;
134
+ step: number;
135
+ format?: (value: number) => string;
136
+ } & SliderValue): import("react").JSX.Element;
137
+ /** On or off. What leaving it out does shows on hover. */
138
+ export declare function SwitchRow({ label, path, field, value, isDisabled, disabledMessage, onChange, }: {
139
+ label: string;
140
+ path: string;
141
+ /** The draft field whose issues show on this row. */
142
+ field?: string;
143
+ value: boolean;
144
+ isDisabled?: boolean;
145
+ /** Why it's off limits, on hover and focus, when `isDisabled`. */
146
+ disabledMessage?: string;
147
+ onChange: (next: boolean) => void;
148
+ }): import("react").JSX.Element;
149
+ export interface Segment<T extends string> {
150
+ value: T;
151
+ label: string;
152
+ icon: IconType;
153
+ /** What it means, on hover, for a segment the catalog has no option for. */
154
+ description?: string;
155
+ isDisabled?: boolean;
156
+ /** Why it can't be picked, on hover, when `isDisabled`. */
157
+ disabledMessage?: string;
158
+ /** The pick the kernel recommends here: its name says so, on hover and to a screen reader. */
159
+ isRecommended?: boolean;
160
+ }
161
+ export type SegmentedRowProps<T extends string> = {
162
+ label: string;
163
+ path: string;
164
+ /** The draft field whose issues show on this row. */
165
+ field?: string;
166
+ value: T;
167
+ segments: readonly Segment<T>[];
168
+ isDisabled?: boolean;
169
+ warning?: string;
170
+ /** A status of the row's own, such as an issue on a page the row opens; the field's issues win. */
171
+ status?: InputStatus;
172
+ /** A control after the segments, on the same line. */
173
+ trailing?: ReactNode;
174
+ /** Past this many options, the row is a dropdown of the same options rather than segments. */
175
+ selectorPast?: number;
176
+ onChange: (next: T) => void;
177
+ } & IsRequired;
178
+ /**
179
+ * A closed set, as icon segments, or a dropdown of the same options past `selectorPast`. Each
180
+ * option's label is its accessible name, and it shows with the schema's description of that
181
+ * option, on hover as a segment or under it in the list. `warning` says, under it, when the pick is
182
+ * valid but won't do what it looks like; a compile issue on the row shows instead.
183
+ */
184
+ export declare function SegmentedRow<T extends string>({ label, path, field, value, segments, isDisabled, isRequired, warning, status: given, trailing, selectorPast, onChange, }: SegmentedRowProps<T>): import("react").JSX.Element;
185
+ /** One option of a `ChoiceRow`: its value alone, or with a label, a description, or disabled. */
186
+ export type Choice<T extends string> = T | {
187
+ value: T;
188
+ label?: string;
189
+ description?: string;
190
+ disabled?: boolean;
191
+ };
192
+ export type ChoiceRowProps<T extends string> = {
193
+ label: string;
194
+ path: string;
195
+ /** The draft field whose issues show on this row. */
196
+ field?: string;
197
+ value: T | '';
198
+ options: readonly Choice<T>[];
199
+ isDisabled?: boolean;
200
+ hasSearch?: boolean;
201
+ /** The options are still arriving. */
202
+ isLoading?: boolean;
203
+ /** What an empty list says. */
204
+ emptyText?: string;
205
+ /** What the blank row says, in place of what leaving the field out does. */
206
+ placeholder?: string;
207
+ /** A status of the row's own, such as a list that failed to load; the field's issues win. */
208
+ status?: InputStatus;
209
+ /** Each option's description shows on hover, not under its name: for long ones, such as a protocol's. */
210
+ hasHoverDescriptions?: boolean;
211
+ onChange: (next: T | '') => void;
212
+ } & IsRequired;
213
+ /**
214
+ * A choice from a list, `''` when none is chosen. An optional one can be cleared, and shows what
215
+ * leaving it out does while blank. `hasSearch` filters a long list. A value the list leaves out
216
+ * shows as itself, marked "Not in the list", so a list never hides or rewrites what the file says.
217
+ */
218
+ export declare function ChoiceRow<T extends string>({ label, path, field, value, options, isDisabled, isRequired, hasSearch, isLoading, emptyText, placeholder, status: given, hasHoverDescriptions, onChange, }: ChoiceRowProps<T>): import("react").JSX.Element;
219
+ /**
220
+ * Several choices from a list, the first few as badges and the rest counted (`ListBadges`): the
221
+ * trigger is one line tall, and Astryx wraps badges past it. Left empty, it shows what leaving it
222
+ * out does.
223
+ */
224
+ export declare function ListRow({ label, path, field, value, options, onChange, }: {
225
+ label: string;
226
+ path: string;
227
+ /** The draft field whose issues show on this row. */
228
+ field?: string;
229
+ value: string[];
230
+ options: SelectorOptionType[];
231
+ onChange: (next: string[]) => void;
232
+ }): import("react").JSX.Element;
233
+ /**
234
+ * Free-form names, typed and committed with Enter, each a token. Duplicates and blanks never make
235
+ * it in. `disabledMessage` says why, when `isDisabled`.
236
+ */
237
+ export declare function NamesRow({ label, path, field, value, placeholder, isDisabled, disabledMessage, onChange, }: {
238
+ label: string;
239
+ path: string;
240
+ /** The draft field whose issues show on this row. */
241
+ field?: string;
242
+ value: string[];
243
+ placeholder?: string;
244
+ isDisabled?: boolean;
245
+ disabledMessage?: string;
246
+ onChange: (next: string[]) => void;
247
+ }): import("react").JSX.Element;
@@ -0,0 +1,284 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FieldStatus } from '@astryxdesign/core/FieldStatus';
3
+ import { HoverCard } from '@astryxdesign/core/HoverCard';
4
+ import { HStack } from '@astryxdesign/core/HStack';
5
+ import { useClipboard } from '@astryxdesign/core/hooks';
6
+ import { Icon } from '@astryxdesign/core/Icon';
7
+ import { IconButton } from '@astryxdesign/core/IconButton';
8
+ import { MultiSelector } from '@astryxdesign/core/MultiSelector';
9
+ import { NumberInput } from '@astryxdesign/core/NumberInput';
10
+ import { Section } from '@astryxdesign/core/Section';
11
+ import { SegmentedControl, SegmentedControlItem } from '@astryxdesign/core/SegmentedControl';
12
+ import { Selector, SelectorOption, } from '@astryxdesign/core/Selector';
13
+ import { Slider } from '@astryxdesign/core/Slider';
14
+ import { StackItem } from '@astryxdesign/core/Stack';
15
+ import { Switch } from '@astryxdesign/core/Switch';
16
+ import { Text } from '@astryxdesign/core/Text';
17
+ import { TextArea } from '@astryxdesign/core/TextArea';
18
+ import { TextInput } from '@astryxdesign/core/TextInput';
19
+ import { Token } from '@astryxdesign/core/Token';
20
+ import { Tokenizer } from '@astryxdesign/core/Tokenizer';
21
+ import { Tooltip } from '@astryxdesign/core/Tooltip';
22
+ import { VStack } from '@astryxdesign/core/VStack';
23
+ import { IconArrowBackUp, IconCheck, IconCode, IconCopy } from '@tabler/icons-react';
24
+ import { fieldMeta } from '@theoremjs/agents';
25
+ import { useContext } from 'react';
26
+ import { originLabel, originPlace, originShortLabel, STUDIO_PROFILE_TYPES } from "../mod.js";
27
+ import { ISSUE_ROW_ATTRIBUTE, ListBadges, SaidOrigin, useFieldStatus, useRowOrigin, } from "./inspector-context.js";
28
+ import { tabFills } from "./lib/tab-fills.js";
29
+ /**
30
+ * Inspector building blocks: captioned sections of label-and-control rows, after Astryx's
31
+ * canvas editor template. Every control is `sm` and hides its own label, because the row's
32
+ * label column names it; that column is one fixed width, so every control starts on one edge.
33
+ */
34
+ /**
35
+ * The label column, wide enough for the longest label ("Temperature", "Attachments") on one line.
36
+ * The template's is 80, which fits its shorter labels.
37
+ */
38
+ const LABEL_COLUMN = 96;
39
+ /**
40
+ * Whether the field at `path` must be set, and what leaving it out does, from the kernel's catalog.
41
+ * `isRequired` overrides it for a field required only in some cases, saying whether it is now.
42
+ */
43
+ function presence(path, isRequired) {
44
+ const meta = fieldMeta(path);
45
+ const required = isRequired ?? meta?.required === true;
46
+ return { required, unset: required ? undefined : meta?.unset };
47
+ }
48
+ /**
49
+ * Controls the project's files set in code: they show their value and take no edit. A disabled
50
+ * fieldset turns off every control inside it, whatever kind it is.
51
+ */
52
+ export function SetInCode({ children }) {
53
+ return (_jsx("fieldset", { disabled: true, className: "inspector-set-in-code", children: children }));
54
+ }
55
+ /**
56
+ * Under a value the files set in code: one quiet line saying what sets it. Clicking it opens that
57
+ * line in the builder's editor. Hovering shows the whole of it, with the full path to copy when
58
+ * no editor opens.
59
+ */
60
+ export function OriginLine({ origin, onOpen }) {
61
+ const { copy, isCopied } = useClipboard();
62
+ const place = originPlace(origin);
63
+ const label = originLabel(origin);
64
+ const line = (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: IconCode, size: "sm" }), _jsx("span", { className: "inspector-origin-text", children: originShortLabel(origin) })] }));
65
+ return (_jsx(HoverCard, { label: place ? `${label} · ${place}` : label, hasHoverIndication: false, className: "inspector-origin-trigger", content: _jsxs(VStack, { gap: 1, children: [_jsx(Text, { type: "supporting", children: label }), place && (_jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(Text, { type: "code", size: "sm", children: place }), _jsx(IconButton, { label: isCopied ? 'Copied' : 'Copy path', variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: isCopied ? IconCheck : IconCopy, size: "sm" }), onClick: () => {
66
+ copy(place);
67
+ } })] }))] }), children: place ? (_jsx("button", { type: "button", className: "inspector-origin", onClick: onOpen, children: line })) : (_jsx("div", { className: "inspector-origin", children: line })) }));
68
+ }
69
+ /**
70
+ * A captioned group of rows. The panel stays at zero padding and each section carries the gutter.
71
+ * Transparent, so the panel's own surface shows through. The title shows the catalog entry of the
72
+ * field the section edits (`path`) on hover, as a row's label does. Under it, `note`: only what
73
+ * the catalog does not say, such as how the editor or the studio treats the field.
74
+ */
75
+ export function InspectorSection({ title, path, note, children, }) {
76
+ const heading = title && (_jsx(Text, { type: "label", weight: "semibold", children: title }));
77
+ // A section whose own field the files set in code says so once, and its rows take no edit.
78
+ const found = useRowOrigin(path);
79
+ const says = found && !found.said ? found : undefined;
80
+ return (_jsx(Section, { variant: "transparent", padding: 3, children: _jsxs(VStack, { gap: 3, children: [_jsxs(VStack, { gap: 1, hAlign: "start", children: [heading && title && path !== undefined ? (_jsx(CatalogHover, { label: title, path: path, children: heading })) : (heading), note && _jsx(Text, { type: "supporting", children: note })] }), says ? (_jsxs(SaidOrigin, { value: says.origin, children: [_jsx(OriginLine, { origin: says.origin, onOpen: says.open }), _jsx(SetInCode, { children: _jsx(VStack, { gap: 3, children: children }) })] })) : (children)] }) }));
81
+ }
82
+ /**
83
+ * The name of a group of rows inside a section. Astryx's ladder, top down: the page title is 14
84
+ * bold, a section title 14 semibold, this 12 semibold in primary, a row label 12 regular in
85
+ * secondary. `hint` says what the group is, on hover.
86
+ */
87
+ export function InspectorGroupTitle({ title, hint }) {
88
+ const heading = (_jsx(Text, { type: "supporting", weight: "semibold", color: "primary", children: title }));
89
+ return hint ? _jsx(Tooltip, { content: hint, children: heading }) : heading;
90
+ }
91
+ /**
92
+ * `children`, with the schema's entry for `path` on hover: what it does, then its options as
93
+ * tokens (or its type, when it has none), when it's required or what leaving it out does. The
94
+ * profile types that take it are only named when one the studio offers can't.
95
+ */
96
+ function CatalogHover({ label, path, children, }) {
97
+ const meta = fieldMeta(path);
98
+ if (!meta)
99
+ return children;
100
+ const scope = meta.profileTypes;
101
+ // why: Decisions are the odd one out: they take little of the schema, so "not on decisions" is
102
+ // assumed, and only a narrower scope is worth saying.
103
+ const agents = STUDIO_PROFILE_TYPES.filter((type) => type !== 'decision');
104
+ const takes = agents.filter((type) => !scope || scope.includes(type));
105
+ const scoped = takes.length < agents.length ? takes : undefined;
106
+ return (_jsx(HoverCard, { label: label, content: _jsxs(VStack, { gap: 2, maxWidth: 280, children: [_jsx(Text, { children: meta.doc }), _jsx(HStack, { gap: 1, wrap: "wrap", children: (meta.options ?? [meta.type]).map((option) => (_jsx(Token, { label: option, size: "sm" }, option))) }), meta.optionNote && (_jsx(Text, { type: "supporting", color: "secondary", children: meta.optionNote })), typeof meta.required === 'string' && (_jsx(Text, { type: "supporting", color: "secondary", children: `Required ${meta.required}.` })), meta.unset && (_jsx(Text, { type: "supporting", color: "secondary", children: `Left out: ${meta.unset}.` })), scoped && (_jsx(Text, { type: "supporting", color: "secondary", children: `Only on ${scoped.join(', ')} profiles.` }))] }), children: children }));
107
+ }
108
+ /** A row's label, 12 regular in secondary, with "Required" under it when `isRequired`, and its catalog entry on hover. */
109
+ function RowLabel({ label, path, isRequired, }) {
110
+ return (_jsx(CatalogHover, { label: label, path: path, children: _jsxs(VStack, { gap: 0, children: [_jsx(Text, { type: "supporting", color: "secondary", children: label }), isRequired && (_jsx(Text, { type: "supporting", color: "placeholder", children: "Required" }))] }) }));
111
+ }
112
+ /** The height of a row's control, which its label centres on when a note makes the row taller. */
113
+ const CONTROL_HEIGHT = 28;
114
+ /**
115
+ * One row: the label column, then the controls for it. `path` is the field's schema catalog path;
116
+ * `hasIssue` marks the row for the issue pill. With `hasNote`, a note sits under the control, so the
117
+ * label stays beside the control and not halfway down the note.
118
+ */
119
+ export function InspectorRow({ label, path, isRequired = false, hasIssue, hasNote = false, children, }) {
120
+ // A value the files set in code shows, takes no edit, and says where it is set. A row inside a
121
+ // section or a node that already said so only takes no edit.
122
+ const found = useRowOrigin(path);
123
+ const set = found && !found.said ? found : undefined;
124
+ const tall = hasNote || set !== undefined;
125
+ const row = (_jsx(HStack, { gap: 1, vAlign: hasNote ? 'start' : 'center', children: children }));
126
+ const controls = found ? _jsx(SetInCode, { children: row }) : row;
127
+ return (_jsxs(HStack, { gap: 2, vAlign: tall ? 'start' : 'center', [ISSUE_ROW_ATTRIBUTE]: hasIssue || undefined, children: [_jsx(StackItem, { size: "static", children: _jsx(HStack, { width: LABEL_COLUMN, minHeight: tall ? CONTROL_HEIGHT : undefined, vAlign: "center", children: _jsx(RowLabel, { label: label, path: path, isRequired: isRequired }) }) }), _jsx(StackItem, { size: "fill", children: set ? (_jsxs(VStack, { gap: 1, children: [controls, _jsx(OriginLine, { origin: set.origin, onOpen: set.open })] })) : (controls) })] }));
128
+ }
129
+ /**
130
+ * A field row's issue status and presence, and the props its one control shares: labelled but with
131
+ * the label hidden, since the row shows it.
132
+ */
133
+ function useFieldRow({ label, path, field, isRequired }) {
134
+ const status = useFieldStatus()(field);
135
+ const { required, unset } = presence(path, isRequired);
136
+ const control = { label, status, isLabelHidden: true, isRequired: required, size: 'sm' };
137
+ return { status, required, unset, control };
138
+ }
139
+ /** A field row whose one control fills the width beside the label. */
140
+ function FillRow({ label, path, required, status, note, children, }) {
141
+ return (_jsx(InspectorRow, { label: label, path: path, isRequired: required, hasIssue: status !== undefined, hasNote: Boolean((status ?? note)?.message), children: _jsx(StackItem, { size: "fill", children: children }) }));
142
+ }
143
+ /**
144
+ * Free text. Left blank, it shows `placeholder`, a value Tab takes up to edit (an example, or the
145
+ * default); else `hint`, or what leaving it out does.
146
+ */
147
+ export function TextRow(props) {
148
+ const { status: fieldStatus, required, unset, control } = useFieldRow(props);
149
+ const status = props.status ?? fieldStatus;
150
+ return (_jsx(FillRow, { label: props.label, path: props.path, required: required, status: status, children: _jsx(TextInput, { ...control, status: status, value: props.value, placeholder: props.placeholder ?? props.hint ?? unset, onKeyDown: tabFills(props.value, props.placeholder, props.onChange),
151
+ // why: TextInput takes no maxLength, so what is typed or pasted past it is dropped here.
152
+ onChange: (next) => {
153
+ props.onChange(Array.from(next).slice(0, props.maxLength).join(''));
154
+ } }) }));
155
+ }
156
+ /**
157
+ * Longer text, under its label rather than beside it: wording and JSON. Left blank, it shows
158
+ * `placeholder` (for wording, the kernel's own default line) for Tab to take up, else `hint`.
159
+ */
160
+ export function TextAreaRow(props) {
161
+ const { label, path, value, placeholder, hint, rows = 3, hasSpellCheck = true, onChange } = props;
162
+ const { status: fieldStatus, required, unset, control } = useFieldRow(props);
163
+ const status = fieldStatus ?? props.status;
164
+ return (_jsxs(VStack, { gap: 1, [ISSUE_ROW_ATTRIBUTE]: fieldStatus !== undefined || undefined, children: [_jsx(RowLabel, { label: label, path: path, isRequired: required }), _jsx(TextArea, { ...control, status: status, rows: rows, hasSpellCheck: hasSpellCheck, value: value, placeholder: placeholder ?? hint ?? unset, onKeyDown: tabFills(value, placeholder, onChange), onChange: onChange })] }));
165
+ }
166
+ /** A number the kernel leaves unset when cleared: it gives `null`, shown as what leaving it out does. */
167
+ export function NumberRow(props) {
168
+ const { status, required, unset, control } = useFieldRow(props);
169
+ return (_jsx(FillRow, { label: props.label, path: props.path, required: required, status: status, note: props.status, children: _jsx(NumberInput, { ...control, status: status ?? props.status, value: props.value, placeholder: props.hint ?? unset, min: props.min, max: props.max, step: props.step, isIntegerOnly: props.isIntegerOnly, units: props.units, isWheelEnabled: false, hasClear: true, onChange: props.onChange }) }));
170
+ }
171
+ const COMPACT = new Intl.NumberFormat('en-US', { notation: 'compact' });
172
+ /**
173
+ * A number on a slider, shown by `format` (compact by default). One that can be blank sits at
174
+ * `fallback`, where the provider puts it, and reads "Default" until moved; reset puts it back.
175
+ */
176
+ export function SliderRow(props) {
177
+ const { label, path, field, min, max, step, format = (next) => COMPACT.format(next), } = props;
178
+ const status = useFieldStatus()(field);
179
+ const { required } = presence(path);
180
+ return (_jsxs(InspectorRow, { label: label, path: path, isRequired: required, hasIssue: status !== undefined, hasNote: Boolean(status?.message), children: [_jsx(StackItem, { size: "fill", children: _jsx(Slider, { label: label, status: status, isLabelHidden: true, value: props.fallback === undefined ? props.value : (props.value ?? props.fallback), min: min, max: max, step: step, valueDisplay: "text", formatValue: (next) => (props.value === null ? 'Default' : format(next)), onChange: props.onChange }) }), props.fallback !== undefined && (_jsx(IconButton, { label: `Reset ${label.toLowerCase()} to the provider default`, variant: "ghost", size: "sm", isDisabled: props.value === null, icon: _jsx(Icon, { icon: IconArrowBackUp, size: "sm" }), onClick: () => {
181
+ props.onChange(null);
182
+ } }))] }));
183
+ }
184
+ /** On or off. What leaving it out does shows on hover. */
185
+ export function SwitchRow({ label, path, field, value, isDisabled, disabledMessage, onChange, }) {
186
+ const status = useFieldStatus()(field);
187
+ return (_jsx(InspectorRow, { label: label, path: path, hasIssue: status !== undefined, hasNote: Boolean(status?.message), children: _jsx(Switch, { label: label, status: status, isLabelHidden: true, size: "sm", value: value, isDisabled: isDisabled, disabledMessage: disabledMessage, onChange: onChange }) }));
188
+ }
189
+ /**
190
+ * A closed set, as icon segments, or a dropdown of the same options past `selectorPast`. Each
191
+ * option's label is its accessible name, and it shows with the schema's description of that
192
+ * option, on hover as a segment or under it in the list. `warning` says, under it, when the pick is
193
+ * valid but won't do what it looks like; a compile issue on the row shows instead.
194
+ */
195
+ export function SegmentedRow({ label, path, field, value, segments, isDisabled, isRequired, warning, status: given, trailing, selectorPast, onChange, }) {
196
+ const options = fieldMeta(path)?.optionDescriptions;
197
+ const issue = useFieldStatus()(field) ?? given;
198
+ const status = issue ?? (warning ? { type: 'warning', message: warning } : undefined);
199
+ const { required } = presence(path, isRequired);
200
+ const named = (segment) => segment.isRecommended ? `${segment.label} (recommended)` : segment.label;
201
+ const described = (segment) => (segment.isDisabled && segment.disabledMessage) ||
202
+ options?.[segment.value] ||
203
+ segment.description;
204
+ const choose = (next) => {
205
+ const segment = segments.find((candidate) => candidate.value === next);
206
+ if (segment)
207
+ onChange(segment.value);
208
+ };
209
+ return (_jsxs(InspectorRow, { label: label, path: path, isRequired: required, hasIssue: issue !== undefined, hasNote: Boolean(status?.message), children: [_jsxs(StackItem, { size: "fill", children: [selectorPast !== undefined && segments.length > selectorPast ? (_jsx(Selector, { label: label, isLabelHidden: true, isRequired: true, size: "sm", placement: "below", value: value, isDisabled: isDisabled, options: segments.map((segment) => ({
210
+ value: segment.value,
211
+ label: named(segment),
212
+ icon: segment.icon,
213
+ disabled: segment.isDisabled,
214
+ description: described(segment),
215
+ })), onChange: choose })) : (_jsx(SegmentedControl, { label: label, size: "sm", layout: "fill", value: value, isDisabled: isDisabled, onChange: choose, children: segments.map((segment) => {
216
+ const description = described(segment);
217
+ const name = named(segment);
218
+ return (_jsx(Tooltip, { content: description ? `${name}: ${description}` : name, children: _jsx(SegmentedControlItem, { value: segment.value, label: name, isLabelHidden: true, isDisabled: segment.isDisabled, icon: _jsx(Icon, { icon: segment.icon, size: "sm" }) }) }, segment.value));
219
+ }) })), status?.message && (_jsx(FieldStatus, { type: status.type, message: status.message, variant: "detached" }))] }), trailing] }));
220
+ }
221
+ /**
222
+ * A choice from a list, `''` when none is chosen. An optional one can be cleared, and shows what
223
+ * leaving it out does while blank. `hasSearch` filters a long list. A value the list leaves out
224
+ * shows as itself, marked "Not in the list", so a list never hides or rewrites what the file says.
225
+ */
226
+ export function ChoiceRow({ label, path, field, value, options, isDisabled, isRequired, hasSearch, isLoading, emptyText, placeholder, status: given, hasHoverDescriptions, onChange, }) {
227
+ const status = useFieldStatus()(field) ?? given;
228
+ const { required, unset } = presence(path, isRequired);
229
+ const listed = options.some((option) => (typeof option === 'string' ? option : option.value) === value);
230
+ const held = value && !listed
231
+ ? [{ value, label: value, description: 'Not in the list' }, ...options]
232
+ : options;
233
+ // The Selector hands back a plain string; take the option's own value for it.
234
+ const choose = (next) => {
235
+ const chosen = held
236
+ .map((option) => (typeof option === 'string' ? option : option.value))
237
+ .find((candidate) => candidate === next);
238
+ onChange(chosen ?? '');
239
+ };
240
+ const shared = {
241
+ label,
242
+ status,
243
+ isLabelHidden: true,
244
+ size: 'sm',
245
+ options: [...held],
246
+ placement: 'below',
247
+ isDisabled,
248
+ hasSearch,
249
+ isLoading,
250
+ emptyText,
251
+ ...(hasHoverDescriptions ? { renderOption: hoverDescribed } : {}),
252
+ };
253
+ return (_jsx(InspectorRow, { label: label, path: path, isRequired: required, hasIssue: status !== undefined, hasNote: Boolean(status?.message), children: _jsx(StackItem, { size: "fill", children: required ? (_jsx(Selector, { ...shared, isRequired: true, value: value, placeholder: placeholder, onChange: choose })) : (_jsx(Selector, { ...shared, value: value || null, placeholder: placeholder ?? unset, hasClear: true, onChange: choose })) }) }));
254
+ }
255
+ /** An option named on its row, with its description in a tooltip. */
256
+ function hoverDescribed(option) {
257
+ const row = _jsx(SelectorOption, { label: option.label ?? option.value });
258
+ return option.description ? (_jsx(Tooltip, { content: option.description, placement: "end", children: row })) : (row);
259
+ }
260
+ /**
261
+ * Several choices from a list, the first few as badges and the rest counted (`ListBadges`): the
262
+ * trigger is one line tall, and Astryx wraps badges past it. Left empty, it shows what leaving it
263
+ * out does.
264
+ */
265
+ export function ListRow({ label, path, field, value, options, onChange, }) {
266
+ const status = useFieldStatus()(field);
267
+ const { unset } = presence(path);
268
+ const maxBadges = useContext(ListBadges);
269
+ return (_jsx(InspectorRow, { label: label, path: path, hasIssue: status !== undefined, hasNote: Boolean(status?.message), children: _jsx(StackItem, { size: "fill", children: _jsx(MultiSelector, { label: label, status: status, isLabelHidden: true, size: "sm", value: value, options: options, placeholder: unset, hasSearch: true, triggerDisplay: "badges", maxBadges: maxBadges, controlClassName: "inspector-list", onChange: onChange }) }) }));
270
+ }
271
+ /** A names row suggests nothing; every token is one the user typed. */
272
+ const NO_SUGGESTIONS = { search: () => [], bootstrap: () => [] };
273
+ /**
274
+ * Free-form names, typed and committed with Enter, each a token. Duplicates and blanks never make
275
+ * it in. `disabledMessage` says why, when `isDisabled`.
276
+ */
277
+ export function NamesRow({ label, path, field, value, placeholder, isDisabled, disabledMessage, onChange, }) {
278
+ const status = useFieldStatus()(field);
279
+ const { unset } = presence(path);
280
+ return (_jsx(InspectorRow, { label: label, path: path, hasIssue: status !== undefined, hasNote: Boolean(status?.message), children: _jsx(StackItem, { size: "fill", children: _jsx(Tokenizer, { label: label, status: status, isLabelHidden: true, size: "sm", value: value.map((name) => ({ id: name, label: name })), searchSource: NO_SUGGESTIONS, hasCreate: true, debounceMs: 0, placeholder: placeholder ?? unset, isDisabled: isDisabled, disabledMessage: disabledMessage, tokenOverflowBehavior: "unfocusedInline", onChange: (items) => {
281
+ const names = items.map((item) => item.label.trim()).filter(Boolean);
282
+ onChange([...new Set(names)]);
283
+ } }) }) }));
284
+ }
@@ -0,0 +1,25 @@
1
+ import { type StudioActingAs, type StudioPeopleOffer, type StudioPerson } from '../../people.ts';
2
+ import type { ProjectSession } from './studio-project.ts';
3
+ export interface ActingAsState {
4
+ /** What the setup file offers; none when it offers no people. */
5
+ offer: StudioPeopleOffer | undefined;
6
+ /** Why the people the setup file exports cannot be offered. */
7
+ problem: string | undefined;
8
+ /** Who runs act as now; none is no one. */
9
+ actingAs: StudioActingAs | undefined;
10
+ choose: (next: StudioActingAs | undefined) => void;
11
+ }
12
+ /** Set by the studio while a project is open. Without it, every run acts as no one. */
13
+ export declare const ActingAsContext: import("react").Context<ActingAsState>;
14
+ export declare function useActingAs(): ActingAsState;
15
+ /**
16
+ * The pick for a project: the builder's last one in this tab, else the one the setup file starts
17
+ * on, else no one. A pick in a place the setup no longer offers is no one.
18
+ */
19
+ export declare function useActingAsState(project: ProjectSession | null): ActingAsState;
20
+ /** Where an agent's chat is kept for a pick: no one's is the agent's own, each person's beside it. */
21
+ export declare function chatKeyOf(chatWith: string, actingAs: StudioActingAs | undefined): string;
22
+ /** The people already in `place` that the setup file offers. */
23
+ export declare function listPeople(project: ProjectSession, place: string): Promise<StudioPerson[]>;
24
+ /** A new person the setup file makes in `place`. */
25
+ export declare function freshPerson(project: ProjectSession, place: string): Promise<StudioPerson>;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Who the project's runs act as: the builder's pick of a person in a place, from the people the
3
+ * setup file offers. Settings is where it is picked; every run carries it to the project, and each
4
+ * person keeps a chat of their own. The pick is kept in this tab, beside the chats it keys.
5
+ */
6
+ import { createContext, useCallback, useContext, useMemo, useState } from 'react';
7
+ import { actingAsSession, readPerson, readPick, } from "../../people.js";
8
+ import { isRecord, session, WORKSPACE_KEY } from "./studio-session.js";
9
+ const NO_PEOPLE = {
10
+ offer: undefined,
11
+ problem: undefined,
12
+ actingAs: undefined,
13
+ choose: () => undefined,
14
+ };
15
+ /** Set by the studio while a project is open. Without it, every run acts as no one. */
16
+ export const ActingAsContext = createContext(NO_PEOPLE);
17
+ export function useActingAs() {
18
+ return useContext(ActingAsContext);
19
+ }
20
+ const pickKey = (project) => `${WORKSPACE_KEY}.acting-as:${project}`;
21
+ /** The builder's last pick in this tab: `null` for no one, nothing when they never picked. */
22
+ function keptPick(project) {
23
+ try {
24
+ const raw = session()?.getItem(pickKey(project));
25
+ return raw ? { value: JSON.parse(raw) } : undefined;
26
+ }
27
+ catch {
28
+ return undefined;
29
+ }
30
+ }
31
+ function keepPick(project, pick) {
32
+ try {
33
+ session()?.setItem(pickKey(project), JSON.stringify(pick));
34
+ }
35
+ catch {
36
+ // Storage refused: the pick lasts as long as the page.
37
+ }
38
+ }
39
+ /**
40
+ * The pick for a project: the builder's last one in this tab, else the one the setup file starts
41
+ * on, else no one. A pick in a place the setup no longer offers is no one.
42
+ */
43
+ export function useActingAsState(project) {
44
+ const name = project?.name;
45
+ const offer = project?.people;
46
+ const problem = project?.peopleProblem;
47
+ const [chosen, setChosen] = useState(() => (name ? keptPick(name) : undefined));
48
+ const actingAs = useMemo(() => {
49
+ if (!offer)
50
+ return undefined;
51
+ const value = chosen ? chosen.value : offer.start;
52
+ if (value === null || value === undefined)
53
+ return undefined;
54
+ const read = readPick(value, offer.places);
55
+ return read.ok ? read.actingAs : undefined;
56
+ }, [offer, chosen]);
57
+ const choose = useCallback((next) => {
58
+ setChosen({ value: next ?? null });
59
+ if (name)
60
+ keepPick(name, next ?? null);
61
+ }, [name]);
62
+ return useMemo(() => (offer || problem ? { offer, problem, actingAs, choose } : NO_PEOPLE), [offer, problem, actingAs, choose]);
63
+ }
64
+ /** Where an agent's chat is kept for a pick: no one's is the agent's own, each person's beside it. */
65
+ export function chatKeyOf(chatWith, actingAs) {
66
+ return actingAs ? `${chatWith}@${actingAsSession(actingAs)}` : chatWith;
67
+ }
68
+ /** What the studio server answered, or what it said went wrong. */
69
+ async function answered(response) {
70
+ const body = await response.json().catch(() => undefined);
71
+ if (response.ok)
72
+ return body;
73
+ const said = isRecord(body) && typeof body.message === 'string' ? body.message : undefined;
74
+ throw new Error(said ?? `The studio server answered ${String(response.status)}.`);
75
+ }
76
+ /** The people already in `place` that the setup file offers. */
77
+ export async function listPeople(project, place) {
78
+ const body = await answered(await fetch(`${project.endpoint}/people?place=${encodeURIComponent(place)}`));
79
+ const people = isRecord(body) && Array.isArray(body.people) ? body.people : [];
80
+ return people.map((person) => readPerson(person, 'existing'));
81
+ }
82
+ /** A new person the setup file makes in `place`. */
83
+ export async function freshPerson(project, place) {
84
+ const body = await answered(await fetch(`${project.endpoint}/people/fresh`, {
85
+ method: 'POST',
86
+ headers: { 'content-type': 'application/json' },
87
+ body: JSON.stringify({ place }),
88
+ }));
89
+ return readPerson(isRecord(body) ? body.person : undefined, 'fresh');
90
+ }