@gamaze/hicortex 0.26.3 → 0.27.0
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/README.md +7 -2
- package/dist/backfill-privacy.d.ts +82 -0
- package/dist/backfill-privacy.js +193 -0
- package/dist/classification.d.ts +153 -0
- package/dist/classification.js +265 -0
- package/dist/classify-domains.js +24 -7
- package/dist/cli.js +31 -0
- package/dist/cluster.d.ts +15 -8
- package/dist/cluster.js +10 -3
- package/dist/consolidate.d.ts +31 -2
- package/dist/consolidate.js +193 -40
- package/dist/db.js +26 -1
- package/dist/dedup.d.ts +5 -3
- package/dist/dedup.js +26 -12
- package/dist/distill-queue.d.ts +25 -1
- package/dist/distill-queue.js +47 -7
- package/dist/graph.d.ts +28 -3
- package/dist/graph.js +46 -4
- package/dist/init.d.ts +18 -9
- package/dist/init.js +111 -81
- package/dist/mcp-server.js +186 -32
- package/dist/nightly.js +33 -7
- package/dist/recall-index.d.ts +19 -9
- package/dist/recall-index.js +14 -4
- package/dist/recall-precision.js +3 -1
- package/dist/reconsolidation.d.ts +10 -0
- package/dist/reconsolidation.js +80 -17
- package/dist/redact.d.ts +9 -1
- package/dist/redact.js +32 -1
- package/dist/rescore-importance.js +21 -4
- package/dist/retrieval.d.ts +23 -6
- package/dist/retrieval.js +41 -15
- package/dist/seed-lesson.js +3 -1
- package/dist/storage.d.ts +23 -4
- package/dist/storage.js +38 -9
- package/dist/type-classify.js +22 -7
- package/dist/types.d.ts +81 -15
- package/dist/uninstall.js +6 -5
- package/hermes-plugin/hicortex/README.md +4 -0
- package/hermes-plugin/hicortex/client.py +36 -9
- package/hermes-plugin/hicortex/plugin.yaml +1 -1
- package/hermes-plugin/hicortex/provider.py +28 -6
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/distill-queue.d.ts
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
import type Database from "better-sqlite3";
|
|
35
35
|
import { detectChunkSize } from "./distiller.js";
|
|
36
36
|
import type { LlmUsage, LlmConfig } from "./llm.js";
|
|
37
|
+
import type { MemoryPrivacy } from "./types.js";
|
|
37
38
|
import type { RunDeadline } from "./run-deadline.js";
|
|
38
39
|
/** One queued delivery, as stored in `distill_queue`. */
|
|
39
40
|
export interface DistillQueueRow {
|
|
@@ -46,7 +47,13 @@ export interface DistillQueueRow {
|
|
|
46
47
|
source_machine: string | null;
|
|
47
48
|
project: string | null;
|
|
48
49
|
session_date: string | null;
|
|
49
|
-
|
|
50
|
+
/**
|
|
51
|
+
* #332 classification stamp. 'standard' | 'confidential' on every row
|
|
52
|
+
* written after v27 (enqueue normalizes; the intake handler derives);
|
|
53
|
+
* nullable defensively because the column is loose TEXT and pre-v27 rows
|
|
54
|
+
* existed — readers treat NULL as standard (the fail-closed default).
|
|
55
|
+
*/
|
|
56
|
+
privacy: MemoryPrivacy | null;
|
|
50
57
|
text: string;
|
|
51
58
|
arrived_at: string;
|
|
52
59
|
}
|
|
@@ -176,6 +183,16 @@ export interface DrainOptions {
|
|
|
176
183
|
* mechanical fold only. The nightly passes the boot-resolved config value.
|
|
177
184
|
*/
|
|
178
185
|
projectAliases?: Readonly<Record<string, string>> | null;
|
|
186
|
+
/**
|
|
187
|
+
* #332: the CONFIDENTIAL model client. Items stamped 'confidential' distill
|
|
188
|
+
* on THIS client; when it is absent they are HELD — the row stays queued
|
|
189
|
+
* (skip-and-continue, the no_llm precedent but per-item) and standard items
|
|
190
|
+
* keep draining. There is NO fallback to `llm`: confidential text never
|
|
191
|
+
* reaches the standard model, held beats exposed.
|
|
192
|
+
*/
|
|
193
|
+
confidentialLlm?: DrainLlm | null;
|
|
194
|
+
/** Its config — drives the confidential endpoint's own chunk-size cache. */
|
|
195
|
+
confidentialLlmConfig?: LlmConfig | null;
|
|
179
196
|
}
|
|
180
197
|
export interface DrainReport {
|
|
181
198
|
/**
|
|
@@ -196,6 +213,13 @@ export interface DrainReport {
|
|
|
196
213
|
memories: number;
|
|
197
214
|
/** Items still queued after this run. */
|
|
198
215
|
remaining: number;
|
|
216
|
+
/**
|
|
217
|
+
* #332: items HELD this run — stamped confidential with no confidential
|
|
218
|
+
* client configured. They stay queued (skip-and-continue); standard items
|
|
219
|
+
* drained normally. The boot warning names the exposure; this count is the
|
|
220
|
+
* per-run queue-growth signal.
|
|
221
|
+
*/
|
|
222
|
+
held_confidential?: number;
|
|
199
223
|
/** Tokens metered this drain (incl. a failed item's partial usage). */
|
|
200
224
|
usage: {
|
|
201
225
|
prompt: number;
|
package/dist/distill-queue.js
CHANGED
|
@@ -102,7 +102,14 @@ function enqueueDistill(db, input) {
|
|
|
102
102
|
// Resolve the date ONCE at delivery (mirrors the sync handler): absent
|
|
103
103
|
// or non-string becomes today, and the drain reuses the stored value so
|
|
104
104
|
// a queued segment keeps its session date.
|
|
105
|
-
str(input.session_date) ?? new Date().toISOString().slice(0, 10),
|
|
105
|
+
str(input.session_date) ?? new Date().toISOString().slice(0, 10),
|
|
106
|
+
// #332: the classification stamp, normalized at the insert boundary —
|
|
107
|
+
// a legacy client's 'WORK'/blank/absent value lands as 'standard'
|
|
108
|
+
// (migration v27 normalized pre-existing rows the same way). The intake
|
|
109
|
+
// handler derives the stamp from source_agent × roster before it gets
|
|
110
|
+
// here, so a rostered agent's delivery is queued 'confidential' even
|
|
111
|
+
// when the client declares nothing.
|
|
112
|
+
storage.normalizeStoredPrivacy(input.privacy), input.text, new Date().toISOString());
|
|
106
113
|
return { duplicate: result.changes === 0 };
|
|
107
114
|
}
|
|
108
115
|
/**
|
|
@@ -189,8 +196,7 @@ function resolveQueueMode(db, distillQueueEnabled) {
|
|
|
189
196
|
}
|
|
190
197
|
/** Chunk-size cache, keyed per endpoint exactly like the handler's. */
|
|
191
198
|
const chunkSizeCache = new Map();
|
|
192
|
-
async function
|
|
193
|
-
const cfg = opts.llmConfig;
|
|
199
|
+
async function resolveDrainChunkSizeFor(opts, cfg) {
|
|
194
200
|
const detect = opts.detectChunkSize ?? distiller_js_1.detectChunkSize;
|
|
195
201
|
const cacheKey = `${cfg.provider}/${cfg.model}@${cfg.baseUrl}`;
|
|
196
202
|
if (!chunkSizeCache.has(cacheKey)) {
|
|
@@ -276,6 +282,7 @@ async function drainDistillQueue(db, opts) {
|
|
|
276
282
|
duplicates: 0,
|
|
277
283
|
memories: 0,
|
|
278
284
|
remaining: 0,
|
|
285
|
+
held_confidential: 0,
|
|
279
286
|
usage: { prompt: 0, completion: 0, total: 0 },
|
|
280
287
|
};
|
|
281
288
|
const rows = db
|
|
@@ -283,6 +290,16 @@ async function drainDistillQueue(db, opts) {
|
|
|
283
290
|
.all();
|
|
284
291
|
if (rows.length === 0)
|
|
285
292
|
return report; // the healthy steady state: depth 0
|
|
293
|
+
// #332: confidential items with no confidential client HOLD (skip-and-
|
|
294
|
+
// continue) — one warn per run, then the drain proceeds over the standard
|
|
295
|
+
// items. The rows stay queued; the report carries the held count.
|
|
296
|
+
const confidentialCount = rows.filter((r) => r.privacy === "confidential").length;
|
|
297
|
+
const hasConfidentialClient = !!(opts.confidentialLlm && opts.confidentialLlmConfig);
|
|
298
|
+
if (confidentialCount > 0 && !hasConfidentialClient) {
|
|
299
|
+
console.warn(`[hicortex] drain: ${confidentialCount} confidential item(s) HELD — no confidential model configured ` +
|
|
300
|
+
`(llmConfidentialBaseUrl/ApiKey). They stay queued; standard items drain normally. ` +
|
|
301
|
+
`Confidential text never touches the standard model.`);
|
|
302
|
+
}
|
|
286
303
|
// No LLM configured: delivery still queued (queue mode needs no LLM), but
|
|
287
304
|
// distillation cannot run. Report + defer — items stay queued; the
|
|
288
305
|
// consolidation block reports its own no_llm right after.
|
|
@@ -307,7 +324,6 @@ async function drainDistillQueue(db, opts) {
|
|
|
307
324
|
}
|
|
308
325
|
const queues = [...byClient.values()];
|
|
309
326
|
console.log(`[hicortex] Distill inbox: ${rows.length} item(s) from ${queues.length} client(s) — draining`);
|
|
310
|
-
const chunkSize = await resolveDrainChunkSize(opts);
|
|
311
327
|
const warned = { unreachable: false };
|
|
312
328
|
let stopped;
|
|
313
329
|
outer: while (queues.some((q) => q.length > 0)) {
|
|
@@ -354,6 +370,24 @@ async function drainDistillQueue(db, opts) {
|
|
|
354
370
|
// usage accrues even on throw (some chunks' LLM calls already happened)
|
|
355
371
|
// — the caller records it against the monthly meter, same as the sync
|
|
356
372
|
// path's finally.
|
|
373
|
+
//
|
|
374
|
+
// #332 per-pool client selection: a confidential item distills on the
|
|
375
|
+
// CONFIDENTIAL client; without one it HOLDS here (skip-and-continue —
|
|
376
|
+
// the row stays queued, standard items drain on, held count reported).
|
|
377
|
+
// Standard items use the main client as before.
|
|
378
|
+
if (item.privacy === "confidential") {
|
|
379
|
+
if (!opts.confidentialLlm || !opts.confidentialLlmConfig) {
|
|
380
|
+
report.held_confidential = (report.held_confidential ?? 0) + 1;
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const itemLlm = (item.privacy === "confidential"
|
|
385
|
+
? opts.confidentialLlm
|
|
386
|
+
: opts.llm);
|
|
387
|
+
const itemLlmConfig = item.privacy === "confidential"
|
|
388
|
+
? opts.confidentialLlmConfig
|
|
389
|
+
: opts.llmConfig;
|
|
390
|
+
const chunkSize = await resolveDrainChunkSizeFor(opts, itemLlmConfig);
|
|
357
391
|
const usage = { prompt: 0, completion: 0, total: 0 };
|
|
358
392
|
const label = item.segment_id !== ""
|
|
359
393
|
? item.segment_id
|
|
@@ -367,7 +401,7 @@ async function drainDistillQueue(db, opts) {
|
|
|
367
401
|
const canonProject = (0, project_canonicalize_js_1.canonicalizeProject)(item.project, opts.projectAliases);
|
|
368
402
|
try {
|
|
369
403
|
// Cast: DrainLlm is the structural surface distillSession uses.
|
|
370
|
-
const llm =
|
|
404
|
+
const llm = itemLlm;
|
|
371
405
|
const entries = await (0, distiller_js_1.distillSession)(llm, item.text, canonProject ?? "unknown", item.session_date ?? new Date().toISOString().slice(0, 10), chunkSize, [], (u) => {
|
|
372
406
|
usage.prompt += u.prompt_tokens ?? 0;
|
|
373
407
|
usage.completion += u.completion_tokens ?? 0;
|
|
@@ -405,7 +439,10 @@ async function drainDistillQueue(db, opts) {
|
|
|
405
439
|
sourceSession: sourcePrefix ? `${sourcePrefix}#${i}` : undefined,
|
|
406
440
|
project: canonProject ?? undefined,
|
|
407
441
|
memoryType,
|
|
408
|
-
|
|
442
|
+
// #332: the row's class stamp rides into the stored memories —
|
|
443
|
+
// normalized defensively (a NULL from a pre-v27 row reads
|
|
444
|
+
// standard, same as the read gates).
|
|
445
|
+
privacy: storage.normalizeStoredPrivacy(item.privacy),
|
|
409
446
|
createdAt,
|
|
410
447
|
});
|
|
411
448
|
}
|
|
@@ -439,7 +476,10 @@ async function drainDistillQueue(db, opts) {
|
|
|
439
476
|
report.remaining = queueDepth(db);
|
|
440
477
|
if (report.outcome === "completed") {
|
|
441
478
|
console.log(`[hicortex] Distill inbox drained: ${report.processed} item(s), ` +
|
|
442
|
-
`${report.memories} memories, ${report.duplicates} duplicate skip(s)`
|
|
479
|
+
`${report.memories} memories, ${report.duplicates} duplicate skip(s)` +
|
|
480
|
+
(report.held_confidential
|
|
481
|
+
? `, ${report.held_confidential} confidential item(s) HELD (no confidential model)`
|
|
482
|
+
: ""));
|
|
443
483
|
}
|
|
444
484
|
return report;
|
|
445
485
|
}
|
package/dist/graph.d.ts
CHANGED
|
@@ -37,11 +37,26 @@ export declare function louvainCommunities(db: Database.Database): {
|
|
|
37
37
|
nodeCount: number;
|
|
38
38
|
edgeCount: number;
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* #332: the confidential id set — the hard-omit set for the gated graph
|
|
42
|
+
* surfaces. Computed once per call (the graph ops are single-query + small
|
|
43
|
+
* loops; a corpus-wide id set is cheap). NULL-safe: only
|
|
44
|
+
* privacy = 'confidential' rows enter.
|
|
45
|
+
*/
|
|
46
|
+
export declare function confidentialNodeIds(db: Database.Database): Set<string>;
|
|
40
47
|
/**
|
|
41
48
|
* Find hub nodes — memories with link count significantly above median.
|
|
42
49
|
* Returns nodes with links > threshold (default: 2x median, minimum 3 links).
|
|
50
|
+
*
|
|
51
|
+
* #332: `includeConfidential` defaults to FALSE — the agent-facing surfaces
|
|
52
|
+
* (REST /graph?op=hubs without a member agent, the MCP graph tool) hard-omit
|
|
53
|
+
* confidential hubs (their content snippets ARE content-bearing). The /viz
|
|
54
|
+
* export (the owner surface — deliberately ungated per the #332 owner ruling)
|
|
55
|
+
* passes true.
|
|
43
56
|
*/
|
|
44
|
-
export declare function detectHubs(db: Database.Database, thresholdMultiplier?: number, minLinks?: number
|
|
57
|
+
export declare function detectHubs(db: Database.Database, thresholdMultiplier?: number, minLinks?: number, opts?: {
|
|
58
|
+
includeConfidential?: boolean;
|
|
59
|
+
}): HubNode[];
|
|
45
60
|
export interface GraphNeighbor {
|
|
46
61
|
id: string;
|
|
47
62
|
relationship: string;
|
|
@@ -50,7 +65,9 @@ export interface GraphNeighbor {
|
|
|
50
65
|
content: string;
|
|
51
66
|
project: string | null;
|
|
52
67
|
}
|
|
53
|
-
export declare function getNeighbors(db: Database.Database, memoryId: string, limit?: number, relationship?: string
|
|
68
|
+
export declare function getNeighbors(db: Database.Database, memoryId: string, limit?: number, relationship?: string, opts?: {
|
|
69
|
+
includeConfidential?: boolean;
|
|
70
|
+
}): GraphNeighbor[];
|
|
54
71
|
export declare const EXPORT_DEFAULT_LIMIT = 5000;
|
|
55
72
|
export declare const EXPORT_MAX_LIMIT = 10000;
|
|
56
73
|
export interface VizNode {
|
|
@@ -106,4 +123,12 @@ export interface ExportGraphOptions {
|
|
|
106
123
|
* queries) and feed the per-node linkCount field.
|
|
107
124
|
*/
|
|
108
125
|
export declare function exportGraph(db: Database.Database, options?: ExportGraphOptions): VizGraph;
|
|
109
|
-
|
|
126
|
+
/**
|
|
127
|
+
* BFS shortest path. #332: `includeConfidential` defaults to FALSE —
|
|
128
|
+
* confidential nodes are excluded from TRAVERSAL entirely (a confidential id
|
|
129
|
+
* must not appear even as an intermediate hop; the endpoints' own classes are
|
|
130
|
+
* the caller's gate, same contract as getNeighbors' center).
|
|
131
|
+
*/
|
|
132
|
+
export declare function shortestPath(db: Database.Database, fromId: string, toId: string, maxDepth?: number, opts?: {
|
|
133
|
+
includeConfidential?: boolean;
|
|
134
|
+
}): string[] | null;
|
package/dist/graph.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.EXPORT_MAX_LIMIT = exports.EXPORT_DEFAULT_LIMIT = void 0;
|
|
14
14
|
exports.louvainCommunities = louvainCommunities;
|
|
15
|
+
exports.confidentialNodeIds = confidentialNodeIds;
|
|
15
16
|
exports.detectHubs = detectHubs;
|
|
16
17
|
exports.getNeighbors = getNeighbors;
|
|
17
18
|
exports.exportGraph = exportGraph;
|
|
@@ -139,11 +140,30 @@ function louvainCommunities(db) {
|
|
|
139
140
|
// ---------------------------------------------------------------------------
|
|
140
141
|
// Hub node detection
|
|
141
142
|
// ---------------------------------------------------------------------------
|
|
143
|
+
/**
|
|
144
|
+
* #332: the confidential id set — the hard-omit set for the gated graph
|
|
145
|
+
* surfaces. Computed once per call (the graph ops are single-query + small
|
|
146
|
+
* loops; a corpus-wide id set is cheap). NULL-safe: only
|
|
147
|
+
* privacy = 'confidential' rows enter.
|
|
148
|
+
*/
|
|
149
|
+
function confidentialNodeIds(db) {
|
|
150
|
+
const rows = db
|
|
151
|
+
.prepare("SELECT id FROM memories WHERE privacy = 'confidential'")
|
|
152
|
+
.all();
|
|
153
|
+
return new Set(rows.map((r) => r.id));
|
|
154
|
+
}
|
|
142
155
|
/**
|
|
143
156
|
* Find hub nodes — memories with link count significantly above median.
|
|
144
157
|
* Returns nodes with links > threshold (default: 2x median, minimum 3 links).
|
|
158
|
+
*
|
|
159
|
+
* #332: `includeConfidential` defaults to FALSE — the agent-facing surfaces
|
|
160
|
+
* (REST /graph?op=hubs without a member agent, the MCP graph tool) hard-omit
|
|
161
|
+
* confidential hubs (their content snippets ARE content-bearing). The /viz
|
|
162
|
+
* export (the owner surface — deliberately ungated per the #332 owner ruling)
|
|
163
|
+
* passes true.
|
|
145
164
|
*/
|
|
146
|
-
function detectHubs(db, thresholdMultiplier = 2, minLinks = 3) {
|
|
165
|
+
function detectHubs(db, thresholdMultiplier = 2, minLinks = 3, opts) {
|
|
166
|
+
const hidden = opts?.includeConfidential === true ? null : confidentialNodeIds(db);
|
|
147
167
|
const rows = db
|
|
148
168
|
.prepare(`SELECT id, cnt FROM (
|
|
149
169
|
SELECT id, COUNT(*) as cnt FROM (
|
|
@@ -163,6 +183,8 @@ function detectHubs(db, thresholdMultiplier = 2, minLinks = 3) {
|
|
|
163
183
|
for (const { id, cnt } of rows) {
|
|
164
184
|
if (cnt < threshold)
|
|
165
185
|
break; // sorted desc, no more hubs
|
|
186
|
+
if (hidden?.has(id))
|
|
187
|
+
continue;
|
|
166
188
|
const mem = db
|
|
167
189
|
.prepare("SELECT content, project, domain FROM memories WHERE id = ?")
|
|
168
190
|
.get(id);
|
|
@@ -178,7 +200,13 @@ function detectHubs(db, thresholdMultiplier = 2, minLinks = 3) {
|
|
|
178
200
|
}
|
|
179
201
|
return hubs;
|
|
180
202
|
}
|
|
181
|
-
function getNeighbors(db, memoryId, limit = 10, relationship) {
|
|
203
|
+
function getNeighbors(db, memoryId, limit = 10, relationship, opts) {
|
|
204
|
+
// #332: hard-omit set for confidential NEIGHBORS (their content rides the
|
|
205
|
+
// row). The CENTER memory's own class is the CALLER's gate — an
|
|
206
|
+
// agent-facing adapter must refuse a confidential center id before calling
|
|
207
|
+
// (REST /graph and the MCP tool 404 it for non-members, same contract as
|
|
208
|
+
// GET /memory). Default false = omit; the owner surfaces pass true.
|
|
209
|
+
const hidden = opts?.includeConfidential === true ? null : confidentialNodeIds(db);
|
|
182
210
|
let sql = `SELECT source_id, target_id, relationship, strength
|
|
183
211
|
FROM memory_links
|
|
184
212
|
WHERE (source_id = ? OR target_id = ?)`;
|
|
@@ -196,6 +224,8 @@ function getNeighbors(db, memoryId, limit = 10, relationship) {
|
|
|
196
224
|
for (const row of rows) {
|
|
197
225
|
const isOutgoing = row.source_id === memoryId;
|
|
198
226
|
const neighborId = isOutgoing ? row.target_id : row.source_id;
|
|
227
|
+
if (hidden?.has(neighborId))
|
|
228
|
+
continue;
|
|
199
229
|
const mem = db
|
|
200
230
|
.prepare("SELECT content, project FROM memories WHERE id = ?")
|
|
201
231
|
.get(neighborId);
|
|
@@ -270,7 +300,10 @@ function exportGraph(db, options = {}) {
|
|
|
270
300
|
if (where.length > 0)
|
|
271
301
|
sql += ` WHERE ${where.join(" AND ")}`;
|
|
272
302
|
const rows = db.prepare(sql).all(...params);
|
|
273
|
-
|
|
303
|
+
// #332: the /viz export is the OWNER surface — deliberately ungated per the
|
|
304
|
+
// issue-332 owner ruling ("dashboard/viz NOT gated in this build"; a
|
|
305
|
+
// show-confidential graph toggle is a separate later item). Explicit true.
|
|
306
|
+
const hubIds = new Set(detectHubs(db, 2, 3, { includeConfidential: true }).map((h) => h.id));
|
|
274
307
|
// Score, filter on effective strength, rank, cap
|
|
275
308
|
const scored = rows.map((row) => {
|
|
276
309
|
const linkCount = linkCounts.get(row.id) ?? 0;
|
|
@@ -356,13 +389,22 @@ function exportGraph(db, options = {}) {
|
|
|
356
389
|
// ---------------------------------------------------------------------------
|
|
357
390
|
// Shortest path (for MCP tool)
|
|
358
391
|
// ---------------------------------------------------------------------------
|
|
359
|
-
|
|
392
|
+
/**
|
|
393
|
+
* BFS shortest path. #332: `includeConfidential` defaults to FALSE —
|
|
394
|
+
* confidential nodes are excluded from TRAVERSAL entirely (a confidential id
|
|
395
|
+
* must not appear even as an intermediate hop; the endpoints' own classes are
|
|
396
|
+
* the caller's gate, same contract as getNeighbors' center).
|
|
397
|
+
*/
|
|
398
|
+
function shortestPath(db, fromId, toId, maxDepth = 5, opts) {
|
|
360
399
|
// BFS on the memory_links graph
|
|
361
400
|
const links = db
|
|
362
401
|
.prepare("SELECT source_id, target_id FROM memory_links")
|
|
363
402
|
.all();
|
|
403
|
+
const hidden = opts?.includeConfidential === true ? null : confidentialNodeIds(db);
|
|
364
404
|
const adj = new Map();
|
|
365
405
|
for (const { source_id, target_id } of links) {
|
|
406
|
+
if (hidden?.has(source_id) || hidden?.has(target_id))
|
|
407
|
+
continue;
|
|
366
408
|
if (!adj.has(source_id))
|
|
367
409
|
adj.set(source_id, new Set());
|
|
368
410
|
adj.get(source_id).add(target_id);
|
package/dist/init.d.ts
CHANGED
|
@@ -379,11 +379,8 @@ export declare function resolveTimerJitterSeconds(configDir?: string): number;
|
|
|
379
379
|
*/
|
|
380
380
|
export declare function randomMinuteOffset(jitterSec: number, rand?: () => number): number;
|
|
381
381
|
/**
|
|
382
|
-
* Resolve the CONSOLIDATION hours (the only
|
|
383
|
-
*
|
|
384
|
-
* across client + server/co-located — so this function no longer returns a
|
|
385
|
-
* capture schedule. Returns null in client mode (no local DB → no
|
|
386
|
-
* consolidation timer).
|
|
382
|
+
* Resolve the CONSOLIDATION hours (the only scheduled timer). Returns null in
|
|
383
|
+
* client mode (no local DB → no consolidation timer).
|
|
387
384
|
*
|
|
388
385
|
* Priority: `consolidationHours` array → legacy `nightlyHour` (single int, only
|
|
389
386
|
* when the array key is absent → one consolidation slot at H, preserving the
|
|
@@ -412,12 +409,24 @@ export declare function formatOnCalendarLines(hours: number[]): string;
|
|
|
412
409
|
export declare function formatLaunchdIntervals(hours: number[], minuteOffset?: number): string;
|
|
413
410
|
/**
|
|
414
411
|
* The systemd `[Timer]` body (everything between `[Timer]` and the next stanza).
|
|
415
|
-
* Exported for testing the #256 jitter line. `isInterval` selects the
|
|
416
|
-
* poll form (OnBootSec + OnUnitActiveSec
|
|
417
|
-
*
|
|
418
|
-
*
|
|
412
|
+
* Exported for testing the #256 jitter line. `isInterval` selects the interval
|
|
413
|
+
* poll form (OnBootSec + OnUnitActiveSec — no current caller since the capture
|
|
414
|
+
* watchdog retired, #596); otherwise one `OnCalendar` line per hour. When
|
|
415
|
+
* `jitterSec > 0` a single `RandomizedDelaySec=<n>` is appended — it applies to
|
|
416
|
+
* every OnCalendar entry AND to OnUnitActiveSec (systemd semantics).
|
|
419
417
|
*/
|
|
420
418
|
export declare function formatSystemdTimerBody(isInterval: boolean, intervalSec: number, hours: number[], jitterSec: number): string;
|
|
419
|
+
/**
|
|
420
|
+
* Remove the CAPTURE WATCHDOG timer (retired, #596 — obsolete since the
|
|
421
|
+
* distill queue #529: distillation runs on the server's scheduled drains, so
|
|
422
|
+
* shortening capture-arrival latency served nothing; see the scheduling doc
|
|
423
|
+
* above, incl. the OnActiveSec note if a timer of this shape is ever rebuilt).
|
|
424
|
+
* Stops + deletes a `hicortex-capture` timer/service pair (or the macOS plist)
|
|
425
|
+
* left by a 0.17–0.26 install, so an old install is cleaned by its next init
|
|
426
|
+
* and a re-init can never resurrect the unit. Fail-soft: nothing installed →
|
|
427
|
+
* silent no-op. Exported for the #596 retirement tests.
|
|
428
|
+
*/
|
|
429
|
+
export declare function removeCaptureWatchdogTimer(): void;
|
|
421
430
|
/**
|
|
422
431
|
* Install the CONSOLIDATION timer (full `nightly`). Reuses the existing
|
|
423
432
|
* `hicortex-nightly` unit name (repurposed from the pre-0.17 single full-nightly).
|