@timurproko/a1 0.1.8-dev.472 → 0.1.8-dev.508
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +4 -5
- package/bin/guardian.js +5 -1
- package/bin/module-identity.js +53 -98
- package/bin/module-resolver.js +138 -0
- package/bin/pinned-pi-public.js +25 -6
- package/bin/ui.js +7 -2
- package/bin/update-recovery.js +76 -7
- package/bin/warmup.js +3 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-diagnostics.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-image.js +1 -1
- package/dist/app/session-shell/helper-pool.d.ts +33 -0
- package/dist/app/session-shell/helper-pool.js +98 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation-client.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation-client.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-source.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-worker.js +1 -1
- package/dist/app/session-shell/index.d.ts +7 -0
- package/dist/app/session-shell/index.js +4 -0
- package/dist/app/session-shell/paste-executor.d.ts +18 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-executor.js +50 -29
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-helper.js +1 -1
- package/dist/app/session-shell/paste-preparation-client.d.ts +31 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-preparation-client.js +19 -8
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-protocol.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-protocol.js +1 -1
- package/dist/app/session-shell/paste-text-preparation.d.ts +6 -0
- package/dist/{integrations/pi/session-ui/paste-text-preparation.d.ts → app/session-shell/paste-types.d.ts} +1 -4
- package/dist/{integrations/pi/session-ui → app/session-shell}/path-chip-presentation.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-chips.d.ts +5 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-chips.js +6 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-history-controller.d.ts +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-history-controller.js +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.js +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-coordinator.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-coordinator.js +3 -5
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-helper.js +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-protocol.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-transport.d.ts +10 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-transport.js +45 -19
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell-root.d.ts +75 -53
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell-root.js +30 -20
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell.d.ts +9 -8
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell.js +108 -67
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-viewport-controller.d.ts +5 -5
- package/dist/{integrations/pi/session-ui → app/session-shell}/session-viewport-controller.js +5 -5
- package/dist/{integrations/pi/session-ui → app/session-shell}/system-clipboard.d.ts +1 -1
- package/dist/{integrations/pi/session-ui → app/session-shell}/system-clipboard.js +1 -1
- package/dist/cli/index.d.ts +8 -5
- package/dist/cli/index.js +4 -5
- package/dist/composition/index.d.ts +0 -1
- package/dist/composition/index.js +0 -1
- package/dist/composition/owned-ui.d.ts +2 -2
- package/dist/composition/owned-ui.js +35 -36
- package/dist/composition/settings-route-host.d.ts +2 -2
- package/dist/contracts/agent-engine/domain.d.ts +6 -1
- package/dist/contracts/agent-engine/index.d.ts +11 -8
- package/dist/contracts/agent-engine/index.js +6 -8
- package/dist/contracts/owned-ui/extension-ui.d.ts +8 -0
- package/dist/contracts/owned-ui/index.d.ts +12 -8
- package/dist/contracts/owned-ui/index.js +8 -8
- package/dist/features/launch/index.d.ts +12 -6
- package/dist/features/launch/index.js +6 -6
- package/dist/features/launch/intent.d.ts +5 -5
- package/dist/features/launch/intent.js +2 -2
- package/dist/features/owned-ui/index.d.ts +6 -6
- package/dist/features/owned-ui/index.js +4 -6
- package/dist/features/owned-ui/run.d.ts +2 -2
- package/dist/features/owned-ui/settings-app.d.ts +2 -2
- package/dist/features/owned-ui/settings-app.js +18 -5
- package/dist/features/prompt-history/service.d.ts +1 -1
- package/dist/features/prompt-history/service.js +1 -1
- package/dist/features/prompt-history/store.js +3 -7
- package/dist/features/prompt-suggestions/diagnostics.js +1 -1
- package/dist/features/prompt-suggestions/index.d.ts +2 -1
- package/dist/features/prompt-suggestions/index.js +1 -1
- package/dist/foundation/launch-guardian/index.d.ts +2 -1
- package/dist/foundation/launch-guardian/index.js +1 -1
- package/dist/foundation/lifecycle/index.d.ts +11 -6
- package/dist/foundation/lifecycle/index.js +5 -6
- package/dist/foundation/process-containment/index.d.ts +8 -6
- package/dist/foundation/process-containment/index.js +6 -6
- package/dist/foundation/process-containment/native-guardian-containment.js +3 -3
- package/dist/foundation/protocol/index.d.ts +3 -2
- package/dist/foundation/protocol/index.js +2 -2
- package/dist/foundation/release/bootstrap.d.ts +0 -4
- package/dist/foundation/release/bootstrap.js +1 -82
- package/dist/foundation/release/dependency-layer.d.ts +2 -5
- package/dist/foundation/release/endpoints.d.ts +4 -0
- package/dist/foundation/release/endpoints.js +86 -2
- package/dist/foundation/release/index.d.ts +30 -16
- package/dist/foundation/release/index.js +16 -16
- package/dist/foundation/release/release.d.ts +1 -1
- package/dist/foundation/release/types.d.ts +11 -0
- package/dist/foundation/release/types.js +1 -0
- package/dist/foundation/release/update-transaction.d.ts +1 -1
- package/dist/foundation/release/update.d.ts +2 -1
- package/dist/foundation/release/update.js +3 -18
- package/dist/foundation/startup/index.d.ts +4 -2
- package/dist/foundation/startup/index.js +2 -2
- package/dist/foundation/startup/startup-descriptor.js +2 -2
- package/dist/foundation/storage/control-store.d.ts +1 -45
- package/dist/foundation/storage/control-store.js +54 -277
- package/dist/foundation/storage/index.d.ts +1 -1
- package/dist/foundation/storage/index.js +1 -1
- package/dist/foundation/supervision/index.d.ts +2 -2
- package/dist/foundation/supervision/index.js +2 -2
- package/dist/foundation/supervision/server.d.ts +5 -10
- package/dist/foundation/supervision/server.js +7 -7
- package/dist/foundation/terminal-cleanup/index.d.ts +3 -2
- package/dist/foundation/terminal-cleanup/index.js +2 -2
- package/dist/integrations/pi/components/editor-interaction.d.ts +1 -1
- package/dist/integrations/pi/components/history-editor-loader.d.ts +1 -1
- package/dist/integrations/pi/components/index.d.ts +20 -13
- package/dist/integrations/pi/components/index.js +12 -13
- package/dist/integrations/pi/components/owned-editor-ux.js +5 -8
- package/dist/integrations/pi/components/resources/builtin-themes.d.ts +7 -5
- package/dist/integrations/pi/components/resources/builtin-themes.js +7 -5
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +1 -1
- package/dist/integrations/pi/components/shell-extension-ui.js +2 -1
- package/dist/integrations/pi/components/shell-footer-status.js +1 -1
- package/dist/integrations/pi/components/shell-presenters-info.d.ts +1 -1
- package/dist/integrations/pi/components/shell-presenters-info.js +1 -1
- package/dist/integrations/pi/components/shell-presenters-transcript.js +1 -1
- package/dist/integrations/pi/components/shell-selectors-dialogs.d.ts +9 -3
- package/dist/integrations/pi/components/shell-selectors-dialogs.js +9 -6
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +3 -1
- package/dist/integrations/pi/components/shell-shared-facade.js +4 -2
- package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +1 -1
- package/dist/integrations/pi/components/submitted-prompt-adapter.js +1 -1
- package/dist/integrations/pi/components/tool-image-presentation.d.ts +1 -1
- package/dist/integrations/pi/components/tool-image-presentation.js +4 -7
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +36 -22
- package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +43 -7
- package/dist/integrations/pi/components/upstream/assets/earendil-image.json +2 -2
- package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +6 -3
- package/dist/integrations/pi/components/upstream/components/daxnuts.d.ts +8 -1
- package/dist/integrations/pi/components/upstream/components/daxnuts.js +7 -3
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +10 -4
- package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +7 -4
- package/dist/integrations/pi/components/upstream/components/extension-editor.js +7 -4
- package/dist/integrations/pi/components/upstream/components/mermaid.js +8 -4
- package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +9 -5
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +10 -6
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +8 -4
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +27 -25
- package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/session-footer.js +8 -10
- package/dist/integrations/pi/components/upstream/components/session-selector-search.js +6 -4
- package/dist/integrations/pi/components/upstream/components/session-selector.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/session-selector.js +8 -4
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +7 -5
- package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +8 -6
- package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +9 -4
- package/dist/integrations/pi/components/upstream/components/status-indicator.js +15 -5
- package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +8 -2
- package/dist/integrations/pi/components/upstream/components/tool-execution.js +58 -37
- package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +7 -4
- package/dist/integrations/pi/components/upstream/components/tree-selector.js +7 -4
- package/dist/integrations/pi/components/upstream/components/trust-selector.d.ts +1 -1
- package/dist/integrations/pi/components/upstream/components/trust-selector.js +10 -5
- package/dist/integrations/pi/components/upstream/external-editor.js +8 -4
- package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +13 -4
- package/dist/integrations/pi/components/upstream/history/editor-core.js +112 -30
- package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +6 -3
- package/dist/integrations/pi/components/upstream/history/kill-ring.js +6 -3
- package/dist/integrations/pi/components/upstream/history/printable-key.js +7 -4
- package/dist/integrations/pi/components/upstream/history/text-helpers.js +6 -3
- package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +6 -3
- package/dist/integrations/pi/components/upstream/history/undo-stack.js +6 -3
- package/dist/integrations/pi/components/upstream/history/word-navigation.js +6 -3
- package/dist/integrations/pi/components/upstream/model-search.d.ts +5 -2
- package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +8 -0
- package/dist/integrations/pi/components/upstream/theme/theme-controller.js +0 -3
- package/dist/integrations/pi/components/upstream/theme/theme.d.ts +2 -2
- package/dist/integrations/pi/components/upstream/theme/theme.js +17 -6
- package/dist/integrations/pi/engine/adapter.d.ts +39 -138
- package/dist/integrations/pi/engine/adapter.js +338 -3226
- package/dist/integrations/pi/engine/command-dispatch.d.ts +41 -0
- package/dist/integrations/pi/engine/command-dispatch.js +125 -0
- package/dist/integrations/pi/engine/event-delivery.d.ts +100 -0
- package/dist/integrations/pi/engine/event-delivery.js +184 -0
- package/dist/integrations/pi/engine/extension-ui-binding.d.ts +35 -0
- package/dist/integrations/pi/engine/extension-ui-binding.js +81 -0
- package/dist/integrations/pi/engine/index.d.ts +18 -14
- package/dist/integrations/pi/engine/index.js +10 -14
- package/dist/integrations/pi/engine/message-values.d.ts +29 -0
- package/dist/integrations/pi/engine/message-values.js +168 -0
- package/dist/integrations/pi/engine/pending-delivery.d.ts +2 -2
- package/dist/integrations/pi/engine/pending-delivery.js +2 -4
- package/dist/integrations/pi/engine/pi-settings-metadata.json +382 -371
- package/dist/integrations/pi/engine/prompt-suggestions.d.ts +30 -0
- package/dist/integrations/pi/engine/prompt-suggestions.js +102 -0
- package/dist/integrations/pi/engine/provider-authentication.d.ts +34 -0
- package/dist/integrations/pi/engine/provider-authentication.js +209 -0
- package/dist/integrations/pi/engine/resource-catalog.d.ts +49 -0
- package/dist/integrations/pi/engine/resource-catalog.js +289 -0
- package/dist/integrations/pi/engine/resources/changelog.json +4 -4
- package/dist/integrations/pi/engine/session-events.d.ts +48 -0
- package/dist/integrations/pi/engine/session-events.js +223 -0
- package/dist/integrations/pi/engine/session-integration.js +2 -4
- package/dist/integrations/pi/engine/session-runtime.d.ts +84 -0
- package/dist/integrations/pi/engine/session-runtime.js +249 -0
- package/dist/integrations/pi/engine/{settings-effects.d.ts → settings-bridge.d.ts} +57 -2
- package/dist/integrations/pi/engine/settings-bridge.js +514 -0
- package/dist/integrations/pi/engine/settings-metadata.d.ts +31 -0
- package/dist/integrations/pi/engine/settings-metadata.js +67 -0
- package/dist/integrations/pi/engine/settings-port.d.ts +42 -0
- package/dist/integrations/pi/engine/settings-port.js +353 -0
- package/dist/integrations/pi/engine/transcript-projection.d.ts +39 -0
- package/dist/integrations/pi/engine/transcript-projection.js +405 -0
- package/dist/integrations/pi/engine/usage-view.d.ts +4 -0
- package/dist/integrations/pi/engine/usage-view.js +56 -0
- package/dist/integrations/pi/engine/workflow-contexts.d.ts +59 -0
- package/dist/integrations/pi/engine/workflow-contexts.js +316 -0
- package/dist/integrations/pi/engine/workflow-runner.d.ts +60 -0
- package/dist/integrations/pi/engine/workflow-runner.js +509 -0
- package/dist/integrations/pi/engine/workflow-support.d.ts +33 -0
- package/dist/integrations/pi/engine/workflow-support.js +352 -0
- package/dist/integrations/pi/engine/workflows.d.ts +63 -2
- package/dist/integrations/pi/engine/workflows.js +5 -2
- package/dist/integrations/pi/startup-public.js +576 -554
- package/dist/integrations/pi/startup-public.manifest.json +1730 -984
- package/dist/integrations/pi/tui-runtime/adapter.js +10 -13
- package/dist/integrations/pi/tui-runtime/contracts.d.ts +11 -1
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +1 -1
- package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +4 -7
- package/dist/integrations/pi/tui-runtime/index.d.ts +8 -6
- package/dist/integrations/pi/tui-runtime/index.js +4 -6
- package/dist/integrations/pi/tui-runtime/mouse-report-input.js +2 -4
- package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +2 -2
- package/dist/integrations/pi/tui-runtime/overlay-geometry.js +4 -5
- package/dist/integrations/pi/tui-runtime/presentation-adapter.js +1 -1
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/runtime-payload-inventory.json +51320 -46509
- package/dist/ui/apps/index.d.ts +5 -3
- package/dist/ui/apps/index.js +3 -3
- package/dist/ui/components/index.d.ts +47 -25
- package/dist/ui/components/index.js +25 -25
- package/dist/ui/components/prompt-input.js +1 -4
- package/dist/ui/settings/declarations.d.ts +119 -0
- package/dist/ui/settings/declarations.js +20 -11
- package/dist/ui/settings/index.d.ts +10 -6
- package/dist/ui/settings/index.js +5 -6
- package/dist/ui/settings/manager.d.ts +54 -0
- package/dist/ui/settings/{session.js → manager.js} +101 -9
- package/dist/ui/settings/sections.d.ts +2 -7
- package/docs/architecture/boundaries.md +4 -4
- package/docs/architecture/history-editor-provenance.md +1 -1
- package/docs/architecture/project-structure.md +6 -6
- package/docs/architecture/prompt-suggestions.md +1 -1
- package/docs/architecture/terminal-host-proof-gate.md +1 -1
- package/docs/architecture/terminal-host-spike-evidence.md +1 -1
- package/docs/architecture/toolchain.md +8 -0
- package/docs/architecture/ui-reference-provenance.md +4 -4
- package/docs/ci-release-runbook.md +7 -1
- package/docs/features/modal-content-interaction.md +2 -2
- package/docs/local-worktree-cleanup.md +4 -2
- package/docs/validation.md +6 -4
- package/package.json +7 -11
- package/bin/pi-tui.d.ts +0 -6
- package/bin/pi-tui.js +0 -28
- package/bin/sync-pi-tui-proxy.js +0 -97
- package/dist/cli/version.d.ts +0 -2
- package/dist/cli/version.js +0 -23
- package/dist/composition/agent-engine-bridge.d.ts +0 -3
- package/dist/composition/agent-engine-bridge.js +0 -108
- package/dist/composition/process.d.ts +0 -16
- package/dist/composition/process.js +0 -45
- package/dist/contracts/workspace/index.d.ts +0 -2
- package/dist/contracts/workspace/index.js +0 -2
- package/dist/contracts/workspace/model.d.ts +0 -248
- package/dist/contracts/workspace/model.js +0 -2
- package/dist/contracts/workspace/validation.d.ts +0 -13
- package/dist/contracts/workspace/validation.js +0 -335
- package/dist/features/owned-ui/customization.d.ts +0 -40
- package/dist/features/owned-ui/customization.js +0 -110
- package/dist/features/owned-ui/diagnostics.d.ts +0 -34
- package/dist/features/owned-ui/diagnostics.js +0 -95
- package/dist/features/workspace/capabilities.d.ts +0 -31
- package/dist/features/workspace/capabilities.js +0 -75
- package/dist/features/workspace/index.d.ts +0 -6
- package/dist/features/workspace/index.js +0 -6
- package/dist/features/workspace/presentation.d.ts +0 -30
- package/dist/features/workspace/presentation.js +0 -70
- package/dist/features/workspace/reconciliation.d.ts +0 -15
- package/dist/features/workspace/reconciliation.js +0 -82
- package/dist/features/workspace/reducer.d.ts +0 -43
- package/dist/features/workspace/reducer.js +0 -214
- package/dist/features/workspace/router.d.ts +0 -32
- package/dist/features/workspace/router.js +0 -125
- package/dist/features/workspace/store.d.ts +0 -18
- package/dist/features/workspace/store.js +0 -55
- package/dist/foundation/native-host-protocol/codec.d.ts +0 -13
- package/dist/foundation/native-host-protocol/codec.js +0 -58
- package/dist/foundation/native-host-protocol/evidence.d.ts +0 -67
- package/dist/foundation/native-host-protocol/evidence.js +0 -141
- package/dist/foundation/native-host-protocol/index.d.ts +0 -4
- package/dist/foundation/native-host-protocol/index.js +0 -4
- package/dist/foundation/native-host-protocol/messages.d.ts +0 -56
- package/dist/foundation/native-host-protocol/messages.js +0 -149
- package/dist/foundation/native-host-protocol/proof-gate.d.ts +0 -13
- package/dist/foundation/native-host-protocol/proof-gate.js +0 -33
- package/dist/foundation/structured-agent-runtime/backpressure.d.ts +0 -47
- package/dist/foundation/structured-agent-runtime/backpressure.js +0 -119
- package/dist/foundation/structured-agent-runtime/commands.d.ts +0 -53
- package/dist/foundation/structured-agent-runtime/commands.js +0 -165
- package/dist/foundation/structured-agent-runtime/handshake.d.ts +0 -41
- package/dist/foundation/structured-agent-runtime/handshake.js +0 -151
- package/dist/foundation/structured-agent-runtime/index.d.ts +0 -5
- package/dist/foundation/structured-agent-runtime/index.js +0 -5
- package/dist/foundation/structured-agent-runtime/reconnection.d.ts +0 -38
- package/dist/foundation/structured-agent-runtime/reconnection.js +0 -130
- package/dist/foundation/structured-agent-runtime/state.d.ts +0 -57
- package/dist/foundation/structured-agent-runtime/state.js +0 -119
- package/dist/integrations/pi/components/upstream/components/custom-entry.d.ts +0 -17
- package/dist/integrations/pi/components/upstream/components/custom-entry.js +0 -51
- package/dist/integrations/pi/components/upstream/components/first-time-setup.d.ts +0 -24
- package/dist/integrations/pi/components/upstream/components/first-time-setup.js +0 -105
- package/dist/integrations/pi/components/upstream/components/markdown-transform.d.ts +0 -2
- package/dist/integrations/pi/components/upstream/components/markdown-transform.js +0 -18
- package/dist/integrations/pi/engine/model-auth-integration.d.ts +0 -31
- package/dist/integrations/pi/engine/model-auth-integration.js +0 -62
- package/dist/integrations/pi/engine/resource-extension-integration.d.ts +0 -32
- package/dist/integrations/pi/engine/resource-extension-integration.js +0 -81
- package/dist/integrations/pi/engine/settings-effects.js +0 -249
- package/dist/integrations/pi/engine/settings-integration.d.ts +0 -43
- package/dist/integrations/pi/engine/settings-integration.js +0 -227
- package/dist/integrations/pi/engine/workflow-controllers.d.ts +0 -21
- package/dist/integrations/pi/engine/workflow-controllers.js +0 -49
- package/dist/integrations/pi/session-ui/index.d.ts +0 -5
- package/dist/integrations/pi/session-ui/index.js +0 -5
- package/dist/integrations/pi/session-ui/paste-executor.d.ts +0 -10
- package/dist/integrations/pi/session-ui/paste-preparation-client.d.ts +0 -16
- package/dist/integrations/pi/session-ui/route-host.d.ts +0 -5
- package/dist/integrations/pi/tui-runtime/conformance.d.ts +0 -18
- package/dist/integrations/pi/tui-runtime/conformance.js +0 -145
- package/dist/ui/components/prompt-row.d.ts +0 -14
- package/dist/ui/components/prompt-row.js +0 -20
- package/dist/ui/settings/session.d.ts +0 -36
- package/dist/ui/settings/store.d.ts +0 -29
- package/dist/ui/settings/store.js +0 -91
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-diagnostics.js +2 -2
- package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-image.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/editor-hyperlink-budget.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/editor-hyperlink-budget.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-source.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/image-worker.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-helper.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-preparation.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-worker.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-worker.js +0 -0
- package/dist/{integrations/pi/session-ui/response-copy-helper.d.ts → app/session-shell/paste-types.js} +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/path-chip-presentation.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro-effects.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro-effects.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro.d.ts +0 -0
- package/dist/{integrations/pi/session-ui/route-host.js → app/session-shell/response-copy-helper.d.ts} +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-protocol.js +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/stream-presentation-coalescer.d.ts +0 -0
- package/dist/{integrations/pi/session-ui → app/session-shell}/stream-presentation-coalescer.js +3 -3
- /package/dist/{integrations/pi/session-ui → app/session-shell}/text-paste.d.ts +0 -0
- /package/dist/{integrations/pi/session-ui → app/session-shell}/text-paste.js +0 -0
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import { NATIVE_HOST_PROTOCOL_VERSION, WORKSPACE_CONTRACT_VERSION } from "./model.js";
|
|
2
|
-
const MAX_ID_LENGTH = 128;
|
|
3
|
-
const MAX_LABEL_LENGTH = 256;
|
|
4
|
-
const MAX_COLLECTION_LENGTH = 10_000;
|
|
5
|
-
const MAX_ENVIRONMENT_ENTRIES = 512;
|
|
6
|
-
const MAX_ARGUMENTS = 1_024;
|
|
7
|
-
const MAX_POSITION = Number.MAX_SAFE_INTEGER;
|
|
8
|
-
const MAX_LIMIT = 1_000_000_000;
|
|
9
|
-
export function assertManagedAgentDescriptor(agent) {
|
|
10
|
-
assertId(agent.id, "agent id");
|
|
11
|
-
assertText(agent.displayName, "agent display name", MAX_LABEL_LENGTH);
|
|
12
|
-
assertId(agent.adapterId, "adapter id");
|
|
13
|
-
assertIsoDate(agent.createdAt, "agent creation time");
|
|
14
|
-
if (agent.recoveryReferenceId !== null)
|
|
15
|
-
assertId(agent.recoveryReferenceId, "recovery reference id");
|
|
16
|
-
assertAgentCapability(agent.capability);
|
|
17
|
-
if (agent.runtime !== agent.capability.kind)
|
|
18
|
-
throw new TypeError("agent runtime must match its capability kind");
|
|
19
|
-
}
|
|
20
|
-
export function assertAgentCapability(capability) {
|
|
21
|
-
if (capability.kind === "structured") {
|
|
22
|
-
assertStructuredCapability(capability);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
assertComposedTerminalCapability(capability);
|
|
26
|
-
}
|
|
27
|
-
export function assertStructuredCapability(capability) {
|
|
28
|
-
if (capability.protocolVersion !== WORKSPACE_CONTRACT_VERSION)
|
|
29
|
-
throw new TypeError("unsupported structured protocol version");
|
|
30
|
-
assertId(capability.adapterId, "structured adapter id");
|
|
31
|
-
assertUniqueText(capability.commands, "structured commands");
|
|
32
|
-
assertUniqueText(capability.eventTypes, "structured event types");
|
|
33
|
-
assertUniqueText(capability.attachmentTypes, "structured attachment types");
|
|
34
|
-
if (capability.resume === "position" && capability.snapshots === "none") {
|
|
35
|
-
throw new TypeError("position resume requires authoritative snapshots for gap recovery");
|
|
36
|
-
}
|
|
37
|
-
if (capability.resume === "snapshot" && capability.snapshots !== "authoritative") {
|
|
38
|
-
throw new TypeError("snapshot resume requires authoritative snapshots");
|
|
39
|
-
}
|
|
40
|
-
for (const [name, value] of Object.entries(capability.flow))
|
|
41
|
-
assertBoundedPositiveInteger(value, `structured flow ${name}`);
|
|
42
|
-
}
|
|
43
|
-
export function assertComposedTerminalCapability(capability) {
|
|
44
|
-
if (capability.protocolVersion !== NATIVE_HOST_PROTOCOL_VERSION)
|
|
45
|
-
throw new TypeError("unsupported native-host protocol version");
|
|
46
|
-
assertId(capability.hostInstanceId, "native host instance id");
|
|
47
|
-
assertRevision(capability.topologyRevision, "topology revision");
|
|
48
|
-
}
|
|
49
|
-
export function assertWorkspaceSnapshot(snapshot) {
|
|
50
|
-
if (snapshot.contractVersion !== WORKSPACE_CONTRACT_VERSION)
|
|
51
|
-
throw new TypeError("unsupported workspace contract version");
|
|
52
|
-
assertId(snapshot.workspaceId, "workspace id");
|
|
53
|
-
assertRevision(snapshot.revision, "workspace revision");
|
|
54
|
-
assertCollection(snapshot.agents, "workspace agents");
|
|
55
|
-
const ids = new Set();
|
|
56
|
-
for (const agent of snapshot.agents) {
|
|
57
|
-
assertManagedAgentDescriptor(agent);
|
|
58
|
-
if (ids.has(agent.id))
|
|
59
|
-
throw new TypeError(`duplicate agent id: ${agent.id}`);
|
|
60
|
-
ids.add(agent.id);
|
|
61
|
-
}
|
|
62
|
-
if (snapshot.selectedAgentId !== null && !ids.has(snapshot.selectedAgentId)) {
|
|
63
|
-
throw new TypeError("selected agent must exist in the workspace snapshot");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export function assertWorkspaceCommand(command) {
|
|
67
|
-
assertId(command.correlationId, "command correlation id");
|
|
68
|
-
switch (command.type) {
|
|
69
|
-
case "create-agent":
|
|
70
|
-
assertManagedAgentDescriptor(command.agent);
|
|
71
|
-
return;
|
|
72
|
-
case "select-agent":
|
|
73
|
-
case "stop-agent":
|
|
74
|
-
case "restart-agent":
|
|
75
|
-
case "remove-agent":
|
|
76
|
-
assertId(command.agentId, "command agent id");
|
|
77
|
-
return;
|
|
78
|
-
case "rename-agent":
|
|
79
|
-
assertId(command.agentId, "command agent id");
|
|
80
|
-
assertText(command.displayName, "agent display name", MAX_LABEL_LENGTH);
|
|
81
|
-
return;
|
|
82
|
-
case "structured-command":
|
|
83
|
-
assertId(command.agentId, "command agent id");
|
|
84
|
-
assertId(command.command, "structured command name");
|
|
85
|
-
assertJsonValue(command.payload, "structured command payload");
|
|
86
|
-
return;
|
|
87
|
-
case "cancel-structured-command":
|
|
88
|
-
assertId(command.agentId, "command agent id");
|
|
89
|
-
assertId(command.targetCorrelationId, "target command correlation id");
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
export function assertWorkspaceEvent(event) {
|
|
93
|
-
assertId(event.agentId, "event agent id");
|
|
94
|
-
switch (event.type) {
|
|
95
|
-
case "agent-lifecycle":
|
|
96
|
-
assertPosition(event.position, "lifecycle event position");
|
|
97
|
-
return;
|
|
98
|
-
case "structured-event":
|
|
99
|
-
assertPosition(event.position, "structured event position");
|
|
100
|
-
assertId(event.eventType, "structured event type");
|
|
101
|
-
assertJsonValue(event.payload, "structured event payload");
|
|
102
|
-
return;
|
|
103
|
-
case "command-outcome":
|
|
104
|
-
assertId(event.correlationId, "command correlation id");
|
|
105
|
-
return;
|
|
106
|
-
case "terminal-topology":
|
|
107
|
-
assertTerminalTopologySnapshot(event.topology);
|
|
108
|
-
return;
|
|
109
|
-
case "recovery-discontinuity":
|
|
110
|
-
assertText(event.reason, "recovery discontinuity reason", 4_096);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export function assertStructuredAgentSnapshot(snapshot) {
|
|
114
|
-
if (snapshot.contractVersion !== WORKSPACE_CONTRACT_VERSION)
|
|
115
|
-
throw new TypeError("unsupported structured snapshot contract version");
|
|
116
|
-
assertId(snapshot.agentId, "structured snapshot agent id");
|
|
117
|
-
assertId(snapshot.snapshotId, "structured snapshot id");
|
|
118
|
-
assertPosition(snapshot.position, "structured snapshot position");
|
|
119
|
-
if (snapshot.authoritative !== true)
|
|
120
|
-
throw new TypeError("structured snapshot must be authoritative");
|
|
121
|
-
assertJsonValue(snapshot.payload, "structured snapshot payload");
|
|
122
|
-
}
|
|
123
|
-
export function assertTerminalTopologySnapshot(topology) {
|
|
124
|
-
assertId(topology.hostInstanceId, "native host instance id");
|
|
125
|
-
assertRevision(topology.revision, "topology revision");
|
|
126
|
-
assertCollection(topology.windows, "terminal windows");
|
|
127
|
-
assertCollection(topology.sessions, "terminal sessions");
|
|
128
|
-
const sessionIds = new Set();
|
|
129
|
-
for (const session of topology.sessions) {
|
|
130
|
-
assertTerminalSessionLaunch(session);
|
|
131
|
-
if (sessionIds.has(session.id))
|
|
132
|
-
throw new TypeError(`duplicate terminal session id: ${session.id}`);
|
|
133
|
-
sessionIds.add(session.id);
|
|
134
|
-
}
|
|
135
|
-
const windowIds = new Set();
|
|
136
|
-
const paneIds = new Set();
|
|
137
|
-
for (const window of topology.windows) {
|
|
138
|
-
assertId(window.id, "terminal window id");
|
|
139
|
-
if (windowIds.has(window.id))
|
|
140
|
-
throw new TypeError(`duplicate terminal window id: ${window.id}`);
|
|
141
|
-
windowIds.add(window.id);
|
|
142
|
-
assertCollection(window.tabs, "terminal tabs");
|
|
143
|
-
if (!window.tabs.some(tab => tab.id === window.activeTabId))
|
|
144
|
-
throw new TypeError("active tab must exist in its window");
|
|
145
|
-
const tabIds = new Set();
|
|
146
|
-
for (const tab of window.tabs) {
|
|
147
|
-
if (tabIds.has(tab.id))
|
|
148
|
-
throw new TypeError(`duplicate terminal tab id in window: ${tab.id}`);
|
|
149
|
-
tabIds.add(tab.id);
|
|
150
|
-
assertTerminalTab(tab, sessionIds, paneIds);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
export function assertNativeHostCommand(command) {
|
|
155
|
-
assertId(command.correlationId, "native-host correlation id");
|
|
156
|
-
if (command.type === "apply-topology") {
|
|
157
|
-
assertRevision(command.expectedRevision, "expected topology revision");
|
|
158
|
-
assertTerminalTopologySnapshot(command.topology);
|
|
159
|
-
if (command.topology.revision !== command.expectedRevision) {
|
|
160
|
-
throw new TypeError("applied topology snapshot revision must equal the expected revision");
|
|
161
|
-
}
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (command.type === "focus-pane" || command.type === "close-pane") {
|
|
165
|
-
assertRevision(command.expectedRevision, "expected topology revision");
|
|
166
|
-
assertId(command.paneId, "terminal pane id");
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
export function assertRecoveryAuthority(authority) {
|
|
170
|
-
assertId(authority.referenceId, "recovery reference id");
|
|
171
|
-
assertId(authority.agentId, "recovery agent id");
|
|
172
|
-
assertText(authority.processIdentity, "recovery process identity", 1_024);
|
|
173
|
-
if (authority.kind === "structured") {
|
|
174
|
-
assertId(authority.adapterId, "recovery adapter id");
|
|
175
|
-
assertText(authority.ownershipProof, "recovery ownership proof", 4_096);
|
|
176
|
-
if (authority.boundary.kind === "position") {
|
|
177
|
-
assertPosition(authority.boundary.position, "resume position");
|
|
178
|
-
assertText(authority.boundary.resumeToken, "resume token", 4_096);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
assertId(authority.boundary.snapshotId, "recovery snapshot id");
|
|
182
|
-
}
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
assertId(authority.hostInstanceId, "recovery host instance id");
|
|
186
|
-
assertText(authority.hostBuildId, "recovery host build id", 1_024);
|
|
187
|
-
assertText(authority.pseudoterminalIdentity, "recovery pseudoterminal identity", 1_024);
|
|
188
|
-
assertText(authority.retainedStateIdentity, "recovery retained-state identity", 1_024);
|
|
189
|
-
assertRevision(authority.topologyRevision, "recovery topology revision");
|
|
190
|
-
assertPosition(authority.streamPosition, "recovery stream position");
|
|
191
|
-
}
|
|
192
|
-
export function assertTerminalSessionLaunch(session) {
|
|
193
|
-
assertId(session.id, "terminal session id");
|
|
194
|
-
assertText(session.executable, "terminal executable", 32_768);
|
|
195
|
-
assertText(session.cwd, "terminal working directory", 32_768);
|
|
196
|
-
if (session.executable.includes("\0") || session.cwd.includes("\0"))
|
|
197
|
-
throw new TypeError("terminal launch paths contain a null byte");
|
|
198
|
-
assertCollection(session.arguments, "terminal arguments", MAX_ARGUMENTS);
|
|
199
|
-
if (session.arguments.some(argument => typeof argument !== "string" || argument.includes("\0"))) {
|
|
200
|
-
throw new TypeError("terminal arguments contain an invalid value");
|
|
201
|
-
}
|
|
202
|
-
const entries = Object.entries(session.environment);
|
|
203
|
-
assertCollection(entries, "terminal environment", MAX_ENVIRONMENT_ENTRIES);
|
|
204
|
-
if (entries.some(([name, value]) => !name || name.includes("=") || name.includes("\0") || typeof value !== "string" || value.includes("\0"))) {
|
|
205
|
-
throw new TypeError("terminal environment contains an invalid name or value");
|
|
206
|
-
}
|
|
207
|
-
assertTerminalDimensions(session.dimensions);
|
|
208
|
-
}
|
|
209
|
-
function assertTerminalDimensions(dimensions) {
|
|
210
|
-
assertIntegerInRange(dimensions.columns, 2, 500, "terminal columns");
|
|
211
|
-
assertIntegerInRange(dimensions.rows, 1, 300, "terminal rows");
|
|
212
|
-
assertIntegerInRange(dimensions.widthPixels, 1, 100_000, "terminal pixel width");
|
|
213
|
-
assertIntegerInRange(dimensions.heightPixels, 1, 100_000, "terminal pixel height");
|
|
214
|
-
}
|
|
215
|
-
function assertTerminalTab(tab, sessionIds, globalPaneIds) {
|
|
216
|
-
assertId(tab.id, "terminal tab id");
|
|
217
|
-
assertCollection(tab.nodes, "terminal topology nodes");
|
|
218
|
-
assertCollection(tab.panes, "terminal panes");
|
|
219
|
-
const paneIds = new Set();
|
|
220
|
-
for (const pane of tab.panes) {
|
|
221
|
-
assertId(pane.id, "terminal pane id");
|
|
222
|
-
assertId(pane.sessionId, "terminal pane session id");
|
|
223
|
-
if (paneIds.has(pane.id) || globalPaneIds.has(pane.id))
|
|
224
|
-
throw new TypeError(`duplicate terminal pane id: ${pane.id}`);
|
|
225
|
-
if (!sessionIds.has(pane.sessionId))
|
|
226
|
-
throw new TypeError(`terminal pane references missing session: ${pane.sessionId}`);
|
|
227
|
-
paneIds.add(pane.id);
|
|
228
|
-
globalPaneIds.add(pane.id);
|
|
229
|
-
}
|
|
230
|
-
if (!paneIds.has(tab.focusedPaneId))
|
|
231
|
-
throw new TypeError("focused pane must exist in its tab");
|
|
232
|
-
const nodes = new Map();
|
|
233
|
-
for (const node of tab.nodes) {
|
|
234
|
-
assertId(node.id, "terminal topology node id");
|
|
235
|
-
if (nodes.has(node.id))
|
|
236
|
-
throw new TypeError(`duplicate terminal topology node id: ${node.id}`);
|
|
237
|
-
if (node.kind === "leaf") {
|
|
238
|
-
if (!paneIds.has(node.paneId))
|
|
239
|
-
throw new TypeError(`terminal leaf references missing pane: ${node.paneId}`);
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
if (!(node.ratio > 0 && node.ratio < 1 && Number.isFinite(node.ratio)))
|
|
243
|
-
throw new RangeError("terminal split ratio must be between zero and one");
|
|
244
|
-
if (node.first === node.second || node.id === node.first || node.id === node.second)
|
|
245
|
-
throw new TypeError("terminal split cannot reference itself or duplicate a child");
|
|
246
|
-
}
|
|
247
|
-
nodes.set(node.id, node);
|
|
248
|
-
}
|
|
249
|
-
if (!nodes.has(tab.rootNodeId))
|
|
250
|
-
throw new TypeError("terminal tab root node is missing");
|
|
251
|
-
const visited = new Set();
|
|
252
|
-
const visiting = new Set();
|
|
253
|
-
const reachedPanes = new Set();
|
|
254
|
-
visitNode(tab.rootNodeId, nodes, visited, visiting, reachedPanes);
|
|
255
|
-
if (visited.size !== nodes.size)
|
|
256
|
-
throw new TypeError("terminal tab contains unreachable topology nodes");
|
|
257
|
-
if (reachedPanes.size !== paneIds.size || [...paneIds].some(paneId => !reachedPanes.has(paneId))) {
|
|
258
|
-
throw new TypeError("each terminal pane must appear exactly once in the split tree");
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
function visitNode(id, nodes, visited, visiting, reachedPanes) {
|
|
262
|
-
const node = nodes.get(id);
|
|
263
|
-
if (!node)
|
|
264
|
-
throw new TypeError(`terminal split references missing node: ${id}`);
|
|
265
|
-
if (visiting.has(id))
|
|
266
|
-
throw new TypeError("terminal topology contains a cycle");
|
|
267
|
-
if (visited.has(id))
|
|
268
|
-
throw new TypeError("terminal topology node has multiple parents");
|
|
269
|
-
visiting.add(id);
|
|
270
|
-
if (node.kind === "leaf") {
|
|
271
|
-
if (reachedPanes.has(node.paneId))
|
|
272
|
-
throw new TypeError("terminal pane appears more than once in the split tree");
|
|
273
|
-
reachedPanes.add(node.paneId);
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
visitNode(node.first, nodes, visited, visiting, reachedPanes);
|
|
277
|
-
visitNode(node.second, nodes, visited, visiting, reachedPanes);
|
|
278
|
-
}
|
|
279
|
-
visiting.delete(id);
|
|
280
|
-
visited.add(id);
|
|
281
|
-
}
|
|
282
|
-
function assertUniqueText(values, name) {
|
|
283
|
-
assertCollection(values, name);
|
|
284
|
-
const seen = new Set();
|
|
285
|
-
for (const value of values) {
|
|
286
|
-
assertId(value, name);
|
|
287
|
-
if (seen.has(value))
|
|
288
|
-
throw new TypeError(`${name} contains a duplicate: ${value}`);
|
|
289
|
-
seen.add(value);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function assertJsonValue(value, name) {
|
|
293
|
-
try {
|
|
294
|
-
const encoded = JSON.stringify(value);
|
|
295
|
-
if (encoded === undefined)
|
|
296
|
-
throw new TypeError();
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
throw new TypeError(`${name} must be JSON serializable`);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
function assertCollection(value, name, maximum = MAX_COLLECTION_LENGTH) {
|
|
303
|
-
if (!Array.isArray(value) || value.length > maximum)
|
|
304
|
-
throw new RangeError(`${name} exceeds its maximum length`);
|
|
305
|
-
}
|
|
306
|
-
function assertId(value, name) {
|
|
307
|
-
assertText(value, name, MAX_ID_LENGTH);
|
|
308
|
-
if (!/^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(value))
|
|
309
|
-
throw new TypeError(`${name} contains unsupported characters`);
|
|
310
|
-
}
|
|
311
|
-
function assertText(value, name, maximum) {
|
|
312
|
-
if (typeof value !== "string" || value.length === 0 || value.length > maximum || value.includes("\0")) {
|
|
313
|
-
throw new TypeError(`${name} is invalid`);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function assertIsoDate(value, name) {
|
|
317
|
-
assertText(value, name, 64);
|
|
318
|
-
if (!Number.isFinite(Date.parse(value)))
|
|
319
|
-
throw new TypeError(`${name} is not an ISO timestamp`);
|
|
320
|
-
}
|
|
321
|
-
function assertRevision(value, name) {
|
|
322
|
-
if (!Number.isSafeInteger(value) || value < 0)
|
|
323
|
-
throw new RangeError(`${name} must be a non-negative safe integer`);
|
|
324
|
-
}
|
|
325
|
-
function assertPosition(value, name) {
|
|
326
|
-
assertIntegerInRange(value, 0, MAX_POSITION, name);
|
|
327
|
-
}
|
|
328
|
-
function assertBoundedPositiveInteger(value, name) {
|
|
329
|
-
assertIntegerInRange(value, 1, MAX_LIMIT, name);
|
|
330
|
-
}
|
|
331
|
-
function assertIntegerInRange(value, minimum, maximum, name) {
|
|
332
|
-
if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {
|
|
333
|
-
throw new RangeError(`${name} must be an integer from ${minimum} to ${maximum}`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { type OwnedUiCommand, type OwnedUiCustomization, type OwnedUiSlotId, type OwnedUiTranscriptBlock } from "../../contracts/owned-ui/index.js";
|
|
2
|
-
export interface OwnedUiSlotImplementation {
|
|
3
|
-
readonly payload: unknown;
|
|
4
|
-
render?(input: unknown, width: number): readonly string[];
|
|
5
|
-
createCommand?(context: {
|
|
6
|
-
readonly sessionId: string;
|
|
7
|
-
readonly correlationId: string;
|
|
8
|
-
}): OwnedUiCommand | Promise<OwnedUiCommand>;
|
|
9
|
-
}
|
|
10
|
-
export interface OwnedCommandHandlerContext {
|
|
11
|
-
readonly sessionId: string;
|
|
12
|
-
readonly correlationId: string;
|
|
13
|
-
}
|
|
14
|
-
export type OwnedCommandHandler = (context: OwnedCommandHandlerContext) => OwnedUiCommand | Promise<OwnedUiCommand>;
|
|
15
|
-
/** Registers owned UI commands and assigns a monotonic correlation identifier to each dispatch. */
|
|
16
|
-
export declare class OwnedCommandSurface {
|
|
17
|
-
#private;
|
|
18
|
-
register(name: string, handler: OwnedCommandHandler): () => void;
|
|
19
|
-
names(): readonly string[];
|
|
20
|
-
dispatch(name: string, sessionId: string): Promise<OwnedUiCommand>;
|
|
21
|
-
}
|
|
22
|
-
export interface ResolvedOwnedUiSlot {
|
|
23
|
-
readonly customization: OwnedUiCustomization;
|
|
24
|
-
readonly implementation: OwnedUiSlotImplementation;
|
|
25
|
-
}
|
|
26
|
-
/** Resolves one customization per slot by precedence and version while preserving registration identity. */
|
|
27
|
-
export declare class OwnedUiCustomizationRegistry {
|
|
28
|
-
#private;
|
|
29
|
-
register(customization: OwnedUiCustomization, implementation: OwnedUiSlotImplementation): () => void;
|
|
30
|
-
resolve(slot: OwnedUiSlotId): ResolvedOwnedUiSlot | undefined;
|
|
31
|
-
registrations(slot: OwnedUiSlotId): readonly OwnedUiCustomization[];
|
|
32
|
-
remove(id: string): boolean;
|
|
33
|
-
all(): readonly OwnedUiCustomization[];
|
|
34
|
-
clear(): void;
|
|
35
|
-
installCommands(surface: OwnedCommandSurface, sessionId: string): readonly string[];
|
|
36
|
-
}
|
|
37
|
-
export interface VanillaUiCustomizationPorts {
|
|
38
|
-
readonly renderTranscriptBlock: (block: OwnedUiTranscriptBlock, width: number) => readonly string[];
|
|
39
|
-
}
|
|
40
|
-
export declare function createVanillaUiCustomizationRegistry(ports: VanillaUiCustomizationPorts): OwnedUiCustomizationRegistry;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { assertOwnedUiCustomization, } from "../../contracts/owned-ui/index.js";
|
|
2
|
-
/** Registers owned UI commands and assigns a monotonic correlation identifier to each dispatch. */
|
|
3
|
-
export class OwnedCommandSurface {
|
|
4
|
-
#handlers = new Map();
|
|
5
|
-
#sequence = 0;
|
|
6
|
-
register(name, handler) {
|
|
7
|
-
this.#handlers.set(name, handler);
|
|
8
|
-
return () => this.#handlers.delete(name);
|
|
9
|
-
}
|
|
10
|
-
names() {
|
|
11
|
-
return [...this.#handlers.keys()].sort();
|
|
12
|
-
}
|
|
13
|
-
async dispatch(name, sessionId) {
|
|
14
|
-
const handler = this.#handlers.get(name);
|
|
15
|
-
if (!handler)
|
|
16
|
-
throw new Error(`unknown owned UI command: ${name}`);
|
|
17
|
-
this.#sequence += 1;
|
|
18
|
-
return handler({ sessionId, correlationId: `ui-command-${this.#sequence}` });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/** Resolves one customization per slot by precedence and version while preserving registration identity. */
|
|
22
|
-
export class OwnedUiCustomizationRegistry {
|
|
23
|
-
#registrations = new Map();
|
|
24
|
-
register(customization, implementation) {
|
|
25
|
-
assertOwnedUiCustomization(customization);
|
|
26
|
-
if (typeof implementation !== "object" || implementation === null) {
|
|
27
|
-
throw new TypeError("owned UI slot implementation is invalid");
|
|
28
|
-
}
|
|
29
|
-
const slot = this.#slot(customization.slot);
|
|
30
|
-
slot.set(customization.id, Object.freeze({ customization, implementation }));
|
|
31
|
-
return () => {
|
|
32
|
-
if (slot.get(customization.id)?.customization.version === customization.version)
|
|
33
|
-
slot.delete(customization.id);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
resolve(slot) {
|
|
37
|
-
return [...(this.#registrations.get(slot)?.values() ?? [])]
|
|
38
|
-
.sort((left, right) => right.customization.precedence - left.customization.precedence
|
|
39
|
-
|| right.customization.version - left.customization.version
|
|
40
|
-
|| left.customization.id.localeCompare(right.customization.id))[0];
|
|
41
|
-
}
|
|
42
|
-
registrations(slot) {
|
|
43
|
-
return [...(this.#registrations.get(slot)?.values() ?? [])]
|
|
44
|
-
.map(registration => registration.customization)
|
|
45
|
-
.sort((left, right) => right.precedence - left.precedence || right.version - left.version || left.id.localeCompare(right.id));
|
|
46
|
-
}
|
|
47
|
-
remove(id) {
|
|
48
|
-
for (const slot of this.#registrations.values()) {
|
|
49
|
-
if (slot.delete(id))
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
all() {
|
|
55
|
-
return [...this.#registrations.values()]
|
|
56
|
-
.flatMap(slot => [...slot.values()].map(registration => registration.customization))
|
|
57
|
-
.sort((left, right) => left.slot.localeCompare(right.slot) || right.precedence - left.precedence || left.id.localeCompare(right.id));
|
|
58
|
-
}
|
|
59
|
-
clear() {
|
|
60
|
-
this.#registrations.clear();
|
|
61
|
-
}
|
|
62
|
-
installCommands(surface, sessionId) {
|
|
63
|
-
const installed = [];
|
|
64
|
-
for (const registration of this.#registrations.get("command")?.values() ?? []) {
|
|
65
|
-
if (!registration.implementation.createCommand)
|
|
66
|
-
continue;
|
|
67
|
-
installed.push(registration.customization.id);
|
|
68
|
-
surface.register(registration.customization.id, context => {
|
|
69
|
-
if (context.sessionId !== sessionId)
|
|
70
|
-
throw new Error("owned UI command session does not match the registry binding");
|
|
71
|
-
return registration.implementation.createCommand(context);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return installed;
|
|
75
|
-
}
|
|
76
|
-
#slot(slot) {
|
|
77
|
-
let registrations = this.#registrations.get(slot);
|
|
78
|
-
if (!registrations) {
|
|
79
|
-
registrations = new Map();
|
|
80
|
-
this.#registrations.set(slot, registrations);
|
|
81
|
-
}
|
|
82
|
-
return registrations;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
export function createVanillaUiCustomizationRegistry(ports) {
|
|
86
|
-
const registry = new OwnedUiCustomizationRegistry();
|
|
87
|
-
const register = (slot, id, label, implementation = { payload: {} }) => registry.register({
|
|
88
|
-
id,
|
|
89
|
-
slot,
|
|
90
|
-
version: 1,
|
|
91
|
-
precedence: 0,
|
|
92
|
-
label,
|
|
93
|
-
payload: {},
|
|
94
|
-
}, implementation);
|
|
95
|
-
register("theme", "vanilla-theme", "Vanilla Pi style", {
|
|
96
|
-
payload: { background: "terminal", foreground: "terminal", accent: "blue" },
|
|
97
|
-
});
|
|
98
|
-
register("transcript-block", "vanilla-transcript", "Vanilla transcript", {
|
|
99
|
-
payload: {},
|
|
100
|
-
render: (input, width) => ports.renderTranscriptBlock(input, width),
|
|
101
|
-
});
|
|
102
|
-
register("tool-card", "vanilla-tool-card", "Vanilla tool cards");
|
|
103
|
-
register("editor", "vanilla-editor", "Vanilla editor");
|
|
104
|
-
register("status", "vanilla-status", "Vanilla status");
|
|
105
|
-
register("selector", "vanilla-selector", "Vanilla selector");
|
|
106
|
-
register("dialog", "vanilla-dialog", "Vanilla dialog");
|
|
107
|
-
register("overlay", "vanilla-overlay", "Vanilla overlay");
|
|
108
|
-
register("layout", "vanilla-fullscreen", "Fullscreen session");
|
|
109
|
-
return registry;
|
|
110
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { OwnedUiDiagnostics } from "../../contracts/owned-ui/index.js";
|
|
2
|
-
export interface OwnedUiFrameObservation {
|
|
3
|
-
readonly requestedFrames: number;
|
|
4
|
-
readonly presentedFrames: number;
|
|
5
|
-
readonly failedFrames: number;
|
|
6
|
-
readonly lastFrameBytes: number;
|
|
7
|
-
}
|
|
8
|
-
export interface OwnedUiResourceObservation {
|
|
9
|
-
readonly cpuUserMicros: number;
|
|
10
|
-
readonly cpuSystemMicros: number;
|
|
11
|
-
readonly residentMemoryBytes: number;
|
|
12
|
-
readonly heapBytes: number;
|
|
13
|
-
}
|
|
14
|
-
export interface OwnedUiDiagnosticsSnapshot {
|
|
15
|
-
readonly entries: readonly OwnedUiDiagnostics[];
|
|
16
|
-
readonly frames: OwnedUiFrameObservation;
|
|
17
|
-
readonly resources: OwnedUiResourceObservation | null;
|
|
18
|
-
readonly terminalRestorationFailed: boolean;
|
|
19
|
-
}
|
|
20
|
-
/** Retains bounded, redacted UI diagnostics together with frame and resource observations. */
|
|
21
|
-
export declare class OwnedUiDiagnosticsRecorder {
|
|
22
|
-
#private;
|
|
23
|
-
readonly maximumEntries: number;
|
|
24
|
-
constructor(maximumEntries?: number);
|
|
25
|
-
entries(): readonly OwnedUiDiagnostics[];
|
|
26
|
-
record(severity: OwnedUiDiagnostics["severity"], code: string, message: string, recoverable?: boolean): OwnedUiDiagnostics;
|
|
27
|
-
noteFrame(bytes: number, failed?: boolean): OwnedUiFrameObservation;
|
|
28
|
-
noteResources(observation: OwnedUiResourceObservation): OwnedUiResourceObservation;
|
|
29
|
-
captureResources(read?: () => NodeJS.ResourceUsage): OwnedUiResourceObservation;
|
|
30
|
-
noteTerminalRestorationFailure(error: unknown): OwnedUiDiagnostics;
|
|
31
|
-
frames(): OwnedUiFrameObservation;
|
|
32
|
-
snapshot(): OwnedUiDiagnosticsSnapshot;
|
|
33
|
-
}
|
|
34
|
-
export declare function redactDiagnosticMessage(message: string): string;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/** Retains bounded, redacted UI diagnostics together with frame and resource observations. */
|
|
2
|
-
export class OwnedUiDiagnosticsRecorder {
|
|
3
|
-
maximumEntries;
|
|
4
|
-
#entries = [];
|
|
5
|
-
#sequence = 0;
|
|
6
|
-
#requestedFrames = 0;
|
|
7
|
-
#presentedFrames = 0;
|
|
8
|
-
#failedFrames = 0;
|
|
9
|
-
#lastFrameBytes = 0;
|
|
10
|
-
#resources = null;
|
|
11
|
-
#terminalRestorationFailed = false;
|
|
12
|
-
constructor(maximumEntries = 100) {
|
|
13
|
-
this.maximumEntries = maximumEntries;
|
|
14
|
-
if (!Number.isSafeInteger(maximumEntries) || maximumEntries <= 0)
|
|
15
|
-
throw new RangeError("diagnostic capacity must be positive");
|
|
16
|
-
}
|
|
17
|
-
entries() {
|
|
18
|
-
return this.#entries.map(entry => ({ ...entry }));
|
|
19
|
-
}
|
|
20
|
-
record(severity, code, message, recoverable = true) {
|
|
21
|
-
const entry = {
|
|
22
|
-
sequence: this.#sequence++,
|
|
23
|
-
code: sanitizeDiagnosticCode(code),
|
|
24
|
-
severity,
|
|
25
|
-
message: redactDiagnosticMessage(message),
|
|
26
|
-
recoverable,
|
|
27
|
-
};
|
|
28
|
-
this.#entries.push(entry);
|
|
29
|
-
if (this.#entries.length > this.maximumEntries)
|
|
30
|
-
this.#entries.shift();
|
|
31
|
-
return { ...entry };
|
|
32
|
-
}
|
|
33
|
-
noteFrame(bytes, failed = false) {
|
|
34
|
-
if (!Number.isSafeInteger(bytes) || bytes < 0)
|
|
35
|
-
throw new RangeError("frame byte count is invalid");
|
|
36
|
-
this.#requestedFrames += 1;
|
|
37
|
-
if (failed)
|
|
38
|
-
this.#failedFrames += 1;
|
|
39
|
-
else
|
|
40
|
-
this.#presentedFrames += 1;
|
|
41
|
-
this.#lastFrameBytes = bytes;
|
|
42
|
-
return this.frames();
|
|
43
|
-
}
|
|
44
|
-
noteResources(observation) {
|
|
45
|
-
for (const value of Object.values(observation)) {
|
|
46
|
-
if (!Number.isFinite(value) || value < 0)
|
|
47
|
-
throw new RangeError("resource observations must be non-negative finite values");
|
|
48
|
-
}
|
|
49
|
-
this.#resources = Object.freeze({ ...observation });
|
|
50
|
-
return this.#resources;
|
|
51
|
-
}
|
|
52
|
-
captureResources(read = () => process.resourceUsage()) {
|
|
53
|
-
const usage = read();
|
|
54
|
-
return this.noteResources({
|
|
55
|
-
cpuUserMicros: usage.userCPUTime,
|
|
56
|
-
cpuSystemMicros: usage.systemCPUTime,
|
|
57
|
-
residentMemoryBytes: process.memoryUsage().rss,
|
|
58
|
-
heapBytes: process.memoryUsage().heapUsed,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
noteTerminalRestorationFailure(error) {
|
|
62
|
-
this.#terminalRestorationFailed = true;
|
|
63
|
-
return this.record("error", "terminal-restoration", error instanceof Error ? error.message : String(error), false);
|
|
64
|
-
}
|
|
65
|
-
frames() {
|
|
66
|
-
return {
|
|
67
|
-
requestedFrames: this.#requestedFrames,
|
|
68
|
-
presentedFrames: this.#presentedFrames,
|
|
69
|
-
failedFrames: this.#failedFrames,
|
|
70
|
-
lastFrameBytes: this.#lastFrameBytes,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
snapshot() {
|
|
74
|
-
return {
|
|
75
|
-
entries: this.entries(),
|
|
76
|
-
frames: this.frames(),
|
|
77
|
-
resources: this.#resources === null ? null : { ...this.#resources },
|
|
78
|
-
terminalRestorationFailed: this.#terminalRestorationFailed,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
export function redactDiagnosticMessage(message) {
|
|
83
|
-
return message
|
|
84
|
-
.replace(/[A-Za-z0-9_\-]{24,}\.[A-Za-z0-9_\-]{12,}\.[A-Za-z0-9_\-]{12,}/g, "[redacted-token]")
|
|
85
|
-
.replace(/(api[_-]?key|token|secret|password)=([^\s]+)/gi, "$1=[redacted]")
|
|
86
|
-
.replace(/[A-Z]:\\Users\\[^\\\s]+/gi, "[home]")
|
|
87
|
-
.replace(/\/home\/[^/\s]+/g, "[home]")
|
|
88
|
-
.slice(0, 4_096);
|
|
89
|
-
}
|
|
90
|
-
function sanitizeDiagnosticCode(code) {
|
|
91
|
-
const normalized = code.toLowerCase().replace(/[^a-z0-9._:-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
92
|
-
if (!normalized)
|
|
93
|
-
throw new TypeError("diagnostic code is invalid");
|
|
94
|
-
return normalized.slice(0, 128);
|
|
95
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ManagedAgentDescriptor } from "../../contracts/workspace/index.js";
|
|
2
|
-
export type WorkspaceCapabilityAction = {
|
|
3
|
-
readonly type: "structured-command";
|
|
4
|
-
readonly command: string;
|
|
5
|
-
} | {
|
|
6
|
-
readonly type: "cancel-structured-command";
|
|
7
|
-
} | {
|
|
8
|
-
readonly type: "restore-structured-snapshot";
|
|
9
|
-
} | {
|
|
10
|
-
readonly type: "send-structured-attachment";
|
|
11
|
-
readonly attachmentType: string;
|
|
12
|
-
} | {
|
|
13
|
-
readonly type: "create-terminal-pane";
|
|
14
|
-
} | {
|
|
15
|
-
readonly type: "apply-terminal-layout";
|
|
16
|
-
} | {
|
|
17
|
-
readonly type: "focus-terminal-pane";
|
|
18
|
-
} | {
|
|
19
|
-
readonly type: "close-terminal-pane";
|
|
20
|
-
};
|
|
21
|
-
export type WorkspaceCapabilityActionType = WorkspaceCapabilityAction["type"];
|
|
22
|
-
export type WorkspaceActionGateResult = {
|
|
23
|
-
readonly kind: "allowed";
|
|
24
|
-
readonly action: WorkspaceCapabilityAction;
|
|
25
|
-
} | {
|
|
26
|
-
readonly kind: "rejected";
|
|
27
|
-
readonly code: string;
|
|
28
|
-
readonly diagnostic: string;
|
|
29
|
-
};
|
|
30
|
-
export declare function gateWorkspaceAction(agent: ManagedAgentDescriptor, action: WorkspaceCapabilityAction): WorkspaceActionGateResult;
|
|
31
|
-
export declare function availableWorkspaceActions(agent: ManagedAgentDescriptor): readonly WorkspaceCapabilityActionType[];
|