@yachiyo-5i/xlyra-agent 1.5.0 → 1.5.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/{chunk-JTYI7NWG.js → chunk-BNTVTVSW.js} +7 -22
- package/dist/chunk-BNTVTVSW.js.map +1 -0
- package/dist/cli.cjs +6 -21
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +6 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JTYI7NWG.js.map +0 -1
|
@@ -2695,10 +2695,8 @@ ${availableToolsPrompt}` : buildSystemPrompt({ availableTools, maxSteps: this.ma
|
|
|
2695
2695
|
let final = null;
|
|
2696
2696
|
const maxStepAttempts = 2;
|
|
2697
2697
|
let attempt = 0;
|
|
2698
|
-
let buffered = null;
|
|
2699
2698
|
while (true) {
|
|
2700
2699
|
attempt += 1;
|
|
2701
|
-
const attemptEvents = [];
|
|
2702
2700
|
let sawDelta = false;
|
|
2703
2701
|
let attemptFailed = null;
|
|
2704
2702
|
for await (const event of protocol.chatStream({
|
|
@@ -2710,48 +2708,35 @@ ${availableToolsPrompt}` : buildSystemPrompt({ availableTools, maxSteps: this.ma
|
|
|
2710
2708
|
})) {
|
|
2711
2709
|
if (event.type === "thinking_delta") {
|
|
2712
2710
|
sawDelta = true;
|
|
2713
|
-
|
|
2711
|
+
yield { type: "thinking_delta", run_id: runId, delta: event.delta };
|
|
2714
2712
|
} else if (event.type === "text_delta") {
|
|
2715
2713
|
sawDelta = true;
|
|
2716
|
-
|
|
2714
|
+
yield { type: "text_delta", run_id: runId, delta: event.delta };
|
|
2717
2715
|
} else if (event.type === "toolcall_start") {
|
|
2718
2716
|
sawDelta = true;
|
|
2719
|
-
|
|
2717
|
+
yield { type: "tool_call_start", run_id: runId, tool_call: event.tool_call };
|
|
2720
2718
|
} else if (event.type === "toolcall_delta") {
|
|
2721
2719
|
sawDelta = true;
|
|
2722
|
-
|
|
2723
|
-
type: "tool_call_delta",
|
|
2724
|
-
run_id: runId,
|
|
2725
|
-
delta: event.delta,
|
|
2726
|
-
tool_call_id: event.tool_call.id
|
|
2727
|
-
});
|
|
2720
|
+
yield { type: "tool_call_delta", run_id: runId, delta: event.delta, tool_call_id: event.tool_call.id };
|
|
2728
2721
|
} else if (event.type === "toolcall_end") {
|
|
2729
2722
|
sawDelta = true;
|
|
2730
|
-
|
|
2723
|
+
yield { type: "tool_call", run_id: runId, tool_call: event.tool_call };
|
|
2731
2724
|
} else if (event.type === "error") {
|
|
2732
2725
|
attemptFailed = event.error || "\u6A21\u578B\u8C03\u7528\u5931\u8D25\uFF0C\u539F\u56E0\u672A\u77E5";
|
|
2733
2726
|
} else if (event.type === "done") {
|
|
2734
2727
|
final = event.response;
|
|
2735
2728
|
}
|
|
2736
2729
|
}
|
|
2737
|
-
if (attemptFailed === null)
|
|
2738
|
-
buffered = attemptEvents;
|
|
2739
|
-
break;
|
|
2740
|
-
}
|
|
2730
|
+
if (attemptFailed === null) break;
|
|
2741
2731
|
const retryable = !sawDelta && attempt < maxStepAttempts && isTransientLLMError(attemptFailed) && !runOpts.signal?.aborted;
|
|
2742
2732
|
if (retryable) {
|
|
2743
2733
|
this.logger.warn(`Agent LLM \u8C03\u7528\u5931\u8D25\uFF08\u91CD\u8BD5 ${attempt + 1}/${maxStepAttempts}\uFF09run=${runId}\uFF1A${attemptFailed}`);
|
|
2744
|
-
buffered = null;
|
|
2745
2734
|
continue;
|
|
2746
2735
|
}
|
|
2747
|
-
buffered = attemptEvents;
|
|
2748
|
-
for (const event of buffered) yield event;
|
|
2749
2736
|
this.logger.warn(`Agent \u8FD0\u884C\u5931\u8D25 run=${runId}\uFF1A${attemptFailed}`);
|
|
2750
2737
|
yield { type: "agent_error", run_id: runId, error: attemptFailed };
|
|
2751
2738
|
return;
|
|
2752
2739
|
}
|
|
2753
|
-
for (const event of buffered ?? []) yield event;
|
|
2754
|
-
buffered = null;
|
|
2755
2740
|
if (runOpts.signal?.aborted) return;
|
|
2756
2741
|
if (!final) {
|
|
2757
2742
|
yield { type: "agent_error", run_id: runId, error: "\u6A21\u578B\u6D41\u5F02\u5E38\u7EC8\u6B62\uFF0C\u672A\u8FD4\u56DE\u7ED3\u679C" };
|
|
@@ -6529,4 +6514,4 @@ export {
|
|
|
6529
6514
|
createAgentServer,
|
|
6530
6515
|
serveFromConfig
|
|
6531
6516
|
};
|
|
6532
|
-
//# sourceMappingURL=chunk-
|
|
6517
|
+
//# sourceMappingURL=chunk-BNTVTVSW.js.map
|