@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.
- package/dist/chunk-BIJ2JH4U.mjs +1 -0
- package/dist/chunk-OYMVHUDZ.mjs +1 -0
- package/dist/funcs.d.mts +16 -5
- package/dist/funcs.d.ts +16 -5
- package/dist/funcs.js +1 -1
- package/dist/funcs.mjs +1 -1
- package/dist/index.d.mts +839 -563
- package/dist/index.d.ts +839 -563
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test/util.d.mts +1 -1
- package/dist/test/util.d.ts +1 -1
- package/dist/test/util.js +1 -1
- package/dist/test/util.mjs +1 -1
- package/docs/api/@isdk/namespaces/ClientTools/README.md +11 -0
- package/docs/api/@isdk/namespaces/ClientTools/functions/get.md +27 -0
- package/docs/api/@isdk/namespaces/EventStates/variables/ABORT.md +1 -1
- package/docs/api/@isdk/namespaces/EventStates/variables/CONTINUE.md +1 -1
- package/docs/api/@isdk/namespaces/EventStates/variables/DONE.md +1 -1
- package/docs/api/@isdk/namespaces/EventStates/variables/STOPPED.md +1 -1
- package/docs/api/classes/BinarySemaphore.md +148 -67
- package/docs/api/classes/CancelableAbility.md +95 -43
- package/docs/api/classes/ClientToolTransport.md +31 -16
- package/docs/api/classes/ClientTools.md +868 -158
- package/docs/api/classes/CmdArgLexer.md +82 -0
- package/docs/api/classes/CmdArgParser.md +56 -0
- package/docs/api/classes/ConfigFile.md +6 -6
- package/docs/api/classes/EnvPromptTemplate.md +224 -52
- package/docs/api/classes/EventClient.md +902 -192
- package/docs/api/classes/EventEmitter.md +62 -12
- package/docs/api/classes/EventServer.md +895 -182
- package/docs/api/classes/EventToolFunc.md +801 -123
- package/docs/api/classes/FStringPromptTemplate.md +224 -52
- package/docs/api/classes/FewShotPromptTemplate.md +231 -59
- package/docs/api/classes/GolangPromptTemplate.md +224 -52
- package/docs/api/classes/HttpClientToolTransport.md +33 -19
- package/docs/api/classes/HttpServerToolTransport.md +15 -15
- package/docs/api/classes/IntSet.md +21 -21
- package/docs/api/classes/MailboxClientTransport.md +398 -0
- package/docs/api/classes/MailboxServerTransport.md +433 -0
- package/docs/api/classes/PromptExampleSelector.md +11 -11
- package/docs/api/classes/PromptTemplate.md +199 -51
- package/docs/api/classes/ReadableStreamError.md +2 -2
- package/docs/api/classes/ResClientTools.md +875 -165
- package/docs/api/classes/ResServerTools.md +869 -156
- package/docs/api/classes/RpcMethodsClientTool.md +870 -160
- package/docs/api/classes/RpcMethodsServerTool.md +865 -152
- package/docs/api/classes/SSEChannel.md +23 -23
- package/docs/api/classes/Semaphore.md +148 -76
- package/docs/api/classes/ServerToolTransport.md +14 -13
- package/docs/api/classes/ServerTools.md +854 -138
- package/docs/api/classes/SignalGate.md +12 -12
- package/docs/api/classes/SseClientPubSubTransport.md +4 -4
- package/docs/api/classes/SseServerPubSubTransport.md +13 -13
- package/docs/api/classes/TaskAbortController.md +33 -11
- package/docs/api/classes/ToolFunc.md +725 -119
- package/docs/api/classes/ToolTransport.md +7 -7
- package/docs/api/classes/YamlTypeBaseObject.md +2 -2
- package/docs/api/enumerations/AsyncFeatureBits.md +4 -4
- package/docs/api/enumerations/AsyncFeatures.md +4 -4
- package/docs/api/enumerations/CmdArgTokenType.md +129 -0
- package/docs/api/enumerations/HashAlgorithm.md +38 -12
- package/docs/api/functions/AIArgProcessor.md +8 -17
- package/docs/api/functions/AIStream.md +1 -1
- package/docs/api/functions/ChoiceArgProcessor.md +13 -15
- package/docs/api/functions/DefaultDateFormat.md +1 -1
- package/docs/api/functions/ObjectArgsToArgsInfo.md +11 -9
- package/docs/api/functions/RateLimit.md +33 -6
- package/docs/api/functions/TemplateArgProcessor.md +13 -15
- package/docs/api/functions/assignDirs.md +1 -1
- package/docs/api/functions/beforeShutdown.md +3 -3
- package/docs/api/functions/calcPerplexity.md +3 -3
- package/docs/api/functions/calcPerplexitySimple.md +3 -3
- package/docs/api/functions/cmdArgEvaluate.md +28 -0
- package/docs/api/functions/cmdArgsToMergedObject.md +34 -0
- package/docs/api/functions/completeSentences.md +1 -1
- package/docs/api/functions/concatText.md +1 -1
- package/docs/api/functions/countLLMTokens.md +1 -1
- package/docs/api/functions/countRegexMatches.md +1 -1
- package/docs/api/functions/createCallbacksTransformer.md +23 -19
- package/docs/api/functions/createEmptyReadableStream.md +1 -1
- package/docs/api/functions/createEndWithRepetitionDetector.md +4 -4
- package/docs/api/functions/createEventStreamTransformer.md +1 -1
- package/docs/api/functions/createHfValueFunc.md +1 -1
- package/docs/api/functions/createLRUCache.md +1 -1
- package/docs/api/functions/createYamlObjectTag.md +1 -1
- package/docs/api/functions/dateToText.md +1 -1
- package/docs/api/functions/decodeCharset.md +1 -1
- package/docs/api/functions/defaultsWithConcat.md +1 -1
- package/docs/api/functions/detectCharset.md +1 -1
- package/docs/api/functions/encodeLLMTokens.md +1 -1
- package/docs/api/functions/ensureQuoted.md +3 -1
- package/docs/api/functions/evaluateExpression.md +40 -0
- package/docs/api/functions/eventable.md +1 -1
- package/docs/api/functions/expandConfig.md +1 -1
- package/docs/api/functions/expandEnv.md +1 -1
- package/docs/api/functions/expandObjEnv.md +1 -1
- package/docs/api/functions/expandPath.md +1 -1
- package/docs/api/functions/expandPathInObject.md +1 -1
- package/docs/api/functions/expandPaths.md +1 -1
- package/docs/api/functions/extNameLevel.md +1 -1
- package/docs/api/functions/extractCodeBlock.md +51 -0
- package/docs/api/functions/fileIsExists.md +3 -3
- package/docs/api/functions/filterValidFnScope.md +3 -3
- package/docs/api/functions/findIndexNonEmptyFrom.md +1 -1
- package/docs/api/functions/findPort.md +13 -5
- package/docs/api/functions/formatTextWithSpace.md +1 -1
- package/docs/api/functions/funcGetMeta.md +1 -1
- package/docs/api/functions/funcWithMeta.md +4 -4
- package/docs/api/functions/genUrlParamsStr.md +1 -1
- package/docs/api/functions/getAllEnumKeys.md +1 -1
- package/docs/api/functions/getConfigFileNames.md +1 -1
- package/docs/api/functions/getConfigs.md +1 -1
- package/docs/api/functions/getEnvVairables.md +1 -1
- package/docs/api/functions/getFileMetaInfo.md +1 -1
- package/docs/api/functions/getHashAlgoBySize.md +1 -1
- package/docs/api/functions/getKeysPath.md +1 -1
- package/docs/api/functions/getLLMTokenizer.md +1 -1
- package/docs/api/functions/getMultiLevelExtname.md +1 -1
- package/docs/api/functions/getPackageDir.md +1 -1
- package/docs/api/functions/getRealFilepath.md +1 -1
- package/docs/api/functions/getResponseErrorReadableStream.md +2 -2
- package/docs/api/functions/getXDGConfigs.md +1 -1
- package/docs/api/functions/hasDirectoryIn.md +3 -3
- package/docs/api/functions/hash.md +25 -4
- package/docs/api/functions/hashFile.md +1 -1
- package/docs/api/functions/hashObject.md +23 -1
- package/docs/api/functions/hashStream.md +25 -4
- package/docs/api/functions/initShutdown.md +1 -1
- package/docs/api/functions/isIdentifier.md +30 -0
- package/docs/api/functions/isLangUsingSpaces.md +1 -1
- package/docs/api/functions/isListItemString.md +3 -3
- package/docs/api/functions/isModelNameMatched.md +3 -3
- package/docs/api/functions/isPathIdentifier.md +23 -0
- package/docs/api/functions/isPunctuationChar.md +1 -1
- package/docs/api/functions/isQuoted.md +4 -1
- package/docs/api/functions/isRegExp.md +20 -1
- package/docs/api/functions/isSameString.md +1 -1
- package/docs/api/functions/isSectionString.md +3 -3
- package/docs/api/functions/isSentenceEnding.md +1 -1
- package/docs/api/functions/isSepLineString.md +3 -3
- package/docs/api/functions/isStrWrapped.md +3 -1
- package/docs/api/functions/isSubdirectory.md +1 -1
- package/docs/api/functions/isTitleString.md +3 -3
- package/docs/api/functions/isValidFilename.md +1 -1
- package/docs/api/functions/isValidFilepath.md +1 -1
- package/docs/api/functions/isWebStream.md +1 -1
- package/docs/api/functions/joinSplitWords.md +1 -1
- package/docs/api/functions/jsonFilterToWhere.md +1 -1
- package/docs/api/functions/jsonToMarkdownStr.md +1 -1
- package/docs/api/functions/loadAIConfig.md +1 -1
- package/docs/api/functions/loadConfig.md +1 -1
- package/docs/api/functions/loadConfigFile.md +1 -1
- package/docs/api/functions/loadFileFromPaths.md +1 -1
- package/docs/api/functions/loadTextFromPaths.md +1 -1
- package/docs/api/functions/lrucache.md +1 -1
- package/docs/api/functions/matchUrlProtocol.md +3 -3
- package/docs/api/functions/memoize.md +1 -1
- package/docs/api/functions/mergeArray.md +1 -1
- package/docs/api/functions/messagesToText.md +1 -1
- package/docs/api/functions/normalizePath.md +1 -1
- package/docs/api/functions/paramsSizeToScaleStr.md +1 -1
- package/docs/api/functions/parseCommand.md +21 -4
- package/docs/api/functions/parseJsJson.md +1 -1
- package/docs/api/functions/parseJsJsonSimpleSync.md +1 -1
- package/docs/api/functions/parseObjectArguments.md +17 -33
- package/docs/api/functions/parseYaml.md +1 -1
- package/docs/api/functions/prependNewlineIfMultiline.md +39 -0
- package/docs/api/functions/pruneSubdirectories.md +1 -1
- package/docs/api/functions/pruneSubdirectoriesInPlace.md +1 -1
- package/docs/api/functions/quoteStr.md +4 -1
- package/docs/api/functions/readFilenamesRecursiveSync.md +1 -1
- package/docs/api/functions/readTextFileChunks.md +1 -1
- package/docs/api/functions/readTextFileChunksEx.md +1 -1
- package/docs/api/functions/readableFromAsyncIterable.md +1 -1
- package/docs/api/functions/registerCoreTools.md +1 -1
- package/docs/api/functions/registerYamlTag.md +2 -2
- package/docs/api/functions/removeMarkdownBold.md +1 -1
- package/docs/api/functions/removeMarkdownBoldAndItalic.md +1 -1
- package/docs/api/functions/removeMarkdownItalic.md +1 -1
- package/docs/api/functions/replaceWithPlaceholder.md +3 -18
- package/docs/api/functions/restoreFromPlacehoders.md +2 -20
- package/docs/api/functions/sanitizeFilename.md +1 -1
- package/docs/api/functions/sanitizeFilepath.md +1 -1
- package/docs/api/functions/saveConfigFile.md +1 -1
- package/docs/api/functions/scaleStrToParamsSize.md +1 -1
- package/docs/api/functions/shutdown.md +2 -2
- package/docs/api/functions/simplifyObjectArguments.md +4 -1
- package/docs/api/functions/simplifyResult.md +34 -0
- package/docs/api/functions/sleep.md +1 -1
- package/docs/api/functions/sortedValues.md +1 -1
- package/docs/api/functions/splitChunks.md +1 -1
- package/docs/api/functions/splitParagraph.md +1 -1
- package/docs/api/functions/splitSentence.md +1 -1
- package/docs/api/functions/splitWords.md +1 -1
- package/docs/api/functions/stringifyYaml.md +1 -1
- package/docs/api/functions/stripConsoleColor.md +1 -1
- package/docs/api/functions/textToDate.md +1 -1
- package/docs/api/functions/textify.md +43 -0
- package/docs/api/functions/toDateTime.md +3 -3
- package/docs/api/functions/toRegExp.md +1 -1
- package/docs/api/functions/trimStartOfStreamHelper.md +1 -1
- package/docs/api/functions/truncTo.md +1 -1
- package/docs/api/functions/truncateByToken.md +1 -1
- package/docs/api/functions/truncateToTokenLimit.md +1 -1
- package/docs/api/functions/truncateToTokenLimitEx.md +1 -1
- package/docs/api/functions/uuid.md +1 -1
- package/docs/api/functions/wrapEventEmitter.md +1 -1
- package/docs/api/functions/wrapFlagValue.md +29 -0
- package/docs/api/functions/xxhash.md +27 -6
- package/docs/api/functions/xxhash32.md +22 -4
- package/docs/api/functions/xxhash64.md +22 -4
- package/docs/api/functions/xxhashAsStr.md +27 -6
- package/docs/api/functions/yieldExec.md +1 -1
- package/docs/api/globals.md +51 -18
- package/docs/api/interfaces/AIChatAssistantMessageParam.md +14 -14
- package/docs/api/interfaces/AIChatContentPartBase.md +26 -0
- package/docs/api/interfaces/AIChatContentPartImage.md +15 -3
- package/docs/api/interfaces/AIChatContentPartText.md +15 -3
- package/docs/api/interfaces/AIChatMessageParamBase.md +9 -9
- package/docs/api/interfaces/AIChatMessageToolCall.md +12 -8
- package/docs/api/interfaces/AIChatSystemMessageParam.md +10 -10
- package/docs/api/interfaces/AIChatToolChoiceFuncObject.md +3 -3
- package/docs/api/interfaces/AIChatToolChoiceObject.md +2 -2
- package/docs/api/interfaces/AIChatToolDefinition.md +45 -0
- package/docs/api/interfaces/AIChatToolFunc.md +5 -5
- package/docs/api/interfaces/AIChatToolFuncParam.md +3 -3
- package/docs/api/interfaces/AIChatToolMessageParam.md +13 -13
- package/docs/api/interfaces/AIChatToolParam.md +2 -2
- package/docs/api/interfaces/AIChatToolTypeObject.md +2 -2
- package/docs/api/interfaces/AIChatUserMessageParam.md +14 -14
- package/docs/api/interfaces/AIResult.md +7 -7
- package/docs/api/interfaces/AIStreamParser.md +2 -2
- package/docs/api/interfaces/AIStreamParserOptions.md +2 -2
- package/docs/api/interfaces/BaseFunc.md +15 -15
- package/docs/api/interfaces/BaseFuncItem.md +16 -16
- package/docs/api/interfaces/BinarySemaphoreAcquireOptions.md +9 -2
- package/docs/api/interfaces/BinarySemaphoreOptions.md +22 -5
- package/docs/api/interfaces/BinarySemaphoreReleaseOptions.md +7 -5
- package/docs/api/interfaces/CancelableAbilityOptions.md +4 -4
- package/docs/api/interfaces/ClientFuncItem.md +70 -19
- package/docs/api/interfaces/CmdArgAIChoiceConfig.md +97 -0
- package/docs/api/interfaces/CmdArgArgsInfo.md +31 -0
- package/docs/api/interfaces/CmdArgContext.md +103 -0
- package/docs/api/interfaces/CmdArgFlagMetadata.md +21 -0
- package/docs/api/interfaces/CmdArgMapResult.md +41 -0
- package/docs/api/interfaces/CmdArgParseResult.md +51 -0
- package/docs/api/interfaces/CmdArgParsedCommand.md +41 -0
- package/docs/api/interfaces/CmdArgParserOptions.md +225 -0
- package/docs/api/interfaces/CmdArgProcessorResultOptions.md +22 -0
- package/docs/api/interfaces/CmdArgSimplifyOptions.md +101 -0
- package/docs/api/interfaces/CmdArgToken.md +51 -0
- package/docs/api/interfaces/EventClientFuncParams.md +5 -5
- package/docs/api/interfaces/EventServerFuncParams.md +21 -7
- package/docs/api/interfaces/FewShotPromptTemplateOptions.md +18 -6
- package/docs/api/interfaces/FuncItem.md +19 -15
- package/docs/api/interfaces/FuncParam.md +5 -5
- package/docs/api/interfaces/FuncParams.md +1 -1
- package/docs/api/interfaces/Funcs.md +1 -1
- package/docs/api/interfaces/HashAlgoParams.md +36 -5
- package/docs/api/interfaces/IClientToolTransport.md +24 -10
- package/docs/api/interfaces/IFileMetaInfo.md +8 -8
- package/docs/api/interfaces/IPubSubClientTransport.md +4 -4
- package/docs/api/interfaces/IPubSubServerTransport.md +14 -14
- package/docs/api/interfaces/IReadTextFileChunksOptions.md +11 -11
- package/docs/api/interfaces/IServerToolTransport.md +8 -8
- package/docs/api/interfaces/IToolTransport.md +5 -5
- package/docs/api/interfaces/ITruncateToTokenLimitOptions.md +10 -10
- package/docs/api/interfaces/JsonFilter.md +1 -1
- package/docs/api/interfaces/MailboxClientOptions.md +74 -0
- package/docs/api/interfaces/MailboxServerOptions.md +69 -0
- package/docs/api/interfaces/ProbabilityItem.md +4 -4
- package/docs/api/interfaces/PromptExampleSelectorOptions.md +3 -3
- package/docs/api/interfaces/PromptTemplateOptions.md +8 -0
- package/docs/api/interfaces/PubSubClientStream.md +11 -11
- package/docs/api/interfaces/PubSubServerSession.md +8 -8
- package/docs/api/interfaces/RegisterOptions.md +298 -0
- package/docs/api/interfaces/RemoteFuncItem.md +63 -20
- package/docs/api/interfaces/ReplacePlacehoderOptions.md +5 -5
- package/docs/api/interfaces/ResClientFuncParams.md +3 -3
- package/docs/api/interfaces/ResServerFuncParams.md +20 -6
- package/docs/api/interfaces/RpcMethodsClientFuncParams.md +2 -2
- package/docs/api/interfaces/RpcMethodsServerFuncParams.md +18 -4
- package/docs/api/interfaces/SanitizeFilenameOptions.md +3 -3
- package/docs/api/interfaces/SectionStringOptions.md +3 -3
- package/docs/api/interfaces/SemaphoreOptions.md +30 -7
- package/docs/api/interfaces/SemaphoreTaskItem.md +18 -5
- package/docs/api/interfaces/ServerFuncItem.md +71 -20
- package/docs/api/interfaces/ServerFuncParams.md +14 -4
- package/docs/api/interfaces/SplitSentenceOptions.md +5 -5
- package/docs/api/interfaces/StreamCallbacksAndOptions.md +80 -7
- package/docs/api/interfaces/TaskAbortControllers.md +2 -2
- package/docs/api/interfaces/TaskPromise.md +6 -6
- package/docs/api/interfaces/TextifyInlineOptions.md +51 -0
- package/docs/api/interfaces/TextifyOptions.md +108 -0
- package/docs/api/interfaces/ToolFuncContext.md +73 -0
- package/docs/api/interfaces/ToolFuncPackage.md +4 -4
- package/docs/api/interfaces/ToolFuncRegistryIsolateOptions.md +41 -0
- package/docs/api/interfaces/UnregisterOptions.md +56 -0
- package/docs/api/type-aliases/AIChatContentPart.md +2 -2
- package/docs/api/type-aliases/AIChatMessageParam.md +1 -1
- package/docs/api/type-aliases/AIChatRole.md +2 -2
- package/docs/api/type-aliases/AIChatTemplateCaps.md +239 -0
- package/docs/api/type-aliases/AIChatToolChoiceParam.md +1 -1
- package/docs/api/type-aliases/AIMessageType.md +1 -1
- package/docs/api/type-aliases/AIModelNameRule.md +1 -1
- package/docs/api/type-aliases/AIModelNameRuleFn.md +1 -1
- package/docs/api/type-aliases/AIModelNameRules.md +1 -1
- package/docs/api/type-aliases/AITextGenerationFinishReason.md +1 -1
- package/docs/api/type-aliases/ActionName.md +1 -1
- package/docs/api/type-aliases/ArgProcessor.md +24 -0
- package/docs/api/type-aliases/ArrayMergeWay.md +1 -1
- package/docs/api/type-aliases/AsyncTaskId.md +1 -1
- package/docs/api/type-aliases/BeforeShutdownListener.md +1 -1
- package/docs/api/type-aliases/CmdArgFlagValue.md +14 -0
- package/docs/api/type-aliases/CmdArgFlagsRecord.md +13 -0
- package/docs/api/type-aliases/EventErrorListenerFn.md +1 -1
- package/docs/api/type-aliases/EventListenerFn.md +1 -1
- package/docs/api/type-aliases/FuncParamType.md +1 -1
- package/docs/api/type-aliases/PromptExamples.md +1 -1
- package/docs/api/type-aliases/PubSubClientId.md +1 -1
- package/docs/api/type-aliases/PubSubCtx.md +6 -6
- package/docs/api/type-aliases/RpcMethodHandler.md +1 -1
- package/docs/api/type-aliases/SSEClient.md +5 -5
- package/docs/api/type-aliases/SemaphoreIsReadyFuncType.md +4 -1
- package/docs/api/type-aliases/SimplifiedResultType.md +14 -0
- package/docs/api/type-aliases/StreamCloseStatus.md +16 -0
- package/docs/api/type-aliases/TFunc.md +1 -1
- package/docs/api/type-aliases/TextifyInlineStyleMode.md +16 -0
- package/docs/api/type-aliases/TextifyStringQuoting.md +16 -0
- package/docs/api/type-aliases/UUIDVersions.md +3 -1
- package/docs/api/variables/AIChatRoles.md +2 -2
- package/docs/api/variables/AIMessageTypes.md +1 -1
- package/docs/api/variables/AITextGenerationFinishReasons.md +1 -1
- package/docs/api/variables/ActionNames.md +1 -1
- package/docs/api/variables/ArrayMergeWay.md +1 -1
- package/docs/api/variables/ArrayMergeWaySymbol.md +1 -1
- package/docs/api/variables/CMD_ARG_FLAG_SYMBOL.md +21 -0
- package/docs/api/variables/CMD_ARG_PROCESSOR_RESULT.md +22 -0
- package/docs/api/variables/CMD_ARG_UNRESOLVED_SYMBOL.md +16 -0
- package/docs/api/variables/ClientEventPrefix.md +2 -2
- package/docs/api/variables/ClientToolFuncSchema.md +27 -17
- package/docs/api/variables/DEFAULT_CONFIG_NAME.md +1 -1
- package/docs/api/variables/DefaultAsyncSemaphoreCapacity.md +4 -1
- package/docs/api/variables/EventBusName.md +2 -2
- package/docs/api/variables/EventName.md +2 -2
- package/docs/api/variables/FilenameReservedRegex.md +1 -1
- package/docs/api/variables/FuncMetaSymbol.md +2 -2
- package/docs/api/variables/IDENTIFIER_REGEX.md +14 -0
- package/docs/api/variables/LLM_TOKENIZER_NAMES.md +1 -1
- package/docs/api/variables/LLM_TOKENIZER_NAMES_MAP.md +1 -1
- package/docs/api/variables/PASSING_SCORE.md +1 -1
- package/docs/api/variables/PATH_IDENTIFIER_REGEX.md +13 -0
- package/docs/api/variables/RESERVED_WORDS.md +13 -0
- package/docs/api/variables/RStreamErrCode.md +1 -1
- package/docs/api/variables/RemoteToolFuncSchema.md +36 -4
- package/docs/api/variables/ResponseRStreamErrCode.md +1 -1
- package/docs/api/variables/RpcMethodsClientToolSchema.md +2 -2
- package/docs/api/variables/RpcMethodsServerToolSchema.md +2 -2
- package/docs/api/variables/SHUTDOWN_SIGNALS.md +1 -1
- package/docs/api/variables/SSEChannelAlreadyClosedErrCode.md +1 -1
- package/docs/api/variables/SecondaryCache.md +1 -1
- package/docs/api/variables/ServerToolFuncSchema.md +27 -17
- package/docs/api/variables/StrangeHumanName.md +1 -1
- package/docs/api/variables/ToolAsyncCancelableBit.md +1 -1
- package/docs/api/variables/ToolAsyncMultiTaskBit.md +1 -1
- package/docs/api/variables/ToolAsyncPriorityBit.md +1 -1
- package/docs/api/variables/ToolFuncSchema.md +13 -13
- package/docs/api/variables/WindowsReservedNameRegex.md +1 -1
- package/docs/api/variables/backendEventable.md +23 -3
- package/docs/api/variables/base32768.md +2 -2
- package/docs/api/variables/event.md +1 -1
- package/docs/api/variables/eventClient.md +1 -1
- package/docs/api/variables/eventServer.md +1 -1
- package/docs/api/variables/lrucache.md +1 -1
- package/docs/api/variables/makeToolFuncCancelable.md +23 -3
- package/docs/api/variables/wait.md +1 -1
- package/docs/transport.dev.md +206 -0
- package/package.json +12 -10
- package/dist/chunk-4FKBOPZI.mjs +0 -1
- package/dist/chunk-TGTHY57V.mjs +0 -1
- package/dist/find-port-qS1CZ9c-.d.mts +0 -3
- package/dist/find-port-qS1CZ9c-.d.ts +0 -3
- package/dist/index-BLW3R7VS.d.mts +0 -1826
- package/dist/index-BLW3R7VS.d.ts +0 -1826
- package/docs/api/@isdk/namespaces/uuidv5/README.md +0 -12
- package/docs/api/@isdk/namespaces/uuidv5/variables/DNS.md +0 -11
- package/docs/api/@isdk/namespaces/uuidv5/variables/URL.md +0 -11
- package/docs/api/functions/nanoid.md +0 -45
- package/docs/api/functions/parseObjectArgInfo.md +0 -33
- package/docs/api/functions/parseObjectArgumentInfos.md +0 -29
- package/docs/api/functions/parseObjectArgumentsAsArgInfos.md +0 -46
- package/docs/api/functions/uuidParse.md +0 -21
- package/docs/api/functions/uuidStringify.md +0 -25
- package/docs/api/functions/uuidValidate.md +0 -21
- package/docs/api/functions/uuidVersion.md +0 -21
- package/docs/api/functions/uuidv1.md +0 -61
- package/docs/api/functions/uuidv4.md +0 -61
- package/docs/api/functions/uuidv5.md +0 -69
- package/docs/api/functions/uuidv6.md +0 -61
- package/docs/api/functions/uuidv7.md +0 -61
- package/docs/api/interfaces/AIChoiceConfig.md +0 -65
- package/docs/api/interfaces/BinarySemaphoreReleaserFunc.md +0 -37
- package/docs/api/interfaces/ParseObjectArgumentOptions.md +0 -89
- package/docs/api/variables/uuidNIL.md +0 -11
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: ServerTools
|
|
8
8
|
|
|
9
|
-
Defined in:
|
|
9
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:321
|
|
10
10
|
|
|
11
11
|
Represents a function that runs on a server and can be exposed to clients.
|
|
12
12
|
|
|
@@ -32,10 +32,13 @@ server-side execution contexts. It is designed to work with a transport layer
|
|
|
32
32
|
|
|
33
33
|
> **new ServerTools**(`name`, `options?`): `ServerTools`
|
|
34
34
|
|
|
35
|
-
Defined in:
|
|
35
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:751
|
|
36
36
|
|
|
37
37
|
Initializes a new `ToolFunc` instance.
|
|
38
38
|
|
|
39
|
+
If a named function is provided as the first argument (or in `options.func`),
|
|
40
|
+
and no name is explicitly provided, the instance will automatically inherit the function's name.
|
|
41
|
+
|
|
39
42
|
#### Parameters
|
|
40
43
|
|
|
41
44
|
##### name
|
|
@@ -46,7 +49,7 @@ Can be a function name, a function implementation, or a configuration object.
|
|
|
46
49
|
|
|
47
50
|
##### options?
|
|
48
51
|
|
|
49
|
-
`any`
|
|
52
|
+
`any`
|
|
50
53
|
|
|
51
54
|
Configuration options if not provided in the first argument.
|
|
52
55
|
|
|
@@ -60,6 +63,22 @@ Configuration options if not provided in the first argument.
|
|
|
60
63
|
|
|
61
64
|
## Properties
|
|
62
65
|
|
|
66
|
+
### \_registry?
|
|
67
|
+
|
|
68
|
+
> `optional` **\_registry**: *typeof* [`ToolFunc`](ToolFunc.md)
|
|
69
|
+
|
|
70
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:496
|
|
71
|
+
|
|
72
|
+
**`Internal`**
|
|
73
|
+
|
|
74
|
+
The registry class where this tool was originally registered.
|
|
75
|
+
|
|
76
|
+
#### Inherited from
|
|
77
|
+
|
|
78
|
+
[`ToolFunc`](ToolFunc.md).[`_registry`](ToolFunc.md#_registry)
|
|
79
|
+
|
|
80
|
+
***
|
|
81
|
+
|
|
63
82
|
### $attributes
|
|
64
83
|
|
|
65
84
|
> **$attributes**: `Properties`
|
|
@@ -76,7 +95,7 @@ Defined in: [property-manager.js/src/advance.d.ts:5](https://github.com/snowyu/p
|
|
|
76
95
|
|
|
77
96
|
> `optional` **action**: `"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
|
|
78
97
|
|
|
79
|
-
Defined in:
|
|
98
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:82
|
|
80
99
|
|
|
81
100
|
The action to be used for the remote call. This typically represents an RPC method name.
|
|
82
101
|
Only for RESTful HTTP transports, it might be mapped to a standard HTTP method (e.g., GET, POST)
|
|
@@ -91,7 +110,7 @@ Only for RESTful HTTP transports, it might be mapped to a standard HTTP method (
|
|
|
91
110
|
|
|
92
111
|
> `optional` **alias**: `string` \| `string`[]
|
|
93
112
|
|
|
94
|
-
Defined in:
|
|
113
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:258
|
|
95
114
|
|
|
96
115
|
Optional aliases for the function name.
|
|
97
116
|
|
|
@@ -105,7 +124,7 @@ Optional aliases for the function name.
|
|
|
105
124
|
|
|
106
125
|
> `optional` **allowExportFunc**: `boolean`
|
|
107
126
|
|
|
108
|
-
Defined in:
|
|
127
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:319
|
|
109
128
|
|
|
110
129
|
If set to true, the body of the function (`func`) will be serialized and sent
|
|
111
130
|
to the client when tools are loaded. This allows the client to execute the
|
|
@@ -121,7 +140,7 @@ function locally instead of making a remote call. Defaults to false.
|
|
|
121
140
|
|
|
122
141
|
> `optional` **apiRoot**: `string`
|
|
123
142
|
|
|
124
|
-
Defined in:
|
|
143
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:76
|
|
125
144
|
|
|
126
145
|
The root endpoint for the remote service.
|
|
127
146
|
|
|
@@ -139,7 +158,7 @@ Use `transport` instead.
|
|
|
139
158
|
|
|
140
159
|
> `optional` **asyncFeatures**: `number`
|
|
141
160
|
|
|
142
|
-
Defined in:
|
|
161
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:272
|
|
143
162
|
|
|
144
163
|
A bitmask representing asynchronous features supported by the function, built from `AsyncFeatureBits`.
|
|
145
164
|
This allows the system to understand if a function supports capabilities like cancellation or multi-tasking.
|
|
@@ -175,6 +194,21 @@ The initial value of Object.prototype.constructor is the standard built-in Objec
|
|
|
175
194
|
|
|
176
195
|
***
|
|
177
196
|
|
|
197
|
+
### ctx?
|
|
198
|
+
|
|
199
|
+
> `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
200
|
+
|
|
201
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:547
|
|
202
|
+
|
|
203
|
+
The execution context for the current function call.
|
|
204
|
+
Only available when isolated execution is enabled.
|
|
205
|
+
|
|
206
|
+
#### Inherited from
|
|
207
|
+
|
|
208
|
+
[`ToolFunc`](ToolFunc.md).[`ctx`](ToolFunc.md#ctx)
|
|
209
|
+
|
|
210
|
+
***
|
|
211
|
+
|
|
178
212
|
### defaultOptions
|
|
179
213
|
|
|
180
214
|
> **defaultOptions**: `object`
|
|
@@ -201,7 +235,7 @@ The default options for export and assign
|
|
|
201
235
|
|
|
202
236
|
> `optional` **depends**: `object`
|
|
203
237
|
|
|
204
|
-
Defined in:
|
|
238
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:295
|
|
205
239
|
|
|
206
240
|
A map of dependencies this function has on other tool functions.
|
|
207
241
|
Declaring dependencies ensures that they are automatically registered when this function is registered.
|
|
@@ -240,7 +274,7 @@ mainFunc.register();
|
|
|
240
274
|
|
|
241
275
|
> `optional` **description**: `string`
|
|
242
276
|
|
|
243
|
-
Defined in:
|
|
277
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:302
|
|
244
278
|
|
|
245
279
|
A detailed description of what the function does.
|
|
246
280
|
|
|
@@ -250,11 +284,25 @@ A detailed description of what the function does.
|
|
|
250
284
|
|
|
251
285
|
***
|
|
252
286
|
|
|
287
|
+
### expectedDuration?
|
|
288
|
+
|
|
289
|
+
> `optional` **expectedDuration**: `number`
|
|
290
|
+
|
|
291
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:102
|
|
292
|
+
|
|
293
|
+
The expected duration of the remote call in milliseconds.
|
|
294
|
+
|
|
295
|
+
#### Inherited from
|
|
296
|
+
|
|
297
|
+
[`ServerFuncItem`](../interfaces/ServerFuncItem.md).[`expectedDuration`](../interfaces/ServerFuncItem.md#expectedduration)
|
|
298
|
+
|
|
299
|
+
***
|
|
300
|
+
|
|
253
301
|
### fetchOptions?
|
|
254
302
|
|
|
255
303
|
> `optional` **fetchOptions**: `any`
|
|
256
304
|
|
|
257
|
-
Defined in:
|
|
305
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:87
|
|
258
306
|
|
|
259
307
|
Addtional options to be passed to the underlying `fetch` call in a transport.
|
|
260
308
|
|
|
@@ -268,7 +316,7 @@ Addtional options to be passed to the underlying `fetch` call in a transport.
|
|
|
268
316
|
|
|
269
317
|
> `optional` **isApi**: `boolean`
|
|
270
318
|
|
|
271
|
-
Defined in:
|
|
319
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:247
|
|
272
320
|
|
|
273
321
|
If true, indicates that this function should be treated as a server-side API.
|
|
274
322
|
|
|
@@ -282,7 +330,7 @@ If true, indicates that this function should be treated as a server-side API.
|
|
|
282
330
|
|
|
283
331
|
> `optional` **name**: `string`
|
|
284
332
|
|
|
285
|
-
Defined in:
|
|
333
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:204
|
|
286
334
|
|
|
287
335
|
The unique name of the function.
|
|
288
336
|
|
|
@@ -310,7 +358,7 @@ the property with the default prefix '$' will not be exported.
|
|
|
310
358
|
|
|
311
359
|
> `optional` **params**: [`FuncParams`](../interfaces/FuncParams.md) \| [`FuncParam`](../interfaces/FuncParam.md)[]
|
|
312
360
|
|
|
313
|
-
Defined in:
|
|
361
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:209
|
|
314
362
|
|
|
315
363
|
Parameter definitions, which can be an object mapping names to definitions or an array for positional parameters.
|
|
316
364
|
|
|
@@ -324,7 +372,7 @@ Parameter definitions, which can be an object mapping names to definitions or an
|
|
|
324
372
|
|
|
325
373
|
> `optional` **result**: `string` \| `Record`\<`string`, `any`\>
|
|
326
374
|
|
|
327
|
-
Defined in:
|
|
375
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:214
|
|
328
376
|
|
|
329
377
|
The expected return type of the function, described as a string or a JSON schema object.
|
|
330
378
|
|
|
@@ -338,7 +386,7 @@ The expected return type of the function, described as a string or a JSON schema
|
|
|
338
386
|
|
|
339
387
|
> `optional` **scope**: `any`
|
|
340
388
|
|
|
341
|
-
Defined in:
|
|
389
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:219
|
|
342
390
|
|
|
343
391
|
The execution scope or context (`this`) for the function.
|
|
344
392
|
|
|
@@ -352,7 +400,7 @@ The execution scope or context (`this`) for the function.
|
|
|
352
400
|
|
|
353
401
|
> `optional` **setup**: (`this`, `options?`) => `void`
|
|
354
402
|
|
|
355
|
-
Defined in:
|
|
403
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:242
|
|
356
404
|
|
|
357
405
|
A lifecycle hook called once during the `ToolFunc` instance's initialization.
|
|
358
406
|
It allows for initial setup, state configuration, or property modification on the instance
|
|
@@ -398,7 +446,7 @@ console.log(myFunc.customState); // Outputs: 'configured'
|
|
|
398
446
|
|
|
399
447
|
> `optional` **stream**: `boolean`
|
|
400
448
|
|
|
401
|
-
Defined in:
|
|
449
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:253
|
|
402
450
|
|
|
403
451
|
If true, indicates that the function has the *capability* to stream its output.
|
|
404
452
|
Whether a specific call is streamed is determined by a `stream` property in the runtime parameters.
|
|
@@ -413,7 +461,7 @@ Whether a specific call is streamed is determined by a `stream` property in the
|
|
|
413
461
|
|
|
414
462
|
> `optional` **tags**: `string` \| `string`[]
|
|
415
463
|
|
|
416
|
-
Defined in:
|
|
464
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:224
|
|
417
465
|
|
|
418
466
|
Tags for grouping or filtering functions.
|
|
419
467
|
|
|
@@ -423,11 +471,49 @@ Tags for grouping or filtering functions.
|
|
|
423
471
|
|
|
424
472
|
***
|
|
425
473
|
|
|
474
|
+
### timeout?
|
|
475
|
+
|
|
476
|
+
> `optional` **timeout**: `number` \| \{ `keepAliveOnTimeout?`: `boolean`; `streamIdleTimeout?`: `number`; `value`: `number`; \}
|
|
477
|
+
|
|
478
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:91
|
|
479
|
+
|
|
480
|
+
The timeout configuration for the remote call.
|
|
481
|
+
|
|
482
|
+
#### Type Declaration
|
|
483
|
+
|
|
484
|
+
`number`
|
|
485
|
+
|
|
486
|
+
\{ `keepAliveOnTimeout?`: `boolean`; `streamIdleTimeout?`: `number`; `value`: `number`; \}
|
|
487
|
+
|
|
488
|
+
#### keepAliveOnTimeout?
|
|
489
|
+
|
|
490
|
+
> `optional` **keepAliveOnTimeout**: `boolean`
|
|
491
|
+
|
|
492
|
+
Whether to keep the server-side function running after a timeout.
|
|
493
|
+
|
|
494
|
+
#### streamIdleTimeout?
|
|
495
|
+
|
|
496
|
+
> `optional` **streamIdleTimeout**: `number`
|
|
497
|
+
|
|
498
|
+
The idle timeout for streaming responses in milliseconds.
|
|
499
|
+
|
|
500
|
+
#### value
|
|
501
|
+
|
|
502
|
+
> **value**: `number`
|
|
503
|
+
|
|
504
|
+
The hard timeout in milliseconds.
|
|
505
|
+
|
|
506
|
+
#### Inherited from
|
|
507
|
+
|
|
508
|
+
[`ServerFuncItem`](../interfaces/ServerFuncItem.md).[`timeout`](../interfaces/ServerFuncItem.md#timeout)
|
|
509
|
+
|
|
510
|
+
***
|
|
511
|
+
|
|
426
512
|
### title?
|
|
427
513
|
|
|
428
514
|
> `optional` **title**: `string`
|
|
429
515
|
|
|
430
|
-
Defined in:
|
|
516
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:307
|
|
431
517
|
|
|
432
518
|
A concise, human-readable title for the function, often used in UI or by AI.
|
|
433
519
|
|
|
@@ -437,13 +523,32 @@ A concise, human-readable title for the function, often used in UI or by AI.
|
|
|
437
523
|
|
|
438
524
|
***
|
|
439
525
|
|
|
526
|
+
### \_refCounts
|
|
527
|
+
|
|
528
|
+
> `protected` `static` **\_refCounts**: `object`
|
|
529
|
+
|
|
530
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:489
|
|
531
|
+
|
|
532
|
+
Tracks the number of active registration holds on each function name.
|
|
533
|
+
A function is truly removed only when its reference count drops to zero.
|
|
534
|
+
|
|
535
|
+
#### Index Signature
|
|
536
|
+
|
|
537
|
+
\[`name`: `string`\]: `number`
|
|
538
|
+
|
|
539
|
+
#### Inherited from
|
|
540
|
+
|
|
541
|
+
[`ToolFunc`](ToolFunc.md).[`_refCounts`](ToolFunc.md#_refcounts)
|
|
542
|
+
|
|
543
|
+
***
|
|
544
|
+
|
|
440
545
|
### aliases
|
|
441
546
|
|
|
442
|
-
> `static` **aliases**: `object`
|
|
547
|
+
> `static` **aliases**: `object`
|
|
443
548
|
|
|
444
|
-
Defined in:
|
|
549
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:480
|
|
445
550
|
|
|
446
|
-
A static map of aliases to their corresponding function names.
|
|
551
|
+
A static map of aliases to their corresponding primary function names.
|
|
447
552
|
|
|
448
553
|
#### Index Signature
|
|
449
554
|
|
|
@@ -455,11 +560,25 @@ A static map of aliases to their corresponding function names.
|
|
|
455
560
|
|
|
456
561
|
***
|
|
457
562
|
|
|
563
|
+
### ctx?
|
|
564
|
+
|
|
565
|
+
> `static` `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
566
|
+
|
|
567
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:508
|
|
568
|
+
|
|
569
|
+
The static execution context for proxy classes created via ToolFunc.with().
|
|
570
|
+
|
|
571
|
+
#### Inherited from
|
|
572
|
+
|
|
573
|
+
[`ToolFunc`](ToolFunc.md).[`ctx`](ToolFunc.md#ctx-1)
|
|
574
|
+
|
|
575
|
+
***
|
|
576
|
+
|
|
458
577
|
### dataPath
|
|
459
578
|
|
|
460
579
|
> `static` **dataPath**: `string`
|
|
461
580
|
|
|
462
|
-
Defined in:
|
|
581
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:503
|
|
463
582
|
|
|
464
583
|
A conventional property to designate a file path for saving the registered `ToolFunc` data.
|
|
465
584
|
Note: The `ToolFunc` class itself does not implement persistence logic. It is up to the
|
|
@@ -473,11 +592,11 @@ developer to use this path to save and load the `ToolFunc.items` registry if nee
|
|
|
473
592
|
|
|
474
593
|
### items
|
|
475
594
|
|
|
476
|
-
> `static` **items**: [`Funcs`](../interfaces/Funcs.md)
|
|
595
|
+
> `static` **items**: [`Funcs`](../interfaces/Funcs.md)
|
|
477
596
|
|
|
478
|
-
Defined in:
|
|
597
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:475
|
|
479
598
|
|
|
480
|
-
A static registry of all `ToolFunc`
|
|
599
|
+
A static registry of all `ToolFunc` implementations, indexed by their primary name.
|
|
481
600
|
|
|
482
601
|
#### Inherited from
|
|
483
602
|
|
|
@@ -489,15 +608,15 @@ A static registry of all `ToolFunc` instances, indexed by name.
|
|
|
489
608
|
|
|
490
609
|
#### Get Signature
|
|
491
610
|
|
|
492
|
-
> **get** `static` **apiRoot**(): `
|
|
611
|
+
> **get** `static` **apiRoot**(): `string` \| `undefined`
|
|
493
612
|
|
|
494
|
-
Defined in:
|
|
613
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:336
|
|
495
614
|
|
|
496
615
|
The conventional root path for the API endpoint.
|
|
497
616
|
|
|
498
617
|
##### Returns
|
|
499
618
|
|
|
500
|
-
`
|
|
619
|
+
`string` \| `undefined`
|
|
501
620
|
|
|
502
621
|
#### Inherited from
|
|
503
622
|
|
|
@@ -505,11 +624,78 @@ The conventional root path for the API endpoint.
|
|
|
505
624
|
|
|
506
625
|
## Methods
|
|
507
626
|
|
|
627
|
+
### \_prepareContext()
|
|
628
|
+
|
|
629
|
+
> `protected` **\_prepareContext**(`params?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
630
|
+
|
|
631
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:806
|
|
632
|
+
|
|
633
|
+
Creates the final execution context (`this.ctx`) for a Shadow Instance.
|
|
634
|
+
|
|
635
|
+
NOTE: We MUST use 'this._prepareContext' (instance path) instead of
|
|
636
|
+
'Static._prepareContext' to allow AOP plugins (like CancelableAbility)
|
|
637
|
+
to hook into context preparation via method overloading ($_prepareContext).
|
|
638
|
+
|
|
639
|
+
#### Parameters
|
|
640
|
+
|
|
641
|
+
##### params?
|
|
642
|
+
|
|
643
|
+
`any`
|
|
644
|
+
|
|
645
|
+
##### ctx?
|
|
646
|
+
|
|
647
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
648
|
+
|
|
649
|
+
#### Returns
|
|
650
|
+
|
|
651
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
652
|
+
|
|
653
|
+
#### Inherited from
|
|
654
|
+
|
|
655
|
+
[`ToolFunc`](ToolFunc.md).[`_prepareContext`](ToolFunc.md#_preparecontext)
|
|
656
|
+
|
|
657
|
+
***
|
|
658
|
+
|
|
659
|
+
### \_shouldIsolate()
|
|
660
|
+
|
|
661
|
+
> `protected` **\_shouldIsolate**(`params?`, `ctx?`): `boolean`
|
|
662
|
+
|
|
663
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:798
|
|
664
|
+
|
|
665
|
+
Determines if the function execution should be isolated into a "Shadow Instance".
|
|
666
|
+
|
|
667
|
+
PRIORITY LOGIC:
|
|
668
|
+
1. Explicit 'ctx.isolated' in the current call (Highest).
|
|
669
|
+
2. Any explicit 'ctx' provided (Safe default: isolate to apply new overrides).
|
|
670
|
+
3. Prevention of recursion (If already an own 'ctx' property exists).
|
|
671
|
+
4. Inherited 'this.ctx.isolated' configuration.
|
|
672
|
+
5. Presence of any inherited context (Default: isolate for concurrency safety).
|
|
673
|
+
|
|
674
|
+
#### Parameters
|
|
675
|
+
|
|
676
|
+
##### params?
|
|
677
|
+
|
|
678
|
+
`any`
|
|
679
|
+
|
|
680
|
+
##### ctx?
|
|
681
|
+
|
|
682
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
683
|
+
|
|
684
|
+
#### Returns
|
|
685
|
+
|
|
686
|
+
`boolean`
|
|
687
|
+
|
|
688
|
+
#### Inherited from
|
|
689
|
+
|
|
690
|
+
[`ToolFunc`](ToolFunc.md).[`_shouldIsolate`](ToolFunc.md#_shouldisolate)
|
|
691
|
+
|
|
692
|
+
***
|
|
693
|
+
|
|
508
694
|
### arr2ObjParams()
|
|
509
695
|
|
|
510
696
|
> **arr2ObjParams**(`params`): `any`[]
|
|
511
697
|
|
|
512
|
-
Defined in:
|
|
698
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:770
|
|
513
699
|
|
|
514
700
|
Converts an array of positional arguments into a named parameters object.
|
|
515
701
|
This is used internally to support functions defined with named parameters.
|
|
@@ -820,7 +1006,7 @@ the dest object.
|
|
|
820
1006
|
|
|
821
1007
|
> **func**(`params`): `any`
|
|
822
1008
|
|
|
823
|
-
Defined in:
|
|
1009
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:367
|
|
824
1010
|
|
|
825
1011
|
Placeholder for the actual server-side function implementation.
|
|
826
1012
|
This method is intended to be defined when a `ServerTools` instance is created.
|
|
@@ -849,7 +1035,7 @@ The result of the function.
|
|
|
849
1035
|
|
|
850
1036
|
> **getFunc**(`name?`): `any`
|
|
851
1037
|
|
|
852
|
-
Defined in:
|
|
1038
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:866
|
|
853
1039
|
|
|
854
1040
|
Gets a bound function reference for execution with named parameters.
|
|
855
1041
|
If a name is provided, it retrieves a different function from the registry.
|
|
@@ -879,7 +1065,7 @@ A function reference or `undefined` if not found.
|
|
|
879
1065
|
|
|
880
1066
|
> **getFuncWithPos**(`name?`): `any`
|
|
881
1067
|
|
|
882
|
-
Defined in:
|
|
1068
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:910
|
|
883
1069
|
|
|
884
1070
|
Gets a bound function reference suitable for positional argument execution.
|
|
885
1071
|
If a name is provided, it retrieves a different function from the registry.
|
|
@@ -929,7 +1115,7 @@ the descriptors of properties object
|
|
|
929
1115
|
|
|
930
1116
|
> **hasAsyncFeature**(`feature`): `boolean`
|
|
931
1117
|
|
|
932
|
-
Defined in:
|
|
1118
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:916
|
|
933
1119
|
|
|
934
1120
|
Checks if the current function instance supports a specific async feature.
|
|
935
1121
|
|
|
@@ -1063,9 +1249,9 @@ The source object
|
|
|
1063
1249
|
|
|
1064
1250
|
### isStream()
|
|
1065
1251
|
|
|
1066
|
-
> **isStream**(`params`): `
|
|
1252
|
+
> **isStream**(`params`): `boolean` \| `undefined`
|
|
1067
1253
|
|
|
1068
|
-
Defined in:
|
|
1254
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:929
|
|
1069
1255
|
|
|
1070
1256
|
Determines if a function call should produce a stream.
|
|
1071
1257
|
|
|
@@ -1085,7 +1271,7 @@ The runtime parameters passed to the function call.
|
|
|
1085
1271
|
|
|
1086
1272
|
#### Returns
|
|
1087
1273
|
|
|
1088
|
-
`
|
|
1274
|
+
`boolean` \| `undefined`
|
|
1089
1275
|
|
|
1090
1276
|
`true` if the call should be streamed, `false` or `undefined` otherwise.
|
|
1091
1277
|
|
|
@@ -1131,7 +1317,7 @@ the dest object.
|
|
|
1131
1317
|
|
|
1132
1318
|
> **obj2ArrParams**(`params?`): `any`[]
|
|
1133
1319
|
|
|
1134
|
-
Defined in:
|
|
1320
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:777
|
|
1135
1321
|
|
|
1136
1322
|
Converts a named parameters object into an array of positional arguments.
|
|
1137
1323
|
This is used for functions defined with positional parameters.
|
|
@@ -1186,7 +1372,7 @@ A property name.
|
|
|
1186
1372
|
|
|
1187
1373
|
> **register**(): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
1188
1374
|
|
|
1189
|
-
Defined in:
|
|
1375
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:757
|
|
1190
1376
|
|
|
1191
1377
|
Registers the current `ToolFunc` instance into the static registry.
|
|
1192
1378
|
Also registers any declared dependencies.
|
|
@@ -1205,13 +1391,13 @@ The instance itself upon successful registration, or `false` if it already exist
|
|
|
1205
1391
|
|
|
1206
1392
|
### run()
|
|
1207
1393
|
|
|
1208
|
-
> **run**(`params`, `
|
|
1394
|
+
> **run**(`params`, `options?`): `any`
|
|
1209
1395
|
|
|
1210
|
-
Defined in:
|
|
1396
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:360
|
|
1211
1397
|
|
|
1212
1398
|
Overrides the base `run` method to inject transport-specific context.
|
|
1213
|
-
If a `context` object containing `req` and `
|
|
1214
|
-
added to the parameters as `_req` and `
|
|
1399
|
+
If a `context` object containing `req`, `reply`, and `signal` is provided,
|
|
1400
|
+
these are added to the parameters as `_req`, `_res`, and `_signal` before execution.
|
|
1215
1401
|
|
|
1216
1402
|
#### Parameters
|
|
1217
1403
|
|
|
@@ -1221,21 +1407,15 @@ added to the parameters as `_req` and `_res` before execution.
|
|
|
1221
1407
|
|
|
1222
1408
|
The parameters for the function.
|
|
1223
1409
|
|
|
1224
|
-
#####
|
|
1225
|
-
|
|
1226
|
-
The transport-level context.
|
|
1227
|
-
|
|
1228
|
-
###### reply
|
|
1410
|
+
##### options?
|
|
1229
1411
|
|
|
1230
1412
|
`any`
|
|
1231
1413
|
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
`any`
|
|
1414
|
+
The transport-level context or options.
|
|
1235
1415
|
|
|
1236
1416
|
#### Returns
|
|
1237
1417
|
|
|
1238
|
-
`
|
|
1418
|
+
`any`
|
|
1239
1419
|
|
|
1240
1420
|
The result of the function execution.
|
|
1241
1421
|
|
|
@@ -1247,12 +1427,14 @@ The result of the function execution.
|
|
|
1247
1427
|
|
|
1248
1428
|
### runAs()
|
|
1249
1429
|
|
|
1250
|
-
> **runAs**(`name`, `params?`): `
|
|
1430
|
+
> **runAs**(`name`, `params?`, `ctx?`): `any`
|
|
1251
1431
|
|
|
1252
|
-
Defined in:
|
|
1432
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:837
|
|
1253
1433
|
|
|
1254
1434
|
Asynchronously executes another registered function by name.
|
|
1255
|
-
|
|
1435
|
+
|
|
1436
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
1437
|
+
otherwise it may return the result synchronously.
|
|
1256
1438
|
|
|
1257
1439
|
#### Parameters
|
|
1258
1440
|
|
|
@@ -1268,11 +1450,17 @@ The name of the target function to run.
|
|
|
1268
1450
|
|
|
1269
1451
|
Optional parameters to pass to the function.
|
|
1270
1452
|
|
|
1453
|
+
##### ctx?
|
|
1454
|
+
|
|
1455
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1456
|
+
|
|
1457
|
+
The execution context.
|
|
1458
|
+
|
|
1271
1459
|
#### Returns
|
|
1272
1460
|
|
|
1273
|
-
`
|
|
1461
|
+
`any`
|
|
1274
1462
|
|
|
1275
|
-
A promise
|
|
1463
|
+
A promise or the direct result of the function's execution.
|
|
1276
1464
|
|
|
1277
1465
|
#### Inherited from
|
|
1278
1466
|
|
|
@@ -1282,12 +1470,22 @@ A promise that resolves with the result of the function execution.
|
|
|
1282
1470
|
|
|
1283
1471
|
### runAsSync()
|
|
1284
1472
|
|
|
1285
|
-
> **runAsSync**(`name`, `params?`): `any`
|
|
1473
|
+
> **runAsSync**(`name`, `params?`, `ctx?`): `any`
|
|
1286
1474
|
|
|
1287
|
-
Defined in:
|
|
1475
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:858
|
|
1288
1476
|
|
|
1289
|
-
|
|
1290
|
-
|
|
1477
|
+
Executes another registered function by name, using hierarchical dependency resolution.
|
|
1478
|
+
|
|
1479
|
+
This method supports **Late-Binding Polymorphism**. It uses the `rootRegistry` and
|
|
1480
|
+
`binding` strategy from the execution context to resolve dependencies.
|
|
1481
|
+
|
|
1482
|
+
### Binding Modes:
|
|
1483
|
+
- `'auto'` (Default): **Lineage-Aware**. Uses late-binding only if the `rootRegistry`
|
|
1484
|
+
is a descendant of the tool's definition registry and has shadowed the dependency.
|
|
1485
|
+
Otherwise, uses early-binding for stability.
|
|
1486
|
+
- `'early'`: **Safety First**. Always prefers the pre-bound instance from `depends`.
|
|
1487
|
+
- `'late'`: **Forced Polymorphism**. Always resolves from the `rootRegistry`,
|
|
1488
|
+
ignoring the definer's environment.
|
|
1291
1489
|
|
|
1292
1490
|
#### Parameters
|
|
1293
1491
|
|
|
@@ -1295,19 +1493,29 @@ This is a convenience method that forwards the call to the static `runSync()` me
|
|
|
1295
1493
|
|
|
1296
1494
|
`string`
|
|
1297
1495
|
|
|
1298
|
-
The name of the target function to run.
|
|
1496
|
+
The name or alias of the target function to run.
|
|
1299
1497
|
|
|
1300
1498
|
##### params?
|
|
1301
1499
|
|
|
1302
1500
|
`any`
|
|
1303
1501
|
|
|
1304
|
-
Optional parameters to pass to the function.
|
|
1502
|
+
Optional parameters to pass to the target function.
|
|
1503
|
+
|
|
1504
|
+
##### ctx?
|
|
1505
|
+
|
|
1506
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1507
|
+
|
|
1508
|
+
The execution context.
|
|
1305
1509
|
|
|
1306
1510
|
#### Returns
|
|
1307
1511
|
|
|
1308
1512
|
`any`
|
|
1309
1513
|
|
|
1310
|
-
The result of the function execution.
|
|
1514
|
+
The result of the target function execution.
|
|
1515
|
+
|
|
1516
|
+
#### Throws
|
|
1517
|
+
|
|
1518
|
+
If the target function cannot be found in the current lineage.
|
|
1311
1519
|
|
|
1312
1520
|
#### Inherited from
|
|
1313
1521
|
|
|
@@ -1317,9 +1525,9 @@ The result of the function execution.
|
|
|
1317
1525
|
|
|
1318
1526
|
### runSync()
|
|
1319
1527
|
|
|
1320
|
-
> **runSync**(`params?`): `any`
|
|
1528
|
+
> **runSync**(`params?`, `ctx?`): `any`
|
|
1321
1529
|
|
|
1322
|
-
Defined in:
|
|
1530
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:814
|
|
1323
1531
|
|
|
1324
1532
|
Executes the function synchronously with a named parameters object.
|
|
1325
1533
|
|
|
@@ -1331,6 +1539,12 @@ Executes the function synchronously with a named parameters object.
|
|
|
1331
1539
|
|
|
1332
1540
|
The parameters object for the function.
|
|
1333
1541
|
|
|
1542
|
+
##### ctx?
|
|
1543
|
+
|
|
1544
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1545
|
+
|
|
1546
|
+
The execution context.
|
|
1547
|
+
|
|
1334
1548
|
#### Returns
|
|
1335
1549
|
|
|
1336
1550
|
`any`
|
|
@@ -1349,12 +1563,14 @@ Will throw an error if an array of parameters is passed to a function that expec
|
|
|
1349
1563
|
|
|
1350
1564
|
### runWithPos()
|
|
1351
1565
|
|
|
1352
|
-
> **runWithPos**(...`params`): `
|
|
1566
|
+
> **runWithPos**(...`params`): `any`
|
|
1353
1567
|
|
|
1354
|
-
Defined in:
|
|
1568
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:891
|
|
1355
1569
|
|
|
1356
1570
|
Executes the function asynchronously using positional arguments.
|
|
1357
|
-
|
|
1571
|
+
|
|
1572
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
1573
|
+
otherwise it may return the result synchronously.
|
|
1358
1574
|
|
|
1359
1575
|
#### Parameters
|
|
1360
1576
|
|
|
@@ -1366,9 +1582,9 @@ Positional arguments passed to the function.
|
|
|
1366
1582
|
|
|
1367
1583
|
#### Returns
|
|
1368
1584
|
|
|
1369
|
-
`
|
|
1585
|
+
`any`
|
|
1370
1586
|
|
|
1371
|
-
A promise
|
|
1587
|
+
A promise or the direct result of the function's execution.
|
|
1372
1588
|
|
|
1373
1589
|
#### Inherited from
|
|
1374
1590
|
|
|
@@ -1378,12 +1594,14 @@ A promise that resolves with the result of the function execution.
|
|
|
1378
1594
|
|
|
1379
1595
|
### runWithPosAs()
|
|
1380
1596
|
|
|
1381
|
-
> **runWithPosAs**(`name`, ...`params`): `
|
|
1597
|
+
> **runWithPosAs**(`name`, ...`params`): `any`
|
|
1382
1598
|
|
|
1383
|
-
Defined in:
|
|
1599
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:902
|
|
1384
1600
|
|
|
1385
1601
|
Asynchronously executes another function by name using positional arguments.
|
|
1386
|
-
|
|
1602
|
+
|
|
1603
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
1604
|
+
otherwise it may return the result synchronously.
|
|
1387
1605
|
|
|
1388
1606
|
#### Parameters
|
|
1389
1607
|
|
|
@@ -1401,9 +1619,9 @@ Positional arguments to pass to the function.
|
|
|
1401
1619
|
|
|
1402
1620
|
#### Returns
|
|
1403
1621
|
|
|
1404
|
-
`
|
|
1622
|
+
`any`
|
|
1405
1623
|
|
|
1406
|
-
A promise
|
|
1624
|
+
A promise or the direct result of the function's execution.
|
|
1407
1625
|
|
|
1408
1626
|
#### Inherited from
|
|
1409
1627
|
|
|
@@ -1415,7 +1633,7 @@ A promise that resolves with the result of the function execution.
|
|
|
1415
1633
|
|
|
1416
1634
|
> **runWithPosAsSync**(`name`, ...`params`): `any`
|
|
1417
1635
|
|
|
1418
|
-
Defined in:
|
|
1636
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:881
|
|
1419
1637
|
|
|
1420
1638
|
Synchronously executes another function by name using positional arguments.
|
|
1421
1639
|
This is a convenience wrapper around the static `runWithPosSync()` method.
|
|
@@ -1450,7 +1668,7 @@ The result of the function execution.
|
|
|
1450
1668
|
|
|
1451
1669
|
> **runWithPosSync**(...`params`): `any`
|
|
1452
1670
|
|
|
1453
|
-
Defined in:
|
|
1671
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:873
|
|
1454
1672
|
|
|
1455
1673
|
Executes the function synchronously using positional arguments.
|
|
1456
1674
|
If the function expects named parameters, it converts the arguments automatically.
|
|
@@ -1555,12 +1773,20 @@ Returns a string representation of an object.
|
|
|
1555
1773
|
|
|
1556
1774
|
### unregister()
|
|
1557
1775
|
|
|
1558
|
-
> **unregister**(): `any`
|
|
1776
|
+
> **unregister**(`options?`): `any`
|
|
1559
1777
|
|
|
1560
|
-
Defined in:
|
|
1778
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:763
|
|
1561
1779
|
|
|
1562
1780
|
Removes the current `ToolFunc` instance from the static registry.
|
|
1563
1781
|
|
|
1782
|
+
#### Parameters
|
|
1783
|
+
|
|
1784
|
+
##### options?
|
|
1785
|
+
|
|
1786
|
+
Unregistration options or a boolean force flag.
|
|
1787
|
+
|
|
1788
|
+
`boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
|
|
1789
|
+
|
|
1564
1790
|
#### Returns
|
|
1565
1791
|
|
|
1566
1792
|
`any`
|
|
@@ -1591,6 +1817,282 @@ Returns the primitive value of the specified object.
|
|
|
1591
1817
|
|
|
1592
1818
|
***
|
|
1593
1819
|
|
|
1820
|
+
### with()
|
|
1821
|
+
|
|
1822
|
+
> **with**(`ctx`): `this`
|
|
1823
|
+
|
|
1824
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:542
|
|
1825
|
+
|
|
1826
|
+
Returns an isolated instance with the provided context.
|
|
1827
|
+
|
|
1828
|
+
#### Parameters
|
|
1829
|
+
|
|
1830
|
+
##### ctx
|
|
1831
|
+
|
|
1832
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1833
|
+
|
|
1834
|
+
The context to use.
|
|
1835
|
+
|
|
1836
|
+
#### Returns
|
|
1837
|
+
|
|
1838
|
+
`this`
|
|
1839
|
+
|
|
1840
|
+
An isolated ToolFunc instance.
|
|
1841
|
+
|
|
1842
|
+
#### Inherited from
|
|
1843
|
+
|
|
1844
|
+
[`ToolFunc`](ToolFunc.md).[`with`](ToolFunc.md#with)
|
|
1845
|
+
|
|
1846
|
+
***
|
|
1847
|
+
|
|
1848
|
+
### \_acquireDependencies()
|
|
1849
|
+
|
|
1850
|
+
> `protected` `static` **\_acquireDependencies**(`inst`, `stack?`): `void`
|
|
1851
|
+
|
|
1852
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:740
|
|
1853
|
+
|
|
1854
|
+
#### Parameters
|
|
1855
|
+
|
|
1856
|
+
##### inst
|
|
1857
|
+
|
|
1858
|
+
[`ToolFunc`](ToolFunc.md)
|
|
1859
|
+
|
|
1860
|
+
##### stack?
|
|
1861
|
+
|
|
1862
|
+
`Set`\<`string`\>
|
|
1863
|
+
|
|
1864
|
+
#### Returns
|
|
1865
|
+
|
|
1866
|
+
`void`
|
|
1867
|
+
|
|
1868
|
+
#### Inherited from
|
|
1869
|
+
|
|
1870
|
+
[`ToolFunc`](ToolFunc.md).[`_acquireDependencies`](ToolFunc.md#_acquiredependencies)
|
|
1871
|
+
|
|
1872
|
+
***
|
|
1873
|
+
|
|
1874
|
+
### \_decRefCount()
|
|
1875
|
+
|
|
1876
|
+
> `protected` `static` **\_decRefCount**(`name`): `number`
|
|
1877
|
+
|
|
1878
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:739
|
|
1879
|
+
|
|
1880
|
+
#### Parameters
|
|
1881
|
+
|
|
1882
|
+
##### name
|
|
1883
|
+
|
|
1884
|
+
`string`
|
|
1885
|
+
|
|
1886
|
+
#### Returns
|
|
1887
|
+
|
|
1888
|
+
`number`
|
|
1889
|
+
|
|
1890
|
+
#### Inherited from
|
|
1891
|
+
|
|
1892
|
+
[`ToolFunc`](ToolFunc.md).[`_decRefCount`](ToolFunc.md#_decrefcount)
|
|
1893
|
+
|
|
1894
|
+
***
|
|
1895
|
+
|
|
1896
|
+
### \_getRegistrationAction()
|
|
1897
|
+
|
|
1898
|
+
> `protected` `static` **\_getRegistrationAction**(`name`, `override`): `"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
|
|
1899
|
+
|
|
1900
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:670
|
|
1901
|
+
|
|
1902
|
+
Analyzes the registration context and determines the appropriate action.
|
|
1903
|
+
|
|
1904
|
+
#### Parameters
|
|
1905
|
+
|
|
1906
|
+
##### name
|
|
1907
|
+
|
|
1908
|
+
`string`
|
|
1909
|
+
|
|
1910
|
+
The function name to register.
|
|
1911
|
+
|
|
1912
|
+
##### override
|
|
1913
|
+
|
|
1914
|
+
Override options.
|
|
1915
|
+
|
|
1916
|
+
###### name?
|
|
1917
|
+
|
|
1918
|
+
`boolean`
|
|
1919
|
+
|
|
1920
|
+
#### Returns
|
|
1921
|
+
|
|
1922
|
+
`"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
|
|
1923
|
+
|
|
1924
|
+
The determined registration action.
|
|
1925
|
+
|
|
1926
|
+
#### Inherited from
|
|
1927
|
+
|
|
1928
|
+
[`ToolFunc`](ToolFunc.md).[`_getRegistrationAction`](ToolFunc.md#_getregistrationaction)
|
|
1929
|
+
|
|
1930
|
+
***
|
|
1931
|
+
|
|
1932
|
+
### \_incRefCount()
|
|
1933
|
+
|
|
1934
|
+
> `protected` `static` **\_incRefCount**(`name`): `void`
|
|
1935
|
+
|
|
1936
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:738
|
|
1937
|
+
|
|
1938
|
+
#### Parameters
|
|
1939
|
+
|
|
1940
|
+
##### name
|
|
1941
|
+
|
|
1942
|
+
`string`
|
|
1943
|
+
|
|
1944
|
+
#### Returns
|
|
1945
|
+
|
|
1946
|
+
`void`
|
|
1947
|
+
|
|
1948
|
+
#### Inherited from
|
|
1949
|
+
|
|
1950
|
+
[`ToolFunc`](ToolFunc.md).[`_incRefCount`](ToolFunc.md#_increfcount)
|
|
1951
|
+
|
|
1952
|
+
***
|
|
1953
|
+
|
|
1954
|
+
### \_normalizeArguments()
|
|
1955
|
+
|
|
1956
|
+
> `protected` `static` **\_normalizeArguments**(`name`, `options?`): `any`
|
|
1957
|
+
|
|
1958
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:643
|
|
1959
|
+
|
|
1960
|
+
**`Internal`**
|
|
1961
|
+
|
|
1962
|
+
Internal helper to normalize arguments from various input patterns.
|
|
1963
|
+
Priority: name (arg1) > options (arg2).
|
|
1964
|
+
|
|
1965
|
+
#### Parameters
|
|
1966
|
+
|
|
1967
|
+
##### name
|
|
1968
|
+
|
|
1969
|
+
Primary config.
|
|
1970
|
+
|
|
1971
|
+
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`FuncItem`](../interfaces/FuncItem.md)
|
|
1972
|
+
|
|
1973
|
+
##### options?
|
|
1974
|
+
|
|
1975
|
+
`any`
|
|
1976
|
+
|
|
1977
|
+
Default config.
|
|
1978
|
+
|
|
1979
|
+
#### Returns
|
|
1980
|
+
|
|
1981
|
+
`any`
|
|
1982
|
+
|
|
1983
|
+
Normalized options object.
|
|
1984
|
+
|
|
1985
|
+
#### Inherited from
|
|
1986
|
+
|
|
1987
|
+
[`ToolFunc`](ToolFunc.md).[`_normalizeArguments`](ToolFunc.md#_normalizearguments)
|
|
1988
|
+
|
|
1989
|
+
***
|
|
1990
|
+
|
|
1991
|
+
### \_normalizeRegisterArguments()
|
|
1992
|
+
|
|
1993
|
+
> `protected` `static` **\_normalizeRegisterArguments**(`name`, `options?`): [`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
1994
|
+
|
|
1995
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:682
|
|
1996
|
+
|
|
1997
|
+
**`Internal`**
|
|
1998
|
+
|
|
1999
|
+
Normalizes the arguments passed to the `register` method into a unified `RegisterOptions` object.
|
|
2000
|
+
|
|
2001
|
+
#### Parameters
|
|
2002
|
+
|
|
2003
|
+
##### name
|
|
2004
|
+
|
|
2005
|
+
The primary identification or implementation.
|
|
2006
|
+
|
|
2007
|
+
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2008
|
+
|
|
2009
|
+
##### options?
|
|
2010
|
+
|
|
2011
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2012
|
+
|
|
2013
|
+
Additional or overriding configuration.
|
|
2014
|
+
|
|
2015
|
+
#### Returns
|
|
2016
|
+
|
|
2017
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2018
|
+
|
|
2019
|
+
A normalized options object ready for registration.
|
|
2020
|
+
|
|
2021
|
+
#### Inherited from
|
|
2022
|
+
|
|
2023
|
+
[`ToolFunc`](ToolFunc.md).[`_normalizeRegisterArguments`](ToolFunc.md#_normalizeregisterarguments)
|
|
2024
|
+
|
|
2025
|
+
***
|
|
2026
|
+
|
|
2027
|
+
### \_prepareContext()
|
|
2028
|
+
|
|
2029
|
+
> `static` **\_prepareContext**(`parentCtx?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
2030
|
+
|
|
2031
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:535
|
|
2032
|
+
|
|
2033
|
+
**`Internal`**
|
|
2034
|
+
|
|
2035
|
+
Internal helper to prepare the execution context, maintaining the prototype chain.
|
|
2036
|
+
|
|
2037
|
+
#### Parameters
|
|
2038
|
+
|
|
2039
|
+
##### parentCtx?
|
|
2040
|
+
|
|
2041
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
2042
|
+
|
|
2043
|
+
The parent context to inherit from.
|
|
2044
|
+
|
|
2045
|
+
##### ctx?
|
|
2046
|
+
|
|
2047
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
2048
|
+
|
|
2049
|
+
The new context properties to apply.
|
|
2050
|
+
|
|
2051
|
+
#### Returns
|
|
2052
|
+
|
|
2053
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
2054
|
+
|
|
2055
|
+
The merged context.
|
|
2056
|
+
|
|
2057
|
+
DANGER - DO NOT "OPTIMIZE" UNLESS YOU UNDERSTAND:
|
|
2058
|
+
1. Why NOT Object.assign(target, ctx) alone?
|
|
2059
|
+
Object.assign only copies 'own' properties. In nested calls (e.g., .with().with()),
|
|
2060
|
+
parent properties exist on the prototype. Using assign would drop all inherited
|
|
2061
|
+
context data (like traceId from a parent runner).
|
|
2062
|
+
2. Why NOT Object.setPrototypeOf?
|
|
2063
|
+
It's a heavy performance killer in V8. We use Object.create(proto) instead.
|
|
2064
|
+
3. Why check isPrototypeOf?
|
|
2065
|
+
If ctx is already in the chain, we return it to maintain identity and avoid
|
|
2066
|
+
redundant shadow layers, which is required by many AOP plugins and unit tests.
|
|
2067
|
+
|
|
2068
|
+
#### Inherited from
|
|
2069
|
+
|
|
2070
|
+
[`ToolFunc`](ToolFunc.md).[`_prepareContext`](ToolFunc.md#_preparecontext-2)
|
|
2071
|
+
|
|
2072
|
+
***
|
|
2073
|
+
|
|
2074
|
+
### \_releaseDependencies()
|
|
2075
|
+
|
|
2076
|
+
> `protected` `static` **\_releaseDependencies**(`inst`): `void`
|
|
2077
|
+
|
|
2078
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:741
|
|
2079
|
+
|
|
2080
|
+
#### Parameters
|
|
2081
|
+
|
|
2082
|
+
##### inst
|
|
2083
|
+
|
|
2084
|
+
[`ToolFunc`](ToolFunc.md)
|
|
2085
|
+
|
|
2086
|
+
#### Returns
|
|
2087
|
+
|
|
2088
|
+
`void`
|
|
2089
|
+
|
|
2090
|
+
#### Inherited from
|
|
2091
|
+
|
|
2092
|
+
[`ToolFunc`](ToolFunc.md).[`_releaseDependencies`](ToolFunc.md#_releasedependencies)
|
|
2093
|
+
|
|
2094
|
+
***
|
|
2095
|
+
|
|
1594
2096
|
### assign()
|
|
1595
2097
|
|
|
1596
2098
|
#### Call Signature
|
|
@@ -1779,6 +2281,27 @@ One or more source objects from which to copy properties
|
|
|
1779
2281
|
|
|
1780
2282
|
***
|
|
1781
2283
|
|
|
2284
|
+
### clear()
|
|
2285
|
+
|
|
2286
|
+
> `static` **clear**(): `void`
|
|
2287
|
+
|
|
2288
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:661
|
|
2289
|
+
|
|
2290
|
+
Resets the local registry by clearing all registered items, aliases, and reference counts.
|
|
2291
|
+
|
|
2292
|
+
In a hierarchical registry, this only clears properties "owned" by the current
|
|
2293
|
+
layer. Inherited items from parent registries remain visible through the prototype chain.
|
|
2294
|
+
|
|
2295
|
+
#### Returns
|
|
2296
|
+
|
|
2297
|
+
`void`
|
|
2298
|
+
|
|
2299
|
+
#### Inherited from
|
|
2300
|
+
|
|
2301
|
+
[`ToolFunc`](ToolFunc.md).[`clear`](ToolFunc.md#clear)
|
|
2302
|
+
|
|
2303
|
+
***
|
|
2304
|
+
|
|
1782
2305
|
### create()
|
|
1783
2306
|
|
|
1784
2307
|
#### Call Signature
|
|
@@ -1795,7 +2318,7 @@ Creates an object that has the specified prototype or that has null prototype.
|
|
|
1795
2318
|
|
|
1796
2319
|
Object to use as a prototype. May be null.
|
|
1797
2320
|
|
|
1798
|
-
`
|
|
2321
|
+
`object` | `null`
|
|
1799
2322
|
|
|
1800
2323
|
##### Returns
|
|
1801
2324
|
|
|
@@ -1819,7 +2342,7 @@ Creates an object that has the specified prototype, and that optionally contains
|
|
|
1819
2342
|
|
|
1820
2343
|
Object to use as a prototype. May be null
|
|
1821
2344
|
|
|
1822
|
-
`
|
|
2345
|
+
`object` | `null`
|
|
1823
2346
|
|
|
1824
2347
|
###### properties
|
|
1825
2348
|
|
|
@@ -2129,7 +2652,7 @@ An iterable object that contains key-value entries for properties and methods.
|
|
|
2129
2652
|
|
|
2130
2653
|
> `static` **get**(`name`): [`ToolFunc`](ToolFunc.md)
|
|
2131
2654
|
|
|
2132
|
-
Defined in:
|
|
2655
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:553
|
|
2133
2656
|
|
|
2134
2657
|
Retrieves a registered function by its name or alias.
|
|
2135
2658
|
|
|
@@ -2157,7 +2680,7 @@ The `ToolFunc` instance if found, otherwise `undefined`.
|
|
|
2157
2680
|
|
|
2158
2681
|
> `static` **getAllByTag**(`tagName`): [`ToolFunc`](ToolFunc.md)[]
|
|
2159
2682
|
|
|
2160
|
-
Defined in:
|
|
2683
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:570
|
|
2161
2684
|
|
|
2162
2685
|
Retrieves all registered functions that have a specific tag.
|
|
2163
2686
|
|
|
@@ -2183,9 +2706,9 @@ An array of matching `ToolFunc` instances.
|
|
|
2183
2706
|
|
|
2184
2707
|
### getByTag()
|
|
2185
2708
|
|
|
2186
|
-
> `static` **getByTag**(`tagName`):
|
|
2709
|
+
> `static` **getByTag**(`tagName`): [`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
2187
2710
|
|
|
2188
|
-
Defined in:
|
|
2711
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:564
|
|
2189
2712
|
|
|
2190
2713
|
Finds the first registered function that has a specific tag.
|
|
2191
2714
|
|
|
@@ -2199,7 +2722,7 @@ The tag to search for.
|
|
|
2199
2722
|
|
|
2200
2723
|
#### Returns
|
|
2201
2724
|
|
|
2202
|
-
|
|
2725
|
+
[`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
2203
2726
|
|
|
2204
2727
|
The first matching `ToolFunc` instance, or `undefined` if none is found.
|
|
2205
2728
|
|
|
@@ -2213,7 +2736,7 @@ The first matching `ToolFunc` instance, or `undefined` if none is found.
|
|
|
2213
2736
|
|
|
2214
2737
|
> `static` **getFunc**(`name`): `any`
|
|
2215
2738
|
|
|
2216
|
-
Defined in:
|
|
2739
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:605
|
|
2217
2740
|
|
|
2218
2741
|
Retrieves a bound, runnable function reference for a registered function.
|
|
2219
2742
|
This reference is suitable for execution with an object of named parameters.
|
|
@@ -2242,7 +2765,7 @@ A bound function reference, or `undefined` if not found.
|
|
|
2242
2765
|
|
|
2243
2766
|
> `static` **getFuncWithPos**(`name`): `any`
|
|
2244
2767
|
|
|
2245
|
-
Defined in:
|
|
2768
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:632
|
|
2246
2769
|
|
|
2247
2770
|
Retrieves a bound, runnable function reference for a registered function.
|
|
2248
2771
|
This reference is suitable for execution with positional arguments.
|
|
@@ -2269,7 +2792,7 @@ A bound function reference, or `undefined` if not found.
|
|
|
2269
2792
|
|
|
2270
2793
|
### getOwnPropertyDescriptor()
|
|
2271
2794
|
|
|
2272
|
-
> `static` **getOwnPropertyDescriptor**(`o`, `p`): `
|
|
2795
|
+
> `static` **getOwnPropertyDescriptor**(`o`, `p`): `PropertyDescriptor` \| `undefined`
|
|
2273
2796
|
|
|
2274
2797
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/typescript/lib/lib.es5.d.ts:175
|
|
2275
2798
|
|
|
@@ -2292,7 +2815,7 @@ Name of the property.
|
|
|
2292
2815
|
|
|
2293
2816
|
#### Returns
|
|
2294
2817
|
|
|
2295
|
-
`
|
|
2818
|
+
`PropertyDescriptor` \| `undefined`
|
|
2296
2819
|
|
|
2297
2820
|
#### Inherited from
|
|
2298
2821
|
|
|
@@ -2433,7 +2956,7 @@ The object that references the prototype.
|
|
|
2433
2956
|
|
|
2434
2957
|
> `static` **hasAsyncFeature**(`feature`): `boolean`
|
|
2435
2958
|
|
|
2436
|
-
Defined in:
|
|
2959
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:576
|
|
2437
2960
|
|
|
2438
2961
|
Checks if any registered function has a specific asynchronous feature.
|
|
2439
2962
|
|
|
@@ -2573,6 +3096,37 @@ Object to test.
|
|
|
2573
3096
|
|
|
2574
3097
|
***
|
|
2575
3098
|
|
|
3099
|
+
### isolateRegistry()
|
|
3100
|
+
|
|
3101
|
+
> `static` **isolateRegistry**(`options?`): `void`
|
|
3102
|
+
|
|
3103
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:654
|
|
3104
|
+
|
|
3105
|
+
Isolates the current registry layer by branching off its parent using prototype shadowing.
|
|
3106
|
+
|
|
3107
|
+
This creates a new "scope" where:
|
|
3108
|
+
1. New registrations are stored only in the local layer, supporting tool shadowing.
|
|
3109
|
+
2. Parent tools remain accessible via the prototype chain (read-only) unless shadowed.
|
|
3110
|
+
3. Reference counting is isolated, enabling clean per-layer lifecycle management.
|
|
3111
|
+
|
|
3112
|
+
#### Parameters
|
|
3113
|
+
|
|
3114
|
+
##### options?
|
|
3115
|
+
|
|
3116
|
+
[`ToolFuncRegistryIsolateOptions`](../interfaces/ToolFuncRegistryIsolateOptions.md)
|
|
3117
|
+
|
|
3118
|
+
Options to selectively isolate specific maps (items, aliases, refCounts).
|
|
3119
|
+
|
|
3120
|
+
#### Returns
|
|
3121
|
+
|
|
3122
|
+
`void`
|
|
3123
|
+
|
|
3124
|
+
#### Inherited from
|
|
3125
|
+
|
|
3126
|
+
[`ToolFunc`](ToolFunc.md).[`isolateRegistry`](ToolFunc.md#isolateregistry)
|
|
3127
|
+
|
|
3128
|
+
***
|
|
3129
|
+
|
|
2576
3130
|
### isSealed()
|
|
2577
3131
|
|
|
2578
3132
|
> `static` **isSealed**(`o`): `boolean`
|
|
@@ -2653,7 +3207,7 @@ Object that contains the properties and methods. This can be an object that you
|
|
|
2653
3207
|
|
|
2654
3208
|
> `static` **list**(): [`Funcs`](../interfaces/Funcs.md)
|
|
2655
3209
|
|
|
2656
|
-
Defined in:
|
|
3210
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:558
|
|
2657
3211
|
|
|
2658
3212
|
Returns the complete map of all registered functions.
|
|
2659
3213
|
|
|
@@ -2707,9 +3261,24 @@ Object to make non-extensible.
|
|
|
2707
3261
|
|
|
2708
3262
|
> `static` **register**(`name`, `options`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2709
3263
|
|
|
2710
|
-
Defined in:
|
|
3264
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:718
|
|
3265
|
+
|
|
3266
|
+
**`Internal`**
|
|
3267
|
+
|
|
3268
|
+
Registers a `ToolFunc` instance into the registry.
|
|
3269
|
+
|
|
3270
|
+
This method supports multiple overloads and handles hierarchical registration,
|
|
3271
|
+
alias collision protection, and automatic dependency registration with cycle detection.
|
|
3272
|
+
|
|
3273
|
+
### Hierarchical Behavior:
|
|
3274
|
+
- In an isolated registry, items are stored locally, shadowing parent items with the same name.
|
|
3275
|
+
- Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
|
|
3276
|
+
unless `allowOverride.alias` is explicitly granted.
|
|
2711
3277
|
|
|
2712
|
-
|
|
3278
|
+
### Circular Dependencies:
|
|
3279
|
+
Automatically detects and manages circular dependency chains using an internal stack.
|
|
3280
|
+
Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
|
|
3281
|
+
and enable clean group unregistration.
|
|
2713
3282
|
|
|
2714
3283
|
##### Parameters
|
|
2715
3284
|
|
|
@@ -2717,19 +3286,38 @@ Registers a new tool function.
|
|
|
2717
3286
|
|
|
2718
3287
|
`string`
|
|
2719
3288
|
|
|
2720
|
-
The name
|
|
3289
|
+
The tool instance, function, or name to register.
|
|
2721
3290
|
|
|
2722
3291
|
###### options
|
|
2723
3292
|
|
|
2724
|
-
[`
|
|
3293
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2725
3294
|
|
|
2726
|
-
|
|
3295
|
+
Configuration or implementation for the tool.
|
|
2727
3296
|
|
|
2728
3297
|
##### Returns
|
|
2729
3298
|
|
|
2730
3299
|
`boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2731
3300
|
|
|
2732
|
-
The
|
|
3301
|
+
The registered ToolFunc instance on success (creation, shadowing, or override),
|
|
3302
|
+
or `false` if registration was ignored (e.g., ref-count increment only).
|
|
3303
|
+
|
|
3304
|
+
##### Example
|
|
3305
|
+
|
|
3306
|
+
```ts
|
|
3307
|
+
// 1. Registering with explicit name and function
|
|
3308
|
+
ToolFunc.register('add', { func: (a, b) => a + b });
|
|
3309
|
+
|
|
3310
|
+
// 2. Registering with shadowing permission in an isolated registry
|
|
3311
|
+
MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
|
|
3312
|
+
|
|
3313
|
+
// 3. Registering an existing ToolFunc instance
|
|
3314
|
+
const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
|
|
3315
|
+
ToolFunc.register(tool);
|
|
3316
|
+
```
|
|
3317
|
+
|
|
3318
|
+
##### Throws
|
|
3319
|
+
|
|
3320
|
+
If name is missing, or if an alias collision occurs without permission.
|
|
2733
3321
|
|
|
2734
3322
|
##### Inherited from
|
|
2735
3323
|
|
|
@@ -2739,9 +3327,24 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
|
|
|
2739
3327
|
|
|
2740
3328
|
> `static` **register**(`func`, `options`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2741
3329
|
|
|
2742
|
-
Defined in:
|
|
3330
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:719
|
|
3331
|
+
|
|
3332
|
+
**`Internal`**
|
|
3333
|
+
|
|
3334
|
+
Registers a `ToolFunc` instance into the registry.
|
|
3335
|
+
|
|
3336
|
+
This method supports multiple overloads and handles hierarchical registration,
|
|
3337
|
+
alias collision protection, and automatic dependency registration with cycle detection.
|
|
3338
|
+
|
|
3339
|
+
### Hierarchical Behavior:
|
|
3340
|
+
- In an isolated registry, items are stored locally, shadowing parent items with the same name.
|
|
3341
|
+
- Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
|
|
3342
|
+
unless `allowOverride.alias` is explicitly granted.
|
|
2743
3343
|
|
|
2744
|
-
|
|
3344
|
+
### Circular Dependencies:
|
|
3345
|
+
Automatically detects and manages circular dependency chains using an internal stack.
|
|
3346
|
+
Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
|
|
3347
|
+
and enable clean group unregistration.
|
|
2745
3348
|
|
|
2746
3349
|
##### Parameters
|
|
2747
3350
|
|
|
@@ -2749,19 +3352,36 @@ Registers a new tool function.
|
|
|
2749
3352
|
|
|
2750
3353
|
`Function`
|
|
2751
3354
|
|
|
2752
|
-
The function implementation.
|
|
2753
|
-
|
|
2754
3355
|
###### options
|
|
2755
3356
|
|
|
2756
|
-
[`
|
|
3357
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2757
3358
|
|
|
2758
|
-
|
|
3359
|
+
Configuration or implementation for the tool.
|
|
2759
3360
|
|
|
2760
3361
|
##### Returns
|
|
2761
3362
|
|
|
2762
3363
|
`boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2763
3364
|
|
|
2764
|
-
The
|
|
3365
|
+
The registered ToolFunc instance on success (creation, shadowing, or override),
|
|
3366
|
+
or `false` if registration was ignored (e.g., ref-count increment only).
|
|
3367
|
+
|
|
3368
|
+
##### Example
|
|
3369
|
+
|
|
3370
|
+
```ts
|
|
3371
|
+
// 1. Registering with explicit name and function
|
|
3372
|
+
ToolFunc.register('add', { func: (a, b) => a + b });
|
|
3373
|
+
|
|
3374
|
+
// 2. Registering with shadowing permission in an isolated registry
|
|
3375
|
+
MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
|
|
3376
|
+
|
|
3377
|
+
// 3. Registering an existing ToolFunc instance
|
|
3378
|
+
const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
|
|
3379
|
+
ToolFunc.register(tool);
|
|
3380
|
+
```
|
|
3381
|
+
|
|
3382
|
+
##### Throws
|
|
3383
|
+
|
|
3384
|
+
If name is missing, or if an alias collision occurs without permission.
|
|
2765
3385
|
|
|
2766
3386
|
##### Inherited from
|
|
2767
3387
|
|
|
@@ -2769,31 +3389,71 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
|
|
|
2769
3389
|
|
|
2770
3390
|
#### Call Signature
|
|
2771
3391
|
|
|
2772
|
-
> `static` **register**(`name`, `options?`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
3392
|
+
> `static` **register**(`name`, `options?`, `_stack?`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
3393
|
+
|
|
3394
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:720
|
|
3395
|
+
|
|
3396
|
+
**`Internal`**
|
|
3397
|
+
|
|
3398
|
+
Registers a `ToolFunc` instance into the registry.
|
|
3399
|
+
|
|
3400
|
+
This method supports multiple overloads and handles hierarchical registration,
|
|
3401
|
+
alias collision protection, and automatic dependency registration with cycle detection.
|
|
2773
3402
|
|
|
2774
|
-
|
|
3403
|
+
### Hierarchical Behavior:
|
|
3404
|
+
- In an isolated registry, items are stored locally, shadowing parent items with the same name.
|
|
3405
|
+
- Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
|
|
3406
|
+
unless `allowOverride.alias` is explicitly granted.
|
|
2775
3407
|
|
|
2776
|
-
|
|
3408
|
+
### Circular Dependencies:
|
|
3409
|
+
Automatically detects and manages circular dependency chains using an internal stack.
|
|
3410
|
+
Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
|
|
3411
|
+
and enable clean group unregistration.
|
|
2777
3412
|
|
|
2778
3413
|
##### Parameters
|
|
2779
3414
|
|
|
2780
3415
|
###### name
|
|
2781
3416
|
|
|
2782
|
-
The name
|
|
3417
|
+
The tool instance, function, or name to register.
|
|
2783
3418
|
|
|
2784
|
-
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`
|
|
3419
|
+
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2785
3420
|
|
|
2786
3421
|
###### options?
|
|
2787
3422
|
|
|
2788
|
-
[`
|
|
3423
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
3424
|
+
|
|
3425
|
+
Configuration or implementation for the tool.
|
|
2789
3426
|
|
|
2790
|
-
|
|
3427
|
+
###### \_stack?
|
|
3428
|
+
|
|
3429
|
+
`Set`\<`string`\>
|
|
3430
|
+
|
|
3431
|
+
Used for cycle detection during recursive registration.
|
|
2791
3432
|
|
|
2792
3433
|
##### Returns
|
|
2793
3434
|
|
|
2794
3435
|
`boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2795
3436
|
|
|
2796
|
-
The
|
|
3437
|
+
The registered ToolFunc instance on success (creation, shadowing, or override),
|
|
3438
|
+
or `false` if registration was ignored (e.g., ref-count increment only).
|
|
3439
|
+
|
|
3440
|
+
##### Example
|
|
3441
|
+
|
|
3442
|
+
```ts
|
|
3443
|
+
// 1. Registering with explicit name and function
|
|
3444
|
+
ToolFunc.register('add', { func: (a, b) => a + b });
|
|
3445
|
+
|
|
3446
|
+
// 2. Registering with shadowing permission in an isolated registry
|
|
3447
|
+
MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
|
|
3448
|
+
|
|
3449
|
+
// 3. Registering an existing ToolFunc instance
|
|
3450
|
+
const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
|
|
3451
|
+
ToolFunc.register(tool);
|
|
3452
|
+
```
|
|
3453
|
+
|
|
3454
|
+
##### Throws
|
|
3455
|
+
|
|
3456
|
+
If name is missing, or if an alias collision occurs without permission.
|
|
2797
3457
|
|
|
2798
3458
|
##### Inherited from
|
|
2799
3459
|
|
|
@@ -2803,12 +3463,15 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
|
|
|
2803
3463
|
|
|
2804
3464
|
### run()
|
|
2805
3465
|
|
|
2806
|
-
> `static` **run**(`name`, `params?`): `
|
|
3466
|
+
> `static` **run**(`name`, `params?`, `ctx?`): `any`
|
|
2807
3467
|
|
|
2808
|
-
Defined in:
|
|
3468
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:589
|
|
2809
3469
|
|
|
2810
3470
|
Asynchronously executes a registered function by name with named parameters.
|
|
2811
3471
|
|
|
3472
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
3473
|
+
otherwise it may return the result synchronously.
|
|
3474
|
+
|
|
2812
3475
|
#### Parameters
|
|
2813
3476
|
|
|
2814
3477
|
##### name
|
|
@@ -2823,11 +3486,17 @@ The name of the function to run.
|
|
|
2823
3486
|
|
|
2824
3487
|
The parameters object for the function.
|
|
2825
3488
|
|
|
3489
|
+
##### ctx?
|
|
3490
|
+
|
|
3491
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
3492
|
+
|
|
3493
|
+
The execution context.
|
|
3494
|
+
|
|
2826
3495
|
#### Returns
|
|
2827
3496
|
|
|
2828
|
-
`
|
|
3497
|
+
`any`
|
|
2829
3498
|
|
|
2830
|
-
A promise
|
|
3499
|
+
A promise or the direct result of the function's execution.
|
|
2831
3500
|
|
|
2832
3501
|
#### Throws
|
|
2833
3502
|
|
|
@@ -2841,9 +3510,9 @@ If the function with the given name is not found.
|
|
|
2841
3510
|
|
|
2842
3511
|
### runSync()
|
|
2843
3512
|
|
|
2844
|
-
> `static` **runSync**(`name`, `params?`): `any`
|
|
3513
|
+
> `static` **runSync**(`name`, `params?`, `ctx?`): `any`
|
|
2845
3514
|
|
|
2846
|
-
Defined in:
|
|
3515
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:598
|
|
2847
3516
|
|
|
2848
3517
|
Synchronously executes a registered function by name with named parameters.
|
|
2849
3518
|
|
|
@@ -2861,6 +3530,12 @@ The name of the function to run.
|
|
|
2861
3530
|
|
|
2862
3531
|
The parameters object for the function.
|
|
2863
3532
|
|
|
3533
|
+
##### ctx?
|
|
3534
|
+
|
|
3535
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
3536
|
+
|
|
3537
|
+
The execution context.
|
|
3538
|
+
|
|
2864
3539
|
#### Returns
|
|
2865
3540
|
|
|
2866
3541
|
`any`
|
|
@@ -2879,12 +3554,15 @@ If the function with the given name is not found.
|
|
|
2879
3554
|
|
|
2880
3555
|
### runWithPos()
|
|
2881
3556
|
|
|
2882
|
-
> `static` **runWithPos**(`name`, ...`params`): `
|
|
3557
|
+
> `static` **runWithPos**(`name`, ...`params`): `any`
|
|
2883
3558
|
|
|
2884
|
-
Defined in:
|
|
3559
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:617
|
|
2885
3560
|
|
|
2886
3561
|
Asynchronously executes a function using positional arguments.
|
|
2887
3562
|
|
|
3563
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
3564
|
+
otherwise it may return the result synchronously.
|
|
3565
|
+
|
|
2888
3566
|
#### Parameters
|
|
2889
3567
|
|
|
2890
3568
|
##### name
|
|
@@ -2901,9 +3579,9 @@ Positional arguments to pass to the function.
|
|
|
2901
3579
|
|
|
2902
3580
|
#### Returns
|
|
2903
3581
|
|
|
2904
|
-
`
|
|
3582
|
+
`any`
|
|
2905
3583
|
|
|
2906
|
-
A promise
|
|
3584
|
+
A promise or the direct result of the function's execution.
|
|
2907
3585
|
|
|
2908
3586
|
#### Throws
|
|
2909
3587
|
|
|
@@ -2919,7 +3597,7 @@ If the function with the given name is not found.
|
|
|
2919
3597
|
|
|
2920
3598
|
> `static` **runWithPosSync**(`name`, ...`params`): `any`
|
|
2921
3599
|
|
|
2922
|
-
Defined in:
|
|
3600
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:625
|
|
2923
3601
|
|
|
2924
3602
|
Synchronously executes a function using positional arguments.
|
|
2925
3603
|
|
|
@@ -2989,7 +3667,7 @@ Object on which to lock the attributes.
|
|
|
2989
3667
|
|
|
2990
3668
|
> `static` **setApiRoot**(`v`): `void`
|
|
2991
3669
|
|
|
2992
|
-
Defined in:
|
|
3670
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:337
|
|
2993
3671
|
|
|
2994
3672
|
#### Parameters
|
|
2995
3673
|
|
|
@@ -3023,7 +3701,7 @@ The object to change its prototype.
|
|
|
3023
3701
|
|
|
3024
3702
|
The value of the new prototype or null.
|
|
3025
3703
|
|
|
3026
|
-
`
|
|
3704
|
+
`object` | `null`
|
|
3027
3705
|
|
|
3028
3706
|
#### Returns
|
|
3029
3707
|
|
|
@@ -3039,12 +3717,13 @@ The value of the new prototype or null.
|
|
|
3039
3717
|
|
|
3040
3718
|
> `static` **toJSON**(): `object`
|
|
3041
3719
|
|
|
3042
|
-
Defined in:
|
|
3720
|
+
Defined in: @isdk/ai-tools/packages/tool-rpc/dist/index-359784IS.d.ts:348
|
|
3043
3721
|
|
|
3044
3722
|
Serializes all registered `ServerTools` instances into a JSON object.
|
|
3045
3723
|
This method is typically called by a transport's discovery endpoint.
|
|
3046
3724
|
|
|
3047
|
-
It filters for tools that are instances of `
|
|
3725
|
+
It filters for tools that are instances of `this` (the current class)
|
|
3726
|
+
or marked as `isApi` but NOT an instance of `ServerTools` (e.g., base ToolFunc).
|
|
3048
3727
|
It omits the `func` body from the output unless `allowExportFunc` is true.
|
|
3049
3728
|
|
|
3050
3729
|
#### Returns
|
|
@@ -3057,25 +3736,34 @@ A map of serializable tool definitions.
|
|
|
3057
3736
|
|
|
3058
3737
|
### unregister()
|
|
3059
3738
|
|
|
3060
|
-
> `static` **unregister**(`
|
|
3739
|
+
> `static` **unregister**(`target`, `options?`): [`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
3740
|
+
|
|
3741
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:737
|
|
3061
3742
|
|
|
3062
|
-
|
|
3743
|
+
Unregisters a tool function implementation from the registry by its name, alias, or instance.
|
|
3063
3744
|
|
|
3064
|
-
|
|
3745
|
+
This method supports hierarchical unregistration. If a function's reference count
|
|
3746
|
+
reaches zero, it is physically removed from the registry and its dependencies are released.
|
|
3065
3747
|
|
|
3066
3748
|
#### Parameters
|
|
3067
3749
|
|
|
3068
|
-
#####
|
|
3750
|
+
##### target
|
|
3069
3751
|
|
|
3070
|
-
|
|
3752
|
+
The name, alias, or implementation instance.
|
|
3753
|
+
|
|
3754
|
+
`string` | [`ToolFunc`](ToolFunc.md)
|
|
3071
3755
|
|
|
3072
|
-
|
|
3756
|
+
##### options?
|
|
3757
|
+
|
|
3758
|
+
Options or a simple 'force' boolean flag.
|
|
3759
|
+
|
|
3760
|
+
`boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
|
|
3073
3761
|
|
|
3074
3762
|
#### Returns
|
|
3075
3763
|
|
|
3076
|
-
|
|
3764
|
+
[`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
3077
3765
|
|
|
3078
|
-
The unregistered
|
|
3766
|
+
The unregistered ToolFunc instance, or `undefined` if not found.
|
|
3079
3767
|
|
|
3080
3768
|
#### Inherited from
|
|
3081
3769
|
|
|
@@ -3136,3 +3824,31 @@ Object that contains the properties and methods. This can be an object that you
|
|
|
3136
3824
|
##### Inherited from
|
|
3137
3825
|
|
|
3138
3826
|
[`ToolFunc`](ToolFunc.md).[`values`](ToolFunc.md#values)
|
|
3827
|
+
|
|
3828
|
+
***
|
|
3829
|
+
|
|
3830
|
+
### with()
|
|
3831
|
+
|
|
3832
|
+
> `static` **with**(`ctx`): *typeof* [`ToolFunc`](ToolFunc.md)
|
|
3833
|
+
|
|
3834
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:515
|
|
3835
|
+
|
|
3836
|
+
Returns a static proxy with the provided context.
|
|
3837
|
+
|
|
3838
|
+
#### Parameters
|
|
3839
|
+
|
|
3840
|
+
##### ctx
|
|
3841
|
+
|
|
3842
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
3843
|
+
|
|
3844
|
+
The context to use.
|
|
3845
|
+
|
|
3846
|
+
#### Returns
|
|
3847
|
+
|
|
3848
|
+
*typeof* [`ToolFunc`](ToolFunc.md)
|
|
3849
|
+
|
|
3850
|
+
A static proxy of ToolFunc class.
|
|
3851
|
+
|
|
3852
|
+
#### Inherited from
|
|
3853
|
+
|
|
3854
|
+
[`ToolFunc`](ToolFunc.md).[`with`](ToolFunc.md#with-2)
|