@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: RpcMethodsServerTool
8
8
 
9
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:10](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L10)
9
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:28
10
10
 
11
11
  Represents a function that runs on a server and can be exposed to clients.
12
12
 
@@ -30,9 +30,9 @@ server-side execution contexts. It is designed to work with a transport layer
30
30
 
31
31
  ### Constructor
32
32
 
33
- > **new RpcMethodsServerTool**(`name`, `options`): `RpcMethodsServerTool`
33
+ > **new RpcMethodsServerTool**(`name`, `options?`): `RpcMethodsServerTool`
34
34
 
35
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:42](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L42)
35
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:36
36
36
 
37
37
  The initial value of Object.prototype.constructor is the standard built-in Object constructor.
38
38
 
@@ -42,9 +42,9 @@ The initial value of Object.prototype.constructor is the standard built-in Objec
42
42
 
43
43
  `string` | `Function` | [`FuncItem`](../interfaces/FuncItem.md)
44
44
 
45
- ##### options
45
+ ##### options?
46
46
 
47
- `any` = `{}`
47
+ `any`
48
48
 
49
49
  #### Returns
50
50
 
@@ -56,6 +56,22 @@ The initial value of Object.prototype.constructor is the standard built-in Objec
56
56
 
57
57
  ## Properties
58
58
 
59
+ ### \_registry?
60
+
61
+ > `optional` **\_registry**: *typeof* [`ToolFunc`](ToolFunc.md)
62
+
63
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:496
64
+
65
+ **`Internal`**
66
+
67
+ The registry class where this tool was originally registered.
68
+
69
+ #### Inherited from
70
+
71
+ [`ServerTools`](ServerTools.md).[`_registry`](ServerTools.md#_registry)
72
+
73
+ ***
74
+
59
75
  ### $attributes
60
76
 
61
77
  > **$attributes**: `Properties`
@@ -72,7 +88,7 @@ Defined in: [property-manager.js/src/advance.d.ts:5](https://github.com/snowyu/p
72
88
 
73
89
  > `optional` **action**: `"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
74
90
 
75
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/consts.ts:95](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/utils/consts.ts#L95)
91
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:82
76
92
 
77
93
  The action to be used for the remote call. This typically represents an RPC method name.
78
94
  Only for RESTful HTTP transports, it might be mapped to a standard HTTP method (e.g., GET, POST)
@@ -87,7 +103,7 @@ Only for RESTful HTTP transports, it might be mapped to a standard HTTP method (
87
103
 
88
104
  > `optional` **alias**: `string` \| `string`[]
89
105
 
90
- 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)
106
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:258
91
107
 
92
108
  Optional aliases for the function name.
93
109
 
@@ -101,7 +117,7 @@ Optional aliases for the function name.
101
117
 
102
118
  > `optional` **allowExportFunc**: `boolean`
103
119
 
104
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/server-tools.ts:35](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/server-tools.ts#L35)
120
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:319
105
121
 
106
122
  If set to true, the body of the function (`func`) will be serialized and sent
107
123
  to the client when tools are loaded. This allows the client to execute the
@@ -117,7 +133,7 @@ function locally instead of making a remote call. Defaults to false.
117
133
 
118
134
  > `optional` **apiRoot**: `string`
119
135
 
120
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/consts.ts:89](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/utils/consts.ts#L89)
136
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:76
121
137
 
122
138
  The root endpoint for the remote service.
123
139
 
@@ -135,7 +151,7 @@ Use `transport` instead.
135
151
 
136
152
  > `optional` **asyncFeatures**: `number`
137
153
 
138
- 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)
154
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:272
139
155
 
140
156
  A bitmask representing asynchronous features supported by the function, built from `AsyncFeatureBits`.
141
157
  This allows the system to understand if a function supports capabilities like cancellation or multi-tasking.
@@ -171,6 +187,21 @@ The initial value of Object.prototype.constructor is the standard built-in Objec
171
187
 
172
188
  ***
173
189
 
190
+ ### ctx?
191
+
192
+ > `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
193
+
194
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:547
195
+
196
+ The execution context for the current function call.
197
+ Only available when isolated execution is enabled.
198
+
199
+ #### Inherited from
200
+
201
+ [`ServerTools`](ServerTools.md).[`ctx`](ServerTools.md#ctx)
202
+
203
+ ***
204
+
174
205
  ### defaultOptions
175
206
 
176
207
  > **defaultOptions**: `object`
@@ -197,7 +228,7 @@ The default options for export and assign
197
228
 
198
229
  > `optional` **depends**: `object`
199
230
 
200
- 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)
231
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:295
201
232
 
202
233
  A map of dependencies this function has on other tool functions.
203
234
  Declaring dependencies ensures that they are automatically registered when this function is registered.
@@ -236,7 +267,7 @@ mainFunc.register();
236
267
 
237
268
  > `optional` **description**: `string`
238
269
 
239
- 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)
270
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:302
240
271
 
241
272
  A detailed description of what the function does.
242
273
 
@@ -246,11 +277,25 @@ A detailed description of what the function does.
246
277
 
247
278
  ***
248
279
 
280
+ ### expectedDuration?
281
+
282
+ > `optional` **expectedDuration**: `number`
283
+
284
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:102
285
+
286
+ The expected duration of the remote call in milliseconds.
287
+
288
+ #### Inherited from
289
+
290
+ [`ServerTools`](ServerTools.md).[`expectedDuration`](ServerTools.md#expectedduration)
291
+
292
+ ***
293
+
249
294
  ### fetchOptions?
250
295
 
251
296
  > `optional` **fetchOptions**: `any`
252
297
 
253
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/consts.ts:100](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/utils/consts.ts#L100)
298
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:87
254
299
 
255
300
  Addtional options to be passed to the underlying `fetch` call in a transport.
256
301
 
@@ -264,7 +309,7 @@ Addtional options to be passed to the underlying `fetch` call in a transport.
264
309
 
265
310
  > `optional` **isApi**: `boolean`
266
311
 
267
- 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)
312
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:247
268
313
 
269
314
  If true, indicates that this function should be treated as a server-side API.
270
315
 
@@ -278,7 +323,7 @@ If true, indicates that this function should be treated as a server-side API.
278
323
 
279
324
  > **methods**: `string`[]
280
325
 
281
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:11](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L11)
326
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:29
282
327
 
283
328
  ***
284
329
 
@@ -286,7 +331,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:11](
286
331
 
287
332
  > `optional` **name**: `string`
288
333
 
289
- 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)
334
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:204
290
335
 
291
336
  The unique name of the function.
292
337
 
@@ -314,7 +359,7 @@ the property with the default prefix '$' will not be exported.
314
359
 
315
360
  > **params**: [`FuncParams`](../interfaces/FuncParams.md)
316
361
 
317
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:17](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L17)
362
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:33
318
363
 
319
364
  Parameter definitions, which can be an object mapping names to definitions or an array for positional parameters.
320
365
 
@@ -328,7 +373,7 @@ Parameter definitions, which can be an object mapping names to definitions or an
328
373
 
329
374
  > `optional` **result**: `string` \| `Record`\<`string`, `any`\>
330
375
 
331
- 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)
376
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:214
332
377
 
333
378
  The expected return type of the function, described as a string or a JSON schema object.
334
379
 
@@ -342,7 +387,7 @@ The expected return type of the function, described as a string or a JSON schema
342
387
 
343
388
  > `optional` **scope**: `any`
344
389
 
345
- 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)
390
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:219
346
391
 
347
392
  The execution scope or context (`this`) for the function.
348
393
 
@@ -356,7 +401,7 @@ The execution scope or context (`this`) for the function.
356
401
 
357
402
  > `optional` **setup**: (`this`, `options?`) => `void`
358
403
 
359
- 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)
404
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:242
360
405
 
