@cydm/pie 1.0.38 → 1.0.39

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-2PLCSYFF.js";
5
- import "../../../chunks/chunk-NTFKTUOW.js";
6
- import "../../../chunks/chunk-2WHIT2UB.js";
4
+ } from "../../../chunks/chunk-SNSSIR3E.js";
5
+ import "../../../chunks/chunk-7IFMKPHH.js";
6
+ import "../../../chunks/chunk-HPTWCKJE.js";
7
7
  import "../../../chunks/chunk-TG2EQLX2.js";
8
8
 
9
9
  // builtin/extensions/ask-user/index.ts
@@ -7,11 +7,11 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-2PLCSYFF.js";
11
- import "../../../chunks/chunk-NTFKTUOW.js";
10
+ } from "../../../chunks/chunk-SNSSIR3E.js";
11
+ import "../../../chunks/chunk-7IFMKPHH.js";
12
12
  import {
13
13
  Type
14
- } from "../../../chunks/chunk-2WHIT2UB.js";
14
+ } from "../../../chunks/chunk-HPTWCKJE.js";
15
15
  import "../../../chunks/chunk-TG2EQLX2.js";
16
16
 
17
17
  // builtin/extensions/plan-mode/index.ts
@@ -1,13 +1,13 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCliHostCapabilities
4
- } from "../../../chunks/chunk-IKIEQTVJ.js";
4
+ } from "../../../chunks/chunk-F6VAOGFL.js";
5
5
  import {
6
6
  createSharedFileSystemTools,
7
7
  createSubagentCapability
8
- } from "../../../chunks/chunk-2PLCSYFF.js";
9
- import "../../../chunks/chunk-NTFKTUOW.js";
10
- import "../../../chunks/chunk-2WHIT2UB.js";
8
+ } from "../../../chunks/chunk-SNSSIR3E.js";
9
+ import "../../../chunks/chunk-7IFMKPHH.js";
10
+ import "../../../chunks/chunk-HPTWCKJE.js";
11
11
  import "../../../chunks/chunk-TG2EQLX2.js";
12
12
 
13
13
  // builtin/extensions/subagent/index.ts
@@ -7,9 +7,9 @@ import {
7
7
  executeManageTodoList,
8
8
  executionStateToTodos,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-2PLCSYFF.js";
11
- import "../../../chunks/chunk-NTFKTUOW.js";
12
- import "../../../chunks/chunk-2WHIT2UB.js";
10
+ } from "../../../chunks/chunk-SNSSIR3E.js";
11
+ import "../../../chunks/chunk-7IFMKPHH.js";
12
+ import "../../../chunks/chunk-HPTWCKJE.js";
13
13
  import "../../../chunks/chunk-TG2EQLX2.js";
14
14
 
15
15
  // builtin/extensions/todo/index.ts
@@ -3,7 +3,7 @@ import {
3
3
  EventStream,
4
4
  streamSimple,
5
5
  validateToolArguments
6
- } from "./chunk-2WHIT2UB.js";
6
+ } from "./chunk-HPTWCKJE.js";
7
7
 
8
8
  // ../../packages/agent-core/src/agent-loop.ts
9
9
  function createLoopErrorMessage(error, config, signal) {
@@ -8,10 +8,10 @@ import {
8
8
  createSharedWebSearchTool,
9
9
  interpretShellExit,
10
10
  requestInteraction
11
- } from "./chunk-2PLCSYFF.js";
11
+ } from "./chunk-SNSSIR3E.js";
12
12
  import {
13
13
  Type
14
- } from "./chunk-2WHIT2UB.js";
14
+ } from "./chunk-HPTWCKJE.js";
15
15
 
16
16
  // src/config.ts
17
17
  import { existsSync, mkdirSync, readFileSync, renameSync } from "fs";
