@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,151 +0,0 @@
|
|
|
1
|
-
import { WORKSPACE_CONTRACT_VERSION, assertStructuredCapability, } from "../../contracts/workspace/index.js";
|
|
2
|
-
import { PRODUCT_IDENTITY, PRODUCT_TEXT } from "../../product-identity.js";
|
|
3
|
-
export const STRUCTURED_ADAPTER_ENVELOPE = PRODUCT_IDENTITY.protocol.structuredAgentSchema;
|
|
4
|
-
export const STRUCTURED_ADAPTER_ENVELOPE_REVISION = 1;
|
|
5
|
-
export const REQUIRED_STRUCTURED_FEATURES = [
|
|
6
|
-
"identity.adapter.v1",
|
|
7
|
-
"commands.correlated.v1",
|
|
8
|
-
"events.typed.v1",
|
|
9
|
-
"flow-control.limits.v1",
|
|
10
|
-
];
|
|
11
|
-
export const OPTIONAL_STRUCTURED_FEATURES = [
|
|
12
|
-
"snapshots.authoritative.v1",
|
|
13
|
-
"resume.position.v1",
|
|
14
|
-
"resume.snapshot.v1",
|
|
15
|
-
"commands.cancellable.v1",
|
|
16
|
-
"attachments.typed.v1",
|
|
17
|
-
];
|
|
18
|
-
export const STRUCTURED_FLOW_LIMITS = Object.freeze({
|
|
19
|
-
maxEventBytes: 64 * 1024,
|
|
20
|
-
maxSnapshotBytes: 1024 * 1024,
|
|
21
|
-
maxAttachmentBytes: 2 * 1024 * 1024,
|
|
22
|
-
maxQueuedEvents: 256,
|
|
23
|
-
maxConcurrentCommands: 4,
|
|
24
|
-
maxReconnectEvents: 1024,
|
|
25
|
-
});
|
|
26
|
-
export function localStructuredAdapterHello() {
|
|
27
|
-
return {
|
|
28
|
-
envelope: STRUCTURED_ADAPTER_ENVELOPE,
|
|
29
|
-
envelopeRevision: STRUCTURED_ADAPTER_ENVELOPE_REVISION,
|
|
30
|
-
requiredFeatures: REQUIRED_STRUCTURED_FEATURES,
|
|
31
|
-
optionalFeatures: OPTIONAL_STRUCTURED_FEATURES,
|
|
32
|
-
flowLimits: STRUCTURED_FLOW_LIMITS,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export function negotiateStructuredAdapter(value, server = localStructuredAdapterHello()) {
|
|
36
|
-
if (!isStructuredAdapterHello(value)) {
|
|
37
|
-
return reject("invalid-message", [], [], "adapter hello is malformed or omits required identity, feature, or capability fields");
|
|
38
|
-
}
|
|
39
|
-
if (value.envelope !== server.envelope || value.envelopeRevision !== server.envelopeRevision) {
|
|
40
|
-
return reject("unsupported-version", [], [], `structured adapter envelope mismatch: adapter ${String(value.envelope)}/${String(value.envelopeRevision)}; ${PRODUCT_TEXT.displayName} ${server.envelope}/${server.envelopeRevision}`);
|
|
41
|
-
}
|
|
42
|
-
if (!isValidIdentityText(value.adapterId) || !isValidBuildId(value.buildId)) {
|
|
43
|
-
return reject("invalid-identity", [], [], "adapter identity and build identity must be bounded non-empty values");
|
|
44
|
-
}
|
|
45
|
-
if (value.capability.adapterId !== value.adapterId) {
|
|
46
|
-
return reject("invalid-identity", [], [], "adapter capability identity must match the hello identity");
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
assertStructuredCapability(value.capability);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
return reject("invalid-capability", [], [], `adapter capability is invalid: ${error instanceof Error ? error.message : String(error)}`);
|
|
53
|
-
}
|
|
54
|
-
const advertised = featureSet(value.requiredFeatures, value.optionalFeatures);
|
|
55
|
-
if (advertised.error)
|
|
56
|
-
return advertised.error;
|
|
57
|
-
const serverFeatures = new Set([...server.requiredFeatures, ...server.optionalFeatures]);
|
|
58
|
-
const adapterRequired = new Set(value.requiredFeatures);
|
|
59
|
-
const unknownRequired = [...adapterRequired].filter(feature => !serverFeatures.has(feature));
|
|
60
|
-
if (unknownRequired.length > 0) {
|
|
61
|
-
return reject("unsupported-feature", [], unknownRequired.sort(), `adapter requires unsupported structured features: ${unknownRequired.sort().join(", ")}`);
|
|
62
|
-
}
|
|
63
|
-
const missingFromAdapter = server.requiredFeatures.filter(feature => !advertised.features.has(feature)).sort();
|
|
64
|
-
const missingFromServer = [...adapterRequired].filter(feature => !serverFeatures.has(feature)).sort();
|
|
65
|
-
if (missingFromAdapter.length > 0 || missingFromServer.length > 0) {
|
|
66
|
-
return reject("incompatible-features", missingFromAdapter, missingFromServer, `required structured features are unavailable; adapter missing [${missingFromAdapter.join(", ")}], ${PRODUCT_TEXT.displayName} missing [${missingFromServer.join(", ")}]`);
|
|
67
|
-
}
|
|
68
|
-
const capabilityFeatures = requiredFeaturesForCapability(value.capability);
|
|
69
|
-
const undeclared = capabilityFeatures.filter(feature => !advertised.features.has(feature));
|
|
70
|
-
if (undeclared.length > 0) {
|
|
71
|
-
return reject("invalid-capability", undeclared.sort(), [], `adapter capability requires undeclared features: ${undeclared.sort().join(", ")}`);
|
|
72
|
-
}
|
|
73
|
-
const negotiatedFeatures = [...advertised.features].filter(feature => serverFeatures.has(feature)).sort();
|
|
74
|
-
const capability = {
|
|
75
|
-
...value.capability,
|
|
76
|
-
adapterId: value.adapterId,
|
|
77
|
-
flow: negotiateFlow(value.capability.flow, server.flowLimits),
|
|
78
|
-
};
|
|
79
|
-
return {
|
|
80
|
-
accepted: true,
|
|
81
|
-
adapterId: value.adapterId,
|
|
82
|
-
negotiatedFeatures,
|
|
83
|
-
capability,
|
|
84
|
-
diagnostic: `structured adapter ready; negotiated ${negotiatedFeatures.join(", ")}`,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function requiredFeaturesForCapability(capability) {
|
|
88
|
-
const features = [];
|
|
89
|
-
if (capability.snapshots === "authoritative")
|
|
90
|
-
features.push("snapshots.authoritative.v1");
|
|
91
|
-
if (capability.resume === "position")
|
|
92
|
-
features.push("resume.position.v1");
|
|
93
|
-
if (capability.resume === "snapshot")
|
|
94
|
-
features.push("resume.snapshot.v1");
|
|
95
|
-
if (capability.cancellation === "correlated")
|
|
96
|
-
features.push("commands.cancellable.v1");
|
|
97
|
-
if (capability.attachmentTypes.length > 0)
|
|
98
|
-
features.push("attachments.typed.v1");
|
|
99
|
-
return features;
|
|
100
|
-
}
|
|
101
|
-
function negotiateFlow(adapter, server) {
|
|
102
|
-
return Object.freeze({
|
|
103
|
-
maxEventBytes: Math.min(adapter.maxEventBytes, server.maxEventBytes),
|
|
104
|
-
maxSnapshotBytes: Math.min(adapter.maxSnapshotBytes, server.maxSnapshotBytes),
|
|
105
|
-
maxAttachmentBytes: Math.min(adapter.maxAttachmentBytes, server.maxAttachmentBytes),
|
|
106
|
-
maxQueuedEvents: Math.min(adapter.maxQueuedEvents, server.maxQueuedEvents),
|
|
107
|
-
maxConcurrentCommands: Math.min(adapter.maxConcurrentCommands, server.maxConcurrentCommands),
|
|
108
|
-
maxReconnectEvents: Math.min(adapter.maxReconnectEvents, server.maxReconnectEvents),
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function isStructuredAdapterHello(value) {
|
|
112
|
-
if (!isRecord(value))
|
|
113
|
-
return false;
|
|
114
|
-
return typeof value.envelope === "string"
|
|
115
|
-
&& typeof value.envelopeRevision === "number"
|
|
116
|
-
&& typeof value.adapterId === "string"
|
|
117
|
-
&& typeof value.buildId === "string"
|
|
118
|
-
&& isStringArray(value.requiredFeatures)
|
|
119
|
-
&& isStringArray(value.optionalFeatures)
|
|
120
|
-
&& isRecord(value.capability)
|
|
121
|
-
&& value.capability.kind === "structured"
|
|
122
|
-
&& typeof value.capability.protocolVersion === "number";
|
|
123
|
-
}
|
|
124
|
-
function featureSet(required, optional) {
|
|
125
|
-
const features = new Set();
|
|
126
|
-
for (const feature of [...required, ...optional]) {
|
|
127
|
-
if (!isValidIdentityText(feature)) {
|
|
128
|
-
return { features, error: reject("invalid-message", [], [], `structured feature name is invalid: ${feature}`) };
|
|
129
|
-
}
|
|
130
|
-
if (features.has(feature)) {
|
|
131
|
-
return { features, error: reject("invalid-message", [], [], `structured feature is declared more than once: ${feature}`) };
|
|
132
|
-
}
|
|
133
|
-
features.add(feature);
|
|
134
|
-
}
|
|
135
|
-
return { features, error: null };
|
|
136
|
-
}
|
|
137
|
-
function reject(code, missingFromAdapter, missingFromServer, diagnostic) {
|
|
138
|
-
return { accepted: false, code, missingFromAdapter, missingFromServer, diagnostic };
|
|
139
|
-
}
|
|
140
|
-
function isValidIdentityText(value) {
|
|
141
|
-
return value.length > 0 && value.length <= 128 && !value.includes("\0");
|
|
142
|
-
}
|
|
143
|
-
function isValidBuildId(value) {
|
|
144
|
-
return value.length > 0 && value.length <= 256 && !value.includes("\0");
|
|
145
|
-
}
|
|
146
|
-
function isRecord(value) {
|
|
147
|
-
return typeof value === "object" && value !== null;
|
|
148
|
-
}
|
|
149
|
-
function isStringArray(value) {
|
|
150
|
-
return Array.isArray(value) && value.every(item => typeof item === "string");
|
|
151
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type AgentRecoveryAuthority, type StructuredAgentSnapshot, type StructuredCapabilityContract, type StructuredRecoveryAuthority } from "../../contracts/workspace/index.js";
|
|
2
|
-
import { StructuredEventReducer, type StructuredRuntimeView } from "./state.js";
|
|
3
|
-
export interface StructuredResumeProof {
|
|
4
|
-
readonly protocolVersion: number;
|
|
5
|
-
readonly agentId: string;
|
|
6
|
-
readonly adapterId: string;
|
|
7
|
-
readonly processIdentity: string;
|
|
8
|
-
readonly ownershipProof: string;
|
|
9
|
-
readonly boundary: {
|
|
10
|
-
readonly kind: "position";
|
|
11
|
-
readonly position: number;
|
|
12
|
-
readonly resumeToken: string;
|
|
13
|
-
} | {
|
|
14
|
-
readonly kind: "snapshot";
|
|
15
|
-
readonly snapshotId: string;
|
|
16
|
-
readonly snapshot: StructuredAgentSnapshot;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export type StructuredReconnectionResult = {
|
|
20
|
-
readonly kind: "accepted";
|
|
21
|
-
readonly boundary: StructuredRecoveryAuthority["boundary"];
|
|
22
|
-
readonly view: StructuredRuntimeView | null;
|
|
23
|
-
readonly diagnostic: string;
|
|
24
|
-
} | {
|
|
25
|
-
readonly kind: "terminated";
|
|
26
|
-
readonly reason: "non-reconnectable";
|
|
27
|
-
readonly diagnostic: string;
|
|
28
|
-
} | {
|
|
29
|
-
readonly kind: "rejected";
|
|
30
|
-
readonly code: string;
|
|
31
|
-
readonly diagnostic: string;
|
|
32
|
-
};
|
|
33
|
-
/** Accepts a recovery boundary once after validating negotiated identity, proof, and protocol continuity. */
|
|
34
|
-
export declare class StructuredReconnectionManager {
|
|
35
|
-
#private;
|
|
36
|
-
constructor(capability: StructuredCapabilityContract);
|
|
37
|
-
resume(authorityValue: AgentRecoveryAuthority, proof: StructuredResumeProof, reducer?: StructuredEventReducer | null): StructuredReconnectionResult;
|
|
38
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { WORKSPACE_CONTRACT_VERSION, assertRecoveryAuthority, assertStructuredAgentSnapshot, assertStructuredCapability, } from "../../contracts/workspace/index.js";
|
|
2
|
-
import { StructuredEventReducer } from "./state.js";
|
|
3
|
-
/** Accepts a recovery boundary once after validating negotiated identity, proof, and protocol continuity. */
|
|
4
|
-
export class StructuredReconnectionManager {
|
|
5
|
-
#capability;
|
|
6
|
-
#acceptedBoundaries = new Set();
|
|
7
|
-
constructor(capability) {
|
|
8
|
-
assertStructuredCapability(capability);
|
|
9
|
-
this.#capability = capability;
|
|
10
|
-
}
|
|
11
|
-
resume(authorityValue, proof, reducer = null) {
|
|
12
|
-
let authority;
|
|
13
|
-
try {
|
|
14
|
-
assertRecoveryAuthority(authorityValue);
|
|
15
|
-
authority = authorityValue;
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
return rejected("invalid-authority", error);
|
|
19
|
-
}
|
|
20
|
-
if (authority.kind !== "structured")
|
|
21
|
-
return rejected("invalid-authority", new Error("structured reconnection requires structured recovery authority"));
|
|
22
|
-
if (this.#capability.resume === "none") {
|
|
23
|
-
return { kind: "terminated", reason: "non-reconnectable", diagnostic: "adapter did not negotiate reconnection; durable agent is ended after restart" };
|
|
24
|
-
}
|
|
25
|
-
if (this.#capability.resume !== authority.boundary.kind) {
|
|
26
|
-
return rejected("unsupported-resume", new Error(`persisted ${authority.boundary.kind} recovery is unavailable from negotiated ${this.#capability.resume} resume`));
|
|
27
|
-
}
|
|
28
|
-
const identityError = verifyIdentity(authority, proof);
|
|
29
|
-
if (identityError)
|
|
30
|
-
return identityError;
|
|
31
|
-
if (proof.protocolVersion !== WORKSPACE_CONTRACT_VERSION) {
|
|
32
|
-
return rejected("version-mismatch", new Error(`resume protocol ${proof.protocolVersion} does not match supported version ${WORKSPACE_CONTRACT_VERSION}`));
|
|
33
|
-
}
|
|
34
|
-
if (proof.boundary.kind !== authority.boundary.kind) {
|
|
35
|
-
return rejected("boundary-mismatch", new Error("resume proof boundary does not match the persisted recovery boundary"));
|
|
36
|
-
}
|
|
37
|
-
const boundaryKey = boundaryKeyOf(authority.boundary);
|
|
38
|
-
if (this.#acceptedBoundaries.has(boundaryKey)) {
|
|
39
|
-
return rejected("replay-detected", new Error("structured recovery boundary has already been accepted"));
|
|
40
|
-
}
|
|
41
|
-
if (authority.boundary.kind === "position") {
|
|
42
|
-
if (proof.boundary.kind !== "position")
|
|
43
|
-
return rejected("boundary-mismatch", new Error("position resume requires a position proof"));
|
|
44
|
-
if (proof.boundary.position !== authority.boundary.position) {
|
|
45
|
-
return rejected("boundary-mismatch", new Error("resume position does not match the persisted recovery boundary"));
|
|
46
|
-
}
|
|
47
|
-
if (proof.boundary.resumeToken !== authority.boundary.resumeToken) {
|
|
48
|
-
return rejected("stale-token", new Error("resume token does not match the persisted recovery boundary"));
|
|
49
|
-
}
|
|
50
|
-
let view = null;
|
|
51
|
-
if (reducer) {
|
|
52
|
-
const restored = restorePosition(reducer, authority.agentId, proof.boundary.position);
|
|
53
|
-
if (isRejected(restored))
|
|
54
|
-
return restored;
|
|
55
|
-
view = restored;
|
|
56
|
-
}
|
|
57
|
-
this.#acceptedBoundaries.add(boundaryKey);
|
|
58
|
-
return { kind: "accepted", boundary: authority.boundary, view, diagnostic: "structured resume position verified" };
|
|
59
|
-
}
|
|
60
|
-
if (proof.boundary.kind !== "snapshot")
|
|
61
|
-
return rejected("boundary-mismatch", new Error("snapshot resume requires a snapshot proof"));
|
|
62
|
-
if (proof.boundary.snapshotId !== authority.boundary.snapshotId) {
|
|
63
|
-
return rejected("stale-token", new Error("resume snapshot identity does not match the persisted recovery boundary"));
|
|
64
|
-
}
|
|
65
|
-
if (payloadBytes(proof.boundary.snapshot.payload) > this.#capability.flow.maxSnapshotBytes) {
|
|
66
|
-
return rejected("snapshot-too-large", new Error(`resume snapshot exceeds the negotiated ${this.#capability.flow.maxSnapshotBytes} byte limit`));
|
|
67
|
-
}
|
|
68
|
-
const snapshotResult = verifySnapshot(authority.agentId, proof.boundary.snapshotId, proof.boundary.snapshot);
|
|
69
|
-
if (snapshotResult)
|
|
70
|
-
return snapshotResult;
|
|
71
|
-
if (reducer) {
|
|
72
|
-
const applied = reducer.replaceWithSnapshot(proof.boundary.snapshot);
|
|
73
|
-
if (applied.kind !== "snapshot-applied") {
|
|
74
|
-
return rejected("snapshot-recovery-failed", new Error(`snapshot recovery failed: ${applied.kind}`));
|
|
75
|
-
}
|
|
76
|
-
this.#acceptedBoundaries.add(boundaryKey);
|
|
77
|
-
return { kind: "accepted", boundary: authority.boundary, view: applied.view, diagnostic: "structured snapshot recovery verified" };
|
|
78
|
-
}
|
|
79
|
-
this.#acceptedBoundaries.add(boundaryKey);
|
|
80
|
-
return { kind: "accepted", boundary: authority.boundary, view: null, diagnostic: "structured snapshot recovery verified" };
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function verifyIdentity(authority, proof) {
|
|
84
|
-
if (proof.agentId !== authority.agentId)
|
|
85
|
-
return rejected("agent-mismatch", new Error("resume proof agent does not match the durable agent identity"));
|
|
86
|
-
if (proof.adapterId !== authority.adapterId)
|
|
87
|
-
return rejected("adapter-mismatch", new Error("resume proof adapter does not match the durable adapter identity"));
|
|
88
|
-
if (proof.processIdentity !== authority.processIdentity)
|
|
89
|
-
return rejected("process-mismatch", new Error("resume proof process does not match verified process ownership"));
|
|
90
|
-
if (proof.ownershipProof !== authority.ownershipProof)
|
|
91
|
-
return rejected("proof-mismatch", new Error("resume ownership proof does not match the persisted authority"));
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
function verifySnapshot(agentId, snapshotId, snapshot) {
|
|
95
|
-
try {
|
|
96
|
-
assertStructuredAgentSnapshot(snapshot);
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
return rejected("invalid-snapshot", error);
|
|
100
|
-
}
|
|
101
|
-
if (snapshot.snapshotId !== snapshotId)
|
|
102
|
-
return rejected("invalid-snapshot", new Error("snapshot payload identity does not match the resume boundary"));
|
|
103
|
-
if (snapshot.agentId !== agentId)
|
|
104
|
-
return rejected("agent-mismatch", new Error("snapshot payload agent does not match the durable agent identity"));
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
function restorePosition(reducer, agentId, position) {
|
|
108
|
-
if (reducer.agentId !== agentId)
|
|
109
|
-
return rejected("agent-mismatch", new Error("resume reducer agent does not match the durable agent identity"));
|
|
110
|
-
try {
|
|
111
|
-
return reducer.restoreResumeBoundary(position);
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
return rejected("invalid-authority", error);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function boundaryKeyOf(boundary) {
|
|
118
|
-
return boundary.kind === "position"
|
|
119
|
-
? `position:${boundary.position}:${boundary.resumeToken}`
|
|
120
|
-
: `snapshot:${boundary.snapshotId}`;
|
|
121
|
-
}
|
|
122
|
-
function isRejected(value) {
|
|
123
|
-
return "kind" in value && value.kind === "rejected";
|
|
124
|
-
}
|
|
125
|
-
function payloadBytes(payload) {
|
|
126
|
-
return new TextEncoder().encode(JSON.stringify(payload)).byteLength;
|
|
127
|
-
}
|
|
128
|
-
function rejected(code, error) {
|
|
129
|
-
return { kind: "rejected", code, diagnostic: error instanceof Error ? error.message : String(error) };
|
|
130
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { type StructuredAgentSnapshot, type StructuredCapabilityContract, type WorkspaceEvent } from "../../contracts/workspace/index.js";
|
|
2
|
-
export type StructuredAgentEvent = Extract<WorkspaceEvent, {
|
|
3
|
-
readonly type: "structured-event";
|
|
4
|
-
}>;
|
|
5
|
-
export interface StructuredRuntimeView {
|
|
6
|
-
readonly agentId: string;
|
|
7
|
-
readonly revision: number;
|
|
8
|
-
readonly lastAppliedPosition: number | null;
|
|
9
|
-
readonly nextEventPosition: number;
|
|
10
|
-
readonly appliedEventCount: number;
|
|
11
|
-
readonly lastEventType: string | null;
|
|
12
|
-
readonly lastEventPayload: unknown;
|
|
13
|
-
readonly snapshotId: string | null;
|
|
14
|
-
readonly snapshotPayload: unknown;
|
|
15
|
-
}
|
|
16
|
-
export type StructuredEventApplyResult = {
|
|
17
|
-
readonly kind: "applied";
|
|
18
|
-
readonly view: StructuredRuntimeView;
|
|
19
|
-
} | {
|
|
20
|
-
readonly kind: "duplicate";
|
|
21
|
-
readonly view: StructuredRuntimeView;
|
|
22
|
-
readonly duplicatePosition: number;
|
|
23
|
-
} | {
|
|
24
|
-
readonly kind: "resynchronization-required";
|
|
25
|
-
readonly view: StructuredRuntimeView;
|
|
26
|
-
readonly expectedPosition: number;
|
|
27
|
-
readonly receivedPosition: number;
|
|
28
|
-
readonly recovery: "snapshot" | "none";
|
|
29
|
-
} | {
|
|
30
|
-
readonly kind: "rejected";
|
|
31
|
-
readonly code: string;
|
|
32
|
-
readonly diagnostic: string;
|
|
33
|
-
};
|
|
34
|
-
export type StructuredSnapshotApplyResult = {
|
|
35
|
-
readonly kind: "snapshot-applied";
|
|
36
|
-
readonly view: StructuredRuntimeView;
|
|
37
|
-
} | {
|
|
38
|
-
readonly kind: "snapshot-stale";
|
|
39
|
-
readonly view: StructuredRuntimeView;
|
|
40
|
-
readonly currentPosition: number;
|
|
41
|
-
readonly snapshotPosition: number;
|
|
42
|
-
} | {
|
|
43
|
-
readonly kind: "rejected";
|
|
44
|
-
readonly code: string;
|
|
45
|
-
readonly diagnostic: string;
|
|
46
|
-
};
|
|
47
|
-
/** Applies ordered structured events and snapshots while exposing gaps as explicit resynchronization. */
|
|
48
|
-
export declare class StructuredEventReducer {
|
|
49
|
-
#private;
|
|
50
|
-
readonly agentId: string;
|
|
51
|
-
constructor(agentId: string, capability: StructuredCapabilityContract);
|
|
52
|
-
applyEvent(event: StructuredAgentEvent): StructuredEventApplyResult;
|
|
53
|
-
replaceWithSnapshot(snapshot: StructuredAgentSnapshot): StructuredSnapshotApplyResult;
|
|
54
|
-
restoreResumeBoundary(position: number): StructuredRuntimeView;
|
|
55
|
-
nextEventPosition(): number;
|
|
56
|
-
view(): StructuredRuntimeView;
|
|
57
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { assertStructuredAgentSnapshot, assertStructuredCapability, assertWorkspaceEvent, } from "../../contracts/workspace/index.js";
|
|
2
|
-
/** Applies ordered structured events and snapshots while exposing gaps as explicit resynchronization. */
|
|
3
|
-
export class StructuredEventReducer {
|
|
4
|
-
agentId;
|
|
5
|
-
#capability;
|
|
6
|
-
#lastAppliedPosition = null;
|
|
7
|
-
#appliedEventCount = 0;
|
|
8
|
-
#revision = 0;
|
|
9
|
-
#lastEventType = null;
|
|
10
|
-
#lastEventPayload = null;
|
|
11
|
-
#snapshotId = null;
|
|
12
|
-
#snapshotPayload = null;
|
|
13
|
-
constructor(agentId, capability) {
|
|
14
|
-
this.agentId = agentId;
|
|
15
|
-
assertStructuredCapability(capability);
|
|
16
|
-
if (!agentId || agentId.includes("\0"))
|
|
17
|
-
throw new TypeError("structured reducer agent id is invalid");
|
|
18
|
-
this.#capability = capability;
|
|
19
|
-
}
|
|
20
|
-
applyEvent(event) {
|
|
21
|
-
try {
|
|
22
|
-
assertWorkspaceEvent(event);
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
return rejected("malformed-event", error);
|
|
26
|
-
}
|
|
27
|
-
if (event.agentId !== this.agentId) {
|
|
28
|
-
return rejected("agent-mismatch", new Error("structured event agent does not match the reducer identity"));
|
|
29
|
-
}
|
|
30
|
-
if (!this.#capability.eventTypes.includes(event.eventType)) {
|
|
31
|
-
return rejected("unsupported-event-type", new Error(`structured event type is not negotiated: ${event.eventType}`));
|
|
32
|
-
}
|
|
33
|
-
if (payloadBytes(event.payload) > this.#capability.flow.maxEventBytes) {
|
|
34
|
-
return rejected("event-too-large", new Error(`structured event exceeds the negotiated ${this.#capability.flow.maxEventBytes} byte limit`));
|
|
35
|
-
}
|
|
36
|
-
const nextPosition = this.nextEventPosition();
|
|
37
|
-
if (event.position < nextPosition) {
|
|
38
|
-
return { kind: "duplicate", view: this.view(), duplicatePosition: event.position };
|
|
39
|
-
}
|
|
40
|
-
if (event.position > nextPosition) {
|
|
41
|
-
return {
|
|
42
|
-
kind: "resynchronization-required",
|
|
43
|
-
view: this.view(),
|
|
44
|
-
expectedPosition: nextPosition,
|
|
45
|
-
receivedPosition: event.position,
|
|
46
|
-
recovery: this.#capability.snapshots === "authoritative" ? "snapshot" : "none",
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
this.#lastAppliedPosition = event.position;
|
|
50
|
-
this.#appliedEventCount += 1;
|
|
51
|
-
this.#lastEventType = event.eventType;
|
|
52
|
-
this.#lastEventPayload = event.payload;
|
|
53
|
-
this.#revision += 1;
|
|
54
|
-
return { kind: "applied", view: this.view() };
|
|
55
|
-
}
|
|
56
|
-
replaceWithSnapshot(snapshot) {
|
|
57
|
-
if (this.#capability.snapshots !== "authoritative") {
|
|
58
|
-
return rejected("snapshots-unsupported", new Error("the negotiated adapter capability does not provide authoritative snapshots"));
|
|
59
|
-
}
|
|
60
|
-
try {
|
|
61
|
-
assertStructuredAgentSnapshot(snapshot);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
return rejected("malformed-snapshot", error);
|
|
65
|
-
}
|
|
66
|
-
if (snapshot.agentId !== this.agentId) {
|
|
67
|
-
return rejected("agent-mismatch", new Error("structured snapshot agent does not match the reducer identity"));
|
|
68
|
-
}
|
|
69
|
-
if (payloadBytes(snapshot.payload) > this.#capability.flow.maxSnapshotBytes) {
|
|
70
|
-
return rejected("snapshot-too-large", new Error(`structured snapshot exceeds the negotiated ${this.#capability.flow.maxSnapshotBytes} byte limit`));
|
|
71
|
-
}
|
|
72
|
-
const currentPosition = this.#lastAppliedPosition;
|
|
73
|
-
if (currentPosition !== null && snapshot.position < currentPosition) {
|
|
74
|
-
return { kind: "snapshot-stale", view: this.view(), currentPosition, snapshotPosition: snapshot.position };
|
|
75
|
-
}
|
|
76
|
-
this.#lastAppliedPosition = snapshot.position;
|
|
77
|
-
this.#appliedEventCount = 0;
|
|
78
|
-
this.#lastEventType = null;
|
|
79
|
-
this.#lastEventPayload = null;
|
|
80
|
-
this.#snapshotId = snapshot.snapshotId;
|
|
81
|
-
this.#snapshotPayload = snapshot.payload;
|
|
82
|
-
this.#revision += 1;
|
|
83
|
-
return { kind: "snapshot-applied", view: this.view() };
|
|
84
|
-
}
|
|
85
|
-
restoreResumeBoundary(position) {
|
|
86
|
-
if (!Number.isSafeInteger(position) || position < 0)
|
|
87
|
-
throw new RangeError("structured resume position must be a non-negative safe integer");
|
|
88
|
-
this.#lastAppliedPosition = position;
|
|
89
|
-
this.#appliedEventCount = 0;
|
|
90
|
-
this.#lastEventType = null;
|
|
91
|
-
this.#lastEventPayload = null;
|
|
92
|
-
this.#snapshotId = null;
|
|
93
|
-
this.#snapshotPayload = null;
|
|
94
|
-
this.#revision += 1;
|
|
95
|
-
return this.view();
|
|
96
|
-
}
|
|
97
|
-
nextEventPosition() {
|
|
98
|
-
return this.#lastAppliedPosition === null ? 0 : this.#lastAppliedPosition + 1;
|
|
99
|
-
}
|
|
100
|
-
view() {
|
|
101
|
-
return Object.freeze({
|
|
102
|
-
agentId: this.agentId,
|
|
103
|
-
revision: this.#revision,
|
|
104
|
-
lastAppliedPosition: this.#lastAppliedPosition,
|
|
105
|
-
nextEventPosition: this.nextEventPosition(),
|
|
106
|
-
appliedEventCount: this.#appliedEventCount,
|
|
107
|
-
lastEventType: this.#lastEventType,
|
|
108
|
-
lastEventPayload: this.#lastEventPayload,
|
|
109
|
-
snapshotId: this.#snapshotId,
|
|
110
|
-
snapshotPayload: this.#snapshotPayload,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function rejected(code, error) {
|
|
115
|
-
return { kind: "rejected", code, diagnostic: error instanceof Error ? error.message : String(error) };
|
|
116
|
-
}
|
|
117
|
-
function payloadBytes(payload) {
|
|
118
|
-
return new TextEncoder().encode(JSON.stringify(payload)).byteLength;
|
|
119
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Container } from "#pi-tui";
|
|
2
|
-
import type { CustomEntry, EntryRenderer } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
/**
|
|
4
|
-
* Component that renders a custom session entry from extensions.
|
|
5
|
-
* The host owns transcript spacing; renderer output should provide only its content.
|
|
6
|
-
*/
|
|
7
|
-
export declare class CustomEntryComponent extends Container {
|
|
8
|
-
private entry;
|
|
9
|
-
private renderer;
|
|
10
|
-
private customComponent;
|
|
11
|
-
private _expanded;
|
|
12
|
-
constructor(entry: CustomEntry<unknown>, renderer: EntryRenderer);
|
|
13
|
-
hasContent(): boolean;
|
|
14
|
-
setExpanded(expanded: boolean): void;
|
|
15
|
-
invalidate(): void;
|
|
16
|
-
private rebuild;
|
|
17
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Box, Container, Spacer, Text } from "#pi-tui";
|
|
2
|
-
import { piTheme } from "../theme/theme.js";
|
|
3
|
-
/**
|
|
4
|
-
* Component that renders a custom session entry from extensions.
|
|
5
|
-
* The host owns transcript spacing; renderer output should provide only its content.
|
|
6
|
-
*/
|
|
7
|
-
export class CustomEntryComponent extends Container {
|
|
8
|
-
entry;
|
|
9
|
-
renderer;
|
|
10
|
-
customComponent;
|
|
11
|
-
_expanded = false;
|
|
12
|
-
constructor(entry, renderer) {
|
|
13
|
-
super();
|
|
14
|
-
this.entry = entry;
|
|
15
|
-
this.renderer = renderer;
|
|
16
|
-
this.rebuild();
|
|
17
|
-
}
|
|
18
|
-
hasContent() {
|
|
19
|
-
return this.customComponent !== undefined;
|
|
20
|
-
}
|
|
21
|
-
setExpanded(expanded) {
|
|
22
|
-
if (this._expanded !== expanded) {
|
|
23
|
-
this._expanded = expanded;
|
|
24
|
-
this.rebuild();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
invalidate() {
|
|
28
|
-
super.invalidate();
|
|
29
|
-
this.rebuild();
|
|
30
|
-
}
|
|
31
|
-
rebuild() {
|
|
32
|
-
this.clear();
|
|
33
|
-
this.customComponent = undefined;
|
|
34
|
-
let component;
|
|
35
|
-
try {
|
|
36
|
-
component = this.renderer(this.entry, { expanded: this._expanded }, piTheme());
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
40
|
-
const box = new Box(1, 1, (text) => piTheme().bg("customMessageBg", text));
|
|
41
|
-
box.addChild(new Text(piTheme().fg("error", `[${this.entry.customType}] renderer failed: ${message}`), 0, 0));
|
|
42
|
-
component = box;
|
|
43
|
-
}
|
|
44
|
-
if (!component) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
this.customComponent = component;
|
|
48
|
-
this.addChild(new Spacer(1));
|
|
49
|
-
this.addChild(component);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Container } from "#pi-tui";
|
|
2
|
-
export type TerminalTheme = "dark" | "light";
|
|
3
|
-
export interface FirstTimeSetupResult {
|
|
4
|
-
theme: TerminalTheme;
|
|
5
|
-
shareAnalytics: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface FirstTimeSetupOptions {
|
|
8
|
-
detectedTheme: TerminalTheme;
|
|
9
|
-
onThemePreview: (themeName: TerminalTheme) => void;
|
|
10
|
-
onSubmit: (result: FirstTimeSetupResult) => void;
|
|
11
|
-
onCancel: () => void;
|
|
12
|
-
}
|
|
13
|
-
/** First-time setup dialog: theme choice and analytics opt-in. */
|
|
14
|
-
export declare class FirstTimeSetupComponent extends Container {
|
|
15
|
-
private step;
|
|
16
|
-
private themeIndex;
|
|
17
|
-
private analyticsIndex;
|
|
18
|
-
private readonly options;
|
|
19
|
-
constructor(options: FirstTimeSetupOptions);
|
|
20
|
-
private update;
|
|
21
|
-
private addOptionList;
|
|
22
|
-
private moveSelection;
|
|
23
|
-
handleInput(keyData: string): void;
|
|
24
|
-
}
|