@osfactory/har 0.38.0 → 0.38.1
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/index.js +298 -297
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -873,14 +873,14 @@ var require_url_state_machine = __commonJS({
|
|
|
873
873
|
return url.replace(/\u0009|\u000A|\u000D/g, "");
|
|
874
874
|
}
|
|
875
875
|
function shortenPath(url) {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
876
|
+
const path62 = url.path;
|
|
877
|
+
if (path62.length === 0) {
|
|
878
878
|
return;
|
|
879
879
|
}
|
|
880
|
-
if (url.scheme === "file" &&
|
|
880
|
+
if (url.scheme === "file" && path62.length === 1 && isNormalizedWindowsDriveLetter(path62[0])) {
|
|
881
881
|
return;
|
|
882
882
|
}
|
|
883
|
-
|
|
883
|
+
path62.pop();
|
|
884
884
|
}
|
|
885
885
|
function includesCredentials(url) {
|
|
886
886
|
return url.username !== "" || url.password !== "";
|
|
@@ -2200,7 +2200,7 @@ var require_lib2 = __commonJS({
|
|
|
2200
2200
|
let accum = [];
|
|
2201
2201
|
let accumBytes = 0;
|
|
2202
2202
|
let abort = false;
|
|
2203
|
-
return new Body.Promise(function(
|
|
2203
|
+
return new Body.Promise(function(resolve46, reject) {
|
|
2204
2204
|
let resTimeout;
|
|
2205
2205
|
if (_this4.timeout) {
|
|
2206
2206
|
resTimeout = setTimeout(function() {
|
|
@@ -2234,7 +2234,7 @@ var require_lib2 = __commonJS({
|
|
|
2234
2234
|
}
|
|
2235
2235
|
clearTimeout(resTimeout);
|
|
2236
2236
|
try {
|
|
2237
|
-
|
|
2237
|
+
resolve46(Buffer.concat(accum, accumBytes));
|
|
2238
2238
|
} catch (err) {
|
|
2239
2239
|
reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
|
|
2240
2240
|
}
|
|
@@ -2909,7 +2909,7 @@ var require_lib2 = __commonJS({
|
|
|
2909
2909
|
throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
|
|
2910
2910
|
}
|
|
2911
2911
|
Body.Promise = fetch3.Promise;
|
|
2912
|
-
return new fetch3.Promise(function(
|
|
2912
|
+
return new fetch3.Promise(function(resolve46, reject) {
|
|
2913
2913
|
const request = new Request3(url, opts);
|
|
2914
2914
|
const options = getNodeRequestOptions(request);
|
|
2915
2915
|
const send = (options.protocol === "https:" ? https : http2).request;
|
|
@@ -3042,7 +3042,7 @@ var require_lib2 = __commonJS({
|
|
|
3042
3042
|
requestOpts.body = void 0;
|
|
3043
3043
|
requestOpts.headers.delete("content-length");
|
|
3044
3044
|
}
|
|
3045
|
-
|
|
3045
|
+
resolve46(fetch3(new Request3(locationURL, requestOpts)));
|
|
3046
3046
|
finalize();
|
|
3047
3047
|
return;
|
|
3048
3048
|
}
|
|
@@ -3063,7 +3063,7 @@ var require_lib2 = __commonJS({
|
|
|
3063
3063
|
const codings = headers.get("Content-Encoding");
|
|
3064
3064
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
3065
3065
|
response = new Response3(body, response_options);
|
|
3066
|
-
|
|
3066
|
+
resolve46(response);
|
|
3067
3067
|
return;
|
|
3068
3068
|
}
|
|
3069
3069
|
const zlibOptions = {
|
|
@@ -3073,7 +3073,7 @@ var require_lib2 = __commonJS({
|
|
|
3073
3073
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
3074
3074
|
body = body.pipe(zlib.createGunzip(zlibOptions));
|
|
3075
3075
|
response = new Response3(body, response_options);
|
|
3076
|
-
|
|
3076
|
+
resolve46(response);
|
|
3077
3077
|
return;
|
|
3078
3078
|
}
|
|
3079
3079
|
if (codings == "deflate" || codings == "x-deflate") {
|
|
@@ -3085,12 +3085,12 @@ var require_lib2 = __commonJS({
|
|
|
3085
3085
|
body = body.pipe(zlib.createInflateRaw());
|
|
3086
3086
|
}
|
|
3087
3087
|
response = new Response3(body, response_options);
|
|
3088
|
-
|
|
3088
|
+
resolve46(response);
|
|
3089
3089
|
});
|
|
3090
3090
|
raw.on("end", function() {
|
|
3091
3091
|
if (!response) {
|
|
3092
3092
|
response = new Response3(body, response_options);
|
|
3093
|
-
|
|
3093
|
+
resolve46(response);
|
|
3094
3094
|
}
|
|
3095
3095
|
});
|
|
3096
3096
|
return;
|
|
@@ -3098,11 +3098,11 @@ var require_lib2 = __commonJS({
|
|
|
3098
3098
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
3099
3099
|
body = body.pipe(zlib.createBrotliDecompress());
|
|
3100
3100
|
response = new Response3(body, response_options);
|
|
3101
|
-
|
|
3101
|
+
resolve46(response);
|
|
3102
3102
|
return;
|
|
3103
3103
|
}
|
|
3104
3104
|
response = new Response3(body, response_options);
|
|
3105
|
-
|
|
3105
|
+
resolve46(response);
|
|
3106
3106
|
});
|
|
3107
3107
|
writeToStream(req, request);
|
|
3108
3108
|
});
|
|
@@ -6459,14 +6459,14 @@ __export(fileFromPath_exports, {
|
|
|
6459
6459
|
fileFromPathSync: () => fileFromPathSync,
|
|
6460
6460
|
isFile: () => isFile
|
|
6461
6461
|
});
|
|
6462
|
-
function createFileFromPath(
|
|
6462
|
+
function createFileFromPath(path62, { mtimeMs, size }, filenameOrOptions, options = {}) {
|
|
6463
6463
|
let filename;
|
|
6464
6464
|
if (isPlainObject_default2(filenameOrOptions)) {
|
|
6465
6465
|
[options, filename] = [filenameOrOptions, void 0];
|
|
6466
6466
|
} else {
|
|
6467
6467
|
filename = filenameOrOptions;
|
|
6468
6468
|
}
|
|
6469
|
-
const file = new FileFromPath({ path:
|
|
6469
|
+
const file = new FileFromPath({ path: path62, size, lastModified: mtimeMs });
|
|
6470
6470
|
if (!filename) {
|
|
6471
6471
|
filename = file.name;
|
|
6472
6472
|
}
|
|
@@ -6475,13 +6475,13 @@ function createFileFromPath(path61, { mtimeMs, size }, filenameOrOptions, option
|
|
|
6475
6475
|
lastModified: file.lastModified
|
|
6476
6476
|
});
|
|
6477
6477
|
}
|
|
6478
|
-
function fileFromPathSync(
|
|
6479
|
-
const stats = (0, import_fs5.statSync)(
|
|
6480
|
-
return createFileFromPath(
|
|
6478
|
+
function fileFromPathSync(path62, filenameOrOptions, options = {}) {
|
|
6479
|
+
const stats = (0, import_fs5.statSync)(path62);
|
|
6480
|
+
return createFileFromPath(path62, stats, filenameOrOptions, options);
|
|
6481
6481
|
}
|
|
6482
|
-
async function fileFromPath2(
|
|
6483
|
-
const stats = await import_fs5.promises.stat(
|
|
6484
|
-
return createFileFromPath(
|
|
6482
|
+
async function fileFromPath2(path62, filenameOrOptions, options) {
|
|
6483
|
+
const stats = await import_fs5.promises.stat(path62);
|
|
6484
|
+
return createFileFromPath(path62, stats, filenameOrOptions, options);
|
|
6485
6485
|
}
|
|
6486
6486
|
var import_fs5, import_path5, import_node_domexception, __classPrivateFieldSet5, __classPrivateFieldGet6, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath;
|
|
6487
6487
|
var init_fileFromPath = __esm({
|
|
@@ -6640,25 +6640,25 @@ __export(otel_hooks_exports, {
|
|
|
6640
6640
|
});
|
|
6641
6641
|
function getOtelHooksHome() {
|
|
6642
6642
|
if (process.env.HAR_OTEL_HOOKS_HOME) {
|
|
6643
|
-
return
|
|
6643
|
+
return path47.resolve(process.env.HAR_OTEL_HOOKS_HOME);
|
|
6644
6644
|
}
|
|
6645
|
-
return
|
|
6645
|
+
return path47.join(os14.homedir(), ".har", "otel-hooks");
|
|
6646
6646
|
}
|
|
6647
6647
|
function getOtelHooksConfigPath(hooksHome = getOtelHooksHome()) {
|
|
6648
|
-
return
|
|
6648
|
+
return path47.join(hooksHome, "otel_config.json");
|
|
6649
6649
|
}
|
|
6650
6650
|
function getOtelHooksWrapperPath(hooksHome = getOtelHooksHome()) {
|
|
6651
|
-
return
|
|
6651
|
+
return path47.join(hooksHome, "run-otel-hook.sh");
|
|
6652
6652
|
}
|
|
6653
6653
|
function getOtelHooksStateDir(hooksHome = getOtelHooksHome()) {
|
|
6654
|
-
return
|
|
6654
|
+
return path47.join(hooksHome, "state");
|
|
6655
6655
|
}
|
|
6656
6656
|
function localOtelHookBin(hooksHome) {
|
|
6657
|
-
return
|
|
6657
|
+
return path47.join(hooksHome, "node_modules", ".bin", "otel-hook");
|
|
6658
6658
|
}
|
|
6659
6659
|
function installedPackageVersion(hooksHome) {
|
|
6660
6660
|
try {
|
|
6661
|
-
const pkgPath =
|
|
6661
|
+
const pkgPath = path47.join(
|
|
6662
6662
|
hooksHome,
|
|
6663
6663
|
"node_modules",
|
|
6664
6664
|
"@osfactory",
|
|
@@ -6793,9 +6793,9 @@ function uninstallLegacyPythonHooks(hooksHome) {
|
|
|
6793
6793
|
}
|
|
6794
6794
|
function removeLegacyPythonArtifacts(hooksHome) {
|
|
6795
6795
|
const legacyPaths = [
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6796
|
+
path47.join(hooksHome, ".venv"),
|
|
6797
|
+
path47.join(hooksHome, "otel_config.yaml"),
|
|
6798
|
+
path47.join(hooksHome, "venv")
|
|
6799
6799
|
];
|
|
6800
6800
|
for (const target of legacyPaths) {
|
|
6801
6801
|
try {
|
|
@@ -6941,14 +6941,14 @@ function pruneLegacyCursorHookEvents(filePath, wrapperPath) {
|
|
|
6941
6941
|
function rewriteKnownHookRegistrations(wrapperPath) {
|
|
6942
6942
|
const home = os14.homedir();
|
|
6943
6943
|
const candidates = [
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6944
|
+
path47.join(home, ".cursor", "hooks.json"),
|
|
6945
|
+
path47.join(home, ".claude", "settings.json"),
|
|
6946
|
+
path47.join(home, ".codex", "hooks.json")
|
|
6947
6947
|
];
|
|
6948
6948
|
for (const filePath of candidates) {
|
|
6949
6949
|
try {
|
|
6950
6950
|
rewriteHookCommandsToWrapper(filePath, wrapperPath);
|
|
6951
|
-
if (filePath.endsWith(`${
|
|
6951
|
+
if (filePath.endsWith(`${path47.sep}.cursor${path47.sep}hooks.json`)) {
|
|
6952
6952
|
pruneLegacyCursorHookEvents(filePath, wrapperPath);
|
|
6953
6953
|
}
|
|
6954
6954
|
} catch {
|
|
@@ -7058,14 +7058,14 @@ function ensureOtelHooks(options) {
|
|
|
7058
7058
|
function disableOtelHooksExport() {
|
|
7059
7059
|
return writeOtelHooksConfig(buildOtelHooksConfig({ enabled: false }));
|
|
7060
7060
|
}
|
|
7061
|
-
var import_child_process10, fs43, os14,
|
|
7061
|
+
var import_child_process10, fs43, os14, path47, OTEL_HOOKS_PACKAGE, OTEL_HOOKS_PROVIDERS, OTEL_HOOKS_AGENTS, LEGACY_CURSOR_ONLY_HOOK_EVENTS;
|
|
7062
7062
|
var init_otel_hooks = __esm({
|
|
7063
7063
|
"src/core/otel-hooks.ts"() {
|
|
7064
7064
|
"use strict";
|
|
7065
7065
|
import_child_process10 = require("child_process");
|
|
7066
7066
|
fs43 = __toESM(require("fs"));
|
|
7067
7067
|
os14 = __toESM(require("os"));
|
|
7068
|
-
|
|
7068
|
+
path47 = __toESM(require("path"));
|
|
7069
7069
|
init_control_config();
|
|
7070
7070
|
init_telemetry_config();
|
|
7071
7071
|
OTEL_HOOKS_PACKAGE = "@osfactory/otel-hook@0.1.2";
|
|
@@ -8181,15 +8181,15 @@ var require_route = __commonJS({
|
|
|
8181
8181
|
};
|
|
8182
8182
|
}
|
|
8183
8183
|
function wrapConversion(toModel, graph) {
|
|
8184
|
-
const
|
|
8184
|
+
const path62 = [graph[toModel].parent, toModel];
|
|
8185
8185
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
8186
8186
|
let cur = graph[toModel].parent;
|
|
8187
8187
|
while (graph[cur].parent) {
|
|
8188
|
-
|
|
8188
|
+
path62.unshift(graph[cur].parent);
|
|
8189
8189
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
8190
8190
|
cur = graph[cur].parent;
|
|
8191
8191
|
}
|
|
8192
|
-
fn.conversion =
|
|
8192
|
+
fn.conversion = path62;
|
|
8193
8193
|
return fn;
|
|
8194
8194
|
}
|
|
8195
8195
|
module2.exports = function(fromModel) {
|
|
@@ -17679,16 +17679,16 @@ var require_os_tmpdir = __commonJS({
|
|
|
17679
17679
|
var isWindows = process.platform === "win32";
|
|
17680
17680
|
var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
|
|
17681
17681
|
module2.exports = function() {
|
|
17682
|
-
var
|
|
17682
|
+
var path62;
|
|
17683
17683
|
if (isWindows) {
|
|
17684
|
-
|
|
17684
|
+
path62 = process.env.TEMP || process.env.TMP || (process.env.SystemRoot || process.env.windir) + "\\temp";
|
|
17685
17685
|
} else {
|
|
17686
|
-
|
|
17686
|
+
path62 = process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp";
|
|
17687
17687
|
}
|
|
17688
|
-
if (trailingSlashRe.test(
|
|
17689
|
-
|
|
17688
|
+
if (trailingSlashRe.test(path62)) {
|
|
17689
|
+
path62 = path62.slice(0, -1);
|
|
17690
17690
|
}
|
|
17691
|
-
return
|
|
17691
|
+
return path62;
|
|
17692
17692
|
};
|
|
17693
17693
|
}
|
|
17694
17694
|
});
|
|
@@ -17697,7 +17697,7 @@ var require_os_tmpdir = __commonJS({
|
|
|
17697
17697
|
var require_tmp = __commonJS({
|
|
17698
17698
|
"node_modules/tmp/lib/tmp.js"(exports2, module2) {
|
|
17699
17699
|
var fs50 = require("fs");
|
|
17700
|
-
var
|
|
17700
|
+
var path62 = require("path");
|
|
17701
17701
|
var crypto6 = require("crypto");
|
|
17702
17702
|
var osTmpDir = require_os_tmpdir();
|
|
17703
17703
|
var _c2 = process.binding("constants");
|
|
@@ -17739,7 +17739,7 @@ var require_tmp = __commonJS({
|
|
|
17739
17739
|
}
|
|
17740
17740
|
function _generateTmpName(opts) {
|
|
17741
17741
|
if (opts.name) {
|
|
17742
|
-
return
|
|
17742
|
+
return path62.join(opts.dir || tmpDir, opts.name);
|
|
17743
17743
|
}
|
|
17744
17744
|
if (opts.template) {
|
|
17745
17745
|
return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));
|
|
@@ -17750,7 +17750,7 @@ var require_tmp = __commonJS({
|
|
|
17750
17750
|
_randomChars(12),
|
|
17751
17751
|
opts.postfix || ""
|
|
17752
17752
|
].join("");
|
|
17753
|
-
return
|
|
17753
|
+
return path62.join(opts.dir || tmpDir, name);
|
|
17754
17754
|
}
|
|
17755
17755
|
function tmpName(options, callback) {
|
|
17756
17756
|
var args = _parseArguments(options, callback), opts = args[0], cb = args[1], tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
|
|
@@ -17835,7 +17835,7 @@ var require_tmp = __commonJS({
|
|
|
17835
17835
|
do {
|
|
17836
17836
|
var dir2 = dirs.pop(), deferred = false, files = fs50.readdirSync(dir2);
|
|
17837
17837
|
for (var i2 = 0, length = files.length; i2 < length; i2++) {
|
|
17838
|
-
var file2 =
|
|
17838
|
+
var file2 = path62.join(dir2, files[i2]), stat = fs50.lstatSync(file2);
|
|
17839
17839
|
if (stat.isDirectory()) {
|
|
17840
17840
|
if (!deferred) {
|
|
17841
17841
|
deferred = true;
|
|
@@ -19046,7 +19046,7 @@ var require_Observable = __commonJS({
|
|
|
19046
19046
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
19047
19047
|
var _this = this;
|
|
19048
19048
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
19049
|
-
return new promiseCtor(function(
|
|
19049
|
+
return new promiseCtor(function(resolve46, reject) {
|
|
19050
19050
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
19051
19051
|
next: function(value) {
|
|
19052
19052
|
try {
|
|
@@ -19057,7 +19057,7 @@ var require_Observable = __commonJS({
|
|
|
19057
19057
|
}
|
|
19058
19058
|
},
|
|
19059
19059
|
error: reject,
|
|
19060
|
-
complete:
|
|
19060
|
+
complete: resolve46
|
|
19061
19061
|
});
|
|
19062
19062
|
_this.subscribe(subscriber);
|
|
19063
19063
|
});
|
|
@@ -19079,14 +19079,14 @@ var require_Observable = __commonJS({
|
|
|
19079
19079
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
19080
19080
|
var _this = this;
|
|
19081
19081
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
19082
|
-
return new promiseCtor(function(
|
|
19082
|
+
return new promiseCtor(function(resolve46, reject) {
|
|
19083
19083
|
var value;
|
|
19084
19084
|
_this.subscribe(function(x2) {
|
|
19085
19085
|
return value = x2;
|
|
19086
19086
|
}, function(err) {
|
|
19087
19087
|
return reject(err);
|
|
19088
19088
|
}, function() {
|
|
19089
|
-
return
|
|
19089
|
+
return resolve46(value);
|
|
19090
19090
|
});
|
|
19091
19091
|
});
|
|
19092
19092
|
};
|
|
@@ -21182,11 +21182,11 @@ var require_innerFrom = __commonJS({
|
|
|
21182
21182
|
"use strict";
|
|
21183
21183
|
var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P3, generator) {
|
|
21184
21184
|
function adopt(value) {
|
|
21185
|
-
return value instanceof P3 ? value : new P3(function(
|
|
21186
|
-
|
|
21185
|
+
return value instanceof P3 ? value : new P3(function(resolve46) {
|
|
21186
|
+
resolve46(value);
|
|
21187
21187
|
});
|
|
21188
21188
|
}
|
|
21189
|
-
return new (P3 || (P3 = Promise))(function(
|
|
21189
|
+
return new (P3 || (P3 = Promise))(function(resolve46, reject) {
|
|
21190
21190
|
function fulfilled(value) {
|
|
21191
21191
|
try {
|
|
21192
21192
|
step(generator.next(value));
|
|
@@ -21202,7 +21202,7 @@ var require_innerFrom = __commonJS({
|
|
|
21202
21202
|
}
|
|
21203
21203
|
}
|
|
21204
21204
|
function step(result) {
|
|
21205
|
-
result.done ?
|
|
21205
|
+
result.done ? resolve46(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
21206
21206
|
}
|
|
21207
21207
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21208
21208
|
});
|
|
@@ -21284,14 +21284,14 @@ var require_innerFrom = __commonJS({
|
|
|
21284
21284
|
}, i2);
|
|
21285
21285
|
function verb(n2) {
|
|
21286
21286
|
i2[n2] = o2[n2] && function(v3) {
|
|
21287
|
-
return new Promise(function(
|
|
21288
|
-
v3 = o2[n2](v3), settle(
|
|
21287
|
+
return new Promise(function(resolve46, reject) {
|
|
21288
|
+
v3 = o2[n2](v3), settle(resolve46, reject, v3.done, v3.value);
|
|
21289
21289
|
});
|
|
21290
21290
|
};
|
|
21291
21291
|
}
|
|
21292
|
-
function settle(
|
|
21292
|
+
function settle(resolve46, reject, d2, v3) {
|
|
21293
21293
|
Promise.resolve(v3).then(function(v4) {
|
|
21294
|
-
|
|
21294
|
+
resolve46({ value: v4, done: d2 });
|
|
21295
21295
|
}, reject);
|
|
21296
21296
|
}
|
|
21297
21297
|
};
|
|
@@ -21910,7 +21910,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
21910
21910
|
var EmptyError_1 = require_EmptyError();
|
|
21911
21911
|
function lastValueFrom2(source, config2) {
|
|
21912
21912
|
var hasConfig = typeof config2 === "object";
|
|
21913
|
-
return new Promise(function(
|
|
21913
|
+
return new Promise(function(resolve46, reject) {
|
|
21914
21914
|
var _hasValue = false;
|
|
21915
21915
|
var _value;
|
|
21916
21916
|
source.subscribe({
|
|
@@ -21921,9 +21921,9 @@ var require_lastValueFrom = __commonJS({
|
|
|
21921
21921
|
error: reject,
|
|
21922
21922
|
complete: function() {
|
|
21923
21923
|
if (_hasValue) {
|
|
21924
|
-
|
|
21924
|
+
resolve46(_value);
|
|
21925
21925
|
} else if (hasConfig) {
|
|
21926
|
-
|
|
21926
|
+
resolve46(config2.defaultValue);
|
|
21927
21927
|
} else {
|
|
21928
21928
|
reject(new EmptyError_1.EmptyError());
|
|
21929
21929
|
}
|
|
@@ -21945,16 +21945,16 @@ var require_firstValueFrom = __commonJS({
|
|
|
21945
21945
|
var Subscriber_1 = require_Subscriber();
|
|
21946
21946
|
function firstValueFrom(source, config2) {
|
|
21947
21947
|
var hasConfig = typeof config2 === "object";
|
|
21948
|
-
return new Promise(function(
|
|
21948
|
+
return new Promise(function(resolve46, reject) {
|
|
21949
21949
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
21950
21950
|
next: function(value) {
|
|
21951
|
-
|
|
21951
|
+
resolve46(value);
|
|
21952
21952
|
subscriber.unsubscribe();
|
|
21953
21953
|
},
|
|
21954
21954
|
error: reject,
|
|
21955
21955
|
complete: function() {
|
|
21956
21956
|
if (hasConfig) {
|
|
21957
|
-
|
|
21957
|
+
resolve46(config2.defaultValue);
|
|
21958
21958
|
} else {
|
|
21959
21959
|
reject(new EmptyError_1.EmptyError());
|
|
21960
21960
|
}
|
|
@@ -27747,14 +27747,14 @@ var require_run_async = __commonJS({
|
|
|
27747
27747
|
return function() {
|
|
27748
27748
|
var args = arguments;
|
|
27749
27749
|
var originalThis = this;
|
|
27750
|
-
var promise = new Promise(function(
|
|
27750
|
+
var promise = new Promise(function(resolve46, reject) {
|
|
27751
27751
|
var resolved = false;
|
|
27752
27752
|
const wrappedResolve = function(value) {
|
|
27753
27753
|
if (resolved) {
|
|
27754
27754
|
console.warn("Run-async promise already resolved.");
|
|
27755
27755
|
}
|
|
27756
27756
|
resolved = true;
|
|
27757
|
-
|
|
27757
|
+
resolve46(value);
|
|
27758
27758
|
};
|
|
27759
27759
|
var rejected = false;
|
|
27760
27760
|
const wrappedReject = function(value) {
|
|
@@ -30783,7 +30783,7 @@ var require_compile = __commonJS({
|
|
|
30783
30783
|
const schOrFunc = root.refs[ref];
|
|
30784
30784
|
if (schOrFunc)
|
|
30785
30785
|
return schOrFunc;
|
|
30786
|
-
let _sch =
|
|
30786
|
+
let _sch = resolve46.call(this, root, ref);
|
|
30787
30787
|
if (_sch === void 0) {
|
|
30788
30788
|
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
|
|
30789
30789
|
const { schemaId } = this.opts;
|
|
@@ -30810,7 +30810,7 @@ var require_compile = __commonJS({
|
|
|
30810
30810
|
function sameSchemaEnv(s1, s2) {
|
|
30811
30811
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
30812
30812
|
}
|
|
30813
|
-
function
|
|
30813
|
+
function resolve46(root, ref) {
|
|
30814
30814
|
let sch;
|
|
30815
30815
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
30816
30816
|
ref = sch;
|
|
@@ -31028,8 +31028,8 @@ var require_utils2 = __commonJS({
|
|
|
31028
31028
|
}
|
|
31029
31029
|
return ind;
|
|
31030
31030
|
}
|
|
31031
|
-
function removeDotSegments(
|
|
31032
|
-
let input =
|
|
31031
|
+
function removeDotSegments(path62) {
|
|
31032
|
+
let input = path62;
|
|
31033
31033
|
const output = [];
|
|
31034
31034
|
let nextSlash = -1;
|
|
31035
31035
|
let len = 0;
|
|
@@ -31281,8 +31281,8 @@ var require_schemes = __commonJS({
|
|
|
31281
31281
|
wsComponent.secure = void 0;
|
|
31282
31282
|
}
|
|
31283
31283
|
if (wsComponent.resourceName) {
|
|
31284
|
-
const [
|
|
31285
|
-
wsComponent.path =
|
|
31284
|
+
const [path62, query] = wsComponent.resourceName.split("?");
|
|
31285
|
+
wsComponent.path = path62 && path62 !== "/" ? path62 : void 0;
|
|
31286
31286
|
wsComponent.query = query;
|
|
31287
31287
|
wsComponent.resourceName = void 0;
|
|
31288
31288
|
}
|
|
@@ -31441,7 +31441,7 @@ var require_fast_uri = __commonJS({
|
|
|
31441
31441
|
}
|
|
31442
31442
|
return uri;
|
|
31443
31443
|
}
|
|
31444
|
-
function
|
|
31444
|
+
function resolve46(baseURI, relativeURI, options) {
|
|
31445
31445
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
31446
31446
|
const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
31447
31447
|
schemelessOptions.skipEscape = true;
|
|
@@ -31699,7 +31699,7 @@ var require_fast_uri = __commonJS({
|
|
|
31699
31699
|
var fastUri = {
|
|
31700
31700
|
SCHEMES,
|
|
31701
31701
|
normalize: normalize3,
|
|
31702
|
-
resolve:
|
|
31702
|
+
resolve: resolve46,
|
|
31703
31703
|
resolveComponent,
|
|
31704
31704
|
equal,
|
|
31705
31705
|
serialize,
|
|
@@ -35964,11 +35964,11 @@ var parser = new YargsParser({
|
|
|
35964
35964
|
resolve: import_path2.resolve,
|
|
35965
35965
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
35966
35966
|
// we can exercise all the lines below:
|
|
35967
|
-
require: (
|
|
35967
|
+
require: (path62) => {
|
|
35968
35968
|
if (typeof require !== "undefined") {
|
|
35969
|
-
return require(
|
|
35970
|
-
} else if (
|
|
35971
|
-
return JSON.parse((0, import_fs2.readFileSync)(
|
|
35969
|
+
return require(path62);
|
|
35970
|
+
} else if (path62.match(/\.json$/)) {
|
|
35971
|
+
return JSON.parse((0, import_fs2.readFileSync)(path62, "utf8"));
|
|
35972
35972
|
} else {
|
|
35973
35973
|
throw Error("only .json config files are supported in ESM");
|
|
35974
35974
|
}
|
|
@@ -37311,13 +37311,13 @@ function usage(yargs, shim3) {
|
|
|
37311
37311
|
};
|
|
37312
37312
|
self.stringifiedValues = function stringifiedValues(values, separator) {
|
|
37313
37313
|
let string3 = "";
|
|
37314
|
-
const
|
|
37314
|
+
const sep6 = separator || ", ";
|
|
37315
37315
|
const array2 = [].concat(values);
|
|
37316
37316
|
if (!values || !array2.length)
|
|
37317
37317
|
return string3;
|
|
37318
37318
|
array2.forEach((value) => {
|
|
37319
37319
|
if (string3.length)
|
|
37320
|
-
string3 +=
|
|
37320
|
+
string3 += sep6;
|
|
37321
37321
|
string3 += JSON.stringify(value);
|
|
37322
37322
|
});
|
|
37323
37323
|
return string3;
|
|
@@ -38494,12 +38494,12 @@ var YargsInstance = class {
|
|
|
38494
38494
|
async getCompletion(args, done) {
|
|
38495
38495
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
38496
38496
|
if (!done) {
|
|
38497
|
-
return new Promise((
|
|
38497
|
+
return new Promise((resolve46, reject) => {
|
|
38498
38498
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
38499
38499
|
if (err)
|
|
38500
38500
|
reject(err);
|
|
38501
38501
|
else
|
|
38502
|
-
|
|
38502
|
+
resolve46(completions);
|
|
38503
38503
|
});
|
|
38504
38504
|
});
|
|
38505
38505
|
} else {
|
|
@@ -40652,8 +40652,8 @@ function getErrorMap() {
|
|
|
40652
40652
|
|
|
40653
40653
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
40654
40654
|
var makeIssue = (params) => {
|
|
40655
|
-
const { data, path:
|
|
40656
|
-
const fullPath = [...
|
|
40655
|
+
const { data, path: path62, errorMaps, issueData } = params;
|
|
40656
|
+
const fullPath = [...path62, ...issueData.path || []];
|
|
40657
40657
|
const fullIssue = {
|
|
40658
40658
|
...issueData,
|
|
40659
40659
|
path: fullPath
|
|
@@ -40769,11 +40769,11 @@ var errorUtil;
|
|
|
40769
40769
|
|
|
40770
40770
|
// node_modules/zod/v3/types.js
|
|
40771
40771
|
var ParseInputLazyPath = class {
|
|
40772
|
-
constructor(parent, value,
|
|
40772
|
+
constructor(parent, value, path62, key) {
|
|
40773
40773
|
this._cachedPath = [];
|
|
40774
40774
|
this.parent = parent;
|
|
40775
40775
|
this.data = value;
|
|
40776
|
-
this._path =
|
|
40776
|
+
this._path = path62;
|
|
40777
40777
|
this._key = key;
|
|
40778
40778
|
}
|
|
40779
40779
|
get path() {
|
|
@@ -68312,16 +68312,16 @@ async function handleAgentSkills(options) {
|
|
|
68312
68312
|
}
|
|
68313
68313
|
async function askYesNo(question) {
|
|
68314
68314
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
68315
|
-
return new Promise((
|
|
68315
|
+
return new Promise((resolve46) => {
|
|
68316
68316
|
process.stderr.write(`${question} `);
|
|
68317
68317
|
rl.once("line", (answer) => {
|
|
68318
68318
|
rl.close();
|
|
68319
68319
|
const trimmed = answer.trim();
|
|
68320
68320
|
if (trimmed === "") {
|
|
68321
|
-
|
|
68321
|
+
resolve46(true);
|
|
68322
68322
|
return;
|
|
68323
68323
|
}
|
|
68324
|
-
|
|
68324
|
+
resolve46(/^y(es)?$/i.test(trimmed));
|
|
68325
68325
|
});
|
|
68326
68326
|
});
|
|
68327
68327
|
}
|
|
@@ -68400,7 +68400,7 @@ function handleRemove(argv) {
|
|
|
68400
68400
|
}
|
|
68401
68401
|
|
|
68402
68402
|
// src/cli/commands/env.ts
|
|
68403
|
-
var
|
|
68403
|
+
var path51 = __toESM(require("path"));
|
|
68404
68404
|
|
|
68405
68405
|
// src/core/harness.ts
|
|
68406
68406
|
var fs22 = __toESM(require("fs"));
|
|
@@ -69189,13 +69189,13 @@ var MultipartBody = class {
|
|
|
69189
69189
|
// node_modules/@anthropic-ai/sdk/_shims/node-runtime.mjs
|
|
69190
69190
|
var import_web = require("node:stream/web");
|
|
69191
69191
|
var fileFromPathWarned = false;
|
|
69192
|
-
async function fileFromPath3(
|
|
69192
|
+
async function fileFromPath3(path62, ...args) {
|
|
69193
69193
|
const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
|
|
69194
69194
|
if (!fileFromPathWarned) {
|
|
69195
|
-
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(
|
|
69195
|
+
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path62)}) instead`);
|
|
69196
69196
|
fileFromPathWarned = true;
|
|
69197
69197
|
}
|
|
69198
|
-
return await _fileFromPath(
|
|
69198
|
+
return await _fileFromPath(path62, ...args);
|
|
69199
69199
|
}
|
|
69200
69200
|
var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
69201
69201
|
var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
@@ -69691,8 +69691,8 @@ async function defaultParseResponse(props) {
|
|
|
69691
69691
|
}
|
|
69692
69692
|
var APIPromise = class _APIPromise extends Promise {
|
|
69693
69693
|
constructor(responsePromise, parseResponse = defaultParseResponse) {
|
|
69694
|
-
super((
|
|
69695
|
-
|
|
69694
|
+
super((resolve46) => {
|
|
69695
|
+
resolve46(null);
|
|
69696
69696
|
});
|
|
69697
69697
|
this.responsePromise = responsePromise;
|
|
69698
69698
|
this.parseResponse = parseResponse;
|
|
@@ -69792,29 +69792,29 @@ var APIClient = class {
|
|
|
69792
69792
|
defaultIdempotencyKey() {
|
|
69793
69793
|
return `stainless-node-retry-${uuid4()}`;
|
|
69794
69794
|
}
|
|
69795
|
-
get(
|
|
69796
|
-
return this.methodRequest("get",
|
|
69795
|
+
get(path62, opts) {
|
|
69796
|
+
return this.methodRequest("get", path62, opts);
|
|
69797
69797
|
}
|
|
69798
|
-
post(
|
|
69799
|
-
return this.methodRequest("post",
|
|
69798
|
+
post(path62, opts) {
|
|
69799
|
+
return this.methodRequest("post", path62, opts);
|
|
69800
69800
|
}
|
|
69801
|
-
patch(
|
|
69802
|
-
return this.methodRequest("patch",
|
|
69801
|
+
patch(path62, opts) {
|
|
69802
|
+
return this.methodRequest("patch", path62, opts);
|
|
69803
69803
|
}
|
|
69804
|
-
put(
|
|
69805
|
-
return this.methodRequest("put",
|
|
69804
|
+
put(path62, opts) {
|
|
69805
|
+
return this.methodRequest("put", path62, opts);
|
|
69806
69806
|
}
|
|
69807
|
-
delete(
|
|
69808
|
-
return this.methodRequest("delete",
|
|
69807
|
+
delete(path62, opts) {
|
|
69808
|
+
return this.methodRequest("delete", path62, opts);
|
|
69809
69809
|
}
|
|
69810
|
-
methodRequest(method,
|
|
69810
|
+
methodRequest(method, path62, opts) {
|
|
69811
69811
|
return this.request(Promise.resolve(opts).then(async (opts2) => {
|
|
69812
69812
|
const body = opts2 && isBlobLike(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
|
|
69813
|
-
return { method, path:
|
|
69813
|
+
return { method, path: path62, ...opts2, body };
|
|
69814
69814
|
}));
|
|
69815
69815
|
}
|
|
69816
|
-
getAPIList(
|
|
69817
|
-
return this.requestAPIList(Page, { method: "get", path:
|
|
69816
|
+
getAPIList(path62, Page, opts) {
|
|
69817
|
+
return this.requestAPIList(Page, { method: "get", path: path62, ...opts });
|
|
69818
69818
|
}
|
|
69819
69819
|
calculateContentLength(body) {
|
|
69820
69820
|
if (typeof body === "string") {
|
|
@@ -69832,10 +69832,10 @@ var APIClient = class {
|
|
|
69832
69832
|
return null;
|
|
69833
69833
|
}
|
|
69834
69834
|
buildRequest(options) {
|
|
69835
|
-
const { method, path:
|
|
69835
|
+
const { method, path: path62, query, headers = {} } = options;
|
|
69836
69836
|
const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
|
|
69837
69837
|
const contentLength = this.calculateContentLength(body);
|
|
69838
|
-
const url = this.buildURL(
|
|
69838
|
+
const url = this.buildURL(path62, query);
|
|
69839
69839
|
if ("timeout" in options)
|
|
69840
69840
|
validatePositiveInteger("timeout", options.timeout);
|
|
69841
69841
|
const timeout = options.timeout ?? this.timeout;
|
|
@@ -69944,8 +69944,8 @@ var APIClient = class {
|
|
|
69944
69944
|
const request = this.makeRequest(options, null);
|
|
69945
69945
|
return new PagePromise(this, request, Page);
|
|
69946
69946
|
}
|
|
69947
|
-
buildURL(
|
|
69948
|
-
const url = isAbsoluteURL(
|
|
69947
|
+
buildURL(path62, query) {
|
|
69948
|
+
const url = isAbsoluteURL(path62) ? new URL(path62) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path62.startsWith("/") ? path62.slice(1) : path62));
|
|
69949
69949
|
const defaultQuery = this.defaultQuery();
|
|
69950
69950
|
if (!isEmptyObj(defaultQuery)) {
|
|
69951
69951
|
query = { ...defaultQuery, ...query };
|
|
@@ -70230,7 +70230,7 @@ var startsWithSchemeRegexp = new RegExp("^(?:[a-z]+:)?//", "i");
|
|
|
70230
70230
|
var isAbsoluteURL = (url) => {
|
|
70231
70231
|
return startsWithSchemeRegexp.test(url);
|
|
70232
70232
|
};
|
|
70233
|
-
var sleep = (ms) => new Promise((
|
|
70233
|
+
var sleep = (ms) => new Promise((resolve46) => setTimeout(resolve46, ms));
|
|
70234
70234
|
var validatePositiveInteger = (name, n2) => {
|
|
70235
70235
|
if (typeof n2 !== "number" || !Number.isInteger(n2)) {
|
|
70236
70236
|
throw new AnthropicError(`${name} must be an integer`);
|
|
@@ -70721,12 +70721,12 @@ var PromptCachingBetaMessageStream = class _PromptCachingBetaMessageStream {
|
|
|
70721
70721
|
}
|
|
70722
70722
|
return this._emit("error", new AnthropicError(String(error3)));
|
|
70723
70723
|
});
|
|
70724
|
-
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_connectedPromise, new Promise((
|
|
70725
|
-
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveConnectedPromise,
|
|
70724
|
+
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_connectedPromise, new Promise((resolve46, reject) => {
|
|
70725
|
+
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveConnectedPromise, resolve46, "f");
|
|
70726
70726
|
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_rejectConnectedPromise, reject, "f");
|
|
70727
70727
|
}), "f");
|
|
70728
|
-
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_endPromise, new Promise((
|
|
70729
|
-
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveEndPromise,
|
|
70728
|
+
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_endPromise, new Promise((resolve46, reject) => {
|
|
70729
|
+
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_resolveEndPromise, resolve46, "f");
|
|
70730
70730
|
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_rejectEndPromise, reject, "f");
|
|
70731
70731
|
}), "f");
|
|
70732
70732
|
__classPrivateFieldGet8(this, _PromptCachingBetaMessageStream_connectedPromise, "f").catch(() => {
|
|
@@ -70855,11 +70855,11 @@ var PromptCachingBetaMessageStream = class _PromptCachingBetaMessageStream {
|
|
|
70855
70855
|
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
70856
70856
|
*/
|
|
70857
70857
|
emitted(event) {
|
|
70858
|
-
return new Promise((
|
|
70858
|
+
return new Promise((resolve46, reject) => {
|
|
70859
70859
|
__classPrivateFieldSet7(this, _PromptCachingBetaMessageStream_catchingPromiseCreated, true, "f");
|
|
70860
70860
|
if (event !== "error")
|
|
70861
70861
|
this.once("error", reject);
|
|
70862
|
-
this.once(event,
|
|
70862
|
+
this.once(event, resolve46);
|
|
70863
70863
|
});
|
|
70864
70864
|
}
|
|
70865
70865
|
async done() {
|
|
@@ -71086,7 +71086,7 @@ var PromptCachingBetaMessageStream = class _PromptCachingBetaMessageStream {
|
|
|
71086
71086
|
if (done) {
|
|
71087
71087
|
return { value: void 0, done: true };
|
|
71088
71088
|
}
|
|
71089
|
-
return new Promise((
|
|
71089
|
+
return new Promise((resolve46, reject) => readQueue.push({ resolve: resolve46, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
|
|
71090
71090
|
}
|
|
71091
71091
|
const chunk = pushQueue.shift();
|
|
71092
71092
|
return { value: chunk, done: false };
|
|
@@ -71234,12 +71234,12 @@ var MessageStream = class _MessageStream {
|
|
|
71234
71234
|
}
|
|
71235
71235
|
return this._emit("error", new AnthropicError(String(error3)));
|
|
71236
71236
|
});
|
|
71237
|
-
__classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((
|
|
71238
|
-
__classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise,
|
|
71237
|
+
__classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((resolve46, reject) => {
|
|
71238
|
+
__classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise, resolve46, "f");
|
|
71239
71239
|
__classPrivateFieldSet8(this, _MessageStream_rejectConnectedPromise, reject, "f");
|
|
71240
71240
|
}), "f");
|
|
71241
|
-
__classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((
|
|
71242
|
-
__classPrivateFieldSet8(this, _MessageStream_resolveEndPromise,
|
|
71241
|
+
__classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((resolve46, reject) => {
|
|
71242
|
+
__classPrivateFieldSet8(this, _MessageStream_resolveEndPromise, resolve46, "f");
|
|
71243
71243
|
__classPrivateFieldSet8(this, _MessageStream_rejectEndPromise, reject, "f");
|
|
71244
71244
|
}), "f");
|
|
71245
71245
|
__classPrivateFieldGet9(this, _MessageStream_connectedPromise, "f").catch(() => {
|
|
@@ -71368,11 +71368,11 @@ var MessageStream = class _MessageStream {
|
|
|
71368
71368
|
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
71369
71369
|
*/
|
|
71370
71370
|
emitted(event) {
|
|
71371
|
-
return new Promise((
|
|
71371
|
+
return new Promise((resolve46, reject) => {
|
|
71372
71372
|
__classPrivateFieldSet8(this, _MessageStream_catchingPromiseCreated, true, "f");
|
|
71373
71373
|
if (event !== "error")
|
|
71374
71374
|
this.once("error", reject);
|
|
71375
|
-
this.once(event,
|
|
71375
|
+
this.once(event, resolve46);
|
|
71376
71376
|
});
|
|
71377
71377
|
}
|
|
71378
71378
|
async done() {
|
|
@@ -71599,7 +71599,7 @@ var MessageStream = class _MessageStream {
|
|
|
71599
71599
|
if (done) {
|
|
71600
71600
|
return { value: void 0, done: true };
|
|
71601
71601
|
}
|
|
71602
|
-
return new Promise((
|
|
71602
|
+
return new Promise((resolve46, reject) => readQueue.push({ resolve: resolve46, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
|
|
71603
71603
|
}
|
|
71604
71604
|
const chunk = pushQueue.shift();
|
|
71605
71605
|
return { value: chunk, done: false };
|
|
@@ -71859,11 +71859,11 @@ async function promptApplyAgentMdProposal(repoPath) {
|
|
|
71859
71859
|
}
|
|
71860
71860
|
async function askYesNo2(question) {
|
|
71861
71861
|
const rl = readline2.createInterface({ input: process.stdin, output: process.stderr });
|
|
71862
|
-
return new Promise((
|
|
71862
|
+
return new Promise((resolve46) => {
|
|
71863
71863
|
process.stderr.write(`${question} `);
|
|
71864
71864
|
rl.once("line", (answer) => {
|
|
71865
71865
|
rl.close();
|
|
71866
|
-
|
|
71866
|
+
resolve46(/^y(es)?$/i.test(answer.trim()));
|
|
71867
71867
|
});
|
|
71868
71868
|
});
|
|
71869
71869
|
}
|
|
@@ -72093,7 +72093,7 @@ async function executeAuthoringToolCall(toolName, input, repoPath, harnessDir, c
|
|
|
72093
72093
|
}
|
|
72094
72094
|
async function askUser(question, options) {
|
|
72095
72095
|
const rl = readline3.createInterface({ input: process.stdin, output: process.stderr });
|
|
72096
|
-
return new Promise((
|
|
72096
|
+
return new Promise((resolve46) => {
|
|
72097
72097
|
process.stderr.write("\n");
|
|
72098
72098
|
process.stderr.write(`\u2753 ${question}
|
|
72099
72099
|
`);
|
|
@@ -72104,7 +72104,7 @@ async function askUser(question, options) {
|
|
|
72104
72104
|
process.stderr.write("> ");
|
|
72105
72105
|
rl.once("line", (answer) => {
|
|
72106
72106
|
rl.close();
|
|
72107
|
-
|
|
72107
|
+
resolve46(answer.trim());
|
|
72108
72108
|
});
|
|
72109
72109
|
});
|
|
72110
72110
|
}
|
|
@@ -72248,7 +72248,7 @@ function runScript(scriptPath, args = [], options = {}) {
|
|
|
72248
72248
|
function runScriptCapture(scriptPath, args = [], options = {}) {
|
|
72249
72249
|
const stream = options.stream ?? false;
|
|
72250
72250
|
const { stream: _stream, ...spawnOptions } = options;
|
|
72251
|
-
return new Promise((
|
|
72251
|
+
return new Promise((resolve46) => {
|
|
72252
72252
|
const proc = (0, import_child_process.spawn)("bash", [scriptPath, ...args], {
|
|
72253
72253
|
...spawnOptions,
|
|
72254
72254
|
stdio: ["inherit", "pipe", "pipe"]
|
|
@@ -72263,13 +72263,13 @@ function runScriptCapture(scriptPath, args = [], options = {}) {
|
|
|
72263
72263
|
stderr += d2;
|
|
72264
72264
|
if (stream) process.stderr.write(d2);
|
|
72265
72265
|
});
|
|
72266
|
-
proc.on("close", (code) =>
|
|
72266
|
+
proc.on("close", (code) => resolve46({ stdout, stderr, code: code ?? 0 }));
|
|
72267
72267
|
});
|
|
72268
72268
|
}
|
|
72269
72269
|
function runShellCommand(command2, options = {}) {
|
|
72270
72270
|
const stream = options.stream ?? false;
|
|
72271
72271
|
const { stream: _stream, ...spawnOptions } = options;
|
|
72272
|
-
return new Promise((
|
|
72272
|
+
return new Promise((resolve46) => {
|
|
72273
72273
|
const proc = (0, import_child_process.spawn)("bash", ["-lc", command2], {
|
|
72274
72274
|
...spawnOptions,
|
|
72275
72275
|
stdio: ["inherit", "pipe", "pipe"]
|
|
@@ -72284,7 +72284,7 @@ function runShellCommand(command2, options = {}) {
|
|
|
72284
72284
|
stderr += d2;
|
|
72285
72285
|
if (stream) process.stderr.write(d2);
|
|
72286
72286
|
});
|
|
72287
|
-
proc.on("close", (code) =>
|
|
72287
|
+
proc.on("close", (code) => resolve46({ stdout, stderr, code: code ?? 0 }));
|
|
72288
72288
|
});
|
|
72289
72289
|
}
|
|
72290
72290
|
|
|
@@ -73742,12 +73742,12 @@ function printAdaptationPrompt(content) {
|
|
|
73742
73742
|
}
|
|
73743
73743
|
function askYesNo3(question) {
|
|
73744
73744
|
const rl = readline4.createInterface({ input: process.stdin, output: process.stderr });
|
|
73745
|
-
return new Promise((
|
|
73745
|
+
return new Promise((resolve46) => {
|
|
73746
73746
|
process.stderr.write(`${question} `);
|
|
73747
73747
|
rl.once("line", (answer) => {
|
|
73748
73748
|
rl.close();
|
|
73749
73749
|
const trimmed = answer.trim();
|
|
73750
|
-
|
|
73750
|
+
resolve46(trimmed === "" || /^y(es)?$/i.test(trimmed));
|
|
73751
73751
|
});
|
|
73752
73752
|
});
|
|
73753
73753
|
}
|
|
@@ -73834,16 +73834,16 @@ async function promptScaffoldCursorRule(exists) {
|
|
|
73834
73834
|
}
|
|
73835
73835
|
async function askYesNo4(question) {
|
|
73836
73836
|
const rl = readline5.createInterface({ input: process.stdin, output: process.stderr });
|
|
73837
|
-
return new Promise((
|
|
73837
|
+
return new Promise((resolve46) => {
|
|
73838
73838
|
process.stderr.write(`${question} `);
|
|
73839
73839
|
rl.once("line", (answer) => {
|
|
73840
73840
|
rl.close();
|
|
73841
73841
|
const trimmed = answer.trim();
|
|
73842
73842
|
if (trimmed === "") {
|
|
73843
|
-
|
|
73843
|
+
resolve46(true);
|
|
73844
73844
|
return;
|
|
73845
73845
|
}
|
|
73846
|
-
|
|
73846
|
+
resolve46(/^y(es)?$/i.test(trimmed));
|
|
73847
73847
|
});
|
|
73848
73848
|
});
|
|
73849
73849
|
}
|
|
@@ -74151,7 +74151,7 @@ var LocalScriptExecutor = class {
|
|
|
74151
74151
|
var localScriptExecutor = new LocalScriptExecutor();
|
|
74152
74152
|
|
|
74153
74153
|
// src/core/control-sync.ts
|
|
74154
|
-
var
|
|
74154
|
+
var path45 = __toESM(require("path"));
|
|
74155
74155
|
init_control_config();
|
|
74156
74156
|
|
|
74157
74157
|
// src/core/control-registry.ts
|
|
@@ -75598,7 +75598,7 @@ init_telemetry_config();
|
|
|
75598
75598
|
// src/core/usage-harvest/claude.ts
|
|
75599
75599
|
var fs40 = __toESM(require("fs"));
|
|
75600
75600
|
var os11 = __toESM(require("os"));
|
|
75601
|
-
var
|
|
75601
|
+
var path41 = __toESM(require("path"));
|
|
75602
75602
|
init_telemetry_config();
|
|
75603
75603
|
|
|
75604
75604
|
// src/core/telemetry-env.ts
|
|
@@ -75666,16 +75666,24 @@ ${TELEMETRY_MARKER_END}
|
|
|
75666
75666
|
fs39.writeFileSync(envFilePath, combined.endsWith("\n") ? combined : combined + "\n");
|
|
75667
75667
|
}
|
|
75668
75668
|
|
|
75669
|
-
// src/core/
|
|
75670
|
-
|
|
75671
|
-
|
|
75672
|
-
return
|
|
75673
|
-
|
|
75674
|
-
|
|
75675
|
-
|
|
75669
|
+
// src/core/workspace-path-match.ts
|
|
75670
|
+
var path40 = __toESM(require("path"));
|
|
75671
|
+
function stripTrailingSeparators(value) {
|
|
75672
|
+
return value.replace(/[/\\]+$/, "");
|
|
75673
|
+
}
|
|
75674
|
+
function isWorkspaceUnderPath(workspace, basePath) {
|
|
75675
|
+
const workspaceNorm = stripTrailingSeparators(path40.resolve(workspace));
|
|
75676
|
+
const baseNorm = stripTrailingSeparators(path40.resolve(basePath));
|
|
75677
|
+
if (!workspaceNorm || !baseNorm) return false;
|
|
75678
|
+
return workspaceNorm === baseNorm || workspaceNorm.startsWith(`${baseNorm}${path40.sep}`);
|
|
75676
75679
|
}
|
|
75680
|
+
function workspaceMatchesTarget(workspace, targets) {
|
|
75681
|
+
return targets.some((target) => isWorkspaceUnderPath(workspace, target));
|
|
75682
|
+
}
|
|
75683
|
+
|
|
75684
|
+
// src/core/usage-harvest/claude.ts
|
|
75677
75685
|
function claudeProjectsRoot() {
|
|
75678
|
-
return process.env.HAR_CLAUDE_PROJECTS_DIR ?
|
|
75686
|
+
return process.env.HAR_CLAUDE_PROJECTS_DIR ? path41.resolve(process.env.HAR_CLAUDE_PROJECTS_DIR) : path41.join(os11.homedir(), ".claude", "projects");
|
|
75679
75687
|
}
|
|
75680
75688
|
function encodeClaudeProjectDir(cwd) {
|
|
75681
75689
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
@@ -75750,18 +75758,18 @@ function findMatchingClaudeTranscripts(slot) {
|
|
|
75750
75758
|
const matches = [];
|
|
75751
75759
|
for (const entry of fs40.readdirSync(root, { withFileTypes: true })) {
|
|
75752
75760
|
if (!entry.isDirectory()) continue;
|
|
75753
|
-
const projectDir =
|
|
75754
|
-
const encodedHit = targets.some((t2) => entry.name
|
|
75761
|
+
const projectDir = path41.join(root, entry.name);
|
|
75762
|
+
const encodedHit = targets.some((t2) => entry.name === encodeClaudeProjectDir(t2));
|
|
75755
75763
|
for (const file of fs40.readdirSync(projectDir)) {
|
|
75756
75764
|
if (!file.endsWith(".jsonl")) continue;
|
|
75757
|
-
const filePath =
|
|
75765
|
+
const filePath = path41.join(projectDir, file);
|
|
75758
75766
|
const stat = fs40.statSync(filePath);
|
|
75759
75767
|
const records = readJsonlRecords(filePath);
|
|
75760
75768
|
let cwdHit = encodedHit;
|
|
75761
75769
|
for (const record2 of records) {
|
|
75762
75770
|
if (!record2 || typeof record2 !== "object") continue;
|
|
75763
75771
|
const cwd = String(record2.cwd ?? "");
|
|
75764
|
-
if (cwd &&
|
|
75772
|
+
if (cwd && workspaceMatchesTarget(cwd, targets)) {
|
|
75765
75773
|
cwdHit = true;
|
|
75766
75774
|
break;
|
|
75767
75775
|
}
|
|
@@ -75869,21 +75877,14 @@ function harvestClaudeEvents(slot) {
|
|
|
75869
75877
|
// src/core/usage-harvest/codex.ts
|
|
75870
75878
|
var fs41 = __toESM(require("fs"));
|
|
75871
75879
|
var os12 = __toESM(require("os"));
|
|
75872
|
-
var
|
|
75873
|
-
function pathsMatch2(candidate, targets) {
|
|
75874
|
-
const norm = path41.resolve(candidate);
|
|
75875
|
-
return targets.some((t2) => {
|
|
75876
|
-
const target = path41.resolve(t2);
|
|
75877
|
-
return norm === target || norm.startsWith(target + path41.sep) || target.startsWith(norm + path41.sep);
|
|
75878
|
-
});
|
|
75879
|
-
}
|
|
75880
|
+
var path42 = __toESM(require("path"));
|
|
75880
75881
|
function codexSessionsRoot() {
|
|
75881
|
-
return process.env.HAR_CODEX_SESSIONS_DIR ?
|
|
75882
|
+
return process.env.HAR_CODEX_SESSIONS_DIR ? path42.resolve(process.env.HAR_CODEX_SESSIONS_DIR) : path42.join(os12.homedir(), ".codex", "sessions");
|
|
75882
75883
|
}
|
|
75883
75884
|
function walkJsonlFiles(dir, out = []) {
|
|
75884
75885
|
if (!fs41.existsSync(dir)) return out;
|
|
75885
75886
|
for (const entry of fs41.readdirSync(dir, { withFileTypes: true })) {
|
|
75886
|
-
const full =
|
|
75887
|
+
const full = path42.join(dir, entry.name);
|
|
75887
75888
|
if (entry.isDirectory()) walkJsonlFiles(full, out);
|
|
75888
75889
|
else if (entry.isFile() && entry.name.endsWith(".jsonl")) out.push(full);
|
|
75889
75890
|
}
|
|
@@ -75952,7 +75953,7 @@ function harvestCodexUsage(slot) {
|
|
|
75952
75953
|
for (const file of files) {
|
|
75953
75954
|
const records = readJsonl(file);
|
|
75954
75955
|
const extracted = extractCodexTokens(records);
|
|
75955
|
-
if (!extracted.cwd || !
|
|
75956
|
+
if (!extracted.cwd || !workspaceMatchesTarget(extracted.cwd, targets)) continue;
|
|
75956
75957
|
if (extracted.tokensInput + extracted.tokensOutput + extracted.tokensCacheRead === 0) continue;
|
|
75957
75958
|
const mtime = fs41.statSync(file).mtimeMs;
|
|
75958
75959
|
if (mtime >= bestMtime) {
|
|
@@ -75996,17 +75997,17 @@ function harvestEventsForSlot(slot) {
|
|
|
75996
75997
|
}
|
|
75997
75998
|
|
|
75998
75999
|
// src/core/control-persisted-usage.ts
|
|
75999
|
-
var
|
|
76000
|
+
var path44 = __toESM(require("path"));
|
|
76000
76001
|
|
|
76001
76002
|
// src/core/portal-watermark.ts
|
|
76002
76003
|
var fs42 = __toESM(require("fs"));
|
|
76003
76004
|
var os13 = __toESM(require("os"));
|
|
76004
|
-
var
|
|
76005
|
+
var path43 = __toESM(require("path"));
|
|
76005
76006
|
function getStatePath() {
|
|
76006
76007
|
if (process.env.HAR_PORTAL_SYNC_STATE_PATH) {
|
|
76007
|
-
return
|
|
76008
|
+
return path43.resolve(process.env.HAR_PORTAL_SYNC_STATE_PATH);
|
|
76008
76009
|
}
|
|
76009
|
-
return
|
|
76010
|
+
return path43.join(os13.homedir(), ".har", "portal-sync-state.json");
|
|
76010
76011
|
}
|
|
76011
76012
|
function readState() {
|
|
76012
76013
|
const statePath = getStatePath();
|
|
@@ -76020,7 +76021,7 @@ function readState() {
|
|
|
76020
76021
|
}
|
|
76021
76022
|
function writeState(state) {
|
|
76022
76023
|
const statePath = getStatePath();
|
|
76023
|
-
fs42.mkdirSync(
|
|
76024
|
+
fs42.mkdirSync(path43.dirname(statePath), { recursive: true });
|
|
76024
76025
|
fs42.writeFileSync(statePath, JSON.stringify(state, null, 2) + "\n");
|
|
76025
76026
|
}
|
|
76026
76027
|
function readPortalWatermark(repoPath, portalUrl) {
|
|
@@ -76072,8 +76073,8 @@ async function getJson(url) {
|
|
|
76072
76073
|
async function resolveControlRepoId(apiUrl, repoPath) {
|
|
76073
76074
|
const repos = await getJson(`${apiUrl}/api/repos`);
|
|
76074
76075
|
if (!Array.isArray(repos)) return null;
|
|
76075
|
-
const target =
|
|
76076
|
-
return repos.find((repo) =>
|
|
76076
|
+
const target = path44.resolve(repoPath);
|
|
76077
|
+
return repos.find((repo) => path44.resolve(repo.path) === target)?.id ?? null;
|
|
76077
76078
|
}
|
|
76078
76079
|
function optionalString(value) {
|
|
76079
76080
|
return value == null ? void 0 : value;
|
|
@@ -76376,7 +76377,7 @@ async function waitForControlApi(apiUrl = getControlApiUrl(), timeoutMs = 6e4, i
|
|
|
76376
76377
|
const deadline = Date.now() + timeoutMs;
|
|
76377
76378
|
while (Date.now() < deadline) {
|
|
76378
76379
|
if (await isControlApiReachable(apiUrl)) return true;
|
|
76379
|
-
await new Promise((
|
|
76380
|
+
await new Promise((resolve46) => setTimeout(resolve46, intervalMs));
|
|
76380
76381
|
}
|
|
76381
76382
|
return false;
|
|
76382
76383
|
}
|
|
@@ -76467,7 +76468,7 @@ async function syncRepoWithLocalControl(options) {
|
|
|
76467
76468
|
const listResponse = await fetch(`${apiUrl}/api/repos`);
|
|
76468
76469
|
if (!listResponse.ok) throw new Error("Failed to list repos from Control API");
|
|
76469
76470
|
const repos = await listResponse.json();
|
|
76470
|
-
const existing = repos.find((r2) =>
|
|
76471
|
+
const existing = repos.find((r2) => path45.resolve(r2.path) === repoPath);
|
|
76471
76472
|
if (!existing) {
|
|
76472
76473
|
return;
|
|
76473
76474
|
}
|
|
@@ -76671,7 +76672,7 @@ init_control_config();
|
|
|
76671
76672
|
|
|
76672
76673
|
// src/core/control-lifecycle.ts
|
|
76673
76674
|
var import_child_process9 = require("child_process");
|
|
76674
|
-
var
|
|
76675
|
+
var path46 = __toESM(require("path"));
|
|
76675
76676
|
|
|
76676
76677
|
// src/core/control-image.ts
|
|
76677
76678
|
var DEFAULT_CONTROL_IMAGE = "theosfactory/har-control";
|
|
@@ -76695,10 +76696,10 @@ var CONTROL_DATA_VOLUME = "har_control_data";
|
|
|
76695
76696
|
var CONTROL_CONTAINER_PORT = 3847;
|
|
76696
76697
|
var CONTROL_DATA_DB_URL = "file:/data/har_control.db";
|
|
76697
76698
|
function resolveControlDir() {
|
|
76698
|
-
return
|
|
76699
|
+
return path46.resolve(__dirname, "..", "control");
|
|
76699
76700
|
}
|
|
76700
76701
|
function resolveControlBuildContext() {
|
|
76701
|
-
return
|
|
76702
|
+
return path46.resolve(resolveControlDir(), "..");
|
|
76702
76703
|
}
|
|
76703
76704
|
function buildDockerRunArgs(options) {
|
|
76704
76705
|
const name = options.containerName ?? CONTROL_CONTAINER_NAME;
|
|
@@ -76754,7 +76755,7 @@ async function startMissionControl(options) {
|
|
|
76754
76755
|
"-t",
|
|
76755
76756
|
imageRef,
|
|
76756
76757
|
"-f",
|
|
76757
|
-
|
|
76758
|
+
path46.join(resolveControlDir(), "Dockerfile"),
|
|
76758
76759
|
resolveControlBuildContext()
|
|
76759
76760
|
]);
|
|
76760
76761
|
if (buildCode !== 0) {
|
|
@@ -76899,7 +76900,7 @@ async function ensureTelemetryInfrastructure(options) {
|
|
|
76899
76900
|
|
|
76900
76901
|
// src/core/run-service.ts
|
|
76901
76902
|
init_telemetry_config();
|
|
76902
|
-
var
|
|
76903
|
+
var path48 = __toESM(require("path"));
|
|
76903
76904
|
function extractShellOutput(result) {
|
|
76904
76905
|
const stdout = result.logs?.find((log) => log.stream === "stdout")?.content ?? result.logs?.find((log) => !log.stream)?.content ?? "";
|
|
76905
76906
|
const stderr = result.logs?.find((log) => log.stream === "stderr")?.content ?? "";
|
|
@@ -77102,12 +77103,12 @@ Usage from Cursor / Claude / Codex (@osfactory/otel-hook) will appear under Work
|
|
|
77102
77103
|
suffix: session.suffix,
|
|
77103
77104
|
createdAt: session.createdAt
|
|
77104
77105
|
});
|
|
77105
|
-
const envFile =
|
|
77106
|
+
const envFile = path48.join(session.workDir, `.env.agent.${options.agentId}`);
|
|
77106
77107
|
try {
|
|
77107
77108
|
appendTelemetryEnvToFile(envFile, {
|
|
77108
77109
|
sessionKey,
|
|
77109
77110
|
agentId: options.agentId,
|
|
77110
|
-
repoPath:
|
|
77111
|
+
repoPath: path48.resolve(options.repoPath),
|
|
77111
77112
|
workDir: session.workDir,
|
|
77112
77113
|
branch: session.branch,
|
|
77113
77114
|
suffix: session.suffix,
|
|
@@ -77345,7 +77346,7 @@ var readline6 = __toESM(require("readline"));
|
|
|
77345
77346
|
// src/core/hooks.ts
|
|
77346
77347
|
var fs44 = __toESM(require("fs"));
|
|
77347
77348
|
var os15 = __toESM(require("os"));
|
|
77348
|
-
var
|
|
77349
|
+
var path49 = __toESM(require("path"));
|
|
77349
77350
|
var MARKER_START = "# >>> har commit gate (managed by `har hooks`) >>>";
|
|
77350
77351
|
var MARKER_END = "# <<< har commit gate <<<";
|
|
77351
77352
|
var PRE_COMMIT_BLOCK = [
|
|
@@ -77370,7 +77371,7 @@ function resolveCheckoutRoot(cwd) {
|
|
|
77370
77371
|
function resolveHooksDir(checkoutDir) {
|
|
77371
77372
|
const hooksPath = tryGit3(checkoutDir, "rev-parse --git-path hooks");
|
|
77372
77373
|
if (!hooksPath) throw new Error(`Not a git checkout: ${checkoutDir}`);
|
|
77373
|
-
return
|
|
77374
|
+
return path49.resolve(checkoutDir, hooksPath);
|
|
77374
77375
|
}
|
|
77375
77376
|
function getConfiguredHooksPath(checkoutDir) {
|
|
77376
77377
|
return tryGit3(checkoutDir, "config core.hooksPath") || void 0;
|
|
@@ -77378,9 +77379,9 @@ function getConfiguredHooksPath(checkoutDir) {
|
|
|
77378
77379
|
function defaultHarInvocation() {
|
|
77379
77380
|
const entry = process.argv[1];
|
|
77380
77381
|
if (entry && entry.endsWith(".js")) {
|
|
77381
|
-
return `"${process.execPath}" "${
|
|
77382
|
+
return `"${process.execPath}" "${path49.resolve(entry)}"`;
|
|
77382
77383
|
}
|
|
77383
|
-
if (entry) return `"${
|
|
77384
|
+
if (entry) return `"${path49.resolve(entry)}"`;
|
|
77384
77385
|
return "har";
|
|
77385
77386
|
}
|
|
77386
77387
|
function buildHookScript(harInvocation, subcommand, failOpenNotice) {
|
|
@@ -77459,17 +77460,17 @@ Or re-run with --force to write into that directory anyway.`
|
|
|
77459
77460
|
fs44.mkdirSync(hooksDir, { recursive: true });
|
|
77460
77461
|
const invocation = options.harInvocation ?? defaultHarInvocation();
|
|
77461
77462
|
fs44.writeFileSync(
|
|
77462
|
-
|
|
77463
|
+
path49.join(hooksDir, "har-pre-commit"),
|
|
77463
77464
|
buildHookScript(invocation, "check", "har: binary not found; skipping commit gate (reinstall with har hooks install)"),
|
|
77464
77465
|
{ mode: 493 }
|
|
77465
77466
|
);
|
|
77466
77467
|
fs44.writeFileSync(
|
|
77467
|
-
|
|
77468
|
+
path49.join(hooksDir, "har-post-commit"),
|
|
77468
77469
|
buildHookScript(invocation, "record-commit", "har: binary not found; skipping commit association"),
|
|
77469
77470
|
{ mode: 493 }
|
|
77470
77471
|
);
|
|
77471
|
-
const preCommit = upsertMarkedBlock(
|
|
77472
|
-
const postCommit = upsertMarkedBlock(
|
|
77472
|
+
const preCommit = upsertMarkedBlock(path49.join(hooksDir, "pre-commit"), PRE_COMMIT_BLOCK);
|
|
77473
|
+
const postCommit = upsertMarkedBlock(path49.join(hooksDir, "post-commit"), POST_COMMIT_BLOCK);
|
|
77473
77474
|
ensureValidationsIgnored(checkout);
|
|
77474
77475
|
return { hooksDir, preCommit, postCommit };
|
|
77475
77476
|
}
|
|
@@ -77478,10 +77479,10 @@ function uninstallHooks(repoPath) {
|
|
|
77478
77479
|
if (!checkout) throw new Error(`Not a git repository: ${repoPath}`);
|
|
77479
77480
|
const hooksDir = resolveHooksDir(checkout);
|
|
77480
77481
|
let removed = false;
|
|
77481
|
-
removed = removeMarkedBlock(
|
|
77482
|
-
removed = removeMarkedBlock(
|
|
77482
|
+
removed = removeMarkedBlock(path49.join(hooksDir, "pre-commit")) || removed;
|
|
77483
|
+
removed = removeMarkedBlock(path49.join(hooksDir, "post-commit")) || removed;
|
|
77483
77484
|
for (const file of ["har-pre-commit", "har-post-commit"]) {
|
|
77484
|
-
const full =
|
|
77485
|
+
const full = path49.join(hooksDir, file);
|
|
77485
77486
|
if (fs44.existsSync(full)) {
|
|
77486
77487
|
fs44.rmSync(full);
|
|
77487
77488
|
removed = true;
|
|
@@ -77502,10 +77503,10 @@ function isAgentWorktree(checkoutDir) {
|
|
|
77502
77503
|
if (branch && (/^har-agent-\d+$/.test(branch) || /-har-agent-\d+-[a-z0-9]+$/.test(branch))) {
|
|
77503
77504
|
return true;
|
|
77504
77505
|
}
|
|
77505
|
-
const worktreesRoot =
|
|
77506
|
-
const resolved =
|
|
77507
|
-
const name =
|
|
77508
|
-
return resolved.startsWith(`${worktreesRoot}${
|
|
77506
|
+
const worktreesRoot = path49.join(os15.homedir(), "worktrees");
|
|
77507
|
+
const resolved = path49.resolve(checkoutDir);
|
|
77508
|
+
const name = path49.basename(resolved);
|
|
77509
|
+
return resolved.startsWith(`${worktreesRoot}${path49.sep}`) && (/-agent-\d+$/.test(name) || /-har-agent-\d+-[a-z0-9]+$/.test(name));
|
|
77509
77510
|
}
|
|
77510
77511
|
function resolveEffectiveMode(checkoutDir, gate) {
|
|
77511
77512
|
if (!gate.enabled) return "off";
|
|
@@ -77518,15 +77519,15 @@ function getHooksStatus(repoPath) {
|
|
|
77518
77519
|
const hooksDir = resolveHooksDir(checkout);
|
|
77519
77520
|
const gate = getCommitGateConfig(checkout);
|
|
77520
77521
|
const hasBlock = (name) => {
|
|
77521
|
-
const file =
|
|
77522
|
+
const file = path49.join(hooksDir, name);
|
|
77522
77523
|
return fs44.existsSync(file) && fs44.readFileSync(file, "utf8").includes(MARKER_START);
|
|
77523
77524
|
};
|
|
77524
77525
|
return {
|
|
77525
77526
|
checkout,
|
|
77526
77527
|
hooksDir,
|
|
77527
77528
|
configuredHooksPath: getConfiguredHooksPath(checkout),
|
|
77528
|
-
preCommitInstalled: hasBlock("pre-commit") && fs44.existsSync(
|
|
77529
|
-
postCommitInstalled: hasBlock("post-commit") && fs44.existsSync(
|
|
77529
|
+
preCommitInstalled: hasBlock("pre-commit") && fs44.existsSync(path49.join(hooksDir, "har-pre-commit")),
|
|
77530
|
+
postCommitInstalled: hasBlock("post-commit") && fs44.existsSync(path49.join(hooksDir, "har-post-commit")),
|
|
77530
77531
|
gate,
|
|
77531
77532
|
effectiveMode: resolveEffectiveMode(checkout, gate)
|
|
77532
77533
|
};
|
|
@@ -77537,7 +77538,7 @@ function checkCommitGate(cwd) {
|
|
|
77537
77538
|
}
|
|
77538
77539
|
const checkout = resolveCheckoutRoot(cwd);
|
|
77539
77540
|
if (!checkout) return { exitCode: 0, messages: [] };
|
|
77540
|
-
if (!fs44.existsSync(
|
|
77541
|
+
if (!fs44.existsSync(path49.join(checkout, ".har", "stages.json"))) {
|
|
77541
77542
|
return { exitCode: 0, messages: [] };
|
|
77542
77543
|
}
|
|
77543
77544
|
const gate = getCommitGateConfig(checkout);
|
|
@@ -77610,12 +77611,12 @@ async function recordCommitAssociation(cwd) {
|
|
|
77610
77611
|
// src/core/commit-gate-onboarding.ts
|
|
77611
77612
|
function askYesNo5(question) {
|
|
77612
77613
|
const rl = readline6.createInterface({ input: process.stdin, output: process.stderr });
|
|
77613
|
-
return new Promise((
|
|
77614
|
+
return new Promise((resolve46) => {
|
|
77614
77615
|
process.stderr.write(`${question} `);
|
|
77615
77616
|
rl.once("line", (answer) => {
|
|
77616
77617
|
rl.close();
|
|
77617
77618
|
const trimmed = answer.trim();
|
|
77618
|
-
|
|
77619
|
+
resolve46(trimmed === "" || /^y(es)?$/i.test(trimmed));
|
|
77619
77620
|
});
|
|
77620
77621
|
});
|
|
77621
77622
|
}
|
|
@@ -77659,12 +77660,12 @@ async function handleCommitGateOnboarding(options) {
|
|
|
77659
77660
|
// src/core/onboarding-preferences.ts
|
|
77660
77661
|
var fs45 = __toESM(require("fs"));
|
|
77661
77662
|
var os16 = __toESM(require("os"));
|
|
77662
|
-
var
|
|
77663
|
+
var path50 = __toESM(require("path"));
|
|
77663
77664
|
function getOnboardingPreferencesPath() {
|
|
77664
77665
|
if (process.env.HAR_PREFERENCES_PATH) {
|
|
77665
|
-
return
|
|
77666
|
+
return path50.resolve(process.env.HAR_PREFERENCES_PATH);
|
|
77666
77667
|
}
|
|
77667
|
-
return
|
|
77668
|
+
return path50.join(os16.homedir(), ".har", "preferences.json");
|
|
77668
77669
|
}
|
|
77669
77670
|
function readOnboardingPreferences() {
|
|
77670
77671
|
const preferencePath = getOnboardingPreferencesPath();
|
|
@@ -77695,7 +77696,7 @@ function writeOnboardingPreferences(overrides) {
|
|
|
77695
77696
|
};
|
|
77696
77697
|
const parsed = OnboardingPreferencesSchema.parse(preference);
|
|
77697
77698
|
const preferencePath = getOnboardingPreferencesPath();
|
|
77698
|
-
fs45.mkdirSync(
|
|
77699
|
+
fs45.mkdirSync(path50.dirname(preferencePath), { recursive: true });
|
|
77699
77700
|
fs45.writeFileSync(preferencePath, `${JSON.stringify(parsed, null, 2)}
|
|
77700
77701
|
`);
|
|
77701
77702
|
return parsed;
|
|
@@ -77984,7 +77985,7 @@ var envCommand = {
|
|
|
77984
77985
|
}
|
|
77985
77986
|
};
|
|
77986
77987
|
async function handleInit(argv) {
|
|
77987
|
-
const repoPath =
|
|
77988
|
+
const repoPath = path51.resolve(argv.repo);
|
|
77988
77989
|
const onboarding = resolveOnboardingOptions(argv);
|
|
77989
77990
|
header("har env init");
|
|
77990
77991
|
info(`Repository: ${repoPath}`);
|
|
@@ -78047,7 +78048,7 @@ async function handleInit(argv) {
|
|
|
78047
78048
|
}
|
|
78048
78049
|
}
|
|
78049
78050
|
async function handleMaintain(argv) {
|
|
78050
|
-
const repoPath =
|
|
78051
|
+
const repoPath = path51.resolve(argv.repo);
|
|
78051
78052
|
const onboarding = resolveOnboardingOptions(argv);
|
|
78052
78053
|
header("har env maintain");
|
|
78053
78054
|
info(`Repository: ${repoPath}`);
|
|
@@ -78169,7 +78170,7 @@ async function handleAgentMdProposal(repoPath, autoYes) {
|
|
|
78169
78170
|
if (autoYes) {
|
|
78170
78171
|
const proposal = readAgentMdProposal(repoPath);
|
|
78171
78172
|
if (proposal) {
|
|
78172
|
-
writeFileSafe(
|
|
78173
|
+
writeFileSafe(path51.join(repoPath, "AGENT.md"), proposal.content);
|
|
78173
78174
|
clearAgentMdProposal(repoPath);
|
|
78174
78175
|
info("Applied AGENT.md proposal (--yes)");
|
|
78175
78176
|
}
|
|
@@ -78178,7 +78179,7 @@ async function handleAgentMdProposal(repoPath, autoYes) {
|
|
|
78178
78179
|
await promptApplyAgentMdProposal(repoPath);
|
|
78179
78180
|
}
|
|
78180
78181
|
async function handleAddPlugin(argv) {
|
|
78181
|
-
const repoPath =
|
|
78182
|
+
const repoPath = path51.resolve(argv.repo);
|
|
78182
78183
|
const available = listPluginIds();
|
|
78183
78184
|
if (argv.list) {
|
|
78184
78185
|
for (const id of available) {
|
|
@@ -78216,7 +78217,7 @@ async function handleAddPlugin(argv) {
|
|
|
78216
78217
|
}
|
|
78217
78218
|
}
|
|
78218
78219
|
async function handleAddStage(argv) {
|
|
78219
|
-
const repoPath =
|
|
78220
|
+
const repoPath = path51.resolve(argv.repo);
|
|
78220
78221
|
const available = listPluginIds();
|
|
78221
78222
|
if (argv.list) {
|
|
78222
78223
|
warn("har env add-stage --list is deprecated; prefer: har env add-plugin --list");
|
|
@@ -78282,7 +78283,7 @@ async function handleAddStage(argv) {
|
|
|
78282
78283
|
});
|
|
78283
78284
|
}
|
|
78284
78285
|
async function handlePreflight(argv) {
|
|
78285
|
-
const repo =
|
|
78286
|
+
const repo = path51.resolve(argv.repo);
|
|
78286
78287
|
const agentId = validateAgentId(argv.id, repo);
|
|
78287
78288
|
const result = await preflightEnvironment({
|
|
78288
78289
|
repoPath: repo,
|
|
@@ -78298,7 +78299,7 @@ async function handlePreflight(argv) {
|
|
|
78298
78299
|
process.exit(result.code);
|
|
78299
78300
|
}
|
|
78300
78301
|
async function handleLaunch(argv) {
|
|
78301
|
-
const repo =
|
|
78302
|
+
const repo = path51.resolve(argv.repo);
|
|
78302
78303
|
const agentId = validateAgentId(argv.id, repo);
|
|
78303
78304
|
if (!argv.resume) {
|
|
78304
78305
|
const guard = checkLaunchGuard2(repo, agentId, {});
|
|
@@ -78353,7 +78354,7 @@ async function handleRecover(argv) {
|
|
|
78353
78354
|
});
|
|
78354
78355
|
}
|
|
78355
78356
|
async function handleVerify(argv) {
|
|
78356
|
-
const repo =
|
|
78357
|
+
const repo = path51.resolve(argv.repo);
|
|
78357
78358
|
const agentId = validateAgentId(argv.id, repo);
|
|
78358
78359
|
const result = await runVerification({
|
|
78359
78360
|
repoPath: repo,
|
|
@@ -78365,7 +78366,7 @@ async function handleVerify(argv) {
|
|
|
78365
78366
|
process.exit(result.code);
|
|
78366
78367
|
}
|
|
78367
78368
|
async function handleTeardown(argv) {
|
|
78368
|
-
const repo =
|
|
78369
|
+
const repo = path51.resolve(argv.repo);
|
|
78369
78370
|
const agentId = validateAgentId(argv.id, repo);
|
|
78370
78371
|
const result = await teardownEnvironment({
|
|
78371
78372
|
repoPath: repo,
|
|
@@ -78376,7 +78377,7 @@ async function handleTeardown(argv) {
|
|
|
78376
78377
|
process.exit(result.code);
|
|
78377
78378
|
}
|
|
78378
78379
|
async function handleComplete(argv) {
|
|
78379
|
-
const repo =
|
|
78380
|
+
const repo = path51.resolve(argv.repo);
|
|
78380
78381
|
const agentId = validateAgentId(argv.id, repo);
|
|
78381
78382
|
const result = await completeEnvironment({
|
|
78382
78383
|
repoPath: repo,
|
|
@@ -78397,7 +78398,7 @@ async function handleComplete(argv) {
|
|
|
78397
78398
|
process.exit(result.code);
|
|
78398
78399
|
}
|
|
78399
78400
|
async function handleStatus(argv) {
|
|
78400
|
-
const repoPath =
|
|
78401
|
+
const repoPath = path51.resolve(argv.repo);
|
|
78401
78402
|
if (argv.json) {
|
|
78402
78403
|
const status = collectEnvironmentStatus(repoPath);
|
|
78403
78404
|
const output = EnvironmentStatusSchema.parse(status);
|
|
@@ -78410,7 +78411,7 @@ async function handleStatus(argv) {
|
|
|
78410
78411
|
});
|
|
78411
78412
|
}
|
|
78412
78413
|
async function handleRunsList(argv) {
|
|
78413
|
-
const repoPath =
|
|
78414
|
+
const repoPath = path51.resolve(argv.repo);
|
|
78414
78415
|
const runs = listRuns(repoPath, { stageId: argv.stage, limit: argv.limit });
|
|
78415
78416
|
if (argv.json) {
|
|
78416
78417
|
process.stdout.write(JSON.stringify({ runs }, null, 2) + "\n");
|
|
@@ -78427,7 +78428,7 @@ async function handleRunsList(argv) {
|
|
|
78427
78428
|
}
|
|
78428
78429
|
}
|
|
78429
78430
|
async function handleRunsGet(argv) {
|
|
78430
|
-
const run2 = getRun(
|
|
78431
|
+
const run2 = getRun(path51.resolve(argv.repo), argv.runId);
|
|
78431
78432
|
if (!run2) {
|
|
78432
78433
|
error(`Run not found: ${argv.runId}`);
|
|
78433
78434
|
process.exit(1);
|
|
@@ -78513,7 +78514,7 @@ function printNextSteps(auto2) {
|
|
|
78513
78514
|
}
|
|
78514
78515
|
|
|
78515
78516
|
// src/cli/commands/control.ts
|
|
78516
|
-
var
|
|
78517
|
+
var path55 = __toESM(require("path"));
|
|
78517
78518
|
|
|
78518
78519
|
// node_modules/@inquirer/core/dist/esm/lib/key.mjs
|
|
78519
78520
|
var isUpKey = (key) => (
|
|
@@ -79533,13 +79534,13 @@ var PromisePolyfill = class extends Promise {
|
|
|
79533
79534
|
// Available starting from Node 22
|
|
79534
79535
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
79535
79536
|
static withResolver() {
|
|
79536
|
-
let
|
|
79537
|
+
let resolve46;
|
|
79537
79538
|
let reject;
|
|
79538
79539
|
const promise = new Promise((res, rej) => {
|
|
79539
|
-
|
|
79540
|
+
resolve46 = res;
|
|
79540
79541
|
reject = rej;
|
|
79541
79542
|
});
|
|
79542
|
-
return { promise, resolve:
|
|
79543
|
+
return { promise, resolve: resolve46, reject };
|
|
79543
79544
|
}
|
|
79544
79545
|
};
|
|
79545
79546
|
|
|
@@ -79556,7 +79557,7 @@ function createPrompt(view) {
|
|
|
79556
79557
|
output
|
|
79557
79558
|
});
|
|
79558
79559
|
const screen = new ScreenManager(rl);
|
|
79559
|
-
const { promise, resolve:
|
|
79560
|
+
const { promise, resolve: resolve46, reject } = PromisePolyfill.withResolver();
|
|
79560
79561
|
const cancel = () => reject(new CancelPromptError());
|
|
79561
79562
|
if (signal) {
|
|
79562
79563
|
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
@@ -79580,7 +79581,7 @@ function createPrompt(view) {
|
|
|
79580
79581
|
cycle(() => {
|
|
79581
79582
|
try {
|
|
79582
79583
|
const nextView = view(config2, (value) => {
|
|
79583
|
-
setImmediate(() =>
|
|
79584
|
+
setImmediate(() => resolve46(value));
|
|
79584
79585
|
});
|
|
79585
79586
|
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
79586
79587
|
screen.render(content, bottomContent);
|
|
@@ -80567,9 +80568,9 @@ var import_run_async = __toESM(require_run_async(), 1);
|
|
|
80567
80568
|
var import_mute_stream2 = __toESM(require_lib3(), 1);
|
|
80568
80569
|
var import_ansi_escapes5 = __toESM(require_ansi_escapes(), 1);
|
|
80569
80570
|
var _2 = {
|
|
80570
|
-
set: (obj,
|
|
80571
|
+
set: (obj, path62 = "", value) => {
|
|
80571
80572
|
let pointer = obj;
|
|
80572
|
-
|
|
80573
|
+
path62.split(".").forEach((key, index, arr) => {
|
|
80573
80574
|
if (key === "__proto__" || key === "constructor")
|
|
80574
80575
|
return;
|
|
80575
80576
|
if (index === arr.length - 1) {
|
|
@@ -80580,8 +80581,8 @@ var _2 = {
|
|
|
80580
80581
|
pointer = pointer[key];
|
|
80581
80582
|
});
|
|
80582
80583
|
},
|
|
80583
|
-
get: (obj,
|
|
80584
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
80584
|
+
get: (obj, path62 = "", defaultValue) => {
|
|
80585
|
+
const travel = (regexp) => String.prototype.split.call(path62, regexp).filter(Boolean).reduce(
|
|
80585
80586
|
// @ts-expect-error implicit any on res[key]
|
|
80586
80587
|
(res, key) => res !== null && res !== void 0 ? res[key] : res,
|
|
80587
80588
|
obj
|
|
@@ -80695,7 +80696,7 @@ var PromptsRunner = class {
|
|
|
80695
80696
|
throw new Error(`Prompt for type ${question.type} not found`);
|
|
80696
80697
|
}
|
|
80697
80698
|
let cleanupSignal;
|
|
80698
|
-
const promptFn = isPromptConstructor(prompt2) ? (q2, { signal: signal2 } = {}) => new Promise((
|
|
80699
|
+
const promptFn = isPromptConstructor(prompt2) ? (q2, { signal: signal2 } = {}) => new Promise((resolve46, reject) => {
|
|
80699
80700
|
const rl = import_node_readline.default.createInterface(setupReadlineOptions(this.opt));
|
|
80700
80701
|
rl.resume();
|
|
80701
80702
|
const onClose = () => {
|
|
@@ -80731,7 +80732,7 @@ var PromptsRunner = class {
|
|
|
80731
80732
|
cleanupSignal = void 0;
|
|
80732
80733
|
};
|
|
80733
80734
|
}
|
|
80734
|
-
activePrompt.run().then(
|
|
80735
|
+
activePrompt.run().then(resolve46, reject).finally(cleanup);
|
|
80735
80736
|
}) : prompt2;
|
|
80736
80737
|
const { signal: moduleSignal } = this.opt;
|
|
80737
80738
|
if (moduleSignal?.aborted) {
|
|
@@ -80835,12 +80836,12 @@ init_control_config();
|
|
|
80835
80836
|
// src/core/control-sync-selection.ts
|
|
80836
80837
|
var fs46 = __toESM(require("fs"));
|
|
80837
80838
|
var os17 = __toESM(require("os"));
|
|
80838
|
-
var
|
|
80839
|
+
var path52 = __toESM(require("path"));
|
|
80839
80840
|
function getSelectionPath() {
|
|
80840
80841
|
if (process.env.HAR_CONTROL_SYNC_SELECTION_PATH) {
|
|
80841
|
-
return
|
|
80842
|
+
return path52.resolve(process.env.HAR_CONTROL_SYNC_SELECTION_PATH);
|
|
80842
80843
|
}
|
|
80843
|
-
return
|
|
80844
|
+
return path52.join(os17.homedir(), ".har", "sync-selection.json");
|
|
80844
80845
|
}
|
|
80845
80846
|
function readSyncSelection() {
|
|
80846
80847
|
const selectionPath = getSelectionPath();
|
|
@@ -80856,7 +80857,7 @@ function readSyncSelection() {
|
|
|
80856
80857
|
function writeSyncSelection(repos) {
|
|
80857
80858
|
const selectionPath = getSelectionPath();
|
|
80858
80859
|
const canonical = Array.from(new Set(repos.map((repoPath) => canonicalizeControlRepoPath(repoPath))));
|
|
80859
|
-
fs46.mkdirSync(
|
|
80860
|
+
fs46.mkdirSync(path52.dirname(selectionPath), { recursive: true });
|
|
80860
80861
|
fs46.writeFileSync(selectionPath, JSON.stringify({ repos: canonical }, null, 2) + "\n");
|
|
80861
80862
|
}
|
|
80862
80863
|
function resolveSyncSelection(input) {
|
|
@@ -80904,7 +80905,7 @@ function openBrowser(url) {
|
|
|
80904
80905
|
}
|
|
80905
80906
|
async function loginViaBrowser(portalUrl, openUrl = openBrowser) {
|
|
80906
80907
|
const state = (0, import_crypto.randomUUID)();
|
|
80907
|
-
return new Promise((
|
|
80908
|
+
return new Promise((resolve46, reject) => {
|
|
80908
80909
|
let timer;
|
|
80909
80910
|
const server = http.createServer((req, res) => {
|
|
80910
80911
|
const requestUrl = new URL(req.url ?? "", "http://127.0.0.1");
|
|
@@ -80927,7 +80928,7 @@ async function loginViaBrowser(portalUrl, openUrl = openBrowser) {
|
|
|
80927
80928
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
80928
80929
|
res.end("<h1>Logged in</h1><p>You can close this tab and return to the terminal.</p>");
|
|
80929
80930
|
cleanup();
|
|
80930
|
-
|
|
80931
|
+
resolve46({ portalUrl, token, workspace, email: email2, createdAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
80931
80932
|
});
|
|
80932
80933
|
const cleanup = () => {
|
|
80933
80934
|
clearTimeout(timer);
|
|
@@ -80955,13 +80956,13 @@ If your browser did not open, paste that URL.
|
|
|
80955
80956
|
|
|
80956
80957
|
// src/core/control-unregister.ts
|
|
80957
80958
|
var fs47 = __toESM(require("fs"));
|
|
80958
|
-
var
|
|
80959
|
+
var path53 = __toESM(require("path"));
|
|
80959
80960
|
init_control_config();
|
|
80960
80961
|
function listUnregisterWorktreeCandidates(repoPath) {
|
|
80961
80962
|
const harnessRoot = canonicalizeControlRepoPath(repoPath);
|
|
80962
80963
|
const byPath = /* @__PURE__ */ new Map();
|
|
80963
80964
|
const add = (partial2) => {
|
|
80964
|
-
const resolved =
|
|
80965
|
+
const resolved = path53.resolve(partial2.worktreePath);
|
|
80965
80966
|
if (!resolved || resolved === harnessRoot) return;
|
|
80966
80967
|
const exists = partial2.exists ?? fs47.existsSync(resolved);
|
|
80967
80968
|
const prev = byPath.get(resolved);
|
|
@@ -81014,8 +81015,8 @@ async function askYesNo6(question) {
|
|
|
81014
81015
|
if (!process.stdin.isTTY || !process.stdout.isTTY) return false;
|
|
81015
81016
|
const readline10 = await import("readline");
|
|
81016
81017
|
const rl = readline10.createInterface({ input: process.stdin, output: process.stderr });
|
|
81017
|
-
const answer = await new Promise((
|
|
81018
|
-
rl.question(question,
|
|
81018
|
+
const answer = await new Promise((resolve46) => {
|
|
81019
|
+
rl.question(question, resolve46);
|
|
81019
81020
|
});
|
|
81020
81021
|
rl.close();
|
|
81021
81022
|
return /^[Yy]$/.test(answer.trim());
|
|
@@ -81161,15 +81162,15 @@ init_control_config();
|
|
|
81161
81162
|
|
|
81162
81163
|
// src/core/harness-scrub.ts
|
|
81163
81164
|
var fs48 = __toESM(require("fs"));
|
|
81164
|
-
var
|
|
81165
|
+
var path54 = __toESM(require("path"));
|
|
81165
81166
|
var HARNESS_SCRUB_DIRS = ["runs", "validations", "state", "slots"];
|
|
81166
81167
|
function scrubLocalHarnessDirs(repoPath) {
|
|
81167
81168
|
const results = [];
|
|
81168
|
-
const resolved =
|
|
81169
|
+
const resolved = path54.resolve(repoPath);
|
|
81169
81170
|
if (!fs48.existsSync(resolved)) {
|
|
81170
81171
|
for (const directory of HARNESS_SCRUB_DIRS) {
|
|
81171
81172
|
results.push({
|
|
81172
|
-
path:
|
|
81173
|
+
path: path54.join(resolved, ".har", directory),
|
|
81173
81174
|
directory,
|
|
81174
81175
|
deleted: false,
|
|
81175
81176
|
error: "repository path does not exist"
|
|
@@ -81178,7 +81179,7 @@ function scrubLocalHarnessDirs(repoPath) {
|
|
|
81178
81179
|
return results;
|
|
81179
81180
|
}
|
|
81180
81181
|
for (const directory of HARNESS_SCRUB_DIRS) {
|
|
81181
|
-
const target =
|
|
81182
|
+
const target = path54.join(resolved, ".har", directory);
|
|
81182
81183
|
if (!fs48.existsSync(target)) {
|
|
81183
81184
|
results.push({ path: target, directory, deleted: true });
|
|
81184
81185
|
continue;
|
|
@@ -81206,7 +81207,7 @@ function scrubLocalHarnessForRepos(repoPaths) {
|
|
|
81206
81207
|
const results = [];
|
|
81207
81208
|
const seen = /* @__PURE__ */ new Set();
|
|
81208
81209
|
for (const repoPath of repoPaths) {
|
|
81209
|
-
const key =
|
|
81210
|
+
const key = path54.resolve(repoPath);
|
|
81210
81211
|
if (seen.has(key)) continue;
|
|
81211
81212
|
seen.add(key);
|
|
81212
81213
|
results.push(...scrubLocalHarnessDirs(key));
|
|
@@ -81219,8 +81220,8 @@ async function askYesNo7(question) {
|
|
|
81219
81220
|
if (!process.stdin.isTTY || !process.stdout.isTTY) return false;
|
|
81220
81221
|
const readline10 = await import("readline");
|
|
81221
81222
|
const rl = readline10.createInterface({ input: process.stdin, output: process.stderr });
|
|
81222
|
-
const answer = await new Promise((
|
|
81223
|
-
rl.question(question,
|
|
81223
|
+
const answer = await new Promise((resolve46) => {
|
|
81224
|
+
rl.question(question, resolve46);
|
|
81224
81225
|
});
|
|
81225
81226
|
rl.close();
|
|
81226
81227
|
return /^[Yy]$/.test(answer.trim());
|
|
@@ -81465,7 +81466,7 @@ async function handleDown() {
|
|
|
81465
81466
|
process.exit(code);
|
|
81466
81467
|
}
|
|
81467
81468
|
async function handleRegister(argv) {
|
|
81468
|
-
const repoPath =
|
|
81469
|
+
const repoPath = path55.resolve(argv.repo);
|
|
81469
81470
|
header("har control register");
|
|
81470
81471
|
info(`Repository: ${repoPath}`);
|
|
81471
81472
|
try {
|
|
@@ -81557,7 +81558,7 @@ async function handleReset(argv) {
|
|
|
81557
81558
|
}
|
|
81558
81559
|
}
|
|
81559
81560
|
async function handleUnregister(argv) {
|
|
81560
|
-
const repoPath =
|
|
81561
|
+
const repoPath = path55.resolve(argv.repo);
|
|
81561
81562
|
const worktrees = listUnregisterWorktreeCandidates(repoPath);
|
|
81562
81563
|
try {
|
|
81563
81564
|
let deleteWorktrees = argv.deleteWorktrees;
|
|
@@ -81718,7 +81719,7 @@ async function handleWatch(argv) {
|
|
|
81718
81719
|
};
|
|
81719
81720
|
const tick = async () => {
|
|
81720
81721
|
if (argv.repo) {
|
|
81721
|
-
await syncOne(
|
|
81722
|
+
await syncOne(path55.resolve(argv.repo));
|
|
81722
81723
|
return;
|
|
81723
81724
|
}
|
|
81724
81725
|
try {
|
|
@@ -81768,11 +81769,11 @@ async function handleLogin(argv) {
|
|
|
81768
81769
|
}
|
|
81769
81770
|
|
|
81770
81771
|
// src/cli/commands/hooks.ts
|
|
81771
|
-
var
|
|
81772
|
+
var path57 = __toESM(require("path"));
|
|
81772
81773
|
|
|
81773
81774
|
// src/core/claude-hooks.ts
|
|
81774
81775
|
var fs49 = __toESM(require("fs"));
|
|
81775
|
-
var
|
|
81776
|
+
var path56 = __toESM(require("path"));
|
|
81776
81777
|
var CLAUDE_GUARD_RELATIVE_PATH = ".har/hooks/claude-worktree-guard.sh";
|
|
81777
81778
|
var CLAUDE_SETTINGS_RELATIVE_PATH = ".claude/settings.json";
|
|
81778
81779
|
var GUARD_MATCHER = "Edit|Write|MultiEdit|NotebookEdit";
|
|
@@ -81793,7 +81794,7 @@ function readSettings(settingsPath) {
|
|
|
81793
81794
|
return parsed;
|
|
81794
81795
|
}
|
|
81795
81796
|
function writeSettings(settingsPath, settings) {
|
|
81796
|
-
fs49.mkdirSync(
|
|
81797
|
+
fs49.mkdirSync(path56.dirname(settingsPath), { recursive: true });
|
|
81797
81798
|
fs49.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
81798
81799
|
}
|
|
81799
81800
|
function installClaudeGuard(repoPath) {
|
|
@@ -81801,11 +81802,11 @@ function installClaudeGuard(repoPath) {
|
|
|
81801
81802
|
if (!templatePath) {
|
|
81802
81803
|
throw new Error("Guard template not found (claude-worktree-guard.sh.template). Run npm run build.");
|
|
81803
81804
|
}
|
|
81804
|
-
const guardScript =
|
|
81805
|
-
fs49.mkdirSync(
|
|
81805
|
+
const guardScript = path56.join(repoPath, CLAUDE_GUARD_RELATIVE_PATH);
|
|
81806
|
+
fs49.mkdirSync(path56.dirname(guardScript), { recursive: true });
|
|
81806
81807
|
fs49.copyFileSync(templatePath, guardScript);
|
|
81807
81808
|
fs49.chmodSync(guardScript, 493);
|
|
81808
|
-
const settingsPath =
|
|
81809
|
+
const settingsPath = path56.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
|
|
81809
81810
|
const settings = readSettings(settingsPath);
|
|
81810
81811
|
const hooks = settings.hooks ?? {};
|
|
81811
81812
|
const preToolUse = (hooks.PreToolUse ?? []).filter((entry) => !isHarGuardEntry(entry));
|
|
@@ -81819,14 +81820,14 @@ function installClaudeGuard(repoPath) {
|
|
|
81819
81820
|
}
|
|
81820
81821
|
function uninstallClaudeGuard(repoPath) {
|
|
81821
81822
|
let removed = false;
|
|
81822
|
-
const guardScript =
|
|
81823
|
+
const guardScript = path56.join(repoPath, CLAUDE_GUARD_RELATIVE_PATH);
|
|
81823
81824
|
if (fs49.existsSync(guardScript)) {
|
|
81824
81825
|
fs49.rmSync(guardScript);
|
|
81825
81826
|
removed = true;
|
|
81826
|
-
const parent =
|
|
81827
|
+
const parent = path56.dirname(guardScript);
|
|
81827
81828
|
if (fs49.existsSync(parent) && fs49.readdirSync(parent).length === 0) fs49.rmdirSync(parent);
|
|
81828
81829
|
}
|
|
81829
|
-
const settingsPath =
|
|
81830
|
+
const settingsPath = path56.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
|
|
81830
81831
|
if (fs49.existsSync(settingsPath)) {
|
|
81831
81832
|
const settings = readSettings(settingsPath);
|
|
81832
81833
|
const preToolUse = settings.hooks?.PreToolUse;
|
|
@@ -81852,7 +81853,7 @@ function uninstallClaudeGuard(repoPath) {
|
|
|
81852
81853
|
return { removed };
|
|
81853
81854
|
}
|
|
81854
81855
|
function claudeGuardInstalled(repoPath) {
|
|
81855
|
-
const settingsPath =
|
|
81856
|
+
const settingsPath = path56.join(repoPath, CLAUDE_SETTINGS_RELATIVE_PATH);
|
|
81856
81857
|
if (!fs49.existsSync(settingsPath)) return false;
|
|
81857
81858
|
try {
|
|
81858
81859
|
const settings = readSettings(settingsPath);
|
|
@@ -81869,7 +81870,7 @@ function repoOption(y2) {
|
|
|
81869
81870
|
function handleInstall2(argv) {
|
|
81870
81871
|
try {
|
|
81871
81872
|
if (argv.claude) {
|
|
81872
|
-
const result2 = installClaudeGuard(
|
|
81873
|
+
const result2 = installClaudeGuard(path57.resolve(argv.repo));
|
|
81873
81874
|
success("Claude Code worktree guard installed.");
|
|
81874
81875
|
info(`Guard script: ${result2.guardScript}`);
|
|
81875
81876
|
info(`Settings: ${result2.settingsPath} (PreToolUse: Edit|Write|MultiEdit|NotebookEdit)`);
|
|
@@ -81877,7 +81878,7 @@ function handleInstall2(argv) {
|
|
|
81877
81878
|
info("Commit both files so the guard travels with the repo.");
|
|
81878
81879
|
return;
|
|
81879
81880
|
}
|
|
81880
|
-
const result = installHooks({ repoPath:
|
|
81881
|
+
const result = installHooks({ repoPath: path57.resolve(argv.repo), force: argv.force });
|
|
81881
81882
|
success(`Commit gate installed in ${result.hooksDir}`);
|
|
81882
81883
|
info(`pre-commit: ${result.preCommit}, post-commit: ${result.postCommit}`);
|
|
81883
81884
|
info("Commits of unverified change batches will be blocked in agent worktrees.");
|
|
@@ -81890,7 +81891,7 @@ function handleInstall2(argv) {
|
|
|
81890
81891
|
function handleUninstall(argv) {
|
|
81891
81892
|
try {
|
|
81892
81893
|
if (argv.claude) {
|
|
81893
|
-
const result2 = uninstallClaudeGuard(
|
|
81894
|
+
const result2 = uninstallClaudeGuard(path57.resolve(argv.repo));
|
|
81894
81895
|
if (result2.removed) {
|
|
81895
81896
|
success("Claude Code worktree guard removed.");
|
|
81896
81897
|
} else {
|
|
@@ -81898,7 +81899,7 @@ function handleUninstall(argv) {
|
|
|
81898
81899
|
}
|
|
81899
81900
|
return;
|
|
81900
81901
|
}
|
|
81901
|
-
const result = uninstallHooks(
|
|
81902
|
+
const result = uninstallHooks(path57.resolve(argv.repo));
|
|
81902
81903
|
if (result.removed) {
|
|
81903
81904
|
success(`Commit gate removed from ${result.hooksDir}`);
|
|
81904
81905
|
} else {
|
|
@@ -81911,7 +81912,7 @@ function handleUninstall(argv) {
|
|
|
81911
81912
|
}
|
|
81912
81913
|
function handleStatus2(argv) {
|
|
81913
81914
|
try {
|
|
81914
|
-
const status = getHooksStatus(
|
|
81915
|
+
const status = getHooksStatus(path57.resolve(argv.repo));
|
|
81915
81916
|
if (argv.json) {
|
|
81916
81917
|
process.stdout.write(`${JSON.stringify(status, null, 2)}
|
|
81917
81918
|
`);
|
|
@@ -81929,7 +81930,7 @@ function handleStatus2(argv) {
|
|
|
81929
81930
|
);
|
|
81930
81931
|
info(`Effective: ${status.effectiveMode} (in this checkout)`);
|
|
81931
81932
|
info(
|
|
81932
|
-
`Claude guard: ${claudeGuardInstalled(
|
|
81933
|
+
`Claude guard: ${claudeGuardInstalled(path57.resolve(argv.repo)) ? `installed (${CLAUDE_GUARD_RELATIVE_PATH})` : "not installed"}`
|
|
81933
81934
|
);
|
|
81934
81935
|
} catch (err) {
|
|
81935
81936
|
error(err instanceof Error ? err.message : String(err));
|
|
@@ -82190,10 +82191,10 @@ function assignProp(target, prop, value) {
|
|
|
82190
82191
|
configurable: true
|
|
82191
82192
|
});
|
|
82192
82193
|
}
|
|
82193
|
-
function getElementAtPath(obj,
|
|
82194
|
-
if (!
|
|
82194
|
+
function getElementAtPath(obj, path62) {
|
|
82195
|
+
if (!path62)
|
|
82195
82196
|
return obj;
|
|
82196
|
-
return
|
|
82197
|
+
return path62.reduce((acc, key) => acc?.[key], obj);
|
|
82197
82198
|
}
|
|
82198
82199
|
function promiseAllObject(promisesObj) {
|
|
82199
82200
|
const keys = Object.keys(promisesObj);
|
|
@@ -82513,11 +82514,11 @@ function aborted(x2, startIndex = 0) {
|
|
|
82513
82514
|
}
|
|
82514
82515
|
return false;
|
|
82515
82516
|
}
|
|
82516
|
-
function prefixIssues(
|
|
82517
|
+
function prefixIssues(path62, issues) {
|
|
82517
82518
|
return issues.map((iss) => {
|
|
82518
82519
|
var _a3;
|
|
82519
82520
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
82520
|
-
iss.path.unshift(
|
|
82521
|
+
iss.path.unshift(path62);
|
|
82521
82522
|
return iss;
|
|
82522
82523
|
});
|
|
82523
82524
|
}
|
|
@@ -87840,7 +87841,7 @@ var Protocol = class {
|
|
|
87840
87841
|
return;
|
|
87841
87842
|
}
|
|
87842
87843
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
87843
|
-
await new Promise((
|
|
87844
|
+
await new Promise((resolve46) => setTimeout(resolve46, pollInterval));
|
|
87844
87845
|
options?.signal?.throwIfAborted();
|
|
87845
87846
|
}
|
|
87846
87847
|
} catch (error3) {
|
|
@@ -87857,7 +87858,7 @@ var Protocol = class {
|
|
|
87857
87858
|
*/
|
|
87858
87859
|
request(request, resultSchema, options) {
|
|
87859
87860
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
87860
|
-
return new Promise((
|
|
87861
|
+
return new Promise((resolve46, reject) => {
|
|
87861
87862
|
const earlyReject = (error3) => {
|
|
87862
87863
|
reject(error3);
|
|
87863
87864
|
};
|
|
@@ -87935,7 +87936,7 @@ var Protocol = class {
|
|
|
87935
87936
|
if (!parseResult.success) {
|
|
87936
87937
|
reject(parseResult.error);
|
|
87937
87938
|
} else {
|
|
87938
|
-
|
|
87939
|
+
resolve46(parseResult.data);
|
|
87939
87940
|
}
|
|
87940
87941
|
} catch (error3) {
|
|
87941
87942
|
reject(error3);
|
|
@@ -88196,12 +88197,12 @@ var Protocol = class {
|
|
|
88196
88197
|
}
|
|
88197
88198
|
} catch {
|
|
88198
88199
|
}
|
|
88199
|
-
return new Promise((
|
|
88200
|
+
return new Promise((resolve46, reject) => {
|
|
88200
88201
|
if (signal.aborted) {
|
|
88201
88202
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
88202
88203
|
return;
|
|
88203
88204
|
}
|
|
88204
|
-
const timeoutId = setTimeout(
|
|
88205
|
+
const timeoutId = setTimeout(resolve46, interval);
|
|
88205
88206
|
signal.addEventListener("abort", () => {
|
|
88206
88207
|
clearTimeout(timeoutId);
|
|
88207
88208
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -88991,7 +88992,7 @@ var Server = class extends Protocol {
|
|
|
88991
88992
|
};
|
|
88992
88993
|
|
|
88993
88994
|
// src/mcp/server.ts
|
|
88994
|
-
var
|
|
88995
|
+
var path58 = __toESM(require("path"));
|
|
88995
88996
|
|
|
88996
88997
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
88997
88998
|
var import_node_process3 = __toESM(require("node:process"), 1);
|
|
@@ -89074,12 +89075,12 @@ var StdioServerTransport = class {
|
|
|
89074
89075
|
this.onclose?.();
|
|
89075
89076
|
}
|
|
89076
89077
|
send(message) {
|
|
89077
|
-
return new Promise((
|
|
89078
|
+
return new Promise((resolve46) => {
|
|
89078
89079
|
const json = serializeMessage(message);
|
|
89079
89080
|
if (this._stdout.write(json)) {
|
|
89080
|
-
|
|
89081
|
+
resolve46();
|
|
89081
89082
|
} else {
|
|
89082
|
-
this._stdout.once("drain",
|
|
89083
|
+
this._stdout.once("drain", resolve46);
|
|
89083
89084
|
}
|
|
89084
89085
|
});
|
|
89085
89086
|
}
|
|
@@ -89625,7 +89626,7 @@ async function handleMcpToolCall(toolName, args, defaultRepo = ".") {
|
|
|
89625
89626
|
const input = ControlUpInputSchema.parse({ ...args, repo });
|
|
89626
89627
|
const result = await startControlAndSync({
|
|
89627
89628
|
detach: input.detach,
|
|
89628
|
-
cwd:
|
|
89629
|
+
cwd: path58.resolve(input.repo)
|
|
89629
89630
|
});
|
|
89630
89631
|
if (result.code !== 0) {
|
|
89631
89632
|
return {
|
|
@@ -89689,10 +89690,10 @@ var mcpCommand = {
|
|
|
89689
89690
|
};
|
|
89690
89691
|
|
|
89691
89692
|
// src/cli/commands/onboard.ts
|
|
89692
|
-
var
|
|
89693
|
+
var path60 = __toESM(require("path"));
|
|
89693
89694
|
|
|
89694
89695
|
// src/core/onboarding.ts
|
|
89695
|
-
var
|
|
89696
|
+
var path59 = __toESM(require("path"));
|
|
89696
89697
|
init_control_config();
|
|
89697
89698
|
init_otel_hooks();
|
|
89698
89699
|
init_telemetry_config();
|
|
@@ -89824,7 +89825,7 @@ async function defaultEnsureControl(options) {
|
|
|
89824
89825
|
return { started: true, apiUrl: result.apiUrl };
|
|
89825
89826
|
}
|
|
89826
89827
|
async function runOnboarding(options, deps = {}) {
|
|
89827
|
-
const repoPath =
|
|
89828
|
+
const repoPath = path59.resolve(options.repoPath);
|
|
89828
89829
|
const applyTelemetry = deps.applyTelemetry ?? applyOnboardingTelemetry;
|
|
89829
89830
|
const ensureControl = deps.ensureControl ?? defaultEnsureControl;
|
|
89830
89831
|
const init = deps.initHarness ?? initHarness;
|
|
@@ -90012,7 +90013,7 @@ async function promptChoices(args) {
|
|
|
90012
90013
|
};
|
|
90013
90014
|
}
|
|
90014
90015
|
const pluginChoices = listPluginChoices();
|
|
90015
|
-
const repoPath =
|
|
90016
|
+
const repoPath = path60.resolve(args.repo);
|
|
90016
90017
|
const alreadyPresent = harnessExists(repoPath);
|
|
90017
90018
|
const needProfile = !alreadyPresent && !args.skipInit && args.profile === void 0;
|
|
90018
90019
|
const needAgentSlots = shouldConfigureSlots && flaggedSlots === void 0;
|
|
@@ -90129,7 +90130,7 @@ function printSummary(result) {
|
|
|
90129
90130
|
console.error("");
|
|
90130
90131
|
}
|
|
90131
90132
|
async function handleOnboard(argv) {
|
|
90132
|
-
const repoPath =
|
|
90133
|
+
const repoPath = path60.resolve(argv.repo);
|
|
90133
90134
|
header("har onboard");
|
|
90134
90135
|
info(`Repository: ${repoPath}`);
|
|
90135
90136
|
try {
|
|
@@ -90364,7 +90365,7 @@ var preferencesCommand = {
|
|
|
90364
90365
|
};
|
|
90365
90366
|
|
|
90366
90367
|
// src/cli/commands/telemetry.ts
|
|
90367
|
-
var
|
|
90368
|
+
var path61 = __toESM(require("path"));
|
|
90368
90369
|
init_control_config();
|
|
90369
90370
|
init_otel_hooks();
|
|
90370
90371
|
init_telemetry_config();
|
|
@@ -90452,7 +90453,7 @@ async function handleOff() {
|
|
|
90452
90453
|
info("Mission Control will not auto-start. Existing usage rows are kept.");
|
|
90453
90454
|
}
|
|
90454
90455
|
async function handleWriteEnv(argv) {
|
|
90455
|
-
const repoPath =
|
|
90456
|
+
const repoPath = path61.resolve(argv.repo);
|
|
90456
90457
|
const harnessRoot = resolveHarnessRoot(repoPath);
|
|
90457
90458
|
const session = readSlotRegistry(harnessRoot, argv.agentId);
|
|
90458
90459
|
const workDir = argv.workDir ?? session?.workDir ?? repoPath;
|
|
@@ -90464,7 +90465,7 @@ async function handleWriteEnv(argv) {
|
|
|
90464
90465
|
suffix,
|
|
90465
90466
|
createdAt: session?.createdAt
|
|
90466
90467
|
});
|
|
90467
|
-
const envFile = argv.envFile ??
|
|
90468
|
+
const envFile = argv.envFile ?? path61.join(workDir, `.env.agent.${argv.agentId}`);
|
|
90468
90469
|
const attrs = {
|
|
90469
90470
|
sessionKey,
|
|
90470
90471
|
agentId: argv.agentId,
|
|
@@ -90480,7 +90481,7 @@ async function handleWriteEnv(argv) {
|
|
|
90480
90481
|
success(`Wrote session attribution to ${envFile}`);
|
|
90481
90482
|
}
|
|
90482
90483
|
function handlePrintEnv(argv) {
|
|
90483
|
-
const repoPath =
|
|
90484
|
+
const repoPath = path61.resolve(argv.repo);
|
|
90484
90485
|
const workDir = argv.workDir ?? repoPath;
|
|
90485
90486
|
const sessionKey = buildSessionKey({
|
|
90486
90487
|
branch: argv.branch,
|