@polka-codes/runner 0.9.88 → 0.9.89

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 +931 -45
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -17900,7 +17900,7 @@ var init_multipart_parser = __esm(() => {
17900
17900
 
17901
17901
  // ../../node_modules/node-fetch/src/body.js
17902
17902
  import Stream, { PassThrough } from "node:stream";
17903
- import { types as types3, deprecate, promisify } from "node:util";
17903
+ import { types as types4, deprecate, promisify } from "node:util";
17904
17904
  import { Buffer as Buffer4 } from "node:buffer";
17905
17905
 
17906
17906
  class Body {
@@ -17912,7 +17912,7 @@ class Body {
17912
17912
  body = null;
17913
17913
  } else if (isURLSearchParameters(body)) {
17914
17914
  body = Buffer4.from(body.toString());
17915
- } else if (isBlob(body)) {} else if (Buffer4.isBuffer(body)) {} else if (types3.isAnyArrayBuffer(body)) {
17915
+ } else if (isBlob(body)) {} else if (Buffer4.isBuffer(body)) {} else if (types4.isAnyArrayBuffer(body)) {
17916
17916
  body = Buffer4.from(body);
17917
17917
  } else if (ArrayBuffer.isView(body)) {
17918
17918
  body = Buffer4.from(body.buffer, body.byteOffset, body.byteLength);
@@ -18058,7 +18058,7 @@ var pipeline, INTERNALS, clone2 = (instance, highWaterMark) => {
18058
18058
  if (isBlob(body)) {
18059
18059
  return body.type || null;
18060
18060
  }
18061
- if (Buffer4.isBuffer(body) || types3.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
18061
+ if (Buffer4.isBuffer(body) || types4.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
18062
18062
  return null;
18063
18063
  }
18064
18064
  if (body instanceof FormData2) {
@@ -18115,7 +18115,7 @@ var init_body = __esm(() => {
18115
18115
  });
18116
18116
 
18117
18117
  // ../../node_modules/node-fetch/src/headers.js
18118
- import { types as types4 } from "node:util";
18118
+ import { types as types5 } from "node:util";
18119
18119
  import http from "node:http";
18120
18120
  function fromRawHeaders(headers = []) {
18121
18121
  return new Headers2(headers.reduce((result, value, index, array2) => {
@@ -18157,7 +18157,7 @@ var init_headers = __esm(() => {
18157
18157
  for (const [name17, values] of Object.entries(raw)) {
18158
18158
  result.push(...values.map((value) => [name17, value]));
18159
18159
  }
18160
- } else if (init == null) {} else if (typeof init === "object" && !types4.isBoxedPrimitive(init)) {
18160
+ } else if (init == null) {} else if (typeof init === "object" && !types5.isBoxedPrimitive(init)) {
18161
18161
  const method = init[Symbol.iterator];
18162
18162
  if (method == null) {
18163
18163
  result.push(...Object.entries(init));
@@ -18166,7 +18166,7 @@ var init_headers = __esm(() => {
18166
18166
  throw new TypeError("Header pairs must be iterable");
18167
18167
  }
18168
18168
  result = [...init].map((pair) => {
18169
- if (typeof pair !== "object" || types4.isBoxedPrimitive(pair)) {
18169
+ if (typeof pair !== "object" || types5.isBoxedPrimitive(pair)) {
18170
18170
  throw new TypeError("Each header pair must be an iterable object");
18171
18171
  }
18172
18172
  return [...pair];
@@ -37641,6 +37641,771 @@ var require_mimeScore = __commonJS((exports, module) => {
37641
37641
  };
37642
37642
  });
37643
37643
 
37644
+ // ../../node_modules/better-sqlite3/lib/util.js
37645
+ var require_util3 = __commonJS((exports) => {
37646
+ exports.getBooleanOption = (options, key) => {
37647
+ let value = false;
37648
+ if (key in options && typeof (value = options[key]) !== "boolean") {
37649
+ throw new TypeError(`Expected the "${key}" option to be a boolean`);
37650
+ }
37651
+ return value;
37652
+ };
37653
+ exports.cppdb = Symbol();
37654
+ exports.inspect = Symbol.for("nodejs.util.inspect.custom");
37655
+ });
37656
+
37657
+ // ../../node_modules/better-sqlite3/lib/sqlite-error.js
37658
+ var require_sqlite_error = __commonJS((exports, module) => {
37659
+ var descriptor = { value: "SqliteError", writable: true, enumerable: false, configurable: true };
37660
+ function SqliteError(message, code) {
37661
+ if (new.target !== SqliteError) {
37662
+ return new SqliteError(message, code);
37663
+ }
37664
+ if (typeof code !== "string") {
37665
+ throw new TypeError("Expected second argument to be a string");
37666
+ }
37667
+ Error.call(this, message);
37668
+ descriptor.value = "" + message;
37669
+ Object.defineProperty(this, "message", descriptor);
37670
+ Error.captureStackTrace(this, SqliteError);
37671
+ this.code = code;
37672
+ }
37673
+ Object.setPrototypeOf(SqliteError, Error);
37674
+ Object.setPrototypeOf(SqliteError.prototype, Error.prototype);
37675
+ Object.defineProperty(SqliteError.prototype, "name", descriptor);
37676
+ module.exports = SqliteError;
37677
+ });
37678
+
37679
+ // ../../node_modules/file-uri-to-path/index.js
37680
+ var require_file_uri_to_path = __commonJS((exports, module) => {
37681
+ var sep = __require("path").sep || "/";
37682
+ module.exports = fileUriToPath;
37683
+ function fileUriToPath(uri) {
37684
+ if (typeof uri != "string" || uri.length <= 7 || uri.substring(0, 7) != "file://") {
37685
+ throw new TypeError("must pass in a file:// URI to convert to a file path");
37686
+ }
37687
+ var rest = decodeURI(uri.substring(7));
37688
+ var firstSlash = rest.indexOf("/");
37689
+ var host = rest.substring(0, firstSlash);
37690
+ var path = rest.substring(firstSlash + 1);
37691
+ if (host == "localhost")
37692
+ host = "";
37693
+ if (host) {
37694
+ host = sep + sep + host;
37695
+ }
37696
+ path = path.replace(/^(.+)\|/, "$1:");
37697
+ if (sep == "\\") {
37698
+ path = path.replace(/\//g, "\\");
37699
+ }
37700
+ if (/^.+\:/.test(path)) {} else {
37701
+ path = sep + path;
37702
+ }
37703
+ return host + path;
37704
+ }
37705
+ });
37706
+
37707
+ // ../../node_modules/bindings/bindings.js
37708
+ var require_bindings = __commonJS((exports, module) => {
37709
+ var __filename = "/Users/xiliangchen/projects/polka-codes/node_modules/bindings/bindings.js";
37710
+ var fs4 = __require("fs");
37711
+ var path = __require("path");
37712
+ var fileURLToPath = require_file_uri_to_path();
37713
+ var join3 = path.join;
37714
+ var dirname2 = path.dirname;
37715
+ var exists = fs4.accessSync && function(path2) {
37716
+ try {
37717
+ fs4.accessSync(path2);
37718
+ } catch (e2) {
37719
+ return false;
37720
+ }
37721
+ return true;
37722
+ } || fs4.existsSync || path.existsSync;
37723
+ var defaults = {
37724
+ arrow: process.env.NODE_BINDINGS_ARROW || " → ",
37725
+ compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
37726
+ platform: process.platform,
37727
+ arch: process.arch,
37728
+ nodePreGyp: "node-v" + process.versions.modules + "-" + process.platform + "-" + process.arch,
37729
+ version: process.versions.node,
37730
+ bindings: "bindings.node",
37731
+ try: [
37732
+ ["module_root", "build", "bindings"],
37733
+ ["module_root", "build", "Debug", "bindings"],
37734
+ ["module_root", "build", "Release", "bindings"],
37735
+ ["module_root", "out", "Debug", "bindings"],
37736
+ ["module_root", "Debug", "bindings"],
37737
+ ["module_root", "out", "Release", "bindings"],
37738
+ ["module_root", "Release", "bindings"],
37739
+ ["module_root", "build", "default", "bindings"],
37740
+ ["module_root", "compiled", "version", "platform", "arch", "bindings"],
37741
+ ["module_root", "addon-build", "release", "install-root", "bindings"],
37742
+ ["module_root", "addon-build", "debug", "install-root", "bindings"],
37743
+ ["module_root", "addon-build", "default", "install-root", "bindings"],
37744
+ ["module_root", "lib", "binding", "nodePreGyp", "bindings"]
37745
+ ]
37746
+ };
37747
+ function bindings(opts) {
37748
+ if (typeof opts == "string") {
37749
+ opts = { bindings: opts };
37750
+ } else if (!opts) {
37751
+ opts = {};
37752
+ }
37753
+ Object.keys(defaults).map(function(i3) {
37754
+ if (!(i3 in opts))
37755
+ opts[i3] = defaults[i3];
37756
+ });
37757
+ if (!opts.module_root) {
37758
+ opts.module_root = exports.getRoot(exports.getFileName());
37759
+ }
37760
+ if (path.extname(opts.bindings) != ".node") {
37761
+ opts.bindings += ".node";
37762
+ }
37763
+ var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
37764
+ var tries = [], i2 = 0, l = opts.try.length, n, b, err;
37765
+ for (;i2 < l; i2++) {
37766
+ n = join3.apply(null, opts.try[i2].map(function(p) {
37767
+ return opts[p] || p;
37768
+ }));
37769
+ tries.push(n);
37770
+ try {
37771
+ b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
37772
+ if (!opts.path) {
37773
+ b.path = n;
37774
+ }
37775
+ return b;
37776
+ } catch (e2) {
37777
+ if (e2.code !== "MODULE_NOT_FOUND" && e2.code !== "QUALIFIED_PATH_RESOLUTION_FAILED" && !/not find/i.test(e2.message)) {
37778
+ throw e2;
37779
+ }
37780
+ }
37781
+ }
37782
+ err = new Error(`Could not locate the bindings file. Tried:
37783
+ ` + tries.map(function(a) {
37784
+ return opts.arrow + a;
37785
+ }).join(`
37786
+ `));
37787
+ err.tries = tries;
37788
+ throw err;
37789
+ }
37790
+ module.exports = exports = bindings;
37791
+ exports.getFileName = function getFileName(calling_file) {
37792
+ var { prepareStackTrace: origPST, stackTraceLimit: origSTL } = Error, dummy = {}, fileName;
37793
+ Error.stackTraceLimit = 10;
37794
+ Error.prepareStackTrace = function(e2, st) {
37795
+ for (var i2 = 0, l = st.length;i2 < l; i2++) {
37796
+ fileName = st[i2].getFileName();
37797
+ if (fileName !== __filename) {
37798
+ if (calling_file) {
37799
+ if (fileName !== calling_file) {
37800
+ return;
37801
+ }
37802
+ } else {
37803
+ return;
37804
+ }
37805
+ }
37806
+ }
37807
+ };
37808
+ Error.captureStackTrace(dummy);
37809
+ dummy.stack;
37810
+ Error.prepareStackTrace = origPST;
37811
+ Error.stackTraceLimit = origSTL;
37812
+ var fileSchema = "file://";
37813
+ if (fileName.indexOf(fileSchema) === 0) {
37814
+ fileName = fileURLToPath(fileName);
37815
+ }
37816
+ return fileName;
37817
+ };
37818
+ exports.getRoot = function getRoot(file2) {
37819
+ var dir = dirname2(file2), prev;
37820
+ while (true) {
37821
+ if (dir === ".") {
37822
+ dir = process.cwd();
37823
+ }
37824
+ if (exists(join3(dir, "package.json")) || exists(join3(dir, "node_modules"))) {
37825
+ return dir;
37826
+ }
37827
+ if (prev === dir) {
37828
+ throw new Error('Could not find module root given file: "' + file2 + '". Do you have a `package.json` file? ');
37829
+ }
37830
+ prev = dir;
37831
+ dir = join3(dir, "..");
37832
+ }
37833
+ };
37834
+ });
37835
+
37836
+ // ../../node_modules/better-sqlite3/lib/methods/wrappers.js
37837
+ var require_wrappers = __commonJS((exports) => {
37838
+ var { cppdb } = require_util3();
37839
+ exports.prepare = function prepare(sql) {
37840
+ return this[cppdb].prepare(sql, this, false);
37841
+ };
37842
+ exports.exec = function exec(sql) {
37843
+ this[cppdb].exec(sql);
37844
+ return this;
37845
+ };
37846
+ exports.close = function close() {
37847
+ this[cppdb].close();
37848
+ return this;
37849
+ };
37850
+ exports.loadExtension = function loadExtension(...args) {
37851
+ this[cppdb].loadExtension(...args);
37852
+ return this;
37853
+ };
37854
+ exports.defaultSafeIntegers = function defaultSafeIntegers(...args) {
37855
+ this[cppdb].defaultSafeIntegers(...args);
37856
+ return this;
37857
+ };
37858
+ exports.unsafeMode = function unsafeMode(...args) {
37859
+ this[cppdb].unsafeMode(...args);
37860
+ return this;
37861
+ };
37862
+ exports.getters = {
37863
+ name: {
37864
+ get: function name() {
37865
+ return this[cppdb].name;
37866
+ },
37867
+ enumerable: true
37868
+ },
37869
+ open: {
37870
+ get: function open() {
37871
+ return this[cppdb].open;
37872
+ },
37873
+ enumerable: true
37874
+ },
37875
+ inTransaction: {
37876
+ get: function inTransaction() {
37877
+ return this[cppdb].inTransaction;
37878
+ },
37879
+ enumerable: true
37880
+ },
37881
+ readonly: {
37882
+ get: function readonly() {
37883
+ return this[cppdb].readonly;
37884
+ },
37885
+ enumerable: true
37886
+ },
37887
+ memory: {
37888
+ get: function memory() {
37889
+ return this[cppdb].memory;
37890
+ },
37891
+ enumerable: true
37892
+ }
37893
+ };
37894
+ });
37895
+
37896
+ // ../../node_modules/better-sqlite3/lib/methods/transaction.js
37897
+ var require_transaction = __commonJS((exports, module) => {
37898
+ var { cppdb } = require_util3();
37899
+ var controllers = new WeakMap;
37900
+ module.exports = function transaction(fn) {
37901
+ if (typeof fn !== "function")
37902
+ throw new TypeError("Expected first argument to be a function");
37903
+ const db2 = this[cppdb];
37904
+ const controller = getController(db2, this);
37905
+ const { apply: apply2 } = Function.prototype;
37906
+ const properties = {
37907
+ default: { value: wrapTransaction(apply2, fn, db2, controller.default) },
37908
+ deferred: { value: wrapTransaction(apply2, fn, db2, controller.deferred) },
37909
+ immediate: { value: wrapTransaction(apply2, fn, db2, controller.immediate) },
37910
+ exclusive: { value: wrapTransaction(apply2, fn, db2, controller.exclusive) },
37911
+ database: { value: this, enumerable: true }
37912
+ };
37913
+ Object.defineProperties(properties.default.value, properties);
37914
+ Object.defineProperties(properties.deferred.value, properties);
37915
+ Object.defineProperties(properties.immediate.value, properties);
37916
+ Object.defineProperties(properties.exclusive.value, properties);
37917
+ return properties.default.value;
37918
+ };
37919
+ var getController = (db2, self2) => {
37920
+ let controller = controllers.get(db2);
37921
+ if (!controller) {
37922
+ const shared = {
37923
+ commit: db2.prepare("COMMIT", self2, false),
37924
+ rollback: db2.prepare("ROLLBACK", self2, false),
37925
+ savepoint: db2.prepare("SAVEPOINT `\t_bs3.\t`", self2, false),
37926
+ release: db2.prepare("RELEASE `\t_bs3.\t`", self2, false),
37927
+ rollbackTo: db2.prepare("ROLLBACK TO `\t_bs3.\t`", self2, false)
37928
+ };
37929
+ controllers.set(db2, controller = {
37930
+ default: Object.assign({ begin: db2.prepare("BEGIN", self2, false) }, shared),
37931
+ deferred: Object.assign({ begin: db2.prepare("BEGIN DEFERRED", self2, false) }, shared),
37932
+ immediate: Object.assign({ begin: db2.prepare("BEGIN IMMEDIATE", self2, false) }, shared),
37933
+ exclusive: Object.assign({ begin: db2.prepare("BEGIN EXCLUSIVE", self2, false) }, shared)
37934
+ });
37935
+ }
37936
+ return controller;
37937
+ };
37938
+ var wrapTransaction = (apply2, fn, db2, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
37939
+ let before, after, undo;
37940
+ if (db2.inTransaction) {
37941
+ before = savepoint;
37942
+ after = release;
37943
+ undo = rollbackTo;
37944
+ } else {
37945
+ before = begin;
37946
+ after = commit;
37947
+ undo = rollback;
37948
+ }
37949
+ before.run();
37950
+ try {
37951
+ const result = apply2.call(fn, this, arguments);
37952
+ if (result && typeof result.then === "function") {
37953
+ throw new TypeError("Transaction function cannot return a promise");
37954
+ }
37955
+ after.run();
37956
+ return result;
37957
+ } catch (ex) {
37958
+ if (db2.inTransaction) {
37959
+ undo.run();
37960
+ if (undo !== rollback)
37961
+ after.run();
37962
+ }
37963
+ throw ex;
37964
+ }
37965
+ };
37966
+ });
37967
+
37968
+ // ../../node_modules/better-sqlite3/lib/methods/pragma.js
37969
+ var require_pragma = __commonJS((exports, module) => {
37970
+ var { getBooleanOption, cppdb } = require_util3();
37971
+ module.exports = function pragma(source, options) {
37972
+ if (options == null)
37973
+ options = {};
37974
+ if (typeof source !== "string")
37975
+ throw new TypeError("Expected first argument to be a string");
37976
+ if (typeof options !== "object")
37977
+ throw new TypeError("Expected second argument to be an options object");
37978
+ const simple = getBooleanOption(options, "simple");
37979
+ const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
37980
+ return simple ? stmt.pluck().get() : stmt.all();
37981
+ };
37982
+ });
37983
+
37984
+ // ../../node_modules/better-sqlite3/lib/methods/backup.js
37985
+ var require_backup = __commonJS((exports, module) => {
37986
+ var fs4 = __require("fs");
37987
+ var path = __require("path");
37988
+ var { promisify: promisify2 } = __require("util");
37989
+ var { cppdb } = require_util3();
37990
+ var fsAccess = promisify2(fs4.access);
37991
+ module.exports = async function backup(filename, options) {
37992
+ if (options == null)
37993
+ options = {};
37994
+ if (typeof filename !== "string")
37995
+ throw new TypeError("Expected first argument to be a string");
37996
+ if (typeof options !== "object")
37997
+ throw new TypeError("Expected second argument to be an options object");
37998
+ filename = filename.trim();
37999
+ const attachedName = "attached" in options ? options.attached : "main";
38000
+ const handler13 = "progress" in options ? options.progress : null;
38001
+ if (!filename)
38002
+ throw new TypeError("Backup filename cannot be an empty string");
38003
+ if (filename === ":memory:")
38004
+ throw new TypeError('Invalid backup filename ":memory:"');
38005
+ if (typeof attachedName !== "string")
38006
+ throw new TypeError('Expected the "attached" option to be a string');
38007
+ if (!attachedName)
38008
+ throw new TypeError('The "attached" option cannot be an empty string');
38009
+ if (handler13 != null && typeof handler13 !== "function")
38010
+ throw new TypeError('Expected the "progress" option to be a function');
38011
+ await fsAccess(path.dirname(filename)).catch(() => {
38012
+ throw new TypeError("Cannot save backup because the directory does not exist");
38013
+ });
38014
+ const isNewFile = await fsAccess(filename).then(() => false, () => true);
38015
+ return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler13 || null);
38016
+ };
38017
+ var runBackup = (backup, handler13) => {
38018
+ let rate = 0;
38019
+ let useDefault = true;
38020
+ return new Promise((resolve4, reject) => {
38021
+ setImmediate(function step() {
38022
+ try {
38023
+ const progress = backup.transfer(rate);
38024
+ if (!progress.remainingPages) {
38025
+ backup.close();
38026
+ resolve4(progress);
38027
+ return;
38028
+ }
38029
+ if (useDefault) {
38030
+ useDefault = false;
38031
+ rate = 100;
38032
+ }
38033
+ if (handler13) {
38034
+ const ret = handler13(progress);
38035
+ if (ret !== undefined) {
38036
+ if (typeof ret === "number" && ret === ret)
38037
+ rate = Math.max(0, Math.min(2147483647, Math.round(ret)));
38038
+ else
38039
+ throw new TypeError("Expected progress callback to return a number or undefined");
38040
+ }
38041
+ }
38042
+ setImmediate(step);
38043
+ } catch (err) {
38044
+ backup.close();
38045
+ reject(err);
38046
+ }
38047
+ });
38048
+ });
38049
+ };
38050
+ });
38051
+
38052
+ // ../../node_modules/better-sqlite3/lib/methods/serialize.js
38053
+ var require_serialize = __commonJS((exports, module) => {
38054
+ var { cppdb } = require_util3();
38055
+ module.exports = function serialize(options) {
38056
+ if (options == null)
38057
+ options = {};
38058
+ if (typeof options !== "object")
38059
+ throw new TypeError("Expected first argument to be an options object");
38060
+ const attachedName = "attached" in options ? options.attached : "main";
38061
+ if (typeof attachedName !== "string")
38062
+ throw new TypeError('Expected the "attached" option to be a string');
38063
+ if (!attachedName)
38064
+ throw new TypeError('The "attached" option cannot be an empty string');
38065
+ return this[cppdb].serialize(attachedName);
38066
+ };
38067
+ });
38068
+
38069
+ // ../../node_modules/better-sqlite3/lib/methods/function.js
38070
+ var require_function = __commonJS((exports, module) => {
38071
+ var { getBooleanOption, cppdb } = require_util3();
38072
+ module.exports = function defineFunction(name17, options, fn) {
38073
+ if (options == null)
38074
+ options = {};
38075
+ if (typeof options === "function") {
38076
+ fn = options;
38077
+ options = {};
38078
+ }
38079
+ if (typeof name17 !== "string")
38080
+ throw new TypeError("Expected first argument to be a string");
38081
+ if (typeof fn !== "function")
38082
+ throw new TypeError("Expected last argument to be a function");
38083
+ if (typeof options !== "object")
38084
+ throw new TypeError("Expected second argument to be an options object");
38085
+ if (!name17)
38086
+ throw new TypeError("User-defined function name cannot be an empty string");
38087
+ const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
38088
+ const deterministic = getBooleanOption(options, "deterministic");
38089
+ const directOnly = getBooleanOption(options, "directOnly");
38090
+ const varargs = getBooleanOption(options, "varargs");
38091
+ let argCount = -1;
38092
+ if (!varargs) {
38093
+ argCount = fn.length;
38094
+ if (!Number.isInteger(argCount) || argCount < 0)
38095
+ throw new TypeError("Expected function.length to be a positive integer");
38096
+ if (argCount > 100)
38097
+ throw new RangeError("User-defined functions cannot have more than 100 arguments");
38098
+ }
38099
+ this[cppdb].function(fn, name17, argCount, safeIntegers, deterministic, directOnly);
38100
+ return this;
38101
+ };
38102
+ });
38103
+
38104
+ // ../../node_modules/better-sqlite3/lib/methods/aggregate.js
38105
+ var require_aggregate = __commonJS((exports, module) => {
38106
+ var { getBooleanOption, cppdb } = require_util3();
38107
+ module.exports = function defineAggregate(name17, options) {
38108
+ if (typeof name17 !== "string")
38109
+ throw new TypeError("Expected first argument to be a string");
38110
+ if (typeof options !== "object" || options === null)
38111
+ throw new TypeError("Expected second argument to be an options object");
38112
+ if (!name17)
38113
+ throw new TypeError("User-defined function name cannot be an empty string");
38114
+ const start = "start" in options ? options.start : null;
38115
+ const step = getFunctionOption(options, "step", true);
38116
+ const inverse = getFunctionOption(options, "inverse", false);
38117
+ const result = getFunctionOption(options, "result", false);
38118
+ const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
38119
+ const deterministic = getBooleanOption(options, "deterministic");
38120
+ const directOnly = getBooleanOption(options, "directOnly");
38121
+ const varargs = getBooleanOption(options, "varargs");
38122
+ let argCount = -1;
38123
+ if (!varargs) {
38124
+ argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
38125
+ if (argCount > 0)
38126
+ argCount -= 1;
38127
+ if (argCount > 100)
38128
+ throw new RangeError("User-defined functions cannot have more than 100 arguments");
38129
+ }
38130
+ this[cppdb].aggregate(start, step, inverse, result, name17, argCount, safeIntegers, deterministic, directOnly);
38131
+ return this;
38132
+ };
38133
+ var getFunctionOption = (options, key, required2) => {
38134
+ const value = key in options ? options[key] : null;
38135
+ if (typeof value === "function")
38136
+ return value;
38137
+ if (value != null)
38138
+ throw new TypeError(`Expected the "${key}" option to be a function`);
38139
+ if (required2)
38140
+ throw new TypeError(`Missing required option "${key}"`);
38141
+ return null;
38142
+ };
38143
+ var getLength = ({ length }) => {
38144
+ if (Number.isInteger(length) && length >= 0)
38145
+ return length;
38146
+ throw new TypeError("Expected function.length to be a positive integer");
38147
+ };
38148
+ });
38149
+
38150
+ // ../../node_modules/better-sqlite3/lib/methods/table.js
38151
+ var require_table = __commonJS((exports, module) => {
38152
+ var { cppdb } = require_util3();
38153
+ module.exports = function defineTable(name17, factory) {
38154
+ if (typeof name17 !== "string")
38155
+ throw new TypeError("Expected first argument to be a string");
38156
+ if (!name17)
38157
+ throw new TypeError("Virtual table module name cannot be an empty string");
38158
+ let eponymous = false;
38159
+ if (typeof factory === "object" && factory !== null) {
38160
+ eponymous = true;
38161
+ factory = defer(parseTableDefinition(factory, "used", name17));
38162
+ } else {
38163
+ if (typeof factory !== "function")
38164
+ throw new TypeError("Expected second argument to be a function or a table definition object");
38165
+ factory = wrapFactory(factory);
38166
+ }
38167
+ this[cppdb].table(factory, name17, eponymous);
38168
+ return this;
38169
+ };
38170
+ function wrapFactory(factory) {
38171
+ return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
38172
+ const thisObject = {
38173
+ module: moduleName,
38174
+ database: databaseName,
38175
+ table: tableName
38176
+ };
38177
+ const def = apply2.call(factory, thisObject, args);
38178
+ if (typeof def !== "object" || def === null) {
38179
+ throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
38180
+ }
38181
+ return parseTableDefinition(def, "returned", moduleName);
38182
+ };
38183
+ }
38184
+ function parseTableDefinition(def, verb, moduleName) {
38185
+ if (!hasOwnProperty10.call(def, "rows")) {
38186
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
38187
+ }
38188
+ if (!hasOwnProperty10.call(def, "columns")) {
38189
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
38190
+ }
38191
+ const rows = def.rows;
38192
+ if (typeof rows !== "function" || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
38193
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
38194
+ }
38195
+ let columns = def.columns;
38196
+ if (!Array.isArray(columns) || !(columns = [...columns]).every((x2) => typeof x2 === "string")) {
38197
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
38198
+ }
38199
+ if (columns.length !== new Set(columns).size) {
38200
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
38201
+ }
38202
+ if (!columns.length) {
38203
+ throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
38204
+ }
38205
+ let parameters;
38206
+ if (hasOwnProperty10.call(def, "parameters")) {
38207
+ parameters = def.parameters;
38208
+ if (!Array.isArray(parameters) || !(parameters = [...parameters]).every((x2) => typeof x2 === "string")) {
38209
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
38210
+ }
38211
+ } else {
38212
+ parameters = inferParameters(rows);
38213
+ }
38214
+ if (parameters.length !== new Set(parameters).size) {
38215
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
38216
+ }
38217
+ if (parameters.length > 32) {
38218
+ throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
38219
+ }
38220
+ for (const parameter of parameters) {
38221
+ if (columns.includes(parameter)) {
38222
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
38223
+ }
38224
+ }
38225
+ let safeIntegers = 2;
38226
+ if (hasOwnProperty10.call(def, "safeIntegers")) {
38227
+ const bool = def.safeIntegers;
38228
+ if (typeof bool !== "boolean") {
38229
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
38230
+ }
38231
+ safeIntegers = +bool;
38232
+ }
38233
+ let directOnly = false;
38234
+ if (hasOwnProperty10.call(def, "directOnly")) {
38235
+ directOnly = def.directOnly;
38236
+ if (typeof directOnly !== "boolean") {
38237
+ throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
38238
+ }
38239
+ }
38240
+ const columnDefinitions = [
38241
+ ...parameters.map(identifier).map((str) => `${str} HIDDEN`),
38242
+ ...columns.map(identifier)
38243
+ ];
38244
+ return [
38245
+ `CREATE TABLE x(${columnDefinitions.join(", ")});`,
38246
+ wrapGenerator(rows, new Map(columns.map((x2, i2) => [x2, parameters.length + i2])), moduleName),
38247
+ parameters,
38248
+ safeIntegers,
38249
+ directOnly
38250
+ ];
38251
+ }
38252
+ function wrapGenerator(generator, columnMap, moduleName) {
38253
+ return function* virtualTable(...args) {
38254
+ const output = args.map((x2) => Buffer.isBuffer(x2) ? Buffer.from(x2) : x2);
38255
+ for (let i2 = 0;i2 < columnMap.size; ++i2) {
38256
+ output.push(null);
38257
+ }
38258
+ for (const row of generator(...args)) {
38259
+ if (Array.isArray(row)) {
38260
+ extractRowArray(row, output, columnMap.size, moduleName);
38261
+ yield output;
38262
+ } else if (typeof row === "object" && row !== null) {
38263
+ extractRowObject(row, output, columnMap, moduleName);
38264
+ yield output;
38265
+ } else {
38266
+ throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
38267
+ }
38268
+ }
38269
+ };
38270
+ }
38271
+ function extractRowArray(row, output, columnCount, moduleName) {
38272
+ if (row.length !== columnCount) {
38273
+ throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
38274
+ }
38275
+ const offset = output.length - columnCount;
38276
+ for (let i2 = 0;i2 < columnCount; ++i2) {
38277
+ output[i2 + offset] = row[i2];
38278
+ }
38279
+ }
38280
+ function extractRowObject(row, output, columnMap, moduleName) {
38281
+ let count = 0;
38282
+ for (const key of Object.keys(row)) {
38283
+ const index = columnMap.get(key);
38284
+ if (index === undefined) {
38285
+ throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
38286
+ }
38287
+ output[index] = row[key];
38288
+ count += 1;
38289
+ }
38290
+ if (count !== columnMap.size) {
38291
+ throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
38292
+ }
38293
+ }
38294
+ function inferParameters({ length }) {
38295
+ if (!Number.isInteger(length) || length < 0) {
38296
+ throw new TypeError("Expected function.length to be a positive integer");
38297
+ }
38298
+ const params = [];
38299
+ for (let i2 = 0;i2 < length; ++i2) {
38300
+ params.push(`$${i2 + 1}`);
38301
+ }
38302
+ return params;
38303
+ }
38304
+ var { hasOwnProperty: hasOwnProperty10 } = Object.prototype;
38305
+ var { apply: apply2 } = Function.prototype;
38306
+ var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {});
38307
+ var identifier = (str) => `"${str.replace(/"/g, '""')}"`;
38308
+ var defer = (x2) => () => x2;
38309
+ });
38310
+
38311
+ // ../../node_modules/better-sqlite3/lib/methods/inspect.js
38312
+ var require_inspect = __commonJS((exports, module) => {
38313
+ var DatabaseInspection = function Database() {};
38314
+ module.exports = function inspect(depth, opts) {
38315
+ return Object.assign(new DatabaseInspection, this);
38316
+ };
38317
+ });
38318
+
38319
+ // ../../node_modules/better-sqlite3/lib/database.js
38320
+ var require_database = __commonJS((exports, module) => {
38321
+ var fs4 = __require("fs");
38322
+ var path = __require("path");
38323
+ var util2 = require_util3();
38324
+ var SqliteError = require_sqlite_error();
38325
+ var DEFAULT_ADDON;
38326
+ function Database(filenameGiven, options) {
38327
+ if (new.target == null) {
38328
+ return new Database(filenameGiven, options);
38329
+ }
38330
+ let buffer;
38331
+ if (Buffer.isBuffer(filenameGiven)) {
38332
+ buffer = filenameGiven;
38333
+ filenameGiven = ":memory:";
38334
+ }
38335
+ if (filenameGiven == null)
38336
+ filenameGiven = "";
38337
+ if (options == null)
38338
+ options = {};
38339
+ if (typeof filenameGiven !== "string")
38340
+ throw new TypeError("Expected first argument to be a string");
38341
+ if (typeof options !== "object")
38342
+ throw new TypeError("Expected second argument to be an options object");
38343
+ if ("readOnly" in options)
38344
+ throw new TypeError('Misspelled option "readOnly" should be "readonly"');
38345
+ if ("memory" in options)
38346
+ throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
38347
+ const filename = filenameGiven.trim();
38348
+ const anonymous = filename === "" || filename === ":memory:";
38349
+ const readonly2 = util2.getBooleanOption(options, "readonly");
38350
+ const fileMustExist = util2.getBooleanOption(options, "fileMustExist");
38351
+ const timeout = "timeout" in options ? options.timeout : 5000;
38352
+ const verbose = "verbose" in options ? options.verbose : null;
38353
+ const nativeBinding = "nativeBinding" in options ? options.nativeBinding : null;
38354
+ if (readonly2 && anonymous && !buffer)
38355
+ throw new TypeError("In-memory/temporary databases cannot be readonly");
38356
+ if (!Number.isInteger(timeout) || timeout < 0)
38357
+ throw new TypeError('Expected the "timeout" option to be a positive integer');
38358
+ if (timeout > 2147483647)
38359
+ throw new RangeError('Option "timeout" cannot be greater than 2147483647');
38360
+ if (verbose != null && typeof verbose !== "function")
38361
+ throw new TypeError('Expected the "verbose" option to be a function');
38362
+ if (nativeBinding != null && typeof nativeBinding !== "string" && typeof nativeBinding !== "object")
38363
+ throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
38364
+ let addon;
38365
+ if (nativeBinding == null) {
38366
+ addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
38367
+ } else if (typeof nativeBinding === "string") {
38368
+ const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
38369
+ addon = requireFunc(path.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
38370
+ } else {
38371
+ addon = nativeBinding;
38372
+ }
38373
+ if (!addon.isInitialized) {
38374
+ addon.setErrorConstructor(SqliteError);
38375
+ addon.isInitialized = true;
38376
+ }
38377
+ if (!anonymous && !filename.startsWith("file:") && !fs4.existsSync(path.dirname(filename))) {
38378
+ throw new TypeError("Cannot open database because the directory does not exist");
38379
+ }
38380
+ Object.defineProperties(this, {
38381
+ [util2.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly2, fileMustExist, timeout, verbose || null, buffer || null) },
38382
+ ...wrappers.getters
38383
+ });
38384
+ }
38385
+ var wrappers = require_wrappers();
38386
+ Database.prototype.prepare = wrappers.prepare;
38387
+ Database.prototype.transaction = require_transaction();
38388
+ Database.prototype.pragma = require_pragma();
38389
+ Database.prototype.backup = require_backup();
38390
+ Database.prototype.serialize = require_serialize();
38391
+ Database.prototype.function = require_function();
38392
+ Database.prototype.aggregate = require_aggregate();
38393
+ Database.prototype.table = require_table();
38394
+ Database.prototype.loadExtension = wrappers.loadExtension;
38395
+ Database.prototype.exec = wrappers.exec;
38396
+ Database.prototype.close = wrappers.close;
38397
+ Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
38398
+ Database.prototype.unsafeMode = wrappers.unsafeMode;
38399
+ Database.prototype[util2.inspect] = require_inspect();
38400
+ module.exports = Database;
38401
+ });
38402
+
38403
+ // ../../node_modules/better-sqlite3/lib/index.js
38404
+ var require_lib2 = __commonJS((exports, module) => {
38405
+ module.exports = require_database();
38406
+ module.exports.SqliteError = require_sqlite_error();
38407
+ });
38408
+
37644
38409
  // ../../node_modules/ws/lib/constants.js
37645
38410
  var require_constants = __commonJS((exports, module) => {
37646
38411
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
@@ -40499,7 +41264,7 @@ var {
40499
41264
  Help
40500
41265
  } = import__.default;
40501
41266
  // package.json
40502
- var version = "0.9.88";
41267
+ var version = "0.9.89";
40503
41268
 
40504
41269
  // src/runner.ts
40505
41270
  import { execSync } from "node:child_process";
@@ -54123,6 +54888,13 @@ function date4(params) {
54123
54888
 
54124
54889
  // ../../node_modules/zod/v4/classic/external.js
54125
54890
  config(en_default());
54891
+ // ../core/src/config/memory.ts
54892
+ var memoryConfigSchema = exports_external.object({
54893
+ enabled: exports_external.boolean().optional().default(true),
54894
+ type: exports_external.enum(["sqlite", "memory"]).optional().default("sqlite"),
54895
+ path: exports_external.string().optional().default("~/.config/polka-codes/memory.sqlite")
54896
+ }).strict().optional();
54897
+
54126
54898
  // ../core/src/config.ts
54127
54899
  var ruleSchema = exports_external.union([
54128
54900
  exports_external.string(),
@@ -54255,7 +55027,8 @@ var configSchema = exports_external.object({
54255
55027
  mcpServers: exports_external.record(exports_external.string(), mcpServerConfigSchema).optional(),
54256
55028
  rules: exports_external.array(ruleSchema).optional().or(exports_external.string()).optional(),
54257
55029
  excludeFiles: exports_external.array(exports_external.string()).optional(),
54258
- agent: agentSchema
55030
+ agent: agentSchema,
55031
+ memory: memoryConfigSchema
54259
55032
  }).strict().nullish();
54260
55033
  // ../core/src/skills/constants.ts
54261
55034
  var SKILL_LIMITS = {
@@ -54728,14 +55501,40 @@ var readBinaryFile_default = {
54728
55501
  // ../core/src/tools/readFile.ts
54729
55502
  var toolInfo6 = {
54730
55503
  name: "readFile",
54731
- description: "Request to read the contents of one or multiple files at the specified paths. Use comma separated paths to read multiple files. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. May not be suitable for other types of binary files, as it returns the raw content as a string. Try to list all the potential files are relevent to the task, and then use this tool to read all the relevant files.",
55504
+ description: `Request to read the contents of one or multiple files at the specified paths.
55505
+
55506
+ When to use:
55507
+ - Examining file contents you don't know
55508
+ - Analyzing code, reviewing text files, extracting configuration info
55509
+ - Reading multiple files at once (use comma-separated paths)
55510
+ - Understanding file structure before editing
55511
+
55512
+ When NOT to use:
55513
+ - For file existence checks: Use listFiles instead
55514
+ - For searching within files: Use grep instead
55515
+ - For file name searches: Use searchFiles instead
55516
+ - Prefer this tool over executeCommand with cat/head/tail
55517
+
55518
+ Features:
55519
+ - Supports comma-separated paths for multiple files
55520
+ - Line numbers included for easy reference
55521
+ - Optional offset/limit for partial file reading
55522
+ - Automatically handles different file types
55523
+
55524
+ IMPORTANT:
55525
+ - Line numbers are included for easy reference
55526
+ - Use offset/limit for large files to read specific sections`,
54732
55527
  parameters: exports_external.object({
54733
55528
  path: exports_external.preprocess((val) => {
54734
55529
  if (!val)
54735
55530
  return [];
54736
- const values = Array.isArray(val) ? val : [val];
54737
- return values.flatMap((i) => typeof i === "string" ? i.split(",") : []).filter((s) => s.length > 0);
55531
+ if (Array.isArray(val)) {
55532
+ return val.filter((s) => typeof s === "string" && s.length > 0);
55533
+ }
55534
+ return val.split(",").filter((s) => s.length > 0);
54738
55535
  }, exports_external.array(exports_external.string())).describe("The path of the file to read").meta({ usageValue: "Comma separated paths here" }),
55536
+ offset: exports_external.number().optional().describe("Skip first N lines (for partial file reading)").meta({ usageValue: "100" }),
55537
+ limit: exports_external.number().optional().describe("Read at most N lines (for partial file reading)").meta({ usageValue: "50" }),
54739
55538
  includeIgnored: exports_external.preprocess(preprocessBoolean, exports_external.boolean().nullish().default(false)).describe("Whether to include ignored files. Use true to include files ignored by .gitignore.").meta({ usageValue: "true or false (optional)" })
54740
55539
  }).meta({
54741
55540
  examples: [
@@ -54750,6 +55549,14 @@ var toolInfo6 = {
54750
55549
  input: {
54751
55550
  path: "src/main.js,src/index.js"
54752
55551
  }
55552
+ },
55553
+ {
55554
+ description: "Read partial file (lines 100-150)",
55555
+ input: {
55556
+ path: "src/large-file.ts",
55557
+ offset: 100,
55558
+ limit: 50
55559
+ }
54753
55560
  }
54754
55561
  ]
54755
55562
  })
@@ -54758,15 +55565,39 @@ var handler6 = async (provider, args) => {
54758
55565
  if (!provider.readFile) {
54759
55566
  return createProviderErrorResponse("read file");
54760
55567
  }
54761
- const { path: paths, includeIgnored } = toolInfo6.parameters.parse(args);
55568
+ const parsed = toolInfo6.parameters.safeParse(args);
55569
+ if (!parsed.success) {
55570
+ return {
55571
+ success: false,
55572
+ message: {
55573
+ type: "error-text",
55574
+ value: `Invalid arguments for readFile: ${parsed.error.message}`
55575
+ }
55576
+ };
55577
+ }
55578
+ const { path: paths, offset, limit, includeIgnored } = parsed.data;
54762
55579
  const resp = [];
54763
55580
  for (const path of paths) {
54764
55581
  const fileContent = await provider.readFile(path, includeIgnored ?? false);
54765
55582
  if (!fileContent) {
54766
55583
  resp.push(createFileElement("read_file_file_content", path, undefined, { file_not_found: "true" }));
54767
- } else {
54768
- resp.push(createFileElement("read_file_file_content", path, fileContent));
55584
+ continue;
54769
55585
  }
55586
+ let lines = fileContent.split(`
55587
+ `);
55588
+ const start = offset ?? 0;
55589
+ const end = limit ? start + limit : lines.length;
55590
+ if (offset !== undefined || limit !== undefined) {
55591
+ lines = lines.slice(start, end);
55592
+ }
55593
+ const lineOffset = offset ?? 0;
55594
+ const numberedContent = lines.map((line, i) => {
55595
+ const lineNumber = lineOffset + i + 1;
55596
+ const paddedNumber = String(lineNumber).padStart(6, " ");
55597
+ return `${paddedNumber}→${line}`;
55598
+ }).join(`
55599
+ `);
55600
+ resp.push(createFileElement("read_file_file_content", path, numberedContent));
54770
55601
  }
54771
55602
  return {
54772
55603
  success: true,
@@ -54963,7 +55794,43 @@ var replaceInFile = (fileContent, diff) => {
54963
55794
  // ../core/src/tools/replaceInFile.ts
54964
55795
  var toolInfo9 = {
54965
55796
  name: "replaceInFile",
54966
- description: "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.",
55797
+ description: `Request to replace sections of content in an existing file using
55798
+ SEARCH/REPLACE blocks.
55799
+
55800
+ When to use:
55801
+ - Making targeted changes to specific parts of a file
55802
+ - Replacing variable names, function signatures, imports
55803
+ - Fixing bugs in existing code
55804
+ - When you know the exact content to replace
55805
+
55806
+ When NOT to use:
55807
+ - For creating new files: Use writeToFile instead
55808
+ - For completely replacing file contents: Use writeToFile instead
55809
+ - When you don't know the exact content: Read file first
55810
+
55811
+ SEARCH/REPLACE FORMAT:
55812
+ <<<<<<< SEARCH
55813
+ [exact content to find]
55814
+ =======
55815
+ [new content to replace with]
55816
+ >>>>>>> REPLACE
55817
+
55818
+ Critical rules:
55819
+ 1. SEARCH content must match EXACTLY (character-for-character including whitespace)
55820
+ 2. Each block replaces only first occurrence
55821
+ 3. Include just enough lines for uniqueness (not too many, not too few)
55822
+ 4. Keep blocks concise (don't include long unchanged sections)
55823
+ 5. List blocks in order they appear in file
55824
+ 6. Use multiple blocks for multiple independent changes
55825
+
55826
+ Special operations:
55827
+ - Move code: Two blocks (delete from original + insert at new location)
55828
+ - Delete code: Empty REPLACE section
55829
+
55830
+ IMPORTANT CONSTRAINTS:
55831
+ - SEARCH text must match file content exactly
55832
+ - Each block is independent (doesn't affect other blocks)
55833
+ - Cannot use for appending or inserting without SEARCH context`,
54967
55834
  parameters: exports_external.object({
54968
55835
  path: exports_external.string().describe("The path of the file to modify").meta({ usageValue: "File path here" }),
54969
55836
  diff: exports_external.string().describe(`One or more SEARCH/REPLACE blocks following this exact format:
@@ -54989,7 +55856,7 @@ Critical rules:
54989
55856
  * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.
54990
55857
  4. Special operations:
54991
55858
  * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)
54992
- * To delete code: Use empty REPLACE section`).meta({ usageValue: "Search and replace blocks here" })
55859
+ * To delete code: Empty REPLACE section`).meta({ usageValue: "Search and replace blocks here" })
54993
55860
  }).meta({
54994
55861
  examples: [
54995
55862
  {
@@ -55317,7 +56184,27 @@ var UpdateTodoItemOutputSchema = exports_external.object({
55317
56184
  // ../core/src/tools/writeToFile.ts
55318
56185
  var toolInfo12 = {
55319
56186
  name: "writeToFile",
55320
- description: "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file. Ensure that the output content does not include incorrect escaped character patterns such as `&lt;`, `&gt;`, or `&amp;`. Also ensure there is no unwanted CDATA tags in the content.",
56187
+ description: `Request to write content to a file at the specified path.
56188
+
56189
+ When to use:
56190
+ - Creating new files
56191
+ - Completely replacing file contents
56192
+ - When you have the complete intended content
56193
+
56194
+ When NOT to use:
56195
+ - For modifying existing files: Use replaceInFile instead
56196
+ - For appending content: Use executeCommand with echo >> instead
56197
+ - For targeted edits: Use replaceInFile instead
56198
+
56199
+ Features:
56200
+ - Automatically creates any directories needed
56201
+ - Overwrites existing files completely
56202
+ - Must provide complete file content (no truncation)
56203
+
56204
+ IMPORTANT CONSTRAINT:
56205
+ - Always provide COMPLETE intended content (no omissions)
56206
+ - Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)
56207
+ - Ensure no unwanted CDATA tags in content`,
55321
56208
  parameters: exports_external.object({
55322
56209
  path: exports_external.string().describe("The path of the file to write to").meta({ usageValue: "File path here" }),
55323
56210
  content: exports_external.string().describe("The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified.").meta({ usageValue: "Your file content here" })
@@ -55358,10 +56245,7 @@ var handler12 = async (provider, args) => {
55358
56245
  }
55359
56246
  };
55360
56247
  }
55361
- let { path, content } = parsed.data;
55362
- const trimmedContent = content.trim();
55363
- if (trimmedContent.startsWith("<![CDATA[") && trimmedContent.endsWith("]]>"))
55364
- content = trimmedContent.slice(9, -3);
56248
+ const { path, content } = parsed.data;
55365
56249
  await provider.writeFile(path, content);
55366
56250
  return {
55367
56251
  success: true,
@@ -58510,9 +59394,9 @@ class ZodUnion2 extends ZodType2 {
58510
59394
  return this._def.options;
58511
59395
  }
58512
59396
  }
58513
- ZodUnion2.create = (types2, params) => {
59397
+ ZodUnion2.create = (types3, params) => {
58514
59398
  return new ZodUnion2({
58515
- options: types2,
59399
+ options: types3,
58516
59400
  typeName: ZodFirstPartyTypeKind2.ZodUnion,
58517
59401
  ...processCreateParams(params)
58518
59402
  });
@@ -61006,15 +61890,15 @@ var primitiveMappings = {
61006
61890
  function parseUnionDef(def, refs) {
61007
61891
  const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
61008
61892
  if (options.every((x) => (x._def.typeName in primitiveMappings) && (!x._def.checks || !x._def.checks.length))) {
61009
- const types2 = options.reduce((types22, x) => {
61893
+ const types3 = options.reduce((types22, x) => {
61010
61894
  const type = primitiveMappings[x._def.typeName];
61011
61895
  return type && !types22.includes(type) ? [...types22, type] : types22;
61012
61896
  }, []);
61013
61897
  return {
61014
- type: types2.length > 1 ? types2 : types2[0]
61898
+ type: types3.length > 1 ? types3 : types3[0]
61015
61899
  };
61016
61900
  } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
61017
- const types2 = options.reduce((acc, x) => {
61901
+ const types3 = options.reduce((acc, x) => {
61018
61902
  const type = typeof x._def.value;
61019
61903
  switch (type) {
61020
61904
  case "string":
@@ -61033,8 +61917,8 @@ function parseUnionDef(def, refs) {
61033
61917
  return acc;
61034
61918
  }
61035
61919
  }, []);
61036
- if (types2.length === options.length) {
61037
- const uniqueTypes = types2.filter((x, i, a) => a.indexOf(x) === i);
61920
+ if (types3.length === options.length) {
61921
+ const uniqueTypes = types3.filter((x, i, a) => a.indexOf(x) === i);
61038
61922
  return {
61039
61923
  type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
61040
61924
  enum: options.reduce((acc, x) => {
@@ -65772,9 +66656,9 @@ var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
65772
66656
  var freeProcess = moduleExports2 && _freeGlobal_default.process;
65773
66657
  var nodeUtil = function() {
65774
66658
  try {
65775
- var types3 = freeModule2 && freeModule2.require && freeModule2.require("util").types;
65776
- if (types3) {
65777
- return types3;
66659
+ var types4 = freeModule2 && freeModule2.require && freeModule2.require("util").types;
66660
+ if (types4) {
66661
+ return types4;
65778
66662
  }
65779
66663
  return freeProcess && freeProcess.binding && freeProcess.binding("util");
65780
66664
  } catch (e) {}
@@ -69825,7 +70709,7 @@ function lookup(path) {
69825
70709
  }
69826
70710
  return $types[extension2] || false;
69827
70711
  }
69828
- function populateMaps(extensions, types5) {
70712
+ function populateMaps(extensions, types6) {
69829
70713
  Object.keys(db).forEach(function forEachMimeType(type) {
69830
70714
  var mime = db[type];
69831
70715
  var exts = mime.extensions;
@@ -69835,10 +70719,10 @@ function populateMaps(extensions, types5) {
69835
70719
  extensions[type] = exts;
69836
70720
  for (var i2 = 0;i2 < exts.length; i2++) {
69837
70721
  var extension2 = exts[i2];
69838
- types5[extension2] = _preferredType(extension2, types5[extension2], type);
69839
- const legacyType = _preferredTypeLegacy(extension2, types5[extension2], type);
69840
- if (legacyType !== types5[extension2]) {
69841
- $_extensionConflicts.push([extension2, legacyType, types5[extension2]]);
70722
+ types6[extension2] = _preferredType(extension2, types6[extension2], type);
70723
+ const legacyType = _preferredTypeLegacy(extension2, types6[extension2], type);
70724
+ if (legacyType !== types6[extension2]) {
70725
+ $_extensionConflicts.push([extension2, legacyType, types6[extension2]]);
69842
70726
  }
69843
70727
  }
69844
70728
  });
@@ -70143,35 +71027,35 @@ var getProvider = (options = {}) => {
70143
71027
  }
70144
71028
  },
70145
71029
  listMemoryTopics: async () => {
70146
- const memory = await memoryStore.read() ?? {};
70147
- return Object.keys(memory);
71030
+ const memory2 = await memoryStore.read() ?? {};
71031
+ return Object.keys(memory2);
70148
71032
  },
70149
71033
  readMemory: async (topic = defaultMemoryTopic) => {
70150
- const memory = await memoryStore.read() ?? {};
70151
- return memory[topic];
71034
+ const memory2 = await memoryStore.read() ?? {};
71035
+ return memory2[topic];
70152
71036
  },
70153
71037
  updateMemory: async (operation, topic, content) => {
70154
71038
  const memoryTopic = topic ?? defaultMemoryTopic;
70155
- const memory = await memoryStore.read() ?? {};
71039
+ const memory2 = await memoryStore.read() ?? {};
70156
71040
  switch (operation) {
70157
71041
  case "append":
70158
71042
  if (content === undefined) {
70159
71043
  throw new Error("Content is required for append operation.");
70160
71044
  }
70161
- memory[memoryTopic] = `${memory[memoryTopic] || ""}
71045
+ memory2[memoryTopic] = `${memory2[memoryTopic] || ""}
70162
71046
  ${content}`;
70163
71047
  break;
70164
71048
  case "replace":
70165
71049
  if (content === undefined) {
70166
71050
  throw new Error("Content is required for replace operation.");
70167
71051
  }
70168
- memory[memoryTopic] = content;
71052
+ memory2[memoryTopic] = content;
70169
71053
  break;
70170
71054
  case "remove":
70171
- delete memory[memoryTopic];
71055
+ delete memory2[memoryTopic];
70172
71056
  break;
70173
71057
  }
70174
- await memoryStore.write(memory);
71058
+ await memoryStore.write(memory2);
70175
71059
  },
70176
71060
  readFile: async (path, includeIgnored) => {
70177
71061
  if (!includeIgnored && ig.ignores(path)) {
@@ -70338,6 +71222,8 @@ ${content}`;
70338
71222
  }
70339
71223
  return provider2;
70340
71224
  };
71225
+ // ../cli-shared/src/sqlite-memory-store.ts
71226
+ var import_better_sqlite3 = __toESM(require_lib2(), 1);
70341
71227
  // ../cli-shared/src/utils/eventHandler.ts
70342
71228
  var taskToolCallStats = new Map;
70343
71229
  var globalToolCallStats = new Map;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/runner",
3
- "version": "0.9.88",
3
+ "version": "0.9.89",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@ai-sdk/provider": "^2.0.1",
21
- "@polka-codes/cli-shared": "0.9.86",
22
- "@polka-codes/core": "0.9.86",
21
+ "@polka-codes/cli-shared": "0.9.88",
22
+ "@polka-codes/core": "0.9.88",
23
23
  "commander": "^14.0.2",
24
24
  "dotenv": "^17.2.3",
25
25
  "ignore": "^7.0.5",