@probelabs/probe 0.6.0-rc311 → 0.6.0-rc312
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/bin/binaries/{probe-v0.6.0-rc311-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc312-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc311-aarch64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc312-aarch64-unknown-linux-musl.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc311-x86_64-apple-darwin.tar.gz → probe-v0.6.0-rc312-x86_64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc311-x86_64-pc-windows-msvc.zip → probe-v0.6.0-rc312-x86_64-pc-windows-msvc.zip} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc311-x86_64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc312-x86_64-unknown-linux-musl.tar.gz} +0 -0
- package/build/agent/ProbeAgent.js +86 -26
- package/cjs/agent/ProbeAgent.cjs +122 -21
- package/cjs/index.cjs +122 -21
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +86 -26
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4084,7 +4084,7 @@ or
|
|
|
4084
4084
|
}
|
|
4085
4085
|
return {
|
|
4086
4086
|
toolChoice: 'none',
|
|
4087
|
-
userMessage: `⚠️ TIME BUDGET EXHAUSTED. Your allocated time for this task has run out. You have ${remaining} step(s) remaining to provide your answer.\n\nIMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly — you simply used all your allocated time.\n\nDo NOT say things like "the system is shutting down" or "try again later" — the user submitted a request and is waiting for YOUR answer right now.\n\
|
|
4087
|
+
userMessage: `⚠️ TIME BUDGET EXHAUSTED. Your allocated time for this task has run out. You have ${remaining} step(s) remaining to provide your answer.\n\nIMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly — you simply used all your allocated time.\n\nDo NOT say things like "the system is shutting down" or "try again later" — the user submitted a request and is waiting for YOUR answer right now.\n\nYou MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. Structure your response as follows:\n\n## Task\nWhat was the original request / goal.\n\n## Completed Work\nWhat you successfully accomplished — include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.\n\n## Key Findings\nConcrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.\n\n## Attempted but Inconclusive\nWhat you tried that did not yield clear results — include the approach and why it was inconclusive, so the next agent does not repeat it.\n\n## Not Started / Remaining\nWhat parts of the task you did not get to, and any recommendations for how to approach them.\n\n## Suggested Next Steps\nSpecific, actionable steps for a follow-up agent to continue this work efficiently.\n\nIMPORTANT: Include ALL useful data you gathered inline — do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`
|
|
4088
4088
|
};
|
|
4089
4089
|
}
|
|
4090
4090
|
|
|
@@ -4094,22 +4094,48 @@ or
|
|
|
4094
4094
|
return { toolChoice: 'none' };
|
|
4095
4095
|
}
|
|
4096
4096
|
|
|
4097
|
-
// Last-iteration warning — force text-only and
|
|
4097
|
+
// Last-iteration warning — force text-only and request a structured progress report
|
|
4098
4098
|
if (stepNumber === maxIterations - 1) {
|
|
4099
|
-
// Build a
|
|
4100
|
-
const
|
|
4101
|
-
.filter(tc => tc.name
|
|
4102
|
-
.map(tc =>
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4099
|
+
// Build a detailed activity log so the model can produce an accurate handoff report
|
|
4100
|
+
const toolActivity = _toolCallLog
|
|
4101
|
+
.filter(tc => tc.name !== '_assistant_text')
|
|
4102
|
+
.map(tc => {
|
|
4103
|
+
const argStr = tc.name === 'search'
|
|
4104
|
+
? `query="${tc.args.query || ''}"${tc.args.exact ? ' exact' : ''} path=${tc.args.path || '.'}`
|
|
4105
|
+
: JSON.stringify(tc.args || {}).substring(0, 200);
|
|
4106
|
+
const brief = tc.resultBrief ? ` → ${tc.resultBrief.substring(0, 150)}` : '';
|
|
4107
|
+
return ` [step ${tc.step}] ${tc.name}(${argStr})${brief}`;
|
|
4108
|
+
})
|
|
4109
|
+
.join('\n');
|
|
4110
|
+
const activityLog = toolActivity ? `\n\nTool activity so far:\n${toolActivity}` : '';
|
|
4107
4111
|
|
|
4108
4112
|
// For code-searcher subagents: instruct to output structured JSON even on partial results
|
|
4109
4113
|
const isCodeSearcher = this.promptType === 'code-searcher';
|
|
4110
4114
|
const lastIterMessage = isCodeSearcher
|
|
4111
|
-
? `⚠️ LAST ITERATION — you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${
|
|
4112
|
-
: `⚠️
|
|
4115
|
+
? `⚠️ LAST ITERATION — you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${activityLog}`
|
|
4116
|
+
: `⚠️ ITERATION LIMIT REACHED — you have no more tool calls. You MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over.
|
|
4117
|
+
|
|
4118
|
+
Structure your response as follows:
|
|
4119
|
+
|
|
4120
|
+
## Task
|
|
4121
|
+
What was the original request / goal.
|
|
4122
|
+
|
|
4123
|
+
## Completed Work
|
|
4124
|
+
What you successfully accomplished — include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
4125
|
+
|
|
4126
|
+
## Key Findings
|
|
4127
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
4128
|
+
|
|
4129
|
+
## Attempted but Inconclusive
|
|
4130
|
+
What you tried that did not yield clear results — include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
4131
|
+
|
|
4132
|
+
## Not Started / Remaining
|
|
4133
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
4134
|
+
|
|
4135
|
+
## Suggested Next Steps
|
|
4136
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.
|
|
4137
|
+
|
|
4138
|
+
IMPORTANT: Include ALL useful data you gathered inline — do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.${activityLog}`;
|
|
4113
4139
|
|
|
4114
4140
|
return {
|
|
4115
4141
|
toolChoice: 'none',
|
|
@@ -4208,13 +4234,26 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4208
4234
|
currentIteration++;
|
|
4209
4235
|
toolContext.currentIteration = currentIteration;
|
|
4210
4236
|
|
|
4211
|
-
// Track tool calls for failure diagnostics
|
|
4237
|
+
// Track tool calls for failure diagnostics and progress reports
|
|
4212
4238
|
if (toolCalls?.length > 0) {
|
|
4213
|
-
for (
|
|
4214
|
-
|
|
4239
|
+
for (let i = 0; i < toolCalls.length; i++) {
|
|
4240
|
+
const tc = toolCalls[i];
|
|
4241
|
+
const tr = toolResults?.[i];
|
|
4242
|
+
let resultBrief = '';
|
|
4243
|
+
if (tr) {
|
|
4244
|
+
const raw = typeof tr.result === 'string' ? tr.result : JSON.stringify(tr.result);
|
|
4245
|
+
resultBrief = raw ? raw.substring(0, 500) : '';
|
|
4246
|
+
}
|
|
4247
|
+
const tcArgs = tc.args || (typeof tc.input === 'string' ? (() => { try { return JSON.parse(tc.input); } catch { return {}; } })() : tc.input) || {};
|
|
4248
|
+
_toolCallLog.push({ name: tc.toolName, args: tcArgs, resultBrief, step: currentIteration });
|
|
4215
4249
|
}
|
|
4216
4250
|
}
|
|
4217
4251
|
|
|
4252
|
+
// Track assistant text output per step for progress reports
|
|
4253
|
+
if (text && text.trim()) {
|
|
4254
|
+
_toolCallLog.push({ name: '_assistant_text', args: {}, resultBrief: text.substring(0, 1000), step: currentIteration });
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4218
4257
|
// Record telemetry — include model's reasoning and tool call details
|
|
4219
4258
|
if (this.tracer) {
|
|
4220
4259
|
const stepEvent = {
|
|
@@ -4633,13 +4672,16 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4633
4672
|
`Some of your tool calls were cancelled mid-execution because the timeout observer determined the time limit was reached.\n\n` +
|
|
4634
4673
|
`IMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly — you simply used all your allocated time. ` +
|
|
4635
4674
|
`Do NOT say things like "the system is shutting down" or "try again later." The user is waiting for your answer RIGHT NOW.\n\n` +
|
|
4636
|
-
`
|
|
4637
|
-
`
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4675
|
+
`You MUST produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. ` +
|
|
4676
|
+
`Structure your response with these sections:\n\n` +
|
|
4677
|
+
`## Task\nWhat was the original request / goal.\n\n` +
|
|
4678
|
+
`## Completed Work\nWhat you successfully accomplished — include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.\n\n` +
|
|
4679
|
+
`## Key Findings\nConcrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.\n\n` +
|
|
4680
|
+
`## Attempted but Inconclusive\nWhat you tried that did not yield clear results — include the approach and why it was inconclusive, so the next agent does not repeat it.\n\n` +
|
|
4681
|
+
`## Not Started / Remaining\nWhat parts of the task you did not get to, and any recommendations for how to approach them.\n\n` +
|
|
4682
|
+
`## Suggested Next Steps\nSpecific, actionable steps for a follow-up agent to continue this work efficiently.` +
|
|
4641
4683
|
`${taskContext}${schemaContext}\n\n` +
|
|
4642
|
-
`
|
|
4684
|
+
`IMPORTANT: Include ALL useful data you gathered inline — do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`;
|
|
4643
4685
|
|
|
4644
4686
|
const summaryMessages = [
|
|
4645
4687
|
...currentMessages,
|
|
@@ -4791,21 +4833,33 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4791
4833
|
const searchQueries = [];
|
|
4792
4834
|
const searchDetails = [];
|
|
4793
4835
|
const toolCounts = {};
|
|
4836
|
+
const toolTimeline = [];
|
|
4794
4837
|
for (const tc of _toolCallLog) {
|
|
4838
|
+
if (tc.name === '_assistant_text') continue;
|
|
4795
4839
|
toolCounts[tc.name] = (toolCounts[tc.name] || 0) + 1;
|
|
4796
4840
|
if (tc.name === 'search') {
|
|
4797
4841
|
const q = tc.args.query || '';
|
|
4798
4842
|
const p = tc.args.path || '.';
|
|
4799
4843
|
const exact = tc.args.exact ? ' (exact)' : '';
|
|
4800
4844
|
searchQueries.push(`"${q}"${exact}`);
|
|
4801
|
-
searchDetails.push({ query: q, path: p, had_results:
|
|
4845
|
+
searchDetails.push({ query: q, path: p, had_results: !!(tc.resultBrief && tc.resultBrief.trim()) });
|
|
4802
4846
|
}
|
|
4847
|
+
const argStr = tc.name === 'search'
|
|
4848
|
+
? `query="${tc.args.query || ''}"${tc.args.exact ? ' exact' : ''}`
|
|
4849
|
+
: JSON.stringify(tc.args || {}).substring(0, 150);
|
|
4850
|
+
const brief = tc.resultBrief ? ` → ${tc.resultBrief.substring(0, 200)}` : ' → (no result)';
|
|
4851
|
+
toolTimeline.push(` [step ${tc.step}] ${tc.name}(${argStr})${brief}`);
|
|
4803
4852
|
}
|
|
4804
4853
|
const toolBreakdown = Object.entries(toolCounts)
|
|
4805
4854
|
.map(([name, count]) => `${name}: ${count}x`)
|
|
4806
4855
|
.join(', ');
|
|
4807
4856
|
const uniqueSearches = [...new Set(searchQueries)];
|
|
4808
4857
|
|
|
4858
|
+
// Collect any assistant text fragments as partial findings
|
|
4859
|
+
const assistantTexts = _toolCallLog
|
|
4860
|
+
.filter(tc => tc.name === '_assistant_text' && tc.resultBrief)
|
|
4861
|
+
.map(tc => tc.resultBrief);
|
|
4862
|
+
|
|
4809
4863
|
// For code-searcher subagents: produce structured JSON so the parent
|
|
4810
4864
|
// can still use partial results instead of getting a plain error string.
|
|
4811
4865
|
if (this.promptType === 'code-searcher') {
|
|
@@ -4816,12 +4870,18 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4816
4870
|
searches: searchDetails
|
|
4817
4871
|
});
|
|
4818
4872
|
} else {
|
|
4819
|
-
let summary =
|
|
4820
|
-
summary +=
|
|
4873
|
+
let summary = `## Progress Report (iteration limit reached after ${currentIteration} steps)\n\n`;
|
|
4874
|
+
summary += `### Tool Usage Summary\n${toolBreakdown || 'none'}\n\n`;
|
|
4821
4875
|
if (uniqueSearches.length > 0) {
|
|
4822
|
-
summary +=
|
|
4876
|
+
summary += `### Search Queries Attempted\n${uniqueSearches.join(', ')}\n\n`;
|
|
4877
|
+
}
|
|
4878
|
+
if (toolTimeline.length > 0) {
|
|
4879
|
+
summary += `### Step-by-Step Activity Log\n${toolTimeline.join('\n')}\n\n`;
|
|
4880
|
+
}
|
|
4881
|
+
if (assistantTexts.length > 0) {
|
|
4882
|
+
summary += `### Partial Findings\n${assistantTexts.join('\n\n')}\n\n`;
|
|
4823
4883
|
}
|
|
4824
|
-
summary +=
|
|
4884
|
+
summary += `### Recommendation for Follow-Up\nThe iteration limit was reached before the task could be completed. A follow-up agent should review the activity log above to avoid repeating the same searches, and consider alternative approaches such as: using exact=true for literal string matching, using bash/grep for pattern-based file searches, or trying a different strategy.`;
|
|
4825
4885
|
finalResult = summary;
|
|
4826
4886
|
}
|
|
4827
4887
|
} catch {
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -22166,7 +22166,7 @@ var init_dist3 = __esm({
|
|
|
22166
22166
|
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
22167
22167
|
preview: external_exports.unknown().optional()
|
|
22168
22168
|
});
|
|
22169
|
-
VERSION2 = true ? "4.0.
|
|
22169
|
+
VERSION2 = true ? "4.0.83" : "0.0.0-test";
|
|
22170
22170
|
bedrockRerankingResponseSchema = lazySchema(
|
|
22171
22171
|
() => zodSchema(
|
|
22172
22172
|
external_exports.object({
|
|
@@ -42349,7 +42349,7 @@ var require_brace_expansion = __commonJS({
|
|
|
42349
42349
|
var x = numeric(n[0]);
|
|
42350
42350
|
var y = numeric(n[1]);
|
|
42351
42351
|
var width = Math.max(n[0].length, n[1].length);
|
|
42352
|
-
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
42352
|
+
var incr = n.length == 3 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
42353
42353
|
var test = lte;
|
|
42354
42354
|
var reverse = y < x;
|
|
42355
42355
|
if (reverse) {
|
|
@@ -104288,7 +104288,27 @@ IMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The
|
|
|
104288
104288
|
|
|
104289
104289
|
Do NOT say things like "the system is shutting down" or "try again later" \u2014 the user submitted a request and is waiting for YOUR answer right now.
|
|
104290
104290
|
|
|
104291
|
-
|
|
104291
|
+
You MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. Structure your response as follows:
|
|
104292
|
+
|
|
104293
|
+
## Task
|
|
104294
|
+
What was the original request / goal.
|
|
104295
|
+
|
|
104296
|
+
## Completed Work
|
|
104297
|
+
What you successfully accomplished \u2014 include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
104298
|
+
|
|
104299
|
+
## Key Findings
|
|
104300
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
104301
|
+
|
|
104302
|
+
## Attempted but Inconclusive
|
|
104303
|
+
What you tried that did not yield clear results \u2014 include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
104304
|
+
|
|
104305
|
+
## Not Started / Remaining
|
|
104306
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
104307
|
+
|
|
104308
|
+
## Suggested Next Steps
|
|
104309
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.
|
|
104310
|
+
|
|
104311
|
+
IMPORTANT: Include ALL useful data you gathered inline \u2014 do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`
|
|
104292
104312
|
};
|
|
104293
104313
|
}
|
|
104294
104314
|
if (this.debug) {
|
|
@@ -104297,11 +104317,39 @@ Provide your BEST answer NOW using the information you have already gathered. Do
|
|
|
104297
104317
|
return { toolChoice: "none" };
|
|
104298
104318
|
}
|
|
104299
104319
|
if (stepNumber === maxIterations - 1) {
|
|
104300
|
-
const
|
|
104301
|
-
|
|
104302
|
-
|
|
104320
|
+
const toolActivity = _toolCallLog.filter((tc) => tc.name !== "_assistant_text").map((tc) => {
|
|
104321
|
+
const argStr = tc.name === "search" ? `query="${tc.args.query || ""}"${tc.args.exact ? " exact" : ""} path=${tc.args.path || "."}` : JSON.stringify(tc.args || {}).substring(0, 200);
|
|
104322
|
+
const brief = tc.resultBrief ? ` \u2192 ${tc.resultBrief.substring(0, 150)}` : "";
|
|
104323
|
+
return ` [step ${tc.step}] ${tc.name}(${argStr})${brief}`;
|
|
104324
|
+
}).join("\n");
|
|
104325
|
+
const activityLog = toolActivity ? `
|
|
104326
|
+
|
|
104327
|
+
Tool activity so far:
|
|
104328
|
+
${toolActivity}` : "";
|
|
104303
104329
|
const isCodeSearcher = this.promptType === "code-searcher";
|
|
104304
|
-
const lastIterMessage = isCodeSearcher ? `\u26A0\uFE0F LAST ITERATION \u2014 you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${
|
|
104330
|
+
const lastIterMessage = isCodeSearcher ? `\u26A0\uFE0F LAST ITERATION \u2014 you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${activityLog}` : `\u26A0\uFE0F ITERATION LIMIT REACHED \u2014 you have no more tool calls. You MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over.
|
|
104331
|
+
|
|
104332
|
+
Structure your response as follows:
|
|
104333
|
+
|
|
104334
|
+
## Task
|
|
104335
|
+
What was the original request / goal.
|
|
104336
|
+
|
|
104337
|
+
## Completed Work
|
|
104338
|
+
What you successfully accomplished \u2014 include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
104339
|
+
|
|
104340
|
+
## Key Findings
|
|
104341
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
104342
|
+
|
|
104343
|
+
## Attempted but Inconclusive
|
|
104344
|
+
What you tried that did not yield clear results \u2014 include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
104345
|
+
|
|
104346
|
+
## Not Started / Remaining
|
|
104347
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
104348
|
+
|
|
104349
|
+
## Suggested Next Steps
|
|
104350
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.
|
|
104351
|
+
|
|
104352
|
+
IMPORTANT: Include ALL useful data you gathered inline \u2014 do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.${activityLog}`;
|
|
104305
104353
|
return {
|
|
104306
104354
|
toolChoice: "none",
|
|
104307
104355
|
userMessage: lastIterMessage
|
|
@@ -104384,10 +104432,27 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
104384
104432
|
currentIteration++;
|
|
104385
104433
|
toolContext.currentIteration = currentIteration;
|
|
104386
104434
|
if (toolCalls?.length > 0) {
|
|
104387
|
-
for (
|
|
104388
|
-
|
|
104435
|
+
for (let i = 0; i < toolCalls.length; i++) {
|
|
104436
|
+
const tc = toolCalls[i];
|
|
104437
|
+
const tr = toolResults?.[i];
|
|
104438
|
+
let resultBrief = "";
|
|
104439
|
+
if (tr) {
|
|
104440
|
+
const raw = typeof tr.result === "string" ? tr.result : JSON.stringify(tr.result);
|
|
104441
|
+
resultBrief = raw ? raw.substring(0, 500) : "";
|
|
104442
|
+
}
|
|
104443
|
+
const tcArgs = tc.args || (typeof tc.input === "string" ? (() => {
|
|
104444
|
+
try {
|
|
104445
|
+
return JSON.parse(tc.input);
|
|
104446
|
+
} catch {
|
|
104447
|
+
return {};
|
|
104448
|
+
}
|
|
104449
|
+
})() : tc.input) || {};
|
|
104450
|
+
_toolCallLog.push({ name: tc.toolName, args: tcArgs, resultBrief, step: currentIteration });
|
|
104389
104451
|
}
|
|
104390
104452
|
}
|
|
104453
|
+
if (text && text.trim()) {
|
|
104454
|
+
_toolCallLog.push({ name: "_assistant_text", args: {}, resultBrief: text.substring(0, 1e3), step: currentIteration });
|
|
104455
|
+
}
|
|
104391
104456
|
if (this.tracer) {
|
|
104392
104457
|
const stepEvent = {
|
|
104393
104458
|
"iteration": currentIteration,
|
|
@@ -104722,13 +104787,27 @@ Respond with ONLY valid JSON \u2014 no markdown, no explanation, no text outside
|
|
|
104722
104787
|
|
|
104723
104788
|
IMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly \u2014 you simply used all your allocated time. Do NOT say things like "the system is shutting down" or "try again later." The user is waiting for your answer RIGHT NOW.
|
|
104724
104789
|
|
|
104725
|
-
|
|
104726
|
-
|
|
104727
|
-
|
|
104728
|
-
|
|
104729
|
-
|
|
104790
|
+
You MUST produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. Structure your response with these sections:
|
|
104791
|
+
|
|
104792
|
+
## Task
|
|
104793
|
+
What was the original request / goal.
|
|
104794
|
+
|
|
104795
|
+
## Completed Work
|
|
104796
|
+
What you successfully accomplished \u2014 include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
104797
|
+
|
|
104798
|
+
## Key Findings
|
|
104799
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
104800
|
+
|
|
104801
|
+
## Attempted but Inconclusive
|
|
104802
|
+
What you tried that did not yield clear results \u2014 include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
104803
|
+
|
|
104804
|
+
## Not Started / Remaining
|
|
104805
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
104806
|
+
|
|
104807
|
+
## Suggested Next Steps
|
|
104808
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.${taskContext}${schemaContext}
|
|
104730
104809
|
|
|
104731
|
-
|
|
104810
|
+
IMPORTANT: Include ALL useful data you gathered inline \u2014 do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`;
|
|
104732
104811
|
const summaryMessages = [
|
|
104733
104812
|
...currentMessages,
|
|
104734
104813
|
{ role: "user", content: summaryPrompt }
|
|
@@ -104841,18 +104920,24 @@ Be thorough \u2014 this is the user's only response. Include all useful informat
|
|
|
104841
104920
|
const searchQueries = [];
|
|
104842
104921
|
const searchDetails = [];
|
|
104843
104922
|
const toolCounts = {};
|
|
104923
|
+
const toolTimeline = [];
|
|
104844
104924
|
for (const tc of _toolCallLog) {
|
|
104925
|
+
if (tc.name === "_assistant_text") continue;
|
|
104845
104926
|
toolCounts[tc.name] = (toolCounts[tc.name] || 0) + 1;
|
|
104846
104927
|
if (tc.name === "search") {
|
|
104847
104928
|
const q = tc.args.query || "";
|
|
104848
104929
|
const p = tc.args.path || ".";
|
|
104849
104930
|
const exact = tc.args.exact ? " (exact)" : "";
|
|
104850
104931
|
searchQueries.push(`"${q}"${exact}`);
|
|
104851
|
-
searchDetails.push({ query: q, path: p, had_results:
|
|
104932
|
+
searchDetails.push({ query: q, path: p, had_results: !!(tc.resultBrief && tc.resultBrief.trim()) });
|
|
104852
104933
|
}
|
|
104934
|
+
const argStr = tc.name === "search" ? `query="${tc.args.query || ""}"${tc.args.exact ? " exact" : ""}` : JSON.stringify(tc.args || {}).substring(0, 150);
|
|
104935
|
+
const brief = tc.resultBrief ? ` \u2192 ${tc.resultBrief.substring(0, 200)}` : " \u2192 (no result)";
|
|
104936
|
+
toolTimeline.push(` [step ${tc.step}] ${tc.name}(${argStr})${brief}`);
|
|
104853
104937
|
}
|
|
104854
104938
|
const toolBreakdown = Object.entries(toolCounts).map(([name15, count]) => `${name15}: ${count}x`).join(", ");
|
|
104855
104939
|
const uniqueSearches = [...new Set(searchQueries)];
|
|
104940
|
+
const assistantTexts = _toolCallLog.filter((tc) => tc.name === "_assistant_text" && tc.resultBrief).map((tc) => tc.resultBrief);
|
|
104856
104941
|
if (this.promptType === "code-searcher") {
|
|
104857
104942
|
finalResult = JSON.stringify({
|
|
104858
104943
|
confidence: "low",
|
|
@@ -104861,17 +104946,33 @@ Be thorough \u2014 this is the user's only response. Include all useful informat
|
|
|
104861
104946
|
searches: searchDetails
|
|
104862
104947
|
});
|
|
104863
104948
|
} else {
|
|
104864
|
-
let summary =
|
|
104949
|
+
let summary = `## Progress Report (iteration limit reached after ${currentIteration} steps)
|
|
104865
104950
|
|
|
104866
104951
|
`;
|
|
104867
|
-
summary +=
|
|
104952
|
+
summary += `### Tool Usage Summary
|
|
104953
|
+
${toolBreakdown || "none"}
|
|
104954
|
+
|
|
104868
104955
|
`;
|
|
104869
104956
|
if (uniqueSearches.length > 0) {
|
|
104870
|
-
summary +=
|
|
104957
|
+
summary += `### Search Queries Attempted
|
|
104958
|
+
${uniqueSearches.join(", ")}
|
|
104959
|
+
|
|
104960
|
+
`;
|
|
104961
|
+
}
|
|
104962
|
+
if (toolTimeline.length > 0) {
|
|
104963
|
+
summary += `### Step-by-Step Activity Log
|
|
104964
|
+
${toolTimeline.join("\n")}
|
|
104965
|
+
|
|
104966
|
+
`;
|
|
104967
|
+
}
|
|
104968
|
+
if (assistantTexts.length > 0) {
|
|
104969
|
+
summary += `### Partial Findings
|
|
104970
|
+
${assistantTexts.join("\n\n")}
|
|
104971
|
+
|
|
104871
104972
|
`;
|
|
104872
104973
|
}
|
|
104873
|
-
summary +=
|
|
104874
|
-
The
|
|
104974
|
+
summary += `### Recommendation for Follow-Up
|
|
104975
|
+
The iteration limit was reached before the task could be completed. A follow-up agent should review the activity log above to avoid repeating the same searches, and consider alternative approaches such as: using exact=true for literal string matching, using bash/grep for pattern-based file searches, or trying a different strategy.`;
|
|
104875
104976
|
finalResult = summary;
|
|
104876
104977
|
}
|
|
104877
104978
|
} catch {
|
package/cjs/index.cjs
CHANGED
|
@@ -24094,7 +24094,7 @@ var init_dist3 = __esm({
|
|
|
24094
24094
|
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
24095
24095
|
preview: external_exports.unknown().optional()
|
|
24096
24096
|
});
|
|
24097
|
-
VERSION2 = true ? "4.0.
|
|
24097
|
+
VERSION2 = true ? "4.0.83" : "0.0.0-test";
|
|
24098
24098
|
bedrockRerankingResponseSchema = lazySchema(
|
|
24099
24099
|
() => zodSchema(
|
|
24100
24100
|
external_exports.object({
|
|
@@ -28521,7 +28521,7 @@ var require_brace_expansion = __commonJS({
|
|
|
28521
28521
|
var x = numeric(n[0]);
|
|
28522
28522
|
var y = numeric(n[1]);
|
|
28523
28523
|
var width = Math.max(n[0].length, n[1].length);
|
|
28524
|
-
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
28524
|
+
var incr = n.length == 3 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
28525
28525
|
var test = lte;
|
|
28526
28526
|
var reverse = y < x;
|
|
28527
28527
|
if (reverse) {
|
|
@@ -100798,7 +100798,27 @@ IMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The
|
|
|
100798
100798
|
|
|
100799
100799
|
Do NOT say things like "the system is shutting down" or "try again later" \u2014 the user submitted a request and is waiting for YOUR answer right now.
|
|
100800
100800
|
|
|
100801
|
-
|
|
100801
|
+
You MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. Structure your response as follows:
|
|
100802
|
+
|
|
100803
|
+
## Task
|
|
100804
|
+
What was the original request / goal.
|
|
100805
|
+
|
|
100806
|
+
## Completed Work
|
|
100807
|
+
What you successfully accomplished \u2014 include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
100808
|
+
|
|
100809
|
+
## Key Findings
|
|
100810
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
100811
|
+
|
|
100812
|
+
## Attempted but Inconclusive
|
|
100813
|
+
What you tried that did not yield clear results \u2014 include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
100814
|
+
|
|
100815
|
+
## Not Started / Remaining
|
|
100816
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
100817
|
+
|
|
100818
|
+
## Suggested Next Steps
|
|
100819
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.
|
|
100820
|
+
|
|
100821
|
+
IMPORTANT: Include ALL useful data you gathered inline \u2014 do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`
|
|
100802
100822
|
};
|
|
100803
100823
|
}
|
|
100804
100824
|
if (this.debug) {
|
|
@@ -100807,11 +100827,39 @@ Provide your BEST answer NOW using the information you have already gathered. Do
|
|
|
100807
100827
|
return { toolChoice: "none" };
|
|
100808
100828
|
}
|
|
100809
100829
|
if (stepNumber === maxIterations - 1) {
|
|
100810
|
-
const
|
|
100811
|
-
|
|
100812
|
-
|
|
100830
|
+
const toolActivity = _toolCallLog.filter((tc) => tc.name !== "_assistant_text").map((tc) => {
|
|
100831
|
+
const argStr = tc.name === "search" ? `query="${tc.args.query || ""}"${tc.args.exact ? " exact" : ""} path=${tc.args.path || "."}` : JSON.stringify(tc.args || {}).substring(0, 200);
|
|
100832
|
+
const brief = tc.resultBrief ? ` \u2192 ${tc.resultBrief.substring(0, 150)}` : "";
|
|
100833
|
+
return ` [step ${tc.step}] ${tc.name}(${argStr})${brief}`;
|
|
100834
|
+
}).join("\n");
|
|
100835
|
+
const activityLog = toolActivity ? `
|
|
100836
|
+
|
|
100837
|
+
Tool activity so far:
|
|
100838
|
+
${toolActivity}` : "";
|
|
100813
100839
|
const isCodeSearcher = this.promptType === "code-searcher";
|
|
100814
|
-
const lastIterMessage = isCodeSearcher ? `\u26A0\uFE0F LAST ITERATION \u2014 you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${
|
|
100840
|
+
const lastIterMessage = isCodeSearcher ? `\u26A0\uFE0F LAST ITERATION \u2014 you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${activityLog}` : `\u26A0\uFE0F ITERATION LIMIT REACHED \u2014 you have no more tool calls. You MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over.
|
|
100841
|
+
|
|
100842
|
+
Structure your response as follows:
|
|
100843
|
+
|
|
100844
|
+
## Task
|
|
100845
|
+
What was the original request / goal.
|
|
100846
|
+
|
|
100847
|
+
## Completed Work
|
|
100848
|
+
What you successfully accomplished \u2014 include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
100849
|
+
|
|
100850
|
+
## Key Findings
|
|
100851
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
100852
|
+
|
|
100853
|
+
## Attempted but Inconclusive
|
|
100854
|
+
What you tried that did not yield clear results \u2014 include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
100855
|
+
|
|
100856
|
+
## Not Started / Remaining
|
|
100857
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
100858
|
+
|
|
100859
|
+
## Suggested Next Steps
|
|
100860
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.
|
|
100861
|
+
|
|
100862
|
+
IMPORTANT: Include ALL useful data you gathered inline \u2014 do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.${activityLog}`;
|
|
100815
100863
|
return {
|
|
100816
100864
|
toolChoice: "none",
|
|
100817
100865
|
userMessage: lastIterMessage
|
|
@@ -100894,10 +100942,27 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
100894
100942
|
currentIteration++;
|
|
100895
100943
|
toolContext.currentIteration = currentIteration;
|
|
100896
100944
|
if (toolCalls?.length > 0) {
|
|
100897
|
-
for (
|
|
100898
|
-
|
|
100945
|
+
for (let i = 0; i < toolCalls.length; i++) {
|
|
100946
|
+
const tc = toolCalls[i];
|
|
100947
|
+
const tr = toolResults?.[i];
|
|
100948
|
+
let resultBrief = "";
|
|
100949
|
+
if (tr) {
|
|
100950
|
+
const raw = typeof tr.result === "string" ? tr.result : JSON.stringify(tr.result);
|
|
100951
|
+
resultBrief = raw ? raw.substring(0, 500) : "";
|
|
100952
|
+
}
|
|
100953
|
+
const tcArgs = tc.args || (typeof tc.input === "string" ? (() => {
|
|
100954
|
+
try {
|
|
100955
|
+
return JSON.parse(tc.input);
|
|
100956
|
+
} catch {
|
|
100957
|
+
return {};
|
|
100958
|
+
}
|
|
100959
|
+
})() : tc.input) || {};
|
|
100960
|
+
_toolCallLog.push({ name: tc.toolName, args: tcArgs, resultBrief, step: currentIteration });
|
|
100899
100961
|
}
|
|
100900
100962
|
}
|
|
100963
|
+
if (text && text.trim()) {
|
|
100964
|
+
_toolCallLog.push({ name: "_assistant_text", args: {}, resultBrief: text.substring(0, 1e3), step: currentIteration });
|
|
100965
|
+
}
|
|
100901
100966
|
if (this.tracer) {
|
|
100902
100967
|
const stepEvent = {
|
|
100903
100968
|
"iteration": currentIteration,
|
|
@@ -101232,13 +101297,27 @@ Respond with ONLY valid JSON \u2014 no markdown, no explanation, no text outside
|
|
|
101232
101297
|
|
|
101233
101298
|
IMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly \u2014 you simply used all your allocated time. Do NOT say things like "the system is shutting down" or "try again later." The user is waiting for your answer RIGHT NOW.
|
|
101234
101299
|
|
|
101235
|
-
|
|
101236
|
-
|
|
101237
|
-
|
|
101238
|
-
|
|
101239
|
-
|
|
101300
|
+
You MUST produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. Structure your response with these sections:
|
|
101301
|
+
|
|
101302
|
+
## Task
|
|
101303
|
+
What was the original request / goal.
|
|
101304
|
+
|
|
101305
|
+
## Completed Work
|
|
101306
|
+
What you successfully accomplished \u2014 include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
101307
|
+
|
|
101308
|
+
## Key Findings
|
|
101309
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
101310
|
+
|
|
101311
|
+
## Attempted but Inconclusive
|
|
101312
|
+
What you tried that did not yield clear results \u2014 include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
101313
|
+
|
|
101314
|
+
## Not Started / Remaining
|
|
101315
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
101316
|
+
|
|
101317
|
+
## Suggested Next Steps
|
|
101318
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.${taskContext}${schemaContext}
|
|
101240
101319
|
|
|
101241
|
-
|
|
101320
|
+
IMPORTANT: Include ALL useful data you gathered inline \u2014 do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`;
|
|
101242
101321
|
const summaryMessages = [
|
|
101243
101322
|
...currentMessages,
|
|
101244
101323
|
{ role: "user", content: summaryPrompt }
|
|
@@ -101351,18 +101430,24 @@ Be thorough \u2014 this is the user's only response. Include all useful informat
|
|
|
101351
101430
|
const searchQueries = [];
|
|
101352
101431
|
const searchDetails = [];
|
|
101353
101432
|
const toolCounts = {};
|
|
101433
|
+
const toolTimeline = [];
|
|
101354
101434
|
for (const tc of _toolCallLog) {
|
|
101435
|
+
if (tc.name === "_assistant_text") continue;
|
|
101355
101436
|
toolCounts[tc.name] = (toolCounts[tc.name] || 0) + 1;
|
|
101356
101437
|
if (tc.name === "search") {
|
|
101357
101438
|
const q = tc.args.query || "";
|
|
101358
101439
|
const p = tc.args.path || ".";
|
|
101359
101440
|
const exact = tc.args.exact ? " (exact)" : "";
|
|
101360
101441
|
searchQueries.push(`"${q}"${exact}`);
|
|
101361
|
-
searchDetails.push({ query: q, path: p, had_results:
|
|
101442
|
+
searchDetails.push({ query: q, path: p, had_results: !!(tc.resultBrief && tc.resultBrief.trim()) });
|
|
101362
101443
|
}
|
|
101444
|
+
const argStr = tc.name === "search" ? `query="${tc.args.query || ""}"${tc.args.exact ? " exact" : ""}` : JSON.stringify(tc.args || {}).substring(0, 150);
|
|
101445
|
+
const brief = tc.resultBrief ? ` \u2192 ${tc.resultBrief.substring(0, 200)}` : " \u2192 (no result)";
|
|
101446
|
+
toolTimeline.push(` [step ${tc.step}] ${tc.name}(${argStr})${brief}`);
|
|
101363
101447
|
}
|
|
101364
101448
|
const toolBreakdown = Object.entries(toolCounts).map(([name15, count]) => `${name15}: ${count}x`).join(", ");
|
|
101365
101449
|
const uniqueSearches = [...new Set(searchQueries)];
|
|
101450
|
+
const assistantTexts = _toolCallLog.filter((tc) => tc.name === "_assistant_text" && tc.resultBrief).map((tc) => tc.resultBrief);
|
|
101366
101451
|
if (this.promptType === "code-searcher") {
|
|
101367
101452
|
finalResult = JSON.stringify({
|
|
101368
101453
|
confidence: "low",
|
|
@@ -101371,17 +101456,33 @@ Be thorough \u2014 this is the user's only response. Include all useful informat
|
|
|
101371
101456
|
searches: searchDetails
|
|
101372
101457
|
});
|
|
101373
101458
|
} else {
|
|
101374
|
-
let summary =
|
|
101459
|
+
let summary = `## Progress Report (iteration limit reached after ${currentIteration} steps)
|
|
101375
101460
|
|
|
101376
101461
|
`;
|
|
101377
|
-
summary +=
|
|
101462
|
+
summary += `### Tool Usage Summary
|
|
101463
|
+
${toolBreakdown || "none"}
|
|
101464
|
+
|
|
101378
101465
|
`;
|
|
101379
101466
|
if (uniqueSearches.length > 0) {
|
|
101380
|
-
summary +=
|
|
101467
|
+
summary += `### Search Queries Attempted
|
|
101468
|
+
${uniqueSearches.join(", ")}
|
|
101469
|
+
|
|
101470
|
+
`;
|
|
101471
|
+
}
|
|
101472
|
+
if (toolTimeline.length > 0) {
|
|
101473
|
+
summary += `### Step-by-Step Activity Log
|
|
101474
|
+
${toolTimeline.join("\n")}
|
|
101475
|
+
|
|
101476
|
+
`;
|
|
101477
|
+
}
|
|
101478
|
+
if (assistantTexts.length > 0) {
|
|
101479
|
+
summary += `### Partial Findings
|
|
101480
|
+
${assistantTexts.join("\n\n")}
|
|
101481
|
+
|
|
101381
101482
|
`;
|
|
101382
101483
|
}
|
|
101383
|
-
summary +=
|
|
101384
|
-
The
|
|
101484
|
+
summary += `### Recommendation for Follow-Up
|
|
101485
|
+
The iteration limit was reached before the task could be completed. A follow-up agent should review the activity log above to avoid repeating the same searches, and consider alternative approaches such as: using exact=true for literal string matching, using bash/grep for pattern-based file searches, or trying a different strategy.`;
|
|
101385
101486
|
finalResult = summary;
|
|
101386
101487
|
}
|
|
101387
101488
|
} catch {
|
package/package.json
CHANGED
package/src/agent/ProbeAgent.js
CHANGED
|
@@ -4084,7 +4084,7 @@ or
|
|
|
4084
4084
|
}
|
|
4085
4085
|
return {
|
|
4086
4086
|
toolChoice: 'none',
|
|
4087
|
-
userMessage: `⚠️ TIME BUDGET EXHAUSTED. Your allocated time for this task has run out. You have ${remaining} step(s) remaining to provide your answer.\n\nIMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly — you simply used all your allocated time.\n\nDo NOT say things like "the system is shutting down" or "try again later" — the user submitted a request and is waiting for YOUR answer right now.\n\
|
|
4087
|
+
userMessage: `⚠️ TIME BUDGET EXHAUSTED. Your allocated time for this task has run out. You have ${remaining} step(s) remaining to provide your answer.\n\nIMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly — you simply used all your allocated time.\n\nDo NOT say things like "the system is shutting down" or "try again later" — the user submitted a request and is waiting for YOUR answer right now.\n\nYou MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. Structure your response as follows:\n\n## Task\nWhat was the original request / goal.\n\n## Completed Work\nWhat you successfully accomplished — include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.\n\n## Key Findings\nConcrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.\n\n## Attempted but Inconclusive\nWhat you tried that did not yield clear results — include the approach and why it was inconclusive, so the next agent does not repeat it.\n\n## Not Started / Remaining\nWhat parts of the task you did not get to, and any recommendations for how to approach them.\n\n## Suggested Next Steps\nSpecific, actionable steps for a follow-up agent to continue this work efficiently.\n\nIMPORTANT: Include ALL useful data you gathered inline — do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`
|
|
4088
4088
|
};
|
|
4089
4089
|
}
|
|
4090
4090
|
|
|
@@ -4094,22 +4094,48 @@ or
|
|
|
4094
4094
|
return { toolChoice: 'none' };
|
|
4095
4095
|
}
|
|
4096
4096
|
|
|
4097
|
-
// Last-iteration warning — force text-only and
|
|
4097
|
+
// Last-iteration warning — force text-only and request a structured progress report
|
|
4098
4098
|
if (stepNumber === maxIterations - 1) {
|
|
4099
|
-
// Build a
|
|
4100
|
-
const
|
|
4101
|
-
.filter(tc => tc.name
|
|
4102
|
-
.map(tc =>
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4099
|
+
// Build a detailed activity log so the model can produce an accurate handoff report
|
|
4100
|
+
const toolActivity = _toolCallLog
|
|
4101
|
+
.filter(tc => tc.name !== '_assistant_text')
|
|
4102
|
+
.map(tc => {
|
|
4103
|
+
const argStr = tc.name === 'search'
|
|
4104
|
+
? `query="${tc.args.query || ''}"${tc.args.exact ? ' exact' : ''} path=${tc.args.path || '.'}`
|
|
4105
|
+
: JSON.stringify(tc.args || {}).substring(0, 200);
|
|
4106
|
+
const brief = tc.resultBrief ? ` → ${tc.resultBrief.substring(0, 150)}` : '';
|
|
4107
|
+
return ` [step ${tc.step}] ${tc.name}(${argStr})${brief}`;
|
|
4108
|
+
})
|
|
4109
|
+
.join('\n');
|
|
4110
|
+
const activityLog = toolActivity ? `\n\nTool activity so far:\n${toolActivity}` : '';
|
|
4107
4111
|
|
|
4108
4112
|
// For code-searcher subagents: instruct to output structured JSON even on partial results
|
|
4109
4113
|
const isCodeSearcher = this.promptType === 'code-searcher';
|
|
4110
4114
|
const lastIterMessage = isCodeSearcher
|
|
4111
|
-
? `⚠️ LAST ITERATION — you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${
|
|
4112
|
-
: `⚠️
|
|
4115
|
+
? `⚠️ LAST ITERATION — you are out of tool calls. Output your JSON response NOW with whatever files you have verified so far. Set confidence to "low" if your search was incomplete. Include the "searches" array listing all search queries you made with their paths and outcomes.${activityLog}`
|
|
4116
|
+
: `⚠️ ITERATION LIMIT REACHED — you have no more tool calls. You MUST now produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over.
|
|
4117
|
+
|
|
4118
|
+
Structure your response as follows:
|
|
4119
|
+
|
|
4120
|
+
## Task
|
|
4121
|
+
What was the original request / goal.
|
|
4122
|
+
|
|
4123
|
+
## Completed Work
|
|
4124
|
+
What you successfully accomplished — include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.
|
|
4125
|
+
|
|
4126
|
+
## Key Findings
|
|
4127
|
+
Concrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.
|
|
4128
|
+
|
|
4129
|
+
## Attempted but Inconclusive
|
|
4130
|
+
What you tried that did not yield clear results — include the approach and why it was inconclusive, so the next agent does not repeat it.
|
|
4131
|
+
|
|
4132
|
+
## Not Started / Remaining
|
|
4133
|
+
What parts of the task you did not get to, and any recommendations for how to approach them.
|
|
4134
|
+
|
|
4135
|
+
## Suggested Next Steps
|
|
4136
|
+
Specific, actionable steps for a follow-up agent to continue this work efficiently.
|
|
4137
|
+
|
|
4138
|
+
IMPORTANT: Include ALL useful data you gathered inline — do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.${activityLog}`;
|
|
4113
4139
|
|
|
4114
4140
|
return {
|
|
4115
4141
|
toolChoice: 'none',
|
|
@@ -4208,13 +4234,26 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4208
4234
|
currentIteration++;
|
|
4209
4235
|
toolContext.currentIteration = currentIteration;
|
|
4210
4236
|
|
|
4211
|
-
// Track tool calls for failure diagnostics
|
|
4237
|
+
// Track tool calls for failure diagnostics and progress reports
|
|
4212
4238
|
if (toolCalls?.length > 0) {
|
|
4213
|
-
for (
|
|
4214
|
-
|
|
4239
|
+
for (let i = 0; i < toolCalls.length; i++) {
|
|
4240
|
+
const tc = toolCalls[i];
|
|
4241
|
+
const tr = toolResults?.[i];
|
|
4242
|
+
let resultBrief = '';
|
|
4243
|
+
if (tr) {
|
|
4244
|
+
const raw = typeof tr.result === 'string' ? tr.result : JSON.stringify(tr.result);
|
|
4245
|
+
resultBrief = raw ? raw.substring(0, 500) : '';
|
|
4246
|
+
}
|
|
4247
|
+
const tcArgs = tc.args || (typeof tc.input === 'string' ? (() => { try { return JSON.parse(tc.input); } catch { return {}; } })() : tc.input) || {};
|
|
4248
|
+
_toolCallLog.push({ name: tc.toolName, args: tcArgs, resultBrief, step: currentIteration });
|
|
4215
4249
|
}
|
|
4216
4250
|
}
|
|
4217
4251
|
|
|
4252
|
+
// Track assistant text output per step for progress reports
|
|
4253
|
+
if (text && text.trim()) {
|
|
4254
|
+
_toolCallLog.push({ name: '_assistant_text', args: {}, resultBrief: text.substring(0, 1000), step: currentIteration });
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4218
4257
|
// Record telemetry — include model's reasoning and tool call details
|
|
4219
4258
|
if (this.tracer) {
|
|
4220
4259
|
const stepEvent = {
|
|
@@ -4633,13 +4672,16 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4633
4672
|
`Some of your tool calls were cancelled mid-execution because the timeout observer determined the time limit was reached.\n\n` +
|
|
4634
4673
|
`IMPORTANT: This is a time budget constraint, NOT a system shutdown or error. The system is working perfectly — you simply used all your allocated time. ` +
|
|
4635
4674
|
`Do NOT say things like "the system is shutting down" or "try again later." The user is waiting for your answer RIGHT NOW.\n\n` +
|
|
4636
|
-
`
|
|
4637
|
-
`
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4675
|
+
`You MUST produce a detailed PROGRESS REPORT so that a follow-up agent can continue your work without starting over. ` +
|
|
4676
|
+
`Structure your response with these sections:\n\n` +
|
|
4677
|
+
`## Task\nWhat was the original request / goal.\n\n` +
|
|
4678
|
+
`## Completed Work\nWhat you successfully accomplished — include ALL findings, code snippets, file paths, data, and conclusions gathered. Be specific and include actual content, not just descriptions.\n\n` +
|
|
4679
|
+
`## Key Findings\nConcrete facts, answers, or data points you discovered. Include file paths with line numbers, code snippets, configuration values, etc.\n\n` +
|
|
4680
|
+
`## Attempted but Inconclusive\nWhat you tried that did not yield clear results — include the approach and why it was inconclusive, so the next agent does not repeat it.\n\n` +
|
|
4681
|
+
`## Not Started / Remaining\nWhat parts of the task you did not get to, and any recommendations for how to approach them.\n\n` +
|
|
4682
|
+
`## Suggested Next Steps\nSpecific, actionable steps for a follow-up agent to continue this work efficiently.` +
|
|
4641
4683
|
`${taskContext}${schemaContext}\n\n` +
|
|
4642
|
-
`
|
|
4684
|
+
`IMPORTANT: Include ALL useful data you gathered inline — do not just say "I found X", actually include X. The next agent will only see this report, not your tool call history.`;
|
|
4643
4685
|
|
|
4644
4686
|
const summaryMessages = [
|
|
4645
4687
|
...currentMessages,
|
|
@@ -4791,21 +4833,33 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4791
4833
|
const searchQueries = [];
|
|
4792
4834
|
const searchDetails = [];
|
|
4793
4835
|
const toolCounts = {};
|
|
4836
|
+
const toolTimeline = [];
|
|
4794
4837
|
for (const tc of _toolCallLog) {
|
|
4838
|
+
if (tc.name === '_assistant_text') continue;
|
|
4795
4839
|
toolCounts[tc.name] = (toolCounts[tc.name] || 0) + 1;
|
|
4796
4840
|
if (tc.name === 'search') {
|
|
4797
4841
|
const q = tc.args.query || '';
|
|
4798
4842
|
const p = tc.args.path || '.';
|
|
4799
4843
|
const exact = tc.args.exact ? ' (exact)' : '';
|
|
4800
4844
|
searchQueries.push(`"${q}"${exact}`);
|
|
4801
|
-
searchDetails.push({ query: q, path: p, had_results:
|
|
4845
|
+
searchDetails.push({ query: q, path: p, had_results: !!(tc.resultBrief && tc.resultBrief.trim()) });
|
|
4802
4846
|
}
|
|
4847
|
+
const argStr = tc.name === 'search'
|
|
4848
|
+
? `query="${tc.args.query || ''}"${tc.args.exact ? ' exact' : ''}`
|
|
4849
|
+
: JSON.stringify(tc.args || {}).substring(0, 150);
|
|
4850
|
+
const brief = tc.resultBrief ? ` → ${tc.resultBrief.substring(0, 200)}` : ' → (no result)';
|
|
4851
|
+
toolTimeline.push(` [step ${tc.step}] ${tc.name}(${argStr})${brief}`);
|
|
4803
4852
|
}
|
|
4804
4853
|
const toolBreakdown = Object.entries(toolCounts)
|
|
4805
4854
|
.map(([name, count]) => `${name}: ${count}x`)
|
|
4806
4855
|
.join(', ');
|
|
4807
4856
|
const uniqueSearches = [...new Set(searchQueries)];
|
|
4808
4857
|
|
|
4858
|
+
// Collect any assistant text fragments as partial findings
|
|
4859
|
+
const assistantTexts = _toolCallLog
|
|
4860
|
+
.filter(tc => tc.name === '_assistant_text' && tc.resultBrief)
|
|
4861
|
+
.map(tc => tc.resultBrief);
|
|
4862
|
+
|
|
4809
4863
|
// For code-searcher subagents: produce structured JSON so the parent
|
|
4810
4864
|
// can still use partial results instead of getting a plain error string.
|
|
4811
4865
|
if (this.promptType === 'code-searcher') {
|
|
@@ -4816,12 +4870,18 @@ Double-check your response based on the criteria above. If everything looks good
|
|
|
4816
4870
|
searches: searchDetails
|
|
4817
4871
|
});
|
|
4818
4872
|
} else {
|
|
4819
|
-
let summary =
|
|
4820
|
-
summary +=
|
|
4873
|
+
let summary = `## Progress Report (iteration limit reached after ${currentIteration} steps)\n\n`;
|
|
4874
|
+
summary += `### Tool Usage Summary\n${toolBreakdown || 'none'}\n\n`;
|
|
4821
4875
|
if (uniqueSearches.length > 0) {
|
|
4822
|
-
summary +=
|
|
4876
|
+
summary += `### Search Queries Attempted\n${uniqueSearches.join(', ')}\n\n`;
|
|
4877
|
+
}
|
|
4878
|
+
if (toolTimeline.length > 0) {
|
|
4879
|
+
summary += `### Step-by-Step Activity Log\n${toolTimeline.join('\n')}\n\n`;
|
|
4880
|
+
}
|
|
4881
|
+
if (assistantTexts.length > 0) {
|
|
4882
|
+
summary += `### Partial Findings\n${assistantTexts.join('\n\n')}\n\n`;
|
|
4823
4883
|
}
|
|
4824
|
-
summary +=
|
|
4884
|
+
summary += `### Recommendation for Follow-Up\nThe iteration limit was reached before the task could be completed. A follow-up agent should review the activity log above to avoid repeating the same searches, and consider alternative approaches such as: using exact=true for literal string matching, using bash/grep for pattern-based file searches, or trying a different strategy.`;
|
|
4825
4885
|
finalResult = summary;
|
|
4826
4886
|
}
|
|
4827
4887
|
} catch {
|