361
406
  A lifecycle hook called once during the `ToolFunc` instance's initialization.
362
407
  It allows for initial setup, state configuration, or property modification on the instance
@@ -402,7 +447,7 @@ console.log(myFunc.customState); // Outputs: 'configured'
402
447
 
403
448
  > `optional` **stream**: `boolean`
404
449
 
405
- 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)
450
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:253
406
451
 
407
452
  If true, indicates that the function has the *capability* to stream its output.
408
453
  Whether a specific call is streamed is determined by a `stream` property in the runtime parameters.
@@ -417,7 +462,7 @@ Whether a specific call is streamed is determined by a `stream` property in the
417
462
 
418
463
  > `optional` **tags**: `string` \| `string`[]
419
464
 
420
- 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)
465
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:224
421
466
 
422
467
  Tags for grouping or filtering functions.
423
468
 
@@ -427,11 +472,49 @@ Tags for grouping or filtering functions.
427
472
 
428
473
  ***
429
474
 
475
+ ### timeout?
476
+
477
+ > `optional` **timeout**: `number` \| \{ `keepAliveOnTimeout?`: `boolean`; `streamIdleTimeout?`: `number`; `value`: `number`; \}
478
+
479
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:91
480
+
481
+ The timeout configuration for the remote call.
482
+
483
+ #### Type Declaration
484
+
485
+ `number`
486
+
487
+ \{ `keepAliveOnTimeout?`: `boolean`; `streamIdleTimeout?`: `number`; `value`: `number`; \}
488
+
489
+ #### keepAliveOnTimeout?
490
+
491
+ > `optional` **keepAliveOnTimeout**: `boolean`
492
+
493
+ Whether to keep the server-side function running after a timeout.
494
+
495
+ #### streamIdleTimeout?
496
+
497
+ > `optional` **streamIdleTimeout**: `number`
498
+
499
+ The idle timeout for streaming responses in milliseconds.
500
+
501
+ #### value
502
+
503
+ > **value**: `number`
504
+
505
+ The hard timeout in milliseconds.
506
+
507
+ #### Inherited from
508
+
509
+ [`ServerTools`](ServerTools.md).[`timeout`](ServerTools.md#timeout)
510
+
511
+ ***
512
+
430
513
  ### title?
431
514
 
432
515
  > `optional` **title**: `string`
433
516
 
434
- 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)
517
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:307
435
518
 
436
519
  A concise, human-readable title for the function, often used in UI or by AI.
437
520
 
@@ -441,13 +524,32 @@ A concise, human-readable title for the function, often used in UI or by AI.
441
524
 
442
525
  ***
443
526
 
527
+ ### \_refCounts
528
+
529
+ > `protected` `static` **\_refCounts**: `object`
530
+
531
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:489
532
+
533
+ Tracks the number of active registration holds on each function name.
534
+ A function is truly removed only when its reference count drops to zero.
535
+
536
+ #### Index Signature
537
+
538
+ \[`name`: `string`\]: `number`
539
+
540
+ #### Inherited from
541
+
542
+ [`ServerTools`](ServerTools.md).[`_refCounts`](ServerTools.md#_refcounts)
543
+
544
+ ***
545
+
444
546
  ### aliases
445
547
 
446
- > `static` **aliases**: `object` = `{}`
548
+ > `static` **aliases**: `object`
447
549
 
448
- 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)
550
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:480
449
551
 
450
- A static map of aliases to their corresponding function names.
552
+ A static map of aliases to their corresponding primary function names.
451
553
 
452
554
  #### Index Signature
453
555
 
@@ -459,11 +561,25 @@ A static map of aliases to their corresponding function names.
459
561
 
460
562
  ***
461
563
 
564
+ ### ctx?
565
+
566
+ > `static` `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
567
+
568
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:508
569
+
570
+ The static execution context for proxy classes created via ToolFunc.with().
571
+
572
+ #### Inherited from
573
+
574
+ [`ServerTools`](ServerTools.md).[`ctx`](ServerTools.md#ctx-1)
575
+
576
+ ***
577
+
462
578
  ### dataPath
463
579
 
464
580
  > `static` **dataPath**: `string`
465
581
 
466
- 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)
582
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:503
467
583
 
468
584
  A conventional property to designate a file path for saving the registered `ToolFunc` data.
469
585
  Note: The `ToolFunc` class itself does not implement persistence logic. It is up to the
@@ -477,11 +593,11 @@ developer to use this path to save and load the `ToolFunc.items` registry if nee
477
593
 
478
594
  ### items
479
595
 
480
- > `static` **items**: [`Funcs`](../interfaces/Funcs.md) = `{}`
596
+ > `static` **items**: [`Funcs`](../interfaces/Funcs.md)
481
597
 
482
- 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)
598
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:475
483
599
 
484
- A static registry of all `ToolFunc` instances, indexed by name.
600
+ A static registry of all `ToolFunc` implementations, indexed by their primary name.
485
601
 
486
602
  #### Inherited from
487
603
 
@@ -493,7 +609,7 @@ A static registry of all `ToolFunc` instances, indexed by name.
493
609
 
494
610
  > `static` `optional` **SpecialRpcMethodNames**: `string`[]
495
611
 
496
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:15](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L15)
612
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:32
497
613
 
498
614
  ## Accessors
499
615
 
@@ -503,7 +619,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:15](
503
619
 
504
620
  > **get** **SpecialRpcMethodNames**(): `any`
505
621
 
506
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:22](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L22)
622
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:34
507
623
 
508
624
  ##### Returns
509
625
 
@@ -515,15 +631,15 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:22](
515
631
 
516
632
  #### Get Signature
517
633
 
518
- > **get** `static` **apiRoot**(): `undefined` \| `string`
634
+ > **get** `static` **apiRoot**(): `string` \| `undefined`
519
635
 
520
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/server-tools.ts:57](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/server-tools.ts#L57)
636
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:336
521
637
 
522
638
  The conventional root path for the API endpoint.
523
639
 
524
640
  ##### Returns
525
641
 
526
- `undefined` \| `string`
642
+ `string` \| `undefined`
527
643
 
528
644
  #### Inherited from
529
645
 
@@ -531,11 +647,78 @@ The conventional root path for the API endpoint.
531
647
 
532
648
  ## Methods
533
649
 
650
+ ### \_prepareContext()
651
+
652
+ > `protected` **\_prepareContext**(`params?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
653
+
654
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:806
655
+
656
+ Creates the final execution context (`this.ctx`) for a Shadow Instance.
657
+
658
+ NOTE: We MUST use 'this._prepareContext' (instance path) instead of
659
+ 'Static._prepareContext' to allow AOP plugins (like CancelableAbility)
660
+ to hook into context preparation via method overloading ($_prepareContext).
661
+
662
+ #### Parameters
663
+
664
+ ##### params?
665
+
666
+ `any`
667
+
668
+ ##### ctx?
669
+
670
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
671
+
672
+ #### Returns
673
+
674
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
675
+
676
+ #### Inherited from
677
+
678
+ [`ServerTools`](ServerTools.md).[`_prepareContext`](ServerTools.md#_preparecontext)
679
+
680
+ ***
681
+
682
+ ### \_shouldIsolate()
683
+
684
+ > `protected` **\_shouldIsolate**(`params?`, `ctx?`): `boolean`
685
+
686
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:798
687
+
688
+ Determines if the function execution should be isolated into a "Shadow Instance".
689
+
690
+ PRIORITY LOGIC:
691
+ 1. Explicit 'ctx.isolated' in the current call (Highest).
692
+ 2. Any explicit 'ctx' provided (Safe default: isolate to apply new overrides).
693
+ 3. Prevention of recursion (If already an own 'ctx' property exists).
694
+ 4. Inherited 'this.ctx.isolated' configuration.
695
+ 5. Presence of any inherited context (Default: isolate for concurrency safety).
696
+
697
+ #### Parameters
698
+
699
+ ##### params?
700
+
701
+ `any`
702
+
703
+ ##### ctx?
704
+
705
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
706
+
707
+ #### Returns
708
+
709
+ `boolean`
710
+
711
+ #### Inherited from
712
+
713
+ [`ServerTools`](ServerTools.md).[`_shouldIsolate`](ServerTools.md#_shouldisolate)
714
+
715
+ ***
716
+
534
717
  ### arr2ObjParams()
535
718
 
536
719
  > **arr2ObjParams**(`params`): `any`[]
537
720
 
538
- 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)
721
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:770
539
722
 
540
723
  Converts an array of positional arguments into a named parameters object.
541
724
  This is used internally to support functions defined with named parameters.
@@ -730,7 +913,7 @@ the dest object
730
913
 
731
914
  > **cast**(`key`, `value`): `any`
732
915
 
733
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:48](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L48)
916
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:37
734
917
 
