@cydm/pie 4.14.1 → 4.15.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 (31) hide show
  1. package/README.md +5 -5
  2. package/dist/builtin/extensions/ask-user/index.js +4 -4
  3. package/dist/builtin/extensions/im-forward/index.js +889 -205
  4. package/dist/builtin/extensions/memory/index.js +6 -6
  5. package/dist/builtin/extensions/memory/package.json +1 -2
  6. package/dist/builtin/extensions/pie-proc/index.js +6 -6
  7. package/dist/builtin/extensions/plan-mode/index.js +4 -4
  8. package/dist/builtin/extensions/subagent/index.js +5 -5
  9. package/dist/builtin/extensions/todo/index.js +4 -4
  10. package/dist/chunks/{chunk-IQDVL34H.js → chunk-6AYPNTCO.js} +8 -8
  11. package/dist/chunks/{chunk-SYZR74QO.js → chunk-J6EZ335F.js} +8 -7
  12. package/dist/chunks/{chunk-X3ZVZB2R.js → chunk-JE53PC46.js} +633 -148
  13. package/dist/chunks/{chunk-2WLKAMOH.js → chunk-LIA52LJU.js} +3 -3
  14. package/dist/chunks/{chunk-SAXKBFX3.js → chunk-MTH6QSYD.js} +1 -1
  15. package/dist/chunks/{chunk-TTSQWGAT.js → chunk-NAMH667S.js} +10 -15
  16. package/dist/chunks/{chunk-DJ4LO7PQ.js → chunk-VWDCKHCC.js} +1 -1
  17. package/dist/chunks/{chunk-IM7DLPPY.js → chunk-YKV45EMY.js} +239 -141
  18. package/dist/chunks/{chunk-OQCKDEEE.js → chunk-ZBIR5YS7.js} +1 -1
  19. package/dist/chunks/{chunk-TNRZEQD5.js → chunk-ZH6EAKVM.js} +2 -2
  20. package/dist/chunks/{host-image-fallback-AEKY2LSZ.js → host-image-fallback-GX2KXZXQ.js} +1 -1
  21. package/dist/chunks/{memory-git-G56IXFWU.js → memory-git-BJMYZHIE.js} +5 -5
  22. package/dist/chunks/{model-registry-4LM2I6FR.js → model-registry-T6EMM66I.js} +2 -2
  23. package/dist/chunks/{read-file-understanding-GTNZHAK5.js → read-file-understanding-ZRE5KDG3.js} +5 -5
  24. package/dist/chunks/{src-3YJ4UVEC.js → src-DLAIQCKP.js} +3 -3
  25. package/dist/chunks/{src-APNP4M4N.js → src-FWL3LCBK.js} +2 -2
  26. package/dist/chunks/{src-T6AUO53N.js → src-OP6LFLR6.js} +8 -4
  27. package/dist/chunks/{src-TNUD7EDH.js → src-XJKZIY3S.js} +11 -1
  28. package/dist/chunks/{test-stream-EF2DHEHV.js → test-stream-P3CUEGEE.js} +1 -1
  29. package/dist/cli.js +408 -52
  30. package/models.schema.json +4 -0
  31. package/package.json +2 -2
@@ -3,10 +3,10 @@ import {
3
3
  distillWorkerLogPath,
4
4
  readDistillWorkerLog,
5
5
  spawnDistillWorker
6
- } from "../../../chunks/chunk-IQDVL34H.js";
6
+ } from "../../../chunks/chunk-6AYPNTCO.js";
7
7
  import {
8
8
  commitCuratedMemoryBestEffort
9
- } from "../../../chunks/chunk-DJ4LO7PQ.js";
9
+ } from "../../../chunks/chunk-VWDCKHCC.js";
10
10
  import {
11
11
  getConfigDir,
12
12
  getSessionsDir,
@@ -27,12 +27,12 @@ import {
27
27
  saveAttestedEntry,
28
28
  searchMemory,
29
29
  todayKey
30
- } from "../../../chunks/chunk-X3ZVZB2R.js";
30
+ } from "../../../chunks/chunk-JE53PC46.js";
31
31
  import {
32
32
  FileSessionStore
33
- } from "../../../chunks/chunk-SYZR74QO.js";
34
- import "../../../chunks/chunk-SAXKBFX3.js";
35
- import "../../../chunks/chunk-IM7DLPPY.js";
33
+ } from "../../../chunks/chunk-J6EZ335F.js";
34
+ import "../../../chunks/chunk-MTH6QSYD.js";
35
+ import "../../../chunks/chunk-YKV45EMY.js";
36
36
  import {
37
37
  Type
38
38
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -6,8 +6,7 @@
6
6
  "type": "module",
7
7
  "pie": {
8
8
  "name": "memory",
9
- "main": "index.js",
10
- "defaultEnablement": false
9
+ "main": "index.js"
11
10
  },
12
11
  "keywords": [
13
12
  "pie",
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  registerWorkerLifecycleBridge,
4
4
  syncInheritedWorkerModels
5
- } from "../../../chunks/chunk-OQCKDEEE.js";
5
+ } from "../../../chunks/chunk-ZBIR5YS7.js";
6
6
  import {
7
7
  readProcessCommandLine
8
8
  } from "../../../chunks/chunk-7RJXKN7N.js";
