@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
|
@@ -7,6 +7,12 @@ const ui$1 = require("@dsc/ui");
|
|
|
7
7
|
const uiPrimitives = require("@dsc/ui-primitives");
|
|
8
8
|
const PAGE = "plugins";
|
|
9
9
|
const KERNEL_PREVIEW = 3;
|
|
10
|
+
function isPackageRow(row) {
|
|
11
|
+
return row.origin === "package";
|
|
12
|
+
}
|
|
13
|
+
function keyOf(row) {
|
|
14
|
+
return row.key ?? `${row.name}/ui/client.js`;
|
|
15
|
+
}
|
|
10
16
|
const ui = ui$1.defineUiPlugin({
|
|
11
17
|
name: "插件中心",
|
|
12
18
|
apply(ui2) {
|
|
@@ -34,7 +40,7 @@ function PluginsView() {
|
|
|
34
40
|
setRows(Array.isArray(list) ? list : []);
|
|
35
41
|
setNote("");
|
|
36
42
|
}).catch((error) => {
|
|
37
|
-
setNote(`读插件失败:${
|
|
43
|
+
setNote(`读插件失败:${uiPrimitives.humanErrorText(error).text}`);
|
|
38
44
|
});
|
|
39
45
|
};
|
|
40
46
|
react.useEffect(() => {
|
|
@@ -46,7 +52,7 @@ function PluginsView() {
|
|
|
46
52
|
setTrusts(Array.isArray(list) ? list : []);
|
|
47
53
|
setTrustNote("");
|
|
48
54
|
}).catch((error) => {
|
|
49
|
-
setTrustNote(`读第三方界面插件状态失败:${
|
|
55
|
+
setTrustNote(`读第三方界面插件状态失败:${uiPrimitives.humanErrorText(error).text}`);
|
|
50
56
|
});
|
|
51
57
|
};
|
|
52
58
|
const confirmTrust = (row) => {
|
|
@@ -57,26 +63,26 @@ function PluginsView() {
|
|
|
57
63
|
setTrustBusy(true);
|
|
58
64
|
void native.invoke("setUiTrust", [row.name]).then((result) => {
|
|
59
65
|
if (!result.ok) {
|
|
60
|
-
ui$1.toastErr(`确认失败:${result.error ?? "未知原因"}`);
|
|
66
|
+
ui$1.toastErr(`确认失败:${uiPrimitives.humanErrorLine(result.error ?? "未知原因")}`);
|
|
61
67
|
return;
|
|
62
68
|
}
|
|
63
69
|
ui$1.toastOk(result.notice ?? `已信任「${row.name}」`);
|
|
64
70
|
setTrustOpen(null);
|
|
65
71
|
loadTrusts();
|
|
66
72
|
}).catch((error) => {
|
|
67
|
-
ui$1.toastErr(`确认失败:${
|
|
73
|
+
ui$1.toastErr(`确认失败:${uiPrimitives.humanErrorLine(error)}`);
|
|
68
74
|
}).finally(() => {
|
|
69
75
|
setTrustBusy(false);
|
|
70
76
|
});
|
|
71
77
|
};
|
|
72
78
|
const toggleTrust = (row, next) => {
|
|
73
79
|
setTrusts((current) => current.map((item) => item.name === row.name ? { ...item, enabled: next } : item));
|
|
74
|
-
void channel.invoke("setPluginEnabled", [
|
|
75
|
-
ui$1.toastOk(`已${next ? "启用" : "停用"}
|
|
80
|
+
void channel.invoke("setPluginEnabled", [keyOf(row), next]).then(() => {
|
|
81
|
+
ui$1.toastOk(`已${next ? "启用" : "停用"}界面插件「${row.name}」,刷新页面(或重启宿主)后生效`);
|
|
76
82
|
setTimeout(loadTrusts, 600);
|
|
77
83
|
}).catch((error) => {
|
|
78
84
|
setTrusts((current) => current.map((item) => item.name === row.name ? { ...item, enabled: !next } : item));
|
|
79
|
-
ui$1.toastErr(`没改成功:${
|
|
85
|
+
ui$1.toastErr(`没改成功:${uiPrimitives.errText(error)}`);
|
|
80
86
|
});
|
|
81
87
|
};
|
|
82
88
|
const toggle = (row, next) => {
|
|
@@ -95,7 +101,7 @@ function PluginsView() {
|
|
|
95
101
|
return;
|
|
96
102
|
}
|
|
97
103
|
void native.invoke("restartHost").catch((reason) => {
|
|
98
|
-
ui$1.toastErr(`重启失败:${
|
|
104
|
+
ui$1.toastErr(`重启失败:${uiPrimitives.humanErrorLine(reason)}`);
|
|
99
105
|
});
|
|
100
106
|
};
|
|
101
107
|
const installPlugin = () => {
|
|
@@ -108,11 +114,14 @@ function PluginsView() {
|
|
|
108
114
|
ui$1.toastOk(`已安装 ${installed.join("、")},即时生效`);
|
|
109
115
|
setTimeout(refresh, 600);
|
|
110
116
|
}).catch((reason) => {
|
|
111
|
-
ui$1.toastErr(`安装失败:${
|
|
117
|
+
ui$1.toastErr(`安装失败:${uiPrimitives.humanErrorLine(reason)}`);
|
|
112
118
|
});
|
|
113
119
|
};
|
|
114
120
|
const detail = detailFile === null ? null : (rows ?? []).find((row) => row.file === detailFile) ?? null;
|
|
115
121
|
const custom = (rows ?? []).filter((row) => row.source === "external");
|
|
122
|
+
const thirdParty = trusts.filter((row) => !isPackageRow(row));
|
|
123
|
+
const packages = trusts.filter(isPackageRow);
|
|
124
|
+
const packageProfiles = [...new Set(packages.map((row) => row.profile).filter((v) => v !== void 0))];
|
|
116
125
|
const official = (rows ?? []).filter((row) => row.source === "builtin" && row.toggleable);
|
|
117
126
|
const kernel = (rows ?? []).filter((row) => row.source === "builtin" && !row.toggleable);
|
|
118
127
|
const kernelShown = kernelOpen ? kernel : kernel.slice(0, KERNEL_PREVIEW);
|
|
@@ -160,20 +169,23 @@ function PluginsView() {
|
|
|
160
169
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "group-hint", children: "~/.dsc/plugins/*.js" })
|
|
161
170
|
] }),
|
|
162
171
|
custom.map((row) => /* @__PURE__ */ jsxRuntime.jsx(PluginCard, { row, onToggle: toggle, onOpen: setDetailFile }, row.file)),
|
|
163
|
-
custom.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
164
|
-
|
|
165
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
166
|
-
" ",
|
|
167
|
-
|
|
172
|
+
custom.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "empty-card compact", children: [
|
|
173
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "empty-card-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPuzzle, { size: 18 }) }),
|
|
174
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "empty-card-title", children: "还没有外部插件" }),
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "empty-card-desc", children: [
|
|
176
|
+
"点右上角「+ 添加插件」选一个 .js 文件,或把它放进 ",
|
|
177
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "~/.dsc/plugins/" }),
|
|
178
|
+
" 后重启宿主。"
|
|
179
|
+
] })
|
|
168
180
|
] }),
|
|
169
|
-
|
|
181
|
+
thirdParty.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
170
182
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-group-label", children: [
|
|
171
183
|
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPuzzle, { size: 13 }),
|
|
172
184
|
" 第三方界面插件 ",
|
|
173
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "count", children:
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "count", children: thirdParty.length }),
|
|
174
186
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "group-hint", children: "~/.dsc/plugins/<目录名>/ui/client.js(信任一次后才装载)" })
|
|
175
187
|
] }),
|
|
176
|
-
|
|
188
|
+
thirdParty.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
189
|
TrustCard,
|
|
178
190
|
{
|
|
179
191
|
row,
|
|
@@ -192,6 +204,31 @@ function PluginsView() {
|
|
|
192
204
|
row.name
|
|
193
205
|
))
|
|
194
206
|
] }) : null,
|
|
207
|
+
packages.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
208
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-group-label", children: [
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui$1.IconPuzzle, { size: 13 }),
|
|
210
|
+
" 组合包界面 ",
|
|
211
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "count", children: packages.length }),
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "group-hint", children: [
|
|
213
|
+
packageProfiles.length === 0 ? "" : `profile ${packageProfiles.join("、")} · `,
|
|
214
|
+
"profile 里装的包(package.json 的 dsh.client.platform = pneuma);装了就算同意,这里只开关"
|
|
215
|
+
] })
|
|
216
|
+
] }),
|
|
217
|
+
packages.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
218
|
+
TrustCard,
|
|
219
|
+
{
|
|
220
|
+
row,
|
|
221
|
+
open: false,
|
|
222
|
+
busy: false,
|
|
223
|
+
onOpen: () => void 0,
|
|
224
|
+
onConfirm: () => void 0,
|
|
225
|
+
onToggle: (next) => {
|
|
226
|
+
toggleTrust(row, next);
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
row.name
|
|
230
|
+
))
|
|
231
|
+
] }) : null,
|
|
195
232
|
trustNote === "" ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "plugins-empty", children: trustNote }),
|
|
196
233
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-group-label", children: [
|
|
197
234
|
"官方可开关 ",
|
|
@@ -233,9 +270,20 @@ function PluginCard({
|
|
|
233
270
|
row.apiVersion !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", children: [
|
|
234
271
|
"API v",
|
|
235
272
|
String(row.apiVersion)
|
|
273
|
+
] }),
|
|
274
|
+
row.bundle !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", "data-bundle": row.bundle, children: [
|
|
275
|
+
"组合包 ",
|
|
276
|
+
row.bundle
|
|
236
277
|
] })
|
|
237
278
|
] }),
|
|
238
|
-
/* @__PURE__ */ jsxRuntime.
|
|
279
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `plugin-desc${row.problem !== void 0 ? " problem" : ""}`, children: [
|
|
280
|
+
row.problem !== void 0 ? `⚠ ${row.problem}` : row.description === "" ? `${row.file} · 无描述` : row.description,
|
|
281
|
+
row.clientCapabilities !== void 0 && row.clientCapabilities.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-desc", "data-client-capabilities": row.clientCapabilities.join(","), children: [
|
|
282
|
+
"界面能力(dsh 客户端插件):",
|
|
283
|
+
row.clientCapabilities.join("、"),
|
|
284
|
+
" · 只列不加载"
|
|
285
|
+
] }) : null
|
|
286
|
+
] })
|
|
239
287
|
] }),
|
|
240
288
|
configurable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
241
289
|
"button",
|
|
@@ -289,11 +337,34 @@ const TRUST_PROBLEM_TIERS = {
|
|
|
289
337
|
next: "把插件目录改名,不要与内置插件的 id 相同。"
|
|
290
338
|
}
|
|
291
339
|
};
|
|
340
|
+
const PACKAGE_PROBLEM_TIERS = {
|
|
341
|
+
version: {
|
|
342
|
+
label: "版本不满足",
|
|
343
|
+
next: "升级宿主(壳)到满足这个包声明的 @dsc/ui 区间,或把这个包装成支持当前壳的版本。"
|
|
344
|
+
},
|
|
345
|
+
artifact: {
|
|
346
|
+
label: "读不到入口",
|
|
347
|
+
next: '检查这个包的 package.json:exports["./client"] 要指向包内真实存在的文件(装坏了就重装这个包)。'
|
|
348
|
+
},
|
|
349
|
+
manifest: {
|
|
350
|
+
label: "清单缺声明",
|
|
351
|
+
next: '检查这个包的 package.json:dsh.client.platform 要是 "pneuma",dsh.client.api 要写(如 "^2.0.0")。'
|
|
352
|
+
},
|
|
353
|
+
clash: {
|
|
354
|
+
label: "与已有插件撞名",
|
|
355
|
+
next: "这个包名与内置插件(或另一个界面插件)的 id 相同,装不进启动图;换个包名,或先停用撞名的那个。"
|
|
356
|
+
}
|
|
357
|
+
};
|
|
292
358
|
const UNKNOWN_TRUST_PROBLEM = {
|
|
293
359
|
label: "装不上",
|
|
294
360
|
next: "照上面的原因检查 ~/.dsc/plugins/<目录名>/ 里的 plugin.json 与 ui/client.js。"
|
|
295
361
|
};
|
|
296
|
-
|
|
362
|
+
const UNKNOWN_PACKAGE_PROBLEM = {
|
|
363
|
+
label: "装不上",
|
|
364
|
+
next: '照上面的原因检查这个包的 package.json(`dsh.client` 段)与 exports["./client"]。'
|
|
365
|
+
};
|
|
366
|
+
function trustProblemTier(kind, origin) {
|
|
367
|
+
if (origin === "package") return kind === void 0 ? UNKNOWN_PACKAGE_PROBLEM : PACKAGE_PROBLEM_TIERS[kind];
|
|
297
368
|
return kind === void 0 ? UNKNOWN_TRUST_PROBLEM : TRUST_PROBLEM_TIERS[kind];
|
|
298
369
|
}
|
|
299
370
|
function TrustCard({
|
|
@@ -305,9 +376,10 @@ function TrustCard({
|
|
|
305
376
|
onToggle
|
|
306
377
|
}) {
|
|
307
378
|
const hello = ui$1.useHostChannel().getHello();
|
|
379
|
+
const fromPackage = isPackageRow(row);
|
|
308
380
|
const trustedAt = row.trustedAt === void 0 ? "" : `(${new Date(row.trustedAt).toLocaleDateString()})`;
|
|
309
|
-
const tier = row.problem === void 0 ? null : trustProblemTier(row.problemKind);
|
|
310
|
-
const desc = row.problem !== void 0 && tier !== null ? `⚠ ${tier.label}:${row.problem}` : row.trusted ? "已确认信任,可以启停(停用或启用都在刷新页面后生效)" : "未信任:还没有信任记录——首次安装需要在插件中心确认一次(它将能调用宿主的界面方法)";
|
|
381
|
+
const tier = row.problem === void 0 ? null : trustProblemTier(row.problemKind, row.origin);
|
|
382
|
+
const desc = row.problem !== void 0 && tier !== null ? `⚠ ${tier.label}:${row.problem}` : row.trusted ? fromPackage ? "组合包自带界面半,装进 profile 就算同意——这里只开关,刷新页面后生效" : "已确认信任,可以启停(停用或启用都在刷新页面后生效)" : "未信任:还没有信任记录——首次安装需要在插件中心确认一次(它将能调用宿主的界面方法)";
|
|
311
383
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "trust-card", "data-trust": row.name, children: [
|
|
312
384
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `plugin-row${row.enabled ? "" : " off"}`, children: [
|
|
313
385
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "plugin-icon", style: { background: iconColor(row.name) }, children: row.name.slice(0, 1).toUpperCase() }),
|
|
@@ -319,10 +391,19 @@ function TrustCard({
|
|
|
319
391
|
row.api
|
|
320
392
|
] }) : null,
|
|
321
393
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "plugin-apiver", children: row.platforms.join("/") }),
|
|
394
|
+
row.version !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", "data-version": row.version, children: [
|
|
395
|
+
"v",
|
|
396
|
+
row.version
|
|
397
|
+
] }) : null,
|
|
398
|
+
row.profile !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", "data-profile": row.profile, children: [
|
|
399
|
+
"profile ",
|
|
400
|
+
row.profile
|
|
401
|
+
] }) : null,
|
|
322
402
|
row.trusted ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "plugin-apiver", children: [
|
|
323
403
|
"已信任",
|
|
324
404
|
trustedAt
|
|
325
|
-
] }) : null
|
|
405
|
+
] }) : null,
|
|
406
|
+
row.trusted && !row.enabled ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "plugin-apiver", children: "已停用" }) : null
|
|
326
407
|
] }),
|
|
327
408
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `plugin-desc${row.problem !== void 0 ? " problem" : ""}`, children: desc }),
|
|
328
409
|
tier !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "trust-next", children: [
|
|
@@ -330,7 +411,7 @@ function TrustCard({
|
|
|
330
411
|
tier.next
|
|
331
412
|
] }) : null
|
|
332
413
|
] }),
|
|
333
|
-
row.problem === void 0 && !row.trusted ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "btn-primary", onClick: onOpen, children: open ? "收起" : "查看并信任" }) : null,
|
|
414
|
+
!fromPackage && row.problem === void 0 && !row.trusted ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "btn-primary", onClick: onOpen, children: open ? "收起" : "查看并信任" }) : null,
|
|
334
415
|
row.trusted ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
335
416
|
"button",
|
|
336
417
|
{
|
|
@@ -429,7 +510,10 @@ function PluginDetail({
|
|
|
429
510
|
] }),
|
|
430
511
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "plugin-detail-config", children: [
|
|
431
512
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-group-title", children: "配置" }),
|
|
432
|
-
section === void 0 ? /* @__PURE__ */ jsxRuntime.
|
|
513
|
+
section === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "settings-loading", role: "status", "aria-label": "正在读取插件配置", children: [
|
|
514
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiPrimitives.SkeletonText, { lines: 3 }),
|
|
515
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiPrimitives.Skeleton, { width: 132, height: 30, radius: 8 })
|
|
516
|
+
] }) : section === null ? plugin.enabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "该插件没有可配置项。" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "settings-empty", children: "插件已停用,启用后才能配置。" }) : /* @__PURE__ */ jsxRuntime.jsx(ConfigFields, { section, onAction: loadSection })
|
|
433
517
|
] })
|
|
434
518
|
] });
|
|
435
519
|
}
|
|
@@ -445,7 +529,7 @@ function ConfigFields({ section, onAction }) {
|
|
|
445
529
|
void channel.invoke("getSectionValues", [section.id]).then((next) => {
|
|
446
530
|
if (alive) setValues(next);
|
|
447
531
|
}).catch((error) => {
|
|
448
|
-
if (alive) setNote({ tone: "error", text: `读取设置失败:${
|
|
532
|
+
if (alive) setNote({ tone: "error", text: `读取设置失败:${uiPrimitives.humanErrorText(error).text}` });
|
|
449
533
|
});
|
|
450
534
|
return () => {
|
|
451
535
|
alive = false;
|
|
@@ -458,27 +542,27 @@ function ConfigFields({ section, onAction }) {
|
|
|
458
542
|
setNote(null);
|
|
459
543
|
void channel.invoke("setSettingValue", [section.id, key, value]).then((result) => {
|
|
460
544
|
if (!result.ok) {
|
|
461
|
-
setNote({ tone: "error", text: `保存失败:${result.error}` });
|
|
545
|
+
setNote({ tone: "error", text: `保存失败:${uiPrimitives.humanErrorText(result.error).text}` });
|
|
462
546
|
return;
|
|
463
547
|
}
|
|
464
548
|
if (result.notice !== void 0) setNote({ tone: "ok", text: result.notice });
|
|
465
549
|
reload();
|
|
466
550
|
}).catch((error) => {
|
|
467
|
-
setNote({ tone: "error", text: `保存失败:${
|
|
551
|
+
setNote({ tone: "error", text: `保存失败:${uiPrimitives.humanErrorText(error).text}` });
|
|
468
552
|
});
|
|
469
553
|
};
|
|
470
554
|
const act = (action) => {
|
|
471
555
|
setNote(null);
|
|
472
556
|
void channel.invoke("runSettingAction", [section.id, action]).then((result) => {
|
|
473
557
|
if (!result.ok) {
|
|
474
|
-
setNote({ tone: "error", text: `操作失败:${result.error}` });
|
|
558
|
+
setNote({ tone: "error", text: `操作失败:${uiPrimitives.humanErrorText(result.error).text}` });
|
|
475
559
|
return;
|
|
476
560
|
}
|
|
477
561
|
if (result.notice !== void 0) setNote({ tone: "ok", text: result.notice });
|
|
478
562
|
reload();
|
|
479
563
|
onAction();
|
|
480
564
|
}).catch((error) => {
|
|
481
|
-
setNote({ tone: "error", text: `操作失败:${
|
|
565
|
+
setNote({ tone: "error", text: `操作失败:${uiPrimitives.humanErrorText(error).text}` });
|
|
482
566
|
});
|
|
483
567
|
};
|
|
484
568
|
const render = (field, index) => {
|
|
@@ -524,7 +608,7 @@ function ConfigFields({ section, onAction }) {
|
|
|
524
608
|
void native.invoke("openPath", [field.text]).then((problem) => {
|
|
525
609
|
if (problem !== "") setNote({ tone: "error", text: `打开失败:${problem}` });
|
|
526
610
|
}).catch((error) => {
|
|
527
|
-
setNote({ tone: "error", text: `打开失败:${
|
|
611
|
+
setNote({ tone: "error", text: `打开失败:${uiPrimitives.errText(error)}` });
|
|
528
612
|
});
|
|
529
613
|
},
|
|
530
614
|
children: "打开"
|
|
@@ -669,14 +753,8 @@ function ConfigFields({ section, onAction }) {
|
|
|
669
753
|
note === null ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `settings-note${note.tone === "error" ? " error" : ""}`, children: note.text })
|
|
670
754
|
] });
|
|
671
755
|
}
|
|
672
|
-
function iconColor(
|
|
673
|
-
|
|
674
|
-
let hash = 0;
|
|
675
|
-
for (const ch of name) hash = (hash * 31 + (ch.codePointAt(0) ?? 0)) % 997;
|
|
676
|
-
return palette[hash % palette.length] ?? palette[0];
|
|
677
|
-
}
|
|
678
|
-
function text(error) {
|
|
679
|
-
return error instanceof Error ? error.message : String(error);
|
|
756
|
+
function iconColor(_name) {
|
|
757
|
+
return "var(--dsc-fill-tertiary)";
|
|
680
758
|
}
|
|
681
759
|
exports.default = ui;
|
|
682
760
|
};
|
|
@@ -4,6 +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 uiPrimitives = require("@dsc/ui-primitives");
|
|
7
8
|
const ui = ui$1.defineUiPlugin({
|
|
8
9
|
name: "文件预览",
|
|
9
10
|
apply() {
|
|
@@ -12,7 +13,7 @@ const ui = ui$1.defineUiPlugin({
|
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
15
|
function PreviewTab({ tab }) {
|
|
15
|
-
const cwd = ui$1.useHostSelector(readCwd);
|
|
16
|
+
const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
|
|
16
17
|
const path = tab.path ?? "";
|
|
17
18
|
if (path === "") {
|
|
18
19
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "file-preview-empty", children: "这张预览页签没有文件路径(关掉它,从文件树重新点一个)。" });
|
|
@@ -69,7 +70,7 @@ function PreviewBody({ path, cwd }) {
|
|
|
69
70
|
] });
|
|
70
71
|
}
|
|
71
72
|
function PatchTab({ tab }) {
|
|
72
|
-
const cwd = ui$1.useHostSelector(readCwd);
|
|
73
|
+
const cwd = ui$1.useHostSelector(uiPrimitives.readCwd);
|
|
73
74
|
const path = tab.path ?? "";
|
|
74
75
|
const source = ui$1.useDockPatchSource(path);
|
|
75
76
|
if (path === "") {
|
|
@@ -131,7 +132,7 @@ function renderBody(read, fsRead) {
|
|
|
131
132
|
if (read.tooLarge) {
|
|
132
133
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-preview-empty", children: [
|
|
133
134
|
"文件过大(",
|
|
134
|
-
|
|
135
|
+
uiPrimitives.formatBytes(read.size ?? 0),
|
|
135
136
|
"),仅支持预览 10MB 以内的文件。"
|
|
136
137
|
] });
|
|
137
138
|
}
|
|
@@ -141,7 +142,7 @@ function renderBody(read, fsRead) {
|
|
|
141
142
|
if (read.kind === "binary") {
|
|
142
143
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "file-preview-empty", children: [
|
|
143
144
|
"二进制文件(",
|
|
144
|
-
|
|
145
|
+
uiPrimitives.formatBytes(read.size ?? 0),
|
|
145
146
|
"),暂不支持预览。"
|
|
146
147
|
] });
|
|
147
148
|
}
|
|
@@ -154,7 +155,7 @@ function renderBody(read, fsRead) {
|
|
|
154
155
|
"这类文件(",
|
|
155
156
|
read.mime ?? "未知类型",
|
|
156
157
|
",",
|
|
157
|
-
|
|
158
|
+
uiPrimitives.formatBytes(read.size ?? 0),
|
|
158
159
|
")要看内容请用「系统打开」。"
|
|
159
160
|
] });
|
|
160
161
|
}
|
|
@@ -182,16 +183,5 @@ function shortPath(path, cwd) {
|
|
|
182
183
|
const base = `${cwd.replace(/\\/g, "/").replace(/\/+$/, "")}/`;
|
|
183
184
|
return posix.toLowerCase().startsWith(base.toLowerCase()) ? posix.slice(base.length) : posix;
|
|
184
185
|
}
|
|
185
|
-
function formatSize(size) {
|
|
186
|
-
if (size < 1024) return `${String(size)}B`;
|
|
187
|
-
if (size < 1024 * 1024) return `${String(Math.max(1, Math.round(size / 1024)))}KB`;
|
|
188
|
-
return `${(size / 1024 / 1024).toFixed(1)}MB`;
|
|
189
|
-
}
|
|
190
|
-
function readCwd(snapshot) {
|
|
191
|
-
const status = snapshot?.["status"];
|
|
192
|
-
if (typeof status !== "object" || status === null) return null;
|
|
193
|
-
const value = status["cwd"];
|
|
194
|
-
return typeof value === "string" && value !== "" ? value : null;
|
|
195
|
-
}
|
|
196
186
|
exports.default = ui;
|
|
197
187
|
};
|
|
@@ -149,6 +149,10 @@ function readOwnerLabel(snapshot) {
|
|
|
149
149
|
if (!Array.isArray(sessions)) return "后台会话";
|
|
150
150
|
return sessions.find((item) => item.id === request.sessionPath)?.title ?? "后台会话";
|
|
151
151
|
}
|
|
152
|
+
const GENERIC_REASONS = /* @__PURE__ */ new Set(["需要授权", "工作区内的改动需要确认"]);
|
|
153
|
+
function isGenericReason(reason) {
|
|
154
|
+
return GENERIC_REASONS.has(reason);
|
|
155
|
+
}
|
|
152
156
|
const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
|
|
153
157
|
const channel = ui$1.useHostChannel();
|
|
154
158
|
const scopes = request.scopes.length > 0 ? request.scopes : ["once"];
|
|
@@ -203,13 +207,13 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
|
|
|
203
207
|
title: request.suggestedRule === null ? "这类动作不给持久化" : `往规则文件写一条:${request.suggestedRule.join(" ")}… 以后照它自动放行`
|
|
204
208
|
}
|
|
205
209
|
];
|
|
206
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `approval risk-${risk.tone}`, children: [
|
|
210
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `approval risk-${risk.tone}`, title: modeLine, children: [
|
|
207
211
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "approval-head", children: [
|
|
208
212
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "tool-name", children: request.toolName }),
|
|
209
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `risk-badge tone-${risk.tone}`, children: risk.label })
|
|
210
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "approval-mode", children: modeLine })
|
|
213
|
+
request.risk === "low" ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: `risk-badge tone-${risk.tone}`, children: risk.label })
|
|
211
214
|
] }),
|
|
212
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-
|
|
215
|
+
request.meaning === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-meaning", children: request.meaning }),
|
|
216
|
+
request.diff === void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-args", title: request.argsSummary, children: request.argsSummary }) : null,
|
|
213
217
|
request.escalation === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "approval-escalation", "data-approval-escalation": "", children: [
|
|
214
218
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-escalation-line", children: `模型请求放宽沙箱:${request.escalation.effect}${request.escalation.scope === "session" ? "(它想要本会话一直放宽)" : ""}` }),
|
|
215
219
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-escalation-why", children: `理由:${request.escalation.justification}` })
|
|
@@ -245,7 +249,7 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
|
|
|
245
249
|
request.diff.fellBack === true ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-diff-note", children: "读不到文件当前内容,以下按参数推算" }) : null,
|
|
246
250
|
diffOpen ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-diff-body", children: request.diff.hunks.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "tc-intended-note", children: "不会有实际改动。" }) : /* @__PURE__ */ jsxRuntime.jsx(DiffRows, { hunks: request.diff.hunks }) }) : null
|
|
247
251
|
] }),
|
|
248
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-reason", children: request.reason }),
|
|
252
|
+
isGenericReason(request.reason) ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-reason", children: request.reason }),
|
|
249
253
|
request.hardline ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "approval-hardline", children: "这一步被安全策略判为不可放行,只能拒绝。" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "approval-actions", children: [
|
|
250
254
|
keys.filter((entry) => scopes.includes(entry.scope)).map((entry) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
251
255
|
"button",
|
|
@@ -269,7 +273,7 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
|
|
|
269
273
|
{
|
|
270
274
|
type: "button",
|
|
271
275
|
className: "btn danger",
|
|
272
|
-
title: "
|
|
276
|
+
title: "不执行这一步,并把拒绝原因回给模型;5 分钟没人答也按拒绝处理",
|
|
273
277
|
disabled: busy,
|
|
274
278
|
onClick: () => {
|
|
275
279
|
answer("reject");
|
|
@@ -279,8 +283,7 @@ const ApprovalCard = react.memo(function ApprovalCard2({ request }) {
|
|
|
279
283
|
/* @__PURE__ */ jsxRuntime.jsx("kbd", { children: "n" })
|
|
280
284
|
]
|
|
281
285
|
}
|
|
282
|
-
)
|
|
283
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "hint", children: "5 分钟没人答按拒绝处理" })
|
|
286
|
+
)
|
|
284
287
|
] }),
|
|
285
288
|
fault === null ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shell-composer-fault", children: [
|
|
286
289
|
"没交上去:",
|
|
@@ -463,6 +466,7 @@ function AskComposer({ items }) {
|
|
|
463
466
|
const [busy, setBusy] = react.useState(false);
|
|
464
467
|
const [fault, setFault] = react.useState(null);
|
|
465
468
|
const sent = react.useRef(0);
|
|
469
|
+
const [open, setOpen] = react.useState(true);
|
|
466
470
|
const index = Math.min(focus, items.length - 1);
|
|
467
471
|
const item = items[index];
|
|
468
472
|
const draft = drafts[item.key] ?? EMPTY_DRAFT;
|
|
@@ -537,51 +541,81 @@ function AskComposer({ items }) {
|
|
|
537
541
|
event.preventDefault();
|
|
538
542
|
if (answered(draft)) continueFlow();
|
|
539
543
|
};
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
544
|
+
const bodyId = "ask-body-" + String(index);
|
|
545
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-card", "data-ask-count": items.length, "data-open": open ? "true" : "false", children: [
|
|
546
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-head", children: [
|
|
547
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-head-text", children: [
|
|
543
548
|
item.header === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-header", children: item.header }),
|
|
544
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-
|
|
549
|
+
open ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-head-title", children: item.question })
|
|
545
550
|
] }),
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
549
|
-
"button",
|
|
550
|
-
{
|
|
551
|
-
type: "button",
|
|
552
|
-
className: `ask-option${picked ? " picked" : ""}`,
|
|
553
|
-
role: item.multiSelect ? "checkbox" : "radio",
|
|
554
|
-
"aria-checked": picked,
|
|
555
|
-
title: option.description ?? "",
|
|
556
|
-
disabled: busy,
|
|
557
|
-
onClick: () => {
|
|
558
|
-
choose(option.label);
|
|
559
|
-
},
|
|
560
|
-
children: [
|
|
561
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-label", children: option.label }),
|
|
562
|
-
option.description === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-desc", children: option.description })
|
|
563
|
-
]
|
|
564
|
-
},
|
|
565
|
-
option.label
|
|
566
|
-
);
|
|
567
|
-
}) }) : null,
|
|
568
|
-
item.freeText ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-free", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
569
|
-
"input",
|
|
551
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
552
|
+
"button",
|
|
570
553
|
{
|
|
571
|
-
|
|
572
|
-
"
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
value: draft.free,
|
|
554
|
+
type: "button",
|
|
555
|
+
className: "ask-fold",
|
|
556
|
+
"aria-expanded": open,
|
|
557
|
+
"aria-controls": bodyId,
|
|
576
558
|
disabled: busy,
|
|
577
|
-
|
|
578
|
-
|
|
559
|
+
title: open ? "收起提问卡" : "展开提问卡",
|
|
560
|
+
onClick: () => {
|
|
561
|
+
setOpen(!open);
|
|
579
562
|
},
|
|
580
|
-
|
|
563
|
+
children: open ? /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconChevronDown, { size: 14 }) : /* @__PURE__ */ jsxRuntime.jsx(ui$1.IconChevronRight, { size: 14 })
|
|
581
564
|
}
|
|
582
|
-
)
|
|
583
|
-
] }
|
|
584
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
565
|
+
)
|
|
566
|
+
] }),
|
|
567
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
568
|
+
"div",
|
|
569
|
+
{
|
|
570
|
+
className: "ask-panel",
|
|
571
|
+
id: bodyId,
|
|
572
|
+
"data-ask-index": index,
|
|
573
|
+
"data-ask-key": item.key,
|
|
574
|
+
hidden: !open,
|
|
575
|
+
children: [
|
|
576
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-question", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-text", children: item.question }) }),
|
|
577
|
+
item.options.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-options", role: item.multiSelect ? "group" : "radiogroup", children: item.options.map((option) => {
|
|
578
|
+
const picked = draft.picked.includes(option.label);
|
|
579
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
580
|
+
"button",
|
|
581
|
+
{
|
|
582
|
+
type: "button",
|
|
583
|
+
className: `ask-option${picked ? " picked" : ""}`,
|
|
584
|
+
role: item.multiSelect ? "checkbox" : "radio",
|
|
585
|
+
"aria-checked": picked,
|
|
586
|
+
title: option.description ?? "",
|
|
587
|
+
disabled: busy,
|
|
588
|
+
onClick: () => {
|
|
589
|
+
choose(option.label);
|
|
590
|
+
},
|
|
591
|
+
children: [
|
|
592
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-label", children: option.label }),
|
|
593
|
+
option.description === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ask-option-desc", children: option.description })
|
|
594
|
+
]
|
|
595
|
+
},
|
|
596
|
+
option.label
|
|
597
|
+
);
|
|
598
|
+
}) }) : null,
|
|
599
|
+
item.freeText ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ask-free", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
600
|
+
"input",
|
|
601
|
+
{
|
|
602
|
+
className: "ask-input",
|
|
603
|
+
"data-ask-input": index,
|
|
604
|
+
autoFocus: item.options.length === 0,
|
|
605
|
+
placeholder: item.multiSelect ? "可以多选,或在这里直接写答案" : "也可以直接写答案",
|
|
606
|
+
value: draft.free,
|
|
607
|
+
disabled: busy,
|
|
608
|
+
onChange: (event) => {
|
|
609
|
+
writeFree(event.target.value);
|
|
610
|
+
},
|
|
611
|
+
onKeyDown: onFreeKeyDown
|
|
612
|
+
}
|
|
613
|
+
) }) : null
|
|
614
|
+
]
|
|
615
|
+
},
|
|
616
|
+
item.key
|
|
617
|
+
),
|
|
618
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-foot", hidden: !open, children: [
|
|
585
619
|
items.length > 1 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ask-pager", children: [
|
|
586
620
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
587
621
|
"button",
|