@indigoai-us/hq-cli 5.345.175 → 5.345.177
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 +25 -0
- package/dist/command-catalog.generated.d.ts +65 -0
- package/dist/command-catalog.generated.js +80 -0
- package/dist/commands/bot.d.ts +28 -2
- package/dist/commands/bot.js +29 -6
- package/dist/commands/daemon.js +16 -0
- package/dist/commands/lanes-loop.d.ts +4 -1
- package/dist/commands/lanes-loop.js +23 -4
- package/dist/commands/lanes-shared.d.ts +5 -0
- package/dist/commands/lanes.d.ts +5 -7
- package/dist/commands/lanes.js +65 -5
- package/dist/commands/sync-core.d.ts +17 -0
- package/dist/commands/sync-core.js +46 -5
- package/dist/commands/sync-manifest.d.ts +6 -0
- package/dist/commands/sync-manifest.js +13 -0
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +448 -226
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/bot/cli-update.d.ts +36 -0
- package/dist/lib/bot/cli-update.js +160 -42
- package/dist/lib/bot/run.d.ts +21 -0
- package/dist/lib/bot/run.js +127 -10
- package/dist/lib/bot/runtime/claude.d.ts +7 -1
- package/dist/lib/bot/runtime/claude.js +29 -0
- package/dist/lib/bot/runtime/codex.d.ts +5 -0
- package/dist/lib/bot/runtime/codex.js +13 -0
- package/dist/lib/bot/runtime/types.d.ts +10 -0
- package/dist/lib/bot/runtime-sign-in-check.d.ts +32 -0
- package/dist/lib/bot/runtime-sign-in-check.js +53 -0
- package/dist/lib/bot/runtime-sign-in.d.ts +32 -3
- package/dist/lib/bot/runtime-sign-in.js +17 -2
- package/dist/lib/bot/status.d.ts +25 -1
- package/dist/lib/bot/status.js +28 -0
- package/dist/lib/daemon/catalog.d.ts +4 -0
- package/dist/lib/daemon/catalog.js +47 -19
- package/dist/lib/daemon/run.js +1 -0
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/lanes/loop-disposition.d.ts +44 -0
- package/dist/lib/lanes/loop-disposition.js +302 -0
- package/dist/lib/lanes/loop.d.ts +16 -3
- package/dist/lib/lanes/loop.js +167 -60
- package/dist/lib/lanes/reconcile.d.ts +5 -0
- package/dist/lib/lanes/reconcile.js +79 -4
- package/dist/lib/mesh/live/daemon/work-subscribe.d.ts +3 -0
- package/dist/lib/mesh/live/daemon/work-subscribe.js +41 -12
- package/dist/lib/sync-core/engine-home.d.ts +11 -4
- package/dist/lib/sync-core/engine-home.js +22 -21
- package/dist/lib/sync-core/manifest-scopes.d.ts +15 -0
- package/dist/lib/sync-core/manifest-scopes.js +26 -0
- package/dist/lib/sync-core/reconcile.d.ts +2 -2
- package/dist/lib/sync-core/reconcile.js +70 -46
- package/dist/lib/sync-core/release.d.ts +2 -2
- package/dist/lib/sync-core/release.js +31 -6
- package/dist/lib/sync-core/rollout-state.d.ts +6 -3
- package/dist/lib/sync-core/rollout-state.js +26 -22
- package/package.json +8 -8
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import { type SyncCoreReconcileResult } from "../lib/sync-core/reconcile.js";
|
|
3
|
+
import { type EngineManifestScope } from "../lib/sync-core/manifest-scopes.js";
|
|
4
|
+
import type { RunSyncManifestOptions, RunSyncManifestOutcome, SyncManifestDeps } from "./sync-manifest.js";
|
|
3
5
|
export interface SyncCoreReconcileCommandOptions {
|
|
4
6
|
hqRoot?: string;
|
|
5
7
|
companiesOnly?: boolean;
|
|
@@ -15,6 +17,21 @@ export interface SyncCoreCommandDeps {
|
|
|
15
17
|
err: (line: string) => void;
|
|
16
18
|
}
|
|
17
19
|
export declare function runSyncCoreReconcile(opts: SyncCoreReconcileCommandOptions, d?: SyncCoreCommandDeps): Promise<SyncCoreReconcileResult>;
|
|
20
|
+
export interface SyncCoreManifestCommandOptions {
|
|
21
|
+
hqRoot?: string;
|
|
22
|
+
json?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface SyncCoreManifestDeps extends SyncCoreCommandDeps {
|
|
25
|
+
runManifest?: (options: RunSyncManifestOptions, deps: SyncManifestDeps) => Promise<RunSyncManifestOutcome>;
|
|
26
|
+
manifestDeps?: () => SyncManifestDeps;
|
|
27
|
+
}
|
|
28
|
+
export interface SyncCoreManifestResult {
|
|
29
|
+
scope: EngineManifestScope;
|
|
30
|
+
status: string;
|
|
31
|
+
mode?: string;
|
|
32
|
+
errorKind?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function runSyncCoreManifest(opts: SyncCoreManifestCommandOptions, d?: SyncCoreManifestDeps): Promise<SyncCoreManifestResult[]>;
|
|
18
35
|
export declare function runSyncCoreStatus(opts: {
|
|
19
36
|
json?: boolean;
|
|
20
37
|
}, d?: SyncCoreCommandDeps): void;
|
|
@@ -4,6 +4,7 @@ import * as path from "node:path";
|
|
|
4
4
|
import { ensureSyncCoreBinary } from "../lib/sync-core/release.js";
|
|
5
5
|
import { readCompanyRolloutFlag } from "../lib/sync-core/flag.js";
|
|
6
6
|
import { reconcileSyncCore } from "../lib/sync-core/reconcile.js";
|
|
7
|
+
import { engineOwnedManifestScopes, manifestScopeArg } from "../lib/sync-core/manifest-scopes.js";
|
|
7
8
|
import { readSyncCoreRolloutState, syncCoreRolloutStatePath } from "../lib/sync-core/rollout-state.js";
|
|
8
9
|
import { readVaultSyncSwitches } from "../lib/vault-sync-switches.js";
|
|
9
10
|
function defaultDeps() {
|
|
@@ -66,6 +67,45 @@ export async function runSyncCoreReconcile(opts, d = defaultDeps()) {
|
|
|
66
67
|
d.out("no vault on this machine is switched to the new sync engine");
|
|
67
68
|
return result;
|
|
68
69
|
}
|
|
70
|
+
export async function runSyncCoreManifest(opts, d = defaultDeps()) {
|
|
71
|
+
const hqRoot = await resolveHqRoot(opts.hqRoot, d.env);
|
|
72
|
+
const scopes = engineOwnedManifestScopes(readVaultSyncSwitches(d.home), readSyncCoreRolloutState(d.home)?.vaults);
|
|
73
|
+
if (scopes.length === 0) {
|
|
74
|
+
if (opts.json)
|
|
75
|
+
d.out("[]");
|
|
76
|
+
else
|
|
77
|
+
d.out("no vault on this machine is owned by the new sync engine; the current sync uploads its own manifests");
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const manifest = await import("./sync-manifest.js");
|
|
81
|
+
const runManifest = d.runManifest ?? manifest.runSyncManifest;
|
|
82
|
+
const manifestDeps = d.manifestDeps ?? manifest.createDefaultDeps;
|
|
83
|
+
const results = [];
|
|
84
|
+
for (const scope of scopes) {
|
|
85
|
+
const label = manifestScopeArg(scope);
|
|
86
|
+
try {
|
|
87
|
+
const outcome = await runManifest({ scopeArg: manifestScopeArg(scope), hqRoot, respectThrottle: true, json: true, engineOwned: true }, { ...manifestDeps(), log: () => { } });
|
|
88
|
+
const { status, mode, error } = outcome.result;
|
|
89
|
+
results.push({
|
|
90
|
+
scope,
|
|
91
|
+
status,
|
|
92
|
+
...(mode ? { mode } : {}),
|
|
93
|
+
...(error?.kind ? { errorKind: error.kind } : {}),
|
|
94
|
+
});
|
|
95
|
+
if (!opts.json)
|
|
96
|
+
d.out(`${label}: ${status}${mode ? ` (${mode})` : ""}${error?.kind ? ` ${error.kind}` : ""}`);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
results.push({ scope, status: "failed", errorKind: "command_error" });
|
|
100
|
+
d.err(`${label}: manifest pass failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (opts.json)
|
|
104
|
+
d.out(JSON.stringify(results, null, 2));
|
|
105
|
+
if (results.some((r) => r.status === "failed"))
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
return results;
|
|
108
|
+
}
|
|
69
109
|
export function runSyncCoreStatus(opts, d = defaultDeps()) {
|
|
70
110
|
const state = readSyncCoreRolloutState(d.home);
|
|
71
111
|
if (opts.json) {
|
|
@@ -83,15 +123,16 @@ export function runSyncCoreStatus(opts, d = defaultDeps()) {
|
|
|
83
123
|
for (const vault of state.vaults) {
|
|
84
124
|
const legacyOff = vault.kind === "personal" ? switches.personalOff : switches.offCompanies.has(vault.slug ?? "");
|
|
85
125
|
d.out(` ${vault.uid} ${vault.kind}${vault.slug ? ` ${vault.slug}` : ""} ${vault.phase === "full" ? "full" : "read-only"} legacy sync ${legacyOff ? "off" : "still on"} home ${vault.engineHome}`);
|
|
86
|
-
if (vault.
|
|
87
|
-
const
|
|
88
|
-
d.out(`
|
|
126
|
+
if (vault.firstCycle) {
|
|
127
|
+
const c = vault.firstCycle;
|
|
128
|
+
d.out(` first full cycle ${c.at}: ${c.planned} planned, ${c.completed} completed, ${c.pending} pending, ${c.held} held, ${c.notApplied} not applied`);
|
|
129
|
+
d.out(` listed work${c.truncated ? ` (first ${c.listed} items only)` : ""}: ${c.uploads} uploads, ${c.downloads} downloads, ${c.deletes} deletes, ${c.conflicts} conflict or merge copies, ${c.deferred} deferred`);
|
|
89
130
|
}
|
|
90
|
-
if (vault.hold)
|
|
91
|
-
d.out(` held read-only: ${vault.hold}`);
|
|
92
131
|
}
|
|
93
132
|
for (const skip of state.skipped ?? [])
|
|
94
133
|
d.out(` ${skip.uid} skipped on this machine: ${skip.reason}`);
|
|
134
|
+
for (const hold of state.held ?? [])
|
|
135
|
+
d.out(` ${hold.uid} held: ${hold.reason}`);
|
|
95
136
|
if (state.vaults.length === 0)
|
|
96
137
|
d.out(" no vault is switched to the new sync engine");
|
|
97
138
|
}
|
|
@@ -110,7 +110,13 @@ export interface RunSyncManifestOptions {
|
|
|
110
110
|
* `resend_full_scheduled` too, and none of those uploaded anything.
|
|
111
111
|
*/
|
|
112
112
|
json?: boolean;
|
|
113
|
+
engineOwned?: boolean;
|
|
113
114
|
}
|
|
115
|
+
export declare const SYNC_CORE_OWNS_SCOPE_LEDGER_CLASS = "SyncCoreOwnsScope";
|
|
116
|
+
export declare class SyncCoreOwnsScope extends Error {
|
|
117
|
+
constructor();
|
|
118
|
+
}
|
|
119
|
+
export declare function engineOwnedLedger(): never;
|
|
114
120
|
/** The machine-readable outcome `--json` prints. Fixed tokens only, no paths. */
|
|
115
121
|
export interface ManifestOutcomeLine {
|
|
116
122
|
status: string;
|
|
@@ -64,6 +64,16 @@ export const MANIFEST_UPLOAD_PATH = "/v1/sync-manifest/upload";
|
|
|
64
64
|
export { MANIFEST_DISABLED_ENV, manifestUploadsDisabled };
|
|
65
65
|
/** The literal `--scope` value that selects the personal (non-company) tree. */
|
|
66
66
|
export const PERSONAL_SCOPE = "personal";
|
|
67
|
+
export const SYNC_CORE_OWNS_SCOPE_LEDGER_CLASS = "SyncCoreOwnsScope";
|
|
68
|
+
export class SyncCoreOwnsScope extends Error {
|
|
69
|
+
constructor() {
|
|
70
|
+
super("the new sync engine owns this scope; the legacy journal is not its ledger");
|
|
71
|
+
this.name = SYNC_CORE_OWNS_SCOPE_LEDGER_CLASS;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function engineOwnedLedger() {
|
|
75
|
+
throw new SyncCoreOwnsScope();
|
|
76
|
+
}
|
|
67
77
|
/** Build the `--json` line for one pass. The free-text error detail is left out. */
|
|
68
78
|
export function manifestOutcomeLine(result) {
|
|
69
79
|
return {
|
|
@@ -333,6 +343,7 @@ export async function runSyncManifest(options, deps) {
|
|
|
333
343
|
dryRun: print,
|
|
334
344
|
forceFull: options.full === true,
|
|
335
345
|
ignoreThrottle: options.respectThrottle !== true,
|
|
346
|
+
...(options.engineOwned === true ? { listJournalsImpl: engineOwnedLedger } : {}),
|
|
336
347
|
});
|
|
337
348
|
if (print) {
|
|
338
349
|
deps.log(JSON.stringify(result.chunks ?? [], null, 2));
|
|
@@ -358,6 +369,7 @@ export function registerSyncManifestCommand(syncCmd) {
|
|
|
358
369
|
.option("--print", "Build and print the chunks as JSON; upload nothing")
|
|
359
370
|
.option("--json", "Print the pass outcome as one JSON line instead of a summary")
|
|
360
371
|
.option("--respect-throttle", "Honour the 24h per-scope upload throttle instead of forcing a pass (for scheduled callers)")
|
|
372
|
+
.option("--engine-owned", "The new sync engine owns this scope here: build the manifest from disk alone and mark the legacy journal as not its ledger")
|
|
361
373
|
.option("--hq-root <path>", `Local HQ tree root (default: ${DEFAULT_HQ_ROOT})`, DEFAULT_HQ_ROOT)
|
|
362
374
|
.action(async (options) => {
|
|
363
375
|
// Capability gate BEFORE anything else: on a published hq-cloud that
|
|
@@ -376,6 +388,7 @@ export function registerSyncManifestCommand(syncCmd) {
|
|
|
376
388
|
print: options.print,
|
|
377
389
|
respectThrottle: options.respectThrottle,
|
|
378
390
|
json: options.json,
|
|
391
|
+
engineOwned: options.engineOwned,
|
|
379
392
|
}, createDefaultDeps());
|
|
380
393
|
if (outcome.exitCode !== 0)
|
|
381
394
|
process.exit(outcome.exitCode);
|