agent-sh 0.15.9 → 0.15.10
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/agent/subagent.js +5 -4
- package/package.json +1 -1
- package/src/agent/subagent.ts +4 -4
package/dist/agent/subagent.js
CHANGED
|
@@ -19,7 +19,7 @@ export async function runSubagent(opts) {
|
|
|
19
19
|
}));
|
|
20
20
|
const conversation = new LiveView();
|
|
21
21
|
conversation.addUserMessage(task);
|
|
22
|
-
let
|
|
22
|
+
let lastResponseText = "";
|
|
23
23
|
let iterations = 0;
|
|
24
24
|
let tokensConsumed = 0;
|
|
25
25
|
let budgetExhausted = false;
|
|
@@ -36,7 +36,8 @@ export async function runSubagent(opts) {
|
|
|
36
36
|
tokensConsumed += usage.completion_tokens || 0;
|
|
37
37
|
onUsage?.(usage);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
if (text)
|
|
40
|
+
lastResponseText = text;
|
|
40
41
|
conversation.addAssistantMessage(assistantContent, assistantToolCalls, extras);
|
|
41
42
|
// No tool calls → done
|
|
42
43
|
if (toolCalls.length === 0)
|
|
@@ -94,9 +95,9 @@ export async function runSubagent(opts) {
|
|
|
94
95
|
}
|
|
95
96
|
if (budgetExhausted) {
|
|
96
97
|
const note = `\n\n[Subagent terminated: completion-token budget (${budgetTokens}) exhausted after ${tokensConsumed} completion tokens. Returning partial progress.]`;
|
|
97
|
-
return
|
|
98
|
+
return lastResponseText + note;
|
|
98
99
|
}
|
|
99
|
-
return
|
|
100
|
+
return lastResponseText;
|
|
100
101
|
}
|
|
101
102
|
/** Stream a single LLM response. */
|
|
102
103
|
async function streamOnce(llmClient, systemPrompt, conversation, apiTools, model, signal, dynamicContext) {
|
package/package.json
CHANGED
package/src/agent/subagent.ts
CHANGED
|
@@ -96,7 +96,7 @@ export async function runSubagent(opts: SubagentOptions): Promise<string> {
|
|
|
96
96
|
const conversation = new LiveView();
|
|
97
97
|
conversation.addUserMessage(task);
|
|
98
98
|
|
|
99
|
-
let
|
|
99
|
+
let lastResponseText = "";
|
|
100
100
|
let iterations = 0;
|
|
101
101
|
let tokensConsumed = 0;
|
|
102
102
|
let budgetExhausted = false;
|
|
@@ -117,7 +117,7 @@ export async function runSubagent(opts: SubagentOptions): Promise<string> {
|
|
|
117
117
|
onUsage?.(usage);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
if (text) lastResponseText = text;
|
|
121
121
|
|
|
122
122
|
conversation.addAssistantMessage(assistantContent, assistantToolCalls, extras);
|
|
123
123
|
|
|
@@ -183,10 +183,10 @@ export async function runSubagent(opts: SubagentOptions): Promise<string> {
|
|
|
183
183
|
|
|
184
184
|
if (budgetExhausted) {
|
|
185
185
|
const note = `\n\n[Subagent terminated: completion-token budget (${budgetTokens}) exhausted after ${tokensConsumed} completion tokens. Returning partial progress.]`;
|
|
186
|
-
return
|
|
186
|
+
return lastResponseText + note;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
return
|
|
189
|
+
return lastResponseText;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
/** Stream a single LLM response. */
|