@polka-codes/cli-shared 0.9.36 → 0.9.38

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 +26 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -50160,6 +50160,7 @@ Request timeout after ${requestTimeoutSeconds} seconds. Canceling current reques
50160
50160
  };
50161
50161
  try {
50162
50162
  resetTimeout();
50163
+ const usageMeterOnFinishHandler = this.config.usageMeter.onFinishHandler(this.ai);
50163
50164
  const streamTextOptions = {
50164
50165
  model: this.ai,
50165
50166
  temperature: 0,
@@ -50178,7 +50179,10 @@ Request timeout after ${requestTimeoutSeconds} seconds. Canceling current reques
50178
50179
  break;
50179
50180
  }
50180
50181
  },
50181
- onFinish: this.config.usageMeter.onFinishHandler(this.ai),
50182
+ onFinish: (evt) => {
50183
+ usageMeterOnFinishHandler(evt);
50184
+ this.#callback({ kind: "Usage" /* Usage */, agent: this, usage: evt.totalUsage });
50185
+ },
50182
50186
  onError: async (error43) => {
50183
50187
  console.error("Error in stream:", error43);
50184
50188
  },
@@ -51273,6 +51277,13 @@ class StepsBuilder {
51273
51277
  step
51274
51278
  });
51275
51279
  }
51280
+ loop(id, config2) {
51281
+ return this.step({
51282
+ ...config2,
51283
+ id,
51284
+ type: "loop"
51285
+ });
51286
+ }
51276
51287
  custom(idOrSpec, run) {
51277
51288
  if (typeof idOrSpec === "string") {
51278
51289
  if (!run) {
@@ -51286,6 +51297,13 @@ class StepsBuilder {
51286
51297
  }
51287
51298
  return this.step(idOrSpec);
51288
51299
  }
51300
+ workflow(id, config2) {
51301
+ return this.step({
51302
+ ...config2,
51303
+ id,
51304
+ type: "workflow"
51305
+ });
51306
+ }
51289
51307
  agent(id, spec2) {
51290
51308
  return this.step({
51291
51309
  ...spec2,
@@ -51293,6 +51311,13 @@ class StepsBuilder {
51293
51311
  type: "agent"
51294
51312
  });
51295
51313
  }
51314
+ branch(id, config2) {
51315
+ return this.step({
51316
+ ...config2,
51317
+ id,
51318
+ type: "branch"
51319
+ });
51320
+ }
51296
51321
  }
51297
51322
  // src/config.ts
51298
51323
  var import_lodash3 = __toESM(require_lodash(), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli-shared",
3
- "version": "0.9.36",
3
+ "version": "0.9.38",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",