haansi 0.1.122 → 0.1.124

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 +76 -11
  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.122",
98
+ version: "0.1.124",
99
99
  description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
100
100
  bin: {
101
101
  haansi: "./dist/haansi.js"
@@ -19496,6 +19496,22 @@ var init_exclusions = __esm({
19496
19496
  dir_blinds: [
19497
19497
  "derived",
19498
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
+ diff_reason: [
19513
+ "operational",
19514
+ "Closed CHECK vocabulary (no_source, no_token, not_in_change, refused)."
19499
19515
  ]
19500
19516
  }),
19501
19517
  ...exchangeExclusions(INTEL, "stored_replay_tasks", {
@@ -26259,6 +26275,17 @@ var init_change_paths = __esm({
26259
26275
  }
26260
26276
  });
26261
26277
 
26278
+ // ../../packages/@company/db/src/change-text.ts
26279
+ var KEYWORDS;
26280
+ var init_change_text = __esm({
26281
+ "../../packages/@company/db/src/change-text.ts"() {
26282
+ "use strict";
26283
+ KEYWORDS = new Set(
26284
+ "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(" ")
26285
+ );
26286
+ }
26287
+ });
26288
+
26262
26289
  // ../../packages/@company/db/src/org-purge.ts
26263
26290
  var observability5;
26264
26291
  var init_org_purge = __esm({
@@ -28139,6 +28166,7 @@ var init_src6 = __esm({
28139
28166
  init_search_vector_write();
28140
28167
  init_keyword_terms();
28141
28168
  init_change_paths();
28169
+ init_change_text();
28142
28170
  init_org_purge();
28143
28171
  init_org_orphan_scan();
28144
28172
  init_integration_purge();
@@ -28683,6 +28711,22 @@ var init_entrypoint = __esm({
28683
28711
  }
28684
28712
  });
28685
28713
 
28714
+ // ../service-capture/agent-sessions/session-branch.ts
28715
+ function sessionGitBranch(sessionBranch, readHead) {
28716
+ const own = sessionBranch?.trim();
28717
+ if (own && own !== "HEAD") return own;
28718
+ try {
28719
+ return readHead() || null;
28720
+ } catch {
28721
+ return null;
28722
+ }
28723
+ }
28724
+ var init_session_branch = __esm({
28725
+ "../service-capture/agent-sessions/session-branch.ts"() {
28726
+ "use strict";
28727
+ }
28728
+ });
28729
+
28686
28730
  // ../service-capture/agent-sessions/collector.ts
28687
28731
  var collector_exports = {};
28688
28732
  __export(collector_exports, {
@@ -28843,13 +28887,10 @@ function extractGitInfo(projectDir, sessionTimestamp, sessionBranch) {
28843
28887
  } catch {
28844
28888
  }
28845
28889
  }
28846
- try {
28847
- result.gitBranch = git(["rev-parse", "--abbrev-ref", "HEAD"]) || null;
28848
- } catch {
28849
- }
28850
- if (!result.gitBranch && sessionBranch) {
28851
- result.gitBranch = sessionBranch;
28852
- }
28890
+ result.gitBranch = sessionGitBranch(
28891
+ sessionBranch,
28892
+ () => git(["rev-parse", "--abbrev-ref", "HEAD"])
28893
+ );
28853
28894
  return result;
28854
28895
  }
28855
28896
  function resolveToken2() {
@@ -29257,6 +29298,7 @@ var init_collector = __esm({
29257
29298
  init_agents();
29258
29299
  init_session_parts();
29259
29300
  init_entrypoint();
29301
+ init_session_branch();
29260
29302
  (0, import_dotenv.config)({ path: (0, import_path3.resolve)(__dirname, "../../../.env") });
29261
29303
  logger5 = createLogger("session-collector");
29262
29304
  DEFAULT_API_URL2 = SERVICE_URL_DEFAULTS.haansiApiBaseUrl;
@@ -60344,7 +60386,7 @@ function searchSolutionsTool(contextSchema2) {
60344
60386
  "Optional. File (or folder) paths you changed (or will change), or that the failure runs through"
60345
60387
  ),
60346
60388
  names: stringList(
60347
- "Optional. Identifiers involved: functions, classes, routes, config keys"
60389
+ "Optional. Identifiers involved: functions, classes, routes, config keys (matched against the code past fixes changed)"
60348
60390
  ),
60349
60391
  _context: contextSchema2
60350
60392
  },
@@ -88281,7 +88323,27 @@ function recallAsk(problem, targetDiff, targetFiles) {
88281
88323
  terms.join(" "),
88282
88324
  files.join(" ")
88283
88325
  ].map((q) => q.slice(0, QUERY_CHARS).trim()).filter((q, i, all) => q !== "" && all.indexOf(q) === i);
88284
- return { task: problem.slice(0, 1e3), error: null, queries };
88326
+ const idCounts = /* @__PURE__ */ new Map();
88327
+ for (const line of targetDiff.split("\n"))
88328
+ if (line.startsWith("+") && !line.startsWith("+++")) {
88329
+ for (const id of line.slice(1).match(IDENTIFIER) ?? [])
88330
+ if (/[a-z][A-Z]|_/.test(id) && !COMMON.has(id.toLowerCase()))
88331
+ idCounts.set(id, (idCounts.get(id) ?? 0) + 1);
88332
+ }
88333
+ 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));
88334
+ const paths = [...new Set(targetFiles)].filter((p) => p.length <= MAX_HINT_CHARS).slice(0, MAX_RECALL_HINTS);
88335
+ return {
88336
+ task: problem.slice(0, 1e3),
88337
+ error: null,
88338
+ queries,
88339
+ ...paths.length ? { paths } : {},
88340
+ ...paths.length || names.length ? {
88341
+ hints: {
88342
+ ...paths.length ? { files: paths } : {},
88343
+ ...names.length ? { names } : {}
88344
+ }
88345
+ } : {}
88346
+ };
88285
88347
  }
88286
88348
  function parseRelevance(text, shown) {
88287
88349
  const match = /\{[\s\S]*\}/.exec(text);
@@ -88399,7 +88461,7 @@ async function judgeRelevance(deps, input) {
88399
88461
  deps.removeDir(dir);
88400
88462
  }
88401
88463
  }
88402
- var import_node_path15, MAX_CHANGE_CHARS2, MAX_ITEMS_CHARS, QUERY_CHARS, TERMS, clip2, COMMON, said;
88464
+ var import_node_path15, MAX_CHANGE_CHARS2, MAX_ITEMS_CHARS, QUERY_CHARS, TERMS, clip2, COMMON, MAX_RECALL_HINTS, MAX_HINT_CHARS, IDENTIFIER, said;
88403
88465
  var init_replay_relevance = __esm({
88404
88466
  "src/commands/replay-relevance.ts"() {
88405
88467
  "use strict";
@@ -88415,6 +88477,9 @@ var init_replay_relevance = __esm({
88415
88477
  COMMON = new Set(
88416
88478
  "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(" ")
88417
88479
  );
88480
+ MAX_RECALL_HINTS = 10;
88481
+ MAX_HINT_CHARS = 300;
88482
+ IDENTIFIER = /[A-Za-z_$][A-Za-z0-9_$]{3,}/g;
88418
88483
  said = (v) => typeof v === "string" && v.trim() !== "";
88419
88484
  }
88420
88485
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haansi",
3
- "version": "0.1.122",
3
+ "version": "0.1.124",
4
4
  "description": "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
5
5
  "bin": {
6
6
  "haansi": "./dist/haansi.js"