@polka-codes/runner 0.9.33 → 0.9.34

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -731
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -30494,7 +30494,7 @@ var {
30494
30494
  Help
30495
30495
  } = import__.default;
30496
30496
  // package.json
30497
- var version = "0.9.33";
30497
+ var version = "0.9.34";
30498
30498
 
30499
30499
  // src/runner.ts
30500
30500
  import { execSync } from "node:child_process";
@@ -51470,13 +51470,6 @@ function prepareRetries({
51470
51470
  })
51471
51471
  };
51472
51472
  }
51473
- function extractTextContent(content) {
51474
- const parts = content.filter((content2) => content2.type === "text");
51475
- if (parts.length === 0) {
51476
- return;
51477
- }
51478
- return parts.map((content2) => content2.text).join("");
51479
- }
51480
51473
  var DefaultGeneratedFile = class {
51481
51474
  constructor({
51482
51475
  data,
@@ -51768,519 +51761,6 @@ var originalGenerateId = createIdGenerator({
51768
51761
  prefix: "aitxt",
51769
51762
  size: 24
51770
51763
  });
51771
- async function generateText({
51772
- model: modelArg,
51773
- tools,
51774
- toolChoice,
51775
- system,
51776
- prompt,
51777
- messages,
51778
- maxRetries: maxRetriesArg,
51779
- abortSignal,
51780
- headers,
51781
- stopWhen = stepCountIs(1),
51782
- experimental_output: output,
51783
- experimental_telemetry: telemetry,
51784
- providerOptions,
51785
- experimental_activeTools,
51786
- activeTools = experimental_activeTools,
51787
- experimental_prepareStep,
51788
- prepareStep = experimental_prepareStep,
51789
- experimental_repairToolCall: repairToolCall,
51790
- experimental_download: download2,
51791
- experimental_context,
51792
- _internal: {
51793
- generateId: generateId3 = originalGenerateId,
51794
- currentDate = () => /* @__PURE__ */ new Date
51795
- } = {},
51796
- onStepFinish,
51797
- ...settings
51798
- }) {
51799
- const model = resolveLanguageModel(modelArg);
51800
- const stopConditions = asArray(stopWhen);
51801
- const { maxRetries, retry } = prepareRetries({
51802
- maxRetries: maxRetriesArg,
51803
- abortSignal
51804
- });
51805
- const callSettings = prepareCallSettings(settings);
51806
- const baseTelemetryAttributes = getBaseTelemetryAttributes({
51807
- model,
51808
- telemetry,
51809
- headers,
51810
- settings: { ...callSettings, maxRetries }
51811
- });
51812
- const initialPrompt = await standardizePrompt({
51813
- system,
51814
- prompt,
51815
- messages
51816
- });
51817
- const tracer = getTracer(telemetry);
51818
- try {
51819
- return await recordSpan({
51820
- name: "ai.generateText",
51821
- attributes: selectTelemetryAttributes({
51822
- telemetry,
51823
- attributes: {
51824
- ...assembleOperationName({
51825
- operationId: "ai.generateText",
51826
- telemetry
51827
- }),
51828
- ...baseTelemetryAttributes,
51829
- "ai.model.provider": model.provider,
51830
- "ai.model.id": model.modelId,
51831
- "ai.prompt": {
51832
- input: () => JSON.stringify({ system, prompt, messages })
51833
- }
51834
- }
51835
- }),
51836
- tracer,
51837
- fn: async (span) => {
51838
- var _a172, _b8, _c, _d, _e, _f, _g;
51839
- const callSettings2 = prepareCallSettings(settings);
51840
- let currentModelResponse;
51841
- let clientToolCalls = [];
51842
- let clientToolOutputs = [];
51843
- const responseMessages = [];
51844
- const steps = [];
51845
- do {
51846
- const stepInputMessages = [
51847
- ...initialPrompt.messages,
51848
- ...responseMessages
51849
- ];
51850
- const prepareStepResult = await (prepareStep == null ? undefined : prepareStep({
51851
- model,
51852
- steps,
51853
- stepNumber: steps.length,
51854
- messages: stepInputMessages
51855
- }));
51856
- const promptMessages = await convertToLanguageModelPrompt({
51857
- prompt: {
51858
- system: (_a172 = prepareStepResult == null ? undefined : prepareStepResult.system) != null ? _a172 : initialPrompt.system,
51859
- messages: (_b8 = prepareStepResult == null ? undefined : prepareStepResult.messages) != null ? _b8 : stepInputMessages
51860
- },
51861
- supportedUrls: await model.supportedUrls,
51862
- download: download2
51863
- });
51864
- const stepModel = resolveLanguageModel((_c = prepareStepResult == null ? undefined : prepareStepResult.model) != null ? _c : model);
51865
- const { toolChoice: stepToolChoice, tools: stepTools } = prepareToolsAndToolChoice({
51866
- tools,
51867
- toolChoice: (_d = prepareStepResult == null ? undefined : prepareStepResult.toolChoice) != null ? _d : toolChoice,
51868
- activeTools: (_e = prepareStepResult == null ? undefined : prepareStepResult.activeTools) != null ? _e : activeTools
51869
- });
51870
- currentModelResponse = await retry(() => {
51871
- var _a18;
51872
- return recordSpan({
51873
- name: "ai.generateText.doGenerate",
51874
- attributes: selectTelemetryAttributes({
51875
- telemetry,
51876
- attributes: {
51877
- ...assembleOperationName({
51878
- operationId: "ai.generateText.doGenerate",
51879
- telemetry
51880
- }),
51881
- ...baseTelemetryAttributes,
51882
- "ai.model.provider": stepModel.provider,
51883
- "ai.model.id": stepModel.modelId,
51884
- "ai.prompt.messages": {
51885
- input: () => stringifyForTelemetry(promptMessages)
51886
- },
51887
- "ai.prompt.tools": {
51888
- input: () => stepTools == null ? undefined : stepTools.map((tool3) => JSON.stringify(tool3))
51889
- },
51890
- "ai.prompt.toolChoice": {
51891
- input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
51892
- },
51893
- "gen_ai.system": stepModel.provider,
51894
- "gen_ai.request.model": stepModel.modelId,
51895
- "gen_ai.request.frequency_penalty": settings.frequencyPenalty,
51896
- "gen_ai.request.max_tokens": settings.maxOutputTokens,
51897
- "gen_ai.request.presence_penalty": settings.presencePenalty,
51898
- "gen_ai.request.stop_sequences": settings.stopSequences,
51899
- "gen_ai.request.temperature": (_a18 = settings.temperature) != null ? _a18 : undefined,
51900
- "gen_ai.request.top_k": settings.topK,
51901
- "gen_ai.request.top_p": settings.topP
51902
- }
51903
- }),
51904
- tracer,
51905
- fn: async (span2) => {
51906
- var _a19, _b22, _c2, _d2, _e2, _f2, _g2, _h;
51907
- const result = await stepModel.doGenerate({
51908
- ...callSettings2,
51909
- tools: stepTools,
51910
- toolChoice: stepToolChoice,
51911
- responseFormat: output == null ? undefined : output.responseFormat,
51912
- prompt: promptMessages,
51913
- providerOptions,
51914
- abortSignal,
51915
- headers
51916
- });
51917
- const responseData = {
51918
- id: (_b22 = (_a19 = result.response) == null ? undefined : _a19.id) != null ? _b22 : generateId3(),
51919
- timestamp: (_d2 = (_c2 = result.response) == null ? undefined : _c2.timestamp) != null ? _d2 : currentDate(),
51920
- modelId: (_f2 = (_e2 = result.response) == null ? undefined : _e2.modelId) != null ? _f2 : stepModel.modelId,
51921
- headers: (_g2 = result.response) == null ? undefined : _g2.headers,
51922
- body: (_h = result.response) == null ? undefined : _h.body
51923
- };
51924
- span2.setAttributes(selectTelemetryAttributes({
51925
- telemetry,
51926
- attributes: {
51927
- "ai.response.finishReason": result.finishReason,
51928
- "ai.response.text": {
51929
- output: () => extractTextContent(result.content)
51930
- },
51931
- "ai.response.toolCalls": {
51932
- output: () => {
51933
- const toolCalls = asToolCalls(result.content);
51934
- return toolCalls == null ? undefined : JSON.stringify(toolCalls);
51935
- }
51936
- },
51937
- "ai.response.id": responseData.id,
51938
- "ai.response.model": responseData.modelId,
51939
- "ai.response.timestamp": responseData.timestamp.toISOString(),
51940
- "ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
51941
- "ai.usage.promptTokens": result.usage.inputTokens,
51942
- "ai.usage.completionTokens": result.usage.outputTokens,
51943
- "gen_ai.response.finish_reasons": [result.finishReason],
51944
- "gen_ai.response.id": responseData.id,
51945
- "gen_ai.response.model": responseData.modelId,
51946
- "gen_ai.usage.input_tokens": result.usage.inputTokens,
51947
- "gen_ai.usage.output_tokens": result.usage.outputTokens
51948
- }
51949
- }));
51950
- return { ...result, response: responseData };
51951
- }
51952
- });
51953
- });
51954
- const stepToolCalls = await Promise.all(currentModelResponse.content.filter((part) => part.type === "tool-call").map((toolCall) => parseToolCall({
51955
- toolCall,
51956
- tools,
51957
- repairToolCall,
51958
- system,
51959
- messages: stepInputMessages
51960
- })));
51961
- for (const toolCall of stepToolCalls) {
51962
- if (toolCall.invalid) {
51963
- continue;
51964
- }
51965
- const tool3 = tools[toolCall.toolName];
51966
- if ((tool3 == null ? undefined : tool3.onInputAvailable) != null) {
51967
- await tool3.onInputAvailable({
51968
- input: toolCall.input,
51969
- toolCallId: toolCall.toolCallId,
51970
- messages: stepInputMessages,
51971
- abortSignal,
51972
- experimental_context
51973
- });
51974
- }
51975
- }
51976
- const invalidToolCalls = stepToolCalls.filter((toolCall) => toolCall.invalid && toolCall.dynamic);
51977
- clientToolOutputs = [];
51978
- for (const toolCall of invalidToolCalls) {
51979
- clientToolOutputs.push({
51980
- type: "tool-error",
51981
- toolCallId: toolCall.toolCallId,
51982
- toolName: toolCall.toolName,
51983
- input: toolCall.input,
51984
- error: getErrorMessage2(toolCall.error),
51985
- dynamic: true
51986
- });
51987
- }
51988
- clientToolCalls = stepToolCalls.filter((toolCall) => !toolCall.providerExecuted);
51989
- if (tools != null) {
51990
- clientToolOutputs.push(...await executeTools({
51991
- toolCalls: clientToolCalls.filter((toolCall) => !toolCall.invalid),
51992
- tools,
51993
- tracer,
51994
- telemetry,
51995
- messages: stepInputMessages,
51996
- abortSignal,
51997
- experimental_context
51998
- }));
51999
- }
52000
- const stepContent = asContent({
52001
- content: currentModelResponse.content,
52002
- toolCalls: stepToolCalls,
52003
- toolOutputs: clientToolOutputs
52004
- });
52005
- responseMessages.push(...toResponseMessages({
52006
- content: stepContent,
52007
- tools
52008
- }));
52009
- const currentStepResult = new DefaultStepResult({
52010
- content: stepContent,
52011
- finishReason: currentModelResponse.finishReason,
52012
- usage: currentModelResponse.usage,
52013
- warnings: currentModelResponse.warnings,
52014
- providerMetadata: currentModelResponse.providerMetadata,
52015
- request: (_f = currentModelResponse.request) != null ? _f : {},
52016
- response: {
52017
- ...currentModelResponse.response,
52018
- messages: structuredClone(responseMessages)
52019
- }
52020
- });
52021
- logWarnings((_g = currentModelResponse.warnings) != null ? _g : []);
52022
- steps.push(currentStepResult);
52023
- await (onStepFinish == null ? undefined : onStepFinish(currentStepResult));
52024
- } while (clientToolCalls.length > 0 && clientToolOutputs.length === clientToolCalls.length && !await isStopConditionMet({ stopConditions, steps }));
52025
- span.setAttributes(selectTelemetryAttributes({
52026
- telemetry,
52027
- attributes: {
52028
- "ai.response.finishReason": currentModelResponse.finishReason,
52029
- "ai.response.text": {
52030
- output: () => extractTextContent(currentModelResponse.content)
52031
- },
52032
- "ai.response.toolCalls": {
52033
- output: () => {
52034
- const toolCalls = asToolCalls(currentModelResponse.content);
52035
- return toolCalls == null ? undefined : JSON.stringify(toolCalls);
52036
- }
52037
- },
52038
- "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
52039
- "ai.usage.promptTokens": currentModelResponse.usage.inputTokens,
52040
- "ai.usage.completionTokens": currentModelResponse.usage.outputTokens
52041
- }
52042
- }));
52043
- const lastStep = steps[steps.length - 1];
52044
- return new DefaultGenerateTextResult({
52045
- steps,
52046
- resolvedOutput: await (output == null ? undefined : output.parseOutput({ text: lastStep.text }, {
52047
- response: lastStep.response,
52048
- usage: lastStep.usage,
52049
- finishReason: lastStep.finishReason
52050
- }))
52051
- });
52052
- }
52053
- });
52054
- } catch (error43) {
52055
- throw wrapGatewayError(error43);
52056
- }
52057
- }
52058
- async function executeTools({
52059
- toolCalls,
52060
- tools,
52061
- tracer,
52062
- telemetry,
52063
- messages,
52064
- abortSignal,
52065
- experimental_context
52066
- }) {
52067
- const toolOutputs = await Promise.all(toolCalls.map(async ({ toolCallId, toolName, input }) => {
52068
- const tool3 = tools[toolName];
52069
- if ((tool3 == null ? undefined : tool3.execute) == null) {
52070
- return;
52071
- }
52072
- return recordSpan({
52073
- name: "ai.toolCall",
52074
- attributes: selectTelemetryAttributes({
52075
- telemetry,
52076
- attributes: {
52077
- ...assembleOperationName({
52078
- operationId: "ai.toolCall",
52079
- telemetry
52080
- }),
52081
- "ai.toolCall.name": toolName,
52082
- "ai.toolCall.id": toolCallId,
52083
- "ai.toolCall.args": {
52084
- output: () => JSON.stringify(input)
52085
- }
52086
- }
52087
- }),
52088
- tracer,
52089
- fn: async (span) => {
52090
- try {
52091
- const stream = executeTool({
52092
- execute: tool3.execute.bind(tool3),
52093
- input,
52094
- options: {
52095
- toolCallId,
52096
- messages,
52097
- abortSignal,
52098
- experimental_context
52099
- }
52100
- });
52101
- let output;
52102
- for await (const part of stream) {
52103
- if (part.type === "final") {
52104
- output = part.output;
52105
- }
52106
- }
52107
- try {
52108
- span.setAttributes(selectTelemetryAttributes({
52109
- telemetry,
52110
- attributes: {
52111
- "ai.toolCall.result": {
52112
- output: () => JSON.stringify(output)
52113
- }
52114
- }
52115
- }));
52116
- } catch (ignored) {}
52117
- return {
52118
- type: "tool-result",
52119
- toolCallId,
52120
- toolName,
52121
- input,
52122
- output,
52123
- dynamic: tool3.type === "dynamic"
52124
- };
52125
- } catch (error43) {
52126
- recordErrorOnSpan(span, error43);
52127
- return {
52128
- type: "tool-error",
52129
- toolCallId,
52130
- toolName,
52131
- input,
52132
- error: error43,
52133
- dynamic: tool3.type === "dynamic"
52134
- };
52135
- }
52136
- }
52137
- });
52138
- }));
52139
- return toolOutputs.filter((output) => output != null);
52140
- }
52141
- var DefaultGenerateTextResult = class {
52142
- constructor(options) {
52143
- this.steps = options.steps;
52144
- this.resolvedOutput = options.resolvedOutput;
52145
- }
52146
- get finalStep() {
52147
- return this.steps[this.steps.length - 1];
52148
- }
52149
- get content() {
52150
- return this.finalStep.content;
52151
- }
52152
- get text() {
52153
- return this.finalStep.text;
52154
- }
52155
- get files() {
52156
- return this.finalStep.files;
52157
- }
52158
- get reasoningText() {
52159
- return this.finalStep.reasoningText;
52160
- }
52161
- get reasoning() {
52162
- return this.finalStep.reasoning;
52163
- }
52164
- get toolCalls() {
52165
- return this.finalStep.toolCalls;
52166
- }
52167
- get staticToolCalls() {
52168
- return this.finalStep.staticToolCalls;
52169
- }
52170
- get dynamicToolCalls() {
52171
- return this.finalStep.dynamicToolCalls;
52172
- }
52173
- get toolResults() {
52174
- return this.finalStep.toolResults;
52175
- }
52176
- get staticToolResults() {
52177
- return this.finalStep.staticToolResults;
52178
- }
52179
- get dynamicToolResults() {
52180
- return this.finalStep.dynamicToolResults;
52181
- }
52182
- get sources() {
52183
- return this.finalStep.sources;
52184
- }
52185
- get finishReason() {
52186
- return this.finalStep.finishReason;
52187
- }
52188
- get warnings() {
52189
- return this.finalStep.warnings;
52190
- }
52191
- get providerMetadata() {
52192
- return this.finalStep.providerMetadata;
52193
- }
52194
- get response() {
52195
- return this.finalStep.response;
52196
- }
52197
- get request() {
52198
- return this.finalStep.request;
52199
- }
52200
- get usage() {
52201
- return this.finalStep.usage;
52202
- }
52203
- get totalUsage() {
52204
- return this.steps.reduce((totalUsage, step) => {
52205
- return addLanguageModelUsage(totalUsage, step.usage);
52206
- }, {
52207
- inputTokens: undefined,
52208
- outputTokens: undefined,
52209
- totalTokens: undefined,
52210
- reasoningTokens: undefined,
52211
- cachedInputTokens: undefined
52212
- });
52213
- }
52214
- get experimental_output() {
52215
- if (this.resolvedOutput == null) {
52216
- throw new NoOutputSpecifiedError;
52217
- }
52218
- return this.resolvedOutput;
52219
- }
52220
- };
52221
- function asToolCalls(content) {
52222
- const parts = content.filter((part) => part.type === "tool-call");
52223
- if (parts.length === 0) {
52224
- return;
52225
- }
52226
- return parts.map((toolCall) => ({
52227
- toolCallId: toolCall.toolCallId,
52228
- toolName: toolCall.toolName,
52229
- input: toolCall.input
52230
- }));
52231
- }
52232
- function asContent({
52233
- content,
52234
- toolCalls,
52235
- toolOutputs
52236
- }) {
52237
- return [
52238
- ...content.map((part) => {
52239
- switch (part.type) {
52240
- case "text":
52241
- case "reasoning":
52242
- case "source":
52243
- return part;
52244
- case "file": {
52245
- return {
52246
- type: "file",
52247
- file: new DefaultGeneratedFile(part)
52248
- };
52249
- }
52250
- case "tool-call": {
52251
- return toolCalls.find((toolCall) => toolCall.toolCallId === part.toolCallId);
52252
- }
52253
- case "tool-result": {
52254
- const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
52255
- if (toolCall == null) {
52256
- throw new Error(`Tool call ${part.toolCallId} not found.`);
52257
- }
52258
- if (part.isError) {
52259
- return {
52260
- type: "tool-error",
52261
- toolCallId: part.toolCallId,
52262
- toolName: part.toolName,
52263
- input: toolCall.input,
52264
- error: part.result,
52265
- providerExecuted: true,
52266
- dynamic: toolCall.dynamic
52267
- };
52268
- }
52269
- return {
52270
- type: "tool-result",
52271
- toolCallId: part.toolCallId,
52272
- toolName: part.toolName,
52273
- input: toolCall.input,
52274
- output: part.result,
52275
- providerExecuted: true,
52276
- dynamic: toolCall.dynamic
52277
- };
52278
- }
52279
- }
52280
- }),
52281
- ...toolOutputs
52282
- ];
52283
- }
52284
51764
  function prepareHeaders(headers, defaultHeaders) {
52285
51765
  const responseHeaders = new Headers(headers != null ? headers : {});
52286
51766
  for (const [key, value] of Object.entries(defaultHeaders)) {
@@ -57069,189 +56549,8 @@ var createNewProject_default = {
57069
56549
  agent: "architect"
57070
56550
  };
57071
56551
 
57072
- // ../core/src/AiTool/generateGitCommitMessage.ts
57073
- var prompt2 = `
57074
- You are an advanced assistant specialized in creating concise and accurate Git commit messages. When you receive:
57075
- - A Git diff inside the <tool_input> tag.
57076
- - Additional user-supplied context inside the <tool_input_context> tag (if any).
57077
-
57078
- You will produce a single commit message enclosed within <tool_output> tags. The commit message must accurately reflect the changes shown in the diff and should be clear, descriptive, and devoid of unnecessary or repeated information. If a context is provided, it MUST be incorporated into the commit message.
57079
-
57080
- Here’s an example of the input and the expected output format:
57081
-
57082
- <tool_input>
57083
- --- a/example_file.py
57084
- +++ b/example_file.py
57085
- @@ -10,7 +10,7 @@ def example_function():
57086
- - print("Old behavior")
57087
- + print("New behavior")
57088
- </tool_input>
57089
- <tool_input_context>
57090
- Changing print statement to update the user-facing message.
57091
- </tool_input_context>
57092
-
57093
- Example Output:
57094
-
57095
- <tool_output>
57096
- Update print statement for revised user-facing message
57097
- </tool_output>
57098
-
57099
- 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.
57100
- `;
57101
- var generateGitCommitMessage_default = {
57102
- name: "generateGitCommitMessage",
57103
- description: "Generates git commit messages from git diff output",
57104
- prompt: prompt2,
57105
- formatInput: (params) => {
57106
- let ret = `<tool_input>
57107
- ${params.diff}
57108
- </tool_input>`;
57109
- if (params.context) {
57110
- ret += `
57111
- <tool_input_context>
57112
- ${params.context}
57113
- </tool_input_context>`;
57114
- }
57115
- return ret;
57116
- },
57117
- parseOutput: (output) => {
57118
- const regex = /<tool_output>([\s\S]*)<\/tool_output>/gm;
57119
- const match = regex.exec(output);
57120
- if (match) {
57121
- return match[1];
57122
- }
57123
- throw new Error(`Could not parse output:
57124
- ${output}`);
57125
- }
57126
- };
57127
-
57128
- // ../core/src/AiTool/generateGithubPullRequestDetails.ts
57129
- var prompt3 = `
57130
- # Generate Github Pull Request Details
57131
-
57132
- You are given:
57133
- - A branch name in <tool_input_branch_name>.
57134
- - An optional context message in <tool_input_context> (which may or may not be present).
57135
- - All commit messages combined in <tool_input_commit_messages>.
57136
- - All diffs combined in <tool_input_commit_diff>.
57137
-
57138
- Your task:
57139
- 1. Consider the optional context (if provided).
57140
- - If an issue number is found, add "Closes #xxx" at the beginning of the PR description
57141
- - IMPORTANT: Use ONLY the exact format "Closes #xxx" at the beginning of the description
57142
- - DO NOT use variations like "Closes issue #xxx" or other formats
57143
- 2. Analyze the combined commit messages and diffs.
57144
- 3. Produce a single GitHub Pull Request title.
57145
- 4. Produce a Pull Request description that explains the changes.
57146
-
57147
- Use the following template for the Pull Request description:
57148
-
57149
- ---
57150
- **Context (if provided)**:
57151
- - Acknowledge any guiding concerns or instructions.
57152
-
57153
- **Summary of Changes**:
57154
- - Provide a concise list or overview of what changed.
57155
-
57156
- **Highlights of Changed Code**:
57157
- - Mention only the specific sections or functionalities updated, without showing full surrounding context.
57158
-
57159
- **Additional Information (if needed)**:
57160
- - Testing steps (if applicable).
57161
- - Any notes or caveats.
57162
-
57163
- ---
57164
-
57165
- Output format:
57166
- <tool_output>
57167
- <tool_output_pr_title>YOUR PR TITLE HERE</tool_output_pr_title>
57168
- <tool_output_pr_description>
57169
- YOUR PR DESCRIPTION HERE
57170
- </tool_output_pr_description>
57171
- </tool_output>
57172
-
57173
- Below is an **example** of the input and output:
57174
-
57175
- Example Input:
57176
- <tool_input>
57177
- <tool_input_branch_name>feature/refactor-logging</tool_input_branch_name>
57178
- <tool_input_context>Implementing changes for issue #123 - Focus on clean code and maintainability</tool_input_context>
57179
- <tool_input_commit_messages>
57180
- Remove debug logs
57181
- Refactor order validation logic
57182
- </tool_input_commit_messages>
57183
- <tool_input_commit_diff>
57184
- diff --git a/user_service.py b/user_service.py
57185
- - print("Debug info")
57186
- + # Removed debug print statements
57187
-
57188
- diff --git a/order_service.py b/order_service.py
57189
- - if is_valid_order(order):
57190
- - process_order(order)
57191
- + validate_and_process(order)
57192
- </tool_input_commit_diff>
57193
- </tool_input>
57194
-
57195
- Example Output:
57196
- <tool_output>
57197
- <tool_output_pr_title>Refactor Order Validation and Remove Debug Logs</tool_output_pr_title>
57198
- <tool_output_pr_description>
57199
- Closes #123
57200
-
57201
- **Context**:
57202
- - Implementing changes for issue #123 - Focus on clean code and maintainability
57203
-
57204
- **Summary of Changes**:
57205
- - Refactored order validation logic to use a new \`validate_and_process\` method.
57206
- - Removed debug print statements from \`user_service.py\`.
57207
-
57208
- **Highlights of Changed Code**:
57209
- - \`order_service.py\`: Replaced direct call to \`process_order\` with \`validate_and_process\`.
57210
- - \`user_service.py\`: Removed \`print("Debug info")\`.
57211
- </tool_output_pr_description>
57212
- </tool_output>
57213
-
57214
- ---
57215
-
57216
- Use the above format whenever you receive <tool_input> that may include a branch name, an optional context, aggregated commit messages in a single tag, and a combined diff in a single tag. Provide your final output strictly in <tool_output> with <tool_output_pr_title> and <tool_output_pr_description>. Only highlight the changed code and avoid including the context around the changes in the description.
57217
- `;
57218
- var generateGithubPullRequestDetails_default = {
57219
- name: "generateGithubPullRequestDetails",
57220
- description: "Generates a GitHub pull request title and description from git commits",
57221
- prompt: prompt3,
57222
- formatInput: (params) => {
57223
- return `<tool_input>
57224
- <tool_input_branch_name>${params.branchName}</tool_input_branch_name>${params.context ? `
57225
- <tool_input_context>${params.context}</tool_input_context>` : ""}
57226
- <tool_input_commit_messages>${params.commitMessages}</tool_input_commit_messages>
57227
- <tool_input_commit_diff>${params.commitDiff}</tool_input_commit_diff>
57228
- </tool_input>`;
57229
- },
57230
- parseOutput: (output) => {
57231
- const regex = /<tool_output>([\s\S]*)<\/tool_output>/gm;
57232
- const match = regex.exec(output);
57233
- if (!match) {
57234
- throw new Error(`Could not parse output:
57235
- ${output}`);
57236
- }
57237
- const [, outputContent] = match;
57238
- const titleRegex = /<tool_output_pr_title>([\s\S]*)<\/tool_output_pr_title>/gm;
57239
- const titleMatch = titleRegex.exec(outputContent);
57240
- const descriptionRegex = /<tool_output_pr_description>([\s\S]*)<\/tool_output_pr_description>/gm;
57241
- const descriptionMatch = descriptionRegex.exec(outputContent);
57242
- if (titleMatch && descriptionMatch) {
57243
- return {
57244
- title: titleMatch[1],
57245
- description: descriptionMatch[1]
57246
- };
57247
- }
57248
- throw new Error(`Could not parse output:
57249
- ${output}`);
57250
- }
57251
- };
57252
-
57253
56552
  // ../core/src/AiTool/generateProjectConfig.ts
57254
- var prompt4 = `
56553
+ var prompt2 = `
57255
56554
  Role: Analyzer agent
57256
56555
  Goal: Produce a valid polkacodes YAML configuration for the project.
57257
56556
 
@@ -57298,7 +56597,7 @@ excludeFiles: # only files likely to hold secrets
57298
56597
  var generateProjectConfig_default = {
57299
56598
  name: "generateProjectConfig",
57300
56599
  description: "Analyzes project files to generate polkacodes config sections",
57301
- prompt: prompt4,
56600
+ prompt: prompt2,
57302
56601
  formatInput: () => {
57303
56602
  return "";
57304
56603
  },
@@ -57309,21 +56608,6 @@ var generateProjectConfig_default = {
57309
56608
  };
57310
56609
 
57311
56610
  // ../core/src/AiTool/index.ts
57312
- var executeTool2 = async (definition, ai, params, usageMeter) => {
57313
- const resp = await generateText({
57314
- model: ai,
57315
- temperature: 0,
57316
- system: definition.prompt,
57317
- messages: [
57318
- {
57319
- role: "user",
57320
- content: definition.formatInput(params)
57321
- }
57322
- ]
57323
- });
57324
- usageMeter.addUsage(ai, resp);
57325
- return definition.parseOutput(resp.text);
57326
- };
57327
56611
  var executeMultiAgentTool = async (definition, agent, params) => {
57328
56612
  const exitReason = await agent.startTask({
57329
56613
  agentName: definition.agent,
@@ -57335,18 +56619,11 @@ var executeMultiAgentTool = async (definition, agent, params) => {
57335
56619
  }
57336
56620
  throw new Error(`Tool execution failed: ${exitReason.type}`);
57337
56621
  };
57338
- var makeTool = (definition) => {
57339
- return async (ai, params, usageMeter) => {
57340
- return executeTool2(definition, ai, params, usageMeter);
57341
- };
57342
- };
57343
56622
  var makeMultiAgentTool = (definition) => {
57344
56623
  return async (agent, params) => {
57345
56624
  return executeMultiAgentTool(definition, agent, params);
57346
56625
  };
57347
56626
  };
57348
- var generateGitCommitMessage = makeTool(generateGitCommitMessage_default);
57349
- var generateGithubPullRequestDetails = makeTool(generateGithubPullRequestDetails_default);
57350
56627
  var generateProjectConfig = makeMultiAgentTool(generateProjectConfig_default);
57351
56628
  var createNewProject = makeMultiAgentTool(createNewProject_default);
57352
56629
  // ../core/src/workflow/utils.ts
@@ -62259,11 +61536,11 @@ class ScreenManager {
62259
61536
  render(content, bottomContent = "") {
62260
61537
  const promptLine = lastLine(content);
62261
61538
  const rawPromptLine = stripVTControlCharacters(promptLine);
62262
- let prompt5 = rawPromptLine;
61539
+ let prompt3 = rawPromptLine;
62263
61540
  if (this.rl.line.length > 0) {
62264
- prompt5 = prompt5.slice(0, -this.rl.line.length);
61541
+ prompt3 = prompt3.slice(0, -this.rl.line.length);
62265
61542
  }
62266
- this.rl.setPrompt(prompt5);
61543
+ this.rl.setPrompt(prompt3);
62267
61544
  this.cursorPos = this.rl.getCursorPos();
62268
61545
  const width = readlineWidth();
62269
61546
  content = breakLines(content, width);
@@ -62333,7 +61610,7 @@ function getCallSites() {
62333
61610
  }
62334
61611
  function createPrompt(view) {
62335
61612
  const callSites = getCallSites();
62336
- const prompt5 = (config3, context = {}) => {
61613
+ const prompt3 = (config3, context = {}) => {
62337
61614
  const { input = process.stdin, signal } = context;
62338
61615
  const cleanups = new Set;
62339
61616
  const output = new import_mute_stream.default;
@@ -62398,7 +61675,7 @@ function createPrompt(view) {
62398
61675
  }).then(() => promise2), { cancel });
62399
61676
  });
62400
61677
  };
62401
- return prompt5;
61678
+ return prompt3;
62402
61679
  }
62403
61680
  // ../../node_modules/@inquirer/core/dist/esm/lib/Separator.js
62404
61681
  var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/runner",
3
- "version": "0.9.33",
3
+ "version": "0.9.34",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",