@isdk/ai-tool 0.7.0 → 0.8.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-4FKBOPZI.mjs +1 -0
- package/dist/{chunk-VIG2GB47.mjs → chunk-TGTHY57V.mjs} +1 -1
- package/dist/funcs.d.mts +1 -2
- package/dist/funcs.d.ts +1 -2
- package/dist/funcs.js +1 -1
- package/dist/funcs.mjs +1 -1
- package/dist/{index-BCco-g_I.d.mts → index-BLW3R7VS.d.mts} +114 -69
- package/dist/{index-BCco-g_I.d.ts → index-BLW3R7VS.d.ts} +114 -69
- package/dist/index.d.mts +101 -38
- package/dist/index.d.ts +101 -38
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test/util.js +1 -1
- package/dist/test/util.mjs +1 -1
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/README.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/ABORT.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/CONTINUE.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/DONE.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/STOPPED.md +2 -2
- package/docs/api/@isdk/namespaces/uuidv5/README.md +12 -0
- package/docs/api/{namespaces → @isdk/namespaces}/uuidv5/variables/DNS.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/uuidv5/variables/URL.md +2 -2
- package/docs/api/_media/pubsub.md +427 -105
- package/docs/api/_media/server_client_tools.md +5 -3
- package/docs/api/_media/toolFunc.md +3 -1
- package/docs/api/classes/AbortError.md +8 -8
- package/docs/api/classes/AlreadyExistsError.md +8 -8
- package/docs/api/classes/BaseError.md +14 -14
- package/docs/api/classes/BinarySemaphore.md +39 -39
- package/docs/api/classes/CancelableAbility.md +43 -39
- package/docs/api/classes/ClientToolTransport.md +22 -22
- package/docs/api/classes/ClientTools.md +182 -154
- package/docs/api/classes/CommonError.md +12 -12
- package/docs/api/classes/ConfigFile.md +6 -6
- package/docs/api/classes/EnvPromptTemplate.md +14 -14
- package/docs/api/classes/EventClient.md +258 -201
- package/docs/api/classes/EventEmitter.md +14 -14
- package/docs/api/classes/EventServer.md +220 -237
- package/docs/api/classes/EventToolFunc.md +144 -116
- package/docs/api/classes/FStringPromptTemplate.md +14 -14
- package/docs/api/classes/FewShotPromptTemplate.md +30 -26
- package/docs/api/classes/GolangPromptTemplate.md +13 -13
- package/docs/api/classes/HttpClientToolTransport.md +23 -23
- package/docs/api/classes/HttpServerToolTransport.md +40 -27
- package/docs/api/classes/IntSet.md +21 -21
- package/docs/api/classes/LRUCache.md +18 -18
- package/docs/api/classes/NotFoundError.md +8 -8
- package/docs/api/classes/NotImplementationError.md +8 -8
- package/docs/api/classes/PromptExampleSelector.md +17 -15
- package/docs/api/classes/PromptTemplate.md +15 -15
- package/docs/api/classes/ReadableStreamError.md +12 -12
- package/docs/api/classes/ResClientTools.md +658 -143
- package/docs/api/classes/ResServerTools.md +643 -133
- package/docs/api/classes/RpcMethodsClientTool.md +3303 -0
- package/docs/api/classes/RpcMethodsServerTool.md +3248 -0
- package/docs/api/classes/SSEChannel.md +142 -52
- package/docs/api/classes/Semaphore.md +40 -40
- package/docs/api/classes/ServerToolTransport.md +32 -27
- package/docs/api/classes/ServerTools.md +167 -139
- package/docs/api/classes/SignalGate.md +19 -17
- package/docs/api/classes/SseClientPubSubTransport.md +38 -10
- package/docs/api/classes/SseServerPubSubTransport.md +115 -42
- package/docs/api/classes/TaskAbortController.md +13 -13
- package/docs/api/classes/ToolFunc.md +157 -129
- package/docs/api/classes/ToolTransport.md +13 -13
- package/docs/api/classes/YamlTypeBaseObject.md +5 -5
- package/docs/api/enumerations/AsyncFeatureBits.md +4 -4
- package/docs/api/enumerations/AsyncFeatures.md +4 -4
- package/docs/api/enumerations/HashAlgorithm.md +12 -12
- package/docs/api/functions/AIArgProcessor.md +2 -2
- package/docs/api/functions/AIStream.md +8 -4
- package/docs/api/functions/ChoiceArgProcessor.md +2 -2
- package/docs/api/functions/DefaultDateFormat.md +2 -2
- package/docs/api/functions/ObjectArgsToArgsInfo.md +1 -1
- package/docs/api/functions/RateLimit.md +2 -2
- package/docs/api/functions/TemplateArgProcessor.md +2 -2
- package/docs/api/functions/addDate.md +7 -3
- package/docs/api/functions/assignDirs.md +1 -1
- package/docs/api/functions/beforeShutdown.md +1 -1
- package/docs/api/functions/calcPerplexity.md +2 -2
- package/docs/api/functions/calcPerplexitySimple.md +1 -1
- package/docs/api/functions/canonicalize.md +1 -1
- 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/createAbilityInjector.md +16 -8
- package/docs/api/functions/createCallbacksTransformer.md +7 -3
- package/docs/api/functions/createEmptyReadableStream.md +1 -1
- package/docs/api/functions/createEndWithRepetitionDetector.md +2 -2
- package/docs/api/functions/createError.md +1 -1
- package/docs/api/functions/createEventStreamTransformer.md +8 -4
- package/docs/api/functions/createHfValueFunc.md +1 -1
- package/docs/api/functions/createLRUCache.md +2 -2
- package/docs/api/functions/createYamlObjectTag.md +1 -1
- package/docs/api/functions/dateToText.md +1 -1
- package/docs/api/functions/decodeCharset.md +2 -2
- package/docs/api/functions/defaultsWithConcat.md +1 -1
- package/docs/api/functions/detectCharset.md +2 -2
- package/docs/api/functions/encodeLLMTokens.md +1 -1
- package/docs/api/functions/ensureQuoted.md +1 -1
- package/docs/api/functions/eventable.md +6 -8
- package/docs/api/functions/expandConfig.md +2 -2
- package/docs/api/functions/expandObjEnv.md +1 -1
- package/docs/api/functions/expandPath.md +2 -2
- package/docs/api/functions/expandPathInObject.md +2 -2
- package/docs/api/functions/expandPaths.md +2 -2
- package/docs/api/functions/fileIsExists.md +1 -1
- package/docs/api/functions/filterValidFnScope.md +2 -2
- package/docs/api/functions/findIndexNonEmptyFrom.md +1 -1
- package/docs/api/functions/findPort.md +1 -1
- package/docs/api/functions/formatISO.md +1 -1
- package/docs/api/functions/formatTextWithSpace.md +2 -2
- package/docs/api/functions/funcGetMeta.md +1 -1
- package/docs/api/functions/funcWithMeta.md +2 -2
- package/docs/api/functions/genUrlParamsStr.md +8 -2
- package/docs/api/functions/getAllEnumKeys.md +4 -2
- package/docs/api/functions/getConfigFileNames.md +2 -2
- package/docs/api/functions/getConfigs.md +2 -2
- package/docs/api/functions/getFileMetaInfo.md +1 -1
- package/docs/api/functions/getHashAlgoBySize.md +1 -1
- package/docs/api/functions/getKeysPath.md +4 -2
- 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 +2 -2
- package/docs/api/functions/hash.md +1 -1
- package/docs/api/functions/hashFile.md +2 -2
- package/docs/api/functions/hashObject.md +2 -2
- package/docs/api/functions/hashStream.md +1 -1
- package/docs/api/functions/initShutdown.md +1 -1
- package/docs/api/functions/isLangUsingSpaces.md +1 -1
- package/docs/api/functions/isListItemString.md +1 -1
- package/docs/api/functions/isModelNameMatched.md +2 -2
- package/docs/api/functions/isPunctuationChar.md +1 -1
- package/docs/api/functions/isQuoted.md +1 -1
- package/docs/api/functions/isRegExp.md +1 -1
- package/docs/api/functions/isSameString.md +1 -1
- package/docs/api/functions/isSectionString.md +2 -2
- package/docs/api/functions/isSentenceEnding.md +1 -1
- package/docs/api/functions/isSepLineString.md +1 -1
- package/docs/api/functions/isStrWrapped.md +1 -1
- package/docs/api/functions/isSubdirectory.md +1 -1
- package/docs/api/functions/isTitleString.md +2 -2
- package/docs/api/functions/isWebStream.md +1 -1
- package/docs/api/functions/joinSplitWords.md +1 -1
- package/docs/api/functions/jsonFilterToWhere.md +2 -2
- package/docs/api/functions/jsonToMarkdownStr.md +2 -2
- 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 +2 -2
- package/docs/api/functions/loadTextFromPaths.md +3 -3
- package/docs/api/functions/lrucache.md +1 -1
- package/docs/api/functions/matchUrlProtocol.md +1 -1
- package/docs/api/functions/memoize.md +5 -3
- package/docs/api/functions/mergeArray.md +1 -1
- package/docs/api/functions/messagesToText.md +1 -1
- package/docs/api/functions/nanoid.md +45 -0
- package/docs/api/functions/normalizePath.md +1 -1
- package/docs/api/functions/paramsSizeToScaleStr.md +1 -1
- package/docs/api/functions/parseCommand.md +3 -3
- package/docs/api/functions/parseDateFormat.md +7 -3
- package/docs/api/functions/parseISO.md +7 -3
- package/docs/api/functions/parseJsJson.md +2 -2
- package/docs/api/functions/parseJsJsonSimpleSync.md +2 -2
- package/docs/api/functions/parseObjectArgInfo.md +2 -2
- package/docs/api/functions/parseObjectArgumentInfos.md +2 -2
- package/docs/api/functions/parseObjectArguments.md +2 -2
- package/docs/api/functions/parseObjectArgumentsAsArgInfos.md +2 -2
- package/docs/api/functions/parseYaml.md +1 -1
- package/docs/api/functions/pruneSubdirectories.md +1 -1
- package/docs/api/functions/pruneSubdirectoriesInPlace.md +1 -1
- package/docs/api/functions/quoteStr.md +1 -1
- package/docs/api/functions/readFilenamesRecursiveSync.md +2 -2
- package/docs/api/functions/readTextFileChunks.md +2 -2
- package/docs/api/functions/readTextFileChunksEx.md +2 -2
- package/docs/api/functions/readableFromAsyncIterable.md +4 -2
- package/docs/api/functions/registerCoreTools.md +1 -1
- package/docs/api/functions/removeMarkdownBold.md +2 -2
- package/docs/api/functions/removeMarkdownBoldAndItalic.md +2 -2
- package/docs/api/functions/removeMarkdownItalic.md +2 -2
- package/docs/api/functions/replaceWithPlaceholder.md +2 -2
- package/docs/api/functions/restoreFromPlacehoders.md +2 -2
- 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 +1 -1
- package/docs/api/functions/simplifyObjectArguments.md +1 -1
- package/docs/api/functions/sleep.md +1 -1
- package/docs/api/functions/sortedValues.md +4 -2
- package/docs/api/functions/splitChunks.md +2 -2
- package/docs/api/functions/splitParagraph.md +2 -2
- 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/throwError.md +1 -1
- package/docs/api/functions/toDate.md +7 -3
- package/docs/api/functions/toDateTime.md +1 -1
- package/docs/api/functions/trimStartOfStreamHelper.md +3 -3
- package/docs/api/functions/truncTo.md +1 -1
- package/docs/api/functions/truncateByToken.md +2 -2
- package/docs/api/functions/truncateToTokenLimit.md +2 -2
- package/docs/api/functions/truncateToTokenLimitEx.md +2 -2
- package/docs/api/functions/uuid.md +15 -6
- package/docs/api/functions/uuidStringify.md +1 -1
- package/docs/api/functions/uuidv1.md +5 -3
- package/docs/api/functions/uuidv4.md +5 -3
- package/docs/api/functions/uuidv5.md +5 -3
- package/docs/api/functions/uuidv6.md +61 -0
- package/docs/api/functions/uuidv7.md +61 -0
- package/docs/api/functions/wrapEventEmitter.md +1 -1
- package/docs/api/functions/xxhash.md +1 -1
- package/docs/api/functions/xxhash32.md +1 -1
- package/docs/api/functions/xxhash64.md +1 -1
- package/docs/api/functions/xxhashAsStr.md +1 -1
- package/docs/api/functions/yieldExec.md +1 -1
- package/docs/api/globals.md +17 -6
- package/docs/api/interfaces/AIChatAssistantMessageParam.md +12 -12
- package/docs/api/interfaces/AIChatContentPartImage.md +3 -3
- package/docs/api/interfaces/AIChatContentPartText.md +3 -3
- package/docs/api/interfaces/AIChatMessageParamBase.md +7 -7
- package/docs/api/interfaces/AIChatMessageToolCall.md +4 -4
- package/docs/api/interfaces/AIChatSystemMessageParam.md +9 -9
- package/docs/api/interfaces/AIChatToolChoiceFuncObject.md +3 -3
- package/docs/api/interfaces/AIChatToolChoiceObject.md +2 -2
- package/docs/api/interfaces/AIChatToolFunc.md +5 -5
- package/docs/api/interfaces/AIChatToolFuncParam.md +3 -3
- package/docs/api/interfaces/AIChatToolMessageParam.md +10 -10
- package/docs/api/interfaces/AIChatToolParam.md +2 -2
- package/docs/api/interfaces/AIChatToolTypeObject.md +2 -2
- package/docs/api/interfaces/AIChatUserMessageParam.md +13 -13
- package/docs/api/interfaces/AIChoiceConfig.md +8 -8
- package/docs/api/interfaces/AIResult.md +12 -8
- package/docs/api/interfaces/AIStreamParser.md +8 -6
- package/docs/api/interfaces/AIStreamParserOptions.md +2 -2
- package/docs/api/interfaces/BaseFunc.md +17 -17
- package/docs/api/interfaces/BaseFuncItem.md +15 -15
- package/docs/api/interfaces/BinarySemaphoreAcquireOptions.md +2 -2
- package/docs/api/interfaces/BinarySemaphoreOptions.md +5 -5
- package/docs/api/interfaces/BinarySemaphoreReleaseOptions.md +2 -2
- package/docs/api/interfaces/BinarySemaphoreReleaserFunc.md +3 -3
- package/docs/api/interfaces/CancelableAbilityOptions.md +4 -4
- package/docs/api/interfaces/ClientFuncItem.md +21 -25
- package/docs/api/interfaces/EventClientFuncParams.md +5 -5
- package/docs/api/interfaces/EventServerFuncParams.md +14 -6
- package/docs/api/interfaces/FewShotPromptTemplateOptions.md +9 -7
- package/docs/api/interfaces/FuncItem.md +18 -18
- 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 +4 -4
- package/docs/api/interfaces/IClientToolTransport.md +9 -9
- package/docs/api/interfaces/IFileMetaInfo.md +8 -8
- package/docs/api/interfaces/IPubSubClientTransport.md +31 -7
- package/docs/api/interfaces/IPubSubServerTransport.md +92 -47
- package/docs/api/interfaces/IReadTextFileChunksOptions.md +13 -13
- package/docs/api/interfaces/IServerToolTransport.md +19 -14
- package/docs/api/interfaces/IToolTransport.md +6 -6
- package/docs/api/interfaces/ITruncateToTokenLimitOptions.md +11 -11
- package/docs/api/interfaces/JsonFilter.md +1 -1
- package/docs/api/interfaces/ParseObjectArgumentOptions.md +11 -11
- package/docs/api/interfaces/ProbabilityItem.md +4 -4
- package/docs/api/interfaces/PromptExampleSelectorOptions.md +3 -3
- package/docs/api/interfaces/PubSubClientStream.md +26 -14
- package/docs/api/interfaces/PubSubServerSession.md +8 -8
- package/docs/api/interfaces/RemoteFuncItem.md +21 -25
- package/docs/api/interfaces/ReplacePlacehoderOptions.md +5 -5
- package/docs/api/interfaces/ResClientFuncParams.md +5 -5
- package/docs/api/interfaces/ResServerFuncParams.md +14 -10
- package/docs/api/interfaces/RpcMethodsClientFuncParams.md +25 -0
- package/docs/api/interfaces/RpcMethodsServerFuncParams.md +61 -0
- package/docs/api/interfaces/SectionStringOptions.md +3 -3
- package/docs/api/interfaces/SemaphoreOptions.md +7 -7
- package/docs/api/interfaces/SemaphoreTaskItem.md +6 -6
- package/docs/api/interfaces/ServerFuncItem.md +22 -26
- package/docs/api/interfaces/ServerFuncParams.md +4 -3
- package/docs/api/interfaces/SplitSentenceOptions.md +5 -5
- package/docs/api/interfaces/StreamCallbacksAndOptions.md +11 -7
- package/docs/api/interfaces/TaskAbortControllers.md +1 -1
- package/docs/api/interfaces/TaskPromise.md +17 -9
- package/docs/api/interfaces/ToolFuncPackage.md +5 -5
- package/docs/api/type-aliases/AIChatContentPart.md +2 -2
- package/docs/api/type-aliases/AIChatMessageParam.md +2 -2
- package/docs/api/type-aliases/AIChatRole.md +2 -2
- package/docs/api/type-aliases/AIChatToolChoiceParam.md +2 -2
- package/docs/api/type-aliases/AIMessageType.md +2 -2
- package/docs/api/type-aliases/AIModelNameRule.md +2 -2
- package/docs/api/type-aliases/AIModelNameRuleFn.md +2 -2
- package/docs/api/type-aliases/AIModelNameRules.md +2 -2
- package/docs/api/type-aliases/AITextGenerationFinishReason.md +2 -2
- package/docs/api/type-aliases/ActionName.md +2 -2
- package/docs/api/type-aliases/ArrayMergeWay.md +2 -2
- package/docs/api/type-aliases/AsyncTaskId.md +2 -2
- package/docs/api/type-aliases/BeforeShutdownListener.md +2 -2
- package/docs/api/type-aliases/EventErrorListenerFn.md +2 -2
- package/docs/api/type-aliases/EventListenerFn.md +2 -2
- package/docs/api/type-aliases/FuncParamType.md +2 -2
- package/docs/api/type-aliases/PromptExamples.md +5 -3
- package/docs/api/type-aliases/PubSubClientId.md +2 -2
- package/docs/api/type-aliases/PubSubCtx.md +24 -4
- package/docs/api/type-aliases/RpcMethodHandler.md +2 -2
- package/docs/api/type-aliases/SSEClient.md +53 -0
- package/docs/api/type-aliases/SemaphoreIsReadyFuncType.md +2 -2
- package/docs/api/type-aliases/TFunc.md +2 -2
- package/docs/api/type-aliases/UUIDVersions.md +11 -0
- package/docs/api/variables/AIChatRoles.md +1 -1
- 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 +2 -2
- package/docs/api/variables/ArrayMergeWaySymbol.md +2 -2
- package/docs/api/variables/ClientEventPrefix.md +11 -0
- package/docs/api/variables/ClientToolFuncSchema.md +4 -2
- package/docs/api/variables/DEFAULT_CONFIG_NAME.md +1 -1
- package/docs/api/variables/DefaultAsyncSemaphoreCapacity.md +1 -1
- package/docs/api/variables/EventBusName.md +1 -1
- package/docs/api/variables/EventName.md +1 -1
- package/docs/api/variables/FuncMetaSymbol.md +2 -2
- package/docs/api/variables/LLM_TOKENIZER_NAMES.md +4 -4
- package/docs/api/variables/LLM_TOKENIZER_NAMES_MAP.md +1 -1
- package/docs/api/variables/PASSING_SCORE.md +1 -1
- package/docs/api/variables/RStreamErrCode.md +1 -1
- package/docs/api/variables/RemoteToolFuncSchema.md +4 -2
- package/docs/api/variables/ResponseRStreamErrCode.md +1 -1
- package/docs/api/variables/RpcMethodsClientToolSchema.md +51 -0
- package/docs/api/variables/RpcMethodsServerToolSchema.md +21 -0
- 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 +4 -2
- 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 +4 -2
- package/docs/api/variables/backendEventable.md +11 -0
- package/docs/api/variables/base32768.md +1 -1
- 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 +11 -0
- package/docs/api/{functions → variables}/wait.md +16 -14
- package/docs/pubsub.md +427 -105
- package/docs/server_client_tools.md +5 -3
- package/docs/toolFunc.md +3 -1
- package/package.json +10 -9
- package/dist/chunk-LNTIQQNN.mjs +0 -1
- package/docs/api/functions/backendEventable.md +0 -29
- package/docs/api/functions/makeToolFuncCancelable.md +0 -29
- package/docs/api/interfaces/PubSubClient.md +0 -27
- package/docs/api/namespaces/uuidv5/README.md +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Guide: Server & Client
|
|
1
|
+
# Guide: Server & Client ToolFunc Types
|
|
2
2
|
|
|
3
3
|
This guide provides a detailed description of the different `ServerTools` and `ClientTools` subclasses. It focuses on their specific purpose and how each one separates its business logic from the communication logic handled by the transport layer.
|
|
4
4
|
|
|
@@ -49,9 +49,11 @@ class CalculatorTool extends RpcMethodsServerTool {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// The main 'func' inherited from the base class handles the routing.
|
|
52
|
-
new CalculatorTool('calculator').register();
|
|
52
|
+
const calculator = new CalculatorTool('calculator').register();
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
**Note:** When an `RpcMethodsServerTool` instance is created, it automatically creates alias methods for its RPC methods (those prefixed with `$`). For example, an alias `add` is created for `$add`, provided the `add` method doesn't already exist. This allows for direct server-side calls (e.g., `calculator.add({a: 1, b: 2})`). The key reason for this is to maintain consistency with the client-side API, as the proxy methods on `RpcMethodsClientTool` are also created without the `$` prefix.
|
|
56
|
+
|
|
55
57
|
### `RpcMethodsClientTool`
|
|
56
58
|
|
|
57
59
|
- **Purpose:** To be a user-friendly proxy for a remote `RpcMethodsServerTool`.
|
|
@@ -85,4 +87,4 @@ new UserResource('users').register();
|
|
|
85
87
|
|
|
86
88
|
- **Purpose:** To be an intuitive proxy for a remote `ResServerTools` instance.
|
|
87
89
|
- **Business Logic:** None.
|
|
88
|
-
- **Communication Logic:** It provides a conventional client-side API (e.g., `.get()`, `.list()`). Calling one of these methods signals to the client transport *how* to construct the underlying HTTP request. For example, calling `userClient.get({ id: '123' })` instructs the transport to make an `HTTP GET` request to the appropriate URL (`/api/users/123`).
|
|
90
|
+
- **Communication Logic:** It provides a conventional client-side API (e.g., `.get()`, `.list()`). Calling one of these methods signals to the client transport *how* to construct the underlying HTTP request. For example, calling `userClient.get({ id: '123' })` instructs the transport to make an `HTTP GET` request to the appropriate URL (`/api/users/123`).
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
`ToolFunc` is a robust framework for creating
|
|
5
|
+
`ToolFunc` is a robust framework for creating and managing reusable functions in JavaScript/TypeScript. It is built around a single class with a dual purpose: its static interface serves as a global registry for discovery and management, while its instances encapsulate the executable function logic and metadata.
|
|
6
|
+
|
|
7
|
+
This deliberate design —*combining the manager and the managed in one class*— prioritizes ease of discovery and dynamism. It is an intentional trade-off, ideal for building modular systems like AI agent toolkits where the ability to dynamically find and invoke any function is a critical requirement.
|
|
6
8
|
|
|
7
9
|
## Key Features
|
|
8
10
|
|
|
@@ -43,9 +43,9 @@ fromJSON - Creates a new BaseError instance from a JSON representation.
|
|
|
43
43
|
|
|
44
44
|
## Constructors
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### Constructor
|
|
47
47
|
|
|
48
|
-
> **new AbortError**(`what
|
|
48
|
+
> **new AbortError**(`what?`, `name?`): `AbortError`
|
|
49
49
|
|
|
50
50
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:155
|
|
51
51
|
|
|
@@ -61,11 +61,11 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_mo
|
|
|
61
61
|
|
|
62
62
|
#### Returns
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
`AbortError`
|
|
65
65
|
|
|
66
66
|
#### Overrides
|
|
67
67
|
|
|
68
|
-
[`CommonError`](CommonError.md).[`constructor`](CommonError.md#
|
|
68
|
+
[`CommonError`](CommonError.md).[`constructor`](CommonError.md#constructor)
|
|
69
69
|
|
|
70
70
|
## Properties
|
|
71
71
|
|
|
@@ -131,7 +131,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/ty
|
|
|
131
131
|
|
|
132
132
|
#### Inherited from
|
|
133
133
|
|
|
134
|
-
[`CommonError`](CommonError.md).[`message`](CommonError.md#message
|
|
134
|
+
[`CommonError`](CommonError.md).[`message`](CommonError.md#message)
|
|
135
135
|
|
|
136
136
|
***
|
|
137
137
|
|
|
@@ -143,7 +143,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/ty
|
|
|
143
143
|
|
|
144
144
|
#### Inherited from
|
|
145
145
|
|
|
146
|
-
[`CommonError`](CommonError.md).[`name`](CommonError.md#name
|
|
146
|
+
[`CommonError`](CommonError.md).[`name`](CommonError.md#name)
|
|
147
147
|
|
|
148
148
|
***
|
|
149
149
|
|
|
@@ -239,7 +239,7 @@ A JSON representation of the error.
|
|
|
239
239
|
|
|
240
240
|
### captureStackTrace()
|
|
241
241
|
|
|
242
|
-
> `static` **captureStackTrace**(`targetObject`, `constructorOpt
|
|
242
|
+
> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
243
243
|
|
|
244
244
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@types+node@24.3.0/node\_modules/@types/node/globals.d.ts:146
|
|
245
245
|
|
|
@@ -345,7 +345,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_mo
|
|
|
345
345
|
|
|
346
346
|
### createErrorClass()
|
|
347
347
|
|
|
348
|
-
> `static` **createErrorClass**(`aType`, `aErrorCode
|
|
348
|
+
> `static` **createErrorClass**(`aType`, `aErrorCode?`, `ParentErrorClass?`): *typeof* [`BaseError`](BaseError.md)
|
|
349
349
|
|
|
350
350
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:66
|
|
351
351
|
|
|
@@ -23,9 +23,9 @@ throw new AlreadyExistsError('user', { id: 123 })
|
|
|
23
23
|
|
|
24
24
|
## Constructors
|
|
25
25
|
|
|
26
|
-
###
|
|
26
|
+
### Constructor
|
|
27
27
|
|
|
28
|
-
> **new AlreadyExistsError**(`what`, `name
|
|
28
|
+
> **new AlreadyExistsError**(`what`, `name?`): `AlreadyExistsError`
|
|
29
29
|
|
|
30
30
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:151
|
|
31
31
|
|
|
@@ -41,11 +41,11 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_mo
|
|
|
41
41
|
|
|
42
42
|
#### Returns
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
`AlreadyExistsError`
|
|
45
45
|
|
|
46
46
|
#### Overrides
|
|
47
47
|
|
|
48
|
-
[`CommonError`](CommonError.md).[`constructor`](CommonError.md#
|
|
48
|
+
[`CommonError`](CommonError.md).[`constructor`](CommonError.md#constructor)
|
|
49
49
|
|
|
50
50
|
## Properties
|
|
51
51
|
|
|
@@ -111,7 +111,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/ty
|
|
|
111
111
|
|
|
112
112
|
#### Inherited from
|
|
113
113
|
|
|
114
|
-
[`CommonError`](CommonError.md).[`message`](CommonError.md#message
|
|
114
|
+
[`CommonError`](CommonError.md).[`message`](CommonError.md#message)
|
|
115
115
|
|
|
116
116
|
***
|
|
117
117
|
|
|
@@ -123,7 +123,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/ty
|
|
|
123
123
|
|
|
124
124
|
#### Inherited from
|
|
125
125
|
|
|
126
|
-
[`CommonError`](CommonError.md).[`name`](CommonError.md#name
|
|
126
|
+
[`CommonError`](CommonError.md).[`name`](CommonError.md#name)
|
|
127
127
|
|
|
128
128
|
***
|
|
129
129
|
|
|
@@ -219,7 +219,7 @@ A JSON representation of the error.
|
|
|
219
219
|
|
|
220
220
|
### captureStackTrace()
|
|
221
221
|
|
|
222
|
-
> `static` **captureStackTrace**(`targetObject`, `constructorOpt
|
|
222
|
+
> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
223
223
|
|
|
224
224
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@types+node@24.3.0/node\_modules/@types/node/globals.d.ts:146
|
|
225
225
|
|
|
@@ -325,7 +325,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_mo
|
|
|
325
325
|
|
|
326
326
|
### createErrorClass()
|
|
327
327
|
|
|
328
|
-
> `static` **createErrorClass**(`aType`, `aErrorCode
|
|
328
|
+
> `static` **createErrorClass**(`aType`, `aErrorCode?`, `ParentErrorClass?`): *typeof* [`BaseError`](BaseError.md)
|
|
329
329
|
|
|
330
330
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:66
|
|
331
331
|
|
|
@@ -43,14 +43,14 @@ fromJSON - Creates a new BaseError instance from a JSON representation.
|
|
|
43
43
|
|
|
44
44
|
## Extended by
|
|
45
45
|
|
|
46
|
-
- [`CommonError`](CommonError.md)
|
|
47
46
|
- [`ReadableStreamError`](ReadableStreamError.md)
|
|
47
|
+
- [`CommonError`](CommonError.md)
|
|
48
48
|
|
|
49
49
|
## Constructors
|
|
50
50
|
|
|
51
|
-
###
|
|
51
|
+
### Constructor
|
|
52
52
|
|
|
53
|
-
> **new BaseError**(`message`, `code
|
|
53
|
+
> **new BaseError**(`message`, `code?`, `name?`): `BaseError`
|
|
54
54
|
|
|
55
55
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:80
|
|
56
56
|
|
|
@@ -78,7 +78,7 @@ The error name or additional properties.
|
|
|
78
78
|
|
|
79
79
|
#### Returns
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
`BaseError`
|
|
82
82
|
|
|
83
83
|
#### Overrides
|
|
84
84
|
|
|
@@ -202,7 +202,7 @@ not capture any frames.
|
|
|
202
202
|
|
|
203
203
|
### fromJSON()
|
|
204
204
|
|
|
205
|
-
> **fromJSON**(`json`):
|
|
205
|
+
> **fromJSON**(`json`): `BaseError`
|
|
206
206
|
|
|
207
207
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:104
|
|
208
208
|
|
|
@@ -214,7 +214,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_mo
|
|
|
214
214
|
|
|
215
215
|
#### Returns
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
`BaseError`
|
|
218
218
|
|
|
219
219
|
***
|
|
220
220
|
|
|
@@ -236,7 +236,7 @@ A JSON representation of the error.
|
|
|
236
236
|
|
|
237
237
|
### captureStackTrace()
|
|
238
238
|
|
|
239
|
-
> `static` **captureStackTrace**(`targetObject`, `constructorOpt
|
|
239
|
+
> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
240
240
|
|
|
241
241
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@types+node@24.3.0/node\_modules/@types/node/globals.d.ts:146
|
|
242
242
|
|
|
@@ -306,7 +306,7 @@ a();
|
|
|
306
306
|
|
|
307
307
|
### create()
|
|
308
308
|
|
|
309
|
-
> `static` **create**(`__namedParameters`):
|
|
309
|
+
> `static` **create**(`__namedParameters`): `BaseError`
|
|
310
310
|
|
|
311
311
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:67
|
|
312
312
|
|
|
@@ -332,13 +332,13 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_mo
|
|
|
332
332
|
|
|
333
333
|
#### Returns
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
`BaseError`
|
|
336
336
|
|
|
337
337
|
***
|
|
338
338
|
|
|
339
339
|
### createErrorClass()
|
|
340
340
|
|
|
341
|
-
> `static` **createErrorClass**(`aType`, `aErrorCode
|
|
341
|
+
> `static` **createErrorClass**(`aType`, `aErrorCode?`, `ParentErrorClass?`): *typeof* `BaseError`
|
|
342
342
|
|
|
343
343
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:66
|
|
344
344
|
|
|
@@ -358,13 +358,13 @@ the error type(class) name
|
|
|
358
358
|
|
|
359
359
|
##### ParentErrorClass?
|
|
360
360
|
|
|
361
|
-
*typeof*
|
|
361
|
+
*typeof* `BaseError`
|
|
362
362
|
|
|
363
363
|
the parent error class. defaults to AbstractError
|
|
364
364
|
|
|
365
365
|
#### Returns
|
|
366
366
|
|
|
367
|
-
*typeof*
|
|
367
|
+
*typeof* `BaseError`
|
|
368
368
|
|
|
369
369
|
the new Error Class
|
|
370
370
|
|
|
@@ -376,7 +376,7 @@ the new Error Class
|
|
|
376
376
|
|
|
377
377
|
### fromJSON()
|
|
378
378
|
|
|
379
|
-
> `static` **fromJSON**(`json`):
|
|
379
|
+
> `static` **fromJSON**(`json`): `BaseError`
|
|
380
380
|
|
|
381
381
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:103
|
|
382
382
|
|
|
@@ -393,7 +393,7 @@ A JSON object representing the error.
|
|
|
393
393
|
|
|
394
394
|
#### Returns
|
|
395
395
|
|
|
396
|
-
|
|
396
|
+
`BaseError`
|
|
397
397
|
|
|
398
398
|
A new instance of the error class (or a subclass).
|
|
399
399
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: BinarySemaphore
|
|
8
8
|
|
|
9
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:88](https://github.com/isdk/ai-tool.js/blob/
|
|
9
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:88](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L88)
|
|
10
10
|
|
|
11
11
|
A binary semaphore implementation for managing concurrency in asynchronous operations.
|
|
12
12
|
Unlike a general semaphore, a binary semaphore allows only one caller to acquire the semaphore at a time.
|
|
@@ -43,11 +43,11 @@ const data = await Promise.all(array.map(fetchData));
|
|
|
43
43
|
|
|
44
44
|
## Constructors
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### Constructor
|
|
47
47
|
|
|
48
|
-
> **new BinarySemaphore**(`options`):
|
|
48
|
+
> **new BinarySemaphore**(`options`): `BinarySemaphore`
|
|
49
49
|
|
|
50
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:145](https://github.com/isdk/ai-tool.js/blob/
|
|
50
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:145](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L145)
|
|
51
51
|
|
|
52
52
|
Creates a binary semaphore object for managing concurrency in asynchronous operations.
|
|
53
53
|
|
|
@@ -59,7 +59,7 @@ Creates a binary semaphore object for managing concurrency in asynchronous opera
|
|
|
59
59
|
|
|
60
60
|
#### Returns
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
`BinarySemaphore`
|
|
63
63
|
|
|
64
64
|
## Properties
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ Creates a binary semaphore object for managing concurrency in asynchronous opera
|
|
|
67
67
|
|
|
68
68
|
> `protected` **\_activeCount**: `number`
|
|
69
69
|
|
|
70
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:97](https://github.com/isdk/ai-tool.js/blob/
|
|
70
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:97](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L97)
|
|
71
71
|
|
|
72
72
|
***
|
|
73
73
|
|
|
@@ -75,7 +75,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:97](ht
|
|
|
75
75
|
|
|
76
76
|
> `protected` **emitter**: [`EventEmitter`](EventEmitter.md)
|
|
77
77
|
|
|
78
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:91](https://github.com/isdk/ai-tool.js/blob/
|
|
78
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:91](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L91)
|
|
79
79
|
|
|
80
80
|
***
|
|
81
81
|
|
|
@@ -83,15 +83,15 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:91](ht
|
|
|
83
83
|
|
|
84
84
|
> `protected` **free**: `any`
|
|
85
85
|
|
|
86
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:90](https://github.com/isdk/ai-tool.js/blob/
|
|
86
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:90](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L90)
|
|
87
87
|
|
|
88
88
|
***
|
|
89
89
|
|
|
90
90
|
### initTokenFn()
|
|
91
91
|
|
|
92
|
-
> `protected` **initTokenFn**: (`token
|
|
92
|
+
> `protected` **initTokenFn**: (`token?`) => `void`
|
|
93
93
|
|
|
94
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:95](https://github.com/isdk/ai-tool.js/blob/
|
|
94
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:95](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L95)
|
|
95
95
|
|
|
96
96
|
#### Parameters
|
|
97
97
|
|
|
@@ -109,7 +109,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:95](ht
|
|
|
109
109
|
|
|
110
110
|
> `protected` **paused**: `boolean`
|
|
111
111
|
|
|
112
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:96](https://github.com/isdk/ai-tool.js/blob/
|
|
112
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:96](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L96)
|
|
113
113
|
|
|
114
114
|
***
|
|
115
115
|
|
|
@@ -117,7 +117,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:96](ht
|
|
|
117
117
|
|
|
118
118
|
> `protected` `optional` **pauseFn**: () => `void`
|
|
119
119
|
|
|
120
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:93](https://github.com/isdk/ai-tool.js/blob/
|
|
120
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:93](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L93)
|
|
121
121
|
|
|
122
122
|
#### Returns
|
|
123
123
|
|
|
@@ -129,7 +129,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:93](ht
|
|
|
129
129
|
|
|
130
130
|
> `protected` `optional` **resumeFn**: () => `void`
|
|
131
131
|
|
|
132
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:94](https://github.com/isdk/ai-tool.js/blob/
|
|
132
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:94](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L94)
|
|
133
133
|
|
|
134
134
|
#### Returns
|
|
135
135
|
|
|
@@ -141,7 +141,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:94](ht
|
|
|
141
141
|
|
|
142
142
|
> `protected` **useDefaultTokens**: `boolean`
|
|
143
143
|
|
|
144
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:92](https://github.com/isdk/ai-tool.js/blob/
|
|
144
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:92](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L92)
|
|
145
145
|
|
|
146
146
|
***
|
|
147
147
|
|
|
@@ -149,7 +149,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:92](ht
|
|
|
149
149
|
|
|
150
150
|
> `readonly` **waiting**: `Deque`\<`undefined` \| [`SemaphoreTaskItem`](../interfaces/SemaphoreTaskItem.md)\>
|
|
151
151
|
|
|
152
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:89](https://github.com/isdk/ai-tool.js/blob/
|
|
152
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:89](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L89)
|
|
153
153
|
|
|
154
154
|
## Accessors
|
|
155
155
|
|
|
@@ -159,7 +159,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:89](ht
|
|
|
159
159
|
|
|
160
160
|
> **get** **activeCount**(): `number`
|
|
161
161
|
|
|
162
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:318](https://github.com/isdk/ai-tool.js/blob/
|
|
162
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:318](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L318)
|
|
163
163
|
|
|
164
164
|
Get the total count of all active operations.
|
|
165
165
|
|
|
@@ -181,7 +181,7 @@ The total count of active operations, including both waiting and ongoing tasks.
|
|
|
181
181
|
|
|
182
182
|
> **get** **pendingCount**(): `number`
|
|
183
183
|
|
|
184
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:327](https://github.com/isdk/ai-tool.js/blob/
|
|
184
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:327](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L327)
|
|
185
185
|
|
|
186
186
|
Get the number of callers waiting on the semaphore, i.e. the number of pending promises.
|
|
187
187
|
|
|
@@ -195,9 +195,9 @@ The number of waiters in the waiting list.
|
|
|
195
195
|
|
|
196
196
|
### \_dispatchTask()
|
|
197
197
|
|
|
198
|
-
> **\_dispatchTask**(`task`, `options
|
|
198
|
+
> **\_dispatchTask**(`task`, `options?`): `void`
|
|
199
199
|
|
|
200
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:212](https://github.com/isdk/ai-tool.js/blob/
|
|
200
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:212](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L212)
|
|
201
201
|
|
|
202
202
|
#### Parameters
|
|
203
203
|
|
|
@@ -217,9 +217,9 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:212](h
|
|
|
217
217
|
|
|
218
218
|
### \_newReleaser()
|
|
219
219
|
|
|
220
|
-
> **\_newReleaser**(`options
|
|
220
|
+
> **\_newReleaser**(`options?`): [`BinarySemaphoreReleaserFunc`](../interfaces/BinarySemaphoreReleaserFunc.md)
|
|
221
221
|
|
|
222
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:199](https://github.com/isdk/ai-tool.js/blob/
|
|
222
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:199](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L199)
|
|
223
223
|
|
|
224
224
|
#### Parameters
|
|
225
225
|
|
|
@@ -235,9 +235,9 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:199](h
|
|
|
235
235
|
|
|
236
236
|
### abort()
|
|
237
237
|
|
|
238
|
-
> **abort**(`reason
|
|
238
|
+
> **abort**(`reason?`): `void`
|
|
239
239
|
|
|
240
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:301](https://github.com/isdk/ai-tool.js/blob/
|
|
240
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:301](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L301)
|
|
241
241
|
|
|
242
242
|
#### Parameters
|
|
243
243
|
|
|
@@ -253,9 +253,9 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:301](h
|
|
|
253
253
|
|
|
254
254
|
### acquire()
|
|
255
255
|
|
|
256
|
-
> **acquire**(`options
|
|
256
|
+
> **acquire**(`options?`): `Promise`\<[`BinarySemaphoreReleaserFunc`](../interfaces/BinarySemaphoreReleaserFunc.md)\>
|
|
257
257
|
|
|
258
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:243](https://github.com/isdk/ai-tool.js/blob/
|
|
258
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:243](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L243)
|
|
259
259
|
|
|
260
260
|
Acquire a token from the semaphore, thus decrement the number of available execution slots. If initFn is not used then the return value of the function can be discarded.
|
|
261
261
|
|
|
@@ -277,7 +277,7 @@ A promise that resolves to a release function when a token is acquired. If the s
|
|
|
277
277
|
|
|
278
278
|
> **drain**(): `Promise`\<`any`[]\>
|
|
279
279
|
|
|
280
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:296](https://github.com/isdk/ai-tool.js/blob/
|
|
280
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:296](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L296)
|
|
281
281
|
|
|
282
282
|
Drains the semaphore and returns all the initialized tokens in an array. Draining is an ideal way to ensure there are no pending async tasks, for example before a process will terminate.
|
|
283
283
|
|
|
@@ -291,7 +291,7 @@ Drains the semaphore and returns all the initialized tokens in an array. Drainin
|
|
|
291
291
|
|
|
292
292
|
> **init**(`options`): `void`
|
|
293
293
|
|
|
294
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:193](https://github.com/isdk/ai-tool.js/blob/
|
|
294
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:193](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L193)
|
|
295
295
|
|
|
296
296
|
#### Parameters
|
|
297
297
|
|
|
@@ -307,9 +307,9 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:193](h
|
|
|
307
307
|
|
|
308
308
|
### initFree()
|
|
309
309
|
|
|
310
|
-
> **initFree**(`options
|
|
310
|
+
> **initFree**(`options?`): `void`
|
|
311
311
|
|
|
312
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:173](https://github.com/isdk/ai-tool.js/blob/
|
|
312
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:173](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L173)
|
|
313
313
|
|
|
314
314
|
#### Parameters
|
|
315
315
|
|
|
@@ -325,9 +325,9 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:173](h
|
|
|
325
325
|
|
|
326
326
|
### lock()
|
|
327
327
|
|
|
328
|
-
> **lock**(`options
|
|
328
|
+
> **lock**(`options?`): `any`
|
|
329
329
|
|
|
330
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:217](https://github.com/isdk/ai-tool.js/blob/
|
|
330
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:217](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L217)
|
|
331
331
|
|
|
332
332
|
#### Parameters
|
|
333
333
|
|
|
@@ -343,9 +343,9 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:217](h
|
|
|
343
343
|
|
|
344
344
|
### onReleased()
|
|
345
345
|
|
|
346
|
-
> **onReleased**(`options
|
|
346
|
+
> **onReleased**(`options?`): `void`
|
|
347
347
|
|
|
348
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:177](https://github.com/isdk/ai-tool.js/blob/
|
|
348
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:177](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L177)
|
|
349
349
|
|
|
350
350
|
#### Parameters
|
|
351
351
|
|
|
@@ -361,9 +361,9 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:177](h
|
|
|
361
361
|
|
|
362
362
|
### release()
|
|
363
363
|
|
|
364
|
-
> **release**(`options
|
|
364
|
+
> **release**(`options?`): `void`
|
|
365
365
|
|
|
366
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:288](https://github.com/isdk/ai-tool.js/blob/
|
|
366
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:288](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L288)
|
|
367
367
|
|
|
368
368
|
Releases the semaphore, incrementing the number of free execution slots. If there are tasks in the waiting queue, the next task will be dispatched.
|
|
369
369
|
|
|
@@ -381,9 +381,9 @@ Releases the semaphore, incrementing the number of free execution slots. If ther
|
|
|
381
381
|
|
|
382
382
|
### tryAcquire()
|
|
383
383
|
|
|
384
|
-
> **tryAcquire**(`options
|
|
384
|
+
> **tryAcquire**(`options?`): `any`
|
|
385
385
|
|
|
386
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:234](https://github.com/isdk/ai-tool.js/blob/
|
|
386
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:234](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L234)
|
|
387
387
|
|
|
388
388
|
Attempt to acquire a token from the semaphore, if one is available immediately. Otherwise, return undefined.
|
|
389
389
|
|
|
@@ -403,9 +403,9 @@ Returns a token if the semaphore is not full; otherwise, returns `undefined`.
|
|
|
403
403
|
|
|
404
404
|
### unlock()
|
|
405
405
|
|
|
406
|
-
> **unlock**(`token
|
|
406
|
+
> **unlock**(`token?`): `void`
|
|
407
407
|
|
|
408
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:225](https://github.com/isdk/ai-tool.js/blob/
|
|
408
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/async-semaphore.ts:225](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/async-semaphore.ts#L225)
|
|
409
409
|
|
|
410
410
|
#### Parameters
|
|
411
411
|
|