@theoremjs/studio 0.0.0-stage → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +295 -2
- package/agreement.d.ts +14 -0
- package/agreement.js +80 -0
- package/asks.d.ts +47 -0
- package/asks.js +54 -0
- package/browser-connection.d.ts +49 -0
- package/browser-connection.js +215 -0
- package/browser-engine.d.ts +11 -0
- package/browser-engine.js +11 -0
- package/browser-execution.d.ts +6 -0
- package/browser-execution.js +18 -0
- package/browser-live.d.ts +4 -0
- package/browser-live.js +132 -0
- package/browser-transport.d.ts +33 -0
- package/browser-transport.js +229 -0
- package/browser.d.ts +4 -0
- package/browser.js +4 -0
- package/canonical.d.ts +10 -0
- package/canonical.js +25 -0
- package/compile-workspace.d.ts +28 -0
- package/compile-workspace.js +295 -0
- package/compile.d.ts +65 -0
- package/compile.js +1605 -0
- package/concierge-demo.d.ts +17 -0
- package/concierge-demo.js +1230 -0
- package/conversation-key.d.ts +5 -0
- package/conversation-key.js +10 -0
- package/decision-example-images.d.ts +30 -0
- package/decision-example-images.js +30 -0
- package/deno.json +3 -0
- package/draft.d.ts +407 -0
- package/draft.js +505 -0
- package/editors.d.ts +29 -0
- package/editors.js +51 -0
- package/example-embedding-files.d.ts +11 -0
- package/example-embedding-files.js +20 -0
- package/example.d.ts +36 -0
- package/example.js +357 -0
- package/guardrail-probe.d.ts +100 -0
- package/guardrail-probe.js +722 -0
- package/held-credentials.d.ts +28 -0
- package/held-credentials.js +87 -0
- package/installed.mjs +40 -0
- package/lent-keys.d.ts +122 -0
- package/lent-keys.js +47 -0
- package/line-diff.d.ts +15 -0
- package/line-diff.js +41 -0
- package/live-connection.d.ts +22 -0
- package/live-connection.js +27 -0
- package/live-session-bridge.d.ts +15 -0
- package/live-session-bridge.js +202 -0
- package/map-line.d.ts +19 -0
- package/map-line.js +42 -0
- package/map.d.ts +154 -0
- package/map.js +525 -0
- package/media-accept.d.ts +19 -0
- package/media-accept.js +65 -0
- package/mod.d.ts +39 -0
- package/mod.js +33 -0
- package/origins.d.ts +52 -0
- package/origins.js +165 -0
- package/package.json +85 -4
- package/page/assets/Banner-BISz3nXA.js +2 -0
- package/page/assets/BottomSheet-BwfBDtje.js +1 -0
- package/page/assets/Card-Lp-0P5eL.js +1 -0
- package/page/assets/CardWall-CBRLdDZW.js +1 -0
- package/page/assets/Center-nHS1JSux.js +1 -0
- package/page/assets/CheckboxInput-Cj5pk-KI.js +2 -0
- package/page/assets/CodeBlock-C7XJ4ioE.js +51 -0
- package/page/assets/CollapsibleGroup-N7_SOjbm.js +2 -0
- package/page/assets/ContextMenu-CBu9H-9H.js +2 -0
- package/page/assets/DateInput-BGrQ5tPC.js +1 -0
- package/page/assets/Dialog-DELWQo-v.js +1 -0
- package/page/assets/EmptyState-C8W4JKBZ.js +1 -0
- package/page/assets/HoverCard-D1Y1ltWQ.js +1 -0
- package/page/assets/Icon-JrysT8aU.js +3 -0
- package/page/assets/IconAlertTriangle-BqAEqqdU.js +1 -0
- package/page/assets/IconButton-DlOGzJIX.js +1 -0
- package/page/assets/IconEye-BB5aY-wQ.js +1 -0
- package/page/assets/IconFileText-6zOFKKrF.js +1 -0
- package/page/assets/IconSearch-BTx66a40.js +1 -0
- package/page/assets/IconShield-DDOh7Gr5.js +1 -0
- package/page/assets/ItemSwipeLayer-Ckn4X6h9.js +1 -0
- package/page/assets/PaneState-BvA2tLQg.js +1 -0
- package/page/assets/PaneState-eUzUkNE8.css +1 -0
- package/page/assets/ScrollableArea-Ckugdj1N.js +1 -0
- package/page/assets/Section-DJ97F7QE.js +1 -0
- package/page/assets/SegmentedControlItem-h-aaXzyS.js +1 -0
- package/page/assets/SidePanel-BL32abk8.js +1 -0
- package/page/assets/StackItem-CQviqAfM.js +1 -0
- package/page/assets/Text-bum6zWWx.js +2 -0
- package/page/assets/TimestampHoverCard-DQIG0RZF.js +1 -0
- package/page/assets/ToolResultCharts-CgshSv9Q.js +1 -0
- package/page/assets/Tooltip-BH9xiRMl.js +1 -0
- package/page/assets/TraceInspector-_yZiz05W.js +1 -0
- package/page/assets/TraceOverview-BPO-HIYK.js +57 -0
- package/page/assets/VStack-CkVMcNiK.js +1 -0
- package/page/assets/_virtual_studio-type-sources-ByxqQaOG.js +12936 -0
- package/page/assets/arrive-DvbqpeRS.js +1 -0
- package/page/assets/browser-engine-CYq9DQAM.js +9 -0
- package/page/assets/browser-transport-D-2jDYe7.js +47 -0
- package/page/assets/codicon-DF1abBS2.ttf +0 -0
- package/page/assets/compile-egress-BSxOdX4K.js +23 -0
- package/page/assets/container.stylex-BmOi-8DQ.js +1 -0
- package/page/assets/createReactComponent-CZwsv6DD.js +1 -0
- package/page/assets/decision-example-images-CZGr7YIT.js +1 -0
- package/page/assets/devWarning-DxuplmRl.js +1 -0
- package/page/assets/editor-DjpsE8to.css +1 -0
- package/page/assets/editor.api-Cd3ViPQa.js +908 -0
- package/page/assets/editor.worker-6GY8RhDc.js +1 -0
- package/page/assets/editor.worker-BmdWdrHZ.js +33 -0
- package/page/assets/editors-BJX_S59A.js +1 -0
- package/page/assets/egress-automata-B5ZGE1mT.js +1 -0
- package/page/assets/embedding-space-view-CfQBPDxD.js +140 -0
- package/page/assets/encode-files-Bc3HJyAh.js +1 -0
- package/page/assets/export-agent-C3yyzXH8.js +43 -0
- package/page/assets/figtree-latin-400-normal-BD4aNku5.woff +0 -0
- package/page/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
- package/page/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
- package/page/assets/figtree-latin-500-normal-B_yy1phn.woff +0 -0
- package/page/assets/figtree-latin-600-normal-BM_oTo4n.woff +0 -0
- package/page/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
- package/page/assets/figtree-latin-700-normal-BCCt2T1q.woff +0 -0
- package/page/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
- package/page/assets/focusOutline.stylex-BT0kfa4t.js +1 -0
- package/page/assets/focusableSelector-DXZeMU85.js +1 -0
- package/page/assets/groupStyles-C7Ter7zC.js +1 -0
- package/page/assets/guardrail-tester-Gut5xK4a.js +9 -0
- package/page/assets/host-patterns-C9RMP16Q.js +1 -0
- package/page/assets/index-CvvmFKgS.js +105 -0
- package/page/assets/index-DOaHlqBo.css +1 -0
- package/page/assets/isRtlElement-BG33-k_H.js +1 -0
- package/page/assets/labels-provider-4TIWDvsE.js +3 -0
- package/page/assets/lent-keys-C32ems-I.js +1 -0
- package/page/assets/live-ingress-lDUGPwth.js +1 -0
- package/page/assets/live-messages-CnkL4GWi.js +1 -0
- package/page/assets/mergeProps-ptS-gIMz.js +1 -0
- package/page/assets/padding.stylex-B76907Zf.js +1 -0
- package/page/assets/preload-helper-DpV6A1kQ.js +1 -0
- package/page/assets/reader-BOCCYaRp.js +7 -0
- package/page/assets/register-CDgivxvX.js +2 -0
- package/page/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/page/assets/schemas-BQ9Jydzb.js +56 -0
- package/page/assets/shaped-data-BcarWqd5.js +16 -0
- package/page/assets/sharedResizeObserver-4U9Xq5Oq.js +1 -0
- package/page/assets/stub-DhdcU_Ew.js +471 -0
- package/page/assets/studio-code-pane-C_SAbcOa.js +8 -0
- package/page/assets/studio-console-DZwlEsvr.js +3 -0
- package/page/assets/studio-decision-B0FnCAXA.js +1 -0
- package/page/assets/studio-embedding-CmA51HVo.js +2 -0
- package/page/assets/studio-host-console-By7hqu2l.js +2 -0
- package/page/assets/studio-live-BrcVQcyV.js +1 -0
- package/page/assets/studio-map-B_xSia-z.js +1 -0
- package/page/assets/studio-map-Bb06Tw1F.css +1 -0
- package/page/assets/studio-monaco-CbKf90i6.css +1 -0
- package/page/assets/studio-monaco-xfyfezQS.js +34 -0
- package/page/assets/studio-ts.worker-B-EXG4Sv.js +67741 -0
- package/page/assets/studio-ts.worker-BXtW3z-O.js +1 -0
- package/page/assets/studio-type-checker-BOvxudki.js +23 -0
- package/page/assets/themeProps-3IqahpCr.js +1 -0
- package/page/assets/tokens.stylex-DkHf0P9C.js +1 -0
- package/page/assets/tool-schema-idaOe2nI.js +18 -0
- package/page/assets/trace-patterns-DnYJa0nI.js +1 -0
- package/page/assets/trace-record-C3zNksA_.js +1 -0
- package/page/assets/trace-schema-9CdEyG6Q.js +1 -0
- package/page/assets/tree-DqyAMsbI.js +3 -0
- package/page/assets/turn-client-Du3Um3Mg.js +2 -0
- package/page/assets/types-BhfXQCLx.js +1 -0
- package/page/assets/typescript-20GgZ8PJ.js +1 -0
- package/page/assets/use-one-call-Hcs8YBp1.js +1 -0
- package/page/assets/useAdaptivePresentation-BzmPCddb.js +1 -0
- package/page/assets/useClipboard-BgGRxRMJ.js +1 -0
- package/page/assets/useContainerReveal-BFy8N_QU.js +1 -0
- package/page/assets/useDevWarning-Z9SoixOP.js +1 -0
- package/page/assets/useLayerDismissal-B_G7IWpC.js +1 -0
- package/page/assets/useMediaQuery-BCT0NUeZ.js +1 -0
- package/page/assets/useScrollLock-Dyf6PHJt.js +1 -0
- package/page/assets/useScrollableArea-0NzdiBCq.js +1 -0
- package/page/assets/useTooltip-CJM_xhLB.js +1 -0
- package/page/assets/workspace-DZALqEDX.js +1 -0
- package/page/assets/zip-DTcEfps6.js +1 -0
- package/page/index.html +90 -0
- package/page.mjs +49 -0
- package/people.d.ts +87 -0
- package/people.js +110 -0
- package/policy.d.ts +43 -0
- package/policy.js +102 -0
- package/ports.d.mts +32 -0
- package/ports.mjs +85 -0
- package/probe-battery.d.ts +13 -0
- package/probe-battery.js +404 -0
- package/providers.d.ts +149 -0
- package/providers.js +306 -0
- package/read-source.d.ts +48 -0
- package/read-source.js +1301 -0
- package/read-steps.d.ts +23 -0
- package/read-steps.js +2 -0
- package/reader.d.ts +11 -0
- package/reader.js +11 -0
- package/registrations.d.ts +83 -0
- package/registrations.js +1 -0
- package/requirements.d.ts +22 -0
- package/requirements.js +38 -0
- package/run-payload-core.d.ts +28 -0
- package/run-payload-core.js +123 -0
- package/run-payload.d.ts +32 -0
- package/run-payload.js +26 -0
- package/runtime-scope.d.ts +84 -0
- package/runtime-scope.js +308 -0
- package/runtime.d.ts +84 -0
- package/runtime.js +387 -0
- package/section-notes.d.ts +33 -0
- package/section-notes.js +38 -0
- package/serve-page.mjs +96 -0
- package/server/draft-decide.d.ts +72 -0
- package/server/draft-decide.js +111 -0
- package/server/draft-embedding.d.ts +3 -0
- package/server/draft-embedding.js +35 -0
- package/server/draft-handler.d.ts +82 -0
- package/server/draft-handler.js +213 -0
- package/server/draft-probe.d.ts +14 -0
- package/server/draft-probe.js +61 -0
- package/server/draft-replies.d.ts +22 -0
- package/server/draft-replies.js +46 -0
- package/server/edited-session.d.ts +28 -0
- package/server/edited-session.js +83 -0
- package/server/edits.d.ts +38 -0
- package/server/edits.js +195 -0
- package/server/handler.d.ts +133 -0
- package/server/handler.js +598 -0
- package/server/lent-draft.d.ts +19 -0
- package/server/lent-draft.js +23 -0
- package/server/live.d.ts +15 -0
- package/server/live.js +96 -0
- package/server/open-editor.d.ts +63 -0
- package/server/open-editor.js +115 -0
- package/server/origins.d.ts +18 -0
- package/server/origins.js +330 -0
- package/server/project-source.d.ts +208 -0
- package/server/project-source.js +1042 -0
- package/server/project.d.ts +22 -0
- package/server/project.js +56 -0
- package/server/run-traces.d.ts +20 -0
- package/server/run-traces.js +96 -0
- package/server/save-new.d.ts +29 -0
- package/server/save-new.js +514 -0
- package/server/save-plan.d.ts +46 -0
- package/server/save-plan.js +1134 -0
- package/server/save-remove.d.ts +21 -0
- package/server/save-remove.js +528 -0
- package/server/save-session.d.ts +96 -0
- package/server/save-session.js +418 -0
- package/server/save-wire.d.ts +235 -0
- package/server/save-wire.js +8 -0
- package/server/save.d.ts +52 -0
- package/server/save.js +209 -0
- package/server/serve.d.ts +23 -0
- package/server/serve.js +413 -0
- package/server/test-connection.d.ts +17 -0
- package/server/test-connection.js +362 -0
- package/server/test-key.d.ts +2 -0
- package/server/test-key.js +83 -0
- package/server/watch.d.ts +28 -0
- package/server/watch.js +93 -0
- package/server/zod-edit.d.ts +74 -0
- package/server/zod-edit.js +558 -0
- package/server.d.ts +8 -0
- package/server.js +8 -0
- package/setups.mjs +170 -0
- package/shared-carry.d.ts +114 -0
- package/shared-carry.js +523 -0
- package/shared-settings.d.ts +34 -0
- package/shared-settings.js +70 -0
- package/source.d.ts +75 -0
- package/source.js +414 -0
- package/start.mjs +169 -0
- package/stream-lines.d.ts +9 -0
- package/stream-lines.js +27 -0
- package/stub.d.ts +6 -0
- package/stub.js +33 -0
- package/surface.d.ts +53 -0
- package/surface.js +631 -0
- package/system-markup.d.ts +20 -0
- package/system-markup.js +51 -0
- package/tool-schema.d.ts +23 -0
- package/tool-schema.js +69 -0
- package/tools.d.ts +16 -0
- package/tools.js +91 -0
- package/traces.d.ts +24 -0
- package/traces.js +29 -0
- package/transport.d.ts +57 -0
- package/transport.js +187 -0
- package/tree.d.ts +32 -0
- package/tree.js +83 -0
- package/types.d.ts +62 -0
- package/types.js +6 -0
- package/ui/acting-as-button.d.ts +2 -0
- package/ui/acting-as-button.js +16 -0
- package/ui/add-provider.d.ts +13 -0
- package/ui/add-provider.js +20 -0
- package/ui/boot-mark.css +53 -0
- package/ui/boot-mark.d.ts +19 -0
- package/ui/boot-mark.js +128 -0
- package/ui/boot-paint.d.ts +8 -0
- package/ui/boot-paint.js +8 -0
- package/ui/brand-icons.d.ts +57 -0
- package/ui/brand-icons.js +148 -0
- package/ui/built/theme.css +830 -0
- package/ui/built/theme.css.d.ts +9 -0
- package/ui/built/theorem-studio.d.ts +13 -0
- package/ui/built/theorem-studio.js +705 -0
- package/ui/built/theorem-studio.variants.d.ts +28 -0
- package/ui/code/monaco-contributions.d.ts +45 -0
- package/ui/code/studio-code.d.ts +7 -0
- package/ui/code/studio-code.js +253 -0
- package/ui/code/studio-monaco.d.ts +44 -0
- package/ui/code/studio-monaco.js +48 -0
- package/ui/code/studio-ts.worker.d.ts +1 -0
- package/ui/code/studio-ts.worker.js +16 -0
- package/ui/code/studio-type-checker.d.ts +12 -0
- package/ui/code/studio-type-checker.js +308 -0
- package/ui/code/studio-type-sources.d.ts +26 -0
- package/ui/confirm-write.d.ts +12 -0
- package/ui/confirm-write.js +45 -0
- package/ui/diff-block.d.ts +21 -0
- package/ui/diff-block.js +17 -0
- package/ui/figtree.css +59 -0
- package/ui/file-place.d.ts +4 -0
- package/ui/file-place.js +26 -0
- package/ui/guardrail-tester.d.ts +18 -0
- package/ui/guardrail-tester.js +248 -0
- package/ui/inspector-context.d.ts +119 -0
- package/ui/inspector-context.js +84 -0
- package/ui/inspector.d.ts +247 -0
- package/ui/inspector.js +284 -0
- package/ui/lib/acting-as.d.ts +25 -0
- package/ui/lib/acting-as.js +90 -0
- package/ui/lib/boot-sequence.d.ts +32 -0
- package/ui/lib/boot-sequence.js +57 -0
- package/ui/lib/export-agent.d.ts +11 -0
- package/ui/lib/export-agent.js +335 -0
- package/ui/lib/facet-icons.d.ts +20 -0
- package/ui/lib/facet-icons.js +21 -0
- package/ui/lib/panel-motion.d.ts +8 -0
- package/ui/lib/panel-motion.js +74 -0
- package/ui/lib/project-address.d.ts +14 -0
- package/ui/lib/project-address.js +24 -0
- package/ui/lib/project-starting.d.ts +13 -0
- package/ui/lib/project-starting.js +30 -0
- package/ui/lib/project-traces.d.ts +17 -0
- package/ui/lib/project-traces.js +54 -0
- package/ui/lib/read-map.d.ts +30 -0
- package/ui/lib/read-map.js +173 -0
- package/ui/lib/read-progress.d.ts +14 -0
- package/ui/lib/read-progress.js +12 -0
- package/ui/lib/refusal-lines.d.ts +3 -0
- package/ui/lib/refusal-lines.js +8 -0
- package/ui/lib/studio-activity.d.ts +5 -0
- package/ui/lib/studio-activity.js +17 -0
- package/ui/lib/studio-console.d.ts +27 -0
- package/ui/lib/studio-console.js +9 -0
- package/ui/lib/studio-conversation.d.ts +20 -0
- package/ui/lib/studio-conversation.js +130 -0
- package/ui/lib/studio-examples.d.ts +31 -0
- package/ui/lib/studio-examples.js +25 -0
- package/ui/lib/studio-labels.d.ts +6 -0
- package/ui/lib/studio-labels.js +13 -0
- package/ui/lib/studio-map-kept.d.ts +17 -0
- package/ui/lib/studio-map-kept.js +48 -0
- package/ui/lib/studio-open.d.ts +22 -0
- package/ui/lib/studio-open.js +54 -0
- package/ui/lib/studio-page.d.ts +33 -0
- package/ui/lib/studio-page.js +121 -0
- package/ui/lib/studio-prefs.d.ts +26 -0
- package/ui/lib/studio-prefs.js +87 -0
- package/ui/lib/studio-project.d.ts +106 -0
- package/ui/lib/studio-project.js +177 -0
- package/ui/lib/studio-restore.d.ts +49 -0
- package/ui/lib/studio-restore.js +251 -0
- package/ui/lib/studio-run-open.d.ts +15 -0
- package/ui/lib/studio-run-open.js +16 -0
- package/ui/lib/studio-session.d.ts +34 -0
- package/ui/lib/studio-session.js +17 -0
- package/ui/lib/studio-settings.d.ts +15 -0
- package/ui/lib/studio-settings.js +48 -0
- package/ui/lib/studio-store.d.ts +64 -0
- package/ui/lib/studio-store.js +391 -0
- package/ui/lib/studio-watch.d.ts +12 -0
- package/ui/lib/studio-watch.js +27 -0
- package/ui/lib/tab-fills.d.ts +6 -0
- package/ui/lib/tab-fills.js +14 -0
- package/ui/lib/tool-credentials.d.ts +3 -0
- package/ui/lib/tool-credentials.js +23 -0
- package/ui/lib/tool-probe.d.ts +19 -0
- package/ui/lib/tool-probe.js +104 -0
- package/ui/lib/type-icons.d.ts +35 -0
- package/ui/lib/type-icons.js +38 -0
- package/ui/lib/when-idle.d.ts +5 -0
- package/ui/lib/when-idle.js +14 -0
- package/ui/lib/zip.d.ts +5 -0
- package/ui/lib/zip.js +8 -0
- package/ui/map-token.css +11 -0
- package/ui/map-token.d.ts +17 -0
- package/ui/map-token.js +29 -0
- package/ui/mcp-icon.d.ts +6 -0
- package/ui/mcp-icon.js +8 -0
- package/ui/motion.css +113 -0
- package/ui/pan.d.ts +32 -0
- package/ui/pan.js +90 -0
- package/ui/profile-editor.d.ts +33 -0
- package/ui/profile-editor.js +2638 -0
- package/ui/provider-editor.d.ts +15 -0
- package/ui/provider-editor.js +92 -0
- package/ui/read-map.css +48 -0
- package/ui/read-map.d.ts +7 -0
- package/ui/read-map.js +163 -0
- package/ui/refusal-detail.d.ts +4 -0
- package/ui/refusal-detail.js +21 -0
- package/ui/shared-change.d.ts +9 -0
- package/ui/shared-change.js +28 -0
- package/ui/shell-motion.css +121 -0
- package/ui/shell-motion.d.ts +73 -0
- package/ui/shell-motion.js +194 -0
- package/ui/studio-code-pane.d.ts +19 -0
- package/ui/studio-code-pane.js +44 -0
- package/ui/studio-compare.d.ts +80 -0
- package/ui/studio-compare.js +326 -0
- package/ui/studio-conflicts.d.ts +17 -0
- package/ui/studio-conflicts.js +87 -0
- package/ui/studio-connection.d.ts +64 -0
- package/ui/studio-connection.js +286 -0
- package/ui/studio-decision.d.ts +6 -0
- package/ui/studio-decision.js +49 -0
- package/ui/studio-embedding.d.ts +6 -0
- package/ui/studio-embedding.js +30 -0
- package/ui/studio-host-console.d.ts +6 -0
- package/ui/studio-host-console.js +17 -0
- package/ui/studio-host.d.ts +73 -0
- package/ui/studio-host.js +12 -0
- package/ui/studio-live.d.ts +17 -0
- package/ui/studio-live.js +26 -0
- package/ui/studio-map.css +273 -0
- package/ui/studio-map.d.ts +17 -0
- package/ui/studio-map.js +397 -0
- package/ui/studio-nav.d.ts +24 -0
- package/ui/studio-nav.js +17 -0
- package/ui/studio-no-project.d.ts +5 -0
- package/ui/studio-no-project.js +9 -0
- package/ui/studio-run.css +76 -0
- package/ui/studio-run.d.ts +14 -0
- package/ui/studio-run.js +119 -0
- package/ui/studio-runner.d.ts +45 -0
- package/ui/studio-runner.js +187 -0
- package/ui/studio-save.d.ts +49 -0
- package/ui/studio-save.js +307 -0
- package/ui/studio-screen.d.ts +61 -0
- package/ui/studio-screen.js +2078 -0
- package/ui/studio-settings.d.ts +31 -0
- package/ui/studio-settings.js +288 -0
- package/ui/studio-shell.css +27 -0
- package/ui/studio-shell.d.ts +43 -0
- package/ui/studio-shell.js +87 -0
- package/ui/studio-theme.d.ts +7 -0
- package/ui/studio-theme.js +94 -0
- package/ui/studio.css +427 -0
- package/ui/theorem-mark.css +84 -0
- package/ui/theorem-mark.d.ts +22 -0
- package/ui/theorem-mark.js +21 -0
- package/vite.d.mts +30 -0
- package/vite.mjs +277 -0
- package/workspace.d.ts +230 -0
- package/workspace.js +1054 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TraceFeed } from '@theoremjs/react/client';
|
|
2
|
+
import type { StudioRunPayload } from '../../mod.ts';
|
|
3
|
+
import { type StudioActingAs } from '../../people.ts';
|
|
4
|
+
/** Whether the agent records traces, so the page can offer them: the rule every view reads. */
|
|
5
|
+
export declare function recordsTraces(payload: StudioRunPayload | null): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* A transport to one of a project's profiles whose runs' traces land on `traces`, where the
|
|
8
|
+
* trace panel reads them: the same panel a draft's run fills in the playground. Each run carries
|
|
9
|
+
* who it acts as, so the project's tools act for that person.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tracedTransport<T extends object>(make: (options: {
|
|
12
|
+
endpoint: string;
|
|
13
|
+
fetch: typeof fetch;
|
|
14
|
+
headers: Record<string, string>;
|
|
15
|
+
}) => T, endpoint: string, traces: TraceFeed, actingAs: StudioActingAs | undefined): T & {
|
|
16
|
+
traces: TraceFeed;
|
|
17
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { resolveObservabilityPolicy } from '@theoremjs/agents';
|
|
2
|
+
import { actingAsHeaders } from "../../people.js";
|
|
3
|
+
import { eachLine, NDJSON } from "../../stream-lines.js";
|
|
4
|
+
import { studioTraceLine } from "../../transport.js";
|
|
5
|
+
/** Whether the agent records traces, so the page can offer them: the rule every view reads. */
|
|
6
|
+
export function recordsTraces(payload) {
|
|
7
|
+
return payload !== null && resolveObservabilityPolicy(payload.profile.observability).record;
|
|
8
|
+
}
|
|
9
|
+
/** The trace record a line of a run's stream carries, or nothing when it is one of the run's events. */
|
|
10
|
+
function traceOf(line) {
|
|
11
|
+
if (!line.includes('"trace"'))
|
|
12
|
+
return undefined;
|
|
13
|
+
try {
|
|
14
|
+
const read = studioTraceLine.safeParse(JSON.parse(line));
|
|
15
|
+
return read.success ? read.data.record : undefined;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Takes the trace lines off a run's stream and puts their records on the feed. */
|
|
22
|
+
function withoutTraces(traces) {
|
|
23
|
+
return eachLine((line, send) => {
|
|
24
|
+
const record = traceOf(line);
|
|
25
|
+
if (record)
|
|
26
|
+
traces.push(record);
|
|
27
|
+
else
|
|
28
|
+
send(line);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** `fetch` for a project's runs: the studio's local server sends each run's trace behind its events. */
|
|
32
|
+
function tracedFetch(traces) {
|
|
33
|
+
return async (input, init) => {
|
|
34
|
+
const response = await fetch(input, init);
|
|
35
|
+
if (!response.body || !response.headers.get('content-type')?.startsWith(NDJSON))
|
|
36
|
+
return response;
|
|
37
|
+
return new Response(response.body.pipeThrough(withoutTraces(traces)), {
|
|
38
|
+
status: response.status,
|
|
39
|
+
statusText: response.statusText,
|
|
40
|
+
headers: response.headers,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A transport to one of a project's profiles whose runs' traces land on `traces`, where the
|
|
46
|
+
* trace panel reads them: the same panel a draft's run fills in the playground. Each run carries
|
|
47
|
+
* who it acts as, so the project's tools act for that person.
|
|
48
|
+
*/
|
|
49
|
+
export function tracedTransport(make, endpoint, traces, actingAs) {
|
|
50
|
+
return {
|
|
51
|
+
...make({ endpoint, fetch: tracedFetch(traces), headers: actingAsHeaders(actingAs) }),
|
|
52
|
+
traces,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The map the loader draws while the studio command reads a project: the setup file on the left,
|
|
3
|
+
* the folders its imports reach as branches, and the agents and tools found in them on the right.
|
|
4
|
+
* Laid out from the steps the command has said so far, to fit a number of rows.
|
|
5
|
+
*/
|
|
6
|
+
import type { ReadStep } from '../../read-steps.ts';
|
|
7
|
+
export type ReadNodeKind = 'entry' | 'folder' | 'profile' | 'tool' | 'more';
|
|
8
|
+
export interface ReadNode {
|
|
9
|
+
id: string;
|
|
10
|
+
kind: ReadNodeKind;
|
|
11
|
+
label: string;
|
|
12
|
+
/** The column, the setup file's being 0. */
|
|
13
|
+
col: number;
|
|
14
|
+
/** The row, which may fall between two when the node sits beside several. */
|
|
15
|
+
row: number;
|
|
16
|
+
parent?: string;
|
|
17
|
+
/** The step that first reaches the node: it is drawn once that step is. */
|
|
18
|
+
first: number;
|
|
19
|
+
/** The steps that read a file of the node's own, in order. Each is a dot on the line into it. */
|
|
20
|
+
own: number[];
|
|
21
|
+
/** The type an agent or a tool was written with. */
|
|
22
|
+
type?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ReadMap {
|
|
25
|
+
nodes: ReadNode[];
|
|
26
|
+
cols: number;
|
|
27
|
+
rows: number;
|
|
28
|
+
}
|
|
29
|
+
/** The map of `steps`, in at most `rows` rows when the project allows it. */
|
|
30
|
+
export declare function readMap(steps: readonly ReadStep[], rows: number): ReadMap;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/** How deep folders are told apart before the rows run out. */
|
|
2
|
+
const DEPTH = 3;
|
|
3
|
+
function folder(path, parent) {
|
|
4
|
+
return { path, parent, folders: new Map(), own: [], found: [], folded: 0 };
|
|
5
|
+
}
|
|
6
|
+
function dirOf(file) {
|
|
7
|
+
const parts = file.split(/[\\/]/);
|
|
8
|
+
parts.pop();
|
|
9
|
+
return parts;
|
|
10
|
+
}
|
|
11
|
+
/** The folders the files are in, no deeper than `depth`, each holding the steps that read its files. */
|
|
12
|
+
function foldersOf(steps, depth) {
|
|
13
|
+
const root = folder('');
|
|
14
|
+
const at = (file) => {
|
|
15
|
+
let here = root;
|
|
16
|
+
for (const part of dirOf(file).slice(0, depth)) {
|
|
17
|
+
let next = here.folders.get(part);
|
|
18
|
+
if (!next) {
|
|
19
|
+
next = folder(here.path ? `${here.path}/${part}` : part, here);
|
|
20
|
+
here.folders.set(part, next);
|
|
21
|
+
}
|
|
22
|
+
here = next;
|
|
23
|
+
}
|
|
24
|
+
return here;
|
|
25
|
+
};
|
|
26
|
+
steps.forEach((step, index) => {
|
|
27
|
+
if ('file' in step && !('found' in step))
|
|
28
|
+
at(step.file).own.push(index);
|
|
29
|
+
else if ('found' in step)
|
|
30
|
+
at(step.file).found.push({
|
|
31
|
+
kind: step.found,
|
|
32
|
+
name: step.name,
|
|
33
|
+
step: index,
|
|
34
|
+
...(step.type === undefined ? {} : { type: step.type }),
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return root;
|
|
38
|
+
}
|
|
39
|
+
/** A folder that only holds one other is drawn as that one, named by the whole path. */
|
|
40
|
+
function shortened(here) {
|
|
41
|
+
for (const [name, child] of here.folders)
|
|
42
|
+
here.folders.set(name, shortened(child));
|
|
43
|
+
const [only] = here.folders.values();
|
|
44
|
+
if (here.parent && here.folders.size === 1 && only && !here.own.length && !here.found.length) {
|
|
45
|
+
only.parent = here.parent;
|
|
46
|
+
return only;
|
|
47
|
+
}
|
|
48
|
+
for (const child of here.folders.values())
|
|
49
|
+
child.parent = here;
|
|
50
|
+
return here;
|
|
51
|
+
}
|
|
52
|
+
function ends(here) {
|
|
53
|
+
if (!here.folders.size)
|
|
54
|
+
return [here];
|
|
55
|
+
return [...here.folders.values()].flatMap(ends);
|
|
56
|
+
}
|
|
57
|
+
function firstOf(here) {
|
|
58
|
+
const firsts = [...here.own.slice(0, 1), ...here.found.map((found) => found.step)];
|
|
59
|
+
for (const child of here.folders.values())
|
|
60
|
+
firsts.push(firstOf(child));
|
|
61
|
+
return Math.min(...firsts);
|
|
62
|
+
}
|
|
63
|
+
/** Keeps the first folders that fit under the top and folds the rest into the last one kept. */
|
|
64
|
+
function folded(root, rows) {
|
|
65
|
+
const kept = [...root.folders.entries()];
|
|
66
|
+
if (kept.length <= rows)
|
|
67
|
+
return;
|
|
68
|
+
const [, last] = kept[rows - 1] ?? [];
|
|
69
|
+
if (!last)
|
|
70
|
+
return;
|
|
71
|
+
for (const [name, extra] of kept.slice(rows)) {
|
|
72
|
+
root.folders.delete(name);
|
|
73
|
+
last.folded += 1;
|
|
74
|
+
const take = (from) => {
|
|
75
|
+
last.own.push(...from.own);
|
|
76
|
+
last.found.push(...from.found);
|
|
77
|
+
for (const child of from.folders.values())
|
|
78
|
+
take(child);
|
|
79
|
+
};
|
|
80
|
+
take(extra);
|
|
81
|
+
}
|
|
82
|
+
last.own.sort((a, b) => a - b);
|
|
83
|
+
}
|
|
84
|
+
/** The folders as deep as the rows allow. */
|
|
85
|
+
function fitted(steps, rows) {
|
|
86
|
+
for (let depth = DEPTH; depth > 1; depth -= 1) {
|
|
87
|
+
const root = shortened(foldersOf(steps, depth));
|
|
88
|
+
if (ends(root).length <= rows)
|
|
89
|
+
return root;
|
|
90
|
+
}
|
|
91
|
+
const root = shortened(foldersOf(steps, 1));
|
|
92
|
+
folded(root, rows);
|
|
93
|
+
return root;
|
|
94
|
+
}
|
|
95
|
+
function depthOf(here) {
|
|
96
|
+
return Math.max(0, ...[...here.folders.values()].map((child) => 1 + depthOf(child)));
|
|
97
|
+
}
|
|
98
|
+
/** The map of `steps`, in at most `rows` rows when the project allows it. */
|
|
99
|
+
export function readMap(steps, rows) {
|
|
100
|
+
const room = Math.max(1, rows);
|
|
101
|
+
const root = fitted(steps, room);
|
|
102
|
+
const all = [];
|
|
103
|
+
const collect = (here) => {
|
|
104
|
+
all.push(here);
|
|
105
|
+
for (const child of here.folders.values())
|
|
106
|
+
collect(child);
|
|
107
|
+
};
|
|
108
|
+
collect(root);
|
|
109
|
+
// Each folder that ends a branch takes a row, with or without anything found in it.
|
|
110
|
+
const holding = all.filter((each) => each.found.length);
|
|
111
|
+
const bare = ends(root).filter((each) => !each.found.length && each !== root).length;
|
|
112
|
+
const each = Math.max(1, Math.floor((room - bare) / Math.max(1, holding.length)));
|
|
113
|
+
const foundCol = depthOf(root) + 1;
|
|
114
|
+
const nodes = [];
|
|
115
|
+
let row = 0;
|
|
116
|
+
const place = (here, col, parent) => {
|
|
117
|
+
const id = here === root ? 'entry' : `folder:${here.path}`;
|
|
118
|
+
const from = row;
|
|
119
|
+
for (const child of here.folders.values())
|
|
120
|
+
place(child, col + 1, id);
|
|
121
|
+
const shown = here.found.length > each ? here.found.slice(0, each - 1) : here.found;
|
|
122
|
+
for (const found of shown) {
|
|
123
|
+
nodes.push({
|
|
124
|
+
id: `${found.kind}:${found.name}`,
|
|
125
|
+
kind: found.kind,
|
|
126
|
+
label: found.name,
|
|
127
|
+
col: foundCol,
|
|
128
|
+
row,
|
|
129
|
+
parent: id,
|
|
130
|
+
first: found.step,
|
|
131
|
+
own: [],
|
|
132
|
+
...(found.type === undefined ? {} : { type: found.type }),
|
|
133
|
+
});
|
|
134
|
+
row += 1;
|
|
135
|
+
}
|
|
136
|
+
const rest = here.found.slice(shown.length);
|
|
137
|
+
if (rest.length) {
|
|
138
|
+
const label = `${String(rest.length)} ${shown.length ? 'more' : 'agents and tools'}`;
|
|
139
|
+
nodes.push({
|
|
140
|
+
id: `more:${here.path}`,
|
|
141
|
+
kind: 'more',
|
|
142
|
+
label,
|
|
143
|
+
col: foundCol,
|
|
144
|
+
row,
|
|
145
|
+
parent: id,
|
|
146
|
+
first: rest[0]?.step ?? 0,
|
|
147
|
+
own: [],
|
|
148
|
+
});
|
|
149
|
+
row += 1;
|
|
150
|
+
}
|
|
151
|
+
if (row === from)
|
|
152
|
+
row += 1;
|
|
153
|
+
const span = [from, row - 1];
|
|
154
|
+
const name = here.path.slice(here.parent && here.parent !== root ? here.parent.path.length + 1 : 0);
|
|
155
|
+
nodes.push({
|
|
156
|
+
id,
|
|
157
|
+
kind: here === root ? 'entry' : 'folder',
|
|
158
|
+
label: here.folded ? `${name} and ${String(here.folded)} more` : name,
|
|
159
|
+
col,
|
|
160
|
+
row: (span[0] + span[1]) / 2,
|
|
161
|
+
...(parent === undefined ? {} : { parent }),
|
|
162
|
+
first: here === root ? 0 : firstOf(here),
|
|
163
|
+
own: here.own,
|
|
164
|
+
});
|
|
165
|
+
return span;
|
|
166
|
+
};
|
|
167
|
+
place(root, 0);
|
|
168
|
+
const entry = steps.find((step) => 'file' in step && !('found' in step));
|
|
169
|
+
const top = nodes.find((node) => node.id === 'entry');
|
|
170
|
+
if (top)
|
|
171
|
+
top.label = entry?.file.split(/[\\/]/).pop() ?? '';
|
|
172
|
+
return { nodes, cols: foundCol + 1, rows: row };
|
|
173
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the studio command has said of its read of the project so far, kept for the loader to draw.
|
|
3
|
+
* The loader draws on its own clock, so it looks here each frame instead of being told.
|
|
4
|
+
*/
|
|
5
|
+
import type { ReadStep } from '../../read-steps.ts';
|
|
6
|
+
export interface Reading {
|
|
7
|
+
/** Every step said so far, in order. The same list each time, longer. */
|
|
8
|
+
steps(): readonly ReadStep[];
|
|
9
|
+
/** Whether the project has arrived, so no step follows. */
|
|
10
|
+
done(): boolean;
|
|
11
|
+
say(step: ReadStep): void;
|
|
12
|
+
finish(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function createReading(): Reading;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A refusal's detail as lines the builder reads: what did not load as edited, or what the project said. */
|
|
2
|
+
export function refusalLines(refusal) {
|
|
3
|
+
if (refusal.detail.length === 0)
|
|
4
|
+
return [];
|
|
5
|
+
if (refusal.reason === 'differs')
|
|
6
|
+
return [`Not loading as edited: ${refusal.detail.join(', ')}.`];
|
|
7
|
+
return refusal.detail.flatMap((each) => each.split('\n')).filter((line) => line.trim() !== '');
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `transport`, calling `note` before each request it sends. `describe` only reads the profile,
|
|
3
|
+
* so it doesn't count.
|
|
4
|
+
*/
|
|
5
|
+
export function noting(transport, note) {
|
|
6
|
+
return new Proxy(transport, {
|
|
7
|
+
get(target, key) {
|
|
8
|
+
const value = Reflect.get(target, key);
|
|
9
|
+
if (typeof value !== 'function' || key === 'describe')
|
|
10
|
+
return value;
|
|
11
|
+
return (...args) => {
|
|
12
|
+
note();
|
|
13
|
+
return Reflect.apply(value, target, args);
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TraceFeed } from '@theoremjs/react/client';
|
|
2
|
+
import type { StudioBrowserRuntime } from '../../browser.ts';
|
|
3
|
+
import type { StudioRunPayload } from '../../mod.ts';
|
|
4
|
+
/** What the builder preview and the standalone run tab hand a one-call console. */
|
|
5
|
+
export interface StudioConsoleProps {
|
|
6
|
+
payload: StudioRunPayload;
|
|
7
|
+
className?: string;
|
|
8
|
+
runtime?: StudioBrowserRuntime | null;
|
|
9
|
+
/** The conversation's trace feed, kept across recompiles. */
|
|
10
|
+
traces?: TraceFeed;
|
|
11
|
+
/** Called before each call; stable, or the transport is rebuilt each render. */
|
|
12
|
+
onActivity?: () => void;
|
|
13
|
+
/** The page's own trace control. */
|
|
14
|
+
trace?: boolean;
|
|
15
|
+
/** The page is already the shell. The console sits in it. */
|
|
16
|
+
flush?: boolean;
|
|
17
|
+
/** The request on the left and the result on the right. */
|
|
18
|
+
columns?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** How a console is laid out, whatever its transport. */
|
|
21
|
+
export type ConsoleViewProps = Pick<StudioConsoleProps, 'payload' | 'className' | 'trace' | 'flush' | 'columns'>;
|
|
22
|
+
/** A console's transport: in the browser's runtime when there is one, else through the studio's server. */
|
|
23
|
+
export declare function useStudioTransport<T extends object>({ payload, runtime, traces, onActivity }: StudioConsoleProps, onServer: (payload: StudioRunPayload, options: {
|
|
24
|
+
traces?: TraceFeed;
|
|
25
|
+
}) => T, inBrowser: (payload: StudioRunPayload, runtime: StudioBrowserRuntime, options: {
|
|
26
|
+
traces?: TraceFeed;
|
|
27
|
+
}) => T): T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { noting } from "./studio-activity.js";
|
|
3
|
+
/** A console's transport: in the browser's runtime when there is one, else through the studio's server. */
|
|
4
|
+
export function useStudioTransport({ payload, runtime = null, traces, onActivity }, onServer, inBrowser) {
|
|
5
|
+
return useMemo(() => {
|
|
6
|
+
const made = runtime ? inBrowser(payload, runtime, { traces }) : onServer(payload, { traces });
|
|
7
|
+
return onActivity ? noting(made, onActivity) : made;
|
|
8
|
+
}, [payload, runtime, traces, onActivity, onServer, inBrowser]);
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Who sealed a kept ref, so it is offered only to a run that can open it. */
|
|
2
|
+
export type ChatSealer = 'page' | 'demo';
|
|
3
|
+
/**
|
|
4
|
+
* The key this tab's page runs seal their conversations with. It is kept in the tab beside the
|
|
5
|
+
* refs it opens, so both go when the tab does. A new key forgets the refs the last one sealed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function pageConversationKey(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Keeps an agent's conversation ref. The ref holds the whole conversation, its media too: one too
|
|
10
|
+
* big for the tab's storage is not kept, and the agent's last kept ref is forgotten with it.
|
|
11
|
+
* Never throws.
|
|
12
|
+
*/
|
|
13
|
+
export declare function saveConversation(agentKey: string, sealer: ChatSealer, ref: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* An agent's kept ref, when `sealer` sealed it. Anything else kept under the agent (a
|
|
16
|
+
* conversation kept before refs) is forgotten, so it holds no room.
|
|
17
|
+
*/
|
|
18
|
+
export declare function restoreConversation(agentKey: string, sealer: ChatSealer): string | undefined;
|
|
19
|
+
/** Forgets one agent's conversation, or every agent's. */
|
|
20
|
+
export declare function clearConversation(agentKey?: string): void;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each agent's preview conversation, kept in this tab's sessionStorage beside the workspace so a
|
|
3
|
+
* reload resumes it. What is kept is the conversation's ref: the conversation sealed with a key,
|
|
4
|
+
* which opens only where that key is. A run in the page seals with the tab's own key; the hosted
|
|
5
|
+
* demo seals on its server.
|
|
6
|
+
*/
|
|
7
|
+
import { newConversationKey } from "../../conversation-key.js";
|
|
8
|
+
import { CHAT_PREFIX, isRecord, session } from "./studio-session.js";
|
|
9
|
+
/** The tab's key for the conversations its page runs seal. */
|
|
10
|
+
const PAGE_KEY = 'theorem.studio.chat-key';
|
|
11
|
+
/** The key, while the tab keeps none: it lasts as long as the page. */
|
|
12
|
+
let pageKeyHeld;
|
|
13
|
+
/**
|
|
14
|
+
* The key this tab's page runs seal their conversations with. It is kept in the tab beside the
|
|
15
|
+
* refs it opens, so both go when the tab does. A new key forgets the refs the last one sealed.
|
|
16
|
+
*/
|
|
17
|
+
export function pageConversationKey() {
|
|
18
|
+
const store = session();
|
|
19
|
+
try {
|
|
20
|
+
const kept = store?.getItem(PAGE_KEY);
|
|
21
|
+
if (kept)
|
|
22
|
+
return kept;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Storage refused the read: the page holds its own key.
|
|
26
|
+
}
|
|
27
|
+
if (pageKeyHeld)
|
|
28
|
+
return pageKeyHeld;
|
|
29
|
+
const key = newConversationKey();
|
|
30
|
+
pageKeyHeld = key;
|
|
31
|
+
forgetSealedBy('page');
|
|
32
|
+
try {
|
|
33
|
+
store?.setItem(PAGE_KEY, key);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Over quota or blocked: the key lasts as long as the page, and so do its chats.
|
|
37
|
+
}
|
|
38
|
+
return key;
|
|
39
|
+
}
|
|
40
|
+
/** A kept ref, when `raw` is one. */
|
|
41
|
+
function keptRef(raw) {
|
|
42
|
+
try {
|
|
43
|
+
const value = JSON.parse(raw);
|
|
44
|
+
if (!isRecord(value) || typeof value.ref !== 'string')
|
|
45
|
+
return undefined;
|
|
46
|
+
const { sealer } = value;
|
|
47
|
+
return sealer === 'page' || sealer === 'demo' ? { sealer, ref: value.ref } : undefined;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Forgets every ref `sealer` sealed: none of them opens any more. */
|
|
54
|
+
function forgetSealedBy(sealer) {
|
|
55
|
+
try {
|
|
56
|
+
const store = session();
|
|
57
|
+
if (!store)
|
|
58
|
+
return;
|
|
59
|
+
for (const key of Object.keys(store)) {
|
|
60
|
+
if (!key.startsWith(CHAT_PREFIX))
|
|
61
|
+
continue;
|
|
62
|
+
const raw = store.getItem(key);
|
|
63
|
+
if (raw && keptRef(raw)?.sealer === sealer)
|
|
64
|
+
store.removeItem(key);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Nothing to forget.
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Keeps an agent's conversation ref. The ref holds the whole conversation, its media too: one too
|
|
73
|
+
* big for the tab's storage is not kept, and the agent's last kept ref is forgotten with it.
|
|
74
|
+
* Never throws.
|
|
75
|
+
*/
|
|
76
|
+
export function saveConversation(agentKey, sealer, ref) {
|
|
77
|
+
const store = session();
|
|
78
|
+
if (!store)
|
|
79
|
+
return;
|
|
80
|
+
const key = `${CHAT_PREFIX}${agentKey}`;
|
|
81
|
+
try {
|
|
82
|
+
store.setItem(key, JSON.stringify({ sealer, ref }));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// Over quota: an older ref is a conversation that already moved on, so none is kept.
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
store.removeItem(key);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// Nothing more to do.
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* An agent's kept ref, when `sealer` sealed it. Anything else kept under the agent (a
|
|
97
|
+
* conversation kept before refs) is forgotten, so it holds no room.
|
|
98
|
+
*/
|
|
99
|
+
export function restoreConversation(agentKey, sealer) {
|
|
100
|
+
try {
|
|
101
|
+
const store = session();
|
|
102
|
+
const key = `${CHAT_PREFIX}${agentKey}`;
|
|
103
|
+
const raw = store?.getItem(key);
|
|
104
|
+
if (!raw)
|
|
105
|
+
return undefined;
|
|
106
|
+
const kept = keptRef(raw);
|
|
107
|
+
if (!kept)
|
|
108
|
+
store?.removeItem(key);
|
|
109
|
+
return kept?.sealer === sealer ? kept.ref : undefined;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** Forgets one agent's conversation, or every agent's. */
|
|
116
|
+
export function clearConversation(agentKey) {
|
|
117
|
+
try {
|
|
118
|
+
const store = session();
|
|
119
|
+
if (!store)
|
|
120
|
+
return;
|
|
121
|
+
for (const key of Object.keys(store)) {
|
|
122
|
+
if (agentKey === undefined ? key.startsWith(CHAT_PREFIX) : key === `${CHAT_PREFIX}${agentKey}`) {
|
|
123
|
+
store.removeItem(key);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Nothing to clear.
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The ready agents "Load an example" offers. */
|
|
2
|
+
export declare const STUDIO_EXAMPLES: {
|
|
3
|
+
readonly concierge: {
|
|
4
|
+
readonly label: "Travel concierge";
|
|
5
|
+
readonly description: "Text agent with weather, places, currency, and trip tools.";
|
|
6
|
+
};
|
|
7
|
+
readonly 'live-concierge': {
|
|
8
|
+
readonly label: "Live concierge";
|
|
9
|
+
readonly description: "The concierge as a voice call, with the same tools.";
|
|
10
|
+
};
|
|
11
|
+
readonly architect: {
|
|
12
|
+
readonly label: "Code architect";
|
|
13
|
+
readonly description: "Reads repos and docs. Brings a Narrator it calls for audio.";
|
|
14
|
+
};
|
|
15
|
+
readonly narrator: {
|
|
16
|
+
readonly label: "Narrator";
|
|
17
|
+
readonly description: "Reads a script aloud.";
|
|
18
|
+
};
|
|
19
|
+
readonly console: {
|
|
20
|
+
readonly label: "Tool console";
|
|
21
|
+
readonly description: "No model. Run its tools by hand.";
|
|
22
|
+
};
|
|
23
|
+
readonly decision: {
|
|
24
|
+
readonly label: "Jev decision";
|
|
25
|
+
readonly description: "Asks Jev about a pantry photo: finds things in it and answers questions.";
|
|
26
|
+
};
|
|
27
|
+
readonly 'gemini-embedding-2': {
|
|
28
|
+
readonly label: "Gemini Embeddings 2";
|
|
29
|
+
readonly description: "Multimodal embedding preview with Gemini Embeddings 2.";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The ready agents "Load an example" offers. */
|
|
2
|
+
export const STUDIO_EXAMPLES = {
|
|
3
|
+
concierge: {
|
|
4
|
+
label: 'Travel concierge',
|
|
5
|
+
description: 'Text agent with weather, places, currency, and trip tools.',
|
|
6
|
+
},
|
|
7
|
+
'live-concierge': {
|
|
8
|
+
label: 'Live concierge',
|
|
9
|
+
description: 'The concierge as a voice call, with the same tools.',
|
|
10
|
+
},
|
|
11
|
+
architect: {
|
|
12
|
+
label: 'Code architect',
|
|
13
|
+
description: 'Reads repos and docs. Brings a Narrator it calls for audio.',
|
|
14
|
+
},
|
|
15
|
+
narrator: { label: 'Narrator', description: 'Reads a script aloud.' },
|
|
16
|
+
console: { label: 'Tool console', description: 'No model. Run its tools by hand.' },
|
|
17
|
+
decision: {
|
|
18
|
+
label: 'Jev decision',
|
|
19
|
+
description: 'Asks Jev about a pantry photo: finds things in it and answers questions.',
|
|
20
|
+
},
|
|
21
|
+
'gemini-embedding-2': {
|
|
22
|
+
label: 'Gemini Embeddings 2',
|
|
23
|
+
description: 'Multimodal embedding preview with Gemini Embeddings 2.',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TheoremLabels } from '@theoremjs/react/ui';
|
|
2
|
+
/**
|
|
3
|
+
* The studio's own lines: a credential typed at a sign-in gate serves one call and is never
|
|
4
|
+
* saved, and a message's delivery status reads in lower case like the rest.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STUDIO_LABELS: TheoremLabels;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The studio's own lines: a credential typed at a sign-in gate serves one call and is never
|
|
3
|
+
* saved, and a message's delivery status reads in lower case like the rest.
|
|
4
|
+
*/
|
|
5
|
+
export const STUDIO_LABELS = {
|
|
6
|
+
en: {
|
|
7
|
+
'@theorem.gate.auth.secret_note': "Used for this call only. theorem doesn't store it.",
|
|
8
|
+
'@astryx.chat.status.sending': 'sending',
|
|
9
|
+
'@astryx.chat.status.sent': 'sent',
|
|
10
|
+
'@astryx.chat.status.delivered': 'delivered',
|
|
11
|
+
'@astryx.chat.status.read': 'read',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How someone left the map, kept in this tab's sessionStorage beside the workspace, a project's
|
|
3
|
+
* under its own name: where they dragged its nodes, with and without detail, whether it shows
|
|
4
|
+
* detail, and the node whose family alone it shows.
|
|
5
|
+
*/
|
|
6
|
+
import type { MapPlace } from '../../mod.ts';
|
|
7
|
+
export type MapPlaces = Readonly<Record<string, MapPlace>>;
|
|
8
|
+
export interface KeptMap {
|
|
9
|
+
tokens: MapPlaces;
|
|
10
|
+
detail: MapPlaces;
|
|
11
|
+
expanded: boolean;
|
|
12
|
+
family?: string;
|
|
13
|
+
}
|
|
14
|
+
/** What was kept; the map as it first opens when nothing was or it cannot be read. */
|
|
15
|
+
export declare function readKeptMap(project: string | undefined): KeptMap;
|
|
16
|
+
/** Keeps `kept`, or forgets it when it is the map as it first opens. Storage that is full or blocked keeps nothing. */
|
|
17
|
+
export declare function writeKeptMap(project: string | undefined, kept: KeptMap): void;
|