tarsk 0.5.39 → 0.5.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.
Files changed (46) hide show
  1. package/dist/index.js +473 -3578
  2. package/dist/public/assets/{account-view-BT90zNSx.js → account-view-D-dJ0y-D.js} +1 -1
  3. package/dist/public/assets/{api-DWU0D34A.js → api-DJaJqkc6.js} +1 -1
  4. package/dist/public/assets/{browser-tab-Bp486a9f.js → browser-tab-D7wEj-BD.js} +1 -1
  5. package/dist/public/assets/{commit-dialog-90PGbqs8.js → commit-dialog-DdhGDH4F.js} +1 -1
  6. package/dist/public/assets/{context-menu-C7FTMa2c.js → context-menu-asf2g-KX.js} +1 -1
  7. package/dist/public/assets/{create-repo-dialog-BkUdww3q.js → create-repo-dialog-Bltp6PKZ.js} +1 -1
  8. package/dist/public/assets/{dialogs-config-DZKtVbNK.js → dialogs-config-B-LZ4nOb.js} +1 -1
  9. package/dist/public/assets/{diff-view-B4G8vqZa.js → diff-view-Bi545EPj.js} +1 -1
  10. package/dist/public/assets/{explorer-tab-view-DEQFid8r.js → explorer-tab-view-B-P555GE.js} +2 -2
  11. package/dist/public/assets/{explorer-tree-CPHGgahA.js → explorer-tree-CyXhVrI7.js} +1 -1
  12. package/dist/public/assets/{explorer-view-BTvhSMDQ.js → explorer-view-BAHDhIGN.js} +1 -1
  13. package/dist/public/assets/{git-history-dialog-Bqv0bD41.js → git-history-dialog-Bci_iQmi.js} +1 -1
  14. package/dist/public/assets/{git-ops-button-BnVMlOO3.js → git-ops-button-1lum9QXI.js} +2 -2
  15. package/dist/public/assets/{history-view-jX3PPID6.js → history-view-CAkN8PCo.js} +1 -1
  16. package/dist/public/assets/index-BLO68CQl.js +69 -0
  17. package/dist/public/assets/{mcp-server-card-CTCrhFIS.js → mcp-server-card-DQUpkDFV.js} +1 -1
  18. package/dist/public/assets/{merged-pr-dialog-B2qqrQ1g.js → merged-pr-dialog-tHPrJ2CK.js} +1 -1
  19. package/dist/public/assets/{onboarding-CxtzQldG.js → onboarding-Bbvb7kO4.js} +1 -1
  20. package/dist/public/assets/{project-settings-view-ZJjQbFbQ.js → project-settings-view-BRkHOq_q.js} +1 -1
  21. package/dist/public/assets/{providers-list-view-BH13AB_H.js → providers-list-view-Dex879vv.js} +1 -1
  22. package/dist/public/assets/{pull-request-dialog-ZzVXh6M9.js → pull-request-dialog-WHdmrW83.js} +1 -1
  23. package/dist/public/assets/{pull-with-changes-dialog-LUgd2a4S.js → pull-with-changes-dialog-Ck3OwINV.js} +1 -1
  24. package/dist/public/assets/{push-before-pr-dialog-CFmgu9H_.js → push-before-pr-dialog-Bvqvz04U.js} +1 -1
  25. package/dist/public/assets/{radio-group-Bd8YbtFD.js → radio-group-B0xvu5B9.js} +1 -1
  26. package/dist/public/assets/{react-vendor-Ba8DSNiO.js → react-vendor-D8PTA4EX.js} +1 -1
  27. package/dist/public/assets/{settings-general-view-C8muiP_K.js → settings-general-view-lUxshNA9.js} +1 -1
  28. package/dist/public/assets/{settings-instructions-view-CV7lRPuw.js → settings-instructions-view-C57XGLha.js} +1 -1
  29. package/dist/public/assets/{settings-list-CKPEGohm.js → settings-list-CHGKmGl_.js} +1 -1
  30. package/dist/public/assets/{settings-mcp-servers-view-3gN9ly3z.js → settings-mcp-servers-view-DpqkhrgB.js} +1 -1
  31. package/dist/public/assets/{settings-models-skeleton-l966LEN8.js → settings-models-skeleton-ClrbJy_p.js} +1 -1
  32. package/dist/public/assets/{settings-models-view-CAMouMhE.js → settings-models-view-QPEdnibD.js} +1 -1
  33. package/dist/public/assets/{settings-rules-view-BnazfbJb.js → settings-rules-view-WJU--cRq.js} +1 -1
  34. package/dist/public/assets/{settings-skills-view-DpzKFcpf.js → settings-skills-view-mgHy4G_g.js} +1 -1
  35. package/dist/public/assets/{settings-slash-commands-view-Drje2Dl4.js → settings-slash-commands-view-LB5tVqy1.js} +1 -1
  36. package/dist/public/assets/{settings-subagents-view-D05kHO1W.js → settings-subagents-view-QR2qlA_y.js} +1 -1
  37. package/dist/public/assets/{settings-system-prompt-view-DQmSdSnp.js → settings-system-prompt-view-Dl66VFaj.js} +1 -1
  38. package/dist/public/assets/{settings-view-B6e0GfSv.js → settings-view-BlVJv4Pz.js} +2 -2
  39. package/dist/public/assets/{skeleton-qzmFgKhS.js → skeleton-K-fVduHt.js} +1 -1
  40. package/dist/public/assets/{terminal-panel-BzCO142Q.js → terminal-panel-BGQxckfH.js} +1 -1
  41. package/dist/public/assets/{ui-components-f8jJJzEo.js → ui-components-C4RrfJEJ.js} +1 -1
  42. package/dist/public/assets/{utils-BlXPFbY9.js → utils-B7FQXlI6.js} +1 -1
  43. package/dist/public/index.html +6 -6
  44. package/dist/recommended-models.txt +1 -1
  45. package/package.json +4 -4
  46. package/dist/public/assets/index-DjD2SPNZ.js +0 -65
package/dist/index.js CHANGED
@@ -1,36 +1,13 @@
1
1
  #!/usr/bin/env node
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
4
  var __esm = (fn, res) => function __init() {
9
5
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
6
  };
11
- var __commonJS = (cb, mod) => function __require() {
12
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
- };
14
7
  var __export = (target, all) => {
15
8
  for (var name in all)
16
9
  __defProp(target, name, { get: all[name], enumerable: true });
17
10
  };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
- // If the importer is in node compatibility mode or this is not an ESM
28
- // file that has been converted to a CommonJS file using a Babel-
29
- // compatible transform (i.e. "__esModule" has not been set), then set
30
- // "default" to the CommonJS "module.exports" for node compatibility.
31
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
- mod
33
- ));
34
11
 
35
12
  // src/core/tarsk-debug.ts
36
13
  function isTarskDebugLoggingEnabled() {
@@ -970,463 +947,6 @@ var init_database = __esm({
970
947
  }
971
948
  });
972
949
 
