teapot-coding-agent 0.37.50 → 0.37.53
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/agent/agent.js +19 -31
- package/dist/agent/mcp-registry.js +41 -2
- package/package.json +1 -1
- package/public/assets/{index-J20qcMnK.js → index-BjvT2ngj.js} +5 -5
- package/public/assets/index-BjvT2ngj.js.map +1 -0
- package/public/assets/{index-BIbBKxvp.css → index-QdJYoEpR.css} +1 -1
- package/public/assets/{shiki-LgPvPv_g.js → shiki-FZoXUE5w.js} +2 -2
- package/public/assets/{shiki-LgPvPv_g.js.map → shiki-FZoXUE5w.js.map} +1 -1
- package/public/index.html +2 -2
- package/public/assets/index-J20qcMnK.js.map +0 -1
package/dist/agent/agent.js
CHANGED
|
@@ -933,14 +933,6 @@ export class Agent {
|
|
|
933
933
|
// `needs_operator` snapshot reported `live: false` until this was added.
|
|
934
934
|
this.status === "needs_operator");
|
|
935
935
|
}
|
|
936
|
-
/**
|
|
937
|
-
* Is this agent doing in-flight work that a WAITER (wait_children) should
|
|
938
|
-
* hold for? Deliberately narrower than isLive(): queued prompts are DORMANT
|
|
939
|
-
* work (a stopped/idle child touches them only after it is started), so
|
|
940
|
-
* they must not keep a parent parked on a child that is visibly idle —
|
|
941
|
-
* that wait would hang. isLive() answers "stop vs start" (#59/#133); this
|
|
942
|
-
* answers "is work in flight".
|
|
943
|
-
*/
|
|
944
936
|
/**
|
|
945
937
|
* The text of every prompt still waiting for a turn boundary.
|
|
946
938
|
*
|
|
@@ -951,6 +943,14 @@ export class Agent {
|
|
|
951
943
|
pendingPromptTexts() {
|
|
952
944
|
return this.pendingPrompts.map((p) => p.text);
|
|
953
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Is this agent doing in-flight work that a WAITER (wait_children) should
|
|
948
|
+
* hold for? Deliberately narrower than isLive(): queued prompts are DORMANT
|
|
949
|
+
* work (a stopped/idle child touches them only after it is started), so
|
|
950
|
+
* they must not keep a parent parked on a child that is visibly idle —
|
|
951
|
+
* that wait would hang. isLive() answers "stop vs start" (#59/#133); this
|
|
952
|
+
* answers "is work in flight".
|
|
953
|
+
*/
|
|
954
954
|
isBusy() {
|
|
955
955
|
if (this.stopRequested)
|
|
956
956
|
return false;
|
|
@@ -1080,11 +1080,6 @@ export class Agent {
|
|
|
1080
1080
|
bus.emit("update", { kind: "agent-update", agentId: this.opts.id });
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Restore the conversation from the JSONL log exactly once, on demand.
|
|
1085
|
-
* Everything that touches history (prompts, start, fork, UI selection)
|
|
1086
|
-
* funnels through here; boot stays cheap no matter how many sessions exist.
|
|
1087
|
-
*/
|
|
1088
1083
|
/**
|
|
1089
1084
|
* Resolve the session/workspace this agent operates on.
|
|
1090
1085
|
*
|
|
@@ -1255,16 +1250,6 @@ export class Agent {
|
|
|
1255
1250
|
/* keep the session copy if the agent-wide write failed — losing notes is worse */
|
|
1256
1251
|
}
|
|
1257
1252
|
}
|
|
1258
|
-
/**
|
|
1259
|
-
* Rebuild the in-memory conversation from the JSONL event log so a restart
|
|
1260
|
-
* continues where the agent left off instead of starting blank.
|
|
1261
|
-
*
|
|
1262
|
-
* Strategy: find the most recent event overall (its branch is where the
|
|
1263
|
-
* agent was), walk the `parent` chain backwards (crossing fork points),
|
|
1264
|
-
* then replay events forward into ChatMessages. Meta-tool calls
|
|
1265
|
-
* (finish / report_progress) never produced logged tool results, so we
|
|
1266
|
-
* synthesize their responses to keep the message sequence valid.
|
|
1267
|
-
*/
|
|
1268
1253
|
/**
|
|
1269
1254
|
* Resolve a leading sub_fork header: load the parent session's file (and
|
|
1270
1255
|
* recurse if THAT one is itself a sub_fork), take its lineage up to the
|
|
@@ -1306,6 +1291,17 @@ export class Agent {
|
|
|
1306
1291
|
prefix.shift();
|
|
1307
1292
|
return [...prefix, ...own.filter((e) => e !== header)];
|
|
1308
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Restore the conversation from the JSONL log exactly once, on demand.
|
|
1296
|
+
* Everything that touches history (prompts, start, fork, UI selection)
|
|
1297
|
+
* funnels through here; boot stays cheap no matter how many sessions exist.
|
|
1298
|
+
*
|
|
1299
|
+
* Strategy: find the most recent event overall (its branch is where the
|
|
1300
|
+
* agent was), walk the `parent` chain backwards (crossing fork points),
|
|
1301
|
+
* then replay events forward into ChatMessages. Meta-tool calls
|
|
1302
|
+
* (finish / report_progress) never produced logged tool results, so we
|
|
1303
|
+
* synthesize their responses to keep the message sequence valid.
|
|
1304
|
+
*/
|
|
1309
1305
|
async restoreFromLog() {
|
|
1310
1306
|
const own = await readEvents(this.log.filePath);
|
|
1311
1307
|
if (own.length === 0)
|
|
@@ -1620,14 +1616,6 @@ export class Agent {
|
|
|
1620
1616
|
await fs.writeFile(this.todoFile, text, "utf8");
|
|
1621
1617
|
await this.log.append("todo", this.currentSession, this.currentBranch, { event: "set", by });
|
|
1622
1618
|
}
|
|
1623
|
-
/**
|
|
1624
|
-
* Update SPECIFIC checkbox items without rewriting the whole list — the
|
|
1625
|
-
* full-replacement path made agents lazy (a mid-task progress tick meant
|
|
1626
|
-
* re-emitting the entire markdown, so they skipped updates) and risky (one
|
|
1627
|
-
* sloppy regeneration mangled unrelated sections). Items are matched by
|
|
1628
|
-
* normalized text; unknown items are reported back instead of silently
|
|
1629
|
-
* dropped. Returns a short human-readable summary for the tool result.
|
|
1630
|
-
*/
|
|
1631
1619
|
/**
|
|
1632
1620
|
* Apply surgical changes to todo.md.
|
|
1633
1621
|
*
|
|
@@ -176,8 +176,31 @@ export class McpRegistry {
|
|
|
176
176
|
st.status = "disabled";
|
|
177
177
|
return st;
|
|
178
178
|
}
|
|
179
|
-
if (st.status === "connected" && st.connection)
|
|
180
|
-
|
|
179
|
+
if (st.status === "connected" && st.connection) {
|
|
180
|
+
/**
|
|
181
|
+
* A cached connection is not proof the server is still there.
|
|
182
|
+
*
|
|
183
|
+
* This used to return immediately, so a server that restarted kept `status: "connected"` with
|
|
184
|
+
* its OLD tool list while the transport underneath was dead. The UI's `test` button opened a
|
|
185
|
+
* FRESH connection (`testConfig`), so it reported success and the tools appeared — and the
|
|
186
|
+
* agent, going through this cached path, could not call any of them. Reported as "test をすると
|
|
187
|
+
* 接続に成功するのに、エージェントからは呼べない".
|
|
188
|
+
*
|
|
189
|
+
* A cheap liveness probe settles it: a server that answers is reused, one that does not is
|
|
190
|
+
* dropped so the reconnect below builds a new transport. `tools()` is the cheapest call that
|
|
191
|
+
* exercises the transport for real (unlike reading the cached list).
|
|
192
|
+
*/
|
|
193
|
+
try {
|
|
194
|
+
st.tools = await st.connection.tools();
|
|
195
|
+
st.lastChecked = Date.now();
|
|
196
|
+
return st;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
st.connection = undefined;
|
|
200
|
+
st.tools = [];
|
|
201
|
+
st.status = "disconnected";
|
|
202
|
+
}
|
|
203
|
+
}
|
|
181
204
|
st.status = "connecting";
|
|
182
205
|
st.lastError = undefined;
|
|
183
206
|
const auth = await this.authFor(name);
|
|
@@ -254,6 +277,22 @@ export class McpRegistry {
|
|
|
254
277
|
return { ok: r.ok, text: r.text };
|
|
255
278
|
}
|
|
256
279
|
catch (err) {
|
|
280
|
+
/**
|
|
281
|
+
* A failed call means the transport is suspect, not just this one call.
|
|
282
|
+
*
|
|
283
|
+
* Leaving `status: "connected"` made the next attempt reuse the same dead connection, so one
|
|
284
|
+
* server restart broke every subsequent call until the process restarted. Dropping the
|
|
285
|
+
* connection here lets `connect()` rebuild it on the next attempt — and the tools list is
|
|
286
|
+
* cleared with it, because a stale list is what let the UI show tools that could not be called.
|
|
287
|
+
*/
|
|
288
|
+
const st = this.servers.get(parts.server);
|
|
289
|
+
if (st) {
|
|
290
|
+
st.connection = undefined;
|
|
291
|
+
st.tools = [];
|
|
292
|
+
st.status = "disconnected";
|
|
293
|
+
st.lastError = err.message;
|
|
294
|
+
st.lastChecked = Date.now();
|
|
295
|
+
}
|
|
257
296
|
return { ok: false, text: `MCP call failed: ${err.message}` };
|
|
258
297
|
}
|
|
259
298
|
}
|