@polka-codes/cli 0.9.51 → 0.9.52

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 +21 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -35579,7 +35579,7 @@ var {
35579
35579
  Help
35580
35580
  } = import__.default;
35581
35581
  // package.json
35582
- var version = "0.9.51";
35582
+ var version = "0.9.52";
35583
35583
 
35584
35584
  // src/commands/code.ts
35585
35585
  import { readFile as readFile3 } from "node:fs/promises";
@@ -64388,7 +64388,8 @@ var agentWorkflow = async (input, { step, tools: tools2 }) => {
64388
64388
  const assistantMessage = await step(`agent-round-${i}`, async () => {
64389
64389
  return await tools2.generateText({
64390
64390
  messages,
64391
- tools: toolSet
64391
+ tools: toolSet,
64392
+ model: input.model
64392
64393
  });
64393
64394
  });
64394
64395
  messages.push(...assistantMessage);
@@ -64423,7 +64424,7 @@ var agentWorkflow = async (input, { step, tools: tools2 }) => {
64423
64424
  await event(`end-round-${i}`, { kind: "EndRequest" /* EndRequest */, message: textContent });
64424
64425
  if (toolCalls.length === 0) {
64425
64426
  if (!input.outputSchema) {
64426
- const exitReason2 = { type: "Exit" /* Exit */, message: textContent };
64427
+ const exitReason2 = { type: "Exit", message: textContent, messages };
64427
64428
  await event("end-task", { kind: "EndTask" /* EndTask */, exitReason: exitReason2 });
64428
64429
  return exitReason2;
64429
64430
  }
@@ -64439,7 +64440,7 @@ var agentWorkflow = async (input, { step, tools: tools2 }) => {
64439
64440
  nextMessage = [{ role: "user", content: errorMessage }];
64440
64441
  continue;
64441
64442
  }
64442
- const exitReason = { type: "Exit" /* Exit */, message: textContent, object: validated.data };
64443
+ const exitReason = { type: "Exit", message: textContent, object: validated.data, messages };
64443
64444
  await event("end-task", { kind: "EndTask" /* EndTask */, exitReason });
64444
64445
  return exitReason;
64445
64446
  }
@@ -64481,7 +64482,7 @@ var agentWorkflow = async (input, { step, tools: tools2 }) => {
64481
64482
  output: toolResponse.message
64482
64483
  });
64483
64484
  break;
64484
- case "Exit" /* Exit */:
64485
+ case "Exit": {
64485
64486
  if (toolCalls.length > 1) {
64486
64487
  toolResults.push({
64487
64488
  toolCallId: toolCall.toolCallId,
@@ -64496,8 +64497,10 @@ var agentWorkflow = async (input, { step, tools: tools2 }) => {
64496
64497
  if (toolResults.length > 0) {
64497
64498
  break;
64498
64499
  }
64499
- await event("end-task", { kind: "EndTask" /* EndTask */, exitReason: toolResponse });
64500
- return toolResponse;
64500
+ const exitReason = { ...toolResponse, messages };
64501
+ await event("end-task", { kind: "EndTask" /* EndTask */, exitReason });
64502
+ return exitReason;
64503
+ }
64501
64504
  }
64502
64505
  }
64503
64506
  nextMessage = [
@@ -64510,7 +64513,7 @@ var agentWorkflow = async (input, { step, tools: tools2 }) => {
64510
64513
  }
64511
64514
  ];
64512
64515
  }
64513
- await event("end-task", { kind: "EndTask" /* EndTask */, exitReason: { type: "UsageExceeded" } });
64516
+ await event("end-task", { kind: "EndTask" /* EndTask */, exitReason: { type: "UsageExceeded", messages } });
64514
64517
  throw new Error("Maximum number of tool round trips reached.");
64515
64518
  };
64516
64519
  // ../workflow/src/json-ai-types.ts
@@ -78650,7 +78653,8 @@ Workflow completed successfully.`);
78650
78653
  kind: "EndTask" /* EndTask */,
78651
78654
  exitReason: {
78652
78655
  type: "Error",
78653
- error: { message: error46.message, stack: error46.stack }
78656
+ error: { message: error46.message, stack: error46.stack },
78657
+ messages: []
78654
78658
  }
78655
78659
  });
78656
78660
  if (error46 instanceof UserCancelledError) {
@@ -79644,7 +79648,7 @@ ${memoryContext}`
79644
79648
  }, context);
