@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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **assignDirs**(`dest`, `src`): `string`[]
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/has-directory-in.ts:48](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/has-directory-in.ts:48](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/has-directory-in.ts#L48)
|
|
12
12
|
|
|
13
13
|
Assigns directories from the source array to the destination array if they do not already exist in the destination.
|
|
14
14
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: beforeShutdown()
|
|
8
8
|
|
|
9
|
-
> **beforeShutdown**(`listener`):
|
|
9
|
+
> **beforeShutdown**(`listener`): [`BeforeShutdownListener`](../type-aliases/BeforeShutdownListener.md) \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/node/before-shutdown.ts:95](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/node/before-shutdown.ts:95](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/node/before-shutdown.ts#L95)
|
|
12
12
|
|
|
13
13
|
Registers a new shutdown listener to be invoked before exiting
|
|
14
14
|
the main process. Listener handlers are guaranteed to be called in the order
|
|
@@ -24,6 +24,6 @@ The shutdown listener to register.
|
|
|
24
24
|
|
|
25
25
|
## Returns
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
[`BeforeShutdownListener`](../type-aliases/BeforeShutdownListener.md) \| `undefined`
|
|
28
28
|
|
|
29
29
|
Echoes back the supplied `listener`.
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: calcPerplexity()
|
|
8
8
|
|
|
9
|
-
> **calcPerplexity**(`probabilities`, `options?`): `
|
|
9
|
+
> **calcPerplexity**(`probabilities`, `options?`): `number` \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/calc-perplexity.ts:97](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/calc-perplexity.ts:97](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/calc-perplexity.ts#L97)
|
|
12
12
|
|
|
13
13
|
Calculates the perplexity of a given list of probability items.
|
|
14
14
|
Perplexity is a measurement used in natural language processing (NLP)
|
|
@@ -33,7 +33,7 @@ Optional configuration for excluding specific types of tokens
|
|
|
33
33
|
|
|
34
34
|
## Returns
|
|
35
35
|
|
|
36
|
-
`
|
|
36
|
+
`number` \| `undefined`
|
|
37
37
|
|
|
38
38
|
The calculated perplexity value as a number.
|
|
39
39
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: calcPerplexitySimple()
|
|
8
8
|
|
|
9
|
-
> **calcPerplexitySimple**(`probabilities`): `
|
|
9
|
+
> **calcPerplexitySimple**(`probabilities`): `number` \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/calc-perplexity.ts:126](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/calc-perplexity.ts:126](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/calc-perplexity.ts#L126)
|
|
12
12
|
|
|
13
13
|
A simplified version of the perplexity calculation function.
|
|
14
14
|
This function directly calculates the perplexity from an array
|
|
@@ -25,7 +25,7 @@ An array of `ProbabilityItem` objects, each containing
|
|
|
25
25
|
|
|
26
26
|
## Returns
|
|
27
27
|
|
|
28
|
-
`
|
|
28
|
+
`number` \| `undefined`
|
|
29
29
|
|
|
30
30
|
The calculated perplexity value as a number.
|
|
31
31
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / cmdArgEvaluate
|
|
6
|
+
|
|
7
|
+
# Function: cmdArgEvaluate()
|
|
8
|
+
|
|
9
|
+
> **cmdArgEvaluate**(`ctx`): `Promise`\<`any`\>
|
|
10
|
+
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/command-parser/evaluator.ts:15](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/command-parser/evaluator.ts#L15)
|
|
12
|
+
|
|
13
|
+
Evaluates the value of an argument.
|
|
14
|
+
|
|
15
|
+
Priority:
|
|
16
|
+
1. Attempt to call a custom processor (ArgProcessor).
|
|
17
|
+
2. If the processor returns a source string, recursively call evaluateExpression.
|
|
18
|
+
3. Default to evaluateExpression (handles literals, scope variables, and JS expressions).
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
### ctx
|
|
23
|
+
|
|
24
|
+
[`CmdArgContext`](../interfaces/CmdArgContext.md)
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
`Promise`\<`any`\>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / cmdArgsToMergedObject
|
|
6
|
+
|
|
7
|
+
# Function: cmdArgsToMergedObject()
|
|
8
|
+
|
|
9
|
+
> **cmdArgsToMergedObject**(`result`, `options?`): `Record`\<`string` \| `number`, `any`\>
|
|
10
|
+
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/command-parser/api.ts:47](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/command-parser/api.ts#L47)
|
|
12
|
+
|
|
13
|
+
Merges parsing results into a single flattened object.
|
|
14
|
+
Numeric indices are used for positional arguments.
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
### result
|
|
19
|
+
|
|
20
|
+
[`CmdArgParseResult`](../interfaces/CmdArgParseResult.md)
|
|
21
|
+
|
|
22
|
+
The raw parse result.
|
|
23
|
+
|
|
24
|
+
### options?
|
|
25
|
+
|
|
26
|
+
[`CmdArgParserOptions`](../interfaces/CmdArgParserOptions.md)
|
|
27
|
+
|
|
28
|
+
CmdArgParser configuration options.
|
|
29
|
+
|
|
30
|
+
## Returns
|
|
31
|
+
|
|
32
|
+
`Record`\<`string` \| `number`, `any`\>
|
|
33
|
+
|
|
34
|
+
A merged object containing all arguments.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **completeSentences**(`sentences`, `__namedParameters`): `string`[]
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/split-sentence.ts:123](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/split-sentence.ts:123](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/split-sentence.ts#L123)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **concatText**(`left`, `right`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/split-sentence.ts:168](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/split-sentence.ts:168](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/split-sentence.ts#L168)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **countLLMTokens**(`text`, `modelId`): `Promise`\<`number`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/llm-tokenizer.ts:74](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/llm-tokenizer.ts:74](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/llm-tokenizer.ts#L74)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **countRegexMatches**(`content`, `regex`): `number`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/count-regex-matches.ts:10](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/count-regex-matches.ts:10](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/count-regex-matches.ts#L10)
|
|
12
12
|
|
|
13
13
|
Counts the number of matches for a given regular expression in a specified string.
|
|
14
14
|
This function ensures that the regular expression is used globally by adding the 'g' flag,
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: createCallbacksTransformer()
|
|
8
8
|
|
|
9
|
-
> **createCallbacksTransformer**\<`I`, `O`\>(`cb
|
|
9
|
+
> **createCallbacksTransformer**\<`I`, `O`\>(`cb?`): `TransformStream`\<`I`, `O`\>
|
|
10
10
|
|
|
11
|
-
Defined in:
|
|
11
|
+
Defined in: @isdk/ai-tools/packages/tool-func/dist/index.d.ts:90
|
|
12
12
|
|
|
13
|
-
Creates a transform stream that invokes optional callback functions.
|
|
14
|
-
The transform stream uses the provided callbacks to execute custom logic at different stages of the stream's lifecycle.
|
|
15
|
-
- `onStart`: Called once when the stream is initialized.
|
|
16
|
-
- `onTransform`: Called for each tokenized message.
|
|
17
|
-
- `onCompletion`: Called every time an AIStream completion message is received. This can occur multiple times when using e.g. OpenAI functions
|
|
18
|
-
- `onFinal`: Called once when the stream is closed with the final completion message.
|
|
13
|
+
Creates a transform stream that invokes optional callback functions during its lifecycle.
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
### Key Features:
|
|
16
|
+
- **Unified Cleanup**: The `onClose` hook ensures resource recovery happens once and only once.
|
|
17
|
+
- **Zero-Copy Optimization**: If `onTransform` is omitted, it leverages the engine's internal
|
|
18
|
+
optimized identity path for maximum throughput.
|
|
19
|
+
- **Cancellation Support**: Explicitly handles the `cancel` hook, critical for Web/RPC scenarios.
|
|
20
|
+
- **Robustness**: Protects the stream lifecycle even if callbacks themselves throw errors.
|
|
21
21
|
|
|
22
22
|
## Type Parameters
|
|
23
23
|
|
|
@@ -31,23 +31,27 @@ This function is useful when you want to process a stream of messages and perfor
|
|
|
31
31
|
|
|
32
32
|
## Parameters
|
|
33
33
|
|
|
34
|
-
### cb
|
|
34
|
+
### cb?
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
[`StreamCallbacksAndOptions`](../interfaces/StreamCallbacksAndOptions.md)\<`I`, `O`\>
|
|
37
|
+
|
|
38
|
+
An object containing optional lifecycle callbacks.
|
|
37
39
|
|
|
38
40
|
## Returns
|
|
39
41
|
|
|
40
42
|
`TransformStream`\<`I`, `O`\>
|
|
41
43
|
|
|
42
|
-
A
|
|
44
|
+
A TransformStream that allows the execution of custom logic through callbacks.
|
|
43
45
|
|
|
44
46
|
## Example
|
|
45
47
|
|
|
46
|
-
```
|
|
47
|
-
const
|
|
48
|
-
onStart:
|
|
49
|
-
onTransform:
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
|
|
48
|
+
```typescript
|
|
49
|
+
const transformer = createCallbacksTransformer({
|
|
50
|
+
onStart: (c) => c.enqueue("START_OF_STREAM"),
|
|
51
|
+
onTransform: (chunk) => chunk.toUpperCase(),
|
|
52
|
+
onClose: (status, reason) => {
|
|
53
|
+
console.log(`Stream closed with status: ${status}`);
|
|
54
|
+
myTaskHandle.release(); // Guaranteed cleanup
|
|
55
|
+
}
|
|
56
|
+
});
|
|
53
57
|
```
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **createEmptyReadableStream**(): `ReadableStream`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/create-empty-stream.ts:8](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/create-empty-stream.ts:8](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/stream/create-empty-stream.ts#L8)
|
|
12
12
|
|
|
13
13
|
Creates an empty ReadableStream that immediately closes upon creation.
|
|
14
14
|
This function is used as a fallback for creating a ReadableStream when the response body is null or undefined,
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: createEndWithRepetitionDetector()
|
|
8
8
|
|
|
9
|
-
> **createEndWithRepetitionDetector**(`repetitionThreshold`): (`value`) => `
|
|
9
|
+
> **createEndWithRepetitionDetector**(`repetitionThreshold`): (`value`) => `RegExpExecArray` \| `null`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/end-with-repeated-sequence.ts:3](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/end-with-repeated-sequence.ts:3](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/end-with-repeated-sequence.ts#L3)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/end-with-repeated-sequenc
|
|
|
18
18
|
|
|
19
19
|
## Returns
|
|
20
20
|
|
|
21
|
-
> (`value`): `
|
|
21
|
+
> (`value`): `RegExpExecArray` \| `null`
|
|
22
22
|
|
|
23
23
|
### Parameters
|
|
24
24
|
|
|
@@ -28,4 +28,4 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/end-with-repeated-sequenc
|
|
|
28
28
|
|
|
29
29
|
### Returns
|
|
30
30
|
|
|
31
|
-
`
|
|
31
|
+
`RegExpExecArray` \| `null`
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **createEventStreamTransformer**\<`TValue`, `TOptions`\>(`customParser?`): `TransformStream`\<`Uint8Array`\<`ArrayBufferLike`\>, [`AIResult`](../interfaces/AIResult.md)\<`TValue`, `TOptions`\>\>
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/ai-stream.ts:36](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/ai-stream.ts:36](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/stream/ai-stream.ts#L36)
|
|
12
12
|
|
|
13
13
|
Creates a TransformStream that parses events from an EventSource stream using a custom parser.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **createLRUCache**(`name`, `options?`): [`ToolFunc`](../classes/ToolFunc.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/funcs/lrucache.ts:24](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/funcs/lrucache.ts:24](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/funcs/lrucache.ts#L24)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **createYamlObjectTag**(`tag`, `BaseObject`): `any`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/yaml-type-base-object.ts:10](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/yaml-type-base-object.ts:10](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/yaml-type-base-object.ts#L10)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **dateToText**(`date`, `format`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/to-datetime.ts:35](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/to-datetime.ts:35](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/to-datetime.ts#L35)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **decodeCharset**(`result`, `encoding?`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-file-from-paths.ts:113](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-file-from-paths.ts:113](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/load-file-from-paths.ts#L113)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **defaultsWithConcat**(`target`, ...`source`): `any`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/merge-with-concat.ts:60](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/merge-with-concat.ts:60](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/merge-with-concat.ts#L60)
|
|
12
12
|
|
|
13
13
|
Merges multiple source objects into the target object with a custom merging strategy.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **detectCharset**(`content`, `options?`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-file-from-paths.ts:263](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-file-from-paths.ts:263](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/load-file-from-paths.ts#L263)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **encodeLLMTokens**(`text`, `modelId`): `Promise`\<`number`[]\>
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/llm-tokenizer.ts:68](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/llm-tokenizer.ts:68](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/llm-tokenizer.ts#L68)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
> **ensureQuoted**(`s`, `quoteChar`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/command-parser/utils.ts:104](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/command-parser/utils.ts#L104)
|
|
12
|
+
|
|
13
|
+
Ensures a string is wrapped in quotes.
|
|
12
14
|
|
|
13
15
|
## Parameters
|
|
14
16
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / evaluateExpression
|
|
6
|
+
|
|
7
|
+
# Function: evaluateExpression()
|
|
8
|
+
|
|
9
|
+
> **evaluateExpression**(`code`, `scope`, `options`): `Promise`\<`any`\>
|
|
10
|
+
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/command-parser/evaluator.ts:58](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/command-parser/evaluator.ts#L58)
|
|
12
|
+
|
|
13
|
+
Evaluates an expression string to its value.
|
|
14
|
+
|
|
15
|
+
Logic sequence:
|
|
16
|
+
1. Check if evaluation should be skipped.
|
|
17
|
+
2. Match simple JS literals (true, false, null, undefined, NaN, Infinity).
|
|
18
|
+
3. Check if it's a number.
|
|
19
|
+
4. Perform path lookup in the scope (getByPath).
|
|
20
|
+
5. Attempt execution as a JS expression or arrow function.
|
|
21
|
+
6. Catch ReferenceError: Decide whether to fall back to raw text or return undefined based on options.
|
|
22
|
+
7. Final fallback: Handle unquoting for quoted strings.
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
|
|
26
|
+
### code
|
|
27
|
+
|
|
28
|
+
`string`
|
|
29
|
+
|
|
30
|
+
### scope
|
|
31
|
+
|
|
32
|
+
`any`
|
|
33
|
+
|
|
34
|
+
### options
|
|
35
|
+
|
|
36
|
+
[`CmdArgParserOptions`](../interfaces/CmdArgParserOptions.md)
|
|
37
|
+
|
|
38
|
+
## Returns
|
|
39
|
+
|
|
40
|
+
`Promise`\<`any`\>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **eventable**\<`T`\>(`targetClass?`, `options?`): `T` & (`aClass?`) => `Function` & `T` *extends* (...`args`) => `any` ? `InstanceType`\<`T`\<`T`\>\> : `T`
|
|
10
10
|
|
|
11
|
-
Defined in: @isdk/
|
|
11
|
+
Defined in: @isdk/util/node\_modules/.pnpm/events-ex@2.1.1/node\_modules/events-ex/lib/eventable.d.ts:48
|
|
12
12
|
|
|
13
13
|
Adds event-emitting capabilities to a class by injecting necessary methods and properties.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **expandConfig**(`config`, `defaultConfig?`): `any`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:18](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:18](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/load-config.ts#L18)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **expandEnv**(`options`): `DotenvExpandOptions`
|
|
10
10
|
|
|
11
|
-
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:
|
|
11
|
+
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:782
|
|
12
12
|
|
|
13
13
|
Expand environment variables in the parsed object
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **expandObjEnv**(`obj`, `options?`, `parsedObjs?`): `any`
|
|
10
10
|
|
|
11
|
-
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:
|
|
11
|
+
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:809
|
|
12
12
|
|
|
13
13
|
Expands environment variables in an object/array or string.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **expandPath**(`path`, `config?`): `any`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:72](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:72](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/load-config.ts#L72)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **expandPathInObject**(`obj`, `pathKeys`, `config?`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:85](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:85](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/load-config.ts#L85)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **expandPaths**(`paths`, `config?`): `any`[]
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:80](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-config.ts:80](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/load-config.ts#L80)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / extractCodeBlock
|
|
6
|
+
|
|
7
|
+
# Function: extractCodeBlock()
|
|
8
|
+
|
|
9
|
+
> **extractCodeBlock**(`text`, `langOrOptions?`): `string` \| `CodeString` \| (`string` \| `CodeString`)[]
|
|
10
|
+
|
|
11
|
+
Defined in: @isdk/util/dist/index.d.ts:1278
|
|
12
|
+
|
|
13
|
+
Extracts fenced code block(s) from the input `text`, with support for nested path selectors.
|
|
14
|
+
|
|
15
|
+
This function acts as a query engine for Markdown code blocks. It can extract
|
|
16
|
+
single blocks, multiple blocks, or drill down into nested structures using
|
|
17
|
+
CSS-like syntax.
|
|
18
|
+
|
|
19
|
+
## Parameters
|
|
20
|
+
|
|
21
|
+
### text
|
|
22
|
+
|
|
23
|
+
`string`
|
|
24
|
+
|
|
25
|
+
The input string containing Markdown.
|
|
26
|
+
|
|
27
|
+
### langOrOptions?
|
|
28
|
+
|
|
29
|
+
Either a language/selector string or a full ExtractCodeBlockOptions object.
|
|
30
|
+
|
|
31
|
+
`string` | `ExtractCodeBlockOptions`
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`string` \| `CodeString` \| (`string` \| `CodeString`)[]
|
|
36
|
+
|
|
37
|
+
A single CodeString, an array of CodeStrings (if `all: true`),
|
|
38
|
+
or the original `text` if no matches are found at the specified index.
|
|
39
|
+
|
|
40
|
+
## Example
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// Simple extraction (last block)
|
|
44
|
+
const code = extractCodeBlock(input, 'js');
|
|
45
|
+
|
|
46
|
+
// Nested extraction
|
|
47
|
+
const inner = extractCodeBlock(input, 'md > ts');
|
|
48
|
+
|
|
49
|
+
// Extract all matching blocks
|
|
50
|
+
const all = extractCodeBlock(input, { lang: 'container > item', all: true });
|
|
51
|
+
```
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: fileIsExists()
|
|
8
8
|
|
|
9
|
-
> **fileIsExists**(`filepath`): `
|
|
9
|
+
> **fileIsExists**(`filepath`): `boolean` \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-file-from-paths.ts:23](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/load-file-from-paths.ts:23](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/load-file-from-paths.ts#L23)
|
|
12
12
|
|
|
13
13
|
Checks if a file (not a directory) exists at the specified path.
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ The path to the file to check.
|
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
25
|
-
`
|
|
25
|
+
`boolean` \| `undefined`
|
|
26
26
|
|
|
27
27
|
true if the file exists and is not a directory; otherwise, false.
|
|
28
28
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: filterValidFnScope()
|
|
8
8
|
|
|
9
|
-
> **filterValidFnScope**(`scope?`): `
|
|
9
|
+
> **filterValidFnScope**(`scope?`): `Record`\<`string`, `any`\> \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/parse-js-json.ts:58](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/parse-js-json.ts:58](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/parse-js-json.ts#L58)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -18,4 +18,4 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/parse-js-json.ts:58](http
|
|
|
18
18
|
|
|
19
19
|
## Returns
|
|
20
20
|
|
|
21
|
-
`
|
|
21
|
+
`Record`\<`string`, `any`\> \| `undefined`
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **findIndexNonEmptyFrom**(`arr`, `start`): `number`
|
|
10
10
|
|
|
11
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/split-sentence.ts:282](https://github.com/isdk/ai-tool.js/blob/
|
|
11
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/split-sentence.ts:282](https://github.com/isdk/ai-tool.js/blob/d10fb4cda65fc1975152a2c3ab327ecab008dea1/src/utils/split-sentence.ts#L282)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|