teapot-coding-agent 0.37.164 → 0.37.166
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 +34 -4
- package/dist/server/api.js +8 -2
- package/package.json +1 -1
- package/public/assets/index-Dx_NfYKj.js +190 -0
- package/public/assets/index-Dx_NfYKj.js.map +1 -0
- package/public/assets/index-uIEhZyeX.css +1 -0
- package/public/index.html +2 -2
- package/public/assets/index-DqXUCh0w.css +0 -1
- package/public/assets/index-VCUYKJyD.js +0 -190
- package/public/assets/index-VCUYKJyD.js.map +0 -1
package/dist/agent/agent.js
CHANGED
|
@@ -228,6 +228,22 @@ export class Agent {
|
|
|
228
228
|
return this.opts.provider;
|
|
229
229
|
}
|
|
230
230
|
pendingPrompts = [];
|
|
231
|
+
/**
|
|
232
|
+
* Will this prompt WAIT, and behind how much? The server's answer, because only the server knows.
|
|
233
|
+
*
|
|
234
|
+
* The client used to decide from a snapshot it happened to hold (`pendingPrompts`, which lags) and from its own
|
|
235
|
+
* leftover echoes, and MEASURED that as the surviving half of "idle状態でプロンプトを送っても一瞬queuedになる問題":
|
|
236
|
+
* a prompt to an idle agent still flickered "queued…". A prompt waits behind the prompts already queued and behind a
|
|
237
|
+
* turn that is still running — nothing else.
|
|
238
|
+
*/
|
|
239
|
+
pendingAheadOf(id) {
|
|
240
|
+
const idx = this.pendingPrompts.findIndex((p) => p.id === id);
|
|
241
|
+
if (idx < 0)
|
|
242
|
+
return 0;
|
|
243
|
+
const queuedAhead = idx;
|
|
244
|
+
const turnRunning = this.status === "running" ? 1 : 0;
|
|
245
|
+
return queuedAhead + (queuedAhead === 0 ? turnRunning : 0);
|
|
246
|
+
}
|
|
231
247
|
stopRequested = false;
|
|
232
248
|
windDownRequested = false;
|
|
233
249
|
wake = null;
|
|
@@ -1284,7 +1300,18 @@ export class Agent {
|
|
|
1284
1300
|
autoCompact: this.opts.autoCompact,
|
|
1285
1301
|
};
|
|
1286
1302
|
}
|
|
1287
|
-
enqueuePrompt(text, source = "user", images
|
|
1303
|
+
enqueuePrompt(text, source = "user", images,
|
|
1304
|
+
/**
|
|
1305
|
+
* The id the CLIENT already drew the row with.
|
|
1306
|
+
*
|
|
1307
|
+
* A prompt used to get one id from the browser (`@p…`, the optimistic row) and another from the server (`p…`, the
|
|
1308
|
+
* log row, the queue entry, the delivery note). Two ids for one prompt means the row has to be re-created when the
|
|
1309
|
+
* second one arrives, and every "is it still queued?" test has to guess which id it is looking at — MEASURED as
|
|
1310
|
+
* four different symptoms of the same thing: a prompt sent to an idle agent blinking "queued…", the FIRST prompt of
|
|
1311
|
+
* a queued run showing a timestamp instead of "queued…", and adding a prompt behind a queue briefly rendering as
|
|
1312
|
+
* settled. The client now proposes the id and this is it.
|
|
1313
|
+
*/
|
|
1314
|
+
clientId) {
|
|
1288
1315
|
if (this.parkedByTool) {
|
|
1289
1316
|
this.toolAbort.abort();
|
|
1290
1317
|
this.toolAbort = new AbortController();
|
|
@@ -1305,9 +1332,12 @@ export class Agent {
|
|
|
1305
1332
|
* client — no row, no count — which is the remaining half of "harnessからのメッセージにqueuedがついてない問題が
|
|
1306
1333
|
* v0.37.160 でもあった".
|
|
1307
1334
|
*/
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1310
|
-
|
|
1335
|
+
const proposed = String(clientId ?? "").trim();
|
|
1336
|
+
const usable = /^[A-Za-z0-9@_-]{1,64}$/.test(proposed) ? proposed : "";
|
|
1337
|
+
const promptId = usable ||
|
|
1338
|
+
(source === "user"
|
|
1339
|
+
? `u${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`
|
|
1340
|
+
: `h${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`);
|
|
1311
1341
|
const entry = { source, text, images, id: promptId };
|
|
1312
1342
|
this.pendingPrompts.push(entry);
|
|
1313
1343
|
void this.ensureReady()
|
package/dist/server/api.js
CHANGED
|
@@ -870,10 +870,16 @@ 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
|
+
/**
|
|
875
|
+
* `ahead` is the answer the client draws "queued…" from — computed BEFORE `start()` flips the status, so a prompt
|
|
876
|
+
* that starts the agent reports 0 and never blinks queued. `queued` (a count taken after the enqueue, so always ≥ 1)
|
|
877
|
+
* stays for the API's older callers but is not what the row uses any more.
|
|
878
|
+
*/
|
|
879
|
+
const ahead = a.pendingAheadOf(promptId);
|
|
874
880
|
if (body.start !== false && a.status !== "running")
|
|
875
881
|
a.start("prompt");
|
|
876
|
-
return c.json({ ok: true, promptId, queued: a.snapshot().pendingPrompts });
|
|
882
|
+
return c.json({ ok: true, promptId, ahead, queued: a.snapshot().pendingPrompts });
|
|
877
883
|
});
|
|
878
884
|
/**
|
|
879
885
|
* Force-load and follow a skill.
|