@waq666/pneuma 0.0.0-stage → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +144 -2
- package/bin/dsc.js +91 -0
- package/bin/headless.cjs +40 -0
- package/lib/adapter/core-runtime.d.ts +11 -0
- package/lib/adapter/core-runtime.js +259 -0
- package/lib/adapter/host.d.ts +18 -0
- package/lib/adapter/host.js +14 -0
- package/lib/adapter/runtime.d.ts +15 -0
- package/lib/adapter/runtime.js +290 -0
- package/lib/adapter/transcript.d.ts +184 -0
- package/lib/adapter/transcript.js +605 -0
- package/lib/app/AgentsOverlay.d.ts +18 -0
- package/lib/app/AgentsOverlay.js +63 -0
- package/lib/app/App.d.ts +13 -0
- package/lib/app/App.js +1498 -0
- package/lib/app/ApprovalCard.d.ts +12 -0
- package/lib/app/ApprovalCard.js +76 -0
- package/lib/app/AskCard.d.ts +20 -0
- package/lib/app/AskCard.js +45 -0
- package/lib/app/ChatView.d.ts +32 -0
- package/lib/app/ChatView.js +198 -0
- package/lib/app/Composer.d.ts +50 -0
- package/lib/app/Composer.js +282 -0
- package/lib/app/DiffBlock.d.ts +6 -0
- package/lib/app/DiffBlock.js +37 -0
- package/lib/app/MarkdownView.d.ts +6 -0
- package/lib/app/MarkdownView.js +99 -0
- package/lib/app/ModelPicker.d.ts +7 -0
- package/lib/app/ModelPicker.js +18 -0
- package/lib/app/PlanReviewCard.d.ts +13 -0
- package/lib/app/PlanReviewCard.js +54 -0
- package/lib/app/PresetPicker.d.ts +11 -0
- package/lib/app/PresetPicker.js +19 -0
- package/lib/app/PreviewOverlay.d.ts +14 -0
- package/lib/app/PreviewOverlay.js +22 -0
- package/lib/app/SessionPicker.d.ts +43 -0
- package/lib/app/SessionPicker.js +56 -0
- package/lib/app/SettingsOverlay.d.ts +32 -0
- package/lib/app/SettingsOverlay.js +157 -0
- package/lib/app/SkillsPicker.d.ts +7 -0
- package/lib/app/SkillsPicker.js +19 -0
- package/lib/app/StatusBar.d.ts +22 -0
- package/lib/app/StatusBar.js +272 -0
- package/lib/app/TaskStrips.d.ts +13 -0
- package/lib/app/TaskStrips.js +40 -0
- package/lib/app/ToolCard.d.ts +5 -0
- package/lib/app/ToolCard.js +40 -0
- package/lib/app/TranscriptOverlay.d.ts +12 -0
- package/lib/app/TranscriptOverlay.js +17 -0
- package/lib/app/Welcome.d.ts +6 -0
- package/lib/app/Welcome.js +66 -0
- package/lib/app/attach.d.ts +16 -0
- package/lib/app/attach.js +58 -0
- package/lib/app/click.d.ts +27 -0
- package/lib/app/click.js +89 -0
- package/lib/app/clipboard-image.d.ts +11 -0
- package/lib/app/clipboard-image.js +66 -0
- package/lib/app/cursor.d.ts +4 -0
- package/lib/app/cursor.js +24 -0
- package/lib/app/hello.d.ts +11 -0
- package/lib/app/hello.js +8 -0
- package/lib/app/history-store.d.ts +4 -0
- package/lib/app/history-store.js +41 -0
- package/lib/app/image-blocks.d.ts +12 -0
- package/lib/app/image-blocks.js +125 -0
- package/lib/app/markdown.d.ts +54 -0
- package/lib/app/markdown.js +189 -0
- package/lib/app/settings-model.d.ts +69 -0
- package/lib/app/settings-model.js +114 -0
- package/lib/app/theme.d.ts +166 -0
- package/lib/app/theme.js +141 -0
- package/lib/boot.d.ts +1 -0
- package/lib/boot.js +34 -0
- package/lib/commands.d.ts +49 -0
- package/lib/commands.js +115 -0
- package/lib/contract.d.ts +1973 -0
- package/lib/contract.js +36 -0
- package/lib/core/agent-roles.d.ts +52 -0
- package/lib/core/agent-roles.js +274 -0
- package/lib/core/approval-floor.d.ts +183 -0
- package/lib/core/approval-floor.js +679 -0
- package/lib/core/approval.d.ts +42 -0
- package/lib/core/approval.js +8 -0
- package/lib/core/audit.d.ts +61 -0
- package/lib/core/audit.js +59 -0
- package/lib/core/boot-notices.d.ts +6 -0
- package/lib/core/boot-notices.js +61 -0
- package/lib/core/cdp/actions.d.ts +182 -0
- package/lib/core/cdp/actions.js +649 -0
- package/lib/core/cdp/launch.d.ts +192 -0
- package/lib/core/cdp/launch.js +491 -0
- package/lib/core/cdp/snapshot.d.ts +139 -0
- package/lib/core/cdp/snapshot.js +316 -0
- package/lib/core/cdp/transport.d.ts +160 -0
- package/lib/core/cdp/transport.js +359 -0
- package/lib/core/command-policy.d.ts +108 -0
- package/lib/core/command-policy.js +580 -0
- package/lib/core/commands-completion.d.ts +78 -0
- package/lib/core/commands-completion.js +167 -0
- package/lib/core/compact-anchors.d.ts +76 -0
- package/lib/core/compact-anchors.js +284 -0
- package/lib/core/compact.d.ts +110 -0
- package/lib/core/compact.js +210 -0
- package/lib/core/config-store.d.ts +38 -0
- package/lib/core/config-store.js +307 -0
- package/lib/core/config.d.ts +36 -0
- package/lib/core/config.js +124 -0
- package/lib/core/connection-test.d.ts +60 -0
- package/lib/core/connection-test.js +84 -0
- package/lib/core/desktop-control.d.ts +298 -0
- package/lib/core/desktop-control.js +1311 -0
- package/lib/core/diff-text.d.ts +74 -0
- package/lib/core/diff-text.js +257 -0
- package/lib/core/dock-browser.d.ts +137 -0
- package/lib/core/dock-browser.js +146 -0
- package/lib/core/dock-ops.d.ts +59 -0
- package/lib/core/dock-ops.js +104 -0
- package/lib/core/dock-session.d.ts +39 -0
- package/lib/core/dock-session.js +28 -0
- package/lib/core/dsh-compat/hook.d.ts +18 -0
- package/lib/core/dsh-compat/hook.js +52 -0
- package/lib/core/dsh-compat/resolve-hook.d.ts +5 -0
- package/lib/core/dsh-compat/resolve-hook.js +59 -0
- package/lib/core/dsh-compat/tools-facade.d.ts +47 -0
- package/lib/core/dsh-compat/tools-facade.js +108 -0
- package/lib/core/err-text.d.ts +13 -0
- package/lib/core/err-text.js +15 -0
- package/lib/core/events.d.ts +149 -0
- package/lib/core/events.js +1 -0
- package/lib/core/git-exec.d.ts +23 -0
- package/lib/core/git-exec.js +72 -0
- package/lib/core/git-info.d.ts +47 -0
- package/lib/core/git-info.js +157 -0
- package/lib/core/goal.d.ts +89 -0
- package/lib/core/goal.js +189 -0
- package/lib/core/hooks.d.ts +272 -0
- package/lib/core/hooks.js +818 -0
- package/lib/core/host-browser-link.d.ts +59 -0
- package/lib/core/host-browser-link.js +9 -0
- package/lib/core/host-methods.d.ts +25 -0
- package/lib/core/host-methods.js +103 -0
- package/lib/core/image-diet.d.ts +77 -0
- package/lib/core/image-diet.js +127 -0
- package/lib/core/learnings/ledger.d.ts +73 -0
- package/lib/core/learnings/ledger.js +273 -0
- package/lib/core/learnings/skill-write.d.ts +250 -0
- package/lib/core/learnings/skill-write.js +854 -0
- package/lib/core/learnings/store.d.ts +102 -0
- package/lib/core/learnings/store.js +266 -0
- package/lib/core/lifecycle-hooks.d.ts +189 -0
- package/lib/core/lifecycle-hooks.js +576 -0
- package/lib/core/llm.d.ts +272 -0
- package/lib/core/llm.js +548 -0
- package/lib/core/lockfile.d.ts +17 -0
- package/lib/core/lockfile.js +110 -0
- package/lib/core/loop.d.ts +185 -0
- package/lib/core/loop.js +587 -0
- package/lib/core/lsp/client.d.ts +189 -0
- package/lib/core/lsp/client.js +690 -0
- package/lib/core/lsp/framing.d.ts +84 -0
- package/lib/core/lsp/framing.js +181 -0
- package/lib/core/lsp/line-shift.d.ts +28 -0
- package/lib/core/lsp/line-shift.js +127 -0
- package/lib/core/lsp/manager.d.ts +93 -0
- package/lib/core/lsp/manager.js +418 -0
- package/lib/core/lsp/normalize.d.ts +32 -0
- package/lib/core/lsp/normalize.js +139 -0
- package/lib/core/lsp/servers.d.ts +106 -0
- package/lib/core/lsp/servers.js +352 -0
- package/lib/core/lsp/uri.d.ts +76 -0
- package/lib/core/lsp/uri.js +179 -0
- package/lib/core/market.d.ts +51 -0
- package/lib/core/market.js +358 -0
- package/lib/core/mcp.d.ts +201 -0
- package/lib/core/mcp.js +836 -0
- package/lib/core/memory-eval.d.ts +158 -0
- package/lib/core/memory-eval.js +215 -0
- package/lib/core/memory.d.ts +266 -0
- package/lib/core/memory.js +703 -0
- package/lib/core/mention.d.ts +57 -0
- package/lib/core/mention.js +129 -0
- package/lib/core/microcompact.d.ts +48 -0
- package/lib/core/microcompact.js +79 -0
- package/lib/core/migrate.d.ts +56 -0
- package/lib/core/migrate.js +134 -0
- package/lib/core/model-caps.d.ts +83 -0
- package/lib/core/model-caps.js +150 -0
- package/lib/core/model-discovery.d.ts +19 -0
- package/lib/core/model-discovery.js +69 -0
- package/lib/core/modes.d.ts +72 -0
- package/lib/core/modes.js +152 -0
- package/lib/core/native-bridge.d.ts +135 -0
- package/lib/core/native-bridge.js +563 -0
- package/lib/core/path-policy.d.ts +32 -0
- package/lib/core/path-policy.js +248 -0
- package/lib/core/permission-presets.d.ts +67 -0
- package/lib/core/permission-presets.js +75 -0
- package/lib/core/plugin-loader.d.ts +36 -0
- package/lib/core/plugin-loader.js +294 -0
- package/lib/core/plugin-registry.d.ts +113 -0
- package/lib/core/plugin-registry.js +256 -0
- package/lib/core/prefs.d.ts +82 -0
- package/lib/core/prefs.js +372 -0
- package/lib/core/presets.d.ts +80 -0
- package/lib/core/presets.js +373 -0
- package/lib/core/pricing.d.ts +90 -0
- package/lib/core/pricing.js +126 -0
- package/lib/core/prompt.d.ts +92 -0
- package/lib/core/prompt.js +339 -0
- package/lib/core/ptc.d.ts +66 -0
- package/lib/core/ptc.js +70 -0
- package/lib/core/remote/frames.d.ts +91 -0
- package/lib/core/remote/frames.js +174 -0
- package/lib/core/remote/notify.d.ts +54 -0
- package/lib/core/remote/notify.js +77 -0
- package/lib/core/remote/owner.d.ts +32 -0
- package/lib/core/remote/owner.js +75 -0
- package/lib/core/remote/pairing.d.ts +104 -0
- package/lib/core/remote/pairing.js +261 -0
- package/lib/core/remote/push.d.ts +80 -0
- package/lib/core/remote/push.js +222 -0
- package/lib/core/remote/store.d.ts +18 -0
- package/lib/core/remote/store.js +59 -0
- package/lib/core/remote/tickets.d.ts +20 -0
- package/lib/core/remote/tickets.js +49 -0
- package/lib/core/remote/uploads.d.ts +63 -0
- package/lib/core/remote/uploads.js +161 -0
- package/lib/core/request-attribution.d.ts +26 -0
- package/lib/core/request-attribution.js +86 -0
- package/lib/core/request-invariant.d.ts +61 -0
- package/lib/core/request-invariant.js +199 -0
- package/lib/core/sandbox/backends.d.ts +64 -0
- package/lib/core/sandbox/backends.js +194 -0
- package/lib/core/sandbox/execpolicy.d.ts +93 -0
- package/lib/core/sandbox/execpolicy.js +452 -0
- package/lib/core/sandbox/net-proxy.d.ts +31 -0
- package/lib/core/sandbox/net-proxy.js +162 -0
- package/lib/core/sandbox/policy.d.ts +211 -0
- package/lib/core/sandbox/policy.js +559 -0
- package/lib/core/sandbox/win/abi.d.ts +161 -0
- package/lib/core/sandbox/win/abi.js +169 -0
- package/lib/core/sandbox/win/account.d.ts +71 -0
- package/lib/core/sandbox/win/account.js +206 -0
- package/lib/core/sandbox/win/acl.d.ts +54 -0
- package/lib/core/sandbox/win/acl.js +339 -0
- package/lib/core/sandbox/win/backend.d.ts +61 -0
- package/lib/core/sandbox/win/backend.js +249 -0
- package/lib/core/sandbox/win/doctor.d.ts +24 -0
- package/lib/core/sandbox/win/doctor.js +272 -0
- package/lib/core/sandbox/win/ffi.d.ts +107 -0
- package/lib/core/sandbox/win/ffi.js +166 -0
- package/lib/core/sandbox/win/net-abi.d.ts +154 -0
- package/lib/core/sandbox/win/net-abi.js +316 -0
- package/lib/core/sandbox/win/runner-entry.d.ts +35 -0
- package/lib/core/sandbox/win/runner-entry.js +391 -0
- package/lib/core/sandbox/win/setup.d.ts +60 -0
- package/lib/core/sandbox/win/setup.js +986 -0
- package/lib/core/sandbox/win/token.d.ts +35 -0
- package/lib/core/sandbox/win/token.js +238 -0
- package/lib/core/sandbox/win/wfp.d.ts +41 -0
- package/lib/core/sandbox/win/wfp.js +200 -0
- package/lib/core/sandbox/win/workspace-sid.d.ts +9 -0
- package/lib/core/sandbox/win/workspace-sid.js +45 -0
- package/lib/core/schedule/rule.d.ts +184 -0
- package/lib/core/schedule/rule.js +745 -0
- package/lib/core/schedule/runner.d.ts +185 -0
- package/lib/core/schedule/runner.js +678 -0
- package/lib/core/schedule/store.d.ts +182 -0
- package/lib/core/schedule/store.js +455 -0
- package/lib/core/secrets.d.ts +41 -0
- package/lib/core/secrets.js +150 -0
- package/lib/core/session-export.d.ts +18 -0
- package/lib/core/session-export.js +73 -0
- package/lib/core/session-index.d.ts +159 -0
- package/lib/core/session-index.js +683 -0
- package/lib/core/session-meta.d.ts +41 -0
- package/lib/core/session-meta.js +97 -0
- package/lib/core/session.d.ts +356 -0
- package/lib/core/session.js +998 -0
- package/lib/core/skills.d.ts +60 -0
- package/lib/core/skills.js +171 -0
- package/lib/core/spill.d.ts +159 -0
- package/lib/core/spill.js +329 -0
- package/lib/core/surface-registry.d.ts +45 -0
- package/lib/core/surface-registry.js +67 -0
- package/lib/core/team-board.d.ts +95 -0
- package/lib/core/team-board.js +316 -0
- package/lib/core/throughput.d.ts +46 -0
- package/lib/core/throughput.js +40 -0
- package/lib/core/todo-reminder.d.ts +44 -0
- package/lib/core/todo-reminder.js +55 -0
- package/lib/core/todo.d.ts +81 -0
- package/lib/core/todo.js +222 -0
- package/lib/core/token-estimate.d.ts +55 -0
- package/lib/core/token-estimate.js +82 -0
- package/lib/core/tool-guards.d.ts +103 -0
- package/lib/core/tool-guards.js +77 -0
- package/lib/core/tool-search.d.ts +152 -0
- package/lib/core/tool-search.js +311 -0
- package/lib/core/tools/bash.d.ts +281 -0
- package/lib/core/tools/bash.js +871 -0
- package/lib/core/tools/command-runner.d.ts +84 -0
- package/lib/core/tools/command-runner.js +68 -0
- package/lib/core/tools/fs-tools.d.ts +23 -0
- package/lib/core/tools/fs-tools.js +247 -0
- package/lib/core/tools/index.d.ts +8 -0
- package/lib/core/tools/index.js +4 -0
- package/lib/core/tools/sandbox-args.d.ts +51 -0
- package/lib/core/tools/sandbox-args.js +90 -0
- package/lib/core/tools/search-tools.d.ts +3 -0
- package/lib/core/tools/search-tools.js +153 -0
- package/lib/core/tools.d.ts +96 -0
- package/lib/core/tools.js +53 -0
- package/lib/core/ui-boot-source.d.ts +71 -0
- package/lib/core/ui-boot-source.js +121 -0
- package/lib/core/ui-bundles.d.ts +249 -0
- package/lib/core/ui-bundles.js +830 -0
- package/lib/core/ui-combo.d.ts +49 -0
- package/lib/core/ui-combo.js +55 -0
- package/lib/core/ui-events.d.ts +81 -0
- package/lib/core/ui-events.js +364 -0
- package/lib/core/ui-hmr.d.ts +36 -0
- package/lib/core/ui-hmr.js +128 -0
- package/lib/core/ui-methods.d.ts +69 -0
- package/lib/core/ui-methods.js +341 -0
- package/lib/core/ui-route.d.ts +69 -0
- package/lib/core/ui-route.js +122 -0
- package/lib/core/ui-server.d.ts +75 -0
- package/lib/core/ui-server.js +369 -0
- package/lib/core/ui-trust.d.ts +47 -0
- package/lib/core/ui-trust.js +164 -0
- package/lib/core/untrusted.d.ts +30 -0
- package/lib/core/untrusted.js +48 -0
- package/lib/core/update-check.d.ts +81 -0
- package/lib/core/update-check.js +177 -0
- package/lib/core/usage-log.d.ts +82 -0
- package/lib/core/usage-log.js +306 -0
- package/lib/core/version.d.ts +1 -0
- package/lib/core/version.js +37 -0
- package/lib/core/web-http.d.ts +57 -0
- package/lib/core/web-http.js +137 -0
- package/lib/core/web-static.d.ts +31 -0
- package/lib/core/web-static.js +75 -0
- package/lib/headless.d.ts +1 -0
- package/lib/headless.js +31 -0
- package/lib/host/kernel.d.ts +33 -0
- package/lib/host/kernel.js +451 -0
- package/lib/index.d.ts +41 -0
- package/lib/index.js +35 -0
- package/lib/plugins/agent.d.ts +2 -0
- package/lib/plugins/agent.js +274 -0
- package/lib/plugins/approval-floor.d.ts +2 -0
- package/lib/plugins/approval-floor.js +223 -0
- package/lib/plugins/approval.d.ts +16 -0
- package/lib/plugins/approval.js +674 -0
- package/lib/plugins/ask.d.ts +2 -0
- package/lib/plugins/ask.js +245 -0
- package/lib/plugins/browser.d.ts +68 -0
- package/lib/plugins/browser.js +1341 -0
- package/lib/plugins/commands.d.ts +23 -0
- package/lib/plugins/commands.js +498 -0
- package/lib/plugins/compact.d.ts +21 -0
- package/lib/plugins/compact.js +274 -0
- package/lib/plugins/computer-use.d.ts +47 -0
- package/lib/plugins/computer-use.js +539 -0
- package/lib/plugins/desktop-dock.d.ts +2 -0
- package/lib/plugins/desktop-dock.js +626 -0
- package/lib/plugins/dock-browser.d.ts +34 -0
- package/lib/plugins/dock-browser.js +765 -0
- package/lib/plugins/dsh-compat.d.ts +25 -0
- package/lib/plugins/dsh-compat.js +37 -0
- package/lib/plugins/file-review.d.ts +108 -0
- package/lib/plugins/file-review.js +393 -0
- package/lib/plugins/git.d.ts +26 -0
- package/lib/plugins/git.js +132 -0
- package/lib/plugins/goal.d.ts +20 -0
- package/lib/plugins/goal.js +245 -0
- package/lib/plugins/guards.d.ts +14 -0
- package/lib/plugins/guards.js +18 -0
- package/lib/plugins/hooks.d.ts +19 -0
- package/lib/plugins/hooks.js +583 -0
- package/lib/plugins/host-stdio.d.ts +88 -0
- package/lib/plugins/host-stdio.js +317 -0
- package/lib/plugins/image-diet.d.ts +17 -0
- package/lib/plugins/image-diet.js +85 -0
- package/lib/plugins/lifecycle-hooks.d.ts +26 -0
- package/lib/plugins/lifecycle-hooks.js +338 -0
- package/lib/plugins/llm.d.ts +13 -0
- package/lib/plugins/llm.js +215 -0
- package/lib/plugins/lsp.d.ts +54 -0
- package/lib/plugins/lsp.js +608 -0
- package/lib/plugins/mcp.d.ts +16 -0
- package/lib/plugins/mcp.js +673 -0
- package/lib/plugins/memory.d.ts +17 -0
- package/lib/plugins/memory.js +858 -0
- package/lib/plugins/microcompact.d.ts +18 -0
- package/lib/plugins/microcompact.js +119 -0
- package/lib/plugins/mode.d.ts +18 -0
- package/lib/plugins/mode.js +115 -0
- package/lib/plugins/permission-presets.d.ts +18 -0
- package/lib/plugins/permission-presets.js +135 -0
- package/lib/plugins/plan.d.ts +2 -0
- package/lib/plugins/plan.js +192 -0
- package/lib/plugins/plugin-manager.d.ts +2 -0
- package/lib/plugins/plugin-manager.js +165 -0
- package/lib/plugins/presets.d.ts +2 -0
- package/lib/plugins/presets.js +182 -0
- package/lib/plugins/prompt.d.ts +2 -0
- package/lib/plugins/prompt.js +264 -0
- package/lib/plugins/ptc.d.ts +2 -0
- package/lib/plugins/ptc.js +272 -0
- package/lib/plugins/remote/http.d.ts +11 -0
- package/lib/plugins/remote/http.js +11 -0
- package/lib/plugins/remote/routes.d.ts +24 -0
- package/lib/plugins/remote/routes.js +384 -0
- package/lib/plugins/remote/types.d.ts +135 -0
- package/lib/plugins/remote/types.js +87 -0
- package/lib/plugins/remote.d.ts +17 -0
- package/lib/plugins/remote.js +1028 -0
- package/lib/plugins/runtime-api.d.ts +16 -0
- package/lib/plugins/runtime-api.js +99 -0
- package/lib/plugins/runtime.d.ts +10 -0
- package/lib/plugins/runtime.js +451 -0
- package/lib/plugins/sandbox.d.ts +2 -0
- package/lib/plugins/sandbox.js +761 -0
- package/lib/plugins/schedule.d.ts +26 -0
- package/lib/plugins/schedule.js +538 -0
- package/lib/plugins/self-improve.d.ts +61 -0
- package/lib/plugins/self-improve.js +953 -0
- package/lib/plugins/session-search.d.ts +16 -0
- package/lib/plugins/session-search.js +308 -0
- package/lib/plugins/session-title.d.ts +19 -0
- package/lib/plugins/session-title.js +109 -0
- package/lib/plugins/session.d.ts +7 -0
- package/lib/plugins/session.js +296 -0
- package/lib/plugins/settings.d.ts +3 -0
- package/lib/plugins/settings.js +705 -0
- package/lib/plugins/skills.d.ts +2 -0
- package/lib/plugins/skills.js +360 -0
- package/lib/plugins/spill.d.ts +16 -0
- package/lib/plugins/spill.js +200 -0
- package/lib/plugins/subagent.d.ts +2 -0
- package/lib/plugins/subagent.js +862 -0
- package/lib/plugins/surfaces.d.ts +11 -0
- package/lib/plugins/surfaces.js +20 -0
- package/lib/plugins/team.d.ts +16 -0
- package/lib/plugins/team.js +149 -0
- package/lib/plugins/todo.d.ts +19 -0
- package/lib/plugins/todo.js +188 -0
- package/lib/plugins/tool-search.d.ts +2 -0
- package/lib/plugins/tool-search.js +425 -0
- package/lib/plugins/tools-default.d.ts +12 -0
- package/lib/plugins/tools-default.js +275 -0
- package/lib/plugins/tools.d.ts +16 -0
- package/lib/plugins/tools.js +62 -0
- package/lib/plugins/transcript.d.ts +15 -0
- package/lib/plugins/transcript.js +311 -0
- package/lib/plugins/tui.d.ts +2 -0
- package/lib/plugins/tui.js +98 -0
- package/lib/plugins/waiting.d.ts +12 -0
- package/lib/plugins/waiting.js +34 -0
- package/lib/plugins/web-search.d.ts +14 -0
- package/lib/plugins/web-search.js +263 -0
- package/lib/plugins/webserver.d.ts +48 -0
- package/lib/plugins/webserver.js +228 -0
- package/lib/remote/assets/app-DAcUCOEn.js +14 -0
- package/lib/remote/assets/icon-192.png +0 -0
- package/lib/remote/assets/icon-512.png +0 -0
- package/lib/remote/assets/index.html +34 -0
- package/lib/remote/assets/manifest.json +27 -0
- package/lib/remote/assets/style-DIB6729x.css +1 -0
- package/lib/remote/assets/sw.js +66 -0
- package/lib/services/types.d.ts +1228 -0
- package/lib/services/types.js +1 -0
- package/lib/tools/config-cli.d.ts +1 -0
- package/lib/tools/config-cli.js +89 -0
- package/lib/ui/arrival.d.ts +72 -0
- package/lib/ui/arrival.js +105 -0
- package/lib/ui/assets/app-B70nVIKd.js +69 -0
- package/lib/ui/assets/chunk-2UxHyX5q.js +1 -0
- package/lib/ui/assets/chunk-B1dDrJ26.js +1 -0
- package/lib/ui/assets/chunk-B6aJPvgy.js +1 -0
- package/lib/ui/assets/chunk-BEwlwnbL.js +1 -0
- package/lib/ui/assets/chunk-BGcgwlCI.js +12 -0
- package/lib/ui/assets/chunk-BIGW1oBm.js +1 -0
- package/lib/ui/assets/chunk-BPQ3VLAy.js +1 -0
- package/lib/ui/assets/chunk-BRH0KZbk.js +141 -0
- package/lib/ui/assets/chunk-BX6H_ySx.js +1 -0
- package/lib/ui/assets/chunk-B_P3UbPa.js +1 -0
- package/lib/ui/assets/chunk-B_TYUkTI.js +1 -0
- package/lib/ui/assets/chunk-B_vNuMnf.js +1 -0
- package/lib/ui/assets/chunk-BajyYBss.js +10 -0
- package/lib/ui/assets/chunk-BdnUsdx6.js +1 -0
- package/lib/ui/assets/chunk-Buea-lGh.js +1 -0
- package/lib/ui/assets/chunk-C0PvZCCE.js +1 -0
- package/lib/ui/assets/chunk-C0m74zRD.js +1 -0
- package/lib/ui/assets/chunk-C27-OAKa.js +1 -0
- package/lib/ui/assets/chunk-C2oV4EkX.js +1 -0
- package/lib/ui/assets/chunk-C7zT0LnQ.js +1 -0
- package/lib/ui/assets/chunk-C9GSunVT.js +1 -0
- package/lib/ui/assets/chunk-C9tS-k6U.js +1 -0
- package/lib/ui/assets/chunk-CHLpvVh8.js +1 -0
- package/lib/ui/assets/chunk-CLxacb5B.js +1 -0
- package/lib/ui/assets/chunk-COt5Ahok.js +1 -0
- package/lib/ui/assets/chunk-CPTIWCL2.js +1 -0
- package/lib/ui/assets/chunk-CQLl-L-p.js +1 -0
- package/lib/ui/assets/chunk-CUWRgxuq.js +55 -0
- package/lib/ui/assets/chunk-CWanVSXC.js +1 -0
- package/lib/ui/assets/chunk-Cf5RLm7j.js +1 -0
- package/lib/ui/assets/chunk-CickPsom.js +1 -0
- package/lib/ui/assets/chunk-Cj5Yp3dK.js +1 -0
- package/lib/ui/assets/chunk-Cmh6b_Ma.js +1 -0
- package/lib/ui/assets/chunk-Cp-IABpG.js +1 -0
- package/lib/ui/assets/chunk-CqE71os6.js +1 -0
- package/lib/ui/assets/chunk-CtKP3W-j.js +1 -0
- package/lib/ui/assets/chunk-Cvjx9yec.js +1 -0
- package/lib/ui/assets/chunk-CxGP3dtY.js +1 -0
- package/lib/ui/assets/chunk-CylS5w8V.js +1 -0
- package/lib/ui/assets/chunk-D38fbIBN.js +1 -0
- package/lib/ui/assets/chunk-D97Zzqfu.js +1 -0
- package/lib/ui/assets/chunk-DAi9KRSo.js +1 -0
- package/lib/ui/assets/chunk-DHK4yRfg.js +1 -0
- package/lib/ui/assets/chunk-DJeabLx-.js +1 -0
- package/lib/ui/assets/chunk-DNRxmY5a.js +1 -0
- package/lib/ui/assets/chunk-DNSN1z5r.js +1 -0
- package/lib/ui/assets/chunk-DNasK_ZG.js +1 -0
- package/lib/ui/assets/chunk-DPvrY3IQ.js +1 -0
- package/lib/ui/assets/chunk-DXmwc3jG.js +1 -0
- package/lib/ui/assets/chunk-Dd0kTxKP.js +1 -0
- package/lib/ui/assets/chunk-De0Btta0.js +1 -0
- package/lib/ui/assets/chunk-Des-eS-w.js +1 -0
- package/lib/ui/assets/chunk-Df6bDoY_.js +1 -0
- package/lib/ui/assets/chunk-DijEV5ha.js +1 -0
- package/lib/ui/assets/chunk-DkvoVjww.js +1 -0
- package/lib/ui/assets/chunk-DlC-OlHO.js +1 -0
- package/lib/ui/assets/chunk-DnzrXTVv.js +1 -0
- package/lib/ui/assets/chunk-Dualf0xi.js +1 -0
- package/lib/ui/assets/chunk-EXT84bkm.js +1 -0
- package/lib/ui/assets/chunk-GwR3hkPK.js +1 -0
- package/lib/ui/assets/chunk-P80f7IUj.js +1 -0
- package/lib/ui/assets/chunk-VOosw3JB.js +1 -0
- package/lib/ui/assets/chunk-YQ4lDkt_.js +140 -0
- package/lib/ui/assets/chunk-Yzrsuije.js +1 -0
- package/lib/ui/assets/chunk-Z72CF80r.js +1 -0
- package/lib/ui/assets/chunk-g9-lgVsj.js +1 -0
- package/lib/ui/assets/chunk-vGWfd6FD.js +1 -0
- package/lib/ui/assets/chunk-wDzz0qaB.js +1 -0
- package/lib/ui/assets/chunk-ySF7HWmS.js +1 -0
- package/lib/ui/assets/icon.png +0 -0
- package/lib/ui/assets/index.html +14 -0
- package/lib/ui/assets/pdf.worker.min-CjEcRF4W.mjs +28 -0
- package/lib/ui/assets/style-Bq01xH_b.css +1 -0
- package/lib/ui/frames.d.ts +67 -0
- package/lib/ui/frames.js +146 -0
- package/lib/ui/index.d.ts +59 -0
- package/lib/ui/index.js +50 -0
- package/lib/ui/manifest.d.ts +172 -0
- package/lib/ui/manifest.js +158 -0
- package/lib/ui/plugin.d.ts +161 -0
- package/lib/ui/plugin.js +7 -0
- package/lib/ui/plugins/browser/client.js +290 -0
- package/lib/ui/plugins/browser/icon.png +0 -0
- package/lib/ui/plugins/composer/client.js +1843 -0
- package/lib/ui/plugins/composer/icon.png +0 -0
- package/lib/ui/plugins/files/client.js +646 -0
- package/lib/ui/plugins/files/icon.png +0 -0
- package/lib/ui/plugins/manifest.json +107 -0
- package/lib/ui/plugins/plugins/client.js +682 -0
- package/lib/ui/plugins/plugins/icon.png +0 -0
- package/lib/ui/plugins/preview/client.js +197 -0
- package/lib/ui/plugins/preview/icon.png +0 -0
- package/lib/ui/plugins/prompt/client.js +653 -0
- package/lib/ui/plugins/prompt/icon.png +0 -0
- package/lib/ui/plugins/sessions/client.js +1577 -0
- package/lib/ui/plugins/sessions/icon.png +0 -0
- package/lib/ui/plugins/settings/client.js +5470 -0
- package/lib/ui/plugins/settings/icon.png +0 -0
- package/lib/ui/plugins/skills/client.js +485 -0
- package/lib/ui/plugins/skills/icon.png +0 -0
- package/lib/ui/plugins/status/client.js +1420 -0
- package/lib/ui/plugins/status/icon.png +0 -0
- package/lib/ui/plugins/statusbar/client.js +504 -0
- package/lib/ui/plugins/statusbar/icon.png +0 -0
- package/lib/ui/plugins/tasks/client.js +52 -0
- package/lib/ui/plugins/tasks/icon.png +0 -0
- package/lib/ui/plugins/team/client.js +527 -0
- package/lib/ui/plugins/team/icon.png +0 -0
- package/lib/ui/plugins/terminal/client.js +232 -0
- package/lib/ui/plugins/terminal/icon.png +0 -0
- package/lib/ui/plugins/trace/client.js +1376 -0
- package/lib/ui/plugins/trace/icon.png +0 -0
- package/lib/ui/plugins/transcript/client.js +2661 -0
- package/lib/ui/plugins/transcript/icon.png +0 -0
- package/lib/ui/scoped-slots.d.ts +20 -0
- package/lib/ui/scoped-slots.js +21 -0
- package/lib/ui/sdk/@dsc/ui/index.d.ts +242 -0
- package/lib/ui/sdk/@dsc/ui/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-core/contract.d.ts +1973 -0
- package/lib/ui/sdk/@dsc/ui-core/core/diff-text.d.ts +74 -0
- package/lib/ui/sdk/@dsc/ui-core/core/dock-browser.d.ts +137 -0
- package/lib/ui/sdk/@dsc/ui-core/core/dock-ops.d.ts +59 -0
- package/lib/ui/sdk/@dsc/ui-core/core/model-caps.d.ts +83 -0
- package/lib/ui/sdk/@dsc/ui-core/core/native-bridge.d.ts +135 -0
- package/lib/ui/sdk/@dsc/ui-core/core/token-estimate.d.ts +55 -0
- package/lib/ui/sdk/@dsc/ui-core/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/arrival.d.ts +72 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/frames.d.ts +67 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/index.d.ts +59 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/manifest.d.ts +172 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/plugin.d.ts +161 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/scoped-slots.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/services-react.d.ts +27 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/services.d.ts +63 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/slots-react.d.ts +28 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/slots.d.ts +481 -0
- package/lib/ui/sdk/@dsc/ui-core/ui/store.d.ts +89 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-model.d.ts +238 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock-state.d.ts +163 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/dock.d.ts +24 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/index.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-dockkit/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-layout/app.d.ts +74 -0
- package/lib/ui/sdk/@dsc/ui-layout/appearance.d.ts +70 -0
- package/lib/ui/sdk/@dsc/ui-layout/host-channel.d.ts +112 -0
- package/lib/ui/sdk/@dsc/ui-layout/index.d.ts +34 -0
- package/lib/ui/sdk/@dsc/ui-layout/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-layout/page-state.d.ts +14 -0
- package/lib/ui/sdk/@dsc/ui-layout/review-pane.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-layout/runtime-context.d.ts +44 -0
- package/lib/ui/sdk/@dsc/ui-layout/thread-view.d.ts +28 -0
- package/lib/ui/sdk/@dsc/ui-layout/update-button.d.ts +21 -0
- package/lib/ui/sdk/@dsc/ui-primitives/code-file-icon-artwork.d.ts +53 -0
- package/lib/ui/sdk/@dsc/ui-primitives/code-view.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-primitives/compat.d.ts +27 -0
- package/lib/ui/sdk/@dsc/ui-primitives/completion-sound.d.ts +24 -0
- package/lib/ui/sdk/@dsc/ui-primitives/confirm.d.ts +33 -0
- package/lib/ui/sdk/@dsc/ui-primitives/css.d.ts +47 -0
- package/lib/ui/sdk/@dsc/ui-primitives/diff-rows.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-primitives/file-icons.d.ts +38 -0
- package/lib/ui/sdk/@dsc/ui-primitives/file-type-classify.d.ts +66 -0
- package/lib/ui/sdk/@dsc/ui-primitives/file-type-icon.d.ts +57 -0
- package/lib/ui/sdk/@dsc/ui-primitives/highlight.d.ts +24 -0
- package/lib/ui/sdk/@dsc/ui-primitives/hover-delay.d.ts +17 -0
- package/lib/ui/sdk/@dsc/ui-primitives/icons.d.ts +109 -0
- package/lib/ui/sdk/@dsc/ui-primitives/index.d.ts +55 -0
- package/lib/ui/sdk/@dsc/ui-primitives/lang-table.d.ts +10 -0
- package/lib/ui/sdk/@dsc/ui-primitives/markdown.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-primitives/native.d.ts +41 -0
- package/lib/ui/sdk/@dsc/ui-primitives/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-primitives/panels.d.ts +86 -0
- package/lib/ui/sdk/@dsc/ui-primitives/paths.d.ts +11 -0
- package/lib/ui/sdk/@dsc/ui-primitives/pdf-view.d.ts +13 -0
- package/lib/ui/sdk/@dsc/ui-primitives/plugin-text.d.ts +15 -0
- package/lib/ui/sdk/@dsc/ui-primitives/select.d.ts +35 -0
- package/lib/ui/sdk/@dsc/ui-primitives/table-view.d.ts +23 -0
- package/lib/ui/sdk/@dsc/ui-primitives/thread-resizer.d.ts +22 -0
- package/lib/ui/sdk/@dsc/ui-primitives/time.d.ts +33 -0
- package/lib/ui/sdk/@dsc/ui-primitives/toast.d.ts +16 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tokens.d.ts +14 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tool-args.d.ts +49 -0
- package/lib/ui/sdk/@dsc/ui-primitives/tool-summary.d.ts +64 -0
- package/lib/ui/sdk/@dsc/ui-renderer/boot.d.ts +121 -0
- package/lib/ui/sdk/@dsc/ui-renderer/hmr.d.ts +43 -0
- package/lib/ui/sdk/@dsc/ui-renderer/index.d.ts +20 -0
- package/lib/ui/sdk/@dsc/ui-renderer/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-slots/index.d.ts +19 -0
- package/lib/ui/sdk/@dsc/ui-slots/package.json +16 -0
- package/lib/ui/sdk/@dsc/ui-slots/slots-react.d.ts +48 -0
- package/lib/ui/sdk/@dsc/ui-slots/slots.d.ts +102 -0
- package/lib/ui/services-react.d.ts +27 -0
- package/lib/ui/services-react.js +32 -0
- package/lib/ui/services.d.ts +63 -0
- package/lib/ui/services.js +121 -0
- package/lib/ui/slots-ink.d.ts +26 -0
- package/lib/ui/slots-ink.js +78 -0
- package/lib/ui/slots-react.d.ts +28 -0
- package/lib/ui/slots-react.js +88 -0
- package/lib/ui/slots.d.ts +481 -0
- package/lib/ui/slots.js +550 -0
- package/lib/ui/store.d.ts +89 -0
- package/lib/ui/store.js +62 -0
- package/lib/ui/tui-plugin-api.d.ts +23 -0
- package/lib/ui/tui-plugin-api.js +23 -0
- package/lib/ui/tui-plugins.d.ts +47 -0
- package/lib/ui/tui-plugins.js +220 -0
- package/package.json +58 -6
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ApprovalPolicy, ApprovalReviewer, EffortLevel, MarketSource, UiPrefsView } from '../contract.js';
|
|
2
|
+
export declare const DSC_SETTINGS_JSON: string;
|
|
3
|
+
/** 预置市场源:Anthropic 官方技能库 + dsh 仓库自带的 .agents/skills。 */
|
|
4
|
+
export declare const DEFAULT_MARKET_SOURCES: readonly MarketSource[];
|
|
5
|
+
/** 界面层偏好。null = 未设置(保持内核默认,不覆盖)。 */
|
|
6
|
+
export interface DscPrefs {
|
|
7
|
+
defaultPolicy: ApprovalPolicy | null;
|
|
8
|
+
/**
|
|
9
|
+
* 新会话默认的审阅者(`user` / `auto-review`)。null = 用内核默认(本人点卡)。
|
|
10
|
+
* 与 defaultPolicy 是两根独立的轴,可以只设其中一根。
|
|
11
|
+
*/
|
|
12
|
+
defaultReviewer: ApprovalReviewer | null;
|
|
13
|
+
/**
|
|
14
|
+
* 新会话默认的**打包权限预设**(沙箱 + 权限模式 + 审阅者三合一)。
|
|
15
|
+
* 空串 = 不按预设走,用上面两根各自的默认。写了不存在的名字时启动回落。
|
|
16
|
+
*/
|
|
17
|
+
defaultPermissionPreset: string;
|
|
18
|
+
defaultEffort: EffortLevel | null;
|
|
19
|
+
/**
|
|
20
|
+
* 新会话默认用哪个模式(`~/.dsc/presets/<名字>.md`)。
|
|
21
|
+
* 空串 = 出厂标准档;写了不存在的名字时启动也回落标准档(模式文件可能被删了)。
|
|
22
|
+
*/
|
|
23
|
+
defaultPreset: string;
|
|
24
|
+
marketSources: MarketSource[];
|
|
25
|
+
/** 点窗口右上角 X 时缩到系统托盘而不是退出(桌面端主进程读这个值)。 */
|
|
26
|
+
closeToTray: boolean;
|
|
27
|
+
/** 检查更新的时机(桌面端主进程读这个值:它才够得着网络与安装程序)。 */
|
|
28
|
+
updateCheck: UpdateCheckMode;
|
|
29
|
+
/**
|
|
30
|
+
* 活动配置文件:空串 = 默认的 `~/.dsc/config.yaml`,否则用这条绝对路径
|
|
31
|
+
* (设置 → 通用「配置文件」那一行的「更换」写它,见 core/config-store 的 activeConfigFile)。
|
|
32
|
+
*
|
|
33
|
+
* 为什么记在这里:它是「下次启动时希望用哪一份配置」,与 settings.json 里其它字段同一性质;
|
|
34
|
+
* 而且桌面端与终端界面共用这一份,两边看到的端点是同一份配置。
|
|
35
|
+
*/
|
|
36
|
+
configFile: string;
|
|
37
|
+
/** 侧栏界面偏好(会话排序、工作区顺序与显示名别名)。 */
|
|
38
|
+
ui: UiPrefsView;
|
|
39
|
+
/** 远程控制偏好(手机浏览器接入;见 plugins/remote.ts)。 */
|
|
40
|
+
remote: RemotePrefs;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 检查更新的时机。
|
|
44
|
+
*
|
|
45
|
+
* 为什么是「时机」而不是「开关」:检查要联网,用户对「什么时候花这个流量」比
|
|
46
|
+
* 「要不要这个功能」更敏感。三档覆盖了常见诉求,不设「每 N 小时」那种需要用户算的档。
|
|
47
|
+
*/
|
|
48
|
+
export type UpdateCheckMode = 'launch' | 'daily' | 'off';
|
|
49
|
+
/** 三档的可选值(读档归一与设置页选项共用同一张表)。 */
|
|
50
|
+
export declare const UPDATE_CHECK_MODES: readonly UpdateCheckMode[];
|
|
51
|
+
/** 远程控制的开关(设置 → 远程控制)。 */
|
|
52
|
+
export interface RemotePrefs {
|
|
53
|
+
/** true = 本机起 HTTP+WS 服务;false = 一个字节都不监听。 */
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
/** 监听端口;1024 以下要管理员权限,所以下限从 1024 起。 */
|
|
56
|
+
port: number;
|
|
57
|
+
/** true = 绑 0.0.0.0(同一个 Wi-Fi 的手机能连);false = 只绑 127.0.0.1。 */
|
|
58
|
+
lan: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* 浏览器推送(Web Push)总开关,默认关。
|
|
61
|
+
* 关着时:WS hello 里的 pushPublicKey 报 null、订阅端点回 403、一条推送都不发,
|
|
62
|
+
* 也不会为了它生成 VAPID 密钥。
|
|
63
|
+
*/
|
|
64
|
+
push: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 通知 Webhook 地址,默认空串 = 关。
|
|
67
|
+
* 只认 http(s);带 `{title}` / `{body}` / `{url}` 占位符时走 GET(Bark 风格),
|
|
68
|
+
* 不带时 POST JSON(ntfy 风格)。读档时非 http(s) 的一律回落空串。
|
|
69
|
+
*/
|
|
70
|
+
notifyWebhook: string;
|
|
71
|
+
}
|
|
72
|
+
/** 远程控制端口范围与缺省值(17321 是随手挑的高位口,不与常见服务撞)。 */
|
|
73
|
+
export declare const REMOTE_PORT_MIN = 1024;
|
|
74
|
+
export declare const REMOTE_PORT_MAX = 65535;
|
|
75
|
+
export declare const REMOTE_PORT_DEFAULT = 17321;
|
|
76
|
+
/** 读偏好(文件缺失或损坏按默认处理,绝不因为偏好坏掉起不来)。 */
|
|
77
|
+
export declare function readPrefs(): DscPrefs;
|
|
78
|
+
/**
|
|
79
|
+
* 合并并写盘偏好。`ui` 与 `remote` 是仅有的两个嵌套字段,所以深合并它们:调用方只传
|
|
80
|
+
* 自己要改的那几项(例如只改端口)也不会把 enabled/lan 抹掉。
|
|
81
|
+
*/
|
|
82
|
+
export declare function writePrefs(patch: Partial<DscPrefs>): DscPrefs;
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户偏好:`~/.dsc/settings.json`,存界面层的默认值、市场源清单,以及侧栏的
|
|
3
|
+
* 排序方式与工作区排列。
|
|
4
|
+
*
|
|
5
|
+
* 模型端点不放这里(那是 config.yaml 的事,见 core/config-store.ts);
|
|
6
|
+
* 本文件的字段都是「下次启动时希望是什么」,运行期改动走各自服务。
|
|
7
|
+
*
|
|
8
|
+
* @module dsc/core/prefs
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { dirname } from 'node:path';
|
|
12
|
+
import { DEFAULT_STATUS_BAR_PREFS, normalizeStatusBarPrefs } from '../contract.js';
|
|
13
|
+
import { isHttpUrl } from './remote/notify.js';
|
|
14
|
+
import { dscPath } from './path-policy.js';
|
|
15
|
+
export const DSC_SETTINGS_JSON = dscPath('settings.json');
|
|
16
|
+
/** 预置市场源:Anthropic 官方技能库 + dsh 仓库自带的 .agents/skills。 */
|
|
17
|
+
export const DEFAULT_MARKET_SOURCES = [
|
|
18
|
+
{ name: 'anthropics', url: 'https://github.com/anthropics/skills/tree/main/skills' },
|
|
19
|
+
{
|
|
20
|
+
name: 'dsh',
|
|
21
|
+
url: 'https://github.com/deepseek-ai/deepseek-harness/tree/master/.agents/skills',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
/** 三档的可选值(读档归一与设置页选项共用同一张表)。 */
|
|
25
|
+
export const UPDATE_CHECK_MODES = ['launch', 'daily', 'off'];
|
|
26
|
+
/** 远程控制端口范围与缺省值(17321 是随手挑的高位口,不与常见服务撞)。 */
|
|
27
|
+
export const REMOTE_PORT_MIN = 1024;
|
|
28
|
+
export const REMOTE_PORT_MAX = 65535;
|
|
29
|
+
export const REMOTE_PORT_DEFAULT = 17321;
|
|
30
|
+
const POLICIES = ['readonly', 'auto-edit', 'full-access'];
|
|
31
|
+
const REVIEWERS = ['user', 'auto-review'];
|
|
32
|
+
/**
|
|
33
|
+
* 旧档名 `ai-review` 的迁移:那一档的真实语义是「每一次调用都先给模型判官」
|
|
34
|
+
* (它既不自动放行工作区内写,也不跳过只读命令),在新模型里等价于
|
|
35
|
+
* 「完全访问 + AI 复核」(审阅者跑在自动放行之前)。这样老用户升级后行为不变。
|
|
36
|
+
*/
|
|
37
|
+
const LEGACY_AI_REVIEW = 'ai-review';
|
|
38
|
+
const EFFORTS = ['default', 'off', 'low', 'high', 'max'];
|
|
39
|
+
const SESSION_SORTS = ['manual', 'recent', 'created'];
|
|
40
|
+
const SESSION_GROUPS = ['workspace', 'tree', 'flat'];
|
|
41
|
+
const ARCHIVED_FILTERS = ['hide', 'show', 'only'];
|
|
42
|
+
const THEME_MODES = ['dark', 'light', 'system'];
|
|
43
|
+
const DENSITIES = ['compact', 'standard', 'roomy'];
|
|
44
|
+
/**
|
|
45
|
+
* 过程折叠程度四档(桌面端「通用 → 过程折叠程度」)。
|
|
46
|
+
* 与桌面端 appearance.ts 的 normalizeProcessFold 同一张表,改这里要两边一起改。
|
|
47
|
+
* satisfies 锁住拼写与类型:档位名写错当场编译报错,不会静默漏进白名单。
|
|
48
|
+
*/
|
|
49
|
+
const PROCESS_FOLDS = ['compact', 'standard', 'detailed', 'verbose'];
|
|
50
|
+
/** 读不出过程折叠程度时的默认档:标准档(整轮折叠 + 阶段分组 + 摘要 + 组头带实时详情)。 */
|
|
51
|
+
const PROCESS_FOLD_DEFAULT = 'standard';
|
|
52
|
+
/**
|
|
53
|
+
* 旧存档里的三档字号:0.6 之前 `ui.fontSize` 存的是字符串,读到时按这张表
|
|
54
|
+
* 换成倍率,之后的存档只存数字。
|
|
55
|
+
*/
|
|
56
|
+
const LEGACY_FONT_SCALES = { sm: 0.92, md: 1, lg: 1.12 };
|
|
57
|
+
/** 字号倍率的可调范围,与桌面端滑杆一致(desktop/src/renderer/appearance.ts)。 */
|
|
58
|
+
const FONT_SCALE_MIN = 0.85;
|
|
59
|
+
const FONT_SCALE_MAX = 1.35;
|
|
60
|
+
/** 读不出字号时的基准倍率:正文 13px 原样。 */
|
|
61
|
+
const FONT_SCALE_DEFAULT = 1;
|
|
62
|
+
/** 按钮倍率的可调范围,与桌面端滑杆一致(desktop/src/renderer/appearance.ts)。 */
|
|
63
|
+
const BUTTON_SCALE_MIN = 0.9;
|
|
64
|
+
const BUTTON_SCALE_MAX = 1.5;
|
|
65
|
+
/** 读不出按钮倍率时的基准倍率:图标按钮静息 26px 原样。 */
|
|
66
|
+
const BUTTON_SCALE_DEFAULT = 1;
|
|
67
|
+
/** 工作区别名的长度上限(侧栏一行放不下太长名字)。 */
|
|
68
|
+
const ALIAS_LIMIT = 40;
|
|
69
|
+
/** 完成提示音的音色数量,与桌面端 renderer/turn-notify.ts 的夹取一致(改这里要两边一起改)。 */
|
|
70
|
+
const SOUND_VARIANT_COUNT = 14;
|
|
71
|
+
/**
|
|
72
|
+
* 把存档里的完成提示音音色编号读成 1–{@link SOUND_VARIANT_COUNT} 的整数。
|
|
73
|
+
*
|
|
74
|
+
* 手改坏的值(0、负数、小数、字符串、NaN)一律回落 1 号音色,绝不让存档把启动拦下来。
|
|
75
|
+
* 夹取而不是拒绝:设置下拉只有 14 项,夹回范围的值至少还能正常出声。
|
|
76
|
+
*
|
|
77
|
+
* @param value settings.json 里 `ui.turnCompleteSoundVariant` 的原始值
|
|
78
|
+
* @returns 可直接交给渲染层音色表的编号
|
|
79
|
+
*/
|
|
80
|
+
function readSoundVariant(value) {
|
|
81
|
+
const id = typeof value === 'number' && Number.isFinite(value) ? Math.round(value) : 1;
|
|
82
|
+
return Math.min(SOUND_VARIANT_COUNT, Math.max(1, id));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 把存档里的字号读成倍率。
|
|
86
|
+
*
|
|
87
|
+
* 数字直接夹到 0.85–1.35;旧的 `'sm' | 'md' | 'lg'` 迁移成 0.92 / 1 / 1.12;
|
|
88
|
+
* 手改坏的值(`"大"`、NaN、null)一律回落 1,绝不让存档把启动拦下来。
|
|
89
|
+
*
|
|
90
|
+
* @param value settings.json 里 `ui.fontSize` 的原始值
|
|
91
|
+
* @returns 可直接写进 `--dsc-font-scale` 的倍率
|
|
92
|
+
*/
|
|
93
|
+
function readFontScale(value) {
|
|
94
|
+
const legacy = typeof value === 'string' ? LEGACY_FONT_SCALES[value] : undefined;
|
|
95
|
+
const scale = legacy ?? (typeof value === 'number' && Number.isFinite(value) ? value : FONT_SCALE_DEFAULT);
|
|
96
|
+
return Math.min(FONT_SCALE_MAX, Math.max(FONT_SCALE_MIN, scale));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 把存档里的按钮倍率读成倍率。
|
|
100
|
+
*
|
|
101
|
+
* 数字直接夹到 0.9–1.5;手改坏的值(`"大"`、NaN、null)一律回落 1,绝不让存档
|
|
102
|
+
* 把启动拦下来。范围与桌面端滑杆一致(desktop/src/renderer/appearance.ts),
|
|
103
|
+
* 改这里要两边一起改。
|
|
104
|
+
*
|
|
105
|
+
* @param value settings.json 里 `ui.buttonScale` 的原始值
|
|
106
|
+
* @returns 可直接写进 `--dsc-btn-scale` 的倍率
|
|
107
|
+
*/
|
|
108
|
+
function readButtonScale(value) {
|
|
109
|
+
const scale = typeof value === 'number' && Number.isFinite(value) ? value : BUTTON_SCALE_DEFAULT;
|
|
110
|
+
return Math.min(BUTTON_SCALE_MAX, Math.max(BUTTON_SCALE_MIN, scale));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 把存档里的过程折叠程度读成四档之一。
|
|
114
|
+
*
|
|
115
|
+
* 认不出的值(手改坏的 `"简单"`、null、数字)一律回落标准档,绝不让存档把启动拦下来;
|
|
116
|
+
* 老 settings.json 里没有这一项,走的也是这条回落。
|
|
117
|
+
*
|
|
118
|
+
* @param value settings.json 里 `ui.processFold` 的原始值
|
|
119
|
+
* @returns 可直接交给渲染层的档位
|
|
120
|
+
*/
|
|
121
|
+
function readProcessFold(value) {
|
|
122
|
+
return typeof value === 'string' && PROCESS_FOLDS.includes(value)
|
|
123
|
+
? value
|
|
124
|
+
: PROCESS_FOLD_DEFAULT;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 把存档里的监听端口读成合法端口。
|
|
128
|
+
*
|
|
129
|
+
* 数字直接夹到 1024–65535;手改坏的值(字符串、NaN、null、小数)一律回落缺省端口,
|
|
130
|
+
* 绝不让存档把启动拦下来。这里用夹取而不是拒绝:改小 80 想「跑在 80 口」这种输入,
|
|
131
|
+
* 夹成 1024 至少服务起得来,界面上还能看见真实生效的值。
|
|
132
|
+
*
|
|
133
|
+
* @param value settings.json 里 `remote.port` 的原始值
|
|
134
|
+
* @returns 可直接 listen 的端口号
|
|
135
|
+
*/
|
|
136
|
+
function readRemotePort(value) {
|
|
137
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
138
|
+
return REMOTE_PORT_DEFAULT;
|
|
139
|
+
return Math.min(REMOTE_PORT_MAX, Math.max(REMOTE_PORT_MIN, Math.round(value)));
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* 把存档里的通知 Webhook 读成合法地址。
|
|
143
|
+
*
|
|
144
|
+
* 只认 http(s);手改坏的值(`javascript:`、`ftp://`、域名缺协议、数字、null)一律回落空串
|
|
145
|
+
* (空串 = 关)。这里用回落而不是夹取:一个发不出去的地址留着只会每次推送都失败一次。
|
|
146
|
+
*
|
|
147
|
+
* @param value settings.json 里 `remote.notifyWebhook` 的原始值
|
|
148
|
+
* @returns 可直接发请求的地址,或空串
|
|
149
|
+
*/
|
|
150
|
+
function readNotifyWebhook(value) {
|
|
151
|
+
if (typeof value !== 'string')
|
|
152
|
+
return '';
|
|
153
|
+
const trimmed = value.trim();
|
|
154
|
+
return isHttpUrl(trimmed) ? trimmed : '';
|
|
155
|
+
}
|
|
156
|
+
/** 模式名形状,与 core/presets.ts 的 PRESET_NAME 同一张表(改这里要两边一起改)。 */
|
|
157
|
+
const PRESET_NAME = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
158
|
+
/** 读偏好(文件缺失或损坏按默认处理,绝不因为偏好坏掉起不来)。 */
|
|
159
|
+
export function readPrefs() {
|
|
160
|
+
const prefs = {
|
|
161
|
+
defaultPolicy: null,
|
|
162
|
+
defaultReviewer: null,
|
|
163
|
+
defaultPermissionPreset: '',
|
|
164
|
+
defaultEffort: null,
|
|
165
|
+
defaultPreset: '',
|
|
166
|
+
marketSources: [...DEFAULT_MARKET_SOURCES],
|
|
167
|
+
closeToTray: true,
|
|
168
|
+
// 出厂每次启动查一次:更新源是一次只读的 GitHub API 调用,代价很小;
|
|
169
|
+
// 不想让它联网的用户在设置里改「不检查」。
|
|
170
|
+
updateCheck: 'launch',
|
|
171
|
+
// 出厂用默认那份 ~/.dsc/config.yaml(换过才非空,见字段注释)。
|
|
172
|
+
configFile: '',
|
|
173
|
+
ui: {
|
|
174
|
+
sessionSort: 'manual',
|
|
175
|
+
sessionGroup: 'workspace',
|
|
176
|
+
archivedFilter: 'hide',
|
|
177
|
+
workspaceOrder: [],
|
|
178
|
+
workspaceAliases: {},
|
|
179
|
+
themeMode: 'dark',
|
|
180
|
+
fontSize: FONT_SCALE_DEFAULT,
|
|
181
|
+
buttonScale: BUTTON_SCALE_DEFAULT,
|
|
182
|
+
density: 'standard',
|
|
183
|
+
processFold: PROCESS_FOLD_DEFAULT,
|
|
184
|
+
// 两个「默认态」开关:出厂都是折叠(与 0.6.3 的实际观感一致,升级不改变现状)。
|
|
185
|
+
reasoningDefaultOpen: false,
|
|
186
|
+
toolDefaultOpen: false,
|
|
187
|
+
// 侧栏分组展开态与会话手动顺序:出厂都是空表(全部用默认行为)。
|
|
188
|
+
sessionExpansion: {},
|
|
189
|
+
sessionOrder: {},
|
|
190
|
+
// 任务完成提醒三项:提示音默认开(合成音,音量压得很低),后台系统通知默认开。
|
|
191
|
+
turnCompleteSound: true,
|
|
192
|
+
turnCompleteSoundVariant: 1,
|
|
193
|
+
turnCompleteNotify: true,
|
|
194
|
+
// TUI 状态栏段显隐:出厂口径在 contract 的 DEFAULT_STATUS_BAR_PREFS(0.6.62)。
|
|
195
|
+
statusBar: { ...DEFAULT_STATUS_BAR_PREFS },
|
|
196
|
+
},
|
|
197
|
+
remote: { enabled: false, port: REMOTE_PORT_DEFAULT, lan: false, push: false, notifyWebhook: '' },
|
|
198
|
+
};
|
|
199
|
+
if (!existsSync(DSC_SETTINGS_JSON))
|
|
200
|
+
return prefs;
|
|
201
|
+
try {
|
|
202
|
+
const doc = JSON.parse(readFileSync(DSC_SETTINGS_JSON, 'utf8'));
|
|
203
|
+
if (typeof doc.closeToTray === 'boolean') {
|
|
204
|
+
prefs.closeToTray = doc.closeToTray;
|
|
205
|
+
}
|
|
206
|
+
// 检查更新时机:认不出的值回落「每次启动」(缺键也一样——老 settings.json 里没有它)。
|
|
207
|
+
if (typeof doc.updateCheck === 'string' && UPDATE_CHECK_MODES.includes(doc.updateCheck)) {
|
|
208
|
+
prefs.updateCheck = doc.updateCheck;
|
|
209
|
+
}
|
|
210
|
+
// 活动配置文件:只认非空字符串(空串与缺键都表示「用默认那份」)。
|
|
211
|
+
if (typeof doc.configFile === 'string' && doc.configFile.trim() !== '') {
|
|
212
|
+
prefs.configFile = doc.configFile;
|
|
213
|
+
}
|
|
214
|
+
if (typeof doc.ui === 'object' && doc.ui !== null) {
|
|
215
|
+
const ui = doc.ui;
|
|
216
|
+
if (typeof ui.sessionSort === 'string' && SESSION_SORTS.includes(ui.sessionSort)) {
|
|
217
|
+
prefs.ui.sessionSort = ui.sessionSort;
|
|
218
|
+
}
|
|
219
|
+
if (typeof ui.sessionGroup === 'string' && SESSION_GROUPS.includes(ui.sessionGroup)) {
|
|
220
|
+
prefs.ui.sessionGroup = ui.sessionGroup;
|
|
221
|
+
}
|
|
222
|
+
if (typeof ui.archivedFilter === 'string' && ARCHIVED_FILTERS.includes(ui.archivedFilter)) {
|
|
223
|
+
prefs.ui.archivedFilter = ui.archivedFilter;
|
|
224
|
+
}
|
|
225
|
+
if (Array.isArray(ui.workspaceOrder)) {
|
|
226
|
+
prefs.ui.workspaceOrder = [...new Set(ui.workspaceOrder.filter((entry) => typeof entry === 'string' && entry !== ''))];
|
|
227
|
+
}
|
|
228
|
+
if (typeof ui.workspaceAliases === 'object' && ui.workspaceAliases !== null) {
|
|
229
|
+
for (const [cwd, alias] of Object.entries(ui.workspaceAliases)) {
|
|
230
|
+
if (typeof alias !== 'string')
|
|
231
|
+
continue;
|
|
232
|
+
const name = alias.replace(/\s+/g, ' ').trim().slice(0, ALIAS_LIMIT);
|
|
233
|
+
if (name !== '')
|
|
234
|
+
prefs.ui.workspaceAliases[cwd] = name;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// 外观四项 + 过程折叠程度:老 settings.json 里没有这几项,读不到就保持上面的默认值。
|
|
238
|
+
if (typeof ui.themeMode === 'string' && THEME_MODES.includes(ui.themeMode)) {
|
|
239
|
+
prefs.ui.themeMode = ui.themeMode;
|
|
240
|
+
}
|
|
241
|
+
if (typeof ui.fontSize === 'string' || typeof ui.fontSize === 'number') {
|
|
242
|
+
prefs.ui.fontSize = readFontScale(ui.fontSize);
|
|
243
|
+
}
|
|
244
|
+
// 按钮缩放只有桌面端这一个写入方,存的是数字;NaN/Infinity 由 readButtonScale 回落 1。
|
|
245
|
+
if (typeof ui.buttonScale === 'number') {
|
|
246
|
+
prefs.ui.buttonScale = readButtonScale(ui.buttonScale);
|
|
247
|
+
}
|
|
248
|
+
if (typeof ui.density === 'string' && DENSITIES.includes(ui.density)) {
|
|
249
|
+
prefs.ui.density = ui.density;
|
|
250
|
+
}
|
|
251
|
+
// 过程折叠程度也只有桌面端这一个写入方,存的是四个字符串之一;
|
|
252
|
+
// 认不出的值由 readProcessFold 回落 standard(老档里没这一项也是这条路)。
|
|
253
|
+
if (ui.processFold !== undefined) {
|
|
254
|
+
prefs.ui.processFold = readProcessFold(ui.processFold);
|
|
255
|
+
}
|
|
256
|
+
// 两个默认态开关:老 settings.json 里没有,读不到就保持上面的 false。
|
|
257
|
+
if (typeof ui.reasoningDefaultOpen === 'boolean') {
|
|
258
|
+
prefs.ui.reasoningDefaultOpen = ui.reasoningDefaultOpen;
|
|
259
|
+
}
|
|
260
|
+
if (typeof ui.toolDefaultOpen === 'boolean') {
|
|
261
|
+
prefs.ui.toolDefaultOpen = ui.toolDefaultOpen;
|
|
262
|
+
}
|
|
263
|
+
// 分组展开态:cwd → 布尔。只认这两种值,行数封顶 500(防手改坏档撑爆 settings.json)。
|
|
264
|
+
if (typeof ui.sessionExpansion === 'object' && ui.sessionExpansion !== null) {
|
|
265
|
+
const expansion = {};
|
|
266
|
+
for (const [key, value] of Object.entries(ui.sessionExpansion)) {
|
|
267
|
+
if (typeof value === 'boolean')
|
|
268
|
+
expansion[key] = value;
|
|
269
|
+
if (Object.keys(expansion).length >= 500)
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
prefs.ui.sessionExpansion = expansion;
|
|
273
|
+
}
|
|
274
|
+
// 会话手动顺序:cwd → 路径序列。只留非空字符串,每表封顶 500 条。
|
|
275
|
+
if (typeof ui.sessionOrder === 'object' && ui.sessionOrder !== null) {
|
|
276
|
+
const order = {};
|
|
277
|
+
for (const [key, value] of Object.entries(ui.sessionOrder)) {
|
|
278
|
+
if (!Array.isArray(value))
|
|
279
|
+
continue;
|
|
280
|
+
const ids = value.filter((entry) => typeof entry === 'string' && entry !== '');
|
|
281
|
+
if (ids.length > 0)
|
|
282
|
+
order[key] = ids.slice(0, 500);
|
|
283
|
+
if (Object.keys(order).length >= 500)
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
prefs.ui.sessionOrder = order;
|
|
287
|
+
}
|
|
288
|
+
// 任务完成提醒三项:老 settings.json 里没有,读不到就保持上面的默认值(都开、1 号音色);
|
|
289
|
+
// 音色编号由 readSoundVariant 夹回 1–14,坏值回落 1。
|
|
290
|
+
if (typeof ui.turnCompleteSound === 'boolean') {
|
|
291
|
+
prefs.ui.turnCompleteSound = ui.turnCompleteSound;
|
|
292
|
+
}
|
|
293
|
+
if (ui.turnCompleteSoundVariant !== undefined) {
|
|
294
|
+
prefs.ui.turnCompleteSoundVariant = readSoundVariant(ui.turnCompleteSoundVariant);
|
|
295
|
+
}
|
|
296
|
+
if (typeof ui.turnCompleteNotify === 'boolean') {
|
|
297
|
+
prefs.ui.turnCompleteNotify = ui.turnCompleteNotify;
|
|
298
|
+
}
|
|
299
|
+
// 状态栏段显隐(0.6.62):逐键白名单归一,缺键/坏键回落出厂默认。
|
|
300
|
+
prefs.ui.statusBar = normalizeStatusBarPrefs(ui.statusBar);
|
|
301
|
+
}
|
|
302
|
+
// 权限档与审阅者:读两个键,兼容旧档名。旧 `ai-review` 落成
|
|
303
|
+
// 「完全访问 + AI 复核」(理由见 LEGACY_AI_REVIEW);显式写了 reviewer 时以它为准。
|
|
304
|
+
const rawReviewer = typeof doc.defaultReviewer === 'string' ? doc.defaultReviewer : '';
|
|
305
|
+
if (doc.defaultPolicy === LEGACY_AI_REVIEW) {
|
|
306
|
+
prefs.defaultPolicy = 'full-access';
|
|
307
|
+
prefs.defaultReviewer = 'auto-review';
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
if (typeof doc.defaultPolicy === 'string' && POLICIES.includes(doc.defaultPolicy)) {
|
|
311
|
+
prefs.defaultPolicy = doc.defaultPolicy;
|
|
312
|
+
}
|
|
313
|
+
if (REVIEWERS.includes(rawReviewer))
|
|
314
|
+
prefs.defaultReviewer = rawReviewer;
|
|
315
|
+
}
|
|
316
|
+
if (typeof doc.defaultPermissionPreset === 'string' && PRESET_NAME.test(doc.defaultPermissionPreset.trim())) {
|
|
317
|
+
prefs.defaultPermissionPreset = doc.defaultPermissionPreset.trim();
|
|
318
|
+
}
|
|
319
|
+
if (typeof doc.defaultEffort === 'string' && EFFORTS.includes(doc.defaultEffort)) {
|
|
320
|
+
prefs.defaultEffort = doc.defaultEffort;
|
|
321
|
+
}
|
|
322
|
+
// 默认模式:认不出的值(手改坏的中文、超长、带斜杠)一律回落出厂标准档,
|
|
323
|
+
// 名字合法但文件不在了也由 presets 插件在启动时回落,不让一个坏偏好把会话卡住。
|
|
324
|
+
if (typeof doc.defaultPreset === 'string' && PRESET_NAME.test(doc.defaultPreset.trim())) {
|
|
325
|
+
prefs.defaultPreset = doc.defaultPreset.trim();
|
|
326
|
+
}
|
|
327
|
+
if (Array.isArray(doc.marketSources)) {
|
|
328
|
+
const sources = doc.marketSources
|
|
329
|
+
.filter((entry) => entry !== null && typeof entry === 'object')
|
|
330
|
+
.map((entry) => ({ name: String(entry.name ?? ''), url: String(entry.url ?? '') }))
|
|
331
|
+
.filter((entry) => entry.name !== '' && entry.url !== '');
|
|
332
|
+
prefs.marketSources = sources;
|
|
333
|
+
}
|
|
334
|
+
// 远程控制:老 settings.json 里没有这一段,读不到就保持上面的默认值(关着);
|
|
335
|
+
// 认不出的键一律不认(不往 prefs 里搬),坏值由 readRemotePort 夹回范围。
|
|
336
|
+
if (typeof doc.remote === 'object' && doc.remote !== null) {
|
|
337
|
+
const remote = doc.remote;
|
|
338
|
+
if (typeof remote.enabled === 'boolean')
|
|
339
|
+
prefs.remote.enabled = remote.enabled;
|
|
340
|
+
if (typeof remote.lan === 'boolean')
|
|
341
|
+
prefs.remote.lan = remote.lan;
|
|
342
|
+
if (remote.port !== undefined)
|
|
343
|
+
prefs.remote.port = readRemotePort(remote.port);
|
|
344
|
+
// 浏览器推送默认关:只认真正的布尔
|
|
345
|
+
if (typeof remote.push === 'boolean')
|
|
346
|
+
prefs.remote.push = remote.push;
|
|
347
|
+
// 通知 Webhook 默认空串:非 http(s) 的坏值回落空串(关掉),不让它每次推送都失败一次
|
|
348
|
+
if (remote.notifyWebhook !== undefined)
|
|
349
|
+
prefs.remote.notifyWebhook = readNotifyWebhook(remote.notifyWebhook);
|
|
350
|
+
}
|
|
351
|
+
return prefs;
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
return prefs;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* 合并并写盘偏好。`ui` 与 `remote` 是仅有的两个嵌套字段,所以深合并它们:调用方只传
|
|
359
|
+
* 自己要改的那几项(例如只改端口)也不会把 enabled/lan 抹掉。
|
|
360
|
+
*/
|
|
361
|
+
export function writePrefs(patch) {
|
|
362
|
+
const current = readPrefs();
|
|
363
|
+
const next = {
|
|
364
|
+
...current,
|
|
365
|
+
...patch,
|
|
366
|
+
ui: { ...current.ui, ...patch.ui },
|
|
367
|
+
remote: { ...current.remote, ...patch.remote },
|
|
368
|
+
};
|
|
369
|
+
mkdirSync(dirname(DSC_SETTINGS_JSON), { recursive: true });
|
|
370
|
+
writeFileSync(DSC_SETTINGS_JSON, `${JSON.stringify(next, null, 2)}\n`, 'utf8');
|
|
371
|
+
return next;
|
|
372
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** 模式文件目录。 */
|
|
2
|
+
export declare const DSC_PRESETS_DIR: string;
|
|
3
|
+
/** 四个出厂模式的标识(标准档是永久的回落目标,任何读不出来的情况都回落到它)。 */
|
|
4
|
+
export declare const STANDARD_PRESET = "standard";
|
|
5
|
+
export declare const MINIMAL_PRESET = "minimal";
|
|
6
|
+
export declare const MAKER_PRESET = "maker";
|
|
7
|
+
export declare const PTC_PRESET = "ptc";
|
|
8
|
+
/** 允许被模式去掉的骨架提示段。
|
|
9
|
+
*
|
|
10
|
+
* 只放「做法层面的叮嘱」:去掉它们只影响模型的自觉程度,
|
|
11
|
+
* 代码里的守卫(审批硬地板、命令策略、路径策略)一条都不会因此松开。
|
|
12
|
+
* `identity`(中文与称呼约定)与 `environment`(环境事实)不在名单里:前者是产品约定,
|
|
13
|
+
* 后者是事实——两者都不该被一个模式抹掉。 */
|
|
14
|
+
export declare const DROPPABLE_SECTIONS: readonly string[];
|
|
15
|
+
/** 骨架段的中文名(设置面板上让人勾的名单)。 */
|
|
16
|
+
export declare const DROPPABLE_LABELS: Readonly<Record<string, string>>;
|
|
17
|
+
/** 一个模式。 */
|
|
18
|
+
export interface Preset {
|
|
19
|
+
/** 模式标识(文件名去掉 .md,或 frontmatter 里的 name)。 */
|
|
20
|
+
name: string;
|
|
21
|
+
/** 界面上的显示名。 */
|
|
22
|
+
label: string;
|
|
23
|
+
description: string;
|
|
24
|
+
/** 工具白名单;null = 全量,空数组 = 一个工具都不给。 */
|
|
25
|
+
tools: string[] | null;
|
|
26
|
+
/** 要去掉的骨架提示段 id(只认 {@link DROPPABLE_SECTIONS} 里的)。 */
|
|
27
|
+
drop: string[];
|
|
28
|
+
/** 正文 = 这个模式追加给模型的提示词。 */
|
|
29
|
+
prompt: string;
|
|
30
|
+
/** 是不是 dsc 出厂自带的那四个。 */
|
|
31
|
+
builtin: boolean;
|
|
32
|
+
/** 文件路径(诊断与「查看配置」用)。 */
|
|
33
|
+
file: string;
|
|
34
|
+
/** 文件里有问题时的说明(其余字段退回默认值)。 */
|
|
35
|
+
problem?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 把还不存在的出厂模式写进模式目录。
|
|
39
|
+
* @returns 实际新写出的模式名(已存在的一律不覆盖,用户改过的永远留着)。
|
|
40
|
+
*/
|
|
41
|
+
export declare function ensureBuiltinPresets(): string[];
|
|
42
|
+
/** 读一个模式文件;返回 null = 文件名不合法或读不起来。 */
|
|
43
|
+
export declare function readPreset(file: string): Preset | null;
|
|
44
|
+
/**
|
|
45
|
+
* 标准档规格:文件在就用文件,文件被删了/写坏了就用出厂那份(内存里现解析)。
|
|
46
|
+
* 这个函数**绝不返回 null**——它是整套模式系统的回落点,任何读不出来的情况
|
|
47
|
+
* (文件没了、frontmatter 坏了、偏好里写了不存在的名字)最后都落到它身上。
|
|
48
|
+
*/
|
|
49
|
+
export declare function standardPreset(): Preset;
|
|
50
|
+
/** 列出全部模式,按名字排序;坏文件也列出来(带 problem),免得用户以为文件没生效。 */
|
|
51
|
+
export declare function listPresets(): Preset[];
|
|
52
|
+
/** 按名字取模式;不存在返回 null(调用方决定是报错还是回落到标准档)。 */
|
|
53
|
+
export declare function findPreset(name: string): Preset | null;
|
|
54
|
+
/**
|
|
55
|
+
* 写一个模式文件(设置面板「保存」用)。
|
|
56
|
+
*
|
|
57
|
+
* 覆盖写:手写在 frontmatter 里的额外键不会保留(写的永远是上面那五个键),
|
|
58
|
+
* 想留着自己的键就直接编辑文件。名字非法或改名为已存在的模式时抛错。
|
|
59
|
+
*/
|
|
60
|
+
export declare function writePreset(draft: {
|
|
61
|
+
oldName: string | null;
|
|
62
|
+
name: string;
|
|
63
|
+
label: string;
|
|
64
|
+
description: string;
|
|
65
|
+
tools: string[] | null;
|
|
66
|
+
drop: string[];
|
|
67
|
+
prompt: string;
|
|
68
|
+
}): Preset;
|
|
69
|
+
/**
|
|
70
|
+
* 删掉一个自定义模式。
|
|
71
|
+
*
|
|
72
|
+
* 内置四个不给删:删了下次启动 ensureBuiltinPresets 又会长回来,只会让人以为没删掉;
|
|
73
|
+
* 想改内置的就直接编辑它。
|
|
74
|
+
*/
|
|
75
|
+
export declare function removePreset(name: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* 把用户写的模式词翻成模式名:先按别名表,再按显示名(label)精确匹配。
|
|
78
|
+
* 认不出来返回 null(让调用方报可用清单)。
|
|
79
|
+
*/
|
|
80
|
+
export declare function parsePresetToken(token: string, presets?: readonly Preset[]): string | null;
|