@polka-codes/cli 0.9.34 → 0.9.35

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 +20 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58608,7 +58608,7 @@ var {
58608
58608
  Help
58609
58609
  } = import__.default;
58610
58610
  // package.json
58611
- var version = "0.9.34";
58611
+ var version = "0.9.35";
58612
58612
 
58613
58613
  // src/commands/chat.ts
58614
58614
  import { readFile as readFile3 } from "node:fs/promises";
@@ -73142,10 +73142,10 @@ class UsageMeter {
73142
73142
  };
73143
73143
  const usage = "totalUsage" in resp ? resp.totalUsage : resp.usage;
73144
73144
  const result = this.#calculageUsage(usage, resp.providerMetadata, modelInfo);
73145
- this.#totals.input += result.input;
73146
- this.#totals.output += result.output;
73147
- this.#totals.cachedRead += result.cachedRead;
73148
- this.#totals.cost += result.cost;
73145
+ this.#totals.input += result.input || 0;
73146
+ this.#totals.output += result.output || 0;
73147
+ this.#totals.cachedRead += result.cachedRead || 0;
73148
+ this.#totals.cost += result.cost || 0;
73149
73149
  this.#totals.messageCount += 1;
73150
73150
  }
73151
73151
  setUsage(newUsage) {
@@ -106348,25 +106348,24 @@ var runChat = async (opts, command2) => {
106348
106348
  }
106349
106349
  }
106350
106350
  if (runner.hasActiveAgent) {
106351
- const reason = await runner.continueTask(message, fileParts);
106352
- exitReason = reason;
106351
+ exitReason = await runner.continueTask(message, fileParts);
106353
106352
  } else {
106354
- const reason = await runner.startTask(message, agent2, fileParts);
106355
- exitReason = reason;
106353
+ exitReason = await runner.startTask(message, agent2, fileParts);
106356
106354
  }
106357
- switch (exitReason.type) {
106358
- case "UsageExceeded": {
106359
- const continueChat = await esm_default2({
106360
- message: "Usage limit exceeded. Do you want to continue?",
106361
- default: true
106362
- });
106363
- if (continueChat) {
106364
- runner.usageMeter.resetUsage();
106365
- } else {
106366
- chat.close();
106367
- }
106368
- break;
106355
+ while (exitReason.type === "UsageExceeded") {
106356
+ const continueChat = await esm_default2({
106357
+ message: "Usage limit exceeded. Do you want to continue?",
106358
+ default: true
106359
+ });
106360
+ if (continueChat) {
106361
+ runner.usageMeter.resetUsage();
106362
+ exitReason = await runner.continueTask(message, fileParts);
106363
+ } else {
106364
+ chat.close();
106365
+ return;
106369
106366
  }
106367
+ }
106368
+ switch (exitReason.type) {
106370
106369
  case "WaitForUserInput":
106371
106370
  break;
106372
106371
  case "Interrupted" /* Interrupted */:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli",
3
- "version": "0.9.34",
3
+ "version": "0.9.35",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",