@indigoai-us/hq-cli 5.345.234 → 5.345.236

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 (100) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/command-catalog.generated.d.ts +311 -7
  3. package/dist/command-catalog.generated.js +383 -7
  4. package/dist/command-registration-plan.d.ts +30 -0
  5. package/dist/command-registration-plan.js +5 -0
  6. package/dist/commands/bot-companies.d.ts +4 -1
  7. package/dist/commands/bot-companies.js +5 -1
  8. package/dist/commands/bot.d.ts +10 -0
  9. package/dist/commands/bot.js +165 -36
  10. package/dist/commands/capacity.js +1 -1
  11. package/dist/commands/core-handoff.js +2 -2
  12. package/dist/commands/core-ontology-native.js +5 -4
  13. package/dist/commands/core-pipeline-workflow-runner-native.js +4 -9
  14. package/dist/commands/deploy-app-db.d.ts +3 -0
  15. package/dist/commands/deploy-app-db.js +79 -0
  16. package/dist/commands/deploy-app-upload.d.ts +3 -0
  17. package/dist/commands/deploy-app-upload.js +120 -0
  18. package/dist/commands/deploy-comments.js +46 -1
  19. package/dist/commands/deploy-mutations.js +71 -5
  20. package/dist/commands/deploy-runtime-bindings.d.ts +3 -0
  21. package/dist/commands/deploy-runtime-bindings.js +135 -0
  22. package/dist/commands/deploy-ssr.d.ts +3 -0
  23. package/dist/commands/deploy-ssr.js +74 -0
  24. package/dist/commands/dm.d.ts +7 -1
  25. package/dist/commands/dm.js +39 -9
  26. package/dist/commands/doctor.js +2 -10
  27. package/dist/commands/fingerprint.js +4 -9
  28. package/dist/commands/lanes-accounts.js +5 -5
  29. package/dist/commands/lanes-hold.js +1 -1
  30. package/dist/commands/lanes-message.js +3 -3
  31. package/dist/commands/lanes-move.js +1 -1
  32. package/dist/commands/lanes-resume.js +6 -6
  33. package/dist/commands/lanes-watch.js +2 -2
  34. package/dist/commands/lanes.js +21 -21
  35. package/dist/commands/work-env.d.ts +90 -0
  36. package/dist/commands/work-env.js +304 -0
  37. package/dist/lazy-commands.js +2 -10
  38. package/dist/lib/bot/api.d.ts +27 -0
  39. package/dist/lib/bot/api.js +28 -2
  40. package/dist/lib/bot/cloud-create.d.ts +46 -0
  41. package/dist/lib/bot/cloud-create.js +128 -0
  42. package/dist/lib/bot/fleet-daemon.js +4 -1
  43. package/dist/lib/bot/fleet-local.d.ts +7 -0
  44. package/dist/lib/bot/fleet-local.js +39 -3
  45. package/dist/lib/bot/fleet-owner-companies.js +2 -2
  46. package/dist/lib/bot/promote.d.ts +81 -2
  47. package/dist/lib/bot/promote.js +425 -51
  48. package/dist/lib/bot/promotion-hold.d.ts +9 -0
  49. package/dist/lib/bot/promotion-hold.js +29 -0
  50. package/dist/lib/bot/promotion-receipt.d.ts +10 -0
  51. package/dist/lib/bot/promotion-receipt.js +41 -1
  52. package/dist/lib/bot/promotion-upload.d.ts +6 -1
  53. package/dist/lib/bot/promotion-upload.js +3 -1
  54. package/dist/lib/bot/readiness.d.ts +9 -0
  55. package/dist/lib/bot/readiness.js +16 -0
  56. package/dist/lib/capacity/route.js +4 -4
  57. package/dist/lib/capacity/sign-in.js +1 -1
  58. package/dist/lib/checkpoint-ontology/entity-file.js +15 -17
  59. package/dist/lib/daemon/catalog.d.ts +2 -0
  60. package/dist/lib/daemon/catalog.js +2 -0
  61. package/dist/lib/daemon/hook-requests.js +23 -3
  62. package/dist/lib/daemon/run.d.ts +14 -0
  63. package/dist/lib/daemon/run.js +24 -14
  64. package/dist/lib/deploy-api.d.ts +3 -1
  65. package/dist/lib/deploy-api.js +11 -1
  66. package/dist/lib/environment/work-requirements.js +1 -1
  67. package/dist/lib/hot-channels/signals-pass.d.ts +0 -76
  68. package/dist/lib/hot-channels/signals-pass.js +81 -4
  69. package/dist/lib/lanes/account-company.js +1 -1
  70. package/dist/lib/lanes/account-ownership.js +1 -1
  71. package/dist/lib/lanes/accounts.js +1 -1
  72. package/dist/lib/lanes/delivery.js +7 -7
  73. package/dist/lib/lanes/dropbox.js +1 -1
  74. package/dist/lib/lanes/grants.js +3 -3
  75. package/dist/lib/lanes/hq-root.js +1 -1
  76. package/dist/lib/lanes/keep-alive-audit.js +2 -2
  77. package/dist/lib/lanes/links.js +4 -4
  78. package/dist/lib/lanes/monitor.js +3 -3
  79. package/dist/lib/lanes/quota-notice.js +1 -1
  80. package/dist/lib/lanes/reconcile.js +22 -12
  81. package/dist/lib/lanes/signal-brief-template.js +1 -1
  82. package/dist/lib/lanes/worker-continuity.js +1 -1
  83. package/dist/lib/mesh/live/direct-drain.d.ts +1 -0
  84. package/dist/lib/mesh/live/direct-drain.js +12 -1
  85. package/dist/lib/mesh/live/emit.d.ts +1 -1
  86. package/dist/lib/mesh/live/emit.js +10 -5
  87. package/dist/lib/mesh/live/flush.js +19 -4
  88. package/dist/lib/mesh/live/reporting-privacy.d.ts +9 -3
  89. package/dist/lib/mesh/live/reporting-privacy.js +27 -7
  90. package/dist/lib/mesh/live/spool.d.ts +2 -0
  91. package/dist/lib/mesh/live/spool.js +41 -0
  92. package/dist/lib/signals/sanitize.js +5 -4
  93. package/dist/lib/signals/steps/garden.js +5 -4
  94. package/dist/utils/frontmatter.d.ts +8 -0
  95. package/dist/utils/frontmatter.js +11 -2
  96. package/dist/utils/hq-roots-core.d.ts +5 -0
  97. package/dist/utils/hq-roots-core.js +18 -9
  98. package/dist/utils/owner-session.d.ts +13 -0
  99. package/dist/utils/owner-session.js +28 -0
  100. package/package.json +7 -7
