@indigoai-us/hq-cloud 6.18.3 → 6.18.4-alpha.1
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/bandwidth.d.ts +56 -10
- package/dist/bandwidth.d.ts.map +1 -1
- package/dist/bandwidth.js +253 -17
- package/dist/bandwidth.js.map +1 -1
- package/dist/bandwidth.test.js +103 -4
- package/dist/bandwidth.test.js.map +1 -1
- package/dist/bin/sync-runner-company.d.ts +2 -0
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +15 -0
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-company.test.js +56 -0
- package/dist/bin/sync-runner-company.test.js.map +1 -1
- package/dist/bin/sync-runner-events.test.js +15 -0
- package/dist/bin/sync-runner-events.test.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +31 -5
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +228 -10
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +31 -2
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +14 -5
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +120 -39
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share.d.ts +26 -8
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +227 -62
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +252 -3
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/sync.d.ts +21 -4
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +140 -19
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +274 -1
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/lib/machine-id.d.ts +7 -0
- package/dist/lib/machine-id.d.ts.map +1 -1
- package/dist/lib/machine-id.js +54 -7
- package/dist/lib/machine-id.js.map +1 -1
- package/dist/lib/machine-id.test.js +20 -1
- package/dist/lib/machine-id.test.js.map +1 -1
- package/dist/lib/ontology-entity-push.d.ts +51 -0
- package/dist/lib/ontology-entity-push.d.ts.map +1 -0
- package/dist/lib/ontology-entity-push.js +125 -0
- package/dist/lib/ontology-entity-push.js.map +1 -0
- package/dist/lib/ontology-entity-push.test.d.ts +2 -0
- package/dist/lib/ontology-entity-push.test.d.ts.map +1 -0
- package/dist/lib/ontology-entity-push.test.js +149 -0
- package/dist/lib/ontology-entity-push.test.js.map +1 -0
- package/dist/object-io.d.ts +38 -7
- package/dist/object-io.d.ts.map +1 -1
- package/dist/object-io.js +336 -140
- package/dist/object-io.js.map +1 -1
- package/dist/object-io.test.js +423 -1
- package/dist/object-io.test.js.map +1 -1
- package/dist/s3-download-stream-hash.test.d.ts +2 -0
- package/dist/s3-download-stream-hash.test.d.ts.map +1 -0
- package/dist/s3-download-stream-hash.test.js +70 -0
- package/dist/s3-download-stream-hash.test.js.map +1 -0
- package/dist/s3.d.ts +8 -3
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +330 -27
- package/dist/s3.js.map +1 -1
- package/dist/s3.test.js +304 -0
- package/dist/s3.test.js.map +1 -1
- package/dist/sync/event-sync.d.ts +14 -4
- package/dist/sync/event-sync.d.ts.map +1 -1
- package/dist/sync/event-sync.js +145 -14
- package/dist/sync/event-sync.js.map +1 -1
- package/dist/sync/event-sync.test.js +266 -1
- package/dist/sync/event-sync.test.js.map +1 -1
- package/dist/sync/inbound-event-admission.d.ts.map +1 -1
- package/dist/sync/inbound-event-admission.js +3 -0
- package/dist/sync/inbound-event-admission.js.map +1 -1
- package/dist/sync/inbound-event-admission.test.js +6 -0
- package/dist/sync/inbound-event-admission.test.js.map +1 -1
- package/dist/sync/push-transport.d.ts +15 -0
- package/dist/sync/push-transport.d.ts.map +1 -1
- package/dist/sync/push-transport.js +27 -0
- package/dist/sync/push-transport.js.map +1 -1
- package/dist/sync/push-transport.test.js +14 -1
- package/dist/sync/push-transport.test.js.map +1 -1
- package/dist/sync-core.d.ts +2 -1
- package/dist/sync-core.d.ts.map +1 -1
- package/dist/sync-core.js +5 -10
- package/dist/sync-core.js.map +1 -1
- package/dist/sync-core.test.js +16 -0
- package/dist/sync-core.test.js.map +1 -1
- package/dist/vault-client.d.ts +5 -0
- package/dist/vault-client.d.ts.map +1 -1
- package/dist/vault-client.js +7 -0
- package/dist/vault-client.js.map +1 -1
- package/dist/vault-client.test.js +39 -0
- package/dist/vault-client.test.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/share.d.ts
CHANGED
|
@@ -240,13 +240,13 @@ declare function statMatchesJournal(absolutePath: string, entry: Parameters<type
|
|
|
240
240
|
*/
|
|
241
241
|
export declare const PUSH_COLLECT_COOPERATIVE_YIELD_MS = 15000;
|
|
242
242
|
export declare function setPushCollectCooperativeYieldMsForTesting(ms: number | undefined): void;
|
|
243
|
-
declare function computePushPlan(filesToShare: CollectedEntry[], journal: SyncJournal, skipUnchanged: boolean, onHeartbeat?: () => void): PushPlan;
|
|
243
|
+
declare function computePushPlan(filesToShare: CollectedEntry[], journal: SyncJournal, skipUnchanged: boolean, onHeartbeat?: () => void, ontologyEntityPush?: boolean): PushPlan;
|
|
244
244
|
/**
|
|
245
245
|
* Build a full-pass plan in bounded row batches. A scoped replan deliberately
|
|
246
246
|
* uses the synchronous single-row planner above, so it does not add an await
|
|
247
247
|
* boundary between upload admissions and collapse the transfer pool.
|
|
248
248
|
*/
|
|
249
|
-
declare function computePushPlanCooperatively(filesToShare: CollectedEntry[], journal: SyncJournal, skipUnchanged: boolean, onHeartbeat: (() => void) | undefined, cooperativeCheckpoint: (() => Promise<void | boolean>) | undefined): Promise<PushPlan>;
|
|
249
|
+
declare function computePushPlanCooperatively(filesToShare: CollectedEntry[], journal: SyncJournal, skipUnchanged: boolean, onHeartbeat: (() => void) | undefined, cooperativeCheckpoint: (() => Promise<void | boolean>) | undefined, ontologyEntityPush?: boolean): Promise<PushPlan>;
|
|
250
250
|
export interface ShareOptions {
|
|
251
251
|
/** Path(s) to share (files or directories) */
|
|
252
252
|
paths: string[];
|
|
@@ -301,6 +301,8 @@ export interface ShareOptions {
|
|
|
301
301
|
onEvent?: (event: SyncProgressEvent) => void;
|
|
302
302
|
/** See SyncOptions.transferSemaphore: shared across concurrent fanout legs. */
|
|
303
303
|
transferSemaphore?: TransferSemaphore;
|
|
304
|
+
/** Realtime passes bypass the full-chore payload governor. */
|
|
305
|
+
transferPriority?: "chore" | "realtime";
|
|
304
306
|
/** See SyncOptions.progressRecorder: fanout writes one aggregate snapshot. */
|
|
305
307
|
progressRecorder?: (event: SyncProgressEvent) => void;
|
|
306
308
|
/**
|
|
@@ -310,12 +312,22 @@ export interface ShareOptions {
|
|
|
310
312
|
onHeartbeat?: () => void;
|
|
311
313
|
/**
|
|
312
314
|
* Cooperative root-lock hand-off for a watch-mode full push. It is called
|
|
313
|
-
* only after a bounded upload unit
|
|
314
|
-
* updates are on disk. A `true` result
|
|
315
|
-
* pass yielded, so the push is rebuilt
|
|
316
|
-
* before it can plan another durable
|
|
317
|
-
|
|
318
|
-
|
|
315
|
+
* only after a bounded upload unit, or the current active upload set, has
|
|
316
|
+
* completely settled and its journal updates are on disk. A `true` result
|
|
317
|
+
* means realtime work ran while this pass yielded, so the push is rebuilt
|
|
318
|
+
* from current local and journal state before it can plan another durable
|
|
319
|
+
* mutation.
|
|
320
|
+
*/
|
|
321
|
+
cooperativeCheckpoint?: (() => Promise<void | boolean>) & {
|
|
322
|
+
/** Lets an upload queue stop filling its next unit before the next count checkpoint. */
|
|
323
|
+
shouldYieldToRealtime?: () => boolean;
|
|
324
|
+
/** Run one payload PUT while the scheduler lends durable ownership to realtime. */
|
|
325
|
+
runChoreNetworkTransfer?: <T>(work: () => Promise<T>) => Promise<{
|
|
326
|
+
value: T;
|
|
327
|
+
realtimeRan: boolean;
|
|
328
|
+
complete: () => void;
|
|
329
|
+
}>;
|
|
330
|
+
};
|
|
319
331
|
/**
|
|
320
332
|
* When true, files whose local hash matches the journal entry from the
|
|
321
333
|
* last sync are skipped (no remote HEAD, no upload). This is the gate
|
|
@@ -514,6 +526,12 @@ export interface ShareOptions {
|
|
|
514
526
|
* successful because the pull/server pipeline is authoritative.
|
|
515
527
|
*/
|
|
516
528
|
serverOwnedPathPolicy?: "error" | "skip";
|
|
529
|
+
/**
|
|
530
|
+
* Whether checkpoint-written `ontology/entities/**` files may be pushed.
|
|
531
|
+
* Unset: resolve the `checkpoint.ontology` flag for this company vault when
|
|
532
|
+
* the pass has an entity file to push. Personal vaults never push them.
|
|
533
|
+
*/
|
|
534
|
+
ontologyEntityPush?: boolean;
|
|
517
535
|
}
|
|
518
536
|
export interface CompanySkillRegistrationRequest {
|
|
519
537
|
companySlug: string;
|
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,WAAW,EAAE,MAAM,aAAa,CAAC;AAwBlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EASL,6BAA6B,EAW9B,MAAM,eAAe,CAAC;AAsBvB,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;
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/cli/share.ts"],"names":[],"mappings":"AAAA;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D;;;;;;;;;;;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,CAsH3B"}
|
package/dist/cli/share.js
CHANGED
|
@@ -26,6 +26,7 @@ import { hasRemoteChanged, isAccessDenied, resolveActiveCompany, resolveTransfer
|
|
|
26
26
|
import { buildConflictBackupPath, buildConflictId, buildConflictProbePath, readShortMachineId, } from "../lib/conflict-file.js";
|
|
27
27
|
import { appendConflictEntry } from "../lib/conflict-index.js";
|
|
28
28
|
import { isCloudAuthoritative } from "../lib/cloud-authoritative.js";
|
|
29
|
+
import { isOntologyEntityKey, resolveOntologyEntityPush } from "../lib/ontology-entity-push.js";
|
|
29
30
|
import { VaultAuthError, VaultClient, VaultClientError, VaultConflictError, VaultPermissionDeniedError, } from "../vault-client.js";
|
|
30
31
|
import { describeError } from "../lib/describe-error.js";
|
|
31
32
|
import { isTransientHttpStatusError } from "../lib/net-errors.js";
|
|
@@ -370,7 +371,20 @@ async function yieldToCooperativeCheckpoint(work, cooperativeCheckpoint, force =
|
|
|
370
371
|
})}\n`);
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
|
-
|
|
374
|
+
/**
|
|
375
|
+
* Push-side refusal for server-owned paths. board.json is the documented
|
|
376
|
+
* exception; checkpoint-written ontology entity files are the second one, only
|
|
377
|
+
* while the company's `checkpoint.ontology` flag is on (see
|
|
378
|
+
* ../lib/ontology-entity-push.ts).
|
|
379
|
+
*/
|
|
380
|
+
function refusesServerOwnedPush(relativePath, ontologyEntityPush) {
|
|
381
|
+
if (relativePath === "board.json")
|
|
382
|
+
return false;
|
|
383
|
+
if (ontologyEntityPush && isOntologyEntityKey(relativePath))
|
|
384
|
+
return false;
|
|
385
|
+
return isCloudAuthoritative(relativePath);
|
|
386
|
+
}
|
|
387
|
+
function computePushPlan(filesToShare, journal, skipUnchanged, onHeartbeat, ontologyEntityPush = false) {
|
|
374
388
|
const items = [];
|
|
375
389
|
let omittedSkips = 0;
|
|
376
390
|
let plannedRows = 0;
|
|
@@ -382,8 +396,8 @@ function computePushPlan(filesToShare, journal, skipUnchanged, onHeartbeat) {
|
|
|
382
396
|
// Server-generated paths are read-only to normal client sync. Classify
|
|
383
397
|
// them before hashing or skip-unchanged so local-only files and files with
|
|
384
398
|
// a divergent remote baseline both surface the same honest refusal. The
|
|
385
|
-
// board
|
|
386
|
-
if (relativePath
|
|
399
|
+
// board and flag-gated ontology entities are the push-side exceptions.
|
|
400
|
+
if (refusesServerOwnedPush(relativePath, ontologyEntityPush)) {
|
|
387
401
|
items.push({ action: "refuse-server-owned", absolutePath, relativePath });
|
|
388
402
|
continue;
|
|
389
403
|
}
|
|
@@ -537,7 +551,7 @@ function computePushPlan(filesToShare, journal, skipUnchanged, onHeartbeat) {
|
|
|
537
551
|
* uses the synchronous single-row planner above, so it does not add an await
|
|
538
552
|
* boundary between upload admissions and collapse the transfer pool.
|
|
539
553
|
*/
|
|
540
|
-
async function computePushPlanCooperatively(filesToShare, journal, skipUnchanged, onHeartbeat, cooperativeCheckpoint) {
|
|
554
|
+
async function computePushPlanCooperatively(filesToShare, journal, skipUnchanged, onHeartbeat, cooperativeCheckpoint, ontologyEntityPush = false) {
|
|
541
555
|
const items = [];
|
|
542
556
|
let filesToUpload = 0;
|
|
543
557
|
let bytesToUpload = 0;
|
|
@@ -546,7 +560,7 @@ async function computePushPlanCooperatively(filesToShare, journal, skipUnchanged
|
|
|
546
560
|
const cooperativeWork = { rowsSinceYield: 0, lastYieldAt: 0 };
|
|
547
561
|
for (let start = 0; start < filesToShare.length; start += getActiveFullPassUnitSize()) {
|
|
548
562
|
const slice = filesToShare.slice(start, start + getActiveFullPassUnitSize());
|
|
549
|
-
const plan = computePushPlan(slice, journal, skipUnchanged, onHeartbeat);
|
|
563
|
+
const plan = computePushPlan(slice, journal, skipUnchanged, onHeartbeat, ontologyEntityPush);
|
|
550
564
|
items.push(...plan.items);
|
|
551
565
|
filesToUpload += plan.filesToUpload;
|
|
552
566
|
bytesToUpload += plan.bytesToUpload;
|
|
@@ -597,11 +611,11 @@ function recollectPushEntry(item) {
|
|
|
597
611
|
* classified from the bytes and journal state that exist immediately before a
|
|
598
612
|
* worker starts, so callers never upload with a hash captured near pass entry.
|
|
599
613
|
*/
|
|
600
|
-
function replanPushItemAtExecution(item, journal, skipUnchanged, onHeartbeat) {
|
|
614
|
+
function replanPushItemAtExecution(item, journal, skipUnchanged, onHeartbeat, ontologyEntityPush = false) {
|
|
601
615
|
const current = recollectPushEntry(item);
|
|
602
616
|
if (current === null)
|
|
603
617
|
return null;
|
|
604
|
-
return computePushPlan([current], journal, skipUnchanged, onHeartbeat).items[0] ?? null;
|
|
618
|
+
return computePushPlan([current], journal, skipUnchanged, onHeartbeat, ontologyEntityPush).items[0] ?? null;
|
|
605
619
|
}
|
|
606
620
|
function uploadBodyMatchesPlan(planned, current) {
|
|
607
621
|
if (planned.kind !== current.kind || planned.localHash !== current.localHash) {
|
|
@@ -983,6 +997,7 @@ async function createPushRunContext(options) {
|
|
|
983
997
|
const journal = scopedJournal ? emptyJournalForScopedPass() : readJournalForPass(journalSlug);
|
|
984
998
|
return {
|
|
985
999
|
options,
|
|
1000
|
+
ontologyEntityPush: false,
|
|
986
1001
|
paths,
|
|
987
1002
|
message,
|
|
988
1003
|
onConflict,
|
|
@@ -1019,6 +1034,24 @@ async function createPushRunContext(options) {
|
|
|
1019
1034
|
},
|
|
1020
1035
|
};
|
|
1021
1036
|
}
|
|
1037
|
+
async function resolveRunOntologyEntityPush(run) {
|
|
1038
|
+
if (run.options.personalMode === true)
|
|
1039
|
+
return false;
|
|
1040
|
+
if (run.options.ontologyEntityPush !== undefined)
|
|
1041
|
+
return run.options.ontologyEntityPush;
|
|
1042
|
+
const vaultConfig = run.vaultConfig;
|
|
1043
|
+
const authToken = vaultConfig?.authToken;
|
|
1044
|
+
return resolveOntologyEntityPush({
|
|
1045
|
+
companyUid: run.ctx.uid,
|
|
1046
|
+
companySlug: run.ctx.slug,
|
|
1047
|
+
endpoint: vaultConfig?.apiUrl,
|
|
1048
|
+
getToken: authToken === undefined
|
|
1049
|
+
? undefined
|
|
1050
|
+
: typeof authToken === "function"
|
|
1051
|
+
? authToken
|
|
1052
|
+
: () => authToken,
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1022
1055
|
function createShareCounters() {
|
|
1023
1056
|
return {
|
|
1024
1057
|
filesUploaded: 0,
|
|
@@ -1692,7 +1725,12 @@ async function buildSharePlans(run) {
|
|
|
1692
1725
|
const uploadableFiles = registrationSkipped.size > 0
|
|
1693
1726
|
? filesToShare.filter((entry) => !registrationSkipped.has(entry.relativePath))
|
|
1694
1727
|
: filesToShare;
|
|
1695
|
-
|
|
1728
|
+
// Resolve the ontology push flag only when this pass has an entity file to
|
|
1729
|
+
// push, so ordinary passes make no flag request.
|
|
1730
|
+
if (uploadableFiles.some((entry) => isOntologyEntityKey(entry.relativePath))) {
|
|
1731
|
+
run.ontologyEntityPush = await resolveRunOntologyEntityPush(run);
|
|
1732
|
+
}
|
|
1733
|
+
const pushPlan = await computePushPlanCooperatively(uploadableFiles, run.journal, run.skipUnchanged === true, run.options.onHeartbeat, run.options.cooperativeCheckpoint, run.ontologyEntityPush);
|
|
1696
1734
|
const deletePlan = run.propagateDeletes === true
|
|
1697
1735
|
? await computeDeletePlan(run.journal, run.syncRoot, deleteScopeRoots, run.shouldSync, run.propagateDeletePolicy, run.ctx, run.options.personalMode !== true)
|
|
1698
1736
|
: { toDelete: [], toTombstone: [], refusedStale: [] };
|
|
@@ -1765,9 +1803,19 @@ async function refreshPushJournalAfterWalk(run, collectedKeys = [], deleteScopeR
|
|
|
1765
1803
|
await yieldToCooperativeCheckpoint(checkpointWork, run.options.cooperativeCheckpoint, true);
|
|
1766
1804
|
}
|
|
1767
1805
|
}
|
|
1806
|
+
function planLimitUpgradeUrlForError(error) {
|
|
1807
|
+
if (!(error instanceof VaultClientError) || !error.upgradeUrl)
|
|
1808
|
+
return undefined;
|
|
1809
|
+
if (error.statusCode === 402 && error.code === "plan_limit_reached") {
|
|
1810
|
+
return error.upgradeUrl;
|
|
1811
|
+
}
|
|
1812
|
+
if (error.code === "PLAN_LIMIT_REACHED")
|
|
1813
|
+
return error.upgradeUrl;
|
|
1814
|
+
return undefined;
|
|
1815
|
+
}
|
|
1768
1816
|
async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
1769
1817
|
counters.filesSkipped += pushPlan.preplannedFilesSkipped;
|
|
1770
|
-
const TRANSFER_CONCURRENCY = resolveTransferConcurrency(run.hostLoadAtStart);
|
|
1818
|
+
const TRANSFER_CONCURRENCY = resolveTransferConcurrency(run.hostLoadAtStart, run.options.transferPriority ?? "chore");
|
|
1771
1819
|
let conflictPromptChain = Promise.resolve();
|
|
1772
1820
|
const resolveConflictSerialized = (info) => {
|
|
1773
1821
|
const resolution = conflictPromptChain.then(() => resolveConflict(info, run.onConflict));
|
|
@@ -1798,7 +1846,7 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
1798
1846
|
for (const previewItem of pushPlan.items) {
|
|
1799
1847
|
if (previewItem.action !== "upload")
|
|
1800
1848
|
continue;
|
|
1801
|
-
const item = replanPushItemAtExecution(previewItem, run.journal, run.skipUnchanged === true, run.options.onHeartbeat);
|
|
1849
|
+
const item = replanPushItemAtExecution(previewItem, run.journal, run.skipUnchanged === true, run.options.onHeartbeat, run.ontologyEntityPush);
|
|
1802
1850
|
if (item?.action === "upload" &&
|
|
1803
1851
|
!isUploadSuppressedByTombstone(item)) {
|
|
1804
1852
|
initiallyPlannedUploads.push(item);
|
|
@@ -1818,6 +1866,18 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
1818
1866
|
let aborted = false;
|
|
1819
1867
|
let abortFlightConflictPaths = [];
|
|
1820
1868
|
let hadUploadFailure = false;
|
|
1869
|
+
let emittedPlanLimitNotice = false;
|
|
1870
|
+
const emitPlanLimitSkip = (error) => {
|
|
1871
|
+
const upgradeUrl = planLimitUpgradeUrlForError(error);
|
|
1872
|
+
if (!upgradeUrl)
|
|
1873
|
+
return false;
|
|
1874
|
+
counters.filesSkipped++;
|
|
1875
|
+
if (!emittedPlanLimitNotice) {
|
|
1876
|
+
emittedPlanLimitNotice = true;
|
|
1877
|
+
run.emit({ type: "plan-limit", upgradeUrl });
|
|
1878
|
+
}
|
|
1879
|
+
return true;
|
|
1880
|
+
};
|
|
1821
1881
|
const settleFreshSkip = (item) => {
|
|
1822
1882
|
if (item.action === "refuse-server-owned") {
|
|
1823
1883
|
if (run.options.serverOwnedPathPolicy !== "skip") {
|
|
@@ -1871,7 +1931,7 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
1871
1931
|
return;
|
|
1872
1932
|
const { absolutePath, relativePath, localHash } = item;
|
|
1873
1933
|
const refreshUploadItem = () => {
|
|
1874
|
-
const refreshed = replanPushItemAtExecution(item, run.journal, run.skipUnchanged === true, run.options.onHeartbeat);
|
|
1934
|
+
const refreshed = replanPushItemAtExecution(item, run.journal, run.skipUnchanged === true, run.options.onHeartbeat, run.ontologyEntityPush);
|
|
1875
1935
|
if (refreshed === null) {
|
|
1876
1936
|
counters.filesSkipped++;
|
|
1877
1937
|
return null;
|
|
@@ -1909,13 +1969,17 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
1909
1969
|
// legitimate, but must flow through the conditional PUT fence below. It
|
|
1910
1970
|
// remains cloud-authoritative on pull so server automation still wins a
|
|
1911
1971
|
// pull conflict.
|
|
1912
|
-
if (relativePath
|
|
1972
|
+
if (refusesServerOwnedPush(relativePath, run.ontologyEntityPush)) {
|
|
1913
1973
|
if (run.options.serverOwnedPathPolicy !== "skip") {
|
|
1914
1974
|
emitServerOwnedRefusal(run, relativePath);
|
|
1915
1975
|
}
|
|
1916
1976
|
counters.filesSkipped++;
|
|
1917
1977
|
return;
|
|
1918
1978
|
}
|
|
1979
|
+
// Checkpoint-written ontology entities reach this point only with the flag
|
|
1980
|
+
// on. They stay cloud-wins: every divergence below adopts the cloud body,
|
|
1981
|
+
// a write is always fenced, and a 412 never retries unfenced.
|
|
1982
|
+
const cloudWinsEntity = isOntologyEntityKey(relativePath);
|
|
1919
1983
|
if (run.vaultConfig && isExpiringSoon(run.ctx.expiresAt)) {
|
|
1920
1984
|
run.ctx = await refreshEntityContext(run.companyRef, run.vaultConfig);
|
|
1921
1985
|
}
|
|
@@ -1957,6 +2021,34 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
1957
2021
|
//
|
|
1958
2022
|
// Scoped to divergent entries: `keep`'s recreate-once behaviour for an
|
|
1959
2023
|
// ordinary journaled key whose remote was deleted is unchanged.
|
|
2024
|
+
// A journaled entity whose remote object is gone was removed server-side
|
|
2025
|
+
// (a merge or a cleanup). Recreating it would undo that. The pull leg
|
|
2026
|
+
// settles the local copy.
|
|
2027
|
+
//
|
|
2028
|
+
// An unedited copy still matches the journal baseline, so the pull leg's
|
|
2029
|
+
// remote-delete sweep removes it; that is not a conflict. An edited copy
|
|
2030
|
+
// would be deferred by that sweep forever (it only honours tombstones for
|
|
2031
|
+
// bodies that match the baseline), so settle it here: the cloud deletion
|
|
2032
|
+
// wins, the local body is parked under `.hq/conflict-backups/`, and the
|
|
2033
|
+
// journal row goes, leaving nothing for the next pass to re-report.
|
|
2034
|
+
if (cloudWinsEntity && !remoteMeta && journalEntry) {
|
|
2035
|
+
counters.filesSkipped++;
|
|
2036
|
+
if (journalEntry.hash === localHash)
|
|
2037
|
+
return;
|
|
2038
|
+
conflictPaths.push(relativePath);
|
|
2039
|
+
if (!isMaterializationPathStillContained(run.syncRoot, item.absolutePath)) {
|
|
2040
|
+
run.emit({ type: "conflict", path: relativePath, direction: "push", resolution: "skip" });
|
|
2041
|
+
return;
|
|
2042
|
+
}
|
|
2043
|
+
const backupKey = buildConflictBackupPath(vaultKeyForLocalPath(run.hqRoot, item.absolutePath), new Date().toISOString(), readShortMachineId(run.hqRoot));
|
|
2044
|
+
const backupAbs = localPathForVaultKey(run.hqRoot, backupKey);
|
|
2045
|
+
fs.mkdirSync(path.dirname(backupAbs), { recursive: true });
|
|
2046
|
+
fs.renameSync(item.absolutePath, backupAbs);
|
|
2047
|
+
journalRows(run.journal).delete(relativePath);
|
|
2048
|
+
flushShareJournal(run);
|
|
2049
|
+
run.emit({ type: "conflict", path: relativePath, direction: "push", resolution: "keep" });
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
1960
2052
|
if (!remoteMeta && journalEntry?.localDiverges) {
|
|
1961
2053
|
conflictPaths.push(relativePath);
|
|
1962
2054
|
const resolution = await resolveConflictSerialized({
|
|
@@ -2108,8 +2200,16 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2108
2200
|
if ((localChanged && remoteChanged) || isFreshCollision || divergentLocalHonesty) {
|
|
2109
2201
|
// Cloud-authoritative paths are already skipped at the top of
|
|
2110
2202
|
// processUploadItem (before HEAD), so anything reaching here is a genuine
|
|
2111
|
-
// conflict on a client-owned file.
|
|
2203
|
+
// conflict on a client-owned file, or a flag-gated ontology entity.
|
|
2112
2204
|
conflictPaths.push(relativePath);
|
|
2205
|
+
if (cloudWinsEntity) {
|
|
2206
|
+
// The cloud body wins whatever the conflict strategy. The local body
|
|
2207
|
+
// is set aside out of the tree, like any adopted conflict.
|
|
2208
|
+
run.emit({ type: "conflict", path: relativePath, direction: "push", resolution: "keep" });
|
|
2209
|
+
await adoptRemoteOnPush(run, item, normalizeEtag(remoteMeta.etag), undefined);
|
|
2210
|
+
counters.filesSkipped++;
|
|
2211
|
+
return;
|
|
2212
|
+
}
|
|
2113
2213
|
// Version-aware winner (strategy unset or `keep`): fetch the remote
|
|
2114
2214
|
// body into scratch and compare it with the local one instead of
|
|
2115
2215
|
// letting the flag name a side. `overwrite`, `abort` and
|
|
@@ -2247,50 +2347,80 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2247
2347
|
: undefined;
|
|
2248
2348
|
if (!isSymlinkUpload)
|
|
2249
2349
|
setUploadContentHash(absolutePath, localHash);
|
|
2250
|
-
const
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2350
|
+
const journalSnapshot = JSON.stringify(journalRows(run.journal).get(relativePath) ?? null);
|
|
2351
|
+
const sendPayload = async () => {
|
|
2352
|
+
if (run.options.transferPriority === "realtime") {
|
|
2353
|
+
return isSymlinkUpload
|
|
2354
|
+
? uploadSymlink(run.ctx, item.target, relativePath, run.options.author, pc, { bypassBandwidthGovernor: true })
|
|
2355
|
+
: uploadFile(run.ctx, absolutePath, relativePath, run.options.author, pc, { bypassBandwidthGovernor: true });
|
|
2356
|
+
}
|
|
2357
|
+
return isSymlinkUpload
|
|
2358
|
+
? uploadSymlink(run.ctx, item.target, relativePath, run.options.author, pc)
|
|
2359
|
+
: uploadFile(run.ctx, absolutePath, relativePath, run.options.author, pc);
|
|
2360
|
+
};
|
|
2361
|
+
const runNetworkTransfer = run.options.cooperativeCheckpoint?.runChoreNetworkTransfer;
|
|
2362
|
+
const transfer = runNetworkTransfer
|
|
2363
|
+
? await runNetworkTransfer(sendPayload)
|
|
2364
|
+
: { value: await sendPayload(), realtimeRan: false, complete: () => undefined };
|
|
2365
|
+
try {
|
|
2366
|
+
if (transfer.realtimeRan) {
|
|
2367
|
+
const latestJournal = readJournalScoped(run.journalSlug, [relativePath]);
|
|
2368
|
+
const latestEntry = journalRows(latestJournal).get(relativePath);
|
|
2369
|
+
if (JSON.stringify(latestEntry ?? null) !== journalSnapshot) {
|
|
2370
|
+
if (latestEntry)
|
|
2371
|
+
journalRows(run.journal).set(relativePath, latestEntry);
|
|
2372
|
+
else
|
|
2373
|
+
journalRows(run.journal).delete(relativePath);
|
|
2374
|
+
counters.filesSkipped++;
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
const { etag } = transfer.value;
|
|
2379
|
+
updateEntry(run.journal, relativePath, localHash, size, "up", absolutePath, {
|
|
2380
|
+
remoteEtag: etag,
|
|
2381
|
+
mtimeMs,
|
|
2382
|
+
ctimeMs,
|
|
2383
|
+
kind: item.kind,
|
|
2384
|
+
skillMetadataPending: skillContentAtPut !== undefined &&
|
|
2385
|
+
skillRegistrarForRun(run) !== undefined,
|
|
2386
|
+
});
|
|
2387
|
+
if (run.message) {
|
|
2388
|
+
journalRows(run.journal).set(relativePath, {
|
|
2389
|
+
...journalRows(run.journal).get(relativePath),
|
|
2390
|
+
message: run.message,
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
counters.filesUploaded++;
|
|
2394
|
+
counters.bytesUploaded += size;
|
|
2395
|
+
// A landed company skill needs a durable retry marker before the registry
|
|
2396
|
+
// call. The ordinary cadence is intentionally sparse for large vaults,
|
|
2397
|
+
// but losing this row can strand tags after a crash between PUT and
|
|
2398
|
+
// reconciliation.
|
|
2399
|
+
if (journalRows(run.journal).get(relativePath)?.skillMetadataPending === true) {
|
|
2400
|
+
flushShareJournal(run);
|
|
2401
|
+
}
|
|
2402
|
+
else {
|
|
2403
|
+
// Strictly after the PUT returned and the entry was applied, so an
|
|
2404
|
+
// interrupted pass can only ever re-upload a file, never skip one.
|
|
2405
|
+
checkpointShareJournal(run);
|
|
2406
|
+
}
|
|
2407
|
+
if (skillContentAtPut !== undefined &&
|
|
2408
|
+
skillRegistrarForRun(run) !== undefined &&
|
|
2409
|
+
fs.readFileSync(absolutePath, "utf8") === skillContentAtPut) {
|
|
2410
|
+
const outcome = await reconcileLandedCompanySkill(run, relativePath, skillContentAtPut, absolutePath);
|
|
2411
|
+
settleLandedReconcile(run, relativePath, outcome);
|
|
2412
|
+
checkpointShareJournal(run);
|
|
2413
|
+
}
|
|
2414
|
+
run.emit({
|
|
2415
|
+
type: "progress",
|
|
2416
|
+
path: relativePath,
|
|
2417
|
+
bytes: size,
|
|
2418
|
+
...(run.message ? { message: run.message } : {}),
|
|
2265
2419
|
});
|
|
2266
2420
|
}
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
// A landed company skill needs a durable retry marker before the registry
|
|
2270
|
-
// call. The ordinary cadence is intentionally sparse for large vaults,
|
|
2271
|
-
// but losing this row can strand tags after a crash between PUT and
|
|
2272
|
-
// reconciliation.
|
|
2273
|
-
if (journalRows(run.journal).get(relativePath)?.skillMetadataPending === true) {
|
|
2274
|
-
flushShareJournal(run);
|
|
2275
|
-
}
|
|
2276
|
-
else {
|
|
2277
|
-
// Strictly after the PUT returned and the entry was applied, so an
|
|
2278
|
-
// interrupted pass can only ever re-upload a file, never skip one.
|
|
2279
|
-
checkpointShareJournal(run);
|
|
2280
|
-
}
|
|
2281
|
-
if (skillContentAtPut !== undefined &&
|
|
2282
|
-
skillRegistrarForRun(run) !== undefined &&
|
|
2283
|
-
fs.readFileSync(absolutePath, "utf8") === skillContentAtPut) {
|
|
2284
|
-
const outcome = await reconcileLandedCompanySkill(run, relativePath, skillContentAtPut, absolutePath);
|
|
2285
|
-
settleLandedReconcile(run, relativePath, outcome);
|
|
2286
|
-
checkpointShareJournal(run);
|
|
2421
|
+
finally {
|
|
2422
|
+
transfer.complete();
|
|
2287
2423
|
}
|
|
2288
|
-
run.emit({
|
|
2289
|
-
type: "progress",
|
|
2290
|
-
path: relativePath,
|
|
2291
|
-
bytes: size,
|
|
2292
|
-
...(run.message ? { message: run.message } : {}),
|
|
2293
|
-
});
|
|
2294
2424
|
};
|
|
2295
2425
|
try {
|
|
2296
2426
|
await performUpload(precondition);
|
|
@@ -2311,8 +2441,21 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2311
2441
|
// full-journal write after every later PUT.
|
|
2312
2442
|
if (err instanceof JournalCheckpointError)
|
|
2313
2443
|
throw err;
|
|
2444
|
+
if (emitPlanLimitSkip(err))
|
|
2445
|
+
return;
|
|
2314
2446
|
if (isPreconditionFailed(err)) {
|
|
2315
2447
|
conflictPaths.push(relativePath);
|
|
2448
|
+
if (cloudWinsEntity) {
|
|
2449
|
+
// The remote moved (or appeared) after HEAD. Never retry unfenced:
|
|
2450
|
+
// adopt whatever the cloud holds now.
|
|
2451
|
+
run.emit({ type: "conflict", path: relativePath, direction: "push", resolution: "keep" });
|
|
2452
|
+
const latest = await headRemoteFile(run.ctx, relativePath);
|
|
2453
|
+
if (latest) {
|
|
2454
|
+
await adoptRemoteOnPush(run, item, normalizeEtag(latest.etag), undefined);
|
|
2455
|
+
}
|
|
2456
|
+
counters.filesSkipped++;
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2316
2459
|
if (usesVersionAwareWinner(run.onConflict)) {
|
|
2317
2460
|
// The remote advanced past the body the fence was built on. Re-decide
|
|
2318
2461
|
// once against the remote as it stands NOW: HEAD for the fresh token,
|
|
@@ -2353,6 +2496,8 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2353
2496
|
}
|
|
2354
2497
|
if (retryErr instanceof JournalCheckpointError)
|
|
2355
2498
|
throw retryErr;
|
|
2499
|
+
if (emitPlanLimitSkip(retryErr))
|
|
2500
|
+
return;
|
|
2356
2501
|
if (isPreconditionFailed(retryErr)) {
|
|
2357
2502
|
counters.filesSkipped++;
|
|
2358
2503
|
return;
|
|
@@ -2439,6 +2584,8 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2439
2584
|
isRetryableIdentityRefusal(retryErr)) {
|
|
2440
2585
|
throw retryErr;
|
|
2441
2586
|
}
|
|
2587
|
+
if (emitPlanLimitSkip(retryErr))
|
|
2588
|
+
return;
|
|
2442
2589
|
hadUploadFailure = true;
|
|
2443
2590
|
run.emit({
|
|
2444
2591
|
type: "error",
|
|
@@ -2523,9 +2670,14 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2523
2670
|
let admittedSinceCooperativeCheckpoint = 0;
|
|
2524
2671
|
let skippedSinceCooperativeCheckpoint = 0;
|
|
2525
2672
|
let remainingPreplannedSkips = pushPlan.preplannedFilesSkipped;
|
|
2673
|
+
let realtimeYieldRequested = false;
|
|
2674
|
+
const realtimeIsWaiting = () => run.options.cooperativeCheckpoint?.shouldYieldToRealtime?.() === true;
|
|
2526
2675
|
while (queue.length > 0 || inFlight.size > 0 || remainingPreplannedSkips > 0) {
|
|
2676
|
+
if (realtimeIsWaiting())
|
|
2677
|
+
realtimeYieldRequested = true;
|
|
2527
2678
|
while (!aborted &&
|
|
2528
2679
|
!sessionAuthAborted &&
|
|
2680
|
+
!realtimeYieldRequested &&
|
|
2529
2681
|
(!run.options.cooperativeCheckpoint ||
|
|
2530
2682
|
(admittedSinceCooperativeCheckpoint <
|
|
2531
2683
|
getActiveFullPassUnitSize() &&
|
|
@@ -2539,7 +2691,7 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2539
2691
|
continue;
|
|
2540
2692
|
}
|
|
2541
2693
|
const previewItem = queue[0];
|
|
2542
|
-
const item = replanPushItemAtExecution(previewItem, run.journal, run.skipUnchanged === true, run.options.onHeartbeat);
|
|
2694
|
+
const item = replanPushItemAtExecution(previewItem, run.journal, run.skipUnchanged === true, run.options.onHeartbeat, run.ontologyEntityPush);
|
|
2543
2695
|
if (item === null) {
|
|
2544
2696
|
queue.shift();
|
|
2545
2697
|
counters.filesSkipped++;
|
|
@@ -2567,12 +2719,19 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2567
2719
|
queue.shift();
|
|
2568
2720
|
admittedSinceCooperativeCheckpoint++;
|
|
2569
2721
|
inFlightBytes += nextBytes;
|
|
2570
|
-
const upload = () =>
|
|
2571
|
-
|
|
2722
|
+
const upload = async () => {
|
|
2723
|
+
await processUploadItem(item);
|
|
2724
|
+
if (realtimeIsWaiting())
|
|
2725
|
+
realtimeYieldRequested = true;
|
|
2726
|
+
};
|
|
2727
|
+
const p = (run.options.transferSemaphore &&
|
|
2728
|
+
run.options.transferPriority !== "realtime"
|
|
2572
2729
|
? run.options.transferSemaphore.withPermit(upload)
|
|
2573
2730
|
: upload())
|
|
2574
2731
|
.catch((err) => {
|
|
2575
2732
|
hadUploadFailure = true;
|
|
2733
|
+
if (realtimeIsWaiting())
|
|
2734
|
+
realtimeYieldRequested = true;
|
|
2576
2735
|
// The journal is no longer persistable, so continuing would upload
|
|
2577
2736
|
// more objects that can never be recorded. Stop feeding the queue.
|
|
2578
2737
|
if (err instanceof JournalCheckpointError)
|
|
@@ -2597,9 +2756,11 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2597
2756
|
!aborted &&
|
|
2598
2757
|
!sessionAuthAborted &&
|
|
2599
2758
|
!hadUploadFailure &&
|
|
2600
|
-
(admittedSinceCooperativeCheckpoint > 0 ||
|
|
2601
|
-
|
|
2602
|
-
|
|
2759
|
+
(admittedSinceCooperativeCheckpoint > 0 ||
|
|
2760
|
+
skippedSinceCooperativeCheckpoint > 0 ||
|
|
2761
|
+
realtimeYieldRequested) &&
|
|
2762
|
+
(realtimeYieldRequested ||
|
|
2763
|
+
admittedSinceCooperativeCheckpoint >= getActiveFullPassUnitSize() ||
|
|
2603
2764
|
skippedSinceCooperativeCheckpoint >=
|
|
2604
2765
|
getActiveFullPassUnitSize() ||
|
|
2605
2766
|
(queue.length === 0 && remainingPreplannedSkips === 0))) {
|
|
@@ -2620,6 +2781,7 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2620
2781
|
resumedAt,
|
|
2621
2782
|
})}\n`);
|
|
2622
2783
|
}
|
|
2784
|
+
realtimeYieldRequested = false;
|
|
2623
2785
|
}
|
|
2624
2786
|
else {
|
|
2625
2787
|
break;
|
|
@@ -2684,7 +2846,7 @@ async function probeRemoteForWinner(run, item, remoteMtime) {
|
|
|
2684
2846
|
let decision;
|
|
2685
2847
|
try {
|
|
2686
2848
|
fs.mkdirSync(path.dirname(probeAbs), { recursive: true });
|
|
2687
|
-
const downloaded = await downloadFile(run.ctx, item.relativePath, probeAbs);
|
|
2849
|
+
const downloaded = await downloadFile(run.ctx, item.relativePath, probeAbs, run.options.transferPriority === "realtime" ? { bypassBandwidthGovernor: true } : {});
|
|
2688
2850
|
fetched = { abs: probeAbs, downloaded };
|
|
2689
2851
|
if (item.kind === "file" && !fs.lstatSync(probeAbs).isSymbolicLink()) {
|
|
2690
2852
|
const localStat = fs.lstatSync(item.absolutePath);
|
|
@@ -2805,7 +2967,7 @@ async function adoptRemoteOnPush(run, item, remoteHash, decision, probe) {
|
|
|
2805
2967
|
downloaded = probeBody.downloaded;
|
|
2806
2968
|
}
|
|
2807
2969
|
else {
|
|
2808
|
-
downloaded = await downloadFile(run.ctx, item.relativePath, item.absolutePath);
|
|
2970
|
+
downloaded = await downloadFile(run.ctx, item.relativePath, item.absolutePath, run.options.transferPriority === "realtime" ? { bypassBandwidthGovernor: true } : {});
|
|
2809
2971
|
}
|
|
2810
2972
|
remoteAdopted = true;
|
|
2811
2973
|
const localLstat = fs.lstatSync(item.absolutePath);
|
|
@@ -3440,6 +3602,9 @@ function defaultConsoleLogger(event) {
|
|
|
3440
3602
|
console.log(`Plan: ${event.filesToUpload} to upload (${event.bytesToUpload} bytes), ${event.filesToSkip} unchanged`);
|
|
3441
3603
|
}
|
|
3442
3604
|
}
|
|
3605
|
+
else if (event.type === "plan-limit") {
|
|
3606
|
+
console.warn(` ! New files are paused by your plan. Upgrade: ${event.upgradeUrl}`);
|
|
3607
|
+
}
|
|
3443
3608
|
else if (event.type === "progress") {
|
|
3444
3609
|
if (event.deleted) {
|
|
3445
3610
|
// Append `message` when present (e.g. tombstone events carry
|