@@ -13,16 +13,16 @@ import "../../../chunks/chunk-Q4NJEPIZ.js";
13
13
  import {
14
14
  loadResolvedModelsConfig,
15
15
  normalizeModelClassRoutes
16
- } from "../../../chunks/chunk-TTSQWGAT.js";
16
+ } from "../../../chunks/chunk-NAMH667S.js";
17
17
  import "../../../chunks/chunk-CBDQJMUI.js";
18
18
  import {
19
19
  redactText
20
- } from "../../../chunks/chunk-X3ZVZB2R.js";
20
+ } from "../../../chunks/chunk-JE53PC46.js";
21
21
  import {
22
22
  isCompactSummaryMessage
23
- } from "../../../chunks/chunk-SYZR74QO.js";
24
- import "../../../chunks/chunk-SAXKBFX3.js";
25
- import "../../../chunks/chunk-IM7DLPPY.js";
23
+ } from "../../../chunks/chunk-J6EZ335F.js";
24
+ import "../../../chunks/chunk-MTH6QSYD.js";
25
+ import "../../../chunks/chunk-YKV45EMY.js";
26
26
  import {
27
27
  Type
28
28
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -6,10 +6,10 @@ import {
6
6
  createPlanCapability,
7
7
  markCompletedPlanSteps,
8
8
  restoreExecutionState
9
- } from "../../../chunks/chunk-X3ZVZB2R.js";
10
- import "../../../chunks/chunk-SYZR74QO.js";
11
- import "../../../chunks/chunk-SAXKBFX3.js";
12
- import "../../../chunks/chunk-IM7DLPPY.js";
9
+ } from "../../../chunks/chunk-JE53PC46.js";
10
+ import "../../../chunks/chunk-J6EZ335F.js";
11
+ import "../../../chunks/chunk-MTH6QSYD.js";
12
+ import "../../../chunks/chunk-YKV45EMY.js";
13
13
  import {
14
14
  Type
15
15
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -5,7 +5,7 @@ import {
5
5
  createCliRetryPolicy,
6
6
  formatTransportLifecycle,
7
7
  logTransportLifecycle
8
- } from "../../../chunks/chunk-2WLKAMOH.js";
8
+ } from "../../../chunks/chunk-LIA52LJU.js";
9
9
  import {
10
10
  getConfigDir
11
11
  } from "../../../chunks/chunk-CBDQJMUI.js";
@@ -14,10 +14,10 @@ import {
14
14
  createPolicyEnforcedTools,
15
15
  createSharedFileSystemTools,
16
16
  createSubagentCapability
17
- } from "../../../chunks/chunk-X3ZVZB2R.js";
18
- import "../../../chunks/chunk-SYZR74QO.js";
19
- import "../../../chunks/chunk-SAXKBFX3.js";
20
- import "../../../chunks/chunk-IM7DLPPY.js";
17
+ } from "../../../chunks/chunk-JE53PC46.js";
18
+ import "../../../chunks/chunk-J6EZ335F.js";
19
+ import "../../../chunks/chunk-MTH6QSYD.js";
20
+ import "../../../chunks/chunk-YKV45EMY.js";
21
21
  import "../../../chunks/chunk-XXGYUYXI.js";
22
22
  import "../../../chunks/chunk-LZQXQOPJ.js";
23
23
 
@@ -8,10 +8,10 @@ import {
8
8
  executeManageTodoList,
9
9
  executionStateToTodos,
10
10
  restoreExecutionState
11
- } from "../../../chunks/chunk-X3ZVZB2R.js";
12
- import "../../../chunks/chunk-SYZR74QO.js";
13
- import "../../../chunks/chunk-SAXKBFX3.js";
14
- import "../../../chunks/chunk-IM7DLPPY.js";
11
+ } from "../../../chunks/chunk-JE53PC46.js";
12
+ import "../../../chunks/chunk-J6EZ335F.js";
13
+ import "../../../chunks/chunk-MTH6QSYD.js";
14
+ import "../../../chunks/chunk-YKV45EMY.js";
15
15
  import "../../../chunks/chunk-XXGYUYXI.js";
