@indigoai-us/hq-cli 5.345.215-beta.0 → 5.345.217
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 +206 -1
- package/README.md +45 -0
- package/assets/scaffold/core/scripts/hq-delegate-verify.sh +5 -2
- package/assets/scaffold/core/scripts/lib/epochrealtime.sh +30 -0
- package/assets/scaffold/core/scripts/lib/work-mesh-enqueue.sh +12 -5
- package/dist/command-catalog.generated.d.ts +105 -10
- package/dist/command-catalog.generated.js +127 -10
- package/dist/command-help.js +3 -1
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/auth.d.ts +1 -1
- package/dist/commands/auth.js +11 -52
- package/dist/commands/bot.js +75 -10
- package/dist/commands/capacity.d.ts +4 -1
- package/dist/commands/capacity.js +46 -10
- package/dist/commands/cloud-demote.d.ts +19 -4
- package/dist/commands/cloud-demote.js +85 -12
- package/dist/commands/cloud-provision.d.ts +5 -1
- package/dist/commands/cloud-provision.js +6 -2
- package/dist/commands/cloud.d.ts +36 -0
- package/dist/commands/cloud.js +110 -27
- package/dist/commands/core-delegate-w1b.js +15 -1
- package/dist/commands/core-policy.js +67 -8
- package/dist/commands/core.js +1 -0
- package/dist/commands/daemon.js +9 -1
- package/dist/commands/dm.js +7 -0
- package/dist/commands/doctor-usage.d.ts +8 -0
- package/dist/commands/doctor-usage.js +20 -0
- package/dist/commands/doctor.js +7 -1
- package/dist/commands/env.d.ts +18 -0
- package/dist/commands/env.js +82 -0
- package/dist/commands/files-browse.d.ts +11 -4
- package/dist/commands/files-browse.js +21 -4
- package/dist/commands/files.d.ts +1 -1
- package/dist/commands/files.js +25 -11
- package/dist/commands/install-global.js +2 -2
- package/dist/commands/integrations-auth-rules.d.ts +27 -0
- package/dist/commands/integrations-auth-rules.js +79 -0
- package/dist/commands/integrations-import.js +124 -12
- package/dist/commands/lanes.js +102 -26
- package/dist/commands/logout.d.ts +7 -0
- package/dist/commands/logout.js +41 -34
- package/dist/commands/mesh.d.ts +2 -0
- package/dist/commands/mesh.js +60 -35
- package/dist/commands/sources.d.ts +8 -2
- package/dist/commands/sources.js +65 -9
- package/dist/commands/sync-held.js +5 -2
- package/dist/commands/whoami.js +26 -1
- package/dist/data/command-states.json +15 -0
- package/dist/index.js +52 -4
- package/dist/lazy-commands.js +5 -6
- package/dist/lib/anywhere-person-setting.d.ts +2 -0
- package/dist/lib/anywhere-person-setting.js +6 -3
- package/dist/lib/billing/usage-card.d.ts +25 -4
- package/dist/lib/billing/usage-card.js +76 -9
- package/dist/lib/billing/usage-cost.d.ts +3 -3
- package/dist/lib/billing/usage-cost.js +35 -13
- package/dist/lib/billing/usage-only.js +4 -2
- package/dist/lib/billing/usage-rate-card.d.ts +2 -2
- package/dist/lib/billing/usage-rate-card.js +3 -0
- package/dist/lib/bot/fleet-cron.d.ts +8 -0
- package/dist/lib/bot/fleet-cron.js +126 -7
- package/dist/lib/bot/fleet-daemon.d.ts +46 -0
- package/dist/lib/bot/fleet-daemon.js +99 -1
- package/dist/lib/bot/inflight.d.ts +9 -0
- package/dist/lib/bot/inflight.js +10 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +12 -1
- package/dist/lib/bot/probe.js +7 -1
- package/dist/lib/bot/run.js +20 -1
- package/dist/lib/bot/runtime/codex.js +1 -1
- package/dist/lib/bot/runtime/grok-acp.d.ts +6 -1
- package/dist/lib/bot/runtime/grok-acp.js +32 -14
- package/dist/lib/bot/runtime/grok.js +1 -1
- package/dist/lib/bot/runtime/index.js +19 -9
- package/dist/lib/bot/runtime/messages-stream.js +2 -2
- package/dist/lib/bot/runtime/types.d.ts +15 -0
- package/dist/lib/bot/runtime/types.js +9 -0
- package/dist/lib/bot/runtime-failure.d.ts +23 -0
- package/dist/lib/bot/runtime-failure.js +43 -1
- package/dist/lib/capacity/accounts.d.ts +8 -0
- package/dist/lib/capacity/accounts.js +19 -0
- package/dist/lib/capacity/available.d.ts +154 -0
- package/dist/lib/capacity/available.js +905 -0
- package/dist/lib/capacity/codex-availability.d.ts +14 -1
- package/dist/lib/capacity/codex-availability.js +26 -1
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +29 -2
- package/dist/lib/capacity/collectors/claude-oauth.js +104 -7
- package/dist/lib/capacity/collectors/codex.js +10 -7
- package/dist/lib/capacity/ledger.d.ts +37 -1
- package/dist/lib/capacity/ledger.js +207 -30
- package/dist/lib/capacity/project.d.ts +26 -0
- package/dist/lib/capacity/project.js +137 -8
- package/dist/lib/capacity/refusal-rows.d.ts +31 -0
- package/dist/lib/capacity/refusal-rows.js +61 -0
- package/dist/lib/capacity/refusal.d.ts +53 -2
- package/dist/lib/capacity/refusal.js +284 -65
- package/dist/lib/capacity/route.js +46 -11
- package/dist/lib/capacity/widget.d.ts +12 -1
- package/dist/lib/capacity/widget.js +91 -3
- package/dist/lib/daemon/flag-monitor.d.ts +8 -0
- package/dist/lib/daemon/flag-monitor.js +17 -6
- package/dist/lib/daemon/flag.d.ts +65 -1
- package/dist/lib/daemon/flag.js +190 -40
- package/dist/lib/daemon/ops/policy.js +62 -5
- package/dist/lib/daemon/paths.d.ts +72 -2
- package/dist/lib/daemon/paths.js +154 -3
- package/dist/lib/daemon/resolver.d.ts +2 -0
- package/dist/lib/daemon/resolver.js +3 -0
- package/dist/lib/daemon/run.d.ts +9 -0
- package/dist/lib/daemon/run.js +79 -21
- package/dist/lib/daemon/selfcheck.d.ts +22 -0
- package/dist/lib/daemon/selfcheck.js +40 -1
- package/dist/lib/daemon/server.d.ts +5 -1
- package/dist/lib/daemon/server.js +17 -23
- package/dist/lib/daemon/state-file-switch.d.ts +57 -0
- package/dist/lib/daemon/state-file-switch.js +88 -0
- package/dist/lib/daemon/state-file.d.ts +198 -0
- package/dist/lib/daemon/state-file.js +419 -0
- package/dist/lib/daemon/tcc-eperm.d.ts +153 -0
- package/dist/lib/daemon/tcc-eperm.js +310 -0
- package/dist/lib/daemon/timed-flag-monitors.d.ts +47 -0
- package/dist/lib/daemon/timed-flag-monitors.js +75 -0
- package/dist/lib/delivery/admission.d.ts +86 -0
- package/dist/lib/delivery/admission.js +148 -0
- package/dist/lib/delivery/artifacts.d.ts +7 -1
- package/dist/lib/delivery/artifacts.js +29 -10
- package/dist/lib/delivery/attempt-id.d.ts +13 -0
- package/dist/lib/delivery/attempt-id.js +16 -0
- package/dist/lib/delivery/disposable-target.d.ts +42 -0
- package/dist/lib/delivery/disposable-target.js +111 -0
- package/dist/lib/delivery/effects.d.ts +136 -0
- package/dist/lib/delivery/effects.js +541 -0
- package/dist/lib/delivery/enrollment.d.ts +21 -17
- package/dist/lib/delivery/enrollment.js +83 -5
- package/dist/lib/delivery/escalations.d.ts +51 -0
- package/dist/lib/delivery/escalations.js +60 -0
- package/dist/lib/delivery/lease.d.ts +80 -0
- package/dist/lib/delivery/lease.js +134 -0
- package/dist/lib/delivery/migrations.d.ts +120 -4
- package/dist/lib/delivery/migrations.js +215 -15
- package/dist/lib/delivery/mqtt.d.ts +2 -0
- package/dist/lib/delivery/mqtt.js +7 -0
- package/dist/lib/delivery/reconciler.d.ts +65 -1
- package/dist/lib/delivery/reconciler.js +224 -13
- package/dist/lib/delivery/rpc/client.d.ts +22 -0
- package/dist/lib/delivery/rpc/client.js +159 -0
- package/dist/lib/delivery/rpc/port.d.ts +40 -0
- package/dist/lib/delivery/rpc/port.js +16 -0
- package/dist/lib/delivery/rpc/server.d.ts +30 -0
- package/dist/lib/delivery/rpc/server.js +205 -0
- package/dist/lib/delivery/rpc/wire.d.ts +85 -0
- package/dist/lib/delivery/rpc/wire.js +143 -0
- package/dist/lib/delivery/store.d.ts +2 -0
- package/dist/lib/delivery/store.js +4 -0
- package/dist/lib/delivery/windows-service-install.d.ts +262 -0
- package/dist/lib/delivery/windows-service-install.js +892 -0
- package/dist/lib/delivery/workers/macos.d.ts +16 -1
- package/dist/lib/delivery/workers/macos.js +54 -12
- package/dist/lib/delivery/workers/windows-service-live.d.ts +121 -0
- package/dist/lib/delivery/workers/windows-service-live.js +711 -0
- package/dist/lib/delivery/workers/windows-service-runner.d.ts +33 -0
- package/dist/lib/delivery/workers/windows-service-runner.js +82 -0
- package/dist/lib/delivery/workers/windows-service.d.ts +140 -0
- package/dist/lib/delivery/workers/windows-service.js +584 -0
- package/dist/lib/delivery/workers/windows.d.ts +32 -22
- package/dist/lib/delivery/workers/windows.js +50 -64
- package/dist/lib/doctor/checks/host-core.d.ts +50 -0
- package/dist/lib/doctor/checks/host-core.js +269 -0
- package/dist/lib/doctor/checks/replay-recorder.d.ts +39 -0
- package/dist/lib/doctor/checks/replay-recorder.js +261 -0
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/environment/profile.d.ts +239 -0
- package/dist/lib/environment/profile.js +251 -0
- package/dist/lib/hook-engine/reconcile.js +39 -13
- package/dist/lib/hook-engine/registration.d.ts +9 -0
- package/dist/lib/hook-engine/registration.js +19 -0
- package/dist/lib/hot-channels/adapters/meetings.d.ts +15 -0
- package/dist/lib/hot-channels/adapters/meetings.js +36 -3
- package/dist/lib/hot-channels/adapters/slack.d.ts +21 -5
- package/dist/lib/hot-channels/adapters/slack.js +64 -21
- package/dist/lib/hot-channels/alert.d.ts +2 -0
- package/dist/lib/hot-channels/alert.js +8 -1
- package/dist/lib/hot-channels/contract.d.ts +12 -0
- package/dist/lib/hot-channels/contract.js +7 -0
- package/dist/lib/hot-channels/loop.js +1 -0
- package/dist/lib/hot-channels/run.d.ts +6 -0
- package/dist/lib/hot-channels/run.js +4 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +74 -1
- package/dist/lib/hot-channels/signals-pass.js +82 -41
- package/dist/lib/hot-channels/signals-redo.js +10 -2
- package/dist/lib/install/claude-targets.d.ts +12 -1
- package/dist/lib/install/claude-targets.js +57 -5
- package/dist/lib/install/codex-targets.d.ts +2 -2
- package/dist/lib/install/codex-targets.js +36 -6
- package/dist/lib/install/hook-target.d.ts +3 -0
- package/dist/lib/install/hook-target.js +11 -0
- package/dist/lib/lanes/canonical-host.d.ts +35 -0
- package/dist/lib/lanes/canonical-host.js +65 -0
- package/dist/lib/lanes/host-capacity.d.ts +30 -0
- package/dist/lib/lanes/host-capacity.js +29 -3
- package/dist/lib/lanes/watcher.js +35 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +2 -0
- package/dist/lib/mesh/live/daemon/run.js +5 -2
- package/dist/lib/mesh/live/flush.d.ts +5 -1
- package/dist/lib/mesh/live/flush.js +12 -6
- package/dist/lib/mesh/live/reporting-privacy.d.ts +32 -0
- package/dist/lib/mesh/live/reporting-privacy.js +56 -1
- package/dist/lib/mesh/live/spool.d.ts +7 -0
- package/dist/lib/mesh/live/spool.js +25 -0
- package/dist/lib/person-setting-cache.d.ts +38 -0
- package/dist/lib/person-setting-cache.js +98 -0
- package/dist/lib/safe-store.d.ts +245 -0
- package/dist/lib/safe-store.js +777 -0
- package/dist/lib/signals/engine.d.ts +29 -2
- package/dist/lib/signals/engine.js +103 -4
- package/dist/lib/signals/reply.js +73 -18
- package/dist/lib/signals/steps/adapters.js +7 -2
- package/dist/lib/signals/steps/extract.d.ts +13 -0
- package/dist/lib/signals/steps/extract.js +122 -6
- package/dist/main.js +46 -3
- package/dist/schemas/hq-available-ai.v1.schema.json +76 -0
- package/dist/schemas/hq-environment-profile.v1.schema.json +438 -0
- package/dist/utils/auth-expiry.d.ts +8 -0
- package/dist/utils/auth-expiry.js +53 -0
- package/dist/utils/catalog-runtime-paths.d.ts +34 -0
- package/dist/utils/catalog-runtime-paths.js +53 -0
- package/dist/utils/cli-telemetry.d.ts +21 -0
- package/dist/utils/cli-telemetry.js +34 -0
- package/dist/utils/command-usage.d.ts +275 -0
- package/dist/utils/command-usage.js +797 -0
- package/dist/utils/files-browse-acl.js +1 -1
- package/dist/utils/hook-trust.d.ts +7 -0
- package/dist/utils/hook-trust.js +31 -4
- package/dist/utils/host-registration.d.ts +126 -0
- package/dist/utils/host-registration.js +378 -0
- package/dist/utils/resident-package-preload.js +2 -0
- package/package.json +10 -8
- package/scripts/bench-core.mjs +1096 -0
- package/scripts/check-function-manifest.mjs +702 -0
- package/dist/lib/delivery/workers/windows-boundary.d.ts +0 -453
- package/dist/lib/delivery/workers/windows-boundary.js +0 -693
package/dist/commands/cloud.js
CHANGED
|
@@ -533,7 +533,7 @@ export function identityHeldLines(count, notice) {
|
|
|
533
533
|
return [];
|
|
534
534
|
return [
|
|
535
535
|
`⚠ ${count} file(s) were NOT uploaded: uploads for this company are held on this computer ` +
|
|
536
|
-
`
|
|
536
|
+
`until you confirm they belong to the signed-in account. Run \`hq sync held\` to see what is held, then ` +
|
|
537
537
|
`\`hq sync release-held\` to upload it.`,
|
|
538
538
|
];
|
|
539
539
|
}
|
|
@@ -1531,6 +1531,7 @@ export function registerCloudCommands(program) {
|
|
|
1531
1531
|
(personalMode ? undefined : companySlugFromSyncPaths(options.hqRoot, targetPaths));
|
|
1532
1532
|
const identityHeld = createIdentityHeldTracker();
|
|
1533
1533
|
const heldDeleteTracker = createUnattendedHeldDeleteTracker();
|
|
1534
|
+
const pushSkipTracker = createPushSkipReasonTracker();
|
|
1534
1535
|
syncHealth = beginSyncHealthReport();
|
|
1535
1536
|
if (!personalMode) {
|
|
1536
1537
|
const companyUid = entityContext?.uid ??
|
|
@@ -1561,6 +1562,7 @@ export function registerCloudCommands(program) {
|
|
|
1561
1562
|
progressRecorder: ((record) => (event) => {
|
|
1562
1563
|
identityHeld.observe(event);
|
|
1563
1564
|
heldDeleteTracker.observe(event);
|
|
1565
|
+
pushSkipTracker.observe(event);
|
|
1564
1566
|
record(event);
|
|
1565
1567
|
})(trackingProgressRecorder(planLimitTracker, progressCompany)),
|
|
1566
1568
|
...(personalMode ? { personalMode: true } : {}),
|
|
@@ -1571,6 +1573,10 @@ export function registerCloudCommands(program) {
|
|
|
1571
1573
|
});
|
|
1572
1574
|
const planLimitRefused = planLimitTracker.summary();
|
|
1573
1575
|
const identityHeldCount = identityHeld.count();
|
|
1576
|
+
const pushSkipReasons = pushSkipTracker.counts();
|
|
1577
|
+
const pushSkipInput = pushSkipReasons
|
|
1578
|
+
? { ...result, skipReasons: pushSkipReasons }
|
|
1579
|
+
: result;
|
|
1574
1580
|
const heldDeletes = heldDeleteTracker.held();
|
|
1575
1581
|
const staleRefusalCount = staleRefusalsExcludingHeld(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes).count;
|
|
1576
1582
|
const uploadFailed = readUploadFailures(result);
|
|
@@ -1690,12 +1696,12 @@ export function registerCloudCommands(program) {
|
|
|
1690
1696
|
}
|
|
1691
1697
|
}
|
|
1692
1698
|
else if (heldDeletes.length > 0) {
|
|
1693
|
-
log(chalk.yellow(`\n⚠ Pushed ${result.filesUploaded} file(s) (${formatBytes(result.bytesUploaded)}, ${formatPushSkipSummary(
|
|
1699
|
+
log(chalk.yellow(`\n⚠ Pushed ${result.filesUploaded} file(s) (${formatBytes(result.bytesUploaded)}, ${formatPushSkipSummary(pushSkipInput)})`));
|
|
1694
1700
|
for (const line of unattendedHeldDeleteLines(heldDeletes))
|
|
1695
1701
|
log(chalk.yellow(line));
|
|
1696
1702
|
}
|
|
1697
1703
|
else {
|
|
1698
|
-
const skipSummary = formatPushSkipSummary(
|
|
1704
|
+
const skipSummary = formatPushSkipSummary(pushSkipInput);
|
|
1699
1705
|
log(chalk.green(`\n✓ Pushed ${result.filesUploaded} file(s) (${formatBytes(result.bytesUploaded)}, ${skipSummary})`));
|
|
1700
1706
|
}
|
|
1701
1707
|
await syncHealth.succeeded();
|
|
@@ -2348,6 +2354,7 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2348
2354
|
: (opts.targetSlug ?? opts.company);
|
|
2349
2355
|
const tracker = createPlanLimitRefusalTracker(companySlugForBilling(progressCompany));
|
|
2350
2356
|
const heldDeleteTracker = createUnattendedHeldDeleteTracker();
|
|
2357
|
+
const skipTracker = createPushSkipReasonTracker();
|
|
2351
2358
|
const record = trackingProgressRecorder(tracker, progressCompany);
|
|
2352
2359
|
const shareResult = await share({
|
|
2353
2360
|
paths: opts.paths,
|
|
@@ -2356,6 +2363,7 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2356
2363
|
hqRoot: opts.hqRoot,
|
|
2357
2364
|
progressRecorder: (event) => {
|
|
2358
2365
|
heldDeleteTracker.observe(event);
|
|
2366
|
+
skipTracker.observe(event);
|
|
2359
2367
|
record(event);
|
|
2360
2368
|
},
|
|
2361
2369
|
...(opts.onConflict ? { onConflict: opts.onConflict } : {}),
|
|
@@ -2378,7 +2386,13 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2378
2386
|
...(opts.prefixSet !== undefined ? { prefixSet: opts.prefixSet } : {}),
|
|
2379
2387
|
...(author ? { author } : {}),
|
|
2380
2388
|
});
|
|
2381
|
-
|
|
2389
|
+
const skipReasons = skipTracker.counts();
|
|
2390
|
+
return {
|
|
2391
|
+
...shareResult,
|
|
2392
|
+
planLimit: tracker.summary(),
|
|
2393
|
+
heldDeletes: heldDeleteTracker.held(),
|
|
2394
|
+
...(skipReasons ? { skipReasons } : {}),
|
|
2395
|
+
};
|
|
2382
2396
|
},
|
|
2383
2397
|
});
|
|
2384
2398
|
}
|
|
@@ -2404,11 +2418,12 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
|
|
|
2404
2418
|
legStale > 0 ||
|
|
2405
2419
|
legHeld > 0 ||
|
|
2406
2420
|
(r.filesUploadFailed ?? 0) > 0 ||
|
|
2421
|
+
describePushSkips(r).warn ||
|
|
2407
2422
|
legRefused
|
|
2408
2423
|
? chalk.yellow("⚠")
|
|
2409
2424
|
: chalk.green("✓");
|
|
2410
2425
|
console.log(` ${status} ${row.slug}: ${r.filesUploaded} file(s), ` +
|
|
2411
|
-
`${formatBytes(r.bytesUploaded)}, ${r
|
|
2426
|
+
`${formatBytes(r.bytesUploaded)}, ${formatPushSkipSummary(r)}, ` +
|
|
2412
2427
|
`${r.filesDeleted} deleted, ${r.filesExcludedByScope} scope-excluded, ` +
|
|
2413
2428
|
`${legStale} stale-refused, ${r.filesUploadFailed ?? 0} failed, ` +
|
|
2414
2429
|
(legHeld > 0 ? `${legHeld} deletion(s) held, ` : "") +
|
|
@@ -2579,6 +2594,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2579
2594
|
// still printed "0 uploaded, 0 skipped" and "Sync now complete".
|
|
2580
2595
|
const pushIdentityHeld = createIdentityHeldTracker();
|
|
2581
2596
|
const pushHeldDeletes = createUnattendedHeldDeleteTracker();
|
|
2597
|
+
const pushSkipTracker = createPushSkipReasonTracker();
|
|
2582
2598
|
const pushRecord = trackingProgressRecorder(planLimitTracker, pushProgressCompany);
|
|
2583
2599
|
const pushResult = await share({
|
|
2584
2600
|
paths: pushPaths,
|
|
@@ -2588,6 +2604,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2588
2604
|
progressRecorder: (event) => {
|
|
2589
2605
|
pushIdentityHeld.observe(event);
|
|
2590
2606
|
pushHeldDeletes.observe(event);
|
|
2607
|
+
pushSkipTracker.observe(event);
|
|
2591
2608
|
pushRecord(event);
|
|
2592
2609
|
},
|
|
2593
2610
|
skipUnchanged: true,
|
|
@@ -2615,11 +2632,15 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
2615
2632
|
pushStaleCount > 0 ||
|
|
2616
2633
|
pushHeldDeleteList.length > 0 ||
|
|
2617
2634
|
pushUploadFailed.count > 0 ||
|
|
2635
|
+
describePushSkips({ ...pushResult, skipReasons: pushSkipTracker.counts() }).warn ||
|
|
2618
2636
|
pushRefused
|
|
2619
2637
|
? chalk.yellow("⚠")
|
|
2620
2638
|
: chalk.green("✓");
|
|
2621
2639
|
console.log(` ${pushStatus} ` +
|
|
2622
|
-
`${pushResult.filesUploaded} uploaded, ${
|
|
2640
|
+
`${pushResult.filesUploaded} uploaded, ${formatPushSkipSummary({
|
|
2641
|
+
...pushResult,
|
|
2642
|
+
skipReasons: pushSkipTracker.counts(),
|
|
2643
|
+
})}, ` +
|
|
2623
2644
|
`${pushResult.filesDeleted} deleted, ${pushResult.filesExcludedByScope} scope-excluded` +
|
|
2624
2645
|
(pushHeldCount > 0 ? `, ${pushHeldCount} held` : "") +
|
|
2625
2646
|
(pushHeldDeleteList.length > 0 ? `, ${pushHeldDeleteList.length} deletion(s) held` : "") +
|
|
@@ -3022,34 +3043,96 @@ function scopeLabel(slug) {
|
|
|
3022
3043
|
return "personal (companies/personal)";
|
|
3023
3044
|
return slug;
|
|
3024
3045
|
}
|
|
3025
|
-
|
|
3046
|
+
/** Plain-words phrase for each non-up-to-date push skip reason; `warn` marks ones that need a look. */
|
|
3047
|
+
const PUSH_SKIP_REASON_WORDS = {
|
|
3048
|
+
merged_with_remote: { phrase: "merged with the cloud copy", warn: false },
|
|
3049
|
+
held_for_next_pass: { phrase: "held for the next pass", warn: false },
|
|
3050
|
+
vanished_before_upload: { phrase: "disappeared before upload", warn: false },
|
|
3051
|
+
remote_deleted_not_recreated: { phrase: "deleted in the cloud and not re-created", warn: false },
|
|
3052
|
+
vault_deleted_local_unchanged: { phrase: "deleted in the cloud, local copy unchanged", warn: false },
|
|
3053
|
+
body_changed_during_decision: { phrase: "changed while sync was deciding", warn: false },
|
|
3054
|
+
local_continuity_pointer_newer: { phrase: "kept because the local handoff pointer is newer", warn: false },
|
|
3055
|
+
retry_budget_exhausted: { phrase: "still changing after repeated attempts", warn: true },
|
|
3056
|
+
remote_body_unreadable: { phrase: "cloud copy could not be read", warn: true },
|
|
3057
|
+
unsafe_personal_mcp: { phrase: "personal connector file not safe to write", warn: true },
|
|
3058
|
+
merge_write_failed: { phrase: "could not merge with the cloud copy", warn: true },
|
|
3059
|
+
};
|
|
3060
|
+
/** Tallies push `reconciled` skip reasons (other than up to date) so every summary can name them. */
|
|
3061
|
+
export function createPushSkipReasonTracker() {
|
|
3062
|
+
const counts = {};
|
|
3063
|
+
return {
|
|
3064
|
+
observe(event) {
|
|
3065
|
+
if (event.type !== "reconciled" || event.direction !== "push")
|
|
3066
|
+
return;
|
|
3067
|
+
if (typeof event.reason !== "string")
|
|
3068
|
+
return;
|
|
3069
|
+
if (event.reason === "already_up_to_date" || event.reason === "already_landed")
|
|
3070
|
+
return;
|
|
3071
|
+
counts[event.reason] = (counts[event.reason] ?? 0) + 1;
|
|
3072
|
+
},
|
|
3073
|
+
counts: () => (Object.keys(counts).length > 0 ? { ...counts } : undefined),
|
|
3074
|
+
};
|
|
3075
|
+
}
|
|
3076
|
+
/**
|
|
3077
|
+
* The one summary every push print site uses. Up-to-date skips read "already
|
|
3078
|
+
* up to date" and each other reason is named in words. Conflicts, broken
|
|
3079
|
+
* links and reasons that need a look are grouped as "N skipped (...)" and
|
|
3080
|
+
* set `warn` so callers can mark the line. Skips with no named reason are
|
|
3081
|
+
* counted as a plain "N skipped" and never warn. The counts always add up
|
|
3082
|
+
* to filesSkipped.
|
|
3083
|
+
*/
|
|
3084
|
+
export function describePushSkips(result) {
|
|
3026
3085
|
const detail = result.filesSkippedDetail;
|
|
3027
3086
|
if (!detail)
|
|
3028
|
-
return `${result.filesSkipped} skipped
|
|
3087
|
+
return { text: `${result.filesSkipped} skipped`, warn: false };
|
|
3029
3088
|
const parts = [];
|
|
3030
3089
|
if (detail.upToDate > 0)
|
|
3031
3090
|
parts.push(`${detail.upToDate} already up to date`);
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
}
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3091
|
+
const tally = Object.entries(result.skipReasons ?? {}).filter(([, n]) => (n ?? 0) > 0);
|
|
3092
|
+
let otherLeft = detail.other;
|
|
3093
|
+
const attention = [];
|
|
3094
|
+
if (detail.conflict > 0) {
|
|
3095
|
+
attention.push({
|
|
3096
|
+
count: detail.conflict,
|
|
3097
|
+
label: `${detail.conflict} conflict${detail.conflict === 1 ? "" : "s"}`,
|
|
3098
|
+
});
|
|
3099
|
+
}
|
|
3100
|
+
if (detail.brokenLink > 0) {
|
|
3101
|
+
attention.push({
|
|
3102
|
+
count: detail.brokenLink,
|
|
3103
|
+
label: `${detail.brokenLink} broken link${detail.brokenLink === 1 ? "" : "s"}`,
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3106
|
+
for (const [reason, n] of tally) {
|
|
3107
|
+
const words = PUSH_SKIP_REASON_WORDS[reason];
|
|
3108
|
+
const take = words ? Math.min(n ?? 0, otherLeft) : 0;
|
|
3109
|
+
if (!words || take <= 0)
|
|
3110
|
+
continue;
|
|
3111
|
+
otherLeft -= take;
|
|
3112
|
+
if (words.warn)
|
|
3113
|
+
attention.push({ count: take, label: `${take} ${words.phrase}` });
|
|
3114
|
+
else
|
|
3115
|
+
parts.push(`${take} ${words.phrase}`);
|
|
3116
|
+
}
|
|
3117
|
+
// Unattributed skips (no reconciled reason, or an unknown reason name) are
|
|
3118
|
+
// routine engine skips: inside a warning group they are named "N other",
|
|
3119
|
+
// on their own they read as a plain "N skipped". They never warn.
|
|
3120
|
+
if (attention.length > 0) {
|
|
3121
|
+
const labels = attention.map((a) => a.label);
|
|
3122
|
+
if (otherLeft > 0)
|
|
3123
|
+
labels.push(`${otherLeft} other`);
|
|
3124
|
+
const total = attention.reduce((sum, item) => sum + item.count, 0) + otherLeft;
|
|
3125
|
+
parts.push(`${total} skipped (${labels.join(", ")})`);
|
|
3126
|
+
}
|
|
3127
|
+
else if (otherLeft > 0) {
|
|
3128
|
+
parts.push(`${otherLeft} skipped`);
|
|
3049
3129
|
}
|
|
3050
3130
|
if (parts.length === 0)
|
|
3051
|
-
return `${result.filesSkipped} skipped
|
|
3052
|
-
return parts.join(", ");
|
|
3131
|
+
return { text: `${result.filesSkipped} skipped`, warn: false };
|
|
3132
|
+
return { text: parts.join(", "), warn: attention.length > 0 };
|
|
3133
|
+
}
|
|
3134
|
+
function formatPushSkipSummary(result) {
|
|
3135
|
+
return describePushSkips(result).text;
|
|
3053
3136
|
}
|
|
3054
3137
|
function formatBytes(bytes) {
|
|
3055
3138
|
if (bytes === 0)
|
|
@@ -140,12 +140,26 @@ function groupMemberIds(output) {
|
|
|
140
140
|
return lines.slice(header + 1).filter((line) => line.trim() !== "")
|
|
141
141
|
.map((line) => line.trim().split(/\s{2,}/, 1)[0] ?? "");
|
|
142
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Creator-row ACL label in any hq-cli wording: bare "creator access", the older
|
|
145
|
+
* "creator access — creator-only", or "creator access (<note>)". The listing
|
|
146
|
+
* comes from the `hq` on PATH, which can be older or newer than this build, so
|
|
147
|
+
* matching only this build's label would fail creator rows from another
|
|
148
|
+
* version. Mirrors the creator alternative in hq-delegate-verify.sh.
|
|
149
|
+
*/
|
|
150
|
+
const CREATOR_ACL_LABEL = / (creator access(?: — creator-only| \([^()]*\))?)$/;
|
|
151
|
+
function trailingAclLabel(row, aclLabels) {
|
|
152
|
+
const creator = CREATOR_ACL_LABEL.exec(row)?.[1];
|
|
153
|
+
if (creator)
|
|
154
|
+
return creator;
|
|
155
|
+
return aclLabels.find((label) => row.endsWith(label));
|
|
156
|
+
}
|
|
143
157
|
function browseContainsExactKey(listing, expected) {
|
|
144
158
|
const lines = listing.split(/\r?\n/);
|
|
145
159
|
const aclLabels = Object.values(ACL_SOURCE_DISPLAY_LABELS);
|
|
146
160
|
return lines.slice(2).some((line) => {
|
|
147
161
|
const row = stripAnsiSequences(line).trimEnd();
|
|
148
|
-
const acl =
|
|
162
|
+
const acl = trailingAclLabel(row, aclLabels);
|
|
149
163
|
if (!acl)
|
|
150
164
|
return false;
|
|
151
165
|
const beforeAcl = row.slice(0, -acl.length).trimEnd();
|
|
@@ -57,7 +57,8 @@ const RETIRE_HELP = [
|
|
|
57
57
|
'# trigger loader, the company-bind digest, the age report.',
|
|
58
58
|
'#',
|
|
59
59
|
'# Usage:',
|
|
60
|
-
'# policy-retire.sh <slug-or-path> --reason "<why>" [--by <who>]',
|
|
60
|
+
'# policy-retire.sh <slug-or-path> --reason "<why>" --evidence "<block log path, incident ref or ledger entry>" [--by <who>]',
|
|
61
|
+
'# (--evidence is required: a rule is not retired on guesswork; it is recorded as retired_evidence:)',
|
|
61
62
|
'# policy-retire.sh <slug-or-path> --restore',
|
|
62
63
|
'# policy-retire.sh --from-report <age-report.json> --class <never-fired|dormant|stale-refs|single-incident-old> --reason "<why>" [--yes]',
|
|
63
64
|
'# policy-retire.sh --auto [--dir <policies-dir>]... [--classes a,b] [--report-dir <dir>] [--dry-run]',
|
|
@@ -562,6 +563,15 @@ export function runPolicyAgeReport(args, root, env = process.env, nowEpoch = Mat
|
|
|
562
563
|
export function runPolicyFrontmatter(args, cwd, env = process.env, platform = process.platform) {
|
|
563
564
|
return runPolicyFrontmatterImpl(args, cwd, env.PATH, platform);
|
|
564
565
|
}
|
|
566
|
+
// The default --by is a session id or user name, which is not always a safe bare YAML scalar
|
|
567
|
+
// (UUIDs often start with a digit). Normalize it so the default always passes invalidRetiredBy.
|
|
568
|
+
// An explicit --by is never normalized; it is validated as typed.
|
|
569
|
+
function defaultRetiredBy(env) {
|
|
570
|
+
const raw = env.HQ_SESSION_ID || env.USER || 'unknown';
|
|
571
|
+
const cleaned = raw.replace(/[^A-Za-z0-9._@-]/g, '-');
|
|
572
|
+
const prefixed = /^[A-Za-z_]/.test(cleaned) ? cleaned : `sess-${cleaned}`;
|
|
573
|
+
return invalidRetiredBy(prefixed) === undefined ? prefixed : `sess-${prefixed}`;
|
|
574
|
+
}
|
|
565
575
|
function parseRetireOptions(args, scriptPath, env) {
|
|
566
576
|
const value = {
|
|
567
577
|
auto: false,
|
|
@@ -570,7 +580,8 @@ function parseRetireOptions(args, scriptPath, env) {
|
|
|
570
580
|
reportDir: '',
|
|
571
581
|
classes: '',
|
|
572
582
|
reason: '',
|
|
573
|
-
|
|
583
|
+
evidence: '',
|
|
584
|
+
by: defaultRetiredBy(env),
|
|
574
585
|
restore: false,
|
|
575
586
|
report: '',
|
|
576
587
|
className: '',
|
|
@@ -582,6 +593,7 @@ function parseRetireOptions(args, scriptPath, env) {
|
|
|
582
593
|
['--report-dir', 'reportDir'],
|
|
583
594
|
['--classes', 'classes'],
|
|
584
595
|
['--reason', 'reason'],
|
|
596
|
+
['--evidence', 'evidence'],
|
|
585
597
|
['--by', 'by'],
|
|
586
598
|
['--from-report', 'report'],
|
|
587
599
|
['--class', 'className'],
|
|
@@ -618,6 +630,7 @@ function parseRetireOptions(args, scriptPath, env) {
|
|
|
618
630
|
'--report-dir': 45,
|
|
619
631
|
'--classes': 46,
|
|
620
632
|
'--reason': 47,
|
|
633
|
+
'--evidence': 47,
|
|
621
634
|
'--by': 48,
|
|
622
635
|
'--from-report': 50,
|
|
623
636
|
'--class': 51,
|
|
@@ -659,7 +672,20 @@ function awkRecords(content) {
|
|
|
659
672
|
}
|
|
660
673
|
return records;
|
|
661
674
|
}
|
|
662
|
-
function
|
|
675
|
+
function yamlDoubleQuoted(value) {
|
|
676
|
+
return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
677
|
+
}
|
|
678
|
+
// eslint-disable-next-line no-control-regex
|
|
679
|
+
const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f]/;
|
|
680
|
+
// retired_by is written as a bare YAML scalar, so it is limited to characters that
|
|
681
|
+
// cannot change how the line parses, and to values YAML would not read as null, bool,
|
|
682
|
+
// number or date (so the first character must be a letter or underscore).
|
|
683
|
+
function invalidRetiredBy(by) {
|
|
684
|
+
if (/^[A-Za-z_][A-Za-z0-9._@-]*$/.test(by) && !/^(null|true|false|yes|no|on|off|y|n)$/i.test(by))
|
|
685
|
+
return undefined;
|
|
686
|
+
return 'policy-retire: --by must be a plain id (letters, digits, ".", "_", "@", "-"; starting with a letter or "_" so YAML cannot read it as a number or date; not a YAML keyword such as null or true)\n';
|
|
687
|
+
}
|
|
688
|
+
function rewriteStatus(content, status, reason, by, now, evidence = '') {
|
|
663
689
|
const output = [];
|
|
664
690
|
let depth = 0;
|
|
665
691
|
let done = false;
|
|
@@ -669,20 +695,20 @@ function rewriteStatus(content, status, reason, by, now) {
|
|
|
669
695
|
depth += 1;
|
|
670
696
|
if (depth === 2 && !done) {
|
|
671
697
|
if (status === 'retired') {
|
|
672
|
-
output.push(Buffer.from(`status: retired\nretired_at: ${now.toISOString().replace(/\.\d{3}Z$/, 'Z')}\nretired_by: ${by}\nretired_reason:
|
|
698
|
+
output.push(Buffer.from(`status: retired\nretired_at: ${now.toISOString().replace(/\.\d{3}Z$/, 'Z')}\nretired_by: ${by}\nretired_reason: ${yamlDoubleQuoted(reason)}\n${evidence ? `retired_evidence: ${yamlDoubleQuoted(evidence)}\n` : ''}`));
|
|
673
699
|
}
|
|
674
700
|
done = true;
|
|
675
701
|
}
|
|
676
702
|
output.push(record, Buffer.from('\n'));
|
|
677
703
|
continue;
|
|
678
704
|
}
|
|
679
|
-
if (depth === 1 && /^(status|retired_at|retired_by|retired_reason):/.test(line))
|
|
705
|
+
if (depth === 1 && /^(status|retired_at|retired_by|retired_reason|retired_evidence):/.test(line))
|
|
680
706
|
continue;
|
|
681
707
|
output.push(record, Buffer.from('\n'));
|
|
682
708
|
}
|
|
683
709
|
return Buffer.concat(output);
|
|
684
710
|
}
|
|
685
|
-
function setPolicyStatus(filePath, status, reason, by, env, now, cwd = process.cwd(), validatePolicy = policyValidatorDiagnostic) {
|
|
711
|
+
function setPolicyStatus(filePath, status, reason, by, env, now, cwd = process.cwd(), validatePolicy = policyValidatorDiagnostic, evidence = '') {
|
|
686
712
|
const resolvedPath = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath);
|
|
687
713
|
let content;
|
|
688
714
|
try {
|
|
@@ -707,7 +733,7 @@ function setPolicyStatus(filePath, status, reason, by, env, now, cwd = process.c
|
|
|
707
733
|
};
|
|
708
734
|
}
|
|
709
735
|
const tempPath = `${resolvedPath}.tmp`;
|
|
710
|
-
fs.writeFileSync(tempPath, rewriteStatus(content, status, reason, by, now), { mode: 0o666 });
|
|
736
|
+
fs.writeFileSync(tempPath, rewriteStatus(content, status, reason, by, now, evidence), { mode: 0o666 });
|
|
711
737
|
fs.renameSync(tempPath, filePath);
|
|
712
738
|
return { ok: true };
|
|
713
739
|
}
|
|
@@ -926,6 +952,9 @@ function autoRetire(options, root, cwd, env, now) {
|
|
|
926
952
|
function fromReport(options, root, cwd, env, now) {
|
|
927
953
|
if (!options.className || !options.reason)
|
|
928
954
|
return policyResult(2, '', '--from-report needs --class and --reason\n');
|
|
955
|
+
const byError = invalidRetiredBy(options.by);
|
|
956
|
+
if (byError)
|
|
957
|
+
return policyResult(2, '', byError);
|
|
929
958
|
const reportPath = path.isAbsolute(options.report) ? options.report : path.resolve(cwd, options.report);
|
|
930
959
|
let reportText;
|
|
931
960
|
try {
|
|
@@ -1003,6 +1032,20 @@ export function runPolicyRetire(args, root, cwd, env = process.env, now = new Da
|
|
|
1003
1032
|
if (parsed.kind === 'error')
|
|
1004
1033
|
return parsed.result;
|
|
1005
1034
|
const options = parsed.value;
|
|
1035
|
+
// Gate --by before any file I/O on every path that writes it (retire, --from-report, --auto).
|
|
1036
|
+
// --restore writes status: active and no retired_by, so it is not gated.
|
|
1037
|
+
if (!options.restore) {
|
|
1038
|
+
const byGate = invalidRetiredBy(options.by);
|
|
1039
|
+
if (byGate)
|
|
1040
|
+
return policyResult(2, '', byGate);
|
|
1041
|
+
// --reason and --evidence become frontmatter lines on every write path
|
|
1042
|
+
// (single target, --from-report, --auto), so check them before any of them runs.
|
|
1043
|
+
for (const [flag, text] of [['--reason', options.reason], ['--evidence', options.evidence.trim()]]) {
|
|
1044
|
+
if (text && CONTROL_CHARACTERS.test(text)) {
|
|
1045
|
+
return policyResult(2, '', `policy-retire: ${flag} must be a single line without control characters (newlines, tabs or escape codes)\n`);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1006
1049
|
if (options.auto)
|
|
1007
1050
|
return autoRetire(options, root, cwd, env, now);
|
|
1008
1051
|
if (options.report)
|
|
@@ -1020,7 +1063,23 @@ export function runPolicyRetire(args, root, cwd, env = process.env, now = new Da
|
|
|
1020
1063
|
}
|
|
1021
1064
|
if (!options.reason)
|
|
1022
1065
|
return policyResult(2, '', 'policy-retire: --reason is required\n');
|
|
1023
|
-
|
|
1066
|
+
// A manual retirement needs saved evidence (block log, incident ref, ledger entry) so a
|
|
1067
|
+
// rule is not retired on guesswork. garden-policy-pass already derives its evidence from
|
|
1068
|
+
// the age report and states it in --reason, so it is the one caller exempt from the flag.
|
|
1069
|
+
// The exemption is keyed on the --by string, which anyone can type; it is not an identity check.
|
|
1070
|
+
const evidence = options.evidence.trim();
|
|
1071
|
+
if (!evidence && options.by !== 'garden-policy-pass') {
|
|
1072
|
+
return policyResult(2, '', 'policy-retire: --evidence is required: name the saved evidence (block log path, incident ref or ledger entry) for retiring this rule\n');
|
|
1073
|
+
}
|
|
1074
|
+
const byError = invalidRetiredBy(options.by);
|
|
1075
|
+
if (byError)
|
|
1076
|
+
return policyResult(2, '', byError);
|
|
1077
|
+
for (const [flag, text] of [['--reason', options.reason], ['--evidence', evidence]]) {
|
|
1078
|
+
if (CONTROL_CHARACTERS.test(text)) {
|
|
1079
|
+
return policyResult(2, '', `policy-retire: ${flag} must be a single line without control characters (newlines, tabs or escape codes)\n`);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
const updated = setPolicyStatus(file, 'retired', options.reason, options.by, env, now, cwd, dependencies.validatePolicy, evidence);
|
|
1024
1083
|
if (!updated.ok)
|
|
1025
1084
|
return policyResult(1, '', updated.error);
|
|
1026
1085
|
return policyResult(0, `policy-retire: retired ${displayPolicyPath(file, root)} — ${options.reason}\n`);
|
package/dist/commands/core.js
CHANGED
|
@@ -323,6 +323,7 @@ export const SCAFFOLD_ONLY_ASSETS = [
|
|
|
323
323
|
{ asset: "core/scripts/lib/hq-cli-floor.sh", root: "live", summary: "Shared CLI version-floor helper sourced by generated forwarders" },
|
|
324
324
|
{ asset: "core/scripts/lib/delegate-brainstorm.sh", root: "live", summary: "Shared brainstorm-stage data helper sourced by delegate assets" },
|
|
325
325
|
{ asset: "core/scripts/lib/forwarder.sh", root: "live", summary: "Shared runtime sourced by generated scaffold forwarders" },
|
|
326
|
+
{ asset: "core/scripts/lib/epochrealtime.sh", root: "live", summary: "Locale-safe epoch-realtime helper sourced by work-mesh-enqueue.sh" },
|
|
326
327
|
{ asset: "core/scripts/lib/work-mesh-enqueue.sh", root: "live", summary: "Work Mesh Live spool enqueue lib sourced by hooks" },
|
|
327
328
|
{ asset: "core/scripts/lib/work-mesh-live-hook.sh", root: "live", summary: "Work Mesh Live hook helpers sourced by rebind" },
|
|
328
329
|
{ asset: "core/scripts/lib/work-mesh-live-rebind.sh", root: "live", summary: "Work Mesh Live session rebind library sourced by hooks and the native rollback command" },
|
package/dist/commands/daemon.js
CHANGED
|
@@ -27,6 +27,7 @@ import { daemonUnitInstalled } from "../lib/daemon/handoff.js";
|
|
|
27
27
|
import { adoptLegacyUnits, readAdoptedUnits, restoreLegacyUnits } from "../lib/daemon/migrate.js";
|
|
28
28
|
import { DAEMON_ALIVE_WAIT_MS, ROOT_REFUSAL, SYSTEM_UNIT_DIR, WINDOWS_START_WAIT_MS, waitForLiveDaemon, daemonRootRefusal, installDaemonUnit, installScopeFor, classifyWindowsTask, daemonServiceStatus, describeSupervision, legacyWindowsTask, startDaemonUnit, readWindowsSid, uninstallDaemonUnit, windowsInteractiveSession, windowsTaskName, } from "../lib/daemon/install.js";
|
|
29
29
|
import { PLIST_REFRESH_MARKER } from "../lib/daemon/plist-refresh.js";
|
|
30
|
+
import { FILES_ACCESS_NEEDED_MESSAGE, filesAccessNeeded } from "../lib/daemon/tcc-eperm.js";
|
|
30
31
|
import { describeLegacyUnit, findLegacyUnits } from "../lib/daemon/legacy.js";
|
|
31
32
|
import { isDaemonProcess, liveDaemonLock, runningDaemonPid } from "../lib/daemon/lock.js";
|
|
32
33
|
import { bundledHqCloud, managedHqCloud, managedHqCloudRoot, readHqCloudCopy, readHqCloudUpdateState } from "../lib/daemon/hq-cloud.js";
|
|
@@ -513,6 +514,10 @@ function statusWarnings(service, paths) {
|
|
|
513
514
|
if (warnings.length > 0 && fs.existsSync(path.join(paths.root, PLIST_REFRESH_MARKER))) {
|
|
514
515
|
warnings.push(`The daemon tried to rewrite it automatically and did not finish. See: ${path.join(paths.root, "logs", "plist-refresh.log")}`);
|
|
515
516
|
}
|
|
517
|
+
// Written by a daemon that macOS keeps refusing under the HQ root (tcc-eperm.ts).
|
|
518
|
+
// A stopped daemon's marker is stale: the next daemon clears it on start.
|
|
519
|
+
if (service.daemonPid !== null && filesAccessNeeded(paths.root))
|
|
520
|
+
warnings.push(FILES_ACCESS_NEEDED_MESSAGE);
|
|
516
521
|
return warnings;
|
|
517
522
|
}
|
|
518
523
|
async function runStatus(d, opts) {
|
|
@@ -1855,15 +1860,18 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
1855
1860
|
.command("sync-core-selfcheck")
|
|
1856
1861
|
.description("DM the person signed in here when a sync engine unit has been held or failing for over 30 minutes (at most daily per unit set)")
|
|
1857
1862
|
.action(wrap(async (d) => {
|
|
1858
|
-
const [{ runSelfCheck }, { readUnitHolds }] = await Promise.all([
|
|
1863
|
+
const [{ runSelfCheck, SELF_CHECK_RESULT_FILE }, { readUnitHolds }, { daemonStateFileEnabled }] = await Promise.all([
|
|
1859
1864
|
import("../lib/daemon/selfcheck.js"),
|
|
1860
1865
|
import("../lib/daemon/unit-holds.js"),
|
|
1866
|
+
import("../lib/daemon/state-file-switch.js"),
|
|
1861
1867
|
]);
|
|
1862
1868
|
const { paths } = currentHost(d);
|
|
1863
1869
|
await runSelfCheck({
|
|
1864
1870
|
statePath: paths.statePath,
|
|
1865
1871
|
holdsPath: paths.holdsPath,
|
|
1866
1872
|
recordPath: path.join(paths.root, "selfcheck.json"),
|
|
1873
|
+
// The result file feeds only the daemon state file; with that switched off it is not written.
|
|
1874
|
+
...(daemonStateFileEnabled() ? { resultPath: path.join(paths.root, SELF_CHECK_RESULT_FILE) } : {}),
|
|
1867
1875
|
now: Date.now,
|
|
1868
1876
|
machine: os.hostname(),
|
|
1869
1877
|
readState: () => {
|
package/dist/commands/dm.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ensureCognitoToken } from "../utils/cognito-session.js";
|
|
|
5
5
|
import { resolveCallerPersonUid, resolveDestinationCompanyUid, vaultApiFetch } from "../utils/vault-api.js";
|
|
6
6
|
import { isMachineIdentity } from "@indigoai-us/hq-cloud";
|
|
7
7
|
import { peekIdToken } from "../utils/id-token.js";
|
|
8
|
+
import { gateApiKeyCapabilities } from "../utils/api-key-command-gate.js";
|
|
8
9
|
import { redactAgentInboxItem as redactInboxCredentials } from "../lib/agent-kit/inbox-redact.js";
|
|
9
10
|
import { classifyAgentInboxBody } from "../lib/agent-kit/inbox-state.js";
|
|
10
11
|
import { EMAIL_PATTERN, RECIPIENT_UID_PATTERN, PERSON_AGENT_AUDIENCE_MESSAGE, PERSON_CANNOT_SEND_AGENT_CODE, callerMayUseAudience, defaultAudienceFor, recipientKindOf, } from "../lib/notify-recipient.js";
|
|
@@ -1939,6 +1940,12 @@ export function registerDmCommand(program) {
|
|
|
1939
1940
|
const dm = program
|
|
1940
1941
|
.command("dm")
|
|
1941
1942
|
.description("Send and read direct messages, and manage connection requests. Messages sent from a person login are always tagged for people. When an agent or bot sends, messages to an agent, a channel or a group are tagged for agents and folded away from people by default. Pass --for-human or --audience human to tag a message for people; --audience agent|both is for agents and bots only.");
|
|
1943
|
+
// Every `hq dm` subcommand calls `ensureCognitoToken()` against the notify
|
|
1944
|
+
// surface (`/v1/notify/*`), and hq-pro serves no `/v1/keys/notify` route. With
|
|
1945
|
+
// only an API key set there is no cached person session, so without this gate
|
|
1946
|
+
// the command falls through to the browser sign-in and hangs. Fail fast with
|
|
1947
|
+
// the capability/Cognito message instead (feedback_68bcc870).
|
|
1948
|
+
gateApiKeyCapabilities(dm, { default: null });
|
|
1942
1949
|
dm
|
|
1943
1950
|
.command("send [recipient] [message]", { isDefault: true, hidden: true })
|
|
1944
1951
|
.description('Send a direct message. RECIPIENT can be a person (email, personUid, or agentUid), a GROUP DM (comma-separated: "a@x.com,b@y.com"), or one of your DM CHANNELS by name — bare (hq dm vyg-dev "hi"), hash form (hq dm "#vyg-dev" "hi"), or via --channel (hq dm --channel vyg-dev "hi"). A person receives a DM as an HQ Sync notification; an agent receives it in its durable box inbox. If you aren\'t connected yet, it sends a connection request that holds your message. See your channels with `hq channels`.\n\nCHANNEL MENTIONS: HQ mentions are structured — the server never reads `@name` out of your text, so a channel message has to carry the participants alongside the body. When you write `@name` in a channel message, this command looks the name up in the channel roster (case-insensitive on display name and slug/handle; quote multi-word names as @"Jacob Posel") and sends it as a real mention, which notifies people and wakes agents. If a name is unknown or matches more than one member, the send FAILS with the candidates instead of posting something that mentions nobody. A bare "@" or an email address in your prose is never treated as a mention. Pass --no-mentions to post the text literally.\n\nCHANNEL THREADS: `hq dm <channel> --thread <eventId> "…"` replies under an existing root (the request carries rootEventId). `--thread last` replies to your most recent top-level message in that channel. Copy a root eventId from `hq dm channel <name>`, which prints each root\'s id and indents replies underneath.')
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq doctor usage` — counts per command for the last 30 days, read from the
|
|
3
|
+
* local usage file (utils/command-usage.ts). It reads one small folder under
|
|
4
|
+
* `~/.hq` and sends nothing.
|
|
5
|
+
*/
|
|
6
|
+
import type { Command } from "commander";
|
|
7
|
+
export declare function registerDoctorUsageCommand(doctor: Command): void;
|
|
8
|
+
//# sourceMappingURL=doctor-usage.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq doctor usage` — counts per command for the last 30 days, read from the
|
|
3
|
+
* local usage file (utils/command-usage.ts). It reads one small folder under
|
|
4
|
+
* `~/.hq` and sends nothing.
|
|
5
|
+
*/
|
|
6
|
+
import { COMMAND_USAGE_WINDOW_DAYS, readCommandUsage, renderCommandUsageText, } from "../utils/command-usage.js";
|
|
7
|
+
export function registerDoctorUsageCommand(doctor) {
|
|
8
|
+
doctor
|
|
9
|
+
.command("usage")
|
|
10
|
+
.description(`Show how many times each command ran on this computer in the last ${COMMAND_USAGE_WINDOW_DAYS} days (a local file that is never sent).`)
|
|
11
|
+
.option("--json", "Emit the counts as JSON.")
|
|
12
|
+
.action((opts, command) => {
|
|
13
|
+
// `hq doctor` declares --json too, and Commander stores the flag on
|
|
14
|
+
// whichever of the two commands it reaches first. Read the merged set.
|
|
15
|
+
const json = opts.json === true || command.optsWithGlobals().json === true;
|
|
16
|
+
const report = readCommandUsage();
|
|
17
|
+
process.stdout.write(json ? `${JSON.stringify(report, null, 2)}\n` : renderCommandUsageText(report));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=doctor-usage.js.map
|
package/dist/commands/doctor.js
CHANGED
|
@@ -37,7 +37,9 @@ import { clientHealthCompanyScopeFromCheckId } from "../lib/doctor/checks/sync-h
|
|
|
37
37
|
import { readCompaniesManifestMap } from "../lib/work-context/repo-remote.js";
|
|
38
38
|
import * as readline from "node:readline";
|
|
39
39
|
import { runSideEffectTests } from "../lib/doctor/deep/sandbox.js";
|
|
40
|
+
import { addHostCoreFamily } from "../lib/doctor/checks/host-core.js";
|
|
40
41
|
import { sweepTempHomes, } from "../lib/doctor/temp-home-sweeper.js";
|
|
42
|
+
import { registerDoctorUsageCommand } from "./doctor-usage.js";
|
|
41
43
|
/**
|
|
42
44
|
* Marker directories that identify an HQ tree root. A directory is an HQ root
|
|
43
45
|
* only when it contains ALL of these. `.claude` + `core` are present in both
|
|
@@ -134,6 +136,8 @@ export async function runDoctor(options = {}) {
|
|
|
134
136
|
integrations: options.integrations !== false,
|
|
135
137
|
};
|
|
136
138
|
const families = await registry.run(context);
|
|
139
|
+
if (!requested)
|
|
140
|
+
await addHostCoreFamily(families, registry, context);
|
|
137
141
|
// `--deep-test` (US-008): after the read-only tiers, actually fire pure-guard
|
|
138
142
|
// fixtures through the real gate in a sandbox and append the verdicts as their
|
|
139
143
|
// own family. Run only when asked — appending here, not in the default
|
|
@@ -343,7 +347,7 @@ export function renderTempHomeSweepText(result) {
|
|
|
343
347
|
}
|
|
344
348
|
/** Register the top-level `hq doctor` command so it appears in `hq --help`. */
|
|
345
349
|
export function registerDoctorCommand(program, deps = {}) {
|
|
346
|
-
program
|
|
350
|
+
const doctor = program
|
|
347
351
|
.command("doctor")
|
|
348
352
|
.description("Verify HQ hook wiring, runtimes, and connection health (read-only; integrations uses one control-plane inventory read).")
|
|
349
353
|
.option("--json", "Emit the machine-readable JSON document (no colour).")
|
|
@@ -491,6 +495,8 @@ export function registerDoctorCommand(program, deps = {}) {
|
|
|
491
495
|
// out-of-tree run or a FAIL/UNKNOWN result.
|
|
492
496
|
process.exitCode = result.exitCode;
|
|
493
497
|
});
|
|
498
|
+
// `hq doctor usage`: the local command count (commands/doctor-usage.ts).
|
|
499
|
+
registerDoctorUsageCommand(doctor);
|
|
494
500
|
}
|
|
495
501
|
/**
|
|
496
502
|
* Split `--only` into family ids. Blank entries are dropped so a trailing comma
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq env`: environment profiles (hq-environment-profile.v1).
|
|
3
|
+
*
|
|
4
|
+
* This release has one subcommand, `hq env validate <file>`. It reads one
|
|
5
|
+
* file and checks it against the schema. The command itself writes nothing,
|
|
6
|
+
* calls no service and needs no sign-in; the CLI's usual start-up state files
|
|
7
|
+
* are still written, as for every hq command.
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from "commander";
|
|
10
|
+
/** A profile is a few kilobytes; nothing larger than this is read. */
|
|
11
|
+
export declare const ENV_VALIDATE_MAX_BYTES: number;
|
|
12
|
+
export interface EnvCommandDeps {
|
|
13
|
+
print: (line: string) => void;
|
|
14
|
+
printError: (line: string) => void;
|
|
15
|
+
setExitCode: (code: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function registerEnvCommand(program: Command, overrides?: Partial<EnvCommandDeps>): Command;
|
|
18
|
+
//# sourceMappingURL=env.d.ts.map
|