@cydm/pie 4.3.6 → 4.3.7

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.
Files changed (27) hide show
  1. package/dist/builtin/extensions/ask-user/index.js +4 -4
  2. package/dist/builtin/extensions/cron/index.js +7 -1
  3. package/dist/builtin/extensions/im-forward/index.js +86 -68
  4. package/dist/builtin/extensions/mcp-adapter/index.js +7 -1
  5. package/dist/builtin/extensions/memory/index.js +5 -5
  6. package/dist/builtin/extensions/pie-ipc/index.js +1 -1
  7. package/dist/builtin/extensions/pie-proc/index.js +2 -1
  8. package/dist/builtin/extensions/plan-mode/index.js +4 -4
  9. package/dist/builtin/extensions/subagent/index.js +5 -5
  10. package/dist/builtin/extensions/todo/index.js +4 -4
  11. package/dist/chunks/{chunk-J2LGVYH2.js → chunk-2SAFRLFJ.js} +28 -13
  12. package/dist/chunks/{chunk-JQRZLVPY.js → chunk-6JEYRAQM.js} +1898 -1692
  13. package/dist/chunks/{chunk-NCP264ZE.js → chunk-B4N5LJMD.js} +1 -1
  14. package/dist/chunks/{chunk-PFXSA2LK.js → chunk-BJ4XN5VX.js} +5 -5
  15. package/dist/chunks/{chunk-H5G55G3R.js → chunk-N3BWFAMZ.js} +11 -1
  16. package/dist/chunks/{chunk-QX6WS73C.js → chunk-VHKMWOG3.js} +1 -1
  17. package/dist/chunks/{chunk-PC6HUZAD.js → chunk-WZLO5V2X.js} +3 -3
  18. package/dist/chunks/{chunk-BK36Y35W.js → chunk-XMOWWL4B.js} +2 -2
  19. package/dist/chunks/{manager-cli-JWCZEQXT.js → manager-cli-QNMCCIFG.js} +253 -7
  20. package/dist/chunks/{model-registry-YA6U366L.js → model-registry-NKE3BRSZ.js} +2 -2
  21. package/dist/chunks/{src-ODLT57PQ.js → src-46R5ZFOU.js} +2 -2
  22. package/dist/chunks/{src-VPMIQGEW.js → src-4EQ7PBEI.js} +3 -3
  23. package/dist/chunks/{src-XSLD2IQ2.js → src-BHIH4VLE.js} +1 -1
  24. package/dist/chunks/{src-AQ4H43UM.js → src-UVULNQOO.js} +4 -4
  25. package/dist/chunks/{test-stream-GIUD5JWS.js → test-stream-FC6ZRENI.js} +1 -1
  26. package/dist/cli.js +343 -204
  27. package/package.json +3 -3
@@ -10,15 +10,15 @@ import {
10
10
  createSharedWebSearchTool,
11
11
  defaultShellKindForPlatform,
12
12
  interpretShellExit
13
- } from "./chunk-PC6HUZAD.js";
13
+ } from "./chunk-WZLO5V2X.js";
14
14
  import {
15
15
  requestInteraction
16
- } from "./chunk-BK36Y35W.js";
16
+ } from "./chunk-XMOWWL4B.js";
17
17
  import {
18
18
  EMPTY_ASSISTANT_CONTENT_ERROR,
19
19
  OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
20
20
  getLogger
21
- } from "./chunk-JQRZLVPY.js";
21
+ } from "./chunk-6JEYRAQM.js";
22
22
  import {
23
23
  Type
24
24
  } from "./chunk-XXGYUYXI.js";
