@indigoai-us/hq-cli 5.345.248 → 5.345.250

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 (79) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/contracts/host-canary-release.json +3 -3
  3. package/dist/command-catalog.generated.d.ts +93 -8
  4. package/dist/command-catalog.generated.js +114 -8
  5. package/dist/commands/core-job-run-native.js +4 -0
  6. package/dist/commands/core-knowledge-prefs.d.ts +1 -1
  7. package/dist/commands/core-knowledge-prefs.js +1 -16
  8. package/dist/commands/core.js +0 -2
  9. package/dist/commands/daemon.js +21 -0
  10. package/dist/commands/ontology-graph.d.ts +2 -1
  11. package/dist/commands/ontology-graph.js +41 -10
  12. package/dist/commands/sync-core.js +6 -0
  13. package/dist/fast-scaffold.js +1 -3
  14. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +281 -256
  15. package/dist/hq-cloud-sync-runner/package.json +1 -1
  16. package/dist/index.d.ts +8 -0
  17. package/dist/index.js +47 -0
  18. package/dist/lib/daemon/installed-cli-restart.d.ts +57 -0
  19. package/dist/lib/daemon/installed-cli-restart.js +114 -0
  20. package/dist/lib/daemon/legacy-journal-gate.d.ts +32 -0
  21. package/dist/lib/daemon/legacy-journal-gate.js +102 -0
  22. package/dist/lib/daemon/machine-checks.d.ts +7 -0
  23. package/dist/lib/daemon/machine-checks.js +10 -0
  24. package/dist/lib/daemon/run.d.ts +3 -1
  25. package/dist/lib/daemon/run.js +48 -5
  26. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  27. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  28. package/dist/lib/hook-engine/coverage.d.ts +82 -13
  29. package/dist/lib/hook-engine/coverage.js +214 -18
  30. package/dist/lib/hook-engine/registration-identity.d.ts +5 -0
  31. package/dist/lib/hook-engine/registration-identity.js +1 -1
  32. package/dist/lib/hook-engine/resolve.d.ts +23 -0
  33. package/dist/lib/hook-engine/resolve.js +48 -1
  34. package/dist/lib/hook-engine/stable-heal.d.ts +87 -0
  35. package/dist/lib/hook-engine/stable-heal.js +214 -0
  36. package/dist/lib/hot-channels/graph-context.js +4 -1
  37. package/dist/lib/ontology-graph/model/step.d.ts +2 -0
  38. package/dist/lib/ontology-graph/model/step.js +3 -0
  39. package/dist/lib/ontology-graph/org/derive.d.ts +2 -0
  40. package/dist/lib/ontology-graph/org/derive.js +9 -2
  41. package/dist/lib/ontology-graph/org/index.d.ts +35 -6
  42. package/dist/lib/ontology-graph/org/index.js +136 -19
  43. package/dist/lib/ontology-graph/org/text.d.ts +2 -0
  44. package/dist/lib/ontology-graph/org/text.js +6 -0
  45. package/dist/lib/ontology-graph/org/types.d.ts +5 -0
  46. package/dist/lib/ontology-graph/pages/render.d.ts +2 -0
  47. package/dist/lib/ontology-graph/pages/render.js +10 -4
  48. package/dist/lib/ontology-graph/read/brief.js +4 -1
  49. package/dist/lib/ontology-graph/read/index.js +13 -2
  50. package/dist/lib/ontology-graph/read/names.d.ts +6 -1
  51. package/dist/lib/ontology-graph/read/names.js +8 -3
  52. package/dist/lib/ontology-graph/replay/engine.d.ts +47 -1
  53. package/dist/lib/ontology-graph/replay/engine.js +68 -2
  54. package/dist/lib/ontology-graph/replay/index.d.ts +2 -1
  55. package/dist/lib/ontology-graph/replay/index.js +1 -1
  56. package/dist/lib/ontology-graph/schema/authority.d.ts +34 -0
  57. package/dist/lib/ontology-graph/schema/authority.js +29 -0
  58. package/dist/lib/ontology-graph/schema/index.d.ts +1 -1
  59. package/dist/lib/ontology-graph/schema/index.js +1 -1
  60. package/dist/lib/ontology-graph/types.d.ts +7 -0
  61. package/dist/lib/sync-core/engine-holds.d.ts +1 -1
  62. package/dist/lib/sync-core/engine-holds.js +12 -2
  63. package/dist/lib/sync-core/hand-back.d.ts +2 -1
  64. package/dist/lib/sync-core/hand-back.js +16 -2
  65. package/dist/lib/sync-core/legacy-journal-export-child.d.ts +2 -0
  66. package/dist/lib/sync-core/legacy-journal-export-child.js +24 -0
  67. package/dist/lib/sync-core/legacy-journal-export.d.ts +39 -0
  68. package/dist/lib/sync-core/legacy-journal-export.js +241 -0
  69. package/dist/lib/sync-core/legacy-journal-reader.d.ts +15 -0
  70. package/dist/lib/sync-core/legacy-journal-reader.js +56 -0
  71. package/dist/lib/sync-core/reconcile.d.ts +3 -0
  72. package/dist/lib/sync-core/reconcile.js +43 -3
  73. package/dist/utils/cli-telemetry.d.ts +1 -0
  74. package/dist/utils/cli-telemetry.js +6 -3
  75. package/dist/utils/hook-engine-rollup.d.ts +96 -0
  76. package/dist/utils/hook-engine-rollup.js +725 -0
  77. package/package.json +8 -8
  78. package/scripts/install-hook-engine.mjs +4 -0
  79. package/assets/scaffold/core/scripts/knowledge-prefs.sh +0 -55
@@ -10,7 +10,8 @@
10
10
  * hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
11
11
  * hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief
12
12
  * hq ontology org-chart draft | confirm --from <file> [--yes] | show
13
- * hq ontology org observed [--write] | compare | person <name> [--view company|member] [--as-of D] [--model]
13
+ * hq ontology activity [<person>] [--roles] [--compare] [--write] [--view company|member] [--as-of D] [--model]
14
+ * (`hq ontology org observed|compare|person <name>` is the same thing under its first name, kept hidden)
14
15
  * hq ontology daily | job install|uninstall|status
15
16
  *
16
17
  * No identity flag is needed (correction C5). Without `--member` the read
@@ -84,6 +85,12 @@ function budgetArg(value) {
84
85
  throw new InvalidArgumentError("expected a whole number, 0 or more");
85
86
  return parsed;
86
87
  }
88
+ function capArg(value) {
89
+ const parsed = Number(value);
90
+ if (value.trim() === "" || !Number.isSafeInteger(parsed) || parsed < 1)
91
+ throw new InvalidArgumentError("expected a whole number, 1 or more");
92
+ return parsed;
93
+ }
87
94
  function clockArg(value) {
88
95
  if (!/^([01]?\d|2[0-3]):[0-5]\d$/.test(value))
89
96
  throw new InvalidArgumentError("expected a time as HH:MM");
@@ -200,6 +207,8 @@ export function registerOntologyCommand(program, deps = {}) {
200
207
  .option("--budget-tokens <n>", "stop model calls after this many input tokens; 0 runs rules only", budgetArg)
201
208
  .option("--no-model", "rules only: make no model call and leave model work pending")
202
209
  .option("--full-listing", "list the whole corpus again instead of only new and changed files")
210
+ .option("--max-input-tokens <n>", "model input tokens allowed per day for this run, counting the day's earlier runs (default 150000)", capArg)
211
+ .option("--max-output-tokens <n>", "model output tokens allowed per day for this run (default 20000)", capArg)
203
212
  .option("--dry-run", "read and count, write nothing")
204
213
  .action(run(async (context, options) => {
205
214
  const { updateCommand } = await import("../lib/ontology-graph/replay/index.js");
@@ -208,6 +217,8 @@ export function registerOntologyCommand(program, deps = {}) {
208
217
  ...(options.budgetTokens !== undefined ? { budgetTokens: options.budgetTokens } : {}),
209
218
  ...(options.model === false ? { noModel: true } : {}),
210
219
  ...(options.fullListing ? { fullListing: true } : {}),
220
+ ...(options.maxInputTokens !== undefined ? { maxInputTokens: options.maxInputTokens } : {}),
221
+ ...(options.maxOutputTokens !== undefined ? { maxOutputTokens: options.maxOutputTokens } : {}),
211
222
  dryRun: Boolean(options.dryRun),
212
223
  });
213
224
  }));
@@ -366,34 +377,54 @@ export function registerOntologyCommand(program, deps = {}) {
366
377
  const { orgChartShowCommand } = await import("../lib/ontology-graph/proposals/org-chart.js");
367
378
  return orgChartShowCommand(context);
368
379
  }));
380
+ // The first name of the activity view. Hidden, and kept so nothing that calls it breaks.
369
381
  const org = ontology
370
- .command("org")
371
- .description("The org as observed from behavior in the graph, beside the stated one. Inferred, never a confirmed fact");
372
- /** The options the three observed-org commands share. */
382
+ .command("org", { hidden: true })
383
+ .description("Earlier name of `hq ontology activity`. Inferred from behavior, never a confirmed fact");
384
+ /** The options the activity commands share. */
373
385
  const orgScoped = (command) => scoped(command)
374
386
  .option("--view <view>", "company (company-wide rows only) or member (also the rows only this member may read)", orgViewArg)
375
387
  .option("--as-of <date>", "the day the 30, 90 and 365 day windows end on (YYYY-MM-DD; default today)", isoDateArg)
376
- .option("--model", "phrase each active person's observed role with one small model call");
388
+ .option("--roles", "also show the inferred role line and who appears to direct whom")
389
+ .option("--model", "with --roles, phrase each active person's role line with one small model call");
377
390
  const orgOptions = (options) => ({
378
391
  ...(options.view ? { view: options.view } : {}),
379
392
  ...(options.asOf ? { asOf: options.asOf } : {}),
380
- model: Boolean(options.model),
393
+ // The model only phrases role lines, so it is never called for output that shows none.
394
+ model: Boolean(options.model) && Boolean(options.roles),
395
+ roles: Boolean(options.roles),
381
396
  });
