@timurproko/a1 0.1.8-dev.50ebb19 → 0.1.8-dev.510
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 +209 -63
- 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 +37 -0
- package/dist/app/session-shell/prompt-suggestion-controller.js +219 -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 +275 -0
- package/dist/app/session-shell/session-shell-root.js +1376 -0
- package/dist/app/session-shell/session-shell.d.ts +66 -0
- package/dist/app/session-shell/session-shell.js +2116 -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 +154 -0
- package/dist/composition/settings-route-host.d.ts +20 -0
- package/dist/composition/settings-route-host.js +141 -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 +374 -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 +9 -0
- package/dist/features/owned-ui/index.js +6 -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/reference-routes.d.ts +6 -0
- package/dist/features/owned-ui/reference-routes.js +6 -0
- package/dist/features/owned-ui/reference-screen-app.d.ts +37 -0
- package/dist/features/owned-ui/reference-screen-app.js +232 -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 +802 -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 +23 -0
- package/dist/integrations/pi/components/index.js +14 -0
- package/dist/integrations/pi/components/models-dialog.d.ts +55 -0
- package/dist/integrations/pi/components/models-dialog.js +310 -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.d.ts +21 -0
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +322 -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 +249 -0
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +53 -0
- package/dist/integrations/pi/components/shell-presenters-info.js +134 -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 +133 -0
- package/dist/integrations/pi/components/shell-selectors-dialogs.js +255 -0
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +225 -0
- package/dist/integrations/pi/components/shell-shared-facade.js +92 -0
- package/dist/integrations/pi/components/skills-command.d.ts +47 -0
- package/dist/integrations/pi/components/skills-command.js +118 -0
- package/dist/integrations/pi/components/skills-dialog.d.ts +9 -0
- package/dist/integrations/pi/components/skills-dialog.js +112 -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 +52 -0
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +222 -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 +139 -0
- package/dist/integrations/pi/engine/adapter.js +660 -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 +50 -0
- package/dist/integrations/pi/engine/resource-catalog.js +299 -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 +66 -0
- package/dist/integrations/pi/engine/workflow-contexts.js +360 -0
- package/dist/integrations/pi/engine/workflow-runner.d.ts +60 -0
- package/dist/integrations/pi/engine/workflow-runner.js +533 -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 +275 -0
- package/dist/integrations/pi/engine/workflows.js +71 -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 +72 -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 +127 -0
- package/dist/ui/settings/declarations.js +124 -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 +92 -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 +61 -6
- package/docs/ci-release-runbook.md +256 -79
- package/docs/features/launch-profiles.md +24 -17
- package/docs/features/modal-content-interaction.md +38 -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.d.ts +0 -11
- 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}/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,1376 @@
|
|
|
1
|
+
import { acceptsTranscriptUpdate } from "../../contracts/owned-ui/index.js";
|
|
2
|
+
import { caretCell } from "../../ui/components/line-input.js";
|
|
3
|
+
import { PromptInput, promptArrow } from "../../ui/components/prompt-input.js";
|
|
4
|
+
import { composeSubmittedPromptRows, formatSubmittedPromptTime, submittedPromptLayout, } from "../../ui/components/submitted-prompt.js";
|
|
5
|
+
import { backgroundSgrSpan, heldNativeHyperlinkStyle, hyperlinkSgrSpan, nativeHyperlinkStyle, overlaySpan, } from "../../ui/components/spans.js";
|
|
6
|
+
import { progressStatusText } from "../../ui/components/progress-status.js";
|
|
7
|
+
import { displayWidth, faint, stripAnsi } from "../../ui/components/text.js";
|
|
8
|
+
import { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_WORKFLOW_COMMAND_NAMES } from "../../integrations/pi/engine/workflows.js";
|
|
9
|
+
import { createPiExtensionUiBridge } from "../../integrations/pi/components/shell-extension-ui.js";
|
|
10
|
+
import { createPiShellEditor } from "../../integrations/pi/components/shell-editor-autocomplete.js";
|
|
11
|
+
import { createPiQueuedInputStatus, createPiShellFooter, createPiShellHeader, createPiShellLoadedResources, createPiShellStatus, } from "../../integrations/pi/components/shell-footer-status.js";
|
|
12
|
+
import { createPiShellArmin, createPiShellAuthProviderSelector, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellExtensionSelector, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, } from "../../integrations/pi/components/shell-selectors-dialogs.js";
|
|
13
|
+
import { createPiShellChangelog, createPiShellCollapsedChangelog, createPiShellHotkeys, createPiShellSessionInfo, renderPiShellCommandMessage, renderPiShellStatusText, } from "../../integrations/pi/components/shell-presenters-info.js";
|
|
14
|
+
import { createPiShellTranscriptComponent, isPiPromptStyleCompaction, paintPiSubmittedPromptTimestamp, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellTranscriptBlock, } from "../../integrations/pi/components/shell-presenters-transcript.js";
|
|
15
|
+
import { onPiThemeChange, PINNED_PI_LAYOUT, piTheme } from "../../integrations/pi/components/upstream/theme/theme.js";
|
|
16
|
+
import { piShellHyperlink, piShellTruncateToWidth, piShellVisibleWidth, } from "../../integrations/pi/components/shell-shared-facade.js";
|
|
17
|
+
import { classifyPiTuiInput, } from "../../integrations/pi/tui-runtime/input-presentation-coordinator.js";
|
|
18
|
+
import { PromptChipStore } from "./prompt-chips.js";
|
|
19
|
+
import { EditorHyperlinkBudget } from "./editor-hyperlink-budget.js";
|
|
20
|
+
import { SessionViewportController } from "./session-viewport-controller.js";
|
|
21
|
+
import { canPreparePasteInline } from "./paste-text-preparation.js";
|
|
22
|
+
/** Composes backend session state into the owned transcript, viewport, editor, and dock presentation. */
|
|
23
|
+
export class OwnedUiSessionShellRoot {
|
|
24
|
+
editor;
|
|
25
|
+
header;
|
|
26
|
+
resources;
|
|
27
|
+
#cwd;
|
|
28
|
+
#transcript = new Map();
|
|
29
|
+
#blocksById = new Map();
|
|
30
|
+
#renderedRows = new Map();
|
|
31
|
+
// Performance: document layouts are shared by wheel, rail, jump, and selection frames.
|
|
32
|
+
#documentLayouts = new Map();
|
|
33
|
+
#themeUnsubscribe;
|
|
34
|
+
#transcriptOrder = [];
|
|
35
|
+
#view;
|
|
36
|
+
#status;
|
|
37
|
+
#footer;
|
|
38
|
+
#queued;
|
|
39
|
+
#extensionRenderers;
|
|
40
|
+
#imageAssets;
|
|
41
|
+
#promptChips;
|
|
42
|
+
#editorHyperlinks = new EditorHyperlinkBudget();
|
|
43
|
+
#pasteDiagnosticId = 0;
|
|
44
|
+
#terminalPasteDiagnosticRequest;
|
|
45
|
+
#customViewport;
|
|
46
|
+
#submittedPromptComposer;
|
|
47
|
+
#viewportController;
|
|
48
|
+
#viewportTheme;
|
|
49
|
+
#onViewportFrame;
|
|
50
|
+
#onInputSurfaceChanged;
|
|
51
|
+
#componentRuntime;
|
|
52
|
+
#toolsExpanded = false;
|
|
53
|
+
#thinkingVisible = true;
|
|
54
|
+
#mermaidRenderingMode = "off";
|
|
55
|
+
#showImages = true;
|
|
56
|
+
#imageWidthCells = 80;
|
|
57
|
+
#outputPad = 1;
|
|
58
|
+
#workflowTranscriptSequence = 0;
|
|
59
|
+
#workflowStatusAnchors = new Map();
|
|
60
|
+
#workflowStatusMessages = new Map();
|
|
61
|
+
#lastWorkflowStatusId;
|
|
62
|
+
// Invariant: the notice is dock chrome, never transcript content; the custom viewport alone uses it.
|
|
63
|
+
#dockNotice;
|
|
64
|
+
#inputSurface;
|
|
65
|
+
#inputSurfaceCoordination = "editor";
|
|
66
|
+
#dockInputReuseEnabled;
|
|
67
|
+
#dockInputCandidate = false;
|
|
68
|
+
// Invariant: receipt-time eligibility is evidence, never authorization for composition-time reuse.
|
|
69
|
+
#dockInputRevision;
|
|
70
|
+
#visibleViewportSnapshot;
|
|
71
|
+
#fullViewportCompositions = 0;
|
|
72
|
+
#dockOnlyViewportCompositions = 0;
|
|
73
|
+
#transcriptBlockRenders = 0;
|
|
74
|
+
#extensionHeader = null;
|
|
75
|
+
#extensionFooter = null;
|
|
76
|
+
#extensionWidgets = new Map();
|
|
77
|
+
#extensionStatuses = new Map();
|
|
78
|
+
#extensionWorkingMessage;
|
|
79
|
+
#extensionWorkingVisible = true;
|
|
80
|
+
constructor(view, cwd, handlers, startup = {}, agentDir, extensionRenderers = {
|
|
81
|
+
getMessageRenderer: () => undefined,
|
|
82
|
+
getToolDefinition: () => undefined,
|
|
83
|
+
}, sessionLayout = "pinned", imageAssets) {
|
|
84
|
+
this.#view = view;
|
|
85
|
+
this.#customViewport = sessionLayout === "custom-viewport";
|
|
86
|
+
this.#promptChips = new PromptChipStore({ isolated: this.#customViewport,
|
|
87
|
+
...(handlers.pasteDiagnostics === undefined ? {} : { onEvent: handlers.pasteDiagnostics }),
|
|
88
|
+
...(handlers.pastePreparation === undefined ? {} : { preparation: handlers.pastePreparation }) });
|
|
89
|
+
this.#submittedPromptComposer = this.#customViewport
|
|
90
|
+
? {
|
|
91
|
+
layout: submittedPromptLayout,
|
|
92
|
+
compose: (rows, width, source, style) => composeSubmittedPromptRows(rows, width, source, { ...style, prefix: text => promptArrow(text, piTheme()) })
|
|
93
|
+
.map(row => nativeHyperlinkStyle(row, nativeTranscriptLinkColor)),
|
|
94
|
+
}
|
|
95
|
+
: undefined;
|
|
96
|
+
this.#cwd = cwd;
|
|
97
|
+
this.#extensionRenderers = extensionRenderers;
|
|
98
|
+
this.#imageAssets = imageAssets;
|
|
99
|
+
this.#componentRuntime = handlers;
|
|
100
|
+
this.#onViewportFrame = handlers.onViewportFrame;
|
|
101
|
+
this.#onInputSurfaceChanged = handlers.onInputSurfaceChanged;
|
|
102
|
+
this.#dockInputReuseEnabled = handlers.enableDockInputReuse ?? true;
|
|
103
|
+
this.header = createPiShellHeader({
|
|
104
|
+
...startup,
|
|
105
|
+
...(this.#customViewport ? { getKeybindings: () => this.editor.keybindingConfig() } : {}),
|
|
106
|
+
});
|
|
107
|
+
this.resources = createPiShellLoadedResources(startup.resources ?? [], startup.expanded ?? false);
|
|
108
|
+
this.#status = createPiShellStatus(view, progressStatusText, handlers);
|
|
109
|
+
this.#status.setProgressPresentation(this.#customViewport ? "custom-viewport" : "pinned");
|
|
110
|
+
this.#footer = createPiShellFooter(this.#viewWithExtensionStatuses(view), cwd, this.#customViewport ? "a1" : "pi");
|
|
111
|
+
this.#queued = createPiQueuedInputStatus(view.editor.queuedSubmissions, this.#customViewport ? "custom-viewport" : "pinned");
|
|
112
|
+
this.editor = createPiShellEditor({
|
|
113
|
+
...handlers,
|
|
114
|
+
keybindingProfile: this.#customViewport ? "a1" : "pi",
|
|
115
|
+
paintEditorSelection: (line, from, to, atomic) => backgroundSgrSpan(line, from, to, atomic ? "\u001b[7m" : "\u001b[27m\u001b[48;2;38;79;120m", atomic ? "\u001b[27m" : "\u001b[49m", piShellVisibleWidth),
|
|
116
|
+
transformPastedContent: content => {
|
|
117
|
+
try {
|
|
118
|
+
return this.#promptChips.transformPastedContent(content, this.editor.getText());
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
handlers.onPasteRejected?.(error);
|
|
122
|
+
return "";
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
...(this.#customViewport ? {
|
|
126
|
+
beginClipboardPaste: () => this.#promptChips.beginPaste(this.editor.getText(), handlers.captureClipboardPaste?.() ?? { kind: "provided", read: signal => handlers.readClipboardContent?.(signal) ?? Promise.resolve(null) }, error => handlers.onPasteRejected?.(error), () => handlers.requestRender()),
|
|
127
|
+
onPasteInput: (bytes, phase) => {
|
|
128
|
+
try {
|
|
129
|
+
if (phase === "framing")
|
|
130
|
+
this.#terminalPasteDiagnosticRequest = --this.#pasteDiagnosticId;
|
|
131
|
+
const request = this.#terminalPasteDiagnosticRequest ?? --this.#pasteDiagnosticId;
|
|
132
|
+
handlers.pasteDiagnostics?.({ request, phase, bytes, atMs: performance.now(), pending: 0, transport: "terminal",
|
|
133
|
+
...(phase === "settled" ? { outcome: "ready" } : {}) });
|
|
134
|
+
if (phase === "settled")
|
|
135
|
+
this.#terminalPasteDiagnosticRequest = undefined;
|
|
136
|
+
}
|
|
137
|
+
catch { /* Invariant: payload-free diagnostics cannot interfere with the input path. */ }
|
|
138
|
+
},
|
|
139
|
+
deferTextPaste: text => !canPreparePasteInline(text),
|
|
140
|
+
beginTextPaste: text => this.#promptChips.beginPaste(this.editor.getText(), { kind: "text", text }, error => handlers.onPasteRejected?.(error)),
|
|
141
|
+
} : {}),
|
|
142
|
+
editorAtomicRanges: line => this.#promptChips.atomicRanges(line),
|
|
143
|
+
editorHiddenRanges: line => this.#promptChips.hiddenRanges(line),
|
|
144
|
+
decorateEditorRow: (row, width, rowIndex) => {
|
|
145
|
+
if (rowIndex === 0)
|
|
146
|
+
this.#editorHyperlinks.reset();
|
|
147
|
+
const plain = stripAnsi(row);
|
|
148
|
+
const ranges = this.#promptChips.hyperlinkRanges(plain);
|
|
149
|
+
if (ranges.length === 0 || !this.#editorHyperlinks.takeCleanup())
|
|
150
|
+
return row;
|
|
151
|
+
const linkResetAndTail = `\u001b]8;;\u001b\\\u001b[24m${" ".repeat(Math.max(0, width - piShellVisibleWidth(row)))}`;
|
|
152
|
+
// Platform: VS15 is zero-column and default-ignorable. It breaks Windows Terminal's
|
|
153
|
+
// plain-text URL detector only in the held-button paint; semantic text stays exact.
|
|
154
|
+
const paintRow = this.#viewportController.editorPointerSelecting
|
|
155
|
+
? row.replaceAll("https://", "https:\uFE0E//").replaceAll("http://", "http:\uFE0E//")
|
|
156
|
+
: row;
|
|
157
|
+
const decorated = this.#viewportController.editorPointerSelecting
|
|
158
|
+
? ranges.reduce((result, range) => backgroundSgrSpan(result, piShellVisibleWidth(plain.slice(0, range.start)), piShellVisibleWidth(plain.slice(0, range.end)), "\u001b[4:4m", "\u001b[24m", piShellVisibleWidth), paintRow)
|
|
159
|
+
: ranges.filter(range => this.#editorHyperlinks.take(range.target)).reduce((result, range) => hyperlinkSgrSpan(result, piShellVisibleWidth(plain.slice(0, range.start)), piShellVisibleWidth(plain.slice(0, range.end)), range.target, piShellVisibleWidth), row);
|
|
160
|
+
// Platform: Windows Terminal can retain stale native dotted-link cells when a mutable
|
|
161
|
+
// prompt replaces a longer URL. Explicit non-link spaces overwrite that tail.
|
|
162
|
+
return `${decorated}${linkResetAndTail}`;
|
|
163
|
+
},
|
|
164
|
+
expandCopiedEditorText: text => this.#promptChips.expandCopiedText(text),
|
|
165
|
+
cwd,
|
|
166
|
+
...(agentDir === undefined ? {} : { agentDir }),
|
|
167
|
+
onToolsExpand: () => this.#setToolsExpanded(!this.#toolsExpanded),
|
|
168
|
+
...(this.#customViewport ? {
|
|
169
|
+
promptPresentation: {
|
|
170
|
+
input: new PromptInput({ fg: (token, text) => piTheme().fg(token, text) }, {
|
|
171
|
+
measure: piShellVisibleWidth,
|
|
172
|
+
truncate: piShellTruncateToWidth,
|
|
173
|
+
}),
|
|
174
|
+
styleSuggestion: faint,
|
|
175
|
+
styleSuggestionCaret: caretCell,
|
|
176
|
+
},
|
|
177
|
+
} : {}),
|
|
178
|
+
onChange: text => {
|
|
179
|
+
handlers.onEditorChange?.(text);
|
|
180
|
+
// Concurrency: Pi clears before onSubmit; capture waiting references before pruning removed chips.
|
|
181
|
+
queueMicrotask(() => this.#promptChips.reconcileDraft(this.editor.getText()));
|
|
182
|
+
},
|
|
183
|
+
...(handlers.onPromptSuggestionAccepted === undefined ? {} : { onPromptSuggestionAccepted: handlers.onPromptSuggestionAccepted }),
|
|
184
|
+
});
|
|
185
|
+
this.#viewportController = new SessionViewportController({
|
|
186
|
+
enabled: this.#customViewport,
|
|
187
|
+
editor: this.editor,
|
|
188
|
+
requestRender: force => this.#componentRuntime.requestRender(force),
|
|
189
|
+
requestHyperlinkCleanup: rows => handlers.requestHyperlinkCleanup?.(rows),
|
|
190
|
+
hasEditorLinks: () => this.#promptChips.hyperlinkRanges(this.editor.getText()).length > 0,
|
|
191
|
+
...(handlers.pasteDiagnostics === undefined ? {} : { pasteDiagnostics: handlers.pasteDiagnostics }),
|
|
192
|
+
nextPasteDiagnosticRequest: () => --this.#pasteDiagnosticId,
|
|
193
|
+
});
|
|
194
|
+
// Performance: stable painter identities let the neutral viewport retain row-level
|
|
195
|
+
// selection variants while each callback still resolves the live Pi theme.
|
|
196
|
+
this.#viewportTheme = {
|
|
197
|
+
track: text => `${SCROLLBAR_CELL_RESET}${piTheme().fg("dim", text)}`,
|
|
198
|
+
thumb: text => `${SCROLLBAR_CELL_RESET}${piTheme().fg("accent", text)}`,
|
|
199
|
+
sticky: (text, hovered) => piTheme().bg(hovered ? "selectedBg" : "toolPendingBg", piTheme().fg("text", withoutTerminalBackground(text))),
|
|
200
|
+
quietSticky: text => `\u001b[2m${text.replace(/\u001b\[(?:0|22)m/g, "$&\u001b[2m")}\u001b[22m`,
|
|
201
|
+
bottomControl: (text, hovered) => piTheme().bg(hovered ? "selectedBg" : "toolPendingBg", piTheme().fg("text", text)),
|
|
202
|
+
selection: (line, from, to) => backgroundSgrSpan(line, from, to, "\u001b[48;2;38;79;120m", "\u001b[49m"),
|
|
203
|
+
};
|
|
204
|
+
this.editor.setThinkingLevel(view.thinkingLevel);
|
|
205
|
+
this.#inputSurface = this.editor;
|
|
206
|
+
for (const block of view.transcript) {
|
|
207
|
+
if (block.kind === "user")
|
|
208
|
+
this.editor.addToHistory(block.text);
|
|
209
|
+
}
|
|
210
|
+
this.#syncTranscript(view.transcript);
|
|
211
|
+
// Invariant: colours come from the active theme, so rendered rows outlive their revision only
|
|
212
|
+
// until the theme under them changes.
|
|
213
|
+
this.#themeUnsubscribe = onPiThemeChange(() => {
|
|
214
|
+
this.#renderedRows.clear();
|
|
215
|
+
this.#documentLayouts.clear();
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
setEditorPaddingX(padding) {
|
|
219
|
+
this.editor.setPaddingX(padding);
|
|
220
|
+
this.#documentLayouts.clear();
|
|
221
|
+
}
|
|
222
|
+
setAutocompleteMaxVisible(maxVisible) {
|
|
223
|
+
this.editor.setAutocompleteMaxVisible(maxVisible);
|
|
224
|
+
}
|
|
225
|
+
setOutputPad(padding) {
|
|
226
|
+
if (this.#outputPad === padding)
|
|
227
|
+
return;
|
|
228
|
+
this.#outputPad = padding;
|
|
229
|
+
this.#status.setOutputPad(padding);
|
|
230
|
+
for (const component of this.#transcript.values())
|
|
231
|
+
component.setOutputPad(padding);
|
|
232
|
+
this.#invalidateTranscriptPresentation();
|
|
233
|
+
}
|
|
234
|
+
setHideThinkingBlock(hidden) {
|
|
235
|
+
if (this.#thinkingVisible === !hidden)
|
|
236
|
+
return;
|
|
237
|
+
this.#thinkingVisible = !hidden;
|
|
238
|
+
for (const component of this.#transcript.values())
|
|
239
|
+
component.setHideThinkingBlock(hidden);
|
|
240
|
+
this.#invalidateTranscriptPresentation();
|
|
241
|
+
}
|
|
242
|
+
setMermaidRenderingMode(mode) {
|
|
243
|
+
if (this.#mermaidRenderingMode === mode)
|
|
244
|
+
return;
|
|
245
|
+
this.#mermaidRenderingMode = mode;
|
|
246
|
+
for (const component of this.#transcript.values())
|
|
247
|
+
component.setMermaidRenderingMode(mode);
|
|
248
|
+
this.#invalidateTranscriptPresentation();
|
|
249
|
+
}
|
|
250
|
+
setImagePresentation(showImages, imageWidthCells) {
|
|
251
|
+
if (this.#showImages === showImages && this.#imageWidthCells === imageWidthCells)
|
|
252
|
+
return;
|
|
253
|
+
this.#showImages = showImages;
|
|
254
|
+
this.#imageWidthCells = imageWidthCells;
|
|
255
|
+
for (const component of this.#transcript.values())
|
|
256
|
+
component.setImagePresentation(showImages, imageWidthCells);
|
|
257
|
+
this.#invalidateTranscriptPresentation();
|
|
258
|
+
}
|
|
259
|
+
prepareHistoryText(text) {
|
|
260
|
+
return this.#promptChips.prepareHistoryText(text);
|
|
261
|
+
}
|
|
262
|
+
rehydrateHistoryText(text, resolveImage) {
|
|
263
|
+
return this.#promptChips.rehydrateHistoryText(text, resolveImage);
|
|
264
|
+
}
|
|
265
|
+
imageChipAttachmentsFromEditor(text) {
|
|
266
|
+
return this.#promptChips.imageChipAttachments(text);
|
|
267
|
+
}
|
|
268
|
+
preparePromptSubmission(text) {
|
|
269
|
+
return this.#promptChips.prepareSubmission(text);
|
|
270
|
+
}
|
|
271
|
+
hasPendingPastes(text) { return this.#promptChips.hasPending(text); }
|
|
272
|
+
waitForPromptPastes(text, signal) {
|
|
273
|
+
return this.#promptChips.waitForPastes(text, signal, () => this.editor.getText());
|
|
274
|
+
}
|
|
275
|
+
resetPendingPastes() {
|
|
276
|
+
this.editor.cancelPendingPastes?.();
|
|
277
|
+
this.editor.setText(this.#promptChips.resetPastes(this.editor.getText()));
|
|
278
|
+
}
|
|
279
|
+
/** Forks the spare paste helper so the first paste of the session takes a live child. */
|
|
280
|
+
warmPastePreparation() { this.#promptChips.warm(); }
|
|
281
|
+
disposePendingPastes() {
|
|
282
|
+
this.resetPendingPastes();
|
|
283
|
+
return this.#promptChips.dispose();
|
|
284
|
+
}
|
|
285
|
+
promptSuggestionPrepareBlockReason() {
|
|
286
|
+
if (!this.usesDefaultInputSurface())
|
|
287
|
+
return "replacement-input";
|
|
288
|
+
if (this.#view.dialog !== null || this.#view.overlay !== null)
|
|
289
|
+
return "modal";
|
|
290
|
+
if (this.editor.getText().length > 0)
|
|
291
|
+
return "draft";
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
canPreparePromptSuggestion() { return this.promptSuggestionPrepareBlockReason() === null; }
|
|
295
|
+
promptSuggestionPresentationBlockReason() {
|
|
296
|
+
const reason = this.promptSuggestionPrepareBlockReason();
|
|
297
|
+
if (reason !== null)
|
|
298
|
+
return reason;
|
|
299
|
+
if (this.#view.lifecycle !== "ready")
|
|
300
|
+
return "not-ready";
|
|
301
|
+
return this.editor.promptSuggestionBlockReason?.()
|
|
302
|
+
?? (this.editor.canPresentPromptSuggestion() ? null : "presentation-unavailable");
|
|
303
|
+
}
|
|
304
|
+
canPresentPromptSuggestion() { return this.promptSuggestionPresentationBlockReason() === null; }
|
|
305
|
+
setPromptSuggestion(text) {
|
|
306
|
+
this.editor.setPromptSuggestion(text);
|
|
307
|
+
}
|
|
308
|
+
update(view) {
|
|
309
|
+
if (view.diagnostics.length !== this.#view.diagnostics.length
|
|
310
|
+
|| view.diagnostics.some((diagnostic, index) => diagnostic.sequence !== this.#view.diagnostics[index]?.sequence)) {
|
|
311
|
+
this.#documentLayouts.clear();
|
|
312
|
+
}
|
|
313
|
+
this.#view = view;
|
|
314
|
+
this.#status.update(view);
|
|
315
|
+
this.#footer.update(this.#viewWithExtensionStatuses(view));
|
|
316
|
+
this.#queued.update(view.editor.queuedSubmissions);
|
|
317
|
+
this.#syncTranscript(view.transcript);
|
|
318
|
+
this.editor.setSubmitEnabled(view.lifecycle !== "stopping" && view.lifecycle !== "stopped" && view.lifecycle !== "failed");
|
|
319
|
+
this.editor.setThinkingLevel(view.thinkingLevel);
|
|
320
|
+
// Performance: semantic updates already invalidate affected transcript blocks. Chrome is a separate authority.
|
|
321
|
+
this.#invalidateChrome();
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Applies one block: its component is created or updated in place and the order grows
|
|
325
|
+
* only when the block is new. A streamed chunk costs one component update rather than a
|
|
326
|
+
* walk of the whole transcript.
|
|
327
|
+
*/
|
|
328
|
+
applyTranscriptBlock(block) {
|
|
329
|
+
const current = this.#blocksById.get(block.id);
|
|
330
|
+
// Invariant: a full-view/final presentation may preempt queued partials. Never revive an older revision.
|
|
331
|
+
if (current !== undefined && !acceptsTranscriptUpdate(current, block))
|
|
332
|
+
return;
|
|
333
|
+
this.#blocksById.set(block.id, block);
|
|
334
|
+
const component = this.#transcript.get(block.id);
|
|
335
|
+
if (component === undefined) {
|
|
336
|
+
const created = this.#mountTranscript(block);
|
|
337
|
+
this.#transcript.set(block.id, created);
|
|
338
|
+
this.#transcriptOrder.push(block.id);
|
|
339
|
+
}
|
|
340
|
+
else if (component.revision !== block.revision) {
|
|
341
|
+
component.update(block);
|
|
342
|
+
}
|
|
343
|
+
// Performance: one chunk touches one block, and the updated component tracks its own dirtiness.
|
|
344
|
+
// Invalidating the whole shell here would re-wrap the entire transcript per chunk.
|
|
345
|
+
this.#renderedRows.delete(block.id);
|
|
346
|
+
this.#documentLayouts.clear();
|
|
347
|
+
}
|
|
348
|
+
#mountTranscript(block) {
|
|
349
|
+
// Invariant: the notice answers the reader's last command, so only their next prompt or
|
|
350
|
+
// shell command retires it; assistant, tool, and compaction blocks streaming in keep it.
|
|
351
|
+
if (block.kind === "user" || block.kind === "bash")
|
|
352
|
+
this.#dismissDockNotice();
|
|
353
|
+
const created = createPiShellTranscriptComponent(block, this.#cwd, this.#extensionRenderers, this.#submittedPromptComposer, this.#outputPad, !this.#thinkingVisible, this.#mermaidRenderingMode, this.#showImages, this.#imageWidthCells, this.#imageAssets, { ...this.#componentRuntime, changed: () => {
|
|
354
|
+
if (this.#transcript.get(block.id) !== created)
|
|
355
|
+
return;
|
|
356
|
+
this.#renderedRows.delete(block.id);
|
|
357
|
+
this.#documentLayouts.clear();
|
|
358
|
+
this.#visibleViewportSnapshot = undefined;
|
|
359
|
+
this.#dockInputCandidate = false;
|
|
360
|
+
this.#dockInputRevision = undefined;
|
|
361
|
+
this.#componentRuntime.requestRender();
|
|
362
|
+
} });
|
|
363
|
+
created.setExpanded(this.#toolsExpanded);
|
|
364
|
+
return created;
|
|
365
|
+
}
|
|
366
|
+
render(width) {
|
|
367
|
+
if (!this.#customViewport) {
|
|
368
|
+
this.#viewportController.setEditorPointerFrame(undefined);
|
|
369
|
+
return [...this.#renderDocument(width), ...this.#renderDock(width)];
|
|
370
|
+
}
|
|
371
|
+
const height = Math.max(0, this.#componentRuntime.getRows());
|
|
372
|
+
const dock = this.#renderDockLayout(width);
|
|
373
|
+
// Invariant: ordinary transcript content uses the full terminal width. The rail is an
|
|
374
|
+
// overlay, not a lost wrapping cell. Submitted prompts alone retain the
|
|
375
|
+
// intentional final gutter after their right-aligned timestamp.
|
|
376
|
+
const documentWidth = width;
|
|
377
|
+
const document = this.#renderDocumentLayout(documentWidth);
|
|
378
|
+
const steeringRows = this.#renderQueued(width);
|
|
379
|
+
const statusRows = this.#renderStatus(width);
|
|
380
|
+
const transientSignature = transientRowsSignature(steeringRows, statusRows);
|
|
381
|
+
const snapshot = this.#visibleViewportSnapshot;
|
|
382
|
+
const dockInputCandidate = this.#dockInputCandidate;
|
|
383
|
+
// Concurrency: input may change after a keyboard receipt but before its paint.
|
|
384
|
+
// Capture only the live inputs this composition will actually represent.
|
|
385
|
+
const inputSurface = this.#inputSurface;
|
|
386
|
+
const dockRows = dock.rows;
|
|
387
|
+
const selectableDocumentRowCount = document.rows.length;
|
|
388
|
+
const dockStartRow = height - dockRows.length + 1;
|
|
389
|
+
const editorOffset = dock.editorOffset;
|
|
390
|
+
this.#viewportController.setInputSurfaceFrame(this.usesDefaultInputSurface() ? undefined : {
|
|
391
|
+
component: this.#inputSurface,
|
|
392
|
+
columnStart: 1,
|
|
393
|
+
columnEnd: width,
|
|
394
|
+
rowStart: Math.max(1, dockStartRow + editorOffset),
|
|
395
|
+
rowEnd: Math.min(height, dockStartRow + editorOffset + dock.inputRows - 1),
|
|
396
|
+
});
|
|
397
|
+
this.#viewportController.setEditorPointerFrame(this.usesDefaultInputSurface()
|
|
398
|
+
? {
|
|
399
|
+
rowStart: dockStartRow + editorOffset,
|
|
400
|
+
rowEnd: dockStartRow + editorOffset + dock.inputRows - 1,
|
|
401
|
+
}
|
|
402
|
+
: undefined);
|
|
403
|
+
const viewportRevision = this.#viewportController.presentationRevision;
|
|
404
|
+
const selectionRevision = this.#viewportController.selectionRevision;
|
|
405
|
+
const pointerPosition = this.#viewportController.pointerPosition;
|
|
406
|
+
this.#dockInputCandidate = false;
|
|
407
|
+
let frame = dockInputCandidate
|
|
408
|
+
&& snapshot !== undefined
|
|
409
|
+
&& snapshot.width === width
|
|
410
|
+
&& snapshot.height === height
|
|
411
|
+
&& snapshot.documentRows === document.rows
|
|
412
|
+
&& snapshot.transientSignature === transientSignature
|
|
413
|
+
&& snapshot.promptAnchors === document.promptAnchors
|
|
414
|
+
&& snapshot.dockLength === dockRows.length
|
|
415
|
+
&& snapshot.inputSurface === inputSurface
|
|
416
|
+
&& snapshot.viewportRevision === viewportRevision
|
|
417
|
+
&& snapshot.selectionRevision === selectionRevision
|
|
418
|
+
? this.#viewportController.composeDockOnly(dockRows, width, height)
|
|
419
|
+
: null;
|
|
420
|
+
if (frame === null) {
|
|
421
|
+
frame = this.#viewportController.compose({
|
|
422
|
+
// Performance: do not copy the complete document on unchanged dock-only input.
|
|
423
|
+
// Steering and Working retain their one non-selectable viewport-tail ownership.
|
|
424
|
+
documentRows: [...document.rows, ...steeringRows, ...statusRows],
|
|
425
|
+
...(this.#viewportController.transcriptPointerSelecting
|
|
426
|
+
? { paintDocumentRow: heldNativeHyperlinkStyle }
|
|
427
|
+
: {}),
|
|
428
|
+
// Invariant: selection and copying stop at the real document tail; Steering,
|
|
429
|
+
// fitting alignment, and live Working remain transient presentation chrome.
|
|
430
|
+
selectableDocumentRowCount,
|
|
431
|
+
...(document.liveTailStartRow === undefined ? {} : { liveTailStartRow: document.liveTailStartRow }),
|
|
432
|
+
bottomAlignedTailRowCount: statusRows.length,
|
|
433
|
+
dockRows,
|
|
434
|
+
promptAnchors: document.promptAnchors,
|
|
435
|
+
width,
|
|
436
|
+
height,
|
|
437
|
+
// Invariant: the control belongs immediately above the complete dock and
|
|
438
|
+
// floats over transient viewport content rather than consuming a dock row.
|
|
439
|
+
bottomControlRow: Math.max(0, height - Math.min(height, dockRows.length) - 1),
|
|
440
|
+
theme: this.#viewportTheme,
|
|
441
|
+
});
|
|
442
|
+
this.#fullViewportCompositions += 1;
|
|
443
|
+
}
|
|
444
|
+
else
|
|
445
|
+
this.#dockOnlyViewportCompositions += 1;
|
|
446
|
+
this.#visibleViewportSnapshot = {
|
|
447
|
+
width,
|
|
448
|
+
height,
|
|
449
|
+
documentRows: document.rows,
|
|
450
|
+
transientSignature,
|
|
451
|
+
promptAnchors: document.promptAnchors,
|
|
452
|
+
dockLength: dockRows.length,
|
|
453
|
+
inputSurface,
|
|
454
|
+
// Invariant: a callback during composition cannot bless older rows with its
|
|
455
|
+
// newer revision. Its ordinary pending render will publish the newer state.
|
|
456
|
+
viewportRevision,
|
|
457
|
+
selectionRevision: frame.descriptor.selectionRevision,
|
|
458
|
+
pointerPosition,
|
|
459
|
+
};
|
|
460
|
+
this.#onViewportFrame?.(frame);
|
|
461
|
+
return frame.rows;
|
|
462
|
+
}
|
|
463
|
+
viewportFrameDescriptor() {
|
|
464
|
+
return this.#viewportController.frame?.descriptor ?? null;
|
|
465
|
+
}
|
|
466
|
+
/** Read-only, payload-free evidence; observing a pending frame must never render or repair it. */
|
|
467
|
+
viewportPresentationEvidence() {
|
|
468
|
+
const frame = this.#viewportController.frame;
|
|
469
|
+
const snapshot = this.#visibleViewportSnapshot;
|
|
470
|
+
return {
|
|
471
|
+
candidate: this.#dockInputCandidate,
|
|
472
|
+
candidateRevision: this.#dockInputCandidate ? this.#dockInputRevision ?? null : null,
|
|
473
|
+
currentRevision: this.#viewportController.presentationRevision,
|
|
474
|
+
composedRevision: snapshot?.viewportRevision ?? null,
|
|
475
|
+
currentPointer: this.#viewportController.pointerPosition ?? null,
|
|
476
|
+
composedPointer: snapshot?.pointerPosition ?? null,
|
|
477
|
+
frameId: frame?.descriptor.frameId ?? null,
|
|
478
|
+
bottom: frame?.hits.bottom ?? null,
|
|
479
|
+
followingEnd: frame?.followingEnd ?? true,
|
|
480
|
+
scrollTop: frame?.scrollTop ?? 0,
|
|
481
|
+
maxScroll: frame?.maxScroll ?? 0,
|
|
482
|
+
cause: frame?.descriptor.cause ?? null,
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
/** Visible non-selectable Steering, alignment, and Working rows, for rendering evidence. */
|
|
486
|
+
viewportTransientTailRowCount() {
|
|
487
|
+
return this.#viewportController.frame?.hits.transientTail.length ?? 0;
|
|
488
|
+
}
|
|
489
|
+
hasActiveSelection() {
|
|
490
|
+
return this.#viewportController.hasSelection || this.editor.hasSelection();
|
|
491
|
+
}
|
|
492
|
+
setViewportConfig(config) {
|
|
493
|
+
if (this.#viewportController.setConfig(config))
|
|
494
|
+
this.#documentLayouts.clear();
|
|
495
|
+
}
|
|
496
|
+
resumeViewportFollowing() {
|
|
497
|
+
this.#viewportController.resumeFollowing();
|
|
498
|
+
}
|
|
499
|
+
noteCompletedAssistantMessage() {
|
|
500
|
+
this.#viewportController.noteCompletedAssistantMessage();
|
|
501
|
+
}
|
|
502
|
+
/** A new session binding owns new mounts even when it reuses semantic invocation ids. */
|
|
503
|
+
resetTranscript() {
|
|
504
|
+
for (const component of this.#transcript.values())
|
|
505
|
+
component.dispose?.();
|
|
506
|
+
this.#transcript.clear();
|
|
507
|
+
this.#blocksById.clear();
|
|
508
|
+
this.#transcriptOrder = [];
|
|
509
|
+
this.#renderedRows.clear();
|
|
510
|
+
this.#documentLayouts.clear();
|
|
511
|
+
}
|
|
512
|
+
resetViewport() {
|
|
513
|
+
this.#viewportController.reset();
|
|
514
|
+
}
|
|
515
|
+
clearViewportPointerState() {
|
|
516
|
+
this.#viewportController.clearPointerState();
|
|
517
|
+
}
|
|
518
|
+
setViewportOverlaySurfaces(surfaces) {
|
|
519
|
+
this.#viewportController.setOverlaySurfaces(surfaces);
|
|
520
|
+
}
|
|
521
|
+
viewportInputGeometryReady(width, height) {
|
|
522
|
+
const frame = this.#viewportController.frame;
|
|
523
|
+
return this.#viewportController.inputGeometryReady && frame?.descriptor.width === width && frame.descriptor.height === height;
|
|
524
|
+
}
|
|
525
|
+
handleViewportPreInput(data, allowWheel = true, now = Date.now(), editorActive = this.usesDefaultInputSurface()) {
|
|
526
|
+
return this.#viewportController.handlePreInput(data, allowWheel, now, editorActive);
|
|
527
|
+
}
|
|
528
|
+
#renderDock(width) {
|
|
529
|
+
return this.#renderDockLayout(width).rows;
|
|
530
|
+
}
|
|
531
|
+
#renderDockLayout(width) {
|
|
532
|
+
const queued = this.#customViewport ? [] : this.#renderQueued(width);
|
|
533
|
+
const statusRows = this.#customViewport ? this.#status.renderDock(width) : this.#renderStatus(width);
|
|
534
|
+
const transientRows = [...queued, ...statusRows, ...this.#renderDockNotice(width)];
|
|
535
|
+
const aboveWidgets = this.#renderWidgets("aboveEditor", width);
|
|
536
|
+
const input = this.#inputSurface.render(width);
|
|
537
|
+
// Invariant: pointer rows describe the body, not the autocomplete block now preceding it.
|
|
538
|
+
const body = this.usesDefaultInputSurface() ? this.editor.bodyGeometry?.() : undefined;
|
|
539
|
+
const belowWidgets = this.#renderWidgets("belowEditor", width);
|
|
540
|
+
const footer = this.#renderFooter(width);
|
|
541
|
+
const rowsWithoutTransient = [...aboveWidgets, ...input, ...belowWidgets, ...footer];
|
|
542
|
+
return {
|
|
543
|
+
rows: [...transientRows, ...rowsWithoutTransient],
|
|
544
|
+
editorOffset: transientRows.length + aboveWidgets.length + (body?.rowOffset ?? 0),
|
|
545
|
+
inputRows: body?.rowCount ?? input.length,
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
#renderDockNotice(width) {
|
|
549
|
+
if (this.#dockNotice === undefined)
|
|
550
|
+
return [];
|
|
551
|
+
// Compatibility: Pi pads its status text by one cell regardless of the output pad setting.
|
|
552
|
+
return ["", ...renderPiShellStatusText(this.#dockNotice, width, PINNED_PI_LAYOUT.outputPad)];
|
|
553
|
+
}
|
|
554
|
+
#dismissDockNotice() {
|
|
555
|
+
if (this.#dockNotice === undefined)
|
|
556
|
+
return;
|
|
557
|
+
this.#dockNotice = undefined;
|
|
558
|
+
this.#invalidateChrome();
|
|
559
|
+
}
|
|
560
|
+
#renderQueued(width) {
|
|
561
|
+
return this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width);
|
|
562
|
+
}
|
|
563
|
+
layoutRoot() {
|
|
564
|
+
const document = layoutPort(width => this.#renderDocument(width), () => this.invalidate());
|
|
565
|
+
const queued = layoutPort(width => this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width), () => this.#queued.invalidate());
|
|
566
|
+
const aboveWidgets = layoutPort(width => this.#renderWidgets("aboveEditor", width), () => this.#invalidateExtensions());
|
|
567
|
+
const status = layoutPort(width => this.#renderStatus(width), () => this.#status.invalidate());
|
|
568
|
+
const editor = layoutPort(width => this.#inputSurface.render(width), () => this.#inputSurface.invalidate(), data => this.#inputSurface.handleInput?.(data));
|
|
569
|
+
const belowWidgets = layoutPort(width => this.#renderWidgets("belowEditor", width), () => this.#invalidateExtensions());
|
|
570
|
+
const footer = layoutPort(width => this.#renderFooter(width), () => (this.#extensionFooter ?? this.#footer).invalidate());
|
|
571
|
+
return {
|
|
572
|
+
type: "stack",
|
|
573
|
+
direction: "vertical",
|
|
574
|
+
children: [
|
|
575
|
+
{
|
|
576
|
+
basis: 0,
|
|
577
|
+
grow: 1,
|
|
578
|
+
shrink: 1,
|
|
579
|
+
minSize: 1,
|
|
580
|
+
node: {
|
|
581
|
+
type: "scroll",
|
|
582
|
+
id: "transcript",
|
|
583
|
+
follow: "end",
|
|
584
|
+
primary: true,
|
|
585
|
+
overscroll: "chain",
|
|
586
|
+
scrollbar: "auto",
|
|
587
|
+
scrollbarTrackStyle: text => piTheme().fg("scrollbarTrack", text),
|
|
588
|
+
scrollbarThumbStyle: text => piTheme().fg("scrollbarThumb", text),
|
|
589
|
+
child: { type: "component", component: document },
|
|
590
|
+
},
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
basis: "auto",
|
|
594
|
+
grow: 0,
|
|
595
|
+
shrink: 1,
|
|
596
|
+
minSize: 1,
|
|
597
|
+
node: {
|
|
598
|
+
type: "stack",
|
|
599
|
+
direction: "vertical",
|
|
600
|
+
children: [
|
|
601
|
+
{ shrink: 1, minSize: 0, node: { type: "component", component: queued } },
|
|
602
|
+
{ shrink: 1, minSize: 0, node: { type: "component", component: status } },
|
|
603
|
+
{ shrink: 1, minSize: 0, node: { type: "component", component: aboveWidgets } },
|
|
604
|
+
{ shrink: 1, minSize: 3, node: { type: "component", component: editor } },
|
|
605
|
+
{ shrink: 1, minSize: 0, node: { type: "component", component: belowWidgets } },
|
|
606
|
+
{ shrink: 1, minSize: 1, node: { type: "component", component: footer } },
|
|
607
|
+
],
|
|
608
|
+
},
|
|
609
|
+
},
|
|
610
|
+
],
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
#renderDocument(width) {
|
|
614
|
+
return this.#renderDocumentLayout(width).rows;
|
|
615
|
+
}
|
|
616
|
+
#renderDocumentLayout(width) {
|
|
617
|
+
// Performance: extension headers may animate independently of transcript revisions, so
|
|
618
|
+
// only the stable built-in document participates in this frame cache.
|
|
619
|
+
const cached = this.#extensionHeader === null ? this.#documentLayouts.get(width) : undefined;
|
|
620
|
+
if (cached !== undefined)
|
|
621
|
+
return cached;
|
|
622
|
+
const diagnostics = this.#view.diagnostics;
|
|
623
|
+
const startupRows = diagnostics
|
|
624
|
+
.filter(diagnostic => diagnostic.code === "engine-startup")
|
|
625
|
+
.flatMap(diagnostic => renderPiShellStartupDiagnostic(diagnostic, width));
|
|
626
|
+
const resourceRows = this.#customViewport ? [] : [...this.resources.render(width)];
|
|
627
|
+
if (resourceRows.at(-1) === "")
|
|
628
|
+
resourceRows.pop();
|
|
629
|
+
const headerRows = this.#extensionHeader !== null
|
|
630
|
+
? this.#extensionHeader.render(width)
|
|
631
|
+
: this.#customViewport ? [] : this.header.render(width);
|
|
632
|
+
const rows = [
|
|
633
|
+
...startupRows,
|
|
634
|
+
...headerRows,
|
|
635
|
+
...resourceRows,
|
|
636
|
+
];
|
|
637
|
+
const promptAnchors = [];
|
|
638
|
+
// Rationale: a block that is still streaming re-renders every row it owns, so the frame
|
|
639
|
+
// reports where its rows begin. Damage-aware painting uses that to tell a live block's
|
|
640
|
+
// own reflow apart from a repaint that reaches settled rows.
|
|
641
|
+
let liveTailStartRow;
|
|
642
|
+
for (let index = 0; index < this.#transcriptOrder.length; index += 1) {
|
|
643
|
+
const id = this.#transcriptOrder[index];
|
|
644
|
+
const block = this.#blocksById.get(id);
|
|
645
|
+
if (!this.#thinkingVisible && block?.kind === "thinking")
|
|
646
|
+
continue;
|
|
647
|
+
const promptLike = block !== undefined
|
|
648
|
+
&& (block.kind === "user" || this.#customViewport && isPiPromptStyleCompaction(block));
|
|
649
|
+
const blockWidth = this.#customViewport
|
|
650
|
+
&& promptLike
|
|
651
|
+
&& this.#viewportController.config.scrollbarAppearance !== "hidden"
|
|
652
|
+
&& width > 1
|
|
653
|
+
? width - 1
|
|
654
|
+
: width;
|
|
655
|
+
const blockRows = this.#blockRows(id, block, blockWidth);
|
|
656
|
+
if (promptLike) {
|
|
657
|
+
// Compatibility: the first natural prompt gets one breathing row at the document top.
|
|
658
|
+
// Once scrolling advances, the prompt itself reaches row zero and then
|
|
659
|
+
// becomes sticky there, so the spacer is never pinned with it.
|
|
660
|
+
if (this.#customViewport && index === 0)
|
|
661
|
+
rows.push("");
|
|
662
|
+
else if (index > 0)
|
|
663
|
+
rows.push("");
|
|
664
|
+
}
|
|
665
|
+
const firstRow = rows.length;
|
|
666
|
+
if (liveTailStartRow === undefined && block !== undefined && block.status !== "finalized") {
|
|
667
|
+
liveTailStartRow = firstRow;
|
|
668
|
+
}
|
|
669
|
+
rows.push(...blockRows);
|
|
670
|
+
if (promptLike && blockRows[0] !== undefined) {
|
|
671
|
+
promptAnchors.push({
|
|
672
|
+
id: block.id,
|
|
673
|
+
firstRow,
|
|
674
|
+
lastRow: Math.max(firstRow, rows.length - 1),
|
|
675
|
+
sourceRow: pinnedPromptSourceRow(block, blockRows[0], blockWidth),
|
|
676
|
+
prominentSourceRow: blockRows[0],
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
rows.push(...diagnostics
|
|
681
|
+
.filter(diagnostic => diagnostic.code === "package-updates")
|
|
682
|
+
.flatMap(diagnostic => renderPiShellPackageUpdateNotice(diagnostic.message.split("\n").filter(line => line.startsWith("- ")).map(line => line.slice(2)), width)));
|
|
683
|
+
rows.push(...diagnostics
|
|
684
|
+
.filter(diagnostic => diagnostic.code === "changelog-collapsed" || diagnostic.code === "changelog-expanded")
|
|
685
|
+
// Rationale: the custom viewport shows the new entries on the What's New screen, so its feed
|
|
686
|
+
// carries only the hint for either diagnostic; the pinned layout keeps the full document.
|
|
687
|
+
.flatMap(diagnostic => diagnostic.code === "changelog-collapsed" || this.#customViewport
|
|
688
|
+
? createPiShellCollapsedChangelog().render(width)
|
|
689
|
+
: createPiShellChangelog(diagnostic.message).render(width)));
|
|
690
|
+
rows.push(...diagnostics
|
|
691
|
+
.filter(diagnostic => diagnostic.code !== "engine-startup" && diagnostic.code !== "package-updates"
|
|
692
|
+
&& diagnostic.code !== "changelog-collapsed" && diagnostic.code !== "changelog-expanded")
|
|
693
|
+
.slice(-3)
|
|
694
|
+
.flatMap(diagnostic => renderPiShellTranscriptBlock({
|
|
695
|
+
id: `diagnostic-${diagnostic.sequence}`,
|
|
696
|
+
kind: diagnostic.severity === "error" ? "error" : "system",
|
|
697
|
+
status: "finalized",
|
|
698
|
+
revision: diagnostic.sequence,
|
|
699
|
+
title: diagnostic.code,
|
|
700
|
+
text: diagnostic.message,
|
|
701
|
+
payload: {},
|
|
702
|
+
}, width, this.#cwd)));
|
|
703
|
+
const layout = { rows: Object.freeze(rows), promptAnchors: Object.freeze(promptAnchors), liveTailStartRow };
|
|
704
|
+
if (this.#extensionHeader === null) {
|
|
705
|
+
this.#documentLayouts.set(width, layout);
|
|
706
|
+
// Performance: the custom viewport commonly probes full width and reserved-rail width.
|
|
707
|
+
while (this.#documentLayouts.size > 2)
|
|
708
|
+
this.#documentLayouts.delete(this.#documentLayouts.keys().next().value);
|
|
709
|
+
}
|
|
710
|
+
return layout;
|
|
711
|
+
}
|
|
712
|
+
// Performance: finalized blocks cache by revision and width; live blocks always render.
|
|
713
|
+
#blockRows(id, block, width) {
|
|
714
|
+
const component = this.#transcript.get(id);
|
|
715
|
+
if (component === undefined)
|
|
716
|
+
return [];
|
|
717
|
+
const render = () => {
|
|
718
|
+
this.#transcriptBlockRenders += 1;
|
|
719
|
+
const rows = component.render(width);
|
|
720
|
+
if (!this.#customViewport || block?.kind === "user")
|
|
721
|
+
return rows;
|
|
722
|
+
return rows.map(row => nativeHyperlinkStyle(row, nativeTranscriptLinkColor));
|
|
723
|
+
};
|
|
724
|
+
if (block === undefined || block.status !== "finalized")
|
|
725
|
+
return render();
|
|
726
|
+
let byWidth = this.#renderedRows.get(id);
|
|
727
|
+
const cached = byWidth?.get(width);
|
|
728
|
+
const presentationRevision = component.presentationRevision ?? 0;
|
|
729
|
+
if (cached?.revision === block.revision && cached.presentationRevision === presentationRevision)
|
|
730
|
+
return cached.rows;
|
|
731
|
+
const rows = render();
|
|
732
|
+
if (byWidth === undefined) {
|
|
733
|
+
byWidth = new Map();
|
|
734
|
+
this.#renderedRows.set(id, byWidth);
|
|
735
|
+
}
|
|
736
|
+
byWidth.set(width, { revision: block.revision, presentationRevision, rows });
|
|
737
|
+
// Invariant: bare A1 probes full width before reserving the overflowing rail column;
|
|
738
|
+
// retain both widths without turning resize history into an unbounded cache.
|
|
739
|
+
while (byWidth.size > 2)
|
|
740
|
+
byWidth.delete(byWidth.keys().next().value);
|
|
741
|
+
return rows;
|
|
742
|
+
}
|
|
743
|
+
transcriptComponent(id) {
|
|
744
|
+
return this.#transcript.get(id);
|
|
745
|
+
}
|
|
746
|
+
exitTranscript(width) {
|
|
747
|
+
const rows = [];
|
|
748
|
+
for (const id of this.#transcriptOrder) {
|
|
749
|
+
const block = this.#blocksById.get(id);
|
|
750
|
+
if (block === undefined || (!this.#thinkingVisible && block.kind === "thinking"))
|
|
751
|
+
continue;
|
|
752
|
+
if (rows.length > 0 && (block.kind === "user" || this.#customViewport && isPiPromptStyleCompaction(block)))
|
|
753
|
+
rows.push("");
|
|
754
|
+
rows.push(...this.#blockRows(id, block, width).map(sanitizeExitTranscriptRow));
|
|
755
|
+
}
|
|
756
|
+
while (rows.at(-1) === "")
|
|
757
|
+
rows.pop();
|
|
758
|
+
return rows.join("\n");
|
|
759
|
+
}
|
|
760
|
+
appendWorkflowStatus(message) {
|
|
761
|
+
// Rationale: bare A1 acknowledges commands in one dock notice above the editor, where the
|
|
762
|
+
// reader's eye already is, instead of a transcript row that opens an empty session at the
|
|
763
|
+
// top-left or sinks into a long feed. The pinned route keeps Pi's chat placement.
|
|
764
|
+
if (this.#customViewport) {
|
|
765
|
+
this.#dockNotice = message;
|
|
766
|
+
this.#invalidateChrome();
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
const previousId = this.#lastWorkflowStatusId;
|
|
770
|
+
if (previousId !== undefined
|
|
771
|
+
&& this.#transcriptOrder.at(-1) === previousId
|
|
772
|
+
&& this.#workflowStatusAnchors.get(previousId) === this.#view.transcript.length) {
|
|
773
|
+
this.#workflowStatusMessages.set(previousId, message);
|
|
774
|
+
this.#documentLayouts.clear();
|
|
775
|
+
this.invalidate();
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
const id = this.#appendAnchoredWorkflowComponent(width => [
|
|
779
|
+
"",
|
|
780
|
+
...renderPiShellStatusText(this.#workflowStatusMessages.get(id) ?? message, width),
|
|
781
|
+
]);
|
|
782
|
+
this.#workflowStatusMessages.set(id, message);
|
|
783
|
+
this.#lastWorkflowStatusId = id;
|
|
784
|
+
}
|
|
785
|
+
appendWorkflowMessage(message) {
|
|
786
|
+
if (message.kind === "status") {
|
|
787
|
+
this.appendWorkflowStatus(message.message);
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
this.#lastWorkflowStatusId = undefined;
|
|
791
|
+
const presentation = { kind: message.kind, message: message.message };
|
|
792
|
+
this.#appendAnchoredWorkflowComponent(width => renderPiShellCommandMessage(presentation, width, this.#outputPad));
|
|
793
|
+
}
|
|
794
|
+
appendWorkflowResult(result) {
|
|
795
|
+
if (result.messages !== undefined) {
|
|
796
|
+
for (const message of result.messages)
|
|
797
|
+
this.appendWorkflowMessage(message);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (result.messageKind === "silent" || (result.outcome === "cancelled" && result.messageKind === undefined))
|
|
801
|
+
return;
|
|
802
|
+
if (result.command === "reload" && result.outcome === "completed") {
|
|
803
|
+
this.appendWorkflowStatus(result.message);
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
if (result.command === "session" && result.outcome === "completed" && result.presentation?.kind === "session-info") {
|
|
807
|
+
this.#lastWorkflowStatusId = undefined;
|
|
808
|
+
const sessionInfo = createPiShellSessionInfo(result.presentation);
|
|
809
|
+
this.#appendAnchoredWorkflowComponent(width => sessionInfo.render(width), () => sessionInfo.dispose?.());
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
if (result.command === "hotkeys" && result.outcome === "completed") {
|
|
813
|
+
this.#lastWorkflowStatusId = undefined;
|
|
814
|
+
const presentation = this.hotkeysPresentation();
|
|
815
|
+
const hotkeys = createPiShellHotkeys(presentation.bindings, presentation.getShortcuts, presentation.profile);
|
|
816
|
+
this.#appendAnchoredWorkflowComponent(width => hotkeys.render(width), () => hotkeys.dispose?.());
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
if (result.command === "changelog" && result.outcome === "completed") {
|
|
820
|
+
this.#lastWorkflowStatusId = undefined;
|
|
821
|
+
const changelog = createPiShellChangelog(result.detail ?? "No changelog entries found.");
|
|
822
|
+
this.#appendAnchoredWorkflowComponent(width => changelog.render(width), () => changelog.dispose?.());
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
if (result.outcome === "failed") {
|
|
826
|
+
this.appendWorkflowMessage({
|
|
827
|
+
kind: result.messageKind === "warning" ? "warning" : "error",
|
|
828
|
+
message: result.message,
|
|
829
|
+
});
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
if (result.outcome === "completed" && (result.command === "quit" || result.command === "compact"))
|
|
833
|
+
return;
|
|
834
|
+
if (result.outcome === "completed" && (result.command === "new" || result.command === "name" || result.command === "debug")) {
|
|
835
|
+
this.#lastWorkflowStatusId = undefined;
|
|
836
|
+
const presentation = { kind: result.command, message: result.message, ...(result.detail === undefined ? {} : { detail: result.detail }) };
|
|
837
|
+
this.#appendAnchoredWorkflowComponent(width => renderPiShellCommandMessage(presentation, width, this.#outputPad));
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
if (result.command === "arminsayshi" && result.outcome === "completed") {
|
|
841
|
+
this.#lastWorkflowStatusId = undefined;
|
|
842
|
+
const armin = createPiShellArmin(this.#componentRuntime);
|
|
843
|
+
this.#appendAnchoredWorkflowComponent(width => ["", ...armin.render(width)], () => armin.dispose?.());
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
if (result.command === "dementedelves" && result.outcome === "completed") {
|
|
847
|
+
this.#lastWorkflowStatusId = undefined;
|
|
848
|
+
const announcement = createPiShellEarendilAnnouncement();
|
|
849
|
+
this.#appendAnchoredWorkflowComponent(width => ["", ...announcement.render(width)], () => announcement.dispose?.());
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
// Rationale: pinned 0.85.1 links both share URLs; the workflow result carries the plain URLs.
|
|
853
|
+
const message = result.command === "share" && result.detail
|
|
854
|
+
? `${linkShareUrl(result.message)}\nGist: ${piShellHyperlink(result.detail)}`
|
|
855
|
+
: result.message;
|
|
856
|
+
this.appendWorkflowStatus(message);
|
|
857
|
+
}
|
|
858
|
+
appendDaxnuts() {
|
|
859
|
+
this.#lastWorkflowStatusId = undefined;
|
|
860
|
+
const daxnuts = createPiShellDaxnuts(this.#componentRuntime);
|
|
861
|
+
this.#appendAnchoredWorkflowComponent(width => ["", ...daxnuts.render(width)], () => daxnuts.dispose?.());
|
|
862
|
+
}
|
|
863
|
+
toggleThinkingVisibility() {
|
|
864
|
+
this.setHideThinkingBlock(this.#thinkingVisible);
|
|
865
|
+
}
|
|
866
|
+
get toolsExpanded() {
|
|
867
|
+
return this.#toolsExpanded;
|
|
868
|
+
}
|
|
869
|
+
setToolsExpanded(expanded) {
|
|
870
|
+
this.#setToolsExpanded(expanded);
|
|
871
|
+
}
|
|
872
|
+
setExtensionWidget(key, component, placement) {
|
|
873
|
+
const previous = this.#extensionWidgets.get(key)?.component;
|
|
874
|
+
if (component === null)
|
|
875
|
+
this.#extensionWidgets.delete(key);
|
|
876
|
+
else
|
|
877
|
+
this.#extensionWidgets.set(key, { component, placement });
|
|
878
|
+
if (previous !== undefined && previous !== component)
|
|
879
|
+
previous.dispose?.();
|
|
880
|
+
this.invalidate();
|
|
881
|
+
}
|
|
882
|
+
setExtensionHeader(component) {
|
|
883
|
+
if (this.#extensionHeader !== component)
|
|
884
|
+
this.#extensionHeader?.dispose?.();
|
|
885
|
+
this.#extensionHeader = component;
|
|
886
|
+
this.#documentLayouts.clear();
|
|
887
|
+
this.invalidate();
|
|
888
|
+
}
|
|
889
|
+
setExtensionFooter(component) {
|
|
890
|
+
if (this.#extensionFooter !== component)
|
|
891
|
+
this.#extensionFooter?.dispose?.();
|
|
892
|
+
this.#extensionFooter = component;
|
|
893
|
+
this.invalidate();
|
|
894
|
+
}
|
|
895
|
+
setExtensionStatus(key, text) {
|
|
896
|
+
if (text === undefined)
|
|
897
|
+
this.#extensionStatuses.delete(key);
|
|
898
|
+
else
|
|
899
|
+
this.#extensionStatuses.set(key, text);
|
|
900
|
+
this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
|
|
901
|
+
this.invalidate();
|
|
902
|
+
}
|
|
903
|
+
setExtensionWorking(message, visible = this.#extensionWorkingVisible) {
|
|
904
|
+
this.#extensionWorkingMessage = message;
|
|
905
|
+
this.#extensionWorkingVisible = visible;
|
|
906
|
+
this.#status.setWorkingOverride(visible ? message : undefined);
|
|
907
|
+
this.invalidate();
|
|
908
|
+
}
|
|
909
|
+
hotkeysPresentation() {
|
|
910
|
+
return {
|
|
911
|
+
bindings: this.editor.keybindingConfig(),
|
|
912
|
+
getShortcuts: bindings => this.#extensionRenderers.getShortcuts?.(bindings) ?? [],
|
|
913
|
+
profile: this.#customViewport ? "a1" : "pi",
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
resetWorkflowPresentation() {
|
|
917
|
+
this.#dockNotice = undefined;
|
|
918
|
+
for (const id of this.#workflowStatusAnchors.keys()) {
|
|
919
|
+
this.#transcript.get(id)?.dispose?.();
|
|
920
|
+
this.#transcript.delete(id);
|
|
921
|
+
}
|
|
922
|
+
this.#workflowStatusAnchors.clear();
|
|
923
|
+
this.#workflowStatusMessages.clear();
|
|
924
|
+
this.#transcriptOrder = this.#transcriptOrder.filter(id => !id.startsWith("workflow-status-"));
|
|
925
|
+
this.#lastWorkflowStatusId = undefined;
|
|
926
|
+
this.#documentLayouts.clear();
|
|
927
|
+
this.invalidate();
|
|
928
|
+
}
|
|
929
|
+
resetExtensionUi() {
|
|
930
|
+
this.#extensionHeader?.dispose?.();
|
|
931
|
+
this.#extensionFooter?.dispose?.();
|
|
932
|
+
for (const { component } of this.#extensionWidgets.values())
|
|
933
|
+
component.dispose?.();
|
|
934
|
+
this.#extensionHeader = null;
|
|
935
|
+
this.#extensionFooter = null;
|
|
936
|
+
this.#extensionWidgets.clear();
|
|
937
|
+
this.#extensionStatuses.clear();
|
|
938
|
+
this.#extensionWorkingMessage = undefined;
|
|
939
|
+
this.#status.setWorkingOverride(undefined);
|
|
940
|
+
this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
|
|
941
|
+
// Invariant: an extension renderer may have drawn transcript blocks that are now unrendered by it.
|
|
942
|
+
this.#renderedRows.clear();
|
|
943
|
+
this.#documentLayouts.clear();
|
|
944
|
+
this.invalidate();
|
|
945
|
+
}
|
|
946
|
+
addExtensionNotification(message, type) {
|
|
947
|
+
if (type === "info") {
|
|
948
|
+
this.appendWorkflowStatus(message);
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
this.appendWorkflowMessage({ kind: type, message });
|
|
952
|
+
}
|
|
953
|
+
extensionFooterData() {
|
|
954
|
+
return {
|
|
955
|
+
getGitBranch: () => this.#view.status.footer?.branch ?? null,
|
|
956
|
+
getExtensionStatuses: () => new Map(this.#extensionStatuses),
|
|
957
|
+
getAvailableProviderCount: () => this.#view.status.footer?.availableProviderCount ?? 1,
|
|
958
|
+
onBranchChange: () => () => { },
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
usesDefaultInputSurface() {
|
|
962
|
+
return this.#inputSurface === this.editor;
|
|
963
|
+
}
|
|
964
|
+
inputCoordinationSurface() {
|
|
965
|
+
return this.#inputSurfaceCoordination;
|
|
966
|
+
}
|
|
967
|
+
viewportCompositionEvidence() {
|
|
968
|
+
return { full: this.#fullViewportCompositions, dockOnly: this.#dockOnlyViewportCompositions };
|
|
969
|
+
}
|
|
970
|
+
transcriptRenderCount() {
|
|
971
|
+
return this.#transcriptBlockRenders;
|
|
972
|
+
}
|
|
973
|
+
setInputSurface(component, disposePrevious = true, coordination = "owned") {
|
|
974
|
+
const next = component ?? this.editor;
|
|
975
|
+
const nextCoordination = next === this.editor ? "editor" : coordination;
|
|
976
|
+
if (next === this.#inputSurface) {
|
|
977
|
+
this.#inputSurfaceCoordination = nextCoordination;
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
this.#dockInputCandidate = false;
|
|
981
|
+
this.#viewportController.invalidateInputSurface();
|
|
982
|
+
this.#inputSurface.setFocused?.(false);
|
|
983
|
+
if (disposePrevious && this.#inputSurface !== this.editor)
|
|
984
|
+
this.#inputSurface.dispose?.();
|
|
985
|
+
this.#inputSurface = next;
|
|
986
|
+
this.#inputSurfaceCoordination = nextCoordination;
|
|
987
|
+
this.#onInputSurfaceChanged?.();
|
|
988
|
+
this.#inputSurface.setFocused?.(true);
|
|
989
|
+
this.invalidate();
|
|
990
|
+
}
|
|
991
|
+
handleInput(data) {
|
|
992
|
+
this.#dockInputCandidate = this.#customViewport && this.#dockInputReuseEnabled
|
|
993
|
+
&& classifyPiTuiInput(data, this.#inputSurfaceCoordination) === "safe";
|
|
994
|
+
this.#dockInputRevision = this.#dockInputCandidate ? this.#viewportController.presentationRevision : undefined;
|
|
995
|
+
try {
|
|
996
|
+
this.#inputSurface.handleInput?.(data);
|
|
997
|
+
}
|
|
998
|
+
catch (error) {
|
|
999
|
+
this.#dockInputCandidate = false;
|
|
1000
|
+
throw error;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
invalidate() {
|
|
1004
|
+
this.#renderedRows.clear();
|
|
1005
|
+
this.#documentLayouts.clear();
|
|
1006
|
+
for (const component of this.#transcript.values())
|
|
1007
|
+
component.invalidate();
|
|
1008
|
+
this.#invalidateChrome();
|
|
1009
|
+
}
|
|
1010
|
+
#invalidateChrome() {
|
|
1011
|
+
this.header.invalidate();
|
|
1012
|
+
this.resources.invalidate();
|
|
1013
|
+
this.editor.invalidate();
|
|
1014
|
+
if (this.#inputSurface !== this.editor)
|
|
1015
|
+
this.#inputSurface.invalidate();
|
|
1016
|
+
this.#invalidateExtensions();
|
|
1017
|
+
this.#status.invalidate();
|
|
1018
|
+
this.#footer.invalidate();
|
|
1019
|
+
this.#queued.invalidate();
|
|
1020
|
+
}
|
|
1021
|
+
setFocused(focused) {
|
|
1022
|
+
this.#inputSurface.setFocused?.(focused);
|
|
1023
|
+
}
|
|
1024
|
+
dispose() {
|
|
1025
|
+
this.clearViewportPointerState();
|
|
1026
|
+
this.#themeUnsubscribe();
|
|
1027
|
+
this.header.dispose?.();
|
|
1028
|
+
this.resources.dispose?.();
|
|
1029
|
+
for (const component of this.#transcript.values())
|
|
1030
|
+
component.dispose?.();
|
|
1031
|
+
this.#transcript.clear();
|
|
1032
|
+
this.#renderedRows.clear();
|
|
1033
|
+
this.#documentLayouts.clear();
|
|
1034
|
+
this.#visibleViewportSnapshot = undefined;
|
|
1035
|
+
this.#dockInputCandidate = false;
|
|
1036
|
+
this.#dockInputRevision = undefined;
|
|
1037
|
+
if (this.#inputSurface !== this.editor)
|
|
1038
|
+
this.#inputSurface.dispose?.();
|
|
1039
|
+
this.#extensionHeader?.dispose?.();
|
|
1040
|
+
this.#extensionFooter?.dispose?.();
|
|
1041
|
+
for (const { component } of this.#extensionWidgets.values())
|
|
1042
|
+
component.dispose?.();
|
|
1043
|
+
this.#extensionWidgets.clear();
|
|
1044
|
+
this.editor.dispose?.();
|
|
1045
|
+
this.#status.dispose?.();
|
|
1046
|
+
this.#footer.dispose?.();
|
|
1047
|
+
this.#queued.dispose?.();
|
|
1048
|
+
}
|
|
1049
|
+
#invalidateTranscriptPresentation() {
|
|
1050
|
+
this.#renderedRows.clear();
|
|
1051
|
+
this.#documentLayouts.clear();
|
|
1052
|
+
this.invalidate();
|
|
1053
|
+
}
|
|
1054
|
+
#syncTranscript(blocks) {
|
|
1055
|
+
const previousIds = this.#transcriptOrder.filter(id => !id.startsWith("workflow-status-"));
|
|
1056
|
+
const transcriptChanged = previousIds.length !== blocks.length || blocks.some((block, index) => {
|
|
1057
|
+
const previous = this.#blocksById.get(block.id);
|
|
1058
|
+
return previousIds[index] !== block.id || previous?.revision !== block.revision;
|
|
1059
|
+
});
|
|
1060
|
+
if (transcriptChanged)
|
|
1061
|
+
this.#documentLayouts.clear();
|
|
1062
|
+
this.#blocksById.clear();
|
|
1063
|
+
for (const block of blocks)
|
|
1064
|
+
this.#blocksById.set(block.id, block);
|
|
1065
|
+
const nextIds = new Set(blocks.map(block => block.id));
|
|
1066
|
+
for (const [id, component] of this.#transcript) {
|
|
1067
|
+
if (id.startsWith("workflow-status-") || nextIds.has(id))
|
|
1068
|
+
continue;
|
|
1069
|
+
component.dispose?.();
|
|
1070
|
+
this.#transcript.delete(id);
|
|
1071
|
+
this.#renderedRows.delete(id);
|
|
1072
|
+
}
|
|
1073
|
+
for (const block of blocks) {
|
|
1074
|
+
const component = this.#transcript.get(block.id);
|
|
1075
|
+
if (component === undefined) {
|
|
1076
|
+
const created = this.#mountTranscript(block);
|
|
1077
|
+
this.#transcript.set(block.id, created);
|
|
1078
|
+
}
|
|
1079
|
+
else if (component.revision !== block.revision) {
|
|
1080
|
+
component.update(block);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
const statusIds = [...this.#workflowStatusAnchors.keys()];
|
|
1084
|
+
const order = [];
|
|
1085
|
+
for (let index = 0; index <= blocks.length; index += 1) {
|
|
1086
|
+
for (const statusId of statusIds) {
|
|
1087
|
+
if (this.#workflowStatusAnchors.get(statusId) === index)
|
|
1088
|
+
order.push(statusId);
|
|
1089
|
+
}
|
|
1090
|
+
const block = blocks[index];
|
|
1091
|
+
if (block !== undefined)
|
|
1092
|
+
order.push(block.id);
|
|
1093
|
+
}
|
|
1094
|
+
const placed = new Set(order);
|
|
1095
|
+
for (const statusId of statusIds) {
|
|
1096
|
+
if (!placed.has(statusId))
|
|
1097
|
+
order.push(statusId);
|
|
1098
|
+
}
|
|
1099
|
+
this.#transcriptOrder = order;
|
|
1100
|
+
}
|
|
1101
|
+
#appendAnchoredWorkflowComponent(render, dispose) {
|
|
1102
|
+
// Invariant: transcript-bound workflow output supersedes a pending acknowledgement.
|
|
1103
|
+
this.#dismissDockNotice();
|
|
1104
|
+
this.#workflowTranscriptSequence += 1;
|
|
1105
|
+
const id = `workflow-status-${this.#workflowTranscriptSequence}`;
|
|
1106
|
+
const component = {
|
|
1107
|
+
id,
|
|
1108
|
+
revision: 1,
|
|
1109
|
+
render,
|
|
1110
|
+
handleInput() { },
|
|
1111
|
+
invalidate() { },
|
|
1112
|
+
update() { },
|
|
1113
|
+
setExpanded() { },
|
|
1114
|
+
setOutputPad() { },
|
|
1115
|
+
setHideThinkingBlock() { },
|
|
1116
|
+
setMermaidRenderingMode() { },
|
|
1117
|
+
setImagePresentation() { },
|
|
1118
|
+
...(dispose === undefined ? {} : { dispose }),
|
|
1119
|
+
};
|
|
1120
|
+
this.#transcript.set(id, component);
|
|
1121
|
+
this.#workflowStatusAnchors.set(id, this.#view.transcript.length);
|
|
1122
|
+
this.#transcriptOrder.push(id);
|
|
1123
|
+
this.#documentLayouts.clear();
|
|
1124
|
+
this.invalidate();
|
|
1125
|
+
return id;
|
|
1126
|
+
}
|
|
1127
|
+
#renderWidgets(placement, width) {
|
|
1128
|
+
const rows = [...this.#extensionWidgets.values()]
|
|
1129
|
+
.filter(widget => widget.placement === placement)
|
|
1130
|
+
.flatMap(widget => widget.component.render(width));
|
|
1131
|
+
return placement === "aboveEditor" ? ["", ...rows] : rows;
|
|
1132
|
+
}
|
|
1133
|
+
#renderStatus(width) {
|
|
1134
|
+
return this.#customViewport ? this.#status.renderLive(width) : this.#status.render(width);
|
|
1135
|
+
}
|
|
1136
|
+
#renderFooter(width) {
|
|
1137
|
+
return (this.#extensionFooter ?? this.#footer).render(width);
|
|
1138
|
+
}
|
|
1139
|
+
#viewWithExtensionStatuses(view) {
|
|
1140
|
+
const footer = view.status.footer;
|
|
1141
|
+
const statuses = new Map(footer?.extensionStatuses ?? []);
|
|
1142
|
+
for (const [key, text] of this.#extensionStatuses)
|
|
1143
|
+
statuses.set(key, text);
|
|
1144
|
+
return {
|
|
1145
|
+
...view,
|
|
1146
|
+
status: {
|
|
1147
|
+
...view.status,
|
|
1148
|
+
footer: {
|
|
1149
|
+
branch: footer?.branch ?? null,
|
|
1150
|
+
sessionName: footer?.sessionName ?? null,
|
|
1151
|
+
availableProviderCount: footer?.availableProviderCount ?? 1,
|
|
1152
|
+
extensionStatuses: [...statuses],
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
#invalidateExtensions() {
|
|
1158
|
+
this.#extensionHeader?.invalidate();
|
|
1159
|
+
this.#extensionFooter?.invalidate();
|
|
1160
|
+
for (const { component } of this.#extensionWidgets.values())
|
|
1161
|
+
component.invalidate();
|
|
1162
|
+
}
|
|
1163
|
+
#setToolsExpanded(expanded) {
|
|
1164
|
+
this.#toolsExpanded = expanded;
|
|
1165
|
+
this.header.setExpanded(expanded);
|
|
1166
|
+
this.resources.setExpanded(expanded);
|
|
1167
|
+
for (const component of this.#transcript.values())
|
|
1168
|
+
component.setExpanded(expanded);
|
|
1169
|
+
// Invariant: expansion changes what a block draws without changing its revision.
|
|
1170
|
+
this.#renderedRows.clear();
|
|
1171
|
+
this.#documentLayouts.clear();
|
|
1172
|
+
this.invalidate();
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
const SCROLLBAR_CELL_RESET = "\u001b[22;23;24;25;27;28;29;39;54;55m";
|
|
1176
|
+
const KITTY_IMAGE_CONTROL = /\u001b_G[\s\S]*?\u001b\\/g;
|
|
1177
|
+
const ITERM_IMAGE_CONTROL = /\u001b]1337;File=[^\u0007]*(?:\u0007|\u001b\\)/g;
|
|
1178
|
+
/** Keep semantic SGR/OSC styling while excluding non-replayable image payloads. */
|
|
1179
|
+
function sanitizeExitTranscriptRow(row) {
|
|
1180
|
+
return row.replace(KITTY_IMAGE_CONTROL, "").replace(ITERM_IMAGE_CONTROL, "");
|
|
1181
|
+
}
|
|
1182
|
+
const TERMINAL_BACKGROUND = /\u001b\[(?:4[0-9]|10[0-7]|48(?:[;:][0-9;:]*)?)m/g;
|
|
1183
|
+
/** Web URLs use link blue; file targets retain A1's cyan interactive accent. */
|
|
1184
|
+
function nativeTranscriptLinkColor(text, target) {
|
|
1185
|
+
return piTheme().fg(/^file:/iu.test(target) ? "accent" : "mdLink", text);
|
|
1186
|
+
}
|
|
1187
|
+
/** Repaint a source prompt with viewport chrome while preserving text, links, and foreground roles. */
|
|
1188
|
+
function withoutTerminalBackground(text) {
|
|
1189
|
+
return text.replace(TERMINAL_BACKGROUND, "");
|
|
1190
|
+
}
|
|
1191
|
+
/** Preserve the stable metadata-grey foreground for every pinned timestamp state. */
|
|
1192
|
+
function pinnedPromptSourceRow(block, sourceRow, width) {
|
|
1193
|
+
if (typeof block.payload !== "object" || block.payload === null)
|
|
1194
|
+
return sourceRow;
|
|
1195
|
+
const value = block.payload.timestamp;
|
|
1196
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
1197
|
+
return sourceRow;
|
|
1198
|
+
const timestamp = formatSubmittedPromptTime(value);
|
|
1199
|
+
if (timestamp === null || submittedPromptLayout(width, value).timestamp === null)
|
|
1200
|
+
return sourceRow;
|
|
1201
|
+
const rowWidth = displayWidth(sourceRow);
|
|
1202
|
+
const timestampWidth = displayWidth(timestamp);
|
|
1203
|
+
if (rowWidth < timestampWidth)
|
|
1204
|
+
return sourceRow;
|
|
1205
|
+
return overlaySpan(sourceRow, rowWidth - timestampWidth, rowWidth, paintPiSubmittedPromptTimestamp(timestamp));
|
|
1206
|
+
}
|
|
1207
|
+
function layoutPort(render, invalidate, handleInput) {
|
|
1208
|
+
return {
|
|
1209
|
+
render,
|
|
1210
|
+
invalidate,
|
|
1211
|
+
...(handleInput === undefined ? {} : { handleInput }),
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
export function shellResourceEntries(backend) {
|
|
1215
|
+
const resources = backend.nonVisualResources().map(resource => ({
|
|
1216
|
+
section: resource.kind === "skill"
|
|
1217
|
+
? "Skills"
|
|
1218
|
+
: resource.kind === "prompt-template"
|
|
1219
|
+
? "Prompts"
|
|
1220
|
+
: resource.kind === "theme"
|
|
1221
|
+
? "Themes"
|
|
1222
|
+
: "Context",
|
|
1223
|
+
label: resource.kind === "prompt-template"
|
|
1224
|
+
? `/${resource.label}`
|
|
1225
|
+
: resource.kind === "agent-context" || resource.kind === "system-prompt"
|
|
1226
|
+
? compactResourceLabel(resource.sourcePath ?? resource.label)
|
|
1227
|
+
: resource.label,
|
|
1228
|
+
sourcePath: resource.sourcePath,
|
|
1229
|
+
diagnostic: resource.diagnostic,
|
|
1230
|
+
}));
|
|
1231
|
+
const extensions = backend.extensionResources().filter(extension => !extension.hidden);
|
|
1232
|
+
const loadedExtensions = extensions.filter(extension => extension.diagnostic === null);
|
|
1233
|
+
const extensionLabels = compactExtensionLabels(loadedExtensions);
|
|
1234
|
+
for (const extension of extensions) {
|
|
1235
|
+
const labelIndex = loadedExtensions.indexOf(extension);
|
|
1236
|
+
resources.push({
|
|
1237
|
+
section: "Extensions",
|
|
1238
|
+
label: extensionLabels[labelIndex] ?? compactResourceLabel(extension.sourcePath ?? extension.resolvedPath ?? "extension"),
|
|
1239
|
+
sourcePath: extension.sourcePath ?? extension.resolvedPath,
|
|
1240
|
+
diagnostic: extension.diagnostic,
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
return resources;
|
|
1244
|
+
}
|
|
1245
|
+
function compactResourceLabel(path) {
|
|
1246
|
+
const segments = compactPathSegments(path);
|
|
1247
|
+
const leaf = segments.at(-1) ?? path;
|
|
1248
|
+
if ((leaf === "index.ts" || leaf === "index.js") && segments.length > 1)
|
|
1249
|
+
return segments.at(-2) ?? leaf;
|
|
1250
|
+
return leaf;
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Pinned from InteractiveMode's compact extension-label helpers at Pi commit
|
|
1254
|
+
* 914cf1472e715297caa30db4b9535d534a9eb718. The source metadata crosses an
|
|
1255
|
+
* A1-owned boundary first; the owned shell never inspects Pi's private root.
|
|
1256
|
+
*/
|
|
1257
|
+
function compactExtensionLabels(extensions) {
|
|
1258
|
+
const localExtensions = extensions
|
|
1259
|
+
.filter(extension => !isPackageExtensionSource(extension.sourceInfo))
|
|
1260
|
+
.map(extension => {
|
|
1261
|
+
const path = extension.sourcePath ?? extension.resolvedPath ?? "extension";
|
|
1262
|
+
const segments = compactPathSegments(path);
|
|
1263
|
+
if (segments.length > 1 && (segments.at(-1) === "index.ts" || segments.at(-1) === "index.js"))
|
|
1264
|
+
segments.pop();
|
|
1265
|
+
return { extension, segments };
|
|
1266
|
+
});
|
|
1267
|
+
return extensions.map(extension => {
|
|
1268
|
+
const resourcePath = extension.sourcePath ?? extension.resolvedPath ?? "extension";
|
|
1269
|
+
if (isPackageExtensionSource(extension.sourceInfo)) {
|
|
1270
|
+
return compactPackageExtensionLabel(resourcePath, extension.sourceInfo);
|
|
1271
|
+
}
|
|
1272
|
+
const localIndex = localExtensions.findIndex(item => item.extension === extension);
|
|
1273
|
+
const segments = localExtensions[localIndex]?.segments;
|
|
1274
|
+
if (!segments || segments.length === 0)
|
|
1275
|
+
return compactResourceLabel(resourcePath);
|
|
1276
|
+
for (let count = 1; count <= segments.length; count += 1) {
|
|
1277
|
+
const candidate = segments.slice(-count).join("/");
|
|
1278
|
+
if (localExtensions.every((item, itemIndex) => itemIndex === localIndex || item.segments.slice(-count).join("/") !== candidate)) {
|
|
1279
|
+
return candidate;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
return segments.join("/");
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
function compactPackageExtensionLabel(resourcePath, sourceInfo) {
|
|
1286
|
+
const sourceLabel = compactPackageSourceLabel(sourceInfo.source);
|
|
1287
|
+
if (!sourceLabel)
|
|
1288
|
+
return compactResourceLabel(resourcePath);
|
|
1289
|
+
const shortPath = shortPackagePath(resourcePath, sourceInfo).replaceAll("\\", "/");
|
|
1290
|
+
const packagePath = shortPath.startsWith("extensions/") ? shortPath.slice("extensions/".length) : shortPath;
|
|
1291
|
+
const slash = packagePath.lastIndexOf("/");
|
|
1292
|
+
const fileName = slash < 0 ? packagePath : packagePath.slice(slash + 1);
|
|
1293
|
+
const directory = slash < 0 ? "" : packagePath.slice(0, slash);
|
|
1294
|
+
const extension = fileName.lastIndexOf(".");
|
|
1295
|
+
const name = extension <= 0 ? fileName : fileName.slice(0, extension);
|
|
1296
|
+
if (name === "index")
|
|
1297
|
+
return !directory || directory === "." ? sourceLabel : `${sourceLabel}:${directory}`;
|
|
1298
|
+
return `${sourceLabel}:${packagePath}`;
|
|
1299
|
+
}
|
|
1300
|
+
function compactPackageSourceLabel(source) {
|
|
1301
|
+
if (source.startsWith("npm:"))
|
|
1302
|
+
return source.slice("npm:".length) || source;
|
|
1303
|
+
if (!source.startsWith("git:"))
|
|
1304
|
+
return source;
|
|
1305
|
+
const gitSource = source.slice("git:".length).trim();
|
|
1306
|
+
let repositoryPath;
|
|
1307
|
+
const scpLike = gitSource.match(/^git@[^:]+:(.+)$/);
|
|
1308
|
+
if (scpLike?.[1]) {
|
|
1309
|
+
repositoryPath = scpLike[1];
|
|
1310
|
+
}
|
|
1311
|
+
else if (/^[a-z]+:\/\//i.test(gitSource)) {
|
|
1312
|
+
try {
|
|
1313
|
+
repositoryPath = new URL(gitSource).pathname.replace(/^\/+/, "");
|
|
1314
|
+
}
|
|
1315
|
+
catch {
|
|
1316
|
+
return source;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
else {
|
|
1320
|
+
const slash = gitSource.indexOf("/");
|
|
1321
|
+
if (slash >= 0)
|
|
1322
|
+
repositoryPath = gitSource.slice(slash + 1);
|
|
1323
|
+
}
|
|
1324
|
+
if (!repositoryPath)
|
|
1325
|
+
return source;
|
|
1326
|
+
const ref = repositoryPath.indexOf("@");
|
|
1327
|
+
const withoutRef = ref < 0 ? repositoryPath : repositoryPath.slice(0, ref);
|
|
1328
|
+
return withoutRef.replace(/\.git$/, "") || source;
|
|
1329
|
+
}
|
|
1330
|
+
function shortPackagePath(resourcePath, sourceInfo) {
|
|
1331
|
+
const fullPath = normalizeResourcePath(resourcePath);
|
|
1332
|
+
const baseDir = sourceInfo.baseDir === null ? undefined : normalizeResourcePath(sourceInfo.baseDir).replace(/\/$/, "");
|
|
1333
|
+
if (baseDir) {
|
|
1334
|
+
const npmRoot = baseDir.match(/^(.*\/node_modules)\/(@?[^/]+(?:\/[^/]+)?)$/);
|
|
1335
|
+
if (npmRoot?.[1] && fullPath.startsWith(`${npmRoot[1]}/`))
|
|
1336
|
+
return relativeResourcePath(baseDir, fullPath);
|
|
1337
|
+
if (fullPath === baseDir)
|
|
1338
|
+
return ".";
|
|
1339
|
+
if (fullPath.startsWith(`${baseDir}/`))
|
|
1340
|
+
return fullPath.slice(baseDir.length + 1);
|
|
1341
|
+
}
|
|
1342
|
+
const npmMatch = fullPath.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)\/(.*)/);
|
|
1343
|
+
if (npmMatch?.[2] && sourceInfo.source.startsWith("npm:"))
|
|
1344
|
+
return npmMatch[2];
|
|
1345
|
+
const gitMatch = fullPath.match(/git\/[^/]+\/[^/]+\/(.*)/);
|
|
1346
|
+
if (gitMatch?.[1] && sourceInfo.source.startsWith("git:"))
|
|
1347
|
+
return gitMatch[1];
|
|
1348
|
+
return resourcePath;
|
|
1349
|
+
}
|
|
1350
|
+
function relativeResourcePath(from, to) {
|
|
1351
|
+
const fromSegments = from.split("/").filter(Boolean);
|
|
1352
|
+
const toSegments = to.split("/").filter(Boolean);
|
|
1353
|
+
let common = 0;
|
|
1354
|
+
while (common < fromSegments.length && common < toSegments.length
|
|
1355
|
+
&& fromSegments[common]?.toLowerCase() === toSegments[common]?.toLowerCase())
|
|
1356
|
+
common += 1;
|
|
1357
|
+
return [...fromSegments.slice(common).map(() => ".."), ...toSegments.slice(common)].join("/") || ".";
|
|
1358
|
+
}
|
|
1359
|
+
function compactPathSegments(path) {
|
|
1360
|
+
return normalizeResourcePath(path).split("/").filter(segment => segment.length > 0 && segment !== "~");
|
|
1361
|
+
}
|
|
1362
|
+
function normalizeResourcePath(path) {
|
|
1363
|
+
return path.replaceAll("\\", "/");
|
|
1364
|
+
}
|
|
1365
|
+
function isPackageExtensionSource(sourceInfo) {
|
|
1366
|
+
const source = sourceInfo?.source ?? "";
|
|
1367
|
+
return source.startsWith("npm:") || source.startsWith("git:");
|
|
1368
|
+
}
|
|
1369
|
+
function transientRowsSignature(steeringRows, statusRows) {
|
|
1370
|
+
return `${steeringRows.length}\u0000${steeringRows.join("\u0000")}\u0001${statusRows.length}\u0000${statusRows.join("\u0000")}`;
|
|
1371
|
+
}
|
|
1372
|
+
/** "Share URL: <url>" with the URL made clickable; other share wordings pass through unchanged. */
|
|
1373
|
+
function linkShareUrl(message) {
|
|
1374
|
+
const match = /^Share URL: (\S+)$/.exec(message);
|
|
1375
|
+
return match === null ? message : `Share URL: ${piShellHyperlink(match[1])}`;
|
|
1376
|
+
}
|