@quantiya/codevibe-codex-plugin 2.0.64 → 2.0.65

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.
Files changed (59) hide show
  1. package/dist/server.js +38 -36
  2. package/node_modules/@quantiya/codevibe-core/dist/appsync/appsync-client.d.ts +302 -8
  3. package/node_modules/@quantiya/codevibe-core/dist/appsync/index.d.ts +25 -1
  4. package/node_modules/@quantiya/codevibe-core/dist/appsync/queries.d.ts +10 -0
  5. package/node_modules/@quantiya/codevibe-core/dist/appsync/standalone-companion-status.d.ts +6 -0
  6. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-deferred-inputs.d.ts +104 -0
  7. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-desktop-registration.d.ts +133 -0
  8. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-event-client.d.ts +110 -0
  9. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-inbound-journal.d.ts +142 -0
  10. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-input-delivery.d.ts +13 -0
  11. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-live-connection.d.ts +87 -0
  12. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-mobile-echo.d.ts +289 -0
  13. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-operation-journal.d.ts +236 -0
  14. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-prompt-publication.d.ts +153 -0
  15. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-prompt-resolution.d.ts +38 -0
  16. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-prompt-retention.d.ts +99 -0
  17. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-read-client.d.ts +131 -0
  18. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-resolution-recovery.d.ts +29 -0
  19. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-security-posture.d.ts +32 -0
  20. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-session-retirement.d.ts +30 -0
  21. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-shell-source.d.ts +151 -0
  22. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-source-cursor.d.ts +529 -0
  23. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-source-file.d.ts +33 -0
  24. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-source-pair.d.ts +33 -0
  25. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-state.d.ts +51 -0
  26. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-usage-warning.d.ts +33 -0
  27. package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-workspace-outcome.d.ts +23 -0
  28. package/node_modules/@quantiya/codevibe-core/dist/config/config.d.ts +3 -0
  29. package/node_modules/@quantiya/codevibe-core/dist/credential-broker/oauth-account-lock.d.ts +4 -0
  30. package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +26 -0
  31. package/node_modules/@quantiya/codevibe-core/dist/index.js +584 -537
  32. package/node_modules/@quantiya/codevibe-core/dist/local-executor/local-executor-impl.d.ts +11 -11
  33. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.d.ts +9 -4
  34. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.js +50680 -44643
  35. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/OrchestrationApp.d.ts +6 -0
  36. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/StatusBar.d.ts +2 -0
  37. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/decision-attempt-recovery.d.ts +2 -0
  38. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/emit-shell-event.d.ts +31 -8
  39. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/gate-prompts.d.ts +4 -0
  40. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/index.d.ts +8 -7
  41. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/planner-offer-e1.d.ts +5 -1
  42. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/quorum-loop.d.ts +9 -2
  43. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/shell-sync-recovery.d.ts +23 -0
  44. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/slash-routes/reviewers.d.ts +3 -1
  45. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/types.d.ts +8 -8
  46. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/workspace-terminal-coordinator.d.ts +1 -1
  47. package/node_modules/@quantiya/codevibe-core/dist/planner/types.d.ts +2 -2
  48. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/atomic-file.d.ts +13 -3
  49. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/consolidator.d.ts +10 -2
  50. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/index.d.ts +1 -0
  51. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/ledger.d.ts +17 -9
  52. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/outbox.d.ts +20 -2
  53. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/replay-cursor.d.ts +2 -2
  54. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/sync-transport.d.ts +53 -0
  55. package/node_modules/@quantiya/codevibe-core/dist/tool-activity/types.d.ts +28 -24
  56. package/node_modules/@quantiya/codevibe-core/dist/types/events.d.ts +3 -0
  57. package/node_modules/@quantiya/codevibe-core/dist/types/reviewer.d.ts +14 -4
  58. package/node_modules/@quantiya/codevibe-core/package.json +1 -1
  59. package/package.json +2 -2
@@ -1,5 +1,20 @@
1
1
  import WebSocket from 'ws';
2
2
  import { type Environment } from '../config';
3
+ import { type CompanionSyncState } from './sync-state';
4
+ import { type SyncSecurityPosture, type SyncSecurityPostureReceipt } from './sync-security-posture';
5
+ import { type WorkspaceOutcomeReceipt, type WorkspaceOutcomeSubmissionOptions } from './sync-workspace-outcome';
6
+ import { DurableDesktopSyncWriter, type DesktopSyncSessionScope } from './sync-operation-journal';
7
+ import { DesktopSyncReadClient } from './sync-read-client';
8
+ import { DesktopSyncLiveConnection } from './sync-live-connection';
9
+ import { type DurableDesktopSyncReader } from './sync-desktop-registration';
10
+ import type { PromptReRaiseDisposition } from './sync-prompt-retention';
11
+ import { type ResolveDesktopSyncPromptInput, type SyncPromptResolutionReceipt } from './sync-prompt-resolution';
12
+ import { type ConfirmDesktopSyncRetirementInput, type SyncSessionRetirementReceipt } from './sync-session-retirement';
13
+ import { type ToolActivitySyncEncryption } from '../tool-activity/sync-transport';
14
+ import type { ToolActivityTransport } from '../tool-activity/consolidator';
15
+ import { ToolActivityOutbox } from '../tool-activity/outbox';
16
+ import type { ToolActivityLedger } from '../tool-activity/ledger';
17
+ import { type CreateDesktopSyncEventInput, type UpdateDesktopSyncEventInput, type SyncEventReceipt, type UpdateDesktopSyncStatusInput, type SyncStatusReceipt, type SyncPromptRetentionReceipt } from './sync-event-client';
3
18
  import { CreateEventInput, CreateSessionInput, UpdateSessionInput, UpdateEventStatusInput, Event, Session, EventSource, DeviceKey, GrantSessionKeyInput, UpdateReviewerPolicyInput, UserReviewerPolicySnapshot } from '../types';
