@cydm/pie 4.13.0 → 4.14.0

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 (33) hide show
  1. package/dist/builtin/extensions/ask-user/index.js +4 -4
  2. package/dist/builtin/extensions/im-forward/index.js +8099 -8101
  3. package/dist/builtin/extensions/mcp-adapter/index.js +86 -81
  4. package/dist/builtin/extensions/memory/index.js +30 -7
  5. package/dist/builtin/extensions/pie-ipc/index.js +13 -18
  6. package/dist/builtin/extensions/pie-proc/index.js +69 -60
  7. package/dist/builtin/extensions/plan-mode/index.js +4 -4
  8. package/dist/builtin/extensions/subagent/index.js +6 -5
  9. package/dist/builtin/extensions/todo/index.js +4 -4
  10. package/dist/chunks/{chunk-BQWHLYYZ.js → chunk-26KRUYZH.js} +1 -1
  11. package/dist/chunks/{chunk-5MCIBDAM.js → chunk-BOQIGMGQ.js} +38 -93
  12. package/dist/chunks/{chunk-AKC7NMP4.js → chunk-EZZTMDWZ.js} +887 -391
  13. package/dist/chunks/{chunk-5PCLBIOO.js → chunk-FD3KBPDR.js} +110 -75
  14. package/dist/chunks/{chunk-NOSNHMA2.js → chunk-IK2FR2YF.js} +2 -1
  15. package/dist/chunks/{chunk-SXBX2P5R.js → chunk-JJH77AUU.js} +1709 -1577
  16. package/dist/chunks/{chunk-OGGL6LUN.js → chunk-JKO42HZW.js} +1 -1
  17. package/dist/chunks/{chunk-3CJLYX5J.js → chunk-KGWKRO7Z.js} +2 -2
  18. package/dist/chunks/{chunk-G2K4GY6N.js → chunk-MCR4JYI6.js} +103 -12
  19. package/dist/chunks/{chunk-IZ4DYCJ7.js → chunk-UYDS75SI.js} +810 -726
  20. package/dist/chunks/{host-image-fallback-MZK633DK.js → host-image-fallback-LPHB5CTL.js} +1 -1
  21. package/dist/chunks/{manager-cli-OTIMAWO6.js → manager-cli-ZV36YNPJ.js} +187 -173
  22. package/dist/chunks/{memory-git-Q3UBYOJ4.js → memory-git-ZJN6SPIU.js} +5 -5
  23. package/dist/chunks/{model-registry-QNEPISBJ.js → model-registry-GLBIUOJR.js} +2 -2
  24. package/dist/chunks/{read-file-understanding-KCJMSOS7.js → read-file-understanding-DFJPTTSB.js} +5 -5
  25. package/dist/chunks/{src-TIDKYA5F.js → src-76Q33OY5.js} +1 -1
  26. package/dist/chunks/{src-D5GN4Q5O.js → src-ALHMJZ5R.js} +2 -2
  27. package/dist/chunks/{src-7MZZJVOG.js → src-KZ7YID3I.js} +11 -3
  28. package/dist/chunks/{src-QI47K3W3.js → src-LEXKDSFV.js} +24 -6
  29. package/dist/chunks/{test-stream-JAJHK44G.js → test-stream-OVGDTXOY.js} +1 -1
  30. package/dist/cli.js +12910 -12631
  31. package/models.schema.json +12 -3
  32. package/package.json +1 -1
  33. package/dist/chunks/{chunk-3GG342QY.js → chunk-TYCKSYUF.js} +19 -19
@@ -10,105 +10,45 @@ import {
10
10
  createSharedWebSearchTool,
11
11
  defaultShellKindForPlatform,
12
12
  interpretShellExit
13
- } from "./chunk-AKC7NMP4.js";
13
+ } from "./chunk-EZZTMDWZ.js";
14
14
  import {
15
+ classifyDefaultFailure,
16
+ isDefaultContextOverflowError,
15
17
  requestInteraction
16
- } from "./chunk-SXBX2P5R.js";
18
+ } from "./chunk-JJH77AUU.js";
17
19
  import {
18
- EMPTY_ASSISTANT_CONTENT_ERROR,
19
- OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
20
20
  getLogger
21
- } from "./chunk-G2K4GY6N.js";
21
+ } from "./chunk-MCR4JYI6.js";
22
22
  import {
23
23
  Type
24
24
  } from "./chunk-XXGYUYXI.js";