735
918
  #### Parameters
736
919
 
@@ -752,7 +935,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:48](
752
935
 
753
936
  > **castParams**(`params`): [`RpcMethodsServerFuncParams`](../interfaces/RpcMethodsServerFuncParams.md)
754
937
 
755
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:64](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L64)
938
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:39
756
939
 
757
940
  #### Parameters
758
941
 
@@ -886,7 +1069,7 @@ the dest object.
886
1069
 
887
1070
  > **func**(`params`): `any`
888
1071
 
889
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:68](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L68)
1072
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:40
890
1073
 
891
1074
  Placeholder for the actual server-side function implementation.
892
1075
  This method is intended to be defined when a `ServerTools` instance is created.
@@ -915,7 +1098,7 @@ The result of the function.
915
1098
 
916
1099
  > **getFunc**(`name?`): `any`
917
1100
 
918
- 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)
1101
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:866
919
1102
 
920
1103
  Gets a bound function reference for execution with named parameters.
921
1104
  If a name is provided, it retrieves a different function from the registry.
@@ -945,7 +1128,7 @@ A function reference or `undefined` if not found.
945
1128
 
946
1129
  > **getFuncWithPos**(`name?`): `any`
947
1130
 
948
- 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)
1131
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:910
949
1132
 
950
1133
  Gets a bound function reference suitable for positional argument execution.
951
1134
  If a name is provided, it retrieves a different function from the registry.
@@ -973,9 +1156,9 @@ A function reference or `undefined` if not found.
973
1156
 
974
1157
  ### getMethodFromParams()
975
1158
 
976
- > **getMethodFromParams**(`params`): `undefined` \| `string`
1159
+ > **getMethodFromParams**(`params`): `string` \| `undefined`
977
1160
 
978
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:59](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L59)
1161
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:38
979
1162
 
980
1163
  #### Parameters
981
1164
 
@@ -985,7 +1168,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:59](
985
1168
 
986
1169
  #### Returns
987
1170
 
988
- `undefined` \| `string`
1171
+ `string` \| `undefined`
989
1172
 
990
1173
  ***
991
1174
 
@@ -1013,7 +1196,7 @@ the descriptors of properties object
1013
1196
 
1014
1197
  > **hasAsyncFeature**(`feature`): `boolean`
1015
1198
 
1016
- 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)
1199
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:916
1017
1200
 
1018
1201
  Checks if the current function instance supports a specific async feature.
1019
1202
 
@@ -1091,15 +1274,15 @@ this object.
1091
1274
 
1092
1275
  ### initRpcMethods()
1093
1276
 
1094
- > **initRpcMethods**(`methods`): `void`
1277
+ > **initRpcMethods**(`methods?`): `void`
1095
1278
 
1096
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/rpc-methods-server-tool.ts:27](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/rpc-methods-server-tool.ts#L27)
1279
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:35
1097
1280
 
1098
1281
  #### Parameters
1099
1282
 
1100
- ##### methods
1283
+ ##### methods?
1101
1284
 
1102
- `string`[] = `...`
1285
+ `string`[]
1103
1286
 
1104
1287
  #### Returns
1105
1288
 
@@ -1165,9 +1348,9 @@ The source object
1165
1348
 
1166
1349
  ### isStream()
1167
1350
 
1168
- > **isStream**(`params`): `undefined` \| `boolean`
1351
+ > **isStream**(`params`): `boolean` \| `undefined`
1169
1352
 
1170
- 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)
1353
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:929
1171
1354
 
1172
1355
  Determines if a function call should produce a stream.
1173
1356
 
@@ -1187,7 +1370,7 @@ The runtime parameters passed to the function call.
1187
1370
 
1188
1371
  #### Returns
1189
1372
 
1190
- `undefined` \| `boolean`
1373
+ `boolean` \| `undefined`
1191
1374
 
1192
1375
  `true` if the call should be streamed, `false` or `undefined` otherwise.
1193
1376
 
@@ -1233,7 +1416,7 @@ the dest object.
1233
1416
 
1234
1417
  > **obj2ArrParams**(`params?`): `any`[]
1235
1418
 
1236
- 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)
1419
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:777
1237
1420
 
1238
1421
  Converts a named parameters object into an array of positional arguments.
1239
1422
  This is used for functions defined with positional parameters.
@@ -1288,7 +1471,7 @@ A property name.
1288
1471
 
1289
1472
  > **register**(): `boolean` \| [`ToolFunc`](ToolFunc.md)
1290
1473
 
1291
- 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)
1474
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:757
1292
1475
 
1293
1476
  Registers the current `ToolFunc` instance into the static registry.
1294
1477
  Also registers any declared dependencies.
@@ -1307,13 +1490,13 @@ The instance itself upon successful registration, or `false` if it already exist
1307
1490
 
1308
1491
  ### run()
1309
1492
 
1310
- > **run**(`params`, `context?`): `Promise`\<`any`\>
1493
+ > **run**(`params`, `options?`): `any`
1311
1494
 
1312
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/server-tools.ts:98](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/server-tools.ts#L98)
1495
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:360
1313
1496
 
1314
1497
  Overrides the base `run` method to inject transport-specific context.
1315
- If a `context` object containing `req` and `reply` is provided, these are
1316
- added to the parameters as `_req` and `_res` before execution.
1498
+ If a `context` object containing `req`, `reply`, and `signal` is provided,
1499
+ these are added to the parameters as `_req`, `_res`, and `_signal` before execution.
1317
1500
 
1318
1501
  #### Parameters
1319
1502
 
@@ -1323,21 +1506,15 @@ added to the parameters as `_req` and `_res` before execution.
1323
1506
 
1324
1507
  The parameters for the function.
1325
1508
 
1326
- ##### context?
1327
-
1328
- The transport-level context.
1329
-
1330
- ###### reply
1509
+ ##### options?
1331
1510
 
1332
1511
  `any`
1333
1512
 
1334
- ###### req
1335
-
1336
- `any`
1513
+ The transport-level context or options.
1337
1514
 
1338
1515
  #### Returns
1339
1516
 
1340
- `Promise`\<`any`\>
1517
+ `any`
1341
1518
 
1342
1519
  The result of the function execution.
1343
1520
 
@@ -1349,12 +1526,14 @@ The result of the function execution.
1349
1526
 
1350
1527
  ### runAs()
1351
1528
 
1352
- > **runAs**(`name`, `params?`): `Promise`\<`any`\>
1529
+ > **runAs**(`name`, `params?`, `ctx?`): `any`
1353
1530
 
1354
- 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)
1531
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:837
1355
1532
 
1356
1533
  Asynchronously executes another registered function by name.
1357
- This method delegates to `runAsSync()` internally.
1534
+
1535
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
1536
+ otherwise it may return the result synchronously.
1358
1537
 
