@indigoai-us/hq-cli 5.123.2 → 5.125.0

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/command-catalog.generated.d.ts +111 -1
  3. package/dist/command-catalog.generated.js +144 -1
  4. package/dist/commands/billing-sponsor.d.ts +83 -0
  5. package/dist/commands/billing-sponsor.js +344 -0
  6. package/dist/commands/billing.d.ts +3 -0
  7. package/dist/commands/billing.js +5 -0
  8. package/dist/commands/login.js +49 -6
  9. package/dist/commands/mesh.js +96 -19
  10. package/dist/lib/doctor/checks/work-context.js +4 -2
  11. package/dist/lib/mesh/live/backfill-held.d.ts +2 -0
  12. package/dist/lib/mesh/live/backfill-held.js +8 -4
  13. package/dist/lib/mesh/live/daemon/board-refresh.d.ts +3 -0
  14. package/dist/lib/mesh/live/daemon/board-refresh.js +6 -0
  15. package/dist/lib/mesh/live/daemon/doctor.d.ts +3 -0
  16. package/dist/lib/mesh/live/daemon/doctor.js +21 -1
  17. package/dist/lib/mesh/live/daemon/run.d.ts +11 -0
  18. package/dist/lib/mesh/live/daemon/run.js +129 -10
  19. package/dist/lib/mesh/live/daemon/state.d.ts +2 -0
  20. package/dist/lib/mesh/live/flush.d.ts +3 -0
  21. package/dist/lib/mesh/live/flush.js +11 -0
  22. package/dist/lib/work-context/company.d.ts +8 -0
  23. package/dist/lib/work-context/company.js +62 -18
  24. package/dist/lib/work-context/config.d.ts +35 -0
  25. package/dist/lib/work-context/config.js +307 -62
  26. package/dist/lib/work-context/contract.d.ts +2 -0
  27. package/dist/lib/work-context/default-company.d.ts +43 -0
  28. package/dist/lib/work-context/default-company.js +83 -0
  29. package/dist/lib/work-context/outbox.d.ts +5 -1
  30. package/dist/lib/work-context/outbox.js +5 -0
  31. package/dist/lib/work-context/reconcile.d.ts +4 -0
  32. package/dist/lib/work-context/reconcile.js +59 -3
  33. package/dist/lib/work-context/state.d.ts +2 -0
  34. package/dist/lib/work-context/state.js +14 -0
  35. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,53 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.125.0] — 2026-09-20
6
+
7
+ ### Fixed
8
+
9
+ - Work Mesh now preserves an acknowledged company binding through later
10
+ company-less hook writes, preventing repeated registrations and held events.
11
+ Held recovery accepts only durable registrations, canonical metadata under a
12
+ verified HQ root, or manifest-backed repository ownership; conflicting or
13
+ event-only hints stay unresolved. Its batch cursor rotates across restarts.
14
+ Both legacy and direct-mode daemons detect an upgraded CLI, and systemd units
15
+ use `Restart=always` so the installed service reloads the new code.
16
+
17
+ - Held-session recovery now accepts session metadata only from the daemon's
18
+ configured HQ root, requires current-session evidence before restoring an
19
+ acknowledged registration, and retains batch position when held records are
20
+ compacted. Repeated hook activity no longer re-registers an unchanged binding.
21
+ CLI updates report installed system units that need their host service manager
22
+ to restart them. Daemon installs persist verified HQ-root allowlists, inject
23
+ the primary root into service environments, and rewrite/reload existing user
24
+ units so upgraded daemons restart reliably.
25
+
26
+ ### Added
27
+
28
+ - Work Mesh now activates a device default company automatically when a signed-in
29
+ person has exactly one active membership. Devices with several memberships ask
30
+ for a choice in interactive CLI paths and show the stored state in `hq mesh
31
+ context default get --json`. Clearing the default is a durable opt-out until
32
+ the person explicitly sets one again. Historical held sessions remain unchanged
33
+ unless `hq mesh context backfill-held --use-device-default` is supplied; those
34
+ repaired records are labeled lower-confidence and counted by daemon doctor.
35
+
36
+ ## [5.124.0] — 2026-09-20
37
+
38
+ ### Added
39
+
40
+ - `hq billing sponsor` — ask a company to cover your $50/mo HQ Individual plan
41
+ from the terminal, and answer those requests if you run the company.
42
+ `request <company>` asks, `list` shows the queue you can answer or — if you
43
+ are not an admin there — your own single status for that company, and
44
+ `approve` / `decline` / `revoke` / `withdraw` resolve one. Pass `--company`
45
+ to `list` when you are asking about your own state.
46
+
47
+ Approving does not always finish the job: if the company has no card on file,
48
+ HQ accepts the yes but nothing is covered yet, and `approve` says so with the
49
+ link to add one. This is off until HQ turns it on; until then the commands
50
+ say it is not available yet rather than failing with a validation error.
51
+
5
52
  ## [5.123.2] — 2026-09-19
