@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { accountHeldByOther } from "../lib/lanes/account-ownership.js";
|
|
1
2
|
import * as path from "node:path";
|
|
2
3
|
import { chooseHostForLane } from "../lib/lanes/host-capacity.js";
|
|
3
4
|
import { laneRunsHere, loadLanesConfig, loadWorkerProfile, readLane, updateLane, withLaneAdmissionLock, } from "../lib/lanes/index.js";
|
|
@@ -167,6 +168,15 @@ export function createLaneMoveHandlers(deps) {
|
|
|
167
168
|
assertKnownOutpost(target.id, known);
|
|
168
169
|
}
|
|
169
170
|
const accountConfig = loadLanesConfig(hqRoot).providers[before.provider].accounts[account];
|
|
171
|
+
if (accountHeldByOther(accountConfig)) {
|
|
172
|
+
const holder = accountConfig?.holder ?? null;
|
|
173
|
+
throw new LanesError("account_held_by_other", `Account ${account} is held by ${holder}, not the owner, and is not used for lanes`, {
|
|
174
|
+
lane_id: laneId,
|
|
175
|
+
provider: before.provider,
|
|
176
|
+
account,
|
|
177
|
+
holder,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
170
180
|
if (accountConfig === undefined || !accountConfig.enabled) {
|
|
171
181
|
throw new LanesError("lane_move_account_invalid", `Account ${account} is unavailable for ${before.provider}`, {
|
|
172
182
|
lane_id: laneId,
|
|
@@ -3,6 +3,7 @@ import { readLanesRegistryFlag } from "../lib/lanes/registry-flag.js";
|
|
|
3
3
|
import { LANE_OUTPOST_LOAD_BALANCING_FLAG } from "../lib/lanes/flag-keys.js";
|
|
4
4
|
import { resolveLaneEffort } from "../lib/lanes/effort.js";
|
|
5
5
|
import { LanesError } from "../lib/lanes/errors.js";
|
|
6
|
+
import { accountHeldByOther } from "../lib/lanes/account-ownership.js";
|
|
6
7
|
import { AccountResolutionError, accountStatus, loadLanesConfig } from "../lib/lanes/index.js";
|
|
7
8
|
import { resolveLaneModel } from "../lib/lanes/spawn.js";
|
|
8
9
|
import { sessionIdFromEnv } from "../lib/mesh/live/session-identity.js";
|
|
@@ -25,6 +26,14 @@ export function assertCurrentResumeAccountAvailable(ctx, lane) {
|
|
|
25
26
|
? `Lane ${lane.lane_id} records account ${JSON.stringify(lane.account)} which is not configured for ${lane.provider}`
|
|
26
27
|
: `Account ${JSON.stringify(lane.account)} is disabled${account.disabled_reason ? `: ${account.disabled_reason}` : ""}`, { provider: lane.provider, account: lane.account ?? "", ...(account?.disabled_reason !== undefined ? { reason: account.disabled_reason } : {}) });
|
|
27
28
|
}
|
|
29
|
+
// PS-006: keeping a lane on a login held by another person is refused
|
|
30
|
+
// before anything probes that login's home.
|
|
31
|
+
if (accountHeldByOther(account)) {
|
|
32
|
+
const holder = account.holder ?? null;
|
|
33
|
+
throw new LanesError("account_held_by_other", `Account ${lane.account} is held by ${holder}, not the owner, and is not used for lanes`, {
|
|
34
|
+
provider: lane.provider, account: lane.account ?? "", holder,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
28
37
|
const status = accountStatus(lane.provider, lane.account, config, {
|
|
29
38
|
existsSync: ctx.existsSync,
|
|
30
39
|
hostname: ctx.hostname(),
|
package/dist/commands/lanes.js
CHANGED
|
@@ -85,6 +85,7 @@ import { sessionIdFromEnv } from "../lib/mesh/live/session-identity.js";
|
|
|
85
85
|
import { applyLoopDisposition, loopDispositionSnapshot } from "../lib/lanes/loop-disposition.js";
|
|
86
86
|
import { listLaneReviews } from "../lib/lanes/reviews.js";
|
|
87
87
|
import { effectiveAccountHome } from "../lib/lanes/account-home.js";
|
|
88
|
+
import { accountHeldByOther } from "../lib/lanes/account-ownership.js";
|
|
88
89
|
import { remoteControlSelectionConfig, remoteControlSessionHome } from "../lib/lanes/remote-control-lane.js";
|
|
89
90
|
import { AccountResolutionError, compareLaneQueueOrder, LANE_PROVIDERS, LANE_STATES, QUESTION_STATUSES, SENIOR_KINDS, accountStatus, appendCappedHistory, canonicalizeHome, createLane, mintLaneId, decideAdmission, defaultLivenessDeps, defaultSystemdUserDir, defaultThrottleDeps, installReconcileTimer, providerPathEnv, probeDrainHookRegistration, isLanesError, isLaneVersionConflict, isTerminalLaneState, isFinishedResumableHireChild, childrenHoldingHireGrantCarve, laneHoldsHireGrantCarve, assignedChildHireGrants, hireGrantCapacityError, planHireGrantBackfill, terminalChildResumeHireGrantError, withHireGrantAdmission, laneStoryLedgerEnabled, syncLaneToProjectStoryLedger, removeLaneFromProjectStoryLedger, validateProjectStories, buildLaneStatusSnapshot, formatLaneStatusHuman, expandLocalLaneIdPrefix, listLaneIds, listQuestionIds, loadLanesConfig, laneRunsHere, MAX_LANE_DEPTH, MONITOR_ERROR_EXIT_CODE, readLiveMonitorEvidence, resolveMachineIdentity as lookupMachineIdentity, loadLivenessIndex, parseLaneProvider, isLaneProvider, parseLaneRecord, parseLaneState, parseQuestionRecord, parseSeniorKind, readAllLanes, readLane, sanitizeHostComponent, retryUpdateLane, syncLaneRecordFromOwner, readQuestion, resolveAccount, resolveLaneWorker, ignoredWorkerProfileFields, loadWorkerProfile, loadWorkerProfileWithRegistry, registryWorkerRecord, runReconcilePass, DEAD_HOST_MS, sessionLiveness, tryReadLane, uninstallReconcileTimer, updateLane, updateQuestion, dropboxDir, laneDeliveryMechanism, hasActiveAdmissionReservation, hasActivePendingResume, hasRecordedSessionId, hasEarlierEligibleQueuedLane, laneAdmissionCapReason, providerSupportsSessionResume, providerSessionPortable, isFailedQuotaKeepAliveLane, sessionNotPortableMessage, withLaneAdmissionLock, withAllLaneAdmissionLocks, readWorkerRunResult, resumeCommandRefusal, withLaneHireLocks, raiseLaneQuestion, sha256Text, } from "../lib/lanes/index.js";
|
|
90
91
|
import { admitQueuedNow } from "../lib/lanes/reconcile.js";
|
|
@@ -3559,14 +3560,58 @@ function markPickupFailure(hqRoot, laneId, reasonRaw, details) {
|
|
|
3559
3560
|
export function applyOutpostAccountPickup(hqRoot, laneId, modelDeps = {}) {
|
|
3560
3561
|
const lane = readLane(hqRoot, laneId);
|
|
3561
3562
|
const config = loadLanesConfig(hqRoot);
|
|
3563
|
+
// PS-006: a recorded login held by another person is never resolved or
|
|
3564
|
+
// probed here. When balancing or the router chose it (account_source
|
|
3565
|
+
// "balanced" or "auto"), pick again among the usable logins; the balanced
|
|
3566
|
+
// pick never returns a held login. When it was pinned (--account, a worker
|
|
3567
|
+
// profile, or a record from before account_source), fail the pickup. The
|
|
3568
|
+
// pickup terminal reasons are a fixed schema list, so that reuses
|
|
3569
|
+
// account_disabled and names the cause in the details.
|
|
3570
|
+
const recordedConfig = lane.account === undefined ? undefined : config.providers[lane.provider].accounts[lane.account];
|
|
3571
|
+
const recordedHeld = lane.account !== undefined && accountHeldByOther(recordedConfig);
|
|
3572
|
+
const recordedPinned = lane.account_source !== "balanced" && lane.account_source !== "auto";
|
|
3573
|
+
if (recordedHeld && recordedPinned) {
|
|
3574
|
+
return markPickupFailure(hqRoot, laneId, "account_disabled", {
|
|
3575
|
+
error: "account_held_by_other",
|
|
3576
|
+
provider: lane.provider,
|
|
3577
|
+
account: lane.account,
|
|
3578
|
+
holder: recordedConfig?.holder ?? null,
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
// A pick at pickup (no recorded account, or a balanced login now held by
|
|
3582
|
+
// another person) stays inside the lane's company and its admission list,
|
|
3583
|
+
// the same scope a local first assignment uses. Nothing left in scope fails
|
|
3584
|
+
// the pickup instead of borrowing another company's or a personal login.
|
|
3585
|
+
const repick = lane.account === undefined || recordedHeld;
|
|
3586
|
+
let allowedAccounts;
|
|
3587
|
+
if (repick) {
|
|
3588
|
+
const providerAccounts = config.providers[lane.provider].accounts;
|
|
3589
|
+
const company = resolveLaneCompany(hqRoot, lane).company;
|
|
3590
|
+
allowedAccounts = Object.keys(providerAccounts).filter((id) => accountMatchesCompany(providerAccounts[id], company, providerAccounts) &&
|
|
3591
|
+
(lane.admission_accounts === undefined || lane.admission_accounts.includes(id)));
|
|
3592
|
+
if (!allowedAccounts.some((id) => providerAccounts[id]?.enabled === true && !accountHeldByOther(providerAccounts[id]))) {
|
|
3593
|
+
return markPickupFailure(hqRoot, laneId, "account_disabled", {
|
|
3594
|
+
error: recordedHeld ? "account_held_by_other" : "no_account_in_lane_scope",
|
|
3595
|
+
provider: lane.provider,
|
|
3596
|
+
account: lane.account ?? null,
|
|
3597
|
+
...(recordedHeld ? { holder: recordedConfig?.holder ?? null } : {}),
|
|
3598
|
+
company: company?.slug ?? null,
|
|
3599
|
+
admission_accounts: lane.admission_accounts ?? null,
|
|
3600
|
+
message: "No enabled login in the lane's company" +
|
|
3601
|
+
(lane.admission_accounts !== undefined ? " and admission accounts" : "") +
|
|
3602
|
+
" is usable by lanes on this host",
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3562
3606
|
try {
|
|
3563
|
-
const resolved = resolveAccount(lane.provider, lane.account, config, {
|
|
3607
|
+
const resolved = resolveAccount(lane.provider, repick ? undefined : lane.account, config, {
|
|
3564
3608
|
hqRoot,
|
|
3565
3609
|
hostname: os.hostname(),
|
|
3566
3610
|
accountDeps: {
|
|
3567
3611
|
probe: modelDeps.probe,
|
|
3568
3612
|
env: modelDeps.env,
|
|
3569
3613
|
},
|
|
3614
|
+
...(allowedAccounts !== undefined ? { allowedAccounts } : {}),
|
|
3570
3615
|
});
|
|
3571
3616
|
const status = accountStatus(lane.provider, resolved.id, config, {
|
|
3572
3617
|
existsSync: (p) => fs.existsSync(p),
|
|
@@ -3622,19 +3667,42 @@ export function applyOutpostAccountPickup(hqRoot, laneId, modelDeps = {}) {
|
|
|
3622
3667
|
// writer. `account` stays closed to `command`: an operator command never
|
|
3623
3668
|
// re-pins the account of a lane it does not execute. The bind also
|
|
3624
3669
|
// clears the pickup marker: from here the reconcile pass may admit it.
|
|
3625
|
-
|
|
3670
|
+
const bound = retryUpdateLane(hqRoot, laneId, "spawn", (current) => {
|
|
3626
3671
|
if (isTerminalLaneState(current.state) || current.state === "running")
|
|
3627
3672
|
return current;
|
|
3628
3673
|
if (current.account === resolved.id && current.pickup_validation_pending === undefined) {
|
|
3629
3674
|
return current;
|
|
3630
3675
|
}
|
|
3676
|
+
const leavingHeld = recordedHeld && current.account === lane.account && current.account !== resolved.id;
|
|
3631
3677
|
return {
|
|
3632
3678
|
...current,
|
|
3633
3679
|
account: resolved.id,
|
|
3634
3680
|
pickup_validation_pending: undefined,
|
|
3635
3681
|
pickup_validation_pending_since: undefined,
|
|
3682
|
+
...(leavingHeld
|
|
3683
|
+
? {
|
|
3684
|
+
account_history: appendCappedHistory(current.account_history ?? [], {
|
|
3685
|
+
from: current.account ?? null,
|
|
3686
|
+
to: resolved.id,
|
|
3687
|
+
at: new Date().toISOString(),
|
|
3688
|
+
reason: "account_unavailable",
|
|
3689
|
+
}),
|
|
3690
|
+
}
|
|
3691
|
+
: {}),
|
|
3636
3692
|
};
|
|
3637
3693
|
});
|
|
3694
|
+
// PS-006: after leaving a held login, the source and any Claude balance
|
|
3695
|
+
// selection that pointed at it describe an account the lane no longer
|
|
3696
|
+
// uses. Those fields are command-written, so this is a second write.
|
|
3697
|
+
if (recordedHeld && bound.account === resolved.id && bound.account !== lane.account &&
|
|
3698
|
+
(bound.account_source !== "balanced" || bound.account_selection !== undefined)) {
|
|
3699
|
+
return retryUpdateLane(hqRoot, laneId, "command", (current) => {
|
|
3700
|
+
if (isTerminalLaneState(current.state) || current.account !== resolved.id)
|
|
3701
|
+
return current;
|
|
3702
|
+
return { ...current, account_source: "balanced", account_selection: undefined };
|
|
3703
|
+
});
|
|
3704
|
+
}
|
|
3705
|
+
return bound;
|
|
3638
3706
|
}
|
|
3639
3707
|
catch (err) {
|
|
3640
3708
|
if (err instanceof AccountResolutionError) {
|
|
@@ -3692,6 +3760,14 @@ export async function createLaneFromSignal(input, deps = {}) {
|
|
|
3692
3760
|
}
|
|
3693
3761
|
/** Project label for lanes created with --no-story and no --project. */
|
|
3694
3762
|
export const NO_STORY_DEFAULT_PROJECT = "standing";
|
|
3763
|
+
/** PS-006: a pinned login held by another person is refused before anything touches its home. */
|
|
3764
|
+
function refuseHeldPinnedAccount(provider, account, config) {
|
|
3765
|
+
const accountConfig = config.providers[provider].accounts[account];
|
|
3766
|
+
if (!accountHeldByOther(accountConfig))
|
|
3767
|
+
return;
|
|
3768
|
+
const holder = accountConfig?.holder ?? null;
|
|
3769
|
+
throw new LanesError("account_held_by_other", `Account ${account} is held by ${holder}, not the owner, and is not used for lanes`, { provider, account, holder });
|
|
3770
|
+
}
|
|
3695
3771
|
async function runCreate(ctx, opts) {
|
|
3696
3772
|
if (opts.signal !== undefined) {
|
|
3697
3773
|
if (!opts.company?.trim())
|
|
@@ -4234,6 +4310,7 @@ async function runCreate(ctx, opts) {
|
|
|
4234
4310
|
if (!requested) {
|
|
4235
4311
|
throw new AccountResolutionError("unknown_account", `Unknown account ${JSON.stringify(opts.account)} for ${provider}`, { provider, account: opts.account, enabled: [] });
|
|
4236
4312
|
}
|
|
4313
|
+
refuseHeldPinnedAccount(provider, requested, config);
|
|
4237
4314
|
const resolved = resolveAccount(provider, requested, config, {
|
|
4238
4315
|
hqRoot,
|
|
4239
4316
|
hostname: ctx.hostname(),
|
|
@@ -4243,6 +4320,7 @@ async function runCreate(ctx, opts) {
|
|
|
4243
4320
|
pinnedAccount = resolved.id;
|
|
4244
4321
|
}
|
|
4245
4322
|
else if (profileAccount !== undefined && profileAccounts === undefined) {
|
|
4323
|
+
refuseHeldPinnedAccount(provider, profileAccount, config);
|
|
4246
4324
|
const resolved = resolveAccount(provider, profileAccount, config, {
|
|
4247
4325
|
hqRoot,
|
|
4248
4326
|
hostname: ctx.hostname(),
|
|
@@ -4251,6 +4329,10 @@ async function runCreate(ctx, opts) {
|
|
|
4251
4329
|
});
|
|
4252
4330
|
pinnedAccount = resolved.id;
|
|
4253
4331
|
}
|
|
4332
|
+
// PS-006: refuse a pinned login held by another person before any model
|
|
4333
|
+
// check reads its home.
|
|
4334
|
+
if (pinnedAccount !== undefined)
|
|
4335
|
+
refuseHeldPinnedAccount(provider, pinnedAccount, config);
|
|
4254
4336
|
if (outpostId !== undefined &&
|
|
4255
4337
|
profile !== undefined &&
|
|
4256
4338
|
!(await placementEnabled())) {
|
|
@@ -4316,6 +4398,9 @@ async function runCreate(ctx, opts) {
|
|
|
4316
4398
|
...Object.keys(accounts)
|
|
4317
4399
|
.filter((id) => id !== candidate &&
|
|
4318
4400
|
accounts[id]?.enabled &&
|
|
4401
|
+
// PS-006: never probe, list models or read the catalog in
|
|
4402
|
+
// another person's login home.
|
|
4403
|
+
!accountHeldByOther(accounts[id]) &&
|
|
4319
4404
|
(profileAccounts === undefined || profileAccounts.includes(id)) &&
|
|
4320
4405
|
accountStatus(provider, id, config, {
|
|
4321
4406
|
existsSync: ctx.existsSync,
|
|
@@ -4397,6 +4482,8 @@ async function runCreate(ctx, opts) {
|
|
|
4397
4482
|
const accountCompany = resolveLaneCompany(hqRoot, { lane_id: "pending-create", company, mesh_company: meshCompany ?? undefined, project_id: project }).company;
|
|
4398
4483
|
const allowedAccounts = Object.keys(config.providers[provider].accounts).filter((id) => (candidateAccounts === undefined || candidateAccounts.includes(id)) &&
|
|
4399
4484
|
accountMatchesCompany(config.providers[provider].accounts[id], accountCompany, config.providers[provider].accounts));
|
|
4485
|
+
if (pinnedAccount !== undefined)
|
|
4486
|
+
refuseHeldPinnedAccount(provider, pinnedAccount, config);
|
|
4400
4487
|
if (pinnedAccount !== undefined && !accountMatchesCompany(config.providers[provider].accounts[pinnedAccount], accountCompany, config.providers[provider].accounts)) {
|
|
4401
4488
|
throw new LanesError("account_company_mismatch", `Account ${pinnedAccount} does not belong to the lane company`, { provider, account: pinnedAccount });
|
|
4402
4489
|
}
|
|
@@ -7302,11 +7389,16 @@ function applyLaneSettings(ctx, laneId, request, options) {
|
|
|
7302
7389
|
if (account === undefined) {
|
|
7303
7390
|
throw new AccountResolutionError("unknown_account", `Lane ${laneId} records account ${JSON.stringify(lane.account)} which is not configured for ${lane.provider}`, { provider: lane.provider, account: lane.account ?? "", enabled: [] });
|
|
7304
7391
|
}
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7392
|
+
// PS-006: never list models or read the catalog in another person's
|
|
7393
|
+
// login. The next spawn moves the lane off it (or refuses) and checks the
|
|
7394
|
+
// model against the account it really runs on.
|
|
7395
|
+
if (!accountHeldByOther(account)) {
|
|
7396
|
+
validateLaneModel(lane.provider, model, effectiveAccountHome(account, ctx.hostname()).home, {
|
|
7397
|
+
readFileSync: ctx.readFileSync,
|
|
7398
|
+
probe: ctx.probeProvider,
|
|
7399
|
+
env: ctx.env,
|
|
7400
|
+
});
|
|
7401
|
+
}
|
|
7310
7402
|
}
|
|
7311
7403
|
const effort = parseCliEffort(lane.provider, request.effort);
|
|
7312
7404
|
const at = ctx.now().toISOString();
|
|
@@ -7858,6 +7950,10 @@ function validateResumeProfileModel(ctx, lane, profile) {
|
|
|
7858
7950
|
}
|
|
7859
7951
|
const hqRoot = ctx.hqRoot();
|
|
7860
7952
|
const config = loadLanesConfig(hqRoot);
|
|
7953
|
+
// PS-006: never read models in another person's login. The resume moves the
|
|
7954
|
+
// lane off that login at spawn, where the new account's models are checked.
|
|
7955
|
+
if (lane.account !== undefined && accountHeldByOther(config.providers[lane.provider].accounts[lane.account]))
|
|
7956
|
+
return;
|
|
7861
7957
|
const account = resolveAccount(lane.provider, lane.account, config, {
|
|
7862
7958
|
hqRoot,
|
|
7863
7959
|
existsSync: ctx.existsSync,
|
|
@@ -7927,6 +8023,15 @@ export function applyResumeProfileAndEffort(hqRoot, current, next, input) {
|
|
|
7927
8023
|
next.provider = targetProvider;
|
|
7928
8024
|
next.provider_source = providerPinned ? current.provider_source : "profile";
|
|
7929
8025
|
if (!accountPinned && profileMatchesProvider) {
|
|
8026
|
+
const profileAccountConfig = profileAccount === undefined
|
|
8027
|
+
? undefined
|
|
8028
|
+
: loadLanesConfig(hqRoot).providers[targetProvider].accounts[profileAccount];
|
|
8029
|
+
if (profileAccount !== undefined && accountHeldByOther(profileAccountConfig)) {
|
|
8030
|
+
const holder = profileAccountConfig?.holder ?? null;
|
|
8031
|
+
throw new LanesError("account_held_by_other", `Worker profile account ${profileAccount} is held by ${holder}, not the owner, and is not used for lanes`, {
|
|
8032
|
+
lane_id: current.lane_id, account: profileAccount, holder,
|
|
8033
|
+
});
|
|
8034
|
+
}
|
|
7930
8035
|
if (profileAccount !== undefined && profileAccount !== current.account &&
|
|
7931
8036
|
!accountMatchesCompany(loadLanesConfig(hqRoot).providers[targetProvider].accounts[profileAccount], resolveLaneCompany(hqRoot, current).company, loadLanesConfig(hqRoot).providers[targetProvider].accounts)) {
|
|
7932
8037
|
throw new LanesError("account_company_mismatch", "Worker profile account does not belong to the lane company", {
|
|
@@ -8001,11 +8106,15 @@ function recordResumeSetup(ctx, lane, input) {
|
|
|
8001
8106
|
if (account === undefined) {
|
|
8002
8107
|
throw new AccountResolutionError("unknown_account", `Lane ${lane.lane_id} records account ${JSON.stringify(lane.account)} which is not configured for ${lane.provider}`, { provider: lane.provider, account: lane.account ?? "", enabled: [] });
|
|
8003
8108
|
}
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8109
|
+
// PS-006: as in applyLaneSettings, a held recorded login is not probed;
|
|
8110
|
+
// spawn moves the lane off it or refuses.
|
|
8111
|
+
if (!accountHeldByOther(account)) {
|
|
8112
|
+
validateLaneModel(lane.provider, model, effectiveAccountHome(account, ctx.hostname()).home, {
|
|
8113
|
+
readFileSync: ctx.readFileSync,
|
|
8114
|
+
probe: ctx.probeProvider,
|
|
8115
|
+
env: ctx.env,
|
|
8116
|
+
});
|
|
8117
|
+
}
|
|
8009
8118
|
}
|
|
8010
8119
|
if (input.profile === undefined &&
|
|
8011
8120
|
input.effort === undefined &&
|
|
@@ -8122,6 +8231,11 @@ async function prepareAccountMove(ctx, lane, input) {
|
|
|
8122
8231
|
if (targetCfg === undefined) {
|
|
8123
8232
|
throw new AccountResolutionError("unknown_account", `Unknown account ${JSON.stringify(target)} for ${lane.provider}. Configured: ${Object.keys(providerCfg.accounts).join(", ") || "(none)"}`, { provider: lane.provider, account: target, enabled: Object.keys(providerCfg.accounts).filter((id) => providerCfg.accounts[id]?.enabled) });
|
|
8124
8233
|
}
|
|
8234
|
+
if (accountHeldByOther(targetCfg)) {
|
|
8235
|
+
throw new LanesError("account_held_by_other", `Account ${target} is held by ${targetCfg.holder}, not the owner, and is not used for lanes`, {
|
|
8236
|
+
provider: lane.provider, account: target, holder: targetCfg.holder ?? null,
|
|
8237
|
+
});
|
|
8238
|
+
}
|
|
8125
8239
|
if (!accountMatchesCompany(targetCfg, resolveLaneCompany(hqRoot, lane).company, providerCfg.accounts)) {
|
|
8126
8240
|
throw new LanesError("account_company_mismatch", "Lane moves require an account assigned to the lane's company", {
|
|
8127
8241
|
provider: lane.provider, account: target, company: lane.company,
|
|
@@ -11599,6 +11713,17 @@ export function registerRunnersCommand(parent, deps = {}) {
|
|
|
11599
11713
|
.action(wrap(async (provider, accountId, home, opts) => {
|
|
11600
11714
|
await accountHandlers.runAccountsSetHome(ctx, provider, accountId, home, opts);
|
|
11601
11715
|
}));
|
|
11716
|
+
accounts
|
|
11717
|
+
.command("set-owner")
|
|
11718
|
+
.description("Record which business owns a login and who holds it (labels only; no credential moves)")
|
|
11719
|
+
.argument("<provider>", "claude | codex | grok")
|
|
11720
|
+
.argument("<account-id>", "Existing account id")
|
|
11721
|
+
.option("--owning-company <slug>", "Company slug, personal, or unknown")
|
|
11722
|
+
.option("--holder <name>", "owner, or the name of the person who holds the login")
|
|
11723
|
+
.option("--json", "JSON on stdout (always)")
|
|
11724
|
+
.action(wrap(async (provider, accountId, opts) => {
|
|
11725
|
+
await accountHandlers.runAccountsSetOwner(ctx, provider, accountId, opts);
|
|
11726
|
+
}));
|
|
11602
11727
|
accounts
|
|
11603
11728
|
.command("login")
|
|
11604
11729
|
.description("Create a home, run the vendor login, and register the account")
|
|
@@ -23,9 +23,27 @@ export interface HeldScope {
|
|
|
23
23
|
at: string;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
export interface CorruptIdentityRecovery {
|
|
27
|
+
recovered: boolean;
|
|
28
|
+
reason?: "none" | "unproven" | "different-person" | "several-people";
|
|
29
|
+
clearedMarker: boolean;
|
|
30
|
+
clearedScopeFiles: number;
|
|
31
|
+
/** Corrupt scope records restored with an upload hold. Absent on older hq-cloud. */
|
|
32
|
+
heldScopeFiles?: number;
|
|
33
|
+
/** True when recovery replaced the file with a hold and cleared nothing. */
|
|
34
|
+
uploadsStayHeld?: boolean;
|
|
35
|
+
}
|
|
26
36
|
interface FenceExports {
|
|
27
37
|
listPushIdentityFences: (stateDir: string) => HeldScope[];
|
|
28
38
|
releasePushIdentityFences: (stateDir: string, identities: readonly string[], slugs?: readonly string[]) => string[];
|
|
39
|
+
corruptPushIdentityHold?: (stateDir: string, journalSlug?: string) => boolean;
|
|
40
|
+
recoverCorruptPushIdentity?: (stateDir: string, identities: readonly string[], options?: {
|
|
41
|
+
personalOwnerUid?: string | null;
|
|
42
|
+
slugs?: readonly string[];
|
|
43
|
+
limitToSlugs?: boolean;
|
|
44
|
+
confirmUnproven?: boolean;
|
|
45
|
+
}) => CorruptIdentityRecovery;
|
|
46
|
+
readPersonalVaultOwnerUid?: () => string | null;
|
|
29
47
|
}
|
|
30
48
|
export declare const HELD_UNAVAILABLE_MESSAGE = "this HQ build cannot list or release held uploads yet; update HQ and try again";
|
|
31
49
|
export declare function fenceExports(mod?: Record<string, unknown>): FenceExports | undefined;
|
|
@@ -61,7 +79,11 @@ export interface ReleaseHeldOptions {
|
|
|
61
79
|
personal?: boolean;
|
|
62
80
|
yes?: boolean;
|
|
63
81
|
json?: boolean;
|
|
82
|
+
/** Restore an unreadable identity file and keep every upload held until the person confirms the files. */
|
|
83
|
+
confirmUnproven?: boolean;
|
|
64
84
|
}
|
|
85
|
+
/** Next step on this computer when saved history names nobody or more than one person. */
|
|
86
|
+
export declare const CONFIRM_UNPROVEN_COMMAND = "hq sync release-held --confirm-unproven";
|
|
65
87
|
export declare function runReleaseHeld(deps: SyncHeldDeps, options: ReleaseHeldOptions): Promise<number>;
|
|
66
88
|
/**
|
|
67
89
|
* The signed-in identity from the session token `ensureCognitoToken` selects
|
|
@@ -26,40 +26,67 @@ export function fenceExports(mod = hqCloud) {
|
|
|
26
26
|
const release = mod.releasePushIdentityFences;
|
|
27
27
|
if (typeof list !== "function" || typeof release !== "function")
|
|
28
28
|
return undefined;
|
|
29
|
+
const corrupt = mod.corruptPushIdentityHold;
|
|
30
|
+
const recover = mod.recoverCorruptPushIdentity;
|
|
31
|
+
const readOwner = mod.readPersonalVaultOwnerUid;
|
|
29
32
|
return {
|
|
30
33
|
listPushIdentityFences: list,
|
|
31
34
|
releasePushIdentityFences: release,
|
|
35
|
+
...(typeof corrupt === "function" ? { corruptPushIdentityHold: corrupt } : {}),
|
|
36
|
+
...(typeof recover === "function" ? { recoverCorruptPushIdentity: recover } : {}),
|
|
37
|
+
...(typeof readOwner === "function" ? { readPersonalVaultOwnerUid: readOwner } : {}),
|
|
32
38
|
};
|
|
33
39
|
}
|
|
34
40
|
export function scopeLabel(slug) {
|
|
35
41
|
return slug === PERSONAL_VAULT_JOURNAL_SLUG || slug === "personal" ? "personal vault" : `company ${slug}`;
|
|
36
42
|
}
|
|
43
|
+
/** A sync has written the files this hold would upload. A count of zero is a real empty list. */
|
|
44
|
+
function hasFileList(scope) {
|
|
45
|
+
const held = scope.held;
|
|
46
|
+
if (!held || !Array.isArray(held.samplePaths))
|
|
47
|
+
return false;
|
|
48
|
+
if (held.samplePaths.length > 0)
|
|
49
|
+
return true;
|
|
50
|
+
return held.count === 0;
|
|
51
|
+
}
|
|
37
52
|
function describe(scope) {
|
|
38
53
|
const since = new Date(scope.sinceMs).toISOString();
|
|
39
54
|
const lines = [` ${scopeLabel(scope.slug)}: held since ${since}`];
|
|
40
55
|
if (scope.held) {
|
|
56
|
+
const samples = scope.held.samplePaths;
|
|
41
57
|
lines.push(` ${scope.held.count} file${scope.held.count === 1 ? "" : "s"} waiting to upload (last checked ${scope.held.at})`);
|
|
42
|
-
for (const sample of
|
|
58
|
+
for (const sample of samples)
|
|
43
59
|
lines.push(` ${sample}`);
|
|
44
|
-
if (scope.held.count >
|
|
45
|
-
lines.push(
|
|
60
|
+
if (scope.held.count > samples.length)
|
|
61
|
+
lines.push(` and ${scope.held.count - samples.length} more`);
|
|
46
62
|
}
|
|
47
63
|
return lines;
|
|
48
64
|
}
|
|
65
|
+
function unnamedHoldMessage(scopes) {
|
|
66
|
+
const names = scopes.map((scope) => scopeLabel(scope.slug)).join(", ");
|
|
67
|
+
const single = scopes.length === 1;
|
|
68
|
+
return `${names} ${single ? "is" : "are"} held, but this computer has not listed the files yet, so ${single ? "that hold stays" : "those holds stay"}. Run \`hq sync\` once, then run \`hq sync release-held\` again and confirm the files it names.`;
|
|
69
|
+
}
|
|
49
70
|
export async function runSyncHeld(deps, json = false) {
|
|
50
71
|
if (!deps.exports) {
|
|
51
72
|
deps.log(`${chalk.red("✗")} ${HELD_UNAVAILABLE_MESSAGE}`);
|
|
52
73
|
return 1;
|
|
53
74
|
}
|
|
54
75
|
const scopes = deps.exports.listPushIdentityFences(deps.stateDir);
|
|
76
|
+
const corrupt = deps.exports.corruptPushIdentityHold?.(deps.stateDir) === true;
|
|
55
77
|
if (json) {
|
|
56
|
-
deps.log(JSON.stringify({ scopes }));
|
|
78
|
+
deps.log(JSON.stringify({ scopes, ...(corrupt ? { corruptIdentity: true } : {}) }));
|
|
57
79
|
return 0;
|
|
58
80
|
}
|
|
59
|
-
if (scopes.length === 0) {
|
|
81
|
+
if (scopes.length === 0 && !corrupt) {
|
|
60
82
|
deps.log("No uploads are held on this computer.");
|
|
61
83
|
return 0;
|
|
62
84
|
}
|
|
85
|
+
if (corrupt) {
|
|
86
|
+
deps.log("Uploads are held because the identity file on this computer can't be read. Run `hq sync release-held` to restore it from the account you are signed in as.");
|
|
87
|
+
}
|
|
88
|
+
if (scopes.length === 0)
|
|
89
|
+
return 0;
|
|
63
90
|
// First install also writes this hold (feedback_baa82c96). Do not say
|
|
64
91
|
// another account was signed in; that is often false and reads as a
|
|
65
92
|
// security scare. The hold is still a confirmation before upload.
|
|
@@ -68,9 +95,16 @@ export async function runSyncHeld(deps, json = false) {
|
|
|
68
95
|
for (const line of describe(scope))
|
|
69
96
|
deps.log(line);
|
|
70
97
|
deps.log("");
|
|
71
|
-
|
|
98
|
+
const unlisted = scopes.filter((scope) => !hasFileList(scope));
|
|
99
|
+
if (scopes.some(hasFileList)) {
|
|
100
|
+
deps.log("Nothing has been uploaded or deleted in the cloud. If these files are yours, run `hq sync release-held`.");
|
|
101
|
+
}
|
|
102
|
+
if (unlisted.length > 0)
|
|
103
|
+
deps.log(unnamedHoldMessage(unlisted));
|
|
72
104
|
return 0;
|
|
73
105
|
}
|
|
106
|
+
/** Next step on this computer when saved history names nobody or more than one person. */
|
|
107
|
+
export const CONFIRM_UNPROVEN_COMMAND = "hq sync release-held --confirm-unproven";
|
|
74
108
|
export async function runReleaseHeld(deps, options) {
|
|
75
109
|
if (!deps.exports) {
|
|
76
110
|
deps.log(`${chalk.red("✗")} ${HELD_UNAVAILABLE_MESSAGE}`);
|
|
@@ -81,28 +115,55 @@ export async function runReleaseHeld(deps, options) {
|
|
|
81
115
|
scopes = scopes.filter((scope) => scope.slug === PERSONAL_VAULT_JOURNAL_SLUG || scope.slug === "personal");
|
|
82
116
|
if (options.company)
|
|
83
117
|
scopes = scopes.filter((scope) => scope.slug === options.company);
|
|
84
|
-
|
|
118
|
+
const corrupt = corruptHoldRequested(deps, options);
|
|
119
|
+
if (scopes.length === 0 && !corrupt) {
|
|
85
120
|
deps.log(options.json ? JSON.stringify({ released: [] }) : "No held uploads match.");
|
|
86
121
|
return 0;
|
|
87
122
|
}
|
|
88
|
-
const needPersonal = scopes.some((scope) => scope.slug === PERSONAL_VAULT_JOURNAL_SLUG || scope.slug === "personal");
|
|
123
|
+
const needPersonal = corrupt || scopes.some((scope) => scope.slug === PERSONAL_VAULT_JOURNAL_SLUG || scope.slug === "personal");
|
|
89
124
|
const snapshot = await deps.identity({ needPersonal, interactive: true });
|
|
90
125
|
const identities = [snapshot.sub, ...(snapshot.personalUid ? [snapshot.personalUid] : [])];
|
|
91
126
|
const mine = scopes.filter((scope) => identities.includes(scope.uid));
|
|
92
|
-
|
|
127
|
+
const listed = mine.filter(hasFileList);
|
|
128
|
+
const unlisted = mine.filter((scope) => !hasFileList(scope));
|
|
129
|
+
if (mine.length === 0 && !corrupt) {
|
|
93
130
|
deps.log(options.json
|
|
94
131
|
? JSON.stringify({ released: [], reason: "not-yours" })
|
|
95
132
|
: "These held uploads belong to a different signed-in person. Sign in as that person to release them.");
|
|
96
133
|
return 1;
|
|
97
134
|
}
|
|
98
135
|
if (!options.json) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
for (const
|
|
102
|
-
|
|
136
|
+
if (listed.length > 0 && options.confirmUnproven) {
|
|
137
|
+
deps.log("These uploads stay held until you confirm which files are yours:");
|
|
138
|
+
for (const scope of listed)
|
|
139
|
+
for (const line of describe(scope))
|
|
140
|
+
deps.log(line);
|
|
141
|
+
}
|
|
142
|
+
else if (listed.length > 0) {
|
|
143
|
+
deps.log("Releasing these uploads sends the files below to the cloud as yours:");
|
|
144
|
+
for (const scope of listed)
|
|
145
|
+
for (const line of describe(scope))
|
|
146
|
+
deps.log(line);
|
|
147
|
+
}
|
|
148
|
+
if (corrupt) {
|
|
149
|
+
deps.log("The identity file on this computer can't be read. Restoring it keeps the uploads held until you review them.");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// A recovered corrupt scope is a hold with no file list until a sync records one.
|
|
153
|
+
// Releasing it would upload whatever is on disk, including another person's edits.
|
|
154
|
+
if (listed.length === 0 && !corrupt) {
|
|
155
|
+
const unnamed = unnamedHoldMessage(unlisted);
|
|
156
|
+
deps.log(options.json ? JSON.stringify({ released: [], reason: "no-file-list", message: unnamed }) : unnamed);
|
|
157
|
+
return 1;
|
|
103
158
|
}
|
|
159
|
+
if (!options.json && unlisted.length > 0)
|
|
160
|
+
deps.log(unnamedHoldMessage(unlisted));
|
|
104
161
|
if (!options.yes) {
|
|
105
|
-
const ok = await deps.confirm(
|
|
162
|
+
const ok = await deps.confirm(options.confirmUnproven
|
|
163
|
+
? "Restore the identity file and keep every upload held until you confirm which files are yours? [y/N] "
|
|
164
|
+
: corrupt && listed.length === 0
|
|
165
|
+
? "Restore the identity file from the account you are signed in as? [y/N] "
|
|
166
|
+
: "Are these files yours to upload? [y/N] ");
|
|
106
167
|
if (!ok) {
|
|
107
168
|
deps.log(options.json ? JSON.stringify({ released: [] }) : "Nothing released.");
|
|
108
169
|
return 1;
|
|
@@ -118,12 +179,99 @@ export async function runReleaseHeld(deps, options) {
|
|
|
118
179
|
: "The signed-in account changed while releasing. Nothing was released; run the command again.");
|
|
119
180
|
return 1;
|
|
120
181
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
182
|
+
// The confirm-unproven prompt keeps every upload held. It is not agreement
|
|
183
|
+
// to release the listed scopes, and --yes only skips that prompt. Release
|
|
184
|
+
// those scopes only when the person agreed to upload these exact files.
|
|
185
|
+
const withheldListed = options.confirmUnproven === true && listed.length > 0;
|
|
186
|
+
const released = listed.length === 0 || withheldListed
|
|
187
|
+
? []
|
|
188
|
+
: deps.exports.releasePushIdentityFences(deps.stateDir, identities, listed.map((scope) => scope.slug));
|
|
189
|
+
const recovery = corrupt ? restoreCorruptIdentity(deps, identities, options) : undefined;
|
|
190
|
+
// "none" means the unreadable file was already gone. That is not a refusal.
|
|
191
|
+
if (recovery && !recovery.recovered && recovery.reason !== "none") {
|
|
192
|
+
if (!options.json && released.length > 0) {
|
|
193
|
+
deps.log(`Released ${released.map(scopeLabel).join(", ")}.`);
|
|
194
|
+
}
|
|
195
|
+
deps.log(options.json
|
|
196
|
+
? JSON.stringify({ released, identityRestored: false, reason: recovery.reason })
|
|
197
|
+
: corruptRefusal(recovery.reason, released.length > 0));
|
|
198
|
+
return 1;
|
|
199
|
+
}
|
|
200
|
+
const restored = recovery?.recovered === true;
|
|
201
|
+
const heldScopeFiles = recovery?.heldScopeFiles ?? 0;
|
|
202
|
+
const stayHeld = heldScopeFiles > 0 || recovery?.uploadsStayHeld === true || withheldListed;
|
|
203
|
+
const reportCorrupt = corrupt && recovery?.reason !== "none";
|
|
204
|
+
const needsSync = unlisted.length > 0 ? unlisted.map((scope) => scope.slug) : undefined;
|
|
205
|
+
if (options.json) {
|
|
206
|
+
deps.log(JSON.stringify({
|
|
207
|
+
released,
|
|
208
|
+
...(reportCorrupt ? { identityRestored: restored } : {}),
|
|
209
|
+
...(recovery?.uploadsStayHeld === true || withheldListed ? { uploadsStayHeld: true } : {}),
|
|
210
|
+
...(needsSync ? { needsSync, ...(released.length === 0 && !withheldListed ? { reason: "no-file-list" } : {}) } : {}),
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
else if (restored && stayHeld && released.length === 0) {
|
|
214
|
+
deps.log(withheldListed
|
|
215
|
+
? "Restored the identity file and kept the uploads held. Run `hq sync release-held` again without `--confirm-unproven` and confirm the files it names."
|
|
216
|
+
: "Restored the identity file and kept the uploads held. Run `hq sync` once so the held files are listed, then run `hq sync release-held` again and confirm the files it names.");
|
|
217
|
+
}
|
|
218
|
+
else if (restored && stayHeld) {
|
|
219
|
+
deps.log(`Released ${released.map(scopeLabel).join(", ")}. Restored the identity file and kept the uploads held. Run \`hq sync\` once so the held files are listed, then run \`hq sync release-held\` again and confirm the files it names.`);
|
|
220
|
+
}
|
|
221
|
+
else if (restored && released.length === 0) {
|
|
222
|
+
deps.log("Restored the identity file from the account you are signed in as. The next sync can upload.");
|
|
223
|
+
}
|
|
224
|
+
else if (restored) {
|
|
225
|
+
deps.log(`Released ${released.map(scopeLabel).join(", ")} and restored the identity file. The next sync uploads these files.`);
|
|
226
|
+
}
|
|
227
|
+
else if (withheldListed) {
|
|
228
|
+
deps.log("Kept the uploads held. Run `hq sync release-held` without `--confirm-unproven` and confirm the files it names.");
|
|
229
|
+
}
|
|
230
|
+
else if (released.length === 0) {
|
|
231
|
+
deps.log("No held uploads match.");
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
deps.log(`Released ${released.map(scopeLabel).join(", ")}. The next sync uploads these files.`);
|
|
235
|
+
}
|
|
125
236
|
return 0;
|
|
126
237
|
}
|
|
238
|
+
function corruptHoldRequested(deps, options) {
|
|
239
|
+
const probe = deps.exports?.corruptPushIdentityHold;
|
|
240
|
+
if (!probe || !deps.exports?.recoverCorruptPushIdentity)
|
|
241
|
+
return false;
|
|
242
|
+
if (options.company)
|
|
243
|
+
return probe(deps.stateDir, options.company);
|
|
244
|
+
if (options.personal)
|
|
245
|
+
return probe(deps.stateDir, PERSONAL_VAULT_JOURNAL_SLUG) || probe(deps.stateDir, "personal");
|
|
246
|
+
return probe(deps.stateDir);
|
|
247
|
+
}
|
|
248
|
+
function restoreCorruptIdentity(deps, identities, options) {
|
|
249
|
+
const recover = deps.exports?.recoverCorruptPushIdentity;
|
|
250
|
+
if (!recover)
|
|
251
|
+
return { recovered: false, reason: "unproven", clearedMarker: false, clearedScopeFiles: 0 };
|
|
252
|
+
const personalOwnerUid = deps.exports?.readPersonalVaultOwnerUid?.() ?? null;
|
|
253
|
+
const slugs = options.company
|
|
254
|
+
? [options.company]
|
|
255
|
+
: options.personal
|
|
256
|
+
? [PERSONAL_VAULT_JOURNAL_SLUG, "personal"]
|
|
257
|
+
: undefined;
|
|
258
|
+
return recover(deps.stateDir, identities, {
|
|
259
|
+
personalOwnerUid,
|
|
260
|
+
...(slugs ? { slugs, limitToSlugs: true } : {}),
|
|
261
|
+
...(options.confirmUnproven ? { confirmUnproven: true } : {}),
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function corruptRefusal(reason, released) {
|
|
265
|
+
const tail = released ? "The identity file was left unchanged." : "Nothing was changed.";
|
|
266
|
+
const confirm = `Run \`${CONFIRM_UNPROVEN_COMMAND}\` on this computer. It restores the file and keeps every upload held until you confirm which files are yours.`;
|
|
267
|
+
if (reason === "several-people") {
|
|
268
|
+
return `The identity file on this computer can't be read, and this computer's history names more than one person. ${tail} ${confirm}`;
|
|
269
|
+
}
|
|
270
|
+
if (reason === "different-person") {
|
|
271
|
+
return `The identity file on this computer can't be read, and the signed-in account is not the one this computer's history names. ${tail} Sign in as that account and run \`hq sync release-held\`.`;
|
|
272
|
+
}
|
|
273
|
+
return `The identity file on this computer can't be read, and no saved history on this computer names an account for it. ${tail} ${confirm}`;
|
|
274
|
+
}
|
|
127
275
|
async function confirmOnTty(question) {
|
|
128
276
|
if (process.stdin.isTTY !== true || process.stdout.isTTY !== true)
|
|
129
277
|
return false;
|
|
@@ -186,6 +334,7 @@ export function registerSyncHeldCommands(syncCmd) {
|
|
|
186
334
|
.option("--company <slug>", "Release only this company")
|
|
187
335
|
.option("--personal", "Release only the personal vault")
|
|
188
336
|
.option("--yes", "Do not ask for confirmation")
|
|
337
|
+
.option("--confirm-unproven", "Restore an unreadable identity file and keep every upload held until you confirm which files are yours")
|
|
189
338
|
.option("--json", "Print the result as JSON")
|
|
190
339
|
.action(async (options) => {
|
|
191
340
|
process.exitCode = await runReleaseHeld(createDefaultSyncHeldDeps(), options);
|