@polka-codes/core 0.9.9 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.ts +1 -1
- package/dist/index.js +30 -9
- package/package.json +1 -1
|
@@ -1737,7 +1737,7 @@ export { ToolUse }
|
|
|
1737
1737
|
export { ToolUse as ToolUse_alias_1 }
|
|
1738
1738
|
export { ToolUse as ToolUse_alias_2 }
|
|
1739
1739
|
|
|
1740
|
-
declare const toolUsePrompt: (tools: FullToolInfoV2[], toolNamePrefix: string) => string;
|
|
1740
|
+
declare const toolUsePrompt: (useNativeTool: boolean, tools: FullToolInfoV2[], toolNamePrefix: string) => string;
|
|
1741
1741
|
export { toolUsePrompt }
|
|
1742
1742
|
export { toolUsePrompt as toolUsePrompt_alias_1 }
|
|
1743
1743
|
export { toolUsePrompt as toolUsePrompt_alias_2 }
|
package/dist/index.js
CHANGED
|
@@ -1488,7 +1488,17 @@ var toolInfoExamplesPrompt = (tool, example, toolNamePrefix, parameterPrefix) =>
|
|
|
1488
1488
|
${Object.entries(example.input).map(([name, value]) => renderParameterValue(name, value, parameterPrefix)).join("\n")}
|
|
1489
1489
|
</${toolNamePrefix}${tool.name}>
|
|
1490
1490
|
`;
|
|
1491
|
-
var toolUsePrompt = (tools, toolNamePrefix) => {
|
|
1491
|
+
var toolUsePrompt = (useNativeTool, tools, toolNamePrefix) => {
|
|
1492
|
+
if (useNativeTool) {
|
|
1493
|
+
return `
|
|
1494
|
+
====
|
|
1495
|
+
|
|
1496
|
+
TOOL USE
|
|
1497
|
+
|
|
1498
|
+
- You MUST use a tool.
|
|
1499
|
+
- Batch tool use when feasible; avoid redundant calls.
|
|
1500
|
+
`;
|
|
1501
|
+
}
|
|
1492
1502
|
if (tools.length === 0) {
|
|
1493
1503
|
return "";
|
|
1494
1504
|
}
|
|
@@ -1856,7 +1866,8 @@ ${instance.prompt}`;
|
|
|
1856
1866
|
if (requestTimeoutSeconds > 0 && requestAbortController) {
|
|
1857
1867
|
timeout = setTimeout(() => {
|
|
1858
1868
|
console.debug(
|
|
1859
|
-
`
|
|
1869
|
+
`
|
|
1870
|
+
Request timeout after ${requestTimeoutSeconds} seconds. Canceling current request attempt ${i + 1}/${retryCount}.`
|
|
1860
1871
|
);
|
|
1861
1872
|
requestAbortController?.abort();
|
|
1862
1873
|
}, requestTimeoutSeconds * 1e3);
|
|
@@ -1918,7 +1929,15 @@ ${instance.prompt}`;
|
|
|
1918
1929
|
}
|
|
1919
1930
|
}
|
|
1920
1931
|
if (this.config.toolFormat === "native") {
|
|
1921
|
-
if (respMessages.some((m) =>
|
|
1932
|
+
if (respMessages.some((m) => {
|
|
1933
|
+
if (m.role === "tool") {
|
|
1934
|
+
return true;
|
|
1935
|
+
}
|
|
1936
|
+
if (typeof m.content === "string") {
|
|
1937
|
+
return true;
|
|
1938
|
+
}
|
|
1939
|
+
return m.content.some((part) => part.type === "tool-call" || part.type === "tool-result" || part.type === "text");
|
|
1940
|
+
})) {
|
|
1922
1941
|
break;
|
|
1923
1942
|
}
|
|
1924
1943
|
} else {
|
|
@@ -1930,7 +1949,8 @@ ${instance.prompt}`;
|
|
|
1930
1949
|
break;
|
|
1931
1950
|
}
|
|
1932
1951
|
if (i < retryCount - 1) {
|
|
1933
|
-
console.debug(`
|
|
1952
|
+
console.debug(`
|
|
1953
|
+
Retrying request ${i + 2} of ${retryCount}`);
|
|
1934
1954
|
}
|
|
1935
1955
|
}
|
|
1936
1956
|
if (respMessages.length === 0) {
|
|
@@ -2167,7 +2187,7 @@ You are the **Analyzer** agent, responsible for:
|
|
|
2167
2187
|
5. **Documentation Assessment**: Review documentation quality and completeness.
|
|
2168
2188
|
6. **Non-Modification**: Never modify code or files - focus solely on analysis.
|
|
2169
2189
|
|
|
2170
|
-
${useNativeTool
|
|
2190
|
+
${toolUsePrompt(useNativeTool, tools, toolNamePrefix)}
|
|
2171
2191
|
${capabilities(toolNamePrefix)}
|
|
2172
2192
|
${systemInformation(info)}
|
|
2173
2193
|
${customInstructions(instructions)}
|
|
@@ -2249,6 +2269,7 @@ You are the **Architect** agent, responsible for:
|
|
|
2249
2269
|
4. **Accuracy** - Ensure conclusions are verifiable.
|
|
2250
2270
|
5. **Clarity** - Present information in a structured format.
|
|
2251
2271
|
6. **Minimal Queries** - Ask questions only when truly needed.
|
|
2272
|
+
7. **Completion** - Only use the \`attemptCompletion\` tool if the user's request has been fully satisfied and no coding tasks need to be delegated to the Coder agent.
|
|
2252
2273
|
|
|
2253
2274
|
## Steps
|
|
2254
2275
|
1. **Analyze Task** - Capture goals, constraints, and success criteria.
|
|
@@ -2262,9 +2283,9 @@ You are the **Architect** agent, responsible for:
|
|
|
2262
2283
|
6. **Handover/Delegate**
|
|
2263
2284
|
- If the plan consists of a single self-contained step, hand it over as one task.
|
|
2264
2285
|
- If multiple steps are required, break them into numbered tasks to delegate to the **Coder** agent.
|
|
2265
|
-
-
|
|
2286
|
+
- When handing over or delegating, you MUST provide the full implementation plan. Include all necessary context, file references, and clarifications for successful execution.
|
|
2266
2287
|
|
|
2267
|
-
${useNativeTool
|
|
2288
|
+
${toolUsePrompt(useNativeTool, tools, toolNamePrefix)}
|
|
2268
2289
|
${capabilities(toolNamePrefix)}
|
|
2269
2290
|
${systemInformation(info)}
|
|
2270
2291
|
${customInstructions(instructions)}
|
|
@@ -2391,7 +2412,7 @@ RETRY GUIDELINES
|
|
|
2391
2412
|
- Report any partial improvements`;
|
|
2392
2413
|
var fullSystemPrompt3 = (info, tools, toolNamePrefix, instructions, scripts, _interactive, useNativeTool) => `
|
|
2393
2414
|
${basePrompt}
|
|
2394
|
-
${useNativeTool
|
|
2415
|
+
${toolUsePrompt(useNativeTool, tools, toolNamePrefix)}
|
|
2395
2416
|
${codeFixingStrategies}
|
|
2396
2417
|
${retryGuidelines}
|
|
2397
2418
|
${capabilities(toolNamePrefix)}
|
|
@@ -2598,7 +2619,7 @@ You solve the user's task by working in small, verifiable steps.
|
|
|
2598
2619
|
`;
|
|
2599
2620
|
var fullSystemPrompt4 = (info, tools, toolNamePrefix, instructions, scripts, useNativeTool) => `
|
|
2600
2621
|
${basePrompt2}
|
|
2601
|
-
${useNativeTool
|
|
2622
|
+
${toolUsePrompt(useNativeTool, tools, toolNamePrefix)}
|
|
2602
2623
|
${editingFilesPrompt(toolNamePrefix)}
|
|
2603
2624
|
${capabilities(toolNamePrefix)}
|
|
2604
2625
|
${rules(toolNamePrefix)}
|