@polka-codes/core 0.7.9 → 0.7.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 +28 -7
- package/dist/index.d.ts +8 -1
- package/dist/index.js +25 -23
- package/package.json +1 -1
|
@@ -51,7 +51,10 @@ declare type AgentNameType = (typeof allAgents)[number]['name'];
|
|
|
51
51
|
export { AgentNameType }
|
|
52
52
|
export { AgentNameType as AgentNameType_alias_1 }
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
declare const agentsPrompt: (agents: Readonly<AgentInfo[]>, name: string) => string;
|
|
55
|
+
export { agentsPrompt }
|
|
56
|
+
export { agentsPrompt as agentsPrompt_alias_1 }
|
|
57
|
+
export { agentsPrompt as agentsPrompt_alias_2 }
|
|
55
58
|
|
|
56
59
|
declare abstract class AiServiceBase {
|
|
57
60
|
readonly usageMeter: UsageMeter;
|
|
@@ -300,7 +303,10 @@ export declare const basePrompt = "You are a highly skilled software engineer sp
|
|
|
300
303
|
|
|
301
304
|
export declare const basePrompt_alias_1 = "You are a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.";
|
|
302
305
|
|
|
303
|
-
|
|
306
|
+
declare const capabilities: (toolNamePrefix: string) => string;
|
|
307
|
+
export { capabilities }
|
|
308
|
+
export { capabilities as capabilities_alias_1 }
|
|
309
|
+
export { capabilities as capabilities_alias_2 }
|
|
304
310
|
|
|
305
311
|
/**
|
|
306
312
|
* CodeFixer agent for fixing code issues like type errors and failing tests.
|
|
@@ -380,12 +386,18 @@ declare const createService: (provider: AiServiceProvider, options: AiServiceOpt
|
|
|
380
386
|
export { createService }
|
|
381
387
|
export { createService as createService_alias_1 }
|
|
382
388
|
|
|
383
|
-
|
|
389
|
+
declare const customInstructions: (customInstructions: string[]) => string;
|
|
390
|
+
export { customInstructions }
|
|
391
|
+
export { customInstructions as customInstructions_alias_1 }
|
|
392
|
+
export { customInstructions as customInstructions_alias_2 }
|
|
384
393
|
|
|
385
|
-
|
|
394
|
+
declare const customScripts: (commands: Record<string, string | {
|
|
386
395
|
command: string;
|
|
387
396
|
description: string;
|
|
388
397
|
}>) => string;
|
|
398
|
+
export { customScripts }
|
|
399
|
+
export { customScripts as customScripts_alias_1 }
|
|
400
|
+
export { customScripts as customScripts_alias_2 }
|
|
389
401
|
|
|
390
402
|
declare const deepSeekDefaultModelId: DeepSeekModelId;
|
|
391
403
|
export { deepSeekDefaultModelId }
|
|
@@ -1744,12 +1756,15 @@ declare const replaceInFile_2: (fileContent: string, diff: string) => Promise<st
|
|
|
1744
1756
|
export { replaceInFile_2 as replaceInFile_alias_3 }
|
|
1745
1757
|
export { replaceInFile_2 as replaceInFile_alias_4 }
|
|
1746
1758
|
|
|
1747
|
-
|
|
1759
|
+
declare const responsePrompts: {
|
|
1748
1760
|
readonly errorInvokeTool: (tool: string, error: unknown) => string;
|
|
1749
1761
|
readonly requireUseTool: "Error: You MUST use a tool before proceeding using XCM tags. e.g. <tool_tool_name>tool_name</tool_tool_name>";
|
|
1750
1762
|
readonly toolResults: (tool: string, result: string) => string;
|
|
1751
1763
|
readonly commandResult: (command: string, exitCode: number, stdout: string, stderr: string) => string;
|
|
1752
1764
|
};
|
|
1765
|
+
export { responsePrompts }
|
|
1766
|
+
export { responsePrompts as responsePrompts_alias_1 }
|
|
1767
|
+
export { responsePrompts as responsePrompts_alias_2 }
|
|
1753
1768
|
|
|
1754
1769
|
export declare const retryGuidelines = "\n====\n\nRETRY GUIDELINES\n\n1. Before Retrying\n - Analyze previous attempt's failure\n - Consider alternative approaches\n - Check if similar issues were fixed\n - Verify no new issues were introduced\n\n2. When to Retry\n - Error message changed but issue persists\n - New information available about the root cause\n - Different fixing strategy available\n - Previous attempt partially successful\n\n3. When to Stop\n - Maximum retry limit reached\n - Same error occurs repeatedly\n - Fix would require major refactoring\n - Issue requires human intervention\n\n4. After Maximum Retries\n - Document attempted solutions\n - Explain why the issue remains\n - Suggest manual intervention steps\n - Report any partial improvements";
|
|
1755
1770
|
|
|
@@ -1773,9 +1788,12 @@ export { SharedAgentOptions }
|
|
|
1773
1788
|
export { SharedAgentOptions as SharedAgentOptions_alias_1 }
|
|
1774
1789
|
export { SharedAgentOptions as SharedAgentOptions_alias_2 }
|
|
1775
1790
|
|
|
1776
|
-
|
|
1791
|
+
declare const systemInformation: (info: {
|
|
1777
1792
|
os: string;
|
|
1778
1793
|
}) => string;
|
|
1794
|
+
export { systemInformation }
|
|
1795
|
+
export { systemInformation as systemInformation_alias_1 }
|
|
1796
|
+
export { systemInformation as systemInformation_alias_2 }
|
|
1779
1797
|
|
|
1780
1798
|
/**
|
|
1781
1799
|
* Union type of all possible task events
|
|
@@ -2422,7 +2440,10 @@ export declare interface ToolUse {
|
|
|
2422
2440
|
params: Record<string, string>;
|
|
2423
2441
|
}
|
|
2424
2442
|
|
|
2425
|
-
|
|
2443
|
+
declare const toolUsePrompt: (tools: ToolInfo[], toolNamePrefix: string) => string;
|
|
2444
|
+
export { toolUsePrompt }
|
|
2445
|
+
export { toolUsePrompt as toolUsePrompt_alias_1 }
|
|
2446
|
+
export { toolUsePrompt as toolUsePrompt_alias_2 }
|
|
2426
2447
|
|
|
2427
2448
|
declare class UsageMeter {
|
|
2428
2449
|
#private;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export { AiServiceProvider } from './_tsup-dts-rollup.js';
|
|
|
2
2
|
export { defaultModels } from './_tsup-dts-rollup.js';
|
|
3
3
|
export { createService } from './_tsup-dts-rollup.js';
|
|
4
4
|
export { UsageMeter } from './_tsup-dts-rollup.js';
|
|
5
|
+
export { AiServiceBase } from './_tsup-dts-rollup.js';
|
|
5
6
|
export { MessageParam } from './_tsup-dts-rollup.js';
|
|
6
7
|
export { AiServiceOptions } from './_tsup-dts-rollup.js';
|
|
7
|
-
export { AiServiceBase } from './_tsup-dts-rollup.js';
|
|
8
8
|
export { ModelInfo } from './_tsup-dts-rollup.js';
|
|
9
9
|
export { ApiUsage } from './_tsup-dts-rollup.js';
|
|
10
10
|
export { ApiStream } from './_tsup-dts-rollup.js';
|
|
@@ -43,6 +43,13 @@ export { CodeFixerAgent } from './_tsup-dts-rollup.js';
|
|
|
43
43
|
export { codeFixerAgentInfo } from './_tsup-dts-rollup.js';
|
|
44
44
|
export { MultiAgentConfig } from './_tsup-dts-rollup.js';
|
|
45
45
|
export { MultiAgent } from './_tsup-dts-rollup.js';
|
|
46
|
+
export { toolUsePrompt } from './_tsup-dts-rollup.js';
|
|
47
|
+
export { agentsPrompt } from './_tsup-dts-rollup.js';
|
|
48
|
+
export { capabilities } from './_tsup-dts-rollup.js';
|
|
49
|
+
export { systemInformation } from './_tsup-dts-rollup.js';
|
|
50
|
+
export { customInstructions } from './_tsup-dts-rollup.js';
|
|
51
|
+
export { customScripts } from './_tsup-dts-rollup.js';
|
|
52
|
+
export { responsePrompts } from './_tsup-dts-rollup.js';
|
|
46
53
|
export { allTools } from './_tsup-dts-rollup.js';
|
|
47
54
|
export { FilesystemProvider } from './_tsup-dts-rollup.js';
|
|
48
55
|
export { CommandProvider } from './_tsup-dts-rollup.js';
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,6 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/AiService/AnthropicService.ts
|
|
8
|
-
import { Anthropic } from "@anthropic-ai/sdk";
|
|
9
|
-
|
|
10
7
|
// src/AiService/AiServiceBase.ts
|
|
11
8
|
var AiServiceBase = class {
|
|
12
9
|
usageMeter;
|
|
@@ -62,6 +59,9 @@ var AiServiceBase = class {
|
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
61
|
|
|
62
|
+
// src/AiService/AnthropicService.ts
|
|
63
|
+
import { Anthropic } from "@anthropic-ai/sdk";
|
|
64
|
+
|
|
65
65
|
// src/AiService/ModelInfo.ts
|
|
66
66
|
var anthropicDefaultModelId = "claude-3-7-sonnet-20250219";
|
|
67
67
|
var anthropicModels = {
|
|
@@ -2063,26 +2063,20 @@ ${tools.map((tool) => {
|
|
|
2063
2063
|
}).join("")}
|
|
2064
2064
|
# Tool Use Guidelines
|
|
2065
2065
|
|
|
2066
|
-
1. **
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
3. **
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
8. **Error Handling**: If a tool returns an error, analyze the error message and adjust your approach accordingly. Consider alternative tools or strategies to achieve the desired outcome.
|
|
2081
|
-
|
|
2082
|
-
By adhering to these guidelines:
|
|
2083
|
-
- You maintain clarity without accidentally re-invoking tools.
|
|
2084
|
-
- You confirm each step\u2019s results before proceeding.
|
|
2085
|
-
- You provide only the necessary information in user-facing replies to prevent re-interpretation as new commands.`;
|
|
2066
|
+
1. **Outline Your Thought Process**
|
|
2067
|
+
- Before using a tool, wrap your reasoning inside \`<thinking>\` tags. Be concise\u2014just enough to clarify your plan and the rationale behind selecting a specific tool.
|
|
2068
|
+
|
|
2069
|
+
2. **Wait for Feedback**
|
|
2070
|
+
- After using a tool, wait for the user's response indicating success/failure or any output logs. Do not assume the result of a tool without explicit confirmation.
|
|
2071
|
+
|
|
2072
|
+
3. **Error Handling**
|
|
2073
|
+
- If a tool fails or produces an unexpected result, analyze the error, decide on an alternative approach or tool, and proceed carefully.
|
|
2074
|
+
|
|
2075
|
+
4. **Avoid Repetition**
|
|
2076
|
+
- Do not quote or repeat previous commands or prompts verbatim. Move the conversation forward by focusing on the latest required action.
|
|
2077
|
+
|
|
2078
|
+
5. **No Unnecessary Re-invocations**
|
|
2079
|
+
- Only invoke the same tool again if a genuine need arises (e.g., different parameters or updated context).`;
|
|
2086
2080
|
};
|
|
2087
2081
|
var agentsPrompt = (agents, name) => `
|
|
2088
2082
|
====
|
|
@@ -3374,6 +3368,7 @@ var generateProjectConfig = makeAgentTool(generateProjectConfig_default);
|
|
|
3374
3368
|
var createNewProject = makeAgentTool(createNewProject_default);
|
|
3375
3369
|
export {
|
|
3376
3370
|
AgentBase,
|
|
3371
|
+
AiServiceBase,
|
|
3377
3372
|
AiServiceProvider,
|
|
3378
3373
|
AnalyzerAgent,
|
|
3379
3374
|
ArchitectAgent,
|
|
@@ -3385,6 +3380,7 @@ export {
|
|
|
3385
3380
|
TaskEventKind,
|
|
3386
3381
|
ToolResponseType,
|
|
3387
3382
|
UsageMeter,
|
|
3383
|
+
agentsPrompt,
|
|
3388
3384
|
allAgents,
|
|
3389
3385
|
allTools_exports as allTools,
|
|
3390
3386
|
analyzerAgentInfo,
|
|
@@ -3393,10 +3389,13 @@ export {
|
|
|
3393
3389
|
architectAgentInfo,
|
|
3394
3390
|
askFollowupQuestion_default as askFollowupQuestion,
|
|
3395
3391
|
attemptCompletion_default as attemptCompletion,
|
|
3392
|
+
capabilities,
|
|
3396
3393
|
codeFixerAgentInfo,
|
|
3397
3394
|
coderAgentInfo,
|
|
3398
3395
|
createNewProject,
|
|
3399
3396
|
createService,
|
|
3397
|
+
customInstructions,
|
|
3398
|
+
customScripts,
|
|
3400
3399
|
deepSeekDefaultModelId,
|
|
3401
3400
|
deepSeekModels,
|
|
3402
3401
|
defaultModels,
|
|
@@ -3419,6 +3418,9 @@ export {
|
|
|
3419
3418
|
removeFile_default as removeFile,
|
|
3420
3419
|
renameFile_default as renameFile,
|
|
3421
3420
|
replaceInFile_default as replaceInFile,
|
|
3421
|
+
responsePrompts,
|
|
3422
3422
|
searchFiles_default as searchFiles,
|
|
3423
|
+
systemInformation,
|
|
3424
|
+
toolUsePrompt,
|
|
3423
3425
|
writeToFile_default as writeToFile
|
|
3424
3426
|
};
|