6
53
 
7
54
  ### Fixed
@@ -4850,6 +4850,110 @@ export declare const COMMAND_CATALOG: readonly [{
4850
4850
  readonly description: "Emit the Checkout URL as JSON";
4851
4851
  }];
4852
4852
  readonly subcommands: readonly [];
4853
+ }, {
4854
+ readonly name: "sponsor";
4855
+ readonly description: "Ask a company to cover your $50 plan, or answer a request";
4856
+ readonly aliases: readonly [];
4857
+ readonly hidden: false;
4858
+ readonly usage: "[options] [command]";
4859
+ readonly arguments: readonly [];
4860
+ readonly options: readonly [];
4861
+ readonly subcommands: readonly [{
4862
+ readonly name: "request";
4863
+ readonly description: "Ask a company to cover your $50 HQ plan";
4864
+ readonly aliases: readonly [];
4865
+ readonly hidden: false;
4866
+ readonly usage: "[options] <company>";
4867
+ readonly arguments: readonly [{
4868
+ readonly name: "company";
4869
+ readonly required: true;
4870
+ readonly variadic: false;
4871
+ }];
4872
+ readonly options: readonly [{
4873
+ readonly flags: "--json";
4874
+ readonly description: "Emit raw JSON";
4875
+ }];
4876
+ readonly subcommands: readonly [];
4877
+ }, {
4878
+ readonly name: "list";
4879
+ readonly description: "Show sponsorship requests — the company's queue, or your own";
4880
+ readonly aliases: readonly [];
4881
+ readonly hidden: false;
4882
+ readonly usage: "[options]";
4883
+ readonly arguments: readonly [];
4884
+ readonly options: readonly [{
4885
+ readonly flags: "--company <slug>";
4886
+ readonly description: "Company slug (resolves to companyUid)";
4887
+ }, {
4888
+ readonly flags: "--json";
4889
+ readonly description: "Emit raw JSON";
4890
+ }];
4891
+ readonly subcommands: readonly [];
4892
+ }, {
4893
+ readonly name: "approve";
4894
+ readonly description: "Say yes — put someone's $50 plan on the company bill";
4895
+ readonly aliases: readonly [];
4896
+ readonly hidden: false;
4897
+ readonly usage: "[options] <id>";
4898
+ readonly arguments: readonly [{
4899
+ readonly name: "id";
4900
+ readonly required: true;
4901
+ readonly variadic: false;
4902
+ }];
4903
+ readonly options: readonly [{
4904
+ readonly flags: "--json";
4905
+ readonly description: "Emit raw JSON";
4906
+ }];
4907
+ readonly subcommands: readonly [];
4908
+ }, {
4909
+ readonly name: "decline";
4910
+ readonly description: "Say no to a plan sponsorship request";
4911
+ readonly aliases: readonly [];
4912
+ readonly hidden: false;
4913
+ readonly usage: "[options] <id>";
4914
+ readonly arguments: readonly [{
4915
+ readonly name: "id";
4916
+ readonly required: true;
4917
+ readonly variadic: false;
4918
+ }];
4919
+ readonly options: readonly [{
4920
+ readonly flags: "--json";
4921
+ readonly description: "Emit raw JSON";
4922
+ }];
4923
+ readonly subcommands: readonly [];
4924
+ }, {
4925
+ readonly name: "revoke";
4926
+ readonly description: "End a sponsorship the company is currently paying for";
4927
+ readonly aliases: readonly [];
4928
+ readonly hidden: false;
4929
+ readonly usage: "[options] <id>";
4930
+ readonly arguments: readonly [{
4931
+ readonly name: "id";
4932
+ readonly required: true;
4933
+ readonly variadic: false;
4934
+ }];
4935
+ readonly options: readonly [{
4936
+ readonly flags: "--json";
4937
+ readonly description: "Emit raw JSON";
4938
+ }];
4939
+ readonly subcommands: readonly [];
4940
+ }, {
4941
+ readonly name: "withdraw";
4942
+ readonly description: "Take back a sponsorship request you made";
4943
+ readonly aliases: readonly [];
4944
+ readonly hidden: false;
4945
+ readonly usage: "[options] <id>";
4946
+ readonly arguments: readonly [{
4947
+ readonly name: "id";
4948
+ readonly required: true;
4949
+ readonly variadic: false;
4950
+ }];
4951
+ readonly options: readonly [{
4952
+ readonly flags: "--json";
4953
+ readonly description: "Emit raw JSON";
4954
+ }];
4955
+ readonly subcommands: readonly [];
4956
+ }];
4853
4957
  }];
