@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.
- package/CHANGELOG.md +102 -0
- package/contracts/host-canary-release.json +3 -3
- package/dist/command-catalog.generated.d.ts +195 -1
- package/dist/command-catalog.generated.js +241 -1
- package/dist/commands/bot.js +5 -1
- package/dist/commands/lanes.d.ts +2 -0
- package/dist/commands/lanes.js +9 -4
- package/dist/commands/ontology-graph.d.ts +9 -2
- package/dist/commands/ontology-graph.js +97 -4
- package/dist/commands/sources.js +26 -8
- package/dist/lib/bot/fleet-cron.d.ts +2 -0
- package/dist/lib/bot/fleet-cron.js +5 -0
- package/dist/lib/hook-engine/coverage.d.ts +18 -7
- package/dist/lib/hook-engine/coverage.js +58 -20
- package/dist/lib/hook-engine/native-stop-compatibility.json +9 -4
- package/dist/lib/hot-channels/graph-context.d.ts +26 -1
- package/dist/lib/hot-channels/graph-context.js +76 -9
- package/dist/lib/hot-channels/run.d.ts +1 -0
- package/dist/lib/hot-channels/signals-pass.js +9 -4
- package/dist/lib/ontology-graph/model/files.d.ts +4 -0
- package/dist/lib/ontology-graph/model/files.js +23 -0
- package/dist/lib/ontology-graph/model/index.d.ts +11 -1
- package/dist/lib/ontology-graph/model/index.js +42 -18
- package/dist/lib/ontology-graph/model/pass-tasks.d.ts +9 -1
- package/dist/lib/ontology-graph/model/pass-tasks.js +7 -4
- package/dist/lib/ontology-graph/model/pass.d.ts +5 -0
- package/dist/lib/ontology-graph/model/pass.js +8 -8
- package/dist/lib/ontology-graph/model/pending-items.d.ts +31 -0
- package/dist/lib/ontology-graph/model/pending-items.js +113 -0
- package/dist/lib/ontology-graph/model/step.d.ts +46 -1
- package/dist/lib/ontology-graph/model/step.js +202 -36
- package/dist/lib/ontology-graph/model/tasks.d.ts +17 -1
- package/dist/lib/ontology-graph/model/tasks.js +28 -8
- package/dist/lib/ontology-graph/pages/render.d.ts +1 -1
- package/dist/lib/ontology-graph/pages/render.js +4 -3
- package/dist/lib/ontology-graph/read/brief.d.ts +13 -3
- package/dist/lib/ontology-graph/read/brief.js +311 -64
- package/dist/lib/ontology-graph/read/index.d.ts +1 -1
- package/dist/lib/ontology-graph/read/index.js +1 -1
- package/dist/lib/ontology-graph/read/reader-setting.d.ts +2 -0
- package/dist/lib/ontology-graph/read/reader-setting.js +4 -1
- package/dist/lib/ontology-graph/remodel/index.d.ts +174 -0
- package/dist/lib/ontology-graph/remodel/index.js +450 -0
- package/dist/lib/ontology-graph/replay/index.js +113 -7
- package/dist/lib/ontology-graph/schema/authority.d.ts +14 -5
- package/dist/lib/ontology-graph/schema/authority.js +13 -3
- package/dist/lib/ontology-graph/schema/index.d.ts +1 -1
- package/dist/lib/ontology-graph/schema/index.js +1 -1
- package/dist/lib/ontology-graph/setup/index.d.ts +88 -0
- package/dist/lib/ontology-graph/setup/index.js +489 -0
- package/dist/lib/ontology-graph/types.d.ts +21 -0
- package/dist/lib/ontology-graph/types.js +5 -0
- package/dist/lib/signals/failure-alert.js +4 -5
- package/dist/lib/signals/steps/adapters.js +3 -0
- package/dist/utils/sync-person.d.ts +15 -0
- package/dist/utils/sync-person.js +74 -0
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AudienceKey, type CommandOutput, type GraphContext, type GraphStore, type LookupOptions, type NeighborsOptions, type Resolver, type SearchOptions, type TraverseOptions } from "../types.js";
|
|
2
2
|
import { type AudienceFilter } from "./graph-index.js";
|
|
3
|
-
export { briefCommand, buildBrief, estimateTokens, BRIEF_MAX_TOKENS } from "./brief.js";
|
|
3
|
+
export { briefCommand, buildBrief, estimateTokens, resolveBriefStyle, BRIEF_DEFAULT_STYLE, BRIEF_MAX_TOKENS } from "./brief.js";
|
|
4
4
|
export type { BriefExtras } from "./brief.js";
|
|
5
5
|
export { graphReaderEnabled, readReaderSetting, readerSettingFile } from "./reader-setting.js";
|
|
6
6
|
export { loadReadIndex, forgetReadIndex, READ_INDEX_RELATIVE } from "./graph-index.js";
|
|
@@ -30,7 +30,7 @@ import { openGraphStore, pageFile } from "../store/index.js";
|
|
|
30
30
|
import { COMPANY_AUDIENCE, } from "../types.js";
|
|
31
31
|
import { graphExists, loadReadIndex, visible, } from "./graph-index.js";
|
|
32
32
|
import { indexedFacts, resolveName, searchIndex } from "./names.js";
|
|
33
|
-
export { briefCommand, buildBrief, estimateTokens, BRIEF_MAX_TOKENS } from "./brief.js";
|
|
33
|
+
export { briefCommand, buildBrief, estimateTokens, resolveBriefStyle, BRIEF_DEFAULT_STYLE, BRIEF_MAX_TOKENS } from "./brief.js";
|
|
34
34
|
export { graphReaderEnabled, readReaderSetting, readerSettingFile } from "./reader-setting.js";
|
|
35
35
|
export { loadReadIndex, forgetReadIndex, READ_INDEX_RELATIVE } from "./graph-index.js";
|
|
36
36
|
export { resolveName, searchIndex } from "./names.js";
|
|
@@ -6,6 +6,8 @@ export interface ReaderSetting {
|
|
|
6
6
|
company: string;
|
|
7
7
|
/** `person/<slug>` of the member, or "" when absent. */
|
|
8
8
|
member: string;
|
|
9
|
+
/** `map` or `full` when the file names one, else "" (the brief's default applies). */
|
|
10
|
+
briefStyle: "map" | "full" | "";
|
|
9
11
|
/** False when the file is missing or unreadable (the default applies). */
|
|
10
12
|
present: boolean;
|
|
11
13
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* reader: entities # entities (old files) | graph (new graph)
|
|
11
11
|
* company: indigo # company whose graph the session brief comes from
|
|
12
12
|
* member: person/<slug> # optional: the member's own entity, for the brief
|
|
13
|
+
* brief_style: map # optional: map (default) | full, the shape `hq ontology brief` writes
|
|
13
14
|
*
|
|
14
15
|
* The file is parsed line by line on purpose: the hook reads it with shell
|
|
15
16
|
* builtins and both readers must agree on what counts as a value.
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
import * as fs from "node:fs";
|
|
18
19
|
import * as path from "node:path";
|
|
19
20
|
export const READER_SETTING_RELATIVE = "personal/settings/ontology-reader.yaml";
|
|
20
|
-
const DEFAULT_SETTING = { reader: "entities", company: "", member: "", present: false };
|
|
21
|
+
const DEFAULT_SETTING = { reader: "entities", company: "", member: "", briefStyle: "", present: false };
|
|
21
22
|
const MAX_SETTING_BYTES = 4096;
|
|
22
23
|
export function readerSettingFile(hqRoot) {
|
|
23
24
|
return path.join(hqRoot, ...READER_SETTING_RELATIVE.split("/"));
|
|
@@ -38,6 +39,8 @@ export function parseReaderSetting(text) {
|
|
|
38
39
|
else if (key === "member") {
|
|
39
40
|
out.member = /^person\/[a-z0-9][a-z0-9._-]*$/.test(value) && !value.includes("..") ? value : "";
|
|
40
41
|
}
|
|
42
|
+
else if (key === "brief_style")
|
|
43
|
+
out.briefStyle = value === "map" || value === "full" ? value : "";
|
|
41
44
|
}
|
|
42
45
|
return out;
|
|
43
46
|
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq ontology remodel`: replace the rows one model wrote with what the model
|
|
3
|
+
* in use now says.
|
|
4
|
+
*
|
|
5
|
+
* Rows by two models are of the same authority, so running the pass again on a
|
|
6
|
+
* better model adds its rows beside the weaker model's and leaves those open.
|
|
7
|
+
* This command asks again, on the configured model, the questions behind the
|
|
8
|
+
* open rows written `by agent:<from>`, and closes those rows through the
|
|
9
|
+
* store's own closure (`closeRow`: the row keeps its id and its line, with
|
|
10
|
+
* `closed <day> by <ref>`; nothing is deleted).
|
|
11
|
+
*
|
|
12
|
+
* What it can ask again is what the graph pass wrote and recorded in
|
|
13
|
+
* `.state/model-rows.jsonl`: digests of meetings and threads, and profiles
|
|
14
|
+
* (role, employer, stage, contacts). For each of those rows it knows the item
|
|
15
|
+
* that produced it. A row is closed only when that item was answered in this
|
|
16
|
+
* run; an item the budget did not reach keeps its rows open for the next run.
|
|
17
|
+
* Rows the replay wrote (typed relationships, extractions), retyped edges and
|
|
18
|
+
* decision supersessions are counted and left as they are.
|
|
19
|
+
*
|
|
20
|
+
* Order: ask (model turns, nothing written), close the old rows of the
|
|
21
|
+
* answered items, write the new rows from the cached answers. The old rows are
|
|
22
|
+
* out of the way before the new ones arrive, so the new model's value is never
|
|
23
|
+
* written closed behind a weaker model's newer row.
|
|
24
|
+
*
|
|
25
|
+
* Closing and writing are two steps, so the run writes down what it is about to
|
|
26
|
+
* do first (`.state/remodel-intent.json`: the rows to close, the items behind
|
|
27
|
+
* them, the model). A run that is killed between the two leaves that file. The
|
|
28
|
+
* next run finishes the job before it does anything else: it closes what was
|
|
29
|
+
* not yet closed, writes the new rows from the cached answers, and reopens any
|
|
30
|
+
* row whose item has no usable answer after all. Only then is the file marked
|
|
31
|
+
* finished. A row is therefore never left closed with nothing asked in its place.
|
|
32
|
+
*/
|
|
33
|
+
import { type BatchModelStep, type PassTask } from "../model/index.js";
|
|
34
|
+
import { compilePages as defaultCompilePages } from "../pages/index.js";
|
|
35
|
+
import { briefCommand as defaultBriefCommand } from "../read/index.js";
|
|
36
|
+
import { type AudienceKey, type CommandOutput, type EntityRef, type GraphContext, type IsoDate, type MemberIdentity, type ModelRunner, type Origin, type RowId, type SourceRef } from "../types.js";
|
|
37
|
+
export interface RemodelOptions {
|
|
38
|
+
/** The model whose rows to replace: `haiku`, or `agent:haiku`. */
|
|
39
|
+
from: string;
|
|
40
|
+
/**
|
|
41
|
+
* Fact fields and verbs that pick what is asked again (`role_title`, `affiliation`, `works_at`). Default: every
|
|
42
|
+
* kind. An item is asked as a whole, so every row the old model wrote from the same source or the same profile
|
|
43
|
+
* is replaced with the rows that were picked.
|
|
44
|
+
*/
|
|
45
|
+
kinds?: readonly string[];
|
|
46
|
+
/** Cap on model input tokens for this run. */
|
|
47
|
+
budgetTokens?: number;
|
|
48
|
+
/** The daily cap for this run, as on `update` (`--max-input-tokens`, `--max-output-tokens`). */
|
|
49
|
+
maxInputTokens?: number;
|
|
50
|
+
maxOutputTokens?: number;
|
|
51
|
+
/** Count and estimate; call no model and write nothing. */
|
|
52
|
+
dryRun: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Seams for tests. Production passes nothing. */
|
|
55
|
+
export interface RemodelDeps {
|
|
56
|
+
runner?: ModelRunner;
|
|
57
|
+
/** The step to ask through. Default: a step on the configured model with the run's caps. */
|
|
58
|
+
step?: BatchModelStep;
|
|
59
|
+
now?: () => Date;
|
|
60
|
+
env?: NodeJS.ProcessEnv;
|
|
61
|
+
resolveMember?: (context: GraphContext) => MemberIdentity | null;
|
|
62
|
+
compilePages?: typeof defaultCompilePages | null;
|
|
63
|
+
brief?: typeof defaultBriefCommand | null;
|
|
64
|
+
/** Called after the old rows are closed and before the new ones are written. A test throws here, as a kill would. */
|
|
65
|
+
afterClose?: () => void;
|
|
66
|
+
}
|
|
67
|
+
/** Where a run writes what it is about to close and write, relative to the graph folder. */
|
|
68
|
+
export declare const REMODEL_INTENT_RELATIVE = ".state/remodel-intent.json";
|
|
69
|
+
interface IntentClosure {
|
|
70
|
+
entity: EntityRef;
|
|
71
|
+
audience: AudienceKey;
|
|
72
|
+
id: RowId;
|
|
73
|
+
on: IsoDate;
|
|
74
|
+
by: SourceRef;
|
|
75
|
+
/** The items of the pass that cover the row (`itemKeys`). */
|
|
76
|
+
items: string[];
|
|
77
|
+
/** The other end of a relationship, closed and reopened with it. */
|
|
78
|
+
inverse?: {
|
|
79
|
+
entity: EntityRef;
|
|
80
|
+
id: RowId;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** What one run is about to close and write. On file from before the first row is closed until the last row is written. */
|
|
84
|
+
export interface RemodelIntent {
|
|
85
|
+
version: 1;
|
|
86
|
+
run: string;
|
|
87
|
+
from: Origin;
|
|
88
|
+
model: string;
|
|
89
|
+
day: IsoDate;
|
|
90
|
+
tasks: PassTask[];
|
|
91
|
+
only: EntityRef[];
|
|
92
|
+
closures: IntentClosure[];
|
|
93
|
+
/** Set when the run is complete. A file with it is history, not work to finish. */
|
|
94
|
+
finished?: string;
|
|
95
|
+
}
|
|
96
|
+
/** The intent of a run that did not finish, or null. An unreadable file is no intent: nothing in it can be trusted to close a row. */
|
|
97
|
+
export declare function readUnfinishedRemodel(graphRoot: string): RemodelIntent | null;
|
|
98
|
+
/** Thrown for a request the command cannot carry out as given. */
|
|
99
|
+
export declare class RemodelUsageError extends Error {
|
|
100
|
+
constructor(message: string);
|
|
101
|
+
}
|
|
102
|
+
export interface RemodelReport {
|
|
103
|
+
from: Origin;
|
|
104
|
+
/** The model asked now. */
|
|
105
|
+
model: string;
|
|
106
|
+
day: IsoDate;
|
|
107
|
+
dryRun: boolean;
|
|
108
|
+
kinds: string[];
|
|
109
|
+
rows: {
|
|
110
|
+
/** Open fact and relationship rows by the old model (and of the kinds asked for), both ends of a relationship counted. */
|
|
111
|
+
open: number;
|
|
112
|
+
byKind: Record<string, number>;
|
|
113
|
+
/** Of those, rows the pass wrote as a digest or a profile: the ones this command can ask about again. */
|
|
114
|
+
askable: number;
|
|
115
|
+
/** Rows with no record of the task that wrote them: the replay's typed relationships and extractions. */
|
|
116
|
+
noRecord: number;
|
|
117
|
+
/** Rows of a task that cannot be asked again from the graph (retyped edges, decision supersessions). */
|
|
118
|
+
otherTask: number;
|
|
119
|
+
/** With `kinds`: rows of other kinds that the same items wrote, replaced with them. */
|
|
120
|
+
sameItem: number;
|
|
121
|
+
};
|
|
122
|
+
/** Items (one source to digest, one entity to profile) behind the askable rows. */
|
|
123
|
+
items: {
|
|
124
|
+
total: number;
|
|
125
|
+
byTask: Partial<Record<PassTask, number>>;
|
|
126
|
+
answered: number;
|
|
127
|
+
cached: number;
|
|
128
|
+
pending: number;
|
|
129
|
+
};
|
|
130
|
+
/** Dry run: what asking would send. Input tokens are an estimate from the size of the turns. */
|
|
131
|
+
estimate?: {
|
|
132
|
+
itemsToSend: number;
|
|
133
|
+
inputTokens: number;
|
|
134
|
+
};
|
|
135
|
+
/** Rows of answered items, closed. Both ends of a relationship counted. */
|
|
136
|
+
closed: number;
|
|
137
|
+
/** Closed rows the new model stated again (same field, or same relationship). */
|
|
138
|
+
replaced: number;
|
|
139
|
+
/** Closed rows the new model did not state again when it read the same source. */
|
|
140
|
+
notRestated: number;
|
|
141
|
+
/** Askable rows whose item was not answered in this run (budget, usage limit): still open. */
|
|
142
|
+
leftOpen: number;
|
|
143
|
+
rowsAdded: number;
|
|
144
|
+
usage: {
|
|
145
|
+
inputTokens: number;
|
|
146
|
+
outputTokens: number;
|
|
147
|
+
calls: number;
|
|
148
|
+
};
|
|
149
|
+
/** Rows closed for an item that turned out to have no usable answer when the new rows were written: open again. */
|
|
150
|
+
reopened: number;
|
|
151
|
+
/** An earlier run that was interrupted between closing and writing, finished by this one before anything else. */
|
|
152
|
+
resumed?: {
|
|
153
|
+
run: string;
|
|
154
|
+
from: Origin;
|
|
155
|
+
model: string;
|
|
156
|
+
closed: number;
|
|
157
|
+
rowsAdded: number;
|
|
158
|
+
reopened: number;
|
|
159
|
+
};
|
|
160
|
+
cap: {
|
|
161
|
+
dayInputTokens: number;
|
|
162
|
+
dayOutputTokens: number;
|
|
163
|
+
overridden: boolean;
|
|
164
|
+
runInputTokens?: number;
|
|
165
|
+
};
|
|
166
|
+
halted: string | null;
|
|
167
|
+
notes: string[];
|
|
168
|
+
}
|
|
169
|
+
export declare function runRemodel(context: GraphContext, options: RemodelOptions, deps?: RemodelDeps): Promise<RemodelReport>;
|
|
170
|
+
export declare function formatRemodelReport(report: RemodelReport): string;
|
|
171
|
+
/** `hq ontology remodel`. */
|
|
172
|
+
export declare function remodelCommand(context: GraphContext, options: RemodelOptions, deps?: RemodelDeps): Promise<CommandOutput>;
|
|
173
|
+
export {};
|
|
174
|
+
//# sourceMappingURL=index.d.ts.map
|