@indigoai-us/hq-cli 5.345.215 → 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 +141 -0
- package/README.md +45 -0
- 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 +59 -4
- package/dist/command-catalog.generated.js +74 -4
- 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 +11 -4
- 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 +109 -26
- package/dist/commands/core.js +1 -0
- package/dist/commands/daemon.js +4 -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/install-global.js +2 -2
- package/dist/commands/lanes.js +100 -24
- package/dist/commands/logout.d.ts +7 -0
- package/dist/commands/logout.js +41 -34
- package/dist/commands/sources.d.ts +8 -2
- package/dist/commands/sources.js +65 -9
- 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 +2 -1
- 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.js +93 -6
- 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/runtime/grok-acp.d.ts +1 -0
- package/dist/lib/bot/runtime/grok-acp.js +26 -11
- package/dist/lib/bot/runtime/grok.js +1 -1
- 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/run.js +25 -20
- package/dist/lib/daemon/selfcheck.d.ts +22 -0
- package/dist/lib/daemon/selfcheck.js +40 -1
- package/dist/lib/daemon/server.d.ts +3 -1
- package/dist/lib/daemon/server.js +7 -22
- 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/timed-flag-monitors.d.ts +47 -0
- package/dist/lib/daemon/timed-flag-monitors.js +75 -0
- 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/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 +64 -1
- package/dist/lib/hot-channels/signals-pass.js +21 -49
- 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/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 +84 -4
- package/dist/main.js +46 -3
- 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/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/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/commands/cloud.js
CHANGED
|
@@ -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)
|
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
|
@@ -1860,15 +1860,18 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
1860
1860
|
.command("sync-core-selfcheck")
|
|
1861
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)")
|
|
1862
1862
|
.action(wrap(async (d) => {
|
|
1863
|
-
const [{ runSelfCheck }, { readUnitHolds }] = await Promise.all([
|
|
1863
|
+
const [{ runSelfCheck, SELF_CHECK_RESULT_FILE }, { readUnitHolds }, { daemonStateFileEnabled }] = await Promise.all([
|
|
1864
1864
|
import("../lib/daemon/selfcheck.js"),
|
|
1865
1865
|
import("../lib/daemon/unit-holds.js"),
|
|
1866
|
+
import("../lib/daemon/state-file-switch.js"),
|
|
1866
1867
|
]);
|
|
1867
1868
|
const { paths } = currentHost(d);
|
|
1868
1869
|
await runSelfCheck({
|
|
1869
1870
|
statePath: paths.statePath,
|
|
1870
1871
|
holdsPath: paths.holdsPath,
|
|
1871
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) } : {}),
|
|
1872
1875
|
now: Date.now,
|
|
1873
1876
|
machine: os.hostname(),
|
|
1874
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
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { readFileSync, statSync } from "node:fs";
|
|
10
|
+
/** A profile is a few kilobytes; nothing larger than this is read. */
|
|
11
|
+
export const ENV_VALIDATE_MAX_BYTES = 5 * 1024 * 1024;
|
|
12
|
+
export function registerEnvCommand(program, overrides = {}) {
|
|
13
|
+
const deps = {
|
|
14
|
+
print: (line) => console.log(line),
|
|
15
|
+
printError: (line) => console.error(line),
|
|
16
|
+
setExitCode: (code) => { process.exitCode = code; },
|
|
17
|
+
...overrides,
|
|
18
|
+
};
|
|
19
|
+
const env = program
|
|
20
|
+
.command("env")
|
|
21
|
+
.description("Environment profiles: the places that can do work (hq-environment-profile.v1)");
|
|
22
|
+
env
|
|
23
|
+
.command("validate")
|
|
24
|
+
.description("Check an environment profile file against hq-environment-profile.v1 (read-only; exit 1 when it is rejected; files up to 5 MB)")
|
|
25
|
+
.argument("<file>", "Path to a profile JSON file")
|
|
26
|
+
.option("--json", "Print the result as JSON")
|
|
27
|
+
.action(async (file, opts) => {
|
|
28
|
+
const { parseEnvironmentProfile } = await import("../lib/environment/profile.js");
|
|
29
|
+
const refuse = (code, message) => {
|
|
30
|
+
if (opts.json)
|
|
31
|
+
deps.print(JSON.stringify({ ok: false, code, message, issues: [], issues_omitted: 0 }, null, 2));
|
|
32
|
+
else
|
|
33
|
+
deps.printError(message);
|
|
34
|
+
deps.setExitCode(1);
|
|
35
|
+
};
|
|
36
|
+
let text;
|
|
37
|
+
try {
|
|
38
|
+
const { size } = statSync(file);
|
|
39
|
+
if (size > ENV_VALIDATE_MAX_BYTES) {
|
|
40
|
+
refuse("too_large", `${file} is too large: ${size} bytes; hq env validate reads files up to ${ENV_VALIDATE_MAX_BYTES} bytes`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
text = readFileSync(file, "utf8");
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const code = error.code ?? "error";
|
|
47
|
+
refuse("unreadable", `cannot read ${file} (${code})`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const result = parseEnvironmentProfile(text);
|
|
51
|
+
if (result.ok) {
|
|
52
|
+
const { declared, view } = result.profile;
|
|
53
|
+
if (opts.json) {
|
|
54
|
+
deps.print(JSON.stringify({
|
|
55
|
+
ok: true,
|
|
56
|
+
schema_version: result.profile.schema_version,
|
|
57
|
+
id: declared.id,
|
|
58
|
+
kind: declared.kind,
|
|
59
|
+
state: declared.state,
|
|
60
|
+
company: view.company,
|
|
61
|
+
}, null, 2));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
deps.print(`valid ${result.profile.schema_version} ${declared.id} (${declared.kind}, ${declared.state}, company ${view.company})`);
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (opts.json) {
|
|
69
|
+
deps.print(JSON.stringify(result, null, 2));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
deps.printError(`${file}: ${result.message}`);
|
|
73
|
+
for (const issue of result.issues)
|
|
74
|
+
deps.printError(` ${issue.path || "/"}: ${issue.message}`);
|
|
75
|
+
if (result.issues_omitted > 0)
|
|
76
|
+
deps.printError(` and ${result.issues_omitted} more`);
|
|
77
|
+
}
|
|
78
|
+
deps.setExitCode(1);
|
|
79
|
+
});
|
|
80
|
+
return env;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -605,7 +605,7 @@ export function installGlobalClaude(opts) {
|
|
|
605
605
|
if (pluginSource)
|
|
606
606
|
log(` plugin: ${pluginSource.pluginId} installed from ${pluginSource.sourceDir}; direct hooks and MCP entries removed`);
|
|
607
607
|
else {
|
|
608
|
-
log(` hooks: ${typeof hookTarget === 'object' ? hookTarget.engine : hookTarget === 'shim' ? 'hqd-hook-shim.sh' : 'master-hook.sh'} registered in ${t.settingsJson}`);
|
|
608
|
+
log(` hooks: ${typeof hookTarget === 'object' ? ('coreNext' in hookTarget ? hookTarget.coreNext : hookTarget.engine) : hookTarget === 'shim' ? 'hqd-hook-shim.sh' : 'master-hook.sh'} registered in ${t.settingsJson}`);
|
|
609
609
|
log(` MCP: "${HQ_MCP_SERVER_NAME}" registered in ${t.claudeJson}`);
|
|
610
610
|
}
|
|
611
611
|
log(` registry: ${seeded.length} manifest entr${seeded.length === 1 ? 'y' : 'ies'} seeded`);
|
|
@@ -984,7 +984,7 @@ export function installGlobalCodex(opts) {
|
|
|
984
984
|
log(` skills linked: ${skills.link.length} new, ${skills.already.length} already present, ${skills.skipped.length} skipped`);
|
|
985
985
|
reportSkillCopies(linkKinds, log);
|
|
986
986
|
reportSkippedSkills(skills, log, false);
|
|
987
|
-
log(` hooks: ${typeof hookTarget === 'object' ? hookTarget.engine : hookTarget === 'shim' ? shimPath(hqRoot) : codexAdapterPath(hqRoot)} registered in ${t.hooksJson}`);
|
|
987
|
+
log(` hooks: ${typeof hookTarget === 'object' ? ('coreNext' in hookTarget ? hookTarget.coreNext : hookTarget.engine) : hookTarget === 'shim' ? shimPath(hqRoot) : codexAdapterPath(hqRoot)} registered in ${t.hooksJson}`);
|
|
988
988
|
log(` MCP: "${HQ_MCP_SERVER_NAME}" registered in ${t.configToml}`);
|
|
989
989
|
return touched;
|
|
990
990
|
}
|