gsd-pi 2.74.0-dev.14c45ac → 2.74.0-dev.28a6415
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/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +13 -13
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +70 -10
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +5 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +57 -21
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +84 -10
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +5 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +72 -23
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- /package/dist/web/standalone/.next/static/{ZMKM0OI0CrTgzKWbgfPOg → fMaWScj7m6EsI3DbaNv2_}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ZMKM0OI0CrTgzKWbgfPOg → fMaWScj7m6EsI3DbaNv2_}/_ssgManifest.js +0 -0
|
@@ -16,7 +16,13 @@ let lastContentLength = 0;
|
|
|
16
16
|
|
|
17
17
|
// --- Segment walker state (per streaming assistant turn) ---
|
|
18
18
|
type RenderedSegment =
|
|
19
|
-
| {
|
|
19
|
+
| {
|
|
20
|
+
kind: "text-run";
|
|
21
|
+
startIndex: number;
|
|
22
|
+
endIndex: number;
|
|
23
|
+
contentType: "text" | "thinking";
|
|
24
|
+
component: AssistantMessageComponent;
|
|
25
|
+
}
|
|
20
26
|
| { kind: "tool"; contentIndex: number; component: ToolExecutionComponent };
|
|
21
27
|
|
|
22
28
|
let renderedSegments: RenderedSegment[] = [];
|
|
@@ -319,44 +325,75 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|
|
319
325
|
}
|
|
320
326
|
return false;
|
|
321
327
|
});
|
|
322
|
-
const shouldDropPreToolText = isClaudeCodeProvider && hasMcpToolBlock;
|
|
323
328
|
const firstToolIdx = blocks.findIndex((b: any) => b.type === "toolCall" || b.type === "serverToolUse");
|
|
329
|
+
const hasPostToolText = firstToolIdx >= 0
|
|
330
|
+
&& blocks.some(
|
|
331
|
+
(b: any, idx: number) => (
|
|
332
|
+
idx > firstToolIdx
|
|
333
|
+
&& b?.type === "text"
|
|
334
|
+
&& typeof b?.text === "string"
|
|
335
|
+
&& b.text.trim().length > 0
|
|
336
|
+
),
|
|
337
|
+
);
|
|
338
|
+
// Only prune provisional pre-tool prose after post-tool prose exists,
|
|
339
|
+
// so MCP tool-only windows do not blank the assistant content.
|
|
340
|
+
const shouldDropPreToolProse = isClaudeCodeProvider && hasMcpToolBlock && hasPostToolText;
|
|
324
341
|
type DesiredSegment =
|
|
325
|
-
| { kind: "text-run"; startIndex: number; endIndex: number }
|
|
342
|
+
| { kind: "text-run"; startIndex: number; endIndex: number; contentType: "text" | "thinking" }
|
|
326
343
|
| { kind: "tool"; contentIndex: number; toolId: string };
|
|
327
344
|
const desired: DesiredSegment[] = [];
|
|
328
345
|
let runStart = -1;
|
|
346
|
+
let runEnd = -1;
|
|
347
|
+
let runType: "text" | "thinking" | undefined;
|
|
348
|
+
const closeRun = () => {
|
|
349
|
+
if (runStart !== -1 && runType) {
|
|
350
|
+
desired.push({ kind: "text-run", startIndex: runStart, endIndex: runEnd, contentType: runType });
|
|
351
|
+
runStart = -1;
|
|
352
|
+
runEnd = -1;
|
|
353
|
+
runType = undefined;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
329
356
|
for (let i = 0; i < blocks.length; i++) {
|
|
330
357
|
const b = blocks[i];
|
|
331
|
-
const
|
|
358
|
+
const blockType = b.type === "text" || b.type === "thinking" ? b.type : undefined;
|
|
359
|
+
const isTextLike = blockType === "text" || blockType === "thinking";
|
|
332
360
|
const isTool = b.type === "toolCall" || b.type === "serverToolUse";
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
361
|
+
// For Claude Code MCP turns, prune only pre-tool prose, never thinking.
|
|
362
|
+
const shouldSkipProse = shouldDropPreToolProse && firstToolIdx >= 0 && i < firstToolIdx && blockType === "text";
|
|
363
|
+
if (shouldSkipProse) {
|
|
364
|
+
closeRun();
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (isTextLike) {
|
|
368
|
+
if (runStart === -1) {
|
|
369
|
+
runStart = i;
|
|
370
|
+
runEnd = i;
|
|
371
|
+
runType = blockType;
|
|
372
|
+
} else if (runType !== blockType) {
|
|
373
|
+
closeRun();
|
|
374
|
+
runStart = i;
|
|
375
|
+
runEnd = i;
|
|
376
|
+
runType = blockType;
|
|
377
|
+
} else {
|
|
378
|
+
runEnd = i;
|
|
336
379
|
}
|
|
337
|
-
if (runStart === -1) runStart = i;
|
|
338
380
|
} else {
|
|
339
|
-
|
|
340
|
-
desired.push({ kind: "text-run", startIndex: runStart, endIndex: i - 1 });
|
|
341
|
-
runStart = -1;
|
|
342
|
-
}
|
|
381
|
+
closeRun();
|
|
343
382
|
if (isTool) {
|
|
344
383
|
desired.push({ kind: "tool", contentIndex: i, toolId: b.id });
|
|
345
384
|
}
|
|
346
385
|
}
|
|
347
386
|
}
|
|
348
|
-
|
|
349
|
-
desired.push({ kind: "text-run", startIndex: runStart, endIndex: blocks.length - 1 });
|
|
350
|
-
}
|
|
387
|
+
closeRun();
|
|
351
388
|
|
|
352
389
|
// Claude Code MCP can emit provisional pre-tool prose that gets
|
|
353
390
|
// superseded by post-tool output. Prune stale text-run segments so
|
|
354
391
|
// the final assistant output remains below tool output.
|
|
355
|
-
if (
|
|
392
|
+
if (shouldDropPreToolProse && firstToolIdx >= 0) {
|
|
356
393
|
if (orphanedSegments.length > 0) {
|
|
357
394
|
const remainingOrphans: RenderedSegment[] = [];
|
|
358
395
|
for (const orphan of orphanedSegments) {
|
|
359
|
-
if (orphan.kind === "text-run") {
|
|
396
|
+
if (orphan.kind === "text-run" && orphan.contentType === "text") {
|
|
360
397
|
host.chatContainer.removeChild(orphan.component);
|
|
361
398
|
if (host.streamingComponent === orphan.component) {
|
|
362
399
|
host.streamingComponent = undefined;
|
|
@@ -367,10 +404,10 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|
|
367
404
|
}
|
|
368
405
|
orphanedSegments = remainingOrphans;
|
|
369
406
|
}
|
|
370
|
-
const
|
|
407
|
+
const desiredTextKeys = new Set(
|
|
371
408
|
desired
|
|
372
409
|
.filter((seg): seg is Extract<DesiredSegment, { kind: "text-run" }> => seg.kind === "text-run")
|
|
373
|
-
.map((seg) => seg.startIndex),
|
|
410
|
+
.map((seg) => `${seg.contentType}:${seg.startIndex}`),
|
|
374
411
|
);
|
|
375
412
|
const desiredToolIndices = new Set(
|
|
376
413
|
desired
|
|
@@ -379,7 +416,11 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|
|
379
416
|
);
|
|
380
417
|
const nextRendered: RenderedSegment[] = [];
|
|
381
418
|
for (const seg of renderedSegments) {
|
|
382
|
-
if (
|
|
419
|
+
if (
|
|
420
|
+
seg.kind === "text-run"
|
|
421
|
+
&& seg.contentType === "text"
|
|
422
|
+
&& !desiredTextKeys.has(`${seg.contentType}:${seg.startIndex}`)
|
|
423
|
+
) {
|
|
383
424
|
host.chatContainer.removeChild(seg.component);
|
|
384
425
|
if (host.streamingComponent === seg.component) {
|
|
385
426
|
host.streamingComponent = undefined;
|
|
@@ -411,7 +452,7 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|
|
411
452
|
} else {
|
|
412
453
|
// text-run segment
|
|
413
454
|
const existing = renderedSegments.find(
|
|
414
|
-
(s) => s.kind === "text-run" && s.startIndex === seg.startIndex,
|
|
455
|
+
(s) => s.kind === "text-run" && s.startIndex === seg.startIndex && s.contentType === seg.contentType,
|
|
415
456
|
);
|
|
416
457
|
if (!existing) {
|
|
417
458
|
const comp = new AssistantMessageComponent(
|
|
@@ -422,7 +463,13 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|
|
422
463
|
{ startIndex: seg.startIndex, endIndex: seg.endIndex },
|
|
423
464
|
);
|
|
424
465
|
host.chatContainer.addChild(comp);
|
|
425
|
-
renderedSegments.push({
|
|
466
|
+
renderedSegments.push({
|
|
467
|
+
kind: "text-run",
|
|
468
|
+
startIndex: seg.startIndex,
|
|
469
|
+
endIndex: seg.endIndex,
|
|
470
|
+
contentType: seg.contentType,
|
|
471
|
+
component: comp,
|
|
472
|
+
});
|
|
426
473
|
host.streamingComponent = comp;
|
|
427
474
|
}
|
|
428
475
|
}
|
|
@@ -433,7 +480,9 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|
|
433
480
|
for (const seg of renderedSegments) {
|
|
434
481
|
if (seg.kind === "text-run") {
|
|
435
482
|
// Find corresponding desired segment to get current endIndex
|
|
436
|
-
const d = desired.find(
|
|
483
|
+
const d = desired.find(
|
|
484
|
+
(ds) => ds.kind === "text-run" && ds.startIndex === seg.startIndex && ds.contentType === seg.contentType,
|
|
485
|
+
);
|
|
437
486
|
if (d && d.kind === "text-run" && d.endIndex !== seg.endIndex) {
|
|
438
487
|
seg.endIndex = d.endIndex;
|
|
439
488
|
seg.component.setRange({ startIndex: seg.startIndex, endIndex: seg.endIndex });
|