@quantiya/codevibe-core 2.0.0 → 2.0.2
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/dist/__tests__/cp-5-baseline-invariants.test.d.ts +1 -0
- package/dist/__tests__/prompt-parser.test.d.ts +1 -0
- package/dist/adapter/__tests__/capabilities.test.d.ts +1 -0
- package/dist/adapter/__tests__/contract-conformance.test.d.ts +1 -0
- package/dist/adapter/__tests__/packets.test.d.ts +1 -0
- package/dist/adapter/__tests__/progress.test.d.ts +1 -0
- package/dist/adapter/__tests__/registry.test.d.ts +1 -0
- package/dist/adapter/__tests__/smoke/claude.smoke.test.d.ts +1 -0
- package/dist/adapter/__tests__/smoke/codex.smoke.test.d.ts +1 -0
- package/dist/adapter/__tests__/smoke/gemini.smoke.test.d.ts +1 -0
- package/dist/adapter/capabilities.d.ts +68 -0
- package/dist/adapter/index.d.ts +7 -0
- package/dist/adapter/packets.d.ts +129 -0
- package/dist/adapter/progress.d.ts +93 -0
- package/dist/adapter/registry.d.ts +91 -0
- package/dist/adapter/types.d.ts +22 -0
- package/dist/appsync/__tests__/appsync-client-apply-user-decision.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client-classb.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client-event-source-filter.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client-planner.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client-task-group.test.d.ts +1 -0
- package/dist/appsync/__tests__/appsync-client.test.d.ts +1 -0
- package/dist/appsync/__tests__/cleanup-subscription.test.d.ts +1 -0
- package/dist/appsync/__tests__/coerce-awsjson-and-review-summary.test.d.ts +1 -0
- package/dist/appsync/__tests__/cp1f-quorum-sdk.test.d.ts +1 -0
- package/dist/appsync/__tests__/event-throttle.test.d.ts +1 -0
- package/dist/appsync/appsync-client.d.ts +1025 -2
- package/dist/appsync/event-throttle.d.ts +28 -0
- package/dist/appsync/index.d.ts +4 -1
- package/dist/appsync/queries.d.ts +34 -0
- package/dist/audit-keys/index.d.ts +32 -0
- package/dist/auth/__tests__/auth-telemetry.test.d.ts +1 -0
- package/dist/auth/auth-service.d.ts +32 -2
- package/dist/auth/auth-telemetry.d.ts +117 -6
- package/dist/auth/index.d.ts +1 -0
- package/dist/companion-mode/__tests__/persist-preference.test.d.ts +1 -0
- package/dist/companion-mode/__tests__/resolve-agent.test.d.ts +1 -0
- package/dist/companion-mode/agent-picker.d.ts +9 -0
- package/dist/companion-mode/index.d.ts +55 -0
- package/dist/companion-mode/persist-preference.d.ts +24 -0
- package/dist/companion-mode/resolve-agent.d.ts +41 -0
- package/dist/config/config.d.ts +8 -1
- package/dist/continuation/__tests__/dirty-state-collector.test.d.ts +1 -0
- package/dist/continuation/__tests__/integration.test.d.ts +1 -0
- package/dist/continuation/__tests__/packet-reader.test.d.ts +1 -0
- package/dist/continuation/__tests__/packet-writer.test.d.ts +1 -0
- package/dist/continuation/__tests__/parity.test.d.ts +1 -0
- package/dist/continuation/__tests__/status-cli.test.d.ts +1 -0
- package/dist/continuation/dirty-state-collector.d.ts +46 -0
- package/dist/continuation/index.d.ts +8 -0
- package/dist/continuation/packet-reader.d.ts +33 -0
- package/dist/continuation/packet-writer.d.ts +86 -0
- package/dist/continuation/types.d.ts +239 -0
- package/dist/credential-broker/__tests__/broker.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/canonical.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/scrubber.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/upstream-client.test.d.ts +1 -0
- package/dist/credential-broker/__tests__/vendor-key-store.test.d.ts +1 -0
- package/dist/credential-broker/audit-sink.d.ts +69 -0
- package/dist/credential-broker/broker-config.d.ts +39 -0
- package/dist/credential-broker/broker-token.d.ts +123 -0
- package/dist/credential-broker/broker.d.ts +165 -0
- package/dist/credential-broker/canonical.d.ts +119 -0
- package/dist/credential-broker/index.d.ts +15 -0
- package/dist/credential-broker/scrubber.d.ts +45 -0
- package/dist/credential-broker/types.d.ts +141 -0
- package/dist/credential-broker/upstream-client.d.ts +20 -0
- package/dist/credential-broker/vendor-key-store.d.ts +54 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +559 -55
- package/dist/keychain/__tests__/keychain-backend.test.d.ts +1 -0
- package/dist/keychain/keychain-backend.d.ts +82 -0
- package/dist/keychain/keychain-manager.d.ts +16 -2
- package/dist/local-executor/__tests__/agentic-disposable-repo.test.d.ts +1 -0
- package/dist/local-executor/__tests__/agentic-resolve.test.d.ts +1 -0
- package/dist/local-executor/__tests__/agentic-resolver-flag.test.d.ts +1 -0
- package/dist/local-executor/__tests__/authority-symlink-fixture.d.ts +15 -0
- package/dist/local-executor/__tests__/authority.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-a-emit.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-a-sign.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-b-consumer.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class-b-consumer.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class1-reconcilers.test.d.ts +1 -0
- package/dist/local-executor/__tests__/class2-resolver.test.d.ts +1 -0
- package/dist/local-executor/__tests__/confined-model-caller.test.d.ts +1 -0
- package/dist/local-executor/__tests__/conflict-classifier.test.d.ts +1 -0
- package/dist/local-executor/__tests__/conflict-resolution-durable-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/conflict-resolution-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/cp1f-quorum-consumer.test.d.ts +1 -0
- package/dist/local-executor/__tests__/cp7-audit-writer.test.d.ts +1 -0
- package/dist/local-executor/__tests__/durable-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/git-lock-retry.test.d.ts +1 -0
- package/dist/local-executor/__tests__/hook-bridge.test.d.ts +1 -0
- package/dist/local-executor/__tests__/implementor-argv.test.d.ts +1 -0
- package/dist/local-executor/__tests__/local-executor-teams.test.d.ts +1 -0
- package/dist/local-executor/__tests__/local-executor.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-extract.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-git.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-resolve-agentic.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-conflict-resolve.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-journal-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train-agentic-recovery.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train-w3.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train-waveb.integration.test.d.ts +1 -0
- package/dist/local-executor/__tests__/merge-train.test.d.ts +1 -0
- package/dist/local-executor/__tests__/promote-wal-store.test.d.ts +1 -0
- package/dist/local-executor/__tests__/revert-reconcile.test.d.ts +1 -0
- package/dist/local-executor/__tests__/revert-runner.test.d.ts +1 -0
- package/dist/local-executor/__tests__/shared-contract-detector.test.d.ts +1 -0
- package/dist/local-executor/__tests__/spawn.test.d.ts +1 -0
- package/dist/local-executor/__tests__/substrate-engage.test.d.ts +1 -0
- package/dist/local-executor/__tests__/team-execution-flag.test.d.ts +1 -0
- package/dist/local-executor/__tests__/track-registry.test.d.ts +1 -0
- package/dist/local-executor/__tests__/verification-runner.test.d.ts +1 -0
- package/dist/local-executor/__tests__/wb2-review-bundle.test.d.ts +1 -0
- package/dist/local-executor/__tests__/wb2-substrate-spawn.live.test.d.ts +1 -0
- package/dist/local-executor/__tests__/workspace-shadow.test.d.ts +1 -0
- package/dist/local-executor/__tests__/worktree-merge.test.d.ts +1 -0
- package/dist/local-executor/agentic-disposable-repo.d.ts +52 -0
- package/dist/local-executor/agentic-resolve.d.ts +54 -0
- package/dist/local-executor/agentic-resolver-flag.d.ts +9 -0
- package/dist/local-executor/authority.d.ts +61 -0
- package/dist/local-executor/class-a-emit.d.ts +140 -0
- package/dist/local-executor/class-a-sign.d.ts +57 -0
- package/dist/local-executor/class-b-consumer.d.ts +276 -0
- package/dist/local-executor/class-b-verify.d.ts +30 -0
- package/dist/local-executor/class1-reconcilers.d.ts +58 -0
- package/dist/local-executor/class2-resolver.d.ts +74 -0
- package/dist/local-executor/confined-model-caller.d.ts +39 -0
- package/dist/local-executor/conflict-classifier.d.ts +21 -0
- package/dist/local-executor/conflict-resolution-durable-store.d.ts +61 -0
- package/dist/local-executor/conflict-resolution-store.d.ts +210 -0
- package/dist/local-executor/conflict-types.d.ts +86 -0
- package/dist/local-executor/cp7-audit-writer.d.ts +152 -0
- package/dist/local-executor/durable-store.d.ts +334 -0
- package/dist/local-executor/git-lock-retry.d.ts +40 -0
- package/dist/local-executor/hook-bridge.d.ts +36 -0
- package/dist/local-executor/implementor-argv.d.ts +183 -0
- package/dist/local-executor/index.d.ts +49 -0
- package/dist/local-executor/local-executor-impl.d.ts +724 -0
- package/dist/local-executor/merge-conflict-extract.d.ts +34 -0
- package/dist/local-executor/merge-conflict-resolve.d.ts +101 -0
- package/dist/local-executor/merge-journal-store.d.ts +311 -0
- package/dist/local-executor/merge-train.d.ts +713 -0
- package/dist/local-executor/promote-wal-store.d.ts +301 -0
- package/dist/local-executor/resolution-set-index.d.ts +51 -0
- package/dist/local-executor/revert-reconcile.d.ts +89 -0
- package/dist/local-executor/revert-runner.d.ts +17 -0
- package/dist/local-executor/shared-contract-detector.d.ts +57 -0
- package/dist/local-executor/spawn.d.ts +34 -0
- package/dist/local-executor/task-group-types.d.ts +346 -0
- package/dist/local-executor/team-execution-flag.d.ts +21 -0
- package/dist/local-executor/track-registry.d.ts +50 -0
- package/dist/local-executor/types.d.ts +417 -0
- package/dist/local-executor/verification-gates/build.d.ts +6 -0
- package/dist/local-executor/verification-gates/deploy-preflight.d.ts +6 -0
- package/dist/local-executor/verification-gates/diff-sanity.d.ts +6 -0
- package/dist/local-executor/verification-gates/hostile-grep.d.ts +6 -0
- package/dist/local-executor/verification-gates/lint.d.ts +6 -0
- package/dist/local-executor/verification-gates/shell-runner.d.ts +40 -0
- package/dist/local-executor/verification-gates/source-traceability.d.ts +6 -0
- package/dist/local-executor/verification-gates/tests.d.ts +6 -0
- package/dist/local-executor/verification-gates/typecheck.d.ts +6 -0
- package/dist/local-executor/verification-runner.d.ts +28 -0
- package/dist/local-executor/wb2-review-bundle.d.ts +59 -0
- package/dist/local-executor/workspace-shadow.d.ts +290 -0
- package/dist/local-executor/worktree-merge.d.ts +601 -0
- package/dist/local-model/__tests__/installer.test.d.ts +1 -0
- package/dist/local-model/__tests__/manager.test.d.ts +1 -0
- package/dist/local-model/__tests__/ollama.test.d.ts +1 -0
- package/dist/local-model/__tests__/runtime.test.d.ts +1 -0
- package/dist/local-model/__tests__/state.test.d.ts +1 -0
- package/dist/local-model/manager.d.ts +119 -0
- package/dist/local-model/ollama.d.ts +27 -0
- package/dist/local-model/runtime.d.ts +27 -0
- package/dist/local-model/state.d.ts +32 -0
- package/dist/orchestration/__tests__/setup-bootstrap.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-failure-recourse.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-save.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-seat-picker.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-telemetry.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-test-agents.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-types.test.d.ts +1 -0
- package/dist/orchestration/__tests__/setup-wizard.test.d.ts +1 -0
- package/dist/orchestration/__tests__/v1-options.test.d.ts +1 -0
- package/dist/orchestration/detect-agents.d.ts +16 -2
- package/dist/orchestration/index.d.ts +1 -0
- package/dist/orchestration/orchestration-cli.d.ts +4 -1
- package/dist/orchestration/setup-bootstrap.d.ts +146 -0
- package/dist/orchestration/setup-failure-recourse.d.ts +23 -0
- package/dist/orchestration/setup-save.d.ts +47 -0
- package/dist/orchestration/setup-seat-picker.d.ts +72 -0
- package/dist/orchestration/setup-telemetry.d.ts +54 -0
- package/dist/orchestration/setup-test-agents.d.ts +108 -0
- package/dist/orchestration/setup-types.d.ts +141 -0
- package/dist/orchestration/setup-wizard.d.ts +57 -0
- package/dist/orchestration/v1-options.d.ts +97 -0
- package/dist/orchestration-shell/__tests__/attachments.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/audit-browser.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/audited-path-fixes.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/bracketed-paste.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-authority-bridge.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-group-halt-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-orchestration-session-bootstrap.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-planner-stack.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-probe-group-status.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-quorum-loop-tier.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-singleton-enforcement.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-verdict-classifier-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/components.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-store.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp10-585-accept-echo-target.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp10-585-loop.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp10-585-prompts.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp12-w2b-team-loop.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp12-w4-team-recovery.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp1f-quorum-loop.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp606-team-track-user-resolved.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp7-reviewer-substrate.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/declared-test-runner.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/emit-shell-event.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/familiarize-routing.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-decision-submit.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-details-panel.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-prompts.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/gate-verdict-details-dispatch.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/group-decision-submit.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/hostile-grep.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/image-attach-e2e.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/input-bar-autocomplete.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/live-region-cap.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/live-static-order.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/mode-selection.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/model-cli.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/non-gate-prompt-routing.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/orchestration-app-group-decision-transport.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/orchestration-app-layout.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/process-markers.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reducer.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reissue-team-retained-spec.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/review-summary-render.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reviewer-wizard.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/reviewers-format.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/root-discovery.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell-classify-dispatch.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell-planner-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell-signal.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/serialize-submissions.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/slash-router.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/slash-suggest.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/status-format.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/sticky-preference.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/task-progress.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-decompose-routing.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-decompose-types.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-decompose.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/team-e2e-smoke.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/tier2-reviewer-selection.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/web-browsing.test.d.ts +1 -0
- package/dist/orchestration-shell/attachments.d.ts +152 -0
- package/dist/orchestration-shell/audit-browser.d.ts +115 -0
- package/dist/orchestration-shell/audit-runner.d.ts +59 -0
- package/dist/orchestration-shell/bracketed-paste.d.ts +26 -0
- package/dist/orchestration-shell/cli.d.ts +431 -0
- package/dist/orchestration-shell/cli.js +44191 -0
- package/dist/orchestration-shell/cohort-flag.d.ts +16 -0
- package/dist/orchestration-shell/components/AuditLogPanel.d.ts +11 -0
- package/dist/orchestration-shell/components/CodeVibeLogo.d.ts +2 -0
- package/dist/orchestration-shell/components/ConversationPane.d.ts +13 -0
- package/dist/orchestration-shell/components/GateDetailsPanel.d.ts +57 -0
- package/dist/orchestration-shell/components/GatePanelEntry.d.ts +9 -0
- package/dist/orchestration-shell/components/GatePromptEntry.d.ts +16 -0
- package/dist/orchestration-shell/components/InputBar.d.ts +55 -0
- package/dist/orchestration-shell/components/LiveProgressLine.d.ts +8 -0
- package/dist/orchestration-shell/components/MultiTrackStatusNode.d.ts +8 -0
- package/dist/orchestration-shell/components/OrchestrationApp.d.ts +129 -0
- package/dist/orchestration-shell/components/ReviewerSetupWizard.d.ts +24 -0
- package/dist/orchestration-shell/components/StatusBar.d.ts +20 -0
- package/dist/orchestration-shell/components/nodes/AdvisoryEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/GateStatusNode.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/PlannerDecisionEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/ReviewerQuorumStatusNode.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/SlashOutputEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/SubagentEventEntry.d.ts +8 -0
- package/dist/orchestration-shell/components/nodes/UserMessageEntry.d.ts +8 -0
- package/dist/orchestration-shell/context-store.d.ts +389 -0
- package/dist/orchestration-shell/declared-test-runner.d.ts +84 -0
- package/dist/orchestration-shell/emit-shell-event.d.ts +64 -0
- package/dist/orchestration-shell/gate-decision-submit.d.ts +245 -0
- package/dist/orchestration-shell/gate-prompts.d.ts +481 -0
- package/dist/orchestration-shell/index.d.ts +712 -0
- package/dist/orchestration-shell/ink-runtime.d.ts +84 -0
- package/dist/orchestration-shell/live-region-cap.d.ts +70 -0
- package/dist/orchestration-shell/live-static-order.d.ts +22 -0
- package/dist/orchestration-shell/mode-selection.d.ts +46 -0
- package/dist/orchestration-shell/non-tty-fallback.d.ts +67 -0
- package/dist/orchestration-shell/process-markers.d.ts +12 -0
- package/dist/orchestration-shell/quorum-loop.d.ts +1900 -0
- package/dist/orchestration-shell/reducer.d.ts +8 -0
- package/dist/orchestration-shell/root-discovery.d.ts +25 -0
- package/dist/orchestration-shell/route-browse.d.ts +20 -0
- package/dist/orchestration-shell/slash-router.d.ts +64 -0
- package/dist/orchestration-shell/slash-routes/continuation.d.ts +71 -0
- package/dist/orchestration-shell/slash-routes/reviewers.d.ts +41 -0
- package/dist/orchestration-shell/slash-suggest.d.ts +29 -0
- package/dist/orchestration-shell/status-format.d.ts +59 -0
- package/dist/orchestration-shell/sticky-preference.d.ts +24 -0
- package/dist/orchestration-shell/store.d.ts +17 -0
- package/dist/orchestration-shell/task-progress.d.ts +122 -0
- package/dist/orchestration-shell/team-decompose.d.ts +196 -0
- package/dist/orchestration-shell/types.d.ts +777 -0
- package/dist/orchestration-shell/vendor/ink-parse-keypress.d.ts +42 -0
- package/dist/orchestration-shell/web/extract.d.ts +11 -0
- package/dist/orchestration-shell/web/fetch.d.ts +15 -0
- package/dist/orchestration-shell/web/ip.d.ts +26 -0
- package/dist/orchestration-shell/web/sanitize.d.ts +14 -0
- package/dist/orchestration-shell/web/search.d.ts +16 -0
- package/dist/planner/__tests__/cache-clarification-bypass.test.d.ts +1 -0
- package/dist/planner/__tests__/cache.test.d.ts +1 -0
- package/dist/planner/__tests__/client.test.d.ts +1 -0
- package/dist/planner/__tests__/health-machine-transitions.test.d.ts +1 -0
- package/dist/planner/__tests__/local-gemma.test.d.ts +1 -0
- package/dist/planner/__tests__/types-zod.test.d.ts +1 -0
- package/dist/planner/adapter.d.ts +16 -0
- package/dist/planner/cache.d.ts +35 -0
- package/dist/planner/client.d.ts +103 -0
- package/dist/planner/health-state.d.ts +24 -0
- package/dist/planner/index.d.ts +7 -0
- package/dist/planner/local-advisory.d.ts +84 -0
- package/dist/planner/local-gemma.d.ts +23 -0
- package/dist/planner/types.d.ts +123 -0
- package/dist/reviewer/__tests__/antigravity-provider.test.d.ts +1 -0
- package/dist/reviewer/__tests__/claude-provider-json.test.d.ts +1 -0
- package/dist/reviewer/__tests__/cp7-reviewer-sandbox.test.d.ts +1 -0
- package/dist/reviewer/__tests__/output-parser-classifier-helpers.test.d.ts +1 -0
- package/dist/reviewer/__tests__/verdict-classifier.test.d.ts +1 -0
- package/dist/reviewer/index.d.ts +2 -0
- package/dist/reviewer/output-parser.d.ts +48 -12
- package/dist/reviewer/provider.d.ts +107 -3
- package/dist/reviewer/providers/__tests__/failure-classifier.test.d.ts +1 -0
- package/dist/reviewer/providers/antigravity.d.ts +49 -0
- package/dist/reviewer/providers/claude.d.ts +19 -4
- package/dist/reviewer/providers/codex.d.ts +47 -5
- package/dist/reviewer/providers/failure-classifier.d.ts +26 -0
- package/dist/reviewer/providers/gemini.d.ts +5 -4
- package/dist/reviewer/registry.d.ts +5 -5
- package/dist/reviewer/subprocess.d.ts +37 -0
- package/dist/reviewer/token-usage.d.ts +32 -0
- package/dist/reviewer/types.d.ts +5 -5
- package/dist/reviewer/verdict-classifier.d.ts +62 -0
- package/dist/session/__tests__/prepare-event-timestamp.test.d.ts +1 -0
- package/dist/session/__tests__/session-resume-service-keys.test.d.ts +1 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/prepare-event-timestamp.d.ts +30 -0
- package/dist/session/session-rekey.d.ts +40 -0
- package/dist/session/session-resume.d.ts +25 -0
- package/dist/structural-summary/__tests__/__fixtures__/fixture-helpers.d.ts +11 -0
- package/dist/structural-summary/__tests__/assembler.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/generator.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/language-detect.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/cargo.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/gomod.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/gradle.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/index.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/npm.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/podfile.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/manifest-parsers/pyproject.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/opt-in-store.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/privacy-filter.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/safe-file-read.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/user-ignore-matcher.test.d.ts +1 -0
- package/dist/structural-summary/__tests__/walker.test.d.ts +1 -0
- package/dist/structural-summary/generator.d.ts +8 -0
- package/dist/structural-summary/index.d.ts +7 -0
- package/dist/structural-summary/manifest-parsers/cargo.d.ts +3 -0
- package/dist/structural-summary/manifest-parsers/index.d.ts +7 -0
- package/dist/structural-summary/manifest-parsers/npm.d.ts +3 -0
- package/dist/structural-summary/manifest-parsers/other.d.ts +17 -0
- package/dist/structural-summary/opt-in-store.d.ts +24 -0
- package/dist/structural-summary/privacy-filter.d.ts +110 -0
- package/dist/structural-summary/safe-file-read.d.ts +11 -0
- package/dist/structural-summary/types.d.ts +215 -0
- package/dist/structural-summary/user-ignore-matcher.d.ts +9 -0
- package/dist/structural-summary/walker.d.ts +20 -0
- package/dist/substrate/__tests__/docker.test.d.ts +1 -0
- package/dist/substrate/__tests__/forwarder.test.d.ts +1 -0
- package/dist/substrate/__tests__/git-proxy.test.d.ts +1 -0
- package/dist/substrate/__tests__/sandbox-exec.test.d.ts +1 -0
- package/dist/substrate/__tests__/substrate-e2e.integration.test.d.ts +1 -0
- package/dist/substrate/command-runner.d.ts +19 -0
- package/dist/substrate/docker.d.ts +134 -0
- package/dist/substrate/errors.d.ts +33 -0
- package/dist/substrate/forwarder.d.ts +67 -0
- package/dist/substrate/git-proxy.d.ts +35 -0
- package/dist/substrate/index.d.ts +12 -0
- package/dist/substrate/relay-script.d.ts +27 -0
- package/dist/substrate/sandbox-exec.d.ts +116 -0
- package/dist/substrate/types.d.ts +218 -0
- package/dist/substrate-launch/__tests__/apikey-bootstrap.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/creditless-loop.integration.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/engage-substrate.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/fallback-ladder.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/le-env-scrub.test.d.ts +1 -0
- package/dist/substrate-launch/__tests__/sanitized-env.test.d.ts +1 -0
- package/dist/substrate-launch/apikey-bootstrap.d.ts +84 -0
- package/dist/substrate-launch/engage-substrate.d.ts +102 -0
- package/dist/substrate-launch/fallback-ladder.d.ts +49 -0
- package/dist/substrate-launch/index.d.ts +12 -0
- package/dist/substrate-launch/le-env-scrub.d.ts +77 -0
- package/dist/substrate-launch/sanitized-env.d.ts +73 -0
- package/dist/types/auth.d.ts +6 -1
- package/dist/types/events.d.ts +19 -2
- package/dist/types/reviewer.d.ts +6 -6
- package/package.json +21 -3
|
@@ -1,4 +1,160 @@
|
|
|
1
1
|
import { CreateEventInput, CreateSessionInput, UpdateSessionInput, UpdateEventStatusInput, Event, Session, EventSource, DeviceKey, GrantSessionKeyInput, UpdateReviewerPolicyInput, UserReviewerPolicySnapshot } from '../types';
|
|
2
|
+
import type { PostDecisionAction } from '../orchestration-shell/types';
|
|
3
|
+
import type { CreateTaskGroupInput, CreateTaskGroupResult, SubmitMergeGateVerdictInput, SubmitMergeGateVerdictResult, SubmitTrackVerificationOutcomeInput, SubmitTrackVerificationOutcomeResult, ClaimGroupDecisionInput, ClaimGroupDecisionResult } from '../local-executor/task-group-types';
|
|
4
|
+
import type { ReviewerVerdict, ReviewerRole, AgentKind as ReviewerAgentKind } from '../reviewer/types';
|
|
5
|
+
import type { PlannerDecision } from '../planner/types';
|
|
6
|
+
/**
|
|
7
|
+
* One assigned reviewer seat returned by `getInReviewAssignments`. Mirrors the
|
|
8
|
+
* engine `InReviewAssignment` serde (camelCase) in
|
|
9
|
+
* `codevibe-orchestration-lambda/src/types.rs::InReviewAssignment`.
|
|
10
|
+
*/
|
|
11
|
+
export interface InReviewAssignment {
|
|
12
|
+
/** Gate this assignment belongs to (UUID string). */
|
|
13
|
+
gateId: string;
|
|
14
|
+
/** NUMERIC seat-id (0-indexed). */
|
|
15
|
+
seatId: number;
|
|
16
|
+
/** snake_case reviewer lens. */
|
|
17
|
+
role: ReviewerRole;
|
|
18
|
+
/** Lowercase agent kind chosen by the resolver. */
|
|
19
|
+
agentKind: ReviewerAgentKind;
|
|
20
|
+
/** Round number of the gate (0-indexed). */
|
|
21
|
+
round: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* CP-12 W4 (#593) — one non-terminal team track returned by the team-dispatch
|
|
25
|
+
* recovery queries (`getTaskGroupTracks` / `getInFlightTeamTracks`). A DISTINCT
|
|
26
|
+
* recovery-row type — NOT an extension of the live `TrackAssignedPayload` (so the
|
|
27
|
+
* live Class B contract stays unpolluted). Mirrors the engine handler's camelCase
|
|
28
|
+
* `TeamTrackRecoveryRow` serde:
|
|
29
|
+
* - ALWAYS present: `taskGroupId`, `trackIndex`, `relaunch`, and `encryptedBrief?`
|
|
30
|
+
* (omitted when the track had no description → recovery treats it as an empty
|
|
31
|
+
* brief). `taskGroupId` is on EVERY row (seed-only too) so the desktop keys its
|
|
32
|
+
* recovered brief + corrupt-brief tombstone by `(taskGroupId, trackIndex)` —
|
|
33
|
+
* B.2 aggregates across groups, so a bare `trackIndex` key could cross-blend
|
|
34
|
+
* two groups (#593 Stage-2 r2 Codex MEDIUM).
|
|
35
|
+
* - ONLY when `relaunch === true` (flattened at top level): the full live
|
|
36
|
+
* `TrackAssigned` wire-field set (`taskId`, `implementorAgent`,
|
|
37
|
+
* `ownershipScope`, `isSharedTestOwner`, `stateDir`, `dispatchId`,
|
|
38
|
+
* `dispatchGeneration`, `conflictContext`) PLUS recovery metadata (`gateRunId`,
|
|
39
|
+
* `gateType`). These camelCase keys are byte-identical to the live
|
|
40
|
+
* `TrackAssigned` Class B packet, so `normalizeTrackAssignedWire(row)` accepts
|
|
41
|
+
* a relaunch row directly (it picks the expected keys and ignores the extras).
|
|
42
|
+
*
|
|
43
|
+
* Typed loosely (`unknown` payload past the always-present fields) because the
|
|
44
|
+
* relaunch keys are present-or-absent; the recovery loop runs the shared
|
|
45
|
+
* `normalizeTrackAssignedWire` + `isValidTrackAssignedPayload` validators on the
|
|
46
|
+
* raw row (never a divergent second validator), so the SDK does not re-type them.
|
|
47
|
+
*/
|
|
48
|
+
export interface TeamTrackRecoveryRow {
|
|
49
|
+
/**
|
|
50
|
+
* The owning task group's id — present on EVERY row (seed-only + relaunch) so
|
|
51
|
+
* recovered briefs + tombstones key by `(taskGroupId, trackIndex)` and B.2's
|
|
52
|
+
* cross-group aggregation can't collide on a shared `trackIndex` (#593 r2).
|
|
53
|
+
*/
|
|
54
|
+
taskGroupId: string;
|
|
55
|
+
trackIndex: number;
|
|
56
|
+
/** Bare base64 ciphertext; absent when the track had no description. */
|
|
57
|
+
encryptedBrief?: string;
|
|
58
|
+
relaunch: boolean;
|
|
59
|
+
/** The round-0 gate id (relaunch rows only) — read off the row by recovery. */
|
|
60
|
+
gateRunId?: string;
|
|
61
|
+
/** `"reviewer_quorum"` (relaunch rows only). */
|
|
62
|
+
gateType?: string;
|
|
63
|
+
/** The relaunch rows carry the full TrackAssigned wire field set (see above). */
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* PHASE-589/469 W3.1 (RESIDUAL 2 / #589-I) — the `getTaskGroupStatus` result. The
|
|
68
|
+
* group's authoritative TERMINAL status (the engine's snake_case
|
|
69
|
+
* `TaskGroupStatus` label, OR `"unknown"` for a vanished / unowned group) + the
|
|
70
|
+
* persisted halt reason (only on a `halted` group). Mirrors the engine
|
|
71
|
+
* `GetTaskGroupStatusOutput { taskGroupId, status, haltReason? }`. Used by the
|
|
72
|
+
* startup reconcile to drive the offline-lease-timeout auto-revert.
|
|
73
|
+
*/
|
|
74
|
+
export interface TaskGroupStatusResult {
|
|
75
|
+
taskGroupId: string;
|
|
76
|
+
status: string;
|
|
77
|
+
haltReason?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* PHASE-CP-1-F.1 Part A (LOCK L2) — tolerant `AWSJSON!` object read.
|
|
81
|
+
*
|
|
82
|
+
* AppSync delivers an `AWSJSON!` field to a consumer as EITHER an embedded
|
|
83
|
+
* object/array OR a (possibly double-encoded) JSON string — the producer
|
|
84
|
+
* stringifies the value into the field, and the delivery path may or may not
|
|
85
|
+
* re-wrap it. This mirrors the iOS normalization
|
|
86
|
+
* (`codevibe-ios/.../GraphQLClient.swift:1004-1009`).
|
|
87
|
+
*
|
|
88
|
+
* Coercion rules (the SINGLE AWSJSON object-read path for new nested-AWSJSON
|
|
89
|
+
* consumers):
|
|
90
|
+
* 1. `raw` is already a non-null, non-array object → use it directly.
|
|
91
|
+
* 2. `raw` is a string → `JSON.parse`. If the result is STILL a string
|
|
92
|
+
* (double-encoded) → `JSON.parse` ONCE more (bounded: at most one extra
|
|
93
|
+
* unwrap — a triple-encoded payload is treated as malformed).
|
|
94
|
+
* 3. The final value MUST be a non-null, non-array object → else throw
|
|
95
|
+
* (fail-closed; we never silently accept null/array/scalar).
|
|
96
|
+
*
|
|
97
|
+
* @param raw the AWSJSON field value off the GraphQL response
|
|
98
|
+
* @param op the operation name (for fail-closed error messages)
|
|
99
|
+
*/
|
|
100
|
+
export declare function coerceAwsJsonObject(raw: unknown, op: string): Record<string, unknown>;
|
|
101
|
+
/** Result of `getReviewerPrompt` — the DECRYPTED rendered prompt + seat metadata. */
|
|
102
|
+
export interface ReviewerPromptResult {
|
|
103
|
+
gateId: string;
|
|
104
|
+
seatId: number;
|
|
105
|
+
role: ReviewerRole;
|
|
106
|
+
/** Decrypted plaintext rendered prompt (UTF-8) → ReviewerSpec.prompt_template. */
|
|
107
|
+
prompt: string;
|
|
108
|
+
}
|
|
109
|
+
/** One reviewer seat in a round's `reviewers[]` (decrypted). */
|
|
110
|
+
export interface TaskReviewSummaryReviewer {
|
|
111
|
+
/** ReviewerVerdict.seat_id (0-indexed). */
|
|
112
|
+
seatId: number;
|
|
113
|
+
/** ReviewerRole serde (snake_case): architecture | correctness | … */
|
|
114
|
+
role: string;
|
|
115
|
+
/** AgentKind serde (lowercase): claude | codex | gemini. */
|
|
116
|
+
agent: string;
|
|
117
|
+
/** VerdictKind serde (UPPERCASE): APPROVE | REJECT | REVISE | ESCALATE. */
|
|
118
|
+
decision: string;
|
|
119
|
+
/** ReviewerVerdict.reasoning verbatim. */
|
|
120
|
+
reasoning: string;
|
|
121
|
+
/** ReviewerVerdict.suggested_changes (may be empty). */
|
|
122
|
+
suggestedChanges: string[];
|
|
123
|
+
}
|
|
124
|
+
/** One round in the per-round summary (decrypted). */
|
|
125
|
+
export interface TaskReviewSummaryRound {
|
|
126
|
+
/** gate_row.round_number (0-indexed). */
|
|
127
|
+
round: number;
|
|
128
|
+
/** Human-readable concat of problem/proposal/plan/expected-outputs. */
|
|
129
|
+
proposal: string;
|
|
130
|
+
/** Per-seat verdicts for this round. */
|
|
131
|
+
reviewers: TaskReviewSummaryReviewer[];
|
|
132
|
+
/** GateDecision serde: proceed | auto_revise | escalate. */
|
|
133
|
+
outcome: string;
|
|
134
|
+
/** Aggregated REVISE seat findings; present only when outcome==auto_revise. */
|
|
135
|
+
reviseNotes?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Result of `getTaskReviewSummary` — the DECRYPTED per-round review summary the
|
|
139
|
+
* desktop renders at the final-approval gate. Mirrors the engine's allowlist
|
|
140
|
+
* projection; `truncatedForSize`/`omittedRounds` flag the size-cap degrade.
|
|
141
|
+
*/
|
|
142
|
+
export interface TaskReviewSummary {
|
|
143
|
+
rounds: TaskReviewSummaryRound[];
|
|
144
|
+
/** The resolution that produced the final-approval prompt (normally proceed). */
|
|
145
|
+
finalOutcome: string;
|
|
146
|
+
/** True when the size cap forced any truncation/omission. */
|
|
147
|
+
truncatedForSize: boolean;
|
|
148
|
+
/** Count of whole oldest rounds dropped under the size cap (0 when none). */
|
|
149
|
+
omittedRounds: number;
|
|
150
|
+
}
|
|
151
|
+
/** Result of `getClassBSigningPublicKey` — the engine's Ed25519 verifier key. */
|
|
152
|
+
export interface ClassBSigningPublicKey {
|
|
153
|
+
/** Base64-encoded raw 32-byte Ed25519 public (verifying) key. */
|
|
154
|
+
publicKeyB64: string;
|
|
155
|
+
/** Rotation-aware key id (matches `signedEnvelope.publicKeyId`). */
|
|
156
|
+
keyId: string;
|
|
157
|
+
}
|
|
2
158
|
/**
|
|
3
159
|
* Download URL response
|
|
4
160
|
*/
|
|
@@ -6,16 +162,117 @@ export interface DownloadUrlResponse {
|
|
|
6
162
|
downloadUrl: string;
|
|
7
163
|
expiresAt: string;
|
|
8
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* CP-1.b IMPL r2 M-4 — Typed GraphQL error that preserves AppSync's
|
|
167
|
+
* `errorType` and `extensions` fields, alongside the human-readable
|
|
168
|
+
* `message`. Stage 2 r1's `graphqlRequest()` threw a plain
|
|
169
|
+
* `Error("GraphQL error: <message>")` and silently dropped
|
|
170
|
+
* `errorType`, which broke `BackendPlannerClient.classifyTransportError`
|
|
171
|
+
* (it discriminates on `err.errorType` to separate
|
|
172
|
+
* `BudgetExceeded` / `TierGateRejected` from provider-health failures).
|
|
173
|
+
*
|
|
174
|
+
* Callers may catch this class to inspect `errorType` directly. Code
|
|
175
|
+
* paths that still parse error.message will continue to work because
|
|
176
|
+
* the message is unchanged ("GraphQL error: <message>").
|
|
177
|
+
*/
|
|
178
|
+
export declare class AppSyncGraphQLError extends Error {
|
|
179
|
+
readonly errorType?: string;
|
|
180
|
+
readonly extensions?: unknown;
|
|
181
|
+
readonly path?: unknown;
|
|
182
|
+
constructor(opts: {
|
|
183
|
+
message: string;
|
|
184
|
+
errorType?: string;
|
|
185
|
+
extensions?: unknown;
|
|
186
|
+
path?: unknown;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* PHASE-CP-10-MIN (#585) §2.3 — the parsed cross-device applyUserDecision
|
|
191
|
+
* echo. Mirrors the quorum-core SDK's `UserDecisionAppliedEvent`
|
|
192
|
+
* (`quorum-core/src/types.ts:680`) + the backend `UserDecisionAppliedEvent`
|
|
193
|
+
* (`schema.graphql:1364-1371`): `decision` lowercase, `action` parsed to the
|
|
194
|
+
* typed `PostDecisionAction` via `coerceAwsJsonObject`.
|
|
195
|
+
*/
|
|
196
|
+
export interface UserDecisionAppliedEvent {
|
|
197
|
+
sessionId: string;
|
|
198
|
+
taskId: string;
|
|
199
|
+
gateId: string;
|
|
200
|
+
/** Lowercase `UserDecisionKind` string (the wire enum is SCREAMING_SNAKE; coerced to lowercase). */
|
|
201
|
+
decision: string;
|
|
202
|
+
/** The parsed `PostDecisionAction` (from the AWSJSON `payload`). */
|
|
203
|
+
action: PostDecisionAction;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* CP-1.f — decides whether a subscribed event should be delivered to the
|
|
207
|
+
* caller's `onEvent` callback.
|
|
208
|
+
*
|
|
209
|
+
* - Companion plugin path (`receiveDesktopEvents` falsy): deliver ONLY
|
|
210
|
+
* MOBILE-source events. The desktop plugin emits its own DESKTOP events and
|
|
211
|
+
* must NOT re-receive them (the 2026-04-14 duplicate-mobile-event fix).
|
|
212
|
+
* - Orchestration shell path (`receiveDesktopEvents` true): ALSO deliver
|
|
213
|
+
* DESKTOP-source events. Engine/backend emits gate prompts via the AppSync
|
|
214
|
+
* SigV4 branch, which stamps `source = DESKTOP` (`emittedBy = SYSTEM`); for
|
|
215
|
+
* an orchestration session those are the ONLY DESKTOP events (the shell
|
|
216
|
+
* originates none), so this is exactly the set of engine-emitted prompts the
|
|
217
|
+
* shell must render. MOBILE events (user messages from the phone) are still
|
|
218
|
+
* delivered in both modes.
|
|
219
|
+
*
|
|
220
|
+
* Pure function so the delivery rule is unit-testable independently of the
|
|
221
|
+
* WebSocket message plumbing.
|
|
222
|
+
*/
|
|
223
|
+
export declare function shouldDeliverSubscribedEvent(event: Pick<Event, 'source'>, receiveDesktopEvents: boolean): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Discriminator for the most recent `authenticateWithStoredTokens()`
|
|
226
|
+
* failure. Lets callers distinguish a genuine "no tokens / refresh
|
|
227
|
+
* rejected" outcome from a transient network failure during the
|
|
228
|
+
* Cognito refresh-token POST.
|
|
229
|
+
*
|
|
230
|
+
* Stage 2 round-1 Codex M1: the production refresh path returns
|
|
231
|
+
* `false` on every error (including network blow-ups inside
|
|
232
|
+
* `callCognitoRefresh`'s catch block), so the wizard's auth-vs-network
|
|
233
|
+
* heuristic — which only ran on caught throws — never fired in
|
|
234
|
+
* production. Recording the kind on every false-return path lets
|
|
235
|
+
* `setup-bootstrap.ts:defaultClientFactory()` route network-shaped
|
|
236
|
+
* refresh failures to `subscription_status_network` (per §6 row
|
|
237
|
+
* "transient 5xx during refresh") instead of misleading the user with
|
|
238
|
+
* a "not signed in" abort.
|
|
239
|
+
*/
|
|
240
|
+
export type AuthFailureKind = 'no_tokens' | 'refresh_auth_rejected' | 'refresh_network';
|
|
9
241
|
/**
|
|
10
242
|
* AppSync GraphQL client with WebSocket subscriptions
|
|
11
243
|
*/
|
|
12
244
|
export declare class AppSyncClient {
|
|
245
|
+
#private;
|
|
13
246
|
private authenticated;
|
|
14
247
|
private currentUserId;
|
|
15
248
|
private currentEmail;
|
|
16
249
|
private tokens;
|
|
17
250
|
private activeSubscriptions;
|
|
251
|
+
/**
|
|
252
|
+
* Set by `authenticateWithStoredTokens()` on every false-return path
|
|
253
|
+
* (and reset to `null` on success). Read by callers (e.g., the
|
|
254
|
+
* wizard's `defaultClientFactory`) to discriminate auth-rejection
|
|
255
|
+
* vs network-failure without re-running the auth call. Stage 2
|
|
256
|
+
* round-1 Codex M1.
|
|
257
|
+
*/
|
|
258
|
+
private lastAuthFailureKind;
|
|
259
|
+
/**
|
|
260
|
+
* Sentinel set inside `performRefresh` / `callCognitoRefresh` when
|
|
261
|
+
* the refresh round-trip fails with a network-shaped error (DNS,
|
|
262
|
+
* socket reset, fetch failed, 5xx). Reset to `false` at the start
|
|
263
|
+
* of each `performRefresh`. Read by `authenticateWithStoredTokens`
|
|
264
|
+
* to classify a `refreshTokens()=false` return as
|
|
265
|
+
* `refresh_network` vs `refresh_auth_rejected`. Internal — never
|
|
266
|
+
* exposed.
|
|
267
|
+
*/
|
|
268
|
+
private lastRefreshNetworkError;
|
|
269
|
+
private pendingRefresh;
|
|
270
|
+
private lastRefreshFailureAt;
|
|
271
|
+
private static readonly REFRESH_BACKOFF_MS;
|
|
18
272
|
private deviceKeyWatcher;
|
|
273
|
+
private sessionUpdateWatchers;
|
|
274
|
+
private applyUserDecisionWatchers;
|
|
275
|
+
private statusWriteChains;
|
|
19
276
|
private environment;
|
|
20
277
|
constructor();
|
|
21
278
|
/**
|
|
@@ -26,6 +283,30 @@ export declare class AppSyncClient {
|
|
|
26
283
|
* Get the current authenticated user email
|
|
27
284
|
*/
|
|
28
285
|
getCurrentUserEmail(): string | null;
|
|
286
|
+
/**
|
|
287
|
+
* Returns the kind of the most recent
|
|
288
|
+
* `authenticateWithStoredTokens()` failure, or `null` if the call
|
|
289
|
+
* succeeded (or has never been called).
|
|
290
|
+
*
|
|
291
|
+
* Stage 2 round-1 Codex M1. Callers (today: `setup-bootstrap.ts
|
|
292
|
+
* :defaultClientFactory`) use this to distinguish network blow-ups
|
|
293
|
+
* during the Cognito refresh-token POST from genuine auth
|
|
294
|
+
* rejections. The wizard maps `'refresh_network'` to
|
|
295
|
+
* `subscription_status_network` (don't tell a signed-in user to
|
|
296
|
+
* re-login when their tokens are valid and the network is broken)
|
|
297
|
+
* and the other two kinds to `not_signed_in` (preserves
|
|
298
|
+
* pre-Codex-M1 behavior).
|
|
299
|
+
*/
|
|
300
|
+
getLastAuthFailureKind(): AuthFailureKind | null;
|
|
301
|
+
/**
|
|
302
|
+
* Heuristic — does the error message look like a transient network
|
|
303
|
+
* failure rather than an auth-token rejection? Mirrors
|
|
304
|
+
* `setup-bootstrap.ts:isNetworkLikeError` byte-for-byte so the same
|
|
305
|
+
* classifier runs both inside the client (for refresh-path
|
|
306
|
+
* discrimination) and at the bootstrap boundary (for caught-throw
|
|
307
|
+
* routing). Stage 2 round-1 Codex M1.
|
|
308
|
+
*/
|
|
309
|
+
private static isNetworkLikeMessage;
|
|
29
310
|
/**
|
|
30
311
|
* Authenticate using stored OAuth tokens from keychain
|
|
31
312
|
*/
|
|
@@ -34,6 +315,47 @@ export declare class AppSyncClient {
|
|
|
34
315
|
* Refresh expired tokens
|
|
35
316
|
*/
|
|
36
317
|
private refreshTokens;
|
|
318
|
+
/**
|
|
319
|
+
* Do the work of refreshing tokens. Tries the caller-supplied tokens
|
|
320
|
+
* first; on failure, re-reads from storage and retries once with a
|
|
321
|
+
* potentially-fresher refresh token. This is the self-healing path
|
|
322
|
+
* that lets `codevibe login` (which writes new tokens to the
|
|
323
|
+
* keychain) recover running daemons without requiring a restart:
|
|
324
|
+
* the in-memory copy the daemon cached at boot may be invalid, but
|
|
325
|
+
* whatever the user just wrote from the login flow is still valid.
|
|
326
|
+
*
|
|
327
|
+
* Splitting the two attempts into a pure-network helper keeps the
|
|
328
|
+
* orchestration readable without duplicating the fetch + body-shape
|
|
329
|
+
* plumbing.
|
|
330
|
+
*/
|
|
331
|
+
private performRefresh;
|
|
332
|
+
/**
|
|
333
|
+
* POST to Cognito's /oauth2/token with a refresh_token grant.
|
|
334
|
+
* Returns the parsed body on 200, or null on any failure (network
|
|
335
|
+
* error, non-2xx response, JSON parse failure). Caller decides how
|
|
336
|
+
* to proceed — this helper is side-effect-free beyond logging.
|
|
337
|
+
*/
|
|
338
|
+
private callCognitoRefresh;
|
|
339
|
+
/**
|
|
340
|
+
* Apply a successful refresh response: update in-memory cache first,
|
|
341
|
+
* clear the backoff sentinel, then persist to storage. Success here
|
|
342
|
+
* is defined as "the process has usable fresh tokens in memory" —
|
|
343
|
+
* storage persistence is degraded-success, not a failure mode.
|
|
344
|
+
*
|
|
345
|
+
* Ordering matters. The API call to Cognito already succeeded, which
|
|
346
|
+
* means we hold valid access/id tokens right now. If we delayed the
|
|
347
|
+
* in-memory update until after persistence and the keychain write
|
|
348
|
+
* threw (keychain locked, disk full, file-backend permission error),
|
|
349
|
+
* we'd be stuck with stale-and-known-dead tokens in memory while
|
|
350
|
+
* holding valid fresh tokens in local scope that vanish at the end
|
|
351
|
+
* of this function. That would re-break both guarantees this hotfix
|
|
352
|
+
* makes: no-restart recovery becomes "restart required to escape
|
|
353
|
+
* the keychain-lock window," and backoff stays unarmed so the
|
|
354
|
+
* caller hot-loops against a working Cognito endpoint — R1's MEDIUM
|
|
355
|
+
* on round 1 of this review. Persistence-failure is loud-logged
|
|
356
|
+
* so operators can see degraded durability without losing availability.
|
|
357
|
+
*/
|
|
358
|
+
private applyRefreshedTokens;
|
|
37
359
|
/**
|
|
38
360
|
* Check if authenticated
|
|
39
361
|
*/
|
|
@@ -54,6 +376,7 @@ export declare class AppSyncClient {
|
|
|
54
376
|
* Update a session
|
|
55
377
|
*/
|
|
56
378
|
updateSession(input: UpdateSessionInput): Promise<Session>;
|
|
379
|
+
private doUpdateSession;
|
|
57
380
|
/**
|
|
58
381
|
* Get a session
|
|
59
382
|
*/
|
|
@@ -70,10 +393,69 @@ export declare class AppSyncClient {
|
|
|
70
393
|
* List events for a session
|
|
71
394
|
*/
|
|
72
395
|
listEvents(sessionId: string, source?: EventSource, limit?: number): Promise<Event[]>;
|
|
396
|
+
/**
|
|
397
|
+
* List the authenticated user's sessions. Paginates automatically
|
|
398
|
+
* via nextToken so callers always get the complete set.
|
|
399
|
+
*/
|
|
400
|
+
listSessions(limit?: number): Promise<Array<{
|
|
401
|
+
sessionId: string;
|
|
402
|
+
agentType: string;
|
|
403
|
+
status: string;
|
|
404
|
+
lastHeartbeatAt: string | null;
|
|
405
|
+
}>>;
|
|
406
|
+
/**
|
|
407
|
+
* Mark stale ACTIVE sessions of a given agentType INACTIVE so they
|
|
408
|
+
* stop appearing in the mobile app's session list. Called at daemon
|
|
409
|
+
* startup to clean up after daemons that died without running their
|
|
410
|
+
* graceful shutdown (crash, auth-loop death, force-kill, power loss).
|
|
411
|
+
*
|
|
412
|
+
* Staleness rule: lastHeartbeatAt is older than `staleThresholdMs`
|
|
413
|
+
* (default 15 min — a conservative ~7.5× the 2-min heartbeat
|
|
414
|
+
* interval, giving legitimately-active daemons on other machines
|
|
415
|
+
* ample margin before we consider their session abandoned).
|
|
416
|
+
*
|
|
417
|
+
* Safety:
|
|
418
|
+
* - Only sessions with status === 'ACTIVE' are candidates.
|
|
419
|
+
* - Sessions explicitly listed in `excludeSessionIds` are skipped
|
|
420
|
+
* (caller can pass the session the daemon is about to attach to
|
|
421
|
+
* if the ID is known before the sweep).
|
|
422
|
+
* - Absent `lastHeartbeatAt` (never-heartbeated sessions — should
|
|
423
|
+
* only happen for rows created within the last few seconds)
|
|
424
|
+
* treats the session as fresh and skips.
|
|
425
|
+
* - updateSession failures are logged as warnings and don't abort
|
|
426
|
+
* the sweep — best-effort cleanup.
|
|
427
|
+
*
|
|
428
|
+
* Returns the number of sessions actually marked INACTIVE.
|
|
429
|
+
*/
|
|
430
|
+
sweepOrphanSessions(opts: {
|
|
431
|
+
agentType: string;
|
|
432
|
+
staleThresholdMs?: number;
|
|
433
|
+
excludeSessionIds?: string[];
|
|
434
|
+
}): Promise<number>;
|
|
73
435
|
/**
|
|
74
436
|
* List user device keys
|
|
75
437
|
*/
|
|
76
438
|
listUserDeviceKeys(): Promise<DeviceKey[]>;
|
|
439
|
+
/**
|
|
440
|
+
* CP-1.b IMPL r4 H-2 — list BACKEND_SERVICE device keys per design
|
|
441
|
+
* §4.9 schema delta bullet 5 + §6.1 service-device flow.
|
|
442
|
+
*
|
|
443
|
+
* Returns every device row with `kind = BACKEND_SERVICE` regardless of
|
|
444
|
+
* the caller's `userId` (the only such row in CP-1.b is the
|
|
445
|
+
* planner-proxy's ECDH P-256 keypair under `deviceId =
|
|
446
|
+
* planner-proxy-{env}`). Callers union this list with
|
|
447
|
+
* `listUserDeviceKeys()` when minting `encryptedKeys[]` for new
|
|
448
|
+
* sessions so the planner-proxy Lambda can decrypt session-bound
|
|
449
|
+
* payloads via ECDH+HKDF against its own private key.
|
|
450
|
+
*
|
|
451
|
+
* The backend resolver is auth-mode widened (`@aws_cognito_user_pools
|
|
452
|
+
* @aws_iam`) — Cognito callers query for the planner-proxy public key
|
|
453
|
+
* at session-creation time; IAM callers (planner-proxy bootstrap) may
|
|
454
|
+
* also call. The CDK-backed GSI `kind-deviceId-index` partitions the
|
|
455
|
+
* device-keys table by `kind`, so this is a single GSI query, not a
|
|
456
|
+
* full scan.
|
|
457
|
+
*/
|
|
458
|
+
listServiceDeviceKeys(): Promise<DeviceKey[]>;
|
|
77
459
|
/**
|
|
78
460
|
* Register device key
|
|
79
461
|
*/
|
|
@@ -99,8 +481,27 @@ export declare class AppSyncClient {
|
|
|
99
481
|
* (`CLAUDE` / `GEMINI` / `CODEX`). Idempotent — safe to call every
|
|
100
482
|
* launch. Backend stores in `User.availableAgents`; used later to
|
|
101
483
|
* derive tier-default reviewer seat assignments.
|
|
484
|
+
*
|
|
485
|
+
* CP-1.f LOCK RP-3 — `replace` semantics. Default `false` keeps the 1.x
|
|
486
|
+
* companion-daemon UNION contract (the backend merges the input into the
|
|
487
|
+
* cross-device set). The orchestration shell passes `true` so the
|
|
488
|
+
* backend SETs `availableAgents` to exactly the input set (REPLACE),
|
|
489
|
+
* dropping any stale agent (e.g. a `GEMINI` from a prior host that would
|
|
490
|
+
* otherwise be composed into the reviewer panel → `spawn gemini ENOENT`).
|
|
102
491
|
*/
|
|
103
|
-
updateAvailableAgents(agents: Array<'CLAUDE' | 'GEMINI' | 'CODEX'
|
|
492
|
+
updateAvailableAgents(agents: Array<'CLAUDE' | 'GEMINI' | 'CODEX' | 'ANTIGRAVITY'>, replace?: boolean): Promise<UserReviewerPolicySnapshot>;
|
|
493
|
+
/**
|
|
494
|
+
* CP-5.c — push the per-agent capability snapshot. Dual-write
|
|
495
|
+
* alongside `updateAvailableAgents` per LOCK #C5-C-4 (the legacy
|
|
496
|
+
* field stays for V1 client backward compat; this surface carries
|
|
497
|
+
* the full 9-field record per AgentKind).
|
|
498
|
+
*
|
|
499
|
+
* `capabilities` is serialized to JSON before transit (AppSync
|
|
500
|
+
* accepts `AWSJSON` as a stringified payload). Backend Lambda
|
|
501
|
+
* persists to `Users.adapterCapabilities` and returns the updated
|
|
502
|
+
* User row.
|
|
503
|
+
*/
|
|
504
|
+
updateAdapterCapabilities(capabilities: unknown[]): Promise<UserReviewerPolicySnapshot>;
|
|
104
505
|
/**
|
|
105
506
|
* Persist the user's orchestration opt-in default and/or custom
|
|
106
507
|
* reviewer panel. Backend validates seat-count against tier, seat_id
|
|
@@ -109,12 +510,440 @@ export declare class AppSyncClient {
|
|
|
109
510
|
* configure-reviewers wizard).
|
|
110
511
|
*/
|
|
111
512
|
updateReviewerPolicy(input: UpdateReviewerPolicyInput): Promise<UserReviewerPolicySnapshot>;
|
|
513
|
+
/**
|
|
514
|
+
* Fetch the user's subscription tier + status. Used by the Phase 3.a
|
|
515
|
+
* setup wizard (#190) at bootstrap to gate Free → upgrade interstitial
|
|
516
|
+
* and to size the seat budget (Pro=2, Max=3).
|
|
517
|
+
*
|
|
518
|
+
* Backend resolver returns a default FREE row when the user has no
|
|
519
|
+
* Users-table entry yet (Lambda resolver — lambda/subscription/index.ts).
|
|
520
|
+
* Network failure / auth expiry surface as graphqlRequest exceptions.
|
|
521
|
+
*/
|
|
522
|
+
getSubscriptionStatus(): Promise<{
|
|
523
|
+
tier: 'FREE' | 'PRO' | 'MAX';
|
|
524
|
+
status: 'ACTIVE' | 'EXPIRED' | 'GRACE_PERIOD' | 'BILLING_RETRY';
|
|
525
|
+
expiresAt: string | null;
|
|
526
|
+
}>;
|
|
527
|
+
/**
|
|
528
|
+
* CP-1.b IMPL r4 H-1 — `classifyPlannerPrompt` AppSync mutation.
|
|
529
|
+
*
|
|
530
|
+
* Implements `PlannerAppSyncTransport.classifyPlannerPrompt` from
|
|
531
|
+
* `codevibe-core/src/planner/client.ts`. Encrypted-input wire shape
|
|
532
|
+
* is locked at design §4.10 + §4.11: `prompt` is raw base64 AES-GCM
|
|
533
|
+
* ciphertext under the session key; `clarifications`, `sessionContext`,
|
|
534
|
+
* `budgetHint` are AWSJSON envelope strings of the form
|
|
535
|
+
* `'{"encrypted":"<base64 ciphertext>"}'`. Response `decision` is RAW
|
|
536
|
+
* base64 ciphertext (NOT envelope-wrapped) per LOCK #27.
|
|
537
|
+
*
|
|
538
|
+
* Typed errors (`BudgetExceeded`, `TierGateRejected`, etc.) surface
|
|
539
|
+
* via `AppSyncGraphQLError.errorType` so the planner client can
|
|
540
|
+
* discriminate policy events from provider-health failures per
|
|
541
|
+
* Stage 2 r2 M-3.
|
|
542
|
+
*/
|
|
543
|
+
classifyPlannerPrompt(input: {
|
|
544
|
+
sessionId: string;
|
|
545
|
+
prompt: string;
|
|
546
|
+
clarifications: string;
|
|
547
|
+
sessionContext: string;
|
|
548
|
+
budgetHint: string;
|
|
549
|
+
}): Promise<{
|
|
550
|
+
decision: string;
|
|
551
|
+
cacheHit: boolean;
|
|
552
|
+
cacheKind: string | null;
|
|
553
|
+
serverLatencyMs: number;
|
|
554
|
+
providerUsed: string;
|
|
555
|
+
}>;
|
|
556
|
+
/**
|
|
557
|
+
* CP-1.b IMPL r4 H-1 — `pingPlanner` AppSync mutation.
|
|
558
|
+
*
|
|
559
|
+
* Implements `PlannerAppSyncTransport.pingPlanner`. Separate mutation
|
|
560
|
+
* from `classifyPlannerPrompt` per Stage A LOCK #31. Input carries
|
|
561
|
+
* only `sessionId` (no encryption, no clarifications, no budgetHint).
|
|
562
|
+
* Response shape `{ ok, ms }` ONLY (no `providerHealthState` —
|
|
563
|
+
* shell-side `PlannerHealthMachine` is the sole authority).
|
|
564
|
+
*/
|
|
565
|
+
pingPlanner(input: {
|
|
566
|
+
sessionId: string;
|
|
567
|
+
}): Promise<{
|
|
568
|
+
ok: boolean;
|
|
569
|
+
ms: number;
|
|
570
|
+
}>;
|
|
571
|
+
/**
|
|
572
|
+
* CP-8 min Stage 1 R1 HIGH-1 closure (Hendry-approved 2026-05-19).
|
|
573
|
+
*
|
|
574
|
+
* Submits an orchestration gate-prompt decision (Path A FinalApproval
|
|
575
|
+
* or Path B Halted-resolution) to the engine and returns the typed
|
|
576
|
+
* `PostDecisionAction` reply.
|
|
577
|
+
*
|
|
578
|
+
* **Implementation deviation from `PHASE-CP-8-MIN-DESIGN.md` #C8M-6
|
|
579
|
+
* literal wording:** the design says "use `@quantiya/quorum-core`'s
|
|
580
|
+
* `applyUserDecision` SDK method." codevibe-core deliberately does
|
|
581
|
+
* NOT depend on `@quantiya/quorum-core` at runtime — see the
|
|
582
|
+
* structural-typing pattern at `src/orchestration/v1-options.ts:44-47`.
|
|
583
|
+
* The locked INVARIANT of #C8M-6 ("single typed transport surface,
|
|
584
|
+
* no direct GraphQL in the orchestration-shell tree") is honored by
|
|
585
|
+
* exposing this method here on codevibe-core's own AppSyncClient,
|
|
586
|
+
* which is THE desktop-side transport surface. Shape mirrors the
|
|
587
|
+
* quorum-core SDK at `client.ts:464-504` byte-for-byte:
|
|
588
|
+
* - Wraps `notes` (when present) in `EncryptedPayloadInput`
|
|
589
|
+
* (AES-256-GCM under the session key, base64 ciphertext +
|
|
590
|
+
* `sessionId` + `keyVersion`).
|
|
591
|
+
* - Uppercases `decision` to UPPER_SNAKE wire enum (matches the
|
|
592
|
+
* SDK's `toWireEnum` pattern).
|
|
593
|
+
* - Parses the `payload` AWSJSON string to the 4-variant
|
|
594
|
+
* `PostDecisionAction` discriminated union.
|
|
595
|
+
*
|
|
596
|
+
* See `PHASE-CP-8-MIN-DESIGN.md` §4 #C8M-6 deviation footer for the
|
|
597
|
+
* sealed rationale.
|
|
598
|
+
*
|
|
599
|
+
* @param input Caller passes the lowercase TS `decision` kind (one of
|
|
600
|
+
* the 7 `UserDecisionKind` values). Encoding to wire
|
|
601
|
+
* UPPER_SNAKE happens here.
|
|
602
|
+
* @param sessionKeyBase64 Optional. REQUIRED only when `input.notes`
|
|
603
|
+
* is provided — used to AES-GCM-encrypt the notes plaintext
|
|
604
|
+
* under the session key. When `notes` is undefined, this
|
|
605
|
+
* parameter is ignored.
|
|
606
|
+
* @returns Parsed `{ decision, postAction }` per the engine's reply.
|
|
607
|
+
* `decision` is echoed in lowercase TS form for caller
|
|
608
|
+
* ergonomics (e.g. dispatcher routing without re-mapping the
|
|
609
|
+
* UPPER_SNAKE wire value).
|
|
610
|
+
*/
|
|
611
|
+
applyUserDecision(input: {
|
|
612
|
+
gateId: string;
|
|
613
|
+
taskId: string;
|
|
614
|
+
sessionId: string;
|
|
615
|
+
currentRound: number;
|
|
616
|
+
decision: string;
|
|
617
|
+
notes?: string;
|
|
618
|
+
}, sessionKeyBase64?: string): Promise<{
|
|
619
|
+
decision: string;
|
|
620
|
+
postAction: PostDecisionAction;
|
|
621
|
+
}>;
|
|
622
|
+
/**
|
|
623
|
+
* CP-12 §2.1 — create a task group. The server validates disjointness
|
|
624
|
+
* (#C12-2) BEFORE creating any track and returns the
|
|
625
|
+
* `CreateTaskGroupResult` discriminated union (accepted arm with
|
|
626
|
+
* `taskGroupId` + `dispatchedTracks`, or rejected arm with `rejection`).
|
|
627
|
+
*
|
|
628
|
+
* The mutation returns `AWSJSON!` (a stringified JSON value), so the
|
|
629
|
+
* response field is a JSON string parsed here — identical AWSJSON handling
|
|
630
|
+
* to `applyUserDecision` + `recordExecutionEvent`. Validates the input
|
|
631
|
+
* minimally (mirrors the `applyUserDecision` pattern) and surfaces backend
|
|
632
|
+
* rejections as `AppSyncGraphQLError` (thrown by `graphqlRequest`).
|
|
633
|
+
*
|
|
634
|
+
* W2.a ships the SDK surface; the N-track spawn / scheduler wiring that
|
|
635
|
+
* consumes the result is W2.b.
|
|
636
|
+
*/
|
|
637
|
+
createTaskGroup(input: CreateTaskGroupInput): Promise<CreateTaskGroupResult>;
|
|
638
|
+
/**
|
|
639
|
+
* CP-12 §2.1 / #C12-8 — submit a MergeGate verdict. The `classification`
|
|
640
|
+
* carries the LE-signed, server-readable structural metadata (the server
|
|
641
|
+
* verifies `classification.signatureB64` against the LE's Class A key
|
|
642
|
+
* before routing); `detail` is the E2E-encrypted human-readable payload.
|
|
643
|
+
* Idempotent replay on `verdictIdempotencyKey`.
|
|
644
|
+
*
|
|
645
|
+
* The mutation returns `AWSJSON!` (the resolved-outcome union as a
|
|
646
|
+
* stringified JSON value); parsed here like `createTaskGroup`. The caller
|
|
647
|
+
* is responsible for building + signing the classification (W2.b builds the
|
|
648
|
+
* real classification; the signing helper is `signMergeClassification` in
|
|
649
|
+
* `local-executor/class-a-sign.ts`). W2.a ships the SDK surface only.
|
|
650
|
+
*/
|
|
651
|
+
submitMergeGateVerdict(input: SubmitMergeGateVerdictInput): Promise<SubmitMergeGateVerdictResult>;
|
|
652
|
+
/**
|
|
653
|
+
* PHASE-589/469 W1 (LOCK #589-F) — report that ONE team track HARD-FAILED
|
|
654
|
+
* its own local gate (a declared-test failure or an out-of-scope write). The
|
|
655
|
+
* engine marks the track `Failed` NOW so its existing scheduler drain +
|
|
656
|
+
* group-escalation resolves the group promptly (instead of the slow lease
|
|
657
|
+
* sweeper, with the wrong "timeout" reason). The marker carries NO proposal
|
|
658
|
+
* and MUST NOT fan out to reviewers (#598's guarantee). `outcome` is the
|
|
659
|
+
* CONTENT-FREE closed reason label — NEVER raw test output.
|
|
660
|
+
*
|
|
661
|
+
* The mutation returns `AWSJSON!` (`{ trackState }` as a stringified JSON
|
|
662
|
+
* value); parsed here like `submitMergeGateVerdict`. The desktop caller
|
|
663
|
+
* treats this as BEST-EFFORT (W1): it does not depend on the return to
|
|
664
|
+
* render — it flips its own track + renders the group-terminal from local
|
|
665
|
+
* state; the engine lease sweeper is the backstop if the call fails.
|
|
666
|
+
*/
|
|
667
|
+
submitTrackVerificationOutcome(input: SubmitTrackVerificationOutcomeInput): Promise<SubmitTrackVerificationOutcomeResult>;
|
|
668
|
+
/**
|
|
669
|
+
* PHASE-589/469 W3.2 — `claimGroupDecision` two-phase group-escalation resolve
|
|
670
|
+
* (LOCK #589-J). Mirror of `submitTrackVerificationOutcome`'s AWSJSON
|
|
671
|
+
* passthrough shape. CLAIM (`phase:"claim"`) atomically locks the group to the
|
|
672
|
+
* first acting surface; COMMIT (`phase:"commit"`, echoing the CLAIM's
|
|
673
|
+
* `claimToken`) drives the group terminal AFTER the desktop revert side-effect.
|
|
674
|
+
* The optional `*_WITH_NOTES` `notes` ride E2E-encrypted (the engine never
|
|
675
|
+
* decrypts them); they are encrypted by the caller before reaching here.
|
|
676
|
+
*/
|
|
677
|
+
claimGroupDecision(input: ClaimGroupDecisionInput, sessionKeyBase64?: string): Promise<ClaimGroupDecisionResult>;
|
|
678
|
+
/**
|
|
679
|
+
* §3.A.1 / §3.C.20 — drive the engine Idle → GatePlanInFlight transition.
|
|
680
|
+
* The planner's `start_task` decision (action + optional gateRequest) is
|
|
681
|
+
* plaintext on the wire (no E2E-sensitive prose beyond the opaque
|
|
682
|
+
* gateRequest blob). Returns the resulting workflow-state label so the
|
|
683
|
+
* caller can confirm the engine spawned a gate plan.
|
|
684
|
+
*
|
|
685
|
+
* CP-1.f LOCK RP-6 — `availableAgents` carries THIS orchestration host's
|
|
686
|
+
* detected coding agents (UPPERCASE `CLAUDE` / `CODEX` / `GEMINI`) so the
|
|
687
|
+
* gate row's availability is stamped race-free from the request, instead
|
|
688
|
+
* of the engine reading the shared per-user `User.availableAgents` field
|
|
689
|
+
* (which a legacy 1.x companion daemon on another device can union a
|
|
690
|
+
* stale agent back into). The `Some([])` vs absent distinction is
|
|
691
|
+
* load-bearing engine-side: pass `[]` (a definitive "nothing detected" →
|
|
692
|
+
* Claude-only fail-safe) rather than omitting the field. The field rides
|
|
693
|
+
* inside `$input` (the `StartTaskInput!` GraphQL type gained
|
|
694
|
+
* `availableAgents: [String]`); the mutation document is unchanged. When
|
|
695
|
+
* `availableAgents` is `undefined` the field is omitted entirely (an
|
|
696
|
+
* older desktop's behavior → engine Users-table fallback).
|
|
697
|
+
*/
|
|
698
|
+
startTask(input: {
|
|
699
|
+
taskId: string;
|
|
700
|
+
sessionId: string;
|
|
701
|
+
decision: PlannerDecision;
|
|
702
|
+
availableAgents?: string[];
|
|
703
|
+
}): Promise<{
|
|
704
|
+
workflowState: string;
|
|
705
|
+
}>;
|
|
706
|
+
/**
|
|
707
|
+
* §3.A.3 / §3.C.20 / §3.C.23 — submit the E2E-encrypted implementor proposal
|
|
708
|
+
* for the in-flight gate (round-0 startTask gate OR a round-N+1 revise gate).
|
|
709
|
+
* `rawOutput` is the primary-agent raw output the engine parses + renders.
|
|
710
|
+
* Returns `{ gateId, workflowState }`.
|
|
711
|
+
*/
|
|
712
|
+
submitImplementorOutput(input: {
|
|
713
|
+
taskId: string;
|
|
714
|
+
gateId: string;
|
|
715
|
+
sessionId: string;
|
|
716
|
+
roundNumber: number;
|
|
717
|
+
rawOutput: string;
|
|
718
|
+
}, sessionKeyBase64: string): Promise<{
|
|
719
|
+
gateId: string;
|
|
720
|
+
workflowState: string;
|
|
721
|
+
}>;
|
|
722
|
+
/**
|
|
723
|
+
* §3.C.22 — submit one reviewer seat's verdict. The full `ReviewerVerdict`
|
|
724
|
+
* JSON is E2E-encrypted under the session key (#C1F-6). Returns the parsed
|
|
725
|
+
* `GateResolvedEvent.payload` (the discriminated `SubmitReviewerVerdictOutput`
|
|
726
|
+
* — `acknowledged` for seats 1..N-1, `reviewGateResolved` for the last seat).
|
|
727
|
+
*/
|
|
728
|
+
submitReviewerVerdict(input: {
|
|
729
|
+
gateId: string;
|
|
730
|
+
sessionId: string;
|
|
731
|
+
seatId: number;
|
|
732
|
+
verdict: ReviewerVerdict;
|
|
733
|
+
}, sessionKeyBase64: string): Promise<unknown>;
|
|
734
|
+
/**
|
|
735
|
+
* §3.A.7 / §3.C.21 — fetch + DECRYPT the engine-rendered reviewer prompt for
|
|
736
|
+
* one seat. `seatId` is the NUMERIC seat (the caller extracts it from the
|
|
737
|
+
* dispatch packet's resolved seat-id string). The engine returns an
|
|
738
|
+
* `EncryptedPayload` (inline-nonce ciphertext of the raw prompt bytes); this
|
|
739
|
+
* decrypts it under the session key → plaintext prompt for the ReviewerSpec.
|
|
740
|
+
*
|
|
741
|
+
* Throws (NotFound surfaced as a GraphQL error) when the pending handle
|
|
742
|
+
* hasn't propagated yet — the caller retries-with-backoff then fail-closed
|
|
743
|
+
* synthesizes ESCALATE (#C1F-8).
|
|
744
|
+
*/
|
|
745
|
+
getReviewerPrompt(gateId: string, seatId: number, sessionKeyBase64: string): Promise<ReviewerPromptResult>;
|
|
746
|
+
/**
|
|
747
|
+
* PHASE-CP-1-F.1 Part B (LOCK L3/L6) — fetch + DECRYPT the per-round review
|
|
748
|
+
* summary for a final-approval gate. `gateId` is the final-approval prompt's
|
|
749
|
+
* gateId (the HEAD of the proposal-gate `revision_of` lineage); `taskId` is
|
|
750
|
+
* the auth/scoping anchor. The engine walks the lineage backward, projects an
|
|
751
|
+
* exhaustive allowlist over each round, and returns the E2E-encrypted summary
|
|
752
|
+
* re-keyed for the session.
|
|
753
|
+
*
|
|
754
|
+
* Wire (bare `AWSJSON!`, read via the SAME tolerant `coerceAwsJsonObject` as
|
|
755
|
+
* Part A): `{ taskId, sessionId, summary: { ciphertextB64, sessionId,
|
|
756
|
+
* keyVersion } }`. `summary` is the DEDICATED `TaskReviewSummaryEnvelope`
|
|
757
|
+
* (inline-nonce AES-256-GCM; the 12-byte nonce is prepended INSIDE
|
|
758
|
+
* `ciphertextB64`, NO separate nonce field) — decrypt with
|
|
759
|
+
* `cryptoService.decryptContent` (NOT decryptMetadata), identical to
|
|
760
|
+
* `getReviewerPrompt`. The decrypted plaintext is the §2.3 `{rounds,
|
|
761
|
+
* finalOutcome, …}` object.
|
|
762
|
+
*
|
|
763
|
+
* Throws on a missing/malformed envelope or a decrypt/parse failure — the
|
|
764
|
+
* caller (the base-first dispatch in `orchestration-shell/index.ts`) catches
|
|
765
|
+
* every throw and fails OPEN (the prompt renders with no panel, never
|
|
766
|
+
* ciphertext).
|
|
767
|
+
*/
|
|
768
|
+
getTaskReviewSummary(taskId: string, gateId: string, sessionKeyBase64: string): Promise<TaskReviewSummary>;
|
|
769
|
+
/**
|
|
770
|
+
* §3.B.15 / §3.C.18 — fetch the engine's Ed25519 Class-B signing PUBLIC key
|
|
771
|
+
* + rotation-aware keyId. The desktop caches this and verifies every Class B
|
|
772
|
+
* packet's signature against it (fail-closed). No E2E — a public verifier
|
|
773
|
+
* key.
|
|
774
|
+
*/
|
|
775
|
+
getClassBSigningPublicKey(): Promise<ClassBSigningPublicKey>;
|
|
776
|
+
/**
|
|
777
|
+
* §3.B.15 / §3.C.21b — the dropped-packet recovery primitive. Returns every
|
|
778
|
+
* seat assigned to the caller across any `in_review` gate of the task; the
|
|
779
|
+
* desktop spawns any seat NOT already running-in-memory or verdict-submitted.
|
|
780
|
+
*/
|
|
781
|
+
getInReviewAssignments(taskId: string): Promise<InReviewAssignment[]>;
|
|
782
|
+
/**
|
|
783
|
+
* CP-12 W4 (#593) B.1 — strong (`ConsistentRead`) read of the just-created
|
|
784
|
+
* team group's in-flight tracks. The desktop knows the `taskGroupId`
|
|
785
|
+
* `createTaskGroup` just returned, so this is the deterministic initial-connect
|
|
786
|
+
* recovery for the proven emit-before-subscribe race (no GSI, no eventual
|
|
787
|
+
* consistency). Returns every NON-terminal track as a `TeamTrackRecoveryRow`;
|
|
788
|
+
* the desktop seeds all briefs (PASS 1) and re-launches the relaunch subset
|
|
789
|
+
* (PASS 2). Mirrors `getInReviewAssignments` (`{ tracks: [...] }` wrapper).
|
|
790
|
+
*/
|
|
791
|
+
getTaskGroupTracks(taskGroupId: string): Promise<TeamTrackRecoveryRow[]>;
|
|
792
|
+
/**
|
|
793
|
+
* CP-12 W4 (#593) B.2 — discover the caller's in-flight team tracks across
|
|
794
|
+
* UNKNOWN groups (restart / reconnect), via the `session_id-status-index` GSI.
|
|
795
|
+
* The desktop has no remembered `taskGroupId` after a restart, so B.1 cannot
|
|
796
|
+
* fire; this is the only path that recovers a team interrupted by a process
|
|
797
|
+
* restart. Eventual-consistency on the GSI is acceptable (a bounded retry
|
|
798
|
+
* covers propagation, §4.2); the handler always re-reads the authoritative
|
|
799
|
+
* `tg#{group}` row with a `ConsistentRead` before deciding `relaunch`. Returns
|
|
800
|
+
* every NON-terminal track as a `TeamTrackRecoveryRow` (same wrapper).
|
|
801
|
+
*/
|
|
802
|
+
getInFlightTeamTracks(sessionId: string): Promise<TeamTrackRecoveryRow[]>;
|
|
803
|
+
/**
|
|
804
|
+
* PHASE-589/469 W3.1 (RESIDUAL 2 / #589-I) — read a team group's authoritative
|
|
805
|
+
* TERMINAL status + halt reason for the startup reconcile. The recovery queries
|
|
806
|
+
* above only surface IN-FLIGHT tracks, so they cannot distinguish a `complete`
|
|
807
|
+
* (kept) group from a `halted` (rejected — incl. a sweeper-driven lease-timeout
|
|
808
|
+
* the desktop MISSED while offline) from a TTL'd one. This reads the group row's
|
|
809
|
+
* status directly so the reconcile can auto-revert a terminal-rejected-but-
|
|
810
|
+
* locally-dirty tree before a backend expiry strands it. CONTENT-FREE (status +
|
|
811
|
+
* halt-reason label only; no decrypt). A vanished / unowned group fails closed
|
|
812
|
+
* server-side to `status: "unknown"`. Mirrors `getTaskGroupTracks` (a top-level
|
|
813
|
+
* `taskGroupId` arg; returns the bare AWSJSON object).
|
|
814
|
+
*/
|
|
815
|
+
getTaskGroupStatus(taskGroupId: string): Promise<TaskGroupStatusResult>;
|
|
816
|
+
/**
|
|
817
|
+
* CP-6 LOCK #C6-A-10.4.10.2 — record an LE-written continuation
|
|
818
|
+
* packet's authoritative hash on the backend audit table. Called
|
|
819
|
+
* DIRECTLY by `createContinuationPacketWriter` after the atomic
|
|
820
|
+
* packet write completes; NOT routed through `emitShellEvent` (per
|
|
821
|
+
* §11 row 25).
|
|
822
|
+
*
|
|
823
|
+
* Wire-form per `RecordContinuationPacketWrittenInput`
|
|
824
|
+
* (`schema.graphql:1086-1093`):
|
|
825
|
+
* - `taskId`: ULID/UUID
|
|
826
|
+
* - `offerId`: nullable ULID (None for LE-initiated writes)
|
|
827
|
+
* - `packetHash`: 64-char lowercase hex SHA-256
|
|
828
|
+
* - `packetRelativePath`: relative to `~/.codevibe/tasks/`
|
|
829
|
+
* - `sourceAgent`: CLAUDE | CODEX | GEMINI | ANTIGRAVITY (all four
|
|
830
|
+
* accepted by the Rust handler as of AGY-2.0 Phase C)
|
|
831
|
+
* - `blockedReason`: §6:827 wire value
|
|
832
|
+
* (`quota_exhausted | auth_failed | timeout | user_requested`)
|
|
833
|
+
*
|
|
834
|
+
* Returns the design-locked discriminated union:
|
|
835
|
+
* - `{ kind: 'ok', auditEventId, alreadyExists }` on success
|
|
836
|
+
* - `{ kind: 'error', reason }` on any GraphQL error
|
|
837
|
+
*
|
|
838
|
+
* Does NOT throw — every failure surfaces as `{ kind: 'error' }`.
|
|
839
|
+
* The writer's F-GY-3 contract unlinks the local packet ONLY when
|
|
840
|
+
* this method returns `{ kind: 'error' }`.
|
|
841
|
+
*/
|
|
842
|
+
recordContinuationPacketWritten(input: {
|
|
843
|
+
taskId: string;
|
|
844
|
+
offerId: string | null;
|
|
845
|
+
packetHash: string;
|
|
846
|
+
packetRelativePath: string;
|
|
847
|
+
sourceAgent: 'CLAUDE' | 'CODEX' | 'GEMINI' | 'ANTIGRAVITY';
|
|
848
|
+
blockedReason: 'quota_exhausted' | 'auth_failed' | 'timeout' | 'user_requested';
|
|
849
|
+
/**
|
|
850
|
+
* PHASE-CP-10-MIN (#585) M-B — the additive `gateId: ID` input. The
|
|
851
|
+
* handler `fetch_row`s it, cross-checks `gate_row.task_id == input.task_id`,
|
|
852
|
+
* stamps `handoff_pending` (#C10M-14), and emits the handoff prompt for it.
|
|
853
|
+
* Optional (the Rust DTO is `#[serde(default)] gate_id: Option<Uuid>`);
|
|
854
|
+
* required at the handler for #585's two triggers. The mutation passes
|
|
855
|
+
* `{ input }` directly, so the additive field rides without a query change.
|
|
856
|
+
*/
|
|
857
|
+
gateId?: string;
|
|
858
|
+
}): Promise<{
|
|
859
|
+
kind: 'ok';
|
|
860
|
+
auditEventId: string;
|
|
861
|
+
alreadyExists: boolean;
|
|
862
|
+
} | {
|
|
863
|
+
kind: 'error';
|
|
864
|
+
reason: string;
|
|
865
|
+
}>;
|
|
866
|
+
/**
|
|
867
|
+
* CP-6 Stage 2 R1 H-1 fix — dedicated existence-check for the
|
|
868
|
+
* `continuation_packet_written` audit row. Replaces the legacy
|
|
869
|
+
* `queryAudit` usage in `packet-reader.ts` which was incompatible
|
|
870
|
+
* with the real backend audit shape (entries[].payload is encrypted,
|
|
871
|
+
* so the reader cannot extract `packet_hash` from the payload to
|
|
872
|
+
* verify F-GY-3).
|
|
873
|
+
*
|
|
874
|
+
* The backend handler computes the dedup_key from the public
|
|
875
|
+
* `(taskId, packetHash)` pair via the same
|
|
876
|
+
* `continuation_packet_written_key` formula used at write time,
|
|
877
|
+
* then does a single DDB point-read on the audit dedup table.
|
|
878
|
+
*
|
|
879
|
+
* Returns the design-locked discriminated union:
|
|
880
|
+
* - `{ kind: 'ok', exists: boolean }` on success
|
|
881
|
+
* - `{ kind: 'error', reason: string }` on any GraphQL/transport
|
|
882
|
+
* error (fail-CLOSED: caller treats this as "unverified" per
|
|
883
|
+
* F-GY-3 — better to refuse the read than silently accept).
|
|
884
|
+
*
|
|
885
|
+
* Does NOT throw — every failure surfaces as `{ kind: 'error' }`
|
|
886
|
+
* (mirrors `recordContinuationPacketWritten` discipline).
|
|
887
|
+
*/
|
|
888
|
+
verifyContinuationPacketWritten(input: {
|
|
889
|
+
taskId: string;
|
|
890
|
+
offerId: string | null;
|
|
891
|
+
packetHash: string;
|
|
892
|
+
}): Promise<{
|
|
893
|
+
kind: 'ok';
|
|
894
|
+
exists: boolean;
|
|
895
|
+
} | {
|
|
896
|
+
kind: 'error';
|
|
897
|
+
reason: string;
|
|
898
|
+
}>;
|
|
899
|
+
/**
|
|
900
|
+
* Backend `queryAudit` query — generic audit-row retrieval keyed on
|
|
901
|
+
* `(taskId, sessionId)`. Backend resolver returns AWSJSON; this
|
|
902
|
+
* method parses the string envelope into a typed shape. The AWSJSON
|
|
903
|
+
* contract is best-effort normalized — callers should treat the
|
|
904
|
+
* `rows[]` as untyped and filter on the `kind` / `packet_hash`
|
|
905
|
+
* fields themselves.
|
|
906
|
+
*
|
|
907
|
+
* @deprecated for the CP-6 F-GY-3 verification path — use
|
|
908
|
+
* `verifyContinuationPacketWritten` instead. The legacy
|
|
909
|
+
* `queryAudit` returns encrypted `entries[].payload` shapes that
|
|
910
|
+
* the reader cannot inspect for `packet_hash`. Kept on the client
|
|
911
|
+
* because other CP-6-unrelated code may use it.
|
|
912
|
+
*/
|
|
913
|
+
queryAudit(input: {
|
|
914
|
+
taskId: string;
|
|
915
|
+
sessionId: string;
|
|
916
|
+
kind?: string;
|
|
917
|
+
}): Promise<{
|
|
918
|
+
rows: Array<Record<string, unknown>>;
|
|
919
|
+
}>;
|
|
112
920
|
/**
|
|
113
921
|
* Subscribe to events for a session
|
|
114
922
|
*/
|
|
115
|
-
subscribeToEvents(sessionId: string, onEvent: (event: Event) => void, onError?: (error: Error) => void
|
|
923
|
+
subscribeToEvents(sessionId: string, onEvent: (event: Event) => void, onError?: (error: Error) => void, options?: {
|
|
924
|
+
receiveDesktopEvents?: boolean;
|
|
925
|
+
}): () => void;
|
|
116
926
|
/**
|
|
117
927
|
* Build WebSocket URL
|
|
928
|
+
*
|
|
929
|
+
* AppSync exposes the realtime endpoint two different ways depending on
|
|
930
|
+
* the GraphQL endpoint shape:
|
|
931
|
+
*
|
|
932
|
+
* 1. Direct AppSync URL (`<id>.appsync-api.<region>.amazonaws.com`):
|
|
933
|
+
* realtime is on a sibling subdomain — swap `appsync-api` →
|
|
934
|
+
* `appsync-realtime-api` and keep the `/graphql` path.
|
|
935
|
+
* → wss://<id>.appsync-realtime-api.<region>.amazonaws.com/graphql
|
|
936
|
+
*
|
|
937
|
+
* 2. Custom domain (`api.codevibe.quantiya.ai` and friends):
|
|
938
|
+
* realtime is path-based on the SAME hostname — append `/realtime`
|
|
939
|
+
* to the GraphQL path.
|
|
940
|
+
* → wss://api.codevibe.quantiya.ai/graphql/realtime
|
|
941
|
+
* AWS docs:
|
|
942
|
+
* https://docs.aws.amazon.com/appsync/latest/devguide/custom-domain-name.html
|
|
943
|
+
*
|
|
944
|
+
* The naive `.replace('appsync-api', 'appsync-realtime-api')` only works
|
|
945
|
+
* for path 1; on a custom-domain URL it doesn't match anything and the
|
|
946
|
+
* resulting `wss://<custom>/graphql` URL never completes the handshake.
|
|
118
947
|
*/
|
|
119
948
|
private buildRealtimeUrl;
|
|
120
949
|
/**
|
|
@@ -153,6 +982,82 @@ export declare class AppSyncClient {
|
|
|
153
982
|
private sendDeviceKeyWatcherStart;
|
|
154
983
|
private resetDeviceKeyWatcherKeepAlive;
|
|
155
984
|
private handleDeviceKeyWatcherError;
|
|
985
|
+
/**
|
|
986
|
+
* Subscribe to status changes on our own session and invoke
|
|
987
|
+
* onMobileEndRequested when status transitions to INACTIVE — typically
|
|
988
|
+
* meaning the user tapped "End Session" in the mobile app.
|
|
989
|
+
*
|
|
990
|
+
* The callback is invoked from the WebSocket message handler. The
|
|
991
|
+
* helper catches and logs WARN any error thrown by the callback so it
|
|
992
|
+
* does not propagate to the subscription handler (would tear down the
|
|
993
|
+
* WebSocket).
|
|
994
|
+
*
|
|
995
|
+
* Returns a stop() function the plugin MUST call BEFORE issuing its
|
|
996
|
+
* own updateSession({ status: INACTIVE }) mutation in the per-session
|
|
997
|
+
* cleanup handler — otherwise the desktop's own end-of-session
|
|
998
|
+
* mutation echoes back through this subscription as a self-caused
|
|
999
|
+
* callback. See §D.3.a in the design doc. Calling stop() more than
|
|
1000
|
+
* once is idempotent.
|
|
1001
|
+
*
|
|
1002
|
+
* Replace-on-duplicate-sessionId semantics: calling watchForMobileEnd
|
|
1003
|
+
* twice with the same sessionId stops the prior watcher and replaces
|
|
1004
|
+
* it with the new one, so at most one watcher is alive per sessionId.
|
|
1005
|
+
* Matches subscribeToEvents (above). Plugins should still call once
|
|
1006
|
+
* per session lifecycle; the replace path exists to make resume /
|
|
1007
|
+
* re-entry safe.
|
|
1008
|
+
*
|
|
1009
|
+
* Initial state assumed = ACTIVE: AppSync subscriptions are
|
|
1010
|
+
* mutation-triggered (NOT current-state snapshots), and plugins only
|
|
1011
|
+
* call this for sessions just created or resumed in ACTIVE state. The
|
|
1012
|
+
* first delivered status=INACTIVE payload IS the real signal and
|
|
1013
|
+
* fires the callback.
|
|
1014
|
+
*
|
|
1015
|
+
* Idempotent firing: callback fires AT MOST ONCE per helper instance.
|
|
1016
|
+
* Subsequent INACTIVE payloads (or any payload after fire) are
|
|
1017
|
+
* ignored. Plugin must rebuild the helper for a new session.
|
|
1018
|
+
*/
|
|
1019
|
+
watchForMobileEnd(sessionId: string, onMobileEndRequested: () => Promise<void> | void): {
|
|
1020
|
+
stop: () => void;
|
|
1021
|
+
};
|
|
1022
|
+
private createSessionUpdateWatcherConnection;
|
|
1023
|
+
/**
|
|
1024
|
+
* Process a delivered onSessionUpdated payload. Decides whether to
|
|
1025
|
+
* fire the callback per the locked rules in §A.2 of the design doc.
|
|
1026
|
+
*/
|
|
1027
|
+
private handleSessionUpdatePayload;
|
|
1028
|
+
private sendSessionUpdateWatcherStart;
|
|
1029
|
+
private resetSessionUpdateWatcherKeepAlive;
|
|
1030
|
+
private handleSessionUpdateWatcherError;
|
|
1031
|
+
private cleanupSessionUpdateWatcherState;
|
|
1032
|
+
/**
|
|
1033
|
+
* PHASE-CP-10-MIN (#585) §2.3 / Codex-H3 — subscribe to the cross-device
|
|
1034
|
+
* `onApplyUserDecision` echo for a session. The orchestration shell uses
|
|
1035
|
+
* this so a FOREIGN (mobile-originated) `continuation_switch_accepted`
|
|
1036
|
+
* decision resumes the desktop that owns the implementor (the shell did NOT
|
|
1037
|
+
* subscribe before; the V1-bridge plugins do via the quorum-core SDK —
|
|
1038
|
+
* `codevibe-claude-plugin/src/server.ts:4493`). Mirrors the
|
|
1039
|
+
* `watchForMobileEnd` per-session watcher (replace-on-duplicate, two-phase
|
|
1040
|
+
* reconnect, keep-alive). Delivers a parsed `UserDecisionAppliedEvent`
|
|
1041
|
+
* (`decision` lowercased; `action` coerced from the AWSJSON payload).
|
|
1042
|
+
* Returns a `stop()` handle (idempotent).
|
|
1043
|
+
*/
|
|
1044
|
+
subscribeToApplyUserDecision(sessionId: string, onDecision: (event: UserDecisionAppliedEvent) => void, onError?: (error: Error) => void): {
|
|
1045
|
+
stop: () => void;
|
|
1046
|
+
};
|
|
1047
|
+
private createApplyUserDecisionWatcherConnection;
|
|
1048
|
+
/**
|
|
1049
|
+
* Parse one delivered `onApplyUserDecision` payload into a typed
|
|
1050
|
+
* `UserDecisionAppliedEvent` and fire the callback OFF the message-handler
|
|
1051
|
+
* stack (so a throwing consumer cannot tear down the socket). The `payload`
|
|
1052
|
+
* is the AWSJSON `PostDecisionAction` — coerced with the SAME tolerant
|
|
1053
|
+
* `coerceAwsJsonObject` the `applyUserDecision` mutation uses (no casing
|
|
1054
|
+
* transform, so the snake_case continuation action fields land verbatim).
|
|
1055
|
+
*/
|
|
1056
|
+
private handleApplyUserDecisionPayload;
|
|
1057
|
+
private sendApplyUserDecisionWatcherStart;
|
|
1058
|
+
private resetApplyUserDecisionWatcherKeepAlive;
|
|
1059
|
+
private handleApplyUserDecisionWatcherError;
|
|
1060
|
+
private cleanupApplyUserDecisionWatcherState;
|
|
156
1061
|
private heartbeatTimers;
|
|
157
1062
|
/**
|
|
158
1063
|
* Start periodic heartbeat for a session.
|
|
@@ -167,8 +1072,126 @@ export declare class AppSyncClient {
|
|
|
167
1072
|
* Send a single heartbeat update.
|
|
168
1073
|
*/
|
|
169
1074
|
private sendHeartbeat;
|
|
1075
|
+
/**
|
|
1076
|
+
* Tear down the mobile-event subscription for a SINGLE session.
|
|
1077
|
+
*
|
|
1078
|
+
* Use this when a session ends or is superseded by a /resume while the
|
|
1079
|
+
* daemon keeps running — cleanupSubscriptions() tears down ALL
|
|
1080
|
+
* subscriptions and is only appropriate on full daemon shutdown.
|
|
1081
|
+
*
|
|
1082
|
+
* Without per-session teardown, an ended session's WebSocket survives in
|
|
1083
|
+
* the still-running daemon. When AppSync idle-closes it (code 1000) the
|
|
1084
|
+
* reconnect path in the start_ack handler re-runs startHeartbeat() and
|
|
1085
|
+
* re-asserts status: ACTIVE — resurrecting the ended session as a
|
|
1086
|
+
* duplicate row that the mobile app shows as a second live session.
|
|
1087
|
+
* cleanupSubscriptionState() sets state.destroyed = true, which is exactly
|
|
1088
|
+
* the flag the start_ack and 'close' handlers check to bail out, so this
|
|
1089
|
+
* closes the resurrection path.
|
|
1090
|
+
*
|
|
1091
|
+
* (Confirmed in production logs 2026-06-04: a resumed-over Claude session
|
|
1092
|
+
* was marked INACTIVE at 00:23:34 and resurrected to ACTIVE at 03:02:05
|
|
1093
|
+
* when its leaked subscription reconnected after an AppSync code-1000
|
|
1094
|
+
* close.)
|
|
1095
|
+
*
|
|
1096
|
+
* Idempotent: a no-op if no subscription is tracked for sessionId.
|
|
1097
|
+
*/
|
|
1098
|
+
cleanupSubscription(sessionId: string): void;
|
|
170
1099
|
/**
|
|
171
1100
|
* Cleanup all subscriptions and heartbeats
|
|
172
1101
|
*/
|
|
173
1102
|
cleanupSubscriptions(): void;
|
|
1103
|
+
/**
|
|
1104
|
+
* Parse a raw `ClassBPacket.packetJson` AWSJSON string into the typed
|
|
1105
|
+
* discriminated-union packet. Throws `Error` on malformed input — the caller
|
|
1106
|
+
* (subscription handler in CP-2) bridges this to `onError` per §7.2.
|
|
1107
|
+
*
|
|
1108
|
+
* Exposed for unit testing per design §7.4 row 1
|
|
1109
|
+
* (`appsync_client_subscribeToClassBPackets_parses_packetJson_into_typed_packet`).
|
|
1110
|
+
*/
|
|
1111
|
+
parseClassBPacketPayload(packetJson: string): unknown;
|
|
1112
|
+
/**
|
|
1113
|
+
* Subscribe to AppSync `onClassBPacket(userId)` and dispatch typed packets
|
|
1114
|
+
* to `onPacket`. Errors during parsing OR transport are forwarded to
|
|
1115
|
+
* `onError`. Returns an unsubscribe handle.
|
|
1116
|
+
*
|
|
1117
|
+
* The `onClassBPacket(userId)` stream delivers EVERY packet for the user —
|
|
1118
|
+
* across ALL of their active sessions. The second `onPacket` argument
|
|
1119
|
+
* surfaces the AppSync `ClassBPacket` ENVELOPE metadata (`sessionId`,
|
|
1120
|
+
* `taskId`, `packetId`, `issuedAt`) so a multi-session consumer (the
|
|
1121
|
+
* orchestration shell) can drop packets that belong to a different session
|
|
1122
|
+
* BEFORE acting on them (CP-12 W3 Stage-2 session-isolation fix). The inner
|
|
1123
|
+
* parsed `packetJson` (the typed `ClassBInbound`) is the FIRST argument and
|
|
1124
|
+
* is unchanged.
|
|
1125
|
+
*
|
|
1126
|
+
* CP-1.f §3.C.17 — the live WebSocket transport is now wired on the same
|
|
1127
|
+
* two-phase reconnect engine that powers `subscribeToEvents` /
|
|
1128
|
+
* `subscribeToDeviceKeyRegistered` (idToken auth via the realtime URL). The
|
|
1129
|
+
* `_deliverClassBPacketForTests` seam is preserved (it routes through the
|
|
1130
|
+
* SAME `classBPacketHandlers` registry the live socket dispatches into), so
|
|
1131
|
+
* unit tests inject packets without standing up a real socket. `onReconnect`
|
|
1132
|
+
* fires after a successful recovery so the shell can run the §3.C.21b
|
|
1133
|
+
* dropped-packet recovery poll.
|
|
1134
|
+
*/
|
|
1135
|
+
subscribeToClassBPackets(userId: string, handlers: {
|
|
1136
|
+
onPacket: (packet: unknown, envelope: ClassBPacketEnvelopeMeta) => void | Promise<void>;
|
|
1137
|
+
onError?: (err: Error) => void;
|
|
1138
|
+
onReconnect?: () => void | Promise<void>;
|
|
1139
|
+
/**
|
|
1140
|
+
* CP-12 W4 (#593) — fired on EVERY subscription establishment (initial
|
|
1141
|
+
* connect + reconnect). `isReconnect=false` on the first connect (the
|
|
1142
|
+
* restart-discovery signal B.2 needs), `true` on a reconnect.
|
|
1143
|
+
*/
|
|
1144
|
+
onSubscribed?: (isReconnect: boolean) => void | Promise<void>;
|
|
1145
|
+
}): {
|
|
1146
|
+
unsubscribe: () => Promise<void>;
|
|
1147
|
+
};
|
|
1148
|
+
/**
|
|
1149
|
+
* Public stop for the Class B watcher. Used at shell teardown.
|
|
1150
|
+
*/
|
|
1151
|
+
stopClassBWatcher(): void;
|
|
1152
|
+
private stopClassBWatcherInternal;
|
|
1153
|
+
private createClassBWatcherConnection;
|
|
1154
|
+
private sendClassBWatcherStart;
|
|
1155
|
+
private resetClassBWatcherKeepAlive;
|
|
1156
|
+
private handleClassBWatcherError;
|
|
1157
|
+
/**
|
|
1158
|
+
* Parse + route one live Class B packet through the registered handler.
|
|
1159
|
+
* Shared by the live WebSocket `data` path AND `_deliverClassBPacketForTests`
|
|
1160
|
+
* so both exercise the exact same parse → onPacket → onError flow.
|
|
1161
|
+
*/
|
|
1162
|
+
private dispatchClassBPacket;
|
|
1163
|
+
/**
|
|
1164
|
+
* Test seam — deliver a raw envelope payload to the registered handler.
|
|
1165
|
+
* Used by §7.4 unit tests to assert parse + forward semantics without
|
|
1166
|
+
* standing up a real WebSocket. Production code path (CP-2) will call the
|
|
1167
|
+
* same internal flow.
|
|
1168
|
+
*
|
|
1169
|
+
* `envelope` mirrors the AppSync `ClassBPacket` envelope fields that the
|
|
1170
|
+
* real subscription surfaces (`{ packetId, userId, sessionId, taskId,
|
|
1171
|
+
* issuedAt }`); the wire envelope's `userId` always equals the subscription
|
|
1172
|
+
* `userId`, so it is filled in here. `sessionId` defaults to '' for the
|
|
1173
|
+
* legacy CP-1.e parse/error tests that do not exercise session isolation.
|
|
1174
|
+
*
|
|
1175
|
+
* @internal
|
|
1176
|
+
*/
|
|
1177
|
+
_deliverClassBPacketForTests(userId: string, rawPacketJson: string, envelope?: Partial<ClassBPacketEnvelopeMeta>): Promise<void>;
|
|
1178
|
+
private classBWatcher;
|
|
1179
|
+
private readonly classBPacketHandlers;
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Envelope metadata surfaced alongside each Class B packet — the AppSync
|
|
1183
|
+
* `ClassBPacket` GraphQL type carries `{ packetId, userId, sessionId, taskId,
|
|
1184
|
+
* packetJson, issuedAt }`. `parseClassBPacketPayload` parses `packetJson`
|
|
1185
|
+
* (the inner typed packet); this type carries the OUTER envelope fields the
|
|
1186
|
+
* consumer needs for routing/isolation. `sessionId` is load-bearing for the
|
|
1187
|
+
* orchestration shell's per-session packet filter (CP-12 W3).
|
|
1188
|
+
*/
|
|
1189
|
+
export interface ClassBPacketEnvelopeMeta {
|
|
1190
|
+
/** The session this packet was minted for. Used for shell session isolation. */
|
|
1191
|
+
sessionId: string;
|
|
1192
|
+
/** Always equals the subscription `userId`. */
|
|
1193
|
+
userId: string;
|
|
1194
|
+
taskId?: string;
|
|
1195
|
+
packetId?: string;
|
|
1196
|
+
issuedAt?: string;
|
|
174
1197
|
}
|