@inerrata-corporation/errata 2.0.2-dev.455 → 2.0.2-dev.476
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 +3 -0
- package/errata.mjs +123 -4
- package/package.json +1 -1
- package/pass-worker.mjs +3 -0
package/consolidate-worker.mjs
CHANGED
|
@@ -16688,6 +16688,9 @@ init_src();
|
|
|
16688
16688
|
init_src();
|
|
16689
16689
|
init_src();
|
|
16690
16690
|
|
|
16691
|
+
// ../../packages/local-graph/src/intent.ts
|
|
16692
|
+
init_src();
|
|
16693
|
+
|
|
16691
16694
|
// ../../packages/local-graph/src/anchor-backfill.ts
|
|
16692
16695
|
init_src();
|
|
16693
16696
|
init_src2();
|
package/errata.mjs
CHANGED
|
@@ -19272,6 +19272,31 @@ function markFixCandidates(store, t) {
|
|
|
19272
19272
|
}
|
|
19273
19273
|
return resolved;
|
|
19274
19274
|
}
|
|
19275
|
+
function recordRenderLedger(store, ledger, seq, ts) {
|
|
19276
|
+
const bump = (ids, field) => {
|
|
19277
|
+
let n = 0;
|
|
19278
|
+
for (const id of new Set(ids.map((i2) => i2.id))) {
|
|
19279
|
+
const node2 = store.getNode(id);
|
|
19280
|
+
if (!node2) continue;
|
|
19281
|
+
const attrs = { ...node2.attrs };
|
|
19282
|
+
attrs[field] = (attrs[field] ?? 0) + 1;
|
|
19283
|
+
if (field === "shownCount") {
|
|
19284
|
+
attrs["lastShownAtSeq"] = seq;
|
|
19285
|
+
if (attrs["firstShownAtSeq"] === void 0) attrs["firstShownAtSeq"] = seq;
|
|
19286
|
+
}
|
|
19287
|
+
store.updateNode(id, { attrs, lastUpdatedAt: node2.lastUpdatedAt });
|
|
19288
|
+
n++;
|
|
19289
|
+
}
|
|
19290
|
+
return n;
|
|
19291
|
+
};
|
|
19292
|
+
let shown = 0;
|
|
19293
|
+
let evicted = 0;
|
|
19294
|
+
store.transaction(() => {
|
|
19295
|
+
shown = bump(ledger.shown, "shownCount");
|
|
19296
|
+
evicted = bump(ledger.evicted, "evictedCount");
|
|
19297
|
+
});
|
|
19298
|
+
return { shown, evicted };
|
|
19299
|
+
}
|
|
19275
19300
|
var DESIGN_PROMOTE_AT, STATEMENT_ALIAS_CAP, PATTERN_DEDUP_COSINE, PATTERN_ALIAS_CAP, DEDUP_STOPWORDS, SAME_ANCHOR_DEDUP_JACCARD, CITABLE_PRIOR_LABELS, MAX_ANCHOR_FILES, AUTO_MINT_PREFIX;
|
|
19276
19301
|
var init_design_problem = __esm({
|
|
19277
19302
|
"../../packages/local-graph/src/design-problem.ts"() {
|
|
@@ -19322,6 +19347,61 @@ var init_design_problem = __esm({
|
|
|
19322
19347
|
}
|
|
19323
19348
|
});
|
|
19324
19349
|
|
|
19350
|
+
// ../../packages/local-graph/src/intent.ts
|
|
19351
|
+
function parseIntentFences(text) {
|
|
19352
|
+
const out2 = [];
|
|
19353
|
+
const block = /```errata-intent[^\n]*\n([\s\S]*?)```/g;
|
|
19354
|
+
let m;
|
|
19355
|
+
while ((m = block.exec(text)) !== null) {
|
|
19356
|
+
const lines = m[1].split(/\r?\n/);
|
|
19357
|
+
const parts2 = [];
|
|
19358
|
+
for (const line of lines) {
|
|
19359
|
+
const kv = /^\s*intent\s*:\s*(.+?)\s*$/i.exec(line);
|
|
19360
|
+
if (kv) parts2.push(kv[1].trim());
|
|
19361
|
+
else if (parts2.length > 0 && line.trim()) parts2.push(line.trim());
|
|
19362
|
+
}
|
|
19363
|
+
const intent = parts2.join(" ").trim();
|
|
19364
|
+
if (intent) out2.push({ intent });
|
|
19365
|
+
}
|
|
19366
|
+
return out2;
|
|
19367
|
+
}
|
|
19368
|
+
function searchByIntent(store, intent, opts) {
|
|
19369
|
+
const limit = opts?.limit ?? 5;
|
|
19370
|
+
const minCoverage = opts?.minCoverage ?? 0.25;
|
|
19371
|
+
const want = new Set(conceptTokens(intent));
|
|
19372
|
+
if (want.size < MIN_INTENT_TOKENS) return [];
|
|
19373
|
+
const hits = [];
|
|
19374
|
+
for (const label of RECALLABLE) {
|
|
19375
|
+
for (const node2 of store.findNodesByLabel(label)) {
|
|
19376
|
+
if (node2.attrs["mergedInto"] !== void 0) continue;
|
|
19377
|
+
if (label === "Problem" && node2.attrs["resolvedAt"] != null && !isConstraintProblem(node2)) {
|
|
19378
|
+
continue;
|
|
19379
|
+
}
|
|
19380
|
+
const bag = conceptTokens(node2.description ?? "");
|
|
19381
|
+
if (bag.length === 0) continue;
|
|
19382
|
+
const matched = bag.filter((t) => want.has(t));
|
|
19383
|
+
if (matched.length === 0) continue;
|
|
19384
|
+
const coverage = matched.length / want.size;
|
|
19385
|
+
if (coverage < minCoverage) continue;
|
|
19386
|
+
hits.push({ node: node2, coverage, matched });
|
|
19387
|
+
}
|
|
19388
|
+
}
|
|
19389
|
+
hits.sort(
|
|
19390
|
+
(a, b) => b.coverage - a.coverage || (a.node.description?.length ?? 0) - (b.node.description?.length ?? 0)
|
|
19391
|
+
);
|
|
19392
|
+
return hits.slice(0, limit);
|
|
19393
|
+
}
|
|
19394
|
+
var RECALLABLE, MIN_INTENT_TOKENS;
|
|
19395
|
+
var init_intent = __esm({
|
|
19396
|
+
"../../packages/local-graph/src/intent.ts"() {
|
|
19397
|
+
"use strict";
|
|
19398
|
+
init_src();
|
|
19399
|
+
init_design_problem();
|
|
19400
|
+
RECALLABLE = ["Problem", "Solution", "RootCause", "Pattern"];
|
|
19401
|
+
MIN_INTENT_TOKENS = 2;
|
|
19402
|
+
}
|
|
19403
|
+
});
|
|
19404
|
+
|
|
19325
19405
|
// ../../packages/local-graph/src/anchor-backfill.ts
|
|
19326
19406
|
function isLegacyAnchor(attrs) {
|
|
19327
19407
|
return attrs?.["captureTime"] === true && attrs["anchorProvenance"] === void 0;
|
|
@@ -21566,6 +21646,7 @@ __export(src_exports2, {
|
|
|
21566
21646
|
JOINT_COMMUNITY_EDGES: () => JOINT_COMMUNITY_EDGES,
|
|
21567
21647
|
JOINT_COMMUNITY_LABELS: () => JOINT_COMMUNITY_LABELS,
|
|
21568
21648
|
MAX_ANCHOR_FILES: () => MAX_ANCHOR_FILES,
|
|
21649
|
+
MIN_INTENT_TOKENS: () => MIN_INTENT_TOKENS,
|
|
21569
21650
|
PATTERN_DEDUP_COSINE: () => PATTERN_DEDUP_COSINE,
|
|
21570
21651
|
PERCOLATING_DRIFT_EDGES: () => PERCOLATING_DRIFT_EDGES,
|
|
21571
21652
|
PERCOLATING_EDGES: () => PERCOLATING_EDGES,
|
|
@@ -21638,6 +21719,7 @@ __export(src_exports2, {
|
|
|
21638
21719
|
openGraphStore: () => openGraphStore,
|
|
21639
21720
|
osNodeId: () => osNodeId,
|
|
21640
21721
|
parseAbstractionFences: () => parseAbstractionFences,
|
|
21722
|
+
parseIntentFences: () => parseIntentFences,
|
|
21641
21723
|
parseSemver: () => parseSemver,
|
|
21642
21724
|
parseTriageFences: () => parseTriageFences,
|
|
21643
21725
|
pendingAbstractions: () => pendingAbstractions,
|
|
@@ -21652,6 +21734,7 @@ __export(src_exports2, {
|
|
|
21652
21734
|
recordCauseChainLink: () => recordCauseChainLink,
|
|
21653
21735
|
recordClaim: () => recordClaim,
|
|
21654
21736
|
recordMisreadPrior: () => recordMisreadPrior,
|
|
21737
|
+
recordRenderLedger: () => recordRenderLedger,
|
|
21655
21738
|
recordTriageObservation: () => recordTriageObservation,
|
|
21656
21739
|
reinforceSameAnchorProblem: () => reinforceSameAnchorProblem,
|
|
21657
21740
|
relateClaims: () => relateClaims,
|
|
@@ -21664,6 +21747,7 @@ __export(src_exports2, {
|
|
|
21664
21747
|
retractDesignProblemByStatement: () => retractDesignProblemByStatement,
|
|
21665
21748
|
revisitContradictedPrinciples: () => revisitContradictedPrinciples,
|
|
21666
21749
|
revisitStaleRoutes: () => revisitStaleRoutes,
|
|
21750
|
+
searchByIntent: () => searchByIntent,
|
|
21667
21751
|
solutionForProblem: () => solutionForProblem,
|
|
21668
21752
|
splittingAxis: () => splittingAxis,
|
|
21669
21753
|
stampObservedOs: () => stampObservedOs,
|
|
@@ -21686,6 +21770,7 @@ var init_src5 = __esm({
|
|
|
21686
21770
|
init_crystallize();
|
|
21687
21771
|
init_aggregate();
|
|
21688
21772
|
init_design_problem();
|
|
21773
|
+
init_intent();
|
|
21689
21774
|
init_anchor_backfill();
|
|
21690
21775
|
init_percolate();
|
|
21691
21776
|
init_abstraction();
|
|
@@ -22183,14 +22268,42 @@ function assembleAgentContext(opts) {
|
|
|
22183
22268
|
}
|
|
22184
22269
|
snapshot.skills = [...snapshot.skills].sort((a, b) => b.confidence - a.confidence);
|
|
22185
22270
|
const maxChars = opts.maxChars ?? DEFAULT_AGENT_CONTEXT_BUDGET;
|
|
22271
|
+
const candidates = snapshotImpressions(snapshot);
|
|
22186
22272
|
const dropped = budgetSnapshot(snapshot, maxChars);
|
|
22273
|
+
const ledger = diffRenderLedger(candidates, snapshotImpressions(snapshot));
|
|
22187
22274
|
let body2 = renderSnapshot(snapshot);
|
|
22188
22275
|
if (dropped > 0) {
|
|
22189
22276
|
body2 += `
|
|
22190
22277
|
|
|
22191
22278
|
_${dropped} lower-priority item${dropped === 1 ? "" : "s"} omitted to fit the passive-context budget \u2014 the full graph is in the errata dashboard._`;
|
|
22192
22279
|
}
|
|
22193
|
-
return { body: body2, snapshot, dropped };
|
|
22280
|
+
return { body: body2, snapshot, dropped, ledger };
|
|
22281
|
+
}
|
|
22282
|
+
function snapshotImpressions(s) {
|
|
22283
|
+
const out2 = [];
|
|
22284
|
+
const push = (band, ids) => {
|
|
22285
|
+
for (const id of ids) if (id) out2.push({ id, band });
|
|
22286
|
+
};
|
|
22287
|
+
push("recentProblems", s.recentProblems.map((p) => p.node.id));
|
|
22288
|
+
push("recentResolved", s.recentResolved.map((r) => r.node.id));
|
|
22289
|
+
push("recentConstraints", s.recentConstraints.map((c) => c.id));
|
|
22290
|
+
push("motifs", s.motifs.map((m) => m.id));
|
|
22291
|
+
push("remote", (s.remote ?? []).map((r) => r.id));
|
|
22292
|
+
push("needsRevisit", s.needsRevisit.map((r) => r.id));
|
|
22293
|
+
push(
|
|
22294
|
+
"reviewItems",
|
|
22295
|
+
(s.reviewItems ?? []).map((r) => r.kind === "abstraction" ? r.candidate : r.route)
|
|
22296
|
+
);
|
|
22297
|
+
push("workingFile", s.workingFile?.priors?.openProblems.map((p) => p.id) ?? []);
|
|
22298
|
+
return out2;
|
|
22299
|
+
}
|
|
22300
|
+
function diffRenderLedger(before, after) {
|
|
22301
|
+
const key = (i2) => `${i2.band}\0${i2.id}`;
|
|
22302
|
+
const survived = new Set(after.map(key));
|
|
22303
|
+
const shown = [];
|
|
22304
|
+
const evicted = [];
|
|
22305
|
+
for (const i2 of before) (survived.has(key(i2)) ? shown : evicted).push(i2);
|
|
22306
|
+
return { shown, evicted };
|
|
22194
22307
|
}
|
|
22195
22308
|
var RECALL_FIRST_HEADER, RECALL_FIRST_BODY, RECALL_FIRST_BLOCK, SEARCH_IMPERATIVE_HEADER, SEARCH_IMPERATIVE_BODY, EVICTION_ORDER, MOTIF_FLOOR, REMOTE_FLOOR, PROBLEM_FLOOR, REVIEW_ITEM_FLOOR, DEFAULT_AGENT_CONTEXT_BUDGET;
|
|
22196
22309
|
var init_render = __esm({
|
|
@@ -22204,7 +22317,7 @@ var init_render = __esm({
|
|
|
22204
22317
|
|
|
22205
22318
|
${RECALL_FIRST_BODY}`;
|
|
22206
22319
|
SEARCH_IMPERATIVE_HEADER = "### \u{1F50E} PRIORS ARE SEEDS \u2014 a sample, not the whole graph";
|
|
22207
|
-
SEARCH_IMPERATIVE_BODY = "Everything below is a budgeted
|
|
22320
|
+
SEARCH_IMPERATIVE_BODY = "Everything below is a budgeted slice of a much larger graph, not all errata knows. Starting a piece of work? Say what it is \u2014 we search on it between your tool calls and put what we find here:\n```errata-intent\nintent: <the work in hand, in your words>\n```\nNarration, not a detour: no tool call, no plan change. It is the one signal we cannot derive from your edits \u2014 everything else here is guessed from the files you touched.";
|
|
22208
22321
|
EVICTION_ORDER = [
|
|
22209
22322
|
"skills",
|
|
22210
22323
|
// Review items beyond the floor drop immediately after skills — one naming
|
|
@@ -53498,7 +53611,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
53498
53611
|
}
|
|
53499
53612
|
|
|
53500
53613
|
// src/engine.ts
|
|
53501
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
53614
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.476" : "2.0.0-alpha.0";
|
|
53502
53615
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
53503
53616
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
53504
53617
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -53869,7 +53982,7 @@ function createWorkspaceEngine(opts) {
|
|
|
53869
53982
|
const doneRender = prebuilt ? null : markPass(`context-render-inline:${profile.name}`);
|
|
53870
53983
|
const pendingUpdate = opts.pendingUpdate?.() ?? null;
|
|
53871
53984
|
const reviewItems = pickReviewItems();
|
|
53872
|
-
const { body: body2, snapshot } = assembleAgentContext({
|
|
53985
|
+
const { body: body2, snapshot, ledger } = assembleAgentContext({
|
|
53873
53986
|
store,
|
|
53874
53987
|
...snapOpts,
|
|
53875
53988
|
remote: remotePriors,
|
|
@@ -53879,6 +53992,12 @@ function createWorkspaceEngine(opts) {
|
|
|
53879
53992
|
...reviewItems.length ? { reviewItems } : {}
|
|
53880
53993
|
});
|
|
53881
53994
|
doneRender?.();
|
|
53995
|
+
try {
|
|
53996
|
+
const seq = store.currentIngestSeq();
|
|
53997
|
+
recordRenderLedger(store, ledger, seq, Date.now());
|
|
53998
|
+
} catch (err2) {
|
|
53999
|
+
console.warn("[errata] render ledger failed:", err2.message?.slice(0, 120));
|
|
54000
|
+
}
|
|
53882
54001
|
writeContextFile(opts.workspaceRoot, body2);
|
|
53883
54002
|
const target = join26(opts.workspaceRoot, "AGENTS.md");
|
|
53884
54003
|
writeManagedBlock(target, { body: AGENTS_POINTER_BODY, stable: true, force: true });
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -25555,6 +25555,9 @@ function markFixCandidates(store2, t) {
|
|
|
25555
25555
|
return resolved;
|
|
25556
25556
|
}
|
|
25557
25557
|
|
|
25558
|
+
// ../../packages/local-graph/src/intent.ts
|
|
25559
|
+
init_src();
|
|
25560
|
+
|
|
25558
25561
|
// ../../packages/local-graph/src/anchor-backfill.ts
|
|
25559
25562
|
init_src();
|
|
25560
25563
|
init_src2();
|