@inerrata-corporation/errata 2.0.2-dev.1097 → 2.0.2-dev.1116
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 +128 -3
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -23067,12 +23067,25 @@ function renderSnapshot(s) {
|
|
|
23067
23067
|
}
|
|
23068
23068
|
lines.push("");
|
|
23069
23069
|
if (s.remote && s.remote.length > 0) {
|
|
23070
|
+
const stratumOf = (m) => {
|
|
23071
|
+
const v = m.attrs?.["stratum"];
|
|
23072
|
+
return v === "project" || v === "team" || v === "org" ? v : void 0;
|
|
23073
|
+
};
|
|
23074
|
+
const hasOwnOrg = s.remote.some((m) => stratumOf(m) !== void 0);
|
|
23070
23075
|
lines.push("### From the Errata Network \u2014 collective priors");
|
|
23071
23076
|
lines.push(
|
|
23072
|
-
"_A small sample of knowledge
|
|
23077
|
+
"_A small sample of knowledge facing your stack/domain (not yet local \u2014 the Network holds far more; these ids seed deeper bursts). Unmarked entries are network-generalized: corroborated across teams, but not from this repo \u2014 treat as pattern and re-derive locally._"
|
|
23073
23078
|
);
|
|
23079
|
+
if (hasOwnOrg) {
|
|
23080
|
+
lines.push(
|
|
23081
|
+
"_Entries marked `[org]`/`[team]`/`[project]` are from YOUR org's membrane \u2014 specifics are real and checkable; someone here already hit this, so consider coordinating before re-deriving._"
|
|
23082
|
+
);
|
|
23083
|
+
}
|
|
23074
23084
|
for (const m of s.remote) {
|
|
23075
|
-
|
|
23085
|
+
const stratum = stratumOf(m);
|
|
23086
|
+
lines.push(
|
|
23087
|
+
`- ${stratum ? `\`[${stratum}]\` ` : ""}**${m.label}:** ${m.description}${tagOf(m)}`
|
|
23088
|
+
);
|
|
23076
23089
|
}
|
|
23077
23090
|
lines.push("");
|
|
23078
23091
|
}
|
|
@@ -53280,6 +53293,91 @@ function subagentTranscripts(mainTranscriptPath, sessionId) {
|
|
|
53280
53293
|
refs.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
53281
53294
|
return refs;
|
|
53282
53295
|
}
|
|
53296
|
+
function codexSessionRoots(env2 = process.env, home = homedir4()) {
|
|
53297
|
+
const roots = /* @__PURE__ */ new Set();
|
|
53298
|
+
const explicit = env2["ERRATA_CODEX_SESSIONS_DIRS"];
|
|
53299
|
+
if (explicit) {
|
|
53300
|
+
for (const d of explicit.split(":")) if (d.trim()) roots.add(d.trim());
|
|
53301
|
+
}
|
|
53302
|
+
if (env2["CODEX_HOME"]) roots.add(join16(env2["CODEX_HOME"], "sessions"));
|
|
53303
|
+
roots.add(join16(home, ".codex", "sessions"));
|
|
53304
|
+
return [...roots];
|
|
53305
|
+
}
|
|
53306
|
+
function readCodexRolloutCwd(path2) {
|
|
53307
|
+
let fd;
|
|
53308
|
+
try {
|
|
53309
|
+
fd = openSync(path2, "r");
|
|
53310
|
+
const CAP = 1e6;
|
|
53311
|
+
const chunk = 65536;
|
|
53312
|
+
let acc = Buffer.alloc(0);
|
|
53313
|
+
let pos = 0;
|
|
53314
|
+
let nl = -1;
|
|
53315
|
+
while (acc.length < CAP) {
|
|
53316
|
+
const buf = Buffer.allocUnsafe(chunk);
|
|
53317
|
+
const n = readSync(fd, buf, 0, chunk, pos);
|
|
53318
|
+
if (n <= 0) break;
|
|
53319
|
+
acc = acc.length === 0 ? buf.subarray(0, n) : Buffer.concat([acc, buf.subarray(0, n)]);
|
|
53320
|
+
pos += n;
|
|
53321
|
+
nl = acc.indexOf(10);
|
|
53322
|
+
if (nl >= 0) break;
|
|
53323
|
+
}
|
|
53324
|
+
const firstLine = acc.toString("utf8", 0, nl >= 0 ? nl : acc.length);
|
|
53325
|
+
try {
|
|
53326
|
+
const o = JSON.parse(firstLine);
|
|
53327
|
+
const meta3 = o?.type === "session_meta" ? o.payload ?? o : o.payload ?? o;
|
|
53328
|
+
const cwd = meta3?.cwd ?? o?.cwd;
|
|
53329
|
+
if (typeof cwd === "string") return cwd;
|
|
53330
|
+
} catch {
|
|
53331
|
+
}
|
|
53332
|
+
const m = firstLine.match(/"cwd"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
53333
|
+
return m ? JSON.parse(`"${m[1]}"`) : null;
|
|
53334
|
+
} catch {
|
|
53335
|
+
return null;
|
|
53336
|
+
} finally {
|
|
53337
|
+
if (fd !== void 0) try {
|
|
53338
|
+
closeSync(fd);
|
|
53339
|
+
} catch {
|
|
53340
|
+
}
|
|
53341
|
+
}
|
|
53342
|
+
}
|
|
53343
|
+
function codexRolloutsForCwd(cwd, opts = {}) {
|
|
53344
|
+
const sinceMs = opts.sinceMs ?? 0;
|
|
53345
|
+
const limit = opts.limit ?? 25;
|
|
53346
|
+
const out2 = [];
|
|
53347
|
+
for (const root of codexSessionRoots(opts.env, opts.home)) {
|
|
53348
|
+
if (!existsSync13(root)) continue;
|
|
53349
|
+
const stack = [{ dir: root, depth: 0 }];
|
|
53350
|
+
while (stack.length > 0) {
|
|
53351
|
+
const { dir, depth } = stack.pop();
|
|
53352
|
+
let names;
|
|
53353
|
+
try {
|
|
53354
|
+
names = readdirSync6(dir);
|
|
53355
|
+
} catch {
|
|
53356
|
+
continue;
|
|
53357
|
+
}
|
|
53358
|
+
for (const name2 of names) {
|
|
53359
|
+
const full = join16(dir, name2);
|
|
53360
|
+
let st;
|
|
53361
|
+
try {
|
|
53362
|
+
st = statSync4(full);
|
|
53363
|
+
} catch {
|
|
53364
|
+
continue;
|
|
53365
|
+
}
|
|
53366
|
+
if (st.isDirectory()) {
|
|
53367
|
+
if (depth < 3) stack.push({ dir: full, depth: depth + 1 });
|
|
53368
|
+
continue;
|
|
53369
|
+
}
|
|
53370
|
+
if (depth < 3) continue;
|
|
53371
|
+
if (!name2.startsWith("rollout-") || !name2.endsWith(".jsonl")) continue;
|
|
53372
|
+
if (st.mtimeMs < sinceMs) continue;
|
|
53373
|
+
if (readCodexRolloutCwd(full) !== cwd) continue;
|
|
53374
|
+
out2.push({ path: full, sessionId: `codex:${basename3(name2, ".jsonl")}`, mtimeMs: st.mtimeMs });
|
|
53375
|
+
}
|
|
53376
|
+
}
|
|
53377
|
+
}
|
|
53378
|
+
out2.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
53379
|
+
return out2.slice(0, limit);
|
|
53380
|
+
}
|
|
53283
53381
|
|
|
53284
53382
|
// src/prior-tags.ts
|
|
53285
53383
|
init_src();
|
|
@@ -56501,13 +56599,14 @@ function createLivenessWatch(deps) {
|
|
|
56501
56599
|
}
|
|
56502
56600
|
|
|
56503
56601
|
// src/engine.ts
|
|
56504
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
56602
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.1116" : "2.0.0-alpha.0";
|
|
56505
56603
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
56506
56604
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
56507
56605
|
var GIT_OP_MUTE_MS = 4e3;
|
|
56508
56606
|
var REINDEX_DEBOUNCE_MS = 200;
|
|
56509
56607
|
var IDENTITY_AUDIT_MAX_BYTES = 16 * 1024 * 1024;
|
|
56510
56608
|
var TURN_REPLAY_LOOKBACK_MS = 7 * 24 * 60 * 6e4;
|
|
56609
|
+
var CODEX_SWEEP_LOOKBACK_MS = 10 * 6e4;
|
|
56511
56610
|
function appendIdentityAudit(path2, record2, line) {
|
|
56512
56611
|
if (!record2.accepted && record2.score <= 0) return;
|
|
56513
56612
|
try {
|
|
@@ -58026,10 +58125,35 @@ function createWorkspaceEngine(opts) {
|
|
|
58026
58125
|
await yieldToLoop();
|
|
58027
58126
|
await harvestSession(ref.sessionId, ref.path);
|
|
58028
58127
|
}
|
|
58128
|
+
const codexRefs = codexRolloutsForCwd(opts.workspaceRoot, {
|
|
58129
|
+
sinceMs: Date.now() - TURN_REPLAY_LOOKBACK_MS,
|
|
58130
|
+
limit: 25
|
|
58131
|
+
});
|
|
58132
|
+
for (const ref of codexRefs) {
|
|
58133
|
+
await yieldToLoop();
|
|
58134
|
+
await harvestSession(ref.sessionId, ref.path);
|
|
58135
|
+
}
|
|
58029
58136
|
} catch {
|
|
58030
58137
|
}
|
|
58031
58138
|
})();
|
|
58032
58139
|
});
|
|
58140
|
+
const sweepCodexRollouts = () => {
|
|
58141
|
+
setImmediate(() => {
|
|
58142
|
+
void (async () => {
|
|
58143
|
+
try {
|
|
58144
|
+
const refs = codexRolloutsForCwd(opts.workspaceRoot, {
|
|
58145
|
+
sinceMs: Date.now() - CODEX_SWEEP_LOOKBACK_MS,
|
|
58146
|
+
limit: 10
|
|
58147
|
+
});
|
|
58148
|
+
for (const ref of refs) {
|
|
58149
|
+
await yieldToLoop();
|
|
58150
|
+
await harvestSession(ref.sessionId, ref.path);
|
|
58151
|
+
}
|
|
58152
|
+
} catch {
|
|
58153
|
+
}
|
|
58154
|
+
})();
|
|
58155
|
+
});
|
|
58156
|
+
};
|
|
58033
58157
|
const designRollup = opts.designRollup ?? (process.env["ERRATA_ROLLUP"] === "1" ? haikuDesignRollup(process.env["ANTHROPIC_API_KEY"] ?? null) : void 0);
|
|
58034
58158
|
const onSessionEnd = (e) => {
|
|
58035
58159
|
if (!designRollup) return;
|
|
@@ -58168,6 +58292,7 @@ function createWorkspaceEngine(opts) {
|
|
|
58168
58292
|
refreshContextNow();
|
|
58169
58293
|
},
|
|
58170
58294
|
async tick() {
|
|
58295
|
+
sweepCodexRollouts();
|
|
58171
58296
|
maybeRefreshRemotePriors();
|
|
58172
58297
|
const report = {
|
|
58173
58298
|
generalizerEventsProcessed: 0,
|