@inerrata-corporation/errata 2.0.2-dev.477 → 2.0.2-dev.479
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/errata.mjs +67 -3
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -22114,7 +22114,24 @@ function renderSnapshot(s) {
|
|
|
22114
22114
|
}
|
|
22115
22115
|
lines.push("");
|
|
22116
22116
|
}
|
|
22117
|
-
if (s.
|
|
22117
|
+
if (s.statedIntent) {
|
|
22118
|
+
const si = s.statedIntent;
|
|
22119
|
+
lines.push(`### \u{1F3AF} You said you're working on this`);
|
|
22120
|
+
lines.push(`> ${si.text}`);
|
|
22121
|
+
if (si.hits.length === 0) {
|
|
22122
|
+
lines.push("");
|
|
22123
|
+
lines.push(
|
|
22124
|
+
"_Nothing recorded here matches that yet \u2014 you're first. What you hit and how you resolve it is what a later agent will be shown._"
|
|
22125
|
+
);
|
|
22126
|
+
} else {
|
|
22127
|
+
lines.push("");
|
|
22128
|
+
lines.push("_Priors that speak to it \u2014 cite one with its `[handle]` if you lean on it:_");
|
|
22129
|
+
for (const h of si.hits) {
|
|
22130
|
+
lines.push(`- **${h.description}** \u2014 \`${h.id}\``);
|
|
22131
|
+
}
|
|
22132
|
+
}
|
|
22133
|
+
lines.push("");
|
|
22134
|
+
} else if (s.workingFile) {
|
|
22118
22135
|
const w = s.workingFile;
|
|
22119
22136
|
lines.push(`### Working file: \`${w.relPath}\``);
|
|
22120
22137
|
if (w.symbols.length) {
|
|
@@ -22227,6 +22244,7 @@ function dropLowestUnit(s) {
|
|
|
22227
22244
|
if (s.motifs.length) return s.motifs.pop(), true;
|
|
22228
22245
|
break;
|
|
22229
22246
|
case "workingFile":
|
|
22247
|
+
if (s.statedIntent) return delete s.statedIntent, true;
|
|
22230
22248
|
if (s.workingFile) return delete s.workingFile, true;
|
|
22231
22249
|
break;
|
|
22232
22250
|
case "remoteOverFloor":
|
|
@@ -22275,6 +22293,7 @@ function assembleAgentContext(opts) {
|
|
|
22275
22293
|
if (opts.edgeElicitation) snapshot.edgeElicitation = opts.edgeElicitation;
|
|
22276
22294
|
if (opts.pendingUpdate) snapshot.pendingUpdate = opts.pendingUpdate;
|
|
22277
22295
|
if (opts.reviewItems?.length) snapshot.reviewItems = [...opts.reviewItems];
|
|
22296
|
+
if (opts.statedIntent) snapshot.statedIntent = opts.statedIntent;
|
|
22278
22297
|
if (opts.remote && opts.remote.length > 0) {
|
|
22279
22298
|
const seen = /* @__PURE__ */ new Set();
|
|
22280
22299
|
const remote = opts.remote.filter((n) => {
|
|
@@ -22315,6 +22334,7 @@ function snapshotImpressions(s) {
|
|
|
22315
22334
|
(s.reviewItems ?? []).map((r) => r.kind === "abstraction" ? r.candidate : r.route)
|
|
22316
22335
|
);
|
|
22317
22336
|
push("workingFile", s.workingFile?.priors?.openProblems.map((p) => p.id) ?? []);
|
|
22337
|
+
push("statedIntent", (s.statedIntent?.hits ?? []).map((h) => h.id));
|
|
22318
22338
|
return out2;
|
|
22319
22339
|
}
|
|
22320
22340
|
function diffRenderLedger(before, after) {
|
|
@@ -53114,6 +53134,38 @@ ${GITIGNORE_LINES.join("\n")}
|
|
|
53114
53134
|
}
|
|
53115
53135
|
}
|
|
53116
53136
|
|
|
53137
|
+
// src/intent-state.ts
|
|
53138
|
+
var INTENT_TTL_MS = 15 * 60 * 1e3;
|
|
53139
|
+
function createIntentState(ttlMs = INTENT_TTL_MS) {
|
|
53140
|
+
const bySession = /* @__PURE__ */ new Map();
|
|
53141
|
+
let recent = null;
|
|
53142
|
+
const live = (s, nowMs) => s !== void 0 && nowMs - s.atMs < ttlMs;
|
|
53143
|
+
return {
|
|
53144
|
+
set(sessionId, text, nowMs) {
|
|
53145
|
+
const trimmed = text.trim();
|
|
53146
|
+
if (!trimmed) return false;
|
|
53147
|
+
const prev = bySession.get(sessionId);
|
|
53148
|
+
bySession.set(sessionId, { text: trimmed, atMs: nowMs });
|
|
53149
|
+
const changed = !(recent && recent.text === trimmed);
|
|
53150
|
+
recent = { sessionId, text: trimmed, atMs: nowMs };
|
|
53151
|
+
if (!changed && prev && prev.text === trimmed) return false;
|
|
53152
|
+
return changed;
|
|
53153
|
+
},
|
|
53154
|
+
get(sessionId, nowMs) {
|
|
53155
|
+
const s = bySession.get(sessionId);
|
|
53156
|
+
return live(s, nowMs) ? s.text : void 0;
|
|
53157
|
+
},
|
|
53158
|
+
mostRecent(nowMs) {
|
|
53159
|
+
if (!recent) return void 0;
|
|
53160
|
+
return nowMs - recent.atMs < ttlMs ? recent.text : void 0;
|
|
53161
|
+
},
|
|
53162
|
+
clear(sessionId) {
|
|
53163
|
+
bySession.delete(sessionId);
|
|
53164
|
+
if (recent?.sessionId === sessionId) recent = null;
|
|
53165
|
+
}
|
|
53166
|
+
};
|
|
53167
|
+
}
|
|
53168
|
+
|
|
53117
53169
|
// src/working-file-state.ts
|
|
53118
53170
|
function createWorkingFileState() {
|
|
53119
53171
|
const bySession = /* @__PURE__ */ new Map();
|
|
@@ -53631,7 +53683,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
53631
53683
|
}
|
|
53632
53684
|
|
|
53633
53685
|
// src/engine.ts
|
|
53634
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
53686
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.479" : "2.0.0-alpha.0";
|
|
53635
53687
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
53636
53688
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
53637
53689
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -53935,6 +53987,7 @@ function createWorkspaceEngine(opts) {
|
|
|
53935
53987
|
});
|
|
53936
53988
|
}
|
|
53937
53989
|
const workingFiles = createWorkingFileState();
|
|
53990
|
+
const intents = createIntentState();
|
|
53938
53991
|
const toolRuns = createToolRunState();
|
|
53939
53992
|
let ctxRefreshTimer = null;
|
|
53940
53993
|
let contextDirty = false;
|
|
@@ -54002,6 +54055,13 @@ function createWorkspaceEngine(opts) {
|
|
|
54002
54055
|
const doneRender = prebuilt ? null : markPass(`context-render-inline:${profile.name}`);
|
|
54003
54056
|
const pendingUpdate = opts.pendingUpdate?.() ?? null;
|
|
54004
54057
|
const reviewItems = pickReviewItems();
|
|
54058
|
+
const liveIntent = intents.mostRecent(Date.now());
|
|
54059
|
+
const intentHits = liveIntent ? searchByIntent(store, liveIntent, { limit: 4 }).map((h) => ({
|
|
54060
|
+
id: h.node.id,
|
|
54061
|
+
label: h.node.label,
|
|
54062
|
+
description: h.node.description,
|
|
54063
|
+
coverage: h.coverage
|
|
54064
|
+
})) : [];
|
|
54005
54065
|
const { body: body2, snapshot, ledger } = assembleAgentContext({
|
|
54006
54066
|
store,
|
|
54007
54067
|
...snapOpts,
|
|
@@ -54009,7 +54069,8 @@ function createWorkspaceEngine(opts) {
|
|
|
54009
54069
|
...elicit ? { edgeElicitation: { instruction: PRIOR_TAG_INSTRUCTION } } : {},
|
|
54010
54070
|
...prebuilt ? { snapshot: prebuilt } : {},
|
|
54011
54071
|
...pendingUpdate ? { pendingUpdate } : {},
|
|
54012
|
-
...reviewItems.length ? { reviewItems } : {}
|
|
54072
|
+
...reviewItems.length ? { reviewItems } : {},
|
|
54073
|
+
...liveIntent ? { statedIntent: { text: liveIntent, hits: intentHits } } : {}
|
|
54013
54074
|
});
|
|
54014
54075
|
doneRender?.();
|
|
54015
54076
|
try {
|
|
@@ -54371,6 +54432,9 @@ function createWorkspaceEngine(opts) {
|
|
|
54371
54432
|
const touchedFileId = turnFile ? resolveFileId(turnFile) : void 0;
|
|
54372
54433
|
const touched = new Set(toolRuns.get(sessionId));
|
|
54373
54434
|
if (touchedFileId) touched.add(touchedFileId);
|
|
54435
|
+
for (const fence of parseIntentFences(turn.text)) {
|
|
54436
|
+
if (intents.set(sessionId, fence.intent, t)) refreshContextNow();
|
|
54437
|
+
}
|
|
54374
54438
|
const plan = harvestInlineTags(store, turn.text, {
|
|
54375
54439
|
sourceId: sessionLastProblem.get(sessionId),
|
|
54376
54440
|
handleMap,
|