@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
package/dist/commands/bot.js
CHANGED
|
@@ -14,6 +14,7 @@ import { checkClaudeLoginNow, readSignalsClaudeLogin, recordSignalsPassClaudeLog
|
|
|
14
14
|
import { fleetCompleteTargetFor } from "../lib/hot-channels/fleet-complete.js";
|
|
15
15
|
import { machineTimeZone } from "../lib/bot/job-run.js";
|
|
16
16
|
import { runCompanyHotChannelSync } from "./sources.js";
|
|
17
|
+
import { resolveSyncPerson } from "../utils/sync-person.js";
|
|
17
18
|
import { OwnerContextCache, lookupOwnerContext } from "../lib/bot/owner-context.js";
|
|
18
19
|
import { hasActivePromotion, localPromotionState } from "../lib/bot/promotion-receipt.js";
|
|
19
20
|
import { botBusyState, readInflightTurns } from "../lib/bot/inflight.js";
|
|
@@ -303,7 +304,8 @@ async function syncFleetRuntimeJobs(name, dir, config) {
|
|
|
303
304
|
executiveCompanies: role.executiveCompanies,
|
|
304
305
|
};
|
|
305
306
|
const signalsJobEnabled = await fleetHotSignalSyncEngineCompanies(jobs, undefined, (message) => log("warn", message));
|
|
306
|
-
const
|
|
307
|
+
const noPersonIdentity = resolveSyncPerson().kind === "no-person";
|
|
308
|
+
const result = ensureFleetHotSignalSync({ ...jobs, signalsJobEnabled, noPersonIdentity });
|
|
307
309
|
if (executive === false && result.removed.length > 0) {
|
|
308
310
|
log("info", `removed the daily hot-signal-sync from this bot (${result.removed.length} job${result.removed.length === 1 ? "" : "s"}): ${executiveBot ? `${executiveBot.name} is the Executive bot now and runs it` : "only the Executive bot runs it"}`);
|
|
309
311
|
}
|
|
@@ -316,6 +318,8 @@ async function syncFleetRuntimeJobs(name, dir, config) {
|
|
|
316
318
|
log("info", `registered the daily hot-signal-sync job for ${entry.company} at 06:30 in the HQ Fleet Runtime`);
|
|
317
319
|
if (entry.heldBy)
|
|
318
320
|
log("info", `not adding a hot-signal-sync job for ${entry.company}: the bot in ${entry.heldBy} already runs it`);
|
|
321
|
+
if (entry.noPersonIdentity)
|
|
322
|
+
log("warn", `not adding a hot-signal-sync job for ${entry.company}: this computer's HQ sign-in is a machine identity that acts for no person, so the sync would have no one to run for`);
|
|
319
323
|
}
|
|
320
324
|
}
|
|
321
325
|
catch (err) {
|
package/dist/commands/lanes.d.ts
CHANGED
|
@@ -136,6 +136,8 @@ export interface LanesCommandDeps {
|
|
|
136
136
|
export type MonitorLaneMessageApi = (laneId: string, payload: MonitorLaneMessagePayload) => Promise<MonitorLaneMessageResult>;
|
|
137
137
|
/** Build the same lane message handlers used by `hq runners _monitor-message`, without a CLI process boundary. */
|
|
138
138
|
export declare function createMonitorLaneMessageApi(hqRoot: string, cwd: string, env?: NodeJS.ProcessEnv): MonitorLaneMessageApi;
|
|
139
|
+
/** The monitor lane message handler registered on `program`, if any. */
|
|
140
|
+
export declare function monitorLaneMessageApiFor(program: Command): MonitorLaneMessageApi | undefined;
|
|
139
141
|
export declare function parseSeniorRef(raw: string): SeniorRef;
|
|
140
142
|
export declare function parseQuestionBody(raw: unknown): QuestionBody | null;
|
|
141
143
|
/**
|
package/dist/commands/lanes.js
CHANGED
|
@@ -265,11 +265,15 @@ export function createMonitorLaneMessageApi(hqRoot, cwd, env = process.env) {
|
|
|
265
265
|
cwd: () => cwd,
|
|
266
266
|
env: { ...env, HQ_ROOT: hqRoot },
|
|
267
267
|
});
|
|
268
|
-
const api =
|
|
268
|
+
const api = monitorLaneMessageApiFor(program);
|
|
269
269
|
if (!api)
|
|
270
270
|
throw new Error("Monitor lane message handler was not registered");
|
|
271
271
|
return api;
|
|
272
272
|
}
|
|
273
|
+
/** The monitor lane message handler registered on `program`, if any. */
|
|
274
|
+
export function monitorLaneMessageApiFor(program) {
|
|
275
|
+
return monitorLaneMessageApis.get(program);
|
|
276
|
+
}
|
|
273
277
|
function withoutProviderHome(value) {
|
|
274
278
|
if (Array.isArray(value))
|
|
275
279
|
return value.map(withoutProviderHome);
|
|
@@ -11038,11 +11042,12 @@ export function registerRunnersCommand(parent, deps = {}) {
|
|
|
11038
11042
|
daemonReconcileCtx.env.HQ_ROOT = hqRoot;
|
|
11039
11043
|
daemonReconcileCtx.cwd = () => hqRoot;
|
|
11040
11044
|
daemonReconcileCtx.callerCwd = () => hqRoot;
|
|
11041
|
-
|
|
11042
|
-
|
|
11045
|
+
const passCtx = { ...daemonReconcileCtx };
|
|
11046
|
+
await runReconcile(passCtx, { inProcess: true }, async (lane) => {
|
|
11047
|
+
await messageHandlers.recoverQueuedMessages(passCtx, lane.lane_id);
|
|
11043
11048
|
});
|
|
11044
11049
|
});
|
|
11045
|
-
monitorLaneMessageApis.set(parent, (laneId, payload) => messageHandlers.deliverMonitorLaneMessage(ctx, laneId, payload));
|
|
11050
|
+
monitorLaneMessageApis.set(parent, (laneId, payload) => messageHandlers.deliverMonitorLaneMessage({ ...ctx }, laneId, payload));
|
|
11046
11051
|
const resumeHandlers = createLaneResumeHandlers({
|
|
11047
11052
|
onLaneWorkerStarted: deps.onLaneWorkerStarted,
|
|
11048
11053
|
archiveResumeMessage,
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* src/lib/ontology-graph/ (see CONTRACT.md there), imported on demand so a
|
|
6
6
|
* read command never loads the replay engine.
|
|
7
7
|
*
|
|
8
|
-
* hq ontology
|
|
8
|
+
* hq ontology status | reader [graph|entities] | model [<model>] (setup: what this machine reads and builds with)
|
|
9
|
+
* hq ontology rebuild --company <slug> [--from D --to D] [--resume] [--budget-tokens N] [--max-input-tokens N] [--max-output-tokens N] [--no-model] [--dry-run]
|
|
9
10
|
* hq ontology update --company <slug> [--input <path>] [--budget-tokens N] [--no-model]
|
|
10
11
|
* hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
|
|
11
|
-
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief
|
|
12
|
+
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief [--style map|full]
|
|
12
13
|
* hq ontology org-chart draft | confirm --from <file> [--yes] | show
|
|
13
14
|
* hq ontology activity [<person>] [--roles] [--compare] [--write] [--view company|member] [--as-of D] [--model]
|
|
14
15
|
* (`hq ontology org observed|compare|person <name>` is the same thing under its first name, kept hidden)
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
* the old `ontology/entities/` folder) is a different command and is unchanged.
|
|
27
28
|
*/
|
|
28
29
|
import { Command } from "commander";
|
|
30
|
+
import type { SetupContext } from "../lib/ontology-graph/setup/index.js";
|
|
29
31
|
import type { GraphContext, MemberIdentity } from "../lib/ontology-graph/types.js";
|
|
30
32
|
export declare class OntologyGraphUsageError extends Error {
|
|
31
33
|
constructor(message: string);
|
|
@@ -58,6 +60,11 @@ export interface OntologyGraphCommandDeps {
|
|
|
58
60
|
}
|
|
59
61
|
/** Resolves the company and the graph folder for one invocation. */
|
|
60
62
|
export declare function resolveGraphContext(options: ScopeOptions): GraphContext;
|
|
63
|
+
/**
|
|
64
|
+
* The company and folders for a setup command (`status`, `reader`, `model`). The graph folder is not checked
|
|
65
|
+
* here: these commands report or refuse on its state themselves, and none reads a row from it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveSetupContext(options: ScopeOptions): SetupContext;
|
|
61
68
|
export declare function registerOntologyCommand(program: Command, deps?: OntologyGraphCommandDeps): Command;
|
|
62
69
|
export {};
|
|
63
70
|
//# sourceMappingURL=ontology-graph.d.ts.map
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* src/lib/ontology-graph/ (see CONTRACT.md there), imported on demand so a
|
|
6
6
|
* read command never loads the replay engine.
|
|
7
7
|
*
|
|
8
|
-
* hq ontology
|
|
8
|
+
* hq ontology status | reader [graph|entities] | model [<model>] (setup: what this machine reads and builds with)
|
|
9
|
+
* hq ontology rebuild --company <slug> [--from D --to D] [--resume] [--budget-tokens N] [--max-input-tokens N] [--max-output-tokens N] [--no-model] [--dry-run]
|
|
9
10
|
* hq ontology update --company <slug> [--input <path>] [--budget-tokens N] [--no-model]
|
|
10
11
|
* hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
|
|
11
|
-
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief
|
|
12
|
+
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief [--style map|full]
|
|
12
13
|
* hq ontology org-chart draft | confirm --from <file> [--yes] | show
|
|
13
14
|
* hq ontology activity [<person>] [--roles] [--compare] [--write] [--view company|member] [--as-of D] [--model]
|
|
14
15
|
* (`hq ontology org observed|compare|person <name>` is the same thing under its first name, kept hidden)
|
|
@@ -96,6 +97,11 @@ function clockArg(value) {
|
|
|
96
97
|
throw new InvalidArgumentError("expected a time as HH:MM");
|
|
97
98
|
return value;
|
|
98
99
|
}
|
|
100
|
+
function briefStyleArg(value) {
|
|
101
|
+
if (value !== "map" && value !== "full")
|
|
102
|
+
throw new InvalidArgumentError("expected map or full");
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
99
105
|
function depthArg(value) {
|
|
100
106
|
const parsed = Number(value);
|
|
101
107
|
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 3)
|
|
@@ -135,6 +141,25 @@ export function resolveGraphContext(options) {
|
|
|
135
141
|
...(member ? { member } : {}),
|
|
136
142
|
};
|
|
137
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The company and folders for a setup command (`status`, `reader`, `model`). The graph folder is not checked
|
|
146
|
+
* here: these commands report or refuse on its state themselves, and none reads a row from it.
|
|
147
|
+
*/
|
|
148
|
+
export function resolveSetupContext(options) {
|
|
149
|
+
const hqRoot = resolveLiveRoot({ hqRoot: options.hqRoot });
|
|
150
|
+
const resolution = resolveOntologyCompany(hqRoot, options.company);
|
|
151
|
+
if (!resolution.ok) {
|
|
152
|
+
throw new OntologyGraphUsageError(options.company ? `ontology: company rejected: ${resolution.reason}` : "ontology: --company <slug> is required");
|
|
153
|
+
}
|
|
154
|
+
const companyRoot = resolution.company.dir;
|
|
155
|
+
return {
|
|
156
|
+
hqRoot,
|
|
157
|
+
company: resolution.company.slug,
|
|
158
|
+
companyRoot,
|
|
159
|
+
graphRoot: resolveGraphRoot({ companyRoot, flag: options.graphRoot }),
|
|
160
|
+
json: Boolean(options.json),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
138
163
|
function orgViewArg(value) {
|
|
139
164
|
if (value !== "company" && value !== "member")
|
|
140
165
|
throw new InvalidArgumentError("expected company or member");
|
|
@@ -179,15 +204,52 @@ export function registerOntologyCommand(program, deps = {}) {
|
|
|
179
204
|
};
|
|
180
205
|
/** A read command: `run` with the member filled in from the sign-in when no flag names one. */
|
|
181
206
|
const read = (entry) => run(entry, "read");
|
|
207
|
+
/** Wraps a setup action: the company and folders, no member, and a graph folder the command looks at itself. */
|
|
208
|
+
const setup = (entry) => async function action(...raw) {
|
|
209
|
+
const args = raw.filter((value) => typeof value === "string");
|
|
210
|
+
const options = mergedOptions(this);
|
|
211
|
+
const context = resolveSetupContext(options);
|
|
212
|
+
const { OntologySetupError } = await import("../lib/ontology-graph/setup/index.js");
|
|
213
|
+
try {
|
|
214
|
+
emit(context, await entry(context, options, args));
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
if (error instanceof OntologySetupError)
|
|
218
|
+
throw new OntologyGraphUsageError(error.message);
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
182
222
|
const ontology = program
|
|
183
223
|
.command("ontology")
|
|
184
224
|
.description("Ontology graph: sourced facts, typed relationships, rebuilt from the files on this machine (local only)");
|
|
225
|
+
scoped(ontology.command("status"))
|
|
226
|
+
.description("Show the reader, the model, the graph folder, its counts, pending model work, the last update and the brief (reads only)")
|
|
227
|
+
.action(setup(async (context) => {
|
|
228
|
+
const { statusCommand } = await import("../lib/ontology-graph/setup/index.js");
|
|
229
|
+
return statusCommand(context);
|
|
230
|
+
}));
|
|
231
|
+
scoped(ontology.command("reader"))
|
|
232
|
+
.description("Show or set which ontology this machine's sessions read for the company: graph, or entities (the old files)")
|
|
233
|
+
.argument("[reader]", "graph or entities; leave out to show the setting")
|
|
234
|
+
.action(setup(async (context, _options, args) => {
|
|
235
|
+
const { readerCommand } = await import("../lib/ontology-graph/setup/index.js");
|
|
236
|
+
return readerCommand(context, args[0] !== undefined ? { value: args[0] } : {});
|
|
237
|
+
}));
|
|
238
|
+
scoped(ontology.command("model"))
|
|
239
|
+
.description("Show or set the model the graph's model step uses for the company on this machine (per machine; the setting does not sync)")
|
|
240
|
+
.argument("[model]", "model name, for example haiku, sonnet or opus; leave out to show the setting")
|
|
241
|
+
.action(setup(async (context, _options, args) => {
|
|
242
|
+
const { modelCommand } = await import("../lib/ontology-graph/setup/index.js");
|
|
243
|
+
return modelCommand(context, args[0] !== undefined ? { value: args[0] } : {});
|
|
244
|
+
}));
|
|
185
245
|
scoped(ontology.command("rebuild"))
|
|
186
246
|
.description("Rebuild the graph: import the old entity files, then replay the vault day by day")
|
|
187
247
|
.option("--from <date>", "first day to replay (YYYY-MM-DD)", isoDateArg)
|
|
188
248
|
.option("--to <date>", "last day to replay (YYYY-MM-DD)", isoDateArg)
|
|
189
249
|
.option("--resume", "continue from the last replayed day")
|
|
190
250
|
.option("--budget-tokens <n>", "stop model calls after this many input tokens; 0 runs rules only", budgetArg)
|
|
251
|
+
.option("--max-input-tokens <n>", "model input tokens allowed per day for this run, counting the day's earlier runs (default 150000)", capArg)
|
|
252
|
+
.option("--max-output-tokens <n>", "model output tokens allowed per day for this run (default 20000)", capArg)
|
|
191
253
|
.option("--no-model", "rules only: make no model call and leave model work pending")
|
|
192
254
|
.option("--dry-run", "read and count, write nothing")
|
|
193
255
|
.action(run(async (context, options) => {
|
|
@@ -197,6 +259,8 @@ export function registerOntologyCommand(program, deps = {}) {
|
|
|
197
259
|
...(options.to ? { to: options.to } : {}),
|
|
198
260
|
resume: Boolean(options.resume),
|
|
199
261
|
...(options.budgetTokens !== undefined ? { budgetTokens: options.budgetTokens } : {}),
|
|
262
|
+
...(options.maxInputTokens !== undefined ? { maxInputTokens: options.maxInputTokens } : {}),
|
|
263
|
+
...(options.maxOutputTokens !== undefined ? { maxOutputTokens: options.maxOutputTokens } : {}),
|
|
200
264
|
...(options.model === false ? { noModel: true } : {}),
|
|
201
265
|
dryRun: Boolean(options.dryRun),
|
|
202
266
|
});
|
|
@@ -209,6 +273,7 @@ export function registerOntologyCommand(program, deps = {}) {
|
|
|
209
273
|
.option("--full-listing", "list the whole corpus again instead of only new and changed files")
|
|
210
274
|
.option("--max-input-tokens <n>", "model input tokens allowed per day for this run, counting the day's earlier runs (default 150000)", capArg)
|
|
211
275
|
.option("--max-output-tokens <n>", "model output tokens allowed per day for this run (default 20000)", capArg)
|
|
276
|
+
.option("--follow-up", "also send model work an earlier run left pending (profiles, retyped links, decisions, summaries), within the daily cap")
|
|
212
277
|
.option("--dry-run", "read and count, write nothing")
|
|
213
278
|
.action(run(async (context, options) => {
|
|
214
279
|
const { updateCommand } = await import("../lib/ontology-graph/replay/index.js");
|
|
@@ -219,9 +284,36 @@ export function registerOntologyCommand(program, deps = {}) {
|
|
|
219
284
|
...(options.fullListing ? { fullListing: true } : {}),
|
|
220
285
|
...(options.maxInputTokens !== undefined ? { maxInputTokens: options.maxInputTokens } : {}),
|
|
221
286
|
...(options.maxOutputTokens !== undefined ? { maxOutputTokens: options.maxOutputTokens } : {}),
|
|
287
|
+
...(options.followUp ? { followUp: true } : {}),
|
|
222
288
|
dryRun: Boolean(options.dryRun),
|
|
223
289
|
});
|
|
224
290
|
}));
|
|
291
|
+
scoped(ontology.command("remodel"))
|
|
292
|
+
.description("Ask again, on the model in use, what another model wrote, and close that model's rows (history kept)")
|
|
293
|
+
.requiredOption("--from <model>", "model whose rows to replace, for example haiku")
|
|
294
|
+
.option("--kinds <list>", "ask again only what wrote these fact fields and relationship verbs, comma-separated (role_title,affiliation,works_at)")
|
|
295
|
+
.option("--budget-tokens <n>", "stop model calls after this many input tokens", capArg)
|
|
296
|
+
.option("--max-input-tokens <n>", "model input tokens allowed per day for this run, counting the day's earlier runs (default 150000)", capArg)
|
|
297
|
+
.option("--max-output-tokens <n>", "model output tokens allowed per day for this run (default 20000)", capArg)
|
|
298
|
+
.option("--dry-run", "count the rows and estimate the tokens; call no model and write nothing")
|
|
299
|
+
.action(run(async (context, options) => {
|
|
300
|
+
const { RemodelUsageError, remodelCommand } = await import("../lib/ontology-graph/remodel/index.js");
|
|
301
|
+
try {
|
|
302
|
+
return await remodelCommand(context, {
|
|
303
|
+
from: options.from,
|
|
304
|
+
...(options.kinds ? { kinds: options.kinds.split(",") } : {}),
|
|
305
|
+
...(options.budgetTokens !== undefined ? { budgetTokens: options.budgetTokens } : {}),
|
|
306
|
+
...(options.maxInputTokens !== undefined ? { maxInputTokens: options.maxInputTokens } : {}),
|
|
307
|
+
...(options.maxOutputTokens !== undefined ? { maxOutputTokens: options.maxOutputTokens } : {}),
|
|
308
|
+
dryRun: Boolean(options.dryRun),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
if (error instanceof RemodelUsageError)
|
|
313
|
+
throw new OntologyGraphUsageError(error.message);
|
|
314
|
+
throw error;
|
|
315
|
+
}
|
|
316
|
+
}));
|
|
225
317
|
scoped(ontology.command("lookup"))
|
|
226
318
|
.description("Find an entity by name and print its facts, each with a source and date")
|
|
227
319
|
.argument("<name>", "name, alias, email or <type>/<slug>")
|
|
@@ -283,11 +375,12 @@ export function registerOntologyCommand(program, deps = {}) {
|
|
|
283
375
|
});
|
|
284
376
|
}));
|
|
285
377
|
scoped(ontology.command("brief"))
|
|
286
|
-
.description("Write brief.md, the short
|
|
378
|
+
.description("Write brief.md, the short text every session starts with: a map of the graph and how to look things up")
|
|
287
379
|
.option("--stdout", "print the brief without writing it")
|
|
380
|
+
.option("--style <style>", "map: what the graph holds, the lookup commands and names worth looking up, with no facts. full: the earlier summary with facts in it. Default: brief_style in the reader setting, else map", briefStyleArg)
|
|
288
381
|
.action(read(async (context, options) => {
|
|
289
382
|
const { briefCommand } = await import("../lib/ontology-graph/read/index.js");
|
|
290
|
-
return briefCommand(context, { stdout: Boolean(options.stdout) });
|
|
383
|
+
return briefCommand(context, { stdout: Boolean(options.stdout), ...(options.style ? { style: options.style } : {}) });
|
|
291
384
|
}));
|
|
292
385
|
scoped(ontology.command("lint"))
|
|
293
386
|
.description("Check the graph and print a count per kind of problem")
|
package/dist/commands/sources.js
CHANGED
|
@@ -33,6 +33,7 @@ import { isAuthError } from "../utils/auth-error.js";
|
|
|
33
33
|
import { IntegrationsCliError, callGateway, fetchIntegrationsSummary, gatewayResultIsError, isBuiltInGatewayProvider, raiseForResponse, toolPrefixForProvider, unwrapGatewayResult, } from "./integrations-core.js";
|
|
34
34
|
import { Sentry } from "../sentry.js";
|
|
35
35
|
import { resolveUploadAuthor } from "../utils/upload-author.js";
|
|
36
|
+
import { resolveSyncPerson } from "../utils/sync-person.js";
|
|
36
37
|
import { createSignalsAlertChannelPoster, raiseSignalsFailureAlerts } from "../lib/hot-channels/alert.js";
|
|
37
38
|
import { audienceKey } from "../lib/hot-channels/audience.js";
|
|
38
39
|
import { appendRunLedgerEntry, ledgerDay, readRunLedger, RUN_TRIGGERS, summarizeRunLedger, } from "../lib/hot-channels/ledger.js";
|
|
@@ -323,6 +324,7 @@ function renderRunsTable(report) {
|
|
|
323
324
|
return lines.join("\n");
|
|
324
325
|
}
|
|
325
326
|
const SIGN_IN_PROMPT = "Your HQ session has expired or you're not signed in. Run `hq login`, then `hq sources sync` again.";
|
|
327
|
+
const NO_PERSON_IDENTITY_NOTICE = "No person identity on this machine: its HQ sign-in is a machine identity that acts for no person, so the hot-channel sync has no one to run for. Run the sync where its owner is signed in to HQ.";
|
|
326
328
|
const MAX_TOOL_ERROR_TEXT = 500;
|
|
327
329
|
/** The catalog API's `hotChannels` array, or null when the server has none. */
|
|
328
330
|
async function fetchHotChannels(token, companyUid) {
|
|
@@ -386,6 +388,17 @@ function signInReport() {
|
|
|
386
388
|
exitCode: 1,
|
|
387
389
|
};
|
|
388
390
|
}
|
|
391
|
+
function noPersonIdentityReport() {
|
|
392
|
+
return {
|
|
393
|
+
runId: null,
|
|
394
|
+
signInRequired: true,
|
|
395
|
+
noPersonIdentity: true,
|
|
396
|
+
outcomes: [],
|
|
397
|
+
entries: [],
|
|
398
|
+
notices: [NO_PERSON_IDENTITY_NOTICE],
|
|
399
|
+
exitCode: 1,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
389
402
|
async function signedInSession(company) {
|
|
390
403
|
let token;
|
|
391
404
|
try {
|
|
@@ -464,11 +477,12 @@ async function meetingIdentities(input, session, email) {
|
|
|
464
477
|
*/
|
|
465
478
|
export async function runCompanyHotChannelSync(input) {
|
|
466
479
|
assertSafeSegment(input.company, "company");
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
480
|
+
const person = resolveSyncPerson();
|
|
481
|
+
if (person.kind === "no-person")
|
|
482
|
+
return noPersonIdentityReport();
|
|
483
|
+
const author = person.kind === "person" ? person.author : undefined;
|
|
484
|
+
const session = author ? await signedInSession(input.company) : null;
|
|
485
|
+
if (!author || !session)
|
|
472
486
|
return signInReport();
|
|
473
487
|
const vaultRoot = path.join(input.hqRoot, "companies", input.company);
|
|
474
488
|
const personKey = audienceKey([author.email]);
|
|
@@ -631,8 +645,9 @@ export async function runSync(options, overrides = {}) {
|
|
|
631
645
|
if (outcome.reconnect)
|
|
632
646
|
process.stderr.write(chalk.yellow(`${outcome.reconnect.prompt}\n`));
|
|
633
647
|
}
|
|
634
|
-
if (report.signInRequired)
|
|
635
|
-
process.stderr.write(chalk.yellow(`${SIGN_IN_PROMPT}\n`));
|
|
648
|
+
if (report.signInRequired) {
|
|
649
|
+
process.stderr.write(chalk.yellow(`${report.noPersonIdentity ? NO_PERSON_IDENTITY_NOTICE : SIGN_IN_PROMPT}\n`));
|
|
650
|
+
}
|
|
636
651
|
if (report.exitCode !== 0)
|
|
637
652
|
process.exitCode = report.exitCode;
|
|
638
653
|
return report;
|
|
@@ -710,7 +725,10 @@ export async function runSignalsRedo(options, overrides = {}) {
|
|
|
710
725
|
};
|
|
711
726
|
const channels = [...new Set([...selection.pending.keys(), ...selection.worklist.keys()])];
|
|
712
727
|
if (!report.dryRun && channels.length > 0) {
|
|
713
|
-
const
|
|
728
|
+
const person = overrides.author !== undefined ? null : resolveSyncPerson();
|
|
729
|
+
if (person?.kind === "no-person")
|
|
730
|
+
return fail(`${NO_PERSON_IDENTITY_NOTICE} (the run takes your hot-channel sync lock)`, 1);
|
|
731
|
+
const author = overrides.author !== undefined ? overrides.author : person?.kind === "person" ? person.author : null;
|
|
714
732
|
// A sub-only author (machine token with no email) has no person key for
|
|
715
733
|
// the hot-channel lock, so it is treated as not signed in.
|
|
716
734
|
if (!author?.email)
|
|
@@ -125,12 +125,14 @@ export interface EnsureFleetHotSignalSyncInput {
|
|
|
125
125
|
/** Companies with an actual replacement job on the Executive bot. */
|
|
126
126
|
executiveCompanies?: readonly string[];
|
|
127
127
|
now?: Date;
|
|
128
|
+
noPersonIdentity?: boolean;
|
|
128
129
|
}
|
|
129
130
|
export interface FleetHotSignalSyncCompanyResult {
|
|
130
131
|
company: string;
|
|
131
132
|
created: boolean;
|
|
132
133
|
job: FleetCronJob | null;
|
|
133
134
|
heldBy?: string;
|
|
135
|
+
noPersonIdentity?: true;
|
|
134
136
|
}
|
|
135
137
|
export interface EnsureFleetHotSignalSyncResult {
|
|
136
138
|
companies: FleetHotSignalSyncCompanyResult[];
|
|
@@ -340,6 +340,8 @@ def classify(out, err, code):
|
|
|
340
340
|
name = signal_name(-code)
|
|
341
341
|
return 'hq was stopped by signal %d%s' % (-code, ' (' + name + ')' if name else ''), FIXES['signal']
|
|
342
342
|
text = ANSI.sub('', (err or '') + '\n' + (out or ''))
|
|
343
|
+
if re.search(r'No person identity on this machine', text, re.I):
|
|
344
|
+
return 'this computer has no person identity in HQ (its sign-in is a machine identity that acts for no person)', FIXES['hq_no_person']
|
|
343
345
|
if re.search(r"HQ session has expired|not signed in to HQ|Sign in to HQ first|run .hq login", text, re.I):
|
|
344
346
|
return 'you are signed out of HQ', FIXES['hq_signed_out']
|
|
345
347
|
if re.search(r'bot-api-key-login', text, re.I):
|
|
@@ -465,6 +467,7 @@ export function renderFleetHotSignalSyncScript(input) {
|
|
|
465
467
|
bot_signed_out: "open the Executive bot's profile in HQ, go to Brain, and reconnect its subscription login.",
|
|
466
468
|
bot_api_key: "open the Executive bot's profile in HQ, go to Brain, and connect its Claude or ChatGPT subscription instead of an API key.",
|
|
467
469
|
hq_signed_out: "run `hq login`.",
|
|
470
|
+
hq_no_person: `run \`${syncCommand}\` where the bot's owner is signed in to HQ, or run the bot on its owner's computer or personal Outpost.`,
|
|
468
471
|
// The desktop app first (Settings → AI tools lists Claude Code with a
|
|
469
472
|
// "Connect Claude" or "Install Claude" button), the terminal as the fallback.
|
|
470
473
|
claude_signed_out: claudeSignInFix,
|
|
@@ -676,6 +679,8 @@ function ensureFleetHotSignalSyncFor(input, company, jobs) {
|
|
|
676
679
|
markFleetHotSignalSyncRegistered(input.dir, company, input.now);
|
|
677
680
|
return { company, created: false, job: current };
|
|
678
681
|
}
|
|
682
|
+
if (input.noPersonIdentity)
|
|
683
|
+
return { company, created: false, job: null, noPersonIdentity: true };
|
|
679
684
|
const heldBy = otherBotWithHotSignalSync(input.dir, company, input.otherBotDirs);
|
|
680
685
|
if (heldBy)
|
|
681
686
|
return { company, created: false, job: null, heldBy };
|
|
@@ -169,14 +169,15 @@ export declare function coveredOn(covers: Readonly<Record<string, readonly strin
|
|
|
169
169
|
/** The old dispatcher's hooks for `event` on `host` that the engine does not cover. */
|
|
170
170
|
export declare function uncoveredHooks(root: string, host: CoreNextHost, event: string, covers: Readonly<Record<string, readonly string[]>> | undefined, env?: NodeJS.ProcessEnv): string[];
|
|
171
171
|
/**
|
|
172
|
-
* The script revisions the native SessionStart master rebuilds (hq-core v16.0.48 through v16.0.50
|
|
172
|
+
* The script revisions the native SessionStart master rebuilds (hq-core v16.0.48 through v16.0.50,
|
|
173
|
+
* and the hq-core-staging fd709b39a shim and hq-session.sh):
|
|
173
174
|
* `hqd_open.rs` (the daemon shim and its flag-cache library), `session_set/mod.rs` `SCRIPTS`,
|
|
174
175
|
* `ID_LIBS` and `CAPABILITY_LIBS` (hq-session.sh and the two libraries it sources) and
|
|
175
176
|
* `foreign_bind.rs` `RESOLVE_REVISIONS` (resolve-company.sh). The native port
|
|
176
177
|
* refuses a SessionStart that reaches any other revision, and Claude Code drops a SessionStart
|
|
177
178
|
* refusal, so the session would start with no SessionStart hook at all.
|
|
178
179
|
*/
|
|
179
|
-
export declare const SESSION_START_PINS: ReadonlyArray<readonly [string, string]>;
|
|
180
|
+
export declare const SESSION_START_PINS: ReadonlyArray<readonly [string, readonly string[]]>;
|
|
180
181
|
/**
|
|
181
182
|
* Why SessionStart must stay on the shell registration in `root`: one of [`SESSION_START_PINS`] is
|
|
182
183
|
* missing, cannot be read, or is not the pinned revision. A registration-time hold, as for Codex
|
|
@@ -226,12 +227,20 @@ export declare function pinnedFilesHold(root: string, event: string, files: read
|
|
|
226
227
|
* order it reads them. Each is skipped there when it is not a file.
|
|
227
228
|
*/
|
|
228
229
|
export declare const GROK_STOP_OBSERVE_PINS: readonly PinnedFile[];
|
|
230
|
+
/** The turn-end leaf revision (b373b582, hq-core v16.0.48 to v16.0.50) that sources `session-id.sh`. */
|
|
231
|
+
export declare const GROK_STOP_OBSERVE_SESSION_ID_LEAF = "b373b582a906b0993a3ce56aa43c1ef0aec6668a6b7e150d59ef3214b7d65b70";
|
|
232
|
+
/**
|
|
233
|
+
* The session library the b373b582 leaf sources (grok_stop_observe.rs `SESSION_ID_LIB_SHA256`).
|
|
234
|
+
* The native member reads it only beside that leaf, and only when no variable names the session;
|
|
235
|
+
* the hold checks it whenever the leaf is b373b582, which can only keep more roots on the shell.
|
|
236
|
+
*/
|
|
237
|
+
export declare const GROK_STOP_OBSERVE_SESSION_ID_PIN: PinnedFile;
|
|
229
238
|
/**
|
|
230
239
|
* Why a Grok StopCancelled or StopFailure (`event`) must stay on the shell adapter in `root`: the
|
|
231
|
-
* turn-end leaf or one of its two libraries is a revision the native member refuses
|
|
232
|
-
* (grok_stop_observe.rs `plan`). As there, nothing
|
|
233
|
-
* `.claude/hooks/hook-gate.sh` or no leaf: the member writes nothing and
|
|
234
|
-
* when the member accepts the root's files.
|
|
240
|
+
* turn-end leaf or one of its two libraries is a revision the native member refuses, or the leaf is
|
|
241
|
+
* b373b582 and `core/scripts/lib/session-id.sh` is (grok_stop_observe.rs `plan`). As there, nothing
|
|
242
|
+
* is read in a root with no `.claude/hooks/hook-gate.sh` or no leaf: the member writes nothing and
|
|
243
|
+
* refuses no file. Null when the member accepts the root's files.
|
|
235
244
|
*/
|
|
236
245
|
export declare function grokStopObserveHold(root: string, event: string): string | null;
|
|
237
246
|
/**
|
|
@@ -257,7 +266,9 @@ export declare function grokPreToolUseHold(root: string, shadow: boolean): strin
|
|
|
257
266
|
/**
|
|
258
267
|
* The dispatcher files the native PreToolUse master model reproduces, in its check order:
|
|
259
268
|
* crates/hq-hook/src/pre_tool_use_master.rs `DISPATCHER_PINS`. master-hook.sh is v16.0.48 (1a2439ae),
|
|
260
|
-
* v16.0.50 (774bca73) or v16.0.49 (d5049d5f);
|
|
269
|
+
* v16.0.50 (774bca73) or v16.0.49 (d5049d5f); hqd-hook-shim.sh is the released ab289ac0 or the
|
|
270
|
+
* hq-core-staging fd709b39a ee5e9fe7, and session-id.sh the released 2ebbc508 or the fd709b39a
|
|
271
|
+
* d6a04155; every other file is one revision.
|
|
261
272
|
*/
|
|
262
273
|
export declare const PRE_TOOL_USE_DISPATCHER_PINS: readonly PinnedFile[];
|
|
263
274
|
/** The Codex adapter the model reproduces on Codex only (pre_tool_use_master.rs `CODEX_ADAPTER_PIN`). */
|
|
@@ -1742,10 +1742,16 @@ export function uncoveredHooks(root, host, event, covers, env = process.env) {
|
|
|
1742
1742
|
if (hold)
|
|
1743
1743
|
missing.push(`(native ${event} compatibility: ${hold})`);
|
|
1744
1744
|
}
|
|
1745
|
+
if (host === 'agents-v2' && event === 'PreToolUse' && covered.includes('agents-v2-adapter:PreToolUse')) {
|
|
1746
|
+
const hold = sessionStartHold(root);
|
|
1747
|
+
if (hold)
|
|
1748
|
+
missing.push(`(native PreToolUse compatibility: ${hold})`);
|
|
1749
|
+
}
|
|
1745
1750
|
return missing;
|
|
1746
1751
|
}
|
|
1747
1752
|
/**
|
|
1748
|
-
* The script revisions the native SessionStart master rebuilds (hq-core v16.0.48 through v16.0.50
|
|
1753
|
+
* The script revisions the native SessionStart master rebuilds (hq-core v16.0.48 through v16.0.50,
|
|
1754
|
+
* and the hq-core-staging fd709b39a shim and hq-session.sh):
|
|
1749
1755
|
* `hqd_open.rs` (the daemon shim and its flag-cache library), `session_set/mod.rs` `SCRIPTS`,
|
|
1750
1756
|
* `ID_LIBS` and `CAPABILITY_LIBS` (hq-session.sh and the two libraries it sources) and
|
|
1751
1757
|
* `foreign_bind.rs` `RESOLVE_REVISIONS` (resolve-company.sh). The native port
|
|
@@ -1753,12 +1759,12 @@ export function uncoveredHooks(root, host, event, covers, env = process.env) {
|
|
|
1753
1759
|
* refusal, so the session would start with no SessionStart hook at all.
|
|
1754
1760
|
*/
|
|
1755
1761
|
export const SESSION_START_PINS = [
|
|
1756
|
-
['core/scripts/hqd-hook-shim.sh', 'ab289ac0af680fe3bcacb110302ca8b998bdc33c6f94321d42bd04a344163eed'],
|
|
1757
|
-
['core/scripts/hqd-hook-flag-cache-lib.sh', '061d264460408e9eaf43fdf0fdde662c906a9a7dacb4e7a591e684bca28c138a'],
|
|
1758
|
-
['core/scripts/hq-session.sh', 'db701162f71b53fd2188974d2f46c58250593dde1252d65b36e6d02b9a765fe7'],
|
|
1759
|
-
['core/scripts/lib/session-id.sh', '2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d'],
|
|
1760
|
-
['core/scripts/lib/session-scope-capability.sh', '388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'],
|
|
1761
|
-
['core/scripts/resolve-company.sh', '00d6fa069f574a86087c77daa44887a2617446d4300d5daebecc9bfb5d81abe7'],
|
|
1762
|
+
['core/scripts/hqd-hook-shim.sh', ['ab289ac0af680fe3bcacb110302ca8b998bdc33c6f94321d42bd04a344163eed', 'ee5e9fe729eb7e51f87b5f90cdc020be865f5b6b35ac0b5758587546b35715c0']],
|
|
1763
|
+
['core/scripts/hqd-hook-flag-cache-lib.sh', ['061d264460408e9eaf43fdf0fdde662c906a9a7dacb4e7a591e684bca28c138a']],
|
|
1764
|
+
['core/scripts/hq-session.sh', ['db701162f71b53fd2188974d2f46c58250593dde1252d65b36e6d02b9a765fe7', '02a37c5dbf4fb5af27cc64d0f271121e990758b757a479f60e9ce099f4d65ded']],
|
|
1765
|
+
['core/scripts/lib/session-id.sh', ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d']],
|
|
1766
|
+
['core/scripts/lib/session-scope-capability.sh', ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead']],
|
|
1767
|
+
['core/scripts/resolve-company.sh', ['00d6fa069f574a86087c77daa44887a2617446d4300d5daebecc9bfb5d81abe7']],
|
|
1762
1768
|
];
|
|
1763
1769
|
/**
|
|
1764
1770
|
* Why SessionStart must stay on the shell registration in `root`: one of [`SESSION_START_PINS`] is
|
|
@@ -1767,7 +1773,7 @@ export const SESSION_START_PINS = [
|
|
|
1767
1773
|
* any revision it does not rebuild. Null when every file matches.
|
|
1768
1774
|
*/
|
|
1769
1775
|
export function sessionStartHold(root) {
|
|
1770
|
-
for (const [relative,
|
|
1776
|
+
for (const [relative, accepted] of SESSION_START_PINS) {
|
|
1771
1777
|
let bytes;
|
|
1772
1778
|
try {
|
|
1773
1779
|
const file = path.join(root, relative);
|
|
@@ -1778,7 +1784,7 @@ export function sessionStartHold(root) {
|
|
|
1778
1784
|
catch {
|
|
1779
1785
|
return `unreadable SessionStart file ${relative}`;
|
|
1780
1786
|
}
|
|
1781
|
-
if (createHash('sha256').update(bytes).digest('hex')
|
|
1787
|
+
if (!accepted.includes(createHash('sha256').update(bytes).digest('hex')))
|
|
1782
1788
|
return `unmodeled SessionStart file ${relative}`;
|
|
1783
1789
|
}
|
|
1784
1790
|
return null;
|
|
@@ -1870,23 +1876,53 @@ export function pinnedFilesHold(root, event, files, generations = []) {
|
|
|
1870
1876
|
* order it reads them. Each is skipped there when it is not a file.
|
|
1871
1877
|
*/
|
|
1872
1878
|
export const GROK_STOP_OBSERVE_PINS = [
|
|
1873
|
-
{
|
|
1879
|
+
{
|
|
1880
|
+
relative: 'core/hooks/Stop/70-work-mesh-turn-end.sh',
|
|
1881
|
+
// hq-core v16.0.47 (`LEAF_16_0_47`), and v16.0.48 to v16.0.50 (`LEAF_16_0_48`).
|
|
1882
|
+
accepted: ['1b37183a94a46152c9592d6821f323203438e09ed59956d6239880bb73f896db', 'b373b582a906b0993a3ce56aa43c1ef0aec6668a6b7e150d59ef3214b7d65b70'],
|
|
1883
|
+
missing: 'allowed',
|
|
1884
|
+
},
|
|
1874
1885
|
{ relative: 'core/scripts/lib/hook-stop-async.sh', accepted: ['730b008b81b360923f82785467f3a3b6592be6610ee3b909e446b242543ab3bc', 'fe89218c3f92413cff36e82a937eed5e548e712644d8228b34d59c7f459917ad'], missing: 'allowed' },
|
|
1875
1886
|
{ relative: 'core/scripts/lib/work-mesh-enqueue.sh', accepted: ['db440318b8933b7c436c7b7172adffc9e8fd00c92f0e1745ed5da76871accbe7', 'ac44fc8f68dbe7311811e0e97bba2b1e53b3aa856856db566635a135c6319451'], missing: 'allowed' },
|
|
1876
1887
|
];
|
|
1888
|
+
/** The turn-end leaf revision (b373b582, hq-core v16.0.48 to v16.0.50) that sources `session-id.sh`. */
|
|
1889
|
+
export const GROK_STOP_OBSERVE_SESSION_ID_LEAF = 'b373b582a906b0993a3ce56aa43c1ef0aec6668a6b7e150d59ef3214b7d65b70';
|
|
1890
|
+
/**
|
|
1891
|
+
* The session library the b373b582 leaf sources (grok_stop_observe.rs `SESSION_ID_LIB_SHA256`).
|
|
1892
|
+
* The native member reads it only beside that leaf, and only when no variable names the session;
|
|
1893
|
+
* the hold checks it whenever the leaf is b373b582, which can only keep more roots on the shell.
|
|
1894
|
+
*/
|
|
1895
|
+
export const GROK_STOP_OBSERVE_SESSION_ID_PIN = {
|
|
1896
|
+
relative: 'core/scripts/lib/session-id.sh',
|
|
1897
|
+
accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d'],
|
|
1898
|
+
missing: 'allowed',
|
|
1899
|
+
};
|
|
1877
1900
|
/**
|
|
1878
1901
|
* Why a Grok StopCancelled or StopFailure (`event`) must stay on the shell adapter in `root`: the
|
|
1879
|
-
* turn-end leaf or one of its two libraries is a revision the native member refuses
|
|
1880
|
-
* (grok_stop_observe.rs `plan`). As there, nothing
|
|
1881
|
-
* `.claude/hooks/hook-gate.sh` or no leaf: the member writes nothing and
|
|
1882
|
-
* when the member accepts the root's files.
|
|
1902
|
+
* turn-end leaf or one of its two libraries is a revision the native member refuses, or the leaf is
|
|
1903
|
+
* b373b582 and `core/scripts/lib/session-id.sh` is (grok_stop_observe.rs `plan`). As there, nothing
|
|
1904
|
+
* is read in a root with no `.claude/hooks/hook-gate.sh` or no leaf: the member writes nothing and
|
|
1905
|
+
* refuses no file. Null when the member accepts the root's files.
|
|
1883
1906
|
*/
|
|
1884
1907
|
export function grokStopObserveHold(root, event) {
|
|
1885
1908
|
if (!regularFile(path.join(root, '.claude', 'hooks', 'hook-gate.sh')))
|
|
1886
1909
|
return null;
|
|
1887
|
-
|
|
1910
|
+
const leaf = path.join(root, GROK_STOP_OBSERVE_PINS[0].relative);
|
|
1911
|
+
if (!regularFile(leaf))
|
|
1912
|
+
return null;
|
|
1913
|
+
const held = pinnedFilesHold(root, event, GROK_STOP_OBSERVE_PINS);
|
|
1914
|
+
if (held)
|
|
1915
|
+
return held;
|
|
1916
|
+
let bytes;
|
|
1917
|
+
try {
|
|
1918
|
+
bytes = fs.readFileSync(leaf);
|
|
1919
|
+
}
|
|
1920
|
+
catch {
|
|
1921
|
+
return `unreadable ${event} file ${GROK_STOP_OBSERVE_PINS[0].relative}`;
|
|
1922
|
+
}
|
|
1923
|
+
if (createHash('sha256').update(bytes).digest('hex') !== GROK_STOP_OBSERVE_SESSION_ID_LEAF)
|
|
1888
1924
|
return null;
|
|
1889
|
-
return pinnedFilesHold(root, event,
|
|
1925
|
+
return pinnedFilesHold(root, event, [GROK_STOP_OBSERVE_SESSION_ID_PIN]);
|
|
1890
1926
|
}
|
|
1891
1927
|
/**
|
|
1892
1928
|
* The Grok adapter and its library the native Grok PreToolUse work is modelled on, as one pair:
|
|
@@ -1917,7 +1953,9 @@ export function grokPreToolUseHold(root, shadow) {
|
|
|
1917
1953
|
/**
|
|
1918
1954
|
* The dispatcher files the native PreToolUse master model reproduces, in its check order:
|
|
1919
1955
|
* crates/hq-hook/src/pre_tool_use_master.rs `DISPATCHER_PINS`. master-hook.sh is v16.0.48 (1a2439ae),
|
|
1920
|
-
* v16.0.50 (774bca73) or v16.0.49 (d5049d5f);
|
|
1956
|
+
* v16.0.50 (774bca73) or v16.0.49 (d5049d5f); hqd-hook-shim.sh is the released ab289ac0 or the
|
|
1957
|
+
* hq-core-staging fd709b39a ee5e9fe7, and session-id.sh the released 2ebbc508 or the fd709b39a
|
|
1958
|
+
* d6a04155; every other file is one revision.
|
|
1921
1959
|
*/
|
|
1922
1960
|
export const PRE_TOOL_USE_DISPATCHER_PINS = [
|
|
1923
1961
|
{ relative: '.claude/hooks/hook-gate.sh', accepted: ['a443b481d895e74b46743548d049644ab011b1e5cb8ae3fcb8da1a6a169cd364'] },
|
|
@@ -1936,12 +1974,12 @@ export const PRE_TOOL_USE_DISPATCHER_PINS = [
|
|
|
1936
1974
|
{ relative: 'core/scripts/hook-lib.sh', accepted: ['9133295e5ce523bf8355a093bbea5a1c19682ec42b59ab6b626dffbc33544f3f'] },
|
|
1937
1975
|
{ relative: 'core/scripts/hq-anywhere-runtime-flag.cjs', accepted: ['8a484cef83d383b440462798ac13e26d132e10bbe509b47e0eb1a3d0db76b2b4'] },
|
|
1938
1976
|
{ relative: 'core/scripts/hqd-hook-flag-cache-lib.sh', accepted: ['061d264460408e9eaf43fdf0fdde662c906a9a7dacb4e7a591e684bca28c138a'] },
|
|
1939
|
-
{ relative: 'core/scripts/hqd-hook-shim.sh', accepted: ['ab289ac0af680fe3bcacb110302ca8b998bdc33c6f94321d42bd04a344163eed'] },
|
|
1977
|
+
{ relative: 'core/scripts/hqd-hook-shim.sh', accepted: ['ab289ac0af680fe3bcacb110302ca8b998bdc33c6f94321d42bd04a344163eed', 'ee5e9fe729eb7e51f87b5f90cdc020be865f5b6b35ac0b5758587546b35715c0'] },
|
|
1940
1978
|
{ relative: 'core/scripts/lib/advisory-cap.sh', accepted: ['ab80b2a3f63a5955db392eaff4e54fed88d20130e96ca5c2a0945a3ea146d39b'] },
|
|
1941
1979
|
{ relative: 'core/scripts/lib/epochrealtime.sh', accepted: ['4c9205520dba31533c95eea145f6068ba626885c342c2aa1f232a7237d046cdf'] },
|
|
1942
1980
|
{ relative: 'core/scripts/lib/hook-adapter-core.sh', accepted: ['940bb5a0a268929a4cd3f88b61a0ce619f0fdf64e5d3f25f7f18da35df466ab5'] },
|
|
1943
1981
|
{ relative: 'core/scripts/lib/perl-child-locale.sh', accepted: ['18e6b9d0e22874eea00ecc868b4dcfebbc3bb42434d8d0c81b20baec1194df2e'] },
|
|
1944
|
-
{ relative: 'core/scripts/lib/session-id.sh', accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d'] },
|
|
1982
|
+
{ relative: 'core/scripts/lib/session-id.sh', accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d', 'd6a04155571ec53edd853878cebaba5a5bab93801a73e356499440c1cd009c71'] },
|
|
1945
1983
|
{ relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'] },
|
|
1946
1984
|
{ relative: 'core/scripts/resolve-hq-root.sh', accepted: ['188e99c7c60bc9909290a666d6f3b93387ae6cf68f2eeb41fd24c2dea62a5240'] },
|
|
1947
1985
|
];
|
|
@@ -2121,7 +2159,7 @@ export function preToolUseHold(root, host, hooks = []) {
|
|
|
2121
2159
|
*/
|
|
2122
2160
|
export const PROMPT_COMPANY_BIND_PINS = [
|
|
2123
2161
|
{ relative: 'core/scripts/lib/prompt-company-mention.sh', accepted: ['6c68e31d0605db272a6b922e361d1e7659ab77e96faaf613c62afa192aef4ee0'] },
|
|
2124
|
-
{ relative: 'core/scripts/hq-session.sh', accepted: ['db701162f71b53fd2188974d2f46c58250593dde1252d65b36e6d02b9a765fe7'] },
|
|
2162
|
+
{ relative: 'core/scripts/hq-session.sh', accepted: ['db701162f71b53fd2188974d2f46c58250593dde1252d65b36e6d02b9a765fe7', '02a37c5dbf4fb5af27cc64d0f271121e990758b757a479f60e9ce099f4d65ded'] },
|
|
2125
2163
|
{ relative: 'core/scripts/lib/session-id.sh', accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d'] },
|
|
2126
2164
|
{ relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'] },
|
|
2127
2165
|
];
|