teapot-coding-agent 0.37.109 → 0.37.110
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
CHANGED
|
@@ -304,6 +304,7 @@ export class Agent {
|
|
|
304
304
|
onIdleUnpark: () => this.unparkFromTool(),
|
|
305
305
|
hasPendingPrompts: () => this.pendingPrompts.length > 0,
|
|
306
306
|
onBackgroundExit: (info) => void this.onBackgroundJobExit(info),
|
|
307
|
+
onBackgroundStart: () => this.emitSnapshotUpdate(),
|
|
307
308
|
onFileRead: (p) => this.trackFileRead(p),
|
|
308
309
|
};
|
|
309
310
|
this.mainSession = path.basename(opts.sessionDir);
|
|
@@ -475,7 +476,17 @@ export class Agent {
|
|
|
475
476
|
trackFileRead(p) {
|
|
476
477
|
this.recentReads = [p, ...this.recentReads.filter((x) => x !== p)].slice(0, 5);
|
|
477
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* Push a fresh snapshot to the UI.
|
|
481
|
+
*
|
|
482
|
+
* `agent-update` is the only carrier of `bgRunning`, and it previously came from session-title writes only.
|
|
483
|
+
* Cheap: the snapshot is what the browser replaces on the other end anyway.
|
|
484
|
+
*/
|
|
485
|
+
emitSnapshotUpdate() {
|
|
486
|
+
bus.emit("update", { kind: "agent-update", agentId: this.opts.id });
|
|
487
|
+
}
|
|
478
488
|
onBackgroundJobExit(info) {
|
|
489
|
+
this.emitSnapshotUpdate();
|
|
479
490
|
const ok = info.code === 0;
|
|
480
491
|
const one = info.cmd.replace(/\s+/g, " ").slice(0, 80);
|
|
481
492
|
void this.log.append("system_note", this.currentSession, this.currentBranch, {
|
package/dist/agent/tools.js
CHANGED
|
@@ -296,6 +296,14 @@ function startBackgroundShell(cmd, ctx) {
|
|
|
296
296
|
child.on("exit", (code) => notify(code));
|
|
297
297
|
child.on("close", (code) => notify(code));
|
|
298
298
|
map.set(id, sh);
|
|
299
|
+
/**
|
|
300
|
+
* Tell the UI the count changed.
|
|
301
|
+
*
|
|
302
|
+
* The header badge reads `bgRunning` off the agent snapshot, and a snapshot only reaches the browser on an
|
|
303
|
+
* `agent-update` — which nothing emitted when a job started or finished, so the badge was right only after
|
|
304
|
+
* an unrelated update happened to arrive (#197 "クリックしないと値更新されなかった").
|
|
305
|
+
*/
|
|
306
|
+
ctx.onBackgroundStart?.(id);
|
|
299
307
|
return id;
|
|
300
308
|
}
|
|
301
309
|
export function isContextOverflow(err) {
|