@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/funcs.js CHANGED
@@ -392,8 +392,7 @@ var ToolFunc = class _ToolFunc extends import_property_manager.AdvancePropertyMa
392
392
  runSync(params) {
393
393
  const isPosParams = this.params && Array.isArray(this.params);
394
394
  if (Array.isArray(params)) {
395
- if (isPosParams)
396
- return this.func(...params);
395
+ if (isPosParams) return this.func(...params);
397
396
  throwError2("the function is not support array params, the params must be object!", this.name);
398
397
  }
399
398
  if (isPosParams) {
@@ -601,22 +600,19 @@ var SSEChannel = class {
601
600
  * @throws Will throw an error if the channel is closed.
602
601
  */
603
602
  publish(data, eventName) {
604
- if (!this.active)
605
- throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
603
+ if (!this.active) throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
606
604
  let output;
607
605
  let id;
608
606
  let _eventName = eventName;
609
607
  if (!data && !eventName) {
610
- if (!this.clients.size)
611
- return;
608
+ if (!this.clients.size) return;
612
609
  output = "data: \n\n";
613
610
  } else {
614
611
  id = this.nextID++;
615
612
  if (typeof data === "object") {
616
613
  if (data.event) {
617
614
  _eventName = data.event;
618
- if (data.data !== void 0)
619
- data = JSON.stringify(data.data);
615
+ if (data.data !== void 0) data = JSON.stringify(data.data);
620
616
  } else {
621
617
  data = JSON.stringify(data);
622
618
  }
@@ -643,8 +639,7 @@ var SSEChannel = class {
643
639
  * @throws Will throw an error if the channel is closed.
644
640
  */
645
641
  subscribe(req, res, events) {
646
- if (!this.active)
647
- throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
642
+ if (!this.active) throwError2("Channel closed", "SSEChannel", SSEChannelAlreadyClosedErrCode);
648
643
  const c = { req, res, events };
649
644
  const maxStreamDuration = this.options.maxStreamDuration;
650
645
  let cacheControl = "max-age=0, stale-while-revalidate=0, stale-if-error=0, no-transform";
@@ -805,8 +800,7 @@ var import_transformers = require("@xenova/transformers");
805
800
  var import_secondary_cache = require("secondary-cache");
806
801
  function _lrucache({ key, value, options } = {}) {
807
802
  if (key === void 0) {
808
- if (options)
809
- this.cache.setDefaultOptions(options);
803
+ if (options) this.cache.setDefaultOptions(options);
810
804
  } else if (value === null) {
811
805
  return this.cache.del(key);
812
806
  } else if (value !== void 0) {
@@ -1059,8 +1053,7 @@ async function _splitSegments({ texts, model } = {}) {
1059
1053
  }
1060
1054
  }
1061
1055
  }
1062
- if (segment.length)
1063
- segments2.push([...segment]);
1056
+ if (segment.length) segments2.push([...segment]);
1064
1057
  return segments2;
1065
1058
  }
1066
1059
  var splitSegments = new ServerTools("splitSegments", {
@@ -1171,6 +1164,7 @@ __export(utils_exports, {
1171
1164
  jsonFilterToWhere: () => jsonFilterToWhere,
1172
1165
  loadFileFromPaths: () => loadFileFromPaths,
1173
1166
  loadTextFromPaths: () => loadTextFromPaths,
1167
+ matchUrlProtocol: () => matchUrlProtocol,
1174
1168
  mimeType: () => import_with_db.mimeType,
1175
1169
  parseFString: () => parseFString,
1176
1170
  parseJsJson: () => parseJsJson,
@@ -1667,8 +1661,7 @@ function tokenize(source, options = {}) {
1667
1661
  while (predicate(src[cursorPosition])) {
1668
1662
  if (src[cursorPosition] === "\\") {
1669
1663
  ++cursorPosition;
1670
- if (cursorPosition >= src.length)
1671
- throw new SyntaxError("Unexpected end of input");
1664
+ if (cursorPosition >= src.length) throw new SyntaxError("Unexpected end of input");
1672
1665
  const escaped = src[cursorPosition++];
1673
1666
  const unescaped = ESCAPE_CHARACTERS.get(escaped);
1674
1667
  if (unescaped === void 0) {
@@ -1678,83 +1671,81 @@ function tokenize(source, options = {}) {
1678
1671
  continue;
1679
1672
  }
1680
1673
  str += src[cursorPosition++];
1681
- if (cursorPosition >= src.length)
1682
- throw new SyntaxError("Unexpected end of input");
1674
+ if (cursorPosition >= src.length) throw new SyntaxError("Unexpected end of input");
1683
1675
  }
1684
1676
  return str;
1685
1677
  };
1686
- main:
1687
- while (cursorPosition < src.length) {
1688
- const lastTokenType = tokens.at(-1)?.type;
1689
- if (lastTokenType === void 0 || lastTokenType === TOKEN_TYPES.CloseStatement || lastTokenType === TOKEN_TYPES.CloseExpression) {
1690
- let text = "";
1691
- while (cursorPosition < src.length && // Keep going until we hit the next Jinja statement or expression
1692
- !(src[cursorPosition] === "{" && (src[cursorPosition + 1] === "%" || src[cursorPosition + 1] === "{"))) {
1693
- text += src[cursorPosition++];
1694
- }
1695
- if (text.length > 0) {
1696
- tokens.push(new Token(text, TOKEN_TYPES.Text));
1697
- continue;
1698
- }
1699
- }
1700
- consumeWhile((char2) => /\s/.test(char2));
1701
- const char = src[cursorPosition];
1702
- if (char === "-" || char === "+") {
1703
- const lastTokenType2 = tokens.at(-1)?.type;
1704
- if (lastTokenType2 === TOKEN_TYPES.Text || lastTokenType2 === void 0) {
1705
- throw new SyntaxError(`Unexpected character: ${char}`);
1706
- }
1707
- switch (lastTokenType2) {
1708
- case TOKEN_TYPES.Identifier:
1709
- case TOKEN_TYPES.NumericLiteral:
1710
- case TOKEN_TYPES.BooleanLiteral:
1711
- case TOKEN_TYPES.StringLiteral:
1712
- case TOKEN_TYPES.CloseParen:
1713
- case TOKEN_TYPES.CloseSquareBracket:
1714
- break;
1715
- default: {
1716
- ++cursorPosition;
1717
- const num = consumeWhile(isInteger);
1718
- tokens.push(
1719
- new Token(`${char}${num}`, num.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)
1720
- );
1721
- continue;
1722
- }
1723
- }
1678
+ main: while (cursorPosition < src.length) {
1679
+ const lastTokenType = tokens.at(-1)?.type;
1680
+ if (lastTokenType === void 0 || lastTokenType === TOKEN_TYPES.CloseStatement || lastTokenType === TOKEN_TYPES.CloseExpression) {
1681
+ let text = "";
1682
+ while (cursorPosition < src.length && // Keep going until we hit the next Jinja statement or expression
1683
+ !(src[cursorPosition] === "{" && (src[cursorPosition + 1] === "%" || src[cursorPosition + 1] === "{"))) {
1684
+ text += src[cursorPosition++];
1685
+ }
1686
+ if (text.length > 0) {
1687
+ tokens.push(new Token(text, TOKEN_TYPES.Text));
1688
+ continue;
1724
1689
  }
1725
- for (const [char2, token] of ORDERED_MAPPING_TABLE) {
1726
- const slice2 = src.slice(cursorPosition, cursorPosition + char2.length);
1727
- if (slice2 === char2) {
1728
- tokens.push(new Token(char2, token));
1729
- cursorPosition += char2.length;
1730
- continue main;
1690
+ }
1691
+ consumeWhile((char2) => /\s/.test(char2));
1692
+ const char = src[cursorPosition];
1693
+ if (char === "-" || char === "+") {
1694
+ const lastTokenType2 = tokens.at(-1)?.type;
1695
+ if (lastTokenType2 === TOKEN_TYPES.Text || lastTokenType2 === void 0) {
1696
+ throw new SyntaxError(`Unexpected character: ${char}`);
1697
+ }
1698
+ switch (lastTokenType2) {
1699
+ case TOKEN_TYPES.Identifier:
1700
+ case TOKEN_TYPES.NumericLiteral:
1701
+ case TOKEN_TYPES.BooleanLiteral:
1702
+ case TOKEN_TYPES.StringLiteral:
1703
+ case TOKEN_TYPES.CloseParen:
1704
+ case TOKEN_TYPES.CloseSquareBracket:
1705
+ break;
1706
+ default: {
1707
+ ++cursorPosition;
1708
+ const num = consumeWhile(isInteger);
1709
+ tokens.push(
1710
+ new Token(`${char}${num}`, num.length > 0 ? TOKEN_TYPES.NumericLiteral : TOKEN_TYPES.UnaryOperator)
1711
+ );
1712
+ continue;
1731
1713
  }
1732
1714
  }
1733
- if (char === "'" || char === '"') {
1734
- ++cursorPosition;
1735
- const str = consumeWhile((c) => c !== char);
1736
- tokens.push(new Token(str, TOKEN_TYPES.StringLiteral));
1737
- ++cursorPosition;
1738
- continue;
1739
- }
1740
- if (isInteger(char)) {
1741
- const num = consumeWhile(isInteger);
1742
- tokens.push(new Token(num, TOKEN_TYPES.NumericLiteral));
1743
- continue;
1715
+ }
1716
+ for (const [char2, token] of ORDERED_MAPPING_TABLE) {
1717
+ const slice2 = src.slice(cursorPosition, cursorPosition + char2.length);
1718
+ if (slice2 === char2) {
1719
+ tokens.push(new Token(char2, token));
1720
+ cursorPosition += char2.length;
1721
+ continue main;
1744
1722
  }
1745
- if (isWord(char)) {
1746
- const word = consumeWhile(isWord);
1747
- const type = Object.hasOwn(KEYWORDS, word) ? KEYWORDS[word] : TOKEN_TYPES.Identifier;
1748
- if (type === TOKEN_TYPES.In && tokens.at(-1)?.type === TOKEN_TYPES.Not) {
1749
- tokens.pop();
1750
- tokens.push(new Token("not in", TOKEN_TYPES.NotIn));
1751
- } else {
1752
- tokens.push(new Token(word, type));
1753
- }
1754
- continue;
1723
+ }
1724
+ if (char === "'" || char === '"') {
1725
+ ++cursorPosition;
1726
+ const str = consumeWhile((c) => c !== char);
1727
+ tokens.push(new Token(str, TOKEN_TYPES.StringLiteral));
1728
+ ++cursorPosition;
1729
+ continue;
1730
+ }
1731
+ if (isInteger(char)) {
1732
+ const num = consumeWhile(isInteger);
1733
+ tokens.push(new Token(num, TOKEN_TYPES.NumericLiteral));
1734
+ continue;
1735
+ }
1736
+ if (isWord(char)) {
1737
+ const word = consumeWhile(isWord);
1738
+ const type = Object.hasOwn(KEYWORDS, word) ? KEYWORDS[word] : TOKEN_TYPES.Identifier;
1739
+ if (type === TOKEN_TYPES.In && tokens.at(-1)?.type === TOKEN_TYPES.Not) {
1740
+ tokens.pop();
1741
+ tokens.push(new Token("not in", TOKEN_TYPES.NotIn));
1742
+ } else {
1743
+ tokens.push(new Token(word, type));
1755
1744
  }
1756
- throw new SyntaxError(`Unexpected character: ${char}`);
1745
+ continue;
1757
1746
  }
1747
+ throw new SyntaxError(`Unexpected character: ${char}`);
1748
+ }
1758
1749
  return tokens;
1759
1750
  }
1760
1751
 
@@ -3050,8 +3041,7 @@ var Interpreter = class {
3050
3041
  return new StringValue(result);
3051
3042
  }
3052
3043
  evaluate(statement, environment) {
3053
- if (statement === void 0)
3054
- return new UndefinedValue();
3044
+ if (statement === void 0) return new UndefinedValue();
3055
3045
  switch (statement.type) {
3056
3046
  case "Program":
3057
3047
  return this.evalProgram(statement, environment);
@@ -3868,8 +3858,7 @@ function createEventStreamTransformer(customParser) {
3868
3858
  const parsedMessage = customParser ? customParser(event2.data, {
3869
3859
  event: event2.event
3870
3860
  }) : event2.data;
3871
- if (parsedMessage)
3872
- controller.enqueue(parsedMessage);
3861
+ if (parsedMessage) controller.enqueue(parsedMessage);
3873
3862
  }
3874
3863
  }
3875
3864
  );
@@ -3885,15 +3874,13 @@ function createCallbacksTransformer(cb) {
3885
3874
  const callbacks = cb || {};
3886
3875
  return new TransformStream({
3887
3876
  async start() {
3888
- if (callbacks.onStart)
3889
- await callbacks.onStart();
3877
+ if (callbacks.onStart) await callbacks.onStart();
3890
3878
  },
3891
3879
  async transform(message, controller) {
3892
3880
  const content = typeof message === "string" ? message : message.content;
3893
3881
  controller.enqueue(textEncoder.encode(content));
3894
3882
  aggregatedResponse += content;
3895
- if (callbacks.onToken)
3896
- await callbacks.onToken(content);
3883
+ if (callbacks.onToken) await callbacks.onToken(content);
3897
3884
  if (callbacks.onText && typeof message === "string") {
3898
3885
  await callbacks.onText(message);
3899
3886
  }
@@ -3913,8 +3900,7 @@ function trimStartOfStreamHelper() {
3913
3900
  return (text) => {
3914
3901
  if (isStreamStart) {
3915
3902
  text = text.trimStart();
3916
- if (text)
3917
- isStreamStart = false;
3903
+ if (text) isStreamStart = false;
3918
3904
  }
3919
3905
  return text;
3920
3906
  };
@@ -3941,10 +3927,8 @@ function readableFromAsyncIterable(iterable) {
3941
3927
  return new ReadableStream({
3942
3928
  async pull(controller) {
3943
3929
  const { done, value } = await it.next();
3944
- if (done)
3945
- controller.close();
3946
- else
3947
- controller.enqueue(value);
3930
+ if (done) controller.close();
3931
+ else controller.enqueue(value);
3948
3932
  },
3949
3933
  async cancel(reason) {
3950
3934
  await it.return?.(reason);
@@ -4017,8 +4001,7 @@ var XXHashAlgorithm = /* @__PURE__ */ ((XXHashAlgorithm2) => {
4017
4001
  return XXHashAlgorithm2;
4018
4002
  })(XXHashAlgorithm || {});
4019
4003
  function xxhash(value, hashAlgo = 111 /* xxhash64 */, seed = SEED) {
4020
- if (value.buffer)
4021
- value = value.buffer;
4004
+ if (value.buffer) value = value.buffer;
4022
4005
  let result;
4023
4006
  if (hashAlgo !== 112 /* xxhash32 */) {
4024
4007
  result = h64(value, seed);
@@ -4207,8 +4190,7 @@ function isObject(value) {
4207
4190
  return !!value && value.constructor === Object;
4208
4191
  }
4209
4192
  function getKeysPath(value) {
4210
- if (!value)
4211
- return [];
4193
+ if (!value) return [];
4212
4194
  return getKeys(value, [], "");
4213
4195
  }
4214
4196
  function getKeys(obj, paths, dot = ".") {
@@ -4430,31 +4412,38 @@ function jsonFilterToWhere(filter, wrapKey) {
4430
4412
  }
4431
4413
  if (Array.isArray(filter)) {
4432
4414
  andQuery.push(generateAndClause(filter, wrapKey));
4433
- } else
4434
- for (const [key, value] of Object.entries(filter)) {
4435
- if (key === "$and") {
4436
- andQuery.push(`(${generateAndClause(filter[key], wrapKey)})`);
4437
- } else if (key === "$or") {
4438
- andQuery.push(`(${generateOrClause(filter[key], wrapKey)})`);
4415
+ } else for (const [key, value] of Object.entries(filter)) {
4416
+ if (key === "$and") {
4417
+ andQuery.push(`(${generateAndClause(filter[key], wrapKey)})`);
4418
+ } else if (key === "$or") {
4419
+ andQuery.push(`(${generateOrClause(filter[key], wrapKey)})`);
4420
+ } else {
4421
+ const tValue = typeof value;
4422
+ if (value == null) {
4423
+ andQuery.push(`${wrapKey(key)} IS NULL`);
4424
+ } else if (tValue === "object" && !Array.isArray(value)) {
4425
+ andQuery.push(generateCondition(wrapKey(key), value));
4426
+ } else if (tValue === "string") {
4427
+ andQuery.push(`${wrapKey(key)}='${value}'`);
4428
+ } else if (tValue === "number" || tValue === "boolean") {
4429
+ andQuery.push(`${wrapKey(key)}=${value}`);
4439
4430
  } else {
4440
- const tValue = typeof value;
4441
- if (value == null) {
4442
- andQuery.push(`${wrapKey(key)} IS NULL`);
4443
- } else if (tValue === "object" && !Array.isArray(value)) {
4444
- andQuery.push(generateCondition(wrapKey(key), value));
4445
- } else if (tValue === "string") {
4446
- andQuery.push(`${wrapKey(key)}='${value}'`);
4447
- } else if (tValue === "number" || tValue === "boolean") {
4448
- andQuery.push(`${wrapKey(key)}=${value}`);
4449
- } else {
4450
- throw new Error(`Unsupported value type for key ${key}`);
4451
- }
4431
+ throw new Error(`Unsupported value type for key ${key}`);
4452
4432
  }
4453
4433
  }
4434
+ }
4454
4435
  ;
4455
4436
  return andQuery.length > 1 ? andQuery.join(" AND ") : andQuery[0];
4456
4437
  }
4457
4438
 
4439
+ // src/utils/match-url-protocol.ts
4440
+ function matchUrlProtocol(name) {
4441
+ const index = name.indexOf("://");
4442
+ if (index > 0) {
4443
+ return name.substring(0, index);
4444
+ }
4445
+ }
4446
+
4458
4447
  // src/client-tools.ts
4459
4448
  var ClientTools = class _ClientTools extends ToolFunc {
4460
4449
  static get apiRoot() {
@@ -4470,8 +4459,7 @@ var ClientTools = class _ClientTools extends ToolFunc {
4470
4459
  "Content-Type": "application/json"
4471
4460
  } });
4472
4461
  const items = await res.json();
4473
- if (items)
4474
- this.loadFromSync(items);
4462
+ if (items) this.loadFromSync(items);
4475
4463
  } else {
4476
4464
  throwError2("missing apiRoot to load tools", "ClientTools");
4477
4465
  }
@@ -4777,8 +4765,7 @@ var EventClient = class extends ResClientTools {
4777
4765
  for (const event2 of events) {
4778
4766
  if (!this._forwardEvents.has(event2)) {
4779
4767
  this._forwardEvents.add(event2);
4780
- if (this.on)
4781
- this.on(event2, this.ebListener);
4768
+ if (this.on) this.on(event2, this.ebListener);
4782
4769
  }
4783
4770
  }
4784
4771
  }
@@ -4797,8 +4784,7 @@ var EventClient = class extends ResClientTools {
4797
4784
  for (const event2 of events) {
4798
4785
  if (this._forwardEvents.has(event2)) {
4799
4786
  this._forwardEvents.delete(event2);
4800
- if (this.off)
4801
- this.off(event2, this.ebListener);
4787
+ if (this.off) this.off(event2, this.ebListener);
4802
4788
  }
4803
4789
  }
4804
4790
  }
package/dist/funcs.mjs CHANGED
@@ -15,8 +15,8 @@ import {
15
15
  segments,
16
16
  similarity,
17
17
  splitSegments
18
- } from "./chunk-PKECBABP.mjs";
19
- import "./chunk-EZFPVSGF.mjs";
18
+ } from "./chunk-ZXBTGYVX.mjs";
19
+ import "./chunk-U5DDQYSF.mjs";
20
20
  export {
21
21
  EventClient,
22
22
  EventServer,
package/dist/index.d.mts CHANGED
@@ -1094,4 +1094,28 @@ interface JsonFilter {
1094
1094
  */
1095
1095
  declare function jsonFilterToWhere(filter: JsonFilter | JsonFilter[], wrapKey?: (k: string) => string): string;
1096
1096
 
1097
- export { type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamCallbacksAndOptions, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, BaseError, type DotenvExpandOptions, type DotenvExpandOutput, type DotenvParseInput, type DotenvParseOutput, type DotenvPopulateInput, EventBusName, type EventErrorListenerFn, type EventListenerFn, EventName, FStringPromptTemplate, type FStringPromptTemplateNode, FewShotPromptTemplate, type FewShotPromptTemplateOptions, FilenameReservedRegex, GolangPromptTemplate, builtins as HFBuiltins, EnvironmentEx as HFEnvironment, Interpreter as HFInterpreter, Template as HFTemplate, HfPromptTemplate, type JsonFilter, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, filenameReservedRegex, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getResponseErrorReadableStream, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isValidFilename, isValidFilepath, jsonFilterToWhere, loadFileFromPaths, loadTextFromPaths, parseFString, parseJsJson, parseYaml, reControlCharsRegex, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, sortedValues, splitSentence, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
1097
+ /**
1098
+ * Extracts the protocol part from a URL-like string.
1099
+ *
1100
+ * This function checks a given string to find the protocol section of a URL.
1101
+ * If the string contains the sequence '://', it returns the substring from the start of the string
1102
+ * up to the '//' characters. If the sequence is not found, the function returns undefined.
1103
+ *
1104
+ * @param name - The string to inspect, expected to contain a URL.
1105
+ * @returns {string | undefined} - The protocol part if '://' is found; otherwise, undefined.
1106
+ *
1107
+ * @example
1108
+ * // Returns "http"
1109
+ * matchUrlProtocol("http://example.com");
1110
+ *
1111
+ * @example
1112
+ * // Returns "ftp"
1113
+ * matchUrlProtocol("ftp://myftpserver.com");
1114
+ *
1115
+ * @example
1116
+ * // Returns undefined
1117
+ * matchUrlProtocol("noProtocolHere");
1118
+ */
1119
+ declare function matchUrlProtocol(name: string): string | undefined;
1120
+
1121
+ export { type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamCallbacksAndOptions, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, BaseError, type DotenvExpandOptions, type DotenvExpandOutput, type DotenvParseInput, type DotenvParseOutput, type DotenvPopulateInput, EventBusName, type EventErrorListenerFn, type EventListenerFn, EventName, FStringPromptTemplate, type FStringPromptTemplateNode, FewShotPromptTemplate, type FewShotPromptTemplateOptions, FilenameReservedRegex, GolangPromptTemplate, builtins as HFBuiltins, EnvironmentEx as HFEnvironment, Interpreter as HFInterpreter, Template as HFTemplate, HfPromptTemplate, type JsonFilter, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, filenameReservedRegex, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getResponseErrorReadableStream, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isValidFilename, isValidFilepath, jsonFilterToWhere, loadFileFromPaths, loadTextFromPaths, matchUrlProtocol, parseFString, parseJsJson, parseYaml, reControlCharsRegex, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, sortedValues, splitSentence, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
package/dist/index.d.ts CHANGED
@@ -1094,4 +1094,28 @@ interface JsonFilter {
1094
1094
  */
1095
1095
  declare function jsonFilterToWhere(filter: JsonFilter | JsonFilter[], wrapKey?: (k: string) => string): string;
1096
1096
 
1097
- export { type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamCallbacksAndOptions, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, BaseError, type DotenvExpandOptions, type DotenvExpandOutput, type DotenvParseInput, type DotenvParseOutput, type DotenvPopulateInput, EventBusName, type EventErrorListenerFn, type EventListenerFn, EventName, FStringPromptTemplate, type FStringPromptTemplateNode, FewShotPromptTemplate, type FewShotPromptTemplateOptions, FilenameReservedRegex, GolangPromptTemplate, builtins as HFBuiltins, EnvironmentEx as HFEnvironment, Interpreter as HFInterpreter, Template as HFTemplate, HfPromptTemplate, type JsonFilter, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, filenameReservedRegex, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getResponseErrorReadableStream, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isValidFilename, isValidFilepath, jsonFilterToWhere, loadFileFromPaths, loadTextFromPaths, parseFString, parseJsJson, parseYaml, reControlCharsRegex, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, sortedValues, splitSentence, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
1097
+ /**
1098
+ * Extracts the protocol part from a URL-like string.
1099
+ *
1100
+ * This function checks a given string to find the protocol section of a URL.
1101
+ * If the string contains the sequence '://', it returns the substring from the start of the string
1102
+ * up to the '//' characters. If the sequence is not found, the function returns undefined.
1103
+ *
1104
+ * @param name - The string to inspect, expected to contain a URL.
1105
+ * @returns {string | undefined} - The protocol part if '://' is found; otherwise, undefined.
1106
+ *
1107
+ * @example
1108
+ * // Returns "http"
1109
+ * matchUrlProtocol("http://example.com");
1110
+ *
1111
+ * @example
1112
+ * // Returns "ftp"
1113
+ * matchUrlProtocol("ftp://myftpserver.com");
1114
+ *
1115
+ * @example
1116
+ * // Returns undefined
1117
+ * matchUrlProtocol("noProtocolHere");
1118
+ */
1119
+ declare function matchUrlProtocol(name: string): string | undefined;
1120
+
1121
+ export { type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamCallbacksAndOptions, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, BaseError, type DotenvExpandOptions, type DotenvExpandOutput, type DotenvParseInput, type DotenvParseOutput, type DotenvPopulateInput, EventBusName, type EventErrorListenerFn, type EventListenerFn, EventName, FStringPromptTemplate, type FStringPromptTemplateNode, FewShotPromptTemplate, type FewShotPromptTemplateOptions, FilenameReservedRegex, GolangPromptTemplate, builtins as HFBuiltins, EnvironmentEx as HFEnvironment, Interpreter as HFInterpreter, Template as HFTemplate, HfPromptTemplate, type JsonFilter, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, filenameReservedRegex, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getResponseErrorReadableStream, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isValidFilename, isValidFilepath, jsonFilterToWhere, loadFileFromPaths, loadTextFromPaths, matchUrlProtocol, parseFString, parseJsJson, parseYaml, reControlCharsRegex, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, sortedValues, splitSentence, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };