teapot-coding-agent 0.37.164 → 0.37.165

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.
@@ -1284,7 +1284,18 @@ export class Agent {
1284
1284
  autoCompact: this.opts.autoCompact,
1285
1285
  };
1286
1286
  }
1287
- enqueuePrompt(text, source = "user", images) {
1287
+ enqueuePrompt(text, source = "user", images,
1288
+ /**
1289
+ * The id the CLIENT already drew the row with.
1290
+ *
1291
+ * A prompt used to get one id from the browser (`@p…`, the optimistic row) and another from the server (`p…`, the
1292
+ * log row, the queue entry, the delivery note). Two ids for one prompt means the row has to be re-created when the
1293
+ * second one arrives, and every "is it still queued?" test has to guess which id it is looking at — MEASURED as
1294
+ * four different symptoms of the same thing: a prompt sent to an idle agent blinking "queued…", the FIRST prompt of
1295
+ * a queued run showing a timestamp instead of "queued…", and adding a prompt behind a queue briefly rendering as
1296
+ * settled. The client now proposes the id and this is it.
1297
+ */
1298
+ clientId) {
1288
1299
  if (this.parkedByTool) {
1289
1300
  this.toolAbort.abort();
1290
1301
  this.toolAbort = new AbortController();
@@ -1305,9 +1316,12 @@ export class Agent {
1305
1316
  * client — no row, no count — which is the remaining half of "harnessからのメッセージにqueuedがついてない問題が
1306
1317
  * v0.37.160 でもあった".
1307
1318
  */
1308
- const promptId = source === "user"
1309
- ? `u${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`
1310
- : `h${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
1319
+ const proposed = String(clientId ?? "").trim();
1320
+ const usable = /^[A-Za-z0-9@_-]{1,64}$/.test(proposed) ? proposed : "";
1321
+ const promptId = usable ||
1322
+ (source === "user"
1323
+ ? `u${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`
1324
+ : `h${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`);
1311
1325
  const entry = { source, text, images, id: promptId };
1312
1326
  this.pendingPrompts.push(entry);
1313
1327
  void this.ensureReady()
@@ -870,7 +870,7 @@ export function buildApp(master) {
870
870
  });
871
871
  const text = body.text ?? "";
872
872
  const src = body.source === "harness" ? "harness" : "user";
873
- const promptId = a.enqueuePrompt(text || "(see attached image)", src, images.length ? images : undefined);
873
+ const promptId = a.enqueuePrompt(text || "(see attached image)", src, images.length ? images : undefined, body.clientId);
874
874
  if (body.start !== false && a.status !== "running")
875
875
  a.start("prompt");
876
876
  return c.json({ ok: true, promptId, queued: a.snapshot().pendingPrompts });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.164",
3
+ "version": "0.37.165",
4
4
  "description": "A lightweight, always-on multi-agent harness for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",