haansi 0.1.96 → 0.1.98

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 +215 -39
  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.96",
98
+ version: "0.1.98",
99
99
  description: "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
100
100
  bin: {
101
101
  haansi: "./dist/haansi.js"
@@ -48267,8 +48267,8 @@ var require_resolve = __commonJS({
48267
48267
  }
48268
48268
  return count4;
48269
48269
  }
48270
- function getFullPath(resolver, id = "", normalize) {
48271
- if (normalize !== false)
48270
+ function getFullPath(resolver, id = "", normalize2) {
48271
+ if (normalize2 !== false)
48272
48272
  id = normalizeId(id);
48273
48273
  const p = resolver.parse(id);
48274
48274
  return _getFullPath(resolver, p);
@@ -49608,7 +49608,7 @@ var require_fast_uri = __commonJS({
49608
49608
  "use strict";
49609
49609
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils5();
49610
49610
  var { SCHEMES, getSchemeHandler } = require_schemes();
49611
- function normalize(uri, options) {
49611
+ function normalize2(uri, options) {
49612
49612
  if (typeof uri === "string") {
49613
49613
  uri = /** @type {T} */
49614
49614
  serialize(parse4(uri, options), options);
@@ -49844,7 +49844,7 @@ var require_fast_uri = __commonJS({
49844
49844
  }
49845
49845
  var fastUri = {
49846
49846
  SCHEMES,
49847
- normalize,
49847
+ normalize: normalize2,
49848
49848
  resolve: resolve5,
49849
49849
  resolveComponent,
49850
49850
  equal,
@@ -54887,8 +54887,8 @@ var require_resolve2 = __commonJS({
54887
54887
  }
54888
54888
  return count4;
54889
54889
  }
54890
- function getFullPath(resolver, id = "", normalize) {
54891
- if (normalize !== false)
54890
+ function getFullPath(resolver, id = "", normalize2) {
54891
+ if (normalize2 !== false)
54892
54892
  id = normalizeId(id);
54893
54893
  const p = resolver.parse(id);
54894
54894
  return _getFullPath(resolver, p);
@@ -74755,7 +74755,7 @@ var require_type_is = __commonJS({
74755
74755
  module2.exports = typeofrequest;
74756
74756
  module2.exports.is = typeis;
74757
74757
  module2.exports.hasBody = hasbody;
74758
- module2.exports.normalize = normalize;
74758
+ module2.exports.normalize = normalize2;
74759
74759
  module2.exports.match = mimeMatch;
74760
74760
  function typeis(value, types_) {
74761
74761
  var i;
@@ -74775,7 +74775,7 @@ var require_type_is = __commonJS({
74775
74775
  }
74776
74776
  var type;
74777
74777
  for (i = 0; i < types2.length; i++) {
74778
- if (mimeMatch(normalize(type = types2[i]), val)) {
74778
+ if (mimeMatch(normalize2(type = types2[i]), val)) {
74779
74779
  return type[0] === "+" || type.indexOf("*") !== -1 ? val : type;
74780
74780
  }
74781
74781
  }
@@ -74790,7 +74790,7 @@ var require_type_is = __commonJS({
74790
74790
  var value = req.headers["content-type"];
74791
74791
  return typeis(value, types2);
74792
74792
  }
74793
- function normalize(type) {
74793
+ function normalize2(type) {
74794
74794
  if (typeof type !== "string") {
74795
74795
  return false;
74796
74796
  }
@@ -78070,10 +78070,10 @@ var require_view = __commonJS({
78070
78070
  var debug = require_src()("express:view");
78071
78071
  var path2 = require("node:path");
78072
78072
  var fs = require("node:fs");
78073
- var dirname5 = path2.dirname;
78073
+ var dirname6 = path2.dirname;
78074
78074
  var basename4 = path2.basename;
78075
78075
  var extname = path2.extname;
78076
- var join21 = path2.join;
78076
+ var join22 = path2.join;
78077
78077
  var resolve5 = path2.resolve;
78078
78078
  module2.exports = View;
78079
78079
  function View(name, options) {
@@ -78109,7 +78109,7 @@ var require_view = __commonJS({
78109
78109
  for (var i = 0; i < roots.length && !path3; i++) {
78110
78110
  var root = roots[i];
78111
78111
  var loc = resolve5(root, name);
78112
- var dir = dirname5(loc);
78112
+ var dir = dirname6(loc);
78113
78113
  var file2 = basename4(loc);
78114
78114
  path3 = this.resolve(dir, file2);
78115
78115
  }
@@ -78135,12 +78135,12 @@ var require_view = __commonJS({
78135
78135
  };
78136
78136
  View.prototype.resolve = function resolve6(dir, file2) {
78137
78137
  var ext = this.ext;
78138
- var path3 = join21(dir, file2);
78138
+ var path3 = join22(dir, file2);
78139
78139
  var stat = tryStat(path3);
78140
78140
  if (stat && stat.isFile()) {
78141
78141
  return path3;
78142
78142
  }
78143
- path3 = join21(dir, basename4(file2, ext), "index" + ext);
78143
+ path3 = join22(dir, basename4(file2, ext), "index" + ext);
78144
78144
  stat = tryStat(path3);
78145
78145
  if (stat && stat.isFile()) {
78146
78146
  return path3;
@@ -81785,8 +81785,8 @@ var require_send = __commonJS({
81785
81785
  var Stream = require("stream");
81786
81786
  var util2 = require("util");
81787
81787
  var extname = path2.extname;
81788
- var join21 = path2.join;
81789
- var normalize = path2.normalize;
81788
+ var join22 = path2.join;
81789
+ var normalize2 = path2.normalize;
81790
81790
  var resolve5 = path2.resolve;
81791
81791
  var sep3 = path2.sep;
81792
81792
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
@@ -81949,7 +81949,7 @@ var require_send = __commonJS({
81949
81949
  var parts;
81950
81950
  if (root !== null) {
81951
81951
  if (path3) {
81952
- path3 = normalize("." + sep3 + path3);
81952
+ path3 = normalize2("." + sep3 + path3);
81953
81953
  }
81954
81954
  if (UP_PATH_REGEXP.test(path3)) {
81955
81955
  debug('malicious path "%s"', path3);
@@ -81957,14 +81957,14 @@ var require_send = __commonJS({
81957
81957
  return res;
81958
81958
  }
81959
81959
  parts = path3.split(sep3);
81960
- path3 = normalize(join21(root, path3));
81960
+ path3 = normalize2(join22(root, path3));
81961
81961
  } else {
81962
81962
  if (UP_PATH_REGEXP.test(path3)) {
81963
81963
  debug('malicious path "%s"', path3);
81964
81964
  this.error(403);
81965
81965
  return res;
81966
81966
  }
81967
- parts = normalize(path3).split(sep3);
81967
+ parts = normalize2(path3).split(sep3);
81968
81968
  path3 = resolve5(path3);
81969
81969
  }
81970
81970
  if (containsDotFile(parts)) {
@@ -82090,7 +82090,7 @@ var require_send = __commonJS({
82090
82090
  if (err2) return self.onStatError(err2);
82091
82091
  return self.error(404);
82092
82092
  }
82093
- var p = join21(path3, self._index[i]);
82093
+ var p = join22(path3, self._index[i]);
82094
82094
  debug('stat "%s"', p);
82095
82095
  fs.stat(p, function(err3, stat) {
82096
82096
  if (err3) return next(err3);
@@ -86676,7 +86676,30 @@ function usageOf(output) {
86676
86676
  }
86677
86677
  return NONE;
86678
86678
  }
86679
- var NONE, count2;
86679
+ function modelUnreachableOf(output, exitCode) {
86680
+ if (exitCode === 0) return null;
86681
+ const used = usageOf(output);
86682
+ if ((used.outputTokens ?? 0) > 0) return null;
86683
+ const objects = jsonLines(output);
86684
+ const result = [...objects].reverse().find((o) => o.type === "result");
86685
+ if (result && result.is_error === true) {
86686
+ const said = typeof result.result === "string" ? result.result : "";
86687
+ if (result.terminal_reason === "api_error" || MODEL_REFUSAL.test(said))
86688
+ return clipReason(said || "the model's API returned an error");
86689
+ }
86690
+ for (const o of [...objects].reverse()) {
86691
+ const message = typeof o.message === "string" ? o.message : typeof o.error?.message === "string" ? String(o.error.message) : "";
86692
+ if ((o.type === "error" || o.type === "turn.failed") && MODEL_REFUSAL.test(message))
86693
+ return clipReason(message);
86694
+ }
86695
+ const line = output.split(/\r?\n/).reverse().find((l) => MODEL_REFUSAL.test(l) && !l.trim().startsWith("{"));
86696
+ return line ? clipReason(line) : null;
86697
+ }
86698
+ function clipReason(text) {
86699
+ const t = text.replace(/\s+/g, " ").trim();
86700
+ return t.length > MAX_REASON_CHARS ? `${t.slice(0, MAX_REASON_CHARS - 1)}\u2026` : t;
86701
+ }
86702
+ var NONE, count2, MODEL_REFUSAL, MAX_REASON_CHARS;
86680
86703
  var init_replay_usage = __esm({
86681
86704
  "src/commands/replay-usage.ts"() {
86682
86705
  "use strict";
@@ -86688,6 +86711,8 @@ var init_replay_usage = __esm({
86688
86711
  turns: null
86689
86712
  };
86690
86713
  count2 = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
86714
+ MODEL_REFUSAL = /credit balance is too low|insufficient[_ ](?:credit|quota|balance|funds)|quota (?:exceeded|exhausted)|exceeded your (?:current )?quota|invalid (?:x-)?api[_ -]?key|authentication[_ ]error|rate[_ ]limit(?:_error| exceeded| reached)|overloaded[_ ]error|api[_ ]error/i;
86715
+ MAX_REASON_CHARS = 200;
86691
86716
  }
86692
86717
  });
86693
86718
 
@@ -87818,6 +87843,139 @@ var init_replay_relevance = __esm({
87818
87843
  }
87819
87844
  });
87820
87845
 
87846
+ // src/commands/replay-interface.ts
87847
+ function importsOf(source) {
87848
+ const text = stripComments(source);
87849
+ const out = /* @__PURE__ */ new Map();
87850
+ const re = /\bimport\s+(?:type\s+)?([\w$]+\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+[\w$]+)?\s*from\s*["']([^"']+)["']/g;
87851
+ let m;
87852
+ while (m = re.exec(text)) {
87853
+ const spec2 = m[3];
87854
+ if (!spec2.startsWith(".")) continue;
87855
+ const entry2 = out.get(spec2) ?? { spec: spec2, names: [], defaultImport: false };
87856
+ const head = (m[1] ?? "").replace(/,/g, "").trim();
87857
+ if (head && head !== "type" && IDENT.test(head)) entry2.defaultImport = true;
87858
+ for (const part of (m[2] ?? "").split(",")) {
87859
+ const name = part.trim().replace(/^type\s+/, "").split(/\s+as\s+/)[0].trim();
87860
+ if (name === "default") entry2.defaultImport = true;
87861
+ else if (IDENT.test(name) && !entry2.names.includes(name))
87862
+ entry2.names.push(name);
87863
+ }
87864
+ out.set(spec2, entry2);
87865
+ }
87866
+ return [...out.values()];
87867
+ }
87868
+ function exportsName(source, name) {
87869
+ const text = stripComments(source);
87870
+ if (/\bexport\s+\*\s+from\b/.test(text)) return true;
87871
+ const n = name.replace(/\$/g, "\\$");
87872
+ if (new RegExp(
87873
+ `\\bexport\\s+(?:declare\\s+)?(?:default\\s+)?(?:async\\s+)?(?:abstract\\s+)?(?:function\\*?|const|let|var|class|interface|type|enum|namespace)\\s+${n}\\b`
87874
+ ).test(text))
87875
+ return true;
87876
+ const lists = text.matchAll(/\bexport\s+(?:type\s+)?\{([^}]*)\}/g);
87877
+ for (const list2 of lists)
87878
+ for (const part of list2[1].split(",")) {
87879
+ const exported = part.trim().split(/\s+as\s+/);
87880
+ const as = (exported[1] ?? exported[0]).replace(/^type\s+/, "").trim();
87881
+ if (as === name) return true;
87882
+ }
87883
+ return false;
87884
+ }
87885
+ function hasDefaultExport(source) {
87886
+ const text = stripComments(source);
87887
+ return /\bexport\s+default\b/.test(text) || /\bexport\s*\{[^}]*\bas\s+default\b/.test(text) || // CommonJS: what a default import of it receives.
87888
+ /\bmodule\.exports\s*=/.test(text);
87889
+ }
87890
+ function candidatesFor(fromFile, spec2) {
87891
+ const base = (0, import_node_path15.normalize)((0, import_node_path15.join)((0, import_node_path15.dirname)(fromFile), spec2)).replace(/\\/g, "/");
87892
+ if (base.startsWith("..")) return [];
87893
+ const stem2 = base.replace(/\.(?:[cm]?js|jsx)$/, "");
87894
+ const withExt = /\.[cm]?[jt]sx?$/.test(base) ? [base] : [];
87895
+ return [
87896
+ ...withExt,
87897
+ ...EXTENSIONS.map((e) => `${stem2}${e}`),
87898
+ ...EXTENSIONS.map((e) => `${stem2}/index${e}`)
87899
+ ].filter((p, i, all) => all.indexOf(p) === i);
87900
+ }
87901
+ async function firstAt(show, sha, paths) {
87902
+ for (const path2 of paths) {
87903
+ const source = await show(sha, path2);
87904
+ if (source !== null) return { path: path2, source };
87905
+ }
87906
+ return null;
87907
+ }
87908
+ async function testInterfaceOf(show, task) {
87909
+ const tests = new Set(task.testFiles);
87910
+ const byPath = /* @__PURE__ */ new Map();
87911
+ for (const file2 of task.testFiles) {
87912
+ if (!JS_TEST.test(file2)) continue;
87913
+ const source = await show(task.targetSha, file2);
87914
+ if (source === null) continue;
87915
+ for (const imp of importsOf(source)) {
87916
+ const candidates = candidatesFor(file2, imp.spec);
87917
+ const atTarget = await firstAt(show, task.targetSha, candidates);
87918
+ if (!atTarget || tests.has(atTarget.path)) continue;
87919
+ if (/(^|\/)(__tests__|__mocks__|__fixtures__|fixtures?|test-utils?)\//.test(
87920
+ atTarget.path
87921
+ ))
87922
+ continue;
87923
+ const atBase = await show(task.baseSha, atTarget.path);
87924
+ const names = imp.names.filter(
87925
+ (n) => atBase === null || !exportsName(atBase, n)
87926
+ );
87927
+ const defaultExport = imp.defaultImport && (atBase === null || !hasDefaultExport(atBase));
87928
+ if (atBase !== null && names.length === 0 && !defaultExport) continue;
87929
+ const entry2 = byPath.get(atTarget.path) ?? {
87930
+ path: atTarget.path,
87931
+ newFile: atBase === null,
87932
+ names: [],
87933
+ defaultExport: false
87934
+ };
87935
+ for (const n of names) if (!entry2.names.includes(n)) entry2.names.push(n);
87936
+ entry2.defaultExport ||= defaultExport;
87937
+ byPath.set(atTarget.path, entry2);
87938
+ }
87939
+ }
87940
+ let budget = MAX_INTERFACE_NAMES;
87941
+ return [...byPath.values()].slice(0, MAX_INTERFACE_MODULES).map((e) => {
87942
+ const names = e.names.slice(0, Math.max(0, budget));
87943
+ budget -= names.length;
87944
+ return { ...e, names };
87945
+ });
87946
+ }
87947
+ function interfaceSection(entries) {
87948
+ if (entries.length === 0) return [];
87949
+ return [
87950
+ "## What the tests use",
87951
+ "",
87952
+ "The task's tests import these from the code, and they do not exist yet. Create them at these paths with these names; how they work is up to you.",
87953
+ "",
87954
+ ...entries.map((e) => {
87955
+ const what = [
87956
+ ...e.defaultExport ? ["a default export"] : [],
87957
+ ...e.names.map((n) => `\`${n}\``)
87958
+ ];
87959
+ const where = `\`${e.path}\`${e.newFile ? " (a new file)" : ""}`;
87960
+ return `- ${where}${what.length ? `: ${what.join(", ")}` : ""}`;
87961
+ }),
87962
+ ""
87963
+ ];
87964
+ }
87965
+ var import_node_path15, MAX_INTERFACE_MODULES, MAX_INTERFACE_NAMES, JS_TEST, EXTENSIONS, IDENT, stripComments;
87966
+ var init_replay_interface = __esm({
87967
+ "src/commands/replay-interface.ts"() {
87968
+ "use strict";
87969
+ import_node_path15 = require("node:path");
87970
+ MAX_INTERFACE_MODULES = 10;
87971
+ MAX_INTERFACE_NAMES = 30;
87972
+ JS_TEST = /\.[cm]?[jt]sx?$/;
87973
+ EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs"];
87974
+ IDENT = /^[A-Za-z_$][\w$]*$/;
87975
+ stripComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1");
87976
+ }
87977
+ });
87978
+
87821
87979
  // src/commands/replay-tasks.ts
87822
87980
  var replay_tasks_exports = {};
87823
87981
  __export(replay_tasks_exports, {
@@ -87911,6 +88069,7 @@ function cardPrompt(task, feedback, arm = "baseline", tools = []) {
87911
88069
  task.card.acceptance,
87912
88070
  ...task.card.area ? ["", "## Part of the code", "", task.card.area] : [],
87913
88071
  "",
88072
+ ...interfaceSection(task.testInterface ?? []),
87914
88073
  ...arm === "haansi" ? tools.length ? haansiSection(tools) : [HAANSI_LINE, ""] : [],
87915
88074
  ...feedback ? [FEEDBACK_HEADER, "", "```", feedback, "```", ""] : [],
87916
88075
  CODE_ONLY_LINE,
@@ -88092,6 +88251,17 @@ async function runStoredReplays(options, deps) {
88092
88251
  };
88093
88252
  const targetText = await referenceDiffOf(deps, task).catch(() => null);
88094
88253
  const targetChanges = targetText === null ? null : parseDiff(targetText);
88254
+ if (!asTask.testNames?.length && task.baseSha && task.targetSha) {
88255
+ task.testInterface = await testInterfaceOf(deps.showFile, {
88256
+ baseSha: task.baseSha,
88257
+ targetSha: task.targetSha,
88258
+ testFiles: task.testFiles
88259
+ }).catch(() => []);
88260
+ if (task.testInterface.length)
88261
+ deps.log(
88262
+ `\u2026 ${label}: the tests use ${task.testInterface.length} module(s) the start lacks; named in the prompt`
88263
+ );
88264
+ }
88095
88265
  let targetSent = false;
88096
88266
  for (const arm of arms) {
88097
88267
  if (!options.force && alreadyMeasured(
@@ -88300,6 +88470,7 @@ var init_replay_tasks = __esm({
88300
88470
  init_replay_judge();
88301
88471
  init_replay();
88302
88472
  init_replay_scale();
88473
+ init_replay_interface();
88303
88474
  FEEDBACK_HEADER = "Your previous attempt did not pass the tests. Their output ends with:";
88304
88475
  REPORT_CHUNK2 = 200;
88305
88476
  REPORT_CHARS = 4e6;
@@ -88471,7 +88642,7 @@ function cleanCheckout(deps, dir, task) {
88471
88642
  }
88472
88643
  async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv = {}) {
88473
88644
  const started = deps.now();
88474
- const dir = (0, import_node_path15.join)(
88645
+ const dir = (0, import_node_path16.join)(
88475
88646
  deps.workDir(),
88476
88647
  `${task.processId.replace(/[^a-zA-Z0-9_-]/g, "")}-${arm}`
88477
88648
  );
@@ -88500,7 +88671,7 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
88500
88671
  `\u2026 ${label}: set up in ${since(at)}${setup.cached ? " (from the setup cache)" : ""}`
88501
88672
  );
88502
88673
  }
88503
- const promptFile = (0, import_node_path15.join)(dir, ".haansi-replay", "prompt.md");
88674
+ const promptFile = (0, import_node_path16.join)(dir, ".haansi-replay", "prompt.md");
88504
88675
  let mcpConfigFile = agentEnv.HAANSI_REPLAY_MCP_CONFIG;
88505
88676
  if (!mcpConfigFile) {
88506
88677
  mcpConfigFile = `${dir}.mcp.json`;
@@ -88552,12 +88723,17 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
88552
88723
  for (const line of agent.output.trim().split("\n").slice(-FAILURE_LINES2))
88553
88724
  deps.log(` ${line}`);
88554
88725
  }
88726
+ const unreachable2 = modelUnreachableOf(agent.output, agent.code);
88727
+ if (unreachable2)
88728
+ throw new Error(
88729
+ `the agent could not reach its model (${unreachable2}); not graded, run it again`
88730
+ );
88555
88731
  const gradeSha = task.testNames?.length ? task.baseSha : task.targetSha;
88556
- const own = new Map(files.map((f) => [f, deps.readFile((0, import_node_path15.join)(dir, f))]));
88732
+ const own = new Map(files.map((f) => [f, deps.readFile((0, import_node_path16.join)(dir, f))]));
88557
88733
  for (const f of files) {
88558
88734
  const content = await deps.showFile(gradeSha, f);
88559
- if (content === null) deps.removeFile((0, import_node_path15.join)(dir, f));
88560
- else deps.writeFile((0, import_node_path15.join)(dir, f), content);
88735
+ if (content === null) deps.removeFile((0, import_node_path16.join)(dir, f));
88736
+ else deps.writeFile((0, import_node_path16.join)(dir, f), content);
88561
88737
  }
88562
88738
  const testAt = deps.now();
88563
88739
  deps.log(`\u2026 ${label}: agent done in ${since(agentAt)}, grading`);
@@ -88608,8 +88784,8 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
88608
88784
  }
88609
88785
  if (test.code === 0 && !guarded) {
88610
88786
  for (const [file2, content] of own) {
88611
- if (content === null) deps.removeFile((0, import_node_path15.join)(dir, file2));
88612
- else deps.writeFile((0, import_node_path15.join)(dir, file2), content);
88787
+ if (content === null) deps.removeFile((0, import_node_path16.join)(dir, file2));
88788
+ else deps.writeFile((0, import_node_path16.join)(dir, file2), content);
88613
88789
  }
88614
88790
  if (inspect) await inspect(dir);
88615
88791
  return {
@@ -88625,8 +88801,8 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
88625
88801
  };
88626
88802
  }
88627
88803
  for (const [file2, content] of own) {
88628
- if (content === null) deps.removeFile((0, import_node_path15.join)(dir, file2));
88629
- else deps.writeFile((0, import_node_path15.join)(dir, file2), content);
88804
+ if (content === null) deps.removeFile((0, import_node_path16.join)(dir, file2));
88805
+ else deps.writeFile((0, import_node_path16.join)(dir, file2), content);
88630
88806
  }
88631
88807
  feedback = guarded ? [
88632
88808
  GUARD_FEEDBACK,
@@ -88693,11 +88869,11 @@ function runCommand(file2, args, cwd, env, timeoutMs, stdoutOnly = false) {
88693
88869
  });
88694
88870
  }
88695
88871
  function dropLinks(work, path2) {
88696
- const rel = (0, import_node_path15.relative)(work, path2);
88697
- if (rel === "" || rel.startsWith("..") || (0, import_node_path15.isAbsolute)(rel)) return;
88872
+ const rel = (0, import_node_path16.relative)(work, path2);
88873
+ if (rel === "" || rel.startsWith("..") || (0, import_node_path16.isAbsolute)(rel)) return;
88698
88874
  let at = work;
88699
- for (const part of rel.split(import_node_path15.sep)) {
88700
- at = (0, import_node_path15.join)(at, part);
88875
+ for (const part of rel.split(import_node_path16.sep)) {
88876
+ at = (0, import_node_path16.join)(at, part);
88701
88877
  let link = false;
88702
88878
  try {
88703
88879
  link = (0, import_node_fs13.lstatSync)(at).isSymbolicLink();
@@ -88732,7 +88908,7 @@ function localDeps(work) {
88732
88908
  // dropLinks: with a container, nothing runs in it while these do.
88733
88909
  writeFile: (path2, content) => {
88734
88910
  dropLinks(work, path2);
88735
- (0, import_node_fs13.mkdirSync)((0, import_node_path15.dirname)(path2), { recursive: true });
88911
+ (0, import_node_fs13.mkdirSync)((0, import_node_path16.dirname)(path2), { recursive: true });
88736
88912
  const fd2 = (0, import_node_fs13.openSync)(
88737
88913
  path2,
88738
88914
  import_node_fs13.constants.O_WRONLY | import_node_fs13.constants.O_CREAT | import_node_fs13.constants.O_TRUNC | import_node_fs13.constants.O_NOFOLLOW
@@ -88793,7 +88969,7 @@ async function replay(argv) {
88793
88969
  async function replayStored(options, token2, apiUrl2) {
88794
88970
  const { runStoredReplays: runStoredReplays2 } = await Promise.resolve().then(() => (init_replay_tasks(), replay_tasks_exports));
88795
88971
  const { cliVersion: cliVersion2 } = await Promise.resolve().then(() => (init_replay_calibrate(), replay_calibrate_exports));
88796
- const work = (0, import_node_fs13.mkdtempSync)((0, import_node_path15.join)((0, import_node_os11.tmpdir)(), "haansi-replay-"));
88972
+ const work = (0, import_node_fs13.mkdtempSync)((0, import_node_path16.join)((0, import_node_os11.tmpdir)(), "haansi-replay-"));
88797
88973
  let stop = null;
88798
88974
  try {
88799
88975
  const contained = await withContainer(
@@ -88864,14 +89040,14 @@ Baseline: ${arm("baseline")} passed \xB7 With Haansi: ${arm("haansi")} passed \x
88864
89040
  (0, import_node_fs13.rmSync)(work, { recursive: true, force: true });
88865
89041
  }
88866
89042
  }
88867
- var import_node_child_process5, import_node_fs13, import_node_os11, import_node_path15, SHA, ARMS, FEEDBACK_CHARS, FAILURE_LINES2, REPLAY_BRANCH, USAGE2;
89043
+ var import_node_child_process5, import_node_fs13, import_node_os11, import_node_path16, SHA, ARMS, FEEDBACK_CHARS, FAILURE_LINES2, REPLAY_BRANCH, USAGE2;
88868
89044
  var init_replay = __esm({
88869
89045
  "src/commands/replay.ts"() {
88870
89046
  "use strict";
88871
89047
  import_node_child_process5 = require("node:child_process");
88872
89048
  import_node_fs13 = require("node:fs");
88873
89049
  import_node_os11 = require("node:os");
88874
- import_node_path15 = require("node:path");
89050
+ import_node_path16 = require("node:path");
88875
89051
  init_paths();
88876
89052
  init_replay_errors();
88877
89053
  init_api2();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haansi",
3
- "version": "0.1.96",
3
+ "version": "0.1.98",
4
4
  "description": "Haansi CLI - Session collector and MCP server for Claude Code & OpenAI Codex",
5
5
  "bin": {
6
6
  "haansi": "./dist/haansi.js"