@timurproko/a1 0.1.8-dev.50ebb19 → 0.1.8-dev.512
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 +168 -65
- package/bin/activate.js +8 -0
- package/bin/cli.js +33 -11
- package/bin/guardian.js +16 -6
- package/bin/module-identity.js +76 -69
- package/bin/module-resolver.js +138 -0
- package/bin/pinned-pi-public.d.ts +3 -0
- package/bin/pinned-pi-public.js +93 -0
- package/bin/release-cleanup.js +8 -0
- package/bin/supervisor.js +2 -2
- package/bin/sync-pi-tui-proxy.js +7 -0
- package/bin/ui.js +67 -22
- package/bin/update-recovery.js +343 -0
- package/bin/warmup.js +28 -0
- package/dist/app/session-shell/clipboard-diagnostics.d.ts +16 -0
- package/dist/app/session-shell/clipboard-diagnostics.js +65 -0
- package/dist/app/session-shell/clipboard-image.d.ts +11 -0
- package/dist/app/session-shell/clipboard-image.js +38 -0
- package/dist/app/session-shell/editor-hyperlink-budget.d.ts +9 -0
- package/dist/app/session-shell/editor-hyperlink-budget.js +23 -0
- package/dist/app/session-shell/helper-pool.d.ts +33 -0
- package/dist/app/session-shell/helper-pool.js +98 -0
- package/dist/app/session-shell/image-preparation-client.d.ts +20 -0
- package/dist/app/session-shell/image-preparation-client.js +145 -0
- package/dist/app/session-shell/image-preparation.d.ts +18 -0
- package/dist/app/session-shell/image-preparation.js +126 -0
- package/dist/app/session-shell/image-source.d.ts +13 -0
- package/dist/app/session-shell/image-source.js +171 -0
- package/dist/app/session-shell/image-worker.d.ts +17 -0
- package/dist/app/session-shell/image-worker.js +23 -0
- package/dist/app/session-shell/index.d.ts +7 -0
- package/dist/app/session-shell/index.js +4 -0
- package/dist/app/session-shell/paste-executor.d.ts +18 -0
- package/dist/app/session-shell/paste-executor.js +253 -0
- package/dist/app/session-shell/paste-helper.js +173 -0
- package/dist/app/session-shell/paste-preparation-client.d.ts +31 -0
- package/dist/app/session-shell/paste-preparation-client.js +170 -0
- package/dist/app/session-shell/paste-protocol.d.ts +78 -0
- package/dist/app/session-shell/paste-protocol.js +18 -0
- package/dist/app/session-shell/paste-text-preparation.d.ts +6 -0
- package/dist/app/session-shell/paste-text-preparation.js +134 -0
- package/dist/app/session-shell/paste-text-worker.js +12 -0
- package/dist/app/session-shell/paste-types.d.ts +17 -0
- package/dist/app/session-shell/path-chip-presentation.d.ts +7 -0
- package/dist/app/session-shell/path-chip-presentation.js +24 -0
- package/dist/app/session-shell/prompt-chips.d.ts +76 -0
- package/dist/app/session-shell/prompt-chips.js +507 -0
- package/dist/app/session-shell/prompt-history-controller.d.ts +36 -0
- package/dist/app/session-shell/prompt-history-controller.js +170 -0
- package/dist/app/session-shell/prompt-suggestion-controller.d.ts +35 -0
- package/dist/app/session-shell/prompt-suggestion-controller.js +207 -0
- package/dist/app/session-shell/quit-outro-effects.d.ts +29 -0
- package/dist/app/session-shell/quit-outro-effects.js +242 -0
- package/dist/app/session-shell/quit-outro.d.ts +38 -0
- package/dist/app/session-shell/quit-outro.js +98 -0
- package/dist/app/session-shell/response-copy-coordinator.d.ts +27 -0
- package/dist/app/session-shell/response-copy-coordinator.js +187 -0
- package/dist/app/session-shell/response-copy-helper.js +122 -0
- package/dist/app/session-shell/response-copy-protocol.d.ts +56 -0
- package/dist/app/session-shell/response-copy-protocol.js +5 -0
- package/dist/app/session-shell/response-copy-transport.d.ts +39 -0
- package/dist/app/session-shell/response-copy-transport.js +217 -0
- package/dist/app/session-shell/session-shell-root.d.ts +265 -0
- package/dist/app/session-shell/session-shell-root.js +1366 -0
- package/dist/app/session-shell/session-shell.d.ts +59 -0
- package/dist/app/session-shell/session-shell.js +1917 -0
- package/dist/app/session-shell/session-viewport-controller.d.ts +61 -0
- package/dist/app/session-shell/session-viewport-controller.js +597 -0
- package/dist/app/session-shell/stream-presentation-coalescer.d.ts +29 -0
- package/dist/app/session-shell/stream-presentation-coalescer.js +79 -0
- package/dist/app/session-shell/system-clipboard.d.ts +20 -0
- package/dist/app/session-shell/system-clipboard.js +159 -0
- package/dist/app/session-shell/text-paste.d.ts +5 -0
- package/dist/app/session-shell/text-paste.js +16 -0
- package/dist/cli/capabilities.d.ts +6 -0
- package/dist/cli/capabilities.js +7 -0
- package/dist/cli/dispatch.d.ts +46 -0
- package/dist/cli/dispatch.js +261 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/package-messages.d.ts +26 -0
- package/dist/cli/package-messages.js +71 -0
- package/dist/cli/packages.d.ts +32 -0
- package/dist/cli/packages.js +81 -0
- package/dist/cli/version-stats.d.ts +22 -0
- package/dist/cli/version-stats.js +112 -0
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +2 -0
- package/dist/composition/owned-ui.d.ts +37 -0
- package/dist/composition/owned-ui.js +136 -0
- package/dist/composition/settings-route-host.d.ts +7 -0
- package/dist/composition/settings-route-host.js +110 -0
- package/dist/contracts/agent-engine/capability-ports.d.ts +95 -0
- package/dist/contracts/agent-engine/domain-validation.js +107 -0
- package/dist/contracts/agent-engine/domain.d.ts +138 -0
- package/dist/contracts/agent-engine/index.d.ts +11 -0
- package/dist/contracts/agent-engine/index.js +6 -0
- package/dist/contracts/agent-engine/package-ports.d.ts +60 -0
- package/dist/contracts/agent-engine/ports.js +1 -0
- package/dist/contracts/owned-ui/extension-ui.d.ts +310 -0
- package/dist/contracts/owned-ui/image-attachments.d.ts +36 -0
- package/dist/contracts/owned-ui/image-attachments.js +67 -0
- package/dist/contracts/owned-ui/index.d.ts +12 -0
- package/dist/contracts/owned-ui/index.js +8 -0
- package/dist/contracts/owned-ui/model.d.ts +378 -0
- package/dist/contracts/owned-ui/prompt-history.d.ts +55 -0
- package/dist/contracts/owned-ui/prompt-history.js +23 -0
- package/dist/contracts/owned-ui/prompt-suggestions.d.ts +3 -0
- package/dist/contracts/owned-ui/prompt-suggestions.js +44 -0
- package/dist/contracts/owned-ui/suggestion-diagnostics.d.ts +22 -0
- package/dist/contracts/owned-ui/suggestion-diagnostics.js +9 -0
- package/dist/contracts/owned-ui/transcript-lifecycle.d.ts +5 -0
- package/dist/contracts/owned-ui/transcript-lifecycle.js +33 -0
- package/dist/contracts/owned-ui/validation.d.ts +15 -0
- package/dist/contracts/owned-ui/validation.js +523 -0
- package/dist/contracts/presentation/index.d.ts +104 -0
- package/dist/features/launch/development-launch.js +36 -0
- package/dist/features/launch/index.d.ts +12 -0
- package/dist/features/launch/index.js +6 -0
- package/dist/features/launch/intent.d.ts +12 -0
- package/dist/features/launch/intent.js +8 -0
- package/dist/features/launch/prepare-launch.d.ts +11 -0
- package/dist/features/launch/prepare-launch.js +14 -0
- package/dist/features/launch/profile-paths.d.ts +16 -0
- package/dist/features/launch/profile-paths.js +36 -0
- package/dist/features/launch/runtime-selection.d.ts +16 -0
- package/dist/features/launch/runtime-selection.js +13 -0
- package/dist/features/owned-ui/index.d.ts +6 -0
- package/dist/features/owned-ui/index.js +4 -0
- package/dist/features/owned-ui/project-trust-prompt.d.ts +25 -0
- package/dist/features/owned-ui/project-trust-prompt.js +149 -0
- package/dist/features/owned-ui/run.d.ts +17 -0
- package/dist/features/owned-ui/run.js +64 -0
- package/dist/features/owned-ui/session-fork-prompt.d.ts +8 -0
- package/dist/features/owned-ui/session-fork-prompt.js +34 -0
- package/dist/features/owned-ui/settings-app.d.ts +21 -0
- package/dist/features/owned-ui/settings-app.js +807 -0
- package/dist/features/owned-ui/settings-route.d.ts +2 -0
- package/dist/features/owned-ui/settings-route.js +2 -0
- package/dist/features/prompt-history/image-sidecar.d.ts +32 -0
- package/dist/features/prompt-history/image-sidecar.js +130 -0
- package/dist/features/prompt-history/index.d.ts +4 -0
- package/dist/features/prompt-history/index.js +3 -0
- package/dist/features/prompt-history/paths.d.ts +5 -0
- package/dist/features/prompt-history/paths.js +17 -0
- package/dist/features/prompt-history/service.d.ts +54 -0
- package/dist/features/prompt-history/service.js +425 -0
- package/dist/features/prompt-history/store.d.ts +16 -0
- package/dist/features/prompt-history/store.js +219 -0
- package/dist/features/prompt-history/worker.d.ts +9 -0
- package/dist/features/prompt-history/worker.js +45 -0
- package/dist/features/prompt-suggestions/diagnostics.d.ts +18 -0
- package/dist/features/prompt-suggestions/diagnostics.js +82 -0
- package/dist/features/prompt-suggestions/index.d.ts +2 -0
- package/dist/features/prompt-suggestions/index.js +1 -0
- package/dist/foundation/launch-context/index.d.ts +59 -0
- package/dist/foundation/launch-context/index.js +136 -0
- package/dist/foundation/launch-guardian/index.d.ts +2 -0
- package/dist/foundation/launch-guardian/index.js +1 -0
- package/dist/foundation/launch-guardian/main.d.ts +33 -0
- package/dist/foundation/launch-guardian/main.js +180 -0
- package/dist/foundation/lifecycle/commands.js +1 -0
- package/dist/foundation/lifecycle/index.d.ts +11 -0
- package/dist/foundation/lifecycle/index.js +5 -0
- package/dist/foundation/lifecycle/model.d.ts +64 -0
- package/dist/foundation/lifecycle/model.js +40 -0
- package/dist/foundation/lifecycle/paths.d.ts +30 -0
- package/dist/foundation/lifecycle/paths.js +70 -0
- package/dist/foundation/lifecycle/session-selection.d.ts +9 -0
- package/dist/foundation/lifecycle/session-selection.js +39 -0
- package/dist/foundation/lifecycle/supervisor-startup.d.ts +30 -0
- package/dist/foundation/lifecycle/supervisor-startup.js +106 -0
- package/dist/foundation/process-containment/darwin-process-inspector.d.ts +5 -0
- package/dist/foundation/process-containment/darwin-process-inspector.js +7 -0
- package/dist/foundation/process-containment/index.d.ts +8 -0
- package/dist/foundation/process-containment/index.js +6 -0
- package/dist/foundation/process-containment/linux-process-inspector.d.ts +7 -0
- package/dist/foundation/process-containment/linux-process-inspector.js +27 -0
- package/dist/foundation/process-containment/native-guardian-containment.d.ts +17 -0
- package/dist/foundation/process-containment/native-guardian-containment.js +140 -0
- package/dist/foundation/process-containment/windows-process-inspector.d.ts +19 -0
- package/dist/foundation/process-containment/windows-process-inspector.js +56 -0
- package/dist/foundation/protocol/client.d.ts +18 -0
- package/dist/foundation/protocol/client.js +130 -0
- package/dist/foundation/protocol/index.d.ts +3 -0
- package/dist/foundation/protocol/index.js +2 -0
- package/dist/foundation/protocol/messages.d.ts +90 -0
- package/dist/foundation/protocol/messages.js +100 -0
- package/dist/foundation/release/bootstrap.d.ts +51 -0
- package/dist/foundation/release/bootstrap.js +427 -0
- package/dist/foundation/release/cohort-state.d.ts +157 -0
- package/dist/foundation/release/cohort-state.js +472 -0
- package/dist/foundation/release/dependency-certification-retention.d.ts +7 -0
- package/dist/foundation/release/dependency-certification-retention.js +88 -0
- package/dist/foundation/release/dependency-certification.d.ts +24 -0
- package/dist/foundation/release/dependency-certification.js +266 -0
- package/dist/foundation/release/dependency-layer.d.ts +78 -0
- package/dist/foundation/release/dependency-layer.js +466 -0
- package/dist/foundation/release/endpoints.d.ts +24 -0
- package/dist/foundation/release/endpoints.js +134 -0
- package/dist/foundation/release/immutable-platform.d.ts +6 -0
- package/dist/foundation/release/immutable-platform.js +13 -0
- package/dist/foundation/release/index.d.ts +32 -0
- package/dist/foundation/release/index.js +17 -0
- package/dist/foundation/release/release-gc.d.ts +71 -0
- package/dist/foundation/release/release-gc.js +764 -0
- package/dist/foundation/release/release-store.d.ts +49 -0
- package/dist/foundation/release/release-store.js +235 -0
- package/dist/foundation/release/release.d.ts +43 -0
- package/dist/foundation/release/release.js +215 -0
- package/dist/foundation/release/restart-certification.d.ts +68 -0
- package/dist/foundation/release/restart-certification.js +227 -0
- package/dist/foundation/release/types.d.ts +11 -0
- package/dist/foundation/release/types.js +1 -0
- package/dist/foundation/release/update-activation.d.ts +72 -0
- package/dist/foundation/release/update-activation.js +204 -0
- package/dist/foundation/release/update-launch.d.ts +6 -0
- package/dist/foundation/release/update-launch.js +17 -0
- package/dist/foundation/release/update-recovery.d.ts +76 -0
- package/dist/foundation/release/update-recovery.js +356 -0
- package/dist/foundation/release/update-transaction.d.ts +42 -0
- package/dist/foundation/release/update-transaction.js +101 -0
- package/dist/foundation/release/update.d.ts +114 -0
- package/dist/foundation/release/update.js +633 -0
- package/dist/foundation/release/warmup.d.ts +3 -0
- package/dist/foundation/release/warmup.js +47 -0
- package/dist/foundation/startup/index.d.ts +4 -0
- package/dist/foundation/startup/index.js +2 -0
- package/dist/foundation/startup/startup-budget.d.ts +46 -0
- package/dist/foundation/startup/startup-budget.js +42 -0
- package/dist/foundation/startup/startup-descriptor.js +34 -0
- package/dist/foundation/startup/startup-runtime.d.ts +27 -0
- package/dist/foundation/startup/startup-runtime.js +128 -0
- package/dist/foundation/storage/control-store.d.ts +18 -0
- package/dist/foundation/storage/control-store.js +342 -0
- package/dist/foundation/storage/index.d.ts +1 -0
- package/dist/foundation/storage/index.js +1 -0
- package/dist/foundation/supervision/index.d.ts +3 -0
- package/dist/foundation/supervision/index.js +3 -0
- package/dist/foundation/supervision/main.d.ts +1 -0
- package/dist/foundation/supervision/main.js +84 -0
- package/dist/foundation/supervision/paths.d.ts +1 -0
- package/dist/foundation/supervision/paths.js +1 -0
- package/dist/foundation/supervision/server.d.ts +46 -0
- package/dist/foundation/supervision/server.js +573 -0
- package/dist/foundation/terminal-cleanup/fatal-exit.d.ts +12 -0
- package/dist/foundation/terminal-cleanup/fatal-exit.js +87 -0
- package/dist/foundation/terminal-cleanup/index.d.ts +3 -0
- package/dist/foundation/terminal-cleanup/index.js +2 -0
- package/dist/foundation/terminal-cleanup/terminal-reset.d.ts +4 -0
- package/dist/foundation/terminal-cleanup/terminal-reset.js +40 -0
- package/dist/integrations/pi/components/components.d.ts +4 -0
- package/dist/integrations/pi/components/components.js +64 -0
- package/dist/integrations/pi/components/conformance.d.ts +18 -0
- package/dist/integrations/pi/components/conformance.js +70 -0
- package/dist/integrations/pi/components/editor-interaction.d.ts +38 -0
- package/dist/integrations/pi/components/editor-interaction.js +1 -0
- package/dist/integrations/pi/components/history-editor-loader.d.ts +5 -0
- package/dist/integrations/pi/components/history-editor-loader.js +5 -0
- package/dist/integrations/pi/components/index.d.ts +21 -0
- package/dist/integrations/pi/components/index.js +13 -0
- package/dist/integrations/pi/components/owned-editor-ux.d.ts +74 -0
- package/dist/integrations/pi/components/owned-editor-ux.js +1094 -0
- package/dist/integrations/pi/components/path-word-ranges.d.ts +2 -0
- package/dist/integrations/pi/components/path-word-ranges.js +37 -0
- package/dist/integrations/pi/components/prompt-input-port.d.ts +18 -0
- package/dist/integrations/pi/components/prompt-input-port.js +1 -0
- package/dist/integrations/pi/components/resources/builtin-themes.d.ts +167 -0
- package/dist/integrations/pi/components/resources/builtin-themes.js +168 -0
- package/dist/integrations/pi/components/shell-components.d.ts +7 -0
- package/dist/integrations/pi/components/shell-components.js +7 -0
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +298 -0
- package/dist/integrations/pi/components/shell-extension-ui.d.ts +35 -0
- package/dist/integrations/pi/components/shell-extension-ui.js +280 -0
- package/dist/integrations/pi/components/shell-footer-status.d.ts +7 -0
- package/dist/integrations/pi/components/shell-footer-status.js +248 -0
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +43 -0
- package/dist/integrations/pi/components/shell-presenters-info.js +114 -0
- package/dist/integrations/pi/components/shell-presenters-transcript.d.ts +29 -0
- package/dist/integrations/pi/components/shell-presenters-transcript.js +433 -0
- package/dist/integrations/pi/components/shell-selectors-dialogs.d.ts +123 -0
- package/dist/integrations/pi/components/shell-selectors-dialogs.js +242 -0
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +217 -0
- package/dist/integrations/pi/components/shell-shared-facade.js +92 -0
- package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +17 -0
- package/dist/integrations/pi/components/submitted-prompt-adapter.js +49 -0
- package/dist/integrations/pi/components/tool-image-presentation.d.ts +21 -0
- package/dist/integrations/pi/components/tool-image-presentation.js +83 -0
- package/dist/integrations/pi/components/tool-result-adapter.d.ts +6 -0
- package/dist/integrations/pi/components/tool-result-adapter.js +27 -0
- package/dist/integrations/pi/components/transcript-image-resolver.d.ts +7 -0
- package/dist/integrations/pi/components/transcript-image-resolver.js +19 -0
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +445 -0
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +370 -0
- package/dist/integrations/pi/components/upstream/assets/earendil-image.json +12 -0
- package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +13 -0
- package/dist/integrations/pi/components/upstream/components/daxnuts.d.ts +29 -0
- package/dist/integrations/pi/components/upstream/components/daxnuts.js +146 -0
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.d.ts +4 -0
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +48 -0
- package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +20 -0
- package/dist/integrations/pi/components/upstream/components/extension-editor.js +84 -0
- package/dist/integrations/pi/components/upstream/components/mermaid.js +81 -0
- package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +46 -0
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +187 -0
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +59 -0
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +346 -0
- package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +11 -0
- package/dist/integrations/pi/components/upstream/components/session-footer.js +123 -0
- package/dist/integrations/pi/components/upstream/components/session-selector-search.js +161 -0
- package/dist/integrations/pi/components/upstream/components/session-selector.d.ts +95 -0
- package/dist/integrations/pi/components/upstream/components/session-selector.js +893 -0
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +21 -0
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +46 -0
- package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +35 -0
- package/dist/integrations/pi/components/upstream/components/status-indicator.js +69 -0
- package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +67 -0
- package/dist/integrations/pi/components/upstream/components/tool-execution.js +365 -0
- package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +101 -0
- package/dist/integrations/pi/components/upstream/components/tree-selector.js +1275 -0
- package/dist/integrations/pi/components/upstream/components/trust-selector.d.ts +33 -0
- package/dist/integrations/pi/components/upstream/components/trust-selector.js +81 -0
- package/dist/integrations/pi/components/upstream/external-editor.js +43 -0
- package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +289 -0
- package/dist/integrations/pi/components/upstream/history/editor-core.js +2144 -0
- package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +35 -0
- package/dist/integrations/pi/components/upstream/history/kill-ring.js +51 -0
- package/dist/integrations/pi/components/upstream/history/printable-key.d.ts +1 -0
- package/dist/integrations/pi/components/upstream/history/printable-key.js +43 -0
- package/dist/integrations/pi/components/upstream/history/text-helpers.d.ts +14 -0
- package/dist/integrations/pi/components/upstream/history/text-helpers.js +31 -0
- package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +25 -0
- package/dist/integrations/pi/components/upstream/history/undo-stack.js +39 -0
- package/dist/integrations/pi/components/upstream/history/word-navigation.d.ts +24 -0
- package/dist/integrations/pi/components/upstream/history/word-navigation.js +103 -0
- package/dist/integrations/pi/components/upstream/model-search.d.ts +18 -0
- package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +33 -0
- package/dist/integrations/pi/components/upstream/theme/theme-controller.js +114 -0
- package/dist/integrations/pi/components/upstream/theme/theme.d.ts +61 -0
- package/dist/integrations/pi/components/upstream/theme/theme.js +337 -0
- package/dist/integrations/pi/engine/adapter.d.ts +135 -0
- package/dist/integrations/pi/engine/adapter.js +648 -0
- package/dist/integrations/pi/engine/changelog.d.ts +2 -0
- package/dist/integrations/pi/engine/changelog.js +63 -0
- package/dist/integrations/pi/engine/command-dispatch.d.ts +41 -0
- package/dist/integrations/pi/engine/command-dispatch.js +125 -0
- package/dist/integrations/pi/engine/compaction-progress.d.ts +28 -0
- package/dist/integrations/pi/engine/compaction-progress.js +96 -0
- package/dist/integrations/pi/engine/conformance.d.ts +39 -0
- package/dist/integrations/pi/engine/conformance.js +140 -0
- package/dist/integrations/pi/engine/event-delivery.d.ts +100 -0
- package/dist/integrations/pi/engine/event-delivery.js +184 -0
- package/dist/integrations/pi/engine/extension-ui-binding.d.ts +35 -0
- package/dist/integrations/pi/engine/extension-ui-binding.js +81 -0
- package/dist/integrations/pi/engine/http-dispatcher.d.ts +4 -0
- package/dist/integrations/pi/engine/http-dispatcher.js +25 -0
- package/dist/integrations/pi/engine/index.d.ts +18 -0
- package/dist/integrations/pi/engine/index.js +10 -0
- package/dist/integrations/pi/engine/message-values.d.ts +29 -0
- package/dist/integrations/pi/engine/message-values.js +168 -0
- package/dist/integrations/pi/engine/package-integration.d.ts +13 -0
- package/dist/integrations/pi/engine/package-integration.js +118 -0
- package/dist/integrations/pi/engine/pending-delivery.d.ts +30 -0
- package/dist/integrations/pi/engine/pending-delivery.js +156 -0
- package/dist/integrations/pi/engine/pi-settings-metadata.json +385 -0
- package/dist/integrations/pi/engine/project-trust-preflight.d.ts +22 -0
- package/dist/integrations/pi/engine/project-trust-preflight.js +50 -0
- package/dist/integrations/pi/engine/prompt-suggestions.d.ts +30 -0
- package/dist/integrations/pi/engine/prompt-suggestions.js +102 -0
- package/dist/integrations/pi/engine/provider-authentication.d.ts +34 -0
- package/dist/integrations/pi/engine/provider-authentication.js +209 -0
- package/dist/integrations/pi/engine/resource-catalog.d.ts +49 -0
- package/dist/integrations/pi/engine/resource-catalog.js +289 -0
- package/dist/integrations/pi/engine/resources/changelog.json +12 -0
- package/dist/integrations/pi/engine/runtime-integration.d.ts +53 -0
- package/dist/integrations/pi/engine/runtime-integration.js +118 -0
- package/dist/integrations/pi/engine/session-events.d.ts +48 -0
- package/dist/integrations/pi/engine/session-events.js +223 -0
- package/dist/integrations/pi/engine/session-integration.d.ts +67 -0
- package/dist/integrations/pi/engine/session-integration.js +195 -0
- package/dist/integrations/pi/engine/session-runtime.d.ts +84 -0
- package/dist/integrations/pi/engine/session-runtime.js +249 -0
- package/dist/integrations/pi/engine/session-selection.d.ts +28 -0
- package/dist/integrations/pi/engine/session-selection.js +90 -0
- package/dist/integrations/pi/engine/settings-bridge.d.ts +121 -0
- package/dist/integrations/pi/engine/settings-bridge.js +514 -0
- package/dist/integrations/pi/engine/settings-metadata.d.ts +31 -0
- package/dist/integrations/pi/engine/settings-metadata.js +67 -0
- package/dist/integrations/pi/engine/settings-port.d.ts +42 -0
- package/dist/integrations/pi/engine/settings-port.js +353 -0
- package/dist/integrations/pi/engine/tool-rendering.d.ts +13 -0
- package/dist/integrations/pi/engine/tool-rendering.js +145 -0
- package/dist/integrations/pi/engine/transcript-image-assets.d.ts +11 -0
- package/dist/integrations/pi/engine/transcript-image-assets.js +86 -0
- package/dist/integrations/pi/engine/transcript-projection.d.ts +39 -0
- package/dist/integrations/pi/engine/transcript-projection.js +405 -0
- package/dist/integrations/pi/engine/usage-view.d.ts +4 -0
- package/dist/integrations/pi/engine/usage-view.js +56 -0
- package/dist/integrations/pi/engine/windows-filesystem-hygiene.d.ts +21 -0
- package/dist/integrations/pi/engine/windows-filesystem-hygiene.js +55 -0
- package/dist/integrations/pi/engine/workflow-contexts.d.ts +59 -0
- package/dist/integrations/pi/engine/workflow-contexts.js +316 -0
- package/dist/integrations/pi/engine/workflow-runner.d.ts +60 -0
- package/dist/integrations/pi/engine/workflow-runner.js +509 -0
- package/dist/integrations/pi/engine/workflow-support.d.ts +33 -0
- package/dist/integrations/pi/engine/workflow-support.js +352 -0
- package/dist/integrations/pi/engine/workflows.d.ts +251 -0
- package/dist/integrations/pi/engine/workflows.js +63 -0
- package/dist/integrations/pi/startup-public.d.ts +2 -0
- package/dist/integrations/pi/startup-public.js +2223 -0
- package/dist/integrations/pi/startup-public.manifest.json +12502 -0
- package/dist/integrations/pi/tui-runtime/adapter.d.ts +56 -0
- package/dist/integrations/pi/tui-runtime/adapter.js +783 -0
- package/dist/integrations/pi/tui-runtime/contracts.d.ts +156 -0
- package/dist/integrations/pi/tui-runtime/contracts.js +1 -0
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +88 -0
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +433 -0
- package/dist/integrations/pi/tui-runtime/index.d.ts +9 -0
- package/dist/integrations/pi/tui-runtime/index.js +5 -0
- package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.d.ts +39 -0
- package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.js +139 -0
- package/dist/integrations/pi/tui-runtime/mouse-report-input.d.ts +13 -0
- package/dist/integrations/pi/tui-runtime/mouse-report-input.js +57 -0
- package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +32 -0
- package/dist/integrations/pi/tui-runtime/overlay-geometry.js +158 -0
- package/dist/integrations/pi/tui-runtime/presentation-adapter.d.ts +4 -0
- package/dist/integrations/pi/tui-runtime/presentation-adapter.js +48 -0
- package/dist/native/darwin-arm64/manifest.json +4 -4
- package/dist/native/darwin-arm64/process-guardian +0 -0
- package/dist/native/linux-x64/manifest.json +3 -3
- package/dist/native/linux-x64/process-guardian +0 -0
- package/dist/native/win32-x64/manifest.json +3 -3
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/product-identity.d.ts +37 -0
- package/dist/product-identity.js +119 -0
- package/dist/product-identity.json +85 -0
- package/dist/runtime-payload-inventory.json +127148 -0
- package/dist/ui/apps/contracts.d.ts +64 -0
- package/dist/ui/apps/host.d.ts +42 -0
- package/dist/ui/apps/host.js +156 -0
- package/dist/ui/apps/index.d.ts +5 -0
- package/dist/ui/apps/index.js +3 -0
- package/dist/ui/apps/registry.d.ts +12 -0
- package/dist/ui/apps/registry.js +33 -0
- package/dist/ui/components/dialog-panel.js +49 -0
- package/dist/ui/components/frame.d.ts +22 -0
- package/dist/ui/components/frame.js +55 -0
- package/dist/ui/components/index.d.ts +47 -0
- package/dist/ui/components/index.js +25 -0
- package/dist/ui/components/line-input.d.ts +68 -0
- package/dist/ui/components/line-input.js +224 -0
- package/dist/ui/components/list-view.d.ts +60 -0
- package/dist/ui/components/list-view.js +82 -0
- package/dist/ui/components/mouse.d.ts +25 -0
- package/dist/ui/components/mouse.js +70 -0
- package/dist/ui/components/progress-status.d.ts +2 -0
- package/dist/ui/components/progress-status.js +4 -0
- package/dist/ui/components/prompt-input.d.ts +32 -0
- package/dist/ui/components/prompt-input.js +51 -0
- package/dist/ui/components/scrollbar.d.ts +88 -0
- package/dist/ui/components/scrollbar.js +137 -0
- package/dist/ui/components/selection-copy.d.ts +24 -0
- package/dist/ui/components/selection-copy.js +39 -0
- package/dist/ui/components/shortcuts.d.ts +58 -0
- package/dist/ui/components/shortcuts.js +82 -0
- package/dist/ui/components/spans.d.ts +28 -0
- package/dist/ui/components/spans.js +266 -0
- package/dist/ui/components/submitted-prompt.d.ts +23 -0
- package/dist/ui/components/submitted-prompt.js +50 -0
- package/dist/ui/components/surface.d.ts +20 -0
- package/dist/ui/components/surface.js +44 -0
- package/dist/ui/components/text-selection.d.ts +62 -0
- package/dist/ui/components/text-selection.js +210 -0
- package/dist/ui/components/text.d.ts +38 -0
- package/dist/ui/components/text.js +185 -0
- package/dist/ui/components/transcript-viewport.d.ts +173 -0
- package/dist/ui/components/transcript-viewport.js +753 -0
- package/dist/ui/components/visible-hyperlinks.d.ts +26 -0
- package/dist/ui/components/visible-hyperlinks.js +97 -0
- package/dist/ui/settings/declarations.d.ts +141 -0
- package/dist/ui/settings/declarations.js +135 -0
- package/dist/ui/settings/index.d.ts +10 -0
- package/dist/ui/settings/index.js +5 -0
- package/dist/ui/settings/manager.d.ts +54 -0
- package/dist/ui/settings/manager.js +256 -0
- package/dist/ui/settings/migrations.d.ts +13 -0
- package/dist/ui/settings/migrations.js +74 -0
- package/dist/ui/settings/sections.d.ts +52 -0
- package/dist/ui/settings/sections.js +112 -0
- package/docs/architecture/boundaries.md +17 -13
- package/docs/architecture/code-documentation.md +77 -0
- package/docs/architecture/history-editor-provenance.md +100 -0
- package/docs/architecture/internal-naming.md +93 -0
- package/docs/architecture/process-guardian-provenance.md +3 -1
- package/docs/architecture/project-structure.md +69 -30
- package/docs/architecture/prompt-suggestions.md +68 -0
- package/docs/architecture/resource-and-data-policy.md +28 -2
- package/docs/architecture/response-copy-delivery.md +85 -0
- package/docs/architecture/terminal-host-proof-gate.md +1 -1
- package/docs/architecture/terminal-host-spike-evidence.md +1 -1
- package/docs/architecture/tool-image-presentation.md +62 -0
- package/docs/architecture/toolchain.md +32 -10
- package/docs/architecture/ui-reference-provenance.md +60 -6
- package/docs/ci-release-runbook.md +256 -79
- package/docs/features/launch-profiles.md +24 -17
- package/docs/features/modal-content-interaction.md +37 -0
- package/docs/features/prompt-history.md +149 -0
- package/docs/local-worktree-cleanup.md +212 -0
- package/docs/manual-code-streaming-cleanup.md +88 -0
- package/docs/manual-ghost-link-baseline.md +89 -0
- package/docs/manual-launch-instance-acceptance.md +12 -35
- package/docs/manual-owned-ui-checkpoint.md +79 -0
- package/docs/manual-pi-boundary-candidate.md +4 -5
- package/docs/manual-terminal-colour-check.md +4 -3
- package/docs/openspec-archive-automation.md +259 -0
- package/docs/repository-governance-live-acceptance.md +77 -0
- package/docs/validation.md +100 -0
- package/package.json +52 -34
- package/dist/src/cli/capabilities.d.ts +0 -15
- package/dist/src/cli/capabilities.js +0 -7
- package/dist/src/cli/dispatch.d.ts +0 -32
- package/dist/src/cli/dispatch.js +0 -142
- package/dist/src/cli/index.d.ts +0 -5
- package/dist/src/cli/index.js +0 -5
- package/dist/src/cli/packages.d.ts +0 -23
- package/dist/src/cli/packages.js +0 -84
- package/dist/src/cli/version-stats.d.ts +0 -16
- package/dist/src/cli/version-stats.js +0 -72
- package/dist/src/cli/version.d.ts +0 -2
- package/dist/src/cli/version.js +0 -23
- package/dist/src/composition/index.d.ts +0 -48
- package/dist/src/composition/index.js +0 -258
- package/dist/src/features/launch/development-launch.js +0 -28
- package/dist/src/features/launch/index.d.ts +0 -7
- package/dist/src/features/launch/index.js +0 -7
- package/dist/src/features/launch/intent.d.ts +0 -7
- package/dist/src/features/launch/intent.js +0 -4
- package/dist/src/features/launch/prepare-launch.d.ts +0 -13
- package/dist/src/features/launch/prepare-launch.js +0 -21
- package/dist/src/features/launch/profile-paths.d.ts +0 -15
- package/dist/src/features/launch/profile-paths.js +0 -31
- package/dist/src/features/launch/profiles.d.ts +0 -12
- package/dist/src/features/launch/profiles.js +0 -26
- package/dist/src/features/launch/runtime-selection.d.ts +0 -19
- package/dist/src/features/launch/runtime-selection.js +0 -13
- package/dist/src/features/owned-ui/customization.d.ts +0 -38
- package/dist/src/features/owned-ui/customization.js +0 -108
- package/dist/src/features/owned-ui/diagnostics.d.ts +0 -33
- package/dist/src/features/owned-ui/diagnostics.js +0 -94
- package/dist/src/features/owned-ui/index.d.ts +0 -4
- package/dist/src/features/owned-ui/index.js +0 -4
- package/dist/src/features/owned-ui/run.d.ts +0 -11
- package/dist/src/features/owned-ui/run.js +0 -15
- package/dist/src/features/owned-ui/settings-app.d.ts +0 -22
- package/dist/src/features/owned-ui/settings-app.js +0 -633
- package/dist/src/features/workspace/capabilities.d.ts +0 -31
- package/dist/src/features/workspace/capabilities.js +0 -75
- package/dist/src/features/workspace/index.d.ts +0 -6
- package/dist/src/features/workspace/index.js +0 -6
- package/dist/src/features/workspace/presentation.d.ts +0 -30
- package/dist/src/features/workspace/presentation.js +0 -70
- package/dist/src/features/workspace/reconciliation.d.ts +0 -15
- package/dist/src/features/workspace/reconciliation.js +0 -82
- package/dist/src/features/workspace/reducer.d.ts +0 -42
- package/dist/src/features/workspace/reducer.js +0 -213
- package/dist/src/features/workspace/router.d.ts +0 -31
- package/dist/src/features/workspace/router.js +0 -124
- package/dist/src/features/workspace/store.d.ts +0 -17
- package/dist/src/features/workspace/store.js +0 -54
- package/dist/src/foundation/agent-engine-contracts/capability-ports.d.ts +0 -95
- package/dist/src/foundation/agent-engine-contracts/domain-validation.js +0 -89
- package/dist/src/foundation/agent-engine-contracts/domain.d.ts +0 -116
- package/dist/src/foundation/agent-engine-contracts/index.d.ts +0 -8
- package/dist/src/foundation/agent-engine-contracts/index.js +0 -8
- package/dist/src/foundation/agent-engine-contracts/package-ports.d.ts +0 -54
- package/dist/src/foundation/launch-guardian/index.d.ts +0 -1
- package/dist/src/foundation/launch-guardian/index.js +0 -1
- package/dist/src/foundation/launch-guardian/main.d.ts +0 -31
- package/dist/src/foundation/launch-guardian/main.js +0 -165
- package/dist/src/foundation/lifecycle/index.d.ts +0 -4
- package/dist/src/foundation/lifecycle/index.js +0 -4
- package/dist/src/foundation/lifecycle/model.d.ts +0 -64
- package/dist/src/foundation/lifecycle/model.js +0 -40
- package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
- package/dist/src/foundation/lifecycle/paths.js +0 -42
- package/dist/src/foundation/native-host-protocol/codec.d.ts +0 -11
- package/dist/src/foundation/native-host-protocol/codec.js +0 -56
- package/dist/src/foundation/native-host-protocol/evidence.d.ts +0 -67
- package/dist/src/foundation/native-host-protocol/evidence.js +0 -141
- package/dist/src/foundation/native-host-protocol/index.d.ts +0 -4
- package/dist/src/foundation/native-host-protocol/index.js +0 -4
- package/dist/src/foundation/native-host-protocol/messages.d.ts +0 -56
- package/dist/src/foundation/native-host-protocol/messages.js +0 -149
- package/dist/src/foundation/native-host-protocol/proof-gate.d.ts +0 -13
- package/dist/src/foundation/native-host-protocol/proof-gate.js +0 -33
- package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts +0 -302
- package/dist/src/foundation/owned-ui-contracts/index.d.ts +0 -3
- package/dist/src/foundation/owned-ui-contracts/index.js +0 -3
- package/dist/src/foundation/owned-ui-contracts/model.d.ts +0 -241
- package/dist/src/foundation/owned-ui-contracts/validation.d.ts +0 -11
- package/dist/src/foundation/owned-ui-contracts/validation.js +0 -395
- package/dist/src/foundation/owned-ui-settings/declarations.d.ts +0 -13
- package/dist/src/foundation/owned-ui-settings/declarations.js +0 -39
- package/dist/src/foundation/owned-ui-settings/index.d.ts +0 -6
- package/dist/src/foundation/owned-ui-settings/index.js +0 -6
- package/dist/src/foundation/owned-ui-settings/migrations.d.ts +0 -13
- package/dist/src/foundation/owned-ui-settings/migrations.js +0 -28
- package/dist/src/foundation/owned-ui-settings/sections.d.ts +0 -70
- package/dist/src/foundation/owned-ui-settings/sections.js +0 -93
- package/dist/src/foundation/owned-ui-settings/session.d.ts +0 -44
- package/dist/src/foundation/owned-ui-settings/session.js +0 -145
- package/dist/src/foundation/owned-ui-settings/store.d.ts +0 -28
- package/dist/src/foundation/owned-ui-settings/store.js +0 -90
- package/dist/src/foundation/pi-component-adapter/components.d.ts +0 -4
- package/dist/src/foundation/pi-component-adapter/components.js +0 -64
- package/dist/src/foundation/pi-component-adapter/conformance.d.ts +0 -17
- package/dist/src/foundation/pi-component-adapter/conformance.js +0 -69
- package/dist/src/foundation/pi-component-adapter/index.d.ts +0 -13
- package/dist/src/foundation/pi-component-adapter/index.js +0 -13
- package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.d.ts +0 -165
- package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.js +0 -166
- package/dist/src/foundation/pi-component-adapter/shell-components.d.ts +0 -6
- package/dist/src/foundation/pi-component-adapter/shell-components.js +0 -6
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js +0 -162
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts +0 -35
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js +0 -279
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts +0 -7
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.js +0 -189
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +0 -57
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js +0 -429
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts +0 -113
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js +0 -235
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts +0 -116
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js +0 -87
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts +0 -422
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js +0 -296
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts +0 -10
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts +0 -17
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js +0 -51
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts +0 -22
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js +0 -142
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts +0 -4
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js +0 -19
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts +0 -17
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js +0 -81
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts +0 -24
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js +0 -105
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts +0 -2
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js +0 -18
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js +0 -77
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.d.ts +0 -18
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.js +0 -55
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts +0 -55
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js +0 -342
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.d.ts +0 -10
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.js +0 -120
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js +0 -159
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts +0 -95
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js +0 -889
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts +0 -19
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js +0 -44
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts +0 -30
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js +0 -59
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts +0 -98
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js +0 -1272
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts +0 -33
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js +0 -76
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js +0 -39
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts +0 -15
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts +0 -25
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js +0 -117
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts +0 -61
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js +0 -326
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts +0 -164
- package/dist/src/foundation/pi-engine-adapter/adapter.js +0 -2367
- package/dist/src/foundation/pi-engine-adapter/conformance.d.ts +0 -37
- package/dist/src/foundation/pi-engine-adapter/conformance.js +0 -130
- package/dist/src/foundation/pi-engine-adapter/index.d.ts +0 -10
- package/dist/src/foundation/pi-engine-adapter/index.js +0 -10
- package/dist/src/foundation/pi-engine-adapter/model-auth-integration.d.ts +0 -30
- package/dist/src/foundation/pi-engine-adapter/model-auth-integration.js +0 -61
- package/dist/src/foundation/pi-engine-adapter/package-integration.d.ts +0 -13
- package/dist/src/foundation/pi-engine-adapter/package-integration.js +0 -112
- package/dist/src/foundation/pi-engine-adapter/pi-settings-metadata.json +0 -374
- package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.d.ts +0 -31
- package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.js +0 -80
- package/dist/src/foundation/pi-engine-adapter/runtime-integration.d.ts +0 -35
- package/dist/src/foundation/pi-engine-adapter/runtime-integration.js +0 -67
- package/dist/src/foundation/pi-engine-adapter/session-integration.d.ts +0 -43
- package/dist/src/foundation/pi-engine-adapter/session-integration.js +0 -97
- package/dist/src/foundation/pi-engine-adapter/settings-integration.d.ts +0 -55
- package/dist/src/foundation/pi-engine-adapter/settings-integration.js +0 -233
- package/dist/src/foundation/pi-engine-adapter/workflow-controllers.d.ts +0 -20
- package/dist/src/foundation/pi-engine-adapter/workflow-controllers.js +0 -48
- package/dist/src/foundation/pi-engine-adapter/workflows.d.ts +0 -173
- package/dist/src/foundation/pi-engine-adapter/workflows.js +0 -60
- package/dist/src/foundation/pi-owned-ui-integration/index.d.ts +0 -2
- package/dist/src/foundation/pi-owned-ui-integration/index.js +0 -2
- package/dist/src/foundation/pi-owned-ui-integration/route-host.d.ts +0 -29
- package/dist/src/foundation/pi-owned-ui-integration/session-shell.d.ts +0 -106
- package/dist/src/foundation/pi-owned-ui-integration/session-shell.js +0 -1518
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts +0 -39
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js +0 -493
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts +0 -18
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js +0 -145
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts +0 -120
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts +0 -4
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js +0 -4
- package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.d.ts +0 -4
- package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.js +0 -48
- package/dist/src/foundation/presentation-contracts/index.d.ts +0 -96
- package/dist/src/foundation/process-containment/index.d.ts +0 -5
- package/dist/src/foundation/process-containment/index.js +0 -5
- package/dist/src/foundation/process-containment/linux-process-inspector.d.ts +0 -6
- package/dist/src/foundation/process-containment/linux-process-inspector.js +0 -26
- package/dist/src/foundation/process-containment/native-guardian-containment.d.ts +0 -16
- package/dist/src/foundation/process-containment/native-guardian-containment.js +0 -139
- package/dist/src/foundation/process-containment/windows-process-inspector.d.ts +0 -17
- package/dist/src/foundation/process-containment/windows-process-inspector.js +0 -53
- package/dist/src/foundation/protocol/client.d.ts +0 -17
- package/dist/src/foundation/protocol/client.js +0 -129
- package/dist/src/foundation/protocol/index.d.ts +0 -2
- package/dist/src/foundation/protocol/index.js +0 -2
- package/dist/src/foundation/protocol/messages.d.ts +0 -89
- package/dist/src/foundation/protocol/messages.js +0 -99
- package/dist/src/foundation/release/bootstrap.d.ts +0 -29
- package/dist/src/foundation/release/bootstrap.js +0 -335
- package/dist/src/foundation/release/cohort-state.d.ts +0 -70
- package/dist/src/foundation/release/cohort-state.js +0 -202
- package/dist/src/foundation/release/index.d.ts +0 -10
- package/dist/src/foundation/release/index.js +0 -10
- package/dist/src/foundation/release/release-gc.d.ts +0 -5
- package/dist/src/foundation/release/release-gc.js +0 -16
- package/dist/src/foundation/release/release-store.d.ts +0 -43
- package/dist/src/foundation/release/release-store.js +0 -175
- package/dist/src/foundation/release/release.d.ts +0 -38
- package/dist/src/foundation/release/release.js +0 -204
- package/dist/src/foundation/release/update-transaction.d.ts +0 -31
- package/dist/src/foundation/release/update-transaction.js +0 -89
- package/dist/src/foundation/release/update.d.ts +0 -82
- package/dist/src/foundation/release/update.js +0 -527
- package/dist/src/foundation/storage/control-store.d.ts +0 -61
- package/dist/src/foundation/storage/control-store.js +0 -530
- package/dist/src/foundation/storage/index.d.ts +0 -1
- package/dist/src/foundation/storage/index.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts +0 -46
- package/dist/src/foundation/structured-agent-runtime/backpressure.js +0 -118
- package/dist/src/foundation/structured-agent-runtime/commands.d.ts +0 -52
- package/dist/src/foundation/structured-agent-runtime/commands.js +0 -164
- package/dist/src/foundation/structured-agent-runtime/handshake.d.ts +0 -41
- package/dist/src/foundation/structured-agent-runtime/handshake.js +0 -151
- package/dist/src/foundation/structured-agent-runtime/index.d.ts +0 -5
- package/dist/src/foundation/structured-agent-runtime/index.js +0 -5
- package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts +0 -37
- package/dist/src/foundation/structured-agent-runtime/reconnection.js +0 -129
- package/dist/src/foundation/structured-agent-runtime/state.d.ts +0 -56
- package/dist/src/foundation/structured-agent-runtime/state.js +0 -118
- package/dist/src/foundation/supervision/index.d.ts +0 -3
- package/dist/src/foundation/supervision/index.js +0 -3
- package/dist/src/foundation/supervision/main.d.ts +0 -1
- package/dist/src/foundation/supervision/main.js +0 -41
- package/dist/src/foundation/supervision/paths.d.ts +0 -1
- package/dist/src/foundation/supervision/paths.js +0 -1
- package/dist/src/foundation/supervision/server.d.ts +0 -22
- package/dist/src/foundation/supervision/server.js +0 -451
- package/dist/src/foundation/ui-apps/contracts.d.ts +0 -42
- package/dist/src/foundation/ui-apps/host.d.ts +0 -42
- package/dist/src/foundation/ui-apps/host.js +0 -152
- package/dist/src/foundation/ui-apps/index.d.ts +0 -3
- package/dist/src/foundation/ui-apps/index.js +0 -3
- package/dist/src/foundation/ui-apps/registry.d.ts +0 -11
- package/dist/src/foundation/ui-apps/registry.js +0 -32
- package/dist/src/foundation/ui-components/dialog-panel.js +0 -47
- package/dist/src/foundation/ui-components/frame.d.ts +0 -21
- package/dist/src/foundation/ui-components/frame.js +0 -54
- package/dist/src/foundation/ui-components/index.d.ts +0 -18
- package/dist/src/foundation/ui-components/index.js +0 -18
- package/dist/src/foundation/ui-components/line-input.d.ts +0 -74
- package/dist/src/foundation/ui-components/line-input.js +0 -245
- package/dist/src/foundation/ui-components/list-view.d.ts +0 -66
- package/dist/src/foundation/ui-components/list-view.js +0 -76
- package/dist/src/foundation/ui-components/mouse.d.ts +0 -15
- package/dist/src/foundation/ui-components/mouse.js +0 -46
- package/dist/src/foundation/ui-components/scrollbar.d.ts +0 -62
- package/dist/src/foundation/ui-components/scrollbar.js +0 -102
- package/dist/src/foundation/ui-components/shortcuts.d.ts +0 -57
- package/dist/src/foundation/ui-components/shortcuts.js +0 -81
- package/dist/src/foundation/ui-components/spans.d.ts +0 -7
- package/dist/src/foundation/ui-components/spans.js +0 -59
- package/dist/src/foundation/ui-components/surface.d.ts +0 -20
- package/dist/src/foundation/ui-components/surface.js +0 -38
- package/dist/src/foundation/ui-components/text.d.ts +0 -24
- package/dist/src/foundation/ui-components/text.js +0 -123
- package/dist/src/foundation/workspace-contracts/index.d.ts +0 -2
- package/dist/src/foundation/workspace-contracts/index.js +0 -2
- package/dist/src/foundation/workspace-contracts/model.d.ts +0 -248
- package/dist/src/foundation/workspace-contracts/model.js +0 -2
- package/dist/src/foundation/workspace-contracts/validation.d.ts +0 -13
- package/dist/src/foundation/workspace-contracts/validation.js +0 -335
- package/dist/src/product-identity.d.ts +0 -37
- package/dist/src/product-identity.js +0 -150
- package/dist/src/product-identity.json +0 -99
- package/docs/manual-transparent-checkpoint.md +0 -53
- /package/dist/{src/foundation/agent-engine-contracts/domain.js → app/session-shell/paste-helper.d.ts} +0 -0
- /package/dist/{src/foundation/agent-engine-contracts/ports.js → app/session-shell/paste-text-worker.d.ts} +0 -0
- /package/dist/{src/foundation/lifecycle/commands.js → app/session-shell/paste-types.js} +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration/route-host.js → app/session-shell/response-copy-helper.d.ts} +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter/contracts.js → contracts/agent-engine/domain.js} +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.js +0 -0
- /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.js +0 -0
- /package/dist/{src/features → features}/launch/development-launch.d.ts +0 -0
- /package/dist/{src/features → features}/launch/initialize-profile.d.ts +0 -0
- /package/dist/{src/features → features}/launch/initialize-profile.js +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/artifact.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/artifact.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/contracts.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/contracts.js +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.js +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.js +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.js +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.js +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/contracts.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.js +0 -0
|
@@ -0,0 +1,893 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provenance: @earendil-works/pi-coding-agent 0.85.1 (MIT), commit d981de1229ef899957bbe968bc8dcda02a21f477,
|
|
3
|
+
* packages/coding-agent/src/modes/interactive/components/session-selector.ts.
|
|
4
|
+
* Modifications: Source-synchronized session selector port: preserve threaded/current/all scope,
|
|
5
|
+
* search, sort, named/path filters, rename, delete confirmation, active-session protection, loading
|
|
6
|
+
* progress, cancellation, focus, and disposal while remapping public helpers, owned keybindings/theme,
|
|
7
|
+
* and canonical path handling.
|
|
8
|
+
* Deviations: none.
|
|
9
|
+
*/
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
12
|
+
import { unlink } from "node:fs/promises";
|
|
13
|
+
import * as os from "node:os";
|
|
14
|
+
import { Container, getKeybindings, Input, Spacer, Text, truncateToWidth, visibleWidth, } from "@earendil-works/pi-tui";
|
|
15
|
+
import { KeybindingsManager } from "../adjacent/core/keybindings.js";
|
|
16
|
+
import { DynamicBorder } from "../../../startup-public.js";
|
|
17
|
+
import { piTheme } from "../theme/theme.js";
|
|
18
|
+
const theme = new Proxy({}, {
|
|
19
|
+
get(_target, property) {
|
|
20
|
+
const active = piTheme();
|
|
21
|
+
const value = active[property];
|
|
22
|
+
return typeof value === "function" ? value.bind(active) : value;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
function keyText(keybinding, keybindings) {
|
|
26
|
+
return keybindings.getKeys(keybinding).join("/");
|
|
27
|
+
}
|
|
28
|
+
function keyHint(keybinding, description, keybindings) {
|
|
29
|
+
return theme.fg("dim", keyText(keybinding, keybindings)) + theme.fg("muted", ` ${description}`);
|
|
30
|
+
}
|
|
31
|
+
import { filterAndSortSessions, hasSessionName } from "./session-selector-search.js";
|
|
32
|
+
function shortenPath(path) {
|
|
33
|
+
const home = os.homedir();
|
|
34
|
+
if (!path)
|
|
35
|
+
return path;
|
|
36
|
+
if (path.startsWith(home)) {
|
|
37
|
+
return `~${path.slice(home.length)}`;
|
|
38
|
+
}
|
|
39
|
+
return path;
|
|
40
|
+
}
|
|
41
|
+
function formatSessionDate(date) {
|
|
42
|
+
const now = new Date();
|
|
43
|
+
const diffMs = now.getTime() - date.getTime();
|
|
44
|
+
const diffMins = Math.floor(diffMs / 60000);
|
|
45
|
+
const diffHours = Math.floor(diffMs / 3600000);
|
|
46
|
+
const diffDays = Math.floor(diffMs / 86400000);
|
|
47
|
+
if (diffMins < 1)
|
|
48
|
+
return "now";
|
|
49
|
+
if (diffMins < 60)
|
|
50
|
+
return `${diffMins}m`;
|
|
51
|
+
if (diffHours < 24)
|
|
52
|
+
return `${diffHours}h`;
|
|
53
|
+
if (diffDays < 7)
|
|
54
|
+
return `${diffDays}d`;
|
|
55
|
+
if (diffDays < 30)
|
|
56
|
+
return `${Math.floor(diffDays / 7)}w`;
|
|
57
|
+
if (diffDays < 365)
|
|
58
|
+
return `${Math.floor(diffDays / 30)}mo`;
|
|
59
|
+
return `${Math.floor(diffDays / 365)}y`;
|
|
60
|
+
}
|
|
61
|
+
function canonicalizePath(path) {
|
|
62
|
+
if (!path)
|
|
63
|
+
return path;
|
|
64
|
+
try {
|
|
65
|
+
return realpathSync(path);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return path;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class SessionSelectorHeader {
|
|
72
|
+
scope;
|
|
73
|
+
sortMode;
|
|
74
|
+
nameFilter;
|
|
75
|
+
requestRender;
|
|
76
|
+
keybindings;
|
|
77
|
+
loading = false;
|
|
78
|
+
loadProgress = null;
|
|
79
|
+
showPath = false;
|
|
80
|
+
confirmingDeletePath = null;
|
|
81
|
+
statusMessage = null;
|
|
82
|
+
statusTimeout = null;
|
|
83
|
+
showRenameHint = false;
|
|
84
|
+
constructor(scope, sortMode, nameFilter, requestRender, keybindings) {
|
|
85
|
+
this.scope = scope;
|
|
86
|
+
this.sortMode = sortMode;
|
|
87
|
+
this.nameFilter = nameFilter;
|
|
88
|
+
this.requestRender = requestRender;
|
|
89
|
+
this.keybindings = keybindings;
|
|
90
|
+
}
|
|
91
|
+
setScope(scope) {
|
|
92
|
+
this.scope = scope;
|
|
93
|
+
}
|
|
94
|
+
setSortMode(sortMode) {
|
|
95
|
+
this.sortMode = sortMode;
|
|
96
|
+
}
|
|
97
|
+
setNameFilter(nameFilter) {
|
|
98
|
+
this.nameFilter = nameFilter;
|
|
99
|
+
}
|
|
100
|
+
setLoading(loading) {
|
|
101
|
+
this.loading = loading;
|
|
102
|
+
// Progress is scoped to the current load; clear whenever the loading state is set
|
|
103
|
+
this.loadProgress = null;
|
|
104
|
+
}
|
|
105
|
+
setProgress(loaded, total) {
|
|
106
|
+
this.loadProgress = { loaded, total };
|
|
107
|
+
}
|
|
108
|
+
setShowPath(showPath) {
|
|
109
|
+
this.showPath = showPath;
|
|
110
|
+
}
|
|
111
|
+
setShowRenameHint(show) {
|
|
112
|
+
this.showRenameHint = show;
|
|
113
|
+
}
|
|
114
|
+
setConfirmingDeletePath(path) {
|
|
115
|
+
this.confirmingDeletePath = path;
|
|
116
|
+
}
|
|
117
|
+
clearStatusTimeout() {
|
|
118
|
+
if (!this.statusTimeout)
|
|
119
|
+
return;
|
|
120
|
+
clearTimeout(this.statusTimeout);
|
|
121
|
+
this.statusTimeout = null;
|
|
122
|
+
}
|
|
123
|
+
setStatusMessage(msg, autoHideMs) {
|
|
124
|
+
this.clearStatusTimeout();
|
|
125
|
+
this.statusMessage = msg;
|
|
126
|
+
if (!msg || !autoHideMs)
|
|
127
|
+
return;
|
|
128
|
+
this.statusTimeout = setTimeout(() => {
|
|
129
|
+
this.statusMessage = null;
|
|
130
|
+
this.statusTimeout = null;
|
|
131
|
+
this.requestRender();
|
|
132
|
+
}, autoHideMs);
|
|
133
|
+
}
|
|
134
|
+
invalidate() { }
|
|
135
|
+
render(width) {
|
|
136
|
+
const title = this.scope === "current" ? "Resume Session (Current Folder)" : "Resume Session (All)";
|
|
137
|
+
const leftText = theme.bold(title);
|
|
138
|
+
const sortLabel = this.sortMode === "threaded" ? "Threaded" : this.sortMode === "recent" ? "Recent" : "Fuzzy";
|
|
139
|
+
const sortText = theme.fg("muted", "Sort: ") + theme.fg("accent", sortLabel);
|
|
140
|
+
const nameLabel = this.nameFilter === "all" ? "All" : "Named";
|
|
141
|
+
const nameText = theme.fg("muted", "Name: ") + theme.fg("accent", nameLabel);
|
|
142
|
+
let scopeText;
|
|
143
|
+
if (this.loading) {
|
|
144
|
+
const progressText = this.loadProgress ? `${this.loadProgress.loaded}/${this.loadProgress.total}` : "...";
|
|
145
|
+
scopeText = `${theme.fg("muted", "○ Current Folder | ")}${theme.fg("accent", `Loading ${progressText}`)}`;
|
|
146
|
+
}
|
|
147
|
+
else if (this.scope === "current") {
|
|
148
|
+
scopeText = `${theme.fg("accent", "◉ Current Folder")}${theme.fg("muted", " | ○ All")}`;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
scopeText = `${theme.fg("muted", "○ Current Folder | ")}${theme.fg("accent", "◉ All")}`;
|
|
152
|
+
}
|
|
153
|
+
const rightText = truncateToWidth(`${scopeText} ${nameText} ${sortText}`, width, "");
|
|
154
|
+
const availableLeft = Math.max(0, width - visibleWidth(rightText) - 1);
|
|
155
|
+
const left = truncateToWidth(leftText, availableLeft, "");
|
|
156
|
+
const spacing = Math.max(0, width - visibleWidth(left) - visibleWidth(rightText));
|
|
157
|
+
// Build hint lines - changes based on state (all branches truncate to width)
|
|
158
|
+
let hintLine1;
|
|
159
|
+
let hintLine2;
|
|
160
|
+
if (this.confirmingDeletePath !== null) {
|
|
161
|
+
const confirmHint = `Delete session? ${keyHint("tui.select.confirm", "confirm", this.keybindings)} · ${keyHint("tui.select.cancel", "cancel", this.keybindings)}`;
|
|
162
|
+
hintLine1 = theme.fg("error", truncateToWidth(confirmHint, width, "…"));
|
|
163
|
+
hintLine2 = "";
|
|
164
|
+
}
|
|
165
|
+
else if (this.statusMessage) {
|
|
166
|
+
const color = this.statusMessage.type === "error" ? "error" : "accent";
|
|
167
|
+
hintLine1 = theme.fg(color, truncateToWidth(this.statusMessage.message, width, "…"));
|
|
168
|
+
hintLine2 = "";
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const pathState = this.showPath ? "(on)" : "(off)";
|
|
172
|
+
const sep = theme.fg("muted", " · ");
|
|
173
|
+
const hint1 = keyHint("tui.input.tab", "scope", this.keybindings) + sep + theme.fg("muted", 're:<pattern> regex · "phrase" exact');
|
|
174
|
+
const hint2Parts = [
|
|
175
|
+
keyHint("app.session.toggleSort", "sort", this.keybindings),
|
|
176
|
+
keyHint("app.session.toggleNamedFilter", "named", this.keybindings),
|
|
177
|
+
keyHint("app.session.delete", "delete", this.keybindings),
|
|
178
|
+
keyHint("app.session.togglePath", `path ${pathState}`, this.keybindings),
|
|
179
|
+
];
|
|
180
|
+
if (this.showRenameHint) {
|
|
181
|
+
hint2Parts.push(keyHint("app.session.rename", "rename", this.keybindings));
|
|
182
|
+
}
|
|
183
|
+
const hint2 = hint2Parts.join(sep);
|
|
184
|
+
hintLine1 = truncateToWidth(hint1, width, "…");
|
|
185
|
+
hintLine2 = truncateToWidth(hint2, width, "…");
|
|
186
|
+
}
|
|
187
|
+
return [`${left}${" ".repeat(spacing)}${rightText}`, hintLine1, hintLine2];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Build a tree structure from sessions based on parentSessionPath.
|
|
192
|
+
* Returns root nodes sorted by modified date (descending).
|
|
193
|
+
*/
|
|
194
|
+
function buildSessionTree(sessions) {
|
|
195
|
+
const byPath = new Map();
|
|
196
|
+
for (const session of sessions) {
|
|
197
|
+
const sessionPath = canonicalizePath(session.path) ?? session.path;
|
|
198
|
+
byPath.set(sessionPath, { session, children: [], latestActivity: session.modified.getTime() });
|
|
199
|
+
}
|
|
200
|
+
const roots = [];
|
|
201
|
+
for (const session of sessions) {
|
|
202
|
+
const sessionPath = canonicalizePath(session.path) ?? session.path;
|
|
203
|
+
const node = byPath.get(sessionPath);
|
|
204
|
+
const parentPath = canonicalizePath(session.parentSessionPath);
|
|
205
|
+
if (parentPath && byPath.has(parentPath)) {
|
|
206
|
+
byPath.get(parentPath).children.push(node);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
roots.push(node);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const updateLatestActivity = (node) => {
|
|
213
|
+
let latestActivity = node.session.modified.getTime();
|
|
214
|
+
for (const child of node.children) {
|
|
215
|
+
latestActivity = Math.max(latestActivity, updateLatestActivity(child));
|
|
216
|
+
}
|
|
217
|
+
node.latestActivity = latestActivity;
|
|
218
|
+
return latestActivity;
|
|
219
|
+
};
|
|
220
|
+
for (const root of roots) {
|
|
221
|
+
updateLatestActivity(root);
|
|
222
|
+
}
|
|
223
|
+
// Sort children and roots by latest activity in each subtree (descending)
|
|
224
|
+
const sortNodes = (nodes) => {
|
|
225
|
+
nodes.sort((a, b) => b.latestActivity - a.latestActivity);
|
|
226
|
+
for (const node of nodes) {
|
|
227
|
+
sortNodes(node.children);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
sortNodes(roots);
|
|
231
|
+
return roots;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Flatten tree into display list with tree structure metadata.
|
|
235
|
+
*/
|
|
236
|
+
function flattenSessionTree(roots) {
|
|
237
|
+
const result = [];
|
|
238
|
+
const walk = (node, depth, ancestorContinues, isLast) => {
|
|
239
|
+
result.push({ session: node.session, depth, isLast, ancestorContinues });
|
|
240
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
241
|
+
const childIsLast = i === node.children.length - 1;
|
|
242
|
+
// Only show continuation line for non-root ancestors
|
|
243
|
+
const continues = depth > 0 ? !isLast : false;
|
|
244
|
+
walk(node.children[i], depth + 1, [...ancestorContinues, continues], childIsLast);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
for (let i = 0; i < roots.length; i++) {
|
|
248
|
+
walk(roots[i], 0, [], i === roots.length - 1);
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Custom session list component with multi-line items and search
|
|
254
|
+
*/
|
|
255
|
+
class SessionList {
|
|
256
|
+
getSelectedSessionPath() {
|
|
257
|
+
const selected = this.filteredSessions[this.selectedIndex];
|
|
258
|
+
return selected?.session.path;
|
|
259
|
+
}
|
|
260
|
+
allSessions = [];
|
|
261
|
+
filteredSessions = [];
|
|
262
|
+
selectedIndex = 0;
|
|
263
|
+
searchInput;
|
|
264
|
+
showCwd = false;
|
|
265
|
+
sortMode = "threaded";
|
|
266
|
+
nameFilter = "all";
|
|
267
|
+
keybindings;
|
|
268
|
+
showPath = false;
|
|
269
|
+
confirmingDeletePath = null;
|
|
270
|
+
currentSessionCanonicalPath;
|
|
271
|
+
onSelect;
|
|
272
|
+
onCancel;
|
|
273
|
+
onExit = () => { };
|
|
274
|
+
onToggleScope;
|
|
275
|
+
onToggleSort;
|
|
276
|
+
onToggleNameFilter;
|
|
277
|
+
onTogglePath;
|
|
278
|
+
onDeleteConfirmationChange;
|
|
279
|
+
onDeleteSession;
|
|
280
|
+
onRenameSession;
|
|
281
|
+
onError;
|
|
282
|
+
maxVisible = 10; // Max sessions visible (one line each)
|
|
283
|
+
// Focusable implementation - propagate to searchInput for IME cursor positioning
|
|
284
|
+
_focused = false;
|
|
285
|
+
get focused() {
|
|
286
|
+
return this._focused;
|
|
287
|
+
}
|
|
288
|
+
set focused(value) {
|
|
289
|
+
this._focused = value;
|
|
290
|
+
this.searchInput.focused = value;
|
|
291
|
+
}
|
|
292
|
+
constructor(sessions, showCwd, sortMode, nameFilter, keybindings, currentSessionFilePath) {
|
|
293
|
+
this.allSessions = sessions;
|
|
294
|
+
this.filteredSessions = [];
|
|
295
|
+
this.searchInput = new Input();
|
|
296
|
+
this.showCwd = showCwd;
|
|
297
|
+
this.sortMode = sortMode;
|
|
298
|
+
this.nameFilter = nameFilter;
|
|
299
|
+
this.keybindings = keybindings;
|
|
300
|
+
this.currentSessionCanonicalPath = canonicalizePath(currentSessionFilePath);
|
|
301
|
+
this.filterSessions("");
|
|
302
|
+
// Handle Enter in search input - select current item
|
|
303
|
+
this.searchInput.onSubmit = () => {
|
|
304
|
+
if (this.filteredSessions[this.selectedIndex]) {
|
|
305
|
+
const selected = this.filteredSessions[this.selectedIndex];
|
|
306
|
+
if (this.onSelect) {
|
|
307
|
+
this.onSelect(selected.session.path);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
setSortMode(sortMode) {
|
|
313
|
+
this.sortMode = sortMode;
|
|
314
|
+
this.filterSessions(this.searchInput.getValue());
|
|
315
|
+
}
|
|
316
|
+
setNameFilter(nameFilter) {
|
|
317
|
+
this.nameFilter = nameFilter;
|
|
318
|
+
this.filterSessions(this.searchInput.getValue());
|
|
319
|
+
}
|
|
320
|
+
setSessions(sessions, showCwd) {
|
|
321
|
+
this.allSessions = sessions;
|
|
322
|
+
this.showCwd = showCwd;
|
|
323
|
+
this.filterSessions(this.searchInput.getValue());
|
|
324
|
+
}
|
|
325
|
+
filterSessions(query) {
|
|
326
|
+
const trimmed = query.trim();
|
|
327
|
+
const nameFiltered = this.nameFilter === "all" ? this.allSessions : this.allSessions.filter((session) => hasSessionName(session));
|
|
328
|
+
if (this.sortMode === "threaded" && !trimmed) {
|
|
329
|
+
// Threaded mode without search: show tree structure
|
|
330
|
+
const roots = buildSessionTree(nameFiltered);
|
|
331
|
+
this.filteredSessions = flattenSessionTree(roots);
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
// Other modes or with search: flat list
|
|
335
|
+
const filtered = filterAndSortSessions(nameFiltered, query, this.sortMode, "all");
|
|
336
|
+
this.filteredSessions = filtered.map((session) => ({
|
|
337
|
+
session,
|
|
338
|
+
depth: 0,
|
|
339
|
+
isLast: true,
|
|
340
|
+
ancestorContinues: [],
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredSessions.length - 1));
|
|
344
|
+
}
|
|
345
|
+
setConfirmingDeletePath(path) {
|
|
346
|
+
this.confirmingDeletePath = path;
|
|
347
|
+
this.onDeleteConfirmationChange?.(path);
|
|
348
|
+
}
|
|
349
|
+
startDeleteConfirmationForSelectedSession() {
|
|
350
|
+
const selected = this.filteredSessions[this.selectedIndex];
|
|
351
|
+
if (!selected)
|
|
352
|
+
return;
|
|
353
|
+
// Prevent deleting current session
|
|
354
|
+
if (this.isCurrentSessionPath(selected.session.path)) {
|
|
355
|
+
this.onError?.("Cannot delete the currently active session");
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this.setConfirmingDeletePath(selected.session.path);
|
|
359
|
+
}
|
|
360
|
+
isCurrentSessionPath(path) {
|
|
361
|
+
if (!this.currentSessionCanonicalPath)
|
|
362
|
+
return false;
|
|
363
|
+
return (canonicalizePath(path) ?? path) === this.currentSessionCanonicalPath;
|
|
364
|
+
}
|
|
365
|
+
invalidate() { }
|
|
366
|
+
render(width) {
|
|
367
|
+
const lines = [];
|
|
368
|
+
// Render search input
|
|
369
|
+
lines.push(...this.searchInput.render(width));
|
|
370
|
+
lines.push(""); // Blank line after search
|
|
371
|
+
if (this.filteredSessions.length === 0) {
|
|
372
|
+
let emptyMessage;
|
|
373
|
+
if (this.nameFilter === "named") {
|
|
374
|
+
const toggleKey = keyText("app.session.toggleNamedFilter", this.keybindings);
|
|
375
|
+
if (this.showCwd) {
|
|
376
|
+
emptyMessage = ` No named sessions found. Press ${toggleKey} to show all.`;
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
emptyMessage = ` No named sessions in current folder. Press ${toggleKey} to show all, or Tab to view all.`;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
else if (this.showCwd) {
|
|
383
|
+
// "All" scope - no sessions anywhere that match filter
|
|
384
|
+
emptyMessage = " No sessions found";
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
// "Current folder" scope - hint to try "all"
|
|
388
|
+
emptyMessage = " No sessions in current folder. Press Tab to view all.";
|
|
389
|
+
}
|
|
390
|
+
lines.push(theme.fg("muted", truncateToWidth(emptyMessage, width, "…")));
|
|
391
|
+
return lines;
|
|
392
|
+
}
|
|
393
|
+
// Calculate visible range with scrolling
|
|
394
|
+
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredSessions.length - this.maxVisible));
|
|
395
|
+
const endIndex = Math.min(startIndex + this.maxVisible, this.filteredSessions.length);
|
|
396
|
+
// Render visible sessions (one line each with tree structure)
|
|
397
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
398
|
+
const node = this.filteredSessions[i];
|
|
399
|
+
const session = node.session;
|
|
400
|
+
const isSelected = i === this.selectedIndex;
|
|
401
|
+
const isConfirmingDelete = session.path === this.confirmingDeletePath;
|
|
402
|
+
const isCurrent = this.isCurrentSessionPath(session.path);
|
|
403
|
+
// Build tree prefix
|
|
404
|
+
const prefix = this.buildTreePrefix(node);
|
|
405
|
+
// Session display text (name or first message)
|
|
406
|
+
const hasName = !!session.name;
|
|
407
|
+
const displayText = session.name ?? session.firstMessage;
|
|
408
|
+
const normalizedMessage = displayText.replace(/[\x00-\x1f\x7f]/g, " ").trim();
|
|
409
|
+
// Right side: message count and age
|
|
410
|
+
const age = formatSessionDate(session.modified);
|
|
411
|
+
const msgCount = String(session.messageCount);
|
|
412
|
+
let rightPart = `${msgCount} ${age}`;
|
|
413
|
+
if (this.showCwd && session.cwd) {
|
|
414
|
+
rightPart = `${shortenPath(session.cwd)} ${rightPart}`;
|
|
415
|
+
}
|
|
416
|
+
if (this.showPath) {
|
|
417
|
+
rightPart = `${shortenPath(session.path)} ${rightPart}`;
|
|
418
|
+
}
|
|
419
|
+
// Cursor
|
|
420
|
+
const cursor = isSelected ? theme.fg("accent", "› ") : " ";
|
|
421
|
+
// Calculate available width for message
|
|
422
|
+
const prefixWidth = visibleWidth(prefix);
|
|
423
|
+
const rightWidth = visibleWidth(rightPart) + 2; // +2 for spacing
|
|
424
|
+
const availableForMsg = width - 2 - prefixWidth - rightWidth; // -2 for cursor
|
|
425
|
+
const truncatedMsg = truncateToWidth(normalizedMessage, Math.max(10, availableForMsg), "…");
|
|
426
|
+
// Style message
|
|
427
|
+
let messageColor = null;
|
|
428
|
+
if (isConfirmingDelete) {
|
|
429
|
+
messageColor = "error";
|
|
430
|
+
}
|
|
431
|
+
else if (isCurrent) {
|
|
432
|
+
messageColor = "accent";
|
|
433
|
+
}
|
|
434
|
+
else if (hasName) {
|
|
435
|
+
messageColor = "warning";
|
|
436
|
+
}
|
|
437
|
+
let styledMsg = messageColor ? theme.fg(messageColor, truncatedMsg) : truncatedMsg;
|
|
438
|
+
if (isSelected) {
|
|
439
|
+
styledMsg = theme.bold(styledMsg);
|
|
440
|
+
}
|
|
441
|
+
// Build line
|
|
442
|
+
const leftPart = cursor + theme.fg("dim", prefix) + styledMsg;
|
|
443
|
+
const leftWidth = visibleWidth(leftPart);
|
|
444
|
+
const spacing = Math.max(1, width - leftWidth - visibleWidth(rightPart));
|
|
445
|
+
const styledRight = theme.fg(isConfirmingDelete ? "error" : "dim", rightPart);
|
|
446
|
+
let line = leftPart + " ".repeat(spacing) + styledRight;
|
|
447
|
+
if (isSelected) {
|
|
448
|
+
line = theme.bg("selectedBg", line);
|
|
449
|
+
}
|
|
450
|
+
lines.push(truncateToWidth(line, width));
|
|
451
|
+
}
|
|
452
|
+
// Add scroll indicator if needed
|
|
453
|
+
if (startIndex > 0 || endIndex < this.filteredSessions.length) {
|
|
454
|
+
const scrollText = ` (${this.selectedIndex + 1}/${this.filteredSessions.length})`;
|
|
455
|
+
const scrollInfo = theme.fg("muted", truncateToWidth(scrollText, width, ""));
|
|
456
|
+
lines.push(scrollInfo);
|
|
457
|
+
}
|
|
458
|
+
return lines;
|
|
459
|
+
}
|
|
460
|
+
buildTreePrefix(node) {
|
|
461
|
+
if (node.depth === 0) {
|
|
462
|
+
return "";
|
|
463
|
+
}
|
|
464
|
+
const parts = node.ancestorContinues.map((continues) => (continues ? "│ " : " "));
|
|
465
|
+
const branch = node.isLast ? "└─ " : "├─ ";
|
|
466
|
+
return parts.join("") + branch;
|
|
467
|
+
}
|
|
468
|
+
handleInput(keyData) {
|
|
469
|
+
const kb = getKeybindings();
|
|
470
|
+
// Handle delete confirmation state first - intercept all keys
|
|
471
|
+
if (this.confirmingDeletePath !== null) {
|
|
472
|
+
if (kb.matches(keyData, "tui.select.confirm")) {
|
|
473
|
+
const pathToDelete = this.confirmingDeletePath;
|
|
474
|
+
this.setConfirmingDeletePath(null);
|
|
475
|
+
void this.onDeleteSession?.(pathToDelete);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
if (kb.matches(keyData, "tui.select.cancel")) {
|
|
479
|
+
this.setConfirmingDeletePath(null);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
// Ignore all other keys while confirming
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
if (kb.matches(keyData, "tui.input.tab")) {
|
|
486
|
+
if (this.onToggleScope) {
|
|
487
|
+
this.onToggleScope();
|
|
488
|
+
}
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (kb.matches(keyData, "app.session.toggleSort")) {
|
|
492
|
+
this.onToggleSort?.();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
if (this.keybindings.matches(keyData, "app.session.toggleNamedFilter")) {
|
|
496
|
+
this.onToggleNameFilter?.();
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
// Ctrl+P: toggle path display
|
|
500
|
+
if (kb.matches(keyData, "app.session.togglePath")) {
|
|
501
|
+
this.showPath = !this.showPath;
|
|
502
|
+
this.onTogglePath?.(this.showPath);
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
// Ctrl+D: initiate delete confirmation (useful on terminals that don't distinguish Ctrl+Backspace from Backspace)
|
|
506
|
+
if (kb.matches(keyData, "app.session.delete")) {
|
|
507
|
+
this.startDeleteConfirmationForSelectedSession();
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
// Rename selected session
|
|
511
|
+
if (kb.matches(keyData, "app.session.rename")) {
|
|
512
|
+
const selected = this.filteredSessions[this.selectedIndex];
|
|
513
|
+
if (selected) {
|
|
514
|
+
this.onRenameSession?.(selected.session.path);
|
|
515
|
+
}
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
// Ctrl+Backspace: non-invasive convenience alias for delete
|
|
519
|
+
// Only triggers deletion when the query is empty; otherwise it is forwarded to the input
|
|
520
|
+
if (kb.matches(keyData, "app.session.deleteNoninvasive")) {
|
|
521
|
+
if (this.searchInput.getValue().length > 0) {
|
|
522
|
+
this.searchInput.handleInput(keyData);
|
|
523
|
+
this.filterSessions(this.searchInput.getValue());
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
this.startDeleteConfirmationForSelectedSession();
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
// Up arrow
|
|
530
|
+
if (kb.matches(keyData, "tui.select.up")) {
|
|
531
|
+
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
532
|
+
}
|
|
533
|
+
// Down arrow
|
|
534
|
+
else if (kb.matches(keyData, "tui.select.down")) {
|
|
535
|
+
this.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + 1);
|
|
536
|
+
}
|
|
537
|
+
// Page up - jump up by maxVisible items
|
|
538
|
+
else if (kb.matches(keyData, "tui.select.pageUp")) {
|
|
539
|
+
this.selectedIndex = Math.max(0, this.selectedIndex - this.maxVisible);
|
|
540
|
+
}
|
|
541
|
+
// Page down - jump down by maxVisible items
|
|
542
|
+
else if (kb.matches(keyData, "tui.select.pageDown")) {
|
|
543
|
+
this.selectedIndex = Math.min(this.filteredSessions.length - 1, this.selectedIndex + this.maxVisible);
|
|
544
|
+
}
|
|
545
|
+
// Enter
|
|
546
|
+
else if (kb.matches(keyData, "tui.select.confirm")) {
|
|
547
|
+
const selected = this.filteredSessions[this.selectedIndex];
|
|
548
|
+
if (selected && this.onSelect) {
|
|
549
|
+
this.onSelect(selected.session.path);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
// Escape - cancel
|
|
553
|
+
else if (kb.matches(keyData, "tui.select.cancel")) {
|
|
554
|
+
if (this.onCancel) {
|
|
555
|
+
this.onCancel();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
// Pass everything else to search input
|
|
559
|
+
else {
|
|
560
|
+
this.searchInput.handleInput(keyData);
|
|
561
|
+
this.filterSessions(this.searchInput.getValue());
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Delete a session file, trying the `trash` CLI first, then falling back to unlink
|
|
567
|
+
*/
|
|
568
|
+
async function deleteSessionFile(sessionPath) {
|
|
569
|
+
// Try `trash` first (if installed)
|
|
570
|
+
const trashArgs = sessionPath.startsWith("-") ? ["--", sessionPath] : [sessionPath];
|
|
571
|
+
const trashResult = spawnSync("trash", trashArgs, { encoding: "utf-8" });
|
|
572
|
+
const getTrashErrorHint = () => {
|
|
573
|
+
const parts = [];
|
|
574
|
+
if (trashResult.error) {
|
|
575
|
+
parts.push(trashResult.error.message);
|
|
576
|
+
}
|
|
577
|
+
const stderr = trashResult.stderr?.trim();
|
|
578
|
+
if (stderr) {
|
|
579
|
+
parts.push(stderr.split("\n")[0] ?? stderr);
|
|
580
|
+
}
|
|
581
|
+
if (parts.length === 0)
|
|
582
|
+
return null;
|
|
583
|
+
return `trash: ${parts.join(" · ").slice(0, 200)}`;
|
|
584
|
+
};
|
|
585
|
+
// If trash reports success, or the file is gone afterwards, treat it as successful
|
|
586
|
+
if (trashResult.status === 0 || !existsSync(sessionPath)) {
|
|
587
|
+
return { ok: true, method: "trash" };
|
|
588
|
+
}
|
|
589
|
+
// Fallback to permanent deletion
|
|
590
|
+
try {
|
|
591
|
+
await unlink(sessionPath);
|
|
592
|
+
return { ok: true, method: "unlink" };
|
|
593
|
+
}
|
|
594
|
+
catch (err) {
|
|
595
|
+
const unlinkError = err instanceof Error ? err.message : String(err);
|
|
596
|
+
const trashErrorHint = getTrashErrorHint();
|
|
597
|
+
const error = trashErrorHint ? `${unlinkError} (${trashErrorHint})` : unlinkError;
|
|
598
|
+
return { ok: false, method: "unlink", error };
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Component that renders a session selector
|
|
603
|
+
*/
|
|
604
|
+
export class SessionSelectorComponent extends Container {
|
|
605
|
+
handleInput(data) {
|
|
606
|
+
if (this.mode === "rename") {
|
|
607
|
+
const kb = getKeybindings();
|
|
608
|
+
if (kb.matches(data, "tui.select.cancel")) {
|
|
609
|
+
this.exitRenameMode();
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
this.renameInput.handleInput(data);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
this.sessionList.handleInput(data);
|
|
616
|
+
}
|
|
617
|
+
canRename = true;
|
|
618
|
+
sessionList;
|
|
619
|
+
header;
|
|
620
|
+
keybindings;
|
|
621
|
+
scope = "current";
|
|
622
|
+
sortMode = "threaded";
|
|
623
|
+
nameFilter = "all";
|
|
624
|
+
currentSessions = null;
|
|
625
|
+
allSessions = null;
|
|
626
|
+
currentSessionsLoader;
|
|
627
|
+
allSessionsLoader;
|
|
628
|
+
requestRender;
|
|
629
|
+
renameSession;
|
|
630
|
+
currentLoading = false;
|
|
631
|
+
allLoading = false;
|
|
632
|
+
allLoadSeq = 0;
|
|
633
|
+
mode = "list";
|
|
634
|
+
renameInput = new Input();
|
|
635
|
+
renameTargetPath = null;
|
|
636
|
+
// Focusable implementation - propagate to sessionList for IME cursor positioning
|
|
637
|
+
_focused = false;
|
|
638
|
+
get focused() {
|
|
639
|
+
return this._focused;
|
|
640
|
+
}
|
|
641
|
+
set focused(value) {
|
|
642
|
+
this._focused = value;
|
|
643
|
+
this.sessionList.focused = value;
|
|
644
|
+
this.renameInput.focused = value;
|
|
645
|
+
if (value && this.mode === "rename") {
|
|
646
|
+
this.renameInput.focused = true;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
buildBaseLayout(content, options) {
|
|
650
|
+
this.clear();
|
|
651
|
+
this.addChild(new Spacer(1));
|
|
652
|
+
this.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
|
|
653
|
+
this.addChild(new Spacer(1));
|
|
654
|
+
if (options?.showHeader ?? true) {
|
|
655
|
+
this.addChild(this.header);
|
|
656
|
+
this.addChild(new Spacer(1));
|
|
657
|
+
}
|
|
658
|
+
this.addChild(content);
|
|
659
|
+
this.addChild(new Spacer(1));
|
|
660
|
+
this.addChild(new DynamicBorder((s) => theme.fg("accent", s)));
|
|
661
|
+
}
|
|
662
|
+
constructor(currentSessionsLoader, allSessionsLoader, onSelect, onCancel, onExit, requestRender, options, currentSessionFilePath) {
|
|
663
|
+
super();
|
|
664
|
+
this.keybindings = options?.keybindings ?? KeybindingsManager.create();
|
|
665
|
+
this.currentSessionsLoader = currentSessionsLoader;
|
|
666
|
+
this.allSessionsLoader = allSessionsLoader;
|
|
667
|
+
this.requestRender = requestRender;
|
|
668
|
+
this.header = new SessionSelectorHeader(this.scope, this.sortMode, this.nameFilter, this.requestRender, this.keybindings);
|
|
669
|
+
const renameSession = options?.renameSession;
|
|
670
|
+
this.renameSession = renameSession;
|
|
671
|
+
this.canRename = !!renameSession;
|
|
672
|
+
this.header.setShowRenameHint(options?.showRenameHint ?? this.canRename);
|
|
673
|
+
// Create session list (starts empty, will be populated after load)
|
|
674
|
+
this.sessionList = new SessionList([], false, this.sortMode, this.nameFilter, this.keybindings, currentSessionFilePath);
|
|
675
|
+
this.buildBaseLayout(this.sessionList);
|
|
676
|
+
this.renameInput.onSubmit = (value) => {
|
|
677
|
+
void this.confirmRename(value);
|
|
678
|
+
};
|
|
679
|
+
// Ensure header status timeouts are cleared when leaving the selector
|
|
680
|
+
const clearStatusMessage = () => this.header.setStatusMessage(null);
|
|
681
|
+
this.sessionList.onSelect = (sessionPath) => {
|
|
682
|
+
clearStatusMessage();
|
|
683
|
+
onSelect(sessionPath);
|
|
684
|
+
};
|
|
685
|
+
this.sessionList.onCancel = () => {
|
|
686
|
+
clearStatusMessage();
|
|
687
|
+
onCancel();
|
|
688
|
+
};
|
|
689
|
+
this.sessionList.onExit = () => {
|
|
690
|
+
clearStatusMessage();
|
|
691
|
+
onExit();
|
|
692
|
+
};
|
|
693
|
+
this.sessionList.onToggleScope = () => this.toggleScope();
|
|
694
|
+
this.sessionList.onToggleSort = () => this.toggleSortMode();
|
|
695
|
+
this.sessionList.onToggleNameFilter = () => this.toggleNameFilter();
|
|
696
|
+
this.sessionList.onRenameSession = (sessionPath) => {
|
|
697
|
+
if (!renameSession)
|
|
698
|
+
return;
|
|
699
|
+
if (this.scope === "current" && this.currentLoading)
|
|
700
|
+
return;
|
|
701
|
+
if (this.scope === "all" && this.allLoading)
|
|
702
|
+
return;
|
|
703
|
+
const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
|
|
704
|
+
const session = sessions.find((s) => s.path === sessionPath);
|
|
705
|
+
this.enterRenameMode(sessionPath, session?.name);
|
|
706
|
+
};
|
|
707
|
+
// Sync list events to header
|
|
708
|
+
this.sessionList.onTogglePath = (showPath) => {
|
|
709
|
+
this.header.setShowPath(showPath);
|
|
710
|
+
this.requestRender();
|
|
711
|
+
};
|
|
712
|
+
this.sessionList.onDeleteConfirmationChange = (path) => {
|
|
713
|
+
this.header.setConfirmingDeletePath(path);
|
|
714
|
+
this.requestRender();
|
|
715
|
+
};
|
|
716
|
+
this.sessionList.onError = (msg) => {
|
|
717
|
+
this.header.setStatusMessage({ type: "error", message: msg }, 3000);
|
|
718
|
+
this.requestRender();
|
|
719
|
+
};
|
|
720
|
+
// Handle session deletion
|
|
721
|
+
this.sessionList.onDeleteSession = async (sessionPath) => {
|
|
722
|
+
const result = await deleteSessionFile(sessionPath);
|
|
723
|
+
if (result.ok) {
|
|
724
|
+
if (this.currentSessions) {
|
|
725
|
+
this.currentSessions = this.currentSessions.filter((s) => s.path !== sessionPath);
|
|
726
|
+
}
|
|
727
|
+
if (this.allSessions) {
|
|
728
|
+
this.allSessions = this.allSessions.filter((s) => s.path !== sessionPath);
|
|
729
|
+
}
|
|
730
|
+
const sessions = this.scope === "all" ? (this.allSessions ?? []) : (this.currentSessions ?? []);
|
|
731
|
+
const showCwd = this.scope === "all";
|
|
732
|
+
this.sessionList.setSessions(sessions, showCwd);
|
|
733
|
+
const msg = result.method === "trash" ? "Session moved to trash" : "Session deleted";
|
|
734
|
+
this.header.setStatusMessage({ type: "info", message: msg }, 2000);
|
|
735
|
+
await this.refreshSessionsAfterMutation();
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
const errorMessage = result.error ?? "Unknown error";
|
|
739
|
+
this.header.setStatusMessage({ type: "error", message: `Failed to delete: ${errorMessage}` }, 3000);
|
|
740
|
+
}
|
|
741
|
+
this.requestRender();
|
|
742
|
+
};
|
|
743
|
+
// Start loading current sessions immediately
|
|
744
|
+
this.loadCurrentSessions();
|
|
745
|
+
}
|
|
746
|
+
loadCurrentSessions() {
|
|
747
|
+
void this.loadScope("current", "initial");
|
|
748
|
+
}
|
|
749
|
+
enterRenameMode(sessionPath, currentName) {
|
|
750
|
+
this.mode = "rename";
|
|
751
|
+
this.renameTargetPath = sessionPath;
|
|
752
|
+
this.renameInput.setValue(currentName ?? "");
|
|
753
|
+
this.renameInput.focused = true;
|
|
754
|
+
const panel = new Container();
|
|
755
|
+
panel.addChild(new Text(theme.bold("Rename Session"), 1, 0));
|
|
756
|
+
panel.addChild(new Spacer(1));
|
|
757
|
+
panel.addChild(this.renameInput);
|
|
758
|
+
panel.addChild(new Spacer(1));
|
|
759
|
+
panel.addChild(new Text(theme.fg("muted", `${keyText("tui.select.confirm", this.keybindings)} to save · ${keyText("tui.select.cancel", this.keybindings)} to cancel`), 1, 0));
|
|
760
|
+
this.buildBaseLayout(panel, { showHeader: false });
|
|
761
|
+
this.requestRender();
|
|
762
|
+
}
|
|
763
|
+
exitRenameMode() {
|
|
764
|
+
this.mode = "list";
|
|
765
|
+
this.renameTargetPath = null;
|
|
766
|
+
this.buildBaseLayout(this.sessionList);
|
|
767
|
+
this.requestRender();
|
|
768
|
+
}
|
|
769
|
+
async confirmRename(value) {
|
|
770
|
+
const next = value.trim();
|
|
771
|
+
if (!next)
|
|
772
|
+
return;
|
|
773
|
+
const target = this.renameTargetPath;
|
|
774
|
+
if (!target) {
|
|
775
|
+
this.exitRenameMode();
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
// Find current name for callback
|
|
779
|
+
const renameSession = this.renameSession;
|
|
780
|
+
if (!renameSession) {
|
|
781
|
+
this.exitRenameMode();
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
try {
|
|
785
|
+
await renameSession(target, next);
|
|
786
|
+
await this.refreshSessionsAfterMutation();
|
|
787
|
+
}
|
|
788
|
+
finally {
|
|
789
|
+
this.exitRenameMode();
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
async loadScope(scope, reason) {
|
|
793
|
+
const showCwd = scope === "all";
|
|
794
|
+
// Mark loading
|
|
795
|
+
if (scope === "current") {
|
|
796
|
+
this.currentLoading = true;
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
this.allLoading = true;
|
|
800
|
+
}
|
|
801
|
+
const seq = scope === "all" ? ++this.allLoadSeq : undefined;
|
|
802
|
+
this.header.setScope(scope);
|
|
803
|
+
this.header.setLoading(true);
|
|
804
|
+
this.requestRender();
|
|
805
|
+
const onProgress = (loaded, total) => {
|
|
806
|
+
if (scope !== this.scope)
|
|
807
|
+
return;
|
|
808
|
+
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
809
|
+
return;
|
|
810
|
+
this.header.setProgress(loaded, total);
|
|
811
|
+
this.requestRender();
|
|
812
|
+
};
|
|
813
|
+
try {
|
|
814
|
+
const sessions = await (scope === "current"
|
|
815
|
+
? this.currentSessionsLoader(onProgress)
|
|
816
|
+
: this.allSessionsLoader(onProgress));
|
|
817
|
+
if (scope === "current") {
|
|
818
|
+
this.currentSessions = sessions;
|
|
819
|
+
this.currentLoading = false;
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
this.allSessions = sessions;
|
|
823
|
+
this.allLoading = false;
|
|
824
|
+
}
|
|
825
|
+
if (scope !== this.scope)
|
|
826
|
+
return;
|
|
827
|
+
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
828
|
+
return;
|
|
829
|
+
this.header.setLoading(false);
|
|
830
|
+
this.sessionList.setSessions(sessions, showCwd);
|
|
831
|
+
this.requestRender();
|
|
832
|
+
}
|
|
833
|
+
catch (err) {
|
|
834
|
+
if (scope === "current") {
|
|
835
|
+
this.currentLoading = false;
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
this.allLoading = false;
|
|
839
|
+
}
|
|
840
|
+
if (scope !== this.scope)
|
|
841
|
+
return;
|
|
842
|
+
if (seq !== undefined && seq !== this.allLoadSeq)
|
|
843
|
+
return;
|
|
844
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
845
|
+
this.header.setLoading(false);
|
|
846
|
+
this.header.setStatusMessage({ type: "error", message: `Failed to load sessions: ${message}` }, 4000);
|
|
847
|
+
if (reason === "initial") {
|
|
848
|
+
this.sessionList.setSessions([], showCwd);
|
|
849
|
+
}
|
|
850
|
+
this.requestRender();
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
toggleSortMode() {
|
|
854
|
+
// Cycle: threaded -> recent -> relevance -> threaded
|
|
855
|
+
this.sortMode = this.sortMode === "threaded" ? "recent" : this.sortMode === "recent" ? "relevance" : "threaded";
|
|
856
|
+
this.header.setSortMode(this.sortMode);
|
|
857
|
+
this.sessionList.setSortMode(this.sortMode);
|
|
858
|
+
this.requestRender();
|
|
859
|
+
}
|
|
860
|
+
toggleNameFilter() {
|
|
861
|
+
this.nameFilter = this.nameFilter === "all" ? "named" : "all";
|
|
862
|
+
this.header.setNameFilter(this.nameFilter);
|
|
863
|
+
this.sessionList.setNameFilter(this.nameFilter);
|
|
864
|
+
this.requestRender();
|
|
865
|
+
}
|
|
866
|
+
async refreshSessionsAfterMutation() {
|
|
867
|
+
await this.loadScope(this.scope, "refresh");
|
|
868
|
+
}
|
|
869
|
+
toggleScope() {
|
|
870
|
+
if (this.scope === "current") {
|
|
871
|
+
this.scope = "all";
|
|
872
|
+
this.header.setScope(this.scope);
|
|
873
|
+
if (this.allSessions !== null) {
|
|
874
|
+
this.header.setLoading(false);
|
|
875
|
+
this.sessionList.setSessions(this.allSessions, true);
|
|
876
|
+
this.requestRender();
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
if (!this.allLoading) {
|
|
880
|
+
void this.loadScope("all", "toggle");
|
|
881
|
+
}
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
this.scope = "current";
|
|
885
|
+
this.header.setScope(this.scope);
|
|
886
|
+
this.header.setLoading(this.currentLoading);
|
|
887
|
+
this.sessionList.setSessions(this.currentSessions ?? [], false);
|
|
888
|
+
this.requestRender();
|
|
889
|
+
}
|
|
890
|
+
getSessionList() {
|
|
891
|
+
return this.sessionList;
|
|
892
|
+
}
|
|
893
|
+
}
|