25
25
 
26
26
  // src/runtime/retry-policy.ts
27
- var TRANSIENT_NETWORK_ERROR_PATTERN = /sse stream aborted|sse stream closed before end|sse stream ended before response completed|responses stream ended without a terminal event|(?:read\s+)?ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|ECONNREFUSED|(?:read\s+|write\s+)?EPIPE|socket hang up|request timeout|websocket upgrade refused|websocket handshake|websocket connection failed|websocket transport failed|connection closed before opening|client network socket disconnected before secure TLS connection was established|connection.?error|connection.?refused|other side closed|fetch failed|upstream.?connect|reset before headers|terminated/i;
28
- var TLS_VALIDATION_ERROR_PATTERN = /certificate (?:has )?expired|certificate is not yet valid|unable to verify (?:the first certificate|certificate)|unable to get (?:local )?issuer certificate|self[-_ ]signed cert(?:ificate)?|CERT_HAS_EXPIRED|SELF_SIGNED_CERT|does not match certificate's altnames|ERR_TLS_CERT_ALTNAME_INVALID/i;
29
- var PROVIDER_TRANSIENT_ERROR_PATTERN = /overloaded|rate.?limit|too many requests|\b429\b|\b500\b|\b502\b|\b503\b|\b504\b|service.?unavailable|server error|internal error|retry delay|quota (?:has been |is )?exhausted/i;
30
27
  var AGY_BRIDGE_TRANSIENT_PATTERN = /\bagy bridge:.*(?:\bunknown model id\b|\bunavailable to this agy account\b)/i;
31
- var USER_ABORT_PATTERN = /request was aborted|local abort signal|user abort|user_interrupt|interrupted by user|esc pressed|ctrl\+c/i;
32
- var AUTH_CONFIG_PATTERN = /missing api key|invalid api key|api key.*invalid|unauthorized|\b401\b|\b403\b|forbidden|authentication failed|no configured model|no models? are configured/i;
33
- var QUOTA_EXHAUSTED_PATTERN = /insufficient[_ ]quota|exceeded[_ ]current[_ ]quota|exceeded your current quota|billing[_ ]hard[_ ]limit|insufficient[_ ]balance|credit balance is too low|\barrearage\b|余额不足|\b(?:account|monthly|billing) quota (?:has been |is )?exhausted/i;
34
- var INVALID_FILE_REFERENCE_PATTERN = /not the owner of this file|owner of this file|invalid_authentication_error/i;
35
- var INVALID_REQUEST_PATTERN = /bad request|\b400\b|invalid request|invalid schema|schema validation|invalid parameter|unsupported parameter|malformed/i;
36
28
  var CLI_RETRY_MAX_RETRIES = 3;
37
29
  var CLI_RETRY_BASE_DELAY_MS = 2e3;
38
30
  var CLI_TRANSIENT_NETWORK_MAX_RETRIES = 10;
39
31
  var CLI_RETRY_TOTAL_MAX_RETRIES = 12;
40
32
  var CLI_RETRY_MAX_DELAY_MS = 6e4;
41
33
  function isCliContextOverflowError(errorMessage) {
42
- return /context length exceeded|context_length_exceeded|maximum context length|maximum context size|too many tokens|input.*too long|prompt.*too long|context window|token limit exceeded|exceeds.{0,20}context/i.test(
43
- errorMessage
44
- );
45
- }
46
- function createClassification(kind, message, overrides) {
47
- return {
48
- kind,
49
- message,
50
- retryable: false,
51
- compactable: false,
52
- userAbort: false,
53
- terminal: true,
54
- ...overrides
55
- };
34
+ return isDefaultContextOverflowError(errorMessage);
56
35
  }
