@indigoai-us/hq-cli 5.345.250 → 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 (57) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/contracts/host-canary-release.json +3 -3
  3. package/dist/command-catalog.generated.d.ts +195 -1
  4. package/dist/command-catalog.generated.js +241 -1
  5. package/dist/commands/bot.js +5 -1
  6. package/dist/commands/lanes.d.ts +2 -0
  7. package/dist/commands/lanes.js +9 -4
  8. package/dist/commands/ontology-graph.d.ts +9 -2
  9. package/dist/commands/ontology-graph.js +97 -4
  10. package/dist/commands/sources.js +26 -8
  11. package/dist/lib/bot/fleet-cron.d.ts +2 -0
  12. package/dist/lib/bot/fleet-cron.js +5 -0
  13. package/dist/lib/hook-engine/coverage.d.ts +18 -7
  14. package/dist/lib/hook-engine/coverage.js +58 -20
  15. package/dist/lib/hook-engine/native-stop-compatibility.json +9 -4
  16. package/dist/lib/hot-channels/graph-context.d.ts +26 -1
  17. package/dist/lib/hot-channels/graph-context.js +76 -9
  18. package/dist/lib/hot-channels/run.d.ts +1 -0
  19. package/dist/lib/hot-channels/signals-pass.js +9 -4
  20. package/dist/lib/ontology-graph/model/files.d.ts +4 -0
  21. package/dist/lib/ontology-graph/model/files.js +23 -0
  22. package/dist/lib/ontology-graph/model/index.d.ts +11 -1
  23. package/dist/lib/ontology-graph/model/index.js +42 -18
  24. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +9 -1
  25. package/dist/lib/ontology-graph/model/pass-tasks.js +7 -4
  26. package/dist/lib/ontology-graph/model/pass.d.ts +5 -0
  27. package/dist/lib/ontology-graph/model/pass.js +8 -8
  28. package/dist/lib/ontology-graph/model/pending-items.d.ts +31 -0
  29. package/dist/lib/ontology-graph/model/pending-items.js +113 -0
  30. package/dist/lib/ontology-graph/model/step.d.ts +46 -1
  31. package/dist/lib/ontology-graph/model/step.js +202 -36
  32. package/dist/lib/ontology-graph/model/tasks.d.ts +17 -1
  33. package/dist/lib/ontology-graph/model/tasks.js +28 -8
  34. package/dist/lib/ontology-graph/pages/render.d.ts +1 -1
  35. package/dist/lib/ontology-graph/pages/render.js +4 -3
  36. package/dist/lib/ontology-graph/read/brief.d.ts +13 -3
  37. package/dist/lib/ontology-graph/read/brief.js +311 -64
  38. package/dist/lib/ontology-graph/read/index.d.ts +1 -1
  39. package/dist/lib/ontology-graph/read/index.js +1 -1
  40. package/dist/lib/ontology-graph/read/reader-setting.d.ts +2 -0
  41. package/dist/lib/ontology-graph/read/reader-setting.js +4 -1
  42. package/dist/lib/ontology-graph/remodel/index.d.ts +174 -0
  43. package/dist/lib/ontology-graph/remodel/index.js +450 -0
  44. package/dist/lib/ontology-graph/replay/index.js +113 -7
  45. package/dist/lib/ontology-graph/schema/authority.d.ts +14 -5
  46. package/dist/lib/ontology-graph/schema/authority.js +13 -3
  47. package/dist/lib/ontology-graph/schema/index.d.ts +1 -1
  48. package/dist/lib/ontology-graph/schema/index.js +1 -1
  49. package/dist/lib/ontology-graph/setup/index.d.ts +88 -0
  50. package/dist/lib/ontology-graph/setup/index.js +489 -0
  51. package/dist/lib/ontology-graph/types.d.ts +21 -0
  52. package/dist/lib/ontology-graph/types.js +5 -0
  53. package/dist/lib/signals/failure-alert.js +4 -5
  54. package/dist/lib/signals/steps/adapters.js +3 -0
  55. package/dist/utils/sync-person.d.ts +15 -0
  56. package/dist/utils/sync-person.js +74 -0
  57. package/package.json +7 -7
@@ -65,20 +65,29 @@ export declare function planSupersession(schema: GraphSchema, entity: EntityRef,
65
65
  /** Fact fields where a model's low-confidence value reads as an established fact when printed beside record rows. */
66
66
  export declare const GUESS_FIELDS: ReadonlySet<string>;
67
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. */
68
74
  export declare const GUESS_VERBS: ReadonlySet<string>;
69
75
  /** A model row in those fields and verbs is shown as a fact only at or above this confidence. */
70
76
  export declare const GUESS_CONFIDENCE_BELOW = 0.7;
71
77
  export interface GuessOptions {
72
78
  /**
73
- * Also treat an employer relationship (`works_at`, `employs`) as a guess. For readers that
74
- * print a relationship with no origin and no confidence beside it. Default false: a reader
75
- * that prints `by agent:<model>` on the line leaves the relationship in.
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.
76
85
  */
77
- edges?: boolean;
86
+ edges?: boolean | "hierarchy";
78
87
  }
79
88
  /**
80
89
  * True for a role or an affiliation a model wrote (`by agent:<model>`) below the
81
- * confidence line, and with `edges` for an employer relationship too. Record, rule,
90
+ * confidence line, and with `edges` for an employer, hierarchy or ownership relationship too. Record, rule,
82
91
  * human and legacy rows are never guesses, whatever their confidence, and neither
83
92
  * is a model row in any other field or verb.
84
93
  */
@@ -131,19 +131,29 @@ function better(a, b) {
131
131
  /** Fact fields where a model's low-confidence value reads as an established fact when printed beside record rows. */
132
132
  export const GUESS_FIELDS = new Set(["role_title", "affiliation"]);
133
133
  /** Relationships that say the same thing as an affiliation fact: who a person works for. */
134
- export const GUESS_VERBS = new Set(["works_at", "employs"]);
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]);
135
141
  /** A model row in those fields and verbs is shown as a fact only at or above this confidence. */
136
142
  export const GUESS_CONFIDENCE_BELOW = 0.7;
137
143
  /**
138
144
  * True for a role or an affiliation a model wrote (`by agent:<model>`) below the
139
- * confidence line, and with `edges` for an employer relationship too. Record, rule,
145
+ * confidence line, and with `edges` for an employer, hierarchy or ownership relationship too. Record, rule,
140
146
  * human and legacy rows are never guesses, whatever their confidence, and neither
141
147
  * is a model row in any other field or verb.
142
148
  */
143
149
  export function isUnverifiedGuess(row, options = {}) {
144
150
  if (row.kind === "T" || !row.by.startsWith("agent:") || !(row.conf < GUESS_CONFIDENCE_BELOW))
145
151
  return false;
146
- return row.kind === "F" ? GUESS_FIELDS.has(row.field) : options.edges === true && GUESS_VERBS.has(row.verb);
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));
147
157
  }
148
158
  /**
149
159
  * The rows a reader may present as fact: every row but the live unverified
@@ -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 { GUESS_CONFIDENCE_BELOW, GUESS_FIELDS, GUESS_VERBS, dropUnverifiedGuesses, effectiveFacts, isUnverifiedGuess, 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 { GUESS_CONFIDENCE_BELOW, GUESS_FIELDS, GUESS_VERBS, dropUnverifiedGuesses, effectiveFacts, isUnverifiedGuess, 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