@clawos-dev/clawd 0.2.536 → 0.2.537
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-builder-plugin/mcp-server.cjs +79 -2
- package/dist/cli.cjs +797 -519
- package/dist/dispatch/mcp-server.cjs +79 -2
- package/dist/share-md-viewer-error.html +1 -1
- package/dist/share-md-viewer.html +1 -1
- package/dist/share-ui/assets/guest-BKYmFSKj.css +32 -0
- package/dist/share-ui/assets/{guest-BmFDorIL.js → guest-CdiCs4w2.js} +135 -135
- package/dist/share-ui/guest.html +2 -2
- package/package.json +1 -1
- package/dist/share-ui/assets/guest-DdY1ARl4.css +0 -32
package/dist/cli.cjs
CHANGED
|
@@ -450,8 +450,8 @@ var init_parseUtil = __esm({
|
|
|
450
450
|
init_errors();
|
|
451
451
|
init_en();
|
|
452
452
|
makeIssue = (params) => {
|
|
453
|
-
const { data, path:
|
|
454
|
-
const fullPath = [...
|
|
453
|
+
const { data, path: path102, errorMaps, issueData } = params;
|
|
454
|
+
const fullPath = [...path102, ...issueData.path || []];
|
|
455
455
|
const fullIssue = {
|
|
456
456
|
...issueData,
|
|
457
457
|
path: fullPath
|
|
@@ -762,11 +762,11 @@ var init_types = __esm({
|
|
|
762
762
|
init_parseUtil();
|
|
763
763
|
init_util();
|
|
764
764
|
ParseInputLazyPath = class {
|
|
765
|
-
constructor(parent, value,
|
|
765
|
+
constructor(parent, value, path102, key) {
|
|
766
766
|
this._cachedPath = [];
|
|
767
767
|
this.parent = parent;
|
|
768
768
|
this.data = value;
|
|
769
|
-
this._path =
|
|
769
|
+
this._path = path102;
|
|
770
770
|
this._key = key;
|
|
771
771
|
}
|
|
772
772
|
get path() {
|
|
@@ -7485,6 +7485,82 @@ var init_onboarding_schemas = __esm({
|
|
|
7485
7485
|
}
|
|
7486
7486
|
});
|
|
7487
7487
|
|
|
7488
|
+
// ../protocol/src/engine-schemas.ts
|
|
7489
|
+
var EngineStatusArgs, RateLimitWindowSchema, EngineAccountSchema, EngineStatusResponseSchema;
|
|
7490
|
+
var init_engine_schemas = __esm({
|
|
7491
|
+
"../protocol/src/engine-schemas.ts"() {
|
|
7492
|
+
"use strict";
|
|
7493
|
+
init_zod();
|
|
7494
|
+
init_onboarding_schemas();
|
|
7495
|
+
EngineStatusArgs = external_exports.object({
|
|
7496
|
+
tool: external_exports.enum(PROBE_TOOL_IDS)
|
|
7497
|
+
});
|
|
7498
|
+
RateLimitWindowSchema = external_exports.object({
|
|
7499
|
+
usedPercent: external_exports.number(),
|
|
7500
|
+
windowDurationMins: external_exports.number().optional(),
|
|
7501
|
+
resetsAt: external_exports.number().optional()
|
|
7502
|
+
}).strict();
|
|
7503
|
+
EngineAccountSchema = external_exports.discriminatedUnion("kind", [
|
|
7504
|
+
// `claude auth status --json`:走环境变量 key 时 email / orgName / subscriptionType 为 null(这里缺席)、多一个 apiKeySource
|
|
7505
|
+
external_exports.object({
|
|
7506
|
+
kind: external_exports.literal("claude"),
|
|
7507
|
+
loggedIn: external_exports.boolean(),
|
|
7508
|
+
/** claude.ai / console / … */
|
|
7509
|
+
authMethod: external_exports.string().optional(),
|
|
7510
|
+
/** firstParty / bedrock / vertex / foundry */
|
|
7511
|
+
apiProvider: external_exports.string().optional(),
|
|
7512
|
+
/** ANTHROPIC_API_KEY / apiKeyHelper */
|
|
7513
|
+
apiKeySource: external_exports.string().optional(),
|
|
7514
|
+
email: external_exports.string().optional(),
|
|
7515
|
+
orgName: external_exports.string().optional(),
|
|
7516
|
+
/** max / pro / team / … */
|
|
7517
|
+
subscriptionType: external_exports.string().optional()
|
|
7518
|
+
}).strict(),
|
|
7519
|
+
// app-server `account/read`:account 为 null → none;`config/read`:model_provider + 自定义 provider 的 base_url
|
|
7520
|
+
external_exports.object({
|
|
7521
|
+
kind: external_exports.literal("codex"),
|
|
7522
|
+
login: external_exports.discriminatedUnion("type", [
|
|
7523
|
+
external_exports.object({ type: external_exports.literal("none") }).strict(),
|
|
7524
|
+
external_exports.object({ type: external_exports.literal("apiKey") }).strict(),
|
|
7525
|
+
external_exports.object({ type: external_exports.literal("chatgpt"), email: external_exports.string(), planType: external_exports.string() }).strict()
|
|
7526
|
+
]),
|
|
7527
|
+
/** 官方 provider 没有 baseUrl(config.model_providers 只含用户自定义的) */
|
|
7528
|
+
provider: external_exports.object({ name: external_exports.string(), baseUrl: external_exports.string().optional() }).strict(),
|
|
7529
|
+
/** 只有 ChatGPT 登录才有;查不到时整项缺席 */
|
|
7530
|
+
rateLimits: external_exports.object({
|
|
7531
|
+
primary: RateLimitWindowSchema.optional(),
|
|
7532
|
+
secondary: RateLimitWindowSchema.optional()
|
|
7533
|
+
}).strict().optional()
|
|
7534
|
+
}).strict(),
|
|
7535
|
+
// provider 从模型表的 `provider/id` 前缀归组;凭据类型来自 auth.json(扩展 provider 的凭据不在那份里 → 缺席)
|
|
7536
|
+
external_exports.object({
|
|
7537
|
+
kind: external_exports.literal("pi"),
|
|
7538
|
+
providers: external_exports.array(
|
|
7539
|
+
external_exports.object({
|
|
7540
|
+
id: external_exports.string(),
|
|
7541
|
+
modelCount: external_exports.number(),
|
|
7542
|
+
credential: external_exports.enum(["api_key", "oauth"]).optional(),
|
|
7543
|
+
/** unix 秒;oauth 才有 */
|
|
7544
|
+
oauthExpiresAt: external_exports.number().optional()
|
|
7545
|
+
}).strict()
|
|
7546
|
+
)
|
|
7547
|
+
}).strict()
|
|
7548
|
+
]);
|
|
7549
|
+
EngineStatusResponseSchema = external_exports.object({
|
|
7550
|
+
tool: external_exports.enum(PROBE_TOOL_IDS),
|
|
7551
|
+
installed: external_exports.boolean(),
|
|
7552
|
+
version: external_exports.string().optional(),
|
|
7553
|
+
path: external_exports.string().optional(),
|
|
7554
|
+
/** 未安装 / 查询失败时缺席 */
|
|
7555
|
+
account: EngineAccountSchema.optional(),
|
|
7556
|
+
/** 查订阅信息失败的原因(codex app-server 超时之类),人话直出 */
|
|
7557
|
+
error: external_exports.string().optional(),
|
|
7558
|
+
/** daemon 手里这份模型表是什么时候查的(ms);还没查过时缺席 */
|
|
7559
|
+
modelsLoadedAt: external_exports.number().optional()
|
|
7560
|
+
}).strict();
|
|
7561
|
+
}
|
|
7562
|
+
});
|
|
7563
|
+
|
|
7488
7564
|
// ../protocol/src/persona-schemas.ts
|
|
7489
7565
|
var PersonaFileSchema, PersonaSkillSummarySchema, PersonaPluginSummarySchema, CodexSandboxSettingsSchema, PersonaSandboxSettingsSchema, PersonaInfoResponseSchema, PersonaCreateArgsSchema, PersonaIdArgsSchema, PersonaUpdateArgsSchema;
|
|
7490
7566
|
var init_persona_schemas = __esm({
|
|
@@ -7799,7 +7875,12 @@ var init_schemas = __esm({
|
|
|
7799
7875
|
scope: external_exports.enum(["core", "tool-specific"])
|
|
7800
7876
|
});
|
|
7801
7877
|
CapabilitiesGetArgs = external_exports.object({
|
|
7802
|
-
tool: external_exports.string().min(1)
|
|
7878
|
+
tool: external_exports.string().min(1),
|
|
7879
|
+
/**
|
|
7880
|
+
* true = 绕过 daemon / adapter 的进程级 memo 重查模型表并覆盖缓存(设置 → 账号「引擎」的「刷新模型」,
|
|
7881
|
+
* spec 2026-09-17-engine-status)。缺省 = 读缓存,与加此字段前逐字一致。
|
|
7882
|
+
*/
|
|
7883
|
+
refresh: external_exports.boolean().optional()
|
|
7803
7884
|
});
|
|
7804
7885
|
ToolFeaturesSchema = external_exports.object({
|
|
7805
7886
|
rewind: external_exports.boolean(),
|
|
@@ -8692,6 +8773,7 @@ var init_methods = __esm({
|
|
|
8692
8773
|
init_github();
|
|
8693
8774
|
init_lark_bot_schemas();
|
|
8694
8775
|
init_onboarding_schemas();
|
|
8776
|
+
init_engine_schemas();
|
|
8695
8777
|
init_persona_schemas();
|
|
8696
8778
|
init_schemas();
|
|
8697
8779
|
NO_ARGS = external_exports.object({});
|
|
@@ -9116,9 +9198,13 @@ var init_methods = __esm({
|
|
|
9116
9198
|
args: GitBranchesArgs
|
|
9117
9199
|
},
|
|
9118
9200
|
"capabilities:get": {
|
|
9119
|
-
summary: "\u53D6\u67D0\u4E2A tool \u7684\u80FD\u529B\u96C6\uFF1A\u53EF\u7528\u6A21\u578B\u5217\u8868 / permissionModes / configSchema",
|
|
9201
|
+
summary: "\u53D6\u67D0\u4E2A tool \u7684\u80FD\u529B\u96C6\uFF1A\u53EF\u7528\u6A21\u578B\u5217\u8868 / permissionModes / configSchema\u3002refresh=true \u7ED5\u8FC7\u8FDB\u7A0B\u7EA7\u7F13\u5B58\u91CD\u67E5\u6A21\u578B\u8868\u5E76\u8986\u76D6\uFF08\u8BBE\u7F6E\u2192\u8D26\u53F7\u300C\u5F15\u64CE\u300D\u7684\u300C\u5237\u65B0\u6A21\u578B\u300D\uFF09",
|
|
9120
9202
|
args: CapabilitiesGetArgs
|
|
9121
9203
|
},
|
|
9204
|
+
"engine:status": {
|
|
9205
|
+
summary: "\u67D0\u4E2A\u5F15\u64CE\uFF08claude / codex / pi\uFF09\u7684\u5B89\u88C5\u72B6\u6001 + \u8BA2\u9605 / \u767B\u5F55\u60C5\u51B5\uFF08claude auth status\u3001codex account/read + rateLimits\u3001pi auth.json \u51ED\u636E\u7C7B\u578B\uFF09+ \u6A21\u578B\u8868\u52A0\u8F7D\u65F6\u95F4\u3002\u4E00\u5F8B\u4E0D\u5E26 key / token \u503C\u3002owner-only",
|
|
9206
|
+
args: EngineStatusArgs
|
|
9207
|
+
},
|
|
9122
9208
|
"persona:create": {
|
|
9123
9209
|
summary: "\u65B0\u5EFA persona\uFF08\u5199 PersonaFile + CLAUDE.md \u9AA8\u67B6\uFF09\u3002owner-only\u3002slug \u53EA\u6536\u5C0F\u5199\u5B57\u6BCD\u6570\u5B57\u4E0E\u5355\u8FDE\u5B57\u7B26\uFF08^[a-z0-9]+(-[a-z0-9]+)*$\uFF0C\u226432\uFF09\uFF0Cdaemon \u62FC\u6210 personaId=persona-<slug>\uFF1B\u8BE5 id \u5DF2\u5B58\u5728\u5219\u62A5\u9519\uFF0C\u4E0D\u81EA\u52A8\u6539\u540D\u3002label \u662F\u663E\u793A\u540D\uFF0C\u4E0D\u53C2\u4E0E id \u63A8\u5BFC\uFF0C\u53EF\u7528\u4E2D\u6587",
|
|
9124
9210
|
args: PersonaCreateArgsSchema
|
|
@@ -9627,6 +9713,7 @@ var init_runtime = __esm({
|
|
|
9627
9713
|
init_lark_bot_format();
|
|
9628
9714
|
init_dispatch_format();
|
|
9629
9715
|
init_onboarding_schemas();
|
|
9716
|
+
init_engine_schemas();
|
|
9630
9717
|
init_tool_family();
|
|
9631
9718
|
}
|
|
9632
9719
|
});
|
|
@@ -9902,8 +9989,8 @@ var require_req = __commonJS({
|
|
|
9902
9989
|
if (req.originalUrl) {
|
|
9903
9990
|
_req.url = req.originalUrl;
|
|
9904
9991
|
} else {
|
|
9905
|
-
const
|
|
9906
|
-
_req.url = typeof
|
|
9992
|
+
const path102 = req.path;
|
|
9993
|
+
_req.url = typeof path102 === "string" ? path102 : req.url ? req.url.path || req.url : void 0;
|
|
9907
9994
|
}
|
|
9908
9995
|
if (req.query) {
|
|
9909
9996
|
_req.query = req.query;
|
|
@@ -10068,14 +10155,14 @@ var require_redact = __commonJS({
|
|
|
10068
10155
|
}
|
|
10069
10156
|
return obj;
|
|
10070
10157
|
}
|
|
10071
|
-
function parsePath(
|
|
10158
|
+
function parsePath(path102) {
|
|
10072
10159
|
const parts = [];
|
|
10073
10160
|
let current = "";
|
|
10074
10161
|
let inBrackets = false;
|
|
10075
10162
|
let inQuotes = false;
|
|
10076
10163
|
let quoteChar = "";
|
|
10077
|
-
for (let i2 = 0; i2 <
|
|
10078
|
-
const char =
|
|
10164
|
+
for (let i2 = 0; i2 < path102.length; i2++) {
|
|
10165
|
+
const char = path102[i2];
|
|
10079
10166
|
if (!inBrackets && char === ".") {
|
|
10080
10167
|
if (current) {
|
|
10081
10168
|
parts.push(current);
|
|
@@ -10206,10 +10293,10 @@ var require_redact = __commonJS({
|
|
|
10206
10293
|
return current;
|
|
10207
10294
|
}
|
|
10208
10295
|
function redactPaths(obj, paths, censor, remove = false) {
|
|
10209
|
-
for (const
|
|
10210
|
-
const parts = parsePath(
|
|
10296
|
+
for (const path102 of paths) {
|
|
10297
|
+
const parts = parsePath(path102);
|
|
10211
10298
|
if (parts.includes("*")) {
|
|
10212
|
-
redactWildcardPath(obj, parts, censor,
|
|
10299
|
+
redactWildcardPath(obj, parts, censor, path102, remove);
|
|
10213
10300
|
} else {
|
|
10214
10301
|
if (remove) {
|
|
10215
10302
|
removeKey(obj, parts);
|
|
@@ -10294,8 +10381,8 @@ var require_redact = __commonJS({
|
|
|
10294
10381
|
}
|
|
10295
10382
|
} else {
|
|
10296
10383
|
if (afterWildcard.includes("*")) {
|
|
10297
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
10298
|
-
const fullPath = [...pathArray.slice(0, pathLength), ...
|
|
10384
|
+
const wrappedCensor = typeof censor === "function" ? (value, path102) => {
|
|
10385
|
+
const fullPath = [...pathArray.slice(0, pathLength), ...path102];
|
|
10299
10386
|
return censor(value, fullPath);
|
|
10300
10387
|
} : censor;
|
|
10301
10388
|
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
@@ -10330,8 +10417,8 @@ var require_redact = __commonJS({
|
|
|
10330
10417
|
return null;
|
|
10331
10418
|
}
|
|
10332
10419
|
const pathStructure = /* @__PURE__ */ new Map();
|
|
10333
|
-
for (const
|
|
10334
|
-
const parts = parsePath(
|
|
10420
|
+
for (const path102 of pathsToClone) {
|
|
10421
|
+
const parts = parsePath(path102);
|
|
10335
10422
|
let current = pathStructure;
|
|
10336
10423
|
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
10337
10424
|
const part = parts[i2];
|
|
@@ -10383,24 +10470,24 @@ var require_redact = __commonJS({
|
|
|
10383
10470
|
}
|
|
10384
10471
|
return cloneSelectively(obj, pathStructure);
|
|
10385
10472
|
}
|
|
10386
|
-
function validatePath(
|
|
10387
|
-
if (typeof
|
|
10473
|
+
function validatePath(path102) {
|
|
10474
|
+
if (typeof path102 !== "string") {
|
|
10388
10475
|
throw new Error("Paths must be (non-empty) strings");
|
|
10389
10476
|
}
|
|
10390
|
-
if (
|
|
10477
|
+
if (path102 === "") {
|
|
10391
10478
|
throw new Error("Invalid redaction path ()");
|
|
10392
10479
|
}
|
|
10393
|
-
if (
|
|
10394
|
-
throw new Error(`Invalid redaction path (${
|
|
10480
|
+
if (path102.includes("..")) {
|
|
10481
|
+
throw new Error(`Invalid redaction path (${path102})`);
|
|
10395
10482
|
}
|
|
10396
|
-
if (
|
|
10397
|
-
throw new Error(`Invalid redaction path (${
|
|
10483
|
+
if (path102.includes(",")) {
|
|
10484
|
+
throw new Error(`Invalid redaction path (${path102})`);
|
|
10398
10485
|
}
|
|
10399
10486
|
let bracketCount = 0;
|
|
10400
10487
|
let inQuotes = false;
|
|
10401
10488
|
let quoteChar = "";
|
|
10402
|
-
for (let i2 = 0; i2 <
|
|
10403
|
-
const char =
|
|
10489
|
+
for (let i2 = 0; i2 < path102.length; i2++) {
|
|
10490
|
+
const char = path102[i2];
|
|
10404
10491
|
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
10405
10492
|
if (!inQuotes) {
|
|
10406
10493
|
inQuotes = true;
|
|
@@ -10414,20 +10501,20 @@ var require_redact = __commonJS({
|
|
|
10414
10501
|
} else if (char === "]" && !inQuotes) {
|
|
10415
10502
|
bracketCount--;
|
|
10416
10503
|
if (bracketCount < 0) {
|
|
10417
|
-
throw new Error(`Invalid redaction path (${
|
|
10504
|
+
throw new Error(`Invalid redaction path (${path102})`);
|
|
10418
10505
|
}
|
|
10419
10506
|
}
|
|
10420
10507
|
}
|
|
10421
10508
|
if (bracketCount !== 0) {
|
|
10422
|
-
throw new Error(`Invalid redaction path (${
|
|
10509
|
+
throw new Error(`Invalid redaction path (${path102})`);
|
|
10423
10510
|
}
|
|
10424
10511
|
}
|
|
10425
10512
|
function validatePaths(paths) {
|
|
10426
10513
|
if (!Array.isArray(paths)) {
|
|
10427
10514
|
throw new TypeError("paths must be an array");
|
|
10428
10515
|
}
|
|
10429
|
-
for (const
|
|
10430
|
-
validatePath(
|
|
10516
|
+
for (const path102 of paths) {
|
|
10517
|
+
validatePath(path102);
|
|
10431
10518
|
}
|
|
10432
10519
|
}
|
|
10433
10520
|
function slowRedact(options = {}) {
|
|
@@ -10554,10 +10641,10 @@ var require_redaction = __commonJS({
|
|
|
10554
10641
|
var strict = false;
|
|
10555
10642
|
function redaction(opts, serialize) {
|
|
10556
10643
|
const { paths, censor, remove } = handle(opts);
|
|
10557
|
-
const shape = paths.reduce((o2,
|
|
10644
|
+
const shape = paths.reduce((o2, str7) => {
|
|
10558
10645
|
rx.lastIndex = 0;
|
|
10559
|
-
const first = rx.exec(
|
|
10560
|
-
const next = rx.exec(
|
|
10646
|
+
const first = rx.exec(str7);
|
|
10647
|
+
const next = rx.exec(str7);
|
|
10561
10648
|
let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
|
|
10562
10649
|
if (ns === "*") {
|
|
10563
10650
|
ns = wildcardFirstSym;
|
|
@@ -10570,7 +10657,7 @@ var require_redaction = __commonJS({
|
|
|
10570
10657
|
return o2;
|
|
10571
10658
|
}
|
|
10572
10659
|
const { index } = next;
|
|
10573
|
-
const nextPath = `${
|
|
10660
|
+
const nextPath = `${str7.substr(index, str7.length - 1)}`;
|
|
10574
10661
|
o2[ns] = o2[ns] || [];
|
|
10575
10662
|
if (ns !== wildcardFirstSym && o2[ns].length === 0) {
|
|
10576
10663
|
o2[ns].push(...o2[wildcardFirstSym] || []);
|
|
@@ -10595,8 +10682,8 @@ var require_redaction = __commonJS({
|
|
|
10595
10682
|
if (shape[k3] === null) {
|
|
10596
10683
|
o2[k3] = (value) => topCensor(value, [k3]);
|
|
10597
10684
|
} else {
|
|
10598
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
10599
|
-
return censor(value, [k3, ...
|
|
10685
|
+
const wrappedCensor = typeof censor === "function" ? (value, path102) => {
|
|
10686
|
+
return censor(value, [k3, ...path102]);
|
|
10600
10687
|
} : censor;
|
|
10601
10688
|
o2[k3] = Redact({
|
|
10602
10689
|
paths: shape[k3],
|
|
@@ -10686,7 +10773,7 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
10686
10773
|
}
|
|
10687
10774
|
var argLen = args.length;
|
|
10688
10775
|
if (argLen === 0) return f2;
|
|
10689
|
-
var
|
|
10776
|
+
var str7 = "";
|
|
10690
10777
|
var a2 = 1 - offset;
|
|
10691
10778
|
var lastPos = -1;
|
|
10692
10779
|
var flen = f2 && f2.length || 0;
|
|
@@ -10701,8 +10788,8 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
10701
10788
|
break;
|
|
10702
10789
|
if (args[a2] == null) break;
|
|
10703
10790
|
if (lastPos < i2)
|
|
10704
|
-
|
|
10705
|
-
|
|
10791
|
+
str7 += f2.slice(lastPos, i2);
|
|
10792
|
+
str7 += Number(args[a2]);
|
|
10706
10793
|
lastPos = i2 + 2;
|
|
10707
10794
|
i2++;
|
|
10708
10795
|
break;
|
|
@@ -10711,8 +10798,8 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
10711
10798
|
break;
|
|
10712
10799
|
if (args[a2] == null) break;
|
|
10713
10800
|
if (lastPos < i2)
|
|
10714
|
-
|
|
10715
|
-
|
|
10801
|
+
str7 += f2.slice(lastPos, i2);
|
|
10802
|
+
str7 += Math.floor(Number(args[a2]));
|
|
10716
10803
|
lastPos = i2 + 2;
|
|
10717
10804
|
i2++;
|
|
10718
10805
|
break;
|
|
@@ -10725,21 +10812,21 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
10725
10812
|
break;
|
|
10726
10813
|
if (args[a2] === void 0) break;
|
|
10727
10814
|
if (lastPos < i2)
|
|
10728
|
-
|
|
10815
|
+
str7 += f2.slice(lastPos, i2);
|
|
10729
10816
|
var type = typeof args[a2];
|
|
10730
10817
|
if (type === "string") {
|
|
10731
|
-
|
|
10818
|
+
str7 += "'" + args[a2] + "'";
|
|
10732
10819
|
lastPos = i2 + 2;
|
|
10733
10820
|
i2++;
|
|
10734
10821
|
break;
|
|
10735
10822
|
}
|
|
10736
10823
|
if (type === "function") {
|
|
10737
|
-
|
|
10824
|
+
str7 += args[a2].name || "<anonymous>";
|
|
10738
10825
|
lastPos = i2 + 2;
|
|
10739
10826
|
i2++;
|
|
10740
10827
|
break;
|
|
10741
10828
|
}
|
|
10742
|
-
|
|
10829
|
+
str7 += ss(args[a2]);
|
|
10743
10830
|
lastPos = i2 + 2;
|
|
10744
10831
|
i2++;
|
|
10745
10832
|
break;
|
|
@@ -10747,15 +10834,15 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
10747
10834
|
if (a2 >= argLen)
|
|
10748
10835
|
break;
|
|
10749
10836
|
if (lastPos < i2)
|
|
10750
|
-
|
|
10751
|
-
|
|
10837
|
+
str7 += f2.slice(lastPos, i2);
|
|
10838
|
+
str7 += String(args[a2]);
|
|
10752
10839
|
lastPos = i2 + 2;
|
|
10753
10840
|
i2++;
|
|
10754
10841
|
break;
|
|
10755
10842
|
case 37:
|
|
10756
10843
|
if (lastPos < i2)
|
|
10757
|
-
|
|
10758
|
-
|
|
10844
|
+
str7 += f2.slice(lastPos, i2);
|
|
10845
|
+
str7 += "%";
|
|
10759
10846
|
lastPos = i2 + 2;
|
|
10760
10847
|
i2++;
|
|
10761
10848
|
a2--;
|
|
@@ -10768,9 +10855,9 @@ var require_quick_format_unescaped = __commonJS({
|
|
|
10768
10855
|
if (lastPos === -1)
|
|
10769
10856
|
return f2;
|
|
10770
10857
|
else if (lastPos < flen) {
|
|
10771
|
-
|
|
10858
|
+
str7 += f2.slice(lastPos);
|
|
10772
10859
|
}
|
|
10773
|
-
return
|
|
10860
|
+
return str7;
|
|
10774
10861
|
}
|
|
10775
10862
|
}
|
|
10776
10863
|
});
|
|
@@ -10814,10 +10901,10 @@ var require_atomic_sleep = __commonJS({
|
|
|
10814
10901
|
var require_sonic_boom = __commonJS({
|
|
10815
10902
|
"../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js"(exports2, module2) {
|
|
10816
10903
|
"use strict";
|
|
10817
|
-
var
|
|
10904
|
+
var fs91 = require("fs");
|
|
10818
10905
|
var EventEmitter2 = require("events");
|
|
10819
10906
|
var inherits = require("util").inherits;
|
|
10820
|
-
var
|
|
10907
|
+
var path102 = require("path");
|
|
10821
10908
|
var sleep2 = require_atomic_sleep();
|
|
10822
10909
|
var assert = require("assert");
|
|
10823
10910
|
var BUSY_WRITE_TIMEOUT = 100;
|
|
@@ -10871,20 +10958,20 @@ var require_sonic_boom = __commonJS({
|
|
|
10871
10958
|
const mode = sonic.mode;
|
|
10872
10959
|
if (sonic.sync) {
|
|
10873
10960
|
try {
|
|
10874
|
-
if (sonic.mkdir)
|
|
10875
|
-
const fd =
|
|
10961
|
+
if (sonic.mkdir) fs91.mkdirSync(path102.dirname(file), { recursive: true });
|
|
10962
|
+
const fd = fs91.openSync(file, flags, mode);
|
|
10876
10963
|
fileOpened(null, fd);
|
|
10877
10964
|
} catch (err) {
|
|
10878
10965
|
fileOpened(err);
|
|
10879
10966
|
throw err;
|
|
10880
10967
|
}
|
|
10881
10968
|
} else if (sonic.mkdir) {
|
|
10882
|
-
|
|
10969
|
+
fs91.mkdir(path102.dirname(file), { recursive: true }, (err) => {
|
|
10883
10970
|
if (err) return fileOpened(err);
|
|
10884
|
-
|
|
10971
|
+
fs91.open(file, flags, mode, fileOpened);
|
|
10885
10972
|
});
|
|
10886
10973
|
} else {
|
|
10887
|
-
|
|
10974
|
+
fs91.open(file, flags, mode, fileOpened);
|
|
10888
10975
|
}
|
|
10889
10976
|
}
|
|
10890
10977
|
function SonicBoom(opts) {
|
|
@@ -10925,8 +11012,8 @@ var require_sonic_boom = __commonJS({
|
|
|
10925
11012
|
this.flush = flushBuffer;
|
|
10926
11013
|
this.flushSync = flushBufferSync;
|
|
10927
11014
|
this._actualWrite = actualWriteBuffer;
|
|
10928
|
-
fsWriteSync = () =>
|
|
10929
|
-
fsWrite = () =>
|
|
11015
|
+
fsWriteSync = () => fs91.writeSync(this.fd, this._writingBuf);
|
|
11016
|
+
fsWrite = () => fs91.write(this.fd, this._writingBuf, this.release);
|
|
10930
11017
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
10931
11018
|
this._writingBuf = "";
|
|
10932
11019
|
this.write = write;
|
|
@@ -10935,15 +11022,15 @@ var require_sonic_boom = __commonJS({
|
|
|
10935
11022
|
this._actualWrite = actualWrite;
|
|
10936
11023
|
fsWriteSync = () => {
|
|
10937
11024
|
if (Buffer.isBuffer(this._writingBuf)) {
|
|
10938
|
-
return
|
|
11025
|
+
return fs91.writeSync(this.fd, this._writingBuf);
|
|
10939
11026
|
}
|
|
10940
|
-
return
|
|
11027
|
+
return fs91.writeSync(this.fd, this._writingBuf, "utf8");
|
|
10941
11028
|
};
|
|
10942
11029
|
fsWrite = () => {
|
|
10943
11030
|
if (Buffer.isBuffer(this._writingBuf)) {
|
|
10944
|
-
return
|
|
11031
|
+
return fs91.write(this.fd, this._writingBuf, this.release);
|
|
10945
11032
|
}
|
|
10946
|
-
return
|
|
11033
|
+
return fs91.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
10947
11034
|
};
|
|
10948
11035
|
} else {
|
|
10949
11036
|
throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
@@ -11000,7 +11087,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11000
11087
|
}
|
|
11001
11088
|
}
|
|
11002
11089
|
if (this._fsync) {
|
|
11003
|
-
|
|
11090
|
+
fs91.fsyncSync(this.fd);
|
|
11004
11091
|
}
|
|
11005
11092
|
const len = this._len;
|
|
11006
11093
|
if (this._reopening) {
|
|
@@ -11114,7 +11201,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11114
11201
|
const onDrain = () => {
|
|
11115
11202
|
if (!this._fsync) {
|
|
11116
11203
|
try {
|
|
11117
|
-
|
|
11204
|
+
fs91.fsync(this.fd, (err) => {
|
|
11118
11205
|
this._flushPending = false;
|
|
11119
11206
|
cb(err);
|
|
11120
11207
|
});
|
|
@@ -11216,7 +11303,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11216
11303
|
const fd = this.fd;
|
|
11217
11304
|
this.once("ready", () => {
|
|
11218
11305
|
if (fd !== this.fd) {
|
|
11219
|
-
|
|
11306
|
+
fs91.close(fd, (err) => {
|
|
11220
11307
|
if (err) {
|
|
11221
11308
|
return this.emit("error", err);
|
|
11222
11309
|
}
|
|
@@ -11265,7 +11352,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11265
11352
|
buf = this._bufs[0];
|
|
11266
11353
|
}
|
|
11267
11354
|
try {
|
|
11268
|
-
const n2 = Buffer.isBuffer(buf) ?
|
|
11355
|
+
const n2 = Buffer.isBuffer(buf) ? fs91.writeSync(this.fd, buf) : fs91.writeSync(this.fd, buf, "utf8");
|
|
11269
11356
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n2);
|
|
11270
11357
|
buf = releasedBufObj.writingBuf;
|
|
11271
11358
|
this._len = releasedBufObj.len;
|
|
@@ -11281,7 +11368,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11281
11368
|
}
|
|
11282
11369
|
}
|
|
11283
11370
|
try {
|
|
11284
|
-
|
|
11371
|
+
fs91.fsyncSync(this.fd);
|
|
11285
11372
|
} catch {
|
|
11286
11373
|
}
|
|
11287
11374
|
}
|
|
@@ -11302,7 +11389,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11302
11389
|
buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
11303
11390
|
}
|
|
11304
11391
|
try {
|
|
11305
|
-
const n2 =
|
|
11392
|
+
const n2 = fs91.writeSync(this.fd, buf);
|
|
11306
11393
|
buf = buf.subarray(n2);
|
|
11307
11394
|
this._len = Math.max(this._len - n2, 0);
|
|
11308
11395
|
if (buf.length <= 0) {
|
|
@@ -11330,13 +11417,13 @@ var require_sonic_boom = __commonJS({
|
|
|
11330
11417
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
11331
11418
|
if (this.sync) {
|
|
11332
11419
|
try {
|
|
11333
|
-
const written = Buffer.isBuffer(this._writingBuf) ?
|
|
11420
|
+
const written = Buffer.isBuffer(this._writingBuf) ? fs91.writeSync(this.fd, this._writingBuf) : fs91.writeSync(this.fd, this._writingBuf, "utf8");
|
|
11334
11421
|
release2(null, written);
|
|
11335
11422
|
} catch (err) {
|
|
11336
11423
|
release2(err);
|
|
11337
11424
|
}
|
|
11338
11425
|
} else {
|
|
11339
|
-
|
|
11426
|
+
fs91.write(this.fd, this._writingBuf, release2);
|
|
11340
11427
|
}
|
|
11341
11428
|
}
|
|
11342
11429
|
function actualWriteBuffer() {
|
|
@@ -11345,7 +11432,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11345
11432
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
11346
11433
|
if (this.sync) {
|
|
11347
11434
|
try {
|
|
11348
|
-
const written =
|
|
11435
|
+
const written = fs91.writeSync(this.fd, this._writingBuf);
|
|
11349
11436
|
release2(null, written);
|
|
11350
11437
|
} catch (err) {
|
|
11351
11438
|
release2(err);
|
|
@@ -11354,7 +11441,7 @@ var require_sonic_boom = __commonJS({
|
|
|
11354
11441
|
if (kCopyBuffer) {
|
|
11355
11442
|
this._writingBuf = Buffer.from(this._writingBuf);
|
|
11356
11443
|
}
|
|
11357
|
-
|
|
11444
|
+
fs91.write(this.fd, this._writingBuf, release2);
|
|
11358
11445
|
}
|
|
11359
11446
|
}
|
|
11360
11447
|
function actualClose(sonic) {
|
|
@@ -11370,12 +11457,12 @@ var require_sonic_boom = __commonJS({
|
|
|
11370
11457
|
sonic._lens = [];
|
|
11371
11458
|
assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
11372
11459
|
try {
|
|
11373
|
-
|
|
11460
|
+
fs91.fsync(sonic.fd, closeWrapped);
|
|
11374
11461
|
} catch {
|
|
11375
11462
|
}
|
|
11376
11463
|
function closeWrapped() {
|
|
11377
11464
|
if (sonic.fd !== 1 && sonic.fd !== 2) {
|
|
11378
|
-
|
|
11465
|
+
fs91.close(sonic.fd, done);
|
|
11379
11466
|
} else {
|
|
11380
11467
|
done();
|
|
11381
11468
|
}
|
|
@@ -12256,38 +12343,38 @@ var require_tools = __commonJS({
|
|
|
12256
12343
|
}
|
|
12257
12344
|
}
|
|
12258
12345
|
}
|
|
12259
|
-
function asString(
|
|
12346
|
+
function asString(str7) {
|
|
12260
12347
|
let result = "";
|
|
12261
12348
|
let last = 0;
|
|
12262
12349
|
let found = false;
|
|
12263
12350
|
let point = 255;
|
|
12264
|
-
const l2 =
|
|
12351
|
+
const l2 = str7.length;
|
|
12265
12352
|
if (l2 > 100) {
|
|
12266
|
-
return JSON.stringify(
|
|
12353
|
+
return JSON.stringify(str7);
|
|
12267
12354
|
}
|
|
12268
12355
|
for (var i2 = 0; i2 < l2 && point >= 32; i2++) {
|
|
12269
|
-
point =
|
|
12356
|
+
point = str7.charCodeAt(i2);
|
|
12270
12357
|
if (point === 34 || point === 92) {
|
|
12271
|
-
result +=
|
|
12358
|
+
result += str7.slice(last, i2) + "\\";
|
|
12272
12359
|
last = i2;
|
|
12273
12360
|
found = true;
|
|
12274
12361
|
}
|
|
12275
12362
|
}
|
|
12276
12363
|
if (!found) {
|
|
12277
|
-
result =
|
|
12364
|
+
result = str7;
|
|
12278
12365
|
} else {
|
|
12279
|
-
result +=
|
|
12366
|
+
result += str7.slice(last);
|
|
12280
12367
|
}
|
|
12281
|
-
return point < 32 ? JSON.stringify(
|
|
12368
|
+
return point < 32 ? JSON.stringify(str7) : '"' + result + '"';
|
|
12282
12369
|
}
|
|
12283
|
-
function asJson(obj, msg,
|
|
12370
|
+
function asJson(obj, msg, num5, time) {
|
|
12284
12371
|
if (asJsonChan.hasSubscribers === false) {
|
|
12285
|
-
return _asJson.call(this, obj, msg,
|
|
12372
|
+
return _asJson.call(this, obj, msg, num5, time);
|
|
12286
12373
|
}
|
|
12287
12374
|
const store = { instance: this, arguments };
|
|
12288
|
-
return asJsonChan.traceSync(_asJson, store, this, obj, msg,
|
|
12375
|
+
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num5, time);
|
|
12289
12376
|
}
|
|
12290
|
-
function _asJson(obj, msg,
|
|
12377
|
+
function _asJson(obj, msg, num5, time) {
|
|
12291
12378
|
const stringify2 = this[stringifySym];
|
|
12292
12379
|
const stringifySafe = this[stringifySafeSym];
|
|
12293
12380
|
const stringifiers = this[stringifiersSym];
|
|
@@ -12297,7 +12384,7 @@ var require_tools = __commonJS({
|
|
|
12297
12384
|
const formatters = this[formattersSym];
|
|
12298
12385
|
const messageKey = this[messageKeySym];
|
|
12299
12386
|
const errorKey = this[errorKeySym];
|
|
12300
|
-
let data = this[lsCacheSym][
|
|
12387
|
+
let data = this[lsCacheSym][num5] + time;
|
|
12301
12388
|
data = data + chindings;
|
|
12302
12389
|
let value;
|
|
12303
12390
|
if (formatters.log) {
|
|
@@ -12924,7 +13011,7 @@ var require_proto = __commonJS({
|
|
|
12924
13011
|
function defaultMixinMergeStrategy(mergeObject, mixinObject) {
|
|
12925
13012
|
return Object.assign(mixinObject, mergeObject);
|
|
12926
13013
|
}
|
|
12927
|
-
function write(_obj, msg,
|
|
13014
|
+
function write(_obj, msg, num5) {
|
|
12928
13015
|
const t2 = this[timeSym]();
|
|
12929
13016
|
const mixin = this[mixinSym];
|
|
12930
13017
|
const errorKey = this[errorKeySym];
|
|
@@ -12946,12 +13033,12 @@ var require_proto = __commonJS({
|
|
|
12946
13033
|
}
|
|
12947
13034
|
}
|
|
12948
13035
|
if (mixin) {
|
|
12949
|
-
obj = mixinMergeStrategy(obj, mixin(obj,
|
|
13036
|
+
obj = mixinMergeStrategy(obj, mixin(obj, num5, this));
|
|
12950
13037
|
}
|
|
12951
|
-
const s2 = this[asJsonSym](obj, msg,
|
|
13038
|
+
const s2 = this[asJsonSym](obj, msg, num5, t2);
|
|
12952
13039
|
const stream = this[streamSym];
|
|
12953
13040
|
if (stream[needsMetadataGsym] === true) {
|
|
12954
|
-
stream.lastLevel =
|
|
13041
|
+
stream.lastLevel = num5;
|
|
12955
13042
|
stream.lastObj = obj;
|
|
12956
13043
|
stream.lastMsg = msg;
|
|
12957
13044
|
stream.lastTime = t2.slice(this[timeSliceIndexSym]);
|
|
@@ -12984,11 +13071,11 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
12984
13071
|
exports2.configure = configure;
|
|
12985
13072
|
module2.exports = stringify;
|
|
12986
13073
|
var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
|
|
12987
|
-
function strEscape(
|
|
12988
|
-
if (
|
|
12989
|
-
return `"${
|
|
13074
|
+
function strEscape(str7) {
|
|
13075
|
+
if (str7.length < 5e3 && !strEscapeSequencesRegExp.test(str7)) {
|
|
13076
|
+
return `"${str7}"`;
|
|
12990
13077
|
}
|
|
12991
|
-
return JSON.stringify(
|
|
13078
|
+
return JSON.stringify(str7);
|
|
12992
13079
|
}
|
|
12993
13080
|
function sort(array, comparator) {
|
|
12994
13081
|
if (array.length > 200 || comparator) {
|
|
@@ -14510,11 +14597,11 @@ var init_lib = __esm({
|
|
|
14510
14597
|
}
|
|
14511
14598
|
}
|
|
14512
14599
|
},
|
|
14513
|
-
addToPath: function addToPath(
|
|
14514
|
-
var last =
|
|
14600
|
+
addToPath: function addToPath(path102, added, removed, oldPosInc, options) {
|
|
14601
|
+
var last = path102.lastComponent;
|
|
14515
14602
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
14516
14603
|
return {
|
|
14517
|
-
oldPos:
|
|
14604
|
+
oldPos: path102.oldPos + oldPosInc,
|
|
14518
14605
|
lastComponent: {
|
|
14519
14606
|
count: last.count + 1,
|
|
14520
14607
|
added,
|
|
@@ -14524,7 +14611,7 @@ var init_lib = __esm({
|
|
|
14524
14611
|
};
|
|
14525
14612
|
} else {
|
|
14526
14613
|
return {
|
|
14527
|
-
oldPos:
|
|
14614
|
+
oldPos: path102.oldPos + oldPosInc,
|
|
14528
14615
|
lastComponent: {
|
|
14529
14616
|
count: 1,
|
|
14530
14617
|
added,
|
|
@@ -15105,12 +15192,12 @@ function attachmentToHistoryMessage(o2, ts) {
|
|
|
15105
15192
|
const raw = Array.isArray(a2.memories) ? a2.memories : [];
|
|
15106
15193
|
const memories = raw.map((m3) => {
|
|
15107
15194
|
if (!m3 || typeof m3 !== "object") return null;
|
|
15108
|
-
const
|
|
15109
|
-
const
|
|
15110
|
-
const content = typeof
|
|
15111
|
-
if (!
|
|
15112
|
-
const entry = { path:
|
|
15113
|
-
if (typeof
|
|
15195
|
+
const rec6 = m3;
|
|
15196
|
+
const path102 = typeof rec6.path === "string" ? rec6.path : null;
|
|
15197
|
+
const content = typeof rec6.content === "string" ? rec6.content : null;
|
|
15198
|
+
if (!path102 || content == null) return null;
|
|
15199
|
+
const entry = { path: path102, content };
|
|
15200
|
+
if (typeof rec6.mtimeMs === "number") entry.mtimeMs = rec6.mtimeMs;
|
|
15114
15201
|
return entry;
|
|
15115
15202
|
}).filter((m3) => m3 !== null);
|
|
15116
15203
|
if (memories.length === 0) return null;
|
|
@@ -15974,12 +16061,12 @@ function parseAttachment(obj) {
|
|
|
15974
16061
|
const raw = Array.isArray(a2.memories) ? a2.memories : [];
|
|
15975
16062
|
const memories = raw.map((m3) => {
|
|
15976
16063
|
if (!m3 || typeof m3 !== "object") return null;
|
|
15977
|
-
const
|
|
15978
|
-
const
|
|
15979
|
-
const content = typeof
|
|
15980
|
-
if (!
|
|
15981
|
-
const out = { path:
|
|
15982
|
-
if (typeof
|
|
16064
|
+
const rec6 = m3;
|
|
16065
|
+
const path102 = typeof rec6.path === "string" ? rec6.path : null;
|
|
16066
|
+
const content = typeof rec6.content === "string" ? rec6.content : null;
|
|
16067
|
+
if (!path102 || content == null) return null;
|
|
16068
|
+
const out = { path: path102, content };
|
|
16069
|
+
if (typeof rec6.mtimeMs === "number") out.mtimeMs = rec6.mtimeMs;
|
|
15983
16070
|
return out;
|
|
15984
16071
|
}).filter((m3) => m3 !== null);
|
|
15985
16072
|
if (memories.length === 0) return null;
|
|
@@ -22900,14 +22987,14 @@ var require_luxon = __commonJS({
|
|
|
22900
22987
|
tibt: [3872, 3881]
|
|
22901
22988
|
};
|
|
22902
22989
|
var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split("");
|
|
22903
|
-
function parseDigits(
|
|
22904
|
-
let value = parseInt(
|
|
22990
|
+
function parseDigits(str7) {
|
|
22991
|
+
let value = parseInt(str7, 10);
|
|
22905
22992
|
if (isNaN(value)) {
|
|
22906
22993
|
value = "";
|
|
22907
|
-
for (let i2 = 0; i2 <
|
|
22908
|
-
const code =
|
|
22909
|
-
if (
|
|
22910
|
-
value += hanidecChars.indexOf(
|
|
22994
|
+
for (let i2 = 0; i2 < str7.length; i2++) {
|
|
22995
|
+
const code = str7.charCodeAt(i2);
|
|
22996
|
+
if (str7[i2].search(numberingSystems.hanidec) !== -1) {
|
|
22997
|
+
value += hanidecChars.indexOf(str7[i2]);
|
|
22911
22998
|
} else {
|
|
22912
22999
|
for (const key in numberingSystemsUTF16) {
|
|
22913
23000
|
const [min, max] = numberingSystemsUTF16[key];
|
|
@@ -24065,7 +24152,7 @@ var require_luxon = __commonJS({
|
|
|
24065
24152
|
const [s3, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match2;
|
|
24066
24153
|
const hasNegativePrefix = s3[0] === "-";
|
|
24067
24154
|
const negativeSeconds = secondStr && secondStr[0] === "-";
|
|
24068
|
-
const maybeNegate = (
|
|
24155
|
+
const maybeNegate = (num5, force = false) => num5 !== void 0 && (force || num5 && hasNegativePrefix) ? -num5 : num5;
|
|
24069
24156
|
return [{
|
|
24070
24157
|
years: maybeNegate(parseFloating(yearStr)),
|
|
24071
24158
|
months: maybeNegate(parseFloating(monthStr)),
|
|
@@ -29906,10 +29993,10 @@ var require_random = __commonJS({
|
|
|
29906
29993
|
"use strict";
|
|
29907
29994
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
29908
29995
|
exports2.seededRandom = seededRandom;
|
|
29909
|
-
function xfnv1a(
|
|
29996
|
+
function xfnv1a(str7) {
|
|
29910
29997
|
let h2 = 2166136261 >>> 0;
|
|
29911
|
-
for (let i2 = 0; i2 <
|
|
29912
|
-
h2 ^=
|
|
29998
|
+
for (let i2 = 0; i2 < str7.length; i2++) {
|
|
29999
|
+
h2 ^= str7.charCodeAt(i2);
|
|
29913
30000
|
h2 = Math.imul(h2, 16777619);
|
|
29914
30001
|
}
|
|
29915
30002
|
return () => h2 >>> 0;
|
|
@@ -29922,8 +30009,8 @@ var require_random = __commonJS({
|
|
|
29922
30009
|
return ((t2 ^ t2 >>> 14) >>> 0) / 4294967296;
|
|
29923
30010
|
};
|
|
29924
30011
|
}
|
|
29925
|
-
function seededRandom(
|
|
29926
|
-
const seed =
|
|
30012
|
+
function seededRandom(str7) {
|
|
30013
|
+
const seed = str7 ? xfnv1a(str7)() : Math.floor(Math.random() * 1e10);
|
|
29927
30014
|
return mulberry32(seed);
|
|
29928
30015
|
}
|
|
29929
30016
|
}
|
|
@@ -30256,7 +30343,7 @@ var require_CronExpressionParser = __commonJS({
|
|
|
30256
30343
|
if (atoms.length <= 1) {
|
|
30257
30344
|
return isNaN(+val) ? val : +val;
|
|
30258
30345
|
}
|
|
30259
|
-
const [min, max] = atoms.map((
|
|
30346
|
+
const [min, max] = atoms.map((num5) => parseInt(num5, 10));
|
|
30260
30347
|
this.#validateRange(min, max, constraints);
|
|
30261
30348
|
this.#validateRepeatInterval(repeatInterval);
|
|
30262
30349
|
return this.#createRange(field, min, max, repeatInterval);
|
|
@@ -30800,26 +30887,26 @@ var require_permessage_deflate = __commonJS({
|
|
|
30800
30887
|
value = value[0];
|
|
30801
30888
|
if (key === "client_max_window_bits") {
|
|
30802
30889
|
if (value !== true) {
|
|
30803
|
-
const
|
|
30804
|
-
if (!Number.isInteger(
|
|
30890
|
+
const num5 = +value;
|
|
30891
|
+
if (!Number.isInteger(num5) || num5 < 8 || num5 > 15) {
|
|
30805
30892
|
throw new TypeError(
|
|
30806
30893
|
`Invalid value for parameter "${key}": ${value}`
|
|
30807
30894
|
);
|
|
30808
30895
|
}
|
|
30809
|
-
value =
|
|
30896
|
+
value = num5;
|
|
30810
30897
|
} else if (!this._isServer) {
|
|
30811
30898
|
throw new TypeError(
|
|
30812
30899
|
`Invalid value for parameter "${key}": ${value}`
|
|
30813
30900
|
);
|
|
30814
30901
|
}
|
|
30815
30902
|
} else if (key === "server_max_window_bits") {
|
|
30816
|
-
const
|
|
30817
|
-
if (!Number.isInteger(
|
|
30903
|
+
const num5 = +value;
|
|
30904
|
+
if (!Number.isInteger(num5) || num5 < 8 || num5 > 15) {
|
|
30818
30905
|
throw new TypeError(
|
|
30819
30906
|
`Invalid value for parameter "${key}": ${value}`
|
|
30820
30907
|
);
|
|
30821
30908
|
}
|
|
30822
|
-
value =
|
|
30909
|
+
value = num5;
|
|
30823
30910
|
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
30824
30911
|
if (value !== true) {
|
|
30825
30912
|
throw new TypeError(
|
|
@@ -31514,8 +31601,8 @@ var require_receiver = __commonJS({
|
|
|
31514
31601
|
return;
|
|
31515
31602
|
}
|
|
31516
31603
|
const buf = this.consume(8);
|
|
31517
|
-
const
|
|
31518
|
-
if (
|
|
31604
|
+
const num5 = buf.readUInt32BE(0);
|
|
31605
|
+
if (num5 > Math.pow(2, 53 - 32) - 1) {
|
|
31519
31606
|
const error = this.createError(
|
|
31520
31607
|
RangeError,
|
|
31521
31608
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -31526,7 +31613,7 @@ var require_receiver = __commonJS({
|
|
|
31526
31613
|
cb(error);
|
|
31527
31614
|
return;
|
|
31528
31615
|
}
|
|
31529
|
-
this._payloadLength =
|
|
31616
|
+
this._payloadLength = num5 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
31530
31617
|
this.haveLength(cb);
|
|
31531
31618
|
}
|
|
31532
31619
|
/**
|
|
@@ -35840,19 +35927,19 @@ var require_stream_readable = __commonJS({
|
|
|
35840
35927
|
var ret = p3.data;
|
|
35841
35928
|
n2 -= ret.length;
|
|
35842
35929
|
while (p3 = p3.next) {
|
|
35843
|
-
var
|
|
35844
|
-
var nb = n2 >
|
|
35845
|
-
if (nb ===
|
|
35846
|
-
else ret +=
|
|
35930
|
+
var str7 = p3.data;
|
|
35931
|
+
var nb = n2 > str7.length ? str7.length : n2;
|
|
35932
|
+
if (nb === str7.length) ret += str7;
|
|
35933
|
+
else ret += str7.slice(0, n2);
|
|
35847
35934
|
n2 -= nb;
|
|
35848
35935
|
if (n2 === 0) {
|
|
35849
|
-
if (nb ===
|
|
35936
|
+
if (nb === str7.length) {
|
|
35850
35937
|
++c2;
|
|
35851
35938
|
if (p3.next) list.head = p3.next;
|
|
35852
35939
|
else list.head = list.tail = null;
|
|
35853
35940
|
} else {
|
|
35854
35941
|
list.head = p3;
|
|
35855
|
-
p3.data =
|
|
35942
|
+
p3.data = str7.slice(nb);
|
|
35856
35943
|
}
|
|
35857
35944
|
break;
|
|
35858
35945
|
}
|
|
@@ -36748,14 +36835,14 @@ var require_utils = __commonJS({
|
|
|
36748
36835
|
var nodejsUtils = require_nodejsUtils();
|
|
36749
36836
|
var external = require_external();
|
|
36750
36837
|
require_setImmediate();
|
|
36751
|
-
function string2binary(
|
|
36838
|
+
function string2binary(str7) {
|
|
36752
36839
|
var result = null;
|
|
36753
36840
|
if (support.uint8array) {
|
|
36754
|
-
result = new Uint8Array(
|
|
36841
|
+
result = new Uint8Array(str7.length);
|
|
36755
36842
|
} else {
|
|
36756
|
-
result = new Array(
|
|
36843
|
+
result = new Array(str7.length);
|
|
36757
36844
|
}
|
|
36758
|
-
return stringToArrayLike(
|
|
36845
|
+
return stringToArrayLike(str7, result);
|
|
36759
36846
|
}
|
|
36760
36847
|
exports2.newBlob = function(part, type) {
|
|
36761
36848
|
exports2.checkSupport("blob");
|
|
@@ -36777,9 +36864,9 @@ var require_utils = __commonJS({
|
|
|
36777
36864
|
function identity(input) {
|
|
36778
36865
|
return input;
|
|
36779
36866
|
}
|
|
36780
|
-
function stringToArrayLike(
|
|
36781
|
-
for (var i2 = 0; i2 <
|
|
36782
|
-
array[i2] =
|
|
36867
|
+
function stringToArrayLike(str7, array) {
|
|
36868
|
+
for (var i2 = 0; i2 < str7.length; ++i2) {
|
|
36869
|
+
array[i2] = str7.charCodeAt(i2) & 255;
|
|
36783
36870
|
}
|
|
36784
36871
|
return array;
|
|
36785
36872
|
}
|
|
@@ -36952,8 +37039,8 @@ var require_utils = __commonJS({
|
|
|
36952
37039
|
var result = transform[inputType][outputType](input);
|
|
36953
37040
|
return result;
|
|
36954
37041
|
};
|
|
36955
|
-
exports2.resolve = function(
|
|
36956
|
-
var parts =
|
|
37042
|
+
exports2.resolve = function(path102) {
|
|
37043
|
+
var parts = path102.split("/");
|
|
36957
37044
|
var result = [];
|
|
36958
37045
|
for (var index = 0; index < parts.length; index++) {
|
|
36959
37046
|
var part = parts[index];
|
|
@@ -36992,10 +37079,10 @@ var require_utils = __commonJS({
|
|
|
36992
37079
|
};
|
|
36993
37080
|
exports2.MAX_VALUE_16BITS = 65535;
|
|
36994
37081
|
exports2.MAX_VALUE_32BITS = -1;
|
|
36995
|
-
exports2.pretty = function(
|
|
37082
|
+
exports2.pretty = function(str7) {
|
|
36996
37083
|
var res = "", code, i2;
|
|
36997
|
-
for (i2 = 0; i2 < (
|
|
36998
|
-
code =
|
|
37084
|
+
for (i2 = 0; i2 < (str7 || "").length; i2++) {
|
|
37085
|
+
code = str7.charCodeAt(i2);
|
|
36999
37086
|
res += "\\x" + (code < 16 ? "0" : "") + code.toString(16).toUpperCase();
|
|
37000
37087
|
}
|
|
37001
37088
|
return res;
|
|
@@ -37305,12 +37392,12 @@ var require_utf8 = __commonJS({
|
|
|
37305
37392
|
}
|
|
37306
37393
|
var i2;
|
|
37307
37394
|
_utf8len[254] = _utf8len[254] = 1;
|
|
37308
|
-
var string2buf = function(
|
|
37309
|
-
var buf, c2, c22, m_pos, i3, str_len =
|
|
37395
|
+
var string2buf = function(str7) {
|
|
37396
|
+
var buf, c2, c22, m_pos, i3, str_len = str7.length, buf_len = 0;
|
|
37310
37397
|
for (m_pos = 0; m_pos < str_len; m_pos++) {
|
|
37311
|
-
c2 =
|
|
37398
|
+
c2 = str7.charCodeAt(m_pos);
|
|
37312
37399
|
if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
37313
|
-
c22 =
|
|
37400
|
+
c22 = str7.charCodeAt(m_pos + 1);
|
|
37314
37401
|
if ((c22 & 64512) === 56320) {
|
|
37315
37402
|
c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
|
|
37316
37403
|
m_pos++;
|
|
@@ -37324,9 +37411,9 @@ var require_utf8 = __commonJS({
|
|
|
37324
37411
|
buf = new Array(buf_len);
|
|
37325
37412
|
}
|
|
37326
37413
|
for (i3 = 0, m_pos = 0; i3 < buf_len; m_pos++) {
|
|
37327
|
-
c2 =
|
|
37414
|
+
c2 = str7.charCodeAt(m_pos);
|
|
37328
37415
|
if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
37329
|
-
c22 =
|
|
37416
|
+
c22 = str7.charCodeAt(m_pos + 1);
|
|
37330
37417
|
if ((c22 & 64512) === 56320) {
|
|
37331
37418
|
c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
|
|
37332
37419
|
m_pos++;
|
|
@@ -37410,11 +37497,11 @@ var require_utf8 = __commonJS({
|
|
|
37410
37497
|
}
|
|
37411
37498
|
return utils.applyFromCharCode(utf16buf);
|
|
37412
37499
|
};
|
|
37413
|
-
exports2.utf8encode = function utf8encode(
|
|
37500
|
+
exports2.utf8encode = function utf8encode(str7) {
|
|
37414
37501
|
if (support.nodebuffer) {
|
|
37415
|
-
return nodejsUtils.newBufferFrom(
|
|
37502
|
+
return nodejsUtils.newBufferFrom(str7, "utf-8");
|
|
37416
37503
|
}
|
|
37417
|
-
return string2buf(
|
|
37504
|
+
return string2buf(str7);
|
|
37418
37505
|
};
|
|
37419
37506
|
exports2.utf8decode = function utf8decode(buf) {
|
|
37420
37507
|
if (support.nodebuffer) {
|
|
@@ -37823,11 +37910,11 @@ var require_crc32 = __commonJS({
|
|
|
37823
37910
|
}
|
|
37824
37911
|
return crc ^ -1;
|
|
37825
37912
|
}
|
|
37826
|
-
function crc32str(crc,
|
|
37913
|
+
function crc32str(crc, str7, len, pos) {
|
|
37827
37914
|
var t2 = crcTable, end = pos + len;
|
|
37828
37915
|
crc = crc ^ -1;
|
|
37829
37916
|
for (var i2 = pos; i2 < end; i2++) {
|
|
37830
|
-
crc = crc >>> 8 ^ t2[(crc ^
|
|
37917
|
+
crc = crc >>> 8 ^ t2[(crc ^ str7.charCodeAt(i2)) & 255];
|
|
37831
37918
|
}
|
|
37832
37919
|
return crc ^ -1;
|
|
37833
37920
|
}
|
|
@@ -39024,7 +39111,7 @@ var require_deflate = __commonJS({
|
|
|
39024
39111
|
}
|
|
39025
39112
|
function fill_window(s2) {
|
|
39026
39113
|
var _w_size = s2.w_size;
|
|
39027
|
-
var p3, n2, m3, more,
|
|
39114
|
+
var p3, n2, m3, more, str7;
|
|
39028
39115
|
do {
|
|
39029
39116
|
more = s2.window_size - s2.lookahead - s2.strstart;
|
|
39030
39117
|
if (s2.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
|
|
@@ -39052,14 +39139,14 @@ var require_deflate = __commonJS({
|
|
|
39052
39139
|
n2 = read_buf(s2.strm, s2.window, s2.strstart + s2.lookahead, more);
|
|
39053
39140
|
s2.lookahead += n2;
|
|
39054
39141
|
if (s2.lookahead + s2.insert >= MIN_MATCH) {
|
|
39055
|
-
|
|
39056
|
-
s2.ins_h = s2.window[
|
|
39057
|
-
s2.ins_h = (s2.ins_h << s2.hash_shift ^ s2.window[
|
|
39142
|
+
str7 = s2.strstart - s2.insert;
|
|
39143
|
+
s2.ins_h = s2.window[str7];
|
|
39144
|
+
s2.ins_h = (s2.ins_h << s2.hash_shift ^ s2.window[str7 + 1]) & s2.hash_mask;
|
|
39058
39145
|
while (s2.insert) {
|
|
39059
|
-
s2.ins_h = (s2.ins_h << s2.hash_shift ^ s2.window[
|
|
39060
|
-
s2.prev[
|
|
39061
|
-
s2.head[s2.ins_h] =
|
|
39062
|
-
|
|
39146
|
+
s2.ins_h = (s2.ins_h << s2.hash_shift ^ s2.window[str7 + MIN_MATCH - 1]) & s2.hash_mask;
|
|
39147
|
+
s2.prev[str7 & s2.w_mask] = s2.head[s2.ins_h];
|
|
39148
|
+
s2.head[s2.ins_h] = str7;
|
|
39149
|
+
str7++;
|
|
39063
39150
|
s2.insert--;
|
|
39064
39151
|
if (s2.lookahead + s2.insert < MIN_MATCH) {
|
|
39065
39152
|
break;
|
|
@@ -39835,7 +39922,7 @@ var require_deflate = __commonJS({
|
|
|
39835
39922
|
function deflateSetDictionary(strm, dictionary) {
|
|
39836
39923
|
var dictLength = dictionary.length;
|
|
39837
39924
|
var s2;
|
|
39838
|
-
var
|
|
39925
|
+
var str7, n2;
|
|
39839
39926
|
var wrap2;
|
|
39840
39927
|
var avail;
|
|
39841
39928
|
var next;
|
|
@@ -39873,15 +39960,15 @@ var require_deflate = __commonJS({
|
|
|
39873
39960
|
strm.input = dictionary;
|
|
39874
39961
|
fill_window(s2);
|
|
39875
39962
|
while (s2.lookahead >= MIN_MATCH) {
|
|
39876
|
-
|
|
39963
|
+
str7 = s2.strstart;
|
|
39877
39964
|
n2 = s2.lookahead - (MIN_MATCH - 1);
|
|
39878
39965
|
do {
|
|
39879
|
-
s2.ins_h = (s2.ins_h << s2.hash_shift ^ s2.window[
|
|
39880
|
-
s2.prev[
|
|
39881
|
-
s2.head[s2.ins_h] =
|
|
39882
|
-
|
|
39966
|
+
s2.ins_h = (s2.ins_h << s2.hash_shift ^ s2.window[str7 + MIN_MATCH - 1]) & s2.hash_mask;
|
|
39967
|
+
s2.prev[str7 & s2.w_mask] = s2.head[s2.ins_h];
|
|
39968
|
+
s2.head[s2.ins_h] = str7;
|
|
39969
|
+
str7++;
|
|
39883
39970
|
} while (--n2);
|
|
39884
|
-
s2.strstart =
|
|
39971
|
+
s2.strstart = str7;
|
|
39885
39972
|
s2.lookahead = MIN_MATCH - 1;
|
|
39886
39973
|
fill_window(s2);
|
|
39887
39974
|
}
|
|
@@ -39932,12 +40019,12 @@ var require_strings = __commonJS({
|
|
|
39932
40019
|
}
|
|
39933
40020
|
var q2;
|
|
39934
40021
|
_utf8len[254] = _utf8len[254] = 1;
|
|
39935
|
-
exports2.string2buf = function(
|
|
39936
|
-
var buf, c2, c22, m_pos, i2, str_len =
|
|
40022
|
+
exports2.string2buf = function(str7) {
|
|
40023
|
+
var buf, c2, c22, m_pos, i2, str_len = str7.length, buf_len = 0;
|
|
39937
40024
|
for (m_pos = 0; m_pos < str_len; m_pos++) {
|
|
39938
|
-
c2 =
|
|
40025
|
+
c2 = str7.charCodeAt(m_pos);
|
|
39939
40026
|
if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
39940
|
-
c22 =
|
|
40027
|
+
c22 = str7.charCodeAt(m_pos + 1);
|
|
39941
40028
|
if ((c22 & 64512) === 56320) {
|
|
39942
40029
|
c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
|
|
39943
40030
|
m_pos++;
|
|
@@ -39947,9 +40034,9 @@ var require_strings = __commonJS({
|
|
|
39947
40034
|
}
|
|
39948
40035
|
buf = new utils.Buf8(buf_len);
|
|
39949
40036
|
for (i2 = 0, m_pos = 0; i2 < buf_len; m_pos++) {
|
|
39950
|
-
c2 =
|
|
40037
|
+
c2 = str7.charCodeAt(m_pos);
|
|
39951
40038
|
if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
|
|
39952
|
-
c22 =
|
|
40039
|
+
c22 = str7.charCodeAt(m_pos + 1);
|
|
39953
40040
|
if ((c22 & 64512) === 56320) {
|
|
39954
40041
|
c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
|
|
39955
40042
|
m_pos++;
|
|
@@ -39988,10 +40075,10 @@ var require_strings = __commonJS({
|
|
|
39988
40075
|
exports2.buf2binstring = function(buf) {
|
|
39989
40076
|
return buf2binstring(buf, buf.length);
|
|
39990
40077
|
};
|
|
39991
|
-
exports2.binstring2buf = function(
|
|
39992
|
-
var buf = new utils.Buf8(
|
|
40078
|
+
exports2.binstring2buf = function(str7) {
|
|
40079
|
+
var buf = new utils.Buf8(str7.length);
|
|
39993
40080
|
for (var i2 = 0, len = buf.length; i2 < len; i2++) {
|
|
39994
|
-
buf[i2] =
|
|
40081
|
+
buf[i2] = str7.charCodeAt(i2);
|
|
39995
40082
|
}
|
|
39996
40083
|
return buf;
|
|
39997
40084
|
};
|
|
@@ -42806,18 +42893,18 @@ var require_object = __commonJS({
|
|
|
42806
42893
|
var object = new ZipObject(name, zipObjectContent, o2);
|
|
42807
42894
|
this.files[name] = object;
|
|
42808
42895
|
};
|
|
42809
|
-
var parentFolder = function(
|
|
42810
|
-
if (
|
|
42811
|
-
|
|
42896
|
+
var parentFolder = function(path102) {
|
|
42897
|
+
if (path102.slice(-1) === "/") {
|
|
42898
|
+
path102 = path102.substring(0, path102.length - 1);
|
|
42812
42899
|
}
|
|
42813
|
-
var lastSlash =
|
|
42814
|
-
return lastSlash > 0 ?
|
|
42900
|
+
var lastSlash = path102.lastIndexOf("/");
|
|
42901
|
+
return lastSlash > 0 ? path102.substring(0, lastSlash) : "";
|
|
42815
42902
|
};
|
|
42816
|
-
var forceTrailingSlash = function(
|
|
42817
|
-
if (
|
|
42818
|
-
|
|
42903
|
+
var forceTrailingSlash = function(path102) {
|
|
42904
|
+
if (path102.slice(-1) !== "/") {
|
|
42905
|
+
path102 += "/";
|
|
42819
42906
|
}
|
|
42820
|
-
return
|
|
42907
|
+
return path102;
|
|
42821
42908
|
};
|
|
42822
42909
|
var folderAdd = function(name, createFolders) {
|
|
42823
42910
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -43819,7 +43906,7 @@ var require_lib3 = __commonJS({
|
|
|
43819
43906
|
// src/run-case/recorder.ts
|
|
43820
43907
|
function startRunCaseRecorder(opts) {
|
|
43821
43908
|
const now = opts.now ?? Date.now;
|
|
43822
|
-
const dir =
|
|
43909
|
+
const dir = import_node_path81.default.dirname(opts.recordPath);
|
|
43823
43910
|
let stream = null;
|
|
43824
43911
|
let closing = false;
|
|
43825
43912
|
let closedSettled = false;
|
|
@@ -43833,8 +43920,8 @@ function startRunCaseRecorder(opts) {
|
|
|
43833
43920
|
});
|
|
43834
43921
|
const ensureStream = () => {
|
|
43835
43922
|
if (stream) return stream;
|
|
43836
|
-
|
|
43837
|
-
stream =
|
|
43923
|
+
import_node_fs62.default.mkdirSync(dir, { recursive: true });
|
|
43924
|
+
stream = import_node_fs62.default.createWriteStream(opts.recordPath, { flags: "a" });
|
|
43838
43925
|
stream.on("close", () => closedResolve());
|
|
43839
43926
|
return stream;
|
|
43840
43927
|
};
|
|
@@ -43859,12 +43946,12 @@ function startRunCaseRecorder(opts) {
|
|
|
43859
43946
|
};
|
|
43860
43947
|
return { tap, close, closed };
|
|
43861
43948
|
}
|
|
43862
|
-
var
|
|
43949
|
+
var import_node_fs62, import_node_path81;
|
|
43863
43950
|
var init_recorder = __esm({
|
|
43864
43951
|
"src/run-case/recorder.ts"() {
|
|
43865
43952
|
"use strict";
|
|
43866
|
-
|
|
43867
|
-
|
|
43953
|
+
import_node_fs62 = __toESM(require("fs"), 1);
|
|
43954
|
+
import_node_path81 = __toESM(require("path"), 1);
|
|
43868
43955
|
}
|
|
43869
43956
|
});
|
|
43870
43957
|
|
|
@@ -43907,7 +43994,7 @@ var init_wire = __esm({
|
|
|
43907
43994
|
// src/run-case/controller.ts
|
|
43908
43995
|
async function runController(opts) {
|
|
43909
43996
|
const now = opts.now ?? Date.now;
|
|
43910
|
-
const cwd = opts.cwd ?? (0,
|
|
43997
|
+
const cwd = opts.cwd ?? (0, import_node_fs63.mkdtempSync)(import_node_path82.default.join(import_node_os29.default.tmpdir(), "clawd-runcase-"));
|
|
43911
43998
|
const ownsCwd = opts.cwd === void 0;
|
|
43912
43999
|
const recorder = startRunCaseRecorder({ recordPath: opts.record, now });
|
|
43913
44000
|
const spawnCtx = { cwd };
|
|
@@ -44068,19 +44155,19 @@ async function runController(opts) {
|
|
|
44068
44155
|
if (sigintHandler) process.off("SIGINT", sigintHandler);
|
|
44069
44156
|
if (ownsCwd) {
|
|
44070
44157
|
try {
|
|
44071
|
-
(0,
|
|
44158
|
+
(0, import_node_fs63.rmSync)(cwd, { recursive: true, force: true });
|
|
44072
44159
|
} catch {
|
|
44073
44160
|
}
|
|
44074
44161
|
}
|
|
44075
44162
|
return exitCode ?? 0;
|
|
44076
44163
|
}
|
|
44077
|
-
var
|
|
44164
|
+
var import_node_fs63, import_node_os29, import_node_path82;
|
|
44078
44165
|
var init_controller = __esm({
|
|
44079
44166
|
"src/run-case/controller.ts"() {
|
|
44080
44167
|
"use strict";
|
|
44081
|
-
|
|
44168
|
+
import_node_fs63 = require("fs");
|
|
44082
44169
|
import_node_os29 = __toESM(require("os"), 1);
|
|
44083
|
-
|
|
44170
|
+
import_node_path82 = __toESM(require("path"), 1);
|
|
44084
44171
|
init_claude();
|
|
44085
44172
|
init_stdout_splitter();
|
|
44086
44173
|
init_permission_stdio();
|
|
@@ -44352,8 +44439,8 @@ Env (advanced):
|
|
|
44352
44439
|
`;
|
|
44353
44440
|
|
|
44354
44441
|
// src/index.ts
|
|
44355
|
-
var
|
|
44356
|
-
var
|
|
44442
|
+
var import_node_path80 = __toESM(require("path"), 1);
|
|
44443
|
+
var import_node_fs61 = __toESM(require("fs"), 1);
|
|
44357
44444
|
var import_node_os28 = __toESM(require("os"), 1);
|
|
44358
44445
|
var import_node_crypto22 = require("crypto");
|
|
44359
44446
|
var import_node_url5 = require("url");
|
|
@@ -44647,9 +44734,9 @@ async function sendBatch(deps, batch) {
|
|
|
44647
44734
|
}
|
|
44648
44735
|
return { sent: 0, failed: batch.records.length };
|
|
44649
44736
|
}
|
|
44650
|
-
function stringifyRecord(
|
|
44737
|
+
function stringifyRecord(rec6) {
|
|
44651
44738
|
const out = {};
|
|
44652
|
-
for (const [k3, v3] of Object.entries(
|
|
44739
|
+
for (const [k3, v3] of Object.entries(rec6)) {
|
|
44653
44740
|
if (v3 == null) continue;
|
|
44654
44741
|
out[k3] = typeof v3 === "string" ? v3 : String(v3);
|
|
44655
44742
|
}
|
|
@@ -47243,7 +47330,8 @@ var SessionManager = class {
|
|
|
47243
47330
|
// 当同步命令执行期间,runner 的 emit-frame 临时 push 到这里;
|
|
47244
47331
|
// null 表示当前是异步路径(stdout 'data' / proc 'exit' 等),走 deps.broadcastFrame
|
|
47245
47332
|
currentCollector = null;
|
|
47246
|
-
// tool id → capabilities 快照(仅 capabilities:get RPC 缓存用;contextWindowSize 走 adapter.resolveContextWindow
|
|
47333
|
+
// tool id → capabilities 快照(仅 capabilities:get RPC 缓存用;contextWindowSize 走 adapter.resolveContextWindow,无需缓存)。
|
|
47334
|
+
// loadedAt 给 engine:status 显示「模型表上次刷新时间」;refresh 走 getCapabilities({ refresh:true }) 整条覆盖
|
|
47247
47335
|
capabilitiesCache = /* @__PURE__ */ new Map();
|
|
47248
47336
|
// sessionId → (synth uuid → real uuid):
|
|
47249
47337
|
// synth uuid = daemon 在 reducer 'send' 命令里生成、写进 buffer 里 user_text 事件的 uuid
|
|
@@ -47351,14 +47439,18 @@ var SessionManager = class {
|
|
|
47351
47439
|
this.storesByScope.set(key, st2);
|
|
47352
47440
|
return st2;
|
|
47353
47441
|
}
|
|
47354
|
-
async getCapabilities(tool) {
|
|
47442
|
+
async getCapabilities(tool, opts) {
|
|
47355
47443
|
const cached = this.capabilitiesCache.get(tool);
|
|
47356
|
-
if (cached) return cached;
|
|
47444
|
+
if (cached && !opts?.refresh) return cached.caps;
|
|
47357
47445
|
const adapter = this.deps.getAdapter(tool);
|
|
47358
|
-
const caps = await adapter.capabilities();
|
|
47359
|
-
this.capabilitiesCache.set(tool, caps);
|
|
47446
|
+
const caps = await adapter.capabilities(opts);
|
|
47447
|
+
this.capabilitiesCache.set(tool, { caps, loadedAt: Date.now() });
|
|
47360
47448
|
return caps;
|
|
47361
47449
|
}
|
|
47450
|
+
/** 这份 capabilities 是什么时候查的(ms);还没查过 → undefined */
|
|
47451
|
+
capabilitiesLoadedAt(tool) {
|
|
47452
|
+
return this.capabilitiesCache.get(tool)?.loadedAt;
|
|
47453
|
+
}
|
|
47362
47454
|
// 由 SessionFile 反推 scope 的 thin wrapper —— 决策矩阵收敛到 scope.scopeForFile
|
|
47363
47455
|
// free function(scope.spec.ts transition 表驱动测试),manager 只负责注入 deps.
|
|
47364
47456
|
scopeForFile(file) {
|
|
@@ -51695,8 +51787,8 @@ function turnStartInput(text, resolveImage) {
|
|
|
51695
51787
|
const items = [];
|
|
51696
51788
|
let leftover = text;
|
|
51697
51789
|
for (const m3 of text.matchAll(SKILL_RE)) {
|
|
51698
|
-
const [marker, name,
|
|
51699
|
-
items.push({ type: "skill", name, path:
|
|
51790
|
+
const [marker, name, path102] = m3;
|
|
51791
|
+
items.push({ type: "skill", name, path: path102 });
|
|
51700
51792
|
leftover = leftover.replace(marker, "");
|
|
51701
51793
|
}
|
|
51702
51794
|
for (const m3 of text.matchAll(ATTACHMENT_RE2)) {
|
|
@@ -52414,15 +52506,9 @@ async function fetchProviderModels(endpoint, deps = {}) {
|
|
|
52414
52506
|
const url = `${endpoint.baseUrl.replace(/\/$/, "")}/models`;
|
|
52415
52507
|
try {
|
|
52416
52508
|
const res = await fetchImpl(url, { headers: endpoint.headers, signal: controller.signal });
|
|
52417
|
-
if (!res.ok) {
|
|
52418
|
-
deps.logger?.warn?.(`provider model list failed: HTTP ${res.status} from ${url}`);
|
|
52419
|
-
return [];
|
|
52420
|
-
}
|
|
52509
|
+
if (!res.ok) throw new Error(`provider model list failed: HTTP ${res.status} from ${url}`);
|
|
52421
52510
|
const data = asRecord(await res.json())?.data;
|
|
52422
|
-
if (!Array.isArray(data)) {
|
|
52423
|
-
deps.logger?.warn?.(`provider model list: \`data\` is not an array (${url})`);
|
|
52424
|
-
return [];
|
|
52425
|
-
}
|
|
52511
|
+
if (!Array.isArray(data)) throw new Error(`provider model list: \`data\` is not an array (${url})`);
|
|
52426
52512
|
const out = [];
|
|
52427
52513
|
for (const item of data) {
|
|
52428
52514
|
const e = asRecord(item);
|
|
@@ -52431,6 +52517,7 @@ async function fetchProviderModels(endpoint, deps = {}) {
|
|
|
52431
52517
|
}
|
|
52432
52518
|
return out;
|
|
52433
52519
|
} catch (err) {
|
|
52520
|
+
if (deps.throwOnFailure) throw err;
|
|
52434
52521
|
deps.logger?.warn?.(`provider model list failed: ${err.message}`);
|
|
52435
52522
|
return [];
|
|
52436
52523
|
} finally {
|
|
@@ -52526,8 +52613,8 @@ var CodexAdapter = class {
|
|
|
52526
52613
|
codexHomeFor;
|
|
52527
52614
|
getSignSecret;
|
|
52528
52615
|
// capabilities 的进程级 memo。**回落结果同样被缓存**——否则 codex 没装时每次开弹窗都
|
|
52529
|
-
// spawn
|
|
52530
|
-
//
|
|
52616
|
+
// spawn 一次必然失败的子进程。装好 codex / provider 加了模型后不用重启:设置 → 账号「引擎」的
|
|
52617
|
+
// 「刷新模型」走 capabilities({ refresh:true }) 重查(spec 2026-09-17-engine-status)。
|
|
52531
52618
|
capsPromise;
|
|
52532
52619
|
constructor(opts = {}) {
|
|
52533
52620
|
this.logger = opts.logger;
|
|
@@ -52544,14 +52631,19 @@ var CodexAdapter = class {
|
|
|
52544
52631
|
this.probeCache = this.probeOverride ? await this.probeOverride() : await probeCodex();
|
|
52545
52632
|
return this.probeCache;
|
|
52546
52633
|
}
|
|
52547
|
-
async capabilities() {
|
|
52548
|
-
if (
|
|
52634
|
+
async capabilities(opts) {
|
|
52635
|
+
if (opts?.refresh) {
|
|
52636
|
+
const fresh = await this.loadCapabilities({ strict: true });
|
|
52637
|
+
this.capsPromise = Promise.resolve(fresh);
|
|
52638
|
+
return fresh;
|
|
52639
|
+
}
|
|
52640
|
+
if (!this.capsPromise) this.capsPromise = this.loadCapabilities({ strict: false });
|
|
52549
52641
|
return this.capsPromise;
|
|
52550
52642
|
}
|
|
52551
|
-
async loadCapabilities() {
|
|
52643
|
+
async loadCapabilities(opts) {
|
|
52552
52644
|
const [native, providerModels] = await Promise.all([
|
|
52553
|
-
this.loadNativeModels(),
|
|
52554
|
-
this.loadProviderModels()
|
|
52645
|
+
this.loadNativeModels(opts.strict),
|
|
52646
|
+
this.loadProviderModels(opts.strict)
|
|
52555
52647
|
]);
|
|
52556
52648
|
if (native.length === 0 && providerModels.length === 0) {
|
|
52557
52649
|
return buildCapabilities([CODEX_DEFAULT_MODEL_ENTRY]);
|
|
@@ -52559,12 +52651,13 @@ var CodexAdapter = class {
|
|
|
52559
52651
|
const base = native.length > 0 ? [] : [CODEX_DEFAULT_MODEL_ENTRY];
|
|
52560
52652
|
return buildCapabilities([...base, ...mergeProviderModels(native, providerModels)]);
|
|
52561
52653
|
}
|
|
52562
|
-
/** codex 内置型号表。失败返回 []
|
|
52563
|
-
async loadNativeModels() {
|
|
52654
|
+
/** codex 内置型号表。失败返回 [](strict 时抛),由 loadCapabilities 决定怎么降级 */
|
|
52655
|
+
async loadNativeModels(strict) {
|
|
52564
52656
|
try {
|
|
52565
52657
|
const raw = this.queryOverride ? await this.queryOverride() : await queryCodexAppServer(process.cwd(), "model/list", {});
|
|
52566
52658
|
return mapModelList(raw);
|
|
52567
52659
|
} catch (err) {
|
|
52660
|
+
if (strict) throw err;
|
|
52568
52661
|
this.logger?.warn?.(`codex model/list failed: ${err.message}`);
|
|
52569
52662
|
return [];
|
|
52570
52663
|
}
|
|
@@ -52573,7 +52666,7 @@ var CodexAdapter = class {
|
|
|
52573
52666
|
* provider 订阅侧全集。未配自定义 provider(官方用户)或任何失败都返回 []。
|
|
52574
52667
|
* 见 codex-provider-models.ts —— model/list 只报 codex 内置型号,代理转发的模型全靠这里。
|
|
52575
52668
|
*/
|
|
52576
|
-
async loadProviderModels() {
|
|
52669
|
+
async loadProviderModels(strict) {
|
|
52577
52670
|
try {
|
|
52578
52671
|
const raw = this.configQueryOverride ? await this.configQueryOverride() : await queryCodexAppServer(process.cwd(), "config/read", {}, {
|
|
52579
52672
|
timeoutMs: PROVIDER_FETCH_TIMEOUT_MS
|
|
@@ -52584,9 +52677,11 @@ var CodexAdapter = class {
|
|
|
52584
52677
|
if (!endpoint) return [];
|
|
52585
52678
|
return await fetchProviderModels(endpoint, {
|
|
52586
52679
|
...this.fetchImpl ? { fetchImpl: this.fetchImpl } : {},
|
|
52587
|
-
...this.logger ? { logger: this.logger } : {}
|
|
52680
|
+
...this.logger ? { logger: this.logger } : {},
|
|
52681
|
+
throwOnFailure: strict
|
|
52588
52682
|
});
|
|
52589
52683
|
} catch (err) {
|
|
52684
|
+
if (strict) throw err;
|
|
52590
52685
|
this.logger?.warn?.(`codex provider model list failed: ${err.message}`);
|
|
52591
52686
|
return [];
|
|
52592
52687
|
}
|
|
@@ -53990,7 +54085,7 @@ function createDispatchStore(deps) {
|
|
|
53990
54085
|
return records.find((r2) => r2.dispatchId === dispatchId);
|
|
53991
54086
|
}
|
|
53992
54087
|
function add(input) {
|
|
53993
|
-
const
|
|
54088
|
+
const rec6 = {
|
|
53994
54089
|
dispatchId: input.dispatchId,
|
|
53995
54090
|
sourceSessionId: input.sourceSessionId,
|
|
53996
54091
|
...input.sourcePersonaId ? { sourcePersonaId: input.sourcePersonaId } : {},
|
|
@@ -54004,9 +54099,9 @@ function createDispatchStore(deps) {
|
|
|
54004
54099
|
...input.meta ? { meta: input.meta } : {},
|
|
54005
54100
|
createdAt: new Date(deps.now()).toISOString()
|
|
54006
54101
|
};
|
|
54007
|
-
records.push(
|
|
54102
|
+
records.push(rec6);
|
|
54008
54103
|
scheduleFlush();
|
|
54009
|
-
return
|
|
54104
|
+
return rec6;
|
|
54010
54105
|
}
|
|
54011
54106
|
function update(dispatchId, patch) {
|
|
54012
54107
|
const idx = records.findIndex((r2) => r2.dispatchId === dispatchId);
|
|
@@ -58908,10 +59003,10 @@ function createGithubApi(args) {
|
|
|
58908
59003
|
const doFetch = args.fetch ?? fetch;
|
|
58909
59004
|
const seal = args.seal ?? sealWithSodium;
|
|
58910
59005
|
const timeoutMs = args.timeoutMs ?? TIMEOUT_MS;
|
|
58911
|
-
async function request(method,
|
|
59006
|
+
async function request(method, path102, body) {
|
|
58912
59007
|
let res;
|
|
58913
59008
|
try {
|
|
58914
|
-
res = await doFetch(`${API}${
|
|
59009
|
+
res = await doFetch(`${API}${path102}`, {
|
|
58915
59010
|
method,
|
|
58916
59011
|
headers: {
|
|
58917
59012
|
Authorization: `Bearer ${args.token}`,
|
|
@@ -58936,8 +59031,8 @@ function createGithubApi(args) {
|
|
|
58936
59031
|
}
|
|
58937
59032
|
return { status: res.status, json };
|
|
58938
59033
|
}
|
|
58939
|
-
async function must(method,
|
|
58940
|
-
const r2 = await request(method,
|
|
59034
|
+
async function must(method, path102, what, body) {
|
|
59035
|
+
const r2 = await request(method, path102, body);
|
|
58941
59036
|
if (r2.status < 200 || r2.status >= 300) throw new GithubApiError(r2.status, explain(r2.status, what, r2.json));
|
|
58942
59037
|
return r2.json;
|
|
58943
59038
|
}
|
|
@@ -58977,9 +59072,9 @@ function createGithubApi(args) {
|
|
|
58977
59072
|
return { env: x2.name, ...Number.isFinite(at3) ? { setAt: at3 } : {} };
|
|
58978
59073
|
});
|
|
58979
59074
|
},
|
|
58980
|
-
async getJson(
|
|
59075
|
+
async getJson(path102) {
|
|
58981
59076
|
try {
|
|
58982
|
-
const r2 = await request("GET",
|
|
59077
|
+
const r2 = await request("GET", path102);
|
|
58983
59078
|
return r2.status >= 200 && r2.status < 300 ? r2.json : void 0;
|
|
58984
59079
|
} catch {
|
|
58985
59080
|
return void 0;
|
|
@@ -60606,11 +60701,11 @@ function createLarkBotCloudClient(opts) {
|
|
|
60606
60701
|
const json = await request("POST", "/api/lark-bot/events/claim?v=2");
|
|
60607
60702
|
const items = json.items ?? [];
|
|
60608
60703
|
return items.map((it2) => {
|
|
60609
|
-
const
|
|
60610
|
-
if (
|
|
60704
|
+
const rec6 = it2;
|
|
60705
|
+
if (rec6 && typeof rec6 === "object" && "payload" in rec6) {
|
|
60611
60706
|
return {
|
|
60612
|
-
status:
|
|
60613
|
-
payload:
|
|
60707
|
+
status: rec6.status === "forwarded" ? "forwarded" : "received",
|
|
60708
|
+
payload: rec6.payload
|
|
60614
60709
|
};
|
|
60615
60710
|
}
|
|
60616
60711
|
return { status: "received", payload: it2 };
|
|
@@ -61125,26 +61220,26 @@ function buildPersonaDispatchHandlers(deps) {
|
|
|
61125
61220
|
"follow-up dispatch cannot be initiated by a guest"
|
|
61126
61221
|
);
|
|
61127
61222
|
}
|
|
61128
|
-
const
|
|
61129
|
-
if (!
|
|
61223
|
+
const rec6 = deps.store.get(args.dispatchId);
|
|
61224
|
+
if (!rec6) {
|
|
61130
61225
|
throw new ClawdError(ERROR_CODES.INVALID_PARAM, `dispatch not found: ${args.dispatchId}`);
|
|
61131
61226
|
}
|
|
61132
|
-
if (!
|
|
61227
|
+
if (!rec6.workerSessionId) {
|
|
61133
61228
|
throw new ClawdError(
|
|
61134
61229
|
ERROR_CODES.INVALID_PARAM,
|
|
61135
61230
|
`dispatch ${args.dispatchId} has no worker session and cannot be continued (cross-device or spawn incomplete)`
|
|
61136
61231
|
);
|
|
61137
61232
|
}
|
|
61138
|
-
if (args.targetPersona && args.targetPersona !==
|
|
61233
|
+
if (args.targetPersona && args.targetPersona !== rec6.targetPersonaId) {
|
|
61139
61234
|
throw new ClawdError(
|
|
61140
61235
|
ERROR_CODES.INVALID_PARAM,
|
|
61141
|
-
`targetPersona mismatch: dispatch ${args.dispatchId} belongs to ${
|
|
61236
|
+
`targetPersona mismatch: dispatch ${args.dispatchId} belongs to ${rec6.targetPersonaId}`
|
|
61142
61237
|
);
|
|
61143
61238
|
}
|
|
61144
61239
|
if (!deps.sendFollowUp) {
|
|
61145
61240
|
throw new Error("follow-up dispatch not wired (sendFollowUp missing)");
|
|
61146
61241
|
}
|
|
61147
|
-
const nextRound = (
|
|
61242
|
+
const nextRound = (rec6.round ?? 1) + 1;
|
|
61148
61243
|
deps.store.update(args.dispatchId, {
|
|
61149
61244
|
status: "running",
|
|
61150
61245
|
outcome: void 0,
|
|
@@ -61153,27 +61248,27 @@ function buildPersonaDispatchHandlers(deps) {
|
|
|
61153
61248
|
taskText: args.prompt.slice(0, TASK_TEXT_MAX),
|
|
61154
61249
|
round: nextRound,
|
|
61155
61250
|
...args.brief ? { taskBrief: args.brief } : {},
|
|
61156
|
-
...args.meta ? { meta: { ...
|
|
61251
|
+
...args.meta ? { meta: { ...rec6.meta ?? {}, ...args.meta } } : {}
|
|
61157
61252
|
});
|
|
61158
61253
|
mgr.reopen(args.dispatchId, {
|
|
61159
61254
|
sourceSessionId,
|
|
61160
|
-
targetPersona:
|
|
61161
|
-
workerSessionId:
|
|
61255
|
+
targetPersona: rec6.targetPersonaId,
|
|
61256
|
+
workerSessionId: rec6.workerSessionId
|
|
61162
61257
|
});
|
|
61163
61258
|
logger?.info("dispatch.run.follow-up", {
|
|
61164
61259
|
dispatchId: args.dispatchId,
|
|
61165
|
-
workerSessionId:
|
|
61260
|
+
workerSessionId: rec6.workerSessionId,
|
|
61166
61261
|
promptLen: args.prompt.length
|
|
61167
61262
|
});
|
|
61168
61263
|
const ok = deps.sendFollowUp(
|
|
61169
|
-
|
|
61264
|
+
rec6.workerSessionId,
|
|
61170
61265
|
buildFollowUpTaskPack(
|
|
61171
61266
|
args.dispatchId,
|
|
61172
61267
|
args.prompt,
|
|
61173
61268
|
nextRound,
|
|
61174
61269
|
// 台账行里有就用台账的(本机派活一律有),没有再现查一次:老台账行是在
|
|
61175
61270
|
// sourcePersonaId 有写入点之前落的,那些行只能靠现查补上。
|
|
61176
|
-
|
|
61271
|
+
rec6.sourcePersonaId ?? deps.getSessionPersonaId?.(sourceSessionId)
|
|
61177
61272
|
),
|
|
61178
61273
|
// 来源分型(L2):续派并进 dispatch-task;realtime 侧靠这个 meta 打标,
|
|
61179
61274
|
// history 侧靠 classifyUserMessage 从信封解出同值。
|
|
@@ -61370,16 +61465,16 @@ function buildPersonaDispatchHandlers(deps) {
|
|
|
61370
61465
|
const get = async (frame, _client, ctx) => {
|
|
61371
61466
|
const { type: _t2, requestId: _r2, ...rest } = frame;
|
|
61372
61467
|
const args = DispatchGetArgsSchema.parse(rest);
|
|
61373
|
-
const
|
|
61374
|
-
const denied = ctx?.principal.kind === "guest" &&
|
|
61375
|
-
if (!
|
|
61468
|
+
const rec6 = deps.store.get(args.dispatchId);
|
|
61469
|
+
const denied = ctx?.principal.kind === "guest" && rec6?.sourceSessionId !== ctx.principal.id;
|
|
61470
|
+
if (!rec6 || denied) {
|
|
61376
61471
|
throw new ClawdError(ERROR_CODES.DISPATCH_NOT_FOUND, `unknown dispatchId: ${args.dispatchId}`);
|
|
61377
61472
|
}
|
|
61378
61473
|
return {
|
|
61379
61474
|
response: {
|
|
61380
61475
|
type: "personaDispatch:get:ok",
|
|
61381
|
-
status:
|
|
61382
|
-
...
|
|
61476
|
+
status: rec6.status,
|
|
61477
|
+
...rec6.outcome ? { outcome: rec6.outcome } : {}
|
|
61383
61478
|
}
|
|
61384
61479
|
};
|
|
61385
61480
|
};
|
|
@@ -62139,9 +62234,9 @@ var CentralClientError = class extends Error {
|
|
|
62139
62234
|
code;
|
|
62140
62235
|
cause;
|
|
62141
62236
|
};
|
|
62142
|
-
async function centralRequest(opts,
|
|
62237
|
+
async function centralRequest(opts, path102, init) {
|
|
62143
62238
|
const f2 = opts.fetchImpl ?? globalThis.fetch;
|
|
62144
|
-
const url = `${opts.api.replace(/\/+$/, "")}${
|
|
62239
|
+
const url = `${opts.api.replace(/\/+$/, "")}${path102}`;
|
|
62145
62240
|
const ctrl = new AbortController();
|
|
62146
62241
|
const timer = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 15e3);
|
|
62147
62242
|
let res;
|
|
@@ -63577,15 +63672,21 @@ var PiAdapter = class {
|
|
|
63577
63672
|
this.probeCache = this.opts.probeOverride ? await this.opts.probeOverride() : await probePi();
|
|
63578
63673
|
return this.probeCache;
|
|
63579
63674
|
}
|
|
63580
|
-
async capabilities() {
|
|
63581
|
-
if (
|
|
63675
|
+
async capabilities(opts) {
|
|
63676
|
+
if (opts?.refresh) {
|
|
63677
|
+
const fresh = await this.loadCapabilities({ strict: true });
|
|
63678
|
+
this.capsPromise = Promise.resolve(fresh);
|
|
63679
|
+
return fresh;
|
|
63680
|
+
}
|
|
63681
|
+
if (!this.capsPromise) this.capsPromise = this.loadCapabilities({ strict: false });
|
|
63582
63682
|
return this.capsPromise;
|
|
63583
63683
|
}
|
|
63584
|
-
async loadCapabilities() {
|
|
63684
|
+
async loadCapabilities(opts) {
|
|
63585
63685
|
let models = [];
|
|
63586
63686
|
try {
|
|
63587
63687
|
models = mapPiModels(this.opts.queryOverride ? await this.opts.queryOverride() : await queryPiModels());
|
|
63588
63688
|
} catch (err) {
|
|
63689
|
+
if (opts.strict) throw err;
|
|
63589
63690
|
this.opts.logger?.warn?.(`pi get_available_models failed: ${err.message}`);
|
|
63590
63691
|
}
|
|
63591
63692
|
if (models.length === 0) models = [PI_DEFAULT_MODEL_ENTRY];
|
|
@@ -63629,13 +63730,13 @@ function mapSkillsListResponse(res) {
|
|
|
63629
63730
|
const r2 = s2 ?? {};
|
|
63630
63731
|
const name = str4(r2.name);
|
|
63631
63732
|
if (!name) continue;
|
|
63632
|
-
const
|
|
63733
|
+
const path102 = str4(r2.path);
|
|
63633
63734
|
const description = str4(r2.description);
|
|
63634
63735
|
const isPlugin = name.includes(":");
|
|
63635
63736
|
out.push({
|
|
63636
63737
|
name,
|
|
63637
63738
|
source: isPlugin ? "plugin" : "project",
|
|
63638
|
-
...
|
|
63739
|
+
...path102 ? { path: path102 } : {},
|
|
63639
63740
|
...description ? { description } : {},
|
|
63640
63741
|
...isPlugin ? { plugin: name.split(":")[0] } : {}
|
|
63641
63742
|
});
|
|
@@ -68162,7 +68263,7 @@ var ServerKeyStore = class {
|
|
|
68162
68263
|
init_protocol();
|
|
68163
68264
|
|
|
68164
68265
|
// src/handlers/index.ts
|
|
68165
|
-
var
|
|
68266
|
+
var import_node_path75 = __toESM(require("path"), 1);
|
|
68166
68267
|
|
|
68167
68268
|
// src/handlers/session.ts
|
|
68168
68269
|
init_protocol();
|
|
@@ -68337,24 +68438,24 @@ async function scanClaude(roots) {
|
|
|
68337
68438
|
let firstTs = 0;
|
|
68338
68439
|
let lastTs = 0;
|
|
68339
68440
|
let hasMainLine = false;
|
|
68340
|
-
for await (const
|
|
68341
|
-
if (!cwd && typeof
|
|
68342
|
-
if (!entrypoint && typeof
|
|
68343
|
-
if (typeof
|
|
68344
|
-
const t2 = Date.parse(
|
|
68441
|
+
for await (const rec6 of jsonLines(file)) {
|
|
68442
|
+
if (!cwd && typeof rec6.cwd === "string") cwd = rec6.cwd;
|
|
68443
|
+
if (!entrypoint && typeof rec6.entrypoint === "string") entrypoint = rec6.entrypoint;
|
|
68444
|
+
if (typeof rec6.timestamp === "string") {
|
|
68445
|
+
const t2 = Date.parse(rec6.timestamp);
|
|
68345
68446
|
if (Number.isFinite(t2)) {
|
|
68346
68447
|
firstTs ||= t2;
|
|
68347
68448
|
lastTs = t2;
|
|
68348
68449
|
}
|
|
68349
68450
|
}
|
|
68350
|
-
if (
|
|
68351
|
-
title = String(
|
|
68451
|
+
if (rec6.type === "ai-title" && rec6.aiTitle) {
|
|
68452
|
+
title = String(rec6.aiTitle);
|
|
68352
68453
|
continue;
|
|
68353
68454
|
}
|
|
68354
|
-
if (
|
|
68355
|
-
if (!
|
|
68356
|
-
if (
|
|
68357
|
-
const text = userText(
|
|
68455
|
+
if (rec6.type !== "user" && rec6.type !== "assistant") continue;
|
|
68456
|
+
if (!rec6.isSidechain) hasMainLine = true;
|
|
68457
|
+
if (rec6.type !== "user" || rec6.isSidechain || rec6.isMeta) continue;
|
|
68458
|
+
const text = userText(rec6.message || {});
|
|
68358
68459
|
if (!text.trim() || text.trimStart().startsWith("<")) continue;
|
|
68359
68460
|
turns += 1;
|
|
68360
68461
|
firstUser ||= text;
|
|
@@ -68381,8 +68482,8 @@ async function countCodexTurns(rolloutPath) {
|
|
|
68381
68482
|
if (!rolloutPath || !import_node_fs56.default.existsSync(rolloutPath)) return { turns: 0, first: "" };
|
|
68382
68483
|
let turns = 0;
|
|
68383
68484
|
let first = "";
|
|
68384
|
-
for await (const
|
|
68385
|
-
const p3 =
|
|
68485
|
+
for await (const rec6 of jsonLines(rolloutPath)) {
|
|
68486
|
+
const p3 = rec6.payload || {};
|
|
68386
68487
|
if (p3.type !== "message" || p3.role !== "user") continue;
|
|
68387
68488
|
const text = (p3.content || []).map((b3) => String(b3 && b3.text || "")).join("");
|
|
68388
68489
|
if (!text.trim() || text.trimStart().startsWith("<")) continue;
|
|
@@ -69562,7 +69663,7 @@ function buildCapabilitiesHandlers(deps) {
|
|
|
69562
69663
|
const { manager } = deps;
|
|
69563
69664
|
const get = async (frame) => {
|
|
69564
69665
|
const args = CapabilitiesGetArgs.parse(frame);
|
|
69565
|
-
const caps = await manager.getCapabilities(args.tool);
|
|
69666
|
+
const caps = await manager.getCapabilities(args.tool, args.refresh ? { refresh: true } : void 0);
|
|
69566
69667
|
return { response: { type: "capabilities:get", ...caps } };
|
|
69567
69668
|
};
|
|
69568
69669
|
return {
|
|
@@ -69570,6 +69671,241 @@ function buildCapabilitiesHandlers(deps) {
|
|
|
69570
69671
|
};
|
|
69571
69672
|
}
|
|
69572
69673
|
|
|
69674
|
+
// src/handlers/engine.ts
|
|
69675
|
+
init_protocol();
|
|
69676
|
+
|
|
69677
|
+
// src/tools/version-probe.ts
|
|
69678
|
+
var import_node_child_process19 = require("child_process");
|
|
69679
|
+
init_claude();
|
|
69680
|
+
init_protocol();
|
|
69681
|
+
|
|
69682
|
+
// src/tools/shell-path.ts
|
|
69683
|
+
var import_node_child_process18 = require("child_process");
|
|
69684
|
+
var import_node_os22 = __toESM(require("os"), 1);
|
|
69685
|
+
function refreshPathFromLoginShell() {
|
|
69686
|
+
if (process.platform === "win32") return;
|
|
69687
|
+
const shell = process.env.SHELL ?? import_node_os22.default.userInfo().shell ?? "/bin/zsh";
|
|
69688
|
+
try {
|
|
69689
|
+
const out = (0, import_node_child_process18.execFileSync)(shell, ["-ilc", 'command echo -n "$PATH"'], {
|
|
69690
|
+
encoding: "utf8",
|
|
69691
|
+
timeout: 3e3,
|
|
69692
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
69693
|
+
});
|
|
69694
|
+
const path102 = out.trim();
|
|
69695
|
+
if (path102) process.env.PATH = path102;
|
|
69696
|
+
} catch {
|
|
69697
|
+
}
|
|
69698
|
+
}
|
|
69699
|
+
|
|
69700
|
+
// src/tools/version-probe.ts
|
|
69701
|
+
function parseVersionOutput(out) {
|
|
69702
|
+
return /(\d+\.\d+\.\d+)/.exec(out)?.[1];
|
|
69703
|
+
}
|
|
69704
|
+
function execVersion(bin) {
|
|
69705
|
+
return new Promise((resolve9, reject) => {
|
|
69706
|
+
(0, import_node_child_process19.execFile)(bin, ["--version"], { timeout: 5e3 }, (err, stdout) => {
|
|
69707
|
+
if (err) reject(err);
|
|
69708
|
+
else resolve9(String(stdout));
|
|
69709
|
+
});
|
|
69710
|
+
});
|
|
69711
|
+
}
|
|
69712
|
+
var cache = null;
|
|
69713
|
+
async function probeToolVersions(opts = {}) {
|
|
69714
|
+
if (cache) return cache;
|
|
69715
|
+
const refreshPath = opts.refreshPath ?? refreshPathFromLoginShell;
|
|
69716
|
+
refreshPath();
|
|
69717
|
+
const probes = opts.probes ?? { claude: () => probeClaude(), codex: () => probeCodex(), pi: () => probePi() };
|
|
69718
|
+
const runVersion = opts.runVersion ?? execVersion;
|
|
69719
|
+
const out = [];
|
|
69720
|
+
for (const id of PROBE_TOOL_IDS) {
|
|
69721
|
+
const p3 = await probes[id]();
|
|
69722
|
+
if (!p3.available) {
|
|
69723
|
+
out.push({ id, available: false });
|
|
69724
|
+
continue;
|
|
69725
|
+
}
|
|
69726
|
+
let version2;
|
|
69727
|
+
try {
|
|
69728
|
+
version2 = parseVersionOutput(await runVersion(p3.path ?? id));
|
|
69729
|
+
} catch {
|
|
69730
|
+
version2 = void 0;
|
|
69731
|
+
}
|
|
69732
|
+
out.push({ id, available: true, ...version2 ? { version: version2 } : {}, ...p3.path ? { path: p3.path } : {} });
|
|
69733
|
+
}
|
|
69734
|
+
if (out.some((t2) => t2.available)) cache = out;
|
|
69735
|
+
return out;
|
|
69736
|
+
}
|
|
69737
|
+
|
|
69738
|
+
// src/tools/claude-auth-status.ts
|
|
69739
|
+
var import_node_child_process20 = require("child_process");
|
|
69740
|
+
var str5 = (v3) => typeof v3 === "string" && v3 ? v3 : void 0;
|
|
69741
|
+
function mapClaudeAuthStatus(raw) {
|
|
69742
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
69743
|
+
throw new Error("claude auth status: output is not a JSON object");
|
|
69744
|
+
}
|
|
69745
|
+
const r2 = raw;
|
|
69746
|
+
const pick = (key) => {
|
|
69747
|
+
const v3 = str5(r2[key]);
|
|
69748
|
+
return v3 ? { [key]: v3 } : {};
|
|
69749
|
+
};
|
|
69750
|
+
return {
|
|
69751
|
+
kind: "claude",
|
|
69752
|
+
loggedIn: r2.loggedIn === true,
|
|
69753
|
+
...pick("authMethod"),
|
|
69754
|
+
...pick("apiProvider"),
|
|
69755
|
+
...pick("apiKeySource"),
|
|
69756
|
+
...pick("email"),
|
|
69757
|
+
...pick("orgName"),
|
|
69758
|
+
...pick("subscriptionType")
|
|
69759
|
+
};
|
|
69760
|
+
}
|
|
69761
|
+
async function queryClaudeAuthStatus(deps = {}) {
|
|
69762
|
+
const run = deps.execFileImpl ?? import_node_child_process20.execFile;
|
|
69763
|
+
const env = deps.env ?? process.env;
|
|
69764
|
+
const bin = env.CLAUDE_BIN ?? "claude";
|
|
69765
|
+
const stdout = await new Promise((resolve9, reject) => {
|
|
69766
|
+
run(bin, ["auth", "status", "--json"], { timeout: 5e3, env }, (err, out) => {
|
|
69767
|
+
if (err) reject(err);
|
|
69768
|
+
else resolve9(String(out));
|
|
69769
|
+
});
|
|
69770
|
+
});
|
|
69771
|
+
let parsed;
|
|
69772
|
+
try {
|
|
69773
|
+
parsed = JSON.parse(stdout);
|
|
69774
|
+
} catch {
|
|
69775
|
+
throw new Error(`claude auth status: output is not JSON: ${stdout.slice(0, 120)}`);
|
|
69776
|
+
}
|
|
69777
|
+
return mapClaudeAuthStatus(parsed);
|
|
69778
|
+
}
|
|
69779
|
+
|
|
69780
|
+
// src/tools/codex-account.ts
|
|
69781
|
+
var rec5 = (v3) => v3 && typeof v3 === "object" && !Array.isArray(v3) ? v3 : void 0;
|
|
69782
|
+
var num4 = (v3) => typeof v3 === "number" && Number.isFinite(v3) ? v3 : void 0;
|
|
69783
|
+
var str6 = (v3) => typeof v3 === "string" && v3 ? v3 : void 0;
|
|
69784
|
+
function mapWindow(raw) {
|
|
69785
|
+
const w3 = rec5(raw);
|
|
69786
|
+
const usedPercent = num4(w3?.usedPercent);
|
|
69787
|
+
if (usedPercent === void 0) return void 0;
|
|
69788
|
+
const windowDurationMins = num4(w3?.windowDurationMins);
|
|
69789
|
+
const resetsAt = num4(w3?.resetsAt);
|
|
69790
|
+
return {
|
|
69791
|
+
usedPercent,
|
|
69792
|
+
...windowDurationMins !== void 0 ? { windowDurationMins } : {},
|
|
69793
|
+
...resetsAt !== void 0 ? { resetsAt } : {}
|
|
69794
|
+
};
|
|
69795
|
+
}
|
|
69796
|
+
function mapCodexAccount(raw) {
|
|
69797
|
+
const account = rec5(rec5(raw.account)?.account);
|
|
69798
|
+
const login = account?.type === "chatgpt" ? { type: "chatgpt", email: str6(account.email) ?? "", planType: str6(account.planType) ?? "unknown" } : account?.type === "apiKey" ? { type: "apiKey" } : { type: "none" };
|
|
69799
|
+
const config = rec5(rec5(raw.config)?.config);
|
|
69800
|
+
const name = str6(config?.model_provider) ?? "openai";
|
|
69801
|
+
const baseUrl = str6(rec5(rec5(config?.model_providers)?.[name])?.base_url);
|
|
69802
|
+
const limits = rec5(rec5(raw.rateLimits)?.rateLimits);
|
|
69803
|
+
const primary = mapWindow(limits?.primary);
|
|
69804
|
+
const secondary = mapWindow(limits?.secondary);
|
|
69805
|
+
const rateLimits = primary || secondary ? { ...primary ? { primary } : {}, ...secondary ? { secondary } : {} } : void 0;
|
|
69806
|
+
return {
|
|
69807
|
+
kind: "codex",
|
|
69808
|
+
login,
|
|
69809
|
+
provider: { name, ...baseUrl ? { baseUrl } : {} },
|
|
69810
|
+
...rateLimits ? { rateLimits } : {}
|
|
69811
|
+
};
|
|
69812
|
+
}
|
|
69813
|
+
async function queryCodexAccount(deps = {}) {
|
|
69814
|
+
const run = async (request) => {
|
|
69815
|
+
const account = await request("account/read");
|
|
69816
|
+
const config = await request("config/read");
|
|
69817
|
+
let rateLimits;
|
|
69818
|
+
if (rec5(rec5(account)?.account)?.type === "chatgpt") {
|
|
69819
|
+
try {
|
|
69820
|
+
rateLimits = await request("account/rateLimits/read");
|
|
69821
|
+
} catch (err) {
|
|
69822
|
+
deps.logger?.warn?.(`codex account/rateLimits/read failed: ${err.message}`);
|
|
69823
|
+
}
|
|
69824
|
+
}
|
|
69825
|
+
return mapCodexAccount({ account, config, rateLimits });
|
|
69826
|
+
};
|
|
69827
|
+
if (deps.queryOverride) return run(deps.queryOverride);
|
|
69828
|
+
return withCodexAppServerClient(process.cwd(), "account", (client) => run((m3) => client.request(m3, {})));
|
|
69829
|
+
}
|
|
69830
|
+
|
|
69831
|
+
// src/tools/pi-account.ts
|
|
69832
|
+
var import_node_fs59 = __toESM(require("fs"), 1);
|
|
69833
|
+
var import_node_path66 = __toESM(require("path"), 1);
|
|
69834
|
+
function readPiCredentials(agentDir) {
|
|
69835
|
+
let raw;
|
|
69836
|
+
try {
|
|
69837
|
+
raw = JSON.parse(import_node_fs59.default.readFileSync(import_node_path66.default.join(agentDir, "auth.json"), "utf8"));
|
|
69838
|
+
} catch {
|
|
69839
|
+
return {};
|
|
69840
|
+
}
|
|
69841
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
69842
|
+
const out = {};
|
|
69843
|
+
for (const [id, entry] of Object.entries(raw)) {
|
|
69844
|
+
const e = entry && typeof entry === "object" ? entry : void 0;
|
|
69845
|
+
if (e?.type === "api_key") out[id] = { type: "api_key" };
|
|
69846
|
+
else if (e?.type === "oauth") {
|
|
69847
|
+
out[id] = { type: "oauth", ...typeof e.expires === "number" ? { expires: e.expires } : {} };
|
|
69848
|
+
}
|
|
69849
|
+
}
|
|
69850
|
+
return out;
|
|
69851
|
+
}
|
|
69852
|
+
function buildPiAccount(models, creds) {
|
|
69853
|
+
const counts = /* @__PURE__ */ new Map();
|
|
69854
|
+
for (const m3 of models) {
|
|
69855
|
+
const slash = m3.id.indexOf("/");
|
|
69856
|
+
if (slash <= 0) continue;
|
|
69857
|
+
const provider = m3.id.slice(0, slash);
|
|
69858
|
+
counts.set(provider, (counts.get(provider) ?? 0) + 1);
|
|
69859
|
+
}
|
|
69860
|
+
return {
|
|
69861
|
+
kind: "pi",
|
|
69862
|
+
providers: [...counts].map(([id, modelCount]) => {
|
|
69863
|
+
const c2 = creds[id];
|
|
69864
|
+
return {
|
|
69865
|
+
id,
|
|
69866
|
+
modelCount,
|
|
69867
|
+
...c2 ? { credential: c2.type } : {},
|
|
69868
|
+
...c2?.type === "oauth" && c2.expires !== void 0 ? { oauthExpiresAt: Math.floor(c2.expires / 1e3) } : {}
|
|
69869
|
+
};
|
|
69870
|
+
})
|
|
69871
|
+
};
|
|
69872
|
+
}
|
|
69873
|
+
|
|
69874
|
+
// src/handlers/engine.ts
|
|
69875
|
+
function buildEngineHandlers(deps, overrides = {}) {
|
|
69876
|
+
const probes = {
|
|
69877
|
+
claude: () => queryClaudeAuthStatus(),
|
|
69878
|
+
codex: () => queryCodexAccount({ logger: deps.logger }),
|
|
69879
|
+
// pi 不重新 spawn:provider 从已查好的模型表归组(capabilities 内部 memo,没查过就查这一次)
|
|
69880
|
+
pi: async () => buildPiAccount((await deps.manager.getCapabilities("pi")).models, readPiCredentials(piAgentDir())),
|
|
69881
|
+
...overrides.probes
|
|
69882
|
+
};
|
|
69883
|
+
const probeTools = overrides.probeTools ?? probeToolVersions;
|
|
69884
|
+
const status = async (frame) => {
|
|
69885
|
+
const { tool } = parseArgs2(EngineStatusArgs, frame, "engine:status");
|
|
69886
|
+
const probed = (await probeTools()).find((t2) => t2.id === tool);
|
|
69887
|
+
const base = {
|
|
69888
|
+
tool,
|
|
69889
|
+
installed: probed?.available === true,
|
|
69890
|
+
...probed?.version ? { version: probed.version } : {},
|
|
69891
|
+
...probed?.path ? { path: probed.path } : {}
|
|
69892
|
+
};
|
|
69893
|
+
if (!base.installed) return { response: base };
|
|
69894
|
+
const withLoadedAt = () => {
|
|
69895
|
+
const modelsLoadedAt = deps.manager.capabilitiesLoadedAt(tool);
|
|
69896
|
+
return modelsLoadedAt !== void 0 ? { ...base, modelsLoadedAt } : base;
|
|
69897
|
+
};
|
|
69898
|
+
try {
|
|
69899
|
+
const account = await probes[tool]();
|
|
69900
|
+
return { response: { ...withLoadedAt(), account } };
|
|
69901
|
+
} catch (err) {
|
|
69902
|
+
deps.logger?.warn?.(`engine:status ${tool} account probe failed: ${err.message}`);
|
|
69903
|
+
return { response: { ...withLoadedAt(), error: err.message } };
|
|
69904
|
+
}
|
|
69905
|
+
};
|
|
69906
|
+
return { "engine:status": status };
|
|
69907
|
+
}
|
|
69908
|
+
|
|
69573
69909
|
// src/handlers/inbox.ts
|
|
69574
69910
|
init_protocol();
|
|
69575
69911
|
function resolvePeerDeviceId(ctx, argsPeerDeviceId) {
|
|
@@ -70145,7 +70481,7 @@ function buildCloudConnectorsHandlers(deps) {
|
|
|
70145
70481
|
}
|
|
70146
70482
|
|
|
70147
70483
|
// src/handlers/meta.ts
|
|
70148
|
-
var
|
|
70484
|
+
var import_node_os23 = __toESM(require("os"), 1);
|
|
70149
70485
|
init_protocol();
|
|
70150
70486
|
|
|
70151
70487
|
// src/handlers/method-grants.ts
|
|
@@ -70333,6 +70669,8 @@ var METHOD_GRANT_MAP = {
|
|
|
70333
70669
|
"git:branch": CAPABILITY_SCOPED,
|
|
70334
70670
|
"git:branches": CAPABILITY_SCOPED,
|
|
70335
70671
|
"capabilities:get": ADMIN_ANY,
|
|
70672
|
+
// engine:status(设置 → 账号「引擎」,spec 2026-09-17-engine-status):回账号邮箱 / 订阅档,与 githubAuth:get 同档,guest 够不着
|
|
70673
|
+
"engine:status": ADMIN_ANY,
|
|
70336
70674
|
"persona:create": ADMIN_ANY,
|
|
70337
70675
|
// persona:list / persona:get 下沉到 CAPABILITY_SCOPED:guest 调用合法
|
|
70338
70676
|
// (list 用于 People 面板展开对方分享的 personas;get 用于 guest 视角下
|
|
@@ -70447,21 +70785,21 @@ function computeMethodAccess(args) {
|
|
|
70447
70785
|
}
|
|
70448
70786
|
|
|
70449
70787
|
// src/version.ts
|
|
70450
|
-
var version = "0.2.
|
|
70788
|
+
var version = "0.2.537".length > 0 ? "0.2.537" : "dev";
|
|
70451
70789
|
|
|
70452
70790
|
// src/cli-probe/probe.ts
|
|
70453
|
-
var
|
|
70454
|
-
var
|
|
70791
|
+
var fs78 = __toESM(require("fs"), 1);
|
|
70792
|
+
var path85 = __toESM(require("path"), 1);
|
|
70455
70793
|
var PKG_NAME = "@clawos-dev/clawd";
|
|
70456
70794
|
var BIN_NAME = "clawd";
|
|
70457
70795
|
var MAX_PARENT_HOPS = 5;
|
|
70458
70796
|
function probeGlobalCli(pathEnv) {
|
|
70459
70797
|
if (!pathEnv) return null;
|
|
70460
|
-
for (const dir of pathEnv.split(
|
|
70798
|
+
for (const dir of pathEnv.split(path85.delimiter)) {
|
|
70461
70799
|
if (!dir) continue;
|
|
70462
70800
|
let real;
|
|
70463
70801
|
try {
|
|
70464
|
-
real =
|
|
70802
|
+
real = fs78.realpathSync(path85.join(dir, BIN_NAME));
|
|
70465
70803
|
} catch {
|
|
70466
70804
|
continue;
|
|
70467
70805
|
}
|
|
@@ -70471,15 +70809,15 @@ function probeGlobalCli(pathEnv) {
|
|
|
70471
70809
|
return null;
|
|
70472
70810
|
}
|
|
70473
70811
|
function readOwnPackageVersion(entryPath) {
|
|
70474
|
-
let dir =
|
|
70812
|
+
let dir = path85.dirname(entryPath);
|
|
70475
70813
|
for (let i2 = 0; i2 < MAX_PARENT_HOPS; i2++) {
|
|
70476
70814
|
try {
|
|
70477
|
-
const raw =
|
|
70815
|
+
const raw = fs78.readFileSync(path85.join(dir, "package.json"), "utf8");
|
|
70478
70816
|
const pkg = JSON.parse(raw);
|
|
70479
70817
|
if (pkg.name !== PKG_NAME) return null;
|
|
70480
70818
|
return typeof pkg.version === "string" && pkg.version ? pkg.version : null;
|
|
70481
70819
|
} catch {
|
|
70482
|
-
const parent =
|
|
70820
|
+
const parent = path85.dirname(dir);
|
|
70483
70821
|
if (parent === dir) return null;
|
|
70484
70822
|
dir = parent;
|
|
70485
70823
|
}
|
|
@@ -70515,7 +70853,7 @@ function buildReadyFrame(deps, client) {
|
|
|
70515
70853
|
return {
|
|
70516
70854
|
version,
|
|
70517
70855
|
protocolVersion: PROTOCOL_VERSION,
|
|
70518
|
-
hostname:
|
|
70856
|
+
hostname: import_node_os23.default.hostname(),
|
|
70519
70857
|
os: process.platform,
|
|
70520
70858
|
tools,
|
|
70521
70859
|
runningSessions: info.runningSessions,
|
|
@@ -70655,7 +70993,7 @@ function buildPersonaHandlers(deps) {
|
|
|
70655
70993
|
}
|
|
70656
70994
|
|
|
70657
70995
|
// src/handlers/attachment.ts
|
|
70658
|
-
var
|
|
70996
|
+
var import_node_path67 = __toESM(require("path"), 1);
|
|
70659
70997
|
init_protocol();
|
|
70660
70998
|
init_protocol();
|
|
70661
70999
|
function assertGuestAttachmentPath(ctx, absPath, personaRoot, method, usersRoot) {
|
|
@@ -70734,12 +71072,12 @@ function buildAttachmentHandlers(deps) {
|
|
|
70734
71072
|
`session ${args.sessionId} scope unresolved`
|
|
70735
71073
|
);
|
|
70736
71074
|
}
|
|
70737
|
-
const cwdAbs =
|
|
70738
|
-
const candidateAbs =
|
|
71075
|
+
const cwdAbs = import_node_path67.default.resolve(sessionFile.cwd);
|
|
71076
|
+
const candidateAbs = import_node_path67.default.isAbsolute(args.relPath) ? import_node_path67.default.resolve(args.relPath) : import_node_path67.default.resolve(cwdAbs, args.relPath);
|
|
70739
71077
|
guardAttachmentPath(ctx, args.sessionId, candidateAbs, "attachment.signUrl", "group-acl");
|
|
70740
71078
|
const entries = deps.groupFileStore.list(scope, args.sessionId);
|
|
70741
71079
|
const entry = entries.find((e) => {
|
|
70742
|
-
const storedAbs =
|
|
71080
|
+
const storedAbs = import_node_path67.default.isAbsolute(e.relPath) ? import_node_path67.default.resolve(e.relPath) : import_node_path67.default.resolve(cwdAbs, e.relPath);
|
|
70743
71081
|
return storedAbs === candidateAbs && !e.stale;
|
|
70744
71082
|
});
|
|
70745
71083
|
if (!entry) {
|
|
@@ -70763,7 +71101,7 @@ function buildAttachmentHandlers(deps) {
|
|
|
70763
71101
|
if (!ctx || ctx.principal.kind !== "guest" || !deps.personaRoot || !deps.sessionStore) return;
|
|
70764
71102
|
const f2 = deps.sessionStore.read(sessionId);
|
|
70765
71103
|
if (!f2) return;
|
|
70766
|
-
assertGuestAttachmentPath(ctx,
|
|
71104
|
+
assertGuestAttachmentPath(ctx, import_node_path67.default.resolve(f2.cwd), deps.personaRoot, method, deps.usersRoot);
|
|
70767
71105
|
}
|
|
70768
71106
|
const groupAdd = async (frame, _client, ctx) => {
|
|
70769
71107
|
if (!deps.groupFileStore || !deps.getSessionScope) {
|
|
@@ -70778,8 +71116,8 @@ function buildAttachmentHandlers(deps) {
|
|
|
70778
71116
|
if (!scope) {
|
|
70779
71117
|
throw new ClawdError(ERROR_CODES.VALIDATION_ERROR, `session ${args.sessionId} not found`);
|
|
70780
71118
|
}
|
|
70781
|
-
const cwdAbs =
|
|
70782
|
-
const candidateAbs =
|
|
71119
|
+
const cwdAbs = import_node_path67.default.resolve(deps.sessionStore?.read(args.sessionId)?.cwd ?? ".");
|
|
71120
|
+
const candidateAbs = import_node_path67.default.isAbsolute(args.relPath) ? import_node_path67.default.resolve(args.relPath) : import_node_path67.default.resolve(cwdAbs, args.relPath);
|
|
70783
71121
|
guardAttachmentPath(ctx, args.sessionId, candidateAbs, "attachment.groupAdd", "cwd-subtree");
|
|
70784
71122
|
const from = args.origin === "agent" ? "agent" : ctx?.principal.kind === "owner" ? "owner" : "agent";
|
|
70785
71123
|
const size = 0;
|
|
@@ -70838,19 +71176,19 @@ function buildAttachmentHandlers(deps) {
|
|
|
70838
71176
|
|
|
70839
71177
|
// src/handlers/extension.ts
|
|
70840
71178
|
var import_promises14 = __toESM(require("fs/promises"), 1);
|
|
70841
|
-
var
|
|
71179
|
+
var import_node_path72 = __toESM(require("path"), 1);
|
|
70842
71180
|
init_protocol();
|
|
70843
71181
|
|
|
70844
71182
|
// src/extension/bundle-zip.ts
|
|
70845
71183
|
var import_promises11 = __toESM(require("fs/promises"), 1);
|
|
70846
|
-
var
|
|
71184
|
+
var import_node_path68 = __toESM(require("path"), 1);
|
|
70847
71185
|
var import_node_crypto18 = __toESM(require("crypto"), 1);
|
|
70848
71186
|
var import_jszip2 = __toESM(require_lib3(), 1);
|
|
70849
71187
|
async function bundleExtensionDir(dir) {
|
|
70850
71188
|
const entries = await listFilesSorted(dir);
|
|
70851
71189
|
const zip = new import_jszip2.default();
|
|
70852
71190
|
for (const rel of entries) {
|
|
70853
|
-
const abs =
|
|
71191
|
+
const abs = import_node_path68.default.join(dir, rel);
|
|
70854
71192
|
const content = await import_promises11.default.readFile(abs);
|
|
70855
71193
|
zip.file(rel, content, { date: FIXED_DATE });
|
|
70856
71194
|
}
|
|
@@ -70871,7 +71209,7 @@ async function listFilesSorted(rootDir) {
|
|
|
70871
71209
|
return out;
|
|
70872
71210
|
}
|
|
70873
71211
|
async function walk(absRoot, relPrefix, out) {
|
|
70874
|
-
const dirAbs =
|
|
71212
|
+
const dirAbs = import_node_path68.default.join(absRoot, relPrefix);
|
|
70875
71213
|
const entries = await import_promises11.default.readdir(dirAbs, { withFileTypes: true });
|
|
70876
71214
|
for (const e of entries) {
|
|
70877
71215
|
if (IGNORE_BASENAMES.has(e.name)) continue;
|
|
@@ -70925,25 +71263,25 @@ function computePublishCheck(args) {
|
|
|
70925
71263
|
|
|
70926
71264
|
// src/extension/install-flow.ts
|
|
70927
71265
|
var import_promises12 = __toESM(require("fs/promises"), 1);
|
|
70928
|
-
var
|
|
70929
|
-
var
|
|
71266
|
+
var import_node_path70 = __toESM(require("path"), 1);
|
|
71267
|
+
var import_node_os25 = __toESM(require("os"), 1);
|
|
70930
71268
|
var import_node_crypto19 = __toESM(require("crypto"), 1);
|
|
70931
71269
|
var import_jszip3 = __toESM(require_lib3(), 1);
|
|
70932
71270
|
|
|
70933
71271
|
// src/extension/paths.ts
|
|
70934
|
-
var
|
|
70935
|
-
var
|
|
71272
|
+
var import_node_os24 = __toESM(require("os"), 1);
|
|
71273
|
+
var import_node_path69 = __toESM(require("path"), 1);
|
|
70936
71274
|
function clawdHomeRoot(override) {
|
|
70937
|
-
return override ?? process.env.CLAWD_HOME ??
|
|
71275
|
+
return override ?? process.env.CLAWD_HOME ?? import_node_path69.default.join(import_node_os24.default.homedir(), ".clawd");
|
|
70938
71276
|
}
|
|
70939
71277
|
function extensionsRoot(override) {
|
|
70940
|
-
return
|
|
71278
|
+
return import_node_path69.default.join(clawdHomeRoot(override), "extensions");
|
|
70941
71279
|
}
|
|
70942
71280
|
function publishedChannelsFile(override) {
|
|
70943
|
-
return
|
|
71281
|
+
return import_node_path69.default.join(clawdHomeRoot(override), "extensions-published.json");
|
|
70944
71282
|
}
|
|
70945
71283
|
function bundleCacheRoot(override) {
|
|
70946
|
-
return
|
|
71284
|
+
return import_node_path69.default.join(clawdHomeRoot(override), "extension-bundles");
|
|
70947
71285
|
}
|
|
70948
71286
|
|
|
70949
71287
|
// src/extension/install-flow.ts
|
|
@@ -70970,7 +71308,7 @@ async function installFromChannel(args, deps) {
|
|
|
70970
71308
|
throw new InstallError("ZIP_INVALID", `failed to load zip: ${e.message}`);
|
|
70971
71309
|
}
|
|
70972
71310
|
for (const name of Object.keys(zip.files)) {
|
|
70973
|
-
if (name.includes("..") || name.startsWith("/") ||
|
|
71311
|
+
if (name.includes("..") || name.startsWith("/") || import_node_path70.default.isAbsolute(name)) {
|
|
70974
71312
|
throw new InstallError("ZIP_INVALID", `unsafe zip entry: ${name}`);
|
|
70975
71313
|
}
|
|
70976
71314
|
}
|
|
@@ -71002,7 +71340,7 @@ async function installFromChannel(args, deps) {
|
|
|
71002
71340
|
);
|
|
71003
71341
|
}
|
|
71004
71342
|
const localExtId = namespacedExtId(ownerSlug, channelRef.ownerPrincipalId);
|
|
71005
|
-
const destDir =
|
|
71343
|
+
const destDir = import_node_path70.default.join(deps.extensionsRoot, localExtId);
|
|
71006
71344
|
let destExists = false;
|
|
71007
71345
|
try {
|
|
71008
71346
|
await import_promises12.default.access(destDir);
|
|
@@ -71016,16 +71354,16 @@ async function installFromChannel(args, deps) {
|
|
|
71016
71354
|
);
|
|
71017
71355
|
}
|
|
71018
71356
|
const stage = await import_promises12.default.mkdtemp(
|
|
71019
|
-
|
|
71357
|
+
import_node_path70.default.join(import_node_os25.default.tmpdir(), `clawd-ext-install-${localExtId}-`)
|
|
71020
71358
|
);
|
|
71021
71359
|
try {
|
|
71022
71360
|
for (const [name, entry] of Object.entries(zip.files)) {
|
|
71023
|
-
const dest =
|
|
71361
|
+
const dest = import_node_path70.default.join(stage, name);
|
|
71024
71362
|
if (entry.dir) {
|
|
71025
71363
|
await import_promises12.default.mkdir(dest, { recursive: true });
|
|
71026
71364
|
continue;
|
|
71027
71365
|
}
|
|
71028
|
-
await import_promises12.default.mkdir(
|
|
71366
|
+
await import_promises12.default.mkdir(import_node_path70.default.dirname(dest), { recursive: true });
|
|
71029
71367
|
if (name === "manifest.json") {
|
|
71030
71368
|
const rewritten = { ...parsed.data, id: localExtId };
|
|
71031
71369
|
await import_promises12.default.writeFile(dest, JSON.stringify(rewritten, null, 2));
|
|
@@ -71046,8 +71384,8 @@ async function installFromChannel(args, deps) {
|
|
|
71046
71384
|
|
|
71047
71385
|
// src/extension/update-flow.ts
|
|
71048
71386
|
var import_promises13 = __toESM(require("fs/promises"), 1);
|
|
71049
|
-
var
|
|
71050
|
-
var
|
|
71387
|
+
var import_node_path71 = __toESM(require("path"), 1);
|
|
71388
|
+
var import_node_os26 = __toESM(require("os"), 1);
|
|
71051
71389
|
var import_node_crypto20 = __toESM(require("crypto"), 1);
|
|
71052
71390
|
var import_jszip4 = __toESM(require_lib3(), 1);
|
|
71053
71391
|
var UpdateError = class extends Error {
|
|
@@ -71063,11 +71401,11 @@ async function updateFromChannel(args, deps) {
|
|
|
71063
71401
|
channelRef.extId,
|
|
71064
71402
|
channelRef.ownerPrincipalId
|
|
71065
71403
|
);
|
|
71066
|
-
const liveDir =
|
|
71404
|
+
const liveDir = import_node_path71.default.join(deps.extensionsRoot, localExtId);
|
|
71067
71405
|
const prevDir = `${liveDir}.prev`;
|
|
71068
71406
|
let existingVersion;
|
|
71069
71407
|
try {
|
|
71070
|
-
const raw = await import_promises13.default.readFile(
|
|
71408
|
+
const raw = await import_promises13.default.readFile(import_node_path71.default.join(liveDir, "manifest.json"), "utf8");
|
|
71071
71409
|
const parsed2 = ExtensionManifestSchema.safeParse(JSON.parse(raw));
|
|
71072
71410
|
if (!parsed2.success) {
|
|
71073
71411
|
throw new UpdateError(
|
|
@@ -71100,7 +71438,7 @@ async function updateFromChannel(args, deps) {
|
|
|
71100
71438
|
throw new UpdateError("ZIP_INVALID", `failed to load zip: ${e.message}`);
|
|
71101
71439
|
}
|
|
71102
71440
|
for (const name of Object.keys(zip.files)) {
|
|
71103
|
-
if (name.includes("..") || name.startsWith("/") ||
|
|
71441
|
+
if (name.includes("..") || name.startsWith("/") || import_node_path71.default.isAbsolute(name)) {
|
|
71104
71442
|
throw new UpdateError("ZIP_INVALID", `unsafe zip entry: ${name}`);
|
|
71105
71443
|
}
|
|
71106
71444
|
}
|
|
@@ -71135,16 +71473,16 @@ async function updateFromChannel(args, deps) {
|
|
|
71135
71473
|
await import_promises13.default.rm(prevDir, { recursive: true, force: true });
|
|
71136
71474
|
await import_promises13.default.rename(liveDir, prevDir);
|
|
71137
71475
|
const stage = await import_promises13.default.mkdtemp(
|
|
71138
|
-
|
|
71476
|
+
import_node_path71.default.join(import_node_os26.default.tmpdir(), `clawd-ext-update-${localExtId}-`)
|
|
71139
71477
|
);
|
|
71140
71478
|
try {
|
|
71141
71479
|
for (const [name, entry] of Object.entries(zip.files)) {
|
|
71142
|
-
const dest =
|
|
71480
|
+
const dest = import_node_path71.default.join(stage, name);
|
|
71143
71481
|
if (entry.dir) {
|
|
71144
71482
|
await import_promises13.default.mkdir(dest, { recursive: true });
|
|
71145
71483
|
continue;
|
|
71146
71484
|
}
|
|
71147
|
-
await import_promises13.default.mkdir(
|
|
71485
|
+
await import_promises13.default.mkdir(import_node_path71.default.dirname(dest), { recursive: true });
|
|
71148
71486
|
if (name === "manifest.json") {
|
|
71149
71487
|
const rewritten = { ...parsed.data, id: localExtId };
|
|
71150
71488
|
await import_promises13.default.writeFile(dest, JSON.stringify(rewritten, null, 2));
|
|
@@ -71211,7 +71549,7 @@ async function rewriteManifestVersion(root, extId, newVersion, previousPublished
|
|
|
71211
71549
|
);
|
|
71212
71550
|
}
|
|
71213
71551
|
}
|
|
71214
|
-
const manifestPath =
|
|
71552
|
+
const manifestPath = import_node_path72.default.join(root, extId, "manifest.json");
|
|
71215
71553
|
const manifest = await readManifest(root, extId);
|
|
71216
71554
|
const next = { ...manifest, version: newVersion };
|
|
71217
71555
|
const tmp = `${manifestPath}.tmp`;
|
|
@@ -71219,7 +71557,7 @@ async function rewriteManifestVersion(root, extId, newVersion, previousPublished
|
|
|
71219
71557
|
await import_promises14.default.rename(tmp, manifestPath);
|
|
71220
71558
|
}
|
|
71221
71559
|
async function readManifest(root, extId) {
|
|
71222
|
-
const file =
|
|
71560
|
+
const file = import_node_path72.default.join(root, extId, "manifest.json");
|
|
71223
71561
|
let raw;
|
|
71224
71562
|
try {
|
|
71225
71563
|
raw = await import_promises14.default.readFile(file, "utf8");
|
|
@@ -71252,22 +71590,22 @@ function assertOwner(ctx) {
|
|
|
71252
71590
|
throw new ClawdError(ERROR_CODES.FORBIDDEN, "owner only");
|
|
71253
71591
|
}
|
|
71254
71592
|
}
|
|
71255
|
-
function composeState(
|
|
71256
|
-
if (
|
|
71257
|
-
if (manifestMode(
|
|
71593
|
+
function composeState(rec6, running, crashed, getPort) {
|
|
71594
|
+
if (rec6.state === "invalid") return rec6;
|
|
71595
|
+
if (manifestMode(rec6.manifest) === "hosted") {
|
|
71258
71596
|
return {
|
|
71259
|
-
...
|
|
71597
|
+
...rec6,
|
|
71260
71598
|
state: "running",
|
|
71261
|
-
target: { kind: "hosted", url:
|
|
71599
|
+
target: { kind: "hosted", url: rec6.manifest.entry.url }
|
|
71262
71600
|
};
|
|
71263
71601
|
}
|
|
71264
|
-
if (running.has(
|
|
71265
|
-
const port = getPort(
|
|
71266
|
-
if (port == null) return
|
|
71267
|
-
return { ...
|
|
71602
|
+
if (running.has(rec6.extId)) {
|
|
71603
|
+
const port = getPort(rec6.extId);
|
|
71604
|
+
if (port == null) return rec6;
|
|
71605
|
+
return { ...rec6, state: "running", target: { kind: "local", port } };
|
|
71268
71606
|
}
|
|
71269
|
-
if (crashed.has(
|
|
71270
|
-
return
|
|
71607
|
+
if (crashed.has(rec6.extId)) return { ...rec6, state: "crashed" };
|
|
71608
|
+
return rec6;
|
|
71271
71609
|
}
|
|
71272
71610
|
function buildExtensionHandlers(deps) {
|
|
71273
71611
|
const list = async (_frame, _client, ctx) => {
|
|
@@ -71303,7 +71641,7 @@ function buildExtensionHandlers(deps) {
|
|
|
71303
71641
|
};
|
|
71304
71642
|
async function buildSnapshotMeta(extId) {
|
|
71305
71643
|
const manifest = await readManifest(deps.root, extId);
|
|
71306
|
-
const { sha256, buffer } = await bundleExtensionDir(
|
|
71644
|
+
const { sha256, buffer } = await bundleExtensionDir(import_node_path72.default.join(deps.root, extId));
|
|
71307
71645
|
return { manifest, contentHash: sha256, buffer };
|
|
71308
71646
|
}
|
|
71309
71647
|
const publish = async (frame, _client, ctx) => {
|
|
@@ -72131,7 +72469,7 @@ function buildVisitorHandlers(deps) {
|
|
|
72131
72469
|
|
|
72132
72470
|
// src/extension/registry.ts
|
|
72133
72471
|
var import_promises16 = __toESM(require("fs/promises"), 1);
|
|
72134
|
-
var
|
|
72472
|
+
var import_node_path73 = __toESM(require("path"), 1);
|
|
72135
72473
|
async function loadAll(root) {
|
|
72136
72474
|
let entries;
|
|
72137
72475
|
try {
|
|
@@ -72144,13 +72482,13 @@ async function loadAll(root) {
|
|
|
72144
72482
|
for (const ent of entries) {
|
|
72145
72483
|
if (!ent.isDirectory()) continue;
|
|
72146
72484
|
if (ent.name.startsWith(".")) continue;
|
|
72147
|
-
records.push(await loadOne(
|
|
72485
|
+
records.push(await loadOne(import_node_path73.default.join(root, ent.name), ent.name));
|
|
72148
72486
|
}
|
|
72149
72487
|
records.sort((a2, b3) => a2.extId < b3.extId ? -1 : a2.extId > b3.extId ? 1 : 0);
|
|
72150
72488
|
return records;
|
|
72151
72489
|
}
|
|
72152
72490
|
async function loadOne(dir, dirName) {
|
|
72153
|
-
const manifestPath =
|
|
72491
|
+
const manifestPath = import_node_path73.default.join(dir, "manifest.json");
|
|
72154
72492
|
let raw;
|
|
72155
72493
|
try {
|
|
72156
72494
|
raw = await import_promises16.default.readFile(manifestPath, "utf8");
|
|
@@ -72195,7 +72533,7 @@ async function loadOne(dir, dirName) {
|
|
|
72195
72533
|
|
|
72196
72534
|
// src/extension/uninstall.ts
|
|
72197
72535
|
var import_promises17 = __toESM(require("fs/promises"), 1);
|
|
72198
|
-
var
|
|
72536
|
+
var import_node_path74 = __toESM(require("path"), 1);
|
|
72199
72537
|
var UninstallError = class extends Error {
|
|
72200
72538
|
constructor(code, message) {
|
|
72201
72539
|
super(message);
|
|
@@ -72204,7 +72542,7 @@ var UninstallError = class extends Error {
|
|
|
72204
72542
|
code;
|
|
72205
72543
|
};
|
|
72206
72544
|
async function uninstall(deps) {
|
|
72207
|
-
const dir =
|
|
72545
|
+
const dir = import_node_path74.default.join(deps.root, deps.extId);
|
|
72208
72546
|
try {
|
|
72209
72547
|
await import_promises17.default.access(dir);
|
|
72210
72548
|
} catch {
|
|
@@ -72221,15 +72559,15 @@ var import_node_crypto21 = require("crypto");
|
|
|
72221
72559
|
init_protocol();
|
|
72222
72560
|
|
|
72223
72561
|
// src/peer-ops/run-command.ts
|
|
72224
|
-
var
|
|
72225
|
-
var
|
|
72562
|
+
var import_node_child_process21 = require("child_process");
|
|
72563
|
+
var import_node_os27 = __toESM(require("os"), 1);
|
|
72226
72564
|
var DEFAULT_TIMEOUT_MS6 = 3e4;
|
|
72227
72565
|
var MAX_TIMEOUT_MS = 3e5;
|
|
72228
72566
|
var MAX_OUTPUT_BYTES = 1048576;
|
|
72229
72567
|
function runCommand2(command, opts = {}) {
|
|
72230
72568
|
const timeoutMs = Math.min(opts.timeoutMs ?? DEFAULT_TIMEOUT_MS6, MAX_TIMEOUT_MS);
|
|
72231
72569
|
return new Promise((resolve9) => {
|
|
72232
|
-
const child = (0,
|
|
72570
|
+
const child = (0, import_node_child_process21.spawn)("bash", ["-c", command], { cwd: import_node_os27.default.homedir() });
|
|
72233
72571
|
const out = [];
|
|
72234
72572
|
const err = [];
|
|
72235
72573
|
let outBytes = 0;
|
|
@@ -72354,6 +72692,7 @@ function buildMethodHandlers(deps) {
|
|
|
72354
72692
|
...buildWorkspaceHandlers(deps),
|
|
72355
72693
|
...buildGitHandlers(deps),
|
|
72356
72694
|
...buildCapabilitiesHandlers(deps),
|
|
72695
|
+
...buildEngineHandlers({ manager: deps.manager, logger: deps.logger }),
|
|
72357
72696
|
...buildMetaHandlers(deps),
|
|
72358
72697
|
...buildPersonaHandlers({
|
|
72359
72698
|
personaManager: deps.personaManager,
|
|
@@ -72417,7 +72756,7 @@ function buildMethodHandlers(deps) {
|
|
|
72417
72756
|
broadcast: deps.broadcastToOwners
|
|
72418
72757
|
}),
|
|
72419
72758
|
...buildMasterHandlers({
|
|
72420
|
-
authorityTablePath:
|
|
72759
|
+
authorityTablePath: import_node_path75.default.join(deps.masterDataDir, "master-authority.json")
|
|
72421
72760
|
}),
|
|
72422
72761
|
...buildTopicHandlers({
|
|
72423
72762
|
topicStore: deps.topicStore,
|
|
@@ -72447,67 +72786,6 @@ function buildMethodHandlers(deps) {
|
|
|
72447
72786
|
// src/handlers/onboarding.ts
|
|
72448
72787
|
init_protocol();
|
|
72449
72788
|
|
|
72450
|
-
// src/tools/version-probe.ts
|
|
72451
|
-
var import_node_child_process20 = require("child_process");
|
|
72452
|
-
init_claude();
|
|
72453
|
-
init_protocol();
|
|
72454
|
-
|
|
72455
|
-
// src/tools/shell-path.ts
|
|
72456
|
-
var import_node_child_process19 = require("child_process");
|
|
72457
|
-
var import_node_os27 = __toESM(require("os"), 1);
|
|
72458
|
-
function refreshPathFromLoginShell() {
|
|
72459
|
-
if (process.platform === "win32") return;
|
|
72460
|
-
const shell = process.env.SHELL ?? import_node_os27.default.userInfo().shell ?? "/bin/zsh";
|
|
72461
|
-
try {
|
|
72462
|
-
const out = (0, import_node_child_process19.execFileSync)(shell, ["-ilc", 'command echo -n "$PATH"'], {
|
|
72463
|
-
encoding: "utf8",
|
|
72464
|
-
timeout: 3e3,
|
|
72465
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
72466
|
-
});
|
|
72467
|
-
const path101 = out.trim();
|
|
72468
|
-
if (path101) process.env.PATH = path101;
|
|
72469
|
-
} catch {
|
|
72470
|
-
}
|
|
72471
|
-
}
|
|
72472
|
-
|
|
72473
|
-
// src/tools/version-probe.ts
|
|
72474
|
-
function parseVersionOutput(out) {
|
|
72475
|
-
return /(\d+\.\d+\.\d+)/.exec(out)?.[1];
|
|
72476
|
-
}
|
|
72477
|
-
function execVersion(bin) {
|
|
72478
|
-
return new Promise((resolve9, reject) => {
|
|
72479
|
-
(0, import_node_child_process20.execFile)(bin, ["--version"], { timeout: 5e3 }, (err, stdout) => {
|
|
72480
|
-
if (err) reject(err);
|
|
72481
|
-
else resolve9(String(stdout));
|
|
72482
|
-
});
|
|
72483
|
-
});
|
|
72484
|
-
}
|
|
72485
|
-
var cache = null;
|
|
72486
|
-
async function probeToolVersions(opts = {}) {
|
|
72487
|
-
if (cache) return cache;
|
|
72488
|
-
const refreshPath = opts.refreshPath ?? refreshPathFromLoginShell;
|
|
72489
|
-
refreshPath();
|
|
72490
|
-
const probes = opts.probes ?? { claude: () => probeClaude(), codex: () => probeCodex(), pi: () => probePi() };
|
|
72491
|
-
const runVersion = opts.runVersion ?? execVersion;
|
|
72492
|
-
const out = [];
|
|
72493
|
-
for (const id of PROBE_TOOL_IDS) {
|
|
72494
|
-
const p3 = await probes[id]();
|
|
72495
|
-
if (!p3.available) {
|
|
72496
|
-
out.push({ id, available: false });
|
|
72497
|
-
continue;
|
|
72498
|
-
}
|
|
72499
|
-
let version2;
|
|
72500
|
-
try {
|
|
72501
|
-
version2 = parseVersionOutput(await runVersion(p3.path ?? id));
|
|
72502
|
-
} catch {
|
|
72503
|
-
version2 = void 0;
|
|
72504
|
-
}
|
|
72505
|
-
out.push({ id, available: true, ...version2 ? { version: version2 } : {}, ...p3.path ? { path: p3.path } : {} });
|
|
72506
|
-
}
|
|
72507
|
-
if (out.some((t2) => t2.available)) cache = out;
|
|
72508
|
-
return out;
|
|
72509
|
-
}
|
|
72510
|
-
|
|
72511
72789
|
// src/feishu-auth/ios-interest-client.ts
|
|
72512
72790
|
var IosInterestClientError = class extends Error {
|
|
72513
72791
|
constructor(code, message, cause) {
|
|
@@ -72579,10 +72857,10 @@ function buildOnboardingHandlers(deps) {
|
|
|
72579
72857
|
}
|
|
72580
72858
|
|
|
72581
72859
|
// src/app-builder-plugin/mcp-config.ts
|
|
72582
|
-
var
|
|
72583
|
-
var
|
|
72860
|
+
var import_node_fs60 = __toESM(require("fs"), 1);
|
|
72861
|
+
var import_node_path76 = __toESM(require("path"), 1);
|
|
72584
72862
|
function appBuilderMcpConfigPath(outDir, personaId2) {
|
|
72585
|
-
return
|
|
72863
|
+
return import_node_path76.default.join(outDir, `${personaId2}.app-builder.mcp.json`);
|
|
72586
72864
|
}
|
|
72587
72865
|
function writeAppBuilderMcpConfig(args) {
|
|
72588
72866
|
const cfgPath = appBuilderMcpConfigPath(args.outDir, args.personaId);
|
|
@@ -72598,18 +72876,18 @@ function writeAppBuilderMcpConfig(args) {
|
|
|
72598
72876
|
...args.secrets ?? {},
|
|
72599
72877
|
CLAWD_APP_BUILDER_PERSONA_ROOT: args.personaRoot,
|
|
72600
72878
|
CLAWD_APP_BUILDER_TEMPLATE_DIR: args.templateDir,
|
|
72601
|
-
CLAWD_APP_BUILDER_SCAFFOLD_SCRIPT:
|
|
72602
|
-
CLAWD_APP_BUILDER_PUBLISH_SCRIPT:
|
|
72603
|
-
CLAWD_APP_BUILDER_REMOVE_SCRIPT:
|
|
72879
|
+
CLAWD_APP_BUILDER_SCAFFOLD_SCRIPT: import_node_path76.default.join(args.deployKitScriptsDir, "new-extension.sh"),
|
|
72880
|
+
CLAWD_APP_BUILDER_PUBLISH_SCRIPT: import_node_path76.default.join(args.deployKitScriptsDir, "publish.sh"),
|
|
72881
|
+
CLAWD_APP_BUILDER_REMOVE_SCRIPT: import_node_path76.default.join(args.deployKitScriptsDir, "remove-extension.sh"),
|
|
72604
72882
|
...args.logPath ? { CLAWD_APP_BUILDER_LOG: args.logPath } : {}
|
|
72605
72883
|
}
|
|
72606
72884
|
}
|
|
72607
72885
|
}
|
|
72608
72886
|
};
|
|
72609
|
-
|
|
72887
|
+
import_node_fs60.default.mkdirSync(args.outDir, { recursive: true, mode: 448 });
|
|
72610
72888
|
const tmp = `${cfgPath}.${process.pid}.tmp`;
|
|
72611
|
-
|
|
72612
|
-
|
|
72889
|
+
import_node_fs60.default.writeFileSync(tmp, JSON.stringify(cfg, null, 2), { encoding: "utf8", mode: 384 });
|
|
72890
|
+
import_node_fs60.default.renameSync(tmp, cfgPath);
|
|
72613
72891
|
return cfgPath;
|
|
72614
72892
|
}
|
|
72615
72893
|
|
|
@@ -72659,8 +72937,8 @@ async function dispatchRpc(method, frame, client, ctx, deps) {
|
|
|
72659
72937
|
}
|
|
72660
72938
|
|
|
72661
72939
|
// src/extension/runtime.ts
|
|
72662
|
-
var
|
|
72663
|
-
var
|
|
72940
|
+
var import_node_child_process22 = require("child_process");
|
|
72941
|
+
var import_node_path77 = __toESM(require("path"), 1);
|
|
72664
72942
|
var import_promises18 = require("timers/promises");
|
|
72665
72943
|
|
|
72666
72944
|
// src/extension/port-allocator.ts
|
|
@@ -72746,28 +73024,28 @@ var Runtime = class {
|
|
|
72746
73024
|
const existing = this.handles.get(extId);
|
|
72747
73025
|
if (existing) return { kind: "local", port: existing.port };
|
|
72748
73026
|
const records = await loadAll(this.root);
|
|
72749
|
-
const
|
|
72750
|
-
if (!
|
|
72751
|
-
if (
|
|
72752
|
-
throw new RuntimeError("INVALID_MANIFEST",
|
|
72753
|
-
if (manifestMode(
|
|
72754
|
-
return { kind: "hosted", url:
|
|
73027
|
+
const rec6 = records.find((r2) => r2.extId === extId);
|
|
73028
|
+
if (!rec6) throw new RuntimeError("NOT_FOUND", `extension ${extId} not installed`);
|
|
73029
|
+
if (rec6.state === "invalid")
|
|
73030
|
+
throw new RuntimeError("INVALID_MANIFEST", rec6.invalidReason);
|
|
73031
|
+
if (manifestMode(rec6.manifest) === "hosted") {
|
|
73032
|
+
return { kind: "hosted", url: rec6.manifest.entry.url };
|
|
72755
73033
|
}
|
|
72756
73034
|
const port = await this.allocator.allocate().catch(() => {
|
|
72757
73035
|
throw new RuntimeError("PORT_EXHAUSTED", "no free port in configured range");
|
|
72758
73036
|
});
|
|
72759
|
-
const startCommand =
|
|
73037
|
+
const startCommand = rec6.manifest.runtime.startCommand;
|
|
72760
73038
|
const cmd = startCommand.replace(
|
|
72761
73039
|
/\$CLAWOS_EXT_PORT/g,
|
|
72762
73040
|
String(port)
|
|
72763
73041
|
);
|
|
72764
|
-
const dir =
|
|
73042
|
+
const dir = import_node_path77.default.join(this.root, extId);
|
|
72765
73043
|
const env = {
|
|
72766
73044
|
...process.env,
|
|
72767
73045
|
CLAWOS_EXT_PORT: String(port),
|
|
72768
73046
|
CLAWOS_EXT_ID: extId
|
|
72769
73047
|
};
|
|
72770
|
-
const child = (0,
|
|
73048
|
+
const child = (0, import_node_child_process22.spawn)("sh", ["-c", cmd], {
|
|
72771
73049
|
cwd: dir,
|
|
72772
73050
|
env,
|
|
72773
73051
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -72873,7 +73151,7 @@ ${handle.stderrTail}`
|
|
|
72873
73151
|
|
|
72874
73152
|
// src/extension/published-channels.ts
|
|
72875
73153
|
var import_promises19 = __toESM(require("fs/promises"), 1);
|
|
72876
|
-
var
|
|
73154
|
+
var import_node_path78 = __toESM(require("path"), 1);
|
|
72877
73155
|
init_zod();
|
|
72878
73156
|
var PublishedChannelsError = class extends Error {
|
|
72879
73157
|
constructor(code, message) {
|
|
@@ -72972,7 +73250,7 @@ var PublishedChannelStore = class {
|
|
|
72972
73250
|
)
|
|
72973
73251
|
};
|
|
72974
73252
|
const tmp = `${this.filePath}.tmp`;
|
|
72975
|
-
await import_promises19.default.mkdir(
|
|
73253
|
+
await import_promises19.default.mkdir(import_node_path78.default.dirname(this.filePath), { recursive: true });
|
|
72976
73254
|
await import_promises19.default.writeFile(tmp, JSON.stringify(data, null, 2), { mode: 384 });
|
|
72977
73255
|
await import_promises19.default.rename(tmp, this.filePath);
|
|
72978
73256
|
}
|
|
@@ -72980,7 +73258,7 @@ var PublishedChannelStore = class {
|
|
|
72980
73258
|
|
|
72981
73259
|
// src/extension/bundle-cache.ts
|
|
72982
73260
|
var import_promises20 = __toESM(require("fs/promises"), 1);
|
|
72983
|
-
var
|
|
73261
|
+
var import_node_path79 = __toESM(require("path"), 1);
|
|
72984
73262
|
var BundleCache = class {
|
|
72985
73263
|
constructor(rootDir) {
|
|
72986
73264
|
this.rootDir = rootDir;
|
|
@@ -72989,14 +73267,14 @@ var BundleCache = class {
|
|
|
72989
73267
|
/** Atomic write: stage tmp → rename. Caller passes the hex sha256. */
|
|
72990
73268
|
async write(snapshotHash, buffer) {
|
|
72991
73269
|
await import_promises20.default.mkdir(this.rootDir, { recursive: true });
|
|
72992
|
-
const file =
|
|
73270
|
+
const file = import_node_path79.default.join(this.rootDir, `${snapshotHash}.zip`);
|
|
72993
73271
|
const tmp = `${file}.tmp`;
|
|
72994
73272
|
await import_promises20.default.writeFile(tmp, buffer, { mode: 384 });
|
|
72995
73273
|
await import_promises20.default.rename(tmp, file);
|
|
72996
73274
|
}
|
|
72997
73275
|
/** Returns the bundle bytes, or null when the file doesn't exist. */
|
|
72998
73276
|
async read(snapshotHash) {
|
|
72999
|
-
const file =
|
|
73277
|
+
const file = import_node_path79.default.join(this.rootDir, `${snapshotHash}.zip`);
|
|
73000
73278
|
try {
|
|
73001
73279
|
return await import_promises20.default.readFile(file);
|
|
73002
73280
|
} catch (e) {
|
|
@@ -73006,7 +73284,7 @@ var BundleCache = class {
|
|
|
73006
73284
|
}
|
|
73007
73285
|
/** Idempotent — missing file is not an error. */
|
|
73008
73286
|
async delete(snapshotHash) {
|
|
73009
|
-
const file =
|
|
73287
|
+
const file = import_node_path79.default.join(this.rootDir, `${snapshotHash}.zip`);
|
|
73010
73288
|
await import_promises20.default.rm(file, { force: true });
|
|
73011
73289
|
}
|
|
73012
73290
|
};
|
|
@@ -73029,24 +73307,24 @@ async function startDaemon(config) {
|
|
|
73029
73307
|
sampling: logShippingCfg.sampling,
|
|
73030
73308
|
homeDir: import_node_os28.default.homedir()
|
|
73031
73309
|
});
|
|
73032
|
-
const logDir =
|
|
73033
|
-
|
|
73310
|
+
const logDir = import_node_path80.default.join(config.dataDir, "log");
|
|
73311
|
+
import_node_fs61.default.mkdirSync(logDir, { recursive: true });
|
|
73034
73312
|
const logger = createLogger({
|
|
73035
73313
|
level: config.logLevel,
|
|
73036
|
-
file:
|
|
73314
|
+
file: import_node_path80.default.join(logDir, "clawd.log"),
|
|
73037
73315
|
logClient
|
|
73038
73316
|
});
|
|
73039
73317
|
logger.info("starting clawd", { version, config: { port: config.port, host: config.host, dataDir: config.dataDir } });
|
|
73040
73318
|
const screenIdleProbeLogger = createFileOnlyLogger({
|
|
73041
|
-
file:
|
|
73319
|
+
file: import_node_path80.default.join(logDir, "screen-idle-probe.log"),
|
|
73042
73320
|
level: "debug"
|
|
73043
73321
|
});
|
|
73044
73322
|
logger.info("screen-idle probe logger enabled", {
|
|
73045
|
-
file:
|
|
73323
|
+
file: import_node_path80.default.join(logDir, "screen-idle-probe.log")
|
|
73046
73324
|
});
|
|
73047
73325
|
const CAP_TARGETS = [
|
|
73048
|
-
|
|
73049
|
-
|
|
73326
|
+
import_node_path80.default.join(logDir, "clawd.log"),
|
|
73327
|
+
import_node_path80.default.join(logDir, "screen-idle-probe.log")
|
|
73050
73328
|
];
|
|
73051
73329
|
const LOG_CAP_MAX_BYTES = 10 * 1024 * 1024;
|
|
73052
73330
|
const LOG_CAP_KEEP_BYTES = 5 * 1024 * 1024;
|
|
@@ -73168,8 +73446,8 @@ async function startDaemon(config) {
|
|
|
73168
73446
|
const agents = new AgentsScanner();
|
|
73169
73447
|
const history = new ClaudeHistoryReader();
|
|
73170
73448
|
let transport = null;
|
|
73171
|
-
const personaStore = new PersonaStore(
|
|
73172
|
-
const usersRoot =
|
|
73449
|
+
const personaStore = new PersonaStore(import_node_path80.default.join(config.dataDir, "personas"));
|
|
73450
|
+
const usersRoot = import_node_path80.default.join(config.dataDir, "users");
|
|
73173
73451
|
const defaultsRoot = findDefaultsRoot(logger);
|
|
73174
73452
|
if (defaultsRoot) {
|
|
73175
73453
|
seedDefaultPersonas({ store: personaStore, defaultsRoot, logger });
|
|
@@ -73193,7 +73471,7 @@ async function startDaemon(config) {
|
|
|
73193
73471
|
retirePersonaBuilder({ store: personaStore, logger });
|
|
73194
73472
|
const groupFileStore = new GroupFileStore({ dataDir: config.dataDir, logger });
|
|
73195
73473
|
const dispatchStore = createDispatchStore({
|
|
73196
|
-
filePath:
|
|
73474
|
+
filePath: import_node_path80.default.join(config.dataDir, "dispatch.json"),
|
|
73197
73475
|
now: () => Date.now(),
|
|
73198
73476
|
onFlushError: (err) => logger.error("dispatch store flush failed", {
|
|
73199
73477
|
reason: err instanceof Error ? err.message : String(err)
|
|
@@ -73202,7 +73480,7 @@ async function startDaemon(config) {
|
|
|
73202
73480
|
await dispatchStore.load();
|
|
73203
73481
|
dispatchStore.markInterruptedAsFailed((/* @__PURE__ */ new Date()).toISOString());
|
|
73204
73482
|
const channelStore = createChannelStore({
|
|
73205
|
-
filePath:
|
|
73483
|
+
filePath: import_node_path80.default.join(config.dataDir, "channels.json"),
|
|
73206
73484
|
now: () => Date.now(),
|
|
73207
73485
|
genId: () => `ch-${(0, import_node_crypto22.randomUUID)().slice(0, 8)}`,
|
|
73208
73486
|
onFlushError: (err) => logger.error("channel store flush failed", {
|
|
@@ -73211,7 +73489,7 @@ async function startDaemon(config) {
|
|
|
73211
73489
|
});
|
|
73212
73490
|
await channelStore.load();
|
|
73213
73491
|
const topicStore = createTopicStore({
|
|
73214
|
-
filePath:
|
|
73492
|
+
filePath: import_node_path80.default.join(config.dataDir, "topics.json"),
|
|
73215
73493
|
now: () => Date.now(),
|
|
73216
73494
|
genId: () => `tp-${(0, import_node_crypto22.randomUUID)().slice(0, 8)}`,
|
|
73217
73495
|
onFlushError: (err) => logger.error("topic store flush failed", {
|
|
@@ -73238,12 +73516,12 @@ async function startDaemon(config) {
|
|
|
73238
73516
|
});
|
|
73239
73517
|
}
|
|
73240
73518
|
});
|
|
73241
|
-
const here = typeof __dirname === "string" ? __dirname :
|
|
73519
|
+
const here = typeof __dirname === "string" ? __dirname : import_node_path80.default.dirname((0, import_node_url5.fileURLToPath)(import_meta9.url));
|
|
73242
73520
|
const mcpConfigs = [];
|
|
73243
73521
|
const secretsBundleRoot = findSecretsBundleRoot(logger);
|
|
73244
|
-
const localSecretsDir =
|
|
73522
|
+
const localSecretsDir = import_node_path80.default.join(config.dataDir, LOCAL_SECRETS_DIRNAME);
|
|
73245
73523
|
const readSecrets = () => readSecretTable({ bundleRoot: secretsBundleRoot, overrideDir: localSecretsDir, logger });
|
|
73246
|
-
const githubTokenFile =
|
|
73524
|
+
const githubTokenFile = import_node_path80.default.join(localSecretsDir, GITHUB_TOKEN_FILE);
|
|
73247
73525
|
const githubIdentity = createGithubIdentity({
|
|
73248
73526
|
resolve: () => resolveGithubAuth({ exec: runCommand, fileToken: () => readEnvFileVar(githubTokenFile, GITHUB_TOKEN_VAR) }),
|
|
73249
73527
|
store: (token) => storeGithubAuth({
|
|
@@ -73283,22 +73561,22 @@ async function startDaemon(config) {
|
|
|
73283
73561
|
void githubIdentity.refresh();
|
|
73284
73562
|
return renderPersonaMcpSecrets({
|
|
73285
73563
|
personaId: personaId2,
|
|
73286
|
-
personaDir:
|
|
73564
|
+
personaDir: import_node_path80.default.join(config.dataDir, "personas", personaId2),
|
|
73287
73565
|
secrets,
|
|
73288
|
-
outDir:
|
|
73566
|
+
outDir: import_node_path80.default.join(config.dataDir, "persona-mcp"),
|
|
73289
73567
|
logger
|
|
73290
73568
|
});
|
|
73291
73569
|
};
|
|
73292
73570
|
const mcpDaemonUrl = `http://127.0.0.1:${config.port}`;
|
|
73293
73571
|
const dispatchServerCandidates = [
|
|
73294
|
-
|
|
73572
|
+
import_node_path80.default.join(here, "dispatch", "mcp-server.cjs"),
|
|
73295
73573
|
// 生产 dist/index → dist/dispatch/mcp-server.cjs
|
|
73296
|
-
|
|
73574
|
+
import_node_path80.default.join(here, "..", "dist", "dispatch", "mcp-server.cjs")
|
|
73297
73575
|
// dev tsx src/index → ../dist/dispatch/mcp-server.cjs
|
|
73298
73576
|
];
|
|
73299
|
-
const dispatchServerScriptPath = dispatchServerCandidates.find((p3) =>
|
|
73577
|
+
const dispatchServerScriptPath = dispatchServerCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73300
73578
|
if (dispatchServerScriptPath) {
|
|
73301
|
-
const dispatchLogPath =
|
|
73579
|
+
const dispatchLogPath = import_node_path80.default.join(logDir, "dispatch-mcp-server.log");
|
|
73302
73580
|
const dispatchCfgPath = writeDispatchMcpConfig({
|
|
73303
73581
|
dataDir: config.dataDir,
|
|
73304
73582
|
serverScriptPath: dispatchServerScriptPath,
|
|
@@ -73318,12 +73596,12 @@ async function startDaemon(config) {
|
|
|
73318
73596
|
});
|
|
73319
73597
|
}
|
|
73320
73598
|
const ticketServerCandidates = [
|
|
73321
|
-
|
|
73322
|
-
|
|
73599
|
+
import_node_path80.default.join(here, "ticket", "mcp-server.cjs"),
|
|
73600
|
+
import_node_path80.default.join(here, "..", "dist", "ticket", "mcp-server.cjs")
|
|
73323
73601
|
];
|
|
73324
|
-
const ticketServerScriptPath = ticketServerCandidates.find((p3) =>
|
|
73602
|
+
const ticketServerScriptPath = ticketServerCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73325
73603
|
if (ticketServerScriptPath) {
|
|
73326
|
-
const ticketLogPath =
|
|
73604
|
+
const ticketLogPath = import_node_path80.default.join(logDir, "ticket-mcp-server.log");
|
|
73327
73605
|
const ticketCfgPath = writeTicketMcpConfig({
|
|
73328
73606
|
dataDir: config.dataDir,
|
|
73329
73607
|
serverScriptPath: ticketServerScriptPath,
|
|
@@ -73345,12 +73623,12 @@ async function startDaemon(config) {
|
|
|
73345
73623
|
});
|
|
73346
73624
|
}
|
|
73347
73625
|
const shiftServerCandidates = [
|
|
73348
|
-
|
|
73349
|
-
|
|
73626
|
+
import_node_path80.default.join(here, "shift", "mcp-server.cjs"),
|
|
73627
|
+
import_node_path80.default.join(here, "..", "dist", "shift", "mcp-server.cjs")
|
|
73350
73628
|
];
|
|
73351
|
-
const shiftServerScriptPath = shiftServerCandidates.find((p3) =>
|
|
73629
|
+
const shiftServerScriptPath = shiftServerCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73352
73630
|
if (shiftServerScriptPath) {
|
|
73353
|
-
const shiftLogPath =
|
|
73631
|
+
const shiftLogPath = import_node_path80.default.join(logDir, "shift-mcp-server.log");
|
|
73354
73632
|
const shiftCfgPath = await writeShiftMcpConfig({
|
|
73355
73633
|
dataDir: config.dataDir,
|
|
73356
73634
|
serverScriptPath: shiftServerScriptPath,
|
|
@@ -73371,12 +73649,12 @@ async function startDaemon(config) {
|
|
|
73371
73649
|
);
|
|
73372
73650
|
}
|
|
73373
73651
|
const inboxServerCandidates = [
|
|
73374
|
-
|
|
73375
|
-
|
|
73652
|
+
import_node_path80.default.join(here, "inbox", "mcp-server.cjs"),
|
|
73653
|
+
import_node_path80.default.join(here, "..", "dist", "inbox", "mcp-server.cjs")
|
|
73376
73654
|
];
|
|
73377
|
-
const inboxServerScriptPath = inboxServerCandidates.find((p3) =>
|
|
73655
|
+
const inboxServerScriptPath = inboxServerCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73378
73656
|
if (inboxServerScriptPath) {
|
|
73379
|
-
const inboxLogPath =
|
|
73657
|
+
const inboxLogPath = import_node_path80.default.join(logDir, "inbox-mcp-server.log");
|
|
73380
73658
|
const inboxCfgPath = await writeInboxMcpConfig({
|
|
73381
73659
|
dataDir: config.dataDir,
|
|
73382
73660
|
serverScriptPath: inboxServerScriptPath,
|
|
@@ -73397,10 +73675,10 @@ async function startDaemon(config) {
|
|
|
73397
73675
|
);
|
|
73398
73676
|
}
|
|
73399
73677
|
const peerOpsServerCandidates = [
|
|
73400
|
-
|
|
73401
|
-
|
|
73678
|
+
import_node_path80.default.join(here, "peer-ops", "mcp-server.cjs"),
|
|
73679
|
+
import_node_path80.default.join(here, "..", "dist", "peer-ops", "mcp-server.cjs")
|
|
73402
73680
|
];
|
|
73403
|
-
const peerOpsServerScriptPath = peerOpsServerCandidates.find((p3) =>
|
|
73681
|
+
const peerOpsServerScriptPath = peerOpsServerCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73404
73682
|
if (peerOpsServerScriptPath) {
|
|
73405
73683
|
const peerOpsCfgPath = writePeerOpsMcpConfig({
|
|
73406
73684
|
dataDir: config.dataDir,
|
|
@@ -73420,12 +73698,12 @@ async function startDaemon(config) {
|
|
|
73420
73698
|
);
|
|
73421
73699
|
}
|
|
73422
73700
|
const rpcToolServerCandidates = [
|
|
73423
|
-
|
|
73424
|
-
|
|
73701
|
+
import_node_path80.default.join(here, "rpc-tool", "mcp-server.cjs"),
|
|
73702
|
+
import_node_path80.default.join(here, "..", "dist", "rpc-tool", "mcp-server.cjs")
|
|
73425
73703
|
];
|
|
73426
|
-
const rpcToolServerScriptPath = rpcToolServerCandidates.find((p3) =>
|
|
73704
|
+
const rpcToolServerScriptPath = rpcToolServerCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73427
73705
|
if (rpcToolServerScriptPath) {
|
|
73428
|
-
const rpcToolLogPath =
|
|
73706
|
+
const rpcToolLogPath = import_node_path80.default.join(logDir, "rpc-tool-mcp-server.log");
|
|
73429
73707
|
const rpcToolCfgPath = writeRpcToolMcpConfig({
|
|
73430
73708
|
dataDir: config.dataDir,
|
|
73431
73709
|
serverScriptPath: rpcToolServerScriptPath,
|
|
@@ -73446,22 +73724,22 @@ async function startDaemon(config) {
|
|
|
73446
73724
|
);
|
|
73447
73725
|
}
|
|
73448
73726
|
const appBuilderServerCandidates = [
|
|
73449
|
-
|
|
73450
|
-
|
|
73727
|
+
import_node_path80.default.join(here, "app-builder-plugin", "mcp-server.cjs"),
|
|
73728
|
+
import_node_path80.default.join(here, "..", "dist", "app-builder-plugin", "mcp-server.cjs")
|
|
73451
73729
|
];
|
|
73452
|
-
const appBuilderServerScriptPath = appBuilderServerCandidates.find((p3) =>
|
|
73730
|
+
const appBuilderServerScriptPath = appBuilderServerCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73453
73731
|
if (appBuilderServerScriptPath) {
|
|
73454
|
-
const appBuilderLogPath =
|
|
73732
|
+
const appBuilderLogPath = import_node_path80.default.join(logDir, "app-builder-mcp-server.log");
|
|
73455
73733
|
const writeAppBuilderConfigFor = (personaId2) => {
|
|
73456
|
-
const personaRoot =
|
|
73457
|
-
const secrets = secretsForKit(readSecrets(),
|
|
73734
|
+
const personaRoot = import_node_path80.default.join(config.dataDir, "personas", personaId2);
|
|
73735
|
+
const secrets = secretsForKit(readSecrets(), import_node_path80.default.join(personaRoot, "extension-kit"));
|
|
73458
73736
|
return writeAppBuilderMcpConfig({
|
|
73459
|
-
outDir:
|
|
73737
|
+
outDir: import_node_path80.default.join(config.dataDir, "persona-mcp"),
|
|
73460
73738
|
personaId: personaId2,
|
|
73461
73739
|
serverScriptPath: appBuilderServerScriptPath,
|
|
73462
73740
|
personaRoot,
|
|
73463
|
-
templateDir:
|
|
73464
|
-
deployKitScriptsDir:
|
|
73741
|
+
templateDir: import_node_path80.default.join(personaRoot, "extension-kit", "examples", APP_BUILDER_TEMPLATE),
|
|
73742
|
+
deployKitScriptsDir: import_node_path80.default.join(config.dataDir, "deploy-kit", "scripts"),
|
|
73465
73743
|
...secrets ? { secrets } : {},
|
|
73466
73744
|
logPath: appBuilderLogPath
|
|
73467
73745
|
});
|
|
@@ -73486,7 +73764,7 @@ async function startDaemon(config) {
|
|
|
73486
73764
|
);
|
|
73487
73765
|
}
|
|
73488
73766
|
const shiftStore = createShiftStore({
|
|
73489
|
-
filePath:
|
|
73767
|
+
filePath: import_node_path80.default.join(config.dataDir, "shift.json"),
|
|
73490
73768
|
ownerIdProvider: () => ownerPrincipalId,
|
|
73491
73769
|
now: () => Date.now()
|
|
73492
73770
|
});
|
|
@@ -73508,7 +73786,7 @@ async function startDaemon(config) {
|
|
|
73508
73786
|
getAdapter,
|
|
73509
73787
|
historyReader: history,
|
|
73510
73788
|
dataDir: config.dataDir,
|
|
73511
|
-
personaRoot:
|
|
73789
|
+
personaRoot: import_node_path80.default.join(config.dataDir, "personas"),
|
|
73512
73790
|
// dispatch / shift 自动化 spawn 按 persona 绑定 tool 起 B session(codex persona 用 codex)。
|
|
73513
73791
|
// personaRegistry 声明在 manager 之后(同作用域 const,调用时机在启动完成后,无 TDZ 风险)。
|
|
73514
73792
|
getPersonaDefaults: (personaId2) => personaRegistry.get(personaId2),
|
|
@@ -73565,10 +73843,10 @@ async function startDaemon(config) {
|
|
|
73565
73843
|
// 文件可能 agent 写完又被自己删(罕见),用 size=0 / fallback mime 兜底。
|
|
73566
73844
|
attachmentGroup: {
|
|
73567
73845
|
onFileEdit: (input) => {
|
|
73568
|
-
const absPath =
|
|
73846
|
+
const absPath = import_node_path80.default.isAbsolute(input.relPath) ? input.relPath : import_node_path80.default.join(input.cwd, input.relPath);
|
|
73569
73847
|
let size = 0;
|
|
73570
73848
|
try {
|
|
73571
|
-
size =
|
|
73849
|
+
size = import_node_fs61.default.statSync(absPath).size;
|
|
73572
73850
|
} catch (err) {
|
|
73573
73851
|
logger.warn("attachment.onFileEdit stat failed", {
|
|
73574
73852
|
sessionId: input.sessionId,
|
|
@@ -73609,9 +73887,9 @@ async function startDaemon(config) {
|
|
|
73609
73887
|
logger.info("projects.seed-dropped", { dropped: droppedSeed.dropped, backup: droppedSeed.backup });
|
|
73610
73888
|
}
|
|
73611
73889
|
const projectsStore = new ProjectsStore({
|
|
73612
|
-
file:
|
|
73890
|
+
file: import_node_path80.default.join(config.dataDir, "projects.json"),
|
|
73613
73891
|
clawdDir: config.dataDir,
|
|
73614
|
-
codexStateFile:
|
|
73892
|
+
codexStateFile: import_node_path80.default.join(import_node_os28.default.homedir(), ".codex", ".codex-global-state.json"),
|
|
73615
73893
|
logger
|
|
73616
73894
|
});
|
|
73617
73895
|
const observer = new SessionObserver({
|
|
@@ -73676,13 +73954,13 @@ async function startDaemon(config) {
|
|
|
73676
73954
|
logger
|
|
73677
73955
|
});
|
|
73678
73956
|
registerAdapter("claude", claudeAdapter);
|
|
73679
|
-
const codexIsolatedHome =
|
|
73957
|
+
const codexIsolatedHome = import_node_path80.default.join(config.dataDir, "codex-home");
|
|
73680
73958
|
try {
|
|
73681
|
-
|
|
73959
|
+
import_node_fs61.default.mkdirSync(codexIsolatedHome, { recursive: true });
|
|
73682
73960
|
for (const f2 of ["auth.json", "config.toml"]) {
|
|
73683
|
-
const link =
|
|
73684
|
-
const target =
|
|
73685
|
-
if (!
|
|
73961
|
+
const link = import_node_path80.default.join(codexIsolatedHome, f2);
|
|
73962
|
+
const target = import_node_path80.default.join(import_node_os28.default.homedir(), ".codex", f2);
|
|
73963
|
+
if (!import_node_fs61.default.existsSync(link) && import_node_fs61.default.existsSync(target)) import_node_fs61.default.symlinkSync(target, link);
|
|
73686
73964
|
}
|
|
73687
73965
|
} catch (err) {
|
|
73688
73966
|
logger.warn("codex isolated home setup failed", { err: String(err) });
|
|
@@ -73693,17 +73971,17 @@ async function startDaemon(config) {
|
|
|
73693
73971
|
logger,
|
|
73694
73972
|
historyReader: new CodexHistoryReader({
|
|
73695
73973
|
roots: codexRolloutRoots(config.dataDir),
|
|
73696
|
-
sharedHome:
|
|
73974
|
+
sharedHome: import_node_path80.default.join(import_node_os28.default.homedir(), ".codex"),
|
|
73697
73975
|
logger
|
|
73698
73976
|
}),
|
|
73699
73977
|
// projectPaths 每次调用现取 —— 用户新建 project 后立即生效,不用重启 daemon
|
|
73700
73978
|
codexHomeFor: (cwd) => resolveCodexHome({
|
|
73701
73979
|
cwd,
|
|
73702
|
-
personaRoot:
|
|
73980
|
+
personaRoot: import_node_path80.default.join(config.dataDir, "personas"),
|
|
73703
73981
|
// 必须用 listMerged(Codex registry ∪ 叠加层):只用本地 list() 的话,用户在
|
|
73704
73982
|
// Codex 里建的 project 不在表里,在它下面开的会话会被误判成隔离 → Codex 侧看不到
|
|
73705
73983
|
projectPaths: projectsStore.listMerged().map((x2) => x2.path),
|
|
73706
|
-
sharedHome:
|
|
73984
|
+
sharedHome: import_node_path80.default.join(import_node_os28.default.homedir(), ".codex"),
|
|
73707
73985
|
isolatedHome: codexIsolatedHome
|
|
73708
73986
|
}),
|
|
73709
73987
|
// 附件图片验签:与 http-router /files 路由同一把 secret
|
|
@@ -73712,10 +73990,10 @@ async function startDaemon(config) {
|
|
|
73712
73990
|
);
|
|
73713
73991
|
registerAdapter(CODEX_CLOUD_TOOL_ID, new CloudCodexAdapter({ client: cloudGateway, logger, getSignSecret: () => authFile.token }));
|
|
73714
73992
|
const piMcpBridgeCandidates = [
|
|
73715
|
-
|
|
73716
|
-
|
|
73993
|
+
import_node_path80.default.join(here, "pi-mcp-bridge", "extension.cjs"),
|
|
73994
|
+
import_node_path80.default.join(here, "..", "dist", "pi-mcp-bridge", "extension.cjs")
|
|
73717
73995
|
];
|
|
73718
|
-
const piMcpBridgePath = piMcpBridgeCandidates.find((p3) =>
|
|
73996
|
+
const piMcpBridgePath = piMcpBridgeCandidates.find((p3) => import_node_fs61.default.existsSync(p3));
|
|
73719
73997
|
if (piMcpBridgePath) {
|
|
73720
73998
|
logger.info("pi-mcp-bridge extension resolved", { path: piMcpBridgePath });
|
|
73721
73999
|
} else {
|
|
@@ -74010,11 +74288,11 @@ async function startDaemon(config) {
|
|
|
74010
74288
|
// 'persona/<pid>/owner',default 走 'default'。
|
|
74011
74289
|
getSessionScope: (sid) => manager.findOwnedSessionScope(sid),
|
|
74012
74290
|
// guest path guard:candidate 必须在 personaRoot 子树或调用者自己的 user-dir 下
|
|
74013
|
-
personaRoot:
|
|
74291
|
+
personaRoot: import_node_path80.default.join(config.dataDir, "personas"),
|
|
74014
74292
|
usersRoot
|
|
74015
74293
|
},
|
|
74016
74294
|
// workspace/git/history/skills/agents handler 共用的 guest path guard 锚点
|
|
74017
|
-
personaRoot:
|
|
74295
|
+
personaRoot: import_node_path80.default.join(config.dataDir, "personas"),
|
|
74018
74296
|
// v2 多人 persona 隔离:handler 派生 guest user-dir 放行
|
|
74019
74297
|
usersRoot,
|
|
74020
74298
|
// v2 Phase 6: whoami handler 装在 owner principal.displayName + persona 解析
|
|
@@ -74289,7 +74567,7 @@ async function startDaemon(config) {
|
|
|
74289
74567
|
});
|
|
74290
74568
|
shiftScheduler.start();
|
|
74291
74569
|
logger.info("shift scheduler started", { shiftCount: shiftStore.list().length });
|
|
74292
|
-
const larkBotStore = createLarkBotBindingStore(
|
|
74570
|
+
const larkBotStore = createLarkBotBindingStore(import_node_path80.default.join(config.dataDir, "personas"));
|
|
74293
74571
|
const larkBotCloud = createLarkBotCloudClient({
|
|
74294
74572
|
api: config.clawosApi ?? DEFAULT_CLAWOS_API,
|
|
74295
74573
|
getLoginPass: () => ownerIdentityStore.read()?.loginPass ?? null
|
|
@@ -74301,7 +74579,7 @@ async function startDaemon(config) {
|
|
|
74301
74579
|
store: larkBotStore,
|
|
74302
74580
|
fetchResource: (appId, messageId, fileKey, maxBytes, type) => larkBotCloud.fetchResource(appId, messageId, fileKey, maxBytes, type),
|
|
74303
74581
|
// 图片落 guest userWorkDir 下(capId = lark-<chat_id>):CC 经 --add-dir + allowRead carve 可 Read
|
|
74304
|
-
mediaRootFor: (chatId) =>
|
|
74582
|
+
mediaRootFor: (chatId) => import_node_path80.default.join(deriveUserWorkDir(`lark-${chatId}`, usersRoot), "lark-media"),
|
|
74305
74583
|
isShuttingDown: () => larkDraining,
|
|
74306
74584
|
logger: {
|
|
74307
74585
|
warn: (msg) => logger.warn(msg),
|
|
@@ -74585,8 +74863,8 @@ async function startDaemon(config) {
|
|
|
74585
74863
|
const lines = [
|
|
74586
74864
|
`Tunnel: ${r2.url}`,
|
|
74587
74865
|
...resolvedAuthToken ? [`Connect: ${connectUrl}`] : [],
|
|
74588
|
-
`Frpc config: ${
|
|
74589
|
-
`Frpc log: ${
|
|
74866
|
+
`Frpc config: ${import_node_path80.default.join(config.dataDir, "frpc.toml")}`,
|
|
74867
|
+
`Frpc log: ${import_node_path80.default.join(logDir, "frpc.log")}`
|
|
74590
74868
|
];
|
|
74591
74869
|
const width2 = Math.max(...lines.map((l2) => l2.length));
|
|
74592
74870
|
const bar = "\u2550".repeat(width2 + 4);
|
|
@@ -74599,8 +74877,8 @@ ${bar}
|
|
|
74599
74877
|
|
|
74600
74878
|
`);
|
|
74601
74879
|
try {
|
|
74602
|
-
const connectPath =
|
|
74603
|
-
|
|
74880
|
+
const connectPath = import_node_path80.default.join(config.dataDir, "connect.txt");
|
|
74881
|
+
import_node_fs61.default.writeFileSync(connectPath, lines.join("\n") + "\n", { mode: 384 });
|
|
74604
74882
|
} catch {
|
|
74605
74883
|
}
|
|
74606
74884
|
} catch (err) {
|
|
@@ -74698,9 +74976,9 @@ ${bar}
|
|
|
74698
74976
|
};
|
|
74699
74977
|
}
|
|
74700
74978
|
function migrateDropPersonsDir(dataDir) {
|
|
74701
|
-
const dir =
|
|
74979
|
+
const dir = import_node_path80.default.join(dataDir, "persons");
|
|
74702
74980
|
try {
|
|
74703
|
-
|
|
74981
|
+
import_node_fs61.default.rmSync(dir, { recursive: true, force: true });
|
|
74704
74982
|
} catch {
|
|
74705
74983
|
}
|
|
74706
74984
|
}
|