clementine-agent 1.0.66 → 1.0.67
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/assistant.js +2 -43
- package/package.json +1 -1
package/dist/agent/assistant.js
CHANGED
|
@@ -2268,39 +2268,6 @@ You have a cost budget per message — not a hard turn limit. Work until the tas
|
|
|
2268
2268
|
// always-on canaries for future SDK regressions.)
|
|
2269
2269
|
const stream = query({ prompt, options: sdkOptions });
|
|
2270
2270
|
let gotStreamEvents = false;
|
|
2271
|
-
// Live status text shown to the user while model is thinking / calling
|
|
2272
|
-
// tools. Rendered as italic markdown lines prepended to the reply.
|
|
2273
|
-
// Stripped from the final `responseText` before return so transcripts
|
|
2274
|
-
// stay clean. Feels like motion — a 30s turn no longer looks frozen.
|
|
2275
|
-
let statusText = '';
|
|
2276
|
-
const hasStreamingSurface = typeof onText === 'function';
|
|
2277
|
-
const flushStatus = async () => {
|
|
2278
|
-
if (!hasStreamingSurface)
|
|
2279
|
-
return;
|
|
2280
|
-
const combined = statusText
|
|
2281
|
-
? (responseText ? `${statusText}\n\n${responseText}` : statusText)
|
|
2282
|
-
: responseText;
|
|
2283
|
-
try {
|
|
2284
|
-
await onText(combined);
|
|
2285
|
-
}
|
|
2286
|
-
catch { /* non-fatal */ }
|
|
2287
|
-
};
|
|
2288
|
-
// Pre-first-token status: show something within the first ~2s so the
|
|
2289
|
-
// user knows the daemon got the message and is working. Derived from
|
|
2290
|
-
// intent classifier type → short phrase; generic otherwise.
|
|
2291
|
-
if (hasStreamingSurface) {
|
|
2292
|
-
const hintMap = {
|
|
2293
|
-
question: 'Looking into that',
|
|
2294
|
-
task: 'On it',
|
|
2295
|
-
feedback: 'Got it',
|
|
2296
|
-
casual: 'One sec',
|
|
2297
|
-
followup: 'Picking that up',
|
|
2298
|
-
correction: 'Got it — correcting',
|
|
2299
|
-
};
|
|
2300
|
-
const hint = (intentClassification?.type && hintMap[intentClassification.type]) || 'Working on it';
|
|
2301
|
-
statusText = `_${hint}…_`;
|
|
2302
|
-
await flushStatus();
|
|
2303
|
-
}
|
|
2304
2271
|
for await (const message of stream) {
|
|
2305
2272
|
// Capture assistant + user messages for post-turn contradiction
|
|
2306
2273
|
// validation. Must happen before the switch below so we catch
|
|
@@ -2317,20 +2284,12 @@ You have a cost budget per message — not a hard turn limit. Work until the tas
|
|
|
2317
2284
|
// received stream_event deltas (which already accumulated text)
|
|
2318
2285
|
responseText += block.text;
|
|
2319
2286
|
if (onText)
|
|
2320
|
-
await onText(
|
|
2287
|
+
await onText(responseText);
|
|
2321
2288
|
}
|
|
2322
2289
|
else if (block.type === 'tool_use' && block.name) {
|
|
2323
2290
|
logToolUse(block.name, (block.input ?? {}));
|
|
2324
2291
|
if (sessionKey)
|
|
2325
2292
|
eventLog.emitToolCall(sessionKey, block.name, (block.input ?? {}));
|
|
2326
|
-
// Append a one-line tool-use status to the live stream so
|
|
2327
|
-
// the user sees real progress during multi-turn ops.
|
|
2328
|
-
if (hasStreamingSurface) {
|
|
2329
|
-
const shortName = block.name.replace(/^mcp__[^_]+(?:_[^_]+)*__/, '').slice(0, 50);
|
|
2330
|
-
const line = `_→ ${shortName}_`;
|
|
2331
|
-
statusText = statusText ? `${statusText}\n${line}` : line;
|
|
2332
|
-
await flushStatus();
|
|
2333
|
-
}
|
|
2334
2293
|
if (onToolActivity) {
|
|
2335
2294
|
try {
|
|
2336
2295
|
await onToolActivity(block.name, (block.input ?? {}));
|
|
@@ -2359,7 +2318,7 @@ You have a cost budget per message — not a hard turn limit. Work until the tas
|
|
|
2359
2318
|
if (evt.type === 'content_block_delta' && evt.delta?.type === 'text_delta' && evt.delta.text) {
|
|
2360
2319
|
responseText += evt.delta.text;
|
|
2361
2320
|
if (onText)
|
|
2362
|
-
await onText(
|
|
2321
|
+
await onText(responseText);
|
|
2363
2322
|
}
|
|
2364
2323
|
}
|
|
2365
2324
|
else if (message.type === 'result') {
|