@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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type OwnedUiCommand, type OwnedUiCommandOutcome, type OwnedUiDiagnostics } from "../../../contracts/owned-ui/index.js";
|
|
2
|
+
import type { PiEmittedEvent } from "./event-delivery.js";
|
|
3
|
+
export interface AdapterCommandResult {
|
|
4
|
+
readonly outcome: OwnedUiCommandOutcome;
|
|
5
|
+
readonly diagnostic: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface PiCommandDispatchPorts {
|
|
8
|
+
sessionId(): string;
|
|
9
|
+
/** True before the runtime and session exist or after disposal: commands are rejected, not queued. */
|
|
10
|
+
notRunning(): boolean;
|
|
11
|
+
/** True while delivery is overloaded or admission is stopped. */
|
|
12
|
+
admissionStopped(): boolean;
|
|
13
|
+
/** Workflows currently admitted; they share the admission budget with commands. */
|
|
14
|
+
pendingWorkflowCount(): number;
|
|
15
|
+
sessionGeneration(): number;
|
|
16
|
+
beginRunning(): void;
|
|
17
|
+
endRunning(): void;
|
|
18
|
+
/** Carry out one admitted command against the engine; a throw becomes a failed outcome. */
|
|
19
|
+
perform(command: OwnedUiCommand): Promise<void>;
|
|
20
|
+
emit(value: PiEmittedEvent): void;
|
|
21
|
+
emitView(): void;
|
|
22
|
+
diagnostic(severity: OwnedUiDiagnostics["severity"], code: string, message: string, recoverable: boolean): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Admission and settlement of owned UI commands: the accepted/completed/failed/rejected outcome
|
|
26
|
+
* events, the bounded pending set with its out-of-band cancellation slot per command, the active
|
|
27
|
+
* ids the view reports, and the remembered results that make a retried correlation id idempotent.
|
|
28
|
+
* What a command does to the engine is the adapter's `perform` port.
|
|
29
|
+
*/
|
|
30
|
+
export declare class PiCommandDispatch {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(ports: PiCommandDispatchPorts);
|
|
33
|
+
get activeCommandIds(): readonly string[];
|
|
34
|
+
get pendingCount(): number;
|
|
35
|
+
isPending(correlationId: string): boolean;
|
|
36
|
+
/** Resolve every admitted command as failed, except the listed types. */
|
|
37
|
+
cancelPending(except?: readonly OwnedUiCommand["type"][]): void;
|
|
38
|
+
/** Forget active ids and remembered results; a new session binding cannot inherit them. */
|
|
39
|
+
reset(): void;
|
|
40
|
+
execute(command: OwnedUiCommand): Promise<AdapterCommandResult>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { assertOwnedUiCommand } from "../../../contracts/owned-ui/index.js";
|
|
2
|
+
/** How many commands and workflows may be admitted together before new work is rejected. */
|
|
3
|
+
const MAX_PENDING_WORK = 32;
|
|
4
|
+
/** Completed results remembered so a retried correlation id gets its original outcome. */
|
|
5
|
+
const MAX_COMPLETED_COMMANDS = 256;
|
|
6
|
+
/**
|
|
7
|
+
* Admission and settlement of owned UI commands: the accepted/completed/failed/rejected outcome
|
|
8
|
+
* events, the bounded pending set with its out-of-band cancellation slot per command, the active
|
|
9
|
+
* ids the view reports, and the remembered results that make a retried correlation id idempotent.
|
|
10
|
+
* What a command does to the engine is the adapter's `perform` port.
|
|
11
|
+
*/
|
|
12
|
+
export class PiCommandDispatch {
|
|
13
|
+
#ports;
|
|
14
|
+
#activeCommandIds = [];
|
|
15
|
+
#completedCommands = new Map();
|
|
16
|
+
#pendingCommands = new Map();
|
|
17
|
+
constructor(ports) {
|
|
18
|
+
this.#ports = ports;
|
|
19
|
+
}
|
|
20
|
+
get activeCommandIds() {
|
|
21
|
+
return this.#activeCommandIds;
|
|
22
|
+
}
|
|
23
|
+
get pendingCount() {
|
|
24
|
+
return this.#pendingCommands.size;
|
|
25
|
+
}
|
|
26
|
+
isPending(correlationId) {
|
|
27
|
+
return this.#pendingCommands.has(correlationId);
|
|
28
|
+
}
|
|
29
|
+
/** Resolve every admitted command as failed, except the listed types. */
|
|
30
|
+
cancelPending(except = []) {
|
|
31
|
+
for (const pending of this.#pendingCommands.values())
|
|
32
|
+
if (!except.includes(pending.type))
|
|
33
|
+
pending.cancel();
|
|
34
|
+
}
|
|
35
|
+
/** Forget active ids and remembered results; a new session binding cannot inherit them. */
|
|
36
|
+
reset() {
|
|
37
|
+
this.#activeCommandIds = [];
|
|
38
|
+
this.#completedCommands.clear();
|
|
39
|
+
}
|
|
40
|
+
async execute(command) {
|
|
41
|
+
assertOwnedUiCommand(command);
|
|
42
|
+
if (command.sessionId !== this.#ports.sessionId()) {
|
|
43
|
+
return this.#finishCommand(command, "rejected", "command targets a different owned session");
|
|
44
|
+
}
|
|
45
|
+
if (this.#ports.notRunning()) {
|
|
46
|
+
return this.#finishCommand(command, "rejected", "engine adapter is not running");
|
|
47
|
+
}
|
|
48
|
+
// Invariant: the bounded out-of-band cancellation path has one slot per admitted command.
|
|
49
|
+
if (this.#ports.admissionStopped() || this.#pendingCommands.size + this.#ports.pendingWorkflowCount() >= MAX_PENDING_WORK)
|
|
50
|
+
return { outcome: "rejected", diagnostic: null };
|
|
51
|
+
const existing = this.#completedCommands.get(command.correlationId);
|
|
52
|
+
if (existing)
|
|
53
|
+
return existing;
|
|
54
|
+
if (this.#activeCommandIds.includes(command.correlationId)) {
|
|
55
|
+
return this.#finishCommand(command, "rejected", "duplicate engine command correlation id");
|
|
56
|
+
}
|
|
57
|
+
this.#activeCommandIds.push(command.correlationId);
|
|
58
|
+
const generation = this.#ports.sessionGeneration();
|
|
59
|
+
let cancelled = false;
|
|
60
|
+
const cancellation = new Promise(resolve => {
|
|
61
|
+
this.#pendingCommands.set(command.correlationId, { type: command.type, cancel: () => {
|
|
62
|
+
if (cancelled)
|
|
63
|
+
return;
|
|
64
|
+
cancelled = true;
|
|
65
|
+
resolve(this.#recordCommand(command, "failed", null));
|
|
66
|
+
} });
|
|
67
|
+
});
|
|
68
|
+
this.#ports.emit({ type: "command-outcome", correlationId: command.correlationId, outcome: "accepted", diagnostic: null });
|
|
69
|
+
const operation = async () => {
|
|
70
|
+
try {
|
|
71
|
+
if (cancelled)
|
|
72
|
+
return { outcome: "failed", diagnostic: null };
|
|
73
|
+
this.#ports.beginRunning();
|
|
74
|
+
try {
|
|
75
|
+
await this.#ports.perform(command);
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
this.#ports.endRunning();
|
|
79
|
+
}
|
|
80
|
+
if (cancelled)
|
|
81
|
+
return { outcome: "failed", diagnostic: null };
|
|
82
|
+
if (generation === this.#ports.sessionGeneration())
|
|
83
|
+
this.#ports.emitView();
|
|
84
|
+
if (cancelled)
|
|
85
|
+
return { outcome: "failed", diagnostic: null };
|
|
86
|
+
return this.#recordCommand(command, "completed", null);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (cancelled)
|
|
90
|
+
return { outcome: "failed", diagnostic: null };
|
|
91
|
+
const diagnostic = error instanceof Error ? error.message : String(error);
|
|
92
|
+
this.#ports.diagnostic("error", "engine-command", diagnostic, true);
|
|
93
|
+
if (generation === this.#ports.sessionGeneration())
|
|
94
|
+
this.#ports.emitView();
|
|
95
|
+
return this.#recordCommand(command, "failed", diagnostic);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
return await Promise.race([operation(), cancellation]);
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
this.#pendingCommands.delete(command.correlationId);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
#recordCommand(command, outcome, diagnostic) {
|
|
106
|
+
const result = this.#finishCommand(command, outcome, diagnostic);
|
|
107
|
+
this.#completedCommands.set(command.correlationId, result);
|
|
108
|
+
if (this.#completedCommands.size > MAX_COMPLETED_COMMANDS) {
|
|
109
|
+
const oldest = this.#completedCommands.keys().next().value;
|
|
110
|
+
if (oldest)
|
|
111
|
+
this.#completedCommands.delete(oldest);
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
#finishCommand(command, outcome, diagnostic) {
|
|
116
|
+
this.#activeCommandIds = this.#activeCommandIds.filter(id => id !== command.correlationId);
|
|
117
|
+
this.#ports.emit({
|
|
118
|
+
type: "command-outcome",
|
|
119
|
+
correlationId: command.correlationId,
|
|
120
|
+
outcome,
|
|
121
|
+
diagnostic,
|
|
122
|
+
});
|
|
123
|
+
return { outcome, diagnostic };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { OwnedUiEvent, OwnedUiTranscriptBlock } from "../../../contracts/owned-ui/index.js";
|
|
2
|
+
/** An event the adapter emits before delivery stamps it with the session id and sequence. */
|
|
3
|
+
export type PiEmittedEvent = Omit<Extract<OwnedUiEvent, {
|
|
4
|
+
type: "session-lifecycle";
|
|
5
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
6
|
+
type: "session-view";
|
|
7
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
8
|
+
type: "transcript-block";
|
|
9
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
10
|
+
type: "assistant-message-completed";
|
|
11
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
12
|
+
type: "agent-run-started";
|
|
13
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
14
|
+
type: "agent-run-settled";
|
|
15
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
16
|
+
type: "editor-state";
|
|
17
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
18
|
+
type: "status";
|
|
19
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
20
|
+
type: "command-outcome";
|
|
21
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
22
|
+
type: "terminal-surface";
|
|
23
|
+
}>, "sessionId" | "sequence"> | Omit<Extract<OwnedUiEvent, {
|
|
24
|
+
type: "diagnostic";
|
|
25
|
+
}>, "sessionId" | "sequence">;
|
|
26
|
+
/** A command outcome held back during an overload so its command can still settle after recovery. */
|
|
27
|
+
export interface ReservedCommandOutcome {
|
|
28
|
+
readonly outcome: Extract<OwnedUiEvent, {
|
|
29
|
+
type: "command-outcome";
|
|
30
|
+
}>["outcome"];
|
|
31
|
+
readonly diagnostic: Extract<OwnedUiEvent, {
|
|
32
|
+
type: "command-outcome";
|
|
33
|
+
}>["diagnostic"];
|
|
34
|
+
}
|
|
35
|
+
export interface PiEventDeliveryPorts {
|
|
36
|
+
sessionId(): string;
|
|
37
|
+
sessionGeneration(): number;
|
|
38
|
+
/** The current block for a lazily materialized transcript event. */
|
|
39
|
+
transcriptBlock(id: string): OwnedUiTranscriptBlock | undefined;
|
|
40
|
+
/** Retain the image assets an event references until the returned release runs. */
|
|
41
|
+
retainEvent(event: OwnedUiEvent): () => void;
|
|
42
|
+
/** Whether a command outcome still has an admitted command waiting for it. */
|
|
43
|
+
isPendingCommand(correlationId: string): boolean;
|
|
44
|
+
/** Cancel admitted work when the queue saturates; resolves once the engine session aborted. */
|
|
45
|
+
cancelForOverload(): Promise<void>;
|
|
46
|
+
/** Rebuild session state once the saturated queue drained; `cancelled` says whether the abort completed. */
|
|
47
|
+
reconcileOverload(cancelled: boolean): Promise<void>;
|
|
48
|
+
/** A listener threw; the adapter records the warning. */
|
|
49
|
+
listenerFailed(message: string): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Bounded delivery of owned UI events: stamps sequence numbers, keeps subscribers, queues events
|
|
53
|
+
* through the replaceable pending buffer, yields to the event loop between batches, and when the
|
|
54
|
+
* buffer saturates declares an overload that the adapter reconciles once the queue drains. The
|
|
55
|
+
* adapter decides what an event means; this class decides only when it reaches a listener.
|
|
56
|
+
*/
|
|
57
|
+
export declare class PiEventDelivery {
|
|
58
|
+
#private;
|
|
59
|
+
constructor(ports: PiEventDeliveryPorts);
|
|
60
|
+
/** The sequence number of the most recently stamped event. */
|
|
61
|
+
get sequence(): number;
|
|
62
|
+
/** True from queue saturation until the adapter's reconciliation ends. */
|
|
63
|
+
get overloaded(): boolean;
|
|
64
|
+
/** True once a listener threw or the queue saturated, until the adapter clears it after a flush. */
|
|
65
|
+
get failed(): boolean;
|
|
66
|
+
clearFailure(): void;
|
|
67
|
+
/** Developer-only pressure evidence; never mirrored into visible diagnostic/status arrays. */
|
|
68
|
+
diagnostics(): {
|
|
69
|
+
overloads: number;
|
|
70
|
+
recovering: boolean;
|
|
71
|
+
reservedOutcomes: number;
|
|
72
|
+
invalidatedEvents: number;
|
|
73
|
+
pending: number;
|
|
74
|
+
bytes: number;
|
|
75
|
+
protected: number;
|
|
76
|
+
superseded: number;
|
|
77
|
+
peakNodes: number;
|
|
78
|
+
peakBytes: number;
|
|
79
|
+
};
|
|
80
|
+
/** Give an event its session id and the next sequence number without queueing it. */
|
|
81
|
+
stamp(value: PiEmittedEvent): OwnedUiEvent;
|
|
82
|
+
/** Register a listener that first receives `initial` and afterwards every later-stamped event. */
|
|
83
|
+
subscribe(listener: (event: OwnedUiEvent) => void, initial: OwnedUiEvent): () => void;
|
|
84
|
+
/** Stamp and queue an event for ordered delivery. */
|
|
85
|
+
emit(value: PiEmittedEvent): OwnedUiEvent;
|
|
86
|
+
/** Queue an already stamped event; during an overload only pending command outcomes are kept, as reservations. */
|
|
87
|
+
enqueue(event: OwnedUiEvent): void;
|
|
88
|
+
/** Freeze lazy snapshots before their source is replaced; false means the queue saturated. */
|
|
89
|
+
seal(): boolean;
|
|
90
|
+
/** Drop queued events from earlier session generations. */
|
|
91
|
+
discardObsolete(generation: number): void;
|
|
92
|
+
/** Enter the bounded overload transition; a no-op while one is already in progress. */
|
|
93
|
+
beginOverload(): void;
|
|
94
|
+
/** Deliver out of band, bypassing the queue; used for reconciliation after an overload. */
|
|
95
|
+
deliverNow(event: OwnedUiEvent): void;
|
|
96
|
+
/** The command outcomes reserved during an overload, in arrival order; clears the reservation. */
|
|
97
|
+
takeReservedOutcomes(): [string, ReservedCommandOutcome][];
|
|
98
|
+
/** Resolves once every queued event has been delivered or invalidated. */
|
|
99
|
+
settle(): Promise<void>;
|
|
100
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { PendingEngineDelivery } from "./pending-delivery.js";
|
|
2
|
+
/**
|
|
3
|
+
* Engine events delivered before the queue hands the event loop a turn. Small enough
|
|
4
|
+
* that a streaming burst never holds input, large enough that an ordinary turn is one
|
|
5
|
+
* batch.
|
|
6
|
+
*/
|
|
7
|
+
// Performance: deliver at most one engine event per event-loop turn. Transcript updates can
|
|
8
|
+
// be expensive in long sessions; a larger synchronous batch starves terminal
|
|
9
|
+
// input and makes an in-progress mouse selection appear frozen.
|
|
10
|
+
const EVENT_DELIVERY_BATCH = 1;
|
|
11
|
+
const OVERLOAD_CANCELLATION_TIMEOUT_MS = 2000;
|
|
12
|
+
/**
|
|
13
|
+
* Bounded delivery of owned UI events: stamps sequence numbers, keeps subscribers, queues events
|
|
14
|
+
* through the replaceable pending buffer, yields to the event loop between batches, and when the
|
|
15
|
+
* buffer saturates declares an overload that the adapter reconciles once the queue drains. The
|
|
16
|
+
* adapter decides what an event means; this class decides only when it reaches a listener.
|
|
17
|
+
*/
|
|
18
|
+
export class PiEventDelivery {
|
|
19
|
+
#listeners = new Map();
|
|
20
|
+
#queue;
|
|
21
|
+
#reservedOutcomes = new Map();
|
|
22
|
+
#ports;
|
|
23
|
+
#sequence = 0;
|
|
24
|
+
#processing;
|
|
25
|
+
#overload;
|
|
26
|
+
#overloads = 0;
|
|
27
|
+
#deliveryFailed = false;
|
|
28
|
+
#invalidatedEvents = 0;
|
|
29
|
+
constructor(ports) {
|
|
30
|
+
this.#ports = ports;
|
|
31
|
+
this.#queue = new PendingEngineDelivery(event => ports.retainEvent(event));
|
|
32
|
+
}
|
|
33
|
+
/** The sequence number of the most recently stamped event. */
|
|
34
|
+
get sequence() {
|
|
35
|
+
return this.#sequence;
|
|
36
|
+
}
|
|
37
|
+
/** True from queue saturation until the adapter's reconciliation ends. */
|
|
38
|
+
get overloaded() {
|
|
39
|
+
return this.#overload !== undefined;
|
|
40
|
+
}
|
|
41
|
+
/** True once a listener threw or the queue saturated, until the adapter clears it after a flush. */
|
|
42
|
+
get failed() {
|
|
43
|
+
return this.#deliveryFailed;
|
|
44
|
+
}
|
|
45
|
+
clearFailure() {
|
|
46
|
+
this.#deliveryFailed = false;
|
|
47
|
+
}
|
|
48
|
+
/** Developer-only pressure evidence; never mirrored into visible diagnostic/status arrays. */
|
|
49
|
+
diagnostics() {
|
|
50
|
+
return { ...this.#queue.diagnostics(), overloads: this.#overloads, recovering: this.overloaded,
|
|
51
|
+
reservedOutcomes: this.#reservedOutcomes.size, invalidatedEvents: this.#invalidatedEvents };
|
|
52
|
+
}
|
|
53
|
+
/** Give an event its session id and the next sequence number without queueing it. */
|
|
54
|
+
stamp(value) {
|
|
55
|
+
this.#sequence += 1;
|
|
56
|
+
return { ...value, sessionId: this.#ports.sessionId(), sequence: this.#sequence };
|
|
57
|
+
}
|
|
58
|
+
/** Register a listener that first receives `initial` and afterwards every later-stamped event. */
|
|
59
|
+
subscribe(listener, initial) {
|
|
60
|
+
this.#listeners.set(listener, initial.sequence);
|
|
61
|
+
listener(initial);
|
|
62
|
+
return () => this.#listeners.delete(listener);
|
|
63
|
+
}
|
|
64
|
+
/** Stamp and queue an event for ordered delivery. */
|
|
65
|
+
emit(value) {
|
|
66
|
+
const event = this.stamp(value);
|
|
67
|
+
this.enqueue(event);
|
|
68
|
+
return event;
|
|
69
|
+
}
|
|
70
|
+
/** Queue an already stamped event; during an overload only pending command outcomes are kept, as reservations. */
|
|
71
|
+
enqueue(event) {
|
|
72
|
+
if (this.#overload !== undefined) {
|
|
73
|
+
if (event.type === "command-outcome" && event.outcome !== "accepted" && this.#ports.isPendingCommand(event.correlationId)) {
|
|
74
|
+
this.#reservedOutcomes.set(event.correlationId, { outcome: event.outcome, diagnostic: event.diagnostic });
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!this.#queue.push(event, this.#ports.sessionGeneration(), event.type === "transcript-block"
|
|
79
|
+
? this.#blockReconciliation(event.block.id, event.sequence) : undefined)) {
|
|
80
|
+
this.beginOverload();
|
|
81
|
+
if (event.type === "command-outcome" && event.outcome !== "accepted" && this.#ports.isPendingCommand(event.correlationId)
|
|
82
|
+
&& !this.#reservedOutcomes.has(event.correlationId)) {
|
|
83
|
+
this.#reservedOutcomes.set(event.correlationId, { outcome: event.outcome, diagnostic: event.diagnostic });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
this.#processing ??= Promise.resolve().then(() => this.#processQueue());
|
|
87
|
+
}
|
|
88
|
+
// Performance: capture only identity, not the complete block/event retained by an earlier revision.
|
|
89
|
+
#blockReconciliation(id, sequence) {
|
|
90
|
+
return () => ({ type: "transcript-block", sessionId: this.#ports.sessionId(), sequence, block: this.#ports.transcriptBlock(id) });
|
|
91
|
+
}
|
|
92
|
+
/** Freeze lazy snapshots before their source is replaced; false means the queue saturated. */
|
|
93
|
+
seal() {
|
|
94
|
+
return this.#queue.seal();
|
|
95
|
+
}
|
|
96
|
+
/** Drop queued events from earlier session generations. */
|
|
97
|
+
discardObsolete(generation) {
|
|
98
|
+
this.#invalidatedEvents += this.#queue.discardObsolete(generation);
|
|
99
|
+
}
|
|
100
|
+
/** Enter the bounded overload transition; a no-op while one is already in progress. */
|
|
101
|
+
beginOverload() {
|
|
102
|
+
if (this.#overload !== undefined)
|
|
103
|
+
return;
|
|
104
|
+
this.#overloads = Math.min(Number.MAX_SAFE_INTEGER, this.#overloads + 1);
|
|
105
|
+
this.#deliveryFailed = true;
|
|
106
|
+
// Concurrency: reserve before cancellation; outcomes produced reentrantly must not enter the saturated queue.
|
|
107
|
+
this.#overload = Promise.resolve(false);
|
|
108
|
+
const cancellation = this.#ports.cancelForOverload();
|
|
109
|
+
this.#overload = new Promise(resolve => {
|
|
110
|
+
const timer = setTimeout(() => resolve(false), OVERLOAD_CANCELLATION_TIMEOUT_MS);
|
|
111
|
+
cancellation.then(() => {
|
|
112
|
+
clearTimeout(timer);
|
|
113
|
+
resolve(true);
|
|
114
|
+
}, () => { clearTimeout(timer); resolve(false); });
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/** Deliver out of band, bypassing the queue; used for reconciliation after an overload. */
|
|
118
|
+
deliverNow(event) {
|
|
119
|
+
for (const [listener, subscribedAt] of this.#listeners) {
|
|
120
|
+
if (event.sequence <= subscribedAt)
|
|
121
|
+
continue;
|
|
122
|
+
try {
|
|
123
|
+
listener(event);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
this.#deliveryFailed = true;
|
|
127
|
+
this.#ports.listenerFailed(error instanceof Error ? error.message : String(error));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** The command outcomes reserved during an overload, in arrival order; clears the reservation. */
|
|
132
|
+
takeReservedOutcomes() {
|
|
133
|
+
const reserved = [...this.#reservedOutcomes];
|
|
134
|
+
this.#reservedOutcomes.clear();
|
|
135
|
+
return reserved;
|
|
136
|
+
}
|
|
137
|
+
/** Resolves once every queued event has been delivered or invalidated. */
|
|
138
|
+
async settle() {
|
|
139
|
+
while (this.#processing)
|
|
140
|
+
await this.#processing;
|
|
141
|
+
}
|
|
142
|
+
async #processQueue() {
|
|
143
|
+
try {
|
|
144
|
+
let deliveredSinceYield = 0;
|
|
145
|
+
while (this.#queue.size > 0) {
|
|
146
|
+
const pending = this.#queue.shift();
|
|
147
|
+
if (pending === undefined)
|
|
148
|
+
continue;
|
|
149
|
+
if (pending.generation !== this.#ports.sessionGeneration() && pending.event.type !== "command-outcome") {
|
|
150
|
+
this.#invalidatedEvents = Math.min(Number.MAX_SAFE_INTEGER, this.#invalidatedEvents + 1);
|
|
151
|
+
pending.release?.();
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
this.deliverNow(pending.event);
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
pending.release?.();
|
|
159
|
+
}
|
|
160
|
+
deliveredSinceYield += 1;
|
|
161
|
+
// Concurrency: a microtask chain runs to exhaustion before the loop turns, so a streaming
|
|
162
|
+
// burst would hold typed input, pointer reports, and timed indicators until it
|
|
163
|
+
// drained. Yielding on a macrotask hands those their turn between batches.
|
|
164
|
+
if (deliveredSinceYield >= EVENT_DELIVERY_BATCH && this.#queue.size > 0) {
|
|
165
|
+
deliveredSinceYield = 0;
|
|
166
|
+
await new Promise(resolve => { setImmediate(resolve); });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (this.#overload !== undefined) {
|
|
170
|
+
const cancelled = await this.#overload;
|
|
171
|
+
await this.#ports.reconcileOverload(cancelled);
|
|
172
|
+
// Invariant: an outcome reserved while reconciliation replayed the earlier ones is dropped with the overload.
|
|
173
|
+
this.#reservedOutcomes.clear();
|
|
174
|
+
this.#overload = undefined;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
this.#processing = undefined;
|
|
179
|
+
if (this.#queue.size > 0) {
|
|
180
|
+
this.#processing = Promise.resolve().then(() => this.#processQueue());
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AgentSession } from "../startup-public.js";
|
|
2
|
+
import { OWNED_UI_EXTENSION_CONTRACT_VERSION, OWNED_UI_EXTENSION_RENDER_CALLBACKS, OWNED_UI_EXTENSION_UI_CALLBACKS, OWNED_UI_EXTENSION_UI_PROPERTIES, type OwnedUiDiagnostics } from "../../../contracts/owned-ui/index.js";
|
|
3
|
+
export interface OwnedPiVisualExtensionSupport {
|
|
4
|
+
readonly available: boolean;
|
|
5
|
+
readonly contractComplete: true;
|
|
6
|
+
readonly contractVersion: typeof OWNED_UI_EXTENSION_CONTRACT_VERSION;
|
|
7
|
+
readonly binding: "bound" | "unbound";
|
|
8
|
+
readonly uiCallbacks: typeof OWNED_UI_EXTENSION_UI_CALLBACKS;
|
|
9
|
+
readonly uiProperties: typeof OWNED_UI_EXTENSION_UI_PROPERTIES;
|
|
10
|
+
readonly renderCallbacks: typeof OWNED_UI_EXTENSION_RENDER_CALLBACKS;
|
|
11
|
+
readonly diagnostic: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PiExtensionUiBindingPorts {
|
|
14
|
+
session(): AgentSession | undefined;
|
|
15
|
+
diagnostic(severity: OwnedUiDiagnostics["severity"], code: string, message: string, recoverable: boolean): void;
|
|
16
|
+
emitView(): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The owned extension UI bridge's attachment to pinned Pi sessions: the bridge the shell hands
|
|
20
|
+
* over, whether the current session is bound to it, and the rebind that every new session needs.
|
|
21
|
+
* Extension errors surface as adapter diagnostics through the ports.
|
|
22
|
+
*/
|
|
23
|
+
export declare class PiExtensionUiBinding {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(ports: PiExtensionUiBindingPorts);
|
|
26
|
+
/** True while a bridge is attached, bound or not. */
|
|
27
|
+
get attached(): boolean;
|
|
28
|
+
support(): OwnedPiVisualExtensionSupport;
|
|
29
|
+
/** Attach the owned extension UI bridge and bind it to the current session. */
|
|
30
|
+
bind(ui: unknown, shutdown?: () => void | Promise<void>): Promise<void>;
|
|
31
|
+
/** Detach the bridge; the next session binding will not rebind it. */
|
|
32
|
+
unbind(): Promise<void>;
|
|
33
|
+
/** Bind the attached bridge to the current session, reporting failures as diagnostics. */
|
|
34
|
+
rebind(): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { PRODUCT_IDENTITY } from "../../../product-identity.js";
|
|
2
|
+
import { isRecord } from "./message-values.js";
|
|
3
|
+
import { OWNED_UI_EXTENSION_CONTRACT_VERSION, OWNED_UI_EXTENSION_RENDER_CALLBACKS, OWNED_UI_EXTENSION_UI_CALLBACKS, OWNED_UI_EXTENSION_UI_PROPERTIES, assertOwnedUiExtensionUiPort, } from "../../../contracts/owned-ui/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* The owned extension UI bridge's attachment to pinned Pi sessions: the bridge the shell hands
|
|
6
|
+
* over, whether the current session is bound to it, and the rebind that every new session needs.
|
|
7
|
+
* Extension errors surface as adapter diagnostics through the ports.
|
|
8
|
+
*/
|
|
9
|
+
export class PiExtensionUiBinding {
|
|
10
|
+
#ports;
|
|
11
|
+
#extensionUi;
|
|
12
|
+
#extensionShutdown;
|
|
13
|
+
#extensionBound = false;
|
|
14
|
+
constructor(ports) {
|
|
15
|
+
this.#ports = ports;
|
|
16
|
+
}
|
|
17
|
+
/** True while a bridge is attached, bound or not. */
|
|
18
|
+
get attached() {
|
|
19
|
+
return this.#extensionUi !== undefined;
|
|
20
|
+
}
|
|
21
|
+
support() {
|
|
22
|
+
return {
|
|
23
|
+
available: this.#extensionBound,
|
|
24
|
+
contractComplete: true,
|
|
25
|
+
contractVersion: OWNED_UI_EXTENSION_CONTRACT_VERSION,
|
|
26
|
+
binding: this.#extensionBound ? "bound" : "unbound",
|
|
27
|
+
uiCallbacks: OWNED_UI_EXTENSION_UI_CALLBACKS,
|
|
28
|
+
uiProperties: OWNED_UI_EXTENSION_UI_PROPERTIES,
|
|
29
|
+
renderCallbacks: OWNED_UI_EXTENSION_RENDER_CALLBACKS,
|
|
30
|
+
diagnostic: this.#extensionBound
|
|
31
|
+
? `Pinned public extension UI lifecycle is bound through the ${PRODUCT_IDENTITY.displayName}-owned bridge.`
|
|
32
|
+
: `The complete ${PRODUCT_IDENTITY.displayName}-owned extension UI contract is available; the active session has not been bound to the owned UI bridge.`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Attach the owned extension UI bridge and bind it to the current session. */
|
|
36
|
+
async bind(ui, shutdown) {
|
|
37
|
+
assertPiExtensionUiContext(ui);
|
|
38
|
+
this.#extensionUi = ui;
|
|
39
|
+
this.#extensionShutdown = shutdown;
|
|
40
|
+
await this.rebind();
|
|
41
|
+
}
|
|
42
|
+
/** Detach the bridge; the next session binding will not rebind it. */
|
|
43
|
+
async unbind() {
|
|
44
|
+
this.#extensionUi = undefined;
|
|
45
|
+
this.#extensionShutdown = undefined;
|
|
46
|
+
this.#extensionBound = false;
|
|
47
|
+
}
|
|
48
|
+
/** Bind the attached bridge to the current session, reporting failures as diagnostics. */
|
|
49
|
+
async rebind() {
|
|
50
|
+
const session = this.#ports.session();
|
|
51
|
+
const ui = this.#extensionUi;
|
|
52
|
+
if (session === undefined || ui === undefined || session.bindExtensions === undefined) {
|
|
53
|
+
this.#extensionBound = false;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
await session.bindExtensions({
|
|
58
|
+
uiContext: ui,
|
|
59
|
+
mode: "tui",
|
|
60
|
+
shutdownHandler: () => this.#extensionShutdown?.(),
|
|
61
|
+
onError: error => {
|
|
62
|
+
const message = isRecord(error) && typeof error.error === "string"
|
|
63
|
+
? error.error
|
|
64
|
+
: error instanceof Error ? error.message : String(error);
|
|
65
|
+
this.#ports.diagnostic("warning", "extension-ui", message, true);
|
|
66
|
+
this.#ports.emitView();
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
this.#extensionBound = true;
|
|
70
|
+
this.#ports.emitView();
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
this.#extensionBound = false;
|
|
74
|
+
this.#ports.diagnostic("error", "extension-ui-bind", error instanceof Error ? error.message : String(error), true);
|
|
75
|
+
this.#ports.emitView();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function assertPiExtensionUiContext(value) {
|
|
80
|
+
assertOwnedUiExtensionUiPort(value);
|
|
81
|
+
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
1
|
+
export { EngineDeliveryError, PiEngineAdapter, createPiEngineAdapter } from "./adapter.js";
|
|
2
|
+
export type { AdapterCommandResult, OwnedPiExtensionResourceSummary, OwnedPiExtensionSourceSummary, OwnedPiResourceSummary, OwnedPiVisualExtensionSupport, PiEngineAdapterOptions, PiEngineRuntimeFactory, PiEngineRuntimeFactoryInput, } from "./adapter.js";
|
|
3
|
+
export { bindPiRuntimeSession, createPiRuntimeIntegration, createPiRuntimeServicesAfterTrust, disposePiRuntimeIntegration, replacePiRuntimeSession, resolveConfiguredModelScope, } from "./runtime-integration.js";
|
|
4
|
+
export type { PiRuntimeIntegrationOptions, PiRuntimePreflightDependencies, PiSessionReplacement } from "./runtime-integration.js";
|
|
5
|
+
export { PiSessionSelectionError, openSelectedPiSession, resolveSessionArgumentPath } from "./session-selection.js";
|
|
6
|
+
export type { PiSessionForkPrompt, PiSessionSelection } from "./session-selection.js";
|
|
7
|
+
export { PiSessionCommandIntegration, convertPiSessionEvent, subscribeToPiSessionEvents } from "./session-integration.js";
|
|
8
|
+
export type { PiDocumentedSessionCommands, PiOrderedEventIntegration, PiSessionCommand, PiSessionCommandResult } from "./session-integration.js";
|
|
9
|
+
export { AUTOMATIC_THEME, EXPOSED_SETTING_KEYS, PI_SETTING_EFFECTS, PiSettingsBridge, PiSettingsCoordinator, parseAutomaticTheme, settingsEffectInventoryDrift, settingsInventoryDrift, settingsVisualInventoryViolations, } from "./settings-bridge.js";
|
|
10
|
+
export { assertPiSettingsMetadata, loadPiSettingsMetadata, PI_SETTINGS_METADATA_FILE } from "./settings-metadata.js";
|
|
11
|
+
export type { PiSettingBounds, PiSettingPresentation, PiSettingsMetadata } from "./settings-metadata.js";
|
|
12
|
+
export type { PiSettingEffectDefinition, PiSettingEffectHandler, PiSettingKey, PiSettingOwnerHandlers, PiSettingStorageOperation, PiSettingVisualClass, PiSettingVisualEvidence, PiSettingsCoordinatorOptions, PiSettingsModelChoice, PiSettingsProviders, } from "./settings-bridge.js";
|
|
13
|
+
export { resolvePiProjectTrustPreflight } from "./project-trust-preflight.js";
|
|
14
|
+
export type { PiProjectTrustPreflightPrompt, PiProjectTrustPreflightRequest, PiProjectTrustPreflightResult, ResolvePiProjectTrustPreflightOptions, } from "./project-trust-preflight.js";
|
|
15
|
+
export { configureOwnedHttpDispatcher, configuredOwnedHttpIdleTimeoutMs } from "./http-dispatcher.js";
|
|
16
|
+
export { createPiPackagesPort } from "./package-integration.js";
|
|
17
|
+
export { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_SETTINGS_CALLBACKS, PINNED_PI_WORKFLOW_COMMAND_NAMES } from "./workflows.js";
|
|
18
|
+
export type { PiAuthenticationProviderOption, PiAuthenticationProviderStatus, PiBashWorkflowResult, PiHiddenWorkflowCommandName, PiPinnedSettingsCallback, PiPinnedSettingsSnapshot, PiProjectTrustContext, PiProjectTrustUpdate, PiScopedModelDescriptor, PiScopedModelsContext, PiScopedModelsRefreshResult, PiSessionInfoPresentation, PiSessionResumeMetadata, PiSessionSelectorContext, PiTreeSelectorContext, PiWorkflowAutocompleteCommand, PiWorkflowCommandName, PiWorkflowHost, PiWorkflowInteractionHost, PiWorkflowInteractionRequest, PiWorkflowLoginNotification, PiWorkflowLoginStart, PiWorkflowMessage, PiWorkflowMessageKind, PiWorkflowOption, PiWorkflowOutcome, PiWorkflowPresentation, PiWorkflowRequest, PiWorkflowResult, PiWorkflowRoute, } from "./workflows.js";
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export * from "./package-integration.js";
|
|
12
|
-
export * from "./resource-extension-integration.js";
|
|
13
|
-
export * from "./workflow-controllers.js";
|
|
14
|
-
export * from "./workflows.js";
|
|
1
|
+
export { EngineDeliveryError, PiEngineAdapter, createPiEngineAdapter } from "./adapter.js";
|
|
2
|
+
export { bindPiRuntimeSession, createPiRuntimeIntegration, createPiRuntimeServicesAfterTrust, disposePiRuntimeIntegration, replacePiRuntimeSession, resolveConfiguredModelScope, } from "./runtime-integration.js";
|
|
3
|
+
export { PiSessionSelectionError, openSelectedPiSession, resolveSessionArgumentPath } from "./session-selection.js";
|
|
4
|
+
export { PiSessionCommandIntegration, convertPiSessionEvent, subscribeToPiSessionEvents } from "./session-integration.js";
|
|
5
|
+
export { AUTOMATIC_THEME, EXPOSED_SETTING_KEYS, PI_SETTING_EFFECTS, PiSettingsBridge, PiSettingsCoordinator, parseAutomaticTheme, settingsEffectInventoryDrift, settingsInventoryDrift, settingsVisualInventoryViolations, } from "./settings-bridge.js";
|
|
6
|
+
export { assertPiSettingsMetadata, loadPiSettingsMetadata, PI_SETTINGS_METADATA_FILE } from "./settings-metadata.js";
|
|
7
|
+
export { resolvePiProjectTrustPreflight } from "./project-trust-preflight.js";
|
|
8
|
+
export { configureOwnedHttpDispatcher, configuredOwnedHttpIdleTimeoutMs } from "./http-dispatcher.js";
|
|
9
|
+
export { createPiPackagesPort } from "./package-integration.js";
|
|
10
|
+
export { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_SETTINGS_CALLBACKS, PINNED_PI_WORKFLOW_COMMAND_NAMES } from "./workflows.js";
|