@isdk/ai-tool 0.2.2 → 0.2.3

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 (202) hide show
  1. package/dist/chunk-FLVJ4R53.mjs +1 -0
  2. package/dist/funcs.js +1 -1
  3. package/dist/funcs.mjs +1 -1
  4. package/dist/index.d.mts +33 -2
  5. package/dist/index.d.ts +33 -2
  6. package/dist/index.js +1 -1
  7. package/dist/index.mjs +1 -1
  8. package/docs/classes/CancelableAbility.md +20 -20
  9. package/docs/classes/ClientTools.md +54 -54
  10. package/docs/classes/EventClient.md +76 -76
  11. package/docs/classes/EventServer.md +78 -78
  12. package/docs/classes/EventToolFunc.md +46 -46
  13. package/docs/classes/FStringPromptTemplate.md +18 -18
  14. package/docs/classes/FewShotPromptTemplate.md +22 -22
  15. package/docs/classes/GolangPromptTemplate.md +18 -18
  16. package/docs/classes/HFEnvironment.md +9 -9
  17. package/docs/classes/HFInterpreter.md +4 -4
  18. package/docs/classes/HFTemplate.md +4 -4
  19. package/docs/classes/HfPromptTemplate.md +18 -18
  20. package/docs/classes/IntSet.md +11 -11
  21. package/docs/classes/PromptExampleSelector.md +8 -8
  22. package/docs/classes/PromptTemplate.md +17 -17
  23. package/docs/classes/ReadableStreamError.md +1 -1
  24. package/docs/classes/ResClientTools.md +61 -61
  25. package/docs/classes/ResServerTools.md +62 -62
  26. package/docs/classes/SSEChannel.md +14 -14
  27. package/docs/classes/Semaphore.md +8 -8
  28. package/docs/classes/ServerTools.md +50 -50
  29. package/docs/classes/TaskAbortController.md +7 -7
  30. package/docs/classes/ToolFunc.md +43 -43
  31. package/docs/enumerations/AsyncFeatureBits.md +3 -3
  32. package/docs/enumerations/AsyncFeatures.md +3 -3
  33. package/docs/enumerations/XXHashAlgorithm.md +2 -2
  34. package/docs/functions/AIArgProcessor.md +1 -1
  35. package/docs/functions/AIStream.md +1 -1
  36. package/docs/functions/ChoiceArgProcessor.md +1 -1
  37. package/docs/functions/RateLimit.md +1 -1
  38. package/docs/functions/TemplateArgProcessor.md +1 -1
  39. package/docs/functions/backendEventable.md +1 -1
  40. package/docs/functions/countRegexMatches.md +1 -1
  41. package/docs/functions/createCallbacksTransformer.md +1 -1
  42. package/docs/functions/createEmptyReadableStream.md +1 -1
  43. package/docs/functions/createEndWithRepetitionDetector.md +1 -1
  44. package/docs/functions/createEventStreamTransformer.md +1 -1
  45. package/docs/functions/createHfValueFunc.md +1 -1
  46. package/docs/functions/createLRUCache.md +1 -1
  47. package/docs/functions/dateToText.md +1 -1
  48. package/docs/functions/expandEnv.md +1 -1
  49. package/docs/functions/expandObjEnv.md +1 -1
  50. package/docs/functions/extNameLevel.md +1 -1
  51. package/docs/functions/fileIsExists.md +1 -1
  52. package/docs/functions/filenameReservedRegex.md +1 -1
  53. package/docs/functions/filterValidFnScope.md +1 -1
  54. package/docs/functions/findPort.md +1 -1
  55. package/docs/functions/getAllEnumKeys.md +1 -1
  56. package/docs/functions/getConfigFileNames.md +1 -1
  57. package/docs/functions/getConfigs.md +1 -1
  58. package/docs/functions/getKeysPath.md +1 -1
  59. package/docs/functions/getMultiLevelExtname.md +1 -1
  60. package/docs/functions/getPackageDir.md +1 -1
  61. package/docs/functions/getRealFilepath.md +1 -1
  62. package/docs/functions/getResponseErrorReadableStream.md +1 -1
  63. package/docs/functions/hasDirectoryIn.md +38 -0
  64. package/docs/functions/hfParse.md +1 -1
  65. package/docs/functions/hfTokenize.md +1 -1
  66. package/docs/functions/interpolateEnv.md +1 -1
  67. package/docs/functions/interpolateFString.md +1 -1
  68. package/docs/functions/interpolateGolangTemplate.md +1 -1
  69. package/docs/functions/isModelNameMatched.md +1 -1
  70. package/docs/functions/isRegExp.md +21 -0
  71. package/docs/functions/isSubdirectory.md +39 -0
  72. package/docs/functions/isValidFilename.md +1 -1
  73. package/docs/functions/isValidFilepath.md +1 -1
  74. package/docs/functions/isWebStream.md +1 -1
  75. package/docs/functions/jsonFilterToWhere.md +1 -1
  76. package/docs/functions/jsonToMarkdownStr.md +1 -1
  77. package/docs/functions/loadFileFromPaths.md +1 -1
  78. package/docs/functions/loadTextFromPaths.md +1 -1
  79. package/docs/functions/lrucache.md +1 -1
  80. package/docs/functions/makeToolFuncCancelable.md +1 -1
  81. package/docs/functions/matchUrlProtocol.md +1 -1
  82. package/docs/functions/memoize.md +1 -1
  83. package/docs/functions/messagesToText.md +1 -1
  84. package/docs/functions/paramsSizeToScaleStr.md +1 -1
  85. package/docs/functions/parseCommand.md +1 -1
  86. package/docs/functions/parseFString.md +1 -1
  87. package/docs/functions/parseJsJson.md +1 -1
  88. package/docs/functions/parseObjectArgInfo.md +1 -1
  89. package/docs/functions/parseObjectArgumentInfos.md +1 -1
  90. package/docs/functions/parseObjectArguments.md +1 -1
  91. package/docs/functions/parseObjectArgumentsAsArgInfos.md +1 -1
  92. package/docs/functions/parseYaml.md +1 -1
  93. package/docs/functions/quoteStr.md +1 -1
  94. package/docs/functions/reControlCharsRegex.md +1 -1
  95. package/docs/functions/readFilenamesRecursiveSync.md +1 -1
  96. package/docs/functions/readableFromAsyncIterable.md +1 -1
  97. package/docs/functions/registerCoreTools.md +1 -1
  98. package/docs/functions/registerYamlTag.md +1 -1
  99. package/docs/functions/sanitizeFilename.md +1 -1
  100. package/docs/functions/sanitizeFilepath.md +1 -1
  101. package/docs/functions/saveConfigFile.md +1 -1
  102. package/docs/functions/scaleStrToParamsSize.md +1 -1
  103. package/docs/functions/simplifyObjectArguments.md +1 -1
  104. package/docs/functions/sortedValues.md +1 -1
  105. package/docs/functions/splitSentence.md +1 -1
  106. package/docs/functions/stringifyYaml.md +6 -34
  107. package/docs/functions/textToDate.md +1 -1
  108. package/docs/functions/toDateTime.md +1 -1
  109. package/docs/functions/toRegExp.md +34 -0
  110. package/docs/functions/trimStartOfStreamHelper.md +1 -1
  111. package/docs/functions/truncTo.md +1 -1
  112. package/docs/functions/uuid.md +1 -1
  113. package/docs/functions/wait.md +1 -1
  114. package/docs/functions/xxhash.md +1 -1
  115. package/docs/functions/xxhash32.md +1 -1
  116. package/docs/functions/xxhash64.md +1 -1
  117. package/docs/functions/xxhashAsStr.md +1 -1
  118. package/docs/globals.md +4 -0
  119. package/docs/interfaces/AIChatAssistantMessageParam.md +6 -6
  120. package/docs/interfaces/AIChatContentPartImage.md +2 -2
  121. package/docs/interfaces/AIChatContentPartText.md +2 -2
  122. package/docs/interfaces/AIChatMessageParamBase.md +1 -1
  123. package/docs/interfaces/AIChatMessageToolCall.md +3 -3
  124. package/docs/interfaces/AIChatSystemMessageParam.md +3 -3
  125. package/docs/interfaces/AIChatToolMessageParam.md +4 -4
  126. package/docs/interfaces/AIChatUserMessageParam.md +7 -7
  127. package/docs/interfaces/AIChoiceConfig.md +7 -7
  128. package/docs/interfaces/AIResult.md +5 -5
  129. package/docs/interfaces/AIStreamParser.md +1 -1
  130. package/docs/interfaces/AIStreamParserOptions.md +1 -1
  131. package/docs/interfaces/BaseFunc.md +9 -9
  132. package/docs/interfaces/BaseFuncItem.md +8 -8
  133. package/docs/interfaces/CancelableAbilityOptions.md +2 -2
  134. package/docs/interfaces/ClientFuncItem.md +11 -11
  135. package/docs/interfaces/DotenvExpandOptions.md +3 -3
  136. package/docs/interfaces/DotenvExpandOutput.md +2 -2
  137. package/docs/interfaces/EventClientFuncParams.md +4 -4
  138. package/docs/interfaces/EventServerFuncParams.md +5 -5
  139. package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
  140. package/docs/interfaces/FuncItem.md +9 -9
  141. package/docs/interfaces/FuncParam.md +6 -6
  142. package/docs/interfaces/ParseObjectArgumentOptions.md +5 -5
  143. package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
  144. package/docs/interfaces/PromptTemplateOptions.md +6 -6
  145. package/docs/interfaces/RemoteFuncItem.md +11 -11
  146. package/docs/interfaces/ResClientFuncParams.md +2 -2
  147. package/docs/interfaces/ResServerFuncParams.md +5 -5
  148. package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
  149. package/docs/interfaces/ServerFuncItem.md +12 -12
  150. package/docs/interfaces/ServerFuncParams.md +2 -2
  151. package/docs/interfaces/StreamCallbacksAndOptions.md +4 -4
  152. package/docs/interfaces/TaskPromise.md +1 -1
  153. package/docs/interfaces/ToolFuncPackage.md +3 -3
  154. package/docs/type-aliases/AIChatContentPart.md +1 -1
  155. package/docs/type-aliases/AIChatMessageParam.md +1 -1
  156. package/docs/type-aliases/AIChatRole.md +1 -1
  157. package/docs/type-aliases/AIMessageType.md +1 -1
  158. package/docs/type-aliases/AIModelNameRule.md +1 -1
  159. package/docs/type-aliases/AIModelNameRuleFn.md +1 -1
  160. package/docs/type-aliases/AIModelNameRules.md +1 -1
  161. package/docs/type-aliases/AITextGenerationFinishReason.md +1 -1
  162. package/docs/type-aliases/ActionName.md +1 -1
  163. package/docs/type-aliases/AsyncTaskId.md +1 -1
  164. package/docs/type-aliases/EventErrorListenerFn.md +1 -1
  165. package/docs/type-aliases/EventListenerFn.md +1 -1
  166. package/docs/type-aliases/FStringPromptTemplateNode.md +1 -1
  167. package/docs/type-aliases/FuncParamType.md +1 -1
  168. package/docs/type-aliases/PromptExamples.md +1 -1
  169. package/docs/type-aliases/PromptTemplateType.md +1 -1
  170. package/docs/type-aliases/PromptType.md +1 -1
  171. package/docs/type-aliases/TFunc.md +1 -1
  172. package/docs/variables/AIChatRoles.md +1 -1
  173. package/docs/variables/AIMessageTypes.md +1 -1
  174. package/docs/variables/AITextGenerationFinishReasons.md +1 -1
  175. package/docs/variables/ActionNames.md +1 -1
  176. package/docs/variables/ClientToolFuncSchema.md +1 -1
  177. package/docs/variables/DefaultAsyncSemaphoreCapacity.md +1 -1
  178. package/docs/variables/EventBusName.md +1 -1
  179. package/docs/variables/EventName.md +1 -1
  180. package/docs/variables/FilenameReservedRegex.md +1 -1
  181. package/docs/variables/HFBuiltins.md +1 -1
  182. package/docs/variables/PASSING_SCORE.md +1 -1
  183. package/docs/variables/PromptTemplateTypes.md +1 -1
  184. package/docs/variables/PromptTypes.md +1 -1
  185. package/docs/variables/RStreamErrCode.md +1 -1
  186. package/docs/variables/RemoteToolFuncSchema.md +1 -1
  187. package/docs/variables/ResponseRStreamErrCode.md +1 -1
  188. package/docs/variables/SSEChannelAlreadyClosedErrCode.md +1 -1
  189. package/docs/variables/ServerToolFuncSchema.md +1 -1
  190. package/docs/variables/ToolAsyncCancelableBit.md +1 -1
  191. package/docs/variables/ToolAsyncMultiTaskBit.md +1 -1
  192. package/docs/variables/ToolAsyncPriorityBit.md +1 -1
  193. package/docs/variables/ToolFuncSchema.md +1 -1
  194. package/docs/variables/WindowsReservedNameRegex.md +1 -1
  195. package/docs/variables/base32768.md +1 -1
  196. package/docs/variables/defaultTemplateFormat.md +1 -1
  197. package/docs/variables/event.md +1 -1
  198. package/docs/variables/eventClient.md +1 -1
  199. package/docs/variables/eventServer.md +1 -1
  200. package/docs/variables/lrucache.md +1 -1
  201. package/package.json +1 -1
  202. package/dist/chunk-PY6NRGZE.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as custom_ability from 'custom-ability';
