chore: v2.8.13 — Artifacts reinstall/edit/installs, agent steps in chat, pick a local file to attach, Windows paths as links

- Chat: an Agent step shows its task, status and tool calls and opens its conversation in place; Windows paths (E:\…, C:/…) in replies open as files
- Prompt: attach a file on this computer by path (native picker), clearer too-large messages
- Artifacts: edit title/description and a skill's files (new snapshot), Reinstall, install history, Hub-only rows, skills installed into ~/.claude/skills and ~/.agents/skills
- Files: batch upload of small files in one extract
- AI Tools: npm install falls back to --prefix ~/.local when the global prefix is not writable
This commit is contained in:
2026-10-20 16:44:55 +07:00
parent 49f87c4da3
commit 0547488f13
59 changed files with 4285 additions and 690 deletions
+52 -8
View File
@@ -846,7 +846,13 @@ router.get("/:id/transcripts", async (req, res) => {
const omp = require("../lib/omp-usage");
const list = [];
if (omp.journalPath(req.params.id)) {
list.push({ id: "main", name: "Main Agent", type: "main", has_transcript: true, db_agent_id: null });
list.push({
id: "main",
name: "Main Agent",
type: "main",
has_transcript: true,
db_agent_id: null,
});
}
for (const j of omp.subagentJournals(req.params.id)) {
list.push({
@@ -973,6 +979,8 @@ router.get("/:id/transcripts", async (req, res) => {
name: transcriptName,
type: isCompact ? "compaction" : "subagent",
subagent_type: transcriptSubagentType,
// The Agent call that launched it: the chat opens it from that call.
tool_use_id: typeof meta?.toolUseId === "string" ? meta.toolUseId : null,
has_transcript: true,
db_agent_id: null, // matched later after all transcripts are collected
_timestamp: transcriptTimestamp,
@@ -1260,18 +1268,32 @@ router.get("/:id/transcript", async (req, res) => {
// A line carries one tool result; an edit's +/- counts ride on it.
const diff = patchCounts(entry.toolUseResult);
const answers = askAnswers(entry.toolUseResult);
const agent = agentInfo(entry.toolUseResult);
// A subagent's report is a reply, read as prose: its text blocks
// whole, not a 10 KB slice of their JSON.
const report =
agent && Array.isArray(block.content)
? block.content
.filter((c) => c?.type === "text" && typeof c.text === "string")
.map((c) => c.text)
.join("\n\n")
: null;
content.push({
type: "tool_result",
id: block.tool_use_id || null,
output: truncate(
typeof block.content === "string"
? block.content
: JSON.stringify(block.content || ""),
10240
),
output:
report !== null
? truncate(report, TEXT_MAX)
: truncate(
typeof block.content === "string"
? block.content
: JSON.stringify(block.content || ""),
10240
),
is_error: !!block.is_error,
...(diff ? { diff } : {}),
...(answers ? { answers } : {}),
...(agent ? { agent } : {}),
});
}
}
@@ -1574,7 +1596,10 @@ function ompMessage(entry, num, isSubagent = false) {
type: "tool_use",
name: c.name || "unknown",
id: c.id || null,
input: truncateObj(c.arguments && typeof c.arguments === "object" ? c.arguments : {}, 10240),
input: truncateObj(
c.arguments && typeof c.arguments === "object" ? c.arguments : {},
10240
),
});
}
}
@@ -1670,6 +1695,24 @@ function askAnswers(r) {
return Object.keys(out).length ? out : null;
}
/** An Agent/Task result's facts (`toolUseResult`): the subagent's id (its
* transcript is `agent-<id>.jsonl`), the model it ran on and, once it
* finished in the foreground, its time, tokens and tool calls. Null for any
* other result. */
function agentInfo(r) {
if (!r || typeof r !== "object" || typeof r.agentId !== "string") return null;
if (!/^[\w-]{1,200}$/.test(r.agentId)) return null;
const num = (v) => (Number.isFinite(v) ? v : null);
return {
id: r.agentId,
model: typeof r.resolvedModel === "string" ? r.resolvedModel : null,
status: typeof r.status === "string" ? r.status : null,
duration_ms: num(r.totalDurationMs),
tokens: num(r.totalTokens),
tool_uses: num(r.totalToolUseCount),
};
}
// A conversation turn — a prompt, an answer — is shown whole: it is bounded by
// the model's output and what the user typed. Only tool payloads and thinking
// (the parts that can run to megabytes) keep the 10 KB cap. This one guards
@@ -1694,3 +1737,4 @@ module.exports.sessionStats = sessionStats;
module.exports.classifyTranscriptSender = classifyTranscriptSender;
module.exports.patchCounts = patchCounts;
module.exports.askAnswers = askAnswers;
module.exports.agentInfo = agentInfo;