@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,529 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CreateDesktopSyncEventInput } from './sync-event-client';
|
|
3
|
+
import type { DesktopSyncSessionScope, DesktopSyncSourceIdentity, DurableSyncResult } from './sync-operation-journal';
|
|
4
|
+
export type DesktopSyncSourceStream = Pick<DesktopSyncSourceIdentity, 'provider' | 'streamSha256'>;
|
|
5
|
+
export declare const MAX_SYNC_SOURCE_ANCHOR_BYTES: number;
|
|
6
|
+
export interface DesktopSyncSourceAnchor {
|
|
7
|
+
startOffset: number;
|
|
8
|
+
endOffset: number;
|
|
9
|
+
sha256: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DesktopSyncSourceFrame extends DesktopSyncSourceIdentity {
|
|
12
|
+
startOffset: number;
|
|
13
|
+
endOffset: number;
|
|
14
|
+
anchor?: DesktopSyncSourceAnchor;
|
|
15
|
+
}
|
|
16
|
+
export interface DesktopSyncSourcePosition {
|
|
17
|
+
byteOffset: number;
|
|
18
|
+
anchor: DesktopSyncSourceAnchor | null;
|
|
19
|
+
discardUntilNewline: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface DesktopSyncSourceGap {
|
|
22
|
+
startOffset: number;
|
|
23
|
+
endOffset: number;
|
|
24
|
+
anchor: DesktopSyncSourceAnchor;
|
|
25
|
+
reason: 'BACKLOG_LIMIT' | 'OVERSIZED_RECORD' | 'PARTIAL_RECORD' | 'MALFORMED_RECORD' | 'EMPTY_RECORD';
|
|
26
|
+
discardUntilNewline: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const schema: z.ZodObject<{
|
|
29
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
30
|
+
kind: z.ZodLiteral<"SOURCE_CURSOR">;
|
|
31
|
+
operationId: z.ZodString;
|
|
32
|
+
sessionId: z.ZodString;
|
|
33
|
+
sessionGenerationId: z.ZodString;
|
|
34
|
+
provider: z.ZodEnum<["codex", "claude", "agy"]>;
|
|
35
|
+
streamSha256: z.ZodString;
|
|
36
|
+
byteOffset: z.ZodNumber;
|
|
37
|
+
anchor: z.ZodNullable<z.ZodEffects<z.ZodObject<{
|
|
38
|
+
startOffset: z.ZodNumber;
|
|
39
|
+
endOffset: z.ZodNumber;
|
|
40
|
+
sha256: z.ZodString;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
sha256: string;
|
|
43
|
+
startOffset: number;
|
|
44
|
+
endOffset: number;
|
|
45
|
+
}, {
|
|
46
|
+
sha256: string;
|
|
47
|
+
startOffset: number;
|
|
48
|
+
endOffset: number;
|
|
49
|
+
}>, {
|
|
50
|
+
sha256: string;
|
|
51
|
+
startOffset: number;
|
|
52
|
+
endOffset: number;
|
|
53
|
+
}, {
|
|
54
|
+
sha256: string;
|
|
55
|
+
startOffset: number;
|
|
56
|
+
endOffset: number;
|
|
57
|
+
}>>;
|
|
58
|
+
discardUntilNewline: z.ZodBoolean;
|
|
59
|
+
skippedBytes: z.ZodNumber;
|
|
60
|
+
lastGap: z.ZodNullable<z.ZodEffects<z.ZodObject<{
|
|
61
|
+
startOffset: z.ZodNumber;
|
|
62
|
+
endOffset: z.ZodNumber;
|
|
63
|
+
anchor: z.ZodEffects<z.ZodObject<{
|
|
64
|
+
startOffset: z.ZodNumber;
|
|
65
|
+
endOffset: z.ZodNumber;
|
|
66
|
+
sha256: z.ZodString;
|
|
67
|
+
}, "strict", z.ZodTypeAny, {
|
|
68
|
+
sha256: string;
|
|
69
|
+
startOffset: number;
|
|
70
|
+
endOffset: number;
|
|
71
|
+
}, {
|
|
72
|
+
sha256: string;
|
|
73
|
+
startOffset: number;
|
|
74
|
+
endOffset: number;
|
|
75
|
+
}>, {
|
|
76
|
+
sha256: string;
|
|
77
|
+
startOffset: number;
|
|
78
|
+
endOffset: number;
|
|
79
|
+
}, {
|
|
80
|
+
sha256: string;
|
|
81
|
+
startOffset: number;
|
|
82
|
+
endOffset: number;
|
|
83
|
+
}>;
|
|
84
|
+
reason: z.ZodEnum<["BACKLOG_LIMIT", "OVERSIZED_RECORD", "PARTIAL_RECORD", "MALFORMED_RECORD", "EMPTY_RECORD"]>;
|
|
85
|
+
discardUntilNewline: z.ZodBoolean;
|
|
86
|
+
}, "strict", z.ZodTypeAny, {
|
|
87
|
+
reason: "BACKLOG_LIMIT" | "OVERSIZED_RECORD" | "PARTIAL_RECORD" | "MALFORMED_RECORD" | "EMPTY_RECORD";
|
|
88
|
+
anchor: {
|
|
89
|
+
sha256: string;
|
|
90
|
+
startOffset: number;
|
|
91
|
+
endOffset: number;
|
|
92
|
+
};
|
|
93
|
+
startOffset: number;
|
|
94
|
+
endOffset: number;
|
|
95
|
+
discardUntilNewline: boolean;
|
|
96
|
+
}, {
|
|
97
|
+
reason: "BACKLOG_LIMIT" | "OVERSIZED_RECORD" | "PARTIAL_RECORD" | "MALFORMED_RECORD" | "EMPTY_RECORD";
|
|
98
|
+
anchor: {
|
|
99
|
+
sha256: string;
|
|
100
|
+
startOffset: number;
|
|
101
|
+
endOffset: number;
|
|
102
|
+
};
|
|
103
|
+
startOffset: number;
|
|
104
|
+
endOffset: number;
|
|
105
|
+
discardUntilNewline: boolean;
|
|
106
|
+
}>, {
|
|
107
|
+
reason: "BACKLOG_LIMIT" | "OVERSIZED_RECORD" | "PARTIAL_RECORD" | "MALFORMED_RECORD" | "EMPTY_RECORD";
|
|
108
|
+
anchor: {
|
|
109
|
+
sha256: string;
|
|
110
|
+
startOffset: number;
|
|
111
|
+
endOffset: number;
|
|
112
|
+
};
|
|
113
|
+
startOffset: number;
|
|
114
|
+
endOffset: number;
|
|
115
|
+
discardUntilNewline: boolean;
|
|
116
|
+
}, {
|
|
117
|
+
reason: "BACKLOG_LIMIT" | "OVERSIZED_RECORD" | "PARTIAL_RECORD" | "MALFORMED_RECORD" | "EMPTY_RECORD";
|
|
118
|
+
anchor: {
|
|
119
|
+
sha256: string;
|
|
120
|
+
startOffset: number;
|
|
121
|
+
endOffset: number;
|
|
122
|
+
};
|
|
123
|
+
startOffset: number;
|
|
124
|
+
endOffset: number;
|
|
125
|
+
discardUntilNewline: boolean;
|
|
126
|
+
}>>;
|
|
127
|
+
projection: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
128
|
+
lastFrame: z.ZodNullable<z.ZodEffects<z.ZodObject<{
|
|
129
|
+
provider: z.ZodEnum<["codex", "claude", "agy"]>;
|
|
130
|
+
streamSha256: z.ZodString;
|
|
131
|
+
occurrence: z.ZodString;
|
|
132
|
+
sourceSha256: z.ZodString;
|
|
133
|
+
} & {
|
|
134
|
+
startOffset: z.ZodNumber;
|
|
135
|
+
endOffset: z.ZodNumber;
|
|
136
|
+
anchor: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
137
|
+
startOffset: z.ZodNumber;
|
|
138
|
+
endOffset: z.ZodNumber;
|
|
139
|
+
sha256: z.ZodString;
|
|
140
|
+
}, "strict", z.ZodTypeAny, {
|
|
141
|
+
sha256: string;
|
|
142
|
+
startOffset: number;
|
|
143
|
+
endOffset: number;
|
|
144
|
+
}, {
|
|
145
|
+
sha256: string;
|
|
146
|
+
startOffset: number;
|
|
147
|
+
endOffset: number;
|
|
148
|
+
}>, {
|
|
149
|
+
sha256: string;
|
|
150
|
+
startOffset: number;
|
|
151
|
+
endOffset: number;
|
|
152
|
+
}, {
|
|
153
|
+
sha256: string;
|
|
154
|
+
startOffset: number;
|
|
155
|
+
endOffset: number;
|
|
156
|
+
}>>;
|
|
157
|
+
}, "strict", z.ZodTypeAny, {
|
|
158
|
+
provider: "agy" | "claude" | "codex";
|
|
159
|
+
streamSha256: string;
|
|
160
|
+
occurrence: string;
|
|
161
|
+
sourceSha256: string;
|
|
162
|
+
startOffset: number;
|
|
163
|
+
endOffset: number;
|
|
164
|
+
anchor?: {
|
|
165
|
+
sha256: string;
|
|
166
|
+
startOffset: number;
|
|
167
|
+
endOffset: number;
|
|
168
|
+
} | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
provider: "agy" | "claude" | "codex";
|
|
171
|
+
streamSha256: string;
|
|
172
|
+
occurrence: string;
|
|
173
|
+
sourceSha256: string;
|
|
174
|
+
startOffset: number;
|
|
175
|
+
endOffset: number;
|
|
176
|
+
anchor?: {
|
|
177
|
+
sha256: string;
|
|
178
|
+
startOffset: number;
|
|
179
|
+
endOffset: number;
|
|
180
|
+
} | undefined;
|
|
181
|
+
}>, {
|
|
182
|
+
provider: "agy" | "claude" | "codex";
|
|
183
|
+
streamSha256: string;
|
|
184
|
+
occurrence: string;
|
|
185
|
+
sourceSha256: string;
|
|
186
|
+
startOffset: number;
|
|
187
|
+
endOffset: number;
|
|
188
|
+
anchor?: {
|
|
189
|
+
sha256: string;
|
|
190
|
+
startOffset: number;
|
|
191
|
+
endOffset: number;
|
|
192
|
+
} | undefined;
|
|
193
|
+
}, {
|
|
194
|
+
provider: "agy" | "claude" | "codex";
|
|
195
|
+
streamSha256: string;
|
|
196
|
+
occurrence: string;
|
|
197
|
+
sourceSha256: string;
|
|
198
|
+
startOffset: number;
|
|
199
|
+
endOffset: number;
|
|
200
|
+
anchor?: {
|
|
201
|
+
sha256: string;
|
|
202
|
+
startOffset: number;
|
|
203
|
+
endOffset: number;
|
|
204
|
+
} | undefined;
|
|
205
|
+
}>>;
|
|
206
|
+
entries: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
207
|
+
frame: z.ZodEffects<z.ZodObject<{
|
|
208
|
+
provider: z.ZodEnum<["codex", "claude", "agy"]>;
|
|
209
|
+
streamSha256: z.ZodString;
|
|
210
|
+
occurrence: z.ZodString;
|
|
211
|
+
sourceSha256: z.ZodString;
|
|
212
|
+
} & {
|
|
213
|
+
startOffset: z.ZodNumber;
|
|
214
|
+
endOffset: z.ZodNumber;
|
|
215
|
+
anchor: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
216
|
+
startOffset: z.ZodNumber;
|
|
217
|
+
endOffset: z.ZodNumber;
|
|
218
|
+
sha256: z.ZodString;
|
|
219
|
+
}, "strict", z.ZodTypeAny, {
|
|
220
|
+
sha256: string;
|
|
221
|
+
startOffset: number;
|
|
222
|
+
endOffset: number;
|
|
223
|
+
}, {
|
|
224
|
+
sha256: string;
|
|
225
|
+
startOffset: number;
|
|
226
|
+
endOffset: number;
|
|
227
|
+
}>, {
|
|
228
|
+
sha256: string;
|
|
229
|
+
startOffset: number;
|
|
230
|
+
endOffset: number;
|
|
231
|
+
}, {
|
|
232
|
+
sha256: string;
|
|
233
|
+
startOffset: number;
|
|
234
|
+
endOffset: number;
|
|
235
|
+
}>>;
|
|
236
|
+
}, "strict", z.ZodTypeAny, {
|
|
237
|
+
provider: "agy" | "claude" | "codex";
|
|
238
|
+
streamSha256: string;
|
|
239
|
+
occurrence: string;
|
|
240
|
+
sourceSha256: string;
|
|
241
|
+
startOffset: number;
|
|
242
|
+
endOffset: number;
|
|
243
|
+
anchor?: {
|
|
244
|
+
sha256: string;
|
|
245
|
+
startOffset: number;
|
|
246
|
+
endOffset: number;
|
|
247
|
+
} | undefined;
|
|
248
|
+
}, {
|
|
249
|
+
provider: "agy" | "claude" | "codex";
|
|
250
|
+
streamSha256: string;
|
|
251
|
+
occurrence: string;
|
|
252
|
+
sourceSha256: string;
|
|
253
|
+
startOffset: number;
|
|
254
|
+
endOffset: number;
|
|
255
|
+
anchor?: {
|
|
256
|
+
sha256: string;
|
|
257
|
+
startOffset: number;
|
|
258
|
+
endOffset: number;
|
|
259
|
+
} | undefined;
|
|
260
|
+
}>, {
|
|
261
|
+
provider: "agy" | "claude" | "codex";
|
|
262
|
+
streamSha256: string;
|
|
263
|
+
occurrence: string;
|
|
264
|
+
sourceSha256: string;
|
|
265
|
+
startOffset: number;
|
|
266
|
+
endOffset: number;
|
|
267
|
+
anchor?: {
|
|
268
|
+
sha256: string;
|
|
269
|
+
startOffset: number;
|
|
270
|
+
endOffset: number;
|
|
271
|
+
} | undefined;
|
|
272
|
+
}, {
|
|
273
|
+
provider: "agy" | "claude" | "codex";
|
|
274
|
+
streamSha256: string;
|
|
275
|
+
occurrence: string;
|
|
276
|
+
sourceSha256: string;
|
|
277
|
+
startOffset: number;
|
|
278
|
+
endOffset: number;
|
|
279
|
+
anchor?: {
|
|
280
|
+
sha256: string;
|
|
281
|
+
startOffset: number;
|
|
282
|
+
endOffset: number;
|
|
283
|
+
} | undefined;
|
|
284
|
+
}>;
|
|
285
|
+
operationId: z.ZodString;
|
|
286
|
+
state: z.ZodEnum<["PREPARING", "READY", "SETTLED"]>;
|
|
287
|
+
projectionAfter: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
288
|
+
outcome: z.ZodOptional<z.ZodEnum<["ACCEPTED", "OMITTED"]>>;
|
|
289
|
+
}, "strict", z.ZodTypeAny, {
|
|
290
|
+
state: "PREPARING" | "READY" | "SETTLED";
|
|
291
|
+
frame: {
|
|
292
|
+
provider: "agy" | "claude" | "codex";
|
|
293
|
+
streamSha256: string;
|
|
294
|
+
occurrence: string;
|
|
295
|
+
sourceSha256: string;
|
|
296
|
+
startOffset: number;
|
|
297
|
+
endOffset: number;
|
|
298
|
+
anchor?: {
|
|
299
|
+
sha256: string;
|
|
300
|
+
startOffset: number;
|
|
301
|
+
endOffset: number;
|
|
302
|
+
} | undefined;
|
|
303
|
+
};
|
|
304
|
+
operationId: string;
|
|
305
|
+
projectionAfter: string | null;
|
|
306
|
+
outcome?: "ACCEPTED" | "OMITTED" | undefined;
|
|
307
|
+
}, {
|
|
308
|
+
state: "PREPARING" | "READY" | "SETTLED";
|
|
309
|
+
frame: {
|
|
310
|
+
provider: "agy" | "claude" | "codex";
|
|
311
|
+
streamSha256: string;
|
|
312
|
+
occurrence: string;
|
|
313
|
+
sourceSha256: string;
|
|
314
|
+
startOffset: number;
|
|
315
|
+
endOffset: number;
|
|
316
|
+
anchor?: {
|
|
317
|
+
sha256: string;
|
|
318
|
+
startOffset: number;
|
|
319
|
+
endOffset: number;
|
|
320
|
+
} | undefined;
|
|
321
|
+
};
|
|
322
|
+
operationId: string;
|
|
323
|
+
projectionAfter: string | null;
|
|
324
|
+
outcome?: "ACCEPTED" | "OMITTED" | undefined;
|
|
325
|
+
}>, {
|
|
326
|
+
state: "PREPARING" | "READY" | "SETTLED";
|
|
327
|
+
frame: {
|
|
328
|
+
provider: "agy" | "claude" | "codex";
|
|
329
|
+
streamSha256: string;
|
|
330
|
+
occurrence: string;
|
|
331
|
+
sourceSha256: string;
|
|
332
|
+
startOffset: number;
|
|
333
|
+
endOffset: number;
|
|
334
|
+
anchor?: {
|
|
335
|
+
sha256: string;
|
|
336
|
+
startOffset: number;
|
|
337
|
+
endOffset: number;
|
|
338
|
+
} | undefined;
|
|
339
|
+
};
|
|
340
|
+
operationId: string;
|
|
341
|
+
projectionAfter: string | null;
|
|
342
|
+
outcome?: "ACCEPTED" | "OMITTED" | undefined;
|
|
343
|
+
}, {
|
|
344
|
+
state: "PREPARING" | "READY" | "SETTLED";
|
|
345
|
+
frame: {
|
|
346
|
+
provider: "agy" | "claude" | "codex";
|
|
347
|
+
streamSha256: string;
|
|
348
|
+
occurrence: string;
|
|
349
|
+
sourceSha256: string;
|
|
350
|
+
startOffset: number;
|
|
351
|
+
endOffset: number;
|
|
352
|
+
anchor?: {
|
|
353
|
+
sha256: string;
|
|
354
|
+
startOffset: number;
|
|
355
|
+
endOffset: number;
|
|
356
|
+
} | undefined;
|
|
357
|
+
};
|
|
358
|
+
operationId: string;
|
|
359
|
+
projectionAfter: string | null;
|
|
360
|
+
outcome?: "ACCEPTED" | "OMITTED" | undefined;
|
|
361
|
+
}>, "many">;
|
|
362
|
+
}, "strict", z.ZodTypeAny, {
|
|
363
|
+
anchor: {
|
|
364
|
+
sha256: string;
|
|
365
|
+
startOffset: number;
|
|
366
|
+
endOffset: number;
|
|
367
|
+
} | null;
|
|
368
|
+
kind: "SOURCE_CURSOR";
|
|
369
|
+
entries: {
|
|
370
|
+
state: "PREPARING" | "READY" | "SETTLED";
|
|
371
|
+
frame: {
|
|
372
|
+
provider: "agy" | "claude" | "codex";
|
|
373
|
+
streamSha256: string;
|
|
374
|
+
occurrence: string;
|
|
375
|
+
sourceSha256: string;
|
|
376
|
+
startOffset: number;
|
|
377
|
+
endOffset: number;
|
|
378
|
+
anchor?: {
|
|
379
|
+
sha256: string;
|
|
380
|
+
startOffset: number;
|
|
381
|
+
endOffset: number;
|
|
382
|
+
} | undefined;
|
|
383
|
+
};
|
|
384
|
+
operationId: string;
|
|
385
|
+
projectionAfter: string | null;
|
|
386
|
+
outcome?: "ACCEPTED" | "OMITTED" | undefined;
|
|
387
|
+
}[];
|
|
388
|
+
sessionId: string;
|
|
389
|
+
sessionGenerationId: string;
|
|
390
|
+
byteOffset: number;
|
|
391
|
+
schemaVersion: 1;
|
|
392
|
+
provider: "agy" | "claude" | "codex";
|
|
393
|
+
streamSha256: string;
|
|
394
|
+
discardUntilNewline: boolean;
|
|
395
|
+
operationId: string;
|
|
396
|
+
skippedBytes: number;
|
|
397
|
+
lastGap: {
|
|
398
|
+
reason: "BACKLOG_LIMIT" | "OVERSIZED_RECORD" | "PARTIAL_RECORD" | "MALFORMED_RECORD" | "EMPTY_RECORD";
|
|
399
|
+
anchor: {
|
|
400
|
+
sha256: string;
|
|
401
|
+
startOffset: number;
|
|
402
|
+
endOffset: number;
|
|
403
|
+
};
|
|
404
|
+
startOffset: number;
|
|
405
|
+
endOffset: number;
|
|
406
|
+
discardUntilNewline: boolean;
|
|
407
|
+
} | null;
|
|
408
|
+
projection: string | null;
|
|
409
|
+
lastFrame: {
|
|
410
|
+
provider: "agy" | "claude" | "codex";
|
|
411
|
+
streamSha256: string;
|
|
412
|
+
occurrence: string;
|
|
413
|
+
sourceSha256: string;
|
|
414
|
+
startOffset: number;
|
|
415
|
+
endOffset: number;
|
|
416
|
+
anchor?: {
|
|
417
|
+
sha256: string;
|
|
418
|
+
startOffset: number;
|
|
419
|
+
endOffset: number;
|
|
420
|
+
} | undefined;
|
|
421
|
+
} | null;
|
|
422
|
+
}, {
|
|
423
|
+
anchor: {
|
|
424
|
+
sha256: string;
|
|
425
|
+
startOffset: number;
|
|
426
|
+
endOffset: number;
|
|
427
|
+
} | null;
|
|
428
|
+
kind: "SOURCE_CURSOR";
|
|
429
|
+
entries: {
|
|
430
|
+
state: "PREPARING" | "READY" | "SETTLED";
|
|
431
|
+
frame: {
|
|
432
|
+
provider: "agy" | "claude" | "codex";
|
|
433
|
+
streamSha256: string;
|
|
434
|
+
occurrence: string;
|
|
435
|
+
sourceSha256: string;
|
|
436
|
+
startOffset: number;
|
|
437
|
+
endOffset: number;
|
|
438
|
+
anchor?: {
|
|
439
|
+
sha256: string;
|
|
440
|
+
startOffset: number;
|
|
441
|
+
endOffset: number;
|
|
442
|
+
} | undefined;
|
|
443
|
+
};
|
|
444
|
+
operationId: string;
|
|
445
|
+
projectionAfter: string | null;
|
|
446
|
+
outcome?: "ACCEPTED" | "OMITTED" | undefined;
|
|
447
|
+
}[];
|
|
448
|
+
sessionId: string;
|
|
449
|
+
sessionGenerationId: string;
|
|
450
|
+
byteOffset: number;
|
|
451
|
+
schemaVersion: 1;
|
|
452
|
+
provider: "agy" | "claude" | "codex";
|
|
453
|
+
streamSha256: string;
|
|
454
|
+
discardUntilNewline: boolean;
|
|
455
|
+
operationId: string;
|
|
456
|
+
skippedBytes: number;
|
|
457
|
+
lastGap: {
|
|
458
|
+
reason: "BACKLOG_LIMIT" | "OVERSIZED_RECORD" | "PARTIAL_RECORD" | "MALFORMED_RECORD" | "EMPTY_RECORD";
|
|
459
|
+
anchor: {
|
|
460
|
+
sha256: string;
|
|
461
|
+
startOffset: number;
|
|
462
|
+
endOffset: number;
|
|
463
|
+
};
|
|
464
|
+
startOffset: number;
|
|
465
|
+
endOffset: number;
|
|
466
|
+
discardUntilNewline: boolean;
|
|
467
|
+
} | null;
|
|
468
|
+
projection: string | null;
|
|
469
|
+
lastFrame: {
|
|
470
|
+
provider: "agy" | "claude" | "codex";
|
|
471
|
+
streamSha256: string;
|
|
472
|
+
occurrence: string;
|
|
473
|
+
sourceSha256: string;
|
|
474
|
+
startOffset: number;
|
|
475
|
+
endOffset: number;
|
|
476
|
+
anchor?: {
|
|
477
|
+
sha256: string;
|
|
478
|
+
startOffset: number;
|
|
479
|
+
endOffset: number;
|
|
480
|
+
} | undefined;
|
|
481
|
+
} | null;
|
|
482
|
+
}>;
|
|
483
|
+
export type DesktopSyncSourceCursor = z.infer<typeof schema>;
|
|
484
|
+
export type DesktopSyncSourceInventory = DesktopSyncSessionScope & DesktopSyncSourceStream & {
|
|
485
|
+
cursorId: string;
|
|
486
|
+
byteOffset: number;
|
|
487
|
+
pendingCount: number;
|
|
488
|
+
};
|
|
489
|
+
/** Internal decoder shared by direct opens and bounded restart inventory. */
|
|
490
|
+
export declare function decodeSourceCursor(value: unknown, invalid: () => never): DesktopSyncSourceCursor;
|
|
491
|
+
/** Validate the linked identities as well as the encrypted record's shape. */
|
|
492
|
+
export declare function validateSourceCursor(value: unknown, options: {
|
|
493
|
+
id: string;
|
|
494
|
+
scope: Readonly<DesktopSyncSessionScope>;
|
|
495
|
+
stream: DesktopSyncSourceStream;
|
|
496
|
+
identify(source: DesktopSyncSourceIdentity): string;
|
|
497
|
+
invalid(): never;
|
|
498
|
+
}): DesktopSyncSourceCursor;
|
|
499
|
+
export interface DesktopSyncSourceJournal {
|
|
500
|
+
/** First admission chooses a descriptor-anchored baseline; existing state is never reset. */
|
|
501
|
+
open(initial: number | DesktopSyncSourcePosition): Promise<DesktopSyncSourceCursor>;
|
|
502
|
+
load(): Promise<DesktopSyncSourceCursor | null>;
|
|
503
|
+
/** Null means an explicitly ignored source frame, not quota/network failure. */
|
|
504
|
+
admit(frame: DesktopSyncSourceFrame, prepare: ((operationId: string) => Promise<CreateDesktopSyncEventInput>) | null, projectionAfter?: string | null): Promise<string | null>;
|
|
505
|
+
/** Persist an intentional reader safety gap, never a network/quota fallback. */
|
|
506
|
+
skip(gap: DesktopSyncSourceGap): Promise<void>;
|
|
507
|
+
/** Repairs interrupted preparation/settlement without source bytes or new encryption. */
|
|
508
|
+
recover(): Promise<void>;
|
|
509
|
+
/** Bounded cloud drain, separate from native source admission. */
|
|
510
|
+
drain(maximum?: number, signal?: AbortSignal): Promise<number>;
|
|
511
|
+
}
|
|
512
|
+
/** Internal persistence capabilities; only the owning encrypted journal constructs these. */
|
|
513
|
+
export declare function createSourceJournal(options: {
|
|
514
|
+
id: string;
|
|
515
|
+
scope: Readonly<DesktopSyncSessionScope>;
|
|
516
|
+
stream: DesktopSyncSourceStream;
|
|
517
|
+
invalid(): never;
|
|
518
|
+
missing(): never;
|
|
519
|
+
locked<T>(fn: (assertOwnership: () => Promise<void>) => Promise<T>): Promise<T>;
|
|
520
|
+
drainLocked<T>(fn: () => Promise<T>): Promise<T>;
|
|
521
|
+
read(validate: (value: unknown) => DesktopSyncSourceCursor): Promise<DesktopSyncSourceCursor | null>;
|
|
522
|
+
write(value: DesktopSyncSourceCursor): Promise<void>;
|
|
523
|
+
prepare(source: DesktopSyncSourceIdentity, factory: (id: string) => Promise<CreateDesktopSyncEventInput>): Promise<string>;
|
|
524
|
+
identify(source: DesktopSyncSourceIdentity): string;
|
|
525
|
+
exists(id: string): Promise<boolean>;
|
|
526
|
+
retry(id: string, signal?: AbortSignal): Promise<DurableSyncResult>;
|
|
527
|
+
acknowledge(id: string): Promise<void>;
|
|
528
|
+
}): DesktopSyncSourceJournal;
|
|
529
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type DesktopSyncSourceAnchor, type DesktopSyncSourcePosition, type DesktopSyncSourceGap } from './sync-source-cursor';
|
|
2
|
+
export interface DesktopSyncFileIdentity {
|
|
3
|
+
filePath: string;
|
|
4
|
+
fileIdentity: Readonly<{
|
|
5
|
+
dev: number;
|
|
6
|
+
ino: number;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export interface DesktopSyncFileFrame extends DesktopSyncFileIdentity {
|
|
10
|
+
startOffset: number;
|
|
11
|
+
endOffset: number;
|
|
12
|
+
sha256: string;
|
|
13
|
+
anchor: DesktopSyncSourceAnchor;
|
|
14
|
+
}
|
|
15
|
+
export interface DesktopSyncFileAdmission<T> {
|
|
16
|
+
restore(source: Readonly<DesktopSyncFileIdentity>, initial: DesktopSyncSourcePosition): Promise<DesktopSyncSourcePosition | null>;
|
|
17
|
+
admit(event: T, source: Readonly<DesktopSyncFileFrame>): Promise<void>;
|
|
18
|
+
skip(gap: DesktopSyncSourceGap, source: Readonly<DesktopSyncFileIdentity>): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/** Bounded descriptor-based reader. Admission/fsync, not cloud delivery, advances it. */
|
|
21
|
+
export declare function readDesktopSyncFile<T>(options: {
|
|
22
|
+
filePath: string;
|
|
23
|
+
initialOffset: number;
|
|
24
|
+
admission: DesktopSyncFileAdmission<T>;
|
|
25
|
+
parse(line: string): T | null;
|
|
26
|
+
isCurrent(): boolean;
|
|
27
|
+
maxBacklogBytes?: number;
|
|
28
|
+
maxRecordBytes?: number;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
position: DesktopSyncSourcePosition;
|
|
31
|
+
size: number;
|
|
32
|
+
mtimeMs: number;
|
|
33
|
+
} | null>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CreateDesktopSyncEventInput } from './sync-event-client';
|
|
2
|
+
import type { DesktopSyncSourceFrame, DesktopSyncSourceGap, DesktopSyncSourceJournal, DesktopSyncSourcePosition, DesktopSyncSourceStream } from './sync-source-cursor';
|
|
3
|
+
type Prepare = ((operationId: string) => Promise<CreateDesktopSyncEventInput>) | null;
|
|
4
|
+
export interface DesktopSyncSourcePair {
|
|
5
|
+
/** Restore the earliest unfinished lane, never the latest volatile reader offset. */
|
|
6
|
+
open(initial: number | DesktopSyncSourcePosition): Promise<DesktopSyncSourcePosition>;
|
|
7
|
+
/** Both slots are fixed for this source's lifetime; null explicitly ignores a slot. */
|
|
8
|
+
admit(frame: DesktopSyncSourceFrame, prepare: readonly [Prepare, Prepare]): Promise<readonly [string | null, string | null]>;
|
|
9
|
+
skip(gap: DesktopSyncSourceGap): Promise<void>;
|
|
10
|
+
recover(): Promise<void>;
|
|
11
|
+
/** The bound is per lane; two lanes cannot starve each other. */
|
|
12
|
+
drain(maximumPerLane?: number, signal?: AbortSignal): Promise<number>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One native frame can carry two independently metered messages (Agy thinking
|
|
16
|
+
* and response). Each lane uses the existing encrypted cursor/operation WAL.
|
|
17
|
+
* The reader advances only after BOTH admissions; after a partial admission it
|
|
18
|
+
* resumes at the minimum cursor. The completed lane suppresses its replay even
|
|
19
|
+
* if its cloud operation was already settled and removed. There is deliberately
|
|
20
|
+
* no all-or-nothing cloud batch: each visible event has its own quota decision.
|
|
21
|
+
*
|
|
22
|
+
* Pair admission/open are serialized by the owning account's descriptor-checked
|
|
23
|
+
* lock. Cloud drain does not hold that lock. Lane identity/order is fixed here,
|
|
24
|
+
* not caller-configurable, so a mapper change cannot silently rename a cursor.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createSourcePair(options: {
|
|
27
|
+
source: DesktopSyncSourceStream;
|
|
28
|
+
lanes: readonly [DesktopSyncSourceJournal, DesktopSyncSourceJournal];
|
|
29
|
+
laneStreams: readonly [string, string];
|
|
30
|
+
locked<T>(fn: () => Promise<T>): Promise<T>;
|
|
31
|
+
invalid(): never;
|
|
32
|
+
}): DesktopSyncSourcePair;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
type Meters = 'syncUnits' | 'mobileAttachmentCount' | 'mobileAttachmentBytes';
|
|
2
|
+
type Usage = Record<`${Meters}${'Committed' | 'Reserved' | 'Limit' | 'PauseLimit'}`, string> & {
|
|
3
|
+
syncState: 'ACTIVE' | 'WARNING' | 'PAUSED';
|
|
4
|
+
usageRevision: string;
|
|
5
|
+
gapStartedAtEpochMs: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const QUOTA_PAUSED_CONTENT = "Companion sync paused. Continue on desktop. Messages omitted while paused will not be backfilled.";
|
|
8
|
+
export interface CompanionQuotaNotice {
|
|
9
|
+
schemaVersion: 1;
|
|
10
|
+
kind: 'QUOTA_PAUSED';
|
|
11
|
+
noticeId: string;
|
|
12
|
+
reasonCode: 'SYNC_QUOTA_EXHAUSTED';
|
|
13
|
+
localizationKey: 'codevibe.sync.quota_paused';
|
|
14
|
+
content: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CompanionSyncState {
|
|
17
|
+
schemaVersion: 1;
|
|
18
|
+
environment: 'development' | 'production';
|
|
19
|
+
observedAtEpochMs: number;
|
|
20
|
+
validUntilEpochMs: number;
|
|
21
|
+
entitlementVersion: string;
|
|
22
|
+
tier: 'FREE' | 'PRO' | 'MAX';
|
|
23
|
+
mode: 'LEGACY' | 'SHADOW' | 'AUTHORITATIVE' | 'ROLLBACK_FREEZE';
|
|
24
|
+
/** Cloud-selected route. FROZEN never authorizes a legacy fallback. */
|
|
25
|
+
protocol: 'LEGACY' | 'SYNC_V2' | 'FROZEN';
|
|
26
|
+
controlGeneration: number;
|
|
27
|
+
accountingGeneration: string | null;
|
|
28
|
+
periodId: string | null;
|
|
29
|
+
resetAtEpochMs: number | null;
|
|
30
|
+
limits: Record<Meters, string>;
|
|
31
|
+
usage: Usage | null;
|
|
32
|
+
/** Present exactly when the authoritative usage is PAUSED; display only. */
|
|
33
|
+
quotaNotice?: CompanionQuotaNotice;
|
|
34
|
+
}
|
|
35
|
+
/** Display feed only. Callers must never use an observed snapshot as an
|
|
36
|
+
* admission cache; writes still perform the normal cloud-authorized request. */
|
|
37
|
+
export interface CompanionSyncStateSource {
|
|
38
|
+
subscribeCompanionSyncState(userId: string, listener: (state: CompanionSyncState | null) => void): () => void;
|
|
39
|
+
getCompanionSyncState(signal?: AbortSignal): Promise<CompanionSyncState>;
|
|
40
|
+
}
|
|
41
|
+
/** Cloud authority tuple wins over response arrival time. An equal tuple may
|
|
42
|
+
* extend freshness, but cannot silently change the quota or route payload. */
|
|
43
|
+
export declare function companionSyncStateMerge(next: CompanionSyncState, previous: CompanionSyncState): 'REPLACE' | 'RETAIN' | 'CONFLICT';
|
|
44
|
+
export declare function companionSyncStateReplaces(next: CompanionSyncState, previous: CompanionSyncState): boolean;
|
|
45
|
+
export declare function companionSyncBadge(state: CompanionSyncState | null, now?: number): string | null;
|
|
46
|
+
/** Persistent usage details; wording and exact counters match the native
|
|
47
|
+
* subscription surfaces. Input is a validated, account-fenced observation. */
|
|
48
|
+
export declare function companionSyncUsageLines(state: CompanionSyncState | null, now?: number): string[];
|
|
49
|
+
/** Validate cloud state; never manufacture a tier, quota, route or empty usage. */
|
|
50
|
+
export declare function parseCompanionSyncState(value: unknown, environment: string, now?: number): CompanionSyncState;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type CompanionSyncState } from './sync-state';
|
|
2
|
+
declare const METERS: readonly ["syncUnits", "mobileAttachmentCount", "mobileAttachmentBytes"];
|
|
3
|
+
type Meter = typeof METERS[number];
|
|
4
|
+
export interface CompanionSyncUsageWarning {
|
|
5
|
+
meter: Meter;
|
|
6
|
+
committed: string;
|
|
7
|
+
reserved: string;
|
|
8
|
+
limit: string;
|
|
9
|
+
periodId: string;
|
|
10
|
+
resetDate: string;
|
|
11
|
+
}
|
|
12
|
+
/** Same closed, committed-only 80% projection and copy as both mobile apps. */
|
|
13
|
+
export declare function companionSyncUsageWarnings(state: CompanionSyncState | null, now?: number): CompanionSyncUsageWarning[];
|
|
14
|
+
export declare function companionSyncUsageWarningMessage(warnings: readonly CompanionSyncUsageWarning[]): string | null;
|
|
15
|
+
/** Installation-local advisory markers only; never admission authority. One
|
|
16
|
+
* <=4 KiB file per hashed account/environment, retaining at most three months.
|
|
17
|
+
* The existing portable lock serializes sibling TUI sessions. No OAuth path is
|
|
18
|
+
* used; ownerless/reclaim ambiguity fails only this advisory, not local work.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CompanionSyncWarningStore {
|
|
21
|
+
private readonly options;
|
|
22
|
+
private readonly root;
|
|
23
|
+
private readonly pending;
|
|
24
|
+
private closed;
|
|
25
|
+
constructor(options?: {
|
|
26
|
+
root?: string;
|
|
27
|
+
now?: () => number;
|
|
28
|
+
});
|
|
29
|
+
present(state: CompanionSyncState, userId: string, isCurrent: () => boolean, presenter: (warnings: CompanionSyncUsageWarning[]) => boolean): Promise<CompanionSyncUsageWarning[]>;
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
private run;
|
|
32
|
+
}
|
|
33
|
+
export {};
|