@@ -4229,6 +4229,7 @@ var NodeHttpClient = class {
4229
4229
  const requestStartTime = Date.now();
4230
4230
  const requestId = `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
4231
4231
  const requestTimeoutMs = options.timeoutMs ?? 6e4;
4232
+ let requestTimeoutError;
4232
4233
  logHttp("DEBUG", `Request [${requestId}] started`, {
4233
4234
  url: url.slice(0, 100),
4234
4235
  method: options.method || "GET",
@@ -4402,14 +4403,14 @@ var NodeHttpClient = class {
4402
4403
  });
4403
4404
  });
4404
4405
  res.on("error", (e) => {
4405
- failStream(e);
4406
+ failStream(requestTimeoutError ?? e);
4406
4407
  });
4407
4408
  res.on("aborted", () => {
4408
- failStream(new Error("SSE stream aborted"));
4409
+ failStream(requestTimeoutError ?? new Error("SSE stream aborted"));
4409
4410
  });
4410
4411
  res.on("close", () => {
4411
4412
  if (!done || !res.complete) {
4412
- failStream(new Error("SSE stream closed before end"));
4413
+ failStream(requestTimeoutError ?? new Error("SSE stream closed before end"));
4413
4414
  }
4414
4415
  });
4415
4416
  try {
@@ -4459,8 +4460,9 @@ var NodeHttpClient = class {
4459
4460
  reject(e);
4460
4461
  });
4461
4462
  req.on("timeout", () => {
4463
+ requestTimeoutError = new Error("Request timeout");
4462
4464
  logHttp("ERROR", `Request [${requestId}] timeout`);
4463
- req.destroy(new Error("Request timeout"));
4465
+ req.destroy(requestTimeoutError);
4464
4466
  });
4465
4467
  req.setTimeout(requestTimeoutMs);
4466
4468
  if (options.signal) {
@@ -5144,6 +5146,7 @@ function buildBaseOptions(model, options, apiKey) {
5144
5146
  cacheRetention: options?.cacheRetention,
5145
5147
  sessionId: options?.sessionId,
5146
5148
  headers: options?.headers,
5149
+ timeoutMs: options?.timeoutMs,
5147
5150
  onPayload: options?.onPayload,
5148
5151
  maxRetryDelayMs: options?.maxRetryDelayMs,
5149
5152
  metadata: options?.metadata
@@ -5567,6 +5570,11 @@ function logEmptyAssistantContentError(error, model, options) {
5567
5570
  }
5568
5571
 
5569
5572
  // ../../packages/ai/src/providers/openai-compat.ts
5573
+ var DEFAULT_OPENAI_COMPAT_STREAM_TIMEOUT_MS = 10 * 60 * 1e3;
5574
+ function getOpenAICompatStreamTimeoutMs() {
5575
+ const value = Number(process.env.PIE_OPENAI_COMPAT_STREAM_TIMEOUT_MS || "");
5576
+ return Number.isFinite(value) && value > 0 ? value : DEFAULT_OPENAI_COMPAT_STREAM_TIMEOUT_MS;
5577
+ }
5570
5578
  function normalizeTokenCount(value) {
5571
5579
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
5572
5580
  return void 0;
@@ -5654,7 +5662,8 @@ var streamOpenAICompletions = (model, context, options) => {
5654
5662
  method: "POST",
5655
5663
  headers,
5656
5664
  body: JSON.stringify(params),
5657
- signal: options?.signal
5665
+ signal: options?.signal,
5666
+ timeoutMs: options?.timeoutMs ?? getOpenAICompatStreamTimeoutMs()
5658
5667
  });
5659
5668
  if (!response.ok) {
5660
5669
  const errorBody = await response.text().catch(() => "");
@@ -5792,13 +5801,11 @@ var streamOpenAICompletions = (model, context, options) => {
5792
5801
  }
5793
5802
  }
5794
5803
  if (choice.delta.tool_calls) {
5795
- for (const toolCall of choice.delta.tool_calls) {
5796
- if (!Number.isInteger(toolCall.index) || toolCall.index < 0) {
5797
- throw new Error("Tool call delta is missing a valid index");
5798
- }
5804
+ for (const [toolCallPosition, toolCall] of choice.delta.tool_calls.entries()) {
5805
+ const toolCallIndex = Number.isInteger(toolCall.index) && toolCall.index >= 0 ? toolCall.index : toolCallPosition;
5799
5806
  finishCurrentBlock(currentBlock);
5800
5807
  currentBlock = null;
5801
- let entry = toolCalls.get(toolCall.index);
5808
+ let entry = toolCalls.get(toolCallIndex);
5802
5809
  if (!entry) {
5803
5810
  const block = {
5804
5811
  type: "toolCall",
@@ -5808,7 +5815,7 @@ var streamOpenAICompletions = (model, context, options) => {
5808
5815
  };
5809
5816
  output.content.push(block);
5810
5817
  entry = { block, partialArgs: "", contentIndex: blockIndex() };
5811
- toolCalls.set(toolCall.index, entry);
5818
+ toolCalls.set(toolCallIndex, entry);
5812
5819
  stream.push({
5813
5820
  type: "toolcall_start",
5814
5821
  contentIndex: entry.contentIndex,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  Agent
4
- } from "./chunk-NTFKTUOW.js";
4
+ } from "./chunk-7IFMKPHH.js";
5
5
  import {
6
6
  FileSystemGateway,
7
7
  Type,
@@ -11,7 +11,7 @@ import {
11
11
  getPlatformConfig,
12
12
  hashText,
13
13
  streamSimple
14
- } from "./chunk-2WHIT2UB.js";
14
+ } from "./chunk-HPTWCKJE.js";
15
15
  import {
16
16
  __commonJS,
17
17
  __toESM
@@ -3,8 +3,8 @@ import {
3
3
  Agent,
4
4
  agentLoop,
5
5
  agentLoopContinue
6
- } from "./chunk-NTFKTUOW.js";
7
- import "./chunk-2WHIT2UB.js";
6
+ } from "./chunk-7IFMKPHH.js";
7
+ import "./chunk-HPTWCKJE.js";
8
8
  import "./chunk-TG2EQLX2.js";
9
9
  export {
10
10
  Agent,
@@ -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-2WHIT2UB.js";
4
+ } from "./chunk-HPTWCKJE.js";
5
5
  import "./chunk-TG2EQLX2.js";
6
6
 
7
7
  // src/app/test-stream.ts
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  getThemesDir,
20
20
  migrateConfigFromAgentDir,
21
21
  truncateHeadTail
22
- } from "./chunks/chunk-IKIEQTVJ.js";
22
+ } from "./chunks/chunk-F6VAOGFL.js";
23
23
  import {
24
24
  AGENTS_CONTEXT_FILE_NAME,
25
25
  AgentSessionController,
@@ -69,8 +69,8 @@ import {
69
69
  setExtensionEnabledInSettings,
70
70
  shouldPreserveExecutionStateForUserText,
71
71
  supersedeExecutionState
72
- } from "./chunks/chunk-2PLCSYFF.js";
73
- import "./chunks/chunk-NTFKTUOW.js";
72
+ } from "./chunks/chunk-SNSSIR3E.js";
73
+ import "./chunks/chunk-7IFMKPHH.js";
74
74
  import {
75
75
  Deref,
76
76
  EMPTY_ASSISTANT_CONTENT_ERROR,
@@ -105,7 +105,7 @@ import {
105
105
  setLogger,
106
106
  sortToolModelCandidatesByCapability,
107
107
  type_exports
108
- } from "./chunks/chunk-2WHIT2UB.js";
108
+ } from "./chunks/chunk-HPTWCKJE.js";
109
109
  import {
110
110
  resolveCliProjectRoot
111
111
  } from "./chunks/chunk-NTYHFBUA.js";
@@ -68117,12 +68117,14 @@ function createInteractiveAgentSessionController(host) {
68117
68117
  queueLength: host.agentSessionController?.pendingMessageCount ?? 0
68118
68118
  });
68119
68119
  } else if (event.type === "turn_recovery_pending") {
68120
+ host.setControllerBusy(true);
68120
68121
  if (event.recovery === "retry") {
68121
68122
  host.showStatus(`Transient request error. Retrying in ${(event.delayMs ?? 0) / 1e3}s... (attempt ${event.attempt}/${event.maxRetries})`);
68122
68123
  } else {
68123
68124
  host.showStatus(event.failure.kind === "context_overflow" ? "Context overflow detected, compacting..." : "Auto-compacting context before retry...");
68124
68125
  }
68125
68126
  } else if (event.type === "turn_retry_started") {
68127
+ host.setControllerBusy(true);
68126
68128
  host.showStatus(`Retrying request (attempt ${event.attempt}/${event.maxRetries})...`);
68127
68129
  } else if (event.type === "turn_retry_succeeded") {
68128
68130
  const outcome = host.executionState.resumePausedTodo();
@@ -69380,7 +69382,7 @@ var InteractiveMode = class {
69380
69382
  if (savedLevel) {
69381
69383
  this.thinkingLevel = savedLevel;
69382
69384
  }
69383
- const { Agent } = await import("./chunks/src-PBRYPFUI.js");
69385
+ const { Agent } = await import("./chunks/src-N6MKSRB3.js");
69384
69386
  const activeSession = this.sessionManager.getActiveSession();
69385
69387
  this.agent = new Agent({
69386
69388
  initialState: {
@@ -70101,7 +70103,7 @@ async function runPrintMode(params) {
70101
70103
  `);
