@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,67 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
/** File name of the metadata beside this module, written by `scripts/pi/build-pi-settings-metadata.mjs`. */
|
|
3
|
+
export const PI_SETTINGS_METADATA_FILE = "pi-settings-metadata.json";
|
|
4
|
+
let loaded;
|
|
5
|
+
/**
|
|
6
|
+
* Reads the generated metadata beside this module. It is produced from the pinned engine at
|
|
7
|
+
* build time rather than committed, so what A1 presents cannot drift from what the engine
|
|
8
|
+
* presents; a source tree that has not been built reports the missing file by name.
|
|
9
|
+
*/
|
|
10
|
+
export function loadPiSettingsMetadata() {
|
|
11
|
+
if (loaded !== undefined)
|
|
12
|
+
return loaded;
|
|
13
|
+
const url = new URL(`./${PI_SETTINGS_METADATA_FILE}`, import.meta.url);
|
|
14
|
+
let raw;
|
|
15
|
+
try {
|
|
16
|
+
raw = readFileSync(url, "utf8");
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw new Error(`Pi settings metadata is not generated at ${url.href}; run npm run build (${describe(error)})`);
|
|
20
|
+
}
|
|
21
|
+
loaded = assertPiSettingsMetadata(JSON.parse(raw));
|
|
22
|
+
return loaded;
|
|
23
|
+
}
|
|
24
|
+
export function assertPiSettingsMetadata(value) {
|
|
25
|
+
if (!isRecord(value))
|
|
26
|
+
throw new TypeError("Pi settings metadata is not an object");
|
|
27
|
+
const { presented, order, settings, dialogs, bounds } = value;
|
|
28
|
+
if (!isStringList(presented) || !isStringList(order))
|
|
29
|
+
throw new TypeError("Pi settings metadata lists are invalid");
|
|
30
|
+
if (!isRecord(settings) || !isRecord(dialogs) || !isRecord(bounds))
|
|
31
|
+
throw new TypeError("Pi settings metadata tables are invalid");
|
|
32
|
+
return {
|
|
33
|
+
presented,
|
|
34
|
+
order,
|
|
35
|
+
settings: checkedTable(settings, isPresentation, "presentation"),
|
|
36
|
+
dialogs: checkedTable(dialogs, isFlagList, "dialog"),
|
|
37
|
+
bounds: checkedTable(bounds, isBounds, "bound"),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function checkedTable(table, guard, what) {
|
|
41
|
+
const checked = {};
|
|
42
|
+
for (const [key, entry] of Object.entries(table)) {
|
|
43
|
+
if (!guard(entry))
|
|
44
|
+
throw new TypeError(`Pi settings metadata ${what} is invalid: ${key}`);
|
|
45
|
+
checked[key] = entry;
|
|
46
|
+
}
|
|
47
|
+
return checked;
|
|
48
|
+
}
|
|
49
|
+
function isPresentation(entry) {
|
|
50
|
+
return isRecord(entry) && typeof entry.label === "string" && typeof entry.description === "string"
|
|
51
|
+
&& typeof entry.opensDialog === "boolean" && (entry.values === undefined || isStringList(entry.values));
|
|
52
|
+
}
|
|
53
|
+
function isFlagList(entry) {
|
|
54
|
+
return Array.isArray(entry) && entry.every(flag => isRecord(flag) && typeof flag.key === "string" && typeof flag.label === "string");
|
|
55
|
+
}
|
|
56
|
+
function isBounds(entry) {
|
|
57
|
+
return isRecord(entry) && typeof entry.minimum === "number" && (entry.maximum === undefined || typeof entry.maximum === "number");
|
|
58
|
+
}
|
|
59
|
+
function isStringList(value) {
|
|
60
|
+
return Array.isArray(value) && value.every(item => typeof item === "string");
|
|
61
|
+
}
|
|
62
|
+
function isRecord(value) {
|
|
63
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
64
|
+
}
|
|
65
|
+
function describe(error) {
|
|
66
|
+
return error instanceof Error ? error.message : String(error);
|
|
67
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PiSettingsBridge } from "./settings-bridge.js";
|
|
2
|
+
import type { PiSettingOwnerHandlers } from "./settings-bridge.js";
|
|
3
|
+
import type { AgentSession, AgentSessionRuntime } from "../startup-public.js";
|
|
4
|
+
import type { OwnedUiThinkingLevel } from "../../../contracts/owned-ui/index.js";
|
|
5
|
+
import type { AgentSettingOwner } from "../../../contracts/agent-engine/index.js";
|
|
6
|
+
import { type PiPinnedSettingsCallback, type PiPinnedSettingsSnapshot, type PiWorkflowResult } from "./workflows.js";
|
|
7
|
+
export interface PiEngineSettingsOptions {
|
|
8
|
+
/** Themes installed on this machine, when the component adapter that owns the theme unit supplies them. */
|
|
9
|
+
readonly availableThemes: (() => readonly string[]) | null;
|
|
10
|
+
readonly productMode: "bare" | "comparison";
|
|
11
|
+
}
|
|
12
|
+
export interface PiEngineSettingsPorts {
|
|
13
|
+
runtime(): AgentSessionRuntime | undefined;
|
|
14
|
+
/** The bound session, or a thrown "not running" error before one exists. */
|
|
15
|
+
requireSession(): AgentSession;
|
|
16
|
+
/** The session's thinking level was written through the settings port; the adapter mirrors and publishes it. */
|
|
17
|
+
thinkingLevelChanged(level: OwnedUiThinkingLevel): void;
|
|
18
|
+
emitView(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Pinned Pi's settings as the owned UI reads and writes them: the lazily built settings port
|
|
22
|
+
* over the runtime's settings manager with its owner bindings, the pinned settings snapshot the
|
|
23
|
+
* settings dialog renders, and the pinned callback protocol that applies one setting and words
|
|
24
|
+
* its result. The runtime and session are reached through ports; the adapter publishes views.
|
|
25
|
+
*/
|
|
26
|
+
export declare class PiEngineSettings {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(options: PiEngineSettingsOptions, ports: PiEngineSettingsPorts);
|
|
29
|
+
/** Which settings surface this adapter serves; hidden-in-bare effects are unbindable in bare mode. */
|
|
30
|
+
get productMode(): "bare" | "comparison";
|
|
31
|
+
/**
|
|
32
|
+
* The theme the engine is configured with, in the engine's own grammar: a
|
|
33
|
+
* theme's name, or a `light/dark` pair meaning "follow the terminal".
|
|
34
|
+
*/
|
|
35
|
+
configuredTheme(): string | undefined;
|
|
36
|
+
/** Settings port for the live runtime, or null before the runtime is available. */
|
|
37
|
+
settingsPort(): PiSettingsBridge | null;
|
|
38
|
+
bindSettingsOwner(owner: AgentSettingOwner, handlers: PiSettingOwnerHandlers): () => void;
|
|
39
|
+
pinnedSettingsSnapshot(): PiPinnedSettingsSnapshot;
|
|
40
|
+
applyPinnedSettingValue(callback: PiPinnedSettingsCallback, value: unknown): Promise<PiWorkflowResult>;
|
|
41
|
+
applyPinnedSetting(selection: string, selectedValue?: unknown, hasSelectedValue?: boolean): Promise<PiWorkflowResult>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { configureOwnedHttpDispatcher } from "./http-dispatcher.js";
|
|
2
|
+
import { isRecord, readThinkingLevel, stringProperty } from "./message-values.js";
|
|
3
|
+
import { collectionResult } from "./resource-catalog.js";
|
|
4
|
+
import { MODEL_THINKING_DEFAULT, PiSettingsBridge } from "./settings-bridge.js";
|
|
5
|
+
import { workflowResult } from "./workflow-support.js";
|
|
6
|
+
import { PINNED_PI_SETTINGS_CALLBACKS } from "./workflows.js";
|
|
7
|
+
/**
|
|
8
|
+
* Pinned Pi's settings as the owned UI reads and writes them: the lazily built settings port
|
|
9
|
+
* over the runtime's settings manager with its owner bindings, the pinned settings snapshot the
|
|
10
|
+
* settings dialog renders, and the pinned callback protocol that applies one setting and words
|
|
11
|
+
* its result. The runtime and session are reached through ports; the adapter publishes views.
|
|
12
|
+
*/
|
|
13
|
+
export class PiEngineSettings {
|
|
14
|
+
#availableThemes;
|
|
15
|
+
#settingsProductMode;
|
|
16
|
+
#ports;
|
|
17
|
+
#settingsIntegration;
|
|
18
|
+
#settingsIntegrationManager;
|
|
19
|
+
constructor(options, ports) {
|
|
20
|
+
this.#availableThemes = options.availableThemes;
|
|
21
|
+
this.#settingsProductMode = options.productMode;
|
|
22
|
+
this.#ports = ports;
|
|
23
|
+
}
|
|
24
|
+
/** Which settings surface this adapter serves; hidden-in-bare effects are unbindable in bare mode. */
|
|
25
|
+
get productMode() {
|
|
26
|
+
return this.#settingsProductMode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The theme the engine is configured with, in the engine's own grammar: a
|
|
30
|
+
* theme's name, or a `light/dark` pair meaning "follow the terminal".
|
|
31
|
+
*/
|
|
32
|
+
configuredTheme() {
|
|
33
|
+
return this.#ports.runtime()?.services.settingsManager.getThemeSetting();
|
|
34
|
+
}
|
|
35
|
+
/** Settings port for the live runtime, or null before the runtime is available. */
|
|
36
|
+
settingsPort() {
|
|
37
|
+
const settings = this.#ports.runtime()?.services.settingsManager;
|
|
38
|
+
if (!settings || typeof settings.getCompactionEnabled !== "function")
|
|
39
|
+
return null;
|
|
40
|
+
if (this.#settingsIntegration === undefined || this.#settingsIntegrationManager !== settings) {
|
|
41
|
+
this.#settingsIntegrationManager = settings;
|
|
42
|
+
configureOwnedHttpDispatcher(settings.getHttpIdleTimeoutMs());
|
|
43
|
+
this.#settingsIntegration = new PiSettingsBridge(settings, {
|
|
44
|
+
...(this.#availableThemes === null ? {} : { themes: this.#availableThemes }),
|
|
45
|
+
models: () => this.#modelChoices(),
|
|
46
|
+
productMode: this.#settingsProductMode,
|
|
47
|
+
});
|
|
48
|
+
this.#settingsIntegration.bindOwner("shell", {
|
|
49
|
+
enableSkillCommands: { apply: value => {
|
|
50
|
+
if (typeof value !== "boolean")
|
|
51
|
+
throw new TypeError("Skill commands value is invalid");
|
|
52
|
+
settings.setEnableSkillCommands(value);
|
|
53
|
+
} },
|
|
54
|
+
doubleEscapeAction: { apply: value => {
|
|
55
|
+
if (value !== "tree" && value !== "fork" && value !== "none")
|
|
56
|
+
throw new TypeError("Double-Escape action is invalid");
|
|
57
|
+
settings.setDoubleEscapeAction(value);
|
|
58
|
+
} },
|
|
59
|
+
treeFilterMode: { apply: value => {
|
|
60
|
+
if (value !== "default" && value !== "no-tools" && value !== "user-only" && value !== "labeled-only" && value !== "all")
|
|
61
|
+
throw new TypeError("Tree filter mode is invalid");
|
|
62
|
+
settings.setTreeFilterMode(value);
|
|
63
|
+
} },
|
|
64
|
+
showCacheMissNotices: { apply: value => {
|
|
65
|
+
if (typeof value !== "boolean")
|
|
66
|
+
throw new TypeError("Cache-miss notice setting is invalid");
|
|
67
|
+
settings.setShowCacheMissNotices(value);
|
|
68
|
+
} },
|
|
69
|
+
});
|
|
70
|
+
this.#settingsIntegration.bindOwner("startup", {
|
|
71
|
+
// Invariant: deferred application is the owner operation: the next preflight reads
|
|
72
|
+
// the persisted default before constructing project-backed services.
|
|
73
|
+
defaultProjectTrust: { apply() { } },
|
|
74
|
+
collapseChangelog: { apply() { } },
|
|
75
|
+
});
|
|
76
|
+
this.#settingsIntegration.bindOwner("agent", {
|
|
77
|
+
autoCompact: { apply: value => {
|
|
78
|
+
if (typeof value !== "boolean")
|
|
79
|
+
throw new TypeError("Auto compact value is invalid");
|
|
80
|
+
this.#ports.requireSession().setAutoCompactionEnabled(value);
|
|
81
|
+
} },
|
|
82
|
+
autoResizeImages: { apply: value => {
|
|
83
|
+
if (typeof value !== "boolean")
|
|
84
|
+
throw new TypeError("Auto-resize images value is invalid");
|
|
85
|
+
settings.setImageAutoResize(value);
|
|
86
|
+
} },
|
|
87
|
+
blockImages: { apply: value => {
|
|
88
|
+
if (typeof value !== "boolean")
|
|
89
|
+
throw new TypeError("Block images value is invalid");
|
|
90
|
+
settings.setBlockImages(value);
|
|
91
|
+
} },
|
|
92
|
+
steeringMode: { apply: value => {
|
|
93
|
+
if (value !== "all" && value !== "one-at-a-time")
|
|
94
|
+
throw new TypeError("Steering mode is invalid");
|
|
95
|
+
this.#ports.requireSession().setSteeringMode(value);
|
|
96
|
+
} },
|
|
97
|
+
followUpMode: { apply: value => {
|
|
98
|
+
if (value !== "all" && value !== "one-at-a-time")
|
|
99
|
+
throw new TypeError("Follow-up mode is invalid");
|
|
100
|
+
this.#ports.requireSession().setFollowUpMode(value);
|
|
101
|
+
} },
|
|
102
|
+
transport: { apply: value => {
|
|
103
|
+
if (value !== "sse" && value !== "websocket" && value !== "websocket-cached" && value !== "auto")
|
|
104
|
+
throw new TypeError("Transport is invalid");
|
|
105
|
+
this.#ports.requireSession().agent.transport = value;
|
|
106
|
+
} },
|
|
107
|
+
httpIdleTimeoutMs: { apply: value => {
|
|
108
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0)
|
|
109
|
+
throw new TypeError("HTTP idle timeout is invalid");
|
|
110
|
+
// Invariant: provider streaming reads the manager per request; global fetch uses
|
|
111
|
+
// the matching owned dispatcher and zero maps to disabled semantics.
|
|
112
|
+
configureOwnedHttpDispatcher(value);
|
|
113
|
+
settings.setHttpIdleTimeoutMs(value);
|
|
114
|
+
} },
|
|
115
|
+
modelThinkingLevels: { apply: value => {
|
|
116
|
+
if (!isRecord(value))
|
|
117
|
+
throw new TypeError("Per-model thinking levels are invalid");
|
|
118
|
+
// Invariant: an override for the model in use takes effect now, as the pinned selector applies it;
|
|
119
|
+
// clearing it returns the session to the engine's global default.
|
|
120
|
+
const session = this.#ports.requireSession();
|
|
121
|
+
const model = session.model;
|
|
122
|
+
if (!model)
|
|
123
|
+
return;
|
|
124
|
+
const level = value[`${model.provider}/${model.id}`] ?? settings.getDefaultThinkingLevel() ?? "medium";
|
|
125
|
+
if (!isThinkingLevel(level))
|
|
126
|
+
throw new TypeError("Thinking level is invalid");
|
|
127
|
+
session.setThinkingLevel(level);
|
|
128
|
+
this.#ports.thinkingLevelChanged(readThinkingLevel(session.thinkingLevel));
|
|
129
|
+
} },
|
|
130
|
+
warnings: { apply: value => {
|
|
131
|
+
if (!isRecord(value) || Object.values(value).some(flag => typeof flag !== "boolean"))
|
|
132
|
+
throw new TypeError("Warnings setting is invalid");
|
|
133
|
+
settings.setWarnings(value);
|
|
134
|
+
} },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return this.#settingsIntegration;
|
|
138
|
+
}
|
|
139
|
+
// Rationale: the rows are the models the running engine offers, each with the levels the engine says it supports.
|
|
140
|
+
#modelChoices() {
|
|
141
|
+
const runtime = this.#ports.runtime();
|
|
142
|
+
const models = runtime?.services.modelRuntime.getAvailableSnapshot?.() ?? [];
|
|
143
|
+
const overrides = runtime?.services.settingsManager.getAllModelThinkingLevels?.() ?? {};
|
|
144
|
+
return models.map(model => {
|
|
145
|
+
const key = `${model.provider}/${model.id}`;
|
|
146
|
+
return {
|
|
147
|
+
key,
|
|
148
|
+
label: `${model.id} [${model.provider}]`,
|
|
149
|
+
description: overrides[key] === undefined ? "global default" : `override: ${overrides[key]}`,
|
|
150
|
+
levels: supportedThinkingLevels(model),
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
bindSettingsOwner(owner, handlers) {
|
|
155
|
+
const settings = this.settingsPort();
|
|
156
|
+
if (settings === null)
|
|
157
|
+
return () => { };
|
|
158
|
+
return settings.bindOwner(owner, handlers);
|
|
159
|
+
}
|
|
160
|
+
pinnedSettingsSnapshot() {
|
|
161
|
+
const session = this.#ports.requireSession();
|
|
162
|
+
const settings = this.#ports.runtime()?.services.settingsManager;
|
|
163
|
+
const setting = (getter, fallback) => {
|
|
164
|
+
const value = getter?.call(settings);
|
|
165
|
+
return value === undefined ? fallback : value;
|
|
166
|
+
};
|
|
167
|
+
const levels = session.getAvailableThinkingLevels?.();
|
|
168
|
+
const defaultProvider = settings?.getDefaultProvider?.();
|
|
169
|
+
const defaultModelId = settings?.getDefaultModel?.();
|
|
170
|
+
const themes = collectionResult(this.#ports.runtime()?.services.resourceLoader?.getThemes?.(), "themes").values
|
|
171
|
+
.map(theme => stringProperty(theme, "name"))
|
|
172
|
+
.filter((name) => !!name);
|
|
173
|
+
return {
|
|
174
|
+
autoCompact: typeof session.autoCompactionEnabled === "boolean"
|
|
175
|
+
? session.autoCompactionEnabled
|
|
176
|
+
: setting(settings?.getCompactionEnabled, true),
|
|
177
|
+
showImages: setting(settings?.getShowImages, true),
|
|
178
|
+
imageWidthCells: setting(settings?.getImageWidthCells, 80),
|
|
179
|
+
autoResizeImages: setting(settings?.getImageAutoResize, true),
|
|
180
|
+
blockImages: setting(settings?.getBlockImages, false),
|
|
181
|
+
enableSkillCommands: setting(settings?.getEnableSkillCommands, true),
|
|
182
|
+
steeringMode: session.steeringMode ?? setting(settings?.getSteeringMode, "one-at-a-time"),
|
|
183
|
+
followUpMode: session.followUpMode ?? setting(settings?.getFollowUpMode, "one-at-a-time"),
|
|
184
|
+
transport: setting(settings?.getTransport, "sse"),
|
|
185
|
+
httpIdleTimeoutMs: setting(settings?.getHttpIdleTimeoutMs, 300_000),
|
|
186
|
+
thinkingLevel: readThinkingLevel(session.thinkingLevel),
|
|
187
|
+
availableThinkingLevels: Array.isArray(levels) ? levels.map(readThinkingLevel) : ["off", "minimal", "low", "medium", "high", "xhigh"],
|
|
188
|
+
defaultThinkingLevel: readThinkingLevel(settings?.getDefaultThinkingLevel?.() ?? "medium"),
|
|
189
|
+
modelThinkingLevels: { ...(settings?.getAllModelThinkingLevels?.() ?? {}) },
|
|
190
|
+
defaultModel: defaultProvider && defaultModelId ? `${defaultProvider}/${defaultModelId}` : "not set",
|
|
191
|
+
...(session.model === undefined ? {} : { currentModel: session.model }),
|
|
192
|
+
availableDefaultModels: this.#ports.runtime()?.services.modelRuntime.getAvailableSnapshot?.() ?? [],
|
|
193
|
+
currentTheme: setting(settings?.getThemeSetting, setting(settings?.getTheme, "dark")),
|
|
194
|
+
terminalTheme: "dark",
|
|
195
|
+
availableThemes: themes.length > 0 ? themes : ["dark", "light"],
|
|
196
|
+
hideThinkingBlock: setting(settings?.getHideThinkingBlock, false),
|
|
197
|
+
mermaidRenderingMode: setting(settings?.getMermaidRenderingMode, "off"),
|
|
198
|
+
showCacheMissNotices: setting(settings?.getShowCacheMissNotices, false),
|
|
199
|
+
collapseChangelog: setting(settings?.getCollapseChangelog, true),
|
|
200
|
+
enableInstallTelemetry: setting(settings?.getEnableInstallTelemetry, true),
|
|
201
|
+
doubleEscapeAction: setting(settings?.getDoubleEscapeAction, "tree"),
|
|
202
|
+
treeFilterMode: setting(settings?.getTreeFilterMode, "default"),
|
|
203
|
+
showHardwareCursor: setting(settings?.getShowHardwareCursor, false),
|
|
204
|
+
editorPaddingX: setting(settings?.getEditorPaddingX, 0),
|
|
205
|
+
outputPad: setting(settings?.getOutputPad, 1),
|
|
206
|
+
autocompleteMaxVisible: setting(settings?.getAutocompleteMaxVisible, 5),
|
|
207
|
+
quietStartup: setting(settings?.getQuietStartup, false),
|
|
208
|
+
defaultProjectTrust: setting(settings?.getDefaultProjectTrust, "ask"),
|
|
209
|
+
clearOnShrink: setting(settings?.getClearOnShrink, false),
|
|
210
|
+
showTerminalProgress: setting(settings?.getShowTerminalProgress, false),
|
|
211
|
+
tuiMode: setting(settings?.getTuiMode, "regular"),
|
|
212
|
+
fullscreenExitOutput: setting(settings?.getFullscreenExitOutput, "transcript"),
|
|
213
|
+
fullscreenScrollbar: setting(settings?.getFullscreenScrollbar, "auto"),
|
|
214
|
+
fullscreenCopyOnSelect: setting(settings?.getFullscreenCopyOnSelect, false),
|
|
215
|
+
warnings: setting(settings?.getWarnings, { anthropicExtraUsage: true }),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
async applyPinnedSettingValue(callback, value) {
|
|
219
|
+
try {
|
|
220
|
+
return await this.applyPinnedSetting(callback, value, true);
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
return workflowResult("settings", "failed", error instanceof Error ? error.message : String(error));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
async applyPinnedSetting(selection, selectedValue, hasSelectedValue = false) {
|
|
227
|
+
if (!PINNED_PI_SETTINGS_CALLBACKS.includes(selection)) {
|
|
228
|
+
return workflowResult("settings", "failed", `Unknown setting callback: ${selection}`);
|
|
229
|
+
}
|
|
230
|
+
const callback = selection;
|
|
231
|
+
if (callback === "onCancel")
|
|
232
|
+
return workflowResult("settings", "cancelled", "Settings cancelled");
|
|
233
|
+
if (callback === "onThemePreview")
|
|
234
|
+
return workflowResult("settings", "completed", "Theme preview refreshed");
|
|
235
|
+
if (!hasSelectedValue) {
|
|
236
|
+
const snapshot = this.pinnedSettingsSnapshot();
|
|
237
|
+
const currentValues = {
|
|
238
|
+
onAutoCompactChange: snapshot.autoCompact,
|
|
239
|
+
onShowImagesChange: snapshot.showImages,
|
|
240
|
+
onImageWidthCellsChange: snapshot.imageWidthCells,
|
|
241
|
+
onAutoResizeImagesChange: snapshot.autoResizeImages,
|
|
242
|
+
onBlockImagesChange: snapshot.blockImages,
|
|
243
|
+
onEnableSkillCommandsChange: snapshot.enableSkillCommands,
|
|
244
|
+
onSteeringModeChange: snapshot.steeringMode,
|
|
245
|
+
onFollowUpModeChange: snapshot.followUpMode,
|
|
246
|
+
onTransportChange: snapshot.transport,
|
|
247
|
+
onHttpIdleTimeoutMsChange: snapshot.httpIdleTimeoutMs,
|
|
248
|
+
onModelThinkingLevelChange: snapshot.modelThinkingLevels,
|
|
249
|
+
onModelThinkingLevelRemove: snapshot.modelThinkingLevels,
|
|
250
|
+
onFullscreenCopyOnSelectChange: snapshot.fullscreenCopyOnSelect,
|
|
251
|
+
onThemeChange: snapshot.currentTheme,
|
|
252
|
+
onHideThinkingBlockChange: snapshot.hideThinkingBlock,
|
|
253
|
+
onMermaidRenderingModeChange: snapshot.mermaidRenderingMode,
|
|
254
|
+
onShowCacheMissNoticesChange: snapshot.showCacheMissNotices,
|
|
255
|
+
onCollapseChangelogChange: snapshot.collapseChangelog,
|
|
256
|
+
onEnableInstallTelemetryChange: snapshot.enableInstallTelemetry,
|
|
257
|
+
onQuietStartupChange: snapshot.quietStartup,
|
|
258
|
+
onDefaultProjectTrustChange: snapshot.defaultProjectTrust,
|
|
259
|
+
onDoubleEscapeActionChange: snapshot.doubleEscapeAction,
|
|
260
|
+
onTreeFilterModeChange: snapshot.treeFilterMode,
|
|
261
|
+
onShowHardwareCursorChange: snapshot.showHardwareCursor,
|
|
262
|
+
onEditorPaddingXChange: snapshot.editorPaddingX,
|
|
263
|
+
onOutputPadChange: snapshot.outputPad,
|
|
264
|
+
onAutocompleteMaxVisibleChange: snapshot.autocompleteMaxVisible,
|
|
265
|
+
onClearOnShrinkChange: snapshot.clearOnShrink,
|
|
266
|
+
onShowTerminalProgressChange: snapshot.showTerminalProgress,
|
|
267
|
+
onTuiModeChange: snapshot.tuiMode,
|
|
268
|
+
onFullscreenExitOutputChange: snapshot.fullscreenExitOutput,
|
|
269
|
+
onFullscreenScrollbarChange: snapshot.fullscreenScrollbar,
|
|
270
|
+
onWarningsChange: snapshot.warnings,
|
|
271
|
+
};
|
|
272
|
+
selectedValue = currentValues[callback];
|
|
273
|
+
hasSelectedValue = true;
|
|
274
|
+
}
|
|
275
|
+
const port = this.settingsPort();
|
|
276
|
+
if (port === null)
|
|
277
|
+
return workflowResult("settings", "failed", "Settings are unavailable");
|
|
278
|
+
const key = settingKeyForCallback(callback);
|
|
279
|
+
if (key === null)
|
|
280
|
+
return workflowResult("settings", "failed", `${settingLabel(callback)} is unavailable in this runtime`);
|
|
281
|
+
// Protocol: the pinned selector reports one model's override as (provider, modelId, level) or (provider, modelId);
|
|
282
|
+
// the port stores the whole record, so the change is folded into the current one.
|
|
283
|
+
if ((callback === "onModelThinkingLevelChange" || callback === "onModelThinkingLevelRemove") && Array.isArray(selectedValue)) {
|
|
284
|
+
const [provider, modelId, level] = selectedValue;
|
|
285
|
+
if (typeof provider !== "string" || typeof modelId !== "string")
|
|
286
|
+
return workflowResult("settings", "failed", "Per-model thinking override is invalid");
|
|
287
|
+
const overrides = { ...this.pinnedSettingsSnapshot().modelThinkingLevels };
|
|
288
|
+
const modelKey = `${provider}/${modelId}`;
|
|
289
|
+
if (callback === "onModelThinkingLevelRemove" || level === MODEL_THINKING_DEFAULT)
|
|
290
|
+
delete overrides[modelKey];
|
|
291
|
+
else if (typeof level === "string")
|
|
292
|
+
overrides[modelKey] = level;
|
|
293
|
+
selectedValue = overrides;
|
|
294
|
+
}
|
|
295
|
+
const result = await port.writeSetting(key, agentJsonValue(selectedValue));
|
|
296
|
+
if (result.status === "failed" || result.status === "unavailable") {
|
|
297
|
+
return workflowResult("settings", "failed", result.failure ?? result.limitationReason ?? `${settingLabel(callback)} is unavailable`);
|
|
298
|
+
}
|
|
299
|
+
this.#ports.emitView();
|
|
300
|
+
const suffix = result.status === "deferred" ? ` (${result.application})` : "";
|
|
301
|
+
return workflowResult("settings", "completed", `${settingLabel(callback)}: ${String(selectedValue)}${suffix}`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function settingKeyForCallback(callback) {
|
|
305
|
+
const keys = {
|
|
306
|
+
onAutoCompactChange: "autoCompact", onShowImagesChange: "showImages", onImageWidthCellsChange: "imageWidthCells",
|
|
307
|
+
onAutoResizeImagesChange: "autoResizeImages", onBlockImagesChange: "blockImages", onEnableSkillCommandsChange: "enableSkillCommands",
|
|
308
|
+
onSteeringModeChange: "steeringMode", onFollowUpModeChange: "followUpMode", onTransportChange: "transport",
|
|
309
|
+
onHttpIdleTimeoutMsChange: "httpIdleTimeoutMs", onModelThinkingLevelChange: "modelThinkingLevels", onModelThinkingLevelRemove: "modelThinkingLevels",
|
|
310
|
+
onThemeChange: "theme", onThemePreview: "theme", onFullscreenCopyOnSelectChange: "fullscreenCopyOnSelect",
|
|
311
|
+
onHideThinkingBlockChange: "hideThinkingBlock", onMermaidRenderingModeChange: "mermaidRenderingMode",
|
|
312
|
+
onShowCacheMissNoticesChange: "showCacheMissNotices", onCollapseChangelogChange: "collapseChangelog",
|
|
313
|
+
onEnableInstallTelemetryChange: "enableInstallTelemetry", onQuietStartupChange: "quietStartup",
|
|
314
|
+
onDefaultProjectTrustChange: "defaultProjectTrust", onDoubleEscapeActionChange: "doubleEscapeAction",
|
|
315
|
+
onTreeFilterModeChange: "treeFilterMode", onShowHardwareCursorChange: "showHardwareCursor",
|
|
316
|
+
onEditorPaddingXChange: "editorPaddingX", onOutputPadChange: "outputPad", onAutocompleteMaxVisibleChange: "autocompleteMaxVisible",
|
|
317
|
+
onClearOnShrinkChange: "clearOnShrink", onShowTerminalProgressChange: "showTerminalProgress", onTuiModeChange: "tuiMode",
|
|
318
|
+
onFullscreenExitOutputChange: "fullscreenExitOutput", onFullscreenScrollbarChange: "fullscreenScrollbar", onWarningsChange: "warnings",
|
|
319
|
+
};
|
|
320
|
+
return keys[callback] ?? null;
|
|
321
|
+
}
|
|
322
|
+
function agentJsonValue(value) {
|
|
323
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" || (typeof value === "number" && Number.isFinite(value)))
|
|
324
|
+
return value;
|
|
325
|
+
if (Array.isArray(value))
|
|
326
|
+
return value.map(agentJsonValue);
|
|
327
|
+
if (isRecord(value))
|
|
328
|
+
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined).map(([key, item]) => [key, agentJsonValue(item)]));
|
|
329
|
+
throw new TypeError("setting value must be JSON serializable");
|
|
330
|
+
}
|
|
331
|
+
function isThinkingLevel(value) {
|
|
332
|
+
return typeof value === "string" && ["off", "minimal", "low", "medium", "high", "xhigh", "max"].includes(value);
|
|
333
|
+
}
|
|
334
|
+
/** The engine's own rule: no reasoning means "off" only; xhigh and max exist only where the model maps them. */
|
|
335
|
+
function supportedThinkingLevels(model) {
|
|
336
|
+
if (!model.reasoning)
|
|
337
|
+
return ["off"];
|
|
338
|
+
return ["off", "minimal", "low", "medium", "high", "xhigh", "max"].filter(level => {
|
|
339
|
+
const mapped = model.thinkingLevelMap?.[level];
|
|
340
|
+
if (mapped === null)
|
|
341
|
+
return false;
|
|
342
|
+
if (level === "xhigh" || level === "max")
|
|
343
|
+
return mapped !== undefined;
|
|
344
|
+
return true;
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
function settingLabel(callback) {
|
|
348
|
+
return callback
|
|
349
|
+
.replace(/^on/, "")
|
|
350
|
+
.replace(/Change$|Preview$|Cancel$/, "")
|
|
351
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
352
|
+
.replace(/^./, character => character.toUpperCase());
|
|
353
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TranscriptImageAssets } from "./transcript-image-assets.js";
|
|
2
|
+
import { type OwnedUiTranscriptBlock, type OwnedUiTranscriptImageReference } from "../../../contracts/owned-ui/index.js";
|
|
3
|
+
export interface PiTranscriptProjectionPorts {
|
|
4
|
+
/** Pinned Pi's current retry attempt, which words an aborted declaration's failure text. */
|
|
5
|
+
retryAttempt(): number;
|
|
6
|
+
/** Called once per stored block change, in order, so the adapter can deliver it. */
|
|
7
|
+
blockChanged(block: OwnedUiTranscriptBlock): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The transcript as the owned UI sees it: Pi's session messages and tool events projected into
|
|
11
|
+
* ordered, revisioned blocks. The projection owns block identity (message and tool ids that stay
|
|
12
|
+
* stable across streaming, settlement, and rebuilds), revision numbering, image asset retention,
|
|
13
|
+
* and the reconciliation rules that keep late or duplicate events from disturbing a settled
|
|
14
|
+
* block. It never touches delivery: the adapter seals pending snapshots before a replacement and
|
|
15
|
+
* receives each changed block through the ports.
|
|
16
|
+
*/
|
|
17
|
+
export declare class PiTranscriptProjection {
|
|
18
|
+
#private;
|
|
19
|
+
readonly assets: TranscriptImageAssets;
|
|
20
|
+
constructor(ports: PiTranscriptProjectionPorts);
|
|
21
|
+
/** The current blocks in transcript order; not a copy. */
|
|
22
|
+
get blocks(): readonly OwnedUiTranscriptBlock[];
|
|
23
|
+
/** A frozen copy that stays identical until the next change, so views can share it. */
|
|
24
|
+
snapshot(): readonly OwnedUiTranscriptBlock[];
|
|
25
|
+
/** Replace every block; the caller has already sealed pending delivery snapshots. */
|
|
26
|
+
replace(blocks: OwnedUiTranscriptBlock[]): void;
|
|
27
|
+
block(id: string): OwnedUiTranscriptBlock | undefined;
|
|
28
|
+
/** Fold a finished run's messages into the transcript without replacing session-authoritative scope. */
|
|
29
|
+
mergeRun(messages: readonly unknown[], sessionMessages: readonly unknown[]): void;
|
|
30
|
+
/** Build the authoritative block list for `messages`, reusing unchanged blocks so their rendered rows survive. */
|
|
31
|
+
rebuild(messages: readonly unknown[], status: OwnedUiTranscriptBlock["status"]): OwnedUiTranscriptBlock[];
|
|
32
|
+
upsertMessage(message: unknown, status: OwnedUiTranscriptBlock["status"]): OwnedUiTranscriptBlock | undefined;
|
|
33
|
+
messageBlocks(message: unknown, status: OwnedUiTranscriptBlock["status"], fallbackIndex: number, occurrence?: number, currentBlock?: (id: string) => OwnedUiTranscriptBlock | undefined): OwnedUiTranscriptBlock[];
|
|
34
|
+
settleFailedDeclarations(message: unknown): void;
|
|
35
|
+
imageReferences(content: unknown, source: OwnedUiTranscriptImageReference["source"]): readonly OwnedUiTranscriptImageReference[];
|
|
36
|
+
upsertToolExecution(event: Record<string, unknown>): void;
|
|
37
|
+
upsert(block: OwnedUiTranscriptBlock): void;
|
|
38
|
+
nextRevision(id: string): number;
|
|
39
|
+
}
|