@standardagents/code 0.9.9 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -249,6 +249,13 @@ var ApiClient = class {
|
|
|
249
249
|
async verify() {
|
|
250
250
|
return (await this.verifyDetailed()).ok;
|
|
251
251
|
}
|
|
252
|
+
/** Replace a thread's tags (published `PATCH /api/threads/:id { tags }`). */
|
|
253
|
+
async setThreadTags(threadId, tags) {
|
|
254
|
+
await this.json(`/api/threads/${threadId}`, {
|
|
255
|
+
method: "PATCH",
|
|
256
|
+
body: JSON.stringify({ tags })
|
|
257
|
+
});
|
|
258
|
+
}
|
|
252
259
|
/**
|
|
253
260
|
* Re-point a thread's ROOT agent (mid-session agent switch). The runtime
|
|
254
261
|
* treats this as an explicit handoff: the full conversation is preserved
|
|
@@ -3045,7 +3052,8 @@ function parseToolCalls(message) {
|
|
|
3045
3052
|
return [{ id, name, arguments: parseObject(item?.function?.arguments ?? item?.arguments ?? item?.args) }];
|
|
3046
3053
|
});
|
|
3047
3054
|
}
|
|
3048
|
-
|
|
3055
|
+
var EMPTY_BOUNDARY_STALE_MS = 15e4;
|
|
3056
|
+
function deriveSessionActivity(messages, nowMs = Date.now()) {
|
|
3049
3057
|
const visible = messages.filter((message) => message.silent !== true && message.metadata?.silent !== true).sort((a, b) => createdAt(a) - createdAt(b));
|
|
3050
3058
|
if (visible.some((message) => message.status === "pending")) return { busy: true, currentTool: unresolvedTool(visible) };
|
|
3051
3059
|
const last = visible.at(-1);
|
|
@@ -3054,6 +3062,11 @@ function deriveSessionActivity(messages) {
|
|
|
3054
3062
|
if (currentTool) return { busy: true, currentTool };
|
|
3055
3063
|
if (last.role === "user" || last.role === "tool") return { busy: true, currentTool: null };
|
|
3056
3064
|
if (last.role === "assistant" && last.status !== "failed" && !messageText(last.content).trim()) {
|
|
3065
|
+
const raw = createdAt(last);
|
|
3066
|
+
const lastMs = raw > 1e14 ? raw / 1e3 : raw < 1e12 ? raw * 1e3 : raw;
|
|
3067
|
+
if (lastMs > 0 && nowMs - lastMs > EMPTY_BOUNDARY_STALE_MS) {
|
|
3068
|
+
return { busy: false, currentTool: null };
|
|
3069
|
+
}
|
|
3057
3070
|
return { busy: true, currentTool: null };
|
|
3058
3071
|
}
|
|
3059
3072
|
return { busy: false, currentTool: null };
|
|
@@ -6840,6 +6853,12 @@ Run \`standardcode daemon install\` (or plain \`standardcode\`) once to sign in.
|
|
|
6840
6853
|
await worker.start();
|
|
6841
6854
|
void registerProject(api, identity, projectDir).catch(() => {
|
|
6842
6855
|
});
|
|
6856
|
+
const rawPath = tags.find((t) => t.startsWith("path:"))?.slice("path:".length);
|
|
6857
|
+
if (rawPath && rawPath !== projectDir) {
|
|
6858
|
+
const fixed = tags.map((t) => t === `path:${rawPath}` ? `path:${projectDir}` : t);
|
|
6859
|
+
void api.setThreadTags(threadId, fixed).catch(() => {
|
|
6860
|
+
});
|
|
6861
|
+
}
|
|
6843
6862
|
};
|
|
6844
6863
|
const detach = (threadId) => {
|
|
6845
6864
|
const worker = workers.get(threadId);
|