@isdk/ai-tool 0.0.2 → 0.0.4

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 (69) hide show
  1. package/dist/{chunk-PKECBABP.mjs → chunk-ZXBTGYVX.mjs} +114 -127
  2. package/dist/funcs.js +112 -126
  3. package/dist/funcs.mjs +2 -2
  4. package/dist/index.d.mts +25 -1
  5. package/dist/index.d.ts +25 -1
  6. package/dist/index.js +114 -126
  7. package/dist/index.mjs +5 -2
  8. package/dist/test/util.js +1 -2
  9. package/dist/test/util.mjs +2 -3
  10. package/docs/classes/AbortError.md +11 -11
  11. package/docs/classes/AlreadyExistsError.md +11 -11
  12. package/docs/classes/BaseError.md +11 -11
  13. package/docs/classes/ClientTools.md +51 -51
  14. package/docs/classes/CommonError.md +11 -11
  15. package/docs/classes/EventClient.md +73 -73
  16. package/docs/classes/EventServer.md +71 -71
  17. package/docs/classes/EventToolFunc.md +41 -41
  18. package/docs/classes/FStringPromptTemplate.md +18 -18
  19. package/docs/classes/FewShotPromptTemplate.md +22 -22
  20. package/docs/classes/GolangPromptTemplate.md +18 -18
  21. package/docs/classes/HFEnvironment.md +9 -9
  22. package/docs/classes/HFInterpreter.md +17 -17
  23. package/docs/classes/HFTemplate.md +4 -4
  24. package/docs/classes/HfPromptTemplate.md +18 -18
  25. package/docs/classes/NotFoundError.md +11 -11
  26. package/docs/classes/NotImplementationError.md +11 -11
  27. package/docs/classes/PromptExampleSelector.md +8 -8
  28. package/docs/classes/PromptTemplate.md +17 -17
  29. package/docs/classes/ReadableStreamError.md +11 -11
  30. package/docs/classes/ResClientTools.md +57 -57
  31. package/docs/classes/ResServerTools.md +55 -55
  32. package/docs/classes/SSEChannel.md +15 -15
  33. package/docs/classes/ServerTools.md +48 -48
  34. package/docs/classes/ToolFunc.md +38 -38
  35. package/docs/enums/ErrorCode.md +19 -19
  36. package/docs/enums/XXHashAlgorithm.md +2 -2
  37. package/docs/interfaces/AIChatAssistantMessageParam.md +6 -6
  38. package/docs/interfaces/AIChatContentPartImage.md +2 -2
  39. package/docs/interfaces/AIChatContentPartText.md +2 -2
  40. package/docs/interfaces/AIChatMessageParamBase.md +1 -1
  41. package/docs/interfaces/AIChatMessageToolCall.md +3 -3
  42. package/docs/interfaces/AIChatSystemMessageParam.md +3 -3
  43. package/docs/interfaces/AIChatToolMessageParam.md +4 -4
  44. package/docs/interfaces/AIChatUserMessageParam.md +7 -7
  45. package/docs/interfaces/AIResult.md +4 -4
  46. package/docs/interfaces/AIStreamCallbacksAndOptions.md +6 -6
  47. package/docs/interfaces/AIStreamParser.md +1 -1
  48. package/docs/interfaces/AIStreamParserOptions.md +1 -1
  49. package/docs/interfaces/BaseFunc.md +7 -7
  50. package/docs/interfaces/BaseFuncItem.md +6 -6
  51. package/docs/interfaces/ClientFuncItem.md +10 -10
  52. package/docs/interfaces/DotenvExpandOptions.md +3 -3
  53. package/docs/interfaces/DotenvExpandOutput.md +2 -2
  54. package/docs/interfaces/EventClientFuncParams.md +4 -4
  55. package/docs/interfaces/EventServerFuncParams.md +5 -5
  56. package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
  57. package/docs/interfaces/FuncItem.md +7 -7
  58. package/docs/interfaces/FuncParam.md +5 -5
  59. package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
  60. package/docs/interfaces/PromptTemplateOptions.md +6 -6
  61. package/docs/interfaces/RemoteFuncItem.md +10 -10
  62. package/docs/interfaces/ResClientFuncParams.md +2 -2
  63. package/docs/interfaces/ResServerFuncParams.md +5 -5
  64. package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
  65. package/docs/interfaces/ServerFuncItem.md +11 -11
  66. package/docs/interfaces/ServerFuncParams.md +2 -2
  67. package/docs/modules.md +159 -109
  68. package/package.json +12 -13
  69. /package/dist/{chunk-EZFPVSGF.mjs → chunk-U5DDQYSF.mjs} +0 -0
