@probelabs/probe 0.6.0-rc271 → 0.6.0-rc273
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-rc271-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc273-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/probe-v0.6.0-rc273-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc273-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc273-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc273-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/contextCompactor.js +42 -25
- package/build/agent/index.js +78 -177
- package/build/agent/shared/prompts.js +4 -3
- package/build/agent/tasks/taskTool.js +46 -235
- package/build/tools/analyzeAll.js +3 -4
- package/build/tools/edit.js +3 -3
- package/build/tools/vercel.js +1 -1
- package/cjs/agent/ProbeAgent.cjs +95 -202
- package/cjs/index.cjs +95 -202
- package/package.json +1 -1
- package/src/agent/contextCompactor.js +42 -25
- package/src/agent/shared/prompts.js +4 -3
- package/src/agent/tasks/taskTool.js +46 -235
- package/src/tools/analyzeAll.js +3 -4
- package/src/tools/edit.js +3 -3
- package/src/tools/vercel.js +1 -1
- package/bin/binaries/probe-v0.6.0-rc271-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc271-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc271-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc271-x86_64-unknown-linux-musl.tar.gz +0 -0
package/cjs/index.cjs
CHANGED
|
@@ -13365,22 +13365,16 @@ var init_JsonShapeDeserializer = __esm({
|
|
|
13365
13365
|
if (Array.isArray(value) && ns.isListSchema()) {
|
|
13366
13366
|
const listMember = ns.getValueSchema();
|
|
13367
13367
|
const out = [];
|
|
13368
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
13369
13368
|
for (const item of value) {
|
|
13370
|
-
|
|
13371
|
-
out.push(this._read(listMember, item));
|
|
13372
|
-
}
|
|
13369
|
+
out.push(this._read(listMember, item));
|
|
13373
13370
|
}
|
|
13374
13371
|
return out;
|
|
13375
13372
|
}
|
|
13376
13373
|
if (ns.isMapSchema()) {
|
|
13377
13374
|
const mapMember = ns.getValueSchema();
|
|
13378
13375
|
const out = {};
|
|
13379
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
13380
13376
|
for (const [_k, _v] of Object.entries(value)) {
|
|
13381
|
-
|
|
13382
|
-
out[_k] = this._read(mapMember, _v);
|
|
13383
|
-
}
|
|
13377
|
+
out[_k] = this._read(mapMember, _v);
|
|
13384
13378
|
}
|
|
13385
13379
|
return out;
|
|
13386
13380
|
}
|
|
@@ -15029,18 +15023,18 @@ var init_XmlShapeDeserializer = __esm({
|
|
|
15029
15023
|
return value;
|
|
15030
15024
|
}
|
|
15031
15025
|
if (typeof value === "object") {
|
|
15032
|
-
const sparse = !!traits.sparse;
|
|
15033
15026
|
const flat = !!traits.xmlFlattened;
|
|
15034
15027
|
if (ns.isListSchema()) {
|
|
15035
15028
|
const listValue = ns.getValueSchema();
|
|
15036
15029
|
const buffer2 = [];
|
|
15037
15030
|
const sourceKey = listValue.getMergedTraits().xmlName ?? "member";
|
|
15038
15031
|
const source = flat ? value : (value[0] ?? value)[sourceKey];
|
|
15032
|
+
if (source == null) {
|
|
15033
|
+
return buffer2;
|
|
15034
|
+
}
|
|
15039
15035
|
const sourceArray = Array.isArray(source) ? source : [source];
|
|
15040
15036
|
for (const v5 of sourceArray) {
|
|
15041
|
-
|
|
15042
|
-
buffer2.push(this.readSchema(listValue, v5));
|
|
15043
|
-
}
|
|
15037
|
+
buffer2.push(this.readSchema(listValue, v5));
|
|
15044
15038
|
}
|
|
15045
15039
|
return buffer2;
|
|
15046
15040
|
}
|
|
@@ -15059,9 +15053,7 @@ var init_XmlShapeDeserializer = __esm({
|
|
|
15059
15053
|
for (const entry of entries) {
|
|
15060
15054
|
const key = entry[keyProperty];
|
|
15061
15055
|
const value2 = entry[valueProperty];
|
|
15062
|
-
|
|
15063
|
-
buffer[key] = this.readSchema(memberNs, value2);
|
|
15064
|
-
}
|
|
15056
|
+
buffer[key] = this.readSchema(memberNs, value2);
|
|
15065
15057
|
}
|
|
15066
15058
|
return buffer;
|
|
15067
15059
|
}
|
|
@@ -19403,7 +19395,7 @@ var require_package2 = __commonJS({
|
|
|
19403
19395
|
module2.exports = {
|
|
19404
19396
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
19405
19397
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
19406
|
-
version: "3.
|
|
19398
|
+
version: "3.1002.0",
|
|
19407
19399
|
scripts: {
|
|
19408
19400
|
build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
19409
19401
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -19427,21 +19419,21 @@ var require_package2 = __commonJS({
|
|
|
19427
19419
|
dependencies: {
|
|
19428
19420
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
19429
19421
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
19430
|
-
"@aws-sdk/core": "^3.973.
|
|
19431
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
19422
|
+
"@aws-sdk/core": "^3.973.17",
|
|
19423
|
+
"@aws-sdk/credential-provider-node": "^3.972.16",
|
|
19432
19424
|
"@aws-sdk/eventstream-handler-node": "^3.972.9",
|
|
19433
19425
|
"@aws-sdk/middleware-eventstream": "^3.972.6",
|
|
19434
19426
|
"@aws-sdk/middleware-host-header": "^3.972.6",
|
|
19435
19427
|
"@aws-sdk/middleware-logger": "^3.972.6",
|
|
19436
19428
|
"@aws-sdk/middleware-recursion-detection": "^3.972.6",
|
|
19437
|
-
"@aws-sdk/middleware-user-agent": "^3.972.
|
|
19429
|
+
"@aws-sdk/middleware-user-agent": "^3.972.17",
|
|
19438
19430
|
"@aws-sdk/middleware-websocket": "^3.972.11",
|
|
19439
19431
|
"@aws-sdk/region-config-resolver": "^3.972.6",
|
|
19440
|
-
"@aws-sdk/token-providers": "3.
|
|
19432
|
+
"@aws-sdk/token-providers": "3.1002.0",
|
|
19441
19433
|
"@aws-sdk/types": "^3.973.4",
|
|
19442
19434
|
"@aws-sdk/util-endpoints": "^3.996.3",
|
|
19443
19435
|
"@aws-sdk/util-user-agent-browser": "^3.972.6",
|
|
19444
|
-
"@aws-sdk/util-user-agent-node": "^3.973.
|
|
19436
|
+
"@aws-sdk/util-user-agent-node": "^3.973.2",
|
|
19445
19437
|
"@smithy/config-resolver": "^4.4.9",
|
|
19446
19438
|
"@smithy/core": "^3.23.7",
|
|
19447
19439
|
"@smithy/eventstream-serde-browser": "^4.2.10",
|
|
@@ -20190,7 +20182,7 @@ var init_package = __esm({
|
|
|
20190
20182
|
"node_modules/@aws-sdk/nested-clients/package.json"() {
|
|
20191
20183
|
package_default = {
|
|
20192
20184
|
name: "@aws-sdk/nested-clients",
|
|
20193
|
-
version: "3.996.
|
|
20185
|
+
version: "3.996.5",
|
|
20194
20186
|
description: "Nested clients for AWS SDK packages.",
|
|
20195
20187
|
main: "./dist-cjs/index.js",
|
|
20196
20188
|
module: "./dist-es/index.js",
|
|
@@ -20219,16 +20211,16 @@ var init_package = __esm({
|
|
|
20219
20211
|
dependencies: {
|
|
20220
20212
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
20221
20213
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
20222
|
-
"@aws-sdk/core": "^3.973.
|
|
20214
|
+
"@aws-sdk/core": "^3.973.17",
|
|
20223
20215
|
"@aws-sdk/middleware-host-header": "^3.972.6",
|
|
20224
20216
|
"@aws-sdk/middleware-logger": "^3.972.6",
|
|
20225
20217
|
"@aws-sdk/middleware-recursion-detection": "^3.972.6",
|
|
20226
|
-
"@aws-sdk/middleware-user-agent": "^3.972.
|
|
20218
|
+
"@aws-sdk/middleware-user-agent": "^3.972.17",
|
|
20227
20219
|
"@aws-sdk/region-config-resolver": "^3.972.6",
|
|
20228
20220
|
"@aws-sdk/types": "^3.973.4",
|
|
20229
20221
|
"@aws-sdk/util-endpoints": "^3.996.3",
|
|
20230
20222
|
"@aws-sdk/util-user-agent-browser": "^3.972.6",
|
|
20231
|
-
"@aws-sdk/util-user-agent-node": "^3.973.
|
|
20223
|
+
"@aws-sdk/util-user-agent-node": "^3.973.2",
|
|
20232
20224
|
"@smithy/config-resolver": "^4.4.9",
|
|
20233
20225
|
"@smithy/core": "^3.23.7",
|
|
20234
20226
|
"@smithy/fetch-http-handler": "^5.3.12",
|
|
@@ -35877,20 +35869,15 @@ var init_zod = __esm({
|
|
|
35877
35869
|
|
|
35878
35870
|
// src/agent/tasks/taskTool.js
|
|
35879
35871
|
function createTaskCompletionBlockedMessage(taskSummary) {
|
|
35880
|
-
return
|
|
35881
|
-
You cannot complete yet. The following tasks are still unresolved:
|
|
35872
|
+
return `You cannot complete yet. The following tasks are still unresolved:
|
|
35882
35873
|
|
|
35883
35874
|
${taskSummary}
|
|
35884
35875
|
|
|
35885
|
-
|
|
35886
|
-
|
|
35887
|
-
|
|
35888
|
-
- Or cancel if no longer needed: <task><action>update</action><id>task-X</id><status>cancelled</status></task>
|
|
35876
|
+
For each pending/in_progress task, either:
|
|
35877
|
+
- Complete it: call task tool with action="complete", id="task-X"
|
|
35878
|
+
- Cancel it: call task tool with action="update", id="task-X", status="cancelled"
|
|
35889
35879
|
|
|
35890
|
-
|
|
35891
|
-
|
|
35892
|
-
Use <task><action>list</action></task> to review current status.
|
|
35893
|
-
</task_completion_blocked>`;
|
|
35880
|
+
After all tasks are resolved, call attempt_completion again.`;
|
|
35894
35881
|
}
|
|
35895
35882
|
function createTaskTool(options = {}) {
|
|
35896
35883
|
const { taskManager, tracer, debug = false } = options;
|
|
@@ -36113,145 +36100,46 @@ var init_taskTool = __esm({
|
|
|
36113
36100
|
dependencies: external_exports.array(external_exports.string()).optional(),
|
|
36114
36101
|
after: external_exports.string().optional()
|
|
36115
36102
|
});
|
|
36116
|
-
taskSystemPrompt = `[Task Management
|
|
36117
|
-
|
|
36118
|
-
|
|
36119
|
-
|
|
36120
|
-
## When to
|
|
36121
|
-
|
|
36122
|
-
CREATE
|
|
36123
|
-
- "Fix bug A AND add feature B" \u2192
|
|
36124
|
-
- "Investigate auth, payments, AND notifications" \u2192
|
|
36125
|
-
- "Implement X, then add tests, then update docs" \u2192
|
|
36126
|
-
|
|
36127
|
-
|
|
36128
|
-
|
|
36129
|
-
- "
|
|
36130
|
-
|
|
36131
|
-
|
|
36132
|
-
|
|
36133
|
-
|
|
36134
|
-
|
|
36135
|
-
|
|
36136
|
-
|
|
36137
|
-
|
|
36138
|
-
|
|
36139
|
-
|
|
36140
|
-
|
|
36141
|
-
|
|
36142
|
-
|
|
36143
|
-
|
|
36144
|
-
|
|
36145
|
-
|
|
36146
|
-
|
|
36147
|
-
-
|
|
36148
|
-
-
|
|
36149
|
-
-
|
|
36150
|
-
|
|
36151
|
-
**Good patterns**:
|
|
36152
|
-
- One task per distinct deliverable \u2713
|
|
36153
|
-
- One task per phase (implement, test, document) \u2713
|
|
36154
|
-
- One task per different type of work \u2713
|
|
36155
|
-
|
|
36156
|
-
MODIFY TASKS when (during execution):
|
|
36157
|
-
- You discover the problem is more complex than expected \u2192 Add new tasks
|
|
36158
|
-
- A single task covers too much scope \u2192 Split into smaller tasks
|
|
36159
|
-
- You find related work that needs attention \u2192 Add dependent tasks
|
|
36160
|
-
- A task becomes irrelevant based on findings \u2192 Cancel it
|
|
36161
|
-
- Task priorities change based on discoveries \u2192 Update priority
|
|
36162
|
-
- You learn new context \u2192 Update task description
|
|
36163
|
-
|
|
36164
|
-
## Task Workflow
|
|
36165
|
-
|
|
36166
|
-
**STEP 1 - Plan (at start):**
|
|
36167
|
-
Analyze the request and create tasks for each logical step:
|
|
36168
|
-
|
|
36169
|
-
<task>
|
|
36170
|
-
<action>create</action>
|
|
36171
|
-
<tasks>[
|
|
36172
|
-
{"title": "Search for authentication module", "priority": "high"},
|
|
36173
|
-
{"title": "Analyze login flow implementation", "dependencies": ["task-1"]},
|
|
36174
|
-
{"title": "Find session management code", "dependencies": ["task-1"]},
|
|
36175
|
-
{"title": "Summarize authentication architecture", "dependencies": ["task-2", "task-3"]}
|
|
36176
|
-
]</tasks>
|
|
36177
|
-
</task>
|
|
36178
|
-
|
|
36179
|
-
**STEP 2 - Execute (during work):**
|
|
36180
|
-
Update task status as you work:
|
|
36181
|
-
|
|
36182
|
-
<task>
|
|
36183
|
-
<action>update</action>
|
|
36184
|
-
<id>task-1</id>
|
|
36185
|
-
<status>in_progress</status>
|
|
36186
|
-
</task>
|
|
36187
|
-
|
|
36188
|
-
... do the work (search, extract, etc.) ...
|
|
36189
|
-
|
|
36190
|
-
<task>
|
|
36191
|
-
<action>complete</action>
|
|
36192
|
-
<id>task-1</id>
|
|
36193
|
-
</task>
|
|
36194
|
-
|
|
36195
|
-
**STEP 2b - Adapt (when you discover new work):**
|
|
36196
|
-
As you work, you may discover that:
|
|
36197
|
-
- A task is more complex than expected \u2192 Split it into subtasks
|
|
36198
|
-
- New areas need investigation \u2192 Add new tasks
|
|
36199
|
-
- Some tasks are no longer needed \u2192 Cancel them
|
|
36200
|
-
- Task order should change \u2192 Update dependencies
|
|
36201
|
-
|
|
36202
|
-
*Adding a new task when you discover more work:*
|
|
36203
|
-
<task>
|
|
36204
|
-
<action>create</action>
|
|
36205
|
-
<title>Investigate caching layer</title>
|
|
36206
|
-
<description>Found references to Redis caching in auth module</description>
|
|
36207
|
-
</task>
|
|
36208
|
-
|
|
36209
|
-
*Inserting a task after a specific task (to maintain logical order):*
|
|
36210
|
-
<task>
|
|
36211
|
-
<action>create</action>
|
|
36212
|
-
<title>Check rate limiting</title>
|
|
36213
|
-
<after>task-2</after>
|
|
36214
|
-
</task>
|
|
36215
|
-
|
|
36216
|
-
*Cancelling and splitting a complex task:*
|
|
36217
|
-
<task>
|
|
36218
|
-
<action>update</action>
|
|
36219
|
-
<id>task-3</id>
|
|
36220
|
-
<status>cancelled</status>
|
|
36221
|
-
</task>
|
|
36222
|
-
<task>
|
|
36223
|
-
<action>create</action>
|
|
36224
|
-
<tasks>[
|
|
36225
|
-
{"title": "Review JWT token generation", "priority": "high"},
|
|
36226
|
-
{"title": "Review token refresh logic"}
|
|
36227
|
-
]</tasks>
|
|
36228
|
-
</task>
|
|
36229
|
-
|
|
36230
|
-
**STEP 3 - Finish (before completion):**
|
|
36231
|
-
Before calling attempt_completion, ensure ALL tasks are either:
|
|
36232
|
-
- \`completed\` - you finished the work
|
|
36233
|
-
- \`cancelled\` - no longer needed
|
|
36234
|
-
|
|
36235
|
-
If you created tasks, you MUST resolve them all before completing.
|
|
36236
|
-
|
|
36237
|
-
## Key Rules
|
|
36238
|
-
|
|
36239
|
-
1. **Dependencies are enforced**: A task cannot start until its dependencies are completed
|
|
36240
|
-
2. **Circular dependencies are rejected**: task-1 \u2192 task-2 \u2192 task-1 is invalid
|
|
36241
|
-
3. **Completion is blocked**: attempt_completion will fail if tasks remain unresolved
|
|
36242
|
-
4. **List to review**: Use <task><action>list</action></task> to see current task status
|
|
36243
|
-
5. **Tasks are living documents**: Add, split, or cancel tasks as you learn more about the problem
|
|
36103
|
+
taskSystemPrompt = `[Task Management]
|
|
36104
|
+
|
|
36105
|
+
Use the task tool to track progress on complex requests with multiple distinct goals.
|
|
36106
|
+
|
|
36107
|
+
## When to Use Tasks
|
|
36108
|
+
|
|
36109
|
+
CREATE tasks when the request has **multiple separate deliverables**:
|
|
36110
|
+
- "Fix bug A AND add feature B" \u2192 two tasks
|
|
36111
|
+
- "Investigate auth, payments, AND notifications" \u2192 three tasks
|
|
36112
|
+
- "Implement X, then add tests, then update docs" \u2192 three sequential tasks
|
|
36113
|
+
|
|
36114
|
+
SKIP tasks for single-goal requests, even complex ones:
|
|
36115
|
+
- "How does ranking work?" \u2014 just investigate and answer
|
|
36116
|
+
- "Explain the authentication flow" \u2014 just trace and explain
|
|
36117
|
+
Multiple internal steps (search, read, analyze) for one goal \u2260 multiple tasks.
|
|
36118
|
+
|
|
36119
|
+
## Granularity
|
|
36120
|
+
|
|
36121
|
+
Tasks = logical units of work, not files or steps.
|
|
36122
|
+
- "Fix 8 similar test files" \u2192 ONE task (same fix repeated)
|
|
36123
|
+
- "Update API + tests + docs" \u2192 THREE tasks (different work types)
|
|
36124
|
+
- Max 3\u20134 tasks. More means you're too granular.
|
|
36125
|
+
|
|
36126
|
+
## Workflow
|
|
36127
|
+
|
|
36128
|
+
1. **Plan**: Call task tool with action="create" and a tasks array up front
|
|
36129
|
+
2. **Execute**: Update status to "in_progress" / "completed" as you work. Add, split, or cancel tasks as you learn more.
|
|
36130
|
+
3. **Finish**: All tasks must be "completed" or "cancelled" before calling attempt_completion.
|
|
36131
|
+
|
|
36132
|
+
## Rules
|
|
36133
|
+
|
|
36134
|
+
- Dependencies are enforced: a task cannot start until its dependencies are completed
|
|
36135
|
+
- Circular dependencies are rejected
|
|
36136
|
+
- attempt_completion is blocked while tasks remain unresolved
|
|
36244
36137
|
`;
|
|
36245
|
-
taskGuidancePrompt =
|
|
36246
|
-
Does this request have MULTIPLE DISTINCT GOALS?
|
|
36138
|
+
taskGuidancePrompt = `Does this request have MULTIPLE DISTINCT GOALS?
|
|
36247
36139
|
- "Do A AND B AND C" (multiple goals) \u2192 Create tasks for each goal
|
|
36248
36140
|
- "Investigate/explain/find X" (single goal) \u2192 Skip tasks, just answer directly
|
|
36249
|
-
|
|
36250
|
-
|
|
36251
|
-
Only create tasks when there are separate deliverables the user is asking for.
|
|
36252
|
-
|
|
36253
|
-
If creating tasks, use the task tool with action="create" first.
|
|
36254
|
-
</task_guidance>`;
|
|
36141
|
+
Multiple internal steps for ONE goal = NO tasks needed.
|
|
36142
|
+
If creating tasks, use the task tool with action="create" first.`;
|
|
36255
36143
|
}
|
|
36256
36144
|
});
|
|
36257
36145
|
|
|
@@ -82750,9 +82638,10 @@ If the solution is clear, you can jump to implementation right away. If not, ask
|
|
|
82750
82638
|
- After every significant change, verify the project still builds and passes linting. Do not wait until the end to discover breakage.
|
|
82751
82639
|
|
|
82752
82640
|
# After Implementation
|
|
82753
|
-
-
|
|
82754
|
-
- Run lint and typecheck commands if known for the project.
|
|
82755
|
-
-
|
|
82641
|
+
- Verify the project builds successfully. If it doesn't, fix the build before moving on.
|
|
82642
|
+
- Run lint and typecheck commands if known for the project. Fix any new warnings or errors you introduced.
|
|
82643
|
+
- Add tests for any new or changed functionality. Tests must cover the main path and important edge cases.
|
|
82644
|
+
- Run the project's full test suite. If any tests fail (including pre-existing ones you may have broken), fix them before finishing.
|
|
82756
82645
|
- When the task is done, respond to the user with a concise summary of what was implemented, what files were changed, and any relevant details. Include links (e.g. pull request URL) so the user has everything they need.
|
|
82757
82646
|
|
|
82758
82647
|
# GitHub Integration
|
|
@@ -91965,6 +91854,19 @@ function isContextLimitError(error2) {
|
|
|
91965
91854
|
}
|
|
91966
91855
|
return false;
|
|
91967
91856
|
}
|
|
91857
|
+
function messageContainsCompletion(msg) {
|
|
91858
|
+
if (Array.isArray(msg.toolInvocations)) {
|
|
91859
|
+
if (msg.toolInvocations.some((t5) => t5.toolName === "attempt_completion")) return true;
|
|
91860
|
+
}
|
|
91861
|
+
if (Array.isArray(msg.tool_calls)) {
|
|
91862
|
+
if (msg.tool_calls.some((t5) => t5.function?.name === "attempt_completion")) return true;
|
|
91863
|
+
}
|
|
91864
|
+
if (Array.isArray(msg.content)) {
|
|
91865
|
+
if (msg.content.some((p5) => p5.type === "tool-call" && p5.toolName === "attempt_completion")) return true;
|
|
91866
|
+
}
|
|
91867
|
+
const text = typeof msg.content === "string" ? msg.content : "";
|
|
91868
|
+
return text.includes("attempt_completion");
|
|
91869
|
+
}
|
|
91968
91870
|
function identifyMessageSegments(messages) {
|
|
91969
91871
|
const segments = [];
|
|
91970
91872
|
let currentSegment = null;
|
|
@@ -91973,27 +91875,23 @@ function identifyMessageSegments(messages) {
|
|
|
91973
91875
|
if (msg.role === "system") {
|
|
91974
91876
|
continue;
|
|
91975
91877
|
}
|
|
91878
|
+
if (msg.role === "tool" && currentSegment) {
|
|
91879
|
+
currentSegment.monologueIndices.push(i5);
|
|
91880
|
+
continue;
|
|
91881
|
+
}
|
|
91976
91882
|
if (msg.role === "user") {
|
|
91977
|
-
|
|
91978
|
-
const isToolResult = content.includes("<tool_result>");
|
|
91979
|
-
if (isToolResult && currentSegment) {
|
|
91980
|
-
currentSegment.finalIndex = i5;
|
|
91883
|
+
if (currentSegment) {
|
|
91981
91884
|
segments.push(currentSegment);
|
|
91982
|
-
currentSegment = null;
|
|
91983
|
-
} else {
|
|
91984
|
-
if (currentSegment) {
|
|
91985
|
-
segments.push(currentSegment);
|
|
91986
|
-
}
|
|
91987
|
-
currentSegment = {
|
|
91988
|
-
userIndex: i5,
|
|
91989
|
-
monologueIndices: [],
|
|
91990
|
-
finalIndex: null
|
|
91991
|
-
};
|
|
91992
91885
|
}
|
|
91886
|
+
currentSegment = {
|
|
91887
|
+
userIndex: i5,
|
|
91888
|
+
monologueIndices: [],
|
|
91889
|
+
finalIndex: null
|
|
91890
|
+
};
|
|
91993
91891
|
}
|
|
91994
91892
|
if (msg.role === "assistant" && currentSegment) {
|
|
91995
|
-
const
|
|
91996
|
-
if (
|
|
91893
|
+
const hasCompletion = messageContainsCompletion(msg);
|
|
91894
|
+
if (hasCompletion) {
|
|
91997
91895
|
currentSegment.monologueIndices.push(i5);
|
|
91998
91896
|
currentSegment.finalIndex = i5;
|
|
91999
91897
|
segments.push(currentSegment);
|
|
@@ -110100,8 +109998,7 @@ Instructions:
|
|
|
110100
109998
|
- Format as a structured list if multiple items found
|
|
110101
109999
|
- If nothing relevant is found in this chunk, respond with "No relevant items found in this chunk."
|
|
110102
110000
|
- Do NOT summarize the code - extract the specific information requested
|
|
110103
|
-
-
|
|
110104
|
-
- Do NOT use the shorthand <attempt_complete></attempt_complete> format`;
|
|
110001
|
+
- When done, use the attempt_completion tool with your answer as the result.`;
|
|
110105
110002
|
try {
|
|
110106
110003
|
const result = await delegate({
|
|
110107
110004
|
task,
|
|
@@ -110166,7 +110063,7 @@ async function aggregateResults(chunkResults2, aggregation, extractionPrompt, op
|
|
|
110166
110063
|
${stripResultTags(r5.result)}`).join("\n\n");
|
|
110167
110064
|
const completionNote = `
|
|
110168
110065
|
|
|
110169
|
-
|
|
110066
|
+
When done, use the attempt_completion tool with your answer as the result.`;
|
|
110170
110067
|
const aggregationPrompts = {
|
|
110171
110068
|
summarize: `Synthesize these analyses into a comprehensive summary. Combine related findings, remove redundancy, and present a coherent overview.
|
|
110172
110069
|
|
|
@@ -110324,7 +110221,7 @@ Your answer should:
|
|
|
110324
110221
|
|
|
110325
110222
|
Format your response as a well-structured document that fully answers: "${question}"
|
|
110326
110223
|
|
|
110327
|
-
|
|
110224
|
+
When done, use the attempt_completion tool with your answer as the result.`;
|
|
110328
110225
|
try {
|
|
110329
110226
|
const result = await delegate({
|
|
110330
110227
|
task: synthesisTask,
|
|
@@ -110655,7 +110552,7 @@ function buildSearchDelegateTask({ searchQuery, searchPath, exact, language, all
|
|
|
110655
110552
|
"",
|
|
110656
110553
|
"Strategy for complex queries:",
|
|
110657
110554
|
"1. Analyze the query - identify key concepts, entities, and relationships",
|
|
110658
|
-
'2. Run focused searches for each concept (e.g., "
|
|
110555
|
+
'2. Run focused searches for each independent concept (e.g., for "how do payments work and how are emails sent", search "payments" and "emails" separately since they are unrelated)',
|
|
110659
110556
|
"3. Use extract to verify relevance of promising results",
|
|
110660
110557
|
"4. Combine all relevant targets in your final response",
|
|
110661
110558
|
"",
|
|
@@ -111394,9 +111291,7 @@ Example: <edit><file_path>${file_path}</file_path><symbol>${allMatches[0].qualif
|
|
|
111394
111291
|
if (fileTracker) {
|
|
111395
111292
|
const check = fileTracker.checkSymbolContent(resolvedPath2, symbol15, symbolInfo.code);
|
|
111396
111293
|
if (!check.ok && check.reason === "stale") {
|
|
111397
|
-
return `Error editing ${file_path}: Symbol "${symbol15}" has changed since you last read it. Use extract to re-read the current content, then retry
|
|
111398
|
-
|
|
111399
|
-
Example: <extract><targets>${file_path}#${symbol15}</targets></extract>`;
|
|
111294
|
+
return `Error editing ${file_path}: Symbol "${symbol15}" has changed since you last read it. Use the extract tool with targets="${file_path}#${symbol15}" to re-read the current content, then retry.`;
|
|
111400
111295
|
}
|
|
111401
111296
|
}
|
|
111402
111297
|
const content = await import_fs12.promises.readFile(resolvedPath2, "utf-8");
|
|
@@ -111634,9 +111529,7 @@ Parameters:
|
|
|
111634
111529
|
}
|
|
111635
111530
|
if (options.fileTracker && !options.fileTracker.isFileSeen(resolvedPath2)) {
|
|
111636
111531
|
const displayPath = toRelativePath(resolvedPath2, workspaceRoot);
|
|
111637
|
-
return `Error editing ${displayPath}: This file has not been read yet in this session. Use
|
|
111638
|
-
|
|
111639
|
-
Example: <extract><targets>${displayPath}</targets></extract>`;
|
|
111532
|
+
return `Error editing ${displayPath}: This file has not been read yet in this session. Use the extract tool with targets="${displayPath}" to read the file first, then retry your edit.`;
|
|
111640
111533
|
}
|
|
111641
111534
|
if (symbol15 !== void 0 && symbol15 !== null) {
|
|
111642
111535
|
return await handleSymbolEdit({ resolvedPath: resolvedPath2, file_path, symbol: symbol15, new_string, position, debug, cwd, fileTracker: options.fileTracker });
|
|
@@ -111656,7 +111549,7 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
|
|
|
111656
111549
|
const displayPath = toRelativePath(resolvedPath2, workspaceRoot);
|
|
111657
111550
|
return `Error editing ${displayPath}: ${staleCheck.message}
|
|
111658
111551
|
|
|
111659
|
-
|
|
111552
|
+
Use the extract tool with targets="${displayPath}" to re-read the file, then retry.`;
|
|
111660
111553
|
}
|
|
111661
111554
|
}
|
|
111662
111555
|
const content = await import_fs12.promises.readFile(resolvedPath2, "utf-8");
|
package/package.json
CHANGED
|
@@ -58,6 +58,28 @@ export function isContextLimitError(error) {
|
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Check if an assistant message contains an attempt_completion tool call.
|
|
63
|
+
* Supports both native tool calling (toolInvocations/tool_calls) and text content.
|
|
64
|
+
*/
|
|
65
|
+
function messageContainsCompletion(msg) {
|
|
66
|
+
// Native tool calling: Vercel AI SDK uses toolInvocations
|
|
67
|
+
if (Array.isArray(msg.toolInvocations)) {
|
|
68
|
+
if (msg.toolInvocations.some(t => t.toolName === 'attempt_completion')) return true;
|
|
69
|
+
}
|
|
70
|
+
// Native tool calling: OpenAI format uses tool_calls
|
|
71
|
+
if (Array.isArray(msg.tool_calls)) {
|
|
72
|
+
if (msg.tool_calls.some(t => t.function?.name === 'attempt_completion')) return true;
|
|
73
|
+
}
|
|
74
|
+
// Multipart content (Vercel AI SDK v4+)
|
|
75
|
+
if (Array.isArray(msg.content)) {
|
|
76
|
+
if (msg.content.some(p => p.type === 'tool-call' && p.toolName === 'attempt_completion')) return true;
|
|
77
|
+
}
|
|
78
|
+
// Text content fallback
|
|
79
|
+
const text = typeof msg.content === 'string' ? msg.content : '';
|
|
80
|
+
return text.includes('attempt_completion');
|
|
81
|
+
}
|
|
82
|
+
|
|
61
83
|
/**
|
|
62
84
|
* Identify message boundaries in conversation history
|
|
63
85
|
* Structure: <user> -> <internal agentic monologue> -> <final-agent-answer>
|
|
@@ -65,7 +87,7 @@ export function isContextLimitError(error) {
|
|
|
65
87
|
* A "segment" is:
|
|
66
88
|
* - user message (role: 'user')
|
|
67
89
|
* - followed by 0+ assistant messages (internal monologue)
|
|
68
|
-
* - ending with
|
|
90
|
+
* - ending with attempt_completion tool call (final answer)
|
|
69
91
|
*
|
|
70
92
|
* @param {Array} messages - Array of message objects with {role, content}
|
|
71
93
|
* @returns {Array} - Array of segments, each containing {userIndex, monologueIndices, finalIndex}
|
|
@@ -82,38 +104,33 @@ export function identifyMessageSegments(messages) {
|
|
|
82
104
|
continue;
|
|
83
105
|
}
|
|
84
106
|
|
|
107
|
+
// Tool result message (native tool calling format)
|
|
108
|
+
if (msg.role === 'tool' && currentSegment) {
|
|
109
|
+
currentSegment.monologueIndices.push(i);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
|
|
85
113
|
// User message starts a new segment
|
|
86
114
|
if (msg.role === 'user') {
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
const isToolResult = content.includes('<tool_result>');
|
|
90
|
-
|
|
91
|
-
if (isToolResult && currentSegment) {
|
|
92
|
-
// This is the final answer for the current segment
|
|
93
|
-
currentSegment.finalIndex = i;
|
|
115
|
+
// Save previous segment if it exists
|
|
116
|
+
if (currentSegment) {
|
|
94
117
|
segments.push(currentSegment);
|
|
95
|
-
currentSegment = null;
|
|
96
|
-
} else {
|
|
97
|
-
// Save previous segment if it exists
|
|
98
|
-
if (currentSegment) {
|
|
99
|
-
segments.push(currentSegment);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Start new segment
|
|
103
|
-
currentSegment = {
|
|
104
|
-
userIndex: i,
|
|
105
|
-
monologueIndices: [],
|
|
106
|
-
finalIndex: null
|
|
107
|
-
};
|
|
108
118
|
}
|
|
119
|
+
|
|
120
|
+
// Start new segment
|
|
121
|
+
currentSegment = {
|
|
122
|
+
userIndex: i,
|
|
123
|
+
monologueIndices: [],
|
|
124
|
+
finalIndex: null
|
|
125
|
+
};
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
// Assistant message is part of monologue
|
|
112
129
|
if (msg.role === 'assistant' && currentSegment) {
|
|
113
|
-
|
|
130
|
+
// Check if this contains an attempt_completion tool call (native or XML format)
|
|
131
|
+
const hasCompletion = messageContainsCompletion(msg);
|
|
114
132
|
|
|
115
|
-
|
|
116
|
-
if (content.includes('<attempt_completion>') || content.includes('attempt_completion')) {
|
|
133
|
+
if (hasCompletion) {
|
|
117
134
|
currentSegment.monologueIndices.push(i);
|
|
118
135
|
currentSegment.finalIndex = i;
|
|
119
136
|
segments.push(currentSegment);
|
|
@@ -138,7 +155,7 @@ export function identifyMessageSegments(messages) {
|
|
|
138
155
|
*
|
|
139
156
|
* Strategy:
|
|
140
157
|
* 1. Keep all user messages
|
|
141
|
-
* 2. Keep all final answers (
|
|
158
|
+
* 2. Keep all final answers (attempt_completion)
|
|
142
159
|
* 3. Remove intermediate monologue messages from completed segments
|
|
143
160
|
* 4. Keep the most recent (active) segment intact
|
|
144
161
|
*
|
|
@@ -94,9 +94,10 @@ If the solution is clear, you can jump to implementation right away. If not, ask
|
|
|
94
94
|
- After every significant change, verify the project still builds and passes linting. Do not wait until the end to discover breakage.
|
|
95
95
|
|
|
96
96
|
# After Implementation
|
|
97
|
-
-
|
|
98
|
-
- Run lint and typecheck commands if known for the project.
|
|
99
|
-
-
|
|
97
|
+
- Verify the project builds successfully. If it doesn't, fix the build before moving on.
|
|
98
|
+
- Run lint and typecheck commands if known for the project. Fix any new warnings or errors you introduced.
|
|
99
|
+
- Add tests for any new or changed functionality. Tests must cover the main path and important edge cases.
|
|
100
|
+
- Run the project's full test suite. If any tests fail (including pre-existing ones you may have broken), fix them before finishing.
|
|
100
101
|
- When the task is done, respond to the user with a concise summary of what was implemented, what files were changed, and any relevant details. Include links (e.g. pull request URL) so the user has everything they need.
|
|
101
102
|
|
|
102
103
|
# GitHub Integration
|