2
2
  import { AbilityOptions } from 'custom-ability';
3
3
  export { createAbilityInjector } from 'custom-ability';
4
+ export { toRegExp } from 'util-ex';
4
5
  import { A as AsyncFeatures, T as ToolFunc, a as AIModelNameRules } from './index-DUEs7T8M.mjs';
5
6
  export { e as AIModelNameRule, d as AIModelNameRuleFn, c as ActionName, b as ActionNames, k as AsyncFeatureBits, p as BaseFunc, B as BaseFuncItem, C as ClientFuncItem, u as ClientToolFuncSchema, t as ClientTools, J as EventClient, I as EventClientFuncParams, M as EventServer, L as EventServerFuncParams, E as EventToolFunc, o as FuncItem, l as FuncParam, F as FuncParamType, m as FuncParams, q as Funcs, P as PASSING_SCORE, f as RemoteFuncItem, R as RemoteToolFuncSchema, O as ResClientFuncParams, Q as ResClientTools, U as ResServerFuncParams, V as ResServerTools, g as SSEChannel, S as SSEChannelAlreadyClosedErrCode, w as ServerFuncItem, v as ServerFuncParams, y as ServerToolFuncSchema, x as ServerTools, n as TFunc, i as ToolAsyncCancelableBit, h as ToolAsyncMultiTaskBit, j as ToolAsyncPriorityBit, r as ToolFuncPackage, s as ToolFuncSchema, _ as _lrucache, G as createLRUCache, D as event, K as eventClient, N as eventServer, H as lrucache, z as registerCoreTools } from './index-DUEs7T8M.mjs';
