@indigoai-us/hq-cli 5.345.248 → 5.345.251

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 (114) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/contracts/host-canary-release.json +3 -3
  3. package/dist/command-catalog.generated.d.ts +288 -9
  4. package/dist/command-catalog.generated.js +355 -9
  5. package/dist/commands/bot.js +5 -1
  6. package/dist/commands/core-job-run-native.js +4 -0
  7. package/dist/commands/core-knowledge-prefs.d.ts +1 -1
  8. package/dist/commands/core-knowledge-prefs.js +1 -16
  9. package/dist/commands/core.js +0 -2
  10. package/dist/commands/daemon.js +21 -0
  11. package/dist/commands/lanes.d.ts +2 -0
  12. package/dist/commands/lanes.js +9 -4
  13. package/dist/commands/ontology-graph.d.ts +11 -3
  14. package/dist/commands/ontology-graph.js +138 -14
  15. package/dist/commands/sources.js +26 -8
  16. package/dist/commands/sync-core.js +6 -0
  17. package/dist/fast-scaffold.js +1 -3
  18. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +281 -256
  19. package/dist/hq-cloud-sync-runner/package.json +1 -1
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.js +47 -0
  22. package/dist/lib/bot/fleet-cron.d.ts +2 -0
  23. package/dist/lib/bot/fleet-cron.js +5 -0
  24. package/dist/lib/daemon/installed-cli-restart.d.ts +57 -0
  25. package/dist/lib/daemon/installed-cli-restart.js +114 -0
  26. package/dist/lib/daemon/legacy-journal-gate.d.ts +32 -0
  27. package/dist/lib/daemon/legacy-journal-gate.js +102 -0
  28. package/dist/lib/daemon/machine-checks.d.ts +7 -0
  29. package/dist/lib/daemon/machine-checks.js +10 -0
  30. package/dist/lib/daemon/run.d.ts +3 -1
  31. package/dist/lib/daemon/run.js +48 -5
  32. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  33. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  34. package/dist/lib/hook-engine/coverage.d.ts +99 -19
  35. package/dist/lib/hook-engine/coverage.js +269 -35
  36. package/dist/lib/hook-engine/native-stop-compatibility.json +9 -4
  37. package/dist/lib/hook-engine/registration-identity.d.ts +5 -0
  38. package/dist/lib/hook-engine/registration-identity.js +1 -1
  39. package/dist/lib/hook-engine/resolve.d.ts +23 -0
  40. package/dist/lib/hook-engine/resolve.js +48 -1
  41. package/dist/lib/hook-engine/stable-heal.d.ts +87 -0
  42. package/dist/lib/hook-engine/stable-heal.js +214 -0
  43. package/dist/lib/hot-channels/graph-context.d.ts +26 -1
  44. package/dist/lib/hot-channels/graph-context.js +80 -10
  45. package/dist/lib/hot-channels/run.d.ts +1 -0
  46. package/dist/lib/hot-channels/signals-pass.js +9 -4
  47. package/dist/lib/ontology-graph/model/files.d.ts +4 -0
  48. package/dist/lib/ontology-graph/model/files.js +23 -0
  49. package/dist/lib/ontology-graph/model/index.d.ts +11 -1
  50. package/dist/lib/ontology-graph/model/index.js +42 -18
  51. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +9 -1
  52. package/dist/lib/ontology-graph/model/pass-tasks.js +7 -4
  53. package/dist/lib/ontology-graph/model/pass.d.ts +5 -0
  54. package/dist/lib/ontology-graph/model/pass.js +8 -8
  55. package/dist/lib/ontology-graph/model/pending-items.d.ts +31 -0
  56. package/dist/lib/ontology-graph/model/pending-items.js +113 -0
  57. package/dist/lib/ontology-graph/model/step.d.ts +48 -1
  58. package/dist/lib/ontology-graph/model/step.js +205 -36
  59. package/dist/lib/ontology-graph/model/tasks.d.ts +17 -1
  60. package/dist/lib/ontology-graph/model/tasks.js +28 -8
  61. package/dist/lib/ontology-graph/org/derive.d.ts +2 -0
  62. package/dist/lib/ontology-graph/org/derive.js +9 -2
  63. package/dist/lib/ontology-graph/org/index.d.ts +35 -6
  64. package/dist/lib/ontology-graph/org/index.js +136 -19
  65. package/dist/lib/ontology-graph/org/text.d.ts +2 -0
  66. package/dist/lib/ontology-graph/org/text.js +6 -0
  67. package/dist/lib/ontology-graph/org/types.d.ts +5 -0
  68. package/dist/lib/ontology-graph/pages/render.d.ts +2 -0
  69. package/dist/lib/ontology-graph/pages/render.js +11 -4
  70. package/dist/lib/ontology-graph/read/brief.d.ts +13 -3
  71. package/dist/lib/ontology-graph/read/brief.js +312 -62
  72. package/dist/lib/ontology-graph/read/index.d.ts +1 -1
  73. package/dist/lib/ontology-graph/read/index.js +14 -3
  74. package/dist/lib/ontology-graph/read/names.d.ts +6 -1
  75. package/dist/lib/ontology-graph/read/names.js +8 -3
  76. package/dist/lib/ontology-graph/read/reader-setting.d.ts +2 -0
  77. package/dist/lib/ontology-graph/read/reader-setting.js +4 -1
  78. package/dist/lib/ontology-graph/remodel/index.d.ts +174 -0
  79. package/dist/lib/ontology-graph/remodel/index.js +450 -0
  80. package/dist/lib/ontology-graph/replay/engine.d.ts +47 -1
  81. package/dist/lib/ontology-graph/replay/engine.js +68 -2
  82. package/dist/lib/ontology-graph/replay/index.d.ts +2 -1
  83. package/dist/lib/ontology-graph/replay/index.js +114 -8
  84. package/dist/lib/ontology-graph/schema/authority.d.ts +43 -0
  85. package/dist/lib/ontology-graph/schema/authority.js +39 -0
  86. package/dist/lib/ontology-graph/schema/index.d.ts +1 -1
  87. package/dist/lib/ontology-graph/schema/index.js +1 -1
  88. package/dist/lib/ontology-graph/setup/index.d.ts +88 -0
  89. package/dist/lib/ontology-graph/setup/index.js +489 -0
  90. package/dist/lib/ontology-graph/types.d.ts +28 -0
  91. package/dist/lib/ontology-graph/types.js +5 -0
  92. package/dist/lib/signals/failure-alert.js +4 -5
  93. package/dist/lib/signals/steps/adapters.js +3 -0
  94. package/dist/lib/sync-core/engine-holds.d.ts +1 -1
  95. package/dist/lib/sync-core/engine-holds.js +12 -2
  96. package/dist/lib/sync-core/hand-back.d.ts +2 -1
  97. package/dist/lib/sync-core/hand-back.js +16 -2
  98. package/dist/lib/sync-core/legacy-journal-export-child.d.ts +2 -0
  99. package/dist/lib/sync-core/legacy-journal-export-child.js +24 -0
  100. package/dist/lib/sync-core/legacy-journal-export.d.ts +39 -0
  101. package/dist/lib/sync-core/legacy-journal-export.js +241 -0
  102. package/dist/lib/sync-core/legacy-journal-reader.d.ts +15 -0
  103. package/dist/lib/sync-core/legacy-journal-reader.js +56 -0
  104. package/dist/lib/sync-core/reconcile.d.ts +3 -0
  105. package/dist/lib/sync-core/reconcile.js +43 -3
  106. package/dist/utils/cli-telemetry.d.ts +1 -0
  107. package/dist/utils/cli-telemetry.js +6 -3
  108. package/dist/utils/hook-engine-rollup.d.ts +96 -0
  109. package/dist/utils/hook-engine-rollup.js +725 -0
  110. package/dist/utils/sync-person.d.ts +15 -0
  111. package/dist/utils/sync-person.js +74 -0
  112. package/package.json +8 -8
  113. package/scripts/install-hook-engine.mjs +4 -0
  114. package/assets/scaffold/core/scripts/knowledge-prefs.sh +0 -55