57
36
  function classifyCliFailure(context) {
58
- const errorMessage = typeof context === "string" ? context : context.errorMessage;
59
- const structuredReplayClass = typeof context === "string" ? void 0 : context.message?.role === "assistant" ? context.message.replayClass : void 0;
60
- if (isCliContextOverflowError(errorMessage)) {
61
- return createClassification("context_overflow", errorMessage, {
62
- compactable: true,
63
- terminal: false
64
- });
65
- }
66
- if (USER_ABORT_PATTERN.test(errorMessage)) {
67
- return createClassification("user_abort", errorMessage, {
68
- userAbort: true,
69
- terminal: false
70
- });
71
- }
72
- if (INVALID_FILE_REFERENCE_PATTERN.test(errorMessage)) {
73
- return createClassification("invalid_file_reference", errorMessage);
74
- }
75
- if (AUTH_CONFIG_PATTERN.test(errorMessage) || QUOTA_EXHAUSTED_PATTERN.test(errorMessage)) {
76
- return createClassification("auth_config", errorMessage);
77
- }
78
- if (TLS_VALIDATION_ERROR_PATTERN.test(errorMessage)) {
79
- return createClassification("tls_config", errorMessage, {
80
- retryable: true,
81
- terminal: false
82
- });
83
- }
84
- if (structuredReplayClass === "stream_lost" || structuredReplayClass === "stream_lost_partial" || TRANSIENT_NETWORK_ERROR_PATTERN.test(errorMessage)) {
85
- return createClassification("transient_network", errorMessage, {
86
- retryable: true,
87
- terminal: false
88
- });
89
- }
90
- if (errorMessage.includes(EMPTY_ASSISTANT_CONTENT_ERROR)) {
91
- return createClassification("provider_transient", errorMessage, {
92
- retryable: true,
93
- terminal: false
94
- });
95
- }
96
- if (errorMessage.includes(OPENAI_COMPAT_PROTOCOL_ERROR_CODE)) {
97
- return createClassification("provider_transient", errorMessage, {
98
- retryable: true,
99
- terminal: false
100
- });
101
- }
102
- if (PROVIDER_TRANSIENT_ERROR_PATTERN.test(errorMessage) || AGY_BRIDGE_TRANSIENT_PATTERN.test(errorMessage)) {
103
- return createClassification("provider_transient", errorMessage, {
104
- retryable: true,
105
- terminal: false
106
- });
107
- }
108
- if (INVALID_REQUEST_PATTERN.test(errorMessage)) {
109
- return createClassification("invalid_request", errorMessage);
37
+ const base = classifyDefaultFailure(context);
38
+ if (base.kind === "invalid_request" || base.kind === "unknown") {
39
+ const errorMessage = typeof context === "string" ? context : context.errorMessage;
40
+ if (AGY_BRIDGE_TRANSIENT_PATTERN.test(errorMessage)) {
41
+ return {
42
+ kind: "provider_transient",
43
+ message: errorMessage,
44
+ retryable: true,
45
+ compactable: false,
46
+ userAbort: false,
47
+ terminal: false
48
+ };
49
+ }
110
50
  }
111
- return createClassification("unknown", errorMessage);
51
+ return base;
112
52
  }
113
53
  function isCliRetryableError(errorMessage) {
114
54
  return classifyCliFailure(errorMessage).retryable;
@@ -232,11 +172,9 @@ function createTraceTransportSink(noteRuntimeEvent) {
232
172
  }
233
173
 
234
174
  // src/capabilities/bash/index.ts
235
- import { spawn, spawnSync } from "child_process";
236
- import { closeSync, createWriteStream, existsSync, openSync, statSync, unlinkSync, writeFileSync } from "fs";
237
- import { tmpdir } from "os";
238
- import { join, resolve } from "path";
239
- import { createHash, randomBytes } from "crypto";
175
+ import { spawn as spawn2 } from "child_process";
176
+ import { closeSync as closeSync2, openSync as openSync2, writeFileSync as writeFileSync2 } from "fs";
177
+ import { createHash as createHash2 } from "crypto";
240
178
 
241
179
  // src/capabilities/bash/truncate.ts
242
180
  var DEFAULT_MAX_LINES = 400;
@@ -595,7 +533,12 @@ var PowerShellDisplay = class {
595
533
  }
596
534
  };
597
535
 
598
- // src/capabilities/bash/index.ts
536
+ // src/capabilities/bash/runtime.ts
537
+ import { spawn, spawnSync } from "child_process";
538
+ import { closeSync, createWriteStream, existsSync, openSync, statSync, unlinkSync } from "fs";
539
+ import { tmpdir } from "os";
540
+ import { join, resolve } from "path";
541
+ import { randomBytes } from "crypto";
599
542
  function buildBashSchema(commandDescription) {
600
543
  return Type.Object({
601
544
  command: Type.String({ description: commandDescription }),
@@ -959,6 +902,8 @@ function killProcessTree(pid, leaderExited) {
959
902
  }
960
903
  }
961
904
  }
905
+
906
+ // src/capabilities/bash/index.ts
962
907
  function createBashTool(defaultCwd, options) {
963
908
  const contract = buildShellToolContract(options?.platform);
964
909
  const recentCommands = /* @__PURE__ */ new Map();
@@ -1111,7 +1056,7 @@ function createBashTool(defaultCwd, options) {
1111
1056
  let shellExitAt = 0;
1112
1057
  let lastPipeActivityAt = 0;
1113
1058
  const spawnCommand = buildSpawnCommand(resolvedShell, effectiveCommand);
1114
- const child = (options?.spawnProcess ?? spawn)(spawnCommand.file, spawnCommand.args, {
1059
+ const child = (options?.spawnProcess ?? spawn2)(spawnCommand.file, spawnCommand.args, {
1115
1060
  shell: spawnCommand.shell,
1116
1061
  cwd: workingDir,
1117
1062
  env: (() => {
@@ -1291,13 +1236,13 @@ ${fullOutput}`;
1291
1236
  let outputText = truncation.content || "(no output)";
1292
1237
  if (truncation.truncated && !tempFilePath) {
1293
1238
  const path3 = getTempFilePath();
1294
- const fd = openSync(path3, "wx", 384);
1239
+ const fd = openSync2(path3, "wx", 384);
1295
1240
  tempFilePath = path3;
1296
1241
  retainedOutputArtifacts.add(path3);
1297
1242
  try {
1298
- writeFileSync(fd, fullBuffer);
1243
+ writeFileSync2(fd, fullBuffer);
1299
1244
  } finally {
1300
- closeSync(fd);
1245
+ closeSync2(fd);
1301
1246
  }
1302
1247
  }
1303
1248
  await finishTempFileStream(tempFileStream);
@@ -1379,7 +1324,7 @@ ${commandNonzeroHint}`;
1379
1324
  }
1380
1325
  const repeatedCommand = rememberCommandResult(
1381
1326
  `${resolvedShell}\0${workingDir}\0${effectiveCommand}`,
1382
- createHash("sha256").update(JSON.stringify({ code, sig, timedOut, outputText })).digest("hex")
1327
+ createHash2("sha256").update(JSON.stringify({ code, sig, timedOut, outputText })).digest("hex")
1383
1328
  );
1384
1329
  details.repeatedCommand = repeatedCommand;
1385
1330
  if (repeatedCommand.count > 1 && repeatedCommand.sameResult) {
@@ -1413,7 +1358,7 @@ ${commandNonzeroHint}`;
1413
1358
  }
1414
1359
 
1415
1360
  // src/capabilities/rendered-page-reader.ts
1416
- import { spawn as spawn2 } from "node:child_process";
1361
+ import { spawn as spawn3 } from "node:child_process";
1417
1362
  import { createRequire } from "node:module";
1418
1363
  import * as fs from "node:fs";
1419
1364
  import * as os from "node:os";
@@ -1433,7 +1378,7 @@ function resolveMcpScript() {
1433
1378
  function runAxi(args, options = {}) {
1434
1379
  const timeoutMs = options.timeoutMs ?? 6e4;
1435
1380
  return new Promise((resolve2, reject) => {
1436
- const child = spawn2(process.execPath, [resolveAxiCli(), ...args], {
1381
+ const child = spawn3(process.execPath, [resolveAxiCli(), ...args], {
1437
1382
  stdio: ["ignore", "pipe", "pipe"],
1438
1383
  shell: false,
1439
1384
  env: options.env,