@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,248 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Banner } from '@astryxdesign/core/Banner';
|
|
3
|
+
import { Button } from '@astryxdesign/core/Button';
|
|
4
|
+
import { Collapsible, CollapsibleGroup } from '@astryxdesign/core/Collapsible';
|
|
5
|
+
import { HoverCard } from '@astryxdesign/core/HoverCard';
|
|
6
|
+
import { HStack } from '@astryxdesign/core/HStack';
|
|
7
|
+
import { Icon } from '@astryxdesign/core/Icon';
|
|
8
|
+
import { IconButton } from '@astryxdesign/core/IconButton';
|
|
9
|
+
import { Item } from '@astryxdesign/core/Item';
|
|
10
|
+
import { ScrollableArea } from '@astryxdesign/core/ScrollableArea';
|
|
11
|
+
import { StackItem } from '@astryxdesign/core/Stack';
|
|
12
|
+
import { Text } from '@astryxdesign/core/Text';
|
|
13
|
+
import { TextArea } from '@astryxdesign/core/TextArea';
|
|
14
|
+
import { Token } from '@astryxdesign/core/Token';
|
|
15
|
+
import { Tooltip } from '@astryxdesign/core/Tooltip';
|
|
16
|
+
import { VStack } from '@astryxdesign/core/VStack';
|
|
17
|
+
import { IconArrowLeft, IconBiohazard, IconBraces, IconBrain, IconEye, IconEyeOff, IconFileText, IconHandStop, IconHistory, IconInfoCircle, IconListDetails, IconMessage, IconPlaylistAdd, IconShield, IconShieldSearch, IconTool, IconUser, IconWorld, IconX, } from '@tabler/icons-react';
|
|
18
|
+
import { PaneLayout, PanePanel, PaneState, Prose, TraceGuardrailsView } from '@theoremjs/react/ui';
|
|
19
|
+
import { useContext, useState } from 'react';
|
|
20
|
+
import { PROBE_BATTERY, PROBE_BOUNDARY_NOTES, PROBE_STATUSES, probeDraft, probeRefusal, sectionNote, } from "../mod.js";
|
|
21
|
+
import { InspectorSection } from "./inspector.js";
|
|
22
|
+
import { ProbedAgent } from "./inspector-context.js";
|
|
23
|
+
import { screenEndpoint } from "./lib/project-address.js";
|
|
24
|
+
const BOUNDARY_ICONS = {
|
|
25
|
+
user: IconUser,
|
|
26
|
+
history: IconHistory,
|
|
27
|
+
system: IconFileText,
|
|
28
|
+
tool_result_local: IconTool,
|
|
29
|
+
tool_result_remote: IconWorld,
|
|
30
|
+
tool_arguments: IconBraces,
|
|
31
|
+
reply: IconMessage,
|
|
32
|
+
thought: IconBrain,
|
|
33
|
+
};
|
|
34
|
+
/** Sends `text` across the draft's boundaries; given `only`, read with that detector alone. */
|
|
35
|
+
async function sendProbe(payload, text, only) {
|
|
36
|
+
try {
|
|
37
|
+
const response = await fetch(`${screenEndpoint()}/probe`, {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
headers: { 'Content-Type': 'application/json' },
|
|
40
|
+
body: JSON.stringify({ ...probeDraft(payload), text, only }),
|
|
41
|
+
});
|
|
42
|
+
const body = await response.json();
|
|
43
|
+
if (response.ok && 'answers' in body)
|
|
44
|
+
return { answers: body.answers };
|
|
45
|
+
return { error: ('error' in body && body.error) || "The probe didn't run." };
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return { error: "Couldn't reach the studio server." };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** A status as its token: the label, colour, and icon the trace's guardrail checks wear. */
|
|
52
|
+
const STATUS_TOKENS = {
|
|
53
|
+
passed: { label: 'Passed', color: 'green', icon: IconEye },
|
|
54
|
+
flagged: { label: 'Flagged', color: 'blue', icon: IconInfoCircle },
|
|
55
|
+
redacted: { label: 'Redacted', color: 'orange', icon: IconEyeOff },
|
|
56
|
+
blocked: { label: 'Blocked', color: 'red', icon: IconHandStop },
|
|
57
|
+
};
|
|
58
|
+
function StatusToken({ status, count }) {
|
|
59
|
+
const { label, color, icon } = STATUS_TOKENS[status];
|
|
60
|
+
return (_jsx(Token, { label: count === undefined ? label : `${label} ${String(count)}`, color: color, icon: _jsx(Icon, { icon: icon, size: "sm" }) }));
|
|
61
|
+
}
|
|
62
|
+
/** What one boundary's guardrails did, and whether its turn was tainted by what it read. */
|
|
63
|
+
function Verdict({ answer }) {
|
|
64
|
+
return (_jsxs(HStack, { gap: 1, wrap: "wrap", children: [_jsx(StatusToken, { status: answer.status }), answer.taint && (_jsx(Token, { label: answer.taint === 'steered' ? 'Steered' : 'Tainted', color: "yellow", icon: _jsx(Icon, { icon: IconBiohazard, size: "sm" }) }))] }));
|
|
65
|
+
}
|
|
66
|
+
/** A sent text's answers in short: how many boundaries did each thing, strongest first. */
|
|
67
|
+
function Tally({ sent }) {
|
|
68
|
+
const { answers } = sent;
|
|
69
|
+
if (!answers)
|
|
70
|
+
return _jsx(Token, { label: sent.error ?? '', color: "gray" });
|
|
71
|
+
return (_jsx(HStack, { gap: 1, wrap: "wrap", children: PROBE_STATUSES.toReversed().map((status) => {
|
|
72
|
+
const count = answers.filter((answer) => answer.status === status).length;
|
|
73
|
+
return count > 0 && _jsx(StatusToken, { status: status, count: count }, status);
|
|
74
|
+
}) }));
|
|
75
|
+
}
|
|
76
|
+
/** Who reads the text once it is past `boundary`. */
|
|
77
|
+
function passedLabel(boundary) {
|
|
78
|
+
if (boundary === 'reply' || boundary === 'thought')
|
|
79
|
+
return 'The user got';
|
|
80
|
+
return boundary === 'tool_arguments' ? 'The tool got' : 'The model read';
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A boundary on hover, as the editor's field labels show a field: what crosses it, then when the
|
|
84
|
+
* kernel reads it and what the kernel does there.
|
|
85
|
+
*/
|
|
86
|
+
function BoundaryCard({ boundary, children }) {
|
|
87
|
+
const { label, note, when, checks } = PROBE_BOUNDARY_NOTES[boundary];
|
|
88
|
+
return (_jsx(HoverCard, { label: label, content: _jsxs(VStack, { gap: 2, maxWidth: 280, children: [_jsx(Text, { children: note }), _jsx(HStack, { gap: 1, wrap: "wrap", children: _jsx(Token, { label: label, size: "sm" }) }), _jsx(Text, { color: "secondary", children: when }), _jsx(Text, { color: "secondary", children: checks })] }), children: children }));
|
|
89
|
+
}
|
|
90
|
+
/** A rule id as a phrase: `detect.injection` reads "Injection". */
|
|
91
|
+
function ruleName(rule) {
|
|
92
|
+
const name = (rule.split('.').at(-1) ?? rule).replaceAll(/[_-]/g, ' ');
|
|
93
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
94
|
+
}
|
|
95
|
+
/** What exactly the guardrails matched, each hit with the text it matched and what was done with it. */
|
|
96
|
+
function Flagged({ answer }) {
|
|
97
|
+
const hits = answer.guardrails.flatMap((event) => event.hits.map((hit) => ({ hit, action: event.action })));
|
|
98
|
+
if (hits.length === 0)
|
|
99
|
+
return null;
|
|
100
|
+
return (_jsx(PanePanel, { title: "Matched", children: _jsx(VStack, { gap: 3, children: hits.map(({ hit, action }, at) => (_jsxs(VStack, { gap: 1, children: [_jsxs(HStack, { gap: 2, align: "center", wrap: "wrap", children: [_jsx(Text, { weight: "medium", children: hit.label ?? ruleName(hit.rule) }), _jsx(Token, { label: hit.severity, size: "sm", color: "gray" }), _jsx(Token, { label: action, size: "sm", color: "gray" })] }), hit.match !== undefined && (_jsx(Text, { type: "supporting", color: "secondary", children: `“${hit.match}”` }))] }, `${hit.rule}-${String(at)}`))) }) }));
|
|
101
|
+
}
|
|
102
|
+
/** The text past its boundary, when anything went on. */
|
|
103
|
+
function Crossed({ answer }) {
|
|
104
|
+
if (answer.passed === undefined)
|
|
105
|
+
return null;
|
|
106
|
+
return (_jsx(PanePanel, { title: passedLabel(answer.boundary), children: _jsx(Prose, { text: answer.passed }) }));
|
|
107
|
+
}
|
|
108
|
+
/** The way out of a view: back to the tester, or closing it when it opened on its own. */
|
|
109
|
+
function BackButton({ isClose, onBack }) {
|
|
110
|
+
return (_jsx(HStack, { children: _jsx(Button, { label: isClose ? 'Close' : 'Back', variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: isClose ? IconX : IconArrowLeft }), onClick: onBack }) }));
|
|
111
|
+
}
|
|
112
|
+
/** A battery case: what it is and what makes it hard. */
|
|
113
|
+
function BatteryRow({ entry, isDisabled, onSend, }) {
|
|
114
|
+
return (_jsx(Item, { startContent: _jsx(Icon, { icon: BOUNDARY_ICONS[entry.boundary], size: "sm", color: "secondary" }), label: _jsx(Text, { weight: "medium", maxLines: 1, children: entry.title }), description: _jsx(Text, { type: "supporting", color: "secondary", maxLines: 2, children: entry.why }), align: "start", density: "compact", isDisabled: isDisabled, onClick: onSend }));
|
|
115
|
+
}
|
|
116
|
+
/** The examples in the row: one hard text from each kind of boundary. */
|
|
117
|
+
const ROW_EXAMPLES = [
|
|
118
|
+
'user.zero_width',
|
|
119
|
+
'user.split_key',
|
|
120
|
+
'tool_result_remote.approved',
|
|
121
|
+
'tool_arguments.base64_key',
|
|
122
|
+
'reply.image_reference',
|
|
123
|
+
].flatMap((id) => PROBE_BATTERY.filter((entry) => entry.id === id));
|
|
124
|
+
/** The battery as a row of tokens to scroll through, one click to send one; and the ways to all of them. */
|
|
125
|
+
function ExampleRow({ isShown, isDisabled, onShow, onSend, }) {
|
|
126
|
+
return (_jsxs(HStack, { gap: 2, align: "center", children: [_jsx(StackItem, { size: "fill", children: _jsx(ScrollableArea, { label: "Examples", axis: "inline", className: "scrollbar-none", children: _jsx(HStack, { gap: 1, children: ROW_EXAMPLES.map((entry) => (_jsx(Token, { label: entry.title, size: "sm", description: entry.why, isDisabled: isDisabled, onClick: () => {
|
|
127
|
+
onSend([entry.text]);
|
|
128
|
+
} }, entry.id))) }) }) }), _jsx(StackItem, { size: "static", children: _jsxs(HStack, { gap: 1, children: [_jsx(IconButton, { label: isShown ? 'Hide all examples' : 'Show all examples', tooltip: isShown ? 'Hide all examples' : 'Show all examples', variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconListDetails, size: "sm" }), "aria-pressed": isShown, onClick: onShow }), _jsx(IconButton, { label: "Load all examples", tooltip: "Load all examples", variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconPlaylistAdd, size: "sm" }), isDisabled: isDisabled, onClick: () => {
|
|
129
|
+
onSend(PROBE_BATTERY.map((entry) => entry.text));
|
|
130
|
+
} })] }) })] }));
|
|
131
|
+
}
|
|
132
|
+
/** The battery's texts, beside the results or in their place; one click sends one. */
|
|
133
|
+
function Examples({ isClose, isDisabled, onBack, onSend, }) {
|
|
134
|
+
return (_jsx(VStack, { padding: 4, children: _jsxs(VStack, { gap: 4, children: [_jsxs(VStack, { gap: 2, children: [_jsx(BackButton, { isClose: isClose, onBack: onBack }), _jsx(Item, { startContent: _jsx(Icon, { icon: IconShieldSearch, size: "sm", color: "secondary" }), label: _jsx(Text, { weight: "semibold", children: "Examples" }), align: "start" })] }), _jsx(VStack, { gap: 0, children: PROBE_BATTERY.map((entry) => (_jsx(BatteryRow, { entry: entry, isDisabled: isDisabled, onSend: () => {
|
|
135
|
+
onSend([entry.text]);
|
|
136
|
+
} }, entry.id))) })] }) }));
|
|
137
|
+
}
|
|
138
|
+
/** A row of the sent list: the text and its answers in short. */
|
|
139
|
+
function SentRow({ sent, onOpen }) {
|
|
140
|
+
return (_jsx(Item, { startContent: _jsx(Icon, { icon: IconShield, size: "sm", color: "secondary" }), label: _jsx(Text, { weight: "medium", maxLines: 1, children: sent.text }), description: _jsx(Tally, { sent: sent }), align: "start", density: "compact", onClick: onOpen }));
|
|
141
|
+
}
|
|
142
|
+
/** A boundary of an open text: where it went in and what the guardrails did there. */
|
|
143
|
+
function AnswerRow({ answer, onOpen }) {
|
|
144
|
+
return (_jsx(Item, { startContent: _jsx(Icon, { icon: BOUNDARY_ICONS[answer.boundary], size: "sm", color: "secondary" }), label: _jsx(BoundaryCard, { boundary: answer.boundary, children: _jsx(Text, { weight: "medium", children: PROBE_BOUNDARY_NOTES[answer.boundary].label }) }), endContent: _jsx(Verdict, { answer: answer }), density: "compact", onClick: onOpen }));
|
|
145
|
+
}
|
|
146
|
+
/** An open text: the way back, the text as sent, and each boundary's answer. */
|
|
147
|
+
function SentOverview({ sent, onBack, onOpen, }) {
|
|
148
|
+
return (_jsxs(VStack, { gap: 5, padding: 4, children: [_jsxs(VStack, { gap: 4, children: [_jsx(HStack, { children: _jsx(Button, { label: "All probes", variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconArrowLeft }), onClick: onBack }) }), sent.error && _jsx(Banner, { status: "error", title: sent.error }), _jsx(PanePanel, { title: "Sent", children: _jsx(Prose, { text: sent.text }) })] }), sent.answers && (_jsxs(VStack, { gap: 2, children: [_jsx(Text, { weight: "semibold", children: "Boundaries" }), _jsx(VStack, { gap: 0, children: sent.answers.map((answer) => (_jsx(AnswerRow, { answer: answer, onOpen: () => {
|
|
149
|
+
onOpen(answer.boundary);
|
|
150
|
+
} }, answer.boundary))) })] }))] }));
|
|
151
|
+
}
|
|
152
|
+
/** What leads one boundary's answer: the way back, the boundary, and its answer, and what got through. */
|
|
153
|
+
function AnswerHead({ answer, isClose, onBack, }) {
|
|
154
|
+
const { label, checks } = PROBE_BOUNDARY_NOTES[answer.boundary];
|
|
155
|
+
return (_jsxs(VStack, { gap: 4, children: [_jsxs(VStack, { gap: 2, children: [_jsx(BackButton, { isClose: isClose, onBack: onBack }), _jsx(Item, { startContent: _jsx(Icon, { icon: BOUNDARY_ICONS[answer.boundary], size: "sm", color: "secondary" }), label: _jsx(Text, { weight: "semibold", children: label }), description: checks, align: "start" }), _jsx(Verdict, { answer: answer }), answer.refused?.message && _jsx(Text, { color: "secondary", children: answer.refused.message })] }), _jsx(Flagged, { answer: answer }), _jsx(Crossed, { answer: answer })] }));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Sends texts across every guardrail boundary of the compiled agent and lists what its guardrails
|
|
159
|
+
* did with each, newest first. A sent text opens on its boundaries, and a boundary on what its
|
|
160
|
+
* trace says of guardrails. The model is scripted, so a probe spends no key.
|
|
161
|
+
*/
|
|
162
|
+
export function GuardrailTester({ payload, isWide, }) {
|
|
163
|
+
const [text, setText] = useState('');
|
|
164
|
+
const [busy, setBusy] = useState(false);
|
|
165
|
+
const [sent, setSent] = useState([]);
|
|
166
|
+
const [openId, setOpenId] = useState(null);
|
|
167
|
+
const [boundary, setBoundary] = useState(null);
|
|
168
|
+
const [examples, setExamples] = useState(false);
|
|
169
|
+
const refusal = probeRefusal(payload.profile);
|
|
170
|
+
if (refusal) {
|
|
171
|
+
return (_jsx(PaneState, { icon: _jsx(Icon, { icon: IconShieldSearch, size: "lg", color: "secondary" }), title: refusal }));
|
|
172
|
+
}
|
|
173
|
+
const send = async (texts) => {
|
|
174
|
+
if (busy)
|
|
175
|
+
return;
|
|
176
|
+
setBusy(true);
|
|
177
|
+
for (const each of texts) {
|
|
178
|
+
const outcome = await sendProbe(payload, each);
|
|
179
|
+
setSent((before) => [{ id: before.length, text: each, ...outcome }, ...before]);
|
|
180
|
+
}
|
|
181
|
+
setBusy(false);
|
|
182
|
+
};
|
|
183
|
+
const open = sent.find((entry) => entry.id === openId);
|
|
184
|
+
if (open) {
|
|
185
|
+
const answer = open.answers?.find((candidate) => candidate.boundary === boundary);
|
|
186
|
+
return (_jsx(PaneLayout, { isWide: isWide, label: "Test guardrails", detailLabel: answer ? PROBE_BOUNDARY_NOTES[answer.boundary].label : '', overview: _jsx(SentOverview, { sent: open, onBack: () => {
|
|
187
|
+
setOpenId(null);
|
|
188
|
+
setBoundary(null);
|
|
189
|
+
}, onOpen: setBoundary }), detail: answer && (_jsx(TraceGuardrailsView, { records: answer.traces, head: _jsx(AnswerHead, { answer: answer, isClose: isWide, onBack: () => {
|
|
190
|
+
setBoundary(null);
|
|
191
|
+
} }) })) }));
|
|
192
|
+
}
|
|
193
|
+
const probe = text.trim();
|
|
194
|
+
const overview = (_jsxs(VStack, { gap: 5, padding: 4, children: [_jsx(Text, { weight: "semibold", children: "Test guardrails" }), _jsxs(VStack, { gap: 3, children: [_jsx(ExampleRow, { isShown: examples, isDisabled: busy, onShow: () => {
|
|
195
|
+
setExamples(!examples);
|
|
196
|
+
}, onSend: (texts) => {
|
|
197
|
+
void send(texts);
|
|
198
|
+
} }), _jsx(TextArea, { label: "Text", isLabelHidden: true, size: "sm", rows: 3, placeholder: "Sent across every boundary", value: text, onChange: setText }), _jsx(HStack, { hAlign: "end", children: _jsx(Button, { label: "Send", variant: "primary", isLoading: busy, isDisabled: !probe, onClick: () => {
|
|
199
|
+
void send([probe]);
|
|
200
|
+
} }) })] }), sent.length > 0 && (_jsxs(VStack, { gap: 2, children: [_jsx(Text, { weight: "semibold", children: "Sent" }), _jsx(VStack, { gap: 0, children: sent.map((entry) => (_jsx(SentRow, { sent: entry, onOpen: () => {
|
|
201
|
+
setOpenId(entry.id);
|
|
202
|
+
} }, entry.id))) })] }))] }));
|
|
203
|
+
return (_jsx(PaneLayout, { isWide: isWide, label: "Test guardrails", detailLabel: "Examples", overview: overview, detail: examples && (_jsx(Examples, { isClose: isWide, isDisabled: busy, onBack: () => {
|
|
204
|
+
setExamples(false);
|
|
205
|
+
}, onSend: (texts) => {
|
|
206
|
+
// Narrow, the examples sit over the results: sending one shows them again.
|
|
207
|
+
if (!isWide)
|
|
208
|
+
setExamples(false);
|
|
209
|
+
void send(texts);
|
|
210
|
+
} })) }));
|
|
211
|
+
}
|
|
212
|
+
/** Why a sample can't be sent to `payload` yet, or undefined when it can. */
|
|
213
|
+
function unsendable(payload) {
|
|
214
|
+
return payload ? probeRefusal(payload.profile) : 'Fix the issues first';
|
|
215
|
+
}
|
|
216
|
+
/** One detector's answers: each boundary it reads, and behind it what the trace says and what crossed. */
|
|
217
|
+
function ScopedAnswers({ answers }) {
|
|
218
|
+
if (answers.length === 0) {
|
|
219
|
+
return (_jsx(Text, { type: "supporting", color: "secondary", children: sectionNote('detect.try.off') }));
|
|
220
|
+
}
|
|
221
|
+
return (_jsx(CollapsibleGroup, { type: "multiple", density: "compact", children: answers.map((answer) => (_jsx(Collapsible, { value: answer.boundary, trigger: _jsxs(HStack, { gap: 2, align: "center", justify: "between", children: [_jsxs(HStack, { gap: 2, align: "center", children: [_jsx(Icon, { icon: BOUNDARY_ICONS[answer.boundary], size: "sm", color: "secondary" }), _jsx(BoundaryCard, { boundary: answer.boundary, children: _jsx(Text, { type: "supporting", children: PROBE_BOUNDARY_NOTES[answer.boundary].label }) })] }), _jsx(Verdict, { answer: answer })] }), children: _jsx(TraceGuardrailsView, { records: answer.traces, head: _jsxs(VStack, { gap: 4, children: [_jsx(Flagged, { answer: answer }), _jsx(Crossed, { answer: answer })] }) }) }, answer.boundary))) }));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The tester from a detector's page: the same probe of the open agent, read with the detector
|
|
225
|
+
* `only` alone. An answer shows for the sample and the draft it was sent with, and goes when
|
|
226
|
+
* either changes.
|
|
227
|
+
*/
|
|
228
|
+
export function DetectorTester({ only }) {
|
|
229
|
+
const payload = useContext(ProbedAgent);
|
|
230
|
+
const [text, setText] = useState('');
|
|
231
|
+
const [busy, setBusy] = useState(false);
|
|
232
|
+
const [tried, setTried] = useState(null);
|
|
233
|
+
const probe = text.trim();
|
|
234
|
+
const blocked = unsendable(payload);
|
|
235
|
+
const shown = tried && tried.payload === payload && tried.text === probe ? tried : null;
|
|
236
|
+
const send = async () => {
|
|
237
|
+
if (!payload || busy)
|
|
238
|
+
return;
|
|
239
|
+
setBusy(true);
|
|
240
|
+
const outcome = await sendProbe(payload, probe, only);
|
|
241
|
+
setTried({ payload, text: probe, ...outcome });
|
|
242
|
+
setBusy(false);
|
|
243
|
+
};
|
|
244
|
+
const button = (_jsx(Button, { label: "Send", size: "sm", isLoading: busy, isDisabled: !probe || blocked !== undefined, onClick: () => {
|
|
245
|
+
void send();
|
|
246
|
+
} }));
|
|
247
|
+
return (_jsxs(InspectorSection, { title: "Try it", note: sectionNote('detect.try'), children: [_jsx(TextArea, { label: "Sample text", isLabelHidden: true, size: "sm", rows: 3, placeholder: "Sent across each boundary this detector reads", value: text, onChange: setText }), _jsx(HStack, { hAlign: "end", children: blocked ? _jsx(Tooltip, { content: blocked, children: button }) : button }), shown?.error && _jsx(Banner, { status: "error", title: shown.error }), shown?.answers && _jsx(ScopedAnswers, { answers: shown.answers })] }));
|
|
248
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { InputStatus } from '@astryxdesign/core/Field';
|
|
2
|
+
import { type NodeOrigins, type StudioAsks, type StudioIssue, type StudioProvider, type StudioRunPayload, type StudioRunsOn, type WriteAsk } from '../mod.ts';
|
|
3
|
+
import type { SettingOrigin } from '../server/save-wire.ts';
|
|
4
|
+
/** The compile issues for the node being edited; rows show the ones on their field. */
|
|
5
|
+
export declare const NodeIssues: import("react").Context<readonly StudioIssue[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Looks up the error status for a draft field of the node being edited, and for a list field, the
|
|
8
|
+
* entry at `index`. Several issues on one field show as one message.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFieldStatus(): (field?: string, index?: number) => InputStatus | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The open node's settings that the project's files set in code, and how to see one in the
|
|
13
|
+
* builder's editor. `null` when no project is open, or the files do not hold the node.
|
|
14
|
+
*/
|
|
15
|
+
export declare const RowOrigins: import("react").Context<{
|
|
16
|
+
scope: NodeOrigins;
|
|
17
|
+
open: (origin: SettingOrigin) => void;
|
|
18
|
+
} | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Asks the builder before a real run of a tool that writes, and answers whether to run it. Where
|
|
21
|
+
* no page mounts the question, the run is refused.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ConfirmWrite: import("react").Context<(ask: WriteAsk) => Promise<boolean>>;
|
|
24
|
+
/** The project's tools that write: the ones the studio makes ask, and the ones it cannot. */
|
|
25
|
+
export declare const ProjectAsks: import("react").Context<StudioAsks>;
|
|
26
|
+
/** The origin a section around a row has already named, so the row does not name it again. */
|
|
27
|
+
export declare const SaidOrigin: import("react").Context<SettingOrigin | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* The origin of the row or section at a catalog path, when the files set it in code: the studio
|
|
30
|
+
* shows its value and does not change it. `said` when the editor already says so over the row:
|
|
31
|
+
* once for the whole node, or on the section the row is in.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useRowOrigin(path: string | undefined): {
|
|
34
|
+
origin: SettingOrigin;
|
|
35
|
+
said: boolean;
|
|
36
|
+
open: () => void;
|
|
37
|
+
} | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Called as the builder starts to leave a page inside a node (a detector's page, back to the list);
|
|
40
|
+
* the function it returns, called once the next page is up, lets the issues left behind show.
|
|
41
|
+
*/
|
|
42
|
+
export declare const LeavePage: import("react").Context<() => () => void>;
|
|
43
|
+
/**
|
|
44
|
+
* The preview's way to a decision question's page. `open` takes a question's id; `asked` is that id
|
|
45
|
+
* until the decision editor shows its page and calls `shown`. Outside the builder none is set.
|
|
46
|
+
*/
|
|
47
|
+
export declare const QuestionLink: import("react").Context<{
|
|
48
|
+
asked?: string;
|
|
49
|
+
open?: (id: string) => void;
|
|
50
|
+
shown?: () => void;
|
|
51
|
+
}>;
|
|
52
|
+
/** Marks a row that has an issue, so the issue pill can scroll to it. */
|
|
53
|
+
export declare const ISSUE_ROW_ATTRIBUTE = "data-issue";
|
|
54
|
+
/**
|
|
55
|
+
* How many of a list row's picks show as badges before the rest are counted: two while the editor
|
|
56
|
+
* is at its default width or wider, one once it is narrowed.
|
|
57
|
+
*/
|
|
58
|
+
export declare const ListBadges: import("react").Context<number>;
|
|
59
|
+
/** What the studio runs on: the page's lent keys, the builder's own, or their machine. */
|
|
60
|
+
export declare const RunsOn: import("react").Context<StudioRunsOn>;
|
|
61
|
+
export declare const LocalConnection: import("react").Context<Pick<{
|
|
62
|
+
entries: {
|
|
63
|
+
id: string;
|
|
64
|
+
slot: string;
|
|
65
|
+
}[];
|
|
66
|
+
setEntries: import("react").Dispatch<import("react").SetStateAction<{
|
|
67
|
+
id: string;
|
|
68
|
+
slot: string;
|
|
69
|
+
}[]>>;
|
|
70
|
+
localModels: {
|
|
71
|
+
status: "idle" | "loading" | "ready" | "error";
|
|
72
|
+
ids: string[];
|
|
73
|
+
error?: string;
|
|
74
|
+
};
|
|
75
|
+
mode: "local" | "demo" | "byok";
|
|
76
|
+
on: StudioRunsOn;
|
|
77
|
+
runtime: import("../browser-transport.ts").StudioBrowserRuntime | null;
|
|
78
|
+
vault: Readonly<Record<string, string | undefined>>;
|
|
79
|
+
setVault: import("react").Dispatch<import("react").SetStateAction<Readonly<Record<string, string | undefined>>>>;
|
|
80
|
+
slots: string[];
|
|
81
|
+
local: {
|
|
82
|
+
baseUrl: string;
|
|
83
|
+
};
|
|
84
|
+
setLocal: import("react").Dispatch<import("react").SetStateAction<{
|
|
85
|
+
baseUrl: string;
|
|
86
|
+
}>>;
|
|
87
|
+
remoteTools: boolean;
|
|
88
|
+
setRemoteTools: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
89
|
+
}, "local" | "vault" | "localModels" | "setLocal" | "remoteTools" | "setRemoteTools" | "runtime" | "slots"> | null>;
|
|
90
|
+
/** One agent of the workspace, as another agent's pickers name it. */
|
|
91
|
+
export interface WorkspaceAgent {
|
|
92
|
+
key: string;
|
|
93
|
+
agentId: string;
|
|
94
|
+
type: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The workspace around the agent the editor shows: the agents it can name, which of the library's
|
|
98
|
+
* tools it allows, and, on a project, a way to add or change a provider. `null` when the editor
|
|
99
|
+
* shows a single draft.
|
|
100
|
+
*/
|
|
101
|
+
export declare const WorkspaceContext: import("react").Context<{
|
|
102
|
+
agents: readonly WorkspaceAgent[];
|
|
103
|
+
self: string;
|
|
104
|
+
allowed: readonly string[];
|
|
105
|
+
setAllowed: (toolKey: string, allowed: boolean) => void;
|
|
106
|
+
addProvider: ((provider: StudioProvider) => void) | undefined;
|
|
107
|
+
/** Puts a changed provider in the workspace; left out where the providers are not the builder's. */
|
|
108
|
+
updateProvider: ((provider: StudioProvider) => void) | undefined;
|
|
109
|
+
/** Who else calls `apiId` on the provider `id` besides the open agent's model `bindingKey` (`modelSharers`). */
|
|
110
|
+
sharing: (bindingKey: string, id: string, apiId: string) => {
|
|
111
|
+
models: string[];
|
|
112
|
+
agents: string[];
|
|
113
|
+
};
|
|
114
|
+
} | null>;
|
|
115
|
+
/**
|
|
116
|
+
* The agent the editor has open, as it compiles now: what a detector's page sends its sample to.
|
|
117
|
+
* Null while the draft has issues.
|
|
118
|
+
*/
|
|
119
|
+
export declare const ProbedAgent: import("react").Context<StudioRunPayload | null>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import { ON_OWN_KEYS, rowOrigin, } from "../mod.js";
|
|
3
|
+
// Kept out of inspector.tsx: a hot reload re-runs that module and would orphan these contexts.
|
|
4
|
+
/** The compile issues for the node being edited; rows show the ones on their field. */
|
|
5
|
+
export const NodeIssues = createContext([]);
|
|
6
|
+
/**
|
|
7
|
+
* Looks up the error status for a draft field of the node being edited, and for a list field, the
|
|
8
|
+
* entry at `index`. Several issues on one field show as one message.
|
|
9
|
+
*/
|
|
10
|
+
export function useFieldStatus() {
|
|
11
|
+
const issues = useContext(NodeIssues);
|
|
12
|
+
return (field, index) => {
|
|
13
|
+
if (field === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
const messages = issues
|
|
16
|
+
.filter((issue) => issue.field === field && issue.index === index)
|
|
17
|
+
.map((issue) => issue.message);
|
|
18
|
+
return messages.length ? { type: 'error', message: messages.join(' ') } : undefined;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The open node's settings that the project's files set in code, and how to see one in the
|
|
23
|
+
* builder's editor. `null` when no project is open, or the files do not hold the node.
|
|
24
|
+
*/
|
|
25
|
+
export const RowOrigins = createContext(null);
|
|
26
|
+
/**
|
|
27
|
+
* Asks the builder before a real run of a tool that writes, and answers whether to run it. Where
|
|
28
|
+
* no page mounts the question, the run is refused.
|
|
29
|
+
*/
|
|
30
|
+
export const ConfirmWrite = createContext(() => Promise.resolve(false));
|
|
31
|
+
/** The project's tools that write: the ones the studio makes ask, and the ones it cannot. */
|
|
32
|
+
export const ProjectAsks = createContext({ asked: [], inside: [] });
|
|
33
|
+
/** The origin a section around a row has already named, so the row does not name it again. */
|
|
34
|
+
export const SaidOrigin = createContext(undefined);
|
|
35
|
+
/**
|
|
36
|
+
* The origin of the row or section at a catalog path, when the files set it in code: the studio
|
|
37
|
+
* shows its value and does not change it. `said` when the editor already says so over the row:
|
|
38
|
+
* once for the whole node, or on the section the row is in.
|
|
39
|
+
*/
|
|
40
|
+
export function useRowOrigin(path) {
|
|
41
|
+
const held = useContext(RowOrigins);
|
|
42
|
+
const above = useContext(SaidOrigin);
|
|
43
|
+
const origin = held && path !== undefined ? rowOrigin(held.scope, path) : undefined;
|
|
44
|
+
if (!held || !origin)
|
|
45
|
+
return undefined;
|
|
46
|
+
return {
|
|
47
|
+
origin,
|
|
48
|
+
said: origin === held.scope.section || origin === held.scope.partly || origin === above,
|
|
49
|
+
open: () => {
|
|
50
|
+
held.open(origin);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Called as the builder starts to leave a page inside a node (a detector's page, back to the list);
|
|
56
|
+
* the function it returns, called once the next page is up, lets the issues left behind show.
|
|
57
|
+
*/
|
|
58
|
+
export const LeavePage = createContext(() => () => undefined);
|
|
59
|
+
/**
|
|
60
|
+
* The preview's way to a decision question's page. `open` takes a question's id; `asked` is that id
|
|
61
|
+
* until the decision editor shows its page and calls `shown`. Outside the builder none is set.
|
|
62
|
+
*/
|
|
63
|
+
export const QuestionLink = createContext({});
|
|
64
|
+
/** Marks a row that has an issue, so the issue pill can scroll to it. */
|
|
65
|
+
export const ISSUE_ROW_ATTRIBUTE = 'data-issue';
|
|
66
|
+
/**
|
|
67
|
+
* How many of a list row's picks show as badges before the rest are counted: two while the editor
|
|
68
|
+
* is at its default width or wider, one once it is narrowed.
|
|
69
|
+
*/
|
|
70
|
+
export const ListBadges = createContext(1);
|
|
71
|
+
/** What the studio runs on: the page's lent keys, the builder's own, or their machine. */
|
|
72
|
+
export const RunsOn = createContext(ON_OWN_KEYS);
|
|
73
|
+
export const LocalConnection = createContext(null);
|
|
74
|
+
/**
|
|
75
|
+
* The workspace around the agent the editor shows: the agents it can name, which of the library's
|
|
76
|
+
* tools it allows, and, on a project, a way to add or change a provider. `null` when the editor
|
|
77
|
+
* shows a single draft.
|
|
78
|
+
*/
|
|
79
|
+
export const WorkspaceContext = createContext(null);
|
|
80
|
+
/**
|
|
81
|
+
* The agent the editor has open, as it compiles now: what a detector's page sends its sample to.
|
|
82
|
+
* Null while the draft has issues.
|
|
83
|
+
*/
|
|
84
|
+
export const ProbedAgent = createContext(null);
|