@cydm/pie 2.7.2 → 2.7.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.
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createAskUserCapability
4
- } from "../../../chunks/chunk-65B6P5J5.js";
5
- import "../../../chunks/chunk-GZDAIW6F.js";
6
- import "../../../chunks/chunk-BRFP5WZ6.js";
4
+ } from "../../../chunks/chunk-F3U2TYDT.js";
5
+ import "../../../chunks/chunk-MPTME6HX.js";
6
+ import "../../../chunks/chunk-E5JQ5SVA.js";
7
7
  import "../../../chunks/chunk-XXGYUYXI.js";
8
8
  import "../../../chunks/chunk-LZQXQOPJ.js";
9
9
 
@@ -7,9 +7,9 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-65B6P5J5.js";
11
- import "../../../chunks/chunk-GZDAIW6F.js";
12
- import "../../../chunks/chunk-BRFP5WZ6.js";
10
+ } from "../../../chunks/chunk-F3U2TYDT.js";
11
+ import "../../../chunks/chunk-MPTME6HX.js";
12
+ import "../../../chunks/chunk-E5JQ5SVA.js";
13
13
  import {
14
14
  Type
15
15
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -3,14 +3,14 @@ import {
3
3
  createCliHostCapabilities,
4
4
  formatTransportLifecycle,
5
5
  logTransportLifecycle
6
- } from "../../../chunks/chunk-GECAIKZL.js";
6
+ } from "../../../chunks/chunk-WLLZTG4W.js";
7
7
  import {
8
8
  SUBAGENT_SESSION_RECORD_VERSION,
9
9
  createSharedFileSystemTools,
10
10
  createSubagentCapability
11
- } from "../../../chunks/chunk-65B6P5J5.js";
12
- import "../../../chunks/chunk-GZDAIW6F.js";
13
- import "../../../chunks/chunk-BRFP5WZ6.js";
11
+ } from "../../../chunks/chunk-F3U2TYDT.js";
12
+ import "../../../chunks/chunk-MPTME6HX.js";
13
+ import "../../../chunks/chunk-E5JQ5SVA.js";
14
14
  import "../../../chunks/chunk-XXGYUYXI.js";
15
15
  import "../../../chunks/chunk-LZQXQOPJ.js";
16
16
 
@@ -8,9 +8,9 @@ import {
8
8
  executeManageTodoList,
9
9
  executionStateToTodos,
10
10
  restoreExecutionState
11
- } from "../../../chunks/chunk-65B6P5J5.js";
12
- import "../../../chunks/chunk-GZDAIW6F.js";
13
- import "../../../chunks/chunk-BRFP5WZ6.js";
11
+ } from "../../../chunks/chunk-F3U2TYDT.js";
12
+ import "../../../chunks/chunk-MPTME6HX.js";
13
+ import "../../../chunks/chunk-E5JQ5SVA.js";
14
14
  import "../../../chunks/chunk-XXGYUYXI.js";
15
15
  import "../../../chunks/chunk-LZQXQOPJ.js";
16
16
 
