@waq666/pneuma 0.0.0-stage → 0.7.0
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 +144 -2
- 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 +13 -0
- package/lib/app/App.js +1498 -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 +32 -0
- package/lib/app/ChatView.js +198 -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 +272 -0
- package/lib/app/TaskStrips.d.ts +13 -0
- package/lib/app/TaskStrips.js +40 -0
- package/lib/app/ToolCard.d.ts +5 -0
- package/lib/app/ToolCard.js +40 -0
- package/lib/app/TranscriptOverlay.d.ts +12 -0
- package/lib/app/TranscriptOverlay.js +17 -0
- package/lib/app/Welcome.d.ts +6 -0
- package/lib/app/Welcome.js +66 -0
- package/lib/app/attach.d.ts +16 -0
- package/lib/app/attach.js +58 -0
- package/lib/app/click.d.ts +27 -0
- package/lib/app/click.js +89 -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/markdown.d.ts +54 -0
- package/lib/app/markdown.js +189 -0
- package/lib/app/settings-model.d.ts +69 -0
- package/lib/app/settings-model.js +114 -0
- package/lib/app/theme.d.ts +166 -0
- package/lib/app/theme.js +141 -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 +272 -0
- package/lib/core/llm.js +548 -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 +862 -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 +425 -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,43 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { SessionRunState, SessionSummary } from '../contract.js';
|
|
3
|
+
/** 工作区层的一行(App 侧按 cwd 分桶后投喂)。 */
|
|
4
|
+
export interface WorkspaceListRow {
|
|
5
|
+
cwd: string;
|
|
6
|
+
/** 显示名:路径最后一段(App 侧的 workspaceLabel 算好)。 */
|
|
7
|
+
name: string;
|
|
8
|
+
/** 该工作区下的会话数(含置顶)。 */
|
|
9
|
+
count: number;
|
|
10
|
+
/** 最近一次会话活动时间(updatedAt 最大值)。 */
|
|
11
|
+
latest: number;
|
|
12
|
+
/** 是当前会话所在的工作区(行尾标「当前」,也是 App 排序置顶的依据)。 */
|
|
13
|
+
current: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** 键盘与鼠标路由(↑↓/Enter/Esc/Ctrl 组合、筛选输入、点击、滚轮)在 App 顶层统一处理,本组件纯展示。 */
|
|
16
|
+
export interface SessionPickerProps {
|
|
17
|
+
/** 当前层:'workspaces' = 工作区选择,'sessions' = 会话列表(缺省,兼容旧调用)。 */
|
|
18
|
+
level?: 'workspaces' | 'sessions';
|
|
19
|
+
/** 工作区层的可见切片(level = 'workspaces' 时渲染)。 */
|
|
20
|
+
workspaces?: WorkspaceListRow[];
|
|
21
|
+
/** 会话层标题的工作区面包屑名(null = 不带,如单工作区直落)。 */
|
|
22
|
+
workspaceTitle?: string | null;
|
|
23
|
+
/** 视口内可见的切片(窗口由 App 按选中项居中计算)。 */
|
|
24
|
+
sessions: SessionSummary[];
|
|
25
|
+
/** 全量条数:标题展示总数,窗口指示与选中钳制都靠它。 */
|
|
26
|
+
total: number;
|
|
27
|
+
/** 切片第一行在全量列表里的下标。 */
|
|
28
|
+
start: number;
|
|
29
|
+
/** 选中项在全量列表里的下标(App 维护)。 */
|
|
30
|
+
index: number;
|
|
31
|
+
/** 当前页:active = 活动区,archived = 归档区(Tab 切换)。 */
|
|
32
|
+
page: 'active' | 'archived';
|
|
33
|
+
/** 筛选词(输入即筛选)。 */
|
|
34
|
+
query: string;
|
|
35
|
+
/** 改名模式下的输入缓冲(非空时输入行走改名态)。 */
|
|
36
|
+
buffer: string | null;
|
|
37
|
+
/** Ctrl+X 已按过一次(等待确认删除)。 */
|
|
38
|
+
armed: boolean;
|
|
39
|
+
loading: boolean;
|
|
40
|
+
/** 跨会话运行状态(状态点数据源)。 */
|
|
41
|
+
sessionStates: Record<string, SessionRunState>;
|
|
42
|
+
}
|
|
43
|
+
export declare function SessionPicker({ level, workspaces, workspaceTitle, sessions, total, start, index, page, query, buffer, armed, loading, sessionStates, }: SessionPickerProps): JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 会话选择器(/resume):整屏视口版,两级导航(0.6.63 对齐 dsh 的会话总管)。
|
|
4
|
+
*
|
|
5
|
+
* 根盒在恒定帧里撑满状态栏之上的全部空间(App 根盒固定高度,溢出从底部裁掉),
|
|
6
|
+
* 列表按选中项居中取窗(App 侧算切片),屏幕行与列表行一一对应——鼠标点击/滚轮的
|
|
7
|
+
* 行号映射由此成立(事件拦截在 App 键盘路由顶层)。两级结构:工作区层(按 cwd 分桶
|
|
8
|
+
* 的「名称 · 条数 · 最近」行)→ 会话层(原有会话行,标题带工作区面包屑);Esc 从
|
|
9
|
+
* 会话层先回工作区层(App 侧路由),单工作区时 App 直接派生为会话层、Esc 即关。
|
|
10
|
+
* Tab 切「活动 / 归档」两页;会话层动作键全部走 Ctrl 组合(普通字符留给筛选输入):
|
|
11
|
+
* Ctrl+R 改名、Ctrl+P 置顶、Ctrl+A 归档、Ctrl+U 恢复、Ctrl+X 删除(再按一次确认,
|
|
12
|
+
* 进回收站)、Ctrl+F 按最后一条用户消息分叉。键盘与鼠标路由都在 App 顶层,纯展示。
|
|
13
|
+
*
|
|
14
|
+
* @module dsc-tui/app/SessionPicker
|
|
15
|
+
*/
|
|
16
|
+
import { Box, Text } from 'ink';
|
|
17
|
+
import { ACCENT, BORDER, GAP, MARK, PAD, SEP, STATUS_COLOR, TEXT } from './theme.js';
|
|
18
|
+
const shortDate = (createdAt) => {
|
|
19
|
+
const date = new Date(createdAt);
|
|
20
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
21
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
22
|
+
};
|
|
23
|
+
/** 后台状态点的形状与颜色(与 StatusBar 同一套语义)。 */
|
|
24
|
+
const STATE_DOT = {
|
|
25
|
+
working: { mark: '◐', color: STATUS_COLOR.pending },
|
|
26
|
+
'awaiting-approval': { mark: '⚠', color: STATUS_COLOR.waiting },
|
|
27
|
+
'just-finished': { mark: '✓', color: STATUS_COLOR.done },
|
|
28
|
+
};
|
|
29
|
+
export function SessionPicker({ level = 'sessions', workspaces = [], workspaceTitle = null, sessions, total, start, index, page, query, buffer, armed, loading, sessionStates, }) {
|
|
30
|
+
const safeIndex = Math.min(index, Math.max(0, total - 1));
|
|
31
|
+
const workspaceLevel = level === 'workspaces';
|
|
32
|
+
const title = workspaceLevel
|
|
33
|
+
? '恢复会话 · 选工作区'
|
|
34
|
+
: workspaceTitle !== null
|
|
35
|
+
? `恢复会话 › ${workspaceTitle}`
|
|
36
|
+
: '恢复会话';
|
|
37
|
+
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: [title, loading ? '(读取中…)' : `(${total} ${workspaceLevel ? '个工作区' : '条'})`, total > (workspaceLevel ? workspaces.length : sessions.length)
|
|
38
|
+
? ` · 显示 ${start + 1}–${start + (workspaceLevel ? workspaces.length : sessions.length)}`
|
|
39
|
+
: '', _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "Tab \u5207", page === 'active' ? '归档' : '活动', "\u9875"] })] }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { ...TEXT.label, color: ACCENT, children: ["\u7B5B\u9009", ' '] }), _jsxs(Text, { ...(query === '' ? TEXT.secondary : TEXT.body), children: [query === ''
|
|
40
|
+
? workspaceLevel
|
|
41
|
+
? '(直接输入按名称/目录过滤)'
|
|
42
|
+
: '(直接输入按标题/目录/id 过滤)'
|
|
43
|
+
: query, buffer === null ? _jsx(Text, { ...TEXT.secondary, children: "\u258F" }) : null] })] }), buffer !== null ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, wrap: "truncate-end", children: ["\u6539\u540D\uFF1A", buffer, "\u258F\uFF08Enter \u786E\u8BA4 \u00B7 Esc \u53D6\u6D88\uFF09"] })) : null, workspaceLevel ? (_jsxs(_Fragment, { children: [workspaces.length === 0 && !loading ? (_jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u5DE5\u4F5C\u533A\uFF09" })) : null, workspaces.map((workspace, position) => {
|
|
44
|
+
const selected = start + position === safeIndex;
|
|
45
|
+
return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, workspace.name, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, workspace.count, " \u6761"] }), _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u6700\u8FD1 ", shortDate(workspace.latest)] }), workspace.current ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: [SEP.gap, "\u2190 \u5F53\u524D"] })) : null] }, workspace.cwd || '(无目录)'));
|
|
46
|
+
})] })) : (_jsxs(_Fragment, { children: [sessions.length === 0 && !loading ? (_jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u4F1A\u8BDD\uFF09" })) : null, sessions.map((session, position) => {
|
|
47
|
+
// v2 的 id 是 jsonl 文件路径;展示取文件名前 8 位
|
|
48
|
+
const shortId = (session.id.split(/[\\/]/).pop() ?? session.id)
|
|
49
|
+
.replace(/\.jsonl$/, '')
|
|
50
|
+
.slice(0, 8);
|
|
51
|
+
const selected = start + position === safeIndex;
|
|
52
|
+
const state = sessionStates[session.id];
|
|
53
|
+
const dot = state !== undefined ? STATE_DOT[state] : undefined;
|
|
54
|
+
return (_jsxs(Box, { children: [_jsx(Text, { ...TEXT.label, color: selected ? ACCENT : undefined, children: selected ? MARK.selected : MARK.idle }), session.pinnedAt !== undefined ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: ["\u2605", ' '] })) : null, _jsx(Text, { ...TEXT.secondary, children: shortDate(session.createdAt) }), _jsxs(Text, { ...TEXT.body, color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [SEP.gap, session.title ?? (session.cwd || '(无目录)')] }), dot !== undefined ? (_jsxs(Text, { ...TEXT.label, color: dot.color, children: [SEP.gap, dot.mark] })) : null, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, shortId] })] }, session.id));
|
|
55
|
+
})] })), buffer !== null ? null : (_jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: workspaceLevel ? (_jsxs(_Fragment, { children: ["\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u8FDB\u5165\u5DE5\u4F5C\u533A \u00B7 \u9F20\u6807\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u8FDB\u5165 \u00B7 \u6EDA\u8F6E\u79FB\u52A8", ' · ', "Tab \u5207", page === 'active' ? '归档' : '活动', "\u9875 \u00B7 Esc \u5173\u95ED"] })) : (_jsxs(_Fragment, { children: ["\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u6253\u5F00 \u00B7 \u9F20\u6807\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u6253\u5F00 \u00B7 \u6EDA\u8F6E\u79FB\u52A8", ' · ', "Ctrl+R \u6539\u540D \u00B7 Ctrl+P \u7F6E\u9876", page === 'active' ? ' · Ctrl+A 归档' : ' · Ctrl+U 恢复', ' · ', "Ctrl+F \u5206\u53C9", armed ? '' : ' · Ctrl+X 删除(再按一次确认)', armed ? _jsx(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: " \u00B7 \u518D\u6309\u4E00\u6B21 Ctrl+X \u786E\u8BA4\u6C38\u4E45\u5220\u9664" }) : null, ' · ', workspaceTitle !== null ? 'Esc 返回工作区列表' : 'Esc 关闭'] })) }))] }) }));
|
|
56
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { SettingsSectionView, SettingsValues } from '../contract.js';
|
|
3
|
+
import { type SettingsGroupRef, type SettingsRow } from './settings-model.js';
|
|
4
|
+
/** 设置页固定框架行数:外框上下边 2 + 标题 1 + 底部 notice 1 + 提示条 1。 */
|
|
5
|
+
export declare const SETTINGS_CHROME = 5;
|
|
6
|
+
/** 列表首行距屏幕顶的行数(鼠标行号映射的固定偏移):顶边框 1 + 标题 1。 */
|
|
7
|
+
export declare const SETTINGS_LIST_TOP = 2;
|
|
8
|
+
/** 编辑中的字段:显示草稿加光标(对齐 dsh 的 ▌)。 */
|
|
9
|
+
export interface SettingsEdit {
|
|
10
|
+
sectionId: string;
|
|
11
|
+
key: string;
|
|
12
|
+
draft: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function SettingsOverlay({ sections, rows, values, focusRow, windowStart, viewport, editing, notice, section, group, }: {
|
|
15
|
+
sections: SettingsSectionView[];
|
|
16
|
+
rows: SettingsRow[];
|
|
17
|
+
/** 分区 id → 值表;分区键缺失 = 值还在装载。 */
|
|
18
|
+
values: Record<string, SettingsValues>;
|
|
19
|
+
/** 聚焦的模型行号(buildSettingsRows 下标)。 */
|
|
20
|
+
focusRow: number;
|
|
21
|
+
windowStart: number;
|
|
22
|
+
viewport: number;
|
|
23
|
+
editing: SettingsEdit | null;
|
|
24
|
+
notice: {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
text: string;
|
|
27
|
+
} | null;
|
|
28
|
+
/** 当前展开的分区页(null = 根页):标题行变面包屑,Esc 提示换「返回」。 */
|
|
29
|
+
section?: string | null;
|
|
30
|
+
/** 当前展开的组子页(null = 不在组子页)。 */
|
|
31
|
+
group?: SettingsGroupRef | null;
|
|
32
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 设置页(/settings):整屏浮层、分区卡片 + 字段行,纯展示——焦点、编辑草稿、
|
|
4
|
+
* 回执、滚动窗口全在 App;行几何用 settings-model.ts 的同一份表,App 的鼠标
|
|
5
|
+
* 行号映射与这里画的行永远 1:1。
|
|
6
|
+
*
|
|
7
|
+
* 行规格(对齐 dsh 的 Settings 屏):卡片顶边 `╭─ 标题 · 副标题 ────╮`、字段行
|
|
8
|
+
* `❯ 标签 … 值右对齐`(switch `[✓]`/`[ ]`、select `‹ 选项 ›`、text/number 编辑态
|
|
9
|
+
* 带 `▌` 光标、button 强调色、info 暗淡),底部恒定两行:notice(成功绿/失败红,
|
|
10
|
+
* 静默时空行防跳动)+ 提示条(聚焦字段的 help + 右侧按键提示)。help 不进卡片行,
|
|
11
|
+
* 聚焦行才在提示条里出现——每行高度恒为 1,行模型才守得住。
|
|
12
|
+
*
|
|
13
|
+
* 子页(0.6.62):带组的分区在根页画组导航行 `❯ 标题 … ›`,传 group 参时整份
|
|
14
|
+
* rows 已是子页内容(settings-model 负责),这里只多两处观感——标题行变面包屑
|
|
15
|
+
* `设置 › 分区 › 组`、提示条 Esc 换「返回」。
|
|
16
|
+
*
|
|
17
|
+
* @module dsc-tui/app/SettingsOverlay
|
|
18
|
+
*/
|
|
19
|
+
import { Box, Text, useStdout } from 'ink';
|
|
20
|
+
import { displayWidth } from './click.js';
|
|
21
|
+
import { focusableRows } from './settings-model.js';
|
|
22
|
+
import { ACCENT, BORDER, GAP, MARK, PAD, PALETTE, SEP, STATUS_COLOR, TEXT } from './theme.js';
|
|
23
|
+
/** 设置页固定框架行数:外框上下边 2 + 标题 1 + 底部 notice 1 + 提示条 1。 */
|
|
24
|
+
export const SETTINGS_CHROME = 5;
|
|
25
|
+
/** 列表首行距屏幕顶的行数(鼠标行号映射的固定偏移):顶边框 1 + 标题 1。 */
|
|
26
|
+
export const SETTINGS_LIST_TOP = 2;
|
|
27
|
+
/** 按显示宽度硬截断(超宽补 …);CJK 记 2 列,代理对不劈开。 */
|
|
28
|
+
const clipToWidth = (text, max) => {
|
|
29
|
+
if (max <= 2)
|
|
30
|
+
return '';
|
|
31
|
+
let width = 0;
|
|
32
|
+
let out = '';
|
|
33
|
+
for (const char of text) {
|
|
34
|
+
if (width + displayWidth(char) > max - 1)
|
|
35
|
+
return `${out}…`;
|
|
36
|
+
out += char;
|
|
37
|
+
width += displayWidth(char);
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 字段值区(右对齐段)的文本;编辑中的 text/number 显示草稿加光标,值表没到时
|
|
43
|
+
* 显示 … 占位(打开设置页后 values 异步装填,只差几毫秒但不能闪「未设置」)。
|
|
44
|
+
*/
|
|
45
|
+
function fieldValueText(field, values, editing) {
|
|
46
|
+
if (field.type === 'info')
|
|
47
|
+
return field.text;
|
|
48
|
+
if (field.type === 'button')
|
|
49
|
+
return field.label;
|
|
50
|
+
if (editing !== null && editing.key === field.key)
|
|
51
|
+
return `${editing.draft}▌`;
|
|
52
|
+
if (values === undefined)
|
|
53
|
+
return '…';
|
|
54
|
+
const current = values[field.key];
|
|
55
|
+
switch (field.type) {
|
|
56
|
+
case 'switch':
|
|
57
|
+
return current === true ? '[✓]' : '[ ]';
|
|
58
|
+
case 'select': {
|
|
59
|
+
const label = field.options.find((option) => option.value === String(current))?.label;
|
|
60
|
+
return `‹ ${label ?? String(current ?? '')} ›`;
|
|
61
|
+
}
|
|
62
|
+
default:
|
|
63
|
+
// text / number:空值给「未设置」占位(对齐 dsh 的(未设置))
|
|
64
|
+
return current === undefined || current === '' ? '(未设置)' : String(current);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** 值区的颜色:switch 打开是完成绿、button/编辑中是强调系,其余走暗淡档。 */
|
|
68
|
+
function fieldValueColor(field, values, editing, focused) {
|
|
69
|
+
if (field.type === 'button')
|
|
70
|
+
return ACCENT;
|
|
71
|
+
if (field.type === 'info')
|
|
72
|
+
return undefined;
|
|
73
|
+
if (editing !== null && editing.key === field.key)
|
|
74
|
+
return PALETTE.text;
|
|
75
|
+
if (field.type === 'switch')
|
|
76
|
+
return values?.[field.key] === true ? STATUS_COLOR.done : undefined;
|
|
77
|
+
if (field.type === 'select')
|
|
78
|
+
return focused ? ACCENT : undefined;
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
export function SettingsOverlay({ sections, rows, values, focusRow, windowStart, viewport, editing, notice, section, group, }) {
|
|
82
|
+
const { stdout } = useStdout();
|
|
83
|
+
const columns = stdout?.columns ?? 100;
|
|
84
|
+
// 内宽 = 终端列 − 整帧页边距 − 外框描边 2 − 框内 padding
|
|
85
|
+
const innerWidth = Math.max(24, columns - PAD.page * 2 - 2 - PAD.inline * 2);
|
|
86
|
+
const sectionById = new Map(sections.map((section) => [section.id, section]));
|
|
87
|
+
const activeSection = section == null ? undefined : sectionById.get(section);
|
|
88
|
+
const groupSection = group == null ? undefined : sectionById.get(group.sectionId);
|
|
89
|
+
const groupSpec = groupSection?.groups?.find((entry) => entry.id === group?.groupId);
|
|
90
|
+
const focusables = focusableRows(rows, sections);
|
|
91
|
+
const focusOrdinal = focusables.indexOf(focusRow);
|
|
92
|
+
const visible = rows.slice(windowStart, windowStart + Math.max(1, viewport));
|
|
93
|
+
const renderRow = (row, index) => {
|
|
94
|
+
const focused = index === focusRow;
|
|
95
|
+
switch (row.kind) {
|
|
96
|
+
case 'card-top': {
|
|
97
|
+
const base = ` ${row.title} `;
|
|
98
|
+
let head = row.subtitle === undefined ? base : ` ${row.title} · ${row.subtitle} `;
|
|
99
|
+
if (displayWidth(head) > innerWidth - 4)
|
|
100
|
+
head = base; // 窄终端先丢副标题(dsh 同序)
|
|
101
|
+
const fill = Math.max(1, innerWidth - 3 - displayWidth(head));
|
|
102
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: BORDER.frame, children: "\u256D\u2500" }), _jsx(Text, { bold: true, color: PALETTE.text, children: head }), _jsxs(Text, { color: BORDER.frame, children: ['─'.repeat(fill), "\u256E"] })] }, index));
|
|
103
|
+
}
|
|
104
|
+
case 'card-bottom':
|
|
105
|
+
return (_jsxs(Text, { color: BORDER.frame, children: ["\u2570", '─'.repeat(Math.max(0, innerWidth - 2)), "\u256F"] }, index));
|
|
106
|
+
case 'spacer':
|
|
107
|
+
return _jsx(Text, { children: " " }, index);
|
|
108
|
+
case 'section': {
|
|
109
|
+
// 分区导航行(0.6.64,组行同款):标题 + 暗淡副标题,`›` 贴右缘
|
|
110
|
+
const labelText = clipToWidth(row.title, Math.max(8, innerWidth - 12));
|
|
111
|
+
const subText = row.subtitle === undefined ? '' : clipToWidth(row.subtitle, Math.max(4, Math.floor(innerWidth / 3)));
|
|
112
|
+
// 宽度账:标记「❯ 」2 + 标题 + 空格 1 + 副标题 + pad + › 1 ≤ innerWidth
|
|
113
|
+
const pad = Math.max(1, innerWidth - 4 - displayWidth(labelText) - displayWidth(subText));
|
|
114
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [focused ? MARK.selected : MARK.idle, _jsx(Text, { bold: focused, color: PALETTE.text, children: labelText }), subText === '' ? null : (_jsxs(Text, { ...TEXT.secondary, children: [' ', subText] })), ' '.repeat(pad), _jsx(Text, { ...(focused ? {} : TEXT.secondary), color: focused ? ACCENT : undefined, children: "\u203A" })] }, index));
|
|
115
|
+
}
|
|
116
|
+
case 'group': {
|
|
117
|
+
// 组导航行(dsh GroupRow 同款):label 左、`›` 贴右缘,聚焦时强调色
|
|
118
|
+
const labelText = clipToWidth(row.title, Math.max(8, innerWidth - 12));
|
|
119
|
+
const pad = Math.max(1, innerWidth - 2 - displayWidth(labelText) - 1);
|
|
120
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [focused ? MARK.selected : MARK.idle, _jsx(Text, { bold: focused, color: PALETTE.text, children: labelText }), ' '.repeat(pad), _jsx(Text, { ...(focused ? {} : TEXT.secondary), color: focused ? ACCENT : undefined, children: "\u203A" })] }, index));
|
|
121
|
+
}
|
|
122
|
+
case 'hint':
|
|
123
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [focused ? MARK.selected : MARK.idle, _jsx(Text, { ...(row.jump === undefined ? TEXT.secondary : {}), bold: focused, color: row.jump === undefined ? undefined : ACCENT, children: row.text })] }, index));
|
|
124
|
+
case 'field': {
|
|
125
|
+
const section = sectionById.get(row.sectionId);
|
|
126
|
+
const field = section?.fields[row.fieldIndex];
|
|
127
|
+
if (field === undefined)
|
|
128
|
+
return _jsx(Text, { children: " " }, index);
|
|
129
|
+
const sectionValues = values[row.sectionId];
|
|
130
|
+
const valueText = fieldValueText(field, sectionValues, editing !== null && editing.sectionId === row.sectionId ? editing : null);
|
|
131
|
+
const valueColor = fieldValueColor(field, sectionValues, editing !== null && editing.sectionId === row.sectionId ? editing : null, focused);
|
|
132
|
+
const labelText = clipToWidth(field.label ?? '', Math.max(8, innerWidth - 12));
|
|
133
|
+
const clipped = clipToWidth(valueText, Math.max(4, innerWidth - 2 - displayWidth(labelText) - 1));
|
|
134
|
+
const pad = Math.max(1, innerWidth - 2 - displayWidth(labelText) - displayWidth(clipped));
|
|
135
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [focused ? MARK.selected : MARK.idle, _jsx(Text, { bold: focused, color: PALETTE.text, children: labelText }), ' '.repeat(pad), _jsx(Text, { color: valueColor, ...(valueColor === undefined ? TEXT.secondary : {}), children: clipped })] }, index));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// 底部提示条:聚焦字段的 help(可复制的 info 追加复制提示)截断后靠左,按键靠右
|
|
140
|
+
const focusedRow = rows[focusRow];
|
|
141
|
+
const focusedField = focusedRow?.kind === 'field' ? sectionById.get(focusedRow.sectionId)?.fields[focusedRow.fieldIndex] : undefined;
|
|
142
|
+
let help = focusedRow?.kind === 'group'
|
|
143
|
+
? (focusedRow.description ?? '')
|
|
144
|
+
: focusedRow?.kind === 'section'
|
|
145
|
+
? (focusedRow.subtitle ?? '')
|
|
146
|
+
: (focusedField?.help ?? '');
|
|
147
|
+
if (focusedField?.type === 'info' && focusedField.copyable === true) {
|
|
148
|
+
help = `${help === '' ? '' : `${help} · `}Enter 复制`;
|
|
149
|
+
}
|
|
150
|
+
const keys = editing !== null
|
|
151
|
+
? 'Enter 确认并保存 · Esc 取消'
|
|
152
|
+
: groupSpec !== undefined || activeSection !== undefined
|
|
153
|
+
? 'Enter 切换/编辑 · Esc 返回'
|
|
154
|
+
: 'Enter 切换/编辑 · Esc 关闭';
|
|
155
|
+
const helpText = clipToWidth(help, Math.max(0, innerWidth - displayWidth(keys) - 2));
|
|
156
|
+
return (_jsxs(Box, { borderStyle: "round", borderColor: BORDER.active, paddingX: PAD.inline, flexDirection: "column", flexGrow: 1, overflowY: "hidden", gap: GAP.none, children: [_jsx(Box, { flexShrink: 0, flexDirection: "column", gap: GAP.none, children: _jsxs(Text, { ...TEXT.label, color: ACCENT, wrap: "truncate-end", children: [groupSpec !== undefined && groupSection !== undefined ? (_jsxs(_Fragment, { children: ["\u8BBE\u7F6E", _jsx(Text, { ...TEXT.secondary, children: ` › ${groupSection.title} › ` }), groupSpec.title] })) : activeSection !== undefined ? (_jsxs(_Fragment, { children: ["\u8BBE\u7F6E", _jsx(Text, { ...TEXT.secondary, children: ' › ' }), activeSection.title] })) : (`设置(${sections.length} 个分区)`), focusOrdinal >= 0 ? (_jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, focusOrdinal + 1, "/", focusables.length] })) : null] }) }), _jsx(Box, { flexDirection: "column", flexGrow: 1, overflowY: "hidden", gap: GAP.none, children: visible.map((row, offset) => renderRow(row, windowStart + offset)) }), _jsxs(Box, { flexShrink: 0, flexDirection: "column", gap: GAP.none, children: [_jsx(Text, { wrap: "truncate-end", children: notice === null ? (_jsx(Text, { children: " " })) : (_jsxs(Text, { color: notice.ok ? STATUS_COLOR.done : STATUS_COLOR.failed, children: [notice.ok ? '✓' : '✕', " ", notice.text] })) }), _jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { ...TEXT.secondary, children: helpText }), _jsx(Text, { ...TEXT.secondary, children: ' '.repeat(Math.max(1, innerWidth - displayWidth(helpText) - displayWidth(keys))) }), _jsx(Text, { ...TEXT.label, color: ACCENT, children: keys })] })] })] }));
|
|
157
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 技能选择浮层(/skills 无参数打开,对齐 dsh 的 SkillsPicker):只读清单 +
|
|
4
|
+
* 回填输入行。数据来自 runtime.listSkills() 的技能投影;行 = /名字 — 描述,
|
|
5
|
+
* 带来源与「已停用 / 不进目录」标记;输入即筛选,Enter 把 `/技能名 ` 灌回输入行
|
|
6
|
+
* (只能回填 userInvocable 的技能——它们才注册成了真命令),Esc 关闭。
|
|
7
|
+
* 启停管理在桌面端「技能」页,这里不提供。键盘与鼠标路由在 App 顶层,纯展示。
|
|
8
|
+
*
|
|
9
|
+
* @module dsc-tui/app/SkillsPicker
|
|
10
|
+
*/
|
|
11
|
+
import { Box, Text } from 'ink';
|
|
12
|
+
import { ACCENT, BORDER, GAP, MARK, PAD, SEP, STATUS_COLOR, TEXT } from './theme.js';
|
|
13
|
+
export function SkillsPicker({ skills, index, query, }) {
|
|
14
|
+
const safeIndex = Math.min(index, Math.max(0, skills.length - 1));
|
|
15
|
+
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: ["\u6280\u80FD\uFF08", skills.length, " \u4E2A\uFF09", _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u70B9\u51FB\u9009\u4E2D\u3001\u518D\u70B9\u56DE\u586B \u00B7 Enter \u628A /\u6280\u80FD\u540D \u704C\u56DE\u8F93\u5165\u884C \u00B7 \u542F\u505C\u5728\u684C\u9762\u7AEF\u6280\u80FD\u4E2D\u5FC3"] })] }), _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" })] })] }), skills.length === 0 ? _jsx(Text, { ...TEXT.secondary, children: "\uFF08\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD\uFF09" }) : null, skills.map((skill, position) => {
|
|
16
|
+
const selected = position === safeIndex;
|
|
17
|
+
return (_jsxs(Text, { color: selected ? ACCENT : undefined, wrap: "truncate-end", children: [selected ? MARK.selected : MARK.idle, "/", skill.name, !skill.userInvocable ? _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, "\u4E0D\u8FDB\u76EE\u5F55"] }) : null, !skill.enabled ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.waiting, children: [SEP.gap, "\u5DF2\u505C\u7528"] })) : null, _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, skill.source] }), _jsxs(Text, { ...TEXT.secondary, children: [SEP.gap, skill.description] }), skill.problem !== undefined ? (_jsxs(Text, { ...TEXT.label, color: STATUS_COLOR.failed, children: [SEP.gap, "\u6CE8\u610F\uFF1A", skill.problem] })) : null] }, skill.name));
|
|
18
|
+
}), _jsx(Text, { ...TEXT.secondary, wrap: "truncate-end", children: "\u2191\u2193 \u9009\u62E9 \u00B7 Enter \u56DE\u586B \u00B7 Esc \u5173\u95ED \u00B7 \u505C\u7528\u7684\u6280\u80FD\u8981\u5148\u5728\u684C\u9762\u7AEF\u6280\u80FD\u4E2D\u5FC3\u542F\u7528\u624D\u4F1A\u88AB\u52A0\u8F7D" })] }) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { RuntimeSnapshot, RuntimeSurfaces, StatusBarPrefsView, StatusView } from '../contract.js';
|
|
3
|
+
import { type RegisterClick } from './click.js';
|
|
4
|
+
/** 会话 jsonl 路径的短标识(文件名去后缀取前 8 位)。 */
|
|
5
|
+
export declare const shortId: (sessionPath: string) => string;
|
|
6
|
+
export declare function StatusBar({ status, surfaces, subagents, queued, config, onOpenAgent, registerClick, }: {
|
|
7
|
+
status: StatusView;
|
|
8
|
+
surfaces: RuntimeSurfaces;
|
|
9
|
+
subagents: RuntimeSnapshot['subagents'];
|
|
10
|
+
/**
|
|
11
|
+
* 待投递条数(0.6.67):回合跑动中提交的消息先在内核收件箱里排队,界面这边没有
|
|
12
|
+
* 队列条可点,至少要看得见「我刚才那一句排上了」。数的是**整条收件箱**——用户输入
|
|
13
|
+
* (`queued`)与机器通知(`notices`,队友汇报那类)都在等出账,只数前者会把通知漏掉。
|
|
14
|
+
* 0 就不画这一段。
|
|
15
|
+
*/
|
|
16
|
+
queued: number;
|
|
17
|
+
/** 段显隐(prefs.ui.statusBar;设置 → 终端界面 → 状态栏 子页可改)。 */
|
|
18
|
+
config: StatusBarPrefsView;
|
|
19
|
+
/** 点后台芯片:打开那个会话的转录浮层(子代理查看入口之一)。 */
|
|
20
|
+
onOpenAgent?: (sessionPath: string) => void;
|
|
21
|
+
registerClick?: RegisterClick;
|
|
22
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* 底部状态栏(0.6.59 对齐 dsh StatusLine 的规格,0.6.60 分段条与费用):固定两行、无框。
|
|
4
|
+
*
|
|
5
|
+
* 第一行是 **context 分段进度条**——占用段按内容类型着色(system/prompt/assistant/
|
|
6
|
+
* thinking/tools,dsh 蓝系谱;估算分段,见 core/token-estimate),空闲段右侧读数
|
|
7
|
+
* `10k/1.0M 1.0%`。读数的分子是**最近一次请求的 prompt_tokens**(权威占用;usage
|
|
8
|
+
* 累计是多轮计费和,会把滚出窗口的内容也算进去),≥80% 琥珀、≥95% 红。
|
|
9
|
+
*
|
|
10
|
+
* 第二行是状态字段行:段间 ` · ` 暗淡分隔(theme 的 SEP.dot),左右两组
|
|
11
|
+
* space-between;后台芯片可点,直达转录。段显隐走 prefs.ui.statusBar(设置 →
|
|
12
|
+
* 终端界面 → 状态栏,0.6.62),开关与数据双条件、缺一整段缺席;总宽超出预算时
|
|
13
|
+
* 按 priority **整段丢弃**(对齐 dsh 的「段缺席优于段截断」——旧版全靠 ink 的
|
|
14
|
+
* flex 等比压缩,宽终端一挤就段段变 `xxx...`),可丢的全丢光仍放不下才让
|
|
15
|
+
* cwd/model 收缩截断。≈¥ 只在 DeepSeek 官方端点且模型有价目时出现(峰谷按
|
|
16
|
+
* 北京时段分桶估算)。行数恒定是选择器几何的组成部分。
|
|
17
|
+
*
|
|
18
|
+
* @module dsc-tui/app/StatusBar
|
|
19
|
+
*/
|
|
20
|
+
import { useRef } from 'react';
|
|
21
|
+
import { Box, Text, useStdout } from 'ink';
|
|
22
|
+
import { measuredSpan, useClickRegion } from './click.js';
|
|
23
|
+
import { displayWidth } from './markdown.js';
|
|
24
|
+
import { CONTEXT_SEGMENTS, GAP, PAD, PALETTE, SEP, STATUS_COLOR, TEXT } from './theme.js';
|
|
25
|
+
/** 回合状态词:中文硬编码,本项目不做 i18n。 */
|
|
26
|
+
const TURN_LABEL = {
|
|
27
|
+
idle: '空闲',
|
|
28
|
+
thinking: '思考中',
|
|
29
|
+
working: '执行中',
|
|
30
|
+
'awaiting-approval': '等待审批',
|
|
31
|
+
};
|
|
32
|
+
/** 回合状态色:进行中的两种状态共用一个状态色,空闲只靠暗淡色。 */
|
|
33
|
+
const TURN_COLOR = {
|
|
34
|
+
idle: STATUS_COLOR.idle,
|
|
35
|
+
thinking: STATUS_COLOR.pending,
|
|
36
|
+
working: STATUS_COLOR.pending,
|
|
37
|
+
'awaiting-approval': STATUS_COLOR.waiting,
|
|
38
|
+
};
|
|
39
|
+
/** 后台会话状态点的形状与颜色(working 青 / 待审批黄 / 已完成未读绿)。 */
|
|
40
|
+
const BACKGROUND_DOT = {
|
|
41
|
+
working: { mark: '◐', color: STATUS_COLOR.pending },
|
|
42
|
+
'awaiting-approval': { mark: '⚠', color: STATUS_COLOR.waiting },
|
|
43
|
+
'just-finished': { mark: '✓', color: STATUS_COLOR.done },
|
|
44
|
+
};
|
|
45
|
+
/** 会话 jsonl 路径的短标识(文件名去后缀取前 8 位)。 */
|
|
46
|
+
export const shortId = (sessionPath) => (sessionPath.split(/[\\/]/).pop() ?? sessionPath).replace(/\.jsonl$/, '').slice(0, 8);
|
|
47
|
+
/** cwd 尾部显示:太长时只留最后两段(Windows 盘符段算一段)。 */
|
|
48
|
+
const shortCwd = (cwd) => {
|
|
49
|
+
const parts = cwd.split(/[\\/]/).filter((part) => part !== '');
|
|
50
|
+
return parts.length <= 2 ? cwd : `…${parts.slice(-2).join('/')}`;
|
|
51
|
+
};
|
|
52
|
+
/** 段的显示宽度(chip 按渲染文本 `mark id` 算)。 */
|
|
53
|
+
const segmentWidth = (segment) => {
|
|
54
|
+
if (segment.kind === 'chip') {
|
|
55
|
+
return displayWidth(`${BACKGROUND_DOT[segment.state].mark} ${shortId(segment.sessionPath)}`);
|
|
56
|
+
}
|
|
57
|
+
return displayWidth(segment.text);
|
|
58
|
+
};
|
|
59
|
+
/** 一组段的总宽:段宽之和 + 段间 ` · ` 分隔(组内只有一段时没有分隔)。 */
|
|
60
|
+
const groupWidth = (segments) => segments.reduce((sum, segment) => sum + segmentWidth(segment), 0) +
|
|
61
|
+
Math.max(0, segments.length - 1) * displayWidth(SEP.dot);
|
|
62
|
+
/**
|
|
63
|
+
* 优先级丢段:左右组总宽(+ 最小 2 列组间缝)超出预算时,按 priority 从小到大
|
|
64
|
+
* **整段**丢弃重算,直到放得下或没有可丢段。返回筛选后的两份列表(原数组不动)。
|
|
65
|
+
*/
|
|
66
|
+
function fitSegments(left, right, budget) {
|
|
67
|
+
let leftFitted = [...left];
|
|
68
|
+
let rightFitted = [...right];
|
|
69
|
+
const overflow = () => groupWidth(leftFitted) + groupWidth(rightFitted) + 2 > budget;
|
|
70
|
+
while (overflow()) {
|
|
71
|
+
const droppable = [...leftFitted, ...rightFitted]
|
|
72
|
+
.filter((segment) => segment.priority >= 0)
|
|
73
|
+
.sort((a, b) => a.priority - b.priority)[0];
|
|
74
|
+
if (droppable === undefined)
|
|
75
|
+
break;
|
|
76
|
+
leftFitted = leftFitted.filter((segment) => segment !== droppable);
|
|
77
|
+
rightFitted = rightFitted.filter((segment) => segment !== droppable);
|
|
78
|
+
}
|
|
79
|
+
return { left: leftFitted, right: rightFitted };
|
|
80
|
+
}
|
|
81
|
+
/** token 数的人话格式(dsh StatusMetrics 同口径):988 / 3.4k / 12k / 1.0M。 */
|
|
82
|
+
const fmtTokens = (value) => {
|
|
83
|
+
if (value >= 1_000_000)
|
|
84
|
+
return `${(value / 1_000_000).toFixed(1)}M`;
|
|
85
|
+
if (value >= 1000)
|
|
86
|
+
return `${(value / 1000).toFixed(1)}k`;
|
|
87
|
+
return String(value);
|
|
88
|
+
};
|
|
89
|
+
/** 后台会话芯片:一枚状态点 + 短 id,整枚可点,点了开那个会话的转录浮层。 */
|
|
90
|
+
function BackgroundChip({ sessionPath, state, onOpen, registerClick, }) {
|
|
91
|
+
const ref = useRef(null);
|
|
92
|
+
const dot = BACKGROUND_DOT[state];
|
|
93
|
+
useClickRegion(ref, registerClick, (col, row, top, height) => {
|
|
94
|
+
if (row < top || row >= top + height)
|
|
95
|
+
return false;
|
|
96
|
+
// 同排还有别的 chip 与文本段:只查行不查列会让任何点击都命中第一个注册的
|
|
97
|
+
// chip(0.6.66 实锤),列区间也要对上——量不到列就宁可无操作。
|
|
98
|
+
const span = measuredSpan(ref.current);
|
|
99
|
+
if (span === null || col < span.left || col >= span.left + span.width)
|
|
100
|
+
return false;
|
|
101
|
+
onOpen(sessionPath);
|
|
102
|
+
return true;
|
|
103
|
+
});
|
|
104
|
+
return (_jsx(Box, { ref: ref, flexShrink: 0, children: _jsxs(Text, { ...TEXT.label, color: dot.color, wrap: "truncate-end", children: [dot.mark, " ", shortId(sessionPath)] }) }));
|
|
105
|
+
}
|
|
106
|
+
/** 全零分段(快照缺字段时的兜底:老 mock / 旧版本快照没有 contextSegments 也不许炸)。 */
|
|
107
|
+
const EMPTY_SEGMENTS = {
|
|
108
|
+
system: 0,
|
|
109
|
+
prompt: 0,
|
|
110
|
+
assistant: 0,
|
|
111
|
+
thinking: 0,
|
|
112
|
+
tools: 0,
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* context 分段进度条(dsh renderContextBar 的 JSX 版):占用段各一块纯色
|
|
116
|
+
* (childless Box——渲染器按自身矩形填背景色),空闲段深底、右缘挂读数。
|
|
117
|
+
* 列宽分配 = largest-remainder + 每个可见段至少 1 列(dsh allocateBarColumns 同款)。
|
|
118
|
+
*/
|
|
119
|
+
function ContextBar({ status }) {
|
|
120
|
+
const { stdout } = useStdout();
|
|
121
|
+
const width = Math.max(10, (stdout?.columns ?? 100) - PAD.page * 2);
|
|
122
|
+
const window = status.contextWindow;
|
|
123
|
+
const used = window > 0 ? Math.min(status.contextUsed ?? 0, window) : 0;
|
|
124
|
+
const ratio = window > 0 ? used / window : 0;
|
|
125
|
+
const pctText = window > 0 ? `${(ratio * 100).toFixed(1)}%` : '--%';
|
|
126
|
+
// 读数阶梯(dsh contextBarReadout):全形式放不下就退到只剩百分比
|
|
127
|
+
const fullReadout = `${fmtTokens(used)}/${window > 0 ? fmtTokens(window) : '--'} ${pctText}`;
|
|
128
|
+
const readout = width - displayWidth(fullReadout) >= 2 ? fullReadout : pctText;
|
|
129
|
+
const readoutWidth = displayWidth(readout);
|
|
130
|
+
// 分段列宽:空闲段 = 窗口 − 权威占用(不是分段之和——分段是估算,只管颜色组成)。
|
|
131
|
+
// 窗口未知(0)时整条画成空闲段:状态栏行数是恒定几何,条不能塌成 0 行。
|
|
132
|
+
const free = window > 0 ? Math.max(0, window - used) : width;
|
|
133
|
+
const segments = status.contextSegments ?? EMPTY_SEGMENTS;
|
|
134
|
+
const values = [...CONTEXT_SEGMENTS.map((segment) => segments[segment.key] ?? 0), free];
|
|
135
|
+
const columns = allocateBarColumns(values, width);
|
|
136
|
+
const nodes = [];
|
|
137
|
+
for (const [index, segment] of CONTEXT_SEGMENTS.entries()) {
|
|
138
|
+
const segmentWidth = columns[index] ?? 0;
|
|
139
|
+
if (segmentWidth <= 0)
|
|
140
|
+
continue;
|
|
141
|
+
nodes.push(_jsx(Box, { width: segmentWidth, height: 1, flexShrink: 0, backgroundColor: segment.color }, segment.key));
|
|
142
|
+
}
|
|
143
|
+
const freeWidth = columns[CONTEXT_SEGMENTS.length] ?? 0;
|
|
144
|
+
if (freeWidth > 0) {
|
|
145
|
+
// 读数永远贴条右缘;压力阈值染读数(空闲段底色不动)
|
|
146
|
+
const pressure = ratio >= 0.95 ? PALETTE.error : ratio >= 0.8 ? PALETTE.warning : undefined;
|
|
147
|
+
nodes.push(_jsx(Box, { width: freeWidth, height: 1, flexShrink: 0, backgroundColor: PALETTE.surface, children: _jsxs(Text, { color: pressure ?? undefined, dimColor: pressure === undefined, wrap: "truncate-end", children: [' '.repeat(Math.max(0, freeWidth - readoutWidth)), readout] }) }, "free"));
|
|
148
|
+
}
|
|
149
|
+
return (_jsx(Box, { flexDirection: "row", flexShrink: 0, children: nodes }));
|
|
150
|
+
}
|
|
151
|
+
/** largest-remainder 列宽分配(dsh StatusMetrics 同款):可见段先各保 1 列,其余按比例分。 */
|
|
152
|
+
function allocateBarColumns(values, width) {
|
|
153
|
+
const allocate = (columns) => {
|
|
154
|
+
if (columns <= 0)
|
|
155
|
+
return values.map(() => 0);
|
|
156
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
157
|
+
if (total <= 0)
|
|
158
|
+
return values.map(() => 0);
|
|
159
|
+
const raw = values.map((value) => (value / total) * columns);
|
|
160
|
+
const floored = raw.map(Math.floor);
|
|
161
|
+
let remaining = columns - floored.reduce((sum, value) => sum + value, 0);
|
|
162
|
+
const byRemainder = raw
|
|
163
|
+
.map((value, index) => ({ index, remainder: value - Math.floor(value) }))
|
|
164
|
+
.sort((left, right) => right.remainder - left.remainder);
|
|
165
|
+
for (const slot of byRemainder) {
|
|
166
|
+
if (remaining <= 0)
|
|
167
|
+
break;
|
|
168
|
+
floored[slot.index] = (floored[slot.index] ?? 0) + 1;
|
|
169
|
+
remaining -= 1;
|
|
170
|
+
}
|
|
171
|
+
return floored;
|
|
172
|
+
};
|
|
173
|
+
const visible = values.map((value, index) => (value > 0 ? index : -1)).filter((index) => index >= 0);
|
|
174
|
+
if (visible.length === 0 || visible.length >= width)
|
|
175
|
+
return allocate(width);
|
|
176
|
+
const minimum = values.map(() => 0);
|
|
177
|
+
for (const index of visible)
|
|
178
|
+
minimum[index] = 1;
|
|
179
|
+
const rest = allocate(width - visible.length);
|
|
180
|
+
return minimum.map((min, index) => min + (rest[index] ?? 0));
|
|
181
|
+
}
|
|
182
|
+
export function StatusBar({ status, surfaces, subagents, queued, config, onOpenAgent, registerClick, }) {
|
|
183
|
+
const { stdout } = useStdout();
|
|
184
|
+
const modeLabel = surfaces.mode.options.find((option) => option.id === surfaces.mode.current)?.label ??
|
|
185
|
+
surfaces.mode.current;
|
|
186
|
+
const policyLabel = surfaces.policy.options.find((option) => option.id === surfaces.policy.current)?.label ??
|
|
187
|
+
surfaces.policy.current;
|
|
188
|
+
// 审阅者后缀:权限档只说「能不能自动放行」,谁在裁是另一根轴——先给模型判官看的
|
|
189
|
+
// 时候补一句,一眼看出现在的审批实际落在谁手里(不给后缀 = 本人点卡)。
|
|
190
|
+
const reviewerSuffix = surfaces.policy.reviewer === 'auto-review' ? '·AI 复核' : '';
|
|
191
|
+
const usage = status.usage;
|
|
192
|
+
const cacheHit = usage?.cacheHitTokens ?? 0;
|
|
193
|
+
const cacheMiss = usage?.cacheMissTokens ?? 0;
|
|
194
|
+
const cacheTotal = cacheHit + cacheMiss;
|
|
195
|
+
const ctxPct = status.contextWindow > 0 ? `${((status.contextUsed / status.contextWindow) * 100).toFixed(1)}%` : '--%';
|
|
196
|
+
// 段装配:开关(config)与数据(usage/cost/cwd)双条件,缺一整段缺席。
|
|
197
|
+
// priority 只排「谁先被丢」,与左右组内的显示顺序无关。
|
|
198
|
+
const left = [
|
|
199
|
+
{
|
|
200
|
+
kind: 'text',
|
|
201
|
+
id: 'turn',
|
|
202
|
+
text: `${status.turnState === 'idle' ? '●' : '◐'} ${TURN_LABEL[status.turnState]}`,
|
|
203
|
+
tone: 'label',
|
|
204
|
+
color: TURN_COLOR[status.turnState],
|
|
205
|
+
priority: -1,
|
|
206
|
+
},
|
|
207
|
+
];
|
|
208
|
+
if (config.model)
|
|
209
|
+
left.push({ kind: 'text', id: 'model', text: status.model, tone: 'secondary', priority: -1 });
|
|
210
|
+
// 排队中的输入(0.6.67):回合跑动中提交的消息在内核收件箱里等着出账,终端这边
|
|
211
|
+
// 没有队列条,至少让「我刚发的那句排上了」看得见。priority 0:这条是临时状态,
|
|
212
|
+
// 挤不下时比 turn/model/会话先让位的只有它(比错字好)。
|
|
213
|
+
if (queued > 0)
|
|
214
|
+
left.push({ kind: 'text', id: 'queued', text: `⌛ 排队 ${String(queued)} 条`, tone: 'secondary', priority: 0 });
|
|
215
|
+
if (config.effort)
|
|
216
|
+
left.push({ kind: 'text', id: 'effort', text: `effort ${status.effort ?? '-'}`, tone: 'secondary', priority: 5 });
|
|
217
|
+
if (config.cache && usage !== null && cacheTotal > 0)
|
|
218
|
+
left.push({ kind: 'text', id: 'cache', text: `缓存${Math.round((cacheHit / cacheTotal) * 100)}%`, tone: 'secondary', priority: 3 });
|
|
219
|
+
if (config.tokens && usage !== null)
|
|
220
|
+
left.push({
|
|
221
|
+
kind: 'text',
|
|
222
|
+
id: 'tokens',
|
|
223
|
+
text: `tok ${fmtTokens(usage.inputTokens)}↑ ${fmtTokens(usage.outputTokens)}↓`,
|
|
224
|
+
tone: 'secondary',
|
|
225
|
+
priority: 0,
|
|
226
|
+
});
|
|
227
|
+
// 费用估算:峰谷按北京时段分桶(core/pricing),估不出来就不显示这个字段
|
|
228
|
+
if (config.cost && status.cost !== undefined)
|
|
229
|
+
left.push({
|
|
230
|
+
kind: 'text',
|
|
231
|
+
id: 'cost',
|
|
232
|
+
text: `≈¥${status.cost.total.toFixed(2)} ${status.cost.peakNow ? '峰' : '谷'}`,
|
|
233
|
+
tone: 'secondary',
|
|
234
|
+
priority: 2,
|
|
235
|
+
});
|
|
236
|
+
if (config.mode)
|
|
237
|
+
left.push({ kind: 'text', id: 'mode', text: `模式 ${modeLabel}`, tone: 'secondary', priority: 4 });
|
|
238
|
+
if (config.policy)
|
|
239
|
+
left.push({ kind: 'text', id: 'policy', text: `权限 ${policyLabel}${reviewerSuffix}`, tone: 'secondary', priority: 7 });
|
|
240
|
+
const right = [];
|
|
241
|
+
if (config.ctx)
|
|
242
|
+
right.push({ kind: 'text', id: 'ctx', text: `ctx ${ctxPct}`, tone: 'secondary', priority: 6 });
|
|
243
|
+
if (config.cwd && status.cwd !== undefined && status.cwd !== '')
|
|
244
|
+
right.push({ kind: 'text', id: 'cwd', text: shortCwd(status.cwd), tone: 'secondary', priority: 9 });
|
|
245
|
+
if (config.session)
|
|
246
|
+
right.push({
|
|
247
|
+
kind: 'text',
|
|
248
|
+
id: 'session',
|
|
249
|
+
text: status.sessionId === null ? '未打开会话' : `会话 ${shortId(status.sessionId)}`,
|
|
250
|
+
tone: 'secondary',
|
|
251
|
+
priority: 1,
|
|
252
|
+
});
|
|
253
|
+
// 子代理 chip 只收当前会话派出去、还在干活的队友(0.6.65 收紧作用域):
|
|
254
|
+
// 收工即消失、切走会话即消失;跨会话动态只活在 /resume 行内状态点与 /agents。
|
|
255
|
+
for (const chip of subagents) {
|
|
256
|
+
right.push({
|
|
257
|
+
kind: 'chip',
|
|
258
|
+
id: `chip:${chip.sessionPath}`,
|
|
259
|
+
sessionPath: chip.sessionPath,
|
|
260
|
+
state: chip.state,
|
|
261
|
+
priority: 8,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
// 宽度预算 = 终端列 − root 的页边距;丢段后仍溢出才让 cwd/model 收缩截断。
|
|
265
|
+
const budget = Math.max(10, (stdout?.columns ?? 100) - PAD.page * 2);
|
|
266
|
+
const fitted = fitSegments(left, right, budget);
|
|
267
|
+
const shrink = groupWidth(fitted.left) + groupWidth(fitted.right) + 2 > budget;
|
|
268
|
+
const flexible = (segment) => shrink && segment.kind === 'text' && (segment.id === 'cwd' || segment.id === 'model');
|
|
269
|
+
/** 一组段 → 带 ` · ` 分隔的节点序列;分隔钉死不缩,可缩的只有 cwd/model。 */
|
|
270
|
+
const renderGroup = (segments) => segments.map((segment, index) => (_jsxs(Box, { flexShrink: flexible(segment) ? 1 : 0, children: [index > 0 ? (_jsx(Box, { flexShrink: 0, children: _jsx(Text, { ...TEXT.secondary, children: SEP.dot }) })) : null, segment.kind === 'chip' ? (_jsx(BackgroundChip, { sessionPath: segment.sessionPath, state: segment.state, onOpen: onOpenAgent === undefined ? () => { } : onOpenAgent, registerClick: onOpenAgent === undefined ? undefined : registerClick })) : (_jsx(Text, { ...(segment.tone === 'label' ? TEXT.label : TEXT.secondary), color: segment.color, wrap: "truncate-end", children: segment.text }))] }, segment.id)));
|
|
271
|
+
return (_jsxs(Box, { flexDirection: "column", gap: GAP.none, children: [_jsx(ContextBar, { status: status }), _jsxs(Box, { justifyContent: "space-between", children: [_jsx(Box, { children: renderGroup(fitted.left) }), _jsx(Box, { children: renderGroup(fitted.right) })] })] }));
|
|
272
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { GoalView, TodoView } from '../contract.js';
|
|
3
|
+
export declare function GoalStrip({ goal }: {
|
|
4
|
+
goal: GoalView;
|
|
5
|
+
}): JSX.Element;
|
|
6
|
+
export declare function TodoStrip({ todos }: {
|
|
7
|
+
todos: TodoView;
|
|
8
|
+
}): JSX.Element | null;
|
|
9
|
+
/** 两条一起排(间距在这里一处声明)。 */
|
|
10
|
+
export declare function TaskStrips({ goal, todos }: {
|
|
11
|
+
goal: GoalView | null;
|
|
12
|
+
todos: TodoView;
|
|
13
|
+
}): JSX.Element | null;
|