@@ -1,6 +1,6 @@
1
1
  import { importLegacy as defaultImportLegacy } from "../legacy/index.js";
2
2
  import { compilePages as defaultCompilePages } from "../pages/index.js";
3
- import { type AudienceKey, type EntityRef, type GraphContext, type GraphSchema, type GraphStore, type IngestRow, type IsoDate, type LegacyImportResult, type MemberIdentity, type Contradiction, type ModelStep, type Origin, type RebuildOptions, type ReplayRunResult, type Resolver, type RuleExtractor, type SourceRef, type UpdateOptions } from "../types.js";
3
+ import { type AudienceKey, type EntityRef, type GraphContext, type GraphSchema, type GraphStore, type IngestRow, type IsoDate, type LegacyImportResult, type MemberIdentity, type Contradiction, type ModelRunner, type ModelStep, type Origin, type RebuildOptions, type ReplayRunResult, type Resolver, type RuleExtractor, type SourceRef, type UpdateOptions } from "../types.js";
4
4
  import { briefCommand as defaultBriefCommand } from "../read/index.js";
5
5
  import { type ClassedInput, type Corpus } from "./readers.js";
6
6
  export declare const TYPING_PROMPT_VERSION = "replay-typing-v1";
@@ -12,6 +12,46 @@ export declare const LISTING_MANIFEST_RELATIVE: string;
12
12
  export declare const NO_MODEL_ENV = "HQ_ONTOLOGY_REPLAY_NO_MODEL";
13
13
  /** Set to 1 to make `update` list the whole corpus again (the same as `--full-listing`). */
14
14
  export declare const FULL_LISTING_ENV = "HQ_ONTOLOGY_REPLAY_FULL_LISTING";
15
+ /** The model step's cap per day. The scheduled daily run uses exactly this; one run can raise it (`resolveDayBudget`). */
16
+ export declare const DEFAULT_DAY_BUDGET: {
17
+ readonly inputTokens: 150000;
18
+ readonly outputTokens: 20000;
19
+ };
20
+ /** Thrown for a daily cap that is not a whole number of 1 or more. */
21
+ export declare class DayBudgetError extends RangeError {
22
+ constructor(name: string, value: unknown);
23
+ }
24
+ /**
25
+ * The daily cap a run uses: the defaults, with either side replaced by the
26
+ * run's own `maxInputTokens` / `maxOutputTokens`. Absent options change
27
+ * nothing. Zero, a negative, a fraction or a non-number is refused: switching
28
+ * the model off is `--no-model`, not a cap of zero.
29
+ */
30
+ export declare function resolveDayBudget(options?: {
31
+ maxInputTokens?: number;
32
+ maxOutputTokens?: number;
33
+ }): {
34
+ inputTokens: number;
35
+ outputTokens: number;
36
+ overridden: boolean;
37
+ };
38
+ /** What the run's model step was allowed, what it used, and whether a cap stopped it. */
39
+ export interface ModelCapReport {
40
+ /** The cap per day this run ran under. */
41
+ dayInputTokens: number;
42
+ dayOutputTokens: number;
43
+ /** True when the run raised or lowered the default cap. */
44
+ overridden: boolean;
45
+ /** Tokens this run's model step used (not the day's earlier runs). */
46
+ usedInputTokens: number;
47
+ usedOutputTokens: number;
48
+ /** Items left pending because the daily cap was reached. */
49
+ pendingAtDayCap: number;
50
+ /** Items left pending because the run's own budget (`--budget-tokens`) was reached. */
51
+ pendingAtRunBudget: number;
52
+ /** Items left pending for any other reason (usage limit, sign-out, timeout, provider error). */
53
+ pendingOther: number;
54
+ }
15
55
  /** Seams for tests. Production passes nothing. */
