@isdk/ai-tool 0.8.2 → 0.9.0

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 (405) hide show
  1. package/dist/chunk-BIJ2JH4U.mjs +1 -0
  2. package/dist/chunk-OYMVHUDZ.mjs +1 -0
  3. package/dist/funcs.d.mts +16 -5
  4. package/dist/funcs.d.ts +16 -5
  5. package/dist/funcs.js +1 -1
  6. package/dist/funcs.mjs +1 -1
  7. package/dist/index.d.mts +839 -563
  8. package/dist/index.d.ts +839 -563
  9. package/dist/index.js +1 -1
  10. package/dist/index.mjs +1 -1
  11. package/dist/test/util.d.mts +1 -1
  12. package/dist/test/util.d.ts +1 -1
  13. package/dist/test/util.js +1 -1
  14. package/dist/test/util.mjs +1 -1
  15. package/docs/api/@isdk/namespaces/ClientTools/README.md +11 -0
  16. package/docs/api/@isdk/namespaces/ClientTools/functions/get.md +27 -0
  17. package/docs/api/@isdk/namespaces/EventStates/variables/ABORT.md +1 -1
  18. package/docs/api/@isdk/namespaces/EventStates/variables/CONTINUE.md +1 -1
  19. package/docs/api/@isdk/namespaces/EventStates/variables/DONE.md +1 -1
  20. package/docs/api/@isdk/namespaces/EventStates/variables/STOPPED.md +1 -1
  21. package/docs/api/classes/BinarySemaphore.md +148 -67
  22. package/docs/api/classes/CancelableAbility.md +95 -43
  23. package/docs/api/classes/ClientToolTransport.md +31 -16
  24. package/docs/api/classes/ClientTools.md +868 -158
  25. package/docs/api/classes/CmdArgLexer.md +82 -0
  26. package/docs/api/classes/CmdArgParser.md +56 -0
  27. package/docs/api/classes/ConfigFile.md +6 -6
  28. package/docs/api/classes/EnvPromptTemplate.md +224 -52
  29. package/docs/api/classes/EventClient.md +902 -192
  30. package/docs/api/classes/EventEmitter.md +62 -12
  31. package/docs/api/classes/EventServer.md +895 -182
  32. package/docs/api/classes/EventToolFunc.md +801 -123
  33. package/docs/api/classes/FStringPromptTemplate.md +224 -52
  34. package/docs/api/classes/FewShotPromptTemplate.md +231 -59
  35. package/docs/api/classes/GolangPromptTemplate.md +224 -52
  36. package/docs/api/classes/HttpClientToolTransport.md +33 -19
  37. package/docs/api/classes/HttpServerToolTransport.md +15 -15
  38. package/docs/api/classes/IntSet.md +21 -21
  39. package/docs/api/classes/MailboxClientTransport.md +398 -0
  40. package/docs/api/classes/MailboxServerTransport.md +433 -0
  41. package/docs/api/classes/PromptExampleSelector.md +11 -11
  42. package/docs/api/classes/PromptTemplate.md +199 -51
  43. package/docs/api/classes/ReadableStreamError.md +2 -2
  44. package/docs/api/classes/ResClientTools.md +875 -165
  45. package/docs/api/classes/ResServerTools.md +869 -156
  46. package/docs/api/classes/RpcMethodsClientTool.md +870 -160
  47. package/docs/api/classes/RpcMethodsServerTool.md +865 -152
  48. package/docs/api/classes/SSEChannel.md +23 -23
  49. package/docs/api/classes/Semaphore.md +148 -76
  50. package/docs/api/classes/ServerToolTransport.md +14 -13
  51. package/docs/api/classes/ServerTools.md +854 -138
  52. package/docs/api/classes/SignalGate.md +12 -12
  53. package/docs/api/classes/SseClientPubSubTransport.md +4 -4
  54. package/docs/api/classes/SseServerPubSubTransport.md +13 -13
  55. package/docs/api/classes/TaskAbortController.md +33 -11
  56. package/docs/api/classes/ToolFunc.md +725 -119
  57. package/docs/api/classes/ToolTransport.md +7 -7
  58. package/docs/api/classes/YamlTypeBaseObject.md +2 -2
  59. package/docs/api/enumerations/AsyncFeatureBits.md +4 -4
  60. package/docs/api/enumerations/AsyncFeatures.md +4 -4
  61. package/docs/api/enumerations/CmdArgTokenType.md +129 -0
  62. package/docs/api/enumerations/HashAlgorithm.md +38 -12
  63. package/docs/api/functions/AIArgProcessor.md +8 -17
  64. package/docs/api/functions/AIStream.md +1 -1
  65. package/docs/api/functions/ChoiceArgProcessor.md +13 -15
  66. package/docs/api/functions/DefaultDateFormat.md +1 -1
  67. package/docs/api/functions/ObjectArgsToArgsInfo.md +11 -9
  68. package/docs/api/functions/RateLimit.md +33 -6
  69. package/docs/api/functions/TemplateArgProcessor.md +13 -15
  70. package/docs/api/functions/assignDirs.md +1 -1
  71. package/docs/api/functions/beforeShutdown.md +3 -3
  72. package/docs/api/functions/calcPerplexity.md +3 -3
  73. package/docs/api/functions/calcPerplexitySimple.md +3 -3
  74. package/docs/api/functions/cmdArgEvaluate.md +28 -0
  75. package/docs/api/functions/cmdArgsToMergedObject.md +34 -0
  76. package/docs/api/functions/completeSentences.md +1 -1
  77. package/docs/api/functions/concatText.md +1 -1
  78. package/docs/api/functions/countLLMTokens.md +1 -1
  79. package/docs/api/functions/countRegexMatches.md +1 -1
  80. package/docs/api/functions/createCallbacksTransformer.md +23 -19
  81. package/docs/api/functions/createEmptyReadableStream.md +1 -1
  82. package/docs/api/functions/createEndWithRepetitionDetector.md +4 -4
  83. package/docs/api/functions/createEventStreamTransformer.md +1 -1
  84. package/docs/api/functions/createHfValueFunc.md +1 -1
  85. package/docs/api/functions/createLRUCache.md +1 -1
  86. package/docs/api/functions/createYamlObjectTag.md +1 -1
  87. package/docs/api/functions/dateToText.md +1 -1
  88. package/docs/api/functions/decodeCharset.md +1 -1
  89. package/docs/api/functions/defaultsWithConcat.md +1 -1
  90. package/docs/api/functions/detectCharset.md +1 -1
  91. package/docs/api/functions/encodeLLMTokens.md +1 -1
  92. package/docs/api/functions/ensureQuoted.md +3 -1
  93. package/docs/api/functions/evaluateExpression.md +40 -0
  94. package/docs/api/functions/eventable.md +1 -1
  95. package/docs/api/functions/expandConfig.md +1 -1
  96. package/docs/api/functions/expandEnv.md +1 -1
  97. package/docs/api/functions/expandObjEnv.md +1 -1
  98. package/docs/api/functions/expandPath.md +1 -1
  99. package/docs/api/functions/expandPathInObject.md +1 -1
  100. package/docs/api/functions/expandPaths.md +1 -1
  101. package/docs/api/functions/extNameLevel.md +1 -1
  102. package/docs/api/functions/extractCodeBlock.md +51 -0
  103. package/docs/api/functions/fileIsExists.md +3 -3
  104. package/docs/api/functions/filterValidFnScope.md +3 -3
  105. package/docs/api/functions/findIndexNonEmptyFrom.md +1 -1
  106. package/docs/api/functions/findPort.md +13 -5
  107. package/docs/api/functions/formatTextWithSpace.md +1 -1
  108. package/docs/api/functions/funcGetMeta.md +1 -1
  109. package/docs/api/functions/funcWithMeta.md +4 -4
  110. package/docs/api/functions/genUrlParamsStr.md +1 -1
  111. package/docs/api/functions/getAllEnumKeys.md +1 -1
  112. package/docs/api/functions/getConfigFileNames.md +1 -1
  113. package/docs/api/functions/getConfigs.md +1 -1
  114. package/docs/api/functions/getEnvVairables.md +1 -1
  115. package/docs/api/functions/getFileMetaInfo.md +1 -1
  116. package/docs/api/functions/getHashAlgoBySize.md +1 -1
  117. package/docs/api/functions/getKeysPath.md +1 -1
  118. package/docs/api/functions/getLLMTokenizer.md +1 -1
  119. package/docs/api/functions/getMultiLevelExtname.md +1 -1
  120. package/docs/api/functions/getPackageDir.md +1 -1
  121. package/docs/api/functions/getRealFilepath.md +1 -1
  122. package/docs/api/functions/getResponseErrorReadableStream.md +2 -2
  123. package/docs/api/functions/getXDGConfigs.md +1 -1
  124. package/docs/api/functions/hasDirectoryIn.md +3 -3
  125. package/docs/api/functions/hash.md +25 -4
  126. package/docs/api/functions/hashFile.md +1 -1
  127. package/docs/api/functions/hashObject.md +23 -1
  128. package/docs/api/functions/hashStream.md +25 -4
  129. package/docs/api/functions/initShutdown.md +1 -1
  130. package/docs/api/functions/isIdentifier.md +30 -0
  131. package/docs/api/functions/isLangUsingSpaces.md +1 -1
  132. package/docs/api/functions/isListItemString.md +3 -3
  133. package/docs/api/functions/isModelNameMatched.md +3 -3
  134. package/docs/api/functions/isPathIdentifier.md +23 -0
  135. package/docs/api/functions/isPunctuationChar.md +1 -1
  136. package/docs/api/functions/isQuoted.md +4 -1
  137. package/docs/api/functions/isRegExp.md +20 -1
  138. package/docs/api/functions/isSameString.md +1 -1
  139. package/docs/api/functions/isSectionString.md +3 -3
  140. package/docs/api/functions/isSentenceEnding.md +1 -1
  141. package/docs/api/functions/isSepLineString.md +3 -3
  142. package/docs/api/functions/isStrWrapped.md +3 -1
  143. package/docs/api/functions/isSubdirectory.md +1 -1
  144. package/docs/api/functions/isTitleString.md +3 -3
  145. package/docs/api/functions/isValidFilename.md +1 -1
  146. package/docs/api/functions/isValidFilepath.md +1 -1
  147. package/docs/api/functions/isWebStream.md +1 -1
  148. package/docs/api/functions/joinSplitWords.md +1 -1
  149. package/docs/api/functions/jsonFilterToWhere.md +1 -1
  150. package/docs/api/functions/jsonToMarkdownStr.md +1 -1
  151. package/docs/api/functions/loadAIConfig.md +1 -1
  152. package/docs/api/functions/loadConfig.md +1 -1
  153. package/docs/api/functions/loadConfigFile.md +1 -1
  154. package/docs/api/functions/loadFileFromPaths.md +1 -1
  155. package/docs/api/functions/loadTextFromPaths.md +1 -1
  156. package/docs/api/functions/lrucache.md +1 -1
  157. package/docs/api/functions/matchUrlProtocol.md +3 -3
  158. package/docs/api/functions/memoize.md +1 -1
  159. package/docs/api/functions/mergeArray.md +1 -1
  160. package/docs/api/functions/messagesToText.md +1 -1
  161. package/docs/api/functions/normalizePath.md +1 -1
  162. package/docs/api/functions/paramsSizeToScaleStr.md +1 -1
  163. package/docs/api/functions/parseCommand.md +21 -4
  164. package/docs/api/functions/parseJsJson.md +1 -1
  165. package/docs/api/functions/parseJsJsonSimpleSync.md +1 -1
  166. package/docs/api/functions/parseObjectArguments.md +17 -33
  167. package/docs/api/functions/parseYaml.md +1 -1
  168. package/docs/api/functions/prependNewlineIfMultiline.md +39 -0
  169. package/docs/api/functions/pruneSubdirectories.md +1 -1
  170. package/docs/api/functions/pruneSubdirectoriesInPlace.md +1 -1
  171. package/docs/api/functions/quoteStr.md +4 -1
  172. package/docs/api/functions/readFilenamesRecursiveSync.md +1 -1
  173. package/docs/api/functions/readTextFileChunks.md +1 -1
  174. package/docs/api/functions/readTextFileChunksEx.md +1 -1
  175. package/docs/api/functions/readableFromAsyncIterable.md +1 -1
  176. package/docs/api/functions/registerCoreTools.md +1 -1
  177. package/docs/api/functions/registerYamlTag.md +2 -2
  178. package/docs/api/functions/removeMarkdownBold.md +1 -1
  179. package/docs/api/functions/removeMarkdownBoldAndItalic.md +1 -1
  180. package/docs/api/functions/removeMarkdownItalic.md +1 -1
  181. package/docs/api/functions/replaceWithPlaceholder.md +3 -18
  182. package/docs/api/functions/restoreFromPlacehoders.md +2 -20
  183. package/docs/api/functions/sanitizeFilename.md +1 -1
  184. package/docs/api/functions/sanitizeFilepath.md +1 -1
  185. package/docs/api/functions/saveConfigFile.md +1 -1
  186. package/docs/api/functions/scaleStrToParamsSize.md +1 -1
  187. package/docs/api/functions/shutdown.md +2 -2
  188. package/docs/api/functions/simplifyObjectArguments.md +4 -1
  189. package/docs/api/functions/simplifyResult.md +34 -0
  190. package/docs/api/functions/sleep.md +1 -1
  191. package/docs/api/functions/sortedValues.md +1 -1
  192. package/docs/api/functions/splitChunks.md +1 -1
  193. package/docs/api/functions/splitParagraph.md +1 -1
  194. package/docs/api/functions/splitSentence.md +1 -1
  195. package/docs/api/functions/splitWords.md +1 -1
  196. package/docs/api/functions/stringifyYaml.md +1 -1
  197. package/docs/api/functions/stripConsoleColor.md +1 -1
  198. package/docs/api/functions/textToDate.md +1 -1
  199. package/docs/api/functions/textify.md +43 -0
  200. package/docs/api/functions/toDateTime.md +3 -3
  201. package/docs/api/functions/toRegExp.md +1 -1
  202. package/docs/api/functions/trimStartOfStreamHelper.md +1 -1
  203. package/docs/api/functions/truncTo.md +1 -1
  204. package/docs/api/functions/truncateByToken.md +1 -1
  205. package/docs/api/functions/truncateToTokenLimit.md +1 -1
  206. package/docs/api/functions/truncateToTokenLimitEx.md +1 -1
  207. package/docs/api/functions/uuid.md +1 -1
  208. package/docs/api/functions/wrapEventEmitter.md +1 -1
  209. package/docs/api/functions/wrapFlagValue.md +29 -0
  210. package/docs/api/functions/xxhash.md +27 -6
  211. package/docs/api/functions/xxhash32.md +22 -4
  212. package/docs/api/functions/xxhash64.md +22 -4
  213. package/docs/api/functions/xxhashAsStr.md +27 -6
  214. package/docs/api/functions/yieldExec.md +1 -1
  215. package/docs/api/globals.md +51 -18
  216. package/docs/api/interfaces/AIChatAssistantMessageParam.md +14 -14
  217. package/docs/api/interfaces/AIChatContentPartBase.md +26 -0
  218. package/docs/api/interfaces/AIChatContentPartImage.md +15 -3
  219. package/docs/api/interfaces/AIChatContentPartText.md +15 -3
  220. package/docs/api/interfaces/AIChatMessageParamBase.md +9 -9
  221. package/docs/api/interfaces/AIChatMessageToolCall.md +12 -8
  222. package/docs/api/interfaces/AIChatSystemMessageParam.md +10 -10
  223. package/docs/api/interfaces/AIChatToolChoiceFuncObject.md +3 -3
  224. package/docs/api/interfaces/AIChatToolChoiceObject.md +2 -2
  225. package/docs/api/interfaces/AIChatToolDefinition.md +45 -0
  226. package/docs/api/interfaces/AIChatToolFunc.md +5 -5
  227. package/docs/api/interfaces/AIChatToolFuncParam.md +3 -3
  228. package/docs/api/interfaces/AIChatToolMessageParam.md +13 -13
  229. package/docs/api/interfaces/AIChatToolParam.md +2 -2
  230. package/docs/api/interfaces/AIChatToolTypeObject.md +2 -2
  231. package/docs/api/interfaces/AIChatUserMessageParam.md +14 -14
  232. package/docs/api/interfaces/AIResult.md +7 -7
  233. package/docs/api/interfaces/AIStreamParser.md +2 -2
  234. package/docs/api/interfaces/AIStreamParserOptions.md +2 -2
  235. package/docs/api/interfaces/BaseFunc.md +15 -15
  236. package/docs/api/interfaces/BaseFuncItem.md +16 -16
  237. package/docs/api/interfaces/BinarySemaphoreAcquireOptions.md +9 -2
  238. package/docs/api/interfaces/BinarySemaphoreOptions.md +22 -5
  239. package/docs/api/interfaces/BinarySemaphoreReleaseOptions.md +7 -5
  240. package/docs/api/interfaces/CancelableAbilityOptions.md +4 -4
  241. package/docs/api/interfaces/ClientFuncItem.md +70 -19
  242. package/docs/api/interfaces/CmdArgAIChoiceConfig.md +97 -0
  243. package/docs/api/interfaces/CmdArgArgsInfo.md +31 -0
  244. package/docs/api/interfaces/CmdArgContext.md +103 -0
  245. package/docs/api/interfaces/CmdArgFlagMetadata.md +21 -0
  246. package/docs/api/interfaces/CmdArgMapResult.md +41 -0
  247. package/docs/api/interfaces/CmdArgParseResult.md +51 -0
  248. package/docs/api/interfaces/CmdArgParsedCommand.md +41 -0
  249. package/docs/api/interfaces/CmdArgParserOptions.md +225 -0
  250. package/docs/api/interfaces/CmdArgProcessorResultOptions.md +22 -0
  251. package/docs/api/interfaces/CmdArgSimplifyOptions.md +101 -0
  252. package/docs/api/interfaces/CmdArgToken.md +51 -0
  253. package/docs/api/interfaces/EventClientFuncParams.md +5 -5
  254. package/docs/api/interfaces/EventServerFuncParams.md +21 -7
  255. package/docs/api/interfaces/FewShotPromptTemplateOptions.md +18 -6
  256. package/docs/api/interfaces/FuncItem.md +19 -15
  257. package/docs/api/interfaces/FuncParam.md +5 -5
  258. package/docs/api/interfaces/FuncParams.md +1 -1
  259. package/docs/api/interfaces/Funcs.md +1 -1
  260. package/docs/api/interfaces/HashAlgoParams.md +36 -5
  261. package/docs/api/interfaces/IClientToolTransport.md +24 -10
  262. package/docs/api/interfaces/IFileMetaInfo.md +8 -8
  263. package/docs/api/interfaces/IPubSubClientTransport.md +4 -4
  264. package/docs/api/interfaces/IPubSubServerTransport.md +14 -14
  265. package/docs/api/interfaces/IReadTextFileChunksOptions.md +11 -11
  266. package/docs/api/interfaces/IServerToolTransport.md +8 -8
  267. package/docs/api/interfaces/IToolTransport.md +5 -5
  268. package/docs/api/interfaces/ITruncateToTokenLimitOptions.md +10 -10
  269. package/docs/api/interfaces/JsonFilter.md +1 -1
  270. package/docs/api/interfaces/MailboxClientOptions.md +74 -0
  271. package/docs/api/interfaces/MailboxServerOptions.md +69 -0
  272. package/docs/api/interfaces/ProbabilityItem.md +4 -4
  273. package/docs/api/interfaces/PromptExampleSelectorOptions.md +3 -3
  274. package/docs/api/interfaces/PromptTemplateOptions.md +8 -0
  275. package/docs/api/interfaces/PubSubClientStream.md +11 -11
  276. package/docs/api/interfaces/PubSubServerSession.md +8 -8
  277. package/docs/api/interfaces/RegisterOptions.md +298 -0
  278. package/docs/api/interfaces/RemoteFuncItem.md +63 -20
  279. package/docs/api/interfaces/ReplacePlacehoderOptions.md +5 -5
  280. package/docs/api/interfaces/ResClientFuncParams.md +3 -3
  281. package/docs/api/interfaces/ResServerFuncParams.md +20 -6
  282. package/docs/api/interfaces/RpcMethodsClientFuncParams.md +2 -2
  283. package/docs/api/interfaces/RpcMethodsServerFuncParams.md +18 -4
  284. package/docs/api/interfaces/SanitizeFilenameOptions.md +3 -3
  285. package/docs/api/interfaces/SectionStringOptions.md +3 -3
  286. package/docs/api/interfaces/SemaphoreOptions.md +30 -7
  287. package/docs/api/interfaces/SemaphoreTaskItem.md +18 -5
  288. package/docs/api/interfaces/ServerFuncItem.md +71 -20
  289. package/docs/api/interfaces/ServerFuncParams.md +14 -4
  290. package/docs/api/interfaces/SplitSentenceOptions.md +5 -5
  291. package/docs/api/interfaces/StreamCallbacksAndOptions.md +80 -7
  292. package/docs/api/interfaces/TaskAbortControllers.md +2 -2
  293. package/docs/api/interfaces/TaskPromise.md +6 -6
  294. package/docs/api/interfaces/TextifyInlineOptions.md +51 -0
  295. package/docs/api/interfaces/TextifyOptions.md +108 -0
  296. package/docs/api/interfaces/ToolFuncContext.md +73 -0
  297. package/docs/api/interfaces/ToolFuncPackage.md +4 -4
  298. package/docs/api/interfaces/ToolFuncRegistryIsolateOptions.md +41 -0
  299. package/docs/api/interfaces/UnregisterOptions.md +56 -0
  300. package/docs/api/type-aliases/AIChatContentPart.md +2 -2
  301. package/docs/api/type-aliases/AIChatMessageParam.md +1 -1
  302. package/docs/api/type-aliases/AIChatRole.md +2 -2
  303. package/docs/api/type-aliases/AIChatTemplateCaps.md +239 -0
  304. package/docs/api/type-aliases/AIChatToolChoiceParam.md +1 -1
  305. package/docs/api/type-aliases/AIMessageType.md +1 -1
  306. package/docs/api/type-aliases/AIModelNameRule.md +1 -1
  307. package/docs/api/type-aliases/AIModelNameRuleFn.md +1 -1
  308. package/docs/api/type-aliases/AIModelNameRules.md +1 -1
  309. package/docs/api/type-aliases/AITextGenerationFinishReason.md +1 -1
  310. package/docs/api/type-aliases/ActionName.md +1 -1
  311. package/docs/api/type-aliases/ArgProcessor.md +24 -0
  312. package/docs/api/type-aliases/ArrayMergeWay.md +1 -1
  313. package/docs/api/type-aliases/AsyncTaskId.md +1 -1
  314. package/docs/api/type-aliases/BeforeShutdownListener.md +1 -1
  315. package/docs/api/type-aliases/CmdArgFlagValue.md +14 -0
  316. package/docs/api/type-aliases/CmdArgFlagsRecord.md +13 -0
  317. package/docs/api/type-aliases/EventErrorListenerFn.md +1 -1
  318. package/docs/api/type-aliases/EventListenerFn.md +1 -1
  319. package/docs/api/type-aliases/FuncParamType.md +1 -1
  320. package/docs/api/type-aliases/PromptExamples.md +1 -1
  321. package/docs/api/type-aliases/PubSubClientId.md +1 -1
  322. package/docs/api/type-aliases/PubSubCtx.md +6 -6
  323. package/docs/api/type-aliases/RpcMethodHandler.md +1 -1
  324. package/docs/api/type-aliases/SSEClient.md +5 -5
  325. package/docs/api/type-aliases/SemaphoreIsReadyFuncType.md +4 -1
  326. package/docs/api/type-aliases/SimplifiedResultType.md +14 -0
  327. package/docs/api/type-aliases/StreamCloseStatus.md +16 -0
  328. package/docs/api/type-aliases/TFunc.md +1 -1
  329. package/docs/api/type-aliases/TextifyInlineStyleMode.md +16 -0
  330. package/docs/api/type-aliases/TextifyStringQuoting.md +16 -0
  331. package/docs/api/type-aliases/UUIDVersions.md +3 -1
  332. package/docs/api/variables/AIChatRoles.md +2 -2
  333. package/docs/api/variables/AIMessageTypes.md +1 -1
  334. package/docs/api/variables/AITextGenerationFinishReasons.md +1 -1
  335. package/docs/api/variables/ActionNames.md +1 -1
  336. package/docs/api/variables/ArrayMergeWay.md +1 -1
  337. package/docs/api/variables/ArrayMergeWaySymbol.md +1 -1
  338. package/docs/api/variables/CMD_ARG_FLAG_SYMBOL.md +21 -0
  339. package/docs/api/variables/CMD_ARG_PROCESSOR_RESULT.md +22 -0
  340. package/docs/api/variables/CMD_ARG_UNRESOLVED_SYMBOL.md +16 -0
  341. package/docs/api/variables/ClientEventPrefix.md +2 -2
  342. package/docs/api/variables/ClientToolFuncSchema.md +27 -17
  343. package/docs/api/variables/DEFAULT_CONFIG_NAME.md +1 -1
  344. package/docs/api/variables/DefaultAsyncSemaphoreCapacity.md +4 -1
  345. package/docs/api/variables/EventBusName.md +2 -2
  346. package/docs/api/variables/EventName.md +2 -2
  347. package/docs/api/variables/FilenameReservedRegex.md +1 -1
  348. package/docs/api/variables/FuncMetaSymbol.md +2 -2
  349. package/docs/api/variables/IDENTIFIER_REGEX.md +14 -0
  350. package/docs/api/variables/LLM_TOKENIZER_NAMES.md +1 -1
  351. package/docs/api/variables/LLM_TOKENIZER_NAMES_MAP.md +1 -1
  352. package/docs/api/variables/PASSING_SCORE.md +1 -1
  353. package/docs/api/variables/PATH_IDENTIFIER_REGEX.md +13 -0
  354. package/docs/api/variables/RESERVED_WORDS.md +13 -0
  355. package/docs/api/variables/RStreamErrCode.md +1 -1
  356. package/docs/api/variables/RemoteToolFuncSchema.md +36 -4
  357. package/docs/api/variables/ResponseRStreamErrCode.md +1 -1
  358. package/docs/api/variables/RpcMethodsClientToolSchema.md +2 -2
  359. package/docs/api/variables/RpcMethodsServerToolSchema.md +2 -2
  360. package/docs/api/variables/SHUTDOWN_SIGNALS.md +1 -1
  361. package/docs/api/variables/SSEChannelAlreadyClosedErrCode.md +1 -1
  362. package/docs/api/variables/SecondaryCache.md +1 -1
  363. package/docs/api/variables/ServerToolFuncSchema.md +27 -17
  364. package/docs/api/variables/StrangeHumanName.md +1 -1
  365. package/docs/api/variables/ToolAsyncCancelableBit.md +1 -1
  366. package/docs/api/variables/ToolAsyncMultiTaskBit.md +1 -1
  367. package/docs/api/variables/ToolAsyncPriorityBit.md +1 -1
  368. package/docs/api/variables/ToolFuncSchema.md +13 -13
  369. package/docs/api/variables/WindowsReservedNameRegex.md +1 -1
  370. package/docs/api/variables/backendEventable.md +23 -3
  371. package/docs/api/variables/base32768.md +2 -2
  372. package/docs/api/variables/event.md +1 -1
  373. package/docs/api/variables/eventClient.md +1 -1
  374. package/docs/api/variables/eventServer.md +1 -1
  375. package/docs/api/variables/lrucache.md +1 -1
  376. package/docs/api/variables/makeToolFuncCancelable.md +23 -3
  377. package/docs/api/variables/wait.md +1 -1
  378. package/docs/transport.dev.md +206 -0
  379. package/package.json +12 -10
  380. package/dist/chunk-4FKBOPZI.mjs +0 -1
  381. package/dist/chunk-TGTHY57V.mjs +0 -1
  382. package/dist/find-port-qS1CZ9c-.d.mts +0 -3
  383. package/dist/find-port-qS1CZ9c-.d.ts +0 -3
  384. package/dist/index-BLW3R7VS.d.mts +0 -1826
  385. package/dist/index-BLW3R7VS.d.ts +0 -1826
  386. package/docs/api/@isdk/namespaces/uuidv5/README.md +0 -12
  387. package/docs/api/@isdk/namespaces/uuidv5/variables/DNS.md +0 -11
  388. package/docs/api/@isdk/namespaces/uuidv5/variables/URL.md +0 -11
  389. package/docs/api/functions/nanoid.md +0 -45
  390. package/docs/api/functions/parseObjectArgInfo.md +0 -33
  391. package/docs/api/functions/parseObjectArgumentInfos.md +0 -29
  392. package/docs/api/functions/parseObjectArgumentsAsArgInfos.md +0 -46
  393. package/docs/api/functions/uuidParse.md +0 -21
  394. package/docs/api/functions/uuidStringify.md +0 -25
  395. package/docs/api/functions/uuidValidate.md +0 -21
  396. package/docs/api/functions/uuidVersion.md +0 -21
  397. package/docs/api/functions/uuidv1.md +0 -61
  398. package/docs/api/functions/uuidv4.md +0 -61
  399. package/docs/api/functions/uuidv5.md +0 -69
  400. package/docs/api/functions/uuidv6.md +0 -61
  401. package/docs/api/functions/uuidv7.md +0 -61
  402. package/docs/api/interfaces/AIChoiceConfig.md +0 -65
  403. package/docs/api/interfaces/BinarySemaphoreReleaserFunc.md +0 -37
  404. package/docs/api/interfaces/ParseObjectArgumentOptions.md +0 -89
  405. package/docs/api/variables/uuidNIL.md +0 -11
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: ToolFunc
8
8
 
9
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:236](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L236)
9
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:412
10
10
 
11
11
  A manager for creating, registering, and executing reusable tool functions.
12
12
 
@@ -83,10 +83,13 @@ main();
83
83
 
84
84
  > **new ToolFunc**(`name`, `options?`): `ToolFunc`
85
85
 
86
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:571](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L571)
86
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:751
87
87
 
88
88
  Initializes a new `ToolFunc` instance.
89
89
 
90
+ If a named function is provided as the first argument (or in `options.func`),
91
+ and no name is explicitly provided, the instance will automatically inherit the function's name.
92
+
90
93
  #### Parameters
91
94
 
92
95
  ##### name
@@ -97,7 +100,7 @@ Can be a function name, a function implementation, or a configuration object.
97
100
 
98
101
  ##### options?
99
102
 
100
- `any` = `{}`
103
+ `any`
101
104
 
102
105
  Configuration options if not provided in the first argument.
103
106
 
@@ -111,6 +114,18 @@ Configuration options if not provided in the first argument.
111
114
 
112
115
  ## Properties
113
116
 
117
+ ### \_registry?
118
+
119
+ > `optional` **\_registry**: *typeof* `ToolFunc`
120
+
121
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:496
122
+
123
+ **`Internal`**
124
+
125
+ The registry class where this tool was originally registered.
126
+
127
+ ***
128
+
114
129
  ### $attributes