package/dist/index.js CHANGED
@@ -124,6 +124,7 @@ __export(src_exports, {
124
124
  loadFileFromPaths: () => loadFileFromPaths,
125
125
  loadTextFromPaths: () => loadTextFromPaths,
126
126
  lrucache: () => lrucache,
127
+ matchUrlProtocol: () => matchUrlProtocol,
127
128
  mergeSegments: () => mergeSegments,
128
129
  mimeType: () => import_with_db.mimeType,
129
130
  parseFString: () => parseFString,
@@ -237,6 +238,7 @@ __export(utils_exports, {
237
238
  jsonFilterToWhere: () => jsonFilterToWhere,
238
239
  loadFileFromPaths: () => loadFileFromPaths,
239
240
  loadTextFromPaths: () => loadTextFromPaths,
241
+ matchUrlProtocol: () => matchUrlProtocol,
240
242
  mimeType: () => import_with_db.mimeType,
241
243
  parseFString: () => parseFString,
242
244
  parseJsJson: () => parseJsJson,
@@ -911,8 +913,7 @@ function tokenize(source, options = {}) {
911
913
  while (predicate(src[cursorPosition])) {
912
914
  if (src[cursorPosition] === "\\") {
913
915
  ++cursorPosition;
914
- if (cursorPosition >= src.length)
915
- throw new SyntaxError("Unexpected end of input");
916
+ if (cursorPosition >= src.length) throw new SyntaxError("Unexpected end of input");
916
917
  const escaped = src[cursorPosition++];
917
918
  const unescaped = ESCAPE_CHARACTERS.get(escaped);
918
919
  if (unescaped === void 0) {
@@ -922,83 +923,81 @@ function tokenize(source, options = {}) {
922
923
  continue;
923
924
  }
924
925
  str += src[cursorPosition++];
925
- if (cursorPosition >= src.length)
926
- throw new SyntaxError("Unexpected end of input");
926
+ if (cursorPosition >= src.length) throw new SyntaxError("Unexpected end of input");
927
927
  }
928
928
  return str;
929
929
  };
930
- main:
931
- while (cursorPosition < src.length) {
932
- const lastTokenType = tokens.at(-1)?.type;
933
- if (lastTokenType === void 0 || lastTokenType === TOKEN_TYPES.CloseStatement || lastTokenType === TOKEN_TYPES.CloseExpression) {
934
- let text = "";
935
- while (cursorPosition < src.length && // Keep going until we hit the next Jinja statement or expression
936
- !(src[cursorPosition] === "{" && (src[cursorPosition + 1] === "%" || src[cursorPosition + 1] === "{"))) {
937
- text += src[cursorPosition++];
938
- }
939
- if (text.length > 0) {
940
- tokens.push(new Token(text, TOKEN_TYPES.Text));
941
- continue;
942
- }
943
- }
944
- consumeWhile((char2) => /\s/.test(char2));
945
- const char = src[cursorPosition];
946
- if (char === "-" || char === "+") {
947
- const lastTokenType2 = tokens.at(-1)?.type;
948
- if (lastTokenType2 === TOKEN_TYPES.Text || lastTokenType2 === void 0) {
949
- throw new SyntaxError(`Unexpected character: ${char}`);
950
- }
951
- switch (lastTokenType2) {
952
- case TOKEN_TYPES.Identifier:
953
- case TOKEN_TYPES.NumericLiteral:
954
- case TOKEN_TYPES.BooleanLiteral:
955
- case TOKEN_TYPES.StringLiteral:
956
- case TOKEN_TYPES.CloseParen:
957
- case TOKEN_TYPES.CloseSquareBracket:
958
- break;
959
- default: {
960
- ++cursorPosition;
961
- const num = consumeWhile(isInteger);
962
- tokens.push(
963
- new Token(`${char}${num}`, num.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)
964
- );
965
- continue;
966
- }
967
- }
930
+ main: while (cursorPosition < src.length) {
931
+ const lastTokenType = tokens.at(-1)?.type;
932
+ if (lastTokenType === void 0 || lastTokenType === TOKEN_TYPES.CloseStatement || lastTokenType === TOKEN_TYPES.CloseExpression) {
933
+ let text = "";
934
+ while (cursorPosition < src.length && // Keep going until we hit the next Jinja statement or expression
935
+ !(src[cursorPosition] === "{" && (src[cursorPosition + 1] === "%" || src[cursorPosition + 1] === "{"))) {
936
+ text += src[cursorPosition++];
937
+ }
938
+ if (text.length > 0) {
939
+ tokens.push(new Token(text, TOKEN_TYPES.Text));
940
+ continue;
968
941
  }
969
- for (const [char2, token] of ORDERED_MAPPING_TABLE) {
970
- const slice2 = src.slice(cursorPosition, cursorPosition + char2.length);
971
- if (slice2 === char2) {
972
- tokens.push(new Token(char2, token));
973
- cursorPosition += char2.length;
974
- continue main;
942
+ }
943
+ consumeWhile((char2) => /\s/.test(char2));
944
+ const char = src[cursorPosition];
945
+ if (char === "-" || char === "+") {
946
+ const lastTokenType2 = tokens.at(-1)?.type;
947
+ if (lastTokenType2 === TOKEN_TYPES.Text || lastTokenType2 === void 0) {
948
+ throw new SyntaxError(`Unexpected character: ${char}`);
949
+ }
950
+ switch (lastTokenType2) {
951
+ case TOKEN_TYPES.Identifier:
952
+ case TOKEN_TYPES.NumericLiteral:
953
+ case TOKEN_TYPES.BooleanLiteral:
954
+ case TOKEN_TYPES.StringLiteral:
955
+ case TOKEN_TYPES.CloseParen:
956
+ case TOKEN_TYPES.CloseSquareBracket:
957
+ break;
958
+ default: {
959
+ ++cursorPosition;
960
+ const num = consumeWhile(isInteger);
961
+ tokens.push(
962
+ new Token(`${char}${num}`, num.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)
963
+ );
964
+ continue;
975
965
  }
976
966
  }
977
- if (char === "'" || char === '"') {
978
- ++cursorPosition;
979
- const str = consumeWhile((c) => c !== char);
980
- tokens.push(new Token(str, TOKEN_TYPES.StringLiteral));
981
- ++cursorPosition;
982
- continue;
983
- }
984
- if (isInteger(char)) {
985
- const num = consumeWhile(isInteger);
986
- tokens.push(new Token(num, TOKEN_TYPES.NumericLiteral));
987
- continue;
967
+ }
968
+ for (const [char2, token] of ORDERED_MAPPING_TABLE) {
969
+ const slice2 = src.slice(cursorPosition, cursorPosition + char2.length);
970
+ if (slice2 === char2) {
971
+ tokens.push(new Token(char2, token));
972
+ cursorPosition += char2.length;
973
+ continue main;
988
974
  }
989
- if (isWord(char)) {
990
- const word = consumeWhile(isWord);
991
- const type = Object.hasOwn(KEYWORDS, word) ? KEYWORDS[word] : TOKEN_TYPES.Identifier;
992
- if (type === TOKEN_TYPES.In && tokens.at(-1)?.type === TOKEN_TYPES.Not) {
993
- tokens.pop();
994
- tokens.push(new Token("not in", TOKEN_TYPES.NotIn));
995
- } else {
996
- tokens.push(new Token(word, type));
997
- }
998
- continue;
975
+ }
976
+ if (char === "'" || char === '"') {
977
+ ++cursorPosition;
978
+ const str = consumeWhile((c) => c !== char);
979
+ tokens.push(new Token(str, TOKEN_TYPES.StringLiteral));
980
+ ++cursorPosition;
981
+ continue;
982
+ }
983
+ if (isInteger(char)) {
984
+ const num = consumeWhile(isInteger);
985
+ tokens.push(new Token(num, TOKEN_TYPES.NumericLiteral));
986
+ continue;
987
+ }
988
+ if (isWord(char)) {
989
+ const word = consumeWhile(isWord);
990
+ const type = Object.hasOwn(KEYWORDS, word) ? KEYWORDS[word] : TOKEN_TYPES.Identifier;
991
+ if (type === TOKEN_TYPES.In && tokens.at(-1)?.type === TOKEN_TYPES.Not) {
992
+ tokens.pop();
993
+ tokens.push(new Token("not in", TOKEN_TYPES.NotIn));
994
+ } else {
995
+ tokens.push(new Token(word, type));
999
996
  }
1000
- throw new SyntaxError(`Unexpected character: ${char}`);
997
+ continue;
1001
998
  }
999
+ throw new SyntaxError(`Unexpected character: ${char}`);
1000
+ }
1002
1001
  return tokens;
1003
1002
  }
1004
1003
 
@@ -2294,8 +2293,7 @@ var Interpreter = class {
2294
2293
  return new StringValue(result);
2295
2294
  }
2296
2295
  evaluate(statement, environment) {
2297
- if (statement === void 0)
2298
- return new UndefinedValue();
2296
+ if (statement === void 0) return new UndefinedValue();
2299
2297
  switch (statement.type) {
2300
2298
  case "Program":
2301
2299
  return this.evalProgram(statement, environment);
@@ -3239,22 +3237,19 @@ var SSEChannel = class {
3239
3237
  * @throws Will throw an error if the channel is closed.
3240
3238
  */
3241
3239
  publish(data, eventName) {
3242
- if (!this.active)
3243
- throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
3240
+ if (!this.active) throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
3244
3241
  let output;
3245
3242
  let id;
3246
3243
  let _eventName = eventName;
3247
3244
  if (!data && !eventName) {
3248
- if (!this.clients.size)
3249
- return;
3245
+ if (!this.clients.size) return;
3250
3246
  output = "data: \n\n";
3251
3247
  } else {
3252
3248
  id = this.nextID++;
3253
3249
  if (typeof data === "object") {
3254
3250
  if (data.event) {
3255
3251
  _eventName = data.event;
3256
- if (data.data !== void 0)
3257
- data = JSON.stringify(data.data);
3252
+ if (data.data !== void 0) data = JSON.stringify(data.data);
3258
3253
  } else {
3259
3254
  data = JSON.stringify(data);
3260
3255
  }
@@ -3281,8 +3276,7 @@ var SSEChannel = class {
3281
3276
  * @throws Will throw an error if the channel is closed.
3282
3277
  */
3283
3278
  subscribe(req, res, events) {
3284
- if (!this.active)
3285
- throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
3279
+ if (!this.active) throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
3286
3280
  const c = { req, res, events };
3287
3281
  const maxStreamDuration = this.options.maxStreamDuration;
3288
3282
  let cacheControl = "max-age=0, stale-while-revalidate=0, stale-if-error=0, no-transform";
@@ -3412,8 +3406,7 @@ function createEventStreamTransformer(customParser) {
3412
3406
  const parsedMessage = customParser ? customParser(event2.data, {
3413
3407
  event: event2.event
3414
3408
  }) : event2.data;
3415
- if (parsedMessage)
3416
- controller.enqueue(parsedMessage);
3409
+ if (parsedMessage) controller.enqueue(parsedMessage);
3417
3410
  }
3418
3411
  }
3419
3412
  );
@@ -3429,15 +3422,13 @@ function createCallbacksTransformer(cb) {
3429
3422
  const callbacks = cb || {};
3430
3423
  return new TransformStream({
3431
3424
  async start() {
3432
- if (callbacks.onStart)
3433
- await callbacks.onStart();
3425
+ if (callbacks.onStart) await callbacks.onStart();
3434
3426
  },
3435
3427
  async transform(message, controller) {
3436
3428
  const content = typeof message === "string" ? message : message.content;
3437
3429
  controller.enqueue(textEncoder.encode(content));
3438
3430
  aggregatedResponse += content;
3439
- if (callbacks.onToken)
3440
- await callbacks.onToken(content);
3431
+ if (callbacks.onToken) await callbacks.onToken(content);
3441
3432
  if (callbacks.onText && typeof message === "string") {
3442
3433
  await callbacks.onText(message);
3443
3434
  }
@@ -3457,8 +3448,7 @@ function trimStartOfStreamHelper() {
3457
3448
  return (text) => {
3458
3449
  if (isStreamStart) {
3459
3450
  text = text.trimStart();
3460
- if (text)
3461
- isStreamStart = false;
3451
+ if (text) isStreamStart = false;
3462
3452
  }
3463
3453
  return text;
3464
3454
  };
@@ -3485,10 +3475,8 @@ function readableFromAsyncIterable(iterable) {
3485
3475
  return new ReadableStream({
3486
3476
  async pull(controller) {
3487
3477
  const { done, value } = await it.next();
3488
- if (done)
3489
- controller.close();
3490
- else
3491
- controller.enqueue(value);
3478
+ if (done) controller.close();
3479
+ else controller.enqueue(value);
3492
3480
  },
3493
3481
  async cancel(reason) {
3494
3482
  await it.return?.(reason);
@@ -3561,8 +3549,7 @@ var XXHashAlgorithm = /* @__PURE__ */ ((XXHashAlgorithm2) => {
3561
3549
  return XXHashAlgorithm2;
3562
3550
  })(XXHashAlgorithm || {});
3563
3551
  function xxhash(value, hashAlgo = 111 /* xxhash64 */, seed = SEED) {
3564
- if (value.buffer)
3565
- value = value.buffer;
3552
+ if (value.buffer) value = value.buffer;
3566
3553
  let result;
3567
3554
  if (hashAlgo !== 112 /* xxhash32 */) {
3568
3555
  result = h64(value, seed);
@@ -3751,8 +3738,7 @@ function isObject(value) {
3751
3738
  return !!value && value.constructor === Object;
3752
3739
  }
3753
3740
  function getKeysPath(value) {
3754
- if (!value)
3755
- return [];
3741
+ if (!value) return [];
3756
3742
  return getKeys(value, [], "");
3757
3743
  }
3758
3744
  function getKeys(obj, paths, dot = ".") {
@@ -3974,31 +3960,38 @@ function jsonFilterToWhere(filter, wrapKey) {
3974
3960
  }
3975
3961
  if (Array.isArray(filter)) {
3976
3962
  andQuery.push(generateAndClause(filter, wrapKey));
3977
- } else
3978
- for (const [key, value] of Object.entries(filter)) {
3979
- if (key === "$and") {
3980
- andQuery.push(`(${generateAndClause(filter[key], wrapKey)})`);
3981
- } else if (key === "$or") {
3982
- andQuery.push(`(${generateOrClause(filter[key], wrapKey)})`);
3963
+ } else for (const [key, value] of Object.entries(filter)) {
3964
+ if (key === "$and") {
3965
+ andQuery.push(`(${generateAndClause(filter[key], wrapKey)})`);
3966
+ } else if (key === "$or") {
3967
+ andQuery.push(`(${generateOrClause(filter[key], wrapKey)})`);
3968
+ } else {
3969
+ const tValue = typeof value;
3970
+ if (value == null) {
3971
+ andQuery.push(`${wrapKey(key)} IS NULL`);
3972
+ } else if (tValue === "object" && !Array.isArray(value)) {
3973
+ andQuery.push(generateCondition(wrapKey(key), value));
3974
+ } else if (tValue === "string") {
3975
+ andQuery.push(`${wrapKey(key)}='${value}'`);
3976
+ } else if (tValue === "number" || tValue === "boolean") {
3977
+ andQuery.push(`${wrapKey(key)}=${value}`);
3983
3978
  } else {
3984
- const tValue = typeof value;
3985
- if (value == null) {
3986
- andQuery.push(`${wrapKey(key)} IS NULL`);
3987
- } else if (tValue === "object" && !Array.isArray(value)) {
3988
- andQuery.push(generateCondition(wrapKey(key), value));
3989
- } else if (tValue === "string") {
3990
- andQuery.push(`${wrapKey(key)}='${value}'`);
3991
- } else if (tValue === "number" || tValue === "boolean") {
3992
- andQuery.push(`${wrapKey(key)}=${value}`);
3993
- } else {
3994
- throw new Error(`Unsupported value type for key ${key}`);
3995
- }
3979
+ throw new Error(`Unsupported value type for key ${key}`);
3996
3980
  }
3997
3981
  }
3982
+ }
3998
3983
  ;
3999
3984
  return andQuery.length > 1 ? andQuery.join(" AND ") : andQuery[0];
4000
3985
  }
4001
3986
 
3987
+ // src/utils/match-url-protocol.ts
3988
+ function matchUrlProtocol(name) {
3989
+ const index = name.indexOf("://");
3990
+ if (index > 0) {
3991
+ return name.substring(0, index);
3992
+ }
3993
+ }
3994
+
4002
3995
  // src/index.ts
4003
3996
  __reExport(src_exports, utils_exports, module.exports);
4004
3997
 
@@ -4185,8 +4178,7 @@ var ToolFunc = class _ToolFunc extends import_property_manager.AdvancePropertyMa
4185
4178
  runSync(params) {
4186
4179
  const isPosParams = this.params && Array.isArray(this.params);
4187
4180
  if (Array.isArray(params)) {
4188
- if (isPosParams)
4189
- return this.func(...params);
4181
+ if (isPosParams) return this.func(...params);
4190
4182
  throwError2("the function is not support array params, the params must be object!", this.name);
4191
4183
  }
4192
4184
  if (isPosParams) {
@@ -4276,8 +4268,7 @@ var ClientTools = class _ClientTools extends ToolFunc {
4276
4268
  "Content-Type": "application/json"
4277
4269
  } });
4278
4270
  const items = await res.json();
4279
- if (items)
4280
- this.loadFromSync(items);
4271
+ if (items) this.loadFromSync(items);
4281
4272
  } else {
4282
4273
  throwError2("missing apiRoot to load tools", "ClientTools");
4283
4274
  }
@@ -4461,8 +4452,7 @@ var import_transformers = require("@xenova/transformers");
4461
4452
  var import_secondary_cache = require("secondary-cache");
4462
4453
  function _lrucache({ key, value, options } = {}) {
4463
4454
  if (key === void 0) {
4464
- if (options)
4465
- this.cache.setDefaultOptions(options);
4455
+ if (options) this.cache.setDefaultOptions(options);
4466
4456
  } else if (value === null) {
4467
4457
  return this.cache.del(key);
4468
4458
  } else if (value !== void 0) {
@@ -4664,8 +4654,7 @@ async function _splitSegments({ texts, model } = {}) {
4664
4654
  }
4665
4655
  }
4666
4656
  }
4667
- if (segment.length)
4668
- segments2.push([...segment]);
4657
+ if (segment.length) segments2.push([...segment]);
4669
4658
  return segments2;
4670
4659
  }
4671
4660
  var splitSegments = new ServerTools("splitSegments", {
@@ -4888,8 +4877,7 @@ var EventClient = class extends ResClientTools {
4888
4877
  for (const event2 of events) {
4889
4878
  if (!this._forwardEvents.has(event2)) {
4890
4879
  this._forwardEvents.add(event2);
4891
- if (this.on)
4892
- this.on(event2, this.ebListener);
4880
+ if (this.on) this.on(event2, this.ebListener);
4893
4881
  }
4894
4882
  }
4895
4883
  }
@@ -4908,8 +4896,7 @@ var EventClient = class extends ResClientTools {
4908
4896
  for (const event2 of events) {
4909
4897
  if (this._forwardEvents.has(event2)) {
4910
4898
  this._forwardEvents.delete(event2);
4911
- if (this.off)
4912
- this.off(event2, this.ebListener);
4899
+ if (this.off) this.off(event2, this.ebListener);
4913
4900
  }
4914
4901
  }
4915
4902
  }
@@ -5201,6 +5188,7 @@ function registerCoreTools() {
5201
5188
  loadFileFromPaths,
5202
5189
  loadTextFromPaths,
5203
5190
  lrucache,
5191
+ matchUrlProtocol,
5204
5192
  mergeSegments,
5205
5193
  mimeType,
5206
5194
  parseFString,
package/dist/index.mjs CHANGED
@@ -91,6 +91,7 @@ import {
91
91
  loadFileFromPaths,
92
92
  loadTextFromPaths,
93
93
  lrucache,
94
+ matchUrlProtocol,
94
95
  mergeSegments,
95
96
  mimeType,
96
97
  parse,
@@ -128,11 +129,11 @@ import {
128
129
  xxhash32,
129
130
  xxhash64,
130
131
  xxhashAsStr
131
- } from "./chunk-PKECBABP.mjs";
132
+ } from "./chunk-ZXBTGYVX.mjs";
132
133
  import {
133
134
  __export,
134
135
  __reExport
135
- } from "./chunk-EZFPVSGF.mjs";
136
+ } from "./chunk-U5DDQYSF.mjs";
136
137
 
137
138
  // src/index.ts
138
139
  var src_exports = {};
@@ -230,6 +231,7 @@ __export(src_exports, {
230
231
  loadFileFromPaths: () => loadFileFromPaths,
231
232
  loadTextFromPaths: () => loadTextFromPaths,
232
233
  lrucache: () => lrucache,
234
+ matchUrlProtocol: () => matchUrlProtocol,
233
235
  mergeSegments: () => mergeSegments,
234
236
  mimeType: () => mimeType,
235
237
  parseFString: () => parseFString,
@@ -361,6 +363,7 @@ export {
361
363
  loadFileFromPaths,
362
364
  loadTextFromPaths,
363
365
  lrucache,
366
+ matchUrlProtocol,
364
367
  mergeSegments,
365
368
  mimeType,
366
369
  parseFString,
package/dist/test/util.js CHANGED
@@ -55,8 +55,7 @@ async function findPort(port, portRetryCount = 10) {
55
55
  port = 0;
56
56
  } else {
57
57
  port = parseInt(port);
58
- if (!(port >= 0))
59
- port = 0;
58
+ if (!(port >= 0)) port = 0;
60
59
  }
61
60
  const server = import_net.default.createServer();
62
61
  server.on("error", (err) => {
@@ -1,4 +1,4 @@
1
- import "../chunk-EZFPVSGF.mjs";
1
+ import "../chunk-U5DDQYSF.mjs";
2
2
 
3
3
  // test/util/compare-str.ts
4
4
  function compareStr(src, dest) {
@@ -19,8 +19,7 @@ async function findPort(port, portRetryCount = 10) {
19
19
  port = 0;
20
20
  } else {
21
21
  port = parseInt(port);
22
- if (!(port >= 0))
23
- port = 0;
22
+ if (!(port >= 0)) port = 0;
24
23
  }
25
24
  const server = net.createServer();
26
25
  server.on("error", (err) => {
@@ -86,7 +86,7 @@ fromJSON - Creates a new BaseError instance from a JSON representation.
86
86
 
87
87
  #### Defined in
88
88
 
89
- [packages/ai-tool/src/utils/base-error.ts:202](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L202)
89
+ [packages/ai-tool/src/utils/base-error.ts:202](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L202)
90
90
 
91
91
  ## Properties
92
92
 
@@ -102,7 +102,7 @@ The name of the function that threw the error.
102
102
 
103
103
  #### Defined in
104
104
 
105
- [packages/ai-tool/src/utils/base-error.ts:64](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L64)
105
+ [packages/ai-tool/src/utils/base-error.ts:64](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L64)
106
106
 
107
107
  ___
108
108
 
@@ -130,7 +130,7 @@ ___
130
130
 
131
131
  #### Defined in
132
132
 
133
- [packages/ai-tool/src/utils/base-error.ts:65](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L65)
133
+ [packages/ai-tool/src/utils/base-error.ts:65](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L65)
134
134
 
135
135
  ___
136
136
 
@@ -146,7 +146,7 @@ Additional data associated with the error.
146
146
 
147
147
  #### Defined in
148
148
 
149
- [packages/ai-tool/src/utils/base-error.ts:66](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L66)
149
+ [packages/ai-tool/src/utils/base-error.ts:66](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L66)
150
150
 
151
151
  ___
152
152
 
@@ -204,7 +204,7 @@ The error code associated with the error.
204
204
 
205
205
  #### Defined in
206
206
 
207
- [packages/ai-tool/src/utils/base-error.ts:201](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L201)
207
+ [packages/ai-tool/src/utils/base-error.ts:201](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L201)
208
208
 
209
209
  ___
210
210
 
@@ -239,7 +239,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
239
239
 
240
240
  #### Defined in
241
241
 
242
- node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:28
242
+ node_modules/.pnpm/@types+node@20.14.2/node_modules/@types/node/globals.d.ts:28
243
243
 
244
244
  ___
245
245
 
@@ -253,7 +253,7 @@ ___
253
253
 
254
254
  #### Defined in
255
255
 
256
- node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:30
256
+ node_modules/.pnpm/@types+node@20.14.2/node_modules/@types/node/globals.d.ts:30
257
257
 
258
258
  ## Methods
259
259
 
@@ -281,7 +281,7 @@ A new BaseError instance.
281
281
 
282
282
  #### Defined in
283
283
 
284
- [packages/ai-tool/src/utils/base-error.ts:129](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L129)
284
+ [packages/ai-tool/src/utils/base-error.ts:129](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L129)
285
285
 
286
286
  ___
287
287
 
@@ -303,7 +303,7 @@ A JSON representation of the error.
303
303
 
304
304
  #### Defined in
305
305
 
306
- [packages/ai-tool/src/utils/base-error.ts:109](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L109)
306
+ [packages/ai-tool/src/utils/base-error.ts:109](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L109)
307
307
 
308
308
  ___
309
309
 
@@ -330,7 +330,7 @@ Create .stack property on a target object
330
330
 
331
331
  #### Defined in
332
332
 
333
- node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:21
333
+ node_modules/.pnpm/@types+node@20.14.2/node_modules/@types/node/globals.d.ts:21
334
334
 
335
335
  ___
336
336
 
@@ -356,4 +356,4 @@ typeof [`BaseError`](BaseError.md)
356
356
 
357
357
  #### Defined in
358
358
 
359
- [packages/ai-tool/src/utils/base-error.ts:68](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L68)
359
+ [packages/ai-tool/src/utils/base-error.ts:68](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L68)
@@ -66,7 +66,7 @@ throw new AlreadyExistsError('user', { id: 123 })
66
66
 
67
67
  #### Defined in
68
68
 
69
- [packages/ai-tool/src/utils/base-error.ts:193](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L193)
69
+ [packages/ai-tool/src/utils/base-error.ts:193](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L193)
70
70
 
71
71
  ## Properties
72
72
 
@@ -82,7 +82,7 @@ The name of the function that threw the error.
82
82
 
83
83
  #### Defined in
84
84
 
85
- [packages/ai-tool/src/utils/base-error.ts:64](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L64)
85
+ [packages/ai-tool/src/utils/base-error.ts:64](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L64)
86
86
 
87
87
  ___
88
88
 
@@ -110,7 +110,7 @@ ___
110
110
 
111
111
  #### Defined in
112
112
 
113
- [packages/ai-tool/src/utils/base-error.ts:65](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L65)
113
+ [packages/ai-tool/src/utils/base-error.ts:65](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L65)
114
114
 
115
115
  ___
116
116
 
@@ -126,7 +126,7 @@ Additional data associated with the error.
126
126
 
127
127
  #### Defined in
128
128
 
129
- [packages/ai-tool/src/utils/base-error.ts:66](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L66)
129
+ [packages/ai-tool/src/utils/base-error.ts:66](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L66)
130
130
 
131
131
  ___
132
132
 
@@ -184,7 +184,7 @@ The error code associated with the error.
184
184
 
185
185
  #### Defined in
186
186
 
187
- [packages/ai-tool/src/utils/base-error.ts:192](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L192)
187
+ [packages/ai-tool/src/utils/base-error.ts:192](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L192)
188
188
 
189
189
  ___
190
190
 
@@ -219,7 +219,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
219
219
 
220
220
  #### Defined in
221
221
 
222
- node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:28
222
+ node_modules/.pnpm/@types+node@20.14.2/node_modules/@types/node/globals.d.ts:28
223
223
 
224
224
  ___
225
225
 
@@ -233,7 +233,7 @@ ___
233
233
 
234
234
  #### Defined in
235
235
 
236
- node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:30
236
+ node_modules/.pnpm/@types+node@20.14.2/node_modules/@types/node/globals.d.ts:30
237
237
 
238
238
  ## Methods
239
239
 
@@ -261,7 +261,7 @@ A new BaseError instance.
261
261
 
262
262
  #### Defined in
263
263
 
264
- [packages/ai-tool/src/utils/base-error.ts:129](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L129)
264
+ [packages/ai-tool/src/utils/base-error.ts:129](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L129)
265
265
 
266
266
  ___
267
267
 
@@ -283,7 +283,7 @@ A JSON representation of the error.
283
283
 
284
284
  #### Defined in
285
285
 
286
- [packages/ai-tool/src/utils/base-error.ts:109](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L109)
286
+ [packages/ai-tool/src/utils/base-error.ts:109](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L109)
287
287
 
288
288
  ___
289
289
 
@@ -310,7 +310,7 @@ Create .stack property on a target object
310
310
 
311
311
  #### Defined in
312
312
 
313
- node_modules/.pnpm/@types+node@20.12.7/node_modules/@types/node/globals.d.ts:21
313
+ node_modules/.pnpm/@types+node@20.14.2/node_modules/@types/node/globals.d.ts:21
314
314
 
315
315
  ___
316
316
 
@@ -336,4 +336,4 @@ typeof [`BaseError`](BaseError.md)
336
336
 
337
337
  #### Defined in
338
338
 
339
- [packages/ai-tool/src/utils/base-error.ts:68](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L68)
339
+ [packages/ai-tool/src/utils/base-error.ts:68](https://github.com/isdk/ai-tool.js/blob/0f8a4d4a5fd2f372072a81ed0b281e2d8d5796f1/src/utils/base-error.ts#L68)