@@ -423,6 +423,15 @@ function createArtifactSinkGate(sink, isActive) {
423
423
 
424
424
  // src/capabilities/bash/powershell-display.ts
425
425
  import { StringDecoder } from "node:string_decoder";
426
+
427
+ // src/capabilities/bash/terminal-mode-filter.ts
428
+ var TERMINAL_MODE_SEQUENCE = /\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[PX^_][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[ -/]*[0-~]?/g;
429
+ function stripTerminalModeSequences(text) {
430
+ if (!text.includes("\x1B")) return text;
431
+ return text.replace(TERMINAL_MODE_SEQUENCE, "");
432
+ }
433
+
434
+ // src/capabilities/bash/powershell-display.ts
426
435
  var MARKER = "#< CLIXML";
427
436
  var MAX_CLIXML_CHARS = 64 * 1024;
428
437
  function xmlText(text) {
@@ -571,12 +580,15 @@ var PowerShellDisplay = class {
571
580
  this.stderr.end();
572
581
  }
573
582
  preview() {
574
- const result = truncateHeadTail(this.total <= this.head.length ? this.head : this.total <= this.head.length + this.tail.length ? this.head + this.tail.slice(this.head.length + this.tail.length - this.total) : this.head + "\n... [stream middle omitted] ...\n" + this.tail);
575
- if (this.totalBytes > result.totalBytes) {
583
+ const assembled = this.total <= this.head.length ? this.head : this.total <= this.head.length + this.tail.length ? this.head + this.tail.slice(this.head.length + this.tail.length - this.total) : this.head + "\n... [stream middle omitted] ...\n" + this.tail;
584
+ const filtered = stripTerminalModeSequences(assembled);
585
+ const result = truncateHeadTail(filtered);
586
+ const retainedCapacity = this.total <= this.head.length ? this.total : this.head.length + this.tail.length;
587
+ result.totalBytes = this.totalBytes;
588
+ result.totalLines = this.newlines + 1;
589
+ if (this.total > retainedCapacity) {
576
590
  result.truncated = true;
577
- result.totalBytes = this.totalBytes;
578
- result.totalLines = this.newlines + 1;
579
- result.truncatedBy = result.totalLines > DEFAULT_MAX_LINES ? "lines" : "bytes";
591
+ result.truncatedBy = this.newlines + 1 > DEFAULT_MAX_LINES ? "lines" : "bytes";
580
592
  }
581
593
  return result;
582
594
  }
@@ -1100,7 +1112,10 @@ function createBashTool(defaultCwd, options) {
1100
1112
  const child = (options?.spawnProcess ?? spawn)(spawnCommand.file, spawnCommand.args, {
1101
1113
  shell: spawnCommand.shell,
1102
1114
  cwd: workingDir,
1103
- env: { ...process.env, ...options?.getEnv?.() ?? {} },
1115
+ env: (() => {
1116
+ const { PIE_DEFAULT_PROVIDER, PIE_DEFAULT_MODEL, PIE_MANAGER_BOOTSTRAP, PIE_PROC_CURATED_NAME, ...rest } = process.env;
1117
+ return { ...rest, ...options?.getEnv?.() ?? {} };
1118
+ })(),
1104
1119
  detached: process.platform !== "win32",
1105
1120
  windowsHide: true
1106
1121
  });
@@ -1187,7 +1202,7 @@ function createBashTool(defaultCwd, options) {
1187
1202
  appendRollingChunk(data);
1188
1203
  display?.writeStdout(data);
1189
1204
  if (onUpdate) {
1190
- const truncation = display?.preview() ?? truncateHeadTail(Buffer.concat(chunks).toString("utf-8"));
1205
+ const truncation = display?.preview() ?? truncateHeadTail(stripTerminalModeSequences(Buffer.concat(chunks).toString("utf-8")));
1191
1206
  onUpdate({
1192
1207
  content: [{ type: "text", text: truncation.content || "" }],
1193
1208
  details: {
@@ -1257,15 +1272,15 @@ function createBashTool(defaultCwd, options) {
1257
1272
  if (drainTimer) clearTimeout(drainTimer);
1258
1273
  signal?.removeEventListener("abort", onAbort);
1259
1274
  const fullBuffer = Buffer.concat(chunks);
1260
- let fullOutput = fullBuffer.toString("utf-8");
1275
+ let fullOutput = stripTerminalModeSequences(fullBuffer.toString("utf-8"));
1261
1276
  if (totalBytes > fullBuffer.length) {
1262
- fullOutput = `${Buffer.concat(headChunks).toString("utf-8")}
1277
+ fullOutput = `${stripTerminalModeSequences(Buffer.concat(headChunks).toString("utf-8"))}
1263
1278
  ... [stream middle omitted] ...
1264
1279
  ${fullOutput}`;
1265
1280
  }
1266
1281
  display?.end();
1267
1282
  const truncation = display?.preview() ?? truncateHeadTail(fullOutput);
1268
- if (!display && totalBytes > truncation.totalBytes) {
1283
+ if (!display && totalBytes > fullBuffer.length + headBytes && totalBytes > truncation.totalBytes) {
1269
1284
  truncation.truncated = true;
1270
1285
  truncation.totalBytes = totalBytes;
1271
1286
  truncation.totalLines = totalNewlines + 1;