@tranhoangnguyen0310/pi-flow-external 2.1.0-external.2 → 2.1.0-external.3

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/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ All notable changes to pi-flow external are documented here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [2.1.0-external.3] - 2026-09-18
8
+
9
+ ### Fixed
10
+
11
+ - Prevented Claude `is_error: true` result diagnostic from being mislabeled as assistant output on terminal error.
12
+ - Supported Pi `responseId` in `inspectRun` event-stream projection and added regression coverage for live Pi event inspection.
13
+ - Handled surrogate-pair boundaries when slicing the interrupted output tail and shared the `OUTPUT_PREVIEW_CHARS` constant across spawn and workflow receipts.
14
+ - Pinned spawn-level timeout rewrite behavior and workflow script `assistantOutput` error propagation in automated tests.
15
+
7
16
  ## [2.1.0-external.2] - 2026-09-18
8
17
 
9
18
  ### Fixed
@@ -13,6 +22,8 @@ All notable changes to pi-flow external are documented here.
13
22
  - `ChildRunError` preserves `partialOutput` and `assistantOutput` for workflow scripts to inspect, and uncaught child errors surface the interrupted output preview in workflow failure receipts.
14
23
  - Hardened CI release workflow polling loop against npm registry replication latency (increased timeout to 150s).
15
24
 
25
+ ## [2.1.0-external.1] - 2026-09-16
26
+
16
27
  ### Fixed
17
28
 
18
29
  - Coordinator guidance now names all four harnesses (`Agent` description, `buildCoordinatorPrompt` body): registered Pi harnesses are first-class alongside Claude Code/Codex CLI/Antigravity, not "external CLIs only" leftovers of the pre-2.1.0 copy. `test/agent-contract`/`agent-rendering` pin the copy.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tranhoangnguyen0310/pi-flow-external",
3
- "version": "2.1.0-external.2",
3
+ "version": "2.1.0-external.3",
4
4
  "description": "External Claude Code, Codex CLI, and Antigravity delegation for pi.",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -243,6 +243,9 @@ function structuredTextFromClaudeValue(value: unknown): string | undefined {
243
243
 
244
244
  export function extractClaudeFinalText(event: Record<string, unknown>): string | undefined {
245
245
  if (event.type === "result") {
246
+ if (event.is_error === true) {
247
+ return undefined;
248
+ }
246
249
  return (
247
250
  structuredTextFromClaudeValue(event.structured_output) ??
248
251
  (typeof event.result === "string" ? event.result : undefined)
@@ -51,10 +51,17 @@ export function assistantOutput(
51
51
  return output.length ? { status, messages: output } : undefined;
52
52
  }
53
53
 
54
+ export const OUTPUT_PREVIEW_CHARS = 4_000;
55
+
54
56
  export function formatInterruptedOutputPreview(output: SubagentAssistantOutput | undefined): string {
55
57
  if (!output?.messages?.length) return "";
56
58
  const text = output.messages.map((m) => m.text.trim()).filter(Boolean).join("\n\n");
57
- return text ? `\n\nInterrupted output:\n${text.slice(-4_000)}` : "";
59
+ if (!text) return "";
60
+ let slice = text.slice(-OUTPUT_PREVIEW_CHARS);
61
+ if (slice.length > 0 && slice.charCodeAt(0) >= 0xdc00 && slice.charCodeAt(0) <= 0xdfff) {
62
+ slice = slice.slice(1);
63
+ }
64
+ return `\n\nInterrupted output:\n${slice}`;
58
65
  }
59
66
 
60
67
  export function extractAssistantMessages(messages: readonly unknown[]): Array<{ id?: string; text: string }> {
@@ -373,7 +373,7 @@ function outputFromEvent(event: EvidenceEvent): ({ kind: "claude" | "codex" | "a
373
373
  const message = asRecord(backendEvent.message);
374
374
  if (message?.role === "assistant") {
375
375
  const text = extractTextContent(message.content);
376
- const id = asString(message.id);
376
+ const id = asString(message.id) ?? asString(message.responseId);
377
377
  return text ? { kind: "pi", ...(id ? { id } : {}), text } : undefined;
378
378
  }
379
379
  }
@@ -17,6 +17,7 @@ import { createRunRecord } from "../core/run-record.ts";
17
17
  import { runRecordsDirectory } from "../core/retention.ts";
18
18
  import { captureParentContext } from "../core/parent-context.ts";
19
19
  import { RunRegistry } from "../core/run-registry.ts";
20
+ import { OUTPUT_PREVIEW_CHARS } from "../core/progress.ts";
20
21
  import { filterExternalAgentProfiles, getSubagentProfiles, mergeSynthesizedPiProfiles, resolveExternalProfile } from "../profiles.ts";
21
22
  import { loadHarnessConfigs } from "../harnesses.ts";
22
23
  import { WORKFLOW_PROMPT_SNIPPET } from "../prompts.ts";
@@ -532,7 +533,7 @@ export function createWorkflowTool(
532
533
  }
533
534
  }
534
535
  const partial = error instanceof ChildRunError && error.partialOutput
535
- ? `\n\nInterrupted child output (${error.runId}):\n${error.partialOutput.slice(-4_000)}`
536
+ ? `\n\nInterrupted child output (${error.runId}):\n${error.partialOutput.slice(-OUTPUT_PREVIEW_CHARS)}`
536
537
  : "";
537
538
  return workflowResult(
538
539
  `Workflow "${metaName}" ${aborted ? "aborted" : "failed"}: ${message}${partial}${formatRecentLogs(snapshot.logs)}`,