haansi 0.1.123 → 0.1.125

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 +43 -28
  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.123",
98
+ version: "0.1.125",
99
99
  description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
100
100
  bin: {
101
101
  haansi: "./dist/haansi.js"
@@ -19508,6 +19508,10 @@ var init_exclusions = __esm({
19508
19508
  diff_state: [
19509
19509
  "operational",
19510
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)."
19511
19515
  ]
19512
19516
  }),
19513
19517
  ...exchangeExclusions(INTEL, "stored_replay_tasks", {
@@ -26283,7 +26287,7 @@ var init_change_text = __esm({
26283
26287
  });
26284
26288
 
26285
26289
  // ../../packages/@company/db/src/org-purge.ts
26286
- var observability5;
26290
+ var observability5, PURGE_STATEMENT_TIMEOUT_MS;
26287
26291
  var init_org_purge = __esm({
26288
26292
  "../../packages/@company/db/src/org-purge.ts"() {
26289
26293
  "use strict";
@@ -26292,6 +26296,7 @@ var init_org_purge = __esm({
26292
26296
  init_client();
26293
26297
  init_org_context();
26294
26298
  observability5 = createObservabilityService("org-purge");
26299
+ PURGE_STATEMENT_TIMEOUT_MS = 5 * 6e4;
26295
26300
  }
26296
26301
  });
26297
26302
 
@@ -28707,6 +28712,22 @@ var init_entrypoint = __esm({
28707
28712
  }
28708
28713
  });
28709
28714
 
28715
+ // ../service-capture/agent-sessions/session-branch.ts
28716
+ function sessionGitBranch(sessionBranch, readHead) {
28717
+ const own = sessionBranch?.trim();
28718
+ if (own && own !== "HEAD") return own;
28719
+ try {
28720
+ return readHead() || null;
28721
+ } catch {
28722
+ return null;
28723
+ }
28724
+ }
28725
+ var init_session_branch = __esm({
28726
+ "../service-capture/agent-sessions/session-branch.ts"() {
28727
+ "use strict";
28728
+ }
28729
+ });
28730
+
28710
28731
  // ../service-capture/agent-sessions/collector.ts
28711
28732
  var collector_exports = {};
28712
28733
  __export(collector_exports, {
@@ -28867,13 +28888,10 @@ function extractGitInfo(projectDir, sessionTimestamp, sessionBranch) {
28867
28888
  } catch {
28868
28889
  }
28869
28890
  }
28870
- try {
28871
- result.gitBranch = git(["rev-parse", "--abbrev-ref", "HEAD"]) || null;
28872
- } catch {
28873
- }
28874
- if (!result.gitBranch && sessionBranch) {
28875
- result.gitBranch = sessionBranch;
28876
- }
28891
+ result.gitBranch = sessionGitBranch(
28892
+ sessionBranch,
28893
+ () => git(["rev-parse", "--abbrev-ref", "HEAD"])
28894
+ );
28877
28895
  return result;
28878
28896
  }
28879
28897
  function resolveToken2() {
@@ -29281,6 +29299,7 @@ var init_collector = __esm({
29281
29299
  init_agents();
29282
29300
  init_session_parts();
29283
29301
  init_entrypoint();
29302
+ init_session_branch();
29284
29303
  (0, import_dotenv.config)({ path: (0, import_path3.resolve)(__dirname, "../../../.env") });
29285
29304
  logger5 = createLogger("session-collector");
29286
29305
  DEFAULT_API_URL2 = SERVICE_URL_DEFAULTS.haansiApiBaseUrl;
@@ -89798,11 +89817,10 @@ function storedScoreOf(task) {
89798
89817
  nearby: task.context?.nearby ?? 0
89799
89818
  };
89800
89819
  }
89801
- function gateTierOf(state, score, recurring = 0) {
89820
+ function gateTierOf(state, recurring = 0) {
89802
89821
  if (state === "found") return "found";
89803
89822
  if (state === "missed") return "missed";
89804
89823
  if (state === "none" && recurring > 0) return "recurring";
89805
- if (state === "none" && score.nearby > 0) return "nearby";
89806
89824
  return null;
89807
89825
  }
89808
89826
  function rankFound(tasks, scoreOf, tierOf = () => "found") {
@@ -90034,18 +90052,15 @@ async function gateOnContext(deps, tasks, options) {
90034
90052
  const scoreOf = (t) => scores.get(t.taskId) ?? { onPoint: 0, nearby: 0 };
90035
90053
  const tiers = /* @__PURE__ */ new Map();
90036
90054
  let noContext = 0;
90055
+ let nearby = 0;
90037
90056
  let unknown2 = 0;
90038
90057
  for (const t of tasks) {
90039
90058
  const label = t.name ?? t.taskKey;
90040
90059
  const s = states.get(t.taskId);
90041
- const tier = gateTierOf(s, scoreOf(t), recurringOf(t).length);
90060
+ const tier = gateTierOf(s, recurringOf(t).length);
90042
90061
  if (tier) {
90043
90062
  tiers.set(t.taskId, tier);
90044
- if (tier === "nearby")
90045
- deps.log(
90046
- `nearby ${label}: no on-point context, ${scoreOf(t).nearby} nearby item(s): replayed, read apart`
90047
- );
90048
- else if (tier === "missed")
90063
+ if (tier === "missed")
90049
90064
  deps.log(
90050
90065
  `missed ${label}: Haansi holds an on-point item its search did not return: replayed as decisive`
90051
90066
  );
@@ -90053,6 +90068,11 @@ async function gateOnContext(deps, tasks, options) {
90053
90068
  deps.log(
90054
90069
  `recurring ${label}: ${recurringOf(t).length} earlier bug fix(es) failed the same test and were fixed before it began: replayed as decisive`
90055
90070
  );
90071
+ } else if (s === "none" && scoreOf(t).nearby > 0) {
90072
+ nearby += 1;
90073
+ deps.log(
90074
+ `skip ${label}: nothing on point, ${scoreOf(t).nearby} nearby item(s) only: its arms would tell nothing`
90075
+ );
90056
90076
  } else if (s === "none") {
90057
90077
  noContext += 1;
90058
90078
  deps.log(
@@ -90068,7 +90088,7 @@ async function gateOnContext(deps, tasks, options) {
90068
90088
  const count4 = (tier) => replay2.filter((t) => tiers.get(t.taskId) === tier).length;
90069
90089
  return {
90070
90090
  replay: replay2,
90071
- nearby: count4("nearby"),
90091
+ nearby,
90072
90092
  missed: count4("missed"),
90073
90093
  recurring: count4("recurring"),
90074
90094
  noContext,
@@ -90076,11 +90096,7 @@ async function gateOnContext(deps, tasks, options) {
90076
90096
  };
90077
90097
  }
90078
90098
  function fromChecks(tasks, limit, shard) {
90079
- const tierOf = (t) => gateTierOf(
90080
- t.context?.state,
90081
- storedScoreOf(t),
90082
- t.context?.recurringIds?.length ?? 0
90083
- );
90099
+ const tierOf = (t) => gateTierOf(t.context?.state, t.context?.recurringIds?.length ?? 0);
90084
90100
  const ready = tasks.filter(
90085
90101
  (t) => !needsCheck(t) && tierOf(t) !== null && t.calibration?.state === "valid" && t.calibration.inputsFingerprint === t.inputsFingerprint
90086
90102
  );
@@ -90101,8 +90117,7 @@ var init_replay_context = __esm({
90101
90117
  TIER_ORDER = {
90102
90118
  found: 0,
90103
90119
  missed: 1,
90104
- recurring: 2,
90105
- nearby: 3
90120
+ recurring: 2
90106
90121
  };
90107
90122
  QUERY_CHARS2 = 300;
90108
90123
  ERROR_CHARS = 1e3;
@@ -90657,7 +90672,7 @@ async function runStoredReplays(options, deps) {
90657
90672
  }
90658
90673
  if (options.checkOnly) {
90659
90674
  deps.log(
90660
- `Checked: ${gated.length - nearby - missed - recurringCount} found \xB7 ${missed} missed \xB7 ${recurringCount} recurring \xB7 ${nearby} nearby \xB7 ${noContext} with no on-point or nearby context \xB7 ${contextUnknown} unknown \xB7 ${notValid} not valid.`
90675
+ `Checked: ${gated.length - missed - recurringCount} found \xB7 ${missed} missed \xB7 ${recurringCount} recurring \xB7 ${nearby} nearby \xB7 ${noContext} with no on-point or nearby context \xB7 ${contextUnknown} unknown \xB7 ${notValid} not valid.`
90661
90676
  );
90662
90677
  return {
90663
90678
  results: [],
@@ -90918,7 +90933,7 @@ async function runStoredReplays(options, deps) {
90918
90933
  task: label,
90919
90934
  taskId: task.taskId,
90920
90935
  kind: task.kind,
90921
- tier: gateTierOf(task.context?.state, storedScoreOf(task)),
90936
+ tier: gateTierOf(task.context?.state),
90922
90937
  arm,
90923
90938
  passed,
90924
90939
  attempts: r.attempts,
@@ -91632,7 +91647,7 @@ async function replayStored(options, token2, apiUrl2) {
91632
91647
  if (options.checkOnly) {
91633
91648
  console.log(
91634
91649
  `
91635
- Context checked: ${(found ?? 0) - (nearby ?? 0) - (missed ?? 0)} task(s) found \xB7 ${missed ?? 0} missed (on point, not returned) \xB7 ${nearby ?? 0} with nearby context only \xB7 ${noContext ?? 0} with no on-point or nearby context${contextUnknown ? ` \xB7 ${contextUnknown} could not be checked` : ""} \xB7 ${notValid} not valid to replay`
91650
+ Context checked: ${(found ?? 0) - (missed ?? 0)} task(s) to replay (${missed ?? 0} of them missed: on point, not returned) \xB7 ${nearby ?? 0} skipped with nearby items only \xB7 ${noContext ?? 0} with no on-point or nearby context${contextUnknown ? ` \xB7 ${contextUnknown} could not be checked` : ""} \xB7 ${notValid} not valid to replay`
91636
91651
  );
91637
91652
  return;
91638
91653
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haansi",
3
- "version": "0.1.123",
3
+ "version": "0.1.125",
4
4
  "description": "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
5
5
  "bin": {
6
6
  "haansi": "./dist/haansi.js"