@polka-codes/core 0.7.10 → 0.7.12

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.
@@ -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
- export declare const agentsPrompt: (agents: Readonly<AgentInfo[]>, name: string) => string;
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
- export declare const capabilities: (toolNamePrefix: string) => string;
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
- export declare const customInstructions: (customInstructions: string[]) => string;
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
- export declare const customScripts: (commands: Record<string, string | {
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 }
@@ -1410,6 +1422,7 @@ export { getAvailableTools as getAvailableTools_alias_1 }
1410
1422
  declare const getBoolean: <T extends string>(args: Partial<Record<T, string>>, name: T, defaultValue?: boolean) => boolean;
1411
1423
  export { getBoolean }
1412
1424
  export { getBoolean as getBoolean_alias_1 }
1425
+ export { getBoolean as getBoolean_alias_2 }
1413
1426
 
1414
1427
  declare type GetInput<T> = T extends AiToolDefinition<infer Input, any> ? Input : never;
1415
1428
  export { GetInput }
@@ -1419,6 +1432,7 @@ export { GetInput as GetInput_alias_2 }
1419
1432
  declare const getInt: <T extends string>(args: Partial<Record<T, string>>, name: T, defaultValue?: number) => number;
1420
1433
  export { getInt }
1421
1434
  export { getInt as getInt_alias_1 }
1435
+ export { getInt as getInt_alias_2 }
1422
1436
 
1423
1437
  declare type GetOutput<T> = T extends AiToolDefinition<any, infer Output> ? Output : never;
1424
1438
  export { GetOutput }
@@ -1428,10 +1442,12 @@ export { GetOutput as GetOutput_alias_2 }
1428
1442
  declare const getString: <T extends string>(args: Partial<Partial<Record<T, string>>>, name: T, defaultValue?: string) => string;
1429
1443
  export { getString }
1430
1444
  export { getString as getString_alias_1 }
1445
+ export { getString as getString_alias_2 }
1431
1446
 
1432
1447
  declare const getStringArray: <T extends string>(args: Partial<Record<T, string>>, name: T, defaultValue?: string[]) => string[];
1433
1448
  export { getStringArray }
1434
1449
  export { getStringArray as getStringArray_alias_1 }
1450
+ export { getStringArray as getStringArray_alias_2 }
1435
1451
 
1436
1452
  export declare const handler: ToolHandler<typeof toolInfo, InteractionProvider>;
1437
1453
 
@@ -1741,15 +1757,19 @@ export { PermissionLevel }
1741
1757
  export { PermissionLevel as PermissionLevel_alias_1 }
1742
1758
 
1743
1759
  declare const replaceInFile_2: (fileContent: string, diff: string) => Promise<string>;
1760
+ export { replaceInFile_2 as replaceInFileHelper }
1744
1761
  export { replaceInFile_2 as replaceInFile_alias_3 }
1745
1762
  export { replaceInFile_2 as replaceInFile_alias_4 }
1746
1763
 
1747
- export declare const responsePrompts: {
1764
+ declare const responsePrompts: {
1748
1765
  readonly errorInvokeTool: (tool: string, error: unknown) => string;
1749
1766
  readonly requireUseTool: "Error: You MUST use a tool before proceeding using XCM tags. e.g. <tool_tool_name>tool_name</tool_tool_name>";
1750
1767
  readonly toolResults: (tool: string, result: string) => string;
1751
1768
  readonly commandResult: (command: string, exitCode: number, stdout: string, stderr: string) => string;
1752
1769
  };
1770
+ export { responsePrompts }
1771
+ export { responsePrompts as responsePrompts_alias_1 }
1772
+ export { responsePrompts as responsePrompts_alias_2 }
1753
1773
 
1754
1774
  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
1775
 
@@ -1773,9 +1793,12 @@ export { SharedAgentOptions }
1773
1793
  export { SharedAgentOptions as SharedAgentOptions_alias_1 }
1774
1794
  export { SharedAgentOptions as SharedAgentOptions_alias_2 }
1775
1795
 
1776
- export declare const systemInformation: (info: {
1796
+ declare const systemInformation: (info: {
1777
1797
  os: string;
1778
1798
  }) => string;
1799
+ export { systemInformation }
1800
+ export { systemInformation as systemInformation_alias_1 }
1801
+ export { systemInformation as systemInformation_alias_2 }
1779
1802
 
1780
1803
  /**
1781
1804
  * Union type of all possible task events
@@ -2422,7 +2445,10 @@ export declare interface ToolUse {
2422
2445
  params: Record<string, string>;
2423
2446
  }
2424
2447
 
2425
- export declare const toolUsePrompt: (tools: ToolInfo[], toolNamePrefix: string) => string;
2448
+ declare const toolUsePrompt: (tools: ToolInfo[], toolNamePrefix: string) => string;
2449
+ export { toolUsePrompt }
2450
+ export { toolUsePrompt as toolUsePrompt_alias_1 }
2451
+ export { toolUsePrompt as toolUsePrompt_alias_2 }
2426
2452
 
2427
2453
  declare class UsageMeter {
2428
2454
  #private;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { replaceInFileHelper } from './_tsup-dts-rollup.js';
1
2
  export { AiServiceProvider } from './_tsup-dts-rollup.js';
2
3
  export { defaultModels } from './_tsup-dts-rollup.js';
3
4
  export { createService } from './_tsup-dts-rollup.js';
@@ -43,6 +44,13 @@ export { CodeFixerAgent } from './_tsup-dts-rollup.js';
43
44
  export { codeFixerAgentInfo } from './_tsup-dts-rollup.js';
44
45
  export { MultiAgentConfig } from './_tsup-dts-rollup.js';
45
46
  export { MultiAgent } from './_tsup-dts-rollup.js';
47
+ export { toolUsePrompt } from './_tsup-dts-rollup.js';
48
+ export { agentsPrompt } from './_tsup-dts-rollup.js';
49
+ export { capabilities } from './_tsup-dts-rollup.js';
50
+ export { systemInformation } from './_tsup-dts-rollup.js';
51
+ export { customInstructions } from './_tsup-dts-rollup.js';
52
+ export { customScripts } from './_tsup-dts-rollup.js';
53
+ export { responsePrompts } from './_tsup-dts-rollup.js';
46
54
  export { allTools } from './_tsup-dts-rollup.js';
47
55
  export { FilesystemProvider } from './_tsup-dts-rollup.js';
48
56
  export { CommandProvider } from './_tsup-dts-rollup.js';
@@ -97,3 +105,7 @@ export { ToolResponseDelegate } from './_tsup-dts-rollup.js';
97
105
  export { ToolResponse } from './_tsup-dts-rollup.js';
98
106
  export { ToolHandler } from './_tsup-dts-rollup.js';
99
107
  export { getAvailableTools_alias_1 as getAvailableTools } from './_tsup-dts-rollup.js';
108
+ export { getString } from './_tsup-dts-rollup.js';
109
+ export { getStringArray } from './_tsup-dts-rollup.js';
110
+ export { getBoolean } from './_tsup-dts-rollup.js';
111
+ export { getInt } from './_tsup-dts-rollup.js';
package/dist/index.js CHANGED
@@ -2063,26 +2063,20 @@ ${tools.map((tool) => {
2063
2063
  }).join("")}
2064
2064
  # Tool Use Guidelines
2065
2065
 
2066
- 1. **Thinking**: Use \`<thinking>\` XCM tag to clearly outline your thought process *before* using any tools. This includes:
2067
- * Assessing the current situation and available information.
2068
- * Defining specific goals and a plan to achieve them.
2069
- * Justifying the selection of a particular tool.
2070
- * Explaining how you intend to use the tool and what you expect to achieve.
2071
- 2. **Tool Selection**: Choose one tool at a time per message based on the task and its description. Do not assume a tool\u2019s outcome without explicit confirmation.
2072
- 3. **Formatting**: Formulate tool use only in the specified XML format for each tool.
2073
- 4. **User Response**: Wait for the user\u2019s response after each tool use. Do not proceed until you have their confirmation. The user\u2019s response may include:
2074
- * Tool success or failure details
2075
- * Linter errors
2076
- * Terminal output or other relevant feedback
2077
- 5. **Conciseness**: Never repeat or quote the entire tool command in your final user-facing message. Summarize outcomes clearly and avoid echoing commands verbatim.
2078
- 6. **Brevity**: Respond concisely and move the conversation forward. Do not re-issue the same command or re-trigger tool use without necessity.
2079
- 7. **Iteration**: Follow these steps iteratively, confirming success and addressing issues as you go.
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
  ====
@@ -3386,6 +3380,7 @@ export {
3386
3380
  TaskEventKind,
3387
3381
  ToolResponseType,
3388
3382
  UsageMeter,
3383
+ agentsPrompt,
3389
3384
  allAgents,
3390
3385
  allTools_exports as allTools,
3391
3386
  analyzerAgentInfo,
@@ -3394,10 +3389,13 @@ export {
3394
3389
  architectAgentInfo,
3395
3390
  askFollowupQuestion_default as askFollowupQuestion,
3396
3391
  attemptCompletion_default as attemptCompletion,
3392
+ capabilities,
3397
3393
  codeFixerAgentInfo,
3398
3394
  coderAgentInfo,
3399
3395
  createNewProject,
3400
3396
  createService,
3397
+ customInstructions,
3398
+ customScripts,
3401
3399
  deepSeekDefaultModelId,
3402
3400
  deepSeekModels,
3403
3401
  defaultModels,
@@ -3409,6 +3407,10 @@ export {
3409
3407
  generateGithubPullRequestDetails,
3410
3408
  generateProjectConfig,
3411
3409
  getAvailableTools,
3410
+ getBoolean,
3411
+ getInt,
3412
+ getString,
3413
+ getStringArray,
3412
3414
  handOver_default as handOver,
3413
3415
  listCodeDefinitionNames_default as listCodeDefinitionNames,
3414
3416
  listFiles_default as listFiles,
@@ -3420,6 +3422,10 @@ export {
3420
3422
  removeFile_default as removeFile,
3421
3423
  renameFile_default as renameFile,
3422
3424
  replaceInFile_default as replaceInFile,
3425
+ replaceInFile as replaceInFileHelper,
3426
+ responsePrompts,
3423
3427
  searchFiles_default as searchFiles,
3428
+ systemInformation,
3429
+ toolUsePrompt,
3424
3430
  writeToFile_default as writeToFile
3425
3431
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/core",
3
- "version": "0.7.10",
3
+ "version": "0.7.12",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",