@indigoai-us/hq-cli 5.345.208 → 5.345.211
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/CHANGELOG.md +106 -0
- package/assets/scaffold/core/scripts/derive-trigger-facts.sh +22 -3
- package/assets/scaffold/core/scripts/lib/trigger-fact-text.awk +152 -41
- package/dist/command-catalog.generated.d.ts +33 -8
- package/dist/command-catalog.generated.js +40 -8
- package/dist/command-registration-plan.d.ts +2 -2
- package/dist/command-registration-plan.js +1 -1
- package/dist/commands/access.js +11 -5
- package/dist/commands/agents.d.ts +8 -0
- package/dist/commands/agents.js +5 -0
- package/dist/commands/bot.d.ts +8 -0
- package/dist/commands/bot.js +67 -7
- package/dist/commands/channels.js +4 -0
- package/dist/commands/cloud.d.ts +83 -2
- package/dist/commands/cloud.js +161 -31
- package/dist/commands/company.d.ts +9 -0
- package/dist/commands/company.js +44 -14
- package/dist/commands/core-checkpoint-native.js +21 -0
- package/dist/commands/core-derive-trigger-facts-native.d.ts +1 -0
- package/dist/commands/core-derive-trigger-facts-native.js +75 -14
- package/dist/commands/core-generate-workers-registry-fast.d.ts +1 -1
- package/dist/commands/core-generate-workers-registry-fast.js +7 -1
- package/dist/commands/core-job-run-native.d.ts +8 -0
- package/dist/commands/core-job-run-native.js +11 -3
- package/dist/commands/core-jobs-native.js +1 -1
- package/dist/commands/core-register-project-native.js +31 -1
- package/dist/commands/core-scan-packages-fast.d.ts +1 -1
- package/dist/commands/core-scan-packages-fast.js +8 -1
- package/dist/commands/core-work-mesh-bind-trusted-native.d.ts +14 -2
- package/dist/commands/core-work-mesh-bind-trusted-native.js +62 -8
- package/dist/commands/core.js +12 -3
- package/dist/commands/dm-attach.d.ts +10 -0
- package/dist/commands/dm-attach.js +33 -5
- package/dist/commands/integrations-connect.d.ts +16 -0
- package/dist/commands/integrations-connect.js +70 -6
- package/dist/commands/lanes-session-start.d.ts +17 -0
- package/dist/commands/lanes-session-start.js +281 -13
- package/dist/commands/lanes-watch.js +11 -3
- package/dist/commands/lanes.d.ts +4 -0
- package/dist/commands/lanes.js +95 -22
- package/dist/commands/library.d.ts +10 -0
- package/dist/commands/library.js +30 -3
- package/dist/commands/meetings.d.ts +42 -0
- package/dist/commands/meetings.js +157 -12
- package/dist/commands/mesh.js +3 -0
- package/dist/commands/monitor.d.ts +6 -0
- package/dist/commands/monitor.js +29 -19
- package/dist/commands/onboard.js +8 -1
- package/dist/commands/sources.js +7 -3
- package/dist/index.js +9 -0
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +2 -2
- package/dist/lanes-session-start-argv.d.ts +4 -1
- package/dist/lanes-session-start-argv.js +5 -2
- package/dist/lib/bot/fleet-daemon.d.ts +101 -0
- package/dist/lib/bot/fleet-daemon.js +227 -0
- package/dist/lib/bot/fleet-local.d.ts +26 -0
- package/dist/lib/bot/fleet-local.js +51 -2
- package/dist/lib/bot/index.d.ts +1 -0
- package/dist/lib/bot/index.js +1 -0
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +4 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +8 -1
- package/dist/lib/bot/log.js +3 -1
- package/dist/lib/bot/probe.js +2 -0
- package/dist/lib/bot/run.js +28 -3
- package/dist/lib/bot/runtime-failure.d.ts +4 -2
- package/dist/lib/bot/runtime-failure.js +9 -1
- package/dist/lib/bot/status.d.ts +17 -0
- package/dist/lib/bot/status.js +53 -2
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +5 -5
- package/dist/lib/capacity/collectors/claude-oauth.js +6 -6
- package/dist/lib/core-utils/native-scaffold-help.d.ts +16 -0
- package/dist/lib/core-utils/native-scaffold-help.js +26 -0
- package/dist/lib/core-utils/session-company.d.ts +25 -8
- package/dist/lib/core-utils/session-company.js +59 -17
- package/dist/lib/daemon/catalog.d.ts +34 -1
- package/dist/lib/daemon/catalog.js +42 -3
- package/dist/lib/daemon/run.d.ts +5 -4
- package/dist/lib/daemon/run.js +40 -16
- package/dist/lib/daemon/server.js +26 -7
- package/dist/lib/daemon/supervisor.d.ts +2 -0
- package/dist/lib/daemon/supervisor.js +60 -1
- package/dist/lib/daemon/tools.js +17 -1
- package/dist/lib/db/sqlite-binding.js +2 -1
- package/dist/lib/doctor/checks/bots.d.ts +2 -0
- package/dist/lib/doctor/checks/bots.js +11 -0
- package/dist/lib/doctor/checks/runtime-health.js +3 -2
- package/dist/lib/doctor/checks/work-context.js +5 -2
- package/dist/lib/hook-engine/resolve.d.ts +1 -1
- package/dist/lib/hook-engine/resolve.js +4 -1
- package/dist/lib/hot-channels/adapters/meeting-providers.d.ts +2 -0
- package/dist/lib/hot-channels/adapters/meeting-providers.js +13 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.d.ts +14 -0
- package/dist/lib/lanes/monitor.js +51 -10
- package/dist/lib/lanes/outpost-dispatch.d.ts +3 -0
- package/dist/lib/lanes/outpost-dispatch.js +1 -0
- package/dist/lib/lanes/store.d.ts +1 -1
- package/dist/lib/lanes/store.js +2 -1
- package/dist/lib/mesh/client.js +7 -1
- package/dist/lib/mesh/live/backfill-held.d.ts +3 -0
- package/dist/lib/mesh/live/backfill-held.js +167 -7
- package/dist/lib/mesh/live/flush.d.ts +7 -0
- package/dist/lib/mesh/live/flush.js +10 -1
- package/dist/lib/monitor.d.ts +9 -0
- package/dist/lib/monitor.js +33 -7
- package/dist/lib/onboarding/orchestrator.js +269 -132
- package/dist/lib/onboarding/types.d.ts +2 -0
- package/dist/lib/scaffold-cli-floor.js +2 -1
- package/dist/lib/signals/failure-alert.js +3 -1
- package/dist/lib/sync-core/reconcile.js +15 -11
- package/dist/lib/work-context/organize.d.ts +6 -0
- package/dist/lib/work-context/organize.js +28 -0
- package/dist/lib/work-context/paths.d.ts +9 -0
- package/dist/lib/work-context/paths.js +15 -0
- package/dist/lib/work-context/prd-sync.js +2 -1
- package/dist/runners-alias.d.ts +54 -0
- package/dist/runners-alias.js +86 -0
- package/dist/utils/install-tree-torn.js +5 -3
- package/dist/utils/npm-install-flags.d.ts +27 -0
- package/dist/utils/npm-install-flags.js +68 -0
- package/dist/utils/package-use-lease.js +1 -1
- package/dist/utils/qmd-native-binding-error.js +2 -1
- package/dist/utils/self-update.js +2 -1
- package/dist/utils/staged-install.js +2 -1
- package/dist/utils/staged-npm-install.js +2 -1
- package/dist/utils/upload-author.d.ts +2 -1
- package/dist/utils/upload-author.js +9 -5
- package/dist/utils/version-check.js +2 -1
- package/dist/utils/version-gate.js +7 -6
- package/package.json +7 -7
- package/scripts/install-hook-engine.mjs +7 -3
package/dist/commands/cloud.js
CHANGED
|
@@ -537,10 +537,84 @@ export function identityHeldLines(count, notice) {
|
|
|
537
537
|
`\`hq sync release-held\` to upload it.`,
|
|
538
538
|
];
|
|
539
539
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
export function createUnattendedHeldDeleteTracker() {
|
|
541
|
+
const held = new Map();
|
|
542
|
+
return {
|
|
543
|
+
observe(event) {
|
|
544
|
+
if (event.type !== "delete-refused-stale-etag" || event.reason !== "unattended-foreign-creator")
|
|
545
|
+
return;
|
|
546
|
+
if (typeof event.path !== "string")
|
|
547
|
+
return;
|
|
548
|
+
held.set(event.path, {
|
|
549
|
+
path: event.path,
|
|
550
|
+
...(typeof event.createdBy === "string" && event.createdBy ? { createdBy: event.createdBy } : {}),
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
held: () => [...held.values()],
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
/** Lines for deletes an unattended sync held. */
|
|
557
|
+
export function unattendedHeldDeleteLines(held) {
|
|
558
|
+
if (held.length === 0)
|
|
543
559
|
return [];
|
|
560
|
+
const one = held.length === 1;
|
|
561
|
+
return [
|
|
562
|
+
`⚠ ${held.length} deletion(s) held: an unattended sync never deletes a file another member created, ` +
|
|
563
|
+
(one
|
|
564
|
+
? `and this file's delete was held by one (now or on an earlier run). The file stays in the vault. `
|
|
565
|
+
: `and these files' deletes were held by an unattended sync (now or on an earlier run). The files stay in the vault. `) +
|
|
566
|
+
`Run \`hq sync pull\` to restore ${one ? "it" : "them"} locally; if the delete is intended, ` +
|
|
567
|
+
`delete ${one ? "it" : "them"} again from an interactive session and sync.`,
|
|
568
|
+
" Held:",
|
|
569
|
+
...held.map((item) => ` - ${item.path}${item.createdBy ? ` (created by ${item.createdBy})` : ""}`),
|
|
570
|
+
];
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* `filesRefusedStale` without the held deletes, which have their own message.
|
|
574
|
+
*
|
|
575
|
+
* Contract with hq-cloud (feedback_65ee9e51): for every held delete, the push
|
|
576
|
+
* counts exactly one entry in `filesRefusedStale`, lists its path once in the
|
|
577
|
+
* stale paths, and emits one `delete-refused-stale-etag` event with reason
|
|
578
|
+
* `unattended-foreign-creator` for that path (the tracker dedupes by path).
|
|
579
|
+
* Subtracting `held.length` relies on that one-entry-per-held-row match; if
|
|
580
|
+
* hq-cloud ever counts a held row more than once or not at all, this drifts.
|
|
581
|
+
*/
|
|
582
|
+
export function staleRefusalsExcludingHeld(count, paths = [], held = []) {
|
|
583
|
+
if (held.length === 0)
|
|
584
|
+
return { count, paths: [...paths] };
|
|
585
|
+
const heldPaths = new Set(held.map((item) => item.path));
|
|
586
|
+
return {
|
|
587
|
+
count: Math.max(0, count - held.length),
|
|
588
|
+
paths: paths.filter((filePath) => !heldPaths.has(filePath)),
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* `push --all` totals without held deletes: sums each target's stale
|
|
593
|
+
* refusals minus that target's held deletes, so exit status and the summary
|
|
594
|
+
* agree with the per-target lines.
|
|
595
|
+
*/
|
|
596
|
+
export function pushAllStaleExcludingHeld(result) {
|
|
597
|
+
let count = 0;
|
|
598
|
+
let held = 0;
|
|
599
|
+
const paths = [];
|
|
600
|
+
for (const row of result.perCompany) {
|
|
601
|
+
if (!row.result)
|
|
602
|
+
continue;
|
|
603
|
+
const leg = staleRefusalsExcludingHeld(row.result.filesRefusedStale ?? 0, row.result.filesRefusedStalePaths, row.result.heldDeletes);
|
|
604
|
+
count += leg.count;
|
|
605
|
+
paths.push(...leg.paths);
|
|
606
|
+
held += row.result.heldDeletes?.length ?? 0;
|
|
607
|
+
}
|
|
608
|
+
return { count, paths, held };
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Actionable recovery for files refused because the vault baseline is stale.
|
|
612
|
+
* Held unattended deletes in `held` are reported separately.
|
|
613
|
+
*/
|
|
614
|
+
export function staleUploadRefusalLines(rawCount, rawPaths = [], held = []) {
|
|
615
|
+
const { count, paths } = staleRefusalsExcludingHeld(rawCount, rawPaths, held);
|
|
616
|
+
if (count <= 0)
|
|
617
|
+
return unattendedHeldDeleteLines(held);
|
|
544
618
|
const lines = [
|
|
545
619
|
`⚠ ${count} file(s) were NOT uploaded because the vault copy changed after your edit. ` +
|
|
546
620
|
`Pull the current vault copy, merge your edit, and push again.`,
|
|
@@ -548,7 +622,7 @@ export function staleUploadRefusalLines(count, paths = []) {
|
|
|
548
622
|
if (paths.length > 0) {
|
|
549
623
|
lines.push(" Not uploaded:", ...paths.map((filePath) => ` - ${filePath}`));
|
|
550
624
|
}
|
|
551
|
-
return lines;
|
|
625
|
+
return [...lines, ...unattendedHeldDeleteLines(held)];
|
|
552
626
|
}
|
|
553
627
|
export function readUploadFailures(result) {
|
|
554
628
|
const r = result;
|
|
@@ -1456,6 +1530,7 @@ export function registerCloudCommands(program) {
|
|
|
1456
1530
|
: undefined) ??
|
|
1457
1531
|
(personalMode ? undefined : companySlugFromSyncPaths(options.hqRoot, targetPaths));
|
|
1458
1532
|
const identityHeld = createIdentityHeldTracker();
|
|
1533
|
+
const heldDeleteTracker = createUnattendedHeldDeleteTracker();
|
|
1459
1534
|
syncHealth = beginSyncHealthReport();
|
|
1460
1535
|
if (!personalMode) {
|
|
1461
1536
|
const companyUid = entityContext?.uid ??
|
|
@@ -1485,6 +1560,7 @@ export function registerCloudCommands(program) {
|
|
|
1485
1560
|
onEvent,
|
|
1486
1561
|
progressRecorder: ((record) => (event) => {
|
|
1487
1562
|
identityHeld.observe(event);
|
|
1563
|
+
heldDeleteTracker.observe(event);
|
|
1488
1564
|
record(event);
|
|
1489
1565
|
})(trackingProgressRecorder(planLimitTracker, progressCompany)),
|
|
1490
1566
|
...(personalMode ? { personalMode: true } : {}),
|
|
@@ -1495,7 +1571,8 @@ export function registerCloudCommands(program) {
|
|
|
1495
1571
|
});
|
|
1496
1572
|
const planLimitRefused = planLimitTracker.summary();
|
|
1497
1573
|
const identityHeldCount = identityHeld.count();
|
|
1498
|
-
const
|
|
1574
|
+
const heldDeletes = heldDeleteTracker.held();
|
|
1575
|
+
const staleRefusalCount = staleRefusalsExcludingHeld(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes).count;
|
|
1499
1576
|
const uploadFailed = readUploadFailures(result);
|
|
1500
1577
|
const refusalRecovery = [
|
|
1501
1578
|
result.filesExcludedByScope > 0
|
|
@@ -1529,7 +1606,9 @@ export function registerCloudCommands(program) {
|
|
|
1529
1606
|
aborted: result.aborted,
|
|
1530
1607
|
filesExcludedByScope: result.filesExcludedByScope,
|
|
1531
1608
|
filesRefusedStale: staleRefusalCount,
|
|
1532
|
-
filesRefusedStalePaths: result.
|
|
1609
|
+
filesRefusedStalePaths: staleRefusalsExcludingHeld(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes).paths,
|
|
1610
|
+
// feedback_65ee9e51: deletes an unattended sync held (not refusals).
|
|
1611
|
+
heldDeletes: { count: heldDeletes.length, paths: heldDeletes.map((item) => item.path) },
|
|
1533
1612
|
filesHeldByIdentityFence: identityHeldCount,
|
|
1534
1613
|
filesUploadFailed: uploadFailed.count,
|
|
1535
1614
|
uploadFailedPaths: uploadFailed.paths,
|
|
@@ -1562,7 +1641,7 @@ export function registerCloudCommands(program) {
|
|
|
1562
1641
|
for (const line of scopeExcludedLines(result.filesExcludedByScope, pushPrefixSet)) {
|
|
1563
1642
|
log(chalk.yellow(line));
|
|
1564
1643
|
}
|
|
1565
|
-
for (const line of staleUploadRefusalLines(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths)) {
|
|
1644
|
+
for (const line of staleUploadRefusalLines(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes)) {
|
|
1566
1645
|
log(chalk.yellow(line));
|
|
1567
1646
|
}
|
|
1568
1647
|
for (const line of uploadFailedLines(uploadFailed.count, uploadFailed.paths)) {
|
|
@@ -1595,7 +1674,7 @@ export function registerCloudCommands(program) {
|
|
|
1595
1674
|
})) {
|
|
1596
1675
|
log(chalk.red(line));
|
|
1597
1676
|
}
|
|
1598
|
-
for (const line of staleUploadRefusalLines(
|
|
1677
|
+
for (const line of staleUploadRefusalLines(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes)) {
|
|
1599
1678
|
log(chalk.yellow(line));
|
|
1600
1679
|
}
|
|
1601
1680
|
for (const line of uploadFailedLines(uploadFailed.count, uploadFailed.paths)) {
|
|
@@ -1610,6 +1689,11 @@ export function registerCloudCommands(program) {
|
|
|
1610
1689
|
log(chalk.yellow(line));
|
|
1611
1690
|
}
|
|
1612
1691
|
}
|
|
1692
|
+
else if (heldDeletes.length > 0) {
|
|
1693
|
+
log(chalk.yellow(`\n⚠ Pushed ${result.filesUploaded} file(s) (${formatBytes(result.bytesUploaded)}, ${formatPushSkipSummary(result)})`));
|
|
1694
|
+
for (const line of unattendedHeldDeleteLines(heldDeletes))
|
|
1695
|
+
log(chalk.yellow(line));
|
|
1696
|
+
}
|
|
1613
1697
|
else {
|
|
1614
1698
|
const skipSummary = formatPushSkipSummary(result);
|
|
1615
1699
|
log(chalk.green(`\n✓ Pushed ${result.filesUploaded} file(s) (${formatBytes(result.bytesUploaded)}, ${skipSummary})`));
|
|
@@ -2256,12 +2340,17 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2256
2340
|
? null
|
|
2257
2341
|
: (opts.targetSlug ?? opts.company);
|
|
2258
2342
|
const tracker = createPlanLimitRefusalTracker(companySlugForBilling(progressCompany));
|
|
2343
|
+
const heldDeleteTracker = createUnattendedHeldDeleteTracker();
|
|
2344
|
+
const record = trackingProgressRecorder(tracker, progressCompany);
|
|
2259
2345
|
const shareResult = await share({
|
|
2260
2346
|
paths: opts.paths,
|
|
2261
2347
|
company: opts.company,
|
|
2262
2348
|
vaultConfig,
|
|
2263
2349
|
hqRoot: opts.hqRoot,
|
|
2264
|
-
progressRecorder:
|
|
2350
|
+
progressRecorder: (event) => {
|
|
2351
|
+
heldDeleteTracker.observe(event);
|
|
2352
|
+
record(event);
|
|
2353
|
+
},
|
|
2265
2354
|
...(opts.onConflict ? { onConflict: opts.onConflict } : {}),
|
|
2266
2355
|
...(opts.personalMode !== undefined
|
|
2267
2356
|
? { personalMode: opts.personalMode }
|
|
@@ -2282,7 +2371,7 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2282
2371
|
...(opts.prefixSet !== undefined ? { prefixSet: opts.prefixSet } : {}),
|
|
2283
2372
|
...(author ? { author } : {}),
|
|
2284
2373
|
});
|
|
2285
|
-
return { ...shareResult, planLimit: tracker.summary() };
|
|
2374
|
+
return { ...shareResult, planLimit: tracker.summary(), heldDeletes: heldDeleteTracker.held() };
|
|
2286
2375
|
},
|
|
2287
2376
|
});
|
|
2288
2377
|
}
|
|
@@ -2301,9 +2390,12 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2301
2390
|
else if (row.result) {
|
|
2302
2391
|
const r = row.result;
|
|
2303
2392
|
const legRefused = r.planLimit ?? null;
|
|
2393
|
+
const legStale = staleRefusalsExcludingHeld(r.filesRefusedStale ?? 0, r.filesRefusedStalePaths, r.heldDeletes).count;
|
|
2394
|
+
const legHeld = r.heldDeletes?.length ?? 0;
|
|
2304
2395
|
const status = r.aborted ||
|
|
2305
2396
|
r.filesExcludedByScope > 0 ||
|
|
2306
|
-
|
|
2397
|
+
legStale > 0 ||
|
|
2398
|
+
legHeld > 0 ||
|
|
2307
2399
|
(r.filesUploadFailed ?? 0) > 0 ||
|
|
2308
2400
|
legRefused
|
|
2309
2401
|
? chalk.yellow("⚠")
|
|
@@ -2311,7 +2403,8 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2311
2403
|
console.log(` ${status} ${row.slug}: ${r.filesUploaded} file(s), ` +
|
|
2312
2404
|
`${formatBytes(r.bytesUploaded)}, ${r.filesSkipped} skipped, ` +
|
|
2313
2405
|
`${r.filesDeleted} deleted, ${r.filesExcludedByScope} scope-excluded, ` +
|
|
2314
|
-
`${
|
|
2406
|
+
`${legStale} stale-refused, ${r.filesUploadFailed ?? 0} failed, ` +
|
|
2407
|
+
(legHeld > 0 ? `${legHeld} deletion(s) held, ` : "") +
|
|
2315
2408
|
`${r.conflictPaths.length} conflict(s)` +
|
|
2316
2409
|
(r.aborted ? " — aborted" : "") +
|
|
2317
2410
|
(legRefused
|
|
@@ -2325,18 +2418,23 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2325
2418
|
}
|
|
2326
2419
|
}
|
|
2327
2420
|
const errored = result.errors.length;
|
|
2421
|
+
// feedback_65ee9e51: held unattended deletes are warnings, not refused
|
|
2422
|
+
// uploads; they never count as stale refusals or fail the run.
|
|
2423
|
+
const pushAllStale = pushAllStaleExcludingHeld(result);
|
|
2328
2424
|
const summary = `\nPushed ${result.filesUploaded} file(s) ` +
|
|
2329
2425
|
`(${formatBytes(result.bytesUploaded)}) across ${result.attempted} ` +
|
|
2330
2426
|
`target(s); ${result.filesDeleted} deleted; ${errored} error(s); ` +
|
|
2331
2427
|
`${result.filesExcludedByScope} scope-excluded; ` +
|
|
2332
|
-
`${
|
|
2428
|
+
`${pushAllStale.count} stale-refused; ` +
|
|
2429
|
+
(pushAllStale.held > 0 ? `${pushAllStale.held} deletion(s) held; ` : "") +
|
|
2333
2430
|
`${result.filesUploadFailed ?? 0} failed` +
|
|
2334
2431
|
(refusedTargets > 0
|
|
2335
2432
|
? `; new files paused on ${refusedTargets} target(s)`
|
|
2336
2433
|
: "");
|
|
2337
2434
|
console.log(errored > 0 ||
|
|
2338
2435
|
result.filesExcludedByScope > 0 ||
|
|
2339
|
-
|
|
2436
|
+
pushAllStale.count > 0 ||
|
|
2437
|
+
pushAllStale.held > 0 ||
|
|
2340
2438
|
(result.filesUploadFailed ?? 0) > 0 ||
|
|
2341
2439
|
refusedTargets > 0
|
|
2342
2440
|
? chalk.yellow(summary)
|
|
@@ -2356,7 +2454,7 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2356
2454
|
console.log(chalk.yellow(`${row.slug}: ${line}`));
|
|
2357
2455
|
}
|
|
2358
2456
|
const staleCount = row.result?.filesRefusedStale ?? 0;
|
|
2359
|
-
for (const line of staleUploadRefusalLines(staleCount, row.result?.filesRefusedStalePaths)) {
|
|
2457
|
+
for (const line of staleUploadRefusalLines(staleCount, row.result?.filesRefusedStalePaths, row.result?.heldDeletes)) {
|
|
2360
2458
|
console.log(chalk.yellow(`${row.slug}: ${line}`));
|
|
2361
2459
|
}
|
|
2362
2460
|
for (const line of uploadFailedLines(row.result?.filesUploadFailed ?? 0, row.result?.uploadFailedPaths)) {
|
|
@@ -2365,19 +2463,40 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2365
2463
|
}
|
|
2366
2464
|
if (errored > 0)
|
|
2367
2465
|
throw new SyncExitError(1);
|
|
2368
|
-
|
|
2369
|
-
|
|
2466
|
+
return pushAllRefusalSummary(result, refused);
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* The refusal summary `runPushAll` returns; null means the caller reports
|
|
2470
|
+
* success and exits 0. feedback_65ee9e51: held unattended deletes are left
|
|
2471
|
+
* out, so a push whose only "refusals" are held deletes returns null.
|
|
2472
|
+
*/
|
|
2473
|
+
export function pushAllRefusalSummary(result, planLimitRefused) {
|
|
2474
|
+
const stale = pushAllStaleExcludingHeld(result);
|
|
2475
|
+
const summary = {
|
|
2476
|
+
planLimitRefused,
|
|
2370
2477
|
filesExcludedByScope: result.filesExcludedByScope,
|
|
2371
|
-
filesRefusedStale:
|
|
2372
|
-
filesRefusedStalePaths: [...new Set(
|
|
2478
|
+
filesRefusedStale: stale.count,
|
|
2479
|
+
filesRefusedStalePaths: [...new Set(stale.paths)],
|
|
2373
2480
|
filesUploadFailed: result.filesUploadFailed ?? 0,
|
|
2374
2481
|
};
|
|
2375
|
-
return
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
?
|
|
2380
|
-
: null
|
|
2482
|
+
return summary.planLimitRefused ||
|
|
2483
|
+
summary.filesExcludedByScope > 0 ||
|
|
2484
|
+
summary.filesRefusedStale > 0 ||
|
|
2485
|
+
summary.filesUploadFailed > 0
|
|
2486
|
+
? summary
|
|
2487
|
+
: null;
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* Whether `hq sync now` (`runNowSingle`) must exit 1 after its push leg
|
|
2491
|
+
* ("one or more requested uploads were refused"). feedback_65ee9e51: held
|
|
2492
|
+
* unattended deletes are a warning, never a refusal.
|
|
2493
|
+
*/
|
|
2494
|
+
export function nowPushLegRefused(input) {
|
|
2495
|
+
const stale = staleRefusalsExcludingHeld(input.filesRefusedStale ?? 0, input.filesRefusedStalePaths, input.heldDeletes).count;
|
|
2496
|
+
return input.filesExcludedByScope > 0 ||
|
|
2497
|
+
stale > 0 ||
|
|
2498
|
+
input.uploadFailedCount > 0 ||
|
|
2499
|
+
input.identityHeldCount > 0;
|
|
2381
2500
|
}
|
|
2382
2501
|
async function runNowSingle(hqRoot, company, personal, message, onConflict, modeAllOverride, forceScopeShrink) {
|
|
2383
2502
|
console.log(chalk.bold("\nHQ Sync — Now"));
|
|
@@ -2452,6 +2571,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2452
2571
|
// feedback_2356e54f: the push leg held files after an account switch and
|
|
2453
2572
|
// still printed "0 uploaded, 0 skipped" and "Sync now complete".
|
|
2454
2573
|
const pushIdentityHeld = createIdentityHeldTracker();
|
|
2574
|
+
const pushHeldDeletes = createUnattendedHeldDeleteTracker();
|
|
2455
2575
|
const pushRecord = trackingProgressRecorder(planLimitTracker, pushProgressCompany);
|
|
2456
2576
|
const pushResult = await share({
|
|
2457
2577
|
paths: pushPaths,
|
|
@@ -2460,6 +2580,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2460
2580
|
hqRoot,
|
|
2461
2581
|
progressRecorder: (event) => {
|
|
2462
2582
|
pushIdentityHeld.observe(event);
|
|
2583
|
+
pushHeldDeletes.observe(event);
|
|
2463
2584
|
pushRecord(event);
|
|
2464
2585
|
},
|
|
2465
2586
|
skipUnchanged: true,
|
|
@@ -2477,11 +2598,15 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2477
2598
|
const pushUploadFailed = readUploadFailures(pushResult);
|
|
2478
2599
|
const pushHeldCount = pushIdentityHeld.count();
|
|
2479
2600
|
const pushHeldNotice = pushIdentityHeld.notice();
|
|
2601
|
+
// feedback_65ee9e51: held unattended deletes warn but never fail the run.
|
|
2602
|
+
const pushHeldDeleteList = pushHeldDeletes.held();
|
|
2603
|
+
const pushStaleCount = staleRefusalsExcludingHeld(pushResult.filesRefusedStale ?? 0, pushResult.filesRefusedStalePaths, pushHeldDeleteList).count;
|
|
2480
2604
|
const pushStatus = pushResult.aborted ||
|
|
2481
2605
|
pushHeldCount > 0 ||
|
|
2482
2606
|
Boolean(pushHeldNotice.message) ||
|
|
2483
2607
|
pushResult.filesExcludedByScope > 0 ||
|
|
2484
|
-
|
|
2608
|
+
pushStaleCount > 0 ||
|
|
2609
|
+
pushHeldDeleteList.length > 0 ||
|
|
2485
2610
|
pushUploadFailed.count > 0 ||
|
|
2486
2611
|
pushRefused
|
|
2487
2612
|
? chalk.yellow("⚠")
|
|
@@ -2490,6 +2615,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2490
2615
|
`${pushResult.filesUploaded} uploaded, ${pushResult.filesSkipped} skipped, ` +
|
|
2491
2616
|
`${pushResult.filesDeleted} deleted, ${pushResult.filesExcludedByScope} scope-excluded` +
|
|
2492
2617
|
(pushHeldCount > 0 ? `, ${pushHeldCount} held` : "") +
|
|
2618
|
+
(pushHeldDeleteList.length > 0 ? `, ${pushHeldDeleteList.length} deletion(s) held` : "") +
|
|
2493
2619
|
(pushResult.aborted ? " — aborted" : "") +
|
|
2494
2620
|
(pushRefused
|
|
2495
2621
|
? ` — ${describeRefusedCount(pushRefused)} refused (new files paused)`
|
|
@@ -2501,7 +2627,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2501
2627
|
console.log(chalk.yellow(line));
|
|
2502
2628
|
}
|
|
2503
2629
|
}
|
|
2504
|
-
for (const line of staleUploadRefusalLines(pushResult.filesRefusedStale ?? 0, pushResult.filesRefusedStalePaths)) {
|
|
2630
|
+
for (const line of staleUploadRefusalLines(pushResult.filesRefusedStale ?? 0, pushResult.filesRefusedStalePaths, pushHeldDeleteList)) {
|
|
2505
2631
|
console.log(chalk.yellow(line));
|
|
2506
2632
|
}
|
|
2507
2633
|
for (const line of uploadFailedLines(pushUploadFailed.count, pushUploadFailed.paths)) {
|
|
@@ -2630,10 +2756,14 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2630
2756
|
"refused: new files are paused for this account (listed above)."));
|
|
2631
2757
|
throw new SyncExitError(1, { health: "succeeded" });
|
|
2632
2758
|
}
|
|
2633
|
-
if (
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2759
|
+
if (nowPushLegRefused({
|
|
2760
|
+
filesExcludedByScope: pushResult.filesExcludedByScope,
|
|
2761
|
+
filesRefusedStale: pushResult.filesRefusedStale,
|
|
2762
|
+
filesRefusedStalePaths: pushResult.filesRefusedStalePaths,
|
|
2763
|
+
heldDeletes: pushHeldDeleteList,
|
|
2764
|
+
uploadFailedCount: pushUploadFailed.count,
|
|
2765
|
+
identityHeldCount: pushHeldCount,
|
|
2766
|
+
})) {
|
|
2637
2767
|
console.log(chalk.yellow("\n⚠ Sync now finished, but one or more requested uploads were refused."));
|
|
2638
2768
|
throw new SyncExitError(1, { health: "succeeded" });
|
|
2639
2769
|
}
|
|
@@ -8,6 +8,15 @@ interface WorkTrackingSettings {
|
|
|
8
8
|
workRegistryEnabled: boolean;
|
|
9
9
|
workMeshLiveEnabled: boolean;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* What to tell the reader when the cloud ontology gardener is off. The
|
|
13
|
+
* gardener is opt-in per company (default off), and while it is off every
|
|
14
|
+
* scheduled or knowledge-push run is a silent no-op: no `ontology/`,
|
|
15
|
+
* `signals/` or `company-brief.md` is ever built in the company vault.
|
|
16
|
+
* Nothing else tells an owner that, so `settings get` says it and names the
|
|
17
|
+
* command that turns it on.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ontologyNextSteps(companySlug: string, ontologyEnabled: boolean): string[];
|
|
11
20
|
/** Plain next steps after a work tracking switch was set, from the effective settings. */
|
|
12
21
|
export declare function workTrackingNextSteps(companySlug: string, settings: WorkTrackingSettings | null): string[];
|
|
13
22
|
export declare function registerCompanyCommand(program: Command): void;
|
package/dist/commands/company.js
CHANGED
|
@@ -12,12 +12,12 @@ function workTrackingFromBody(body) {
|
|
|
12
12
|
: null;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Read
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Read the owner/admin settings from GET /company-settings. The server returns
|
|
16
|
+
* effective values, so an absent field means the default (registry off, live
|
|
17
|
+
* on, ontology gardener off).
|
|
18
18
|
* A refused or failed read returns null rather than a guess.
|
|
19
19
|
*/
|
|
20
|
-
async function
|
|
20
|
+
async function readOwnerSettings(token, companyUid) {
|
|
21
21
|
try {
|
|
22
22
|
const res = await vaultApiFetch({
|
|
23
23
|
token,
|
|
@@ -30,12 +30,30 @@ async function readWorkTrackingSettings(token, companyUid) {
|
|
|
30
30
|
return {
|
|
31
31
|
workRegistryEnabled: body.workRegistryEnabled === true,
|
|
32
32
|
workMeshLiveEnabled: body.workMeshLiveEnabled !== false,
|
|
33
|
+
ontologyEnabled: body.ontologyEnabled === true,
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
catch {
|
|
36
37
|
return null;
|
|
37
38
|
}
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* What to tell the reader when the cloud ontology gardener is off. The
|
|
42
|
+
* gardener is opt-in per company (default off), and while it is off every
|
|
43
|
+
* scheduled or knowledge-push run is a silent no-op: no `ontology/`,
|
|
44
|
+
* `signals/` or `company-brief.md` is ever built in the company vault.
|
|
45
|
+
* Nothing else tells an owner that, so `settings get` says it and names the
|
|
46
|
+
* command that turns it on.
|
|
47
|
+
*/
|
|
48
|
+
export function ontologyNextSteps(companySlug, ontologyEnabled) {
|
|
49
|
+
if (ontologyEnabled)
|
|
50
|
+
return [];
|
|
51
|
+
return [
|
|
52
|
+
`The cloud ontology gardener is off for ${companySlug}, so HQ does not build a cloud ontology ` +
|
|
53
|
+
"or company brief from its knowledge. An owner can turn it on with: " +
|
|
54
|
+
`hq company --company ${companySlug} settings set --ontology-enabled true`,
|
|
55
|
+
];
|
|
56
|
+
}
|
|
39
57
|
/** Plain next steps after a work tracking switch was set, from the effective settings. */
|
|
40
58
|
export function workTrackingNextSteps(companySlug, settings) {
|
|
41
59
|
const command = `hq company --company ${companySlug} settings`;
|
|
@@ -177,7 +195,7 @@ export function registerCompanyCommand(program) {
|
|
|
177
195
|
// from the PUT response when it echoes both, otherwise from a GET.
|
|
178
196
|
const resBody = (await res.json().catch(() => ({})));
|
|
179
197
|
const effective = workTrackingFromBody(resBody) ??
|
|
180
|
-
(await
|
|
198
|
+
(await readOwnerSettings(token, companyUid));
|
|
181
199
|
for (const line of workTrackingNextSteps(companySlug, effective)) {
|
|
182
200
|
console.log(line);
|
|
183
201
|
}
|
|
@@ -192,7 +210,8 @@ export function registerCompanyCommand(program) {
|
|
|
192
210
|
.command("get")
|
|
193
211
|
.description("Show whether the checkpoint Stop gate is on for this company " +
|
|
194
212
|
"(GET /company-settings/checkpoint-gate; any member may read it) and, " +
|
|
195
|
-
"for an owner or admin, the two work tracking switches
|
|
213
|
+
"for an owner or admin, the two work tracking switches and whether the " +
|
|
214
|
+
"cloud ontology gardener is on (GET /company-settings).")
|
|
196
215
|
.option("--json", "Print the result as JSON")
|
|
197
216
|
.action(async (opts) => {
|
|
198
217
|
try {
|
|
@@ -222,24 +241,35 @@ export function registerCompanyCommand(program) {
|
|
|
222
241
|
console.error(chalk.red("Failed to read company settings: no checkpointGateEnabled in the response."));
|
|
223
242
|
process.exit(1);
|
|
224
243
|
}
|
|
225
|
-
// The work tracking switches
|
|
226
|
-
// route. A refused or failed read is
|
|
227
|
-
|
|
244
|
+
// The work tracking switches and the ontology gardener switch are only
|
|
245
|
+
// on the owner/admin settings route. A refused or failed read is
|
|
246
|
+
// reported as unknown, not guessed.
|
|
247
|
+
const ownerSettings = await readOwnerSettings(token, companyUid);
|
|
228
248
|
if (opts.json) {
|
|
229
249
|
console.log(JSON.stringify({
|
|
230
250
|
company: companySlug,
|
|
231
251
|
checkpointGateEnabled: enabled,
|
|
232
|
-
workRegistryEnabled:
|
|
233
|
-
workMeshLiveEnabled:
|
|
252
|
+
workRegistryEnabled: ownerSettings?.workRegistryEnabled ?? null,
|
|
253
|
+
workMeshLiveEnabled: ownerSettings?.workMeshLiveEnabled ?? null,
|
|
254
|
+
ontologyEnabled: ownerSettings?.ontologyEnabled ?? null,
|
|
234
255
|
}));
|
|
235
256
|
}
|
|
236
257
|
else {
|
|
237
258
|
console.log(`checkpointGateEnabled=${enabled}`);
|
|
238
|
-
for (const key of [
|
|
239
|
-
|
|
240
|
-
|
|
259
|
+
for (const key of [
|
|
260
|
+
"workRegistryEnabled",
|
|
261
|
+
"workMeshLiveEnabled",
|
|
262
|
+
"ontologyEnabled",
|
|
263
|
+
]) {
|
|
264
|
+
console.log(ownerSettings
|
|
265
|
+
? `${key}=${ownerSettings[key]}`
|
|
241
266
|
: `${key}=unknown (only the company owner or an admin can read this setting)`);
|
|
242
267
|
}
|
|
268
|
+
if (ownerSettings) {
|
|
269
|
+
for (const line of ontologyNextSteps(companySlug, ownerSettings.ontologyEnabled)) {
|
|
270
|
+
console.log(line);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
243
273
|
}
|
|
244
274
|
}
|
|
245
275
|
catch (err) {
|
|
@@ -22,6 +22,23 @@ const CODEX_SIBLING_MODEL = "gpt-5.6-terra";
|
|
|
22
22
|
const CODEX_SIBLING_REASONING_EFFORT = "medium";
|
|
23
23
|
const CLAUDE_SIBLING_MODEL = "claude-sonnet-5";
|
|
24
24
|
const CLAUDE_SIBLING_EFFORT = "medium";
|
|
25
|
+
/**
|
|
26
|
+
* Context a headless maintenance run never uses. A `claude -p` sibling at the
|
|
27
|
+
* HQ root otherwise starts with the whole interactive context: the listing of
|
|
28
|
+
* every skill (~30 KB at a 255-skill HQ), every MCP connector's deferred-tool
|
|
29
|
+
* names and server instructions (~24 KB), and the chat output style meant for
|
|
30
|
+
* a human reader (~16 KB). The sibling then pays for that context again on
|
|
31
|
+
* every one of its ~50-80 model calls, which made it about 17% of a team-plan
|
|
32
|
+
* user's token use (feedback_8e62a685). It reads skill files by path, calls no
|
|
33
|
+
* MCP tool, and has no chat reader, so these flags drop only dead weight.
|
|
34
|
+
* Settings files, CLAUDE.md and hooks (the HQ safety boundary) still load.
|
|
35
|
+
*/
|
|
36
|
+
const CLAUDE_SIBLING_LEAN_CONTEXT_ARGS = [
|
|
37
|
+
"--disable-slash-commands",
|
|
38
|
+
"--strict-mcp-config",
|
|
39
|
+
"--settings",
|
|
40
|
+
JSON.stringify({ outputStyle: "default" }),
|
|
41
|
+
];
|
|
25
42
|
const GROK_SIBLING_MODEL = "grok-4.6";
|
|
26
43
|
const GROK_SIBLING_EFFORT = "medium";
|
|
27
44
|
/**
|
|
@@ -172,6 +189,9 @@ report instead of guessing.
|
|
|
172
189
|
or tokens from the transcript. If .claude/skills/checkpoint/SKILL.md exists
|
|
173
190
|
under this HQ root, read it and follow it wherever it goes beyond these instructions;
|
|
174
191
|
the write bounds below always win over the skill text.
|
|
192
|
+
Slash commands are unavailable in this run. Where that skill says to call
|
|
193
|
+
/learn or run /document-release, do not try the command; do that work by
|
|
194
|
+
path as steps 3 and 6 describe.
|
|
175
195
|
2. Upgrade the thread file named in the payload IN PLACE: verify/repair its
|
|
176
196
|
JSON; fill git.remote_url, git.initial_commit, git.commits_made, and
|
|
177
197
|
git.knowledge_repos by scanning core/knowledge/public/*,
|
|
@@ -1012,6 +1032,7 @@ export function siblingArgs(backend, prompt) {
|
|
|
1012
1032
|
CLAUDE_SIBLING_MODEL,
|
|
1013
1033
|
"--effort",
|
|
1014
1034
|
CLAUDE_SIBLING_EFFORT,
|
|
1035
|
+
...CLAUDE_SIBLING_LEAN_CONTEXT_ARGS,
|
|
1015
1036
|
// `acceptEdits` auto-approves edits only. At the HQ root the scaffold
|
|
1016
1037
|
// settings make Bash "ask", so a terminal command — the git scan, the
|
|
1017
1038
|
// journal helper, the queue-draining `mv` — hits an approval gate with
|
|
@@ -17,6 +17,7 @@ export type DeriveTriggerRunResult = {
|
|
|
17
17
|
};
|
|
18
18
|
export declare function resolveWindowsFilesystemPath(candidate: string, cwd: string, resolveRealpath?: (value: string) => string, isDirectory?: (value: string) => boolean): string | undefined;
|
|
19
19
|
export declare function commandOnPath(command: string, env: Record<string, string | undefined>, platform?: NodeJS.Platform): boolean;
|
|
20
|
+
export declare function matchTextFacts(rawText: string, env: Record<string, string | undefined>): string[];
|
|
20
21
|
/** Run the native handler contract, retaining exact bytes for differential tests. */
|
|
21
22
|
export declare function runDeriveTriggerFacts(options: DeriveTriggerRunOptions): DeriveTriggerRunResult;
|
|
22
23
|
export declare function runDeriveTriggerFactsFast(argv: readonly string[], stdin: string, cwd: string, hqRoot: string | undefined): number;
|