@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,55 @@
|
|
|
1
|
+
import { isBashToolResult, isEditToolResult, isWriteToolResult, } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { lstat, unlink } from "node:fs/promises";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
const DEFAULT_FILE_SYSTEM = { lstat, unlink };
|
|
5
|
+
const DEFAULT_PATHS = { dirname, join, resolve };
|
|
6
|
+
const SIMPLE_CD = /(?:^|[;&|\n])\s*cd\s+(?:"([^"\r\n]+)"|'([^'\r\n]+)'|([^\s;&|]+))/;
|
|
7
|
+
export function createWindowsNulCleanupExtension(options = {}) {
|
|
8
|
+
if ((options.platform ?? process.platform) !== "win32")
|
|
9
|
+
return null;
|
|
10
|
+
const fileSystem = options.fileSystem ?? DEFAULT_FILE_SYSTEM;
|
|
11
|
+
const paths = options.paths ?? DEFAULT_PATHS;
|
|
12
|
+
return {
|
|
13
|
+
name: "windows-nul-file-cleanup",
|
|
14
|
+
factory: pi => registerNulCleanup(pi, fileSystem, paths),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function registerNulCleanup(pi, fileSystem, paths) {
|
|
18
|
+
const cleanDirectory = async (directory) => {
|
|
19
|
+
const candidate = paths.join(directory, "nul");
|
|
20
|
+
try {
|
|
21
|
+
const metadata = await fileSystem.lstat(candidate);
|
|
22
|
+
if (metadata.isFile() && !metadata.isSymbolicLink())
|
|
23
|
+
await fileSystem.unlink(candidate);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
30
|
+
await cleanDirectory(ctx.cwd);
|
|
31
|
+
});
|
|
32
|
+
pi.on("tool_result", async (event, ctx) => {
|
|
33
|
+
const directories = new Set([ctx.cwd]);
|
|
34
|
+
if (isBashToolResult(event)) {
|
|
35
|
+
const command = stringInput(event.input, "command");
|
|
36
|
+
const target = command === null ? null : simpleCdTarget(command);
|
|
37
|
+
if (target !== null)
|
|
38
|
+
directories.add(paths.resolve(ctx.cwd, target));
|
|
39
|
+
}
|
|
40
|
+
if (isWriteToolResult(event) || isEditToolResult(event)) {
|
|
41
|
+
const target = stringInput(event.input, "path");
|
|
42
|
+
if (target !== null)
|
|
43
|
+
directories.add(paths.dirname(paths.resolve(ctx.cwd, target)));
|
|
44
|
+
}
|
|
45
|
+
await Promise.all(Array.from(directories, cleanDirectory));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function simpleCdTarget(command) {
|
|
49
|
+
const match = SIMPLE_CD.exec(command);
|
|
50
|
+
return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;
|
|
51
|
+
}
|
|
52
|
+
function stringInput(input, key) {
|
|
53
|
+
const value = input[key];
|
|
54
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
55
|
+
}
|
package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentJsonValue, AgentWorkflowDescriptor, AgentWorkflowPort } from "
|
|
1
|
+
import type { AgentJsonValue, AgentWorkflowDescriptor, AgentWorkflowPort } from "../../../contracts/agent-engine/index.js";
|
|
2
2
|
import { type PiWorkflowRoute } from "./workflows.js";
|
|
3
3
|
export type WorkflowCapability = "prompt" | "abort" | "compact" | "bash" | "models.read" | "models.write" | "auth.login" | "auth.logout" | "settings.read" | "settings.write" | "resources.read" | "resources.reload" | "session.read" | "session.new" | "session.resume" | "session.fork" | "session.tree" | "session.import" | "clipboard.write" | "export.write" | "share.write" | "process.quit" | "diagnostics.read";
|
|
4
4
|
export interface WorkflowControllerResult {
|
|
@@ -6,6 +6,7 @@ export interface WorkflowControllerResult {
|
|
|
6
6
|
readonly message: string;
|
|
7
7
|
readonly value?: AgentJsonValue;
|
|
8
8
|
}
|
|
9
|
+
/** Capability-gates pinned Pi workflows before delegating execution through the neutral workflow port. */
|
|
9
10
|
export declare class PiWorkflowControllerPort implements AgentWorkflowPort {
|
|
10
11
|
#private;
|
|
11
12
|
private readonly execute;
|
|
@@ -16,5 +17,5 @@ export declare class PiWorkflowControllerPort implements AgentWorkflowPort {
|
|
|
16
17
|
listWorkflows(): Promise<readonly AgentWorkflowDescriptor[]>;
|
|
17
18
|
executeWorkflow(workflowId: string, input: AgentJsonValue, signal?: AbortSignal): Promise<AgentJsonValue>;
|
|
18
19
|
}
|
|
19
|
-
export declare const PI_BUILTIN_WORKFLOW_ROUTES: readonly ("name" | "share" | "model" | "login" | "logout" | "settings" | "reload" | "compact" | "new" | "resume" | "
|
|
20
|
+
export declare const PI_BUILTIN_WORKFLOW_ROUTES: readonly ("name" | "share" | "model" | "login" | "logout" | "settings" | "reload" | "compact" | "new" | "resume" | "quit" | "session" | "tree" | "scoped-models" | "export" | "import" | "copy" | "changelog" | "hotkeys" | "fork" | "clone" | "trust" | "debug" | "arminsayshi" | "dementedelves")[];
|
|
20
21
|
export declare const PI_WORKFLOW_CAPABILITIES: readonly WorkflowCapability[];
|
package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.js
RENAMED
|
@@ -8,6 +8,7 @@ const DEFINITIONS = [
|
|
|
8
8
|
define("new", "session.new"), define("compact", "compact"), define("resume", "session.resume"), define("reload", "resources.reload"),
|
|
9
9
|
define("quit", "process.quit"), define("debug", "diagnostics.read"), define("arminsayshi", "resources.read"), define("dementedelves", "resources.read"),
|
|
10
10
|
];
|
|
11
|
+
/** Capability-gates pinned Pi workflows before delegating execution through the neutral workflow port. */
|
|
11
12
|
export class PiWorkflowControllerPort {
|
|
12
13
|
execute;
|
|
13
14
|
capabilities = { execute: true };
|
|
@@ -62,6 +62,10 @@ export interface PiWorkflowRequest {
|
|
|
62
62
|
readonly argument: string;
|
|
63
63
|
readonly selection?: string;
|
|
64
64
|
readonly confirmed?: boolean;
|
|
65
|
+
/** Recovery cwd selected after an import/resume source cwd is unavailable. */
|
|
66
|
+
readonly cwdOverride?: string;
|
|
67
|
+
/** Cancellation for an owned operation surface such as `/share`. */
|
|
68
|
+
readonly signal?: AbortSignal;
|
|
65
69
|
readonly treeSummary?: {
|
|
66
70
|
readonly summarize: boolean;
|
|
67
71
|
readonly customInstructions?: string;
|
|
@@ -100,10 +104,19 @@ export interface PiSessionInfoPresentation {
|
|
|
100
104
|
}[];
|
|
101
105
|
}
|
|
102
106
|
export type PiWorkflowPresentation = PiSessionInfoPresentation;
|
|
107
|
+
export type PiWorkflowMessageKind = "status" | "warning" | "error" | "accent" | "silent";
|
|
108
|
+
export interface PiWorkflowMessage {
|
|
109
|
+
readonly kind: Exclude<PiWorkflowMessageKind, "silent">;
|
|
110
|
+
readonly message: string;
|
|
111
|
+
}
|
|
103
112
|
export interface PiWorkflowResult {
|
|
104
113
|
readonly command: PiWorkflowRoute;
|
|
105
114
|
readonly outcome: PiWorkflowOutcome;
|
|
106
115
|
readonly message: string;
|
|
116
|
+
/** Explicit presentation semantics; never inferred from message prefixes. */
|
|
117
|
+
readonly messageKind?: PiWorkflowMessageKind;
|
|
118
|
+
/** Ordered messages for truthful partial-success outcomes. */
|
|
119
|
+
readonly messages?: readonly PiWorkflowMessage[];
|
|
107
120
|
readonly detail?: string;
|
|
108
121
|
readonly selectorTitle?: string;
|
|
109
122
|
readonly options?: readonly PiWorkflowOption[];
|
|
@@ -153,15 +166,19 @@ export interface PiWorkflowInteractionHost {
|
|
|
153
166
|
startLogin?(request: PiWorkflowLoginStart): void;
|
|
154
167
|
prompt(request: PiWorkflowInteractionRequest): Promise<string | null>;
|
|
155
168
|
notify(event: PiWorkflowLoginNotification): void;
|
|
169
|
+
/** Deliver a post-login status or warning after the authentication dialog closes. */
|
|
170
|
+
publish?(message: PiWorkflowMessage): void;
|
|
156
171
|
finishLogin?(): void;
|
|
157
172
|
}
|
|
158
173
|
export interface PiWorkflowHost {
|
|
159
174
|
copyText(text: string): Promise<void>;
|
|
160
|
-
runCommand(command: string, arguments_: readonly string[]
|
|
175
|
+
runCommand(command: string, arguments_: readonly string[], options?: {
|
|
176
|
+
readonly signal?: AbortSignal;
|
|
177
|
+
}): Promise<{
|
|
161
178
|
readonly stdout: string;
|
|
162
179
|
readonly stderr: string;
|
|
163
180
|
}>;
|
|
164
|
-
readChangelog(): Promise<string>;
|
|
181
|
+
readChangelog(sinceVersion?: string): Promise<string>;
|
|
165
182
|
}
|
|
166
183
|
export interface PiBashWorkflowResult {
|
|
167
184
|
readonly command: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PiTuiInputDiagnosticsEvent } from "../tui-runtime/index.js";
|
|
2
|
+
import type { ResponseCopyEvent } from "./response-copy-protocol.js";
|
|
3
|
+
import type { PasteEvent } from "./paste-protocol.js";
|
|
4
|
+
/** Opt-in scalar-only snapshots, bounded to 128 rows and one pending asynchronous write. */
|
|
5
|
+
export declare class ClipboardDiagnosticCapture {
|
|
6
|
+
#private;
|
|
7
|
+
private readonly destination;
|
|
8
|
+
private readonly write;
|
|
9
|
+
constructor(destination: string, write?: (file: string, data: string) => Promise<void>);
|
|
10
|
+
copy(event: ResponseCopyEvent): void;
|
|
11
|
+
paste(event: PasteEvent): void;
|
|
12
|
+
runtime(event: PiTuiInputDiagnosticsEvent): void;
|
|
13
|
+
/** Explicit test/evidence boundary; the interactive UI never waits for disk diagnostics. */
|
|
14
|
+
flush(): Promise<void>;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
const PHASES = new Set(["capture", "selection-clear", "queued", "preparing", "extracted", "encoded", "submitting", "settled", "cleanup",
|
|
3
|
+
"framing", "admitted", "predecessor", "acquiring", "acquired-text", "acquired-image", "classifying", "path-fallback", "prepared", "inserting",
|
|
4
|
+
"receipt", "semantic-start", "semantic-end", "composition-start", "composition-end", "write-start", "write-end", "heartbeat"]);
|
|
5
|
+
/** Opt-in scalar-only snapshots, bounded to 128 rows and one pending asynchronous write. */
|
|
6
|
+
export class ClipboardDiagnosticCapture {
|
|
7
|
+
destination;
|
|
8
|
+
write;
|
|
9
|
+
#records = [];
|
|
10
|
+
#payloads = new Map();
|
|
11
|
+
#pending;
|
|
12
|
+
#writing;
|
|
13
|
+
#disposed = false;
|
|
14
|
+
#heartbeat;
|
|
15
|
+
constructor(destination, write = (file, data) => writeFile(file, data, { encoding: "utf8", mode: 0o600 })) {
|
|
16
|
+
this.destination = destination;
|
|
17
|
+
this.write = write;
|
|
18
|
+
this.#heartbeat = setInterval(() => this.#record("heartbeat", { phase: "heartbeat", atMs: performance.now() }), 100);
|
|
19
|
+
this.#heartbeat.unref();
|
|
20
|
+
}
|
|
21
|
+
copy(event) { this.#record("copy", event); }
|
|
22
|
+
paste(event) { this.#record("paste", event); }
|
|
23
|
+
runtime(event) {
|
|
24
|
+
this.#record("runtime", { phase: event.phase, atMs: event.atMs, request: event.revision, pending: event.pendingDepth });
|
|
25
|
+
}
|
|
26
|
+
#record(source, event) {
|
|
27
|
+
if (this.#disposed || !PHASES.has(event.phase))
|
|
28
|
+
return;
|
|
29
|
+
const key = `${source}:${event.request ?? 0}`;
|
|
30
|
+
// Concurrency: eight pastes plus active/pending copy and the incoming superseding capture can overlap briefly.
|
|
31
|
+
if (["capture", "admitted"].includes(event.phase) && this.#payloads.size < 11)
|
|
32
|
+
this.#payloads.set(key, scalar(event.sourceUnits) * 2);
|
|
33
|
+
if (this.#payloads.has(key) && event.bytes !== undefined)
|
|
34
|
+
this.#payloads.set(key, Math.max(this.#payloads.get(key), scalar(event.bytes)));
|
|
35
|
+
if (event.phase === "settled" || event.phase === "cleanup")
|
|
36
|
+
this.#payloads.delete(key);
|
|
37
|
+
// Rationale: observed payload/source bytes, not an assertion about opaque native allocator overhead.
|
|
38
|
+
const pendingBytes = scalar([...this.#payloads.values()].reduce((sum, bytes) => sum + bytes, 0));
|
|
39
|
+
// Security: project only declared scalar fields. Never serialize the supplied event object or raw errors.
|
|
40
|
+
this.#records.push({ source, phase: event.phase, atMs: scalar(event.atMs), request: event.request !== undefined && event.request < 0 ? -scalar(-event.request) : scalar(event.request), pending: scalar(event.pending), bytes: scalar(event.bytes), elapsedMs: scalar(event.elapsedMs),
|
|
41
|
+
sourceUnits: scalar(event.sourceUnits), pendingBytes,
|
|
42
|
+
transport: ["native", "terminal", "provided", "injected"].includes(event.transport ?? "") ? event.transport : "none",
|
|
43
|
+
outcome: ["ready", "failed", "canceled", "delivered", "submitted-unverified", "timed-out", "superseded"].includes(event.outcome ?? "") ? event.outcome : "none" });
|
|
44
|
+
if (this.#records.length > 128)
|
|
45
|
+
this.#records.shift();
|
|
46
|
+
this.#pending = JSON.stringify({ schema: "clipboard-diagnostics-v1", records: this.#records });
|
|
47
|
+
this.#pump();
|
|
48
|
+
}
|
|
49
|
+
#pump() {
|
|
50
|
+
if (this.#disposed || this.#writing || this.#pending === undefined)
|
|
51
|
+
return;
|
|
52
|
+
const snapshot = this.#pending;
|
|
53
|
+
this.#pending = undefined;
|
|
54
|
+
this.#writing = Promise.resolve().then(() => this.write(this.destination, snapshot)).catch(() => {
|
|
55
|
+
// Security: diagnostics failure must not enter the normal terminal or block clipboard work.
|
|
56
|
+
}).finally(() => { this.#writing = undefined; this.#pump(); });
|
|
57
|
+
}
|
|
58
|
+
/** Explicit test/evidence boundary; the interactive UI never waits for disk diagnostics. */
|
|
59
|
+
async flush() { while (this.#writing)
|
|
60
|
+
await this.#writing; }
|
|
61
|
+
dispose() { this.#disposed = true; clearInterval(this.#heartbeat); this.#pending = undefined; this.#records = []; this.#payloads.clear(); }
|
|
62
|
+
}
|
|
63
|
+
function scalar(value) {
|
|
64
|
+
return value !== undefined && Number.isFinite(value) ? Math.max(0, Math.min(Number.MAX_SAFE_INTEGER, value)) : 0;
|
|
65
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ClipboardImageData {
|
|
2
|
+
readonly data: string;
|
|
3
|
+
readonly mimeType: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Converts valid padded or unpadded standard base64 into its unique padded form.
|
|
7
|
+
* Clipboard adapters are untrusted at this boundary, so reject representations
|
|
8
|
+
* that Node's permissive base64 decoder would otherwise partially accept.
|
|
9
|
+
*/
|
|
10
|
+
export declare function canonicalizeClipboardImage(image: ClipboardImageData, source?: boolean): ClipboardImageData | null;
|
|
11
|
+
export declare function canonicalizeStandardBase64(value: string, source?: boolean): string | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ImageAttachmentError, MAX_IMAGE_DATA_BYTES } from "../../../contracts/owned-ui/index.js";
|
|
2
|
+
import { MAX_SOURCE_IMAGE_BYTES } from "./image-source.js";
|
|
3
|
+
const STANDARD_BASE64 = /^[A-Za-z0-9+/]*={0,2}$/u;
|
|
4
|
+
/**
|
|
5
|
+
* Converts valid padded or unpadded standard base64 into its unique padded form.
|
|
6
|
+
* Clipboard adapters are untrusted at this boundary, so reject representations
|
|
7
|
+
* that Node's permissive base64 decoder would otherwise partially accept.
|
|
8
|
+
*/
|
|
9
|
+
export function canonicalizeClipboardImage(image, source = false) {
|
|
10
|
+
const data = canonicalizeStandardBase64(image.data, source);
|
|
11
|
+
return data === null ? null : { data, mimeType: image.mimeType };
|
|
12
|
+
}
|
|
13
|
+
export function canonicalizeStandardBase64(value, source = false) {
|
|
14
|
+
if (typeof value !== "string" || value.length === 0)
|
|
15
|
+
return null;
|
|
16
|
+
const maximum = source ? Math.ceil(MAX_SOURCE_IMAGE_BYTES / 3) * 4 : MAX_IMAGE_DATA_BYTES;
|
|
17
|
+
if (Math.ceil(value.length / 4) * 4 > maximum)
|
|
18
|
+
throw new ImageAttachmentError(source ? "image-source-size" : "image-size");
|
|
19
|
+
if (!STANDARD_BASE64.test(value))
|
|
20
|
+
return null;
|
|
21
|
+
const paddingStart = value.indexOf("=");
|
|
22
|
+
const core = paddingStart < 0 ? value : value.slice(0, paddingStart);
|
|
23
|
+
const suppliedPadding = value.length - core.length;
|
|
24
|
+
const remainder = core.length % 4;
|
|
25
|
+
if (remainder === 1)
|
|
26
|
+
return null;
|
|
27
|
+
const requiredPadding = remainder === 0 ? 0 : 4 - remainder;
|
|
28
|
+
if (suppliedPadding !== 0 && suppliedPadding !== requiredPadding)
|
|
29
|
+
return null;
|
|
30
|
+
const padded = `${core}${"=".repeat(requiredPadding)}`;
|
|
31
|
+
const decoded = Buffer.from(padded, "base64");
|
|
32
|
+
if (source && decoded.length > MAX_SOURCE_IMAGE_BYTES)
|
|
33
|
+
throw new ImageAttachmentError("image-source-size");
|
|
34
|
+
if (decoded.length === 0)
|
|
35
|
+
return null;
|
|
36
|
+
const canonical = decoded.toString("base64");
|
|
37
|
+
return canonical === padded ? canonical : null;
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Aggregate explicit URL-chip metadata allowance for one owned editor decoration pass. */
|
|
2
|
+
export declare const EDITOR_HYPERLINK_METADATA_BYTES: number;
|
|
3
|
+
/** Accounts complete OSC 8 controls before construction, without scanning oversized backing URLs. */
|
|
4
|
+
export declare class EditorHyperlinkBudget {
|
|
5
|
+
#private;
|
|
6
|
+
reset(): void;
|
|
7
|
+
takeCleanup(): boolean;
|
|
8
|
+
take(target: string): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Aggregate explicit URL-chip metadata allowance for one owned editor decoration pass. */
|
|
2
|
+
export const EDITOR_HYPERLINK_METADATA_BYTES = 64 * 1024;
|
|
3
|
+
const CLOSE_BYTES = 7;
|
|
4
|
+
const PAIR_BYTES = CLOSE_BYTES * 2;
|
|
5
|
+
/** Accounts complete OSC 8 controls before construction, without scanning oversized backing URLs. */
|
|
6
|
+
export class EditorHyperlinkBudget {
|
|
7
|
+
#remaining = EDITOR_HYPERLINK_METADATA_BYTES;
|
|
8
|
+
reset() { this.#remaining = EDITOR_HYPERLINK_METADATA_BYTES; }
|
|
9
|
+
takeCleanup() { return this.#reserve(CLOSE_BYTES); }
|
|
10
|
+
take(target) {
|
|
11
|
+
// Performance: UTF-16 length is a lower bound on UTF-8 bytes, including replacement surrogates.
|
|
12
|
+
// Reject large backing values before byte counting, flattening, interpolation, or signatures.
|
|
13
|
+
if (target.length > this.#remaining - PAIR_BYTES)
|
|
14
|
+
return false;
|
|
15
|
+
return this.#reserve(PAIR_BYTES + Buffer.byteLength(target, "utf8"));
|
|
16
|
+
}
|
|
17
|
+
#reserve(bytes) {
|
|
18
|
+
if (bytes > this.#remaining)
|
|
19
|
+
return false;
|
|
20
|
+
this.#remaining -= bytes;
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PiShellClipboardContent } from "../components/index.js";
|
|
2
|
+
import type { ImagePreparationLimits, PreparedImage } from "./image-preparation.js";
|
|
3
|
+
import type { ImageWorkerRequest } from "./image-worker.js";
|
|
4
|
+
export type PreparedClipboardContent = {
|
|
5
|
+
readonly kind: "text";
|
|
6
|
+
readonly text: string;
|
|
7
|
+
} | ({
|
|
8
|
+
readonly kind: "image";
|
|
9
|
+
} & PreparedImage) | null;
|
|
10
|
+
export interface ImagePasteJob {
|
|
11
|
+
readonly result: Promise<PreparedClipboardContent>;
|
|
12
|
+
cancel(): void;
|
|
13
|
+
}
|
|
14
|
+
/** Owns bounded paste acquisition and one off-thread conversion, canceled on session disposal. */
|
|
15
|
+
export declare class ImagePreparationClient {
|
|
16
|
+
#private;
|
|
17
|
+
start(read?: (signal: AbortSignal) => Promise<PiShellClipboardContent | null>, limits?: ImagePreparationLimits): ImagePasteJob;
|
|
18
|
+
dispose(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare function runImageWorker<T>(request: ImageWorkerRequest, signal: AbortSignal): Promise<T>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Worker } from "node:worker_threads";
|
|
2
|
+
import { ImageAttachmentError } from "../../../contracts/owned-ui/index.js";
|
|
3
|
+
import { IMAGE_PREPARATION_MS, MAX_SOURCE_IMAGE_BYTES } from "./image-source.js";
|
|
4
|
+
/** Owns bounded paste acquisition and one off-thread conversion, canceled on session disposal. */
|
|
5
|
+
export class ImagePreparationClient {
|
|
6
|
+
#active = new Set();
|
|
7
|
+
#queue = [];
|
|
8
|
+
#stopping = new Set();
|
|
9
|
+
#converting = false;
|
|
10
|
+
#disposed = false;
|
|
11
|
+
start(read, limits = {}) {
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
if (this.#disposed || this.#active.size >= 8) {
|
|
14
|
+
const result = Promise.reject(new ImageAttachmentError(this.#disposed ? "image-canceled" : "image-busy"));
|
|
15
|
+
void result.catch(() => { });
|
|
16
|
+
return { result, cancel: () => { } };
|
|
17
|
+
}
|
|
18
|
+
this.#active.add(controller);
|
|
19
|
+
const deadline = setTimeout(() => controller.abort(new ImageAttachmentError("image-timeout")), IMAGE_PREPARATION_MS);
|
|
20
|
+
const result = new Promise((resolve, reject) => {
|
|
21
|
+
controller.signal.addEventListener("abort", () => reject(abortError(controller.signal)), { once: true });
|
|
22
|
+
// Concurrency: the pending marker gets a render opportunity before any acquisition starts.
|
|
23
|
+
setImmediate(() => {
|
|
24
|
+
if (controller.signal.aborted)
|
|
25
|
+
return;
|
|
26
|
+
const acquire = read === undefined
|
|
27
|
+
? runImageWorker({ kind: "clipboard" }, controller.signal)
|
|
28
|
+
: Promise.resolve().then(() => read(controller.signal));
|
|
29
|
+
void acquire.then(content => {
|
|
30
|
+
if (controller.signal.aborted)
|
|
31
|
+
return;
|
|
32
|
+
if (content?.kind !== "image") {
|
|
33
|
+
resolve(content);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (Math.ceil(content.data.length / 4) * 3 > MAX_SOURCE_IMAGE_BYTES + 2)
|
|
37
|
+
throw new ImageAttachmentError("image-source-size");
|
|
38
|
+
this.#queue.push({ signal: controller.signal, run: async () => {
|
|
39
|
+
try {
|
|
40
|
+
const image = await runImageWorker({ kind: "prepare", source: content, limits }, controller.signal);
|
|
41
|
+
resolve({ kind: "image", ...image });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
reject(error);
|
|
45
|
+
}
|
|
46
|
+
} });
|
|
47
|
+
this.#drain();
|
|
48
|
+
}).catch(reject);
|
|
49
|
+
});
|
|
50
|
+
}).finally(() => {
|
|
51
|
+
clearTimeout(deadline);
|
|
52
|
+
this.#active.delete(controller);
|
|
53
|
+
const stopped = waitForImageWorkers(controller.signal);
|
|
54
|
+
this.#stopping.add(stopped);
|
|
55
|
+
void stopped.finally(() => this.#stopping.delete(stopped));
|
|
56
|
+
const index = this.#queue.findIndex(item => item.signal === controller.signal);
|
|
57
|
+
if (index >= 0)
|
|
58
|
+
this.#queue.splice(index, 1);
|
|
59
|
+
});
|
|
60
|
+
void result.catch(() => { });
|
|
61
|
+
return { result, cancel: () => controller.abort(new ImageAttachmentError("image-canceled")) };
|
|
62
|
+
}
|
|
63
|
+
async dispose() {
|
|
64
|
+
this.#disposed = true;
|
|
65
|
+
for (const controller of this.#active)
|
|
66
|
+
controller.abort(new ImageAttachmentError("image-canceled"));
|
|
67
|
+
this.#queue.length = 0;
|
|
68
|
+
await Promise.resolve();
|
|
69
|
+
await Promise.all(this.#stopping);
|
|
70
|
+
}
|
|
71
|
+
#drain() {
|
|
72
|
+
if (this.#converting)
|
|
73
|
+
return;
|
|
74
|
+
const next = this.#queue.shift();
|
|
75
|
+
if (next === undefined)
|
|
76
|
+
return;
|
|
77
|
+
if (next.signal.aborted) {
|
|
78
|
+
this.#drain();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.#converting = true;
|
|
82
|
+
void next.run().finally(() => { this.#converting = false; this.#drain(); });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const ACTIVE_IMAGE_WORKERS = new Map();
|
|
86
|
+
async function waitForImageWorkers(signal) {
|
|
87
|
+
await Promise.all([...ACTIVE_IMAGE_WORKERS].filter(([, owner]) => owner === signal)
|
|
88
|
+
.map(([worker]) => new Promise(resolve => { worker.once("exit", () => resolve()); })));
|
|
89
|
+
}
|
|
90
|
+
export function runImageWorker(request, signal) {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
if (signal.aborted) {
|
|
93
|
+
reject(abortError(signal));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (ACTIVE_IMAGE_WORKERS.size >= 8) {
|
|
97
|
+
reject(new ImageAttachmentError("image-busy"));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Compatibility: production uses the emitted sibling; source tests load TypeScript through tsx.
|
|
101
|
+
const source = import.meta.url.endsWith(".ts");
|
|
102
|
+
const entry = new URL(source ? "./image-worker.ts" : "./image-worker.js", import.meta.url);
|
|
103
|
+
const worker = source
|
|
104
|
+
? new Worker(`import('tsx/esm/api').then(({ tsImport }) => tsImport(${JSON.stringify(entry.href)}, ${JSON.stringify(import.meta.url)}))`, { eval: true, workerData: request, stdout: true, stderr: true })
|
|
105
|
+
: new Worker(entry, { workerData: request, stdout: true, stderr: true });
|
|
106
|
+
// Security: native/codec output is not trusted diagnostics and must never reach the terminal or logs.
|
|
107
|
+
worker.stdout.resume();
|
|
108
|
+
worker.stderr.resume();
|
|
109
|
+
ACTIVE_IMAGE_WORKERS.set(worker, signal);
|
|
110
|
+
let outcome;
|
|
111
|
+
let stop;
|
|
112
|
+
const requestStop = () => {
|
|
113
|
+
if (stop !== undefined)
|
|
114
|
+
return;
|
|
115
|
+
worker.postMessage("cancel");
|
|
116
|
+
// Security: allow clipboard subprocess abort first; a busy codec cannot handle messages.
|
|
117
|
+
stop = setTimeout(() => { void worker.terminate().catch(() => { }); }, 50);
|
|
118
|
+
stop.unref();
|
|
119
|
+
};
|
|
120
|
+
const abort = () => { outcome = { error: abortError(signal) }; requestStop(); };
|
|
121
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
122
|
+
worker.once("message", (message) => {
|
|
123
|
+
if (!signal.aborted)
|
|
124
|
+
outcome = message?.ok === true
|
|
125
|
+
? { value: message.value }
|
|
126
|
+
: { error: new ImageAttachmentError(message?.code ?? "image-codec") };
|
|
127
|
+
requestStop();
|
|
128
|
+
});
|
|
129
|
+
worker.once("error", () => { outcome = { error: new ImageAttachmentError("image-codec") }; requestStop(); });
|
|
130
|
+
worker.once("exit", () => {
|
|
131
|
+
ACTIVE_IMAGE_WORKERS.delete(worker);
|
|
132
|
+
if (stop !== undefined)
|
|
133
|
+
clearTimeout(stop);
|
|
134
|
+
signal.removeEventListener("abort", abort);
|
|
135
|
+
// Concurrency: release the conversion slot only after the old executor has actually stopped.
|
|
136
|
+
if (outcome === undefined || outcome.error !== undefined)
|
|
137
|
+
reject(outcome?.error ?? new ImageAttachmentError("image-codec"));
|
|
138
|
+
else
|
|
139
|
+
resolve(outcome.value);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function abortError(signal) {
|
|
144
|
+
return signal.reason instanceof ImageAttachmentError ? signal.reason : new ImageAttachmentError("image-canceled");
|
|
145
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ImagePreparationLimits {
|
|
2
|
+
readonly encodedBytes?: number;
|
|
3
|
+
readonly decodedBytes?: number;
|
|
4
|
+
readonly maxDimension?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface PreparedImage {
|
|
7
|
+
readonly data: string;
|
|
8
|
+
readonly mimeType: string;
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly height: number;
|
|
11
|
+
readonly transformed: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const IMAGE_TARGET_BASE64_BYTES: number;
|
|
14
|
+
export declare const IMAGE_TARGET_DECODED_BYTES: number;
|
|
15
|
+
export declare function prepareImage(source: {
|
|
16
|
+
readonly data: string;
|
|
17
|
+
readonly mimeType: string;
|
|
18
|
+
}, limits?: ImagePreparationLimits): Promise<PreparedImage>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { isMainThread } from "node:worker_threads";
|
|
2
|
+
import { ImageAttachmentError } from "../../../contracts/owned-ui/index.js";
|
|
3
|
+
import { canonicalizeClipboardImage } from "./clipboard-image.js";
|
|
4
|
+
import { sourceImageInfo } from "./image-source.js";
|
|
5
|
+
export const IMAGE_TARGET_BASE64_BYTES = 4.5 * 1024 * 1024;
|
|
6
|
+
export const IMAGE_TARGET_DECODED_BYTES = 5 * 1024 * 1024;
|
|
7
|
+
export async function prepareImage(source, limits = {}) {
|
|
8
|
+
// Performance: an async signature does not move synchronous WASM work off the interactive thread.
|
|
9
|
+
if (isMainThread)
|
|
10
|
+
throw new Error("Image preparation requires a worker");
|
|
11
|
+
const canonical = canonicalizeClipboardImage(source, true);
|
|
12
|
+
if (canonical === null)
|
|
13
|
+
throw new ImageAttachmentError("image-data");
|
|
14
|
+
const bytes = Buffer.from(canonical.data, "base64");
|
|
15
|
+
const metadata = sourceImageInfo(bytes, canonical.mimeType);
|
|
16
|
+
const encodedLimit = Math.min(IMAGE_TARGET_BASE64_BYTES - 1, positive(limits.encodedBytes, Infinity));
|
|
17
|
+
const decodedLimit = Math.min(IMAGE_TARGET_DECODED_BYTES, positive(limits.decodedBytes, Infinity));
|
|
18
|
+
const maxDimension = positive(limits.maxDimension, Infinity);
|
|
19
|
+
const fits = (length) => length <= decodedLimit && 4 * Math.ceil(length / 3) <= encodedLimit;
|
|
20
|
+
if (fits(bytes.length) && Math.max(metadata.width, metadata.height) <= maxDimension) {
|
|
21
|
+
return { ...canonical, width: metadata.width, height: metadata.height, transformed: false };
|
|
22
|
+
}
|
|
23
|
+
if (metadata.conversionUnsafe)
|
|
24
|
+
throw new ImageAttachmentError("image-conversion");
|
|
25
|
+
const photon = await import("@silvia-odwyer/photon-node").catch(() => { throw new ImageAttachmentError("image-codec"); });
|
|
26
|
+
let image;
|
|
27
|
+
try {
|
|
28
|
+
image = photon.PhotonImage.new_from_byteslice(bytes);
|
|
29
|
+
if (image.get_width() !== metadata.width || image.get_height() !== metadata.height)
|
|
30
|
+
throw new ImageAttachmentError("image-data");
|
|
31
|
+
if (metadata.orientation !== 1) {
|
|
32
|
+
const raw = image.get_raw_pixels();
|
|
33
|
+
const oriented = orientPixels(raw, metadata.width, metadata.height, metadata.orientation);
|
|
34
|
+
image.free();
|
|
35
|
+
image = undefined;
|
|
36
|
+
image = new photon.PhotonImage(oriented.pixels, oriented.width, oriented.height);
|
|
37
|
+
}
|
|
38
|
+
const width = image.get_width(), height = image.get_height();
|
|
39
|
+
let scale = Math.min(1, 2000 / Math.max(width, height), maxDimension / Math.max(width, height));
|
|
40
|
+
const floor = Math.min(Math.max(width, height), 1024, maxDimension);
|
|
41
|
+
for (let level = 0; level < 4; level++, scale *= 0.75) {
|
|
42
|
+
const w = Math.max(1, Math.round(width * scale)), h = Math.max(1, Math.round(height * scale));
|
|
43
|
+
if (Math.max(w, h) < floor)
|
|
44
|
+
break;
|
|
45
|
+
const resized = photon.resize(image, w, h, photon.SamplingFilter.Lanczos3);
|
|
46
|
+
let opaque;
|
|
47
|
+
try {
|
|
48
|
+
const png = resized.get_bytes();
|
|
49
|
+
if (fits(png.length))
|
|
50
|
+
return result(png, "image/png", w, h);
|
|
51
|
+
const pixels = resized.get_raw_pixels();
|
|
52
|
+
for (let p = 0; p < pixels.length; p += 4) {
|
|
53
|
+
const alpha = (pixels[p + 3] ?? 255) / 255;
|
|
54
|
+
for (let c = 0; c < 3; c++)
|
|
55
|
+
pixels[p + c] = Math.round((pixels[p + c] ?? 0) * alpha + 255 * (1 - alpha));
|
|
56
|
+
pixels[p + 3] = 255;
|
|
57
|
+
}
|
|
58
|
+
opaque = new photon.PhotonImage(pixels, w, h);
|
|
59
|
+
for (const quality of [85, 70, 55, 40]) {
|
|
60
|
+
const jpeg = opaque.get_bytes_jpeg(quality);
|
|
61
|
+
if (fits(jpeg.length))
|
|
62
|
+
return result(jpeg, "image/jpeg", w, h);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
opaque?.free();
|
|
67
|
+
resized.free();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
throw new ImageAttachmentError("image-output");
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof ImageAttachmentError)
|
|
74
|
+
throw error;
|
|
75
|
+
throw new ImageAttachmentError("image-conversion");
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
image?.free();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function positive(value, fallback) {
|
|
82
|
+
if (value === undefined)
|
|
83
|
+
return fallback;
|
|
84
|
+
if (!Number.isFinite(value) || value < 1)
|
|
85
|
+
throw new ImageAttachmentError("image-output");
|
|
86
|
+
return Math.floor(value);
|
|
87
|
+
}
|
|
88
|
+
function result(bytes, mimeType, width, height) {
|
|
89
|
+
return { data: Buffer.from(bytes).toString("base64"), mimeType, width, height, transformed: true };
|
|
90
|
+
}
|
|
91
|
+
function orientPixels(pixels, width, height, orientation) {
|
|
92
|
+
const swapped = orientation >= 5;
|
|
93
|
+
const outputWidth = swapped ? height : width, outputHeight = swapped ? width : height;
|
|
94
|
+
const output = new Uint8Array(pixels.length);
|
|
95
|
+
for (let y = 0; y < height; y++)
|
|
96
|
+
for (let x = 0; x < width; x++) {
|
|
97
|
+
let dx = x, dy = y;
|
|
98
|
+
if (orientation === 2)
|
|
99
|
+
dx = width - 1 - x;
|
|
100
|
+
if (orientation === 3) {
|
|
101
|
+
dx = width - 1 - x;
|
|
102
|
+
dy = height - 1 - y;
|
|
103
|
+
}
|
|
104
|
+
if (orientation === 4)
|
|
105
|
+
dy = height - 1 - y;
|
|
106
|
+
if (orientation === 5) {
|
|
107
|
+
dx = y;
|
|
108
|
+
dy = x;
|
|
109
|
+
}
|
|
110
|
+
if (orientation === 6) {
|
|
111
|
+
dx = height - 1 - y;
|
|
112
|
+
dy = x;
|
|
113
|
+
}
|
|
114
|
+
if (orientation === 7) {
|
|
115
|
+
dx = height - 1 - y;
|
|
116
|
+
dy = width - 1 - x;
|
|
117
|
+
}
|
|
118
|
+
if (orientation === 8) {
|
|
119
|
+
dx = y;
|
|
120
|
+
dy = width - 1 - x;
|
|
121
|
+
}
|
|
122
|
+
const from = (y * width + x) * 4, to = (dy * outputWidth + dx) * 4;
|
|
123
|
+
output.set(pixels.subarray(from, from + 4), to);
|
|
124
|
+
}
|
|
125
|
+
return { pixels: output, width: outputWidth, height: outputHeight };
|
|
126
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const MAX_SOURCE_IMAGE_BYTES: number;
|
|
2
|
+
export declare const MAX_SOURCE_PIXELS = 40000000;
|
|
3
|
+
export declare const MAX_SOURCE_DIMENSION = 32768;
|
|
4
|
+
export declare const IMAGE_PREPARATION_MS = 15000;
|
|
5
|
+
export interface ImageSourceInfo {
|
|
6
|
+
readonly width: number;
|
|
7
|
+
readonly height: number;
|
|
8
|
+
readonly mimeType: string;
|
|
9
|
+
readonly orientation: number;
|
|
10
|
+
readonly conversionUnsafe: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function assertSourceBytes(length: number): void;
|
|
13
|
+
export declare function sourceImageInfo(bytes: Uint8Array, mimeType: string): ImageSourceInfo;
|