p-spore 0.1.4 → 0.1.42
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 +110 -15
- package/dist/agents/agent-manager.d.ts +3 -3
- package/dist/agents/agent-manager.d.ts.map +1 -1
- package/dist/agents/agent-manager.js +3 -2
- package/dist/agents/agent-manager.js.map +1 -1
- package/dist/application/agent-application.d.ts +29 -5
- package/dist/application/agent-application.d.ts.map +1 -1
- package/dist/application/agent-application.js +444 -14
- package/dist/application/agent-application.js.map +1 -1
- package/dist/articles/diff.d.ts +70 -0
- package/dist/articles/diff.d.ts.map +1 -0
- package/dist/articles/diff.js +330 -0
- package/dist/articles/diff.js.map +1 -0
- package/dist/articles/docx.d.ts +10 -0
- package/dist/articles/docx.d.ts.map +1 -0
- package/dist/articles/docx.js +219 -0
- package/dist/articles/docx.js.map +1 -0
- package/dist/articles/draft.d.ts +18 -0
- package/dist/articles/draft.d.ts.map +1 -0
- package/dist/articles/draft.js +88 -0
- package/dist/articles/draft.js.map +1 -0
- package/dist/articles/edits.d.ts +24 -0
- package/dist/articles/edits.d.ts.map +1 -0
- package/dist/articles/edits.js +54 -0
- package/dist/articles/edits.js.map +1 -0
- package/dist/articles/html.d.ts +10 -0
- package/dist/articles/html.d.ts.map +1 -0
- package/dist/articles/html.js +122 -0
- package/dist/articles/html.js.map +1 -0
- package/dist/articles/plain.d.ts +8 -0
- package/dist/articles/plain.d.ts.map +1 -0
- package/dist/articles/plain.js +69 -0
- package/dist/articles/plain.js.map +1 -0
- package/dist/articles/preview.d.ts +43 -0
- package/dist/articles/preview.d.ts.map +1 -0
- package/dist/articles/preview.js +90 -0
- package/dist/articles/preview.js.map +1 -0
- package/dist/articles/publish.d.ts +10 -0
- package/dist/articles/publish.d.ts.map +1 -0
- package/dist/articles/publish.js +54 -0
- package/dist/articles/publish.js.map +1 -0
- package/dist/articles/receipt.d.ts +16 -0
- package/dist/articles/receipt.d.ts.map +1 -0
- package/dist/articles/receipt.js +27 -0
- package/dist/articles/receipt.js.map +1 -0
- package/dist/articles/store.d.ts +78 -0
- package/dist/articles/store.d.ts.map +1 -0
- package/dist/articles/store.js +308 -0
- package/dist/articles/store.js.map +1 -0
- package/dist/articles/tool.d.ts +14 -0
- package/dist/articles/tool.d.ts.map +1 -0
- package/dist/articles/tool.js +175 -0
- package/dist/articles/tool.js.map +1 -0
- package/dist/articles/writer-context.d.ts +5 -0
- package/dist/articles/writer-context.d.ts.map +1 -0
- package/dist/articles/writer-context.js +56 -0
- package/dist/articles/writer-context.js.map +1 -0
- package/dist/articles/writer.d.ts +18 -0
- package/dist/articles/writer.d.ts.map +1 -0
- package/dist/articles/writer.js +79 -0
- package/dist/articles/writer.js.map +1 -0
- package/dist/articles/zip-write.d.ts +11 -0
- package/dist/articles/zip-write.d.ts.map +1 -0
- package/dist/articles/zip-write.js +63 -0
- package/dist/articles/zip-write.js.map +1 -0
- package/dist/bundled-skills/README.md +17 -0
- package/dist/bundled-skills/aegis-search/SKILL.md +59 -0
- package/dist/bundled-skills/aegis-search/bin/.gitkeep +0 -0
- package/dist/bundled-skills/article-canvas/SKILL.md +28 -0
- package/dist/bundled-skills/binaries.json +23 -0
- package/dist/bundled-skills/doc-extract/SKILL.md +56 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +407 -54
- package/dist/cli/main.js.map +1 -1
- package/dist/config/config.d.ts +43 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +150 -6
- package/dist/config/config.js.map +1 -1
- package/dist/daemon/daemon.d.ts.map +1 -1
- package/dist/daemon/daemon.js +80 -11
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/desktop/application.d.ts +4 -0
- package/dist/desktop/application.d.ts.map +1 -0
- package/dist/desktop/application.js +1688 -0
- package/dist/desktop/application.js.map +1 -0
- package/dist/desktop/article-export.d.ts +12 -0
- package/dist/desktop/article-export.d.ts.map +1 -0
- package/dist/desktop/article-export.js +87 -0
- package/dist/desktop/article-export.js.map +1 -0
- package/dist/desktop/assets/pspore.png +0 -0
- package/dist/desktop/assets/pspore.svg +24 -0
- package/dist/desktop/conversation-smoke.d.ts +5 -0
- package/dist/desktop/conversation-smoke.d.ts.map +1 -0
- package/dist/desktop/conversation-smoke.js +93 -0
- package/dist/desktop/conversation-smoke.js.map +1 -0
- package/dist/desktop/daemon-bridge.d.ts.map +1 -1
- package/dist/desktop/daemon-bridge.js +62 -17
- package/dist/desktop/daemon-bridge.js.map +1 -1
- package/dist/desktop/ipc-contract.d.ts +124 -0
- package/dist/desktop/ipc-contract.d.ts.map +1 -1
- package/dist/desktop/ipc-contract.js +191 -12
- package/dist/desktop/ipc-contract.js.map +1 -1
- package/dist/desktop/local-path.d.ts +15 -0
- package/dist/desktop/local-path.d.ts.map +1 -0
- package/dist/desktop/local-path.js +59 -0
- package/dist/desktop/local-path.js.map +1 -0
- package/dist/desktop/main.d.ts +10 -1
- package/dist/desktop/main.d.ts.map +1 -1
- package/dist/desktop/main.js +122 -530
- package/dist/desktop/main.js.map +1 -1
- package/dist/desktop/native-startup.d.ts +4 -0
- package/dist/desktop/native-startup.d.ts.map +1 -0
- package/dist/desktop/native-startup.js +57 -0
- package/dist/desktop/native-startup.js.map +1 -0
- package/dist/desktop/preload.cjs +28 -1
- package/dist/desktop/renderer/article-panel.d.ts +45 -0
- package/dist/desktop/renderer/article-panel.d.ts.map +1 -0
- package/dist/desktop/renderer/article-panel.js +1126 -0
- package/dist/desktop/renderer/article-panel.js.map +1 -0
- package/dist/desktop/renderer/article-split.d.ts +32 -0
- package/dist/desktop/renderer/article-split.d.ts.map +1 -0
- package/dist/desktop/renderer/article-split.js +48 -0
- package/dist/desktop/renderer/article-split.js.map +1 -0
- package/dist/desktop/renderer/composer-file-references.d.ts +23 -0
- package/dist/desktop/renderer/composer-file-references.d.ts.map +1 -0
- package/dist/desktop/renderer/composer-file-references.js +51 -0
- package/dist/desktop/renderer/composer-file-references.js.map +1 -0
- package/dist/desktop/renderer/conversation.d.ts +23 -0
- package/dist/desktop/renderer/conversation.d.ts.map +1 -0
- package/dist/desktop/renderer/conversation.js +66 -0
- package/dist/desktop/renderer/conversation.js.map +1 -0
- package/dist/desktop/renderer/dom-reconcile.d.ts +15 -0
- package/dist/desktop/renderer/dom-reconcile.d.ts.map +1 -0
- package/dist/desktop/renderer/dom-reconcile.js +33 -0
- package/dist/desktop/renderer/dom-reconcile.js.map +1 -0
- package/dist/desktop/renderer/index.html +211 -34
- package/dist/desktop/renderer/indexing-view.d.ts +22 -0
- package/dist/desktop/renderer/indexing-view.d.ts.map +1 -0
- package/dist/desktop/renderer/indexing-view.js +115 -0
- package/dist/desktop/renderer/indexing-view.js.map +1 -0
- package/dist/desktop/renderer/markdown-view.d.ts +23 -0
- package/dist/desktop/renderer/markdown-view.d.ts.map +1 -0
- package/dist/desktop/renderer/markdown-view.js +436 -0
- package/dist/desktop/renderer/markdown-view.js.map +1 -0
- package/dist/desktop/renderer/motion.d.ts +67 -0
- package/dist/desktop/renderer/motion.d.ts.map +1 -0
- package/dist/desktop/renderer/motion.js +296 -0
- package/dist/desktop/renderer/motion.js.map +1 -0
- package/dist/desktop/renderer/renderer.js +1788 -151
- package/dist/desktop/renderer/renderer.js.map +1 -1
- package/dist/desktop/renderer/session-find.d.ts +18 -0
- package/dist/desktop/renderer/session-find.d.ts.map +1 -0
- package/dist/desktop/renderer/session-find.js +29 -0
- package/dist/desktop/renderer/session-find.js.map +1 -0
- package/dist/desktop/renderer/session-search.d.ts +30 -0
- package/dist/desktop/renderer/session-search.d.ts.map +1 -0
- package/dist/desktop/renderer/session-search.js +296 -0
- package/dist/desktop/renderer/session-search.js.map +1 -0
- package/dist/desktop/renderer/store.d.ts +33 -0
- package/dist/desktop/renderer/store.d.ts.map +1 -1
- package/dist/desktop/renderer/store.js +92 -19
- package/dist/desktop/renderer/store.js.map +1 -1
- package/dist/desktop/renderer/styles.css +910 -268
- package/dist/desktop/renderer/vendor/gsap.min.js +11 -0
- package/dist/desktop/renderer-diagnostics.d.ts +5 -0
- package/dist/desktop/renderer-diagnostics.d.ts.map +1 -0
- package/dist/desktop/renderer-diagnostics.js +47 -0
- package/dist/desktop/renderer-diagnostics.js.map +1 -0
- package/dist/desktop/security.d.ts +26 -1
- package/dist/desktop/security.d.ts.map +1 -1
- package/dist/desktop/security.js +26 -6
- package/dist/desktop/security.js.map +1 -1
- package/dist/desktop/smoke-fixture.d.ts.map +1 -1
- package/dist/desktop/smoke-fixture.js +77 -3
- package/dist/desktop/smoke-fixture.js.map +1 -1
- package/dist/desktop/splash/index.html +25 -0
- package/dist/desktop/splash/splash.d.ts +2 -0
- package/dist/desktop/splash/splash.d.ts.map +1 -0
- package/dist/desktop/splash/splash.js +8 -0
- package/dist/desktop/splash/splash.js.map +1 -0
- package/dist/desktop/splash/styles.css +24 -0
- package/dist/desktop/system-open.d.ts +16 -0
- package/dist/desktop/system-open.d.ts.map +1 -0
- package/dist/desktop/system-open.js +90 -0
- package/dist/desktop/system-open.js.map +1 -0
- package/dist/desktop/validation.d.ts.map +1 -1
- package/dist/desktop/validation.js +99 -21
- package/dist/desktop/validation.js.map +1 -1
- package/dist/desktop/window-security.d.ts +4 -0
- package/dist/desktop/window-security.d.ts.map +1 -0
- package/dist/desktop/window-security.js +26 -0
- package/dist/desktop/window-security.js.map +1 -0
- package/dist/documents/errors.d.ts +12 -0
- package/dist/documents/errors.d.ts.map +1 -0
- package/dist/documents/errors.js +12 -0
- package/dist/documents/errors.js.map +1 -0
- package/dist/documents/extract.d.ts +37 -0
- package/dist/documents/extract.d.ts.map +1 -0
- package/dist/documents/extract.js +90 -0
- package/dist/documents/extract.js.map +1 -0
- package/dist/documents/legacy-office.d.ts +23 -0
- package/dist/documents/legacy-office.d.ts.map +1 -0
- package/dist/documents/legacy-office.js +439 -0
- package/dist/documents/legacy-office.js.map +1 -0
- package/dist/documents/ole.d.ts +20 -0
- package/dist/documents/ole.d.ts.map +1 -0
- package/dist/documents/ole.js +189 -0
- package/dist/documents/ole.js.map +1 -0
- package/dist/documents/ooxml.d.ts +23 -0
- package/dist/documents/ooxml.d.ts.map +1 -0
- package/dist/documents/ooxml.js +197 -0
- package/dist/documents/ooxml.js.map +1 -0
- package/dist/documents/pdf.d.ts +20 -0
- package/dist/documents/pdf.d.ts.map +1 -0
- package/dist/documents/pdf.js +95 -0
- package/dist/documents/pdf.js.map +1 -0
- package/dist/documents/plain-text.d.ts +22 -0
- package/dist/documents/plain-text.d.ts.map +1 -0
- package/dist/documents/plain-text.js +57 -0
- package/dist/documents/plain-text.js.map +1 -0
- package/dist/documents/zip.d.ts +15 -0
- package/dist/documents/zip.d.ts.map +1 -0
- package/dist/documents/zip.js +137 -0
- package/dist/documents/zip.js.map +1 -0
- package/dist/domain/indexing.d.ts +60 -0
- package/dist/domain/indexing.d.ts.map +1 -0
- package/dist/domain/indexing.js +13 -0
- package/dist/domain/indexing.js.map +1 -0
- package/dist/domain/runtime.d.ts +133 -5
- package/dist/domain/runtime.d.ts.map +1 -1
- package/dist/gateway/local-gateway.d.ts +8 -0
- package/dist/gateway/local-gateway.d.ts.map +1 -1
- package/dist/gateway/local-gateway.js +105 -21
- package/dist/gateway/local-gateway.js.map +1 -1
- package/dist/indexing/index-service.d.ts +56 -0
- package/dist/indexing/index-service.d.ts.map +1 -0
- package/dist/indexing/index-service.js +262 -0
- package/dist/indexing/index-service.js.map +1 -0
- package/dist/kernel/loop.d.ts +10 -0
- package/dist/kernel/loop.d.ts.map +1 -1
- package/dist/kernel/loop.js +6 -2
- package/dist/kernel/loop.js.map +1 -1
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +17 -1
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/kernel/state.d.ts +17 -4
- package/dist/kernel/state.d.ts.map +1 -1
- package/dist/kernel/state.js +2 -0
- package/dist/kernel/state.js.map +1 -1
- package/dist/pi/context-budget.d.ts +8 -0
- package/dist/pi/context-budget.d.ts.map +1 -0
- package/dist/pi/context-budget.js +62 -0
- package/dist/pi/context-budget.js.map +1 -0
- package/dist/pi/pi-runtime-adapter.d.ts +38 -3
- package/dist/pi/pi-runtime-adapter.d.ts.map +1 -1
- package/dist/pi/pi-runtime-adapter.js +551 -56
- package/dist/pi/pi-runtime-adapter.js.map +1 -1
- package/dist/plugins/bundled-skills.d.ts +56 -0
- package/dist/plugins/bundled-skills.d.ts.map +1 -0
- package/dist/plugins/bundled-skills.js +243 -0
- package/dist/plugins/bundled-skills.js.map +1 -0
- package/dist/plugins/extension-manager.d.ts +23 -1
- package/dist/plugins/extension-manager.d.ts.map +1 -1
- package/dist/plugins/extension-manager.js +117 -0
- package/dist/plugins/extension-manager.js.map +1 -1
- package/dist/plugins/types.d.ts +29 -0
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/workspace-skills.d.ts +36 -0
- package/dist/plugins/workspace-skills.d.ts.map +1 -0
- package/dist/plugins/workspace-skills.js +309 -0
- package/dist/plugins/workspace-skills.js.map +1 -0
- package/dist/policy/policy.d.ts.map +1 -1
- package/dist/policy/policy.js +22 -3
- package/dist/policy/policy.js.map +1 -1
- package/dist/protocol/client.d.ts +1 -0
- package/dist/protocol/client.d.ts.map +1 -1
- package/dist/protocol/client.js +49 -24
- package/dist/protocol/client.js.map +1 -1
- package/dist/protocol/limits.d.ts +69 -0
- package/dist/protocol/limits.d.ts.map +1 -0
- package/dist/protocol/limits.js +166 -0
- package/dist/protocol/limits.js.map +1 -0
- package/dist/protocol/schema.d.ts +6 -0
- package/dist/protocol/schema.d.ts.map +1 -1
- package/dist/protocol/schema.js.map +1 -1
- package/dist/protocol/server-frame-codec.d.ts +18 -0
- package/dist/protocol/server-frame-codec.d.ts.map +1 -0
- package/dist/protocol/server-frame-codec.js +211 -0
- package/dist/protocol/server-frame-codec.js.map +1 -0
- package/dist/service/legacy-daemon.d.ts +6 -0
- package/dist/service/legacy-daemon.d.ts.map +1 -0
- package/dist/service/legacy-daemon.js +42 -0
- package/dist/service/legacy-daemon.js.map +1 -0
- package/dist/service/service-launch.d.ts +10 -0
- package/dist/service/service-launch.d.ts.map +1 -0
- package/dist/service/service-launch.js +56 -0
- package/dist/service/service-launch.js.map +1 -0
- package/dist/service/system-service.d.ts +57 -0
- package/dist/service/system-service.d.ts.map +1 -0
- package/dist/service/system-service.js +263 -0
- package/dist/service/system-service.js.map +1 -0
- package/dist/sessions/session-catalog.d.ts +45 -0
- package/dist/sessions/session-catalog.d.ts.map +1 -0
- package/dist/sessions/session-catalog.js +270 -0
- package/dist/sessions/session-catalog.js.map +1 -0
- package/dist/sessions/session-file.d.ts +12 -0
- package/dist/sessions/session-file.d.ts.map +1 -0
- package/dist/sessions/session-file.js +47 -0
- package/dist/sessions/session-file.js.map +1 -0
- package/dist/settings/compaction-settings.d.ts +10 -0
- package/dist/settings/compaction-settings.d.ts.map +1 -0
- package/dist/settings/compaction-settings.js +8 -0
- package/dist/settings/compaction-settings.js.map +1 -0
- package/dist/settings/indexing-settings-service.d.ts +16 -0
- package/dist/settings/indexing-settings-service.d.ts.map +1 -0
- package/dist/settings/indexing-settings-service.js +57 -0
- package/dist/settings/indexing-settings-service.js.map +1 -0
- package/dist/settings/indexing-settings.d.ts +30 -0
- package/dist/settings/indexing-settings.d.ts.map +1 -0
- package/dist/settings/indexing-settings.js +58 -0
- package/dist/settings/indexing-settings.js.map +1 -0
- package/dist/settings/llm-settings-service.d.ts +6 -0
- package/dist/settings/llm-settings-service.d.ts.map +1 -1
- package/dist/settings/llm-settings-service.js +137 -12
- package/dist/settings/llm-settings-service.js.map +1 -1
- package/dist/settings/llm-settings.d.ts +68 -2
- package/dist/settings/llm-settings.d.ts.map +1 -1
- package/dist/settings/llm-settings.js +119 -17
- package/dist/settings/llm-settings.js.map +1 -1
- package/dist/settings/model-api.d.ts +10 -0
- package/dist/settings/model-api.d.ts.map +1 -0
- package/dist/settings/model-api.js +10 -0
- package/dist/settings/model-api.js.map +1 -0
- package/dist/storage/home.d.ts +1 -0
- package/dist/storage/home.d.ts.map +1 -1
- package/dist/storage/home.js +37 -2
- package/dist/storage/home.js.map +1 -1
- package/dist/tools/core-tools.d.ts +2 -0
- package/dist/tools/core-tools.d.ts.map +1 -1
- package/dist/tools/core-tools.js +91 -1
- package/dist/tools/core-tools.js.map +1 -1
- package/dist/ui/shared/activity.d.ts +2 -0
- package/dist/ui/shared/activity.d.ts.map +1 -1
- package/dist/ui/shared/activity.js +18 -4
- package/dist/ui/shared/activity.js.map +1 -1
- package/dist/ui/shared/full-message.d.ts +22 -0
- package/dist/ui/shared/full-message.d.ts.map +1 -0
- package/dist/ui/shared/full-message.js +40 -0
- package/dist/ui/shared/full-message.js.map +1 -0
- package/dist/ui/shared/local-links.d.ts +7 -0
- package/dist/ui/shared/local-links.d.ts.map +1 -0
- package/dist/ui/shared/local-links.js +24 -0
- package/dist/ui/shared/local-links.js.map +1 -0
- package/dist/ui/shared/markdown-stream.d.ts +25 -0
- package/dist/ui/shared/markdown-stream.d.ts.map +1 -0
- package/dist/ui/shared/markdown-stream.js +35 -0
- package/dist/ui/shared/markdown-stream.js.map +1 -0
- package/dist/ui/shared/markdown.d.ts +70 -0
- package/dist/ui/shared/markdown.d.ts.map +1 -0
- package/dist/ui/shared/markdown.js +434 -0
- package/dist/ui/shared/markdown.js.map +1 -0
- package/dist/ui/shared/presentation.d.ts +10 -2
- package/dist/ui/shared/presentation.d.ts.map +1 -1
- package/dist/ui/shared/presentation.js +83 -22
- package/dist/ui/shared/presentation.js.map +1 -1
- package/dist/ui/shared/protocol-state.d.ts +19 -0
- package/dist/ui/shared/protocol-state.d.ts.map +1 -1
- package/dist/ui/shared/protocol-state.js +188 -26
- package/dist/ui/shared/protocol-state.js.map +1 -1
- package/dist/ui/shared/virtual-list.d.ts +34 -0
- package/dist/ui/shared/virtual-list.d.ts.map +1 -0
- package/dist/ui/shared/virtual-list.js +143 -0
- package/dist/ui/shared/virtual-list.js.map +1 -0
- package/dist/ui/tui/commands.d.ts +1 -1
- package/dist/ui/tui/commands.d.ts.map +1 -1
- package/dist/ui/tui/commands.js +8 -3
- package/dist/ui/tui/commands.js.map +1 -1
- package/dist/ui/tui/store.d.ts +22 -1
- package/dist/ui/tui/store.d.ts.map +1 -1
- package/dist/ui/tui/store.js +50 -3
- package/dist/ui/tui/store.js.map +1 -1
- package/dist/ui/tui/tui-app.d.ts.map +1 -1
- package/dist/ui/tui/tui-app.js +231 -31
- package/dist/ui/tui/tui-app.js.map +1 -1
- package/dist/ui/tui/view.d.ts +7 -0
- package/dist/ui/tui/view.d.ts.map +1 -1
- package/dist/ui/tui/view.js +161 -57
- package/dist/ui/tui/view.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +13 -2
package/dist/ui/tui/tui-app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { ProcessTerminal, TuiAltScreen } from "@earendil-works/pi-tui";
|
|
3
3
|
import { ProtocolClient } from "../../protocol/client.js";
|
|
4
|
-
import { decodeLlmSettingsUpdate, defaultModelFor, MODEL_APIS, PROVIDER_OPTIONS, THINKING_LEVELS, } from "../../settings/llm-settings.js";
|
|
4
|
+
import { BYPASS_PERMISSION_MODE, decodeLlmSettingsUpdate, defaultModelFor, MODEL_APIS, PERMISSION_MODES, permissionModeSummary, PROVIDER_OPTIONS, THINKING_LEVELS, } from "../../settings/llm-settings.js";
|
|
5
5
|
import { TuiStore } from "./store.js";
|
|
6
6
|
import { TUI_HELP_LINES } from "./commands.js";
|
|
7
7
|
import { PsporeTuiView } from "./view.js";
|
|
@@ -11,8 +11,8 @@ export const MODEL_SETUP_OFFER_PROMPT = "Run the model setup wizard now? [Y/n]";
|
|
|
11
11
|
export const MODEL_SETUP_OFFER_LINES = [
|
|
12
12
|
"No model is configured yet, so prompts would fail with model_not_configured.",
|
|
13
13
|
"",
|
|
14
|
-
"The wizard walks through provider, model, thinking
|
|
15
|
-
"The key
|
|
14
|
+
"The wizard walks through provider, model, thinking, API key and optional proxy cookie.",
|
|
15
|
+
"The key and cookie are stored in private 0600 files and are never shown in the TUI.",
|
|
16
16
|
"",
|
|
17
17
|
"Answer n to skip; you can run /config wizard at any time.",
|
|
18
18
|
];
|
|
@@ -23,6 +23,8 @@ export function acceptsModelSetupOffer(answer) {
|
|
|
23
23
|
const normalized = answer.trim().toLowerCase();
|
|
24
24
|
return normalized === "" || normalized === "y" || normalized === "yes";
|
|
25
25
|
}
|
|
26
|
+
/** How many older messages one scrollback request asks for. */
|
|
27
|
+
const HISTORY_PAGE_SIZE = 200;
|
|
26
28
|
export class PsporeTuiApp {
|
|
27
29
|
#options;
|
|
28
30
|
#store = new TuiStore();
|
|
@@ -32,8 +34,10 @@ export class PsporeTuiApp {
|
|
|
32
34
|
#client;
|
|
33
35
|
#stopping = false;
|
|
34
36
|
#retryTimer;
|
|
37
|
+
#settleTimer;
|
|
35
38
|
#retryMs = 250;
|
|
36
39
|
#lastInterruptAt = 0;
|
|
40
|
+
#loadingHistory = false;
|
|
37
41
|
#resolveExit;
|
|
38
42
|
#view;
|
|
39
43
|
constructor(options) {
|
|
@@ -48,6 +52,7 @@ export class PsporeTuiApp {
|
|
|
48
52
|
onSubmit: (input) => void this.#submit(input),
|
|
49
53
|
onInterrupt: () => void this.#interrupt(),
|
|
50
54
|
onBack: () => this.#store.clearPanel(),
|
|
55
|
+
onScrollBack: () => void this.#loadOlderHistory(),
|
|
51
56
|
});
|
|
52
57
|
this.#view = view;
|
|
53
58
|
this.#tui.setLayoutRoot(view);
|
|
@@ -65,6 +70,8 @@ export class PsporeTuiApp {
|
|
|
65
70
|
this.#stopping = true;
|
|
66
71
|
if (this.#retryTimer)
|
|
67
72
|
clearTimeout(this.#retryTimer);
|
|
73
|
+
if (this.#settleTimer)
|
|
74
|
+
clearTimeout(this.#settleTimer);
|
|
68
75
|
await this.#client?.close().catch(() => undefined);
|
|
69
76
|
this.#view?.dispose();
|
|
70
77
|
this.#tui.stop();
|
|
@@ -93,6 +100,7 @@ export class PsporeTuiApp {
|
|
|
93
100
|
if (connected)
|
|
94
101
|
return;
|
|
95
102
|
this.#store.disconnected(error?.message ?? "Disconnected");
|
|
103
|
+
this.#scheduleSettle();
|
|
96
104
|
this.#tui.requestRender();
|
|
97
105
|
this.#scheduleReconnect();
|
|
98
106
|
});
|
|
@@ -108,10 +116,50 @@ export class PsporeTuiApp {
|
|
|
108
116
|
}
|
|
109
117
|
catch (error) {
|
|
110
118
|
this.#store.disconnected(`Daemon unavailable: ${toError(error).message}`);
|
|
119
|
+
this.#scheduleSettle();
|
|
111
120
|
this.#tui.requestRender();
|
|
112
121
|
this.#scheduleReconnect();
|
|
113
122
|
}
|
|
114
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Fetches the page of history before the oldest message this client holds.
|
|
126
|
+
* The daemon broadcasts only a bounded tail, so scrollback is a request.
|
|
127
|
+
*/
|
|
128
|
+
async #loadOlderHistory() {
|
|
129
|
+
if (this.#loadingHistory)
|
|
130
|
+
return;
|
|
131
|
+
const state = this.#store.snapshot();
|
|
132
|
+
const sessionId = state.selectedSessionId;
|
|
133
|
+
const session = state.kernel.sessions[sessionId];
|
|
134
|
+
if (!session || session.messageOffset === 0)
|
|
135
|
+
return;
|
|
136
|
+
const from = Math.max(0, session.messageOffset - HISTORY_PAGE_SIZE);
|
|
137
|
+
this.#loadingHistory = true;
|
|
138
|
+
try {
|
|
139
|
+
const page = await this.#command("session.transcript", { from, limit: session.messageOffset - from }, sessionId);
|
|
140
|
+
if (this.#store.applyTranscriptPage(page))
|
|
141
|
+
this.#tui.requestRender();
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
this.#store.setNotice(`Could not load older history: ${toError(error).message}`);
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
this.#loadingHistory = false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Surfaces a genuine outage once the store's masking window expires. */
|
|
151
|
+
#scheduleSettle() {
|
|
152
|
+
if (this.#stopping || this.#settleTimer)
|
|
153
|
+
return;
|
|
154
|
+
this.#settleTimer = setTimeout(() => {
|
|
155
|
+
this.#settleTimer = undefined;
|
|
156
|
+
if (this.#store.settleConnection())
|
|
157
|
+
this.#tui.requestRender();
|
|
158
|
+
else if (this.#store.snapshot().reconnecting)
|
|
159
|
+
this.#scheduleSettle();
|
|
160
|
+
}, 250);
|
|
161
|
+
this.#settleTimer.unref();
|
|
162
|
+
}
|
|
115
163
|
#scheduleReconnect() {
|
|
116
164
|
if (this.#stopping || this.#retryTimer)
|
|
117
165
|
return;
|
|
@@ -145,22 +193,54 @@ export class PsporeTuiApp {
|
|
|
145
193
|
await this.#config(input);
|
|
146
194
|
return;
|
|
147
195
|
}
|
|
196
|
+
if (input === "/new" || input.startsWith("/new ")) {
|
|
197
|
+
const title = input.slice(4).trim();
|
|
198
|
+
const session = await this.#command("session.create", title ? { title } : {});
|
|
199
|
+
this.#store.selectSession(session.sessionId);
|
|
200
|
+
this.#store.setNotice(`New session ${session.sessionId}`);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (input === "/delete" || input.startsWith("/delete ")) {
|
|
204
|
+
const requested = input.slice(7).trim();
|
|
205
|
+
const sessionId = requested || this.#store.snapshot().selectedSessionId;
|
|
206
|
+
if (this.#selectedAgent() && !requested) {
|
|
207
|
+
throw new Error("Only a root session can be deleted; use /agent-cancel for a child agent");
|
|
208
|
+
}
|
|
209
|
+
// Deleting also removes the transcript, so the id is echoed back rather
|
|
210
|
+
// than silently acting on whatever happened to be selected.
|
|
211
|
+
const deleted = await this.#command("session.delete", {}, sessionId);
|
|
212
|
+
this.#store.setNotice(`Deleted session ${deleted.sessionId}${deleted.title ? ` (${deleted.title})` : ""}`
|
|
213
|
+
+ `${deleted.transcriptRemoved ? " and its transcript" : ""}`);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
148
216
|
if (input === "/abort") {
|
|
217
|
+
const selectedSessionId = this.#store.snapshot().selectedSessionId;
|
|
149
218
|
const child = this.#selectedAgent();
|
|
150
219
|
if (child)
|
|
151
220
|
await this.#command("agent.cancel", { agentId: child.id, reason: "cancelled from TUI" });
|
|
152
221
|
else
|
|
153
|
-
await this.#command("session.abort", { reason: "TUI user requested abort" },
|
|
222
|
+
await this.#command("session.abort", { reason: "TUI user requested abort" }, selectedSessionId);
|
|
154
223
|
this.#store.setNotice(child ? `Agent ${child.id} cancelled` : "Abort requested");
|
|
155
224
|
return;
|
|
156
225
|
}
|
|
157
226
|
if (input === "/compact") {
|
|
158
227
|
if (this.#selectedAgent())
|
|
159
|
-
throw new Error("Compaction is available only for
|
|
160
|
-
await this.#command("session.compact", {},
|
|
228
|
+
throw new Error("Compaction is available only for a root session");
|
|
229
|
+
await this.#command("session.compact", {}, this.#store.snapshot().selectedSessionId);
|
|
161
230
|
this.#store.setNotice("Compaction requested");
|
|
162
231
|
return;
|
|
163
232
|
}
|
|
233
|
+
if (input.startsWith("/send-now ")) {
|
|
234
|
+
if (this.#selectedAgent())
|
|
235
|
+
throw new Error("Queued root-session messages are unavailable for a child agent");
|
|
236
|
+
const displayIndex = Number(input.slice(10).trim());
|
|
237
|
+
if (!Number.isSafeInteger(displayIndex) || displayIndex < 1)
|
|
238
|
+
throw new Error("Usage: /send-now QUEUE_NUMBER");
|
|
239
|
+
const sessionId = this.#store.snapshot().selectedSessionId;
|
|
240
|
+
await this.#command("session.queue.send-now", { index: displayIndex - 1 }, sessionId);
|
|
241
|
+
this.#store.setNotice("直接发送消息");
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
164
244
|
if (input === "/jobs") {
|
|
165
245
|
const jobs = await this.#command("jobs.list", {});
|
|
166
246
|
this.#store.setPanel("Automation jobs", jobs.map((job) => (`• ${job.id} · ${job.enabled ? "enabled" : "disabled"}${job.schedule?.cron ? ` · ${job.schedule.cron} ${job.schedule.timezone ?? ""}` : ""}`)));
|
|
@@ -211,10 +291,18 @@ export class PsporeTuiApp {
|
|
|
211
291
|
]);
|
|
212
292
|
return;
|
|
213
293
|
}
|
|
214
|
-
if (input === "/
|
|
215
|
-
const
|
|
294
|
+
if (input === "/skills") {
|
|
295
|
+
const skills = await this.#command("skills.catalog", {});
|
|
296
|
+
this.#store.setPanel("Skills", skills.length === 0 ? ["No skills found"] : skills.flatMap((skill) => [
|
|
297
|
+
`• ${skill.name} · ${skill.source} · ${skill.status}`,
|
|
298
|
+
...(skill.message ? [` ${skill.message}`] : []),
|
|
299
|
+
]));
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (input === "/resources" || input === "/plugins") {
|
|
303
|
+
const command = input === "/plugins" ? "plugins.list" : "resources.list";
|
|
216
304
|
const resources = await this.#command(command, {});
|
|
217
|
-
this.#store.setPanel(input === "/
|
|
305
|
+
this.#store.setPanel(input === "/plugins" ? "Host plugins" : "Trusted resources", resources.map((resource) => (`• ${resource.record.kind} · ${resource.record.name} · ${resource.health.status}`)));
|
|
218
306
|
return;
|
|
219
307
|
}
|
|
220
308
|
if (input.startsWith("/resource-inspect ")) {
|
|
@@ -259,8 +347,10 @@ export class PsporeTuiApp {
|
|
|
259
347
|
const objective = input.slice(13).trim();
|
|
260
348
|
if (!objective)
|
|
261
349
|
throw new Error("Usage: /agent-spawn OBJECTIVE");
|
|
350
|
+
const snapshot = this.#store.snapshot();
|
|
351
|
+
const parentId = selectedAgent(snapshot.kernel, snapshot.selectedSessionId)?.rootId ?? snapshot.selectedSessionId;
|
|
262
352
|
const agent = await this.#command("agent.spawn", {
|
|
263
|
-
parentId
|
|
353
|
+
parentId,
|
|
264
354
|
objective,
|
|
265
355
|
workspaceMode: "shared-read",
|
|
266
356
|
budget: {
|
|
@@ -321,13 +411,7 @@ export class PsporeTuiApp {
|
|
|
321
411
|
await this.#approval(input);
|
|
322
412
|
return;
|
|
323
413
|
}
|
|
324
|
-
|
|
325
|
-
const main = this.#store.snapshot().kernel.sessions["main"];
|
|
326
|
-
if (!child && main?.status === "running") {
|
|
327
|
-
this.#store.setNotice("Session is running; use /steer TEXT or /follow TEXT explicitly");
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
await this.#prompt(input, "prompt");
|
|
414
|
+
await this.#prompt(input, "auto");
|
|
331
415
|
}
|
|
332
416
|
catch (error) {
|
|
333
417
|
this.#store.setNotice(`Error: ${toError(error).message}`);
|
|
@@ -349,7 +433,8 @@ export class PsporeTuiApp {
|
|
|
349
433
|
return;
|
|
350
434
|
}
|
|
351
435
|
await this.#command("session.prompt", { text: intent.text, mode: intent.mode }, intent.sessionId);
|
|
352
|
-
this.#store.
|
|
436
|
+
const queued = this.#store.snapshot().kernel.sessions[intent.sessionId]?.status === "running" && mode === "auto";
|
|
437
|
+
this.#store.setNotice(queued ? "继续排队" : `Message accepted for ${intent.sessionId}`);
|
|
353
438
|
}
|
|
354
439
|
async #approval(input) {
|
|
355
440
|
const parts = input.split(/\s+/);
|
|
@@ -453,6 +538,38 @@ export class PsporeTuiApp {
|
|
|
453
538
|
await this.#saveSettings(updateFrom(current, { thinking: parseThinking(parts[2]) }));
|
|
454
539
|
return;
|
|
455
540
|
}
|
|
541
|
+
if (action === "permissions") {
|
|
542
|
+
if (parts.length !== 3)
|
|
543
|
+
throw new Error(`Usage: /config permissions ${PERMISSION_MODES.join("|")}|bypass`);
|
|
544
|
+
const permissionMode = parsePermissionMode(parts[2]);
|
|
545
|
+
await this.#saveSettings(updateFrom(current, { permissionMode }));
|
|
546
|
+
if (permissionMode === BYPASS_PERMISSION_MODE) {
|
|
547
|
+
this.#store.setNotice("Permissions bypassed: tools now run with your own privileges and no confirmation");
|
|
548
|
+
}
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (action === "compact") {
|
|
552
|
+
if (parts.length < 3 || parts.length > 6) {
|
|
553
|
+
throw new Error("Usage: /config compact on|off [RESERVE_TOKENS] [KEEP_RECENT_TOKENS] [TRIGGER_TOKENS]");
|
|
554
|
+
}
|
|
555
|
+
const enabled = parseOnOff(parts[2], "/config compact");
|
|
556
|
+
const reserveTokens = parts[3] === undefined
|
|
557
|
+
? current.autoCompactionReserveTokens
|
|
558
|
+
: parseCompactionTokens(parts[3], "reserve tokens");
|
|
559
|
+
const keepRecentTokens = parts[4] === undefined
|
|
560
|
+
? current.autoCompactionKeepRecentTokens
|
|
561
|
+
: parseCompactionTokens(parts[4], "keep recent tokens");
|
|
562
|
+
const triggerTokens = parts[5] === undefined
|
|
563
|
+
? current.autoCompactionTriggerTokens
|
|
564
|
+
: parseCompactionTokens(parts[5], "trigger tokens");
|
|
565
|
+
await this.#saveSettings(updateFrom(current, {
|
|
566
|
+
autoCompactionEnabled: enabled,
|
|
567
|
+
autoCompactionTriggerTokens: triggerTokens,
|
|
568
|
+
autoCompactionReserveTokens: reserveTokens,
|
|
569
|
+
autoCompactionKeepRecentTokens: keepRecentTokens,
|
|
570
|
+
}));
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
456
573
|
if (action === "key") {
|
|
457
574
|
if (parts.length !== 2)
|
|
458
575
|
throw new Error("API keys are never accepted as command arguments; use /config key");
|
|
@@ -472,6 +589,25 @@ export class PsporeTuiApp {
|
|
|
472
589
|
await this.#saveSettings(updateFrom(current, { clearApiKey: true }));
|
|
473
590
|
return;
|
|
474
591
|
}
|
|
592
|
+
if (action === "cookie") {
|
|
593
|
+
if (parts.length !== 2)
|
|
594
|
+
throw new Error("Cookies are never accepted as command arguments; use /config cookie");
|
|
595
|
+
const cookie = await this.#view?.requestValue("Cookie (hidden; Esc cancels)", { secret: true });
|
|
596
|
+
if (cookie === undefined) {
|
|
597
|
+
this.#store.setNotice("Cookie update cancelled");
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (!cookie)
|
|
601
|
+
throw new Error("Cookie cannot be empty");
|
|
602
|
+
await this.#saveSettings(updateFrom(current, { cookie }));
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
if (action === "clear-cookie") {
|
|
606
|
+
if (parts.length !== 2)
|
|
607
|
+
throw new Error("Usage: /config clear-cookie");
|
|
608
|
+
await this.#saveSettings(updateFrom(current, { clearCookie: true }));
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
475
611
|
throw new Error("Unknown config action; use /config, /config wizard, or /help");
|
|
476
612
|
}
|
|
477
613
|
/**
|
|
@@ -517,7 +653,7 @@ export class PsporeTuiApp {
|
|
|
517
653
|
`2 OpenAI ${current.provider === "openai" ? "← current" : ""}`,
|
|
518
654
|
`3 Custom OpenAI ${current.provider === "custom-openai" ? "← current" : ""}`,
|
|
519
655
|
]);
|
|
520
|
-
const providerValue = await view.requestValue(`1/
|
|
656
|
+
const providerValue = await view.requestValue(`1/7 provider [${current.provider}] (1 deepseek · 2 openai · 3 custom)`);
|
|
521
657
|
if (providerValue === undefined)
|
|
522
658
|
return this.#cancelWizard();
|
|
523
659
|
const provider = providerValue.trim() ? parseProvider(providerValue) : current.provider;
|
|
@@ -527,7 +663,7 @@ export class PsporeTuiApp {
|
|
|
527
663
|
`Suggested ${suggestedModel}`,
|
|
528
664
|
"Press Enter to accept the suggestion, or type another model ID.",
|
|
529
665
|
]);
|
|
530
|
-
const modelValue = await view.requestValue(`2/
|
|
666
|
+
const modelValue = await view.requestValue(`2/7 model [${suggestedModel}]`);
|
|
531
667
|
if (modelValue === undefined)
|
|
532
668
|
return this.#cancelWizard();
|
|
533
669
|
const model = modelValue.trim() || suggestedModel;
|
|
@@ -539,13 +675,13 @@ export class PsporeTuiApp {
|
|
|
539
675
|
"The URL must use HTTP(S) and cannot contain credentials.",
|
|
540
676
|
"API compatibility can be Chat Completions or Responses.",
|
|
541
677
|
]);
|
|
542
|
-
const baseUrlValue = await view.requestValue(`3/
|
|
678
|
+
const baseUrlValue = await view.requestValue(`3/7 Base URL [${current.provider === provider ? current.baseUrl : "required"}]`);
|
|
543
679
|
if (baseUrlValue === undefined)
|
|
544
680
|
return this.#cancelWizard();
|
|
545
681
|
baseUrl = baseUrlValue.trim() || (current.provider === provider ? current.baseUrl : "");
|
|
546
682
|
if (!baseUrl)
|
|
547
683
|
throw new Error("A Base URL is required for custom OpenAI");
|
|
548
|
-
const apiValue = await view.requestValue("3/
|
|
684
|
+
const apiValue = await view.requestValue("3/7 API [chat] (chat · responses)");
|
|
549
685
|
if (apiValue === undefined)
|
|
550
686
|
return this.#cancelWizard();
|
|
551
687
|
api = parseOpenAiApi(apiValue.trim() || (current.provider === provider ? current.api : "chat"));
|
|
@@ -555,17 +691,18 @@ export class PsporeTuiApp {
|
|
|
555
691
|
`Options ${THINKING_LEVELS.join(" · ")}`,
|
|
556
692
|
"Higher effort can increase latency and token use when the provider supports it.",
|
|
557
693
|
]);
|
|
558
|
-
const thinkingValue = await view.requestValue(`4/
|
|
694
|
+
const thinkingValue = await view.requestValue(`4/7 thinking [${current.thinking}] (${THINKING_LEVELS.join(" · ")})`);
|
|
559
695
|
if (thinkingValue === undefined)
|
|
560
696
|
return this.#cancelWizard();
|
|
561
697
|
const thinking = parseThinking(thinkingValue.trim() || current.thinking);
|
|
562
698
|
this.#showWizardStep(5, "Manage the API key", [
|
|
563
699
|
`Status ${current.hasApiKey ? "configured (hidden)" : "not configured"}`,
|
|
700
|
+
`File ${current.apiKeyPath}`,
|
|
564
701
|
"keep Leave the managed key unchanged",
|
|
565
702
|
"set Enter a new key through hidden input",
|
|
566
703
|
"clear Remove the managed key",
|
|
567
704
|
]);
|
|
568
|
-
const keyActionValue = await view.requestValue(`5/
|
|
705
|
+
const keyActionValue = await view.requestValue(`5/7 key [keep] (keep · set · clear)`);
|
|
569
706
|
if (keyActionValue === undefined)
|
|
570
707
|
return this.#cancelWizard();
|
|
571
708
|
const keyAction = keyActionValue.trim().toLowerCase() || "keep";
|
|
@@ -574,23 +711,46 @@ export class PsporeTuiApp {
|
|
|
574
711
|
}
|
|
575
712
|
let apiKey;
|
|
576
713
|
if (keyAction === "set") {
|
|
577
|
-
apiKey = await view.requestValue("5/
|
|
714
|
+
apiKey = await view.requestValue("5/7 API key (hidden; Esc cancels)", { secret: true });
|
|
578
715
|
if (apiKey === undefined)
|
|
579
716
|
return this.#cancelWizard();
|
|
580
717
|
if (!apiKey)
|
|
581
718
|
throw new Error("API key cannot be empty");
|
|
582
719
|
}
|
|
583
|
-
this.#showWizardStep(6, "
|
|
720
|
+
this.#showWizardStep(6, "Optional LLM proxy cookie", [
|
|
721
|
+
`Status ${current.hasCookie ? "configured (hidden)" : "not configured"}`,
|
|
722
|
+
`File ${current.cookiePath}`,
|
|
723
|
+
"keep Leave the managed cookie unchanged",
|
|
724
|
+
"set Enter a Cookie header through hidden input",
|
|
725
|
+
"clear Remove the managed cookie",
|
|
726
|
+
]);
|
|
727
|
+
const cookieActionValue = await view.requestValue(`6/7 cookie [keep] (keep · set · clear)`);
|
|
728
|
+
if (cookieActionValue === undefined)
|
|
729
|
+
return this.#cancelWizard();
|
|
730
|
+
const cookieAction = cookieActionValue.trim().toLowerCase() || "keep";
|
|
731
|
+
if (!["keep", "set", "clear"].includes(cookieAction)) {
|
|
732
|
+
throw new Error("Cookie action must be keep, set, or clear");
|
|
733
|
+
}
|
|
734
|
+
let cookie;
|
|
735
|
+
if (cookieAction === "set") {
|
|
736
|
+
cookie = await view.requestValue("6/7 Cookie (hidden; Esc cancels)", { secret: true });
|
|
737
|
+
if (cookie === undefined)
|
|
738
|
+
return this.#cancelWizard();
|
|
739
|
+
if (!cookie)
|
|
740
|
+
throw new Error("Cookie cannot be empty");
|
|
741
|
+
}
|
|
742
|
+
this.#showWizardStep(7, "Review and apply", [
|
|
584
743
|
`Provider ${provider}`,
|
|
585
744
|
`Model ${model}`,
|
|
586
745
|
`Base URL ${baseUrl || "provider default"}`,
|
|
587
746
|
`API ${api}`,
|
|
588
747
|
`Thinking ${thinking}`,
|
|
589
748
|
`API key ${keyAction === "keep" ? current.hasApiKey ? "keep configured key" : "not configured" : keyAction}`,
|
|
749
|
+
`Cookie ${cookieAction === "keep" ? current.hasCookie ? "keep configured cookie" : "not configured" : cookieAction}`,
|
|
590
750
|
"",
|
|
591
|
-
"The key
|
|
751
|
+
"The key and cookie values are never displayed or stored in the TUI state.",
|
|
592
752
|
]);
|
|
593
|
-
const confirmation = await view.requestValue("
|
|
753
|
+
const confirmation = await view.requestValue("7/7 save and apply? [y/N]");
|
|
594
754
|
if (confirmation === undefined || !/^(y|yes)$/i.test(confirmation.trim()))
|
|
595
755
|
return this.#cancelWizard();
|
|
596
756
|
await this.#saveSettings(updateFrom(current, {
|
|
@@ -601,7 +761,9 @@ export class PsporeTuiApp {
|
|
|
601
761
|
thinking,
|
|
602
762
|
customModel: provider === "custom-openai",
|
|
603
763
|
...(apiKey ? { apiKey } : {}),
|
|
764
|
+
...(cookie ? { cookie } : {}),
|
|
604
765
|
clearApiKey: keyAction === "clear",
|
|
766
|
+
clearCookie: cookieAction === "clear",
|
|
605
767
|
}));
|
|
606
768
|
}
|
|
607
769
|
async #saveSettings(update) {
|
|
@@ -619,8 +781,8 @@ export class PsporeTuiApp {
|
|
|
619
781
|
this.#store.setNotice(message);
|
|
620
782
|
}
|
|
621
783
|
#showWizardStep(step, title, lines) {
|
|
622
|
-
const progress = Array.from({ length:
|
|
623
|
-
this.#store.setPanel(`Model setup · ${step}/
|
|
784
|
+
const progress = Array.from({ length: 7 }, (_, index) => index + 1 < step ? "●" : index + 1 === step ? "◉" : "○").join("─");
|
|
785
|
+
this.#store.setPanel(`Model setup · ${step}/7`, [
|
|
624
786
|
`${progress} ${title}`,
|
|
625
787
|
"",
|
|
626
788
|
...lines,
|
|
@@ -687,7 +849,8 @@ export class PsporeTuiApp {
|
|
|
687
849
|
return client.command(type, payload, sessionId === undefined ? {} : { sessionId });
|
|
688
850
|
}
|
|
689
851
|
async #interrupt() {
|
|
690
|
-
const
|
|
852
|
+
const snapshot = this.#store.snapshot();
|
|
853
|
+
const running = snapshot.kernel.sessions[snapshot.selectedSessionId]?.status === "running";
|
|
691
854
|
if (running) {
|
|
692
855
|
await this.#submit("/abort");
|
|
693
856
|
this.#lastInterruptAt = Date.now();
|
|
@@ -728,6 +891,15 @@ function parseProvider(value) {
|
|
|
728
891
|
}
|
|
729
892
|
return provider;
|
|
730
893
|
}
|
|
894
|
+
function parsePermissionMode(value) {
|
|
895
|
+
const normalized = value?.trim().toLowerCase();
|
|
896
|
+
// `bypass` is the name users reach for; it maps onto the existing allow_all policy.
|
|
897
|
+
const mode = normalized === "bypass" ? "allow_all" : normalized;
|
|
898
|
+
if (!mode || !PERMISSION_MODES.includes(mode)) {
|
|
899
|
+
throw new Error(`Permission mode must be one of: ${PERMISSION_MODES.join(", ")} (or bypass)`);
|
|
900
|
+
}
|
|
901
|
+
return mode;
|
|
902
|
+
}
|
|
731
903
|
function parseThinking(value) {
|
|
732
904
|
const normalized = value?.trim().toLowerCase();
|
|
733
905
|
if (!normalized || !THINKING_LEVELS.includes(normalized)) {
|
|
@@ -751,8 +923,15 @@ function updateFrom(settings, changes) {
|
|
|
751
923
|
api: changes.api ?? settings.api,
|
|
752
924
|
thinking: changes.thinking ?? settings.thinking,
|
|
753
925
|
customModel: changes.customModel ?? settings.customModel,
|
|
926
|
+
permissionMode: changes.permissionMode ?? settings.permissionMode,
|
|
927
|
+
autoCompactionEnabled: changes.autoCompactionEnabled ?? settings.autoCompactionEnabled,
|
|
928
|
+
autoCompactionTriggerTokens: changes.autoCompactionTriggerTokens ?? settings.autoCompactionTriggerTokens,
|
|
929
|
+
autoCompactionReserveTokens: changes.autoCompactionReserveTokens ?? settings.autoCompactionReserveTokens,
|
|
930
|
+
autoCompactionKeepRecentTokens: changes.autoCompactionKeepRecentTokens ?? settings.autoCompactionKeepRecentTokens,
|
|
754
931
|
...(changes.apiKey ? { apiKey: changes.apiKey } : {}),
|
|
932
|
+
...(changes.cookie ? { cookie: changes.cookie } : {}),
|
|
755
933
|
clearApiKey: changes.clearApiKey ?? false,
|
|
934
|
+
clearCookie: changes.clearCookie ?? false,
|
|
756
935
|
};
|
|
757
936
|
}
|
|
758
937
|
function settingsLines(settings) {
|
|
@@ -762,9 +941,30 @@ function settingsLines(settings) {
|
|
|
762
941
|
`Base URL ${settings.baseUrl || "provider default"}`,
|
|
763
942
|
`API ${settings.api}`,
|
|
764
943
|
`Thinking ${settings.thinking}`,
|
|
944
|
+
`Approvals ${settings.permissionMode} — ${permissionModeSummary(settings.permissionMode)}`,
|
|
945
|
+
`Compact ${settings.autoCompactionEnabled ? "on" : "off"} · trigger ${settings.autoCompactionTriggerTokens} · reserve ${settings.autoCompactionReserveTokens} · keep ${settings.autoCompactionKeepRecentTokens}`,
|
|
765
946
|
`API key ${settings.hasApiKey ? "configured (hidden)" : "not configured"}`,
|
|
947
|
+
` file ${settings.apiKeyPath}`,
|
|
948
|
+
`Cookie ${settings.hasCookie ? "configured (hidden)" : "not configured"}`,
|
|
949
|
+
` file ${settings.cookiePath}`,
|
|
950
|
+
`Config ${settings.configPath}`,
|
|
951
|
+
`Catalog ${settings.modelsPath}`,
|
|
766
952
|
"",
|
|
767
953
|
"Use /config wizard for guided setup, or /help for direct commands.",
|
|
768
954
|
];
|
|
769
955
|
}
|
|
956
|
+
function parseOnOff(value, label) {
|
|
957
|
+
if (value === "on")
|
|
958
|
+
return true;
|
|
959
|
+
if (value === "off")
|
|
960
|
+
return false;
|
|
961
|
+
throw new Error(`${label} expects on or off`);
|
|
962
|
+
}
|
|
963
|
+
function parseCompactionTokens(value, label) {
|
|
964
|
+
const parsed = Number(value);
|
|
965
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0 || parsed > 1_000_000) {
|
|
966
|
+
throw new Error(`${label} must be an integer from 1 to 1000000`);
|
|
967
|
+
}
|
|
968
|
+
return parsed;
|
|
969
|
+
}
|
|
770
970
|
//# sourceMappingURL=tui-app.js.map
|