@cydm/pie 2.7.0 → 2.7.2

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.
@@ -6,7 +6,10 @@ import {
6
6
  createSharedWebSearchTool,
7
7
  interpretShellExit,
8
8
  requestInteraction
9
- } from "./chunk-6RBSTII7.js";
9
+ } from "./chunk-65B6P5J5.js";
10
+ import {
11
+ getLogger
12
+ } from "./chunk-BRFP5WZ6.js";
10
13
  import {
11
14
  Type
12
15
  } from "./chunk-XXGYUYXI.js";
@@ -124,6 +127,66 @@ function migrateConfigFromAgentDir() {
124
127
  }
125
128
  }
126
129
 
130
+ // src/runtime/transport-diagnostics.ts
131
+ function numberOrDash(value) {
132
+ return typeof value === "number" ? String(value) : "-";
133
+ }
134
+ function formatTransportLifecycle(event) {
135
+ const parts = [
136
+ `transport=${event.transport}`,
137
+ `id=${event.localRequestId}`,
138
+ `phase=${event.phase}`,
139
+ `gen=${event.requestGeneration}${event.connectionGeneration !== void 0 ? `/c${event.connectionGeneration}` : ""}`,
140
+ `reused=${event.reusedConnection ? "yes" : "no"}`,
141
+ `ageMs=${numberOrDash(event.requestAgeMs)}`,
142
+ `lastReceiveAgeMs=${numberOrDash(event.lastReceiveAgeMs)}`
143
+ ];
144
+ if (event.timeoutKind) parts.push(`timeoutKind=${event.timeoutKind}`);
145
+ if (event.budgets) {
146
+ const budgets = Object.entries(event.budgets).filter(([, value]) => typeof value === "number").map(([key, value]) => `${key}=${value}`);
147
+ if (budgets.length > 0) parts.push(`budgets(${budgets.join(",")})`);
148
+ }
149
+ if (event.receivedMessageCount !== void 0) parts.push(`messages=${event.receivedMessageCount}`);
150
+ if (event.sawResponseCreated !== void 0) parts.push(`sawCreated=${event.sawResponseCreated ? "yes" : "no"}`);
151
+ if (event.sawModelContent !== void 0) parts.push(`sawContent=${event.sawModelContent ? "yes" : "no"}`);
152
+ if (event.submissionAttempted !== void 0) parts.push(`submitted=${event.submissionAttempted ? "yes" : "no"}`);
153
+ if (event.terminalAccepted !== void 0) parts.push(`terminal=${event.terminalAccepted ? "yes" : "no"}`);
154
+ if (event.retryAllowed !== void 0) parts.push(`retryAllowed=${event.retryAllowed ? "yes" : "no"}`);
155
+ if (event.retryDecision) parts.push(`retryDecision=${event.retryDecision}`);
156
+ if (event.replayExempt === true) parts.push("replayExempt=yes");
157
+ if (event.cancelSource) parts.push(`cancelSource=${event.cancelSource}`);
158
+ if (event.cleanupOutcome) parts.push(`cleanup=${event.cleanupOutcome}`);
159
+ if (event.singleAttempt) parts.push(`singleAttempt=${event.singleAttempt}`);
160
+ return `[transport] ${parts.join(" ")}`;
161
+ }
162
+ function createTransportDiagnosticsStreamFn(base, sink) {
163
+ return (model, context, options) => base(model, context, {
164
+ ...options,
165
+ onTransportLifecycle: (event) => {
166
+ try {
167
+ options?.onTransportLifecycle?.(event);
168
+ sink(event);
169
+ } catch {
170
+ }
171
+ }
172
+ });
173
+ }
174
+ var logTransportLifecycle = (event) => {
175
+ const logger = getLogger().child({ module: "cli.transport" });
176
+ const line = formatTransportLifecycle(event);
177
+ if (event.phase === "timeout" || event.cleanupOutcome === "request_abandoned") {
178
+ logger.warn(line, { transportLifecycle: event });
179
+ } else {
180
+ logger.debug(line, { transportLifecycle: event });
181
+ }
182
+ };
183
+ function createTraceTransportSink(noteRuntimeEvent) {
184
+ return (event) => {
185
+ noteRuntimeEvent("transport_lifecycle", event);
186
+ logTransportLifecycle(event);
187
+ };
188
+ }
189
+
127
190
  // src/capabilities/bash/index.ts
128
191
  import { spawn } from "child_process";
129
192
  import { closeSync, createWriteStream, existsSync as existsSync2, openSync, statSync, unlinkSync, writeFileSync } from "fs";
@@ -706,7 +769,7 @@ function createBashTool(defaultCwd, options) {
706
769
  const child = (options?.spawnProcess ?? spawn)(spawnCommand.file, spawnCommand.args, {
707
770
  shell: spawnCommand.shell,
708
771
  cwd: workingDir,
709
- env: process.env,
772
+ env: { ...process.env, ...options?.getEnv?.() ?? {} },
710
773
  detached: process.platform !== "win32",
711
774
  windowsHide: true
712
775
  });
@@ -1195,7 +1258,7 @@ function createCliWebResearchHealthStore(configDir) {
1195
1258
 
1196
1259
  // src/capabilities/index.ts
1197
1260
  function createCliHostCapabilities(cwd, options = {}) {
1198
- const bashTool = createBashTool(cwd);
1261
+ const bashTool = createBashTool(cwd, options.getBashEnv ? { getEnv: options.getBashEnv } : void 0);
1199
1262
  const healthStore = createCliWebResearchHealthStore(options.configDir ?? getConfigDir());
1200
1263
  const webSearchTool = createSharedWebSearchTool({
1201
1264
  getModel: options.getModel ?? (() => void 0),
@@ -1264,5 +1327,9 @@ export {
1264
1327
  formatSize,
1265
1328
  cleanupBashOutputArtifacts,
1266
1329
  createBashTool,
1330
+ formatTransportLifecycle,
1331
+ createTransportDiagnosticsStreamFn,
1332
+ logTransportLifecycle,
1333
+ createTraceTransportSink,
1267
1334
  createCliHostCapabilities
1268
1335
  };
@@ -4,7 +4,7 @@ import {
4
4
  disposeModelTransports,
5
5
  streamSimple,
6
6
  validateToolArguments
7
- } from "./chunk-R5I2QLF2.js";
7
+ } from "./chunk-BRFP5WZ6.js";
8
8
 
9
9
  // ../../packages/agent-core/src/agent-loop.ts
10
10
  function createLoopErrorMessage(error, config, signal) {
@@ -6,8 +6,8 @@ import {
6
6
  bindToolCallerIdentity,
7
7
  createToolCallerIdentity,
8
8
  getToolCallerIdentity
9
- } from "./chunk-TWILEFLD.js";
10
- import "./chunk-R5I2QLF2.js";
9
+ } from "./chunk-GZDAIW6F.js";
10
+ import "./chunk-BRFP5WZ6.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-R5I2QLF2.js";
4
+ } from "./chunk-BRFP5WZ6.js";
5
5
  import "./chunk-XXGYUYXI.js";
6
6
  import "./chunk-LZQXQOPJ.js";
7
7