haansi 0.1.120 → 0.1.122

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.
Files changed (2) hide show
  1. package/dist/haansi.js +80 -7
  2. package/package.json +1 -1
package/dist/haansi.js CHANGED
@@ -95,7 +95,7 @@ var require_package = __commonJS({
95
95
  "package.json"(exports2, module2) {
96
96
  module2.exports = {
97
97
  name: "haansi",
98
- version: "0.1.120",
98
+ version: "0.1.122",
99
99
  description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
100
100
  bin: {
101
101
  haansi: "./dist/haansi.js"
@@ -19480,6 +19480,24 @@ var init_exclusions = __esm({
19480
19480
  "Actions workflow names from CI config that passed on the fix."
19481
19481
  ]
19482
19482
  }),
19483
+ // The change index (outcome-ledger/066): each changed file as org-keyed
19484
+ // digests (path_blind, base_blind, dir_blinds: the *_blind rule); these
19485
+ // say only which source a row is for.
19486
+ ...exchangeExclusions(INTEL, "change_files", {
19487
+ kind: ["operational", "Closed CHECK vocabulary (solution, activity)."],
19488
+ source_id: [
19489
+ "join-key",
19490
+ "The solution's or activity's id (a UUID as text), joined by equality."
19491
+ ],
19492
+ source_fingerprint: [
19493
+ "derived",
19494
+ "A truncated SHA-256 of the source's path list, to tell when to rebuild; no text."
19495
+ ],
19496
+ dir_blinds: [
19497
+ "derived",
19498
+ "Org-keyed HMAC digests of the file's folders (blind indexes, plural so the *_blind rule misses it); no path text."
19499
+ ]
19500
+ }),
19483
19501
  ...exchangeExclusions(INTEL, "stored_replay_tasks", {
19484
19502
  task_key: [
19485
19503
  "join-key",
@@ -26233,6 +26251,14 @@ var init_search_vector_write = __esm({
26233
26251
  }
26234
26252
  });
26235
26253
 
26254
+ // ../../packages/@company/db/src/change-paths.ts
26255
+ var init_change_paths = __esm({
26256
+ "../../packages/@company/db/src/change-paths.ts"() {
26257
+ "use strict";
26258
+ init_src4();
26259
+ }
26260
+ });
26261
+
26236
26262
  // ../../packages/@company/db/src/org-purge.ts
26237
26263
  var observability5;
26238
26264
  var init_org_purge = __esm({
@@ -26995,6 +27021,11 @@ var init_table_registry = __esm({
26995
27021
  entry("intelligence", INTELLIGENCE_DB, "replay_mining_requests", "direct", {
26996
27022
  scopingColumn: "organization_id"
26997
27023
  }),
27024
+ // The change index: each changed file of a solution or an activity as
27025
+ // org-keyed digests, so files find them on any org (outcome-ledger/066).
27026
+ entry("intelligence", INTELLIGENCE_DB, "change_files", "direct", {
27027
+ scopingColumn: "organization_id"
27028
+ }),
26998
27029
  // A person's revert verdicts, the checks that validate a change and the
26999
27030
  // replay commands, per repository (outcome evidence v2 plan).
27000
27031
  entry("intelligence", INTELLIGENCE_DB, "revert_labels", "direct", {
@@ -28107,6 +28138,7 @@ var init_src6 = __esm({
28107
28138
  init_admin_pools();
28108
28139
  init_search_vector_write();
28109
28140
  init_keyword_terms();
28141
+ init_change_paths();
28110
28142
  init_org_purge();
28111
28143
  init_org_orphan_scan();
28112
28144
  init_integration_purge();
@@ -60309,7 +60341,7 @@ function searchSolutionsTool(contextSchema2) {
60309
60341
  description: "Optional. The error line, e.g. the assertion or exception message"
60310
60342
  },
60311
60343
  files: stringList(
60312
- "Optional. File paths you changed (or will change), or that the failure runs through"
60344
+ "Optional. File (or folder) paths you changed (or will change), or that the failure runs through"
60313
60345
  ),
60314
60346
  names: stringList(
60315
60347
  "Optional. Identifiers involved: functions, classes, routes, config keys"
@@ -87252,6 +87284,13 @@ function alreadyMeasured(measured, arm, agent, model, configFingerprint) {
87252
87284
  (m) => m.arm === arm && (m.agent ?? null) === (agent ?? null) && (m.model ?? null) === (model ?? null) && m.configFingerprint === configFingerprint
87253
87285
  );
87254
87286
  }
87287
+ function replayedBefore(measured, arms, agent, model) {
87288
+ return arms.every(
87289
+ (arm) => (measured ?? []).some(
87290
+ (m) => m.arm === arm && (m.agent ?? null) === (agent ?? null) && (m.model ?? null) === (model ?? null)
87291
+ )
87292
+ );
87293
+ }
87255
87294
  function pastDeadline(startedAt, now, maxHours) {
87256
87295
  return maxHours !== null && now - startedAt >= maxHours * 36e5;
87257
87296
  }
@@ -89254,6 +89293,15 @@ var init_replay_spec_gaps = __esm({
89254
89293
  });
89255
89294
 
89256
89295
  // src/commands/replay-recurring.ts
89296
+ function errorKeyOf(output) {
89297
+ for (const line of output.split("\n")) {
89298
+ const m = /\b\w*(?:Error|Exception)\b:?\s*(.+)$/.exec(line) ?? /\b(expected .+)$/i.exec(line);
89299
+ if (!m) continue;
89300
+ const key = m[1].toLowerCase().replace(/(["'`])(?:(?!\1).)*\1/g, "_").replace(/\d+/g, "#").replace(/\s+/g, " ").trim().slice(0, 80);
89301
+ if (key.replace(/[_#\s]/g, "").length >= 12) return key;
89302
+ }
89303
+ return null;
89304
+ }
89257
89305
  function commitTimeOf(run3) {
89258
89306
  const seen = /* @__PURE__ */ new Map();
89259
89307
  return (sha) => {
@@ -89278,11 +89326,15 @@ async function recurringFailures(tasks, committedAt) {
89278
89326
  const start = t.startsAt ? Date.parse(t.startsAt) : NaN;
89279
89327
  if (!Number.isFinite(start)) continue;
89280
89328
  const mine = new Set(t.failing.tests);
89329
+ const myFiles = new Set(t.failing.tests.map(fileOf));
89330
+ const myError = errorKeyOf(t.failing.output);
89281
89331
  const earlier = [];
89282
89332
  for (const e of bugs) {
89283
89333
  if (e.taskId === t.taskId || e.repository !== t.repository) continue;
89284
89334
  if (e.processId && e.processId === t.processId) continue;
89285
- if (!e.failing.tests.some((name) => mine.has(name))) continue;
89335
+ const sameTest = e.failing.tests.some((name) => mine.has(name));
89336
+ const sameFileAndError = myError !== null && e.failing.tests.some((name) => myFiles.has(fileOf(name))) && errorKeyOf(e.failing.output) === myError;
89337
+ if (!sameTest && !sameFileAndError) continue;
89286
89338
  const fixed = await committedAt(e.targetSha);
89287
89339
  if (fixed !== null && fixed < start) earlier.push(e.taskId);
89288
89340
  }
@@ -89291,10 +89343,14 @@ async function recurringFailures(tasks, committedAt) {
89291
89343
  }
89292
89344
  return out;
89293
89345
  }
89294
- var MAX_RECURRING, SHA2;
89346
+ var fileOf, MAX_RECURRING, SHA2;
89295
89347
  var init_replay_recurring = __esm({
89296
89348
  "src/commands/replay-recurring.ts"() {
89297
89349
  "use strict";
89350
+ fileOf = (test) => {
89351
+ const i = test.indexOf(" \u203A ");
89352
+ return i < 0 ? test : test.slice(0, i);
89353
+ };
89298
89354
  MAX_RECURRING = 20;
89299
89355
  SHA2 = /^[0-9a-f]{40}$/i;
89300
89356
  }
@@ -90373,7 +90429,7 @@ function configFingerprintOf(c) {
90373
90429
  }
90374
90430
  async function runStoredReplays(options, deps) {
90375
90431
  const repository = await repositoryOf(deps);
90376
- const set2 = await deps.getReplaySet(repository);
90432
+ let set2 = await deps.getReplaySet(repository);
90377
90433
  const repo = options.repoCommands ? set2.repoCommands : null;
90378
90434
  const setupCmd = options.setupCmd ?? repo?.setupCommand ?? null;
90379
90435
  const testCmd = options.testCmd || repo?.testCommand || "";
@@ -90402,6 +90458,21 @@ async function runStoredReplays(options, deps) {
90402
90458
  );
90403
90459
  return { results: [], notValid: 0, recorded: null };
90404
90460
  }
90461
+ if (options.newOnly) {
90462
+ const fresh = set2.tasks.filter(
90463
+ (t) => !replayedBefore(
90464
+ t.measured,
90465
+ options.arms,
90466
+ options.agentName ?? null,
90467
+ options.model ?? null
90468
+ )
90469
+ );
90470
+ deps.log(
90471
+ `--new-only: ${set2.tasks.length - fresh.length} task(s) replayed before with this agent and model left out; ${fresh.length} new.`
90472
+ );
90473
+ set2 = { ...set2, tasks: fresh };
90474
+ if (fresh.length === 0) return { results: [], notValid: 0, recorded: null };
90475
+ }
90405
90476
  let mine;
90406
90477
  if (options.fromChecks) {
90407
90478
  const picked = fromChecks(set2.tasks, options.limit, options.shard ?? null);
@@ -90962,6 +91033,7 @@ function parseReplayArgs(argv) {
90962
91033
  else if (a === "--repo-commands") options.repoCommands = true;
90963
91034
  else if (takeScaleArg(a, next, scale, errors)) continue;
90964
91035
  else if (a === "--force") options.force = true;
91036
+ else if (a === "--new-only") options.newOnly = true;
90965
91037
  else if (a === "--any-context") options.anyContext = true;
90966
91038
  else if (a === "--inject-context") options.injectContext = true;
90967
91039
  else if (a === "--check-only") options.checkOnly = true;
@@ -91566,7 +91638,7 @@ var init_replay = __esm({
91566
91638
  [--timeout-min 20] [--agent-name <name>] [--model <name>]
91567
91639
  [--judge-cmd "<cmd>"]
91568
91640
  [--run-ref <url>] [--dry-run] [--repo-commands] [--no-diffs]
91569
- [--shard i/n] [--concurrency k] [--force] [--max-hours h] [--any-context]
91641
+ [--shard i/n] [--concurrency k] [--force] [--new-only] [--max-hours h] [--any-context]
91570
91642
  [--check-only | --from-checks]
91571
91643
  [--setup-cache <files> --setup-cache-path <paths> [--setup-cache-dir <dir>]]
91572
91644
  [--container <image> [--container-setup "<cmd>"] [--container-env NAME]...]
@@ -91586,7 +91658,8 @@ test output on this machine and reports only how far they match.
91586
91658
  At scale: --shard i/n takes this job's share of the tasks (a CI matrix of n
91587
91659
  jobs); --concurrency k replays k tasks at once here; an arm already measured
91588
91660
  on the same card with the same agent and model is skipped (--force runs it
91589
- again); --max-hours stops starting arms after h hours. --setup-cache
91661
+ again); --new-only leaves out every task replayed before on all its arms with
91662
+ the same agent and model, in any version, before --limit picks; --max-hours stops starting arms after h hours. --setup-cache
91590
91663
  package-lock.json --setup-cache-path '**/node_modules' keeps the setup's output
91591
91664
  (every workspace's node_modules) per lockfile (in ~/.cache/haansi-replay, or --setup-cache-dir) and restores
91592
91665
  it instead of running the setup again; not with --container.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haansi",
3
- "version": "0.1.120",
3
+ "version": "0.1.122",
4
4
  "description": "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
5
5
  "bin": {
6
6
  "haansi": "./dist/haansi.js"