haansi 0.1.96 → 0.1.97
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.
- package/dist/haansi.js +184 -38
- 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.
|
|
98
|
+
version: "0.1.97",
|
|
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 = "",
|
|
48271
|
-
if (
|
|
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
|
|
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 = "",
|
|
54891
|
-
if (
|
|
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 =
|
|
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(
|
|
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
|
|
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
|
|
78073
|
+
var dirname6 = path2.dirname;
|
|
78074
78074
|
var basename4 = path2.basename;
|
|
78075
78075
|
var extname = path2.extname;
|
|
78076
|
-
var
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
81789
|
-
var
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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);
|
|
@@ -87818,6 +87818,139 @@ var init_replay_relevance = __esm({
|
|
|
87818
87818
|
}
|
|
87819
87819
|
});
|
|
87820
87820
|
|
|
87821
|
+
// src/commands/replay-interface.ts
|
|
87822
|
+
function importsOf(source) {
|
|
87823
|
+
const text = stripComments(source);
|
|
87824
|
+
const out = /* @__PURE__ */ new Map();
|
|
87825
|
+
const re = /\bimport\s+(?:type\s+)?([\w$]+\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+[\w$]+)?\s*from\s*["']([^"']+)["']/g;
|
|
87826
|
+
let m;
|
|
87827
|
+
while (m = re.exec(text)) {
|
|
87828
|
+
const spec2 = m[3];
|
|
87829
|
+
if (!spec2.startsWith(".")) continue;
|
|
87830
|
+
const entry2 = out.get(spec2) ?? { spec: spec2, names: [], defaultImport: false };
|
|
87831
|
+
const head = (m[1] ?? "").replace(/,/g, "").trim();
|
|
87832
|
+
if (head && head !== "type" && IDENT.test(head)) entry2.defaultImport = true;
|
|
87833
|
+
for (const part of (m[2] ?? "").split(",")) {
|
|
87834
|
+
const name = part.trim().replace(/^type\s+/, "").split(/\s+as\s+/)[0].trim();
|
|
87835
|
+
if (name === "default") entry2.defaultImport = true;
|
|
87836
|
+
else if (IDENT.test(name) && !entry2.names.includes(name))
|
|
87837
|
+
entry2.names.push(name);
|
|
87838
|
+
}
|
|
87839
|
+
out.set(spec2, entry2);
|
|
87840
|
+
}
|
|
87841
|
+
return [...out.values()];
|
|
87842
|
+
}
|
|
87843
|
+
function exportsName(source, name) {
|
|
87844
|
+
const text = stripComments(source);
|
|
87845
|
+
if (/\bexport\s+\*\s+from\b/.test(text)) return true;
|
|
87846
|
+
const n = name.replace(/\$/g, "\\$");
|
|
87847
|
+
if (new RegExp(
|
|
87848
|
+
`\\bexport\\s+(?:declare\\s+)?(?:default\\s+)?(?:async\\s+)?(?:abstract\\s+)?(?:function\\*?|const|let|var|class|interface|type|enum|namespace)\\s+${n}\\b`
|
|
87849
|
+
).test(text))
|
|
87850
|
+
return true;
|
|
87851
|
+
const lists = text.matchAll(/\bexport\s+(?:type\s+)?\{([^}]*)\}/g);
|
|
87852
|
+
for (const list2 of lists)
|
|
87853
|
+
for (const part of list2[1].split(",")) {
|
|
87854
|
+
const exported = part.trim().split(/\s+as\s+/);
|
|
87855
|
+
const as = (exported[1] ?? exported[0]).replace(/^type\s+/, "").trim();
|
|
87856
|
+
if (as === name) return true;
|
|
87857
|
+
}
|
|
87858
|
+
return false;
|
|
87859
|
+
}
|
|
87860
|
+
function hasDefaultExport(source) {
|
|
87861
|
+
const text = stripComments(source);
|
|
87862
|
+
return /\bexport\s+default\b/.test(text) || /\bexport\s*\{[^}]*\bas\s+default\b/.test(text) || // CommonJS: what a default import of it receives.
|
|
87863
|
+
/\bmodule\.exports\s*=/.test(text);
|
|
87864
|
+
}
|
|
87865
|
+
function candidatesFor(fromFile, spec2) {
|
|
87866
|
+
const base = (0, import_node_path15.normalize)((0, import_node_path15.join)((0, import_node_path15.dirname)(fromFile), spec2)).replace(/\\/g, "/");
|
|
87867
|
+
if (base.startsWith("..")) return [];
|
|
87868
|
+
const stem2 = base.replace(/\.(?:[cm]?js|jsx)$/, "");
|
|
87869
|
+
const withExt = /\.[cm]?[jt]sx?$/.test(base) ? [base] : [];
|
|
87870
|
+
return [
|
|
87871
|
+
...withExt,
|
|
87872
|
+
...EXTENSIONS.map((e) => `${stem2}${e}`),
|
|
87873
|
+
...EXTENSIONS.map((e) => `${stem2}/index${e}`)
|
|
87874
|
+
].filter((p, i, all) => all.indexOf(p) === i);
|
|
87875
|
+
}
|
|
87876
|
+
async function firstAt(show, sha, paths) {
|
|
87877
|
+
for (const path2 of paths) {
|
|
87878
|
+
const source = await show(sha, path2);
|
|
87879
|
+
if (source !== null) return { path: path2, source };
|
|
87880
|
+
}
|
|
87881
|
+
return null;
|
|
87882
|
+
}
|
|
87883
|
+
async function testInterfaceOf(show, task) {
|
|
87884
|
+
const tests = new Set(task.testFiles);
|
|
87885
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
87886
|
+
for (const file2 of task.testFiles) {
|
|
87887
|
+
if (!JS_TEST.test(file2)) continue;
|
|
87888
|
+
const source = await show(task.targetSha, file2);
|
|
87889
|
+
if (source === null) continue;
|
|
87890
|
+
for (const imp of importsOf(source)) {
|
|
87891
|
+
const candidates = candidatesFor(file2, imp.spec);
|
|
87892
|
+
const atTarget = await firstAt(show, task.targetSha, candidates);
|
|
87893
|
+
if (!atTarget || tests.has(atTarget.path)) continue;
|
|
87894
|
+
if (/(^|\/)(__tests__|__mocks__|__fixtures__|fixtures?|test-utils?)\//.test(
|
|
87895
|
+
atTarget.path
|
|
87896
|
+
))
|
|
87897
|
+
continue;
|
|
87898
|
+
const atBase = await show(task.baseSha, atTarget.path);
|
|
87899
|
+
const names = imp.names.filter(
|
|
87900
|
+
(n) => atBase === null || !exportsName(atBase, n)
|
|
87901
|
+
);
|
|
87902
|
+
const defaultExport = imp.defaultImport && (atBase === null || !hasDefaultExport(atBase));
|
|
87903
|
+
if (atBase !== null && names.length === 0 && !defaultExport) continue;
|
|
87904
|
+
const entry2 = byPath.get(atTarget.path) ?? {
|
|
87905
|
+
path: atTarget.path,
|
|
87906
|
+
newFile: atBase === null,
|
|
87907
|
+
names: [],
|
|
87908
|
+
defaultExport: false
|
|
87909
|
+
};
|
|
87910
|
+
for (const n of names) if (!entry2.names.includes(n)) entry2.names.push(n);
|
|
87911
|
+
entry2.defaultExport ||= defaultExport;
|
|
87912
|
+
byPath.set(atTarget.path, entry2);
|
|
87913
|
+
}
|
|
87914
|
+
}
|
|
87915
|
+
let budget = MAX_INTERFACE_NAMES;
|
|
87916
|
+
return [...byPath.values()].slice(0, MAX_INTERFACE_MODULES).map((e) => {
|
|
87917
|
+
const names = e.names.slice(0, Math.max(0, budget));
|
|
87918
|
+
budget -= names.length;
|
|
87919
|
+
return { ...e, names };
|
|
87920
|
+
});
|
|
87921
|
+
}
|
|
87922
|
+
function interfaceSection(entries) {
|
|
87923
|
+
if (entries.length === 0) return [];
|
|
87924
|
+
return [
|
|
87925
|
+
"## What the tests use",
|
|
87926
|
+
"",
|
|
87927
|
+
"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.",
|
|
87928
|
+
"",
|
|
87929
|
+
...entries.map((e) => {
|
|
87930
|
+
const what = [
|
|
87931
|
+
...e.defaultExport ? ["a default export"] : [],
|
|
87932
|
+
...e.names.map((n) => `\`${n}\``)
|
|
87933
|
+
];
|
|
87934
|
+
const where = `\`${e.path}\`${e.newFile ? " (a new file)" : ""}`;
|
|
87935
|
+
return `- ${where}${what.length ? `: ${what.join(", ")}` : ""}`;
|
|
87936
|
+
}),
|
|
87937
|
+
""
|
|
87938
|
+
];
|
|
87939
|
+
}
|
|
87940
|
+
var import_node_path15, MAX_INTERFACE_MODULES, MAX_INTERFACE_NAMES, JS_TEST, EXTENSIONS, IDENT, stripComments;
|
|
87941
|
+
var init_replay_interface = __esm({
|
|
87942
|
+
"src/commands/replay-interface.ts"() {
|
|
87943
|
+
"use strict";
|
|
87944
|
+
import_node_path15 = require("node:path");
|
|
87945
|
+
MAX_INTERFACE_MODULES = 10;
|
|
87946
|
+
MAX_INTERFACE_NAMES = 30;
|
|
87947
|
+
JS_TEST = /\.[cm]?[jt]sx?$/;
|
|
87948
|
+
EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs"];
|
|
87949
|
+
IDENT = /^[A-Za-z_$][\w$]*$/;
|
|
87950
|
+
stripComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1");
|
|
87951
|
+
}
|
|
87952
|
+
});
|
|
87953
|
+
|
|
87821
87954
|
// src/commands/replay-tasks.ts
|
|
87822
87955
|
var replay_tasks_exports = {};
|
|
87823
87956
|
__export(replay_tasks_exports, {
|
|
@@ -87911,6 +88044,7 @@ function cardPrompt(task, feedback, arm = "baseline", tools = []) {
|
|
|
87911
88044
|
task.card.acceptance,
|
|
87912
88045
|
...task.card.area ? ["", "## Part of the code", "", task.card.area] : [],
|
|
87913
88046
|
"",
|
|
88047
|
+
...interfaceSection(task.testInterface ?? []),
|
|
87914
88048
|
...arm === "haansi" ? tools.length ? haansiSection(tools) : [HAANSI_LINE, ""] : [],
|
|
87915
88049
|
...feedback ? [FEEDBACK_HEADER, "", "```", feedback, "```", ""] : [],
|
|
87916
88050
|
CODE_ONLY_LINE,
|
|
@@ -88092,6 +88226,17 @@ async function runStoredReplays(options, deps) {
|
|
|
88092
88226
|
};
|
|
88093
88227
|
const targetText = await referenceDiffOf(deps, task).catch(() => null);
|
|
88094
88228
|
const targetChanges = targetText === null ? null : parseDiff(targetText);
|
|
88229
|
+
if (!asTask.testNames?.length && task.baseSha && task.targetSha) {
|
|
88230
|
+
task.testInterface = await testInterfaceOf(deps.showFile, {
|
|
88231
|
+
baseSha: task.baseSha,
|
|
88232
|
+
targetSha: task.targetSha,
|
|
88233
|
+
testFiles: task.testFiles
|
|
88234
|
+
}).catch(() => []);
|
|
88235
|
+
if (task.testInterface.length)
|
|
88236
|
+
deps.log(
|
|
88237
|
+
`\u2026 ${label}: the tests use ${task.testInterface.length} module(s) the start lacks; named in the prompt`
|
|
88238
|
+
);
|
|
88239
|
+
}
|
|
88095
88240
|
let targetSent = false;
|
|
88096
88241
|
for (const arm of arms) {
|
|
88097
88242
|
if (!options.force && alreadyMeasured(
|
|
@@ -88300,6 +88445,7 @@ var init_replay_tasks = __esm({
|
|
|
88300
88445
|
init_replay_judge();
|
|
88301
88446
|
init_replay();
|
|
88302
88447
|
init_replay_scale();
|
|
88448
|
+
init_replay_interface();
|
|
88303
88449
|
FEEDBACK_HEADER = "Your previous attempt did not pass the tests. Their output ends with:";
|
|
88304
88450
|
REPORT_CHUNK2 = 200;
|
|
88305
88451
|
REPORT_CHARS = 4e6;
|
|
@@ -88471,7 +88617,7 @@ function cleanCheckout(deps, dir, task) {
|
|
|
88471
88617
|
}
|
|
88472
88618
|
async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv = {}) {
|
|
88473
88619
|
const started = deps.now();
|
|
88474
|
-
const dir = (0,
|
|
88620
|
+
const dir = (0, import_node_path16.join)(
|
|
88475
88621
|
deps.workDir(),
|
|
88476
88622
|
`${task.processId.replace(/[^a-zA-Z0-9_-]/g, "")}-${arm}`
|
|
88477
88623
|
);
|
|
@@ -88500,7 +88646,7 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
|
|
|
88500
88646
|
`\u2026 ${label}: set up in ${since(at)}${setup.cached ? " (from the setup cache)" : ""}`
|
|
88501
88647
|
);
|
|
88502
88648
|
}
|
|
88503
|
-
const promptFile = (0,
|
|
88649
|
+
const promptFile = (0, import_node_path16.join)(dir, ".haansi-replay", "prompt.md");
|
|
88504
88650
|
let mcpConfigFile = agentEnv.HAANSI_REPLAY_MCP_CONFIG;
|
|
88505
88651
|
if (!mcpConfigFile) {
|
|
88506
88652
|
mcpConfigFile = `${dir}.mcp.json`;
|
|
@@ -88553,11 +88699,11 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
|
|
|
88553
88699
|
deps.log(` ${line}`);
|
|
88554
88700
|
}
|
|
88555
88701
|
const gradeSha = task.testNames?.length ? task.baseSha : task.targetSha;
|
|
88556
|
-
const own = new Map(files.map((f) => [f, deps.readFile((0,
|
|
88702
|
+
const own = new Map(files.map((f) => [f, deps.readFile((0, import_node_path16.join)(dir, f))]));
|
|
88557
88703
|
for (const f of files) {
|
|
88558
88704
|
const content = await deps.showFile(gradeSha, f);
|
|
88559
|
-
if (content === null) deps.removeFile((0,
|
|
88560
|
-
else deps.writeFile((0,
|
|
88705
|
+
if (content === null) deps.removeFile((0, import_node_path16.join)(dir, f));
|
|
88706
|
+
else deps.writeFile((0, import_node_path16.join)(dir, f), content);
|
|
88561
88707
|
}
|
|
88562
88708
|
const testAt = deps.now();
|
|
88563
88709
|
deps.log(`\u2026 ${label}: agent done in ${since(agentAt)}, grading`);
|
|
@@ -88608,8 +88754,8 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
|
|
|
88608
88754
|
}
|
|
88609
88755
|
if (test.code === 0 && !guarded) {
|
|
88610
88756
|
for (const [file2, content] of own) {
|
|
88611
|
-
if (content === null) deps.removeFile((0,
|
|
88612
|
-
else deps.writeFile((0,
|
|
88757
|
+
if (content === null) deps.removeFile((0, import_node_path16.join)(dir, file2));
|
|
88758
|
+
else deps.writeFile((0, import_node_path16.join)(dir, file2), content);
|
|
88613
88759
|
}
|
|
88614
88760
|
if (inspect) await inspect(dir);
|
|
88615
88761
|
return {
|
|
@@ -88625,8 +88771,8 @@ async function replayArm(deps, options, task, arm, promptOf, inspect, agentEnv =
|
|
|
88625
88771
|
};
|
|
88626
88772
|
}
|
|
88627
88773
|
for (const [file2, content] of own) {
|
|
88628
|
-
if (content === null) deps.removeFile((0,
|
|
88629
|
-
else deps.writeFile((0,
|
|
88774
|
+
if (content === null) deps.removeFile((0, import_node_path16.join)(dir, file2));
|
|
88775
|
+
else deps.writeFile((0, import_node_path16.join)(dir, file2), content);
|
|
88630
88776
|
}
|
|
88631
88777
|
feedback = guarded ? [
|
|
88632
88778
|
GUARD_FEEDBACK,
|
|
@@ -88693,11 +88839,11 @@ function runCommand(file2, args, cwd, env, timeoutMs, stdoutOnly = false) {
|
|
|
88693
88839
|
});
|
|
88694
88840
|
}
|
|
88695
88841
|
function dropLinks(work, path2) {
|
|
88696
|
-
const rel = (0,
|
|
88697
|
-
if (rel === "" || rel.startsWith("..") || (0,
|
|
88842
|
+
const rel = (0, import_node_path16.relative)(work, path2);
|
|
88843
|
+
if (rel === "" || rel.startsWith("..") || (0, import_node_path16.isAbsolute)(rel)) return;
|
|
88698
88844
|
let at = work;
|
|
88699
|
-
for (const part of rel.split(
|
|
88700
|
-
at = (0,
|
|
88845
|
+
for (const part of rel.split(import_node_path16.sep)) {
|
|
88846
|
+
at = (0, import_node_path16.join)(at, part);
|
|
88701
88847
|
let link = false;
|
|
88702
88848
|
try {
|
|
88703
88849
|
link = (0, import_node_fs13.lstatSync)(at).isSymbolicLink();
|
|
@@ -88732,7 +88878,7 @@ function localDeps(work) {
|
|
|
88732
88878
|
// dropLinks: with a container, nothing runs in it while these do.
|
|
88733
88879
|
writeFile: (path2, content) => {
|
|
88734
88880
|
dropLinks(work, path2);
|
|
88735
|
-
(0, import_node_fs13.mkdirSync)((0,
|
|
88881
|
+
(0, import_node_fs13.mkdirSync)((0, import_node_path16.dirname)(path2), { recursive: true });
|
|
88736
88882
|
const fd2 = (0, import_node_fs13.openSync)(
|
|
88737
88883
|
path2,
|
|
88738
88884
|
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 +88939,7 @@ async function replay(argv) {
|
|
|
88793
88939
|
async function replayStored(options, token2, apiUrl2) {
|
|
88794
88940
|
const { runStoredReplays: runStoredReplays2 } = await Promise.resolve().then(() => (init_replay_tasks(), replay_tasks_exports));
|
|
88795
88941
|
const { cliVersion: cliVersion2 } = await Promise.resolve().then(() => (init_replay_calibrate(), replay_calibrate_exports));
|
|
88796
|
-
const work = (0, import_node_fs13.mkdtempSync)((0,
|
|
88942
|
+
const work = (0, import_node_fs13.mkdtempSync)((0, import_node_path16.join)((0, import_node_os11.tmpdir)(), "haansi-replay-"));
|
|
88797
88943
|
let stop = null;
|
|
88798
88944
|
try {
|
|
88799
88945
|
const contained = await withContainer(
|
|
@@ -88864,14 +89010,14 @@ Baseline: ${arm("baseline")} passed \xB7 With Haansi: ${arm("haansi")} passed \x
|
|
|
88864
89010
|
(0, import_node_fs13.rmSync)(work, { recursive: true, force: true });
|
|
88865
89011
|
}
|
|
88866
89012
|
}
|
|
88867
|
-
var import_node_child_process5, import_node_fs13, import_node_os11,
|
|
89013
|
+
var import_node_child_process5, import_node_fs13, import_node_os11, import_node_path16, SHA, ARMS, FEEDBACK_CHARS, FAILURE_LINES2, REPLAY_BRANCH, USAGE2;
|
|
88868
89014
|
var init_replay = __esm({
|
|
88869
89015
|
"src/commands/replay.ts"() {
|
|
88870
89016
|
"use strict";
|
|
88871
89017
|
import_node_child_process5 = require("node:child_process");
|
|
88872
89018
|
import_node_fs13 = require("node:fs");
|
|
88873
89019
|
import_node_os11 = require("node:os");
|
|
88874
|
-
|
|
89020
|
+
import_node_path16 = require("node:path");
|
|
88875
89021
|
init_paths();
|
|
88876
89022
|
init_replay_errors();
|
|
88877
89023
|
init_api2();
|