79645
79649
  });
79646
79650
  const res = await step(`fix-summary-${i}`, async () => {
79647
- if (result.type === "Exit" /* Exit */ && result.object) {
79651
+ if (result.type === "Exit" && result.object) {
79648
79652
  const { summary, bailReason } = result.object;
79649
79653
  if (bailReason) {
79650
79654
  logger.warn(`Agent bailed: ${bailReason}`);
@@ -79718,7 +79722,7 @@ ${defaultContext}`;
79718
79722
  outputSchema: PlanSchema
79719
79723
  }, context);
79720
79724
  });
79721
- if (result.type === "Exit" /* Exit */ && result.object) {
79725
+ if (result.type === "Exit" && result.object) {
79722
79726
  const { plan, question, reason, files: filePaths } = result.object;
79723
79727
  if (reason) {
79724
79728
  return { reason };
@@ -79981,7 +79985,7 @@ ${additionalInstructions}` : CODER_SYSTEM_PROMPT;
79981
79985
  outputSchema: ImplementOutputSchema
79982
79986
  }, context);
79983
79987
  });
79984
- if (res.type === "Exit" /* Exit */ && res.object) {
79988
+ if (res.type === "Exit" && res.object) {
79985
79989
  const { summary, bailReason } = res.object;
79986
79990
  if (bailReason) {
79987
79991
  logger.error(`
@@ -80007,7 +80011,7 @@ Implementation complete!
80007
80011
  Implementation complete!
80008
80012
  `);
80009
80013
  }
80010
- } else if (res.type === "Exit" /* Exit */) {
80014
+ } else if (res.type === "Exit") {
80011
80015
  logger.info(`
80012
80016
  Implementation complete!
80013
80017
  `);
@@ -80198,7 +80202,7 @@ ${input2.context}
80198
80202
  outputSchema: commitMessageSchema
80199
80203
  }, context);
80200
80204
  });
80201
- if (result.type === "Exit" /* Exit */ && result.object) {
80205
+ if (result.type === "Exit" && result.object) {
80202
80206
  const { commitMessage } = commitMessageSchema.parse(result.object);
80203
80207
  if (commitMessage) {
80204
80208
  logger.info(`
@@ -80405,7 +80409,7 @@ ${provider3.toUpperCase()}_API_KEY=${providerConfig.apiKey}`;
80405
80409
  outputSchema: exports_external.object({ yaml: exports_external.string() })
80406
80410
  }, { logger, tools: tools2, step });
80407
80411
  });
80408
- if (result.type === "Exit" /* Exit */ && result.object) {
80412
+ if (result.type === "Exit" && result.object) {
80409
80413
  const yamlConfig = result.object.yaml;
80410
80414
  generatedConfig = yamlConfig ? $parse(yamlConfig) : {};
80411
80415
  }
@@ -80533,7 +80537,7 @@ ${feedback}`
80533
80537
  ],
80534
80538
  outputSchema: EpicPlanSchema
80535
80539
  }, context);
80536
- if (planResult.type === "Exit" /* Exit */) {
80540
+ if (planResult.type === "Exit") {
80537
80541
  return planResult.object;
80538
80542
  }
80539
80543
  return { type: "error", reason: "Usage limit exceeded." };
@@ -81311,7 +81315,7 @@ var reviewWorkflow = async (input2, context) => {
81311
81315
  outputSchema: reviewOutputSchema
81312
81316
  }, context);
81313
81317
  });
81314
- if (result.type === "Exit" /* Exit */) {
81318
+ if (result.type === "Exit") {
81315
81319
  const reviewResult = result.object;
81316
81320
  if (!reviewResult) {
81317
81321
  return { overview: "AI agent failed to produce a review.", specificReviews: [] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.9.51",
3
+ "version": "0.9.52",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",