@timurproko/a1 0.1.8-dev.3b54f21 → 0.1.8-dev.407
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 +159 -65
- package/bin/cli.js +28 -10
- package/bin/guardian.js +12 -6
- package/bin/module-identity.js +69 -35
- package/bin/pi-tui.d.ts +6 -0
- package/bin/pi-tui.js +28 -0
- package/bin/release-cleanup.js +8 -0
- package/bin/supervisor.js +2 -2
- package/bin/sync-pi-tui-proxy.js +97 -0
- package/bin/ui.js +62 -21
- package/bin/update-recovery.js +274 -0
- package/bin/warmup.js +27 -0
- package/dist/cli/capabilities.d.ts +6 -0
- package/dist/{src/cli → cli}/capabilities.js +1 -1
- package/dist/{src/cli → cli}/dispatch.d.ts +15 -1
- package/dist/cli/dispatch.js +261 -0
- package/dist/cli/package-messages.d.ts +26 -0
- package/dist/cli/package-messages.js +71 -0
- package/dist/{src/cli → cli}/packages.d.ts +11 -2
- package/dist/{src/cli → cli}/packages.js +24 -27
- package/dist/{src/cli → cli}/version-stats.d.ts +6 -0
- package/dist/cli/version-stats.js +112 -0
- 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 +35 -0
- package/dist/composition/owned-ui.js +118 -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 +75 -0
- package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.d.ts +2 -2
- package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.js +22 -4
- package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.d.ts +17 -0
- package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.d.ts +6 -0
- package/dist/contracts/owned-ui/image-attachments.d.ts +36 -0
- package/dist/contracts/owned-ui/image-attachments.js +67 -0
- package/dist/contracts/owned-ui/index.d.ts +8 -0
- package/dist/contracts/owned-ui/index.js +8 -0
- package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.d.ts +123 -0
- package/dist/contracts/owned-ui/prompt-history.d.ts +55 -0
- package/dist/contracts/owned-ui/prompt-history.js +23 -0
- package/dist/contracts/owned-ui/prompt-suggestions.d.ts +3 -0
- package/dist/contracts/owned-ui/prompt-suggestions.js +44 -0
- package/dist/contracts/owned-ui/suggestion-diagnostics.d.ts +22 -0
- package/dist/contracts/owned-ui/suggestion-diagnostics.js +9 -0
- package/dist/contracts/owned-ui/transcript-lifecycle.d.ts +5 -0
- package/dist/contracts/owned-ui/transcript-lifecycle.js +33 -0
- package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.d.ts +5 -1
- package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.js +129 -4
- package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.d.ts +8 -0
- package/dist/{src/features → features}/launch/development-launch.js +11 -3
- package/dist/{src/features → features}/launch/index.d.ts +0 -1
- package/dist/{src/features → features}/launch/index.js +0 -1
- package/dist/features/launch/intent.d.ts +10 -0
- package/dist/features/launch/intent.js +8 -0
- package/dist/{src/features → features}/launch/prepare-launch.d.ts +0 -2
- package/dist/{src/features → features}/launch/prepare-launch.js +2 -9
- package/dist/{src/features → features}/launch/profile-paths.d.ts +3 -2
- package/dist/{src/features → features}/launch/profile-paths.js +13 -8
- package/dist/{src/features → features}/launch/runtime-selection.d.ts +2 -5
- package/dist/{src/features → features}/owned-ui/customization.d.ts +3 -1
- package/dist/{src/features → features}/owned-ui/customization.js +3 -1
- package/dist/{src/features → features}/owned-ui/diagnostics.d.ts +2 -1
- package/dist/{src/features → features}/owned-ui/diagnostics.js +1 -0
- package/dist/{src/features → features}/owned-ui/index.d.ts +2 -0
- package/dist/{src/features → features}/owned-ui/index.js +2 -0
- package/dist/features/owned-ui/project-trust-prompt.d.ts +25 -0
- package/dist/features/owned-ui/project-trust-prompt.js +149 -0
- package/dist/{src/features → features}/owned-ui/run.d.ts +2 -2
- package/dist/features/owned-ui/run.js +32 -0
- package/dist/features/owned-ui/session-fork-prompt.d.ts +8 -0
- package/dist/features/owned-ui/session-fork-prompt.js +34 -0
- package/dist/{src/features → features}/owned-ui/settings-app.d.ts +3 -3
- package/dist/{src/features → features}/owned-ui/settings-app.js +105 -56
- package/dist/features/prompt-history/image-sidecar.d.ts +32 -0
- package/dist/features/prompt-history/image-sidecar.js +130 -0
- package/dist/features/prompt-history/index.d.ts +4 -0
- package/dist/features/prompt-history/index.js +3 -0
- package/dist/features/prompt-history/paths.d.ts +5 -0
- package/dist/features/prompt-history/paths.js +17 -0
- package/dist/features/prompt-history/service.d.ts +54 -0
- package/dist/features/prompt-history/service.js +425 -0
- package/dist/features/prompt-history/store.d.ts +16 -0
- package/dist/features/prompt-history/store.js +223 -0
- package/dist/features/prompt-history/worker.d.ts +9 -0
- package/dist/features/prompt-history/worker.js +45 -0
- package/dist/features/prompt-suggestions/diagnostics.d.ts +18 -0
- package/dist/features/prompt-suggestions/diagnostics.js +82 -0
- package/dist/features/prompt-suggestions/index.d.ts +1 -0
- package/dist/features/prompt-suggestions/index.js +1 -0
- package/dist/{src/features → features}/workspace/capabilities.d.ts +1 -1
- package/dist/{src/features → features}/workspace/reducer.d.ts +2 -1
- package/dist/{src/features → features}/workspace/reducer.js +2 -1
- package/dist/{src/features → features}/workspace/router.d.ts +2 -1
- package/dist/{src/features → features}/workspace/router.js +1 -0
- package/dist/{src/features → features}/workspace/store.d.ts +2 -1
- package/dist/{src/features → features}/workspace/store.js +1 -0
- package/dist/foundation/launch-context/index.d.ts +59 -0
- package/dist/foundation/launch-context/index.js +136 -0
- package/dist/{src/foundation → foundation}/launch-guardian/main.d.ts +2 -0
- package/dist/{src/foundation → foundation}/launch-guardian/main.js +23 -8
- package/dist/{src/foundation → foundation}/lifecycle/index.d.ts +2 -0
- package/dist/{src/foundation → foundation}/lifecycle/index.js +2 -0
- package/dist/{src/foundation → foundation}/lifecycle/model.d.ts +1 -1
- package/dist/{src/foundation → foundation}/lifecycle/model.js +1 -1
- package/dist/foundation/lifecycle/paths.d.ts +30 -0
- package/dist/{src/foundation → foundation}/lifecycle/paths.js +29 -1
- package/dist/foundation/lifecycle/session-selection.d.ts +9 -0
- package/dist/foundation/lifecycle/session-selection.js +39 -0
- package/dist/foundation/lifecycle/supervisor-startup.d.ts +30 -0
- package/dist/foundation/lifecycle/supervisor-startup.js +106 -0
- package/dist/{src/foundation → foundation}/native-host-protocol/codec.d.ts +2 -0
- package/dist/{src/foundation → foundation}/native-host-protocol/codec.js +2 -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/foundation/process-containment/darwin-process-inspector.d.ts +5 -0
- package/dist/foundation/process-containment/darwin-process-inspector.js +7 -0
- package/dist/{src/foundation → foundation}/process-containment/index.d.ts +1 -0
- package/dist/{src/foundation → foundation}/process-containment/index.js +1 -0
- package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.d.ts +1 -0
- package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.js +1 -0
- package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.d.ts +1 -0
- package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.js +1 -0
- package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.d.ts +3 -1
- package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.js +5 -2
- package/dist/{src/foundation → foundation}/protocol/client.d.ts +1 -0
- package/dist/{src/foundation → foundation}/protocol/client.js +1 -0
- package/dist/{src/foundation → foundation}/protocol/messages.d.ts +1 -0
- package/dist/{src/foundation → foundation}/protocol/messages.js +1 -0
- package/dist/foundation/release/bootstrap.d.ts +55 -0
- package/dist/{src/foundation → foundation}/release/bootstrap.js +219 -46
- package/dist/foundation/release/cohort-state.d.ts +157 -0
- package/dist/foundation/release/cohort-state.js +472 -0
- package/dist/foundation/release/dependency-certification-retention.d.ts +7 -0
- package/dist/foundation/release/dependency-certification-retention.js +88 -0
- package/dist/foundation/release/dependency-certification.d.ts +24 -0
- package/dist/foundation/release/dependency-certification.js +266 -0
- package/dist/foundation/release/dependency-layer.d.ts +81 -0
- package/dist/foundation/release/dependency-layer.js +466 -0
- package/dist/foundation/release/endpoints.d.ts +20 -0
- package/dist/foundation/release/endpoints.js +50 -0
- package/dist/foundation/release/immutable-platform.d.ts +6 -0
- package/dist/foundation/release/immutable-platform.js +13 -0
- package/dist/{src/foundation → foundation}/release/index.d.ts +6 -0
- package/dist/{src/foundation → foundation}/release/index.js +6 -0
- package/dist/foundation/release/release-gc.d.ts +71 -0
- package/dist/foundation/release/release-gc.js +764 -0
- package/dist/{src/foundation → foundation}/release/release-store.d.ts +9 -3
- package/dist/{src/foundation → foundation}/release/release-store.js +74 -14
- package/dist/{src/foundation → foundation}/release/release.d.ts +6 -1
- package/dist/{src/foundation → foundation}/release/release.js +15 -4
- package/dist/foundation/release/restart-certification.d.ts +68 -0
- package/dist/foundation/release/restart-certification.js +227 -0
- package/dist/foundation/release/update-launch.d.ts +6 -0
- package/dist/foundation/release/update-launch.js +17 -0
- package/dist/foundation/release/update-recovery.d.ts +76 -0
- package/dist/foundation/release/update-recovery.js +356 -0
- package/dist/{src/foundation → foundation}/release/update-transaction.d.ts +11 -0
- package/dist/{src/foundation → foundation}/release/update-transaction.js +13 -1
- package/dist/{src/foundation → foundation}/release/update.d.ts +40 -4
- package/dist/{src/foundation → foundation}/release/update.js +196 -78
- package/dist/foundation/release/warmup.d.ts +3 -0
- package/dist/foundation/release/warmup.js +47 -0
- package/dist/foundation/startup/index.d.ts +1 -0
- package/dist/foundation/startup/index.js +1 -0
- package/dist/foundation/startup/startup-runtime.d.ts +36 -0
- package/dist/foundation/startup/startup-runtime.js +142 -0
- package/dist/{src/foundation → foundation}/storage/control-store.d.ts +2 -1
- package/dist/{src/foundation → foundation}/storage/control-store.js +39 -4
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.d.ts +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.js +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.d.ts +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.js +2 -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 +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.js +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.d.ts +2 -1
- package/dist/{src/foundation → foundation}/structured-agent-runtime/state.js +2 -1
- package/dist/foundation/supervision/index.d.ts +3 -0
- package/dist/foundation/supervision/index.js +3 -0
- package/dist/foundation/supervision/main.d.ts +1 -0
- package/dist/foundation/supervision/main.js +84 -0
- package/dist/foundation/supervision/paths.d.ts +1 -0
- package/dist/foundation/supervision/paths.js +1 -0
- package/dist/foundation/supervision/server.d.ts +51 -0
- package/dist/{src/foundation → foundation}/supervision/server.js +142 -20
- package/dist/foundation/terminal-cleanup/fatal-exit.d.ts +12 -0
- package/dist/foundation/terminal-cleanup/fatal-exit.js +85 -0
- package/dist/foundation/terminal-cleanup/index.d.ts +2 -0
- package/dist/foundation/terminal-cleanup/index.js +2 -0
- package/dist/foundation/terminal-cleanup/terminal-reset.d.ts +4 -0
- package/dist/foundation/terminal-cleanup/terminal-reset.js +40 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.d.ts +1 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.js +3 -2
- package/dist/integrations/pi/components/editor-interaction.d.ts +38 -0
- package/dist/integrations/pi/components/history-editor-loader.d.ts +5 -0
- package/dist/integrations/pi/components/history-editor-loader.js +5 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.d.ts +2 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.js +2 -1
- package/dist/integrations/pi/components/owned-editor-ux.d.ts +74 -0
- package/dist/integrations/pi/components/owned-editor-ux.js +1093 -0
- package/dist/integrations/pi/components/path-word-ranges.d.ts +2 -0
- package/dist/integrations/pi/components/path-word-ranges.js +37 -0
- package/dist/integrations/pi/components/prompt-input-port.d.ts +18 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.d.ts +1 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.js +1 -0
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +297 -0
- 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 +4 -4
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.js +58 -23
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +43 -0
- package/dist/integrations/pi/components/shell-presenters-info.js +114 -0
- package/dist/integrations/pi/components/shell-presenters-transcript.d.ts +29 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.js +174 -170
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.d.ts +8 -4
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.js +10 -6
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +213 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.js +5 -2
- package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +15 -0
- package/dist/integrations/pi/components/submitted-prompt-adapter.js +43 -0
- package/dist/integrations/pi/components/tool-image-presentation.d.ts +21 -0
- package/dist/integrations/pi/components/tool-image-presentation.js +86 -0
- package/dist/integrations/pi/components/tool-result-adapter.d.ts +6 -0
- package/dist/integrations/pi/components/tool-result-adapter.js +27 -0
- package/dist/integrations/pi/components/transcript-image-resolver.d.ts +7 -0
- package/dist/integrations/pi/components/transcript-image-resolver.js +19 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.d.ts +11 -2
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.js +41 -3
- package/dist/integrations/pi/components/upstream/assets/earendil-image.json +12 -0
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +42 -0
- package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +40 -0
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +166 -0
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.d.ts +1 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.js +3 -1
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.d.ts +3 -2
- package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.js +12 -7
- package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +61 -0
- package/dist/integrations/pi/components/upstream/components/tool-execution.js +344 -0
- package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +280 -0
- package/dist/integrations/pi/components/upstream/history/editor-core.js +2062 -0
- package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +32 -0
- package/dist/integrations/pi/components/upstream/history/kill-ring.js +48 -0
- package/dist/integrations/pi/components/upstream/history/printable-key.d.ts +1 -0
- package/dist/integrations/pi/components/upstream/history/printable-key.js +40 -0
- package/dist/integrations/pi/components/upstream/history/text-helpers.d.ts +14 -0
- package/dist/integrations/pi/components/upstream/history/text-helpers.js +28 -0
- package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +22 -0
- package/dist/integrations/pi/components/upstream/history/undo-stack.js +36 -0
- package/dist/integrations/pi/components/upstream/history/word-navigation.d.ts +24 -0
- package/dist/integrations/pi/components/upstream/history/word-navigation.js +100 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.d.ts +74 -6
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.js +1340 -228
- package/dist/integrations/pi/engine/changelog.d.ts +2 -0
- package/dist/integrations/pi/engine/changelog.js +63 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.d.ts +4 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.js +15 -5
- package/dist/integrations/pi/engine/http-dispatcher.d.ts +4 -0
- package/dist/integrations/pi/engine/http-dispatcher.js +25 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.d.ts +4 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.js +4 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.d.ts +2 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.js +1 -0
- 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 +32 -26
- package/dist/integrations/pi/engine/pending-delivery.d.ts +30 -0
- package/dist/integrations/pi/engine/pending-delivery.js +158 -0
- package/dist/integrations/pi/engine/project-trust-preflight.d.ts +22 -0
- package/dist/integrations/pi/engine/project-trust-preflight.js +50 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.d.ts +2 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.js +1 -0
- package/dist/integrations/pi/engine/resources/changelog.json +12 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.d.ts +19 -1
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.js +56 -5
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.d.ts +4 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.js +19 -4
- package/dist/integrations/pi/engine/session-selection.d.ts +28 -0
- package/dist/integrations/pi/engine/session-selection.js +90 -0
- package/dist/integrations/pi/engine/settings-effects.d.ts +66 -0
- package/dist/integrations/pi/engine/settings-effects.js +249 -0
- package/dist/integrations/pi/engine/settings-integration.d.ts +43 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.js +102 -108
- package/dist/integrations/pi/engine/tool-rendering.d.ts +13 -0
- package/dist/integrations/pi/engine/tool-rendering.js +145 -0
- package/dist/integrations/pi/engine/transcript-image-assets.d.ts +11 -0
- package/dist/integrations/pi/engine/transcript-image-assets.js +86 -0
- package/dist/integrations/pi/engine/windows-filesystem-hygiene.d.ts +21 -0
- package/dist/integrations/pi/engine/windows-filesystem-hygiene.js +55 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.d.ts +3 -2
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.js +1 -0
- package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.d.ts +19 -2
- package/dist/integrations/pi/session-ui/clipboard-diagnostics.d.ts +16 -0
- package/dist/integrations/pi/session-ui/clipboard-diagnostics.js +65 -0
- package/dist/integrations/pi/session-ui/clipboard-image.d.ts +11 -0
- package/dist/integrations/pi/session-ui/clipboard-image.js +38 -0
- package/dist/integrations/pi/session-ui/editor-hyperlink-budget.d.ts +9 -0
- package/dist/integrations/pi/session-ui/editor-hyperlink-budget.js +23 -0
- package/dist/integrations/pi/session-ui/image-preparation-client.d.ts +20 -0
- package/dist/integrations/pi/session-ui/image-preparation-client.js +145 -0
- package/dist/integrations/pi/session-ui/image-preparation.d.ts +18 -0
- package/dist/integrations/pi/session-ui/image-preparation.js +126 -0
- package/dist/integrations/pi/session-ui/image-source.d.ts +13 -0
- package/dist/integrations/pi/session-ui/image-source.js +171 -0
- package/dist/integrations/pi/session-ui/image-worker.d.ts +17 -0
- package/dist/integrations/pi/session-ui/image-worker.js +23 -0
- package/dist/integrations/pi/session-ui/index.d.ts +5 -0
- package/dist/integrations/pi/session-ui/index.js +5 -0
- package/dist/integrations/pi/session-ui/paste-executor.d.ts +10 -0
- package/dist/integrations/pi/session-ui/paste-executor.js +232 -0
- package/dist/integrations/pi/session-ui/paste-helper.d.ts +1 -0
- package/dist/integrations/pi/session-ui/paste-helper.js +173 -0
- package/dist/integrations/pi/session-ui/paste-preparation-client.d.ts +16 -0
- package/dist/integrations/pi/session-ui/paste-preparation-client.js +159 -0
- package/dist/integrations/pi/session-ui/paste-protocol.d.ts +78 -0
- package/dist/integrations/pi/session-ui/paste-protocol.js +18 -0
- package/dist/integrations/pi/session-ui/paste-text-preparation.d.ts +20 -0
- package/dist/integrations/pi/session-ui/paste-text-preparation.js +134 -0
- package/dist/integrations/pi/session-ui/paste-text-worker.d.ts +1 -0
- package/dist/integrations/pi/session-ui/paste-text-worker.js +12 -0
- package/dist/integrations/pi/session-ui/path-chip-presentation.d.ts +7 -0
- package/dist/integrations/pi/session-ui/path-chip-presentation.js +24 -0
- package/dist/integrations/pi/session-ui/prompt-chips.d.ts +72 -0
- package/dist/integrations/pi/session-ui/prompt-chips.js +503 -0
- package/dist/integrations/pi/session-ui/prompt-history-controller.d.ts +36 -0
- package/dist/integrations/pi/session-ui/prompt-history-controller.js +170 -0
- package/dist/integrations/pi/session-ui/prompt-suggestion-controller.d.ts +35 -0
- package/dist/integrations/pi/session-ui/prompt-suggestion-controller.js +207 -0
- package/dist/integrations/pi/session-ui/response-copy-coordinator.d.ts +27 -0
- package/dist/integrations/pi/session-ui/response-copy-coordinator.js +189 -0
- package/dist/integrations/pi/session-ui/response-copy-helper.d.ts +1 -0
- package/dist/integrations/pi/session-ui/response-copy-helper.js +122 -0
- package/dist/integrations/pi/session-ui/response-copy-protocol.d.ts +56 -0
- package/dist/integrations/pi/session-ui/response-copy-protocol.js +5 -0
- package/dist/integrations/pi/session-ui/response-copy-transport.d.ts +31 -0
- package/dist/integrations/pi/session-ui/response-copy-transport.js +187 -0
- package/dist/integrations/pi/session-ui/route-host.d.ts +5 -0
- package/dist/integrations/pi/session-ui/route-host.js +1 -0
- package/dist/integrations/pi/session-ui/session-shell-root.d.ts +221 -0
- package/dist/integrations/pi/session-ui/session-shell-root.js +1305 -0
- package/dist/integrations/pi/session-ui/session-shell.d.ts +55 -0
- package/dist/integrations/pi/session-ui/session-shell.js +1792 -0
- package/dist/integrations/pi/session-ui/session-viewport-controller.d.ts +56 -0
- package/dist/integrations/pi/session-ui/session-viewport-controller.js +569 -0
- package/dist/integrations/pi/session-ui/stream-presentation-coalescer.d.ts +29 -0
- package/dist/integrations/pi/session-ui/stream-presentation-coalescer.js +79 -0
- package/dist/integrations/pi/session-ui/system-clipboard.d.ts +20 -0
- package/dist/integrations/pi/session-ui/system-clipboard.js +156 -0
- package/dist/integrations/pi/session-ui/text-paste.d.ts +5 -0
- package/dist/integrations/pi/session-ui/text-paste.js +16 -0
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.d.ts +10 -1
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.js +255 -11
- package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.d.ts +32 -6
- package/dist/integrations/pi/tui-runtime/contracts.js +1 -0
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +81 -0
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +424 -0
- package/dist/integrations/pi/tui-runtime/index.d.ts +7 -0
- package/dist/integrations/pi/tui-runtime/index.js +7 -0
- package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.d.ts +39 -0
- package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.js +139 -0
- package/dist/integrations/pi/tui-runtime/mouse-report-input.d.ts +13 -0
- package/dist/integrations/pi/tui-runtime/mouse-report-input.js +59 -0
- package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +32 -0
- package/dist/integrations/pi/tui-runtime/overlay-geometry.js +159 -0
- 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 +4 -4
- package/dist/native/darwin-arm64/process-guardian +0 -0
- package/dist/native/linux-x64/manifest.json +3 -3
- package/dist/native/linux-x64/process-guardian +0 -0
- package/dist/native/win32-x64/manifest.json +3 -3
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/{src/product-identity.d.ts → product-identity.d.ts} +4 -4
- package/dist/{src/product-identity.js → product-identity.js} +7 -38
- package/dist/{src/product-identity.json → product-identity.json} +13 -27
- package/dist/runtime-payload-inventory.json +122333 -0
- package/dist/{src/foundation/ui-apps → ui/apps}/contracts.d.ts +23 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.d.ts +1 -1
- package/dist/{src/foundation/ui-apps → ui/apps}/host.js +14 -10
- package/dist/{src/foundation/ui-apps → ui/apps}/registry.d.ts +1 -0
- package/dist/{src/foundation/ui-apps → ui/apps}/registry.js +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.js +5 -3
- package/dist/{src/foundation/ui-components → ui/components}/frame.d.ts +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/frame.js +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/index.d.ts +7 -0
- package/dist/{src/foundation/ui-components → ui/components}/index.js +7 -0
- package/dist/{src/foundation/ui-components → ui/components}/line-input.d.ts +2 -8
- package/dist/{src/foundation/ui-components → ui/components}/line-input.js +7 -28
- package/dist/{src/foundation/ui-components → ui/components}/list-view.d.ts +0 -6
- package/dist/{src/foundation/ui-components → ui/components}/list-view.js +14 -7
- package/dist/{src/foundation/ui-components → ui/components}/mouse.d.ts +10 -0
- package/dist/{src/foundation/ui-components → ui/components}/mouse.js +24 -0
- package/dist/ui/components/progress-status.d.ts +2 -0
- package/dist/ui/components/progress-status.js +4 -0
- package/dist/ui/components/prompt-input.d.ts +32 -0
- package/dist/ui/components/prompt-input.js +54 -0
- package/dist/ui/components/prompt-row.d.ts +14 -0
- package/dist/ui/components/prompt-row.js +20 -0
- package/dist/{src/foundation/ui-components → ui/components}/scrollbar.d.ts +26 -0
- package/dist/{src/foundation/ui-components → ui/components}/scrollbar.js +35 -0
- package/dist/ui/components/selection-copy.d.ts +24 -0
- package/dist/ui/components/selection-copy.js +39 -0
- package/dist/{src/foundation/ui-components → ui/components}/shortcuts.d.ts +1 -0
- package/dist/{src/foundation/ui-components → ui/components}/shortcuts.js +1 -0
- package/dist/ui/components/spans.d.ts +28 -0
- package/dist/ui/components/spans.js +266 -0
- package/dist/ui/components/submitted-prompt.d.ts +23 -0
- package/dist/ui/components/submitted-prompt.js +50 -0
- package/dist/{src/foundation/ui-components → ui/components}/surface.d.ts +0 -5
- package/dist/{src/foundation/ui-components → ui/components}/surface.js +1 -5
- package/dist/ui/components/text-selection.d.ts +62 -0
- package/dist/ui/components/text-selection.js +210 -0
- package/dist/{src/foundation/ui-components → ui/components}/text.d.ts +14 -0
- package/dist/{src/foundation/ui-components → ui/components}/text.js +67 -5
- package/dist/ui/components/transcript-viewport.d.ts +173 -0
- package/dist/ui/components/transcript-viewport.js +753 -0
- package/dist/ui/components/visible-hyperlinks.d.ts +26 -0
- package/dist/ui/components/visible-hyperlinks.js +97 -0
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.d.ts +8 -1
- package/dist/ui/settings/declarations.js +94 -0
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.d.ts +1 -1
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.js +28 -2
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.d.ts +6 -19
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.js +41 -22
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.d.ts +9 -17
- package/dist/ui/settings/session.js +164 -0
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.d.ts +1 -0
- package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.js +2 -1
- package/docs/architecture/boundaries.md +14 -10
- package/docs/architecture/code-documentation.md +77 -0
- package/docs/architecture/history-editor-provenance.md +100 -0
- package/docs/architecture/internal-naming.md +91 -0
- package/docs/architecture/process-guardian-provenance.md +3 -1
- package/docs/architecture/project-structure.md +69 -30
- package/docs/architecture/prompt-suggestions.md +68 -0
- package/docs/architecture/resource-and-data-policy.md +28 -2
- package/docs/architecture/response-copy-delivery.md +83 -0
- package/docs/architecture/tool-image-presentation.md +62 -0
- package/docs/architecture/toolchain.md +24 -10
- package/docs/architecture/ui-reference-provenance.md +59 -5
- package/docs/ci-release-runbook.md +236 -79
- package/docs/features/launch-profiles.md +24 -17
- package/docs/features/modal-content-interaction.md +37 -0
- package/docs/features/prompt-history.md +149 -0
- package/docs/local-worktree-cleanup.md +128 -0
- package/docs/manual-code-streaming-cleanup.md +88 -0
- package/docs/manual-ghost-link-baseline.md +89 -0
- package/docs/manual-launch-instance-acceptance.md +12 -35
- package/docs/manual-owned-ui-checkpoint.md +78 -0
- package/docs/manual-pi-boundary-candidate.md +4 -5
- package/docs/manual-terminal-colour-check.md +4 -3
- package/docs/openspec-archive-automation.md +128 -0
- package/docs/repository-governance-live-acceptance.md +77 -0
- package/package.json +45 -28
- package/dist/src/cli/capabilities.d.ts +0 -15
- package/dist/src/cli/dispatch.js +0 -142
- package/dist/src/cli/version-stats.js +0 -72
- package/dist/src/composition/index.d.ts +0 -48
- package/dist/src/composition/index.js +0 -258
- package/dist/src/features/launch/intent.d.ts +0 -7
- package/dist/src/features/launch/intent.js +0 -4
- package/dist/src/features/launch/profiles.d.ts +0 -12
- package/dist/src/features/launch/profiles.js +0 -26
- package/dist/src/features/owned-ui/run.js +0 -15
- package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
- package/dist/src/foundation/owned-ui-contracts/index.d.ts +0 -3
- package/dist/src/foundation/owned-ui-contracts/index.js +0 -3
- package/dist/src/foundation/owned-ui-settings/declarations.js +0 -39
- package/dist/src/foundation/owned-ui-settings/session.js +0 -145
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js +0 -162
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +0 -57
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts +0 -116
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js +0 -19
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.d.ts +0 -18
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.js +0 -55
- package/dist/src/foundation/pi-engine-adapter/settings-integration.d.ts +0 -55
- package/dist/src/foundation/pi-owned-ui-integration/index.d.ts +0 -2
- package/dist/src/foundation/pi-owned-ui-integration/index.js +0 -2
- package/dist/src/foundation/pi-owned-ui-integration/route-host.d.ts +0 -29
- package/dist/src/foundation/pi-owned-ui-integration/session-shell.d.ts +0 -106
- package/dist/src/foundation/pi-owned-ui-integration/session-shell.js +0 -1518
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts +0 -4
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js +0 -4
- package/dist/src/foundation/release/bootstrap.d.ts +0 -29
- package/dist/src/foundation/release/cohort-state.d.ts +0 -70
- package/dist/src/foundation/release/cohort-state.js +0 -202
- package/dist/src/foundation/release/release-gc.d.ts +0 -5
- package/dist/src/foundation/release/release-gc.js +0 -16
- package/dist/src/foundation/supervision/index.d.ts +0 -3
- package/dist/src/foundation/supervision/index.js +0 -3
- package/dist/src/foundation/supervision/main.d.ts +0 -1
- package/dist/src/foundation/supervision/main.js +0 -41
- package/dist/src/foundation/supervision/paths.d.ts +0 -1
- package/dist/src/foundation/supervision/paths.js +0 -1
- package/dist/src/foundation/supervision/server.d.ts +0 -22
- package/dist/src/foundation/ui-components/spans.d.ts +0 -7
- package/dist/src/foundation/ui-components/spans.js +0 -59
- package/docs/manual-transparent-checkpoint.md +0 -53
- /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.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.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.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.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}/model.js +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/initialize-profile.d.ts +0 -0
- /package/dist/{src/features → features}/launch/initialize-profile.js +0 -0
- /package/dist/{src/features → features}/launch/runtime-selection.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/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}/lifecycle/commands.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/lifecycle/commands.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}/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}/protocol/index.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/protocol/index.js +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/cohort-selection.js +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/concurrency.js +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/process-cleanup.js +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.d.ts +0 -0
- /package/dist/{src/foundation → foundation}/release/stable-release.js +0 -0
- /package/dist/{src/foundation → 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/pi-component-adapter → integrations/pi/components}/components.js +0 -0
- /package/dist/{src/foundation/pi-owned-ui-integration/route-host.js → integrations/pi/components/editor-interaction.js} +0 -0
- /package/dist/{src/foundation/pi-tui-runtime-adapter/contracts.js → integrations/pi/components/prompt-input-port.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-editor-autocomplete.d.ts +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}/theme.d.ts +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.js +0 -0
- /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.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/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/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}/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}/workflows.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}/presentation-adapter.js +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-components → ui/components}/dialog-panel.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/label.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/list-block.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/pane.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/revision.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/status-line.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/stepper.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/theme.js +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.d.ts +0 -0
- /package/dist/{src/foundation/ui-components → ui/components}/value-menu.js +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/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}/resolution.d.ts +0 -0
- /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.js +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { PROMPT_HISTORY_MAX_TEXT_BYTES } from "../../../contracts/owned-ui/index.js";
|
|
3
|
+
/** Merges bounded recall snapshots; the editor alone owns browsing, draft, cursor, and undo state. */
|
|
4
|
+
export class PromptHistoryController {
|
|
5
|
+
options;
|
|
6
|
+
#local = new Map();
|
|
7
|
+
#unsubscribe;
|
|
8
|
+
#snapshot;
|
|
9
|
+
#fallback;
|
|
10
|
+
#rehydrateCache;
|
|
11
|
+
#disposed = false;
|
|
12
|
+
#generation = 0;
|
|
13
|
+
#unsubscribeSnapshot;
|
|
14
|
+
#unsubscribeFailure;
|
|
15
|
+
#closeFailed = false;
|
|
16
|
+
#closePromise;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
if (options.editor.recall === undefined)
|
|
20
|
+
throw new Error("The selected editor does not expose typed history");
|
|
21
|
+
this.#snapshot = { revision: 0, limit: options.limit, entries: [] };
|
|
22
|
+
this.#rehydrateCache = new Map();
|
|
23
|
+
this.#fallback = boundedTexts([...options.fallback].reverse(), options.limit);
|
|
24
|
+
this.#unsubscribeSnapshot = this.#subscribeSnapshot();
|
|
25
|
+
this.#unsubscribeFailure = options.store.onFailure(() => {
|
|
26
|
+
if (this.#disposed)
|
|
27
|
+
this.#closeFailed = true;
|
|
28
|
+
});
|
|
29
|
+
this.#unsubscribe = [
|
|
30
|
+
options.editor.recall.observe(() => {
|
|
31
|
+
if (this.#disposed)
|
|
32
|
+
return;
|
|
33
|
+
if (options.editor.recall.position().index === -1)
|
|
34
|
+
this.synchronize();
|
|
35
|
+
options.store.refresh();
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
this.synchronize();
|
|
39
|
+
}
|
|
40
|
+
start() { this.options.store.start(); }
|
|
41
|
+
capture(text, kind, cwd, sessionId) {
|
|
42
|
+
const canonical = text.trim();
|
|
43
|
+
if (!canonical || this.#disposed)
|
|
44
|
+
return;
|
|
45
|
+
const id = randomUUID();
|
|
46
|
+
const generation = this.#generation;
|
|
47
|
+
this.#local.set(id, { text: canonical, committed: false });
|
|
48
|
+
this.#boundLocal();
|
|
49
|
+
this.synchronize();
|
|
50
|
+
void this.options.store.record({ id, text: canonical, timestamp: Date.now(), kind, cwd, sessionId }).then(outcome => {
|
|
51
|
+
if (this.#disposed || generation !== this.#generation)
|
|
52
|
+
return;
|
|
53
|
+
const local = this.#local.get(id);
|
|
54
|
+
if (local === undefined || outcome !== "committed")
|
|
55
|
+
return;
|
|
56
|
+
local.committed = true;
|
|
57
|
+
if (this.#snapshot.entries.some(entry => entry.submissionId === id))
|
|
58
|
+
this.#local.delete(id);
|
|
59
|
+
this.synchronize();
|
|
60
|
+
}).catch(() => { });
|
|
61
|
+
}
|
|
62
|
+
rememberRecovery(text) {
|
|
63
|
+
if (this.#disposed || !text.trim())
|
|
64
|
+
return;
|
|
65
|
+
const canonical = text.trim();
|
|
66
|
+
if ([...this.#local.values()].some(item => item.text === canonical)
|
|
67
|
+
|| this.#snapshot.entries.some(item => item.text === canonical))
|
|
68
|
+
return;
|
|
69
|
+
this.#local.set(randomUUID(), { text: canonical, committed: false });
|
|
70
|
+
this.#boundLocal();
|
|
71
|
+
this.synchronize();
|
|
72
|
+
}
|
|
73
|
+
synchronize() {
|
|
74
|
+
if (this.#disposed || !this.options.active())
|
|
75
|
+
return;
|
|
76
|
+
const local = [...this.#local.values()].reverse().map(item => item.text);
|
|
77
|
+
const saved = this.#snapshot.entries.map(item => item.text);
|
|
78
|
+
const values = this.#rehydrateAll(local.concat(saved, this.#fallback));
|
|
79
|
+
this.options.editor.recall.replace(boundedTexts(values, this.#snapshot.limit));
|
|
80
|
+
this.options.render();
|
|
81
|
+
}
|
|
82
|
+
#rehydrateAll(values) {
|
|
83
|
+
const rehydrate = this.options.rehydrate;
|
|
84
|
+
if (rehydrate === undefined)
|
|
85
|
+
return [...values];
|
|
86
|
+
const cache = this.#rehydrateCache;
|
|
87
|
+
const results = [];
|
|
88
|
+
for (const value of values) {
|
|
89
|
+
const cached = cache.get(value);
|
|
90
|
+
if (cached !== undefined) {
|
|
91
|
+
results.push(cached);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const rendered = rehydrate(value);
|
|
95
|
+
cache.set(value, rendered);
|
|
96
|
+
results.push(rendered);
|
|
97
|
+
}
|
|
98
|
+
if (cache.size > 512) {
|
|
99
|
+
// Performance: keep the cache bounded so long sessions cannot grow it without limit.
|
|
100
|
+
const keys = [...cache.keys()].slice(0, cache.size - 256);
|
|
101
|
+
for (const key of keys)
|
|
102
|
+
cache.delete(key);
|
|
103
|
+
}
|
|
104
|
+
return results;
|
|
105
|
+
}
|
|
106
|
+
reset(fallback) {
|
|
107
|
+
this.#generation++;
|
|
108
|
+
this.#unsubscribeSnapshot();
|
|
109
|
+
this.#unsubscribeSnapshot = this.#subscribeSnapshot();
|
|
110
|
+
this.#fallback = boundedTexts([...fallback].reverse(), this.options.limit);
|
|
111
|
+
this.#local.clear();
|
|
112
|
+
this.#rehydrateCache.clear();
|
|
113
|
+
this.options.editor.recall.reset();
|
|
114
|
+
this.synchronize();
|
|
115
|
+
this.options.store.refresh();
|
|
116
|
+
}
|
|
117
|
+
close() {
|
|
118
|
+
if (this.#closePromise !== undefined)
|
|
119
|
+
return this.#closePromise;
|
|
120
|
+
this.#disposed = true;
|
|
121
|
+
this.#unsubscribeSnapshot();
|
|
122
|
+
for (const unsubscribe of this.#unsubscribe)
|
|
123
|
+
unsubscribe();
|
|
124
|
+
this.#local.clear();
|
|
125
|
+
this.#fallback = [];
|
|
126
|
+
this.#closePromise = this.options.store.close().then(() => !this.#closeFailed, () => false)
|
|
127
|
+
.finally(() => this.#unsubscribeFailure());
|
|
128
|
+
return this.#closePromise;
|
|
129
|
+
}
|
|
130
|
+
#subscribeSnapshot() {
|
|
131
|
+
const generation = this.#generation;
|
|
132
|
+
return this.options.store.onSnapshot(snapshot => {
|
|
133
|
+
if (this.#disposed || generation !== this.#generation || snapshot.revision < this.#snapshot.revision)
|
|
134
|
+
return;
|
|
135
|
+
this.#snapshot = snapshot;
|
|
136
|
+
for (const [id, entry] of this.#local) {
|
|
137
|
+
if (entry.committed || snapshot.entries.some(saved => saved.submissionId === id))
|
|
138
|
+
this.#local.delete(id);
|
|
139
|
+
}
|
|
140
|
+
this.synchronize();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
#boundLocal() {
|
|
144
|
+
let bytes = [...this.#local.values()].reduce((sum, item) => sum + Buffer.byteLength(item.text), 0);
|
|
145
|
+
while (this.#local.size > this.options.limit || bytes > PROMPT_HISTORY_MAX_TEXT_BYTES) {
|
|
146
|
+
const id = this.#local.keys().next().value;
|
|
147
|
+
bytes -= Buffer.byteLength(this.#local.get(id).text);
|
|
148
|
+
this.#local.delete(id);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function boundedTexts(values, limit) {
|
|
153
|
+
const result = [];
|
|
154
|
+
const seen = new Set();
|
|
155
|
+
let bytes = 0;
|
|
156
|
+
for (const value of values) {
|
|
157
|
+
const text = value.trim();
|
|
158
|
+
if (!text || seen.has(text))
|
|
159
|
+
continue;
|
|
160
|
+
const size = Buffer.byteLength(text);
|
|
161
|
+
if (bytes + size > PROMPT_HISTORY_MAX_TEXT_BYTES)
|
|
162
|
+
continue;
|
|
163
|
+
result.push(text);
|
|
164
|
+
seen.add(text);
|
|
165
|
+
bytes += size;
|
|
166
|
+
if (result.length >= limit)
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type OwnedUiPromptSuggestionGeneratorPort, type OwnedUiPromptSuggestionIdentity, type OwnedUiPromptSuggestionState, type SuggestionDecision, type SuggestionDecisionReason, type SuggestionDiagnosticObserver } from "../../../contracts/owned-ui/index.js";
|
|
2
|
+
export interface ContextualPromptSuggestionSurface {
|
|
3
|
+
canPresent(identity: OwnedUiPromptSuggestionIdentity): boolean;
|
|
4
|
+
presentationBlockReason?(identity: OwnedUiPromptSuggestionIdentity): SuggestionDecision;
|
|
5
|
+
present(text: string): boolean;
|
|
6
|
+
clear(): void;
|
|
7
|
+
requestRender(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface ContextualPromptSuggestionControllerOptions {
|
|
10
|
+
readonly generator: OwnedUiPromptSuggestionGeneratorPort;
|
|
11
|
+
readonly surface: ContextualPromptSuggestionSurface;
|
|
12
|
+
readonly enabled: boolean;
|
|
13
|
+
readonly timeoutMs?: number;
|
|
14
|
+
readonly diagnostics?: SuggestionDiagnosticObserver;
|
|
15
|
+
readonly now?: () => number;
|
|
16
|
+
}
|
|
17
|
+
type DecisionIdentity = Omit<OwnedUiPromptSuggestionIdentity, "model"> & {
|
|
18
|
+
readonly model: OwnedUiPromptSuggestionIdentity["model"] | null;
|
|
19
|
+
};
|
|
20
|
+
/** Prefetches one inert candidate; owns retirement even when a provider ignores abort. */
|
|
21
|
+
export declare class ContextualPromptSuggestionController {
|
|
22
|
+
#private;
|
|
23
|
+
readonly options: ContextualPromptSuggestionControllerOptions;
|
|
24
|
+
constructor(options: ContextualPromptSuggestionControllerOptions);
|
|
25
|
+
get state(): OwnedUiPromptSuggestionState;
|
|
26
|
+
setEnabled(enabled: boolean): void;
|
|
27
|
+
skip(identity: DecisionIdentity, reason: SuggestionDecisionReason): void;
|
|
28
|
+
consider(identity: OwnedUiPromptSuggestionIdentity, decision: boolean | SuggestionDecision): void;
|
|
29
|
+
settle(identity: OwnedUiPromptSuggestionIdentity): void;
|
|
30
|
+
accept(): void;
|
|
31
|
+
invalidate(): void;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function samePromptSuggestionIdentity(left: OwnedUiPromptSuggestionIdentity, right: OwnedUiPromptSuggestionIdentity): boolean;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { assertOwnedUiPromptSuggestionResult, normalizePromptSuggestionCandidate, } from "../../../contracts/owned-ui/index.js";
|
|
2
|
+
/** Prefetches one inert candidate; owns retirement even when a provider ignores abort. */
|
|
3
|
+
export class ContextualPromptSuggestionController {
|
|
4
|
+
options;
|
|
5
|
+
#state = { status: "idle" };
|
|
6
|
+
#request = null;
|
|
7
|
+
#lastConsidered = "";
|
|
8
|
+
#enabled;
|
|
9
|
+
#disposed = false;
|
|
10
|
+
#sessionKey = "";
|
|
11
|
+
#sessionSequence = 0;
|
|
12
|
+
#requestSequence = 0;
|
|
13
|
+
#timeoutMs;
|
|
14
|
+
#now;
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.options = options;
|
|
17
|
+
this.#enabled = options.enabled;
|
|
18
|
+
this.#timeoutMs = options.timeoutMs ?? 15_000;
|
|
19
|
+
this.#now = options.now ?? Date.now;
|
|
20
|
+
}
|
|
21
|
+
get state() { return this.#state; }
|
|
22
|
+
setEnabled(enabled) {
|
|
23
|
+
if (this.#enabled === enabled)
|
|
24
|
+
return;
|
|
25
|
+
this.#enabled = enabled;
|
|
26
|
+
this.invalidate();
|
|
27
|
+
}
|
|
28
|
+
skip(identity, reason) {
|
|
29
|
+
this.invalidate();
|
|
30
|
+
this.#emit(this.#metadata(identity), "skipped", reason);
|
|
31
|
+
}
|
|
32
|
+
consider(identity, decision) {
|
|
33
|
+
const key = identityKey(identity);
|
|
34
|
+
if (key === this.#lastConsidered)
|
|
35
|
+
return;
|
|
36
|
+
this.#lastConsidered = key;
|
|
37
|
+
this.invalidate();
|
|
38
|
+
const reason = this.#disposed ? "disposed" : !this.#enabled ? "disabled"
|
|
39
|
+
: decision === false ? "ineligible" : decision === true ? null : decision;
|
|
40
|
+
if (reason !== null) {
|
|
41
|
+
this.#emit(this.#metadata(identity), "skipped", reason);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let reasoning = "unavailable";
|
|
45
|
+
try {
|
|
46
|
+
reasoning = this.options.generator.suggestionReasoningPolicy?.() ?? "unavailable";
|
|
47
|
+
}
|
|
48
|
+
catch { /* Security: isolate diagnostic metadata failure. */ }
|
|
49
|
+
const request = {
|
|
50
|
+
identity,
|
|
51
|
+
metadata: { ...this.#metadata(identity), request: ++this.#requestSequence, reasoning },
|
|
52
|
+
abort: new AbortController(), startedAt: this.#now(), terminal: false,
|
|
53
|
+
};
|
|
54
|
+
this.#request = request;
|
|
55
|
+
this.#state = { status: "generating", identity, settled: false };
|
|
56
|
+
this.#emit(request.metadata, "started");
|
|
57
|
+
request.timer = setTimeout(() => {
|
|
58
|
+
if (this.#request !== request || this.#state.status !== "generating")
|
|
59
|
+
return;
|
|
60
|
+
this.#finish(request, "timeout");
|
|
61
|
+
this.#state = { status: "idle" };
|
|
62
|
+
this.#request = null;
|
|
63
|
+
request.abort.abort();
|
|
64
|
+
}, this.#timeoutMs);
|
|
65
|
+
request.timer.unref?.();
|
|
66
|
+
try {
|
|
67
|
+
void this.options.generator.generate({ identity, signal: request.abort.signal })
|
|
68
|
+
.then(result => this.#receive(request, result), () => this.#failed(request))
|
|
69
|
+
.finally(() => clearTimeout(request.timer));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
this.#failed(request);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
settle(identity) {
|
|
76
|
+
if (this.#disposed || !this.#enabled || this.#state.status === "idle")
|
|
77
|
+
return;
|
|
78
|
+
if (!samePromptSuggestionIdentity(this.#state.identity, identity)) {
|
|
79
|
+
if (this.#request)
|
|
80
|
+
this.#finish(this.#request, "stale-result", "stale-identity");
|
|
81
|
+
this.invalidate();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (this.#state.status === "generating")
|
|
85
|
+
this.#state = { ...this.#state, settled: true };
|
|
86
|
+
else if (this.#state.status === "prepared" && this.#request)
|
|
87
|
+
this.#show(this.#request, this.#state.text);
|
|
88
|
+
}
|
|
89
|
+
accept() { this.#invalidate(false); }
|
|
90
|
+
invalidate() { this.#invalidate(true); }
|
|
91
|
+
dispose() {
|
|
92
|
+
this.#disposed = true;
|
|
93
|
+
this.invalidate();
|
|
94
|
+
this.#lastConsidered = "";
|
|
95
|
+
this.#sessionKey = "";
|
|
96
|
+
}
|
|
97
|
+
#invalidate(clearSurface) {
|
|
98
|
+
const hadVisibleSuggestion = this.#state.status === "available";
|
|
99
|
+
const request = this.#request;
|
|
100
|
+
if (request)
|
|
101
|
+
this.#finish(request, "cancelled");
|
|
102
|
+
this.#request = null;
|
|
103
|
+
this.#state = { status: "idle" };
|
|
104
|
+
request?.abort.abort();
|
|
105
|
+
if (clearSurface && hadVisibleSuggestion) {
|
|
106
|
+
this.options.surface.clear();
|
|
107
|
+
this.options.surface.requestRender();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
#failed(request) {
|
|
111
|
+
if (this.#request !== request || request.terminal) {
|
|
112
|
+
this.#late(request);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.#finish(request, "provider-failure");
|
|
116
|
+
this.#request = null;
|
|
117
|
+
this.#state = { status: "idle" };
|
|
118
|
+
}
|
|
119
|
+
#receive(request, result) {
|
|
120
|
+
if (this.#disposed || this.#request !== request || request.terminal || this.#state.status !== "generating") {
|
|
121
|
+
this.#late(request);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
assertOwnedUiPromptSuggestionResult(result);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
this.#finish(request, "rejected");
|
|
129
|
+
this.invalidate();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (!samePromptSuggestionIdentity(request.identity, result.identity)) {
|
|
133
|
+
this.#finish(request, "stale-result", "stale-identity");
|
|
134
|
+
this.invalidate();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (result.outcome !== "candidate") {
|
|
138
|
+
this.#finish(request, result.outcome);
|
|
139
|
+
this.invalidate();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const text = normalizePromptSuggestionCandidate(result.text);
|
|
143
|
+
if (text === null) {
|
|
144
|
+
this.#finish(request, "rejected");
|
|
145
|
+
this.invalidate();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
clearTimeout(request.timer);
|
|
149
|
+
if (this.#state.settled)
|
|
150
|
+
this.#show(request, text);
|
|
151
|
+
else
|
|
152
|
+
this.#state = { status: "prepared", identity: request.identity, text };
|
|
153
|
+
}
|
|
154
|
+
#show(request, text) {
|
|
155
|
+
const reason = this.options.surface.presentationBlockReason?.(request.identity)
|
|
156
|
+
?? (this.options.surface.canPresent(request.identity) ? null : "presentation-unavailable");
|
|
157
|
+
if (reason !== null || !this.options.surface.present(text)) {
|
|
158
|
+
this.#finish(request, "presentation-blocked", reason ?? "presentation-unavailable");
|
|
159
|
+
this.invalidate();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.#state = { status: "available", identity: request.identity, text };
|
|
163
|
+
this.#finish(request, "displayed");
|
|
164
|
+
this.options.surface.requestRender();
|
|
165
|
+
}
|
|
166
|
+
#finish(request, event, reason) {
|
|
167
|
+
if (request.terminal)
|
|
168
|
+
return;
|
|
169
|
+
// Concurrency: retire before notifying observers or aborting; neither may rewrite the winner.
|
|
170
|
+
request.terminal = true;
|
|
171
|
+
clearTimeout(request.timer);
|
|
172
|
+
this.#emit({ ...request.metadata, elapsedMs: Math.max(0, this.#now() - request.startedAt) }, event, reason);
|
|
173
|
+
}
|
|
174
|
+
#late(request) {
|
|
175
|
+
if (!this.#disposed)
|
|
176
|
+
this.#emit({ ...request.metadata, elapsedMs: Math.max(0, this.#now() - request.startedAt) }, "late-result-discarded");
|
|
177
|
+
}
|
|
178
|
+
#metadata(identity) {
|
|
179
|
+
const key = `${identity.sessionId}\0${identity.sessionGeneration}`;
|
|
180
|
+
if (this.#sessionKey !== key) {
|
|
181
|
+
this.#sessionKey = key;
|
|
182
|
+
this.#sessionSequence++;
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
event: "skipped", session: this.#sessionSequence, run: identity.runSequence, response: identity.responseSequence,
|
|
186
|
+
request: 0, provider: identity.model?.providerId ?? "", model: identity.model?.modelId ?? "",
|
|
187
|
+
reasoning: "unavailable", elapsedMs: 0,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
#emit(metadata, event, reason) {
|
|
191
|
+
try {
|
|
192
|
+
this.options.diagnostics?.record({ ...metadata, event, ...(reason === undefined ? {} : { reason }) });
|
|
193
|
+
}
|
|
194
|
+
catch { /* Security: diagnostics never own input or lifecycle. */ }
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
export function samePromptSuggestionIdentity(left, right) {
|
|
198
|
+
return left.sessionId === right.sessionId
|
|
199
|
+
&& left.sessionGeneration === right.sessionGeneration
|
|
200
|
+
&& left.runSequence === right.runSequence
|
|
201
|
+
&& left.responseSequence === right.responseSequence
|
|
202
|
+
&& left.model.providerId === right.model.providerId
|
|
203
|
+
&& left.model.modelId === right.model.modelId;
|
|
204
|
+
}
|
|
205
|
+
function identityKey(identity) {
|
|
206
|
+
return `${identity.sessionId}\0${identity.sessionGeneration}\0${identity.runSequence}\0${identity.responseSequence}\0${identity.model.providerId}\0${identity.model.modelId}`;
|
|
207
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type SelectionCopySnapshot } from "../../../ui/components/index.js";
|
|
2
|
+
import { type CopyResult, type ResponseCopyEvent } from "./response-copy-protocol.js";
|
|
3
|
+
import type { ResponseCopyExecutor } from "./response-copy-transport.js";
|
|
4
|
+
/** Owns one delivery and one newest pending copy, including expiry and side-effect fencing. */
|
|
5
|
+
export declare class ResponseCopyCoordinator {
|
|
6
|
+
#private;
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(options: {
|
|
9
|
+
readonly execute: ResponseCopyExecutor;
|
|
10
|
+
readonly onEvent?: (event: ResponseCopyEvent) => void;
|
|
11
|
+
readonly onFailure?: (result: CopyResult) => void;
|
|
12
|
+
readonly now?: () => number;
|
|
13
|
+
});
|
|
14
|
+
get busy(): boolean;
|
|
15
|
+
get latest(): Promise<CopyResult>;
|
|
16
|
+
/** Exact prompt copy/cut shares the write lifetime without transcript text transformations. */
|
|
17
|
+
submitText(text: string): Promise<CopyResult>;
|
|
18
|
+
/** Admission is synchronous, but preparation/startup never runs in the input handler's stack. */
|
|
19
|
+
submit(snapshot: SelectionCopySnapshot, before?: Promise<void>): Promise<CopyResult>;
|
|
20
|
+
/** Capture the current copy barrier, without making later copies retroactively delay this paste. */
|
|
21
|
+
canPaste(signal: AbortSignal): Promise<boolean>;
|
|
22
|
+
/** Only a pending write is a prerequisite; a completed failure cannot poison independent future reads. */
|
|
23
|
+
capturePasteBarrier(): (signal: AbortSignal) => Promise<boolean>;
|
|
24
|
+
/** Session replacement fences the old executor rather than discarding its live side effects. */
|
|
25
|
+
reset(): void;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { MAX_COPY_SOURCE_UNITS } from "../../../ui/components/index.js";
|
|
2
|
+
import { COPY_CLEANUP_MS, COPY_DEADLINE_MS } from "./response-copy-protocol.js";
|
|
3
|
+
/** Owns one delivery and one newest pending copy, including expiry and side-effect fencing. */
|
|
4
|
+
export class ResponseCopyCoordinator {
|
|
5
|
+
options;
|
|
6
|
+
#sequence = 0;
|
|
7
|
+
#epoch = 0;
|
|
8
|
+
#active;
|
|
9
|
+
#pending;
|
|
10
|
+
#latest = Promise.resolve({ outcome: "delivered" });
|
|
11
|
+
#latestPending = false;
|
|
12
|
+
#disposed = false;
|
|
13
|
+
#quarantined = false;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.options = options;
|
|
16
|
+
}
|
|
17
|
+
get busy() { return this.#active !== undefined || this.#pending !== undefined; }
|
|
18
|
+
get latest() { return this.#latest; }
|
|
19
|
+
/** Exact prompt copy/cut shares the write lifetime without transcript text transformations. */
|
|
20
|
+
submitText(text) {
|
|
21
|
+
return this.submit(Object.freeze({
|
|
22
|
+
literal: true, revision: 0, sourceUnits: text.length,
|
|
23
|
+
selection: Object.freeze({ start: Object.freeze({ line: 0, column: 0 }), end: Object.freeze({ line: 0, column: Number.MAX_SAFE_INTEGER }) }),
|
|
24
|
+
rows: Object.freeze(text.length > MAX_COPY_SOURCE_UNITS ? [] : [Object.freeze({ text })]),
|
|
25
|
+
...(text.length > MAX_COPY_SOURCE_UNITS ? { rejected: "size" } : {}),
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
/** Admission is synchronous, but preparation/startup never runs in the input handler's stack. */
|
|
29
|
+
submit(snapshot, before = Promise.resolve()) {
|
|
30
|
+
const id = ++this.#sequence;
|
|
31
|
+
const admitted = this.#now() - (snapshot.captureMs ?? 0);
|
|
32
|
+
let resolve;
|
|
33
|
+
const result = new Promise(done => { resolve = done; });
|
|
34
|
+
this.#latest = result;
|
|
35
|
+
this.#latestPending = true;
|
|
36
|
+
const request = {
|
|
37
|
+
id, epoch: this.#epoch, admitted, sourceUnits: snapshot.sourceUnits, snapshot, before, resolve, done: false, submitting: false,
|
|
38
|
+
timer: setTimeout(() => this.#cancel(request, { outcome: "timed-out" }), Math.max(0, COPY_DEADLINE_MS - (snapshot.captureMs ?? 0))),
|
|
39
|
+
};
|
|
40
|
+
request.timer.unref?.();
|
|
41
|
+
this.#trace(request, "capture", { elapsedMs: snapshot.captureMs ?? 0 });
|
|
42
|
+
if (snapshot.literal !== true)
|
|
43
|
+
this.#trace(request, "selection-clear");
|
|
44
|
+
if (this.#disposed || this.#quarantined || snapshot.rejected) {
|
|
45
|
+
this.#settle(request, { outcome: this.#disposed ? "canceled" : "failed", failure: snapshot.rejected ? "size" : "unsafe" });
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
if (this.#pending)
|
|
49
|
+
this.#cancel(this.#pending, { outcome: "superseded" });
|
|
50
|
+
this.#pending = request;
|
|
51
|
+
if (this.#active && !this.#active.submitting)
|
|
52
|
+
this.#cancel(this.#active, { outcome: "superseded" });
|
|
53
|
+
this.#trace(request, "queued");
|
|
54
|
+
this.#drain();
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/** Capture the current copy barrier, without making later copies retroactively delay this paste. */
|
|
58
|
+
canPaste(signal) { return this.capturePasteBarrier()(signal); }
|
|
59
|
+
/** Only a pending write is a prerequisite; a completed failure cannot poison independent future reads. */
|
|
60
|
+
capturePasteBarrier() {
|
|
61
|
+
const latest = this.#latestPending ? this.#latest : undefined;
|
|
62
|
+
return async (signal) => {
|
|
63
|
+
if (signal.aborted)
|
|
64
|
+
return false;
|
|
65
|
+
if (latest === undefined)
|
|
66
|
+
return true;
|
|
67
|
+
return new Promise(resolve => {
|
|
68
|
+
const abort = () => resolve(false);
|
|
69
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
70
|
+
void latest.then(result => {
|
|
71
|
+
signal.removeEventListener("abort", abort);
|
|
72
|
+
resolve(!signal.aborted && (result.outcome === "delivered" || result.outcome === "submitted-unverified"));
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Session replacement fences the old executor rather than discarding its live side effects. */
|
|
78
|
+
reset() {
|
|
79
|
+
this.#epoch++;
|
|
80
|
+
if (this.#pending)
|
|
81
|
+
this.#cancel(this.#pending, { outcome: "canceled" });
|
|
82
|
+
if (this.#active)
|
|
83
|
+
this.#cancel(this.#active, { outcome: "canceled" });
|
|
84
|
+
this.#latestPending = false;
|
|
85
|
+
this.#latest = Promise.resolve({ outcome: "delivered" });
|
|
86
|
+
}
|
|
87
|
+
dispose() { this.#disposed = true; this.reset(); }
|
|
88
|
+
#drain() {
|
|
89
|
+
if (this.#active || this.#disposed || this.#quarantined)
|
|
90
|
+
return;
|
|
91
|
+
const request = this.#pending;
|
|
92
|
+
this.#pending = undefined;
|
|
93
|
+
if (!request || request.done)
|
|
94
|
+
return;
|
|
95
|
+
this.#active = request;
|
|
96
|
+
// Concurrency: render and input get an event-loop turn before child startup or source transfer.
|
|
97
|
+
setImmediate(() => {
|
|
98
|
+
if (request.done) {
|
|
99
|
+
this.#release(request);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let canceled = false;
|
|
103
|
+
let executor;
|
|
104
|
+
const run = request.before.then(async () => {
|
|
105
|
+
if (canceled || request.done || request.snapshot === undefined)
|
|
106
|
+
return { outcome: "canceled" };
|
|
107
|
+
this.#trace(request, "preparing");
|
|
108
|
+
executor = this.options.execute(request.snapshot, (phase, bytes, transport) => {
|
|
109
|
+
if (request.done)
|
|
110
|
+
return;
|
|
111
|
+
if (phase === "submitting")
|
|
112
|
+
request.submitting = true;
|
|
113
|
+
this.#trace(request, phase, { bytes, transport });
|
|
114
|
+
});
|
|
115
|
+
return executor.result;
|
|
116
|
+
}).catch(() => ({ outcome: "failed", failure: "transport" }));
|
|
117
|
+
// Concurrency: a canceled gate has not started any side effect. Do not wait for an unrelated prior prompt indefinitely.
|
|
118
|
+
let cancelGate;
|
|
119
|
+
const gateStopped = new Promise(resolve => { cancelGate = resolve; });
|
|
120
|
+
const stopped = Promise.race([
|
|
121
|
+
run.then(async () => { await executor?.stopped; }), gateStopped,
|
|
122
|
+
]);
|
|
123
|
+
request.job = { result: run, stopped, cancel: () => {
|
|
124
|
+
canceled = true;
|
|
125
|
+
if (executor)
|
|
126
|
+
executor.cancel();
|
|
127
|
+
else
|
|
128
|
+
cancelGate();
|
|
129
|
+
} };
|
|
130
|
+
void run.then(result => this.#settle(request, result));
|
|
131
|
+
void stopped.then(() => this.#release(request));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
#cancel(request, result) {
|
|
135
|
+
if (request.done)
|
|
136
|
+
return;
|
|
137
|
+
this.#settle(request, result);
|
|
138
|
+
request.job?.cancel();
|
|
139
|
+
if (this.#pending === request)
|
|
140
|
+
this.#pending = undefined;
|
|
141
|
+
if (this.#active === request && request.job) {
|
|
142
|
+
const cleanup = setTimeout(() => {
|
|
143
|
+
if (this.#active !== request)
|
|
144
|
+
return;
|
|
145
|
+
this.#quarantined = true;
|
|
146
|
+
this.#trace(request, "cleanup");
|
|
147
|
+
if (this.#pending)
|
|
148
|
+
this.#cancel(this.#pending, { outcome: "failed", failure: "unsafe" });
|
|
149
|
+
}, COPY_CLEANUP_MS);
|
|
150
|
+
cleanup.unref?.();
|
|
151
|
+
void request.job.stopped.then(() => clearTimeout(cleanup));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
#settle(request, result) {
|
|
155
|
+
if (request.done)
|
|
156
|
+
return;
|
|
157
|
+
request.done = true;
|
|
158
|
+
if (request.id === this.#sequence)
|
|
159
|
+
this.#latestPending = false;
|
|
160
|
+
request.snapshot = undefined;
|
|
161
|
+
clearTimeout(request.timer);
|
|
162
|
+
this.#trace(request, "settled", { outcome: result.outcome });
|
|
163
|
+
request.resolve(result);
|
|
164
|
+
if (!this.#disposed && request.epoch === this.#epoch && request.id === this.#sequence
|
|
165
|
+
&& (result.outcome === "failed" || result.outcome === "timed-out")) {
|
|
166
|
+
this.options.onFailure?.(result);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
#release(request) {
|
|
170
|
+
if (this.#active !== request)
|
|
171
|
+
return;
|
|
172
|
+
this.#active = undefined;
|
|
173
|
+
this.#quarantined = false;
|
|
174
|
+
this.#trace(request, "cleanup");
|
|
175
|
+
this.#drain();
|
|
176
|
+
}
|
|
177
|
+
#now() { return this.options.now?.() ?? performance.now(); }
|
|
178
|
+
#trace(request, phase, extra = {}) {
|
|
179
|
+
if (this.options.onEvent === undefined)
|
|
180
|
+
return;
|
|
181
|
+
const atMs = this.#now();
|
|
182
|
+
// Security: observations contain only bounded scalar metadata, never copied source or encoded content.
|
|
183
|
+
try {
|
|
184
|
+
this.options.onEvent({ request: request.id, phase, atMs, elapsedMs: atMs - request.admitted,
|
|
185
|
+
sourceUnits: request.sourceUnits, pending: Number(this.#active !== undefined) + Number(this.#pending !== undefined), ...extra });
|
|
186
|
+
}
|
|
187
|
+
catch { /* Invariant: diagnostics must not alter copy semantics. */ }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|