4854
4958
  }, {
4855
4959
  readonly name: "core";
@@ -5625,7 +5729,10 @@ export declare const COMMAND_CATALOG: readonly [{
5625
5729
  readonly description: "Cap sessions processed (default 0 = no cap)";
5626
5730
  }, {
5627
5731
  readonly flags: "--company <slug>";
5628
- readonly description: "Optional non-forcing company hint (resolver default still wins)";
5732
+ readonly description: "Optional non-forcing company hint";
5733
+ }, {
5734
+ readonly flags: "--use-device-default";
5735
+ readonly description: "Opt in to historical repair using the device default (lower-confidence attribution)";
5629
5736
  }, {
5630
5737
  readonly flags: "--json";
5631
5738
  readonly description: "Print machine-readable JSON";
@@ -5765,6 +5872,9 @@ export declare const COMMAND_CATALOG: readonly [{
5765
5872
  readonly options: readonly [{
5766
5873
  readonly flags: "--allow-without-migration";
5767
5874
  readonly description: "Deprecated compatibility no-op; selected-company membership is always verified";
5875
+ }, {
5876
+ readonly flags: "--repair-held-with-default";
5877
+ readonly description: "Persist opt-in for lower-confidence historical held-session repair";
5768
5878
  }, {
5769
5879
  readonly flags: "--company <slug|uid>";
5770
5880
  readonly description: "Deprecated no-op; the selected company is verified directly";
@@ -6268,6 +6268,141 @@ export const COMMAND_CATALOG = [
6268
6268
  }
6269
6269
  ],
6270
6270
  "subcommands": []
6271
+ },
6272
+ {
6273
+ "name": "sponsor",
6274
+ "description": "Ask a company to cover your $50 plan, or answer a request",
6275
+ "aliases": [],
6276
+ "hidden": false,
6277
+ "usage": "[options] [command]",
6278
+ "arguments": [],
6279
+ "options": [],
6280
+ "subcommands": [
6281
+ {
6282
+ "name": "request",
6283
+ "description": "Ask a company to cover your $50 HQ plan",
6284
+ "aliases": [],
6285
+ "hidden": false,
6286
+ "usage": "[options] <company>",
6287
+ "arguments": [
6288
+ {
6289
+ "name": "company",
6290
+ "required": true,
6291
+ "variadic": false
6292
+ }
6293
+ ],
6294
+ "options": [
6295
+ {
6296
+ "flags": "--json",
6297
+ "description": "Emit raw JSON"
6298
+ }
6299
+ ],
6300
+ "subcommands": []
6301
+ },
6302
+ {
6303
+ "name": "list",
6304
+ "description": "Show sponsorship requests — the company's queue, or your own",
6305
+ "aliases": [],
6306
+ "hidden": false,
6307
+ "usage": "[options]",
6308
+ "arguments": [],
6309
+ "options": [
6310
+ {
6311
+ "flags": "--company <slug>",
6312
+ "description": "Company slug (resolves to companyUid)"
6313
+ },
6314
+ {
6315
+ "flags": "--json",
6316
+ "description": "Emit raw JSON"
6317
+ }
6318
+ ],
6319
+ "subcommands": []
6320
+ },
6321
+ {
6322
+ "name": "approve",
6323
+ "description": "Say yes — put someone's $50 plan on the company bill",
6324
+ "aliases": [],
6325
+ "hidden": false,
6326
+ "usage": "[options] <id>",
6327
+ "arguments": [
6328
+ {
6329
+ "name": "id",
6330
+ "required": true,
6331
+ "variadic": false
6332
+ }
6333
+ ],
6334
+ "options": [
6335
+ {
6336
+ "flags": "--json",
6337
+ "description": "Emit raw JSON"
6338
+ }
6339
+ ],
6340
+ "subcommands": []
6341
+ },
6342
+ {
6343
+ "name": "decline",
6344
+ "description": "Say no to a plan sponsorship request",
6345
+ "aliases": [],
6346
+ "hidden": false,
6347
+ "usage": "[options] <id>",
6348
+ "arguments": [
6349
+ {
6350
+ "name": "id",
6351
+ "required": true,
6352
+ "variadic": false
6353
+ }
6354
+ ],
6355
+ "options": [
6356
+ {
6357
+ "flags": "--json",
6358
+ "description": "Emit raw JSON"
6359
+ }
6360
+ ],
6361
+ "subcommands": []
6362
+ },
6363
+ {
6364
+ "name": "revoke",
6365
+ "description": "End a sponsorship the company is currently paying for",
6366
+ "aliases": [],
6367
+ "hidden": false,
6368
+ "usage": "[options] <id>",
6369
+ "arguments": [
6370
+ {
6371
+ "name": "id",
6372
+ "required": true,
6373
+ "variadic": false
6374
+ }
6375
+ ],
6376
+ "options": [
6377
+ {
6378
+ "flags": "--json",
6379
+ "description": "Emit raw JSON"
6380
+ }
6381
+ ],
6382
+ "subcommands": []
6383
+ },
6384
+ {
6385
+ "name": "withdraw",
6386
+ "description": "Take back a sponsorship request you made",
6387
+ "aliases": [],
6388
+ "hidden": false,
6389
+ "usage": "[options] <id>",
6390
+ "arguments": [
6391
+ {
6392
+ "name": "id",
6393
+ "required": true,
6394
+ "variadic": false
6395
+ }
6396
+ ],
6397
+ "options": [
6398
+ {
6399
+ "flags": "--json",
6400
+ "description": "Emit raw JSON"
6401
+ }
6402
+ ],
6403
+ "subcommands": []
6404
+ }
6405
+ ]
6271
6406
  }
6272
6407
  ]
6273
6408
  },
@@ -7256,7 +7391,11 @@ export const COMMAND_CATALOG = [
7256
7391
  },
7257
7392
  {
7258
7393
  "flags": "--company <slug>",
7259
- "description": "Optional non-forcing company hint (resolver default still wins)"
7394
+ "description": "Optional non-forcing company hint"
7395
+ },
7396
+ {
7397
+ "flags": "--use-device-default",
7398
+ "description": "Opt in to historical repair using the device default (lower-confidence attribution)"
7260
7399
  },
7261
7400
  {
7262
7401
  "flags": "--json",
@@ -7438,6 +7577,10 @@ export const COMMAND_CATALOG = [
7438
7577
  "flags": "--allow-without-migration",
7439
7578
  "description": "Deprecated compatibility no-op; selected-company membership is always verified"
7440
7579
  },
7580
+ {
7581
+ "flags": "--repair-held-with-default",
7582
+ "description": "Persist opt-in for lower-confidence historical held-session repair"
7583
+ },
7441
7584
  {
7442
7585
  "flags": "--company <slug|uid>",
7443
7586
  "description": "Deprecated no-op; the selected company is verified directly"
@@ -0,0 +1,83 @@
1
+ /**
2
+ * `hq billing sponsor` — the individual-pull half of plan sponsorship, from the
3
+ * terminal ("ask a company to sponsor me", hq-pro #3609).
4
+ *
5
+ * A person who is over a personal limit has exactly three ways out: pay $50
6
+ * themselves, reduce what they store, or ask a company to cover the $50 plan
7
+ * line. This command is the third one, plus the admin side that answers it.
8
+ *
9
+ * hq billing sponsor request <company> — ask that company to cover my plan
10
+ * hq billing sponsor list — the queue (admins), or my own
11
+ * single status (everyone else)
12
+ * hq billing sponsor approve <id> — admin: say yes
13
+ * hq billing sponsor decline <id> — admin: say no
14
+ * hq billing sponsor revoke <id> — admin: end an active sponsorship
15
+ * hq billing sponsor withdraw <id> — me: take back my own request
16
+ *
17
+ * Every subcommand talks to the SAME hq-pro routes the console uses
18
+ * (`/v1/billing/sponsorship/...`). hq-pro is the authoritative gate on all of
19
+ * them: it resolves the caller's person id and the company's admin set
20
+ * server-side, so nothing here is trusted from the client.
21
+ *
22
+ * FEATURE SWITCH. The `plan` request kind only exists while hq-pro's
23
+ * `PLAN_SPONSORSHIP_REQUESTS_ENABLED` switch is on. With the switch off the
24
+ * backend does not recognise `plan` and answers 400 `MISSING_FIELDS` — which
25
+ * would read as "you typed something wrong". We translate that one case into a
26
+ * plain "not available yet" line so a person never sees a validation error for
27
+ * a feature that simply is not turned on.
28
+ */
29
+ import { Command } from "commander";
30
+ /** The request kind this command files. Matches hq-pro's contract. */
31
+ export declare const PLAN_RESOURCE: "plan";
32
+ /** What a person is told when hq-pro's plan-sponsorship switch is off. */
33
+ export declare const FEATURE_OFF_MESSAGE = "Asking a company to sponsor your plan isn't available yet.";
34
+ /** What v1 sponsorship covers, stated wherever a person confirms or reads it. */
35
+ export declare const COVERAGE_SENTENCE = "Your company pays your $50 plan. Storage above your plan's allowance is still yours.";
36
+ /** What a person is told while an approval waits on the sponsor's card. */
37
+ export declare const HELD_FOR_CARD_SENTENCE = "Your company said yes and is adding a card. Your limits still apply until then.";
38
+ /** One request row as hq-pro persists and returns it. */
39
+ export interface SponsorshipRequestRecord {
40
+ requestId: string;
41
+ companyUid: string;
42
+ requestedBy: string;
43
+ resourceId?: string;
44
+ resource: "outpost" | "agent" | "plan";
45
+ status: "pending" | "active" | "declined" | "pending-sponsor-billing" | "expired";
46
+ payer: "person" | "company";
47
+ requestedAt: string;
48
+ updatedAt: string;
49
+ }
50
+ /** An hq-pro error body: `{ error, code }` on every non-2xx these routes send. */
51
+ interface ApiErrorBody {
52
+ error?: string;
53
+ message?: string;
54
+ code?: string;
55
+ }
56
+ /**
57
+ * Turn an hq-pro non-2xx into one plain sentence.
58
+ *
59
+ * The switch-off 400 is the important translation: with the feature off,
60
+ * `plan` is an unrecognised resource kind and the generic body reads
61
+ * "companyUid and resource ('outpost'|'agent') are required", which tells a
62
+ * person nothing true about what happened.
63
+ */
64
+ export declare function messageForError(status: number, body: ApiErrorBody): string;
65
+ /**
66
+ * The member self-read's shape. hq-pro answers
67
+ * `GET /v1/billing/sponsorship/mine?companyUid=…&resource=…` with ONE status —
68
+ * not a list — because the route is a self-scoped "am I covered" question.
69
+ * `active` is true only for an approved COMPANY-paid row; everything else
70
+ * (never asked, still pending, declined) comes back `active: false` with null
71
+ * fields.
72
+ */
73
+ export interface SponsorshipSelfState {
74
+ active: boolean;
75
+ status: string | null;
76
+ payer: "person" | "company" | null;
77
+ requestId: string | null;
78
+ }
79
+ /** Plain label for a request status. Never shows the raw enum. */
80
+ export declare function statusLabel(status: string): string;
81
+ export declare function registerBillingSponsorCommands(billing: Command): void;
82
+ export {};
83
+ //# sourceMappingURL=billing-sponsor.d.ts.map