1359
1538
  #### Parameters
1360
1539
 
@@ -1370,11 +1549,17 @@ The name of the target function to run.
1370
1549
 
1371
1550
  Optional parameters to pass to the function.
1372
1551
 
1552
+ ##### ctx?
1553
+
1554
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1555
+
1556
+ The execution context.
1557
+
1373
1558
  #### Returns
1374
1559
 
1375
- `Promise`\<`any`\>
1560
+ `any`
1376
1561
 
1377
- A promise that resolves with the result of the function execution.
1562
+ A promise or the direct result of the function's execution.
1378
1563
 
1379
1564
  #### Inherited from
1380
1565
 
@@ -1384,12 +1569,22 @@ A promise that resolves with the result of the function execution.
1384
1569
 
1385
1570
  ### runAsSync()
1386
1571
 
1387
- > **runAsSync**(`name`, `params?`): `any`
1572
+ > **runAsSync**(`name`, `params?`, `ctx?`): `any`
1573
+
1574
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:858
1575
+
1576
+ Executes another registered function by name, using hierarchical dependency resolution.
1388
1577
 
1389
- 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)
1578
+ This method supports **Late-Binding Polymorphism**. It uses the `rootRegistry` and
1579
+ `binding` strategy from the execution context to resolve dependencies.
1390
1580
 
1391
- Synchronously executes another registered function by name.
1392
- This is a convenience method that forwards the call to the static `runSync()` method.
1581
+ ### Binding Modes:
1582
+ - `'auto'` (Default): **Lineage-Aware**. Uses late-binding only if the `rootRegistry`
1583
+ is a descendant of the tool's definition registry and has shadowed the dependency.
1584
+ Otherwise, uses early-binding for stability.
1585
+ - `'early'`: **Safety First**. Always prefers the pre-bound instance from `depends`.
1586
+ - `'late'`: **Forced Polymorphism**. Always resolves from the `rootRegistry`,
1587
+ ignoring the definer's environment.
1393
1588
 
1394
1589
  #### Parameters
1395
1590
 
@@ -1397,19 +1592,29 @@ This is a convenience method that forwards the call to the static `runSync()` me
1397
1592
 
1398
1593
  `string`
1399
1594
 
1400
- The name of the target function to run.
1595
+ The name or alias of the target function to run.
1401
1596
 
1402
1597
  ##### params?
1403
1598
 
1404
1599
  `any`
1405
1600
 
1406
- Optional parameters to pass to the function.
1601
+ Optional parameters to pass to the target function.
1602
+
1603
+ ##### ctx?
1604
+
1605
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1606
+
1607
+ The execution context.
1407
1608
 
1408
1609
  #### Returns
1409
1610
 
1410
1611
  `any`
1411
1612
 
1412
- The result of the function execution.
1613
+ The result of the target function execution.
1614
+
1615
+ #### Throws
1616
+
1617
+ If the target function cannot be found in the current lineage.
1413
1618
 
1414
1619
  #### Inherited from
1415
1620
 
@@ -1419,9 +1624,9 @@ The result of the function execution.
1419
1624
 
1420
1625
  ### runSync()
1421
1626
 
1422
- > **runSync**(`params?`): `any`
1627
+ > **runSync**(`params?`, `ctx?`): `any`
1423
1628
 
1424
- 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)
1629
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:814
1425
1630
 
1426
1631
  Executes the function synchronously with a named parameters object.
1427
1632
 
@@ -1433,6 +1638,12 @@ Executes the function synchronously with a named parameters object.
1433
1638
 
1434
1639
  The parameters object for the function.
1435
1640
 
1641
+ ##### ctx?
1642
+
1643
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1644
+
1645
+ The execution context.
1646
+
1436
1647
  #### Returns
1437
1648
 
1438
1649
  `any`
@@ -1451,12 +1662,14 @@ Will throw an error if an array of parameters is passed to a function that expec
1451
1662
 
1452
1663
  ### runWithPos()
1453
1664
 
1454
- > **runWithPos**(...`params`): `Promise`\<`any`\>
1665
+ > **runWithPos**(...`params`): `any`
1455
1666
 
1456
- 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)
1667
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:891
1457
1668
 
1458
1669
  Executes the function asynchronously using positional arguments.
1459
- Delegates to `runWithPosSync()` internally.
1670
+
1671
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
1672
+ otherwise it may return the result synchronously.
1460
1673
 
1461
1674
  #### Parameters
1462
1675
 
@@ -1468,9 +1681,9 @@ Positional arguments passed to the function.
1468
1681
 
1469
1682
  #### Returns
1470
1683
 
1471
- `Promise`\<`any`\>
1684
+ `any`
1472
1685
 
1473
- A promise that resolves with the result of the function execution.
1686
+ A promise or the direct result of the function's execution.
1474
1687
 
1475
1688
  #### Inherited from
1476
1689
 
@@ -1480,12 +1693,14 @@ A promise that resolves with the result of the function execution.
1480
1693
 
1481
1694
  ### runWithPosAs()
1482
1695
 
1483
- > **runWithPosAs**(`name`, ...`params`): `Promise`\<`any`\>
1696
+ > **runWithPosAs**(`name`, ...`params`): `any`
1484
1697
 
1485
- 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)
1698
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:902
1486
1699
 
1487
1700
  Asynchronously executes another function by name using positional arguments.
1488
- Delegates to `runWithPosAsSync()` internally.
1701
+
1702
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
1703
+ otherwise it may return the result synchronously.
1489
1704
 
1490
1705
  #### Parameters
1491
1706
 
@@ -1503,9 +1718,9 @@ Positional arguments to pass to the function.
1503
1718
 
1504
1719
  #### Returns
1505
1720
 
1506
- `Promise`\<`any`\>
1721
+ `any`
1507
1722
 
1508
- A promise that resolves with the result of the function execution.
1723
+ A promise or the direct result of the function's execution.
1509
1724
 
1510
1725
  #### Inherited from
1511
1726
 
@@ -1517,7 +1732,7 @@ A promise that resolves with the result of the function execution.
1517
1732
 
1518
1733
  > **runWithPosAsSync**(`name`, ...`params`): `any`
1519
1734
 
1520
- 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)
1735
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:881
1521
1736
 
1522
1737
  Synchronously executes another function by name using positional arguments.
1523
1738
  This is a convenience wrapper around the static `runWithPosSync()` method.
@@ -1552,7 +1767,7 @@ The result of the function execution.
1552
1767
 
1553
1768
  > **runWithPosSync**(...`params`): `any`
1554
1769
 
1555
- 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)
1770
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:873
1556
1771
 
1557
1772
  Executes the function synchronously using positional arguments.
1558
1773
  If the function expects named parameters, it converts the arguments automatically.
@@ -1657,12 +1872,20 @@ Returns a string representation of an object.
1657
1872
 
1658
1873
  ### unregister()
1659
1874
 
1660
- > **unregister**(): `any`
1875
+ > **unregister**(`options?`): `any`
1661
1876
 
1662
- 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)
1877
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:763
1663
1878
 
1664
1879
  Removes the current `ToolFunc` instance from the static registry.
1665
1880
 