@@ -5697,6 +5697,7 @@ function streamResponsesSSE(model, context, options) {
5697
5697
  let totalTimer;
5698
5698
  let internalTimeout;
5699
5699
  let localFailure = false;
5700
+ let providerRejected = false;
5700
5701
  const requestAbort = new AbortController();
5701
5702
  const onUserAbort = () => requestAbort.abort();
5702
5703
  const clearTotalTimer = () => {
@@ -5790,6 +5791,7 @@ function streamResponsesSSE(model, context, options) {
5790
5791
  });
5791
5792
  if (!response.ok) {
5792
5793
  const errorBody = await response.text().catch(() => "");
5794
+ providerRejected = true;
5793
5795
  throw new Error(`API error ${response.status}: ${errorBody}`);
5794
5796
  }
5795
5797
  if (!response.readSSELines) {
@@ -5852,16 +5854,21 @@ function streamResponsesSSE(model, context, options) {
5852
5854
  internalTimeout = adapterTimeoutKind === "first_byte" ? "first_response" : "stream_idle";
5853
5855
  }
5854
5856
  message.errorMessage = internalTimeout ? `Responses request timeout (${internalTimeout}) after ${Math.round(monotonicNow() - startedAt)}ms` : error instanceof Error ? error.message : JSON.stringify(error);
5855
- if (internalTimeout && getResponsesCompat(model).timeoutReplay) {
5857
+ const compat = getResponsesCompat(model);
5858
+ const streamLost = !internalTimeout && submitted && !localFailure && !providerRejected && message.stopReason === "error";
5859
+ if (internalTimeout && compat.timeoutReplay) {
5856
5860
  message.replayEligible = true;
5857
5861
  message.replayClass = internalTimeout;
5862
+ } else if (streamLost && compat.timeoutReplay) {
5863
+ message.replayEligible = true;
5864
+ message.replayClass = receivedMessageCount === 0 ? "stream_lost" : "stream_lost_partial";
5858
5865
  }
5859
- if (submitted || localFailure) message.retryable = false;
5866
+ if ((submitted || localFailure) && !(streamLost && receivedMessageCount === 0)) message.retryable = false;
5860
5867
  phase = "cleanup";
5861
5868
  lifecycle({
5862
5869
  timeoutKind: internalTimeout,
5863
- retryAllowed: !submitted && !userAborted && !localFailure,
5864
- retryDecision: submitted ? "not_retryable_after_submission" : localFailure ? "local_configuration_error" : "not_submitted",
5870
+ retryAllowed: !userAborted && !localFailure && message.retryable !== false,
5871
+ retryDecision: streamLost ? receivedMessageCount === 0 ? message.replayEligible ? "replay_exempt_stream_lost" : "stream_lost_no_evidence" : message.replayEligible ? "replay_exempt_after_submission" : "not_retryable_after_submission" : submitted ? "not_retryable_after_submission" : localFailure ? "local_configuration_error" : "not_submitted",
5865
5872
  cancelSource: userAborted ? "user" : internalTimeout ? "internal_timeout" : "none",
5866
5873
  cleanupOutcome: "request_abandoned"
5867
5874
  });
@@ -6310,13 +6317,21 @@ function streamResponsesWS(model, context, options) {
6310
6317
  message.stopReason = userAborted || ownerDisposed ? "aborted" : "error";
6311
6318
  const cause = timedOut ? `Responses request timeout (${timedOut}) after ${ageMs()}ms` : error instanceof Error ? error.message : String(error);
6312
6319
  message.errorMessage = cause;
6320
+ const streamLost = !timedOut && message.stopReason === "error";
6313
6321
  if (timedOut && compat.timeoutReplay) {
6314
6322
  message.replayEligible = true;
6315
6323
  message.replayClass = timedOut;
6324
+ } else if (streamLost && compat.timeoutReplay) {
6325
+ message.replayEligible = true;
6326
+ message.replayClass = receivedMessageCount === 0 ? "stream_lost" : "stream_lost_partial";
6316
6327
  }
6317
6328
  if (sent) {
6318
- message.retryable = false;
6319
- retryDecision = "not_retryable_after_submission";
6329
+ if (streamLost && receivedMessageCount === 0) {
6330
+ retryDecision = message.replayEligible ? "replay_exempt_stream_lost" : "stream_lost_no_evidence";
6331
+ } else {
6332
+ message.retryable = false;
6333
+ if (!timedOut) retryDecision = message.replayEligible ? "replay_exempt_after_submission" : "not_retryable_after_submission";
6334
+ }
6320
6335
  }
6321
6336
  cleanupCancelSource = userAborted ? "user" : timedOut ? "internal_timeout" : ownerDisposed ? "owner_disposal" : "none";
6322
6337
  stream.push({ type: "error", reason: message.stopReason, error: message });
@@ -6338,7 +6353,7 @@ function streamResponsesWS(model, context, options) {
6338
6353
  terminalAccepted: finished,
6339
6354
  timeoutKind: timedOut,
6340
6355
  submissionAttempted: sent,
6341
- retryAllowed: !finished && !sent && reducer.message.stopReason !== "aborted" && reducer.message.retryable !== false,
6356
+ retryAllowed: !finished && reducer.message.stopReason !== "aborted" && reducer.message.retryable !== false,
6342
6357
  cancelSource,
6343
6358
  retryDecision,
6344
6359
  cleanupOutcome
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  Agent,
4
4
  getToolCallerIdentity
5
- } from "./chunk-GZDAIW6F.js";
5
+ } from "./chunk-MPTME6HX.js";
6
6
  import {
7
7
  AssistantMessageEventStream,
8
8
  FileSystemGateway,
@@ -12,7 +12,7 @@ import {
12
12
  getPlatformConfig,
13
13
  hashText,
14
14
  streamSimple
15
- } from "./chunk-BRFP5WZ6.js";
15
+ } from "./chunk-E5JQ5SVA.js";
16
16
  import {
17
17
  Type
18
18
  } from "./chunk-XXGYUYXI.js";
@@ -3286,9 +3286,10 @@ function isTransientCompactionFailure(error) {
3286
3286
  if (record?.name === "AbortError" || /request was aborted|local abort signal|user abort|user_interrupt|interrupted by user|esc pressed|ctrl\+c|\bcancel(?:led|ed)\b|insufficient[_ ]quota|exceeded[_ ]current[_ ]quota|exceeded your current quota|insufficient[_ ]balance|credit balance is too low|\barrearage\b|余额不足|\b(?:account|monthly|billing) quota (?:has been |is )?exhausted|billing|invalid api key|unauthorized|forbidden/i.test(text)) return false;
3287
3287
  const status = record?.status ?? record?.statusCode;
3288
3288
  if (status !== void 0) return status === 429 || status >= 500 && status <= 599;
3289
- return /\b(?:429|5\d\d|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|ECONNREFUSED|EPIPE)\b|fetch failed|network error|request timeout|socket hang up|connection error|sse stream (?:aborted|closed before end|ended before response completed)|rate.?limit|too many requests|overloaded|service unavailable/i.test(text);
3289
+ return /\b(?:429|5\d\d|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|ECONNREFUSED|EPIPE)\b|fetch failed|network error|request timeout|socket hang up|connection error|sse stream (?:aborted|closed before end|ended before response completed)|responses stream ended without a terminal event|rate.?limit|too many requests|overloaded|service unavailable/i.test(text);
3290
3290
  }
3291
3291
  function explicitlyNonRetryable(error) {
3292
+ if (Boolean(error && typeof error === "object" && error.replayEligible === true)) return false;
3292
3293
  return Boolean(error && typeof error === "object" && error.retryable === false);
3293
3294
  }
3294
3295
  function waitForCompactionRetry(delayMs, signal) {
@@ -3346,6 +3347,7 @@ Return a text-only successor handoff. Do not call any tools.` }],
3346
3347
  const providerError = new Error(response.errorMessage || "Compaction provider error");
3347
3348
  const explicitRetryable = response.retryable;
3348
3349
  if (typeof explicitRetryable === "boolean") providerError.retryable = explicitRetryable;
3350
+ if (response.replayEligible === true) providerError.replayEligible = true;
3349
3351
  throw providerError;
3350
3352
  }
3351
3353
  } catch (error) {
@@ -4,7 +4,7 @@ import {
4
4
  disposeModelTransports,
5
5
  streamSimple,
6
6
  validateToolArguments
7
- } from "./chunk-BRFP5WZ6.js";
7
+ } from "./chunk-E5JQ5SVA.js";
8
8
 
9
9
  // ../../packages/agent-core/src/agent-loop.ts
10
10
  function createLoopErrorMessage(error, config, signal) {
@@ -6,10 +6,10 @@ import {
6
6
  createSharedWebSearchTool,
7
7
  interpretShellExit,
8
8
  requestInteraction
9
- } from "./chunk-65B6P5J5.js";
9
+ } from "./chunk-F3U2TYDT.js";
10
10
  import {
11
11
  getLogger
12
- } from "./chunk-BRFP5WZ6.js";
12
+ } from "./chunk-E5JQ5SVA.js";
13
13
  import {
14
14
  Type
15
15
  } from "./chunk-XXGYUYXI.js";
@@ -6,8 +6,8 @@ import {
6
6
  bindToolCallerIdentity,
7
7
  createToolCallerIdentity,
8
8
  getToolCallerIdentity
9
- } from "./chunk-GZDAIW6F.js";
10
- import "./chunk-BRFP5WZ6.js";
9
+ } from "./chunk-MPTME6HX.js";
10
+ import "./chunk-E5JQ5SVA.js";
11
11
  import "./chunk-XXGYUYXI.js";
12
12
  import "./chunk-LZQXQOPJ.js";
13
13
  export {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  EventStream
4
- } from "./chunk-BRFP5WZ6.js";
4
+ } from "./chunk-E5JQ5SVA.js";
5
5
  import "./chunk-XXGYUYXI.js";
6
6
  import "./chunk-LZQXQOPJ.js";
7
7
 
package/dist/cli.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  logTransportLifecycle,
24
24
  migrateConfigFromAgentDir,
25
25
  truncateHeadTail
26
- } from "./chunks/chunk-GECAIKZL.js";
26
+ } from "./chunks/chunk-WLLZTG4W.js";
27
27
  import {
28
28
  resolveCliProjectRoot
29
29
  } from "./chunks/chunk-WLFOBECN.js";
@@ -86,8 +86,8 @@ import {
86
86
  shouldPreserveExecutionStateForUserText,
87
87
  supersedeExecutionState,
88
88
  verifyPreparedCompactionCommit
89
- } from "./chunks/chunk-65B6P5J5.js";
90
- import "./chunks/chunk-GZDAIW6F.js";
89
+ } from "./chunks/chunk-F3U2TYDT.js";
90
+ import "./chunks/chunk-MPTME6HX.js";
91
91
  import {
92
92
  Deref,
93
93
  EMPTY_ASSISTANT_CONTENT_ERROR,
@@ -112,7 +112,7 @@ import {
112
112
  sortToolModelCandidatesByCapability,
113
113
  streamSimple,
114
114
  type_exports
115
- } from "./chunks/chunk-BRFP5WZ6.js";
115
+ } from "./chunks/chunk-E5JQ5SVA.js";
116
116
  import {
117
117
  IsArray,
118
118
  IsBigInt,
@@ -82562,7 +82562,7 @@ var InteractiveMode = class {
82562
82562
  async init() {
82563
82563
  const activeSession = this.sessionManager.getActiveSession();
82564
82564
  this.thinkingLevel = resolveInitialThinkingLevel({ session: activeSession, settingsManager: this.options.settingsManager });
82565
- const { Agent } = await import("./chunks/src-PRKTGADX.js");
82565
+ const { Agent } = await import("./chunks/src-TOJ3HCEX.js");
82566
82566
  this.agent = new Agent({
82567
82567
  initialState: {
82568
82568
  systemPrompt: this.buildSystemPrompt(),
@@ -83420,7 +83420,7 @@ async function runPrintMode(params) {
83420
83420
  `);
83421
83421
  console.log("Assistant: ");
83422
83422
  }
83423
- const { Agent: AgentClass } = await import("./chunks/src-PRKTGADX.js");
83423
+ const { Agent: AgentClass } = await import("./chunks/src-TOJ3HCEX.js");
83424
83424
  let agent;
83425
83425
  const printModeExtensions = await loadPrintModeExtensions({
83426
83426
  cwd: runtime.cwd,
@@ -84273,7 +84273,7 @@ async function runJsonEventsMode(params) {
84273
84273
  return;
84274
84274
  }
84275
84275
  const parent = agent;
84276
- const { Agent: AgentClass } = await import("./chunks/src-PRKTGADX.js");
84276
+ const { Agent: AgentClass } = await import("./chunks/src-TOJ3HCEX.js");
84277
84277
  const sideAgent = new AgentClass({
84278
84278
  initialState: {
84279
84279
  systemPrompt: parent.state.systemPrompt,
@@ -84621,7 +84621,7 @@ async function runJsonEventsMode(params) {
84621
84621
  if (runtime.initialModel.unconfigured || controller) {
84622
84622
  return;
84623
84623
  }
84624
- const { Agent: AgentClass } = await import("./chunks/src-PRKTGADX.js");
84624
+ const { Agent: AgentClass } = await import("./chunks/src-TOJ3HCEX.js");
84625
84625
  const jsonModeExtensions = await loadJsonModeExtensions({ runtime, getAgent: () => agent });
84626
84626
  extensionRunner = jsonModeExtensions.runner;
84627
84627
  const tools = [...runtime.tools, ...jsonModeExtensions.extensionTools];
@@ -85220,7 +85220,7 @@ async function runWithJsonEventsConsoleIsolation(fn) {
85220
85220
  }
85221
85221
  async function createCliTestStreamFnFromEnv() {
85222
85222
  if (!process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) return void 0;
85223
- return (await import("./chunks/test-stream-BGAEVPRX.js")).createTestStreamFnFromSequenceEnv();
85223
+ return (await import("./chunks/test-stream-6426JXLY.js")).createTestStreamFnFromSequenceEnv();
85224
85224
  }
85225
85225
  function resolveJsonEventsDetailFlag() {
85226
85226
  for (let index = 0; index < process.argv.length; index += 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "2.7.2",
3
+ "version": "2.7.3",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {