@indigoai-us/hq-cli 5.345.225 → 5.345.226
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 +32 -0
- package/dist/command-catalog.generated.d.ts +78 -0
- package/dist/command-catalog.generated.js +97 -0
- package/dist/commands/daemon.js +1 -1
- package/dist/commands/deploy-domains.js +38 -2
- package/dist/commands/lanes-accounts.d.ts +14 -0
- package/dist/commands/lanes-accounts.js +119 -0
- package/dist/commands/lanes-move.js +10 -0
- package/dist/commands/lanes-shared.js +9 -0
- package/dist/commands/lanes.js +137 -12
- package/dist/commands/sync-held.d.ts +22 -0
- package/dist/commands/sync-held.js +167 -18
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +4845 -2524
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/capacity/accounts.d.ts +4 -0
- package/dist/lib/capacity/accounts.js +4 -0
- package/dist/lib/capacity/route.js +14 -0
- package/dist/lib/capacity/sign-in.d.ts +18 -0
- package/dist/lib/capacity/sign-in.js +34 -1
- package/dist/lib/daemon/catalog.d.ts +1 -0
- package/dist/lib/daemon/catalog.js +1 -1
- package/dist/lib/daemon/hook-requests.d.ts +76 -0
- package/dist/lib/daemon/hook-requests.js +481 -0
- package/dist/lib/daemon/lanes-reconcile-status.d.ts +35 -0
- package/dist/lib/daemon/lanes-reconcile-status.js +86 -0
- package/dist/lib/daemon/ops/policy.d.ts +1 -1
- package/dist/lib/daemon/ops/policy.js +43 -4
- package/dist/lib/daemon/run.js +37 -4
- package/dist/lib/daemon/server.js +6 -1
- package/dist/lib/daemon/supervisor.d.ts +2 -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/account-company.d.ts +7 -1
- package/dist/lib/lanes/account-company.js +22 -4
- package/dist/lib/lanes/account-ownership.d.ts +65 -0
- package/dist/lib/lanes/account-ownership.js +134 -0
- package/dist/lib/lanes/accounts.js +9 -2
- package/dist/lib/lanes/claude-balance.js +9 -3
- package/dist/lib/lanes/config.js +17 -0
- package/dist/lib/lanes/host-capacity.d.ts +19 -0
- package/dist/lib/lanes/host-capacity.js +37 -0
- package/dist/lib/lanes/reconcile.js +44 -3
- package/dist/lib/lanes/spawn.d.ts +0 -10
- package/dist/lib/lanes/spawn.js +51 -1
- package/dist/lib/lanes/types.d.ts +12 -0
- package/package.json +8 -8
package/dist/lib/lanes/spawn.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* mutable fields are re-read from the lane record (spec §5.4).
|
|
9
9
|
*/
|
|
10
10
|
import { accountMatchesCompany, accountMayRetainLane, companyMismatchError } from "./account-company.js";
|
|
11
|
+
import { accountHeldByOther } from "./account-ownership.js";
|
|
11
12
|
import { spawn, spawnSync } from "node:child_process";
|
|
12
13
|
import { randomUUID } from "node:crypto";
|
|
13
14
|
import * as fs from "node:fs";
|
|
@@ -282,7 +283,13 @@ function selectSpawnAccount(input) {
|
|
|
282
283
|
let refusal;
|
|
283
284
|
const operatorMovePending = lane.pending_resume !== undefined &&
|
|
284
285
|
lane.account_history?.at(-1)?.reason === "operator_move";
|
|
285
|
-
if (current !== undefined &&
|
|
286
|
+
if (current !== undefined && accountHeldByOther(current)) {
|
|
287
|
+
reason = "account_unavailable";
|
|
288
|
+
refusal = new LanesError("account_held_by_other", "The lane's recorded login is held by another person and is not used for lanes", {
|
|
289
|
+
provider: lane.provider, account: lane.account,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
else if (current !== undefined && !accountMayRetainLane(current, resolveLaneCompany(hqRoot, lane).company, config.providers[lane.provider].accounts)) {
|
|
286
293
|
reason = "account_unavailable";
|
|
287
294
|
refusal = new LanesError("account_company_mismatch", `Account ${lane.account} belongs to another company`, {
|
|
288
295
|
provider: lane.provider, account: lane.account,
|
|
@@ -2565,6 +2572,30 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2565
2572
|
}
|
|
2566
2573
|
throw err;
|
|
2567
2574
|
}
|
|
2575
|
+
if (err instanceof LanesError && err.error === "account_held_by_other") {
|
|
2576
|
+
// PS-006: the lane's login is held by another person and no other login
|
|
2577
|
+
// can take it. Record why it waits, once, instead of leaving it queued
|
|
2578
|
+
// with no reason and logging a bind failure on every tick.
|
|
2579
|
+
let recorded = false;
|
|
2580
|
+
retryUpdateLane(hqRoot, lane.lane_id, "spawn", (current) => {
|
|
2581
|
+
if (current.state !== "queued")
|
|
2582
|
+
return current;
|
|
2583
|
+
if (current.queued_reason === "admit_failed" && current.queued_details?.reason === "admit_failed" &&
|
|
2584
|
+
current.queued_details.error === err.error)
|
|
2585
|
+
return current;
|
|
2586
|
+
recorded = true;
|
|
2587
|
+
return {
|
|
2588
|
+
...current,
|
|
2589
|
+
queued_reason: "admit_failed",
|
|
2590
|
+
queued_details: { reason: "admit_failed", error: err.error, message: err.message },
|
|
2591
|
+
admission_reserved_at: undefined,
|
|
2592
|
+
};
|
|
2593
|
+
});
|
|
2594
|
+
if (recorded) {
|
|
2595
|
+
process.stderr.write(`hq lanes: lane ${lane.lane_id} waits: ${err.message}\n`);
|
|
2596
|
+
}
|
|
2597
|
+
throw err;
|
|
2598
|
+
}
|
|
2568
2599
|
process.stderr.write(`hq lanes: account bind failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2569
2600
|
throw err;
|
|
2570
2601
|
}
|
|
@@ -3289,6 +3320,20 @@ export function envelopeRepairMode(provider) {
|
|
|
3289
3320
|
* follows the new process. The account is the one already bound on the record.
|
|
3290
3321
|
* Fast-mode evidence is updated after the replacement is proven detached.
|
|
3291
3322
|
*/
|
|
3323
|
+
function assertRepairAccountUsable(hqRoot, lane, config) {
|
|
3324
|
+
if (lane.account === undefined)
|
|
3325
|
+
return;
|
|
3326
|
+
const accounts = config.providers[lane.provider].accounts;
|
|
3327
|
+
const account = accounts[lane.account];
|
|
3328
|
+
if (accountHeldByOther(account)) {
|
|
3329
|
+
throw new LanesError("account_held_by_other", `Envelope repair refused: login ${lane.account} is held by ${account?.holder ?? "another person"}, not the owner, and is not used for lanes`, { provider: lane.provider, account: lane.account, holder: account?.holder ?? null });
|
|
3330
|
+
}
|
|
3331
|
+
if (account !== undefined && !accountMayRetainLane(account, resolveLaneCompany(hqRoot, lane).company, accounts)) {
|
|
3332
|
+
throw new LanesError("account_company_mismatch", `Envelope repair refused: account ${lane.account} belongs to another company`, {
|
|
3333
|
+
provider: lane.provider, account: lane.account,
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3292
3337
|
export function spawnEnvelopeRepair(hqRoot, lane, input, deps = {}) {
|
|
3293
3338
|
const env = deps.env ?? process.env;
|
|
3294
3339
|
const hostname = accountHomeHostname(deps);
|
|
@@ -3305,6 +3350,11 @@ export function spawnEnvelopeRepair(hqRoot, lane, input, deps = {}) {
|
|
|
3305
3350
|
const logsDir = path.join(runDir, "logs");
|
|
3306
3351
|
ensureDir(logsDir);
|
|
3307
3352
|
const config = loadLanesConfig(hqRoot);
|
|
3353
|
+
// PS-006: the repair turn runs in the lane's recorded login, so it gets the
|
|
3354
|
+
// same ownership checks as any spawn. It cannot move the session to another
|
|
3355
|
+
// login (the transcript lives in that home), so it refuses; the failed turn
|
|
3356
|
+
// then ends normally and the next spawn or resume moves the lane off.
|
|
3357
|
+
assertRepairAccountUsable(hqRoot, lane, config);
|
|
3308
3358
|
const profile = lane.worker_profile
|
|
3309
3359
|
? loadWorkerProfileWithRegistry(hqRoot, lane.worker_profile, {
|
|
3310
3360
|
laneCompany: lane.company?.slug ?? lane.mesh_company?.slug,
|
|
@@ -1210,6 +1210,18 @@ export interface LaneEnvelope {
|
|
|
1210
1210
|
export interface AccountConfig {
|
|
1211
1211
|
/** Company slug or UID owning this account. Untagged accounts are personal. */
|
|
1212
1212
|
company?: string;
|
|
1213
|
+
/**
|
|
1214
|
+
* The business that owns this login: a company slug, `personal` or
|
|
1215
|
+
* `unknown`. Recorded for reporting and ranking only (PS-006, D5); it never
|
|
1216
|
+
* restricts which lanes may use the login. `company` above is the filter.
|
|
1217
|
+
*/
|
|
1218
|
+
owning_company?: string;
|
|
1219
|
+
/**
|
|
1220
|
+
* Who holds this login: `owner` (the person this HQ belongs to) or another
|
|
1221
|
+
* named person. Logins held by another person are never picked for lanes and
|
|
1222
|
+
* are listed without their account id in `hq runners capacity`.
|
|
1223
|
+
*/
|
|
1224
|
+
holder?: string;
|
|
1213
1225
|
home: string;
|
|
1214
1226
|
/** Optional account home overrides keyed by the owning host's hostname. */
|
|
1215
1227
|
hosts?: Record<string, AccountHostHome>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.345.
|
|
3
|
+
"version": "5.345.226",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@aws-sdk/client-iot-data-plane": "^3.1096.0",
|
|
63
63
|
"@aws-sdk/client-s3": "^3.1049.0",
|
|
64
64
|
"@aws-sdk/dsql-signer": "^3.1146.0",
|
|
65
|
-
"@indigoai-us/hq-cloud": "6.18.
|
|
65
|
+
"@indigoai-us/hq-cloud": "6.18.110",
|
|
66
66
|
"@indigoai-us/hq-flags-client": "^0.2.0",
|
|
67
67
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
68
68
|
"@sentry/node": "^10.49.0",
|
|
@@ -124,11 +124,11 @@
|
|
|
124
124
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
125
125
|
},
|
|
126
126
|
"optionalDependencies": {
|
|
127
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
128
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
129
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
130
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
131
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
132
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
127
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.226",
|
|
128
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.226",
|
|
129
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.226",
|
|
130
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.226",
|
|
131
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.226",
|
|
132
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.226"
|
|
133
133
|
}
|
|
134
134
|
}
|