@indigoai-us/hq-cloud 6.16.58-alpha.5 → 6.16.58-alpha.6
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/cli/share.d.ts +14 -4
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +52 -32
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +113 -0
- package/dist/cli/share.test.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/share.d.ts
CHANGED
|
@@ -134,6 +134,12 @@ export declare function isEphemeralPath(p: string): boolean;
|
|
|
134
134
|
* (skip-excluded-policy), symmetric with the ephemeral-mirror filter above.
|
|
135
135
|
*/
|
|
136
136
|
export declare function isMalformedVaultKey(key: string): boolean;
|
|
137
|
+
declare function enableCooperativeRowVisits(): void;
|
|
138
|
+
declare function disableCooperativeRowVisits(): void;
|
|
139
|
+
declare function snapshotCooperativeRowVisits(): {
|
|
140
|
+
collect: Map<string, number>;
|
|
141
|
+
plan: Map<string, number>;
|
|
142
|
+
};
|
|
137
143
|
/**
|
|
138
144
|
* Test-only export. Kept under a `_testing` namespace so the module's public
|
|
139
145
|
* surface stays focused on `share()` / `ShareOptions` / `ShareResult` while
|
|
@@ -151,6 +157,9 @@ export declare const _testing: {
|
|
|
151
157
|
isWithinLexicalOrReal: typeof isWithinLexicalOrReal;
|
|
152
158
|
defaultConsoleLogger: typeof defaultConsoleLogger;
|
|
153
159
|
statMatchesJournal: typeof statMatchesJournal;
|
|
160
|
+
enableCooperativeRowVisits: typeof enableCooperativeRowVisits;
|
|
161
|
+
disableCooperativeRowVisits: typeof disableCooperativeRowVisits;
|
|
162
|
+
cooperativeRowVisits: typeof snapshotCooperativeRowVisits;
|
|
154
163
|
};
|
|
155
164
|
/**
|
|
156
165
|
* Stage-1 classification for a single local file in a push run. Pre-HEAD —
|
|
@@ -650,10 +659,11 @@ export declare function wrapFilterWithIgnoreVisibility(underlying: (absPath: str
|
|
|
650
659
|
/**
|
|
651
660
|
* Share local file(s) to the entity vault.
|
|
652
661
|
*
|
|
653
|
-
* A cooperative hand-off
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
662
|
+
* A cooperative hand-off yields the root lock at a drained 500-row unit, then
|
|
663
|
+
* resumes the same collection, plan, and executor instead of restarting
|
|
664
|
+
* `share()`. Journal writes stay delta-only (absence-is-deletion is the delete
|
|
665
|
+
* plan, computed once from the completed walk), so a realtime writer's rows
|
|
666
|
+
* are not dropped when this pass finalizes.
|
|
657
667
|
*/
|
|
658
668
|
export declare function share(options: ShareOptions): Promise<ShareResult>;
|
|
659
669
|
type UploadPlanItem = Extract<PushPlanItem, {
|
package/dist/cli/share.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/cli/share.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAe,YAAY,EAAE,MAAM,aAAa,CAAC;AAwBhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAqC7C,OAAO,KAAK,EAAwC,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAOL,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAML,KAAK,0BAA0B,EAChC,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAA4B,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAiEtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,sBAAsB,QACmD,CAAC;AAEv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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,iBAAS,qBAAqB,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACvC,OAAO,CAwBT;AA8HD;;;;;;;;;;;GAWG;AACH,iBAAe,YAAY,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,EAC/C,KAAK,GAAE,YAAiB,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC,CAsG3B"}
|
package/dist/cli/share.js
CHANGED
|
@@ -213,6 +213,33 @@ export function isEphemeralPath(p) {
|
|
|
213
213
|
export function isMalformedVaultKey(key) {
|
|
214
214
|
return key.includes("\\");
|
|
215
215
|
}
|
|
216
|
+
const cooperativeRowVisits = {
|
|
217
|
+
enabled: false,
|
|
218
|
+
collect: new Map(),
|
|
219
|
+
plan: new Map(),
|
|
220
|
+
};
|
|
221
|
+
function noteCooperativeRowVisit(phase, relativePath) {
|
|
222
|
+
if (!cooperativeRowVisits.enabled)
|
|
223
|
+
return;
|
|
224
|
+
const bucket = cooperativeRowVisits[phase];
|
|
225
|
+
bucket.set(relativePath, (bucket.get(relativePath) ?? 0) + 1);
|
|
226
|
+
}
|
|
227
|
+
function enableCooperativeRowVisits() {
|
|
228
|
+
cooperativeRowVisits.enabled = true;
|
|
229
|
+
cooperativeRowVisits.collect = new Map();
|
|
230
|
+
cooperativeRowVisits.plan = new Map();
|
|
231
|
+
}
|
|
232
|
+
function disableCooperativeRowVisits() {
|
|
233
|
+
cooperativeRowVisits.enabled = false;
|
|
234
|
+
cooperativeRowVisits.collect = new Map();
|
|
235
|
+
cooperativeRowVisits.plan = new Map();
|
|
236
|
+
}
|
|
237
|
+
function snapshotCooperativeRowVisits() {
|
|
238
|
+
return {
|
|
239
|
+
collect: new Map(cooperativeRowVisits.collect),
|
|
240
|
+
plan: new Map(cooperativeRowVisits.plan),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
216
243
|
/**
|
|
217
244
|
* Test-only export. Kept under a `_testing` namespace so the module's public
|
|
218
245
|
* surface stays focused on `share()` / `ShareOptions` / `ShareResult` while
|
|
@@ -230,6 +257,9 @@ export const _testing = {
|
|
|
230
257
|
isWithinLexicalOrReal,
|
|
231
258
|
defaultConsoleLogger,
|
|
232
259
|
statMatchesJournal,
|
|
260
|
+
enableCooperativeRowVisits,
|
|
261
|
+
disableCooperativeRowVisits,
|
|
262
|
+
cooperativeRowVisits: snapshotCooperativeRowVisits,
|
|
233
263
|
};
|
|
234
264
|
/** Snapshot of `absolutePath`, or null when it is missing or not a plain file. */
|
|
235
265
|
function statSnapshot(absolutePath) {
|
|
@@ -287,17 +317,11 @@ function statMatchesJournal(absolutePath, entry) {
|
|
|
287
317
|
// (journal.ts) so the pull planner applies the identical gate.
|
|
288
318
|
return journalEntryMatchesStat(entry, lstat);
|
|
289
319
|
}
|
|
290
|
-
class CooperativePushHandoff extends Error {
|
|
291
|
-
constructor() {
|
|
292
|
-
super("Realtime work ran at a settled full-push boundary");
|
|
293
|
-
this.name = "CooperativePushHandoff";
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
320
|
/**
|
|
297
321
|
* Let watcher ingress run at a bounded row cadence, then hand the full-pass
|
|
298
322
|
* scheduler a mutation-free boundary when it has realtime work waiting. The
|
|
299
|
-
*
|
|
300
|
-
*
|
|
323
|
+
* caller resumes at the next 500-row unit; collection and planning keep the
|
|
324
|
+
* snapshot they already built instead of restarting `share()`.
|
|
301
325
|
*/
|
|
302
326
|
async function yieldToCooperativeCheckpoint(work, cooperativeCheckpoint, force = false) {
|
|
303
327
|
work.rowsSinceYield += 1;
|
|
@@ -305,9 +329,8 @@ async function yieldToCooperativeCheckpoint(work, cooperativeCheckpoint, force =
|
|
|
305
329
|
return;
|
|
306
330
|
work.rowsSinceYield = 0;
|
|
307
331
|
await new Promise((resolve) => setImmediate(resolve));
|
|
308
|
-
if (cooperativeCheckpoint
|
|
309
|
-
|
|
310
|
-
}
|
|
332
|
+
if (cooperativeCheckpoint)
|
|
333
|
+
await cooperativeCheckpoint();
|
|
311
334
|
}
|
|
312
335
|
function computePushPlan(filesToShare, journal, skipUnchanged, onHeartbeat) {
|
|
313
336
|
const items = [];
|
|
@@ -469,11 +492,15 @@ async function computePushPlanCooperatively(filesToShare, journal, skipUnchanged
|
|
|
469
492
|
let filesToSkip = 0;
|
|
470
493
|
const cooperativeWork = { rowsSinceYield: 0 };
|
|
471
494
|
for (let start = 0; start < filesToShare.length; start += FULL_PUSH_COOPERATIVE_CHECKPOINT_BATCH_SIZE) {
|
|
472
|
-
const
|
|
495
|
+
const slice = filesToShare.slice(start, start + FULL_PUSH_COOPERATIVE_CHECKPOINT_BATCH_SIZE);
|
|
496
|
+
const plan = computePushPlan(slice, journal, skipUnchanged, onHeartbeat);
|
|
473
497
|
items.push(...plan.items);
|
|
474
498
|
filesToUpload += plan.filesToUpload;
|
|
475
499
|
bytesToUpload += plan.bytesToUpload;
|
|
476
500
|
filesToSkip += plan.filesToSkip;
|
|
501
|
+
for (const entry of slice) {
|
|
502
|
+
noteCooperativeRowVisit("plan", entry.relativePath);
|
|
503
|
+
}
|
|
477
504
|
await yieldToCooperativeCheckpoint(cooperativeWork, cooperativeCheckpoint, true);
|
|
478
505
|
}
|
|
479
506
|
return { items, filesToUpload, bytesToUpload, filesToSkip };
|
|
@@ -676,22 +703,14 @@ export function wrapFilterWithIgnoreVisibility(underlying, hqRoot, onIgnoreExclu
|
|
|
676
703
|
/**
|
|
677
704
|
* Share local file(s) to the entity vault.
|
|
678
705
|
*
|
|
679
|
-
* A cooperative hand-off
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
706
|
+
* A cooperative hand-off yields the root lock at a drained 500-row unit, then
|
|
707
|
+
* resumes the same collection, plan, and executor instead of restarting
|
|
708
|
+
* `share()`. Journal writes stay delta-only (absence-is-deletion is the delete
|
|
709
|
+
* plan, computed once from the completed walk), so a realtime writer's rows
|
|
710
|
+
* are not dropped when this pass finalizes.
|
|
683
711
|
*/
|
|
684
712
|
export async function share(options) {
|
|
685
|
-
|
|
686
|
-
try {
|
|
687
|
-
return await shareOnce(options);
|
|
688
|
-
}
|
|
689
|
-
catch (error) {
|
|
690
|
-
if (error instanceof CooperativePushHandoff)
|
|
691
|
-
continue;
|
|
692
|
-
throw error;
|
|
693
|
-
}
|
|
694
|
-
}
|
|
713
|
+
return shareOnce(options);
|
|
695
714
|
}
|
|
696
715
|
async function shareOnce(options) {
|
|
697
716
|
const run = await createPushRunContext(options);
|
|
@@ -2512,16 +2531,14 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2512
2531
|
queue.length === 0)) {
|
|
2513
2532
|
// Every admitted upload has settled, so `processUploadItem` has
|
|
2514
2533
|
// finished its mutable journal updates. Persist that durable unit before
|
|
2515
|
-
// yielding. Skip-only units have no new durable state;
|
|
2516
|
-
//
|
|
2534
|
+
// yielding. Skip-only units have no new durable state; resume the
|
|
2535
|
+
// remaining queue after realtime returns the lock.
|
|
2517
2536
|
if (admittedSinceCooperativeCheckpoint > 0)
|
|
2518
2537
|
flushShareJournal(run);
|
|
2519
2538
|
admittedSinceCooperativeCheckpoint = 0;
|
|
2520
2539
|
skippedSinceCooperativeCheckpoint = 0;
|
|
2521
2540
|
await new Promise((resolve) => setImmediate(resolve));
|
|
2522
|
-
|
|
2523
|
-
throw new CooperativePushHandoff();
|
|
2524
|
-
}
|
|
2541
|
+
await run.options.cooperativeCheckpoint();
|
|
2525
2542
|
}
|
|
2526
2543
|
else {
|
|
2527
2544
|
break;
|
|
@@ -3848,6 +3865,7 @@ async function collectFiles(paths, hqRoot, syncRoot, filter, hooks = {}) {
|
|
|
3848
3865
|
else if (lstat.isFile()) {
|
|
3849
3866
|
const relativePath = vaultKeyForLocalPath(syncRoot, absolutePath);
|
|
3850
3867
|
if (filter(absolutePath)) {
|
|
3868
|
+
noteCooperativeRowVisit("collect", relativePath);
|
|
3851
3869
|
results.push({ kind: "file", absolutePath, relativePath });
|
|
3852
3870
|
}
|
|
3853
3871
|
}
|
|
@@ -3934,10 +3952,12 @@ async function walkDir(dir, syncRoot, filter, results, hooks = {}, cooperativeWo
|
|
|
3934
3952
|
enterDirectory(absolutePath);
|
|
3935
3953
|
}
|
|
3936
3954
|
else if (entry.isFile()) {
|
|
3955
|
+
const relativePath = vaultKeyForLocalPath(syncRoot, absolutePath);
|
|
3956
|
+
noteCooperativeRowVisit("collect", relativePath);
|
|
3937
3957
|
results.push({
|
|
3938
3958
|
kind: "file",
|
|
3939
3959
|
absolutePath,
|
|
3940
|
-
relativePath
|
|
3960
|
+
relativePath,
|
|
3941
3961
|
});
|
|
3942
3962
|
}
|
|
3943
3963
|
}
|