@cydm/pie 1.0.14 → 1.0.15
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 +3 -2
- package/dist/builtin/extensions/plan-mode/index.js +3 -2
- package/dist/builtin/extensions/subagent/index.js +4 -3
- package/dist/builtin/extensions/todo/index.js +3 -2
- package/dist/chunks/{chunk-EFG2MQFD.js → chunk-55RUSXEA.js} +2 -2
- package/dist/chunks/{chunk-D7NAXU7F.js → chunk-5DA2D3K2.js} +79 -1097
- package/dist/chunks/{chunk-LF5Q7BVU.js → chunk-R5LYKDKA.js} +56 -5
- package/dist/chunks/chunk-VE2HDCNB.js +1029 -0
- package/dist/chunks/{src-LZC56DRG.js → src-6WPNVGT2.js} +2 -1
- package/dist/chunks/test-stream-ZSKNLUEJ.js +94 -0
- package/dist/cli.js +207 -33
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
Agent
|
|
3
|
+
Agent
|
|
4
|
+
} from "./chunk-VE2HDCNB.js";
|
|
5
|
+
import {
|
|
4
6
|
FileSystemGateway,
|
|
5
7
|
Type,
|
|
6
8
|
completeSimple,
|
|
@@ -8,7 +10,7 @@ import {
|
|
|
8
10
|
getFileSystem,
|
|
9
11
|
getPlatformConfig,
|
|
10
12
|
streamSimple
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5DA2D3K2.js";
|
|
12
14
|
import {
|
|
13
15
|
__require
|
|
14
16
|
} from "./chunk-TG2EQLX2.js";
|
|
@@ -3279,8 +3281,13 @@ var AgentSessionRetryController = class {
|
|
|
3279
3281
|
continueTurn;
|
|
3280
3282
|
retryAttempt = 0;
|
|
3281
3283
|
retryTimer;
|
|
3284
|
+
pendingRetry;
|
|
3285
|
+
resolvePendingRetry;
|
|
3282
3286
|
get hasPendingRetry() {
|
|
3283
|
-
return this.retryTimer !== void 0;
|
|
3287
|
+
return this.retryTimer !== void 0 || this.pendingRetry !== void 0;
|
|
3288
|
+
}
|
|
3289
|
+
waitForRetry() {
|
|
3290
|
+
return this.pendingRetry ?? Promise.resolve();
|
|
3284
3291
|
}
|
|
3285
3292
|
async handleTurnEnd(message) {
|
|
3286
3293
|
if (!this.retry || !message || message.role !== "assistant") {
|
|
@@ -3291,10 +3298,15 @@ var AgentSessionRetryController = class {
|
|
|
3291
3298
|
if (this.retryAttempt > 0) {
|
|
3292
3299
|
this.emit({ type: "retry_succeeded", attempts: this.retryAttempt });
|
|
3293
3300
|
this.retryAttempt = 0;
|
|
3301
|
+
this.resolvePending();
|
|
3294
3302
|
}
|
|
3295
3303
|
return;
|
|
3296
3304
|
}
|
|
3297
3305
|
if (!this.retry.isRetryableError(errorMessage)) {
|
|
3306
|
+
if (this.retryAttempt > 0) {
|
|
3307
|
+
this.retryAttempt = 0;
|
|
3308
|
+
this.resolvePending();
|
|
3309
|
+
}
|
|
3298
3310
|
return;
|
|
3299
3311
|
}
|
|
3300
3312
|
const maxRetries = this.retry.maxRetries ?? 3;
|
|
@@ -3302,10 +3314,12 @@ var AgentSessionRetryController = class {
|
|
|
3302
3314
|
if (this.retryAttempt > maxRetries) {
|
|
3303
3315
|
this.emit({ type: "retry_exhausted", errorMessage, maxRetries });
|
|
3304
3316
|
this.retryAttempt = 0;
|
|
3317
|
+
this.resolvePending();
|
|
3305
3318
|
return;
|
|
3306
3319
|
}
|
|
3307
3320
|
const attempt = this.retryAttempt;
|
|
3308
3321
|
const delayMs = (this.retry.baseDelayMs ?? 2e3) * 2 ** (attempt - 1);
|
|
3322
|
+
this.ensurePending();
|
|
3309
3323
|
this.emit({ type: "retry_scheduled", errorMessage, attempt, maxRetries, delayMs });
|
|
3310
3324
|
this.cancelTimerOnly();
|
|
3311
3325
|
const setTimer = this.retry.setTimeout ?? defaultSetTimeout4;
|
|
@@ -3313,13 +3327,21 @@ var AgentSessionRetryController = class {
|
|
|
3313
3327
|
this.retryTimer = void 0;
|
|
3314
3328
|
this.emit({ type: "retry_start", attempt, maxRetries });
|
|
3315
3329
|
this.removeTrailingAssistantError();
|
|
3316
|
-
void this.continueTurn().catch(() => {
|
|
3330
|
+
void this.continueTurn().catch((error) => {
|
|
3331
|
+
this.emit({
|
|
3332
|
+
type: "retry_exhausted",
|
|
3333
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
3334
|
+
maxRetries
|
|
3335
|
+
});
|
|
3336
|
+
this.retryAttempt = 0;
|
|
3337
|
+
this.resolvePending();
|
|
3317
3338
|
});
|
|
3318
3339
|
}, delayMs);
|
|
3319
3340
|
}
|
|
3320
3341
|
cancel() {
|
|
3321
3342
|
this.cancelTimerOnly();
|
|
3322
3343
|
this.retryAttempt = 0;
|
|
3344
|
+
this.resolvePending();
|
|
3323
3345
|
}
|
|
3324
3346
|
cancelTimerOnly() {
|
|
3325
3347
|
if (this.retryTimer === void 0) {
|
|
@@ -3329,6 +3351,20 @@ var AgentSessionRetryController = class {
|
|
|
3329
3351
|
clearTimer(this.retryTimer);
|
|
3330
3352
|
this.retryTimer = void 0;
|
|
3331
3353
|
}
|
|
3354
|
+
ensurePending() {
|
|
3355
|
+
if (this.pendingRetry) {
|
|
3356
|
+
return;
|
|
3357
|
+
}
|
|
3358
|
+
this.pendingRetry = new Promise((resolve2) => {
|
|
3359
|
+
this.resolvePendingRetry = resolve2;
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
resolvePending() {
|
|
3363
|
+
const resolve2 = this.resolvePendingRetry;
|
|
3364
|
+
this.pendingRetry = void 0;
|
|
3365
|
+
this.resolvePendingRetry = void 0;
|
|
3366
|
+
resolve2?.();
|
|
3367
|
+
}
|
|
3332
3368
|
};
|
|
3333
3369
|
|
|
3334
3370
|
// ../../packages/agent-framework/src/session/controller/runtime-guard.ts
|
|
@@ -3735,6 +3771,15 @@ var AgentSessionController = class {
|
|
|
3735
3771
|
waitForIdle() {
|
|
3736
3772
|
return this.agent.waitForIdle();
|
|
3737
3773
|
}
|
|
3774
|
+
async waitForSettled() {
|
|
3775
|
+
while (true) {
|
|
3776
|
+
await this.agent.waitForIdle();
|
|
3777
|
+
if (!this.retryController.hasPendingRetry) {
|
|
3778
|
+
return;
|
|
3779
|
+
}
|
|
3780
|
+
await this.retryController.waitForRetry();
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3738
3783
|
async runAutoCompact(reason, willRetry = false) {
|
|
3739
3784
|
return runAgentSessionCompaction({
|
|
3740
3785
|
reason,
|
|
@@ -3833,6 +3878,10 @@ var AgentSessionController = class {
|
|
|
3833
3878
|
if (this.disposed || this.runtimeGuard.triggered) {
|
|
3834
3879
|
return;
|
|
3835
3880
|
}
|
|
3881
|
+
const assistantError = message?.role === "assistant" && message.stopReason === "error" && Boolean(message.errorMessage);
|
|
3882
|
+
if (!assistantError) {
|
|
3883
|
+
await this.retryController.handleTurnEnd(message);
|
|
3884
|
+
}
|
|
3836
3885
|
const compactDecision = this.getAutoCompactDecision?.({
|
|
3837
3886
|
agent: this.agent,
|
|
3838
3887
|
sessionManager: this.sessionManager,
|
|
@@ -3844,7 +3893,9 @@ var AgentSessionController = class {
|
|
|
3844
3893
|
this.scheduleAutoCompact(compactDecision);
|
|
3845
3894
|
return;
|
|
3846
3895
|
}
|
|
3847
|
-
|
|
3896
|
+
if (assistantError) {
|
|
3897
|
+
await this.retryController.handleTurnEnd(message);
|
|
3898
|
+
}
|
|
3848
3899
|
}
|
|
3849
3900
|
async handleAgentEndHook(messages) {
|
|
3850
3901
|
if (this.disposed || this.runtimeGuard.triggered) {
|