@polka-codes/runner 0.9.24 → 0.9.26
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 +157 -98
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30458,7 +30458,7 @@ var {
|
|
|
30458
30458
|
Help
|
|
30459
30459
|
} = import__.default;
|
|
30460
30460
|
// package.json
|
|
30461
|
-
var version = "0.9.
|
|
30461
|
+
var version = "0.9.26";
|
|
30462
30462
|
|
|
30463
30463
|
// src/runner.ts
|
|
30464
30464
|
import { execSync } from "node:child_process";
|
|
@@ -41582,8 +41582,7 @@ var toolInfo = {
|
|
|
41582
41582
|
}
|
|
41583
41583
|
}
|
|
41584
41584
|
]
|
|
41585
|
-
})
|
|
41586
|
-
permissionLevel: 0 /* None */
|
|
41585
|
+
})
|
|
41587
41586
|
};
|
|
41588
41587
|
var handler = async (provider, args) => {
|
|
41589
41588
|
if (!provider.askFollowupQuestion) {
|
|
@@ -41645,8 +41644,7 @@ var toolInfo2 = {
|
|
|
41645
41644
|
}
|
|
41646
41645
|
}
|
|
41647
41646
|
]
|
|
41648
|
-
})
|
|
41649
|
-
permissionLevel: 0 /* None */
|
|
41647
|
+
})
|
|
41650
41648
|
};
|
|
41651
41649
|
var handler2 = async (provider, args) => {
|
|
41652
41650
|
const parsed = toolInfo2.parameters.safeParse(args);
|
|
@@ -41709,8 +41707,7 @@ var toolInfo3 = {
|
|
|
41709
41707
|
}
|
|
41710
41708
|
}
|
|
41711
41709
|
]
|
|
41712
|
-
})
|
|
41713
|
-
permissionLevel: 0 /* None */
|
|
41710
|
+
})
|
|
41714
41711
|
};
|
|
41715
41712
|
var handler3 = async (_provider, args) => {
|
|
41716
41713
|
const parsed = toolInfo3.parameters.safeParse(args);
|
|
@@ -41766,8 +41763,7 @@ var toolInfo4 = {
|
|
|
41766
41763
|
}
|
|
41767
41764
|
}
|
|
41768
41765
|
]
|
|
41769
|
-
})
|
|
41770
|
-
permissionLevel: 3 /* Arbitrary */
|
|
41766
|
+
})
|
|
41771
41767
|
};
|
|
41772
41768
|
var handler4 = async (provider, args) => {
|
|
41773
41769
|
if (!provider.executeCommand) {
|
|
@@ -41857,8 +41853,7 @@ var toolInfo5 = {
|
|
|
41857
41853
|
}
|
|
41858
41854
|
}
|
|
41859
41855
|
]
|
|
41860
|
-
})
|
|
41861
|
-
permissionLevel: 1 /* Read */
|
|
41856
|
+
})
|
|
41862
41857
|
};
|
|
41863
41858
|
var handler5 = async (provider, args) => {
|
|
41864
41859
|
if (!provider.fetchUrl) {
|
|
@@ -41934,8 +41929,7 @@ var toolInfo6 = {
|
|
|
41934
41929
|
}
|
|
41935
41930
|
}
|
|
41936
41931
|
]
|
|
41937
|
-
})
|
|
41938
|
-
permissionLevel: 0 /* None */
|
|
41932
|
+
})
|
|
41939
41933
|
};
|
|
41940
41934
|
var handler6 = async (_provider, args) => {
|
|
41941
41935
|
const parsed = toolInfo6.parameters.safeParse(args);
|
|
@@ -42002,8 +41996,7 @@ var toolInfo7 = {
|
|
|
42002
41996
|
}
|
|
42003
41997
|
}
|
|
42004
41998
|
]
|
|
42005
|
-
})
|
|
42006
|
-
permissionLevel: 1 /* Read */
|
|
41999
|
+
})
|
|
42007
42000
|
};
|
|
42008
42001
|
var handler7 = async (provider, args) => {
|
|
42009
42002
|
if (!provider.listFiles) {
|
|
@@ -42044,8 +42037,7 @@ var toolInfo8 = {
|
|
|
42044
42037
|
description: "Read a binary file from a URL or local path. Use file:// prefix to access local files. This can be used to access non-text files such as PDFs or images.",
|
|
42045
42038
|
parameters: exports_external.object({
|
|
42046
42039
|
url: exports_external.string().describe("The URL or local path of the file to read.")
|
|
42047
|
-
})
|
|
42048
|
-
permissionLevel: 1 /* Read */
|
|
42040
|
+
})
|
|
42049
42041
|
};
|
|
42050
42042
|
var handler8 = async (provider, args) => {
|
|
42051
42043
|
if (!provider.readBinaryFile) {
|
|
@@ -42129,8 +42121,7 @@ var toolInfo9 = {
|
|
|
42129
42121
|
}
|
|
42130
42122
|
}
|
|
42131
42123
|
]
|
|
42132
|
-
})
|
|
42133
|
-
permissionLevel: 1 /* Read */
|
|
42124
|
+
})
|
|
42134
42125
|
};
|
|
42135
42126
|
var handler9 = async (provider, args) => {
|
|
42136
42127
|
if (!provider.readFile) {
|
|
@@ -42189,8 +42180,7 @@ var toolInfo10 = {
|
|
|
42189
42180
|
}
|
|
42190
42181
|
}
|
|
42191
42182
|
]
|
|
42192
|
-
})
|
|
42193
|
-
permissionLevel: 2 /* Write */
|
|
42183
|
+
})
|
|
42194
42184
|
};
|
|
42195
42185
|
var handler10 = async (provider, args) => {
|
|
42196
42186
|
if (!provider.removeFile) {
|
|
@@ -42247,8 +42237,7 @@ var toolInfo11 = {
|
|
|
42247
42237
|
}
|
|
42248
42238
|
}
|
|
42249
42239
|
]
|
|
42250
|
-
})
|
|
42251
|
-
permissionLevel: 2 /* Write */
|
|
42240
|
+
})
|
|
42252
42241
|
};
|
|
42253
42242
|
var handler11 = async (provider, args) => {
|
|
42254
42243
|
if (!provider.renameFile) {
|
|
@@ -42461,8 +42450,7 @@ function oldFeature() {
|
|
|
42461
42450
|
}
|
|
42462
42451
|
}
|
|
42463
42452
|
]
|
|
42464
|
-
})
|
|
42465
|
-
permissionLevel: 2 /* Write */
|
|
42453
|
+
})
|
|
42466
42454
|
};
|
|
42467
42455
|
var handler12 = async (provider, args) => {
|
|
42468
42456
|
if (!provider.readFile || !provider.writeFile) {
|
|
@@ -42568,8 +42556,7 @@ var toolInfo13 = {
|
|
|
42568
42556
|
}
|
|
42569
42557
|
}
|
|
42570
42558
|
]
|
|
42571
|
-
})
|
|
42572
|
-
permissionLevel: 1 /* Read */
|
|
42559
|
+
})
|
|
42573
42560
|
};
|
|
42574
42561
|
var handler13 = async (provider, args) => {
|
|
42575
42562
|
if (!provider.searchFiles) {
|
|
@@ -42654,8 +42641,7 @@ export default App;
|
|
|
42654
42641
|
}
|
|
42655
42642
|
}
|
|
42656
42643
|
]
|
|
42657
|
-
})
|
|
42658
|
-
permissionLevel: 2 /* Write */
|
|
42644
|
+
})
|
|
42659
42645
|
};
|
|
42660
42646
|
var handler14 = async (provider, args) => {
|
|
42661
42647
|
if (!provider.writeFile) {
|
|
@@ -42703,7 +42689,6 @@ var getAvailableTools = ({
|
|
|
42703
42689
|
provider: provider2,
|
|
42704
42690
|
allTools: allTools2,
|
|
42705
42691
|
hasAgent,
|
|
42706
|
-
permissionLevel,
|
|
42707
42692
|
interactive
|
|
42708
42693
|
}) => {
|
|
42709
42694
|
const filteredTools = interactive ? allTools2 : allTools2.filter((tool) => tool.name !== askFollowupQuestion_default.name);
|
|
@@ -42716,7 +42701,7 @@ var getAvailableTools = ({
|
|
|
42716
42701
|
continue;
|
|
42717
42702
|
}
|
|
42718
42703
|
}
|
|
42719
|
-
if (tool.isAvailable(provider2)
|
|
42704
|
+
if (tool.isAvailable(provider2)) {
|
|
42720
42705
|
tools.push(tool);
|
|
42721
42706
|
}
|
|
42722
42707
|
}
|
|
@@ -66863,14 +66848,23 @@ Retrying request ${i + 2} of ${retryCount}`);
|
|
|
66863
66848
|
return { type: "exit", reason: { type: "Pause", responses: toolResponses } };
|
|
66864
66849
|
}
|
|
66865
66850
|
if (toolResponses.length === 0) {
|
|
66851
|
+
if (this.config.requireToolUse) {
|
|
66852
|
+
return {
|
|
66853
|
+
type: "reply",
|
|
66854
|
+
message: [
|
|
66855
|
+
{
|
|
66856
|
+
role: "user",
|
|
66857
|
+
content: responsePrompts.requireUseToolNative
|
|
66858
|
+
}
|
|
66859
|
+
]
|
|
66860
|
+
};
|
|
66861
|
+
}
|
|
66866
66862
|
return {
|
|
66867
|
-
type: "
|
|
66868
|
-
|
|
66869
|
-
|
|
66870
|
-
|
|
66871
|
-
|
|
66872
|
-
}
|
|
66873
|
-
]
|
|
66863
|
+
type: "exit",
|
|
66864
|
+
reason: {
|
|
66865
|
+
type: "Exit" /* Exit */,
|
|
66866
|
+
message: response.filter((c) => c.type === "text").map((c) => c.content).join("")
|
|
66867
|
+
}
|
|
66874
66868
|
};
|
|
66875
66869
|
}
|
|
66876
66870
|
const mediaUserMessage = medias.length > 0 ? [
|
|
@@ -66912,14 +66906,23 @@ Retrying request ${i + 2} of ${retryCount}`);
|
|
|
66912
66906
|
};
|
|
66913
66907
|
}
|
|
66914
66908
|
if (toolResponses.length === 0) {
|
|
66909
|
+
if (this.config.requireToolUse) {
|
|
66910
|
+
return {
|
|
66911
|
+
type: "reply",
|
|
66912
|
+
message: [
|
|
66913
|
+
{
|
|
66914
|
+
role: "user",
|
|
66915
|
+
content: responsePrompts.requireUseTool
|
|
66916
|
+
}
|
|
66917
|
+
]
|
|
66918
|
+
};
|
|
66919
|
+
}
|
|
66915
66920
|
return {
|
|
66916
|
-
type: "
|
|
66917
|
-
|
|
66918
|
-
|
|
66919
|
-
|
|
66920
|
-
|
|
66921
|
-
}
|
|
66922
|
-
]
|
|
66921
|
+
type: "exit",
|
|
66922
|
+
reason: {
|
|
66923
|
+
type: "Exit" /* Exit */,
|
|
66924
|
+
message: response.filter((c) => c.type === "text").map((c) => c.content).join("")
|
|
66925
|
+
}
|
|
66923
66926
|
};
|
|
66924
66927
|
}
|
|
66925
66928
|
const finalResp = toolResponses.filter((resp) => resp.type === "response").flatMap(({ tool: tool2, response: response2 }) => responsePrompts.toolResults(tool2, response2));
|
|
@@ -67009,14 +67012,15 @@ ${customScripts(scripts)}
|
|
|
67009
67012
|
`;
|
|
67010
67013
|
|
|
67011
67014
|
// ../core/src/Agent/AnalyzerAgent/index.ts
|
|
67015
|
+
var agentTools = [askFollowupQuestion_default, attemptCompletion_default, delegate_default, fetchUrl_default, handOver_default, listFiles_default, readBinaryFile_default, readFile_default, searchFiles_default];
|
|
67016
|
+
|
|
67012
67017
|
class AnalyzerAgent extends AgentBase {
|
|
67013
67018
|
constructor(options) {
|
|
67014
|
-
const combinedTools = [...options.additionalTools ?? [], ...
|
|
67019
|
+
const combinedTools = [...options.additionalTools ?? [], ...agentTools];
|
|
67015
67020
|
const tools = getAvailableTools({
|
|
67016
67021
|
provider: options.provider,
|
|
67017
67022
|
allTools: combinedTools,
|
|
67018
67023
|
hasAgent: (options.agents?.length ?? 0) > 0,
|
|
67019
|
-
permissionLevel: 1 /* Read */,
|
|
67020
67024
|
interactive: true
|
|
67021
67025
|
});
|
|
67022
67026
|
const toolNamePrefix = options.toolFormat === "native" ? "" : "tool_";
|
|
@@ -67036,7 +67040,8 @@ class AnalyzerAgent extends AgentBase {
|
|
|
67036
67040
|
toolFormat: options.toolFormat,
|
|
67037
67041
|
parameters: options.parameters ?? {},
|
|
67038
67042
|
usageMeter: options.usageMeter ?? new UsageMeter,
|
|
67039
|
-
requestTimeoutSeconds: options.requestTimeoutSeconds
|
|
67043
|
+
requestTimeoutSeconds: options.requestTimeoutSeconds,
|
|
67044
|
+
requireToolUse: options.requireToolUse ?? true
|
|
67040
67045
|
});
|
|
67041
67046
|
}
|
|
67042
67047
|
onBeforeInvokeTool() {
|
|
@@ -67140,7 +67145,6 @@ class CodeFixerAgent extends AgentBase {
|
|
|
67140
67145
|
provider: options.provider,
|
|
67141
67146
|
allTools: combinedTools,
|
|
67142
67147
|
hasAgent: (options.agents?.length ?? 0) > 0,
|
|
67143
|
-
permissionLevel: 3 /* Arbitrary */,
|
|
67144
67148
|
interactive: true
|
|
67145
67149
|
});
|
|
67146
67150
|
const toolNamePrefix = options.toolFormat === "native" ? "" : "tool_";
|
|
@@ -67160,7 +67164,8 @@ class CodeFixerAgent extends AgentBase {
|
|
|
67160
67164
|
toolFormat: options.toolFormat,
|
|
67161
67165
|
parameters: options.parameters ?? {},
|
|
67162
67166
|
usageMeter: options.usageMeter ?? new UsageMeter,
|
|
67163
|
-
requestTimeoutSeconds: options.requestTimeoutSeconds
|
|
67167
|
+
requestTimeoutSeconds: options.requestTimeoutSeconds,
|
|
67168
|
+
requireToolUse: options.requireToolUse ?? true
|
|
67164
67169
|
});
|
|
67165
67170
|
this.#maxRetries = options.maxRetries ?? 5;
|
|
67166
67171
|
}
|
|
@@ -67345,7 +67350,6 @@ class CoderAgent extends AgentBase {
|
|
|
67345
67350
|
provider: options.provider,
|
|
67346
67351
|
allTools: combinedTools,
|
|
67347
67352
|
hasAgent: (options.agents?.length ?? 0) > 0,
|
|
67348
|
-
permissionLevel: 3 /* Arbitrary */,
|
|
67349
67353
|
interactive: true
|
|
67350
67354
|
});
|
|
67351
67355
|
const toolNamePrefix = options.toolFormat === "native" ? "" : "tool_";
|
|
@@ -67365,7 +67369,8 @@ class CoderAgent extends AgentBase {
|
|
|
67365
67369
|
toolFormat: options.toolFormat,
|
|
67366
67370
|
parameters: options.parameters ?? {},
|
|
67367
67371
|
usageMeter: options.usageMeter ?? new UsageMeter,
|
|
67368
|
-
requestTimeoutSeconds: options.requestTimeoutSeconds
|
|
67372
|
+
requestTimeoutSeconds: options.requestTimeoutSeconds,
|
|
67373
|
+
requireToolUse: options.requireToolUse ?? true
|
|
67369
67374
|
});
|
|
67370
67375
|
}
|
|
67371
67376
|
async#runScript(scriptName, shouldReplyWithError) {
|
|
@@ -67952,7 +67957,7 @@ var toolInfo15 = {
|
|
|
67952
67957
|
return val;
|
|
67953
67958
|
}, exports_external.boolean().optional().default(false)).describe("Get staged changes instead of unstaged changes."),
|
|
67954
67959
|
commitRange: exports_external.string().optional().describe('The commit range to get the diff for (e.g., "main...HEAD").'),
|
|
67955
|
-
file: exports_external.string().
|
|
67960
|
+
file: exports_external.string().describe("Get the diff for a specific file."),
|
|
67956
67961
|
contextLines: exports_external.coerce.number().optional().default(5).describe("Number of context lines to include around changes."),
|
|
67957
67962
|
includeLineNumbers: exports_external.preprocess((val) => {
|
|
67958
67963
|
if (typeof val === "string") {
|
|
@@ -67964,8 +67969,7 @@ var toolInfo15 = {
|
|
|
67964
67969
|
}
|
|
67965
67970
|
return val;
|
|
67966
67971
|
}, exports_external.boolean().optional().default(false)).describe("Annotate the diff with line numbers for additions and deletions.")
|
|
67967
|
-
})
|
|
67968
|
-
permissionLevel: 1 /* Read */
|
|
67972
|
+
})
|
|
67969
67973
|
};
|
|
67970
67974
|
var handler15 = async (provider2, args) => {
|
|
67971
67975
|
if (!provider2.executeCommand) {
|
|
@@ -68049,50 +68053,64 @@ var prompt5 = `
|
|
|
68049
68053
|
You are a senior software engineer reviewing code changes.
|
|
68050
68054
|
|
|
68051
68055
|
## Critical Instructions
|
|
68052
|
-
**ONLY review the actual changes shown in the diff.** Do not comment on existing code that wasn't modified.
|
|
68056
|
+
- **ONLY review the actual changes shown in the diff.** Do not comment on existing code that wasn't modified.
|
|
68057
|
+
- **ONLY run git_diff on files that are reviewable source/config files** per the "File Selection for git_diff" rules below. Do not pass excluded files to git_diff.
|
|
68058
|
+
|
|
68059
|
+
## File Selection for git_diff
|
|
68060
|
+
Use <file_status> to decide which files to diff. Include only files likely to contain human-authored source or meaningful configuration.
|
|
68061
|
+
|
|
68062
|
+
Include (run git_diff):
|
|
68063
|
+
- Application/source code
|
|
68064
|
+
- UI/templates/assets code
|
|
68065
|
+
- Infra/config that affects behavior
|
|
68066
|
+
|
|
68067
|
+
Exclude (do NOT run git_diff; do not review):
|
|
68068
|
+
- Lockfiles
|
|
68069
|
+
- Generated/build artifacts & deps
|
|
68070
|
+
- Test artifacts/snapshots
|
|
68071
|
+
- Data and fixtures
|
|
68072
|
+
- Binary/media/minified/maps
|
|
68053
68073
|
|
|
68054
68074
|
## Viewing Changes
|
|
68055
|
-
- **
|
|
68056
|
-
- **Pull request
|
|
68057
|
-
- **Local changes
|
|
68058
|
-
- The diff will include line number annotations: [Line N] for additions and [Line N removed] for deletions
|
|
68059
|
-
-
|
|
68075
|
+
- For each included file, **use git_diff** to inspect the actual code changes:
|
|
68076
|
+
- **Pull request:** use the provided commit range for the git_diff tool with contextLines: 5 and includeLineNumbers: true, but only surface and review the included files.
|
|
68077
|
+
- **Local changes:** diff staged or unstaged included files using git_diff with contextLines: 5 and includeLineNumbers: true.
|
|
68078
|
+
- The diff will include line number annotations: [Line N] for additions and [Line N removed] for deletions.
|
|
68079
|
+
- You may receive:
|
|
68060
68080
|
- <pr_title>
|
|
68061
68081
|
- <pr_description>
|
|
68062
68082
|
- <commit_messages>
|
|
68063
68083
|
- A <review_instructions> tag tells you the focus of the review.
|
|
68064
|
-
-
|
|
68084
|
+
- Use <file_status> to understand which files were modified, added, deleted, or renamed and to apply the inclusion/exclusion rules above.
|
|
68065
68085
|
|
|
68066
68086
|
## Line Number Reporting
|
|
68067
|
-
-
|
|
68068
|
-
- For additions:
|
|
68069
|
-
- For deletions:
|
|
68070
|
-
- For modifications:
|
|
68071
|
-
- Report single lines as "N" and ranges as "N-M"
|
|
68087
|
+
- Use the line numbers from the annotations in the diff output.
|
|
68088
|
+
- For additions: use the number from the [Line N] annotation after the + line.
|
|
68089
|
+
- For deletions: use the number from the [Line N removed] annotation after the - line.
|
|
68090
|
+
- For modifications: report the line number of the new/current code (from [Line N]).
|
|
68091
|
+
- Report single lines as "N" and ranges as "N-M".
|
|
68072
68092
|
|
|
68073
68093
|
## Review Guidelines
|
|
68074
68094
|
Focus exclusively on the changed lines (+ additions, - deletions, modified lines):
|
|
68075
|
-
- **Specific issues
|
|
68076
|
-
- **Actionable fixes
|
|
68077
|
-
- **Clear reasoning
|
|
68078
|
-
- **Avoid generic advice
|
|
68095
|
+
- **Specific issues:** Point to exact problems in the changed code with accurate line references from the annotations.
|
|
68096
|
+
- **Actionable fixes:** Provide concrete solutions, not vague suggestions.
|
|
68097
|
+
- **Clear reasoning:** Explain why each issue matters and how to fix it.
|
|
68098
|
+
- **Avoid generic advice** unless directly tied to a specific problem visible in the diff.
|
|
68079
68099
|
|
|
68080
68100
|
## What NOT to review
|
|
68081
|
-
-
|
|
68082
|
-
-
|
|
68083
|
-
-
|
|
68084
|
-
- Missing features or functionality not part of this diff
|
|
68101
|
+
- Files excluded by the "File Selection for git_diff" rules (do not diff or comment on them).
|
|
68102
|
+
- Existing unchanged code.
|
|
68103
|
+
- Overall project structure/architecture unless directly impacted by the changes.
|
|
68104
|
+
- Missing features or functionality not part of this diff.
|
|
68085
68105
|
|
|
68086
68106
|
## Output Format
|
|
68087
|
-
Do
|
|
68107
|
+
Do not include praise or positive feedback.
|
|
68088
68108
|
Only include reviews for actual issues found in the changed code.
|
|
68089
68109
|
|
|
68090
68110
|
Return your review as a JSON object inside a \`\`\`json block, wrapped like:
|
|
68091
|
-
<tool_attempt_completion>
|
|
68092
|
-
<tool_parameter_result>
|
|
68093
68111
|
\`\`\`json
|
|
68094
68112
|
{
|
|
68095
|
-
"overview": "Summary of specific issues found in the diff changes,
|
|
68113
|
+
"overview": "Summary of specific issues found in the diff changes, 'No issues found', or 'No reviewable changes' if all modified files were excluded.",
|
|
68096
68114
|
"specificReviews": [
|
|
68097
68115
|
{
|
|
68098
68116
|
"file": "path/filename.ext",
|
|
@@ -68102,8 +68120,6 @@ Return your review as a JSON object inside a \`\`\`json block, wrapped like:
|
|
|
68102
68120
|
]
|
|
68103
68121
|
}
|
|
68104
68122
|
\`\`\`
|
|
68105
|
-
</tool_parameter_result>
|
|
68106
|
-
</tool_attempt_completion>
|
|
68107
68123
|
`;
|
|
68108
68124
|
var reviewDiff_default = {
|
|
68109
68125
|
name: "reviewDiff",
|
|
@@ -68165,7 +68181,8 @@ ${output}`,
|
|
|
68165
68181
|
agent: (options) => {
|
|
68166
68182
|
return new AnalyzerAgent({
|
|
68167
68183
|
...options,
|
|
68168
|
-
additionalTools: [gitDiff_default]
|
|
68184
|
+
additionalTools: [gitDiff_default],
|
|
68185
|
+
requireToolUse: false
|
|
68169
68186
|
});
|
|
68170
68187
|
}
|
|
68171
68188
|
};
|
|
@@ -68227,8 +68244,50 @@ var generateGithubPullRequestDetails = makeTool(generateGithubPullRequestDetails
|
|
|
68227
68244
|
var reviewDiff = makeAgentTool(reviewDiff_default);
|
|
68228
68245
|
var generateProjectConfig = makeMultiAgentTool(generateProjectConfig_default);
|
|
68229
68246
|
var createNewProject = makeMultiAgentTool(createNewProject_default);
|
|
68230
|
-
// ../
|
|
68247
|
+
// ../core/src/workflow/utils.ts
|
|
68231
68248
|
var import_lodash2 = __toESM(require_lodash(), 1);
|
|
68249
|
+
// ../core/src/workflow/builder.ts
|
|
68250
|
+
class StepsBuilder {
|
|
68251
|
+
#steps = [];
|
|
68252
|
+
build() {
|
|
68253
|
+
if (this.#steps.length === 0) {
|
|
68254
|
+
throw new Error("A workflow must have at least one step.");
|
|
68255
|
+
}
|
|
68256
|
+
const rootStep = this.#steps.length > 1 ? {
|
|
68257
|
+
id: "root",
|
|
68258
|
+
type: "sequential",
|
|
68259
|
+
steps: this.#steps
|
|
68260
|
+
} : this.#steps[0];
|
|
68261
|
+
return rootStep;
|
|
68262
|
+
}
|
|
68263
|
+
step(step) {
|
|
68264
|
+
this.#steps.push(step);
|
|
68265
|
+
return this;
|
|
68266
|
+
}
|
|
68267
|
+
parallel(id, step) {
|
|
68268
|
+
return this.step({
|
|
68269
|
+
id,
|
|
68270
|
+
type: "parallel",
|
|
68271
|
+
step
|
|
68272
|
+
});
|
|
68273
|
+
}
|
|
68274
|
+
custom(id, run) {
|
|
68275
|
+
return this.step({
|
|
68276
|
+
id,
|
|
68277
|
+
type: "custom",
|
|
68278
|
+
run
|
|
68279
|
+
});
|
|
68280
|
+
}
|
|
68281
|
+
agent(id, spec2) {
|
|
68282
|
+
return this.step({
|
|
68283
|
+
...spec2,
|
|
68284
|
+
id,
|
|
68285
|
+
type: "agent"
|
|
68286
|
+
});
|
|
68287
|
+
}
|
|
68288
|
+
}
|
|
68289
|
+
// ../cli-shared/src/config.ts
|
|
68290
|
+
var import_lodash3 = __toESM(require_lodash(), 1);
|
|
68232
68291
|
|
|
68233
68292
|
// ../cli-shared/node_modules/yaml/dist/index.js
|
|
68234
68293
|
var composer = require_composer();
|
|
@@ -70873,9 +70932,9 @@ class ZodUnion4 extends ZodType4 {
|
|
|
70873
70932
|
return this._def.options;
|
|
70874
70933
|
}
|
|
70875
70934
|
}
|
|
70876
|
-
ZodUnion4.create = (
|
|
70935
|
+
ZodUnion4.create = (types2, params) => {
|
|
70877
70936
|
return new ZodUnion4({
|
|
70878
|
-
options:
|
|
70937
|
+
options: types2,
|
|
70879
70938
|
typeName: ZodFirstPartyTypeKind4.ZodUnion,
|
|
70880
70939
|
...processCreateParams2(params)
|
|
70881
70940
|
});
|
|
@@ -72132,7 +72191,7 @@ function mergeConfigs(configs) {
|
|
|
72132
72191
|
return {};
|
|
72133
72192
|
}
|
|
72134
72193
|
const mergedConfig = configs.reduce((acc, config4) => {
|
|
72135
|
-
const merged =
|
|
72194
|
+
const merged = import_lodash3.merge({}, acc, config4);
|
|
72136
72195
|
let accRules = acc.rules ?? [];
|
|
72137
72196
|
if (typeof accRules === "string") {
|
|
72138
72197
|
accRules = [accRules];
|
|
@@ -73509,7 +73568,7 @@ function lookup(path) {
|
|
|
73509
73568
|
}
|
|
73510
73569
|
return $types[extension2] || false;
|
|
73511
73570
|
}
|
|
73512
|
-
function populateMaps(extensions,
|
|
73571
|
+
function populateMaps(extensions, types2) {
|
|
73513
73572
|
Object.keys(db).forEach(function forEachMimeType(type) {
|
|
73514
73573
|
var mime = db[type];
|
|
73515
73574
|
var exts = mime.extensions;
|
|
@@ -73519,10 +73578,10 @@ function populateMaps(extensions, types) {
|
|
|
73519
73578
|
extensions[type] = exts;
|
|
73520
73579
|
for (var i = 0;i < exts.length; i++) {
|
|
73521
73580
|
var extension2 = exts[i];
|
|
73522
|
-
|
|
73523
|
-
const legacyType = _preferredTypeLegacy(extension2,
|
|
73524
|
-
if (legacyType !==
|
|
73525
|
-
$_extensionConflicts.push([extension2, legacyType,
|
|
73581
|
+
types2[extension2] = _preferredType(extension2, types2[extension2], type);
|
|
73582
|
+
const legacyType = _preferredTypeLegacy(extension2, types2[extension2], type);
|
|
73583
|
+
if (legacyType !== types2[extension2]) {
|
|
73584
|
+
$_extensionConflicts.push([extension2, legacyType, types2[extension2]]);
|
|
73526
73585
|
}
|
|
73527
73586
|
}
|
|
73528
73587
|
});
|
|
@@ -73767,10 +73826,10 @@ var getProvider = (_agentName, _config, options = {}) => {
|
|
|
73767
73826
|
mediaType
|
|
73768
73827
|
};
|
|
73769
73828
|
},
|
|
73770
|
-
executeCommand: (
|
|
73829
|
+
executeCommand: (command2, _needApprove) => {
|
|
73771
73830
|
return new Promise((resolve4, reject) => {
|
|
73772
|
-
options.command?.onStarted(
|
|
73773
|
-
const child = spawn2(
|
|
73831
|
+
options.command?.onStarted(command2);
|
|
73832
|
+
const child = spawn2(command2, [], {
|
|
73774
73833
|
shell: true,
|
|
73775
73834
|
stdio: "pipe"
|
|
73776
73835
|
});
|
|
@@ -76461,9 +76520,9 @@ class ZodUnion5 extends ZodType5 {
|
|
|
76461
76520
|
return this._def.options;
|
|
76462
76521
|
}
|
|
76463
76522
|
}
|
|
76464
|
-
ZodUnion5.create = (
|
|
76523
|
+
ZodUnion5.create = (types2, params) => {
|
|
76465
76524
|
return new ZodUnion5({
|
|
76466
|
-
options:
|
|
76525
|
+
options: types2,
|
|
76467
76526
|
typeName: ZodFirstPartyTypeKind5.ZodUnion,
|
|
76468
76527
|
...processCreateParams3(params)
|
|
76469
76528
|
});
|
|
@@ -78072,8 +78131,8 @@ class Runner {
|
|
|
78072
78131
|
const config5 = loadConfig() ?? {};
|
|
78073
78132
|
this.provider = getProvider("coder", config5 || {}, {
|
|
78074
78133
|
command: {
|
|
78075
|
-
onStarted(
|
|
78076
|
-
console.log(`$ >>>> $ ${
|
|
78134
|
+
onStarted(command2) {
|
|
78135
|
+
console.log(`$ >>>> $ ${command2}`);
|
|
78077
78136
|
},
|
|
78078
78137
|
onStdout(data) {
|
|
78079
78138
|
process.stdout.write(data);
|