@polka-codes/cli 0.6.6 → 0.6.8
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/README.md +2 -2
- package/dist/index.js +96 -62
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ POLKA_API_KEY=your_api_key_here
|
|
|
117
117
|
|
|
118
118
|
# Optional - override defaults
|
|
119
119
|
POLKA_API_PROVIDER=deepseek # or anthropic, openrouter, ollama
|
|
120
|
-
POLKA_AI_MODEL_ID=deepseek-chat # or claude-3-sonnet-
|
|
120
|
+
POLKA_AI_MODEL_ID=deepseek-chat # or claude-3-7-sonnet-20250219
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
### Project Configuration
|
|
@@ -194,4 +194,4 @@ rules: |
|
|
|
194
194
|
|
|
195
195
|
---
|
|
196
196
|
|
|
197
|
-
*This README was generated by polka.codes*
|
|
197
|
+
*This README was generated by polka.codes*
|
package/dist/index.js
CHANGED
|
@@ -10411,7 +10411,7 @@ var require_wrap_ansi = __commonJS((exports, module2) => {
|
|
|
10411
10411
|
};
|
|
10412
10412
|
});
|
|
10413
10413
|
|
|
10414
|
-
// ../../node_modules/mute-stream/lib/index.js
|
|
10414
|
+
// ../../node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js
|
|
10415
10415
|
var require_lib3 = __commonJS((exports, module2) => {
|
|
10416
10416
|
var Stream3 = __require("stream");
|
|
10417
10417
|
|
|
@@ -24629,7 +24629,7 @@ var {
|
|
|
24629
24629
|
Help
|
|
24630
24630
|
} = import__.default;
|
|
24631
24631
|
// package.json
|
|
24632
|
-
var version = "0.6.
|
|
24632
|
+
var version = "0.6.8";
|
|
24633
24633
|
|
|
24634
24634
|
// ../../node_modules/@anthropic-ai/sdk/version.mjs
|
|
24635
24635
|
var VERSION = "0.36.2";
|
|
@@ -27863,8 +27863,19 @@ class AiServiceBase {
|
|
|
27863
27863
|
}
|
|
27864
27864
|
|
|
27865
27865
|
// ../core/src/AiService/ModelInfo.ts
|
|
27866
|
-
var anthropicDefaultModelId = "claude-3-
|
|
27866
|
+
var anthropicDefaultModelId = "claude-3-7-sonnet-20250219";
|
|
27867
27867
|
var anthropicModels = {
|
|
27868
|
+
"claude-3-7-sonnet-20250219": {
|
|
27869
|
+
maxTokens: 8192,
|
|
27870
|
+
contextWindow: 200000,
|
|
27871
|
+
supportsImages: true,
|
|
27872
|
+
supportsComputerUse: true,
|
|
27873
|
+
supportsPromptCache: true,
|
|
27874
|
+
inputPrice: 3,
|
|
27875
|
+
outputPrice: 15,
|
|
27876
|
+
cacheWritesPrice: 3.75,
|
|
27877
|
+
cacheReadsPrice: 0.3
|
|
27878
|
+
},
|
|
27868
27879
|
"claude-3-5-sonnet-20241022": {
|
|
27869
27880
|
maxTokens: 8192,
|
|
27870
27881
|
contextWindow: 200000,
|
|
@@ -27962,6 +27973,7 @@ class AnthropicService extends AiServiceBase {
|
|
|
27962
27973
|
const modelId = this.model.id;
|
|
27963
27974
|
const cacheControl = this.#options.enableCache ? { type: "ephemeral" } : undefined;
|
|
27964
27975
|
switch (modelId) {
|
|
27976
|
+
case "claude-3-7-sonnet-20250219":
|
|
27965
27977
|
case "claude-3-5-sonnet-20241022":
|
|
27966
27978
|
case "claude-3-5-haiku-20241022":
|
|
27967
27979
|
case "claude-3-opus-20240229":
|
|
@@ -32927,6 +32939,11 @@ class OpenRouterService extends AiServiceBase {
|
|
|
32927
32939
|
];
|
|
32928
32940
|
const cacheControl = this.#options.enableCache ? { type: "ephemeral" } : undefined;
|
|
32929
32941
|
switch (this.model.id) {
|
|
32942
|
+
case "anthropic/claude-3.7-sonnet:thinking":
|
|
32943
|
+
case "anthropic/claude-3.7-sonnet":
|
|
32944
|
+
case "anthropic/claude-3.7-sonnet:beta":
|
|
32945
|
+
case "anthropic/claude-3-7-sonnet":
|
|
32946
|
+
case "anthropic/claude-3-7-sonnet:beta":
|
|
32930
32947
|
case "anthropic/claude-3.5-sonnet":
|
|
32931
32948
|
case "anthropic/claude-3.5-sonnet:beta":
|
|
32932
32949
|
case "anthropic/claude-3.5-sonnet-20240620":
|
|
@@ -32970,6 +32987,11 @@ class OpenRouterService extends AiServiceBase {
|
|
|
32970
32987
|
}
|
|
32971
32988
|
let maxTokens;
|
|
32972
32989
|
switch (this.model.id) {
|
|
32990
|
+
case "anthropic/claude-3.7-sonnet:thinking":
|
|
32991
|
+
case "anthropic/claude-3.7-sonnet":
|
|
32992
|
+
case "anthropic/claude-3.7-sonnet:beta":
|
|
32993
|
+
case "anthropic/claude-3-7-sonnet":
|
|
32994
|
+
case "anthropic/claude-3-7-sonnet:beta":
|
|
32973
32995
|
case "anthropic/claude-3.5-sonnet":
|
|
32974
32996
|
case "anthropic/claude-3.5-sonnet:beta":
|
|
32975
32997
|
case "anthropic/claude-3.5-sonnet-20240620":
|
|
@@ -33108,10 +33130,10 @@ var AiServiceProvider;
|
|
|
33108
33130
|
AiServiceProvider2["OpenRouter"] = "openrouter";
|
|
33109
33131
|
})(AiServiceProvider ||= {});
|
|
33110
33132
|
var defaultModels = {
|
|
33111
|
-
["anthropic" /* Anthropic */]: "claude-3-
|
|
33133
|
+
["anthropic" /* Anthropic */]: "claude-3-7-sonnet-20250219",
|
|
33112
33134
|
["ollama" /* Ollama */]: "maryasov/qwen2.5-coder-cline:7b",
|
|
33113
33135
|
["deepseek" /* DeepSeek */]: "deepseek-chat",
|
|
33114
|
-
["openrouter" /* OpenRouter */]: "anthropic/claude-3.
|
|
33136
|
+
["openrouter" /* OpenRouter */]: "anthropic/claude-3.7-sonnet"
|
|
33115
33137
|
};
|
|
33116
33138
|
var createService = (provider, options) => {
|
|
33117
33139
|
switch (provider) {
|
|
@@ -34137,9 +34159,16 @@ var renameFile_default = {
|
|
|
34137
34159
|
isAvailable: isAvailable13
|
|
34138
34160
|
};
|
|
34139
34161
|
// ../core/src/getAvailableTools.ts
|
|
34140
|
-
var getAvailableTools = (
|
|
34162
|
+
var getAvailableTools = ({
|
|
34163
|
+
provider: provider2,
|
|
34164
|
+
allTools: allTools2,
|
|
34165
|
+
hasAgent,
|
|
34166
|
+
permissionLevel,
|
|
34167
|
+
interactive
|
|
34168
|
+
}) => {
|
|
34169
|
+
const filteredTools = interactive ? allTools2 : allTools2.filter((tool) => tool.name !== askFollowupQuestion_default.name);
|
|
34141
34170
|
const tools = [];
|
|
34142
|
-
for (const tool of
|
|
34171
|
+
for (const tool of filteredTools) {
|
|
34143
34172
|
if (!hasAgent) {
|
|
34144
34173
|
switch (tool.name) {
|
|
34145
34174
|
case handOver_default.name:
|
|
@@ -34271,6 +34300,8 @@ For example:
|
|
|
34271
34300
|
|
|
34272
34301
|
Always adhere to this format for the tool use to ensure proper parsing and execution.
|
|
34273
34302
|
|
|
34303
|
+
NEVER surround tool use with triple backticks (\`\`\`).
|
|
34304
|
+
|
|
34274
34305
|
# Tools
|
|
34275
34306
|
${tools.map((tool) => toolInfoPrompt(tool, toolNamePrefix, parameterPrefix)).join(`
|
|
34276
34307
|
`)}
|
|
@@ -34311,7 +34342,7 @@ var agentsPrompt = (agents, name2) => `
|
|
|
34311
34342
|
|
|
34312
34343
|
AVAILABLE AGENTS
|
|
34313
34344
|
|
|
34314
|
-
The following agents are available for task handover:
|
|
34345
|
+
The following agents are available for task handover/delegate:
|
|
34315
34346
|
${agents.map((agent) => `
|
|
34316
34347
|
- **${agent.name}**
|
|
34317
34348
|
- Responsibilities:
|
|
@@ -34320,7 +34351,7 @@ ${agent.responsibilities.map((resp) => ` - ${resp}`).join(`
|
|
|
34320
34351
|
`)}
|
|
34321
34352
|
|
|
34322
34353
|
- **Current Agent Role**
|
|
34323
|
-
You are currently acting as **${name2}**. If you identify the task is beyond your current scope, use the handover tool to transition to the other agent. Include sufficient context so the new agent can seamlessly continue the work.
|
|
34354
|
+
You are currently acting as **${name2}**. If you identify the task is beyond your current scope, use the handover or delegate tool to transition to the other agent. Include sufficient context so the new agent can seamlessly continue the work.
|
|
34324
34355
|
`;
|
|
34325
34356
|
var capabilities = (toolNamePrefix) => `
|
|
34326
34357
|
====
|
|
@@ -34335,24 +34366,6 @@ var systemInformation = (info2) => `
|
|
|
34335
34366
|
SYSTEM INFORMATION
|
|
34336
34367
|
|
|
34337
34368
|
Operating System: ${info2.os}`;
|
|
34338
|
-
var interactiveMode = (interactive) => {
|
|
34339
|
-
if (interactive) {
|
|
34340
|
-
return `
|
|
34341
|
-
====
|
|
34342
|
-
|
|
34343
|
-
INTERACTIVE MODE
|
|
34344
|
-
|
|
34345
|
-
You are in interactive mode. This means you may ask user questions to gather additional information to complete the task.
|
|
34346
|
-
`;
|
|
34347
|
-
}
|
|
34348
|
-
return `
|
|
34349
|
-
====
|
|
34350
|
-
|
|
34351
|
-
NON-INTERACTIVE MODE
|
|
34352
|
-
|
|
34353
|
-
You are in non-interactive mode. This means you will not be able to ask user questions to gather additional information to complete the task. You should try to use available tools to accomplish the task. If unable to precede further, you may try to end the task and provide a reason.
|
|
34354
|
-
`;
|
|
34355
|
-
};
|
|
34356
34369
|
var customInstructions = (customInstructions2) => {
|
|
34357
34370
|
const joined = customInstructions2.join(`
|
|
34358
34371
|
`);
|
|
@@ -34612,7 +34625,7 @@ ${agents}`;
|
|
|
34612
34625
|
}
|
|
34613
34626
|
|
|
34614
34627
|
// ../core/src/Agent/AnalyzerAgent/prompts.ts
|
|
34615
|
-
var fullSystemPrompt = (info2, tools, toolNamePrefix, instructions, scripts
|
|
34628
|
+
var fullSystemPrompt = (info2, tools, toolNamePrefix, instructions, scripts) => `
|
|
34616
34629
|
# Analyzer Agent
|
|
34617
34630
|
|
|
34618
34631
|
## Role
|
|
@@ -34638,18 +34651,23 @@ ${capabilities(toolNamePrefix)}
|
|
|
34638
34651
|
${systemInformation(info2)}
|
|
34639
34652
|
${customInstructions(instructions)}
|
|
34640
34653
|
${customScripts(scripts)}
|
|
34641
|
-
${interactiveMode(interactive)}
|
|
34642
34654
|
`;
|
|
34643
34655
|
|
|
34644
34656
|
// ../core/src/Agent/AnalyzerAgent/index.ts
|
|
34645
34657
|
class AnalyzerAgent extends AgentBase {
|
|
34646
34658
|
constructor(options) {
|
|
34647
34659
|
const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
|
|
34648
|
-
const tools = getAvailableTools(
|
|
34660
|
+
const tools = getAvailableTools({
|
|
34661
|
+
provider: options.provider,
|
|
34662
|
+
allTools: combinedTools,
|
|
34663
|
+
hasAgent: (options.agents?.length ?? 0) > 0,
|
|
34664
|
+
permissionLevel: 1 /* Read */,
|
|
34665
|
+
interactive: true
|
|
34666
|
+
});
|
|
34649
34667
|
const toolNamePrefix = "tool_";
|
|
34650
34668
|
const systemPrompt = fullSystemPrompt({
|
|
34651
34669
|
os: options.os
|
|
34652
|
-
}, tools, toolNamePrefix, options.customInstructions ?? [], options.scripts ?? {}
|
|
34670
|
+
}, tools, toolNamePrefix, options.customInstructions ?? [], options.scripts ?? {});
|
|
34653
34671
|
super(analyzerAgentInfo.name, options.ai, {
|
|
34654
34672
|
systemPrompt,
|
|
34655
34673
|
tools,
|
|
@@ -34677,7 +34695,7 @@ var analyzerAgentInfo = {
|
|
|
34677
34695
|
};
|
|
34678
34696
|
|
|
34679
34697
|
// ../core/src/Agent/ArchitectAgent/prompts.ts
|
|
34680
|
-
var fullSystemPrompt2 = (info2, tools, toolNamePrefix, instructions, scripts
|
|
34698
|
+
var fullSystemPrompt2 = (info2, tools, toolNamePrefix, instructions, scripts) => `
|
|
34681
34699
|
# Architect Agent
|
|
34682
34700
|
|
|
34683
34701
|
## Role
|
|
@@ -34715,31 +34733,37 @@ You are the **Architect** agent, responsible for:
|
|
|
34715
34733
|
4. **Create Implementation Plan**
|
|
34716
34734
|
- Outline tasks, define milestones, and detail resources or dependencies.
|
|
34717
34735
|
- Provide clear, concise instructions for each step.
|
|
34736
|
+
- Each step should be appropriate sized and self-contained.
|
|
34718
34737
|
|
|
34719
|
-
5. **
|
|
34720
|
-
-
|
|
34721
|
-
-
|
|
34722
|
-
|
|
34723
|
-
6. **Handover/Delegate**
|
|
34738
|
+
5. **Handover/Delegate**
|
|
34739
|
+
- Evaluate the number of steps required.
|
|
34740
|
+
- Handleover to the **Coder** agent if only one step is required.
|
|
34741
|
+
- If multiple steps are required, delegate each step to the **Coder** agent.
|
|
34724
34742
|
- Deliver the final implementation plan, context, and relevant files to the **Coder** agent.
|
|
34725
34743
|
- Provide any additional instructions or clarifications needed for successful implementation.
|
|
34744
|
+
|
|
34726
34745
|
${toolUsePrompt(tools, toolNamePrefix)}
|
|
34727
34746
|
${capabilities(toolNamePrefix)}
|
|
34728
34747
|
${systemInformation(info2)}
|
|
34729
34748
|
${customInstructions(instructions)}
|
|
34730
34749
|
${customScripts(scripts)}
|
|
34731
|
-
${interactiveMode(interactive)}
|
|
34732
34750
|
`;
|
|
34733
34751
|
|
|
34734
34752
|
// ../core/src/Agent/ArchitectAgent/index.ts
|
|
34735
34753
|
class ArchitectAgent extends AgentBase {
|
|
34736
34754
|
constructor(options) {
|
|
34737
34755
|
const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
|
|
34738
|
-
const tools = getAvailableTools(
|
|
34756
|
+
const tools = getAvailableTools({
|
|
34757
|
+
provider: options.provider,
|
|
34758
|
+
allTools: combinedTools,
|
|
34759
|
+
hasAgent: (options.agents?.length ?? 0) > 0,
|
|
34760
|
+
permissionLevel: 1 /* Read */,
|
|
34761
|
+
interactive: true
|
|
34762
|
+
});
|
|
34739
34763
|
const toolNamePrefix = "tool_";
|
|
34740
34764
|
const systemPrompt = fullSystemPrompt2({
|
|
34741
34765
|
os: options.os
|
|
34742
|
-
}, tools, toolNamePrefix, options.customInstructions ?? [], options.scripts ?? {}
|
|
34766
|
+
}, tools, toolNamePrefix, options.customInstructions ?? [], options.scripts ?? {});
|
|
34743
34767
|
super(architectAgentInfo.name, options.ai, {
|
|
34744
34768
|
systemPrompt,
|
|
34745
34769
|
tools,
|
|
@@ -34839,8 +34863,7 @@ ${retryGuidelines}
|
|
|
34839
34863
|
${capabilities(toolNamePrefix)}
|
|
34840
34864
|
${systemInformation(info2)}
|
|
34841
34865
|
${customInstructions(instructions)}
|
|
34842
|
-
${customScripts(scripts)}
|
|
34843
|
-
${interactiveMode(interactive)}`;
|
|
34866
|
+
${customScripts(scripts)}`;
|
|
34844
34867
|
|
|
34845
34868
|
// ../core/src/Agent/CodeFixerAgent/index.ts
|
|
34846
34869
|
class CodeFixerAgent extends AgentBase {
|
|
@@ -34848,7 +34871,13 @@ class CodeFixerAgent extends AgentBase {
|
|
|
34848
34871
|
#retryCount = 0;
|
|
34849
34872
|
constructor(options) {
|
|
34850
34873
|
const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
|
|
34851
|
-
const tools = getAvailableTools(
|
|
34874
|
+
const tools = getAvailableTools({
|
|
34875
|
+
provider: options.provider,
|
|
34876
|
+
allTools: combinedTools,
|
|
34877
|
+
hasAgent: (options.agents?.length ?? 0) > 0,
|
|
34878
|
+
permissionLevel: 3 /* Arbitrary */,
|
|
34879
|
+
interactive: true
|
|
34880
|
+
});
|
|
34852
34881
|
const toolNamePrefix = "tool_";
|
|
34853
34882
|
const systemPrompt = fullSystemPrompt3({
|
|
34854
34883
|
os: options.os
|
|
@@ -35006,7 +35035,9 @@ RULES
|
|
|
35006
35035
|
- When presented with images, utilize your vision capabilities to thoroughly examine them and extract meaningful information. Incorporate these insights into your thought process as you accomplish the user's task.
|
|
35007
35036
|
- When using the ${toolNamePrefix}replace_in_file tool, you must include complete lines in your SEARCH blocks, not partial lines. The system requires exact line matches and cannot match partial lines. For example, if you want to match a line containing "const x = 5;", your SEARCH block must include the entire line, not just "x = 5" or other fragments.
|
|
35008
35037
|
- When using the ${toolNamePrefix}replace_in_file tool, if you use multiple SEARCH/REPLACE blocks, list them in the order they appear in the file. For example if you need to make changes to both line 10 and line 50, first include the SEARCH/REPLACE block for line 10, followed by the SEARCH/REPLACE block for line 50.
|
|
35009
|
-
- It is critical you wait for the user's response after each tool use, in order to confirm the success of the tool use. For example, if asked to make a todo app, you would create a file, wait for the user's response it was created successfully, then create another file if needed, wait for the user's response it was created successfully, etc
|
|
35038
|
+
- It is critical you wait for the user's response after each tool use, in order to confirm the success of the tool use. For example, if asked to make a todo app, you would create a file, wait for the user's response it was created successfully, then create another file if needed, wait for the user's response it was created successfully, etc.
|
|
35039
|
+
- Keep the inline docs up to date if needed.
|
|
35040
|
+
`;
|
|
35010
35041
|
var objectives = (toolNamePrefix) => `
|
|
35011
35042
|
====
|
|
35012
35043
|
|
|
@@ -35019,7 +35050,7 @@ You accomplish a given task iteratively, breaking it down into clear steps and w
|
|
|
35019
35050
|
3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within <thinking></thinking> tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use.
|
|
35020
35051
|
4. Once you've completed the user's task, you must use the ${toolNamePrefix}attempt_completion tool to present the result of the task to the user.
|
|
35021
35052
|
5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.`;
|
|
35022
|
-
var fullSystemPrompt4 = (info2, tools, toolNamePrefix, instructions, scripts
|
|
35053
|
+
var fullSystemPrompt4 = (info2, tools, toolNamePrefix, instructions, scripts) => `
|
|
35023
35054
|
${basePrompt2}
|
|
35024
35055
|
${toolUsePrompt(tools, toolNamePrefix)}
|
|
35025
35056
|
${editingFilesPrompt(toolNamePrefix)}
|
|
@@ -35029,18 +35060,23 @@ ${objectives(toolNamePrefix)}
|
|
|
35029
35060
|
${systemInformation(info2)}
|
|
35030
35061
|
${customInstructions(instructions)}
|
|
35031
35062
|
${customScripts(scripts)}
|
|
35032
|
-
${interactiveMode(interactive)}
|
|
35033
35063
|
`;
|
|
35034
35064
|
|
|
35035
35065
|
// ../core/src/Agent/CoderAgent/index.ts
|
|
35036
35066
|
class CoderAgent extends AgentBase {
|
|
35037
35067
|
constructor(options) {
|
|
35038
35068
|
const combinedTools = [...options.additionalTools ?? [], ...Object.values(exports_allTools)];
|
|
35039
|
-
const tools = getAvailableTools(
|
|
35069
|
+
const tools = getAvailableTools({
|
|
35070
|
+
provider: options.provider,
|
|
35071
|
+
allTools: combinedTools,
|
|
35072
|
+
hasAgent: (options.agents?.length ?? 0) > 0,
|
|
35073
|
+
permissionLevel: 3 /* Arbitrary */,
|
|
35074
|
+
interactive: true
|
|
35075
|
+
});
|
|
35040
35076
|
const toolNamePrefix = "tool_";
|
|
35041
35077
|
const systemPrompt = fullSystemPrompt4({
|
|
35042
35078
|
os: options.os
|
|
35043
|
-
}, tools, toolNamePrefix, options.customInstructions ?? [], options.scripts ?? {}
|
|
35079
|
+
}, tools, toolNamePrefix, options.customInstructions ?? [], options.scripts ?? {});
|
|
35044
35080
|
super(coderAgentInfo.name, options.ai, {
|
|
35045
35081
|
systemPrompt,
|
|
35046
35082
|
tools,
|
|
@@ -35258,7 +35294,6 @@ You will produce a single commit message enclosed within <tool_output> tags. The
|
|
|
35258
35294
|
|
|
35259
35295
|
Here’s an example of the input and the expected output format:
|
|
35260
35296
|
|
|
35261
|
-
\`\`\`
|
|
35262
35297
|
<tool_input>
|
|
35263
35298
|
--- a/example_file.py
|
|
35264
35299
|
+++ b/example_file.py
|
|
@@ -35269,15 +35304,12 @@ Here’s an example of the input and the expected output format:
|
|
|
35269
35304
|
<tool_input_context>
|
|
35270
35305
|
Changing print statement to update the user-facing message.
|
|
35271
35306
|
</tool_input_context>
|
|
35272
|
-
\`\`\`
|
|
35273
35307
|
|
|
35274
35308
|
Example Output:
|
|
35275
35309
|
|
|
35276
|
-
\`\`\`
|
|
35277
35310
|
<tool_output>
|
|
35278
35311
|
Update print statement for revised user-facing message
|
|
35279
35312
|
</tool_output>
|
|
35280
|
-
\`\`\`
|
|
35281
35313
|
|
|
35282
35314
|
Follow the same structure for any new input. Never repeat questions; focus on generating a concise commit message that captures the essence of the changes.
|
|
35283
35315
|
`;
|
|
@@ -41120,6 +41152,7 @@ class Runner {
|
|
|
41120
41152
|
case coderAgentInfo.name:
|
|
41121
41153
|
return new CoderAgent({
|
|
41122
41154
|
...args2,
|
|
41155
|
+
interactive: false,
|
|
41123
41156
|
provider: getProvider(agentName, options.config, providerOptions)
|
|
41124
41157
|
});
|
|
41125
41158
|
case architectAgentInfo.name:
|
|
@@ -41130,6 +41163,7 @@ class Runner {
|
|
|
41130
41163
|
case analyzerAgentInfo.name:
|
|
41131
41164
|
return new AnalyzerAgent({
|
|
41132
41165
|
...args2,
|
|
41166
|
+
interactive: false,
|
|
41133
41167
|
provider: getProvider(agentName, options.config, providerOptions)
|
|
41134
41168
|
});
|
|
41135
41169
|
case codeFixerAgentInfo.name:
|
|
@@ -45368,6 +45402,7 @@ var agentSchema = providerModelSchema.extend({
|
|
|
45368
45402
|
}).optional()
|
|
45369
45403
|
});
|
|
45370
45404
|
var configSchema = z2.object({
|
|
45405
|
+
agent: z2.string().optional(),
|
|
45371
45406
|
providers: z2.record(z2.string(), z2.object({
|
|
45372
45407
|
apiKey: z2.string().optional(),
|
|
45373
45408
|
defaultModel: z2.string().optional()
|
|
@@ -45491,7 +45526,7 @@ function getEnv(override) {
|
|
|
45491
45526
|
|
|
45492
45527
|
// src/options.ts
|
|
45493
45528
|
function addSharedOptions(command) {
|
|
45494
|
-
return command.option("-c --config <paths>", "Path to config file(s)", (value, prev) => prev.concat(value), []).option("--api-provider <provider>", "API provider").option("--model <model>", "Model ID").option("--api-key <key>", "API key").option("--max-messages <iterations>", "Maximum number of messages to send. Default to 50", Number.parseInt, 50).option("--budget <budget>", "Budget for the AI service. Default to $10", Number.parseFloat).option("-v --verbose", "Enable verbose output. Use -v for level 1, -vv for level 2", (value, prev) => prev + 1, 0).option("-d --base-dir <path>", "Base directory to run commands in");
|
|
45529
|
+
return command.option("-c --config <paths>", "Path to config file(s)", (value, prev) => prev.concat(value), []).option("--api-provider <provider>", "API provider").option("--model <model>", "Model ID").option("--api-key <key>", "API key").option("--max-messages <iterations>", "Maximum number of messages to send. Default to 50", Number.parseInt, 50).option("--budget <budget>", "Budget for the AI service. Default to $10", Number.parseFloat).option("-v --verbose", "Enable verbose output. Use -v for level 1, -vv for level 2", (value, prev) => prev + 1, 0).option("-d --base-dir <path>", "Base directory to run commands in").option("--agent <agent>", "Initial agent to use (default: architect)");
|
|
45495
45530
|
}
|
|
45496
45531
|
function parseOptions(options, cwdArg, home = os2.homedir(), env = getEnv()) {
|
|
45497
45532
|
let cwd = cwdArg;
|
|
@@ -45533,7 +45568,8 @@ function parseOptions(options, cwdArg, home = os2.homedir(), env = getEnv()) {
|
|
|
45533
45568
|
budget: options.budget ?? (env.POLKA_BUDGET ? Number.parseFloat(env.POLKA_BUDGET) : undefined) ?? config.budget ?? 10,
|
|
45534
45569
|
verbose: options.verbose ?? 0,
|
|
45535
45570
|
config,
|
|
45536
|
-
providerConfig
|
|
45571
|
+
providerConfig,
|
|
45572
|
+
agent: options.agent ?? config.agent ?? "architect"
|
|
45537
45573
|
};
|
|
45538
45574
|
}
|
|
45539
45575
|
|
|
@@ -46129,13 +46165,12 @@ ${event.systemPrompt}`);
|
|
|
46129
46165
|
// src/commands/chat.ts
|
|
46130
46166
|
var runChat = async (opts, command) => {
|
|
46131
46167
|
const options = command?.parent?.opts() ?? opts ?? {};
|
|
46132
|
-
const { config, providerConfig, maxMessageCount, verbose, budget } = parseOptions(options);
|
|
46168
|
+
const { config, providerConfig, maxMessageCount, verbose, budget, agent } = parseOptions(options);
|
|
46133
46169
|
if (!process.stdin.isTTY) {
|
|
46134
46170
|
console.error("Error: Terminal is not interactive. Please run this command in an interactive terminal.");
|
|
46135
46171
|
process.exit(1);
|
|
46136
46172
|
}
|
|
46137
|
-
|
|
46138
|
-
let { provider: provider2, model, apiKey } = providerConfig.getConfigForAgent(startAgent) ?? {};
|
|
46173
|
+
let { provider: provider2, model, apiKey } = providerConfig.getConfigForAgent(agent) ?? {};
|
|
46139
46174
|
if (!provider2) {
|
|
46140
46175
|
const newConfig = await configPrompt({ provider: provider2, model, apiKey });
|
|
46141
46176
|
provider2 = newConfig.provider;
|
|
@@ -46163,7 +46198,7 @@ var runChat = async (opts, command) => {
|
|
|
46163
46198
|
const reason = await runner.continueTask(message);
|
|
46164
46199
|
exitReason = reason;
|
|
46165
46200
|
} else {
|
|
46166
|
-
const reason = await runner.startTask(message);
|
|
46201
|
+
const reason = await runner.startTask(message, agent);
|
|
46167
46202
|
exitReason = reason;
|
|
46168
46203
|
}
|
|
46169
46204
|
switch (exitReason.type) {
|
|
@@ -47191,9 +47226,8 @@ async function runTask(taskArg, _options, command) {
|
|
|
47191
47226
|
process.exit(1);
|
|
47192
47227
|
}
|
|
47193
47228
|
}
|
|
47194
|
-
const { config, providerConfig, verbose, maxMessageCount, budget } = parseOptions(command.opts());
|
|
47195
|
-
const
|
|
47196
|
-
const { provider: provider2, model } = providerConfig.getConfigForAgent(startAgent) ?? {};
|
|
47229
|
+
const { config, providerConfig, verbose, maxMessageCount, budget, agent } = parseOptions(command.opts());
|
|
47230
|
+
const { provider: provider2, model } = providerConfig.getConfigForAgent(agent) ?? {};
|
|
47197
47231
|
if (!provider2 || !model) {
|
|
47198
47232
|
console.error("Provider and model must be configured");
|
|
47199
47233
|
process.exit(1);
|
|
@@ -47209,7 +47243,7 @@ async function runTask(taskArg, _options, command) {
|
|
|
47209
47243
|
eventCallback: printEvent(verbose),
|
|
47210
47244
|
enableCache: true
|
|
47211
47245
|
});
|
|
47212
|
-
await runner.startTask(task,
|
|
47246
|
+
await runner.startTask(task, agent);
|
|
47213
47247
|
runner.printUsage();
|
|
47214
47248
|
}
|
|
47215
47249
|
|