70102
70104
  console.log("Assistant: ");
70103
70105
  }
70104
- const { Agent: AgentClass } = await import("./chunks/src-PBRYPFUI.js");
70106
+ const { Agent: AgentClass } = await import("./chunks/src-N6MKSRB3.js");
70105
70107
  let agent;
70106
70108
  const printModeExtensions = await loadPrintModeExtensions({
70107
70109
  cwd: runtime.cwd,
@@ -71051,7 +71053,7 @@ async function runJsonEventsMode(params) {
71051
71053
  if (runtime.initialModel.unconfigured || controller) {
71052
71054
  return;
71053
71055
  }
71054
- const { Agent: AgentClass } = await import("./chunks/src-PBRYPFUI.js");
71056
+ const { Agent: AgentClass } = await import("./chunks/src-N6MKSRB3.js");
71055
71057
  const jsonModeExtensions = await loadJsonModeExtensions({ runtime, getAgent: () => agent });
71056
71058
  const tools = [...runtime.tools, ...jsonModeExtensions.extensionTools];
71057
71059
  recordCliCompositionStep(runtime.compositionTrace, {
@@ -71683,7 +71685,7 @@ async function runWithJsonEventsConsoleIsolation(fn) {
71683
71685
  }
71684
71686
  async function createCliTestStreamFnFromEnv() {
71685
71687
  if (!process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) return void 0;
71686
- return (await import("./chunks/test-stream-EO6L26M5.js")).createTestStreamFnFromSequenceEnv();
71688
+ return (await import("./chunks/test-stream-6F6VZ44U.js")).createTestStreamFnFromSequenceEnv();
71687
71689
  }
71688
71690
  async function startChat(initialPrompt, testCommand) {
71689
71691
  const rawOutput = process.argv.includes("--raw-output");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "test": "npm run test:offline",
19
19
  "pretest:offline": "npm run build --workspace @pie/agent-framework && npm run build --workspace @pie/shared-headless-capabilities && npm run build",
20
20
  "posttest:offline": "node --test --import tsx test/remote-model-catalog.test.ts",
21
- "test:offline": "node --test --import tsx test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/extensions-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/code-intel-typescript-provider.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/terminal-title.test.ts test/todo-title.terminal.test.ts test/plan-mode-extension.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/direct-bash.test.ts test/daily-agent-smoke.terminal.test.ts",
21
+ "test:offline": "node --test --import tsx test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/extensions-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/code-intel-typescript-provider.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/plan-mode-extension.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/direct-bash.test.ts test/daily-agent-smoke.terminal.test.ts",
22
22
  "test:all": "npm run test:offline && npm run test:terminal:vitest",
23
23
  "test:terminal:vitest": "vitest run test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/viewport-position-final.test.ts --no-file-parallelism",
24
24
  "test:todo-tui": "PIE_REAL_TODO_TUI=1 node --test --import tsx test/todo-closure.terminal.test.ts",