@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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.345.226] — 2026-11-17
|
|
6
|
+
- `hq sync release-held` restores an identity file sync cannot read and keeps those uploads held until you review them. When no saved history names an account, or the history names more than one person, it tells you to run `hq sync release-held --confirm-unproven` on this computer. That restores the file and keeps every upload held until you confirm which files are yours. A hold that lists no files stays in place. Run `hq sync` once, then run `hq sync release-held` and confirm the files it names. When the history names one other account, it tells you to sign in as that account and run `hq sync release-held`. `hq sync held` names `hq sync release-held` while the file cannot be read. Saying yes to `--confirm-unproven`, including with `--yes`, does not release uploads that already list files. Run `hq sync release-held` again without that flag and confirm the files it names. Declining the prompt releases nothing.
|
|
7
|
+
- `hq daemon status` (text and `--json`) has a `lanes-reconcile` line again when the daemon reconciles lanes in process. It shows the last run time and result; a failed run reads `last run failed: <error>` (one line, secrets removed, at most 300 bytes, also `lastError` in `--json`), and a failed run on a signed-out machine reads `waiting not signed in (run `hq login`)` like the other services. Before, a reconcile failing every 15 seconds was visible only in `daemon.log`.
|
|
8
|
+
- `hq deploy domains add`, `refresh`, `base add` and `base status` no longer ask you to create DNS records for a domain your company bought through HQ. When hq-deploy answers `dnsManaged: true`, they print `HQ manages DNS for <domain>. No records to add.` instead of the record list, the apex ALIAS advice and the "When the records are in place" step. `list` marks those domains, and `--json` output now includes `dnsManaged` (false when an older server leaves it out).
|
|
9
|
+
- Refuse relative file paths after sourced code may change the working directory, and preserve directory effects of same-shell eval.
|
|
10
|
+
- Refuse zsh splitting and globbing flags on positional parameters when the native scope guard cannot determine their paths.
|
|
11
|
+
- `hq-hook run --host` now blocks a tool call when the process checking it is killed (SIGKILL, the out-of-memory killer, an abort), is still running when its time is up, exits with a code or with output that is not an answer, or cannot be started. On macOS and Linux the tool-call check runs in a child of hq-hook itself; its answer is passed through unchanged when it gives one. hq-hook tells that it is that child from what the system says about its parent process, not from its environment. A machine that cannot start one more process (a process limit, heavy load) now has its tool calls blocked with that reason, where the check used to run anyway. Cost: one extra start of hq-hook per checked tool call. Other events and Windows are unchanged.
|
|
12
|
+
- Bundles hq-cloud 6.18.110 (32 hq-cloud changes). Sync: the background sync runner (daemon, --direction both) pulls but skips the upload for one pass when the last sync is more than 7 days old (hq sync now still pushes first); unattended runs keep shared files another member created instead of deleting them; a burst of scattered deletes is refused; a blank company manifest never replaces a populated one; append-only logs are merged entry by entry on a two-sided conflict; knowledge folders named build, dist, out, tmp or vendor now sync. Sign-in: a network failure during a token refresh no longer marks the session invalid, and machine sign-in backs off across processes after a NotAuthorized. Outposts: the --company flag works on exec, exec-submit, exec-stage, exec-result and terminal. Rescue and reindex fixes.
|
|
13
|
+
- `policy.check` answers `hq_root_unreadable` when the hq daemon cannot open the HQ folder (EPERM, as macOS returns for a launchd daemon reading under Documents, Desktop or iCloud Drive), instead of a raw `internal` error. The hook shim uses that code to run the scope check in the hook process, so company work in a correctly bound session is no longer blocked.
|
|
14
|
+
- lanes: every lane account can record `owning_company` (a company slug, `personal` or `unknown`) and `holder` (`owner` or another named person) in `personal/lanes/config.json`. Set them with `hq lanes accounts set-owner <provider> <account-id> --owning-company <slug|personal|unknown> --holder <owner|name>`; only these two labels are written. Reserved words are matched case-insensitively and stored in lowercase (`Owner` and `OWNER` become `owner`, `Personal` becomes `personal`). A holder may not contain C0 or C1 control characters, bidi embedding, override, isolate or mark characters, or zero-width characters. `hq lanes accounts list --json` prints both on every account, with their source, `held_by_owner` (true for `owner`, false for another person, null when no holder is recorded or it is `unknown`) and `ownership_missing`, plus an `ownership_warnings` list; enabled accounts missing either value are named in one warning line on stderr with the set-owner command. `set-owner` warns when the change leaves a provider with no login lanes can use, and when the holder matches this machine's user name (a sign the owner typed his own name instead of `owner`). `hq runners capacity --json` adds `owning_company` and `holder` to each account. A login held by another person is left out of `accounts` and listed under `other_holder_logins` with engine and holder only. Lanes never use such a login: first assignment, every balanced pick (including Outpost pickup), `--account auto` (it moves on to the next account), the Claude balance, background recovery, loop recovery in reconcile, pinned `--account`, `move-target` and account moves all skip or refuse it (`account_held_by_other`), and a lane already on it moves off or is refused at its next spawn, resume or recovery. An envelope repair turn on such a login is refused, Outpost pickup of a lane pinned to one fails with `account_disabled` (details name `account_held_by_other`) while a lane whose account was balanced or auto-picked is re-picked onto a usable login in the lane's company and admission accounts (recorded in `account_history`; with none in scope the pickup fails with `account_disabled`). A pickup that picks an account for a lane with none recorded uses the same company and admission scope, `hq lanes set --model` and `hq lanes resume|message --model` never check the model in such a login (keeping a lane on it with `--account` is refused), a lane that can only wait records `admit_failed` naming `account_held_by_other`, and `--model` checks never probe or read the model catalog in such a login's home. `owning_company` is not a lane filter (the owner's logins serve any of the owner's businesses); the existing `company` tag is unchanged. `hq capacity accounts --json` adds `owningCompany` and `holder` to each row and a `byOwningCompany` grouping. All fields are additions; snapshots from older CLIs parse as before.
|
|
15
|
+
- Behaviour change without the new fields: an Outpost lane picked up with no recorded account now picks only a login inside the lane's company (and its admission list when set), the same rule a local first assignment uses. Setups that tag some logins by company and run Codex or Grok Outpost lanes will see such pickups fail with `account_disabled` (`no_account_in_lane_scope`) where they used to bind an untagged or other-company login. Setups with no company tags are unchanged.
|
|
16
|
+
- Known limits, not changed here:
|
|
17
|
+
- An older CLI strips `owning_company` and `holder` the next time it rewrites `personal/lanes/config.json`, and an older Outpost still lists other people's logins by account id in its capacity output and may still pick them. Upgrade every Outpost (and every other host that shares the file) before anyone runs `set-owner`.
|
|
18
|
+
- `hq capacity accounts` and `hq bot --account` still show or use a login held by another person, and `hq capacity available` still lists it as a row, though never as its recommended pick.
|
|
19
|
+
- `set-owner` takes no lock against a concurrent config write, and it saves a `~` home path as an absolute path when it rewrites the file.
|
|
20
|
+
- Error messages for a held-by-other login include the account id and the holder's name.
|
|
21
|
+
- Codex PostToolUse in hq-hook now models the adapter's `auto-capture-registry` Bash supplement. No released hook gate lets it run, so it does nothing, as under the adapter. A gate that would let it run is refused natively.
|
|
22
|
+
- hq-hook: port the PreToolUse start_session row of spawn-company-handoff natively (updatedInput carried through the evaluator chain to Claude Code) and claim it in the capabilities COVERS for PreToolUse. Its UserPromptSubmit row runs hq-session.sh and stays on the shell path, unclaimed.
|
|
23
|
+
- The native SessionStart hook now gives the lanes senior-monitor reminder (`45-lanes-senior-monitor.sh`) through the shared `lanes_reminder` shim, with the shell's 2-second `hq runners monitor-check` limit.
|
|
24
|
+
- The native SessionEnd hook now stops the MCP helper processes its own session started and sweeps stale per-process temp files, matching `cleanup-mcp-processes.sh` (it runs `ps` with a time limit and starts no shell, jq or awk).
|
|
25
|
+
- hq-hook: on hq-core v16.0.48-beta.104 through beta.124, the company git metadata and plans-folder guards answer natively again instead of handing every call back to bash (their hook library 9133295e is now pinned).
|
|
26
|
+
- hq-hook: on hq-core v16.0.48-beta.109 through beta.124, policy injection answers natively through the bridge instead of handing every call back to bash (injector da7c95c2, hook-gate a443b481 and gate a2879dfe are now pinned).
|
|
27
|
+
- Add guard-only coverage for nested function argument ownership, preserving cross-company refusals and allowed own-company calls.
|
|
28
|
+
- The native hook engine's command rules now answer only where the old hook would have run (HQ_DISABLED_HOOKS and the registry prefilter), name that hook in the refusal, and give env-file-no-trailing-newline's own message on Claude Code, with a parity test against the hq-core-staging master-hook. No hook is added to the coverage list.
|
|
29
|
+
- The HQ daemon now takes request notes that the native hook engine leaves under `~/.hq/daemon/hook-requests/` and does the work they ask for; the first kind is `reindex` (`hq reindex --from-hook`). A note waits while no daemon is running, is tried up to three times, and is deleted without running once it is a day old.
|
|
30
|
+
- The native hook engine gains the writer for those notes and a `reindex` PostToolUse check that leaves one instead of starting `hq`. The check is not registered yet: `reindex.sh` still runs.
|
|
31
|
+
- The native hook engine now gives the "JOURNAL ENTRY DUE" reminder on Claude Code PostToolUse (every ten edits of a session, a `git commit`, a test or lint run with edits behind it), as `journal-due.sh` did, without starting a program. It takes the session journal's counter lock in process, waits at most five seconds for it, and claims the hook in its PostToolUse cover list.
|
|
32
|
+
- The native hook engine has a port of the intent hint (`intent-hint.sh`, the `<intent-hints>` block on UserPromptSubmit) with a parity test against the shell hook. It is not registered and `intent-hint` is not claimed, so the shell hook still runs everywhere: its `/startwork` company prefetch starts a program and waits on an owner decision.
|
|
33
|
+
- The native hook engine has a port of the first-prompt routing reminder (`natural-language-router.sh`, the `<natural-language-routing>` block on UserPromptSubmit) with a parity test against the shell hook. It is not registered and `natural-language-router` is not claimed, so the shell hook still runs everywhere: its first-prompt company bind reads a helper script and starts a program, and is ported in later changes.
|
|
34
|
+
- `hq-hook` gains a native version of the session auto-bind and session scope capability shell libraries (`session_start_mesh`), checked file for file against the shell libraries. No hook uses it yet: the SessionStart work-mesh hook still runs as a shell hook.
|
|
35
|
+
- The native hook engine gains an in-process version of the `/startwork <company>` prefetch gate, the `<startwork-context>` block and the last-thread line (first of five parts). Nothing calls it yet; the `intent-hint` hook still runs on the shell path.
|
|
36
|
+
|
|
5
37
|
## [5.345.225] — 2026-11-17
|
|
6
38
|
- The native agent-browser presence check stays silent while the daemon owns the machine checks, so a missing agent-browser is shown once by the machine-check notice instead of at every session start (and twice at the first).
|
|
7
39
|
- `hq install --global` and `hq reindex` register master-hook for the Claude Code user-scope hooks on a root the hq daemon serves, instead of the hqd shim, so tool calls in projects outside HQ get every PreToolUse hook master-hook runs. An existing shim registration is moved back on the next reindex.
|
|
@@ -1246,6 +1246,10 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
1246
1246
|
readonly flags: "--yes";
|
|
1247
1247
|
readonly description: "Do not ask for confirmation";
|
|
1248
1248
|
readonly hidden: false;
|
|
1249
|
+
}, {
|
|
1250
|
+
readonly flags: "--confirm-unproven";
|
|
1251
|
+
readonly description: "Restore an unreadable identity file and keep every upload held until you confirm which files are yours";
|
|
1252
|
+
readonly hidden: false;
|
|
1249
1253
|
}, {
|
|
1250
1254
|
readonly flags: "--json";
|
|
1251
1255
|
readonly description: "Print the result as JSON";
|
|
@@ -8997,6 +9001,14 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
8997
9001
|
readonly flags: "--id <outpostId>";
|
|
8998
9002
|
readonly description: "Outpost id (defaults to your primary box)";
|
|
8999
9003
|
readonly hidden: false;
|
|
9004
|
+
}, {
|
|
9005
|
+
readonly flags: "--company <slug>";
|
|
9006
|
+
readonly description: "Run on this company's Outpost (company owners and admins)";
|
|
9007
|
+
readonly hidden: false;
|
|
9008
|
+
}, {
|
|
9009
|
+
readonly flags: "--outpost <name|id>";
|
|
9010
|
+
readonly description: "Which company Outpost, when the company has more than one";
|
|
9011
|
+
readonly hidden: false;
|
|
9000
9012
|
}, {
|
|
9001
9013
|
readonly flags: "--root";
|
|
9002
9014
|
readonly description: "Run the command as root (default: ec2-user)";
|
|
@@ -9041,6 +9053,14 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
9041
9053
|
readonly flags: "--id <outpostId>";
|
|
9042
9054
|
readonly description: "Outpost id (defaults to your primary box)";
|
|
9043
9055
|
readonly hidden: false;
|
|
9056
|
+
}, {
|
|
9057
|
+
readonly flags: "--company <slug>";
|
|
9058
|
+
readonly description: "Run on this company's Outpost (company owners and admins)";
|
|
9059
|
+
readonly hidden: false;
|
|
9060
|
+
}, {
|
|
9061
|
+
readonly flags: "--outpost <name|id>";
|
|
9062
|
+
readonly description: "Which company Outpost, when the company has more than one";
|
|
9063
|
+
readonly hidden: false;
|
|
9044
9064
|
}, {
|
|
9045
9065
|
readonly flags: "--json";
|
|
9046
9066
|
readonly description: "Emit raw JSON";
|
|
@@ -9066,6 +9086,14 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
9066
9086
|
readonly flags: "--id <outpostId>";
|
|
9067
9087
|
readonly description: "Outpost id (defaults to your primary box)";
|
|
9068
9088
|
readonly hidden: false;
|
|
9089
|
+
}, {
|
|
9090
|
+
readonly flags: "--company <slug>";
|
|
9091
|
+
readonly description: "Run on this company's Outpost (company owners and admins)";
|
|
9092
|
+
readonly hidden: false;
|
|
9093
|
+
}, {
|
|
9094
|
+
readonly flags: "--outpost <name|id>";
|
|
9095
|
+
readonly description: "Which company Outpost, when the company has more than one";
|
|
9096
|
+
readonly hidden: false;
|
|
9069
9097
|
}, {
|
|
9070
9098
|
readonly flags: "--root";
|
|
9071
9099
|
readonly description: "Run the command as root (default: ec2-user)";
|
|
@@ -9098,6 +9126,14 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
9098
9126
|
readonly flags: "--id <outpostId>";
|
|
9099
9127
|
readonly description: "Outpost id (defaults to your primary box)";
|
|
9100
9128
|
readonly hidden: false;
|
|
9129
|
+
}, {
|
|
9130
|
+
readonly flags: "--company <slug>";
|
|
9131
|
+
readonly description: "Run on this company's Outpost (company owners and admins)";
|
|
9132
|
+
readonly hidden: false;
|
|
9133
|
+
}, {
|
|
9134
|
+
readonly flags: "--outpost <name|id>";
|
|
9135
|
+
readonly description: "Which company Outpost, when the company has more than one";
|
|
9136
|
+
readonly hidden: false;
|
|
9101
9137
|
}, {
|
|
9102
9138
|
readonly flags: "--wait";
|
|
9103
9139
|
readonly description: "Poll until the command reaches a terminal state";
|
|
@@ -9157,6 +9193,14 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
9157
9193
|
readonly flags: "--id <outpostId>";
|
|
9158
9194
|
readonly description: "Outpost id (defaults to your primary box)";
|
|
9159
9195
|
readonly hidden: false;
|
|
9196
|
+
}, {
|
|
9197
|
+
readonly flags: "--company <slug>";
|
|
9198
|
+
readonly description: "Run on this company's Outpost (company owners and admins)";
|
|
9199
|
+
readonly hidden: false;
|
|
9200
|
+
}, {
|
|
9201
|
+
readonly flags: "--outpost <name|id>";
|
|
9202
|
+
readonly description: "Which company Outpost, when the company has more than one";
|
|
9203
|
+
readonly hidden: false;
|
|
9160
9204
|
}, {
|
|
9161
9205
|
readonly flags: "--forward <port>";
|
|
9162
9206
|
readonly description: "Forward this port on the box to your machine instead of opening a shell";
|
|
@@ -18347,6 +18391,40 @@ export declare const COMMAND_CATALOG: readonly [{
|
|
|
18347
18391
|
readonly hidden: false;
|
|
18348
18392
|
}];
|
|
18349
18393
|
readonly subcommands: readonly [];
|
|
18394
|
+
}, {
|
|
18395
|
+
readonly name: "set-owner";
|
|
18396
|
+
readonly description: "Record which business owns a login and who holds it (labels only; no credential moves)";
|
|
18397
|
+
readonly aliases: readonly [];
|
|
18398
|
+
readonly hidden: false;
|
|
18399
|
+
readonly helpOption: true;
|
|
18400
|
+
readonly helpCommand: false;
|
|
18401
|
+
readonly usage: "[options] <provider> <account-id>";
|
|
18402
|
+
readonly helpText: readonly [];
|
|
18403
|
+
readonly arguments: readonly [{
|
|
18404
|
+
readonly name: "provider";
|
|
18405
|
+
readonly required: true;
|
|
18406
|
+
readonly variadic: false;
|
|
18407
|
+
readonly description: "claude | codex | grok";
|
|
18408
|
+
}, {
|
|
18409
|
+
readonly name: "account-id";
|
|
18410
|
+
readonly required: true;
|
|
18411
|
+
readonly variadic: false;
|
|
18412
|
+
readonly description: "Existing account id";
|
|
18413
|
+
}];
|
|
18414
|
+
readonly options: readonly [{
|
|
18415
|
+
readonly flags: "--owning-company <slug>";
|
|
18416
|
+
readonly description: "Company slug, personal, or unknown";
|
|
18417
|
+
readonly hidden: false;
|
|
18418
|
+
}, {
|
|
18419
|
+
readonly flags: "--holder <name>";
|
|
18420
|
+
readonly description: "owner, or the name of the person who holds the login";
|
|
18421
|
+
readonly hidden: false;
|
|
18422
|
+
}, {
|
|
18423
|
+
readonly flags: "--json";
|
|
18424
|
+
readonly description: "JSON on stdout (always)";
|
|
18425
|
+
readonly hidden: false;
|
|
18426
|
+
}];
|
|
18427
|
+
readonly subcommands: readonly [];
|
|
18350
18428
|
}, {
|
|
18351
18429
|
readonly name: "login";
|
|
18352
18430
|
readonly description: "Create a home, run the vendor login, and register the account";
|
|
@@ -1498,6 +1498,11 @@ export const COMMAND_CATALOG = [
|
|
|
1498
1498
|
"description": "Do not ask for confirmation",
|
|
1499
1499
|
"hidden": false
|
|
1500
1500
|
},
|
|
1501
|
+
{
|
|
1502
|
+
"flags": "--confirm-unproven",
|
|
1503
|
+
"description": "Restore an unreadable identity file and keep every upload held until you confirm which files are yours",
|
|
1504
|
+
"hidden": false
|
|
1505
|
+
},
|
|
1501
1506
|
{
|
|
1502
1507
|
"flags": "--json",
|
|
1503
1508
|
"description": "Print the result as JSON",
|
|
@@ -11000,6 +11005,16 @@ export const COMMAND_CATALOG = [
|
|
|
11000
11005
|
"description": "Outpost id (defaults to your primary box)",
|
|
11001
11006
|
"hidden": false
|
|
11002
11007
|
},
|
|
11008
|
+
{
|
|
11009
|
+
"flags": "--company <slug>",
|
|
11010
|
+
"description": "Run on this company's Outpost (company owners and admins)",
|
|
11011
|
+
"hidden": false
|
|
11012
|
+
},
|
|
11013
|
+
{
|
|
11014
|
+
"flags": "--outpost <name|id>",
|
|
11015
|
+
"description": "Which company Outpost, when the company has more than one",
|
|
11016
|
+
"hidden": false
|
|
11017
|
+
},
|
|
11003
11018
|
{
|
|
11004
11019
|
"flags": "--root",
|
|
11005
11020
|
"description": "Run the command as root (default: ec2-user)",
|
|
@@ -11054,6 +11069,16 @@ export const COMMAND_CATALOG = [
|
|
|
11054
11069
|
"description": "Outpost id (defaults to your primary box)",
|
|
11055
11070
|
"hidden": false
|
|
11056
11071
|
},
|
|
11072
|
+
{
|
|
11073
|
+
"flags": "--company <slug>",
|
|
11074
|
+
"description": "Run on this company's Outpost (company owners and admins)",
|
|
11075
|
+
"hidden": false
|
|
11076
|
+
},
|
|
11077
|
+
{
|
|
11078
|
+
"flags": "--outpost <name|id>",
|
|
11079
|
+
"description": "Which company Outpost, when the company has more than one",
|
|
11080
|
+
"hidden": false
|
|
11081
|
+
},
|
|
11057
11082
|
{
|
|
11058
11083
|
"flags": "--json",
|
|
11059
11084
|
"description": "Emit raw JSON",
|
|
@@ -11085,6 +11110,16 @@ export const COMMAND_CATALOG = [
|
|
|
11085
11110
|
"description": "Outpost id (defaults to your primary box)",
|
|
11086
11111
|
"hidden": false
|
|
11087
11112
|
},
|
|
11113
|
+
{
|
|
11114
|
+
"flags": "--company <slug>",
|
|
11115
|
+
"description": "Run on this company's Outpost (company owners and admins)",
|
|
11116
|
+
"hidden": false
|
|
11117
|
+
},
|
|
11118
|
+
{
|
|
11119
|
+
"flags": "--outpost <name|id>",
|
|
11120
|
+
"description": "Which company Outpost, when the company has more than one",
|
|
11121
|
+
"hidden": false
|
|
11122
|
+
},
|
|
11088
11123
|
{
|
|
11089
11124
|
"flags": "--root",
|
|
11090
11125
|
"description": "Run the command as root (default: ec2-user)",
|
|
@@ -11124,6 +11159,16 @@ export const COMMAND_CATALOG = [
|
|
|
11124
11159
|
"description": "Outpost id (defaults to your primary box)",
|
|
11125
11160
|
"hidden": false
|
|
11126
11161
|
},
|
|
11162
|
+
{
|
|
11163
|
+
"flags": "--company <slug>",
|
|
11164
|
+
"description": "Run on this company's Outpost (company owners and admins)",
|
|
11165
|
+
"hidden": false
|
|
11166
|
+
},
|
|
11167
|
+
{
|
|
11168
|
+
"flags": "--outpost <name|id>",
|
|
11169
|
+
"description": "Which company Outpost, when the company has more than one",
|
|
11170
|
+
"hidden": false
|
|
11171
|
+
},
|
|
11127
11172
|
{
|
|
11128
11173
|
"flags": "--wait",
|
|
11129
11174
|
"description": "Poll until the command reaches a terminal state",
|
|
@@ -11196,6 +11241,16 @@ export const COMMAND_CATALOG = [
|
|
|
11196
11241
|
"description": "Outpost id (defaults to your primary box)",
|
|
11197
11242
|
"hidden": false
|
|
11198
11243
|
},
|
|
11244
|
+
{
|
|
11245
|
+
"flags": "--company <slug>",
|
|
11246
|
+
"description": "Run on this company's Outpost (company owners and admins)",
|
|
11247
|
+
"hidden": false
|
|
11248
|
+
},
|
|
11249
|
+
{
|
|
11250
|
+
"flags": "--outpost <name|id>",
|
|
11251
|
+
"description": "Which company Outpost, when the company has more than one",
|
|
11252
|
+
"hidden": false
|
|
11253
|
+
},
|
|
11199
11254
|
{
|
|
11200
11255
|
"flags": "--forward <port>",
|
|
11201
11256
|
"description": "Forward this port on the box to your machine instead of opening a shell",
|
|
@@ -22401,6 +22456,48 @@ export const COMMAND_CATALOG = [
|
|
|
22401
22456
|
],
|
|
22402
22457
|
"subcommands": []
|
|
22403
22458
|
},
|
|
22459
|
+
{
|
|
22460
|
+
"name": "set-owner",
|
|
22461
|
+
"description": "Record which business owns a login and who holds it (labels only; no credential moves)",
|
|
22462
|
+
"aliases": [],
|
|
22463
|
+
"hidden": false,
|
|
22464
|
+
"helpOption": true,
|
|
22465
|
+
"helpCommand": false,
|
|
22466
|
+
"usage": "[options] <provider> <account-id>",
|
|
22467
|
+
"helpText": [],
|
|
22468
|
+
"arguments": [
|
|
22469
|
+
{
|
|
22470
|
+
"name": "provider",
|
|
22471
|
+
"required": true,
|
|
22472
|
+
"variadic": false,
|
|
22473
|
+
"description": "claude | codex | grok"
|
|
22474
|
+
},
|
|
22475
|
+
{
|
|
22476
|
+
"name": "account-id",
|
|
22477
|
+
"required": true,
|
|
22478
|
+
"variadic": false,
|
|
22479
|
+
"description": "Existing account id"
|
|
22480
|
+
}
|
|
22481
|
+
],
|
|
22482
|
+
"options": [
|
|
22483
|
+
{
|
|
22484
|
+
"flags": "--owning-company <slug>",
|
|
22485
|
+
"description": "Company slug, personal, or unknown",
|
|
22486
|
+
"hidden": false
|
|
22487
|
+
},
|
|
22488
|
+
{
|
|
22489
|
+
"flags": "--holder <name>",
|
|
22490
|
+
"description": "owner, or the name of the person who holds the login",
|
|
22491
|
+
"hidden": false
|
|
22492
|
+
},
|
|
22493
|
+
{
|
|
22494
|
+
"flags": "--json",
|
|
22495
|
+
"description": "JSON on stdout (always)",
|
|
22496
|
+
"hidden": false
|
|
22497
|
+
}
|
|
22498
|
+
],
|
|
22499
|
+
"subcommands": []
|
|
22500
|
+
},
|
|
22404
22501
|
{
|
|
22405
22502
|
"name": "login",
|
|
22406
22503
|
"description": "Create a home, run the vendor login, and register the account",
|
package/dist/commands/daemon.js
CHANGED
|
@@ -498,7 +498,7 @@ function formatUnit(u) {
|
|
|
498
498
|
const detail = u.status === "running" && u.pid
|
|
499
499
|
? `pid ${u.pid}`
|
|
500
500
|
: u.status === "idle" && u.lastResult
|
|
501
|
-
? `last run ${u.lastResult}`
|
|
501
|
+
? `last run ${u.lastResult}${u.lastResult === "failed" && u.lastError ? `: ${u.lastError}` : ""}`
|
|
502
502
|
: (u.reason ?? "");
|
|
503
503
|
const restarts = u.restarts > 0 ? ` (restarted ${u.restarts}x)` : "";
|
|
504
504
|
return ` ${u.id.padEnd(40)} ${u.status.padEnd(12)} ${detail}${restarts}`;
|
|
@@ -442,6 +442,17 @@ function printDnsRecords(records) {
|
|
|
442
442
|
console.log(` ${displayText(record.type)} ${displayText(record.name)} -> ${displayText(record.value)}`);
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* True when hq-deploy writes the DNS records itself: the domain was bought
|
|
447
|
+
* through HQ by this company and its Route 53 zone is HQ's. An older server
|
|
448
|
+
* sends no field, which reads as false.
|
|
449
|
+
*/
|
|
450
|
+
function isDnsManaged(body) {
|
|
451
|
+
return body.dnsManaged === true;
|
|
452
|
+
}
|
|
453
|
+
function managedDnsLine(domain) {
|
|
454
|
+
return `HQ manages DNS for ${displayText(domain)}. No records to add.`;
|
|
455
|
+
}
|
|
445
456
|
function dnsRecords(value) {
|
|
446
457
|
if (!Array.isArray(value))
|
|
447
458
|
return [];
|
|
@@ -525,6 +536,7 @@ async function listAction(options) {
|
|
|
525
536
|
displayText(domain.domain),
|
|
526
537
|
displayText(domain.environment ?? "production"),
|
|
527
538
|
displayText(domain.validationState ?? "unknown"),
|
|
539
|
+
...(isDnsManaged(domain) ? ["DNS managed by HQ"] : []),
|
|
528
540
|
].join(" | "));
|
|
529
541
|
}
|
|
530
542
|
}
|
|
@@ -541,6 +553,7 @@ async function addAction(domainArg, options) {
|
|
|
541
553
|
throw await deployError(response, target.orgSlug);
|
|
542
554
|
const body = await readBody(response);
|
|
543
555
|
const records = dnsRecords(body.dnsInstructions);
|
|
556
|
+
const dnsManaged = isDnsManaged(body);
|
|
544
557
|
const apex = body.apex === true;
|
|
545
558
|
const apexGuidance = typeof body.apexGuidance === "string" ? body.apexGuidance : undefined;
|
|
546
559
|
const paid = body.billingBasis === "paid";
|
|
@@ -553,6 +566,7 @@ async function addAction(domainArg, options) {
|
|
|
553
566
|
environment,
|
|
554
567
|
validationState: body.domain?.validationState ?? "pending",
|
|
555
568
|
serving: body.serving === true,
|
|
569
|
+
dnsManaged,
|
|
556
570
|
dnsInstructions: records,
|
|
557
571
|
apex,
|
|
558
572
|
...(apexGuidance ? { apexGuidance } : {}),
|
|
@@ -564,6 +578,11 @@ async function addAction(domainArg, options) {
|
|
|
564
578
|
console.log(`Added ${displayText(domain)} to ${displayText(environment)}. It is not live yet.`);
|
|
565
579
|
if (priceLine)
|
|
566
580
|
console.log(priceLine);
|
|
581
|
+
if (dnsManaged) {
|
|
582
|
+
console.log(managedDnsLine(domain));
|
|
583
|
+
console.log(`To check when it is live, run: hq deploy domains refresh ${displayText(domain)}`);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
567
586
|
printDnsRecords(records);
|
|
568
587
|
if (apex) {
|
|
569
588
|
console.log(apexGuidance
|
|
@@ -582,10 +601,11 @@ async function refreshAction(domainArg, options) {
|
|
|
582
601
|
const body = await readBody(response);
|
|
583
602
|
const serving = body.serving === true;
|
|
584
603
|
const records = dnsRecords(body.dnsInstructions);
|
|
604
|
+
const dnsManaged = isDnsManaged(body);
|
|
585
605
|
if (!serving)
|
|
586
606
|
process.exitCode = REFRESH_NOT_SERVING_EXIT_CODE;
|
|
587
607
|
if (options.json) {
|
|
588
|
-
console.log(safeJson({ ok: true, appId: target.appId, ...body, domain, serving, dnsInstructions: records }));
|
|
608
|
+
console.log(safeJson({ ok: true, appId: target.appId, ...body, domain, serving, dnsManaged, dnsInstructions: records }));
|
|
589
609
|
return;
|
|
590
610
|
}
|
|
591
611
|
if (serving) {
|
|
@@ -594,6 +614,11 @@ async function refreshAction(domainArg, options) {
|
|
|
594
614
|
}
|
|
595
615
|
const certStatus = typeof body.certStatus === "string" ? ` (certificate ${displayText(body.certStatus)})` : "";
|
|
596
616
|
console.log(`${displayText(domain)} is waiting for DNS validation${certStatus}.`);
|
|
617
|
+
if (dnsManaged) {
|
|
618
|
+
console.log(managedDnsLine(domain));
|
|
619
|
+
console.log(`Run this again to check: hq deploy domains refresh ${displayText(domain)}`);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
597
622
|
printDnsRecords(records);
|
|
598
623
|
if (body.apex === true && typeof body.apexGuidance === "string")
|
|
599
624
|
console.log(displayText(body.apexGuidance));
|
|
@@ -718,6 +743,7 @@ function baseState(body) {
|
|
|
718
743
|
servingStatus,
|
|
719
744
|
servingError: typeof serving.error === "string" && serving.error ? serving.error : null,
|
|
720
745
|
records: dnsRecords(body.records),
|
|
746
|
+
dnsManaged: isDnsManaged(body),
|
|
721
747
|
live: status === "live" || servingStatus === "live",
|
|
722
748
|
raw: body,
|
|
723
749
|
};
|
|
@@ -750,6 +776,7 @@ async function baseAddAction(domainArg, options) {
|
|
|
750
776
|
baseDomain: state.baseDomain ?? domain,
|
|
751
777
|
status: state.status,
|
|
752
778
|
certificate: state.certStatus,
|
|
779
|
+
dnsManaged: state.dnsManaged,
|
|
753
780
|
records: state.records,
|
|
754
781
|
...(typeof body.billingBasis === "string" ? { billingBasis: body.billingBasis } : {}),
|
|
755
782
|
...(typeof body.monthlyPriceUsd === "number" ? { monthlyPriceUsd: body.monthlyPriceUsd } : {}),
|
|
@@ -760,6 +787,11 @@ async function baseAddAction(domainArg, options) {
|
|
|
760
787
|
console.log(`${displayText(domain)} is now the deploy domain of '${orgSlug}'. It is not live yet.`);
|
|
761
788
|
if (priceLine)
|
|
762
789
|
console.log(priceLine);
|
|
790
|
+
if (state.dnsManaged) {
|
|
791
|
+
console.log(managedDnsLine(state.baseDomain ?? domain));
|
|
792
|
+
console.log("To wait until it is live, run: hq deploy domains base status --wait");
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
763
795
|
printDnsRecords(state.records);
|
|
764
796
|
if (state.records.length < 2) {
|
|
765
797
|
console.log("The certificate's validation record can take a few seconds to appear; 'hq deploy domains base status' prints it.");
|
|
@@ -805,6 +837,7 @@ async function baseStatusAction(options) {
|
|
|
805
837
|
certificate: state.certStatus,
|
|
806
838
|
serving: state.servingStatus,
|
|
807
839
|
...(state.servingError ? { servingError: state.servingError } : {}),
|
|
840
|
+
dnsManaged: state.dnsManaged,
|
|
808
841
|
records: state.live ? [] : state.records,
|
|
809
842
|
attempts,
|
|
810
843
|
...(timedOut ? { timedOut: true } : {}),
|
|
@@ -821,7 +854,10 @@ async function baseStatusAction(options) {
|
|
|
821
854
|
return;
|
|
822
855
|
}
|
|
823
856
|
console.log(`${name} is not live yet: ${describeBaseState(state)}.`);
|
|
824
|
-
|
|
857
|
+
if (state.dnsManaged)
|
|
858
|
+
console.log(managedDnsLine(state.baseDomain ?? "the company deploy domain"));
|
|
859
|
+
else
|
|
860
|
+
printDnsRecords(state.records);
|
|
825
861
|
console.log(timedOut
|
|
826
862
|
? `Stopped waiting after ${minutes} minutes. Run 'hq deploy domains base status --wait' again to keep waiting.`
|
|
827
863
|
: "Run 'hq deploy domains base status --wait' to wait until it is live.");
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { type AccountConfig, type LaneProvider } from "../lib/lanes/index.js";
|
|
1
2
|
import type { Ctx, LaneAccountsHandlerDeps } from "./lanes-shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* PS-006 set-owner warnings. The change is still saved; these only flag the
|
|
5
|
+
* likely mistake of recording the owner's own login under his name instead
|
|
6
|
+
* of `owner`, which takes that login away from every lane.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setOwnerWarnings(env: NodeJS.ProcessEnv, provider: LaneProvider, id: string, holder: string | undefined, accounts: Record<string, AccountConfig>): Array<{
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}>;
|
|
2
12
|
export declare function createLaneAccountsHandlers(deps: LaneAccountsHandlerDeps): {
|
|
3
13
|
runAccountsList: (ctx: Ctx, opts: {
|
|
4
14
|
provider?: string;
|
|
@@ -18,6 +28,10 @@ export declare function createLaneAccountsHandlers(deps: LaneAccountsHandlerDeps
|
|
|
18
28
|
host?: string;
|
|
19
29
|
company?: string;
|
|
20
30
|
}) => Promise<void>;
|
|
31
|
+
runAccountsSetOwner: (ctx: Ctx, providerRaw: string, accountIdRaw: string, opts: {
|
|
32
|
+
owningCompany?: string;
|
|
33
|
+
holder?: string;
|
|
34
|
+
}) => Promise<void>;
|
|
21
35
|
runAccountsClearQuota: (ctx: Ctx, providerRaw: string, accountIdRaw: string, opts: {
|
|
22
36
|
model?: string;
|
|
23
37
|
}) => Promise<void>;
|
|
@@ -4,6 +4,7 @@ import { buildOutpostBalanceMoveCommand, dispatchErrorMessage } from "../lib/lan
|
|
|
4
4
|
import { BALANCE_MOVABLE_STATES, accountLoadsForReport, planClaudeBalanceMoves, selectClaudeAccount } from "../lib/lanes/claude-balance.js";
|
|
5
5
|
import { CompanySelectionError } from "../utils/company-selection-error.js";
|
|
6
6
|
import { effectiveAccountHome } from "../lib/lanes/account-home.js";
|
|
7
|
+
import { accountHeldByOther, accountOwnership, heldByOwner, holderProblem, normalizeHolder, normalizeOwningCompany, owningCompanyProblem, ownershipWarning, setOwnerCommand } from "../lib/lanes/account-ownership.js";
|
|
7
8
|
import { AccountResolutionError, DEFAULT_ACCOUNT_HOMES, LANE_PROVIDERS, accountStatus, canonicalizeHome, claudeIdentityDiffers, installDrainHook, isLanesError, listAccountStatuses, loadLanesConfig, parseLaneProvider, probeInteractiveClaudeIdentity, readLane, withProviderHomeEnv, writeLanesConfig } from "../lib/lanes/index.js";
|
|
8
9
|
import { assertUniqueAccountHomes, providerCompactAfterMs } from "../lib/lanes/config.js";
|
|
9
10
|
import { resolveLaneEffort } from "../lib/lanes/effort.js";
|
|
@@ -14,6 +15,33 @@ import { accountQuotaView, clearAccountQuota, loadQuotaState } from "../lib/lane
|
|
|
14
15
|
import { resolveLaneModel } from "../lib/lanes/spawn.js";
|
|
15
16
|
import { leadLaneIds } from "../lib/lanes/admission.js";
|
|
16
17
|
import { resolveLaneCompany } from "../lib/lanes/lane-company.js";
|
|
18
|
+
/**
|
|
19
|
+
* PS-006 set-owner warnings. The change is still saved; these only flag the
|
|
20
|
+
* likely mistake of recording the owner's own login under his name instead
|
|
21
|
+
* of `owner`, which takes that login away from every lane.
|
|
22
|
+
*/
|
|
23
|
+
export function setOwnerWarnings(env, provider, id, holder, accounts) {
|
|
24
|
+
const warnings = [];
|
|
25
|
+
if (holder === undefined || !accountHeldByOther(accounts[id]))
|
|
26
|
+
return warnings;
|
|
27
|
+
const usable = Object.values(accounts).filter((account) => account.enabled && !accountHeldByOther(account));
|
|
28
|
+
if (usable.length === 0) {
|
|
29
|
+
warnings.push({
|
|
30
|
+
code: "no_usable_login",
|
|
31
|
+
message: "No enabled " + provider + " login is usable by lanes now. If " + id + " is really your own login, record it with: hq lanes accounts set-owner " + provider + " " + id + " --holder owner",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const localNames = [env.USER, env.LOGNAME, env.USERNAME]
|
|
35
|
+
.filter((name) => typeof name === "string" && name.trim() !== "")
|
|
36
|
+
.map((name) => name.trim().toLowerCase());
|
|
37
|
+
if (localNames.some((name) => name === holder.toLowerCase())) {
|
|
38
|
+
warnings.push({
|
|
39
|
+
code: "holder_matches_local_user",
|
|
40
|
+
message: "Holder " + JSON.stringify(holder) + " matches this machine's user name. If " + id + " is your own login, use --holder owner; a named holder keeps lanes off it.",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return warnings;
|
|
44
|
+
}
|
|
17
45
|
export function createLaneAccountsHandlers(deps) {
|
|
18
46
|
const { admitQueuedFromCtx, automaticBalanceMoveHistoryReason, ensureDir, laneWithRecoveredProviderSession, loadClaudeBalanceHostSnapshots, parseRemoteJson, prepareAccountMove, printJson, reconcileHostFromCtx, resolveCallerPath } = deps;
|
|
19
47
|
const VENDOR_LOGIN = {
|
|
@@ -166,8 +194,20 @@ export function createLaneAccountsHandlers(deps) {
|
|
|
166
194
|
effective_effort: effort.effort ?? null,
|
|
167
195
|
effective_effort_source: effort.source,
|
|
168
196
|
...accountQuotaView(quota, provider, status.id),
|
|
197
|
+
// PS-006: who owns and who holds this login. Added fields only.
|
|
198
|
+
...ownershipView(provider, status.id, accountCfg),
|
|
169
199
|
};
|
|
170
200
|
}));
|
|
201
|
+
const ownershipWarnings = providers.flatMap((provider) => Object.entries(config.providers[provider].accounts).flatMap(([id, account]) => {
|
|
202
|
+
const warning = ownershipWarning(provider, id, account);
|
|
203
|
+
return warning === undefined ? [] : [{ provider, account: id, ...warning }];
|
|
204
|
+
}));
|
|
205
|
+
// One summary line, not one per account; the JSON keeps the full list.
|
|
206
|
+
if (ownershipWarnings.length > 0) {
|
|
207
|
+
const names = ownershipWarnings.map((warning) => warning.provider + "/" + warning.account).join(", ");
|
|
208
|
+
process.stderr.write("warning: " + ownershipWarnings.length + " enabled account(s) have no owning_company or holder recorded: " + names +
|
|
209
|
+
". Record them with: hq lanes accounts set-owner <provider> <account-id> --owning-company <slug|personal|unknown> --holder <owner|name>\n");
|
|
210
|
+
}
|
|
171
211
|
const providerDefaults = providers.map((provider) => ({
|
|
172
212
|
provider,
|
|
173
213
|
model: config.providers[provider].model ?? null,
|
|
@@ -180,6 +220,84 @@ export function createLaneAccountsHandlers(deps) {
|
|
|
180
220
|
providers: providerDefaults,
|
|
181
221
|
...(providers.includes("claude") ? { interactive_identity: interactiveIdentity } : {}),
|
|
182
222
|
accounts,
|
|
223
|
+
ownership_warnings: ownershipWarnings,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function ownershipView(provider, id, account) {
|
|
227
|
+
const ownership = accountOwnership(account);
|
|
228
|
+
const warning = ownershipWarning(provider, id, account);
|
|
229
|
+
return {
|
|
230
|
+
owning_company: ownership.owning_company,
|
|
231
|
+
owning_company_source: ownership.owning_company_source,
|
|
232
|
+
holder: ownership.holder,
|
|
233
|
+
holder_source: ownership.holder_source,
|
|
234
|
+
// null when no holder is recorded; never true by default.
|
|
235
|
+
held_by_owner: heldByOwner(account),
|
|
236
|
+
ownership_missing: ownership.ownership_missing,
|
|
237
|
+
...(warning !== undefined
|
|
238
|
+
? { ownership_warning: warning.message, ownership_fix_command: warning.fix_command }
|
|
239
|
+
: {}),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Record who owns and who holds a login (PS-006). Only these two labels are
|
|
244
|
+
* written: no credential, home or vault file is read or moved.
|
|
245
|
+
*/
|
|
246
|
+
async function runAccountsSetOwner(ctx, providerRaw, accountIdRaw, opts) {
|
|
247
|
+
const provider = parseLaneProvider(providerRaw);
|
|
248
|
+
const id = accountIdRaw.trim();
|
|
249
|
+
const owningCompany = opts.owningCompany === undefined ? undefined : normalizeOwningCompany(opts.owningCompany);
|
|
250
|
+
const holder = opts.holder === undefined ? undefined : normalizeHolder(opts.holder);
|
|
251
|
+
if (owningCompany === undefined && holder === undefined) {
|
|
252
|
+
throw new LanesError("ownership_value_required", "Pass --owning-company, --holder, or both", {
|
|
253
|
+
provider,
|
|
254
|
+
account: id,
|
|
255
|
+
usage: setOwnerCommand(provider, id || "<account-id>"),
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (owningCompany !== undefined) {
|
|
259
|
+
const problem = owningCompanyProblem(owningCompany);
|
|
260
|
+
if (problem !== null) {
|
|
261
|
+
throw new LanesError("invalid_owning_company", `--owning-company ${problem}`, { provider, account: id, value: opts.owningCompany });
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (holder !== undefined) {
|
|
265
|
+
const problem = holderProblem(holder);
|
|
266
|
+
if (problem !== null) {
|
|
267
|
+
throw new LanesError("invalid_holder", `--holder ${problem}`, { provider, account: id, value: opts.holder });
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const hqRoot = ctx.hqRoot();
|
|
271
|
+
const config = loadLanesConfig(hqRoot);
|
|
272
|
+
const account = config.providers[provider].accounts[id];
|
|
273
|
+
if (account === undefined) {
|
|
274
|
+
throw new AccountResolutionError("unknown_account", `Unknown account ${JSON.stringify(id)} for ${provider}`, {
|
|
275
|
+
provider,
|
|
276
|
+
account: id,
|
|
277
|
+
enabled: Object.entries(config.providers[provider].accounts)
|
|
278
|
+
.filter(([, a]) => a.enabled)
|
|
279
|
+
.map(([key]) => key),
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const before = { owning_company: account.owning_company ?? null, holder: account.holder ?? null };
|
|
283
|
+
if (owningCompany !== undefined)
|
|
284
|
+
account.owning_company = owningCompany;
|
|
285
|
+
if (holder !== undefined)
|
|
286
|
+
account.holder = holder;
|
|
287
|
+
writeLanesConfig(hqRoot, config);
|
|
288
|
+
const savedConfig = loadLanesConfig(hqRoot);
|
|
289
|
+
const saved = savedConfig.providers[provider].accounts[id];
|
|
290
|
+
const warnings = setOwnerWarnings(ctx.env, provider, id, holder, savedConfig.providers[provider].accounts);
|
|
291
|
+
for (const warning of warnings)
|
|
292
|
+
process.stderr.write("warning: " + warning.message + "\n");
|
|
293
|
+
printJson({
|
|
294
|
+
ok: true,
|
|
295
|
+
action: "accounts.set-owner",
|
|
296
|
+
provider,
|
|
297
|
+
account: id,
|
|
298
|
+
before,
|
|
299
|
+
...ownershipView(provider, id, saved),
|
|
300
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
183
301
|
});
|
|
184
302
|
}
|
|
185
303
|
async function runAccountsBalance(ctx, opts) {
|
|
@@ -637,6 +755,7 @@ export function createLaneAccountsHandlers(deps) {
|
|
|
637
755
|
runAccountsBalance,
|
|
638
756
|
runAccountsLogin,
|
|
639
757
|
runAccountsSetHome,
|
|
758
|
+
runAccountsSetOwner,
|
|
640
759
|
runAccountsClearQuota,
|
|
641
760
|
runAccountsEnable,
|
|
642
761
|
runAccountsDisable
|