@timurproko/a1 0.2.6 → 0.2.7-dev.1222
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 +41 -3
- package/bin/automatic-update.js +7 -0
- package/bin/cli.js +4 -0
- package/bin/guardian.js +5 -0
- package/bin/tab-launch-context.d.ts +27 -0
- package/bin/tab-launch-context.js +94 -0
- package/bin/ui.js +107 -59
- package/dist/app/session-shell/clipboard-diagnostics.js +1 -1
- package/dist/app/session-shell/dialog-coordinator.d.ts +42 -0
- package/dist/app/session-shell/dialog-coordinator.js +133 -0
- package/dist/app/session-shell/dock-chrome.d.ts +34 -0
- package/dist/app/session-shell/dock-chrome.js +109 -0
- package/dist/app/session-shell/exit-notice.d.ts +1 -1
- package/dist/app/session-shell/exit-notice.js +1 -1
- package/dist/app/session-shell/extension-surface.d.ts +30 -0
- package/dist/app/session-shell/extension-surface.js +105 -0
- package/dist/app/session-shell/helper-pool.d.ts +3 -5
- package/dist/app/session-shell/helper-pool.js +3 -5
- package/dist/app/session-shell/input-surface-switch.d.ts +36 -0
- package/dist/app/session-shell/input-surface-switch.js +85 -0
- package/dist/app/session-shell/login-interaction.d.ts +27 -0
- package/dist/app/session-shell/login-interaction.js +91 -0
- package/dist/app/session-shell/prompt-submission.d.ts +48 -0
- package/dist/app/session-shell/prompt-submission.js +276 -0
- package/dist/app/session-shell/resident-tab-coordinator.d.ts +38 -0
- package/dist/app/session-shell/resident-tab-coordinator.js +77 -0
- package/dist/app/session-shell/response-copy-helper.js +21 -6
- package/dist/app/session-shell/response-copy-protocol.d.ts +1 -1
- package/dist/app/session-shell/response-copy-transport.d.ts +16 -6
- package/dist/app/session-shell/response-copy-transport.js +69 -17
- package/dist/app/session-shell/session-concern.d.ts +22 -0
- package/dist/app/session-shell/session-concern.js +29 -0
- package/dist/app/session-shell/session-lifecycle.d.ts +29 -0
- package/dist/app/session-shell/session-lifecycle.js +49 -0
- package/dist/app/session-shell/session-shell-root.d.ts +42 -6
- package/dist/app/session-shell/session-shell-root.js +197 -908
- package/dist/app/session-shell/session-shell.d.ts +3 -8
- package/dist/app/session-shell/session-shell.js +327 -835
- package/dist/app/session-shell/session-viewport-controller.d.ts +2 -1
- package/dist/app/session-shell/session-viewport-controller.js +41 -38
- package/dist/app/session-shell/settings-bindings.d.ts +17 -0
- package/dist/app/session-shell/settings-bindings.js +91 -0
- package/dist/app/session-shell/shell-editor-factory.d.ts +27 -0
- package/dist/app/session-shell/shell-editor-factory.js +105 -0
- package/dist/app/session-shell/shell-host.d.ts +6 -0
- package/dist/app/session-shell/shell-host.js +34 -7
- package/dist/app/session-shell/shell-layout.d.ts +64 -0
- package/dist/app/session-shell/shell-layout.js +18 -0
- package/dist/app/session-shell/suggestion-surface.d.ts +25 -0
- package/dist/app/session-shell/suggestion-surface.js +63 -0
- package/dist/app/session-shell/transcript-document.d.ts +78 -0
- package/dist/app/session-shell/transcript-document.js +365 -0
- package/dist/app/session-shell/viewport-layout.d.ts +31 -0
- package/dist/app/session-shell/viewport-layout.js +160 -0
- package/dist/app/session-shell/workflow-output.d.ts +33 -0
- package/dist/app/session-shell/workflow-output.js +174 -0
- package/dist/app/session-shell/workflow-router.d.ts +25 -0
- package/dist/app/session-shell/workflow-router.js +39 -0
- package/dist/cli/dispatch.d.ts +11 -1
- package/dist/cli/dispatch.js +79 -5
- package/dist/cli/tabs-request.d.ts +7 -0
- package/dist/cli/tabs-request.js +1 -0
- package/dist/cli/tabs.d.ts +14 -0
- package/dist/cli/tabs.js +151 -0
- package/dist/cli/version-stats.js +38 -3
- package/dist/composition/owned-settings.d.ts +12 -0
- package/dist/composition/owned-settings.js +36 -0
- package/dist/composition/owned-ui.d.ts +27 -28
- package/dist/composition/owned-ui.js +207 -153
- package/dist/composition/reference-selection-options.d.ts +3 -0
- package/dist/composition/reference-selection-options.js +16 -0
- package/dist/composition/resident-tab-bridge.d.ts +25 -0
- package/dist/composition/resident-tab-bridge.js +180 -0
- package/dist/composition/session-backend.d.ts +19 -0
- package/dist/composition/session-backend.js +1 -0
- package/dist/composition/session-runtime-registry.d.ts +20 -0
- package/dist/composition/session-runtime-registry.js +85 -0
- package/dist/composition/settings-route-host.d.ts +16 -2
- package/dist/composition/settings-route-host.js +42 -17
- package/dist/composition/settings-search-input.d.ts +9 -0
- package/dist/composition/settings-search-input.js +61 -0
- package/dist/composition/startup-route.d.ts +32 -0
- package/dist/composition/startup-route.js +72 -0
- package/dist/composition/utility-tab.d.ts +28 -0
- package/dist/composition/utility-tab.js +244 -0
- package/dist/contracts/owned-ui/index.d.ts +1 -1
- package/dist/contracts/owned-ui/model.d.ts +3 -0
- package/dist/contracts/owned-ui/session-backend.d.ts +3 -0
- package/dist/contracts/owned-ui/session-workflows.d.ts +11 -4
- package/dist/contracts/presentation/index.d.ts +11 -0
- package/dist/contracts/presentation/index.js +12 -0
- package/dist/features/launch/development-launch.js +6 -0
- package/dist/features/launch/index.d.ts +1 -1
- package/dist/features/launch/intent.d.ts +3 -1
- package/dist/features/launch/intent.js +7 -4
- package/dist/features/launch/profile-paths.js +4 -0
- package/dist/features/owned-ui/plus-menu-dialog.d.ts +22 -0
- package/dist/features/owned-ui/plus-menu-dialog.js +84 -0
- package/dist/features/owned-ui/project-trust-dialog.d.ts +1 -1
- package/dist/features/owned-ui/project-trust-dialog.js +6 -8
- package/dist/features/owned-ui/project-trust-prompt.d.ts +1 -0
- package/dist/features/owned-ui/project-trust-prompt.js +7 -3
- package/dist/features/owned-ui/reference-document-selection.d.ts +30 -0
- package/dist/features/owned-ui/reference-document-selection.js +179 -0
- package/dist/features/owned-ui/reference-screen-app.d.ts +6 -1
- package/dist/features/owned-ui/reference-screen-app.js +51 -10
- package/dist/features/owned-ui/settings-app.d.ts +13 -2
- package/dist/features/owned-ui/settings-app.js +136 -97
- package/dist/features/owned-ui/settings-search-input.d.ts +29 -0
- package/dist/features/owned-ui/settings-search-input.js +1 -0
- package/dist/features/prompt-history/index.d.ts +1 -1
- package/dist/features/prompt-history/paths.d.ts +2 -1
- package/dist/features/prompt-history/paths.js +10 -2
- package/dist/features/prompt-history/service.d.ts +5 -0
- package/dist/features/prompt-history/service.js +1 -1
- package/dist/features/resident-tab/auto-name.d.ts +11 -0
- package/dist/features/resident-tab/auto-name.js +44 -0
- package/dist/features/resident-tab/index.d.ts +5 -0
- package/dist/features/resident-tab/index.js +7 -0
- package/dist/features/resident-tab/shortcut-bindings-file.d.ts +8 -0
- package/dist/features/resident-tab/shortcut-bindings-file.js +40 -0
- package/dist/features/resident-tab/shortcut-declarations.d.ts +13 -0
- package/dist/features/resident-tab/shortcut-declarations.js +26 -0
- package/dist/features/resident-tab/shortcut-projection.d.ts +29 -0
- package/dist/features/resident-tab/shortcut-projection.js +64 -0
- package/dist/features/resident-tab/status-deriver.d.ts +10 -0
- package/dist/features/resident-tab/status-deriver.js +12 -0
- package/dist/foundation/launch-context/index.d.ts +12 -0
- package/dist/foundation/launch-context/index.js +26 -0
- package/dist/foundation/launch-guardian/exit-watcher.d.ts +14 -0
- package/dist/foundation/launch-guardian/exit-watcher.js +94 -0
- package/dist/foundation/launch-guardian/main.d.ts +7 -1
- package/dist/foundation/launch-guardian/main.js +60 -7
- package/dist/foundation/lifecycle/session-repository-context.js +16 -2
- package/dist/foundation/process-containment/{native-guardian-containment.d.ts → addon-containment.d.ts} +7 -5
- package/dist/foundation/process-containment/addon-containment.js +139 -0
- package/dist/foundation/process-containment/addon-process-inspector.d.ts +11 -0
- package/dist/foundation/process-containment/addon-process-inspector.js +36 -0
- package/dist/foundation/process-containment/addon.d.ts +42 -0
- package/dist/foundation/process-containment/addon.js +57 -0
- package/dist/foundation/process-containment/artifact.d.ts +1 -1
- package/dist/foundation/process-containment/artifact.js +6 -5
- package/dist/foundation/process-containment/contracts.d.ts +2 -0
- package/dist/foundation/process-containment/index.d.ts +4 -4
- package/dist/foundation/process-containment/index.js +3 -3
- package/dist/foundation/process-containment/native-process-inspector.d.ts +2 -1
- package/dist/foundation/process-containment/native-process-inspector.js +10 -10
- package/dist/foundation/release/automatic-update.d.ts +37 -0
- package/dist/foundation/release/automatic-update.js +265 -0
- package/dist/foundation/release/bootstrap.d.ts +7 -9
- package/dist/foundation/release/bootstrap.js +107 -24
- package/dist/foundation/release/cohort-state.d.ts +1 -1
- package/dist/foundation/release/cohort-state.js +1 -1
- package/dist/foundation/release/dependency-certification.js +54 -19
- package/dist/foundation/release/early-accent.d.ts +12 -0
- package/dist/foundation/release/early-accent.js +59 -0
- package/dist/foundation/release/index.d.ts +2 -2
- package/dist/foundation/release/index.js +2 -2
- package/dist/foundation/release/latest-release.d.ts +24 -2
- package/dist/foundation/release/latest-release.js +51 -1
- package/dist/foundation/release/progress-palette.generated.d.ts +137 -3
- package/dist/foundation/release/progress-palette.generated.js +137 -3
- package/dist/foundation/release/release-gc.d.ts +3 -0
- package/dist/foundation/release/release-gc.js +59 -8
- package/dist/foundation/release/release-store.d.ts +12 -0
- package/dist/foundation/release/release-store.js +124 -2
- package/dist/foundation/release/update-execution-lease.d.ts +48 -0
- package/dist/foundation/release/update-execution-lease.js +161 -0
- package/dist/foundation/release/update.d.ts +12 -7
- package/dist/foundation/release/update.js +281 -196
- package/dist/foundation/resident-tabs/bounded-host-command.d.ts +18 -0
- package/dist/foundation/resident-tabs/bounded-host-command.js +39 -0
- package/dist/foundation/resident-tabs/bridge-client.d.ts +70 -0
- package/dist/foundation/resident-tabs/bridge-client.js +321 -0
- package/dist/foundation/resident-tabs/doctor.d.ts +28 -0
- package/dist/foundation/resident-tabs/doctor.js +166 -0
- package/dist/foundation/resident-tabs/draft-checkpoint.d.ts +27 -0
- package/dist/foundation/resident-tabs/draft-checkpoint.js +145 -0
- package/dist/foundation/resident-tabs/ensure-terminal-host.d.ts +36 -0
- package/dist/foundation/resident-tabs/ensure-terminal-host.js +151 -0
- package/dist/foundation/resident-tabs/fault-injection.d.ts +8 -0
- package/dist/foundation/resident-tabs/fault-injection.js +26 -0
- package/dist/foundation/resident-tabs/fixture-control.d.ts +7 -0
- package/dist/foundation/resident-tabs/fixture-control.js +35 -0
- package/dist/foundation/resident-tabs/host-entry.d.ts +1 -0
- package/dist/foundation/resident-tabs/host-entry.js +17 -0
- package/dist/foundation/resident-tabs/index.d.ts +12 -0
- package/dist/foundation/resident-tabs/index.js +6 -0
- package/dist/foundation/resident-tabs/maintenance.d.ts +39 -0
- package/dist/foundation/resident-tabs/maintenance.js +75 -0
- package/dist/foundation/resident-tabs/progress-observation-schema.d.ts +34 -0
- package/dist/foundation/resident-tabs/progress-observation-schema.js +1 -0
- package/dist/foundation/resident-tabs/progress-observation.d.ts +4 -0
- package/dist/foundation/resident-tabs/progress-observation.js +150 -0
- package/dist/foundation/resident-tabs/prompt-journal.d.ts +63 -0
- package/dist/foundation/resident-tabs/prompt-journal.js +213 -0
- package/dist/foundation/resident-tabs/protocol.d.ts +12 -0
- package/dist/foundation/resident-tabs/protocol.js +195 -0
- package/dist/foundation/resident-tabs/recovery.d.ts +26 -0
- package/dist/foundation/resident-tabs/recovery.js +205 -0
- package/dist/foundation/resident-tabs/release-holds.d.ts +28 -0
- package/dist/foundation/resident-tabs/release-holds.js +75 -0
- package/dist/foundation/resident-tabs/routes.d.ts +5 -0
- package/dist/foundation/resident-tabs/routes.js +5 -0
- package/dist/foundation/resident-tabs/routing.d.ts +11 -0
- package/dist/foundation/resident-tabs/routing.js +10 -0
- package/dist/foundation/resident-tabs/session-sync.d.ts +14 -0
- package/dist/foundation/resident-tabs/session-sync.js +37 -0
- package/dist/foundation/resident-tabs/settings.d.ts +12 -0
- package/dist/foundation/resident-tabs/settings.js +58 -0
- package/dist/foundation/resident-tabs/terminal-host-artifact.d.ts +14 -0
- package/dist/foundation/resident-tabs/terminal-host-artifact.js +78 -0
- package/dist/foundation/resident-tabs/zip-archive.d.ts +9 -0
- package/dist/foundation/resident-tabs/zip-archive.js +56 -0
- package/dist/foundation/session-writer-lock/index.d.ts +30 -0
- package/dist/foundation/session-writer-lock/index.js +203 -0
- package/dist/foundation/startup/startup-descriptor.js +2 -2
- package/dist/foundation/terminal-cleanup/index.d.ts +1 -1
- package/dist/foundation/terminal-cleanup/index.js +1 -1
- package/dist/foundation/terminal-cleanup/terminal-reset.d.ts +6 -0
- package/dist/foundation/terminal-cleanup/terminal-reset.js +6 -0
- package/dist/integrations/pi/components/editor-interaction.d.ts +2 -0
- package/dist/integrations/pi/components/modal-frame.d.ts +17 -1
- package/dist/integrations/pi/components/modal-frame.js +48 -9
- package/dist/integrations/pi/components/models-dialog.js +4 -52
- package/dist/integrations/pi/components/owned-editor-ux.d.ts +6 -1
- package/dist/integrations/pi/components/owned-editor-ux.js +138 -11
- package/dist/integrations/pi/components/resources/builtin-themes.d.ts +4 -4
- package/dist/integrations/pi/components/resources/builtin-themes.js +4 -4
- package/dist/integrations/pi/components/share-operation-dialog.d.ts +2 -0
- package/dist/integrations/pi/components/share-operation-dialog.js +2 -1
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +58 -36
- package/dist/integrations/pi/components/shell-extension-ui.js +79 -60
- package/dist/integrations/pi/components/shell-footer-status.d.ts +1 -1
- package/dist/integrations/pi/components/shell-footer-status.js +21 -5
- package/dist/integrations/pi/components/shell-hotkey-sections.js +1 -1
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +5 -2
- package/dist/integrations/pi/components/shell-presenters-info.js +18 -4
- package/dist/integrations/pi/components/shell-presenters-transcript.js +4 -1
- package/dist/integrations/pi/components/shell-selectors-dialogs.js +5 -1
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +12 -1
- package/dist/integrations/pi/components/skills-dialog.js +2 -2
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +17 -4
- package/dist/integrations/pi/components/upstream/assets/earendil-image.json +2 -2
- package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +1 -1
- package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/extension-editor.js +1 -1
- package/dist/integrations/pi/components/upstream/components/extension-input.js +1 -1
- package/dist/integrations/pi/components/upstream/components/extension-selector.js +1 -1
- package/dist/integrations/pi/components/upstream/components/mermaid.js +1 -1
- package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +8 -6
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +16 -9
- package/dist/integrations/pi/components/upstream/components/pi-logo.js +1 -1
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +4 -4
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +2 -2
- package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +2 -1
- package/dist/integrations/pi/components/upstream/components/session-footer.js +31 -25
- package/dist/integrations/pi/components/upstream/components/session-selector-search.js +1 -1
- package/dist/integrations/pi/components/upstream/components/session-selector.js +8 -7
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +1 -1
- package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +2 -2
- package/dist/integrations/pi/components/upstream/components/status-indicator.js +3 -3
- package/dist/integrations/pi/components/upstream/components/themed-text.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/themed-text.js +1 -1
- package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +8 -7
- package/dist/integrations/pi/components/upstream/components/thinking-selector.js +10 -9
- package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +2 -6
- package/dist/integrations/pi/components/upstream/components/tool-execution.js +103 -101
- package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +9 -9
- package/dist/integrations/pi/components/upstream/components/tree-selector.js +13 -21
- package/dist/integrations/pi/components/upstream/components/trust-selector.js +1 -1
- package/dist/integrations/pi/components/upstream/external-editor.js +1 -1
- package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +2 -2
- package/dist/integrations/pi/components/upstream/history/editor-core.js +7 -5
- package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/history/kill-ring.js +1 -1
- package/dist/integrations/pi/components/upstream/history/printable-key.js +1 -1
- package/dist/integrations/pi/components/upstream/history/text-helpers.js +1 -1
- package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/history/undo-stack.js +1 -1
- package/dist/integrations/pi/components/upstream/history/word-navigation.js +1 -1
- package/dist/integrations/pi/components/upstream/model-search.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/program-status-reporter.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/theme/theme.d.ts +5 -0
- package/dist/integrations/pi/components/upstream/theme/theme.js +29 -2
- package/dist/integrations/pi/engine/adapter.d.ts +5 -77
- package/dist/integrations/pi/engine/adapter.js +95 -394
- package/dist/integrations/pi/engine/command-dispatch.d.ts +13 -0
- package/dist/integrations/pi/engine/command-dispatch.js +57 -0
- package/dist/integrations/pi/engine/host.js +2 -2
- package/dist/integrations/pi/engine/offline-settings-port.d.ts +23 -0
- package/dist/integrations/pi/engine/offline-settings-port.js +53 -0
- package/dist/integrations/pi/engine/pi-settings-metadata.json +14 -2
- package/dist/integrations/pi/engine/ports.d.ts +56 -0
- package/dist/integrations/pi/engine/ports.js +93 -0
- package/dist/integrations/pi/engine/prompt-suggestions.d.ts +1 -0
- package/dist/integrations/pi/engine/prompt-suggestions.js +40 -0
- package/dist/integrations/pi/engine/resources/changelog.json +4 -4
- package/dist/integrations/pi/engine/runtime-integration.js +102 -29
- package/dist/integrations/pi/engine/session-runtime.d.ts +0 -6
- package/dist/integrations/pi/engine/session-runtime.js +13 -5
- package/dist/integrations/pi/engine/session-selection.d.ts +3 -0
- package/dist/integrations/pi/engine/session-selection.js +45 -9
- package/dist/integrations/pi/engine/settings-bridge.d.ts +5 -0
- package/dist/integrations/pi/engine/settings-bridge.js +15 -0
- package/dist/integrations/pi/engine/settings-port.js +11 -15
- package/dist/integrations/pi/engine/view-state.d.ts +42 -0
- package/dist/integrations/pi/engine/view-state.js +126 -0
- package/dist/integrations/pi/engine/workflow-contexts.js +10 -1
- package/dist/integrations/pi/engine/workflow-runner.js +74 -5
- package/dist/integrations/pi/engine/workflow-support.d.ts +12 -0
- package/dist/integrations/pi/engine/workflow-support.js +36 -0
- package/dist/integrations/pi/engine/workflows.d.ts +3 -1
- package/dist/integrations/pi/engine/workflows.js +1 -0
- package/dist/integrations/pi/startup-public.js +257 -310
- package/dist/integrations/pi/startup-public.manifest.json +564 -440
- package/dist/integrations/pi/tui-runtime/adapter.d.ts +6 -0
- package/dist/integrations/pi/tui-runtime/adapter.js +32 -1
- package/dist/integrations/pi/tui-runtime/contracts.d.ts +5 -0
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +12 -1
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +31 -2
- package/dist/native/darwin-arm64/manifest.json +10 -7
- package/dist/native/darwin-arm64/process-guardian.node +0 -0
- package/dist/native/darwin-arm64/terminal-host-THIRD-PARTY-NOTICES.txt +10500 -0
- package/dist/native/darwin-arm64/terminal-host.manifest.json +46 -0
- package/dist/native/darwin-arm64/terminal-host.node +0 -0
- package/dist/native/darwin-x64/manifest.json +23 -0
- package/dist/native/darwin-x64/process-guardian.node +0 -0
- package/dist/native/darwin-x64/terminal-host-THIRD-PARTY-NOTICES.txt +10737 -0
- package/dist/native/darwin-x64/terminal-host.manifest.json +46 -0
- package/dist/native/darwin-x64/terminal-host.node +0 -0
- package/dist/native/linux-x64/manifest.json +10 -7
- package/dist/native/linux-x64/process-guardian.node +0 -0
- package/dist/native/linux-x64/terminal-host-THIRD-PARTY-NOTICES.txt +11226 -0
- package/dist/native/linux-x64/terminal-host.manifest.json +46 -0
- package/dist/native/linux-x64/terminal-host.node +0 -0
- package/dist/native/win32-x64/manifest.json +10 -7
- package/dist/native/win32-x64/process-guardian.node +0 -0
- package/dist/native/win32-x64/terminal-host-THIRD-PARTY-NOTICES.txt +10757 -0
- package/dist/native/win32-x64/terminal-host.manifest.json +46 -0
- package/dist/native/win32-x64/terminal-host.node +0 -0
- package/dist/product-identity.d.ts +3 -3
- package/dist/product-identity.js +4 -4
- package/dist/product-identity.json +16 -2
- package/dist/runtime-payload-inventory.json +6330 -6677
- package/dist/ui/apps/host.d.ts +2 -0
- package/dist/ui/apps/host.js +7 -1
- package/dist/ui/components/dialog-panel.d.ts +17 -8
- package/dist/ui/components/dialog-panel.js +117 -41
- package/dist/ui/components/index.d.ts +5 -5
- package/dist/ui/components/index.js +4 -4
- package/dist/ui/components/line-input.d.ts +4 -1
- package/dist/ui/components/line-input.js +3 -1
- package/dist/ui/components/prompt-input.d.ts +11 -8
- package/dist/ui/components/prompt-input.js +15 -13
- package/dist/ui/components/scrollbar.d.ts +1 -1
- package/dist/ui/components/scrollbar.js +1 -1
- package/dist/ui/components/selection-copy.d.ts +3 -3
- package/dist/ui/components/selection-copy.js +16 -1
- package/dist/ui/components/spans.js +2 -2
- package/dist/ui/components/submitted-prompt.d.ts +9 -6
- package/dist/ui/components/submitted-prompt.js +20 -12
- package/dist/ui/components/surface.js +4 -2
- package/dist/ui/components/text-selection.d.ts +1 -2
- package/dist/ui/components/text-selection.js +5 -2
- package/dist/ui/components/text.d.ts +3 -6
- package/dist/ui/components/text.js +6 -8
- package/dist/ui/components/transcript-viewport.d.ts +9 -2
- package/dist/ui/components/transcript-viewport.js +179 -58
- package/dist/ui/settings/declarations.d.ts +90 -16
- package/dist/ui/settings/declarations.js +67 -14
- package/dist/ui/settings/early-accent.d.ts +81 -0
- package/dist/ui/settings/early-accent.js +50 -0
- package/dist/ui/settings/index.d.ts +4 -2
- package/dist/ui/settings/index.js +2 -1
- package/dist/ui/settings/manager.d.ts +16 -3
- package/dist/ui/settings/manager.js +122 -33
- package/dist/ui/settings/migrations.d.ts +6 -0
- package/dist/ui/settings/migrations.js +73 -0
- package/dist/ui/settings/profile-document.d.ts +26 -0
- package/dist/ui/settings/profile-document.js +164 -0
- package/dist/ui/settings/progress-palette.generated.d.ts +139 -0
- package/dist/ui/settings/progress-palette.generated.js +139 -0
- package/dist/ui/settings/sections.d.ts +4 -0
- package/dist/ui/settings/sections.js +9 -3
- package/docs/architecture/boundaries.md +24 -9
- package/docs/architecture/evidence/resident-tabs/linux-x64.md +37 -0
- package/docs/architecture/evidence/resident-tabs/macos-arm64.md +36 -0
- package/docs/architecture/evidence/resident-tabs/macos-x64.md +35 -0
- package/docs/architecture/evidence/resident-tabs/windows-x64.md +36 -0
- package/docs/architecture/internal-naming.md +3 -1
- package/docs/architecture/process-guardian-provenance.md +18 -10
- package/docs/architecture/project-structure.md +8 -0
- package/docs/architecture/resident-tabs-requirements.md +18 -0
- package/docs/architecture/resident-tabs.md +649 -0
- package/docs/architecture/response-copy-delivery.md +1 -1
- package/docs/architecture/terminal-host-proof-gate.md +2 -0
- package/docs/architecture/terminal-host-provenance.md +16 -4
- package/docs/architecture/tool-image-presentation.md +2 -1
- package/docs/architecture/toolchain.md +11 -9
- package/docs/ci-release-runbook.md +14 -7
- package/docs/features/launch-profiles.md +11 -8
- package/docs/features/prompt-history.md +41 -20
- package/docs/manual-resident-tabs-acceptance.md +51 -0
- package/docs/openspec-archive-automation.md +49 -22
- package/docs/validation.md +49 -9
- package/package.json +19 -6
- package/dist/foundation/process-containment/darwin-process-inspector.d.ts +0 -5
- package/dist/foundation/process-containment/darwin-process-inspector.js +0 -7
- package/dist/foundation/process-containment/native-guardian-containment.js +0 -152
- package/dist/foundation/process-containment/windows-process-inspector.d.ts +0 -19
- package/dist/foundation/process-containment/windows-process-inspector.js +0 -56
- package/dist/native/darwin-arm64/process-guardian +0 -0
- package/dist/native/linux-x64/process-guardian +0 -0
- package/dist/native/win32-x64/process-guardian.exe +0 -0
|
@@ -2,7 +2,7 @@ import { PiTranscriptProjection } from "./transcript-projection.js";
|
|
|
2
2
|
import { isRecord, readModel, readStringArray, readThinkingLevel, stringProperty } from "./message-values.js";
|
|
3
3
|
import { getAgentDir } from "../startup-public.js";
|
|
4
4
|
import { assertOwnedUiSnapshot, } from "../../../contracts/owned-ui/index.js";
|
|
5
|
-
import { PiCommandDispatch } from "./command-dispatch.js";
|
|
5
|
+
import { PiCommandDispatch, performEngineCommand } from "./command-dispatch.js";
|
|
6
6
|
import { PiEventDelivery } from "./event-delivery.js";
|
|
7
7
|
import { PiExtensionUiBinding } from "./extension-ui-binding.js";
|
|
8
8
|
import { PiPromptSuggestions } from "./prompt-suggestions.js";
|
|
@@ -15,16 +15,12 @@ import { readUsageView } from "./usage-view.js";
|
|
|
15
15
|
import { PiWorkflowContexts } from "./workflow-contexts.js";
|
|
16
16
|
import { PiWorkflowRunner } from "./workflow-runner.js";
|
|
17
17
|
import { defaultWorkflowHost } from "./workflow-support.js";
|
|
18
|
+
import { EngineViewState } from "./view-state.js";
|
|
19
|
+
import { createEnginePorts } from "./ports.js";
|
|
18
20
|
/** Explicit flush failure when required delivery was interrupted rather than completed. */
|
|
19
21
|
export class EngineDeliveryError extends Error {
|
|
20
22
|
constructor() { super("Engine delivery did not complete"); this.name = "EngineDeliveryError"; }
|
|
21
23
|
}
|
|
22
|
-
const DEFAULT_SURFACE = {
|
|
23
|
-
columns: 100,
|
|
24
|
-
rows: 32,
|
|
25
|
-
focusedRegion: "editor",
|
|
26
|
-
hardwareCursor: false,
|
|
27
|
-
};
|
|
28
24
|
/** Owns the pinned Pi session lifecycle and serves it to the owned shell as the neutral session backend. */
|
|
29
25
|
export class PiEngineAdapter {
|
|
30
26
|
#agentDir;
|
|
@@ -38,31 +34,11 @@ export class PiEngineAdapter {
|
|
|
38
34
|
#resources;
|
|
39
35
|
#settings;
|
|
40
36
|
#suggestions;
|
|
41
|
-
#
|
|
42
|
-
#lifecycle = "starting";
|
|
43
|
-
#editor = {
|
|
44
|
-
text: "",
|
|
45
|
-
queuedSubmissions: [],
|
|
46
|
-
selection: null,
|
|
47
|
-
cursorOffset: 0,
|
|
48
|
-
historyRevision: 0,
|
|
49
|
-
submitEnabled: false,
|
|
50
|
-
};
|
|
51
|
-
#status = {
|
|
52
|
-
title: "Pi",
|
|
53
|
-
workingMessage: null,
|
|
54
|
-
diagnostics: [],
|
|
55
|
-
badges: [],
|
|
56
|
-
};
|
|
57
|
-
#terminal = DEFAULT_SURFACE;
|
|
58
|
-
#activeModel = null;
|
|
59
|
-
#thinkingLevel = "medium";
|
|
37
|
+
#state = new EngineViewState();
|
|
60
38
|
#projection = new PiTranscriptProjection({
|
|
61
39
|
retryAttempt: () => this.#engine.session?.retryAttempt ?? 0,
|
|
62
40
|
blockChanged: block => this.#emitEvent({ type: "transcript-block", block }),
|
|
63
41
|
});
|
|
64
|
-
#usageCache;
|
|
65
|
-
#diagnostics = [];
|
|
66
42
|
// Invariant: every port closes over adapter state read at call time, so delivery is built before a session binds.
|
|
67
43
|
#delivery = new PiEventDelivery({
|
|
68
44
|
sessionId: () => this.#sessionId,
|
|
@@ -80,36 +56,30 @@ export class PiEngineAdapter {
|
|
|
80
56
|
#events = new PiSessionEvents(this.#projection, {
|
|
81
57
|
sessionGeneration: () => this.#engine.generation,
|
|
82
58
|
sessionMessages: () => this.#engine.session?.messages ?? [],
|
|
83
|
-
activeModel: () => this.#activeModel,
|
|
59
|
+
activeModel: () => this.#state.activeModel,
|
|
84
60
|
replaceTranscript: blocks => { this.#setTranscript(blocks); },
|
|
85
61
|
emit: value => { this.#emitEvent(value); },
|
|
86
62
|
emitView: () => { this.#emitView(); },
|
|
87
63
|
enterWork: message => {
|
|
88
|
-
|
|
89
|
-
this.#lifecycle = "busy";
|
|
90
|
-
this.#status = { ...this.#status, workingMessage: message, workingProgress: null };
|
|
91
|
-
if (!wasBusy)
|
|
64
|
+
if (!this.#state.enterWork(message))
|
|
92
65
|
this.#emitEvent({ type: "session-lifecycle", lifecycle: "busy", reason: null });
|
|
93
|
-
this.#emitEvent({ type: "status", status: this.#status });
|
|
66
|
+
this.#emitEvent({ type: "status", status: this.#state.status });
|
|
94
67
|
},
|
|
95
68
|
leaveWork: () => {
|
|
96
|
-
this.#
|
|
97
|
-
this.#status = { ...this.#status, workingMessage: null, workingProgress: null };
|
|
69
|
+
this.#state.leaveWork();
|
|
98
70
|
this.#emitEvent({ type: "session-lifecycle", lifecycle: "ready", reason: null });
|
|
99
|
-
this.#emitEvent({ type: "status", status: this.#status });
|
|
71
|
+
this.#emitEvent({ type: "status", status: this.#state.status });
|
|
100
72
|
},
|
|
101
73
|
workProgress: percent => {
|
|
102
|
-
if (this.#
|
|
103
|
-
|
|
104
|
-
this.#status = { ...this.#status, workingProgress: percent };
|
|
105
|
-
this.#emitEvent({ type: "status", status: this.#status });
|
|
74
|
+
if (this.#state.setWorkProgress(percent))
|
|
75
|
+
this.#emitEvent({ type: "status", status: this.#state.status });
|
|
106
76
|
},
|
|
107
77
|
queueChanged: queuedSubmissions => {
|
|
108
|
-
this.#
|
|
109
|
-
this.#emitEvent({ type: "editor-state", editor: this.#editor });
|
|
78
|
+
this.#state.setQueuedSubmissions(queuedSubmissions);
|
|
79
|
+
this.#emitEvent({ type: "editor-state", editor: this.#state.editor });
|
|
110
80
|
},
|
|
111
|
-
thinkingLevelChanged: level => { this.#thinkingLevel = level; },
|
|
112
|
-
usageInvalidated: () => { this.#
|
|
81
|
+
thinkingLevelChanged: level => { this.#state.thinkingLevel = level; },
|
|
82
|
+
usageInvalidated: () => { this.#state.invalidateUsage(); },
|
|
113
83
|
compactionStarted: () => { this.#engine.compactionStarted(); },
|
|
114
84
|
compactionEnded: () => { this.#engine.compactionEnded(); },
|
|
115
85
|
deliverQueuedAfterCompaction: () => { this.#engine.deliverQueuedAfterCompaction(); },
|
|
@@ -146,10 +116,7 @@ export class PiEngineAdapter {
|
|
|
146
116
|
}, {
|
|
147
117
|
disposed: () => this.#disposed,
|
|
148
118
|
started: runtime => {
|
|
149
|
-
this.#
|
|
150
|
-
...this.#terminal,
|
|
151
|
-
hardwareCursor: runtime.services.settingsManager?.getShowHardwareCursor?.() ?? this.#terminal.hardwareCursor,
|
|
152
|
-
};
|
|
119
|
+
this.#state.setHardwareCursor(runtime.services.settingsManager?.getShowHardwareCursor?.() ?? this.#state.terminal.hardwareCursor);
|
|
153
120
|
const httpIdleTimeoutMs = runtime.services.settingsManager?.getHttpIdleTimeoutMs?.();
|
|
154
121
|
if (typeof httpIdleTimeoutMs === "number")
|
|
155
122
|
this.#engineHost.httpPolicyLoaded(httpIdleTimeoutMs, this.#sessionId);
|
|
@@ -168,7 +135,7 @@ export class PiEngineAdapter {
|
|
|
168
135
|
session: () => this.#engine.session,
|
|
169
136
|
runtime: () => this.#engine.runtime,
|
|
170
137
|
disposed: () => this.#disposed,
|
|
171
|
-
activeModel: () => this.#activeModel,
|
|
138
|
+
activeModel: () => this.#state.activeModel,
|
|
172
139
|
emitView: () => { this.#emitView(); },
|
|
173
140
|
});
|
|
174
141
|
this.#workflows = new PiWorkflowRunner({ agentDir: this.#agentDir, host: this.#workflowHost, contexts: this.#contexts }, {
|
|
@@ -181,10 +148,10 @@ export class PiEngineAdapter {
|
|
|
181
148
|
pendingCommandCount: () => this.#commands.pendingCount,
|
|
182
149
|
beginRunning: () => { this.#runningCommands++; },
|
|
183
150
|
endRunning: () => { this.#runningCommands--; },
|
|
184
|
-
activeModel: () => this.#activeModel,
|
|
185
|
-
setActiveModel: model => { this.#activeModel = model; },
|
|
186
|
-
thinkingLevel: () => this.#thinkingLevel,
|
|
187
|
-
setThinkingLevel: level => { this.#thinkingLevel = level; },
|
|
151
|
+
activeModel: () => this.#state.activeModel,
|
|
152
|
+
setActiveModel: model => { this.#state.activeModel = model; },
|
|
153
|
+
thinkingLevel: () => this.#state.thinkingLevel,
|
|
154
|
+
setThinkingLevel: level => { this.#state.thinkingLevel = level; },
|
|
188
155
|
emitView: () => { this.#emitView(); },
|
|
189
156
|
reconcileActiveModelAvailability: () => { this.#reconcileActiveModelAvailability(); },
|
|
190
157
|
bindExtensionUiToSession: () => this.#extensions.rebind(),
|
|
@@ -200,7 +167,7 @@ export class PiEngineAdapter {
|
|
|
200
167
|
sessionGeneration: () => this.#engine.generation,
|
|
201
168
|
beginRunning: () => { this.#runningCommands++; },
|
|
202
169
|
endRunning: () => { this.#runningCommands--; },
|
|
203
|
-
perform: command => this.#
|
|
170
|
+
perform: command => performEngineCommand(command, this.#commandContext()),
|
|
204
171
|
emit: value => { this.#emitEvent(value); },
|
|
205
172
|
emitView: () => { this.#emitView(); },
|
|
206
173
|
diagnostic: (severity, code, message, recoverable) => { this.#addDiagnostic(severity, code, message, recoverable); },
|
|
@@ -212,14 +179,14 @@ export class PiEngineAdapter {
|
|
|
212
179
|
this.#settings = new PiEngineSettings({ availableThemes: options.availableThemes ?? null, productMode: options.settingsProductMode ?? "bare" }, {
|
|
213
180
|
runtime: () => this.#engine.runtime,
|
|
214
181
|
requireSession: () => this.#requireWorkflowSession(),
|
|
215
|
-
thinkingLevelChanged: level => { this.#thinkingLevel = level; this.#emitView(); },
|
|
182
|
+
thinkingLevelChanged: level => { this.#state.thinkingLevel = level; this.#emitView(); },
|
|
216
183
|
httpPolicyChanged: timeoutMs => { this.#engineHost.httpPolicyChanged(timeoutMs, this.#sessionId); },
|
|
217
184
|
emitView: () => { this.#emitView(); },
|
|
218
185
|
});
|
|
219
186
|
this.#suggestions = new PiPromptSuggestions({
|
|
220
187
|
session: () => this.#engine.session,
|
|
221
188
|
runtime: () => this.#engine.runtime,
|
|
222
|
-
activeModel: () => this.#activeModel,
|
|
189
|
+
activeModel: () => this.#state.activeModel,
|
|
223
190
|
identity: () => ({ sessionId: this.#sessionId, sessionGeneration: this.#engine.generation, runSequence: this.#events.runSequence, responseSequence: this.#events.responseSequence }),
|
|
224
191
|
unavailable: () => this.#disposed || this.#delivery.overloaded || this.#admissionStopped,
|
|
225
192
|
});
|
|
@@ -236,42 +203,21 @@ export class PiEngineAdapter {
|
|
|
236
203
|
setWorkflowInteractionHost(interaction) {
|
|
237
204
|
this.#workflowInteraction = interaction;
|
|
238
205
|
}
|
|
239
|
-
|
|
240
|
-
return this.#sessionId;
|
|
241
|
-
}
|
|
242
|
-
get sessionGeneration() {
|
|
243
|
-
return this.#engine.generation;
|
|
244
|
-
}
|
|
245
|
-
/** Actual session replacements, excluding delivery-only invalidation of callbacks. */
|
|
246
|
-
get sessionBindingGeneration() { return this.#engine.bindingGeneration; }
|
|
247
|
-
get cwd() {
|
|
248
|
-
return this.#engine.cwd;
|
|
249
|
-
}
|
|
250
|
-
get agentDir() {
|
|
251
|
-
return this.#agentDir;
|
|
252
|
-
}
|
|
253
|
-
resolveTranscriptImage(assetId) {
|
|
206
|
+
#resolveTranscriptImage(assetId) {
|
|
254
207
|
return this.#projection.assets.resolve(assetId);
|
|
255
208
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
currentSessionResumeMetadata() {
|
|
260
|
-
return this.#engine.currentSessionResumeMetadata();
|
|
261
|
-
}
|
|
262
|
-
get disposed() {
|
|
263
|
-
return this.#disposed;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Report a newer A1 release found by the startup check. The shell renders the diagnostic as
|
|
267
|
-
* pinned Pi's `Update Available` notice; it arrives whenever the check resolves, so a late
|
|
268
|
-
* result is appended to the transcript like Pi's own fire-and-forget version check.
|
|
269
|
-
*/
|
|
270
|
-
announceReleaseUpdate(release) {
|
|
209
|
+
// Rationale: the startup check's newer release becomes pinned Pi's `Update Available` notice; it arrives
|
|
210
|
+
// whenever the check resolves, so a late result is appended like Pi's own fire-and-forget version check.
|
|
211
|
+
#announceReleaseUpdate(release) {
|
|
271
212
|
if (this.#disposed)
|
|
272
213
|
return;
|
|
273
|
-
|
|
274
|
-
|
|
214
|
+
if (release.status === "installed") {
|
|
215
|
+
this.#addDiagnostic("info", "release-update-installed", `Update ${release.version} installed; restart to update.`, true);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
const changelog = release.changelogUrl === null ? "" : `\nChangelog: ${release.changelogUrl}`;
|
|
219
|
+
this.#addDiagnostic("info", "release-update", `New version ${release.version} is available. Run ${release.command}${changelog}`, true);
|
|
220
|
+
}
|
|
275
221
|
this.#emitView();
|
|
276
222
|
}
|
|
277
223
|
suggestionReasoningPolicy() {
|
|
@@ -280,16 +226,18 @@ export class PiEngineAdapter {
|
|
|
280
226
|
generate(request) {
|
|
281
227
|
return this.#suggestions.generate(request);
|
|
282
228
|
}
|
|
229
|
+
generateResidentTabName(instruction, maxTokens, signal) {
|
|
230
|
+
return this.#suggestions.completeInstruction(instruction, maxTokens, signal);
|
|
231
|
+
}
|
|
283
232
|
async start() {
|
|
284
233
|
if (this.#engine.started)
|
|
285
234
|
return this.view();
|
|
286
235
|
await this.#engine.start().catch(error => {
|
|
287
|
-
this.#lifecycle = "failed";
|
|
236
|
+
this.#state.lifecycle = "failed";
|
|
288
237
|
this.#addDiagnostic("error", "engine-startup", error instanceof Error ? error.message : String(error), false);
|
|
289
238
|
throw error;
|
|
290
239
|
});
|
|
291
|
-
this.#
|
|
292
|
-
this.#editor = { ...this.#editor, submitEnabled: true };
|
|
240
|
+
this.#state.markReady();
|
|
293
241
|
this.#emitEvent({ type: "session-lifecycle", lifecycle: "ready", reason: null });
|
|
294
242
|
this.#emitView();
|
|
295
243
|
return this.view();
|
|
@@ -312,94 +260,14 @@ export class PiEngineAdapter {
|
|
|
312
260
|
async flushEvents() {
|
|
313
261
|
const failed = this.#delivery.failed;
|
|
314
262
|
await this.#delivery.settle();
|
|
315
|
-
if (failed || this.#delivery.failed || this.#disposed && this.#lifecycle !== "stopped") {
|
|
263
|
+
if (failed || this.#delivery.failed || this.#disposed && this.#state.lifecycle !== "stopped") {
|
|
316
264
|
this.#delivery.clearFailure();
|
|
317
265
|
throw new EngineDeliveryError();
|
|
318
266
|
}
|
|
319
267
|
}
|
|
320
|
-
nonVisualResources() {
|
|
321
|
-
return this.#resources.nonVisualResources();
|
|
322
|
-
}
|
|
323
|
-
extensionResources() {
|
|
324
|
-
return this.#resources.extensionResources();
|
|
325
|
-
}
|
|
326
|
-
workflowAutocompleteCommands() {
|
|
327
|
-
return this.#resources.workflowAutocompleteCommands();
|
|
328
|
-
}
|
|
329
|
-
visualExtensionSupport() {
|
|
330
|
-
return this.#extensions.support();
|
|
331
|
-
}
|
|
332
|
-
bindExtensionUi(ui, shutdown) {
|
|
333
|
-
return this.#extensions.bind(ui, shutdown);
|
|
334
|
-
}
|
|
335
|
-
unbindExtensionUi() {
|
|
336
|
-
return this.#extensions.unbind();
|
|
337
|
-
}
|
|
338
|
-
async cycleModelWorkflow(direction) {
|
|
339
|
-
return this.#workflows.cycleModelWorkflow(direction);
|
|
340
|
-
}
|
|
341
|
-
pinnedProjectTrustContext() {
|
|
342
|
-
return this.#contexts.pinnedProjectTrustContext();
|
|
343
|
-
}
|
|
344
|
-
persistProjectTrust(updates) {
|
|
345
|
-
this.#contexts.persistProjectTrust(updates);
|
|
346
|
-
}
|
|
347
|
-
pinnedScopedModelsContext() {
|
|
348
|
-
return this.#contexts.pinnedScopedModelsContext();
|
|
349
|
-
}
|
|
350
|
-
updateScopedModels(enabledModelIds) {
|
|
351
|
-
this.#contexts.updateScopedModels(enabledModelIds);
|
|
352
|
-
}
|
|
353
|
-
persistScopedModels(enabledModelIds) {
|
|
354
|
-
this.#contexts.persistScopedModels(enabledModelIds);
|
|
355
|
-
}
|
|
356
|
-
refreshScopedModels(signal) {
|
|
357
|
-
return this.#contexts.refreshScopedModels(signal);
|
|
358
|
-
}
|
|
359
|
-
modelsContext() {
|
|
360
|
-
return this.#contexts.modelsContext();
|
|
361
|
-
}
|
|
362
|
-
setSessionModelScope(scopeIds) {
|
|
363
|
-
this.#contexts.setSessionModelScope(scopeIds);
|
|
364
|
-
}
|
|
365
|
-
persistModelScope(scopeIds) {
|
|
366
|
-
this.#contexts.persistModelScope(scopeIds);
|
|
367
|
-
}
|
|
368
|
-
refreshModels(signal) {
|
|
369
|
-
return this.#contexts.refreshModels(signal);
|
|
370
|
-
}
|
|
371
|
-
pinnedLoginOptions(authType) {
|
|
372
|
-
return this.#contexts.loginOptions(authType);
|
|
373
|
-
}
|
|
374
|
-
pinnedLoginMethodOptions(providerReference) {
|
|
375
|
-
return this.#contexts.pinnedLoginMethodOptions(providerReference);
|
|
376
|
-
}
|
|
377
|
-
pinnedAmbientAuthentication(selection) {
|
|
378
|
-
return this.#contexts.pinnedAmbientAuthentication(selection);
|
|
379
|
-
}
|
|
380
|
-
pinnedLogoutOptions() {
|
|
381
|
-
return this.#contexts.logoutOptions();
|
|
382
|
-
}
|
|
383
|
-
pinnedForkOptions() {
|
|
384
|
-
return this.#contexts.pinnedForkOptions();
|
|
385
|
-
}
|
|
386
|
-
/** Bind the owned UI's clipboard lifecycle without changing the comparison host. True means acknowledged delivery. */
|
|
387
|
-
bindClipboardWriter(writer) {
|
|
388
|
-
return this.#workflows.bindClipboardWriter(writer);
|
|
389
|
-
}
|
|
390
|
-
/** Workflow and tree copying share the active owner's write fence and delivery acknowledgment. */
|
|
391
|
-
copyWorkflowText(text) {
|
|
392
|
-
return this.#workflows.copyWorkflowText(text);
|
|
393
|
-
}
|
|
394
268
|
abortBashWorkflow() {
|
|
395
269
|
this.#workflows.abortBashWorkflow();
|
|
396
270
|
}
|
|
397
|
-
executeBashWorkflow(command, excludeFromContext) {
|
|
398
|
-
return this.#workflows.executeBashWorkflow(command, excludeFromContext);
|
|
399
|
-
}
|
|
400
|
-
reloadBlockedResult() {
|
|
401
|
-
return this.#workflows.reloadBlockedResult();
|
|
402
|
-
}
|
|
403
271
|
async executeWorkflow(request) {
|
|
404
272
|
const result = await this.#workflows.executeWorkflow(request);
|
|
405
273
|
if (request.command === "tree" && result.outcome === "completed" && request.selection !== undefined) {
|
|
@@ -414,40 +282,13 @@ export class PiEngineAdapter {
|
|
|
414
282
|
configuredTheme() {
|
|
415
283
|
return this.#settings.configuredTheme();
|
|
416
284
|
}
|
|
417
|
-
/** Persist the global thinking default without changing the live session level. */
|
|
418
|
-
setDefaultThinkingLevel(level) {
|
|
419
|
-
this.#settings.setDefaultThinkingLevel(level);
|
|
420
|
-
}
|
|
421
285
|
/** Settings port for the live runtime, or null before the runtime is available. */
|
|
422
286
|
settingsPort() {
|
|
423
287
|
return this.#settings.settingsPort();
|
|
424
288
|
}
|
|
425
|
-
/** Which settings surface this adapter serves; hidden-in-bare effects are unbindable in bare mode. */
|
|
426
|
-
get settingsProductMode() {
|
|
427
|
-
return this.#settings.productMode;
|
|
428
|
-
}
|
|
429
|
-
bindSettingsOwner(owner, handlers) {
|
|
430
|
-
return this.#settings.bindSettingsOwner(owner, handlers);
|
|
431
|
-
}
|
|
432
289
|
pinnedSettingsSnapshot() {
|
|
433
290
|
return this.#settings.pinnedSettingsSnapshot();
|
|
434
291
|
}
|
|
435
|
-
#pinnedMessageRenderer(customType) {
|
|
436
|
-
return this.#requireWorkflowSession().extensionRunner?.getMessageRenderer?.(customType);
|
|
437
|
-
}
|
|
438
|
-
#pinnedShortcutDescriptions(bindings) {
|
|
439
|
-
const shortcuts = this.#requireWorkflowSession().extensionRunner?.getShortcuts?.(bindings);
|
|
440
|
-
return shortcuts === undefined ? [] : [...shortcuts].map(([key, shortcut]) => ({ key, description: shortcut.description ?? shortcut.extensionPath }));
|
|
441
|
-
}
|
|
442
|
-
#pinnedToolRenderers(toolName) {
|
|
443
|
-
const runner = this.#requireWorkflowSession().extensionRunner;
|
|
444
|
-
if (runner === undefined)
|
|
445
|
-
return undefined;
|
|
446
|
-
if (typeof runner.resolveToolRenderers === "function") {
|
|
447
|
-
return runner.resolveToolRenderers(toolName, () => runner.getToolDefinition?.(toolName));
|
|
448
|
-
}
|
|
449
|
-
return runner.getToolDefinition?.(toolName);
|
|
450
|
-
}
|
|
451
292
|
clearQueuedWorkflows() {
|
|
452
293
|
const session = this.#requireWorkflowSession();
|
|
453
294
|
const result = session.clearQueue?.();
|
|
@@ -462,15 +303,15 @@ export class PiEngineAdapter {
|
|
|
462
303
|
return {
|
|
463
304
|
contractVersion: 1,
|
|
464
305
|
sessionId: this.#sessionId,
|
|
465
|
-
revision: this.#
|
|
466
|
-
lifecycle: this.#lifecycle,
|
|
306
|
+
revision: this.#state.revision,
|
|
307
|
+
lifecycle: this.#state.lifecycle,
|
|
467
308
|
transcript: this.#projection.snapshot(),
|
|
468
|
-
editor: { ...this.#editor, queuedSubmissions: [...this.#editor.queuedSubmissions] },
|
|
309
|
+
editor: { ...this.#state.editor, queuedSubmissions: [...this.#state.editor.queuedSubmissions] },
|
|
469
310
|
status: {
|
|
470
|
-
...this.#status,
|
|
471
|
-
diagnostics: [...this.#status.diagnostics],
|
|
472
|
-
badges: [...this.#status.badges],
|
|
473
|
-
usage: this.#
|
|
311
|
+
...this.#state.status,
|
|
312
|
+
diagnostics: [...this.#state.status.diagnostics],
|
|
313
|
+
badges: [...this.#state.status.badges],
|
|
314
|
+
usage: this.#state.usage(() => readUsageView(this.#engine.session, this.#engine.runtime, this.#state.activeModel)),
|
|
474
315
|
footer: {
|
|
475
316
|
branch: this.#engine.gitBranch,
|
|
476
317
|
repositoryPath: this.#engine.repositoryCwd,
|
|
@@ -480,24 +321,24 @@ export class PiEngineAdapter {
|
|
|
480
321
|
extensionStatuses: [],
|
|
481
322
|
},
|
|
482
323
|
},
|
|
483
|
-
terminal: { ...this.#terminal },
|
|
484
|
-
activeModel: this.#activeModel === null ? null : { ...this.#activeModel },
|
|
324
|
+
terminal: { ...this.#state.terminal },
|
|
325
|
+
activeModel: this.#state.activeModel === null ? null : { ...this.#state.activeModel },
|
|
485
326
|
routedModel: routedModel === null ? null : {
|
|
486
327
|
model: routedModel,
|
|
487
328
|
...(routed?.thinkingLevel === undefined ? {} : { thinkingLevel: readThinkingLevel(routed.thinkingLevel) }),
|
|
488
329
|
},
|
|
489
|
-
thinkingLevel: this.#thinkingLevel,
|
|
330
|
+
thinkingLevel: this.#state.thinkingLevel,
|
|
490
331
|
activeCommandIds: [...this.#commands.activeCommandIds],
|
|
491
332
|
dialog: null,
|
|
492
333
|
overlay: null,
|
|
493
334
|
customizations: [],
|
|
494
|
-
diagnostics: this.#diagnostics.map(diagnostic => ({ ...diagnostic })),
|
|
335
|
+
diagnostics: this.#state.diagnostics.map(diagnostic => ({ ...diagnostic })),
|
|
495
336
|
};
|
|
496
337
|
}
|
|
497
338
|
snapshot() {
|
|
498
339
|
const snapshot = {
|
|
499
340
|
contractVersion: 1,
|
|
500
|
-
snapshotId: `snapshot-${this.#
|
|
341
|
+
snapshotId: `snapshot-${this.#state.revision}`,
|
|
501
342
|
sessionId: this.#sessionId,
|
|
502
343
|
sequence: this.#delivery.sequence,
|
|
503
344
|
view: this.view(),
|
|
@@ -517,10 +358,10 @@ export class PiEngineAdapter {
|
|
|
517
358
|
this.#workflows.cancelPending("quit");
|
|
518
359
|
this.#projection.assets.clear();
|
|
519
360
|
await this.#extensions.unbind();
|
|
520
|
-
this.#lifecycle = "stopping";
|
|
361
|
+
this.#state.lifecycle = "stopping";
|
|
521
362
|
this.#emitEvent({ type: "session-lifecycle", lifecycle: "stopping", reason: null });
|
|
522
363
|
await this.#engine.dispose();
|
|
523
|
-
this.#lifecycle = "stopped";
|
|
364
|
+
this.#state.lifecycle = "stopped";
|
|
524
365
|
this.#emitEvent({ type: "session-lifecycle", lifecycle: "stopped", reason: null });
|
|
525
366
|
this.#emitView();
|
|
526
367
|
try {
|
|
@@ -531,27 +372,17 @@ export class PiEngineAdapter {
|
|
|
531
372
|
throw error;
|
|
532
373
|
}
|
|
533
374
|
}
|
|
534
|
-
// Invariant: every
|
|
375
|
+
// Invariant: every port member delegates at call time, so ports built once follow session replacement.
|
|
535
376
|
#createPorts() {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
return {
|
|
546
|
-
identity: {
|
|
547
|
-
sessionId,
|
|
548
|
-
agentDir,
|
|
549
|
-
get cwd() { return engine.cwd; },
|
|
550
|
-
get sessionGeneration() { return engine.generation; },
|
|
551
|
-
get sessionBindingGeneration() { return engine.bindingGeneration; },
|
|
552
|
-
get disposed() { return isDisposed(); },
|
|
553
|
-
currentSessionResumeMetadata: () => engine.currentSessionResumeMetadata(),
|
|
554
|
-
},
|
|
377
|
+
return createEnginePorts({
|
|
378
|
+
sessionId: this.#sessionId,
|
|
379
|
+
agentDir: this.#agentDir,
|
|
380
|
+
engine: this.#engine,
|
|
381
|
+
contexts: this.#contexts,
|
|
382
|
+
workflows: this.#workflows,
|
|
383
|
+
settings: this.#settings,
|
|
384
|
+
resources: this.#resources,
|
|
385
|
+
extensions: this.#extensions,
|
|
555
386
|
session: {
|
|
556
387
|
start: () => this.start(),
|
|
557
388
|
view: () => this.view(),
|
|
@@ -561,67 +392,22 @@ export class PiEngineAdapter {
|
|
|
561
392
|
flushEvents: () => this.flushEvents(),
|
|
562
393
|
dispose: () => this.dispose(),
|
|
563
394
|
},
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
},
|
|
581
|
-
bindOwner: (owner, handlers) => settings.bindSettingsOwner(owner, handlers),
|
|
582
|
-
setDefaultThinkingLevel: level => { settings.setDefaultThinkingLevel(level); },
|
|
583
|
-
configuredTheme: () => settings.configuredTheme(),
|
|
584
|
-
},
|
|
585
|
-
catalog: {
|
|
586
|
-
modelsContext: () => contexts.modelsContext(),
|
|
587
|
-
setSessionModelScope: scopeIds => { contexts.setSessionModelScope(scopeIds); },
|
|
588
|
-
persistModelScope: scopeIds => { contexts.persistModelScope(scopeIds); },
|
|
589
|
-
refreshModels: signal => contexts.refreshModels(signal),
|
|
590
|
-
pinnedScopedModelsContext: () => contexts.pinnedScopedModelsContext(),
|
|
591
|
-
updateScopedModels: enabledModelIds => { contexts.updateScopedModels(enabledModelIds); },
|
|
592
|
-
persistScopedModels: enabledModelIds => { contexts.persistScopedModels(enabledModelIds); },
|
|
593
|
-
refreshScopedModels: signal => contexts.refreshScopedModels(signal),
|
|
594
|
-
pinnedProjectTrustContext: () => contexts.pinnedProjectTrustContext(),
|
|
595
|
-
persistProjectTrust: updates => { contexts.persistProjectTrust(updates); },
|
|
596
|
-
pinnedLoginOptions: authType => contexts.loginOptions(authType),
|
|
597
|
-
pinnedLoginMethodOptions: providerReference => contexts.pinnedLoginMethodOptions(providerReference),
|
|
598
|
-
pinnedAmbientAuthentication: selection => contexts.pinnedAmbientAuthentication(selection),
|
|
599
|
-
pinnedLogoutOptions: () => contexts.logoutOptions(),
|
|
600
|
-
pinnedForkOptions: () => contexts.pinnedForkOptions(),
|
|
601
|
-
},
|
|
602
|
-
extensions: {
|
|
603
|
-
nonVisualResources: () => resources.nonVisualResources(),
|
|
604
|
-
extensionResources: () => resources.extensionResources(),
|
|
605
|
-
resolveTranscriptImage: assetId => this.resolveTranscriptImage(assetId),
|
|
606
|
-
visualExtensionSupport: () => extensions.support(),
|
|
607
|
-
bindExtensionUi: (ui, shutdown) => extensions.bind(ui, shutdown),
|
|
608
|
-
unbindExtensionUi: () => extensions.unbind(),
|
|
609
|
-
bindClipboardWriter: writer => workflows.bindClipboardWriter(writer),
|
|
610
|
-
announceReleaseUpdate: release => { this.announceReleaseUpdate(release); },
|
|
611
|
-
},
|
|
612
|
-
presentation: {
|
|
613
|
-
pinnedModelSelectorContext: () => contexts.pinnedModelSelectorContext(),
|
|
614
|
-
pinnedSessionSelectorContext: () => contexts.pinnedSessionSelectorContext(),
|
|
615
|
-
pinnedTreeSelectorContext: () => contexts.pinnedTreeSelectorContext(),
|
|
616
|
-
pinnedMessageRenderer: customType => this.#pinnedMessageRenderer(customType),
|
|
617
|
-
pinnedToolRenderers: toolName => this.#pinnedToolRenderers(toolName),
|
|
618
|
-
pinnedShortcutDescriptions: bindings => this.#pinnedShortcutDescriptions(bindings),
|
|
619
|
-
pinnedSettingsModels: () => {
|
|
620
|
-
const { currentModel, availableDefaultModels } = settings.pinnedSettingsSnapshot();
|
|
621
|
-
return { ...(currentModel === undefined ? {} : { currentModel }), availableDefaultModels };
|
|
622
|
-
},
|
|
623
|
-
applyPinnedSettingValue: (callback, value) => settings.applyPinnedSettingValue(callback, value),
|
|
624
|
-
},
|
|
395
|
+
disposed: () => this.#disposed,
|
|
396
|
+
executeWorkflow: request => this.executeWorkflow(request),
|
|
397
|
+
clearQueuedWorkflows: () => this.clearQueuedWorkflows(),
|
|
398
|
+
setWorkflowInteractionHost: interaction => { this.setWorkflowInteractionHost(interaction); },
|
|
399
|
+
announceReleaseUpdate: release => { this.#announceReleaseUpdate(release); },
|
|
400
|
+
resolveTranscriptImage: assetId => this.#resolveTranscriptImage(assetId),
|
|
401
|
+
extensionRunner: () => this.#requireWorkflowSession().extensionRunner,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
#commandContext() {
|
|
405
|
+
return {
|
|
406
|
+
engine: this.#engine,
|
|
407
|
+
state: this.#state,
|
|
408
|
+
admissionOpen: () => !this.#delivery.overloaded && !this.#admissionStopped,
|
|
409
|
+
emit: value => { this.#emitEvent(value); },
|
|
410
|
+
dispose: () => this.dispose(),
|
|
625
411
|
};
|
|
626
412
|
}
|
|
627
413
|
#requireWorkflowSession() {
|
|
@@ -629,75 +415,16 @@ export class PiEngineAdapter {
|
|
|
629
415
|
throw new Error("engine adapter is not running");
|
|
630
416
|
return this.#engine.session;
|
|
631
417
|
}
|
|
632
|
-
async #perform(command) {
|
|
633
|
-
const runtime = this.#engine.runtime;
|
|
634
|
-
const session = this.#engine.session;
|
|
635
|
-
const generation = this.#engine.generation;
|
|
636
|
-
if (!runtime || !session)
|
|
637
|
-
throw new Error("engine session is unavailable");
|
|
638
|
-
switch (command.type) {
|
|
639
|
-
case "prompt":
|
|
640
|
-
case "steer":
|
|
641
|
-
case "follow-up":
|
|
642
|
-
case "abort":
|
|
643
|
-
case "retry":
|
|
644
|
-
case "compact": {
|
|
645
|
-
const result = await this.#engine.sessionCommands?.execute(command.type === "prompt" || command.type === "steer" || command.type === "follow-up"
|
|
646
|
-
? {
|
|
647
|
-
type: command.type,
|
|
648
|
-
text: command.text,
|
|
649
|
-
...(command.images === undefined ? {} : { images: [...command.images] }),
|
|
650
|
-
}
|
|
651
|
-
: { type: command.type });
|
|
652
|
-
if (!result || result.outcome === "rejected" || result.outcome === "failed") {
|
|
653
|
-
throw new Error(command.type === "retry" ? "no previous prompt is available to retry" : `Pi session command failed: ${command.type}`);
|
|
654
|
-
}
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
case "set-model": {
|
|
658
|
-
const model = runtime.services.modelRuntime.getModel(command.model.providerId, command.model.modelId);
|
|
659
|
-
if (!model) {
|
|
660
|
-
throw new Error(`model is unavailable: ${command.model.providerId}/${command.model.modelId}`);
|
|
661
|
-
}
|
|
662
|
-
await session.setModel(model);
|
|
663
|
-
if (generation === this.#engine.generation && !this.#delivery.overloaded && !this.#admissionStopped)
|
|
664
|
-
this.#activeModel = { ...command.model };
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
case "set-thinking-level":
|
|
668
|
-
session.setThinkingLevel(command.thinkingLevel);
|
|
669
|
-
this.#thinkingLevel = command.thinkingLevel;
|
|
670
|
-
return;
|
|
671
|
-
case "new-session":
|
|
672
|
-
await runtime.newSession();
|
|
673
|
-
return;
|
|
674
|
-
case "resume-session":
|
|
675
|
-
await runtime.switchSession(command.sessionPath);
|
|
676
|
-
return;
|
|
677
|
-
case "resize-surface":
|
|
678
|
-
this.#terminal = { ...command.surface };
|
|
679
|
-
this.#emitEvent({ type: "terminal-surface", surface: this.#terminal });
|
|
680
|
-
return;
|
|
681
|
-
case "shutdown":
|
|
682
|
-
await this.dispose();
|
|
683
|
-
return;
|
|
684
|
-
case "set-setting":
|
|
685
|
-
case "apply-customization":
|
|
686
|
-
case "remove-customization":
|
|
687
|
-
throw new Error("owned UI state commands belong to the owned UI layer, not the Pi engine adapter");
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
418
|
// Invariant: in-place tree navigation rebuilds derived content without clearing the editor draft.
|
|
691
419
|
#refreshNavigatedSession(editorText) {
|
|
692
420
|
const session = this.#engine.session;
|
|
693
421
|
if (!session)
|
|
694
422
|
return;
|
|
695
|
-
if (editorText
|
|
696
|
-
this.#
|
|
697
|
-
|
|
698
|
-
this.#activeModel = readModel(session.model);
|
|
423
|
+
if (editorText)
|
|
424
|
+
this.#state.offerEditorText(editorText);
|
|
425
|
+
this.#state.activeModel = readModel(session.model);
|
|
699
426
|
this.#reconcileActiveModelAvailability();
|
|
700
|
-
this.#thinkingLevel = readThinkingLevel(session.thinkingLevel);
|
|
427
|
+
this.#state.thinkingLevel = readThinkingLevel(session.thinkingLevel);
|
|
701
428
|
this.#projection.assets.clear();
|
|
702
429
|
this.#setTranscript(this.#projection.rebuild(session.messages, "finalized"));
|
|
703
430
|
this.#emitView();
|
|
@@ -706,19 +433,11 @@ export class PiEngineAdapter {
|
|
|
706
433
|
#sessionReplaced(session) {
|
|
707
434
|
this.#delivery.discardObsolete(this.#engine.generation);
|
|
708
435
|
this.#commands.reset();
|
|
709
|
-
this.#
|
|
710
|
-
text: "",
|
|
711
|
-
queuedSubmissions: [],
|
|
712
|
-
selection: null,
|
|
713
|
-
cursorOffset: 0,
|
|
714
|
-
historyRevision: this.#editor.historyRevision + 1,
|
|
715
|
-
submitEnabled: true,
|
|
716
|
-
};
|
|
717
|
-
this.#status = { ...this.#status, workingMessage: null, workingProgress: null, badges: [] };
|
|
436
|
+
this.#state.replaceSession();
|
|
718
437
|
this.#events.reset();
|
|
719
|
-
this.#activeModel = readModel(session.model);
|
|
438
|
+
this.#state.activeModel = readModel(session.model);
|
|
720
439
|
this.#reconcileActiveModelAvailability();
|
|
721
|
-
this.#thinkingLevel = readThinkingLevel(session.thinkingLevel);
|
|
440
|
+
this.#state.thinkingLevel = readThinkingLevel(session.thinkingLevel);
|
|
722
441
|
this.#projection.assets.clear();
|
|
723
442
|
// Invariant: a new binding cannot inherit arguments/results from a reused invocation id.
|
|
724
443
|
this.#setTranscript([]);
|
|
@@ -729,17 +448,17 @@ export class PiEngineAdapter {
|
|
|
729
448
|
#reconcileActiveModelAvailability() {
|
|
730
449
|
const modelRuntime = this.#engine.runtime?.services.modelRuntime;
|
|
731
450
|
if (!modelRuntime) {
|
|
732
|
-
this.#activeModel = null;
|
|
451
|
+
this.#state.activeModel = null;
|
|
733
452
|
return;
|
|
734
453
|
}
|
|
735
454
|
const available = modelRuntime.getAvailableSnapshot?.() ?? [];
|
|
736
455
|
const sessionModel = readModel(this.#engine.session?.model);
|
|
737
|
-
const authoritative = this.#activeModel ?? sessionModel;
|
|
456
|
+
const authoritative = this.#state.activeModel ?? sessionModel;
|
|
738
457
|
if (authoritative === null)
|
|
739
458
|
return;
|
|
740
459
|
const remainsAvailable = available.some(model => stringProperty(model, "provider") === authoritative.providerId
|
|
741
460
|
&& stringProperty(model, "id") === authoritative.modelId);
|
|
742
|
-
this.#activeModel = remainsAvailable ? authoritative : null;
|
|
461
|
+
this.#state.activeModel = remainsAvailable ? authoritative : null;
|
|
743
462
|
}
|
|
744
463
|
#setTranscript(blocks) {
|
|
745
464
|
// Invariant: lazy delivery snapshots must freeze before their authoritative source can be removed.
|
|
@@ -754,13 +473,12 @@ export class PiEngineAdapter {
|
|
|
754
473
|
this.#emitEvent({ type: "diagnostic", diagnostic });
|
|
755
474
|
}
|
|
756
475
|
#emitView() {
|
|
757
|
-
this.#
|
|
758
|
-
this.#viewRevision += 1;
|
|
476
|
+
this.#state.invalidate();
|
|
759
477
|
this.#emitEvent({ type: "session-view", view: this.view() });
|
|
760
478
|
}
|
|
761
479
|
#emitEvent(value) {
|
|
762
480
|
if (value.type !== "session-view")
|
|
763
|
-
this.#
|
|
481
|
+
this.#state.advance();
|
|
764
482
|
this.#delivery.emit(value);
|
|
765
483
|
}
|
|
766
484
|
// Concurrency: cancellation runs synchronously so the overload reservation already guards reentrant outcomes.
|
|
@@ -775,10 +493,7 @@ export class PiEngineAdapter {
|
|
|
775
493
|
this.#admissionStopped = !canResume;
|
|
776
494
|
this.#engine.suspend();
|
|
777
495
|
this.#events.abandonRun();
|
|
778
|
-
this.#
|
|
779
|
-
this.#lifecycle = this.#disposed ? "stopped" : canResume ? "ready" : "failed";
|
|
780
|
-
this.#editor = { ...this.#editor, submitEnabled: canResume && !this.#disposed };
|
|
781
|
-
this.#viewRevision += 1;
|
|
496
|
+
this.#state.settleOverload(canResume, this.#disposed);
|
|
782
497
|
// Invariant: overload publishes one authoritative view; settle tool phases before finalizing other live blocks.
|
|
783
498
|
this.#projection.settleFailedDeclarations({ role: "assistant", stopReason: cancelled ? "aborted" : "error",
|
|
784
499
|
errorMessage: "Tool result unavailable after UI delivery overload" });
|
|
@@ -795,21 +510,7 @@ export class PiEngineAdapter {
|
|
|
795
510
|
this.#engine.resume();
|
|
796
511
|
}
|
|
797
512
|
#recordDiagnostic(severity, code, message, recoverable) {
|
|
798
|
-
|
|
799
|
-
sequence: this.#diagnostics.length,
|
|
800
|
-
code,
|
|
801
|
-
severity,
|
|
802
|
-
message,
|
|
803
|
-
recoverable,
|
|
804
|
-
};
|
|
805
|
-
this.#diagnostics.push(diagnostic);
|
|
806
|
-
if (this.#diagnostics.length > 100)
|
|
807
|
-
this.#diagnostics.shift();
|
|
808
|
-
this.#status = {
|
|
809
|
-
...this.#status,
|
|
810
|
-
diagnostics: [...this.#status.diagnostics, message].slice(-8),
|
|
811
|
-
};
|
|
812
|
-
return diagnostic;
|
|
513
|
+
return this.#state.recordDiagnostic(severity, code, message, recoverable);
|
|
813
514
|
}
|
|
814
515
|
}
|
|
815
516
|
export async function createPiEngineAdapter(options) {
|