1881
+ #### Parameters
1882
+
1883
+ ##### options?
1884
+
1885
+ Unregistration options or a boolean force flag.
1886
+
1887
+ `boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
1888
+
1666
1889
  #### Returns
1667
1890
 
1668
1891
  `any`
@@ -1693,6 +1916,282 @@ Returns the primitive value of the specified object.
1693
1916
 
1694
1917
  ***
1695
1918
 
1919
+ ### with()
1920
+
1921
+ > **with**(`ctx`): `this`
1922
+
1923
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:542
1924
+
1925
+ Returns an isolated instance with the provided context.
1926
+
1927
+ #### Parameters
1928
+
1929
+ ##### ctx
1930
+
1931
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
1932
+
1933
+ The context to use.
1934
+
1935
+ #### Returns
1936
+
1937
+ `this`
1938
+
1939
+ An isolated ToolFunc instance.
1940
+
1941
+ #### Inherited from
1942
+
1943
+ [`ServerTools`](ServerTools.md).[`with`](ServerTools.md#with)
1944
+
1945
+ ***
1946
+
1947
+ ### \_acquireDependencies()
1948
+
1949
+ > `protected` `static` **\_acquireDependencies**(`inst`, `stack?`): `void`
1950
+
1951
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:740
1952
+
1953
+ #### Parameters
1954
+
1955
+ ##### inst
1956
+
1957
+ [`ToolFunc`](ToolFunc.md)
1958
+
1959
+ ##### stack?
1960
+
1961
+ `Set`\<`string`\>
1962
+
1963
+ #### Returns
1964
+
1965
+ `void`
1966
+
1967
+ #### Inherited from
1968
+
1969
+ [`ServerTools`](ServerTools.md).[`_acquireDependencies`](ServerTools.md#_acquiredependencies)
1970
+
1971
+ ***
1972
+
1973
+ ### \_decRefCount()
1974
+
1975
+ > `protected` `static` **\_decRefCount**(`name`): `number`
1976
+
1977
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:739
1978
+
1979
+ #### Parameters
1980
+
1981
+ ##### name
1982
+
1983
+ `string`
1984
+
1985
+ #### Returns
1986
+
1987
+ `number`
1988
+
1989
+ #### Inherited from
1990
+
1991
+ [`ServerTools`](ServerTools.md).[`_decRefCount`](ServerTools.md#_decrefcount)
1992
+
1993
+ ***
1994
+
1995
+ ### \_getRegistrationAction()
1996
+
1997
+ > `protected` `static` **\_getRegistrationAction**(`name`, `override`): `"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
1998
+
1999
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:670
2000
+
2001
+ Analyzes the registration context and determines the appropriate action.
2002
+
2003
+ #### Parameters
2004
+
2005
+ ##### name
2006
+
2007
+ `string`
2008
+
2009
+ The function name to register.
2010
+
2011
+ ##### override
2012
+
2013
+ Override options.
2014
+
2015
+ ###### name?
2016
+
2017
+ `boolean`
2018
+
2019
+ #### Returns
2020
+
2021
+ `"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
2022
+
2023
+ The determined registration action.
2024
+
2025
+ #### Inherited from
2026
+
2027
+ [`ServerTools`](ServerTools.md).[`_getRegistrationAction`](ServerTools.md#_getregistrationaction)
2028
+
2029
+ ***
2030
+
2031
+ ### \_incRefCount()
2032
+
2033
+ > `protected` `static` **\_incRefCount**(`name`): `void`
2034
+
2035
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:738
2036
+
2037
+ #### Parameters
2038
+
2039
+ ##### name
2040
+
2041
+ `string`
2042
+
2043
+ #### Returns
2044
+
2045
+ `void`
2046
+
2047
+ #### Inherited from
2048
+
2049
+ [`ServerTools`](ServerTools.md).[`_incRefCount`](ServerTools.md#_increfcount)
2050
+
2051
+ ***
2052
+
2053
+ ### \_normalizeArguments()
2054
+
2055
+ > `protected` `static` **\_normalizeArguments**(`name`, `options?`): `any`
2056
+
2057
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:643
2058
+
2059
+ **`Internal`**
2060
+
2061
+ Internal helper to normalize arguments from various input patterns.
2062
+ Priority: name (arg1) > options (arg2).
2063
+
2064
+ #### Parameters
2065
+
2066
+ ##### name
2067
+
2068
+ Primary config.
2069
+
2070
+ `string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`FuncItem`](../interfaces/FuncItem.md)
2071
+
2072
+ ##### options?
2073
+
2074
+ `any`
2075
+
2076
+ Default config.
2077
+
2078
+ #### Returns
2079
+
2080
+ `any`
2081
+
2082
+ Normalized options object.
2083
+
2084
+ #### Inherited from
2085
+
2086
+ [`ServerTools`](ServerTools.md).[`_normalizeArguments`](ServerTools.md#_normalizearguments)
2087
+
2088
+ ***
2089
+
2090
+ ### \_normalizeRegisterArguments()
2091
+
2092
+ > `protected` `static` **\_normalizeRegisterArguments**(`name`, `options?`): [`RegisterOptions`](../interfaces/RegisterOptions.md)
2093
+
2094
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:682
2095
+
2096
+ **`Internal`**
2097
+
2098
+ Normalizes the arguments passed to the `register` method into a unified `RegisterOptions` object.
2099
+
2100
+ #### Parameters
2101
+
2102
+ ##### name
2103
+
2104
+ The primary identification or implementation.
2105
+
2106
+ `string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`RegisterOptions`](../interfaces/RegisterOptions.md)
2107
+
2108
+ ##### options?
2109
+
2110
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
2111
+
2112
+ Additional or overriding configuration.
2113
+
2114
+ #### Returns
2115
+
2116
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
2117
+
2118
+ A normalized options object ready for registration.
2119
+
2120
+ #### Inherited from
2121
+
2122
+ [`ServerTools`](ServerTools.md).[`_normalizeRegisterArguments`](ServerTools.md#_normalizeregisterarguments)
2123
+
2124
+ ***
2125
+
2126
+ ### \_prepareContext()
2127
+
2128
+ > `static` **\_prepareContext**(`parentCtx?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
2129
+
2130
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:535
2131
+
2132
+ **`Internal`**
2133
+
2134
+ Internal helper to prepare the execution context, maintaining the prototype chain.
2135
+
2136
+ #### Parameters
2137
+
2138
+ ##### parentCtx?
2139
+
2140
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
2141
+
2142
+ The parent context to inherit from.
2143
+
2144
+ ##### ctx?
2145
+
2146
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
2147
+
2148
+ The new context properties to apply.
2149
+
2150
+ #### Returns
2151
+
2152
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
2153
+
2154
+ The merged context.
2155
+
2156
+ DANGER - DO NOT "OPTIMIZE" UNLESS YOU UNDERSTAND:
2157
+ 1. Why NOT Object.assign(target, ctx) alone?
2158
+ Object.assign only copies 'own' properties. In nested calls (e.g., .with().with()),
2159
+ parent properties exist on the prototype. Using assign would drop all inherited
2160
+ context data (like traceId from a parent runner).
2161
+ 2. Why NOT Object.setPrototypeOf?
2162
+ It's a heavy performance killer in V8. We use Object.create(proto) instead.
2163
+ 3. Why check isPrototypeOf?
2164
+ If ctx is already in the chain, we return it to maintain identity and avoid
2165
+ redundant shadow layers, which is required by many AOP plugins and unit tests.
2166
+
2167
+ #### Inherited from
2168
+
2169
+ [`ServerTools`](ServerTools.md).[`_prepareContext`](ServerTools.md#_preparecontext-2)
2170
+
2171
+ ***
2172
+
2173
+ ### \_releaseDependencies()
2174
+
2175
+ > `protected` `static` **\_releaseDependencies**(`inst`): `void`
2176
+
2177
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:741
2178
+
2179
+ #### Parameters
2180
+
2181
+ ##### inst
2182
+
2183
+ [`ToolFunc`](ToolFunc.md)
2184
+
2185
+ #### Returns
2186
+
2187
+ `void`
2188
+
2189
+ #### Inherited from
2190
+
2191
+ [`ServerTools`](ServerTools.md).[`_releaseDependencies`](ServerTools.md#_releasedependencies)
2192
+
2193
+ ***
2194
+
1696
2195
  ### assign()
1697
2196
 
1698
2197
  #### Call Signature
@@ -1881,6 +2380,27 @@ One or more source objects from which to copy properties
1881
2380
 
1882
2381
  ***
1883
2382
 
2383
+ ### clear()
2384
+
2385
+ > `static` **clear**(): `void`
2386
+
2387
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:661
2388
+
2389
+ Resets the local registry by clearing all registered items, aliases, and reference counts.
2390
+
2391
+ In a hierarchical registry, this only clears properties "owned" by the current
2392
+ layer. Inherited items from parent registries remain visible through the prototype chain.
2393
+
2394
+ #### Returns
2395
+
2396
+ `void`
2397
+
2398
+ #### Inherited from
2399
+
2400
+ [`ServerTools`](ServerTools.md).[`clear`](ServerTools.md#clear)
2401
+
2402
+ ***
2403
+
1884
2404
  ### create()
1885
2405
 
1886
2406
  #### Call Signature
@@ -1897,7 +2417,7 @@ Creates an object that has the specified prototype or that has null prototype.
1897
2417
 
1898
2418
  Object to use as a prototype. May be null.
1899
2419
 
1900
- `null` | `object`
2420
+ `object` | `null`
1901
2421
 
1902
2422
  ##### Returns
1903
2423
 
@@ -1921,7 +2441,7 @@ Creates an object that has the specified prototype, and that optionally contains
1921
2441
 
1922
2442
  Object to use as a prototype. May be null
1923
2443
 
1924
- `null` | `object`
2444
+ `object` | `null`
1925
2445
 
1926
2446
  ###### properties
1927
2447
 
@@ -2231,7 +2751,7 @@ An iterable object that contains key-value entries for properties and methods.
2231
2751
 
2232
2752
  > `static` **get**(`name`): [`ToolFunc`](ToolFunc.md)
2233
2753
 
2234
- 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)
2754
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:553
2235
2755
 
2236
2756
  Retrieves a registered function by its name or alias.
2237
2757
 
@@ -2259,7 +2779,7 @@ The `ToolFunc` instance if found, otherwise `undefined`.
2259
2779
 
2260
2780
  > `static` **getAllByTag**(`tagName`): [`ToolFunc`](ToolFunc.md)[]
2261
2781
 
2262
- 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)
2782
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:570
2263
2783
 
2264
2784
  Retrieves all registered functions that have a specific tag.
2265
2785
 
@@ -2285,9 +2805,9 @@ An array of matching `ToolFunc` instances.
2285
2805
 
2286
2806
  ### getByTag()
2287
2807
 
2288
- > `static` **getByTag**(`tagName`): `undefined` \| [`ToolFunc`](ToolFunc.md)
2808
+ > `static` **getByTag**(`tagName`): [`ToolFunc`](ToolFunc.md) \| `undefined`
2289
2809
 
2290
- 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)
2810
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:564
2291
2811
 
2292
2812
  Finds the first registered function that has a specific tag.
2293
2813
 
@@ -2301,7 +2821,7 @@ The tag to search for.
2301
2821
 
2302
2822
  #### Returns
2303
2823
 
2304
- `undefined` \| [`ToolFunc`](ToolFunc.md)
2824
+ [`ToolFunc`](ToolFunc.md) \| `undefined`
2305
2825
 
2306
2826
  The first matching `ToolFunc` instance, or `undefined` if none is found.
2307
2827
 
@@ -2315,7 +2835,7 @@ The first matching `ToolFunc` instance, or `undefined` if none is found.
2315
2835
 
2316
2836
  > `static` **getFunc**(`name`): `any`
2317
2837
 
2318
- 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)
2838
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:605
2319
2839
 
