@clawos-dev/clawd 0.2.409 → 0.2.411
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/cli.cjs +86 -58
- package/dist/share-md-viewer-error.html +1 -1
- package/dist/share-md-viewer.html +1 -1
- package/dist/share-ui/assets/{guest-zY0ICv53.js → guest-DcTI4F8B.js} +130 -130
- package/dist/share-ui/assets/guest-DdIGJUIu.css +32 -0
- package/dist/share-ui/guest.html +2 -2
- package/package.json +1 -1
- package/dist/share-ui/assets/guest-b29slU5m.css +0 -32
package/dist/cli.cjs
CHANGED
|
@@ -14365,22 +14365,49 @@ var init_tool_result_extra = __esm({
|
|
|
14365
14365
|
function cwdToHashDir(cwd) {
|
|
14366
14366
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
14367
14367
|
}
|
|
14368
|
-
function
|
|
14369
|
-
const
|
|
14368
|
+
function subagentsDirCandidates(projectsRoot, cwd, toolSessionId) {
|
|
14369
|
+
const out = [];
|
|
14370
|
+
const seen = /* @__PURE__ */ new Set();
|
|
14371
|
+
const add = (dir) => {
|
|
14372
|
+
if (seen.has(dir)) return;
|
|
14373
|
+
try {
|
|
14374
|
+
if (!import_node_fs6.default.statSync(dir).isDirectory()) return;
|
|
14375
|
+
} catch {
|
|
14376
|
+
return;
|
|
14377
|
+
}
|
|
14378
|
+
seen.add(dir);
|
|
14379
|
+
out.push(dir);
|
|
14380
|
+
};
|
|
14381
|
+
add(import_node_path5.default.join(projectsRoot, cwdToHashDir(cwd), toolSessionId, "subagents"));
|
|
14370
14382
|
let entries;
|
|
14371
14383
|
try {
|
|
14372
|
-
entries = import_node_fs6.default.readdirSync(
|
|
14384
|
+
entries = import_node_fs6.default.readdirSync(projectsRoot, { withFileTypes: true });
|
|
14373
14385
|
} catch {
|
|
14374
|
-
return
|
|
14386
|
+
return out;
|
|
14387
|
+
}
|
|
14388
|
+
for (const ent of entries) {
|
|
14389
|
+
if (!ent.isDirectory()) continue;
|
|
14390
|
+
add(import_node_path5.default.join(projectsRoot, ent.name, toolSessionId, "subagents"));
|
|
14375
14391
|
}
|
|
14392
|
+
return out;
|
|
14393
|
+
}
|
|
14394
|
+
function newestSubagentMtimeMs(projectsRoot, cwd, toolSessionId) {
|
|
14376
14395
|
let newest = null;
|
|
14377
|
-
for (const
|
|
14378
|
-
|
|
14379
|
-
if (!e.name.startsWith("agent-") || !e.name.endsWith(".jsonl")) continue;
|
|
14396
|
+
for (const dir of subagentsDirCandidates(projectsRoot, cwd, toolSessionId)) {
|
|
14397
|
+
let entries;
|
|
14380
14398
|
try {
|
|
14381
|
-
|
|
14382
|
-
if (newest === null || m2 > newest) newest = m2;
|
|
14399
|
+
entries = import_node_fs6.default.readdirSync(dir, { withFileTypes: true });
|
|
14383
14400
|
} catch {
|
|
14401
|
+
continue;
|
|
14402
|
+
}
|
|
14403
|
+
for (const e of entries) {
|
|
14404
|
+
if (!e.isFile()) continue;
|
|
14405
|
+
if (!e.name.startsWith("agent-") || !e.name.endsWith(".jsonl")) continue;
|
|
14406
|
+
try {
|
|
14407
|
+
const m2 = import_node_fs6.default.statSync(import_node_path5.default.join(dir, e.name)).mtimeMs;
|
|
14408
|
+
if (newest === null || m2 > newest) newest = m2;
|
|
14409
|
+
} catch {
|
|
14410
|
+
}
|
|
14384
14411
|
}
|
|
14385
14412
|
}
|
|
14386
14413
|
return newest;
|
|
@@ -14934,38 +14961,41 @@ var init_claude_history = __esm({
|
|
|
14934
14961
|
return { messages: this.readSubagentFromMainJsonl(args.cwd, args.toolSessionId, args.subagentId) };
|
|
14935
14962
|
}
|
|
14936
14963
|
// 独立目录路径:<projectsRoot>/<cwdHash>/<toolSessionId>/subagents/*.jsonl
|
|
14937
|
-
// 返回 null
|
|
14964
|
+
// 返回 null 表示一个候选目录都没有(调用方回退旧实现);返回空数组表示目录在但无 jsonl。
|
|
14965
|
+
// [cwd 漂移] 下取**所有候选目录的并集**:漂移前后的 agent 都该列出来。同名 agentId 只可能
|
|
14966
|
+
// 是同一个 agent(id 全局唯一),取先遇到的那份(byCwd 优先)。
|
|
14938
14967
|
listSubagentsFromDirectory(cwd, toolSessionId) {
|
|
14939
|
-
const
|
|
14940
|
-
|
|
14941
|
-
toolSessionId,
|
|
14942
|
-
"subagents"
|
|
14943
|
-
);
|
|
14944
|
-
let entries;
|
|
14945
|
-
try {
|
|
14946
|
-
entries = import_node_fs6.default.readdirSync(dir, { withFileTypes: true });
|
|
14947
|
-
} catch (err) {
|
|
14948
|
-
if (err.code === "ENOENT") return null;
|
|
14949
|
-
return null;
|
|
14950
|
-
}
|
|
14968
|
+
const dirs = subagentsDirCandidates(this.projectsRoot, cwd, toolSessionId);
|
|
14969
|
+
if (dirs.length === 0) return null;
|
|
14951
14970
|
const out = [];
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
|
|
14960
|
-
for (const
|
|
14961
|
-
|
|
14962
|
-
if (!
|
|
14963
|
-
|
|
14964
|
-
if (
|
|
14965
|
-
|
|
14971
|
+
const seen = /* @__PURE__ */ new Set();
|
|
14972
|
+
for (const dir of dirs) {
|
|
14973
|
+
let entries;
|
|
14974
|
+
try {
|
|
14975
|
+
entries = import_node_fs6.default.readdirSync(dir, { withFileTypes: true });
|
|
14976
|
+
} catch {
|
|
14977
|
+
continue;
|
|
14978
|
+
}
|
|
14979
|
+
for (const e of entries) {
|
|
14980
|
+
if (!e.isFile()) continue;
|
|
14981
|
+
if (!e.name.startsWith("agent-") || !e.name.endsWith(".jsonl")) continue;
|
|
14982
|
+
const subagentId = e.name.slice("agent-".length, -".jsonl".length);
|
|
14983
|
+
if (seen.has(subagentId)) continue;
|
|
14984
|
+
seen.add(subagentId);
|
|
14985
|
+
const filePath = import_node_path5.default.join(dir, e.name);
|
|
14986
|
+
const lines = readJsonlLines(filePath);
|
|
14987
|
+
let firstText = "";
|
|
14988
|
+
let messageCount = 0;
|
|
14989
|
+
for (const line of lines) {
|
|
14990
|
+
const msg = messageFromJsonl(line);
|
|
14991
|
+
if (!msg) continue;
|
|
14992
|
+
messageCount += 1;
|
|
14993
|
+
if (!firstText && msg.kind === "user-text" && msg.text) {
|
|
14994
|
+
firstText = msg.text.slice(0, 120);
|
|
14995
|
+
}
|
|
14966
14996
|
}
|
|
14997
|
+
out.push({ subagentId, summary: firstText, messageCount });
|
|
14967
14998
|
}
|
|
14968
|
-
out.push({ subagentId, summary: firstText, messageCount });
|
|
14969
14999
|
}
|
|
14970
15000
|
return out;
|
|
14971
15001
|
}
|
|
@@ -15002,28 +15032,26 @@ var init_claude_history = __esm({
|
|
|
15002
15032
|
messageCount: buckets.get(id)?.count ?? 0
|
|
15003
15033
|
}));
|
|
15004
15034
|
}
|
|
15005
|
-
// 独立文件路径:agent-<subagentId>.jsonl
|
|
15035
|
+
// 独立文件路径:agent-<subagentId>.jsonl;所有候选目录里都没有才返回 null,让调用方
|
|
15036
|
+
// 回退去扫主 jsonl 的 sidechain。[cwd 漂移] 下要的就是「这个文件落在哪一侧」——
|
|
15037
|
+
// 只看某一个目录在不在,会把漂移侧的 agent 判成不存在。
|
|
15006
15038
|
readSubagentFromFile(cwd, toolSessionId, subagentId) {
|
|
15007
|
-
const
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
|
|
15011
|
-
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
const messages = [];
|
|
15022
|
-
for (const line of lines) {
|
|
15023
|
-
const msg = messageFromJsonl(line);
|
|
15024
|
-
if (msg) messages.push(msg);
|
|
15039
|
+
for (const dir of subagentsDirCandidates(this.projectsRoot, cwd, toolSessionId)) {
|
|
15040
|
+
const file = import_node_path5.default.join(dir, `agent-${subagentId}.jsonl`);
|
|
15041
|
+
try {
|
|
15042
|
+
if (!import_node_fs6.default.statSync(file).isFile()) continue;
|
|
15043
|
+
} catch {
|
|
15044
|
+
continue;
|
|
15045
|
+
}
|
|
15046
|
+
const lines = readJsonlLines(file);
|
|
15047
|
+
const messages = [];
|
|
15048
|
+
for (const line of lines) {
|
|
15049
|
+
const msg = messageFromJsonl(line);
|
|
15050
|
+
if (msg) messages.push(msg);
|
|
15051
|
+
}
|
|
15052
|
+
return messages;
|
|
15025
15053
|
}
|
|
15026
|
-
return
|
|
15054
|
+
return null;
|
|
15027
15055
|
}
|
|
15028
15056
|
/**
|
|
15029
15057
|
* 遍历 session JSONL 找所有 `type:'file-history-snapshot'` 条目,按 messageId 建表
|
|
@@ -62305,7 +62333,7 @@ function computeMethodAccess(args) {
|
|
|
62305
62333
|
}
|
|
62306
62334
|
|
|
62307
62335
|
// src/version.ts
|
|
62308
|
-
var version = "0.2.
|
|
62336
|
+
var version = "0.2.411".length > 0 ? "0.2.411" : "dev";
|
|
62309
62337
|
|
|
62310
62338
|
// src/cli-probe/probe.ts
|
|
62311
62339
|
var fs66 = __toESM(require("fs"), 1);
|