@waq666/pneuma 0.7.1 → 0.8.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/README.md +242 -206
- package/bin/dsc.js +9 -3
- package/bin/headless.cjs +1 -1
- package/lib/adapter/transcript.d.ts +19 -2
- package/lib/adapter/transcript.js +71 -14
- package/lib/app/AgentsOverlay.js +7 -6
- package/lib/app/App.js +1 -1
- package/lib/app/ApprovalCard.js +15 -9
- package/lib/app/ChatView.d.ts +3 -1
- package/lib/app/ChatView.js +21 -17
- package/lib/app/Composer.js +22 -4
- package/lib/app/MarkdownView.js +2 -1
- package/lib/app/ModelPicker.js +7 -6
- package/lib/app/PickerFrame.d.ts +4 -0
- package/lib/app/PickerFrame.js +18 -0
- package/lib/app/PlanReviewCard.js +2 -1
- package/lib/app/PresetPicker.js +8 -7
- package/lib/app/SessionPicker.js +21 -20
- package/lib/app/SettingsOverlay.js +1 -1
- package/lib/app/SkillsPicker.js +7 -6
- package/lib/app/StatusBar.js +3 -15
- package/lib/app/TaskStrips.js +1 -4
- package/lib/app/TimelineRail.js +2 -1
- package/lib/app/ToolCard.js +2 -6
- package/lib/app/Welcome.d.ts +1 -0
- package/lib/app/Welcome.js +1 -4
- package/lib/app/click.d.ts +0 -2
- package/lib/app/click.js +2 -21
- package/lib/app/display-width.d.ts +16 -0
- package/lib/app/display-width.js +33 -0
- package/lib/app/markdown.d.ts +1 -3
- package/lib/app/markdown.js +2 -19
- package/lib/app/scroll-model.js +1 -1
- package/lib/contract/approval.d.ts +91 -0
- package/lib/contract/approval.js +1 -0
- package/lib/contract/mode.d.ts +69 -0
- package/lib/contract/mode.js +1 -0
- package/lib/contract/plugin.d.ts +240 -0
- package/lib/contract/plugin.js +1 -0
- package/lib/contract/runtime.d.ts +282 -0
- package/lib/contract/runtime.js +1 -0
- package/lib/contract/session.d.ts +208 -0
- package/lib/contract/session.js +36 -0
- package/lib/contract/settings.d.ts +242 -0
- package/lib/contract/settings.js +1 -0
- package/lib/contract/snapshot.d.ts +453 -0
- package/lib/contract/snapshot.js +1 -0
- package/lib/contract/task.d.ts +189 -0
- package/lib/contract/task.js +10 -0
- package/lib/contract/transcript.d.ts +358 -0
- package/lib/contract/transcript.js +1 -0
- package/lib/contract/usage.d.ts +132 -0
- package/lib/contract/usage.js +10 -0
- package/lib/contract.d.ts +20 -1968
- package/lib/contract.js +19 -30
- package/lib/core/agent-roles.d.ts +1 -1
- package/lib/core/agent-roles.js +6 -5
- package/lib/core/approval-floor.d.ts +9 -0
- package/lib/core/approval-floor.js +152 -25
- package/lib/core/attachments.d.ts +185 -0
- package/lib/core/attachments.js +425 -0
- package/lib/core/bytes.d.ts +14 -0
- package/lib/core/bytes.js +28 -0
- package/lib/core/call-meaning.d.ts +20 -0
- package/lib/core/call-meaning.js +347 -0
- package/lib/core/cdp/actions.js +6 -0
- package/lib/core/cdp/launch.js +2 -2
- package/lib/core/cdp/report.d.ts +27 -0
- package/lib/core/cdp/report.js +50 -0
- package/lib/core/cdp/ring-buffer.d.ts +25 -0
- package/lib/core/cdp/ring-buffer.js +44 -0
- package/lib/core/cdp/snapshot.js +5 -9
- package/lib/core/cdp/transport.js +1 -1
- package/lib/core/clamp.d.ts +20 -0
- package/lib/core/clamp.js +24 -0
- package/lib/core/clock.d.ts +16 -0
- package/lib/core/clock.js +20 -0
- package/lib/core/command-policy.js +33 -1
- package/lib/core/commands-completion.d.ts +28 -0
- package/lib/core/commands-completion.js +108 -30
- package/lib/core/compact.d.ts +36 -6
- package/lib/core/compact.js +89 -17
- package/lib/core/desktop-control.js +1 -3
- package/lib/core/dsh-compat/llm-usage-event.d.ts +78 -0
- package/lib/core/dsh-compat/llm-usage-event.js +91 -0
- package/lib/core/dsh-compat/presentation.d.ts +84 -0
- package/lib/core/dsh-compat/presentation.js +105 -0
- package/lib/core/dsh-compat/resolve-hook.d.ts +3 -3
- package/lib/core/dsh-compat/resolve-hook.js +41 -13
- package/lib/core/dsh-compat/service-map.d.ts +52 -0
- package/lib/core/dsh-compat/service-map.js +87 -0
- package/lib/core/dsh-compat/session-bridge.d.ts +107 -0
- package/lib/core/dsh-compat/session-bridge.js +376 -0
- package/lib/core/dsh-compat/session-events.d.ts +54 -0
- package/lib/core/dsh-compat/session-events.js +297 -0
- package/lib/core/dsh-compat/shims/credentials.d.ts +62 -0
- package/lib/core/dsh-compat/shims/credentials.js +86 -0
- package/lib/core/dsh-compat/shims/home-paths.d.ts +77 -0
- package/lib/core/dsh-compat/shims/home-paths.js +143 -0
- package/lib/core/dsh-compat/tools-facade.d.ts +31 -1
- package/lib/core/dsh-compat/tools-facade.js +207 -3
- package/lib/core/err-text.d.ts +5 -0
- package/lib/core/err-text.js +5 -0
- package/lib/core/events.d.ts +31 -2
- package/lib/core/git-info.d.ts +127 -15
- package/lib/core/git-info.js +315 -34
- package/lib/core/git-surface.d.ts +17 -0
- package/lib/core/git-surface.js +7 -0
- package/lib/core/hooks.d.ts +19 -2
- package/lib/core/hooks.js +57 -13
- package/lib/core/host-methods.d.ts +1 -1
- package/lib/core/host-methods.js +4 -0
- package/lib/core/image-diet.js +1 -4
- package/lib/core/json-text.d.ts +11 -0
- package/lib/core/json-text.js +18 -0
- package/lib/core/learnings/skill-write.d.ts +1 -7
- package/lib/core/learnings/skill-write.js +3 -37
- package/lib/core/lifecycle-hooks.d.ts +11 -3
- package/lib/core/lifecycle-hooks.js +33 -42
- package/lib/core/llm.d.ts +42 -0
- package/lib/core/llm.js +40 -25
- package/lib/core/loop.d.ts +11 -1
- package/lib/core/loop.js +95 -28
- package/lib/core/lsp/client.js +30 -17
- package/lib/core/lsp/normalize.d.ts +0 -2
- package/lib/core/lsp/normalize.js +1 -6
- package/lib/core/lsp/servers.js +1 -4
- package/lib/core/mcp.d.ts +18 -0
- package/lib/core/mcp.js +60 -16
- package/lib/core/microcompact.d.ts +45 -0
- package/lib/core/microcompact.js +128 -0
- package/lib/core/native-bridge.js +2 -10
- package/lib/core/path-policy.d.ts +13 -1
- package/lib/core/path-policy.js +87 -18
- package/lib/core/permission-presets.d.ts +9 -5
- package/lib/core/permission-presets.js +14 -7
- package/lib/core/permission-scope.d.ts +65 -0
- package/lib/core/permission-scope.js +109 -0
- package/lib/core/plugin-bundle.d.ts +95 -0
- package/lib/core/plugin-bundle.js +137 -0
- package/lib/core/plugin-loader.d.ts +36 -1
- package/lib/core/plugin-loader.js +336 -12
- package/lib/core/plugin-patch.d.ts +64 -0
- package/lib/core/plugin-patch.js +146 -0
- package/lib/core/plugin-registry.d.ts +14 -0
- package/lib/core/plugin-registry.js +2 -0
- package/lib/core/prefs.js +40 -2
- package/lib/core/presets.d.ts +11 -0
- package/lib/core/presets.js +61 -22
- package/lib/core/profile-dir.d.ts +5 -0
- package/lib/core/profile-dir.js +40 -0
- package/lib/core/prompt.js +55 -19
- package/lib/core/ptc.d.ts +8 -2
- package/lib/core/ptc.js +18 -4
- package/lib/core/records.d.ts +16 -0
- package/lib/core/records.js +22 -0
- package/lib/core/remote/notify.js +1 -3
- package/lib/core/remote/push.js +2 -6
- package/lib/core/sandbox/execpolicy.js +27 -3
- package/lib/core/sandbox/net-proxy.js +2 -2
- package/lib/core/sandbox/policy.d.ts +1 -1
- package/lib/core/sandbox/policy.js +21 -15
- package/lib/core/sandbox/win/account.js +1 -4
- package/lib/core/sandbox/win/acl.js +1 -6
- package/lib/core/sandbox/win/backend.d.ts +24 -3
- package/lib/core/sandbox/win/backend.js +73 -23
- package/lib/core/sandbox/win/doctor.js +1 -4
- package/lib/core/sandbox/win/runner-entry.js +1 -6
- package/lib/core/sandbox/win/setup.js +1 -4
- package/lib/core/sandbox/win/utf16.d.ts +11 -0
- package/lib/core/sandbox/win/utf16.js +15 -0
- package/lib/core/sandbox/win/wfp.js +1 -4
- package/lib/core/schedule/rule.d.ts +0 -17
- package/lib/core/schedule/rule.js +1 -3
- package/lib/core/schedule/runner.d.ts +5 -2
- package/lib/core/schedule/runner.js +32 -9
- package/lib/core/schedule/store.d.ts +0 -2
- package/lib/core/schedule/store.js +2 -9
- package/lib/core/session-index.d.ts +50 -0
- package/lib/core/session-index.js +169 -3
- package/lib/core/session.d.ts +89 -13
- package/lib/core/session.js +385 -32
- package/lib/core/shell-quote.d.ts +21 -0
- package/lib/core/shell-quote.js +24 -0
- package/lib/core/side-ask.d.ts +52 -0
- package/lib/core/side-ask.js +89 -0
- package/lib/core/skills.d.ts +16 -0
- package/lib/core/skills.js +45 -8
- package/lib/core/snapshot-throttle.d.ts +8 -0
- package/lib/core/snapshot-throttle.js +24 -0
- package/lib/core/spill.d.ts +11 -5
- package/lib/core/spill.js +35 -36
- package/lib/core/strings.d.ts +21 -0
- package/lib/core/strings.js +33 -0
- package/lib/core/terminal-env.d.ts +61 -0
- package/lib/core/terminal-env.js +327 -0
- package/lib/core/text-format.d.ts +17 -0
- package/lib/core/text-format.js +26 -0
- package/lib/core/todo-reminder.d.ts +19 -14
- package/lib/core/todo-reminder.js +14 -23
- package/lib/core/token-estimate.d.ts +18 -2
- package/lib/core/token-estimate.js +10 -2
- package/lib/core/tool-result-prune.d.ts +42 -0
- package/lib/core/tool-result-prune.js +47 -0
- package/lib/core/tool-search.d.ts +3 -2
- package/lib/core/tool-search.js +3 -2
- package/lib/core/tools/bash.d.ts +35 -3
- package/lib/core/tools/bash.js +168 -41
- package/lib/core/tools/fs-tools.js +18 -17
- package/lib/core/tools/image-tool.d.ts +2 -0
- package/lib/core/tools/image-tool.js +59 -0
- package/lib/core/tools/path-args.d.ts +4 -0
- package/lib/core/tools/path-args.js +22 -0
- package/lib/core/tools/search-tools.d.ts +30 -0
- package/lib/core/tools/search-tools.js +321 -34
- package/lib/core/tools.d.ts +82 -0
- package/lib/core/tools.js +21 -0
- package/lib/core/transcript-text.d.ts +19 -0
- package/lib/core/transcript-text.js +44 -0
- package/lib/core/ui-boot-source.d.ts +5 -0
- package/lib/core/ui-boot-source.js +10 -3
- package/lib/core/ui-bundles.d.ts +80 -6
- package/lib/core/ui-bundles.js +700 -76
- package/lib/core/ui-events.d.ts +10 -0
- package/lib/core/ui-events.js +25 -0
- package/lib/core/ui-methods.d.ts +1 -1
- package/lib/core/ui-methods.js +42 -13
- package/lib/core/ui-route.js +11 -7
- package/lib/core/ui-server.d.ts +6 -0
- package/lib/core/ui-server.js +106 -1
- package/lib/core/unified-diff.d.ts +35 -0
- package/lib/core/unified-diff.js +86 -0
- package/lib/core/usage-log.js +39 -0
- package/lib/core/web-http.d.ts +1 -1
- package/lib/core/web-http.js +1 -3
- package/lib/host/kernel.js +57 -41
- package/lib/plugins/agent.js +101 -20
- package/lib/plugins/approval-floor.js +12 -8
- package/lib/plugins/approval.js +252 -80
- package/lib/plugins/ask.js +60 -8
- package/lib/plugins/browser.js +32 -84
- package/lib/plugins/commands.js +167 -57
- package/lib/plugins/compact.d.ts +2 -2
- package/lib/plugins/compact.js +200 -30
- package/lib/plugins/computer-use.js +34 -18
- package/lib/plugins/dock-browser.js +24 -65
- package/lib/plugins/dsh-compat.js +7 -0
- package/lib/plugins/file-review.js +59 -15
- package/lib/plugins/git.js +16 -8
- package/lib/plugins/goal.js +9 -8
- package/lib/plugins/hooks.js +4 -2
- package/lib/plugins/host-stdio.js +14 -16
- package/lib/plugins/lifecycle-hooks.d.ts +5 -4
- package/lib/plugins/lifecycle-hooks.js +12 -10
- package/lib/plugins/llm.js +74 -33
- package/lib/plugins/lsp.js +22 -27
- package/lib/plugins/mcp.js +16 -17
- package/lib/plugins/memory.js +3 -24
- package/lib/plugins/microcompact.d.ts +4 -1
- package/lib/plugins/microcompact.js +117 -19
- package/lib/plugins/mode.js +30 -11
- package/lib/plugins/permission-presets.d.ts +2 -1
- package/lib/plugins/permission-presets.js +55 -35
- package/lib/plugins/plugin-manager.js +4 -6
- package/lib/plugins/presets.js +56 -27
- package/lib/plugins/prompt.js +54 -11
- package/lib/plugins/ptc.d.ts +13 -0
- package/lib/plugins/ptc.js +121 -24
- package/lib/plugins/remote/types.d.ts +1 -1
- package/lib/plugins/remote/types.js +11 -0
- package/lib/plugins/remote.js +14 -15
- package/lib/plugins/runtime.js +91 -14
- package/lib/plugins/sandbox.js +181 -60
- package/lib/plugins/schedule.js +12 -11
- package/lib/plugins/self-improve.js +28 -18
- package/lib/plugins/session-search.js +18 -13
- package/lib/plugins/session-title.js +1 -1
- package/lib/plugins/session.js +103 -25
- package/lib/plugins/settings.js +16 -40
- package/lib/plugins/skills.js +18 -1
- package/lib/plugins/spill.js +18 -11
- package/lib/plugins/subagent.js +208 -42
- package/lib/plugins/team.js +11 -5
- package/lib/plugins/todo.d.ts +1 -1
- package/lib/plugins/todo.js +25 -19
- package/lib/plugins/tool-search.js +47 -28
- package/lib/plugins/tools-default.js +89 -5
- package/lib/plugins/tools.js +3 -3
- package/lib/plugins/transcript.js +116 -9
- package/lib/plugins/web-search.d.ts +1 -1
- package/lib/plugins/web-search.js +25 -16
- package/lib/plugins/webserver.js +40 -7
- package/lib/remote/assets/app-B3Id1EBq.js +14 -0
- package/lib/remote/assets/index.html +2 -2
- package/lib/remote/assets/{style-DIB6729x.css → style-NtlpbKOI.css} +1 -1
- package/lib/services/types.d.ts +247 -29
- package/lib/tools/plugin-cli.d.ts +1 -0
- package/lib/tools/plugin-cli.js +209 -0
- package/lib/ui/assets/app-B-Jx5dnh.js +90 -0
- package/lib/ui/assets/{chunk-BajyYBss.js → chunk-Bfdlo8Me.js} +1 -1
- package/lib/ui/assets/chunk-DGX-i4eb.js +12 -0
- package/lib/ui/assets/index.html +62 -14
- package/lib/ui/assets/style-WzxwEPaE.css +1 -0
- package/lib/ui/frames.js +1 -3
- package/lib/ui/index.d.ts +30 -1
- package/lib/ui/index.js +29 -0
- package/lib/ui/manifest.d.ts +24 -6
- package/lib/ui/manifest.js +3 -2
- package/lib/ui/plugins/actions/bundle.json +8 -0
- package/lib/ui/plugins/actions/client.js +43 -0
- package/lib/ui/plugins/ask/bundle.json +8 -0
- package/lib/ui/plugins/ask/client.js +415 -0
- package/lib/ui/plugins/browser/bundle.json +8 -0
- package/lib/ui/plugins/composer/bundle.json +9 -0
- package/lib/ui/plugins/composer/client.js +1806 -1087
- package/lib/ui/plugins/files/bundle.json +8 -0
- package/lib/ui/plugins/files/client.js +13 -98
- package/lib/ui/plugins/manifest.json +1 -104
- package/lib/ui/plugins/palette/bundle.json +8 -0
- package/lib/ui/plugins/palette/client.js +360 -0
- package/lib/ui/plugins/plugins/bundle.json +8 -0
- package/lib/ui/plugins/plugins/client.js +116 -38
- package/lib/ui/plugins/preview/bundle.json +8 -0
- package/lib/ui/plugins/preview/client.js +6 -16
- package/lib/ui/plugins/prompt/bundle.json +8 -0
- package/lib/ui/plugins/prompt/client.js +81 -47
- package/lib/ui/plugins/sessions/bundle.json +8 -0
- package/lib/ui/plugins/sessions/client.js +157 -111
- package/lib/ui/plugins/settings/bundle.json +8 -0
- package/lib/ui/plugins/settings/client.js +184 -170
- package/lib/ui/plugins/skills/bundle.json +8 -0
- package/lib/ui/plugins/skills/client.js +161 -79
- package/lib/ui/plugins/status/bundle.json +8 -0
- package/lib/ui/plugins/status/client.js +165 -26
- package/lib/ui/plugins/statusbar/bundle.json +9 -0
- package/lib/ui/plugins/statusbar/client.js +100 -144
- package/lib/ui/plugins/tasks/bundle.json +8 -0
- package/lib/ui/plugins/team/bundle.json +8 -0
- package/lib/ui/plugins/team/client.js +60 -58
- package/lib/ui/plugins/terminal/bundle.json +8 -0
- package/lib/ui/plugins/terminal/client.js +1 -7
- package/lib/ui/plugins/trace/bundle.json +11 -0
- package/lib/ui/plugins/trace/client.js +86 -179
- package/lib/ui/plugins/transcript/bundle.json +8 -0
- package/lib/ui/plugins/transcript/client.js +1608 -1243
- package/lib/ui/sdk/@dsc/ui/index.d.ts +54 -16
- package/lib/ui/sdk/@dsc/ui/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-core/contract.d.ts +20 -1968
- package/lib/ui/sdk/@dsc/ui-core/core/attachments.d.ts +185 -0
- package/lib/ui/sdk/@dsc/ui-core/core/bytes.d.ts +14 -0
- package/lib/ui/sdk/@dsc/ui-core/core/err-text.d.ts +18 -0
- package/lib/ui/sdk/@dsc/ui-core/core/git-surface.d.ts +17 -0
- package/lib/ui/sdk/@dsc/ui-core/core/json-text.d.ts +11 -0
- package/lib/ui/sdk/@dsc/ui-core/core/path-policy.d.ts +44 -0
- package/lib/ui/sdk/@dsc/ui-core/core/records.d.ts +16 -0
- package/lib/ui/sdk/@dsc/ui-core/core/throughput.d.ts +46 -0
- package/lib/ui/sdk/@dsc/ui-core/core/token-estimate.d.ts +18 -2
- package/lib/ui/sdk/@dsc/ui-core/core/unified-diff.d.ts +35 -0
- package/lib/ui/sdk/@dsc/ui-core/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-core/ui/index.d.ts +30 -1
- package/lib/ui/sdk/@dsc/ui-core/ui/manifest.d.ts +24 -6
- package/lib/ui/sdk/@dsc/ui-core/ui/services.d.ts +19 -8
- package/lib/ui/sdk/@dsc/ui-core/ui/signal.d.ts +49 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-model.d.ts +17 -3
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-state.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-dockkit/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/app.d.ts +4 -0
- package/lib/ui/sdk/@dsc/ui-layout/appearance.d.ts +6 -1
- package/lib/ui/sdk/@dsc/ui-layout/host-channel.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-layout/index.d.ts +1 -0
- package/lib/ui/sdk/@dsc/ui-layout/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/page-state.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/runtime-context.d.ts +10 -1
- package/lib/ui/sdk/@dsc/ui-layout/thread-view.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-layout/usage-today.d.ts +11 -0
- package/lib/ui/sdk/@dsc/ui-primitives/dialog-focus.d.ts +30 -0
- package/lib/ui/sdk/@dsc/ui-primitives/error-text.d.ts +12 -0
- package/lib/ui/sdk/@dsc/ui-primitives/git-surface.d.ts +9 -0
- package/lib/ui/sdk/@dsc/ui-primitives/highlight.d.ts +23 -0
- package/lib/ui/sdk/@dsc/ui-primitives/humanize-error.d.ts +35 -0
- package/lib/ui/sdk/@dsc/ui-primitives/icons-workspace.d.ts +33 -0
- package/lib/ui/sdk/@dsc/ui-primitives/icons.d.ts +21 -3
- package/lib/ui/sdk/@dsc/ui-primitives/image-lightbox.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-primitives/index.d.ts +16 -0
- package/lib/ui/sdk/@dsc/ui-primitives/markdown.d.ts +10 -14
- package/lib/ui/sdk/@dsc/ui-primitives/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-primitives/panels.d.ts +31 -8
- package/lib/ui/sdk/@dsc/ui-primitives/paths.d.ts +2 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-findings-card.d.ts +25 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-findings.d.ts +64 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-notice-card.d.ts +27 -0
- package/lib/ui/sdk/@dsc/ui-primitives/review-notice.d.ts +80 -0
- package/lib/ui/sdk/@dsc/ui-primitives/signal.d.ts +9 -0
- package/lib/ui/sdk/@dsc/ui-primitives/sizes.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-primitives/skeleton.d.ts +39 -0
- package/lib/ui/sdk/@dsc/ui-primitives/snapshot.d.ts +46 -0
- package/lib/ui/sdk/@dsc/ui-primitives/thread-resizer.d.ts +3 -3
- package/lib/ui/sdk/@dsc/ui-primitives/throughput.d.ts +13 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tokens.d.ts +9 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tool-args.d.ts +1 -1
- package/lib/ui/sdk/@dsc/ui-primitives/tool-summary.d.ts +30 -6
- package/lib/ui/sdk/@dsc/ui-primitives/unified-diff.d.ts +10 -0
- package/lib/ui/sdk/@dsc/ui-renderer/boot.d.ts +10 -1
- package/lib/ui/sdk/@dsc/ui-renderer/cordis-host.d.ts +113 -0
- package/lib/ui/sdk/@dsc/ui-renderer/package.json +1 -1
- package/lib/ui/sdk/@dsc/ui-slots/package.json +1 -1
- package/lib/ui/services.d.ts +19 -8
- package/lib/ui/services.js +20 -12
- package/lib/ui/signal.d.ts +49 -0
- package/lib/ui/signal.js +57 -0
- package/lib/ui/tui-plugins.js +36 -16
- package/package.json +71 -58
- package/lib/remote/assets/app-DAcUCOEn.js +0 -14
- package/lib/ui/assets/app-B70nVIKd.js +0 -69
- package/lib/ui/assets/chunk-BGcgwlCI.js +0 -12
- package/lib/ui/assets/style-Bq01xH_b.css +0 -1
|
@@ -4,79 +4,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const react = require("react");
|
|
6
6
|
const ui$1 = require("@dsc/ui");
|
|
7
|
-
const
|
|
8
|
-
function parseUnifiedDiff(text) {
|
|
9
|
-
const hunks = [];
|
|
10
|
-
const lines = text.split(/\r?\n/);
|
|
11
|
-
let at = 0;
|
|
12
|
-
while (at < lines.length) {
|
|
13
|
-
const head = (lines[at] ?? "").match(HUNK_HEAD);
|
|
14
|
-
if (head === null) {
|
|
15
|
-
at += 1;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
at += 1;
|
|
19
|
-
const rows = [];
|
|
20
|
-
let oldLine = Number(head[1]);
|
|
21
|
-
let newLine = Number(head[3]);
|
|
22
|
-
while (at < lines.length) {
|
|
23
|
-
const line = lines[at] ?? "";
|
|
24
|
-
if (HUNK_HEAD.test(line)) break;
|
|
25
|
-
const tag = line.charAt(0);
|
|
26
|
-
if (tag === "\\") {
|
|
27
|
-
at += 1;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
if (tag === " ") {
|
|
31
|
-
rows.push({ kind: "context", text: line.slice(1), oldLine, newLine });
|
|
32
|
-
oldLine += 1;
|
|
33
|
-
newLine += 1;
|
|
34
|
-
} else if (tag === "-") {
|
|
35
|
-
rows.push({ kind: "remove", text: line.slice(1), oldLine, newLine: null });
|
|
36
|
-
oldLine += 1;
|
|
37
|
-
} else if (tag === "+") {
|
|
38
|
-
rows.push({ kind: "add", text: line.slice(1), oldLine: null, newLine });
|
|
39
|
-
newLine += 1;
|
|
40
|
-
} else {
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
at += 1;
|
|
44
|
-
}
|
|
45
|
-
if (rows.length > 0) {
|
|
46
|
-
hunks.push({
|
|
47
|
-
oldStart: Number(head[1]),
|
|
48
|
-
oldCount: rows.reduce((sum, row) => sum + (row.kind === "add" ? 0 : 1), 0),
|
|
49
|
-
newStart: Number(head[3]),
|
|
50
|
-
newCount: rows.reduce((sum, row) => sum + (row.kind === "remove" ? 0 : 1), 0),
|
|
51
|
-
lines: rows
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return hunks;
|
|
56
|
-
}
|
|
57
|
-
function splitUnifiedDiffByFile(text) {
|
|
58
|
-
const files = [];
|
|
59
|
-
const chunks = text.split(/^diff --git /m).filter((chunk) => chunk.trim() !== "");
|
|
60
|
-
for (const chunk of chunks) {
|
|
61
|
-
const firstLineEnd = chunk.indexOf("\n");
|
|
62
|
-
const first = firstLineEnd < 0 ? chunk : chunk.slice(0, firstLineEnd);
|
|
63
|
-
const nameMatch = first.match(/^a\/(.*) b\/(.*)$/);
|
|
64
|
-
const path = (nameMatch !== null ? nameMatch[2] : first).trim();
|
|
65
|
-
if (path === "") continue;
|
|
66
|
-
const hunks = parseUnifiedDiff(chunk);
|
|
67
|
-
if (hunks.length === 0) continue;
|
|
68
|
-
let added = 0;
|
|
69
|
-
let removed = 0;
|
|
70
|
-
for (const hunk of hunks) {
|
|
71
|
-
for (const row of hunk.lines) {
|
|
72
|
-
if (row.kind === "add") added += 1;
|
|
73
|
-
else if (row.kind === "remove") removed += 1;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
files.push({ path, added, removed, hunks });
|
|
77
|
-
}
|
|
78
|
-
return files;
|
|
79
|
-
}
|
|
7
|
+
const uiPrimitives = require("@dsc/ui-primitives");
|
|
80
8
|
function fileOf(entry) {
|
|
81
9
|
return entry.replace(/^[ AMDRCU?]+\s+/, "");
|
|
82
10
|
}
|
|
@@ -340,6 +268,7 @@ function CommitDialog(props) {
|
|
|
340
268
|
const [message, setMessage] = react.useState("");
|
|
341
269
|
const [includeUnstaged, setIncludeUnstaged] = react.useState(false);
|
|
342
270
|
const [selected, setSelected] = react.useState([]);
|
|
271
|
+
const dialog = uiPrimitives.useDialogFocus(true, props.onClose);
|
|
343
272
|
const unstagedPaths = props.unstaged.map((entry) => fileOf(entry));
|
|
344
273
|
const toggleUnstagedAll = (next) => {
|
|
345
274
|
setIncludeUnstaged(next);
|
|
@@ -360,7 +289,9 @@ function CommitDialog(props) {
|
|
|
360
289
|
{
|
|
361
290
|
className: "git-dialog",
|
|
362
291
|
role: "dialog",
|
|
292
|
+
"aria-modal": "true",
|
|
363
293
|
"aria-label": "提交",
|
|
294
|
+
ref: dialog.ref,
|
|
364
295
|
onClick: (event) => {
|
|
365
296
|
event.stopPropagation();
|
|
366
297
|
},
|
|
@@ -419,6 +350,7 @@ function CommitDialog(props) {
|
|
|
419
350
|
"textarea",
|
|
420
351
|
{
|
|
421
352
|
className: "git-dialog-message",
|
|
353
|
+
"data-autofocus": true,
|
|
422
354
|
rows: 3,
|
|
423
355
|
placeholder: "遵循 feat:/fix:/chore: 规范",
|
|
424
356
|
value: message,
|
|
@@ -435,8 +367,8 @@ function CommitDialog(props) {
|
|
|
435
367
|
) });
|
|
436
368
|
}
|
|
437
369
|
function GitDiffView(props) {
|
|
438
|
-
const sections = props.diff.loading ? [] : props.all ? splitUnifiedDiffByFile(props.diff.text) : (() => {
|
|
439
|
-
const hunks = parseUnifiedDiff(props.diff.text);
|
|
370
|
+
const sections = props.diff.loading ? [] : props.all ? uiPrimitives.splitUnifiedDiffByFile(props.diff.text) : (() => {
|
|
371
|
+
const hunks = uiPrimitives.parseUnifiedDiff(props.diff.text);
|
|
440
372
|
const added = hunks.reduce((sum, hunk) => sum + hunk.lines.filter((line) => line.kind === "add").length, 0);
|
|
441
373
|
const removed = hunks.reduce((sum, hunk) => sum + hunk.lines.filter((line) => line.kind === "remove").length, 0);
|
|
442
374
|
return hunks.length === 0 ? [] : [{ path: props.title, added, removed, hunks }];
|
|
@@ -472,9 +404,9 @@ function GitDiffView(props) {
|
|
|
472
404
|
] });
|
|
473
405
|
}
|
|
474
406
|
const trees = /* @__PURE__ */ new Map();
|
|
475
|
-
const
|
|
407
|
+
const treeChannel = ui$1.createSignal(0);
|
|
476
408
|
function emit() {
|
|
477
|
-
|
|
409
|
+
treeChannel.notify();
|
|
478
410
|
}
|
|
479
411
|
function getTree(cwd) {
|
|
480
412
|
let tree = trees.get(cwd);
|
|
@@ -485,10 +417,7 @@ function getTree(cwd) {
|
|
|
485
417
|
return tree;
|
|
486
418
|
}
|
|
487
419
|
function subscribe(listener) {
|
|
488
|
-
|
|
489
|
-
return () => {
|
|
490
|
-
listeners.delete(listener);
|
|
491
|
-
};
|
|
420
|
+
return treeChannel.subscribe(listener);
|
|
492
421
|
}
|
|
493
422
|
function put(cwd, next) {
|
|
494
423
|
trees.set(cwd, next);
|
|
@@ -526,7 +455,7 @@ const ui = ui$1.defineUiPlugin({
|
|
|
526
455
|
}
|
|
527
456
|
});
|
|
528
457
|
function FilesTab() {
|
|
529
|
-
const cwd = ui$1.useHostSelector(readCwd);
|
|
458
|
+
const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
|
|
530
459
|
if (cwd === null || cwd === "") {
|
|
531
460
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "files-pane", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tree-note", children: "读取中…" }) });
|
|
532
461
|
}
|
|
@@ -561,7 +490,7 @@ function TreeLevel({ cwd, path, depth }) {
|
|
|
561
490
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
562
491
|
level.truncated ? /* @__PURE__ */ jsxRuntime.jsx(TreeNote, { kind: "truncated" }) : null,
|
|
563
492
|
entries.map((entry) => {
|
|
564
|
-
const entryPath = joinPath(path, entry.name);
|
|
493
|
+
const entryPath = uiPrimitives.joinPath(path, entry.name);
|
|
565
494
|
if (entry.dir) {
|
|
566
495
|
const expanded = tree.expanded.includes(entryPath);
|
|
567
496
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tree-item", "data-tree-entry": "directory", children: [
|
|
@@ -582,7 +511,7 @@ function TreeLevel({ cwd, path, depth }) {
|
|
|
582
511
|
children: [
|
|
583
512
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "file-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.FileIcon, { name: entry.name, size: 15 }) }),
|
|
584
513
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "file-name", children: entry.name }),
|
|
585
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "file-size", children:
|
|
514
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "file-size", children: uiPrimitives.formatBytes(entry.size) })
|
|
586
515
|
]
|
|
587
516
|
},
|
|
588
517
|
entry.name
|
|
@@ -628,19 +557,5 @@ function FilesPane({ cwd }) {
|
|
|
628
557
|
)
|
|
629
558
|
] });
|
|
630
559
|
}
|
|
631
|
-
function joinPath(parent, name) {
|
|
632
|
-
return /[\\/]$/.test(parent) ? parent + name : `${parent}\\${name}`;
|
|
633
|
-
}
|
|
634
|
-
function formatSize(size) {
|
|
635
|
-
if (size < 1024) return `${String(size)}B`;
|
|
636
|
-
if (size < 1024 * 1024) return `${String(Math.max(1, Math.round(size / 1024)))}KB`;
|
|
637
|
-
return `${(size / 1024 / 1024).toFixed(1)}MB`;
|
|
638
|
-
}
|
|
639
|
-
function readCwd(snapshot) {
|
|
640
|
-
const status = snapshot?.["status"];
|
|
641
|
-
if (typeof status !== "object" || status === null) return null;
|
|
642
|
-
const value = status["cwd"];
|
|
643
|
-
return typeof value === "string" && value !== "" ? value : null;
|
|
644
|
-
}
|
|
645
560
|
exports.default = ui;
|
|
646
561
|
};
|
|
@@ -1,107 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"apiVersion": "
|
|
4
|
-
"plugins": [
|
|
5
|
-
{
|
|
6
|
-
"id": "browser",
|
|
7
|
-
"file": "client.js",
|
|
8
|
-
"platform": "web",
|
|
9
|
-
"api": "^1.1.0"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"id": "composer",
|
|
13
|
-
"file": "client.js",
|
|
14
|
-
"platform": "web",
|
|
15
|
-
"api": "^1.1.0",
|
|
16
|
-
"phase": "early"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"id": "files",
|
|
20
|
-
"file": "client.js",
|
|
21
|
-
"platform": "web",
|
|
22
|
-
"api": "^1.1.0"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"id": "plugins",
|
|
26
|
-
"file": "client.js",
|
|
27
|
-
"platform": "web",
|
|
28
|
-
"api": "^1.1.0"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"id": "preview",
|
|
32
|
-
"file": "client.js",
|
|
33
|
-
"platform": "web",
|
|
34
|
-
"api": "^1.1.0"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"id": "prompt",
|
|
38
|
-
"file": "client.js",
|
|
39
|
-
"platform": "web",
|
|
40
|
-
"api": "^1.1.0"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"id": "sessions",
|
|
44
|
-
"file": "client.js",
|
|
45
|
-
"platform": "web",
|
|
46
|
-
"api": "^1.1.0"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"id": "settings",
|
|
50
|
-
"file": "client.js",
|
|
51
|
-
"platform": "web",
|
|
52
|
-
"api": "^1.1.0"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"id": "skills",
|
|
56
|
-
"file": "client.js",
|
|
57
|
-
"platform": "web",
|
|
58
|
-
"api": "^1.1.0"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"id": "status",
|
|
62
|
-
"file": "client.js",
|
|
63
|
-
"platform": "web",
|
|
64
|
-
"api": "^1.1.0"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"id": "statusbar",
|
|
68
|
-
"file": "client.js",
|
|
69
|
-
"platform": "web",
|
|
70
|
-
"api": "^1.1.0",
|
|
71
|
-
"phase": "early"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"id": "tasks",
|
|
75
|
-
"file": "client.js",
|
|
76
|
-
"platform": "web",
|
|
77
|
-
"api": "^1.1.0"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"id": "team",
|
|
81
|
-
"file": "client.js",
|
|
82
|
-
"platform": "web",
|
|
83
|
-
"api": "^1.1.0"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"id": "terminal",
|
|
87
|
-
"file": "client.js",
|
|
88
|
-
"platform": "web",
|
|
89
|
-
"api": "^1.1.0"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"id": "trace",
|
|
93
|
-
"file": "client.js",
|
|
94
|
-
"platform": "web",
|
|
95
|
-
"api": "^1.1.0",
|
|
96
|
-
"inject": [
|
|
97
|
-
"transcript"
|
|
98
|
-
]
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"id": "transcript",
|
|
102
|
-
"file": "client.js",
|
|
103
|
-
"platform": "web",
|
|
104
|
-
"api": "^1.1.0"
|
|
105
|
-
}
|
|
106
|
-
]
|
|
3
|
+
"apiVersion": "0.8.1"
|
|
107
4
|
}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
(globalThis.__DSC_UI_FACTORIES__ ??= {})["palette"] = function (require, module, exports) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
const react = require("react");
|
|
6
|
+
const ui$1 = require("@dsc/ui");
|
|
7
|
+
const uiPrimitives = require("@dsc/ui-primitives");
|
|
8
|
+
const OPEN_EVENT = "shell.palette.open";
|
|
9
|
+
const HELP_EVENT = "shell.shortcuts.open";
|
|
10
|
+
const ui = ui$1.defineUiPlugin({
|
|
11
|
+
name: "命令面板",
|
|
12
|
+
apply(ui2) {
|
|
13
|
+
ui2.slots.register("shell.header", { id: "palette.panel", order: 70 }, PalettePanel);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
function PalettePanel() {
|
|
17
|
+
const channel = ui$1.useHostChannel();
|
|
18
|
+
const sessions = ui$1.useHostSelector(uiPrimitives.readSessions);
|
|
19
|
+
const actions = ui$1.useActions();
|
|
20
|
+
const [open, setOpen] = react.useState(false);
|
|
21
|
+
const [help, setHelp] = react.useState(false);
|
|
22
|
+
const [query, setQuery] = react.useState("");
|
|
23
|
+
const [active, setActive] = react.useState(0);
|
|
24
|
+
const input = react.useRef(null);
|
|
25
|
+
const list = react.useRef(null);
|
|
26
|
+
react.useEffect(() => {
|
|
27
|
+
const toggle = () => {
|
|
28
|
+
setQuery("");
|
|
29
|
+
setActive(0);
|
|
30
|
+
setOpen((value) => !value);
|
|
31
|
+
};
|
|
32
|
+
const typing = (target) => {
|
|
33
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
34
|
+
const tag = target.tagName;
|
|
35
|
+
return tag === "INPUT" || tag === "TEXTAREA" || target.isContentEditable;
|
|
36
|
+
};
|
|
37
|
+
const onKey = (event) => {
|
|
38
|
+
if (event.shiftKey && event.key.toLowerCase() === "k") return;
|
|
39
|
+
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "k") {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
setHelp(false);
|
|
42
|
+
toggle();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (event.key === "?" && !event.ctrlKey && !event.metaKey && !typing(event.target)) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
setOpen(false);
|
|
48
|
+
setHelp(true);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (event.key === "Escape" && (open || help)) {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
setOpen(false);
|
|
54
|
+
setHelp(false);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const onEvent = () => {
|
|
58
|
+
setQuery("");
|
|
59
|
+
setActive(0);
|
|
60
|
+
setHelp(false);
|
|
61
|
+
setOpen(true);
|
|
62
|
+
};
|
|
63
|
+
const onHelp = () => {
|
|
64
|
+
setOpen(false);
|
|
65
|
+
setHelp(true);
|
|
66
|
+
};
|
|
67
|
+
window.addEventListener("keydown", onKey);
|
|
68
|
+
window.addEventListener(OPEN_EVENT, onEvent);
|
|
69
|
+
window.addEventListener(HELP_EVENT, onHelp);
|
|
70
|
+
return () => {
|
|
71
|
+
window.removeEventListener("keydown", onKey);
|
|
72
|
+
window.removeEventListener(OPEN_EVENT, onEvent);
|
|
73
|
+
window.removeEventListener(HELP_EVENT, onHelp);
|
|
74
|
+
};
|
|
75
|
+
}, [open, help]);
|
|
76
|
+
react.useEffect(() => {
|
|
77
|
+
if (open) input.current?.focus();
|
|
78
|
+
}, [open]);
|
|
79
|
+
const items = react.useMemo(() => {
|
|
80
|
+
const list2 = actions.filter((action) => action.palette !== false).map((action) => ({
|
|
81
|
+
id: action.id,
|
|
82
|
+
label: action.label,
|
|
83
|
+
hint: action.hint ?? "",
|
|
84
|
+
group: action.group ?? "动作",
|
|
85
|
+
...action.shortcut === void 0 ? {} : { shortcut: action.shortcut },
|
|
86
|
+
keywords: action.keywords ?? [],
|
|
87
|
+
run: action.run
|
|
88
|
+
}));
|
|
89
|
+
const recent = [...sessions].filter((session) => session.archivedAt === void 0).sort((a, b) => b.updatedAt - a.updatedAt).slice(0, 8);
|
|
90
|
+
for (const session of recent) {
|
|
91
|
+
list2.push({
|
|
92
|
+
id: `session.${session.id}`,
|
|
93
|
+
label: session.title ?? "新会话",
|
|
94
|
+
hint: session.cwd,
|
|
95
|
+
group: "最近会话",
|
|
96
|
+
keywords: [],
|
|
97
|
+
run: () => {
|
|
98
|
+
void channel.invoke("openSession", [session.id]);
|
|
99
|
+
void channel.invoke("refreshSessions", []);
|
|
100
|
+
setOpen(false);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return list2;
|
|
105
|
+
}, [actions, channel, sessions]);
|
|
106
|
+
const shown = react.useMemo(() => {
|
|
107
|
+
const needle = query.trim().toLowerCase();
|
|
108
|
+
if (needle === "") return items;
|
|
109
|
+
return items.filter((item) => matches(item, needle));
|
|
110
|
+
}, [items, query]);
|
|
111
|
+
react.useEffect(() => {
|
|
112
|
+
setActive(0);
|
|
113
|
+
}, [query]);
|
|
114
|
+
react.useEffect(() => {
|
|
115
|
+
if (!open) return;
|
|
116
|
+
list.current?.querySelector('[data-active="1"]')?.scrollIntoView({ block: "nearest" });
|
|
117
|
+
}, [active, query, open]);
|
|
118
|
+
const pageRows = () => {
|
|
119
|
+
const node = list.current;
|
|
120
|
+
if (node === null) return 5;
|
|
121
|
+
const row = node.querySelector(".palette-row");
|
|
122
|
+
const rowHeight = row === null ? 35 : row.getBoundingClientRect().height + 1;
|
|
123
|
+
return Math.max(1, Math.floor((node.clientHeight - rowHeight) / rowHeight));
|
|
124
|
+
};
|
|
125
|
+
if (help) {
|
|
126
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
127
|
+
ShortcutSheet,
|
|
128
|
+
{
|
|
129
|
+
onClose: () => {
|
|
130
|
+
setHelp(false);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
if (!open) return null;
|
|
136
|
+
const pick = (item) => {
|
|
137
|
+
if (item === void 0) return;
|
|
138
|
+
item.run();
|
|
139
|
+
setOpen(false);
|
|
140
|
+
};
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
className: "palette-mask",
|
|
145
|
+
onMouseDown: () => {
|
|
146
|
+
setOpen(false);
|
|
147
|
+
},
|
|
148
|
+
onWheel: (event) => {
|
|
149
|
+
wheelToList(event, list.current);
|
|
150
|
+
},
|
|
151
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
className: "palette",
|
|
155
|
+
role: "dialog",
|
|
156
|
+
"aria-modal": "true",
|
|
157
|
+
"aria-label": "命令面板",
|
|
158
|
+
onMouseDown: (event) => {
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
},
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "palette-search", children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconSearch, { size: 15 }),
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
165
|
+
"input",
|
|
166
|
+
{
|
|
167
|
+
ref: input,
|
|
168
|
+
value: query,
|
|
169
|
+
placeholder: "搜索动作、会话或设置…",
|
|
170
|
+
"aria-label": "搜索动作、会话或设置",
|
|
171
|
+
onChange: (event) => {
|
|
172
|
+
setQuery(event.target.value);
|
|
173
|
+
},
|
|
174
|
+
onKeyDown: (event) => {
|
|
175
|
+
if (event.key === "ArrowDown") {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
setActive((index) => Math.min(index + 1, shown.length - 1));
|
|
178
|
+
} else if (event.key === "ArrowUp") {
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
setActive((index) => Math.max(index - 1, 0));
|
|
181
|
+
} else if (event.key === "PageDown" || event.key === "PageUp") {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
const step = pageRows();
|
|
184
|
+
const delta = event.key === "PageDown" ? step : -step;
|
|
185
|
+
setActive((index) => Math.max(0, Math.min(shown.length - 1, index + delta)));
|
|
186
|
+
} else if (event.key === "Home" || event.key === "End") {
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
setActive(event.key === "Home" ? 0 : Math.max(0, shown.length - 1));
|
|
189
|
+
} else if (event.key === "Enter") {
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
pick(shown[active]);
|
|
192
|
+
} else if (event.key === "Tab") {
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "palette-key", children: "Esc" }),
|
|
199
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
+
"button",
|
|
201
|
+
{
|
|
202
|
+
type: "button",
|
|
203
|
+
className: "palette-close",
|
|
204
|
+
title: "关闭,快捷键 Esc",
|
|
205
|
+
"aria-label": "关闭命令面板",
|
|
206
|
+
onClick: () => {
|
|
207
|
+
setOpen(false);
|
|
208
|
+
},
|
|
209
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconClose, { size: 15 })
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "palette-list", ref: list, role: "listbox", "aria-label": "匹配项", children: [
|
|
214
|
+
shown.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "palette-empty", children: "没有匹配项" }) : null,
|
|
215
|
+
shown.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
ItemRow,
|
|
217
|
+
{
|
|
218
|
+
item,
|
|
219
|
+
active: index === active,
|
|
220
|
+
header: index === 0 ? item.group : shown[index - 1]?.group === item.group ? void 0 : item.group,
|
|
221
|
+
onHover: () => {
|
|
222
|
+
setActive(index);
|
|
223
|
+
},
|
|
224
|
+
onPick: () => {
|
|
225
|
+
pick(item);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
item.id
|
|
229
|
+
))
|
|
230
|
+
] }),
|
|
231
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "palette-foot", children: [
|
|
232
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "上下键选择" }),
|
|
233
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "PgUp / PgDn 翻页" }),
|
|
234
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "回车打开" }),
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Esc 关闭" }),
|
|
236
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
237
|
+
"button",
|
|
238
|
+
{
|
|
239
|
+
type: "button",
|
|
240
|
+
className: "palette-foot-link",
|
|
241
|
+
onClick: () => {
|
|
242
|
+
setOpen(false);
|
|
243
|
+
setHelp(true);
|
|
244
|
+
},
|
|
245
|
+
children: [
|
|
246
|
+
"键盘快捷键 ",
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "palette-key", children: "?" })
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
] })
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
const SHORTCUTS = [
|
|
259
|
+
{ keys: "Ctrl K", label: "命令面板", note: "搜动作、会话与设置" },
|
|
260
|
+
{ keys: "Ctrl B", label: "收起 / 展开侧栏" },
|
|
261
|
+
{ keys: "Ctrl P", label: "文件页签" },
|
|
262
|
+
{ keys: "Ctrl `", label: "终端页签" },
|
|
263
|
+
{ keys: "Ctrl T", label: "浏览器页签" },
|
|
264
|
+
{ keys: "Ctrl Enter", label: "插话", note: "回合进行中补一句" },
|
|
265
|
+
{ keys: "Ctrl Alt R", label: "重命名会话", note: "焦点在会话行上" },
|
|
266
|
+
{ keys: "Ctrl Alt F", label: "分叉会话", note: "焦点在会话行上" },
|
|
267
|
+
{ keys: "Ctrl Shift A", label: "归档会话", note: "焦点在会话行上" },
|
|
268
|
+
{ keys: "Esc", label: "关闭浮层" }
|
|
269
|
+
];
|
|
270
|
+
function ShortcutSheet({ onClose }) {
|
|
271
|
+
const list = react.useRef(null);
|
|
272
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
273
|
+
"div",
|
|
274
|
+
{
|
|
275
|
+
className: "palette-mask",
|
|
276
|
+
onMouseDown: onClose,
|
|
277
|
+
onWheel: (event) => {
|
|
278
|
+
wheelToList(event, list.current);
|
|
279
|
+
},
|
|
280
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
className: "palette shortcut-sheet",
|
|
284
|
+
role: "dialog",
|
|
285
|
+
"aria-modal": "true",
|
|
286
|
+
"aria-label": "键盘快捷键",
|
|
287
|
+
onMouseDown: (event) => {
|
|
288
|
+
event.stopPropagation();
|
|
289
|
+
},
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shortcut-head", children: [
|
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "键盘快捷键" }),
|
|
293
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "palette-key", children: "Esc" }),
|
|
294
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
295
|
+
"button",
|
|
296
|
+
{
|
|
297
|
+
type: "button",
|
|
298
|
+
className: "palette-close",
|
|
299
|
+
title: "关闭,快捷键 Esc",
|
|
300
|
+
"aria-label": "关闭键位表",
|
|
301
|
+
onClick: onClose,
|
|
302
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconClose, { size: 15 })
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shortcut-list", ref: list, children: SHORTCUTS.map((row) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shortcut-row", children: [
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "shortcut-label", children: [
|
|
308
|
+
row.label,
|
|
309
|
+
row.note === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shortcut-note", children: row.note })
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "shortcut-keys", children: row.keys })
|
|
312
|
+
] }, row.keys)) }),
|
|
313
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shortcut-foot", children: "按 ? 随时打开这张表" })
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
function wheelToList(event, node) {
|
|
321
|
+
if (node === null) return;
|
|
322
|
+
if (event.target instanceof Node && node.contains(event.target)) return;
|
|
323
|
+
if (node.scrollHeight <= node.clientHeight) return;
|
|
324
|
+
node.scrollTop += event.deltaY;
|
|
325
|
+
}
|
|
326
|
+
function ItemRow({
|
|
327
|
+
item,
|
|
328
|
+
active,
|
|
329
|
+
header,
|
|
330
|
+
onHover,
|
|
331
|
+
onPick
|
|
332
|
+
}) {
|
|
333
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
334
|
+
header === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "palette-group", children: header }),
|
|
335
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
336
|
+
"button",
|
|
337
|
+
{
|
|
338
|
+
type: "button",
|
|
339
|
+
role: "option",
|
|
340
|
+
"aria-selected": active,
|
|
341
|
+
className: "palette-row",
|
|
342
|
+
"data-active": active ? "1" : void 0,
|
|
343
|
+
onMouseEnter: onHover,
|
|
344
|
+
onClick: onPick,
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "palette-label", children: item.label }),
|
|
347
|
+
item.hint === "" ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "palette-hint", children: item.hint }),
|
|
348
|
+
item.shortcut === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "palette-key", children: item.shortcut })
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
] });
|
|
353
|
+
}
|
|
354
|
+
function matches(item, needle) {
|
|
355
|
+
if (item.label.toLowerCase().includes(needle)) return true;
|
|
356
|
+
if (item.hint.toLowerCase().includes(needle)) return true;
|
|
357
|
+
return item.keywords.some((word) => word.toLowerCase().includes(needle));
|
|
358
|
+
}
|
|
359
|
+
exports.default = ui;
|
|
360
|
+
};
|