@indigoai-us/hq-cloud 6.18.3-alpha.0 → 6.18.4-alpha.0
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 +44 -10
- package/dist/bandwidth.d.ts.map +1 -1
- package/dist/bandwidth.js +219 -17
- package/dist/bandwidth.js.map +1 -1
- package/dist/bandwidth.test.js +79 -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 +206 -60
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +224 -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 +139 -18
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +230 -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 +33 -7
- package/dist/object-io.d.ts.map +1 -1
- package/dist/object-io.js +329 -140
- package/dist/object-io.js.map +1 -1
- package/dist/object-io.test.js +400 -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 +304 -27
- package/dist/s3.js.map +1 -1
- package/dist/s3.test.js +163 -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":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T;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,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,15 @@ 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
|
+
if (cloudWinsEntity && !remoteMeta && journalEntry) {
|
|
2028
|
+
conflictPaths.push(relativePath);
|
|
2029
|
+
run.emit({ type: "conflict", path: relativePath, direction: "push", resolution: "skip" });
|
|
2030
|
+
counters.filesSkipped++;
|
|
2031
|
+
return;
|
|
2032
|
+
}
|
|
1960
2033
|
if (!remoteMeta && journalEntry?.localDiverges) {
|
|
1961
2034
|
conflictPaths.push(relativePath);
|
|
1962
2035
|
const resolution = await resolveConflictSerialized({
|
|
@@ -2108,8 +2181,16 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2108
2181
|
if ((localChanged && remoteChanged) || isFreshCollision || divergentLocalHonesty) {
|
|
2109
2182
|
// Cloud-authoritative paths are already skipped at the top of
|
|
2110
2183
|
// processUploadItem (before HEAD), so anything reaching here is a genuine
|
|
2111
|
-
// conflict on a client-owned file.
|
|
2184
|
+
// conflict on a client-owned file, or a flag-gated ontology entity.
|
|
2112
2185
|
conflictPaths.push(relativePath);
|
|
2186
|
+
if (cloudWinsEntity) {
|
|
2187
|
+
// The cloud body wins whatever the conflict strategy. The local body
|
|
2188
|
+
// is set aside out of the tree, like any adopted conflict.
|
|
2189
|
+
run.emit({ type: "conflict", path: relativePath, direction: "push", resolution: "keep" });
|
|
2190
|
+
await adoptRemoteOnPush(run, item, normalizeEtag(remoteMeta.etag), undefined);
|
|
2191
|
+
counters.filesSkipped++;
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2113
2194
|
// Version-aware winner (strategy unset or `keep`): fetch the remote
|
|
2114
2195
|
// body into scratch and compare it with the local one instead of
|
|
2115
2196
|
// letting the flag name a side. `overwrite`, `abort` and
|
|
@@ -2247,50 +2328,80 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2247
2328
|
: undefined;
|
|
2248
2329
|
if (!isSymlinkUpload)
|
|
2249
2330
|
setUploadContentHash(absolutePath, localHash);
|
|
2250
|
-
const
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2331
|
+
const journalSnapshot = JSON.stringify(journalRows(run.journal).get(relativePath) ?? null);
|
|
2332
|
+
const sendPayload = async () => {
|
|
2333
|
+
if (run.options.transferPriority === "realtime") {
|
|
2334
|
+
return isSymlinkUpload
|
|
2335
|
+
? uploadSymlink(run.ctx, item.target, relativePath, run.options.author, pc, { bypassBandwidthGovernor: true })
|
|
2336
|
+
: uploadFile(run.ctx, absolutePath, relativePath, run.options.author, pc, { bypassBandwidthGovernor: true });
|
|
2337
|
+
}
|
|
2338
|
+
return isSymlinkUpload
|
|
2339
|
+
? uploadSymlink(run.ctx, item.target, relativePath, run.options.author, pc)
|
|
2340
|
+
: uploadFile(run.ctx, absolutePath, relativePath, run.options.author, pc);
|
|
2341
|
+
};
|
|
2342
|
+
const runNetworkTransfer = run.options.cooperativeCheckpoint?.runChoreNetworkTransfer;
|
|
2343
|
+
const transfer = runNetworkTransfer
|
|
2344
|
+
? await runNetworkTransfer(sendPayload)
|
|
2345
|
+
: { value: await sendPayload(), realtimeRan: false, complete: () => undefined };
|
|
2346
|
+
try {
|
|
2347
|
+
if (transfer.realtimeRan) {
|
|
2348
|
+
const latestJournal = readJournalScoped(run.journalSlug, [relativePath]);
|
|
2349
|
+
const latestEntry = journalRows(latestJournal).get(relativePath);
|
|
2350
|
+
if (JSON.stringify(latestEntry ?? null) !== journalSnapshot) {
|
|
2351
|
+
if (latestEntry)
|
|
2352
|
+
journalRows(run.journal).set(relativePath, latestEntry);
|
|
2353
|
+
else
|
|
2354
|
+
journalRows(run.journal).delete(relativePath);
|
|
2355
|
+
counters.filesSkipped++;
|
|
2356
|
+
return;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
const { etag } = transfer.value;
|
|
2360
|
+
updateEntry(run.journal, relativePath, localHash, size, "up", absolutePath, {
|
|
2361
|
+
remoteEtag: etag,
|
|
2362
|
+
mtimeMs,
|
|
2363
|
+
ctimeMs,
|
|
2364
|
+
kind: item.kind,
|
|
2365
|
+
skillMetadataPending: skillContentAtPut !== undefined &&
|
|
2366
|
+
skillRegistrarForRun(run) !== undefined,
|
|
2367
|
+
});
|
|
2368
|
+
if (run.message) {
|
|
2369
|
+
journalRows(run.journal).set(relativePath, {
|
|
2370
|
+
...journalRows(run.journal).get(relativePath),
|
|
2371
|
+
message: run.message,
|
|
2372
|
+
});
|
|
2373
|
+
}
|
|
2374
|
+
counters.filesUploaded++;
|
|
2375
|
+
counters.bytesUploaded += size;
|
|
2376
|
+
// A landed company skill needs a durable retry marker before the registry
|
|
2377
|
+
// call. The ordinary cadence is intentionally sparse for large vaults,
|
|
2378
|
+
// but losing this row can strand tags after a crash between PUT and
|
|
2379
|
+
// reconciliation.
|
|
2380
|
+
if (journalRows(run.journal).get(relativePath)?.skillMetadataPending === true) {
|
|
2381
|
+
flushShareJournal(run);
|
|
2382
|
+
}
|
|
2383
|
+
else {
|
|
2384
|
+
// Strictly after the PUT returned and the entry was applied, so an
|
|
2385
|
+
// interrupted pass can only ever re-upload a file, never skip one.
|
|
2386
|
+
checkpointShareJournal(run);
|
|
2387
|
+
}
|
|
2388
|
+
if (skillContentAtPut !== undefined &&
|
|
2389
|
+
skillRegistrarForRun(run) !== undefined &&
|
|
2390
|
+
fs.readFileSync(absolutePath, "utf8") === skillContentAtPut) {
|
|
2391
|
+
const outcome = await reconcileLandedCompanySkill(run, relativePath, skillContentAtPut, absolutePath);
|
|
2392
|
+
settleLandedReconcile(run, relativePath, outcome);
|
|
2393
|
+
checkpointShareJournal(run);
|
|
2394
|
+
}
|
|
2395
|
+
run.emit({
|
|
2396
|
+
type: "progress",
|
|
2397
|
+
path: relativePath,
|
|
2398
|
+
bytes: size,
|
|
2399
|
+
...(run.message ? { message: run.message } : {}),
|
|
2265
2400
|
});
|
|
2266
2401
|
}
|
|
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);
|
|
2402
|
+
finally {
|
|
2403
|
+
transfer.complete();
|
|
2280
2404
|
}
|
|
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);
|
|
2287
|
-
}
|
|
2288
|
-
run.emit({
|
|
2289
|
-
type: "progress",
|
|
2290
|
-
path: relativePath,
|
|
2291
|
-
bytes: size,
|
|
2292
|
-
...(run.message ? { message: run.message } : {}),
|
|
2293
|
-
});
|
|
2294
2405
|
};
|
|
2295
2406
|
try {
|
|
2296
2407
|
await performUpload(precondition);
|
|
@@ -2311,8 +2422,21 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2311
2422
|
// full-journal write after every later PUT.
|
|
2312
2423
|
if (err instanceof JournalCheckpointError)
|
|
2313
2424
|
throw err;
|
|
2425
|
+
if (emitPlanLimitSkip(err))
|
|
2426
|
+
return;
|
|
2314
2427
|
if (isPreconditionFailed(err)) {
|
|
2315
2428
|
conflictPaths.push(relativePath);
|
|
2429
|
+
if (cloudWinsEntity) {
|
|
2430
|
+
// The remote moved (or appeared) after HEAD. Never retry unfenced:
|
|
2431
|
+
// adopt whatever the cloud holds now.
|
|
2432
|
+
run.emit({ type: "conflict", path: relativePath, direction: "push", resolution: "keep" });
|
|
2433
|
+
const latest = await headRemoteFile(run.ctx, relativePath);
|
|
2434
|
+
if (latest) {
|
|
2435
|
+
await adoptRemoteOnPush(run, item, normalizeEtag(latest.etag), undefined);
|
|
2436
|
+
}
|
|
2437
|
+
counters.filesSkipped++;
|
|
2438
|
+
return;
|
|
2439
|
+
}
|
|
2316
2440
|
if (usesVersionAwareWinner(run.onConflict)) {
|
|
2317
2441
|
// The remote advanced past the body the fence was built on. Re-decide
|
|
2318
2442
|
// once against the remote as it stands NOW: HEAD for the fresh token,
|
|
@@ -2353,6 +2477,8 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2353
2477
|
}
|
|
2354
2478
|
if (retryErr instanceof JournalCheckpointError)
|
|
2355
2479
|
throw retryErr;
|
|
2480
|
+
if (emitPlanLimitSkip(retryErr))
|
|
2481
|
+
return;
|
|
2356
2482
|
if (isPreconditionFailed(retryErr)) {
|
|
2357
2483
|
counters.filesSkipped++;
|
|
2358
2484
|
return;
|
|
@@ -2439,6 +2565,8 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2439
2565
|
isRetryableIdentityRefusal(retryErr)) {
|
|
2440
2566
|
throw retryErr;
|
|
2441
2567
|
}
|
|
2568
|
+
if (emitPlanLimitSkip(retryErr))
|
|
2569
|
+
return;
|
|
2442
2570
|
hadUploadFailure = true;
|
|
2443
2571
|
run.emit({
|
|
2444
2572
|
type: "error",
|
|
@@ -2523,9 +2651,14 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2523
2651
|
let admittedSinceCooperativeCheckpoint = 0;
|
|
2524
2652
|
let skippedSinceCooperativeCheckpoint = 0;
|
|
2525
2653
|
let remainingPreplannedSkips = pushPlan.preplannedFilesSkipped;
|
|
2654
|
+
let realtimeYieldRequested = false;
|
|
2655
|
+
const realtimeIsWaiting = () => run.options.cooperativeCheckpoint?.shouldYieldToRealtime?.() === true;
|
|
2526
2656
|
while (queue.length > 0 || inFlight.size > 0 || remainingPreplannedSkips > 0) {
|
|
2657
|
+
if (realtimeIsWaiting())
|
|
2658
|
+
realtimeYieldRequested = true;
|
|
2527
2659
|
while (!aborted &&
|
|
2528
2660
|
!sessionAuthAborted &&
|
|
2661
|
+
!realtimeYieldRequested &&
|
|
2529
2662
|
(!run.options.cooperativeCheckpoint ||
|
|
2530
2663
|
(admittedSinceCooperativeCheckpoint <
|
|
2531
2664
|
getActiveFullPassUnitSize() &&
|
|
@@ -2539,7 +2672,7 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2539
2672
|
continue;
|
|
2540
2673
|
}
|
|
2541
2674
|
const previewItem = queue[0];
|
|
2542
|
-
const item = replanPushItemAtExecution(previewItem, run.journal, run.skipUnchanged === true, run.options.onHeartbeat);
|
|
2675
|
+
const item = replanPushItemAtExecution(previewItem, run.journal, run.skipUnchanged === true, run.options.onHeartbeat, run.ontologyEntityPush);
|
|
2543
2676
|
if (item === null) {
|
|
2544
2677
|
queue.shift();
|
|
2545
2678
|
counters.filesSkipped++;
|
|
@@ -2567,12 +2700,19 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2567
2700
|
queue.shift();
|
|
2568
2701
|
admittedSinceCooperativeCheckpoint++;
|
|
2569
2702
|
inFlightBytes += nextBytes;
|
|
2570
|
-
const upload = () =>
|
|
2571
|
-
|
|
2703
|
+
const upload = async () => {
|
|
2704
|
+
await processUploadItem(item);
|
|
2705
|
+
if (realtimeIsWaiting())
|
|
2706
|
+
realtimeYieldRequested = true;
|
|
2707
|
+
};
|
|
2708
|
+
const p = (run.options.transferSemaphore &&
|
|
2709
|
+
run.options.transferPriority !== "realtime"
|
|
2572
2710
|
? run.options.transferSemaphore.withPermit(upload)
|
|
2573
2711
|
: upload())
|
|
2574
2712
|
.catch((err) => {
|
|
2575
2713
|
hadUploadFailure = true;
|
|
2714
|
+
if (realtimeIsWaiting())
|
|
2715
|
+
realtimeYieldRequested = true;
|
|
2576
2716
|
// The journal is no longer persistable, so continuing would upload
|
|
2577
2717
|
// more objects that can never be recorded. Stop feeding the queue.
|
|
2578
2718
|
if (err instanceof JournalCheckpointError)
|
|
@@ -2597,9 +2737,11 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2597
2737
|
!aborted &&
|
|
2598
2738
|
!sessionAuthAborted &&
|
|
2599
2739
|
!hadUploadFailure &&
|
|
2600
|
-
(admittedSinceCooperativeCheckpoint > 0 ||
|
|
2601
|
-
|
|
2602
|
-
|
|
2740
|
+
(admittedSinceCooperativeCheckpoint > 0 ||
|
|
2741
|
+
skippedSinceCooperativeCheckpoint > 0 ||
|
|
2742
|
+
realtimeYieldRequested) &&
|
|
2743
|
+
(realtimeYieldRequested ||
|
|
2744
|
+
admittedSinceCooperativeCheckpoint >= getActiveFullPassUnitSize() ||
|
|
2603
2745
|
skippedSinceCooperativeCheckpoint >=
|
|
2604
2746
|
getActiveFullPassUnitSize() ||
|
|
2605
2747
|
(queue.length === 0 && remainingPreplannedSkips === 0))) {
|
|
@@ -2620,6 +2762,7 @@ async function executeUploads(run, pushPlan, counters, conflictPaths) {
|
|
|
2620
2762
|
resumedAt,
|
|
2621
2763
|
})}\n`);
|
|
2622
2764
|
}
|
|
2765
|
+
realtimeYieldRequested = false;
|
|
2623
2766
|
}
|
|
2624
2767
|
else {
|
|
2625
2768
|
break;
|
|
@@ -3440,6 +3583,9 @@ function defaultConsoleLogger(event) {
|
|
|
3440
3583
|
console.log(`Plan: ${event.filesToUpload} to upload (${event.bytesToUpload} bytes), ${event.filesToSkip} unchanged`);
|
|
3441
3584
|
}
|
|
3442
3585
|
}
|
|
3586
|
+
else if (event.type === "plan-limit") {
|
|
3587
|
+
console.warn(` ! New files are paused by your plan. Upgrade: ${event.upgradeUrl}`);
|
|
3588
|
+
}
|
|
3443
3589
|
else if (event.type === "progress") {
|
|
3444
3590
|
if (event.deleted) {
|
|
3445
3591
|
// Append `message` when present (e.g. tombstone events carry
|