@inerrata-corporation/errata 2.0.8-dev.2932 → 2.0.8-dev.2965
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/consolidate-worker.mjs +4 -1
- package/errata.mjs +81 -28
- package/package.json +1 -1
- package/pass-worker.mjs +4 -1
package/consolidate-worker.mjs
CHANGED
|
@@ -15351,7 +15351,7 @@ function anchorLabelAttrs(attrs) {
|
|
|
15351
15351
|
...typeof line === "number" && Number.isInteger(line) && line >= 1 && line <= 1e7 ? { labelLine: line } : {}
|
|
15352
15352
|
};
|
|
15353
15353
|
}
|
|
15354
|
-
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, PROJECT_ONLY_NODE_LABELS, PROJECT_ONLY_NODE_LABEL_SET, PROJECT_ONLY_EDGE_TYPES, PROJECT_ONLY_EDGE_TYPE_SET, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, ANCHOR_COMMIT_SHA_RE, ANCHOR_BODY_HASH_RE, ANCHOR_SYMBOL_KINDS, ANCHOR_LABEL_KINDS, FILE_ANCHOR_QNAME, ANCHOR_LABEL_PATH_RE, ANCHOR_LABEL_QNAME_RE, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15354
|
+
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, PROJECT_ONLY_NODE_LABELS, PROJECT_ONLY_NODE_LABEL_SET, PROJECT_ONLY_EDGE_TYPES, PROJECT_ONLY_EDGE_TYPE_SET, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, ANCHOR_COMMIT_SHA_RE, ANCHOR_BODY_HASH_RE, ANCHOR_SYMBOL_KINDS, ANCHOR_LABEL_KINDS, FILE_ANCHOR_QNAME, ANCHOR_LABEL_PATH_RE, ANCHOR_LABEL_QNAME_RE, TRIAGE_DISCRIMINATOR_MAX_LENGTH, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15355
15355
|
var init_wire = __esm({
|
|
15356
15356
|
"../../packages/shared/src/wire.ts"() {
|
|
15357
15357
|
"use strict";
|
|
@@ -15470,6 +15470,7 @@ var init_wire = __esm({
|
|
|
15470
15470
|
FILE_ANCHOR_QNAME = "";
|
|
15471
15471
|
ANCHOR_LABEL_PATH_RE = /^(?![/])(?![A-Za-z]:)(?!(?:.*\/)?\.\.(?:\/|$))[^\x00-\x1f\x7f\\`]{1,512}$/;
|
|
15472
15472
|
ANCHOR_LABEL_QNAME_RE = /^[^\x00-\x1f\x7f`]{1,256}$/;
|
|
15473
|
+
TRIAGE_DISCRIMINATOR_MAX_LENGTH = 2e3;
|
|
15473
15474
|
CastaliaIngestEdgeSchema = external_exports.object({
|
|
15474
15475
|
fromCanonicalId: external_exports.string().min(6).max(160),
|
|
15475
15476
|
toCanonicalId: external_exports.string().min(6).max(160),
|
|
@@ -15480,6 +15481,8 @@ var init_wire = __esm({
|
|
|
15480
15481
|
/** Triage route per-context counts (T3 induction). Carried as structured data
|
|
15481
15482
|
* here; stored JSON-encoded on the Neo4j rel (`perContextJson`). */
|
|
15482
15483
|
perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional(),
|
|
15484
|
+
/** Scrubbed diagnostic check for a triage route, re-scanned at the cloud door. */
|
|
15485
|
+
discriminator: external_exports.string().trim().min(1).max(TRIAGE_DISCRIMINATOR_MAX_LENGTH).optional(),
|
|
15483
15486
|
/** PJ-anchor-version: WHICH version of a symbol an `ANCHORED_AT` was
|
|
15484
15487
|
* witnessed against. Both opaque — the observing checkout's HEAD sha and
|
|
15485
15488
|
* the indexer's 16-hex sha256 of the symbol body. Neither is reversible
|
package/errata.mjs
CHANGED
|
@@ -15732,6 +15732,13 @@ function isSeedProvenance(source) {
|
|
|
15732
15732
|
function isAnchorLabelKind(kind) {
|
|
15733
15733
|
return typeof kind === "string" && ANCHOR_LABEL_KINDS.includes(kind);
|
|
15734
15734
|
}
|
|
15735
|
+
function triageDiscriminatorAttrs(type, attrs) {
|
|
15736
|
+
if (!["CONFIRMS", "INDICATES", "ROUTES_TO"].includes(type)) return {};
|
|
15737
|
+
const value = attrs?.["discriminator"];
|
|
15738
|
+
if (typeof value !== "string") return {};
|
|
15739
|
+
const test = value.trim();
|
|
15740
|
+
return test && test.length <= TRIAGE_DISCRIMINATOR_MAX_LENGTH && !(test.startsWith("<") && test.endsWith(">")) ? { discriminator: test } : {};
|
|
15741
|
+
}
|
|
15735
15742
|
function anchorVersionAttrs(attrs) {
|
|
15736
15743
|
if (!attrs) return {};
|
|
15737
15744
|
const commit = attrs["observedAtCommit"];
|
|
@@ -15792,7 +15799,7 @@ function summarizeIngestResult(r) {
|
|
|
15792
15799
|
...r.patternReconciliation ? { patternReconciliation: r.patternReconciliation } : {}
|
|
15793
15800
|
};
|
|
15794
15801
|
}
|
|
15795
|
-
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, PROJECT_ONLY_NODE_LABELS, PROJECT_ONLY_NODE_LABEL_SET, PROJECT_ONLY_EDGE_TYPES, PROJECT_ONLY_EDGE_TYPE_SET, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, QUARANTINE_EXTRACTION_SOURCE_PREFIX, MAX_NODES_PER_PAYLOAD, MAX_EDGES_PER_PAYLOAD, CastaliaIngestNodeSchema, RouteContextCountWireSchema, ANCHOR_COMMIT_SHA_RE, ANCHOR_BODY_HASH_RE, ANCHOR_SYMBOL_KINDS, ANCHOR_LABEL_KINDS, FILE_ANCHOR_QNAME, ANCHOR_LABEL_PATH_RE, ANCHOR_LABEL_QNAME_RE, ANCHOR_LABEL_KEYS, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15802
|
+
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, PROJECT_ONLY_NODE_LABELS, PROJECT_ONLY_NODE_LABEL_SET, PROJECT_ONLY_EDGE_TYPES, PROJECT_ONLY_EDGE_TYPE_SET, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, QUARANTINE_EXTRACTION_SOURCE_PREFIX, MAX_NODES_PER_PAYLOAD, MAX_EDGES_PER_PAYLOAD, CastaliaIngestNodeSchema, RouteContextCountWireSchema, ANCHOR_COMMIT_SHA_RE, ANCHOR_BODY_HASH_RE, ANCHOR_SYMBOL_KINDS, ANCHOR_LABEL_KINDS, FILE_ANCHOR_QNAME, ANCHOR_LABEL_PATH_RE, ANCHOR_LABEL_QNAME_RE, ANCHOR_LABEL_KEYS, TRIAGE_DISCRIMINATOR_MAX_LENGTH, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15796
15803
|
var init_wire = __esm({
|
|
15797
15804
|
"../../packages/shared/src/wire.ts"() {
|
|
15798
15805
|
"use strict";
|
|
@@ -15915,6 +15922,7 @@ var init_wire = __esm({
|
|
|
15915
15922
|
ANCHOR_LABEL_PATH_RE = /^(?![/])(?![A-Za-z]:)(?!(?:.*\/)?\.\.(?:\/|$))[^\x00-\x1f\x7f\\`]{1,512}$/;
|
|
15916
15923
|
ANCHOR_LABEL_QNAME_RE = /^[^\x00-\x1f\x7f`]{1,256}$/;
|
|
15917
15924
|
ANCHOR_LABEL_KEYS = ["labelRelPath", "labelQname", "labelKind", "labelLine"];
|
|
15925
|
+
TRIAGE_DISCRIMINATOR_MAX_LENGTH = 2e3;
|
|
15918
15926
|
CastaliaIngestEdgeSchema = external_exports.object({
|
|
15919
15927
|
fromCanonicalId: external_exports.string().min(6).max(160),
|
|
15920
15928
|
toCanonicalId: external_exports.string().min(6).max(160),
|
|
@@ -15925,6 +15933,8 @@ var init_wire = __esm({
|
|
|
15925
15933
|
/** Triage route per-context counts (T3 induction). Carried as structured data
|
|
15926
15934
|
* here; stored JSON-encoded on the Neo4j rel (`perContextJson`). */
|
|
15927
15935
|
perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional(),
|
|
15936
|
+
/** Scrubbed diagnostic check for a triage route, re-scanned at the cloud door. */
|
|
15937
|
+
discriminator: external_exports.string().trim().min(1).max(TRIAGE_DISCRIMINATOR_MAX_LENGTH).optional(),
|
|
15928
15938
|
/** PJ-anchor-version: WHICH version of a symbol an `ANCHORED_AT` was
|
|
15929
15939
|
* witnessed against. Both opaque — the observing checkout's HEAD sha and
|
|
15930
15940
|
* the indexer's 16-hex sha256 of the symbol body. Neither is reversible
|
|
@@ -16827,6 +16837,7 @@ __export(src_exports, {
|
|
|
16827
16837
|
TAXONOMY_EDGES: () => TAXONOMY_EDGES,
|
|
16828
16838
|
TOOL_KINDS: () => TOOL_KINDS,
|
|
16829
16839
|
TRANSFER_EDGES: () => TRANSFER_EDGES,
|
|
16840
|
+
TRIAGE_DISCRIMINATOR_MAX_LENGTH: () => TRIAGE_DISCRIMINATOR_MAX_LENGTH,
|
|
16830
16841
|
TRIAGE_EDGES: () => TRIAGE_EDGES,
|
|
16831
16842
|
TRUTH_KIND: () => TRUTH_KIND,
|
|
16832
16843
|
UnregisteredGraphEventError: () => UnregisteredGraphEventError,
|
|
@@ -16910,6 +16921,7 @@ __export(src_exports, {
|
|
|
16910
16921
|
summaryRejectionReason: () => summaryRejectionReason,
|
|
16911
16922
|
toCloudAttrs: () => toCloudAttrs,
|
|
16912
16923
|
toolCanonicalId: () => toolCanonicalId,
|
|
16924
|
+
triageDiscriminatorAttrs: () => triageDiscriminatorAttrs,
|
|
16913
16925
|
unregisteredGraphEventKeys: () => unregisteredGraphEventKeys,
|
|
16914
16926
|
validateCastaliaPayload: () => validateCastaliaPayload,
|
|
16915
16927
|
versionlessPurl: () => versionlessPurl,
|
|
@@ -22620,7 +22632,8 @@ function pendingDiscriminators(l2, opts = {}) {
|
|
|
22620
22632
|
const perContext = e.attrs["perContext"] ?? {};
|
|
22621
22633
|
const global2 = perContext[TRIAGE_GLOBAL_BUCKET] ?? {};
|
|
22622
22634
|
const observations = Number(global2.confirmed ?? 0);
|
|
22623
|
-
const
|
|
22635
|
+
const inferred = new Set(global2.inferredContributors ?? []);
|
|
22636
|
+
const sources = new Set((global2.contributors ?? []).filter((id) => !inferred.has(id))).size;
|
|
22624
22637
|
if (sources < minSources || observations < minObservations) continue;
|
|
22625
22638
|
out2.push({ route: e.id, presenting: triage.description, cause: "", sources, observations, causeId: e.to });
|
|
22626
22639
|
}
|
|
@@ -22638,7 +22651,7 @@ function markDiscriminatorAsked(l2, routeIds, ts) {
|
|
|
22638
22651
|
}
|
|
22639
22652
|
}
|
|
22640
22653
|
function promoteRouteWithDiscriminator(l2, routeId, discriminator, ts, source) {
|
|
22641
|
-
const test = discriminator.
|
|
22654
|
+
const test = triageDiscriminatorAttrs("CONFIRMS", { discriminator }).discriminator;
|
|
22642
22655
|
if (!test) return false;
|
|
22643
22656
|
if (isUnfilledPlaceholder(test)) return false;
|
|
22644
22657
|
const existing = l2.getEdge(routeId);
|
|
@@ -22740,9 +22753,12 @@ function parseTriageFences(text) {
|
|
|
22740
22753
|
return out2;
|
|
22741
22754
|
}
|
|
22742
22755
|
function harvestTriageFences(l2, text, opts) {
|
|
22756
|
+
const seen = [...text.matchAll(/```errata-triage[^\n]*\n([\s\S]*?)```/g)].length;
|
|
22743
22757
|
let recorded = 0;
|
|
22744
22758
|
let promoted = 0;
|
|
22745
22759
|
for (const f of parseTriageFences(text)) {
|
|
22760
|
+
if ([f.presenting, f.cause, f.test, f.fix, f.route].some((value) => value && isUnfilledPlaceholder(value))) continue;
|
|
22761
|
+
if (f.test && !triageDiscriminatorAttrs("CONFIRMS", { discriminator: f.test }).discriminator) continue;
|
|
22746
22762
|
if (f.route && f.test) {
|
|
22747
22763
|
if (promoteRouteWithDiscriminator(l2, f.route.trim(), f.test, opts.ts, opts.contributor)) promoted++;
|
|
22748
22764
|
continue;
|
|
@@ -22778,7 +22794,7 @@ function harvestTriageFences(l2, text, opts) {
|
|
|
22778
22794
|
}
|
|
22779
22795
|
recorded++;
|
|
22780
22796
|
}
|
|
22781
|
-
return { recorded, promoted };
|
|
22797
|
+
return { seen, recorded, promoted, rejected: seen - recorded - promoted };
|
|
22782
22798
|
}
|
|
22783
22799
|
var COOCCUR_BONUS, routeEdgeId, ROUTE_EDGE_TYPES, routeTypeFor, isRouterRoute, INDUCTED_MARK, DRIFT_VALUES;
|
|
22784
22800
|
var init_triage2 = __esm({
|
|
@@ -24396,7 +24412,7 @@ function renderSnapshot(s) {
|
|
|
24396
24412
|
lines.push("");
|
|
24397
24413
|
lines.push("### \u270D\uFE0F CAPTURE PROTOCOL \u2014 tags are the record");
|
|
24398
24414
|
lines.push(
|
|
24399
|
-
"errata records
|
|
24415
|
+
"For problems and fixes, errata records inline tags: `[!one line]` for every problem you state, `(fix:[id])` when your edit fixed a shown problem, and to JUDGE a prior shown below \u2014 `(confirm:[id])` if it held, `(refute:[id] why)` if it's wrong or didn't hold. Untagged prose is silently lost \u2014 tag as you write. Requested errata-* answer blocks keep their fences; put them in your turn-final reply."
|
|
24400
24416
|
);
|
|
24401
24417
|
lines.push("");
|
|
24402
24418
|
lines.push(SEARCH_IMPERATIVE_HEADER);
|
|
@@ -24682,7 +24698,7 @@ function renderSnapshot(s) {
|
|
|
24682
24698
|
for (const item of reviewItems) {
|
|
24683
24699
|
if (item.kind === "discriminator") {
|
|
24684
24700
|
lines.push(
|
|
24685
|
-
`- **A recurring diagnosis is one cheap check from promoting** \u2014 "${item.presenting}" usually turns out to be: ${item.cause}. If (and only if) you KNOW a cheap ante-hoc check that confirms it,
|
|
24701
|
+
`- **A recurring diagnosis is one cheap check from promoting** \u2014 "${item.presenting}" usually turns out to be: ${item.cause}. If (and only if) you KNOW a cheap ante-hoc check that confirms it, fill this fenced block in your turn-final reply:`
|
|
24686
24702
|
);
|
|
24687
24703
|
lines.push(" ```errata-triage");
|
|
24688
24704
|
lines.push(` route: ${item.route}`);
|
|
@@ -24690,7 +24706,7 @@ function renderSnapshot(s) {
|
|
|
24690
24706
|
lines.push(" ```");
|
|
24691
24707
|
} else {
|
|
24692
24708
|
lines.push(
|
|
24693
|
-
`- **Name the principle this cluster of your beliefs generalizes** \u2014 it ships to the collective only once named
|
|
24709
|
+
`- **Name the principle this cluster of your beliefs generalizes** \u2014 it ships to the collective only once named. Cover ALL members in one sentence; fill this fenced block in your turn-final reply:`
|
|
24694
24710
|
);
|
|
24695
24711
|
for (const m of item.members) lines.push(` - ${m.description}`);
|
|
24696
24712
|
lines.push(" ```errata-abstraction");
|
|
@@ -25196,6 +25212,7 @@ function toWirePayload(batch, runId) {
|
|
|
25196
25212
|
attrs: {
|
|
25197
25213
|
...typeof e.confidence === "number" ? { confidence: clamp012(e.confidence) } : {},
|
|
25198
25214
|
...perContext ? { perContext } : {},
|
|
25215
|
+
...triageDiscriminatorAttrs(e.type, e.attrs),
|
|
25199
25216
|
// PJ-anchor-version: the two opaque version stamps ride on anchors only.
|
|
25200
25217
|
...e.type === "ANCHORED_AT" ? anchorVersionAttrs(e.attrs) : {},
|
|
25201
25218
|
// PJ-anchor-labels: readable labels ride only when the producer set the
|
|
@@ -25802,6 +25819,7 @@ var init_client = __esm({
|
|
|
25802
25819
|
if (q.seed?.length) qs.set("seed", q.seed.join(","));
|
|
25803
25820
|
if (q.q) qs.set("q", q.q);
|
|
25804
25821
|
if (q.channel) qs.set("channel", q.channel);
|
|
25822
|
+
if (q.includeTriage) qs.set("includeTriage", "true");
|
|
25805
25823
|
const publicCtx = process.env["ERRATA_PRIMING_PUBLIC_CONTEXT"];
|
|
25806
25824
|
const usePublicCtx = Boolean(publicCtx && publicCtx !== "0" && q.channel === "priming");
|
|
25807
25825
|
const UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -29016,7 +29034,7 @@ function buildAgentInstruction(opts = {}) {
|
|
|
29016
29034
|
const signals = opts.signals ?? ["prior", "problem", "domain", "fix", "constraint", "triage", "attempt", "link"];
|
|
29017
29035
|
const ref = opts.referent ?? "its-handle";
|
|
29018
29036
|
const token = (s) => s === "problem" ? TAG_EXAMPLE.problem() : s === "constraint" ? TAG_EXAMPLE.constraint() : s === "attempt" ? TAG_EXAMPLE.tried() : s === "domain" ? TAG_EXAMPLE.domain() : s === "link" ? TAG_EXAMPLE.pattern() : s === "verdict" ? TAG_EXAMPLE.confirm(ref) : TAG_EXAMPLE[s](ref);
|
|
29019
|
-
const head2 = `We tag the priors we show you with a short handle like [${opts.handleExample ?? "chokidar-glob"}].
|
|
29037
|
+
const head2 = `We tag the priors we show you with a short handle like [${opts.handleExample ?? "chokidar-glob"}]. Untagged prose is silently lost. Put each tag inline in prose (no fences or backticks). Requested errata-* answer blocks are the exception: keep their fences in your turn-final reply. Tag everything, we filter downstream:`;
|
|
29020
29038
|
const tail = "Mid-turn text (between tool calls) can be dropped by the harness \u2014 RESTATE every tag in your turn-final message; the final message is what reliably survives \u2014 EXCEPT one already shown above with an id: that is captured, so cite `[its-handle]` rather than retyping it (drift mints a duplicate).";
|
|
29021
29039
|
return [
|
|
29022
29040
|
head2,
|
|
@@ -41900,7 +41918,7 @@ function takeDiscriminatorNudge(path2) {
|
|
|
41900
41918
|
return [
|
|
41901
41919
|
`\u26A1 errata \u2014 a known wrong-door is one field from ranking: "${top.presenting.slice(0, 90)}"`,
|
|
41902
41920
|
` usually turns out to be: ${top.cause.slice(0, 90)} (seen ${top.observations}x)`,
|
|
41903
|
-
" Know a CHEAP check that confirms it?
|
|
41921
|
+
" Know a CHEAP check that confirms it? Fill this fenced block in your turn-final reply so the",
|
|
41904
41922
|
" next agent gets it first. Only if you actually know one: a guessed test ranks first",
|
|
41905
41923
|
" and misroutes everyone after you.",
|
|
41906
41924
|
" ```errata-triage",
|
|
@@ -43417,7 +43435,7 @@ var init_mcp = __esm({
|
|
|
43417
43435
|
pending,
|
|
43418
43436
|
...pending.length > 0 ? {
|
|
43419
43437
|
howToAnswer: [
|
|
43420
|
-
"For each route you know a cheap test for, emit an errata-triage fence",
|
|
43438
|
+
"For each route you know a cheap test for, emit an errata-triage fence in your turn-final reply",
|
|
43421
43439
|
"carrying its `route` id and the `test` \u2014 no presenting/cause needed, the",
|
|
43422
43440
|
"route id identifies both endpoints. Attaching a test does NOT count as",
|
|
43423
43441
|
"another sighting, so it cannot inflate the route's evidence.",
|
|
@@ -74144,18 +74162,21 @@ function readTailWithLosses(path2, maxBytes) {
|
|
|
74144
74162
|
try {
|
|
74145
74163
|
fd = openSync(path2, "r");
|
|
74146
74164
|
} catch {
|
|
74147
|
-
return { text: "", bytesUnreachable: 0, ioFailed: true };
|
|
74165
|
+
return { text: "", bytesUnreachable: 0, parseStartByte: 0, ioFailed: true };
|
|
74148
74166
|
}
|
|
74149
74167
|
try {
|
|
74150
74168
|
const size = fstatSync(fd).size;
|
|
74151
74169
|
const start2 = Math.max(0, size - maxBytes);
|
|
74152
74170
|
const len = size - start2;
|
|
74153
|
-
if (len <= 0) return { text: "", bytesUnreachable: 0, ioFailed: false };
|
|
74171
|
+
if (len <= 0) return { text: "", bytesUnreachable: 0, parseStartByte: 0, ioFailed: false };
|
|
74154
74172
|
const buf = Buffer.allocUnsafe(len);
|
|
74155
74173
|
readSync(fd, buf, 0, len, start2);
|
|
74156
|
-
|
|
74174
|
+
const text = buf.toString("utf8");
|
|
74175
|
+
const firstNewline = buf.indexOf(10);
|
|
74176
|
+
const parseStartByte = firstNewline < 0 ? start2 : start2 + firstNewline + 1 - Buffer.byteLength(buf.subarray(0, firstNewline + 1).toString("utf8"));
|
|
74177
|
+
return { text, bytesUnreachable: start2, parseStartByte, ioFailed: false };
|
|
74157
74178
|
} catch {
|
|
74158
|
-
return { text: "", bytesUnreachable: 0, ioFailed: true };
|
|
74179
|
+
return { text: "", bytesUnreachable: 0, parseStartByte: 0, ioFailed: true };
|
|
74159
74180
|
} finally {
|
|
74160
74181
|
closeSync(fd);
|
|
74161
74182
|
}
|
|
@@ -74219,7 +74240,7 @@ function isUserTurnBoundary(obj) {
|
|
|
74219
74240
|
}
|
|
74220
74241
|
function readAssistantTurnsWithLosses(transcriptPath, includeThinking = true, maxBytes = 2e6) {
|
|
74221
74242
|
const tail = readTailWithLosses(transcriptPath, maxBytes);
|
|
74222
|
-
const parsed = parseAssistantTurns(tail.text, includeThinking, false);
|
|
74243
|
+
const parsed = parseAssistantTurns(tail.text, includeThinking, false, tail.parseStartByte);
|
|
74223
74244
|
return {
|
|
74224
74245
|
turns: parsed.turns,
|
|
74225
74246
|
losses: {
|
|
@@ -74231,7 +74252,8 @@ function readAssistantTurnsWithLosses(transcriptPath, includeThinking = true, ma
|
|
|
74231
74252
|
}
|
|
74232
74253
|
function readAssistantTurnsFrom(transcriptPath, fromByte, includeThinking = true, maxBytes) {
|
|
74233
74254
|
const { text, nextOffset, more, ioFailed } = readFrom(transcriptPath, fromByte, maxBytes);
|
|
74234
|
-
const
|
|
74255
|
+
const startByte = fromByte > 0 && fromByte <= nextOffset ? fromByte : 0;
|
|
74256
|
+
const parsed = parseAssistantTurns(text, includeThinking, fromByte > 0, startByte);
|
|
74235
74257
|
return {
|
|
74236
74258
|
turns: parsed.turns,
|
|
74237
74259
|
nextOffset,
|
|
@@ -74267,10 +74289,10 @@ function detectHostHarness(raw2) {
|
|
|
74267
74289
|
}
|
|
74268
74290
|
return "claude_code";
|
|
74269
74291
|
}
|
|
74270
|
-
function parseAssistantTurns(raw2, includeThinking, skipFirstLineParseFailure = false) {
|
|
74292
|
+
function parseAssistantTurns(raw2, includeThinking, skipFirstLineParseFailure = false, startByte = 0) {
|
|
74271
74293
|
if (!raw2) return { turns: [], parseFailures: 0 };
|
|
74272
74294
|
const harness = detectHostHarness(raw2);
|
|
74273
|
-
if (harness === "codex") return parseCodexAssistantTurns(raw2, skipFirstLineParseFailure);
|
|
74295
|
+
if (harness === "codex") return parseCodexAssistantTurns(raw2, skipFirstLineParseFailure, startByte);
|
|
74274
74296
|
if (harness === "gemini") return parseGeminiAssistantTurns(raw2, skipFirstLineParseFailure);
|
|
74275
74297
|
if (harness === "opencode") return parseOpencodeAssistantTurns(raw2, skipFirstLineParseFailure);
|
|
74276
74298
|
return parseClaudeAssistantTurns(raw2, includeThinking, skipFirstLineParseFailure);
|
|
@@ -74361,13 +74383,16 @@ function parseGeminiAssistantTurns(raw2, skipFirstLineParseFailure = false) {
|
|
|
74361
74383
|
const turns = [...byId.entries()].sort((a, b) => a[1].order - b[1].order).map(([uuid3, v]) => ({ uuid: uuid3, text: v.text, hostHarness: "gemini" }));
|
|
74362
74384
|
return { turns, parseFailures };
|
|
74363
74385
|
}
|
|
74364
|
-
function parseCodexAssistantTurns(raw2, skipFirstLineParseFailure = false) {
|
|
74386
|
+
function parseCodexAssistantTurns(raw2, skipFirstLineParseFailure = false, startByte = 0) {
|
|
74365
74387
|
const turns = [];
|
|
74366
|
-
const lines = raw2.split(
|
|
74388
|
+
const lines = raw2.split("\n");
|
|
74367
74389
|
let parseFailures = 0;
|
|
74390
|
+
let nextByte = startByte;
|
|
74368
74391
|
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
74369
74392
|
const line = lines[i2];
|
|
74370
|
-
|
|
74393
|
+
const lineByte = nextByte;
|
|
74394
|
+
nextByte += Buffer.byteLength(line ?? "", "utf8") + 1;
|
|
74395
|
+
if (!line?.trim()) continue;
|
|
74371
74396
|
let obj;
|
|
74372
74397
|
try {
|
|
74373
74398
|
obj = JSON.parse(line);
|
|
@@ -74386,7 +74411,9 @@ function parseCodexAssistantTurns(raw2, skipFirstLineParseFailure = false) {
|
|
|
74386
74411
|
}
|
|
74387
74412
|
if (parts2.length === 0) continue;
|
|
74388
74413
|
turns.push({
|
|
74389
|
-
|
|
74414
|
+
// Slice-local line numbers repeat on every Stop. Position distinguishes
|
|
74415
|
+
// identical messages; the digest distinguishes a replaced row at that position.
|
|
74416
|
+
uuid: typeof payload["id"] === "string" && payload["id"].length > 0 ? payload["id"] : `codex-${lineByte}-${createHash14("sha256").update(line.trimEnd()).digest("hex")}`,
|
|
74390
74417
|
text: parts2.join("\n\n"),
|
|
74391
74418
|
hostHarness: "codex"
|
|
74392
74419
|
});
|
|
@@ -76958,21 +76985,31 @@ async function pullCloudTriage(shared, cloud, profile, limit = 50) {
|
|
|
76958
76985
|
stack: profile.stack,
|
|
76959
76986
|
domains: profile.domains,
|
|
76960
76987
|
kinds: ["Problem"],
|
|
76988
|
+
includeTriage: true,
|
|
76961
76989
|
limit
|
|
76962
76990
|
});
|
|
76963
76991
|
const byId = new Map(res.nodes.map((n) => [n.id, n]));
|
|
76964
76992
|
const now = Date.now();
|
|
76965
76993
|
let merged = 0;
|
|
76994
|
+
const landedTriages = /* @__PURE__ */ new Set();
|
|
76966
76995
|
const landNode = (id) => {
|
|
76967
|
-
|
|
76996
|
+
const existing = shared.getNode(id);
|
|
76968
76997
|
const n = byId.get(id);
|
|
76998
|
+
if (existing) {
|
|
76999
|
+
if (n && existing.attrs["source"] === "cloud") {
|
|
77000
|
+
shared.updateNode(id, { attrs: { ...existing.attrs, ...n.attrs, source: "cloud" }, lastUpdatedAt: now });
|
|
77001
|
+
}
|
|
77002
|
+
return true;
|
|
77003
|
+
}
|
|
76969
77004
|
if (!n) return false;
|
|
76970
77005
|
shared.mergeNode({ ...n, extractionSource: "bko-inferred", embedding: [], attrs: { ...n.attrs, source: "cloud" } });
|
|
76971
77006
|
return true;
|
|
76972
77007
|
};
|
|
76973
77008
|
for (const edge2 of res.edges) {
|
|
76974
77009
|
if (edge2.type !== "CONFIRMS" && edge2.type !== "ROUTES_TO") continue;
|
|
77010
|
+
if (!triageDiscriminatorAttrs(edge2.type, edge2.attrs).discriminator) continue;
|
|
76975
77011
|
if (!landNode(edge2.from) || !landNode(edge2.to)) continue;
|
|
77012
|
+
landedTriages.add(edge2.from);
|
|
76976
77013
|
const cloudAttrs = { ...edge2.attrs, source: "cloud", provisional: false };
|
|
76977
77014
|
const existing = shared.getEdge(edge2.id);
|
|
76978
77015
|
if (existing && existing.type === "CONFIRMS") {
|
|
@@ -76983,6 +77020,11 @@ async function pullCloudTriage(shared, cloud, profile, limit = 50) {
|
|
|
76983
77020
|
}
|
|
76984
77021
|
merged++;
|
|
76985
77022
|
}
|
|
77023
|
+
for (const edge2 of res.edges) {
|
|
77024
|
+
if (edge2.type !== "TRIAGED_BY" || !landedTriages.has(edge2.to)) continue;
|
|
77025
|
+
if (!landNode(edge2.from)) continue;
|
|
77026
|
+
shared.mergeEdge({ ...edge2, attrs: { ...edge2.attrs, source: "cloud" } });
|
|
77027
|
+
}
|
|
76986
77028
|
return merged;
|
|
76987
77029
|
}
|
|
76988
77030
|
|
|
@@ -80279,7 +80321,7 @@ function createWatchBreaker(deps) {
|
|
|
80279
80321
|
}
|
|
80280
80322
|
|
|
80281
80323
|
// src/engine.ts
|
|
80282
|
-
var DAEMON_VERSION = true ? "2.0.8-dev.
|
|
80324
|
+
var DAEMON_VERSION = true ? "2.0.8-dev.2965" : "2.0.0-alpha.0";
|
|
80283
80325
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
80284
80326
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
80285
80327
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -81165,6 +81207,9 @@ function createWorkspaceEngine(opts) {
|
|
|
81165
81207
|
let resolved = 0;
|
|
81166
81208
|
let abstracted = 0;
|
|
81167
81209
|
let triaged = 0;
|
|
81210
|
+
let triageFencesSeen = 0;
|
|
81211
|
+
let triagePromoted = 0;
|
|
81212
|
+
let triageFencesRejected = 0;
|
|
81168
81213
|
let priorEdges = 0;
|
|
81169
81214
|
let exposureShown = 0;
|
|
81170
81215
|
let exposureEvicted = 0;
|
|
@@ -81228,11 +81273,16 @@ function createWorkspaceEngine(opts) {
|
|
|
81228
81273
|
console.warn("[errata] abstraction harvest failed:", err2);
|
|
81229
81274
|
}
|
|
81230
81275
|
try {
|
|
81231
|
-
|
|
81276
|
+
const triage = harvestTriageFences(opts.sharedStore, turn.text, {
|
|
81232
81277
|
context: { stack: profile.stack, domain: profile.domains[0] },
|
|
81233
81278
|
contributor: sessionId,
|
|
81234
81279
|
ts: t
|
|
81235
|
-
})
|
|
81280
|
+
});
|
|
81281
|
+
triaged += triage.recorded;
|
|
81282
|
+
triageFencesSeen += triage.seen;
|
|
81283
|
+
triagePromoted += triage.promoted;
|
|
81284
|
+
triageFencesRejected += triage.rejected;
|
|
81285
|
+
if (triage.recorded > 0 || triage.promoted > 0) contextDirty = true;
|
|
81236
81286
|
} catch (err2) {
|
|
81237
81287
|
console.warn("[errata] triage harvest failed:", err2);
|
|
81238
81288
|
}
|
|
@@ -81908,8 +81958,8 @@ function createWorkspaceEngine(opts) {
|
|
|
81908
81958
|
if (abstracted > 0) {
|
|
81909
81959
|
console.log(`[errata] abstraction: ${abstracted} principle(s) distilled from the conversation`);
|
|
81910
81960
|
}
|
|
81911
|
-
if (triaged > 0) {
|
|
81912
|
-
console.log(`[errata] triage: ${triaged}
|
|
81961
|
+
if (triaged > 0 || triagePromoted > 0 || triageFencesRejected > 0) {
|
|
81962
|
+
console.log(`[errata] triage: ${triaged} diagnosis(es), ${triagePromoted} route promotion(s), ${triageFencesRejected} rejected fence(s)`);
|
|
81913
81963
|
}
|
|
81914
81964
|
if (processedTurns > 0) {
|
|
81915
81965
|
appendPassLedger(paths.configDir, "capture", Date.now() - t, {
|
|
@@ -81924,6 +81974,9 @@ function createWorkspaceEngine(opts) {
|
|
|
81924
81974
|
tagsRestated,
|
|
81925
81975
|
resolved,
|
|
81926
81976
|
triaged,
|
|
81977
|
+
triageFencesSeen,
|
|
81978
|
+
triagePromoted,
|
|
81979
|
+
triageFencesRejected,
|
|
81927
81980
|
priorEdges,
|
|
81928
81981
|
corroboratedEdges,
|
|
81929
81982
|
// RG-mark: refute witnesses stamped onto local nodes (the local half of
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -15140,7 +15140,7 @@ var init_symbol_intent = __esm({
|
|
|
15140
15140
|
});
|
|
15141
15141
|
|
|
15142
15142
|
// ../../packages/shared/src/wire.ts
|
|
15143
|
-
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, PROJECT_ONLY_NODE_LABELS, PROJECT_ONLY_NODE_LABEL_SET, PROJECT_ONLY_EDGE_TYPES, PROJECT_ONLY_EDGE_TYPE_SET, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, ANCHOR_COMMIT_SHA_RE, ANCHOR_BODY_HASH_RE, ANCHOR_SYMBOL_KINDS, ANCHOR_LABEL_KINDS, ANCHOR_LABEL_PATH_RE, ANCHOR_LABEL_QNAME_RE, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15143
|
+
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, PROJECT_ONLY_NODE_LABELS, PROJECT_ONLY_NODE_LABEL_SET, PROJECT_ONLY_EDGE_TYPES, PROJECT_ONLY_EDGE_TYPE_SET, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, ANCHOR_COMMIT_SHA_RE, ANCHOR_BODY_HASH_RE, ANCHOR_SYMBOL_KINDS, ANCHOR_LABEL_KINDS, ANCHOR_LABEL_PATH_RE, ANCHOR_LABEL_QNAME_RE, TRIAGE_DISCRIMINATOR_MAX_LENGTH, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15144
15144
|
var init_wire = __esm({
|
|
15145
15145
|
"../../packages/shared/src/wire.ts"() {
|
|
15146
15146
|
"use strict";
|
|
@@ -15258,6 +15258,7 @@ var init_wire = __esm({
|
|
|
15258
15258
|
ANCHOR_LABEL_KINDS = [...ANCHOR_SYMBOL_KINDS, "File"];
|
|
15259
15259
|
ANCHOR_LABEL_PATH_RE = /^(?![/])(?![A-Za-z]:)(?!(?:.*\/)?\.\.(?:\/|$))[^\x00-\x1f\x7f\\`]{1,512}$/;
|
|
15260
15260
|
ANCHOR_LABEL_QNAME_RE = /^[^\x00-\x1f\x7f`]{1,256}$/;
|
|
15261
|
+
TRIAGE_DISCRIMINATOR_MAX_LENGTH = 2e3;
|
|
15261
15262
|
CastaliaIngestEdgeSchema = external_exports.object({
|
|
15262
15263
|
fromCanonicalId: external_exports.string().min(6).max(160),
|
|
15263
15264
|
toCanonicalId: external_exports.string().min(6).max(160),
|
|
@@ -15268,6 +15269,8 @@ var init_wire = __esm({
|
|
|
15268
15269
|
/** Triage route per-context counts (T3 induction). Carried as structured data
|
|
15269
15270
|
* here; stored JSON-encoded on the Neo4j rel (`perContextJson`). */
|
|
15270
15271
|
perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional(),
|
|
15272
|
+
/** Scrubbed diagnostic check for a triage route, re-scanned at the cloud door. */
|
|
15273
|
+
discriminator: external_exports.string().trim().min(1).max(TRIAGE_DISCRIMINATOR_MAX_LENGTH).optional(),
|
|
15271
15274
|
/** PJ-anchor-version: WHICH version of a symbol an `ANCHORED_AT` was
|
|
15272
15275
|
* witnessed against. Both opaque — the observing checkout's HEAD sha and
|
|
15273
15276
|
* the indexer's 16-hex sha256 of the symbol body. Neither is reversible
|