@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,78 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { TranscriptEntry } from '../contract.js';
|
|
3
|
+
import { type RegisterClick } from './click.js';
|
|
4
|
+
import { type TurnMark, type ViewportLayout } from './scroll-model.js';
|
|
5
|
+
/** 一次滚轮 = 几行(终端一格滚轮不分行,三行是「一格看得出动了」的最小值)。 */
|
|
6
|
+
export declare const WHEEL_LINES = 3;
|
|
7
|
+
/** 视口对外的手柄:App 的键位与鼠标处理打这里(视口自己持有滚动状态)。 */
|
|
8
|
+
export interface TranscriptViewportApi {
|
|
9
|
+
/** 按行滚:正数往上(看更早的)。 */
|
|
10
|
+
scrollLines: (delta: number) => void;
|
|
11
|
+
/** 跳到上/下一轮。 */
|
|
12
|
+
jumpTurn: (direction: 'up' | 'down') => void;
|
|
13
|
+
/** 跳到指定轮。 */
|
|
14
|
+
jumpToTurn: (index: number) => void;
|
|
15
|
+
/** 回到底部(跟尾)。 */
|
|
16
|
+
toTail: () => void;
|
|
17
|
+
/** 翻一页的行数(一屏减一行;视口行数自己量的,调用方不必知道)。 */
|
|
18
|
+
page: () => number;
|
|
19
|
+
/** 是不是贴着最新。 */
|
|
20
|
+
atTail: () => boolean;
|
|
21
|
+
/** 当前这份布局(测试与探针读)。 */
|
|
22
|
+
layout: () => ViewportLayout | null;
|
|
23
|
+
}
|
|
24
|
+
export interface TranscriptViewportProps {
|
|
25
|
+
/** 全量条目(顺序即时间序)。 */
|
|
26
|
+
entries: TranscriptEntry[];
|
|
27
|
+
/** 没画刻度栏时可用的内容宽度(列)——调用方按帧几何扣掉边框与内边距。 */
|
|
28
|
+
maxWidth: number;
|
|
29
|
+
/**
|
|
30
|
+
* 视口行数。省略 = **自己量**(聊天区下面是会变高的卡片与输入区,算不出固定值):
|
|
31
|
+
* 先用一个宽松的默认值起排(尾锚定不受它影响,画面本来就是对的),量到真值后重排一次。
|
|
32
|
+
*/
|
|
33
|
+
viewportLines?: number;
|
|
34
|
+
/** 终端总列数(刻度栏门槛与它自己占的列数用)。 */
|
|
35
|
+
columns: number;
|
|
36
|
+
/**
|
|
37
|
+
* 刻度栏**居中**用的高度(省略 = 视口行数)。视口行数会随页脚变(「回到底部」胶囊、
|
|
38
|
+
* 草稿行数),按它居中会让整块刻度每滚一下挪一格;调用方传一个「只在终端改变尺寸时才变」
|
|
39
|
+
* 的高度(聊天区是「帧高 − 状态栏」),刻度栏就静止了。
|
|
40
|
+
*/
|
|
41
|
+
railCenterLines?: number;
|
|
42
|
+
/**
|
|
43
|
+
* 思考块当前是不是展开的:只影响**没量到过的**条目的行数估算(一条思考块展开态十几行、
|
|
44
|
+
* 折叠态只画两行)。估错了会连带「跳过段」的高度一起错,表现出来就是「滚轮前几格不动、
|
|
45
|
+
* 再滚一下弹回底部」。
|
|
46
|
+
*/
|
|
47
|
+
expandThinking?: boolean;
|
|
48
|
+
/** 一条条目怎么画。 */
|
|
49
|
+
renderEntry: (entry: TranscriptEntry) => ReactNode;
|
|
50
|
+
/** 画不画右侧刻度栏(浮层画;窄屏由 `railEligible` 再判一次)。 */
|
|
51
|
+
showRail?: boolean;
|
|
52
|
+
registerClick?: RegisterClick;
|
|
53
|
+
/** 「是不是贴着最新」变化时回调(聊天那颗回到底部的胶囊用)。 */
|
|
54
|
+
onAtTailChange?: (atTail: boolean) => void;
|
|
55
|
+
/** 没有条目时的占位文案。 */
|
|
56
|
+
emptyHint?: string;
|
|
57
|
+
/**
|
|
58
|
+
* 挂在**流最顶上**的块(聊天区的启动欢迎页):随内容一起从顶上滚走,所以它是流里的
|
|
59
|
+
* 第一个「条目」(占行、参与行高表),不是固定表头。
|
|
60
|
+
*/
|
|
61
|
+
leading?: ReactNode;
|
|
62
|
+
/** 视口顶部固定的内容(浮层标题行这类,不参与滚动)。 */
|
|
63
|
+
header?: (layout: ViewportLayout) => ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* **浮在视口第一行上**的钉住块(聊天的「当前轮题面」):零高容器 + 负 `marginTop`,压在
|
|
66
|
+
* 内容第一行上,而不是挤掉一行。
|
|
67
|
+
*
|
|
68
|
+
* 为什么不占一行(两条都是用户报过的):占一行会改内容坐标——同样格数滚上去再滚回来就差
|
|
69
|
+
* 一行到不了底;也会把右侧刻度栏整体推下去一格(「上下滑动时刻度会上下晃」)。浮上去之后
|
|
70
|
+
* 视口、刻度、滚动坐标全部不动,代价是**可见内容少一行**(与 dsh 挤掉一行的观感一致)。
|
|
71
|
+
*
|
|
72
|
+
* 只有滚离尾部(`top !== null`)时才给「当前轮」;第三参是正文列宽(盖满第一行用)。
|
|
73
|
+
*/
|
|
74
|
+
pinned?: (active: TurnMark, layout: ViewportLayout, width: number) => ReactNode;
|
|
75
|
+
/** 视口底部固定的内容(提示行、回到底部胶囊)。 */
|
|
76
|
+
footer?: ReactNode;
|
|
77
|
+
}
|
|
78
|
+
export declare const TranscriptViewport: import("react").ForwardRefExoticComponent<TranscriptViewportProps & import("react").RefAttributes<TranscriptViewportApi>>;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 转录视口:把一段条目按**行**滚动地画在定高区域里,右侧带轮数刻度栏。
|
|
4
|
+
*
|
|
5
|
+
* 结构(自上而下):
|
|
6
|
+
* [上占位 spacer] + [窗口内的条目] + [下占位 spacer]
|
|
7
|
+
* 整叠内容 `flexShrink={0}` + `marginBottom={-shift}`,装在定高、`overflowY="hidden"`、
|
|
8
|
+
* `justifyContent="flex-end"` 的裁剪盒里——尾锚定 + 负 margin 就是逐行滚动(ink 按行
|
|
9
|
+
* 裁切越界文本,见 `render-node-to-output.js` / `output.js`),折行也跟着走,不用自己算。
|
|
10
|
+
* spacer 让内容总高恒等于估算总行数,于是「视口顶落在第几行」就是全部滚动状态。
|
|
11
|
+
*
|
|
12
|
+
* 滚动状态是 **视口顶的内容行号 `top`**(null = 跟尾)而不是「距尾部多少行」:队友还在
|
|
13
|
+
* 往尾部写的时候,距尾部计数会被新内容推着走——你正读到的地方会被顶下去;钉住顶行号才
|
|
14
|
+
* 站得住(在顶部以上的条目已定稿、不可变,所以钉住是稳的)。
|
|
15
|
+
*
|
|
16
|
+
* 行高表:渲染前从上一帧量到的行里取真值(`measuredHeight`),没量过的用估算
|
|
17
|
+
* (`scroll-model.estimateLines`);内容宽度一改(刻度栏出现/消失)表就整表作废。
|
|
18
|
+
* settled 条目不可变,所以量到一次就永久有效;只有 live 尾每帧重测。
|
|
19
|
+
*
|
|
20
|
+
* 视口行数由调用方按帧几何算好传进来(浮层是「帧行数 − 状态栏 − 浮层框架」,聊天是
|
|
21
|
+
* 「帧行数 − 状态栏 − 聊天框架」),不在这里量,免得首帧拿不到数。
|
|
22
|
+
*
|
|
23
|
+
* @module dsc-tui/app/TranscriptViewport
|
|
24
|
+
*/
|
|
25
|
+
import { Box, Text } from 'ink';
|
|
26
|
+
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
27
|
+
import { measuredHeight } from './click.js';
|
|
28
|
+
import { activeTurnIndex, anchorAtRow, estimateLines, HeightCache, layoutViewport, railEligible, railGeometry, RAIL_MIN_COLUMNS, RAIL_WIDTH, rowOfAnchor, turnJumpTarget, } from './scroll-model.js';
|
|
29
|
+
import { TimelineRail } from './TimelineRail.js';
|
|
30
|
+
import { GAP, INDENT, TEXT } from './theme.js';
|
|
31
|
+
/** 流头部(聊天区的欢迎块)在行高表里的哨兵 id——它不是真条目,但占行、要参与排版。 */
|
|
32
|
+
const LEADING_ID = -1_000_000;
|
|
33
|
+
/** 一次滚轮 = 几行(终端一格滚轮不分行,三行是「一格看得出动了」的最小值)。 */
|
|
34
|
+
export const WHEEL_LINES = 3;
|
|
35
|
+
export const TranscriptViewport = forwardRef(function TranscriptViewport({ entries, maxWidth, viewportLines, columns, railCenterLines, expandThinking, renderEntry, showRail = false, registerClick, onAtTailChange, emptyHint, leading, header, pinned, footer }, ref) {
|
|
36
|
+
/** 视口顶的**内容锚点**(哪一条的第几行);null = 跟尾(新内容长出来就一直跟着尾巴)。 */
|
|
37
|
+
const [anchor, setAnchor] = useState(null);
|
|
38
|
+
/** 自己量到的裁剪盒高度(`viewportLines` 省略时用;`flexGrow` 撑出来的高度量不到就先用默认)。 */
|
|
39
|
+
const [selfLines, setSelfLines] = useState(0);
|
|
40
|
+
const boxRef = useRef(null);
|
|
41
|
+
const lines = viewportLines ?? (selfLines > 0 ? selfLines : 30);
|
|
42
|
+
/** 行高表(宽度变了自动作废)。 */
|
|
43
|
+
const heights = useRef(new HeightCache()).current;
|
|
44
|
+
const nodes = useRef(new Map());
|
|
45
|
+
const atTail = useRef(true);
|
|
46
|
+
/** 本轮量到「与估算不符」的条数(>0 就要按真值重排一次)。 */
|
|
47
|
+
const fixups = useRef(0);
|
|
48
|
+
// 流头部当成一条「伪条目」参与排版:占它的行、跟着滚,但不进窗口的 renderEntry
|
|
49
|
+
const layoutEntries = leading === undefined
|
|
50
|
+
? entries
|
|
51
|
+
: [{ kind: 'system', id: LEADING_ID, text: '' }, ...entries];
|
|
52
|
+
/** id → 条目(量到真值时查它的估算值)。 */
|
|
53
|
+
const byId = new Map(layoutEntries.map((entry) => [entry.id, entry]));
|
|
54
|
+
/** 估算口径:必须与实际渲染口径一致(思考块展开与否差十几行)。 */
|
|
55
|
+
const estimate = { expandThinking: expandThinking === true };
|
|
56
|
+
// 刻度栏先按列数定「要不要给它留位」;画不画再按轮数/内容高度复核(不画就把列还给正文)
|
|
57
|
+
const wantRail = showRail && columns >= RAIL_MIN_COLUMNS;
|
|
58
|
+
const width = Math.max(20, maxWidth - (wantRail ? RAIL_WIDTH : 0));
|
|
59
|
+
heights.useWidth(width);
|
|
60
|
+
// 渲染前先把上一帧量到的行数收进行高表:这一帧的布局就能用上真值。
|
|
61
|
+
// (读的是上一帧的 yoga 几何——`click.ts` 的命中判定也是这么「用的时候才量」。)
|
|
62
|
+
// 只有「首次量到、且与估算不符」才记一笔重排请求:纯文本条目估算本来就准,不必多排,
|
|
63
|
+
// 否则流式增量(每条都要新量一次)会把提交次数拖着翻倍。
|
|
64
|
+
for (const [id, node] of nodes.current) {
|
|
65
|
+
const measured = measuredHeight(node);
|
|
66
|
+
if (measured === null)
|
|
67
|
+
continue;
|
|
68
|
+
const known = heights.get(id);
|
|
69
|
+
heights.set(id, measured);
|
|
70
|
+
if (known !== undefined)
|
|
71
|
+
continue;
|
|
72
|
+
const entry = byId.get(id);
|
|
73
|
+
if (entry !== undefined && estimateLines(entry, width, estimate) !== measured)
|
|
74
|
+
fixups.current += 1;
|
|
75
|
+
}
|
|
76
|
+
// 布局:锚点 → 视口顶行号 → 窗口切片与滚动量。刻度栏占不占位要按「画出来没有」
|
|
77
|
+
// 复核,所以可能按两个宽度各排一次(`railOn` 为假时把 2 列还给正文,下一帧就正)。
|
|
78
|
+
const measuredLayout = layoutViewport(layoutEntries, heights, { width, viewportLines: lines, anchor, ...estimate });
|
|
79
|
+
const railOn = wantRail &&
|
|
80
|
+
railEligible({
|
|
81
|
+
columns,
|
|
82
|
+
turnCount: measuredLayout.turns.length,
|
|
83
|
+
viewportLines: lines,
|
|
84
|
+
contentLines: measuredLayout.totalLines,
|
|
85
|
+
});
|
|
86
|
+
const layout = railOn || !wantRail
|
|
87
|
+
? measuredLayout
|
|
88
|
+
: layoutViewport(layoutEntries, heights, { width: maxWidth, viewportLines: lines, anchor, ...estimate });
|
|
89
|
+
const windowEntries = layoutEntries.slice(layout.start, layout.end);
|
|
90
|
+
const turns = layout.turns;
|
|
91
|
+
const activeIndex = activeTurnIndex(turns, layout.shift, layout, lines);
|
|
92
|
+
const viewportTop = Math.max(0, layout.totalLines - lines - layout.shift);
|
|
93
|
+
// 刻度栏照 dsh:块纵向居中、两头的箭头永远画(没有目标画暗色),窗口贴尾时钉在最新。
|
|
94
|
+
// 居中高度用调用方给的稳定值(视口行数会随页脚变化,按它居中会「滚动时刻度上下晃」)
|
|
95
|
+
const geometry = railOn
|
|
96
|
+
? railGeometry({
|
|
97
|
+
turnCount: turns.length,
|
|
98
|
+
activeIndex,
|
|
99
|
+
rows: lines,
|
|
100
|
+
centerRows: railCenterLines,
|
|
101
|
+
atBottom: layout.shift === 0,
|
|
102
|
+
viewportTop,
|
|
103
|
+
maxTop: layout.maxShift,
|
|
104
|
+
turnTops: turns.map((turn) => turn.top),
|
|
105
|
+
})
|
|
106
|
+
: null;
|
|
107
|
+
// 轮数不够(<2 轮)或画不下就整列不画——右边空着,正文也不必让位
|
|
108
|
+
const contentWidth = railOn ? width : maxWidth;
|
|
109
|
+
// 浮在视口第一行上的钉住块(只在滚离尾部、且真有当前轮时给):内容坐标不动,它只是压在第一行上
|
|
110
|
+
const activeTurn = turns[activeIndex];
|
|
111
|
+
const pinnedNode = pinned === undefined || layout.top === null || activeTurn === undefined
|
|
112
|
+
? null
|
|
113
|
+
: pinned(activeTurn, layout, contentWidth);
|
|
114
|
+
// 手柄与夹界都读「刚画出去的那一帧」:键位/鼠标发生在帧之后,读到的是最新值
|
|
115
|
+
const layoutRef = useRef(layout);
|
|
116
|
+
layoutRef.current = layout;
|
|
117
|
+
const linesRef = useRef(lines);
|
|
118
|
+
linesRef.current = lines;
|
|
119
|
+
/** 本帧参与排版的条目(含流头部伪条目):滚动手柄按行号换算锚点时要查它。 */
|
|
120
|
+
const layoutEntriesRef = useRef(layoutEntries);
|
|
121
|
+
layoutEntriesRef.current = layoutEntries;
|
|
122
|
+
/**
|
|
123
|
+
* 往上/往下滚 delta 行(正数 = 往更早的看)。
|
|
124
|
+
*
|
|
125
|
+
* 两条都踩过(用户报的「连滚不动 + 突然弹回底部」):
|
|
126
|
+
* - **必须用函数式更新**:终端把连续几格滚轮合并成一包是常态,一个任务里会连着调
|
|
127
|
+
* 好几次;若每次都读「上一次渲染时的位置」来算,几次都从同一个基准起算,最后只有
|
|
128
|
+
* 一格生效——五格滚轮只走三行。函数式更新拿的是累积后的最新值,几格就是几格。
|
|
129
|
+
* - **行号算完立刻换成锚点**:行号是估算坐标系里的坐标,跳过段一旦被量到真值就缩水,
|
|
130
|
+
* 同一个行号指的内容会变;钉成「哪一条的第几行」之后,跳过段怎么变视线都不动
|
|
131
|
+
* (见 `scroll-model.ScrollAnchor`)。
|
|
132
|
+
*/
|
|
133
|
+
const scrollLines = useCallback((delta) => {
|
|
134
|
+
setAnchor((previous) => {
|
|
135
|
+
const current = layoutRef.current;
|
|
136
|
+
const entries = layoutEntriesRef.current;
|
|
137
|
+
const from = previous === null ? current.maxShift : rowOfAnchor(current.rows, entries, previous);
|
|
138
|
+
const next = Math.max(0, Math.min(current.maxShift, from - delta));
|
|
139
|
+
return anchorAtRow(current.rows, entries, next, current.maxShift);
|
|
140
|
+
});
|
|
141
|
+
}, []);
|
|
142
|
+
const jumpToTurn = useCallback((index) => {
|
|
143
|
+
const current = layoutRef.current;
|
|
144
|
+
const turn = current.turns[index];
|
|
145
|
+
if (turn === undefined)
|
|
146
|
+
return;
|
|
147
|
+
// 锚在那一条的第 0 行:跳轮之后跳过段再怎么量,题面都待在视口顶
|
|
148
|
+
const maxTop = Math.max(0, current.totalLines - linesRef.current);
|
|
149
|
+
const row = Math.min(turn.top, maxTop);
|
|
150
|
+
setAnchor(anchorAtRow(current.rows, layoutEntriesRef.current, row, current.maxShift));
|
|
151
|
+
}, []);
|
|
152
|
+
/** 刻度悬停读数条上的题面预览(轮下标 → 该轮题面首行;读的是上一帧的布局与条目表)。 */
|
|
153
|
+
const turnPreview = useCallback((turn) => {
|
|
154
|
+
const mark = layoutRef.current.turns[turn];
|
|
155
|
+
const entry = mark === undefined ? undefined : layoutEntriesRef.current[mark.index];
|
|
156
|
+
if (entry === undefined || entry.kind !== 'user')
|
|
157
|
+
return null;
|
|
158
|
+
return entry.text.replace(/\s+/g, ' ').trim();
|
|
159
|
+
}, []);
|
|
160
|
+
const jumpTurn = useCallback((direction) => {
|
|
161
|
+
const current = layoutRef.current;
|
|
162
|
+
const viewport = Math.max(0, current.totalLines - lines - current.shift);
|
|
163
|
+
// 箭头的目标与刻度栏用同一条纯函数(`[`/`]` 键与点击不会给出不同的落点)
|
|
164
|
+
const next = turnJumpTarget({
|
|
165
|
+
turnCount: current.turns.length,
|
|
166
|
+
activeIndex: activeTurnIndex(current.turns, current.shift, current, lines),
|
|
167
|
+
direction,
|
|
168
|
+
viewportTop: viewport,
|
|
169
|
+
maxTop: current.maxShift,
|
|
170
|
+
turnTops: current.turns.map((turn) => turn.top),
|
|
171
|
+
});
|
|
172
|
+
if (next !== null)
|
|
173
|
+
jumpToTurn(next);
|
|
174
|
+
}, [jumpToTurn, lines]);
|
|
175
|
+
useImperativeHandle(ref, () => ({
|
|
176
|
+
scrollLines,
|
|
177
|
+
jumpTurn,
|
|
178
|
+
jumpToTurn,
|
|
179
|
+
toTail: () => setAnchor(null),
|
|
180
|
+
page: () => Math.max(1, linesRef.current - 1),
|
|
181
|
+
atTail: () => layoutRef.current.shift === 0,
|
|
182
|
+
layout: () => layoutRef.current,
|
|
183
|
+
}), [jumpToTurn, jumpTurn, scrollLines]);
|
|
184
|
+
const atTailNow = layout.shift === 0;
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
if (atTail.current === atTailNow)
|
|
187
|
+
return;
|
|
188
|
+
atTail.current = atTailNow;
|
|
189
|
+
onAtTailChange?.(atTailNow);
|
|
190
|
+
}, [atTailNow, onAtTailChange]);
|
|
191
|
+
/**
|
|
192
|
+
* 量到的真值要「落地一次」:首帧的位置全是估算出来的,排完这一帧才拿到真实行高——
|
|
193
|
+
* 不重排一次,首屏就可能停在错误的行上(试过:可视区里出现半屏空占位)。
|
|
194
|
+
* 签名只看「条目数 + 已量条数」,所以流式增量不会反复触发(那是同一个签名),
|
|
195
|
+
* 只有「新条目进来」或「又量到一批」才多排一帧,且必然收敛。
|
|
196
|
+
*/
|
|
197
|
+
const [, setPass] = useState(0);
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
if (viewportLines !== undefined)
|
|
200
|
+
return;
|
|
201
|
+
const measured = measuredHeight(boxRef.current);
|
|
202
|
+
if (measured === null || measured === selfLines)
|
|
203
|
+
return;
|
|
204
|
+
setSelfLines(measured);
|
|
205
|
+
});
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if (fixups.current === 0)
|
|
208
|
+
return;
|
|
209
|
+
fixups.current = 0;
|
|
210
|
+
setPass((current) => current + 1);
|
|
211
|
+
});
|
|
212
|
+
return (_jsxs(Box, { flexDirection: "column", flexGrow: 1, minHeight: 0, children: [header?.(layout), _jsxs(Box, { flexDirection: "row", minHeight: 0, flexGrow: 1, children: [_jsx(Box, { ref: boxRef, flexDirection: "column", width: contentWidth, ...(viewportLines === undefined ? { flexGrow: 1, minHeight: 0 } : { height: viewportLines, flexShrink: 0 }), overflowY: "hidden", justifyContent: "flex-end", children: _jsxs(Box, { flexDirection: "column", flexShrink: 0, gap: GAP.none, marginBottom: -layout.shift, children: [layout.aboveLines > 0 ? _jsx(Box, { height: layout.aboveLines, flexShrink: 0 }) : null, windowEntries.map((entry) => (_jsx(Box, { ref: (node) => {
|
|
213
|
+
if (node === null)
|
|
214
|
+
nodes.current.delete(entry.id);
|
|
215
|
+
else
|
|
216
|
+
nodes.current.set(entry.id, node);
|
|
217
|
+
}, flexDirection: "column", flexShrink: 0, gap: GAP.none, children: entry.id === LEADING_ID ? leading : renderEntry(entry) }, entry.id))), layout.belowLines > 0 ? _jsx(Box, { height: layout.belowLines, flexShrink: 0 }) : null, layoutEntries.length === 0 ? (_jsx(Box, { marginLeft: INDENT.detail, children: _jsx(Text, { ...TEXT.secondary, children: emptyHint ?? '(这个会话还没有条目)' }) })) : null, pinnedNode === null ? null : (_jsx(Box, { height: 0, flexShrink: 0, children: _jsx(Box, { marginTop: -(lines + layout.shift), flexDirection: "column", children: pinnedNode }) }))] }) }), geometry !== null ? (_jsx(TimelineRail, { geometry: geometry, registerClick: registerClick, onPickTurn: jumpToTurn, turnText: turnPreview })) : null] }), footer] }));
|
|
218
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 启动欢迎块(0.6.58 对齐 dsh-TUI LogoV2 的规格):「PNEUMA」5 行点阵大字
|
|
4
|
+
* (行色按 品牌蓝→浅冰 渐变)+ `✦ Pneuma vX` 词标 + model/cwd/tips 信息行 +
|
|
5
|
+
* tagline,**挂在会话流最顶上、随内容从顶上自然滚走**(codex session header /
|
|
6
|
+
* dsh LogoHeader 同构),不是独立路由。
|
|
7
|
+
*
|
|
8
|
+
* 阶梯降级(对齐 dsh splashLayout):终端行数 ≥ 30 且列数 ≥ 40 → 全块(大字
|
|
9
|
+
* 35 列宽,故列数门槛 40);行数 ≥ 12 → 只留词标+信息行;其余一行式。resume
|
|
10
|
+
* 长会话(条目 ≥ 30)直接不画——再画只是把历史往下顶。纯展示,信息行的暗淡档
|
|
11
|
+
* 让位给正文。
|
|
12
|
+
*
|
|
13
|
+
* @module dsc-tui/app/Welcome
|
|
14
|
+
*/
|
|
15
|
+
import { Box, Text, useStdout } from 'ink';
|
|
16
|
+
import { DSC_VERSION } from '../core/version.js';
|
|
17
|
+
import { KEYS } from './keymap.js';
|
|
18
|
+
import { GAP, PALETTE, TEXT } from './theme.js';
|
|
19
|
+
/** 5 行 × 5 列点阵字形(方块字,参照 dsh splashFonts 的 bold 款)。 */
|
|
20
|
+
const GLYPHS = {
|
|
21
|
+
M: ['█ █', '██ ██', '█ █ █', '█ █', '█ █'],
|
|
22
|
+
U: ['█ █', '█ █', '█ █', '█ █', '▀▀▀▀▀'],
|
|
23
|
+
S: ['▀▀▀▀█', '█ ', '▀▀▀▀ ', ' █', '▀▀▀▀▀'],
|
|
24
|
+
E: ['█████', '█ ', '████ ', '█ ', '█████'],
|
|
25
|
+
C: ['█████', '█ ', '█ ', '█ ', '█████'],
|
|
26
|
+
O: ['█████', '█ █', '█ █', '█ █', '█████'],
|
|
27
|
+
D: ['████ ', '█ █', '█ █', '█ █', '████ '],
|
|
28
|
+
P: ['█████', '█ █', '█████', '█ ', '█ '],
|
|
29
|
+
N: ['█ █', '██ █', '█ █ █', '█ ██', '█ █'],
|
|
30
|
+
A: ['█████', '█ █', '█████', '█ █', '█ █'],
|
|
31
|
+
' ': [' ', ' ', ' ', ' ', ' '],
|
|
32
|
+
};
|
|
33
|
+
/** 一个词的 5 行点阵(字形间 1 列空隙)。 */
|
|
34
|
+
const wordRows = (word) => {
|
|
35
|
+
const rows = ['', '', '', '', ''];
|
|
36
|
+
for (const char of word) {
|
|
37
|
+
const glyph = GLYPHS[char] ?? GLYPHS[' '];
|
|
38
|
+
for (let r = 0; r < 5; r += 1)
|
|
39
|
+
rows[r] += `${glyph[r]} `;
|
|
40
|
+
}
|
|
41
|
+
return rows.map((row) => row.trimEnd());
|
|
42
|
+
};
|
|
43
|
+
/** hex → rgb → 线性插值 → hex(大字的行渐变)。 */
|
|
44
|
+
const lerpColor = (from, to, t) => {
|
|
45
|
+
const channel = (text, offset) => Number.parseInt(text.slice(offset, offset + 2), 16);
|
|
46
|
+
const mix = (a, b) => Math.round(a + (b - a) * t);
|
|
47
|
+
const r = mix(channel(from, 1), channel(to, 1));
|
|
48
|
+
const g = mix(channel(from, 3), channel(to, 3));
|
|
49
|
+
const b = mix(channel(from, 5), channel(to, 5));
|
|
50
|
+
return `#${[r, g, b].map((part) => part.toString(16).padStart(2, '0')).join('')}`;
|
|
51
|
+
};
|
|
52
|
+
/** 一行点阵按渐变色渲染。 */
|
|
53
|
+
function BigWord({ rows, from, to }) {
|
|
54
|
+
return (_jsx(Box, { flexDirection: "column", children: rows.map((row, index) => (_jsx(Text, { bold: true, color: lerpColor(from, to, index / 4), children: row }, index))) }));
|
|
55
|
+
}
|
|
56
|
+
/** cwd 尾部显示:太长时只留最后两段(与 StatusBar 同一规则)。 */
|
|
57
|
+
const shortCwd = (cwd) => {
|
|
58
|
+
const parts = cwd.split(/[\\/]/).filter((part) => part !== '');
|
|
59
|
+
return parts.length <= 2 ? cwd : `…${parts.slice(-2).join('/')}`;
|
|
60
|
+
};
|
|
61
|
+
export function Welcome({ model, effort, cwd, }) {
|
|
62
|
+
const { stdout } = useStdout();
|
|
63
|
+
const columns = stdout?.columns ?? 100;
|
|
64
|
+
const rows = stdout?.rows ?? 24;
|
|
65
|
+
const info = (_jsxs(_Fragment, { children: [_jsxs(Text, { ...TEXT.secondary, wrap: "truncate-end", children: [cwd !== undefined && cwd !== '' ? `${shortCwd(cwd)} · ` : '', "\u6A21\u578B ", model, " \u00B7 effort ", effort] }), _jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: `/help 看命令 · 双击 ${KEYS.escape} 撤回上一轮 · ${KEYS.transcript} 回看全文 · ${KEYS.thinking} 展开思考 · ${KEYS.paste} 贴图` }), _jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: "\u6709\u6D3B\u76F4\u63A5\u8BF4\uFF1B@ \u63D0\u6587\u4EF6\uFF0C/ \u6216 @ \u5524\u51FA\u8865\u5168\uFF0CShift+Enter \u6362\u884C\u3002" })] }));
|
|
66
|
+
// 阶梯降级:矮终端/窄终端退到词标版(大字体 35 列宽,故列数门槛 40)
|
|
67
|
+
if (rows >= 30 && columns >= 40) {
|
|
68
|
+
return (_jsxs(Box, { flexDirection: "column", gap: GAP.none, marginBottom: GAP.tight, children: [_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.accent, children: "\u2726 " }), _jsx(Text, { bold: true, children: "Pneuma" }), _jsxs(Text, { ...TEXT.secondary, children: [" v", DSC_VERSION] })] }), _jsx(BigWord, { rows: wordRows('PNEUMA'), from: PALETTE.brand, to: PALETTE.pale }), _jsx(Text, { color: PALETTE.accent, children: "\u2726 \u628A\u60F3\u6CD5\u53D8\u6210\u4EE3\u7801" }), info] }));
|
|
69
|
+
}
|
|
70
|
+
return (_jsxs(Box, { flexDirection: "column", gap: GAP.none, marginBottom: GAP.tight, children: [_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.accent, children: "\u2726 " }), _jsx(Text, { bold: true, children: "Pneuma" }), _jsxs(Text, { ...TEXT.secondary, children: [" v", DSC_VERSION] })] }), info] }));
|
|
71
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AttachResult {
|
|
2
|
+
/** 原文(路径不替换,模型看得见来源)。 */
|
|
3
|
+
text: string;
|
|
4
|
+
/** 成功读出的 data URL 清单(submit(text, images) 的第二参)。 */
|
|
5
|
+
images: string[];
|
|
6
|
+
/** 成功附加的路径。 */
|
|
7
|
+
attached: string[];
|
|
8
|
+
/** 看起来是图片路径但没读成的(太大/IO 错误),界面提示用。 */
|
|
9
|
+
failed: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function extractImages(text: string): AttachResult;
|
|
12
|
+
/**
|
|
13
|
+
* 读一个图片文件成 data URL(附件芯片提交时用;格式/大小不合格直接抛错,由
|
|
14
|
+
* 调用方折成「读取失败」提示)。
|
|
15
|
+
*/
|
|
16
|
+
export declare function readImageAsDataUrl(path: string): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 提交前的图片附件提取:消息里出现「存在的本地图片文件路径」(空格分词、可带引号)
|
|
3
|
+
* 就读成 data URL 附加。路径原样留在正文里,模型文本与图都看得见。
|
|
4
|
+
*
|
|
5
|
+
* 当前模型没勾「照片」时不需要这里拦——宿主的 drop-images 投影(order 900)会把图
|
|
6
|
+
* 换成一句说明发出去。
|
|
7
|
+
*
|
|
8
|
+
* @module dsc/app/attach
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { extname } from 'node:path';
|
|
12
|
+
const IMAGE_MIME = {
|
|
13
|
+
'.png': 'image/png',
|
|
14
|
+
'.jpg': 'image/jpeg',
|
|
15
|
+
'.jpeg': 'image/jpeg',
|
|
16
|
+
'.webp': 'image/webp',
|
|
17
|
+
'.gif': 'image/gif',
|
|
18
|
+
};
|
|
19
|
+
/** 单图上限:再大的多半选错了文件,报「读取失败」让用户自己看。 */
|
|
20
|
+
const MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
21
|
+
export function extractImages(text) {
|
|
22
|
+
const images = [];
|
|
23
|
+
const attached = [];
|
|
24
|
+
const failed = [];
|
|
25
|
+
const next = text.replace(/\S+/g, (token) => {
|
|
26
|
+
const clean = token.replace(/^["'`(「]+|["'`,,。」』)]+$/g, '');
|
|
27
|
+
const mime = IMAGE_MIME[extname(clean).toLowerCase()];
|
|
28
|
+
if (mime === undefined)
|
|
29
|
+
return token;
|
|
30
|
+
try {
|
|
31
|
+
if (!existsSync(clean) || !statSync(clean).isFile())
|
|
32
|
+
return token;
|
|
33
|
+
if (statSync(clean).size > MAX_IMAGE_BYTES) {
|
|
34
|
+
failed.push(clean);
|
|
35
|
+
return token;
|
|
36
|
+
}
|
|
37
|
+
images.push(`data:${mime};base64,${readFileSync(clean).toString('base64')}`);
|
|
38
|
+
attached.push(clean);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
failed.push(clean);
|
|
42
|
+
}
|
|
43
|
+
return token;
|
|
44
|
+
});
|
|
45
|
+
return { text: next, images, attached, failed };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 读一个图片文件成 data URL(附件芯片提交时用;格式/大小不合格直接抛错,由
|
|
49
|
+
* 调用方折成「读取失败」提示)。
|
|
50
|
+
*/
|
|
51
|
+
export function readImageAsDataUrl(path) {
|
|
52
|
+
const mime = IMAGE_MIME[extname(path).toLowerCase()];
|
|
53
|
+
if (mime === undefined)
|
|
54
|
+
throw new Error(`不是受支持的图片格式:${path}`);
|
|
55
|
+
if (statSync(path).size > MAX_IMAGE_BYTES)
|
|
56
|
+
throw new Error(`图片超过 10MB:${path}`);
|
|
57
|
+
return `data:${mime};base64,${readFileSync(path).toString('base64')}`;
|
|
58
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { DOMElement } from 'ink';
|
|
3
|
+
/** 与终端一致的显示宽度:CJK/全角/emoji 记 2 列,其余记 1 列。 */
|
|
4
|
+
export declare function displayWidth(text: string): number;
|
|
5
|
+
/** 节点在帧内的绝对行(0 基);量不到(非 TTY 管道、未挂载)返回 null。 */
|
|
6
|
+
export declare function absoluteTop(node: DOMElement | null | undefined): number | null;
|
|
7
|
+
/** 节点在帧内的绝对列(0 基);量不到返回 null(同一行里多块区域分列命中用)。 */
|
|
8
|
+
export declare function absoluteLeft(node: DOMElement | null | undefined): number | null;
|
|
9
|
+
/** 节点在帧内的水平区间(0 基 [left, left+width));量不到返回 null。 */
|
|
10
|
+
export declare function measuredSpan(node: DOMElement | null | undefined): {
|
|
11
|
+
left: number;
|
|
12
|
+
width: number;
|
|
13
|
+
} | null;
|
|
14
|
+
/** 节点的渲染高度(行);量不到返回 null。 */
|
|
15
|
+
export declare function measuredHeight(node: DOMElement | null | undefined): number | null;
|
|
16
|
+
/** 节点的渲染宽度(列);量不到返回 null(芯片内部「主体 / 删除钮」分列用)。 */
|
|
17
|
+
export declare function measuredWidth(node: DOMElement | null | undefined): number | null;
|
|
18
|
+
/** 一个命中判定:点击发生时由 App 现量几何再询问;返回 true 表示消费了这次点击。 */
|
|
19
|
+
export interface ClickEntry {
|
|
20
|
+
node: RefObject<DOMElement | null>;
|
|
21
|
+
/** (col, row, top, height) 均为 0 基帧内坐标。 */
|
|
22
|
+
hit: (col: number, row: number, top: number, height: number) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 够不够格当**拖动目标**(按住左键划过,SGR 1002):只有刻度列认拖动
|
|
25
|
+
* (拖 = 一连串跳到该行),其余区一律不派发拖动——划过去误触比「拖不动」讨厌。
|
|
26
|
+
*/
|
|
27
|
+
drag?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** App 侧的注册表:组件渲染后登记,卸载/重渲染时自动注销。 */
|
|
30
|
+
export type RegisterClick = (entry: ClickEntry) => () => void;
|
|
31
|
+
/**
|
|
32
|
+
* 组件登记命中判定。
|
|
33
|
+
*
|
|
34
|
+
* `hit` 走 ref、**只在挂载/卸载时登记一次**:原先没有依赖数组,每次重渲染都要把
|
|
35
|
+
* 帧内 80+ 个命中区退订再登记一遍(Set 的增删落在渲染提交路径上)。判定闭包拿的
|
|
36
|
+
* 仍是最新 props——ref 每次渲染都刷新,判定时刻读到的是当次渲染的闭包。
|
|
37
|
+
*/
|
|
38
|
+
export declare function useClickRegion(ref: RefObject<DOMElement | null>, register: RegisterClick | undefined, hit: ClickEntry['hit'] | undefined, options?: {
|
|
39
|
+
drag?: boolean;
|
|
40
|
+
}): void;
|
package/lib/app/click.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 鼠标点击命中基础设施(原版 ink 没有命中测试,这里是 dsc 的最小实现)。
|
|
3
|
+
*
|
|
4
|
+
* 组成三件事:
|
|
5
|
+
* - `displayWidth`:按显示宽度数列(CJK/全角记 2 列),卡片页脚「按键按钮」的列区间
|
|
6
|
+
* 就靠它和渲染同源计算;
|
|
7
|
+
* - `absoluteTop` / `measuredHeight`:沿 ink DOM 的 parentNode 链累加 yoga 的
|
|
8
|
+
* getComputedTop,得到节点在帧内的绝对行——帧恒定为「终端行数 − 1」且从屏顶排
|
|
9
|
+
* (App 根盒),帧内行就是屏幕行;
|
|
10
|
+
* - `useClickRegion`:组件登记一个命中判定函数,**几何在点击发生时才测量**——ink 的
|
|
11
|
+
* 布局在节流渲染里才算完,注册时量到的是上一帧的尺寸,点击时(距上一次绘制总有
|
|
12
|
+
* 一段人手时差)量的才是画出来的那一帧。
|
|
13
|
+
*
|
|
14
|
+
* 坐标约定:命中判定收到的 col/row 一律是 0 基帧内坐标(App 把 SGR 的 1 基剥掉)。
|
|
15
|
+
* 测量失败(yoga 节点缺席、管道渲染等)跳过该区——点击退化为无操作,键盘不受影响。
|
|
16
|
+
*
|
|
17
|
+
* @module dsc-tui/app/click
|
|
18
|
+
*/
|
|
19
|
+
import { useEffect, useRef } from 'react';
|
|
20
|
+
/** 与终端一致的显示宽度:CJK/全角/emoji 记 2 列,其余记 1 列。 */
|
|
21
|
+
export function displayWidth(text) {
|
|
22
|
+
let width = 0;
|
|
23
|
+
for (const char of text) {
|
|
24
|
+
const code = char.codePointAt(0) ?? 0;
|
|
25
|
+
width += isWideCodePoint(code) ? 2 : 1;
|
|
26
|
+
}
|
|
27
|
+
return width;
|
|
28
|
+
}
|
|
29
|
+
const isWideCodePoint = (code) => (code >= 0x1100 && code <= 0x115f) ||
|
|
30
|
+
(code >= 0x2e80 && code <= 0xa4cf) ||
|
|
31
|
+
(code >= 0xac00 && code <= 0xd7a3) ||
|
|
32
|
+
(code >= 0xf900 && code <= 0xfaff) ||
|
|
33
|
+
(code >= 0xfe30 && code <= 0xfe4f) ||
|
|
34
|
+
(code >= 0xff00 && code <= 0xff60) ||
|
|
35
|
+
(code >= 0xffe0 && code <= 0xffe6) ||
|
|
36
|
+
(code >= 0x1f300 && code <= 0x1faff) ||
|
|
37
|
+
(code >= 0x20000 && code <= 0x3fffd);
|
|
38
|
+
/** 节点在帧内的绝对行(0 基);量不到(非 TTY 管道、未挂载)返回 null。 */
|
|
39
|
+
export function absoluteTop(node) {
|
|
40
|
+
let y = 0;
|
|
41
|
+
let current = node;
|
|
42
|
+
while (current !== null && current !== undefined) {
|
|
43
|
+
const top = current.yogaNode?.getComputedTop();
|
|
44
|
+
if (typeof top !== 'number')
|
|
45
|
+
return null;
|
|
46
|
+
y += top;
|
|
47
|
+
current = current.parentNode;
|
|
48
|
+
}
|
|
49
|
+
return y;
|
|
50
|
+
}
|
|
51
|
+
/** 节点在帧内的绝对列(0 基);量不到返回 null(同一行里多块区域分列命中用)。 */
|
|
52
|
+
export function absoluteLeft(node) {
|
|
53
|
+
let x = 0;
|
|
54
|
+
let current = node;
|
|
55
|
+
while (current !== null && current !== undefined) {
|
|
56
|
+
const left = current.yogaNode?.getComputedLeft();
|
|
57
|
+
if (typeof left !== 'number')
|
|
58
|
+
return null;
|
|
59
|
+
x += left;
|
|
60
|
+
current = current.parentNode;
|
|
61
|
+
}
|
|
62
|
+
return x;
|
|
63
|
+
}
|
|
64
|
+
/** 节点在帧内的水平区间(0 基 [left, left+width));量不到返回 null。 */
|
|
65
|
+
export function measuredSpan(node) {
|
|
66
|
+
const left = absoluteLeft(node);
|
|
67
|
+
const width = measuredWidth(node);
|
|
68
|
+
if (left === null || width === null)
|
|
69
|
+
return null;
|
|
70
|
+
return { left, width };
|
|
71
|
+
}
|
|
72
|
+
/** 节点的渲染高度(行);量不到返回 null。 */
|
|
73
|
+
export function measuredHeight(node) {
|
|
74
|
+
const height = node?.yogaNode?.getComputedHeight();
|
|
75
|
+
return typeof height === 'number' ? height : null;
|
|
76
|
+
}
|
|
77
|
+
/** 节点的渲染宽度(列);量不到返回 null(芯片内部「主体 / 删除钮」分列用)。 */
|
|
78
|
+
export function measuredWidth(node) {
|
|
79
|
+
const width = node?.yogaNode?.getComputedWidth();
|
|
80
|
+
return typeof width === 'number' ? width : null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 组件登记命中判定。
|
|
84
|
+
*
|
|
85
|
+
* `hit` 走 ref、**只在挂载/卸载时登记一次**:原先没有依赖数组,每次重渲染都要把
|
|
86
|
+
* 帧内 80+ 个命中区退订再登记一遍(Set 的增删落在渲染提交路径上)。判定闭包拿的
|
|
87
|
+
* 仍是最新 props——ref 每次渲染都刷新,判定时刻读到的是当次渲染的闭包。
|
|
88
|
+
*/
|
|
89
|
+
export function useClickRegion(ref, register, hit, options) {
|
|
90
|
+
const hitRef = useRef(hit);
|
|
91
|
+
hitRef.current = hit;
|
|
92
|
+
const drag = options?.drag === true;
|
|
93
|
+
const active = register !== undefined && hit !== undefined;
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!active)
|
|
96
|
+
return;
|
|
97
|
+
return register({
|
|
98
|
+
node: ref,
|
|
99
|
+
hit: (col, row, top, height) => hitRef.current?.(col, row, top, height) ?? false,
|
|
100
|
+
...(drag ? { drag: true } : {}),
|
|
101
|
+
});
|
|
102
|
+
}, [active, register, ref, drag]);
|
|
103
|
+
}
|