@waq666/pneuma 0.0.0-stage → 0.7.1
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 +206 -3
- package/bin/dsc.js +91 -0
- package/bin/headless.cjs +40 -0
- package/lib/adapter/core-runtime.d.ts +11 -0
- package/lib/adapter/core-runtime.js +259 -0
- package/lib/adapter/host.d.ts +18 -0
- package/lib/adapter/host.js +14 -0
- package/lib/adapter/runtime.d.ts +15 -0
- package/lib/adapter/runtime.js +290 -0
- package/lib/adapter/transcript.d.ts +184 -0
- package/lib/adapter/transcript.js +605 -0
- package/lib/app/AgentsOverlay.d.ts +18 -0
- package/lib/app/AgentsOverlay.js +63 -0
- package/lib/app/App.d.ts +15 -0
- package/lib/app/App.js +1650 -0
- package/lib/app/App.js.nv-backup +1650 -0
- package/lib/app/ApprovalCard.d.ts +12 -0
- package/lib/app/ApprovalCard.js +76 -0
- package/lib/app/AskCard.d.ts +20 -0
- package/lib/app/AskCard.js +45 -0
- package/lib/app/ChatView.d.ts +63 -0
- package/lib/app/ChatView.js +310 -0
- package/lib/app/Composer.d.ts +50 -0
- package/lib/app/Composer.js +282 -0
- package/lib/app/DiffBlock.d.ts +6 -0
- package/lib/app/DiffBlock.js +37 -0
- package/lib/app/MarkdownView.d.ts +6 -0
- package/lib/app/MarkdownView.js +99 -0
- package/lib/app/ModelPicker.d.ts +7 -0
- package/lib/app/ModelPicker.js +18 -0
- package/lib/app/PlanReviewCard.d.ts +13 -0
- package/lib/app/PlanReviewCard.js +54 -0
- package/lib/app/PresetPicker.d.ts +11 -0
- package/lib/app/PresetPicker.js +19 -0
- package/lib/app/PreviewOverlay.d.ts +14 -0
- package/lib/app/PreviewOverlay.js +22 -0
- package/lib/app/SessionPicker.d.ts +43 -0
- package/lib/app/SessionPicker.js +56 -0
- package/lib/app/SettingsOverlay.d.ts +32 -0
- package/lib/app/SettingsOverlay.js +157 -0
- package/lib/app/SkillsPicker.d.ts +7 -0
- package/lib/app/SkillsPicker.js +19 -0
- package/lib/app/StatusBar.d.ts +22 -0
- package/lib/app/StatusBar.js +201 -0
- package/lib/app/TaskStrips.d.ts +13 -0
- package/lib/app/TaskStrips.js +40 -0
- package/lib/app/TimelineRail.d.ts +22 -0
- package/lib/app/TimelineRail.js +160 -0
- package/lib/app/TimelineRail.js.negbak +98 -0
- package/lib/app/TimelineRail.js.nv-backup +160 -0
- package/lib/app/ToolCard.d.ts +11 -0
- package/lib/app/ToolCard.js +64 -0
- package/lib/app/ToolCard.js.nv-backup +64 -0
- package/lib/app/TranscriptOverlay.d.ts +27 -0
- package/lib/app/TranscriptOverlay.js +36 -0
- package/lib/app/TranscriptViewport.d.ts +78 -0
- package/lib/app/TranscriptViewport.js +218 -0
- package/lib/app/Welcome.d.ts +6 -0
- package/lib/app/Welcome.js +71 -0
- package/lib/app/attach.d.ts +16 -0
- package/lib/app/attach.js +58 -0
- package/lib/app/click.d.ts +40 -0
- package/lib/app/click.js +103 -0
- package/lib/app/clipboard-image.d.ts +11 -0
- package/lib/app/clipboard-image.js +66 -0
- package/lib/app/cursor.d.ts +4 -0
- package/lib/app/cursor.js +24 -0
- package/lib/app/hello.d.ts +11 -0
- package/lib/app/hello.js +8 -0
- package/lib/app/history-store.d.ts +4 -0
- package/lib/app/history-store.js +41 -0
- package/lib/app/image-blocks.d.ts +12 -0
- package/lib/app/image-blocks.js +125 -0
- package/lib/app/keymap.d.ts +56 -0
- package/lib/app/keymap.js +56 -0
- package/lib/app/markdown.d.ts +54 -0
- package/lib/app/markdown.js +189 -0
- package/lib/app/mouse.d.ts +33 -0
- package/lib/app/mouse.js +35 -0
- package/lib/app/pointer.d.ts +16 -0
- package/lib/app/pointer.js +60 -0
- package/lib/app/scroll-model.d.ts +240 -0
- package/lib/app/scroll-model.js +347 -0
- package/lib/app/settings-model.d.ts +69 -0
- package/lib/app/settings-model.js +114 -0
- package/lib/app/snapshot-subscribe.d.ts +34 -0
- package/lib/app/snapshot-subscribe.js +110 -0
- package/lib/app/theme.d.ts +194 -0
- package/lib/app/theme.js +186 -0
- package/lib/app/ticker.d.ts +7 -0
- package/lib/app/ticker.js +53 -0
- package/lib/boot.d.ts +1 -0
- package/lib/boot.js +34 -0
- package/lib/commands.d.ts +49 -0
- package/lib/commands.js +115 -0
- package/lib/contract.d.ts +1973 -0
- package/lib/contract.js +36 -0
- package/lib/core/agent-roles.d.ts +52 -0
- package/lib/core/agent-roles.js +274 -0
- package/lib/core/approval-floor.d.ts +183 -0
- package/lib/core/approval-floor.js +679 -0
- package/lib/core/approval.d.ts +42 -0
- package/lib/core/approval.js +8 -0
- package/lib/core/audit.d.ts +61 -0
- package/lib/core/audit.js +59 -0
- package/lib/core/boot-notices.d.ts +6 -0
- package/lib/core/boot-notices.js +61 -0
- package/lib/core/cdp/actions.d.ts +182 -0
- package/lib/core/cdp/actions.js +649 -0
- package/lib/core/cdp/launch.d.ts +192 -0
- package/lib/core/cdp/launch.js +491 -0
- package/lib/core/cdp/snapshot.d.ts +139 -0
- package/lib/core/cdp/snapshot.js +316 -0
- package/lib/core/cdp/transport.d.ts +160 -0
- package/lib/core/cdp/transport.js +359 -0
- package/lib/core/command-policy.d.ts +108 -0
- package/lib/core/command-policy.js +580 -0
- package/lib/core/commands-completion.d.ts +78 -0
- package/lib/core/commands-completion.js +167 -0
- package/lib/core/compact-anchors.d.ts +76 -0
- package/lib/core/compact-anchors.js +284 -0
- package/lib/core/compact.d.ts +110 -0
- package/lib/core/compact.js +210 -0
- package/lib/core/config-store.d.ts +38 -0
- package/lib/core/config-store.js +307 -0
- package/lib/core/config.d.ts +36 -0
- package/lib/core/config.js +124 -0
- package/lib/core/connection-test.d.ts +60 -0
- package/lib/core/connection-test.js +84 -0
- package/lib/core/desktop-control.d.ts +298 -0
- package/lib/core/desktop-control.js +1311 -0
- package/lib/core/diff-text.d.ts +74 -0
- package/lib/core/diff-text.js +257 -0
- package/lib/core/dock-browser.d.ts +137 -0
- package/lib/core/dock-browser.js +146 -0
- package/lib/core/dock-ops.d.ts +59 -0
- package/lib/core/dock-ops.js +104 -0
- package/lib/core/dock-session.d.ts +39 -0
- package/lib/core/dock-session.js +28 -0
- package/lib/core/dsh-compat/hook.d.ts +18 -0
- package/lib/core/dsh-compat/hook.js +52 -0
- package/lib/core/dsh-compat/resolve-hook.d.ts +5 -0
- package/lib/core/dsh-compat/resolve-hook.js +59 -0
- package/lib/core/dsh-compat/tools-facade.d.ts +47 -0
- package/lib/core/dsh-compat/tools-facade.js +108 -0
- package/lib/core/err-text.d.ts +13 -0
- package/lib/core/err-text.js +15 -0
- package/lib/core/events.d.ts +149 -0
- package/lib/core/events.js +1 -0
- package/lib/core/git-exec.d.ts +23 -0
- package/lib/core/git-exec.js +72 -0
- package/lib/core/git-info.d.ts +47 -0
- package/lib/core/git-info.js +157 -0
- package/lib/core/goal.d.ts +89 -0
- package/lib/core/goal.js +189 -0
- package/lib/core/hooks.d.ts +272 -0
- package/lib/core/hooks.js +818 -0
- package/lib/core/host-browser-link.d.ts +59 -0
- package/lib/core/host-browser-link.js +9 -0
- package/lib/core/host-methods.d.ts +25 -0
- package/lib/core/host-methods.js +103 -0
- package/lib/core/image-diet.d.ts +77 -0
- package/lib/core/image-diet.js +127 -0
- package/lib/core/learnings/ledger.d.ts +73 -0
- package/lib/core/learnings/ledger.js +273 -0
- package/lib/core/learnings/skill-write.d.ts +250 -0
- package/lib/core/learnings/skill-write.js +854 -0
- package/lib/core/learnings/store.d.ts +102 -0
- package/lib/core/learnings/store.js +266 -0
- package/lib/core/lifecycle-hooks.d.ts +189 -0
- package/lib/core/lifecycle-hooks.js +576 -0
- package/lib/core/llm.d.ts +283 -0
- package/lib/core/llm.js +565 -0
- package/lib/core/lockfile.d.ts +17 -0
- package/lib/core/lockfile.js +110 -0
- package/lib/core/loop.d.ts +185 -0
- package/lib/core/loop.js +587 -0
- package/lib/core/lsp/client.d.ts +189 -0
- package/lib/core/lsp/client.js +690 -0
- package/lib/core/lsp/framing.d.ts +84 -0
- package/lib/core/lsp/framing.js +181 -0
- package/lib/core/lsp/line-shift.d.ts +28 -0
- package/lib/core/lsp/line-shift.js +127 -0
- package/lib/core/lsp/manager.d.ts +93 -0
- package/lib/core/lsp/manager.js +418 -0
- package/lib/core/lsp/normalize.d.ts +32 -0
- package/lib/core/lsp/normalize.js +139 -0
- package/lib/core/lsp/servers.d.ts +106 -0
- package/lib/core/lsp/servers.js +352 -0
- package/lib/core/lsp/uri.d.ts +76 -0
- package/lib/core/lsp/uri.js +179 -0
- package/lib/core/market.d.ts +51 -0
- package/lib/core/market.js +358 -0
- package/lib/core/mcp.d.ts +201 -0
- package/lib/core/mcp.js +836 -0
- package/lib/core/memory-eval.d.ts +158 -0
- package/lib/core/memory-eval.js +215 -0
- package/lib/core/memory.d.ts +266 -0
- package/lib/core/memory.js +703 -0
- package/lib/core/mention.d.ts +57 -0
- package/lib/core/mention.js +129 -0
- package/lib/core/microcompact.d.ts +48 -0
- package/lib/core/microcompact.js +79 -0
- package/lib/core/migrate.d.ts +56 -0
- package/lib/core/migrate.js +134 -0
- package/lib/core/model-caps.d.ts +83 -0
- package/lib/core/model-caps.js +150 -0
- package/lib/core/model-discovery.d.ts +19 -0
- package/lib/core/model-discovery.js +69 -0
- package/lib/core/modes.d.ts +72 -0
- package/lib/core/modes.js +152 -0
- package/lib/core/native-bridge.d.ts +135 -0
- package/lib/core/native-bridge.js +563 -0
- package/lib/core/path-policy.d.ts +32 -0
- package/lib/core/path-policy.js +248 -0
- package/lib/core/permission-presets.d.ts +67 -0
- package/lib/core/permission-presets.js +75 -0
- package/lib/core/plugin-loader.d.ts +36 -0
- package/lib/core/plugin-loader.js +294 -0
- package/lib/core/plugin-registry.d.ts +113 -0
- package/lib/core/plugin-registry.js +256 -0
- package/lib/core/prefs.d.ts +82 -0
- package/lib/core/prefs.js +372 -0
- package/lib/core/presets.d.ts +80 -0
- package/lib/core/presets.js +373 -0
- package/lib/core/pricing.d.ts +90 -0
- package/lib/core/pricing.js +126 -0
- package/lib/core/prompt.d.ts +92 -0
- package/lib/core/prompt.js +339 -0
- package/lib/core/ptc.d.ts +66 -0
- package/lib/core/ptc.js +70 -0
- package/lib/core/remote/frames.d.ts +91 -0
- package/lib/core/remote/frames.js +174 -0
- package/lib/core/remote/notify.d.ts +54 -0
- package/lib/core/remote/notify.js +77 -0
- package/lib/core/remote/owner.d.ts +32 -0
- package/lib/core/remote/owner.js +75 -0
- package/lib/core/remote/pairing.d.ts +104 -0
- package/lib/core/remote/pairing.js +261 -0
- package/lib/core/remote/push.d.ts +80 -0
- package/lib/core/remote/push.js +222 -0
- package/lib/core/remote/store.d.ts +18 -0
- package/lib/core/remote/store.js +59 -0
- package/lib/core/remote/tickets.d.ts +20 -0
- package/lib/core/remote/tickets.js +49 -0
- package/lib/core/remote/uploads.d.ts +63 -0
- package/lib/core/remote/uploads.js +161 -0
- package/lib/core/request-attribution.d.ts +26 -0
- package/lib/core/request-attribution.js +86 -0
- package/lib/core/request-invariant.d.ts +61 -0
- package/lib/core/request-invariant.js +199 -0
- package/lib/core/sandbox/backends.d.ts +64 -0
- package/lib/core/sandbox/backends.js +194 -0
- package/lib/core/sandbox/execpolicy.d.ts +93 -0
- package/lib/core/sandbox/execpolicy.js +452 -0
- package/lib/core/sandbox/net-proxy.d.ts +31 -0
- package/lib/core/sandbox/net-proxy.js +162 -0
- package/lib/core/sandbox/policy.d.ts +211 -0
- package/lib/core/sandbox/policy.js +559 -0
- package/lib/core/sandbox/win/abi.d.ts +161 -0
- package/lib/core/sandbox/win/abi.js +169 -0
- package/lib/core/sandbox/win/account.d.ts +71 -0
- package/lib/core/sandbox/win/account.js +206 -0
- package/lib/core/sandbox/win/acl.d.ts +54 -0
- package/lib/core/sandbox/win/acl.js +339 -0
- package/lib/core/sandbox/win/backend.d.ts +61 -0
- package/lib/core/sandbox/win/backend.js +249 -0
- package/lib/core/sandbox/win/doctor.d.ts +24 -0
- package/lib/core/sandbox/win/doctor.js +272 -0
- package/lib/core/sandbox/win/ffi.d.ts +107 -0
- package/lib/core/sandbox/win/ffi.js +166 -0
- package/lib/core/sandbox/win/net-abi.d.ts +154 -0
- package/lib/core/sandbox/win/net-abi.js +316 -0
- package/lib/core/sandbox/win/runner-entry.d.ts +35 -0
- package/lib/core/sandbox/win/runner-entry.js +391 -0
- package/lib/core/sandbox/win/setup.d.ts +60 -0
- package/lib/core/sandbox/win/setup.js +986 -0
- package/lib/core/sandbox/win/token.d.ts +35 -0
- package/lib/core/sandbox/win/token.js +238 -0
- package/lib/core/sandbox/win/wfp.d.ts +41 -0
- package/lib/core/sandbox/win/wfp.js +200 -0
- package/lib/core/sandbox/win/workspace-sid.d.ts +9 -0
- package/lib/core/sandbox/win/workspace-sid.js +45 -0
- package/lib/core/schedule/rule.d.ts +184 -0
- package/lib/core/schedule/rule.js +745 -0
- package/lib/core/schedule/runner.d.ts +185 -0
- package/lib/core/schedule/runner.js +678 -0
- package/lib/core/schedule/store.d.ts +182 -0
- package/lib/core/schedule/store.js +455 -0
- package/lib/core/secrets.d.ts +41 -0
- package/lib/core/secrets.js +150 -0
- package/lib/core/session-export.d.ts +18 -0
- package/lib/core/session-export.js +73 -0
- package/lib/core/session-index.d.ts +159 -0
- package/lib/core/session-index.js +683 -0
- package/lib/core/session-meta.d.ts +41 -0
- package/lib/core/session-meta.js +97 -0
- package/lib/core/session.d.ts +356 -0
- package/lib/core/session.js +998 -0
- package/lib/core/skills.d.ts +60 -0
- package/lib/core/skills.js +171 -0
- package/lib/core/spill.d.ts +159 -0
- package/lib/core/spill.js +329 -0
- package/lib/core/surface-registry.d.ts +45 -0
- package/lib/core/surface-registry.js +67 -0
- package/lib/core/team-board.d.ts +95 -0
- package/lib/core/team-board.js +316 -0
- package/lib/core/throughput.d.ts +46 -0
- package/lib/core/throughput.js +40 -0
- package/lib/core/todo-reminder.d.ts +44 -0
- package/lib/core/todo-reminder.js +55 -0
- package/lib/core/todo.d.ts +81 -0
- package/lib/core/todo.js +222 -0
- package/lib/core/token-estimate.d.ts +55 -0
- package/lib/core/token-estimate.js +82 -0
- package/lib/core/tool-guards.d.ts +103 -0
- package/lib/core/tool-guards.js +77 -0
- package/lib/core/tool-search.d.ts +152 -0
- package/lib/core/tool-search.js +311 -0
- package/lib/core/tools/bash.d.ts +281 -0
- package/lib/core/tools/bash.js +871 -0
- package/lib/core/tools/command-runner.d.ts +84 -0
- package/lib/core/tools/command-runner.js +68 -0
- package/lib/core/tools/fs-tools.d.ts +23 -0
- package/lib/core/tools/fs-tools.js +247 -0
- package/lib/core/tools/index.d.ts +8 -0
- package/lib/core/tools/index.js +4 -0
- package/lib/core/tools/sandbox-args.d.ts +51 -0
- package/lib/core/tools/sandbox-args.js +90 -0
- package/lib/core/tools/search-tools.d.ts +3 -0
- package/lib/core/tools/search-tools.js +153 -0
- package/lib/core/tools.d.ts +96 -0
- package/lib/core/tools.js +53 -0
- package/lib/core/ui-boot-source.d.ts +71 -0
- package/lib/core/ui-boot-source.js +121 -0
- package/lib/core/ui-bundles.d.ts +249 -0
- package/lib/core/ui-bundles.js +830 -0
- package/lib/core/ui-combo.d.ts +49 -0
- package/lib/core/ui-combo.js +55 -0
- package/lib/core/ui-events.d.ts +81 -0
- package/lib/core/ui-events.js +364 -0
- package/lib/core/ui-hmr.d.ts +36 -0
- package/lib/core/ui-hmr.js +128 -0
- package/lib/core/ui-methods.d.ts +69 -0
- package/lib/core/ui-methods.js +341 -0
- package/lib/core/ui-route.d.ts +69 -0
- package/lib/core/ui-route.js +122 -0
- package/lib/core/ui-server.d.ts +75 -0
- package/lib/core/ui-server.js +369 -0
- package/lib/core/ui-trust.d.ts +47 -0
- package/lib/core/ui-trust.js +164 -0
- package/lib/core/untrusted.d.ts +30 -0
- package/lib/core/untrusted.js +48 -0
- package/lib/core/update-check.d.ts +81 -0
- package/lib/core/update-check.js +177 -0
- package/lib/core/usage-log.d.ts +82 -0
- package/lib/core/usage-log.js +306 -0
- package/lib/core/version.d.ts +1 -0
- package/lib/core/version.js +37 -0
- package/lib/core/web-http.d.ts +57 -0
- package/lib/core/web-http.js +137 -0
- package/lib/core/web-static.d.ts +31 -0
- package/lib/core/web-static.js +75 -0
- package/lib/headless.d.ts +1 -0
- package/lib/headless.js +31 -0
- package/lib/host/kernel.d.ts +33 -0
- package/lib/host/kernel.js +451 -0
- package/lib/index.d.ts +41 -0
- package/lib/index.js +35 -0
- package/lib/plugins/agent.d.ts +2 -0
- package/lib/plugins/agent.js +274 -0
- package/lib/plugins/approval-floor.d.ts +2 -0
- package/lib/plugins/approval-floor.js +223 -0
- package/lib/plugins/approval.d.ts +16 -0
- package/lib/plugins/approval.js +674 -0
- package/lib/plugins/ask.d.ts +2 -0
- package/lib/plugins/ask.js +245 -0
- package/lib/plugins/browser.d.ts +68 -0
- package/lib/plugins/browser.js +1341 -0
- package/lib/plugins/commands.d.ts +23 -0
- package/lib/plugins/commands.js +498 -0
- package/lib/plugins/compact.d.ts +21 -0
- package/lib/plugins/compact.js +274 -0
- package/lib/plugins/computer-use.d.ts +47 -0
- package/lib/plugins/computer-use.js +539 -0
- package/lib/plugins/desktop-dock.d.ts +2 -0
- package/lib/plugins/desktop-dock.js +626 -0
- package/lib/plugins/dock-browser.d.ts +34 -0
- package/lib/plugins/dock-browser.js +765 -0
- package/lib/plugins/dsh-compat.d.ts +25 -0
- package/lib/plugins/dsh-compat.js +37 -0
- package/lib/plugins/file-review.d.ts +108 -0
- package/lib/plugins/file-review.js +393 -0
- package/lib/plugins/git.d.ts +26 -0
- package/lib/plugins/git.js +132 -0
- package/lib/plugins/goal.d.ts +20 -0
- package/lib/plugins/goal.js +245 -0
- package/lib/plugins/guards.d.ts +14 -0
- package/lib/plugins/guards.js +18 -0
- package/lib/plugins/hooks.d.ts +19 -0
- package/lib/plugins/hooks.js +583 -0
- package/lib/plugins/host-stdio.d.ts +88 -0
- package/lib/plugins/host-stdio.js +317 -0
- package/lib/plugins/image-diet.d.ts +17 -0
- package/lib/plugins/image-diet.js +85 -0
- package/lib/plugins/lifecycle-hooks.d.ts +26 -0
- package/lib/plugins/lifecycle-hooks.js +338 -0
- package/lib/plugins/llm.d.ts +13 -0
- package/lib/plugins/llm.js +215 -0
- package/lib/plugins/lsp.d.ts +54 -0
- package/lib/plugins/lsp.js +608 -0
- package/lib/plugins/mcp.d.ts +16 -0
- package/lib/plugins/mcp.js +673 -0
- package/lib/plugins/memory.d.ts +17 -0
- package/lib/plugins/memory.js +858 -0
- package/lib/plugins/microcompact.d.ts +18 -0
- package/lib/plugins/microcompact.js +119 -0
- package/lib/plugins/mode.d.ts +18 -0
- package/lib/plugins/mode.js +115 -0
- package/lib/plugins/permission-presets.d.ts +18 -0
- package/lib/plugins/permission-presets.js +135 -0
- package/lib/plugins/plan.d.ts +2 -0
- package/lib/plugins/plan.js +192 -0
- package/lib/plugins/plugin-manager.d.ts +2 -0
- package/lib/plugins/plugin-manager.js +165 -0
- package/lib/plugins/presets.d.ts +2 -0
- package/lib/plugins/presets.js +182 -0
- package/lib/plugins/prompt.d.ts +2 -0
- package/lib/plugins/prompt.js +264 -0
- package/lib/plugins/ptc.d.ts +2 -0
- package/lib/plugins/ptc.js +272 -0
- package/lib/plugins/remote/http.d.ts +11 -0
- package/lib/plugins/remote/http.js +11 -0
- package/lib/plugins/remote/routes.d.ts +24 -0
- package/lib/plugins/remote/routes.js +384 -0
- package/lib/plugins/remote/types.d.ts +135 -0
- package/lib/plugins/remote/types.js +87 -0
- package/lib/plugins/remote.d.ts +17 -0
- package/lib/plugins/remote.js +1028 -0
- package/lib/plugins/runtime-api.d.ts +16 -0
- package/lib/plugins/runtime-api.js +99 -0
- package/lib/plugins/runtime.d.ts +10 -0
- package/lib/plugins/runtime.js +451 -0
- package/lib/plugins/sandbox.d.ts +2 -0
- package/lib/plugins/sandbox.js +761 -0
- package/lib/plugins/schedule.d.ts +26 -0
- package/lib/plugins/schedule.js +538 -0
- package/lib/plugins/self-improve.d.ts +61 -0
- package/lib/plugins/self-improve.js +953 -0
- package/lib/plugins/session-search.d.ts +16 -0
- package/lib/plugins/session-search.js +308 -0
- package/lib/plugins/session-title.d.ts +19 -0
- package/lib/plugins/session-title.js +109 -0
- package/lib/plugins/session.d.ts +7 -0
- package/lib/plugins/session.js +296 -0
- package/lib/plugins/settings.d.ts +3 -0
- package/lib/plugins/settings.js +705 -0
- package/lib/plugins/skills.d.ts +2 -0
- package/lib/plugins/skills.js +360 -0
- package/lib/plugins/spill.d.ts +16 -0
- package/lib/plugins/spill.js +200 -0
- package/lib/plugins/subagent.d.ts +2 -0
- package/lib/plugins/subagent.js +896 -0
- package/lib/plugins/surfaces.d.ts +11 -0
- package/lib/plugins/surfaces.js +20 -0
- package/lib/plugins/team.d.ts +16 -0
- package/lib/plugins/team.js +149 -0
- package/lib/plugins/todo.d.ts +19 -0
- package/lib/plugins/todo.js +188 -0
- package/lib/plugins/tool-search.d.ts +2 -0
- package/lib/plugins/tool-search.js +434 -0
- package/lib/plugins/tool-search.js.nv-backup +434 -0
- package/lib/plugins/tools-default.d.ts +12 -0
- package/lib/plugins/tools-default.js +275 -0
- package/lib/plugins/tools.d.ts +16 -0
- package/lib/plugins/tools.js +62 -0
- package/lib/plugins/transcript.d.ts +15 -0
- package/lib/plugins/transcript.js +311 -0
- package/lib/plugins/tui.d.ts +2 -0
- package/lib/plugins/tui.js +98 -0
- package/lib/plugins/waiting.d.ts +12 -0
- package/lib/plugins/waiting.js +34 -0
- package/lib/plugins/web-search.d.ts +14 -0
- package/lib/plugins/web-search.js +263 -0
- package/lib/plugins/webserver.d.ts +48 -0
- package/lib/plugins/webserver.js +228 -0
- package/lib/remote/assets/app-DAcUCOEn.js +14 -0
- package/lib/remote/assets/icon-192.png +0 -0
- package/lib/remote/assets/icon-512.png +0 -0
- package/lib/remote/assets/index.html +34 -0
- package/lib/remote/assets/manifest.json +27 -0
- package/lib/remote/assets/style-DIB6729x.css +1 -0
- package/lib/remote/assets/sw.js +66 -0
- package/lib/services/types.d.ts +1228 -0
- package/lib/services/types.js +1 -0
- package/lib/tools/config-cli.d.ts +1 -0
- package/lib/tools/config-cli.js +89 -0
- package/lib/ui/arrival.d.ts +72 -0
- package/lib/ui/arrival.js +105 -0
- package/lib/ui/assets/app-B70nVIKd.js +69 -0
- package/lib/ui/assets/chunk-2UxHyX5q.js +1 -0
- package/lib/ui/assets/chunk-B1dDrJ26.js +1 -0
- package/lib/ui/assets/chunk-B6aJPvgy.js +1 -0
- package/lib/ui/assets/chunk-BEwlwnbL.js +1 -0
- package/lib/ui/assets/chunk-BGcgwlCI.js +12 -0
- package/lib/ui/assets/chunk-BIGW1oBm.js +1 -0
- package/lib/ui/assets/chunk-BPQ3VLAy.js +1 -0
- package/lib/ui/assets/chunk-BRH0KZbk.js +141 -0
- package/lib/ui/assets/chunk-BX6H_ySx.js +1 -0
- package/lib/ui/assets/chunk-B_P3UbPa.js +1 -0
- package/lib/ui/assets/chunk-B_TYUkTI.js +1 -0
- package/lib/ui/assets/chunk-B_vNuMnf.js +1 -0
- package/lib/ui/assets/chunk-BajyYBss.js +10 -0
- package/lib/ui/assets/chunk-BdnUsdx6.js +1 -0
- package/lib/ui/assets/chunk-Buea-lGh.js +1 -0
- package/lib/ui/assets/chunk-C0PvZCCE.js +1 -0
- package/lib/ui/assets/chunk-C0m74zRD.js +1 -0
- package/lib/ui/assets/chunk-C27-OAKa.js +1 -0
- package/lib/ui/assets/chunk-C2oV4EkX.js +1 -0
- package/lib/ui/assets/chunk-C7zT0LnQ.js +1 -0
- package/lib/ui/assets/chunk-C9GSunVT.js +1 -0
- package/lib/ui/assets/chunk-C9tS-k6U.js +1 -0
- package/lib/ui/assets/chunk-CHLpvVh8.js +1 -0
- package/lib/ui/assets/chunk-CLxacb5B.js +1 -0
- package/lib/ui/assets/chunk-COt5Ahok.js +1 -0
- package/lib/ui/assets/chunk-CPTIWCL2.js +1 -0
- package/lib/ui/assets/chunk-CQLl-L-p.js +1 -0
- package/lib/ui/assets/chunk-CUWRgxuq.js +55 -0
- package/lib/ui/assets/chunk-CWanVSXC.js +1 -0
- package/lib/ui/assets/chunk-Cf5RLm7j.js +1 -0
- package/lib/ui/assets/chunk-CickPsom.js +1 -0
- package/lib/ui/assets/chunk-Cj5Yp3dK.js +1 -0
- package/lib/ui/assets/chunk-Cmh6b_Ma.js +1 -0
- package/lib/ui/assets/chunk-Cp-IABpG.js +1 -0
- package/lib/ui/assets/chunk-CqE71os6.js +1 -0
- package/lib/ui/assets/chunk-CtKP3W-j.js +1 -0
- package/lib/ui/assets/chunk-Cvjx9yec.js +1 -0
- package/lib/ui/assets/chunk-CxGP3dtY.js +1 -0
- package/lib/ui/assets/chunk-CylS5w8V.js +1 -0
- package/lib/ui/assets/chunk-D38fbIBN.js +1 -0
- package/lib/ui/assets/chunk-D97Zzqfu.js +1 -0
- package/lib/ui/assets/chunk-DAi9KRSo.js +1 -0
- package/lib/ui/assets/chunk-DHK4yRfg.js +1 -0
- package/lib/ui/assets/chunk-DJeabLx-.js +1 -0
- package/lib/ui/assets/chunk-DNRxmY5a.js +1 -0
- package/lib/ui/assets/chunk-DNSN1z5r.js +1 -0
- package/lib/ui/assets/chunk-DNasK_ZG.js +1 -0
- package/lib/ui/assets/chunk-DPvrY3IQ.js +1 -0
- package/lib/ui/assets/chunk-DXmwc3jG.js +1 -0
- package/lib/ui/assets/chunk-Dd0kTxKP.js +1 -0
- package/lib/ui/assets/chunk-De0Btta0.js +1 -0
- package/lib/ui/assets/chunk-Des-eS-w.js +1 -0
- package/lib/ui/assets/chunk-Df6bDoY_.js +1 -0
- package/lib/ui/assets/chunk-DijEV5ha.js +1 -0
- package/lib/ui/assets/chunk-DkvoVjww.js +1 -0
- package/lib/ui/assets/chunk-DlC-OlHO.js +1 -0
- package/lib/ui/assets/chunk-DnzrXTVv.js +1 -0
- package/lib/ui/assets/chunk-Dualf0xi.js +1 -0
- package/lib/ui/assets/chunk-EXT84bkm.js +1 -0
- package/lib/ui/assets/chunk-GwR3hkPK.js +1 -0
- package/lib/ui/assets/chunk-P80f7IUj.js +1 -0
- package/lib/ui/assets/chunk-VOosw3JB.js +1 -0
- package/lib/ui/assets/chunk-YQ4lDkt_.js +140 -0
- package/lib/ui/assets/chunk-Yzrsuije.js +1 -0
- package/lib/ui/assets/chunk-Z72CF80r.js +1 -0
- package/lib/ui/assets/chunk-g9-lgVsj.js +1 -0
- package/lib/ui/assets/chunk-vGWfd6FD.js +1 -0
- package/lib/ui/assets/chunk-wDzz0qaB.js +1 -0
- package/lib/ui/assets/chunk-ySF7HWmS.js +1 -0
- package/lib/ui/assets/icon.png +0 -0
- package/lib/ui/assets/index.html +14 -0
- package/lib/ui/assets/pdf.worker.min-CjEcRF4W.mjs +28 -0
- package/lib/ui/assets/style-Bq01xH_b.css +1 -0
- package/lib/ui/frames.d.ts +67 -0
- package/lib/ui/frames.js +146 -0
- package/lib/ui/index.d.ts +59 -0
- package/lib/ui/index.js +50 -0
- package/lib/ui/manifest.d.ts +172 -0
- package/lib/ui/manifest.js +158 -0
- package/lib/ui/plugin.d.ts +161 -0
- package/lib/ui/plugin.js +7 -0
- package/lib/ui/plugins/browser/client.js +290 -0
- package/lib/ui/plugins/browser/icon.png +0 -0
- package/lib/ui/plugins/composer/client.js +1843 -0
- package/lib/ui/plugins/composer/icon.png +0 -0
- package/lib/ui/plugins/files/client.js +646 -0
- package/lib/ui/plugins/files/icon.png +0 -0
- package/lib/ui/plugins/manifest.json +107 -0
- package/lib/ui/plugins/plugins/client.js +682 -0
- package/lib/ui/plugins/plugins/icon.png +0 -0
- package/lib/ui/plugins/preview/client.js +197 -0
- package/lib/ui/plugins/preview/icon.png +0 -0
- package/lib/ui/plugins/prompt/client.js +653 -0
- package/lib/ui/plugins/prompt/icon.png +0 -0
- package/lib/ui/plugins/sessions/client.js +1577 -0
- package/lib/ui/plugins/sessions/icon.png +0 -0
- package/lib/ui/plugins/settings/client.js +5470 -0
- package/lib/ui/plugins/settings/icon.png +0 -0
- package/lib/ui/plugins/skills/client.js +485 -0
- package/lib/ui/plugins/skills/icon.png +0 -0
- package/lib/ui/plugins/status/client.js +1420 -0
- package/lib/ui/plugins/status/icon.png +0 -0
- package/lib/ui/plugins/statusbar/client.js +504 -0
- package/lib/ui/plugins/statusbar/icon.png +0 -0
- package/lib/ui/plugins/tasks/client.js +52 -0
- package/lib/ui/plugins/tasks/icon.png +0 -0
- package/lib/ui/plugins/team/client.js +527 -0
- package/lib/ui/plugins/team/icon.png +0 -0
- package/lib/ui/plugins/terminal/client.js +232 -0
- package/lib/ui/plugins/terminal/icon.png +0 -0
- package/lib/ui/plugins/trace/client.js +1376 -0
- package/lib/ui/plugins/trace/icon.png +0 -0
- package/lib/ui/plugins/transcript/client.js +2661 -0
- package/lib/ui/plugins/transcript/icon.png +0 -0
- package/lib/ui/scoped-slots.d.ts +20 -0
- package/lib/ui/scoped-slots.js +21 -0
- package/lib/ui/sdk/@dsc/ui/index.d.ts +242 -0
- package/lib/ui/sdk/@dsc/ui/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-core/contract.d.ts +1973 -0
- package/lib/ui/sdk/@dsc/ui-core/core/diff-text.d.ts +74 -0
- package/lib/ui/sdk/@dsc/ui-core/core/dock-browser.d.ts +137 -0
- package/lib/ui/sdk/@dsc/ui-core/core/dock-ops.d.ts +59 -0
- package/lib/ui/sdk/@dsc/ui-core/core/model-caps.d.ts +83 -0
- package/lib/ui/sdk/@dsc/ui-core/core/native-bridge.d.ts +135 -0
- package/lib/ui/sdk/@dsc/ui-core/core/token-estimate.d.ts +55 -0
- package/lib/ui/sdk/@dsc/ui-core/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/arrival.d.ts +72 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/frames.d.ts +67 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/index.d.ts +59 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/manifest.d.ts +172 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/plugin.d.ts +161 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/scoped-slots.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/services-react.d.ts +27 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/services.d.ts +63 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/slots-react.d.ts +28 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/slots.d.ts +481 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/store.d.ts +89 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-model.d.ts +238 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-state.d.ts +163 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock.d.ts +24 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/index.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-layout/app.d.ts +74 -0
- package/lib/ui/sdk/@dsc/ui-layout/appearance.d.ts +70 -0
- package/lib/ui/sdk/@dsc/ui-layout/host-channel.d.ts +112 -0
- package/lib/ui/sdk/@dsc/ui-layout/index.d.ts +34 -0
- package/lib/ui/sdk/@dsc/ui-layout/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-layout/page-state.d.ts +14 -0
- package/lib/ui/sdk/@dsc/ui-layout/review-pane.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-layout/runtime-context.d.ts +44 -0
- package/lib/ui/sdk/@dsc/ui-layout/thread-view.d.ts +28 -0
- package/lib/ui/sdk/@dsc/ui-layout/update-button.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-primitives/code-file-icon-artwork.d.ts +53 -0
- package/lib/ui/sdk/@dsc/ui-primitives/code-view.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-primitives/compat.d.ts +27 -0
- package/lib/ui/sdk/@dsc/ui-primitives/completion-sound.d.ts +24 -0
- package/lib/ui/sdk/@dsc/ui-primitives/confirm.d.ts +33 -0
- package/lib/ui/sdk/@dsc/ui-primitives/css.d.ts +47 -0
- package/lib/ui/sdk/@dsc/ui-primitives/diff-rows.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-primitives/file-icons.d.ts +38 -0
- package/lib/ui/sdk/@dsc/ui-primitives/file-type-classify.d.ts +66 -0
- package/lib/ui/sdk/@dsc/ui-primitives/file-type-icon.d.ts +57 -0
- package/lib/ui/sdk/@dsc/ui-primitives/highlight.d.ts +24 -0
- package/lib/ui/sdk/@dsc/ui-primitives/hover-delay.d.ts +17 -0
- package/lib/ui/sdk/@dsc/ui-primitives/icons.d.ts +109 -0
- package/lib/ui/sdk/@dsc/ui-primitives/index.d.ts +55 -0
- package/lib/ui/sdk/@dsc/ui-primitives/lang-table.d.ts +10 -0
- package/lib/ui/sdk/@dsc/ui-primitives/markdown.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-primitives/native.d.ts +41 -0
- package/lib/ui/sdk/@dsc/ui-primitives/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-primitives/panels.d.ts +86 -0
- package/lib/ui/sdk/@dsc/ui-primitives/paths.d.ts +11 -0
- package/lib/ui/sdk/@dsc/ui-primitives/pdf-view.d.ts +13 -0
- package/lib/ui/sdk/@dsc/ui-primitives/plugin-text.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-primitives/select.d.ts +35 -0
- package/lib/ui/sdk/@dsc/ui-primitives/table-view.d.ts +23 -0
- package/lib/ui/sdk/@dsc/ui-primitives/thread-resizer.d.ts +22 -0
- package/lib/ui/sdk/@dsc/ui-primitives/time.d.ts +33 -0
- package/lib/ui/sdk/@dsc/ui-primitives/toast.d.ts +16 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tokens.d.ts +14 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tool-args.d.ts +49 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tool-summary.d.ts +64 -0
- package/lib/ui/sdk/@dsc/ui-renderer/boot.d.ts +121 -0
- package/lib/ui/sdk/@dsc/ui-renderer/hmr.d.ts +43 -0
- package/lib/ui/sdk/@dsc/ui-renderer/index.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-renderer/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-slots/index.d.ts +19 -0
- package/lib/ui/sdk/@dsc/ui-slots/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-slots/slots-react.d.ts +48 -0
- package/lib/ui/sdk/@dsc/ui-slots/slots.d.ts +102 -0
- package/lib/ui/services-react.d.ts +27 -0
- package/lib/ui/services-react.js +32 -0
- package/lib/ui/services.d.ts +63 -0
- package/lib/ui/services.js +121 -0
- package/lib/ui/slots-ink.d.ts +26 -0
- package/lib/ui/slots-ink.js +78 -0
- package/lib/ui/slots-react.d.ts +28 -0
- package/lib/ui/slots-react.js +88 -0
- package/lib/ui/slots.d.ts +481 -0
- package/lib/ui/slots.js +550 -0
- package/lib/ui/store.d.ts +89 -0
- package/lib/ui/store.js +62 -0
- package/lib/ui/tui-plugin-api.d.ts +23 -0
- package/lib/ui/tui-plugin-api.js +23 -0
- package/lib/ui/tui-plugins.d.ts +47 -0
- package/lib/ui/tui-plugins.js +220 -0
- package/package.json +58 -6
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 槽位注册表:界面上每一块「谁在什么位置放什么东西」由插件自己登记。
|
|
3
|
+
*
|
|
4
|
+
* 为什么要这一层(与 core/surface-registry.ts 同一套思路,但对象是**组件**不是数据):
|
|
5
|
+
* 原来界面是写死的——想加一个状态栏徽标就得改 App.tsx。有了注册表之后,
|
|
6
|
+
* 界面壳只负责声明「我有这几个位置」,谁往里放、放什么由功能点自己决定;
|
|
7
|
+
* 界面壳不认识任何具体功能。
|
|
8
|
+
*
|
|
9
|
+
* 刻意不依赖 React:同一份注册表要被两种壳复用(浏览器壳用 React 组件、
|
|
10
|
+
* TUI 壳用 ink 组件),所以这里对「组件」只当作一个泛型 C,不 import 任何框架。
|
|
11
|
+
*
|
|
12
|
+
* 四条规则(前三条对齐 dsh 的 ui-slots 语义):
|
|
13
|
+
* - **格子与遮蔽**:一种形态决定「什么算一个格子」——single 整个槽一个格子、
|
|
14
|
+
* list 每个 id 一个格子、keyed 每个 key 一个格子。同一个格子里可以合法地放多份,
|
|
15
|
+
* 按 `priority` 小者胜(这叫遮蔽);同格子同 priority 是装配错误,当场报错——
|
|
16
|
+
* 两个插件抢同一个位置必须让作者自己说清谁赢,不能靠加载顺序偷偷决定。
|
|
17
|
+
* - **崩溃退位**:一个条目在渲染期抛异常,注册表把它标成坏的并从格子里剔掉,
|
|
18
|
+
* 格子里的下一名顶上;坏掉的条目不会自己复活(要复活就重新注册)。
|
|
19
|
+
* - **往未声明的槽注册当场报错**,但可以用 `injectSlot` 说「等这个槽出现我再贡献」,
|
|
20
|
+
* 于是插件之间不再需要靠加载顺序排依赖。
|
|
21
|
+
* - **chain:条目自己选举**。每条登记带一个 `select(owner)` 选择器,渲染时按
|
|
22
|
+
* priority 升序依次问(小者先试,同值按注册序),第一个**不返回 null** 的当选;
|
|
23
|
+
* 全都弃权就落给渲染方的兜底。「谁负责展示这个工具调用」这类分派不再写死 if——
|
|
24
|
+
* 内置渲染器与第三方渲染器在**同一条链**里按优先级竞争。chain 没有格子的概念,
|
|
25
|
+
* 同 priority 允许多条并存(按注册序排队),register 也不做占用冲突检查。
|
|
26
|
+
*
|
|
27
|
+
* 2026-10-13 起加了一层**类型化契约**(D1):`SlotMap` / `SlotFactoryMap` 两张表由
|
|
28
|
+
* **插件 import 的那个模块**用 `declare module` 合并(web 面是 `ui-shell/src/plugin-api.ts`,
|
|
29
|
+
* TUI 面是 `src/ui/tui-plugin-api.ts`——合并只认词法相邻的声明,re-export 不参与),
|
|
30
|
+
* `register` / `registerFactory` 的槽名、owner props、children、chain select、席位份额
|
|
31
|
+
* 全部从表里推出来:插件作者写错一处,`tsc` 当场报错(负例钉在
|
|
32
|
+
* `ui-shell/src/slot-contract.typecheck.tsx`)。表在未收窄时(`SlotMapLike` /
|
|
33
|
+
* `FactoryMapLike`)键就是 string,等于不做类型检查——探针与 JS 插件走这条路。
|
|
34
|
+
*
|
|
35
|
+
* 另外两条机制(D2/D3):
|
|
36
|
+
* - **Factory**(D2):一份可复用的装配定义,无关的父位置各自渲染一次 occurrence,
|
|
37
|
+
* 调用方按 occurrence 选局部组件(定义内部用 `useFactorySlot` 取,没选就用 fallback);
|
|
38
|
+
* Factory 的 children 仍是普通槽,走同一条声明/登记/遮蔽的账。
|
|
39
|
+
* - **席位**(D3):登记时给一个 `StoreHandle`,该条目的组件拿到 `useStore` + `actions`
|
|
40
|
+
* (draft 已剥掉);**同一个 handle 对象**的多个登记共享一个实例,最后一个持有者
|
|
41
|
+
* 卸载时释放。跨插件共享走 A1 的 `provide`/`consume` 传 handle,席位本身不认字符串键。
|
|
42
|
+
*
|
|
43
|
+
* @module dsc/ui/slots
|
|
44
|
+
*/
|
|
45
|
+
import type { PropsStoreOf, SeatInstanceOf, StoreHandle } from './store.js';
|
|
46
|
+
/** 槽的四种形态:single/list/keyed 各管「几个格子」,chain 管「谁来渲染这一份」。 */
|
|
47
|
+
export type SlotKind = 'single' | 'list' | 'keyed' | 'chain';
|
|
48
|
+
/**
|
|
49
|
+
* 契约表里一条槽的形状底线:`kind` 必填;`owner` 是父在渲染调用点传的 props;
|
|
50
|
+
* `matched` 是 chain 选择器的返回值类型(组件 `matched` prop 从它推)。
|
|
51
|
+
*/
|
|
52
|
+
export interface SlotEntryLike {
|
|
53
|
+
kind: SlotKind;
|
|
54
|
+
owner?: object;
|
|
55
|
+
matched?: unknown;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 未收窄的开放表:键是任意 string。装载器、探针、TUI 的默认注册表用它,
|
|
59
|
+
* 等于「不做类型检查」;插件面用 declare module 把具体键并进自己的那份表。
|
|
60
|
+
*/
|
|
61
|
+
export interface SlotMapLike {
|
|
62
|
+
[key: string]: SlotEntryLike;
|
|
63
|
+
}
|
|
64
|
+
/** 表里的槽名(联合类型)。 */
|
|
65
|
+
export type SlotNameOf<M> = keyof M & string;
|
|
66
|
+
/** 某个槽的形态(表里没有就退回全宽 SlotKind)。 */
|
|
67
|
+
export type SlotKindOf<M, K extends keyof M & string> = M[K] extends {
|
|
68
|
+
kind: infer Kd extends SlotKind;
|
|
69
|
+
} ? Kd : SlotKind;
|
|
70
|
+
/** 某个槽的 owner 份额(表里没写 owner 就是空对象)。 */
|
|
71
|
+
export type SlotOwnerOf<M, K extends keyof M & string> = M[K] extends {
|
|
72
|
+
owner: infer O extends object;
|
|
73
|
+
} ? O : Record<never, never>;
|
|
74
|
+
/** 某个 chain 槽的 matched 类型(非 chain 给 never)。 */
|
|
75
|
+
export type SlotMatchedOf<M, K extends keyof M & string> = M[K] extends {
|
|
76
|
+
kind: 'chain';
|
|
77
|
+
matched: infer Mm;
|
|
78
|
+
} ? Mm : never;
|
|
79
|
+
/** 登记位能声明出来的子槽表:键从契约表取,形态必须是表里声明的那个。 */
|
|
80
|
+
export type SlotChildrenOf<M> = {
|
|
81
|
+
[P in keyof M & string]?: SlotKindOf<M, P>;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Factory 契约表里一条定义的形状底线:入参 props、children(普通槽)、
|
|
85
|
+
* 局部位置表、可选席位。表由 declare module 合并,键就是 Factory 名。
|
|
86
|
+
*/
|
|
87
|
+
export interface FactoryEntryLike {
|
|
88
|
+
props?: object;
|
|
89
|
+
children?: Record<string, SlotKind>;
|
|
90
|
+
slots?: Record<string, {
|
|
91
|
+
props?: object;
|
|
92
|
+
}>;
|
|
93
|
+
store?: StoreHandle<any, any>;
|
|
94
|
+
}
|
|
95
|
+
/** 未收窄的开放 Factory 表(同 {@link SlotMapLike})。 */
|
|
96
|
+
export interface FactoryMapLike {
|
|
97
|
+
[key: string]: FactoryEntryLike;
|
|
98
|
+
}
|
|
99
|
+
/** Factory 的 occurrence 输入 props(父在 renderFactorySlot 调用点传的)。 */
|
|
100
|
+
export type FactoryInputPropsOf<FM, F extends keyof FM & string> = FM[F] extends {
|
|
101
|
+
props: infer P extends object;
|
|
102
|
+
} ? P : object;
|
|
103
|
+
/** Factory 声明的普通子槽表(定义声明、定义渲染、任何插件可注册)。 */
|
|
104
|
+
export type FactoryChildrenOf<FM, F extends keyof FM & string> = FM[F] extends {
|
|
105
|
+
children: infer D extends Record<string, SlotKind>;
|
|
106
|
+
} ? D : Record<never, never>;
|
|
107
|
+
/** Factory 声明的局部位置表(父按 occurrence 选组件)。 */
|
|
108
|
+
export type FactoryLocalSlotsOf<FM, F extends keyof FM & string> = FM[F] extends {
|
|
109
|
+
slots: infer S extends Record<string, {
|
|
110
|
+
props?: object;
|
|
111
|
+
}>;
|
|
112
|
+
} ? S : Record<never, never>;
|
|
113
|
+
/** 局部位置名。 */
|
|
114
|
+
export type FactoryLocalNameOf<FM, F extends keyof FM & string> = keyof FactoryLocalSlotsOf<FM, F> & string;
|
|
115
|
+
/** 某个局部位置的输入 props(局部组件从父那里拿到的)。 */
|
|
116
|
+
export type FactoryLocalInputPropsOf<FM, F extends keyof FM & string, N extends FactoryLocalNameOf<FM, F>> = FactoryLocalSlotsOf<FM, F>[N] extends {
|
|
117
|
+
props: infer P extends object;
|
|
118
|
+
} ? P : object;
|
|
119
|
+
/** Factory 声明的席位句柄(没声明就是 undefined)。 */
|
|
120
|
+
export type FactoryStoreOf<FM, F extends keyof FM & string> = FM[F] extends {
|
|
121
|
+
store: infer H extends StoreHandle<any, any>;
|
|
122
|
+
} ? H : undefined;
|
|
123
|
+
/**
|
|
124
|
+
* 注册位组件的形状:裸调用签名(不用 FC)。参数逆变让「props 收窄的组件」天然可赋给
|
|
125
|
+
* 更宽的约束,FC 的静态成员只会帮倒忙。
|
|
126
|
+
*/
|
|
127
|
+
export type SlotComponentLike<P> = (props: P) => unknown;
|
|
128
|
+
/**
|
|
129
|
+
* 渲染能力份额:`renderSlot`(本条目声明过的子槽)+ `childSlots` + `renderFactorySlot`。
|
|
130
|
+
*
|
|
131
|
+
* 返回类型写成 `never` 是**故意的**:核心面不 import React,靠逆变(never 可赋给一切)
|
|
132
|
+
* 让这份约束仍能赋给契约面的 ReactNode 版本。写插件的组件看到的是 `@dsc/ui` 的
|
|
133
|
+
* `SlotComponentProps`(ReactNode 返回),不是这里。
|
|
134
|
+
*/
|
|
135
|
+
export interface SlotRenderShare<M, D, FM> {
|
|
136
|
+
renderSlot: <K extends keyof D & keyof M & string>(name: K, props?: SlotOwnerOf<M, K>) => never;
|
|
137
|
+
childSlots: readonly string[];
|
|
138
|
+
renderFactorySlot: RenderFactorySlotOf<M, FM>;
|
|
139
|
+
}
|
|
140
|
+
/** 渲染一次 Factory occurrence(父位置用的那个函数)。 */
|
|
141
|
+
export type RenderFactorySlotOf<M, FM> = <F extends keyof FM & string>(name: F, props?: FactoryInputPropsOf<FM, F>, options?: {
|
|
142
|
+
slots?: Partial<{
|
|
143
|
+
[N in FactoryLocalNameOf<FM, F>]: FactoryLocalComponentLike<M, FM, F, N>;
|
|
144
|
+
}>;
|
|
145
|
+
fallback?: unknown;
|
|
146
|
+
}) => never;
|
|
147
|
+
/** Factory 定义与局部组件共享的注册面:子槽渲染 + Factory 渲染 + 席位。 */
|
|
148
|
+
export type FactoryRegistrationShare<M, FM, F extends keyof FM & string> = SlotRenderShare<M, FactoryChildrenOf<FM, F>, FM> & PropsStoreOf<FactoryStoreOf<FM, F>>;
|
|
149
|
+
/** 父选的局部组件(输入位置:props 形状必须装得下注册面那份)。 */
|
|
150
|
+
export type FactoryLocalComponentLike<M, FM, F extends keyof FM & string, N extends FactoryLocalNameOf<FM, F>> = SlotComponentLike<FactoryLocalInputPropsOf<FM, F, N> & FactoryRegistrationShare<M, FM, F>>;
|
|
151
|
+
/**
|
|
152
|
+
* 定义内部选自局部组件的 hook:返回一个稳定组件(父没选就用 fallback)。
|
|
153
|
+
* 返回组件的返回值取 never(同 {@link SlotRenderShare} 的逆变理由)。
|
|
154
|
+
*/
|
|
155
|
+
export type UseFactorySlotOf<M, FM, F extends keyof FM & string> = <N extends FactoryLocalNameOf<FM, F>>(name: N, fallback: FactoryLocalComponentLike<M, FM, F, N>) => (props: FactoryLocalInputPropsOf<FM, F, N>) => never;
|
|
156
|
+
/** Factory 定义组件收到的 props(核心面)。 */
|
|
157
|
+
export type FactoryDefinitionPropsOf<M, FM, F extends keyof FM & string> = FactoryInputPropsOf<FM, F> & FactoryRegistrationShare<M, FM, F> & {
|
|
158
|
+
useFactorySlot: UseFactorySlotOf<M, FM, F>;
|
|
159
|
+
};
|
|
160
|
+
/** 注册位组件 props 全集(核心面:owner + matched + 渲染能力 + 席位)。 */
|
|
161
|
+
export type SlotPropsOf<M, K extends keyof M & string, D, H, FM> = SlotOwnerOf<M, K> & (SlotKindOf<M, K> extends 'chain' ? {
|
|
162
|
+
matched: SlotMatchedOf<M, K>;
|
|
163
|
+
} : object) & SlotRenderShare<M, D, FM> & PropsStoreOf<H>;
|
|
164
|
+
/** 按形态收窄的登记位字段:keyed 要 key、chain 要 select,其余只有 priority。 */
|
|
165
|
+
type KindFields<M, K extends keyof M & string> = SlotKindOf<M, K> extends 'keyed' ? {
|
|
166
|
+
key: string;
|
|
167
|
+
priority?: number;
|
|
168
|
+
} : SlotKindOf<M, K> extends 'chain' ? {
|
|
169
|
+
select: (owner: SlotOwnerOf<M, K>) => SlotMatchedOf<M, K> | null;
|
|
170
|
+
priority?: number;
|
|
171
|
+
} : {
|
|
172
|
+
priority?: number;
|
|
173
|
+
};
|
|
174
|
+
/** 注册一条登记时的字段(component 单独传)。 */
|
|
175
|
+
export type SlotRegisterOptions<M = SlotMapLike, K extends keyof M & string = keyof M & string, D extends SlotChildrenOf<M> = Record<never, never>, H extends StoreHandle<any, any> | undefined = undefined> = {
|
|
176
|
+
id: string;
|
|
177
|
+
/** 缺省 0;list 槽里决定横向次序。 */
|
|
178
|
+
order?: number;
|
|
179
|
+
/** 这条登记自己开出来的子槽(键从契约表取,形态必须与表一致)。 */
|
|
180
|
+
children?: D;
|
|
181
|
+
/** 席位:同一个 handle 的多个登记共享一个实例。 */
|
|
182
|
+
store?: H;
|
|
183
|
+
} & KindFields<M, K>;
|
|
184
|
+
/** Factory 声明表与 SlotMap 的对齐检查:children 的每个键都必须在 SlotMap 里、形态匹配。 */
|
|
185
|
+
type FactoryChildMismatchKeys<M, FM, F extends keyof FM & string> = {
|
|
186
|
+
[K in keyof FactoryChildrenOf<FM, F>]: K extends keyof M & string ? FactoryChildrenOf<FM, F>[K] extends SlotKindOf<M, K> ? never : K : K;
|
|
187
|
+
}[keyof FactoryChildrenOf<FM, F>];
|
|
188
|
+
type FactoryChildrenCheck<M, FM, F extends keyof FM & string> = [
|
|
189
|
+
FactoryChildMismatchKeys<M, FM, F>
|
|
190
|
+
] extends [never] ? unknown : {
|
|
191
|
+
'Factory 的 children 必须与 SlotMap 对齐(键在表里、形态一致)': FactoryChildMismatchKeys<M, FM, F>;
|
|
192
|
+
};
|
|
193
|
+
/** 注册一个 Factory 定义时的字段(component 单独传)。 */
|
|
194
|
+
export type SlotFactoryRegisterOptions<M, FM, F extends keyof FM & string> = {
|
|
195
|
+
name: F;
|
|
196
|
+
/** 声明的普通子槽必须与 SlotMap 对齐(见 FactoryChildrenCheck)。 */
|
|
197
|
+
children?: FactoryChildrenOf<FM, F>;
|
|
198
|
+
/** 登记时只声明「有哪几个局部位置」;每个位置的 props 形状在 SlotFactoryMap 里定。 */
|
|
199
|
+
slots?: Partial<Record<FactoryLocalNameOf<FM, F>, {
|
|
200
|
+
props?: object;
|
|
201
|
+
}>>;
|
|
202
|
+
/** 可选席位(第一版只支持共享 handle)。 */
|
|
203
|
+
store?: FactoryStoreOf<FM, F>;
|
|
204
|
+
} & FactoryChildrenCheck<M, FM, F>;
|
|
205
|
+
/** 已定义的 Factory(运行期记录;component 的类型在登记面收窄)。 */
|
|
206
|
+
export interface StoredFactory<C> {
|
|
207
|
+
name: string;
|
|
208
|
+
component: C;
|
|
209
|
+
/** 声明的普通子槽名(readonly 快照)。 */
|
|
210
|
+
children: readonly string[];
|
|
211
|
+
/** 声明的局部位置名。 */
|
|
212
|
+
slots: readonly string[];
|
|
213
|
+
/** 席位句柄;没声明是 null。 */
|
|
214
|
+
store: StoreHandle<any, any> | null;
|
|
215
|
+
}
|
|
216
|
+
/** 一条登记:某插件往某槽放了一个组件。 */
|
|
217
|
+
export interface SlotEntry<C> {
|
|
218
|
+
/** 槽名(父级声明的那个 id)。 */
|
|
219
|
+
slot: string;
|
|
220
|
+
/** 这条登记的稳定 id。 */
|
|
221
|
+
id: string;
|
|
222
|
+
/** 排序权重,小的在前;相同则按注册先后。 */
|
|
223
|
+
order: number;
|
|
224
|
+
/** 遮蔽权重,小的胜;同一个格子里 priority 相同就是冲突。 */
|
|
225
|
+
priority: number;
|
|
226
|
+
/** keyed 槽的分格键;其它槽为 null。 */
|
|
227
|
+
key: string | null;
|
|
228
|
+
/** 这条登记占的格子(single 恒为 '',list 是 id,keyed 是 key)。 */
|
|
229
|
+
cell: string;
|
|
230
|
+
/** 这条登记声明出来的子槽名(`renderSlot` 只认这几个名字)。 */
|
|
231
|
+
children: readonly string[];
|
|
232
|
+
/** chain 槽的选举选择器;其它形态为 null。 */
|
|
233
|
+
select: ((owner: unknown) => unknown) | null;
|
|
234
|
+
/** 组件本身(浏览器壳里是 React 组件,TUI 壳里是 ink 组件)。 */
|
|
235
|
+
component: C;
|
|
236
|
+
/** 登记时声明的席位句柄;没声明是 null。 */
|
|
237
|
+
store: StoreHandle<any, any> | null;
|
|
238
|
+
/** 注册序号:order 与 priority 都持平时的稳定次序。 */
|
|
239
|
+
seq: number;
|
|
240
|
+
}
|
|
241
|
+
/** 一次插件故障(渲染期异常、贡献回调抛错、卸载回调抛错)。 */
|
|
242
|
+
export interface SlotFault {
|
|
243
|
+
slot: string;
|
|
244
|
+
/** 出事的登记 id;贡献回调还没形成登记时是空串。 */
|
|
245
|
+
id: string;
|
|
246
|
+
/** 出在哪个阶段。 */
|
|
247
|
+
phase: 'render' | 'contribute' | 'dispose';
|
|
248
|
+
error: Error;
|
|
249
|
+
}
|
|
250
|
+
/** 往未声明的槽注册时抛这个:消息里带上已知槽名,省得去翻代码。 */
|
|
251
|
+
export declare class UndeclaredSlotError extends Error {
|
|
252
|
+
constructor(slot: string, known: readonly string[]);
|
|
253
|
+
}
|
|
254
|
+
/** 同一个槽被声明成两种形态时抛这个(两个功能点对同一个位置的期望不一致)。 */
|
|
255
|
+
export declare class SlotKindConflictError extends Error {
|
|
256
|
+
constructor(slot: string, declared: SlotKind, wanted: SlotKind);
|
|
257
|
+
}
|
|
258
|
+
/** 同一个格子、同一个 priority 有两条登记时抛这个(谁赢必须由作者自己说清)。 */
|
|
259
|
+
export declare class DuplicateSlotError extends Error {
|
|
260
|
+
constructor(slot: string, cell: string, priority: number, holder: string, incoming: string);
|
|
261
|
+
}
|
|
262
|
+
/** keyed 槽没给 key 时抛这个:不给 key 就等于把整槽压成一个格子,静默丢东西。 */
|
|
263
|
+
export declare class KeyedSlotKeyError extends Error {
|
|
264
|
+
constructor(slot: string);
|
|
265
|
+
}
|
|
266
|
+
/** chain 槽的登记没给选择器时抛这个:没有选择器的条目永远无法当选,只能是死登记。 */
|
|
267
|
+
export declare class ChainSlotSelectError extends Error {
|
|
268
|
+
constructor(slot: string);
|
|
269
|
+
}
|
|
270
|
+
/** 一次选举的结果:当选的登记 + 选择器交回来的 matched 值。 */
|
|
271
|
+
export interface SlotElectResult<C> {
|
|
272
|
+
entry: SlotEntry<C>;
|
|
273
|
+
/** 选择器的返回值原样透传(渲染层把它展开成组件的 `matched` prop)。 */
|
|
274
|
+
matched: unknown;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* 壳自己装配错了(子槽没声明、出口没在壳里)时抛这个。
|
|
278
|
+
*
|
|
279
|
+
* 与插件组件抛异常区分开:那种是「某个插件坏了,那一块不显示就行」;
|
|
280
|
+
* 这种是「壳和插件的契约没对上」,必须炸出来,不能被降级成一句界面文案。
|
|
281
|
+
*/
|
|
282
|
+
export declare class SlotAssemblyError extends Error {
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* 槽位注册表本体。
|
|
286
|
+
*
|
|
287
|
+
* @typeParam C - 组件类型。浏览器壳传 React 组件类型,TUI 壳传 ink 组件类型。
|
|
288
|
+
* @typeParam M - 槽位契约表(`SlotMap`)。默认是不收窄的开放表,等于不做类型检查。
|
|
289
|
+
* @typeParam FM - Factory 契约表(`SlotFactoryMap`)。同上。
|
|
290
|
+
*/
|
|
291
|
+
export declare class SlotRegistry<C = unknown, M = SlotMapLike, FM = FactoryMapLike> {
|
|
292
|
+
/** 已声明的槽:名字 → 形态 + 引用计数(引用计数让子槽可以被多份登记共享)。 */
|
|
293
|
+
private readonly kinds;
|
|
294
|
+
private readonly entries;
|
|
295
|
+
/** 渲染期崩过、已经退位的登记(不复活,重新注册才是一次新的机会)。 */
|
|
296
|
+
private readonly broken;
|
|
297
|
+
private readonly listeners;
|
|
298
|
+
/** 最近几十条故障(每次追加都换一个新数组,诊断区才能靠引用变化重渲染)。 */
|
|
299
|
+
private faultLog;
|
|
300
|
+
private readonly faultListeners;
|
|
301
|
+
/** 等槽声明的贡献者(槽一出现就跑,槽一消失就撤)。 */
|
|
302
|
+
private readonly waiters;
|
|
303
|
+
/**
|
|
304
|
+
* 席位账:handle → 引用计数 + 懒建的共享实例。
|
|
305
|
+
*
|
|
306
|
+
* 为什么按 handle 引用计数而不是按名字:席位的身份就是 handle 对象——两个登记给了
|
|
307
|
+
* 同一个 handle 才共享实例;没有字符串键,也就没有「同名冲突」这回事
|
|
308
|
+
* (跨插件要共享就走 `ui.provide`/`consume` 传同一个 handle,重名冲突落在服务表上)。
|
|
309
|
+
*/
|
|
310
|
+
private readonly seats;
|
|
311
|
+
/** 已定义的 Factory:名字 → 定义 + 版本(版本变化让渲染出口重订阅)。 */
|
|
312
|
+
private readonly factories;
|
|
313
|
+
private readonly factoryVersions;
|
|
314
|
+
private readonly factoryListeners;
|
|
315
|
+
/**
|
|
316
|
+
* `winners()` 的缓存,每个槽各自记下「算的时候那个槽的版本号」。
|
|
317
|
+
*
|
|
318
|
+
* 为什么要缓存:React 的 `useSyncExternalStore` 要求「没变就返回同一个引用」,
|
|
319
|
+
* 而 winners 每次都要新建数组(遮掉被顶掉的条目)。
|
|
320
|
+
* 为什么按槽记版本:一次登记只该让**那一个槽**的快照换引用。要是全局清缓存,
|
|
321
|
+
* 每个出口都会被判成「变了」,一次登记就放大成整页重渲染。
|
|
322
|
+
*/
|
|
323
|
+
private readonly winnersCache;
|
|
324
|
+
/** 每个槽各自的单调版本号(React 那边拿它当 useSyncExternalStore 的快照)。 */
|
|
325
|
+
private readonly versions;
|
|
326
|
+
private globalVersion;
|
|
327
|
+
private seq;
|
|
328
|
+
/**
|
|
329
|
+
* 声明一个槽(界面壳在加载任何插件之前声明自己有哪些位置)。
|
|
330
|
+
*
|
|
331
|
+
* 同一个名字、同一种形态重复声明是合法的(引用计数 +1),
|
|
332
|
+
* 这样多个条目可以把自己的子槽声明成同一个共享扩展点。
|
|
333
|
+
* @param slot - 槽名,约定用「区域.位置」形状,例如 `shell.main`、`statusbar.right`
|
|
334
|
+
* @param kind - 这个位置能容纳几份
|
|
335
|
+
* @returns 撤回这一次声明的函数(计数归零时,连带清掉槽里的登记与等待者)
|
|
336
|
+
*/
|
|
337
|
+
declare<K extends keyof M & string>(slot: K, kind: SlotKindOf<M, K>): () => void;
|
|
338
|
+
/** 类型擦除重载:壳内部按字符串声明(启动清单/SHELL_SLOTS 循环那种)。 */
|
|
339
|
+
declare(slot: string, kind: SlotKind): () => void;
|
|
340
|
+
/**
|
|
341
|
+
* 等一个槽声明出来再贡献(插件之间不必靠加载顺序排依赖)。
|
|
342
|
+
*
|
|
343
|
+
* 槽每次被声明都会跑一遍 `contribute`;槽被撤回时,`contribute` 交回来的
|
|
344
|
+
* 退订函数会被调用。于是「先加载的插件给后声明的槽加东西」不再失败。
|
|
345
|
+
* @param slot - 要等的槽名
|
|
346
|
+
* @param contribute - 槽存在时的贡献动作,可返回退订函数
|
|
347
|
+
* @returns 撤回这次等待(连带撤掉已经做出的贡献)
|
|
348
|
+
*/
|
|
349
|
+
injectSlot<K extends keyof M & string>(slot: K, contribute: () => void | (() => void)): () => void;
|
|
350
|
+
/**
|
|
351
|
+
* 往一个已声明的槽里登记组件。
|
|
352
|
+
*
|
|
353
|
+
* 类型面:槽名从契约表推,组件 props 约束由 owner/children/chain matched/席位份额
|
|
354
|
+
* 组装(`SlotPropsOf`)——传错 props 的组件在 `register` 这一行就编不过。
|
|
355
|
+
* @param slot - 槽名
|
|
356
|
+
* @param options - 登记 id、排序与遮蔽权重、子槽声明、席位
|
|
357
|
+
* @param component - 组件
|
|
358
|
+
* @returns 退订函数;插件卸载时调用,界面下一帧就没有它了
|
|
359
|
+
* @throws {UndeclaredSlotError} 槽没声明(想等它出现就用 `injectSlot`)
|
|
360
|
+
* @throws {KeyedSlotKeyError} keyed 槽没给 key
|
|
361
|
+
* @throws {ChainSlotSelectError} chain 槽没给 select
|
|
362
|
+
* @throws {DuplicateSlotError} 同格子同 priority 已经被占
|
|
363
|
+
*/
|
|
364
|
+
register<K extends keyof M & string, const D extends SlotChildrenOf<M> = Record<never, never>, H extends StoreHandle<any, any> | undefined = undefined>(slot: K, options: SlotRegisterOptions<M, K, D, H>, component: C & SlotComponentLike<SlotPropsOf<M, K, D, H, FM>>): () => void;
|
|
365
|
+
/**
|
|
366
|
+
* 让一个 chain 槽为这份 owner 值选出渲染者。
|
|
367
|
+
*
|
|
368
|
+
* 按 priority 升序逐个问选择器(同 priority 按注册序),第一个不返回 null 的当选;
|
|
369
|
+
* 选择器抛异常视同弃权(记一条故障,链继续走——一个坏选择器不该烧掉整条链);
|
|
370
|
+
* 全部弃权(或槽里没有幸存者)返回 null,渲染方画自己的兜底。
|
|
371
|
+
* @param slot - chain 形态的槽名
|
|
372
|
+
* @param owner - 渲染位置的上下文(例如「这一条工具调用」),原样交给选择器
|
|
373
|
+
* @throws {Error} 槽不是 chain 形态时抛装配错误(选举只对 chain 有意义)
|
|
374
|
+
*/
|
|
375
|
+
elect<K extends keyof M & string>(slot: K, owner: SlotOwnerOf<M, K>): SlotElectResult<C> | null;
|
|
376
|
+
/** 类型擦除重载:渲染出口按字符串槽名调用(出口的 owner 保持 Record 擦除面)。 */
|
|
377
|
+
elect(slot: string, owner: unknown): SlotElectResult<C> | null;
|
|
378
|
+
/**
|
|
379
|
+
* 报一个条目的渲染期故障:这个条目退位,格子里的下一名顶上。
|
|
380
|
+
* @param entry - 出事的那条登记(组件拿到的就是它,所以身份是准的)
|
|
381
|
+
* @param error - 异常
|
|
382
|
+
*/
|
|
383
|
+
reportFault(entry: SlotEntry<C>, error: unknown): void;
|
|
384
|
+
/** 订阅故障(壳把最近几条画在诊断区,线上排错不必靠用户截图)。 */
|
|
385
|
+
onFault(handler: (fault: SlotFault) => void): () => void;
|
|
386
|
+
/** 目前攒下的故障(诊断区用)。 */
|
|
387
|
+
get faults(): readonly SlotFault[];
|
|
388
|
+
/** 已声明的槽名(按声明顺序,诊断与报错消息用)。 */
|
|
389
|
+
get slots(): string[];
|
|
390
|
+
/** 某个槽的形态;没声明过给 undefined。 */
|
|
391
|
+
spec<K extends keyof M & string>(slot: K): SlotKindOf<M, K> | undefined;
|
|
392
|
+
/** 类型擦除重载:壳内部按字符串查询(已声明槽的形态是运行期事实)。 */
|
|
393
|
+
spec(slot: string): SlotKind | undefined;
|
|
394
|
+
/** 某个槽里的全部登记(含被遮蔽的与被退位的,诊断用)。 */
|
|
395
|
+
entriesOf(slot: string): readonly SlotEntry<C>[];
|
|
396
|
+
/**
|
|
397
|
+
* 渲染一个槽时该画哪几条:每个格子取一名幸存者,再按 order 排显示序。
|
|
398
|
+
*
|
|
399
|
+
* 返回值在这个槽的版本号不变时引用稳定,可以直接当 `useSyncExternalStore` 的快照。
|
|
400
|
+
* @param slot - 槽名
|
|
401
|
+
*/
|
|
402
|
+
winners(slot: string): readonly SlotEntry<C>[];
|
|
403
|
+
/**
|
|
404
|
+
* 某个槽的单调版本号。
|
|
405
|
+
*
|
|
406
|
+
* 为什么不用「winners 数组」当 useSyncExternalStore 的快照:那要求注册表保证
|
|
407
|
+
* 引用稳定,一次登记就得把所有槽的缓存清掉(一个槽的变化会放大成整个界面的重渲染)。
|
|
408
|
+
* 版本号是标量,比较便宜,而且内容在渲染体里现读(读的时候一定是新的)。
|
|
409
|
+
*/
|
|
410
|
+
version(slot: string): number;
|
|
411
|
+
/** 全局单调版本号(诊断区那种「关心所有槽」的订阅者用)。 */
|
|
412
|
+
getVersion(): number;
|
|
413
|
+
/**
|
|
414
|
+
* 订阅登记变化。
|
|
415
|
+
* @param listener - 变化回调
|
|
416
|
+
* @param slot - 只关心这个槽;不传表示关心所有槽
|
|
417
|
+
* @returns 退订函数
|
|
418
|
+
*/
|
|
419
|
+
subscribe(listener: () => void, slot?: string): () => void;
|
|
420
|
+
/** 注册总数(诊断面板用)。 */
|
|
421
|
+
get size(): number;
|
|
422
|
+
/** 这个槽里有没有已被退位的条目(诊断面板标红用)。 */
|
|
423
|
+
brokenCount(slot: string): number;
|
|
424
|
+
/**
|
|
425
|
+
* 读一个席位的共享实例(**该 handle 已有登记**才给实例)。
|
|
426
|
+
*
|
|
427
|
+
* 懒建时机与 dsh 一致:第一个渲染读(组件经 `useStore`,或持有 handle 的插件经这个方法)
|
|
428
|
+
* 才 `create()`。没有登记过这个 handle 就返回 undefined——席位不能凭空出现,
|
|
429
|
+
* 跨插件读之前先经 A1 的服务表拿到 handle(provider 卸载时服务先撤,这里自然读到 undefined)。
|
|
430
|
+
*/
|
|
431
|
+
seat<H extends StoreHandle<any, any>>(handle: H): SeatInstanceOf<H> | undefined;
|
|
432
|
+
/**
|
|
433
|
+
* 注册一个可复用的 Factory 定义(D2)。
|
|
434
|
+
*
|
|
435
|
+
* 运行期规则(照 dsh,逐条可测):
|
|
436
|
+
* - 同名第二次注册抛装配错误(一个名字只许一个定义);
|
|
437
|
+
* - children 与普通槽共用声明表(引用计数语义:同名同形态合法,形态冲突报错);
|
|
438
|
+
* - disposer 清定义 + collapse children(子槽的登记递归清掉,迟到的 disposer 变空操作)。
|
|
439
|
+
* @param options - 定义名、children、局部位置表、可选席位
|
|
440
|
+
* @param component - 定义组件(收 occurrence 输入 props + 注册能力 + useFactorySlot)
|
|
441
|
+
* @returns 退订函数(幂等)
|
|
442
|
+
*/
|
|
443
|
+
registerFactory<F extends keyof FM & string>(options: SlotFactoryRegisterOptions<M, FM, F>, component: C & SlotComponentLike<FactoryDefinitionPropsOf<M, FM, F>>): () => void;
|
|
444
|
+
/** 读一个已定义的 Factory;没定义过(或已卸下)给 undefined。 */
|
|
445
|
+
factory(name: string): StoredFactory<C> | undefined;
|
|
446
|
+
/** Factory 定义的单调版本号(渲染出口拿它当 useSyncExternalStore 的快照)。 */
|
|
447
|
+
factoryVersion(name: string): number;
|
|
448
|
+
/** 订阅某个 Factory 定义的增删(同名注册/卸载都会通知)。 */
|
|
449
|
+
subscribeFactory(name: string, listener: () => void): () => void;
|
|
450
|
+
/**
|
|
451
|
+
* 报一条 Factory 里的故障(定义组件或局部组件在渲染期抛异常)。
|
|
452
|
+
*
|
|
453
|
+
* 与条目的 `reportFault` 取向一致(记进同一本故障账,诊断区看得见),但**不摘除共享定义**:
|
|
454
|
+
* 定义是多个父位置共用的,一个 occurrence 崩了不能把别人的装配也打掉(dsh 的 reportFactoryError)。
|
|
455
|
+
* @param name - Factory 名
|
|
456
|
+
* @param id - 出事的定义/局部位置标识(诊断用)
|
|
457
|
+
* @param error - 异常
|
|
458
|
+
*/
|
|
459
|
+
reportFactoryFault(name: string, id: string, error: unknown): void;
|
|
460
|
+
/** 席位引用计数 +1(register/registerFactory 声明席位时)。 */
|
|
461
|
+
private holdSeat;
|
|
462
|
+
/** 席位引用计数 −1;最后一个持有者走了,实例随之消失(下次登记重新建)。 */
|
|
463
|
+
private releaseSeat;
|
|
464
|
+
/** Factory 版本号 +1 并通知关心这个定义的订阅者。 */
|
|
465
|
+
private bumpFactory;
|
|
466
|
+
/** 按 children 声明表把子槽开出来,返回一批退订函数。 */
|
|
467
|
+
private declareChildren;
|
|
468
|
+
/** 槽刚被声明:把所有等待者跑一遍。 */
|
|
469
|
+
private runWaiters;
|
|
470
|
+
/** 跑一个等待者的贡献动作(已经跑过就不重复跑)。 */
|
|
471
|
+
private runWaiter;
|
|
472
|
+
/** 槽被撤回:把所有等待者已经做出的贡献撤掉(等待关系留着,槽回来再贡献)。 */
|
|
473
|
+
private suspendWaiters;
|
|
474
|
+
/** 撤掉一个等待者的贡献。 */
|
|
475
|
+
private suspendWaiter;
|
|
476
|
+
/** 版本号 +1,然后通知关心这个槽(以及关心所有槽)的订阅者。 */
|
|
477
|
+
private bump;
|
|
478
|
+
/** 记一条故障并广播给监督者。 */
|
|
479
|
+
private record;
|
|
480
|
+
}
|
|
481
|
+
export {};
|