973
- // ../node_modules/.bun/ignore@7.0.5/node_modules/ignore/index.js
974
- var require_ignore = __commonJS({
975
- "../node_modules/.bun/ignore@7.0.5/node_modules/ignore/index.js"(exports, module) {
976
- function makeArray(subject) {
977
- return Array.isArray(subject) ? subject : [subject];
978
- }
979
- var UNDEFINED = void 0;
980
- var EMPTY = "";
981
- var SPACE = " ";
982
- var ESCAPE = "\\";
983
- var REGEX_TEST_BLANK_LINE = /^\s+$/;
984
- var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
985
- var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
986
- var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
987
- var REGEX_SPLITALL_CRLF = /\r?\n/g;
988
- var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
989
- var REGEX_TEST_TRAILING_SLASH = /\/$/;
990
- var SLASH = "/";
991
- var TMP_KEY_IGNORE = "node-ignore";
992
- if (typeof Symbol !== "undefined") {
993
- TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
994
- }
995
- var KEY_IGNORE = TMP_KEY_IGNORE;
996
- var define = (object, key, value) => {
997
- Object.defineProperty(object, key, { value });
998
- return value;
999
- };
1000
- var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
1001
- var RETURN_FALSE = () => false;
1002
- var sanitizeRange = (range) => range.replace(
1003
- REGEX_REGEXP_RANGE,
1004
- (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
1005
- );
1006
- var cleanRangeBackSlash = (slashes) => {
1007
- const { length } = slashes;
1008
- return slashes.slice(0, length - length % 2);
1009
- };
1010
- var REPLACERS = [
1011
- [
1012
- // Remove BOM
1013
- // TODO:
1014
- // Other similar zero-width characters?
1015
- /^\uFEFF/,
1016
- () => EMPTY
1017
- ],
1018
- // > Trailing spaces are ignored unless they are quoted with backslash ("\")
1019
- [
1020
- // (a\ ) -> (a )
1021
- // (a ) -> (a)
1022
- // (a ) -> (a)
1023
- // (a \ ) -> (a )
1024
- /((?:\\\\)*?)(\\?\s+)$/,
1025
- (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
1026
- ],
1027
- // Replace (\ ) with ' '
1028
- // (\ ) -> ' '
1029
- // (\\ ) -> '\\ '
1030
- // (\\\ ) -> '\\ '
1031
- [
1032
- /(\\+?)\s/g,
1033
- (_, m1) => {
1034
- const { length } = m1;
1035
- return m1.slice(0, length - length % 2) + SPACE;
1036
- }
1037
- ],
1038
- // Escape metacharacters
1039
- // which is written down by users but means special for regular expressions.
1040
- // > There are 12 characters with special meanings:
1041
- // > - the backslash \,
1042
- // > - the caret ^,
1043
- // > - the dollar sign $,
1044
- // > - the period or dot .,
1045
- // > - the vertical bar or pipe symbol |,
1046
- // > - the question mark ?,
1047
- // > - the asterisk or star *,
1048
- // > - the plus sign +,
1049
- // > - the opening parenthesis (,
1050
- // > - the closing parenthesis ),
1051
- // > - and the opening square bracket [,
1052
- // > - the opening curly brace {,
1053
- // > These special characters are often called "metacharacters".
1054
- [
1055
- /[\\$.|*+(){^]/g,
1056
- (match) => `\\${match}`
1057
- ],
1058
- [
1059
- // > a question mark (?) matches a single character
1060
- /(?!\\)\?/g,
1061
- () => "[^/]"
1062
- ],
1063
- // leading slash
1064
- [
1065
- // > A leading slash matches the beginning of the pathname.
1066
- // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
1067
- // A leading slash matches the beginning of the pathname
1068
- /^\//,
1069
- () => "^"
1070
- ],
1071
- // replace special metacharacter slash after the leading slash
1072
- [
1073
- /\//g,
1074
- () => "\\/"
1075
- ],
1076
- [
1077
- // > A leading "**" followed by a slash means match in all directories.
1078
- // > For example, "**/foo" matches file or directory "foo" anywhere,
1079
- // > the same as pattern "foo".
1080
- // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
1081
- // > under directory "foo".
1082
- // Notice that the '*'s have been replaced as '\\*'
1083
- /^\^*\\\*\\\*\\\//,
1084
- // '**/foo' <-> 'foo'
1085
- () => "^(?:.*\\/)?"
1086
- ],
1087
- // starting
1088
- [
1089
- // there will be no leading '/'
1090
- // (which has been replaced by section "leading slash")
1091
- // If starts with '**', adding a '^' to the regular expression also works
1092
- /^(?=[^^])/,
1093
- function startingReplacer() {
1094
- return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
1095
- }
1096
- ],
1097
- // two globstars
1098
- [
1099
- // Use lookahead assertions so that we could match more than one `'/**'`
1100
- /\\\/\\\*\\\*(?=\\\/|$)/g,
1101
- // Zero, one or several directories
1102
- // should not use '*', or it will be replaced by the next replacer
1103
- // Check if it is not the last `'/**'`
1104
- (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
1105
- ],
1106
- // normal intermediate wildcards
1107
- [
1108
- // Never replace escaped '*'
1109
- // ignore rule '\*' will match the path '*'
1110
- // 'abc.*/' -> go
1111
- // 'abc.*' -> skip this rule,
1112
- // coz trailing single wildcard will be handed by [trailing wildcard]
1113
- /(^|[^\\]+)(\\\*)+(?=.+)/g,
1114
- // '*.js' matches '.js'
1115
- // '*.js' doesn't match 'abc'
1116
- (_, p1, p2) => {
1117
- const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
1118
- return p1 + unescaped;
1119
- }
1120
- ],
1121
- [
1122
- // unescape, revert step 3 except for back slash
1123
- // For example, if a user escape a '\\*',
1124
- // after step 3, the result will be '\\\\\\*'
1125
- /\\\\\\(?=[$.|*+(){^])/g,
1126
- () => ESCAPE
1127
- ],
1128
- [
1129
- // '\\\\' -> '\\'
1130
- /\\\\/g,
1131
- () => ESCAPE
1132
- ],
1133
- [
1134
- // > The range notation, e.g. [a-zA-Z],
1135
- // > can be used to match one of the characters in a range.
1136
- // `\` is escaped by step 3
1137
- /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
1138
- (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
1139
- ],
1140
- // ending
1141
- [
1142
- // 'js' will not match 'js.'
1143
- // 'ab' will not match 'abc'
1144
- /(?:[^*])$/,
1145
- // WTF!
1146
- // https://git-scm.com/docs/gitignore
1147
- // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
1148
- // which re-fixes #24, #38
1149
- // > If there is a separator at the end of the pattern then the pattern
1150
- // > will only match directories, otherwise the pattern can match both
1151
- // > files and directories.
1152
- // 'js*' will not match 'a.js'
1153
- // 'js/' will not match 'a.js'
1154
- // 'js' will match 'a.js' and 'a.js/'
1155
- (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
1156
- ]
1157
- ];
1158
- var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
1159
- var MODE_IGNORE = "regex";
1160
- var MODE_CHECK_IGNORE = "checkRegex";
1161
- var UNDERSCORE = "_";
1162
- var TRAILING_WILD_CARD_REPLACERS = {
1163
- [MODE_IGNORE](_, p1) {
1164
- const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
1165
- return `${prefix}(?=$|\\/$)`;
1166
- },
1167
- [MODE_CHECK_IGNORE](_, p1) {
1168
- const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
1169
- return `${prefix}(?=$|\\/$)`;
1170
- }
1171
- };
1172
- var makeRegexPrefix = (pattern) => REPLACERS.reduce(
1173
- (prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)),
1174
- pattern
1175
- );
1176
- var isString = (subject) => typeof subject === "string";
1177
- var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
1178
- var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
1179
- var IgnoreRule = class {
1180
- constructor(pattern, mark, body, ignoreCase, negative, prefix) {
1181
- this.pattern = pattern;
1182
- this.mark = mark;
1183
- this.negative = negative;
1184
- define(this, "body", body);
1185
- define(this, "ignoreCase", ignoreCase);
1186
- define(this, "regexPrefix", prefix);
1187
- }
1188
- get regex() {
1189
- const key = UNDERSCORE + MODE_IGNORE;
1190
- if (this[key]) {
1191
- return this[key];
1192
- }
1193
- return this._make(MODE_IGNORE, key);
1194
- }
1195
- get checkRegex() {
1196
- const key = UNDERSCORE + MODE_CHECK_IGNORE;
1197
- if (this[key]) {
1198
- return this[key];
1199
- }
1200
- return this._make(MODE_CHECK_IGNORE, key);
1201
- }
1202
- _make(mode, key) {
1203
- const str = this.regexPrefix.replace(
1204
- REGEX_REPLACE_TRAILING_WILDCARD,
1205
- // It does not need to bind pattern
1206
- TRAILING_WILD_CARD_REPLACERS[mode]
1207
- );
1208
- const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
1209
- return define(this, key, regex);
1210
- }
1211
- };
1212
- var createRule2 = ({
1213
- pattern,
1214
- mark
1215
- }, ignoreCase) => {
1216
- let negative = false;
1217
- let body = pattern;
1218
- if (body.indexOf("!") === 0) {
1219
- negative = true;
1220
- body = body.substr(1);
1221
- }
1222
- body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
1223
- const regexPrefix = makeRegexPrefix(body);
1224
- return new IgnoreRule(
1225
- pattern,
1226
- mark,
1227
- body,
1228
- ignoreCase,
1229
- negative,
1230
- regexPrefix
1231
- );
1232
- };
1233
- var RuleManager2 = class {
1234
- constructor(ignoreCase) {
1235
- this._ignoreCase = ignoreCase;
1236
- this._rules = [];
1237
- }
1238
- _add(pattern) {
1239
- if (pattern && pattern[KEY_IGNORE]) {
1240
- this._rules = this._rules.concat(pattern._rules._rules);
1241
- this._added = true;
1242
- return;
1243
- }
1244
- if (isString(pattern)) {
1245
- pattern = {
1246
- pattern
1247
- };
1248
- }
1249
- if (checkPattern(pattern.pattern)) {
1250
- const rule = createRule2(pattern, this._ignoreCase);
1251
- this._added = true;
1252
- this._rules.push(rule);
1253
- }
1254
- }
1255
- // @param {Array<string> | string | Ignore} pattern
1256
- add(pattern) {
1257
- this._added = false;
1258
- makeArray(
1259
- isString(pattern) ? splitPattern(pattern) : pattern
1260
- ).forEach(this._add, this);
1261
- return this._added;
1262
- }
1263
- // Test one single path without recursively checking parent directories
1264
- //
1265
- // - checkUnignored `boolean` whether should check if the path is unignored,
1266
- // setting `checkUnignored` to `false` could reduce additional
1267
- // path matching.
1268
- // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
1269
- // @returns {TestResult} true if a file is ignored
1270
- test(path7, checkUnignored, mode) {
1271
- let ignored = false;
1272
- let unignored = false;
1273
- let matchedRule;
1274
- this._rules.forEach((rule) => {
1275
- const { negative } = rule;
1276
- if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
1277
- return;
1278
- }
1279
- const matched = rule[mode].test(path7);
1280
- if (!matched) {
1281
- return;
1282
- }
1283
- ignored = !negative;
1284
- unignored = negative;
1285
- matchedRule = negative ? UNDEFINED : rule;
1286
- });
1287
- const ret = {
1288
- ignored,
1289
- unignored
1290
- };
1291
- if (matchedRule) {
1292
- ret.rule = matchedRule;
1293
- }
1294
- return ret;
1295
- }
1296
- };
1297
- var throwError = (message, Ctor) => {
1298
- throw new Ctor(message);
1299
- };
1300
- var checkPath = (path7, originalPath, doThrow) => {
1301
- if (!isString(path7)) {
1302
- return doThrow(
1303
- `path must be a string, but got \`${originalPath}\``,
1304
- TypeError
1305
- );
1306
- }
1307
- if (!path7) {
1308
- return doThrow(`path must not be empty`, TypeError);
1309
- }
1310
- if (checkPath.isNotRelative(path7)) {
1311
- const r = "`path.relative()`d";
1312
- return doThrow(
1313
- `path should be a ${r} string, but got "${originalPath}"`,
1314
- RangeError
1315
- );
1316
- }
1317
- return true;
1318
- };
1319
- var isNotRelative = (path7) => REGEX_TEST_INVALID_PATH.test(path7);
1320
- checkPath.isNotRelative = isNotRelative;
1321
- checkPath.convert = (p) => p;
1322
- var Ignore = class {
1323
- constructor({
1324
- ignorecase = true,
1325
- ignoreCase = ignorecase,
1326
- allowRelativePaths = false
1327
- } = {}) {
1328
- define(this, KEY_IGNORE, true);
1329
- this._rules = new RuleManager2(ignoreCase);
1330
- this._strictPathCheck = !allowRelativePaths;
1331
- this._initCache();
1332
- }
1333
- _initCache() {
1334
- this._ignoreCache = /* @__PURE__ */ Object.create(null);
1335
- this._testCache = /* @__PURE__ */ Object.create(null);
1336
- }
1337
- add(pattern) {
1338
- if (this._rules.add(pattern)) {
1339
- this._initCache();
1340
- }
1341
- return this;
1342
- }
1343
- // legacy
1344
- addPattern(pattern) {
1345
- return this.add(pattern);
1346
- }
1347
- // @returns {TestResult}
1348
- _test(originalPath, cache, checkUnignored, slices) {
1349
- const path7 = originalPath && checkPath.convert(originalPath);
1350
- checkPath(
1351
- path7,
1352
- originalPath,
1353
- this._strictPathCheck ? throwError : RETURN_FALSE
1354
- );
1355
- return this._t(path7, cache, checkUnignored, slices);
1356
- }
1357
- checkIgnore(path7) {
1358
- if (!REGEX_TEST_TRAILING_SLASH.test(path7)) {
1359
- return this.test(path7);
1360
- }
1361
- const slices = path7.split(SLASH).filter(Boolean);
1362
- slices.pop();
1363
- if (slices.length) {
1364
- const parent = this._t(
1365
- slices.join(SLASH) + SLASH,
1366
- this._testCache,
1367
- true,
1368
- slices
1369
- );
1370
- if (parent.ignored) {
1371
- return parent;
1372
- }
1373
- }
1374
- return this._rules.test(path7, false, MODE_CHECK_IGNORE);
1375
- }
1376
- _t(path7, cache, checkUnignored, slices) {
1377
- if (path7 in cache) {
1378
- return cache[path7];
1379
- }
1380
- if (!slices) {
1381
- slices = path7.split(SLASH).filter(Boolean);
1382
- }
1383
- slices.pop();
1384
- if (!slices.length) {
1385
- return cache[path7] = this._rules.test(path7, checkUnignored, MODE_IGNORE);
1386
- }
1387
- const parent = this._t(
1388
- slices.join(SLASH) + SLASH,
1389
- cache,
1390
- checkUnignored,
1391
- slices
1392
- );
1393
- return cache[path7] = parent.ignored ? parent : this._rules.test(path7, checkUnignored, MODE_IGNORE);
1394
- }
1395
- ignores(path7) {
1396
- return this._test(path7, this._ignoreCache, false).ignored;
1397
- }
1398
- createFilter() {
1399
- return (path7) => !this.ignores(path7);
1400
- }
1401
- filter(paths) {
1402
- return makeArray(paths).filter(this.createFilter());
1403
- }
1404
- // @returns {TestResult}
1405
- test(path7) {
1406
- return this._test(path7, this._testCache, true);
1407
- }
1408
- };
1409
- var factory = (options) => new Ignore(options);
1410
- var isPathValid = (path7) => checkPath(path7 && checkPath.convert(path7), path7, RETURN_FALSE);
1411
- var setupWindows = () => {
1412
- const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
1413
- checkPath.convert = makePosix;
1414
- const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
1415
- checkPath.isNotRelative = (path7) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path7) || isNotRelative(path7);
1416
- };
1417
- if (
1418
- // Detect `process` so that it can run in browsers.
1419
- typeof process !== "undefined" && process.platform === "win32"
1420
- ) {
1421
- setupWindows();
1422
- }
1423
- module.exports = factory;
1424
- factory.default = factory;
1425
- module.exports.isPathValid = isPathValid;
1426
- define(module.exports, /* @__PURE__ */ Symbol.for("setupWindows"), setupWindows);
1427
- }
1428
- });
1429
-
1430
950
  // src/server.ts
1431
951
  import { createAdaptorServer } from "@hono/node-server";
1432
952
  import { serveStatic } from "@hono/node-server/serve-static";
@@ -1704,6 +1224,15 @@ function buildDefaultSystemPrompt(toolNames) {
1704
1224
  const toolList = toolNames.length > 0 ? toolNames.join(", ") : "read, bash, edit, and write";
1705
1225
  return `You are a helpful coding assistant. You have access to ${toolList} tools. Use them to explore and modify the codebase as needed. Skills are created and stored in .agents/skills/ . Use Mermaid for flowcharts, sequence diagrams, state diagrams, or graphs when appropriate. Do not use emojis.`;
1706
1226
  }
1227
+ function formatCurrentDateLine(referenceDate = /* @__PURE__ */ new Date()) {
1228
+ const date = referenceDate.toLocaleDateString("en-US", {
1229
+ weekday: "long",
1230
+ year: "numeric",
1231
+ month: "long",
1232
+ day: "numeric"
1233
+ });
1234
+ return `The current date is ${date}.`;
1235
+ }
1707
1236
 
1708
1237
  // ../shared/dist/image-payload.js
1709
1238
  function isDataImageUrl(value) {
@@ -1986,6 +1515,11 @@ var toolDisplayRegistry = [
1986
1515
  { name: "simple_grep", displayName: "Search", activeDisplayName: "Searching" },
1987
1516
  { name: "todo", displayName: "Todo", activeDisplayName: "Updating" },
1988
1517
  { name: "tool_search", displayName: "Find Tools", activeDisplayName: "Finding Tools" },
1518
+ {
1519
+ name: "web_search",
1520
+ displayName: "Web Search",
1521
+ activeDisplayName: "Searching Web"
1522
+ },
1989
1523
  { name: "write", displayName: "Write", activeDisplayName: "Writing" }
1990
1524
  ];
1991
1525
  var displayByName = new Map(toolDisplayRegistry.map((entry) => [entry.name, entry]));
@@ -2038,2714 +1572,107 @@ var WEB_FETCH_PREAPPROVED_DOMAINS = [
2038
1572
  "tailwindcss.com",
2039
1573
  "vitest.dev",
2040
1574
  "esbuild.github.io",
2041
- "nodejs.org",
2042
- "typescriptlang.org",
2043
- "hono.dev",
2044
- "sqlite.org"
2045
- ];
2046
- function normalizeFetchHostname(hostname2) {
2047
- const lower = hostname2.toLowerCase();
2048
- return lower.startsWith("www.") ? lower.slice(4) : lower;
2049
- }
2050
- function isPreapprovedFetchDomain(hostname2) {
2051
- const normalized = normalizeFetchHostname(hostname2);
2052
- return WEB_FETCH_PREAPPROVED_DOMAINS.some((domain) => normalizeFetchHostname(domain) === normalized);
2053
- }
2054
- function isSameFetchHost(a, b) {
2055
- return normalizeFetchHostname(a) === normalizeFetchHostname(b);
2056
- }
2057
-
2058
- // ../shared/dist/explorer-media.js
2059
- var EXPLORER_IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
2060
- "png",
2061
- "jpg",
2062
- "jpeg",
2063
- "gif",
2064
- "webp",
2065
- "svg",
2066
- "ico",
2067
- "bmp",
2068
- "tiff",
2069
- "tif"
2070
- ]);
2071
- var EXPLORER_VIDEO_EXTENSIONS = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi"]);
2072
- var EXPLORER_MEDIA_MIME_TYPES = {
2073
- png: "image/png",
2074
- jpg: "image/jpeg",
2075
- jpeg: "image/jpeg",
2076
- gif: "image/gif",
2077
- webp: "image/webp",
2078
- svg: "image/svg+xml",
2079
- ico: "image/x-icon",
2080
- bmp: "image/bmp",
2081
- tiff: "image/tiff",
2082
- tif: "image/tiff",
2083
- mp4: "video/mp4",
2084
- webm: "video/webm",
2085
- mov: "video/quicktime",
2086
- avi: "video/x-msvideo"
2087
- };
2088
- function getFileExtension(filename) {
2089
- const trimmed = filename.trim();
2090
- const basename5 = trimmed.split(/[/\\]/).pop() ?? trimmed;
2091
- const dotIndex = basename5.lastIndexOf(".");
2092
- if (dotIndex <= 0 || dotIndex === basename5.length - 1) {
2093
- return "";
2094
- }
2095
- return basename5.slice(dotIndex + 1).toLowerCase();
2096
- }
2097
- function getExplorerFileMediaType(path7, name) {
2098
- const ext = getFileExtension(path7) || (name ? getFileExtension(name) : "");
2099
- if (!ext) {
2100
- return null;
2101
- }
2102
- if (EXPLORER_IMAGE_EXTENSIONS.has(ext)) {
2103
- return "image";
2104
- }
2105
- if (EXPLORER_VIDEO_EXTENSIONS.has(ext)) {
2106
- return "video";
2107
- }
2108
- return null;
2109
- }
2110
-
2111
- // src/server.ts
2112
- import fs3 from "fs";
2113
- import { Hono as Hono26 } from "hono";
2114
- import { cors } from "hono/cors";
2115
- import open3 from "open";
2116
- import path5 from "path";
2117
- import { fileURLToPath as fileURLToPath2 } from "url";
2118
-
2119
- // src/agent/agent.executor.ts
2120
- import { Agent as Agent2 } from "@earendil-works/pi-agent-core";
2121
- import { streamSimple } from "@earendil-works/pi-ai";
2122
- import { resolve as resolve3, isAbsolute as isAbsolute3 } from "path";
2123
-
2124
- // src/features/mcp/mcp.status.ts
2125
- function formatMcpStatusForChat(line, options) {
2126
- const text = options?.includeLabel ? `[MCP] ${line}` : line;
2127
- return `${text}
2128
- `;
2129
- }
2130
- function createMcpThinkingEvent(content) {
2131
- return { type: "thinking", content };
2132
- }
2133
-
2134
- // src/tools/bash.ts
2135
- import { randomBytes as randomBytes2 } from "node:crypto";
2136
- import { createWriteStream, existsSync as existsSync3 } from "node:fs";
2137
- import { tmpdir } from "node:os";
2138
- import { join as join3 } from "node:path";
2139
-
2140
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
2141
- var value_exports = {};
2142
- __export(value_exports, {
2143
- HasPropertyKey: () => HasPropertyKey,
2144
- IsArray: () => IsArray,
2145
- IsAsyncIterator: () => IsAsyncIterator,
2146
- IsBigInt: () => IsBigInt,
2147
- IsBoolean: () => IsBoolean,
2148
- IsDate: () => IsDate,
2149
- IsFunction: () => IsFunction,
2150
- IsIterator: () => IsIterator,
2151
- IsNull: () => IsNull,
2152
- IsNumber: () => IsNumber,
2153
- IsObject: () => IsObject,
2154
- IsRegExp: () => IsRegExp,
2155
- IsString: () => IsString,
2156
- IsSymbol: () => IsSymbol,
2157
- IsUint8Array: () => IsUint8Array,
2158
- IsUndefined: () => IsUndefined
2159
- });
2160
- function HasPropertyKey(value, key) {
2161
- return key in value;
2162
- }
2163
- function IsAsyncIterator(value) {
2164
- return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
2165
- }
2166
- function IsArray(value) {
2167
- return Array.isArray(value);
2168
- }
2169
- function IsBigInt(value) {
2170
- return typeof value === "bigint";
2171
- }
2172
- function IsBoolean(value) {
2173
- return typeof value === "boolean";
2174
- }
2175
- function IsDate(value) {
2176
- return value instanceof globalThis.Date;
2177
- }
2178
- function IsFunction(value) {
2179
- return typeof value === "function";
2180
- }
2181
- function IsIterator(value) {
2182
- return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
2183
- }
2184
- function IsNull(value) {
2185
- return value === null;
2186
- }
2187
- function IsNumber(value) {
2188
- return typeof value === "number";
2189
- }
2190
- function IsObject(value) {
2191
- return typeof value === "object" && value !== null;
2192
- }
2193
- function IsRegExp(value) {
2194
- return value instanceof globalThis.RegExp;
2195
- }
2196
- function IsString(value) {
2197
- return typeof value === "string";
2198
- }
2199
- function IsSymbol(value) {
2200
- return typeof value === "symbol";
2201
- }
2202
- function IsUint8Array(value) {
2203
- return value instanceof globalThis.Uint8Array;
2204
- }
2205
- function IsUndefined(value) {
2206
- return value === void 0;
2207
- }
2208
-
2209
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
2210
- function ArrayType(value) {
2211
- return value.map((value2) => Visit(value2));
2212
- }
2213
- function DateType(value) {
2214
- return new Date(value.getTime());
2215
- }
2216
- function Uint8ArrayType(value) {
2217
- return new Uint8Array(value);
2218
- }
2219
- function RegExpType(value) {
2220
- return new RegExp(value.source, value.flags);
2221
- }
2222
- function ObjectType(value) {
2223
- const result = {};
2224
- for (const key of Object.getOwnPropertyNames(value)) {
2225
- result[key] = Visit(value[key]);
2226
- }
2227
- for (const key of Object.getOwnPropertySymbols(value)) {
2228
- result[key] = Visit(value[key]);
2229
- }
2230
- return result;
2231
- }
2232
- function Visit(value) {
2233
- return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
2234
- }
2235
- function Clone(value) {
2236
- return Visit(value);
2237
- }
2238
-
2239
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
2240
- function CloneType(schema, options) {
2241
- return options === void 0 ? Clone(schema) : Clone({ ...options, ...schema });
2242
- }
2243
-
2244
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
2245
- function IsObject2(value) {
2246
- return value !== null && typeof value === "object";
2247
- }
2248
- function IsArray2(value) {
2249
- return globalThis.Array.isArray(value) && !globalThis.ArrayBuffer.isView(value);
2250
- }
2251
- function IsUndefined2(value) {
2252
- return value === void 0;
2253
- }
2254
- function IsNumber2(value) {
2255
- return typeof value === "number";
2256
- }
2257
-
2258
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/system/policy.mjs
2259
- var TypeSystemPolicy;
2260
- (function(TypeSystemPolicy2) {
2261
- TypeSystemPolicy2.InstanceMode = "default";
2262
- TypeSystemPolicy2.ExactOptionalPropertyTypes = false;
2263
- TypeSystemPolicy2.AllowArrayObject = false;
2264
- TypeSystemPolicy2.AllowNaN = false;
2265
- TypeSystemPolicy2.AllowNullVoid = false;
2266
- function IsExactOptionalProperty(value, key) {
2267
- return TypeSystemPolicy2.ExactOptionalPropertyTypes ? key in value : value[key] !== void 0;
2268
- }
2269
- TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
2270
- function IsObjectLike(value) {
2271
- const isObject = IsObject2(value);
2272
- return TypeSystemPolicy2.AllowArrayObject ? isObject : isObject && !IsArray2(value);
2273
- }
2274
- TypeSystemPolicy2.IsObjectLike = IsObjectLike;
2275
- function IsRecordLike(value) {
2276
- return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
2277
- }
2278
- TypeSystemPolicy2.IsRecordLike = IsRecordLike;
2279
- function IsNumberLike(value) {
2280
- return TypeSystemPolicy2.AllowNaN ? IsNumber2(value) : Number.isFinite(value);
2281
- }
2282
- TypeSystemPolicy2.IsNumberLike = IsNumberLike;
2283
- function IsVoidLike(value) {
2284
- const isUndefined = IsUndefined2(value);
2285
- return TypeSystemPolicy2.AllowNullVoid ? isUndefined || value === null : isUndefined;
2286
- }
2287
- TypeSystemPolicy2.IsVoidLike = IsVoidLike;
2288
- })(TypeSystemPolicy || (TypeSystemPolicy = {}));
2289
-
2290
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs
2291
- function ImmutableArray(value) {
2292
- return globalThis.Object.freeze(value).map((value2) => Immutable(value2));
2293
- }
2294
- function ImmutableDate(value) {
2295
- return value;
2296
- }
2297
- function ImmutableUint8Array(value) {
2298
- return value;
2299
- }
2300
- function ImmutableRegExp(value) {
2301
- return value;
2302
- }
2303
- function ImmutableObject(value) {
2304
- const result = {};
2305
- for (const key of Object.getOwnPropertyNames(value)) {
2306
- result[key] = Immutable(value[key]);
2307
- }
2308
- for (const key of Object.getOwnPropertySymbols(value)) {
2309
- result[key] = Immutable(value[key]);
2310
- }
2311
- return globalThis.Object.freeze(result);
2312
- }
2313
- function Immutable(value) {
2314
- return IsArray(value) ? ImmutableArray(value) : IsDate(value) ? ImmutableDate(value) : IsUint8Array(value) ? ImmutableUint8Array(value) : IsRegExp(value) ? ImmutableRegExp(value) : IsObject(value) ? ImmutableObject(value) : value;
2315
- }
2316
-
2317
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs
2318
- function CreateType(schema, options) {
2319
- const result = options !== void 0 ? { ...options, ...schema } : schema;
2320
- switch (TypeSystemPolicy.InstanceMode) {
2321
- case "freeze":
2322
- return Immutable(result);
2323
- case "clone":
2324
- return Clone(result);
2325
- default:
2326
- return result;
2327
- }
2328
- }
2329
-
2330
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
2331
- var TypeBoxError = class extends Error {
2332
- constructor(message) {
2333
- super(message);
2334
- }
2335
- };
2336
-
2337
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
2338
- var TransformKind = /* @__PURE__ */ Symbol.for("TypeBox.Transform");
2339
- var ReadonlyKind = /* @__PURE__ */ Symbol.for("TypeBox.Readonly");
2340
- var OptionalKind = /* @__PURE__ */ Symbol.for("TypeBox.Optional");
2341
- var Hint = /* @__PURE__ */ Symbol.for("TypeBox.Hint");
2342
- var Kind = /* @__PURE__ */ Symbol.for("TypeBox.Kind");
2343
-
2344
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
2345
- function IsReadonly(value) {
2346
- return IsObject(value) && value[ReadonlyKind] === "Readonly";
2347
- }
2348
- function IsOptional(value) {
2349
- return IsObject(value) && value[OptionalKind] === "Optional";
2350
- }
2351
- function IsAny(value) {
2352
- return IsKindOf(value, "Any");
2353
- }
2354
- function IsArgument(value) {
2355
- return IsKindOf(value, "Argument");
2356
- }
2357
- function IsArray3(value) {
2358
- return IsKindOf(value, "Array");
2359
- }
2360
- function IsAsyncIterator2(value) {
2361
- return IsKindOf(value, "AsyncIterator");
2362
- }
2363
- function IsBigInt2(value) {
2364
- return IsKindOf(value, "BigInt");
2365
- }
2366
- function IsBoolean2(value) {
2367
- return IsKindOf(value, "Boolean");
2368
- }
2369
- function IsComputed(value) {
2370
- return IsKindOf(value, "Computed");
2371
- }
2372
- function IsConstructor(value) {
2373
- return IsKindOf(value, "Constructor");
2374
- }
2375
- function IsDate2(value) {
2376
- return IsKindOf(value, "Date");
2377
- }
2378
- function IsFunction2(value) {
2379
- return IsKindOf(value, "Function");
2380
- }
2381
- function IsInteger(value) {
2382
- return IsKindOf(value, "Integer");
2383
- }
2384
- function IsIntersect(value) {
2385
- return IsKindOf(value, "Intersect");
2386
- }
2387
- function IsIterator2(value) {
2388
- return IsKindOf(value, "Iterator");
2389
- }
2390
- function IsKindOf(value, kind) {
2391
- return IsObject(value) && Kind in value && value[Kind] === kind;
2392
- }
2393
- function IsLiteralValue(value) {
2394
- return IsBoolean(value) || IsNumber(value) || IsString(value);
2395
- }
2396
- function IsLiteral(value) {
2397
- return IsKindOf(value, "Literal");
2398
- }
2399
- function IsMappedKey(value) {
2400
- return IsKindOf(value, "MappedKey");
2401
- }
2402
- function IsMappedResult(value) {
2403
- return IsKindOf(value, "MappedResult");
2404
- }
2405
- function IsNever(value) {
2406
- return IsKindOf(value, "Never");
2407
- }
2408
- function IsNot(value) {
2409
- return IsKindOf(value, "Not");
2410
- }
2411
- function IsNull2(value) {
2412
- return IsKindOf(value, "Null");
2413
- }
2414
- function IsNumber3(value) {
2415
- return IsKindOf(value, "Number");
2416
- }
2417
- function IsObject3(value) {
2418
- return IsKindOf(value, "Object");
2419
- }
2420
- function IsPromise(value) {
2421
- return IsKindOf(value, "Promise");
2422
- }
2423
- function IsRecord(value) {
2424
- return IsKindOf(value, "Record");
2425
- }
2426
- function IsRef(value) {
2427
- return IsKindOf(value, "Ref");
2428
- }
2429
- function IsRegExp2(value) {
2430
- return IsKindOf(value, "RegExp");
2431
- }
2432
- function IsString2(value) {
2433
- return IsKindOf(value, "String");
2434
- }
2435
- function IsSymbol2(value) {
2436
- return IsKindOf(value, "Symbol");
2437
- }
2438
- function IsTemplateLiteral(value) {
2439
- return IsKindOf(value, "TemplateLiteral");
2440
- }
2441
- function IsThis(value) {
2442
- return IsKindOf(value, "This");
2443
- }
2444
- function IsTransform(value) {
2445
- return IsObject(value) && TransformKind in value;
2446
- }
2447
- function IsTuple(value) {
2448
- return IsKindOf(value, "Tuple");
2449
- }
2450
- function IsUndefined3(value) {
2451
- return IsKindOf(value, "Undefined");
2452
- }
2453
- function IsUnion(value) {
2454
- return IsKindOf(value, "Union");
2455
- }
2456
- function IsUint8Array2(value) {
2457
- return IsKindOf(value, "Uint8Array");
2458
- }
2459
- function IsUnknown(value) {
2460
- return IsKindOf(value, "Unknown");
2461
- }
2462
- function IsUnsafe(value) {
2463
- return IsKindOf(value, "Unsafe");
2464
- }
2465
- function IsVoid(value) {
2466
- return IsKindOf(value, "Void");
2467
- }
2468
- function IsKind(value) {
2469
- return IsObject(value) && Kind in value && IsString(value[Kind]);
2470
- }
2471
- function IsSchema(value) {
2472
- return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsComputed(value) || IsConstructor(value) || IsDate2(value) || IsFunction2(value) || IsInteger(value) || IsIntersect(value) || IsIterator2(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull2(value) || IsNumber3(value) || IsObject3(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
2473
- }
2474
-
2475
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
2476
- var type_exports = {};
2477
- __export(type_exports, {
2478
- IsAny: () => IsAny2,
2479
- IsArgument: () => IsArgument2,
2480
- IsArray: () => IsArray4,
2481
- IsAsyncIterator: () => IsAsyncIterator3,
2482
- IsBigInt: () => IsBigInt3,
2483
- IsBoolean: () => IsBoolean3,
2484
- IsComputed: () => IsComputed2,
2485
- IsConstructor: () => IsConstructor2,
2486
- IsDate: () => IsDate3,
2487
- IsFunction: () => IsFunction3,
2488
- IsImport: () => IsImport,
2489
- IsInteger: () => IsInteger2,
2490
- IsIntersect: () => IsIntersect2,
2491
- IsIterator: () => IsIterator3,
2492
- IsKind: () => IsKind2,
2493
- IsKindOf: () => IsKindOf2,
2494
- IsLiteral: () => IsLiteral2,
2495
- IsLiteralBoolean: () => IsLiteralBoolean,
2496
- IsLiteralNumber: () => IsLiteralNumber,
2497
- IsLiteralString: () => IsLiteralString,
2498
- IsLiteralValue: () => IsLiteralValue2,
2499
- IsMappedKey: () => IsMappedKey2,
2500
- IsMappedResult: () => IsMappedResult2,
2501
- IsNever: () => IsNever2,
2502
- IsNot: () => IsNot2,
2503
- IsNull: () => IsNull3,
2504
- IsNumber: () => IsNumber4,
2505
- IsObject: () => IsObject4,
2506
- IsOptional: () => IsOptional2,
2507
- IsPromise: () => IsPromise2,
2508
- IsProperties: () => IsProperties,
2509
- IsReadonly: () => IsReadonly2,
2510
- IsRecord: () => IsRecord2,
2511
- IsRecursive: () => IsRecursive,
2512
- IsRef: () => IsRef2,
2513
- IsRegExp: () => IsRegExp3,
2514
- IsSchema: () => IsSchema2,
2515
- IsString: () => IsString3,
2516
- IsSymbol: () => IsSymbol3,
2517
- IsTemplateLiteral: () => IsTemplateLiteral2,
2518
- IsThis: () => IsThis2,
2519
- IsTransform: () => IsTransform2,
2520
- IsTuple: () => IsTuple2,
2521
- IsUint8Array: () => IsUint8Array3,
2522
- IsUndefined: () => IsUndefined4,
2523
- IsUnion: () => IsUnion2,
2524
- IsUnionLiteral: () => IsUnionLiteral,
2525
- IsUnknown: () => IsUnknown2,
2526
- IsUnsafe: () => IsUnsafe2,
2527
- IsVoid: () => IsVoid2,
2528
- TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
2529
- });
2530
- var TypeGuardUnknownTypeError = class extends TypeBoxError {
2531
- };
2532
- var KnownTypes = [
2533
- "Argument",
2534
- "Any",
2535
- "Array",
2536
- "AsyncIterator",
2537
- "BigInt",
2538
- "Boolean",
2539
- "Computed",
2540
- "Constructor",
2541
- "Date",
2542
- "Enum",
2543
- "Function",
2544
- "Integer",
2545
- "Intersect",
2546
- "Iterator",
2547
- "Literal",
2548
- "MappedKey",
2549
- "MappedResult",
2550
- "Not",
2551
- "Null",
2552
- "Number",
2553
- "Object",
2554
- "Promise",
2555
- "Record",
2556
- "Ref",
2557
- "RegExp",
2558
- "String",
2559
- "Symbol",
2560
- "TemplateLiteral",
2561
- "This",
2562
- "Tuple",
2563
- "Undefined",
2564
- "Union",
2565
- "Uint8Array",
2566
- "Unknown",
2567
- "Void"
2568
- ];
2569
- function IsPattern(value) {
2570
- try {
2571
- new RegExp(value);
2572
- return true;
2573
- } catch {
2574
- return false;
2575
- }
2576
- }
2577
- function IsControlCharacterFree(value) {
2578
- if (!IsString(value))
2579
- return false;
2580
- for (let i = 0; i < value.length; i++) {
2581
- const code = value.charCodeAt(i);
2582
- if (code >= 7 && code <= 13 || code === 27 || code === 127) {
2583
- return false;
2584
- }
2585
- }
2586
- return true;
2587
- }
2588
- function IsAdditionalProperties(value) {
2589
- return IsOptionalBoolean(value) || IsSchema2(value);
2590
- }
2591
- function IsOptionalBigInt(value) {
2592
- return IsUndefined(value) || IsBigInt(value);
2593
- }
2594
- function IsOptionalNumber(value) {
2595
- return IsUndefined(value) || IsNumber(value);
2596
- }
2597
- function IsOptionalBoolean(value) {
2598
- return IsUndefined(value) || IsBoolean(value);
2599
- }
2600
- function IsOptionalString(value) {
2601
- return IsUndefined(value) || IsString(value);
2602
- }
2603
- function IsOptionalPattern(value) {
2604
- return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
2605
- }
2606
- function IsOptionalFormat(value) {
2607
- return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
2608
- }
2609
- function IsOptionalSchema(value) {
2610
- return IsUndefined(value) || IsSchema2(value);
2611
- }
2612
- function IsReadonly2(value) {
2613
- return IsObject(value) && value[ReadonlyKind] === "Readonly";
2614
- }
2615
- function IsOptional2(value) {
2616
- return IsObject(value) && value[OptionalKind] === "Optional";
2617
- }
2618
- function IsAny2(value) {
2619
- return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
2620
- }
2621
- function IsArgument2(value) {
2622
- return IsKindOf2(value, "Argument") && IsNumber(value.index);
2623
- }
2624
- function IsArray4(value) {
2625
- return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
2626
- }
2627
- function IsAsyncIterator3(value) {
2628
- return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
2629
- }
2630
- function IsBigInt3(value) {
2631
- return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
2632
- }
2633
- function IsBoolean3(value) {
2634
- return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
2635
- }
2636
- function IsComputed2(value) {
2637
- return IsKindOf2(value, "Computed") && IsString(value.target) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema));
2638
- }
2639
- function IsConstructor2(value) {
2640
- return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
2641
- }
2642
- function IsDate3(value) {
2643
- return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
2644
- }
2645
- function IsFunction3(value) {
2646
- return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
2647
- }
2648
- function IsImport(value) {
2649
- return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
2650
- }
2651
- function IsInteger2(value) {
2652
- return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
2653
- }
2654
- function IsProperties(value) {
2655
- return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
2656
- }
2657
- function IsIntersect2(value) {
2658
- return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
2659
- }
2660
- function IsIterator3(value) {
2661
- return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
2662
- }
2663
- function IsKindOf2(value, kind) {
2664
- return IsObject(value) && Kind in value && value[Kind] === kind;
2665
- }
2666
- function IsLiteralString(value) {
2667
- return IsLiteral2(value) && IsString(value.const);
2668
- }
2669
- function IsLiteralNumber(value) {
2670
- return IsLiteral2(value) && IsNumber(value.const);
2671
- }
2672
- function IsLiteralBoolean(value) {
2673
- return IsLiteral2(value) && IsBoolean(value.const);
2674
- }
2675
- function IsLiteral2(value) {
2676
- return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue2(value.const);
2677
- }
2678
- function IsLiteralValue2(value) {
2679
- return IsBoolean(value) || IsNumber(value) || IsString(value);
2680
- }
2681
- function IsMappedKey2(value) {
2682
- return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
2683
- }
2684
- function IsMappedResult2(value) {
2685
- return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
2686
- }
2687
- function IsNever2(value) {
2688
- return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
2689
- }
2690
- function IsNot2(value) {
2691
- return IsKindOf2(value, "Not") && IsSchema2(value.not);
2692
- }
2693
- function IsNull3(value) {
2694
- return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
2695
- }
2696
- function IsNumber4(value) {
2697
- return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
2698
- }
2699
- function IsObject4(value) {
2700
- return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
2701
- }
2702
- function IsPromise2(value) {
2703
- return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
2704
- }
2705
- function IsRecord2(value) {
2706
- return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
2707
- const keys = Object.getOwnPropertyNames(schema.patternProperties);
2708
- return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
2709
- })(value);
2710
- }
2711
- function IsRecursive(value) {
2712
- return IsObject(value) && Hint in value && value[Hint] === "Recursive";
2713
- }
2714
- function IsRef2(value) {
2715
- return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
2716
- }
2717
- function IsRegExp3(value) {
2718
- return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
2719
- }
2720
- function IsString3(value) {
2721
- return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
2722
- }
2723
- function IsSymbol3(value) {
2724
- return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
2725
- }
2726
- function IsTemplateLiteral2(value) {
2727
- return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
2728
- }
2729
- function IsThis2(value) {
2730
- return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
2731
- }
2732
- function IsTransform2(value) {
2733
- return IsObject(value) && TransformKind in value;
2734
- }
2735
- function IsTuple2(value) {
2736
- return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
2737
- (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
2738
- }
2739
- function IsUndefined4(value) {
2740
- return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
2741
- }
2742
- function IsUnionLiteral(value) {
2743
- return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
2744
- }
2745
- function IsUnion2(value) {
2746
- return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
2747
- }
2748
- function IsUint8Array3(value) {
2749
- return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
2750
- }
2751
- function IsUnknown2(value) {
2752
- return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
2753
- }
2754
- function IsUnsafe2(value) {
2755
- return IsKindOf2(value, "Unsafe");
2756
- }
2757
- function IsVoid2(value) {
2758
- return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
2759
- }
2760
- function IsKind2(value) {
2761
- return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
2762
- }
2763
- function IsSchema2(value) {
2764
- return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed2(value) || IsConstructor2(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect2(value) || IsIterator3(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull3(value) || IsNumber4(value) || IsObject4(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
2765
- }
2766
-
2767
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
2768
- var PatternBoolean = "(true|false)";
2769
- var PatternNumber = "(0|[1-9][0-9]*)";
2770
- var PatternString = "(.*)";
2771
- var PatternNever = "(?!.*)";
2772
- var PatternBooleanExact = `^${PatternBoolean}$`;
2773
- var PatternNumberExact = `^${PatternNumber}$`;
2774
- var PatternStringExact = `^${PatternString}$`;
2775
- var PatternNeverExact = `^${PatternNever}$`;
2776
-
2777
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
2778
- function SetIncludes(T, S) {
2779
- return T.includes(S);
2780
- }
2781
- function SetDistinct(T) {
2782
- return [...new Set(T)];
2783
- }
2784
- function SetIntersect(T, S) {
2785
- return T.filter((L) => S.includes(L));
2786
- }
2787
- function SetIntersectManyResolve(T, Init) {
2788
- return T.reduce((Acc, L) => {
2789
- return SetIntersect(Acc, L);
2790
- }, Init);
2791
- }
2792
- function SetIntersectMany(T) {
2793
- return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
2794
- }
2795
- function SetUnionMany(T) {
2796
- const Acc = [];
2797
- for (const L of T)
2798
- Acc.push(...L);
2799
- return Acc;
2800
- }
2801
-
2802
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
2803
- function Any(options) {
2804
- return CreateType({ [Kind]: "Any" }, options);
2805
- }
2806
-
2807
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
2808
- function Array2(items, options) {
2809
- return CreateType({ [Kind]: "Array", type: "array", items }, options);
2810
- }
2811
-
2812
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs
2813
- function Argument(index) {
2814
- return CreateType({ [Kind]: "Argument", index });
2815
- }
2816
-
2817
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
2818
- function AsyncIterator(items, options) {
2819
- return CreateType({ [Kind]: "AsyncIterator", type: "AsyncIterator", items }, options);
2820
- }
2821
-
2822
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs
2823
- function Computed(target, parameters, options) {
2824
- return CreateType({ [Kind]: "Computed", target, parameters }, options);
2825
- }
2826
-
2827
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
2828
- function DiscardKey(value, key) {
2829
- const { [key]: _, ...rest } = value;
2830
- return rest;
2831
- }
2832
- function Discard(value, keys) {
2833
- return keys.reduce((acc, key) => DiscardKey(acc, key), value);
2834
- }
2835
-
2836
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
2837
- function Never(options) {
2838
- return CreateType({ [Kind]: "Never", not: {} }, options);
2839
- }
2840
-
2841
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
2842
- function MappedResult(properties) {
2843
- return CreateType({
2844
- [Kind]: "MappedResult",
2845
- properties
2846
- });
2847
- }
2848
-
2849
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
2850
- function Constructor(parameters, returns, options) {
2851
- return CreateType({ [Kind]: "Constructor", type: "Constructor", parameters, returns }, options);
2852
- }
2853
-
2854
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
2855
- function Function(parameters, returns, options) {
2856
- return CreateType({ [Kind]: "Function", type: "Function", parameters, returns }, options);
2857
- }
2858
-
2859
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
2860
- function UnionCreate(T, options) {
2861
- return CreateType({ [Kind]: "Union", anyOf: T }, options);
2862
- }
2863
-
2864
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
2865
- function IsUnionOptional(types) {
2866
- return types.some((type) => IsOptional(type));
2867
- }
2868
- function RemoveOptionalFromRest(types) {
2869
- return types.map((left) => IsOptional(left) ? RemoveOptionalFromType(left) : left);
2870
- }
2871
- function RemoveOptionalFromType(T) {
2872
- return Discard(T, [OptionalKind]);
2873
- }
2874
- function ResolveUnion(types, options) {
2875
- const isOptional = IsUnionOptional(types);
2876
- return isOptional ? Optional(UnionCreate(RemoveOptionalFromRest(types), options)) : UnionCreate(RemoveOptionalFromRest(types), options);
2877
- }
2878
- function UnionEvaluated(T, options) {
2879
- return T.length === 1 ? CreateType(T[0], options) : T.length === 0 ? Never(options) : ResolveUnion(T, options);
2880
- }
2881
-
2882
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
2883
- function Union(types, options) {
2884
- return types.length === 0 ? Never(options) : types.length === 1 ? CreateType(types[0], options) : UnionCreate(types, options);
2885
- }
2886
-
2887
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
2888
- var TemplateLiteralParserError = class extends TypeBoxError {
2889
- };
2890
- function Unescape(pattern) {
2891
- return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
2892
- }
2893
- function IsNonEscaped(pattern, index, char) {
2894
- return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
2895
- }
2896
- function IsOpenParen(pattern, index) {
2897
- return IsNonEscaped(pattern, index, "(");
2898
- }
2899
- function IsCloseParen(pattern, index) {
2900
- return IsNonEscaped(pattern, index, ")");
2901
- }
2902
- function IsSeparator(pattern, index) {
2903
- return IsNonEscaped(pattern, index, "|");
2904
- }
2905
- function IsGroup(pattern) {
2906
- if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
2907
- return false;
2908
- let count = 0;
2909
- for (let index = 0; index < pattern.length; index++) {
2910
- if (IsOpenParen(pattern, index))
2911
- count += 1;
2912
- if (IsCloseParen(pattern, index))
2913
- count -= 1;
2914
- if (count === 0 && index !== pattern.length - 1)
2915
- return false;
2916
- }
2917
- return true;
2918
- }
2919
- function InGroup(pattern) {
2920
- return pattern.slice(1, pattern.length - 1);
2921
- }
2922
- function IsPrecedenceOr(pattern) {
2923
- let count = 0;
2924
- for (let index = 0; index < pattern.length; index++) {
2925
- if (IsOpenParen(pattern, index))
2926
- count += 1;
2927
- if (IsCloseParen(pattern, index))
2928
- count -= 1;
2929
- if (IsSeparator(pattern, index) && count === 0)
2930
- return true;
2931
- }
2932
- return false;
2933
- }
2934
- function IsPrecedenceAnd(pattern) {
2935
- for (let index = 0; index < pattern.length; index++) {
2936
- if (IsOpenParen(pattern, index))
2937
- return true;
2938
- }
2939
- return false;
2940
- }
2941
- function Or(pattern) {
2942
- let [count, start] = [0, 0];
2943
- const expressions = [];
2944
- for (let index = 0; index < pattern.length; index++) {
2945
- if (IsOpenParen(pattern, index))
2946
- count += 1;
2947
- if (IsCloseParen(pattern, index))
2948
- count -= 1;
2949
- if (IsSeparator(pattern, index) && count === 0) {
2950
- const range2 = pattern.slice(start, index);
2951
- if (range2.length > 0)
2952
- expressions.push(TemplateLiteralParse(range2));
2953
- start = index + 1;
2954
- }
2955
- }
2956
- const range = pattern.slice(start);
2957
- if (range.length > 0)
2958
- expressions.push(TemplateLiteralParse(range));
2959
- if (expressions.length === 0)
2960
- return { type: "const", const: "" };
2961
- if (expressions.length === 1)
2962
- return expressions[0];
2963
- return { type: "or", expr: expressions };
2964
- }
2965
- function And(pattern) {
2966
- function Group(value, index) {
2967
- if (!IsOpenParen(value, index))
2968
- throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
2969
- let count = 0;
2970
- for (let scan = index; scan < value.length; scan++) {
2971
- if (IsOpenParen(value, scan))
2972
- count += 1;
2973
- if (IsCloseParen(value, scan))
2974
- count -= 1;
2975
- if (count === 0)
2976
- return [index, scan];
2977
- }
2978
- throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
2979
- }
2980
- function Range(pattern2, index) {
2981
- for (let scan = index; scan < pattern2.length; scan++) {
2982
- if (IsOpenParen(pattern2, scan))
2983
- return [index, scan];
2984
- }
2985
- return [index, pattern2.length];
2986
- }
2987
- const expressions = [];
2988
- for (let index = 0; index < pattern.length; index++) {
2989
- if (IsOpenParen(pattern, index)) {
2990
- const [start, end] = Group(pattern, index);
2991
- const range = pattern.slice(start, end + 1);
2992
- expressions.push(TemplateLiteralParse(range));
2993
- index = end;
2994
- } else {
2995
- const [start, end] = Range(pattern, index);
2996
- const range = pattern.slice(start, end);
2997
- if (range.length > 0)
2998
- expressions.push(TemplateLiteralParse(range));
2999
- index = end - 1;
3000
- }
3001
- }
3002
- return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
3003
- }
3004
- function TemplateLiteralParse(pattern) {
3005
- return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
3006
- }
3007
- function TemplateLiteralParseExact(pattern) {
3008
- return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
3009
- }
3010
-
3011
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
3012
- var TemplateLiteralFiniteError = class extends TypeBoxError {
3013
- };
3014
- function IsNumberExpression(expression) {
3015
- return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";
3016
- }
3017
- function IsBooleanExpression(expression) {
3018
- return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";
3019
- }
3020
- function IsStringExpression(expression) {
3021
- return expression.type === "const" && expression.const === ".*";
3022
- }
3023
- function IsTemplateLiteralExpressionFinite(expression) {
3024
- return IsNumberExpression(expression) || IsStringExpression(expression) ? false : IsBooleanExpression(expression) ? true : expression.type === "and" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "or" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "const" ? true : (() => {
3025
- throw new TemplateLiteralFiniteError(`Unknown expression type`);
3026
- })();
3027
- }
3028
- function IsTemplateLiteralFinite(schema) {
3029
- const expression = TemplateLiteralParseExact(schema.pattern);
3030
- return IsTemplateLiteralExpressionFinite(expression);
3031
- }
3032
-
3033
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
3034
- var TemplateLiteralGenerateError = class extends TypeBoxError {
3035
- };
3036
- function* GenerateReduce(buffer) {
3037
- if (buffer.length === 1)
3038
- return yield* buffer[0];
3039
- for (const left of buffer[0]) {
3040
- for (const right of GenerateReduce(buffer.slice(1))) {
3041
- yield `${left}${right}`;
3042
- }
3043
- }
3044
- }
3045
- function* GenerateAnd(expression) {
3046
- return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
3047
- }
3048
- function* GenerateOr(expression) {
3049
- for (const expr of expression.expr)
3050
- yield* TemplateLiteralExpressionGenerate(expr);
3051
- }
3052
- function* GenerateConst(expression) {
3053
- return yield expression.const;
3054
- }
3055
- function* TemplateLiteralExpressionGenerate(expression) {
3056
- return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
3057
- throw new TemplateLiteralGenerateError("Unknown expression");
3058
- })();
3059
- }
3060
- function TemplateLiteralGenerate(schema) {
3061
- const expression = TemplateLiteralParseExact(schema.pattern);
3062
- return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
3063
- }
3064
-
3065
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
3066
- function Literal(value, options) {
3067
- return CreateType({
3068
- [Kind]: "Literal",
3069
- const: value,
3070
- type: typeof value
3071
- }, options);
3072
- }
3073
-
3074
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
3075
- function Boolean2(options) {
3076
- return CreateType({ [Kind]: "Boolean", type: "boolean" }, options);
3077
- }
3078
-
3079
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
3080
- function BigInt(options) {
3081
- return CreateType({ [Kind]: "BigInt", type: "bigint" }, options);
3082
- }
3083
-
3084
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
3085
- function Number2(options) {
3086
- return CreateType({ [Kind]: "Number", type: "number" }, options);
3087
- }
3088
-
3089
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
3090
- function String2(options) {
3091
- return CreateType({ [Kind]: "String", type: "string" }, options);
3092
- }
3093
-
3094
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
3095
- function* FromUnion(syntax) {
3096
- const trim = syntax.trim().replace(/"|'/g, "");
3097
- return trim === "boolean" ? yield Boolean2() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt() : trim === "string" ? yield String2() : yield (() => {
3098
- const literals = trim.split("|").map((literal) => Literal(literal.trim()));
3099
- return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
3100
- })();
3101
- }
3102
- function* FromTerminal(syntax) {
3103
- if (syntax[1] !== "{") {
3104
- const L = Literal("$");
3105
- const R = FromSyntax(syntax.slice(1));
3106
- return yield* [L, ...R];
3107
- }
3108
- for (let i = 2; i < syntax.length; i++) {
3109
- if (syntax[i] === "}") {
3110
- const L = FromUnion(syntax.slice(2, i));
3111
- const R = FromSyntax(syntax.slice(i + 1));
3112
- return yield* [...L, ...R];
3113
- }
3114
- }
3115
- yield Literal(syntax);
3116
- }
3117
- function* FromSyntax(syntax) {
3118
- for (let i = 0; i < syntax.length; i++) {
3119
- if (syntax[i] === "$") {
3120
- const L = Literal(syntax.slice(0, i));
3121
- const R = FromTerminal(syntax.slice(i));
3122
- return yield* [L, ...R];
3123
- }
3124
- }
3125
- yield Literal(syntax);
3126
- }
3127
- function TemplateLiteralSyntax(syntax) {
3128
- return [...FromSyntax(syntax)];
3129
- }
3130
-
3131
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
3132
- var TemplateLiteralPatternError = class extends TypeBoxError {
3133
- };
3134
- function Escape(value) {
3135
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3136
- }
3137
- function Visit2(schema, acc) {
3138
- return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` : IsInteger(schema) ? `${acc}${PatternNumber}` : IsBigInt2(schema) ? `${acc}${PatternNumber}` : IsString2(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean2(schema) ? `${acc}${PatternBoolean}` : (() => {
3139
- throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
3140
- })();
3141
- }
3142
- function TemplateLiteralPattern(kinds) {
3143
- return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
3144
- }
3145
-
3146
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
3147
- function TemplateLiteralToUnion(schema) {
3148
- const R = TemplateLiteralGenerate(schema);
3149
- const L = R.map((S) => Literal(S));
3150
- return UnionEvaluated(L);
3151
- }
3152
-
3153
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
3154
- function TemplateLiteral(unresolved, options) {
3155
- const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
3156
- return CreateType({ [Kind]: "TemplateLiteral", type: "string", pattern }, options);
3157
- }
3158
-
3159
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
3160
- function FromTemplateLiteral(templateLiteral) {
3161
- const keys = TemplateLiteralGenerate(templateLiteral);
3162
- return keys.map((key) => key.toString());
3163
- }
3164
- function FromUnion2(types) {
3165
- const result = [];
3166
- for (const type of types)
3167
- result.push(...IndexPropertyKeys(type));
3168
- return result;
3169
- }
3170
- function FromLiteral(literalValue) {
3171
- return [literalValue.toString()];
3172
- }
3173
- function IndexPropertyKeys(type) {
3174
- return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] : IsInteger(type) ? ["[number]"] : [])];
3175
- }
3176
-
3177
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
3178
- function FromProperties(type, properties, options) {
3179
- const result = {};
3180
- for (const K2 of Object.getOwnPropertyNames(properties)) {
3181
- result[K2] = Index(type, IndexPropertyKeys(properties[K2]), options);
3182
- }
3183
- return result;
3184
- }
3185
- function FromMappedResult(type, mappedResult, options) {
3186
- return FromProperties(type, mappedResult.properties, options);
3187
- }
3188
- function IndexFromMappedResult(type, mappedResult, options) {
3189
- const properties = FromMappedResult(type, mappedResult, options);
3190
- return MappedResult(properties);
3191
- }
3192
-
3193
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
3194
- function FromRest(types, key) {
3195
- return types.map((type) => IndexFromPropertyKey(type, key));
3196
- }
3197
- function FromIntersectRest(types) {
3198
- return types.filter((type) => !IsNever(type));
3199
- }
3200
- function FromIntersect(types, key) {
3201
- return IntersectEvaluated(FromIntersectRest(FromRest(types, key)));
3202
- }
3203
- function FromUnionRest(types) {
3204
- return types.some((L) => IsNever(L)) ? [] : types;
3205
- }
3206
- function FromUnion3(types, key) {
3207
- return UnionEvaluated(FromUnionRest(FromRest(types, key)));
3208
- }
3209
- function FromTuple(types, key) {
3210
- return key in types ? types[key] : key === "[number]" ? UnionEvaluated(types) : Never();
3211
- }
3212
- function FromArray(type, key) {
3213
- return key === "[number]" ? type : Never();
3214
- }
3215
- function FromProperty(properties, propertyKey) {
3216
- return propertyKey in properties ? properties[propertyKey] : Never();
3217
- }
3218
- function IndexFromPropertyKey(type, propertyKey) {
3219
- return IsIntersect(type) ? FromIntersect(type.allOf, propertyKey) : IsUnion(type) ? FromUnion3(type.anyOf, propertyKey) : IsTuple(type) ? FromTuple(type.items ?? [], propertyKey) : IsArray3(type) ? FromArray(type.items, propertyKey) : IsObject3(type) ? FromProperty(type.properties, propertyKey) : Never();
3220
- }
3221
- function IndexFromPropertyKeys(type, propertyKeys) {
3222
- return propertyKeys.map((propertyKey) => IndexFromPropertyKey(type, propertyKey));
3223
- }
3224
- function FromSchema(type, propertyKeys) {
3225
- return UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys));
3226
- }
3227
- function Index(type, key, options) {
3228
- if (IsRef(type) || IsRef(key)) {
3229
- const error = `Index types using Ref parameters require both Type and Key to be of TSchema`;
3230
- if (!IsSchema(type) || !IsSchema(key))
3231
- throw new TypeBoxError(error);
3232
- return Computed("Index", [type, key]);
3233
- }
3234
- if (IsMappedResult(key))
3235
- return IndexFromMappedResult(type, key, options);
3236
- if (IsMappedKey(key))
3237
- return IndexFromMappedKey(type, key, options);
3238
- return CreateType(IsSchema(key) ? FromSchema(type, IndexPropertyKeys(key)) : FromSchema(type, key), options);
3239
- }
3240
-
3241
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
3242
- function MappedIndexPropertyKey(type, key, options) {
3243
- return { [key]: Index(type, [key], Clone(options)) };
3244
- }
3245
- function MappedIndexPropertyKeys(type, propertyKeys, options) {
3246
- return propertyKeys.reduce((result, left) => {
3247
- return { ...result, ...MappedIndexPropertyKey(type, left, options) };
3248
- }, {});
3249
- }
3250
- function MappedIndexProperties(type, mappedKey, options) {
3251
- return MappedIndexPropertyKeys(type, mappedKey.keys, options);
3252
- }
3253
- function IndexFromMappedKey(type, mappedKey, options) {
3254
- const properties = MappedIndexProperties(type, mappedKey, options);
3255
- return MappedResult(properties);
3256
- }
3257
-
3258
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
3259
- function Iterator(items, options) {
3260
- return CreateType({ [Kind]: "Iterator", type: "Iterator", items }, options);
3261
- }
3262
-
3263
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
3264
- function RequiredArray(properties) {
3265
- return globalThis.Object.keys(properties).filter((key) => !IsOptional(properties[key]));
3266
- }
3267
- function _Object(properties, options) {
3268
- const required = RequiredArray(properties);
3269
- const schema = required.length > 0 ? { [Kind]: "Object", type: "object", required, properties } : { [Kind]: "Object", type: "object", properties };
3270
- return CreateType(schema, options);
3271
- }
3272
- var Object2 = _Object;
3273
-
3274
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
3275
- function Promise2(item, options) {
3276
- return CreateType({ [Kind]: "Promise", type: "Promise", item }, options);
3277
- }
3278
-
3279
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
3280
- function RemoveReadonly(schema) {
3281
- return CreateType(Discard(schema, [ReadonlyKind]));
3282
- }
3283
- function AddReadonly(schema) {
3284
- return CreateType({ ...schema, [ReadonlyKind]: "Readonly" });
3285
- }
3286
- function ReadonlyWithFlag(schema, F) {
3287
- return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
3288
- }
3289
- function Readonly(schema, enable) {
3290
- const F = enable ?? true;
3291
- return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
3292
- }
3293
-
3294
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
3295
- function FromProperties2(K, F) {
3296
- const Acc = {};
3297
- for (const K2 of globalThis.Object.getOwnPropertyNames(K))
3298
- Acc[K2] = Readonly(K[K2], F);
3299
- return Acc;
3300
- }
3301
- function FromMappedResult2(R, F) {
3302
- return FromProperties2(R.properties, F);
3303
- }
3304
- function ReadonlyFromMappedResult(R, F) {
3305
- const P = FromMappedResult2(R, F);
3306
- return MappedResult(P);
3307
- }
3308
-
3309
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
3310
- function Tuple(types, options) {
3311
- return CreateType(types.length > 0 ? { [Kind]: "Tuple", type: "array", items: types, additionalItems: false, minItems: types.length, maxItems: types.length } : { [Kind]: "Tuple", type: "array", minItems: types.length, maxItems: types.length }, options);
3312
- }
3313
-
3314
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
3315
- function FromMappedResult3(K, P) {
3316
- return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
3317
- }
3318
- function MappedKeyToKnownMappedResultProperties(K) {
3319
- return { [K]: Literal(K) };
3320
- }
3321
- function MappedKeyToUnknownMappedResultProperties(P) {
3322
- const Acc = {};
3323
- for (const L of P)
3324
- Acc[L] = Literal(L);
3325
- return Acc;
3326
- }
3327
- function MappedKeyToMappedResultProperties(K, P) {
3328
- return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
3329
- }
3330
- function FromMappedKey(K, P) {
3331
- const R = MappedKeyToMappedResultProperties(K, P);
3332
- return FromMappedResult3(K, R);
3333
- }
3334
- function FromRest2(K, T) {
3335
- return T.map((L) => FromSchemaType(K, L));
3336
- }
3337
- function FromProperties3(K, T) {
3338
- const Acc = {};
3339
- for (const K2 of globalThis.Object.getOwnPropertyNames(T))
3340
- Acc[K2] = FromSchemaType(K, T[K2]);
3341
- return Acc;
3342
- }
3343
- function FromSchemaType(K, T) {
3344
- const options = { ...T };
3345
- return (
3346
- // unevaluated modifier types
3347
- IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
3348
- // unevaluated mapped types
3349
- IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
3350
- // unevaluated types
3351
- IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsFunction2(T) ? Function(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items), options) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items), options) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf), options) : IsUnion(T) ? Union(FromRest2(K, T.anyOf), options) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? []), options) : IsObject3(T) ? Object2(FromProperties3(K, T.properties), options) : IsArray3(T) ? Array2(FromSchemaType(K, T.items), options) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item), options) : T
3352
- )
3353
- )
3354
- );
3355
- }
3356
- function MappedFunctionReturnType(K, T) {
3357
- const Acc = {};
3358
- for (const L of K)
3359
- Acc[L] = FromSchemaType(L, T);
3360
- return Acc;
3361
- }
3362
- function Mapped(key, map, options) {
3363
- const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
3364
- const RT = map({ [Kind]: "MappedKey", keys: K });
3365
- const R = MappedFunctionReturnType(K, RT);
3366
- return Object2(R, options);
3367
- }
3368
-
3369
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
3370
- function RemoveOptional(schema) {
3371
- return CreateType(Discard(schema, [OptionalKind]));
3372
- }
3373
- function AddOptional(schema) {
3374
- return CreateType({ ...schema, [OptionalKind]: "Optional" });
3375
- }
3376
- function OptionalWithFlag(schema, F) {
3377
- return F === false ? RemoveOptional(schema) : AddOptional(schema);
3378
- }
3379
- function Optional(schema, enable) {
3380
- const F = enable ?? true;
3381
- return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
3382
- }
3383
-
3384
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
3385
- function FromProperties4(P, F) {
3386
- const Acc = {};
3387
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3388
- Acc[K2] = Optional(P[K2], F);
3389
- return Acc;
3390
- }
3391
- function FromMappedResult4(R, F) {
3392
- return FromProperties4(R.properties, F);
3393
- }
3394
- function OptionalFromMappedResult(R, F) {
3395
- const P = FromMappedResult4(R, F);
3396
- return MappedResult(P);
3397
- }
3398
-
3399
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
3400
- function IntersectCreate(T, options = {}) {
3401
- const allObjects = T.every((schema) => IsObject3(schema));
3402
- const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: options.unevaluatedProperties } : {};
3403
- return CreateType(options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: T } : { ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: T }, options);
3404
- }
3405
-
3406
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
3407
- function IsIntersectOptional(types) {
3408
- return types.every((left) => IsOptional(left));
3409
- }
3410
- function RemoveOptionalFromType2(type) {
3411
- return Discard(type, [OptionalKind]);
3412
- }
3413
- function RemoveOptionalFromRest2(types) {
3414
- return types.map((left) => IsOptional(left) ? RemoveOptionalFromType2(left) : left);
3415
- }
3416
- function ResolveIntersect(types, options) {
3417
- return IsIntersectOptional(types) ? Optional(IntersectCreate(RemoveOptionalFromRest2(types), options)) : IntersectCreate(RemoveOptionalFromRest2(types), options);
3418
- }
3419
- function IntersectEvaluated(types, options = {}) {
3420
- if (types.length === 1)
3421
- return CreateType(types[0], options);
3422
- if (types.length === 0)
3423
- return Never(options);
3424
- if (types.some((schema) => IsTransform(schema)))
3425
- throw new Error("Cannot intersect transform types");
3426
- return ResolveIntersect(types, options);
3427
- }
3428
-
3429
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
3430
- function Intersect(types, options) {
3431
- if (types.length === 1)
3432
- return CreateType(types[0], options);
3433
- if (types.length === 0)
3434
- return Never(options);
3435
- if (types.some((schema) => IsTransform(schema)))
3436
- throw new Error("Cannot intersect transform types");
3437
- return IntersectCreate(types, options);
3438
- }
3439
-
3440
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
3441
- function Ref(...args2) {
3442
- const [$ref, options] = typeof args2[0] === "string" ? [args2[0], args2[1]] : [args2[0].$id, args2[1]];
3443
- if (typeof $ref !== "string")
3444
- throw new TypeBoxError("Ref: $ref must be a string");
3445
- return CreateType({ [Kind]: "Ref", $ref }, options);
3446
- }
3447
-
3448
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
3449
- function FromComputed(target, parameters) {
3450
- return Computed("Awaited", [Computed(target, parameters)]);
3451
- }
3452
- function FromRef($ref) {
3453
- return Computed("Awaited", [Ref($ref)]);
3454
- }
3455
- function FromIntersect2(types) {
3456
- return Intersect(FromRest3(types));
3457
- }
3458
- function FromUnion4(types) {
3459
- return Union(FromRest3(types));
3460
- }
3461
- function FromPromise(type) {
3462
- return Awaited(type);
3463
- }
3464
- function FromRest3(types) {
3465
- return types.map((type) => Awaited(type));
3466
- }
3467
- function Awaited(type, options) {
3468
- return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) : IsPromise(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
3469
- }
3470
-
3471
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
3472
- function FromRest4(types) {
3473
- const result = [];
3474
- for (const L of types)
3475
- result.push(KeyOfPropertyKeys(L));
3476
- return result;
3477
- }
3478
- function FromIntersect3(types) {
3479
- const propertyKeysArray = FromRest4(types);
3480
- const propertyKeys = SetUnionMany(propertyKeysArray);
3481
- return propertyKeys;
3482
- }
3483
- function FromUnion5(types) {
3484
- const propertyKeysArray = FromRest4(types);
3485
- const propertyKeys = SetIntersectMany(propertyKeysArray);
3486
- return propertyKeys;
3487
- }
3488
- function FromTuple2(types) {
3489
- return types.map((_, indexer) => indexer.toString());
3490
- }
3491
- function FromArray2(_) {
3492
- return ["[number]"];
3493
- }
3494
- function FromProperties5(T) {
3495
- return globalThis.Object.getOwnPropertyNames(T);
3496
- }
3497
- function FromPatternProperties(patternProperties) {
3498
- if (!includePatternProperties)
3499
- return [];
3500
- const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
3501
- return patternPropertyKeys.map((key) => {
3502
- return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
3503
- });
3504
- }
3505
- function KeyOfPropertyKeys(type) {
3506
- return IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion5(type.anyOf) : IsTuple(type) ? FromTuple2(type.items ?? []) : IsArray3(type) ? FromArray2(type.items) : IsObject3(type) ? FromProperties5(type.properties) : IsRecord(type) ? FromPatternProperties(type.patternProperties) : [];
3507
- }
3508
- var includePatternProperties = false;
3509
-
3510
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
3511
- function FromComputed2(target, parameters) {
3512
- return Computed("KeyOf", [Computed(target, parameters)]);
3513
- }
3514
- function FromRef2($ref) {
3515
- return Computed("KeyOf", [Ref($ref)]);
3516
- }
3517
- function KeyOfFromType(type, options) {
3518
- const propertyKeys = KeyOfPropertyKeys(type);
3519
- const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys);
3520
- const result = UnionEvaluated(propertyKeyTypes);
3521
- return CreateType(result, options);
3522
- }
3523
- function KeyOfPropertyKeysToRest(propertyKeys) {
3524
- return propertyKeys.map((L) => L === "[number]" ? Number2() : Literal(L));
3525
- }
3526
- function KeyOf(type, options) {
3527
- return IsComputed(type) ? FromComputed2(type.target, type.parameters) : IsRef(type) ? FromRef2(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options);
3528
- }
3529
-
3530
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
3531
- function FromProperties6(properties, options) {
3532
- const result = {};
3533
- for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
3534
- result[K2] = KeyOf(properties[K2], Clone(options));
3535
- return result;
3536
- }
3537
- function FromMappedResult5(mappedResult, options) {
3538
- return FromProperties6(mappedResult.properties, options);
3539
- }
3540
- function KeyOfFromMappedResult(mappedResult, options) {
3541
- const properties = FromMappedResult5(mappedResult, options);
3542
- return MappedResult(properties);
3543
- }
3544
-
3545
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
3546
- function CompositeKeys(T) {
3547
- const Acc = [];
3548
- for (const L of T)
3549
- Acc.push(...KeyOfPropertyKeys(L));
3550
- return SetDistinct(Acc);
3551
- }
3552
- function FilterNever(T) {
3553
- return T.filter((L) => !IsNever(L));
3554
- }
3555
- function CompositeProperty(T, K) {
3556
- const Acc = [];
3557
- for (const L of T)
3558
- Acc.push(...IndexFromPropertyKeys(L, [K]));
3559
- return FilterNever(Acc);
3560
- }
3561
- function CompositeProperties(T, K) {
3562
- const Acc = {};
3563
- for (const L of K) {
3564
- Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
3565
- }
3566
- return Acc;
3567
- }
3568
- function Composite(T, options) {
3569
- const K = CompositeKeys(T);
3570
- const P = CompositeProperties(T, K);
3571
- const R = Object2(P, options);
3572
- return R;
3573
- }
3574
-
3575
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
3576
- function Date2(options) {
3577
- return CreateType({ [Kind]: "Date", type: "Date" }, options);
3578
- }
3579
-
3580
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
3581
- function Null(options) {
3582
- return CreateType({ [Kind]: "Null", type: "null" }, options);
3583
- }
3584
-
3585
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
3586
- function Symbol2(options) {
3587
- return CreateType({ [Kind]: "Symbol", type: "symbol" }, options);
3588
- }
3589
-
3590
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
3591
- function Undefined(options) {
3592
- return CreateType({ [Kind]: "Undefined", type: "undefined" }, options);
3593
- }
3594
-
3595
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
3596
- function Uint8Array2(options) {
3597
- return CreateType({ [Kind]: "Uint8Array", type: "Uint8Array" }, options);
3598
- }
3599
-
3600
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
3601
- function Unknown(options) {
3602
- return CreateType({ [Kind]: "Unknown" }, options);
3603
- }
3604
-
3605
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
3606
- function FromArray3(T) {
3607
- return T.map((L) => FromValue(L, false));
3608
- }
3609
- function FromProperties7(value) {
3610
- const Acc = {};
3611
- for (const K of globalThis.Object.getOwnPropertyNames(value))
3612
- Acc[K] = Readonly(FromValue(value[K], false));
3613
- return Acc;
3614
- }
3615
- function ConditionalReadonly(T, root) {
3616
- return root === true ? T : Readonly(T);
3617
- }
3618
- function FromValue(value, root) {
3619
- return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
3620
- }
3621
- function Const(T, options) {
3622
- return CreateType(FromValue(T, true), options);
3623
- }
3624
-
3625
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
3626
- function ConstructorParameters(schema, options) {
3627
- return IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options);
3628
- }
3629
-
3630
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
3631
- function Enum(item, options) {
3632
- if (IsUndefined(item))
3633
- throw new Error("Enum undefined or empty");
3634
- const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
3635
- const values2 = [...new Set(values1)];
3636
- const anyOf = values2.map((value) => Literal(value));
3637
- return Union(anyOf, { ...options, [Hint]: "Enum" });
3638
- }
3639
-
3640
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
3641
- var ExtendsResolverError = class extends TypeBoxError {
3642
- };
3643
- var ExtendsResult;
3644
- (function(ExtendsResult2) {
3645
- ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
3646
- ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
3647
- ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
3648
- })(ExtendsResult || (ExtendsResult = {}));
3649
- function IntoBooleanResult(result) {
3650
- return result === ExtendsResult.False ? result : ExtendsResult.True;
3651
- }
3652
- function Throw(message) {
3653
- throw new ExtendsResolverError(message);
3654
- }
3655
- function IsStructuralRight(right) {
3656
- return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
3657
- }
3658
- function StructuralRight(left, right) {
3659
- return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
3660
- }
3661
- function FromAnyRight(left, right) {
3662
- return ExtendsResult.True;
3663
- }
3664
- function FromAny(left, right) {
3665
- return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) && right.anyOf.some((schema) => type_exports.IsAny(schema) || type_exports.IsUnknown(schema)) ? ExtendsResult.True : type_exports.IsUnion(right) ? ExtendsResult.Union : type_exports.IsUnknown(right) ? ExtendsResult.True : type_exports.IsAny(right) ? ExtendsResult.True : ExtendsResult.Union;
3666
- }
3667
- function FromArrayRight(left, right) {
3668
- return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
3669
- }
3670
- function FromArray4(left, right) {
3671
- return type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsArray(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3672
- }
3673
- function FromAsyncIterator(left, right) {
3674
- return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3675
- }
3676
- function FromBigInt(left, right) {
3677
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBigInt(right) ? ExtendsResult.True : ExtendsResult.False;
3678
- }
3679
- function FromBooleanRight(left, right) {
3680
- return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
3681
- }
3682
- function FromBoolean(left, right) {
3683
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBoolean(right) ? ExtendsResult.True : ExtendsResult.False;
3684
- }
3685
- function FromConstructor(left, right) {
3686
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsConstructor(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
3687
- }
3688
- function FromDate(left, right) {
3689
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsDate(right) ? ExtendsResult.True : ExtendsResult.False;
3690
- }
3691
- function FromFunction(left, right) {
3692
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsFunction(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
3693
- }
3694
- function FromIntegerRight(left, right) {
3695
- return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
3696
- }
3697
- function FromInteger(left, right) {
3698
- return type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : ExtendsResult.False;
3699
- }
3700
- function FromIntersectRight(left, right) {
3701
- return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3702
- }
3703
- function FromIntersect4(left, right) {
3704
- return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3705
- }
3706
- function FromIterator(left, right) {
3707
- return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3708
- }
3709
- function FromLiteral2(left, right) {
3710
- return type_exports.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
3711
- }
3712
- function FromNeverRight(left, right) {
3713
- return ExtendsResult.False;
3714
- }
3715
- function FromNever(left, right) {
3716
- return ExtendsResult.True;
3717
- }
3718
- function UnwrapTNot(schema) {
3719
- let [current, depth] = [schema, 0];
3720
- while (true) {
3721
- if (!type_exports.IsNot(current))
3722
- break;
3723
- current = current.not;
3724
- depth += 1;
3725
- }
3726
- return depth % 2 === 0 ? current : Unknown();
3727
- }
3728
- function FromNot(left, right) {
3729
- return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
3730
- }
3731
- function FromNull(left, right) {
3732
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsNull(right) ? ExtendsResult.True : ExtendsResult.False;
3733
- }
3734
- function FromNumberRight(left, right) {
3735
- return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
3736
- }
3737
- function FromNumber(left, right) {
3738
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : ExtendsResult.False;
3739
- }
3740
- function IsObjectPropertyCount(schema, count) {
3741
- return Object.getOwnPropertyNames(schema.properties).length === count;
3742
- }
3743
- function IsObjectStringLike(schema) {
3744
- return IsObjectArrayLike(schema);
3745
- }
3746
- function IsObjectSymbolLike(schema) {
3747
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && type_exports.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (type_exports.IsString(schema.properties.description.anyOf[0]) && type_exports.IsUndefined(schema.properties.description.anyOf[1]) || type_exports.IsString(schema.properties.description.anyOf[1]) && type_exports.IsUndefined(schema.properties.description.anyOf[0]));
3748
- }
3749
- function IsObjectNumberLike(schema) {
3750
- return IsObjectPropertyCount(schema, 0);
3751
- }
3752
- function IsObjectBooleanLike(schema) {
3753
- return IsObjectPropertyCount(schema, 0);
3754
- }
3755
- function IsObjectBigIntLike(schema) {
3756
- return IsObjectPropertyCount(schema, 0);
3757
- }
3758
- function IsObjectDateLike(schema) {
3759
- return IsObjectPropertyCount(schema, 0);
3760
- }
3761
- function IsObjectUint8ArrayLike(schema) {
3762
- return IsObjectArrayLike(schema);
3763
- }
3764
- function IsObjectFunctionLike(schema) {
3765
- const length = Number2();
3766
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
3767
- }
3768
- function IsObjectConstructorLike(schema) {
3769
- return IsObjectPropertyCount(schema, 0);
3770
- }
3771
- function IsObjectArrayLike(schema) {
3772
- const length = Number2();
3773
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
3774
- }
3775
- function IsObjectPromiseLike(schema) {
3776
- const then = Function([Any()], Any());
3777
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
3778
- }
3779
- function Property(left, right) {
3780
- return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
3781
- }
3782
- function FromObjectRight(left, right) {
3783
- return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) || type_exports.IsLiteralString(left) && IsObjectStringLike(right) || type_exports.IsLiteralNumber(left) && IsObjectNumberLike(right) || type_exports.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsBigInt(left) && IsObjectBigIntLike(right) || type_exports.IsString(left) && IsObjectStringLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsNumber(left) && IsObjectNumberLike(right) || type_exports.IsInteger(left) && IsObjectNumberLike(right) || type_exports.IsBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || type_exports.IsDate(left) && IsObjectDateLike(right) || type_exports.IsConstructor(left) && IsObjectConstructorLike(right) || type_exports.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : type_exports.IsRecord(left) && type_exports.IsString(RecordKey(left)) ? (() => {
3784
- return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
3785
- })() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
3786
- return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
3787
- })() : ExtendsResult.False;
3788
- }
3789
- function FromObject(left, right) {
3790
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
3791
- for (const key of Object.getOwnPropertyNames(right.properties)) {
3792
- if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
3793
- return ExtendsResult.False;
3794
- }
3795
- if (type_exports.IsOptional(right.properties[key])) {
3796
- return ExtendsResult.True;
3797
- }
3798
- if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
3799
- return ExtendsResult.False;
3800
- }
3801
- }
3802
- return ExtendsResult.True;
3803
- })();
3804
- }
3805
- function FromPromise2(left, right) {
3806
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
3807
- }
3808
- function RecordKey(schema) {
3809
- return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String2() : Throw("Unknown record key pattern");
3810
- }
3811
- function RecordValue(schema) {
3812
- return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
3813
- }
3814
- function FromRecordRight(left, right) {
3815
- const [Key, Value] = [RecordKey(right), RecordValue(right)];
3816
- return type_exports.IsLiteralString(left) && type_exports.IsNumber(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : type_exports.IsUint8Array(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsString(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsArray(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsObject(left) ? (() => {
3817
- for (const key of Object.getOwnPropertyNames(left.properties)) {
3818
- if (Property(Value, left.properties[key]) === ExtendsResult.False) {
3819
- return ExtendsResult.False;
3820
- }
3821
- }
3822
- return ExtendsResult.True;
3823
- })() : ExtendsResult.False;
3824
- }
3825
- function FromRecord(left, right) {
3826
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
3827
- }
3828
- function FromRegExp(left, right) {
3829
- const L = type_exports.IsRegExp(left) ? String2() : left;
3830
- const R = type_exports.IsRegExp(right) ? String2() : right;
3831
- return Visit3(L, R);
3832
- }
3833
- function FromStringRight(left, right) {
3834
- return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
3835
- }
3836
- function FromString(left, right) {
3837
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? ExtendsResult.True : ExtendsResult.False;
3838
- }
3839
- function FromSymbol(left, right) {
3840
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsSymbol(right) ? ExtendsResult.True : ExtendsResult.False;
3841
- }
3842
- function FromTemplateLiteral2(left, right) {
3843
- return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
3844
- }
3845
- function IsArrayOfTuple(left, right) {
3846
- return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
3847
- }
3848
- function FromTupleRight(left, right) {
3849
- return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
3850
- }
3851
- function FromTuple3(left, right) {
3852
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : type_exports.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !type_exports.IsTuple(right) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) || !value_exports.IsUndefined(left.items) && value_exports.IsUndefined(right.items) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index) => Visit3(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3853
- }
3854
- function FromUint8Array(left, right) {
3855
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsUint8Array(right) ? ExtendsResult.True : ExtendsResult.False;
3856
- }
3857
- function FromUndefined(left, right) {
3858
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsVoid(right) ? FromVoidRight(left, right) : type_exports.IsUndefined(right) ? ExtendsResult.True : ExtendsResult.False;
3859
- }
3860
- function FromUnionRight(left, right) {
3861
- return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3862
- }
3863
- function FromUnion6(left, right) {
3864
- return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3865
- }
3866
- function FromUnknownRight(left, right) {
3867
- return ExtendsResult.True;
3868
- }
3869
- function FromUnknown(left, right) {
3870
- return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : type_exports.IsArray(right) ? FromArrayRight(left, right) : type_exports.IsTuple(right) ? FromTupleRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsUnknown(right) ? ExtendsResult.True : ExtendsResult.False;
3871
- }
3872
- function FromVoidRight(left, right) {
3873
- return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
3874
- }
3875
- function FromVoid(left, right) {
3876
- return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsVoid(right) ? ExtendsResult.True : ExtendsResult.False;
3877
- }
3878
- function Visit3(left, right) {
3879
- return (
3880
- // resolvable
3881
- type_exports.IsTemplateLiteral(left) || type_exports.IsTemplateLiteral(right) ? FromTemplateLiteral2(left, right) : type_exports.IsRegExp(left) || type_exports.IsRegExp(right) ? FromRegExp(left, right) : type_exports.IsNot(left) || type_exports.IsNot(right) ? FromNot(left, right) : (
3882
- // standard
3883
- type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray4(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator(left, right) : type_exports.IsConstructor(left) ? FromConstructor(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect4(left, right) : type_exports.IsIterator(left) ? FromIterator(left, right) : type_exports.IsLiteral(left) ? FromLiteral2(left, right) : type_exports.IsNever(left) ? FromNever(left, right) : type_exports.IsNull(left) ? FromNull(left, right) : type_exports.IsNumber(left) ? FromNumber(left, right) : type_exports.IsObject(left) ? FromObject(left, right) : type_exports.IsRecord(left) ? FromRecord(left, right) : type_exports.IsString(left) ? FromString(left, right) : type_exports.IsSymbol(left) ? FromSymbol(left, right) : type_exports.IsTuple(left) ? FromTuple3(left, right) : type_exports.IsPromise(left) ? FromPromise2(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion6(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
3884
- )
3885
- );
3886
- }
3887
- function ExtendsCheck(left, right) {
3888
- return Visit3(left, right);
3889
- }
3890
-
3891
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
3892
- function FromProperties8(P, Right, True, False, options) {
3893
- const Acc = {};
3894
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3895
- Acc[K2] = Extends(P[K2], Right, True, False, Clone(options));
3896
- return Acc;
3897
- }
3898
- function FromMappedResult6(Left, Right, True, False, options) {
3899
- return FromProperties8(Left.properties, Right, True, False, options);
3900
- }
3901
- function ExtendsFromMappedResult(Left, Right, True, False, options) {
3902
- const P = FromMappedResult6(Left, Right, True, False, options);
3903
- return MappedResult(P);
3904
- }
3905
-
3906
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
3907
- function ExtendsResolve(left, right, trueType, falseType) {
3908
- const R = ExtendsCheck(left, right);
3909
- return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
3910
- }
3911
- function Extends(L, R, T, F, options) {
3912
- return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CreateType(ExtendsFromMappedKey(L, R, T, F, options)) : CreateType(ExtendsResolve(L, R, T, F), options);
3913
- }
3914
-
3915
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
3916
- function FromPropertyKey(K, U, L, R, options) {
3917
- return {
3918
- [K]: Extends(Literal(K), U, L, R, Clone(options))
3919
- };
3920
- }
3921
- function FromPropertyKeys(K, U, L, R, options) {
3922
- return K.reduce((Acc, LK) => {
3923
- return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
3924
- }, {});
3925
- }
3926
- function FromMappedKey2(K, U, L, R, options) {
3927
- return FromPropertyKeys(K.keys, U, L, R, options);
3928
- }
3929
- function ExtendsFromMappedKey(T, U, L, R, options) {
3930
- const P = FromMappedKey2(T, U, L, R, options);
3931
- return MappedResult(P);
3932
- }
3933
-
3934
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
3935
- function ExcludeFromTemplateLiteral(L, R) {
3936
- return Exclude(TemplateLiteralToUnion(L), R);
3937
- }
3938
-
3939
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
3940
- function ExcludeRest(L, R) {
3941
- const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
3942
- return excluded.length === 1 ? excluded[0] : Union(excluded);
3943
- }
3944
- function Exclude(L, R, options = {}) {
3945
- if (IsTemplateLiteral(L))
3946
- return CreateType(ExcludeFromTemplateLiteral(L, R), options);
3947
- if (IsMappedResult(L))
3948
- return CreateType(ExcludeFromMappedResult(L, R), options);
3949
- return CreateType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
3950
- }
3951
-
3952
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
3953
- function FromProperties9(P, U) {
3954
- const Acc = {};
3955
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3956
- Acc[K2] = Exclude(P[K2], U);
3957
- return Acc;
3958
- }
3959
- function FromMappedResult7(R, T) {
3960
- return FromProperties9(R.properties, T);
3961
- }
3962
- function ExcludeFromMappedResult(R, T) {
3963
- const P = FromMappedResult7(R, T);
3964
- return MappedResult(P);
3965
- }
3966
-
3967
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
3968
- function ExtractFromTemplateLiteral(L, R) {
3969
- return Extract(TemplateLiteralToUnion(L), R);
3970
- }
3971
-
3972
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
3973
- function ExtractRest(L, R) {
3974
- const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
3975
- return extracted.length === 1 ? extracted[0] : Union(extracted);
3976
- }
3977
- function Extract(L, R, options) {
3978
- if (IsTemplateLiteral(L))
3979
- return CreateType(ExtractFromTemplateLiteral(L, R), options);
3980
- if (IsMappedResult(L))
3981
- return CreateType(ExtractFromMappedResult(L, R), options);
3982
- return CreateType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
3983
- }
3984
-
3985
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
3986
- function FromProperties10(P, T) {
3987
- const Acc = {};
3988
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3989
- Acc[K2] = Extract(P[K2], T);
3990
- return Acc;
3991
- }
3992
- function FromMappedResult8(R, T) {
3993
- return FromProperties10(R.properties, T);
3994
- }
3995
- function ExtractFromMappedResult(R, T) {
3996
- const P = FromMappedResult8(R, T);
3997
- return MappedResult(P);
3998
- }
3999
-
4000
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
4001
- function InstanceType(schema, options) {
4002
- return IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options);
4003
- }
4004
-
4005
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
4006
- function ReadonlyOptional(schema) {
4007
- return Readonly(Optional(schema));
4008
- }
4009
-
4010
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
4011
- function RecordCreateFromPattern(pattern, T, options) {
4012
- return CreateType({ [Kind]: "Record", type: "object", patternProperties: { [pattern]: T } }, options);
4013
- }
4014
- function RecordCreateFromKeys(K, T, options) {
4015
- const result = {};
4016
- for (const K2 of K)
4017
- result[K2] = T;
4018
- return Object2(result, { ...options, [Hint]: "Record" });
4019
- }
4020
- function FromTemplateLiteralKey(K, T, options) {
4021
- return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
4022
- }
4023
- function FromUnionKey(key, type, options) {
4024
- return RecordCreateFromKeys(IndexPropertyKeys(Union(key)), type, options);
4025
- }
4026
- function FromLiteralKey(key, type, options) {
4027
- return RecordCreateFromKeys([key.toString()], type, options);
4028
- }
4029
- function FromRegExpKey(key, type, options) {
4030
- return RecordCreateFromPattern(key.source, type, options);
4031
- }
4032
- function FromStringKey(key, type, options) {
4033
- const pattern = IsUndefined(key.pattern) ? PatternStringExact : key.pattern;
4034
- return RecordCreateFromPattern(pattern, type, options);
4035
- }
4036
- function FromAnyKey(_, type, options) {
4037
- return RecordCreateFromPattern(PatternStringExact, type, options);
4038
- }
4039
- function FromNeverKey(_key, type, options) {
4040
- return RecordCreateFromPattern(PatternNeverExact, type, options);
4041
- }
4042
- function FromBooleanKey(_key, type, options) {
4043
- return Object2({ true: type, false: type }, options);
4044
- }
4045
- function FromIntegerKey(_key, type, options) {
4046
- return RecordCreateFromPattern(PatternNumberExact, type, options);
4047
- }
4048
- function FromNumberKey(_, type, options) {
4049
- return RecordCreateFromPattern(PatternNumberExact, type, options);
4050
- }
4051
- function Record(key, type, options = {}) {
4052
- return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) : IsBoolean2(key) ? FromBooleanKey(key, type, options) : IsInteger(key) ? FromIntegerKey(key, type, options) : IsNumber3(key) ? FromNumberKey(key, type, options) : IsRegExp2(key) ? FromRegExpKey(key, type, options) : IsString2(key) ? FromStringKey(key, type, options) : IsAny(key) ? FromAnyKey(key, type, options) : IsNever(key) ? FromNeverKey(key, type, options) : Never(options);
4053
- }
4054
- function RecordPattern(record) {
4055
- return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
4056
- }
4057
- function RecordKey2(type) {
4058
- const pattern = RecordPattern(type);
4059
- return pattern === PatternStringExact ? String2() : pattern === PatternNumberExact ? Number2() : String2({ pattern });
4060
- }
4061
- function RecordValue2(type) {
4062
- return type.patternProperties[RecordPattern(type)];
4063
- }
4064
-
4065
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs
4066
- function FromConstructor2(args2, type) {
4067
- type.parameters = FromTypes(args2, type.parameters);
4068
- type.returns = FromType(args2, type.returns);
4069
- return type;
4070
- }
4071
- function FromFunction2(args2, type) {
4072
- type.parameters = FromTypes(args2, type.parameters);
4073
- type.returns = FromType(args2, type.returns);
4074
- return type;
4075
- }
4076
- function FromIntersect5(args2, type) {
4077
- type.allOf = FromTypes(args2, type.allOf);
4078
- return type;
4079
- }
4080
- function FromUnion7(args2, type) {
4081
- type.anyOf = FromTypes(args2, type.anyOf);
4082
- return type;
4083
- }
4084
- function FromTuple4(args2, type) {
4085
- if (IsUndefined(type.items))
4086
- return type;
4087
- type.items = FromTypes(args2, type.items);
4088
- return type;
4089
- }
4090
- function FromArray5(args2, type) {
4091
- type.items = FromType(args2, type.items);
4092
- return type;
4093
- }
4094
- function FromAsyncIterator2(args2, type) {
4095
- type.items = FromType(args2, type.items);
4096
- return type;
4097
- }
4098
- function FromIterator2(args2, type) {
4099
- type.items = FromType(args2, type.items);
4100
- return type;
4101
- }
4102
- function FromPromise3(args2, type) {
4103
- type.item = FromType(args2, type.item);
4104
- return type;
4105
- }
4106
- function FromObject2(args2, type) {
4107
- const mappedProperties = FromProperties11(args2, type.properties);
4108
- return { ...type, ...Object2(mappedProperties) };
4109
- }
4110
- function FromRecord2(args2, type) {
4111
- const mappedKey = FromType(args2, RecordKey2(type));
4112
- const mappedValue = FromType(args2, RecordValue2(type));
4113
- const result = Record(mappedKey, mappedValue);
4114
- return { ...type, ...result };
4115
- }
4116
- function FromArgument(args2, argument) {
4117
- return argument.index in args2 ? args2[argument.index] : Unknown();
4118
- }
4119
- function FromProperty2(args2, type) {
4120
- const isReadonly = IsReadonly(type);
4121
- const isOptional = IsOptional(type);
4122
- const mapped = FromType(args2, type);
4123
- return isReadonly && isOptional ? ReadonlyOptional(mapped) : isReadonly && !isOptional ? Readonly(mapped) : !isReadonly && isOptional ? Optional(mapped) : mapped;
4124
- }
4125
- function FromProperties11(args2, properties) {
4126
- return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => {
4127
- return { ...result, [key]: FromProperty2(args2, properties[key]) };
4128
- }, {});
4129
- }
4130
- function FromTypes(args2, types) {
4131
- return types.map((type) => FromType(args2, type));
4132
- }
4133
- function FromType(args2, type) {
4134
- return IsConstructor(type) ? FromConstructor2(args2, type) : IsFunction2(type) ? FromFunction2(args2, type) : IsIntersect(type) ? FromIntersect5(args2, type) : IsUnion(type) ? FromUnion7(args2, type) : IsTuple(type) ? FromTuple4(args2, type) : IsArray3(type) ? FromArray5(args2, type) : IsAsyncIterator2(type) ? FromAsyncIterator2(args2, type) : IsIterator2(type) ? FromIterator2(args2, type) : IsPromise(type) ? FromPromise3(args2, type) : IsObject3(type) ? FromObject2(args2, type) : IsRecord(type) ? FromRecord2(args2, type) : IsArgument(type) ? FromArgument(args2, type) : type;
4135
- }
4136
- function Instantiate(type, args2) {
4137
- return FromType(args2, CloneType(type));
4138
- }
4139
-
4140
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
4141
- function Integer(options) {
4142
- return CreateType({ [Kind]: "Integer", type: "integer" }, options);
4143
- }
4144
-
4145
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
4146
- function MappedIntrinsicPropertyKey(K, M, options) {
4147
- return {
4148
- [K]: Intrinsic(Literal(K), M, Clone(options))
4149
- };
4150
- }
4151
- function MappedIntrinsicPropertyKeys(K, M, options) {
4152
- const result = K.reduce((Acc, L) => {
4153
- return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
4154
- }, {});
4155
- return result;
4156
- }
4157
- function MappedIntrinsicProperties(T, M, options) {
4158
- return MappedIntrinsicPropertyKeys(T["keys"], M, options);
4159
- }
4160
- function IntrinsicFromMappedKey(T, M, options) {
4161
- const P = MappedIntrinsicProperties(T, M, options);
4162
- return MappedResult(P);
4163
- }
4164
-
4165
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
4166
- function ApplyUncapitalize(value) {
4167
- const [first, rest] = [value.slice(0, 1), value.slice(1)];
4168
- return [first.toLowerCase(), rest].join("");
4169
- }
4170
- function ApplyCapitalize(value) {
4171
- const [first, rest] = [value.slice(0, 1), value.slice(1)];
4172
- return [first.toUpperCase(), rest].join("");
4173
- }
4174
- function ApplyUppercase(value) {
4175
- return value.toUpperCase();
4176
- }
4177
- function ApplyLowercase(value) {
4178
- return value.toLowerCase();
4179
- }
4180
- function FromTemplateLiteral3(schema, mode, options) {
4181
- const expression = TemplateLiteralParseExact(schema.pattern);
4182
- const finite = IsTemplateLiteralExpressionFinite(expression);
4183
- if (!finite)
4184
- return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
4185
- const strings = [...TemplateLiteralExpressionGenerate(expression)];
4186
- const literals = strings.map((value) => Literal(value));
4187
- const mapped = FromRest5(literals, mode);
4188
- const union = Union(mapped);
4189
- return TemplateLiteral([union], options);
4190
- }
4191
- function FromLiteralValue(value, mode) {
4192
- return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
4193
- }
4194
- function FromRest5(T, M) {
4195
- return T.map((L) => Intrinsic(L, M));
4196
- }
4197
- function Intrinsic(schema, mode, options = {}) {
4198
- return (
4199
- // Intrinsic-Mapped-Inference
4200
- IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
4201
- // Standard-Inference
4202
- IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, options) : IsUnion(schema) ? Union(FromRest5(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : (
4203
- // Default Type
4204
- CreateType(schema, options)
4205
- )
4206
- )
4207
- );
4208
- }
4209
-
4210
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
4211
- function Capitalize(T, options = {}) {
4212
- return Intrinsic(T, "Capitalize", options);
4213
- }
4214
-
4215
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
4216
- function Lowercase(T, options = {}) {
4217
- return Intrinsic(T, "Lowercase", options);
4218
- }
4219
-
4220
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
4221
- function Uncapitalize(T, options = {}) {
4222
- return Intrinsic(T, "Uncapitalize", options);
4223
- }
4224
-
4225
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
4226
- function Uppercase(T, options = {}) {
4227
- return Intrinsic(T, "Uppercase", options);
4228
- }
4229
-
4230
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
4231
- function FromProperties12(properties, propertyKeys, options) {
4232
- const result = {};
4233
- for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
4234
- result[K2] = Omit(properties[K2], propertyKeys, Clone(options));
4235
- return result;
4236
- }
4237
- function FromMappedResult9(mappedResult, propertyKeys, options) {
4238
- return FromProperties12(mappedResult.properties, propertyKeys, options);
4239
- }
4240
- function OmitFromMappedResult(mappedResult, propertyKeys, options) {
4241
- const properties = FromMappedResult9(mappedResult, propertyKeys, options);
4242
- return MappedResult(properties);
4243
- }
4244
-
4245
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
4246
- function FromIntersect6(types, propertyKeys) {
4247
- return types.map((type) => OmitResolve(type, propertyKeys));
4248
- }
4249
- function FromUnion8(types, propertyKeys) {
4250
- return types.map((type) => OmitResolve(type, propertyKeys));
4251
- }
4252
- function FromProperty3(properties, key) {
4253
- const { [key]: _, ...R } = properties;
4254
- return R;
4255
- }
4256
- function FromProperties13(properties, propertyKeys) {
4257
- return propertyKeys.reduce((T, K2) => FromProperty3(T, K2), properties);
4258
- }
4259
- function FromObject3(type, propertyKeys, properties) {
4260
- const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
4261
- const mappedProperties = FromProperties13(properties, propertyKeys);
4262
- return Object2(mappedProperties, options);
4263
- }
4264
- function UnionFromPropertyKeys(propertyKeys) {
4265
- const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
4266
- return Union(result);
4267
- }
4268
- function OmitResolve(type, propertyKeys) {
4269
- return IsIntersect(type) ? Intersect(FromIntersect6(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion8(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject3(type, propertyKeys, type.properties) : Object2({});
4270
- }
4271
- function Omit(type, key, options) {
4272
- const typeKey = IsArray(key) ? UnionFromPropertyKeys(key) : key;
4273
- const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
4274
- const isTypeRef = IsRef(type);
4275
- const isKeyRef = IsRef(key);
4276
- return IsMappedResult(type) ? OmitFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? OmitFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Omit", [type, typeKey], options) : CreateType({ ...OmitResolve(type, propertyKeys), ...options });
4277
- }
4278
-
4279
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
4280
- function FromPropertyKey2(type, key, options) {
4281
- return { [key]: Omit(type, [key], Clone(options)) };
4282
- }
4283
- function FromPropertyKeys2(type, propertyKeys, options) {
4284
- return propertyKeys.reduce((Acc, LK) => {
4285
- return { ...Acc, ...FromPropertyKey2(type, LK, options) };
4286
- }, {});
4287
- }
4288
- function FromMappedKey3(type, mappedKey, options) {
4289
- return FromPropertyKeys2(type, mappedKey.keys, options);
4290
- }
4291
- function OmitFromMappedKey(type, mappedKey, options) {
4292
- const properties = FromMappedKey3(type, mappedKey, options);
4293
- return MappedResult(properties);
4294
- }
4295
-
4296
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
4297
- function FromProperties14(properties, propertyKeys, options) {
4298
- const result = {};
4299
- for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
4300
- result[K2] = Pick(properties[K2], propertyKeys, Clone(options));
4301
- return result;
4302
- }
4303
- function FromMappedResult10(mappedResult, propertyKeys, options) {
4304
- return FromProperties14(mappedResult.properties, propertyKeys, options);
4305
- }
4306
- function PickFromMappedResult(mappedResult, propertyKeys, options) {
4307
- const properties = FromMappedResult10(mappedResult, propertyKeys, options);
4308
- return MappedResult(properties);
4309
- }
4310
-
4311
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
4312
- function FromIntersect7(types, propertyKeys) {
4313
- return types.map((type) => PickResolve(type, propertyKeys));
4314
- }
4315
- function FromUnion9(types, propertyKeys) {
4316
- return types.map((type) => PickResolve(type, propertyKeys));
4317
- }
4318
- function FromProperties15(properties, propertyKeys) {
4319
- const result = {};
4320
- for (const K2 of propertyKeys)
4321
- if (K2 in properties)
4322
- result[K2] = properties[K2];
4323
- return result;
4324
- }
4325
- function FromObject4(Type2, keys, properties) {
4326
- const options = Discard(Type2, [TransformKind, "$id", "required", "properties"]);
4327
- const mappedProperties = FromProperties15(properties, keys);
4328
- return Object2(mappedProperties, options);
4329
- }
4330
- function UnionFromPropertyKeys2(propertyKeys) {
4331
- const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
4332
- return Union(result);
4333
- }
4334
- function PickResolve(type, propertyKeys) {
4335
- return IsIntersect(type) ? Intersect(FromIntersect7(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion9(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject4(type, propertyKeys, type.properties) : Object2({});
4336
- }
4337
- function Pick(type, key, options) {
4338
- const typeKey = IsArray(key) ? UnionFromPropertyKeys2(key) : key;
4339
- const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
4340
- const isTypeRef = IsRef(type);
4341
- const isKeyRef = IsRef(key);
4342
- return IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? PickFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Pick", [type, typeKey], options) : CreateType({ ...PickResolve(type, propertyKeys), ...options });
4343
- }
4344
-
4345
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
4346
- function FromPropertyKey3(type, key, options) {
4347
- return {
4348
- [key]: Pick(type, [key], Clone(options))
4349
- };
4350
- }
4351
- function FromPropertyKeys3(type, propertyKeys, options) {
4352
- return propertyKeys.reduce((result, leftKey) => {
4353
- return { ...result, ...FromPropertyKey3(type, leftKey, options) };
4354
- }, {});
4355
- }
4356
- function FromMappedKey4(type, mappedKey, options) {
4357
- return FromPropertyKeys3(type, mappedKey.keys, options);
4358
- }
4359
- function PickFromMappedKey(type, mappedKey, options) {
4360
- const properties = FromMappedKey4(type, mappedKey, options);
4361
- return MappedResult(properties);
4362
- }
4363
-
4364
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
4365
- function FromComputed3(target, parameters) {
4366
- return Computed("Partial", [Computed(target, parameters)]);
4367
- }
4368
- function FromRef3($ref) {
4369
- return Computed("Partial", [Ref($ref)]);
4370
- }
4371
- function FromProperties16(properties) {
4372
- const partialProperties = {};
4373
- for (const K of globalThis.Object.getOwnPropertyNames(properties))
4374
- partialProperties[K] = Optional(properties[K]);
4375
- return partialProperties;
4376
- }
4377
- function FromObject5(type, properties) {
4378
- const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
4379
- const mappedProperties = FromProperties16(properties);
4380
- return Object2(mappedProperties, options);
4381
- }
4382
- function FromRest6(types) {
4383
- return types.map((type) => PartialResolve(type));
4384
- }
4385
- function PartialResolve(type) {
4386
- return (
4387
- // Mappable
4388
- IsComputed(type) ? FromComputed3(type.target, type.parameters) : IsRef(type) ? FromRef3(type.$ref) : IsIntersect(type) ? Intersect(FromRest6(type.allOf)) : IsUnion(type) ? Union(FromRest6(type.anyOf)) : IsObject3(type) ? FromObject5(type, type.properties) : (
4389
- // Intrinsic
4390
- IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
4391
- // Passthrough
4392
- Object2({})
4393
- )
4394
- )
4395
- );
4396
- }
4397
- function Partial(type, options) {
4398
- if (IsMappedResult(type)) {
4399
- return PartialFromMappedResult(type, options);
4400
- } else {
4401
- return CreateType({ ...PartialResolve(type), ...options });
4402
- }
4403
- }
4404
-
4405
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
4406
- function FromProperties17(K, options) {
4407
- const Acc = {};
4408
- for (const K2 of globalThis.Object.getOwnPropertyNames(K))
4409
- Acc[K2] = Partial(K[K2], Clone(options));
4410
- return Acc;
4411
- }
4412
- function FromMappedResult11(R, options) {
4413
- return FromProperties17(R.properties, options);
4414
- }
4415
- function PartialFromMappedResult(R, options) {
4416
- const P = FromMappedResult11(R, options);
4417
- return MappedResult(P);
4418
- }
4419
-
4420
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
4421
- function FromComputed4(target, parameters) {
4422
- return Computed("Required", [Computed(target, parameters)]);
4423
- }
4424
- function FromRef4($ref) {
4425
- return Computed("Required", [Ref($ref)]);
4426
- }
4427
- function FromProperties18(properties) {
4428
- const requiredProperties = {};
4429
- for (const K of globalThis.Object.getOwnPropertyNames(properties))
4430
- requiredProperties[K] = Discard(properties[K], [OptionalKind]);
4431
- return requiredProperties;
4432
- }
4433
- function FromObject6(type, properties) {
4434
- const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
4435
- const mappedProperties = FromProperties18(properties);
4436
- return Object2(mappedProperties, options);
4437
- }
4438
- function FromRest7(types) {
4439
- return types.map((type) => RequiredResolve(type));
4440
- }
4441
- function RequiredResolve(type) {
4442
- return (
4443
- // Mappable
4444
- IsComputed(type) ? FromComputed4(type.target, type.parameters) : IsRef(type) ? FromRef4(type.$ref) : IsIntersect(type) ? Intersect(FromRest7(type.allOf)) : IsUnion(type) ? Union(FromRest7(type.anyOf)) : IsObject3(type) ? FromObject6(type, type.properties) : (
4445
- // Intrinsic
4446
- IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
4447
- // Passthrough
4448
- Object2({})
4449
- )
4450
- )
4451
- );
4452
- }
4453
- function Required(type, options) {
4454
- if (IsMappedResult(type)) {
4455
- return RequiredFromMappedResult(type, options);
4456
- } else {
4457
- return CreateType({ ...RequiredResolve(type), ...options });
4458
- }
4459
- }
4460
-
4461
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
4462
- function FromProperties19(P, options) {
4463
- const Acc = {};
4464
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4465
- Acc[K2] = Required(P[K2], options);
4466
- return Acc;
4467
- }
4468
- function FromMappedResult12(R, options) {
4469
- return FromProperties19(R.properties, options);
4470
- }
4471
- function RequiredFromMappedResult(R, options) {
4472
- const P = FromMappedResult12(R, options);
4473
- return MappedResult(P);
4474
- }
4475
-
4476
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs
4477
- function DereferenceParameters(moduleProperties, types) {
4478
- return types.map((type) => {
4479
- return IsRef(type) ? Dereference(moduleProperties, type.$ref) : FromType2(moduleProperties, type);
4480
- });
4481
- }
4482
- function Dereference(moduleProperties, ref) {
4483
- return ref in moduleProperties ? IsRef(moduleProperties[ref]) ? Dereference(moduleProperties, moduleProperties[ref].$ref) : FromType2(moduleProperties, moduleProperties[ref]) : Never();
4484
- }
4485
- function FromAwaited(parameters) {
4486
- return Awaited(parameters[0]);
4487
- }
4488
- function FromIndex(parameters) {
4489
- return Index(parameters[0], parameters[1]);
4490
- }
4491
- function FromKeyOf(parameters) {
4492
- return KeyOf(parameters[0]);
4493
- }
4494
- function FromPartial(parameters) {
4495
- return Partial(parameters[0]);
4496
- }
4497
- function FromOmit(parameters) {
4498
- return Omit(parameters[0], parameters[1]);
4499
- }
4500
- function FromPick(parameters) {
4501
- return Pick(parameters[0], parameters[1]);
4502
- }
4503
- function FromRequired(parameters) {
4504
- return Required(parameters[0]);
4505
- }
4506
- function FromComputed5(moduleProperties, target, parameters) {
4507
- const dereferenced = DereferenceParameters(moduleProperties, parameters);
4508
- return target === "Awaited" ? FromAwaited(dereferenced) : target === "Index" ? FromIndex(dereferenced) : target === "KeyOf" ? FromKeyOf(dereferenced) : target === "Partial" ? FromPartial(dereferenced) : target === "Omit" ? FromOmit(dereferenced) : target === "Pick" ? FromPick(dereferenced) : target === "Required" ? FromRequired(dereferenced) : Never();
4509
- }
4510
- function FromArray6(moduleProperties, type) {
4511
- return Array2(FromType2(moduleProperties, type));
4512
- }
4513
- function FromAsyncIterator3(moduleProperties, type) {
4514
- return AsyncIterator(FromType2(moduleProperties, type));
4515
- }
4516
- function FromConstructor3(moduleProperties, parameters, instanceType) {
4517
- return Constructor(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, instanceType));
4518
- }
4519
- function FromFunction3(moduleProperties, parameters, returnType) {
4520
- return Function(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, returnType));
4521
- }
4522
- function FromIntersect8(moduleProperties, types) {
4523
- return Intersect(FromTypes2(moduleProperties, types));
4524
- }
4525
- function FromIterator3(moduleProperties, type) {
4526
- return Iterator(FromType2(moduleProperties, type));
4527
- }
4528
- function FromObject7(moduleProperties, properties) {
4529
- return Object2(globalThis.Object.keys(properties).reduce((result, key) => {
4530
- return { ...result, [key]: FromType2(moduleProperties, properties[key]) };
4531
- }, {}));
4532
- }
4533
- function FromRecord3(moduleProperties, type) {
4534
- const [value, pattern] = [FromType2(moduleProperties, RecordValue2(type)), RecordPattern(type)];
4535
- const result = CloneType(type);
4536
- result.patternProperties[pattern] = value;
4537
- return result;
4538
- }
4539
- function FromTransform(moduleProperties, transform) {
4540
- return IsRef(transform) ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } : transform;
4541
- }
4542
- function FromTuple5(moduleProperties, types) {
4543
- return Tuple(FromTypes2(moduleProperties, types));
4544
- }
4545
- function FromUnion10(moduleProperties, types) {
4546
- return Union(FromTypes2(moduleProperties, types));
4547
- }
4548
- function FromTypes2(moduleProperties, types) {
4549
- return types.map((type) => FromType2(moduleProperties, type));
4550
- }
4551
- function FromType2(moduleProperties, type) {
4552
- return (
4553
- // Modifiers
4554
- IsOptional(type) ? CreateType(FromType2(moduleProperties, Discard(type, [OptionalKind])), type) : IsReadonly(type) ? CreateType(FromType2(moduleProperties, Discard(type, [ReadonlyKind])), type) : (
4555
- // Transform
4556
- IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : (
4557
- // Types
4558
- IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator2(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction2(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator2(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject3(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type
4559
- )
4560
- )
4561
- );
1575
+ "nodejs.org",
1576
+ "typescriptlang.org",
1577
+ "hono.dev",
1578
+ "sqlite.org"
1579
+ ];
1580
+ function normalizeFetchHostname(hostname2) {
1581
+ const lower = hostname2.toLowerCase();
1582
+ return lower.startsWith("www.") ? lower.slice(4) : lower;
4562
1583
  }
4563
- function ComputeType(moduleProperties, key) {
4564
- return key in moduleProperties ? FromType2(moduleProperties, moduleProperties[key]) : Never();
1584
+ function isPreapprovedFetchDomain(hostname2) {
1585
+ const normalized = normalizeFetchHostname(hostname2);
1586
+ return WEB_FETCH_PREAPPROVED_DOMAINS.some((domain) => normalizeFetchHostname(domain) === normalized);
4565
1587
  }
4566
- function ComputeModuleProperties(moduleProperties) {
4567
- return globalThis.Object.getOwnPropertyNames(moduleProperties).reduce((result, key) => {
4568
- return { ...result, [key]: ComputeType(moduleProperties, key) };
4569
- }, {});
1588
+ function isSameFetchHost(a, b) {
1589
+ return normalizeFetchHostname(a) === normalizeFetchHostname(b);
4570
1590
  }
4571
1591
 
4572
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs
4573
- var TModule = class {
4574
- constructor($defs) {
4575
- const computed = ComputeModuleProperties($defs);
4576
- const identified = this.WithIdentifiers(computed);
4577
- this.$defs = identified;
1592
+ // ../shared/dist/explorer-media.js
1593
+ var EXPLORER_IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
1594
+ "png",
1595
+ "jpg",
1596
+ "jpeg",
1597
+ "gif",
1598
+ "webp",
1599
+ "svg",
1600
+ "ico",
1601
+ "bmp",
1602
+ "tiff",
1603
+ "tif"
1604
+ ]);
1605
+ var EXPLORER_VIDEO_EXTENSIONS = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi"]);
1606
+ var EXPLORER_MEDIA_MIME_TYPES = {
1607
+ png: "image/png",
1608
+ jpg: "image/jpeg",
1609
+ jpeg: "image/jpeg",
1610
+ gif: "image/gif",
1611
+ webp: "image/webp",
1612
+ svg: "image/svg+xml",
1613
+ ico: "image/x-icon",
1614
+ bmp: "image/bmp",
1615
+ tiff: "image/tiff",
1616
+ tif: "image/tiff",
1617
+ mp4: "video/mp4",
1618
+ webm: "video/webm",
1619
+ mov: "video/quicktime",
1620
+ avi: "video/x-msvideo"
1621
+ };
1622
+ function getFileExtension(filename) {
1623
+ const trimmed = filename.trim();
1624
+ const basename5 = trimmed.split(/[/\\]/).pop() ?? trimmed;
1625
+ const dotIndex = basename5.lastIndexOf(".");
1626
+ if (dotIndex <= 0 || dotIndex === basename5.length - 1) {
1627
+ return "";
4578
1628
  }
4579
- /** `[Json]` Imports a Type by Key. */
4580
- Import(key, options) {
4581
- const $defs = { ...this.$defs, [key]: CreateType(this.$defs[key], options) };
4582
- return CreateType({ [Kind]: "Import", $defs, $ref: key });
1629
+ return basename5.slice(dotIndex + 1).toLowerCase();
1630
+ }
1631
+ function getExplorerFileMediaType(path7, name) {
1632
+ const ext = getFileExtension(path7) || (name ? getFileExtension(name) : "");
1633
+ if (!ext) {
1634
+ return null;
4583
1635
  }
4584
- // prettier-ignore
4585
- WithIdentifiers($defs) {
4586
- return globalThis.Object.getOwnPropertyNames($defs).reduce((result, key) => {
4587
- return { ...result, [key]: { ...$defs[key], $id: key } };
4588
- }, {});
1636
+ if (EXPLORER_IMAGE_EXTENSIONS.has(ext)) {
1637
+ return "image";
4589
1638
  }
4590
- };
4591
- function Module(properties) {
4592
- return new TModule(properties);
4593
- }
4594
-
4595
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
4596
- function Not(type, options) {
4597
- return CreateType({ [Kind]: "Not", not: type }, options);
4598
- }
4599
-
4600
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
4601
- function Parameters(schema, options) {
4602
- return IsFunction2(schema) ? Tuple(schema.parameters, options) : Never();
1639
+ if (EXPLORER_VIDEO_EXTENSIONS.has(ext)) {
1640
+ return "video";
1641
+ }
1642
+ return null;
4603
1643
  }
4604
1644
 
4605
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
4606
- var Ordinal = 0;
4607
- function Recursive(callback, options = {}) {
4608
- if (IsUndefined(options.$id))
4609
- options.$id = `T${Ordinal++}`;
4610
- const thisType = CloneType(callback({ [Kind]: "This", $ref: `${options.$id}` }));
4611
- thisType.$id = options.$id;
4612
- return CreateType({ [Hint]: "Recursive", ...thisType }, options);
4613
- }
1645
+ // src/server.ts
1646
+ import fs3 from "fs";
1647
+ import { Hono as Hono26 } from "hono";
1648
+ import { cors } from "hono/cors";
1649
+ import open3 from "open";
1650
+ import path5 from "path";
1651
+ import { fileURLToPath as fileURLToPath2 } from "url";
4614
1652
 
4615
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
4616
- function RegExp2(unresolved, options) {
4617
- const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
4618
- return CreateType({ [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags }, options);
4619
- }
1653
+ // src/agent/agent.executor.ts
1654
+ import { Agent as Agent2 } from "@earendil-works/pi-agent-core";
1655
+ import { streamSimple } from "@earendil-works/pi-ai";
1656
+ import { resolve as resolve3, isAbsolute as isAbsolute3 } from "path";
4620
1657
 
4621
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
4622
- function RestResolve(T) {
4623
- return IsIntersect(T) ? T.allOf : IsUnion(T) ? T.anyOf : IsTuple(T) ? T.items ?? [] : [];
4624
- }
4625
- function Rest(T) {
4626
- return RestResolve(T);
1658
+ // src/features/mcp/mcp.status.ts
1659
+ function formatMcpStatusForChat(line, options) {
1660
+ const text = options?.includeLabel ? `[MCP] ${line}` : line;
1661
+ return `${text}
1662
+ `;
4627
1663
  }
4628
-
4629
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
4630
- function ReturnType(schema, options) {
4631
- return IsFunction2(schema) ? CreateType(schema.returns, options) : Never(options);
1664
+ function createMcpThinkingEvent(content) {
1665
+ return { type: "thinking", content };
4632
1666
  }
4633
1667
 
4634
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
4635
- var TransformDecodeBuilder = class {
4636
- constructor(schema) {
4637
- this.schema = schema;
4638
- }
4639
- Decode(decode) {
4640
- return new TransformEncodeBuilder(this.schema, decode);
4641
- }
4642
- };
4643
- var TransformEncodeBuilder = class {
4644
- constructor(schema, decode) {
4645
- this.schema = schema;
4646
- this.decode = decode;
4647
- }
4648
- EncodeTransform(encode, schema) {
4649
- const Encode = (value) => schema[TransformKind].Encode(encode(value));
4650
- const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
4651
- const Codec = { Encode, Decode };
4652
- return { ...schema, [TransformKind]: Codec };
4653
- }
4654
- EncodeSchema(encode, schema) {
4655
- const Codec = { Decode: this.decode, Encode: encode };
4656
- return { ...schema, [TransformKind]: Codec };
4657
- }
4658
- Encode(encode) {
4659
- return IsTransform(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema);
4660
- }
4661
- };
4662
- function Transform(schema) {
4663
- return new TransformDecodeBuilder(schema);
4664
- }
4665
-
4666
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
4667
- function Unsafe(options = {}) {
4668
- return CreateType({ [Kind]: options[Kind] ?? "Unsafe" }, options);
4669
- }
4670
-
4671
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
4672
- function Void(options) {
4673
- return CreateType({ [Kind]: "Void", type: "void" }, options);
4674
- }
4675
-
4676
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
4677
- var type_exports2 = {};
4678
- __export(type_exports2, {
4679
- Any: () => Any,
4680
- Argument: () => Argument,
4681
- Array: () => Array2,
4682
- AsyncIterator: () => AsyncIterator,
4683
- Awaited: () => Awaited,
4684
- BigInt: () => BigInt,
4685
- Boolean: () => Boolean2,
4686
- Capitalize: () => Capitalize,
4687
- Composite: () => Composite,
4688
- Const: () => Const,
4689
- Constructor: () => Constructor,
4690
- ConstructorParameters: () => ConstructorParameters,
4691
- Date: () => Date2,
4692
- Enum: () => Enum,
4693
- Exclude: () => Exclude,
4694
- Extends: () => Extends,
4695
- Extract: () => Extract,
4696
- Function: () => Function,
4697
- Index: () => Index,
4698
- InstanceType: () => InstanceType,
4699
- Instantiate: () => Instantiate,
4700
- Integer: () => Integer,
4701
- Intersect: () => Intersect,
4702
- Iterator: () => Iterator,
4703
- KeyOf: () => KeyOf,
4704
- Literal: () => Literal,
4705
- Lowercase: () => Lowercase,
4706
- Mapped: () => Mapped,
4707
- Module: () => Module,
4708
- Never: () => Never,
4709
- Not: () => Not,
4710
- Null: () => Null,
4711
- Number: () => Number2,
4712
- Object: () => Object2,
4713
- Omit: () => Omit,
4714
- Optional: () => Optional,
4715
- Parameters: () => Parameters,
4716
- Partial: () => Partial,
4717
- Pick: () => Pick,
4718
- Promise: () => Promise2,
4719
- Readonly: () => Readonly,
4720
- ReadonlyOptional: () => ReadonlyOptional,
4721
- Record: () => Record,
4722
- Recursive: () => Recursive,
4723
- Ref: () => Ref,
4724
- RegExp: () => RegExp2,
4725
- Required: () => Required,
4726
- Rest: () => Rest,
4727
- ReturnType: () => ReturnType,
4728
- String: () => String2,
4729
- Symbol: () => Symbol2,
4730
- TemplateLiteral: () => TemplateLiteral,
4731
- Transform: () => Transform,
4732
- Tuple: () => Tuple,
4733
- Uint8Array: () => Uint8Array2,
4734
- Uncapitalize: () => Uncapitalize,
4735
- Undefined: () => Undefined,
4736
- Union: () => Union,
4737
- Unknown: () => Unknown,
4738
- Unsafe: () => Unsafe,
4739
- Uppercase: () => Uppercase,
4740
- Void: () => Void
4741
- });
4742
-
4743
- // ../node_modules/.bun/@sinclair+typebox@0.34.49/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
4744
- var Type = type_exports2;
4745
-
4746
1668
  // src/tools/bash.ts
4747
1669
  init_tarsk_debug();
4748
1670
  init_utils();
1671
+ import { randomBytes as randomBytes2 } from "node:crypto";
1672
+ import { createWriteStream, existsSync as existsSync3 } from "node:fs";
1673
+ import { tmpdir } from "node:os";
1674
+ import { join as join3 } from "node:path";
1675
+ import { Type } from "@sinclair/typebox";
4749
1676
 
4750
1677
  // src/tools/shell.ts
4751
1678
  init_utils();
@@ -5697,260 +2624,12 @@ Command timed out after ${secs} seconds` : `Command timed out after ${secs} seco
5697
2624
  var bashTool = createBashTool(process.cwd());
5698
2625
 
5699
2626
  // src/tools/edit.ts
2627
+ import { Type as Type2 } from "@sinclair/typebox";
5700
2628
  import { constants as constants2 } from "fs";
5701
2629
  import { access as fsAccess, readFile as fsReadFile, writeFile as fsWriteFile } from "fs/promises";
5702
2630
 
5703
- // ../node_modules/.bun/diff@8.0.4/node_modules/diff/libesm/diff/base.js
5704
- var Diff = class {
5705
- diff(oldStr, newStr, options = {}) {
5706
- let callback;
5707
- if (typeof options === "function") {
5708
- callback = options;
5709
- options = {};
5710
- } else if ("callback" in options) {
5711
- callback = options.callback;
5712
- }
5713
- const oldString = this.castInput(oldStr, options);
5714
- const newString = this.castInput(newStr, options);
5715
- const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
5716
- const newTokens = this.removeEmpty(this.tokenize(newString, options));
5717
- return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
5718
- }
5719
- diffWithOptionsObj(oldTokens, newTokens, options, callback) {
5720
- var _a;
5721
- const done = (value) => {
5722
- value = this.postProcess(value, options);
5723
- if (callback) {
5724
- setTimeout(function() {
5725
- callback(value);
5726
- }, 0);
5727
- return void 0;
5728
- } else {
5729
- return value;
5730
- }
5731
- };
5732
- const newLen = newTokens.length, oldLen = oldTokens.length;
5733
- let editLength = 1;
5734
- let maxEditLength = newLen + oldLen;
5735
- if (options.maxEditLength != null) {
5736
- maxEditLength = Math.min(maxEditLength, options.maxEditLength);
5737
- }
5738
- const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
5739
- const abortAfterTimestamp = Date.now() + maxExecutionTime;
5740
- const bestPath = [{ oldPos: -1, lastComponent: void 0 }];
5741
- let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
5742
- if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
5743
- return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
5744
- }
5745
- let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
5746
- const execEditLength = () => {
5747
- for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
5748
- let basePath;
5749
- const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
5750
- if (removePath) {
5751
- bestPath[diagonalPath - 1] = void 0;
5752
- }
5753
- let canAdd = false;
5754
- if (addPath) {
5755
- const addPathNewPos = addPath.oldPos - diagonalPath;
5756
- canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
5757
- }
5758
- const canRemove = removePath && removePath.oldPos + 1 < oldLen;
5759
- if (!canAdd && !canRemove) {
5760
- bestPath[diagonalPath] = void 0;
5761
- continue;
5762
- }
5763
- if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
5764
- basePath = this.addToPath(addPath, true, false, 0, options);
5765
- } else {
5766
- basePath = this.addToPath(removePath, false, true, 1, options);
5767
- }
5768
- newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
5769
- if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
5770
- return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
5771
- } else {
5772
- bestPath[diagonalPath] = basePath;
5773
- if (basePath.oldPos + 1 >= oldLen) {
5774
- maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
5775
- }
5776
- if (newPos + 1 >= newLen) {
5777
- minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
5778
- }
5779
- }
5780
- }
5781
- editLength++;
5782
- };
5783
- if (callback) {
5784
- (function exec() {
5785
- setTimeout(function() {
5786
- if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
5787
- return callback(void 0);
5788
- }
5789
- if (!execEditLength()) {
5790
- exec();
5791
- }
5792
- }, 0);
5793
- })();
5794
- } else {
5795
- while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
5796
- const ret = execEditLength();
5797
- if (ret) {
5798
- return ret;
5799
- }
5800
- }
5801
- }
5802
- }
5803
- addToPath(path7, added, removed, oldPosInc, options) {
5804
- const last = path7.lastComponent;
5805
- if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
5806
- return {
5807
- oldPos: path7.oldPos + oldPosInc,
5808
- lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
5809
- };
5810
- } else {
5811
- return {
5812
- oldPos: path7.oldPos + oldPosInc,
5813
- lastComponent: { count: 1, added, removed, previousComponent: last }
5814
- };
5815
- }
5816
- }
5817
- extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
5818
- const newLen = newTokens.length, oldLen = oldTokens.length;
5819
- let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
5820
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
5821
- newPos++;
5822
- oldPos++;
5823
- commonCount++;
5824
- if (options.oneChangePerToken) {
5825
- basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
5826
- }
5827
- }
5828
- if (commonCount && !options.oneChangePerToken) {
5829
- basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
5830
- }
5831
- basePath.oldPos = oldPos;
5832
- return newPos;
5833
- }
5834
- equals(left, right, options) {
5835
- if (options.comparator) {
5836
- return options.comparator(left, right);
5837
- } else {
5838
- return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
5839
- }
5840
- }
5841
- removeEmpty(array) {
5842
- const ret = [];
5843
- for (let i = 0; i < array.length; i++) {
5844
- if (array[i]) {
5845
- ret.push(array[i]);
5846
- }
5847
- }
5848
- return ret;
5849
- }
5850
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5851
- castInput(value, options) {
5852
- return value;
5853
- }
5854
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5855
- tokenize(value, options) {
5856
- return Array.from(value);
5857
- }
5858
- join(chars) {
5859
- return chars.join("");
5860
- }
5861
- postProcess(changeObjects, options) {
5862
- return changeObjects;
5863
- }
5864
- get useLongestToken() {
5865
- return false;
5866
- }
5867
- buildValues(lastComponent, newTokens, oldTokens) {
5868
- const components = [];
5869
- let nextComponent;
5870
- while (lastComponent) {
5871
- components.push(lastComponent);
5872
- nextComponent = lastComponent.previousComponent;
5873
- delete lastComponent.previousComponent;
5874
- lastComponent = nextComponent;
5875
- }
5876
- components.reverse();
5877
- const componentLen = components.length;
5878
- let componentPos = 0, newPos = 0, oldPos = 0;
5879
- for (; componentPos < componentLen; componentPos++) {
5880
- const component = components[componentPos];
5881
- if (!component.removed) {
5882
- if (!component.added && this.useLongestToken) {
5883
- let value = newTokens.slice(newPos, newPos + component.count);
5884
- value = value.map(function(value2, i) {
5885
- const oldValue = oldTokens[oldPos + i];
5886
- return oldValue.length > value2.length ? oldValue : value2;
5887
- });
5888
- component.value = this.join(value);
5889
- } else {
5890
- component.value = this.join(newTokens.slice(newPos, newPos + component.count));
5891
- }
5892
- newPos += component.count;
5893
- if (!component.added) {
5894
- oldPos += component.count;
5895
- }
5896
- } else {
5897
- component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
5898
- oldPos += component.count;
5899
- }
5900
- }
5901
- return components;
5902
- }
5903
- };
5904
-
5905
- // ../node_modules/.bun/diff@8.0.4/node_modules/diff/libesm/diff/line.js
5906
- var LineDiff = class extends Diff {
5907
- constructor() {
5908
- super(...arguments);
5909
- this.tokenize = tokenize;
5910
- }
5911
- equals(left, right, options) {
5912
- if (options.ignoreWhitespace) {
5913
- if (!options.newlineIsToken || !left.includes("\n")) {
5914
- left = left.trim();
5915
- }
5916
- if (!options.newlineIsToken || !right.includes("\n")) {
5917
- right = right.trim();
5918
- }
5919
- } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
5920
- if (left.endsWith("\n")) {
5921
- left = left.slice(0, -1);
5922
- }
5923
- if (right.endsWith("\n")) {
5924
- right = right.slice(0, -1);
5925
- }
5926
- }
5927
- return super.equals(left, right, options);
5928
- }
5929
- };
5930
- var lineDiff = new LineDiff();
5931
- function diffLines(oldStr, newStr, options) {
5932
- return lineDiff.diff(oldStr, newStr, options);
5933
- }
5934
- function tokenize(value, options) {
5935
- if (options.stripTrailingCr) {
5936
- value = value.replace(/\r\n/g, "\n");
5937
- }
5938
- const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
5939
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
5940
- linesAndNewlines.pop();
5941
- }
5942
- for (let i = 0; i < linesAndNewlines.length; i++) {
5943
- const line = linesAndNewlines[i];
5944
- if (i % 2 && !options.newlineIsToken) {
5945
- retLines[retLines.length - 1] += line;
5946
- } else {
5947
- retLines.push(line);
5948
- }
5949
- }
5950
- return retLines;
5951
- }
5952
-
5953
2631
  // src/tools/edit-diff.ts
2632
+ import * as Diff from "diff";
5954
2633
  function detectLineEnding(content) {
5955
2634
  const crlfIdx = content.indexOf("\r\n");
5956
2635
  const lfIdx = content.indexOf("\n");
@@ -6002,7 +2681,7 @@ function stripBom(content) {
6002
2681
  return content.startsWith("\uFEFF") ? { bom: "\uFEFF", text: content.slice(1) } : { bom: "", text: content };
6003
2682
  }
6004
2683
  function generateDiffString(oldContent, newContent, contextLines = 4) {
6005
- const parts = diffLines(oldContent, newContent);
2684
+ const parts = Diff.diffLines(oldContent, newContent);
6006
2685
  const output = [];
6007
2686
  const oldLines = oldContent.split("\n");
6008
2687
  const newLines = newContent.split("\n");
@@ -6099,10 +2778,10 @@ async function withAbortSignal(signal, operation) {
6099
2778
  }
6100
2779
 
6101
2780
  // src/tools/edit.ts
6102
- var editSchema = Type.Object({
6103
- path: Type.String({ description: "Path to the file to edit (relative or absolute)" }),
6104
- oldText: Type.String({ description: "Exact text to find and replace (must match exactly)" }),
6105
- newText: Type.String({ description: "New text to replace the old text with" })
2781
+ var editSchema = Type2.Object({
2782
+ path: Type2.String({ description: "Path to the file to edit (relative or absolute)" }),
2783
+ oldText: Type2.String({ description: "Exact text to find and replace (must match exactly)" }),
2784
+ newText: Type2.String({ description: "New text to replace the old text with" })
6106
2785
  });
6107
2786
  var defaultEditOperations = {
6108
2787
  readFile: (path7) => fsReadFile(path7),
@@ -6171,18 +2850,19 @@ function createEditTool(cwd, options) {
6171
2850
  var editTool = createEditTool(process.cwd());
6172
2851
 
6173
2852
  // src/tools/find.ts
2853
+ import { Type as Type3 } from "@sinclair/typebox";
6174
2854
  import { existsSync as existsSync4 } from "fs";
6175
2855
  import os2 from "node:os";
6176
2856
  import path from "path";
6177
2857
  import { globSync } from "glob";
6178
- var findSchema = Type.Object({
6179
- pattern: Type.String({
2858
+ var findSchema = Type3.Object({
2859
+ pattern: Type3.String({
6180
2860
  description: "Glob pattern to match files, e.g. '*.ts', '**/*.json', or 'src/**/*.spec.ts'"
6181
2861
  }),
6182
- path: Type.Optional(
6183
- Type.String({ description: "Directory to search in (default: current directory)" })
2862
+ path: Type3.Optional(
2863
+ Type3.String({ description: "Directory to search in (default: current directory)" })
6184
2864
  ),
6185
- limit: Type.Optional(Type.Number({ description: "Maximum number of results (default: 1000)" }))
2865
+ limit: Type3.Optional(Type3.Number({ description: "Maximum number of results (default: 1000)" }))
6186
2866
  });
6187
2867
  var DEFAULT_LIMIT = 1e3;
6188
2868
  var defaultFindOperations = {
@@ -6292,8 +2972,9 @@ function createFindTool(cwd, options) {
6292
2972
  var findTool = createFindTool(process.cwd());
6293
2973
 
6294
2974
  // src/tools/grep.ts
6295
- import { createInterface } from "node:readline";
6296
2975
  init_utils();
2976
+ import { createInterface } from "node:readline";
2977
+ import { Type as Type4 } from "@sinclair/typebox";
6297
2978
  import { readFileSync, statSync } from "fs";
6298
2979
  import path2 from "path";
6299
2980
 
@@ -6319,25 +3000,25 @@ function resolveBin(name) {
6319
3000
  }
6320
3001
 
6321
3002
  // src/tools/grep.ts
6322
- var grepSchema = Type.Object({
6323
- pattern: Type.String({ description: "Search pattern (regex or literal string)" }),
6324
- path: Type.Optional(
6325
- Type.String({ description: "Directory or file to search (default: current directory)" })
3003
+ var grepSchema = Type4.Object({
3004
+ pattern: Type4.String({ description: "Search pattern (regex or literal string)" }),
3005
+ path: Type4.Optional(
3006
+ Type4.String({ description: "Directory or file to search (default: current directory)" })
6326
3007
  ),
6327
- glob: Type.Optional(Type.String({ description: "Filter files by glob pattern, e.g. '*.ts'" })),
6328
- ignoreCase: Type.Optional(
6329
- Type.Boolean({ description: "Case-insensitive search (default: false)" })
3008
+ glob: Type4.Optional(Type4.String({ description: "Filter files by glob pattern, e.g. '*.ts'" })),
3009
+ ignoreCase: Type4.Optional(
3010
+ Type4.Boolean({ description: "Case-insensitive search (default: false)" })
6330
3011
  ),
6331
- literal: Type.Optional(
6332
- Type.Boolean({
3012
+ literal: Type4.Optional(
3013
+ Type4.Boolean({
6333
3014
  description: "Treat pattern as literal string instead of regex (default: false)"
6334
3015
  })
6335
3016
  ),
6336
- context: Type.Optional(
6337
- Type.Number({ description: "Number of lines before/after each match (default: 0)" })
3017
+ context: Type4.Optional(
3018
+ Type4.Number({ description: "Number of lines before/after each match (default: 0)" })
6338
3019
  ),
6339
- limit: Type.Optional(
6340
- Type.Number({ description: "Maximum number of matches to return (default: 100)" })
3020
+ limit: Type4.Optional(
3021
+ Type4.Number({ description: "Maximum number of matches to return (default: 100)" })
6341
3022
  )
6342
3023
  });
6343
3024
  var DEFAULT_LIMIT2 = 100;
@@ -6555,80 +3236,81 @@ function createSimpleGrepTool(cwd, options) {
6555
3236
  var simpleGrepTool = createSimpleGrepTool(process.cwd());
6556
3237
 
6557
3238
  // src/tools/rip-grep.ts
3239
+ import { Type as Type5 } from "@sinclair/typebox";
6558
3240
  import { statSync as statSync2 } from "node:fs";
6559
3241
  import path3 from "node:path";
6560
3242
  import { ripgrep } from "ripgrep";
6561
3243
  var VCS_DIRECTORIES_TO_EXCLUDE = [".git", ".svn", ".hg", ".bzr", ".jj", ".sl"];
6562
3244
  var DEFAULT_HEAD_LIMIT = 250;
6563
- var ripGrepSchema = Type.Object({
6564
- pattern: Type.String({
3245
+ var ripGrepSchema = Type5.Object({
3246
+ pattern: Type5.String({
6565
3247
  description: "The regular expression pattern to search for in file contents"
6566
3248
  }),
6567
- path: Type.Optional(
6568
- Type.String({
3249
+ path: Type5.Optional(
3250
+ Type5.String({
6569
3251
  description: "File or directory to search in (rg PATH). Defaults to current working directory."
6570
3252
  })
6571
3253
  ),
6572
- glob: Type.Optional(
6573
- Type.String({
3254
+ glob: Type5.Optional(
3255
+ Type5.String({
6574
3256
  description: 'Glob pattern to filter files (e.g. "*.js", "*.{ts,tsx}") - maps to rg --glob'
6575
3257
  })
6576
3258
  ),
6577
- output_mode: Type.Optional(
6578
- Type.Union(
6579
- [Type.Literal("content"), Type.Literal("files_with_matches"), Type.Literal("count")],
3259
+ output_mode: Type5.Optional(
3260
+ Type5.Union(
3261
+ [Type5.Literal("content"), Type5.Literal("files_with_matches"), Type5.Literal("count")],
6580
3262
  {
6581
3263
  description: 'Output mode: "content" shows matching lines (supports -A/-B/-C context, -n line numbers, head_limit), "files_with_matches" shows file paths (supports head_limit), "count" shows match counts (supports head_limit). Defaults to "content".'
6582
3264
  }
6583
3265
  )
6584
3266
  ),
6585
- "-B": Type.Optional(
6586
- Type.Number({
3267
+ "-B": Type5.Optional(
3268
+ Type5.Number({
6587
3269
  description: 'Number of lines to show before each match (rg -B). Requires output_mode: "content", ignored otherwise.'
6588
3270
  })
6589
3271
  ),
6590
- "-A": Type.Optional(
6591
- Type.Number({
3272
+ "-A": Type5.Optional(
3273
+ Type5.Number({
6592
3274
  description: 'Number of lines to show after each match (rg -A). Requires output_mode: "content", ignored otherwise.'
6593
3275
  })
6594
3276
  ),
6595
- "-C": Type.Optional(
6596
- Type.Number({
3277
+ "-C": Type5.Optional(
3278
+ Type5.Number({
6597
3279
  description: "Alias for context. Requires output_mode: content."
6598
3280
  })
6599
3281
  ),
6600
- context: Type.Optional(
6601
- Type.Number({
3282
+ context: Type5.Optional(
3283
+ Type5.Number({
6602
3284
  description: 'Number of lines to show before and after each match (rg -C). Requires output_mode: "content", ignored otherwise.'
6603
3285
  })
6604
3286
  ),
6605
- "-n": Type.Optional(
6606
- Type.Boolean({
3287
+ "-n": Type5.Optional(
3288
+ Type5.Boolean({
6607
3289
  description: 'Show line numbers in output (rg -n). Requires output_mode: "content", ignored otherwise. Defaults to true.'
6608
3290
  })
6609
3291
  ),
6610
- "-i": Type.Optional(
6611
- Type.Boolean({
3292
+ "-i": Type5.Optional(
3293
+ Type5.Boolean({
6612
3294
  description: "Case insensitive search (rg -i)"
6613
3295
  })
6614
3296
  ),
6615
- type: Type.Optional(
6616
- Type.String({
3297
+ type: Type5.Optional(
3298
+ Type5.String({
6617
3299
  description: "File type to search (rg --type). Common types: js, py, rust, go, java, etc. More efficient than include for standard file types."
6618
3300
  })
6619
3301
  ),
6620
- head_limit: Type.Optional(
6621
- Type.Number({
3302
+ head_limit: Type5.Optional(
3303
+ Type5.Number({
6622
3304
  description: 'Limit output to first N lines/entries, equivalent to "| head -N". Works across all output modes. Defaults to 250 when unspecified. Pass 0 for unlimited.'
6623
3305
  })
6624
3306
  ),
6625
- offset: Type.Optional(
6626
- Type.Number({
3307
+ offset: Type5.Optional(
3308
+ Type5.Number({
6627
3309
  description: 'Skip first N lines/entries before applying head_limit, equivalent to "| tail -n +N | head -N". Works across all output modes. Defaults to 0.'
6628
3310
  })
6629
3311
  ),
6630
- multiline: Type.Optional(
6631
- Type.Boolean({
3312
+ multiline: Type5.Optional(
3313
+ Type5.Boolean({
6632
3314
  description: "Enable multiline mode where . matches newlines and patterns can span lines (rg -U --multiline-dotall). Default: false."
6633
3315
  })
6634
3316
  )
@@ -6922,14 +3604,15 @@ var ripGrepTool = createRipGrepTool(process.cwd());
6922
3604
 
6923
3605
  // src/tools/code-search.ts
6924
3606
  init_database();
3607
+ import { Type as Type6 } from "@sinclair/typebox";
6925
3608
 
6926
3609
  // src/tools/code-search-indexer.ts
6927
- var import_ignore = __toESM(require_ignore(), 1);
6928
3610
  init_database();
6929
3611
  init_tarsk_debug();
6930
3612
  import { readFileSync as readFileSync2 } from "fs";
6931
3613
  import { readFile, opendir } from "fs/promises";
6932
3614
  import { join as join4, relative as relative2, extname } from "path";
3615
+ import ignore from "ignore";
6933
3616
  var SKIP_DIRS = /* @__PURE__ */ new Set([
6934
3617
  "node_modules",
6935
3618
  ".git",
@@ -6999,7 +3682,7 @@ var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
6999
3682
  var MAX_FILE_SIZE = 512 * 1024;
7000
3683
  var BATCH_SIZE = 50;
7001
3684
  function readGitignore(dirPath) {
7002
- const ig = (0, import_ignore.default)();
3685
+ const ig = ignore();
7003
3686
  try {
7004
3687
  const content = readFileSync2(join4(dirPath, ".gitignore"), "utf8");
7005
3688
  ig.add(content);
@@ -7110,39 +3793,39 @@ async function invalidateThreadIndex(threadId) {
7110
3793
 
7111
3794
  // src/tools/code-search.ts
7112
3795
  var DEFAULT_LIMIT3 = 30;
7113
- var codeSearchSchema = Type.Object({
7114
- query: Type.Optional(
7115
- Type.String({
3796
+ var codeSearchSchema = Type6.Object({
3797
+ query: Type6.Optional(
3798
+ Type6.String({
7116
3799
  description: 'FTS5 full-text search on plain identifier/word tokens (e.g. "validateEmail", "email validation"). Multi-word queries use proximity matching automatically. Supports "quoted phrases", prefix*, and boolean operators (A OR B, A NOT B). Special characters (backslashes, brackets, dots) are stripped \u2014 do NOT put regex patterns here. For regex use `pattern`.'
7117
3800
  })
7118
3801
  ),
7119
- pattern: Type.Optional(
7120
- Type.String({
3802
+ pattern: Type6.Optional(
3803
+ Type6.String({
7121
3804
  description: "JavaScript regex for searching file content, e.g. 'function\\s+\\w+\\s*\\(' or 'class\\s+\\w+Service'. Works standalone (scans all indexed files) or combined with `query` to pre-filter by FTS first. By default matched line by line; set `multiline: true` for cross-line patterns. Case-insensitive unless the pattern contains uppercase letters."
7122
3805
  })
7123
3806
  ),
7124
- filePath: Type.Optional(
7125
- Type.String({
3807
+ filePath: Type6.Optional(
3808
+ Type6.String({
7126
3809
  description: "Search by file path pattern, e.g. 'camp.page.ts', 'src/app/camp', or 'src/**/camp/*.ts'. Supports glob wildcards (* and **). Returns file paths only, no content."
7127
3810
  })
7128
3811
  ),
7129
- fileGlob: Type.Optional(
7130
- Type.String({
3812
+ fileGlob: Type6.Optional(
3813
+ Type6.String({
7131
3814
  description: "Restrict FTS/regex results to files matching this glob, e.g. '*.ts', '**/camp/*.ts'. Applied before the result limit."
7132
3815
  })
7133
3816
  ),
7134
- limit: Type.Optional(
7135
- Type.Number({
3817
+ limit: Type6.Optional(
3818
+ Type6.Number({
7136
3819
  description: `Maximum number of file matches to return (default: ${DEFAULT_LIMIT3})`
7137
3820
  })
7138
3821
  ),
7139
- offset: Type.Optional(
7140
- Type.Number({
3822
+ offset: Type6.Optional(
3823
+ Type6.Number({
7141
3824
  description: "Number of file matches to skip for pagination (default: 0). Use with `limit` to page through results when the match limit or output size is reached."
7142
3825
  })
7143
3826
  ),
7144
- multiline: Type.Optional(
7145
- Type.Boolean({
3827
+ multiline: Type6.Optional(
3828
+ Type6.Boolean({
7146
3829
  description: "When true, apply `pattern` to the full file content rather than line by line, so patterns can span multiple lines. Use `[\\s\\S]` instead of `.` to match newlines within the pattern (e.g. '@Component\\({[\\s\\S]*?templateUrl:' or 'templateUrl:[\\s\\S]*?styleUrl:'). Has no effect without `pattern`."
7147
3830
  })
7148
3831
  )
@@ -7538,14 +4221,15 @@ var codeSearchTool = createCodeSearchTool(
7538
4221
  );
7539
4222
 
7540
4223
  // src/tools/ls.ts
4224
+ import { Type as Type7 } from "@sinclair/typebox";
7541
4225
  import { existsSync as existsSync5, readdirSync as readdirSync2, statSync as statSync3 } from "fs";
7542
4226
  import nodePath from "path";
7543
- var lsSchema = Type.Object({
7544
- path: Type.Optional(
7545
- Type.String({ description: "Directory to list (default: current directory)" })
4227
+ var lsSchema = Type7.Object({
4228
+ path: Type7.Optional(
4229
+ Type7.String({ description: "Directory to list (default: current directory)" })
7546
4230
  ),
7547
- limit: Type.Optional(
7548
- Type.Number({ description: "Maximum number of entries to return (default: 500)" })
4231
+ limit: Type7.Optional(
4232
+ Type7.Number({ description: "Maximum number of entries to return (default: 500)" })
7549
4233
  )
7550
4234
  });
7551
4235
  var DEFAULT_LIMIT4 = 500;
@@ -7650,14 +4334,15 @@ function createLsTool(cwd, options) {
7650
4334
  var lsTool = createLsTool(process.cwd());
7651
4335
 
7652
4336
  // src/tools/read.ts
4337
+ import { Type as Type8 } from "@sinclair/typebox";
7653
4338
  import { constants as constants3 } from "fs";
7654
4339
  import { access as fsAccess2, readFile as fsReadFile2 } from "fs/promises";
7655
- var readSchema = Type.Object({
7656
- path: Type.String({ description: "Path to the file to read (relative or absolute)" }),
7657
- offset: Type.Optional(
7658
- Type.Number({ description: "Line number to start reading from (1-indexed)" })
4340
+ var readSchema = Type8.Object({
4341
+ path: Type8.String({ description: "Path to the file to read (relative or absolute)" }),
4342
+ offset: Type8.Optional(
4343
+ Type8.Number({ description: "Line number to start reading from (1-indexed)" })
7659
4344
  ),
7660
- limit: Type.Optional(Type.Number({ description: "Maximum number of lines to read" }))
4345
+ limit: Type8.Optional(Type8.Number({ description: "Maximum number of lines to read" }))
7661
4346
  });
7662
4347
  var defaultReadOperations = {
7663
4348
  readFile: (path7) => fsReadFile2(path7),
@@ -7735,11 +4420,12 @@ function createReadTool(cwd, options) {
7735
4420
  var readTool = createReadTool(process.cwd());
7736
4421
 
7737
4422
  // src/tools/write.ts
4423
+ import { Type as Type9 } from "@sinclair/typebox";
7738
4424
  import { mkdir as fsMkdir, writeFile as fsWriteFile2 } from "fs/promises";
7739
4425
  import { dirname } from "path";
7740
- var writeSchema = Type.Object({
7741
- path: Type.String({ description: "Path to the file to write (relative or absolute)" }),
7742
- content: Type.String({ description: "Content to write to the file" })
4426
+ var writeSchema = Type9.Object({
4427
+ path: Type9.String({ description: "Path to the file to write (relative or absolute)" }),
4428
+ content: Type9.String({ description: "Content to write to the file" })
7743
4429
  });
7744
4430
  var defaultWriteOperations = {
7745
4431
  writeFile: (path7, content) => fsWriteFile2(path7, content, "utf-8"),
@@ -7795,10 +4481,11 @@ function createWriteTool(cwd, options) {
7795
4481
  var writeTool = createWriteTool(process.cwd());
7796
4482
 
7797
4483
  // src/tools/skill-tool.ts
4484
+ init_utils();
7798
4485
  import { readdir } from "fs/promises";
7799
4486
  import { join as join5, extname as extname2 } from "path";
7800
4487
  import { existsSync as existsSync6, statSync as statSync4 } from "fs";
7801
- init_utils();
4488
+ import { Type as Type10 } from "@sinclair/typebox";
7802
4489
  function getInterpreter(scriptPath) {
7803
4490
  const ext = extname2(scriptPath);
7804
4491
  switch (ext) {
@@ -7863,13 +4550,13 @@ async function executeScript(scriptPath, args2, cwd, timeout = 30) {
7863
4550
  });
7864
4551
  });
7865
4552
  }
7866
- var skillScriptSchema = Type.Object({
7867
- skillName: Type.String({ description: "Name of the skill" }),
7868
- scriptName: Type.String({ description: "Name of the script to execute (without path)" }),
7869
- args: Type.Optional(
7870
- Type.Array(Type.String(), { description: "Arguments to pass to the script" })
4553
+ var skillScriptSchema = Type10.Object({
4554
+ skillName: Type10.String({ description: "Name of the skill" }),
4555
+ scriptName: Type10.String({ description: "Name of the script to execute (without path)" }),
4556
+ args: Type10.Optional(
4557
+ Type10.Array(Type10.String(), { description: "Arguments to pass to the script" })
7871
4558
  ),
7872
- timeout: Type.Optional(Type.Number({ description: "Timeout in seconds (default: 30)" }))
4559
+ timeout: Type10.Optional(Type10.Number({ description: "Timeout in seconds (default: 30)" }))
7873
4560
  });
7874
4561
  function buildSkillScriptCommand(scriptPath, args2) {
7875
4562
  const interpreter = getInterpreter(scriptPath);
@@ -7978,15 +4665,16 @@ ${result.stderr}
7978
4665
  import { readFile as readFile2, readdir as readdir2 } from "fs/promises";
7979
4666
  import { join as join6, normalize, relative as relative3 } from "path";
7980
4667
  import { existsSync as existsSync7 } from "fs";
4668
+ import { Type as Type11 } from "@sinclair/typebox";
7981
4669
  function isPathSafe(basePath, requestedPath) {
7982
4670
  const normalized = normalize(requestedPath);
7983
4671
  const fullPath = join6(basePath, normalized);
7984
4672
  const relativePath = relative3(basePath, fullPath);
7985
4673
  return !relativePath.startsWith("..") && !relativePath.startsWith("/");
7986
4674
  }
7987
- var skillReferenceSchema = Type.Object({
7988
- skillName: Type.String({ description: "Name of the skill" }),
7989
- referencePath: Type.String({
4675
+ var skillReferenceSchema = Type11.Object({
4676
+ skillName: Type11.String({ description: "Name of the skill" }),
4677
+ referencePath: Type11.String({
7990
4678
  description: `Path to the reference file relative to the skill's references/ directory (e.g., "api-reference.md" or "guides/setup.md")`
7991
4679
  })
7992
4680
  });
@@ -8095,17 +4783,18 @@ async function listReferencesRecursive(dir, prefix = "") {
8095
4783
  }
8096
4784
 
8097
4785
  // src/tools/ask-user.ts
8098
- var askUserSchema = Type.Object({
8099
- question: Type.String({
4786
+ import { Type as Type12 } from "@sinclair/typebox";
4787
+ var askUserSchema = Type12.Object({
4788
+ question: Type12.String({
8100
4789
  description: "A clear, specific question to ask the user. Frame it to help clarify ambiguous requirements, confirm decisions, or gather preferences needed to proceed."
8101
4790
  }),
8102
- options: Type.Optional(
8103
- Type.Array(Type.String(), {
4791
+ options: Type12.Optional(
4792
+ Type12.Array(Type12.String(), {
8104
4793
  description: "Optional list of predefined answer choices. The user can pick one or type a custom response. Use when there are a small number of clear alternatives."
8105
4794
  })
8106
4795
  ),
8107
- context: Type.Optional(
8108
- Type.String({
4796
+ context: Type12.Optional(
4797
+ Type12.String({
8109
4798
  description: "Optional brief context explaining why this question is being asked, so the user understands the impact of their answer."
8110
4799
  })
8111
4800
  )
@@ -8161,6 +4850,7 @@ var askUserTool = createAskUserTool();
8161
4850
 
8162
4851
  // src/tools/todo.ts
8163
4852
  init_database();
4853
+ import { Type as Type13 } from "@sinclair/typebox";
8164
4854
 
8165
4855
  // src/features/todos/todos.database.ts
8166
4856
  init_database();
@@ -8251,46 +4941,46 @@ ${learnings}
8251
4941
  }
8252
4942
 
8253
4943
  // src/tools/todo.ts
8254
- var todoSchema = Type.Object({
8255
- action: Type.Union(
4944
+ var todoSchema = Type13.Object({
4945
+ action: Type13.Union(
8256
4946
  [
8257
- Type.Literal("add"),
8258
- Type.Literal("update"),
8259
- Type.Literal("list"),
8260
- Type.Literal("delete"),
8261
- Type.Literal("learnings")
4947
+ Type13.Literal("add"),
4948
+ Type13.Literal("update"),
4949
+ Type13.Literal("list"),
4950
+ Type13.Literal("delete"),
4951
+ Type13.Literal("learnings")
8262
4952
  ],
8263
4953
  {
8264
4954
  description: "Operation to perform: 'add' creates new items, 'update' changes status, 'list' returns all items, 'delete' removes items, 'learnings' appends text to progress.txt for cross-iteration memory."
8265
4955
  }
8266
4956
  ),
8267
- descriptions: Type.Optional(
8268
- Type.Array(Type.String(), {
4957
+ descriptions: Type13.Optional(
4958
+ Type13.Array(Type13.String(), {
8269
4959
  description: "Todo item descriptions. Required for 'add'. Provide one or more descriptions to create multiple items at once."
8270
4960
  })
8271
4961
  ),
8272
- ids: Type.Optional(
8273
- Type.Array(Type.String(), {
4962
+ ids: Type13.Optional(
4963
+ Type13.Array(Type13.String(), {
8274
4964
  description: "Todo item IDs. Required for 'update' and 'delete'. Provide one or more IDs to update or delete multiple items at once."
8275
4965
  })
8276
4966
  ),
8277
- status: Type.Optional(
8278
- Type.Union([Type.Literal("pending"), Type.Literal("working"), Type.Literal("done")], {
4967
+ status: Type13.Optional(
4968
+ Type13.Union([Type13.Literal("pending"), Type13.Literal("working"), Type13.Literal("done")], {
8279
4969
  description: "New status for 'update'. Applied to all specified IDs. 'pending' = not started, 'working' = in progress, 'done' = complete."
8280
4970
  })
8281
4971
  ),
8282
- assignedTo: Type.Optional(
8283
- Type.String({
4972
+ assignedTo: Type13.Optional(
4973
+ Type13.String({
8284
4974
  description: "Who items are assigned to. Defaults to 'agent'. Applied to all specified items."
8285
4975
  })
8286
4976
  ),
8287
- passes: Type.Optional(
8288
- Type.Boolean({
4977
+ passes: Type13.Optional(
4978
+ Type13.Boolean({
8289
4979
  description: "Whether the story's quality checks passed. Used in Ralph mode to mark stories as verified. Set to true when checks pass after implementation."
8290
4980
  })
8291
4981
  ),
8292
- learnings: Type.Optional(
8293
- Type.String({
4982
+ learnings: Type13.Optional(
4983
+ Type13.String({
8294
4984
  description: "Text to append to progress.txt. Required for 'learnings' action. Records patterns, gotchas, and context discovered during implementation."
8295
4985
  })
8296
4986
  )
@@ -9038,6 +5728,7 @@ function clearMCPToolCache(projectPath) {
9038
5728
  }
9039
5729
 
9040
5730
  // src/tools/generate-image.ts
5731
+ import { Type as Type14 } from "@sinclair/typebox";
9041
5732
  import { mkdir as fsMkdir2, writeFile as fsWriteFile3 } from "fs/promises";
9042
5733
  import { dirname as dirname2 } from "path";
9043
5734
 
@@ -9562,14 +6253,14 @@ async function searchImage(query, size, signal) {
9562
6253
  }
9563
6254
 
9564
6255
  // src/tools/generate-image.ts
9565
- var generateImageSchema = Type.Object({
9566
- prompt: Type.String({ description: "Text description of the image to generate" }),
9567
- model: Type.Optional(
9568
- Type.String({
6256
+ var generateImageSchema = Type14.Object({
6257
+ prompt: Type14.String({ description: "Text description of the image to generate" }),
6258
+ model: Type14.Optional(
6259
+ Type14.String({
9569
6260
  description: "Image model name or ID to use (e.g. 'dall-e-3', 'gpt-image-1', 'google/gemini-2.5-flash-image'). If omitted the first enabled image model is used."
9570
6261
  })
9571
6262
  ),
9572
- save_to_file: Type.String({
6263
+ save_to_file: Type14.String({
9573
6264
  description: "File path (relative to the project root) to save the generated image to, e.g. 'assets/logo.png' or 'docs/diagram.png'. The file and any parent directories will be created automatically. The image is also returned as data so it can be displayed."
9574
6265
  })
9575
6266
  });
@@ -9863,29 +6554,30 @@ async function executeGenerateImage(options) {
9863
6554
  }
9864
6555
 
9865
6556
  // src/tools/find-images.ts
6557
+ import { Type as Type15 } from "@sinclair/typebox";
9866
6558
  import { mkdir as fsMkdir3, writeFile as fsWriteFile4 } from "fs/promises";
9867
6559
  import { dirname as dirname3 } from "path";
9868
- var findImagesSchema = Type.Object({
9869
- query: Type.String({ description: "Search term for the image (e.g. 'sunset over mountains')" }),
9870
- size: Type.Optional(
9871
- Type.Union(
6560
+ var findImagesSchema = Type15.Object({
6561
+ query: Type15.String({ description: "Search term for the image (e.g. 'sunset over mountains')" }),
6562
+ size: Type15.Optional(
6563
+ Type15.Union(
9872
6564
  [
9873
- Type.Literal("original"),
9874
- Type.Literal("large2x"),
9875
- Type.Literal("large"),
9876
- Type.Literal("medium"),
9877
- Type.Literal("small"),
9878
- Type.Literal("portrait"),
9879
- Type.Literal("landscape"),
9880
- Type.Literal("tiny")
6565
+ Type15.Literal("original"),
6566
+ Type15.Literal("large2x"),
6567
+ Type15.Literal("large"),
6568
+ Type15.Literal("medium"),
6569
+ Type15.Literal("small"),
6570
+ Type15.Literal("portrait"),
6571
+ Type15.Literal("landscape"),
6572
+ Type15.Literal("tiny")
9881
6573
  ],
9882
6574
  {
9883
6575
  description: "Image size variant: original, large2x, large, medium (default), small, portrait, landscape, tiny"
9884
6576
  }
9885
6577
  )
9886
6578
  ),
9887
- save_to_file: Type.Optional(
9888
- Type.String({
6579
+ save_to_file: Type15.Optional(
6580
+ Type15.String({
9889
6581
  description: "File path relative to the project root to save the image to (e.g. 'assets/hero.jpg'). Parent directories are created automatically. If omitted the image is returned as base64 data only."
9890
6582
  })
9891
6583
  )
@@ -9955,11 +6647,12 @@ function createFindImagesTool(cwd) {
9955
6647
 
9956
6648
  // src/tools/execute-browser-js.ts
9957
6649
  init_tarsk_debug();
9958
- var runWebWorkerSchema = Type.Object({
9959
- intention: Type.String({
6650
+ import { Type as Type16 } from "@sinclair/typebox";
6651
+ var runWebWorkerSchema = Type16.Object({
6652
+ intention: Type16.String({
9960
6653
  description: "A short description of what this code execution is trying to accomplish."
9961
6654
  }),
9962
- code: Type.String({
6655
+ code: Type16.String({
9963
6656
  description: "The javascript code to execute in browser context(not nodejs). The environment provides an async function `callTool(toolName, params)` which allows calling any of the other available tools by name. callTool always returns `{ text: string | null, error: string | null }`. On success `text` contains the result and `error` is null. On failure `error` contains the error message and `text` is null. Example: `const r = await callTool('read', { path: 'foo.ts' }); if (r.error) return r.error; return r.text;`."
9964
6657
  })
9965
6658
  });
@@ -10092,6 +6785,9 @@ function looksLikeMissingReturn(code) {
10092
6785
  }
10093
6786
  var runWebWorkerTool = createRunWebWorkerTool();
10094
6787
 
6788
+ // src/tools/fetch.ts
6789
+ import { Type as Type17 } from "@sinclair/typebox";
6790
+
10095
6791
  // src/features/web-fetch/content-processor.ts
10096
6792
  import { completeSimple as completeSimple2 } from "@earendil-works/pi-ai";
10097
6793
 
@@ -11682,9 +8378,9 @@ function truncateFetchUrl(url, maxLength = 80) {
11682
8378
  }
11683
8379
 
11684
8380
  // src/tools/fetch.ts
11685
- var fetchSchema = Type.Object({
11686
- url: Type.String({ description: "Fully qualified URL to fetch (http or https)" }),
11687
- prompt: Type.String({
8381
+ var fetchSchema = Type17.Object({
8382
+ url: Type17.String({ description: "Fully qualified URL to fetch (http or https)" }),
8383
+ prompt: Type17.String({
11688
8384
  description: "What to extract or summarize from the page content"
11689
8385
  })
11690
8386
  });
@@ -11780,13 +8476,188 @@ function createFetchTool(options) {
11780
8476
  };
11781
8477
  }
11782
8478
 
8479
+ // src/tools/web-search.ts
8480
+ import { Type as Type18 } from "@sinclair/typebox";
8481
+
8482
+ // src/features/web-search/web-search.client.ts
8483
+ var WEB_SEARCH_API = "https://api.webnative.dev/websearch";
8484
+ function clampNumResults(numResults) {
8485
+ if (numResults === void 0) return 10;
8486
+ return Math.min(100, Math.max(1, Math.round(numResults)));
8487
+ }
8488
+ function normalizeResultItem(raw) {
8489
+ const highlights = Array.isArray(raw.highlights) ? raw.highlights.filter((item) => typeof item === "string") : void 0;
8490
+ return {
8491
+ title: typeof raw.title === "string" ? raw.title : "Untitled",
8492
+ url: typeof raw.url === "string" ? raw.url : typeof raw.id === "string" ? raw.id : "",
8493
+ publishedDate: typeof raw.publishedDate === "string" || raw.publishedDate === null ? raw.publishedDate : void 0,
8494
+ author: typeof raw.author === "string" || raw.author === null ? raw.author : void 0,
8495
+ highlights
8496
+ };
8497
+ }
8498
+ function parseSearchErrorMessage(status, body) {
8499
+ try {
8500
+ const parsed = JSON.parse(body);
8501
+ const message = typeof parsed.error === "string" && parsed.error || typeof parsed.message === "string" && parsed.message;
8502
+ if (message) return `Web search failed (${status}): ${message}`;
8503
+ } catch {
8504
+ }
8505
+ return `Web search failed (${status}): ${body || "Unknown error"}`;
8506
+ }
8507
+ async function searchWeb(options) {
8508
+ const payload = {
8509
+ query: options.query,
8510
+ type: options.type ?? "auto",
8511
+ numResults: clampNumResults(options.numResults),
8512
+ contents: {
8513
+ highlights: true
8514
+ }
8515
+ };
8516
+ if (options.includeDomains?.length) {
8517
+ payload.includeDomains = options.includeDomains;
8518
+ }
8519
+ if (options.excludeDomains?.length) {
8520
+ payload.excludeDomains = options.excludeDomains;
8521
+ }
8522
+ const response = await fetch(WEB_SEARCH_API, {
8523
+ method: "POST",
8524
+ headers: {
8525
+ "Content-Type": "application/json"
8526
+ },
8527
+ body: JSON.stringify(payload),
8528
+ signal: options.signal
8529
+ });
8530
+ const body = await response.text();
8531
+ if (!response.ok) {
8532
+ throw new Error(parseSearchErrorMessage(response.status, body));
8533
+ }
8534
+ let parsed;
8535
+ try {
8536
+ parsed = JSON.parse(body);
8537
+ } catch {
8538
+ throw new Error("Web search failed: invalid JSON response");
8539
+ }
8540
+ const rawResults = Array.isArray(parsed.results) ? parsed.results : [];
8541
+ const results = rawResults.filter((item) => item !== null && typeof item === "object").map(normalizeResultItem);
8542
+ return {
8543
+ requestId: typeof parsed.requestId === "string" ? parsed.requestId : void 0,
8544
+ searchType: typeof parsed.searchType === "string" ? parsed.searchType : void 0,
8545
+ results
8546
+ };
8547
+ }
8548
+
8549
+ // src/tools/web-search.ts
8550
+ var searchTypeSchema = Type18.Union([
8551
+ Type18.Literal("auto"),
8552
+ Type18.Literal("fast"),
8553
+ Type18.Literal("instant"),
8554
+ Type18.Literal("deep-lite"),
8555
+ Type18.Literal("deep"),
8556
+ Type18.Literal("deep-reasoning")
8557
+ ]);
8558
+ var webSearchSchema = Type18.Object({
8559
+ query: Type18.String({
8560
+ description: "Natural language search query (e.g. 'Next.js route handler authentication example')"
8561
+ }),
8562
+ numResults: Type18.Optional(
8563
+ Type18.Number({
8564
+ description: "Number of results to return (1-100, default 10)",
8565
+ minimum: 1,
8566
+ maximum: 100
8567
+ })
8568
+ ),
8569
+ type: Type18.Optional(
8570
+ Type18.Union([searchTypeSchema], {
8571
+ description: "Search depth/latency tradeoff. Use auto (default) for most queries; fast/instant for low latency; deep variants for research."
8572
+ })
8573
+ ),
8574
+ includeDomains: Type18.Optional(
8575
+ Type18.Array(Type18.String(), {
8576
+ description: "Only return results from these domains (e.g. ['docs.github.com', 'nodejs.org'])"
8577
+ })
8578
+ ),
8579
+ excludeDomains: Type18.Optional(
8580
+ Type18.Array(Type18.String(), {
8581
+ description: "Exclude results from these domains"
8582
+ })
8583
+ )
8584
+ });
8585
+ function createWebSearchTool() {
8586
+ return {
8587
+ name: "web_search",
8588
+ label: "web_search",
8589
+ description: "Search the web for current information, documentation, API references, and code examples. Returns titles, URLs, and query-relevant highlights for each result. Use fetch to read a specific URL in full after finding it.",
8590
+ parameters: webSearchSchema,
8591
+ execute: async (_toolCallId, { query, numResults, type, includeDomains, excludeDomains }, signal, onUpdate) => {
8592
+ return withAbortSignal(signal, async (isAborted) => {
8593
+ onUpdate?.({
8594
+ content: [{ type: "text", text: `Searching the web for "${query}"\u2026` }],
8595
+ details: void 0
8596
+ });
8597
+ let response;
8598
+ try {
8599
+ response = await searchWeb({
8600
+ query,
8601
+ numResults,
8602
+ type,
8603
+ includeDomains,
8604
+ excludeDomains,
8605
+ signal
8606
+ });
8607
+ } catch (err) {
8608
+ const message = err instanceof Error ? err.message : String(err);
8609
+ return {
8610
+ content: [{ type: "text", text: message }],
8611
+ details: void 0
8612
+ };
8613
+ }
8614
+ if (isAborted()) {
8615
+ return { content: [], details: void 0 };
8616
+ }
8617
+ const payload = {
8618
+ query,
8619
+ searchType: response.searchType ?? type ?? "auto",
8620
+ requestId: response.requestId,
8621
+ resultCount: response.results.length,
8622
+ results: response.results.map((result) => ({
8623
+ title: result.title,
8624
+ url: result.url,
8625
+ publishedDate: result.publishedDate ?? void 0,
8626
+ author: result.author ?? void 0,
8627
+ highlights: result.highlights ?? []
8628
+ }))
8629
+ };
8630
+ const serialized = JSON.stringify(payload, null, 2);
8631
+ const truncated = truncateHead(serialized, { maxLines: 500, maxBytes: 50 * 1024 });
8632
+ let output = truncated.content;
8633
+ if (truncated.truncated) {
8634
+ output += `
8635
+
8636
+ [Output truncated: showing ${truncated.outputLines}/${truncated.totalLines} lines]`;
8637
+ }
8638
+ const details = {
8639
+ query,
8640
+ searchType: payload.searchType,
8641
+ resultCount: payload.resultCount,
8642
+ requestId: response.requestId
8643
+ };
8644
+ return {
8645
+ content: [{ type: "text", text: output }],
8646
+ details
8647
+ };
8648
+ });
8649
+ }
8650
+ };
8651
+ }
8652
+
11783
8653
  // src/tools/tool-search.ts
11784
- var toolSearchSchema = Type.Object({
11785
- query: Type.String({
8654
+ import { Type as Type19 } from "@sinclair/typebox";
8655
+ var toolSearchSchema = Type19.Object({
8656
+ query: Type19.String({
11786
8657
  description: 'Search query to find tools. Use "select:name1,name2" to fetch exact tools by name, or keywords to search by description.'
11787
8658
  }),
11788
- max_results: Type.Optional(
11789
- Type.Number({
8659
+ max_results: Type19.Optional(
8660
+ Type19.Number({
11790
8661
  description: "Maximum number of results to return (default: 5)"
11791
8662
  })
11792
8663
  )
@@ -11965,6 +8836,12 @@ var toolRegistry = [
11965
8836
  displayName: "Find Tools",
11966
8837
  activeDisplayName: "Finding Tools"
11967
8838
  },
8839
+ {
8840
+ name: "web_search",
8841
+ enabled: true,
8842
+ displayName: "Web Search",
8843
+ activeDisplayName: "Searching Web"
8844
+ },
11968
8845
  { name: "write", enabled: true, displayName: "Write", activeDisplayName: "Writing" }
11969
8846
  ];
11970
8847
  var registryByName = new Map(toolRegistry.map((entry) => [entry.name, entry]));
@@ -11988,6 +8865,9 @@ function resolveRegistryEntry(toolName) {
11988
8865
  if (lowerName === "fetch" || lowerName.includes("web_fetch")) {
11989
8866
  return registryByName.get("fetch");
11990
8867
  }
8868
+ if (lowerName === "web_search") {
8869
+ return registryByName.get("web_search");
8870
+ }
11991
8871
  if (lowerName.includes("read")) {
11992
8872
  return registryByName.get("read");
11993
8873
  }
@@ -12249,7 +9129,8 @@ async function createCodingTools(cwd, options) {
12249
9129
  createFetchTool({
12250
9130
  metadataManager: options?.metadataManager,
12251
9131
  webFetchPermissionGate: options?.webFetchPermissionGate
12252
- })
9132
+ }),
9133
+ createWebSearchTool()
12253
9134
  ]);
12254
9135
  if (options?.metadataManager && isToolEnabled("generate_image")) {
12255
9136
  coreTools.push(createGenerateImageTool({ metadataManager: options.metadataManager, cwd }));
@@ -12381,6 +9262,9 @@ async function* loadCodingToolsWithMcpStatus(cwd, options) {
12381
9262
  return result;
12382
9263
  }
12383
9264
 
9265
+ // src/tools/agent-tool.ts
9266
+ import { Type as Type20 } from "@sinclair/typebox";
9267
+
12384
9268
  // src/agent/agent.subagent-executor.ts
12385
9269
  import { Agent } from "@earendil-works/pi-agent-core";
12386
9270
 
@@ -12538,6 +9422,7 @@ var EventQueue = class {
12538
9422
  */
12539
9423
  push(event) {
12540
9424
  this.queue.push(event);
9425
+ this.notify();
12541
9426
  }
12542
9427
  /**
12543
9428
  * Removes and returns the next event from the queue
@@ -12728,15 +9613,15 @@ async function executeSubagent(options) {
12728
9613
  }
12729
9614
 
12730
9615
  // src/tools/agent-tool.ts
12731
- var agentToolSchema = Type.Object({
12732
- prompt: Type.String({ description: "The task or question for the subagent to work on" }),
12733
- agentName: Type.Optional(
12734
- Type.String({
9616
+ var agentToolSchema = Type20.Object({
9617
+ prompt: Type20.String({ description: "The task or question for the subagent to work on" }),
9618
+ agentName: Type20.Optional(
9619
+ Type20.String({
12735
9620
  description: "Name of a defined agent (from AGENT.md) to use. If omitted, a general-purpose subagent is created."
12736
9621
  })
12737
9622
  ),
12738
- description: Type.Optional(
12739
- Type.String({
9623
+ description: Type20.Optional(
9624
+ Type20.String({
12740
9625
  description: "A short (3-5 word) label describing what the subagent will do"
12741
9626
  })
12742
9627
  )
@@ -12764,7 +9649,7 @@ function createAgentTool(options) {
12764
9649
  label: "agent",
12765
9650
  description: "Launch a specialized subagent to handle a focused subtask in an isolated context. The subagent runs autonomously and returns its result. Use this to delegate research, analysis, or parallel work without polluting the current context. If agentName is provided, that agent's system prompt and tool restrictions are applied.",
12766
9651
  parameters: agentToolSchema,
12767
- execute: async (_toolCallId, { prompt, agentName, description }) => {
9652
+ execute: async (toolCallId, { prompt, agentName, description }) => {
12768
9653
  const agentDef = agentName ? agents.find((a) => a.name === agentName && !a.disableModelInvocation) : void 0;
12769
9654
  if (agentName && !agentDef) {
12770
9655
  const available = agents.filter((a) => !a.disableModelInvocation).map((a) => a.name).join(", ");
@@ -12788,6 +9673,7 @@ function createAgentTool(options) {
12788
9673
  );
12789
9674
  onEvent({
12790
9675
  type: "subagent_start",
9676
+ toolCallId,
12791
9677
  subagentName: label,
12792
9678
  subagentDescription: agentDef?.description,
12793
9679
  subagentPrompt: prompt
@@ -12804,6 +9690,7 @@ function createAgentTool(options) {
12804
9690
  onEvent: (event) => {
12805
9691
  onEvent({
12806
9692
  type: "subagent_event",
9693
+ toolCallId,
12807
9694
  subagentName: label,
12808
9695
  subagentEvent: event
12809
9696
  });
@@ -12815,6 +9702,7 @@ function createAgentTool(options) {
12815
9702
  console.error(`[agent-tool] Subagent '${label}' failed:`, message);
12816
9703
  onEvent({
12817
9704
  type: "subagent_complete",
9705
+ toolCallId,
12818
9706
  subagentName: label,
12819
9707
  subagentResult: `Error: ${message}`
12820
9708
  });
@@ -12825,6 +9713,7 @@ function createAgentTool(options) {
12825
9713
  }
12826
9714
  onEvent({
12827
9715
  type: "subagent_complete",
9716
+ toolCallId,
12828
9717
  subagentName: label,
12829
9718
  subagentResult: result
12830
9719
  });
@@ -13265,6 +10154,12 @@ init_tarsk_debug();
13265
10154
  function buildDefaultPrompt(tools) {
13266
10155
  return buildDefaultSystemPrompt(tools.map((tool) => tool.name));
13267
10156
  }
10157
+ function resolveBaseSystemPrompt(tools, overrideOptions) {
10158
+ const base = resolveEffectiveSystemPrompt(buildDefaultPrompt(tools), overrideOptions);
10159
+ return `${base}
10160
+
10161
+ ${formatCurrentDateLine()}`;
10162
+ }
13268
10163
  var PLAN_MODE_INSTRUCTIONS = `
13269
10164
 
13270
10165
  # Plan Mode (ACTIVE)
@@ -13433,7 +10328,7 @@ function resolveEffectiveSystemPrompt(generatedPrompt, options) {
13433
10328
  return generatedPrompt;
13434
10329
  }
13435
10330
  async function loadPromptSections(threadPath, tools, skills, planMode, agents, deferredTools, ralphMode, overrideOptions) {
13436
- let systemPrompt = resolveEffectiveSystemPrompt(buildDefaultPrompt(tools), overrideOptions);
10331
+ let systemPrompt = resolveBaseSystemPrompt(tools, overrideOptions);
13437
10332
  const agentsContent = loadDeveloperContext(threadPath);
13438
10333
  if (agentsContent) {
13439
10334
  systemPrompt += "\n\n# Developer Context\n\n" + agentsContent;
@@ -13515,7 +10410,7 @@ function formatAgentsSection(agents) {
13515
10410
  return section;
13516
10411
  }
13517
10412
  async function loadAgentSystemPrompt(threadPath, tools, skills, planMode, agents, deferredTools, ralphMode, overrideOptions) {
13518
- let prompt = resolveEffectiveSystemPrompt(buildDefaultPrompt(tools), overrideOptions);
10413
+ let prompt = resolveBaseSystemPrompt(tools, overrideOptions);
13519
10414
  const agentsContent = loadDeveloperContext(threadPath);
13520
10415
  if (agentsContent) {
13521
10416
  prompt += "\n\n# Developer Context\n\n" + agentsContent;