16
56
  export interface ReplayDeps {
17
57
  now?: () => Date;
@@ -20,6 +60,8 @@ export interface ReplayDeps {
20
60
  /** Builds the resolver once the legacy import is done. Default: WP-C's `createResolver`. */
21
61
  createResolver?: (store: GraphStore, schema: GraphSchema) => Resolver;
22
62
  modelStep?: ModelStep | null;
63
+ /** Runner for the step the engine creates itself (when `modelStep` is not given). Default: the `claude -p` turn. */
64
+ modelRunner?: ModelRunner;
23
65
  /** Model name stamped on `by agent:<model>` rows. */
24
66
  modelName?: string;
25
67
  importLegacy?: typeof defaultImportLegacy | null;
@@ -83,6 +125,8 @@ export interface ReplayReport extends ReplayRunResult {
83
125
  wallMs: number;
84
126
  counters: Record<string, number>;
85
127
  notes: string[];
128
+ /** Present when the run had a model step that reports totals. */
129
+ modelCap?: ModelCapReport;
86
130
  }
87
131
  interface TypingItem {
88
132
  ref: SourceRef;
@@ -95,6 +139,8 @@ interface TypingItem {
95
139
  export declare function parseTypingReply(reply: string, items: readonly TypingItem[], learned: IsoDate, by: Origin): IngestRow[];
96
140
  export declare function runRebuildWith(context: GraphContext, options: RebuildOptions, deps?: ReplayDeps): Promise<ReplayReport>;
97
141
  export declare function runUpdateWith(context: GraphContext, options: UpdateOptions, deps?: ReplayDeps): Promise<ReplayReport>;
142
+ /** The lines of the run summary that say what the model step was allowed, what it used and why it stopped. */
143
+ export declare function modelCapLines(cap: ModelCapReport): string[];
98
144
  export declare function formatReport(report: ReplayReport): string;
99
145
  export {};
100
146
  //# sourceMappingURL=engine.d.ts.map
@@ -53,7 +53,33 @@ export const NO_MODEL_ENV = "HQ_ONTOLOGY_REPLAY_NO_MODEL";
53
53
  export const FULL_LISTING_ENV = "HQ_ONTOLOGY_REPLAY_FULL_LISTING";
54
54
  /** Sources with no signals sent to the model per replayed day, at most. */
55
55
  const EXTRACT_SOURCES_PER_DAY = 12;
56
- const DEFAULT_DAY_BUDGET = { inputTokens: 150_000, outputTokens: 20_000 };
56
+ /** The model step's cap per day. The scheduled daily run uses exactly this; one run can raise it (`resolveDayBudget`). */
57
+ export const DEFAULT_DAY_BUDGET = { inputTokens: 150_000, outputTokens: 20_000 };
58
+ /** Thrown for a daily cap that is not a whole number of 1 or more. */
59
+ export class DayBudgetError extends RangeError {
60
+ constructor(name, value) {
61
+ super(`${name} must be a whole number of 1 or more, got ${String(value)}`);
62
+ this.name = "DayBudgetError";
63
+ }
64
+ }
65
+ /**
66
+ * The daily cap a run uses: the defaults, with either side replaced by the
67
+ * run's own `maxInputTokens` / `maxOutputTokens`. Absent options change
68
+ * nothing. Zero, a negative, a fraction or a non-number is refused: switching
69
+ * the model off is `--no-model`, not a cap of zero.
70
+ */
71
+ export function resolveDayBudget(options = {}) {
72
+ const check = (name, value, fallback) => {
73
+ if (value === undefined)
74
+ return fallback;
75
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)
76
+ throw new DayBudgetError(name, value);
77
+ return value;
78
+ };
79
+ const inputTokens = check("maxInputTokens", options.maxInputTokens, DEFAULT_DAY_BUDGET.inputTokens);
80
+ const outputTokens = check("maxOutputTokens", options.maxOutputTokens, DEFAULT_DAY_BUDGET.outputTokens);
81
+ return { inputTokens, outputTokens, overridden: options.maxInputTokens !== undefined || options.maxOutputTokens !== undefined };
82
+ }
57
83
  const MAX_IDENTITY_PASSES = 3;
58
84
  function fuzzyHooks(resolver) {
59
85
  return typeof resolver.setAdjudication === "function" ? resolver : null;
@@ -286,6 +312,8 @@ async function runReplay(command, context, options, deps) {
286
312
  context = withMember(context, deps.resolveMember ?? ((ctx) => resolveSignedInMemberFrom(ctx, env)));
287
313
  if (!context.member)
288
314
  throw new MemberIdentityRequiredError(command);
315
+ // Refused before anything is read or written.
316
+ const dayBudget = resolveDayBudget(options);
289
317
  const memberUid = context.member.personUid;
290
318
  const now = deps.now ?? (() => new Date());
291
319
  const started = Date.now();
@@ -503,7 +531,8 @@ async function runReplay(command, context, options, deps) {
503
531
  if (deps.modelStep === undefined && !modelOff) {
504
532
  try {
505
533
  model = defaultCreateModelStep(effective, {
506
- budget: DEFAULT_DAY_BUDGET,
534
+ budget: { inputTokens: dayBudget.inputTokens, outputTokens: dayBudget.outputTokens },
535
+ ...(deps.modelRunner ? { runner: deps.modelRunner } : {}),
507
536
  ...(budgetTokens ? { runBudget: { inputTokens: budgetTokens, outputTokens: Math.ceil(budgetTokens / 7.5) } } : {}),
508
537
  dryRun: options.dryRun,
509
538
  runId: run,
@@ -1118,6 +1147,23 @@ async function runReplay(command, context, options, deps) {
1118
1147
  bump("resolver_memo_hits", resolver.calls.memoHits);
1119
1148
  bump("resolver_resolved", resolver.calls.resolved);
1120
1149
  const totals = sumTotals([...entriesBefore, ...entries]);
1150
+ let modelCap;
1151
+ if (batchStep) {
1152
+ const stepTotals = batchStep.totals();
1153
+ const byReason = stepTotals.pendingByReason;
1154
+ const atDayCap = byReason["budget-day"] ?? 0;
1155
+ const atRunBudget = byReason["budget-run"] ?? 0;
1156
+ modelCap = {
1157
+ dayInputTokens: dayBudget.inputTokens,
1158
+ dayOutputTokens: dayBudget.outputTokens,
1159
+ overridden: dayBudget.overridden,
1160
+ usedInputTokens: stepTotals.used.inputTokens,
1161
+ usedOutputTokens: stepTotals.used.outputTokens,
1162
+ pendingAtDayCap: atDayCap,
1163
+ pendingAtRunBudget: atRunBudget,
1164
+ pendingOther: Math.max(0, stepTotals.pending - atDayCap - atRunBudget),
1165
+ };
1166
+ }
1121
1167
  return {
1122
1168
  run, command, days: entries.length,
1123
1169
  ...(entries.length > 0 ? { firstDay: entries[0].day, lastDay: entries[entries.length - 1].day } : {}),
@@ -1127,6 +1173,7 @@ async function runReplay(command, context, options, deps) {
1127
1173
  inputs: [...plan.values()].reduce((sum, bucket) => sum + bucket.length, 0),
1128
1174
  inputsByClass: corpus.stats.listed, excluded: corpus.stats.excluded, scanMs: corpus.stats.scanMs,
1129
1175
  wallMs: Date.now() - started, counters, notes,
1176
+ ...(modelCap ? { modelCap } : {}),
1130
1177
  ...(command === "update" ? { touched: [...touchedByRun].sort() } : {}),
1131
1178
  };
1132
1179
  }
@@ -1148,8 +1195,25 @@ export function runUpdateWith(context, options, deps = {}) {
1148
1195
  ...(options.noModel ? { noModel: true } : {}),
1149
1196
  ...(options.fullListing ? { fullListing: true } : {}),
1150
1197
  ...(options.input ? { input: options.input } : {}),
1198
+ ...(options.maxInputTokens !== undefined ? { maxInputTokens: options.maxInputTokens } : {}),
1199
+ ...(options.maxOutputTokens !== undefined ? { maxOutputTokens: options.maxOutputTokens } : {}),
1151
1200
  }, deps);
1152
1201
  }
1202
+ /** The lines of the run summary that say what the model step was allowed, what it used and why it stopped. */
1203
+ export function modelCapLines(cap) {
1204
+ const count = (n) => `${String(n)} item${n === 1 ? "" : "s"}`;
1205
+ const lines = [
1206
+ `model cap per day: in ${String(cap.dayInputTokens)} out ${String(cap.dayOutputTokens)} (${cap.overridden ? "set for this run" : "default"}); this run used in ${String(cap.usedInputTokens)} out ${String(cap.usedOutputTokens)}`,
1207
+ ];
1208
+ if (cap.pendingAtDayCap > 0) {
1209
+ lines.push(`stopped at the daily cap; ${count(cap.pendingAtDayCap)} pending. The next day's run carries on, or raise the cap for one run: hq ontology update --max-input-tokens <n> --max-output-tokens <n>`);
1210
+ }
1211
+ if (cap.pendingAtRunBudget > 0)
1212
+ lines.push(`stopped at the run budget (--budget-tokens); ${count(cap.pendingAtRunBudget)} pending. The next run carries on.`);
1213
+ if (cap.pendingOther > 0)
1214
+ lines.push(`${count(cap.pendingOther)} pending for another reason (usage limit, sign-out, timeout or provider error). The next run sends them again.`);
1215
+ return lines;
1216
+ }
1153
1217
  export function formatReport(report) {
1154
1218
  const lines = [
1155
1219
  `${report.command}${report.dryRun ? " (dry run, nothing written)" : ""}: ${report.days} day${report.days === 1 ? "" : "s"}${report.firstDay ? ` (${report.firstDay} to ${report.lastDay})` : ""}, ${report.inputs} inputs`,
@@ -1165,6 +1229,8 @@ export function formatReport(report) {
1165
1229
  const excluded = Object.entries(report.excluded).filter(([, value]) => value > 0);
1166
1230
  if (excluded.length > 0)
1167
1231
  lines.push(`left out: ${excluded.map(([reason, value]) => `${reason} ${value}`).join(", ")}`);
1232
+ if (report.modelCap)
1233
+ lines.push(...modelCapLines(report.modelCap));
1168
1234
  if (report.partial)
1169
1235
  lines.push(`stopped early: ${report.stoppedBecause ?? "unknown"}. Run again with --resume.`);
1170
1236
  for (const note of report.notes)
@@ -13,7 +13,8 @@ export { loadReplayConfig, REPLAY_CONFIG_RELATIVE } from "./config.js";
13
13
  export type { ReplayConfig } from "./config.js";
14
14
  export { resolveMemberScope } from "./scope.js";
15
15
  export type { MemberScope } from "./scope.js";
16
- export { FULL_LISTING_ENV, LISTING_MANIFEST_RELATIVE, NO_MODEL_ENV, PENDING_RELATIVE, TYPING_PROMPT_VERSION, formatReport, parseTypingReply } from "./engine.js";
16
+ export { DEFAULT_DAY_BUDGET, DayBudgetError, FULL_LISTING_ENV, LISTING_MANIFEST_RELATIVE, NO_MODEL_ENV, PENDING_RELATIVE, TYPING_PROMPT_VERSION, formatReport, modelCapLines, parseTypingReply, resolveDayBudget } from "./engine.js";
17
+ export type { ModelCapReport } from "./engine.js";
17
18
  export { LISTING_MANIFEST_VERSION, gitHeadCommit, openListingManifest } from "./listing-manifest.js";
18
19
  export type { ListingManifest, ListingManifestStats } from "./listing-manifest.js";
19
20
  export type { ReplayDeps, ReplayReport } from "./engine.js";
@@ -4,20 +4,21 @@
4
4
  * classes in readers.ts, the rules in extractors.ts.
5
5
  */
6
6
  import { runLint as defaultRunLint } from "../lint/index.js";
7
- import { DEFAULT_ONTOLOGY_MODEL, PASS_TASK_MODELS, createModelStep as defaultCreateModelStep, resolveModel, runModelPass as defaultRunModelPass, } from "../model/index.js";
7
+ import * as path from "node:path";
8
+ import { DEFAULT_ONTOLOGY_MODEL, MODEL_STATE_PATHS, PASS_TASK_MODELS, createModelStep as defaultCreateModelStep, followUpEntities, followUpScope, followUpTask, peekPendingMarkers, resolveModel, resolveModelStateDir, runModelPass as defaultRunModelPass, } from "../model/index.js";
8
9
  import { OntologyGraphNotImplementedError } from "../not-implemented.js";
9
10
  import { compilePages as defaultCompilePages, summaryItemsFor } from "../pages/index.js";
10
11
  import { briefCommand as defaultBriefCommand } from "../read/index.js";
11
12
  import { graphPath, openGraphStore } from "../store/index.js";
12
13
  import { MemberIdentityRequiredError, } from "../types.js";
13
14
  import { kindReaders, scanCorpus } from "./readers.js";
14
- import { LISTING_MANIFEST_RELATIVE, NO_MODEL_ENV, TRANSCRIPT_CACHE_RELATIVE, formatReport, runRebuildWith, runUpdateWith } from "./engine.js";
15
+ import { LISTING_MANIFEST_RELATIVE, NO_MODEL_ENV, TRANSCRIPT_CACHE_RELATIVE, formatReport, resolveDayBudget, runRebuildWith, runUpdateWith } from "./engine.js";
15
16
  import { allRuleExtractors } from "./extractors.js";
16
17
  import { resolveSignedInMember, withMember } from "./member.js";
17
18
  export { scanCorpus, kindReaders, meetingSlug } from "./readers.js";
18
19
  export { loadReplayConfig, REPLAY_CONFIG_RELATIVE } from "./config.js";
19
20
  export { resolveMemberScope } from "./scope.js";
20
- export { FULL_LISTING_ENV, LISTING_MANIFEST_RELATIVE, NO_MODEL_ENV, PENDING_RELATIVE, TYPING_PROMPT_VERSION, formatReport, parseTypingReply } from "./engine.js";
21
+ export { DEFAULT_DAY_BUDGET, DayBudgetError, FULL_LISTING_ENV, LISTING_MANIFEST_RELATIVE, NO_MODEL_ENV, PENDING_RELATIVE, TYPING_PROMPT_VERSION, formatReport, modelCapLines, parseTypingReply, resolveDayBudget } from "./engine.js";
21
22
  export { LISTING_MANIFEST_VERSION, gitHeadCommit, openListingManifest } from "./listing-manifest.js";
22
23
  export { classOf, createExtractTools, registerExtractTools } from "./extractors.js";
23
24
  export { countingResolver, createFallbackResolver, nameCandidates } from "./mentions.js";
@@ -30,6 +31,12 @@ export const PASS_RUN_BUDGET = {
30
31
  /** A rebuild: one full pass over a vault of about 50,000 inputs, with room. Replies already cached cost nothing. */
31
32
  rebuild: { inputTokens: 8_000_000, outputTokens: 4_000_000 },
32
33
  };
34
+ /** Why a follow-up marker its task did not build again is dropped, by task. Said in the run summary with the count. */
35
+ const DROP_REASON = {
36
+ profile: "the entity no longer has recent lines that state a role, employer or stage",
37
+ retype: "the link is no longer an open untyped link with a dated line that names both ends",
38
+ supersede: "the decisions about the topic have changed since, and the new group was asked instead",
39
+ };
33
40
  /** The cap per model per day, whatever the runs: a loop of updates stops here. */
34
41
  const PASS_DAY_BUDGET = { inputTokens: 12_000_000, outputTokens: 6_000_000 };
35
42
  const PASS_CONCURRENCY = 4;
@@ -50,6 +57,12 @@ function passIsOff(options, deps) {
50
57
  * dirty, then the brief. Replies are cached by content beside the graph folder
51
58
  * (`.hq/ontology-graph-model`), which no rebuild touches, so a second run over
52
59
  * unchanged sources makes no call.
60
+ *
61
+ * An update also looks again at the follow-up work an earlier run left pending
62
+ * (profiles, retypes, decisions that replace each other, page summaries,
63
+ * digests), whether or not it found anything new: the pass is scoped to what
64
+ * the run touched and to the entities those markers name. A marker whose item
65
+ * the graph no longer builds is dropped.
53
66
  */
54
67
  async function replayThenPass(command, context, options, deps, run) {
55
68
  if (passIsOff(options, deps))
@@ -62,8 +75,42 @@ async function replayThenPass(command, context, options, deps, run) {
62
75
  const scoped = withMember(context, deps.resolveMember ?? ((ctx) => resolveSignedInMember(ctx, env)));
63
76
  const day = (deps.now ?? (() => new Date()))().toISOString().slice(0, 10);
64
77
  const changed = report.days > 0 || report.totals.rowsAdded > 0 || report.totals.rowsClosed > 0;
65
- // A stopped run is finished by the next one. An update that found nothing new has nothing to send.
66
- if (report.partial || (command === "update" && !changed))
78
+ // A stopped run is finished by the next one.
79
+ if (report.partial)
80
+ return report;
81
+ // Follow-up work an earlier run left pending (profiles, retyped links, decisions, summaries, digests) is sent
82
+ // only when the run asks for it (`--follow-up`): a plain update with nothing new makes no model call, as
83
+ // before. Without the flag the summary says how many items wait. A look at the file decides whether there is
84
+ // anything to count, so a quiet day with nothing pending still costs the listing and nothing else.
85
+ const isUpdate = command === "update";
86
+ const wantFollowUp = isUpdate && options.followUp === true;
87
+ const pendingFile = path.join(resolveModelStateDir(scoped, undefined, env), ...MODEL_STATE_PATHS.pending.replace(/^\.state\//, "").split("/"));
88
+ const followUpOf = (markers) => markers.filter((marker) => followUpTask(marker) !== null);
89
+ /** The follow-up markers that are really pending: the file's, less what any model has already answered. */
90
+ const pendingFollowUp = () => {
91
+ if (deps.passStep)
92
+ return followUpOf(deps.passStep.pending());
93
+ if (followUpOf(peekPendingMarkers(pendingFile)).length === 0)
94
+ return [];
95
+ // A step that writes nothing: opening it applies the same cleanup a real run would, in memory.
96
+ return followUpOf(defaultCreateModelStep(scoped, { budget: PASS_DAY_BUDGET, dryRun: true, readOnly: true }).pending());
97
+ };
98
+ const sayPending = (markers) => {
99
+ if (markers.length === 0)
100
+ return;
101
+ const byTask = new Map();
102
+ for (const marker of markers)
103
+ byTask.set(followUpTask(marker), (byTask.get(followUpTask(marker)) ?? 0) + 1);
104
+ report.counters.pass_follow_up_pending = markers.length;
105
+ const detail = [...byTask].sort().map(([task, count]) => `${task} ${String(count)}`).join(", ");
106
+ report.notes.push(`${String(markers.length)} follow-up ${markers.length === 1 ? "item is" : "items are"} pending from earlier runs (${detail}) and ${markers.length === 1 ? "was" : "were"} not sent. To send them within the daily cap: hq ontology update --follow-up`);
107
+ };
108
+ if (isUpdate && !changed && !wantFollowUp) {
109
+ sayPending(pendingFollowUp());
110
+ return report;
111
+ }
112
+ let followUp = new Set();
113
+ if (isUpdate && !changed && pendingFollowUp().length === 0)
67
114
  return report;
68
115
  const dirtyBefore = new Set(openGraphStore(context.graphRoot, { company: context.company }).readDirty());
69
116
  const cap = options.budgetTokens;
@@ -75,9 +122,22 @@ async function replayThenPass(command, context, options, deps, run) {
75
122
  else {
76
123
  const runBudget = left === undefined ? PASS_RUN_BUDGET[command] : { inputTokens: left, outputTokens: Math.ceil(left / 2) };
77
124
  try {
78
- const make = (model) => defaultCreateModelStep(scoped, { budget: PASS_DAY_BUDGET, runBudget, concurrency: PASS_CONCURRENCY, runId: report.run, ...(deps.now ? { now: deps.now } : {}), ...(model ? { model } : {}) });
125
+ // A pass that exists only for follow-up work stays inside the daily cap of the model step (150,000 input
126
+ // tokens a day unless the run raises it), counted from the call ledger with the day's other runs.
127
+ const dayCap = resolveDayBudget(options);
128
+ const budget = isUpdate && !changed ? { inputTokens: dayCap.inputTokens, outputTokens: dayCap.outputTokens } : PASS_DAY_BUDGET;
129
+ const make = (model) => defaultCreateModelStep(scoped, { budget, runBudget, concurrency: PASS_CONCURRENCY, runId: report.run, ...(deps.now ? { now: deps.now } : {}), ...(model ? { model } : {}) });
79
130
  const step = deps.passStep ?? make();
80
131
  passStep = step;
132
+ // Opening the step dropped the markers another model had already answered: the scope is what is left.
133
+ const waiting = isUpdate ? followUpOf(step.pending()) : [];
134
+ if (wantFollowUp)
135
+ followUp = followUpScope(waiting);
136
+ const only = isUpdate ? new Set([...(report.touched ?? []), ...followUp]) : undefined;
137
+ if (only && followUp.size > 0)
138
+ report.counters.pass_follow_up_entities = followUp.size;
139
+ // A digest queued while its source was inside the window is still asked when the source has aged past it.
140
+ const keepSources = new Set(wantFollowUp ? waiting.filter((marker) => followUpTask(marker) === "digest").map((marker) => marker.itemKey) : []);
81
141
  let taskSteps = deps.passTaskSteps;
82
142
  if (!taskSteps && !deps.passStep && resolveModel(scoped) === DEFAULT_ONTOLOGY_MODEL) {
83
143
  // The cheapest model was measured wrong too often on these tasks; a member who raised the model keeps theirs.
@@ -92,8 +152,9 @@ async function replayThenPass(command, context, options, deps, run) {
92
152
  const pass = await (deps.runModelPass ?? defaultRunModelPass)(scoped, {
93
153
  step,
94
154
  day,
95
- // An update asks about what it touched; a rebuild about everything.
96
- ...(report.touched ? { only: new Set(report.touched) } : {}),
155
+ // An update asks about what it touched and what an earlier run left pending; a rebuild about everything.
156
+ ...(only ? { only } : {}),
157
+ ...(keepSources.size > 0 ? { keepSources } : {}),
97
158
  ...(taskSteps ? { taskSteps } : {}),
98
159
  summaryItems: (refs) => summaryItemsFor(openGraphStore(context.graphRoot, { company: context.company }), refs),
99
160
  });
@@ -113,6 +174,49 @@ async function replayThenPass(command, context, options, deps, run) {
113
174
  report.totals.rowsAdded += task.rowsNew;
114
175
  }
115
176
  report.counters.pass_ms = Math.round(pass.seconds * 1000);
177
+ if (only && wantFollowUp) {
178
+ // A follow-up marker inside the scope whose task ran and did not build its item again. For a profile,
179
+ // a retype or a decision group that means the graph no longer asks the question, and the marker is
180
+ // dropped, counted and named in the summary. A digest is never dropped: its source may only be off
181
+ // this machine for now. Page summaries are left to the page compiler, which sends its own.
182
+ const ran = new Set(pass.tasks.map((task) => task.task));
183
+ const seen = new Set();
184
+ for (const entry of steps)
185
+ for (const id of entry.seenItems())
186
+ seen.add(id);
187
+ const notBuilt = step.pending().filter((marker) => {
188
+ const task = followUpTask(marker);
189
+ if (!task || task === "summaries" || !ran.has(task) || seen.has(marker.id))
190
+ return false;
191
+ const refs = followUpEntities(marker);
192
+ return refs.length > 0 && refs.every((ref) => only.has(ref));
193
+ });
194
+ const dropped = new Map();
195
+ let keptDigests = 0;
196
+ for (const marker of notBuilt) {
197
+ const task = followUpTask(marker);
198
+ if (task === "digest")
199
+ keptDigests += 1;
200
+ else
201
+ dropped.set(task, [...(dropped.get(task) ?? []), marker]);
202
+ }
203
+ for (const [task, markers] of [...dropped].sort()) {
204
+ const count = step.dropPending(markers.map((marker) => marker.id));
205
+ report.counters[`pass_pending_dropped_${task}`] = count;
206
+ report.notes.push(`Dropped ${String(count)} pending ${task} ${count === 1 ? "item" : "items"}: ${DROP_REASON[task] ?? "the graph no longer builds the item"}.`);
207
+ }
208
+ if (keptDigests > 0) {
209
+ report.counters.pass_pending_digests_not_built = keptDigests;
210
+ report.notes.push(`${String(keptDigests)} pending ${keptDigests === 1 ? "digest was" : "digests were"} not built this run (the source file is not on this machine, or a signal covers the source now): kept pending, not dropped.`);
211
+ }
212
+ if (!changed) {
213
+ const sent = pass.tasks.reduce((sum, task) => sum + task.stats.calls, 0);
214
+ report.notes.push(`Nothing new; follow-up work from earlier runs was looked at again on ${String(followUp.size)} ${followUp.size === 1 ? "entity" : "entities"} (${String(sent)} model ${sent === 1 ? "call" : "calls"}).`);
215
+ }
216
+ }
217
+ else if (isUpdate) {
218
+ sayPending(followUpOf(step.pending()));
219
+ }
116
220
  if (halted)
117
221
  report.notes.push(`Model pass stopped (${halted}): what was not sent is left pending for the next run.`);
118
222
  }
@@ -123,6 +227,8 @@ async function replayThenPass(command, context, options, deps, run) {
123
227
  }
124
228
  }
125
229
  // What the pass changed joins what the replay changed, so the closing lint of an update sees both.
230
+ if (command === "update" && !report.touched)
231
+ report.touched = [];
126
232
  if (report.touched) {
127
233
  const byPass = openGraphStore(context.graphRoot, { company: context.company }).readDirty().filter((ref) => !dirtyBefore.has(ref));
128
234
  report.touched = [...new Set([...report.touched, ...byPass])].sort();
@@ -62,6 +62,49 @@ export interface SupersessionPlan {
62
62
  * incoming row is written closed on the open row's valid-from day.
63
63
  */
64
64
  export declare function planSupersession(schema: GraphSchema, entity: EntityRef, audience: AudienceKey, existing: readonly StoredRow[], incoming: Stamped): SupersessionPlan;
65
+ /** Fact fields where a model's low-confidence value reads as an established fact when printed beside record rows. */
66
+ export declare const GUESS_FIELDS: ReadonlySet<string>;
67
+ /** Relationships that say the same thing as an affiliation fact: who a person works for. */
68
+ export declare const GUESS_EMPLOYER_VERBS: ReadonlySet<string>;
69
+ /** Relationships that state a place in a hierarchy: who reports to, manages, leads or belongs to whom. */
70
+ export declare const GUESS_HIERARCHY_VERBS: ReadonlySet<string>;
71
+ /** Relationships that state who owns a thing: a project's owner is printed as a fact by the brief and the pages. */
72
+ export declare const GUESS_OWNERSHIP_VERBS: ReadonlySet<string>;
73
+ /** Every relationship the rule can cover. */
74
+ export declare const GUESS_VERBS: ReadonlySet<string>;
75
+ /** A model row in those fields and verbs is shown as a fact only at or above this confidence. */
76
+ export declare const GUESS_CONFIDENCE_BELOW = 0.7;
77
+ export interface GuessOptions {
78
+ /**
79
+ * Also treat a relationship as a guess. `true`: employer relationships (`works_at`, `employs`),
80
+ * hierarchy relationships (`reports_to`, `manages`, `member_of`, `has_member`, `leads`,
81
+ * `led_by`) and ownership (`owned_by`, `owns`), for readers that print a relationship with no
82
+ * origin and no confidence beside it. `"hierarchy"`: the hierarchy and ownership relationships
83
+ * only, for a reader that must keep model-written employer rows (a customer's contact list on
84
+ * a compiled page). Default false.
85
+ */
86
+ edges?: boolean | "hierarchy";
87
+ }
88
+ /**
89
+ * True for a role or an affiliation a model wrote (`by agent:<model>`) below the
90
+ * confidence line, and with `edges` for an employer, hierarchy or ownership relationship too. Record, rule,
91
+ * human and legacy rows are never guesses, whatever their confidence, and neither
92
+ * is a model row in any other field or verb.
93
+ */
94
+ export declare function isUnverifiedGuess(row: StoredRow["row"], options?: GuessOptions): boolean;
95
+ /**
96
+ * The rows a reader may present as fact: every row but the live unverified
97
+ * guesses, with how many were left out. Readers call this before they pick the
98
+ * winner of a field, so a newer guess never hides an older established row.
99
+ * `live` says which rows the reader is about to show (open rows by default; a
100
+ * reader answering for a past day passes `rowCoversDay`).
101
+ */
102
+ export declare function dropUnverifiedGuesses<T extends StoredRow>(rows: readonly T[], options?: GuessOptions & {
103
+ live?: (row: Stamped) => boolean;
104
+ }): {
105
+ rows: T[];
106
+ leftOut: number;
107
+ };
65
108
  /**
66
109
  * The facts that answer "what is true" for one entity (design 2.7): for a
67
110
  * single-valued field, the open row with the highest authority, then the
@@ -128,6 +128,45 @@ function better(a, b) {
128
128
  return a.row.conf > b.row.conf;
129
129
  return a.id < b.id;
130
130
  }
131
+ /** Fact fields where a model's low-confidence value reads as an established fact when printed beside record rows. */
132
+ export const GUESS_FIELDS = new Set(["role_title", "affiliation"]);
133
+ /** Relationships that say the same thing as an affiliation fact: who a person works for. */
134
+ export const GUESS_EMPLOYER_VERBS = new Set(["works_at", "employs"]);
135
+ /** Relationships that state a place in a hierarchy: who reports to, manages, leads or belongs to whom. */
136
+ export const GUESS_HIERARCHY_VERBS = new Set(["reports_to", "manages", "member_of", "has_member", "leads", "led_by"]);
137
+ /** Relationships that state who owns a thing: a project's owner is printed as a fact by the brief and the pages. */
138
+ export const GUESS_OWNERSHIP_VERBS = new Set(["owned_by", "owns"]);
139
+ /** Every relationship the rule can cover. */
140
+ export const GUESS_VERBS = new Set([...GUESS_EMPLOYER_VERBS, ...GUESS_HIERARCHY_VERBS, ...GUESS_OWNERSHIP_VERBS]);
141
+ /** A model row in those fields and verbs is shown as a fact only at or above this confidence. */
142
+ export const GUESS_CONFIDENCE_BELOW = 0.7;
143
+ /**
144
+ * True for a role or an affiliation a model wrote (`by agent:<model>`) below the
145
+ * confidence line, and with `edges` for an employer, hierarchy or ownership relationship too. Record, rule,
146
+ * human and legacy rows are never guesses, whatever their confidence, and neither
147
+ * is a model row in any other field or verb.
148
+ */
149
+ export function isUnverifiedGuess(row, options = {}) {
150
+ if (row.kind === "T" || !row.by.startsWith("agent:") || !(row.conf < GUESS_CONFIDENCE_BELOW))
151
+ return false;
152
+ if (row.kind === "F")
153
+ return GUESS_FIELDS.has(row.field);
154
+ if (options.edges === true)
155
+ return GUESS_VERBS.has(row.verb);
156
+ return options.edges === "hierarchy" && (GUESS_HIERARCHY_VERBS.has(row.verb) || GUESS_OWNERSHIP_VERBS.has(row.verb));
157
+ }
158
+ /**
159
+ * The rows a reader may present as fact: every row but the live unverified
160
+ * guesses, with how many were left out. Readers call this before they pick the
161
+ * winner of a field, so a newer guess never hides an older established row.
162
+ * `live` says which rows the reader is about to show (open rows by default; a
163
+ * reader answering for a past day passes `rowCoversDay`).
164
+ */
165
+ export function dropUnverifiedGuesses(rows, options = {}) {
166
+ const live = options.live ?? isOpen;
167
+ const kept = rows.filter((stored) => stored.row.kind === "T" || !isUnverifiedGuess(stored.row, options) || !live(stored.row));
168
+ return { rows: kept, leftOut: rows.length - kept.length };
169
+ }
131
170
  /**
132
171
  * The facts that answer "what is true" for one entity (design 2.7): for a
133
172
  * single-valued field, the open row with the highest authority, then the
@@ -7,6 +7,6 @@ export type { RowParseResult } from "./grammar.js";
7
7
  export { DEFAULT_SCHEMA, parseSchemaYaml, renderSchemaYaml } from "./default-schema.js";
8
8
  export { SchemaError } from "./default-schema.js";
9
9
  export { validateEntityUpsert, validateRow } from "./validate.js";
10
- export { effectiveFacts, inverseEdge, isOpen, isSingleValued, planSupersession, rowCoversDay, singleValueKey, } from "./authority.js";
10
+ export { GUESS_CONFIDENCE_BELOW, GUESS_EMPLOYER_VERBS, GUESS_FIELDS, GUESS_HIERARCHY_VERBS, GUESS_OWNERSHIP_VERBS, GUESS_VERBS, dropUnverifiedGuesses, effectiveFacts, isUnverifiedGuess, inverseEdge, isOpen, isSingleValued, planSupersession, rowCoversDay, singleValueKey, } from "./authority.js";
11
11
  export type { SupersessionPlan } from "./authority.js";
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -6,5 +6,5 @@ export { RowGrammarError, compareRows, entityRef, escapeText, formatConf, format
6
6
  export { DEFAULT_SCHEMA, parseSchemaYaml, renderSchemaYaml } from "./default-schema.js";
7
7
  export { SchemaError } from "./default-schema.js";
8
8
  export { validateEntityUpsert, validateRow } from "./validate.js";
9
- export { effectiveFacts, inverseEdge, isOpen, isSingleValued, planSupersession, rowCoversDay, singleValueKey, } from "./authority.js";
9
+ export { GUESS_CONFIDENCE_BELOW, GUESS_EMPLOYER_VERBS, GUESS_FIELDS, GUESS_HIERARCHY_VERBS, GUESS_OWNERSHIP_VERBS, GUESS_VERBS, dropUnverifiedGuesses, effectiveFacts, isUnverifiedGuess, inverseEdge, isOpen, isSingleValued, planSupersession, rowCoversDay, singleValueKey, } from "./authority.js";
10
10
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,88 @@
1
+ import { type OntologyReader } from "../read/reader-setting.js";
2
+ import { type CommandOutput } from "../types.js";
3
+ /** What the setup commands need: no member, and a graph root that has not been checked. */
4
+ export interface SetupContext {
5
+ hqRoot: string;
6
+ company: string;
7
+ companyRoot: string;
8
+ /** The folder `status` describes: `--graph-root`, else the env var, else the company's own. */
9
+ graphRoot: string;
10
+ json: boolean;
11
+ }
12
+ /** A request the command refuses. The command file turns it into a usage error. */
13
+ export declare class OntologySetupError extends Error {
14
+ constructor(message: string);
15
+ }
16
+ export type GraphStampState = "ok" | "missing" | "unstamped" | "other-company" | "unreadable";
17
+ export interface GraphFolderState {
18
+ /** Absolute path. */
19
+ root: string;
20
+ /** True when the folder has an `entities` folder. */
21
+ present: boolean;
22
+ /** The company in `.state/company`, or null when there is no stamp or it cannot be trusted. */
23
+ stamp: string | null;
24
+ state: GraphStampState;
25
+ /** One line in plain words. */
26
+ detail: string;
27
+ }
28
+ /** Says whether a graph folder exists and whose it says it is. Never throws and never writes. */
29
+ export declare function inspectGraphFolder(root: string, company: string): GraphFolderState;
30
+ export interface ReaderCommandOptions {
31
+ /** `graph` or `entities` to set; absent to show. */
32
+ value?: string;
33
+ }
34
+ /**
35
+ * The setting text with `reader:` and `company:` set. Every other line is
36
+ * kept as it is (comments, `member:`). The first line of each key is
37
+ * replaced and a repeated one is dropped, so the two readers of the file
38
+ * (line by line in the shell hook, `parseReaderSetting` here) cannot disagree.
39
+ */
40
+ export declare function renderReaderSetting(existing: string | null, reader: OntologyReader, company: string): string;
41
+ /** `hq ontology reader [graph|entities]`: show or set which ontology this machine's sessions read for the company. */
42
+ export declare function readerCommand(context: SetupContext, options?: ReaderCommandOptions): Promise<CommandOutput>;
43
+ export type ModelSource = "env" | "setting" | "default";
44
+ export interface ModelState {
45
+ model: string;
46
+ source: ModelSource;
47
+ /** `model:` in the settings file, or null when the file has none that is a model name. */
48
+ setting: string | null;
49
+ /** HQ_ONTOLOGY_MODEL when it is a model name, else null. */
50
+ env: string | null;
51
+ }
52
+ /** The model the step would call on this machine and where that comes from. Reads only. */
53
+ export declare function readModelState(context: Pick<SetupContext, "companyRoot">, env?: NodeJS.ProcessEnv): ModelState;
54
+ /**
55
+ * The settings text with the top-level `model:` set. Every other line is
56
+ * kept. A top-level `model:` wins over `ontology.model` when the step reads
57
+ * the file, so a file that only has the nested key gets the top-level one.
58
+ */
59
+ export declare function renderModelSetting(existing: string | null, model: string): string;
60
+ export interface ModelCommandOptions {
61
+ /** A model name to set; absent to show. */
62
+ value?: string;
63
+ env?: NodeJS.ProcessEnv;
64
+ }
65
+ /** `hq ontology model [<model>]`: show or set the model the graph's model step calls for the company on this machine. */
66
+ export declare function modelCommand(context: SetupContext, options?: ModelCommandOptions): Promise<CommandOutput>;
67
+ export interface GraphCounts {
68
+ entities: number;
69
+ entitiesByType: Record<string, number>;
70
+ rows: number;
71
+ facts: number;
72
+ relationships: number;
73
+ datedLines: number;
74
+ /** Audience folders under `facts/`, the company-wide one included. */
75
+ audienceFolders: number;
76
+ }
77
+ /**
78
+ * Counts entity files and row lines straight from the folder. It opens no
79
+ * store, builds no index and prints no row: only how many there are. Links
80
+ * are not followed.
81
+ */
82
+ export declare function countGraph(root: string): GraphCounts;
83
+ export interface StatusCommandOptions {
84
+ env?: NodeJS.ProcessEnv;
85
+ }
86
+ /** `hq ontology status`: reader, model, graph, counts, pending model work, last update and brief, on one screen. Reads only. */
87
+ export declare function statusCommand(context: SetupContext, options?: StatusCommandOptions): Promise<CommandOutput>;
88
+ //# sourceMappingURL=index.d.ts.map