@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ORCHID AI LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,296 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @theoremjs/studio
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@theoremjs/studio)
|
|
4
|
+
[](https://github.com/masudl-hub/theoremai/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/masudl-hub/theoremai/blob/main/LICENSE)
|
|
6
|
+
[](https://deepwiki.com/masudl-hub/theoremai)
|
|
7
|
+
|
|
8
|
+
Edit, run, and test Theorem agents in a studio: on your own project with one command, or as a screen in your own app.
|
|
9
|
+
|
|
10
|
+
## The idea
|
|
11
|
+
|
|
12
|
+
The **studio** is a screen for one agent **profile** (see [`@theoremjs/agents`](https://www.npmjs.com/package/@theoremjs/agents)) at a time. You edit the profile as a form or as code, run it in a chat beside the editor, and probe its guardrails.
|
|
13
|
+
|
|
14
|
+
The screen keeps the profile it edits in the browser, as a **draft**. It sends the draft with every request to a server under `/api/studio`. You choose which server answers:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
┌──────────────────────────────┐
|
|
18
|
+
│ BROWSER │
|
|
19
|
+
│ <StudioScreen /> │
|
|
20
|
+
│ edits the draft · runs it │
|
|
21
|
+
└──────────────┬───────────────┘
|
|
22
|
+
│ POST /api/studio/*
|
|
23
|
+
│ (the draft rides along)
|
|
24
|
+
┌─────────────────┴──────────────────┐
|
|
25
|
+
▼ ▼
|
|
26
|
+
┌────────────────────────────────┐ ┌────────────────────────────────┐
|
|
27
|
+
│ THE COMMAND │ │ YOUR APP │
|
|
28
|
+
│ npx theorem-studio │ │ createStudioDraftHandler() │
|
|
29
|
+
│ │ │ │
|
|
30
|
+
│ your project, on this machine │ │ any visitor, on your server │
|
|
31
|
+
│ saves edits to your files │ │ saves nothing │
|
|
32
|
+
└────────────────────────────────┘ └────────────────────────────────┘
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- **The command** opens your project's agents. It runs them with your project's tools and keys, and writes your edits back to your files.
|
|
36
|
+
- **The screen in your app** shows the same studio to your users. Your server answers with one handler. It runs drafts only on keys you choose to lend.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install -D @theoremjs/studio @theoremjs/agents @theoremjs/react
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The command needs [Deno](https://deno.com). The installed `@theoremjs/studio`, `@theoremjs/agents`, and `@theoremjs/react` versions must match exactly.
|
|
45
|
+
|
|
46
|
+
To show the screen in your app, also install the peers at the versions this package lists in `peerDependencies`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install react react-dom zod @astryxdesign/core@0.7.0 @astryxdesign/theme-neutral@0.7.0 @stylexjs/stylex@0.19.0
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Open your project
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx theorem-studio
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The command starts two servers that only this machine reaches: your project's server, under Deno, and the studio's page. It opens the project's **setup file**: `studio.setup.ts` or `<name>.studio.setup.ts`. When the project has several, it asks which one.
|
|
59
|
+
|
|
60
|
+
Add `"studio": "theorem-studio"` to your scripts to run it as `npm run studio`.
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
theorem-studio [setup] [--editor <command>] [--deno-config <file>] [--no-watch]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| Option | What it does |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `setup` | The setup file to open, by its file or its name. |
|
|
69
|
+
| `--editor <command>` | The editor the studio opens a line of your files in. Default: `$VISUAL` or `$EDITOR` when it opens a window, else `code`. |
|
|
70
|
+
| `--deno-config <file>` | The Deno config your project loads with. Default: the `deno.json` or `deno.jsonc` in the folder you ran the command in, else the studio's. |
|
|
71
|
+
| `--no-watch` | Do not watch the files the setup reads. The studio reads them again when you come back to it. |
|
|
72
|
+
|
|
73
|
+
### What a setup file exports
|
|
74
|
+
|
|
75
|
+
Every export is optional. The studio reads only these:
|
|
76
|
+
|
|
77
|
+
| Export | What the studio does with it |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `default()` | Calls it once as it loads the project, before anything runs: register the project's profiles and tools here. It may be `async`. |
|
|
80
|
+
| `provider` | The keys, network, and limits every model call runs on (`ProviderHostOptions` from `@theoremjs/agents/kernel`). Without it, a run's model call fails for want of a key. |
|
|
81
|
+
| `people`, `host` | Who a run's tools act for (below). |
|
|
82
|
+
| `questions` | What each decision profile asks, by the profile's id: `{ [profileId]: { [questionId]: DecisionQuestion } }`. |
|
|
83
|
+
| `images` | The pictures each decision profile sends with every decision, by the profile's id: `{ [profileId]: { [reference]: DecisionAsset } }`, where a reference is the name its questions write, such as `'<ghs02>'`. |
|
|
84
|
+
|
|
85
|
+
### Keys a run uses
|
|
86
|
+
|
|
87
|
+
A profile's model names a key slot. `provider.vault` holds a key for each slot, so a studio run signs with the key the same profile uses in your app. Load the keys however your start script does, and read them when the setup file loads; the studio never writes them down:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
export const provider = {
|
|
91
|
+
vault: { openai: Deno.env.get('OPENAI_API_KEY') ?? '' },
|
|
92
|
+
};
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For a key that comes from a secret store, a slot can hold a function instead. The studio calls it with the provider and slot when a call needs the key. A slot left out or empty fails that run with the slot's name, not a guess at another key.
|
|
96
|
+
|
|
97
|
+
### Who a run acts as
|
|
98
|
+
|
|
99
|
+
A setup file can export `people` and `host` to let the builder pick who the project's tools act for:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import type { StudioActingAs, StudioPeople } from '@theoremjs/studio/people';
|
|
103
|
+
|
|
104
|
+
export const people: StudioPeople = {
|
|
105
|
+
places: [{ id: 'stage', label: 'Stage' }],
|
|
106
|
+
existing: (place) => [{ id: 'user-1', label: 'Test keeper' }], // optional
|
|
107
|
+
fresh: (place) => makeTestUser(place), // optional; removing it later is yours
|
|
108
|
+
start: undefined, // optional pick the studio opens on; without it, no one
|
|
109
|
+
};
|
|
110
|
+
export function host(request: Request, actingAs: StudioActingAs | undefined): unknown {
|
|
111
|
+
return actingAs ? buildContextFor(actingAs.person.id) : undefined;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The builder picks a place and a person in Settings, under People. Each run carries the pick, and `host` builds the tools' context from it. `host` may be `async`; the run waits for it. Each person keeps their own chat and session. Without `people`, every run acts as no one.
|
|
116
|
+
|
|
117
|
+
## Show the studio in your app
|
|
118
|
+
|
|
119
|
+
Use this when your users should edit and run agents on your site: a playground, or an internal tool. You need a Vite build, the screen, and one server route.
|
|
120
|
+
|
|
121
|
+
### 1. Add the Vite plugin
|
|
122
|
+
|
|
123
|
+
`studioVite` resolves the screen's packages to your install, so your page has one copy of React and Astryx. It also serves the code editor's icons and the type declarations it checks a profile's code against.
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
// vite.config.ts
|
|
127
|
+
import { studioVite } from '@theoremjs/studio/vite';
|
|
128
|
+
import react from '@vitejs/plugin-react';
|
|
129
|
+
import { defineConfig } from 'vite';
|
|
130
|
+
|
|
131
|
+
export default defineConfig({
|
|
132
|
+
plugins: [react(), studioVite({ hostRoot: import.meta.dirname })],
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`hostRoot` is the folder of the app that shows the screen.
|
|
137
|
+
|
|
138
|
+
### 2. Show the screen
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import { LayerProvider } from '@astryxdesign/core/Layer';
|
|
142
|
+
import { Theme } from '@astryxdesign/core/theme';
|
|
143
|
+
import { theoremStudioTheme } from '@theoremjs/studio/ui/built/theorem-studio.ts';
|
|
144
|
+
import { openStudio } from '@theoremjs/studio/ui/lib/studio-open.ts';
|
|
145
|
+
import { StudioScreen } from '@theoremjs/studio/ui/studio-screen.tsx';
|
|
146
|
+
import '@theoremjs/studio/ui/figtree.css';
|
|
147
|
+
import '@astryxdesign/core/reset.css';
|
|
148
|
+
import '@astryxdesign/core/astryx.css';
|
|
149
|
+
import '@theoremjs/studio/ui/built/theme.css';
|
|
150
|
+
import '@theoremjs/studio/ui/motion.css';
|
|
151
|
+
|
|
152
|
+
export function Studio() {
|
|
153
|
+
return (
|
|
154
|
+
<Theme theme={theoremStudioTheme} mode="dark">
|
|
155
|
+
<LayerProvider>
|
|
156
|
+
<StudioScreen opened={openStudio()} host={{ kernelVersion: '0.3.1' }} />
|
|
157
|
+
</LayerProvider>
|
|
158
|
+
</Theme>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Render it in the browser only. `openStudio()` reads the tab's kept workspace, so it does not run on a server.
|
|
164
|
+
|
|
165
|
+
`host` tells the screen about your page:
|
|
166
|
+
|
|
167
|
+
| Field | What it does |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `kernelVersion` | The `@theoremjs/agents` version, shown under the studio's title. Required. |
|
|
170
|
+
| `lentKeys` | Keys your page lends to whoever opens the studio. See [Lend your keys](#lend-your-keys). |
|
|
171
|
+
| `toolHandlers` | Handlers for your page's own function tools, by name. A tool with none answers with its sample reply or a stub. |
|
|
172
|
+
| `hasSettings` | True when your page has a door to Settings. Keys then show in Settings, not in the editor's header. |
|
|
173
|
+
| `mountSurface` | Mounts the screen's surface while the screen is open, and returns the unmount. |
|
|
174
|
+
| `onReport` | Called as what is on screen changes, and with `null` when the screen closes. |
|
|
175
|
+
|
|
176
|
+
### 3. Answer at `/api/studio`
|
|
177
|
+
|
|
178
|
+
The screen sends every request under `/api/studio`. Mount one handler there:
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
import { createStudioDraftHandler, STUDIO_BASE } from '@theoremjs/studio/server';
|
|
182
|
+
|
|
183
|
+
const studio = createStudioDraftHandler();
|
|
184
|
+
|
|
185
|
+
export default {
|
|
186
|
+
fetch(request: Request): Promise<Response> | Response {
|
|
187
|
+
if (new URL(request.url).pathname.startsWith(`${STUDIO_BASE}/`)) return studio(request);
|
|
188
|
+
return new Response('Not found', { status: 404 });
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The handler takes a Web `Request` and returns a `Response`. It serves no project: each request carries its draft.
|
|
194
|
+
|
|
195
|
+
Without lent keys, the handler answers three requests:
|
|
196
|
+
|
|
197
|
+
- the guardrail probe, on a scripted model, so no model is called;
|
|
198
|
+
- the key test, for a key the builder types;
|
|
199
|
+
- the tool connection test, which reaches public hosts only.
|
|
200
|
+
|
|
201
|
+
Drafts then run in the browser, on the builder's own keys.
|
|
202
|
+
|
|
203
|
+
To call `onProbePassed` after the reply on a Worker, pass `ctx.waitUntil` as the second argument: `studio(request, (work) => ctx.waitUntil(work))`.
|
|
204
|
+
|
|
205
|
+
## Lend your keys
|
|
206
|
+
|
|
207
|
+
Use this when visitors without a key should still run drafts: a public playground on your free-tier keys. The drafts then run on your server, so you decide what they may use.
|
|
208
|
+
|
|
209
|
+
You describe the keys once, as a `LentKeys`. It says which models the keys run and which built-in tools each model may use. It also says how large a decision may be, including how many images it may carry (`decision.images`) and how heavy each may be (`decision.imageBytes`). A decision's own pictures and the ones dropped into its state count together, and what runs on the keys keep to. Give the same `LentKeys` to the screen and to the handler:
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
import type { LentKeys } from '@theoremjs/studio';
|
|
213
|
+
import { createStudioDraftHandler } from '@theoremjs/studio/server';
|
|
214
|
+
|
|
215
|
+
declare const keys: LentKeys;
|
|
216
|
+
declare const env: { GEMINI_KEY: string };
|
|
217
|
+
|
|
218
|
+
const studio = createStudioDraftHandler({
|
|
219
|
+
lent: {
|
|
220
|
+
mode: 'demo',
|
|
221
|
+
keys,
|
|
222
|
+
// Fill each key slot the draft's models name.
|
|
223
|
+
hostOptions: (profile) => ({
|
|
224
|
+
vault: Object.fromEntries(
|
|
225
|
+
'models' in profile
|
|
226
|
+
? Object.values(profile.models).flatMap((model) => (model.keySlot ? [[model.keySlot, env.GEMINI_KEY]] : []))
|
|
227
|
+
: [],
|
|
228
|
+
),
|
|
229
|
+
}),
|
|
230
|
+
},
|
|
231
|
+
spend: (kind, request) => {
|
|
232
|
+
// Count `kind` for whoever sent `request`. Throw a TheoremError to refuse it.
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
<StudioScreen opened={openStudio()} host={{ kernelVersion: '0.3.1', lentKeys: keys }} />
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
`hostOptions` gets each draft's profile. The draft names its own key slots, so fill the slots its models name. A decision or embedding whose vault holds no key is refused with `auth`.
|
|
242
|
+
|
|
243
|
+
With `lent`, the handler also runs chats, calls, decisions, and embeddings. A draft that names a model the keys do not run is refused with the reason `LentKeys.violation` gives.
|
|
244
|
+
|
|
245
|
+
| Option | What it does |
|
|
246
|
+
| --- | --- |
|
|
247
|
+
| `lent` | `{ mode: 'demo', keys }`, with `hostOptions` filling each profile's key slots, and your tool handlers. Without it, no draft runs on the server. |
|
|
248
|
+
| `spend` | Spends one `decision`, `call`, or `agent` turn for whoever sent the request, before it runs. Throw a `TheoremError` to refuse it; the screen shows its wording. Default: nothing is counted. |
|
|
249
|
+
| `resolveHost` | Resolves the names the connection test calls, so the network guard refuses one that answers a private address. Workers have no DNS lookup: pass `dnsOverHttpsResolver(...)`. Default: `lent.resolveHost`. |
|
|
250
|
+
| `onProbePassed` | Gets each probed text that some guardrail boundary let through, after the reply. |
|
|
251
|
+
| `sessionStore`, `pageToolBroker`, `steer` | Where visitor sessions, page tool results, and a running chat's steers are kept. Default: in memory. A host on several isolates needs stores they all reach. |
|
|
252
|
+
| `conversationKey` | The key chat conversations are sealed with. Default: a new one for this handler's lifetime. A restart, or another isolate, then cannot open a chat, and the chat continues from the page's transcript. Pass one key to every isolate to keep each conversation on the server. |
|
|
253
|
+
| `draftNetwork` | True only when the handler serves the builder alone, on their own machine, as the command's does. A connection test then keeps to the draft's network guardrail. Otherwise it reaches public hosts only. |
|
|
254
|
+
|
|
255
|
+
Live calls on lent keys open a WebSocket to `/api/live/relay`, not `/api/studio`. This package does not ship that relay. Build it on your server with `attachStudioLiveSession` from `@theoremjs/studio/browser`, and see the relay section of [`@theoremjs/react`](https://www.npmjs.com/package/@theoremjs/react).
|
|
256
|
+
|
|
257
|
+
## Entry points
|
|
258
|
+
|
|
259
|
+
| Import | What it holds |
|
|
260
|
+
| --- | --- |
|
|
261
|
+
| `theorem-studio` | The command. |
|
|
262
|
+
| `@theoremjs/studio/server` | `createStudioDraftHandler`, `STUDIO_BASE`, and their types. |
|
|
263
|
+
| `@theoremjs/studio/ui/*` | The screen: `ui/studio-screen.tsx`, `ui/lib/studio-open.ts`, the theme in `ui/built/`, and the stylesheets. |
|
|
264
|
+
| `@theoremjs/studio/vite` | `studioVite`. |
|
|
265
|
+
| `@theoremjs/studio/people` | `StudioPeople` and `StudioActingAs`, for a setup file. |
|
|
266
|
+
| `@theoremjs/studio/browser` | Runs a draft in the browser on the builder's keys, and `attachStudioLiveSession` for a live relay. |
|
|
267
|
+
| `@theoremjs/studio/runtime` | `studioScope` and the run functions the handler is built on, for a server of your own. |
|
|
268
|
+
| `@theoremjs/studio/surface` | `studioSurface`: the draft as nodes an agent can read and set. |
|
|
269
|
+
| `@theoremjs/studio` | The draft and its tools (below). |
|
|
270
|
+
|
|
271
|
+
## The `@theoremjs/studio` entry
|
|
272
|
+
|
|
273
|
+
Use these when you build on the studio's draft yourself: compile it, export it as source, or probe its guardrails.
|
|
274
|
+
|
|
275
|
+
| Export | Purpose |
|
|
276
|
+
| --- | --- |
|
|
277
|
+
| `StudioDraft`, `createBlankDraft()`, `createExampleDraft()` | Editable profile draft; blank, or the travel concierge |
|
|
278
|
+
| `createDecisionExampleDraft()`, `DECISION_EXAMPLE_STATE`, `decisionExampleAssets()` | The decision example: Jev 1.14 asked about a pantry shelf, with box, Number and Choice questions. Its four pictures ship with it, and load only when the example is made, so both functions return a promise. The ginger, the colour chart and the flag are the decision's own, sent with every decision. The chart question sets its box's image to `<apple_ripeness>`. The run tab starts with the shelf in its state. Each is written as its reference, such as `<ginger>`, in the state or in the questions. The shelf and ginger photos are CC0 and the flag is public domain, all from Wikimedia Commons. The colour chart was drawn for the example |
|
|
279
|
+
| `createLiveExampleDraft()`, `createNarratorExampleDraft()`, `createConsoleExampleDraft()`, `createArchitectWorkspace()` | The other examples: the concierge as a live agent, a speech narrator, a host tool console, and a code architect that calls the narrator through an agent tool |
|
|
280
|
+
| `setProfileType()`, `includeFacet()`, `excludeFacet()`, `newModelBinding()`, `newToolSpec()` | Draft edits that keep it consistent with `PROFILE_GRAPH` |
|
|
281
|
+
| `studioTree()`, `studioNodeRef()`, `modelBindingNodeId()`, `toolSpecNodeId()` | The draft as a tree; node ids that issues point at |
|
|
282
|
+
| `compileStudio()` | Draft → profile definition, custom tools, structured schema; or issues keyed by node |
|
|
283
|
+
| `studioSource()` | Compiled draft as a TypeScript module (`registerTool`, `defineProfile`, `registerProfile`) |
|
|
284
|
+
| `LentKeys`, `LentHolds`, `StudioRunsOn`, `ON_OWN_KEYS`, `modelBindingViolation()` | What a studio runs on: a page's lent keys (which models, built-ins, and decision sizes they allow, and what runs on them keep to whatever a profile says), or the builder's own keys or machine, where a profile runs as written |
|
|
285
|
+
| `zodFromJsonSchema()`, `parseJsonSchema()` | Authored JSON Schema → Zod for registration |
|
|
286
|
+
| run-payload helpers, `studioRunDefines()`, `clearStaleStudioRuns()` | Handoff of a compiled draft to the run tab, whether a kept run still defines on this package, and clearing the ones that do not |
|
|
287
|
+
| `createStudioTransport()`, `studioInterface()` | The run tab's transport for a compiled draft; its `traces` feed receives the records each run writes |
|
|
288
|
+
| `runGuardrailProbes()`, `runGuardrailProbe()`, `probeDraft()`, `PROBE_BOUNDARIES`, `PROBE_BOUNDARY_NOTES`, `PROBE_STATUSES` | Test a draft's guardrails: send one text across every boundary, or across one, on a scripted model. Each boundary answers with a status (passed, flagged, redacted, or blocked), whether its turn was tainted by a remote read, the guardrail events, what went on past the boundary, and the turn's trace records. No model or host is called. Each boundary's note says what crosses it, when the kernel reads it and what the kernel does there |
|
|
289
|
+
| `PROBE_BATTERY` | Hard texts to probe with: disguised attacks and harmless texts that look like attacks, each with the boundary it crosses and whether a guardrail should act on it |
|
|
290
|
+
| `createStudioTraceRouter()`, `STUDIO_RUN_METADATA_KEY`, `StudioTraceLine` | Trace delivery: the server registers the router's sink for `STUDIO_TRACE_DESTINATION`; each run opens a route and passes its metadata, and gets back `{ type: 'trace', record }` lines (after a text run's events, or on the Live socket as each record is written) |
|
|
291
|
+
| `demoToolSpecs()`, `demoInputsSpec()` | Every example tool seed, and the inputs facet seed |
|
|
292
|
+
| `DEMO_CONCIERGE_SYSTEM`, `DEMO_ALLOWED_HOSTS` | Demo system prompt and egress allowlist |
|
|
293
|
+
| `DEMO_HTTP_SAMPLE_INPUT`, `demoHttpSampleInput()` | Connection-test payloads for demo HTTP tools |
|
|
294
|
+
| `registerStudioTools()`, `StudioToolHandlers` | Register a draft's tools; a function tool answers with its sample reply, else the handler the host gives for its name, else a stub from its output schema |
|
|
295
|
+
| `stubOutputFromSchema()` | Generic stub object from a JSON Schema |
|
|
296
|
+
| `StudioInputsSpec`, `StudioToolSeed`, `StudioToolSpecSeed` | Serializable seed shapes |
|
package/agreement.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a profile the studio opened is the profile the project registered. The studio reads a
|
|
3
|
+
* profile into its own draft and compiles it back; the two may differ only in the settings the
|
|
4
|
+
* studio's policy sets for itself, and any other difference is one the studio has to show.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Each setting `studio` holds differently from `project`, by its path. A setting left out is the
|
|
10
|
+
* value the kernel says leaving it out stands for, and where the kernel names no such value,
|
|
11
|
+
* left out and written are two things. A section left out is one written with nothing in it: each
|
|
12
|
+
* setting in it is then read as left out, and a difference is named where it is.
|
|
13
|
+
*/
|
|
14
|
+
export declare function differingSettings(project: unknown, studio: unknown): string[];
|
package/agreement.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a profile the studio opened is the profile the project registered. The studio reads a
|
|
3
|
+
* profile into its own draft and compiles it back; the two may differ only in the settings the
|
|
4
|
+
* studio's policy sets for itself, and any other difference is one the studio has to show.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { resolveAllow, resolveDetect } from '@theoremjs/agents/guardrails';
|
|
9
|
+
import { unsetValue } from '@theoremjs/agents/kernel';
|
|
10
|
+
import { STUDIO_POLICY_UNSET } from "./policy.js";
|
|
11
|
+
function isRecord(value) {
|
|
12
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
13
|
+
}
|
|
14
|
+
/** Whether the studio holds `theirs` at `path` only because the project left it out: its policy fills it in. */
|
|
15
|
+
function isPolicyFill(path, ours, theirs) {
|
|
16
|
+
return (ours === undefined && theirs !== undefined && STUDIO_POLICY_UNSET[path.join('.')] === theirs);
|
|
17
|
+
}
|
|
18
|
+
/** `held` without the table the kernel works out from its patterns. */
|
|
19
|
+
const uncompiled = ({ compiled: _, ...held }) => held;
|
|
20
|
+
/**
|
|
21
|
+
* What the kernel reads `detect` as: each detector's action at each boundary, whose patterns it
|
|
22
|
+
* reads with, and what it lets through. Two settings the kernel reads the same are the same here.
|
|
23
|
+
*/
|
|
24
|
+
function detectAsRead(detect) {
|
|
25
|
+
if (detect === undefined)
|
|
26
|
+
return undefined;
|
|
27
|
+
const { sources = {}, host = [], ...read } = resolveDetect(detect);
|
|
28
|
+
const allow = Object.entries(resolveAllow(detect)).map(([detector, held]) => [
|
|
29
|
+
detector,
|
|
30
|
+
{
|
|
31
|
+
...held,
|
|
32
|
+
fromTools: held.fromTools ?? unsetValue(['guardrails', 'detect', detector, 'allow', 'fromTools']),
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
return {
|
|
36
|
+
...read,
|
|
37
|
+
sources: Object.fromEntries(Object.entries(sources).map(([detector, source]) => [detector, uncompiled(source)])),
|
|
38
|
+
host: Object.fromEntries(host.map(({ id, ...rule }) => [id, uncompiled(rule)])),
|
|
39
|
+
allow: Object.fromEntries(allow),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** A profile with its `detect` as the kernel reads it. */
|
|
43
|
+
function asRead(profile) {
|
|
44
|
+
if (!isRecord(profile) ||
|
|
45
|
+
!isRecord(profile.guardrails) ||
|
|
46
|
+
profile.guardrails.detect === undefined)
|
|
47
|
+
return profile;
|
|
48
|
+
return {
|
|
49
|
+
...profile,
|
|
50
|
+
guardrails: { ...profile.guardrails, detect: detectAsRead(profile.guardrails.detect) },
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Each setting `studio` holds differently from `project`, by its path. A setting left out is the
|
|
55
|
+
* value the kernel says leaving it out stands for, and where the kernel names no such value,
|
|
56
|
+
* left out and written are two things. A section left out is one written with nothing in it: each
|
|
57
|
+
* setting in it is then read as left out, and a difference is named where it is.
|
|
58
|
+
*/
|
|
59
|
+
export function differingSettings(project, studio) {
|
|
60
|
+
const found = [];
|
|
61
|
+
const walk = (ours, theirs, path) => {
|
|
62
|
+
if (isPolicyFill(path, ours, theirs))
|
|
63
|
+
return;
|
|
64
|
+
let [mine, yours] = [ours ?? unsetValue(path), theirs ?? unsetValue(path)];
|
|
65
|
+
if (mine === undefined && isRecord(yours))
|
|
66
|
+
mine = {};
|
|
67
|
+
if (yours === undefined && isRecord(mine))
|
|
68
|
+
yours = {};
|
|
69
|
+
if (JSON.stringify(mine) === JSON.stringify(yours))
|
|
70
|
+
return;
|
|
71
|
+
if (!isRecord(mine) || !isRecord(yours)) {
|
|
72
|
+
found.push(path.join('.'));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
for (const key of new Set([...Object.keys(mine), ...Object.keys(yours)]))
|
|
76
|
+
walk(mine[key], yours[key], [...path, key]);
|
|
77
|
+
};
|
|
78
|
+
walk(asRead(project), asRead(studio), []);
|
|
79
|
+
return found;
|
|
80
|
+
}
|
package/asks.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The question the studio puts before a real run of a tool that writes: which tool, how it is
|
|
3
|
+
* set, what the run sends, and where. A tool that only reads is run unasked.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolSpecDraft } from './draft.ts';
|
|
8
|
+
/** What the builder reads before a tool that writes runs. */
|
|
9
|
+
export interface WriteAsk {
|
|
10
|
+
tool: string;
|
|
11
|
+
access: Exclude<ToolSpecDraft['access'], 'read-only'>;
|
|
12
|
+
/** The request the run makes, as `METHOD address`. */
|
|
13
|
+
sends: string;
|
|
14
|
+
/** The input the run sends, as the JSON the builder typed. */
|
|
15
|
+
input: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The question to put before the editor's Test of `tool`, or undefined when the test needs none:
|
|
19
|
+
* the tool only reads, or the test only lists an MCP server's tools and calls none.
|
|
20
|
+
*/
|
|
21
|
+
export declare function writeAsk(tool: ToolSpecDraft, input: string): WriteAsk | undefined;
|
|
22
|
+
/** What the question says above the input. */
|
|
23
|
+
export declare function writeAskLine(ask: WriteAsk): string;
|
|
24
|
+
/** A registered tool, as far as asking goes. An agent tool names the profile it runs. */
|
|
25
|
+
export interface AskTool {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
access: string;
|
|
29
|
+
permission: string;
|
|
30
|
+
profile?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Which of a project's tools the studio makes ask, and which it cannot. */
|
|
33
|
+
export interface StudioAsks {
|
|
34
|
+
/** The tools that ask before each run here and would not in the application. */
|
|
35
|
+
asked: string[];
|
|
36
|
+
/**
|
|
37
|
+
* The tools that write and run unasked: a called agent runs them, and a question inside a called
|
|
38
|
+
* agent has no one to answer it. The call to that agent asks instead.
|
|
39
|
+
*/
|
|
40
|
+
inside: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The tools the studio makes ask before each run: every one that writes, and every agent tool
|
|
44
|
+
* whose agent can reach one that writes. A tool a called agent runs is left as it is, because the
|
|
45
|
+
* kernel refuses a called agent whose tool can stop on a question.
|
|
46
|
+
*/
|
|
47
|
+
export declare function studioAsks(tools: readonly AskTool[], allowed: (profile: string) => readonly string[]): StudioAsks;
|
package/asks.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The question the studio puts before a real run of a tool that writes: which tool, how it is
|
|
3
|
+
* set, what the run sends, and where. A tool that only reads is run unasked.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The question to put before the editor's Test of `tool`, or undefined when the test needs none:
|
|
9
|
+
* the tool only reads, or the test only lists an MCP server's tools and calls none.
|
|
10
|
+
*/
|
|
11
|
+
export function writeAsk(tool, input) {
|
|
12
|
+
if (tool.access === 'read-only' || tool.toolType !== 'http')
|
|
13
|
+
return undefined;
|
|
14
|
+
return {
|
|
15
|
+
tool: tool.toolName,
|
|
16
|
+
access: tool.access,
|
|
17
|
+
sends: `${tool.method ?? 'GET'} ${tool.endpoint ?? ''}`.trim(),
|
|
18
|
+
input: input.trim() || '{}',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** What the question says above the input. */
|
|
22
|
+
export function writeAskLine(ask) {
|
|
23
|
+
const set = ask.access === 'destructive' ? 'destructive' : 'read and write';
|
|
24
|
+
return `It is set as ${set}. Run sends a real request: ${ask.sends}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The tools the studio makes ask before each run: every one that writes, and every agent tool
|
|
28
|
+
* whose agent can reach one that writes. A tool a called agent runs is left as it is, because the
|
|
29
|
+
* kernel refuses a called agent whose tool can stop on a question.
|
|
30
|
+
*/
|
|
31
|
+
export function studioAsks(tools, allowed) {
|
|
32
|
+
const named = new Map(tools.map((tool) => [tool.name, tool]));
|
|
33
|
+
const runs = (tool) => tool.type === 'agent' && tool.profile ? allowed(tool.profile) : [];
|
|
34
|
+
const inside = new Set(tools.flatMap(runs));
|
|
35
|
+
const writes = (tool, seen) => {
|
|
36
|
+
if (seen.has(tool.name))
|
|
37
|
+
return false;
|
|
38
|
+
seen.add(tool.name);
|
|
39
|
+
if (tool.access !== 'read-only')
|
|
40
|
+
return true;
|
|
41
|
+
return runs(tool).some((name) => {
|
|
42
|
+
const inner = named.get(name);
|
|
43
|
+
return inner !== undefined && writes(inner, seen);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
// A provider's built-in tool runs on the provider and never stops on a question.
|
|
47
|
+
const writing = tools.filter((tool) => tool.type !== 'builtin' && writes(tool, new Set()));
|
|
48
|
+
return {
|
|
49
|
+
asked: writing
|
|
50
|
+
.filter((tool) => !inside.has(tool.name) && tool.permission !== 'always_confirm')
|
|
51
|
+
.map((tool) => tool.name),
|
|
52
|
+
inside: writing.filter((tool) => inside.has(tool.name)).map((tool) => tool.name),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type KeyVault } from '@theoremjs/agents';
|
|
2
|
+
import type { StudioBrowserRuntime } from './browser-transport.ts';
|
|
3
|
+
/** Browser-only host configuration. Never part of a compiled profile or persisted run payload. */
|
|
4
|
+
export interface StudioBrowserConnection {
|
|
5
|
+
/** One vault for every provider; each model reads the slot it names. */
|
|
6
|
+
vault: KeyVault;
|
|
7
|
+
/** A local model that needs a token names a slot, like any other model. */
|
|
8
|
+
local: {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
};
|
|
11
|
+
remoteTools: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Which service a pasted key belongs to, from its published prefix; `undefined` when unknown. */
|
|
14
|
+
export declare function keyKind(secret: string | undefined): 'gemini' | 'openrouter' | undefined;
|
|
15
|
+
export declare function localStudioConfig(local: StudioBrowserConnection['local']): NonNullable<StudioBrowserRuntime['providers']>['local'];
|
|
16
|
+
export declare const STUDIO_KEY_SLOT_CAP = 32;
|
|
17
|
+
/** The same localhost origin and transport used for inference; never a site proxy. */
|
|
18
|
+
export declare function listLocalStudioModels(local: StudioBrowserConnection['local'], signal?: AbortSignal): Promise<string[]>;
|
|
19
|
+
/** The profile types a model runs for; a provider's list is filtered to the one being edited. */
|
|
20
|
+
export type ListedProfileType = 'text' | 'image' | 'speech' | 'live' | 'embedding';
|
|
21
|
+
/** A model a provider lists, as the studio's picker shows it. */
|
|
22
|
+
export interface ProviderModel {
|
|
23
|
+
/** What the profile's `apiId` is set to. */
|
|
24
|
+
id: string;
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
/** The providers whose models the studio can list from the browser. */
|
|
28
|
+
export type ListedProvider = 'gemini' | 'openrouter';
|
|
29
|
+
export declare const KNOWN_GEMINI_EMBEDDING_MODELS: readonly ProviderModel[];
|
|
30
|
+
export declare const KNOWN_OPENROUTER_EMBEDDING_MODELS: readonly ProviderModel[];
|
|
31
|
+
/**
|
|
32
|
+
* The models a provider offers for a profile type, fetched from the browser with the key in this
|
|
33
|
+
* tab, never through the site. OpenRouter lists without a key and says what each model returns, so
|
|
34
|
+
* its list keeps only models of the profile's kind. Gemini needs the key and says only which calls
|
|
35
|
+
* a model takes, so its list keeps the models that answer a turn (live models for live).
|
|
36
|
+
*/
|
|
37
|
+
export declare function listProviderModels(provider: ListedProvider, profileType: ListedProfileType, key: string | undefined, signal?: AbortSignal): Promise<ProviderModel[]>;
|
|
38
|
+
/** Slot references come from the compiled contract, including each model's overrides. */
|
|
39
|
+
export declare function studioKeySlots(profile: {
|
|
40
|
+
type?: string;
|
|
41
|
+
key?: string;
|
|
42
|
+
fallbackKey?: string;
|
|
43
|
+
models?: Record<string, {
|
|
44
|
+
keySlot?: string;
|
|
45
|
+
fallbackKeySlot?: string;
|
|
46
|
+
}>;
|
|
47
|
+
}): string[];
|
|
48
|
+
/** Defines even empty referenced slots, so names such as `constructor` never read inherited values. */
|
|
49
|
+
export declare function studioVault(slots: readonly string[], vault: KeyVault): KeyVault;
|