@timurproko/a1 0.1.8-dev.3b54f21 → 0.1.8-dev.402
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/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 +124 -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,223 @@
|
|
|
1
|
+
import { DatabaseSync } from "node:sqlite";
|
|
2
|
+
import { chmodSync, closeSync, lstatSync, mkdirSync, openSync, statSync } from "node:fs";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import { PRODUCT_IDENTITY } from "../../product-identity.js";
|
|
5
|
+
import { assertPromptHistorySubmission, PROMPT_HISTORY_MAX_ENTRY_BYTES, PROMPT_HISTORY_MAX_TEXT_BYTES } from "../../contracts/owned-ui/index.js";
|
|
6
|
+
import { collectImageChipIdentifiers, PromptImageSidecar } from "./image-sidecar.js";
|
|
7
|
+
export class HistoryStorageError extends Error {
|
|
8
|
+
code;
|
|
9
|
+
certainty;
|
|
10
|
+
constructor(code, certainty = "uncommitted") {
|
|
11
|
+
super(`Prompt history ${code}`);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.certainty = certainty;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const MAX_STORAGE_BYTES = 64 * 1024 * 1024;
|
|
17
|
+
export class PromptHistoryStore {
|
|
18
|
+
path;
|
|
19
|
+
profileId;
|
|
20
|
+
#database;
|
|
21
|
+
#sidecar;
|
|
22
|
+
constructor(path, profileId, limit, imagesDir) {
|
|
23
|
+
this.path = path;
|
|
24
|
+
this.profileId = profileId;
|
|
25
|
+
if (!Number.isInteger(limit) || limit < 10 || limit > 100 || limit % 10 !== 0)
|
|
26
|
+
throw new HistoryStorageError("schema");
|
|
27
|
+
this.#sidecar = imagesDir === undefined ? undefined : new PromptImageSidecar(imagesDir);
|
|
28
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
29
|
+
if (lstatSync(dirname(path)).isSymbolicLink())
|
|
30
|
+
throw new HistoryStorageError("unavailable");
|
|
31
|
+
if (process.platform !== "win32")
|
|
32
|
+
chmodSync(dirname(path), 0o700);
|
|
33
|
+
try {
|
|
34
|
+
closeSync(openSync(path, "wx", 0o600));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
if (lstatSync(path).isSymbolicLink() || !lstatSync(path).isFile())
|
|
41
|
+
throw new HistoryStorageError("unavailable");
|
|
42
|
+
if (process.platform !== "win32")
|
|
43
|
+
chmodSync(path, 0o600);
|
|
44
|
+
this.#checkSize();
|
|
45
|
+
this.#database = new DatabaseSync(path);
|
|
46
|
+
try {
|
|
47
|
+
this.#database.exec("PRAGMA busy_timeout = 25");
|
|
48
|
+
this.#transaction(() => {
|
|
49
|
+
const version = Number(this.#database.prepare("PRAGMA user_version").get()?.user_version);
|
|
50
|
+
if (version === 0) {
|
|
51
|
+
const tables = this.#database.prepare("SELECT name FROM sqlite_master WHERE type='table'").all();
|
|
52
|
+
if (tables.length !== 0)
|
|
53
|
+
throw new HistoryStorageError("schema");
|
|
54
|
+
this.#database.exec(`CREATE TABLE history_meta (id INTEGER PRIMARY KEY CHECK(id=1), schema TEXT NOT NULL, profile TEXT NOT NULL, revision INTEGER NOT NULL, limit_count INTEGER NOT NULL);
|
|
55
|
+
CREATE TABLE prompts (text TEXT PRIMARY KEY COLLATE BINARY, submission_id TEXT NOT NULL, sequence INTEGER NOT NULL UNIQUE, timestamp INTEGER NOT NULL, kind TEXT NOT NULL, cwd TEXT, session_id TEXT, bytes INTEGER NOT NULL CHECK(bytes>0 AND bytes<=1048576));
|
|
56
|
+
PRAGMA user_version=1;`);
|
|
57
|
+
this.#database.prepare("INSERT INTO history_meta VALUES (1,?,?,0,?)").run(PRODUCT_IDENTITY.protocol.promptHistorySchema, profileId, limit);
|
|
58
|
+
}
|
|
59
|
+
else if (version !== 1)
|
|
60
|
+
throw new HistoryStorageError("schema");
|
|
61
|
+
const meta = this.#database.prepare("SELECT schema,profile FROM history_meta WHERE id=1").get();
|
|
62
|
+
if (meta?.schema !== PRODUCT_IDENTITY.protocol.promptHistorySchema || meta?.profile !== profileId)
|
|
63
|
+
throw new HistoryStorageError("schema");
|
|
64
|
+
this.#database.prepare("UPDATE history_meta SET limit_count=?,revision=revision+1 WHERE id=1").run(limit);
|
|
65
|
+
this.#prune(limit);
|
|
66
|
+
});
|
|
67
|
+
this.#database.exec("PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL; PRAGMA wal_autocheckpoint=128; PRAGMA journal_size_limit=8388608; PRAGMA max_page_count=8192;");
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.#database.close();
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
// Rationale: opportunistically reclaim any sidecar whose row was pruned in a prior process
|
|
74
|
+
// crash or by another concurrent opener. Bounded by the number of files on disk minus the
|
|
75
|
+
// surviving reference set; failures are swallowed to preserve honest history behavior.
|
|
76
|
+
this.#sweepOrphanedSidecars();
|
|
77
|
+
}
|
|
78
|
+
record(input) {
|
|
79
|
+
assertPromptHistorySubmission(input);
|
|
80
|
+
const bytes = Buffer.byteLength(input.text);
|
|
81
|
+
if (bytes > PROMPT_HISTORY_MAX_ENTRY_BYTES)
|
|
82
|
+
throw new HistoryStorageError("oversized");
|
|
83
|
+
this.#checkSize(true);
|
|
84
|
+
this.#transaction(() => {
|
|
85
|
+
const duplicate = this.#database.prepare("SELECT submission_id FROM prompts WHERE text=?").get(input.text);
|
|
86
|
+
if (duplicate?.submission_id === input.id)
|
|
87
|
+
return;
|
|
88
|
+
this.#database.exec("UPDATE history_meta SET revision=revision+1 WHERE id=1");
|
|
89
|
+
const meta = this.#database.prepare("SELECT revision,limit_count FROM history_meta WHERE id=1").get();
|
|
90
|
+
this.#database.prepare(`INSERT INTO prompts VALUES (?,?,?,?,?,?,?,?) ON CONFLICT(text) DO UPDATE SET submission_id=excluded.submission_id,sequence=excluded.sequence,timestamp=excluded.timestamp,kind=excluded.kind,cwd=excluded.cwd,session_id=excluded.session_id,bytes=excluded.bytes`)
|
|
91
|
+
.run(input.text, input.id, meta.revision, input.timestamp, input.kind, bounded(input.cwd, 8192), bounded(input.sessionId, 256), bytes);
|
|
92
|
+
this.#prune(Number(meta.limit_count));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
snapshot() {
|
|
96
|
+
this.#database.exec("BEGIN");
|
|
97
|
+
try {
|
|
98
|
+
const meta = this.#database.prepare("SELECT revision,limit_count FROM history_meta WHERE id=1").get();
|
|
99
|
+
const entries = this.#database.prepare("SELECT text,submission_id FROM prompts ORDER BY sequence DESC LIMIT 100").all();
|
|
100
|
+
let bytes = 0;
|
|
101
|
+
const result = entries.map(row => {
|
|
102
|
+
if (typeof row.text !== "string" || typeof row.submission_id !== "string")
|
|
103
|
+
throw new HistoryStorageError("corrupt");
|
|
104
|
+
bytes += Buffer.byteLength(row.text);
|
|
105
|
+
if (bytes > PROMPT_HISTORY_MAX_TEXT_BYTES)
|
|
106
|
+
throw new HistoryStorageError("corrupt");
|
|
107
|
+
return { text: row.text, submissionId: row.submission_id };
|
|
108
|
+
});
|
|
109
|
+
this.#database.exec("COMMIT");
|
|
110
|
+
return { revision: Number(meta.revision), limit: Number(meta.limit_count), entries: result };
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.#database.exec("ROLLBACK");
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
close() { this.#database.close(); }
|
|
118
|
+
#transaction(work) {
|
|
119
|
+
try {
|
|
120
|
+
this.#database.exec("BEGIN IMMEDIATE");
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new HistoryStorageError(classifyHistoryError(error), "uncommitted");
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
work();
|
|
127
|
+
this.#database.exec("COMMIT");
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
// Invariant: only a successful rollback proves that replay cannot advance recency twice.
|
|
131
|
+
try {
|
|
132
|
+
this.#database.exec("ROLLBACK");
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
throw new HistoryStorageError(classifyHistoryError(error), "unknown");
|
|
136
|
+
}
|
|
137
|
+
throw new HistoryStorageError(classifyHistoryError(error), "uncommitted");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
#prune(limit) {
|
|
141
|
+
const rows = this.#database.prepare("SELECT sequence,bytes FROM prompts ORDER BY sequence DESC").all();
|
|
142
|
+
let bytes = 0;
|
|
143
|
+
const dropped = [];
|
|
144
|
+
for (const [index, row] of rows.entries()) {
|
|
145
|
+
bytes += Number(row.bytes);
|
|
146
|
+
if (index >= limit || bytes > PROMPT_HISTORY_MAX_TEXT_BYTES)
|
|
147
|
+
dropped.push(row.sequence);
|
|
148
|
+
}
|
|
149
|
+
if (dropped.length === 0)
|
|
150
|
+
return;
|
|
151
|
+
// Invariant: sidecar reap uses text still referenced by SURVIVING rows so a row still
|
|
152
|
+
// referencing an id shared with a pruned row keeps the file. Collect surviving ids before
|
|
153
|
+
// deleting so a concurrent snapshot cannot see a live row whose sidecar is already gone.
|
|
154
|
+
const droppedTexts = dropped.map(sequence => this.#database.prepare("SELECT text FROM prompts WHERE sequence=?").get(sequence)?.text).filter((value) => typeof value === "string");
|
|
155
|
+
for (const sequence of dropped)
|
|
156
|
+
this.#database.prepare("DELETE FROM prompts WHERE sequence=?").run(sequence);
|
|
157
|
+
if (this.#sidecar === undefined)
|
|
158
|
+
return;
|
|
159
|
+
const survivingIds = this.#collectReferencedIdentifiers();
|
|
160
|
+
for (const text of droppedTexts) {
|
|
161
|
+
for (const id of collectImageChipIdentifiers(text)) {
|
|
162
|
+
if (!survivingIds.has(id))
|
|
163
|
+
this.#sidecar.unlink(id);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
#collectReferencedIdentifiers() {
|
|
168
|
+
const identifiers = new Set();
|
|
169
|
+
const rows = this.#database.prepare("SELECT text FROM prompts").all();
|
|
170
|
+
for (const row of rows) {
|
|
171
|
+
if (typeof row.text !== "string")
|
|
172
|
+
continue;
|
|
173
|
+
for (const id of collectImageChipIdentifiers(row.text))
|
|
174
|
+
identifiers.add(id);
|
|
175
|
+
}
|
|
176
|
+
return identifiers;
|
|
177
|
+
}
|
|
178
|
+
#sweepOrphanedSidecars() {
|
|
179
|
+
if (this.#sidecar === undefined)
|
|
180
|
+
return;
|
|
181
|
+
try {
|
|
182
|
+
this.#sidecar.sweep(this.#collectReferencedIdentifiers());
|
|
183
|
+
}
|
|
184
|
+
catch { /* Rationale: sidecar sweep never blocks history readiness. */ }
|
|
185
|
+
}
|
|
186
|
+
#checkSize(maintain = false) {
|
|
187
|
+
let size = 0;
|
|
188
|
+
for (const suffix of ["", "-wal", "-shm"]) {
|
|
189
|
+
try {
|
|
190
|
+
if (lstatSync(this.path + suffix).isSymbolicLink())
|
|
191
|
+
throw new HistoryStorageError("unavailable");
|
|
192
|
+
size += statSync(this.path + suffix).size;
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (size > MAX_STORAGE_BYTES && maintain) {
|
|
200
|
+
this.#database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
201
|
+
this.#checkSize();
|
|
202
|
+
}
|
|
203
|
+
else if (size > MAX_STORAGE_BYTES)
|
|
204
|
+
throw new HistoryStorageError("capacity");
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function bounded(value, bytes) {
|
|
208
|
+
return value !== undefined && Buffer.byteLength(value) <= bytes ? value : null;
|
|
209
|
+
}
|
|
210
|
+
export function classifyHistoryError(error) {
|
|
211
|
+
if (error instanceof HistoryStorageError)
|
|
212
|
+
return error.code;
|
|
213
|
+
if (error instanceof Error && "errcode" in error) {
|
|
214
|
+
const code = Number(error.errcode) & 0xff;
|
|
215
|
+
if (code === 5 || code === 6)
|
|
216
|
+
return "busy";
|
|
217
|
+
if (code === 11 || code === 26)
|
|
218
|
+
return "corrupt";
|
|
219
|
+
if (code === 13)
|
|
220
|
+
return "capacity";
|
|
221
|
+
}
|
|
222
|
+
return "unavailable";
|
|
223
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
2
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
3
|
+
import { HistoryStorageError, PromptHistoryStore, classifyHistoryError } from "./store.js";
|
|
4
|
+
const port = parentPort;
|
|
5
|
+
if (port !== null) {
|
|
6
|
+
let store;
|
|
7
|
+
let chain = Promise.resolve();
|
|
8
|
+
const options = workerData;
|
|
9
|
+
const open = retry(() => { store = new PromptHistoryStore(options.path, options.profileId, options.limit, options.imagesDir); });
|
|
10
|
+
void open.then(() => port.postMessage({ id: 0, ok: true }), error => port.postMessage({ id: 0, ok: false, code: classifyHistoryError(error) }));
|
|
11
|
+
port.on("message", (request) => {
|
|
12
|
+
chain = chain.then(async () => {
|
|
13
|
+
try {
|
|
14
|
+
await open;
|
|
15
|
+
if (request.kind === "close") {
|
|
16
|
+
store.close();
|
|
17
|
+
port.postMessage({ id: request.id, ok: true });
|
|
18
|
+
port.close();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const value = await retry(() => request.kind === "record" ? store.record(request.submission) : store.snapshot());
|
|
22
|
+
port.postMessage({ id: request.id, ok: true, value });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
port.postMessage({ id: request.id, ok: false, code: classifyHistoryError(error),
|
|
26
|
+
certainty: error instanceof HistoryStorageError ? error.certainty : "unknown" });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async function retry(operation) {
|
|
32
|
+
const deadline = performance.now() + 1000;
|
|
33
|
+
for (;;) {
|
|
34
|
+
try {
|
|
35
|
+
return operation();
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (classifyHistoryError(error) !== "busy"
|
|
39
|
+
|| error instanceof HistoryStorageError && error.certainty === "unknown"
|
|
40
|
+
|| performance.now() >= deadline)
|
|
41
|
+
throw error;
|
|
42
|
+
await delay(25);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SuggestionDiagnosticObserver, type SuggestionDiagnosticRecord } from "../../contracts/owned-ui/index.js";
|
|
2
|
+
export interface SuggestionDiagnosticCaptureOptions {
|
|
3
|
+
readonly enabled?: boolean;
|
|
4
|
+
/** Explicit local destination, or an injected sink for deterministic I/O tests. */
|
|
5
|
+
readonly destination?: string;
|
|
6
|
+
readonly writeSnapshot?: (snapshot: string) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/** Bounded metadata snapshots; one in-flight write and one replaceable latest snapshot. */
|
|
9
|
+
export declare class SuggestionDiagnosticCapture implements SuggestionDiagnosticObserver {
|
|
10
|
+
#private;
|
|
11
|
+
readonly options: SuggestionDiagnosticCaptureOptions;
|
|
12
|
+
constructor(options?: SuggestionDiagnosticCaptureOptions);
|
|
13
|
+
record(record: SuggestionDiagnosticRecord): void;
|
|
14
|
+
snapshot(): readonly SuggestionDiagnosticRecord[];
|
|
15
|
+
/** Explicit evidence boundary, never awaited by input or rendering. */
|
|
16
|
+
flush(): Promise<void>;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import { SUGGESTION_DECISION_REASONS, SUGGESTION_DIAGNOSTIC_EVENTS, } from "../../contracts/owned-ui/index.js";
|
|
3
|
+
/** Bounded metadata snapshots; one in-flight write and one replaceable latest snapshot. */
|
|
4
|
+
export class SuggestionDiagnosticCapture {
|
|
5
|
+
options;
|
|
6
|
+
#records = [];
|
|
7
|
+
#pending;
|
|
8
|
+
#writing;
|
|
9
|
+
#disposed = false;
|
|
10
|
+
#write;
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.#write = options.writeSnapshot ?? (options.destination === undefined ? undefined
|
|
14
|
+
: snapshot => writeFile(options.destination, snapshot, { encoding: "utf8", mode: 0o600 }));
|
|
15
|
+
}
|
|
16
|
+
record(record) {
|
|
17
|
+
if (!this.options.enabled || this.#disposed)
|
|
18
|
+
return;
|
|
19
|
+
const safe = sanitize(record);
|
|
20
|
+
if (safe === null)
|
|
21
|
+
return;
|
|
22
|
+
this.#records.push(safe);
|
|
23
|
+
if (this.#records.length > 128)
|
|
24
|
+
this.#records.shift();
|
|
25
|
+
let snapshot = this.#serialize();
|
|
26
|
+
while (Buffer.byteLength(snapshot, "utf8") > 65_536) {
|
|
27
|
+
this.#records.shift();
|
|
28
|
+
snapshot = this.#serialize();
|
|
29
|
+
}
|
|
30
|
+
if (this.#write) {
|
|
31
|
+
this.#pending = snapshot;
|
|
32
|
+
this.#pump();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
snapshot() { return this.#records.map(record => ({ ...record })); }
|
|
36
|
+
/** Explicit evidence boundary, never awaited by input or rendering. */
|
|
37
|
+
async flush() {
|
|
38
|
+
while (this.#writing)
|
|
39
|
+
await this.#writing;
|
|
40
|
+
}
|
|
41
|
+
dispose() {
|
|
42
|
+
this.#disposed = true;
|
|
43
|
+
this.#records = [];
|
|
44
|
+
this.#pending = undefined;
|
|
45
|
+
}
|
|
46
|
+
#serialize() { return JSON.stringify({ schema: "prompt-suggestion-diagnostics-v1", records: this.#records }); }
|
|
47
|
+
#pump() {
|
|
48
|
+
if (this.#writing || this.#pending === undefined || !this.#write || this.#disposed)
|
|
49
|
+
return;
|
|
50
|
+
const snapshot = this.#pending;
|
|
51
|
+
this.#pending = undefined;
|
|
52
|
+
this.#writing = Promise.resolve().then(() => this.#write(snapshot)).catch(() => {
|
|
53
|
+
// Security: do not retain or display raw filesystem/provider errors.
|
|
54
|
+
}).finally(() => {
|
|
55
|
+
this.#writing = undefined;
|
|
56
|
+
this.#pump();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function sanitize(record) {
|
|
61
|
+
if (!SUGGESTION_DIAGNOSTIC_EVENTS.includes(record.event))
|
|
62
|
+
return null;
|
|
63
|
+
const reasoning = ["ordinary", "off", "minimal", "low", "medium", "high", "xhigh", "max", "unavailable"].includes(record.reasoning)
|
|
64
|
+
? record.reasoning : "unavailable";
|
|
65
|
+
const reason = record.reason !== undefined && SUGGESTION_DECISION_REASONS.includes(record.reason) ? record.reason : undefined;
|
|
66
|
+
// Security: explicit projection prevents arbitrary extra fields, including raw error payloads, from escaping.
|
|
67
|
+
return {
|
|
68
|
+
event: record.event, ...(reason === undefined ? {} : { reason }),
|
|
69
|
+
session: boundedNumber(record.session), run: boundedNumber(record.run), response: boundedNumber(record.response),
|
|
70
|
+
request: boundedNumber(record.request), provider: identifier(record.provider), model: identifier(record.model),
|
|
71
|
+
reasoning, elapsedMs: boundedNumber(record.elapsedMs),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function boundedNumber(value) {
|
|
75
|
+
return Number.isFinite(value) ? Math.min(Number.MAX_SAFE_INTEGER, Math.max(0, Math.floor(value))) : 0;
|
|
76
|
+
}
|
|
77
|
+
function identifier(value) {
|
|
78
|
+
// Security: identifiers are metadata, not display names or arbitrary JSON. Reject controls/path-shaped values.
|
|
79
|
+
if (typeof value !== "string" || /[\p{C}\\\s]/u.test(value) || value.includes(":") || value.startsWith("/"))
|
|
80
|
+
return "redacted";
|
|
81
|
+
return value.slice(0, 64);
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./diagnostics.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./diagnostics.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ManagedAgentDescriptor } from "../../
|
|
1
|
+
import type { ManagedAgentDescriptor } from "../../contracts/workspace/index.js";
|
|
2
2
|
export type WorkspaceCapabilityAction = {
|
|
3
3
|
readonly type: "structured-command";
|
|
4
4
|
readonly command: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ManagedAgentDescriptor } from "../../
|
|
1
|
+
import { type ManagedAgentDescriptor } from "../../contracts/workspace/index.js";
|
|
2
2
|
export interface WorkspaceAgentFailure {
|
|
3
3
|
readonly code: string;
|
|
4
4
|
readonly message: string;
|
|
@@ -23,6 +23,7 @@ export type WorkspaceReducerResult<T = undefined> = {
|
|
|
23
23
|
readonly code: string;
|
|
24
24
|
readonly diagnostic: string;
|
|
25
25
|
};
|
|
26
|
+
/** Applies validated workspace mutations and advances the revision only when observable state changes. */
|
|
26
27
|
export declare class WorkspaceReducer {
|
|
27
28
|
#private;
|
|
28
29
|
readonly workspaceId: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { assertManagedAgentDescriptor, } from "../../
|
|
1
|
+
import { assertManagedAgentDescriptor, } from "../../contracts/workspace/index.js";
|
|
2
2
|
const REMOVABLE_STATES = new Set(["stopped", "failed", "discontinuous"]);
|
|
3
|
+
/** Applies validated workspace mutations and advances the revision only when observable state changes. */
|
|
3
4
|
export class WorkspaceReducer {
|
|
4
5
|
workspaceId;
|
|
5
6
|
#agents = new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StructuredCommandRecord } from "../../foundation/structured-agent-runtime/index.js";
|
|
2
|
-
import type { ManagedAgentDescriptor } from "../../
|
|
2
|
+
import type { ManagedAgentDescriptor } from "../../contracts/workspace/index.js";
|
|
3
3
|
import { WorkspaceReducer, type WorkspaceAgentState, type WorkspaceView } from "./reducer.js";
|
|
4
4
|
export interface RoutedStructuredCommand {
|
|
5
5
|
readonly agentId: string;
|
|
@@ -16,6 +16,7 @@ export type WorkspaceRouterResult<T = undefined> = {
|
|
|
16
16
|
readonly code: string;
|
|
17
17
|
readonly diagnostic: string;
|
|
18
18
|
};
|
|
19
|
+
/** Serializes workspace actions and capability-gates structured commands at the selected-agent boundary. */
|
|
19
20
|
export declare class WorkspaceRouter {
|
|
20
21
|
#private;
|
|
21
22
|
readonly reducer: WorkspaceReducer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StructuredCommandTracker, } from "../../foundation/structured-agent-runtime/index.js";
|
|
2
2
|
import { gateWorkspaceAction } from "./capabilities.js";
|
|
3
3
|
import { WorkspaceReducer } from "./reducer.js";
|
|
4
|
+
/** Serializes workspace actions and capability-gates structured commands at the selected-agent boundary. */
|
|
4
5
|
export class WorkspaceRouter {
|
|
5
6
|
reducer;
|
|
6
7
|
#trackers = new Map();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AgentRecoveryAuthority, RecoveryReferenceId } from "../../
|
|
1
|
+
import type { AgentRecoveryAuthority, RecoveryReferenceId } from "../../contracts/workspace/index.js";
|
|
2
2
|
import { WorkspaceReducer, type WorkspaceView } from "./reducer.js";
|
|
3
|
+
/** Persists complete workspace views and recovery references through the control-store boundary. */
|
|
3
4
|
export declare class WorkspaceStore {
|
|
4
5
|
#private;
|
|
5
6
|
constructor(path: string);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ControlStore, DEFAULT_WORKSPACE_ID, } from "../../foundation/storage/index.js";
|
|
2
2
|
import { WorkspaceReducer } from "./reducer.js";
|
|
3
|
+
/** Persists complete workspace views and recovery references through the control-store boundary. */
|
|
3
4
|
export class WorkspaceStore {
|
|
4
5
|
#store;
|
|
5
6
|
constructor(path) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** The contract this build emits; supersedes the pre-cutover key set it still accepts. */
|
|
2
|
+
export declare const PRIVATE_LAUNCH_CONTRACT = "neutral-launch-v1";
|
|
3
|
+
export declare const PRIVATE_ENVIRONMENT: Readonly<{
|
|
4
|
+
releaseRoot: "LAUNCH_CONTEXT_RELEASE_ROOT";
|
|
5
|
+
releaseId: "LAUNCH_CONTEXT_RELEASE_ID";
|
|
6
|
+
releaseDigest: "LAUNCH_CONTEXT_RELEASE_DIGEST";
|
|
7
|
+
releaseLayers: "LAUNCH_CONTEXT_RELEASE_LAYERS";
|
|
8
|
+
launchProfile: "LAUNCH_CONTEXT_PROFILE";
|
|
9
|
+
immutableWarmup: "LAUNCH_CONTEXT_WARMUP";
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Keys published by releases that predate the neutral cutover. They are read when
|
|
13
|
+
* an older launcher hands this build a process, and written when this build
|
|
14
|
+
* starts a release that declares no contract of its own, so an upgrade never
|
|
15
|
+
* depends on both sides having been rebuilt at the same moment.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SUPERSEDED_ENVIRONMENT: Readonly<{
|
|
18
|
+
releaseRoot: "A1_RELEASE_ROOT";
|
|
19
|
+
releaseId: "A1_RELEASE_ID";
|
|
20
|
+
releaseDigest: "A1_RELEASE_DIGEST";
|
|
21
|
+
releaseLayers: "A1_RELEASE_LAYERS";
|
|
22
|
+
launchProfile: "A1_LAUNCH_PROFILE";
|
|
23
|
+
immutableWarmup: "A1_IMMUTABLE_WARMUP";
|
|
24
|
+
}>;
|
|
25
|
+
/** A release either declares the current contract or predates contract declaration. */
|
|
26
|
+
export type LaunchContractTarget = typeof PRIVATE_LAUNCH_CONTRACT | "superseded";
|
|
27
|
+
export interface LaunchContext {
|
|
28
|
+
readonly releaseRoot?: string;
|
|
29
|
+
readonly releaseId?: string;
|
|
30
|
+
readonly releaseDigest?: string;
|
|
31
|
+
readonly releaseLayers?: string;
|
|
32
|
+
readonly launchProfile?: "a1" | "pi";
|
|
33
|
+
readonly immutableWarmup?: "1";
|
|
34
|
+
}
|
|
35
|
+
export type LaunchContextRequirement = "optional" | "profile" | "release" | "warmup";
|
|
36
|
+
/** Read current keys, fall back to superseded keys per field, with bounded diagnostics. */
|
|
37
|
+
export declare function readLaunchContext(environment: NodeJS.ProcessEnv, requirement?: LaunchContextRequirement, platform?: NodeJS.Platform): LaunchContext;
|
|
38
|
+
/** The key set a process started for this release must receive. */
|
|
39
|
+
export declare function launchEnvironmentKeys(contract: LaunchContractTarget): Readonly<Record<string, string>>;
|
|
40
|
+
/** Classify metadata by the contract it declares rather than rejecting what it omits. */
|
|
41
|
+
export declare function launchContractTarget(value: {
|
|
42
|
+
readonly launchContract?: unknown;
|
|
43
|
+
}): LaunchContractTarget;
|
|
44
|
+
/** Whether metadata was produced by a build that declares this contract. */
|
|
45
|
+
export declare function isCurrentLaunchContract(value: {
|
|
46
|
+
readonly launchContract?: unknown;
|
|
47
|
+
}): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Rebuild owned context without inheriting a prior session's private selection. The
|
|
50
|
+
* contract selects which key set is written, so this build can start either its
|
|
51
|
+
* own releases or a retained pre-cutover release it must keep serving.
|
|
52
|
+
*/
|
|
53
|
+
export declare function withLaunchContext(environment: NodeJS.ProcessEnv, context: LaunchContext, platform?: NodeJS.Platform, contract?: LaunchContractTarget): NodeJS.ProcessEnv;
|
|
54
|
+
/** Remove both key sets, leaving user and integration settings intact. */
|
|
55
|
+
export declare function withoutLaunchContext(environment: NodeJS.ProcessEnv, platform?: NodeJS.Platform): NodeJS.ProcessEnv;
|
|
56
|
+
/** Require this build's own contract where nothing older can be accepted, such as recovery capsules. */
|
|
57
|
+
export declare function assertCurrentLaunchContract(value: {
|
|
58
|
+
readonly launchContract?: unknown;
|
|
59
|
+
}): void;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/** The contract this build emits; supersedes the pre-cutover key set it still accepts. */
|
|
2
|
+
export const PRIVATE_LAUNCH_CONTRACT = "neutral-launch-v1";
|
|
3
|
+
export const PRIVATE_ENVIRONMENT = Object.freeze({
|
|
4
|
+
releaseRoot: "LAUNCH_CONTEXT_RELEASE_ROOT",
|
|
5
|
+
releaseId: "LAUNCH_CONTEXT_RELEASE_ID",
|
|
6
|
+
releaseDigest: "LAUNCH_CONTEXT_RELEASE_DIGEST",
|
|
7
|
+
releaseLayers: "LAUNCH_CONTEXT_RELEASE_LAYERS",
|
|
8
|
+
launchProfile: "LAUNCH_CONTEXT_PROFILE",
|
|
9
|
+
immutableWarmup: "LAUNCH_CONTEXT_WARMUP",
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Keys published by releases that predate the neutral cutover. They are read when
|
|
13
|
+
* an older launcher hands this build a process, and written when this build
|
|
14
|
+
* starts a release that declares no contract of its own, so an upgrade never
|
|
15
|
+
* depends on both sides having been rebuilt at the same moment.
|
|
16
|
+
*/
|
|
17
|
+
export const SUPERSEDED_ENVIRONMENT = Object.freeze({
|
|
18
|
+
releaseRoot: "A1_RELEASE_ROOT",
|
|
19
|
+
releaseId: "A1_RELEASE_ID",
|
|
20
|
+
releaseDigest: "A1_RELEASE_DIGEST",
|
|
21
|
+
releaseLayers: "A1_RELEASE_LAYERS",
|
|
22
|
+
launchProfile: "A1_LAUNCH_PROFILE",
|
|
23
|
+
immutableWarmup: "A1_IMMUTABLE_WARMUP",
|
|
24
|
+
});
|
|
25
|
+
const PRIVATE_ENTRIES = Object.entries(PRIVATE_ENVIRONMENT);
|
|
26
|
+
const SUPERSEDED_ENTRIES = Object.entries(SUPERSEDED_ENVIRONMENT);
|
|
27
|
+
const PRIVATE_KEYS = new Set([...Object.values(PRIVATE_ENVIRONMENT), ...Object.values(SUPERSEDED_ENVIRONMENT)]);
|
|
28
|
+
const LOGICAL_KEYS = new Map(PRIVATE_ENTRIES.map(([logical, key]) => [key, logical]));
|
|
29
|
+
const SUPERSEDED_LOGICAL_KEYS = new Map(SUPERSEDED_ENTRIES.map(([logical, key]) => [key, logical]));
|
|
30
|
+
/** Read current keys, fall back to superseded keys per field, with bounded diagnostics. */
|
|
31
|
+
export function readLaunchContext(environment, requirement = "optional", platform = process.platform) {
|
|
32
|
+
const values = {};
|
|
33
|
+
const superseded = {};
|
|
34
|
+
// Performance: enumerate names only for Windows casing; never fetch unrelated environment values.
|
|
35
|
+
if (platform === "win32") {
|
|
36
|
+
for (const name of Object.keys(environment)) {
|
|
37
|
+
const upper = name.toUpperCase();
|
|
38
|
+
const logical = LOGICAL_KEYS.get(upper);
|
|
39
|
+
if (logical !== undefined)
|
|
40
|
+
acceptValue(values, logical, environment[name]);
|
|
41
|
+
const supersededLogical = SUPERSEDED_LOGICAL_KEYS.get(upper);
|
|
42
|
+
if (supersededLogical !== undefined)
|
|
43
|
+
acceptValue(superseded, supersededLogical, environment[name]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
for (const [logical, key] of PRIVATE_ENTRIES) {
|
|
48
|
+
if (Object.prototype.propertyIsEnumerable.call(environment, key))
|
|
49
|
+
acceptValue(values, logical, environment[key]);
|
|
50
|
+
}
|
|
51
|
+
for (const [logical, key] of SUPERSEDED_ENTRIES) {
|
|
52
|
+
if (Object.prototype.propertyIsEnumerable.call(environment, key))
|
|
53
|
+
acceptValue(superseded, logical, environment[key]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Compatibility: the current key wins wherever both are present, so a launcher that
|
|
57
|
+
// emits this contract is never overruled by an inherited pre-cutover value.
|
|
58
|
+
for (const [logical, value] of Object.entries(superseded))
|
|
59
|
+
if (values[logical] === undefined)
|
|
60
|
+
values[logical] = value;
|
|
61
|
+
if (values.launchProfile !== undefined && values.launchProfile !== "a1" && values.launchProfile !== "pi") {
|
|
62
|
+
throw invalidContext("launchProfile", "unsupported profile");
|
|
63
|
+
}
|
|
64
|
+
if (values.immutableWarmup !== undefined && values.immutableWarmup !== "1")
|
|
65
|
+
throw invalidContext("immutableWarmup", "invalid permission flag");
|
|
66
|
+
if (values.releaseDigest !== undefined && !/^[a-f0-9]{64}$/.test(values.releaseDigest))
|
|
67
|
+
throw invalidContext("releaseDigest", "invalid digest");
|
|
68
|
+
if (requirement === "profile")
|
|
69
|
+
requireFields(values, ["launchProfile"]);
|
|
70
|
+
if (requirement === "release" || requirement === "warmup") {
|
|
71
|
+
requireFields(values, ["releaseRoot", "releaseId", "releaseDigest"]);
|
|
72
|
+
// Compatibility: Windows drops an empty value from a child environment block, so a
|
|
73
|
+
// release with no dependency layer arrives without the key it was given. The
|
|
74
|
+
// layer list is metadata of the release being started, never authority, and an
|
|
75
|
+
// absent list means the same thing the empty string does.
|
|
76
|
+
if (values.releaseLayers === undefined)
|
|
77
|
+
values.releaseLayers = "";
|
|
78
|
+
}
|
|
79
|
+
if (requirement === "warmup")
|
|
80
|
+
requireFields(values, ["immutableWarmup"]);
|
|
81
|
+
return Object.freeze(values);
|
|
82
|
+
}
|
|
83
|
+
/** The key set a process started for this release must receive. */
|
|
84
|
+
export function launchEnvironmentKeys(contract) {
|
|
85
|
+
return contract === PRIVATE_LAUNCH_CONTRACT ? PRIVATE_ENVIRONMENT : SUPERSEDED_ENVIRONMENT;
|
|
86
|
+
}
|
|
87
|
+
/** Classify metadata by the contract it declares rather than rejecting what it omits. */
|
|
88
|
+
export function launchContractTarget(value) {
|
|
89
|
+
return value.launchContract === PRIVATE_LAUNCH_CONTRACT ? PRIVATE_LAUNCH_CONTRACT : "superseded";
|
|
90
|
+
}
|
|
91
|
+
/** Whether metadata was produced by a build that declares this contract. */
|
|
92
|
+
export function isCurrentLaunchContract(value) {
|
|
93
|
+
return value.launchContract === PRIVATE_LAUNCH_CONTRACT;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Rebuild owned context without inheriting a prior session's private selection. The
|
|
97
|
+
* contract selects which key set is written, so this build can start either its
|
|
98
|
+
* own releases or a retained pre-cutover release it must keep serving.
|
|
99
|
+
*/
|
|
100
|
+
export function withLaunchContext(environment, context, platform = process.platform, contract = PRIVATE_LAUNCH_CONTRACT) {
|
|
101
|
+
const result = withoutLaunchContext(environment, platform);
|
|
102
|
+
for (const [logical, key] of Object.entries(launchEnvironmentKeys(contract))) {
|
|
103
|
+
const value = context[logical];
|
|
104
|
+
if (value !== undefined)
|
|
105
|
+
result[key] = value;
|
|
106
|
+
}
|
|
107
|
+
readLaunchContext(result, "optional", platform);
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
/** Remove both key sets, leaving user and integration settings intact. */
|
|
111
|
+
export function withoutLaunchContext(environment, platform = process.platform) {
|
|
112
|
+
return Object.fromEntries(Object.entries(environment).filter(([key]) => !PRIVATE_KEYS.has(platform === "win32" ? key.toUpperCase() : key)));
|
|
113
|
+
}
|
|
114
|
+
/** Require this build's own contract where nothing older can be accepted, such as recovery capsules. */
|
|
115
|
+
export function assertCurrentLaunchContract(value) {
|
|
116
|
+
if (value.launchContract !== PRIVATE_LAUNCH_CONTRACT) {
|
|
117
|
+
throw new Error("Unsupported private launch contract. Stop existing processes and install the current package directly with npm; review disposable runtime/release state before any manual reset. User settings, sessions, and history must be preserved.");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function acceptValue(values, logical, value) {
|
|
121
|
+
if (value === undefined)
|
|
122
|
+
return;
|
|
123
|
+
if (values[logical] !== undefined && values[logical] !== value)
|
|
124
|
+
throw invalidContext(logical, "conflicting environment key casing");
|
|
125
|
+
if (typeof value !== "string" || value.includes("\0") || (value.length === 0 && logical !== "releaseLayers"))
|
|
126
|
+
throw invalidContext(logical, "invalid value");
|
|
127
|
+
values[logical] = value;
|
|
128
|
+
}
|
|
129
|
+
function requireFields(values, fields) {
|
|
130
|
+
for (const field of fields)
|
|
131
|
+
if (values[field] === undefined)
|
|
132
|
+
throw invalidContext(field, "required current-contract field is missing");
|
|
133
|
+
}
|
|
134
|
+
function invalidContext(logical, reason) {
|
|
135
|
+
return new Error(`Invalid private launch context (${logical}): ${reason}`);
|
|
136
|
+
}
|