@@ -14,6 +14,7 @@
14
14
  * Only exact slug or alias matches are merged, by ontology-garden.mjs itself;
15
15
  * this step adds no merging of its own for the >= 0.95 band.
16
16
  */
17
+ import { splitFrontmatterBody } from "../../../utils/frontmatter.js";
17
18
  import * as fs from "node:fs";
18
19
  import * as path from "node:path";
19
20
  import { localDate } from "../local-date.js";
@@ -44,11 +45,11 @@ export function isByaBook(company, ref) {
44
45
  }
45
46
  /** Same flat key: value reader as ontology-garden.mjs. */
46
47
  export function readFrontmatter(text) {
47
- const m = text.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
48
- if (!m)
48
+ const block = splitFrontmatterBody(text, "lf");
49
+ if (!block)
49
50
  return { fm: {}, body: text.trim() };
50
51
  const fm = {};
51
- for (const line of m[1].split("\n")) {
52
+ for (const line of block.yaml.split("\n")) {
52
53
  const mm = line.match(/^([A-Za-z_]+):\s*(.*)$/);
53
54
  if (!mm)
54
55
  continue;
@@ -57,7 +58,7 @@ export function readFrontmatter(text) {
57
58
  ? v.slice(1, -1).split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")).filter(Boolean)
58
59
  : v.replace(/^["']|["']$/g, "");
59
60
  }
60
- return { fm, body: m[2].trim() };
61
+ return { fm, body: block.body.trim() };
61
62
  }
62
63
  const str = (v) => (Array.isArray(v) ? v.join(",") : v ?? "");
63
64
  /** Pending candidate files (relative to hqRoot) under one _candidates dir. */
@@ -24,4 +24,12 @@ export declare function splitFrontmatterBlock(text: string): {
24
24
  frontmatter: string;
25
25
  body: string;
26
26
  } | null;
27
+ /**
28
+ * Read the YAML bytes and body of a block without parsing the YAML.
29
+ * Legacy LF readers can require LF at the opening and closing fences.
30
+ */
31
+ export declare function splitFrontmatterBody(text: string, lineEndings?: "lf" | "lf-or-crlf"): {
32
+ yaml: string;
33
+ body: string;
34
+ } | null;
27
35
  //# sourceMappingURL=frontmatter.d.ts.map
@@ -12,7 +12,8 @@
12
12
  /** Closing fence must end its line or the text. Group 1 is the YAML text. */
13
13
  const FENCE_RE = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;
14
14
  /** Closing fence may run straight into the body. Group 1 is the fenced block, group 2 the rest. */
15
- const BLOCK_RE = /^(---\r?\n[\s\S]*?\r?\n---\r?\n?)([\s\S]*)$/;
15
+ const BLOCK_RE = /^(---\r?\n([\s\S]*?)\r?\n---\r?\n?)([\s\S]*)$/;
16
+ const LF_BLOCK_RE = /^(---\n([\s\S]*?)\n---\n?)([\s\S]*)$/;
16
17
  /**
17
18
  * Match a frontmatter fence at the very start of `text`. `[1]` is the YAML
18
19
  * text between the fences, `[0]` runs through the closing fence's line ending.
@@ -28,6 +29,14 @@ export function matchFrontmatter(text) {
28
29
  */
29
30
  export function splitFrontmatterBlock(text) {
30
31
  const match = BLOCK_RE.exec(text);
31
- return match ? { frontmatter: match[1], body: match[2] } : null;
32
+ return match ? { frontmatter: match[1], body: match[3] } : null;
33
+ }
34
+ /**
35
+ * Read the YAML bytes and body of a block without parsing the YAML.
36
+ * Legacy LF readers can require LF at the opening and closing fences.
37
+ */
38
+ export function splitFrontmatterBody(text, lineEndings = "lf-or-crlf") {
39
+ const match = (lineEndings === "lf" ? LF_BLOCK_RE : BLOCK_RE).exec(text);
40
+ return match ? { yaml: match[2], body: match[3] } : null;
32
41
  }
33
42
  //# sourceMappingURL=frontmatter.js.map
@@ -36,6 +36,11 @@ export declare const BUNDLED_ASSET_DIR: string;
36
36
  * checkout without a personal overlay, and a personal-only overlay.
37
37
  */
38
38
  export declare function isHqRoot(dir: string): boolean;
39
+ /**
40
+ * Find the nearest matching ancestor, including the filesystem root.
41
+ * Callers supply their existing marker check when they use a different HQ layout.
42
+ */
43
+ export declare function findHqRootAncestor(start: string, matches?: (dir: string) => boolean, parentOf?: (dir: string) => string): string | null;
39
44
  export type PackageRootFs = Pick<typeof fs, "existsSync" | "readFileSync" | "realpathSync" | "statSync">;
40
45
  export type PackageRootResolverOptions = {
41
46
  /** Directory containing the currently-running compiled module. */
@@ -61,6 +61,21 @@ export function isHqRoot(dir) {
61
61
  fs.existsSync(path.join(dir, "core")) ||
62
62
  fs.existsSync(path.join(dir, "personal"))));
63
63
  }
64
+ /**
65
+ * Find the nearest matching ancestor, including the filesystem root.
66
+ * Callers supply their existing marker check when they use a different HQ layout.
67
+ */
68
+ export function findHqRootAncestor(start, matches = isHqRoot, parentOf = path.dirname) {
69
+ let dir = start;
70
+ for (;;) {
71
+ if (matches(dir))
72
+ return dir;
73
+ const parent = parentOf(dir);
74
+ if (parent === dir)
75
+ return null;
76
+ dir = parent;
77
+ }
78
+ }
64
79
  function realpathOrResolve(p, fileSystem = fs) {
65
80
  try {
66
81
  return fileSystem.realpathSync(p);
@@ -306,15 +321,9 @@ export function resolveLiveRoot(opts = {}) {
306
321
  // Walk up from cwd. Unlike the explicit tiers this is a guess, so failing to
307
322
  // find a root here is reported as "run this from inside HQ" rather than as a
308
323
  // bad value.
309
- let dir = realpathOrResolve(opts.cwd ?? process.cwd());
310
- for (;;) {
311
- if (isHqRoot(dir) && !isWithinPackage(dir))
312
- return dir;
313
- const parent = path.dirname(dir);
314
- if (parent === dir)
315
- break;
316
- dir = parent;
317
- }
324
+ const discovered = findHqRootAncestor(realpathOrResolve(opts.cwd ?? process.cwd()), (dir) => isHqRoot(dir) && !isWithinPackage(dir));
325
+ if (discovered !== null)
326
+ return discovered;
318
327
  throw rootError("Could not find your HQ installation. Run this from inside your HQ " +
319
328
  "directory, or pass --hq-root <path> / set $HQ_ROOT.");
320
329
  }
@@ -0,0 +1,13 @@
1
+ export interface OwnerSessionDeps {
2
+ hasPersonSession?: () => boolean;
3
+ hasMachineCreds?: () => boolean;
4
+ machineKind?: () => string | undefined;
5
+ machineToken?: (signal?: AbortSignal) => Promise<string>;
6
+ personToken?: (interactive: boolean, signal?: AbortSignal) => Promise<string>;
7
+ }
8
+ export declare function delegatedOwnerSub(token: string | undefined): string | null;
9
+ export declare function ensureOwnerToken(options: {
10
+ interactive: boolean;
11
+ signal?: AbortSignal;
12
+ }, deps?: OwnerSessionDeps): Promise<string>;
13
+ //# sourceMappingURL=owner-session.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { loadMachineCreds } from "@indigoai-us/hq-cloud";
2
+ import { ensureCognitoToken } from "./cognito-session.js";
3
+ import { hasPersonCachedSession, probeMachineIdentity } from "./machine-principal-state.js";
4
+ import { decodeJwtPayload } from "./person-token-cache.js";
5
+ const NEVER_AN_OWNER = new Set(["agent", "company-outpost"]);
6
+ export function delegatedOwnerSub(token) {
7
+ const claims = decodeJwtPayload(token);
8
+ if (claims?.["custom:entityType"] !== "outpost")
9
+ return null;
10
+ const sub = claims["custom:delegatedSub"];
11
+ return typeof sub === "string" && sub.trim().length > 0 ? sub : null;
12
+ }
13
+ export async function ensureOwnerToken(options, deps = {}) {
14
+ const hasPersonSession = deps.hasPersonSession ?? (() => hasPersonCachedSession());
15
+ const hasMachineCreds = deps.hasMachineCreds ?? (() => probeMachineIdentity(process.env));
16
+ const machineToken = deps.machineToken ??
17
+ ((signal) => ensureCognitoToken({ tokenSource: "machine", interactive: false, ...(signal ? { signal } : {}) }));
18
+ const personToken = deps.personToken ??
19
+ ((interactive, signal) => ensureCognitoToken({ tokenSource: "person", interactive, ...(signal ? { signal } : {}) }));
20
+ const machineKind = deps.machineKind ?? (() => loadMachineCreds()?.entityType);
21
+ if (!hasPersonSession() && hasMachineCreds() && !NEVER_AN_OWNER.has(machineKind() ?? "")) {
22
+ const token = await machineToken(options.signal);
23
+ if (delegatedOwnerSub(token))
24
+ return token;
25
+ }
26
+ return personToken(options.interactive, options.signal);
27
+ }
28
+ //# sourceMappingURL=owner-session.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.234",
3
+ "version": "5.345.236",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -126,11 +126,11 @@
126
126
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
127
127
  },
128
128
  "optionalDependencies": {
129
- "@indigoai-us/hq-hook-win32-x64": "5.345.234",
130
- "@indigoai-us/hq-hook-win32-arm64": "5.345.234",
131
- "@indigoai-us/hq-hook-darwin-x64": "5.345.234",
132
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.234",
133
- "@indigoai-us/hq-hook-linux-x64": "5.345.234",
134
- "@indigoai-us/hq-hook-linux-arm64": "5.345.234"
129
+ "@indigoai-us/hq-hook-win32-x64": "5.345.236",
130
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.236",
131
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.236",
132
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.236",
133
+ "@indigoai-us/hq-hook-linux-x64": "5.345.236",
134
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.236"
135
135
  }
136
136
  }