@polka-codes/cli 0.9.40 → 0.9.41
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 +31 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56846,7 +56846,7 @@ var {
|
|
|
56846
56846
|
Help
|
|
56847
56847
|
} = import__.default;
|
|
56848
56848
|
// package.json
|
|
56849
|
-
var version = "0.9.
|
|
56849
|
+
var version = "0.9.41";
|
|
56850
56850
|
|
|
56851
56851
|
// src/commands/chat.ts
|
|
56852
56852
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -105279,22 +105279,40 @@ var runChat = async (opts, command) => {
|
|
|
105279
105279
|
// src/runWorkflow.ts
|
|
105280
105280
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
105281
105281
|
import os5 from "node:os";
|
|
105282
|
-
|
|
105283
|
-
|
|
105284
|
-
|
|
105282
|
+
|
|
105283
|
+
// ../workflow/src/helpers.ts
|
|
105284
|
+
var makeStepFn = (fns) => {
|
|
105285
|
+
if (!fns) {
|
|
105285
105286
|
const results = {};
|
|
105286
105287
|
const counts = {};
|
|
105287
|
-
|
|
105288
|
-
|
|
105289
|
-
|
|
105290
|
-
|
|
105291
|
-
|
|
105292
|
-
|
|
105293
|
-
|
|
105294
|
-
|
|
105295
|
-
|
|
105288
|
+
fns = {
|
|
105289
|
+
getStepResult: async (key2) => results[key2],
|
|
105290
|
+
setStepResult: async (key2, value) => {
|
|
105291
|
+
results[key2] = value;
|
|
105292
|
+
},
|
|
105293
|
+
getAndIncrementCounts: async (key2) => {
|
|
105294
|
+
counts[key2] = (counts[key2] || 0) + 1;
|
|
105295
|
+
return counts[key2];
|
|
105296
|
+
}
|
|
105296
105297
|
};
|
|
105297
105298
|
}
|
|
105299
|
+
return async (name18, fn) => {
|
|
105300
|
+
const currentCounts = await fns.getAndIncrementCounts(name18);
|
|
105301
|
+
const key2 = `${name18}#${currentCounts}`;
|
|
105302
|
+
const existingResult = await fns.getStepResult(key2);
|
|
105303
|
+
if (existingResult !== undefined) {
|
|
105304
|
+
return existingResult;
|
|
105305
|
+
}
|
|
105306
|
+
const result = await fn();
|
|
105307
|
+
await fns.setStepResult(key2, result ?? null);
|
|
105308
|
+
return result;
|
|
105309
|
+
};
|
|
105310
|
+
};
|
|
105311
|
+
// ../workflow/src/workflow.ts
|
|
105312
|
+
async function run(workflow, input, stepFn) {
|
|
105313
|
+
if (!stepFn) {
|
|
105314
|
+
stepFn = makeStepFn();
|
|
105315
|
+
}
|
|
105298
105316
|
const tools2 = new Proxy({}, {
|
|
105299
105317
|
get: (_target, tool6) => {
|
|
105300
105318
|
return function* (input2) {
|