@quantiya/codevibe-codex-plugin 2.0.64 → 2.0.66
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/server.js +38 -36
- package/node_modules/@quantiya/codevibe-core/dist/appsync/appsync-client.d.ts +302 -8
- package/node_modules/@quantiya/codevibe-core/dist/appsync/index.d.ts +25 -1
- package/node_modules/@quantiya/codevibe-core/dist/appsync/queries.d.ts +10 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/standalone-companion-status.d.ts +6 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-deferred-inputs.d.ts +104 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-desktop-registration.d.ts +133 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-event-client.d.ts +110 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-inbound-journal.d.ts +142 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-input-delivery.d.ts +13 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-live-connection.d.ts +87 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-mobile-echo.d.ts +289 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-operation-journal.d.ts +236 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-prompt-publication.d.ts +153 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-prompt-resolution.d.ts +38 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-prompt-retention.d.ts +99 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-read-client.d.ts +131 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-resolution-recovery.d.ts +29 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-security-posture.d.ts +32 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-session-retirement.d.ts +30 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-shell-source.d.ts +151 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-source-cursor.d.ts +529 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-source-file.d.ts +33 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-source-pair.d.ts +33 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-state.d.ts +51 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-usage-warning.d.ts +33 -0
- package/node_modules/@quantiya/codevibe-core/dist/appsync/sync-workspace-outcome.d.ts +23 -0
- package/node_modules/@quantiya/codevibe-core/dist/config/config.d.ts +3 -0
- package/node_modules/@quantiya/codevibe-core/dist/credential-broker/oauth-account-lock.d.ts +4 -0
- package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +26 -0
- package/node_modules/@quantiya/codevibe-core/dist/index.js +584 -537
- package/node_modules/@quantiya/codevibe-core/dist/local-executor/local-executor-impl.d.ts +11 -11
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.d.ts +9 -4
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.js +50678 -44643
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/OrchestrationApp.d.ts +6 -0
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/StatusBar.d.ts +2 -0
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/decision-attempt-recovery.d.ts +2 -0
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/emit-shell-event.d.ts +31 -8
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/gate-prompts.d.ts +4 -0
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/index.d.ts +8 -7
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/planner-offer-e1.d.ts +5 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/quorum-loop.d.ts +9 -2
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/shell-sync-recovery.d.ts +23 -0
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/slash-routes/reviewers.d.ts +3 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/types.d.ts +8 -8
- package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/workspace-terminal-coordinator.d.ts +1 -1
- package/node_modules/@quantiya/codevibe-core/dist/planner/types.d.ts +2 -2
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/atomic-file.d.ts +13 -3
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/consolidator.d.ts +10 -2
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/index.d.ts +1 -0
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/ledger.d.ts +17 -9
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/outbox.d.ts +20 -2
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/replay-cursor.d.ts +2 -2
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/sync-transport.d.ts +53 -0
- package/node_modules/@quantiya/codevibe-core/dist/tool-activity/types.d.ts +28 -24
- package/node_modules/@quantiya/codevibe-core/dist/types/events.d.ts +3 -0
- package/node_modules/@quantiya/codevibe-core/dist/types/reviewer.d.ts +14 -4
- package/node_modules/@quantiya/codevibe-core/package.json +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type PromptOwner = {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
promptId: string;
|
|
4
|
+
} & ({
|
|
5
|
+
producerKind: 'PLUGIN_APPROVAL';
|
|
6
|
+
ownerToken: string;
|
|
7
|
+
} | {
|
|
8
|
+
producerKind: 'CORE_OFFER';
|
|
9
|
+
sessionGenerationId: string;
|
|
10
|
+
expectedSessionKeyGen: string;
|
|
11
|
+
});
|
|
12
|
+
export type ResolveDesktopSyncPromptInput = PromptOwner & {
|
|
13
|
+
clientOperationId: string;
|
|
14
|
+
};
|
|
15
|
+
export interface SyncPromptResolutionReceipt {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
promptId: string;
|
|
18
|
+
state: 'RESOLVED';
|
|
19
|
+
controlClass: 'PROMPT_OWNERSHIP';
|
|
20
|
+
}
|
|
21
|
+
export interface PromptResolutionRecord {
|
|
22
|
+
schemaVersion: 1;
|
|
23
|
+
kind: 'PROMPT_RESOLUTION';
|
|
24
|
+
operationId: string;
|
|
25
|
+
input: ResolveDesktopSyncPromptInput;
|
|
26
|
+
}
|
|
27
|
+
/** Closed, flat ownership profiles. No content, Event source or caller proof.
|
|
28
|
+
* Copy only own data properties before any account/key/network await. */
|
|
29
|
+
export declare function snapshotSyncPromptResolution(value: unknown): ResolveDesktopSyncPromptInput;
|
|
30
|
+
/** Exact ownership deletion is idempotent by canonical marker absence. Keep a
|
|
31
|
+
* stable control identity across retries; never mint a new visible occurrence.
|
|
32
|
+
* This does not itself persist the owner's outstanding resolution intent. */
|
|
33
|
+
export declare function makeSyncPromptResolutionInput(userId: string, owner: PromptOwner): ResolveDesktopSyncPromptInput;
|
|
34
|
+
/** Encrypted local recovery record, containing ownership only, never content or
|
|
35
|
+
* a fresh signature. The original creator key signs anew at each retry. */
|
|
36
|
+
export declare function decodePromptResolution(value: unknown, userId: string, invalidRecord: () => never): PromptResolutionRecord;
|
|
37
|
+
export declare function parseSyncPromptResolutionReceipt(value: unknown, expected: ResolveDesktopSyncPromptInput): SyncPromptResolutionReceipt;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type SyncPromptRetentionReceipt } from './sync-event-client';
|
|
3
|
+
declare const schema: z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
5
|
+
kind: z.ZodLiteral<"PROMPT_RETENTION">;
|
|
6
|
+
operationId: z.ZodString;
|
|
7
|
+
sessionId: z.ZodString;
|
|
8
|
+
sessionGenerationId: z.ZodString;
|
|
9
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
10
|
+
entries: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
11
|
+
promptId: z.ZodString;
|
|
12
|
+
status: z.ZodLiteral<"REFRESHED">;
|
|
13
|
+
checkedAt: z.ZodNumber;
|
|
14
|
+
checkAfter: z.ZodNumber;
|
|
15
|
+
expiresAt: z.ZodNumber;
|
|
16
|
+
}, "strict", z.ZodTypeAny, {
|
|
17
|
+
promptId: string;
|
|
18
|
+
status: "REFRESHED";
|
|
19
|
+
expiresAt: number;
|
|
20
|
+
checkedAt: number;
|
|
21
|
+
checkAfter: number;
|
|
22
|
+
}, {
|
|
23
|
+
promptId: string;
|
|
24
|
+
status: "REFRESHED";
|
|
25
|
+
expiresAt: number;
|
|
26
|
+
checkedAt: number;
|
|
27
|
+
checkAfter: number;
|
|
28
|
+
}>, z.ZodObject<{
|
|
29
|
+
promptId: z.ZodString;
|
|
30
|
+
status: z.ZodLiteral<"RERAISE_REQUIRED">;
|
|
31
|
+
reRaiseToken: z.ZodString;
|
|
32
|
+
}, "strict", z.ZodTypeAny, {
|
|
33
|
+
promptId: string;
|
|
34
|
+
status: "RERAISE_REQUIRED";
|
|
35
|
+
reRaiseToken: string;
|
|
36
|
+
}, {
|
|
37
|
+
promptId: string;
|
|
38
|
+
status: "RERAISE_REQUIRED";
|
|
39
|
+
reRaiseToken: string;
|
|
40
|
+
}>]>, "many">;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
kind: "PROMPT_RETENTION";
|
|
43
|
+
entries: ({
|
|
44
|
+
promptId: string;
|
|
45
|
+
status: "REFRESHED";
|
|
46
|
+
expiresAt: number;
|
|
47
|
+
checkedAt: number;
|
|
48
|
+
checkAfter: number;
|
|
49
|
+
} | {
|
|
50
|
+
promptId: string;
|
|
51
|
+
status: "RERAISE_REQUIRED";
|
|
52
|
+
reRaiseToken: string;
|
|
53
|
+
})[];
|
|
54
|
+
sessionId: string;
|
|
55
|
+
sessionGenerationId: string;
|
|
56
|
+
schemaVersion: 1;
|
|
57
|
+
operationId: string;
|
|
58
|
+
cursor: string | null;
|
|
59
|
+
}, {
|
|
60
|
+
kind: "PROMPT_RETENTION";
|
|
61
|
+
entries: ({
|
|
62
|
+
promptId: string;
|
|
63
|
+
status: "REFRESHED";
|
|
64
|
+
expiresAt: number;
|
|
65
|
+
checkedAt: number;
|
|
66
|
+
checkAfter: number;
|
|
67
|
+
} | {
|
|
68
|
+
promptId: string;
|
|
69
|
+
status: "RERAISE_REQUIRED";
|
|
70
|
+
reRaiseToken: string;
|
|
71
|
+
})[];
|
|
72
|
+
sessionId: string;
|
|
73
|
+
sessionGenerationId: string;
|
|
74
|
+
schemaVersion: 1;
|
|
75
|
+
operationId: string;
|
|
76
|
+
cursor: string | null;
|
|
77
|
+
}>;
|
|
78
|
+
export type PromptRetentionRecord = z.infer<typeof schema>;
|
|
79
|
+
export type PromptReRaiseDisposition = 'RERAISED' | 'CLOSED' | 'OMITTED' | 'RETRY';
|
|
80
|
+
export declare function decodePromptRetention(value: unknown): PromptRetentionRecord;
|
|
81
|
+
export interface PromptRetentionJournal {
|
|
82
|
+
run(promptIds: readonly string[], refresh: (promptId: string) => Promise<SyncPromptRetentionReceipt>, reRaise: (promptId: string, reRaiseToken: string) => Promise<PromptReRaiseDisposition>, now?: () => number): Promise<void>;
|
|
83
|
+
/** Only after the exact session is canonically INACTIVE and work is joined. */
|
|
84
|
+
remove(): Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
interface Store {
|
|
87
|
+
read(): Promise<PromptRetentionRecord>;
|
|
88
|
+
write(row: PromptRetentionRecord): Promise<void>;
|
|
89
|
+
remove(): Promise<void>;
|
|
90
|
+
runExclusive<T>(fn: (fence: () => Promise<void>) => Promise<T>): Promise<T>;
|
|
91
|
+
}
|
|
92
|
+
/** One bounded encrypted record per session incarnation. Cursor advances BEFORE
|
|
93
|
+
* network I/O; a failed target cannot monopolize each subsequent batch. Absence
|
|
94
|
+
* is persisted BEFORE re-raise, and cleared only after its idempotent producer
|
|
95
|
+
* acknowledges success or confirms closure. Unknown/temporarily missing local
|
|
96
|
+
* prompts are not resurrected. Their absence receipts wait for owner recovery.
|
|
97
|
+
*/
|
|
98
|
+
export declare function createPromptRetentionJournal(store: Store): PromptRetentionJournal;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type DeviceSigningKey } from '../local-executor/class-a-sign';
|
|
2
|
+
import type { DesktopSyncSessionScope } from './sync-operation-journal';
|
|
3
|
+
import { type SyncResolutionScope, type SyncResolutionResult } from './sync-resolution-recovery';
|
|
4
|
+
export declare class SyncReadClientError extends Error {
|
|
5
|
+
readonly code: 'INVALID_SYNC_READ_INPUT' | 'INVALID_SYNC_READ_RESPONSE' | 'SYNC_READ_UNAVAILABLE';
|
|
6
|
+
readonly backendCode?: string | undefined;
|
|
7
|
+
readonly retryAfterMs?: number | undefined;
|
|
8
|
+
constructor(code: 'INVALID_SYNC_READ_INPUT' | 'INVALID_SYNC_READ_RESPONSE' | 'SYNC_READ_UNAVAILABLE', backendCode?: string | undefined, retryAfterMs?: number | undefined);
|
|
9
|
+
}
|
|
10
|
+
/** Shared closed error envelope for HTTP and authenticated socket receipts. */
|
|
11
|
+
export declare function syncReadResponseError(value: unknown): SyncReadClientError;
|
|
12
|
+
export interface DesktopSyncRegistrationAttempt {
|
|
13
|
+
clientOperationId: string;
|
|
14
|
+
issuedAtEpochMs: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DesktopSyncReadCredential extends DesktopSyncSessionScope {
|
|
17
|
+
credential: string;
|
|
18
|
+
expiresAtEpochMs: number;
|
|
19
|
+
}
|
|
20
|
+
/** Stored encrypted Event shape, NOT the decrypted GraphQL/UI Event shape. */
|
|
21
|
+
export type SyncReadEvent = Readonly<Record<string, unknown> & {
|
|
22
|
+
eventId: string;
|
|
23
|
+
sessionId: string;
|
|
24
|
+
sessionGenerationId: string;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
type: string;
|
|
27
|
+
source: 'DESKTOP' | 'MOBILE';
|
|
28
|
+
}>;
|
|
29
|
+
export interface SyncHistoryPage extends DesktopSyncSessionScope {
|
|
30
|
+
version: 1;
|
|
31
|
+
items: readonly SyncReadEvent[];
|
|
32
|
+
nextToken: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface SyncInputCoordinate {
|
|
35
|
+
eventId: string;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
}
|
|
38
|
+
export interface SyncPendingInputsPage extends DesktopSyncSessionScope {
|
|
39
|
+
version: 1;
|
|
40
|
+
kind: 'PENDING_INPUTS';
|
|
41
|
+
items: readonly Readonly<SyncInputCoordinate>[];
|
|
42
|
+
nextToken: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface SyncLegacyPendingInputsPage extends DesktopSyncSessionScope {
|
|
45
|
+
version: 1;
|
|
46
|
+
kind: 'LEGACY_PENDING_INPUTS';
|
|
47
|
+
items: readonly Readonly<SyncInputCoordinate>[];
|
|
48
|
+
nextToken: string | null;
|
|
49
|
+
}
|
|
50
|
+
export interface SyncRecoveryTarget {
|
|
51
|
+
eventId: string;
|
|
52
|
+
timestamp: string;
|
|
53
|
+
eventRevision: string;
|
|
54
|
+
eventSha256: string;
|
|
55
|
+
}
|
|
56
|
+
export interface SyncExecutedInput extends DesktopSyncSessionScope {
|
|
57
|
+
eventId: string;
|
|
58
|
+
timestamp: string;
|
|
59
|
+
source: 'MOBILE';
|
|
60
|
+
type: string;
|
|
61
|
+
deliveryStatus: 'EXECUTED';
|
|
62
|
+
}
|
|
63
|
+
export interface DesktopSyncSocketProof {
|
|
64
|
+
input: Readonly<Record<string, unknown>>;
|
|
65
|
+
headers?: Readonly<Record<string, string>>;
|
|
66
|
+
}
|
|
67
|
+
/** One explicit request per operation: never auto-page, auto-register, retry an
|
|
68
|
+
* exact-fetch capability, or fall back to unmetered AppSync history. The caller
|
|
69
|
+
* owns durable registration intent and credential lifetime. Endpoints come
|
|
70
|
+
* from deployment configuration, not Event/notification/customer payloads. */
|
|
71
|
+
export declare class DesktopSyncReadClient {
|
|
72
|
+
private readonly deps;
|
|
73
|
+
private readonly endpoint;
|
|
74
|
+
private readonly scope;
|
|
75
|
+
constructor(deps: {
|
|
76
|
+
endpoint: string;
|
|
77
|
+
userId: string;
|
|
78
|
+
sessionScope: DesktopSyncSessionScope;
|
|
79
|
+
assertAccount(): void;
|
|
80
|
+
getToken(signal?: AbortSignal): Promise<string>;
|
|
81
|
+
getSigningKey(): Promise<DeviceSigningKey>;
|
|
82
|
+
fetch?: typeof globalThis.fetch;
|
|
83
|
+
now?: () => number;
|
|
84
|
+
resolutionQuery?(input: SyncResolutionScope & {
|
|
85
|
+
desktopProof: string;
|
|
86
|
+
}, signal?: AbortSignal): Promise<unknown>;
|
|
87
|
+
});
|
|
88
|
+
private now;
|
|
89
|
+
private fence;
|
|
90
|
+
private credential;
|
|
91
|
+
private event;
|
|
92
|
+
private request;
|
|
93
|
+
/** Same pinned identity as HTTP. CONNECT alone carries the current JWT;
|
|
94
|
+
* HELLO/HEARTBEAT are signed for the already authorized socket. */
|
|
95
|
+
socketProof(action: 'CONNECT' | 'HELLO' | 'HEARTBEAT', value: DesktopSyncReadCredential, connectionGeneration?: number, signal?: AbortSignal): Promise<DesktopSyncSocketProof>;
|
|
96
|
+
/** Persist clientOperationId BEFORE calling. A lost response retries that
|
|
97
|
+
* exact intent with a fresh signed proof time; never remint the operation. */
|
|
98
|
+
register(attempt: DesktopSyncRegistrationAttempt, signal?: AbortSignal): Promise<DesktopSyncReadCredential>;
|
|
99
|
+
history(value: DesktopSyncReadCredential, nextToken?: string, signal?: AbortSignal): Promise<SyncHistoryPage>;
|
|
100
|
+
exact(value: DesktopSyncReadCredential, target: {
|
|
101
|
+
eventId: string;
|
|
102
|
+
capability: string;
|
|
103
|
+
eventSha256: string;
|
|
104
|
+
}, signal?: AbortSignal): Promise<SyncReadEvent>;
|
|
105
|
+
/** One authenticated control query, then exactly one paid body request. A
|
|
106
|
+
* lost exact response is NOT retried: the next explicit recovery query sees
|
|
107
|
+
* a claimed capability and uses the known-coordinate history path instead. */
|
|
108
|
+
gateResolution(value: DesktopSyncReadCredential, promptId: string, signal?: AbortSignal): Promise<SyncResolutionResult>;
|
|
109
|
+
/** Discover at most 32 unexecuted input coordinates. This never reads or
|
|
110
|
+
* dispatches conversation history; each coordinate needs a fresh status read. */
|
|
111
|
+
pendingInputs(value: DesktopSyncReadCredential, nextToken?: string, signal?: AbortSignal): Promise<SyncPendingInputsPage>;
|
|
112
|
+
/** A one-time per-connection scan of old mobile prompt coordinates. Empty
|
|
113
|
+
* pages may have a cursor because the bounded server scan can evaluate 32
|
|
114
|
+
* non-input/already-executed Events without returning any handoff body. */
|
|
115
|
+
legacyPendingInputs(value: DesktopSyncReadCredential, nextToken?: string, signal?: AbortSignal): Promise<SyncLegacyPendingInputsPage>;
|
|
116
|
+
/** Current authenticated input only. DELIVERED is not permission to replay;
|
|
117
|
+
* the inbound journal determines whether this host ever began a handoff. */
|
|
118
|
+
pendingInput(value: DesktopSyncReadCredential, target: SyncInputCoordinate, signal?: AbortSignal): Promise<SyncReadEvent | null>;
|
|
119
|
+
/** A separate charged history request for ONE known coordinate. No reused
|
|
120
|
+
* capability, recursive page drain or dispatch of unrelated mobile inputs. */
|
|
121
|
+
recoverExact(value: DesktopSyncReadCredential, target: SyncRecoveryTarget, signal?: AbortSignal): Promise<SyncReadEvent>;
|
|
122
|
+
/** Fresh exact-coordinate authority. A newer revision is not corruption;
|
|
123
|
+
* callers still decide whether the durable handoff boundary permits replay. */
|
|
124
|
+
recoverCurrent(value: DesktopSyncReadCredential, target: SyncRecoveryTarget, signal?: AbortSignal): Promise<SyncReadEvent | null>;
|
|
125
|
+
/** A lost execution acknowledgement must NOT replay the input. Read its
|
|
126
|
+
* current canonical status via the same bounded, charged coordinate query.
|
|
127
|
+
* Return no payload: newer content can never enter the provider callback. */
|
|
128
|
+
executionReceipt(value: DesktopSyncReadCredential, target: SyncRecoveryTarget, signal?: AbortSignal): Promise<SyncExecutedInput | null>;
|
|
129
|
+
private targetedEvent;
|
|
130
|
+
private coordinateEvent;
|
|
131
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Event } from '../types/events';
|
|
2
|
+
export interface SyncResolutionScope {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
sessionGenerationId: string;
|
|
5
|
+
promptId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SyncResolutionReceipt extends SyncResolutionScope {
|
|
8
|
+
state: 'NOT_FOUND' | 'CLAIMED' | 'RESOLVED';
|
|
9
|
+
actionable: false;
|
|
10
|
+
decisionClaimId: string | null;
|
|
11
|
+
resolutionEventId: string | null;
|
|
12
|
+
resolutionTimestamp: string | null;
|
|
13
|
+
resolutionEventDigest: string | null;
|
|
14
|
+
exactFetchCapability: string | null;
|
|
15
|
+
}
|
|
16
|
+
export type SyncResolutionResult = Readonly<Pick<SyncResolutionReceipt, 'sessionId' | 'promptId' | 'state' | 'actionable' | 'decisionClaimId' | 'resolutionEventId' | 'resolutionTimestamp'> & {
|
|
17
|
+
resolutionEvent: Event | null;
|
|
18
|
+
}>;
|
|
19
|
+
/** Keep the existing strict dispatch contract; transport credentials and digest
|
|
20
|
+
* are consumed by verification, never forwarded as new effect authority. */
|
|
21
|
+
export declare function syncResolutionResult(receipt: SyncResolutionReceipt, resolutionEvent: Event | null): SyncResolutionResult;
|
|
22
|
+
export declare function validateSyncResolutionScope(scope: SyncResolutionScope, invalid: () => never): void;
|
|
23
|
+
/** A V2 control receipt contains no Event. Never accept an embedded payload or
|
|
24
|
+
* infer generation from a mutable Session lookup during cold-start recovery. */
|
|
25
|
+
export declare function parseSyncResolutionReceipt(value: unknown, scope: SyncResolutionScope, invalid: () => never): Readonly<SyncResolutionReceipt>;
|
|
26
|
+
/** Verify immutable decision fields BEFORE decoding metadata. Mutable
|
|
27
|
+
* publication/accounting/index state is never part of this wire document.
|
|
28
|
+
* Legacy native rows may omit authority stamps; none are synthesized. */
|
|
29
|
+
export declare function verifySyncResolutionDocument(value: unknown, receipt: SyncResolutionReceipt, invalid: () => never): Event;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type SyncSecurityPosture = 'ISOLATION_OFF' | 'COARSE_EGRESS';
|
|
2
|
+
export type SyncSecurityPostureInput = {
|
|
3
|
+
clientOperationId: string;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
sessionGenerationId: string;
|
|
6
|
+
expectedSessionKeyGen: string;
|
|
7
|
+
posture: SyncSecurityPosture;
|
|
8
|
+
};
|
|
9
|
+
export interface SyncSecurityPostureReceipt {
|
|
10
|
+
schemaVersion: 1;
|
|
11
|
+
kind: 'SECURITY_POSTURE';
|
|
12
|
+
state: 'RECORDED';
|
|
13
|
+
sessionId: string;
|
|
14
|
+
sessionGenerationId: string;
|
|
15
|
+
posture: SyncSecurityPosture;
|
|
16
|
+
noticeId: string;
|
|
17
|
+
delivery: {
|
|
18
|
+
state: 'ATTEMPTED' | 'REPLAY_NO_SEND';
|
|
19
|
+
outcomes: Array<{
|
|
20
|
+
installationId: string;
|
|
21
|
+
outcome: 'SUBMITTED' | 'STALE_RECIPIENT' | 'ATTEMPT_UNCONFIRMED';
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Stable signed fact, not an Event or a client-controlled notice body. The
|
|
26
|
+
* canonical server identity ignores operation-ID changes within this posture. */
|
|
27
|
+
export declare function makeSyncSecurityPostureInput(userId: string, scope: Omit<SyncSecurityPostureInput, 'clientOperationId'>): SyncSecurityPostureInput;
|
|
28
|
+
export declare function syncSecurityPostureNoticeId(input: Pick<SyncSecurityPostureInput, 'sessionId' | 'sessionGenerationId' | 'posture'>): string;
|
|
29
|
+
/** RECORDED proves canonical persistence only. SUBMITTED is transport
|
|
30
|
+
* acceptance, never a phone/render acknowledgment. An ambiguous delivery or
|
|
31
|
+
* replay remains explicitly visible in the returned receipt, not retried. */
|
|
32
|
+
export declare function parseSyncSecurityPostureReceipt(value: unknown, expected: SyncSecurityPostureInput): SyncSecurityPostureReceipt;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ConfirmDesktopSyncRetirementInput = {
|
|
2
|
+
clientOperationId: string;
|
|
3
|
+
sessionId: string;
|
|
4
|
+
sessionGenerationId: string;
|
|
5
|
+
expectedSessionKeyGen: string;
|
|
6
|
+
};
|
|
7
|
+
export type SyncSessionRetirementReceipt = ConfirmDesktopSyncRetirementInput & {
|
|
8
|
+
state: 'RETIRED';
|
|
9
|
+
controlClass: 'SESSION_RETIREMENT';
|
|
10
|
+
};
|
|
11
|
+
export interface ToolSyncRetirementLocation {
|
|
12
|
+
agent: 'codex' | 'claude';
|
|
13
|
+
root: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SessionRetirementRecord {
|
|
16
|
+
schemaVersion: 1;
|
|
17
|
+
kind: 'SESSION_RETIREMENT';
|
|
18
|
+
operationId: string;
|
|
19
|
+
input: ConfirmDesktopSyncRetirementInput;
|
|
20
|
+
toolOutbox: ToolSyncRetirementLocation | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function snapshotSyncSessionRetirement(value: unknown): ConfirmDesktopSyncRetirementInput;
|
|
23
|
+
/** Stable proof-request identity only: this is not an Event operation ID and
|
|
24
|
+
* cannot settle, refund or relabel an Event's delivery outcome. */
|
|
25
|
+
export declare function makeSyncSessionRetirementInput(userId: string, scope: Omit<ConfirmDesktopSyncRetirementInput, 'clientOperationId'>): ConfirmDesktopSyncRetirementInput;
|
|
26
|
+
export declare function parseSyncSessionRetirementReceipt(value: unknown, expected: ConfirmDesktopSyncRetirementInput): SyncSessionRetirementReceipt;
|
|
27
|
+
/** The terminal owner writes this encrypted intent only AFTER stop/join. It is
|
|
28
|
+
* discovery/ordering state, not cached permission: every recovery still needs
|
|
29
|
+
* fresh cloud retirement proof before deleting source payload. */
|
|
30
|
+
export declare function decodeSessionRetirement(value: unknown, userId: string, bad: () => never): SessionRetirementRecord;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type CreateDesktopSyncEventInput } from './sync-event-client';
|
|
3
|
+
import type { DesktopSyncSessionScope, DurableSyncResult } from './sync-operation-journal';
|
|
4
|
+
declare const ticketSchema: z.ZodObject<{
|
|
5
|
+
sourceId: z.ZodString;
|
|
6
|
+
sequence: z.ZodNumber;
|
|
7
|
+
operationId: z.ZodString;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
operationId: string;
|
|
10
|
+
sourceId: string;
|
|
11
|
+
sequence: number;
|
|
12
|
+
}, {
|
|
13
|
+
operationId: string;
|
|
14
|
+
sourceId: string;
|
|
15
|
+
sequence: number;
|
|
16
|
+
}>;
|
|
17
|
+
declare const schema: z.ZodObject<{
|
|
18
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
19
|
+
kind: z.ZodLiteral<"SHELL_SOURCE">;
|
|
20
|
+
operationId: z.ZodString;
|
|
21
|
+
sessionId: z.ZodString;
|
|
22
|
+
sessionGenerationId: z.ZodString;
|
|
23
|
+
nextSequence: z.ZodNumber;
|
|
24
|
+
settledThrough: z.ZodNumber;
|
|
25
|
+
entries: z.ZodArray<z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
|
|
26
|
+
sequence: z.ZodNumber;
|
|
27
|
+
operationId: z.ZodString;
|
|
28
|
+
state: z.ZodLiteral<"STAGED">;
|
|
29
|
+
input: z.ZodUnknown;
|
|
30
|
+
}, "strict", z.ZodTypeAny, {
|
|
31
|
+
state: "STAGED";
|
|
32
|
+
operationId: string;
|
|
33
|
+
sequence: number;
|
|
34
|
+
input?: unknown;
|
|
35
|
+
}, {
|
|
36
|
+
state: "STAGED";
|
|
37
|
+
operationId: string;
|
|
38
|
+
sequence: number;
|
|
39
|
+
input?: unknown;
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
sequence: z.ZodNumber;
|
|
42
|
+
operationId: z.ZodString;
|
|
43
|
+
state: z.ZodLiteral<"OMITTED">;
|
|
44
|
+
fingerprint: z.ZodString;
|
|
45
|
+
}, "strict", z.ZodTypeAny, {
|
|
46
|
+
state: "OMITTED";
|
|
47
|
+
fingerprint: string;
|
|
48
|
+
operationId: string;
|
|
49
|
+
sequence: number;
|
|
50
|
+
}, {
|
|
51
|
+
state: "OMITTED";
|
|
52
|
+
fingerprint: string;
|
|
53
|
+
operationId: string;
|
|
54
|
+
sequence: number;
|
|
55
|
+
}>, z.ZodObject<{
|
|
56
|
+
sequence: z.ZodNumber;
|
|
57
|
+
operationId: z.ZodString;
|
|
58
|
+
state: z.ZodLiteral<"SETTLED">;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
state: "SETTLED";
|
|
61
|
+
operationId: string;
|
|
62
|
+
sequence: number;
|
|
63
|
+
}, {
|
|
64
|
+
state: "SETTLED";
|
|
65
|
+
operationId: string;
|
|
66
|
+
sequence: number;
|
|
67
|
+
}>]>, "many">;
|
|
68
|
+
}, "strict", z.ZodTypeAny, {
|
|
69
|
+
kind: "SHELL_SOURCE";
|
|
70
|
+
entries: ({
|
|
71
|
+
state: "STAGED";
|
|
72
|
+
operationId: string;
|
|
73
|
+
sequence: number;
|
|
74
|
+
input?: unknown;
|
|
75
|
+
} | {
|
|
76
|
+
state: "OMITTED";
|
|
77
|
+
fingerprint: string;
|
|
78
|
+
operationId: string;
|
|
79
|
+
sequence: number;
|
|
80
|
+
} | {
|
|
81
|
+
state: "SETTLED";
|
|
82
|
+
operationId: string;
|
|
83
|
+
sequence: number;
|
|
84
|
+
})[];
|
|
85
|
+
sessionId: string;
|
|
86
|
+
sessionGenerationId: string;
|
|
87
|
+
schemaVersion: 1;
|
|
88
|
+
operationId: string;
|
|
89
|
+
nextSequence: number;
|
|
90
|
+
settledThrough: number;
|
|
91
|
+
}, {
|
|
92
|
+
kind: "SHELL_SOURCE";
|
|
93
|
+
entries: ({
|
|
94
|
+
state: "STAGED";
|
|
95
|
+
operationId: string;
|
|
96
|
+
sequence: number;
|
|
97
|
+
input?: unknown;
|
|
98
|
+
} | {
|
|
99
|
+
state: "OMITTED";
|
|
100
|
+
fingerprint: string;
|
|
101
|
+
operationId: string;
|
|
102
|
+
sequence: number;
|
|
103
|
+
} | {
|
|
104
|
+
state: "SETTLED";
|
|
105
|
+
operationId: string;
|
|
106
|
+
sequence: number;
|
|
107
|
+
})[];
|
|
108
|
+
sessionId: string;
|
|
109
|
+
sessionGenerationId: string;
|
|
110
|
+
schemaVersion: 1;
|
|
111
|
+
operationId: string;
|
|
112
|
+
nextSequence: number;
|
|
113
|
+
settledThrough: number;
|
|
114
|
+
}>;
|
|
115
|
+
export type ShellSyncSourceRecord = z.infer<typeof schema>;
|
|
116
|
+
export type ShellSyncTicket = z.infer<typeof ticketSchema>;
|
|
117
|
+
export type ShellSyncSourceInventory = DesktopSyncSessionScope & {
|
|
118
|
+
sourceId: string;
|
|
119
|
+
pendingCount: number;
|
|
120
|
+
};
|
|
121
|
+
/** The source is the fsynced prepared event, not a volatile conversation entry.
|
|
122
|
+
* Each append is a NEW occurrence. Retrying that occurrence uses its ticket,
|
|
123
|
+
* never append(), re-encryption, or a hash of customer text as an event ID.
|
|
124
|
+
* A compact monotonic settlement cursor prevents old tickets being reminted.
|
|
125
|
+
*/
|
|
126
|
+
export interface ShellSyncSource {
|
|
127
|
+
append(input: CreateDesktopSyncEventInput): Promise<ShellSyncTicket>;
|
|
128
|
+
/** Complete an already-durable settlement/ack, without any cloud send. */
|
|
129
|
+
recover(): Promise<void>;
|
|
130
|
+
/** Null means this ticket was already durably settled, not a delivery claim. */
|
|
131
|
+
deliver(ticket: ShellSyncTicket, signal?: AbortSignal): Promise<DurableSyncResult | null>;
|
|
132
|
+
drain(maximum?: number, signal?: AbortSignal): Promise<number>;
|
|
133
|
+
}
|
|
134
|
+
export declare function decodeShellSyncSource(value: unknown, invalid: () => never): ShellSyncSourceRecord;
|
|
135
|
+
/** Persistence and locks are supplied by the existing bounded encrypted account store. */
|
|
136
|
+
export declare function createShellSyncSource(options: {
|
|
137
|
+
id: string;
|
|
138
|
+
scope: Readonly<DesktopSyncSessionScope>;
|
|
139
|
+
invalid(): never;
|
|
140
|
+
full(): never;
|
|
141
|
+
collision(): never;
|
|
142
|
+
locked<T>(fn: (assertOwnership: () => Promise<void>) => Promise<T>): Promise<T>;
|
|
143
|
+
drainLocked<T>(fn: () => Promise<T>): Promise<T>;
|
|
144
|
+
read(): Promise<ShellSyncSourceRecord | null>;
|
|
145
|
+
write(row: ShellSyncSourceRecord): Promise<void>;
|
|
146
|
+
prepare(input: CreateDesktopSyncEventInput): Promise<string>;
|
|
147
|
+
omitNewPayload?(): Promise<boolean>;
|
|
148
|
+
retry(id: string, signal?: AbortSignal): Promise<DurableSyncResult>;
|
|
149
|
+
acknowledge(id: string): Promise<void>;
|
|
150
|
+
}): ShellSyncSource;
|
|
151
|
+
export {};
|