@probelabs/probe 0.6.0-rc272 → 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-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-rc272-x86_64-pc-windows-msvc.zip → 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 +77 -176
- 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/cjs/agent/ProbeAgent.cjs +77 -176
- package/cjs/index.cjs +77 -176
- 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/bin/binaries/probe-v0.6.0-rc272-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc272-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc272-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc272-x86_64-unknown-linux-musl.tar.gz +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
*
|
package/build/agent/index.js
CHANGED
|
@@ -4354,8 +4354,7 @@ Instructions:
|
|
|
4354
4354
|
- Format as a structured list if multiple items found
|
|
4355
4355
|
- If nothing relevant is found in this chunk, respond with "No relevant items found in this chunk."
|
|
4356
4356
|
- Do NOT summarize the code - extract the specific information requested
|
|
4357
|
-
-
|
|
4358
|
-
- Do NOT use the shorthand <attempt_complete></attempt_complete> format`;
|
|
4357
|
+
- When done, use the attempt_completion tool with your answer as the result.`;
|
|
4359
4358
|
try {
|
|
4360
4359
|
const result = await delegate({
|
|
4361
4360
|
task,
|
|
@@ -4420,7 +4419,7 @@ async function aggregateResults(chunkResults2, aggregation, extractionPrompt, op
|
|
|
4420
4419
|
${stripResultTags(r.result)}`).join("\n\n");
|
|
4421
4420
|
const completionNote = `
|
|
4422
4421
|
|
|
4423
|
-
|
|
4422
|
+
When done, use the attempt_completion tool with your answer as the result.`;
|
|
4424
4423
|
const aggregationPrompts = {
|
|
4425
4424
|
summarize: `Synthesize these analyses into a comprehensive summary. Combine related findings, remove redundancy, and present a coherent overview.
|
|
4426
4425
|
|
|
@@ -4578,7 +4577,7 @@ Your answer should:
|
|
|
4578
4577
|
|
|
4579
4578
|
Format your response as a well-structured document that fully answers: "${question}"
|
|
4580
4579
|
|
|
4581
|
-
|
|
4580
|
+
When done, use the attempt_completion tool with your answer as the result.`;
|
|
4582
4581
|
try {
|
|
4583
4582
|
const result = await delegate({
|
|
4584
4583
|
task: synthesisTask,
|
|
@@ -11812,9 +11811,7 @@ Example: <edit><file_path>${file_path}</file_path><symbol>${allMatches[0].qualif
|
|
|
11812
11811
|
if (fileTracker) {
|
|
11813
11812
|
const check = fileTracker.checkSymbolContent(resolvedPath, symbol, symbolInfo.code);
|
|
11814
11813
|
if (!check.ok && check.reason === "stale") {
|
|
11815
|
-
return `Error editing ${file_path}: Symbol "${symbol}" has changed since you last read it. Use extract to re-read the current content, then retry
|
|
11816
|
-
|
|
11817
|
-
Example: <extract><targets>${file_path}#${symbol}</targets></extract>`;
|
|
11814
|
+
return `Error editing ${file_path}: Symbol "${symbol}" has changed since you last read it. Use the extract tool with targets="${file_path}#${symbol}" to re-read the current content, then retry.`;
|
|
11818
11815
|
}
|
|
11819
11816
|
}
|
|
11820
11817
|
const content = await fs6.readFile(resolvedPath, "utf-8");
|
|
@@ -12048,9 +12045,7 @@ Parameters:
|
|
|
12048
12045
|
}
|
|
12049
12046
|
if (options.fileTracker && !options.fileTracker.isFileSeen(resolvedPath)) {
|
|
12050
12047
|
const displayPath = toRelativePath(resolvedPath, workspaceRoot);
|
|
12051
|
-
return `Error editing ${displayPath}: This file has not been read yet in this session. Use
|
|
12052
|
-
|
|
12053
|
-
Example: <extract><targets>${displayPath}</targets></extract>`;
|
|
12048
|
+
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.`;
|
|
12054
12049
|
}
|
|
12055
12050
|
if (symbol !== void 0 && symbol !== null) {
|
|
12056
12051
|
return await handleSymbolEdit({ resolvedPath, file_path, symbol, new_string, position, debug, cwd, fileTracker: options.fileTracker });
|
|
@@ -12070,7 +12065,7 @@ Example: <extract><targets>${displayPath}</targets></extract>`;
|
|
|
12070
12065
|
const displayPath = toRelativePath(resolvedPath, workspaceRoot);
|
|
12071
12066
|
return `Error editing ${displayPath}: ${staleCheck.message}
|
|
12072
12067
|
|
|
12073
|
-
|
|
12068
|
+
Use the extract tool with targets="${displayPath}" to re-read the file, then retry.`;
|
|
12074
12069
|
}
|
|
12075
12070
|
}
|
|
12076
12071
|
const content = await fs6.readFile(resolvedPath, "utf-8");
|
|
@@ -31692,20 +31687,15 @@ ${taskLines.join("\n")}
|
|
|
31692
31687
|
|
|
31693
31688
|
// src/agent/tasks/taskTool.js
|
|
31694
31689
|
function createTaskCompletionBlockedMessage(taskSummary) {
|
|
31695
|
-
return
|
|
31696
|
-
You cannot complete yet. The following tasks are still unresolved:
|
|
31690
|
+
return `You cannot complete yet. The following tasks are still unresolved:
|
|
31697
31691
|
|
|
31698
31692
|
${taskSummary}
|
|
31699
31693
|
|
|
31700
|
-
|
|
31701
|
-
|
|
31702
|
-
|
|
31703
|
-
- Or cancel if no longer needed: <task><action>update</action><id>task-X</id><status>cancelled</status></task>
|
|
31694
|
+
For each pending/in_progress task, either:
|
|
31695
|
+
- Complete it: call task tool with action="complete", id="task-X"
|
|
31696
|
+
- Cancel it: call task tool with action="update", id="task-X", status="cancelled"
|
|
31704
31697
|
|
|
31705
|
-
|
|
31706
|
-
|
|
31707
|
-
Use <task><action>list</action></task> to review current status.
|
|
31708
|
-
</task_completion_blocked>`;
|
|
31698
|
+
After all tasks are resolved, call attempt_completion again.`;
|
|
31709
31699
|
}
|
|
31710
31700
|
function createTaskTool(options = {}) {
|
|
31711
31701
|
const { taskManager, tracer, debug = false } = options;
|
|
@@ -31928,145 +31918,46 @@ var init_taskTool = __esm({
|
|
|
31928
31918
|
dependencies: external_exports.array(external_exports.string()).optional(),
|
|
31929
31919
|
after: external_exports.string().optional()
|
|
31930
31920
|
});
|
|
31931
|
-
taskSystemPrompt = `[Task Management
|
|
31932
|
-
|
|
31933
|
-
|
|
31934
|
-
|
|
31935
|
-
## When to
|
|
31936
|
-
|
|
31937
|
-
CREATE
|
|
31938
|
-
- "Fix bug A AND add feature B" \u2192
|
|
31939
|
-
- "Investigate auth, payments, AND notifications" \u2192
|
|
31940
|
-
- "Implement X, then add tests, then update docs" \u2192
|
|
31941
|
-
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
- "
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31951
|
-
|
|
31952
|
-
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
|
|
31960
|
-
|
|
31961
|
-
|
|
31962
|
-
-
|
|
31963
|
-
-
|
|
31964
|
-
-
|
|
31965
|
-
|
|
31966
|
-
**Good patterns**:
|
|
31967
|
-
- One task per distinct deliverable \u2713
|
|
31968
|
-
- One task per phase (implement, test, document) \u2713
|
|
31969
|
-
- One task per different type of work \u2713
|
|
31970
|
-
|
|
31971
|
-
MODIFY TASKS when (during execution):
|
|
31972
|
-
- You discover the problem is more complex than expected \u2192 Add new tasks
|
|
31973
|
-
- A single task covers too much scope \u2192 Split into smaller tasks
|
|
31974
|
-
- You find related work that needs attention \u2192 Add dependent tasks
|
|
31975
|
-
- A task becomes irrelevant based on findings \u2192 Cancel it
|
|
31976
|
-
- Task priorities change based on discoveries \u2192 Update priority
|
|
31977
|
-
- You learn new context \u2192 Update task description
|
|
31978
|
-
|
|
31979
|
-
## Task Workflow
|
|
31980
|
-
|
|
31981
|
-
**STEP 1 - Plan (at start):**
|
|
31982
|
-
Analyze the request and create tasks for each logical step:
|
|
31983
|
-
|
|
31984
|
-
<task>
|
|
31985
|
-
<action>create</action>
|
|
31986
|
-
<tasks>[
|
|
31987
|
-
{"title": "Search for authentication module", "priority": "high"},
|
|
31988
|
-
{"title": "Analyze login flow implementation", "dependencies": ["task-1"]},
|
|
31989
|
-
{"title": "Find session management code", "dependencies": ["task-1"]},
|
|
31990
|
-
{"title": "Summarize authentication architecture", "dependencies": ["task-2", "task-3"]}
|
|
31991
|
-
]</tasks>
|
|
31992
|
-
</task>
|
|
31993
|
-
|
|
31994
|
-
**STEP 2 - Execute (during work):**
|
|
31995
|
-
Update task status as you work:
|
|
31996
|
-
|
|
31997
|
-
<task>
|
|
31998
|
-
<action>update</action>
|
|
31999
|
-
<id>task-1</id>
|
|
32000
|
-
<status>in_progress</status>
|
|
32001
|
-
</task>
|
|
32002
|
-
|
|
32003
|
-
... do the work (search, extract, etc.) ...
|
|
32004
|
-
|
|
32005
|
-
<task>
|
|
32006
|
-
<action>complete</action>
|
|
32007
|
-
<id>task-1</id>
|
|
32008
|
-
</task>
|
|
32009
|
-
|
|
32010
|
-
**STEP 2b - Adapt (when you discover new work):**
|
|
32011
|
-
As you work, you may discover that:
|
|
32012
|
-
- A task is more complex than expected \u2192 Split it into subtasks
|
|
32013
|
-
- New areas need investigation \u2192 Add new tasks
|
|
32014
|
-
- Some tasks are no longer needed \u2192 Cancel them
|
|
32015
|
-
- Task order should change \u2192 Update dependencies
|
|
32016
|
-
|
|
32017
|
-
*Adding a new task when you discover more work:*
|
|
32018
|
-
<task>
|
|
32019
|
-
<action>create</action>
|
|
32020
|
-
<title>Investigate caching layer</title>
|
|
32021
|
-
<description>Found references to Redis caching in auth module</description>
|
|
32022
|
-
</task>
|
|
32023
|
-
|
|
32024
|
-
*Inserting a task after a specific task (to maintain logical order):*
|
|
32025
|
-
<task>
|
|
32026
|
-
<action>create</action>
|
|
32027
|
-
<title>Check rate limiting</title>
|
|
32028
|
-
<after>task-2</after>
|
|
32029
|
-
</task>
|
|
32030
|
-
|
|
32031
|
-
*Cancelling and splitting a complex task:*
|
|
32032
|
-
<task>
|
|
32033
|
-
<action>update</action>
|
|
32034
|
-
<id>task-3</id>
|
|
32035
|
-
<status>cancelled</status>
|
|
32036
|
-
</task>
|
|
32037
|
-
<task>
|
|
32038
|
-
<action>create</action>
|
|
32039
|
-
<tasks>[
|
|
32040
|
-
{"title": "Review JWT token generation", "priority": "high"},
|
|
32041
|
-
{"title": "Review token refresh logic"}
|
|
32042
|
-
]</tasks>
|
|
32043
|
-
</task>
|
|
32044
|
-
|
|
32045
|
-
**STEP 3 - Finish (before completion):**
|
|
32046
|
-
Before calling attempt_completion, ensure ALL tasks are either:
|
|
32047
|
-
- \`completed\` - you finished the work
|
|
32048
|
-
- \`cancelled\` - no longer needed
|
|
32049
|
-
|
|
32050
|
-
If you created tasks, you MUST resolve them all before completing.
|
|
32051
|
-
|
|
32052
|
-
## Key Rules
|
|
32053
|
-
|
|
32054
|
-
1. **Dependencies are enforced**: A task cannot start until its dependencies are completed
|
|
32055
|
-
2. **Circular dependencies are rejected**: task-1 \u2192 task-2 \u2192 task-1 is invalid
|
|
32056
|
-
3. **Completion is blocked**: attempt_completion will fail if tasks remain unresolved
|
|
32057
|
-
4. **List to review**: Use <task><action>list</action></task> to see current task status
|
|
32058
|
-
5. **Tasks are living documents**: Add, split, or cancel tasks as you learn more about the problem
|
|
31921
|
+
taskSystemPrompt = `[Task Management]
|
|
31922
|
+
|
|
31923
|
+
Use the task tool to track progress on complex requests with multiple distinct goals.
|
|
31924
|
+
|
|
31925
|
+
## When to Use Tasks
|
|
31926
|
+
|
|
31927
|
+
CREATE tasks when the request has **multiple separate deliverables**:
|
|
31928
|
+
- "Fix bug A AND add feature B" \u2192 two tasks
|
|
31929
|
+
- "Investigate auth, payments, AND notifications" \u2192 three tasks
|
|
31930
|
+
- "Implement X, then add tests, then update docs" \u2192 three sequential tasks
|
|
31931
|
+
|
|
31932
|
+
SKIP tasks for single-goal requests, even complex ones:
|
|
31933
|
+
- "How does ranking work?" \u2014 just investigate and answer
|
|
31934
|
+
- "Explain the authentication flow" \u2014 just trace and explain
|
|
31935
|
+
Multiple internal steps (search, read, analyze) for one goal \u2260 multiple tasks.
|
|
31936
|
+
|
|
31937
|
+
## Granularity
|
|
31938
|
+
|
|
31939
|
+
Tasks = logical units of work, not files or steps.
|
|
31940
|
+
- "Fix 8 similar test files" \u2192 ONE task (same fix repeated)
|
|
31941
|
+
- "Update API + tests + docs" \u2192 THREE tasks (different work types)
|
|
31942
|
+
- Max 3\u20134 tasks. More means you're too granular.
|
|
31943
|
+
|
|
31944
|
+
## Workflow
|
|
31945
|
+
|
|
31946
|
+
1. **Plan**: Call task tool with action="create" and a tasks array up front
|
|
31947
|
+
2. **Execute**: Update status to "in_progress" / "completed" as you work. Add, split, or cancel tasks as you learn more.
|
|
31948
|
+
3. **Finish**: All tasks must be "completed" or "cancelled" before calling attempt_completion.
|
|
31949
|
+
|
|
31950
|
+
## Rules
|
|
31951
|
+
|
|
31952
|
+
- Dependencies are enforced: a task cannot start until its dependencies are completed
|
|
31953
|
+
- Circular dependencies are rejected
|
|
31954
|
+
- attempt_completion is blocked while tasks remain unresolved
|
|
32059
31955
|
`;
|
|
32060
|
-
taskGuidancePrompt =
|
|
32061
|
-
Does this request have MULTIPLE DISTINCT GOALS?
|
|
31956
|
+
taskGuidancePrompt = `Does this request have MULTIPLE DISTINCT GOALS?
|
|
32062
31957
|
- "Do A AND B AND C" (multiple goals) \u2192 Create tasks for each goal
|
|
32063
31958
|
- "Investigate/explain/find X" (single goal) \u2192 Skip tasks, just answer directly
|
|
32064
|
-
|
|
32065
|
-
|
|
32066
|
-
Only create tasks when there are separate deliverables the user is asking for.
|
|
32067
|
-
|
|
32068
|
-
If creating tasks, use the task tool with action="create" first.
|
|
32069
|
-
</task_guidance>`;
|
|
31959
|
+
Multiple internal steps for ONE goal = NO tasks needed.
|
|
31960
|
+
If creating tasks, use the task tool with action="create" first.`;
|
|
32070
31961
|
}
|
|
32071
31962
|
});
|
|
32072
31963
|
|
|
@@ -70835,9 +70726,10 @@ If the solution is clear, you can jump to implementation right away. If not, ask
|
|
|
70835
70726
|
- After every significant change, verify the project still builds and passes linting. Do not wait until the end to discover breakage.
|
|
70836
70727
|
|
|
70837
70728
|
# After Implementation
|
|
70838
|
-
-
|
|
70839
|
-
- Run lint and typecheck commands if known for the project.
|
|
70840
|
-
-
|
|
70729
|
+
- Verify the project builds successfully. If it doesn't, fix the build before moving on.
|
|
70730
|
+
- Run lint and typecheck commands if known for the project. Fix any new warnings or errors you introduced.
|
|
70731
|
+
- Add tests for any new or changed functionality. Tests must cover the main path and important edge cases.
|
|
70732
|
+
- Run the project's full test suite. If any tests fail (including pre-existing ones you may have broken), fix them before finishing.
|
|
70841
70733
|
- 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.
|
|
70842
70734
|
|
|
70843
70735
|
# GitHub Integration
|
|
@@ -80050,6 +79942,19 @@ function isContextLimitError(error) {
|
|
|
80050
79942
|
}
|
|
80051
79943
|
return false;
|
|
80052
79944
|
}
|
|
79945
|
+
function messageContainsCompletion(msg) {
|
|
79946
|
+
if (Array.isArray(msg.toolInvocations)) {
|
|
79947
|
+
if (msg.toolInvocations.some((t) => t.toolName === "attempt_completion")) return true;
|
|
79948
|
+
}
|
|
79949
|
+
if (Array.isArray(msg.tool_calls)) {
|
|
79950
|
+
if (msg.tool_calls.some((t) => t.function?.name === "attempt_completion")) return true;
|
|
79951
|
+
}
|
|
79952
|
+
if (Array.isArray(msg.content)) {
|
|
79953
|
+
if (msg.content.some((p) => p.type === "tool-call" && p.toolName === "attempt_completion")) return true;
|
|
79954
|
+
}
|
|
79955
|
+
const text = typeof msg.content === "string" ? msg.content : "";
|
|
79956
|
+
return text.includes("attempt_completion");
|
|
79957
|
+
}
|
|
80053
79958
|
function identifyMessageSegments(messages) {
|
|
80054
79959
|
const segments = [];
|
|
80055
79960
|
let currentSegment = null;
|
|
@@ -80058,27 +79963,23 @@ function identifyMessageSegments(messages) {
|
|
|
80058
79963
|
if (msg.role === "system") {
|
|
80059
79964
|
continue;
|
|
80060
79965
|
}
|
|
79966
|
+
if (msg.role === "tool" && currentSegment) {
|
|
79967
|
+
currentSegment.monologueIndices.push(i);
|
|
79968
|
+
continue;
|
|
79969
|
+
}
|
|
80061
79970
|
if (msg.role === "user") {
|
|
80062
|
-
|
|
80063
|
-
const isToolResult = content.includes("<tool_result>");
|
|
80064
|
-
if (isToolResult && currentSegment) {
|
|
80065
|
-
currentSegment.finalIndex = i;
|
|
79971
|
+
if (currentSegment) {
|
|
80066
79972
|
segments.push(currentSegment);
|
|
80067
|
-
currentSegment = null;
|
|
80068
|
-
} else {
|
|
80069
|
-
if (currentSegment) {
|
|
80070
|
-
segments.push(currentSegment);
|
|
80071
|
-
}
|
|
80072
|
-
currentSegment = {
|
|
80073
|
-
userIndex: i,
|
|
80074
|
-
monologueIndices: [],
|
|
80075
|
-
finalIndex: null
|
|
80076
|
-
};
|
|
80077
79973
|
}
|
|
79974
|
+
currentSegment = {
|
|
79975
|
+
userIndex: i,
|
|
79976
|
+
monologueIndices: [],
|
|
79977
|
+
finalIndex: null
|
|
79978
|
+
};
|
|
80078
79979
|
}
|
|
80079
79980
|
if (msg.role === "assistant" && currentSegment) {
|
|
80080
|
-
const
|
|
80081
|
-
if (
|
|
79981
|
+
const hasCompletion = messageContainsCompletion(msg);
|
|
79982
|
+
if (hasCompletion) {
|
|
80082
79983
|
currentSegment.monologueIndices.push(i);
|
|
80083
79984
|
currentSegment.finalIndex = i;
|
|
80084
79985
|
segments.push(currentSegment);
|
|
@@ -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
|