4
19
  import type { PostDecisionAction } from '../orchestration-shell/types';
5
20
  import type { InvocationUsageSnapshot } from '../reviewer/token-usage';
@@ -317,6 +332,8 @@ export interface TaskReviewSummaryQuorum {
317
332
  seats: TaskReviewSummaryQuorumSeat[];
318
333
  roundCount: number;
319
334
  revisionCount: number;
335
+ approvalRule?: string;
336
+ autoRevisionLimit?: number;
320
337
  }
321
338
  export interface TaskReviewSummaryMergeGate {
322
339
  applicable: boolean;
@@ -418,6 +435,7 @@ export interface DownloadUrlResponse {
418
435
  * the message is unchanged ("GraphQL error: <message>").
419
436
  */
420
437
  export declare class AppSyncGraphQLError extends Error {
438
+ readonly responseMessage: string;
421
439
  readonly errorType?: string;
422
440
  readonly extensions?: unknown;
423
441
  readonly path?: unknown;
@@ -529,15 +547,27 @@ export declare function isRecognizedNonProductionEnvironment(env?: NodeJS.Proces
529
547
  * Any invalid, out-of-bounds, non-integer, or non-finite value safely defaults to DEFAULT_HEARTBEAT_INTERVAL_MS.
530
548
  */
531
549
  export declare function resolveHeartbeatIntervalMs(override?: number, env?: NodeJS.ProcessEnv): number;
532
- /**
533
- * AppSync GraphQL client with WebSocket subscriptions
534
- */
550
+ /** Programmatic producer result, not a fabricated Event. Only ACCEPTED has an
551
+ * actual event identity; a V2 acceptance also carries its canonical receipt. */
552
+ export type CompanionEventPublication = {
553
+ status: 'ACCEPTED';
554
+ eventId: string;
555
+ receipt?: SyncEventReceipt;
556
+ } | {
557
+ status: 'OMITTED' | 'PENDING' | 'DROPPED' | 'SETTLED';
558
+ };
559
+ /** AppSync GraphQL client with WebSocket subscriptions. */
535
560
  export declare class AppSyncClient {
536
561
  #private;
537
562
  private authenticated;
538
563
  private currentUserId;
539
564
  private currentEmail;
540
565
  private tokens;
566
+ private syncDisplayEpoch;
567
+ private syncDisplaySequence;
568
+ private syncDisplayAppliedSequence;
569
+ private syncDisplay;
570
+ private syncDisplayListeners;
541
571
  private activeSubscriptions;
542
572
  /**
543
573
  * Set by `authenticateWithStoredTokens()` on every false-return path
@@ -709,6 +739,251 @@ export declare class AppSyncClient {
709
739
  * Make a GraphQL request
710
740
  */
711
741
  private graphqlRequest;
742
+ /** Small control receipts cannot turn an untrusted response into an
743
+ * unbounded allocation. Applied only to explicitly bounded query callers. */
744
+ private boundedGraphQLJson;
745
+ private assertSyncAccount;
746
+ /** Bounded cloud routing/usage read, pinned to the current account. No fallback. */
747
+ getCompanionSyncState(signal?: AbortSignal): Promise<CompanionSyncState>;
748
+ /** Subscribe to validated reads already performed by this client. No new
749
+ * request, persistent journal, producer grant or retry is created here. */
750
+ subscribeCompanionSyncState(userId: string, listener: (state: CompanionSyncState | null) => void): () => void;
751
+ /** Synchronous display snapshot for local /status. Never starts cloud I/O,
752
+ * grants admission, or exposes another account's last observation. */
753
+ companionSyncStatusSnapshot(userId: string): CompanionSyncState | null;
754
+ /** Existing socket maintenance recovers idle status after its cloud cache
755
+ * expires. This is display-only; admissions never use the cached result. */
756
+ private refreshCompanionSyncDisplayOnMaintenance;
757
+ private notifyCompanionSyncDisplay;
758
+ private resetCompanionSyncDisplay;
759
+ private publishCompanionSyncDisplay;
760
+ /** Signed closed safety fact, independent of customer event quota. Only an
761
+ * affirmative cloud LEGACY selection permits the caller's legacy sink.
762
+ * Success confirms canonical persistence, never phone/render delivery. */
763
+ reportSecurityPostureIfSelected(sessionScope: {
764
+ sessionId: string;
765
+ sessionGenerationId?: string | null;
766
+ sessionKeyGen?: string;
767
+ }, posture: SyncSecurityPosture, signal?: AbortSignal): Promise<SyncSecurityPostureReceipt | null>;
768
+ /** Explicit bounded read plane. No registration, paging or legacy fallback
769
+ * occurs at construction; lifecycle owners persist and supply credentials. */
770
+ desktopSyncReadClient(sessionScope: DesktopSyncSessionScope, signal?: AbortSignal): Promise<DesktopSyncReadClient>;
771
+ /** Session owners keep this object, close/join it before hosted retirement,
772
+ * then retire its exact registration. No in-memory-only credential shortcut. */
773
+ desktopSyncReadSession(options: DesktopSyncSessionScope & {
774
+ root?: string;
775
+ }, signal?: AbortSignal): Promise<DurableDesktopSyncReader>;
776
+ /** One signed data-plane socket, with caller-owned close/join. The default
777
+ * subscribeToEvents path below uses this same factory for all providers. */
778
+ desktopSyncLiveSession(options: DesktopSyncSessionScope & {
779
+ root?: string;
780
+ }, onEvent: (event: Event) => Promise<void> | void, onError: (error: Error) => void, signal?: AbortSignal): Promise<DesktopSyncLiveConnection>;
781
+ private syncEventForConsumer;
782
+ retireDesktopSyncRegistration(options: DesktopSyncSessionScope & {
783
+ root?: string;
784
+ }, retired: Session): Promise<boolean>;
785
+ /** Explicit metered route; no legacy fallback, synthetic Event or local quota authority. */
786
+ desktopSyncWriter(options?: {
787
+ root?: string;
788
+ sessionScope?: DesktopSyncSessionScope;
789
+ }): DurableDesktopSyncWriter;
790
+ /** Closed metered tool producer; native source settlement owns journal acknowledgment. */
791
+ toolActivitySyncTransport(options: {
792
+ root?: string;
793
+ sessionScope: DesktopSyncSessionScope;
794
+ getEncryptionContext(): Promise<ToolActivitySyncEncryption>;
795
+ }): ToolActivityTransport;
796
+ private readonly companionNoticeOwners;
797
+ private companionNoticeOwner;
798
+ private closeCompanionNoticeOwners;
799
+ /** One invocation is one NEW synthetic notice, not a native-record retry.
800
+ * Callers must not re-invoke after PENDING: the encrypted prepared source now
801
+ * owns retry/settlement. No Event is fabricated for pending or quota omission.
802
+ * Retryable native/domain producers use their existing occurrence owners.
803
+ */
804
+ publishCompanionNotice(value: CreateEventInput, legacy: () => Promise<boolean>, options?: {
805
+ root?: string;
806
+ }): Promise<'ACCEPTED' | 'OMITTED' | 'PENDING' | 'DROPPED' | 'SETTLED'>;
807
+ /** One call admits one NEW ordinary desktop event. The source retains its
808
+ * operation through cloud retry/restart. PENDING/SETTLED are not permission
809
+ * for the caller to submit the payload again as another occurrence.
810
+ * E1/domain controls and consolidated tool windows use their own producers. */
811
+ publishCompanionEvent(value: CreateEventInput, legacy: () => Promise<{
812
+ eventId: string;
813
+ } | null>, options?: {
814
+ root?: string;
815
+ assertOwner?: () => void;
816
+ }): Promise<CompanionEventPublication>;
817
+ private publishCompanionOccurrence;
818
+ /** Recover native-source operations without a current Session, key-generation
819
+ * lookup or protocol selection. The saved cursor supplies the exact original
820
+ * incarnation; recovery cannot re-encrypt or migrate it to a replacement.
821
+ */
822
+ recoverCompanionSyncSources(options: {
823
+ sessionId: string;
824
+ root?: string;
825
+ }, signal?: AbortSignal): Promise<number>;
826
+ /** Recover the shell's prepared source in its ORIGINAL session generation.
827
+ * No live Session/key/protocol lookup may reinterpret an already sealed event.
828
+ * The source owns settlement/ack; ordinary journal inventory is never swept.
829
+ */
830
+ recoverShellSyncSources(options: {
831
+ sessionId: string;
832
+ root?: string;
833
+ }, signal?: AbortSignal): Promise<number>;
834
+ /** Shared shell/notice payload recovery; no live route or key selection. */
835
+ private recoverPreparedCompanionEvents;
836
+ /** The caller supplies the actual updateSession(INACTIVE) result only after
837
+ * its local producers are quiescent. A missing/foreign/generationless result
838
+ * is not deletion authority. Empty source only; unresolved writes survive. */
839
+ retireEmptyShellSyncSource(options: DesktopSyncSessionScope & {
840
+ root?: string;
841
+ }, retired: Session): Promise<boolean>;
842
+ /** Recover only previously sealed operations before live protocol selection. */
843
+ recoverToolActivityWindows(options: {
844
+ sessionId: string;
845
+ root?: string;
846
+ outbox: ToolActivityOutbox;
847
+ ledger: ToolActivityLedger;
848
+ }): Promise<void>;
849
+ /**
850
+ * Provider startup uses cloud routing, never a local tier/flag or an error
851
+ * fallback. A transport is generation-bound for its entire lifetime. Cutover
852
+ * and rollback must drain/restart the producer; they cannot reinterpret its
853
+ * sealed source windows as a different protocol.
854
+ */
855
+ selectToolActivityTransport(options: {
856
+ sessionId: string;
857
+ root?: string;
858
+ legacyTransport: ToolActivityTransport;
859
+ }): Promise<ToolActivityTransport>;
860
+ /** Shared cloud-selected authority for tools and ordinary native sources. */
861
+ selectCompanionSourceTransport(options: {
862
+ sessionId: string;
863
+ root?: string;
864
+ }): Promise<{
865
+ protocol: 'LEGACY';
866
+ } | {
867
+ protocol: 'SYNC_V2';
868
+ sessionScope: Readonly<DesktopSyncSessionScope>;
869
+ writer: DurableDesktopSyncWriter;
870
+ getEncryptionContext(): Promise<ToolActivitySyncEncryption>;
871
+ prepareEvent(input: CreateEventInput, operationId: string): Promise<CreateDesktopSyncEventInput>;
872
+ }>;
873
+ /** Shared E1 producer adapter. The legacy encryption factory runs only after
874
+ * affirmative cloud LEGACY selection. V2 encrypts inside the durable source
875
+ * factory and never maps a quota omission to a successful cloud publication. */
876
+ publishCompanionPrompt(value: CreateEventInput, legacy: () => Promise<boolean>, options?: {
877
+ root?: string;
878
+ reRaiseToken?: string;
879
+ }): Promise<PromptReRaiseDisposition>;
880
+ /** Caller first stops this prompt's local producer and joins its publications.
881
+ * Recover the exact saved episode before the owner-token delete, including a
882
+ * lost ACK whose marker already exists. Settlement needs no route/key lookup;
883
+ * cloud routing selects the resolution protocol without a current Session.
884
+ * A failed/ambiguous step retains every source record.
885
+ * This is control-only and remains usable after new-sync admission closes. */
886
+ resolveCompanionPrompt(value: {
887
+ sessionId: string;
888
+ promptId: string;
889
+ ownerToken: string;
890
+ resolutionAt?: string;
891
+ }, options?: {
892
+ root?: string;
893
+ }): Promise<boolean>;
894
+ /** Core resolution carries the generation already bound to the session
895
+ * owner. Never fetch a newer Session/key to clear an older offer. */
896
+ resolveCoreOfferPrompt(value: {
897
+ sessionId: string;
898
+ promptId: string;
899
+ sessionGenerationId?: string | null;
900
+ sessionKeyGen?: string | null;
901
+ }, legacy: () => Promise<boolean>, options?: {
902
+ root?: string;
903
+ }): Promise<boolean>;
904
+ private resolvePromptByProtocol;
905
+ private finishPromptResolution;
906
+ /** Explicit session-owned restart recovery. Inventory is bounded by the
907
+ * account store's 256-file cap; empty inventory does no cloud I/O. Reuses
908
+ * original ownership/generation, not current Session or encryption state.
909
+ * No failure/age/quota condition deletes an outstanding intent. */
910
+ recoverPromptResolutions(options: {
911
+ sessionId: string;
912
+ root?: string;
913
+ }, signal?: AbortSignal): Promise<number>;
914
+ /** Local recovery ordering shared by owner-token plugin and signed core-offer
915
+ * resolution. The caller quiesces this exact prompt before entry, then uses
916
+ * its existing domain authority to obtain a validated resolution ACK. This
917
+ * method grants no backend authority and creates no new visible occurrence.
918
+ * False, thrown or account-switched acknowledgements retain the source. */
919
+ resolvePromptPublication(value: {
920
+ sessionId: string;
921
+ promptId: string;
922
+ }, resolve: (hasV2Publication: boolean) => Promise<boolean>, options?: {
923
+ root?: string;
924
+ signal?: AbortSignal;
925
+ }): Promise<boolean>;
926
+ /** Wire-only primitive. Durable producers use desktopSyncWriter(). */
927
+ createDesktopSyncEvent(input: CreateDesktopSyncEventInput, signal?: AbortSignal): Promise<SyncEventReceipt>;
928
+ updateDesktopSyncEvent(input: UpdateDesktopSyncEventInput, signal?: AbortSignal): Promise<SyncEventReceipt>;
929
+ /** Explicit cloud proof of permanent generation closure. No current Session
930
+ * or session encryption-key lookup, journal deletion or delivery inference. */
931
+ confirmDesktopSyncRetirement(input: ConfirmDesktopSyncRetirementInput, signal?: AbortSignal): Promise<SyncSessionRetirementReceipt>;
932
+ /** Explicit terminal owner boundary. quiesce must stop AND join native,
933
+ * shell, prompt and source-recovery producers; a daemon handoff is not a
934
+ * terminal retirement. Missing/failed cloud proof retains every source.
935
+ * This does not retire hosted state or sweep tool/control journals. */
936
+ retireDesktopSyncSources(options: DesktopSyncSessionScope & {
937
+ expectedSessionKeyGen: string;
938
+ root?: string;
939
+ }, quiesce: () => Promise<void>, signal?: AbortSignal): Promise<{
940
+ sourcesRemoved: number;
941
+ operationsRemoved: number;
942
+ }>;
943
+ private quiesceDesktopSyncSession;
944
+ /** Called only by a terminal owner after its actual INACTIVE mutation. A
945
+ * heartbeat, mobile-end notification, bootstrap cancellation or handoff does
946
+ * not by itself establish local producer quiescence. Old source links are
947
+ * collected before control-intent ACKs, so resolution never replays retired
948
+ * Events. A lost control ACK keeps the independent intent for retry. */
949
+ completeDesktopSyncRetirement(options: {
950
+ sessionId: string;
951
+ root?: string;
952
+ toolOutbox?: ToolActivityOutbox;
953
+ }, retired: Session, quiesce: () => Promise<void>, signal?: AbortSignal): Promise<{
954
+ sourcesRemoved: number;
955
+ operationsRemoved: number;
956
+ }>;
957
+ /** No Session fetch, live key lookup, native-process operation or re-homing.
958
+ * The encrypted intent records a completed producer join; fresh cloud proof
959
+ * still gates each payload cleanup. Independent failed intents remain local. */
960
+ recoverSessionRetirements(options?: {
961
+ root?: string;
962
+ }, signal?: AbortSignal): Promise<{
963
+ completed: number;
964
+ deferred: number;
965
+ }>;
966
+ private readonly sessionRetirementRecoveryPasses;
967
+ private recoverSessionRetirementsOnce;
968
+ private finishRecordedSessionRetirement;
969
+ /** Wire-only PROMPT_OWNERSHIP transition. It cannot create an Event. Plugin
970
+ * preimage authority does not require the retired Session's encryption key;
971
+ * core authority signs the exact bound generation with the device key. */
972
+ resolveDesktopSyncPrompt(input: ResolveDesktopSyncPromptInput, signal?: AbortSignal): Promise<SyncPromptResolutionReceipt>;
973
+ /** Monotonic control transition; safe retry means re-read canonical status,
974
+ * not retrying the provider input or manufacturing a full Event response. */
975
+ updateDesktopSyncEventStatus(input: UpdateDesktopSyncStatusInput, signal?: AbortSignal): Promise<SyncStatusReceipt>;
976
+ /** One budgeted liveness operation, never a legacy fallback. The producer
977
+ * must persist each receipt/progress before advancing its refresh batch. */
978
+ refreshDesktopSyncPrompt(promptId: string, signal?: AbortSignal): Promise<SyncPromptRetentionReceipt>;
979
+ /** Producer-facing batch: V2 keeps exact per-incarnation progress; the
980
+ * legacy protocol retains its existing chunked endpoint until cutover. */
981
+ refreshSessionOpenPromptTtl(options: {
982
+ sessionId: string;
983
+ promptIds: readonly string[];
984
+ root?: string;
985
+ }, reRaise: (promptId: string, reRaiseToken?: string) => Promise<PromptReRaiseDisposition>): Promise<void>;
986
+ private mutateDesktopSyncEvent;
712
987
  /**
713
988
  * Create a session
714
989
  */
@@ -737,6 +1012,11 @@ export declare class AppSyncClient {
737
1012
  * Get a session
738
1013
  */
739
1014
  getSession(sessionId: string): Promise<Session | null>;
1015
+ /** The workspace owner retains its existing durable outbox. Never put a
1016
+ * second journal around it, re-encrypt it, or choose the current generation.
1017
+ * Quota omission is a canonical ACK, not a synthetic Event or a retry queue.
1018
+ */
1019
+ submitWorkspaceOutcome(value: CreateEventInput, options?: WorkspaceOutcomeSubmissionOptions): Promise<WorkspaceOutcomeReceipt>;
740
1020
  /**
741
1021
  * Create an event
742
1022
  */
@@ -754,7 +1034,7 @@ export declare class AppSyncClient {
754
1034
  /**
755
1035
  * Update event status
756
1036
  */
757
- updateEventStatus(input: UpdateEventStatusInput): Promise<Event>;
1037
+ updateEventStatus(value: UpdateEventStatusInput, requiredInput?: Pick<SyncStatusReceipt, 'sessionGenerationId'> & Partial<Pick<SyncStatusReceipt, 'type'>>, signal?: AbortSignal): Promise<Event | SyncStatusReceipt>;
758
1038
  /**
759
1039
  * List events for a session
760
1040
  */
@@ -903,13 +1183,13 @@ export declare class AppSyncClient {
903
1183
  /**
904
1184
  * Fetch the user's subscription tier + status. Used by the Phase 3.a
905
1185
  * setup wizard (#190) at bootstrap to gate Free → upgrade interstitial
906
- * and to size the seat budget (Pro=2, Max=3).
1186
+ * and to bound the panel (Pro=1, Max=1–2; Max defaults to 2).
907
1187
  *
908
1188
  * Backend resolver returns a default FREE row when the user has no
909
1189
  * Users-table entry yet (Lambda resolver — lambda/subscription/index.ts).
910
1190
  * Network failure / auth expiry surface as graphqlRequest exceptions.
911
1191
  */
912
- getSubscriptionStatus(): Promise<{
1192
+ getSubscriptionStatus(signal?: AbortSignal): Promise<{
913
1193
  tier: 'FREE' | 'PRO' | 'MAX';
914
1194
  status: 'ACTIVE' | 'EXPIRED' | 'GRACE_PERIOD' | 'BILLING_RETRY';
915
1195
  expiresAt: string | null;
@@ -1090,10 +1370,12 @@ export declare class AppSyncClient {
1090
1370
  promptId: string;
1091
1371
  decisionAttemptId: string;
1092
1372
  }): Promise<DecisionAttemptResult>;
1093
- /** Owner-scoped durable resolution point read for receipt recovery. */
1373
+ /** Cloud-selected recovery protocol. V2 requires the session owner's known
1374
+ * generation and never falls back to a live Session lookup or legacy Event. */
1094
1375
  getGateResolution(input: {
1095
1376
  sessionId: string;
1096
1377
  promptId: string;
1378
+ sessionGenerationId?: string;
1097
1379
  }): Promise<unknown>;
1098
1380
  applyUserDecision(input: {
1099
1381
  gateId: string;
@@ -1457,10 +1739,21 @@ export declare class AppSyncClient {
1457
1739
  }): Promise<{
1458
1740
  rows: Array<Record<string, unknown>>;
1459
1741
  }>;
1742
+ private readonly syncSubscriptionClosures;
1743
+ private readonly syncReadOwners;
1744
+ private syncReadEpoch;
1745
+ private readonly syncRetiringSessions;
1746
+ private readonly syncRegistrations;
1747
+ private assertSyncReadAdmission;
1748
+ private rememberSyncRegistration;
1749
+ private ownSyncReader;
1750
+ private trackSyncClosure;
1751
+ private joinSyncSubscriptionClosures;
1752
+ private syncHistoryForSession;
1460
1753
  /**
1461
1754
  * Subscribe to events for a session
1462
1755
  */
1463
- subscribeToEvents(sessionId: string, onEvent: (event: Event) => void, onError?: (error: Error) => void, options?: {
1756
+ subscribeToEvents(sessionId: string, onEvent: (event: Event) => Promise<void> | void, onError?: (error: Error) => void, options?: {
1464
1757
  receiveDesktopEvents?: boolean;
1465
1758
  onSupervisionEvent?: (event: Event) => void;
1466
1759
  onSubscribed?: (isReconnect: boolean) => void;
@@ -1493,6 +1786,7 @@ export declare class AppSyncClient {
1493
1786
  * Create WebSocket subscription
1494
1787
  */
1495
1788
  private createSubscription;
1789
+ private createLegacySubscription;
1496
1790
  private handleSubscriptionStartAck;
1497
1791
  /**
1498
1792
  * Send subscription start message
@@ -1,7 +1,31 @@
1
1
  export { AppSyncClient, AppSyncAuthenticationError, AppSyncGraphQLError, DownloadUrlResponse, resolveHeartbeatIntervalMs, DEFAULT_HEARTBEAT_INTERVAL_MS, MIN_HEARTBEAT_INTERVAL_MS, MAX_HEARTBEAT_INTERVAL_MS, isRecognizedNonProductionEnvironment, RECOGNIZED_NON_PRODUCTION_ENVIRONMENTS, CREDENTIAL_STORAGE_UNAVAILABLE_EXIT_CODE, describeStoredAuthFailure, } from './appsync-client';
2
2
  export type { AuthFailureKind, StoredAuthFailureReport } from './appsync-client';
3
3
  export { coerceAwsJsonObject } from './appsync-client';
4
- export type { ClassBPacketEnvelopeMeta } from './appsync-client';
4
+ export type { ClassBPacketEnvelopeMeta, CompanionEventPublication } from './appsync-client';
5
5
  export type { TaskReviewSummary, TaskReviewSummaryRound, TaskReviewSummaryReviewer, TaskGroupStatusResult, PutContextItemInput, } from './appsync-client';
6
6
  export { queries, mutations, subscriptions } from './queries';
7
7
  export { isPersistedEventResult } from './event-throttle';
8
+ export { SyncEventClientError, PLAIN_DESKTOP_SYNC_TYPES } from './sync-event-client';
9
+ export type { PromptPublicationJournal } from './sync-prompt-publication';
10
+ export type { PromptReRaiseDisposition } from './sync-prompt-retention';
11
+ export type { ResolveDesktopSyncPromptInput, SyncPromptResolutionReceipt } from './sync-prompt-resolution';
12
+ export type { ConfirmDesktopSyncRetirementInput, SyncSessionRetirementReceipt } from './sync-session-retirement';
13
+ export { acknowledgeMobileInputDelivery, acknowledgeMobileInputExecution, requiresSyncInputDeliveryReceipt } from './sync-input-delivery';
14
+ export type { MobileInputStatusUpdater } from './sync-input-delivery';
15
+ export type { CreateDesktopSyncEventInput, UpdateDesktopSyncEventInput, UpdateDesktopSyncStatusInput, SyncStatusReceipt, SyncPromptRetentionReceipt, SyncEventReceipt, SyncJson } from './sync-event-client';
16
+ export type { CompanionSyncState } from './sync-state';
17
+ export { readStandaloneCompanionStatus } from './standalone-companion-status';
18
+ export { DurableDesktopSyncWriter, SyncJournalError } from './sync-operation-journal';
19
+ export { desktopDeferredInputSha256 } from './sync-deferred-inputs';
20
+ export type { DesktopDeferredInput, DesktopDeferredInputStore, DesktopDeferredNoticeState } from './sync-deferred-inputs';
21
+ export type { DesktopMobileEchoJournal, DesktopMobileEchoTarget, DesktopMobileEchoFrame } from './sync-mobile-echo';
22
+ export type { ShellSyncSource, ShellSyncTicket, ShellSyncSourceInventory } from './sync-shell-source';
23
+ export type { DurableSyncResult, DurableDesktopSyncWriterOptions, DesktopSyncSessionScope, DesktopSyncSourceIdentity } from './sync-operation-journal';
24
+ export { MAX_SYNC_SOURCE_ANCHOR_BYTES } from './sync-source-cursor';
25
+ export type { DesktopSyncSourceStream, DesktopSyncSourceFrame, DesktopSyncSourceCursor, DesktopSyncSourceJournal, DesktopSyncSourceInventory, DesktopSyncSourceAnchor, DesktopSyncSourcePosition, DesktopSyncSourceGap } from './sync-source-cursor';
26
+ export type { DesktopSyncSourcePair } from './sync-source-pair';
27
+ export { readDesktopSyncFile } from './sync-source-file';
28
+ export type { DesktopSyncFileIdentity, DesktopSyncFileFrame, DesktopSyncFileAdmission } from './sync-source-file';
29
+ export { DesktopSyncReadClient, SyncReadClientError } from './sync-read-client';
30
+ export type { DesktopSyncRegistrationAttempt, DesktopSyncReadCredential, SyncReadEvent, SyncHistoryPage } from './sync-read-client';
31
+ export type { DesktopSyncRegistrationStore, DurableDesktopSyncReader } from './sync-desktop-registration';
@@ -1,8 +1,10 @@
1
1
  export declare const queries: {
2
+ getCompanionSyncState: string;
2
3
  getSession: string;
3
4
  listEvents: string;
4
5
  listSupervisionEvents: string;
5
6
  getDecisionAttempt: string;
7
+ getGateResolutionV2: string;
6
8
  getGateResolution: string;
7
9
  listOpenPrompts: string;
8
10
  listUserDeviceKeys: string;
@@ -33,9 +35,17 @@ export declare const mutations: {
33
35
  putContextItem: string;
34
36
  createSession: string;
35
37
  updateSession: string;
38
+ createEventV2: string;
39
+ recordWorkspaceOutcomeV2: string;
40
+ updateEventV2: string;
36
41
  createEvent: string;
37
42
  refreshOpenPromptTtl: string;
43
+ refreshOpenPromptTtlV2: string;
44
+ resolveOpenPromptV2: string;
45
+ reportSecurityPostureV2: string;
46
+ confirmSessionRetirementV2: string;
38
47
  updateEventStatus: string;
48
+ updateEventStatusV2: string;
39
49
  registerDeviceKey: string;
40
50
  grantSessionKey: string;
41
51
  getAttachmentDownloadUrl: string;
@@ -0,0 +1,6 @@
1
+ import type { AppSyncClient } from './appsync-client';
2
+ type StatusClient = Pick<AppSyncClient, 'getCurrentUserId' | 'getSubscriptionStatus' | 'getCompanionSyncState'>;
3
+ /** Read-only status for a provider companion without an Orchestration shell.
4
+ * This never grants a tier or authorizes a send; cloud writes remain authoritative. */
5
+ export declare function readStandaloneCompanionStatus(client: StatusClient, signal?: AbortSignal): Promise<string[]>;
6
+ export {};
@@ -0,0 +1,104 @@
1
+ import { z } from 'zod';
2
+ import type { DesktopSyncSessionScope } from './sync-operation-journal';
3
+ import { type CreateDesktopSyncEventInput } from './sync-event-client';
4
+ export type DesktopDeferredNoticeState = {
5
+ state: 'STAGED';
6
+ input: CreateDesktopSyncEventInput;
7
+ } | {
8
+ state: 'SETTLED';
9
+ operationId: string;
10
+ status: 'ACCEPTED' | 'OMITTED';
11
+ };
12
+ declare const item: z.ZodObject<{
13
+ eventId: z.ZodString;
14
+ timestamp: z.ZodEffects<z.ZodString, string, string>;
15
+ type: z.ZodEnum<["USER_PROMPT", "PROMPT_RESPONSE"]>;
16
+ payloadJson: z.ZodEffects<z.ZodString, string, string>;
17
+ notice: z.ZodOptional<z.ZodType<DesktopDeferredNoticeState, z.ZodTypeDef, unknown>>;
18
+ }, "strict", z.ZodTypeAny, {
19
+ eventId: string;
20
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
21
+ timestamp: string;
22
+ payloadJson: string;
23
+ notice?: DesktopDeferredNoticeState | undefined;
24
+ }, {
25
+ eventId: string;
26
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
27
+ timestamp: string;
28
+ payloadJson: string;
29
+ notice?: unknown;
30
+ }>;
31
+ declare const row: z.ZodObject<{
32
+ schemaVersion: z.ZodLiteral<1>;
33
+ kind: z.ZodLiteral<"DEFERRED_INPUTS">;
34
+ operationId: z.ZodString;
35
+ sessionId: z.ZodString;
36
+ sessionGenerationId: z.ZodString;
37
+ provider: z.ZodEnum<["codex", "claude", "agy"]>;
38
+ nativeSessionSha256: z.ZodString;
39
+ entries: z.ZodArray<z.ZodObject<{
40
+ eventId: z.ZodString;
41
+ timestamp: z.ZodEffects<z.ZodString, string, string>;
42
+ type: z.ZodEnum<["USER_PROMPT", "PROMPT_RESPONSE"]>;
43
+ payloadJson: z.ZodEffects<z.ZodString, string, string>;
44
+ notice: z.ZodOptional<z.ZodType<DesktopDeferredNoticeState, z.ZodTypeDef, unknown>>;
45
+ }, "strict", z.ZodTypeAny, {
46
+ eventId: string;
47
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
48
+ timestamp: string;
49
+ payloadJson: string;
50
+ notice?: DesktopDeferredNoticeState | undefined;
51
+ }, {
52
+ eventId: string;
53
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
54
+ timestamp: string;
55
+ payloadJson: string;
56
+ notice?: unknown;
57
+ }>, "many">;
58
+ }, "strict", z.ZodTypeAny, {
59
+ kind: "DEFERRED_INPUTS";
60
+ entries: {
61
+ eventId: string;
62
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
63
+ timestamp: string;
64
+ payloadJson: string;
65
+ notice?: DesktopDeferredNoticeState | undefined;
66
+ }[];
67
+ sessionId: string;
68
+ sessionGenerationId: string;
69
+ schemaVersion: 1;
70
+ provider: "agy" | "claude" | "codex";
71
+ operationId: string;
72
+ nativeSessionSha256: string;
73
+ }, {
74
+ kind: "DEFERRED_INPUTS";
75
+ entries: {
76
+ eventId: string;
77
+ type: "USER_PROMPT" | "PROMPT_RESPONSE";
78
+ timestamp: string;
79
+ payloadJson: string;
80
+ notice?: unknown;
81
+ }[];
82
+ sessionId: string;
83
+ sessionGenerationId: string;
84
+ schemaVersion: 1;
85
+ provider: "agy" | "claude" | "codex";
86
+ operationId: string;
87
+ nativeSessionSha256: string;
88
+ }>;
89
+ export type DesktopDeferredInput = z.infer<typeof item>;
90
+ export type DesktopDeferredInputRecord = z.infer<typeof row>;
91
+ export interface DesktopDeferredInputStore {
92
+ read(): Promise<readonly DesktopDeferredInput[]>;
93
+ /** Missing expected hash means create-only. Use desktopDeferredInputSha256 on the last read. */
94
+ put(input: DesktopDeferredInput, expectedPayloadSha256?: string): Promise<void>;
95
+ remove(target: Pick<DesktopDeferredInput, 'eventId' | 'timestamp' | 'type'>, expectedPayloadSha256?: string): Promise<void>;
96
+ /** Serialize terminal handoff/recovery across processes. Read fresh inside. */
97
+ runExclusive<T>(callback: (assertOwnership: () => Promise<void>) => Promise<T>): Promise<T>;
98
+ }
99
+ export declare function decodeDeferredInputs(value: unknown): DesktopDeferredInputRecord;
100
+ /** Preserve the existing payload-only token for entries without a notice. */
101
+ export declare function desktopDeferredInputSha256(input: DesktopDeferredInput): string;
102
+ export declare function snapshotDeferredInput(value: DesktopDeferredInput): DesktopDeferredInput;
103
+ export declare function deferredScopeMatches(row: DesktopDeferredInputRecord, scope: DesktopSyncSessionScope): boolean;
104
+ export {};