6
7
  import { CommonError, BaseError } from '@isdk/common-error';
@@ -12,7 +13,6 @@ import _memoize, { Options } from 'memoizee';
12
13
  export { f as findPort } from './find-port-qS1CZ9c-.mjs';
13
14
  export { NIL as uuidNIL, parse as uuidParse, stringify as uuidStringify, validate as uuidValidate, version as uuidVersion, v1 as uuidv1, v4 as uuidv4, v5 as uuidv5 } from 'uuid';
14
15
  export { canonicalize } from 'json-canonicalize';
15
- export { stringify as stringifyYaml } from 'yaml';
16
16
  export { mimeType } from 'mime-type/with-db';
17
17
  export { Config as ConfigFile } from 'load-config-file';
18
18
  export { formatISO, parse as parseDateFormat, parseISO, toDate } from 'date-fns';
@@ -1350,6 +1350,7 @@ declare function getRealFilepath(filepath: string): string;
1350
1350
 
1351
1351
  declare function registerYamlTag(tags: any): void;
1352
1352
  declare function parseYaml(content: string): any;
1353
+ declare function stringifyYaml(content: any): string;
1353
1354
 
1354
1355
  interface ConfigFilesFilter {
1355
1356
  after?: {
@@ -1591,4 +1592,34 @@ declare function memoize<F extends (...args: any[]) => any>(fn: any, options?: O
1591
1592
  */
1592
1593
  declare function getPackageDir(cwd: string): string;
1593
1594
 
1594
- export { AIArgProcessor, type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIChoiceConfig, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, AsyncFeatures, type AsyncTaskId, CancelableAbility, type CancelableAbilityOptions, ChoiceArgProcessor, DefaultAsyncSemaphoreCapacity, 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, IntSet, type JsonFilter, type ParseObjectArgumentOptions, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, RateLimit, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, Semaphore, type StreamCallbacksAndOptions, TaskAbortController, type TaskAbortControllers, type TaskPromise, TemplateArgProcessor, ToolFunc, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, countRegexMatches, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, dateToText, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, fileIsExists, filenameReservedRegex, filterValidFnScope, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getPackageDir, getRealFilepath, getResponseErrorReadableStream, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isValidFilename, isValidFilepath, isWebStream, jsonFilterToWhere, jsonToMarkdownStr, loadFileFromPaths, loadTextFromPaths, makeToolFuncCancelable, matchUrlProtocol, memoize, messagesToText, paramsSizeToScaleStr, parseCommand, parseFString, parseJsJson, parseObjectArgInfo, parseObjectArgumentInfos, parseObjectArguments, parseObjectArgumentsAsArgInfos, parseYaml, quoteStr, reControlCharsRegex, readFilenamesRecursiveSync, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, scaleStrToParamsSize, simplifyObjectArguments, sortedValues, splitSentence, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
1595
+ /**
1596
+ * Determines whether the `childDir` is a subdirectory of `parentDir`.
1597
+ *
1598
+ * @param parentDir - The directory to check as the potential parent.
1599
+ * @param childDir - The directory to check as the potential child.
1600
+ * @returns true if `childDir` is a subdirectory of `parentDir`, otherwise false.
1601
+ *
1602
+ * @example
1603
+ * ```typescript
1604
+ * const parentDir = '/usr/local';
1605
+ * const childDir = '/usr/local/include';
1606
+ * const result = isSubdirectory(parentDir, childDir); // true
1607
+ * ```
1608
+ */
1609
+ declare function isSubdirectory(parentDir: string, childDir: string): boolean;
1610
+ /**
1611
+ * Checks if a given directory is a subdirectory of any directory in the provided array.
1612
+ *
1613
+ * @param dir The directory path to check.
1614
+ * @param dirs An array of directory paths.
1615
+ * @returns true if the given directory is a subdirectory of any directory in the array; otherwise, false.
1616
+ *
1617
+ * @example
1618
+ * // Returns true if 'subdir' is within 'parentdir'
1619
+ * hasDirectoryIn('parentdir/subdir', ['parentdir', 'otherdir']); // true
1620
+ */
1621
+ declare function hasDirectoryIn(dir: string, dirs?: string[]): boolean | undefined;
1622
+
1623
+ declare function isRegExp(value: any): boolean;
1624
+
1625
+ export { AIArgProcessor, type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIChoiceConfig, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, AsyncFeatures, type AsyncTaskId, CancelableAbility, type CancelableAbilityOptions, ChoiceArgProcessor, DefaultAsyncSemaphoreCapacity, 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, IntSet, type JsonFilter, type ParseObjectArgumentOptions, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, RateLimit, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, Semaphore, type StreamCallbacksAndOptions, TaskAbortController, type TaskAbortControllers, type TaskPromise, TemplateArgProcessor, ToolFunc, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, countRegexMatches, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, dateToText, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, fileIsExists, filenameReservedRegex, filterValidFnScope, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getPackageDir, getRealFilepath, getResponseErrorReadableStream, hasDirectoryIn, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isRegExp, isSubdirectory, isValidFilename, isValidFilepath, isWebStream, jsonFilterToWhere, jsonToMarkdownStr, loadFileFromPaths, loadTextFromPaths, makeToolFuncCancelable, matchUrlProtocol, memoize, messagesToText, paramsSizeToScaleStr, parseCommand, parseFString, parseJsJson, parseObjectArgInfo, parseObjectArgumentInfos, parseObjectArguments, parseObjectArgumentsAsArgInfos, parseYaml, quoteStr, reControlCharsRegex, readFilenamesRecursiveSync, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, scaleStrToParamsSize, simplifyObjectArguments, sortedValues, splitSentence, stringifyYaml, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as custom_ability from 'custom-ability';
2
2
  import { AbilityOptions } from 'custom-ability';
3
3
  export { createAbilityInjector } from 'custom-ability';
4
+ export { toRegExp } from 'util-ex';
4
5
  import { A as AsyncFeatures, T as ToolFunc, a as AIModelNameRules } from './index-DUEs7T8M.js';
5
6
  export { e as AIModelNameRule, d as AIModelNameRuleFn, c as ActionName, b as ActionNames, k as AsyncFeatureBits, p as BaseFunc, B as BaseFuncItem, C as ClientFuncItem, u as ClientToolFuncSchema, t as ClientTools, J as EventClient, I as EventClientFuncParams, M as EventServer, L as EventServerFuncParams, E as EventToolFunc, o as FuncItem, l as FuncParam, F as FuncParamType, m as FuncParams, q as Funcs, P as PASSING_SCORE, f as RemoteFuncItem, R as RemoteToolFuncSchema, O as ResClientFuncParams, Q as ResClientTools, U as ResServerFuncParams, V as ResServerTools, g as SSEChannel, S as SSEChannelAlreadyClosedErrCode, w as ServerFuncItem, v as ServerFuncParams, y as ServerToolFuncSchema, x as ServerTools, n as TFunc, i as ToolAsyncCancelableBit, h as ToolAsyncMultiTaskBit, j as ToolAsyncPriorityBit, r as ToolFuncPackage, s as ToolFuncSchema, _ as _lrucache, G as createLRUCache, D as event, K as eventClient, N as eventServer, H as lrucache, z as registerCoreTools } from './index-DUEs7T8M.js';
6
7
  import { CommonError, BaseError } from '@isdk/common-error';
@@ -12,7 +13,6 @@ import _memoize, { Options } from 'memoizee';
12
13
  export { f as findPort } from './find-port-qS1CZ9c-.js';
13
14
  export { NIL as uuidNIL, parse as uuidParse, stringify as uuidStringify, validate as uuidValidate, version as uuidVersion, v1 as uuidv1, v4 as uuidv4, v5 as uuidv5 } from 'uuid';
14
15
  export { canonicalize } from 'json-canonicalize';
15
- export { stringify as stringifyYaml } from 'yaml';
16
16
  export { mimeType } from 'mime-type/with-db';
17
17
  export { Config as ConfigFile } from 'load-config-file';
18
18
  export { formatISO, parse as parseDateFormat, parseISO, toDate } from 'date-fns';
@@ -1350,6 +1350,7 @@ declare function getRealFilepath(filepath: string): string;
1350
1350
 
1351
1351
  declare function registerYamlTag(tags: any): void;
1352
1352
  declare function parseYaml(content: string): any;
1353
+ declare function stringifyYaml(content: any): string;
1353
1354
 
1354
1355
  interface ConfigFilesFilter {
1355
1356
  after?: {
@@ -1591,4 +1592,34 @@ declare function memoize<F extends (...args: any[]) => any>(fn: any, options?: O
1591
1592
  */
1592
1593
  declare function getPackageDir(cwd: string): string;
1593
1594
 
1594
- export { AIArgProcessor, type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIChoiceConfig, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, AsyncFeatures, type AsyncTaskId, CancelableAbility, type CancelableAbilityOptions, ChoiceArgProcessor, DefaultAsyncSemaphoreCapacity, 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, IntSet, type JsonFilter, type ParseObjectArgumentOptions, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, RateLimit, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, Semaphore, type StreamCallbacksAndOptions, TaskAbortController, type TaskAbortControllers, type TaskPromise, TemplateArgProcessor, ToolFunc, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, countRegexMatches, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, dateToText, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, fileIsExists, filenameReservedRegex, filterValidFnScope, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getPackageDir, getRealFilepath, getResponseErrorReadableStream, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isValidFilename, isValidFilepath, isWebStream, jsonFilterToWhere, jsonToMarkdownStr, loadFileFromPaths, loadTextFromPaths, makeToolFuncCancelable, matchUrlProtocol, memoize, messagesToText, paramsSizeToScaleStr, parseCommand, parseFString, parseJsJson, parseObjectArgInfo, parseObjectArgumentInfos, parseObjectArguments, parseObjectArgumentsAsArgInfos, parseYaml, quoteStr, reControlCharsRegex, readFilenamesRecursiveSync, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, scaleStrToParamsSize, simplifyObjectArguments, sortedValues, splitSentence, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
1595
+ /**
1596
+ * Determines whether the `childDir` is a subdirectory of `parentDir`.
1597
+ *
1598
+ * @param parentDir - The directory to check as the potential parent.
1599
+ * @param childDir - The directory to check as the potential child.
1600
+ * @returns true if `childDir` is a subdirectory of `parentDir`, otherwise false.
1601
+ *
1602
+ * @example
1603
+ * ```typescript
1604
+ * const parentDir = '/usr/local';
1605
+ * const childDir = '/usr/local/include';
1606
+ * const result = isSubdirectory(parentDir, childDir); // true
1607
+ * ```
1608
+ */
1609
+ declare function isSubdirectory(parentDir: string, childDir: string): boolean;
1610
+ /**
1611
+ * Checks if a given directory is a subdirectory of any directory in the provided array.
1612
+ *
1613
+ * @param dir The directory path to check.
1614
+ * @param dirs An array of directory paths.
1615
+ * @returns true if the given directory is a subdirectory of any directory in the array; otherwise, false.
1616
+ *
1617
+ * @example
1618
+ * // Returns true if 'subdir' is within 'parentdir'
1619
+ * hasDirectoryIn('parentdir/subdir', ['parentdir', 'otherdir']); // true
1620
+ */
1621
+ declare function hasDirectoryIn(dir: string, dirs?: string[]): boolean | undefined;
1622
+
1623
+ declare function isRegExp(value: any): boolean;
1624
+
1625
+ export { AIArgProcessor, type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIChoiceConfig, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, AsyncFeatures, type AsyncTaskId, CancelableAbility, type CancelableAbilityOptions, ChoiceArgProcessor, DefaultAsyncSemaphoreCapacity, 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, IntSet, type JsonFilter, type ParseObjectArgumentOptions, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, RateLimit, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, Semaphore, type StreamCallbacksAndOptions, TaskAbortController, type TaskAbortControllers, type TaskPromise, TemplateArgProcessor, ToolFunc, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, countRegexMatches, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, dateToText, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, fileIsExists, filenameReservedRegex, filterValidFnScope, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getPackageDir, getRealFilepath, getResponseErrorReadableStream, hasDirectoryIn, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isRegExp, isSubdirectory, isValidFilename, isValidFilepath, isWebStream, jsonFilterToWhere, jsonToMarkdownStr, loadFileFromPaths, loadTextFromPaths, makeToolFuncCancelable, matchUrlProtocol, memoize, messagesToText, paramsSizeToScaleStr, parseCommand, parseFString, parseJsJson, parseObjectArgInfo, parseObjectArgumentInfos, parseObjectArguments, parseObjectArgumentsAsArgInfos, parseYaml, quoteStr, reControlCharsRegex, readFilenamesRecursiveSync, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, scaleStrToParamsSize, simplifyObjectArguments, sortedValues, splitSentence, stringifyYaml, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };