@primeinc/swarm 0.57.8-beta.0 → 0.57.10-beta.0
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/bin/swarm.ts +3 -3
- package/claude-plugin/dist/index.js +1419 -693
- package/claude-plugin/dist/utils/arg-normalizer.d.ts +9 -0
- package/claude-plugin/dist/utils/arg-normalizer.d.ts.map +1 -0
- package/dist/bin/swarm.js +3563 -1632
- package/dist/dashboard.d.ts +2 -6
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/hive.d.ts +7 -2
- package/dist/hive.d.ts.map +1 -1
- package/dist/hive.js +545 -76
- package/dist/index.js +781 -302
- package/dist/marketplace/index.js +1419 -693
- package/dist/plugin.js +781 -288
- package/dist/swarm-mail.d.ts.map +1 -1
- package/dist/swarm-prompts.js +593 -118
- package/dist/swarm-research.d.ts +1 -2
- package/dist/swarm-research.d.ts.map +1 -1
- package/dist/utils/arg-normalizer.d.ts +9 -0
- package/dist/utils/arg-normalizer.d.ts.map +1 -0
- package/package.json +6 -5
- package/claude-plugin/dist/utils/normalize-path.d.ts +0 -75
- package/claude-plugin/dist/utils/normalize-path.d.ts.map +0 -1
- package/dist/utils/normalize-path.d.ts +0 -75
- package/dist/utils/normalize-path.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -12774,7 +12774,7 @@ __export(exports_util2, {
|
|
|
12774
12774
|
promiseAllObject: () => promiseAllObject2,
|
|
12775
12775
|
primitiveTypes: () => primitiveTypes2,
|
|
12776
12776
|
prefixIssues: () => prefixIssues2,
|
|
12777
|
-
pick: () =>
|
|
12777
|
+
pick: () => pick3,
|
|
12778
12778
|
partial: () => partial2,
|
|
12779
12779
|
optionalKeys: () => optionalKeys2,
|
|
12780
12780
|
omit: () => omit2,
|
|
@@ -12925,10 +12925,10 @@ function mergeDefs2(...defs) {
|
|
|
12925
12925
|
function cloneDef2(schema) {
|
|
12926
12926
|
return mergeDefs2(schema._zod.def);
|
|
12927
12927
|
}
|
|
12928
|
-
function getElementAtPath2(obj,
|
|
12929
|
-
if (!
|
|
12928
|
+
function getElementAtPath2(obj, path3) {
|
|
12929
|
+
if (!path3)
|
|
12930
12930
|
return obj;
|
|
12931
|
-
return
|
|
12931
|
+
return path3.reduce((acc, key) => acc?.[key], obj);
|
|
12932
12932
|
}
|
|
12933
12933
|
function promiseAllObject2(promisesObj) {
|
|
12934
12934
|
const keys = Object.keys(promisesObj);
|
|
@@ -13055,7 +13055,7 @@ function optionalKeys2(shape) {
|
|
|
13055
13055
|
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
13056
13056
|
});
|
|
13057
13057
|
}
|
|
13058
|
-
function
|
|
13058
|
+
function pick3(schema, mask) {
|
|
13059
13059
|
const currDef = schema._zod.def;
|
|
13060
13060
|
const def = mergeDefs2(schema._zod.def, {
|
|
13061
13061
|
get shape() {
|
|
@@ -13217,11 +13217,11 @@ function aborted2(x, startIndex = 0) {
|
|
|
13217
13217
|
}
|
|
13218
13218
|
return false;
|
|
13219
13219
|
}
|
|
13220
|
-
function prefixIssues2(
|
|
13220
|
+
function prefixIssues2(path3, issues) {
|
|
13221
13221
|
return issues.map((iss) => {
|
|
13222
13222
|
var _a;
|
|
13223
13223
|
(_a = iss).path ?? (_a.path = []);
|
|
13224
|
-
iss.path.unshift(
|
|
13224
|
+
iss.path.unshift(path3);
|
|
13225
13225
|
return iss;
|
|
13226
13226
|
});
|
|
13227
13227
|
}
|
|
@@ -13444,7 +13444,7 @@ function treeifyError2(error45, _mapper) {
|
|
|
13444
13444
|
return issue3.message;
|
|
13445
13445
|
};
|
|
13446
13446
|
const result = { errors: [] };
|
|
13447
|
-
const processError = (error46,
|
|
13447
|
+
const processError = (error46, path3 = []) => {
|
|
13448
13448
|
var _a, _b;
|
|
13449
13449
|
for (const issue3 of error46.issues) {
|
|
13450
13450
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
@@ -13454,7 +13454,7 @@ function treeifyError2(error45, _mapper) {
|
|
|
13454
13454
|
} else if (issue3.code === "invalid_element") {
|
|
13455
13455
|
processError({ issues: issue3.issues }, issue3.path);
|
|
13456
13456
|
} else {
|
|
13457
|
-
const fullpath = [...
|
|
13457
|
+
const fullpath = [...path3, ...issue3.path];
|
|
13458
13458
|
if (fullpath.length === 0) {
|
|
13459
13459
|
result.errors.push(mapper(issue3));
|
|
13460
13460
|
continue;
|
|
@@ -13486,8 +13486,8 @@ function treeifyError2(error45, _mapper) {
|
|
|
13486
13486
|
}
|
|
13487
13487
|
function toDotPath2(_path) {
|
|
13488
13488
|
const segs = [];
|
|
13489
|
-
const
|
|
13490
|
-
for (const seg of
|
|
13489
|
+
const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
13490
|
+
for (const seg of path3) {
|
|
13491
13491
|
if (typeof seg === "number")
|
|
13492
13492
|
segs.push(`[${seg}]`);
|
|
13493
13493
|
else if (typeof seg === "symbol")
|
|
@@ -25372,14 +25372,14 @@ __export(exports_eval_capture, {
|
|
|
25372
25372
|
});
|
|
25373
25373
|
import * as fs from "node:fs";
|
|
25374
25374
|
import * as os from "node:os";
|
|
25375
|
-
import * as
|
|
25375
|
+
import * as path3 from "node:path";
|
|
25376
25376
|
import { getSwarmMailLibSQL } from "swarm-mail";
|
|
25377
25377
|
function getEvalDataPath(projectPath) {
|
|
25378
|
-
return
|
|
25378
|
+
return path3.join(projectPath, DEFAULT_EVAL_DATA_PATH);
|
|
25379
25379
|
}
|
|
25380
25380
|
function ensureEvalDataDir(projectPath) {
|
|
25381
25381
|
const evalPath = getEvalDataPath(projectPath);
|
|
25382
|
-
const dir =
|
|
25382
|
+
const dir = path3.dirname(evalPath);
|
|
25383
25383
|
if (!fs.existsSync(dir)) {
|
|
25384
25384
|
fs.mkdirSync(dir, { recursive: true });
|
|
25385
25385
|
}
|
|
@@ -25553,10 +25553,10 @@ function getEvalDataStats(projectPath) {
|
|
|
25553
25553
|
};
|
|
25554
25554
|
}
|
|
25555
25555
|
function getSessionDir() {
|
|
25556
|
-
return process.env.SWARM_SESSIONS_DIR ||
|
|
25556
|
+
return process.env.SWARM_SESSIONS_DIR || path3.join(os.homedir(), ".config", "swarm-tools", "sessions");
|
|
25557
25557
|
}
|
|
25558
25558
|
function getSessionPath(sessionId) {
|
|
25559
|
-
return
|
|
25559
|
+
return path3.join(getSessionDir(), `${sessionId}.jsonl`);
|
|
25560
25560
|
}
|
|
25561
25561
|
function ensureSessionDir() {
|
|
25562
25562
|
const sessionDir = getSessionDir();
|
|
@@ -30318,7 +30318,7 @@ WD9f
|
|
|
30318
30318
|
|
|
30319
30319
|
// ../../node_modules/ioredis/built/utils/index.js
|
|
30320
30320
|
var require_utils2 = __commonJS((exports) => {
|
|
30321
|
-
var __dirname = "/home/runner/work/swarm
|
|
30321
|
+
var __dirname = "/home/runner/work/swarm/swarm/node_modules/ioredis/built/utils";
|
|
30322
30322
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30323
30323
|
exports.noop = exports.defaults = exports.Debug = exports.getPackageMeta = exports.zipMap = exports.CONNECTION_CLOSED_ERROR_MSG = exports.shuffle = exports.sample = exports.resolveTLSProfile = exports.parseURL = exports.optimizeErrorStack = exports.toArg = exports.convertMapToArray = exports.convertObjectToArray = exports.timeout = exports.packObject = exports.isInt = exports.wrapMultiResult = exports.convertBufferToString = undefined;
|
|
30324
30324
|
var fs_1 = __require("fs");
|
|
@@ -30548,7 +30548,7 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
30548
30548
|
|
|
30549
30549
|
// ../../node_modules/ioredis/built/Command.js
|
|
30550
30550
|
var require_Command = __commonJS((exports) => {
|
|
30551
|
-
var __dirname = "/home/runner/work/swarm
|
|
30551
|
+
var __dirname = "/home/runner/work/swarm/swarm/node_modules/ioredis/built";
|
|
30552
30552
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30553
30553
|
var commands_1 = require_built();
|
|
30554
30554
|
var calculateSlot = require_lib();
|
|
@@ -39592,7 +39592,7 @@ import {
|
|
|
39592
39592
|
dirname as dirname3,
|
|
39593
39593
|
resolve,
|
|
39594
39594
|
relative,
|
|
39595
|
-
isAbsolute,
|
|
39595
|
+
isAbsolute as isAbsolute2,
|
|
39596
39596
|
sep
|
|
39597
39597
|
} from "path";
|
|
39598
39598
|
import { fileURLToPath } from "url";
|
|
@@ -40240,7 +40240,7 @@ Use this to access supplementary skill resources.`,
|
|
|
40240
40240
|
if (!skill) {
|
|
40241
40241
|
return `Skill '${args.skill}' not found.`;
|
|
40242
40242
|
}
|
|
40243
|
-
if (
|
|
40243
|
+
if (isAbsolute2(args.file)) {
|
|
40244
40244
|
return "Invalid file path. Use a relative path.";
|
|
40245
40245
|
}
|
|
40246
40246
|
if (args.file.includes("..")) {
|
|
@@ -40454,7 +40454,7 @@ executed with skills_execute. Use for:
|
|
|
40454
40454
|
if (!skill) {
|
|
40455
40455
|
return `Skill '${args.skill}' not found.`;
|
|
40456
40456
|
}
|
|
40457
|
-
if (
|
|
40457
|
+
if (isAbsolute2(args.script_name) || args.script_name.includes("..") || args.script_name.includes("/") || args.script_name.includes("\\") || basename(args.script_name) !== args.script_name) {
|
|
40458
40458
|
return "Invalid script name. Use simple filenames without paths.";
|
|
40459
40459
|
}
|
|
40460
40460
|
const scriptsDir = join6(skill.directory, "scripts");
|
|
@@ -42705,17 +42705,17 @@ var getKeysForIndexSignature = (input, parameter) => {
|
|
|
42705
42705
|
done = true;
|
|
42706
42706
|
return a;
|
|
42707
42707
|
};
|
|
42708
|
-
}, isNonEmpty = (x) => Array.isArray(x), isSingle = (x) => !Array.isArray(x), formatPathKey = (key) => `[${formatPropertyKey(key)}]`, formatPath = (
|
|
42708
|
+
}, isNonEmpty = (x) => Array.isArray(x), isSingle = (x) => !Array.isArray(x), formatPathKey = (key) => `[${formatPropertyKey(key)}]`, formatPath = (path5) => isNonEmpty(path5) ? path5.map(formatPathKey).join("") : formatPathKey(path5);
|
|
42709
42709
|
var init_util3 = __esm(() => {
|
|
42710
42710
|
init_Inspectable();
|
|
42711
42711
|
});
|
|
42712
42712
|
|
|
42713
42713
|
// ../../node_modules/effect/dist/esm/internal/schema/errors.js
|
|
42714
|
-
var getErrorMessage = (reason, details,
|
|
42714
|
+
var getErrorMessage = (reason, details, path5, ast) => {
|
|
42715
42715
|
let out = reason;
|
|
42716
|
-
if (
|
|
42716
|
+
if (path5 && isNonEmptyReadonlyArray(path5)) {
|
|
42717
42717
|
out += `
|
|
42718
|
-
at path: ${formatPath(
|
|
42718
|
+
at path: ${formatPath(path5)}`;
|
|
42719
42719
|
}
|
|
42720
42720
|
if (details !== undefined) {
|
|
42721
42721
|
out += `
|
|
@@ -43728,7 +43728,7 @@ var TypeId3, BigDecimalProto, isBigDecimal = (u) => hasProperty(u, TypeId3), mak
|
|
|
43728
43728
|
const o = make4(value, scale);
|
|
43729
43729
|
o.normalized = o;
|
|
43730
43730
|
return o;
|
|
43731
|
-
}, bigint0, bigint10, zero,
|
|
43731
|
+
}, bigint0, bigint10, zero, normalize2 = (self) => {
|
|
43732
43732
|
if (self.normalized === undefined) {
|
|
43733
43733
|
if (self.value === bigint0) {
|
|
43734
43734
|
self.normalized = zero;
|
|
@@ -43752,7 +43752,7 @@ var TypeId3, BigDecimalProto, isBigDecimal = (u) => hasProperty(u, TypeId3), mak
|
|
|
43752
43752
|
}
|
|
43753
43753
|
return self.normalized;
|
|
43754
43754
|
}, scale, abs = (n) => n.value < bigint0 ? make4(-n.value, n.scale) : n, Equivalence, equals2, format2 = (n) => {
|
|
43755
|
-
const normalized =
|
|
43755
|
+
const normalized = normalize2(n);
|
|
43756
43756
|
if (Math.abs(normalized.scale) >= 16) {
|
|
43757
43757
|
return toExponential(normalized);
|
|
43758
43758
|
}
|
|
@@ -43780,7 +43780,7 @@ var TypeId3, BigDecimalProto, isBigDecimal = (u) => hasProperty(u, TypeId3), mak
|
|
|
43780
43780
|
if (isZero(n)) {
|
|
43781
43781
|
return "0e+0";
|
|
43782
43782
|
}
|
|
43783
|
-
const normalized =
|
|
43783
|
+
const normalized = normalize2(n);
|
|
43784
43784
|
const digits = `${abs(normalized).value}`;
|
|
43785
43785
|
const head2 = digits.slice(0, 1);
|
|
43786
43786
|
const tail = digits.slice(1);
|
|
@@ -43803,7 +43803,7 @@ var init_BigDecimal = __esm(() => {
|
|
|
43803
43803
|
BigDecimalProto = {
|
|
43804
43804
|
[TypeId3]: TypeId3,
|
|
43805
43805
|
[symbol3]() {
|
|
43806
|
-
const normalized =
|
|
43806
|
+
const normalized = normalize2(this);
|
|
43807
43807
|
return pipe3(hash3(normalized.value), combine(number8(normalized.scale)), cached3(this));
|
|
43808
43808
|
},
|
|
43809
43809
|
[symbol4](that) {
|
|
@@ -48339,64 +48339,64 @@ var ConfigErrorSymbolKey = "effect/ConfigError", ConfigErrorTypeId, proto2, And
|
|
|
48339
48339
|
}
|
|
48340
48340
|
});
|
|
48341
48341
|
return error89;
|
|
48342
|
-
}, InvalidData = (
|
|
48342
|
+
}, InvalidData = (path5, message, options2 = {
|
|
48343
48343
|
pathDelim: "."
|
|
48344
48344
|
}) => {
|
|
48345
48345
|
const error89 = Object.create(proto2);
|
|
48346
48346
|
error89._op = OP_INVALID_DATA;
|
|
48347
|
-
error89.path =
|
|
48347
|
+
error89.path = path5;
|
|
48348
48348
|
error89.message = message;
|
|
48349
48349
|
Object.defineProperty(error89, "toString", {
|
|
48350
48350
|
enumerable: false,
|
|
48351
48351
|
value() {
|
|
48352
|
-
const
|
|
48353
|
-
return `(Invalid data at ${
|
|
48352
|
+
const path6 = pipe3(this.path, join8(options2.pathDelim));
|
|
48353
|
+
return `(Invalid data at ${path6}: "${this.message}")`;
|
|
48354
48354
|
}
|
|
48355
48355
|
});
|
|
48356
48356
|
return error89;
|
|
48357
|
-
}, MissingData = (
|
|
48357
|
+
}, MissingData = (path5, message, options2 = {
|
|
48358
48358
|
pathDelim: "."
|
|
48359
48359
|
}) => {
|
|
48360
48360
|
const error89 = Object.create(proto2);
|
|
48361
48361
|
error89._op = OP_MISSING_DATA;
|
|
48362
|
-
error89.path =
|
|
48362
|
+
error89.path = path5;
|
|
48363
48363
|
error89.message = message;
|
|
48364
48364
|
Object.defineProperty(error89, "toString", {
|
|
48365
48365
|
enumerable: false,
|
|
48366
48366
|
value() {
|
|
48367
|
-
const
|
|
48368
|
-
return `(Missing data at ${
|
|
48367
|
+
const path6 = pipe3(this.path, join8(options2.pathDelim));
|
|
48368
|
+
return `(Missing data at ${path6}: "${this.message}")`;
|
|
48369
48369
|
}
|
|
48370
48370
|
});
|
|
48371
48371
|
return error89;
|
|
48372
|
-
}, SourceUnavailable = (
|
|
48372
|
+
}, SourceUnavailable = (path5, message, cause, options2 = {
|
|
48373
48373
|
pathDelim: "."
|
|
48374
48374
|
}) => {
|
|
48375
48375
|
const error89 = Object.create(proto2);
|
|
48376
48376
|
error89._op = OP_SOURCE_UNAVAILABLE;
|
|
48377
|
-
error89.path =
|
|
48377
|
+
error89.path = path5;
|
|
48378
48378
|
error89.message = message;
|
|
48379
48379
|
error89.cause = cause;
|
|
48380
48380
|
Object.defineProperty(error89, "toString", {
|
|
48381
48381
|
enumerable: false,
|
|
48382
48382
|
value() {
|
|
48383
|
-
const
|
|
48384
|
-
return `(Source unavailable at ${
|
|
48383
|
+
const path6 = pipe3(this.path, join8(options2.pathDelim));
|
|
48384
|
+
return `(Source unavailable at ${path6}: "${this.message}")`;
|
|
48385
48385
|
}
|
|
48386
48386
|
});
|
|
48387
48387
|
return error89;
|
|
48388
|
-
}, Unsupported = (
|
|
48388
|
+
}, Unsupported = (path5, message, options2 = {
|
|
48389
48389
|
pathDelim: "."
|
|
48390
48390
|
}) => {
|
|
48391
48391
|
const error89 = Object.create(proto2);
|
|
48392
48392
|
error89._op = OP_UNSUPPORTED;
|
|
48393
|
-
error89.path =
|
|
48393
|
+
error89.path = path5;
|
|
48394
48394
|
error89.message = message;
|
|
48395
48395
|
Object.defineProperty(error89, "toString", {
|
|
48396
48396
|
enumerable: false,
|
|
48397
48397
|
value() {
|
|
48398
|
-
const
|
|
48399
|
-
return `(Unsupported operation at ${
|
|
48398
|
+
const path6 = pipe3(this.path, join8(options2.pathDelim));
|
|
48399
|
+
return `(Unsupported operation at ${path6}: "${this.message}")`;
|
|
48400
48400
|
}
|
|
48401
48401
|
});
|
|
48402
48402
|
return error89;
|
|
@@ -48445,9 +48445,9 @@ var init_pathPatch = __esm(() => {
|
|
|
48445
48445
|
empty20 = {
|
|
48446
48446
|
_tag: "Empty"
|
|
48447
48447
|
};
|
|
48448
|
-
patch5 = /* @__PURE__ */ dual(2, (
|
|
48448
|
+
patch5 = /* @__PURE__ */ dual(2, (path5, patch6) => {
|
|
48449
48449
|
let input = of3(patch6);
|
|
48450
|
-
let output =
|
|
48450
|
+
let output = path5;
|
|
48451
48451
|
while (isCons(input)) {
|
|
48452
48452
|
const patch7 = input.head;
|
|
48453
48453
|
switch (patch7._tag) {
|
|
@@ -48498,7 +48498,7 @@ var concat = (l, r) => [...l, ...r], ConfigProviderSymbolKey = "effect/ConfigPro
|
|
|
48498
48498
|
}), makeFlat = (options2) => ({
|
|
48499
48499
|
[FlatConfigProviderTypeId]: FlatConfigProviderTypeId,
|
|
48500
48500
|
patch: options2.patch,
|
|
48501
|
-
load: (
|
|
48501
|
+
load: (path5, config3, split = true) => options2.load(path5, config3, split),
|
|
48502
48502
|
enumerateChildren: options2.enumerateChildren
|
|
48503
48503
|
}), fromFlat = (flat) => make22({
|
|
48504
48504
|
load: (config3) => flatMap7(fromFlatLoop(flat, empty2(), config3, false), (chunk) => match3(head(chunk), {
|
|
@@ -48514,29 +48514,29 @@ var concat = (l, r) => [...l, ...r], ConfigProviderSymbolKey = "effect/ConfigPro
|
|
|
48514
48514
|
pathDelim: "_",
|
|
48515
48515
|
seqDelim: ","
|
|
48516
48516
|
}, options2);
|
|
48517
|
-
const makePathString = (
|
|
48517
|
+
const makePathString = (path5) => pipe3(path5, join8(pathDelim));
|
|
48518
48518
|
const unmakePathString = (pathString) => pathString.split(pathDelim);
|
|
48519
48519
|
const getEnv = () => typeof process !== "undefined" && ("env" in process) && typeof process.env === "object" ? process.env : {};
|
|
48520
|
-
const load = (
|
|
48521
|
-
const pathString = makePathString(
|
|
48520
|
+
const load = (path5, primitive, split = true) => {
|
|
48521
|
+
const pathString = makePathString(path5);
|
|
48522
48522
|
const current = getEnv();
|
|
48523
48523
|
const valueOpt = pathString in current ? some2(current[pathString]) : none2();
|
|
48524
|
-
return pipe3(valueOpt, mapError(() => MissingData(
|
|
48524
|
+
return pipe3(valueOpt, mapError(() => MissingData(path5, `Expected ${pathString} to exist in the process context`)), flatMap7((value) => parsePrimitive(value, path5, primitive, seqDelim, split)));
|
|
48525
48525
|
};
|
|
48526
|
-
const enumerateChildren = (
|
|
48526
|
+
const enumerateChildren = (path5) => sync(() => {
|
|
48527
48527
|
const current = getEnv();
|
|
48528
48528
|
const keys3 = Object.keys(current);
|
|
48529
48529
|
const keyPaths = keys3.map((value) => unmakePathString(value.toUpperCase()));
|
|
48530
48530
|
const filteredKeyPaths = keyPaths.filter((keyPath) => {
|
|
48531
|
-
for (let i = 0;i <
|
|
48532
|
-
const pathComponent = pipe3(
|
|
48531
|
+
for (let i = 0;i < path5.length; i++) {
|
|
48532
|
+
const pathComponent = pipe3(path5, unsafeGet(i));
|
|
48533
48533
|
const currentElement = keyPath[i];
|
|
48534
48534
|
if (currentElement === undefined || pathComponent !== currentElement) {
|
|
48535
48535
|
return false;
|
|
48536
48536
|
}
|
|
48537
48537
|
}
|
|
48538
48538
|
return true;
|
|
48539
|
-
}).flatMap((keyPath) => keyPath.slice(
|
|
48539
|
+
}).flatMap((keyPath) => keyPath.slice(path5.length, path5.length + 1));
|
|
48540
48540
|
return fromIterable5(filteredKeyPaths);
|
|
48541
48541
|
});
|
|
48542
48542
|
return fromFlat(makeFlat({
|
|
@@ -48550,17 +48550,17 @@ var concat = (l, r) => [...l, ...r], ConfigProviderSymbolKey = "effect/ConfigPro
|
|
|
48550
48550
|
const leftExtension = concat(left3, leftPad);
|
|
48551
48551
|
const rightExtension = concat(right3, rightPad);
|
|
48552
48552
|
return [leftExtension, rightExtension];
|
|
48553
|
-
}, appendConfigPath = (
|
|
48553
|
+
}, appendConfigPath = (path5, config3) => {
|
|
48554
48554
|
let op = config3;
|
|
48555
48555
|
if (op._tag === "Nested") {
|
|
48556
|
-
const out =
|
|
48556
|
+
const out = path5.slice();
|
|
48557
48557
|
while (op._tag === "Nested") {
|
|
48558
48558
|
out.push(op.name);
|
|
48559
48559
|
op = op.config;
|
|
48560
48560
|
}
|
|
48561
48561
|
return out;
|
|
48562
48562
|
}
|
|
48563
|
-
return
|
|
48563
|
+
return path5;
|
|
48564
48564
|
}, fromFlatLoop = (flat, prefix, config3, split) => {
|
|
48565
48565
|
const op = config3;
|
|
48566
48566
|
switch (op._tag) {
|
|
@@ -48635,8 +48635,8 @@ var concat = (l, r) => [...l, ...r], ConfigProviderSymbolKey = "effect/ConfigPro
|
|
|
48635
48635
|
return fail2(right3.left);
|
|
48636
48636
|
}
|
|
48637
48637
|
if (isRight2(left3) && isRight2(right3)) {
|
|
48638
|
-
const
|
|
48639
|
-
const fail3 = fromFlatLoopFail(prefix,
|
|
48638
|
+
const path5 = pipe3(prefix, join8("."));
|
|
48639
|
+
const fail3 = fromFlatLoopFail(prefix, path5);
|
|
48640
48640
|
const [lefts, rights] = extend3(fail3, fail3, pipe3(left3.right, map6(right2)), pipe3(right3.right, map6(right2)));
|
|
48641
48641
|
return pipe3(lefts, zip(rights), forEachSequential(([left4, right4]) => pipe3(zip2(left4, right4), map12(([left5, right5]) => op.zip(left5, right5)))));
|
|
48642
48642
|
}
|
|
@@ -48644,17 +48644,17 @@ var concat = (l, r) => [...l, ...r], ConfigProviderSymbolKey = "effect/ConfigPro
|
|
|
48644
48644
|
})))));
|
|
48645
48645
|
}
|
|
48646
48646
|
}
|
|
48647
|
-
}, fromFlatLoopFail = (prefix,
|
|
48647
|
+
}, fromFlatLoopFail = (prefix, path5) => (index) => left2(MissingData(prefix, `The element at index ${index} in a sequence at path "${path5}" was missing`)), splitPathString = (text, delim) => {
|
|
48648
48648
|
const split = text.split(new RegExp(`\\s*${escape2(delim)}\\s*`));
|
|
48649
48649
|
return split;
|
|
48650
|
-
}, parsePrimitive = (text,
|
|
48650
|
+
}, parsePrimitive = (text, path5, primitive, delimiter, split) => {
|
|
48651
48651
|
if (!split) {
|
|
48652
48652
|
return pipe3(primitive.parse(text), mapBoth({
|
|
48653
|
-
onFailure: prefixed(
|
|
48653
|
+
onFailure: prefixed(path5),
|
|
48654
48654
|
onSuccess: of
|
|
48655
48655
|
}));
|
|
48656
48656
|
}
|
|
48657
|
-
return pipe3(splitPathString(text, delimiter), forEachSequential((char) => primitive.parse(char.trim())), mapError(prefixed(
|
|
48657
|
+
return pipe3(splitPathString(text, delimiter), forEachSequential((char) => primitive.parse(char.trim())), mapError(prefixed(path5)));
|
|
48658
48658
|
}, transpose = (array5) => {
|
|
48659
48659
|
return Object.keys(array5[0]).map((column) => array5.map((row) => row[column]));
|
|
48660
48660
|
}, indicesFrom = (quotedIndices) => pipe3(forEachSequential(quotedIndices, parseQuotedIndex), mapBoth({
|
|
@@ -57031,8 +57031,8 @@ class Pointer {
|
|
|
57031
57031
|
actual;
|
|
57032
57032
|
issue;
|
|
57033
57033
|
_tag = "Pointer";
|
|
57034
|
-
constructor(
|
|
57035
|
-
this.path =
|
|
57034
|
+
constructor(path5, actual, issue3) {
|
|
57035
|
+
this.path = path5;
|
|
57036
57036
|
this.actual = actual;
|
|
57037
57037
|
this.issue = issue3;
|
|
57038
57038
|
}
|
|
@@ -58937,14 +58937,14 @@ var init_memory = __esm(() => {
|
|
|
58937
58937
|
// src/memory-tools.ts
|
|
58938
58938
|
import { getSwarmMailLibSQL as getSwarmMailLibSQL5, createEvent as createEvent4, appendEvent as appendEvent3 } from "swarm-mail";
|
|
58939
58939
|
async function getMemoryAdapter(projectPath) {
|
|
58940
|
-
const
|
|
58941
|
-
if (cachedAdapter && cachedProjectPath ===
|
|
58940
|
+
const path5 = projectPath || process.cwd();
|
|
58941
|
+
if (cachedAdapter && cachedProjectPath === path5) {
|
|
58942
58942
|
return cachedAdapter;
|
|
58943
58943
|
}
|
|
58944
|
-
const swarmMail = await getSwarmMailLibSQL5(
|
|
58944
|
+
const swarmMail = await getSwarmMailLibSQL5(path5);
|
|
58945
58945
|
const dbAdapter = await swarmMail.getDatabase();
|
|
58946
58946
|
cachedAdapter = await createMemoryAdapter(dbAdapter);
|
|
58947
|
-
cachedProjectPath =
|
|
58947
|
+
cachedProjectPath = path5;
|
|
58948
58948
|
return cachedAdapter;
|
|
58949
58949
|
}
|
|
58950
58950
|
function resetMemoryCache() {
|
|
@@ -59763,17 +59763,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
59763
59763
|
visit.BREAK = BREAK;
|
|
59764
59764
|
visit.SKIP = SKIP;
|
|
59765
59765
|
visit.REMOVE = REMOVE;
|
|
59766
|
-
function visit_(key, node, visitor,
|
|
59767
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
59766
|
+
function visit_(key, node, visitor, path5) {
|
|
59767
|
+
const ctrl = callVisitor(key, node, visitor, path5);
|
|
59768
59768
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
59769
|
-
replaceNode(key,
|
|
59770
|
-
return visit_(key, ctrl, visitor,
|
|
59769
|
+
replaceNode(key, path5, ctrl);
|
|
59770
|
+
return visit_(key, ctrl, visitor, path5);
|
|
59771
59771
|
}
|
|
59772
59772
|
if (typeof ctrl !== "symbol") {
|
|
59773
59773
|
if (identity2.isCollection(node)) {
|
|
59774
|
-
|
|
59774
|
+
path5 = Object.freeze(path5.concat(node));
|
|
59775
59775
|
for (let i = 0;i < node.items.length; ++i) {
|
|
59776
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
59776
|
+
const ci = visit_(i, node.items[i], visitor, path5);
|
|
59777
59777
|
if (typeof ci === "number")
|
|
59778
59778
|
i = ci - 1;
|
|
59779
59779
|
else if (ci === BREAK)
|
|
@@ -59784,13 +59784,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
59784
59784
|
}
|
|
59785
59785
|
}
|
|
59786
59786
|
} else if (identity2.isPair(node)) {
|
|
59787
|
-
|
|
59788
|
-
const ck = visit_("key", node.key, visitor,
|
|
59787
|
+
path5 = Object.freeze(path5.concat(node));
|
|
59788
|
+
const ck = visit_("key", node.key, visitor, path5);
|
|
59789
59789
|
if (ck === BREAK)
|
|
59790
59790
|
return BREAK;
|
|
59791
59791
|
else if (ck === REMOVE)
|
|
59792
59792
|
node.key = null;
|
|
59793
|
-
const cv = visit_("value", node.value, visitor,
|
|
59793
|
+
const cv = visit_("value", node.value, visitor, path5);
|
|
59794
59794
|
if (cv === BREAK)
|
|
59795
59795
|
return BREAK;
|
|
59796
59796
|
else if (cv === REMOVE)
|
|
@@ -59811,17 +59811,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
59811
59811
|
visitAsync.BREAK = BREAK;
|
|
59812
59812
|
visitAsync.SKIP = SKIP;
|
|
59813
59813
|
visitAsync.REMOVE = REMOVE;
|
|
59814
|
-
async function visitAsync_(key, node, visitor,
|
|
59815
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
59814
|
+
async function visitAsync_(key, node, visitor, path5) {
|
|
59815
|
+
const ctrl = await callVisitor(key, node, visitor, path5);
|
|
59816
59816
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
59817
|
-
replaceNode(key,
|
|
59818
|
-
return visitAsync_(key, ctrl, visitor,
|
|
59817
|
+
replaceNode(key, path5, ctrl);
|
|
59818
|
+
return visitAsync_(key, ctrl, visitor, path5);
|
|
59819
59819
|
}
|
|
59820
59820
|
if (typeof ctrl !== "symbol") {
|
|
59821
59821
|
if (identity2.isCollection(node)) {
|
|
59822
|
-
|
|
59822
|
+
path5 = Object.freeze(path5.concat(node));
|
|
59823
59823
|
for (let i = 0;i < node.items.length; ++i) {
|
|
59824
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
59824
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path5);
|
|
59825
59825
|
if (typeof ci === "number")
|
|
59826
59826
|
i = ci - 1;
|
|
59827
59827
|
else if (ci === BREAK)
|
|
@@ -59832,13 +59832,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
59832
59832
|
}
|
|
59833
59833
|
}
|
|
59834
59834
|
} else if (identity2.isPair(node)) {
|
|
59835
|
-
|
|
59836
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
59835
|
+
path5 = Object.freeze(path5.concat(node));
|
|
59836
|
+
const ck = await visitAsync_("key", node.key, visitor, path5);
|
|
59837
59837
|
if (ck === BREAK)
|
|
59838
59838
|
return BREAK;
|
|
59839
59839
|
else if (ck === REMOVE)
|
|
59840
59840
|
node.key = null;
|
|
59841
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
59841
|
+
const cv = await visitAsync_("value", node.value, visitor, path5);
|
|
59842
59842
|
if (cv === BREAK)
|
|
59843
59843
|
return BREAK;
|
|
59844
59844
|
else if (cv === REMOVE)
|
|
@@ -59865,23 +59865,23 @@ var require_visit = __commonJS((exports) => {
|
|
|
59865
59865
|
}
|
|
59866
59866
|
return visitor;
|
|
59867
59867
|
}
|
|
59868
|
-
function callVisitor(key, node, visitor,
|
|
59868
|
+
function callVisitor(key, node, visitor, path5) {
|
|
59869
59869
|
if (typeof visitor === "function")
|
|
59870
|
-
return visitor(key, node,
|
|
59870
|
+
return visitor(key, node, path5);
|
|
59871
59871
|
if (identity2.isMap(node))
|
|
59872
|
-
return visitor.Map?.(key, node,
|
|
59872
|
+
return visitor.Map?.(key, node, path5);
|
|
59873
59873
|
if (identity2.isSeq(node))
|
|
59874
|
-
return visitor.Seq?.(key, node,
|
|
59874
|
+
return visitor.Seq?.(key, node, path5);
|
|
59875
59875
|
if (identity2.isPair(node))
|
|
59876
|
-
return visitor.Pair?.(key, node,
|
|
59876
|
+
return visitor.Pair?.(key, node, path5);
|
|
59877
59877
|
if (identity2.isScalar(node))
|
|
59878
|
-
return visitor.Scalar?.(key, node,
|
|
59878
|
+
return visitor.Scalar?.(key, node, path5);
|
|
59879
59879
|
if (identity2.isAlias(node))
|
|
59880
|
-
return visitor.Alias?.(key, node,
|
|
59880
|
+
return visitor.Alias?.(key, node, path5);
|
|
59881
59881
|
return;
|
|
59882
59882
|
}
|
|
59883
|
-
function replaceNode(key,
|
|
59884
|
-
const parent =
|
|
59883
|
+
function replaceNode(key, path5, node) {
|
|
59884
|
+
const parent = path5[path5.length - 1];
|
|
59885
59885
|
if (identity2.isCollection(parent)) {
|
|
59886
59886
|
parent.items[key] = node;
|
|
59887
59887
|
} else if (identity2.isPair(parent)) {
|
|
@@ -60438,10 +60438,10 @@ var require_Collection = __commonJS((exports) => {
|
|
|
60438
60438
|
var createNode = require_createNode();
|
|
60439
60439
|
var identity2 = require_identity();
|
|
60440
60440
|
var Node = require_Node();
|
|
60441
|
-
function collectionFromPath(schema,
|
|
60441
|
+
function collectionFromPath(schema, path5, value) {
|
|
60442
60442
|
let v = value;
|
|
60443
|
-
for (let i =
|
|
60444
|
-
const k =
|
|
60443
|
+
for (let i = path5.length - 1;i >= 0; --i) {
|
|
60444
|
+
const k = path5[i];
|
|
60445
60445
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
60446
60446
|
const a = [];
|
|
60447
60447
|
a[k] = v;
|
|
@@ -60460,7 +60460,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
60460
60460
|
sourceObjects: new Map
|
|
60461
60461
|
});
|
|
60462
60462
|
}
|
|
60463
|
-
var isEmptyPath = (
|
|
60463
|
+
var isEmptyPath = (path5) => path5 == null || typeof path5 === "object" && !!path5[Symbol.iterator]().next().done;
|
|
60464
60464
|
|
|
60465
60465
|
class Collection extends Node.NodeBase {
|
|
60466
60466
|
constructor(type, schema) {
|
|
@@ -60481,11 +60481,11 @@ var require_Collection = __commonJS((exports) => {
|
|
|
60481
60481
|
copy3.range = this.range.slice();
|
|
60482
60482
|
return copy3;
|
|
60483
60483
|
}
|
|
60484
|
-
addIn(
|
|
60485
|
-
if (isEmptyPath(
|
|
60484
|
+
addIn(path5, value) {
|
|
60485
|
+
if (isEmptyPath(path5))
|
|
60486
60486
|
this.add(value);
|
|
60487
60487
|
else {
|
|
60488
|
-
const [key, ...rest] =
|
|
60488
|
+
const [key, ...rest] = path5;
|
|
60489
60489
|
const node = this.get(key, true);
|
|
60490
60490
|
if (identity2.isCollection(node))
|
|
60491
60491
|
node.addIn(rest, value);
|
|
@@ -60495,8 +60495,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
60495
60495
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
60496
60496
|
}
|
|
60497
60497
|
}
|
|
60498
|
-
deleteIn(
|
|
60499
|
-
const [key, ...rest] =
|
|
60498
|
+
deleteIn(path5) {
|
|
60499
|
+
const [key, ...rest] = path5;
|
|
60500
60500
|
if (rest.length === 0)
|
|
60501
60501
|
return this.delete(key);
|
|
60502
60502
|
const node = this.get(key, true);
|
|
@@ -60505,8 +60505,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
60505
60505
|
else
|
|
60506
60506
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
60507
60507
|
}
|
|
60508
|
-
getIn(
|
|
60509
|
-
const [key, ...rest] =
|
|
60508
|
+
getIn(path5, keepScalar) {
|
|
60509
|
+
const [key, ...rest] = path5;
|
|
60510
60510
|
const node = this.get(key, true);
|
|
60511
60511
|
if (rest.length === 0)
|
|
60512
60512
|
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
@@ -60521,15 +60521,15 @@ var require_Collection = __commonJS((exports) => {
|
|
|
60521
60521
|
return n == null || allowScalar && identity2.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
60522
60522
|
});
|
|
60523
60523
|
}
|
|
60524
|
-
hasIn(
|
|
60525
|
-
const [key, ...rest] =
|
|
60524
|
+
hasIn(path5) {
|
|
60525
|
+
const [key, ...rest] = path5;
|
|
60526
60526
|
if (rest.length === 0)
|
|
60527
60527
|
return this.has(key);
|
|
60528
60528
|
const node = this.get(key, true);
|
|
60529
60529
|
return identity2.isCollection(node) ? node.hasIn(rest) : false;
|
|
60530
60530
|
}
|
|
60531
|
-
setIn(
|
|
60532
|
-
const [key, ...rest] =
|
|
60531
|
+
setIn(path5, value) {
|
|
60532
|
+
const [key, ...rest] = path5;
|
|
60533
60533
|
if (rest.length === 0) {
|
|
60534
60534
|
this.set(key, value);
|
|
60535
60535
|
} else {
|
|
@@ -62911,9 +62911,9 @@ var require_Document = __commonJS((exports) => {
|
|
|
62911
62911
|
if (assertCollection(this.contents))
|
|
62912
62912
|
this.contents.add(value);
|
|
62913
62913
|
}
|
|
62914
|
-
addIn(
|
|
62914
|
+
addIn(path5, value) {
|
|
62915
62915
|
if (assertCollection(this.contents))
|
|
62916
|
-
this.contents.addIn(
|
|
62916
|
+
this.contents.addIn(path5, value);
|
|
62917
62917
|
}
|
|
62918
62918
|
createAlias(node, name) {
|
|
62919
62919
|
if (!node.anchor) {
|
|
@@ -62962,30 +62962,30 @@ var require_Document = __commonJS((exports) => {
|
|
|
62962
62962
|
delete(key) {
|
|
62963
62963
|
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
62964
62964
|
}
|
|
62965
|
-
deleteIn(
|
|
62966
|
-
if (Collection.isEmptyPath(
|
|
62965
|
+
deleteIn(path5) {
|
|
62966
|
+
if (Collection.isEmptyPath(path5)) {
|
|
62967
62967
|
if (this.contents == null)
|
|
62968
62968
|
return false;
|
|
62969
62969
|
this.contents = null;
|
|
62970
62970
|
return true;
|
|
62971
62971
|
}
|
|
62972
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
62972
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path5) : false;
|
|
62973
62973
|
}
|
|
62974
62974
|
get(key, keepScalar) {
|
|
62975
62975
|
return identity2.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
|
|
62976
62976
|
}
|
|
62977
|
-
getIn(
|
|
62978
|
-
if (Collection.isEmptyPath(
|
|
62977
|
+
getIn(path5, keepScalar) {
|
|
62978
|
+
if (Collection.isEmptyPath(path5))
|
|
62979
62979
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
62980
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
62980
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path5, keepScalar) : undefined;
|
|
62981
62981
|
}
|
|
62982
62982
|
has(key) {
|
|
62983
62983
|
return identity2.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
62984
62984
|
}
|
|
62985
|
-
hasIn(
|
|
62986
|
-
if (Collection.isEmptyPath(
|
|
62985
|
+
hasIn(path5) {
|
|
62986
|
+
if (Collection.isEmptyPath(path5))
|
|
62987
62987
|
return this.contents !== undefined;
|
|
62988
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
62988
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path5) : false;
|
|
62989
62989
|
}
|
|
62990
62990
|
set(key, value) {
|
|
62991
62991
|
if (this.contents == null) {
|
|
@@ -62994,13 +62994,13 @@ var require_Document = __commonJS((exports) => {
|
|
|
62994
62994
|
this.contents.set(key, value);
|
|
62995
62995
|
}
|
|
62996
62996
|
}
|
|
62997
|
-
setIn(
|
|
62998
|
-
if (Collection.isEmptyPath(
|
|
62997
|
+
setIn(path5, value) {
|
|
62998
|
+
if (Collection.isEmptyPath(path5)) {
|
|
62999
62999
|
this.contents = value;
|
|
63000
63000
|
} else if (this.contents == null) {
|
|
63001
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
63001
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path5), value);
|
|
63002
63002
|
} else if (assertCollection(this.contents)) {
|
|
63003
|
-
this.contents.setIn(
|
|
63003
|
+
this.contents.setIn(path5, value);
|
|
63004
63004
|
}
|
|
63005
63005
|
}
|
|
63006
63006
|
setSchema(version3, options2 = {}) {
|
|
@@ -64889,9 +64889,9 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
64889
64889
|
visit.BREAK = BREAK;
|
|
64890
64890
|
visit.SKIP = SKIP;
|
|
64891
64891
|
visit.REMOVE = REMOVE;
|
|
64892
|
-
visit.itemAtPath = (cst,
|
|
64892
|
+
visit.itemAtPath = (cst, path5) => {
|
|
64893
64893
|
let item = cst;
|
|
64894
|
-
for (const [field, index] of
|
|
64894
|
+
for (const [field, index] of path5) {
|
|
64895
64895
|
const tok = item?.[field];
|
|
64896
64896
|
if (tok && "items" in tok) {
|
|
64897
64897
|
item = tok.items[index];
|
|
@@ -64900,23 +64900,23 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
64900
64900
|
}
|
|
64901
64901
|
return item;
|
|
64902
64902
|
};
|
|
64903
|
-
visit.parentCollection = (cst,
|
|
64904
|
-
const parent = visit.itemAtPath(cst,
|
|
64905
|
-
const field =
|
|
64903
|
+
visit.parentCollection = (cst, path5) => {
|
|
64904
|
+
const parent = visit.itemAtPath(cst, path5.slice(0, -1));
|
|
64905
|
+
const field = path5[path5.length - 1][0];
|
|
64906
64906
|
const coll = parent?.[field];
|
|
64907
64907
|
if (coll && "items" in coll)
|
|
64908
64908
|
return coll;
|
|
64909
64909
|
throw new Error("Parent collection not found");
|
|
64910
64910
|
};
|
|
64911
|
-
function _visit(
|
|
64912
|
-
let ctrl = visitor(item,
|
|
64911
|
+
function _visit(path5, item, visitor) {
|
|
64912
|
+
let ctrl = visitor(item, path5);
|
|
64913
64913
|
if (typeof ctrl === "symbol")
|
|
64914
64914
|
return ctrl;
|
|
64915
64915
|
for (const field of ["key", "value"]) {
|
|
64916
64916
|
const token = item[field];
|
|
64917
64917
|
if (token && "items" in token) {
|
|
64918
64918
|
for (let i = 0;i < token.items.length; ++i) {
|
|
64919
|
-
const ci = _visit(Object.freeze(
|
|
64919
|
+
const ci = _visit(Object.freeze(path5.concat([[field, i]])), token.items[i], visitor);
|
|
64920
64920
|
if (typeof ci === "number")
|
|
64921
64921
|
i = ci - 1;
|
|
64922
64922
|
else if (ci === BREAK)
|
|
@@ -64927,10 +64927,10 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
64927
64927
|
}
|
|
64928
64928
|
}
|
|
64929
64929
|
if (typeof ctrl === "function" && field === "key")
|
|
64930
|
-
ctrl = ctrl(item,
|
|
64930
|
+
ctrl = ctrl(item, path5);
|
|
64931
64931
|
}
|
|
64932
64932
|
}
|
|
64933
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
64933
|
+
return typeof ctrl === "function" ? ctrl(item, path5) : ctrl;
|
|
64934
64934
|
}
|
|
64935
64935
|
exports.visit = visit;
|
|
64936
64936
|
});
|
|
@@ -66847,8 +66847,8 @@ var require_req = __commonJS((exports, module) => {
|
|
|
66847
66847
|
if (req.originalUrl) {
|
|
66848
66848
|
_req.url = req.originalUrl;
|
|
66849
66849
|
} else {
|
|
66850
|
-
const
|
|
66851
|
-
_req.url = typeof
|
|
66850
|
+
const path6 = req.path;
|
|
66851
|
+
_req.url = typeof path6 === "string" ? path6 : req.url ? req.url.path || req.url : undefined;
|
|
66852
66852
|
}
|
|
66853
66853
|
if (req.query) {
|
|
66854
66854
|
_req.query = req.query;
|
|
@@ -67004,14 +67004,14 @@ var require_redact = __commonJS((exports, module) => {
|
|
|
67004
67004
|
}
|
|
67005
67005
|
return obj;
|
|
67006
67006
|
}
|
|
67007
|
-
function parsePath(
|
|
67007
|
+
function parsePath(path6) {
|
|
67008
67008
|
const parts2 = [];
|
|
67009
67009
|
let current = "";
|
|
67010
67010
|
let inBrackets = false;
|
|
67011
67011
|
let inQuotes = false;
|
|
67012
67012
|
let quoteChar = "";
|
|
67013
|
-
for (let i = 0;i <
|
|
67014
|
-
const char =
|
|
67013
|
+
for (let i = 0;i < path6.length; i++) {
|
|
67014
|
+
const char = path6[i];
|
|
67015
67015
|
if (!inBrackets && char === ".") {
|
|
67016
67016
|
if (current) {
|
|
67017
67017
|
parts2.push(current);
|
|
@@ -67142,10 +67142,10 @@ var require_redact = __commonJS((exports, module) => {
|
|
|
67142
67142
|
return current;
|
|
67143
67143
|
}
|
|
67144
67144
|
function redactPaths(obj, paths, censor, remove7 = false) {
|
|
67145
|
-
for (const
|
|
67146
|
-
const parts2 = parsePath(
|
|
67145
|
+
for (const path6 of paths) {
|
|
67146
|
+
const parts2 = parsePath(path6);
|
|
67147
67147
|
if (parts2.includes("*")) {
|
|
67148
|
-
redactWildcardPath(obj, parts2, censor,
|
|
67148
|
+
redactWildcardPath(obj, parts2, censor, path6, remove7);
|
|
67149
67149
|
} else {
|
|
67150
67150
|
if (remove7) {
|
|
67151
67151
|
removeKey(obj, parts2);
|
|
@@ -67232,8 +67232,8 @@ var require_redact = __commonJS((exports, module) => {
|
|
|
67232
67232
|
}
|
|
67233
67233
|
} else {
|
|
67234
67234
|
if (afterWildcard.includes("*")) {
|
|
67235
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
67236
|
-
const fullPath = [...pathArray.slice(0, pathLength), ...
|
|
67235
|
+
const wrappedCensor = typeof censor === "function" ? (value, path6) => {
|
|
67236
|
+
const fullPath = [...pathArray.slice(0, pathLength), ...path6];
|
|
67237
67237
|
return censor(value, fullPath);
|
|
67238
67238
|
} : censor;
|
|
67239
67239
|
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove7);
|
|
@@ -67270,8 +67270,8 @@ var require_redact = __commonJS((exports, module) => {
|
|
|
67270
67270
|
return null;
|
|
67271
67271
|
}
|
|
67272
67272
|
const pathStructure = new Map;
|
|
67273
|
-
for (const
|
|
67274
|
-
const parts2 = parsePath(
|
|
67273
|
+
for (const path6 of pathsToClone) {
|
|
67274
|
+
const parts2 = parsePath(path6);
|
|
67275
67275
|
let current = pathStructure;
|
|
67276
67276
|
for (let i = 0;i < parts2.length; i++) {
|
|
67277
67277
|
const part = parts2[i];
|
|
@@ -67323,24 +67323,24 @@ var require_redact = __commonJS((exports, module) => {
|
|
|
67323
67323
|
}
|
|
67324
67324
|
return cloneSelectively(obj, pathStructure);
|
|
67325
67325
|
}
|
|
67326
|
-
function validatePath(
|
|
67327
|
-
if (typeof
|
|
67326
|
+
function validatePath(path6) {
|
|
67327
|
+
if (typeof path6 !== "string") {
|
|
67328
67328
|
throw new Error("Paths must be (non-empty) strings");
|
|
67329
67329
|
}
|
|
67330
|
-
if (
|
|
67330
|
+
if (path6 === "") {
|
|
67331
67331
|
throw new Error("Invalid redaction path ()");
|
|
67332
67332
|
}
|
|
67333
|
-
if (
|
|
67334
|
-
throw new Error(`Invalid redaction path (${
|
|
67333
|
+
if (path6.includes("..")) {
|
|
67334
|
+
throw new Error(`Invalid redaction path (${path6})`);
|
|
67335
67335
|
}
|
|
67336
|
-
if (
|
|
67337
|
-
throw new Error(`Invalid redaction path (${
|
|
67336
|
+
if (path6.includes(",")) {
|
|
67337
|
+
throw new Error(`Invalid redaction path (${path6})`);
|
|
67338
67338
|
}
|
|
67339
67339
|
let bracketCount = 0;
|
|
67340
67340
|
let inQuotes = false;
|
|
67341
67341
|
let quoteChar = "";
|
|
67342
|
-
for (let i = 0;i <
|
|
67343
|
-
const char =
|
|
67342
|
+
for (let i = 0;i < path6.length; i++) {
|
|
67343
|
+
const char = path6[i];
|
|
67344
67344
|
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
67345
67345
|
if (!inQuotes) {
|
|
67346
67346
|
inQuotes = true;
|
|
@@ -67354,20 +67354,20 @@ var require_redact = __commonJS((exports, module) => {
|
|
|
67354
67354
|
} else if (char === "]" && !inQuotes) {
|
|
67355
67355
|
bracketCount--;
|
|
67356
67356
|
if (bracketCount < 0) {
|
|
67357
|
-
throw new Error(`Invalid redaction path (${
|
|
67357
|
+
throw new Error(`Invalid redaction path (${path6})`);
|
|
67358
67358
|
}
|
|
67359
67359
|
}
|
|
67360
67360
|
}
|
|
67361
67361
|
if (bracketCount !== 0) {
|
|
67362
|
-
throw new Error(`Invalid redaction path (${
|
|
67362
|
+
throw new Error(`Invalid redaction path (${path6})`);
|
|
67363
67363
|
}
|
|
67364
67364
|
}
|
|
67365
67365
|
function validatePaths(paths) {
|
|
67366
67366
|
if (!Array.isArray(paths)) {
|
|
67367
67367
|
throw new TypeError("paths must be an array");
|
|
67368
67368
|
}
|
|
67369
|
-
for (const
|
|
67370
|
-
validatePath(
|
|
67369
|
+
for (const path6 of paths) {
|
|
67370
|
+
validatePath(path6);
|
|
67371
67371
|
}
|
|
67372
67372
|
}
|
|
67373
67373
|
function slowRedact(options2 = {}) {
|
|
@@ -67529,8 +67529,8 @@ var require_redaction = __commonJS((exports, module) => {
|
|
|
67529
67529
|
if (shape[k] === null) {
|
|
67530
67530
|
o[k] = (value) => topCensor(value, [k]);
|
|
67531
67531
|
} else {
|
|
67532
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
67533
|
-
return censor(value, [k, ...
|
|
67532
|
+
const wrappedCensor = typeof censor === "function" ? (value, path6) => {
|
|
67533
|
+
return censor(value, [k, ...path6]);
|
|
67534
67534
|
} : censor;
|
|
67535
67535
|
o[k] = Redact({
|
|
67536
67536
|
paths: shape[k],
|
|
@@ -67741,7 +67741,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
|
|
|
67741
67741
|
var fs2 = __require("fs");
|
|
67742
67742
|
var EventEmitter = __require("events");
|
|
67743
67743
|
var inherits = __require("util").inherits;
|
|
67744
|
-
var
|
|
67744
|
+
var path6 = __require("path");
|
|
67745
67745
|
var sleep5 = require_atomic_sleep();
|
|
67746
67746
|
var assert3 = __require("assert");
|
|
67747
67747
|
var BUSY_WRITE_TIMEOUT = 100;
|
|
@@ -67796,7 +67796,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
|
|
|
67796
67796
|
if (sonic.sync) {
|
|
67797
67797
|
try {
|
|
67798
67798
|
if (sonic.mkdir)
|
|
67799
|
-
fs2.mkdirSync(
|
|
67799
|
+
fs2.mkdirSync(path6.dirname(file3), { recursive: true });
|
|
67800
67800
|
const fd = fs2.openSync(file3, flags, mode);
|
|
67801
67801
|
fileOpened(null, fd);
|
|
67802
67802
|
} catch (err) {
|
|
@@ -67804,7 +67804,7 @@ var require_sonic_boom = __commonJS((exports, module) => {
|
|
|
67804
67804
|
throw err;
|
|
67805
67805
|
}
|
|
67806
67806
|
} else if (sonic.mkdir) {
|
|
67807
|
-
fs2.mkdir(
|
|
67807
|
+
fs2.mkdir(path6.dirname(file3), { recursive: true }, (err) => {
|
|
67808
67808
|
if (err)
|
|
67809
67809
|
return fileOpened(err);
|
|
67810
67810
|
fs2.open(file3, flags, mode, fileOpened);
|
|
@@ -68530,7 +68530,7 @@ var require_indexes = __commonJS((exports, module) => {
|
|
|
68530
68530
|
|
|
68531
68531
|
// ../../node_modules/thread-stream/index.js
|
|
68532
68532
|
var require_thread_stream = __commonJS((exports, module) => {
|
|
68533
|
-
var __dirname = "/home/runner/work/swarm
|
|
68533
|
+
var __dirname = "/home/runner/work/swarm/swarm/node_modules/thread-stream";
|
|
68534
68534
|
var { version: version3 } = require_package();
|
|
68535
68535
|
var { EventEmitter } = __require("events");
|
|
68536
68536
|
var { Worker } = __require("worker_threads");
|
|
@@ -68951,10 +68951,10 @@ var require_thread_stream = __commonJS((exports, module) => {
|
|
|
68951
68951
|
|
|
68952
68952
|
// ../../node_modules/pino/lib/transport.js
|
|
68953
68953
|
var require_transport = __commonJS((exports, module) => {
|
|
68954
|
-
var __dirname = "/home/runner/work/swarm
|
|
68954
|
+
var __dirname = "/home/runner/work/swarm/swarm/node_modules/pino/lib";
|
|
68955
68955
|
var { createRequire: createRequire2 } = __require("module");
|
|
68956
68956
|
var getCallers = require_caller();
|
|
68957
|
-
var { join: join13, isAbsolute:
|
|
68957
|
+
var { join: join13, isAbsolute: isAbsolute3, sep: sep4 } = __require("node:path");
|
|
68958
68958
|
var sleep5 = require_atomic_sleep();
|
|
68959
68959
|
var onExit4 = require_on_exit_leak_free();
|
|
68960
68960
|
var ThreadStream = require_thread_stream();
|
|
@@ -69052,7 +69052,7 @@ var require_transport = __commonJS((exports, module) => {
|
|
|
69052
69052
|
return buildStream(fixTarget(target), options2, worker, sync4);
|
|
69053
69053
|
function fixTarget(origin) {
|
|
69054
69054
|
origin = bundlerOverrides[origin] || origin;
|
|
69055
|
-
if (
|
|
69055
|
+
if (isAbsolute3(origin) || origin.indexOf("file://") === 0) {
|
|
69056
69056
|
return origin;
|
|
69057
69057
|
}
|
|
69058
69058
|
if (origin === "pino/file") {
|
|
@@ -70657,11 +70657,11 @@ var require_pino = __commonJS((exports, module) => {
|
|
|
70657
70657
|
depthLimit: 5,
|
|
70658
70658
|
edgeLimit: 100
|
|
70659
70659
|
};
|
|
70660
|
-
var
|
|
70660
|
+
var normalize3 = createArgsNormalizer(defaultOptions);
|
|
70661
70661
|
var serializers = Object.assign(Object.create(null), stdSerializers);
|
|
70662
70662
|
function pino(...args2) {
|
|
70663
70663
|
const instance = {};
|
|
70664
|
-
const { opts, stream } =
|
|
70664
|
+
const { opts, stream } = normalize3(instance, caller(), ...args2);
|
|
70665
70665
|
if (opts.level && typeof opts.level === "string" && DEFAULT_LEVELS[opts.level.toLowerCase()] !== undefined)
|
|
70666
70666
|
opts.level = opts.level.toLowerCase();
|
|
70667
70667
|
const {
|
|
@@ -70794,32 +70794,401 @@ import {
|
|
|
70794
70794
|
findCellsByPartialId
|
|
70795
70795
|
} from "swarm-mail";
|
|
70796
70796
|
|
|
70797
|
-
//
|
|
70798
|
-
|
|
70799
|
-
|
|
70800
|
-
|
|
70797
|
+
// ../cross-path/dist/normalize.js
|
|
70798
|
+
import path2 from "node:path";
|
|
70799
|
+
|
|
70800
|
+
// ../cross-path/dist/detect.js
|
|
70801
|
+
var cachedEnvironment = null;
|
|
70802
|
+
function detectEnvironment() {
|
|
70803
|
+
if (cachedEnvironment !== null) {
|
|
70804
|
+
return cachedEnvironment;
|
|
70801
70805
|
}
|
|
70802
|
-
|
|
70803
|
-
|
|
70804
|
-
|
|
70805
|
-
|
|
70806
|
+
const platform = process.platform;
|
|
70807
|
+
if (platform === "win32") {
|
|
70808
|
+
cachedEnvironment = "windows";
|
|
70809
|
+
return cachedEnvironment;
|
|
70810
|
+
}
|
|
70811
|
+
if (platform === "darwin") {
|
|
70812
|
+
cachedEnvironment = "darwin";
|
|
70813
|
+
return cachedEnvironment;
|
|
70814
|
+
}
|
|
70815
|
+
if (platform === "linux") {
|
|
70816
|
+
if (process.env.WSL_DISTRO_NAME || process.env.WSLENV) {
|
|
70817
|
+
cachedEnvironment = "wsl";
|
|
70818
|
+
return cachedEnvironment;
|
|
70819
|
+
}
|
|
70820
|
+
const msystem = process.env.MSYSTEM;
|
|
70821
|
+
if (msystem && (msystem.includes("MINGW") || msystem.includes("MSYS"))) {
|
|
70822
|
+
cachedEnvironment = "git-bash";
|
|
70823
|
+
return cachedEnvironment;
|
|
70824
|
+
}
|
|
70825
|
+
if (process.env.CYGWIN) {
|
|
70826
|
+
cachedEnvironment = "cygwin";
|
|
70827
|
+
return cachedEnvironment;
|
|
70828
|
+
}
|
|
70829
|
+
cachedEnvironment = "linux";
|
|
70830
|
+
return cachedEnvironment;
|
|
70831
|
+
}
|
|
70832
|
+
cachedEnvironment = "linux";
|
|
70833
|
+
return cachedEnvironment;
|
|
70806
70834
|
}
|
|
70807
|
-
|
|
70808
|
-
|
|
70835
|
+
|
|
70836
|
+
// ../cross-path/dist/validate.js
|
|
70837
|
+
import path from "node:path";
|
|
70838
|
+
function isAbsolute(inputPath) {
|
|
70839
|
+
return path.win32.isAbsolute(inputPath) || path.posix.isAbsolute(inputPath);
|
|
70809
70840
|
}
|
|
70810
|
-
function
|
|
70811
|
-
|
|
70841
|
+
function isUNC(inputPath) {
|
|
70842
|
+
const normalized = inputPath.replace(/\\/g, "/");
|
|
70843
|
+
if (normalized.length < 3) {
|
|
70844
|
+
return false;
|
|
70845
|
+
}
|
|
70846
|
+
if (!normalized.startsWith("//")) {
|
|
70847
|
+
return false;
|
|
70848
|
+
}
|
|
70849
|
+
if (normalized[2] === "/") {
|
|
70850
|
+
return false;
|
|
70851
|
+
}
|
|
70852
|
+
const afterPrefix = normalized.substring(2);
|
|
70853
|
+
const hasValidServerPart = /^[^\s\/]+/.test(afterPrefix);
|
|
70854
|
+
return hasValidServerPart;
|
|
70855
|
+
}
|
|
70856
|
+
function isWSLMount(inputPath) {
|
|
70857
|
+
const wslMountPattern = /^\/mnt\/[a-z](\/|$)/i;
|
|
70858
|
+
return wslMountPattern.test(inputPath);
|
|
70812
70859
|
}
|
|
70813
|
-
function
|
|
70814
|
-
const
|
|
70815
|
-
|
|
70816
|
-
|
|
70860
|
+
function isGitBashMount(inputPath) {
|
|
70861
|
+
const gitBashPattern = /^\/[a-z]\//i;
|
|
70862
|
+
return gitBashPattern.test(inputPath);
|
|
70863
|
+
}
|
|
70864
|
+
function hasDriveLetter(inputPath) {
|
|
70865
|
+
const driveLetterPattern = /^[A-Za-z]:/;
|
|
70866
|
+
return driveLetterPattern.test(inputPath);
|
|
70867
|
+
}
|
|
70868
|
+
function parseWSLUNC(inputPath) {
|
|
70869
|
+
const normalized = inputPath.replace(/\\/g, "/");
|
|
70870
|
+
const wslUNCPattern = /^\/\/(wsl\.localhost|wsl\$)\/([^/]+)(\/.*)?$/i;
|
|
70871
|
+
const match = normalized.match(wslUNCPattern);
|
|
70872
|
+
if (!match) {
|
|
70873
|
+
return null;
|
|
70874
|
+
}
|
|
70875
|
+
const distro = match[2];
|
|
70876
|
+
const restPath = match[3] || "/";
|
|
70877
|
+
return { distro, path: restPath };
|
|
70878
|
+
}
|
|
70879
|
+
function isDriveRelative(inputPath) {
|
|
70880
|
+
if (inputPath.length < 3) {
|
|
70881
|
+
return false;
|
|
70882
|
+
}
|
|
70883
|
+
const hasLetter = /^[A-Za-z]$/.test(inputPath[0]);
|
|
70884
|
+
const hasColon = inputPath[1] === ":";
|
|
70885
|
+
const notSlash = inputPath[2] !== "/" && inputPath[2] !== "\\";
|
|
70886
|
+
return hasLetter && hasColon && notSlash;
|
|
70887
|
+
}
|
|
70888
|
+
|
|
70889
|
+
// ../cross-path/dist/normalize.js
|
|
70890
|
+
function normalize(inputPath, options2) {
|
|
70891
|
+
if (inputPath === null || inputPath === undefined) {
|
|
70892
|
+
throw new TypeError("Path cannot be null or undefined");
|
|
70893
|
+
}
|
|
70894
|
+
if (typeof inputPath !== "string") {
|
|
70895
|
+
throw new TypeError(`Path must be a string, received ${typeof inputPath}`);
|
|
70896
|
+
}
|
|
70897
|
+
if (inputPath.length === 0) {
|
|
70898
|
+
throw new TypeError("Path cannot be empty");
|
|
70899
|
+
}
|
|
70900
|
+
if (inputPath.includes("\x00")) {
|
|
70901
|
+
throw new TypeError("Path cannot contain null bytes");
|
|
70902
|
+
}
|
|
70903
|
+
const env = options2?.env ?? detectEnvironment();
|
|
70904
|
+
const wslUNCInfo = parseWSLUNC(inputPath);
|
|
70905
|
+
if (wslUNCInfo) {
|
|
70906
|
+
const currentDistro = process.env.WSL_DISTRO_NAME;
|
|
70907
|
+
if (env === "wsl" && currentDistro && wslUNCInfo.distro.toLowerCase() === currentDistro.toLowerCase()) {
|
|
70908
|
+
return path2.posix.normalize(wslUNCInfo.path);
|
|
70909
|
+
}
|
|
70910
|
+
}
|
|
70911
|
+
let intermediate = inputPath.replace(/\\/g, "/");
|
|
70912
|
+
const originalIsUNC = isUNC(intermediate);
|
|
70913
|
+
if (isWSLMount(intermediate)) {
|
|
70914
|
+
const driveLetter = intermediate.charAt(5).toLowerCase();
|
|
70915
|
+
intermediate = `${driveLetter}:${intermediate.substring(6)}`;
|
|
70916
|
+
if (intermediate.length === 2) {
|
|
70917
|
+
intermediate = `${driveLetter}:/`;
|
|
70918
|
+
}
|
|
70919
|
+
} else if (isGitBashMount(intermediate)) {
|
|
70920
|
+
const driveLetter = intermediate.charAt(1).toLowerCase();
|
|
70921
|
+
intermediate = `${driveLetter}:${intermediate.substring(2)}`;
|
|
70922
|
+
}
|
|
70923
|
+
const hasWindowsDrive = hasDriveLetter(intermediate);
|
|
70924
|
+
const isAbsolutePath = isAbsolute(intermediate);
|
|
70925
|
+
const driveRelative = isDriveRelative(intermediate);
|
|
70926
|
+
if (!isAbsolutePath && !hasWindowsDrive) {
|
|
70927
|
+
const basePath = options2?.basePath ?? process.cwd();
|
|
70928
|
+
const normalizedBase = basePath.replace(/\\/g, "/");
|
|
70929
|
+
if (hasDriveLetter(normalizedBase)) {
|
|
70930
|
+
const drive = normalizedBase.substring(0, 2);
|
|
70931
|
+
const baseRest = normalizedBase.substring(2) || "/";
|
|
70932
|
+
const resolved = path2.posix.resolve(baseRest, intermediate);
|
|
70933
|
+
intermediate = drive + resolved;
|
|
70934
|
+
} else {
|
|
70935
|
+
intermediate = path2.posix.resolve(normalizedBase, intermediate);
|
|
70936
|
+
}
|
|
70937
|
+
} else if (driveRelative) {
|
|
70938
|
+
const pathDrive = intermediate.substring(0, 2).toLowerCase();
|
|
70939
|
+
const pathRest = intermediate.substring(2);
|
|
70940
|
+
const basePath = options2?.basePath ?? process.cwd();
|
|
70941
|
+
const normalizedBase = basePath.replace(/\\/g, "/");
|
|
70942
|
+
if (hasDriveLetter(normalizedBase)) {
|
|
70943
|
+
const baseDrive = normalizedBase.substring(0, 2).toLowerCase();
|
|
70944
|
+
if (baseDrive === pathDrive) {
|
|
70945
|
+
const baseRest = normalizedBase.substring(2) || "/";
|
|
70946
|
+
const resolved = path2.posix.resolve(baseRest, pathRest);
|
|
70947
|
+
intermediate = pathDrive + resolved;
|
|
70948
|
+
} else {
|
|
70949
|
+
intermediate = pathDrive + "/" + pathRest;
|
|
70950
|
+
}
|
|
70951
|
+
} else {
|
|
70952
|
+
intermediate = pathDrive + "/" + pathRest;
|
|
70953
|
+
}
|
|
70954
|
+
}
|
|
70955
|
+
if (originalIsUNC || isUNC(intermediate)) {
|
|
70956
|
+
const withoutPrefix = intermediate.substring(2);
|
|
70957
|
+
const normalizedRest = path2.posix.normalize(withoutPrefix);
|
|
70958
|
+
intermediate = "//" + normalizedRest;
|
|
70959
|
+
} else if (hasWindowsDrive || hasDriveLetter(intermediate)) {
|
|
70960
|
+
const drive = intermediate.substring(0, 2);
|
|
70961
|
+
let rest = intermediate.substring(2);
|
|
70962
|
+
if (!rest.startsWith("/")) {
|
|
70963
|
+
rest = "/" + rest;
|
|
70964
|
+
}
|
|
70965
|
+
const normalizedRest = path2.posix.normalize(rest);
|
|
70966
|
+
intermediate = drive + normalizedRest;
|
|
70817
70967
|
} else {
|
|
70818
|
-
|
|
70968
|
+
intermediate = path2.posix.normalize(intermediate);
|
|
70969
|
+
}
|
|
70970
|
+
const finalHasDrive = hasDriveLetter(intermediate);
|
|
70971
|
+
const finalIsUNC = isUNC(intermediate);
|
|
70972
|
+
if (finalHasDrive || finalIsUNC) {
|
|
70973
|
+
intermediate = intermediate.toLowerCase();
|
|
70974
|
+
const segments = intermediate.split("/");
|
|
70975
|
+
const normalizedSegments = segments.map((segment, index) => {
|
|
70976
|
+
if (index === 0 || segment === "") {
|
|
70977
|
+
return segment;
|
|
70978
|
+
}
|
|
70979
|
+
return segment.replace(/[\s.]+$/, "");
|
|
70980
|
+
});
|
|
70981
|
+
intermediate = normalizedSegments.join("/");
|
|
70819
70982
|
}
|
|
70983
|
+
if (intermediate.length > 1 && intermediate.endsWith("/")) {
|
|
70984
|
+
const isWindowsRoot = finalHasDrive && intermediate.length === 3;
|
|
70985
|
+
const isPosixRoot = intermediate === "/";
|
|
70986
|
+
const isUNCRoot = finalIsUNC && intermediate.split("/").filter(Boolean).length <= 2;
|
|
70987
|
+
if (!isWindowsRoot && !isPosixRoot && !isUNCRoot) {
|
|
70988
|
+
intermediate = intermediate.slice(0, -1);
|
|
70989
|
+
}
|
|
70990
|
+
}
|
|
70991
|
+
if (finalHasDrive && intermediate.length === 2) {
|
|
70992
|
+
intermediate = intermediate + "/";
|
|
70993
|
+
}
|
|
70994
|
+
return intermediate;
|
|
70995
|
+
}
|
|
70996
|
+
function normalizePaths(paths, options2) {
|
|
70997
|
+
return paths.map((p) => normalize(p, options2));
|
|
70820
70998
|
}
|
|
70821
|
-
|
|
70822
|
-
|
|
70999
|
+
// src/utils/arg-normalizer.ts
|
|
71000
|
+
function toPlainObject(value) {
|
|
71001
|
+
if (typeof value === "string") {
|
|
71002
|
+
try {
|
|
71003
|
+
const parsed = JSON.parse(value);
|
|
71004
|
+
if (parsed && typeof parsed === "object")
|
|
71005
|
+
return parsed;
|
|
71006
|
+
} catch {
|
|
71007
|
+
return { title: value };
|
|
71008
|
+
}
|
|
71009
|
+
}
|
|
71010
|
+
if (value && typeof value === "object")
|
|
71011
|
+
return value;
|
|
71012
|
+
return {};
|
|
71013
|
+
}
|
|
71014
|
+
function coerceBoolean(v) {
|
|
71015
|
+
if (typeof v === "boolean")
|
|
71016
|
+
return v;
|
|
71017
|
+
if (typeof v === "string") {
|
|
71018
|
+
const s = v.trim().toLowerCase();
|
|
71019
|
+
if (["true", "t", "1", "yes", "y"].includes(s))
|
|
71020
|
+
return true;
|
|
71021
|
+
if (["false", "f", "0", "no", "n"].includes(s))
|
|
71022
|
+
return false;
|
|
71023
|
+
}
|
|
71024
|
+
if (typeof v === "number")
|
|
71025
|
+
return v !== 0;
|
|
71026
|
+
return;
|
|
71027
|
+
}
|
|
71028
|
+
function coerceNumber(v) {
|
|
71029
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
71030
|
+
return v;
|
|
71031
|
+
if (typeof v === "string") {
|
|
71032
|
+
const n = Number(v);
|
|
71033
|
+
if (!Number.isNaN(n))
|
|
71034
|
+
return n;
|
|
71035
|
+
}
|
|
71036
|
+
return;
|
|
71037
|
+
}
|
|
71038
|
+
function normalizeStatus(v) {
|
|
71039
|
+
if (typeof v !== "string")
|
|
71040
|
+
return;
|
|
71041
|
+
const s = v.trim().toLowerCase().replace(/\s+/g, "_").replace(/-+/g, "_");
|
|
71042
|
+
const allowed = new Set(["open", "in_progress", "blocked", "closed"]);
|
|
71043
|
+
if (allowed.has(s))
|
|
71044
|
+
return s;
|
|
71045
|
+
return;
|
|
71046
|
+
}
|
|
71047
|
+
function normalizeType(v) {
|
|
71048
|
+
if (typeof v !== "string")
|
|
71049
|
+
return;
|
|
71050
|
+
const s = v.trim().toLowerCase();
|
|
71051
|
+
const allowed = new Set(["bug", "feature", "task", "epic", "chore"]);
|
|
71052
|
+
if (allowed.has(s))
|
|
71053
|
+
return s;
|
|
71054
|
+
return;
|
|
71055
|
+
}
|
|
71056
|
+
function pick2(obj, keys) {
|
|
71057
|
+
const out = {};
|
|
71058
|
+
for (const k of keys)
|
|
71059
|
+
if (k in obj)
|
|
71060
|
+
out[k] = obj[k];
|
|
71061
|
+
return out;
|
|
71062
|
+
}
|
|
71063
|
+
function aliasCommonKeys(obj) {
|
|
71064
|
+
const out = { ...obj };
|
|
71065
|
+
const move = (from, to) => {
|
|
71066
|
+
if (out[from] !== undefined && out[to] === undefined) {
|
|
71067
|
+
out[to] = out[from];
|
|
71068
|
+
delete out[from];
|
|
71069
|
+
}
|
|
71070
|
+
};
|
|
71071
|
+
move("cell_id", "id");
|
|
71072
|
+
move("bead_id", "id");
|
|
71073
|
+
move("beadId", "id");
|
|
71074
|
+
move("parentId", "parent_id");
|
|
71075
|
+
move("issue_type", "type");
|
|
71076
|
+
move("issueType", "type");
|
|
71077
|
+
move("kind", "type");
|
|
71078
|
+
move("epicTitle", "epic_title");
|
|
71079
|
+
move("epicDescription", "epic_description");
|
|
71080
|
+
move("subTasks", "subtasks");
|
|
71081
|
+
move("tasks", "subtasks");
|
|
71082
|
+
move("items", "subtasks");
|
|
71083
|
+
move("idSuffix", "id_suffix");
|
|
71084
|
+
return out;
|
|
71085
|
+
}
|
|
71086
|
+
function normalizeCreateArgs(raw) {
|
|
71087
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
71088
|
+
if (typeof raw === "string" && !obj.title)
|
|
71089
|
+
obj.title = String(raw);
|
|
71090
|
+
if (obj.priority !== undefined)
|
|
71091
|
+
obj.priority = coerceNumber(obj.priority);
|
|
71092
|
+
if (obj.type !== undefined)
|
|
71093
|
+
obj.type = normalizeType(obj.type) ?? obj.type;
|
|
71094
|
+
if (obj.parent_id !== undefined)
|
|
71095
|
+
obj.parent_id = String(obj.parent_id);
|
|
71096
|
+
return pick2(obj, ["title", "type", "priority", "description", "parent_id"]);
|
|
71097
|
+
}
|
|
71098
|
+
function normalizeUpdateArgs(raw) {
|
|
71099
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
71100
|
+
if (obj.status !== undefined)
|
|
71101
|
+
obj.status = normalizeStatus(obj.status) ?? obj.status;
|
|
71102
|
+
if (obj.priority !== undefined)
|
|
71103
|
+
obj.priority = coerceNumber(obj.priority);
|
|
71104
|
+
if (obj.description !== undefined && obj.description != null)
|
|
71105
|
+
obj.description = String(obj.description);
|
|
71106
|
+
if (obj.id !== undefined)
|
|
71107
|
+
obj.id = String(obj.id);
|
|
71108
|
+
return pick2(obj, ["id", "status", "description", "priority"]);
|
|
71109
|
+
}
|
|
71110
|
+
function normalizeCloseArgs(raw) {
|
|
71111
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
71112
|
+
if (obj.id !== undefined)
|
|
71113
|
+
obj.id = String(obj.id);
|
|
71114
|
+
if (obj.reason !== undefined)
|
|
71115
|
+
obj.reason = String(obj.reason);
|
|
71116
|
+
return pick2(obj, ["id", "reason"]);
|
|
71117
|
+
}
|
|
71118
|
+
function normalizeQueryArgs(raw) {
|
|
71119
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
71120
|
+
if (obj.status !== undefined)
|
|
71121
|
+
obj.status = normalizeStatus(obj.status) ?? obj.status;
|
|
71122
|
+
if (obj.type !== undefined)
|
|
71123
|
+
obj.type = normalizeType(obj.type) ?? obj.type;
|
|
71124
|
+
if (obj.ready !== undefined)
|
|
71125
|
+
obj.ready = coerceBoolean(obj.ready);
|
|
71126
|
+
if (obj.parent_id !== undefined)
|
|
71127
|
+
obj.parent_id = String(obj.parent_id);
|
|
71128
|
+
if (obj.limit !== undefined)
|
|
71129
|
+
obj.limit = coerceNumber(obj.limit);
|
|
71130
|
+
return pick2(obj, ["status", "type", "ready", "parent_id", "limit"]);
|
|
71131
|
+
}
|
|
71132
|
+
function normalizeCellsArgs(raw) {
|
|
71133
|
+
const obj = aliasCommonKeys(toPlainObject(raw));
|
|
71134
|
+
if (obj.id !== undefined)
|
|
71135
|
+
obj.id = String(obj.id);
|
|
71136
|
+
if (obj.status !== undefined)
|
|
71137
|
+
obj.status = normalizeStatus(obj.status) ?? obj.status;
|
|
71138
|
+
if (obj.type !== undefined)
|
|
71139
|
+
obj.type = normalizeType(obj.type) ?? obj.type;
|
|
71140
|
+
if (obj.parent_id !== undefined)
|
|
71141
|
+
obj.parent_id = String(obj.parent_id);
|
|
71142
|
+
if (obj.ready !== undefined)
|
|
71143
|
+
obj.ready = coerceBoolean(obj.ready);
|
|
71144
|
+
if (obj.limit !== undefined)
|
|
71145
|
+
obj.limit = coerceNumber(obj.limit);
|
|
71146
|
+
return pick2(obj, ["id", "status", "type", "parent_id", "ready", "limit"]);
|
|
71147
|
+
}
|
|
71148
|
+
function normalizeEpicCreateArgs(raw) {
|
|
71149
|
+
const obj0 = aliasCommonKeys(toPlainObject(raw));
|
|
71150
|
+
const obj = { ...obj0 };
|
|
71151
|
+
if (obj.subtasks !== undefined && !Array.isArray(obj.subtasks)) {
|
|
71152
|
+
if (typeof obj.subtasks === "string")
|
|
71153
|
+
obj.subtasks = obj.subtasks.split(/[,\n]/).map((s) => ({ title: s.trim() })).filter((x) => x.title);
|
|
71154
|
+
else if (obj.subtasks && typeof obj.subtasks === "object")
|
|
71155
|
+
obj.subtasks = [obj.subtasks];
|
|
71156
|
+
}
|
|
71157
|
+
if (Array.isArray(obj.subtasks)) {
|
|
71158
|
+
obj.subtasks = obj.subtasks.map((st) => {
|
|
71159
|
+
if (typeof st === "string")
|
|
71160
|
+
return { title: st };
|
|
71161
|
+
const s = aliasCommonKeys(toPlainObject(st));
|
|
71162
|
+
if (s.priority !== undefined)
|
|
71163
|
+
s.priority = coerceNumber(s.priority);
|
|
71164
|
+
if (s.files && !Array.isArray(s.files))
|
|
71165
|
+
s.files = [String(s.files)];
|
|
71166
|
+
if (Array.isArray(s.files))
|
|
71167
|
+
s.files = s.files.map((p) => String(p));
|
|
71168
|
+
return pick2(s, ["title", "priority", "files", "id_suffix"]);
|
|
71169
|
+
});
|
|
71170
|
+
}
|
|
71171
|
+
if (obj.epic_title === undefined && typeof raw === "string")
|
|
71172
|
+
obj.epic_title = String(raw);
|
|
71173
|
+
if (obj.epic_description !== undefined)
|
|
71174
|
+
obj.epic_description = String(obj.epic_description);
|
|
71175
|
+
return pick2(obj, ["epic_title", "epic_description", "epic_id", "subtasks", "strategy", "task", "project_key", "recovery_context"]);
|
|
71176
|
+
}
|
|
71177
|
+
function formatZodError(toolName, err, example) {
|
|
71178
|
+
const issues = err.issues.map((i) => `- ${i.path.join(".") || "<root>"}: ${i.message}`).join(`
|
|
71179
|
+
`);
|
|
71180
|
+
const guidance = `How to fix:
|
|
71181
|
+
1) Check field names (snake_case expected).
|
|
71182
|
+
2) Coercions allowed: booleans as 'true/false', numbers as strings, status 'in-progress' -> 'in_progress'.
|
|
71183
|
+
3) Remove unknown fields or typos.`;
|
|
71184
|
+
const sample = example ? `
|
|
71185
|
+
|
|
71186
|
+
Example:
|
|
71187
|
+
${example}` : "";
|
|
71188
|
+
return `${toolName}: Invalid arguments.
|
|
71189
|
+
${issues}
|
|
71190
|
+
|
|
71191
|
+
${guidance}${sample}`;
|
|
70823
71192
|
}
|
|
70824
71193
|
|
|
70825
71194
|
// src/hive.ts
|
|
@@ -71507,6 +71876,25 @@ async function runGitCommand(args) {
|
|
|
71507
71876
|
const exitCode = await proc.exited;
|
|
71508
71877
|
return { exitCode, stdout, stderr };
|
|
71509
71878
|
}
|
|
71879
|
+
async function withRetry(operation, retries = 3, delayMs = 100) {
|
|
71880
|
+
let lastError;
|
|
71881
|
+
for (let attempt = 0;attempt <= retries; attempt++) {
|
|
71882
|
+
try {
|
|
71883
|
+
return await operation();
|
|
71884
|
+
} catch (err) {
|
|
71885
|
+
lastError = err;
|
|
71886
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
71887
|
+
if (attempt < retries && (message.includes("SQLITE_BUSY") || message.includes("SQLITE_BUSY_RECOVERY") || message.includes("database is locked"))) {
|
|
71888
|
+
await new Promise((r) => setTimeout(r, delayMs * (attempt + 1)));
|
|
71889
|
+
continue;
|
|
71890
|
+
}
|
|
71891
|
+
break;
|
|
71892
|
+
}
|
|
71893
|
+
}
|
|
71894
|
+
if (lastError instanceof Error)
|
|
71895
|
+
throw lastError;
|
|
71896
|
+
throw new Error(String(lastError));
|
|
71897
|
+
}
|
|
71510
71898
|
|
|
71511
71899
|
class HiveError extends Error {
|
|
71512
71900
|
command;
|
|
@@ -71532,8 +71920,8 @@ class HiveValidationError extends Error {
|
|
|
71532
71920
|
}
|
|
71533
71921
|
var BeadValidationError = HiveValidationError;
|
|
71534
71922
|
function checkBeadsMigrationNeeded(projectPath) {
|
|
71535
|
-
const beadsDir =
|
|
71536
|
-
const hiveDir =
|
|
71923
|
+
const beadsDir = normalize(join2(projectPath, ".beads"));
|
|
71924
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
71537
71925
|
if (existsSync2(hiveDir)) {
|
|
71538
71926
|
return { needed: false };
|
|
71539
71927
|
}
|
|
@@ -71543,8 +71931,8 @@ function checkBeadsMigrationNeeded(projectPath) {
|
|
|
71543
71931
|
return { needed: false };
|
|
71544
71932
|
}
|
|
71545
71933
|
async function migrateBeadsToHive(projectPath) {
|
|
71546
|
-
const beadsDir =
|
|
71547
|
-
const hiveDir =
|
|
71934
|
+
const beadsDir = normalize(join2(projectPath, ".beads"));
|
|
71935
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
71548
71936
|
if (existsSync2(hiveDir)) {
|
|
71549
71937
|
return {
|
|
71550
71938
|
migrated: false,
|
|
@@ -71562,7 +71950,7 @@ async function migrateBeadsToHive(projectPath) {
|
|
|
71562
71950
|
return { migrated: true };
|
|
71563
71951
|
}
|
|
71564
71952
|
function ensureHiveDirectory(projectPath) {
|
|
71565
|
-
const hiveDir =
|
|
71953
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
71566
71954
|
if (!existsSync2(hiveDir)) {
|
|
71567
71955
|
const { mkdirSync: mkdirSync2 } = __require("node:fs");
|
|
71568
71956
|
mkdirSync2(hiveDir, { recursive: true });
|
|
@@ -71570,9 +71958,9 @@ function ensureHiveDirectory(projectPath) {
|
|
|
71570
71958
|
}
|
|
71571
71959
|
async function mergeHistoricBeads(projectPath) {
|
|
71572
71960
|
const { readFileSync: readFileSync3, writeFileSync: writeFileSync2, existsSync: existsSync3 } = await import("node:fs");
|
|
71573
|
-
const hiveDir =
|
|
71574
|
-
const basePath =
|
|
71575
|
-
const issuesPath =
|
|
71961
|
+
const hiveDir = normalize(join2(projectPath, ".hive"));
|
|
71962
|
+
const basePath = normalize(join2(hiveDir, "beads.base.jsonl"));
|
|
71963
|
+
const issuesPath = normalize(join2(hiveDir, "issues.jsonl"));
|
|
71576
71964
|
if (!existsSync3(basePath)) {
|
|
71577
71965
|
return { merged: 0, skipped: 0 };
|
|
71578
71966
|
}
|
|
@@ -71604,7 +71992,7 @@ async function mergeHistoricBeads(projectPath) {
|
|
|
71604
71992
|
writeFileSync2(issuesPath, mergedContent, "utf-8");
|
|
71605
71993
|
return { merged, skipped };
|
|
71606
71994
|
}
|
|
71607
|
-
async function
|
|
71995
|
+
async function importJsonlToLibSQL(projectPath) {
|
|
71608
71996
|
const jsonlPath = join2(projectPath, ".hive", "issues.jsonl");
|
|
71609
71997
|
if (!existsSync2(jsonlPath)) {
|
|
71610
71998
|
return { imported: 0, updated: 0, errors: 0 };
|
|
@@ -71672,6 +72060,7 @@ async function importJsonlToPGLite(projectPath) {
|
|
|
71672
72060
|
}
|
|
71673
72061
|
return { imported, updated, errors: errors5 };
|
|
71674
72062
|
}
|
|
72063
|
+
var importJsonlToPGLite = importJsonlToLibSQL;
|
|
71675
72064
|
var adapterCache = new Map;
|
|
71676
72065
|
var exitHookRegistered = false;
|
|
71677
72066
|
var exitHookRunning = false;
|
|
@@ -71777,7 +72166,19 @@ var hive_create = tool({
|
|
|
71777
72166
|
parent_id: tool.schema.string().optional().describe("Parent cell ID for epic children")
|
|
71778
72167
|
},
|
|
71779
72168
|
async execute(args, ctx) {
|
|
71780
|
-
const
|
|
72169
|
+
const normalized = normalizeCreateArgs(args);
|
|
72170
|
+
const parsed = CellCreateArgsSchema.safeParse(normalized);
|
|
72171
|
+
if (!parsed.success) {
|
|
72172
|
+
const message = formatZodError("hive_create", parsed.error, `{
|
|
72173
|
+
"title": "Fix login bug",
|
|
72174
|
+
"type": "bug",
|
|
72175
|
+
"priority": 2,
|
|
72176
|
+
"description": "Null check on session token",
|
|
72177
|
+
"parent_id": "project-abc12"
|
|
72178
|
+
}`);
|
|
72179
|
+
throw new HiveValidationError(message, parsed.error);
|
|
72180
|
+
}
|
|
72181
|
+
const validated = parsed.data;
|
|
71781
72182
|
const projectKey = getHiveWorkingDirectory();
|
|
71782
72183
|
const adapter = await getHiveAdapter(projectKey);
|
|
71783
72184
|
try {
|
|
@@ -71833,7 +72234,20 @@ var hive_create_epic = tool({
|
|
|
71833
72234
|
}).optional().describe("Recovery context from checkpoint compaction")
|
|
71834
72235
|
},
|
|
71835
72236
|
async execute(args, ctx) {
|
|
71836
|
-
const
|
|
72237
|
+
const normalized = normalizeEpicCreateArgs(args);
|
|
72238
|
+
const parsed = EpicCreateArgsSchema.safeParse(normalized);
|
|
72239
|
+
if (!parsed.success) {
|
|
72240
|
+
const message = formatZodError("hive_create_epic", parsed.error, `{
|
|
72241
|
+
"epic_title": "Ship new Auth",
|
|
72242
|
+
"epic_description": "Auth overhaul with passwordless",
|
|
72243
|
+
"subtasks": [
|
|
72244
|
+
{ "title": "DB migration", "priority": 1 },
|
|
72245
|
+
{ "title": "Add magic links", "priority": 2 }
|
|
72246
|
+
]
|
|
72247
|
+
}`);
|
|
72248
|
+
throw new HiveValidationError(message, parsed.error);
|
|
72249
|
+
}
|
|
72250
|
+
const validated = parsed.data;
|
|
71837
72251
|
const projectKey = getHiveWorkingDirectory();
|
|
71838
72252
|
const adapter = await getHiveAdapter(projectKey);
|
|
71839
72253
|
const created = [];
|
|
@@ -71856,12 +72270,21 @@ var hive_create_epic = tool({
|
|
|
71856
72270
|
await adapter.markDirty(projectKey, subtaskCell.id);
|
|
71857
72271
|
created.push(subtaskCell);
|
|
71858
72272
|
}
|
|
72273
|
+
try {
|
|
72274
|
+
const children = await adapter.queryCells(projectKey, { parent_id: epic.id });
|
|
72275
|
+
if (children.length !== validated.subtasks.length) {
|
|
72276
|
+
throw new Error(`Post-create validation failed: expected ${validated.subtasks.length} subtasks, found ${children.length}`);
|
|
72277
|
+
}
|
|
72278
|
+
} catch (e) {
|
|
72279
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
72280
|
+
throw new Error(`Epic integrity check failed: ${msg}`);
|
|
72281
|
+
}
|
|
71859
72282
|
const result = {
|
|
71860
72283
|
success: true,
|
|
71861
72284
|
epic: formatCellForOutput(epic),
|
|
71862
72285
|
subtasks: created.slice(1).map((c) => formatCellForOutput(c))
|
|
71863
72286
|
};
|
|
71864
|
-
const effectiveProjectKey =
|
|
72287
|
+
const effectiveProjectKey = normalized.project_key || projectKey;
|
|
71865
72288
|
try {
|
|
71866
72289
|
const epicCreatedEvent = createEvent("epic_created", {
|
|
71867
72290
|
project_key: effectiveProjectKey,
|
|
@@ -71879,16 +72302,16 @@ var hive_create_epic = tool({
|
|
|
71879
72302
|
const event = createEvent("decomposition_generated", {
|
|
71880
72303
|
project_key: effectiveProjectKey,
|
|
71881
72304
|
epic_id: epic.id,
|
|
71882
|
-
task:
|
|
72305
|
+
task: normalized.task || validated.epic_title,
|
|
71883
72306
|
context: validated.epic_description,
|
|
71884
|
-
strategy:
|
|
72307
|
+
strategy: normalized.strategy || "feature-based",
|
|
71885
72308
|
epic_title: validated.epic_title,
|
|
71886
72309
|
subtasks: validated.subtasks.map((st) => ({
|
|
71887
72310
|
title: st.title,
|
|
71888
72311
|
files: st.files || [],
|
|
71889
72312
|
priority: st.priority
|
|
71890
72313
|
})),
|
|
71891
|
-
recovery_context:
|
|
72314
|
+
recovery_context: normalized.recovery_context
|
|
71892
72315
|
});
|
|
71893
72316
|
await appendEvent(event, effectiveProjectKey);
|
|
71894
72317
|
} catch (error89) {
|
|
@@ -71900,7 +72323,7 @@ var hive_create_epic = tool({
|
|
|
71900
72323
|
project_key: effectiveProjectKey,
|
|
71901
72324
|
epic_id: epic.id,
|
|
71902
72325
|
epic_title: validated.epic_title,
|
|
71903
|
-
strategy:
|
|
72326
|
+
strategy: normalized.strategy || "feature-based",
|
|
71904
72327
|
subtask_count: validated.subtasks.length,
|
|
71905
72328
|
total_files: totalFiles,
|
|
71906
72329
|
coordinator_agent: "coordinator"
|
|
@@ -71925,10 +72348,10 @@ var hive_create_epic = tool({
|
|
|
71925
72348
|
decision_type: "decomposition_complete",
|
|
71926
72349
|
payload: {
|
|
71927
72350
|
subtask_count: validated.subtasks.length,
|
|
71928
|
-
strategy_used:
|
|
72351
|
+
strategy_used: normalized.strategy || "feature-based",
|
|
71929
72352
|
files_per_subtask: filesPerSubtask,
|
|
71930
72353
|
epic_title: validated.epic_title,
|
|
71931
|
-
task:
|
|
72354
|
+
task: normalized.task
|
|
71932
72355
|
}
|
|
71933
72356
|
});
|
|
71934
72357
|
} catch (error89) {
|
|
@@ -71984,7 +72407,18 @@ var hive_query = tool({
|
|
|
71984
72407
|
limit: tool.schema.number().optional().describe("Max results to return (default: 20)")
|
|
71985
72408
|
},
|
|
71986
72409
|
async execute(args, ctx) {
|
|
71987
|
-
const
|
|
72410
|
+
const normalized = normalizeQueryArgs(args);
|
|
72411
|
+
const parsed = CellQueryArgsSchema.safeParse(normalized);
|
|
72412
|
+
if (!parsed.success) {
|
|
72413
|
+
const message = formatZodError("hive_query", parsed.error, `{
|
|
72414
|
+
"status": "in_progress",
|
|
72415
|
+
"type": "task",
|
|
72416
|
+
"parent_id": "project-abc12",
|
|
72417
|
+
"limit": 10
|
|
72418
|
+
}`);
|
|
72419
|
+
throw new HiveValidationError(message, parsed.error);
|
|
72420
|
+
}
|
|
72421
|
+
const validated = parsed.data;
|
|
71988
72422
|
const projectKey = getHiveWorkingDirectory();
|
|
71989
72423
|
const adapter = await getHiveAdapter(projectKey);
|
|
71990
72424
|
try {
|
|
@@ -72017,20 +72451,32 @@ var hive_update = tool({
|
|
|
72017
72451
|
priority: tool.schema.number().min(0).max(3).optional().describe("New priority")
|
|
72018
72452
|
},
|
|
72019
72453
|
async execute(args, ctx) {
|
|
72020
|
-
const
|
|
72454
|
+
const normalized = normalizeUpdateArgs(args);
|
|
72455
|
+
const parsed = CellUpdateArgsSchema.safeParse(normalized);
|
|
72456
|
+
if (!parsed.success) {
|
|
72457
|
+
const message = formatZodError("hive_update", parsed.error, `{
|
|
72458
|
+
"id": "project-abc12",
|
|
72459
|
+
"status": "in_progress",
|
|
72460
|
+
"priority": 1,
|
|
72461
|
+
"description": "Ready for review"
|
|
72462
|
+
}`);
|
|
72463
|
+
throw new HiveValidationError(message, parsed.error);
|
|
72464
|
+
}
|
|
72465
|
+
const validated = parsed.data;
|
|
72021
72466
|
const projectKey = getHiveWorkingDirectory();
|
|
72022
72467
|
const adapter = await getHiveAdapter(projectKey);
|
|
72023
72468
|
try {
|
|
72024
72469
|
const cellId = await resolvePartialId(adapter, projectKey, validated.id) || validated.id;
|
|
72025
72470
|
let cell;
|
|
72026
|
-
if (validated.status) {
|
|
72027
|
-
|
|
72471
|
+
if (validated.status !== undefined) {
|
|
72472
|
+
const newStatus = validated.status;
|
|
72473
|
+
cell = await withRetry(() => adapter.changeCellStatus(projectKey, cellId, newStatus));
|
|
72028
72474
|
}
|
|
72029
72475
|
if (validated.description !== undefined || validated.priority !== undefined) {
|
|
72030
|
-
cell = await adapter.updateCell(projectKey, cellId, {
|
|
72476
|
+
cell = await withRetry(() => adapter.updateCell(projectKey, cellId, {
|
|
72031
72477
|
description: validated.description,
|
|
72032
72478
|
priority: validated.priority
|
|
72033
|
-
});
|
|
72479
|
+
}));
|
|
72034
72480
|
} else if (!validated.status) {
|
|
72035
72481
|
const existingCell = await adapter.getCell(projectKey, cellId);
|
|
72036
72482
|
if (!existingCell) {
|
|
@@ -72077,14 +72523,23 @@ var hive_close = tool({
|
|
|
72077
72523
|
reason: tool.schema.string().describe("Completion reason")
|
|
72078
72524
|
},
|
|
72079
72525
|
async execute(args, ctx) {
|
|
72080
|
-
const
|
|
72526
|
+
const normalized = normalizeCloseArgs(args);
|
|
72527
|
+
const parsed = CellCloseArgsSchema.safeParse(normalized);
|
|
72528
|
+
if (!parsed.success) {
|
|
72529
|
+
const message = formatZodError("hive_close", parsed.error, `{
|
|
72530
|
+
"id": "project-abc12",
|
|
72531
|
+
"reason": "Merged in main"
|
|
72532
|
+
}`);
|
|
72533
|
+
throw new HiveValidationError(message, parsed.error);
|
|
72534
|
+
}
|
|
72535
|
+
const validated = parsed.data;
|
|
72081
72536
|
const projectKey = getHiveWorkingDirectory();
|
|
72082
72537
|
const adapter = await getHiveAdapter(projectKey);
|
|
72083
72538
|
try {
|
|
72084
72539
|
const cellId = await resolvePartialId(adapter, projectKey, validated.id) || validated.id;
|
|
72085
72540
|
const cellBeforeClose = await adapter.getCell(projectKey, cellId);
|
|
72086
72541
|
const isEpic = cellBeforeClose?.type === "epic";
|
|
72087
|
-
const cell = await adapter.closeCell(projectKey, cellId, validated.reason);
|
|
72542
|
+
const cell = await withRetry(() => adapter.closeCell(projectKey, cellId, validated.reason));
|
|
72088
72543
|
await adapter.markDirty(projectKey, cellId);
|
|
72089
72544
|
if (isEpic && cellBeforeClose) {
|
|
72090
72545
|
try {
|
|
@@ -72205,7 +72660,7 @@ var hive_start = tool({
|
|
|
72205
72660
|
const adapter = await getHiveAdapter(projectKey);
|
|
72206
72661
|
try {
|
|
72207
72662
|
const cellId = await resolvePartialId(adapter, projectKey, args.id) || args.id;
|
|
72208
|
-
const cell = await adapter.changeCellStatus(projectKey, cellId, "in_progress");
|
|
72663
|
+
const cell = await withRetry(() => adapter.changeCellStatus(projectKey, cellId, "in_progress"));
|
|
72209
72664
|
await adapter.markDirty(projectKey, cellId);
|
|
72210
72665
|
try {
|
|
72211
72666
|
const event = createEvent("cell_status_changed", {
|
|
@@ -72280,16 +72735,17 @@ PREFER THIS OVER hive_query when you need to:
|
|
|
72280
72735
|
async execute(args, ctx) {
|
|
72281
72736
|
const projectKey = getHiveWorkingDirectory();
|
|
72282
72737
|
const adapter = await getHiveAdapter(projectKey);
|
|
72738
|
+
const normalized = normalizeCellsArgs(args);
|
|
72283
72739
|
try {
|
|
72284
|
-
if (
|
|
72285
|
-
const matchingCells = await findCellsByPartialId(adapter, projectKey,
|
|
72740
|
+
if (normalized.id) {
|
|
72741
|
+
const matchingCells = await findCellsByPartialId(adapter, projectKey, normalized.id);
|
|
72286
72742
|
if (matchingCells.length === 0) {
|
|
72287
|
-
throw new HiveError(`No cell found matching ID '${
|
|
72743
|
+
throw new HiveError(`No cell found matching ID '${normalized.id}'`, "hive_cells");
|
|
72288
72744
|
}
|
|
72289
72745
|
const formatted2 = matchingCells.map((c) => formatCellForOutput(c));
|
|
72290
72746
|
return JSON.stringify(formatted2, null, 2);
|
|
72291
72747
|
}
|
|
72292
|
-
if (
|
|
72748
|
+
if (normalized.ready) {
|
|
72293
72749
|
const ready = await adapter.getNextReadyCell(projectKey);
|
|
72294
72750
|
if (!ready) {
|
|
72295
72751
|
return JSON.stringify([], null, 2);
|
|
@@ -72298,10 +72754,10 @@ PREFER THIS OVER hive_query when you need to:
|
|
|
72298
72754
|
return JSON.stringify([formatted2], null, 2);
|
|
72299
72755
|
}
|
|
72300
72756
|
const cells = await adapter.queryCells(projectKey, {
|
|
72301
|
-
status:
|
|
72302
|
-
type:
|
|
72303
|
-
parent_id:
|
|
72304
|
-
limit:
|
|
72757
|
+
status: normalized.status,
|
|
72758
|
+
type: normalized.type,
|
|
72759
|
+
parent_id: normalized.parent_id,
|
|
72760
|
+
limit: normalized.limit || 20
|
|
72305
72761
|
});
|
|
72306
72762
|
const formatted = cells.map((c) => formatCellForOutput(c));
|
|
72307
72763
|
return JSON.stringify(formatted, null, 2);
|
|
@@ -72311,7 +72767,7 @@ PREFER THIS OVER hive_query when you need to:
|
|
|
72311
72767
|
}
|
|
72312
72768
|
const message = error89 instanceof Error ? error89.message : String(error89);
|
|
72313
72769
|
if (message.includes("Bead not found") || message.includes("Cell not found")) {
|
|
72314
|
-
throw new HiveError(`No cell found matching ID '${
|
|
72770
|
+
throw new HiveError(`No cell found matching ID '${normalized.id || "unknown"}'`, "hive_cells");
|
|
72315
72771
|
}
|
|
72316
72772
|
throw new HiveError(`Failed to query cells: ${message}`, "hive_cells");
|
|
72317
72773
|
}
|
|
@@ -72380,6 +72836,14 @@ var hive_sync = tool({
|
|
|
72380
72836
|
const remoteCheckResult2 = await runGitCommand(["remote"]);
|
|
72381
72837
|
const hasRemote2 = remoteCheckResult2.stdout.trim() !== "";
|
|
72382
72838
|
if (hasRemote2) {
|
|
72839
|
+
await withTimeout(runGitCommand(["fetch", "--all", "--prune"]), TIMEOUT_MS, "git fetch");
|
|
72840
|
+
const upstreamResult = await runGitCommand([
|
|
72841
|
+
"rev-parse",
|
|
72842
|
+
"--abbrev-ref",
|
|
72843
|
+
"--symbolic-full-name",
|
|
72844
|
+
"@{u}"
|
|
72845
|
+
]);
|
|
72846
|
+
const hasUpstream = upstreamResult.exitCode === 0;
|
|
72383
72847
|
const statusResult = await runGitCommand(["status", "--porcelain"]);
|
|
72384
72848
|
const hasUnstagedChanges = statusResult.stdout.trim() !== "";
|
|
72385
72849
|
let didStash = false;
|
|
@@ -72390,9 +72854,13 @@ var hive_sync = tool({
|
|
|
72390
72854
|
}
|
|
72391
72855
|
}
|
|
72392
72856
|
try {
|
|
72393
|
-
|
|
72394
|
-
|
|
72395
|
-
|
|
72857
|
+
if (hasUpstream) {
|
|
72858
|
+
const pullResult = await withTimeout(runGitCommand(["pull", "--rebase"]), TIMEOUT_MS, "git pull --rebase");
|
|
72859
|
+
if (pullResult.exitCode !== 0) {
|
|
72860
|
+
throw new HiveError(`Failed to pull: ${pullResult.stderr}`, "git pull --rebase", pullResult.exitCode);
|
|
72861
|
+
}
|
|
72862
|
+
} else {
|
|
72863
|
+
console.warn("[hive_sync] No upstream configured for current branch. Skipping pull.");
|
|
72396
72864
|
}
|
|
72397
72865
|
} finally {
|
|
72398
72866
|
if (didStash) {
|
|
@@ -72928,7 +73396,7 @@ var createDatabase = null;
|
|
|
72928
73396
|
try {
|
|
72929
73397
|
if (typeof globalThis.Bun !== "undefined") {
|
|
72930
73398
|
const bunSqlite = await import("bun:sqlite");
|
|
72931
|
-
createDatabase = (
|
|
73399
|
+
createDatabase = (path4) => new bunSqlite.Database(path4);
|
|
72932
73400
|
sqliteAvailable = true;
|
|
72933
73401
|
}
|
|
72934
73402
|
} catch {
|
|
@@ -73278,10 +73746,10 @@ function getSessionStatePath(sessionID) {
|
|
|
73278
73746
|
return join4(SESSION_STATE_DIR, `${safeID}.json`);
|
|
73279
73747
|
}
|
|
73280
73748
|
function loadSessionState(sessionID) {
|
|
73281
|
-
const
|
|
73749
|
+
const path4 = getSessionStatePath(sessionID);
|
|
73282
73750
|
try {
|
|
73283
|
-
if (existsSync4(
|
|
73284
|
-
const data = readFileSync3(
|
|
73751
|
+
if (existsSync4(path4)) {
|
|
73752
|
+
const data = readFileSync3(path4, "utf-8");
|
|
73285
73753
|
return JSON.parse(data);
|
|
73286
73754
|
}
|
|
73287
73755
|
} catch (error89) {
|
|
@@ -73294,8 +73762,8 @@ function saveSessionState(sessionID, state) {
|
|
|
73294
73762
|
if (!existsSync4(SESSION_STATE_DIR)) {
|
|
73295
73763
|
mkdirSync3(SESSION_STATE_DIR, { recursive: true });
|
|
73296
73764
|
}
|
|
73297
|
-
const
|
|
73298
|
-
writeFileSync2(
|
|
73765
|
+
const path4 = getSessionStatePath(sessionID);
|
|
73766
|
+
writeFileSync2(path4, JSON.stringify(state, null, 2));
|
|
73299
73767
|
return true;
|
|
73300
73768
|
} catch (error89) {
|
|
73301
73769
|
console.error(`[agent-mail] CRITICAL: Could not save session state: ${error89}`);
|
|
@@ -73436,11 +73904,11 @@ async function restartServer() {
|
|
|
73436
73904
|
`${process.env.HOME}/mcp_agent_mail`
|
|
73437
73905
|
];
|
|
73438
73906
|
let serverDir = null;
|
|
73439
|
-
for (const
|
|
73907
|
+
for (const path4 of possiblePaths) {
|
|
73440
73908
|
try {
|
|
73441
|
-
const stat = await Bun.file(`${
|
|
73909
|
+
const stat = await Bun.file(`${path4}/pyproject.toml`).exists();
|
|
73442
73910
|
if (stat) {
|
|
73443
|
-
serverDir =
|
|
73911
|
+
serverDir = path4;
|
|
73444
73912
|
break;
|
|
73445
73913
|
}
|
|
73446
73914
|
} catch {
|
|
@@ -74355,10 +74823,10 @@ function getSessionStatePath2(sessionID) {
|
|
|
74355
74823
|
return join5(SESSION_STATE_DIR2, `${safeID}.json`);
|
|
74356
74824
|
}
|
|
74357
74825
|
function loadSessionState2(sessionID) {
|
|
74358
|
-
const
|
|
74826
|
+
const path4 = getSessionStatePath2(sessionID);
|
|
74359
74827
|
try {
|
|
74360
|
-
if (existsSync5(
|
|
74361
|
-
const data = readFileSync4(
|
|
74828
|
+
if (existsSync5(path4)) {
|
|
74829
|
+
const data = readFileSync4(path4, "utf-8");
|
|
74362
74830
|
return JSON.parse(data);
|
|
74363
74831
|
}
|
|
74364
74832
|
} catch (error89) {
|
|
@@ -74371,8 +74839,8 @@ function saveSessionState2(sessionID, state) {
|
|
|
74371
74839
|
if (!existsSync5(SESSION_STATE_DIR2)) {
|
|
74372
74840
|
mkdirSync4(SESSION_STATE_DIR2, { recursive: true });
|
|
74373
74841
|
}
|
|
74374
|
-
const
|
|
74375
|
-
writeFileSync3(
|
|
74842
|
+
const path4 = getSessionStatePath2(sessionID);
|
|
74843
|
+
writeFileSync3(path4, JSON.stringify(state, null, 2));
|
|
74376
74844
|
return true;
|
|
74377
74845
|
} catch (error89) {
|
|
74378
74846
|
console.warn(`[swarm-mail] Could not save session state: ${error89}`);
|
|
@@ -74380,10 +74848,10 @@ function saveSessionState2(sessionID, state) {
|
|
|
74380
74848
|
}
|
|
74381
74849
|
}
|
|
74382
74850
|
function clearSessionState(sessionID) {
|
|
74383
|
-
const
|
|
74851
|
+
const path4 = getSessionStatePath2(sessionID);
|
|
74384
74852
|
try {
|
|
74385
|
-
if (existsSync5(
|
|
74386
|
-
unlinkSync2(
|
|
74853
|
+
if (existsSync5(path4)) {
|
|
74854
|
+
unlinkSync2(path4);
|
|
74387
74855
|
}
|
|
74388
74856
|
} catch {}
|
|
74389
74857
|
}
|
|
@@ -74414,12 +74882,27 @@ var swarmmail_init = tool({
|
|
|
74414
74882
|
const sessionID = ctx.sessionID || "default";
|
|
74415
74883
|
const existingState = loadSessionState2(sessionID);
|
|
74416
74884
|
if (existingState) {
|
|
74417
|
-
|
|
74418
|
-
|
|
74419
|
-
|
|
74420
|
-
|
|
74421
|
-
|
|
74422
|
-
}
|
|
74885
|
+
const requestedAgent = args.agent_name;
|
|
74886
|
+
const projectMismatch = existingState.projectKey !== projectPath;
|
|
74887
|
+
const agentMismatch = Boolean(requestedAgent && requestedAgent !== existingState.agentName);
|
|
74888
|
+
if (args.force_reinit) {
|
|
74889
|
+
clearSessionState(sessionID);
|
|
74890
|
+
} else {
|
|
74891
|
+
return JSON.stringify({
|
|
74892
|
+
agent_name: existingState.agentName,
|
|
74893
|
+
project_key: existingState.projectKey,
|
|
74894
|
+
message: `Session already initialized as ${existingState.agentName}`,
|
|
74895
|
+
already_initialized: true,
|
|
74896
|
+
session_id: sessionID,
|
|
74897
|
+
project_mismatch: projectMismatch || undefined,
|
|
74898
|
+
agent_mismatch: agentMismatch || undefined,
|
|
74899
|
+
note: projectMismatch || agentMismatch ? "To switch project/agent, call swarmmail_init again with force_reinit: true (or end the session)." : undefined,
|
|
74900
|
+
requested: requestedAgent || args.project_path ? {
|
|
74901
|
+
agent_name: requestedAgent,
|
|
74902
|
+
project_key: args.project_path
|
|
74903
|
+
} : undefined
|
|
74904
|
+
}, null, 2);
|
|
74905
|
+
}
|
|
74423
74906
|
}
|
|
74424
74907
|
try {
|
|
74425
74908
|
const result = await initSwarmAgent({
|
|
@@ -74633,7 +75116,7 @@ var swarmmail_release = tool({
|
|
|
74633
75116
|
} else if (args.reservation_ids) {
|
|
74634
75117
|
state.reservations = state.reservations.filter((id) => !args.reservation_ids.includes(id));
|
|
74635
75118
|
} else if (normalizedPaths) {
|
|
74636
|
-
const releasedIds = currentReservations.filter((r) => normalizedPaths.
|
|
75119
|
+
const releasedIds = currentReservations.filter((r) => normalizedPaths.some((p) => p === r.path_pattern)).map((r) => r.id);
|
|
74637
75120
|
state.reservations = state.reservations.filter((id) => !releasedIds.includes(id));
|
|
74638
75121
|
}
|
|
74639
75122
|
saveSessionState2(sessionID, state);
|
|
@@ -74806,8 +75289,8 @@ class JsonExtractionError extends Error {
|
|
|
74806
75289
|
}
|
|
74807
75290
|
function formatZodErrors(error89) {
|
|
74808
75291
|
return error89.issues.map((issue3) => {
|
|
74809
|
-
const
|
|
74810
|
-
return `${
|
|
75292
|
+
const path4 = issue3.path.length > 0 ? `${issue3.path.join(".")}: ` : "";
|
|
75293
|
+
return `${path4}${issue3.message}`;
|
|
74811
75294
|
});
|
|
74812
75295
|
}
|
|
74813
75296
|
var SCHEMA_REGISTRY = {
|
|
@@ -76970,11 +77453,11 @@ var qmarksTestNoExtDot = ([$0]) => {
|
|
|
76970
77453
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
76971
77454
|
};
|
|
76972
77455
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
76973
|
-
var
|
|
77456
|
+
var path4 = {
|
|
76974
77457
|
win32: { sep: "\\" },
|
|
76975
77458
|
posix: { sep: "/" }
|
|
76976
77459
|
};
|
|
76977
|
-
var sep2 = defaultPlatform === "win32" ?
|
|
77460
|
+
var sep2 = defaultPlatform === "win32" ? path4.win32.sep : path4.posix.sep;
|
|
76978
77461
|
minimatch.sep = sep2;
|
|
76979
77462
|
var GLOBSTAR = Symbol("globstar **");
|
|
76980
77463
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -77120,9 +77603,9 @@ class Minimatch {
|
|
|
77120
77603
|
this.debug(this.pattern, this.globParts);
|
|
77121
77604
|
let set3 = this.globParts.map((s, _, __) => {
|
|
77122
77605
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
77123
|
-
const
|
|
77606
|
+
const isUNC2 = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
77124
77607
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
77125
|
-
if (
|
|
77608
|
+
if (isUNC2) {
|
|
77126
77609
|
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
77127
77610
|
} else if (isDrive) {
|
|
77128
77611
|
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
@@ -77624,10 +78107,10 @@ import { existsSync as existsSync6 } from "node:fs";
|
|
|
77624
78107
|
var WORKTREE_DIR = ".swarm/worktrees";
|
|
77625
78108
|
function getWorktreePath(projectPath, taskId) {
|
|
77626
78109
|
const safeTaskId = taskId.replace(/[^a-zA-Z0-9.-]/g, "_");
|
|
77627
|
-
return
|
|
78110
|
+
return normalize(join7(projectPath, WORKTREE_DIR, safeTaskId));
|
|
77628
78111
|
}
|
|
77629
78112
|
function parseTaskIdFromPath(worktreePath) {
|
|
77630
|
-
const normalized =
|
|
78113
|
+
const normalized = normalize(worktreePath);
|
|
77631
78114
|
const parts = normalized.split("/");
|
|
77632
78115
|
const worktreesIdx = parts.indexOf("worktrees");
|
|
77633
78116
|
if (worktreesIdx >= 0 && worktreesIdx < parts.length - 1) {
|
|
@@ -77635,18 +78118,18 @@ function parseTaskIdFromPath(worktreePath) {
|
|
|
77635
78118
|
}
|
|
77636
78119
|
return null;
|
|
77637
78120
|
}
|
|
77638
|
-
async function isGitRepo(
|
|
77639
|
-
const result = await Bun.$`git -C ${
|
|
78121
|
+
async function isGitRepo(path5) {
|
|
78122
|
+
const result = await Bun.$`git -C ${path5} rev-parse --git-dir`.quiet().nothrow();
|
|
77640
78123
|
return result.exitCode === 0;
|
|
77641
78124
|
}
|
|
77642
|
-
async function hasUncommittedChanges(
|
|
77643
|
-
const result = await Bun.$`git -C ${
|
|
78125
|
+
async function hasUncommittedChanges(path5) {
|
|
78126
|
+
const result = await Bun.$`git -C ${path5} status --porcelain`.quiet().nothrow();
|
|
77644
78127
|
if (result.exitCode !== 0)
|
|
77645
78128
|
return true;
|
|
77646
78129
|
return result.stdout.toString().trim().length > 0;
|
|
77647
78130
|
}
|
|
77648
|
-
async function getCurrentCommit(
|
|
77649
|
-
const result = await Bun.$`git -C ${
|
|
78131
|
+
async function getCurrentCommit(path5) {
|
|
78132
|
+
const result = await Bun.$`git -C ${path5} rev-parse HEAD`.quiet().nothrow();
|
|
77650
78133
|
if (result.exitCode !== 0)
|
|
77651
78134
|
return null;
|
|
77652
78135
|
return result.stdout.toString().trim();
|
|
@@ -77659,7 +78142,7 @@ async function getWorktreeCommits(worktreePath, startCommit) {
|
|
|
77659
78142
|
`).filter((c) => c.length > 0);
|
|
77660
78143
|
}
|
|
77661
78144
|
async function ensureWorktreeDir(projectPath) {
|
|
77662
|
-
const worktreeDir =
|
|
78145
|
+
const worktreeDir = normalize(join7(projectPath, WORKTREE_DIR));
|
|
77663
78146
|
await Bun.$`mkdir -p ${worktreeDir}`.quiet().nothrow();
|
|
77664
78147
|
}
|
|
77665
78148
|
var swarm_worktree_create = tool({
|
|
@@ -77871,12 +78354,12 @@ var swarm_worktree_list = tool({
|
|
|
77871
78354
|
const commitMatch = block.match(/^HEAD ([a-f0-9]+)$/m);
|
|
77872
78355
|
const branchMatch = block.match(/^branch (.+)$/m);
|
|
77873
78356
|
if (pathMatch && pathMatch[1].includes(worktreeDir)) {
|
|
77874
|
-
const
|
|
77875
|
-
const taskId = parseTaskIdFromPath(
|
|
78357
|
+
const path5 = pathMatch[1];
|
|
78358
|
+
const taskId = parseTaskIdFromPath(path5);
|
|
77876
78359
|
if (taskId) {
|
|
77877
78360
|
worktrees.push({
|
|
77878
78361
|
task_id: taskId,
|
|
77879
|
-
path:
|
|
78362
|
+
path: path5,
|
|
77880
78363
|
commit: commitMatch ? commitMatch[1] : "unknown",
|
|
77881
78364
|
branch: branchMatch ? branchMatch[1] : undefined
|
|
77882
78365
|
});
|
|
@@ -81481,11 +81964,6 @@ var TOOL_DEFINITIONS = [
|
|
|
81481
81964
|
name: "fetch",
|
|
81482
81965
|
type: "mcp",
|
|
81483
81966
|
capabilities: ["http-fetch", "markdown-conversion"]
|
|
81484
|
-
},
|
|
81485
|
-
{
|
|
81486
|
-
name: "pdf-brain",
|
|
81487
|
-
type: "mcp",
|
|
81488
|
-
capabilities: ["knowledge-base-search", "internal-docs"]
|
|
81489
81967
|
}
|
|
81490
81968
|
];
|
|
81491
81969
|
function stripSemverConstraint(versionStr) {
|
|
@@ -82925,28 +83403,28 @@ import {
|
|
|
82925
83403
|
makeOllamaLive as makeOllamaLive2
|
|
82926
83404
|
} from "swarm-mail";
|
|
82927
83405
|
import * as os2 from "node:os";
|
|
82928
|
-
import * as
|
|
83406
|
+
import * as path5 from "node:path";
|
|
82929
83407
|
import { join as join12 } from "node:path";
|
|
82930
83408
|
var cachedAdapter2 = null;
|
|
82931
83409
|
var cachedIndexer = null;
|
|
82932
83410
|
var cachedProjectPath2 = null;
|
|
82933
83411
|
async function getMemoryAdapter2(projectPath) {
|
|
82934
|
-
const
|
|
82935
|
-
if (cachedAdapter2 && cachedProjectPath2 ===
|
|
83412
|
+
const path6 = projectPath || process.cwd();
|
|
83413
|
+
if (cachedAdapter2 && cachedProjectPath2 === path6) {
|
|
82936
83414
|
return cachedAdapter2;
|
|
82937
83415
|
}
|
|
82938
|
-
const swarmMail = await getSwarmMailLibSQL6(
|
|
83416
|
+
const swarmMail = await getSwarmMailLibSQL6(path6);
|
|
82939
83417
|
const dbAdapter = await swarmMail.getDatabase();
|
|
82940
83418
|
cachedAdapter2 = await createMemoryAdapter(dbAdapter);
|
|
82941
|
-
cachedProjectPath2 =
|
|
83419
|
+
cachedProjectPath2 = path6;
|
|
82942
83420
|
return cachedAdapter2;
|
|
82943
83421
|
}
|
|
82944
83422
|
async function getSessionIndexer(projectPath) {
|
|
82945
|
-
const
|
|
82946
|
-
if (cachedIndexer && cachedProjectPath2 ===
|
|
83423
|
+
const path6 = projectPath || process.cwd();
|
|
83424
|
+
if (cachedIndexer && cachedProjectPath2 === path6) {
|
|
82947
83425
|
return cachedIndexer;
|
|
82948
83426
|
}
|
|
82949
|
-
const swarmMail = await getSwarmMailLibSQL6(
|
|
83427
|
+
const swarmMail = await getSwarmMailLibSQL6(path6);
|
|
82950
83428
|
const dbAdapter = await swarmMail.getDatabase();
|
|
82951
83429
|
const db = toSwarmDb2(dbAdapter);
|
|
82952
83430
|
const ollamaLayer = makeOllamaLive2({
|
|
@@ -82954,7 +83432,7 @@ async function getSessionIndexer(projectPath) {
|
|
|
82954
83432
|
ollamaModel: process.env.OLLAMA_MODEL || "mxbai-embed-large"
|
|
82955
83433
|
});
|
|
82956
83434
|
cachedIndexer = new SessionIndexer(db, ollamaLayer);
|
|
82957
|
-
cachedProjectPath2 =
|
|
83435
|
+
cachedProjectPath2 = path6;
|
|
82958
83436
|
return cachedIndexer;
|
|
82959
83437
|
}
|
|
82960
83438
|
var getHivemindAdapter = getMemoryAdapter2;
|
|
@@ -82970,11 +83448,11 @@ async function emitEvent(eventType, data) {
|
|
|
82970
83448
|
} catch {}
|
|
82971
83449
|
}
|
|
82972
83450
|
var AGENT_DIRECTORIES = [
|
|
82973
|
-
|
|
82974
|
-
|
|
82975
|
-
|
|
82976
|
-
|
|
82977
|
-
|
|
83451
|
+
path5.join(os2.homedir(), ".config", "swarm-tools", "sessions"),
|
|
83452
|
+
path5.join(os2.homedir(), ".opencode"),
|
|
83453
|
+
path5.join(os2.homedir(), "Cursor", "User", "History"),
|
|
83454
|
+
path5.join(os2.homedir(), ".local", "share", "Claude"),
|
|
83455
|
+
path5.join(os2.homedir(), ".aider")
|
|
82978
83456
|
];
|
|
82979
83457
|
var hivemind_store = tool({
|
|
82980
83458
|
description: "Store a memory (learning, decision, pattern) with semantic embedding. Memories are searchable by semantic similarity and organized into collections. Use collection='default' for manual learnings.",
|
|
@@ -84958,17 +85436,17 @@ init_memory_tools();
|
|
|
84958
85436
|
|
|
84959
85437
|
// src/eval-history.ts
|
|
84960
85438
|
import * as fs2 from "node:fs";
|
|
84961
|
-
import * as
|
|
85439
|
+
import * as path6 from "node:path";
|
|
84962
85440
|
var DEFAULT_EVAL_HISTORY_PATH = ".opencode/eval-history.jsonl";
|
|
84963
85441
|
var VARIANCE_THRESHOLD = 0.1;
|
|
84964
85442
|
var BOOTSTRAP_THRESHOLD = 10;
|
|
84965
85443
|
var STABILIZATION_THRESHOLD = 50;
|
|
84966
85444
|
function getEvalHistoryPath(projectPath) {
|
|
84967
|
-
return
|
|
85445
|
+
return path6.join(projectPath, DEFAULT_EVAL_HISTORY_PATH);
|
|
84968
85446
|
}
|
|
84969
85447
|
function ensureEvalHistoryDir(projectPath) {
|
|
84970
85448
|
const historyPath = getEvalHistoryPath(projectPath);
|
|
84971
|
-
const dir =
|
|
85449
|
+
const dir = path6.dirname(historyPath);
|
|
84972
85450
|
if (!fs2.existsSync(dir)) {
|
|
84973
85451
|
fs2.mkdirSync(dir, { recursive: true });
|
|
84974
85452
|
}
|
|
@@ -85357,13 +85835,13 @@ import {
|
|
|
85357
85835
|
getSwarmMailLibSQL as getSwarmMailLibSQL8
|
|
85358
85836
|
} from "swarm-mail";
|
|
85359
85837
|
import * as os3 from "node:os";
|
|
85360
|
-
import * as
|
|
85838
|
+
import * as path7 from "node:path";
|
|
85361
85839
|
var AGENT_DIRECTORIES2 = [
|
|
85362
|
-
|
|
85363
|
-
|
|
85364
|
-
|
|
85365
|
-
|
|
85366
|
-
|
|
85840
|
+
path7.join(os3.homedir(), ".config", "swarm-tools", "sessions"),
|
|
85841
|
+
path7.join(os3.homedir(), ".opencode"),
|
|
85842
|
+
path7.join(os3.homedir(), "Cursor", "User", "History"),
|
|
85843
|
+
path7.join(os3.homedir(), ".local", "share", "Claude"),
|
|
85844
|
+
path7.join(os3.homedir(), ".aider")
|
|
85367
85845
|
];
|
|
85368
85846
|
async function getSessionIndexer2() {
|
|
85369
85847
|
const db = await getDb();
|
|
@@ -85920,6 +86398,7 @@ export {
|
|
|
85920
86398
|
isAgentEvent,
|
|
85921
86399
|
invalidateSkillsCache,
|
|
85922
86400
|
importJsonlToPGLite,
|
|
86401
|
+
importJsonlToLibSQL,
|
|
85923
86402
|
ifToolAvailable,
|
|
85924
86403
|
hive_update,
|
|
85925
86404
|
hive_sync,
|