115
130
 
116
131
  > **$attributes**: `Properties`
@@ -123,7 +138,7 @@ Defined in: [property-manager.js/src/advance.d.ts:5](https://github.com/snowyu/p
123
138
 
124
139
  > `optional` **alias**: `string` \| `string`[]
125
140
 
126
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:130](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L130)
141
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:258
127
142
 
128
143
  Optional aliases for the function name.
129
144
 
@@ -137,7 +152,7 @@ Optional aliases for the function name.
137
152
 
138
153
  > `optional` **asyncFeatures**: `number`
139
154
 
140
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:144](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L144)
155
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:272
141
156
 
142
157
  A bitmask representing asynchronous features supported by the function, built from `AsyncFeatureBits`.
143
158
  This allows the system to understand if a function supports capabilities like cancellation or multi-tasking.
@@ -173,6 +188,17 @@ The initial value of Object.prototype.constructor is the standard built-in Objec
173
188
 
174
189
  ***
175
190
 
191
+ ### ctx?
192
+
193
+ > `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
194
+
195
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:547
196
+
197
+ The execution context for the current function call.
198
+ Only available when isolated execution is enabled.
199
+
200
+ ***
201
+
176
202
  ### defaultOptions
177
203
 
178
204
  > **defaultOptions**: `object`
@@ -195,7 +221,7 @@ The default options for export and assign
195
221
 
196
222
  > `optional` **depends**: `object`
197
223
 
198
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:167](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L167)
224
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:295
199
225
 
200
226
  A map of dependencies this function has on other tool functions.
201
227
  Declaring dependencies ensures that they are automatically registered when this function is registered.
@@ -234,7 +260,7 @@ mainFunc.register();
234
260
 
235
261
  > `optional` **description**: `string`
236
262
 
237
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:172](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L172)
263
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:302
238
264
 
239
265
  A detailed description of what the function does.
240
266
 
@@ -248,7 +274,7 @@ A detailed description of what the function does.
248
274
 
249
275
  > `optional` **isApi**: `boolean`
250
276
 
251
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:119](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L119)
277
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:247
252
278
 
253
279
  If true, indicates that this function should be treated as a server-side API.
254
280
 
@@ -262,7 +288,7 @@ If true, indicates that this function should be treated as a server-side API.
262
288
 
263
289
  > `optional` **name**: `string`
264
290
 
265
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:76](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L76)
291
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:204
266
292
 
267
293
  The unique name of the function.
268
294
 
@@ -286,7 +312,7 @@ the property with the default prefix '$' will not be exported.
286
312
 
287
313
  > `optional` **params**: [`FuncParams`](../interfaces/FuncParams.md) \| [`FuncParam`](../interfaces/FuncParam.md)[]
288
314
 
289
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:81](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L81)
315
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:209
290
316
 
291
317
  Parameter definitions, which can be an object mapping names to definitions or an array for positional parameters.
292
318
 
@@ -300,7 +326,7 @@ Parameter definitions, which can be an object mapping names to definitions or an
300
326
 
301
327
  > `optional` **result**: `string` \| `Record`\<`string`, `any`\>
302
328
 
303
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:86](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L86)
329
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:214
304
330
 
305
331
  The expected return type of the function, described as a string or a JSON schema object.
306
332
 
@@ -314,7 +340,7 @@ The expected return type of the function, described as a string or a JSON schema
314
340
 
315
341
  > `optional` **scope**: `any`
316
342
 
317
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:91](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L91)
343
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:219
318
344
 
319
345
  The execution scope or context (`this`) for the function.
320
346
 
@@ -328,7 +354,7 @@ The execution scope or context (`this`) for the function.
328
354
 
329
355
  > `optional` **setup**: (`this`, `options?`) => `void`
330
356
 
331
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:114](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L114)
357
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:242
332
358
 
333
359
  A lifecycle hook called once during the `ToolFunc` instance's initialization.
334
360
  It allows for initial setup, state configuration, or property modification on the instance
@@ -374,7 +400,7 @@ console.log(myFunc.customState); // Outputs: 'configured'
374
400
 
375
401
  > `optional` **stream**: `boolean`
376
402
 
377
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:125](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L125)
403
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:253
378
404
 
379
405
  If true, indicates that the function has the *capability* to stream its output.
380
406
  Whether a specific call is streamed is determined by a `stream` property in the runtime parameters.
@@ -389,7 +415,7 @@ Whether a specific call is streamed is determined by a `stream` property in the
389
415
 
390
416
  > `optional` **tags**: `string` \| `string`[]
391
417
 
392
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:96](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L96)
418
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:224
393
419
 
394
420
  Tags for grouping or filtering functions.
395
421
 
@@ -403,7 +429,7 @@ Tags for grouping or filtering functions.
403
429
 
404
430
  > `optional` **title**: `string`
405
431
 
406
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:177](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L177)
432
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:307
407
433
 
408
434
  A concise, human-readable title for the function, often used in UI or by AI.
409
435
 
@@ -413,13 +439,28 @@ A concise, human-readable title for the function, often used in UI or by AI.
413
439
 
414
440
  ***
415
441
 
442
+ ### \_refCounts
443
+
444
+ > `protected` `static` **\_refCounts**: `object`
445
+
446
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:489
447
+
448
+ Tracks the number of active registration holds on each function name.
449
+ A function is truly removed only when its reference count drops to zero.
450
+
451
+ #### Index Signature
452
+
453
+ \[`name`: `string`\]: `number`
454
+
455
+ ***
456
+
416
457
  ### aliases
417
458
 
418
- > `static` **aliases**: `object` = `{}`
459
+ > `static` **aliases**: `object`
419
460
 
420
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:305](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L305)
461
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:480
421
462
 
422
- A static map of aliases to their corresponding function names.
463
+ A static map of aliases to their corresponding primary function names.
423
464
 
424
465
  #### Index Signature
425
466
 
@@ -427,11 +468,21 @@ A static map of aliases to their corresponding function names.
427
468
 
428
469
  ***
429
470
 
471
+ ### ctx?
472
+
473
+ > `static` `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
474
+
475
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:508
476
+
477
+ The static execution context for proxy classes created via ToolFunc.with().
478
+
479
+ ***
480
+
430
481
  ### dataPath
