@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: EventToolFunc
|
|
8
8
|
|
|
9
|
-
Defined in:
|
|
9
|
+
Defined in: @isdk/ai-tools/packages/tool-event/dist/index.d.ts:145
|
|
10
10
|
|
|
11
11
|
A manager for creating, registering, and executing reusable tool functions.
|
|
12
12
|
|
|
@@ -77,10 +77,13 @@ main();
|
|
|
77
77
|
|
|
78
78
|
> **new EventToolFunc**(`name`, `options?`): `EventToolFunc`
|
|
79
79
|
|
|
80
|
-
Defined in:
|
|
80
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:751
|
|
81
81
|
|
|
82
82
|
Initializes a new `ToolFunc` instance.
|
|
83
83
|
|
|
84
|
+
If a named function is provided as the first argument (or in `options.func`),
|
|
85
|
+
and no name is explicitly provided, the instance will automatically inherit the function's name.
|
|
86
|
+
|
|
84
87
|
#### Parameters
|
|
85
88
|
|
|
86
89
|
##### name
|
|
@@ -91,7 +94,7 @@ Can be a function name, a function implementation, or a configuration object.
|
|
|
91
94
|
|
|
92
95
|
##### options?
|
|
93
96
|
|
|
94
|
-
`any`
|
|
97
|
+
`any`
|
|
95
98
|
|
|
96
99
|
Configuration options if not provided in the first argument.
|
|
97
100
|
|
|
@@ -109,7 +112,23 @@ Configuration options if not provided in the first argument.
|
|
|
109
112
|
|
|
110
113
|
> **\_emitter**: [`EventEmitter`](EventEmitter.md)
|
|
111
114
|
|
|
112
|
-
Defined in:
|
|
115
|
+
Defined in: @isdk/ai-tools/packages/tool-event/dist/index.d.ts:146
|
|
116
|
+
|
|
117
|
+
***
|
|
118
|
+
|
|
119
|
+
### \_registry?
|
|
120
|
+
|
|
121
|
+
> `optional` **\_registry**: *typeof* [`ToolFunc`](ToolFunc.md)
|
|
122
|
+
|
|
123
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:496
|
|
124
|
+
|
|
125
|
+
**`Internal`**
|
|
126
|
+
|
|
127
|
+
The registry class where this tool was originally registered.
|
|
128
|
+
|
|
129
|
+
#### Inherited from
|
|
130
|
+
|
|
131
|
+
[`ToolFunc`](ToolFunc.md).[`_registry`](ToolFunc.md#_registry)
|
|
113
132
|
|
|
114
133
|
***
|
|
115
134
|
|
|
@@ -129,7 +148,7 @@ Defined in: [property-manager.js/src/advance.d.ts:5](https://github.com/snowyu/p
|
|
|
129
148
|
|
|
130
149
|
> `optional` **alias**: `string` \| `string`[]
|
|
131
150
|
|
|
132
|
-
Defined in:
|
|
151
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:258
|
|
133
152
|
|
|
134
153
|
Optional aliases for the function name.
|
|
135
154
|
|
|
@@ -143,7 +162,7 @@ Optional aliases for the function name.
|
|
|
143
162
|
|
|
144
163
|
> `optional` **asyncFeatures**: `number`
|
|
145
164
|
|
|
146
|
-
Defined in:
|
|
165
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:272
|
|
147
166
|
|
|
148
167
|
A bitmask representing asynchronous features supported by the function, built from `AsyncFeatureBits`.
|
|
149
168
|
This allows the system to understand if a function supports capabilities like cancellation or multi-tasking.
|
|
@@ -183,6 +202,21 @@ The initial value of Object.prototype.constructor is the standard built-in Objec
|
|
|
183
202
|
|
|
184
203
|
***
|
|
185
204
|
|
|
205
|
+
### ctx?
|
|
206
|
+
|
|
207
|
+
> `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
208
|
+
|
|
209
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:547
|
|
210
|
+
|
|
211
|
+
The execution context for the current function call.
|
|
212
|
+
Only available when isolated execution is enabled.
|
|
213
|
+
|
|
214
|
+
#### Inherited from
|
|
215
|
+
|
|
216
|
+
[`ToolFunc`](ToolFunc.md).[`ctx`](ToolFunc.md#ctx)
|
|
217
|
+
|
|
218
|
+
***
|
|
219
|
+
|
|
186
220
|
### defaultOptions
|
|
187
221
|
|
|
188
222
|
> **defaultOptions**: `object`
|
|
@@ -209,7 +243,7 @@ The default options for export and assign
|
|
|
209
243
|
|
|
210
244
|
> `optional` **depends**: `object`
|
|
211
245
|
|
|
212
|
-
Defined in:
|
|
246
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:295
|
|
213
247
|
|
|
214
248
|
A map of dependencies this function has on other tool functions.
|
|
215
249
|
Declaring dependencies ensures that they are automatically registered when this function is registered.
|
|
@@ -246,9 +280,9 @@ mainFunc.register();
|
|
|
246
280
|
|
|
247
281
|
### description
|
|
248
282
|
|
|
249
|
-
> **description**: `string`
|
|
283
|
+
> **description**: `string`
|
|
250
284
|
|
|
251
|
-
Defined in:
|
|
285
|
+
Defined in: @isdk/ai-tools/packages/tool-event/dist/index.d.ts:147
|
|
252
286
|
|
|
253
287
|
A detailed description of what the function does.
|
|
254
288
|
|
|
@@ -262,7 +296,7 @@ A detailed description of what the function does.
|
|
|
262
296
|
|
|
263
297
|
> `optional` **isApi**: `boolean`
|
|
264
298
|
|
|
265
|
-
Defined in:
|
|
299
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:247
|
|
266
300
|
|
|
267
301
|
If true, indicates that this function should be treated as a server-side API.
|
|
268
302
|
|
|
@@ -276,7 +310,7 @@ If true, indicates that this function should be treated as a server-side API.
|
|
|
276
310
|
|
|
277
311
|
> `optional` **name**: `string`
|
|
278
312
|
|
|
279
|
-
Defined in:
|
|
313
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:204
|
|
280
314
|
|
|
281
315
|
The unique name of the function.
|
|
282
316
|
|
|
@@ -304,7 +338,7 @@ the property with the default prefix '$' will not be exported.
|
|
|
304
338
|
|
|
305
339
|
> `optional` **params**: [`FuncParams`](../interfaces/FuncParams.md) \| [`FuncParam`](../interfaces/FuncParam.md)[]
|
|
306
340
|
|
|
307
|
-
Defined in:
|
|
341
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:209
|
|
308
342
|
|
|
309
343
|
Parameter definitions, which can be an object mapping names to definitions or an array for positional parameters.
|
|
310
344
|
|
|
@@ -316,9 +350,9 @@ Parameter definitions, which can be an object mapping names to definitions or an
|
|
|
316
350
|
|
|
317
351
|
### result
|
|
318
352
|
|
|
319
|
-
> **result**: `string`
|
|
353
|
+
> **result**: `string`
|
|
320
354
|
|
|
321
|
-
Defined in:
|
|
355
|
+
Defined in: @isdk/ai-tools/packages/tool-event/dist/index.d.ts:148
|
|
322
356
|
|
|
323
357
|
The expected return type of the function, described as a string or a JSON schema object.
|
|
324
358
|
|
|
@@ -332,7 +366,7 @@ The expected return type of the function, described as a string or a JSON schema
|
|
|
332
366
|
|
|
333
367
|
> `optional` **scope**: `any`
|
|
334
368
|
|
|
335
|
-
Defined in:
|
|
369
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:219
|
|
336
370
|
|
|
337
371
|
The execution scope or context (`this`) for the function.
|
|
338
372
|
|
|
@@ -346,7 +380,7 @@ The execution scope or context (`this`) for the function.
|
|
|
346
380
|
|
|
347
381
|
> `optional` **setup**: (`this`, `options?`) => `void`
|
|
348
382
|
|
|
349
|
-
Defined in:
|
|
383
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:242
|
|
350
384
|
|
|
351
385
|
A lifecycle hook called once during the `ToolFunc` instance's initialization.
|
|
352
386
|
It allows for initial setup, state configuration, or property modification on the instance
|
|
@@ -392,7 +426,7 @@ console.log(myFunc.customState); // Outputs: 'configured'
|
|
|
392
426
|
|
|
393
427
|
> `optional` **stream**: `boolean`
|
|
394
428
|
|
|
395
|
-
Defined in:
|
|
429
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:253
|
|
396
430
|
|
|
397
431
|
If true, indicates that the function has the *capability* to stream its output.
|
|
398
432
|
Whether a specific call is streamed is determined by a `stream` property in the runtime parameters.
|
|
@@ -407,7 +441,7 @@ Whether a specific call is streamed is determined by a `stream` property in the
|
|
|
407
441
|
|
|
408
442
|
> `optional` **tags**: `string` \| `string`[]
|
|
409
443
|
|
|
410
|
-
Defined in:
|
|
444
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:224
|
|
411
445
|
|
|
412
446
|
Tags for grouping or filtering functions.
|
|
413
447
|
|
|
@@ -421,7 +455,7 @@ Tags for grouping or filtering functions.
|
|
|
421
455
|
|
|
422
456
|
> `optional` **title**: `string`
|
|
423
457
|
|
|
424
|
-
Defined in:
|
|
458
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:307
|
|
425
459
|
|
|
426
460
|
A concise, human-readable title for the function, often used in UI or by AI.
|
|
427
461
|
|
|
@@ -431,13 +465,32 @@ A concise, human-readable title for the function, often used in UI or by AI.
|
|
|
431
465
|
|
|
432
466
|
***
|
|
433
467
|
|
|
468
|
+
### \_refCounts
|
|
469
|
+
|
|
470
|
+
> `protected` `static` **\_refCounts**: `object`
|
|
471
|
+
|
|
472
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:489
|
|
473
|
+
|
|
474
|
+
Tracks the number of active registration holds on each function name.
|
|
475
|
+
A function is truly removed only when its reference count drops to zero.
|
|
476
|
+
|
|
477
|
+
#### Index Signature
|
|
478
|
+
|
|
479
|
+
\[`name`: `string`\]: `number`
|
|
480
|
+
|
|
481
|
+
#### Inherited from
|
|
482
|
+
|
|
483
|
+
[`ToolFunc`](ToolFunc.md).[`_refCounts`](ToolFunc.md#_refcounts)
|
|
484
|
+
|
|
485
|
+
***
|
|
486
|
+
|
|
434
487
|
### aliases
|
|
435
488
|
|
|
436
|
-
> `static` **aliases**: `object`
|
|
489
|
+
> `static` **aliases**: `object`
|
|
437
490
|
|
|
438
|
-
Defined in:
|
|
491
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:480
|
|
439
492
|
|
|
440
|
-
A static map of aliases to their corresponding function names.
|
|
493
|
+
A static map of aliases to their corresponding primary function names.
|
|
441
494
|
|
|
442
495
|
#### Index Signature
|
|
443
496
|
|
|
@@ -449,11 +502,25 @@ A static map of aliases to their corresponding function names.
|
|
|
449
502
|
|
|
450
503
|
***
|
|
451
504
|
|
|
505
|
+
### ctx?
|
|
506
|
+
|
|
507
|
+
> `static` `optional` **ctx**: [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
508
|
+
|
|
509
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:508
|
|
510
|
+
|
|
511
|
+
The static execution context for proxy classes created via ToolFunc.with().
|
|
512
|
+
|
|
513
|
+
#### Inherited from
|
|
514
|
+
|
|
515
|
+
[`ToolFunc`](ToolFunc.md).[`ctx`](ToolFunc.md#ctx-1)
|
|
516
|
+
|
|
517
|
+
***
|
|
518
|
+
|
|
452
519
|
### dataPath
|
|
453
520
|
|
|
454
521
|
> `static` **dataPath**: `string`
|
|
455
522
|
|
|
456
|
-
Defined in:
|
|
523
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:503
|
|
457
524
|
|
|
458
525
|
A conventional property to designate a file path for saving the registered `ToolFunc` data.
|
|
459
526
|
Note: The `ToolFunc` class itself does not implement persistence logic. It is up to the
|
|
@@ -467,11 +534,11 @@ developer to use this path to save and load the `ToolFunc.items` registry if nee
|
|
|
467
534
|
|
|
468
535
|
### items
|
|
469
536
|
|
|
470
|
-
> `static` **items**: [`Funcs`](../interfaces/Funcs.md)
|
|
537
|
+
> `static` **items**: [`Funcs`](../interfaces/Funcs.md)
|
|
471
538
|
|
|
472
|
-
Defined in:
|
|
539
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:475
|
|
473
540
|
|
|
474
|
-
A static registry of all `ToolFunc`
|
|
541
|
+
A static registry of all `ToolFunc` implementations, indexed by their primary name.
|
|
475
542
|
|
|
476
543
|
#### Inherited from
|
|
477
544
|
|
|
@@ -485,7 +552,7 @@ A static registry of all `ToolFunc` instances, indexed by name.
|
|
|
485
552
|
|
|
486
553
|
> **get** **emitter**(): [`EventEmitter`](EventEmitter.md)
|
|
487
554
|
|
|
488
|
-
Defined in:
|
|
555
|
+
Defined in: @isdk/ai-tools/packages/tool-event/dist/index.d.ts:149
|
|
489
556
|
|
|
490
557
|
##### Returns
|
|
491
558
|
|
|
@@ -493,11 +560,78 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/funcs/event.ts:12](https://gith
|
|
|
493
560
|
|
|
494
561
|
## Methods
|
|
495
562
|
|
|
563
|
+
### \_prepareContext()
|
|
564
|
+
|
|
565
|
+
> `protected` **\_prepareContext**(`params?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
566
|
+
|
|
567
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:806
|
|
568
|
+
|
|
569
|
+
Creates the final execution context (`this.ctx`) for a Shadow Instance.
|
|
570
|
+
|
|
571
|
+
NOTE: We MUST use 'this._prepareContext' (instance path) instead of
|
|
572
|
+
'Static._prepareContext' to allow AOP plugins (like CancelableAbility)
|
|
573
|
+
to hook into context preparation via method overloading ($_prepareContext).
|
|
574
|
+
|
|
575
|
+
#### Parameters
|
|
576
|
+
|
|
577
|
+
##### params?
|
|
578
|
+
|
|
579
|
+
`any`
|
|
580
|
+
|
|
581
|
+
##### ctx?
|
|
582
|
+
|
|
583
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
584
|
+
|
|
585
|
+
#### Returns
|
|
586
|
+
|
|
587
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
588
|
+
|
|
589
|
+
#### Inherited from
|
|
590
|
+
|
|
591
|
+
[`ToolFunc`](ToolFunc.md).[`_prepareContext`](ToolFunc.md#_preparecontext)
|
|
592
|
+
|
|
593
|
+
***
|
|
594
|
+
|
|
595
|
+
### \_shouldIsolate()
|
|
596
|
+
|
|
597
|
+
> `protected` **\_shouldIsolate**(`params?`, `ctx?`): `boolean`
|
|
598
|
+
|
|
599
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:798
|
|
600
|
+
|
|
601
|
+
Determines if the function execution should be isolated into a "Shadow Instance".
|
|
602
|
+
|
|
603
|
+
PRIORITY LOGIC:
|
|
604
|
+
1. Explicit 'ctx.isolated' in the current call (Highest).
|
|
605
|
+
2. Any explicit 'ctx' provided (Safe default: isolate to apply new overrides).
|
|
606
|
+
3. Prevention of recursion (If already an own 'ctx' property exists).
|
|
607
|
+
4. Inherited 'this.ctx.isolated' configuration.
|
|
608
|
+
5. Presence of any inherited context (Default: isolate for concurrency safety).
|
|
609
|
+
|
|
610
|
+
#### Parameters
|
|
611
|
+
|
|
612
|
+
##### params?
|
|
613
|
+
|
|
614
|
+
`any`
|
|
615
|
+
|
|
616
|
+
##### ctx?
|
|
617
|
+
|
|
618
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
619
|
+
|
|
620
|
+
#### Returns
|
|
621
|
+
|
|
622
|
+
`boolean`
|
|
623
|
+
|
|
624
|
+
#### Inherited from
|
|
625
|
+
|
|
626
|
+
[`ToolFunc`](ToolFunc.md).[`_shouldIsolate`](ToolFunc.md#_shouldisolate)
|
|
627
|
+
|
|
628
|
+
***
|
|
629
|
+
|
|
496
630
|
### arr2ObjParams()
|
|
497
631
|
|
|
498
632
|
> **arr2ObjParams**(`params`): `any`[]
|
|
499
633
|
|
|
500
|
-
Defined in:
|
|
634
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:770
|
|
501
635
|
|
|
502
636
|
Converts an array of positional arguments into a named parameters object.
|
|
503
637
|
This is used internally to support functions defined with named parameters.
|
|
@@ -808,7 +942,7 @@ the dest object.
|
|
|
808
942
|
|
|
809
943
|
> **func**(): [`EventEmitter`](EventEmitter.md)
|
|
810
944
|
|
|
811
|
-
Defined in:
|
|
945
|
+
Defined in: @isdk/ai-tools/packages/tool-event/dist/index.d.ts:150
|
|
812
946
|
|
|
813
947
|
The actual function implementation.
|
|
814
948
|
|
|
@@ -828,7 +962,7 @@ The result of the function.
|
|
|
828
962
|
|
|
829
963
|
> **getFunc**(`name?`): `any`
|
|
830
964
|
|
|
831
|
-
Defined in:
|
|
965
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:866
|
|
832
966
|
|
|
833
967
|
Gets a bound function reference for execution with named parameters.
|
|
834
968
|
If a name is provided, it retrieves a different function from the registry.
|
|
@@ -858,7 +992,7 @@ A function reference or `undefined` if not found.
|
|
|
858
992
|
|
|
859
993
|
> **getFuncWithPos**(`name?`): `any`
|
|
860
994
|
|
|
861
|
-
Defined in:
|
|
995
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:910
|
|
862
996
|
|
|
863
997
|
Gets a bound function reference suitable for positional argument execution.
|
|
864
998
|
If a name is provided, it retrieves a different function from the registry.
|
|
@@ -908,7 +1042,7 @@ the descriptors of properties object
|
|
|
908
1042
|
|
|
909
1043
|
> **hasAsyncFeature**(`feature`): `boolean`
|
|
910
1044
|
|
|
911
|
-
Defined in:
|
|
1045
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:916
|
|
912
1046
|
|
|
913
1047
|
Checks if the current function instance supports a specific async feature.
|
|
914
1048
|
|
|
@@ -1042,9 +1176,9 @@ The source object
|
|
|
1042
1176
|
|
|
1043
1177
|
### isStream()
|
|
1044
1178
|
|
|
1045
|
-
> **isStream**(`params`): `
|
|
1179
|
+
> **isStream**(`params`): `boolean` \| `undefined`
|
|
1046
1180
|
|
|
1047
|
-
Defined in:
|
|
1181
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:929
|
|
1048
1182
|
|
|
1049
1183
|
Determines if a function call should produce a stream.
|
|
1050
1184
|
|
|
@@ -1064,7 +1198,7 @@ The runtime parameters passed to the function call.
|
|
|
1064
1198
|
|
|
1065
1199
|
#### Returns
|
|
1066
1200
|
|
|
1067
|
-
`
|
|
1201
|
+
`boolean` \| `undefined`
|
|
1068
1202
|
|
|
1069
1203
|
`true` if the call should be streamed, `false` or `undefined` otherwise.
|
|
1070
1204
|
|
|
@@ -1110,7 +1244,7 @@ the dest object.
|
|
|
1110
1244
|
|
|
1111
1245
|
> **obj2ArrParams**(`params?`): `any`[]
|
|
1112
1246
|
|
|
1113
|
-
Defined in:
|
|
1247
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:777
|
|
1114
1248
|
|
|
1115
1249
|
Converts a named parameters object into an array of positional arguments.
|
|
1116
1250
|
This is used for functions defined with positional parameters.
|
|
@@ -1165,7 +1299,7 @@ A property name.
|
|
|
1165
1299
|
|
|
1166
1300
|
> **register**(): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
1167
1301
|
|
|
1168
|
-
Defined in:
|
|
1302
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:757
|
|
1169
1303
|
|
|
1170
1304
|
Registers the current `ToolFunc` instance into the static registry.
|
|
1171
1305
|
Also registers any declared dependencies.
|
|
@@ -1184,12 +1318,15 @@ The instance itself upon successful registration, or `false` if it already exist
|
|
|
1184
1318
|
|
|
1185
1319
|
### run()
|
|
1186
1320
|
|
|
1187
|
-
> **run**(`params?`): `
|
|
1321
|
+
> **run**(`params?`, `ctx?`): `any`
|
|
1188
1322
|
|
|
1189
|
-
Defined in:
|
|
1323
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:825
|
|
1190
1324
|
|
|
1191
1325
|
Executes the function asynchronously with a named parameters object.
|
|
1192
1326
|
|
|
1327
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
1328
|
+
otherwise it may return the result synchronously.
|
|
1329
|
+
|
|
1193
1330
|
#### Parameters
|
|
1194
1331
|
|
|
1195
1332
|
##### params?
|
|
@@ -1198,11 +1335,17 @@ Executes the function asynchronously with a named parameters object.
|
|
|
1198
1335
|
|
|
1199
1336
|
The parameters object for the function.
|
|
1200
1337
|
|
|
1338
|
+
##### ctx?
|
|
1339
|
+
|
|
1340
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1341
|
+
|
|
1342
|
+
The execution context.
|
|
1343
|
+
|
|
1201
1344
|
#### Returns
|
|
1202
1345
|
|
|
1203
|
-
`
|
|
1346
|
+
`any`
|
|
1204
1347
|
|
|
1205
|
-
A promise
|
|
1348
|
+
A promise or the direct result of the function's execution.
|
|
1206
1349
|
|
|
1207
1350
|
#### Inherited from
|
|
1208
1351
|
|
|
@@ -1212,12 +1355,14 @@ A promise that resolves with the function's result.
|
|
|
1212
1355
|
|
|
1213
1356
|
### runAs()
|
|
1214
1357
|
|
|
1215
|
-
> **runAs**(`name`, `params?`): `
|
|
1358
|
+
> **runAs**(`name`, `params?`, `ctx?`): `any`
|
|
1216
1359
|
|
|
1217
|
-
Defined in:
|
|
1360
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:837
|
|
1218
1361
|
|
|
1219
1362
|
Asynchronously executes another registered function by name.
|
|
1220
|
-
|
|
1363
|
+
|
|
1364
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
1365
|
+
otherwise it may return the result synchronously.
|
|
1221
1366
|
|
|
1222
1367
|
#### Parameters
|
|
1223
1368
|
|
|
@@ -1233,11 +1378,17 @@ The name of the target function to run.
|
|
|
1233
1378
|
|
|
1234
1379
|
Optional parameters to pass to the function.
|
|
1235
1380
|
|
|
1381
|
+
##### ctx?
|
|
1382
|
+
|
|
1383
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1384
|
+
|
|
1385
|
+
The execution context.
|
|
1386
|
+
|
|
1236
1387
|
#### Returns
|
|
1237
1388
|
|
|
1238
|
-
`
|
|
1389
|
+
`any`
|
|
1239
1390
|
|
|
1240
|
-
A promise
|
|
1391
|
+
A promise or the direct result of the function's execution.
|
|
1241
1392
|
|
|
1242
1393
|
#### Inherited from
|
|
1243
1394
|
|
|
@@ -1247,12 +1398,22 @@ A promise that resolves with the result of the function execution.
|
|
|
1247
1398
|
|
|
1248
1399
|
### runAsSync()
|
|
1249
1400
|
|
|
1250
|
-
> **runAsSync**(`name`, `params?`): `any`
|
|
1401
|
+
> **runAsSync**(`name`, `params?`, `ctx?`): `any`
|
|
1402
|
+
|
|
1403
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:858
|
|
1404
|
+
|
|
1405
|
+
Executes another registered function by name, using hierarchical dependency resolution.
|
|
1251
1406
|
|
|
1252
|
-
|
|
1407
|
+
This method supports **Late-Binding Polymorphism**. It uses the `rootRegistry` and
|
|
1408
|
+
`binding` strategy from the execution context to resolve dependencies.
|
|
1253
1409
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1410
|
+
### Binding Modes:
|
|
1411
|
+
- `'auto'` (Default): **Lineage-Aware**. Uses late-binding only if the `rootRegistry`
|
|
1412
|
+
is a descendant of the tool's definition registry and has shadowed the dependency.
|
|
1413
|
+
Otherwise, uses early-binding for stability.
|
|
1414
|
+
- `'early'`: **Safety First**. Always prefers the pre-bound instance from `depends`.
|
|
1415
|
+
- `'late'`: **Forced Polymorphism**. Always resolves from the `rootRegistry`,
|
|
1416
|
+
ignoring the definer's environment.
|
|
1256
1417
|
|
|
1257
1418
|
#### Parameters
|
|
1258
1419
|
|
|
@@ -1260,19 +1421,29 @@ This is a convenience method that forwards the call to the static `runSync()` me
|
|
|
1260
1421
|
|
|
1261
1422
|
`string`
|
|
1262
1423
|
|
|
1263
|
-
The name of the target function to run.
|
|
1424
|
+
The name or alias of the target function to run.
|
|
1264
1425
|
|
|
1265
1426
|
##### params?
|
|
1266
1427
|
|
|
1267
1428
|
`any`
|
|
1268
1429
|
|
|
1269
|
-
Optional parameters to pass to the function.
|
|
1430
|
+
Optional parameters to pass to the target function.
|
|
1431
|
+
|
|
1432
|
+
##### ctx?
|
|
1433
|
+
|
|
1434
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1435
|
+
|
|
1436
|
+
The execution context.
|
|
1270
1437
|
|
|
1271
1438
|
#### Returns
|
|
1272
1439
|
|
|
1273
1440
|
`any`
|
|
1274
1441
|
|
|
1275
|
-
The result of the function execution.
|
|
1442
|
+
The result of the target function execution.
|
|
1443
|
+
|
|
1444
|
+
#### Throws
|
|
1445
|
+
|
|
1446
|
+
If the target function cannot be found in the current lineage.
|
|
1276
1447
|
|
|
1277
1448
|
#### Inherited from
|
|
1278
1449
|
|
|
@@ -1282,9 +1453,9 @@ The result of the function execution.
|
|
|
1282
1453
|
|
|
1283
1454
|
### runSync()
|
|
1284
1455
|
|
|
1285
|
-
> **runSync**(`params?`): `any`
|
|
1456
|
+
> **runSync**(`params?`, `ctx?`): `any`
|
|
1286
1457
|
|
|
1287
|
-
Defined in:
|
|
1458
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:814
|
|
1288
1459
|
|
|
1289
1460
|
Executes the function synchronously with a named parameters object.
|
|
1290
1461
|
|
|
@@ -1296,6 +1467,12 @@ Executes the function synchronously with a named parameters object.
|
|
|
1296
1467
|
|
|
1297
1468
|
The parameters object for the function.
|
|
1298
1469
|
|
|
1470
|
+
##### ctx?
|
|
1471
|
+
|
|
1472
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1473
|
+
|
|
1474
|
+
The execution context.
|
|
1475
|
+
|
|
1299
1476
|
#### Returns
|
|
1300
1477
|
|
|
1301
1478
|
`any`
|
|
@@ -1314,12 +1491,14 @@ Will throw an error if an array of parameters is passed to a function that expec
|
|
|
1314
1491
|
|
|
1315
1492
|
### runWithPos()
|
|
1316
1493
|
|
|
1317
|
-
> **runWithPos**(...`params`): `
|
|
1494
|
+
> **runWithPos**(...`params`): `any`
|
|
1318
1495
|
|
|
1319
|
-
Defined in:
|
|
1496
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:891
|
|
1320
1497
|
|
|
1321
1498
|
Executes the function asynchronously using positional arguments.
|
|
1322
|
-
|
|
1499
|
+
|
|
1500
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
1501
|
+
otherwise it may return the result synchronously.
|
|
1323
1502
|
|
|
1324
1503
|
#### Parameters
|
|
1325
1504
|
|
|
@@ -1331,9 +1510,9 @@ Positional arguments passed to the function.
|
|
|
1331
1510
|
|
|
1332
1511
|
#### Returns
|
|
1333
1512
|
|
|
1334
|
-
`
|
|
1513
|
+
`any`
|
|
1335
1514
|
|
|
1336
|
-
A promise
|
|
1515
|
+
A promise or the direct result of the function's execution.
|
|
1337
1516
|
|
|
1338
1517
|
#### Inherited from
|
|
1339
1518
|
|
|
@@ -1343,12 +1522,14 @@ A promise that resolves with the result of the function execution.
|
|
|
1343
1522
|
|
|
1344
1523
|
### runWithPosAs()
|
|
1345
1524
|
|
|
1346
|
-
> **runWithPosAs**(`name`, ...`params`): `
|
|
1525
|
+
> **runWithPosAs**(`name`, ...`params`): `any`
|
|
1347
1526
|
|
|
1348
|
-
Defined in:
|
|
1527
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:902
|
|
1349
1528
|
|
|
1350
1529
|
Asynchronously executes another function by name using positional arguments.
|
|
1351
|
-
|
|
1530
|
+
|
|
1531
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
1532
|
+
otherwise it may return the result synchronously.
|
|
1352
1533
|
|
|
1353
1534
|
#### Parameters
|
|
1354
1535
|
|
|
@@ -1366,9 +1547,9 @@ Positional arguments to pass to the function.
|
|
|
1366
1547
|
|
|
1367
1548
|
#### Returns
|
|
1368
1549
|
|
|
1369
|
-
`
|
|
1550
|
+
`any`
|
|
1370
1551
|
|
|
1371
|
-
A promise
|
|
1552
|
+
A promise or the direct result of the function's execution.
|
|
1372
1553
|
|
|
1373
1554
|
#### Inherited from
|
|
1374
1555
|
|
|
@@ -1380,7 +1561,7 @@ A promise that resolves with the result of the function execution.
|
|
|
1380
1561
|
|
|
1381
1562
|
> **runWithPosAsSync**(`name`, ...`params`): `any`
|
|
1382
1563
|
|
|
1383
|
-
Defined in:
|
|
1564
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:881
|
|
1384
1565
|
|
|
1385
1566
|
Synchronously executes another function by name using positional arguments.
|
|
1386
1567
|
This is a convenience wrapper around the static `runWithPosSync()` method.
|
|
@@ -1415,7 +1596,7 @@ The result of the function execution.
|
|
|
1415
1596
|
|
|
1416
1597
|
> **runWithPosSync**(...`params`): `any`
|
|
1417
1598
|
|
|
1418
|
-
Defined in:
|
|
1599
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:873
|
|
1419
1600
|
|
|
1420
1601
|
Executes the function synchronously using positional arguments.
|
|
1421
1602
|
If the function expects named parameters, it converts the arguments automatically.
|
|
@@ -1520,12 +1701,20 @@ Returns a string representation of an object.
|
|
|
1520
1701
|
|
|
1521
1702
|
### unregister()
|
|
1522
1703
|
|
|
1523
|
-
> **unregister**(): `any`
|
|
1704
|
+
> **unregister**(`options?`): `any`
|
|
1524
1705
|
|
|
1525
|
-
Defined in:
|
|
1706
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:763
|
|
1526
1707
|
|
|
1527
1708
|
Removes the current `ToolFunc` instance from the static registry.
|
|
1528
1709
|
|
|
1710
|
+
#### Parameters
|
|
1711
|
+
|
|
1712
|
+
##### options?
|
|
1713
|
+
|
|
1714
|
+
Unregistration options or a boolean force flag.
|
|
1715
|
+
|
|
1716
|
+
`boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
|
|
1717
|
+
|
|
1529
1718
|
#### Returns
|
|
1530
1719
|
|
|
1531
1720
|
`any`
|
|
@@ -1556,6 +1745,282 @@ Returns the primitive value of the specified object.
|
|
|
1556
1745
|
|
|
1557
1746
|
***
|
|
1558
1747
|
|
|
1748
|
+
### with()
|
|
1749
|
+
|
|
1750
|
+
> **with**(`ctx`): `this`
|
|
1751
|
+
|
|
1752
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:542
|
|
1753
|
+
|
|
1754
|
+
Returns an isolated instance with the provided context.
|
|
1755
|
+
|
|
1756
|
+
#### Parameters
|
|
1757
|
+
|
|
1758
|
+
##### ctx
|
|
1759
|
+
|
|
1760
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1761
|
+
|
|
1762
|
+
The context to use.
|
|
1763
|
+
|
|
1764
|
+
#### Returns
|
|
1765
|
+
|
|
1766
|
+
`this`
|
|
1767
|
+
|
|
1768
|
+
An isolated ToolFunc instance.
|
|
1769
|
+
|
|
1770
|
+
#### Inherited from
|
|
1771
|
+
|
|
1772
|
+
[`ToolFunc`](ToolFunc.md).[`with`](ToolFunc.md#with)
|
|
1773
|
+
|
|
1774
|
+
***
|
|
1775
|
+
|
|
1776
|
+
### \_acquireDependencies()
|
|
1777
|
+
|
|
1778
|
+
> `protected` `static` **\_acquireDependencies**(`inst`, `stack?`): `void`
|
|
1779
|
+
|
|
1780
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:740
|
|
1781
|
+
|
|
1782
|
+
#### Parameters
|
|
1783
|
+
|
|
1784
|
+
##### inst
|
|
1785
|
+
|
|
1786
|
+
[`ToolFunc`](ToolFunc.md)
|
|
1787
|
+
|
|
1788
|
+
##### stack?
|
|
1789
|
+
|
|
1790
|
+
`Set`\<`string`\>
|
|
1791
|
+
|
|
1792
|
+
#### Returns
|
|
1793
|
+
|
|
1794
|
+
`void`
|
|
1795
|
+
|
|
1796
|
+
#### Inherited from
|
|
1797
|
+
|
|
1798
|
+
[`ToolFunc`](ToolFunc.md).[`_acquireDependencies`](ToolFunc.md#_acquiredependencies)
|
|
1799
|
+
|
|
1800
|
+
***
|
|
1801
|
+
|
|
1802
|
+
### \_decRefCount()
|
|
1803
|
+
|
|
1804
|
+
> `protected` `static` **\_decRefCount**(`name`): `number`
|
|
1805
|
+
|
|
1806
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:739
|
|
1807
|
+
|
|
1808
|
+
#### Parameters
|
|
1809
|
+
|
|
1810
|
+
##### name
|
|
1811
|
+
|
|
1812
|
+
`string`
|
|
1813
|
+
|
|
1814
|
+
#### Returns
|
|
1815
|
+
|
|
1816
|
+
`number`
|
|
1817
|
+
|
|
1818
|
+
#### Inherited from
|
|
1819
|
+
|
|
1820
|
+
[`ToolFunc`](ToolFunc.md).[`_decRefCount`](ToolFunc.md#_decrefcount)
|
|
1821
|
+
|
|
1822
|
+
***
|
|
1823
|
+
|
|
1824
|
+
### \_getRegistrationAction()
|
|
1825
|
+
|
|
1826
|
+
> `protected` `static` **\_getRegistrationAction**(`name`, `override`): `"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
|
|
1827
|
+
|
|
1828
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:670
|
|
1829
|
+
|
|
1830
|
+
Analyzes the registration context and determines the appropriate action.
|
|
1831
|
+
|
|
1832
|
+
#### Parameters
|
|
1833
|
+
|
|
1834
|
+
##### name
|
|
1835
|
+
|
|
1836
|
+
`string`
|
|
1837
|
+
|
|
1838
|
+
The function name to register.
|
|
1839
|
+
|
|
1840
|
+
##### override
|
|
1841
|
+
|
|
1842
|
+
Override options.
|
|
1843
|
+
|
|
1844
|
+
###### name?
|
|
1845
|
+
|
|
1846
|
+
`boolean`
|
|
1847
|
+
|
|
1848
|
+
#### Returns
|
|
1849
|
+
|
|
1850
|
+
`"replace"` \| `"create"` \| `"shadow"` \| `"increment"`
|
|
1851
|
+
|
|
1852
|
+
The determined registration action.
|
|
1853
|
+
|
|
1854
|
+
#### Inherited from
|
|
1855
|
+
|
|
1856
|
+
[`ToolFunc`](ToolFunc.md).[`_getRegistrationAction`](ToolFunc.md#_getregistrationaction)
|
|
1857
|
+
|
|
1858
|
+
***
|
|
1859
|
+
|
|
1860
|
+
### \_incRefCount()
|
|
1861
|
+
|
|
1862
|
+
> `protected` `static` **\_incRefCount**(`name`): `void`
|
|
1863
|
+
|
|
1864
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:738
|
|
1865
|
+
|
|
1866
|
+
#### Parameters
|
|
1867
|
+
|
|
1868
|
+
##### name
|
|
1869
|
+
|
|
1870
|
+
`string`
|
|
1871
|
+
|
|
1872
|
+
#### Returns
|
|
1873
|
+
|
|
1874
|
+
`void`
|
|
1875
|
+
|
|
1876
|
+
#### Inherited from
|
|
1877
|
+
|
|
1878
|
+
[`ToolFunc`](ToolFunc.md).[`_incRefCount`](ToolFunc.md#_increfcount)
|
|
1879
|
+
|
|
1880
|
+
***
|
|
1881
|
+
|
|
1882
|
+
### \_normalizeArguments()
|
|
1883
|
+
|
|
1884
|
+
> `protected` `static` **\_normalizeArguments**(`name`, `options?`): `any`
|
|
1885
|
+
|
|
1886
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:643
|
|
1887
|
+
|
|
1888
|
+
**`Internal`**
|
|
1889
|
+
|
|
1890
|
+
Internal helper to normalize arguments from various input patterns.
|
|
1891
|
+
Priority: name (arg1) > options (arg2).
|
|
1892
|
+
|
|
1893
|
+
#### Parameters
|
|
1894
|
+
|
|
1895
|
+
##### name
|
|
1896
|
+
|
|
1897
|
+
Primary config.
|
|
1898
|
+
|
|
1899
|
+
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`FuncItem`](../interfaces/FuncItem.md)
|
|
1900
|
+
|
|
1901
|
+
##### options?
|
|
1902
|
+
|
|
1903
|
+
`any`
|
|
1904
|
+
|
|
1905
|
+
Default config.
|
|
1906
|
+
|
|
1907
|
+
#### Returns
|
|
1908
|
+
|
|
1909
|
+
`any`
|
|
1910
|
+
|
|
1911
|
+
Normalized options object.
|
|
1912
|
+
|
|
1913
|
+
#### Inherited from
|
|
1914
|
+
|
|
1915
|
+
[`ToolFunc`](ToolFunc.md).[`_normalizeArguments`](ToolFunc.md#_normalizearguments)
|
|
1916
|
+
|
|
1917
|
+
***
|
|
1918
|
+
|
|
1919
|
+
### \_normalizeRegisterArguments()
|
|
1920
|
+
|
|
1921
|
+
> `protected` `static` **\_normalizeRegisterArguments**(`name`, `options?`): [`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
1922
|
+
|
|
1923
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:682
|
|
1924
|
+
|
|
1925
|
+
**`Internal`**
|
|
1926
|
+
|
|
1927
|
+
Normalizes the arguments passed to the `register` method into a unified `RegisterOptions` object.
|
|
1928
|
+
|
|
1929
|
+
#### Parameters
|
|
1930
|
+
|
|
1931
|
+
##### name
|
|
1932
|
+
|
|
1933
|
+
The primary identification or implementation.
|
|
1934
|
+
|
|
1935
|
+
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
1936
|
+
|
|
1937
|
+
##### options?
|
|
1938
|
+
|
|
1939
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
1940
|
+
|
|
1941
|
+
Additional or overriding configuration.
|
|
1942
|
+
|
|
1943
|
+
#### Returns
|
|
1944
|
+
|
|
1945
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
1946
|
+
|
|
1947
|
+
A normalized options object ready for registration.
|
|
1948
|
+
|
|
1949
|
+
#### Inherited from
|
|
1950
|
+
|
|
1951
|
+
[`ToolFunc`](ToolFunc.md).[`_normalizeRegisterArguments`](ToolFunc.md#_normalizeregisterarguments)
|
|
1952
|
+
|
|
1953
|
+
***
|
|
1954
|
+
|
|
1955
|
+
### \_prepareContext()
|
|
1956
|
+
|
|
1957
|
+
> `static` **\_prepareContext**(`parentCtx?`, `ctx?`): [`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1958
|
+
|
|
1959
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:535
|
|
1960
|
+
|
|
1961
|
+
**`Internal`**
|
|
1962
|
+
|
|
1963
|
+
Internal helper to prepare the execution context, maintaining the prototype chain.
|
|
1964
|
+
|
|
1965
|
+
#### Parameters
|
|
1966
|
+
|
|
1967
|
+
##### parentCtx?
|
|
1968
|
+
|
|
1969
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1970
|
+
|
|
1971
|
+
The parent context to inherit from.
|
|
1972
|
+
|
|
1973
|
+
##### ctx?
|
|
1974
|
+
|
|
1975
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1976
|
+
|
|
1977
|
+
The new context properties to apply.
|
|
1978
|
+
|
|
1979
|
+
#### Returns
|
|
1980
|
+
|
|
1981
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
1982
|
+
|
|
1983
|
+
The merged context.
|
|
1984
|
+
|
|
1985
|
+
DANGER - DO NOT "OPTIMIZE" UNLESS YOU UNDERSTAND:
|
|
1986
|
+
1. Why NOT Object.assign(target, ctx) alone?
|
|
1987
|
+
Object.assign only copies 'own' properties. In nested calls (e.g., .with().with()),
|
|
1988
|
+
parent properties exist on the prototype. Using assign would drop all inherited
|
|
1989
|
+
context data (like traceId from a parent runner).
|
|
1990
|
+
2. Why NOT Object.setPrototypeOf?
|
|
1991
|
+
It's a heavy performance killer in V8. We use Object.create(proto) instead.
|
|
1992
|
+
3. Why check isPrototypeOf?
|
|
1993
|
+
If ctx is already in the chain, we return it to maintain identity and avoid
|
|
1994
|
+
redundant shadow layers, which is required by many AOP plugins and unit tests.
|
|
1995
|
+
|
|
1996
|
+
#### Inherited from
|
|
1997
|
+
|
|
1998
|
+
[`ToolFunc`](ToolFunc.md).[`_prepareContext`](ToolFunc.md#_preparecontext-2)
|
|
1999
|
+
|
|
2000
|
+
***
|
|
2001
|
+
|
|
2002
|
+
### \_releaseDependencies()
|
|
2003
|
+
|
|
2004
|
+
> `protected` `static` **\_releaseDependencies**(`inst`): `void`
|
|
2005
|
+
|
|
2006
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:741
|
|
2007
|
+
|
|
2008
|
+
#### Parameters
|
|
2009
|
+
|
|
2010
|
+
##### inst
|
|
2011
|
+
|
|
2012
|
+
[`ToolFunc`](ToolFunc.md)
|
|
2013
|
+
|
|
2014
|
+
#### Returns
|
|
2015
|
+
|
|
2016
|
+
`void`
|
|
2017
|
+
|
|
2018
|
+
#### Inherited from
|
|
2019
|
+
|
|
2020
|
+
[`ToolFunc`](ToolFunc.md).[`_releaseDependencies`](ToolFunc.md#_releasedependencies)
|
|
2021
|
+
|
|
2022
|
+
***
|
|
2023
|
+
|
|
1559
2024
|
### assign()
|
|
1560
2025
|
|
|
1561
2026
|
#### Call Signature
|
|
@@ -1744,6 +2209,27 @@ One or more source objects from which to copy properties
|
|
|
1744
2209
|
|
|
1745
2210
|
***
|
|
1746
2211
|
|
|
2212
|
+
### clear()
|
|
2213
|
+
|
|
2214
|
+
> `static` **clear**(): `void`
|
|
2215
|
+
|
|
2216
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:661
|
|
2217
|
+
|
|
2218
|
+
Resets the local registry by clearing all registered items, aliases, and reference counts.
|
|
2219
|
+
|
|
2220
|
+
In a hierarchical registry, this only clears properties "owned" by the current
|
|
2221
|
+
layer. Inherited items from parent registries remain visible through the prototype chain.
|
|
2222
|
+
|
|
2223
|
+
#### Returns
|
|
2224
|
+
|
|
2225
|
+
`void`
|
|
2226
|
+
|
|
2227
|
+
#### Inherited from
|
|
2228
|
+
|
|
2229
|
+
[`ToolFunc`](ToolFunc.md).[`clear`](ToolFunc.md#clear)
|
|
2230
|
+
|
|
2231
|
+
***
|
|
2232
|
+
|
|
1747
2233
|
### create()
|
|
1748
2234
|
|
|
1749
2235
|
#### Call Signature
|
|
@@ -1760,7 +2246,7 @@ Creates an object that has the specified prototype or that has null prototype.
|
|
|
1760
2246
|
|
|
1761
2247
|
Object to use as a prototype. May be null.
|
|
1762
2248
|
|
|
1763
|
-
`
|
|
2249
|
+
`object` | `null`
|
|
1764
2250
|
|
|
1765
2251
|
##### Returns
|
|
1766
2252
|
|
|
@@ -1784,7 +2270,7 @@ Creates an object that has the specified prototype, and that optionally contains
|
|
|
1784
2270
|
|
|
1785
2271
|
Object to use as a prototype. May be null
|
|
1786
2272
|
|
|
1787
|
-
`
|
|
2273
|
+
`object` | `null`
|
|
1788
2274
|
|
|
1789
2275
|
###### properties
|
|
1790
2276
|
|
|
@@ -2094,7 +2580,7 @@ An iterable object that contains key-value entries for properties and methods.
|
|
|
2094
2580
|
|
|
2095
2581
|
> `static` **get**(`name`): [`ToolFunc`](ToolFunc.md)
|
|
2096
2582
|
|
|
2097
|
-
Defined in:
|
|
2583
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:553
|
|
2098
2584
|
|
|
2099
2585
|
Retrieves a registered function by its name or alias.
|
|
2100
2586
|
|
|
@@ -2122,7 +2608,7 @@ The `ToolFunc` instance if found, otherwise `undefined`.
|
|
|
2122
2608
|
|
|
2123
2609
|
> `static` **getAllByTag**(`tagName`): [`ToolFunc`](ToolFunc.md)[]
|
|
2124
2610
|
|
|
2125
|
-
Defined in:
|
|
2611
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:570
|
|
2126
2612
|
|
|
2127
2613
|
Retrieves all registered functions that have a specific tag.
|
|
2128
2614
|
|
|
@@ -2148,9 +2634,9 @@ An array of matching `ToolFunc` instances.
|
|
|
2148
2634
|
|
|
2149
2635
|
### getByTag()
|
|
2150
2636
|
|
|
2151
|
-
> `static` **getByTag**(`tagName`):
|
|
2637
|
+
> `static` **getByTag**(`tagName`): [`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
2152
2638
|
|
|
2153
|
-
Defined in:
|
|
2639
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:564
|
|
2154
2640
|
|
|
2155
2641
|
Finds the first registered function that has a specific tag.
|
|
2156
2642
|
|
|
@@ -2164,7 +2650,7 @@ The tag to search for.
|
|
|
2164
2650
|
|
|
2165
2651
|
#### Returns
|
|
2166
2652
|
|
|
2167
|
-
|
|
2653
|
+
[`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
2168
2654
|
|
|
2169
2655
|
The first matching `ToolFunc` instance, or `undefined` if none is found.
|
|
2170
2656
|
|
|
@@ -2178,7 +2664,7 @@ The first matching `ToolFunc` instance, or `undefined` if none is found.
|
|
|
2178
2664
|
|
|
2179
2665
|
> `static` **getFunc**(`name`): `any`
|
|
2180
2666
|
|
|
2181
|
-
Defined in:
|
|
2667
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:605
|
|
2182
2668
|
|
|
2183
2669
|
Retrieves a bound, runnable function reference for a registered function.
|
|
2184
2670
|
This reference is suitable for execution with an object of named parameters.
|
|
@@ -2207,7 +2693,7 @@ A bound function reference, or `undefined` if not found.
|
|
|
2207
2693
|
|
|
2208
2694
|
> `static` **getFuncWithPos**(`name`): `any`
|
|
2209
2695
|
|
|
2210
|
-
Defined in:
|
|
2696
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:632
|
|
2211
2697
|
|
|
2212
2698
|
Retrieves a bound, runnable function reference for a registered function.
|
|
2213
2699
|
This reference is suitable for execution with positional arguments.
|
|
@@ -2234,7 +2720,7 @@ A bound function reference, or `undefined` if not found.
|
|
|
2234
2720
|
|
|
2235
2721
|
### getOwnPropertyDescriptor()
|
|
2236
2722
|
|
|
2237
|
-
> `static` **getOwnPropertyDescriptor**(`o`, `p`): `
|
|
2723
|
+
> `static` **getOwnPropertyDescriptor**(`o`, `p`): `PropertyDescriptor` \| `undefined`
|
|
2238
2724
|
|
|
2239
2725
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/typescript/lib/lib.es5.d.ts:175
|
|
2240
2726
|
|
|
@@ -2257,7 +2743,7 @@ Name of the property.
|
|
|
2257
2743
|
|
|
2258
2744
|
#### Returns
|
|
2259
2745
|
|
|
2260
|
-
`
|
|
2746
|
+
`PropertyDescriptor` \| `undefined`
|
|
2261
2747
|
|
|
2262
2748
|
#### Inherited from
|
|
2263
2749
|
|
|
@@ -2398,7 +2884,7 @@ The object that references the prototype.
|
|
|
2398
2884
|
|
|
2399
2885
|
> `static` **hasAsyncFeature**(`feature`): `boolean`
|
|
2400
2886
|
|
|
2401
|
-
Defined in:
|
|
2887
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:576
|
|
2402
2888
|
|
|
2403
2889
|
Checks if any registered function has a specific asynchronous feature.
|
|
2404
2890
|
|
|
@@ -2538,6 +3024,37 @@ Object to test.
|
|
|
2538
3024
|
|
|
2539
3025
|
***
|
|
2540
3026
|
|
|
3027
|
+
### isolateRegistry()
|
|
3028
|
+
|
|
3029
|
+
> `static` **isolateRegistry**(`options?`): `void`
|
|
3030
|
+
|
|
3031
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:654
|
|
3032
|
+
|
|
3033
|
+
Isolates the current registry layer by branching off its parent using prototype shadowing.
|
|
3034
|
+
|
|
3035
|
+
This creates a new "scope" where:
|
|
3036
|
+
1. New registrations are stored only in the local layer, supporting tool shadowing.
|
|
3037
|
+
2. Parent tools remain accessible via the prototype chain (read-only) unless shadowed.
|
|
3038
|
+
3. Reference counting is isolated, enabling clean per-layer lifecycle management.
|
|
3039
|
+
|
|
3040
|
+
#### Parameters
|
|
3041
|
+
|
|
3042
|
+
##### options?
|
|
3043
|
+
|
|
3044
|
+
[`ToolFuncRegistryIsolateOptions`](../interfaces/ToolFuncRegistryIsolateOptions.md)
|
|
3045
|
+
|
|
3046
|
+
Options to selectively isolate specific maps (items, aliases, refCounts).
|
|
3047
|
+
|
|
3048
|
+
#### Returns
|
|
3049
|
+
|
|
3050
|
+
`void`
|
|
3051
|
+
|
|
3052
|
+
#### Inherited from
|
|
3053
|
+
|
|
3054
|
+
[`ToolFunc`](ToolFunc.md).[`isolateRegistry`](ToolFunc.md#isolateregistry)
|
|
3055
|
+
|
|
3056
|
+
***
|
|
3057
|
+
|
|
2541
3058
|
### isSealed()
|
|
2542
3059
|
|
|
2543
3060
|
> `static` **isSealed**(`o`): `boolean`
|
|
@@ -2618,7 +3135,7 @@ Object that contains the properties and methods. This can be an object that you
|
|
|
2618
3135
|
|
|
2619
3136
|
> `static` **list**(): [`Funcs`](../interfaces/Funcs.md)
|
|
2620
3137
|
|
|
2621
|
-
Defined in:
|
|
3138
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:558
|
|
2622
3139
|
|
|
2623
3140
|
Returns the complete map of all registered functions.
|
|
2624
3141
|
|
|
@@ -2672,9 +3189,24 @@ Object to make non-extensible.
|
|
|
2672
3189
|
|
|
2673
3190
|
> `static` **register**(`name`, `options`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2674
3191
|
|
|
2675
|
-
Defined in:
|
|
3192
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:718
|
|
3193
|
+
|
|
3194
|
+
**`Internal`**
|
|
3195
|
+
|
|
3196
|
+
Registers a `ToolFunc` instance into the registry.
|
|
3197
|
+
|
|
3198
|
+
This method supports multiple overloads and handles hierarchical registration,
|
|
3199
|
+
alias collision protection, and automatic dependency registration with cycle detection.
|
|
2676
3200
|
|
|
2677
|
-
|
|
3201
|
+
### Hierarchical Behavior:
|
|
3202
|
+
- In an isolated registry, items are stored locally, shadowing parent items with the same name.
|
|
3203
|
+
- Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
|
|
3204
|
+
unless `allowOverride.alias` is explicitly granted.
|
|
3205
|
+
|
|
3206
|
+
### Circular Dependencies:
|
|
3207
|
+
Automatically detects and manages circular dependency chains using an internal stack.
|
|
3208
|
+
Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
|
|
3209
|
+
and enable clean group unregistration.
|
|
2678
3210
|
|
|
2679
3211
|
##### Parameters
|
|
2680
3212
|
|
|
@@ -2682,19 +3214,38 @@ Registers a new tool function.
|
|
|
2682
3214
|
|
|
2683
3215
|
`string`
|
|
2684
3216
|
|
|
2685
|
-
The name
|
|
3217
|
+
The tool instance, function, or name to register.
|
|
2686
3218
|
|
|
2687
3219
|
###### options
|
|
2688
3220
|
|
|
2689
|
-
[`
|
|
3221
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2690
3222
|
|
|
2691
|
-
|
|
3223
|
+
Configuration or implementation for the tool.
|
|
2692
3224
|
|
|
2693
3225
|
##### Returns
|
|
2694
3226
|
|
|
2695
3227
|
`boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2696
3228
|
|
|
2697
|
-
The
|
|
3229
|
+
The registered ToolFunc instance on success (creation, shadowing, or override),
|
|
3230
|
+
or `false` if registration was ignored (e.g., ref-count increment only).
|
|
3231
|
+
|
|
3232
|
+
##### Example
|
|
3233
|
+
|
|
3234
|
+
```ts
|
|
3235
|
+
// 1. Registering with explicit name and function
|
|
3236
|
+
ToolFunc.register('add', { func: (a, b) => a + b });
|
|
3237
|
+
|
|
3238
|
+
// 2. Registering with shadowing permission in an isolated registry
|
|
3239
|
+
MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
|
|
3240
|
+
|
|
3241
|
+
// 3. Registering an existing ToolFunc instance
|
|
3242
|
+
const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
|
|
3243
|
+
ToolFunc.register(tool);
|
|
3244
|
+
```
|
|
3245
|
+
|
|
3246
|
+
##### Throws
|
|
3247
|
+
|
|
3248
|
+
If name is missing, or if an alias collision occurs without permission.
|
|
2698
3249
|
|
|
2699
3250
|
##### Inherited from
|
|
2700
3251
|
|
|
@@ -2704,9 +3255,24 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
|
|
|
2704
3255
|
|
|
2705
3256
|
> `static` **register**(`func`, `options`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2706
3257
|
|
|
2707
|
-
Defined in:
|
|
3258
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:719
|
|
3259
|
+
|
|
3260
|
+
**`Internal`**
|
|
3261
|
+
|
|
3262
|
+
Registers a `ToolFunc` instance into the registry.
|
|
2708
3263
|
|
|
2709
|
-
|
|
3264
|
+
This method supports multiple overloads and handles hierarchical registration,
|
|
3265
|
+
alias collision protection, and automatic dependency registration with cycle detection.
|
|
3266
|
+
|
|
3267
|
+
### Hierarchical Behavior:
|
|
3268
|
+
- In an isolated registry, items are stored locally, shadowing parent items with the same name.
|
|
3269
|
+
- Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
|
|
3270
|
+
unless `allowOverride.alias` is explicitly granted.
|
|
3271
|
+
|
|
3272
|
+
### Circular Dependencies:
|
|
3273
|
+
Automatically detects and manages circular dependency chains using an internal stack.
|
|
3274
|
+
Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
|
|
3275
|
+
and enable clean group unregistration.
|
|
2710
3276
|
|
|
2711
3277
|
##### Parameters
|
|
2712
3278
|
|
|
@@ -2714,19 +3280,36 @@ Registers a new tool function.
|
|
|
2714
3280
|
|
|
2715
3281
|
`Function`
|
|
2716
3282
|
|
|
2717
|
-
The function implementation.
|
|
2718
|
-
|
|
2719
3283
|
###### options
|
|
2720
3284
|
|
|
2721
|
-
[`
|
|
3285
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2722
3286
|
|
|
2723
|
-
|
|
3287
|
+
Configuration or implementation for the tool.
|
|
2724
3288
|
|
|
2725
3289
|
##### Returns
|
|
2726
3290
|
|
|
2727
3291
|
`boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2728
3292
|
|
|
2729
|
-
The
|
|
3293
|
+
The registered ToolFunc instance on success (creation, shadowing, or override),
|
|
3294
|
+
or `false` if registration was ignored (e.g., ref-count increment only).
|
|
3295
|
+
|
|
3296
|
+
##### Example
|
|
3297
|
+
|
|
3298
|
+
```ts
|
|
3299
|
+
// 1. Registering with explicit name and function
|
|
3300
|
+
ToolFunc.register('add', { func: (a, b) => a + b });
|
|
3301
|
+
|
|
3302
|
+
// 2. Registering with shadowing permission in an isolated registry
|
|
3303
|
+
MyPluginTools.register('calc', { func: () => 2 }, { allowOverride: true });
|
|
3304
|
+
|
|
3305
|
+
// 3. Registering an existing ToolFunc instance
|
|
3306
|
+
const tool = new ToolFunc({ name: 'my-tool', func: () => 'ok' });
|
|
3307
|
+
ToolFunc.register(tool);
|
|
3308
|
+
```
|
|
3309
|
+
|
|
3310
|
+
##### Throws
|
|
3311
|
+
|
|
3312
|
+
If name is missing, or if an alias collision occurs without permission.
|
|
2730
3313
|
|
|
2731
3314
|
##### Inherited from
|
|
2732
3315
|
|
|
@@ -2734,31 +3317,71 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
|
|
|
2734
3317
|
|
|
2735
3318
|
#### Call Signature
|
|
2736
3319
|
|
|
2737
|
-
> `static` **register**(`name`, `options?`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
3320
|
+
> `static` **register**(`name`, `options?`, `_stack?`): `boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
3321
|
+
|
|
3322
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:720
|
|
2738
3323
|
|
|
2739
|
-
|
|
3324
|
+
**`Internal`**
|
|
2740
3325
|
|
|
2741
|
-
Registers a
|
|
3326
|
+
Registers a `ToolFunc` instance into the registry.
|
|
3327
|
+
|
|
3328
|
+
This method supports multiple overloads and handles hierarchical registration,
|
|
3329
|
+
alias collision protection, and automatic dependency registration with cycle detection.
|
|
3330
|
+
|
|
3331
|
+
### Hierarchical Behavior:
|
|
3332
|
+
- In an isolated registry, items are stored locally, shadowing parent items with the same name.
|
|
3333
|
+
- Alias consistency is enforced across the hierarchy: registering a colliding alias throws an error
|
|
3334
|
+
unless `allowOverride.alias` is explicitly granted.
|
|
3335
|
+
|
|
3336
|
+
### Circular Dependencies:
|
|
3337
|
+
Automatically detects and manages circular dependency chains using an internal stack.
|
|
3338
|
+
Reference counts are precisely managed (count=1 for back-edges) to prevent memory leaks
|
|
3339
|
+
and enable clean group unregistration.
|
|
2742
3340
|
|
|
2743
3341
|
##### Parameters
|
|
2744
3342
|
|
|
2745
3343
|
###### name
|
|
2746
3344
|
|
|
2747
|
-
The name
|
|
3345
|
+
The tool instance, function, or name to register.
|
|
2748
3346
|
|
|
2749
|
-
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`
|
|
3347
|
+
`string` | `Function` | [`ToolFunc`](ToolFunc.md) | [`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
2750
3348
|
|
|
2751
3349
|
###### options?
|
|
2752
3350
|
|
|
2753
|
-
[`
|
|
3351
|
+
[`RegisterOptions`](../interfaces/RegisterOptions.md)
|
|
3352
|
+
|
|
3353
|
+
Configuration or implementation for the tool.
|
|
2754
3354
|
|
|
2755
|
-
|
|
3355
|
+
###### \_stack?
|
|
3356
|
+
|
|
3357
|
+
`Set`\<`string`\>
|
|
3358
|
+
|
|
3359
|
+
Used for cycle detection during recursive registration.
|
|
2756
3360
|
|
|
2757
3361
|
##### Returns
|
|
2758
3362
|
|
|
2759
3363
|
`boolean` \| [`ToolFunc`](ToolFunc.md)
|
|
2760
3364
|
|
|
2761
|
-
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.
|
|
2762
3385
|
|
|
2763
3386
|
##### Inherited from
|
|
2764
3387
|
|
|
@@ -2768,12 +3391,15 @@ The new `ToolFunc` instance, or `false` if a function with that name already exi
|
|
|
2768
3391
|
|
|
2769
3392
|
### run()
|
|
2770
3393
|
|
|
2771
|
-
> `static` **run**(`name`, `params?`): `
|
|
3394
|
+
> `static` **run**(`name`, `params?`, `ctx?`): `any`
|
|
2772
3395
|
|
|
2773
|
-
Defined in:
|
|
3396
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:589
|
|
2774
3397
|
|
|
2775
3398
|
Asynchronously executes a registered function by name with named parameters.
|
|
2776
3399
|
|
|
3400
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
3401
|
+
otherwise it may return the result synchronously.
|
|
3402
|
+
|
|
2777
3403
|
#### Parameters
|
|
2778
3404
|
|
|
2779
3405
|
##### name
|
|
@@ -2788,11 +3414,17 @@ The name of the function to run.
|
|
|
2788
3414
|
|
|
2789
3415
|
The parameters object for the function.
|
|
2790
3416
|
|
|
3417
|
+
##### ctx?
|
|
3418
|
+
|
|
3419
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
3420
|
+
|
|
3421
|
+
The execution context.
|
|
3422
|
+
|
|
2791
3423
|
#### Returns
|
|
2792
3424
|
|
|
2793
|
-
`
|
|
3425
|
+
`any`
|
|
2794
3426
|
|
|
2795
|
-
A promise
|
|
3427
|
+
A promise or the direct result of the function's execution.
|
|
2796
3428
|
|
|
2797
3429
|
#### Throws
|
|
2798
3430
|
|
|
@@ -2806,9 +3438,9 @@ If the function with the given name is not found.
|
|
|
2806
3438
|
|
|
2807
3439
|
### runSync()
|
|
2808
3440
|
|
|
2809
|
-
> `static` **runSync**(`name`, `params?`): `any`
|
|
3441
|
+
> `static` **runSync**(`name`, `params?`, `ctx?`): `any`
|
|
2810
3442
|
|
|
2811
|
-
Defined in:
|
|
3443
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:598
|
|
2812
3444
|
|
|
2813
3445
|
Synchronously executes a registered function by name with named parameters.
|
|
2814
3446
|
|
|
@@ -2826,6 +3458,12 @@ The name of the function to run.
|
|
|
2826
3458
|
|
|
2827
3459
|
The parameters object for the function.
|
|
2828
3460
|
|
|
3461
|
+
##### ctx?
|
|
3462
|
+
|
|
3463
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
3464
|
+
|
|
3465
|
+
The execution context.
|
|
3466
|
+
|
|
2829
3467
|
#### Returns
|
|
2830
3468
|
|
|
2831
3469
|
`any`
|
|
@@ -2844,12 +3482,15 @@ If the function with the given name is not found.
|
|
|
2844
3482
|
|
|
2845
3483
|
### runWithPos()
|
|
2846
3484
|
|
|
2847
|
-
> `static` **runWithPos**(`name`, ...`params`): `
|
|
3485
|
+
> `static` **runWithPos**(`name`, ...`params`): `any`
|
|
2848
3486
|
|
|
2849
|
-
Defined in:
|
|
3487
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:617
|
|
2850
3488
|
|
|
2851
3489
|
Asynchronously executes a function using positional arguments.
|
|
2852
3490
|
|
|
3491
|
+
Note: This method returns a `Promise` if the underlying function is asynchronous,
|
|
3492
|
+
otherwise it may return the result synchronously.
|
|
3493
|
+
|
|
2853
3494
|
#### Parameters
|
|
2854
3495
|
|
|
2855
3496
|
##### name
|
|
@@ -2866,9 +3507,9 @@ Positional arguments to pass to the function.
|
|
|
2866
3507
|
|
|
2867
3508
|
#### Returns
|
|
2868
3509
|
|
|
2869
|
-
`
|
|
3510
|
+
`any`
|
|
2870
3511
|
|
|
2871
|
-
A promise
|
|
3512
|
+
A promise or the direct result of the function's execution.
|
|
2872
3513
|
|
|
2873
3514
|
#### Throws
|
|
2874
3515
|
|
|
@@ -2884,7 +3525,7 @@ If the function with the given name is not found.
|
|
|
2884
3525
|
|
|
2885
3526
|
> `static` **runWithPosSync**(`name`, ...`params`): `any`
|
|
2886
3527
|
|
|
2887
|
-
Defined in:
|
|
3528
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:625
|
|
2888
3529
|
|
|
2889
3530
|
Synchronously executes a function using positional arguments.
|
|
2890
3531
|
|
|
@@ -2970,7 +3611,7 @@ The object to change its prototype.
|
|
|
2970
3611
|
|
|
2971
3612
|
The value of the new prototype or null.
|
|
2972
3613
|
|
|
2973
|
-
`
|
|
3614
|
+
`object` | `null`
|
|
2974
3615
|
|
|
2975
3616
|
#### Returns
|
|
2976
3617
|
|
|
@@ -2984,25 +3625,34 @@ The value of the new prototype or null.
|
|
|
2984
3625
|
|
|
2985
3626
|
### unregister()
|
|
2986
3627
|
|
|
2987
|
-
> `static` **unregister**(`
|
|
3628
|
+
> `static` **unregister**(`target`, `options?`): [`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
3629
|
+
|
|
3630
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:737
|
|
2988
3631
|
|
|
2989
|
-
|
|
3632
|
+
Unregisters a tool function implementation from the registry by its name, alias, or instance.
|
|
2990
3633
|
|
|
2991
|
-
|
|
3634
|
+
This method supports hierarchical unregistration. If a function's reference count
|
|
3635
|
+
reaches zero, it is physically removed from the registry and its dependencies are released.
|
|
2992
3636
|
|
|
2993
3637
|
#### Parameters
|
|
2994
3638
|
|
|
2995
|
-
#####
|
|
3639
|
+
##### target
|
|
2996
3640
|
|
|
2997
|
-
|
|
3641
|
+
The name, alias, or implementation instance.
|
|
3642
|
+
|
|
3643
|
+
`string` | [`ToolFunc`](ToolFunc.md)
|
|
3644
|
+
|
|
3645
|
+
##### options?
|
|
2998
3646
|
|
|
2999
|
-
|
|
3647
|
+
Options or a simple 'force' boolean flag.
|
|
3648
|
+
|
|
3649
|
+
`boolean` | [`UnregisterOptions`](../interfaces/UnregisterOptions.md)
|
|
3000
3650
|
|
|
3001
3651
|
#### Returns
|
|
3002
3652
|
|
|
3003
|
-
|
|
3653
|
+
[`ToolFunc`](ToolFunc.md) \| `undefined`
|
|
3004
3654
|
|
|
3005
|
-
The unregistered
|
|
3655
|
+
The unregistered ToolFunc instance, or `undefined` if not found.
|
|
3006
3656
|
|
|
3007
3657
|
#### Inherited from
|
|
3008
3658
|
|
|
@@ -3063,3 +3713,31 @@ Object that contains the properties and methods. This can be an object that you
|
|
|
3063
3713
|
##### Inherited from
|
|
3064
3714
|
|
|
3065
3715
|
[`ToolFunc`](ToolFunc.md).[`values`](ToolFunc.md#values)
|
|
3716
|
+
|
|
3717
|
+
***
|
|
3718
|
+
|
|
3719
|
+
### with()
|
|
3720
|
+
|
|
3721
|
+
> `static` **with**(`ctx`): *typeof* [`ToolFunc`](ToolFunc.md)
|
|
3722
|
+
|
|
3723
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:515
|
|
3724
|
+
|
|
3725
|
+
Returns a static proxy with the provided context.
|
|
3726
|
+
|
|
3727
|
+
#### Parameters
|
|
3728
|
+
|
|
3729
|
+
##### ctx
|
|
3730
|
+
|
|
3731
|
+
[`ToolFuncContext`](../interfaces/ToolFuncContext.md)
|
|
3732
|
+
|
|
3733
|
+
The context to use.
|
|
3734
|
+
|
|
3735
|
+
#### Returns
|
|
3736
|
+
|
|
3737
|
+
*typeof* [`ToolFunc`](ToolFunc.md)
|
|
3738
|
+
|
|
3739
|
+
A static proxy of ToolFunc class.
|
|
3740
|
+
|
|
3741
|
+
#### Inherited from
|
|
3742
|
+
|
|
3743
|
+
[`ToolFunc`](ToolFunc.md).[`with`](ToolFunc.md#with-2)
|