@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
package/read-steps.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the studio command says while it reads a project, a line at a time, before it answers with
|
|
3
|
+
* the project. Each file is named from the project's folder.
|
|
4
|
+
*/
|
|
5
|
+
export type ReadStep =
|
|
6
|
+
/** A file was read. `from` is the file whose import led to it; the setup file has none. */
|
|
7
|
+
{
|
|
8
|
+
file: string;
|
|
9
|
+
from?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A profile or a tool was found in a file already read. `type` is the type the file writes for it. */
|
|
12
|
+
| {
|
|
13
|
+
found: 'profile' | 'tool';
|
|
14
|
+
name: string;
|
|
15
|
+
file: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
}
|
|
18
|
+
/** The files changed since the last load, so the project is loading again. */
|
|
19
|
+
| {
|
|
20
|
+
again: true;
|
|
21
|
+
};
|
|
22
|
+
/** The address that asks for the steps before the project. */
|
|
23
|
+
export declare const READ_STEPS = "steps";
|
package/read-steps.js
ADDED
package/reader.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClientTurnOptions } from '@theoremjs/agents/host';
|
|
2
|
+
import type { StudioRunsOn } from './lent-keys.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Who reads what the studio runs: the builder, on their own machine and keys. A failure says what
|
|
5
|
+
* actually happened (no key in a slot, a rejected key, an unreachable server) instead of the
|
|
6
|
+
* visitor wording. Every handler the studio serves and every run it makes in the page words its
|
|
7
|
+
* replies with this; a run on lent keys is a visitor's, and words its own with `studioReader`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const STUDIO_READER: ClientTurnOptions;
|
|
10
|
+
/** Who reads a run: a visitor on lent keys, else the builder (`STUDIO_READER`). */
|
|
11
|
+
export declare function studioReader(on: StudioRunsOn): ClientTurnOptions;
|
package/reader.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who reads what the studio runs: the builder, on their own machine and keys. A failure says what
|
|
3
|
+
* actually happened (no key in a slot, a rejected key, an unreachable server) instead of the
|
|
4
|
+
* visitor wording. Every handler the studio serves and every run it makes in the page words its
|
|
5
|
+
* replies with this; a run on lent keys is a visitor's, and words its own with `studioReader`.
|
|
6
|
+
*/
|
|
7
|
+
export const STUDIO_READER = { reader: 'builder' };
|
|
8
|
+
/** Who reads a run: a visitor on lent keys, else the builder (`STUDIO_READER`). */
|
|
9
|
+
export function studioReader(on) {
|
|
10
|
+
return on.mode === 'demo' ? { reader: 'visitor' } : STUDIO_READER;
|
|
11
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { StructuredSpec, ToolAuthConfig, ToolLabels } from '@theoremjs/agents/kernel';
|
|
2
|
+
import type { HttpMethod, ToolAccess, ToolLoadTier, ToolPermission } from '@theoremjs/agents/schema';
|
|
3
|
+
/** The kernel's auth config; the host's OAuth endpoints are never set from the studio. */
|
|
4
|
+
export type StudioToolAuth = Omit<ToolAuthConfig, 'preResolved'>;
|
|
5
|
+
export type StudioToolLabels = Pick<ToolLabels, 'activity' | 'activityPast' | 'activityFailed' | 'request'>;
|
|
6
|
+
export type StructuredRegistration = {
|
|
7
|
+
id: string;
|
|
8
|
+
spec: StructuredSpec;
|
|
9
|
+
};
|
|
10
|
+
export type FunctionToolRegistration = {
|
|
11
|
+
type: 'function';
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
category: string;
|
|
15
|
+
access: ToolAccess;
|
|
16
|
+
permission: ToolPermission;
|
|
17
|
+
loadTier: ToolLoadTier;
|
|
18
|
+
paths: string[];
|
|
19
|
+
inputSchema: Record<string, unknown>;
|
|
20
|
+
outputSchema: Record<string, unknown>;
|
|
21
|
+
labels?: StudioToolLabels;
|
|
22
|
+
/** Overrides the generic stub. */
|
|
23
|
+
stubResponse?: Record<string, unknown>;
|
|
24
|
+
/** The page answers the call: the kernel supplies the handler, and the page sends the output. */
|
|
25
|
+
answeredBy?: 'page';
|
|
26
|
+
};
|
|
27
|
+
export type HttpToolRegistration = {
|
|
28
|
+
type: 'http';
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
category: string;
|
|
32
|
+
access: ToolAccess;
|
|
33
|
+
permission: ToolPermission;
|
|
34
|
+
loadTier: ToolLoadTier;
|
|
35
|
+
paths: string[];
|
|
36
|
+
endpoint: string;
|
|
37
|
+
method: HttpMethod;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
mapping?: {
|
|
40
|
+
pathParams?: string[];
|
|
41
|
+
queryParams?: string[];
|
|
42
|
+
bodyParam?: string;
|
|
43
|
+
};
|
|
44
|
+
auth?: StudioToolAuth;
|
|
45
|
+
inputSchema: Record<string, unknown>;
|
|
46
|
+
outputSchema: Record<string, unknown>;
|
|
47
|
+
labels?: StudioToolLabels;
|
|
48
|
+
};
|
|
49
|
+
export type McpToolRegistration = {
|
|
50
|
+
type: 'mcp';
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
category: string;
|
|
54
|
+
access: ToolAccess;
|
|
55
|
+
permission: ToolPermission;
|
|
56
|
+
loadTier: ToolLoadTier;
|
|
57
|
+
paths: string[];
|
|
58
|
+
serverUrl: string;
|
|
59
|
+
mcpToolName: string;
|
|
60
|
+
headers?: Record<string, string>;
|
|
61
|
+
auth?: StudioToolAuth;
|
|
62
|
+
inputSchema: Record<string, unknown>;
|
|
63
|
+
outputSchema: Record<string, unknown>;
|
|
64
|
+
labels?: StudioToolLabels;
|
|
65
|
+
};
|
|
66
|
+
/** Runs one turn of another registered agent; its schemas are the kernel's fixed ones. */
|
|
67
|
+
export type AgentToolRegistration = {
|
|
68
|
+
type: 'agent';
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
category: string;
|
|
72
|
+
access: ToolAccess;
|
|
73
|
+
permission: ToolPermission;
|
|
74
|
+
loadTier: ToolLoadTier;
|
|
75
|
+
paths: string[];
|
|
76
|
+
/** The agent's profile id, registered before this tool. */
|
|
77
|
+
profile: string;
|
|
78
|
+
maxCallsPerTurn?: number;
|
|
79
|
+
inputSchema: Record<string, unknown>;
|
|
80
|
+
outputSchema: Record<string, unknown>;
|
|
81
|
+
labels?: StudioToolLabels;
|
|
82
|
+
};
|
|
83
|
+
export type ToolRegistration = FunctionToolRegistration | HttpToolRegistration | McpToolRegistration | AgentToolRegistration;
|
package/registrations.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Shared by the compiler and the editor so both agree; mirrors the kernel's `PROFILE_FIELD_PRESENCE`. */
|
|
2
|
+
import type { InputsDraft, ModelBindingDraft, StudioDraft } from './draft.ts';
|
|
3
|
+
export declare function defaultModelRequired(draft: StudioDraft): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a model other than a local one reads no vault slot: not its own, its provider's, or the
|
|
6
|
+
* profile's. The kernel runs it without a key, so a provider that needs one refuses the run.
|
|
7
|
+
*/
|
|
8
|
+
export declare function keySlotUnset(draft: StudioDraft): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The key slots a model of `draft` reads: its own, the profile's, or its provider's. Each says
|
|
11
|
+
* whether it is the provider's, which the profile does not write.
|
|
12
|
+
*/
|
|
13
|
+
export declare function bindingSlots(draft: StudioDraft, binding: ModelBindingDraft): {
|
|
14
|
+
keySlot?: string;
|
|
15
|
+
fallbackKeySlot?: string;
|
|
16
|
+
given: {
|
|
17
|
+
keySlot: boolean;
|
|
18
|
+
fallbackKeySlot: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare function defaultEffortRequired(binding: ModelBindingDraft): boolean;
|
|
22
|
+
export declare function inputLimitsRequired(inputs: InputsDraft): boolean;
|
package/requirements.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Shared by the compiler and the editor so both agree; mirrors the kernel's `PROFILE_FIELD_PRESENCE`. */
|
|
2
|
+
import { modelSlots } from "./providers.js";
|
|
3
|
+
export function defaultModelRequired(draft) {
|
|
4
|
+
return draft.modelBindings.length > 1;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Whether a model other than a local one reads no vault slot: not its own, its provider's, or the
|
|
8
|
+
* profile's. The kernel runs it without a key, so a provider that needs one refuses the run.
|
|
9
|
+
*/
|
|
10
|
+
export function keySlotUnset(draft) {
|
|
11
|
+
return draft.modelBindings.some((binding) => binding.provider !== 'local' && !modelSlots(draft.providers, binding).keySlot);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The key slots a model of `draft` reads: its own, the profile's, or its provider's. Each says
|
|
15
|
+
* whether it is the provider's, which the profile does not write.
|
|
16
|
+
*/
|
|
17
|
+
export function bindingSlots(draft, binding) {
|
|
18
|
+
const written = {
|
|
19
|
+
provider: binding.provider,
|
|
20
|
+
keySlot: binding.keySlot || draft.models.key,
|
|
21
|
+
fallbackKeySlot: binding.fallbackKeySlot || draft.models.fallbackKey,
|
|
22
|
+
};
|
|
23
|
+
const read = modelSlots(draft.providers, written);
|
|
24
|
+
return {
|
|
25
|
+
...read,
|
|
26
|
+
given: {
|
|
27
|
+
keySlot: Boolean(read.keySlot) && !written.keySlot,
|
|
28
|
+
fallbackKeySlot: Boolean(read.fallbackKeySlot) && !written.fallbackKeySlot,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function defaultEffortRequired(binding) {
|
|
33
|
+
const aliases = binding.efforts.map(({ alias }) => alias.trim()).filter(Boolean);
|
|
34
|
+
return new Set(aliases).size > 1;
|
|
35
|
+
}
|
|
36
|
+
export function inputLimitsRequired(inputs) {
|
|
37
|
+
return inputs.attachmentsAccept.length > 0 || inputs.voiceAccept.length > 0;
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** No package imports; typed wrappers live in `run-payload.ts`. */
|
|
2
|
+
export declare const STUDIO_RUN_PAYLOAD_KEY = "theoremjs.studio.run";
|
|
3
|
+
export declare const STUDIO_RUN_PAYLOAD_KEY_PREFIX = "theoremjs.studio.run.";
|
|
4
|
+
/** Ordered index of saved run ids (newest first). */
|
|
5
|
+
export declare const STUDIO_RUN_INDEX_KEY = "theoremjs.studio.run.index";
|
|
6
|
+
export declare const STUDIO_RUN_PAYLOAD_CAP = 8;
|
|
7
|
+
export type StudioRunIndexEntry = {
|
|
8
|
+
id: string;
|
|
9
|
+
savedAt: number;
|
|
10
|
+
};
|
|
11
|
+
export type StudioRunIndex = {
|
|
12
|
+
entries: StudioRunIndexEntry[];
|
|
13
|
+
};
|
|
14
|
+
export declare function studioRunPayloadKey(runId: string): string;
|
|
15
|
+
export declare function createStudioRunId(): string;
|
|
16
|
+
export declare function readStudioRunIdFromUrl(url?: string | {
|
|
17
|
+
href: string;
|
|
18
|
+
}): string | null;
|
|
19
|
+
export declare function upsertStudioRunIndex(entries: readonly StudioRunIndexEntry[], runId: string, savedAt: number, cap?: number): {
|
|
20
|
+
entries: StudioRunIndexEntry[];
|
|
21
|
+
prunedIds: string[];
|
|
22
|
+
};
|
|
23
|
+
/** Prunes the oldest payloads beyond the cap. */
|
|
24
|
+
export declare function saveStudioRunPayloadRecord(payload: Record<string, unknown>, runId: string, storeOverride?: Storage | null): void;
|
|
25
|
+
export declare function loadStudioRunPayloadRecord(runId: string, storeOverride?: Storage | null): Record<string, unknown> | null;
|
|
26
|
+
/** Every kept run's id, indexed or not. */
|
|
27
|
+
export declare function keptStudioRunIds(storeOverride?: Storage | null): string[];
|
|
28
|
+
export declare function clearStudioRunPayloadRecord(runId: string, storeOverride?: Storage | null): void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** No package imports; typed wrappers live in `run-payload.ts`. */
|
|
2
|
+
export const STUDIO_RUN_PAYLOAD_KEY = 'theoremjs.studio.run';
|
|
3
|
+
export const STUDIO_RUN_PAYLOAD_KEY_PREFIX = `${STUDIO_RUN_PAYLOAD_KEY}.`;
|
|
4
|
+
/** Ordered index of saved run ids (newest first). */
|
|
5
|
+
export const STUDIO_RUN_INDEX_KEY = `${STUDIO_RUN_PAYLOAD_KEY}.index`;
|
|
6
|
+
export const STUDIO_RUN_PAYLOAD_CAP = 8;
|
|
7
|
+
export function studioRunPayloadKey(runId) {
|
|
8
|
+
return `${STUDIO_RUN_PAYLOAD_KEY_PREFIX}${runId}`;
|
|
9
|
+
}
|
|
10
|
+
export function createStudioRunId() {
|
|
11
|
+
if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
|
|
12
|
+
return crypto.randomUUID();
|
|
13
|
+
}
|
|
14
|
+
return `run-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
15
|
+
}
|
|
16
|
+
export function readStudioRunIdFromUrl(url = typeof window !== 'undefined'
|
|
17
|
+
? globalThis.location
|
|
18
|
+
: { href: '' }) {
|
|
19
|
+
const href = typeof url === 'string' ? url : url.href;
|
|
20
|
+
if (!href)
|
|
21
|
+
return null;
|
|
22
|
+
try {
|
|
23
|
+
const parsed = new URL(href, 'http://localhost');
|
|
24
|
+
const run = parsed.searchParams.get('run')?.trim();
|
|
25
|
+
return run && run.length > 0 ? run : null;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function upsertStudioRunIndex(entries, runId, savedAt, cap = STUDIO_RUN_PAYLOAD_CAP) {
|
|
32
|
+
const without = entries.filter((entry) => entry.id !== runId);
|
|
33
|
+
const next = [{ id: runId, savedAt }, ...without];
|
|
34
|
+
if (next.length <= cap) {
|
|
35
|
+
return { entries: next, prunedIds: [] };
|
|
36
|
+
}
|
|
37
|
+
const kept = next.slice(0, cap);
|
|
38
|
+
const prunedIds = next.slice(cap).map((entry) => entry.id);
|
|
39
|
+
return { entries: kept, prunedIds };
|
|
40
|
+
}
|
|
41
|
+
function resolveStore(store) {
|
|
42
|
+
if (store !== undefined)
|
|
43
|
+
return store;
|
|
44
|
+
if (typeof globalThis === 'undefined' || !('localStorage' in globalThis))
|
|
45
|
+
return null;
|
|
46
|
+
try {
|
|
47
|
+
// Private-mode / blocked storage can throw on access.
|
|
48
|
+
return globalThis.localStorage;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function readIndex(store) {
|
|
55
|
+
const raw = store.getItem(STUDIO_RUN_INDEX_KEY);
|
|
56
|
+
if (!raw)
|
|
57
|
+
return [];
|
|
58
|
+
try {
|
|
59
|
+
const parsed = JSON.parse(raw);
|
|
60
|
+
return Array.isArray(parsed.entries) ? parsed.entries : [];
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function writeIndex(store, entries) {
|
|
67
|
+
store.setItem(STUDIO_RUN_INDEX_KEY, JSON.stringify({ entries }));
|
|
68
|
+
}
|
|
69
|
+
/** Prunes the oldest payloads beyond the cap. */
|
|
70
|
+
export function saveStudioRunPayloadRecord(payload, runId, storeOverride) {
|
|
71
|
+
const store = resolveStore(storeOverride);
|
|
72
|
+
if (!store || !runId)
|
|
73
|
+
return;
|
|
74
|
+
store.removeItem(STUDIO_RUN_PAYLOAD_KEY);
|
|
75
|
+
const body = {
|
|
76
|
+
version: 1,
|
|
77
|
+
...payload,
|
|
78
|
+
runId,
|
|
79
|
+
};
|
|
80
|
+
store.setItem(studioRunPayloadKey(runId), JSON.stringify(body));
|
|
81
|
+
const { entries, prunedIds } = upsertStudioRunIndex(readIndex(store), runId, Date.now(), STUDIO_RUN_PAYLOAD_CAP);
|
|
82
|
+
for (const id of prunedIds) {
|
|
83
|
+
store.removeItem(studioRunPayloadKey(id));
|
|
84
|
+
}
|
|
85
|
+
writeIndex(store, entries);
|
|
86
|
+
}
|
|
87
|
+
export function loadStudioRunPayloadRecord(runId, storeOverride) {
|
|
88
|
+
const store = resolveStore(storeOverride);
|
|
89
|
+
if (!store || !runId)
|
|
90
|
+
return null;
|
|
91
|
+
const raw = store.getItem(studioRunPayloadKey(runId));
|
|
92
|
+
if (!raw)
|
|
93
|
+
return null;
|
|
94
|
+
try {
|
|
95
|
+
const parsed = JSON.parse(raw);
|
|
96
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
97
|
+
return null;
|
|
98
|
+
return parsed;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Every kept run's id, indexed or not. */
|
|
105
|
+
export function keptStudioRunIds(storeOverride) {
|
|
106
|
+
const store = resolveStore(storeOverride);
|
|
107
|
+
if (!store)
|
|
108
|
+
return [];
|
|
109
|
+
const ids = [];
|
|
110
|
+
for (let i = 0; i < store.length; i++) {
|
|
111
|
+
const key = store.key(i);
|
|
112
|
+
if (key?.startsWith(STUDIO_RUN_PAYLOAD_KEY_PREFIX) && key !== STUDIO_RUN_INDEX_KEY)
|
|
113
|
+
ids.push(key.slice(STUDIO_RUN_PAYLOAD_KEY_PREFIX.length));
|
|
114
|
+
}
|
|
115
|
+
return ids;
|
|
116
|
+
}
|
|
117
|
+
export function clearStudioRunPayloadRecord(runId, storeOverride) {
|
|
118
|
+
const store = resolveStore(storeOverride);
|
|
119
|
+
if (!store || !runId)
|
|
120
|
+
return;
|
|
121
|
+
store.removeItem(studioRunPayloadKey(runId));
|
|
122
|
+
writeIndex(store, readIndex(store).filter((entry) => entry.id !== runId));
|
|
123
|
+
}
|
package/run-payload.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DecisionAsset, DecisionQuestion, ProfileDefinition } from '@theoremjs/agents';
|
|
2
|
+
import type { StudioConnectionMode } from './policy.ts';
|
|
3
|
+
import type { StudioProvider } from './providers.ts';
|
|
4
|
+
import type { StructuredRegistration, ToolRegistration } from './registrations.ts';
|
|
5
|
+
import { createStudioRunId, keptStudioRunIds, readStudioRunIdFromUrl, STUDIO_RUN_INDEX_KEY, STUDIO_RUN_PAYLOAD_CAP, STUDIO_RUN_PAYLOAD_KEY, STUDIO_RUN_PAYLOAD_KEY_PREFIX, type StudioRunIndex, type StudioRunIndexEntry, studioRunPayloadKey, upsertStudioRunIndex } from './run-payload-core.ts';
|
|
6
|
+
import type { StudioDependency } from './runtime-scope.ts';
|
|
7
|
+
export { createStudioRunId, keptStudioRunIds, readStudioRunIdFromUrl, STUDIO_RUN_INDEX_KEY, STUDIO_RUN_PAYLOAD_CAP, STUDIO_RUN_PAYLOAD_KEY, STUDIO_RUN_PAYLOAD_KEY_PREFIX, type StudioRunIndex, type StudioRunIndexEntry, studioRunPayloadKey, upsertStudioRunIndex, };
|
|
8
|
+
export type StudioRunPayload = {
|
|
9
|
+
/** Payload schema version — bump when handoff shape changes. */
|
|
10
|
+
version?: 1;
|
|
11
|
+
/** Execution choice only. Credentials never belong in this persisted payload. */
|
|
12
|
+
connectionMode?: StudioConnectionMode;
|
|
13
|
+
/** Non-secret localhost connection setting; no bearer key travels with it. */
|
|
14
|
+
localBaseUrl?: string;
|
|
15
|
+
runId?: string;
|
|
16
|
+
agentId: string;
|
|
17
|
+
profile: ProfileDefinition;
|
|
18
|
+
customTools: ToolRegistration[];
|
|
19
|
+
structured?: StructuredRegistration;
|
|
20
|
+
/** A decision profile's questions, by id. */
|
|
21
|
+
questions?: Record<string, DecisionQuestion>;
|
|
22
|
+
/** The pictures every decision sends, by the reference its questions write. */
|
|
23
|
+
images?: Record<string, DecisionAsset>;
|
|
24
|
+
/** The providers its models name, each with its adapter. Left out, they are the studio's own. */
|
|
25
|
+
providers?: readonly StudioProvider[];
|
|
26
|
+
/** The agents this one names, each after the agents it names; registered before it. */
|
|
27
|
+
dependencies?: StudioDependency[];
|
|
28
|
+
};
|
|
29
|
+
/** `localStorage`, not `sessionStorage`: session storage is per-tab, so a `window.open` handoff would lose it. */
|
|
30
|
+
export declare function saveStudioRunPayload(payload: StudioRunPayload, runId: string, storeOverride?: Storage | null): void;
|
|
31
|
+
export declare function loadStudioRunPayload(runId: string, storeOverride?: Storage | null): StudioRunPayload | null;
|
|
32
|
+
export declare function clearStudioRunPayload(runId: string, storeOverride?: Storage | null): void;
|
package/run-payload.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { clearStudioRunPayloadRecord, createStudioRunId, keptStudioRunIds, loadStudioRunPayloadRecord, readStudioRunIdFromUrl, STUDIO_RUN_INDEX_KEY, STUDIO_RUN_PAYLOAD_CAP, STUDIO_RUN_PAYLOAD_KEY, STUDIO_RUN_PAYLOAD_KEY_PREFIX, saveStudioRunPayloadRecord, studioRunPayloadKey, upsertStudioRunIndex, } from "./run-payload-core.js";
|
|
3
|
+
export { createStudioRunId, keptStudioRunIds, readStudioRunIdFromUrl, STUDIO_RUN_INDEX_KEY, STUDIO_RUN_PAYLOAD_CAP, STUDIO_RUN_PAYLOAD_KEY, STUDIO_RUN_PAYLOAD_KEY_PREFIX, studioRunPayloadKey, upsertStudioRunIndex, };
|
|
4
|
+
const kept = z.looseObject({
|
|
5
|
+
profile: z.looseObject({ id: z.string() }),
|
|
6
|
+
customTools: z.array(z.looseObject({ name: z.string() })),
|
|
7
|
+
});
|
|
8
|
+
/** The outline of a run kept in this browser, which an older or other package may have written. */
|
|
9
|
+
const keptRun = kept.extend({
|
|
10
|
+
agentId: z.string(),
|
|
11
|
+
dependencies: z.array(kept).optional(),
|
|
12
|
+
});
|
|
13
|
+
/** `localStorage`, not `sessionStorage`: session storage is per-tab, so a `window.open` handoff would lose it. */
|
|
14
|
+
export function saveStudioRunPayload(payload, runId, storeOverride) {
|
|
15
|
+
saveStudioRunPayloadRecord({ ...payload }, runId, storeOverride);
|
|
16
|
+
}
|
|
17
|
+
export function loadStudioRunPayload(runId, storeOverride) {
|
|
18
|
+
const raw = loadStudioRunPayloadRecord(runId, storeOverride);
|
|
19
|
+
// Only the outline is checked here; `defineProfile` checks the profiles when the run opens.
|
|
20
|
+
if (!raw || !keptRun.safeParse(raw).success)
|
|
21
|
+
return null;
|
|
22
|
+
return raw;
|
|
23
|
+
}
|
|
24
|
+
export function clearStudioRunPayload(runId, storeOverride) {
|
|
25
|
+
clearStudioRunPayloadRecord(runId, storeOverride);
|
|
26
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Studio drafts, each run on a kernel scope of its own. Two visitors can
|
|
3
|
+
* name the same profile, tool, or schema without either one seeing the other's.
|
|
4
|
+
*/
|
|
5
|
+
import { defineProfile, type KernelScope, type Profile, type ProfileDefinition, type Provider, type ResolveHost, type ToolExecutionCoordinator } from '@theoremjs/agents';
|
|
6
|
+
import { type DetectSpec } from '@theoremjs/agents/guardrails';
|
|
7
|
+
import type { AgentCall, AgentCallHook, ProviderHostOptions, TurnModel } from '@theoremjs/agents/kernel';
|
|
8
|
+
export interface StudioProviderOptions extends ProviderHostOptions {
|
|
9
|
+
local?: {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
fetch?: typeof fetch;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
import { type StudioRunsOn } from './lent-keys.ts';
|
|
15
|
+
import type { StructuredRegistration, ToolRegistration } from './registrations.ts';
|
|
16
|
+
import { type StudioToolHandlers } from './tools.ts';
|
|
17
|
+
/** What a run holds besides what it runs on. */
|
|
18
|
+
export interface StudioRuntimeBase {
|
|
19
|
+
/** A project's own provider definitions, registered after the studio's. */
|
|
20
|
+
providerDefinitions?: readonly Provider[];
|
|
21
|
+
execution?: ToolExecutionCoordinator;
|
|
22
|
+
pageExecution?: import('@theoremjs/agents').PageToolExecution;
|
|
23
|
+
providers?: StudioProviderOptions;
|
|
24
|
+
hostOptions?: (profile: Profile, model?: string) => ProviderHostOptions;
|
|
25
|
+
/** Answers every model call with a scripted model, in place of the profile's provider. */
|
|
26
|
+
provider?: (profile: Profile, model?: string) => TurnModel;
|
|
27
|
+
resolveHost?: ResolveHost;
|
|
28
|
+
remoteTools?: boolean;
|
|
29
|
+
/** Handlers the host runs for function tools, by name. A tool with none answers with its stub. */
|
|
30
|
+
toolHandlers?: StudioToolHandlers;
|
|
31
|
+
/** Before each agent tool call runs its agent: return `refuse` to stop it. */
|
|
32
|
+
onAgentCall?: (call: AgentCall) => {
|
|
33
|
+
refuse: string;
|
|
34
|
+
} | undefined | Promise<{
|
|
35
|
+
refuse: string;
|
|
36
|
+
} | undefined>;
|
|
37
|
+
}
|
|
38
|
+
/** A run, and what it runs on: a run on lent keys carries the keys it is held to. */
|
|
39
|
+
export type StudioRuntime = StudioRuntimeBase & StudioRunsOn;
|
|
40
|
+
/**
|
|
41
|
+
* The host options a profile's turn runs with. A runtime with a scripted model registers it as a
|
|
42
|
+
* provider of its own and binds the profile's model to it.
|
|
43
|
+
*/
|
|
44
|
+
export declare function runtimeProvider(runtime: StudioRuntime, scope: KernelScope, profile: Profile, model?: string): ProviderHostOptions;
|
|
45
|
+
/**
|
|
46
|
+
* Each called agent runs on a provider of its own, so it reads its own key
|
|
47
|
+
* slots and may use another provider than its caller. The runtime may refuse
|
|
48
|
+
* the call first.
|
|
49
|
+
*/
|
|
50
|
+
export declare function agentCallHook(scope: KernelScope, runtime: StudioRuntime): AgentCallHook;
|
|
51
|
+
/**
|
|
52
|
+
* `def` with the table compiled for each detector's patterns, here where the draft runs: a table
|
|
53
|
+
* a browser sent is never trusted, since compiling is what refuses a pattern that could hang on
|
|
54
|
+
* hostile text. The compiler loads only for a draft that has patterns.
|
|
55
|
+
*/
|
|
56
|
+
export declare function withCompiledPatterns<D extends ProfileDefinition>(def: D): Promise<D>;
|
|
57
|
+
/** `def` with its patterns compiled by `compile`, for a caller that already holds the compiler. */
|
|
58
|
+
export declare function withPatterns<D extends ProfileDefinition>(def: D, compile: (detect: DetectSpec) => DetectSpec): D;
|
|
59
|
+
/** `defineProfile` for a draft a request carries. */
|
|
60
|
+
export declare const defineDraft: typeof defineProfile;
|
|
61
|
+
/** An agent the run's agent names, registered before it: one its agent tools run, or its summariser. */
|
|
62
|
+
export interface StudioDependency {
|
|
63
|
+
profile: ProfileDefinition;
|
|
64
|
+
customTools: readonly ToolRegistration[];
|
|
65
|
+
structured?: StructuredRegistration;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A new scope holding one request's draft, and the profile to run on it. Never cache or share it:
|
|
69
|
+
* the scope also holds MCP sessions, and a shared one would hand a keyless server's session to
|
|
70
|
+
* every visitor and keep it past the request. `dependencies` are registered first, in order.
|
|
71
|
+
*/
|
|
72
|
+
export declare function studioScope(profile: ProfileDefinition, customTools: readonly ToolRegistration[], structured: StructuredRegistration | undefined, runtime: StudioRuntime, dependencies?: readonly StudioDependency[]): Promise<{
|
|
73
|
+
scope: KernelScope;
|
|
74
|
+
profile: Profile;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* A new scope holding drafts as written, the last one returned: no runtime
|
|
78
|
+
* rewrites their guardrails or checks their model bindings. For a run that
|
|
79
|
+
* calls no model and reaches no host. Never cache or share it.
|
|
80
|
+
*/
|
|
81
|
+
export declare function writtenScope(drafts: readonly StudioDependency[]): Promise<{
|
|
82
|
+
scope: KernelScope;
|
|
83
|
+
profile: Profile | undefined;
|
|
84
|
+
}>;
|