pi-mega-compact 0.20.5 → 0.20.7
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/dist/config/vector-cortex.js +12 -0
- package/dist/config.js +1 -1
- package/dist/extensions/dashboard-server/routes-rag-settings-helpers.js +3 -31
- package/dist/extensions/dashboard-server/routes-rag-settings-types.js +11 -0
- package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +43 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex-rollout.js +43 -0
- package/dist/extensions/dashboard-server/routes-vector-cortex.js +1 -0
- package/dist/extensions/dashboard-server/routes.js +1 -1
- package/dist/extensions/dashboard-server/server.js +3 -1
- package/dist/extensions/mega-runtime/vector-cortex-live.js +105 -0
- package/dist/src/config/dedup.js +1 -0
- package/dist/src/config/vector-cortex.js +12 -0
- package/dist/src/config.js +1 -1
- package/dist/src/dedup-audit.test-helpers.js +43 -0
- package/dist/src/monitoring.js +9 -0
- package/dist/src/vector-cortex/rollout/_acceptance-fixture.js +55 -0
- package/dist/src/vector-cortex/rollout/_acceptance-helpers.js +8 -0
- package/dist/src/vector-cortex/rollout/_acceptance-scenario.js +70 -0
- package/dist/src/vector-cortex/rollout/assign.js +56 -0
- package/dist/src/vector-cortex/rollout/emit.js +50 -0
- package/dist/src/vector-cortex/rollout/gate.js +75 -0
- package/dist/src/vector-cortex/rollout/types.js +39 -0
- package/dist/src/vectorStore/add-l0.js +108 -0
- package/dist/src/vectorStore/add-l1.js +35 -0
- package/dist/src/vectorStore/add.js +229 -0
- package/dist/src/vectorStore/class.js +15 -291
- package/dist/src/vectorStore/dedup-audit.js +104 -0
- package/dist/src/vectorStore.js +1 -0
- package/dist/vector-cortex/rollout/_acceptance-fixture.js +55 -0
- package/dist/vector-cortex/rollout/_acceptance-helpers.js +8 -0
- package/dist/vector-cortex/rollout/_acceptance-scenario.js +70 -0
- package/dist/vector-cortex/rollout/assign.js +56 -0
- package/dist/vector-cortex/rollout/emit.js +50 -0
- package/dist/vector-cortex/rollout/gate.js +75 -0
- package/dist/vector-cortex/rollout/types.js +39 -0
- package/extensions/dashboard-client/dist/assets/{AreaChart-CGL29Tcl.js → AreaChart-DqTbaSRA.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-CGL29Tcl.js.map → AreaChart-DqTbaSRA.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-OxhalIZa.js → BarChart-BfNBeOvF.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-OxhalIZa.js.map → BarChart-BfNBeOvF.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-VcMFwL-6.js → CacheTab-C9SOMYB5.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-VcMFwL-6.js.map → CacheTab-C9SOMYB5.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-DePofXDM.js → EventsTab-GsMKP10_.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-DePofXDM.js.map → EventsTab-GsMKP10_.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-nQd1tjSF.js → HealthTab-DAOCXwRP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-nQd1tjSF.js.map → HealthTab-DAOCXwRP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CzvA8-F6.js → MaintenanceTab-BtBeMkB5.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CzvA8-F6.js.map → MaintenanceTab-BtBeMkB5.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-3lxgWBvU.js → MemoryMapTab-DzndtgkZ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-3lxgWBvU.js.map → MemoryMapTab-DzndtgkZ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-D_FcA6kN.js → MetricsTab-DyxJ4eb8.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-D_FcA6kN.js.map → MetricsTab-DyxJ4eb8.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-BU6R4aEs.js → OverviewTab-DCiEdVWR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-BU6R4aEs.js.map → OverviewTab-DCiEdVWR.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-DFjy1isz.js → ReposTab-B5SIqVHA.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-DFjy1isz.js.map → ReposTab-B5SIqVHA.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-UGIzIH25.js → SessionsTab-DLWFJ9xI.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-UGIzIH25.js.map → SessionsTab-DLWFJ9xI.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-CECrgMKI.js → SetupTab-CvGXZyej.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-CECrgMKI.js.map → SetupTab-CvGXZyej.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-Dyy4SCDk.js → TimeSavedCard-wZuQGxLS.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-Dyy4SCDk.js.map → TimeSavedCard-wZuQGxLS.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-B0LPcVs1.js → TurnsTab-B7aOejch.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-B0LPcVs1.js.map → TurnsTab-B7aOejch.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-eHVt9yDx.js +2 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-eHVt9yDx.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{WikiTab-DWk9Qvut.js → WikiTab-DhWHjAtt.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-DWk9Qvut.js.map → WikiTab-DhWHjAtt.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-O59wPr5H.js → button-BrC-W87h.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-O59wPr5H.js.map → button-BrC-W87h.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-C-DxXv1-.js → card-0rgfRgr3.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-C-DxXv1-.js.map → card-0rgfRgr3.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-Dw5YnE5s.js → generateCategoricalChart-DRresOQF.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-Dw5YnE5s.js.map → generateCategoricalChart-DRresOQF.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-i9oaPE0a.js → index-DohmtZWL.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-i9oaPE0a.js.map → index-DohmtZWL.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-B69QY3IM.js → switch-Bs8g_zB5.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-B69QY3IM.js.map → switch-Bs8g_zB5.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-BJ4Kwggu.js → toggle-DVVauIo8.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-BJ4Kwggu.js.map → toggle-DVVauIo8.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-BpuA8sPd.js → useSSE-DxH1PTAR.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-BpuA8sPd.js.map → useSSE-DxH1PTAR.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/api/vector-cortex.ts +9 -0
- package/extensions/dashboard-client/src/tabs/VectorCortexRolloutCard.tsx +44 -0
- package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +8 -0
- package/extensions/dashboard-client/src/types/vector-cortex.ts +17 -0
- package/extensions/dashboard-server/api-contracts/vector-cortex.ts +32 -1
- package/extensions/dashboard-server/routes-rag-settings-helpers.ts +11 -129
- package/extensions/dashboard-server/routes-rag-settings-types.ts +34 -0
- package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +142 -0
- package/extensions/dashboard-server/routes-vector-cortex-rollout.ts +52 -0
- package/extensions/dashboard-server/routes-vector-cortex.ts +1 -0
- package/extensions/dashboard-server/routes.ts +1 -0
- package/extensions/dashboard-server/server.ts +2 -0
- package/extensions/mega-runtime/vector-cortex-live.ts +165 -0
- package/package.json +1 -1
- package/src/config/dedup.ts +9 -0
- package/src/config/vector-cortex.ts +13 -0
- package/src/config.ts +1 -0
- package/src/dedup-audit.test-helpers.ts +49 -0
- package/src/monitoring.ts +10 -0
- package/src/vector-cortex/rollout/_acceptance-fixture.ts +94 -0
- package/src/vector-cortex/rollout/_acceptance-helpers.ts +24 -0
- package/src/vector-cortex/rollout/_acceptance-scenario.ts +96 -0
- package/src/vector-cortex/rollout/assign.ts +67 -0
- package/src/vector-cortex/rollout/emit.ts +81 -0
- package/src/vector-cortex/rollout/gate.ts +119 -0
- package/src/vector-cortex/rollout/types.ts +111 -0
- package/src/vectorStore/add-l0.ts +152 -0
- package/src/vectorStore/add-l1.ts +57 -0
- package/src/vectorStore/add.ts +269 -0
- package/src/vectorStore/class.ts +17 -327
- package/src/vectorStore/dedup-audit.ts +199 -0
- package/src/vectorStore.ts +1 -0
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-BWi3u_gp.js +0 -2
- package/extensions/dashboard-client/dist/assets/VectorCortexTab-BWi3u_gp.js.map +0 -1
|
@@ -7,25 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* PREVENT-011: no `any` type.
|
|
9
9
|
*/
|
|
10
|
+
import type { SettingSpec, SettingGroup } from "./routes-rag-settings-types.js";
|
|
11
|
+
import { VECTOR_CORTEX_SETTINGS } from "./routes-rag-settings-vector-cortex.js";
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Base metadata for a single setting entry before its live `value` is resolved.
|
|
14
|
-
* `category` and `value` are filled in at read time by the handler.
|
|
15
|
-
*/
|
|
16
|
-
export interface SettingSpec {
|
|
17
|
-
key: string;
|
|
18
|
-
label: string;
|
|
19
|
-
description: string;
|
|
20
|
-
type: "boolean" | "number" | "string";
|
|
21
|
-
default: string | number | boolean;
|
|
22
|
-
/** True when this is a `_DISABLED`-convention opt-out flag. */
|
|
23
|
-
disabledConvention: boolean;
|
|
24
|
-
requiresLlm: boolean;
|
|
25
|
-
unit?: string;
|
|
26
|
-
min?: number;
|
|
27
|
-
max?: number;
|
|
28
|
-
}
|
|
13
|
+
export type { SettingSpec } from "./routes-rag-settings-types.js";
|
|
29
14
|
|
|
30
15
|
// Shorthand builders to keep the inventory terse and unambiguous.
|
|
31
16
|
const boolFlag = (
|
|
@@ -96,10 +81,7 @@ const str = (
|
|
|
96
81
|
});
|
|
97
82
|
|
|
98
83
|
/** Every adjustable setting, grouped by category. Read-only after module load. */
|
|
99
|
-
export const SETTINGS: ReadonlyArray<
|
|
100
|
-
name: string;
|
|
101
|
-
settings: SettingSpec[];
|
|
102
|
-
}> = [
|
|
84
|
+
export const SETTINGS: ReadonlyArray<SettingGroup> = [
|
|
103
85
|
{
|
|
104
86
|
name: "RAG Pipeline",
|
|
105
87
|
settings: [
|
|
@@ -233,6 +215,12 @@ export const SETTINGS: ReadonlyArray<{
|
|
|
233
215
|
boolDirect("MEGACOMPACT_MARK_ONLY_L1", "Mark Only L1", "L1 runs but does not collapse", false),
|
|
234
216
|
boolDirect("MEGACOMPACT_MARK_ONLY_L2", "Mark Only L2", "L2 runs but does not collapse", false),
|
|
235
217
|
boolDirect("MEGACOMPACT_MINILM", "MiniLM Embedder", "Use MiniLM instead of trigram", false),
|
|
218
|
+
boolDirect(
|
|
219
|
+
"MEGACOMPACT_DEDUP_AUDIT",
|
|
220
|
+
"Dedup Audit Trail",
|
|
221
|
+
"Append one events.log line per tier decision (which layer collapsed a region, onto what, at what similarity) to tune the thresholds below. Pure instrumentation — dedup behavior is identical either way.",
|
|
222
|
+
true,
|
|
223
|
+
),
|
|
236
224
|
],
|
|
237
225
|
},
|
|
238
226
|
{
|
|
@@ -274,113 +262,7 @@ export const SETTINGS: ReadonlyArray<{
|
|
|
274
262
|
num("MEGACOMPACT_EMBEDDING_CHARS_PER_TOKEN", "Embedding Chars per Token", "Estimated characters per token used for embedder chunking size", 4, 1, 32),
|
|
275
263
|
],
|
|
276
264
|
},
|
|
277
|
-
|
|
278
|
-
name: "Vector Cortex",
|
|
279
|
-
settings: [
|
|
280
|
-
boolDirect(
|
|
281
|
-
"MEGACOMPACT_VC0A",
|
|
282
|
-
"VC0A Baseline Observability",
|
|
283
|
-
"Structured evaluation observer (MetricEventV1 + latency histogram). OFF = mode C, byte-identical to predecessor.",
|
|
284
|
-
true,
|
|
285
|
-
),
|
|
286
|
-
boolDirect(
|
|
287
|
-
"MEGACOMPACT_VC0B",
|
|
288
|
-
"VC0B Replay Correctness",
|
|
289
|
-
"ReplayCutV2 effective-cut (min of boundary-safe/commit/capture high-water + pair retreat + anchor floor) and M3 effective-cut-v2 migration. OFF = legacy capped replay, byte-identical.",
|
|
290
|
-
true,
|
|
291
|
-
),
|
|
292
|
-
boolDirect(
|
|
293
|
-
"MEGACOMPACT_VC1A",
|
|
294
|
-
"VC1A Canonical Byte Events",
|
|
295
|
-
"EventV2 byte-authority ledger codec (original bytes + SHA-256, strict UTF-8, derived NFC) and canonical validator (EVT_DIGEST_MISMATCH / EVT_UTF8_TAG_INVALID / EVT_DUPLICATE_ID). OFF = mode C, transcript codec unchanged, byte-identical.",
|
|
296
|
-
true,
|
|
297
|
-
),
|
|
298
|
-
boolDirect(
|
|
299
|
-
"MEGACOMPACT_VC1B",
|
|
300
|
-
"VC1B Occurrence Ledger + Tool Identity",
|
|
301
|
-
"Neutral occurrence ledger (LedgerReader/Writer/Admin + CompatJournalV1): per-session monotonic seq, tool result references one earlier call, uniqueness by (eventId,digest) only, and the M2 copy-validate-switch downgrade journal. OFF = mode C, ledger unwritten, byte-identical.",
|
|
302
|
-
true,
|
|
303
|
-
),
|
|
304
|
-
boolDirect(
|
|
305
|
-
"MEGACOMPACT_VC0C",
|
|
306
|
-
"VC0C Live Safety Envelope",
|
|
307
|
-
"TriadResult/Breaker live circuit breaker (60s window, 20 attempts, 30s cooldown, 3 probes, 5min healthy residence) + durable spool before provider invocation; manual reset clears cooldown but never evidence. OFF = mode C, unchanged transcript, byte-identical.",
|
|
308
|
-
true,
|
|
309
|
-
),
|
|
310
|
-
boolDirect(
|
|
311
|
-
"MEGACOMPACT_VC1C",
|
|
312
|
-
"VC1C Cross-Language Conformance v2",
|
|
313
|
-
"FixtureManifestV2 canonical manifest validator + DowngradeReport deterministic downgrade export + MinHashV2 exact big-integer signatures and the M4 copy/validate/switch minhash-v2 migration (seed table frozen, cross-language byte-exact). OFF = mode C, v1 sync dedup scan unchanged, byte-identical.",
|
|
314
|
-
true,
|
|
315
|
-
),
|
|
316
|
-
boolDirect(
|
|
317
|
-
"MEGACOMPACT_VC2A",
|
|
318
|
-
"VC2A Offline Model Runtime",
|
|
319
|
-
"ModelManifestV1 digest-before-load ONNX runtime (opset17/batch1/max512) + asset-free trigram demotion. Asset path assets/vector-cortex/encoder-v1 is immutable/digest-pinned. OFF = mode C, byte-identical to predecessor.",
|
|
320
|
-
true,
|
|
321
|
-
),
|
|
322
|
-
boolDirect(
|
|
323
|
-
"MEGACOMPACT_VC2B",
|
|
324
|
-
"VC2B Multi-Head Encoder",
|
|
325
|
-
"VectorSetV1 five L2-normalized heads (384/128/128/64/32) with head-calibration draft + asset-free trigram B (512d) and lexical C fallbacks, plus the per-head emit seam. OFF = mode C, no per-head vectors emitted, byte-identical predecessor.",
|
|
326
|
-
true,
|
|
327
|
-
),
|
|
328
|
-
boolDirect(
|
|
329
|
-
"MEGACOMPACT_VC2C",
|
|
330
|
-
"VC2C Encoder Qualification + Calibration",
|
|
331
|
-
"QualifiedEncoderV1/CalibrationV1: calibration fit on the calibration split only (held-out labels prohibited) + atomic selection across MODEL_ASSET and per-head EVALUATION thresholds (any field failure demotes all of A). OFF = mode C, no qualification/calibration selection, byte-identical predecessor.",
|
|
332
|
-
true,
|
|
333
|
-
),
|
|
334
|
-
boolDirect(
|
|
335
|
-
"MEGACOMPACT_VC3A",
|
|
336
|
-
"VC3A Cortex Store",
|
|
337
|
-
"Capability-gated derived cortex store (CortexReader/Writer/Admin + CortexRecordV1): additive, keyed (sourceHighWater, algorithmVersion, id), immutable records, deterministic generation rebuild + one root digest. OFF = mode C, no cortex records written, byte-identical predecessor.",
|
|
338
|
-
true,
|
|
339
|
-
),
|
|
340
|
-
boolDirect(
|
|
341
|
-
"MEGACOMPACT_VC3B",
|
|
342
|
-
"VC3B Deterministic Topology",
|
|
343
|
-
"Deterministic cortical topology (TopologyV1/EdgeV1): per-(source,head) top-k=16/head calibrated-threshold edges, stable score-desc/then-target-ID sort, dependency directed + contradiction symmetric paired records, one stable generation digest. OFF = mode C, no topology graph built/emitted, predecessor-precise topology view, byte-identical predecessor.",
|
|
344
|
-
true,
|
|
345
|
-
),
|
|
346
|
-
boolDirect(
|
|
347
|
-
"MEGACOMPACT_VC3C",
|
|
348
|
-
"VC3C Topology Query + Router Invalidation",
|
|
349
|
-
"TopologyQueryV1/RouterKeyV2 structured keys (length-delimited, unsigned-byte order, no prefix ambiguity), exact (session,generation) invalidation, stale-generation rejection (TOP_GENERATION_STALE), and the M6 router-generation-v2 copy/validate/switch migration. OFF = mode C, no structured router key / generation invalidation, byte-identical predecessor.",
|
|
350
|
-
true,
|
|
351
|
-
),
|
|
352
|
-
boolDirect(
|
|
353
|
-
"MEGACOMPACT_VC4A",
|
|
354
|
-
"VC4A Dual-Tier Shards",
|
|
355
|
-
"SemanticShardV1/ExactShardV1/ShardManifestV1: partition a session ONLY at complete EventV2 boundaries; exact shards preserve every tool call/result pair, anchor and invalid UTF-8 event as original bytes (pairs never split across exact shards); manifest enforces disjoint sorted ranges + complete protected-span coverage. OFF = mode C, exact anchors/current transcript only, byte-identical predecessor.",
|
|
356
|
-
true,
|
|
357
|
-
),
|
|
358
|
-
boolDirect(
|
|
359
|
-
"MEGACOMPACT_VC4B",
|
|
360
|
-
"VC4B Residual Basis Parity",
|
|
361
|
-
"Residual codec: orthonormal DCT-II basis + int16 block quantization + block-scoped exact correction stream + (9,6) Reed-Solomon parity shards with SHA-256 corruption detection; admission gates on encodedSize <= 95% of exact-compressed size. OFF = mode C, no residual artifact produced, byte-identical predecessor.",
|
|
362
|
-
true,
|
|
363
|
-
),
|
|
364
|
-
boolDirect(
|
|
365
|
-
"MEGACOMPACT_VC4C",
|
|
366
|
-
"VC4C Reconstruction Fidelity",
|
|
367
|
-
"Conservative closure + source-order assembly + reconstruction validator: recursively closes dependencies and whole tool pairs to a fixed point, resolves contradictions by retaining the later exact source resolution, assembles spans solely by source range, and rejects missing anchors / split pairs / digest mismatch / unresolved contradiction. Mandatory token estimate is content-only and handed unchanged to VC5A. OFF = mode C, no closure/validator, byte-identical predecessor (VC4B).",
|
|
368
|
-
true,
|
|
369
|
-
),
|
|
370
|
-
boolDirect(
|
|
371
|
-
"MEGACOMPACT_VC5A",
|
|
372
|
-
"VC5A PromptDagV1 + Budgeted Planner",
|
|
373
|
-
"Single-session DAG (PromptDagV1) + budgeted 0/1 portfolio planner: builds a stable Kahn-ordered DAG, computes the mandatory dependency/tool/anchor closure before optional selection, returns MANDATORY_CLOSURE_OVER_BUDGET with evidence preserved on overflow, and runs a utility-per-token portfolio that never exceeds the remaining budget. Framing is owned here, not in VC4C. OFF = byte-identical predecessor (VC4C).",
|
|
374
|
-
true,
|
|
375
|
-
),
|
|
376
|
-
boolDirect(
|
|
377
|
-
"MEGACOMPACT_VC5B",
|
|
378
|
-
"VC5B Validated Renderer + Provider Profiles",
|
|
379
|
-
"Validated prompt renderer: replays VC5A's stable Kahn order verbatim, preserves exact tool bytes (PREVENT-PI-002), places compacted context via the host before_agent_start prepend seam — never role:system (PREVENT-PI-003) — and SHA-256 hashes the entire canonical outbound request before provider invocation. Unknown provider/model cleanly bypasses to the predecessor prompt path. OFF = byte-identical predecessor (VC5A).",
|
|
380
|
-
true,
|
|
381
|
-
),
|
|
382
|
-
],
|
|
383
|
-
},
|
|
265
|
+
VECTOR_CORTEX_SETTINGS,
|
|
384
266
|
{
|
|
385
267
|
name: "Cost API",
|
|
386
268
|
settings: [
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dashboard-server/routes-rag-settings-types.ts — SETTINGS inventory contract.
|
|
3
|
+
*
|
|
4
|
+
* The shared shapes the settings inventory is built from. Extracted so the
|
|
5
|
+
* inventory can be split across sibling files (helpers.ts + the per-area groups)
|
|
6
|
+
* without either side importing the other's data — contract-first, per
|
|
7
|
+
* docs/ENGINEERING_PRACTICES.md.
|
|
8
|
+
*
|
|
9
|
+
* PREVENT-011: no `any` type.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Base metadata for a single setting entry before its live `value` is resolved.
|
|
14
|
+
* `category` and `value` are filled in at read time by the handler.
|
|
15
|
+
*/
|
|
16
|
+
export interface SettingSpec {
|
|
17
|
+
key: string;
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
type: "boolean" | "number" | "string";
|
|
21
|
+
default: string | number | boolean;
|
|
22
|
+
/** True when this is a `_DISABLED`-convention opt-out flag. */
|
|
23
|
+
disabledConvention: boolean;
|
|
24
|
+
requiresLlm: boolean;
|
|
25
|
+
unit?: string;
|
|
26
|
+
min?: number;
|
|
27
|
+
max?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** One named category of settings as rendered by the Setup panel. */
|
|
31
|
+
export interface SettingGroup {
|
|
32
|
+
name: string;
|
|
33
|
+
settings: SettingSpec[];
|
|
34
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dashboard-server/routes-rag-settings-vector-cortex.ts — Vector Cortex SETTINGS.
|
|
3
|
+
*
|
|
4
|
+
* The VC0A..VC5C chain flag inventory, split out of routes-rag-settings-helpers.ts
|
|
5
|
+
* to keep that file under the 400-line extensions/ soft limit. Every VC flag is a
|
|
6
|
+
* user-visible dashboard toggle (never in EXCLUDED_SETTINGS) per the chain spec,
|
|
7
|
+
* and each carries the long description the Setup panel renders as help text.
|
|
8
|
+
*
|
|
9
|
+
* PREVENT-011: no `any` type.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { SettingSpec, SettingGroup } from "./routes-rag-settings-types.js";
|
|
13
|
+
|
|
14
|
+
const boolDirect = (
|
|
15
|
+
key: string,
|
|
16
|
+
label: string,
|
|
17
|
+
description: string,
|
|
18
|
+
def: boolean,
|
|
19
|
+
): SettingSpec => ({
|
|
20
|
+
key,
|
|
21
|
+
label,
|
|
22
|
+
description,
|
|
23
|
+
type: "boolean",
|
|
24
|
+
default: def,
|
|
25
|
+
disabledConvention: false,
|
|
26
|
+
requiresLlm: false,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/** The Vector Cortex chain flags, as one SETTINGS category. */
|
|
30
|
+
export const VECTOR_CORTEX_SETTINGS: SettingGroup = {
|
|
31
|
+
name: "Vector Cortex",
|
|
32
|
+
settings: [
|
|
33
|
+
boolDirect(
|
|
34
|
+
"MEGACOMPACT_VC0A",
|
|
35
|
+
"VC0A Baseline Observability",
|
|
36
|
+
"Structured evaluation observer (MetricEventV1 + latency histogram). OFF = mode C, byte-identical to predecessor.",
|
|
37
|
+
true,
|
|
38
|
+
),
|
|
39
|
+
boolDirect(
|
|
40
|
+
"MEGACOMPACT_VC0B",
|
|
41
|
+
"VC0B Replay Correctness",
|
|
42
|
+
"ReplayCutV2 effective-cut (min of boundary-safe/commit/capture high-water + pair retreat + anchor floor) and M3 effective-cut-v2 migration. OFF = legacy capped replay, byte-identical.",
|
|
43
|
+
true,
|
|
44
|
+
),
|
|
45
|
+
boolDirect(
|
|
46
|
+
"MEGACOMPACT_VC1A",
|
|
47
|
+
"VC1A Canonical Byte Events",
|
|
48
|
+
"EventV2 byte-authority ledger codec (original bytes + SHA-256, strict UTF-8, derived NFC) and canonical validator (EVT_DIGEST_MISMATCH / EVT_UTF8_TAG_INVALID / EVT_DUPLICATE_ID). OFF = mode C, transcript codec unchanged, byte-identical.",
|
|
49
|
+
true,
|
|
50
|
+
),
|
|
51
|
+
boolDirect(
|
|
52
|
+
"MEGACOMPACT_VC1B",
|
|
53
|
+
"VC1B Occurrence Ledger + Tool Identity",
|
|
54
|
+
"Neutral occurrence ledger (LedgerReader/Writer/Admin + CompatJournalV1): per-session monotonic seq, tool result references one earlier call, uniqueness by (eventId,digest) only, and the M2 copy-validate-switch downgrade journal. OFF = mode C, ledger unwritten, byte-identical.",
|
|
55
|
+
true,
|
|
56
|
+
),
|
|
57
|
+
boolDirect(
|
|
58
|
+
"MEGACOMPACT_VC0C",
|
|
59
|
+
"VC0C Live Safety Envelope",
|
|
60
|
+
"TriadResult/Breaker live circuit breaker (60s window, 20 attempts, 30s cooldown, 3 probes, 5min healthy residence) + durable spool before provider invocation; manual reset clears cooldown but never evidence. OFF = mode C, unchanged transcript, byte-identical.",
|
|
61
|
+
true,
|
|
62
|
+
),
|
|
63
|
+
boolDirect(
|
|
64
|
+
"MEGACOMPACT_VC1C",
|
|
65
|
+
"VC1C Cross-Language Conformance v2",
|
|
66
|
+
"FixtureManifestV2 canonical manifest validator + DowngradeReport deterministic downgrade export + MinHashV2 exact big-integer signatures and the M4 copy/validate/switch minhash-v2 migration (seed table frozen, cross-language byte-exact). OFF = mode C, v1 sync dedup scan unchanged, byte-identical.",
|
|
67
|
+
true,
|
|
68
|
+
),
|
|
69
|
+
boolDirect(
|
|
70
|
+
"MEGACOMPACT_VC2A",
|
|
71
|
+
"VC2A Offline Model Runtime",
|
|
72
|
+
"ModelManifestV1 digest-before-load ONNX runtime (opset17/batch1/max512) + asset-free trigram demotion. Asset path assets/vector-cortex/encoder-v1 is immutable/digest-pinned. OFF = mode C, byte-identical to predecessor.",
|
|
73
|
+
true,
|
|
74
|
+
),
|
|
75
|
+
boolDirect(
|
|
76
|
+
"MEGACOMPACT_VC2B",
|
|
77
|
+
"VC2B Multi-Head Encoder",
|
|
78
|
+
"VectorSetV1 five L2-normalized heads (384/128/128/64/32) with head-calibration draft + asset-free trigram B (512d) and lexical C fallbacks, plus the per-head emit seam. OFF = mode C, no per-head vectors emitted, byte-identical predecessor.",
|
|
79
|
+
true,
|
|
80
|
+
),
|
|
81
|
+
boolDirect(
|
|
82
|
+
"MEGACOMPACT_VC2C",
|
|
83
|
+
"VC2C Encoder Qualification + Calibration",
|
|
84
|
+
"QualifiedEncoderV1/CalibrationV1: calibration fit on the calibration split only (held-out labels prohibited) + atomic selection across MODEL_ASSET and per-head EVALUATION thresholds (any field failure demotes all of A). OFF = mode C, no qualification/calibration selection, byte-identical predecessor.",
|
|
85
|
+
true,
|
|
86
|
+
),
|
|
87
|
+
boolDirect(
|
|
88
|
+
"MEGACOMPACT_VC3A",
|
|
89
|
+
"VC3A Cortex Store",
|
|
90
|
+
"Capability-gated derived cortex store (CortexReader/Writer/Admin + CortexRecordV1): additive, keyed (sourceHighWater, algorithmVersion, id), immutable records, deterministic generation rebuild + one root digest. OFF = mode C, no cortex records written, byte-identical predecessor.",
|
|
91
|
+
true,
|
|
92
|
+
),
|
|
93
|
+
boolDirect(
|
|
94
|
+
"MEGACOMPACT_VC3B",
|
|
95
|
+
"VC3B Deterministic Topology",
|
|
96
|
+
"Deterministic cortical topology (TopologyV1/EdgeV1): per-(source,head) top-k=16/head calibrated-threshold edges, stable score-desc/then-target-ID sort, dependency directed + contradiction symmetric paired records, one stable generation digest. OFF = mode C, no topology graph built/emitted, predecessor-precise topology view, byte-identical predecessor.",
|
|
97
|
+
true,
|
|
98
|
+
),
|
|
99
|
+
boolDirect(
|
|
100
|
+
"MEGACOMPACT_VC3C",
|
|
101
|
+
"VC3C Topology Query + Router Invalidation",
|
|
102
|
+
"TopologyQueryV1/RouterKeyV2 structured keys (length-delimited, unsigned-byte order, no prefix ambiguity), exact (session,generation) invalidation, stale-generation rejection (TOP_GENERATION_STALE), and the M6 router-generation-v2 copy/validate/switch migration. OFF = mode C, no structured router key / generation invalidation, byte-identical predecessor.",
|
|
103
|
+
true,
|
|
104
|
+
),
|
|
105
|
+
boolDirect(
|
|
106
|
+
"MEGACOMPACT_VC4A",
|
|
107
|
+
"VC4A Dual-Tier Shards",
|
|
108
|
+
"SemanticShardV1/ExactShardV1/ShardManifestV1: partition a session ONLY at complete EventV2 boundaries; exact shards preserve every tool call/result pair, anchor and invalid UTF-8 event as original bytes (pairs never split across exact shards); manifest enforces disjoint sorted ranges + complete protected-span coverage. OFF = mode C, exact anchors/current transcript only, byte-identical predecessor.",
|
|
109
|
+
true,
|
|
110
|
+
),
|
|
111
|
+
boolDirect(
|
|
112
|
+
"MEGACOMPACT_VC4B",
|
|
113
|
+
"VC4B Residual Basis Parity",
|
|
114
|
+
"Residual codec: orthonormal DCT-II basis + int16 block quantization + block-scoped exact correction stream + (9,6) Reed-Solomon parity shards with SHA-256 corruption detection; admission gates on encodedSize <= 95% of exact-compressed size. OFF = mode C, no residual artifact produced, byte-identical predecessor.",
|
|
115
|
+
true,
|
|
116
|
+
),
|
|
117
|
+
boolDirect(
|
|
118
|
+
"MEGACOMPACT_VC4C",
|
|
119
|
+
"VC4C Reconstruction Fidelity",
|
|
120
|
+
"Conservative closure + source-order assembly + reconstruction validator: recursively closes dependencies and whole tool pairs to a fixed point, resolves contradictions by retaining the later exact source resolution, assembles spans solely by source range, and rejects missing anchors / split pairs / digest mismatch / unresolved contradiction. Mandatory token estimate is content-only and handed unchanged to VC5A. OFF = mode C, no closure/validator, byte-identical predecessor (VC4B).",
|
|
121
|
+
true,
|
|
122
|
+
),
|
|
123
|
+
boolDirect(
|
|
124
|
+
"MEGACOMPACT_VC5A",
|
|
125
|
+
"VC5A PromptDagV1 + Budgeted Planner",
|
|
126
|
+
"Single-session DAG (PromptDagV1) + budgeted 0/1 portfolio planner: builds a stable Kahn-ordered DAG, computes the mandatory dependency/tool/anchor closure before optional selection, returns MANDATORY_CLOSURE_OVER_BUDGET with evidence preserved on overflow, and runs a utility-per-token portfolio that never exceeds the remaining budget. Framing is owned here, not in VC4C. OFF = byte-identical predecessor (VC4C).",
|
|
127
|
+
true,
|
|
128
|
+
),
|
|
129
|
+
boolDirect(
|
|
130
|
+
"MEGACOMPACT_VC5B",
|
|
131
|
+
"VC5B Validated Renderer + Provider Profiles",
|
|
132
|
+
"Validated prompt renderer: replays VC5A's stable Kahn order verbatim, preserves exact tool bytes (PREVENT-PI-002), places compacted context via the host before_agent_start prepend seam — never role:system (PREVENT-PI-003) — and SHA-256 hashes the entire canonical outbound request before provider invocation. Unknown provider/model cleanly bypasses to the predecessor prompt path. OFF = byte-identical predecessor (VC5A).",
|
|
133
|
+
true,
|
|
134
|
+
),
|
|
135
|
+
boolDirect(
|
|
136
|
+
"MEGACOMPACT_VC5C",
|
|
137
|
+
"VC5C Live Graduated Rollout",
|
|
138
|
+
"Live graduated rollout: deterministically hashes each session into a stable 10,000-bucket cohort and advances the exposure gate (1/5/25/50/100%) only after a 72h monotonic residency, a powered sample, >=10,000 events, and >=200 sessions — advancing ONE gate at a time. A hard causal/tool/anchor/exact failure freezes promotion and selects the pre-VC path. OFF = byte-identical predecessor (VC5B).",
|
|
139
|
+
true,
|
|
140
|
+
),
|
|
141
|
+
],
|
|
142
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dashboard-server/routes-vector-cortex-rollout.ts — VC5C live graduated-rollout
|
|
3
|
+
* dashboard route.
|
|
4
|
+
*
|
|
5
|
+
* Reader-only GET /api/vector-cortex/rollout returning the rollout aggregate:
|
|
6
|
+
* current gate, bucket count, sessions/events counts, and promotion-blocked
|
|
7
|
+
* state. NEVER exposes session payloads, prompt text, or bucket→session mappings
|
|
8
|
+
* (reader-only, SECURITY_PRIVACY). Flag-gated on MEGACOMPACT_VC5C: `enabled:false`
|
|
9
|
+
* when off (byte-identical to the pre-VC5C predecessor).
|
|
10
|
+
*
|
|
11
|
+
* Guardrails: PREVENT-PI-004 (local in-process state only), PREVENT-011 (no
|
|
12
|
+
* `any`), reader-only aggregate (counts + gate state only).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
16
|
+
import type { RouteContext } from "./routes-core.js";
|
|
17
|
+
import { VC5C_ENABLED } from "../../src/config.js";
|
|
18
|
+
import { ROLLOUT_GATES, ROLLOUT_BUCKETS } from "../../src/vector-cortex/rollout/types.js";
|
|
19
|
+
import { sendJson } from "./routes-vector-cortex-shared.js";
|
|
20
|
+
import type { VectorCortexRolloutView } from "./api-contracts/vector-cortex.js";
|
|
21
|
+
|
|
22
|
+
/** Reader-only GET /api/vector-cortex/rollout (VC5C). */
|
|
23
|
+
export function handleVectorCortexRollout(
|
|
24
|
+
req: IncomingMessage,
|
|
25
|
+
res: ServerResponse,
|
|
26
|
+
_ctx: RouteContext,
|
|
27
|
+
): boolean {
|
|
28
|
+
const url = req.url ?? "";
|
|
29
|
+
const path = url.split("?")[0] ?? url;
|
|
30
|
+
if (path !== "/api/vector-cortex/rollout") return false;
|
|
31
|
+
if (req.method !== "GET") {
|
|
32
|
+
sendJson(res, 405, { error: "method_not_allowed" });
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const enabled = VC5C_ENABLED();
|
|
37
|
+
const gateIndex = 0; // Ephemeral rollout state: no durable gate in this sprint.
|
|
38
|
+
const gatePct = ROLLOUT_GATES[gateIndex]!;
|
|
39
|
+
const body: VectorCortexRolloutView = {
|
|
40
|
+
enabled,
|
|
41
|
+
gateIndex: enabled ? gateIndex : 0,
|
|
42
|
+
gatePct: enabled ? gatePct : 0,
|
|
43
|
+
buckets: ROLLOUT_BUCKETS,
|
|
44
|
+
bucketCount: enabled ? gatePct * 100 : 0,
|
|
45
|
+
events: 0,
|
|
46
|
+
sessions: 0,
|
|
47
|
+
promotionBlocked: false,
|
|
48
|
+
updatedAt: new Date().toISOString(),
|
|
49
|
+
};
|
|
50
|
+
sendJson(res, 200, body);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
@@ -24,3 +24,4 @@ export { handleVectorCortexResidual } from "./routes-vector-cortex-residual.js";
|
|
|
24
24
|
export { handleVectorCortexReconstruct } from "./routes-vector-cortex-reconstruct.js";
|
|
25
25
|
export { handleVectorCortexPlans } from "./routes-vector-cortex-plans.js";
|
|
26
26
|
export { handleVectorCortexRender } from "./routes-vector-cortex-render.js";
|
|
27
|
+
export { handleVectorCortexRollout } from "./routes-vector-cortex-rollout.js";
|
|
@@ -68,6 +68,7 @@ import {
|
|
|
68
68
|
handleVectorCortexReconstruct,
|
|
69
69
|
handleVectorCortexPlans,
|
|
70
70
|
handleVectorCortexRender,
|
|
71
|
+
handleVectorCortexRollout,
|
|
71
72
|
handleStatic,
|
|
72
73
|
} from "./routes.js";
|
|
73
74
|
|
|
@@ -315,6 +316,7 @@ export async function launchDashboardServer(
|
|
|
315
316
|
if (handleVectorCortexReconstruct(req, res, ctx)) return;
|
|
316
317
|
if (handleVectorCortexPlans(req, res, ctx)) return;
|
|
317
318
|
if (handleVectorCortexRender(req, res, ctx)) return;
|
|
319
|
+
if (handleVectorCortexRollout(req, res, ctx)) return;
|
|
318
320
|
handleStatic(req, res, ctx);
|
|
319
321
|
});
|
|
320
322
|
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-cortex-live.ts — VC5C live graduated-rollout integration seam.
|
|
3
|
+
*
|
|
4
|
+
* This adapter composes the rollout assign + gate + emit seams into the host
|
|
5
|
+
* provider-invocation path. It runs BEFORE provider invocation and decides, for
|
|
6
|
+
* the current session, which live path is active:
|
|
7
|
+
*
|
|
8
|
+
* - on a hard causal/tool/anchor/exact failure → select mode C (pre-VC prompt
|
|
9
|
+
* path) and FREEZE promotion (promotionBlocked=true) for the remainder of the
|
|
10
|
+
* cooldown/spool/restart/clock period satisfying TRIAD_RESILIENCE;
|
|
11
|
+
* - otherwise → the active gate decides whether the VC path is exposed to this
|
|
12
|
+
* session's bucket.
|
|
13
|
+
*
|
|
14
|
+
* PREVENT-PI-003: the rollout NEVER emits a `role:"system"` message. The VC
|
|
15
|
+
* prompt context is composed into the host `before_agent_start` systemPrompt
|
|
16
|
+
* prepend seam only. PREVENT-PI-004: zero network calls (local in-process state
|
|
17
|
+
* + injected clock only). PREVENT-011: no `any`. Non-fatal: any rollout noise
|
|
18
|
+
* degrades to mode C (pre-VC continuity), never breaking the agent loop.
|
|
19
|
+
*
|
|
20
|
+
* LIVENESS HONESTY (mirrors VC0C-Q01/Q06): the rollout decision state here is
|
|
21
|
+
* PER-PROCESS / IN-MEMORY and EPHEMERAL — there is NO persistent rollout runtime
|
|
22
|
+
* and NO live producer wiring. The gate decision is recomputed from injected
|
|
23
|
+
* evidence each epoch. The assigned/blocked events are emitted for observability
|
|
24
|
+
* only.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { assignSession, bucketInGate, gatePctForIndex } from "../../src/vector-cortex/rollout/assign.js";
|
|
28
|
+
import {
|
|
29
|
+
decideGate,
|
|
30
|
+
selectsPreVcPath,
|
|
31
|
+
type RolloutClock,
|
|
32
|
+
type RolloutEvidence,
|
|
33
|
+
} from "../../src/vector-cortex/rollout/gate.js";
|
|
34
|
+
import { createRolloutReporter, type RolloutReporter } from "../../src/vector-cortex/rollout/emit.js";
|
|
35
|
+
import type { GateIndex, RolloutHardFault } from "../../src/vector-cortex/rollout/types.js";
|
|
36
|
+
import { VC5C_ENABLED } from "../../src/config/vector-cortex.js";
|
|
37
|
+
|
|
38
|
+
/** Host context the live seam needs. */
|
|
39
|
+
export interface VectorCortexLiveContext {
|
|
40
|
+
/** Monotonic clock for windows/cooldowns + gate eligibility (fake-clock testable). */
|
|
41
|
+
readonly clock?: RolloutClock;
|
|
42
|
+
/** Current gate index BEFORE this epoch (0..4). */
|
|
43
|
+
readonly currentGate?: GateIndex;
|
|
44
|
+
/** Injected rollout evidence for the current window. */
|
|
45
|
+
readonly evidence?: RolloutEvidence;
|
|
46
|
+
/** Hard faults observed this epoch (any entry forces C + freezes promotion). */
|
|
47
|
+
readonly hardFaults?: readonly RolloutHardFault[];
|
|
48
|
+
/** Optional emit callback for observability events. */
|
|
49
|
+
readonly emit?: (event: string, fields: Record<string, unknown>) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The decision the live seam returns for one session epoch. */
|
|
53
|
+
export interface VectorCortexLiveDecision {
|
|
54
|
+
/** Whether the VC path is exposed to this session (true under current gate). */
|
|
55
|
+
readonly vcActive: boolean;
|
|
56
|
+
/** True when a hard failure forced mode C (pre-VC continuity). */
|
|
57
|
+
readonly forcedPreVc: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The selected triad mode for this epoch. The VC5C rollout seam only ever
|
|
60
|
+
* selects "A" (VC path exposed at the active gate) or "C" (pre-VC fallback:
|
|
61
|
+
* flag off, no evidence/clock, or a hard causal/tool/anchor/exact fault that
|
|
62
|
+
* freezes promotion). The deterministic-greedy triad "B" mode is NOT produced
|
|
63
|
+
* here — this seam is a pure gating/eligibility layer with no live renderer
|
|
64
|
+
* driver; a real mode-B greedy-render fallback belongs to the layer that
|
|
65
|
+
* actually runs renderers (a future sprint), not to this observability seam.
|
|
66
|
+
* Declaring "B" in this union while never producing it would be an overclaim.
|
|
67
|
+
*/
|
|
68
|
+
readonly mode: "A" | "C";
|
|
69
|
+
/** The session's stable bucket (0..9999). */
|
|
70
|
+
readonly bucket: number;
|
|
71
|
+
/** The effective gate index after this epoch. */
|
|
72
|
+
readonly gateIndex: GateIndex;
|
|
73
|
+
/** True when promotion is frozen by a hard fault. */
|
|
74
|
+
readonly promotionBlocked: boolean;
|
|
75
|
+
/** The systemPrompt prepend the host `before_agent_start` seam should use. */
|
|
76
|
+
readonly systemPromptPrepend: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const NO_PREPEND = "";
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Decide the live path for a session epoch. Pure over injected context; no
|
|
83
|
+
* I/O, no network. Flag OFF (or absent evidence/clock) degrades to mode C with
|
|
84
|
+
* the VC path inactive (pre-VC predecessor parity).
|
|
85
|
+
*/
|
|
86
|
+
export function decideLivePath(
|
|
87
|
+
sessionId: string,
|
|
88
|
+
ctx: VectorCortexLiveContext,
|
|
89
|
+
): VectorCortexLiveDecision {
|
|
90
|
+
const reporter: RolloutReporter = createRolloutReporter(ctx.emit);
|
|
91
|
+
const assignment = assignSession(sessionId);
|
|
92
|
+
|
|
93
|
+
if (!VC5C_ENABLED()) {
|
|
94
|
+
// Pre-VC predecessor: no rollout, no VC path. Never emit role:system.
|
|
95
|
+
return {
|
|
96
|
+
vcActive: false,
|
|
97
|
+
forcedPreVc: false,
|
|
98
|
+
mode: "C",
|
|
99
|
+
bucket: assignment.bucket,
|
|
100
|
+
gateIndex: 0,
|
|
101
|
+
promotionBlocked: false,
|
|
102
|
+
systemPromptPrepend: NO_PREPEND,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
reporter.assigned({
|
|
107
|
+
sessionId,
|
|
108
|
+
bucket: assignment.bucket,
|
|
109
|
+
gateIndex: assignment.gateIndex,
|
|
110
|
+
gatePct: gatePctForIndex(assignment.gateIndex),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const hardFaults = ctx.hardFaults ?? [];
|
|
114
|
+
const hardFault = hardFaults.length > 0 ? hardFaults[0]! : undefined;
|
|
115
|
+
const forcedPreVc = selectsPreVcPath(hardFault);
|
|
116
|
+
|
|
117
|
+
if (forcedPreVc && hardFault) {
|
|
118
|
+
reporter.promotionBlocked({
|
|
119
|
+
gateIndex: ctx.currentGate ?? assignment.gateIndex,
|
|
120
|
+
kind: hardFault.kind,
|
|
121
|
+
detail: hardFault.detail,
|
|
122
|
+
});
|
|
123
|
+
// Hard failure → select C (pre-VC path) and freeze promotion.
|
|
124
|
+
return {
|
|
125
|
+
vcActive: false,
|
|
126
|
+
forcedPreVc: true,
|
|
127
|
+
mode: "C",
|
|
128
|
+
bucket: assignment.bucket,
|
|
129
|
+
gateIndex: ctx.currentGate ?? assignment.gateIndex,
|
|
130
|
+
promotionBlocked: true,
|
|
131
|
+
systemPromptPrepend: NO_PREPEND,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const clock = ctx.clock;
|
|
136
|
+
const evidence = ctx.evidence;
|
|
137
|
+
if (clock === undefined || evidence === undefined) {
|
|
138
|
+
// No live evidence/clock → pre-VC parity (no promotion, no VC exposure).
|
|
139
|
+
return {
|
|
140
|
+
vcActive: false,
|
|
141
|
+
forcedPreVc: false,
|
|
142
|
+
mode: "C",
|
|
143
|
+
bucket: assignment.bucket,
|
|
144
|
+
gateIndex: assignment.gateIndex,
|
|
145
|
+
promotionBlocked: false,
|
|
146
|
+
systemPromptPrepend: NO_PREPEND,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const outcome = decideGate(ctx.currentGate ?? assignment.gateIndex, evidence, clock);
|
|
151
|
+
const vcActive = bucketInGate(assignment.bucket, outcome.gatePct);
|
|
152
|
+
|
|
153
|
+
// PREVENT-PI-003: VC prompt context is composed into the host prepend seam,
|
|
154
|
+
// never as a role:system message. Empty prepend here (the actual prompt text
|
|
155
|
+
// is owned by the renderer seam); this seam only signals eligibility.
|
|
156
|
+
return {
|
|
157
|
+
vcActive,
|
|
158
|
+
forcedPreVc: false,
|
|
159
|
+
mode: vcActive ? "A" : "C",
|
|
160
|
+
bucket: assignment.bucket,
|
|
161
|
+
gateIndex: outcome.gateIndex,
|
|
162
|
+
promotionBlocked: outcome.promotionBlocked,
|
|
163
|
+
systemPromptPrepend: NO_PREPEND,
|
|
164
|
+
};
|
|
165
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mega-compact",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.7",
|
|
4
4
|
"description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|
package/src/config/dedup.ts
CHANGED
|
@@ -75,6 +75,14 @@ export interface DedupConfigShape {
|
|
|
75
75
|
* topical structure before detailed checkpoint hits. */
|
|
76
76
|
RAPTOR_INJECT_SUMMARIES: boolean;
|
|
77
77
|
// Monitoring / alerting.
|
|
78
|
+
/**
|
|
79
|
+
* Durable dedup audit trail (external-audit item #2). ON appends one
|
|
80
|
+
* structured JSON line per tier DECISION to events.log so an operator can see
|
|
81
|
+
* which layer collapsed a region, onto what, and at what similarity — the
|
|
82
|
+
* inputs needed to tune the thresholds above. OFF writes nothing at all;
|
|
83
|
+
* dedup behavior is identical either way (pure instrumentation).
|
|
84
|
+
*/
|
|
85
|
+
DEDUP_AUDIT: boolean;
|
|
78
86
|
FP_RATE_L0: number; // FP alert threshold for exact tier
|
|
79
87
|
FP_RATE_L1L2: number; // FP alert threshold for fuzzy tiers
|
|
80
88
|
ALERT_WINDOW_MS: number;
|
|
@@ -115,6 +123,7 @@ export function loadDedupConfig(): DedupConfigShape {
|
|
|
115
123
|
RAPTOR_MAX_LEAF_EXPANSION: envNum("MEGACOMPACT_RAPTOR_MAX_LEAF_EXP", 10),
|
|
116
124
|
RAPTOR_FRESHNESS_HOURS: envNum("MEGACOMPACT_RAPTOR_FRESHNESS_HOURS", 4),
|
|
117
125
|
RAPTOR_INJECT_SUMMARIES: envBool("MEGACOMPACT_RAPTOR_INJECT_SUMMARIES", true),
|
|
126
|
+
DEDUP_AUDIT: envBool("MEGACOMPACT_DEDUP_AUDIT", true),
|
|
118
127
|
FP_RATE_L0: envNum("MEGACOMPACT_FP_RATE_L0", 0.01),
|
|
119
128
|
FP_RATE_L1L2: envNum("MEGACOMPACT_FP_RATE_L1L2", 0.05),
|
|
120
129
|
ALERT_WINDOW_MS: envNum("MEGACOMPACT_ALERT_WINDOW_MS", 600_000),
|
|
@@ -201,6 +201,19 @@ export const VC5A_ENABLED = (): boolean => sprintFlag("MEGACOMPACT_VC5A");
|
|
|
201
201
|
*/
|
|
202
202
|
export const VC5B_ENABLED = (): boolean => sprintFlag("MEGACOMPACT_VC5B");
|
|
203
203
|
|
|
204
|
+
/**
|
|
205
|
+
* VC5C — live graduated rollout. Default ON. `MEGACOMPACT_VC5C=0` disables and
|
|
206
|
+
* is byte-identical to the predecessor (VC5B): no session is assigned a stable
|
|
207
|
+
* 10k bucket, no gate-advance decision runs, the `vector_cortex_rollout_assigned`
|
|
208
|
+
* / `vector_cortex_rollout_promotion_blocked` events are never emitted, and the
|
|
209
|
+
* prompt continues to be built by the predecessor VC5B renderer path (its goldens
|
|
210
|
+
* are unchanged). The assign/gate/emit functions are PURE — flag OFF gates the
|
|
211
|
+
* reporter + dashboard seam, never the arithmetic. This flag MUST also be a
|
|
212
|
+
* dashboard SETTINGS toggle (visible in config UI, never in EXCLUDED_SETTINGS),
|
|
213
|
+
* mirroring VC4A/VC4B/VC4C/VC5A/VC5B.
|
|
214
|
+
*/
|
|
215
|
+
export const VC5C_ENABLED = (): boolean => sprintFlag("MEGACOMPACT_VC5C");
|
|
216
|
+
|
|
204
217
|
// ---------------------------------------------------------------------------
|
|
205
218
|
// Breaker state machine constants (TRIAD_RESILIENCE.md §breaker).
|
|
206
219
|
// Rolled numbers for one 60s window; VC0C consumes these at its breaker seam.
|