2320
2840
  Retrieves a bound, runnable function reference for a registered function.
2321
2841
  This reference is suitable for execution with an object of named parameters.
@@ -2344,7 +2864,7 @@ A bound function reference, or `undefined` if not found.
2344
2864
 
2345
2865
  > `static` **getFuncWithPos**(`name`): `any`
2346
2866
 
2347
- 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)
2867
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:632
2348
2868
 
2349
2869
  Retrieves a bound, runnable function reference for a registered function.
2350
2870
  This reference is suitable for execution with positional arguments.
@@ -2371,7 +2891,7 @@ A bound function reference, or `undefined` if not found.
2371
2891
 
2372
2892
  ### getOwnPropertyDescriptor()
2373
2893
 
2374
- > `static` **getOwnPropertyDescriptor**(`o`, `p`): `undefined` \| `PropertyDescriptor`
2894
+ > `static` **getOwnPropertyDescriptor**(`o`, `p`): `PropertyDescriptor` \| `undefined`
2375
2895
 
2376
2896
  Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/typescript/lib/lib.es5.d.ts:175
2377
2897
 
@@ -2394,7 +2914,7 @@ Name of the property.
2394
2914
 
2395
2915
  #### Returns
2396
2916
 
2397
- `undefined` \| `PropertyDescriptor`
2917
+ `PropertyDescriptor` \| `undefined`
2398
2918
 
2399
2919
  #### Inherited from
2400
2920
 
@@ -2535,7 +3055,7 @@ The object that references the prototype.
2535
3055
 
2536
3056
  > `static` **hasAsyncFeature**(`feature`): `boolean`
2537
3057
 
2538
- 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)
3058
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:576
2539
3059
 
2540
3060
  Checks if any registered function has a specific asynchronous feature.
2541
3061
 
@@ -2675,6 +3195,37 @@ Object to test.
2675
3195
 
2676
3196
  ***
2677
3197
 
3198
+ ### isolateRegistry()
3199
+
3200
+ > `static` **isolateRegistry**(`options?`): `void`
3201
+
3202
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:654
3203
+
3204
+ Isolates the current registry layer by branching off its parent using prototype shadowing.
3205
+
3206
+ This creates a new "scope" where:
3207
+ 1. New registrations are stored only in the local layer, supporting tool shadowing.
3208
+ 2. Parent tools remain accessible via the prototype chain (read-only) unless shadowed.
3209
+ 3. Reference counting is isolated, enabling clean per-layer lifecycle management.
3210
+
3211
+ #### Parameters
3212
+
3213
+ ##### options?
3214
+
3215
+ [`ToolFuncRegistryIsolateOptions`](../interfaces/ToolFuncRegistryIsolateOptions.md)
3216
+
3217
+ Options to selectively isolate specific maps (items, aliases, refCounts).
3218
+
3219
+ #### Returns
3220
+
3221
+ `void`
3222
+
3223
+ #### Inherited from
3224
+
3225
+ [`ServerTools`](ServerTools.md).[`isolateRegistry`](ServerTools.md#isolateregistry)
3226
+
3227
+ ***
3228
+
2678
3229
  ### isSealed()
2679
3230
 
2680
3231
  > `static` **isSealed**(`o`): `boolean`
@@ -2755,7 +3306,7 @@ Object that contains the properties and methods. This can be an object that you
2755
3306
 
2756
3307
  > `static` **list**(): [`Funcs`](../interfaces/Funcs.md)
2757
3308
 
2758
- 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)
3309
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:558
2759
3310
 
2760
3311
  Returns the complete map of all registered functions.
2761
3312
 
@@ -2809,9 +3360,24 @@ Object to make non-extensible.
2809
3360
 
2810
3361
  > `static` **register**(`name`, `options`): `boolean` \| [`ToolFunc`](ToolFunc.md)
2811
3362
 
2812
- 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)
3363
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:718
3364
+
3365
+ **`Internal`**
3366
+
3367
+ Registers a `ToolFunc` instance into the registry.
3368
+
3369
+ This method supports multiple overloads and handles hierarchical registration,
3370
+ alias collision protection, and automatic dependency registration with cycle detection.
3371
+
3372
+ ### Hierarchical Behavior:
3373
+ - In an isolated registry, items are stored locally, shadowing parent items with the same name.
3374
+ - Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
3375
+ unless `allowOverride.alias` is explicitly granted.
2813
3376
 
2814
- Registers a new tool function.
3377
+ ### Circular Dependencies:
3378
+ Automatically detects and manages circular dependency chains using an internal stack.
3379
+ Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
3380
+ and enable clean group unregistration.
2815
3381
 
2816
3382
  ##### Parameters
2817
3383
 
@@ -2819,19 +3385,38 @@ Registers a new tool function.
2819
3385
 
2820
3386
  `string`
2821
3387
 
2822
- The name of the function.
3388
+ The tool instance, function, or name to register.
2823
3389
 
2824
3390
  ###### options
2825
3391
 
2826
- [`FuncItem`](../interfaces/FuncItem.md)
3392
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
2827
3393
 
2828
- The function's configuration.
3394
+ Configuration or implementation for the tool.
2829
3395
 
2830
3396
  ##### Returns
2831
3397
 
2832
3398
  `boolean` \| [`ToolFunc`](ToolFunc.md)
2833
3399
 
2834
- The new `ToolFunc` instance, or `false` if a function with that name already exists.
3400
+ The registered ToolFunc instance on success (creation, shadowing, or override),
3401
+ or `false` if registration was ignored (e.g., ref-count increment only).
3402
+
3403
+ ##### Example
3404
+
3405
+ ```ts
3406
+ // 1. Registering with explicit name and function
3407
+ ToolFunc.register('add', { func: (a, b) => a + b });
3408
+
3409
+ // 2. Registering with shadowing permission in an isolated registry
3410
+ MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
3411
+
3412
+ // 3. Registering an existing ToolFunc instance
3413
+ const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
3414
+ ToolFunc.register(tool);
3415
+ ```
3416
+
3417
+ ##### Throws
3418
+
3419
+ If name is missing, or if an alias collision occurs without permission.
2835
3420
 
2836
3421
  ##### Inherited from
2837
3422
 
@@ -2841,9 +3426,24 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
2841
3426
 
2842
3427
  > `static` **register**(`func`, `options`): `boolean` \| [`ToolFunc`](ToolFunc.md)
2843
3428
 
2844
- 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)
3429
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:719
3430
+
3431
+ **`Internal`**
3432
+
3433
+ Registers a `ToolFunc` instance into the registry.
3434
+
3435
+ This method supports multiple overloads and handles hierarchical registration,
3436
+ alias collision protection, and automatic dependency registration with cycle detection.
3437
+
3438
+ ### Hierarchical Behavior:
3439
+ - In an isolated registry, items are stored locally, shadowing parent items with the same name.
3440
+ - Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
3441
+ unless `allowOverride.alias` is explicitly granted.
2845
3442
 
2846
- Registers a new tool function.
3443
+ ### Circular Dependencies:
3444
+ Automatically detects and manages circular dependency chains using an internal stack.
3445
+ Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
3446
+ and enable clean group unregistration.
2847
3447
 
2848
3448
  ##### Parameters
2849
3449
 
@@ -2851,19 +3451,36 @@ Registers a new tool function.
2851
3451
 
2852
3452
  `Function`
2853
3453
 
2854
- The function implementation.
2855
-
2856
3454
  ###### options
2857
3455
 
2858
- [`FuncItem`](../interfaces/FuncItem.md)
3456
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
2859
3457
 
2860
- The function's configuration.
3458
+ Configuration or implementation for the tool.
2861
3459
 
2862
3460
  ##### Returns
2863
3461
 
2864
3462
  `boolean` \| [`ToolFunc`](ToolFunc.md)
2865
3463
 
2866
- The new `ToolFunc` instance, or `false` if a function with that name already exists.
3464
+ The registered ToolFunc instance on success (creation, shadowing, or override),
3465
+ or `false` if registration was ignored (e.g., ref-count increment only).
3466
+
3467
+ ##### Example
3468
+
3469
+ ```ts
3470
+ // 1. Registering with explicit name and function
3471
+ ToolFunc.register('add', { func: (a, b) => a + b });
3472
+
3473
+ // 2. Registering with shadowing permission in an isolated registry
3474
+ MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
3475
+
3476
+ // 3. Registering an existing ToolFunc instance
3477
+ const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
3478
+ ToolFunc.register(tool);
3479
+ ```
3480
+
3481
+ ##### Throws
3482
+
3483
+ If name is missing, or if an alias collision occurs without permission.
2867
3484
 
2868
3485
  ##### Inherited from
2869
3486
 
@@ -2871,31 +3488,71 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
2871
3488
 
2872
3489
  #### Call Signature
2873
3490
 
2874
- > `static` **register**(`name`, `options?`): `boolean` \| [`ToolFunc`](ToolFunc.md)
3491
+ > `static` **register**(`name`, `options?`, `_stack?`): `boolean` \| [`ToolFunc`](ToolFunc.md)
3492
+
3493
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:720
3494
+
3495
+ **`Internal`**
3496
+
3497
+ Registers a `ToolFunc` instance into the registry.
3498
+
3499
+ This method supports multiple overloads and handles hierarchical registration,
3500
+ alias collision protection, and automatic dependency registration with cycle detection.
2875
3501
 
2876
- 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)
3502
+ ### Hierarchical Behavior:
3503
+ - In an isolated registry, items are stored locally, shadowing parent items with the same name.
3504
+ - Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
3505
+ unless `allowOverride.alias` is explicitly granted.
2877
3506
 
2878
- Registers a new tool function.
3507
+ ### Circular Dependencies:
3508
+ Automatically detects and manages circular dependency chains using an internal stack.
3509
+ Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
3510
+ and enable clean group unregistration.
2879
3511
 
2880
3512
  ##### Parameters
2881
3513
 
2882
3514
  ###### name
2883
3515
 
2884
- The name of the function.
3516
+ The tool instance, function, or name to register.
2885
3517
 
2886
- `string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`FuncItem`](../interfaces/FuncItem.md)
3518
+ `string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`RegisterOptions`](../interfaces/RegisterOptions.md)
2887
3519
 
2888
3520
  ###### options?
2889
3521
 
2890
- [`FuncItem`](../interfaces/FuncItem.md)
3522
+ [`RegisterOptions`](../interfaces/RegisterOptions.md)
3523
+
3524
+ Configuration or implementation for the tool.
2891
3525
 
2892
- The function's configuration.
3526
+ ###### \_stack?
3527
+
3528
+ `Set`\<`string`\>
3529
+
3530
+ Used for cycle detection during recursive registration.
2893
3531
 
2894
3532
  ##### Returns
2895
3533
 
2896
3534
  `boolean` \| [`ToolFunc`](ToolFunc.md)
2897
3535
 
2898
- The new `ToolFunc` instance, or `false` if a function with that name already exists.
3536
+ The registered ToolFunc instance on success (creation, shadowing, or override),
3537
+ or `false` if registration was ignored (e.g., ref-count increment only).
3538
+
3539
+ ##### Example
3540
+
3541
+ ```ts
3542
+ // 1. Registering with explicit name and function
3543
+ ToolFunc.register('add', { func: (a, b) => a + b });
3544
+
3545
+ // 2. Registering with shadowing permission in an isolated registry
3546
+ MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
3547
+
3548
+ // 3. Registering an existing ToolFunc instance
3549
+ const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
3550
+ ToolFunc.register(tool);
3551
+ ```
3552
+
3553
+ ##### Throws
3554
+
3555
+ If name is missing, or if an alias collision occurs without permission.
2899
3556
 
2900
3557
  ##### Inherited from
2901
3558
 
@@ -2905,12 +3562,15 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
2905
3562
 
2906
3563
  ### run()
2907
3564
 
2908
- > `static` **run**(`name`, `params?`): `Promise`\<`any`\>
3565
+ > `static` **run**(`name`, `params?`, `ctx?`): `any`
2909
3566
 
2910
- 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)
3567
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:589
2911
3568
 
2912
3569
  Asynchronously executes a registered function by name with named parameters.
2913
3570
 
3571
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
3572
+ otherwise it may return the result synchronously.
3573
+
2914
3574
  #### Parameters
2915
3575
 
2916
3576
  ##### name
@@ -2925,11 +3585,17 @@ The name of the function to run.
2925
3585
 
2926
3586
  The parameters object for the function.
2927
3587
 
3588
+ ##### ctx?
3589
+
3590
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
3591
+
3592
+ The execution context.
3593
+
2928
3594
  #### Returns
2929
3595
 
2930
- `Promise`\<`any`\>
3596
+ `any`
2931
3597
 
2932
- A promise that resolves with the function's result.
3598
+ A promise or the direct result of the function's execution.
2933
3599
 
2934
3600
  #### Throws
2935
3601
 
@@ -2943,9 +3609,9 @@ If the function with the given name is not found.
2943
3609
 
2944
3610
  ### runSync()
2945
3611
 
2946
- > `static` **runSync**(`name`, `params?`): `any`
3612
+ > `static` **runSync**(`name`, `params?`, `ctx?`): `any`
2947
3613
 
2948
- 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)
3614
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:598
2949
3615
 
2950
3616
  Synchronously executes a registered function by name with named parameters.
2951
3617
 
@@ -2963,6 +3629,12 @@ The name of the function to run.
2963
3629
 
2964
3630
  The parameters object for the function.
2965
3631
 
3632
+ ##### ctx?
3633
+
3634
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
3635
+
3636
+ The execution context.
3637
+
2966
3638
  #### Returns
2967
3639
 
2968
3640
  `any`
@@ -2981,12 +3653,15 @@ If the function with the given name is not found.
2981
3653
 
2982
3654
  ### runWithPos()
2983
3655
 
2984
- > `static` **runWithPos**(`name`, ...`params`): `Promise`\<`any`\>
3656
+ > `static` **runWithPos**(`name`, ...`params`): `any`
2985
3657
 
2986
- 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)
3658
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:617
2987
3659
 
2988
3660
  Asynchronously executes a function using positional arguments.
2989
3661
 
3662
+ Note: This method returns a `Promise` if the underlying function is asynchronous,
3663
+ otherwise it may return the result synchronously.
3664
+
2990
3665
  #### Parameters
2991
3666
 
2992
3667
  ##### name
@@ -3003,9 +3678,9 @@ Positional arguments to pass to the function.
3003
3678
 
3004
3679
  #### Returns
3005
3680
 
3006
- `Promise`\<`any`\>
3681
+ `any`
3007
3682
 
3008
- A promise that resolves with the function's result.
3683
+ A promise or the direct result of the function's execution.
3009
3684
 
3010
3685
  #### Throws
3011
3686
 
@@ -3021,7 +3696,7 @@ If the function with the given name is not found.
3021
3696
 
3022
3697
  > `static` **runWithPosSync**(`name`, ...`params`): `any`
3023
3698
 
3024
- 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)
3699
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:625
3025
3700
 
3026
3701
  Synchronously executes a function using positional arguments.
3027
3702
 
@@ -3091,7 +3766,7 @@ Object on which to lock the attributes.
3091
3766
 
3092
3767
  > `static` **setApiRoot**(`v`): `void`
3093
3768
 
3094
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/server-tools.ts:61](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/server-tools.ts#L61)
3769
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:337
3095
3770
 
3096
3771
  #### Parameters
3097
3772
 
@@ -3129,7 +3804,7 @@ The object to change its prototype.
3129
3804
 
3130
3805
  The value of the new prototype or null.
3131
3806
 
3132
- `null` | `object`
3807
+ `object` | `null`
3133
3808
 
3134
3809
  #### Returns
3135
3810
 
@@ -3145,12 +3820,13 @@ The value of the new prototype or null.
3145
3820
 
3146
3821
  > `static` **toJSON**(): `object`
3147
3822
 
3148
- Defined in: [@isdk/ai-tools/packages/ai-tool/src/server-tools.ts:74](https://github.com/isdk/ai-tool.js/blob/e883e341c67e937e7d3a3e95e8bc56844896f5a3/src/server-tools.ts#L74)
3823
+ Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index.d.ts:41
3149
3824
 
3150
3825
  Serializes all registered `ServerTools` instances into a JSON object.
3151
3826
  This method is typically called by a transport's discovery endpoint.
3152
3827
 
3153
- It filters for tools that are instances of `ServerTools` or marked as `isApi`.
3828
+ It filters for tools that are instances of `this` (the current class)
3829
+ or marked as `isApi` but NOT an instance of `ServerTools` (e.g., base ToolFunc).
3154
3830
  It omits the `func` body from the output unless `allowExportFunc` is true.
3155
3831
 
3156
3832
  #### Returns
@@ -3167,25 +3843,34 @@ A map of serializable tool definitions.
3167
3843
 
3168
3844
  ### unregister()
3169
3845
 
3170
- > `static` **unregister**(`name`): `undefined` \| [`ToolFunc`](ToolFunc.md)
3846
+ > `static` **unregister**(`target`, `options?`): [`ToolFunc`](ToolFunc.md) \| `undefined`
3847
+
3848
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:737
3171
3849
 
3172
- 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)
3850
+ Unregisters a tool function implementation from the registry by its name, alias, or instance.
3173
3851
 
3174
- Unregisters a function by its name, also removing any associated aliases.
3852
+ This method supports hierarchical unregistration. If a function's reference count
3853
+ reaches zero, it is physically removed from the registry and its dependencies are released.
3175
3854
 
3176
3855
  #### Parameters
3177
3856
 
3178
- ##### name
3857
+ ##### target
3179
3858
 
3180
- `string`
3859
+ The name, alias, or implementation instance.
3860
+
3861
+ `string` | [`ToolFunc`](ToolFunc.md)
3181
3862
 
3182
- The name of the function to unregister.
3863
+ ##### options?
3864
+
3865
+ Options or a simple 'force' boolean flag.
3866
+
3867
+ `boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
3183
3868
 
3184
3869
  #### Returns
3185
3870
 
3186
- `undefined` \| [`ToolFunc`](ToolFunc.md)
3871
+ [`ToolFunc`](ToolFunc.md) \| `undefined`
3187
3872
 
3188
- The unregistered `ToolFunc` instance, or `undefined` if it was not found.
3873
+ The unregistered ToolFunc instance, or `undefined` if not found.
3189
3874
 
3190
3875
  #### Inherited from
3191
3876
 
@@ -3246,3 +3931,31 @@ Object that contains the properties and methods. This can be an object that you
3246
3931
  ##### Inherited from
3247
3932
 
3248
3933
  [`ServerTools`](ServerTools.md).[`values`](ServerTools.md#values)
3934
+
3935
+ ***
3936
+
3937
+ ### with()
3938
+
3939
+ > `static` **with**(`ctx`): *typeof* [`ToolFunc`](ToolFunc.md)
3940
+
3941
+ Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:515
3942
+
3943
+ Returns a static proxy with the provided context.
3944
+
3945
+ #### Parameters
3946
+
3947
+ ##### ctx
3948
+
3949
+ [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
3950
+
3951
+ The context to use.
3952
+
3953
+ #### Returns
3954
+
3955
+ *typeof* [`ToolFunc`](ToolFunc.md)
3956
+
3957
+ A static proxy of ToolFunc class.
3958
+
3959
+ #### Inherited from
3960
+
3961
+ [`ServerTools`](ServerTools.md).[`with`](ServerTools.md#with-2)