haansi 0.1.121 → 0.1.123

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 +103 -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.121",
98
+ version: "0.1.123",
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,36 @@ 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
+ change_status: [
19501
+ "operational",
19502
+ "GitHub's file status vocabulary (added, modified, removed, renamed)."
19503
+ ],
19504
+ change_ref: [
19505
+ "join-key",
19506
+ "owner/repo@sha or owner/repo#pr the diff was read from, as in change_outcomes."
19507
+ ],
19508
+ diff_state: [
19509
+ "operational",
19510
+ "Closed CHECK vocabulary (full, clipped, no_patch, unavailable)."
19511
+ ]
19512
+ }),
19483
19513
  ...exchangeExclusions(INTEL, "stored_replay_tasks", {
19484
19514
  task_key: [
19485
19515
  "join-key",
@@ -26233,6 +26263,25 @@ var init_search_vector_write = __esm({
26233
26263
  }
26234
26264
  });
26235
26265
 
26266
+ // ../../packages/@company/db/src/change-paths.ts
26267
+ var init_change_paths = __esm({
26268
+ "../../packages/@company/db/src/change-paths.ts"() {
26269
+ "use strict";
26270
+ init_src4();
26271
+ }
26272
+ });
26273
+
26274
+ // ../../packages/@company/db/src/change-text.ts
26275
+ var KEYWORDS;
26276
+ var init_change_text = __esm({
26277
+ "../../packages/@company/db/src/change-text.ts"() {
26278
+ "use strict";
26279
+ KEYWORDS = new Set(
26280
+ "this that with from have will when then than else elif true false null none undefined return const function export import class async await string number boolean void unknown interface type extends implements public private protected static readonly new delete typeof instanceof while break continue switch case default throw catch finally yield super self def lambda pass raise except select where order group limit insert update into values join left right inner outer table create alter drop index begin commit rollback not and exists between expect describe test toBe toEqual mockResolvedValue".toLowerCase().split(" ")
26281
+ );
26282
+ }
26283
+ });
26284
+
26236
26285
  // ../../packages/@company/db/src/org-purge.ts
26237
26286
  var observability5;
26238
26287
  var init_org_purge = __esm({
@@ -26995,6 +27044,11 @@ var init_table_registry = __esm({
26995
27044
  entry("intelligence", INTELLIGENCE_DB, "replay_mining_requests", "direct", {
26996
27045
  scopingColumn: "organization_id"
26997
27046
  }),
27047
+ // The change index: each changed file of a solution or an activity as
27048
+ // org-keyed digests, so files find them on any org (outcome-ledger/066).
27049
+ entry("intelligence", INTELLIGENCE_DB, "change_files", "direct", {
27050
+ scopingColumn: "organization_id"
27051
+ }),
26998
27052
  // A person's revert verdicts, the checks that validate a change and the
26999
27053
  // replay commands, per repository (outcome evidence v2 plan).
27000
27054
  entry("intelligence", INTELLIGENCE_DB, "revert_labels", "direct", {
@@ -28107,6 +28161,8 @@ var init_src6 = __esm({
28107
28161
  init_admin_pools();
28108
28162
  init_search_vector_write();
28109
28163
  init_keyword_terms();
28164
+ init_change_paths();
28165
+ init_change_text();
28110
28166
  init_org_purge();
28111
28167
  init_org_orphan_scan();
28112
28168
  init_integration_purge();
@@ -60309,10 +60365,10 @@ function searchSolutionsTool(contextSchema2) {
60309
60365
  description: "Optional. The error line, e.g. the assertion or exception message"
60310
60366
  },
60311
60367
  files: stringList(
60312
- "Optional. File paths you changed (or will change), or that the failure runs through"
60368
+ "Optional. File (or folder) paths you changed (or will change), or that the failure runs through"
60313
60369
  ),
60314
60370
  names: stringList(
60315
- "Optional. Identifiers involved: functions, classes, routes, config keys"
60371
+ "Optional. Identifiers involved: functions, classes, routes, config keys (matched against the code past fixes changed)"
60316
60372
  ),
60317
60373
  _context: contextSchema2
60318
60374
  },
@@ -88249,7 +88305,27 @@ function recallAsk(problem, targetDiff, targetFiles) {
88249
88305
  terms.join(" "),
88250
88306
  files.join(" ")
88251
88307
  ].map((q) => q.slice(0, QUERY_CHARS).trim()).filter((q, i, all) => q !== "" && all.indexOf(q) === i);
88252
- return { task: problem.slice(0, 1e3), error: null, queries };
88308
+ const idCounts = /* @__PURE__ */ new Map();
88309
+ for (const line of targetDiff.split("\n"))
88310
+ if (line.startsWith("+") && !line.startsWith("+++")) {
88311
+ for (const id of line.slice(1).match(IDENTIFIER) ?? [])
88312
+ if (/[a-z][A-Z]|_/.test(id) && !COMMON.has(id.toLowerCase()))
88313
+ idCounts.set(id, (idCounts.get(id) ?? 0) + 1);
88314
+ }
88315
+ const names = [...idCounts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).slice(0, MAX_RECALL_HINTS).map(([id]) => id.slice(0, MAX_HINT_CHARS));
88316
+ const paths = [...new Set(targetFiles)].filter((p) => p.length <= MAX_HINT_CHARS).slice(0, MAX_RECALL_HINTS);
88317
+ return {
88318
+ task: problem.slice(0, 1e3),
88319
+ error: null,
88320
+ queries,
88321
+ ...paths.length ? { paths } : {},
88322
+ ...paths.length || names.length ? {
88323
+ hints: {
88324
+ ...paths.length ? { files: paths } : {},
88325
+ ...names.length ? { names } : {}
88326
+ }
88327
+ } : {}
88328
+ };
88253
88329
  }
88254
88330
  function parseRelevance(text, shown) {
88255
88331
  const match = /\{[\s\S]*\}/.exec(text);
@@ -88367,7 +88443,7 @@ async function judgeRelevance(deps, input) {
88367
88443
  deps.removeDir(dir);
88368
88444
  }
88369
88445
  }
88370
- var import_node_path15, MAX_CHANGE_CHARS2, MAX_ITEMS_CHARS, QUERY_CHARS, TERMS, clip2, COMMON, said;
88446
+ var import_node_path15, MAX_CHANGE_CHARS2, MAX_ITEMS_CHARS, QUERY_CHARS, TERMS, clip2, COMMON, MAX_RECALL_HINTS, MAX_HINT_CHARS, IDENTIFIER, said;
88371
88447
  var init_replay_relevance = __esm({
88372
88448
  "src/commands/replay-relevance.ts"() {
88373
88449
  "use strict";
@@ -88383,6 +88459,9 @@ var init_replay_relevance = __esm({
88383
88459
  COMMON = new Set(
88384
88460
  "this that with from have will when then than they them their there what which while where return const function export import class true false null undefined async await string number value values type types test tests expect should data item items list name names error errors".split(" ")
88385
88461
  );
88462
+ MAX_RECALL_HINTS = 10;
88463
+ MAX_HINT_CHARS = 300;
88464
+ IDENTIFIER = /[A-Za-z_$][A-Za-z0-9_$]{3,}/g;
88386
88465
  said = (v) => typeof v === "string" && v.trim() !== "";
88387
88466
  }
88388
88467
  });
@@ -89261,6 +89340,15 @@ var init_replay_spec_gaps = __esm({
89261
89340
  });
89262
89341
 
89263
89342
  // src/commands/replay-recurring.ts
89343
+ function errorKeyOf(output) {
89344
+ for (const line of output.split("\n")) {
89345
+ const m = /\b\w*(?:Error|Exception)\b:?\s*(.+)$/.exec(line) ?? /\b(expected .+)$/i.exec(line);
89346
+ if (!m) continue;
89347
+ const key = m[1].toLowerCase().replace(/(["'`])(?:(?!\1).)*\1/g, "_").replace(/\d+/g, "#").replace(/\s+/g, " ").trim().slice(0, 80);
89348
+ if (key.replace(/[_#\s]/g, "").length >= 12) return key;
89349
+ }
89350
+ return null;
89351
+ }
89264
89352
  function commitTimeOf(run3) {
89265
89353
  const seen = /* @__PURE__ */ new Map();
89266
89354
  return (sha) => {
@@ -89285,11 +89373,15 @@ async function recurringFailures(tasks, committedAt) {
89285
89373
  const start = t.startsAt ? Date.parse(t.startsAt) : NaN;
89286
89374
  if (!Number.isFinite(start)) continue;
89287
89375
  const mine = new Set(t.failing.tests);
89376
+ const myFiles = new Set(t.failing.tests.map(fileOf));
89377
+ const myError = errorKeyOf(t.failing.output);
89288
89378
  const earlier = [];
89289
89379
  for (const e of bugs) {
89290
89380
  if (e.taskId === t.taskId || e.repository !== t.repository) continue;
89291
89381
  if (e.processId && e.processId === t.processId) continue;
89292
- if (!e.failing.tests.some((name) => mine.has(name))) continue;
89382
+ const sameTest = e.failing.tests.some((name) => mine.has(name));
89383
+ const sameFileAndError = myError !== null && e.failing.tests.some((name) => myFiles.has(fileOf(name))) && errorKeyOf(e.failing.output) === myError;
89384
+ if (!sameTest && !sameFileAndError) continue;
89293
89385
  const fixed = await committedAt(e.targetSha);
89294
89386
  if (fixed !== null && fixed < start) earlier.push(e.taskId);
89295
89387
  }
@@ -89298,10 +89390,14 @@ async function recurringFailures(tasks, committedAt) {
89298
89390
  }
89299
89391
  return out;
89300
89392
  }
89301
- var MAX_RECURRING, SHA2;
89393
+ var fileOf, MAX_RECURRING, SHA2;
89302
89394
  var init_replay_recurring = __esm({
89303
89395
  "src/commands/replay-recurring.ts"() {
89304
89396
  "use strict";
89397
+ fileOf = (test) => {
89398
+ const i = test.indexOf(" \u203A ");
89399
+ return i < 0 ? test : test.slice(0, i);
89400
+ };
89305
89401
  MAX_RECURRING = 20;
89306
89402
  SHA2 = /^[0-9a-f]{40}$/i;
89307
89403
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haansi",
3
- "version": "0.1.121",
3
+ "version": "0.1.123",
4
4
  "description": "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
5
5
  "bin": {
6
6
  "haansi": "./dist/haansi.js"