@cydm/pie 4.14.0 → 4.14.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.
- package/dist/builtin/extensions/ask-user/index.js +4 -4
- package/dist/builtin/extensions/cron/index.js +70 -17
- package/dist/builtin/extensions/im-forward/index.js +8 -8
- package/dist/builtin/extensions/memory/index.js +6 -6
- package/dist/builtin/extensions/pie-proc/README.md +12 -3
- package/dist/builtin/extensions/pie-proc/index.js +88 -45
- package/dist/builtin/extensions/plan-mode/index.js +4 -4
- package/dist/builtin/extensions/subagent/index.js +5 -5
- package/dist/builtin/extensions/todo/index.js +4 -4
- package/dist/chunks/{chunk-BOQIGMGQ.js → chunk-2WLKAMOH.js} +3 -3
- package/dist/chunks/{chunk-IK2FR2YF.js → chunk-DJ4LO7PQ.js} +1 -1
- package/dist/chunks/{chunk-MCR4JYI6.js → chunk-IM7DLPPY.js} +74 -8
- package/dist/chunks/{chunk-FD3KBPDR.js → chunk-IQDVL34H.js} +7 -7
- package/dist/chunks/{chunk-JKO42HZW.js → chunk-OQCKDEEE.js} +1 -1
- package/dist/chunks/{chunk-26KRUYZH.js → chunk-SAXKBFX3.js} +1 -1
- package/dist/chunks/{chunk-JJH77AUU.js → chunk-SYZR74QO.js} +4 -4
- package/dist/chunks/{chunk-KGWKRO7Z.js → chunk-TNRZEQD5.js} +2 -2
- package/dist/chunks/{chunk-UYDS75SI.js → chunk-TTSQWGAT.js} +2 -1
- package/dist/chunks/{chunk-EZZTMDWZ.js → chunk-X3ZVZB2R.js} +435 -17
- package/dist/chunks/{host-image-fallback-LPHB5CTL.js → host-image-fallback-AEKY2LSZ.js} +1 -1
- package/dist/chunks/{memory-git-ZJN6SPIU.js → memory-git-G56IXFWU.js} +5 -5
- package/dist/chunks/{model-registry-GLBIUOJR.js → model-registry-4LM2I6FR.js} +2 -2
- package/dist/chunks/{read-file-understanding-DFJPTTSB.js → read-file-understanding-GTNZHAK5.js} +5 -5
- package/dist/chunks/{src-KZ7YID3I.js → src-3YJ4UVEC.js} +3 -3
- package/dist/chunks/{src-ALHMJZ5R.js → src-APNP4M4N.js} +2 -2
- package/dist/chunks/{src-LEXKDSFV.js → src-T6AUO53N.js} +4 -4
- package/dist/chunks/{src-76Q33OY5.js → src-TNUD7EDH.js} +1 -1
- package/dist/chunks/{test-stream-OVGDTXOY.js → test-stream-EF2DHEHV.js} +1 -1
- package/dist/cli.js +16 -16
- package/package.json +1 -1
|
@@ -5300,12 +5300,13 @@ var ResponsesEventReducer = class {
|
|
|
5300
5300
|
events.push(...this.appendTextDelta(raw, "text"));
|
|
5301
5301
|
break;
|
|
5302
5302
|
case "response.output_text.done":
|
|
5303
|
-
this.
|
|
5303
|
+
events.push(...this.onTextDone(raw, "text"));
|
|
5304
5304
|
break;
|
|
5305
5305
|
case "response.refusal.delta":
|
|
5306
5306
|
events.push(...this.appendTextDelta(raw, "refusal"));
|
|
5307
5307
|
break;
|
|
5308
5308
|
case "response.refusal.done":
|
|
5309
|
+
events.push(...this.onTextDone(raw, "refusal"));
|
|
5309
5310
|
break;
|
|
5310
5311
|
case "response.reasoning_summary_text.delta":
|
|
5311
5312
|
case "response.reasoning_text.delta":
|
|
@@ -5435,16 +5436,30 @@ var ResponsesEventReducer = class {
|
|
|
5435
5436
|
throw new ResponsesProtocolError("response.content_part.added is missing a valid content_index.");
|
|
5436
5437
|
}
|
|
5437
5438
|
if (state.kind !== "message") return [];
|
|
5438
|
-
|
|
5439
|
+
const existing = state.blocks.get(partIndex);
|
|
5440
|
+
if (existing?.started) {
|
|
5439
5441
|
throw new ResponsesProtocolError(`Responses stream reused content_index ${partIndex} on one message item.`);
|
|
5440
5442
|
}
|
|
5441
5443
|
if (partType !== "output_text" && partType !== "refusal") {
|
|
5442
5444
|
return [];
|
|
5443
5445
|
}
|
|
5446
|
+
if (existing) {
|
|
5447
|
+
existing.started = true;
|
|
5448
|
+
return [{ type: "text_start", contentIndex: existing.contentIndex, partial: this.output }];
|
|
5449
|
+
}
|
|
5450
|
+
if (partIndex > 0 && partIndex <= 32) {
|
|
5451
|
+
for (let idx = 0; idx < partIndex; idx += 1) {
|
|
5452
|
+
if (state.blocks.has(idx)) continue;
|
|
5453
|
+
const placeholder = { type: "text", text: "" };
|
|
5454
|
+
this.output.content.push(placeholder);
|
|
5455
|
+
state.blocks.set(idx, { block: placeholder, contentIndex: this.output.content.length - 1, started: false });
|
|
5456
|
+
}
|
|
5457
|
+
}
|
|
5444
5458
|
const block = { type: "text", text: "" };
|
|
5445
5459
|
this.output.content.push(block);
|
|
5446
|
-
|
|
5447
|
-
|
|
5460
|
+
const contentIndex = this.output.content.length - 1;
|
|
5461
|
+
state.blocks.set(partIndex, { block, contentIndex, started: true });
|
|
5462
|
+
return [{ type: "text_start", contentIndex, partial: this.output }];
|
|
5448
5463
|
}
|
|
5449
5464
|
messageBlockFor(raw) {
|
|
5450
5465
|
const { state } = this.lookupItem(raw, ["message"], "message");
|
|
@@ -5454,7 +5469,7 @@ var ResponsesEventReducer = class {
|
|
|
5454
5469
|
throw new ResponsesProtocolError(`Responses event "${raw.type}" is missing a valid content_index.`);
|
|
5455
5470
|
}
|
|
5456
5471
|
const entry = state.blocks.get(partIndex);
|
|
5457
|
-
if (!entry) {
|
|
5472
|
+
if (!entry || !entry.started) {
|
|
5458
5473
|
throw new ResponsesProtocolError(
|
|
5459
5474
|
`Responses event "${raw.type}" references content_index ${partIndex} that was never added.`
|
|
5460
5475
|
);
|
|
@@ -5468,8 +5483,16 @@ var ResponsesEventReducer = class {
|
|
|
5468
5483
|
entry.block.text += delta;
|
|
5469
5484
|
return [{ type: "text_delta", contentIndex: entry.contentIndex, delta, partial: this.output }];
|
|
5470
5485
|
}
|
|
5471
|
-
|
|
5472
|
-
this.messageBlockFor(raw);
|
|
5486
|
+
onTextDone(raw, kind) {
|
|
5487
|
+
const entry = this.messageBlockFor(raw);
|
|
5488
|
+
if (entry.block.text.length === 0) {
|
|
5489
|
+
const fallback = kind === "refusal" ? raw.refusal : raw.text;
|
|
5490
|
+
if (typeof fallback === "string" && fallback.length > 0) {
|
|
5491
|
+
entry.block.text = fallback;
|
|
5492
|
+
return [{ type: "text_delta", contentIndex: entry.contentIndex, delta: fallback, partial: this.output }];
|
|
5493
|
+
}
|
|
5494
|
+
}
|
|
5495
|
+
return [];
|
|
5473
5496
|
}
|
|
5474
5497
|
appendReasoningDelta(raw) {
|
|
5475
5498
|
const delta = raw.delta;
|
|
@@ -5519,7 +5542,39 @@ ${delta}`;
|
|
|
5519
5542
|
switch (state.kind) {
|
|
5520
5543
|
case "message": {
|
|
5521
5544
|
const events = [];
|
|
5522
|
-
|
|
5545
|
+
const doneParts = Array.isArray(item.content) ? item.content : [];
|
|
5546
|
+
for (let idx = 0; idx < doneParts.length; idx += 1) {
|
|
5547
|
+
const part = doneParts[idx];
|
|
5548
|
+
if (!isRecord(part)) continue;
|
|
5549
|
+
const partType = part.type;
|
|
5550
|
+
if (partType !== "output_text" && partType !== "refusal") continue;
|
|
5551
|
+
const fallback = partType === "refusal" ? typeof part.refusal === "string" ? part.refusal : "" : typeof part.text === "string" ? part.text : "";
|
|
5552
|
+
const existing = state.blocks.get(idx);
|
|
5553
|
+
if (existing) {
|
|
5554
|
+
if (!existing.started) {
|
|
5555
|
+
existing.started = true;
|
|
5556
|
+
existing.block.text = fallback;
|
|
5557
|
+
events.push({ type: "text_start", contentIndex: existing.contentIndex, partial: this.output });
|
|
5558
|
+
if (fallback.length > 0) {
|
|
5559
|
+
events.push({ type: "text_delta", contentIndex: existing.contentIndex, delta: fallback, partial: this.output });
|
|
5560
|
+
}
|
|
5561
|
+
} else if (existing.block.text.length === 0 && fallback.length > 0) {
|
|
5562
|
+
existing.block.text = fallback;
|
|
5563
|
+
events.push({ type: "text_delta", contentIndex: existing.contentIndex, delta: fallback, partial: this.output });
|
|
5564
|
+
}
|
|
5565
|
+
} else {
|
|
5566
|
+
const block = { type: "text", text: fallback };
|
|
5567
|
+
this.output.content.push(block);
|
|
5568
|
+
const contentIndex = this.output.content.length - 1;
|
|
5569
|
+
state.blocks.set(idx, { block, contentIndex, started: true });
|
|
5570
|
+
events.push({ type: "text_start", contentIndex, partial: this.output });
|
|
5571
|
+
if (fallback.length > 0) {
|
|
5572
|
+
events.push({ type: "text_delta", contentIndex, delta: fallback, partial: this.output });
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
const ordered = [...state.blocks.entries()].filter(([, entry]) => entry.started).sort((a, b) => a[0] - b[0]);
|
|
5577
|
+
for (const [, { block, contentIndex }] of ordered) {
|
|
5523
5578
|
events.push({ type: "text_end", contentIndex, content: block.text, partial: this.output });
|
|
5524
5579
|
}
|
|
5525
5580
|
return events;
|
|
@@ -5663,6 +5718,11 @@ ${delta}`;
|
|
|
5663
5718
|
if (stopReason === "toolUse" && this.toolCallStates.length === 0) {
|
|
5664
5719
|
stopReason = "stop";
|
|
5665
5720
|
}
|
|
5721
|
+
if (stopReason === "stop" && !hasAssistantContent(this.output)) {
|
|
5722
|
+
this.output.stopReason = "error";
|
|
5723
|
+
this.output.errorMessage = EMPTY_ASSISTANT_CONTENT_ERROR;
|
|
5724
|
+
return [{ type: "error", reason: "error", error: this.output }];
|
|
5725
|
+
}
|
|
5666
5726
|
this.output.stopReason = stopReason;
|
|
5667
5727
|
void terminalType;
|
|
5668
5728
|
return [{ type: "done", reason: stopReason, message: this.output }];
|
|
@@ -7547,6 +7607,9 @@ function streamResponsesSSE(model, context, options) {
|
|
|
7547
7607
|
stream2.push(assistantEvent);
|
|
7548
7608
|
}
|
|
7549
7609
|
if (reducer.isTerminal) {
|
|
7610
|
+
if (reducer.message.stopReason === "error" && reducer.message.errorMessage === EMPTY_ASSISTANT_CONTENT_ERROR) {
|
|
7611
|
+
logEmptyAssistantContentError(new EmptyAssistantContentError(), model, options);
|
|
7612
|
+
}
|
|
7550
7613
|
terminalAccepted = true;
|
|
7551
7614
|
phase = "terminal_accepted";
|
|
7552
7615
|
clearTotalTimer();
|
|
@@ -8245,6 +8308,9 @@ function streamResponsesWS(model, context, options) {
|
|
|
8245
8308
|
}
|
|
8246
8309
|
}
|
|
8247
8310
|
finished = true;
|
|
8311
|
+
if (reducer.message.stopReason === "error" && reducer.message.errorMessage === EMPTY_ASSISTANT_CONTENT_ERROR) {
|
|
8312
|
+
logEmptyAssistantContentError(new EmptyAssistantContentError(), model, options);
|
|
8313
|
+
}
|
|
8248
8314
|
clearRequestTimers();
|
|
8249
8315
|
retryDecision = reducer.message.remoteFailure ? `remote_${reducer.message.remoteFailure.category}` : "terminal";
|
|
8250
8316
|
lifecycle("terminal_accepted", {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-CBDQJMUI.js";
|
|
5
5
|
import {
|
|
6
6
|
createMemoryLockBackend
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X3ZVZB2R.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-
|
|
197
|
+
const complete = hooks?.completeFn ?? (await import("./src-TNUD7EDH.js")).completeSimple;
|
|
198
198
|
const runCandidate = async (model, apiKey) => {
|
|
199
199
|
const invokeOnce = async () => {
|
|
200
200
|
const controller = new AbortController();
|
|
@@ -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-
|
|
359
|
+
const { ModelRegistry } = await import("./model-registry-4LM2I6FR.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-
|
|
363
|
-
const { WikiStore, runWikiBootstrap, runWikiDreamBatches, runWikiGc } = await import("./src-
|
|
364
|
-
const { commitCuratedMemoryBestEffort } = await import("./memory-git-
|
|
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");
|
|
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-
|
|
459
|
+
const { WikiStore, countWikiInbox, todayKey } = await import("./src-T6AUO53N.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-
|
|
5
|
+
} from "./chunk-SAXKBFX3.js";
|
|
6
6
|
import {
|
|
7
7
|
EMPTY_ASSISTANT_CONTENT_ERROR,
|
|
8
8
|
FileSystemGateway,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getFileSystemGateway,
|
|
12
12
|
getPlatformConfig,
|
|
13
13
|
streamSimple
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IM7DLPPY.js";
|
|
15
15
|
import {
|
|
16
16
|
Type
|
|
17
17
|
} from "./chunk-XXGYUYXI.js";
|
|
@@ -818,13 +818,13 @@ import { createRequire } from "node:module";
|
|
|
818
818
|
import { fileURLToPath } from "node:url";
|
|
819
819
|
|
|
820
820
|
// ../../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)/i;
|
|
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
823
|
return QUOTA_EXHAUSTED_PATTERN.test(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" && isDefaultQuotaExhaustedError(message)) {
|
|
827
|
+
if ((remote.category === "other" || remote.category === "transient") && isDefaultQuotaExhaustedError(message)) {
|
|
828
828
|
return {
|
|
829
829
|
kind: "auth_config",
|
|
830
830
|
retryable: false,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
createReadFileUnderstandingHandler,
|
|
7
7
|
modalityForReadFileUnderstandingKind
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-X3ZVZB2R.js";
|
|
9
9
|
import {
|
|
10
10
|
getLogger
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IM7DLPPY.js";
|
|
12
12
|
|
|
13
13
|
// src/capabilities/read-file-understanding.ts
|
|
14
14
|
import * as path10 from "node:path";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
modelSupportsToolPurpose,
|
|
14
14
|
requiredCapabilityForToolPurpose,
|
|
15
15
|
sortToolModelCandidatesByCapability
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IM7DLPPY.js";
|
|
17
17
|
|
|
18
18
|
// src/core/model-registry.ts
|
|
19
19
|
import * as fs2 from "fs";
|
|
@@ -2351,6 +2351,7 @@ var ModelRegistry = class {
|
|
|
2351
2351
|
|
|
2352
2352
|
export {
|
|
2353
2353
|
mergeThinkingCapability,
|
|
2354
|
+
normalizeModelClassRoutes,
|
|
2354
2355
|
validatedRemoteCatalogs,
|
|
2355
2356
|
validateModelsDocumentShape,
|
|
2356
2357
|
resolveProfileRoute,
|