@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,472 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
5
|
+
export const RELEASE_COHORT_SCHEMA = PRODUCT_IDENTITY.protocol.releaseCohortSchema;
|
|
6
|
+
const RELEASE_ID_PATTERN = /^[0-9A-Za-z.+_-]+-[a-f0-9]{20}$/;
|
|
7
|
+
/**
|
|
8
|
+
* Derive protection exclusively from current selectors and ownership authorities.
|
|
9
|
+
* The historical retention snapshot is deliberately not an input to this plan.
|
|
10
|
+
*/
|
|
11
|
+
export function planProtectedReleases(state, inputs = {}) {
|
|
12
|
+
const holds = inputs.externalHolds ?? [];
|
|
13
|
+
for (const hold of holds) {
|
|
14
|
+
if (hold.authority !== "agent" && hold.authority !== "migration")
|
|
15
|
+
throw new Error(`unknown release hold authority: ${String(hold.authority)}`);
|
|
16
|
+
if (!state.releases[hold.releaseId] && !state.cleanup.pending[hold.releaseId]) {
|
|
17
|
+
throw new Error(`external ${hold.authority} hold names unknown release ${hold.releaseId}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const protectedIds = new Set();
|
|
21
|
+
for (const id of [state.references.active, state.references.pending, state.references.approved, state.references.rollback]) {
|
|
22
|
+
if (id !== null)
|
|
23
|
+
protectedIds.add(id);
|
|
24
|
+
}
|
|
25
|
+
for (const id of inputs.liveReleaseIds ?? [])
|
|
26
|
+
protectedIds.add(id);
|
|
27
|
+
for (const hold of holds)
|
|
28
|
+
protectedIds.add(hold.releaseId);
|
|
29
|
+
if (inputs.transaction?.status === "active" && inputs.transaction.priorActiveReleaseId !== null) {
|
|
30
|
+
protectedIds.add(inputs.transaction.priorActiveReleaseId);
|
|
31
|
+
}
|
|
32
|
+
const protectedReleaseIds = [...protectedIds].sort();
|
|
33
|
+
const known = Object.keys(state.releases).sort();
|
|
34
|
+
return {
|
|
35
|
+
protectedReleaseIds,
|
|
36
|
+
retainedReleaseIds: known.filter(id => protectedIds.has(id)),
|
|
37
|
+
collectibleReleaseIds: known.filter(id => !protectedIds.has(id)),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Serializes validated cohort-state revisions under a lock and commits each update atomically. */
|
|
41
|
+
export class CohortStateStore {
|
|
42
|
+
path;
|
|
43
|
+
constructor(dataDir) {
|
|
44
|
+
this.path = resolve(dataDir, "release-state.json");
|
|
45
|
+
}
|
|
46
|
+
async read() {
|
|
47
|
+
try {
|
|
48
|
+
const state = normalizeState(JSON.parse(await readFile(this.path, "utf8")));
|
|
49
|
+
validateState(state);
|
|
50
|
+
return state;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
54
|
+
return emptyState();
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async update(operation) {
|
|
59
|
+
await mkdir(dirname(this.path), { recursive: true, mode: 0o700 });
|
|
60
|
+
const lockPath = `${this.path}.lock`;
|
|
61
|
+
const lock = await acquireLock(lockPath);
|
|
62
|
+
try {
|
|
63
|
+
const current = await this.read();
|
|
64
|
+
const next = await operation(current);
|
|
65
|
+
validateTransition(current, next);
|
|
66
|
+
const committed = { ...next, revision: current.revision + 1 };
|
|
67
|
+
const temporary = `${this.path}.${process.pid}.${randomUUID()}.tmp`;
|
|
68
|
+
const file = await open(temporary, "wx", 0o600);
|
|
69
|
+
try {
|
|
70
|
+
await file.writeFile(JSON.stringify(committed, null, 2));
|
|
71
|
+
await file.sync();
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
await file.close();
|
|
75
|
+
}
|
|
76
|
+
await rename(temporary, this.path);
|
|
77
|
+
return committed;
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await lock.close();
|
|
81
|
+
await rm(lockPath, { force: true });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async recordCandidate(release) {
|
|
85
|
+
return await this.update(current => {
|
|
86
|
+
const existing = current.releases[release.releaseId];
|
|
87
|
+
const record = existing ?? {
|
|
88
|
+
releaseId: release.releaseId,
|
|
89
|
+
releaseRoot: release.releaseRoot,
|
|
90
|
+
packageVersion: release.packageVersion,
|
|
91
|
+
contentDigest: release.contentDigest,
|
|
92
|
+
...(release.launchContract === undefined ? {} : { launchContract: release.launchContract }),
|
|
93
|
+
approval: "candidate",
|
|
94
|
+
materializedAt: new Date().toISOString(),
|
|
95
|
+
certifiedAt: null,
|
|
96
|
+
diagnosticsPath: null,
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
...current,
|
|
100
|
+
releases: { ...current.releases, [release.releaseId]: record },
|
|
101
|
+
references: {
|
|
102
|
+
...current.references,
|
|
103
|
+
pending: current.references.active === release.releaseId ? current.references.pending : release.releaseId,
|
|
104
|
+
},
|
|
105
|
+
activation: activation("pending", "candidate awaits certification and safe activation"),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async approve(releaseId, diagnosticsPath) {
|
|
110
|
+
return await this.update(current => {
|
|
111
|
+
const release = requiredRelease(current, releaseId);
|
|
112
|
+
return {
|
|
113
|
+
...current,
|
|
114
|
+
releases: { ...current.releases, [releaseId]: { ...release, approval: "approved", certifiedAt: new Date().toISOString(), diagnosticsPath } },
|
|
115
|
+
references: { ...current.references, approved: releaseId, pending: current.references.active === releaseId ? null : releaseId },
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async activate(releaseId) {
|
|
120
|
+
return await this.update(current => {
|
|
121
|
+
const release = requiredRelease(current, releaseId);
|
|
122
|
+
if (release.approval !== "approved")
|
|
123
|
+
throw new Error(`cannot activate unverified release ${releaseId}`);
|
|
124
|
+
const prior = current.references.active;
|
|
125
|
+
return {
|
|
126
|
+
...current,
|
|
127
|
+
references: {
|
|
128
|
+
...current.references,
|
|
129
|
+
active: releaseId,
|
|
130
|
+
pending: null,
|
|
131
|
+
approved: releaseId,
|
|
132
|
+
rollback: prior && prior !== releaseId ? prior : current.references.rollback,
|
|
133
|
+
},
|
|
134
|
+
activation: activation("idle", null),
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async blockPending(reason, blockerGenerationIds) {
|
|
139
|
+
return await this.update(current => ({ ...current, activation: { ...activation("blocked", reason), blockerGenerationIds: [...blockerGenerationIds] } }));
|
|
140
|
+
}
|
|
141
|
+
async rollback(ownershipReleased) {
|
|
142
|
+
if (!ownershipReleased)
|
|
143
|
+
throw new Error("cannot roll back before current cohort ownership is released");
|
|
144
|
+
return await this.update(current => {
|
|
145
|
+
const rollbackId = current.references.rollback;
|
|
146
|
+
if (!rollbackId)
|
|
147
|
+
throw new Error("no rollback release is recorded");
|
|
148
|
+
const rollback = requiredRelease(current, rollbackId);
|
|
149
|
+
if (rollback.approval !== "approved")
|
|
150
|
+
throw new Error(`cannot roll back to unverified release ${rollbackId}`);
|
|
151
|
+
return {
|
|
152
|
+
...current,
|
|
153
|
+
references: {
|
|
154
|
+
...current.references,
|
|
155
|
+
active: rollbackId,
|
|
156
|
+
pending: null,
|
|
157
|
+
approved: rollbackId,
|
|
158
|
+
rollback: current.references.active,
|
|
159
|
+
},
|
|
160
|
+
activation: activation("idle", null),
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
async setRetention(releaseIds) {
|
|
165
|
+
return await this.update(current => {
|
|
166
|
+
for (const releaseId of releaseIds)
|
|
167
|
+
requiredRelease(current, releaseId);
|
|
168
|
+
return { ...current, references: { ...current.references, retention: unique(releaseIds) } };
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/** Atomically replace legacy retention history and detach every currently collectible record. */
|
|
172
|
+
async reconcileRetention(resolveInputs, orphans = []) {
|
|
173
|
+
let plan = null;
|
|
174
|
+
let detachedReleaseIds = [];
|
|
175
|
+
const state = await this.update(async (current) => {
|
|
176
|
+
const inputs = await resolveInputs(current);
|
|
177
|
+
plan = planProtectedReleases(current, inputs);
|
|
178
|
+
const nextReleases = { ...current.releases };
|
|
179
|
+
const pending = { ...current.cleanup.pending };
|
|
180
|
+
for (const releaseId of plan.collectibleReleaseIds) {
|
|
181
|
+
const release = nextReleases[releaseId];
|
|
182
|
+
pending[releaseId] ??= cleanupDisposition(release, "detached", null);
|
|
183
|
+
delete nextReleases[releaseId];
|
|
184
|
+
}
|
|
185
|
+
for (const orphan of orphans) {
|
|
186
|
+
const releaseId = orphan.release.releaseId;
|
|
187
|
+
if (nextReleases[releaseId] || pending[releaseId] || plan.protectedReleaseIds.includes(releaseId))
|
|
188
|
+
continue;
|
|
189
|
+
pending[releaseId] = cleanupDisposition(orphan.release, orphan.stage, orphan.trashPath ?? null);
|
|
190
|
+
}
|
|
191
|
+
detachedReleaseIds = plan.collectibleReleaseIds;
|
|
192
|
+
return {
|
|
193
|
+
...current,
|
|
194
|
+
releases: nextReleases,
|
|
195
|
+
references: { ...current.references, retention: plan.retainedReleaseIds },
|
|
196
|
+
cleanup: { ...current.cleanup, pending },
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
if (plan === null)
|
|
200
|
+
throw new Error("release retention reconciliation did not produce a plan");
|
|
201
|
+
return { state, plan, detachedReleaseIds };
|
|
202
|
+
}
|
|
203
|
+
async markCleanupTrash(releaseId, trashPath) {
|
|
204
|
+
return await this.update(current => {
|
|
205
|
+
const disposition = current.cleanup.pending[releaseId];
|
|
206
|
+
if (!disposition)
|
|
207
|
+
throw new Error(`release ${releaseId} has no cleanup disposition`);
|
|
208
|
+
return replaceCleanup(current, releaseId, { ...disposition, stage: "trash", trashPath, lastError: null });
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async recordCleanupFailure(releaseId, stage, error) {
|
|
212
|
+
return await this.update(current => {
|
|
213
|
+
const attemptedAt = new Date().toISOString();
|
|
214
|
+
const message = boundedError(error);
|
|
215
|
+
const disposition = current.cleanup.pending[releaseId];
|
|
216
|
+
const pending = disposition ? {
|
|
217
|
+
...current.cleanup.pending,
|
|
218
|
+
[releaseId]: { ...disposition, attempts: disposition.attempts + 1, lastAttemptAt: attemptedAt, lastError: message },
|
|
219
|
+
} : current.cleanup.pending;
|
|
220
|
+
return {
|
|
221
|
+
...current,
|
|
222
|
+
cleanup: {
|
|
223
|
+
...current.cleanup,
|
|
224
|
+
pending,
|
|
225
|
+
diagnostics: [...current.cleanup.diagnostics, { releaseId, stage, attemptedAt, error: message }].slice(-64),
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
async completeCleanup(releaseId) {
|
|
231
|
+
return await this.update(current => {
|
|
232
|
+
const pending = { ...current.cleanup.pending };
|
|
233
|
+
delete pending[releaseId];
|
|
234
|
+
return { ...current, cleanup: { ...current.cleanup, pending } };
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
async recordCleanupWorkerScheduled(runId) {
|
|
238
|
+
return await this.update(current => {
|
|
239
|
+
const scheduledAt = new Date().toISOString();
|
|
240
|
+
const run = {
|
|
241
|
+
runId,
|
|
242
|
+
status: "scheduled",
|
|
243
|
+
scheduledAt,
|
|
244
|
+
startedAt: null,
|
|
245
|
+
completedAt: null,
|
|
246
|
+
pid: null,
|
|
247
|
+
batches: 0,
|
|
248
|
+
attempted: 0,
|
|
249
|
+
completed: 0,
|
|
250
|
+
remaining: Object.keys(current.cleanup.pending).length,
|
|
251
|
+
error: null,
|
|
252
|
+
};
|
|
253
|
+
return { ...current, cleanup: { ...current.cleanup, workerRuns: [...current.cleanup.workerRuns, run].slice(-16) } };
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
async recordCleanupWorkerStarted(runId, pid) {
|
|
257
|
+
return await this.update(current => replaceCleanupWorkerRun(current, runId, existing => ({
|
|
258
|
+
...(existing ?? cleanupWorkerRun(runId, Object.keys(current.cleanup.pending).length)),
|
|
259
|
+
status: "running",
|
|
260
|
+
startedAt: new Date().toISOString(),
|
|
261
|
+
completedAt: null,
|
|
262
|
+
pid,
|
|
263
|
+
error: null,
|
|
264
|
+
})));
|
|
265
|
+
}
|
|
266
|
+
async recordCleanupWorkerProgress(runId, summary) {
|
|
267
|
+
return await this.update(current => replaceCleanupWorkerRun(current, runId, existing => ({
|
|
268
|
+
...(existing ?? cleanupWorkerRun(runId, summary.remaining)),
|
|
269
|
+
status: "running",
|
|
270
|
+
startedAt: existing?.startedAt ?? new Date().toISOString(),
|
|
271
|
+
pid: existing?.pid ?? process.pid,
|
|
272
|
+
...summary,
|
|
273
|
+
})));
|
|
274
|
+
}
|
|
275
|
+
async recordCleanupWorkerFinished(runId, status, summary, error = null) {
|
|
276
|
+
return await this.update(current => replaceCleanupWorkerRun(current, runId, existing => ({
|
|
277
|
+
...(existing ?? cleanupWorkerRun(runId, summary.remaining)),
|
|
278
|
+
status,
|
|
279
|
+
startedAt: existing?.startedAt ?? new Date().toISOString(),
|
|
280
|
+
completedAt: new Date().toISOString(),
|
|
281
|
+
pid: existing?.pid ?? process.pid,
|
|
282
|
+
...summary,
|
|
283
|
+
error: error === null ? null : boundedError(error),
|
|
284
|
+
})));
|
|
285
|
+
}
|
|
286
|
+
async removeUnreferencedRelease(releaseId, externalReferences) {
|
|
287
|
+
return await this.update(current => {
|
|
288
|
+
const release = requiredRelease(current, releaseId);
|
|
289
|
+
const protectedIds = new Set([
|
|
290
|
+
current.references.active,
|
|
291
|
+
current.references.pending,
|
|
292
|
+
current.references.approved,
|
|
293
|
+
current.references.rollback,
|
|
294
|
+
...current.references.retention,
|
|
295
|
+
...externalReferences,
|
|
296
|
+
].filter((value) => value !== null));
|
|
297
|
+
if (protectedIds.has(releaseId))
|
|
298
|
+
throw new Error(`release ${releaseId} is still referenced and cannot be collected`);
|
|
299
|
+
const releases = { ...current.releases };
|
|
300
|
+
delete releases[releaseId];
|
|
301
|
+
return {
|
|
302
|
+
...current,
|
|
303
|
+
releases,
|
|
304
|
+
cleanup: {
|
|
305
|
+
...current.cleanup,
|
|
306
|
+
pending: { ...current.cleanup.pending, [releaseId]: cleanupDisposition(release, "detached", null) },
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
export function emptyState() {
|
|
313
|
+
return {
|
|
314
|
+
schema: RELEASE_COHORT_SCHEMA,
|
|
315
|
+
revision: 0,
|
|
316
|
+
releases: {},
|
|
317
|
+
references: { active: null, pending: null, approved: null, rollback: null, retention: [] },
|
|
318
|
+
cleanup: { pending: {}, diagnostics: [], workerRuns: [] },
|
|
319
|
+
activation: activation("idle", null),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function cleanupDisposition(release, stage, trashPath) {
|
|
323
|
+
return { release, stage, trashPath, attempts: 0, lastAttemptAt: null, lastError: null };
|
|
324
|
+
}
|
|
325
|
+
function replaceCleanup(current, releaseId, disposition) {
|
|
326
|
+
return { ...current, cleanup: { ...current.cleanup, pending: { ...current.cleanup.pending, [releaseId]: disposition } } };
|
|
327
|
+
}
|
|
328
|
+
function cleanupWorkerRun(runId, remaining) {
|
|
329
|
+
return {
|
|
330
|
+
runId,
|
|
331
|
+
status: "scheduled",
|
|
332
|
+
scheduledAt: new Date().toISOString(),
|
|
333
|
+
startedAt: null,
|
|
334
|
+
completedAt: null,
|
|
335
|
+
pid: null,
|
|
336
|
+
batches: 0,
|
|
337
|
+
attempted: 0,
|
|
338
|
+
completed: 0,
|
|
339
|
+
remaining,
|
|
340
|
+
error: null,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function replaceCleanupWorkerRun(current, runId, operation) {
|
|
344
|
+
const existing = current.cleanup.workerRuns.find(run => run.runId === runId);
|
|
345
|
+
const workerRuns = existing
|
|
346
|
+
? current.cleanup.workerRuns.map(run => run.runId === runId ? operation(run) : run)
|
|
347
|
+
: [...current.cleanup.workerRuns, operation(undefined)];
|
|
348
|
+
return { ...current, cleanup: { ...current.cleanup, workerRuns: workerRuns.slice(-16) } };
|
|
349
|
+
}
|
|
350
|
+
function activation(state, reason) {
|
|
351
|
+
return { state, reason, blockerGenerationIds: [], updatedAt: new Date().toISOString() };
|
|
352
|
+
}
|
|
353
|
+
function requiredRelease(state, releaseId) {
|
|
354
|
+
const release = state.releases[releaseId];
|
|
355
|
+
if (!release)
|
|
356
|
+
throw new Error(`unknown release ${releaseId}`);
|
|
357
|
+
return release;
|
|
358
|
+
}
|
|
359
|
+
function unique(values) { return [...new Set(values)]; }
|
|
360
|
+
async function acquireLock(path) {
|
|
361
|
+
const deadline = Date.now() + 5_000;
|
|
362
|
+
while (true) {
|
|
363
|
+
try {
|
|
364
|
+
const lock = await open(path, "wx", 0o600);
|
|
365
|
+
await lock.writeFile(JSON.stringify({ pid: process.pid, createdAt: new Date().toISOString() }));
|
|
366
|
+
await lock.sync();
|
|
367
|
+
return lock;
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
371
|
+
throw error;
|
|
372
|
+
if (await reclaimAbandonedLock(path))
|
|
373
|
+
continue;
|
|
374
|
+
if (Date.now() >= deadline)
|
|
375
|
+
throw error;
|
|
376
|
+
await new Promise(resolvePromise => setTimeout(resolvePromise, 20));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
async function reclaimAbandonedLock(path) {
|
|
381
|
+
let abandoned = false;
|
|
382
|
+
try {
|
|
383
|
+
const value = JSON.parse(await readFile(path, "utf8"));
|
|
384
|
+
if (typeof value.pid === "number") {
|
|
385
|
+
try {
|
|
386
|
+
process.kill(value.pid, 0);
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
abandoned = !(error instanceof Error && "code" in error && error.code === "EPERM");
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
catch {
|
|
394
|
+
const metadata = await stat(path).catch(() => null);
|
|
395
|
+
abandoned = metadata !== null && Date.now() - metadata.mtimeMs > 10_000;
|
|
396
|
+
}
|
|
397
|
+
if (!abandoned)
|
|
398
|
+
return false;
|
|
399
|
+
const quarantine = `${path}.abandoned`;
|
|
400
|
+
const oldQuarantine = await stat(quarantine).catch(() => null);
|
|
401
|
+
if (oldQuarantine && Date.now() - oldQuarantine.mtimeMs > 10_000)
|
|
402
|
+
await rm(quarantine, { force: true });
|
|
403
|
+
try {
|
|
404
|
+
// Concurrency: the fixed destination lets exactly one waiter claim the stale lock;
|
|
405
|
+
// another waiter cannot accidentally rename a newly acquired replacement.
|
|
406
|
+
await rename(path, quarantine);
|
|
407
|
+
await rm(quarantine, { force: true });
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
catch {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
function normalizeState(value) {
|
|
415
|
+
if (!value || typeof value !== "object")
|
|
416
|
+
return value;
|
|
417
|
+
const state = value;
|
|
418
|
+
const cleanup = state.cleanup;
|
|
419
|
+
return {
|
|
420
|
+
...state,
|
|
421
|
+
cleanup: cleanup
|
|
422
|
+
? { ...cleanup, workerRuns: cleanup.workerRuns ?? [] }
|
|
423
|
+
: { pending: {}, diagnostics: [], workerRuns: [] },
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
function validateState(state) {
|
|
427
|
+
if (!state || state.schema !== RELEASE_COHORT_SCHEMA || !Number.isSafeInteger(state.revision) || state.revision < 0
|
|
428
|
+
|| !state.releases || typeof state.releases !== "object" || !state.references || !Array.isArray(state.references.retention)
|
|
429
|
+
|| !state.cleanup || typeof state.cleanup.pending !== "object" || !Array.isArray(state.cleanup.diagnostics)
|
|
430
|
+
|| !Array.isArray(state.cleanup.workerRuns)) {
|
|
431
|
+
throw new Error("invalid release cohort state");
|
|
432
|
+
}
|
|
433
|
+
for (const run of state.cleanup.workerRuns) {
|
|
434
|
+
if (!run || typeof run.runId !== "string" || run.runId.length === 0
|
|
435
|
+
|| !["scheduled", "running", "completed", "blocked", "continued", "failed", "skipped"].includes(run.status)
|
|
436
|
+
|| typeof run.scheduledAt !== "string" || (run.startedAt !== null && typeof run.startedAt !== "string")
|
|
437
|
+
|| (run.completedAt !== null && typeof run.completedAt !== "string") || (run.pid !== null && (!Number.isSafeInteger(run.pid) || run.pid < 1))
|
|
438
|
+
|| !Number.isSafeInteger(run.batches) || run.batches < 0 || !Number.isSafeInteger(run.attempted) || run.attempted < 0
|
|
439
|
+
|| !Number.isSafeInteger(run.completed) || run.completed < 0 || run.completed > run.attempted
|
|
440
|
+
|| !Number.isSafeInteger(run.remaining) || run.remaining < 0 || (run.error !== null && typeof run.error !== "string")) {
|
|
441
|
+
throw new Error("invalid release cleanup worker run");
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
for (const [releaseId, release] of Object.entries(state.releases))
|
|
445
|
+
validateReleaseRecord(releaseId, release);
|
|
446
|
+
for (const reference of [state.references.active, state.references.pending, state.references.approved, state.references.rollback]) {
|
|
447
|
+
if (reference !== null && !state.releases[reference])
|
|
448
|
+
throw new Error(`release reference points to an unknown release: ${reference}`);
|
|
449
|
+
}
|
|
450
|
+
for (const [releaseId, disposition] of Object.entries(state.cleanup.pending)) {
|
|
451
|
+
validateReleaseRecord(releaseId, disposition.release);
|
|
452
|
+
if (!["detached", "trash"].includes(disposition.stage))
|
|
453
|
+
throw new Error(`invalid cleanup disposition for ${releaseId}`);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function validateReleaseRecord(releaseId, release) {
|
|
457
|
+
if (release.releaseId !== releaseId || !RELEASE_ID_PATTERN.test(releaseId) || typeof release.releaseRoot !== "string"
|
|
458
|
+
|| typeof release.packageVersion !== "string" || !/^[a-f0-9]{64}$/.test(release.contentDigest)
|
|
459
|
+
|| !["candidate", "approved", "rejected"].includes(release.approval)) {
|
|
460
|
+
throw new Error(`invalid release record for ${releaseId}`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function validateTransition(current, next) {
|
|
464
|
+
validateState(next);
|
|
465
|
+
if (next.schema !== current.schema)
|
|
466
|
+
throw new Error("release cohort schema cannot change during a state update");
|
|
467
|
+
if (next.revision !== current.revision)
|
|
468
|
+
throw new Error("release cohort revision is controlled by the state store");
|
|
469
|
+
}
|
|
470
|
+
function boundedError(error) {
|
|
471
|
+
return (error instanceof Error ? error.message : String(error)).replace(/[\r\n]+/g, " ").slice(0, 1_000);
|
|
472
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface DependencyCertificationProtection {
|
|
2
|
+
readonly referenced: Set<string>;
|
|
3
|
+
readonly legacyRequired: Set<string>;
|
|
4
|
+
readonly uncertain: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Inspect retained and not-yet-collected release metadata, never dependency payload bytes. */
|
|
7
|
+
export declare function dependencyCertificationProtection(dataDir: string, retainedReleaseIds?: readonly string[]): Promise<DependencyCertificationProtection>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { lstat, readFile, readdir, realpath } from "node:fs/promises";
|
|
2
|
+
import { basename, resolve } from "node:path";
|
|
3
|
+
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
4
|
+
import { dependencyLayerCertificationPath } from "./dependency-certification.js";
|
|
5
|
+
import { RELEASE_MANIFEST_FILENAME } from "./release-store.js";
|
|
6
|
+
import { readRestartCertifiedRelease } from "./restart-certification.js";
|
|
7
|
+
/** Inspect retained and not-yet-collected release metadata, never dependency payload bytes. */
|
|
8
|
+
export async function dependencyCertificationProtection(dataDir, retainedReleaseIds = []) {
|
|
9
|
+
const referenced = new Set();
|
|
10
|
+
const legacyRequired = new Set();
|
|
11
|
+
const canonicalData = await realpath(dataDir);
|
|
12
|
+
const releasesRoot = resolve(canonicalData, "releases");
|
|
13
|
+
const roots = [];
|
|
14
|
+
let uncertain = false;
|
|
15
|
+
const rootMetadata = await lstat(releasesRoot);
|
|
16
|
+
if (!rootMetadata.isDirectory() || rootMetadata.isSymbolicLink())
|
|
17
|
+
return { referenced, legacyRequired, uncertain: true };
|
|
18
|
+
const entries = await readdir(releasesRoot, { withFileTypes: true });
|
|
19
|
+
for (const entry of entries) {
|
|
20
|
+
if (entry.isSymbolicLink()) {
|
|
21
|
+
uncertain = true;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!entry.isDirectory() || entry.name.startsWith(".candidate-"))
|
|
25
|
+
continue;
|
|
26
|
+
if (entry.name === ".trash") {
|
|
27
|
+
for (const trash of await readdir(resolve(releasesRoot, entry.name), { withFileTypes: true })) {
|
|
28
|
+
if (trash.isSymbolicLink())
|
|
29
|
+
uncertain = true;
|
|
30
|
+
else if (trash.isDirectory() && !trash.name.startsWith(".candidate"))
|
|
31
|
+
roots.push(resolve(releasesRoot, entry.name, trash.name));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else
|
|
35
|
+
roots.push(resolve(releasesRoot, entry.name));
|
|
36
|
+
}
|
|
37
|
+
const discoveredIds = new Set(roots.map(root => basename(root).split("--", 1)[0]));
|
|
38
|
+
if (retainedReleaseIds.some(id => !discoveredIds.has(id)))
|
|
39
|
+
uncertain = true;
|
|
40
|
+
for (const root of roots) {
|
|
41
|
+
try {
|
|
42
|
+
const manifestPath = resolve(root, RELEASE_MANIFEST_FILENAME);
|
|
43
|
+
const metadata = await lstat(manifestPath);
|
|
44
|
+
if (!metadata.isFile() || metadata.isSymbolicLink())
|
|
45
|
+
throw new Error("release manifest is not a regular file");
|
|
46
|
+
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
47
|
+
if (!manifest || !/^[0-9A-Za-z.+_-]+-[a-f0-9]{20}$/.test(manifest.releaseId)
|
|
48
|
+
|| (manifest.dependencyLayers !== undefined && !Array.isArray(manifest.dependencyLayers)))
|
|
49
|
+
throw new Error("invalid retained release manifest");
|
|
50
|
+
const seal = await canonicalConsumerSeal(canonicalData, manifest.releaseId, manifest.contentDigest);
|
|
51
|
+
for (const layer of manifest.dependencyLayers ?? []) {
|
|
52
|
+
if (!layer || !/^dependencies-[a-f0-9]{32}$/.test(layer.layerId))
|
|
53
|
+
throw new Error("invalid retained dependency reference");
|
|
54
|
+
referenced.add(layer.layerId);
|
|
55
|
+
const evidence = seal?.dependencyLayers.filter(item => item.layerId === layer.layerId);
|
|
56
|
+
if (evidence?.length !== 1 || evidence[0].contentDigest !== layer.contentDigest
|
|
57
|
+
|| evidence[0].certification?.path !== dependencyLayerCertificationPath(canonicalData, layer.layerId)) {
|
|
58
|
+
// Compatibility: an absent, legacy, or uncertain seal cannot prove canonical-only use.
|
|
59
|
+
legacyRequired.add(layer.layerId);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Security: an unreadable retained manifest might reference any layer; do not guess ownership.
|
|
65
|
+
uncertain = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return { referenced, legacyRequired, uncertain };
|
|
69
|
+
}
|
|
70
|
+
async function canonicalConsumerSeal(dataDir, releaseId, contentDigest) {
|
|
71
|
+
try {
|
|
72
|
+
const path = resolve(dataDir, `certification-${releaseId}.json`);
|
|
73
|
+
const metadata = await lstat(path);
|
|
74
|
+
if (!metadata.isFile() || metadata.isSymbolicLink() || (metadata.mode & 0o222) !== 0)
|
|
75
|
+
return null;
|
|
76
|
+
const document = JSON.parse(await readFile(path, "utf8"));
|
|
77
|
+
if (document.schema !== PRODUCT_IDENTITY.evidence.releaseCertificationSchema || document.releaseId !== releaseId
|
|
78
|
+
|| document.contentDigest !== contentDigest || !document.restartSeal)
|
|
79
|
+
return null;
|
|
80
|
+
// Security: path claims alone do not prove a canonical-only consumer. Reuse the bounded
|
|
81
|
+
// restart validator so stale, unsupported, or tampered seals conservatively retain legacy files.
|
|
82
|
+
await readRestartCertifiedRelease({ releaseId, contentDigest, releaseRoot: resolve(dataDir, "releases", releaseId) }, dataDir);
|
|
83
|
+
return document.restartSeal;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const DEPENDENCY_CERTIFICATIONS_DIRECTORY = "dependency-certifications";
|
|
2
|
+
type LayerIdentity = {
|
|
3
|
+
readonly layerId: string;
|
|
4
|
+
readonly contentDigest: string;
|
|
5
|
+
};
|
|
6
|
+
export interface ReadDependencyCertificationOptions {
|
|
7
|
+
/** Only authenticated parent-started supervisors may upgrade missing platform evidence. */
|
|
8
|
+
readonly allowLegacyParentCertification?: boolean;
|
|
9
|
+
/** Cleanup must validate canonical evidence without migrating or falling back. */
|
|
10
|
+
readonly canonicalOnly?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Derive the canonical record path without accepting path components as layer identities. */
|
|
13
|
+
export declare function dependencyLayerCertificationPath(dataDir: string, layerId: string): string;
|
|
14
|
+
/** Keep the historical filename solely for compatibility reads and managed cleanup. */
|
|
15
|
+
export declare function legacyDependencyLayerCertificationPath(dataDir: string, layerId: string): string;
|
|
16
|
+
/** Validate the dedicated directory before reading, creating, or deleting any contained record. */
|
|
17
|
+
export declare function dependencyCertificationDirectory(dataDir: string, create?: boolean): Promise<string | null>;
|
|
18
|
+
/** Resolve only direct regular managed records; callers never follow directory or record links. */
|
|
19
|
+
export declare function managedDependencyCertificationPath(dataDir: string, layerId: string, legacy?: boolean): Promise<string | null>;
|
|
20
|
+
/** Prefer canonical evidence; copy validated legacy evidence without changing its sealed source. */
|
|
21
|
+
export declare function readDependencyCertification(dataDir: string, identity: LayerIdentity, options?: ReadDependencyCertificationOptions): Promise<void>;
|
|
22
|
+
/** Publish certification after materialization/full verification, preserving an already-valid winner. */
|
|
23
|
+
export declare function writeDependencyCertification(dataDir: string, identity: LayerIdentity): Promise<void>;
|
|
24
|
+
export {};
|