431
482
 
432
483
  > `static` **dataPath**: `string`
433
484
 
434
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:312](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L312)
485
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:503
435
486
 
436
487
  A conventional property to designate a file path for saving the registered `ToolFunc` data.
437
488
  Note: The `ToolFunc` class itself does not implement persistence logic. It is up to the
@@ -441,19 +492,78 @@ developer to use this path to save and load the `ToolFunc.items` registry if nee
441
492
 
442
493
  ### items
443
494
 
444
- > `static` **items**: [`Funcs`](../interfaces/Funcs.md) = `{}`
495
+ > `static` **items**: [`Funcs`](../interfaces/Funcs.md)
445
496
 
446
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:300](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L300)
497
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:475
447
498
 
448
- A static registry of all `ToolFunc` instances, indexed by name.
499
+ A static registry of all `ToolFunc` implementations, indexed by their primary name.
449
500
 
450
501
  ## Methods
451
502
 
503
+ ### \_prepareContext()
504
+
505
+ > `protected` **\_prepareContext**(`params?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
506
+
507
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:806
508
+
509
+ Creates the final execution context (`this.ctx`) for a Shadow Instance.
510
+
511
+ NOTE: We MUST use 'this._prepareContext' (instance path) instead of
512
+ 'Static._prepareContext' to allow AOP plugins (like CancelableAbility)
513
+ to hook into context preparation via method overloading ($_prepareContext).
514
+
515
+ #### Parameters
516
+
517
+ ##### params?
518
+
519
+ `any`
520
+
521
+ ##### ctx?
522
+
523
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
524
+
525
+ #### Returns
526
+
527
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
528
+
529
+ ***
530
+
531
+ ### \_shouldIsolate()
532
+
533
+ > `protected` **\_shouldIsolate**(`params?`, `ctx?`): `boolean`
534
+
535
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:798
536
+
537
+ Determines if the function execution should be isolated into a "Shadow Instance".
538
+
539
+ PRIORITY LOGIC:
540
+ 1. Explicit 'ctx.isolated' in the current call (Highest).
541
+ 2. Any explicit 'ctx' provided (Safe default: isolate to apply new overrides).
542
+ 3. Prevention of recursion (If already an own 'ctx' property exists).
543
+ 4. Inherited 'this.ctx.isolated' configuration.
544
+ 5. Presence of any inherited context (Default: isolate for concurrency safety).
545
+
546
+ #### Parameters
547
+
548
+ ##### params?
549
+
550
+ `any`
551
+
552
+ ##### ctx?
553
+
554
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
555
+
556
+ #### Returns
557
+
558
+ `boolean`
559
+
560
+ ***
561
+
452
562
  ### arr2ObjParams()
453
563
 
454
564
  > **arr2ObjParams**(`params`): `any`[]
455
565
 
456
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:629](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L629)
566
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:770
457
567
 
458
568
  Converts an array of positional arguments into a named parameters object.
459
569
  This is used internally to support functions defined with named parameters.
@@ -728,7 +838,7 @@ the dest object.
728
838
 
729
839
  > **func**(...`params`): `any`
730
840
 
731
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:202](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L202)
841
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:356
732
842
 
733
843
  The actual function implementation.
734
844
 
@@ -756,7 +866,7 @@ The result of the function.
756
866
 
757
867
  > **getFunc**(`name?`): `any`
758
868
 
759
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:720](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L720)
869
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:866
760
870
 
761
871
  Gets a bound function reference for execution with named parameters.
762
872
  If a name is provided, it retrieves a different function from the registry.
@@ -782,7 +892,7 @@ A function reference or `undefined` if not found.
782
892
 
783
893
  > **getFuncWithPos**(`name?`): `any`
784
894
 
785
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:777](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L777)
895
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:910
786
896
 
787
897
  Gets a bound function reference suitable for positional argument execution.
788
898
  If a name is provided, it retrieves a different function from the registry.
@@ -824,7 +934,7 @@ the descriptors of properties object
824
934
 
825
935
  > **hasAsyncFeature**(`feature`): `boolean`
826
936
 
827
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:787](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L787)
937
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:916
828
938
 
829
939
  Checks if the current function instance supports a specific async feature.
830
940
 
@@ -938,9 +1048,9 @@ The source object
938
1048
 
939
1049
  ### isStream()
940
1050
 
941
- > **isStream**(`params`): `undefined` \| `boolean`
1051
+ > **isStream**(`params`): `boolean` \| `undefined`
942
1052
 
943
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:805](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L805)
1053
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:929
944
1054
 
945
1055
  Determines if a function call should produce a stream.
946
1056
 
@@ -960,7 +1070,7 @@ The runtime parameters passed to the function call.
960
1070
 
961
1071
  #### Returns
962
1072
 
963
- `undefined` \| `boolean`
1073
+ `boolean` \| `undefined`
964
1074
 
965
1075
  `true` if the call should be streamed, `false` or `undefined` otherwise.
966
1076
 
@@ -998,7 +1108,7 @@ the dest object.
998
1108
 
999
1109
  > **obj2ArrParams**(`params?`): `any`[]
1000
1110
 
1001
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:648](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L648)
1111
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:777
1002
1112
 
1003
1113
  Converts a named parameters object into an array of positional arguments.
1004
1114
  This is used for functions defined with positional parameters.
@@ -1045,7 +1155,7 @@ A property name.
1045
1155
 
1046
1156
  > **register**(): `boolean` \| `ToolFunc`
1047
1157
 
1048
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:602](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L602)
1158
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:757
1049
1159
 
1050
1160
  Registers the current `ToolFunc` instance into the static registry.
1051
1161
  Also registers any declared dependencies.
@@ -1060,12 +1170,15 @@ The instance itself upon successful registration, or `false` if it already exist
1060
1170
 
1061
1171
  ### run()
1062
1172
 
1063
- > **run**(`params?`): `Promise`\<`any`\>
1173
+ > **run**(`params?`, `ctx?`): `any`
1064
1174
 
1065
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:686](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L686)
1175
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:825
1066
1176
 
1067
1177
  Executes the function asynchronously with a named parameters object.
1068
1178
 
1179
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
1180
+ otherwise it may return the result synchronously.
1181
+
1069
1182
  #### Parameters
1070
1183
 
1071
1184
  ##### params?
@@ -1074,22 +1187,30 @@ Executes the function asynchronously with a named parameters object.
1074
1187
 
1075
1188
  The parameters object for the function.
1076
1189
 
1190
+ ##### ctx?
1191
+
1192
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1193
+
1194
+ The execution context.
1195
+
1077
1196
  #### Returns
1078
1197
 
1079
- `Promise`\<`any`\>
1198
+ `any`
1080
1199
 
1081
- A promise that resolves with the function's result.
1200
+ A promise or the direct result of the function's execution.
1082
1201
 
1083
1202
  ***
1084
1203
 
1085
1204
  ### runAs()
1086
1205
 
1087
- > **runAs**(`name`, `params?`): `Promise`\<`any`\>
1206
+ > **runAs**(`name`, `params?`, `ctx?`): `any`
1088
1207
 
1089
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:697](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L697)
1208
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:837
1090
1209
 
1091
1210
  Asynchronously executes another registered function by name.
1092
- This method delegates to `runAsSync()` internally.
1211
+
1212
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
1213
+ otherwise it may return the result synchronously.
1093
1214
 
1094
1215
  #### Parameters
1095
1216
 
@@ -1105,22 +1226,38 @@ The name of the target function to run.
1105
1226
 
1106
1227
  Optional parameters to pass to the function.
1107
1228
 
1229
+ ##### ctx?
1230
+
1231
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1232
+
1233
+ The execution context.
1234
+
1108
1235
  #### Returns
1109
1236
 
1110
- `Promise`\<`any`\>
1237
+ `any`
1111
1238
 
1112
- A promise that resolves with the result of the function execution.
1239
+ A promise or the direct result of the function's execution.
1113
1240
 
1114
1241
  ***
1115
1242
 
1116
1243
  ### runAsSync()
1117
1244
 
1118
- > **runAsSync**(`name`, `params?`): `any`
1245
+ > **runAsSync**(`name`, `params?`, `ctx?`): `any`
1246
+
1247
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:858
1248
+
1249
+ Executes another registered function by name, using hierarchical dependency resolution.
1119
1250
 
1120
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:708](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L708)
1251
+ This method supports **Late-Binding Polymorphism**. It uses the `rootRegistry` and
1252
+ `binding` strategy from the execution context to resolve dependencies.
1121
1253
 
1122
- Synchronously executes another registered function by name.
1123
- This is a convenience method that forwards the call to the static `runSync()` method.
1254
+ ### Binding Modes:
1255
+ - `'auto'` (Default): **Lineage-Aware**. Uses late-binding only if the `rootRegistry`
1256
+ is a descendant of the tool's definition registry and has shadowed the dependency.
1257
+ Otherwise, uses early-binding for stability.
1258
+ - `'early'`: **Safety First**. Always prefers the pre-bound instance from `depends`.
1259
+ - `'late'`: **Forced Polymorphism**. Always resolves from the `rootRegistry`,
1260
+ ignoring the definer's environment.
1124
1261
 
1125
1262
  #### Parameters
1126
1263
 
@@ -1128,27 +1265,37 @@ This is a convenience method that forwards the call to the static `runSync()` me
1128
1265
 
1129
1266
  `string`
1130
1267
 
1131
- The name of the target function to run.
1268
+ The name or alias of the target function to run.
1132
1269
 
1133
1270
  ##### params?
1134
1271
 
1135
1272
  `any`
1136
1273
 
1137
- Optional parameters to pass to the function.
1274
+ Optional parameters to pass to the target function.
1275
+
1276
+ ##### ctx?
1277
+
1278
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1279
+
1280
+ The execution context.
1138
1281
 
1139
1282
  #### Returns
1140
1283
 
1141
1284
  `any`
1142
1285
 
1143
- The result of the function execution.
1286
+ The result of the target function execution.
1287
+
1288
+ #### Throws
1289
+
1290
+ If the target function cannot be found in the current lineage.
1144
1291
 
1145
1292
  ***
1146
1293
 
1147
1294
  ### runSync()
1148
1295
 
1149
- > **runSync**(`params?`): `any`
1296
+ > **runSync**(`params?`, `ctx?`): `any`
1150
1297
 
1151
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:667](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L667)
1298
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:814
1152
1299
 
1153
1300
  Executes the function synchronously with a named parameters object.
1154
1301
 
@@ -1160,6 +1307,12 @@ Executes the function synchronously with a named parameters object.
1160
1307
 
1161
1308
  The parameters object for the function.
1162
1309
 
1310
+ ##### ctx?
1311
+
1312
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1313
+
1314
+ The execution context.
1315
+
1163
1316
  #### Returns
1164
1317
 
1165
1318
  `any`
@@ -1174,12 +1327,14 @@ Will throw an error if an array of parameters is passed to a function that expec
1174
1327
 
1175
1328
  ### runWithPos()
1176
1329
 
1177
- > **runWithPos**(...`params`): `Promise`\<`any`\>
1330
+ > **runWithPos**(...`params`): `any`
1178
1331
 
1179
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:755](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L755)
1332
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:891
1180
1333
 
1181
1334
  Executes the function asynchronously using positional arguments.
1182
- Delegates to `runWithPosSync()` internally.
1335
+
1336
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
1337
+ otherwise it may return the result synchronously.
1183
1338
 
1184
1339
  #### Parameters
1185
1340
 
@@ -1191,20 +1346,22 @@ Positional arguments passed to the function.
1191
1346
 
1192
1347
  #### Returns
1193
1348
 
1194
- `Promise`\<`any`\>
1349
+ `any`
1195
1350
 
1196
- A promise that resolves with the result of the function execution.
1351
+ A promise or the direct result of the function's execution.
1197
1352
 
1198
1353
  ***
1199
1354
 
1200
1355
  ### runWithPosAs()
1201
1356
 
1202
- > **runWithPosAs**(`name`, ...`params`): `Promise`\<`any`\>
1357
+ > **runWithPosAs**(`name`, ...`params`): `any`
1203
1358
 
1204
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:766](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L766)
1359
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:902
1205
1360
 
1206
1361
  Asynchronously executes another function by name using positional arguments.
1207
- Delegates to `runWithPosAsSync()` internally.
1362
+
1363
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
1364
+ otherwise it may return the result synchronously.
1208
1365
 
1209
1366
  #### Parameters
1210
1367
 
@@ -1222,9 +1379,9 @@ Positional arguments to pass to the function.
1222
1379
 
1223
1380
  #### Returns
1224
1381
 
1225
- `Promise`\<`any`\>
1382
+ `any`
1226
1383
 
1227
- A promise that resolves with the result of the function execution.
1384
+ A promise or the direct result of the function's execution.
1228
1385
 
1229
1386
  ***
1230
1387
 
@@ -1232,7 +1389,7 @@ A promise that resolves with the result of the function execution.
1232
1389
 
1233
1390
  > **runWithPosAsSync**(`name`, ...`params`): `any`
1234
1391
 
1235
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:745](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L745)
1392
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:881
1236
1393
 
1237
1394
  Synchronously executes another function by name using positional arguments.
1238
1395
  This is a convenience wrapper around the static `runWithPosSync()` method.
@@ -1263,7 +1420,7 @@ The result of the function execution.
1263
1420
 
1264
1421
  > **runWithPosSync**(...`params`): `any`
1265
1422
 
1266
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:731](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L731)
1423
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:873
1267
1424
 
1268
1425
  Executes the function synchronously using positional arguments.
1269
1426
  If the function expects named parameters, it converts the arguments automatically.
@@ -1348,12 +1505,20 @@ Returns a string representation of an object.
1348
1505
 
1349
1506
  ### unregister()
1350
1507
 
1351
- > **unregister**(): `any`
1508
+ > **unregister**(`options?`): `any`
1352
1509
 
1353
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:619](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L619)
1510
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:763
1354
1511
 
1355
1512
  Removes the current `ToolFunc` instance from the static registry.
1356
1513
 
1514
+ #### Parameters
1515
+
1516
+ ##### options?
1517
+
1518
+ Unregistration options or a boolean force flag.
1519
+
1520
+ `boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
1521
+
1357
1522
  #### Returns
1358
1523
 
1359
1524
  `any`
@@ -1376,6 +1541,246 @@ Returns the primitive value of the specified object.
1376
1541
 
1377
1542
  ***
1378
1543
 
1544
+ ### with()
1545
+
1546
+ > **with**(`ctx`): `this`
1547
+
1548
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:542
1549
+
1550
+ Returns an isolated instance with the provided context.
1551
+
1552
+ #### Parameters
1553
+
1554
+ ##### ctx
1555
+
1556
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1557
+
1558
+ The context to use.
1559
+
1560
+ #### Returns
1561
+
1562
+ `this`
1563
+
1564
+ An isolated ToolFunc instance.
1565
+
1566
+ ***
1567
+
1568
+ ### \_acquireDependencies()
1569
+
1570
+ > `protected` `static` **\_acquireDependencies**(`inst`, `stack?`): `void`
1571
+
1572
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:740
1573
+
1574
+ #### Parameters
1575
+
1576
+ ##### inst
1577
+
1578
+ `ToolFunc`
1579
+
1580
+ ##### stack?
1581
+
1582
+ `Set`\<`string`\>
1583
+
1584
+ #### Returns
1585
+
1586
+ `void`
1587
+
1588
+ ***
1589
+
1590
+ ### \_decRefCount()
1591
+
1592
+ > `protected` `static` **\_decRefCount**(`name`): `number`
1593
+
1594
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:739
1595
+
1596
+ #### Parameters
1597
+
1598
+ ##### name
1599
+
1600
+ `string`
1601
+
1602
+ #### Returns
1603
+
1604
+ `number`
1605
+
1606
+ ***
1607
+
1608
+ ### \_getRegistrationAction()
1609
+
1610
+ > `protected` `static` **\_getRegistrationAction**(`name`, `override`): `"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
1611
+
1612
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:670
1613
+
1614
+ Analyzes the registration context and determines the appropriate action.
1615
+
1616
+ #### Parameters
1617
+
1618
+ ##### name
1619
+
1620
+ `string`
1621
+
1622
+ The function name to register.
1623
+
1624
+ ##### override
1625
+
1626
+ Override options.
1627
+
1628
+ ###### name?
1629
+
1630
+ `boolean`
1631
+
1632
+ #### Returns
1633
+
1634
+ `"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
1635
+
1636
+ The determined registration action.
1637
+
1638
+ ***
1639
+
1640
+ ### \_incRefCount()
1641
+
1642
+ > `protected` `static` **\_incRefCount**(`name`): `void`
1643
+
1644
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:738
1645
+
1646
+ #### Parameters
1647
+
1648
+ ##### name
1649
+
1650
+ `string`
1651
+
1652
+ #### Returns
1653
+
1654
+ `void`
1655
+
1656
+ ***
1657
+
1658
+ ### \_normalizeArguments()
1659
+
1660
+ > `protected` `static` **\_normalizeArguments**(`name`, `options?`): `any`
1661
+
1662
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:643
1663
+
1664
+ **`Internal`**
1665
+
1666
+ Internal helper to normalize arguments from various input patterns.
1667
+ Priority: name (arg1) > options (arg2).
1668
+
1669
+ #### Parameters
1670
+
1671
+ ##### name
1672
+
1673
+ Primary config.
1674
+
1675
+ `string` | `Function` | `ToolFunc` | [`FuncItem`](../interfaces/FuncItem.md)
1676
+
1677
+ ##### options?
1678
+
1679
+ `any`
1680
+
1681
+ Default config.
1682
+
1683
+ #### Returns
1684
+
1685
+ `any`
1686
+
1687
+ Normalized options object.
1688
+
1689
+ ***
1690
+
1691
+ ### \_normalizeRegisterArguments()
1692
+
1693
+ > `protected` `static` **\_normalizeRegisterArguments**(`name`, `options?`): [`RegisterOptions`](../interfaces/RegisterOptions.md)
1694
+
1695
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:682
1696
+
1697
+ **`Internal`**
1698
+
1699
+ Normalizes the arguments passed to the `register` method into a unified `RegisterOptions` object.
1700
+
1701
+ #### Parameters
1702
+
1703
+ ##### name
1704
+
1705
+ The primary identification or implementation.
1706
+
1707
+ `string` | `Function` | `ToolFunc` | [`RegisterOptions`](../interfaces/RegisterOptions.md)
1708
+
1709
+ ##### options?
1710
+
1711
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
1712
+
1713
+ Additional or overriding configuration.
1714
+
1715
+ #### Returns
1716
+
1717
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
1718
+
1719
+ A normalized options object ready for registration.
1720
+
1721
+ ***
1722
+
1723
+ ### \_prepareContext()
1724
+
1725
+ > `static` **\_prepareContext**(`parentCtx?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1726
+
1727
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:535
1728
+
1729
+ **`Internal`**
1730
+
1731
+ Internal helper to prepare the execution context, maintaining the prototype chain.
1732
+
1733
+ #### Parameters
1734
+
1735
+ ##### parentCtx?
1736
+
1737
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1738
+
1739
+ The parent context to inherit from.
1740
+
1741
+ ##### ctx?
1742
+
1743
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1744
+
1745
+ The new context properties to apply.
1746
+
1747
+ #### Returns
1748
+
1749
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1750
+
1751
+ The merged context.
1752
+
1753
+ DANGER - DO NOT "OPTIMIZE" UNLESS YOU UNDERSTAND:
1754
+ 1. Why NOT Object.assign(target, ctx) alone?
1755
+ Object.assign only copies 'own' properties. In nested calls (e.g., .with().with()),
1756
+ parent properties exist on the prototype. Using assign would drop all inherited
1757
+ context data (like traceId from a parent runner).
1758
+ 2. Why NOT Object.setPrototypeOf?
1759
+ It's a heavy performance killer in V8. We use Object.create(proto) instead.
1760
+ 3. Why check isPrototypeOf?
1761
+ If ctx is already in the chain, we return it to maintain identity and avoid
1762
+ redundant shadow layers, which is required by many AOP plugins and unit tests.
1763
+
1764
+ ***
1765
+
1766
+ ### \_releaseDependencies()
1767
+
1768
+ > `protected` `static` **\_releaseDependencies**(`inst`): `void`
1769
+
1770
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:741
1771
+
1772
+ #### Parameters
1773
+
1774
+ ##### inst
1775
+
1776
+ `ToolFunc`
1777
+
1778
+ #### Returns
1779
+
1780
+ `void`
1781
+
1782
+ ***
1783
+
1379
1784
  ### assign()
1380
1785
 
1381
1786
  #### Call Signature
@@ -1548,6 +1953,23 @@ One or more source objects from which to copy properties
1548
1953
 
1549
1954
  ***
1550
1955
 
1956
+ ### clear()
1957
+
1958
+ > `static` **clear**(): `void`
1959
+
1960
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:661
1961
+
1962
+ Resets the local registry by clearing all registered items, aliases, and reference counts.
1963
+
1964
+ In a hierarchical registry, this only clears properties "owned" by the current
1965
+ layer. Inherited items from parent registries remain visible through the prototype chain.
1966
+
1967
+ #### Returns
1968
+
1969
+ `void`
1970
+
1971
+ ***
1972
+
1551
1973
  ### create()
1552
1974
 
1553
1975
  #### Call Signature
@@ -1564,7 +1986,7 @@ Creates an object that has the specified prototype or that has null prototype.
1564
1986
 
1565
1987
  Object to use as a prototype. May be null.
1566
1988
 
1567
- `null` | `object`
1989
+ `object` | `null`
1568
1990
 
1569
1991
  ##### Returns
1570
1992
 
@@ -1584,7 +2006,7 @@ Creates an object that has the specified prototype, and that optionally contains
1584
2006
 
1585
2007
  Object to use as a prototype. May be null
1586
2008
 
1587
- `null` | `object`
2009
+ `object` | `null`
1588
2010
 
1589
2011
  ###### properties
1590
2012
 
@@ -1854,7 +2276,7 @@ An iterable object that contains key-value entries for properties and methods.
1854
2276
 
1855
2277
  > `static` **get**(`name`): `ToolFunc`
1856
2278
 
1857
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:319](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L319)
2279
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:553
1858
2280
 
1859
2281
  Retrieves a registered function by its name or alias.
1860
2282
 
@@ -1878,7 +2300,7 @@ The `ToolFunc` instance if found, otherwise `undefined`.
1878
2300
 
1879
2301
  > `static` **getAllByTag**(`tagName`): `ToolFunc`[]
1880
2302
 
1881
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:365](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L365)
2303
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:570
1882
2304
 
1883
2305
  Retrieves all registered functions that have a specific tag.
1884
2306
 
@@ -1900,9 +2322,9 @@ An array of matching `ToolFunc` instances.
1900
2322
 
1901
2323
  ### getByTag()
1902
2324
 
1903
- > `static` **getByTag**(`tagName`): `undefined` \| `ToolFunc`
2325
+ > `static` **getByTag**(`tagName`): `ToolFunc` \| `undefined`
1904
2326
 
1905
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:340](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L340)
2327
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:564
1906
2328
 
1907
2329
  Finds the first registered function that has a specific tag.
1908
2330
 
@@ -1916,7 +2338,7 @@ The tag to search for.
1916
2338
 
1917
2339
  #### Returns
1918
2340
 
1919
- `undefined` \| `ToolFunc`
2341
+ `ToolFunc` \| `undefined`
1920
2342
 
1921
2343
  The first matching `ToolFunc` instance, or `undefined` if none is found.
1922
2344
 
@@ -1926,7 +2348,7 @@ The first matching `ToolFunc` instance, or `undefined` if none is found.
1926
2348
 
1927
2349
  > `static` **getFunc**(`name`): `any`
1928
2350
 
1929
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:431](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L431)
2351
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:605
1930
2352
 
1931
2353
  Retrieves a bound, runnable function reference for a registered function.
1932
2354
  This reference is suitable for execution with an object of named parameters.
@@ -1951,7 +2373,7 @@ A bound function reference, or `undefined` if not found.
1951
2373
 
1952
2374
  > `static` **getFuncWithPos**(`name`): `any`
1953
2375
 
1954
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:472](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L472)
2376
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:632
1955
2377
 
1956
2378
  Retrieves a bound, runnable function reference for a registered function.
1957
2379
  This reference is suitable for execution with positional arguments.
@@ -1974,7 +2396,7 @@ A bound function reference, or `undefined` if not found.
1974
2396
 
1975
2397
  ### getOwnPropertyDescriptor()
1976
2398
 
1977
- > `static` **getOwnPropertyDescriptor**(`o`, `p`): `undefined` \| `PropertyDescriptor`
2399
+ > `static` **getOwnPropertyDescriptor**(`o`, `p`): `PropertyDescriptor` \| `undefined`
1978
2400
 
1979
2401
  Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/typescript/lib/lib.es5.d.ts:175
1980
2402
 
@@ -1997,7 +2419,7 @@ Name of the property.
1997
2419
 
1998
2420
  #### Returns
1999
2421
 
2000
- `undefined` \| `PropertyDescriptor`
2422
+ `PropertyDescriptor` \| `undefined`
2001
2423
 
2002
2424
  ***
2003
2425
 
@@ -2114,7 +2536,7 @@ The object that references the prototype.
2114
2536
 
2115
2537
  > `static` **hasAsyncFeature**(`feature`): `boolean`
2116
2538
 
2117
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:388](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L388)
2539
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:576
2118
2540
 
2119
2541
  Checks if any registered function has a specific asynchronous feature.
2120
2542
 
@@ -2234,6 +2656,33 @@ Object to test.
2234
2656
 
2235
2657
  ***
2236
2658
 
2659
+ ### isolateRegistry()
2660
+
2661
+ > `static` **isolateRegistry**(`options?`): `void`
2662
+
2663
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:654
2664
+
2665
+ Isolates the current registry layer by branching off its parent using prototype shadowing.
2666
+
2667
+ This creates a new "scope" where:
2668
+ 1. New registrations are stored only in the local layer, supporting tool shadowing.
2669
+ 2. Parent tools remain accessible via the prototype chain (read-only) unless shadowed.
2670
+ 3. Reference counting is isolated, enabling clean per-layer lifecycle management.
2671
+
2672
+ #### Parameters
2673
+
2674
+ ##### options?
2675
+
2676
+ [`ToolFuncRegistryIsolateOptions`](../interfaces/ToolFuncRegistryIsolateOptions.md)
2677
+
2678
+ Options to selectively isolate specific maps (items, aliases, refCounts).
2679
+
2680
+ #### Returns
2681
+
2682
+ `void`
2683
+
2684
+ ***
2685
+
2237
2686
  ### isSealed()
2238
2687
 
2239
2688
  > `static` **isSealed**(`o`): `boolean`
@@ -2302,7 +2751,7 @@ Object that contains the properties and methods. This can be an object that you
2302
2751
 
2303
2752
  > `static` **list**(): [`Funcs`](../interfaces/Funcs.md)
2304
2753
 
2305
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:331](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L331)
2754
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:558
2306
2755
 
2307
2756
  Returns the complete map of all registered functions.
2308
2757
 
@@ -2348,9 +2797,24 @@ Object to make non-extensible.
2348
2797
 
2349
2798
  > `static` **register**(`name`, `options`): `boolean` \| `ToolFunc`
2350
2799
 
2351
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:495](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L495)
2800
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:718
2801
+
2802
+ **`Internal`**
2803
+
2804
+ Registers a `ToolFunc` instance into the registry.
2805
+
2806
+ This method supports multiple overloads and handles hierarchical registration,
2807
+ alias collision protection, and automatic dependency registration with cycle detection.
2808
+
2809
+ ### Hierarchical Behavior:
2810
+ - In an isolated registry, items are stored locally, shadowing parent items with the same name.
2811
+ - Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
2812
+ unless `allowOverride.alias` is explicitly granted.
2352
2813
 
2353
- Registers a new tool function.
2814
+ ### Circular Dependencies:
2815
+ Automatically detects and manages circular dependency chains using an internal stack.
2816
+ Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
2817
+ and enable clean group unregistration.
2354
2818
 
2355
2819
  ##### Parameters
2356
2820
 
@@ -2358,27 +2822,61 @@ Registers a new tool function.
2358
2822
 
2359
2823
  `string`
2360
2824
 
2361
- The name of the function.
2825
+ The tool instance, function, or name to register.
2362
2826
 
2363
2827
  ###### options
2364
2828
 
2365
- [`FuncItem`](../interfaces/FuncItem.md)
2829
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
2366
2830
 
2367
- The function's configuration.
2831
+ Configuration or implementation for the tool.
2368
2832
 
2369
2833
  ##### Returns
2370
2834
 
2371
2835
  `boolean` \| `ToolFunc`
2372
2836
 
2373
- The new `ToolFunc` instance, or `false` if a function with that name already exists.
2837
+ The registered ToolFunc instance on success (creation, shadowing, or override),
2838
+ or `false` if registration was ignored (e.g., ref-count increment only).
2839
+
2840
+ ##### Example
2841
+
2842
+ ```ts
2843
+ // 1. Registering with explicit name and function
2844
+ ToolFunc.register('add', { func: (a, b) => a + b });
2845
+
2846
+ // 2. Registering with shadowing permission in an isolated registry
2847
+ MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
2848
+
2849
+ // 3. Registering an existing ToolFunc instance
2850
+ const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
2851
+ ToolFunc.register(tool);
2852
+ ```
2853
+
2854
+ ##### Throws
2855
+
2856
+ If name is missing, or if an alias collision occurs without permission.
2374
2857
 
2375
2858
  #### Call Signature
2376
2859
 
2377
2860
  > `static` **register**(`func`, `options`): `boolean` \| `ToolFunc`
2378
2861
 
2379
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:496](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L496)
2862
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:719
2863
+
2864
+ **`Internal`**
2380
2865
 
2381
- Registers a new tool function.
2866
+ Registers a `ToolFunc` instance into the registry.
2867
+
2868
+ This method supports multiple overloads and handles hierarchical registration,
2869
+ alias collision protection, and automatic dependency registration with cycle detection.
2870
+
2871
+ ### Hierarchical Behavior:
2872
+ - In an isolated registry, items are stored locally, shadowing parent items with the same name.
2873
+ - Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
2874
+ unless `allowOverride.alias` is explicitly granted.
2875
+
2876
+ ### Circular Dependencies:
2877
+ Automatically detects and manages circular dependency chains using an internal stack.
2878
+ Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
2879
+ and enable clean group unregistration.
2382
2880
 
2383
2881
  ##### Parameters
2384
2882
 
@@ -2386,58 +2884,118 @@ Registers a new tool function.
2386
2884
 
2387
2885
  `Function`
2388
2886
 
2389
- The function implementation.
2390
-
2391
2887
  ###### options
2392
2888
 
2393
- [`FuncItem`](../interfaces/FuncItem.md)
2889
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
2394
2890
 
2395
- The function's configuration.
2891
+ Configuration or implementation for the tool.
2396
2892
 
2397
2893
  ##### Returns
2398
2894
 
2399
2895
  `boolean` \| `ToolFunc`
2400
2896
 
2401
- The new `ToolFunc` instance, or `false` if a function with that name already exists.
2897
+ The registered ToolFunc instance on success (creation, shadowing, or override),
2898
+ or `false` if registration was ignored (e.g., ref-count increment only).
2899
+
2900
+ ##### Example
2901
+
2902
+ ```ts
2903
+ // 1. Registering with explicit name and function
2904
+ ToolFunc.register('add', { func: (a, b) => a + b });
2905
+
2906
+ // 2. Registering with shadowing permission in an isolated registry
2907
+ MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
2908
+
2909
+ // 3. Registering an existing ToolFunc instance
2910
+ const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
2911
+ ToolFunc.register(tool);
2912
+ ```
2913
+
2914
+ ##### Throws
2915
+
2916
+ If name is missing, or if an alias collision occurs without permission.
2402
2917
 
2403
2918
  #### Call Signature
2404
2919
 
2405
- > `static` **register**(`name`, `options?`): `boolean` \| `ToolFunc`
2920
+ > `static` **register**(`name`, `options?`, `_stack?`): `boolean` \| `ToolFunc`
2921
+
2922
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:720
2923
+
2924
+ **`Internal`**
2925
+
2926
+ Registers a `ToolFunc` instance into the registry.
2927
+
2928
+ This method supports multiple overloads and handles hierarchical registration,
2929
+ alias collision protection, and automatic dependency registration with cycle detection.
2406
2930
 
2407
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:497](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L497)
2931
+ ### Hierarchical Behavior:
2932
+ - In an isolated registry, items are stored locally, shadowing parent items with the same name.
2933
+ - Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
2934
+ unless `allowOverride.alias` is explicitly granted.
2408
2935
 
2409
- Registers a new tool function.
2936
+ ### Circular Dependencies:
2937
+ Automatically detects and manages circular dependency chains using an internal stack.
2938
+ Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
2939
+ and enable clean group unregistration.
2410
2940
 
2411
2941
  ##### Parameters
2412
2942
 
2413
2943
  ###### name
2414
2944
 
2415
- The name of the function.
2945
+ The tool instance, function, or name to register.
2416
2946
 
2417
- `string` | `Function` | `ToolFunc` | [`FuncItem`](../interfaces/FuncItem.md)
2947
+ `string` | `Function` | `ToolFunc` | [`RegisterOptions`](../interfaces/RegisterOptions.md)
2418
2948
 
2419
2949
  ###### options?
2420
2950
 
2421
- [`FuncItem`](../interfaces/FuncItem.md)
2951
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
2952
+
2953
+ Configuration or implementation for the tool.
2954
+
2955
+ ###### \_stack?
2956
+
2957
+ `Set`\<`string`\>
2422
2958
 
2423
- The function's configuration.
2959
+ Used for cycle detection during recursive registration.
2424
2960
 
2425
2961
  ##### Returns
2426
2962
 
2427
2963
  `boolean` \| `ToolFunc`
2428
2964
 
2429
- The new `ToolFunc` instance, or `false` if a function with that name already exists.
2965
+ The registered ToolFunc instance on success (creation, shadowing, or override),
2966
+ or `false` if registration was ignored (e.g., ref-count increment only).
2967
+
2968
+ ##### Example
2969
+
2970
+ ```ts
2971
+ // 1. Registering with explicit name and function
2972
+ ToolFunc.register('add', { func: (a, b) => a + b });
2973
+
2974
+ // 2. Registering with shadowing permission in an isolated registry
2975
+ MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
2976
+
2977
+ // 3. Registering an existing ToolFunc instance
2978
+ const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
2979
+ ToolFunc.register(tool);
2980
+ ```
2981
+
2982
+ ##### Throws
2983
+
2984
+ If name is missing, or if an alias collision occurs without permission.
2430
2985
 
2431
2986
  ***
2432
2987
 
2433
2988
  ### run()
2434
2989
 
2435
- > `static` **run**(`name`, `params?`): `Promise`\<`any`\>
2990
+ > `static` **run**(`name`, `params?`, `ctx?`): `any`
2436
2991
 
2437
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:402](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L402)
2992
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:589
2438
2993
 
2439
2994
  Asynchronously executes a registered function by name with named parameters.
2440
2995
 
2996
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
2997
+ otherwise it may return the result synchronously.
2998
+
2441
2999
  #### Parameters
2442
3000
 
2443
3001
  ##### name
@@ -2452,11 +3010,17 @@ The name of the function to run.
2452
3010
 
2453
3011
  The parameters object for the function.
2454
3012
 
3013
+ ##### ctx?
3014
+
3015
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
3016
+
3017
+ The execution context.
3018
+
2455
3019
  #### Returns
2456
3020
 
2457
- `Promise`\<`any`\>
3021
+ `any`
2458
3022
 
2459
- A promise that resolves with the function's result.
3023
+ A promise or the direct result of the function's execution.
2460
3024
 
2461
3025
  #### Throws
2462
3026
 
@@ -2466,9 +3030,9 @@ If the function with the given name is not found.
2466
3030
 
2467
3031
  ### runSync()
2468
3032
 
2469
- > `static` **runSync**(`name`, `params?`): `any`
3033
+ > `static` **runSync**(`name`, `params?`, `ctx?`): `any`
2470
3034
 
2471
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:417](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L417)
3035
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:598
2472
3036
 
2473
3037
  Synchronously executes a registered function by name with named parameters.
2474
3038
 
@@ -2486,6 +3050,12 @@ The name of the function to run.
2486
3050
 
2487
3051
  The parameters object for the function.
2488
3052
 
3053
+ ##### ctx?
3054
+
3055
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
3056
+
3057
+ The execution context.
3058
+
2489
3059
  #### Returns
2490
3060
 
2491
3061
  `any`
@@ -2500,12 +3070,15 @@ If the function with the given name is not found.
2500
3070
 
2501
3071
  ### runWithPos()
2502
3072
 
2503
- > `static` **runWithPos**(`name`, ...`params`): `Promise`\<`any`\>
3073
+ > `static` **runWithPos**(`name`, ...`params`): `any`
2504
3074
 
2505
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:443](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L443)
3075
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:617
2506
3076
 
2507
3077
  Asynchronously executes a function using positional arguments.
2508
3078
 
3079
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
3080
+ otherwise it may return the result synchronously.
3081
+
2509
3082
  #### Parameters
2510
3083
 
2511
3084
  ##### name
@@ -2522,9 +3095,9 @@ Positional arguments to pass to the function.
2522
3095
 
2523
3096
  #### Returns
2524
3097
 
2525
- `Promise`\<`any`\>
3098
+ `any`
2526
3099
 
2527
- A promise that resolves with the function's result.
3100
+ A promise or the direct result of the function's execution.
2528
3101
 
2529
3102
  #### Throws
2530
3103
 
@@ -2536,7 +3109,7 @@ If the function with the given name is not found.
2536
3109
 
2537
3110
  > `static` **runWithPosSync**(`name`, ...`params`): `any`
2538
3111
 
2539
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:458](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L458)
3112
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:625
2540
3113
 
2541
3114
  Synchronously executes a function using positional arguments.
2542
3115
 
@@ -2614,7 +3187,7 @@ The object to change its prototype.
2614
3187
 
2615
3188
  The value of the new prototype or null.
2616
3189
 
2617
- `null` | `object`
3190
+ `object` | `null`
2618
3191
 
2619
3192
  #### Returns
2620
3193
 
@@ -2624,25 +3197,34 @@ The value of the new prototype or null.
2624
3197
 
2625
3198
  ### unregister()
2626
3199
 
2627
- > `static` **unregister**(`name`): `undefined` \| `ToolFunc`
3200
+ > `static` **unregister**(`target`, `options?`): `ToolFunc` \| `undefined`
3201
+
3202
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:737
2628
3203
 
2629
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/tool-func.ts:547](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/tool-func.ts#L547)
3204
+ Unregisters a tool function implementation from the registry by its name, alias, or instance.
2630
3205
 
2631
- Unregisters a function by its name, also removing any associated aliases.
3206
+ This method supports hierarchical unregistration. If a function's reference count
3207
+ reaches zero, it is physically removed from the registry and its dependencies are released.
2632
3208
 
2633
3209
  #### Parameters
2634
3210
 
2635
- ##### name
3211
+ ##### target
2636
3212
 
2637
- `string`
3213
+ The name, alias, or implementation instance.
3214
+
3215
+ `string` | `ToolFunc`
3216
+
3217
+ ##### options?
3218
+
3219
+ Options or a simple 'force' boolean flag.
2638
3220
 
2639
- The name of the function to unregister.
3221
+ `boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
2640
3222
 
2641
3223
  #### Returns
2642
3224
 
2643
- `undefined` \| `ToolFunc`
3225
+ `ToolFunc` \| `undefined`
2644
3226
 
2645
- The unregistered `ToolFunc` instance, or `undefined` if it was not found.
3227
+ The unregistered ToolFunc instance, or `undefined` if not found.
2646
3228
 
2647
3229
  ***
2648
3230
 
@@ -2691,3 +3273,27 @@ Object that contains the properties and methods. This can be an object that you
2691
3273
  ##### Returns
2692
3274
 
2693
3275
  `any`[]
3276
+
3277
+ ***
3278
+
3279
+ ### with()
3280
+
3281
+ > `static` **with**(`ctx`): *typeof* `ToolFunc`
3282
+
3283
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:515
3284
+
3285
+ Returns a static proxy with the provided context.
3286
+
3287
+ #### Parameters
3288
+
3289
+ ##### ctx
3290
+
3291
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
3292
+
3293
+ The context to use.
3294
+
3295
+ #### Returns
3296
+
3297
+ *typeof* `ToolFunc`
3298
+
3299
+ A static proxy of ToolFunc class.