@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,282 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 输入行:ink 6 移除了 TextInput,这里用 useInput 自实现受控输入。
|
|
4
|
+
*
|
|
5
|
+
* 批次三起是「光标模型」:value + caret 两个状态,支持 ←→/Home/End 移动、
|
|
6
|
+
* Ctrl+A/E/U/K/W 编辑键、Shift+Enter / Ctrl+J 换行(多行输入)、粘贴整段插入
|
|
7
|
+
* (粘贴里的换行不再压平——PasteBurst-lite)。
|
|
8
|
+
*
|
|
9
|
+
* 补全面板两类:
|
|
10
|
+
* - `/` 命令补全(命令阶段列命令、`/model ` 参数阶段列模型),仅在行首生效;
|
|
11
|
+
* - `@` 文件提及补全(core/mention 的定位与排序,文件清单经 dock 的 fs-list
|
|
12
|
+
* 异步拉一次缓存),任意位置生效、优先于命令补全。
|
|
13
|
+
* ↑↓ 选择、Tab 补全、Esc 关闭(内容一变自动恢复);Enter 提交前做命令唯一前缀展开。
|
|
14
|
+
*
|
|
15
|
+
* 历史持久化在 history-store(~/.dsc/.tui-history,新的在前,多行压平存)。
|
|
16
|
+
*
|
|
17
|
+
* @module dsc/app/Composer
|
|
18
|
+
*/
|
|
19
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
20
|
+
import { Box, Text, useInput } from 'ink';
|
|
21
|
+
import { completionsFor, expandCommand } from '../core/commands-completion.js';
|
|
22
|
+
import { collectWorkspaceFiles, insertMention, mentionQueryAt, rankMentionCandidates, } from '../core/mention.js';
|
|
23
|
+
import { useParkedCursor } from './cursor.js';
|
|
24
|
+
import { displayWidth, measuredSpan, useClickRegion } from './click.js';
|
|
25
|
+
import { loadHistory, recordHistory } from './history-store.js';
|
|
26
|
+
import { settingsWindowStart } from './settings-model.js';
|
|
27
|
+
import { ACCENT, BORDER, GAP, MARK, PAD, SEP, STATUS_COLOR, TEXT } from './theme.js';
|
|
28
|
+
/** 补全面板视口行数:候选再多也只画这行窗口,聊天区不被挤没(选中越缘窗口跟滑)。 */
|
|
29
|
+
const PANEL_ROWS = 10;
|
|
30
|
+
/** 附件芯片:主体点击 = 预览,尾部的 ✕ 点击 = 摘下。 */
|
|
31
|
+
function AttachmentChip({ att, onRemove, onPreview, registerClick, }) {
|
|
32
|
+
const bodyRef = useRef(null);
|
|
33
|
+
const closeRef = useRef(null);
|
|
34
|
+
useClickRegion(bodyRef, onPreview === undefined ? undefined : registerClick, onPreview === undefined
|
|
35
|
+
? undefined
|
|
36
|
+
: (col, row, top, height) => {
|
|
37
|
+
if (row < top || row >= top + height)
|
|
38
|
+
return false;
|
|
39
|
+
const span = measuredSpan(bodyRef.current);
|
|
40
|
+
if (span === null || col < span.left || col >= span.left + span.width)
|
|
41
|
+
return false;
|
|
42
|
+
onPreview(att.id);
|
|
43
|
+
return true;
|
|
44
|
+
});
|
|
45
|
+
useClickRegion(closeRef, onRemove === undefined ? undefined : registerClick, onRemove === undefined
|
|
46
|
+
? undefined
|
|
47
|
+
: (col, row, top, height) => {
|
|
48
|
+
if (row < top || row >= top + height)
|
|
49
|
+
return false;
|
|
50
|
+
const span = measuredSpan(closeRef.current);
|
|
51
|
+
if (span === null || col < span.left || col >= span.left + span.width)
|
|
52
|
+
return false;
|
|
53
|
+
onRemove(att.id);
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
56
|
+
return (_jsxs(Box, { children: [_jsx(Box, { ref: bodyRef, children: _jsxs(Text, { color: ACCENT, wrap: "truncate-end", children: ["[\u56FE#", att.id, "] ", att.name] }) }), _jsx(Box, { ref: closeRef, children: _jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: [' ', "\u2715"] }) })] }));
|
|
57
|
+
}
|
|
58
|
+
export function Composer({ disabled, models, placeholder, completionsEnabled = true, lister, onPanelOpenChange, onDraftChange, preset, attachments, onRemoveAttachment, onPreviewAttachment, onOpenSessions, working = false, registerClick, onSubmit, }) {
|
|
59
|
+
const [value, setValue] = useState('');
|
|
60
|
+
const [caret, setCaret] = useState(0);
|
|
61
|
+
const [history, setHistory] = useState(() => loadHistory());
|
|
62
|
+
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
63
|
+
const [completionIndex, setCompletionIndex] = useState(0);
|
|
64
|
+
/** @ 提及的工作区文件清单:第一次敲 @ 时拉一次,进程内缓存。 */
|
|
65
|
+
const [mentionFiles, setMentionFiles] = useState([]);
|
|
66
|
+
const mentionLoaded = useRef(false);
|
|
67
|
+
/** Esc 关闭面板后记住被抑制的输入;内容一变自动恢复。 */
|
|
68
|
+
const [suppressedFor, setSuppressedFor] = useState(null);
|
|
69
|
+
/** 光标处的 @ 提及查询(null = 不在 @ 补全态)。 */
|
|
70
|
+
const mention = useMemo(() => mentionQueryAt(value, caret), [value, caret]);
|
|
71
|
+
const completions = useMemo(() => {
|
|
72
|
+
if (value === suppressedFor)
|
|
73
|
+
return [];
|
|
74
|
+
if (mention !== null) {
|
|
75
|
+
return rankMentionCandidates(mentionFiles, mention.token, 8).map((path) => ({
|
|
76
|
+
insert: path,
|
|
77
|
+
label: path,
|
|
78
|
+
description: '文件提及',
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
if (!completionsEnabled)
|
|
82
|
+
return [];
|
|
83
|
+
// 命令候选全量(内置 + 插件 + 技能命令,40+ 条);面板只画 PANEL_ROWS 行窗口,
|
|
84
|
+
// 选中项越缘窗口跟着滑(settingsWindowStart 焦点跟随语义,与设置页同款)。
|
|
85
|
+
return completionsFor(value, models);
|
|
86
|
+
}, [value, suppressedFor, mention, mentionFiles, completionsEnabled, models]);
|
|
87
|
+
const panelOpen = completions.length > 0;
|
|
88
|
+
const safeIndex = Math.max(0, Math.min(completionIndex, completions.length - 1));
|
|
89
|
+
/** 面板视口:候选超过 PANEL_ROWS 时只画选中项附近的窗口(纯派生,无新状态)。 */
|
|
90
|
+
const panelStart = settingsWindowStart(safeIndex, PANEL_ROWS, completions.length);
|
|
91
|
+
const panelVisible = completions.slice(panelStart, panelStart + PANEL_ROWS);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
onPanelOpenChange?.(panelOpen);
|
|
94
|
+
}, [panelOpen, onPanelOpenChange]);
|
|
95
|
+
/** 第一次需要 @ 候选时才拉工作区文件清单(异步递归,失败当空表——补全只是锦上添花)。 */
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (mention === null || mentionLoaded.current || lister === undefined)
|
|
98
|
+
return;
|
|
99
|
+
mentionLoaded.current = true;
|
|
100
|
+
void collectWorkspaceFiles(lister)
|
|
101
|
+
.then((files) => setMentionFiles(files))
|
|
102
|
+
.catch(() => setMentionFiles([]));
|
|
103
|
+
}, [mention, lister]);
|
|
104
|
+
// 草稿上报(App 判断「输入框为空」的依据);preset 灌入(撤回文本回框)。
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
onDraftChange?.(value);
|
|
107
|
+
}, [value, onDraftChange]);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (preset === undefined || preset.token === 0)
|
|
110
|
+
return;
|
|
111
|
+
setValue(preset.text);
|
|
112
|
+
setCaret(preset.text.length);
|
|
113
|
+
setHistoryIndex(-1);
|
|
114
|
+
setSuppressedFor(null);
|
|
115
|
+
}, [preset]);
|
|
116
|
+
// IME 光标停靠(0.6.57,ink useCursor):声明 caret 的逻辑行列,帧尾光标停到
|
|
117
|
+
// 输入框内——Windows Terminal 的拼音预览因此画在输入框里。
|
|
118
|
+
const inputBoxRef = useRef(null);
|
|
119
|
+
const homeRef = useRef(null);
|
|
120
|
+
useClickRegion(homeRef, onOpenSessions === undefined ? undefined : registerClick, onOpenSessions === undefined
|
|
121
|
+
? undefined
|
|
122
|
+
: (col, row, top, height) => {
|
|
123
|
+
if (row < top || row >= top + height)
|
|
124
|
+
return false;
|
|
125
|
+
onOpenSessions();
|
|
126
|
+
return true;
|
|
127
|
+
});
|
|
128
|
+
const caretBefore = value.slice(0, caret).split('\n');
|
|
129
|
+
// 列原点:边框 1 + padding 1 + 「⌸ 」2(可选)+「❯ 」2
|
|
130
|
+
const promptCols = 2 + (onOpenSessions !== undefined ? 2 : 0);
|
|
131
|
+
useParkedCursor(inputBoxRef, caretBefore.length - 1, displayWidth(caretBefore[caretBefore.length - 1] ?? ''), !disabled, promptCols);
|
|
132
|
+
/** 修改输入并把光标带到位(函数式更新:同批多次按键不丢状态)。 */
|
|
133
|
+
const update = (next, nextCaret) => {
|
|
134
|
+
setValue(next);
|
|
135
|
+
setCaret(Math.max(0, Math.min(nextCaret, next.length)));
|
|
136
|
+
setCompletionIndex(0);
|
|
137
|
+
};
|
|
138
|
+
const insert = (text) => {
|
|
139
|
+
update(value.slice(0, caret) + text + value.slice(caret), caret + text.length);
|
|
140
|
+
};
|
|
141
|
+
/** Tab / Enter(面板开时):把选中候选项填进输入框。 */
|
|
142
|
+
const applyCompletion = () => {
|
|
143
|
+
const item = completions[safeIndex];
|
|
144
|
+
if (item === undefined)
|
|
145
|
+
return false;
|
|
146
|
+
setHistoryIndex(-1);
|
|
147
|
+
if (mention !== null) {
|
|
148
|
+
const next = insertMention(value, mention, item.insert);
|
|
149
|
+
update(next.text, next.caret);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
update(item.insert, item.insert.length);
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
};
|
|
156
|
+
useInput((input, key) => {
|
|
157
|
+
if (disabled)
|
|
158
|
+
return;
|
|
159
|
+
// SGR 鼠标事件(App 顶层已消费,这里兜底吞掉)绝不能当成打字灌进输入框。
|
|
160
|
+
if (/^\[<\d+;\d+;\d+[Mm]$/.test(input))
|
|
161
|
+
return;
|
|
162
|
+
// 补全面板打开时,导航键归面板(不与历史翻阅冲突)
|
|
163
|
+
if (panelOpen) {
|
|
164
|
+
if (key.upArrow) {
|
|
165
|
+
setCompletionIndex((current) => Math.max(0, Math.min(current, completions.length - 1) - 1));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (key.downArrow) {
|
|
169
|
+
setCompletionIndex((current) => Math.min(completions.length - 1, Math.min(current, completions.length - 1) + 1));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (key.tab) {
|
|
173
|
+
applyCompletion();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (key.escape) {
|
|
177
|
+
setSuppressedFor(value);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (key.return) {
|
|
181
|
+
// @ 提及:Enter 采纳候选;命令/模型:Enter 采纳(唯一前缀展开在下面统一做)。
|
|
182
|
+
if (mention !== null) {
|
|
183
|
+
applyCompletion();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (key.return && !key.shift && !(key.ctrl && input === 'j')) {
|
|
189
|
+
if (panelOpen && mention !== null)
|
|
190
|
+
return; // 上面已处理
|
|
191
|
+
// 面板打开时 Enter 采用当前选中项(`/mo`+Enter → `/model `),否则按前缀展开。
|
|
192
|
+
const chosen = panelOpen ? completions[safeIndex]?.insert : undefined;
|
|
193
|
+
const text = expandCommand((chosen ?? value).trim());
|
|
194
|
+
if (text === '')
|
|
195
|
+
return;
|
|
196
|
+
setHistory((previous) => recordHistory(previous, text));
|
|
197
|
+
setHistoryIndex(-1);
|
|
198
|
+
setSuppressedFor(null);
|
|
199
|
+
setValue('');
|
|
200
|
+
setCaret(0);
|
|
201
|
+
onSubmit(text);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// 换行:Shift+Enter 或 Ctrl+J(ink 把 Shift+Enter 交成 key.return + key.shift)。
|
|
205
|
+
if ((key.return && key.shift) || (key.ctrl && input === 'j')) {
|
|
206
|
+
insert('\n');
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (key.backspace || key.delete) {
|
|
210
|
+
if (key.delete && caret < value.length && !key.backspace) {
|
|
211
|
+
update(value.slice(0, caret) + value.slice(caret + 1), caret);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (caret > 0)
|
|
215
|
+
update(value.slice(0, caret - 1) + value.slice(caret), caret - 1);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (key.leftArrow) {
|
|
219
|
+
setCaret((current) => Math.max(0, current - 1));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (key.rightArrow) {
|
|
223
|
+
setCaret((current) => Math.min(value.length, current + 1));
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (key.home || (key.ctrl && input === 'a')) {
|
|
227
|
+
setCaret(0);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (key.end || (key.ctrl && input === 'e')) {
|
|
231
|
+
setCaret(value.length);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (key.ctrl && input === 'u') {
|
|
235
|
+
update(value.slice(caret), 0);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (key.ctrl && input === 'k') {
|
|
239
|
+
update(value.slice(0, caret), caret);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (key.ctrl && input === 'w') {
|
|
243
|
+
// 删光标前的一个词(空白分词,吃掉前导空白)
|
|
244
|
+
const head = value.slice(0, caret);
|
|
245
|
+
const trimmed = head.replace(/\s+$/, '').replace(/\S*$/, '');
|
|
246
|
+
update(trimmed + value.slice(caret), trimmed.length);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (key.upArrow && value === '' && history.length > 0) {
|
|
250
|
+
const next = historyIndex < 0 ? 0 : Math.min(historyIndex + 1, history.length - 1);
|
|
251
|
+
setHistoryIndex(next);
|
|
252
|
+
const recalled = history[next] ?? '';
|
|
253
|
+
update(recalled, recalled.length);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (key.downArrow && historyIndex >= 0) {
|
|
257
|
+
const next = historyIndex - 1;
|
|
258
|
+
setHistoryIndex(next);
|
|
259
|
+
const recalled = next < 0 ? '' : history[next] ?? '';
|
|
260
|
+
update(recalled, recalled.length);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (key.upArrow || key.downArrow || key.pageUp || key.pageDown)
|
|
264
|
+
return;
|
|
265
|
+
if (key.tab || key.escape)
|
|
266
|
+
return;
|
|
267
|
+
if (key.ctrl || key.meta)
|
|
268
|
+
return;
|
|
269
|
+
// 粘贴整段(带换行)原样插入(只去 \r);普通输入照旧。
|
|
270
|
+
const printable = input.includes('\n') ? input.replace(/\r/g, '') : input.replace(/[\r\n]+/g, '');
|
|
271
|
+
if (printable !== '') {
|
|
272
|
+
setHistoryIndex(-1);
|
|
273
|
+
insert(printable);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
return (_jsxs(Box, { flexDirection: "column", gap: GAP.none, children: [panelOpen ? (_jsxs(Box, { borderStyle: "single", borderColor: BORDER.frame, paddingX: PAD.inline, flexDirection: "column", gap: GAP.none, children: [panelVisible.map((item, position) => {
|
|
277
|
+
const selected = panelStart + position === safeIndex;
|
|
278
|
+
return (_jsxs(Text, { color: selected ? ACCENT : undefined, children: [selected ? MARK.selected : MARK.idle, item.label, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, item.description] })] }, item.label));
|
|
279
|
+
}), _jsxs(Text, { ...TEXT.secondary, children: [completions.length > panelVisible.length
|
|
280
|
+
? `${panelStart + 1}–${panelStart + panelVisible.length}/${completions.length} 条 · `
|
|
281
|
+
: '', "\u2191\u2193 \u9009\u62E9 \u00B7 Tab \u8865\u5168 \u00B7 Esc \u5173\u95ED"] })] })) : null, attachments !== undefined && attachments.length > 0 ? (_jsx(Box, { gap: PAD.field, flexWrap: "wrap", children: attachments.map((att) => (_jsx(AttachmentChip, { att: att, onRemove: onRemoveAttachment, onPreview: onPreviewAttachment, registerClick: registerClick }, att.id))) })) : null, _jsxs(Box, { ref: inputBoxRef, borderStyle: "round", borderColor: disabled ? BORDER.frame : BORDER.active, paddingX: PAD.inline, children: [onOpenSessions !== undefined ? (_jsx(Box, { ref: homeRef, children: _jsx(Text, { ...TEXT.secondary, children: "\u2338 " }) })) : null, _jsxs(Text, { color: working && !disabled ? BORDER.frame : ACCENT, children: ["\u276F", ' '] }), value === '' && placeholder !== undefined ? (_jsx(Text, { ...TEXT.secondary, children: placeholder })) : (_jsx(Text, { ...TEXT.body, children: value }))] })] }));
|
|
282
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 差异块:unified hunk 的终端渲染(审批卡「将做的改动」与批次二的轮尾文件更改卡共用)。
|
|
4
|
+
* 新增行绿、删除行红、上下文暗淡;默认折叠(只留前若干行),expanded 展开全部。
|
|
5
|
+
*
|
|
6
|
+
* @module dsc-tui/app/DiffBlock
|
|
7
|
+
*/
|
|
8
|
+
import { Box, Text } from 'ink';
|
|
9
|
+
import { DIFF_COLOR, GAP, INDENT, TEXT } from './theme.js';
|
|
10
|
+
/** 折叠时最多显示的差异行数(hunk 头不计)。 */
|
|
11
|
+
const FOLD_LINES = 14;
|
|
12
|
+
function DiffRow({ line }) {
|
|
13
|
+
if (line.kind === 'add')
|
|
14
|
+
return _jsxs(Text, { color: DIFF_COLOR.add, children: ["+ ", line.text] });
|
|
15
|
+
if (line.kind === 'remove')
|
|
16
|
+
return _jsxs(Text, { color: DIFF_COLOR.del, children: ["\u2212 ", line.text] });
|
|
17
|
+
return _jsxs(Text, { ...TEXT.secondary, children: [" ", line.text] });
|
|
18
|
+
}
|
|
19
|
+
export function DiffBlock({ diff, expanded }) {
|
|
20
|
+
const totalLines = diff.hunks.reduce((sum, hunk) => sum + hunk.lines.length, 0);
|
|
21
|
+
const rows = [];
|
|
22
|
+
let remaining = expanded ? Number.POSITIVE_INFINITY : FOLD_LINES;
|
|
23
|
+
for (const hunk of diff.hunks) {
|
|
24
|
+
if (remaining <= 0)
|
|
25
|
+
break;
|
|
26
|
+
rows.push(_jsxs(Text, { ...TEXT.secondary, children: ["@@ -", hunk.oldStart, ",", hunk.oldCount, " +", hunk.newStart, ",", hunk.newCount, " @@"] }, `h${rows.length}`));
|
|
27
|
+
for (const line of hunk.lines) {
|
|
28
|
+
if (remaining <= 0)
|
|
29
|
+
break;
|
|
30
|
+
rows.push(_jsx(DiffRow, { line: line }, `l${rows.length}`));
|
|
31
|
+
remaining -= 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const shown = totalLines - Math.max(0, remaining === Number.POSITIVE_INFINITY ? 0 : remaining);
|
|
35
|
+
const hidden = totalLines - shown;
|
|
36
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: GAP.none, gap: GAP.none, children: [_jsxs(Text, { ...TEXT.secondary, children: ["\u5C06\u505A\u7684\u6539\u52A8\uFF1A", diff.path, "\uFF08", diff.status === 'added' ? '新建' : '修改', "\uFF0C+", diff.added, " \u2212", diff.removed, diff.fellBack === true ? ',按参数推算' : '', diff.mismatch === 'missing' ? ',⚠ old 在盘上匹配不到,照参数执行会失败' : '', diff.mismatch === 'ambiguous' ? ',⚠ old 匹配多处,照参数执行会失败' : '', "\uFF09"] }), _jsx(Box, { flexDirection: "column", marginLeft: INDENT.detail, gap: GAP.none, children: rows }), hidden > 0 || diff.truncated === true ? (_jsxs(Text, { ...TEXT.secondary, children: ["\u2026 \u8FD8\u6709 ", hidden, " \u884C", diff.truncated === true ? '(超预算已截断)' : '', "\uFF0Cv \u5C55\u5F00/\u6536\u8D77"] })) : null] }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* markdown 渲染组件(0.6.58):把 markdown.ts 解析出的块画进 ink——对齐 dsh-TUI
|
|
4
|
+
* 的排版规格:H1 强调色粗体下划线 / H2 权限蓝粗体 / H3+ 粗体正文、行内代码权限蓝、
|
|
5
|
+
* 链接强调色下划线(url 退化补注——终端没有可点的超链接,藏掉 url 会丢信息)、
|
|
6
|
+
* 列表符号权限蓝、引用 ▎ 暗淡斜体、代码块两格缩进无闭合围栏、表格 ┌─┬┐ 框线 +
|
|
7
|
+
* 表头粗体居中(超宽降级成 label: value 行)。块与块之间空一行。
|
|
8
|
+
*
|
|
9
|
+
* 解析结果按 source memo(同一条目重渲染不重解析);流式光标 `▌` 追加在最后一段。
|
|
10
|
+
* 正文行一律自然折行(truncate 会把长回答砍成一行;高度交给聊天视口顶部裁剪)。
|
|
11
|
+
*
|
|
12
|
+
* @module dsc-tui/app/MarkdownView
|
|
13
|
+
*/
|
|
14
|
+
import { useMemo } from 'react';
|
|
15
|
+
import { Box, Text, useStdout } from 'ink';
|
|
16
|
+
import { displayWidth, parseMarkdown, } from './markdown.js';
|
|
17
|
+
import { PAD, PALETTE, TEXT } from './theme.js';
|
|
18
|
+
/** 行内片段 → ink Text 序列(链接补注 url)。 */
|
|
19
|
+
function Spans({ spans }) {
|
|
20
|
+
return (_jsx(_Fragment, { children: spans.map((span, index) => {
|
|
21
|
+
const style = {
|
|
22
|
+
...(span.bold === true ? { bold: true } : {}),
|
|
23
|
+
...(span.italic === true ? { italic: true } : {}),
|
|
24
|
+
};
|
|
25
|
+
if (span.code === true) {
|
|
26
|
+
return (_jsx(Text, { ...style, color: PALETTE.permission, children: span.text }, index));
|
|
27
|
+
}
|
|
28
|
+
if (span.link !== undefined) {
|
|
29
|
+
return (_jsxs(Text, { children: [_jsx(Text, { ...style, color: PALETTE.accent, underline: true, children: span.text }), span.text !== span.link ? _jsxs(Text, { ...TEXT.secondary, children: [" (", span.link, ")"] }) : null] }, index));
|
|
30
|
+
}
|
|
31
|
+
return (_jsx(Text, { ...TEXT.body, ...style, children: span.text }, index));
|
|
32
|
+
}) }));
|
|
33
|
+
}
|
|
34
|
+
/** 表格:┌─┬┐ 框线 + 表头粗体居中;总宽超限降级成「表头: 首格;次格」行。 */
|
|
35
|
+
function TableView({ header, rows, maxWidth, }) {
|
|
36
|
+
const columnCount = Math.max(header.length, ...rows.map((row) => row.length), 1);
|
|
37
|
+
const widths = [];
|
|
38
|
+
for (let c = 0; c < columnCount; c += 1) {
|
|
39
|
+
let width = 0;
|
|
40
|
+
for (const span of header[c] ?? [])
|
|
41
|
+
width = Math.max(width, displayWidth(span.text));
|
|
42
|
+
for (const row of rows) {
|
|
43
|
+
for (const span of row[c] ?? [])
|
|
44
|
+
width = Math.max(width, displayWidth(span.text));
|
|
45
|
+
}
|
|
46
|
+
widths.push(Math.max(3, Math.min(width, 42)));
|
|
47
|
+
}
|
|
48
|
+
const total = widths.reduce((sum, w) => sum + w, 0) + columnCount * 3 + 1;
|
|
49
|
+
if (total > maxWidth) {
|
|
50
|
+
const label = header.map((spans) => spans.map((span) => span.text).join('')).join('·');
|
|
51
|
+
return (_jsx(Box, { flexDirection: "column", children: rows.map((row, index) => {
|
|
52
|
+
const cells = row.flatMap((cell, c) => c === 0 ? cell : [{ text: ';' }, ...cell]);
|
|
53
|
+
return (_jsxs(Text, { children: [_jsx(Text, { bold: true, children: label }), _jsx(Text, { ...TEXT.secondary, children: "\uFF1A " }), _jsx(Spans, { spans: cells })] }, index));
|
|
54
|
+
}) }));
|
|
55
|
+
}
|
|
56
|
+
const borderRow = (left, mid, right) => left + widths.map((w) => '─'.repeat(w + 2)).join(mid) + right;
|
|
57
|
+
const cellRow = (cells, bold, center) => (_jsxs(Text, { children: ["\u2502", widths.map((width, c) => {
|
|
58
|
+
const spans = cells[c] ?? [];
|
|
59
|
+
const plain = spans.map((span) => span.text).join('');
|
|
60
|
+
const pad = Math.max(0, width - displayWidth(plain));
|
|
61
|
+
const leftPad = center ? Math.floor(pad / 2) : 0;
|
|
62
|
+
// 段宽 = 1空格 + 内容(width) + 1空格 = w+2,与边框段 '─'.repeat(w+2) 对齐
|
|
63
|
+
return (_jsxs(Text, { children: [' ', ' '.repeat(leftPad), bold ? _jsx(Text, { bold: true, children: plain }) : _jsx(Spans, { spans: spans }), ' '.repeat(pad - leftPad), ' ', "\u2502"] }, c));
|
|
64
|
+
})] }));
|
|
65
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: borderRow('┌', '┬', '┐') }), cellRow(header, true, true), _jsx(Text, { children: borderRow('├', '┼', '┤') }), rows.map((row, index) => (_jsx(Box, { children: cellRow(row, false, false) }, index))), _jsx(Text, { children: borderRow('└', '┴', '┘') })] }));
|
|
66
|
+
}
|
|
67
|
+
function BlockView({ block, maxWidth, isLast, cursor, }) {
|
|
68
|
+
switch (block.kind) {
|
|
69
|
+
case 'heading': {
|
|
70
|
+
const text = block.spans.map((span) => span.text).join('');
|
|
71
|
+
if (block.level === 1) {
|
|
72
|
+
return (_jsx(Text, { bold: true, color: PALETTE.accent, underline: true, children: text }));
|
|
73
|
+
}
|
|
74
|
+
if (block.level === 2) {
|
|
75
|
+
return (_jsx(Text, { bold: true, color: PALETTE.permission, children: text }));
|
|
76
|
+
}
|
|
77
|
+
return _jsx(Text, { bold: true, children: text });
|
|
78
|
+
}
|
|
79
|
+
case 'paragraph':
|
|
80
|
+
return (_jsx(Box, { flexDirection: "column", children: block.rows.map((row, index) => {
|
|
81
|
+
const lastRow = index === block.rows.length - 1;
|
|
82
|
+
return (_jsxs(Text, { children: [_jsx(Spans, { spans: row }), cursor && isLast && lastRow ? _jsx(Text, { color: PALETTE.accent, children: " \u258C" }) : null] }, index));
|
|
83
|
+
}) }));
|
|
84
|
+
case 'list':
|
|
85
|
+
return (_jsx(Box, { flexDirection: "column", children: block.items.map((item, index) => (_jsxs(Text, { children: [block.ordered ? (_jsxs(Text, { color: PALETTE.permission, bold: true, children: [index + 1, "."] })) : (_jsx(Text, { color: PALETTE.permission, children: "-" })), _jsx(Text, { children: " " }), _jsx(Spans, { spans: item })] }, index))) }));
|
|
86
|
+
case 'quote':
|
|
87
|
+
return (_jsxs(Text, { children: [_jsx(Text, { ...TEXT.secondary, children: "\u258E " }), _jsx(Text, { ...TEXT.body, italic: true, children: _jsx(Spans, { spans: block.spans }) })] }));
|
|
88
|
+
case 'code':
|
|
89
|
+
return (_jsxs(Box, { flexDirection: "column", children: [block.lang !== null ? _jsxs(Text, { ...TEXT.secondary, children: ["```", block.lang] }) : null, block.lines.map((line, index) => (_jsxs(Text, { ...TEXT.body, children: [' ', line] }, index)))] }));
|
|
90
|
+
case 'table':
|
|
91
|
+
return _jsx(TableView, { header: block.header, rows: block.rows, maxWidth: maxWidth });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export function MarkdownView({ source, cursor = false, }) {
|
|
95
|
+
const { stdout } = useStdout();
|
|
96
|
+
const maxWidth = Math.max(20, (stdout?.columns ?? 100) - PAD.page * 2 - 2);
|
|
97
|
+
const blocks = useMemo(() => parseMarkdown(source), [source]);
|
|
98
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [blocks.map((block, index) => (_jsx(BlockView, { block: block, maxWidth: maxWidth, isLast: index === blocks.length - 1, cursor: cursor }, index))), blocks.length === 0 && cursor ? _jsx(Text, { color: PALETTE.accent, children: " \u258C" }) : null] }));
|
|
99
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 模型选择浮层(/model 无参数打开):整屏可点版。根盒撑满状态栏之上的全部空间,
|
|
4
|
+
* 列表行从构造位置起排(上边框 + 标题 + 筛选行),屏幕行与候选一一对应——鼠标点击
|
|
5
|
+
* 选中、再点已选中项即切换;滚轮与 ↑↓ 同义(路由在 App 键盘/鼠标顶层)。输入即筛选
|
|
6
|
+
* (按端点/模型名/说明),Enter 切换(下一次请求生效)、Esc 关闭。本组件纯展示。
|
|
7
|
+
*
|
|
8
|
+
* @module dsc-tui/app/ModelPicker
|
|
9
|
+
*/
|
|
10
|
+
import { Box, Text } from 'ink';
|
|
11
|
+
import { ACCENT, BORDER, GAP, MARK, PAD, SEP, TEXT } from './theme.js';
|
|
12
|
+
export function ModelPicker({ models, index, query, }) {
|
|
13
|
+
const safeIndex = Math.min(index, Math.max(0, models.length - 1));
|
|
14
|
+
return (_jsx(Box, { borderStyle: "round", borderColor: BORDER.active, paddingX: PAD.inline, flexDirection: "column", flexGrow: 1, overflowY: "hidden", gap: GAP.none, children: _jsxs(Box, { flexShrink: 0, flexDirection: "column", gap: GAP.none, children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: ["\u6A21\u578B\u9009\u62E9\uFF08", models.length, " \u4E2A\uFF09", _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u5E94\u7528 \u00B7 Enter \u5207\u6362\uFF08\u4E0B\u4E00\u6B21\u8BF7\u6C42\u751F\u6548\uFF09"] })] }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, children: ["\u7B5B\u9009", ' '] }), _jsxs(Text, { ...(query === '' ? TEXT.secondary : TEXT.body), children: [query === '' ? '(直接输入按端点/模型/说明过滤)' : query, _jsx(Text, { ...TEXT.secondary, children: "\u258F" })] })] }), models.length === 0 ? _jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u6A21\u578B\uFF09" }) : null, models.map((choice, position) => {
|
|
15
|
+
const selected = position === safeIndex;
|
|
16
|
+
return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, choice.value, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, choice.description] })] }, choice.value));
|
|
17
|
+
}), _jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: "\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u5207\u6362 \u00B7 Esc \u5173\u95ED" })] }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { PlanView } from '../contract.js';
|
|
3
|
+
import { type RegisterClick } from './click.js';
|
|
4
|
+
/** 页脚按钮的动作 id(App 派发成与按键等价的调用)。 */
|
|
5
|
+
export type PlanAction = 'approve' | 'reject' | 'feedback';
|
|
6
|
+
export declare function PlanReviewCard({ plan, expanded, feedbacking, onAction, registerClick, }: {
|
|
7
|
+
plan: PlanView;
|
|
8
|
+
expanded: boolean;
|
|
9
|
+
feedbacking: boolean;
|
|
10
|
+
/** 鼠标点中页脚按钮 / 折叠标记行时派发;缺省即无鼠标行为。 */
|
|
11
|
+
onAction?: (action: PlanAction | 'toggle') => void;
|
|
12
|
+
registerClick?: RegisterClick;
|
|
13
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 计划评审卡:exit_plan_mode 提交的计划等用户批。y 批准(批准后宿主自动切回执行
|
|
4
|
+
* 模式开工)/ n(或 Esc)拒绝 / e 带反馈退回——App 收到 e 后把 Composer 临时切成
|
|
5
|
+
* 反馈输入框,提交即把反馈原话捎给模型。计划全文超长折叠(只留前几行),v 或点击
|
|
6
|
+
* 「… 共 N 行」标记行展开/收起;页脚按钮可鼠标点击(列区间与渲染同源计算)。
|
|
7
|
+
* 键盘与鼠标路由在 App 顶层统一处理,本组件纯展示。
|
|
8
|
+
*
|
|
9
|
+
* @module dsc-tui/app/PlanReviewCard
|
|
10
|
+
*/
|
|
11
|
+
import { useRef } from 'react';
|
|
12
|
+
import { Box, Text } from 'ink';
|
|
13
|
+
import { ACCENT, BORDER, GAP, PAD, STATUS_COLOR, TEXT } from './theme.js';
|
|
14
|
+
import { absoluteLeft, displayWidth, useClickRegion } from './click.js';
|
|
15
|
+
/** 折叠时保留的正文行数。 */
|
|
16
|
+
const PREVIEW_LINES = 12;
|
|
17
|
+
const BUTTONS = [
|
|
18
|
+
{ id: 'approve', hint: '[y]', label: '批准开工', hintColor: STATUS_COLOR.done, labelDim: false },
|
|
19
|
+
{ id: 'reject', hint: '[n]', label: '拒绝', hintColor: STATUS_COLOR.failed, labelDim: false },
|
|
20
|
+
{ id: 'feedback', hint: '[e]', label: '带反馈退回', hintColor: ACCENT, labelDim: true },
|
|
21
|
+
];
|
|
22
|
+
export function PlanReviewCard({ plan, expanded, feedbacking, onAction, registerClick, }) {
|
|
23
|
+
const rootRef = useRef(null);
|
|
24
|
+
const lines = plan.text.split('\n');
|
|
25
|
+
const folded = !expanded && lines.length > PREVIEW_LINES + 1;
|
|
26
|
+
const shown = folded ? lines.slice(0, PREVIEW_LINES) : lines;
|
|
27
|
+
let cursor = 0;
|
|
28
|
+
const spans = BUTTONS.map((button) => {
|
|
29
|
+
const text = `${button.hint} ${button.label}`;
|
|
30
|
+
const from = cursor;
|
|
31
|
+
cursor += displayWidth(text) + 2;
|
|
32
|
+
return { id: button.id, from, to: from + displayWidth(text) };
|
|
33
|
+
});
|
|
34
|
+
useClickRegion(rootRef, registerClick, onAction === undefined ? undefined : (col, row, top, height) => {
|
|
35
|
+
// 几何点击时现量:页脚在底边框上第一行(反馈输入态没有页脚);
|
|
36
|
+
// 折叠标记行在页脚之上(feedbacking 时就是最末内容行)。
|
|
37
|
+
const footerRow = feedbacking ? null : top + height - 2;
|
|
38
|
+
const markerRow = folded ? top + height - 2 - (feedbacking ? 0 : 1) : null;
|
|
39
|
+
if (markerRow !== null && row === markerRow) {
|
|
40
|
+
onAction('toggle');
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (footerRow === null || row !== footerRow)
|
|
44
|
+
return false;
|
|
45
|
+
// 页边距/边框/padding 的列原点点击时现量(对根帧 paddingX 变化免疫)
|
|
46
|
+
const contentCol = col - ((absoluteLeft(rootRef.current) ?? 0) + 1 + PAD.inline);
|
|
47
|
+
const hit = spans.find((span) => contentCol >= span.from && contentCol < span.to);
|
|
48
|
+
if (hit === undefined)
|
|
49
|
+
return false;
|
|
50
|
+
onAction(hit.id);
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
return (_jsxs(Box, { ref: rootRef, borderStyle: "double", borderColor: BORDER.alert, paddingX: PAD.inline, flexDirection: "column", marginTop: GAP.tight, gap: GAP.none, children: [_jsxs(Text, { ...TEXT.label, color: BORDER.alert, wrap: "truncate-end", children: ["\u2610 \u8BA1\u5212\u8BC4\u5BA1\uFF1A", plan.title] }), _jsxs(Text, { ...TEXT.secondary, wrap: "truncate-end", children: ["\u8BA1\u5212\u6587\u4EF6\uFF1A", plan.file] }), _jsx(Box, { flexDirection: "column", gap: GAP.none, children: shown.map((line, position) => (_jsx(Text, { ...TEXT.body, wrap: "truncate-end", children: line === '' ? ' ' : line }, position))) }), folded ? (_jsxs(Text, { ...TEXT.secondary, children: ["\u2026 \u5171 ", lines.length, " \u884C\uFF0Cv \u6216\u70B9\u51FB\u672C\u884C\u5C55\u5F00/\u6536\u8D77\u5168\u6587"] })) : null, feedbacking ? (_jsx(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: "\u5E26\u53CD\u9988\u9000\u56DE\uFF1A\u5728\u4E0B\u65B9\u8F93\u5165\u6846\u5199\u53CD\u9988\u539F\u8BDD\uFF0CEnter \u63D0\u4EA4\uFF0CEsc \u53D6\u6D88" })) : (_jsx(Text, { children: BUTTONS.map((button, position) => (_jsxs(Text, { ...(button.labelDim ? TEXT.secondary : TEXT.body), children: [_jsxs(Text, { ...TEXT.label, color: button.hintColor, children: [position === 0 ? '' : ' ', button.hint] }), _jsxs(Text, { children: [" ", button.label] })] }, button.id))) }))] }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { PresetView } from '../contract.js';
|
|
3
|
+
export declare function PresetPicker({ presets, current, defaultName, index, query, }: {
|
|
4
|
+
presets: PresetView[];
|
|
5
|
+
/** 当前会话正在用的模式名。 */
|
|
6
|
+
current: string;
|
|
7
|
+
/** 新会话默认用的模式名。 */
|
|
8
|
+
defaultName: string;
|
|
9
|
+
index: number;
|
|
10
|
+
query: string;
|
|
11
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 模式选择浮层(/preset 无参数打开,对齐 dsh 裸命令开 picker):整屏可点版。
|
|
4
|
+
* 数据来自 runtime.listPresets() 的模式投影(当前会话用的 + 新会话默认的 + 全部
|
|
5
|
+
* 可选),行带「✓ 当前 / 默认 / 内置」标记;输入即筛选(按显示名/名字/说明),
|
|
6
|
+
* Enter 切换当前会话的模式、Esc 关闭。键盘与鼠标路由在 App 顶层,本组件纯展示。
|
|
7
|
+
*
|
|
8
|
+
* @module dsc-tui/app/PresetPicker
|
|
9
|
+
*/
|
|
10
|
+
import { Box, Text } from 'ink';
|
|
11
|
+
import { ACCENT, BORDER, GAP, MARK, PAD, SEP, STATUS_COLOR, TEXT } from './theme.js';
|
|
12
|
+
export function PresetPicker({ presets, current, defaultName, index, query, }) {
|
|
13
|
+
const safeIndex = Math.min(index, Math.max(0, presets.length - 1));
|
|
14
|
+
return (_jsx(Box, { borderStyle: "round", borderColor: BORDER.active, paddingX: PAD.inline, flexDirection: "column", flexGrow: 1, overflowY: "hidden", gap: GAP.none, children: _jsxs(Box, { flexShrink: 0, flexDirection: "column", gap: GAP.none, children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: ["\u6A21\u5F0F\u9009\u62E9\uFF08", presets.length, " \u4E2A\uFF09", _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u5207\u6362 \u00B7 Enter \u5207\u6362\uFF08\u5199\u8FDB\u4F1A\u8BDD\u8BB0\u5F55\uFF0C\u6062\u590D\u4F1A\u8BDD\u65F6\u8DDF\u7740\u56DE\u6765\uFF09"] })] }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, children: ["\u7B5B\u9009", ' '] }), _jsxs(Text, { ...(query === '' ? TEXT.secondary : TEXT.body), children: [query === '' ? '(直接输入按显示名/名字/说明过滤)' : query, _jsx(Text, { ...TEXT.secondary, children: "\u258F" })] })] }), presets.length === 0 ? _jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u6A21\u5F0F\uFF09" }) : null, presets.map((preset, position) => {
|
|
15
|
+
const selected = position === safeIndex;
|
|
16
|
+
const isCurrent = preset.name === current;
|
|
17
|
+
return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, preset.label, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, preset.name] }), isCurrent ? _jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.done, children: [SEP.gap, "\u2713 \u5F53\u524D"] }) : null, !isCurrent && preset.name === defaultName ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: [SEP.gap, "\u9ED8\u8BA4"] })) : null, preset.builtin ? _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u5185\u7F6E"] }) : null, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, preset.description] }), preset.problem !== undefined ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: [SEP.gap, "\u6CE8\u610F\uFF1A", preset.problem] })) : null] }, preset.name));
|
|
18
|
+
}), _jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: "\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u5207\u6362 \u00B7 Esc \u5173\u95ED \u00B7 \u5E26\u53C2\u6570\u5207\u6362\u8D70 /preset <\u540D\u5B57>" })] }) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import { type RegisterClick } from './click.js';
|
|
3
|
+
export declare function PreviewOverlay({ title, index, total, block, loading, error, registerClick, onClose, }: {
|
|
4
|
+
title: string;
|
|
5
|
+
/** 当前是第几张(0 基)。 */
|
|
6
|
+
index: number;
|
|
7
|
+
total: number;
|
|
8
|
+
/** 渲染好的半块字符画(多行,无尾随换行);null = 还在渲染。 */
|
|
9
|
+
block: string | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
error: string | null;
|
|
12
|
+
registerClick?: RegisterClick;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 图片预览浮层(0.6.57):半块真彩字符画居中展示,←→ 在同一批图片里切换,
|
|
4
|
+
* Esc / 点击图片关闭。数据(渲染好的字符画)由 App 现算传入——渲染走 PowerShell
|
|
5
|
+
* 的 System.Drawing(见 image-blocks),本组件纯展示。
|
|
6
|
+
*
|
|
7
|
+
* @module dsc-tui/app/PreviewOverlay
|
|
8
|
+
*/
|
|
9
|
+
import { useRef } from 'react';
|
|
10
|
+
import { Box, Text } from 'ink';
|
|
11
|
+
import { useClickRegion } from './click.js';
|
|
12
|
+
import { ACCENT, BORDER, GAP, PAD, STATUS_COLOR, TEXT } from './theme.js';
|
|
13
|
+
export function PreviewOverlay({ title, index, total, block, loading, error, registerClick, onClose, }) {
|
|
14
|
+
const ref = useRef(null);
|
|
15
|
+
useClickRegion(ref, registerClick, (col, row, top, height) => {
|
|
16
|
+
if (row < top || row >= top + height)
|
|
17
|
+
return false;
|
|
18
|
+
onClose();
|
|
19
|
+
return true;
|
|
20
|
+
});
|
|
21
|
+
return (_jsxs(Box, { ref: ref, borderStyle: "round", borderColor: BORDER.active, paddingX: PAD.inline, flexDirection: "column", flexGrow: 1, justifyContent: "center", alignItems: "center", gap: GAP.tight, children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: [title, total > 1 ? `(${index + 1}/${total})` : ''] }), loading ? (_jsx(Text, { ...TEXT.secondary, children: "\u6B63\u5728\u6E32\u67D3\u9884\u89C8\u2026" })) : error !== null ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: ["\u9884\u89C8\u5931\u8D25\uFF1A", error] })) : (_jsx(Box, { flexDirection: "column", children: (block ?? '').split('\n').map((line, position) => (_jsx(Text, { children: line }, position))) })), _jsxs(Text, { ...TEXT.secondary, wrap: "truncate-end", children: [total > 1 ? '←→ 切换 · ' : '', "\u70B9\u51FB\u56FE\u7247\u6216 Esc \u5173\u95ED"] })] }));
|
|
22
|
+
}
|