@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
|
@@ -130,7 +130,6 @@ function nestByPath(dirs) {
|
|
|
130
130
|
for (const node of nodes.values()) if (!out.includes(node)) out.push(node);
|
|
131
131
|
return out;
|
|
132
132
|
}
|
|
133
|
-
const NO_SESSIONS = Object.freeze([]);
|
|
134
133
|
const PREVIEW_COUNT = 5;
|
|
135
134
|
const ARCHIVE_DETAIL_ONE = "会话会离开侧边栏,移进「设置 → 归档」的归档区;消息一个字不删,想回来去归档里点「恢复会话」。";
|
|
136
135
|
const ui = ui$1.defineUiPlugin({
|
|
@@ -171,11 +170,13 @@ const DEFAULT_PREFS = {
|
|
|
171
170
|
};
|
|
172
171
|
function SessionList() {
|
|
173
172
|
const channel = ui$1.useHostChannel();
|
|
174
|
-
const sessions = ui$1.useHostSelector(readSessions);
|
|
173
|
+
const sessions = ui$1.useHostSelector(uiPrimitives.readSessions);
|
|
175
174
|
const states = ui$1.useHostSelector(readStates);
|
|
176
175
|
const currentPath = ui$1.useHostSelector(readCurrentPath);
|
|
176
|
+
const [pendingOpen, setPendingOpen] = react.useState(null);
|
|
177
|
+
const shownPath = pendingOpen ?? currentPath;
|
|
177
178
|
const loading = ui$1.useHostSelector(readLoading);
|
|
178
|
-
const cwd = ui$1.useHostSelector(readCwd);
|
|
179
|
+
const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
|
|
179
180
|
const page = ui$1.useShellPage();
|
|
180
181
|
const [fault, setFault] = react.useState(null);
|
|
181
182
|
const [forking, setForking] = react.useState(null);
|
|
@@ -254,6 +255,10 @@ function SessionList() {
|
|
|
254
255
|
};
|
|
255
256
|
const open = (id) => {
|
|
256
257
|
ui$1.setShellPage(null);
|
|
258
|
+
setPendingOpen(id ?? null);
|
|
259
|
+
if (id === void 0 && cwd !== null && cwd !== "" && prefs.expansion[cwd] === false) {
|
|
260
|
+
patchPrefs({ expansion: { ...prefs.expansion, [cwd]: true } });
|
|
261
|
+
}
|
|
257
262
|
void (async () => {
|
|
258
263
|
await run("openSession", id === void 0 ? [] : [id]);
|
|
259
264
|
await run("refreshSessions", []);
|
|
@@ -272,6 +277,7 @@ function SessionList() {
|
|
|
272
277
|
setFault(null);
|
|
273
278
|
try {
|
|
274
279
|
await channel.invoke("newSessionIn", [target]);
|
|
280
|
+
setRecentCwds((list) => list.includes(target) ? list : [target, ...list]);
|
|
275
281
|
void ui$1.getHostNative().invoke("rememberCwd", [target]).catch(() => void 0);
|
|
276
282
|
await run("refreshSessions", []);
|
|
277
283
|
} catch (reason) {
|
|
@@ -284,7 +290,8 @@ function SessionList() {
|
|
|
284
290
|
};
|
|
285
291
|
const deleteWorkspace = (target, sessionsOfGroup) => {
|
|
286
292
|
void (async () => {
|
|
287
|
-
const
|
|
293
|
+
const real = sessionsOfGroup.filter((session) => session.unsaved !== true);
|
|
294
|
+
const count = real.length;
|
|
288
295
|
const detail = count > 0 ? `其下 ${String(count)} 个会话会全部归档(移进「设置 → 归档」,消息一个字不删,可恢复),工作区从侧边栏移除。` : "该工作区还没有会话,将从侧边栏移除。";
|
|
289
296
|
const current = target === (cwd ?? "") ? "它仍是当前目录,新建会话后会重新出现在侧边栏。" : "";
|
|
290
297
|
const ok = await ui$1.confirmAction({
|
|
@@ -303,7 +310,7 @@ function SessionList() {
|
|
|
303
310
|
return;
|
|
304
311
|
}
|
|
305
312
|
try {
|
|
306
|
-
await channel.invoke("archiveSessions", [
|
|
313
|
+
await channel.invoke("archiveSessions", [real.map((session) => session.id)]);
|
|
307
314
|
await run("refreshSessions", []);
|
|
308
315
|
ui$1.toastOk(`工作区已删除,${String(count)} 个会话已归档`);
|
|
309
316
|
} catch {
|
|
@@ -324,6 +331,22 @@ function SessionList() {
|
|
|
324
331
|
window.addEventListener("shell.session.new", onNew);
|
|
325
332
|
return () => window.removeEventListener("shell.session.new", onNew);
|
|
326
333
|
}, []);
|
|
334
|
+
const actions = ui$1.useService(ui$1.ACTIONS_SERVICE);
|
|
335
|
+
react.useEffect(() => {
|
|
336
|
+
if (actions === void 0) return void 0;
|
|
337
|
+
return actions.register("sessions", [
|
|
338
|
+
{
|
|
339
|
+
id: "session.new",
|
|
340
|
+
label: "新会话",
|
|
341
|
+
hint: "在当前工作区开一条空会话",
|
|
342
|
+
group: "会话",
|
|
343
|
+
keywords: ["新建", "new", "chat"],
|
|
344
|
+
run: () => {
|
|
345
|
+
newRef.current();
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
]);
|
|
349
|
+
}, [actions]);
|
|
327
350
|
const startFork = (id) => {
|
|
328
351
|
void (async () => {
|
|
329
352
|
setFault(null);
|
|
@@ -410,12 +433,25 @@ function SessionList() {
|
|
|
410
433
|
const flatSessions = react.useMemo(() => groups.flatMap((group) => group.sessions), [groups]);
|
|
411
434
|
const parents = react.useMemo(() => new Set(groups.filter((item) => item.hasChildren).map((item) => item.cwd)), [groups]);
|
|
412
435
|
const activeCwd = react.useMemo(() => {
|
|
413
|
-
if (
|
|
414
|
-
const owner = sessions.find((session) => session.id ===
|
|
436
|
+
if (shownPath !== null) {
|
|
437
|
+
const owner = sessions.find((session) => session.id === shownPath);
|
|
415
438
|
if (owner !== void 0) return owner.cwd;
|
|
416
439
|
}
|
|
417
440
|
return cwd;
|
|
418
|
-
}, [sessions,
|
|
441
|
+
}, [sessions, shownPath, cwd]);
|
|
442
|
+
react.useEffect(() => {
|
|
443
|
+
if (pendingOpen === null) return;
|
|
444
|
+
if (currentPath === pendingOpen) {
|
|
445
|
+
setPendingOpen(null);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const timer = setTimeout(() => {
|
|
449
|
+
setPendingOpen(null);
|
|
450
|
+
}, 4e3);
|
|
451
|
+
return () => {
|
|
452
|
+
clearTimeout(timer);
|
|
453
|
+
};
|
|
454
|
+
}, [pendingOpen, currentPath]);
|
|
419
455
|
react.useEffect(() => {
|
|
420
456
|
if (cwd === null || cwd === "") return;
|
|
421
457
|
const chain = [cwd];
|
|
@@ -489,11 +525,21 @@ function SessionList() {
|
|
|
489
525
|
const dragFor = (groupCwd, session) => {
|
|
490
526
|
const compatible = sessDrag !== null && sessDrag.cwd === groupCwd && sessDrag.pinned === (session.pinnedAt !== void 0);
|
|
491
527
|
return {
|
|
492
|
-
|
|
528
|
+
// 临时行(还没落盘)不参与拖拽:拖完要写 sessionOrder,而它在列表里的位置只由
|
|
529
|
+
// 「谁是当前会话」决定,拖了也不会被记住。
|
|
530
|
+
enabled: prefs.sort === "manual" && session.archivedAt === void 0 && session.unsaved !== true,
|
|
493
531
|
mark: sessDrag !== null && sessDrag.over !== null && sessDrag.over.id === session.id ? sessDrag.over.half : null,
|
|
494
532
|
onStart: (event) => {
|
|
495
533
|
event.dataTransfer.effectAllowed = "move";
|
|
496
534
|
event.dataTransfer.setData("text/plain", session.id);
|
|
535
|
+
const ghost = document.createElement("div");
|
|
536
|
+
ghost.className = "dsc-drag-ghost";
|
|
537
|
+
ghost.textContent = session.title ?? "新会话";
|
|
538
|
+
document.body.appendChild(ghost);
|
|
539
|
+
event.dataTransfer.setDragImage(ghost, 12, 16);
|
|
540
|
+
window.setTimeout(() => {
|
|
541
|
+
ghost.remove();
|
|
542
|
+
}, 0);
|
|
497
543
|
setSessDrag({ cwd: groupCwd, id: session.id, pinned: session.pinnedAt !== void 0, over: null });
|
|
498
544
|
},
|
|
499
545
|
onOver: compatible ? (event) => {
|
|
@@ -636,7 +682,7 @@ function SessionList() {
|
|
|
636
682
|
{
|
|
637
683
|
session,
|
|
638
684
|
state: states[session.id],
|
|
639
|
-
current:
|
|
685
|
+
current: shownPath !== null && session.id === shownPath,
|
|
640
686
|
sort: prefs.sort,
|
|
641
687
|
renameRequest: renaming === session.id,
|
|
642
688
|
onOpen: open,
|
|
@@ -704,7 +750,7 @@ function SessionList() {
|
|
|
704
750
|
},
|
|
705
751
|
onDragEnd: endDrag,
|
|
706
752
|
children: [
|
|
707
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "folder-icon", children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(ui$1.
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "folder-icon", children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconFolderOpenColor, { size: 15 }) : /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconFolderColor, { size: 15 }) }),
|
|
708
754
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "folder-chevron", children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconTriangleRightFill, { size: 14, className: expanded ? "arrow-open" : void 0 }) }),
|
|
709
755
|
groupRenaming?.cwd === group.cwd ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
710
756
|
"input",
|
|
@@ -782,7 +828,7 @@ function SessionList() {
|
|
|
782
828
|
{
|
|
783
829
|
session,
|
|
784
830
|
state: states[session.id],
|
|
785
|
-
current:
|
|
831
|
+
current: shownPath !== null && session.id === shownPath,
|
|
786
832
|
sort: prefs.sort,
|
|
787
833
|
renameRequest: renaming === session.id,
|
|
788
834
|
drag: dragFor(group.cwd, session),
|
|
@@ -1007,7 +1053,7 @@ function SessionList() {
|
|
|
1007
1053
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1008
1054
|
MenuItem,
|
|
1009
1055
|
{
|
|
1010
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(ui$1.
|
|
1056
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconFolderOpenColor, { size: 15 }),
|
|
1011
1057
|
text: "在资源管理器中打开",
|
|
1012
1058
|
onClick: () => {
|
|
1013
1059
|
setMenu(null);
|
|
@@ -1017,7 +1063,7 @@ function SessionList() {
|
|
|
1017
1063
|
return;
|
|
1018
1064
|
}
|
|
1019
1065
|
void native.invoke("openPath", [cwdOf]).catch((reason) => {
|
|
1020
|
-
ui$1.toastErr(`打开失败:${
|
|
1066
|
+
ui$1.toastErr(`打开失败:${uiPrimitives.humanErrorLine(reason)}`);
|
|
1021
1067
|
});
|
|
1022
1068
|
}
|
|
1023
1069
|
}
|
|
@@ -1125,35 +1171,18 @@ function MenuItem({
|
|
|
1125
1171
|
hint === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "menu-key", children: hint })
|
|
1126
1172
|
] });
|
|
1127
1173
|
}
|
|
1128
|
-
const FOOTER_USAGE_TIP = "今天所有会话累计用量(输入 +
|
|
1174
|
+
const FOOTER_USAGE_TIP = "今天所有会话累计用量(输入 + 输出)与估算花费,每分钟自动刷新";
|
|
1129
1175
|
function SidebarFooter() {
|
|
1130
|
-
const channel = ui$1.useHostChannel();
|
|
1131
1176
|
const usage = ui$1.useHostSelector(readUsageTokens);
|
|
1132
|
-
const
|
|
1133
|
-
react.useEffect(() => {
|
|
1134
|
-
let active = true;
|
|
1135
|
-
const load = () => {
|
|
1136
|
-
void channel.invoke("usageStats").then((stats) => {
|
|
1137
|
-
if (!active) return;
|
|
1138
|
-
const day = stats.days[stats.days.length - 1];
|
|
1139
|
-
setToday(day === void 0 ? 0 : day.inputTokens + day.outputTokens);
|
|
1140
|
-
}).catch(() => {
|
|
1141
|
-
});
|
|
1142
|
-
};
|
|
1143
|
-
load();
|
|
1144
|
-
const timer = window.setInterval(load, 6e4);
|
|
1145
|
-
return () => {
|
|
1146
|
-
active = false;
|
|
1147
|
-
window.clearInterval(timer);
|
|
1148
|
-
};
|
|
1149
|
-
}, [channel, usage]);
|
|
1177
|
+
const today = ui$1.useTodayUsage(usage);
|
|
1150
1178
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sidebar-footer", children: [
|
|
1151
1179
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "row", "data-tip": FOOTER_USAGE_TIP, title: FOOTER_USAGE_TIP, children: [
|
|
1152
1180
|
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconCoins, { size: 14 }),
|
|
1153
1181
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "今日总用量" }),
|
|
1154
1182
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "num", children: [
|
|
1155
|
-
uiPrimitives.formatTokens(today),
|
|
1156
|
-
" tok"
|
|
1183
|
+
uiPrimitives.formatTokens(today.tokens),
|
|
1184
|
+
" tok",
|
|
1185
|
+
today.cost === null ? null : ` · ${uiPrimitives.formatCostCny(today.cost)}`
|
|
1157
1186
|
] })
|
|
1158
1187
|
] }),
|
|
1159
1188
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1235,9 +1264,20 @@ function SessionRow({
|
|
|
1235
1264
|
const [draft, setDraft] = react.useState(null);
|
|
1236
1265
|
const pinned = session.pinnedAt !== void 0;
|
|
1237
1266
|
const archived = session.archivedAt !== void 0;
|
|
1267
|
+
const unsaved = session.unsaved === true;
|
|
1238
1268
|
const title = session.title ?? "新会话";
|
|
1239
1269
|
const dot = state === void 0 ? void 0 : DOT_CLASS[state];
|
|
1240
1270
|
const dotLabel = state === void 0 ? "" : DOT_LABEL[state];
|
|
1271
|
+
const titleRef = react.useRef(null);
|
|
1272
|
+
const [titleShift, setTitleShift] = react.useState(0);
|
|
1273
|
+
const measureTitle = () => {
|
|
1274
|
+
const box = titleRef.current;
|
|
1275
|
+
if (box === null) return;
|
|
1276
|
+
const text = box.firstElementChild;
|
|
1277
|
+
if (!(text instanceof HTMLElement)) return;
|
|
1278
|
+
setTitleShift(Math.max(0, Math.ceil(text.scrollWidth - box.clientWidth)));
|
|
1279
|
+
};
|
|
1280
|
+
const titleDur = Math.min(6e3, 1400 + titleShift * 22);
|
|
1241
1281
|
const openRow = () => {
|
|
1242
1282
|
if (archived) {
|
|
1243
1283
|
ui$1.toastErr("这个会话已归档:先点行尾的「恢复」再打开");
|
|
@@ -1257,6 +1297,7 @@ function SessionRow({
|
|
|
1257
1297
|
openRow();
|
|
1258
1298
|
return;
|
|
1259
1299
|
}
|
|
1300
|
+
if (unsaved) return;
|
|
1260
1301
|
if (!event.ctrlKey && !event.metaKey) return;
|
|
1261
1302
|
const lower = event.key.toLowerCase();
|
|
1262
1303
|
if (event.ctrlKey && event.altKey && lower === "r") {
|
|
@@ -1285,22 +1326,28 @@ function SessionRow({
|
|
|
1285
1326
|
className: `sess-item${current ? " active" : ""}${archived ? " archived" : ""}${drag?.mark === "before" ? " drop-above" : ""}${drag?.mark === "after" ? " drop-below" : ""}`,
|
|
1286
1327
|
role: "button",
|
|
1287
1328
|
tabIndex: 0,
|
|
1288
|
-
"data-tip": archived ? `${title}(已归档);恢复后才能在对话里打开` : `${title};双击标题改名 · Ctrl+Alt+F 分叉 · Ctrl+Shift+A 归档`,
|
|
1329
|
+
"data-tip": unsaved ? `${title}:还没发过消息,发出第一条后才会存进磁盘` : archived ? `${title}(已归档);恢复后才能在对话里打开` : `${title};双击标题改名 · Ctrl+Alt+F 分叉 · Ctrl+Shift+A 归档`,
|
|
1289
1330
|
draggable: drag?.enabled === true && draft === null,
|
|
1290
1331
|
onDragStart: drag?.enabled === true && draft === null ? drag.onStart : void 0,
|
|
1291
1332
|
onDragOver: drag?.enabled === true && draft === null ? drag.onOver : void 0,
|
|
1292
1333
|
onDrop: drag?.enabled === true && draft === null ? drag.onDrop : void 0,
|
|
1293
1334
|
onDragEnd: drag?.enabled === true && draft === null ? drag.onEnd : void 0,
|
|
1294
1335
|
onClick: openRow,
|
|
1336
|
+
onPointerEnter: measureTitle,
|
|
1337
|
+
onFocus: measureTitle,
|
|
1295
1338
|
onKeyDown: (event) => {
|
|
1296
1339
|
rowKeys(event);
|
|
1297
1340
|
},
|
|
1298
1341
|
onContextMenu: (event) => {
|
|
1299
1342
|
event.preventDefault();
|
|
1343
|
+
if (unsaved) return;
|
|
1300
1344
|
onMenu(event.clientX, event.clientY);
|
|
1301
1345
|
},
|
|
1302
1346
|
children: [
|
|
1303
|
-
dot === void 0 ? (
|
|
1347
|
+
dot === void 0 ? unsaved ? (
|
|
1348
|
+
// 临时行不给图钉:置顶要写 jsonl,文件还没有。占位撑住行首宽度,视觉不塌。
|
|
1349
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-slot" })
|
|
1350
|
+
) : (
|
|
1304
1351
|
// 没有运行状态时才给图钉:旧界面里这一格是「状态点 / 图钉」二选一,
|
|
1305
1352
|
// 两样同时画会把行首撑宽。
|
|
1306
1353
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-slot", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1314,7 +1361,7 @@ function SessionRow({
|
|
|
1314
1361
|
stop(event);
|
|
1315
1362
|
onPin(!pinned);
|
|
1316
1363
|
},
|
|
1317
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPin, { size:
|
|
1364
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPin, { size: 14, filled: pinned })
|
|
1318
1365
|
}
|
|
1319
1366
|
) })
|
|
1320
1367
|
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: `row-slot session-dot ${dot}`, "data-tip": dotLabel, "aria-label": dotLabel, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "dot" }) }),
|
|
@@ -1322,11 +1369,14 @@ function SessionRow({
|
|
|
1322
1369
|
"span",
|
|
1323
1370
|
{
|
|
1324
1371
|
className: "title",
|
|
1372
|
+
ref: titleRef,
|
|
1373
|
+
"data-overflow": titleShift > 0 ? "1" : void 0,
|
|
1374
|
+
style: titleShift > 0 ? { "--title-shift": `${String(-titleShift)}px`, "--title-dur": `${String(titleDur)}ms` } : void 0,
|
|
1325
1375
|
onDoubleClick: (event) => {
|
|
1326
1376
|
event.stopPropagation();
|
|
1327
|
-
if (!archived) setDraft(session.title ?? "");
|
|
1377
|
+
if (!archived && !unsaved) setDraft(session.title ?? "");
|
|
1328
1378
|
},
|
|
1329
|
-
children: title
|
|
1379
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "title-text", children: title })
|
|
1330
1380
|
}
|
|
1331
1381
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1332
1382
|
"input",
|
|
@@ -1357,7 +1407,7 @@ function SessionRow({
|
|
|
1357
1407
|
}
|
|
1358
1408
|
),
|
|
1359
1409
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "when", children: relativeTime(sort === "created" ? session.createdAt : session.archivedAt ?? session.updatedAt) }),
|
|
1360
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-actions", onClick: stop, children: archived ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1410
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "row-actions", onClick: stop, children: unsaved ? null : archived ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1361
1411
|
"button",
|
|
1362
1412
|
{
|
|
1363
1413
|
type: "button",
|
|
@@ -1387,10 +1437,6 @@ function oneLine(text) {
|
|
|
1387
1437
|
const chars = Array.from(flat);
|
|
1388
1438
|
return chars.length > 60 ? `${chars.slice(0, 60).join("")}…` : flat;
|
|
1389
1439
|
}
|
|
1390
|
-
function readSessions(snapshot) {
|
|
1391
|
-
const value = snapshot?.["sessions"];
|
|
1392
|
-
return Array.isArray(value) ? value : NO_SESSIONS;
|
|
1393
|
-
}
|
|
1394
1440
|
function readStates(snapshot) {
|
|
1395
1441
|
const value = snapshot?.["sessionStates"];
|
|
1396
1442
|
return typeof value === "object" && value !== null ? value : {};
|
|
@@ -1404,12 +1450,6 @@ function readCurrentPath(snapshot) {
|
|
|
1404
1450
|
function readLoading(snapshot) {
|
|
1405
1451
|
return snapshot?.["sessionsLoading"] === true;
|
|
1406
1452
|
}
|
|
1407
|
-
function readCwd(snapshot) {
|
|
1408
|
-
const status = snapshot?.["status"];
|
|
1409
|
-
if (typeof status !== "object" || status === null) return null;
|
|
1410
|
-
const value = status["cwd"];
|
|
1411
|
-
return typeof value === "string" && value !== "" ? value : null;
|
|
1412
|
-
}
|
|
1413
1453
|
function readUsageTokens(snapshot) {
|
|
1414
1454
|
const status = snapshot?.["status"];
|
|
1415
1455
|
if (typeof status !== "object" || status === null) return null;
|
|
@@ -1450,9 +1490,26 @@ function AddWorkspaceButton({ onCreated }) {
|
|
|
1450
1490
|
);
|
|
1451
1491
|
}
|
|
1452
1492
|
function WorkspaceOpenGroup() {
|
|
1453
|
-
const cwd = ui$1.useHostSelector(readCwd);
|
|
1493
|
+
const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
|
|
1454
1494
|
const native = ui$1.getHostNative();
|
|
1455
1495
|
const [menuOpen, setMenuOpen] = react.useState(false);
|
|
1496
|
+
const groupRef = react.useRef(null);
|
|
1497
|
+
react.useEffect(() => {
|
|
1498
|
+
if (!menuOpen) return void 0;
|
|
1499
|
+
const onPointerDown = (event) => {
|
|
1500
|
+
if (event.target instanceof Node && groupRef.current?.contains(event.target) === true) return;
|
|
1501
|
+
setMenuOpen(false);
|
|
1502
|
+
};
|
|
1503
|
+
const onKeyDown = (event) => {
|
|
1504
|
+
if (event.key === "Escape") setMenuOpen(false);
|
|
1505
|
+
};
|
|
1506
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
1507
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
1508
|
+
return () => {
|
|
1509
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
1510
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
1511
|
+
};
|
|
1512
|
+
}, [menuOpen]);
|
|
1456
1513
|
const open = (kind) => {
|
|
1457
1514
|
setMenuOpen(false);
|
|
1458
1515
|
if (cwd === null) {
|
|
@@ -1465,10 +1522,10 @@ function WorkspaceOpenGroup() {
|
|
|
1465
1522
|
}
|
|
1466
1523
|
void native.invoke("openWorkspace", [kind, cwd]).then((result) => {
|
|
1467
1524
|
if (result !== null && typeof result === "object" && result.ok === false) {
|
|
1468
|
-
ui$1.toastErr(`打开失败:${result.error ?? "宿主没说什么原因"}`);
|
|
1525
|
+
ui$1.toastErr(`打开失败:${uiPrimitives.humanErrorLine(result.error ?? "宿主没说什么原因")}`);
|
|
1469
1526
|
}
|
|
1470
1527
|
}).catch((reason) => {
|
|
1471
|
-
ui$1.toastErr(`打开失败:${
|
|
1528
|
+
ui$1.toastErr(`打开失败:${uiPrimitives.humanErrorLine(reason)}`);
|
|
1472
1529
|
});
|
|
1473
1530
|
};
|
|
1474
1531
|
const copyPath = () => {
|
|
@@ -1483,7 +1540,7 @@ function WorkspaceOpenGroup() {
|
|
|
1483
1540
|
}
|
|
1484
1541
|
);
|
|
1485
1542
|
};
|
|
1486
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ws-open", children: [
|
|
1543
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ws-open", ref: groupRef, children: [
|
|
1487
1544
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1488
1545
|
"button",
|
|
1489
1546
|
{
|
|
@@ -1494,7 +1551,7 @@ function WorkspaceOpenGroup() {
|
|
|
1494
1551
|
onClick: () => {
|
|
1495
1552
|
open("explorer");
|
|
1496
1553
|
},
|
|
1497
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.
|
|
1554
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconFolderOpenColor, { size: 16 })
|
|
1498
1555
|
}
|
|
1499
1556
|
),
|
|
1500
1557
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1511,64 +1568,53 @@ function WorkspaceOpenGroup() {
|
|
|
1511
1568
|
children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconChevronDown, { size: 13 })
|
|
1512
1569
|
}
|
|
1513
1570
|
),
|
|
1514
|
-
menuOpen ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1515
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1516
|
-
"
|
|
1571
|
+
menuOpen ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "row-menu ws-open-menu", role: "menu", children: [
|
|
1572
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1573
|
+
"button",
|
|
1517
1574
|
{
|
|
1518
|
-
|
|
1575
|
+
type: "button",
|
|
1576
|
+
className: "menu-item",
|
|
1519
1577
|
onClick: () => {
|
|
1520
|
-
|
|
1521
|
-
}
|
|
1578
|
+
open("terminal");
|
|
1579
|
+
},
|
|
1580
|
+
children: [
|
|
1581
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconTerminalColor, { size: 15 }),
|
|
1582
|
+
" 在终端中打开"
|
|
1583
|
+
]
|
|
1522
1584
|
}
|
|
1523
1585
|
),
|
|
1524
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
type: "button",
|
|
1557
|
-
className: "menu-item",
|
|
1558
|
-
onClick: () => {
|
|
1559
|
-
open("vscode");
|
|
1560
|
-
},
|
|
1561
|
-
children: [
|
|
1562
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconCode, { size: 14 }),
|
|
1563
|
-
" 在 VS Code 中打开"
|
|
1564
|
-
]
|
|
1565
|
-
}
|
|
1566
|
-
),
|
|
1567
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "menu-sep" }),
|
|
1568
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "menu-item", onClick: copyPath, children: [
|
|
1569
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconCopy, { size: 14 }),
|
|
1570
|
-
" 复制工作区路径"
|
|
1571
|
-
] })
|
|
1586
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1587
|
+
"button",
|
|
1588
|
+
{
|
|
1589
|
+
type: "button",
|
|
1590
|
+
className: "menu-item",
|
|
1591
|
+
onClick: () => {
|
|
1592
|
+
open("explorer");
|
|
1593
|
+
},
|
|
1594
|
+
children: [
|
|
1595
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconFolderOpenColor, { size: 15 }),
|
|
1596
|
+
" 在文件管理器中打开"
|
|
1597
|
+
]
|
|
1598
|
+
}
|
|
1599
|
+
),
|
|
1600
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1601
|
+
"button",
|
|
1602
|
+
{
|
|
1603
|
+
type: "button",
|
|
1604
|
+
className: "menu-item",
|
|
1605
|
+
onClick: () => {
|
|
1606
|
+
open("vscode");
|
|
1607
|
+
},
|
|
1608
|
+
children: [
|
|
1609
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconVSCodeColor, { size: 15 }),
|
|
1610
|
+
" 在 VS Code 中打开"
|
|
1611
|
+
]
|
|
1612
|
+
}
|
|
1613
|
+
),
|
|
1614
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "menu-sep" }),
|
|
1615
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "menu-item", onClick: copyPath, children: [
|
|
1616
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconCopyColor, { size: 15 }),
|
|
1617
|
+
" 复制工作区路径"
|
|
1572
1618
|
] })
|
|
1573
1619
|
] }) : null
|
|
1574
1620
|
] });
|