@timurproko/a1 0.1.8-dev.472 → 0.1.8-dev.508
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/bin/cli.js +4 -5
- package/bin/guardian.js +5 -1
- package/bin/module-identity.js +53 -98
- package/bin/module-resolver.js +138 -0
- package/bin/pinned-pi-public.js +25 -6
- package/bin/ui.js +7 -2
- package/bin/update-recovery.js +76 -7
- package/bin/warmup.js +3 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-diagnostics.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-image.js +1 -1
- package/dist/app/session-shell/helper-pool.d.ts +33 -0
- package/dist/app/session-shell/helper-pool.js +98 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation-client.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation-client.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-source.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-worker.js +1 -1
- package/dist/app/session-shell/index.d.ts +7 -0
- package/dist/app/session-shell/index.js +4 -0
- package/dist/app/session-shell/paste-executor.d.ts +18 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-executor.js +50 -29
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-helper.js +1 -1
- package/dist/app/session-shell/paste-preparation-client.d.ts +31 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-preparation-client.js +19 -8
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-protocol.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-protocol.js +1 -1
- package/dist/app/session-shell/paste-text-preparation.d.ts +6 -0
- package/dist/{integrations/pi/session-ui/paste-text-preparation.d.ts → app/session-shell/paste-types.d.ts} +1 -4
- package/dist/{integrations/pi/session-ui → app/session-shell}/path-chip-presentation.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-chips.d.ts +5 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-chips.js +6 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-history-controller.d.ts +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-history-controller.js +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.js +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-coordinator.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-coordinator.js +3 -5
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-helper.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-protocol.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-transport.d.ts +10 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-transport.js +45 -19
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell-root.d.ts +75 -53
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell-root.js +30 -20
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell.d.ts +9 -8
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell.js +108 -67
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-viewport-controller.d.ts +5 -5
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-viewport-controller.js +5 -5
- package/dist/{integrations/pi/session-ui → app/session-shell}/system-clipboard.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/system-clipboard.js +1 -1
- package/dist/cli/index.d.ts +8 -5
- package/dist/cli/index.js +4 -5
- package/dist/composition/index.d.ts +0 -1
- package/dist/composition/index.js +0 -1
- package/dist/composition/owned-ui.d.ts +2 -2
- package/dist/composition/owned-ui.js +35 -36
- package/dist/composition/settings-route-host.d.ts +2 -2
- package/dist/contracts/agent-engine/domain.d.ts +6 -1
- package/dist/contracts/agent-engine/index.d.ts +11 -8
- package/dist/contracts/agent-engine/index.js +6 -8
- package/dist/contracts/owned-ui/extension-ui.d.ts +8 -0
- package/dist/contracts/owned-ui/index.d.ts +12 -8
- package/dist/contracts/owned-ui/index.js +8 -8
- package/dist/features/launch/index.d.ts +12 -6
- package/dist/features/launch/index.js +6 -6
- package/dist/features/launch/intent.d.ts +5 -5
- package/dist/features/launch/intent.js +2 -2
- package/dist/features/owned-ui/index.d.ts +6 -6
- package/dist/features/owned-ui/index.js +4 -6
- package/dist/features/owned-ui/run.d.ts +2 -2
- package/dist/features/owned-ui/settings-app.d.ts +2 -2
- package/dist/features/owned-ui/settings-app.js +18 -5
- package/dist/features/prompt-history/service.d.ts +1 -1
- package/dist/features/prompt-history/service.js +1 -1
- package/dist/features/prompt-history/store.js +3 -7
- package/dist/features/prompt-suggestions/diagnostics.js +1 -1
- package/dist/features/prompt-suggestions/index.d.ts +2 -1
- package/dist/features/prompt-suggestions/index.js +1 -1
- package/dist/foundation/launch-guardian/index.d.ts +2 -1
- package/dist/foundation/launch-guardian/index.js +1 -1
- package/dist/foundation/lifecycle/index.d.ts +11 -6
- package/dist/foundation/lifecycle/index.js +5 -6
- package/dist/foundation/process-containment/index.d.ts +8 -6
- package/dist/foundation/process-containment/index.js +6 -6
- package/dist/foundation/process-containment/native-guardian-containment.js +3 -3
- package/dist/foundation/protocol/index.d.ts +3 -2
- package/dist/foundation/protocol/index.js +2 -2
- package/dist/foundation/release/bootstrap.d.ts +0 -4
- package/dist/foundation/release/bootstrap.js +1 -82
- package/dist/foundation/release/dependency-layer.d.ts +2 -5
- package/dist/foundation/release/endpoints.d.ts +4 -0
- package/dist/foundation/release/endpoints.js +86 -2
- package/dist/foundation/release/index.d.ts +30 -16
- package/dist/foundation/release/index.js +16 -16
- package/dist/foundation/release/release.d.ts +1 -1
- package/dist/foundation/release/types.d.ts +11 -0
- package/dist/foundation/release/types.js +1 -0
- package/dist/foundation/release/update-transaction.d.ts +1 -1
- package/dist/foundation/release/update.d.ts +2 -1
- package/dist/foundation/release/update.js +3 -18
- package/dist/foundation/startup/index.d.ts +4 -2
- package/dist/foundation/startup/index.js +2 -2
- package/dist/foundation/startup/startup-descriptor.js +2 -2
- package/dist/foundation/storage/control-store.d.ts +1 -45
- package/dist/foundation/storage/control-store.js +54 -277
- package/dist/foundation/storage/index.d.ts +1 -1
- package/dist/foundation/storage/index.js +1 -1
- package/dist/foundation/supervision/index.d.ts +2 -2
- package/dist/foundation/supervision/index.js +2 -2
- package/dist/foundation/supervision/server.d.ts +5 -10
- package/dist/foundation/supervision/server.js +7 -7
- package/dist/foundation/terminal-cleanup/index.d.ts +3 -2
- package/dist/foundation/terminal-cleanup/index.js +2 -2
- package/dist/integrations/pi/components/editor-interaction.d.ts +1 -1
- package/dist/integrations/pi/components/history-editor-loader.d.ts +1 -1
- package/dist/integrations/pi/components/index.d.ts +20 -13
- package/dist/integrations/pi/components/index.js +12 -13
- package/dist/integrations/pi/components/owned-editor-ux.js +5 -8
- package/dist/integrations/pi/components/resources/builtin-themes.d.ts +7 -5
- package/dist/integrations/pi/components/resources/builtin-themes.js +7 -5
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +1 -1
- package/dist/integrations/pi/components/shell-extension-ui.js +2 -1
- package/dist/integrations/pi/components/shell-footer-status.js +1 -1
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +1 -1
- package/dist/integrations/pi/components/shell-presenters-info.js +1 -1
- package/dist/integrations/pi/components/shell-presenters-transcript.js +1 -1
- package/dist/integrations/pi/components/shell-selectors-dialogs.d.ts +9 -3
- package/dist/integrations/pi/components/shell-selectors-dialogs.js +9 -6
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +3 -1
- package/dist/integrations/pi/components/shell-shared-facade.js +4 -2
- package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +1 -1
- package/dist/integrations/pi/components/submitted-prompt-adapter.js +1 -1
- package/dist/integrations/pi/components/tool-image-presentation.d.ts +1 -1
- package/dist/integrations/pi/components/tool-image-presentation.js +4 -7
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +36 -22
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +43 -7
- package/dist/integrations/pi/components/upstream/assets/earendil-image.json +2 -2
- package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +6 -3
- package/dist/integrations/pi/components/upstream/components/daxnuts.d.ts +8 -1
- package/dist/integrations/pi/components/upstream/components/daxnuts.js +7 -3
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +10 -4
- package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +7 -4
- package/dist/integrations/pi/components/upstream/components/extension-editor.js +7 -4
- package/dist/integrations/pi/components/upstream/components/mermaid.js +8 -4
- package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +9 -5
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +10 -6
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +8 -4
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +27 -25
- package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/session-footer.js +8 -10
- package/dist/integrations/pi/components/upstream/components/session-selector-search.js +6 -4
- package/dist/integrations/pi/components/upstream/components/session-selector.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/session-selector.js +8 -4
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +7 -5
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +8 -6
- package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +9 -4
- package/dist/integrations/pi/components/upstream/components/status-indicator.js +15 -5
- package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +8 -2
- package/dist/integrations/pi/components/upstream/components/tool-execution.js +58 -37
- package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +7 -4
- package/dist/integrations/pi/components/upstream/components/tree-selector.js +7 -4
- package/dist/integrations/pi/components/upstream/components/trust-selector.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/trust-selector.js +10 -5
- package/dist/integrations/pi/components/upstream/external-editor.js +8 -4
- package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +13 -4
- package/dist/integrations/pi/components/upstream/history/editor-core.js +112 -30
- package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +6 -3
- package/dist/integrations/pi/components/upstream/history/kill-ring.js +6 -3
- package/dist/integrations/pi/components/upstream/history/printable-key.js +7 -4
- package/dist/integrations/pi/components/upstream/history/text-helpers.js +6 -3
- package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +6 -3
- package/dist/integrations/pi/components/upstream/history/undo-stack.js +6 -3
- package/dist/integrations/pi/components/upstream/history/word-navigation.js +6 -3
- package/dist/integrations/pi/components/upstream/model-search.d.ts +5 -2
- package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +8 -0
- package/dist/integrations/pi/components/upstream/theme/theme-controller.js +0 -3
- package/dist/integrations/pi/components/upstream/theme/theme.d.ts +2 -2
- package/dist/integrations/pi/components/upstream/theme/theme.js +17 -6
- package/dist/integrations/pi/engine/adapter.d.ts +39 -138
- package/dist/integrations/pi/engine/adapter.js +338 -3226
- package/dist/integrations/pi/engine/command-dispatch.d.ts +41 -0
- package/dist/integrations/pi/engine/command-dispatch.js +125 -0
- package/dist/integrations/pi/engine/event-delivery.d.ts +100 -0
- package/dist/integrations/pi/engine/event-delivery.js +184 -0
- package/dist/integrations/pi/engine/extension-ui-binding.d.ts +35 -0
- package/dist/integrations/pi/engine/extension-ui-binding.js +81 -0
- package/dist/integrations/pi/engine/index.d.ts +18 -14
- package/dist/integrations/pi/engine/index.js +10 -14
- package/dist/integrations/pi/engine/message-values.d.ts +29 -0
- package/dist/integrations/pi/engine/message-values.js +168 -0
- package/dist/integrations/pi/engine/pending-delivery.d.ts +2 -2
- package/dist/integrations/pi/engine/pending-delivery.js +2 -4
- package/dist/integrations/pi/engine/pi-settings-metadata.json +382 -371
- package/dist/integrations/pi/engine/prompt-suggestions.d.ts +30 -0
- package/dist/integrations/pi/engine/prompt-suggestions.js +102 -0
- package/dist/integrations/pi/engine/provider-authentication.d.ts +34 -0
- package/dist/integrations/pi/engine/provider-authentication.js +209 -0
- package/dist/integrations/pi/engine/resource-catalog.d.ts +49 -0
- package/dist/integrations/pi/engine/resource-catalog.js +289 -0
- package/dist/integrations/pi/engine/resources/changelog.json +4 -4
- package/dist/integrations/pi/engine/session-events.d.ts +48 -0
- package/dist/integrations/pi/engine/session-events.js +223 -0
- package/dist/integrations/pi/engine/session-integration.js +2 -4
- package/dist/integrations/pi/engine/session-runtime.d.ts +84 -0
- package/dist/integrations/pi/engine/session-runtime.js +249 -0
- package/dist/integrations/pi/engine/{settings-effects.d.ts → settings-bridge.d.ts} +57 -2
- package/dist/integrations/pi/engine/settings-bridge.js +514 -0
- package/dist/integrations/pi/engine/settings-metadata.d.ts +31 -0
- package/dist/integrations/pi/engine/settings-metadata.js +67 -0
- package/dist/integrations/pi/engine/settings-port.d.ts +42 -0
- package/dist/integrations/pi/engine/settings-port.js +353 -0
- package/dist/integrations/pi/engine/transcript-projection.d.ts +39 -0
- package/dist/integrations/pi/engine/transcript-projection.js +405 -0
- package/dist/integrations/pi/engine/usage-view.d.ts +4 -0
- package/dist/integrations/pi/engine/usage-view.js +56 -0
- package/dist/integrations/pi/engine/workflow-contexts.d.ts +59 -0
- package/dist/integrations/pi/engine/workflow-contexts.js +316 -0
- package/dist/integrations/pi/engine/workflow-runner.d.ts +60 -0
- package/dist/integrations/pi/engine/workflow-runner.js +509 -0
- package/dist/integrations/pi/engine/workflow-support.d.ts +33 -0
- package/dist/integrations/pi/engine/workflow-support.js +352 -0
- package/dist/integrations/pi/engine/workflows.d.ts +63 -2
- package/dist/integrations/pi/engine/workflows.js +5 -2
- package/dist/integrations/pi/startup-public.js +576 -554
- package/dist/integrations/pi/startup-public.manifest.json +1730 -984
- package/dist/integrations/pi/tui-runtime/adapter.js +10 -13
- package/dist/integrations/pi/tui-runtime/contracts.d.ts +11 -1
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +1 -1
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +4 -7
- package/dist/integrations/pi/tui-runtime/index.d.ts +8 -6
- package/dist/integrations/pi/tui-runtime/index.js +4 -6
- package/dist/integrations/pi/tui-runtime/mouse-report-input.js +2 -4
- package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +2 -2
- package/dist/integrations/pi/tui-runtime/overlay-geometry.js +4 -5
- package/dist/integrations/pi/tui-runtime/presentation-adapter.js +1 -1
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/runtime-payload-inventory.json +51320 -46509
- package/dist/ui/apps/index.d.ts +5 -3
- package/dist/ui/apps/index.js +3 -3
- package/dist/ui/components/index.d.ts +47 -25
- package/dist/ui/components/index.js +25 -25
- package/dist/ui/components/prompt-input.js +1 -4
- package/dist/ui/settings/declarations.d.ts +119 -0
- package/dist/ui/settings/declarations.js +20 -11
- package/dist/ui/settings/index.d.ts +10 -6
- package/dist/ui/settings/index.js +5 -6
- package/dist/ui/settings/manager.d.ts +54 -0
- package/dist/ui/settings/{session.js → manager.js} +101 -9
- package/dist/ui/settings/sections.d.ts +2 -7
- package/docs/architecture/boundaries.md +4 -4
- package/docs/architecture/history-editor-provenance.md +1 -1
- package/docs/architecture/project-structure.md +6 -6
- package/docs/architecture/prompt-suggestions.md +1 -1
- package/docs/architecture/terminal-host-proof-gate.md +1 -1
- package/docs/architecture/terminal-host-spike-evidence.md +1 -1
- package/docs/architecture/toolchain.md +8 -0
- package/docs/architecture/ui-reference-provenance.md +4 -4
- package/docs/ci-release-runbook.md +7 -1
- package/docs/features/modal-content-interaction.md +2 -2
- package/docs/local-worktree-cleanup.md +4 -2
- package/docs/validation.md +6 -4
- package/package.json +7 -11
- package/bin/pi-tui.d.ts +0 -6
- package/bin/pi-tui.js +0 -28
- package/bin/sync-pi-tui-proxy.js +0 -97
- package/dist/cli/version.d.ts +0 -2
- package/dist/cli/version.js +0 -23
- package/dist/composition/agent-engine-bridge.d.ts +0 -3
- package/dist/composition/agent-engine-bridge.js +0 -108
- package/dist/composition/process.d.ts +0 -16
- package/dist/composition/process.js +0 -45
- package/dist/contracts/workspace/index.d.ts +0 -2
- package/dist/contracts/workspace/index.js +0 -2
- package/dist/contracts/workspace/model.d.ts +0 -248
- package/dist/contracts/workspace/model.js +0 -2
- package/dist/contracts/workspace/validation.d.ts +0 -13
- package/dist/contracts/workspace/validation.js +0 -335
- package/dist/features/owned-ui/customization.d.ts +0 -40
- package/dist/features/owned-ui/customization.js +0 -110
- package/dist/features/owned-ui/diagnostics.d.ts +0 -34
- package/dist/features/owned-ui/diagnostics.js +0 -95
- package/dist/features/workspace/capabilities.d.ts +0 -31
- package/dist/features/workspace/capabilities.js +0 -75
- package/dist/features/workspace/index.d.ts +0 -6
- package/dist/features/workspace/index.js +0 -6
- package/dist/features/workspace/presentation.d.ts +0 -30
- package/dist/features/workspace/presentation.js +0 -70
- package/dist/features/workspace/reconciliation.d.ts +0 -15
- package/dist/features/workspace/reconciliation.js +0 -82
- package/dist/features/workspace/reducer.d.ts +0 -43
- package/dist/features/workspace/reducer.js +0 -214
- package/dist/features/workspace/router.d.ts +0 -32
- package/dist/features/workspace/router.js +0 -125
- package/dist/features/workspace/store.d.ts +0 -18
- package/dist/features/workspace/store.js +0 -55
- package/dist/foundation/native-host-protocol/codec.d.ts +0 -13
- package/dist/foundation/native-host-protocol/codec.js +0 -58
- package/dist/foundation/native-host-protocol/evidence.d.ts +0 -67
- package/dist/foundation/native-host-protocol/evidence.js +0 -141
- package/dist/foundation/native-host-protocol/index.d.ts +0 -4
- package/dist/foundation/native-host-protocol/index.js +0 -4
- package/dist/foundation/native-host-protocol/messages.d.ts +0 -56
- package/dist/foundation/native-host-protocol/messages.js +0 -149
- package/dist/foundation/native-host-protocol/proof-gate.d.ts +0 -13
- package/dist/foundation/native-host-protocol/proof-gate.js +0 -33
- package/dist/foundation/structured-agent-runtime/backpressure.d.ts +0 -47
- package/dist/foundation/structured-agent-runtime/backpressure.js +0 -119
- package/dist/foundation/structured-agent-runtime/commands.d.ts +0 -53
- package/dist/foundation/structured-agent-runtime/commands.js +0 -165
- package/dist/foundation/structured-agent-runtime/handshake.d.ts +0 -41
- package/dist/foundation/structured-agent-runtime/handshake.js +0 -151
- package/dist/foundation/structured-agent-runtime/index.d.ts +0 -5
- package/dist/foundation/structured-agent-runtime/index.js +0 -5
- package/dist/foundation/structured-agent-runtime/reconnection.d.ts +0 -38
- package/dist/foundation/structured-agent-runtime/reconnection.js +0 -130
- package/dist/foundation/structured-agent-runtime/state.d.ts +0 -57
- package/dist/foundation/structured-agent-runtime/state.js +0 -119
- package/dist/integrations/pi/components/upstream/components/custom-entry.d.ts +0 -17
- package/dist/integrations/pi/components/upstream/components/custom-entry.js +0 -51
- package/dist/integrations/pi/components/upstream/components/first-time-setup.d.ts +0 -24
- package/dist/integrations/pi/components/upstream/components/first-time-setup.js +0 -105
- package/dist/integrations/pi/components/upstream/components/markdown-transform.d.ts +0 -2
- package/dist/integrations/pi/components/upstream/components/markdown-transform.js +0 -18
- package/dist/integrations/pi/engine/model-auth-integration.d.ts +0 -31
- package/dist/integrations/pi/engine/model-auth-integration.js +0 -62
- package/dist/integrations/pi/engine/resource-extension-integration.d.ts +0 -32
- package/dist/integrations/pi/engine/resource-extension-integration.js +0 -81
- package/dist/integrations/pi/engine/settings-effects.js +0 -249
- package/dist/integrations/pi/engine/settings-integration.d.ts +0 -43
- package/dist/integrations/pi/engine/settings-integration.js +0 -227
- package/dist/integrations/pi/engine/workflow-controllers.d.ts +0 -21
- package/dist/integrations/pi/engine/workflow-controllers.js +0 -49
- package/dist/integrations/pi/session-ui/index.d.ts +0 -5
- package/dist/integrations/pi/session-ui/index.js +0 -5
- package/dist/integrations/pi/session-ui/paste-executor.d.ts +0 -10
- package/dist/integrations/pi/session-ui/paste-preparation-client.d.ts +0 -16
- package/dist/integrations/pi/session-ui/route-host.d.ts +0 -5
- package/dist/integrations/pi/tui-runtime/conformance.d.ts +0 -18
- package/dist/integrations/pi/tui-runtime/conformance.js +0 -145
- package/dist/ui/components/prompt-row.d.ts +0 -14
- package/dist/ui/components/prompt-row.js +0 -20
- package/dist/ui/settings/session.d.ts +0 -36
- package/dist/ui/settings/store.d.ts +0 -29
- package/dist/ui/settings/store.js +0 -91
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-diagnostics.js +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-image.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/editor-hyperlink-budget.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/editor-hyperlink-budget.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-source.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-worker.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-helper.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-preparation.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-worker.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-worker.js +0 -0
- package/dist/{integrations/pi/session-ui/response-copy-helper.d.ts → app/session-shell/paste-types.js} +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/path-chip-presentation.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro-effects.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro-effects.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro.d.ts +0 -0
- package/dist/{integrations/pi/session-ui/route-host.js → app/session-shell/response-copy-helper.d.ts} +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-protocol.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/stream-presentation-coalescer.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/stream-presentation-coalescer.js +3 -3
- /package/dist/{integrations/pi/session-ui → app/session-shell}/text-paste.d.ts +0 -0
- /package/dist/{integrations/pi/session-ui → app/session-shell}/text-paste.js +0 -0
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { ImageAttachmentError } from "
|
|
2
|
-
import { startPasteExecutor } from "./paste-executor.js";
|
|
1
|
+
import { ImageAttachmentError } from "../../contracts/owned-ui/index.js";
|
|
2
|
+
import { createPasteHelperPool, startPasteExecutor } from "./paste-executor.js";
|
|
3
3
|
import { PASTE_READ_MS, PASTE_REQUESTS, PASTE_STOP_MS, PASTE_TOTAL_MS } from "./paste-protocol.js";
|
|
4
4
|
/** Keeps eight distinct paste transactions alive through insertion; canceled executors retain capacity until fenced. */
|
|
5
5
|
export class PastePreparationClient {
|
|
6
|
-
onEvent;
|
|
7
6
|
#active = new Set();
|
|
7
|
+
#onEvent;
|
|
8
|
+
#execute;
|
|
9
|
+
#helper;
|
|
10
|
+
#pool;
|
|
8
11
|
#sequence = 0;
|
|
9
12
|
#disposed = false;
|
|
10
|
-
constructor(
|
|
11
|
-
this
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.#onEvent = options.onEvent;
|
|
15
|
+
this.#execute = options.execute ?? startPasteExecutor;
|
|
16
|
+
this.#helper = options.helper;
|
|
17
|
+
this.#pool = options.execute === undefined ? createPasteHelperPool(options.helper, options.spareIdleMs) : undefined;
|
|
12
18
|
}
|
|
19
|
+
/** Forks the spare helper now so the first paste takes a live child; later pastes rewarm it themselves. */
|
|
20
|
+
warm() { this.#pool?.warm(); }
|
|
21
|
+
/** Whether a spare helper is held; diagnostics and tests only. */
|
|
22
|
+
get warmed() { return this.#pool?.warmed ?? false; }
|
|
13
23
|
start(source, adopt, onImage, onText = () => { }) {
|
|
14
24
|
const controller = new AbortController();
|
|
15
25
|
const id = ++this.#sequence;
|
|
@@ -22,7 +32,7 @@ export class PastePreparationClient {
|
|
|
22
32
|
const emit = (phase, bytes, outcome) => {
|
|
23
33
|
const atMs = performance.now();
|
|
24
34
|
try {
|
|
25
|
-
this
|
|
35
|
+
this.#onEvent?.({ request: id, phase, atMs, elapsedMs: atMs - admitted, pending: this.#active.size, transport: source.kind === "text" ? "terminal" : source.kind,
|
|
26
36
|
...(bytes === undefined ? {} : { bytes }), ...(outcome === undefined ? {} : { outcome }) });
|
|
27
37
|
}
|
|
28
38
|
catch { /* Invariant: observations never affect input. */ }
|
|
@@ -100,7 +110,7 @@ export class PastePreparationClient {
|
|
|
100
110
|
}
|
|
101
111
|
content = read;
|
|
102
112
|
}
|
|
103
|
-
executor =
|
|
113
|
+
executor = this.#execute(content, controller.signal, (phase, bytes) => {
|
|
104
114
|
// Protocol: helper exit precedes adoption; only the request's finally block reports complete cleanup.
|
|
105
115
|
if (phase === "cleanup")
|
|
106
116
|
return;
|
|
@@ -113,7 +123,7 @@ export class PastePreparationClient {
|
|
|
113
123
|
if (phase === "acquired-text")
|
|
114
124
|
onText();
|
|
115
125
|
emit(phase, bytes);
|
|
116
|
-
});
|
|
126
|
+
}, this.#helper, this.#pool);
|
|
117
127
|
const value = await executor.result;
|
|
118
128
|
if (controller.signal.aborted)
|
|
119
129
|
return;
|
|
@@ -150,6 +160,7 @@ export class PastePreparationClient {
|
|
|
150
160
|
async dispose() {
|
|
151
161
|
this.#disposed = true;
|
|
152
162
|
this.reset();
|
|
163
|
+
this.#pool?.dispose();
|
|
153
164
|
let timer;
|
|
154
165
|
await Promise.race([Promise.all([...this.#active].map(active => active.stopped)),
|
|
155
166
|
new Promise(resolve => { timer = setTimeout(resolve, PASTE_STOP_MS); timer.unref(); })]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PiShellClipboardContent } from "
|
|
1
|
+
import type { PiShellClipboardContent } from "../../integrations/pi/components/index.js";
|
|
2
2
|
import type { PreparedPasteText, ClipboardPath } from "./paste-text-preparation.js";
|
|
3
3
|
import type { PreparedImage } from "./image-preparation.js";
|
|
4
4
|
export declare const PASTE_READ_MS = 5000;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_CLIPBOARD_TEXT_BYTES } from "
|
|
1
|
+
import { MAX_CLIPBOARD_TEXT_BYTES } from "../../contracts/owned-ui/index.js";
|
|
2
2
|
export const PASTE_READ_MS = 5_000;
|
|
3
3
|
export const PASTE_TOTAL_MS = 15_000;
|
|
4
4
|
export const PASTE_STOP_MS = 250;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PreparedPasteText } from "./paste-types.js";
|
|
2
|
+
export type { ClipboardPath, PreparedPasteText } from "./paste-types.js";
|
|
3
|
+
/** Small non-path text has a fixed CPU bound and cannot enter filesystem probing. */
|
|
4
|
+
export declare function canPreparePasteInline(text: string): boolean;
|
|
5
|
+
/** The shared chip classifier; interactive callers run path/filesystem probing in an isolated executor. */
|
|
6
|
+
export declare function preparePasteText(text: string, skipPaths?: boolean, compactPaths?: boolean): PreparedPasteText;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Paste classification results shared by text preparation and path chip presentation. */
|
|
1
2
|
export interface ClipboardPath {
|
|
2
3
|
readonly fullPath: string;
|
|
3
4
|
readonly kind: "folder" | "file";
|
|
@@ -14,7 +15,3 @@ export type PreparedPasteText = {
|
|
|
14
15
|
readonly kind: "paths";
|
|
15
16
|
readonly paths: readonly ClipboardPath[];
|
|
16
17
|
};
|
|
17
|
-
/** Small non-path text has a fixed CPU bound and cannot enter filesystem probing. */
|
|
18
|
-
export declare function canPreparePasteInline(text: string): boolean;
|
|
19
|
-
/** The shared chip classifier; interactive callers run path/filesystem probing in an isolated executor. */
|
|
20
|
-
export declare function preparePasteText(text: string, skipPaths?: boolean, compactPaths?: boolean): PreparedPasteText;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClipboardPath, PreparedPasteText } from "./paste-
|
|
1
|
+
import type { ClipboardPath, PreparedPasteText } from "./paste-types.js";
|
|
2
2
|
export declare const PATH_CHIP_PRESENTATION_UNITS = 4096;
|
|
3
3
|
export declare const PATH_CHIP_SUFFIX_UNITS = 20;
|
|
4
4
|
/** Shared base tag for presentation budgeting and actual chip adoption, including image-file spacing. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PiShellClipboardContent, PiShellEditorTextRange } from "
|
|
1
|
+
import type { PiShellClipboardContent, PiShellEditorTextRange } from "../../integrations/pi/components/shell-shared-facade.js";
|
|
2
|
+
import { type PastePreparationClientOptions } from "./paste-preparation-client.js";
|
|
2
3
|
import type { PasteEvent, PasteSource } from "./paste-protocol.js";
|
|
3
4
|
export interface PromptImageAttachment {
|
|
4
5
|
readonly type: "image";
|
|
@@ -15,7 +16,10 @@ export declare class PromptChipStore {
|
|
|
15
16
|
constructor(options?: {
|
|
16
17
|
readonly isolated?: boolean;
|
|
17
18
|
readonly onEvent?: (event: PasteEvent) => void;
|
|
19
|
+
readonly preparation?: Omit<PastePreparationClientOptions, "onEvent">;
|
|
18
20
|
});
|
|
21
|
+
/** Forks the spare paste helper so the session's first paste does not pay for helper startup. */
|
|
22
|
+
warm(): void;
|
|
19
23
|
beginPaste(currentText: string, read: ((signal: AbortSignal) => Promise<PiShellClipboardContent | null>) | PasteSource, onError: (error: unknown) => void, onImage?: () => void): {
|
|
20
24
|
marker: string;
|
|
21
25
|
result: Promise<string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { canonicalizeClipboardImage } from "./clipboard-image.js";
|
|
4
|
-
import { assertImageEncodedSize, assertPromptImages, ImageAttachmentError } from "
|
|
4
|
+
import { assertImageEncodedSize, assertPromptImages, ImageAttachmentError } from "../../contracts/owned-ui/index.js";
|
|
5
5
|
import { ImagePreparationClient } from "./image-preparation-client.js";
|
|
6
6
|
import { preparePasteText } from "./paste-text-preparation.js";
|
|
7
7
|
import { pathChipTag } from "./path-chip-presentation.js";
|
|
@@ -26,8 +26,12 @@ export class PromptChipStore {
|
|
|
26
26
|
#provisionalOwners = new Map();
|
|
27
27
|
#ownedChipTags = new Map();
|
|
28
28
|
constructor(options = {}) {
|
|
29
|
-
this.#isolated = options.isolated
|
|
29
|
+
this.#isolated = options.isolated
|
|
30
|
+
? new PastePreparationClient({ ...options.preparation, ...(options.onEvent === undefined ? {} : { onEvent: options.onEvent }) })
|
|
31
|
+
: undefined;
|
|
30
32
|
}
|
|
33
|
+
/** Forks the spare paste helper so the session's first paste does not pay for helper startup. */
|
|
34
|
+
warm() { this.#isolated?.warm(); }
|
|
31
35
|
beginPaste(currentText, read, onError, onImage = () => { }) {
|
|
32
36
|
if (this.#isolated)
|
|
33
37
|
return this.#beginIsolatedPaste(currentText, typeof read === "function" ? { kind: "provided", read } : read, onError, onImage);
|
package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-history-controller.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type PromptHistoryKind, type PromptHistoryPort } from "
|
|
2
|
-
import type { PiShellEditorPort } from "
|
|
1
|
+
import { type PromptHistoryKind, type PromptHistoryPort } from "../../contracts/owned-ui/index.js";
|
|
2
|
+
import type { PiShellEditorPort } from "../../integrations/pi/components/index.js";
|
|
3
3
|
/** Merges bounded recall snapshots; the editor alone owns browsing, draft, cursor, and undo state. */
|
|
4
4
|
export declare class PromptHistoryController {
|
|
5
5
|
#private;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { PROMPT_HISTORY_MAX_TEXT_BYTES } from "
|
|
2
|
+
import { PROMPT_HISTORY_MAX_TEXT_BYTES } from "../../contracts/owned-ui/index.js";
|
|
3
3
|
/** Merges bounded recall snapshots; the editor alone owns browsing, draft, cursor, and undo state. */
|
|
4
4
|
export class PromptHistoryController {
|
|
5
|
-
options;
|
|
6
5
|
#local = new Map();
|
|
7
6
|
#unsubscribe;
|
|
8
7
|
#snapshot;
|
|
@@ -14,6 +13,7 @@ export class PromptHistoryController {
|
|
|
14
13
|
#unsubscribeFailure;
|
|
15
14
|
#closeFailed = false;
|
|
16
15
|
#closePromise;
|
|
16
|
+
options;
|
|
17
17
|
constructor(options) {
|
|
18
18
|
this.options = options;
|
|
19
19
|
if (options.editor.recall === undefined)
|
package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type OwnedUiPromptSuggestionGeneratorPort, type OwnedUiPromptSuggestionIdentity, type OwnedUiPromptSuggestionState, type SuggestionDecision, type SuggestionDecisionReason, type SuggestionDiagnosticObserver } from "
|
|
1
|
+
import { type OwnedUiPromptSuggestionGeneratorPort, type OwnedUiPromptSuggestionIdentity, type OwnedUiPromptSuggestionState, type SuggestionDecision, type SuggestionDecisionReason, type SuggestionDiagnosticObserver } from "../../contracts/owned-ui/index.js";
|
|
2
2
|
export interface ContextualPromptSuggestionSurface {
|
|
3
3
|
canPresent(identity: OwnedUiPromptSuggestionIdentity): boolean;
|
|
4
4
|
presentationBlockReason?(identity: OwnedUiPromptSuggestionIdentity): SuggestionDecision;
|
package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.js
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { assertOwnedUiPromptSuggestionResult, normalizePromptSuggestionCandidate, } from "
|
|
1
|
+
import { assertOwnedUiPromptSuggestionResult, normalizePromptSuggestionCandidate, } from "../../contracts/owned-ui/index.js";
|
|
2
2
|
/** Prefetches one inert candidate; owns retirement even when a provider ignores abort. */
|
|
3
3
|
export class ContextualPromptSuggestionController {
|
|
4
|
-
options;
|
|
5
4
|
#state = { status: "idle" };
|
|
6
5
|
#request = null;
|
|
7
6
|
#lastConsidered = "";
|
|
@@ -12,6 +11,7 @@ export class ContextualPromptSuggestionController {
|
|
|
12
11
|
#requestSequence = 0;
|
|
13
12
|
#timeoutMs;
|
|
14
13
|
#now;
|
|
14
|
+
options;
|
|
15
15
|
constructor(options) {
|
|
16
16
|
this.options = options;
|
|
17
17
|
this.#enabled = options.enabled;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* terminal never shows a half-painted step, and playback is bounded so a slow
|
|
6
6
|
* terminal cannot delay restoration past the configured clamp.
|
|
7
7
|
*/
|
|
8
|
-
import { displayWidth, truncateToWidth } from "
|
|
8
|
+
import { displayWidth, truncateToWidth } from "../../ui/components/index.js";
|
|
9
9
|
import { createQuitOutroPlan } from "./quit-outro-effects.js";
|
|
10
10
|
export const QUIT_OUTRO_MIN_MS = 300;
|
|
11
11
|
export const QUIT_OUTRO_MAX_MS = 2000;
|
package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-coordinator.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SelectionCopySnapshot } from "
|
|
1
|
+
import { type SelectionCopySnapshot } from "../../ui/components/selection-copy.js";
|
|
2
2
|
import { type CopyResult, type ResponseCopyEvent } from "./response-copy-protocol.js";
|
|
3
3
|
import type { ResponseCopyExecutor } from "./response-copy-transport.js";
|
|
4
4
|
/** Owns one delivery and one newest pending copy, including expiry and side-effect fencing. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { MAX_COPY_SOURCE_UNITS } from "
|
|
1
|
+
import { MAX_COPY_SOURCE_UNITS } from "../../ui/components/selection-copy.js";
|
|
2
2
|
import { COPY_CLEANUP_MS, COPY_DEADLINE_MS } from "./response-copy-protocol.js";
|
|
3
3
|
/** Owns one delivery and one newest pending copy, including expiry and side-effect fencing. */
|
|
4
4
|
export class ResponseCopyCoordinator {
|
|
5
|
-
options;
|
|
6
5
|
#sequence = 0;
|
|
7
6
|
#epoch = 0;
|
|
8
7
|
#active;
|
|
@@ -11,9 +10,8 @@ export class ResponseCopyCoordinator {
|
|
|
11
10
|
#latestPending = false;
|
|
12
11
|
#disposed = false;
|
|
13
12
|
#quarantined = false;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
options;
|
|
14
|
+
constructor(options) { this.options = options; }
|
|
17
15
|
get busy() { return this.#active !== undefined || this.#pending !== undefined; }
|
|
18
16
|
get latest() { return this.#latest; }
|
|
19
17
|
/** Exact prompt copy/cut shares the write lifetime without transcript text transformations. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_COPY_ROWS, MAX_COPY_SOURCE_UNITS, selectionCopyRowText } from "
|
|
1
|
+
import { MAX_COPY_ROWS, MAX_COPY_SOURCE_UNITS, selectionCopyRowText } from "../../ui/components/index.js";
|
|
2
2
|
import { COPY_CHUNK_UNITS, MAX_COPY_BYTES, MAX_COPY_CONTROL_BYTES } from "./response-copy-protocol.js";
|
|
3
3
|
// Security: this isolated executor never inherits the UI terminal and never logs clipboard contents.
|
|
4
4
|
let header;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OrderedTextSelection, SelectionCopyPrompt } from "
|
|
1
|
+
import type { OrderedTextSelection, SelectionCopyPrompt } from "../../ui/components/index.js";
|
|
2
2
|
export declare const COPY_DEADLINE_MS = 5000;
|
|
3
3
|
export declare const COPY_CLEANUP_MS = 250;
|
|
4
4
|
export declare const MAX_COPY_BYTES: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SelectionCopySnapshot } from "
|
|
1
|
+
import type { SelectionCopySnapshot } from "../../ui/components/selection-copy.js";
|
|
2
2
|
import { type CopyResult } from "./response-copy-protocol.js";
|
|
3
3
|
export interface ResponseCopyJob {
|
|
4
4
|
readonly result: Promise<CopyResult>;
|
|
@@ -8,6 +8,12 @@ export interface ResponseCopyJob {
|
|
|
8
8
|
}
|
|
9
9
|
export type CopyPhaseObserver = (phase: "extracted" | "encoded" | "submitting", bytes: number, transport: "native" | "terminal" | "injected") => void;
|
|
10
10
|
export type ResponseCopyExecutor = (snapshot: SelectionCopySnapshot, phase: CopyPhaseObserver) => ResponseCopyJob;
|
|
11
|
+
/** The production executor also owns a spare helper; the owner warms it at start and disposes it at shutdown. */
|
|
12
|
+
export interface OwnedResponseCopyExecutor extends ResponseCopyExecutor {
|
|
13
|
+
warm(): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
readonly warmed: boolean;
|
|
16
|
+
}
|
|
11
17
|
export interface ResponseCopyTerminal {
|
|
12
18
|
readonly maxBytes?: number;
|
|
13
19
|
/** A supported non-blocking submission boundary, not clipboard acknowledgment. */
|
|
@@ -28,4 +34,6 @@ export declare function createResponseCopyExecutor(options?: {
|
|
|
28
34
|
readonly writeText?: (text: string, signal: AbortSignal) => Promise<void>;
|
|
29
35
|
/** Package/fault-test seam: the production helper is always an emitted sibling. */
|
|
30
36
|
readonly helper?: URL;
|
|
31
|
-
|
|
37
|
+
/** Idle bound for the spare helper; production keeps the default. */
|
|
38
|
+
readonly spareIdleMs?: number;
|
|
39
|
+
}): OwnedResponseCopyExecutor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fork } from "node:child_process";
|
|
2
2
|
import { fstatSync } from "node:fs";
|
|
3
|
+
import { HelperPool } from "./helper-pool.js";
|
|
3
4
|
import { COPY_CHUNK_UNITS, COPY_CLEANUP_MS, MAX_COPY_BYTES, MAX_COPY_CONTROL_BYTES } from "./response-copy-protocol.js";
|
|
4
5
|
/** Never substitute a remote host's native clipboard for the terminal user's clipboard. */
|
|
5
6
|
export function responseCopyDestination(env) {
|
|
@@ -22,7 +23,8 @@ export function hasAsyncClipboardOutput(platform = process.platform, stdout = pr
|
|
|
22
23
|
}
|
|
23
24
|
/** Isolates preparation and native clipboard access; only the owner may submit terminal controls. */
|
|
24
25
|
export function createResponseCopyExecutor(options = {}) {
|
|
25
|
-
|
|
26
|
+
const pool = new HelperPool({ fork: () => forkCopyHelper(options.helper), stop: stopCopyHelper, ...(options.spareIdleMs === undefined ? {} : { idleMs: options.spareIdleMs }) });
|
|
27
|
+
const execute = (snapshot, phase) => {
|
|
26
28
|
const controller = new AbortController();
|
|
27
29
|
let active;
|
|
28
30
|
const run = async () => {
|
|
@@ -33,7 +35,7 @@ export function createResponseCopyExecutor(options = {}) {
|
|
|
33
35
|
if (mode === "terminal" && options.terminal === undefined) {
|
|
34
36
|
return { kind: "result", result: { outcome: "failed", failure: "unsafe" } };
|
|
35
37
|
}
|
|
36
|
-
active = startHelper(snapshot, mode, options.terminal?.maxBytes ?? MAX_COPY_CONTROL_BYTES, phase, options.helper);
|
|
38
|
+
active = startHelper(snapshot, mode, options.terminal?.maxBytes ?? MAX_COPY_CONTROL_BYTES, phase, options.helper, pool);
|
|
37
39
|
if (controller.signal.aborted)
|
|
38
40
|
active.cancel();
|
|
39
41
|
return active.result;
|
|
@@ -65,6 +67,28 @@ export function createResponseCopyExecutor(options = {}) {
|
|
|
65
67
|
const result = run().catch(() => ({ outcome: controller.signal.aborted ? "canceled" : "failed", failure: "transport" }));
|
|
66
68
|
return { result, stopped: result.then(() => { }), cancel: () => { controller.abort(); active?.cancel(); } };
|
|
67
69
|
};
|
|
70
|
+
// Rationale: `Object.assign` would copy the getter's value once; the accessor must read the pool each time.
|
|
71
|
+
return Object.defineProperties(execute, {
|
|
72
|
+
warm: { value: () => pool.warm() },
|
|
73
|
+
dispose: { value: () => pool.dispose() },
|
|
74
|
+
warmed: { get: () => pool.warmed },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** Forks one copy helper: bounded IPC only, no clipboard payload in argv or temp files, no inherited terminal descriptors. */
|
|
78
|
+
function forkCopyHelper(helper) {
|
|
79
|
+
const source = new URL(import.meta.url).pathname.endsWith(".ts");
|
|
80
|
+
const entry = helper ?? new URL(source ? "./response-copy-helper.ts" : "./response-copy-helper.js", import.meta.url);
|
|
81
|
+
const forkOptions = {
|
|
82
|
+
execArgv: entry.pathname.endsWith(".ts") ? ["--import", "tsx"] : [],
|
|
83
|
+
stdio: ["ignore", "ignore", "ignore", "ipc"], windowsHide: true,
|
|
84
|
+
serialization: "json",
|
|
85
|
+
};
|
|
86
|
+
return fork(entry, [], forkOptions);
|
|
87
|
+
}
|
|
88
|
+
function stopCopyHelper(child) {
|
|
89
|
+
child.kill("SIGKILL");
|
|
90
|
+
child.unref();
|
|
91
|
+
child.channel?.unref();
|
|
68
92
|
}
|
|
69
93
|
function* sourceMessages(snapshot, mode, controlLimit) {
|
|
70
94
|
yield { kind: "begin", selection: snapshot.selection, rows: snapshot.rows.length, mode, controlLimit,
|
|
@@ -77,16 +101,10 @@ function* sourceMessages(snapshot, mode, controlLimit) {
|
|
|
77
101
|
}
|
|
78
102
|
yield { kind: "finish" };
|
|
79
103
|
}
|
|
80
|
-
function startHelper(snapshot, mode, controlLimit, phase, helper) {
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
const forkOptions = {
|
|
85
|
-
execArgv: entry.pathname.endsWith(".ts") ? ["--import", "tsx"] : [],
|
|
86
|
-
stdio: ["ignore", "ignore", "ignore", "ipc"], windowsHide: true,
|
|
87
|
-
serialization: "json",
|
|
88
|
-
};
|
|
89
|
-
const child = fork(entry, [], forkOptions);
|
|
104
|
+
function startHelper(snapshot, mode, controlLimit, phase, helper, pool) {
|
|
105
|
+
// Performance: a warm spare skips fork and module load on the copy's own critical path.
|
|
106
|
+
const spare = pool.take();
|
|
107
|
+
const child = spare?.child ?? forkCopyHelper(helper);
|
|
90
108
|
let iterator = sourceMessages(snapshot, mode, controlLimit);
|
|
91
109
|
let outcome;
|
|
92
110
|
let stopping = false;
|
|
@@ -123,18 +141,21 @@ function startHelper(snapshot, mode, controlLimit, phase, helper) {
|
|
|
123
141
|
resolve(value);
|
|
124
142
|
prepared = [];
|
|
125
143
|
};
|
|
144
|
+
const advance = () => {
|
|
145
|
+
const next = iterator?.next();
|
|
146
|
+
if (next === undefined || next.done) {
|
|
147
|
+
cancel();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
child.send(next.value, error => { if (error)
|
|
151
|
+
cancel(); });
|
|
152
|
+
};
|
|
126
153
|
child.on("message", value => {
|
|
127
154
|
const message = value;
|
|
128
155
|
if (stopping)
|
|
129
156
|
return;
|
|
130
157
|
if (message?.kind === "ready") {
|
|
131
|
-
|
|
132
|
-
if (next === undefined || next.done) {
|
|
133
|
-
cancel();
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
child.send(next.value, error => { if (error)
|
|
137
|
-
cancel(); });
|
|
158
|
+
advance();
|
|
138
159
|
}
|
|
139
160
|
else if (message?.kind === "data") {
|
|
140
161
|
if (mode !== "prepare" || expectedBytes === undefined || typeof message.text !== "string" || message.text.length > COPY_CHUNK_UNITS) {
|
|
@@ -178,6 +199,8 @@ function startHelper(snapshot, mode, controlLimit, phase, helper) {
|
|
|
178
199
|
clearTimeout(cleanup);
|
|
179
200
|
child.removeAllListeners("message");
|
|
180
201
|
settle();
|
|
202
|
+
// Performance: the next copy finds a spare that was forked while nothing waited on it.
|
|
203
|
+
pool.replenish();
|
|
181
204
|
});
|
|
182
205
|
// Platform: spawn failure has no exit event, but has a close event and no live executor to fence.
|
|
183
206
|
child.once("close", () => {
|
|
@@ -186,6 +209,9 @@ function startHelper(snapshot, mode, controlLimit, phase, helper) {
|
|
|
186
209
|
clearTimeout(cleanup);
|
|
187
210
|
settle();
|
|
188
211
|
});
|
|
212
|
+
// Protocol: a spare already announced itself while pooled, so its first request is sent now rather than on "ready".
|
|
213
|
+
if (spare?.ready)
|
|
214
|
+
advance();
|
|
189
215
|
});
|
|
190
216
|
return { result, cancel };
|
|
191
217
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type { OwnedUiPromptSuggestionGeneratorPort, OwnedUiSessionViewModel, OwnedUiViewportSettings, OwnedUiViewportSettingsPort, OwnedUiQuitOutroSettingsPort, SuggestionDecision, SuggestionDiagnosticObserver } from "
|
|
2
|
-
import type { PiTuiPointerSurface } from "
|
|
3
|
-
import type { UiRouteHost } from "
|
|
4
|
-
import type { TranscriptViewportFrame, TranscriptViewportFrameDescriptor } from "
|
|
5
|
-
import type { PiEngineAdapter } from "
|
|
6
|
-
import type { PiWorkflowMessage, PiWorkflowResult } from "
|
|
7
|
-
import { type PiShellClipboardContent, type PiShellComponentPort, type PiShellEditorPort, type PiShellExtensionRendererResolver, type PiShellHeaderOptions, type PiShellHeaderPort, type PiShellImageAssetResolver, type PiShellLoadedResourcesPort, type PiShellResourceEntry, type PiShellTranscriptComponentPort } from "
|
|
8
|
-
import { type PiTuiInputCoordinationScheduler, type PiTuiInputSurfaceKind } from "
|
|
9
|
-
import type { PiTuiComponentPort, PiTuiInputDiagnosticsEvent, PiTuiLayoutNode, PiTuiTerminalPort } from "
|
|
1
|
+
import type { OwnedUiPromptSuggestionGeneratorPort, OwnedUiSessionViewModel, OwnedUiViewportSettings, OwnedUiViewportSettingsPort, OwnedUiQuitOutroSettingsPort, SuggestionDecision, SuggestionDiagnosticObserver } from "../../contracts/owned-ui/index.js";
|
|
2
|
+
import type { PiTuiPointerSurface } from "../../integrations/pi/tui-runtime/contracts.js";
|
|
3
|
+
import type { UiRouteHost } from "../../ui/apps/contracts.js";
|
|
4
|
+
import type { TranscriptViewportFrame, TranscriptViewportFrameDescriptor } from "../../ui/components/transcript-viewport.js";
|
|
5
|
+
import type { PiEngineAdapter } from "../../integrations/pi/engine/adapter.js";
|
|
6
|
+
import type { PiWorkflowMessage, PiWorkflowResult } from "../../integrations/pi/engine/workflows.js";
|
|
7
|
+
import { type PiShellClipboardContent, type PiShellComponentPort, type PiShellEditorPort, type PiShellExtensionRendererResolver, type PiShellHeaderOptions, type PiShellHeaderPort, type PiShellImageAssetResolver, type PiShellLoadedResourcesPort, type PiShellResourceEntry, type PiShellTranscriptComponentPort } from "../../integrations/pi/components/shell-shared-facade.js";
|
|
8
|
+
import { type PiTuiInputCoordinationScheduler, type PiTuiInputSurfaceKind } from "../../integrations/pi/tui-runtime/input-presentation-coordinator.js";
|
|
9
|
+
import type { PiTuiComponentPort, PiTuiInputDiagnosticsEvent, PiTuiLayoutNode, PiTuiTerminalPort } from "../../integrations/pi/tui-runtime/contracts.js";
|
|
10
10
|
import { type PreparedPrompt } from "./prompt-chips.js";
|
|
11
|
+
import type { PastePreparationClientOptions } from "./paste-preparation-client.js";
|
|
11
12
|
import { type SessionViewportInputResult } from "./session-viewport-controller.js";
|
|
12
13
|
import type { ResponseCopyExecutor } from "./response-copy-transport.js";
|
|
13
14
|
import type { ResponseCopyEvent } from "./response-copy-protocol.js";
|
|
@@ -24,20 +25,10 @@ export interface OwnedUiClipboardPort {
|
|
|
24
25
|
} | null>;
|
|
25
26
|
writeText?(text: string, signal?: AbortSignal): Promise<void>;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
readonly store: import("../../../contracts/owned-ui/index.js").PromptHistoryPort;
|
|
30
|
-
readonly limit: number;
|
|
31
|
-
readonly editor: import("../components/index.js").HistoryEditorConstructor;
|
|
32
|
-
/** Optional per-profile filesystem sidecar for image chip payloads. When present, submit
|
|
33
|
-
* writes each referenced attachment and recall reads them back to rehydrate live chips.
|
|
34
|
-
* When absent, image chips silently strip on recall, matching the missing-sidecar path. */
|
|
35
|
-
readonly imageSidecar?: import("../../../contracts/owned-ui/index.js").PromptHistoryImageSidecarPort;
|
|
36
|
-
};
|
|
28
|
+
/** The engine session the shell presents and the composition's decisions about it. */
|
|
29
|
+
export interface OwnedUiShellEngineOptions {
|
|
37
30
|
readonly backend: OwnedUiBackendPort;
|
|
38
31
|
readonly cwd: string;
|
|
39
|
-
readonly terminal?: OwnedUiTerminalPort;
|
|
40
|
-
readonly startup?: OwnedUiStartupOptions;
|
|
41
32
|
/**
|
|
42
33
|
* Declared A1-owned routes. A route this host claims resolves to its app;
|
|
43
34
|
* every other route continues to the pinned workflow table unchanged.
|
|
@@ -45,30 +36,15 @@ export interface OwnedUiSessionShellOptions {
|
|
|
45
36
|
readonly routeHost?: UiRouteHost;
|
|
46
37
|
/** Bare A1 selects the owned bounded viewport; comparison profiles stay pinned. */
|
|
47
38
|
readonly sessionLayout?: "pinned" | "custom-viewport";
|
|
39
|
+
}
|
|
40
|
+
/** Terminal, startup, viewport, and presentation-cadence seams; production leaves most at their defaults. */
|
|
41
|
+
export interface OwnedUiShellPresentationOptions {
|
|
42
|
+
readonly terminal?: OwnedUiTerminalPort;
|
|
43
|
+
readonly startup?: OwnedUiStartupOptions;
|
|
48
44
|
/** Live profile-local settings, supplied only to the bare-A1 composition. */
|
|
49
45
|
readonly viewportSettings?: OwnedUiViewportSettingsPort;
|
|
50
|
-
/**
|
|
51
|
-
* Quit outro settings and seams, supplied only to the bare-A1 composition.
|
|
52
|
-
* `interactive` states whether the terminal can show the animation; production
|
|
53
|
-
* passes stdout's TTY state, tests opt in explicitly.
|
|
54
|
-
*/
|
|
55
|
-
readonly quitOutro?: OwnedUiQuitOutroSettingsPort & {
|
|
56
|
-
readonly interactive: boolean;
|
|
57
|
-
readonly now?: () => number;
|
|
58
|
-
readonly sleep?: (ms: number) => Promise<void>;
|
|
59
|
-
readonly seed?: number;
|
|
60
|
-
};
|
|
61
|
-
/** Optional platform seam; production uses A1's system clipboard adapter. */
|
|
62
|
-
readonly clipboard?: OwnedUiClipboardPort;
|
|
63
|
-
/** Owned response-copy transport and payload-free diagnostic seams. Comparison profiles ignore them. */
|
|
64
|
-
readonly responseCopy?: {
|
|
65
|
-
readonly execute?: ResponseCopyExecutor;
|
|
66
|
-
readonly onEvent?: (event: ResponseCopyEvent) => void;
|
|
67
|
-
};
|
|
68
|
-
/** Bounded, payload-free clipboard acquisition/preparation observations. */
|
|
69
|
-
readonly pasteDiagnostics?: (event: PasteEvent) => void;
|
|
70
46
|
/** Deterministic scheduling seam for presentation-cadence tests. */
|
|
71
|
-
readonly
|
|
47
|
+
readonly stream?: {
|
|
72
48
|
readonly intervalMs?: number;
|
|
73
49
|
readonly scheduler?: StreamPresentationScheduler;
|
|
74
50
|
};
|
|
@@ -76,19 +52,23 @@ export interface OwnedUiSessionShellOptions {
|
|
|
76
52
|
* Minimum time the reload box stays visible so a fast reload still reads as one.
|
|
77
53
|
* Production uses the default hold; tests inject `now`/`sleep` for determinism.
|
|
78
54
|
*/
|
|
79
|
-
readonly
|
|
55
|
+
readonly reload?: {
|
|
80
56
|
readonly minVisibleMs?: number;
|
|
81
57
|
readonly now?: () => number;
|
|
82
58
|
readonly sleep?: (ms: number) => Promise<void>;
|
|
83
59
|
};
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Quit outro settings and seams, supplied only to the bare-A1 composition.
|
|
62
|
+
* `interactive` states whether the terminal can show the animation; production
|
|
63
|
+
* passes stdout's TTY state, tests opt in explicitly.
|
|
64
|
+
*/
|
|
65
|
+
readonly quitOutro?: OwnedUiQuitOutroSettingsPort & {
|
|
66
|
+
readonly interactive: boolean;
|
|
67
|
+
readonly now?: () => number;
|
|
68
|
+
readonly sleep?: (ms: number) => Promise<void>;
|
|
69
|
+
readonly seed?: number;
|
|
90
70
|
};
|
|
91
|
-
readonly
|
|
71
|
+
readonly input?: {
|
|
92
72
|
readonly scheduler?: PiTuiInputCoordinationScheduler;
|
|
93
73
|
readonly onEvent?: (event: PiTuiInputDiagnosticsEvent) => void;
|
|
94
74
|
readonly now?: () => number;
|
|
@@ -98,6 +78,45 @@ export interface OwnedUiSessionShellOptions {
|
|
|
98
78
|
readonly viewportReuse?: boolean;
|
|
99
79
|
};
|
|
100
80
|
}
|
|
81
|
+
/** Persistent prompt history: its store, its bound, the editor that recalls it, and the image sidecar. */
|
|
82
|
+
export interface OwnedUiShellHistoryOptions {
|
|
83
|
+
readonly store: import("../../contracts/owned-ui/index.js").PromptHistoryPort;
|
|
84
|
+
readonly limit: number;
|
|
85
|
+
readonly editor: import("../../integrations/pi/components/index.js").HistoryEditorConstructor;
|
|
86
|
+
/** Optional per-profile filesystem sidecar for image chip payloads. When present, submit
|
|
87
|
+
* writes each referenced attachment and recall reads them back to rehydrate live chips.
|
|
88
|
+
* When absent, image chips silently strip on recall, matching the missing-sidecar path. */
|
|
89
|
+
readonly imageSidecar?: import("../../contracts/owned-ui/index.js").PromptHistoryImageSidecarPort;
|
|
90
|
+
}
|
|
91
|
+
/** Contextual prompt suggestions: the generator, the enablement setting, and an optional evidence seam. */
|
|
92
|
+
export interface OwnedUiShellSuggestionOptions {
|
|
93
|
+
readonly diagnostics?: SuggestionDiagnosticObserver;
|
|
94
|
+
readonly generator: OwnedUiPromptSuggestionGeneratorPort;
|
|
95
|
+
readonly enabled: () => boolean;
|
|
96
|
+
readonly onChange: (listener: (enabled: boolean) => void) => () => void;
|
|
97
|
+
}
|
|
98
|
+
/** Clipboard seams and payload-free diagnostics; comparison profiles ignore the diagnostics. */
|
|
99
|
+
export interface OwnedUiShellDiagnosticOptions {
|
|
100
|
+
/** Optional platform seam; production uses A1's system clipboard adapter. */
|
|
101
|
+
readonly clipboard?: OwnedUiClipboardPort;
|
|
102
|
+
/** Owned response-copy transport and payload-free diagnostic seams. */
|
|
103
|
+
readonly responseCopy?: {
|
|
104
|
+
readonly execute?: ResponseCopyExecutor;
|
|
105
|
+
readonly onEvent?: (event: ResponseCopyEvent) => void;
|
|
106
|
+
};
|
|
107
|
+
/** Bounded, payload-free clipboard acquisition/preparation observations. */
|
|
108
|
+
readonly paste?: (event: PasteEvent) => void;
|
|
109
|
+
/** Test seams for isolated paste preparation: an in-process starter, or the forked helper's entry. */
|
|
110
|
+
readonly pastePreparation?: Omit<PastePreparationClientOptions, "onEvent" | "spareIdleMs">;
|
|
111
|
+
}
|
|
112
|
+
/** What composes an owned session shell, grouped by the collaborator that provides each part. */
|
|
113
|
+
export interface OwnedUiSessionShellOptions {
|
|
114
|
+
readonly engine: OwnedUiShellEngineOptions;
|
|
115
|
+
readonly presentation?: OwnedUiShellPresentationOptions;
|
|
116
|
+
readonly history?: OwnedUiShellHistoryOptions;
|
|
117
|
+
readonly suggestions?: OwnedUiShellSuggestionOptions;
|
|
118
|
+
readonly diagnostics?: OwnedUiShellDiagnosticOptions;
|
|
119
|
+
}
|
|
101
120
|
/** Composes backend session state into the owned transcript, viewport, editor, and dock presentation. */
|
|
102
121
|
export declare class OwnedUiSessionShellRoot implements PiTuiComponentPort {
|
|
103
122
|
#private;
|
|
@@ -112,7 +131,7 @@ export declare class OwnedUiSessionShellRoot implements PiTuiComponentPort {
|
|
|
112
131
|
readonly requestHyperlinkCleanup?: (rows?: readonly number[]) => void;
|
|
113
132
|
readonly enableDockInputReuse?: boolean;
|
|
114
133
|
readonly persistentHistory?: boolean;
|
|
115
|
-
readonly historyEditor?: import("
|
|
134
|
+
readonly historyEditor?: import("../../integrations/pi/components/index.js").HistoryEditorConstructor;
|
|
116
135
|
readonly onSubmit: (text: string) => void;
|
|
117
136
|
readonly onPasteRejected?: (error: unknown) => void;
|
|
118
137
|
readonly onInterrupt: () => void;
|
|
@@ -132,6 +151,7 @@ export declare class OwnedUiSessionShellRoot implements PiTuiComponentPort {
|
|
|
132
151
|
readonly readClipboardContent?: (signal?: AbortSignal) => Promise<PiShellClipboardContent | null>;
|
|
133
152
|
readonly captureClipboardPaste?: () => PasteSource;
|
|
134
153
|
readonly pasteDiagnostics?: (event: PasteEvent) => void;
|
|
154
|
+
readonly pastePreparation?: Omit<PastePreparationClientOptions, "onEvent">;
|
|
135
155
|
}, startup?: PiShellHeaderOptions, agentDir?: string, extensionRenderers?: PiShellExtensionRendererResolver, sessionLayout?: "pinned" | "custom-viewport", imageAssets?: PiShellImageAssetResolver);
|
|
136
156
|
setEditorPaddingX(padding: number): void;
|
|
137
157
|
setAutocompleteMaxVisible(maxVisible: number): void;
|
|
@@ -140,7 +160,7 @@ export declare class OwnedUiSessionShellRoot implements PiTuiComponentPort {
|
|
|
140
160
|
setMermaidRenderingMode(mode: "off" | "final" | "streaming"): void;
|
|
141
161
|
setImagePresentation(showImages: boolean, imageWidthCells: number): void;
|
|
142
162
|
prepareHistoryText(text: string): string;
|
|
143
|
-
rehydrateHistoryText(text: string, resolveImage: (id: string) => import("
|
|
163
|
+
rehydrateHistoryText(text: string, resolveImage: (id: string) => import("../../contracts/owned-ui/index.js").PromptHistoryImageSidecarAttachment | null): string;
|
|
144
164
|
imageChipAttachmentsFromEditor(text: string): {
|
|
145
165
|
readonly id: string;
|
|
146
166
|
readonly tag: string;
|
|
@@ -154,6 +174,8 @@ export declare class OwnedUiSessionShellRoot implements PiTuiComponentPort {
|
|
|
154
174
|
hasPendingPastes(text: string): boolean;
|
|
155
175
|
waitForPromptPastes(text: string, signal: AbortSignal): Promise<PreparedPrompt>;
|
|
156
176
|
resetPendingPastes(): void;
|
|
177
|
+
/** Forks the spare paste helper so the first paste of the session takes a live child. */
|
|
178
|
+
warmPastePreparation(): void;
|
|
157
179
|
disposePendingPastes(): Promise<void>;
|
|
158
180
|
promptSuggestionPrepareBlockReason(): SuggestionDecision;
|
|
159
181
|
canPreparePromptSuggestion(): boolean;
|
|
@@ -192,7 +214,7 @@ export declare class OwnedUiSessionShellRoot implements PiTuiComponentPort {
|
|
|
192
214
|
followingEnd: boolean;
|
|
193
215
|
scrollTop: number;
|
|
194
216
|
maxScroll: number;
|
|
195
|
-
cause: "
|
|
217
|
+
cause: "initial" | "steady" | "dock-input" | "follow-shift" | "detached" | "geometry-change" | null;
|
|
196
218
|
};
|
|
197
219
|
/** Visible non-selectable Steering, alignment, and Working rows, for rendering evidence. */
|
|
198
220
|
viewportTransientTailRowCount(): number;
|