397
+ orgScoped(ontology.command("activity"))
398
+ .description("What each person does, from behavior in the graph: kinds of work with counts, what they ship and own, who they work with, change over time. Inferred; stores nothing without --write")
399
+ .argument("[person]", "one person's name or slug; without it, everyone")
400
+ .option("--compare", "print stated beside observed instead: title, manager and listed owner against behavior")
401
+ .option("--write", "also store the derived rows in the graph folder, marked as inferred")
402
+ .action(read(async (context, options, args) => {
403
+ const lib = await import("../lib/ontology-graph/org/index.js");
404
+ if (options.compare) {
405
+ if (args[0] !== undefined)
406
+ throw new OntologyGraphUsageError("--compare covers everyone; leave the person out");
407
+ return lib.orgCompareCommand(context, { ...orgOptions(options), model: Boolean(options.model) });
408
+ }
409
+ if (args[0] !== undefined)
410
+ return lib.orgPersonCommand(context, { ...orgOptions(options), name: args[0], write: options.write === true });
411
+ return lib.orgObservedCommand(context, { ...orgOptions(options), write: options.write === true });
412
+ }));
382
413
  orgScoped(org.command("observed"))
383
- .description("Print the observed org: role, areas, who appears to direct whom, groups and de facto owners. Stores nothing without --write")
414
+ .description("Same as `hq ontology activity`")
384
415
  .option("--write", "also store the derived rows in the graph folder, marked as inferred")
385
416
  .action(read(async (context, options) => {
386
417
  const { orgObservedCommand } = await import("../lib/ontology-graph/org/index.js");
387
418
  return orgObservedCommand(context, { ...orgOptions(options), write: options.write === true });
388
419
  }));
389
420
  orgScoped(org.command("compare"))
390
- .description("Print stated beside observed: title, manager and listed owner against behavior. Changes nothing")
421
+ .description("Same as `hq ontology activity --compare`")
391
422
  .action(read(async (context, options) => {
392
423
  const { orgCompareCommand } = await import("../lib/ontology-graph/org/index.js");
393
- return orgCompareCommand(context, orgOptions(options));
424
+ return orgCompareCommand(context, { ...orgOptions(options), model: Boolean(options.model) });
394
425
  }));
395
426
  orgScoped(org.command("person"))
396
- .description("Print one person's observed activity by window, coverage, edges and stated claims. Changes nothing")
427
+ .description("Same as `hq ontology activity <person>`")
397
428
  .argument("<name>", "the person's name or slug")
398
429
  .action(read(async (context, options, args) => {
399
430
  const { orgPersonCommand } = await import("../lib/ontology-graph/org/index.js");
@@ -91,6 +91,11 @@ export async function runSyncCoreReconcile(opts, d = defaultDeps()) {
91
91
  if (!fs.existsSync(tokenFile))
92
92
  throw new Error(`the token file ${tokenFile} does not exist`);
93
93
  const client = new VaultClient(buildVaultConfig(token));
94
+ const [{ bundledHqCloud, currentHqCloud }, { loadLegacyJournalReader }] = await Promise.all([
95
+ import("../lib/daemon/hq-cloud.js"),
96
+ import("../lib/sync-core/legacy-journal-reader.js"),
97
+ ]);
98
+ const journal = await loadLegacyJournalReader([currentHqCloud(daemonPaths(d.home, d.env).root), bundledHqCloud()]);
94
99
  const { resolveCanonicalPersonUid } = await import("./cloud.js");
95
100
  const result = await reconcileSyncCore({
96
101
  home: d.home,
@@ -105,6 +110,7 @@ export async function runSyncCoreReconcile(opts, d = defaultDeps()) {
105
110
  }),
106
111
  readRolloutFlag: (companyUid) => readCompanyRolloutFlag(companyUid, token, { env: d.env }),
107
112
  resolveCompany: (companyUid) => client.entity.get(companyUid),
113
+ ...(journal.reader ? { readLegacyJournal: journal.reader } : { legacyJournalUnavailable: journal.reason }),
108
114
  machineType: await machineTypeHere(d),
109
115
  readDownloadStreams: (companyUid) => readCompanyDownloadStreams(companyUid, token, { env: d.env }),
110
116
  ensureBinary: (release) => ensureSyncCoreBinary({ home: d.home, platform: d.platform, arch: d.arch, release, env: d.env }),
@@ -483,10 +483,8 @@ export const FAST_SCAFFOLD_SCRIPTS = [
483
483
  exportName: "runKnowledgePrefsFast",
484
484
  flagKey: "hq-core-native-fast-route",
485
485
  familyFlagKey: "core-native-policy",
486
- asset: "core/scripts/knowledge-prefs.sh",
487
486
  root: "live",
488
- shellCwd: "live",
489
- shellHqRoot: "live",
487
+ fallbackToCommandGraph: true,
490
488
  },
491
489
  ...["finalize", "post", "open-steps"].map((name) => ({
492
490
  name: `handoff ${name}`,