@timurproko/a1 0.1.8-dev.0b6d8cc → 0.1.8-dev.121
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 +29 -23
- package/bin/cli.js +7 -7
- package/bin/guardian.js +1 -1
- package/bin/supervisor.js +1 -1
- package/bin/ui.js +3 -3
- package/dist/{src/cli → cli}/dispatch.js +14 -12
- package/dist/{src/cli → cli}/packages.d.ts +10 -2
- package/dist/{src/cli → cli}/packages.js +24 -20
- package/dist/{src/cli → cli}/version-stats.js +4 -4
- package/dist/composition/agent-engine-bridge.d.ts +3 -0
- package/dist/composition/agent-engine-bridge.js +108 -0
- package/dist/composition/index.d.ts +3 -0
- package/dist/composition/index.js +3 -0
- package/dist/composition/owned-ui.d.ts +25 -0
- package/dist/composition/owned-ui.js +40 -0
- package/dist/composition/process.d.ts +16 -0
- package/dist/composition/process.js +45 -0
- package/dist/composition/settings-route-host.d.ts +8 -0
- package/dist/composition/settings-route-host.js +73 -0
- package/dist/{src/features → features}/owned-ui/customization.d.ts +1 -1
- package/dist/{src/features → features}/owned-ui/customization.js +1 -1
- package/dist/{src/features → features}/owned-ui/diagnostics.d.ts +1 -1
- package/dist/{src/features → features}/owned-ui/run.d.ts +2 -2
- package/dist/{src/features → features}/owned-ui/settings-app.d.ts +3 -3
- package/dist/{src/features → features}/owned-ui/settings-app.js +1 -1
- package/dist/{src/features → features}/workspace/capabilities.d.ts +1 -1
- package/dist/{src/features → features}/workspace/reducer.d.ts +1 -1
- package/dist/{src/features → features}/workspace/reducer.js +1 -1
- package/dist/{src/features → features}/workspace/router.d.ts +1 -1
- package/dist/{src/features → features}/workspace/store.d.ts +1 -1
- package/dist/{src/foundation → foundation}/launch-guardian/main.js +8 -2
- package/dist/foundation/lifecycle/paths.d.ts +28 -0
- package/dist/{src/foundation → foundation}/lifecycle/paths.js +21 -0
- package/dist/{src/foundation → foundation}/native-host-protocol/messages.d.ts +1 -1
- package/dist/{src/foundation → foundation}/native-host-protocol/messages.js +1 -1
- package/dist/{src/foundation → foundation}/release/bootstrap.js +42 -10
- package/dist/foundation/release/endpoints.d.ts +20 -0
- package/dist/foundation/release/endpoints.js +50 -0
- package/dist/{src/foundation → foundation}/release/index.d.ts +1 -0
- package/dist/{src/foundation → foundation}/release/index.js +1 -0
- package/dist/{src/foundation → foundation}/release/release-gc.d.ts +4 -1
- package/dist/{src/foundation → foundation}/release/release-gc.js +9 -1
- package/dist/{src/foundation → foundation}/release/update.d.ts +9 -1
- package/dist/{src/foundation → foundation}/release/update.js +69 -35
- package/dist/{src/foundation → foundation}/storage/control-store.d.ts +1 -1
- package/dist/{src/foundation → foundation}/storage/control-store.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.js +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.d.ts +1 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.js +1 -1
- package/dist/foundation/supervision/index.d.ts +3 -0
- package/dist/foundation/supervision/index.js +3 -0
- package/dist/{src/foundation → foundation}/supervision/main.js +11 -5
- package/dist/foundation/supervision/paths.d.ts +1 -0
- package/dist/foundation/supervision/paths.js +1 -0
- package/dist/{src/foundation → foundation}/supervision/server.d.ts +18 -1
- package/dist/{src/foundation → foundation}/supervision/server.js +52 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.js +2 -2
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.js +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.d.ts +2 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.js +113 -16
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.js +2 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.js +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.js +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.d.ts +1 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.d.ts +1 -1
- package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/route-host.d.ts +1 -1
- package/dist/{src/foundation/pi-owned-ui-integration/session-shell.d.ts → integrations/pi/owned-ui/session-shell-root.d.ts} +13 -46
- package/dist/integrations/pi/owned-ui/session-shell-root.js +722 -0
- package/dist/integrations/pi/owned-ui/session-shell.d.ts +46 -0
- package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/session-shell.js +24 -704
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.d.ts +1 -1
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/{src/foundation/ui-apps → ui/apps}/contracts.d.ts +1 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.d.ts +1 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.js +1 -1
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.d.ts +1 -1
- package/docs/architecture/boundaries.md +8 -8
- package/docs/architecture/project-structure.md +52 -29
- package/docs/architecture/toolchain.md +5 -5
- package/docs/ci-release-runbook.md +76 -79
- package/docs/features/launch-profiles.md +7 -9
- package/docs/manual-owned-ui-checkpoint.md +52 -0
- package/docs/manual-terminal-colour-check.md +1 -1
- package/package.json +24 -22
- package/dist/src/composition/index.d.ts +0 -48
- package/dist/src/composition/index.js +0 -258
- package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
- package/dist/src/foundation/supervision/index.d.ts +0 -3
- package/dist/src/foundation/supervision/index.js +0 -3
- package/dist/src/foundation/supervision/paths.d.ts +0 -1
- package/dist/src/foundation/supervision/paths.js +0 -1
- package/docs/manual-transparent-checkpoint.md +0 -53
- /package/dist/{src/cli → cli}/capabilities.d.ts +0 -0
- /package/dist/{src/cli → cli}/capabilities.js +0 -0
- /package/dist/{src/cli → cli}/dispatch.d.ts +0 -0
- /package/dist/{src/cli → cli}/index.d.ts +0 -0
- /package/dist/{src/cli → cli}/index.js +0 -0
- /package/dist/{src/cli → cli}/version-stats.d.ts +0 -0
- /package/dist/{src/cli → cli}/version.d.ts +0 -0
- /package/dist/{src/cli → cli}/version.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.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/agent-engine-contracts → contracts/agent-engine}/domain-validation.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.js +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.d.ts +0 -0
- /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.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.d.ts +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}/ports.js +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.d.ts +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}/index.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.js +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.js +0 -0
- /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.d.ts +0 -0
- /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.js +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.d.ts +0 -0
- /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.js +0 -0
- /package/dist/{src/features → features}/launch/development-launch.d.ts +0 -0
- /package/dist/{src/features → features}/launch/development-launch.js +0 -0
- /package/dist/{src/features → features}/launch/index.d.ts +0 -0
- /package/dist/{src/features → features}/launch/index.js +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/features → features}/launch/intent.d.ts +0 -0
- /package/dist/{src/features → features}/launch/intent.js +0 -0
- /package/dist/{src/features → features}/launch/prepare-launch.d.ts +0 -0
- /package/dist/{src/features → features}/launch/prepare-launch.js +0 -0
- /package/dist/{src/features → features}/launch/profile-paths.d.ts +0 -0
- /package/dist/{src/features → features}/launch/profile-paths.js +0 -0
- /package/dist/{src/features → features}/launch/profiles.d.ts +0 -0
- /package/dist/{src/features → features}/launch/profiles.js +0 -0
- /package/dist/{src/features → features}/launch/runtime-selection.d.ts +0 -0
- /package/dist/{src/features → features}/launch/runtime-selection.js +0 -0
- /package/dist/{src/features → features}/owned-ui/diagnostics.js +0 -0
- /package/dist/{src/features → features}/owned-ui/index.d.ts +0 -0
- /package/dist/{src/features → features}/owned-ui/index.js +0 -0
- /package/dist/{src/features → features}/owned-ui/run.js +0 -0
- /package/dist/{src/features → features}/workspace/capabilities.js +0 -0
- /package/dist/{src/features → features}/workspace/index.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/index.js +0 -0
- /package/dist/{src/features → features}/workspace/presentation.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/presentation.js +0 -0
- /package/dist/{src/features → features}/workspace/reconciliation.d.ts +0 -0
- /package/dist/{src/features → features}/workspace/reconciliation.js +0 -0
- /package/dist/{src/features → features}/workspace/router.js +0 -0
- /package/dist/{src/features → features}/workspace/store.js +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/index.js +0 -0
- /package/dist/{src/foundation → foundation}/launch-guardian/main.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.js +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/index.js +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}/lifecycle/model.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/model.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/codec.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/codec.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/index.js +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.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}/process-containment/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/index.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.js +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.js +0 -0
- /package/dist/{src/foundation → foundation}/protocol/client.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/client.js +0 -0
- /package/dist/{src/foundation → foundation}/protocol/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/index.js +0 -0
- /package/dist/{src/foundation → foundation}/protocol/messages.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/messages.js +0 -0
- /package/dist/{src/foundation → foundation}/release/bootstrap.d.ts +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/cohort-state.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-state.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/release-store.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/release-store.js +0 -0
- /package/dist/{src/foundation → foundation}/release/release.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/release.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 → foundation}/release/update-transaction.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/update-transaction.js +0 -0
- /package/dist/{src/foundation → foundation}/storage/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/storage/index.js +0 -0
- /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.js +0 -0
- /package/dist/{src/foundation → foundation}/supervision/main.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.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/adjacent/core/keybindings.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.d.ts +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/custom-entry.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.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/mermaid.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.js +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/components/session-selector-search.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.js +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/external-editor.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.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-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/pi-settings-metadata.json +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/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.js +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.d.ts +0 -0
- /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.js +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/index.js +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/route-host.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.d.ts +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.js +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.js +0 -0
- /package/dist/{src/product-identity.d.ts → product-identity.d.ts} +0 -0
- /package/dist/{src/product-identity.js → product-identity.js} +0 -0
- /package/dist/{src/product-identity.json → product-identity.json} +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/contracts.js +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/index.d.ts +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/index.js +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/registry.d.ts +0 -0
- /package/dist/{src/foundation/ui-apps → ui/apps}/registry.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}/dialog-panel.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/frame.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/frame.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/index.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/index.js +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}/line-input.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/line-input.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}/list-view.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-view.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/mouse.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/mouse.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}/scrollbar.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/scrollbar.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/shortcuts.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/shortcuts.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/spans.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/spans.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}/surface.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/surface.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/text.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/text.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}/declarations.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.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
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.js +0 -0
package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/session-shell.js
RENAMED
|
@@ -1,704 +1,9 @@
|
|
|
1
|
-
import { MOUSE_TRACKING_OFF, MOUSE_TRACKING_ON, parseMouseInput } from "
|
|
2
|
-
import { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_WORKFLOW_COMMAND_NAMES, } from "../
|
|
3
|
-
import { createPiExtensionUiBridge, createPiQueuedInputStatus, createPiShellArmin, createPiShellAuthProviderSelector, createPiShellChangelog, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellEditor, createPiShellExtensionSelector, createPiShellFooter, createPiShellHeader, createPiShellHotkeys, createPiShellLoadedResources, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionInfo, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellStatus, createPiShellTranscriptComponent, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, onPiThemeChange, piTheme, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellStatusText, renderPiShellTranscriptBlock, } from "../
|
|
4
|
-
import { PiTuiRuntimeAdapter, } from "../
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
header;
|
|
8
|
-
resources;
|
|
9
|
-
#cwd;
|
|
10
|
-
#transcript = new Map();
|
|
11
|
-
#blocksById = new Map();
|
|
12
|
-
#renderedRows = new Map();
|
|
13
|
-
#themeUnsubscribe;
|
|
14
|
-
#transcriptOrder = [];
|
|
15
|
-
#view;
|
|
16
|
-
#status;
|
|
17
|
-
#footer;
|
|
18
|
-
#queued;
|
|
19
|
-
#extensionRenderers;
|
|
20
|
-
#componentRuntime;
|
|
21
|
-
#toolsExpanded = false;
|
|
22
|
-
#thinkingVisible = true;
|
|
23
|
-
#workflowTranscriptSequence = 0;
|
|
24
|
-
#workflowStatusAnchors = new Map();
|
|
25
|
-
#workflowStatusMessages = new Map();
|
|
26
|
-
#lastWorkflowStatusId;
|
|
27
|
-
#inputSurface;
|
|
28
|
-
#extensionHeader = null;
|
|
29
|
-
#extensionFooter = null;
|
|
30
|
-
#extensionWidgets = new Map();
|
|
31
|
-
#extensionStatuses = new Map();
|
|
32
|
-
#extensionWorkingMessage;
|
|
33
|
-
#extensionWorkingVisible = true;
|
|
34
|
-
constructor(view, cwd, handlers, startup = {}, agentDir, extensionRenderers = {
|
|
35
|
-
getMessageRenderer: () => undefined,
|
|
36
|
-
getToolDefinition: () => undefined,
|
|
37
|
-
}) {
|
|
38
|
-
this.#view = view;
|
|
39
|
-
this.#cwd = cwd;
|
|
40
|
-
this.#extensionRenderers = extensionRenderers;
|
|
41
|
-
this.#componentRuntime = handlers;
|
|
42
|
-
this.header = createPiShellHeader(startup);
|
|
43
|
-
this.resources = createPiShellLoadedResources(startup.resources ?? [], startup.expanded ?? false);
|
|
44
|
-
this.#status = createPiShellStatus(view, handlers);
|
|
45
|
-
this.#footer = createPiShellFooter(this.#viewWithExtensionStatuses(view), cwd);
|
|
46
|
-
this.#queued = createPiQueuedInputStatus(view.editor.queuedSubmissions);
|
|
47
|
-
this.editor = createPiShellEditor({
|
|
48
|
-
...handlers,
|
|
49
|
-
cwd,
|
|
50
|
-
...(agentDir === undefined ? {} : { agentDir }),
|
|
51
|
-
onToolsExpand: () => this.#setToolsExpanded(!this.#toolsExpanded),
|
|
52
|
-
});
|
|
53
|
-
this.editor.setThinkingLevel(view.thinkingLevel);
|
|
54
|
-
this.#inputSurface = this.editor;
|
|
55
|
-
for (const block of view.transcript) {
|
|
56
|
-
if (block.kind === "user")
|
|
57
|
-
this.editor.addToHistory(block.text);
|
|
58
|
-
}
|
|
59
|
-
this.#syncTranscript(view.transcript);
|
|
60
|
-
// Colours come from the active theme, so rendered rows outlive their revision only
|
|
61
|
-
// until the theme under them changes.
|
|
62
|
-
this.#themeUnsubscribe = onPiThemeChange(() => this.#renderedRows.clear());
|
|
63
|
-
}
|
|
64
|
-
update(view) {
|
|
65
|
-
this.#view = view;
|
|
66
|
-
this.#status.update(view);
|
|
67
|
-
this.#footer.update(this.#viewWithExtensionStatuses(view));
|
|
68
|
-
this.#queued.update(view.editor.queuedSubmissions);
|
|
69
|
-
this.#syncTranscript(view.transcript);
|
|
70
|
-
this.editor.setSubmitEnabled(view.lifecycle !== "stopping" && view.lifecycle !== "stopped" && view.lifecycle !== "failed");
|
|
71
|
-
this.editor.setThinkingLevel(view.thinkingLevel);
|
|
72
|
-
this.invalidate();
|
|
73
|
-
}
|
|
74
|
-
render(width) {
|
|
75
|
-
const queued = this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width);
|
|
76
|
-
return [
|
|
77
|
-
...this.#renderDocument(width),
|
|
78
|
-
...queued,
|
|
79
|
-
...this.#renderStatus(width),
|
|
80
|
-
...this.#renderWidgets("aboveEditor", width),
|
|
81
|
-
...this.#inputSurface.render(width),
|
|
82
|
-
...this.#renderWidgets("belowEditor", width),
|
|
83
|
-
...this.#renderFooter(width),
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
layoutRoot() {
|
|
87
|
-
const document = layoutPort(width => this.#renderDocument(width), () => this.invalidate());
|
|
88
|
-
const queued = layoutPort(width => this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width), () => this.#queued.invalidate());
|
|
89
|
-
const aboveWidgets = layoutPort(width => this.#renderWidgets("aboveEditor", width), () => this.#invalidateExtensions());
|
|
90
|
-
const status = layoutPort(width => this.#renderStatus(width), () => this.#status.invalidate());
|
|
91
|
-
const editor = layoutPort(width => this.#inputSurface.render(width), () => this.#inputSurface.invalidate(), data => this.#inputSurface.handleInput?.(data));
|
|
92
|
-
const belowWidgets = layoutPort(width => this.#renderWidgets("belowEditor", width), () => this.#invalidateExtensions());
|
|
93
|
-
const footer = layoutPort(width => this.#renderFooter(width), () => (this.#extensionFooter ?? this.#footer).invalidate());
|
|
94
|
-
return {
|
|
95
|
-
type: "stack",
|
|
96
|
-
direction: "vertical",
|
|
97
|
-
children: [
|
|
98
|
-
{
|
|
99
|
-
basis: 0,
|
|
100
|
-
grow: 1,
|
|
101
|
-
shrink: 1,
|
|
102
|
-
minSize: 1,
|
|
103
|
-
node: {
|
|
104
|
-
type: "scroll",
|
|
105
|
-
id: "transcript",
|
|
106
|
-
follow: "end",
|
|
107
|
-
primary: true,
|
|
108
|
-
overscroll: "chain",
|
|
109
|
-
scrollbar: "auto",
|
|
110
|
-
scrollbarStyle: text => piTheme().bg("scrollbarThumb", text),
|
|
111
|
-
child: { type: "component", component: document },
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
basis: "auto",
|
|
116
|
-
grow: 0,
|
|
117
|
-
shrink: 1,
|
|
118
|
-
minSize: 1,
|
|
119
|
-
node: {
|
|
120
|
-
type: "stack",
|
|
121
|
-
direction: "vertical",
|
|
122
|
-
children: [
|
|
123
|
-
{ shrink: 1, minSize: 0, node: { type: "component", component: queued } },
|
|
124
|
-
{ shrink: 1, minSize: 0, node: { type: "component", component: status } },
|
|
125
|
-
{ shrink: 1, minSize: 0, node: { type: "component", component: aboveWidgets } },
|
|
126
|
-
{ shrink: 1, minSize: 3, node: { type: "component", component: editor } },
|
|
127
|
-
{ shrink: 1, minSize: 0, node: { type: "component", component: belowWidgets } },
|
|
128
|
-
{ shrink: 1, minSize: 1, node: { type: "component", component: footer } },
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
#renderDocument(width) {
|
|
136
|
-
const transcript = this.#transcriptOrder.flatMap((id, index) => {
|
|
137
|
-
const block = this.#blocksById.get(id);
|
|
138
|
-
if (!this.#thinkingVisible && block?.kind === "thinking")
|
|
139
|
-
return [];
|
|
140
|
-
const rows = this.#blockRows(id, block, width);
|
|
141
|
-
if (index > 0 && block?.kind === "user")
|
|
142
|
-
return ["", ...rows];
|
|
143
|
-
return rows;
|
|
144
|
-
});
|
|
145
|
-
const diagnostics = this.#view.diagnostics;
|
|
146
|
-
const startupRows = diagnostics
|
|
147
|
-
.filter(diagnostic => diagnostic.code === "engine-startup")
|
|
148
|
-
.flatMap(diagnostic => renderPiShellStartupDiagnostic(diagnostic, width));
|
|
149
|
-
const packageUpdateRows = diagnostics
|
|
150
|
-
.filter(diagnostic => diagnostic.code === "package-updates")
|
|
151
|
-
.flatMap(diagnostic => renderPiShellPackageUpdateNotice(diagnostic.message.split("\n").filter(line => line.startsWith("- ")).map(line => line.slice(2)), width));
|
|
152
|
-
const diagnosticRows = diagnostics
|
|
153
|
-
.filter(diagnostic => diagnostic.code !== "engine-startup" && diagnostic.code !== "package-updates")
|
|
154
|
-
.slice(-3)
|
|
155
|
-
.flatMap(diagnostic => renderPiShellTranscriptBlock({
|
|
156
|
-
id: `diagnostic-${diagnostic.sequence}`,
|
|
157
|
-
kind: diagnostic.severity === "error" ? "error" : "system",
|
|
158
|
-
status: "finalized",
|
|
159
|
-
revision: diagnostic.sequence,
|
|
160
|
-
title: diagnostic.code,
|
|
161
|
-
text: diagnostic.message,
|
|
162
|
-
payload: {},
|
|
163
|
-
}, width, this.#cwd));
|
|
164
|
-
const resourceRows = [...this.resources.render(width)];
|
|
165
|
-
if (resourceRows.at(-1) === "")
|
|
166
|
-
resourceRows.pop();
|
|
167
|
-
return [
|
|
168
|
-
...startupRows,
|
|
169
|
-
...(this.#extensionHeader ?? this.header).render(width),
|
|
170
|
-
...resourceRows,
|
|
171
|
-
...transcript,
|
|
172
|
-
...packageUpdateRows,
|
|
173
|
-
...diagnosticRows,
|
|
174
|
-
];
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Rows for one transcript block. A finalized block renders once for a given revision
|
|
178
|
-
* and width and is reused after that, so a frame costs what changed rather than what
|
|
179
|
-
* the session has accumulated. A live block, and anything the shell drives itself, is
|
|
180
|
-
* rendered every time because its content is still moving.
|
|
181
|
-
*/
|
|
182
|
-
#blockRows(id, block, width) {
|
|
183
|
-
const component = this.#transcript.get(id);
|
|
184
|
-
if (component === undefined)
|
|
185
|
-
return [];
|
|
186
|
-
if (block === undefined || block.status !== "finalized")
|
|
187
|
-
return component.render(width);
|
|
188
|
-
const cached = this.#renderedRows.get(id);
|
|
189
|
-
if (cached && cached.width === width && cached.revision === block.revision)
|
|
190
|
-
return cached.rows;
|
|
191
|
-
const rows = component.render(width);
|
|
192
|
-
this.#renderedRows.set(id, { width, revision: block.revision, rows });
|
|
193
|
-
return rows;
|
|
194
|
-
}
|
|
195
|
-
transcriptComponent(id) {
|
|
196
|
-
return this.#transcript.get(id);
|
|
197
|
-
}
|
|
198
|
-
appendWorkflowStatus(message) {
|
|
199
|
-
const previousId = this.#lastWorkflowStatusId;
|
|
200
|
-
if (previousId !== undefined
|
|
201
|
-
&& this.#transcriptOrder.at(-1) === previousId
|
|
202
|
-
&& this.#workflowStatusAnchors.get(previousId) === this.#view.transcript.length) {
|
|
203
|
-
this.#workflowStatusMessages.set(previousId, message);
|
|
204
|
-
this.invalidate();
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
const id = this.#appendAnchoredWorkflowComponent(width => [
|
|
208
|
-
"",
|
|
209
|
-
...renderPiShellStatusText(this.#workflowStatusMessages.get(id) ?? message, width),
|
|
210
|
-
]);
|
|
211
|
-
this.#workflowStatusMessages.set(id, message);
|
|
212
|
-
this.#lastWorkflowStatusId = id;
|
|
213
|
-
}
|
|
214
|
-
appendWorkflowResult(result) {
|
|
215
|
-
if (result.command === "reload" && result.outcome === "completed") {
|
|
216
|
-
this.appendWorkflowStatus(result.message);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (result.command === "session" && result.outcome === "completed" && result.presentation?.kind === "session-info") {
|
|
220
|
-
this.#lastWorkflowStatusId = undefined;
|
|
221
|
-
const sessionInfo = createPiShellSessionInfo(result.presentation);
|
|
222
|
-
this.#appendAnchoredWorkflowComponent(width => sessionInfo.render(width), () => sessionInfo.dispose?.());
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (result.command === "hotkeys" && result.outcome === "completed") {
|
|
226
|
-
this.#lastWorkflowStatusId = undefined;
|
|
227
|
-
const hotkeys = createPiShellHotkeys();
|
|
228
|
-
this.#appendAnchoredWorkflowComponent(width => hotkeys.render(width), () => hotkeys.dispose?.());
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (result.command === "changelog" && result.outcome === "completed") {
|
|
232
|
-
this.#lastWorkflowStatusId = undefined;
|
|
233
|
-
const changelog = createPiShellChangelog(result.detail ?? "No changelog entries found.");
|
|
234
|
-
this.#appendAnchoredWorkflowComponent(width => changelog.render(width), () => changelog.dispose?.());
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
if (result.outcome === "failed") {
|
|
238
|
-
this.#lastWorkflowStatusId = undefined;
|
|
239
|
-
const warning = (result.command === "name" && result.message.startsWith("Usage:"))
|
|
240
|
-
|| (result.command === "reload" && result.message.startsWith("Wait for "));
|
|
241
|
-
const prefix = warning ? "Warning" : "Error";
|
|
242
|
-
const color = warning ? "warning" : "error";
|
|
243
|
-
this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg(color, `${prefix}: ${result.message}`)}`]);
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (result.outcome === "completed" && (result.command === "quit" || result.command === "compact"))
|
|
247
|
-
return;
|
|
248
|
-
if (result.command === "new" && result.outcome === "completed") {
|
|
249
|
-
this.#lastWorkflowStatusId = undefined;
|
|
250
|
-
this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg("accent", result.message)}`]);
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
if (result.command === "name" && result.outcome === "completed") {
|
|
254
|
-
this.#lastWorkflowStatusId = undefined;
|
|
255
|
-
this.#appendAnchoredWorkflowComponent(() => [
|
|
256
|
-
...(result.detail ? ["", ` ${piTheme().fg("warning", `Warning: ${result.detail}`)}`] : []),
|
|
257
|
-
"",
|
|
258
|
-
` ${piTheme().fg("dim", result.message)}`,
|
|
259
|
-
]);
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
if (result.command === "debug" && result.outcome === "completed") {
|
|
263
|
-
this.#lastWorkflowStatusId = undefined;
|
|
264
|
-
this.#appendAnchoredWorkflowComponent(() => [
|
|
265
|
-
"",
|
|
266
|
-
` ${piTheme().fg("accent", result.message)}`,
|
|
267
|
-
...(result.detail ? [` ${piTheme().fg("muted", result.detail)}`] : []),
|
|
268
|
-
]);
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
if (result.command === "arminsayshi" && result.outcome === "completed") {
|
|
272
|
-
this.#lastWorkflowStatusId = undefined;
|
|
273
|
-
const armin = createPiShellArmin(this.#componentRuntime);
|
|
274
|
-
this.#appendAnchoredWorkflowComponent(width => ["", ...armin.render(width)], () => armin.dispose?.());
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
if (result.command === "dementedelves" && result.outcome === "completed") {
|
|
278
|
-
this.#lastWorkflowStatusId = undefined;
|
|
279
|
-
const announcement = createPiShellEarendilAnnouncement();
|
|
280
|
-
this.#appendAnchoredWorkflowComponent(width => ["", ...announcement.render(width)], () => announcement.dispose?.());
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
const message = result.command === "share" && result.detail
|
|
284
|
-
? `${result.message}\nGist: ${result.detail}`
|
|
285
|
-
: result.message;
|
|
286
|
-
this.appendWorkflowStatus(message);
|
|
287
|
-
}
|
|
288
|
-
appendDaxnuts() {
|
|
289
|
-
this.#lastWorkflowStatusId = undefined;
|
|
290
|
-
const daxnuts = createPiShellDaxnuts(this.#componentRuntime);
|
|
291
|
-
this.#appendAnchoredWorkflowComponent(width => ["", ...daxnuts.render(width)], () => daxnuts.dispose?.());
|
|
292
|
-
}
|
|
293
|
-
toggleThinkingVisibility() {
|
|
294
|
-
this.#thinkingVisible = !this.#thinkingVisible;
|
|
295
|
-
this.invalidate();
|
|
296
|
-
}
|
|
297
|
-
get toolsExpanded() {
|
|
298
|
-
return this.#toolsExpanded;
|
|
299
|
-
}
|
|
300
|
-
setToolsExpanded(expanded) {
|
|
301
|
-
this.#setToolsExpanded(expanded);
|
|
302
|
-
}
|
|
303
|
-
setExtensionWidget(key, component, placement) {
|
|
304
|
-
const previous = this.#extensionWidgets.get(key)?.component;
|
|
305
|
-
if (component === null)
|
|
306
|
-
this.#extensionWidgets.delete(key);
|
|
307
|
-
else
|
|
308
|
-
this.#extensionWidgets.set(key, { component, placement });
|
|
309
|
-
if (previous !== undefined && previous !== component)
|
|
310
|
-
previous.dispose?.();
|
|
311
|
-
this.invalidate();
|
|
312
|
-
}
|
|
313
|
-
setExtensionHeader(component) {
|
|
314
|
-
if (this.#extensionHeader !== component)
|
|
315
|
-
this.#extensionHeader?.dispose?.();
|
|
316
|
-
this.#extensionHeader = component;
|
|
317
|
-
this.invalidate();
|
|
318
|
-
}
|
|
319
|
-
setExtensionFooter(component) {
|
|
320
|
-
if (this.#extensionFooter !== component)
|
|
321
|
-
this.#extensionFooter?.dispose?.();
|
|
322
|
-
this.#extensionFooter = component;
|
|
323
|
-
this.invalidate();
|
|
324
|
-
}
|
|
325
|
-
setExtensionStatus(key, text) {
|
|
326
|
-
if (text === undefined)
|
|
327
|
-
this.#extensionStatuses.delete(key);
|
|
328
|
-
else
|
|
329
|
-
this.#extensionStatuses.set(key, text);
|
|
330
|
-
this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
|
|
331
|
-
this.invalidate();
|
|
332
|
-
}
|
|
333
|
-
setExtensionWorking(message, visible = this.#extensionWorkingVisible) {
|
|
334
|
-
this.#extensionWorkingMessage = message;
|
|
335
|
-
this.#extensionWorkingVisible = visible;
|
|
336
|
-
this.#status.setWorkingOverride(visible ? message : undefined);
|
|
337
|
-
this.invalidate();
|
|
338
|
-
}
|
|
339
|
-
resetWorkflowPresentation() {
|
|
340
|
-
for (const id of this.#workflowStatusAnchors.keys()) {
|
|
341
|
-
this.#transcript.get(id)?.dispose?.();
|
|
342
|
-
this.#transcript.delete(id);
|
|
343
|
-
}
|
|
344
|
-
this.#workflowStatusAnchors.clear();
|
|
345
|
-
this.#workflowStatusMessages.clear();
|
|
346
|
-
this.#transcriptOrder = this.#transcriptOrder.filter(id => !id.startsWith("workflow-status-"));
|
|
347
|
-
this.#lastWorkflowStatusId = undefined;
|
|
348
|
-
this.invalidate();
|
|
349
|
-
}
|
|
350
|
-
resetExtensionUi() {
|
|
351
|
-
this.#extensionHeader?.dispose?.();
|
|
352
|
-
this.#extensionFooter?.dispose?.();
|
|
353
|
-
for (const { component } of this.#extensionWidgets.values())
|
|
354
|
-
component.dispose?.();
|
|
355
|
-
this.#extensionHeader = null;
|
|
356
|
-
this.#extensionFooter = null;
|
|
357
|
-
this.#extensionWidgets.clear();
|
|
358
|
-
this.#extensionStatuses.clear();
|
|
359
|
-
this.#extensionWorkingMessage = undefined;
|
|
360
|
-
this.#status.setWorkingOverride(undefined);
|
|
361
|
-
this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
|
|
362
|
-
// An extension renderer may have drawn transcript blocks that are now unrendered by it.
|
|
363
|
-
this.#renderedRows.clear();
|
|
364
|
-
this.invalidate();
|
|
365
|
-
}
|
|
366
|
-
addExtensionNotification(message, type) {
|
|
367
|
-
if (type === "info") {
|
|
368
|
-
this.appendWorkflowStatus(message);
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
this.#lastWorkflowStatusId = undefined;
|
|
372
|
-
const prefix = type === "warning" ? "Warning" : "Error";
|
|
373
|
-
this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg(type, `${prefix}: ${message}`)}`]);
|
|
374
|
-
}
|
|
375
|
-
extensionFooterData() {
|
|
376
|
-
return {
|
|
377
|
-
getGitBranch: () => this.#view.status.footer?.branch ?? null,
|
|
378
|
-
getExtensionStatuses: () => new Map(this.#extensionStatuses),
|
|
379
|
-
getAvailableProviderCount: () => this.#view.status.footer?.availableProviderCount ?? 1,
|
|
380
|
-
onBranchChange: () => () => { },
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
setInputSurface(component, disposePrevious = true) {
|
|
384
|
-
const next = component ?? this.editor;
|
|
385
|
-
if (next === this.#inputSurface)
|
|
386
|
-
return;
|
|
387
|
-
this.#inputSurface.setFocused?.(false);
|
|
388
|
-
if (disposePrevious && this.#inputSurface !== this.editor)
|
|
389
|
-
this.#inputSurface.dispose?.();
|
|
390
|
-
this.#inputSurface = next;
|
|
391
|
-
this.#inputSurface.setFocused?.(true);
|
|
392
|
-
this.invalidate();
|
|
393
|
-
}
|
|
394
|
-
handleInput(data) {
|
|
395
|
-
this.#inputSurface.handleInput?.(data);
|
|
396
|
-
}
|
|
397
|
-
invalidate() {
|
|
398
|
-
this.header.invalidate();
|
|
399
|
-
this.resources.invalidate();
|
|
400
|
-
for (const component of this.#transcript.values())
|
|
401
|
-
component.invalidate();
|
|
402
|
-
this.editor.invalidate();
|
|
403
|
-
if (this.#inputSurface !== this.editor)
|
|
404
|
-
this.#inputSurface.invalidate();
|
|
405
|
-
this.#invalidateExtensions();
|
|
406
|
-
this.#status.invalidate();
|
|
407
|
-
this.#footer.invalidate();
|
|
408
|
-
this.#queued.invalidate();
|
|
409
|
-
}
|
|
410
|
-
setFocused(focused) {
|
|
411
|
-
this.#inputSurface.setFocused?.(focused);
|
|
412
|
-
}
|
|
413
|
-
dispose() {
|
|
414
|
-
this.#themeUnsubscribe();
|
|
415
|
-
this.header.dispose?.();
|
|
416
|
-
this.resources.dispose?.();
|
|
417
|
-
for (const component of this.#transcript.values())
|
|
418
|
-
component.dispose?.();
|
|
419
|
-
this.#transcript.clear();
|
|
420
|
-
this.#renderedRows.clear();
|
|
421
|
-
if (this.#inputSurface !== this.editor)
|
|
422
|
-
this.#inputSurface.dispose?.();
|
|
423
|
-
this.#extensionHeader?.dispose?.();
|
|
424
|
-
this.#extensionFooter?.dispose?.();
|
|
425
|
-
for (const { component } of this.#extensionWidgets.values())
|
|
426
|
-
component.dispose?.();
|
|
427
|
-
this.#extensionWidgets.clear();
|
|
428
|
-
this.editor.dispose?.();
|
|
429
|
-
this.#status.dispose?.();
|
|
430
|
-
this.#footer.dispose?.();
|
|
431
|
-
this.#queued.dispose?.();
|
|
432
|
-
}
|
|
433
|
-
#syncTranscript(blocks) {
|
|
434
|
-
this.#blocksById.clear();
|
|
435
|
-
for (const block of blocks)
|
|
436
|
-
this.#blocksById.set(block.id, block);
|
|
437
|
-
const nextIds = new Set(blocks.map(block => block.id));
|
|
438
|
-
for (const [id, component] of this.#transcript) {
|
|
439
|
-
if (id.startsWith("workflow-status-") || nextIds.has(id))
|
|
440
|
-
continue;
|
|
441
|
-
component.dispose?.();
|
|
442
|
-
this.#transcript.delete(id);
|
|
443
|
-
this.#renderedRows.delete(id);
|
|
444
|
-
}
|
|
445
|
-
for (const block of blocks) {
|
|
446
|
-
const component = this.#transcript.get(block.id);
|
|
447
|
-
if (component === undefined) {
|
|
448
|
-
const created = createPiShellTranscriptComponent(block, this.#cwd, this.#extensionRenderers);
|
|
449
|
-
created.setExpanded(this.#toolsExpanded);
|
|
450
|
-
this.#transcript.set(block.id, created);
|
|
451
|
-
}
|
|
452
|
-
else if (component.revision !== block.revision) {
|
|
453
|
-
component.update(block);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
const statusIds = [...this.#workflowStatusAnchors.keys()];
|
|
457
|
-
const order = [];
|
|
458
|
-
for (let index = 0; index <= blocks.length; index += 1) {
|
|
459
|
-
for (const statusId of statusIds) {
|
|
460
|
-
if (this.#workflowStatusAnchors.get(statusId) === index)
|
|
461
|
-
order.push(statusId);
|
|
462
|
-
}
|
|
463
|
-
const block = blocks[index];
|
|
464
|
-
if (block !== undefined)
|
|
465
|
-
order.push(block.id);
|
|
466
|
-
}
|
|
467
|
-
const placed = new Set(order);
|
|
468
|
-
for (const statusId of statusIds) {
|
|
469
|
-
if (!placed.has(statusId))
|
|
470
|
-
order.push(statusId);
|
|
471
|
-
}
|
|
472
|
-
this.#transcriptOrder = order;
|
|
473
|
-
}
|
|
474
|
-
#appendAnchoredWorkflowComponent(render, dispose) {
|
|
475
|
-
this.#workflowTranscriptSequence += 1;
|
|
476
|
-
const id = `workflow-status-${this.#workflowTranscriptSequence}`;
|
|
477
|
-
const component = {
|
|
478
|
-
id,
|
|
479
|
-
revision: 1,
|
|
480
|
-
render,
|
|
481
|
-
handleInput() { },
|
|
482
|
-
invalidate() { },
|
|
483
|
-
update() { },
|
|
484
|
-
setExpanded() { },
|
|
485
|
-
...(dispose === undefined ? {} : { dispose }),
|
|
486
|
-
};
|
|
487
|
-
this.#transcript.set(id, component);
|
|
488
|
-
this.#workflowStatusAnchors.set(id, this.#view.transcript.length);
|
|
489
|
-
this.#transcriptOrder.push(id);
|
|
490
|
-
this.invalidate();
|
|
491
|
-
return id;
|
|
492
|
-
}
|
|
493
|
-
#renderWidgets(placement, width) {
|
|
494
|
-
const rows = [...this.#extensionWidgets.values()]
|
|
495
|
-
.filter(widget => widget.placement === placement)
|
|
496
|
-
.flatMap(widget => widget.component.render(width));
|
|
497
|
-
return placement === "aboveEditor" ? ["", ...rows] : rows;
|
|
498
|
-
}
|
|
499
|
-
#renderStatus(width) {
|
|
500
|
-
return this.#status.render(width);
|
|
501
|
-
}
|
|
502
|
-
#renderFooter(width) {
|
|
503
|
-
return (this.#extensionFooter ?? this.#footer).render(width);
|
|
504
|
-
}
|
|
505
|
-
#viewWithExtensionStatuses(view) {
|
|
506
|
-
const footer = view.status.footer;
|
|
507
|
-
const statuses = new Map(footer?.extensionStatuses ?? []);
|
|
508
|
-
for (const [key, text] of this.#extensionStatuses)
|
|
509
|
-
statuses.set(key, text);
|
|
510
|
-
return {
|
|
511
|
-
...view,
|
|
512
|
-
status: {
|
|
513
|
-
...view.status,
|
|
514
|
-
footer: {
|
|
515
|
-
branch: footer?.branch ?? null,
|
|
516
|
-
sessionName: footer?.sessionName ?? null,
|
|
517
|
-
availableProviderCount: footer?.availableProviderCount ?? 1,
|
|
518
|
-
extensionStatuses: [...statuses],
|
|
519
|
-
},
|
|
520
|
-
},
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
#invalidateExtensions() {
|
|
524
|
-
this.#extensionHeader?.invalidate();
|
|
525
|
-
this.#extensionFooter?.invalidate();
|
|
526
|
-
for (const { component } of this.#extensionWidgets.values())
|
|
527
|
-
component.invalidate();
|
|
528
|
-
}
|
|
529
|
-
#setToolsExpanded(expanded) {
|
|
530
|
-
this.#toolsExpanded = expanded;
|
|
531
|
-
this.header.setExpanded(expanded);
|
|
532
|
-
this.resources.setExpanded(expanded);
|
|
533
|
-
for (const component of this.#transcript.values())
|
|
534
|
-
component.setExpanded(expanded);
|
|
535
|
-
// Expansion changes what a block draws without changing its revision.
|
|
536
|
-
this.#renderedRows.clear();
|
|
537
|
-
this.invalidate();
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
function layoutPort(render, invalidate, handleInput) {
|
|
541
|
-
return {
|
|
542
|
-
render,
|
|
543
|
-
invalidate,
|
|
544
|
-
...(handleInput === undefined ? {} : { handleInput }),
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
function shellResourceEntries(backend) {
|
|
548
|
-
const resources = backend.nonVisualResources().map(resource => ({
|
|
549
|
-
section: resource.kind === "skill"
|
|
550
|
-
? "Skills"
|
|
551
|
-
: resource.kind === "prompt-template"
|
|
552
|
-
? "Prompts"
|
|
553
|
-
: resource.kind === "theme"
|
|
554
|
-
? "Themes"
|
|
555
|
-
: "Context",
|
|
556
|
-
label: resource.kind === "prompt-template"
|
|
557
|
-
? `/${resource.label}`
|
|
558
|
-
: resource.kind === "agent-context" || resource.kind === "system-prompt"
|
|
559
|
-
? compactResourceLabel(resource.sourcePath ?? resource.label)
|
|
560
|
-
: resource.label,
|
|
561
|
-
sourcePath: resource.sourcePath,
|
|
562
|
-
diagnostic: resource.diagnostic,
|
|
563
|
-
}));
|
|
564
|
-
const extensions = backend.extensionResources().filter(extension => !extension.hidden);
|
|
565
|
-
const loadedExtensions = extensions.filter(extension => extension.diagnostic === null);
|
|
566
|
-
const extensionLabels = compactExtensionLabels(loadedExtensions);
|
|
567
|
-
for (const extension of extensions) {
|
|
568
|
-
const labelIndex = loadedExtensions.indexOf(extension);
|
|
569
|
-
resources.push({
|
|
570
|
-
section: "Extensions",
|
|
571
|
-
label: extensionLabels[labelIndex] ?? compactResourceLabel(extension.sourcePath ?? extension.resolvedPath ?? "extension"),
|
|
572
|
-
sourcePath: extension.sourcePath ?? extension.resolvedPath,
|
|
573
|
-
diagnostic: extension.diagnostic,
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
return resources;
|
|
577
|
-
}
|
|
578
|
-
function compactResourceLabel(path) {
|
|
579
|
-
const segments = compactPathSegments(path);
|
|
580
|
-
const leaf = segments.at(-1) ?? path;
|
|
581
|
-
if ((leaf === "index.ts" || leaf === "index.js") && segments.length > 1)
|
|
582
|
-
return segments.at(-2) ?? leaf;
|
|
583
|
-
return leaf;
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Pinned from InteractiveMode's compact extension-label helpers at Pi commit
|
|
587
|
-
* 914cf1472e715297caa30db4b9535d534a9eb718. The source metadata crosses an
|
|
588
|
-
* A1-owned boundary first; the owned shell never inspects Pi's private root.
|
|
589
|
-
*/
|
|
590
|
-
function compactExtensionLabels(extensions) {
|
|
591
|
-
const localExtensions = extensions
|
|
592
|
-
.filter(extension => !isPackageExtensionSource(extension.sourceInfo))
|
|
593
|
-
.map(extension => {
|
|
594
|
-
const path = extension.sourcePath ?? extension.resolvedPath ?? "extension";
|
|
595
|
-
const segments = compactPathSegments(path);
|
|
596
|
-
if (segments.length > 1 && (segments.at(-1) === "index.ts" || segments.at(-1) === "index.js"))
|
|
597
|
-
segments.pop();
|
|
598
|
-
return { extension, segments };
|
|
599
|
-
});
|
|
600
|
-
return extensions.map(extension => {
|
|
601
|
-
const resourcePath = extension.sourcePath ?? extension.resolvedPath ?? "extension";
|
|
602
|
-
if (isPackageExtensionSource(extension.sourceInfo)) {
|
|
603
|
-
return compactPackageExtensionLabel(resourcePath, extension.sourceInfo);
|
|
604
|
-
}
|
|
605
|
-
const localIndex = localExtensions.findIndex(item => item.extension === extension);
|
|
606
|
-
const segments = localExtensions[localIndex]?.segments;
|
|
607
|
-
if (!segments || segments.length === 0)
|
|
608
|
-
return compactResourceLabel(resourcePath);
|
|
609
|
-
for (let count = 1; count <= segments.length; count += 1) {
|
|
610
|
-
const candidate = segments.slice(-count).join("/");
|
|
611
|
-
if (localExtensions.every((item, itemIndex) => itemIndex === localIndex || item.segments.slice(-count).join("/") !== candidate)) {
|
|
612
|
-
return candidate;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
return segments.join("/");
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
function compactPackageExtensionLabel(resourcePath, sourceInfo) {
|
|
619
|
-
const sourceLabel = compactPackageSourceLabel(sourceInfo.source);
|
|
620
|
-
if (!sourceLabel)
|
|
621
|
-
return compactResourceLabel(resourcePath);
|
|
622
|
-
const shortPath = shortPackagePath(resourcePath, sourceInfo).replaceAll("\\", "/");
|
|
623
|
-
const packagePath = shortPath.startsWith("extensions/") ? shortPath.slice("extensions/".length) : shortPath;
|
|
624
|
-
const slash = packagePath.lastIndexOf("/");
|
|
625
|
-
const fileName = slash < 0 ? packagePath : packagePath.slice(slash + 1);
|
|
626
|
-
const directory = slash < 0 ? "" : packagePath.slice(0, slash);
|
|
627
|
-
const extension = fileName.lastIndexOf(".");
|
|
628
|
-
const name = extension <= 0 ? fileName : fileName.slice(0, extension);
|
|
629
|
-
if (name === "index")
|
|
630
|
-
return !directory || directory === "." ? sourceLabel : `${sourceLabel}:${directory}`;
|
|
631
|
-
return `${sourceLabel}:${packagePath}`;
|
|
632
|
-
}
|
|
633
|
-
function compactPackageSourceLabel(source) {
|
|
634
|
-
if (source.startsWith("npm:"))
|
|
635
|
-
return source.slice("npm:".length) || source;
|
|
636
|
-
if (!source.startsWith("git:"))
|
|
637
|
-
return source;
|
|
638
|
-
const gitSource = source.slice("git:".length).trim();
|
|
639
|
-
let repositoryPath;
|
|
640
|
-
const scpLike = gitSource.match(/^git@[^:]+:(.+)$/);
|
|
641
|
-
if (scpLike?.[1]) {
|
|
642
|
-
repositoryPath = scpLike[1];
|
|
643
|
-
}
|
|
644
|
-
else if (/^[a-z]+:\/\//i.test(gitSource)) {
|
|
645
|
-
try {
|
|
646
|
-
repositoryPath = new URL(gitSource).pathname.replace(/^\/+/, "");
|
|
647
|
-
}
|
|
648
|
-
catch {
|
|
649
|
-
return source;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
else {
|
|
653
|
-
const slash = gitSource.indexOf("/");
|
|
654
|
-
if (slash >= 0)
|
|
655
|
-
repositoryPath = gitSource.slice(slash + 1);
|
|
656
|
-
}
|
|
657
|
-
if (!repositoryPath)
|
|
658
|
-
return source;
|
|
659
|
-
const ref = repositoryPath.indexOf("@");
|
|
660
|
-
const withoutRef = ref < 0 ? repositoryPath : repositoryPath.slice(0, ref);
|
|
661
|
-
return withoutRef.replace(/\.git$/, "") || source;
|
|
662
|
-
}
|
|
663
|
-
function shortPackagePath(resourcePath, sourceInfo) {
|
|
664
|
-
const fullPath = normalizeResourcePath(resourcePath);
|
|
665
|
-
const baseDir = sourceInfo.baseDir === null ? undefined : normalizeResourcePath(sourceInfo.baseDir).replace(/\/$/, "");
|
|
666
|
-
if (baseDir) {
|
|
667
|
-
const npmRoot = baseDir.match(/^(.*\/node_modules)\/(@?[^/]+(?:\/[^/]+)?)$/);
|
|
668
|
-
if (npmRoot?.[1] && fullPath.startsWith(`${npmRoot[1]}/`))
|
|
669
|
-
return relativeResourcePath(baseDir, fullPath);
|
|
670
|
-
if (fullPath === baseDir)
|
|
671
|
-
return ".";
|
|
672
|
-
if (fullPath.startsWith(`${baseDir}/`))
|
|
673
|
-
return fullPath.slice(baseDir.length + 1);
|
|
674
|
-
}
|
|
675
|
-
const npmMatch = fullPath.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)\/(.*)/);
|
|
676
|
-
if (npmMatch?.[2] && sourceInfo.source.startsWith("npm:"))
|
|
677
|
-
return npmMatch[2];
|
|
678
|
-
const gitMatch = fullPath.match(/git\/[^/]+\/[^/]+\/(.*)/);
|
|
679
|
-
if (gitMatch?.[1] && sourceInfo.source.startsWith("git:"))
|
|
680
|
-
return gitMatch[1];
|
|
681
|
-
return resourcePath;
|
|
682
|
-
}
|
|
683
|
-
function relativeResourcePath(from, to) {
|
|
684
|
-
const fromSegments = from.split("/").filter(Boolean);
|
|
685
|
-
const toSegments = to.split("/").filter(Boolean);
|
|
686
|
-
let common = 0;
|
|
687
|
-
while (common < fromSegments.length && common < toSegments.length
|
|
688
|
-
&& fromSegments[common]?.toLowerCase() === toSegments[common]?.toLowerCase())
|
|
689
|
-
common += 1;
|
|
690
|
-
return [...fromSegments.slice(common).map(() => ".."), ...toSegments.slice(common)].join("/") || ".";
|
|
691
|
-
}
|
|
692
|
-
function compactPathSegments(path) {
|
|
693
|
-
return normalizeResourcePath(path).split("/").filter(segment => segment.length > 0 && segment !== "~");
|
|
694
|
-
}
|
|
695
|
-
function normalizeResourcePath(path) {
|
|
696
|
-
return path.replaceAll("\\", "/");
|
|
697
|
-
}
|
|
698
|
-
function isPackageExtensionSource(sourceInfo) {
|
|
699
|
-
const source = sourceInfo?.source ?? "";
|
|
700
|
-
return source.startsWith("npm:") || source.startsWith("git:");
|
|
701
|
-
}
|
|
1
|
+
import { MOUSE_TRACKING_OFF, MOUSE_TRACKING_ON, parseMouseInput } from "../../../ui/components/index.js";
|
|
2
|
+
import { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_WORKFLOW_COMMAND_NAMES, } from "../engine/index.js";
|
|
3
|
+
import { createPiExtensionUiBridge, createPiQueuedInputStatus, createPiShellArmin, createPiShellAuthProviderSelector, createPiShellChangelog, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellEditor, createPiShellExtensionSelector, createPiShellFooter, createPiShellHeader, createPiShellHotkeys, createPiShellLoadedResources, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionInfo, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellStatus, createPiShellTranscriptComponent, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, onPiThemeChange, piTheme, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellStatusText, renderPiShellTranscriptBlock, } from "../components/index.js";
|
|
4
|
+
import { PiTuiRuntimeAdapter, } from "../tui-runtime/index.js";
|
|
5
|
+
import { OwnedUiSessionShellRoot, shellResourceEntries, } from "./session-shell-root.js";
|
|
6
|
+
export { OwnedUiSessionShellRoot } from "./session-shell-root.js";
|
|
702
7
|
export class OwnedUiSessionShell {
|
|
703
8
|
backend;
|
|
704
9
|
root;
|
|
@@ -794,9 +99,12 @@ export class OwnedUiSessionShell {
|
|
|
794
99
|
});
|
|
795
100
|
this.root.editor.setAutocompleteCommands(this.backend.workflowAutocompleteCommands());
|
|
796
101
|
this.#unsubscribe = this.backend.onEvent(event => {
|
|
797
|
-
//
|
|
798
|
-
//
|
|
799
|
-
|
|
102
|
+
// A streamed chunk names one block, and touching only that block is what keeps the
|
|
103
|
+
// cost of a chunk the same in a long session as in a new one. Everything else
|
|
104
|
+
// resynchronizes the view, which is cheap next to re-reading the transcript.
|
|
105
|
+
const view = event.type === "transcript-block" && this.#sessionGeneration === this.backend.sessionGeneration
|
|
106
|
+
? this.#syncBlock(event.block)
|
|
107
|
+
: this.#syncView();
|
|
800
108
|
if (view.lifecycle === "ready" && this.#compactionQueue.length > 0)
|
|
801
109
|
void this.#flushCompactionQueue();
|
|
802
110
|
if (event.type === "session-lifecycle" && event.lifecycle === "stopped")
|
|
@@ -1415,6 +723,18 @@ export class OwnedUiSessionShell {
|
|
|
1415
723
|
this.#extensionBridge.dispose();
|
|
1416
724
|
await this.runtime.dispose();
|
|
1417
725
|
}
|
|
726
|
+
/**
|
|
727
|
+
* Applies one transcript block without re-reading the session. The listeners still hear
|
|
728
|
+
* the view they would have heard, so nothing downstream can tell the difference.
|
|
729
|
+
*/
|
|
730
|
+
#syncBlock(block) {
|
|
731
|
+
this.root.applyTranscriptBlock(block);
|
|
732
|
+
this.runtime.requestRender();
|
|
733
|
+
const view = this.view();
|
|
734
|
+
for (const listener of this.#listeners)
|
|
735
|
+
listener(view);
|
|
736
|
+
return view;
|
|
737
|
+
}
|
|
1418
738
|
#syncView() {
|
|
1419
739
|
const view = this.view();
|
|
1420
740
|
if (this.backend.sessionGeneration !== this.#sessionGeneration) {
|