16
16
  import "../../../chunks/chunk-LZQXQOPJ.js";
17
17
 
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-CBDQJMUI.js";
5
5
  import {
6
6
  createMemoryLockBackend
7
- } from "./chunk-X3ZVZB2R.js";
7
+ } from "./chunk-JE53PC46.js";
8
8
 
9
9
  // src/commands/memory-distill.ts
10
10
  import * as fs from "node:fs";
@@ -194,7 +194,7 @@ function createWikiModelCall(registry, modelClass, explicitModelSpec, timeoutMs
194
194
  };
195
195
  return async (prompt, options) => {
196
196
  const targets = resolveTargets();
197
- const complete = hooks?.completeFn ?? (await import("./src-TNUD7EDH.js")).completeSimple;
197
+ const complete = hooks?.completeFn ?? (await import("./src-XJKZIY3S.js")).completeSimple;
198
198
  const runCandidate = async (model, apiKey) => {
199
199
  const invokeOnce = async () => {
200
200
  const controller = new AbortController();
@@ -225,7 +225,7 @@ function createWikiModelCall(registry, modelClass, explicitModelSpec, timeoutMs
225
225
  if (message.stopReason && message.stopReason !== "stop") {
226
226
  const detail = typeof message.errorMessage === "string" && message.errorMessage.trim() ? `: ${message.errorMessage.trim()}` : "";
227
227
  const err = new Error(`wiki model call (${model.provider}/${model.id}) ended with stopReason=${message.stopReason}${detail}`);
228
- if (message.retryable === false || message.stopReason === "length") {
228
+ if (message.retryable === false || message.remoteFailure?.quotaExhausted === true || message.stopReason === "length") {
229
229
  err.noImmediateReplay = true;
230
230
  }
231
231
  throw err;
@@ -356,12 +356,12 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false, sessionsDi
356
356
  let result;
357
357
  let wikiForError;
358
358
  try {
359
- const { ModelRegistry } = await import("./model-registry-4LM2I6FR.js");
359
+ const { ModelRegistry } = await import("./model-registry-T6EMM66I.js");
360
360
  const { AuthStorage } = await import("./auth-storage-IJEJ2TGE.js");
361
361
  const { getSessionsDir } = await import("./config-4EOI5NOU.js");
362
- const { FileSessionStore } = await import("./src-3YJ4UVEC.js");
363
- const { WikiStore, runWikiBootstrap, runWikiDreamBatches, runWikiGc } = await import("./src-T6AUO53N.js");
364
- const { commitCuratedMemoryBestEffort } = await import("./memory-git-G56IXFWU.js");
362
+ const { FileSessionStore } = await import("./src-DLAIQCKP.js");
363
+ const { WikiStore, runWikiBootstrap, runWikiDreamBatches, runWikiGc } = await import("./src-OP6LFLR6.js");
364
+ const { commitCuratedMemoryBestEffort } = await import("./memory-git-BJMYZHIE.js");
365
365
  const wiki = new WikiStore(memoryRoot);
366
366
  wikiForError = wiki;
367
367
  const inboxOnly = date === "__inbox__";
@@ -456,7 +456,7 @@ async function runDistillAuto(memoryRoot, days = 7, runner, sessionsDir) {
456
456
  } catch {
457
457
  }
458
458
  };
459
- const { WikiStore, countWikiInbox, todayKey } = await import("./src-T6AUO53N.js");
459
+ const { WikiStore, countWikiInbox, todayKey } = await import("./src-OP6LFLR6.js");
460
460
  const wiki = new WikiStore(memoryRoot);
461
461
  const today = todayKey(Date.now());
462
462
  const dates = [];
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  createAgentOperationError,
4
4
  getAgentFailureMetadata
5
- } from "./chunk-SAXKBFX3.js";
5
+ } from "./chunk-MTH6QSYD.js";
6
6
  import {
7
7
  EMPTY_ASSISTANT_CONTENT_ERROR,
8
8
  FileSystemGateway,
@@ -10,8 +10,9 @@ import {
10
10
  detectPlatform,
11
11
  getFileSystemGateway,
12
12
  getPlatformConfig,
13
+ isQuotaOrBillingFailure,
13
14
  streamSimple
14
- } from "./chunk-IM7DLPPY.js";
15
+ } from "./chunk-YKV45EMY.js";
15
16
  import {
16
17
  Type
17
18
  } from "./chunk-XXGYUYXI.js";
@@ -818,13 +819,12 @@ import { createRequire } from "node:module";
818
819
  import { fileURLToPath } from "node:url";
819
820
 
820
821
  // ../../packages/agent-framework/src/session/remote-failure.ts
821
- var QUOTA_EXHAUSTED_PATTERN = /insufficient[_ ]quota|plan[_ ]quota[_ ](?:exhausted|exceeded|depleted)|fresh plan quota.*required|credit[_ ]protection|credit protection|credits are disabled|exceeded[_ ]current[_ ]quota|exceeded your current quota|billing[_ ]hard[_ ]limit|insufficient[_ ]balance|credit balance is too low|\barrearage\b|余额不足|\b(?:account|monthly|billing|plan) quota (?:has been |is )?(?:exhausted|exceeded|depleted)|(?:您)?已达到.{0,12}(?:5\s*小时|每周|每月|本周|本月).{0,6}(?:使用)?上限|\b(?:5-?hour|weekly|monthly)\s+(?:plan\s+|subscription\s+)?usage\s+limit\b|\bplan\s+usage\s+limit\b/i;
822
822
  function isDefaultQuotaExhaustedError(errorMessage) {
823
- return QUOTA_EXHAUSTED_PATTERN.test(errorMessage);
823
+ return isQuotaOrBillingFailure(errorMessage);
824
824
  }
825
825
  function classifyRemoteFailure(remote, message) {
826
826
  if (!remote || !["transient", "other", "context_overflow"].includes(remote.category)) return void 0;
827
- if ((remote.category === "other" || remote.category === "transient") && isDefaultQuotaExhaustedError(message)) {
827
+ if (remote.quotaExhausted === true || (remote.category === "other" || remote.category === "transient") && isDefaultQuotaExhaustedError(message)) {
828
828
  return {
829
829
  kind: "auth_config",
830
830
  retryable: false,
@@ -1170,8 +1170,8 @@ function isCompactionWsOverflowError(error) {
1170
1170
  function isTransientCompactionFailure(error) {
1171
1171
  const record = error && typeof error === "object" ? error : void 0;
1172
1172
  const text = `${record?.code ?? ""} ${record?.message ?? String(error)}`;
1173
- if (record?.name === "AbortError" || /request was aborted|local abort signal|user abort|user_interrupt|interrupted by user|esc pressed|ctrl\+c|\bcancel(?:led|ed)\b|insufficient[_ ]quota|exceeded[_ ]current[_ ]quota|exceeded your current quota|insufficient[_ ]balance|credit balance is too low|\barrearage\b|余额不足|\b(?:account|monthly|billing) quota (?:has been |is )?exhausted|billing|invalid api key|unauthorized|forbidden/i.test(text)) return false;
1174
1173
  const status = record?.status ?? record?.statusCode;
1174
+ if (record?.name === "AbortError" || /request was aborted|local abort signal|user abort|user_interrupt|interrupted by user|esc pressed|ctrl\+c|\bcancel(?:led|ed)\b|invalid api key|unauthorized|forbidden/i.test(text) || isQuotaOrBillingFailure(error, status) || isQuotaOrBillingFailure(text, status)) return false;
1175
1175
  if (status !== void 0) {
1176
1176
  if (status === 400 && AGY_BRIDGE_TRANSIENT_PATTERN.test(text)) return true;
1177
1177
  return status === 429 || status >= 500 && status <= 599;
@@ -1605,7 +1605,7 @@ function createSimpleSummary(messages) {
1605
1605
  ].filter(Boolean).join("\n");
1606
1606
  }
1607
1607
  async function createCompactionSummary(messages, options = {}) {
1608
- const { model, apiKey, systemPrompt, compactPrompt, signal } = options;
1608
+ const { model, apiKey, systemPrompt, compactPrompt, signal, sessionId } = options;
1609
1609
  const throwIfAborted = () => {
1610
1610
  if (signal?.aborted) {
1611
1611
  throw new Error("Compaction aborted");
@@ -1641,6 +1641,7 @@ Return a text-only successor handoff. Do not call any tools.` }],
1641
1641
  {
1642
1642
  apiKey,
1643
1643
  signal,
1644
+ ...sessionId ? { sessionId } : {},
1644
1645
  ...forceSseFallback ? { transport: "sse" } : {}
1645
1646
  }
1646
1647
  ).result();