@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.
- package/LICENSE +21 -0
- package/README.md +295 -2
- package/agreement.d.ts +14 -0
- package/agreement.js +80 -0
- package/asks.d.ts +47 -0
- package/asks.js +54 -0
- package/browser-connection.d.ts +49 -0
- package/browser-connection.js +215 -0
- package/browser-engine.d.ts +11 -0
- package/browser-engine.js +11 -0
- package/browser-execution.d.ts +6 -0
- package/browser-execution.js +18 -0
- package/browser-live.d.ts +4 -0
- package/browser-live.js +132 -0
- package/browser-transport.d.ts +33 -0
- package/browser-transport.js +229 -0
- package/browser.d.ts +4 -0
- package/browser.js +4 -0
- package/canonical.d.ts +10 -0
- package/canonical.js +25 -0
- package/compile-workspace.d.ts +28 -0
- package/compile-workspace.js +295 -0
- package/compile.d.ts +65 -0
- package/compile.js +1605 -0
- package/concierge-demo.d.ts +17 -0
- package/concierge-demo.js +1230 -0
- package/conversation-key.d.ts +5 -0
- package/conversation-key.js +10 -0
- package/decision-example-images.d.ts +30 -0
- package/decision-example-images.js +30 -0
- package/deno.json +3 -0
- package/draft.d.ts +407 -0
- package/draft.js +505 -0
- package/editors.d.ts +29 -0
- package/editors.js +51 -0
- package/example-embedding-files.d.ts +11 -0
- package/example-embedding-files.js +20 -0
- package/example.d.ts +36 -0
- package/example.js +357 -0
- package/guardrail-probe.d.ts +100 -0
- package/guardrail-probe.js +722 -0
- package/held-credentials.d.ts +28 -0
- package/held-credentials.js +87 -0
- package/installed.mjs +40 -0
- package/lent-keys.d.ts +122 -0
- package/lent-keys.js +47 -0
- package/line-diff.d.ts +15 -0
- package/line-diff.js +41 -0
- package/live-connection.d.ts +22 -0
- package/live-connection.js +27 -0
- package/live-session-bridge.d.ts +15 -0
- package/live-session-bridge.js +202 -0
- package/map-line.d.ts +19 -0
- package/map-line.js +42 -0
- package/map.d.ts +154 -0
- package/map.js +525 -0
- package/media-accept.d.ts +19 -0
- package/media-accept.js +65 -0
- package/mod.d.ts +39 -0
- package/mod.js +33 -0
- package/origins.d.ts +52 -0
- package/origins.js +165 -0
- package/package.json +85 -4
- package/page/assets/Banner-BISz3nXA.js +2 -0
- package/page/assets/BottomSheet-BwfBDtje.js +1 -0
- package/page/assets/Card-Lp-0P5eL.js +1 -0
- package/page/assets/CardWall-CBRLdDZW.js +1 -0
- package/page/assets/Center-nHS1JSux.js +1 -0
- package/page/assets/CheckboxInput-Cj5pk-KI.js +2 -0
- package/page/assets/CodeBlock-C7XJ4ioE.js +51 -0
- package/page/assets/CollapsibleGroup-N7_SOjbm.js +2 -0
- package/page/assets/ContextMenu-CBu9H-9H.js +2 -0
- package/page/assets/DateInput-BGrQ5tPC.js +1 -0
- package/page/assets/Dialog-DELWQo-v.js +1 -0
- package/page/assets/EmptyState-C8W4JKBZ.js +1 -0
- package/page/assets/HoverCard-D1Y1ltWQ.js +1 -0
- package/page/assets/Icon-JrysT8aU.js +3 -0
- package/page/assets/IconAlertTriangle-BqAEqqdU.js +1 -0
- package/page/assets/IconButton-DlOGzJIX.js +1 -0
- package/page/assets/IconEye-BB5aY-wQ.js +1 -0
- package/page/assets/IconFileText-6zOFKKrF.js +1 -0
- package/page/assets/IconSearch-BTx66a40.js +1 -0
- package/page/assets/IconShield-DDOh7Gr5.js +1 -0
- package/page/assets/ItemSwipeLayer-Ckn4X6h9.js +1 -0
- package/page/assets/PaneState-BvA2tLQg.js +1 -0
- package/page/assets/PaneState-eUzUkNE8.css +1 -0
- package/page/assets/ScrollableArea-Ckugdj1N.js +1 -0
- package/page/assets/Section-DJ97F7QE.js +1 -0
- package/page/assets/SegmentedControlItem-h-aaXzyS.js +1 -0
- package/page/assets/SidePanel-BL32abk8.js +1 -0
- package/page/assets/StackItem-CQviqAfM.js +1 -0
- package/page/assets/Text-bum6zWWx.js +2 -0
- package/page/assets/TimestampHoverCard-DQIG0RZF.js +1 -0
- package/page/assets/ToolResultCharts-CgshSv9Q.js +1 -0
- package/page/assets/Tooltip-BH9xiRMl.js +1 -0
- package/page/assets/TraceInspector-_yZiz05W.js +1 -0
- package/page/assets/TraceOverview-BPO-HIYK.js +57 -0
- package/page/assets/VStack-CkVMcNiK.js +1 -0
- package/page/assets/_virtual_studio-type-sources-ByxqQaOG.js +12936 -0
- package/page/assets/arrive-DvbqpeRS.js +1 -0
- package/page/assets/browser-engine-CYq9DQAM.js +9 -0
- package/page/assets/browser-transport-D-2jDYe7.js +47 -0
- package/page/assets/codicon-DF1abBS2.ttf +0 -0
- package/page/assets/compile-egress-BSxOdX4K.js +23 -0
- package/page/assets/container.stylex-BmOi-8DQ.js +1 -0
- package/page/assets/createReactComponent-CZwsv6DD.js +1 -0
- package/page/assets/decision-example-images-CZGr7YIT.js +1 -0
- package/page/assets/devWarning-DxuplmRl.js +1 -0
- package/page/assets/editor-DjpsE8to.css +1 -0
- package/page/assets/editor.api-Cd3ViPQa.js +908 -0
- package/page/assets/editor.worker-6GY8RhDc.js +1 -0
- package/page/assets/editor.worker-BmdWdrHZ.js +33 -0
- package/page/assets/editors-BJX_S59A.js +1 -0
- package/page/assets/egress-automata-B5ZGE1mT.js +1 -0
- package/page/assets/embedding-space-view-CfQBPDxD.js +140 -0
- package/page/assets/encode-files-Bc3HJyAh.js +1 -0
- package/page/assets/export-agent-C3yyzXH8.js +43 -0
- package/page/assets/figtree-latin-400-normal-BD4aNku5.woff +0 -0
- package/page/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
- package/page/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
- package/page/assets/figtree-latin-500-normal-B_yy1phn.woff +0 -0
- package/page/assets/figtree-latin-600-normal-BM_oTo4n.woff +0 -0
- package/page/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
- package/page/assets/figtree-latin-700-normal-BCCt2T1q.woff +0 -0
- package/page/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
- package/page/assets/focusOutline.stylex-BT0kfa4t.js +1 -0
- package/page/assets/focusableSelector-DXZeMU85.js +1 -0
- package/page/assets/groupStyles-C7Ter7zC.js +1 -0
- package/page/assets/guardrail-tester-Gut5xK4a.js +9 -0
- package/page/assets/host-patterns-C9RMP16Q.js +1 -0
- package/page/assets/index-CvvmFKgS.js +105 -0
- package/page/assets/index-DOaHlqBo.css +1 -0
- package/page/assets/isRtlElement-BG33-k_H.js +1 -0
- package/page/assets/labels-provider-4TIWDvsE.js +3 -0
- package/page/assets/lent-keys-C32ems-I.js +1 -0
- package/page/assets/live-ingress-lDUGPwth.js +1 -0
- package/page/assets/live-messages-CnkL4GWi.js +1 -0
- package/page/assets/mergeProps-ptS-gIMz.js +1 -0
- package/page/assets/padding.stylex-B76907Zf.js +1 -0
- package/page/assets/preload-helper-DpV6A1kQ.js +1 -0
- package/page/assets/reader-BOCCYaRp.js +7 -0
- package/page/assets/register-CDgivxvX.js +2 -0
- package/page/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/page/assets/schemas-BQ9Jydzb.js +56 -0
- package/page/assets/shaped-data-BcarWqd5.js +16 -0
- package/page/assets/sharedResizeObserver-4U9Xq5Oq.js +1 -0
- package/page/assets/stub-DhdcU_Ew.js +471 -0
- package/page/assets/studio-code-pane-C_SAbcOa.js +8 -0
- package/page/assets/studio-console-DZwlEsvr.js +3 -0
- package/page/assets/studio-decision-B0FnCAXA.js +1 -0
- package/page/assets/studio-embedding-CmA51HVo.js +2 -0
- package/page/assets/studio-host-console-By7hqu2l.js +2 -0
- package/page/assets/studio-live-BrcVQcyV.js +1 -0
- package/page/assets/studio-map-B_xSia-z.js +1 -0
- package/page/assets/studio-map-Bb06Tw1F.css +1 -0
- package/page/assets/studio-monaco-CbKf90i6.css +1 -0
- package/page/assets/studio-monaco-xfyfezQS.js +34 -0
- package/page/assets/studio-ts.worker-B-EXG4Sv.js +67741 -0
- package/page/assets/studio-ts.worker-BXtW3z-O.js +1 -0
- package/page/assets/studio-type-checker-BOvxudki.js +23 -0
- package/page/assets/themeProps-3IqahpCr.js +1 -0
- package/page/assets/tokens.stylex-DkHf0P9C.js +1 -0
- package/page/assets/tool-schema-idaOe2nI.js +18 -0
- package/page/assets/trace-patterns-DnYJa0nI.js +1 -0
- package/page/assets/trace-record-C3zNksA_.js +1 -0
- package/page/assets/trace-schema-9CdEyG6Q.js +1 -0
- package/page/assets/tree-DqyAMsbI.js +3 -0
- package/page/assets/turn-client-Du3Um3Mg.js +2 -0
- package/page/assets/types-BhfXQCLx.js +1 -0
- package/page/assets/typescript-20GgZ8PJ.js +1 -0
- package/page/assets/use-one-call-Hcs8YBp1.js +1 -0
- package/page/assets/useAdaptivePresentation-BzmPCddb.js +1 -0
- package/page/assets/useClipboard-BgGRxRMJ.js +1 -0
- package/page/assets/useContainerReveal-BFy8N_QU.js +1 -0
- package/page/assets/useDevWarning-Z9SoixOP.js +1 -0
- package/page/assets/useLayerDismissal-B_G7IWpC.js +1 -0
- package/page/assets/useMediaQuery-BCT0NUeZ.js +1 -0
- package/page/assets/useScrollLock-Dyf6PHJt.js +1 -0
- package/page/assets/useScrollableArea-0NzdiBCq.js +1 -0
- package/page/assets/useTooltip-CJM_xhLB.js +1 -0
- package/page/assets/workspace-DZALqEDX.js +1 -0
- package/page/assets/zip-DTcEfps6.js +1 -0
- package/page/index.html +90 -0
- package/page.mjs +49 -0
- package/people.d.ts +87 -0
- package/people.js +110 -0
- package/policy.d.ts +43 -0
- package/policy.js +102 -0
- package/ports.d.mts +32 -0
- package/ports.mjs +85 -0
- package/probe-battery.d.ts +13 -0
- package/probe-battery.js +404 -0
- package/providers.d.ts +149 -0
- package/providers.js +306 -0
- package/read-source.d.ts +48 -0
- package/read-source.js +1301 -0
- package/read-steps.d.ts +23 -0
- package/read-steps.js +2 -0
- package/reader.d.ts +11 -0
- package/reader.js +11 -0
- package/registrations.d.ts +83 -0
- package/registrations.js +1 -0
- package/requirements.d.ts +22 -0
- package/requirements.js +38 -0
- package/run-payload-core.d.ts +28 -0
- package/run-payload-core.js +123 -0
- package/run-payload.d.ts +32 -0
- package/run-payload.js +26 -0
- package/runtime-scope.d.ts +84 -0
- package/runtime-scope.js +308 -0
- package/runtime.d.ts +84 -0
- package/runtime.js +387 -0
- package/section-notes.d.ts +33 -0
- package/section-notes.js +38 -0
- package/serve-page.mjs +96 -0
- package/server/draft-decide.d.ts +72 -0
- package/server/draft-decide.js +111 -0
- package/server/draft-embedding.d.ts +3 -0
- package/server/draft-embedding.js +35 -0
- package/server/draft-handler.d.ts +82 -0
- package/server/draft-handler.js +213 -0
- package/server/draft-probe.d.ts +14 -0
- package/server/draft-probe.js +61 -0
- package/server/draft-replies.d.ts +22 -0
- package/server/draft-replies.js +46 -0
- package/server/edited-session.d.ts +28 -0
- package/server/edited-session.js +83 -0
- package/server/edits.d.ts +38 -0
- package/server/edits.js +195 -0
- package/server/handler.d.ts +133 -0
- package/server/handler.js +598 -0
- package/server/lent-draft.d.ts +19 -0
- package/server/lent-draft.js +23 -0
- package/server/live.d.ts +15 -0
- package/server/live.js +96 -0
- package/server/open-editor.d.ts +63 -0
- package/server/open-editor.js +115 -0
- package/server/origins.d.ts +18 -0
- package/server/origins.js +330 -0
- package/server/project-source.d.ts +208 -0
- package/server/project-source.js +1042 -0
- package/server/project.d.ts +22 -0
- package/server/project.js +56 -0
- package/server/run-traces.d.ts +20 -0
- package/server/run-traces.js +96 -0
- package/server/save-new.d.ts +29 -0
- package/server/save-new.js +514 -0
- package/server/save-plan.d.ts +46 -0
- package/server/save-plan.js +1134 -0
- package/server/save-remove.d.ts +21 -0
- package/server/save-remove.js +528 -0
- package/server/save-session.d.ts +96 -0
- package/server/save-session.js +418 -0
- package/server/save-wire.d.ts +235 -0
- package/server/save-wire.js +8 -0
- package/server/save.d.ts +52 -0
- package/server/save.js +209 -0
- package/server/serve.d.ts +23 -0
- package/server/serve.js +413 -0
- package/server/test-connection.d.ts +17 -0
- package/server/test-connection.js +362 -0
- package/server/test-key.d.ts +2 -0
- package/server/test-key.js +83 -0
- package/server/watch.d.ts +28 -0
- package/server/watch.js +93 -0
- package/server/zod-edit.d.ts +74 -0
- package/server/zod-edit.js +558 -0
- package/server.d.ts +8 -0
- package/server.js +8 -0
- package/setups.mjs +170 -0
- package/shared-carry.d.ts +114 -0
- package/shared-carry.js +523 -0
- package/shared-settings.d.ts +34 -0
- package/shared-settings.js +70 -0
- package/source.d.ts +75 -0
- package/source.js +414 -0
- package/start.mjs +169 -0
- package/stream-lines.d.ts +9 -0
- package/stream-lines.js +27 -0
- package/stub.d.ts +6 -0
- package/stub.js +33 -0
- package/surface.d.ts +53 -0
- package/surface.js +631 -0
- package/system-markup.d.ts +20 -0
- package/system-markup.js +51 -0
- package/tool-schema.d.ts +23 -0
- package/tool-schema.js +69 -0
- package/tools.d.ts +16 -0
- package/tools.js +91 -0
- package/traces.d.ts +24 -0
- package/traces.js +29 -0
- package/transport.d.ts +57 -0
- package/transport.js +187 -0
- package/tree.d.ts +32 -0
- package/tree.js +83 -0
- package/types.d.ts +62 -0
- package/types.js +6 -0
- package/ui/acting-as-button.d.ts +2 -0
- package/ui/acting-as-button.js +16 -0
- package/ui/add-provider.d.ts +13 -0
- package/ui/add-provider.js +20 -0
- package/ui/boot-mark.css +53 -0
- package/ui/boot-mark.d.ts +19 -0
- package/ui/boot-mark.js +128 -0
- package/ui/boot-paint.d.ts +8 -0
- package/ui/boot-paint.js +8 -0
- package/ui/brand-icons.d.ts +57 -0
- package/ui/brand-icons.js +148 -0
- package/ui/built/theme.css +830 -0
- package/ui/built/theme.css.d.ts +9 -0
- package/ui/built/theorem-studio.d.ts +13 -0
- package/ui/built/theorem-studio.js +705 -0
- package/ui/built/theorem-studio.variants.d.ts +28 -0
- package/ui/code/monaco-contributions.d.ts +45 -0
- package/ui/code/studio-code.d.ts +7 -0
- package/ui/code/studio-code.js +253 -0
- package/ui/code/studio-monaco.d.ts +44 -0
- package/ui/code/studio-monaco.js +48 -0
- package/ui/code/studio-ts.worker.d.ts +1 -0
- package/ui/code/studio-ts.worker.js +16 -0
- package/ui/code/studio-type-checker.d.ts +12 -0
- package/ui/code/studio-type-checker.js +308 -0
- package/ui/code/studio-type-sources.d.ts +26 -0
- package/ui/confirm-write.d.ts +12 -0
- package/ui/confirm-write.js +45 -0
- package/ui/diff-block.d.ts +21 -0
- package/ui/diff-block.js +17 -0
- package/ui/figtree.css +59 -0
- package/ui/file-place.d.ts +4 -0
- package/ui/file-place.js +26 -0
- package/ui/guardrail-tester.d.ts +18 -0
- package/ui/guardrail-tester.js +248 -0
- package/ui/inspector-context.d.ts +119 -0
- package/ui/inspector-context.js +84 -0
- package/ui/inspector.d.ts +247 -0
- package/ui/inspector.js +284 -0
- package/ui/lib/acting-as.d.ts +25 -0
- package/ui/lib/acting-as.js +90 -0
- package/ui/lib/boot-sequence.d.ts +32 -0
- package/ui/lib/boot-sequence.js +57 -0
- package/ui/lib/export-agent.d.ts +11 -0
- package/ui/lib/export-agent.js +335 -0
- package/ui/lib/facet-icons.d.ts +20 -0
- package/ui/lib/facet-icons.js +21 -0
- package/ui/lib/panel-motion.d.ts +8 -0
- package/ui/lib/panel-motion.js +74 -0
- package/ui/lib/project-address.d.ts +14 -0
- package/ui/lib/project-address.js +24 -0
- package/ui/lib/project-starting.d.ts +13 -0
- package/ui/lib/project-starting.js +30 -0
- package/ui/lib/project-traces.d.ts +17 -0
- package/ui/lib/project-traces.js +54 -0
- package/ui/lib/read-map.d.ts +30 -0
- package/ui/lib/read-map.js +173 -0
- package/ui/lib/read-progress.d.ts +14 -0
- package/ui/lib/read-progress.js +12 -0
- package/ui/lib/refusal-lines.d.ts +3 -0
- package/ui/lib/refusal-lines.js +8 -0
- package/ui/lib/studio-activity.d.ts +5 -0
- package/ui/lib/studio-activity.js +17 -0
- package/ui/lib/studio-console.d.ts +27 -0
- package/ui/lib/studio-console.js +9 -0
- package/ui/lib/studio-conversation.d.ts +20 -0
- package/ui/lib/studio-conversation.js +130 -0
- package/ui/lib/studio-examples.d.ts +31 -0
- package/ui/lib/studio-examples.js +25 -0
- package/ui/lib/studio-labels.d.ts +6 -0
- package/ui/lib/studio-labels.js +13 -0
- package/ui/lib/studio-map-kept.d.ts +17 -0
- package/ui/lib/studio-map-kept.js +48 -0
- package/ui/lib/studio-open.d.ts +22 -0
- package/ui/lib/studio-open.js +54 -0
- package/ui/lib/studio-page.d.ts +33 -0
- package/ui/lib/studio-page.js +121 -0
- package/ui/lib/studio-prefs.d.ts +26 -0
- package/ui/lib/studio-prefs.js +87 -0
- package/ui/lib/studio-project.d.ts +106 -0
- package/ui/lib/studio-project.js +177 -0
- package/ui/lib/studio-restore.d.ts +49 -0
- package/ui/lib/studio-restore.js +251 -0
- package/ui/lib/studio-run-open.d.ts +15 -0
- package/ui/lib/studio-run-open.js +16 -0
- package/ui/lib/studio-session.d.ts +34 -0
- package/ui/lib/studio-session.js +17 -0
- package/ui/lib/studio-settings.d.ts +15 -0
- package/ui/lib/studio-settings.js +48 -0
- package/ui/lib/studio-store.d.ts +64 -0
- package/ui/lib/studio-store.js +391 -0
- package/ui/lib/studio-watch.d.ts +12 -0
- package/ui/lib/studio-watch.js +27 -0
- package/ui/lib/tab-fills.d.ts +6 -0
- package/ui/lib/tab-fills.js +14 -0
- package/ui/lib/tool-credentials.d.ts +3 -0
- package/ui/lib/tool-credentials.js +23 -0
- package/ui/lib/tool-probe.d.ts +19 -0
- package/ui/lib/tool-probe.js +104 -0
- package/ui/lib/type-icons.d.ts +35 -0
- package/ui/lib/type-icons.js +38 -0
- package/ui/lib/when-idle.d.ts +5 -0
- package/ui/lib/when-idle.js +14 -0
- package/ui/lib/zip.d.ts +5 -0
- package/ui/lib/zip.js +8 -0
- package/ui/map-token.css +11 -0
- package/ui/map-token.d.ts +17 -0
- package/ui/map-token.js +29 -0
- package/ui/mcp-icon.d.ts +6 -0
- package/ui/mcp-icon.js +8 -0
- package/ui/motion.css +113 -0
- package/ui/pan.d.ts +32 -0
- package/ui/pan.js +90 -0
- package/ui/profile-editor.d.ts +33 -0
- package/ui/profile-editor.js +2638 -0
- package/ui/provider-editor.d.ts +15 -0
- package/ui/provider-editor.js +92 -0
- package/ui/read-map.css +48 -0
- package/ui/read-map.d.ts +7 -0
- package/ui/read-map.js +163 -0
- package/ui/refusal-detail.d.ts +4 -0
- package/ui/refusal-detail.js +21 -0
- package/ui/shared-change.d.ts +9 -0
- package/ui/shared-change.js +28 -0
- package/ui/shell-motion.css +121 -0
- package/ui/shell-motion.d.ts +73 -0
- package/ui/shell-motion.js +194 -0
- package/ui/studio-code-pane.d.ts +19 -0
- package/ui/studio-code-pane.js +44 -0
- package/ui/studio-compare.d.ts +80 -0
- package/ui/studio-compare.js +326 -0
- package/ui/studio-conflicts.d.ts +17 -0
- package/ui/studio-conflicts.js +87 -0
- package/ui/studio-connection.d.ts +64 -0
- package/ui/studio-connection.js +286 -0
- package/ui/studio-decision.d.ts +6 -0
- package/ui/studio-decision.js +49 -0
- package/ui/studio-embedding.d.ts +6 -0
- package/ui/studio-embedding.js +30 -0
- package/ui/studio-host-console.d.ts +6 -0
- package/ui/studio-host-console.js +17 -0
- package/ui/studio-host.d.ts +73 -0
- package/ui/studio-host.js +12 -0
- package/ui/studio-live.d.ts +17 -0
- package/ui/studio-live.js +26 -0
- package/ui/studio-map.css +273 -0
- package/ui/studio-map.d.ts +17 -0
- package/ui/studio-map.js +397 -0
- package/ui/studio-nav.d.ts +24 -0
- package/ui/studio-nav.js +17 -0
- package/ui/studio-no-project.d.ts +5 -0
- package/ui/studio-no-project.js +9 -0
- package/ui/studio-run.css +76 -0
- package/ui/studio-run.d.ts +14 -0
- package/ui/studio-run.js +119 -0
- package/ui/studio-runner.d.ts +45 -0
- package/ui/studio-runner.js +187 -0
- package/ui/studio-save.d.ts +49 -0
- package/ui/studio-save.js +307 -0
- package/ui/studio-screen.d.ts +61 -0
- package/ui/studio-screen.js +2078 -0
- package/ui/studio-settings.d.ts +31 -0
- package/ui/studio-settings.js +288 -0
- package/ui/studio-shell.css +27 -0
- package/ui/studio-shell.d.ts +43 -0
- package/ui/studio-shell.js +87 -0
- package/ui/studio-theme.d.ts +7 -0
- package/ui/studio-theme.js +94 -0
- package/ui/studio.css +427 -0
- package/ui/theorem-mark.css +84 -0
- package/ui/theorem-mark.d.ts +22 -0
- package/ui/theorem-mark.js +21 -0
- package/vite.d.mts +30 -0
- package/vite.mjs +277 -0
- package/workspace.d.ts +230 -0
- package/workspace.js +1054 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The second load of an open project: the files with the builder's unsaved edits laid over them,
|
|
3
|
+
* so one message can be answered by both. It starts when the page asks for it, is replaced when
|
|
4
|
+
* the edits change, and ends when the files do. It reaches the project's process only through the
|
|
5
|
+
* host it is given, so the rules can be run without one.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { projectDiffers, projectNames, saveSubjects, withoutRemoved } from "./save.js";
|
|
10
|
+
import { message, refusal, stampOf } from "./save-session.js";
|
|
11
|
+
/**
|
|
12
|
+
* The load with each added tool's sample reply as the page holds it. A tool added here has no
|
|
13
|
+
* file to read its sample reply from, and the load answers with it all the same.
|
|
14
|
+
*/
|
|
15
|
+
function withSampleReplies(loaded, tested, added) {
|
|
16
|
+
const fresh = new Set(added.map((tool) => tool.name));
|
|
17
|
+
const held = new Map(tested.toolSpecs.map((tool) => [tool.toolName, tool.stubOutputJson]));
|
|
18
|
+
return {
|
|
19
|
+
...loaded,
|
|
20
|
+
toolSpecs: loaded.toolSpecs.map((tool) => {
|
|
21
|
+
const reply = fresh.has(tool.toolName) ? held.get(tool.toolName) : undefined;
|
|
22
|
+
return reply === undefined ? tool : { ...tool, stubOutputJson: reply };
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function createEditedSession(host) {
|
|
27
|
+
let held;
|
|
28
|
+
const close = async () => {
|
|
29
|
+
const old = held;
|
|
30
|
+
held = undefined;
|
|
31
|
+
if (old)
|
|
32
|
+
await host.stop(old.loaded);
|
|
33
|
+
};
|
|
34
|
+
const start = async (workspace, names) => {
|
|
35
|
+
let subjects;
|
|
36
|
+
try {
|
|
37
|
+
subjects = saveSubjects(workspace, names);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return refusal('issues', [message(error)]);
|
|
41
|
+
}
|
|
42
|
+
if (!subjects.ok)
|
|
43
|
+
return refusal('issues', subjects.issues);
|
|
44
|
+
const edits = { subjects: subjects.subjects, added: subjects.added };
|
|
45
|
+
const stamp = await stampOf(edits);
|
|
46
|
+
if (held?.stamp === stamp)
|
|
47
|
+
return { ok: true, stamp };
|
|
48
|
+
await close();
|
|
49
|
+
let loaded;
|
|
50
|
+
try {
|
|
51
|
+
loaded = await host.load(edits);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return refusal('load', [message(error)]);
|
|
55
|
+
}
|
|
56
|
+
// The same proof Save makes of the files it wrote: this load is what the builder is testing.
|
|
57
|
+
// What the builder removed is still in this load, where nothing the page shows can reach it.
|
|
58
|
+
const opened = withSampleReplies(host.opened(loaded), workspace, subjects.added.tools);
|
|
59
|
+
const differs = projectDiffers(withoutRemoved(opened, subjects.removed), workspace);
|
|
60
|
+
if (differs.length) {
|
|
61
|
+
await host.stop(loaded);
|
|
62
|
+
return refusal('differs', differs);
|
|
63
|
+
}
|
|
64
|
+
held = { loaded, stamp };
|
|
65
|
+
return { ok: true, stamp };
|
|
66
|
+
};
|
|
67
|
+
const open = async (workspace, saved) => {
|
|
68
|
+
const names = projectNames(host.opened(saved));
|
|
69
|
+
return { ...(await start(workspace, names)), saved: [...names.profiles] };
|
|
70
|
+
};
|
|
71
|
+
/** One at a time: a second request waits for the first. */
|
|
72
|
+
let turn = Promise.resolve();
|
|
73
|
+
const inTurn = (work) => {
|
|
74
|
+
const next = turn.then(work, work);
|
|
75
|
+
turn = next.catch(() => { });
|
|
76
|
+
return next;
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
open: (workspace, saved) => inTurn(() => open(workspace, saved)),
|
|
80
|
+
running: () => held?.loaded,
|
|
81
|
+
close: () => inTurn(close),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The builder's unsaved edits, laid over a load of the project: each changed setting set on the
|
|
3
|
+
* profile or tool the project's own code registered, and each new agent and tool registered
|
|
4
|
+
* beside them. Everything the builder did not change stays the project's, handlers and all, so a
|
|
5
|
+
* run of this load differs from a run of the files only by the edits.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { KernelScope } from '@theoremjs/agents';
|
|
10
|
+
import type { ProjectImages, ProjectQuestions } from './handler.ts';
|
|
11
|
+
import type { NewSubjects } from './save-new.ts';
|
|
12
|
+
import type { SaveSubject } from './save-plan.ts';
|
|
13
|
+
/** What the builder changed and added, as Save reads a workspace. */
|
|
14
|
+
export interface ProjectEdits {
|
|
15
|
+
subjects: readonly SaveSubject[];
|
|
16
|
+
added: NewSubjects;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* What each decision is asked in the edited load: the questions the setup names, and for a
|
|
20
|
+
* decision the setup does not name (one the builder added, renamed, or made a decision) the ones
|
|
21
|
+
* on the page.
|
|
22
|
+
*/
|
|
23
|
+
export declare function editedQuestions(edits: ProjectEdits, named?: ProjectQuestions): ProjectQuestions;
|
|
24
|
+
/** The pictures each decision sends in the edited load, as `editedQuestions` reads its questions. */
|
|
25
|
+
export declare function editedImages(edits: ProjectEdits, named?: ProjectImages): ProjectImages;
|
|
26
|
+
/** One setting that differs: where it is, and its value now. No value when it was taken away. */
|
|
27
|
+
export interface Change {
|
|
28
|
+
path: readonly string[];
|
|
29
|
+
value?: unknown;
|
|
30
|
+
}
|
|
31
|
+
/** The settings that differ between two compiled values. A list that differs is one setting. */
|
|
32
|
+
export declare function changedSettings(before: unknown, after: unknown, path?: readonly string[]): Change[];
|
|
33
|
+
/**
|
|
34
|
+
* Registers the edits over the project `scope` holds. A provider goes before the agents whose
|
|
35
|
+
* models name it, tools an agent runs before it, and an agent before the tool that calls it: the
|
|
36
|
+
* order the kernel checks them in.
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerEdits(scope: KernelScope, edits: ProjectEdits): Promise<void>;
|
package/server/edits.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The builder's unsaved edits, laid over a load of the project: each changed setting set on the
|
|
3
|
+
* profile or tool the project's own code registered, and each new agent and tool registered
|
|
4
|
+
* beside them. Everything the builder did not change stays the project's, handlers and all, so a
|
|
5
|
+
* run of this load differs from a run of the files only by the edits.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { canonical } from "../canonical.js";
|
|
10
|
+
import { heldSetting, unheldProblem } from "../held-credentials.js";
|
|
11
|
+
import { registerStudioProvider } from "../providers.js";
|
|
12
|
+
import { defineDraft, withCompiledPatterns } from "../runtime-scope.js";
|
|
13
|
+
import { zodFromJsonSchema } from "../tool-schema.js";
|
|
14
|
+
import { registerCustomTool } from "../tools.js";
|
|
15
|
+
/**
|
|
16
|
+
* What each decision is asked in the edited load: the questions the setup names, and for a
|
|
17
|
+
* decision the setup does not name (one the builder added, renamed, or made a decision) the ones
|
|
18
|
+
* on the page.
|
|
19
|
+
*/
|
|
20
|
+
export function editedQuestions(edits, named = {}) {
|
|
21
|
+
const asked = { ...named };
|
|
22
|
+
for (const agent of edits.added.agents) {
|
|
23
|
+
if (agent.questions && !asked[agent.agentId])
|
|
24
|
+
asked[agent.agentId] = agent.questions;
|
|
25
|
+
}
|
|
26
|
+
return asked;
|
|
27
|
+
}
|
|
28
|
+
/** The pictures each decision sends in the edited load, as `editedQuestions` reads its questions. */
|
|
29
|
+
export function editedImages(edits, named = {}) {
|
|
30
|
+
const sent = { ...named };
|
|
31
|
+
for (const agent of edits.added.agents) {
|
|
32
|
+
if (agent.images && !sent[agent.agentId])
|
|
33
|
+
sent[agent.agentId] = agent.images;
|
|
34
|
+
}
|
|
35
|
+
return sent;
|
|
36
|
+
}
|
|
37
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
38
|
+
/** The settings that differ between two compiled values. A list that differs is one setting. */
|
|
39
|
+
export function changedSettings(before, after, path = []) {
|
|
40
|
+
if (canonical(before) === canonical(after))
|
|
41
|
+
return [];
|
|
42
|
+
if (!isRecord(before) || !isRecord(after))
|
|
43
|
+
return after === undefined ? [{ path }] : [{ path, value: after }];
|
|
44
|
+
return [...new Set([...Object.keys(before), ...Object.keys(after)])].flatMap((key) => changedSettings(before[key], after[key], [...path, key]));
|
|
45
|
+
}
|
|
46
|
+
/** `held` with one setting changed. What the path does not lead through is the same object as before. */
|
|
47
|
+
function withSetting(held, [key, ...rest], change) {
|
|
48
|
+
if (key === undefined)
|
|
49
|
+
return change.value;
|
|
50
|
+
const { [key]: inner, ...others } = isRecord(held) ? held : {};
|
|
51
|
+
if (rest.length === 0 && !('value' in change))
|
|
52
|
+
return others;
|
|
53
|
+
return { ...others, [key]: withSetting(inner, rest, change) };
|
|
54
|
+
}
|
|
55
|
+
const withSettings = (held, changes) => changes.reduce((current, change) => withSetting(current, change.path, change), held);
|
|
56
|
+
/** A settings group the kernel reads as a whole: one changed setting inside it replaces the group. */
|
|
57
|
+
const WHOLE = [['guardrails', 'detect']];
|
|
58
|
+
const leads = (group, path) => group.every((key, at) => path[at] === key);
|
|
59
|
+
const at = (held, path) => path.reduce((inner, key) => (isRecord(inner) ? inner[key] : undefined), held);
|
|
60
|
+
/** The profile's changes, with every change inside a whole group made one change of the group. */
|
|
61
|
+
function profileChanges(before, after) {
|
|
62
|
+
const found = changedSettings(before, after);
|
|
63
|
+
const groups = WHOLE.filter((group) => found.some((change) => leads(group, change.path)));
|
|
64
|
+
return [
|
|
65
|
+
...found.filter((change) => !groups.some((group) => leads(group, change.path))),
|
|
66
|
+
...groups.map((path) => {
|
|
67
|
+
const value = at(after, path);
|
|
68
|
+
return value === undefined ? { path } : { path, value };
|
|
69
|
+
}),
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
/** The settings of a tool that only the studio holds: the kernel's registration has no place for them. */
|
|
73
|
+
const STUDIO_ONLY = new Set(['stubResponse']);
|
|
74
|
+
/** A tool's schema, and the field the kernel holds it in. */
|
|
75
|
+
const SCHEMAS = {
|
|
76
|
+
inputSchema: 'input',
|
|
77
|
+
outputSchema: 'output',
|
|
78
|
+
};
|
|
79
|
+
/** `tool`, refused when it shows a credential nothing holds a value for: a call must not carry a mask. */
|
|
80
|
+
function held(tool) {
|
|
81
|
+
const problem = unheldProblem(tool.name, tool);
|
|
82
|
+
if (problem)
|
|
83
|
+
throw new Error(problem);
|
|
84
|
+
return tool;
|
|
85
|
+
}
|
|
86
|
+
/** The project's tool with the builder's changes: its handler and everything unchanged stay its own. */
|
|
87
|
+
function editedTool(registered, before, after) {
|
|
88
|
+
const edited = { ...registered };
|
|
89
|
+
for (const key of new Set([...Object.keys(before), ...Object.keys(after)])) {
|
|
90
|
+
const [was, is] = [before[key], after[key]];
|
|
91
|
+
if (STUDIO_ONLY.has(key) || canonical(was) === canonical(is))
|
|
92
|
+
continue;
|
|
93
|
+
const schema = SCHEMAS[key];
|
|
94
|
+
if (schema)
|
|
95
|
+
Object.assign(edited, { [schema]: zodFromJsonSchema(is) });
|
|
96
|
+
else if (is === undefined)
|
|
97
|
+
Reflect.deleteProperty(edited, key);
|
|
98
|
+
// A credential the page holds masked is the project's own: the edit beside it keeps it.
|
|
99
|
+
else
|
|
100
|
+
Object.assign(edited, { [key]: heldSetting(key, is, registered[key]) });
|
|
101
|
+
}
|
|
102
|
+
return held(edited);
|
|
103
|
+
}
|
|
104
|
+
function registerNew(scope, tool) {
|
|
105
|
+
registerCustomTool(scope.tools, held(tool));
|
|
106
|
+
}
|
|
107
|
+
function registerTool(scope, tool, subject) {
|
|
108
|
+
const registered = subject ? scope.tools.get(subject.of) : undefined;
|
|
109
|
+
const before = subject?.before;
|
|
110
|
+
// A tool that became another kind keeps nothing of the old one.
|
|
111
|
+
if (!registered || before?.type !== tool.type)
|
|
112
|
+
registerNew(scope, tool);
|
|
113
|
+
else
|
|
114
|
+
scope.tools.register(editedTool(registered, before, tool));
|
|
115
|
+
}
|
|
116
|
+
async function registerAgent(scope, agent, subject) {
|
|
117
|
+
if (agent.structured && agent.profile.type !== 'live')
|
|
118
|
+
scope.schemas.register(agent.structured.id, agent.structured.spec);
|
|
119
|
+
const held = subject ? scope.profiles.find(subject.of) : undefined;
|
|
120
|
+
// An agent that became another type keeps nothing of the old one: the kernel filled the old
|
|
121
|
+
// type's own settings in, and the new type refuses them.
|
|
122
|
+
const registered = held?.type === agent.profile.type ? held : undefined;
|
|
123
|
+
const definition = registered
|
|
124
|
+
? withSettings(registered, profileChanges(subject?.before, subject?.after))
|
|
125
|
+
: agent.profile;
|
|
126
|
+
scope.profiles.register(defineDraft(await withCompiledPatterns(definition)));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A provider with the builder's edits over the one the project registered. What the page was not
|
|
130
|
+
* shown stays as registered: anything it connects with that is not text. Moved to another kernel
|
|
131
|
+
* definition, it is that definition with what the page holds.
|
|
132
|
+
*/
|
|
133
|
+
function registerProvider(scope, subject) {
|
|
134
|
+
const registered = scope.providers.get(subject.of);
|
|
135
|
+
const [before, after] = [subject.before, subject.after];
|
|
136
|
+
if (!registered || after.definition !== before.definition) {
|
|
137
|
+
// On another definition, nothing the project connected with before carries over.
|
|
138
|
+
registerStudioProvider(scope.providers, { ...after, id: subject.of }, undefined, 'replace');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const [shown, edited] = [
|
|
142
|
+
isRecord(before.connection) ? before.connection : {},
|
|
143
|
+
isRecord(after.connection) ? after.connection : {},
|
|
144
|
+
];
|
|
145
|
+
const connection = { ...(isRecord(registered.connection) ? registered.connection : {}) };
|
|
146
|
+
for (const key of new Set([...Object.keys(shown), ...Object.keys(edited)])) {
|
|
147
|
+
if (key in edited)
|
|
148
|
+
connection[key] = edited[key];
|
|
149
|
+
else
|
|
150
|
+
delete connection[key];
|
|
151
|
+
}
|
|
152
|
+
scope.providers.replace(registered.definition, {
|
|
153
|
+
id: subject.of,
|
|
154
|
+
connection,
|
|
155
|
+
...(typeof after.keySlot === 'string' ? { keySlot: after.keySlot } : {}),
|
|
156
|
+
...(typeof after.fallbackKeySlot === 'string'
|
|
157
|
+
? { fallbackKeySlot: after.fallbackKeySlot }
|
|
158
|
+
: {}),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Registers the edits over the project `scope` holds. A provider goes before the agents whose
|
|
163
|
+
* models name it, tools an agent runs before it, and an agent before the tool that calls it: the
|
|
164
|
+
* order the kernel checks them in.
|
|
165
|
+
*/
|
|
166
|
+
export async function registerEdits(scope, edits) {
|
|
167
|
+
for (const provider of edits.added.providers)
|
|
168
|
+
registerStudioProvider(scope.providers, provider);
|
|
169
|
+
for (const held of edits.subjects)
|
|
170
|
+
if (held.kind === 'provider')
|
|
171
|
+
registerProvider(scope, held);
|
|
172
|
+
const subject = (kind, named, name) => edits.subjects.find((held) => held.kind === kind && named(held.after) === name);
|
|
173
|
+
const fresh = new Set(edits.added.tools.map((tool) => tool.name));
|
|
174
|
+
const done = new Set();
|
|
175
|
+
const tool = (held) => {
|
|
176
|
+
if (done.has(held.name))
|
|
177
|
+
return;
|
|
178
|
+
done.add(held.name);
|
|
179
|
+
const changed = subject('tool', (after) => after.name, held.name);
|
|
180
|
+
if (changed || fresh.has(held.name))
|
|
181
|
+
registerTool(scope, held, changed);
|
|
182
|
+
};
|
|
183
|
+
const agents = edits.added.agents;
|
|
184
|
+
for (const agent of agents)
|
|
185
|
+
for (const held of agent.customTools)
|
|
186
|
+
if (held.type !== 'agent')
|
|
187
|
+
tool(held);
|
|
188
|
+
for (const agent of agents) {
|
|
189
|
+
for (const held of agent.customTools)
|
|
190
|
+
tool(held);
|
|
191
|
+
const changed = subject('profile', (after) => after.id, agent.agentId);
|
|
192
|
+
if (changed || edits.added.profiles.includes(agent.agentId))
|
|
193
|
+
await registerAgent(scope, agent, changed);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The studio's local server: a project's registered profiles and tools, as the
|
|
3
|
+
* studio's workspace, and each profile served to run.
|
|
4
|
+
*
|
|
5
|
+
* The page is the studio. It reads its workspace from `GET <base>` and runs
|
|
6
|
+
* the open profile at `<base>/profiles/<id>`, so a run is the project's own
|
|
7
|
+
* code, not the page's draft.
|
|
8
|
+
*
|
|
9
|
+
* It reads and runs. Writing an edit back to the project is the server's
|
|
10
|
+
* (`serve.ts`), which starts this in a process of its own and starts it again
|
|
11
|
+
* after a Save, so a run is always the code on disk.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import { type DecisionAsset, type DecisionQuestion, type Profile, type ProviderHostOptions } from '@theoremjs/agents';
|
|
16
|
+
import { type StudioAsks } from '../asks.ts';
|
|
17
|
+
import { type StudioActingAs, type StudioPeople, type StudioPeopleOffer } from '../people.ts';
|
|
18
|
+
import { type StudioUpgrade } from './live.ts';
|
|
19
|
+
export { STUDIO_BASE } from './draft-handler.ts';
|
|
20
|
+
import { type StudioWorkspace } from '../workspace.ts';
|
|
21
|
+
import type { ProjectOrigins, ProviderPlace, SharedSetting, Unregistered } from './save-wire.ts';
|
|
22
|
+
/** A profile the page could not show or run, and why. */
|
|
23
|
+
export type StudioProblem = {
|
|
24
|
+
profile: string;
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
/** A model that cannot run as the project's files set it, and why. Its agent still opens and runs. */
|
|
28
|
+
export type StudioModelProblem = {
|
|
29
|
+
profile: string;
|
|
30
|
+
model: string;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
33
|
+
/** A profile or provider the studio shows differently from the project, and each setting it differs in, by path. */
|
|
34
|
+
export type StudioDifference = {
|
|
35
|
+
kind: 'profile' | 'provider';
|
|
36
|
+
of: string;
|
|
37
|
+
settings: string[];
|
|
38
|
+
};
|
|
39
|
+
/** What the page opens. */
|
|
40
|
+
export type StudioDescription = {
|
|
41
|
+
project: string;
|
|
42
|
+
/** The project as the studio holds one: an agent per profile, and the tools they share. */
|
|
43
|
+
workspace: StudioWorkspace;
|
|
44
|
+
problems: StudioProblem[];
|
|
45
|
+
/** The models that cannot run as the files set them. None when every one can. */
|
|
46
|
+
modelProblems?: StudioModelProblem[];
|
|
47
|
+
/** Where what the studio shows is not what the project registered. None when they agree. */
|
|
48
|
+
differences?: StudioDifference[];
|
|
49
|
+
/** Why the project does not compile as the studio opened it, when it does not. */
|
|
50
|
+
unheld?: string[];
|
|
51
|
+
/** The settings several profiles share. The studio command reads them from the project's files. */
|
|
52
|
+
shared?: SharedSetting[];
|
|
53
|
+
/** The settings the project's files set in code, which the studio shows and does not change. */
|
|
54
|
+
origins?: ProjectOrigins;
|
|
55
|
+
/** The profiles and tools the files define that the project did not register. */
|
|
56
|
+
unregistered?: Unregistered[];
|
|
57
|
+
/** Where the files define each provider the project registered. */
|
|
58
|
+
providerPlaces?: ProviderPlace[];
|
|
59
|
+
/** The tools that write: the ones the studio makes ask before each run, and the ones it cannot. */
|
|
60
|
+
asks: StudioAsks;
|
|
61
|
+
/** What the project printed when its files stopped loading. The page then shows the last load that did. */
|
|
62
|
+
unloaded?: string;
|
|
63
|
+
/** The editor the studio command opens files in when the page names none, by its command. */
|
|
64
|
+
editor?: string;
|
|
65
|
+
/** The setup file the studio command was started on, from the folder it ran in. */
|
|
66
|
+
setup?: string;
|
|
67
|
+
/** The places and people the setup file offers a run to act as. None: every run acts as no one. */
|
|
68
|
+
people?: StudioPeopleOffer;
|
|
69
|
+
/** Why the people the setup file exports cannot be offered, when they cannot. */
|
|
70
|
+
peopleProblem?: string;
|
|
71
|
+
};
|
|
72
|
+
export type StudioHandlerOptions = {
|
|
73
|
+
/** The project's name, shown at the top of the page. */
|
|
74
|
+
project: string;
|
|
75
|
+
/** The origins whose page may call the server. Any other origin is refused. */
|
|
76
|
+
pageOrigins: readonly string[];
|
|
77
|
+
/** The `host:port` the server listens on. A request that names another host is refused. */
|
|
78
|
+
listenHost: string;
|
|
79
|
+
/**
|
|
80
|
+
* Opaque application context for tool handlers (`ctx.host`): a database client, and the person
|
|
81
|
+
* the builder picked, in the place they picked. `undefined` is no one. A promise is awaited
|
|
82
|
+
* before the run starts.
|
|
83
|
+
*/
|
|
84
|
+
host?: (request: Request, actingAs: StudioActingAs | undefined) => unknown;
|
|
85
|
+
/** The places and people a run may act as. Without them every run acts as no one. */
|
|
86
|
+
people?: StudioPeople;
|
|
87
|
+
/** How the project's registered providers find their keys. Default: as the project registered them. */
|
|
88
|
+
provider?: ProviderHostOptions;
|
|
89
|
+
/** What each decision profile asks, by the profile's id: the questions the application passes when it decides. */
|
|
90
|
+
questions?: ProjectQuestions;
|
|
91
|
+
/** The pictures each decision profile sends, by the profile's id: the images the application passes when it decides. */
|
|
92
|
+
images?: ProjectImages;
|
|
93
|
+
/** How the server takes a socket, which a voice call needs. Without it a live profile is not run. */
|
|
94
|
+
upgrade?: StudioUpgrade;
|
|
95
|
+
/**
|
|
96
|
+
* The key the chats' conversations are sealed with. `serve.ts` makes one per
|
|
97
|
+
* studio run and hands it to every load, so a chat outlives a Save or an edit.
|
|
98
|
+
*/
|
|
99
|
+
conversationKey: string;
|
|
100
|
+
};
|
|
101
|
+
/** A project's decision questions: for each decision profile's id, its questions by their ids. */
|
|
102
|
+
export type ProjectQuestions = Record<string, Record<string, DecisionQuestion>>;
|
|
103
|
+
/** A project's decision pictures: for each decision profile's id, its images by reference. */
|
|
104
|
+
export type ProjectImages = Record<string, Record<string, DecisionAsset>>;
|
|
105
|
+
/**
|
|
106
|
+
* A profile as the studio can print it. What a file writes as code (a validator, a trigger, a
|
|
107
|
+
* trace sink of its own) cannot be shown as a setting, so it is left to the file: the editor
|
|
108
|
+
* says where it is set, Save does not touch it, and a run is still the profile as registered.
|
|
109
|
+
*/
|
|
110
|
+
export declare function printableProfile<P extends Profile>(profile: P): P;
|
|
111
|
+
export declare function json(status: number, body: unknown, headers: HeadersInit): Response;
|
|
112
|
+
/**
|
|
113
|
+
* Whether a request comes from somewhere other than the studio's own page.
|
|
114
|
+
* A page on another site can reach 127.0.0.1 through the builder's browser: the
|
|
115
|
+
* origin check stops its requests, and the host check stops a name it pointed at
|
|
116
|
+
* this machine. A browser's request that names no page at all (an image or a script tag, an
|
|
117
|
+
* address typed in) is refused too: the studio's page always names itself.
|
|
118
|
+
*/
|
|
119
|
+
export declare function isForeign(request: Request, options: Pick<StudioHandlerOptions, 'listenHost' | 'pageOrigins'>): boolean;
|
|
120
|
+
/** The page's own origin, echoed: a request from any other was refused before this. */
|
|
121
|
+
export declare function corsHeaders(request: Request, pageOrigins: readonly string[]): Record<string, string>;
|
|
122
|
+
/** Why a decision profile is not run: the setup file does not name its questions. */
|
|
123
|
+
export declare function noQuestions(profileId: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* Why a decision profile's questions cannot be asked, or nothing. A setup file is not always
|
|
126
|
+
* type-checked, so the studio reads what it exports before it trusts it.
|
|
127
|
+
*/
|
|
128
|
+
export declare function questionsFault(profileId: string, questions: unknown): string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Serves the studio for the tools and profiles registered when it is called.
|
|
131
|
+
* Register the project first.
|
|
132
|
+
*/
|
|
133
|
+
export declare function createStudioHandler(options: StudioHandlerOptions): (request: Request) => Promise<Response>;
|