@cydm/pie 2.7.0 → 2.7.1

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.
@@ -4,7 +4,7 @@ import {
4
4
  disposeModelTransports,
5
5
  streamSimple,
6
6
  validateToolArguments
7
- } from "./chunk-R5I2QLF2.js";
7
+ } from "./chunk-XUROMYTT.js";
8
8
 
9
9
  // ../../packages/agent-core/src/agent-loop.ts
10
10
  function createLoopErrorMessage(error, config, signal) {
@@ -6,7 +6,10 @@ import {
6
6
  createSharedWebSearchTool,
7
7
  interpretShellExit,
8
8
  requestInteraction
9
- } from "./chunk-6RBSTII7.js";
9
+ } from "./chunk-M44CWVDZ.js";
10
+ import {
11
+ getLogger
12
+ } from "./chunk-XUROMYTT.js";
10
13
  import {
11
14
  Type
12
15
  } from "./chunk-XXGYUYXI.js";
@@ -124,6 +127,65 @@ 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.cancelSource) parts.push(`cancelSource=${event.cancelSource}`);
157
+ if (event.cleanupOutcome) parts.push(`cleanup=${event.cleanupOutcome}`);
158
+ if (event.singleAttempt) parts.push(`singleAttempt=${event.singleAttempt}`);
159
+ return `[transport] ${parts.join(" ")}`;
160
+ }
161
+ function createTransportDiagnosticsStreamFn(base, sink) {
162
+ return (model, context, options) => base(model, context, {
163
+ ...options,
164
+ onTransportLifecycle: (event) => {
165
+ try {
166
+ options?.onTransportLifecycle?.(event);
167
+ sink(event);
168
+ } catch {
169
+ }
170
+ }
171
+ });
172
+ }
173
+ var logTransportLifecycle = (event) => {
174
+ const logger = getLogger().child({ module: "cli.transport" });
175
+ const line = formatTransportLifecycle(event);
176
+ if (event.phase === "timeout" || event.cleanupOutcome === "request_abandoned") {
177
+ logger.warn(line, { transportLifecycle: event });
178
+ } else {
179
+ logger.debug(line, { transportLifecycle: event });
180
+ }
181
+ };
182
+ function createTraceTransportSink(noteRuntimeEvent) {
183
+ return (event) => {
184
+ noteRuntimeEvent("transport_lifecycle", event);
185
+ logTransportLifecycle(event);
186
+ };
187
+ }
188
+
127
189
  // src/capabilities/bash/index.ts
128
190
  import { spawn } from "child_process";
129
191
  import { closeSync, createWriteStream, existsSync as existsSync2, openSync, statSync, unlinkSync, writeFileSync } from "fs";
@@ -706,7 +768,7 @@ function createBashTool(defaultCwd, options) {
706
768
  const child = (options?.spawnProcess ?? spawn)(spawnCommand.file, spawnCommand.args, {
707
769
  shell: spawnCommand.shell,
708
770
  cwd: workingDir,
709
- env: process.env,
771
+ env: { ...process.env, ...options?.getEnv?.() ?? {} },
710
772
  detached: process.platform !== "win32",
711
773
  windowsHide: true
712
774
  });
@@ -1195,7 +1257,7 @@ function createCliWebResearchHealthStore(configDir) {
1195
1257
 
1196
1258
  // src/capabilities/index.ts
1197
1259
  function createCliHostCapabilities(cwd, options = {}) {
1198
- const bashTool = createBashTool(cwd);
1260
+ const bashTool = createBashTool(cwd, options.getBashEnv ? { getEnv: options.getBashEnv } : void 0);
1199
1261
  const healthStore = createCliWebResearchHealthStore(options.configDir ?? getConfigDir());
1200
1262
  const webSearchTool = createSharedWebSearchTool({
1201
1263
  getModel: options.getModel ?? (() => void 0),
@@ -1264,5 +1326,9 @@ export {
1264
1326
  formatSize,
1265
1327
  cleanupBashOutputArtifacts,
1266
1328
  createBashTool,
1329
+ formatTransportLifecycle,
1330
+ createTransportDiagnosticsStreamFn,
1331
+ logTransportLifecycle,
1332
+ createTraceTransportSink,
1267
1333
  createCliHostCapabilities
1268
1334
  };