@polka-codes/cli 0.8.6 → 0.8.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/dist/index.js +78 -39
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31550,7 +31550,7 @@ var {
|
|
|
31550
31550
|
Help
|
|
31551
31551
|
} = import__.default;
|
|
31552
31552
|
// package.json
|
|
31553
|
-
var version = "0.8.
|
|
31553
|
+
var version = "0.8.8";
|
|
31554
31554
|
|
|
31555
31555
|
// ../core/src/AiService/AiServiceBase.ts
|
|
31556
31556
|
class AiServiceBase {
|
|
@@ -41029,6 +41029,7 @@ var toolInfo = {
|
|
|
41029
41029
|
description: "One or more follow-up questions you need answered before you can continue.",
|
|
41030
41030
|
required: true,
|
|
41031
41031
|
allowMultiple: true,
|
|
41032
|
+
usageValue: "questions here",
|
|
41032
41033
|
children: [
|
|
41033
41034
|
{
|
|
41034
41035
|
name: "prompt",
|
|
@@ -42243,17 +42244,47 @@ var getAvailableTools = ({
|
|
|
42243
42244
|
};
|
|
42244
42245
|
|
|
42245
42246
|
// ../core/src/Agent/parseAssistantMessage.ts
|
|
42246
|
-
function parseNestedParameters(content, parameterPrefix) {
|
|
42247
|
+
function parseNestedParameters(content, parameterPrefix, childrenParams) {
|
|
42247
42248
|
const result = {};
|
|
42248
42249
|
const nestedParamRegex = new RegExp(`<${parameterPrefix}([^>]+)>([\\s\\S]*?)<\\/${parameterPrefix}\\1>`, "gs");
|
|
42250
|
+
const arrayParams = new Set;
|
|
42251
|
+
if (childrenParams) {
|
|
42252
|
+
for (const param of childrenParams) {
|
|
42253
|
+
if (param.allowMultiple) {
|
|
42254
|
+
arrayParams.add(param.name);
|
|
42255
|
+
}
|
|
42256
|
+
}
|
|
42257
|
+
}
|
|
42249
42258
|
while (true) {
|
|
42250
42259
|
const match = nestedParamRegex.exec(content);
|
|
42251
42260
|
if (match === null)
|
|
42252
42261
|
break;
|
|
42253
42262
|
const paramName = match[1];
|
|
42254
42263
|
const paramContent = match[2].trim();
|
|
42255
|
-
|
|
42256
|
-
|
|
42264
|
+
const childParam = childrenParams?.find((p2) => p2.name === paramName);
|
|
42265
|
+
if (paramContent.includes(`<${parameterPrefix}`) && childParam?.children) {
|
|
42266
|
+
const nestedResult = parseNestedParameters(paramContent, parameterPrefix, childParam.children);
|
|
42267
|
+
if (arrayParams.has(paramName)) {
|
|
42268
|
+
if (!result[paramName]) {
|
|
42269
|
+
result[paramName] = [];
|
|
42270
|
+
}
|
|
42271
|
+
if (Array.isArray(result[paramName])) {
|
|
42272
|
+
result[paramName].push(nestedResult);
|
|
42273
|
+
} else {
|
|
42274
|
+
result[paramName] = [nestedResult];
|
|
42275
|
+
}
|
|
42276
|
+
} else {
|
|
42277
|
+
result[paramName] = nestedResult;
|
|
42278
|
+
}
|
|
42279
|
+
} else if (arrayParams.has(paramName)) {
|
|
42280
|
+
if (!result[paramName]) {
|
|
42281
|
+
result[paramName] = [];
|
|
42282
|
+
}
|
|
42283
|
+
if (Array.isArray(result[paramName])) {
|
|
42284
|
+
result[paramName].push(paramContent);
|
|
42285
|
+
} else {
|
|
42286
|
+
result[paramName] = [paramContent];
|
|
42287
|
+
}
|
|
42257
42288
|
} else {
|
|
42258
42289
|
result[paramName] = paramContent;
|
|
42259
42290
|
}
|
|
@@ -42297,15 +42328,29 @@ function parseAssistantMessage(assistantMessage, tools, toolNamePrefix) {
|
|
|
42297
42328
|
paramMatches.push(paramMatch[1].trim());
|
|
42298
42329
|
}
|
|
42299
42330
|
if (paramMatches.length > 0) {
|
|
42300
|
-
if (paramMatches.length === 1) {
|
|
42331
|
+
if (paramMatches.length === 1 && !param.allowMultiple) {
|
|
42301
42332
|
const paramContent = paramMatches[0];
|
|
42302
|
-
if (paramContent.includes(`<${parameterPrefix}`)) {
|
|
42303
|
-
params[param.name] = parseNestedParameters(paramContent, parameterPrefix);
|
|
42333
|
+
if (paramContent.includes(`<${parameterPrefix}`) && param.children) {
|
|
42334
|
+
params[param.name] = parseNestedParameters(paramContent, parameterPrefix, param.children);
|
|
42304
42335
|
} else {
|
|
42305
42336
|
params[param.name] = paramContent;
|
|
42306
42337
|
}
|
|
42307
42338
|
} else {
|
|
42308
|
-
|
|
42339
|
+
if (param.allowMultiple) {
|
|
42340
|
+
params[param.name] = paramMatches.map((paramContent) => {
|
|
42341
|
+
if (paramContent.includes(`<${parameterPrefix}`) && param.children) {
|
|
42342
|
+
return parseNestedParameters(paramContent, parameterPrefix, param.children);
|
|
42343
|
+
}
|
|
42344
|
+
return paramContent;
|
|
42345
|
+
});
|
|
42346
|
+
} else {
|
|
42347
|
+
const paramContent = paramMatches[0];
|
|
42348
|
+
if (paramContent.includes(`<${parameterPrefix}`) && param.children) {
|
|
42349
|
+
params[param.name] = parseNestedParameters(paramContent, parameterPrefix, param.children);
|
|
42350
|
+
} else {
|
|
42351
|
+
params[param.name] = paramContent;
|
|
42352
|
+
}
|
|
42353
|
+
}
|
|
42309
42354
|
}
|
|
42310
42355
|
}
|
|
42311
42356
|
}
|
|
@@ -42358,12 +42403,13 @@ var toolInfoPrompt = (tool, toolNamePrefix, parameterPrefix) => `
|
|
|
42358
42403
|
Description: ${tool.description}
|
|
42359
42404
|
|
|
42360
42405
|
Parameters:
|
|
42361
|
-
${tool.parameters.map((param) => `- ${parameterPrefix}${param.name}: (${param.required ? "required" : "optional"}) ${param.description}`).join(`
|
|
42406
|
+
${tool.parameters.map((param) => `- ${parameterPrefix}${param.name}: (${param.required ? "required" : "optional"})${param.allowMultiple ? " (multiple allowed)" : ""} ${param.description}`).join(`
|
|
42362
42407
|
`)}
|
|
42363
42408
|
|
|
42364
42409
|
Usage:
|
|
42365
42410
|
<${toolNamePrefix}${tool.name}>
|
|
42366
|
-
${tool.parameters.map((param) => `<${parameterPrefix}${param.name}>${param.usageValue}</${parameterPrefix}${param.name}
|
|
42411
|
+
${tool.parameters.map((param) => param.allowMultiple ? `<${parameterPrefix}${param.name}>${param.usageValue}</${parameterPrefix}${param.name}>
|
|
42412
|
+
<${parameterPrefix}${param.name}>${param.usageValue}</${parameterPrefix}${param.name}>` : `<${parameterPrefix}${param.name}>${param.usageValue}</${parameterPrefix}${param.name}>`).join(`
|
|
42367
42413
|
`)}
|
|
42368
42414
|
</${toolNamePrefix}${tool.name}>`;
|
|
42369
42415
|
var toolInfoExamplesPrompt = (tool, example, toolNamePrefix, parameterPrefix) => `
|
|
@@ -42894,42 +42940,35 @@ var fullSystemPrompt2 = (info2, tools, toolNamePrefix, instructions, scripts) =>
|
|
|
42894
42940
|
## Role
|
|
42895
42941
|
You are the **Architect** agent, responsible for:
|
|
42896
42942
|
1. **Task Analysis** - Understand requirements.
|
|
42897
|
-
2. **File Identification** -
|
|
42898
|
-
3. **File Reading** - Use
|
|
42899
|
-
4. **Implementation Plan** - Draft a
|
|
42900
|
-
5. **Review & Improve** -
|
|
42943
|
+
2. **File Identification** - Select relevant files.
|
|
42944
|
+
3. **File Reading** - Use provided tools to gather information.
|
|
42945
|
+
4. **Implementation Plan** - Draft a *code-free* plan (pseudocode/interface stubs permitted).
|
|
42946
|
+
5. **Review & Improve** - Refine the plan.
|
|
42901
42947
|
6. **Handover/Delegate** - Provide the final plan, context, and files to the **Coder** agent.
|
|
42902
42948
|
|
|
42903
|
-
> **
|
|
42949
|
+
> **Never** modify project files directly. Only produce the implementation plan; the **Coder** agent performs all code changes.
|
|
42904
42950
|
|
|
42905
42951
|
## Rules
|
|
42906
|
-
1. **Consistency** -
|
|
42907
|
-
2. **Relevance** - Consult only
|
|
42908
|
-
3. **Conciseness** -
|
|
42909
|
-
4. **Accuracy** - Ensure
|
|
42910
|
-
5. **Clarity** - Present information in a structured
|
|
42911
|
-
6. **Minimal Queries** - Ask
|
|
42952
|
+
1. **Consistency** - Align with user objectives.
|
|
42953
|
+
2. **Relevance** - Consult only essential files.
|
|
42954
|
+
3. **Conciseness** - Be succinct; avoid repetition.
|
|
42955
|
+
4. **Accuracy** - Ensure conclusions are verifiable.
|
|
42956
|
+
5. **Clarity** - Present information in a structured format.
|
|
42957
|
+
6. **Minimal Queries** - Ask questions only when truly needed.
|
|
42912
42958
|
|
|
42913
42959
|
## Steps
|
|
42914
|
-
1. **Analyze Task**
|
|
42915
|
-
|
|
42916
|
-
|
|
42917
|
-
|
|
42918
|
-
|
|
42919
|
-
|
|
42920
|
-
|
|
42921
|
-
|
|
42922
|
-
|
|
42923
|
-
4. **Create Implementation Plan**
|
|
42924
|
-
- Produce a **detailed, step-by-step plan** that:
|
|
42925
|
-
- Describes tasks, resources, and dependencies.
|
|
42926
|
-
- Uses pseudocode or interface declarations *only*—no concrete code.
|
|
42927
|
-
- Is explicit enough for the **Coder** agent to implement without further clarification.
|
|
42928
|
-
|
|
42929
|
-
5. **Handover/Delegate**
|
|
42960
|
+
1. **Analyze Task** - Capture goals, constraints, and success criteria.
|
|
42961
|
+
2. **Identify Relevant Files** - List files and justify each choice.
|
|
42962
|
+
3. **Read Files via Tools** - Summarize key insights.
|
|
42963
|
+
4. **Create Implementation Plan** - Provide a detailed, step-by-step breakdown:
|
|
42964
|
+
* Tasks, resources, and dependencies.
|
|
42965
|
+
* Pseudocode or interface declarations only—no concrete code.
|
|
42966
|
+
* Sufficient detail for the **Coder** to implement without follow-ups.
|
|
42967
|
+
5. **Review & Improve** - Confirm the plan is unambiguous and complete.
|
|
42968
|
+
6. **Handover/Delegate**
|
|
42930
42969
|
- If the plan consists of a single self-contained step, hand it over as one task.
|
|
42931
|
-
- If multiple steps are required, break them into numbered tasks
|
|
42932
|
-
- Provide all necessary context, file references, and clarifications for successful execution.
|
|
42970
|
+
- If multiple steps are required, break them into numbered tasks to delegate to the **Coder** agent.
|
|
42971
|
+
- Provide all necessary context, implementation plan, file references, and clarifications for successful execution.
|
|
42933
42972
|
|
|
42934
42973
|
${toolUsePrompt(tools, toolNamePrefix)}
|
|
42935
42974
|
${capabilities(toolNamePrefix)}
|