@isdk/ai-tool 0.2.0 → 0.2.2
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-PY6NRGZE.mjs +1 -0
- package/dist/funcs.d.mts +1 -1
- package/dist/funcs.d.ts +1 -1
- package/dist/funcs.js +1 -1
- package/dist/funcs.mjs +1 -1
- package/dist/{index-nP9lSU6E.d.mts → index-DUEs7T8M.d.mts} +2 -2
- package/dist/{index-nP9lSU6E.d.ts → index-DUEs7T8M.d.ts} +2 -2
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +5 -3
- package/docs/_media/CONTRIBUTING.md +18 -0
- package/docs/_media/LICENSE-MIT +22 -0
- package/docs/classes/AbortError.md +108 -129
- package/docs/classes/AlreadyExistsError.md +105 -126
- package/docs/classes/BaseError.md +112 -125
- package/docs/classes/CancelableAbility.md +136 -188
- package/docs/classes/ClientTools.md +1005 -1107
- package/docs/classes/CommonError.md +115 -136
- package/docs/classes/ConfigFile.md +150 -163
- package/docs/classes/EventClient.md +1128 -1282
- package/docs/classes/EventServer.md +1165 -1303
- package/docs/classes/EventToolFunc.md +958 -1028
- package/docs/classes/FStringPromptTemplate.md +352 -438
- package/docs/classes/FewShotPromptTemplate.md +364 -464
- package/docs/classes/GolangPromptTemplate.md +352 -438
- package/docs/classes/HFEnvironment.md +53 -79
- package/docs/classes/HFInterpreter.md +20 -377
- package/docs/classes/HFTemplate.md +21 -33
- package/docs/classes/HfPromptTemplate.md +352 -438
- package/docs/classes/IntSet.md +67 -100
- package/docs/classes/NotFoundError.md +105 -126
- package/docs/classes/NotImplementationError.md +105 -126
- package/docs/classes/PromptExampleSelector.md +58 -70
- package/docs/classes/PromptTemplate.md +338 -422
- package/docs/classes/ReadableStreamError.md +108 -129
- package/docs/classes/ResClientTools.md +916 -1026
- package/docs/classes/ResServerTools.md +919 -1026
- package/docs/classes/SSEChannel.md +93 -112
- package/docs/classes/Semaphore.md +44 -140
- package/docs/classes/ServerTools.md +981 -1072
- package/docs/classes/TaskAbortController.md +46 -66
- package/docs/classes/ToolFunc.md +840 -910
- package/docs/enumerations/AsyncFeatureBits.md +37 -0
- package/docs/enumerations/AsyncFeatures.md +37 -0
- package/docs/enumerations/ErrorCode.md +217 -0
- package/docs/enumerations/XXHashAlgorithm.md +27 -0
- package/docs/functions/AIArgProcessor.md +27 -0
- package/docs/functions/AIStream.md +50 -0
- package/docs/functions/ChoiceArgProcessor.md +27 -0
- package/docs/functions/RateLimit.md +33 -0
- package/docs/functions/TemplateArgProcessor.md +27 -0
- package/docs/functions/backendEventable.md +23 -0
- package/docs/functions/canonicalize.md +21 -0
- package/docs/functions/countRegexMatches.md +33 -0
- package/docs/functions/createAbilityInjector.md +87 -0
- package/docs/functions/createCallbacksTransformer.md +49 -0
- package/docs/functions/createEmptyReadableStream.md +23 -0
- package/docs/functions/createEndWithRepetitionDetector.md +29 -0
- package/docs/functions/createError.md +35 -0
- package/docs/functions/createEventStreamTransformer.md +33 -0
- package/docs/functions/createHfValueFunc.md +29 -0
- package/docs/functions/createLRUCache.md +23 -0
- package/docs/functions/dateToText.md +23 -0
- package/docs/functions/expandEnv.md +40 -0
- package/docs/functions/expandObjEnv.md +54 -0
- package/docs/functions/extNameLevel.md +43 -0
- package/docs/functions/fileIsExists.md +34 -0
- package/docs/functions/filenameReservedRegex.md +22 -0
- package/docs/functions/filterValidFnScope.md +21 -0
- package/docs/functions/findPort.md +23 -0
- package/docs/functions/formatISO.md +71 -0
- package/docs/functions/getAllEnumKeys.md +31 -0
- package/docs/functions/getConfigFileNames.md +23 -0
- package/docs/functions/getConfigs.md +23 -0
- package/docs/functions/getKeysPath.md +38 -0
- package/docs/functions/getMultiLevelExtname.md +31 -0
- package/docs/functions/getPackageDir.md +39 -0
- package/docs/functions/getRealFilepath.md +34 -0
- package/docs/functions/getResponseErrorReadableStream.md +21 -0
- package/docs/functions/hfParse.md +24 -0
- package/docs/functions/hfTokenize.md +25 -0
- package/docs/functions/interpolateEnv.md +25 -0
- package/docs/functions/interpolateFString.md +27 -0
- package/docs/functions/interpolateGolangTemplate.md +31 -0
- package/docs/functions/isModelNameMatched.md +45 -0
- package/docs/functions/isValidFilename.md +38 -0
- package/docs/functions/isValidFilepath.md +27 -0
- package/docs/functions/isWebStream.md +21 -0
- package/docs/functions/jsonFilterToWhere.md +45 -0
- package/docs/functions/jsonToMarkdownStr.md +31 -0
- package/docs/functions/loadFileFromPaths.md +54 -0
- package/docs/functions/loadTextFromPaths.md +29 -0
- package/docs/functions/lrucache.md +29 -0
- package/docs/functions/makeToolFuncCancelable.md +23 -0
- package/docs/functions/matchUrlProtocol.md +48 -0
- package/docs/functions/memoize.md +27 -0
- package/docs/functions/messagesToText.md +21 -0
- package/docs/functions/paramsSizeToScaleStr.md +32 -0
- package/docs/functions/parseCommand.md +33 -0
- package/docs/functions/parseDateFormat.md +360 -0
- package/docs/functions/parseFString.md +26 -0
- package/docs/functions/parseISO.md +72 -0
- package/docs/functions/parseJsJson.md +38 -0
- package/docs/functions/parseObjectArgInfo.md +27 -0
- package/docs/functions/parseObjectArgumentInfos.md +25 -0
- package/docs/functions/parseObjectArguments.md +68 -0
- package/docs/functions/parseObjectArgumentsAsArgInfos.md +42 -0
- package/docs/functions/parseYaml.md +21 -0
- package/docs/functions/quoteStr.md +21 -0
- package/docs/functions/reControlCharsRegex.md +21 -0
- package/docs/functions/readFilenamesRecursiveSync.md +47 -0
- package/docs/functions/readableFromAsyncIterable.md +28 -0
- package/docs/functions/registerCoreTools.md +17 -0
- package/docs/functions/registerYamlTag.md +21 -0
- package/docs/functions/sanitizeFilename.md +37 -0
- package/docs/functions/sanitizeFilepath.md +31 -0
- package/docs/functions/saveConfigFile.md +25 -0
- package/docs/functions/scaleStrToParamsSize.md +27 -0
- package/docs/functions/simplifyObjectArguments.md +21 -0
- package/docs/functions/sortedValues.md +25 -0
- package/docs/functions/splitSentence.md +37 -0
- package/docs/functions/stringifyYaml.md +49 -0
- package/docs/functions/textToDate.md +23 -0
- package/docs/functions/throwError.md +37 -0
- package/docs/functions/toDate.md +76 -0
- package/docs/functions/toDateTime.md +21 -0
- package/docs/functions/trimStartOfStreamHelper.md +41 -0
- package/docs/functions/truncTo.md +47 -0
- package/docs/functions/uuid.md +23 -0
- package/docs/functions/uuidParse.md +21 -0
- package/docs/functions/uuidStringify.md +23 -0
- package/docs/functions/uuidValidate.md +21 -0
- package/docs/functions/uuidVersion.md +21 -0
- package/docs/functions/uuidv1.md +47 -0
- package/docs/functions/uuidv4.md +47 -0
- package/docs/functions/uuidv5.md +51 -0
- package/docs/functions/wait.md +21 -0
- package/docs/functions/xxhash.md +25 -0
- package/docs/functions/xxhash32.md +23 -0
- package/docs/functions/xxhash64.md +23 -0
- package/docs/functions/xxhashAsStr.md +25 -0
- package/docs/globals.md +236 -0
- package/docs/interfaces/AIChatAssistantMessageParam.md +29 -38
- package/docs/interfaces/AIChatContentPartImage.md +11 -16
- package/docs/interfaces/AIChatContentPartText.md +9 -12
- package/docs/interfaces/AIChatMessageParamBase.md +12 -19
- package/docs/interfaces/AIChatMessageToolCall.md +18 -21
- package/docs/interfaces/AIChatSystemMessageParam.md +16 -22
- package/docs/interfaces/AIChatToolMessageParam.md +19 -26
- package/docs/interfaces/AIChatUserMessageParam.md +32 -42
- package/docs/interfaces/AIChoiceConfig.md +31 -39
- package/docs/interfaces/AIResult.md +29 -32
- package/docs/interfaces/AIStreamParser.md +24 -18
- package/docs/interfaces/AIStreamParserOptions.md +8 -10
- package/docs/interfaces/BaseFunc.md +55 -75
- package/docs/interfaces/BaseFuncItem.md +43 -61
- package/docs/interfaces/CancelableAbilityOptions.md +43 -54
- package/docs/interfaces/ClientFuncItem.md +66 -83
- package/docs/interfaces/DotenvExpandOptions.md +15 -19
- package/docs/interfaces/DotenvExpandOutput.md +11 -14
- package/docs/interfaces/DotenvParseInput.md +6 -2
- package/docs/interfaces/DotenvParseOutput.md +6 -2
- package/docs/interfaces/DotenvPopulateInput.md +6 -2
- package/docs/interfaces/EventClientFuncParams.md +22 -33
- package/docs/interfaces/EventServerFuncParams.md +27 -35
- package/docs/interfaces/FewShotPromptTemplateOptions.md +58 -74
- package/docs/interfaces/FuncItem.md +53 -70
- package/docs/interfaces/FuncParam.md +29 -36
- package/docs/interfaces/FuncParams.md +6 -2
- package/docs/interfaces/Funcs.md +6 -2
- package/docs/interfaces/JsonFilter.md +6 -2
- package/docs/interfaces/ParseObjectArgumentOptions.md +23 -29
- package/docs/interfaces/PromptExampleSelectorOptions.md +13 -16
- package/docs/interfaces/PromptTemplateOptions.md +31 -40
- package/docs/interfaces/RemoteFuncItem.md +64 -82
- package/docs/interfaces/ResClientFuncParams.md +14 -19
- package/docs/interfaces/ResServerFuncParams.md +28 -36
- package/docs/interfaces/SanitizeFilenameOptions.md +11 -14
- package/docs/interfaces/ServerFuncItem.md +70 -88
- package/docs/interfaces/ServerFuncParams.md +15 -20
- package/docs/interfaces/StreamCallbacksAndOptions.md +36 -65
- package/docs/interfaces/TaskAbortControllers.md +6 -2
- package/docs/interfaces/TaskPromise.md +48 -61
- package/docs/interfaces/ToolFuncPackage.md +18 -32
- package/docs/type-aliases/AIChatContentPart.md +13 -0
- package/docs/type-aliases/AIChatMessageParam.md +13 -0
- package/docs/type-aliases/AIChatRole.md +13 -0
- package/docs/type-aliases/AIMessageType.md +13 -0
- package/docs/type-aliases/AIModelNameRule.md +13 -0
- package/docs/type-aliases/AIModelNameRuleFn.md +21 -0
- package/docs/type-aliases/AIModelNameRules.md +13 -0
- package/docs/type-aliases/AITextGenerationFinishReason.md +13 -0
- package/docs/type-aliases/ActionName.md +13 -0
- package/docs/type-aliases/AsyncTaskId.md +13 -0
- package/docs/type-aliases/EventErrorListenerFn.md +27 -0
- package/docs/type-aliases/EventListenerFn.md +25 -0
- package/docs/type-aliases/FStringPromptTemplateNode.md +16 -0
- package/docs/type-aliases/FuncParamType.md +13 -0
- package/docs/type-aliases/PromptExamples.md +17 -0
- package/docs/type-aliases/PromptTemplateType.md +13 -0
- package/docs/type-aliases/PromptType.md +13 -0
- package/docs/type-aliases/TFunc.md +23 -0
- package/docs/variables/AIChatRoles.md +13 -0
- package/docs/variables/AIMessageTypes.md +13 -0
- package/docs/variables/AITextGenerationFinishReasons.md +13 -0
- package/docs/variables/AbortErrorCode.md +13 -0
- package/docs/variables/ActionNames.md +13 -0
- package/docs/variables/AlreadyExistsErrorCode.md +13 -0
- package/docs/variables/ClientToolFuncSchema.md +87 -0
- package/docs/variables/DefaultAsyncSemaphoreCapacity.md +13 -0
- package/docs/variables/EventBusName.md +13 -0
- package/docs/variables/EventName.md +13 -0
- package/docs/variables/FilenameReservedRegex.md +16 -0
- package/docs/variables/HFBuiltins.md +92 -0
- package/docs/variables/InternalErrorCode.md +13 -0
- package/docs/variables/NotFoundErrorCode.md +13 -0
- package/docs/variables/NotImplementedErrorCode.md +13 -0
- package/docs/variables/PASSING_SCORE.md +13 -0
- package/docs/variables/PromptTemplateTypes.md +13 -0
- package/docs/variables/PromptTypes.md +16 -0
- package/docs/variables/RStreamErrCode.md +13 -0
- package/docs/variables/RemoteToolFuncSchema.md +87 -0
- package/docs/variables/ResponseRStreamErrCode.md +13 -0
- package/docs/variables/SSEChannelAlreadyClosedErrCode.md +13 -0
- package/docs/variables/ServerToolFuncSchema.md +87 -0
- package/docs/variables/ToolAsyncCancelableBit.md +13 -0
- package/docs/variables/ToolAsyncMultiTaskBit.md +13 -0
- package/docs/variables/ToolAsyncPriorityBit.md +13 -0
- package/docs/variables/ToolFuncSchema.md +125 -0
- package/docs/variables/WindowsReservedNameRegex.md +15 -0
- package/docs/variables/base32768.md +13 -0
- package/docs/variables/defaultTemplateFormat.md +13 -0
- package/docs/variables/event.md +13 -0
- package/docs/variables/eventClient.md +13 -0
- package/docs/variables/eventServer.md +13 -0
- package/docs/variables/lrucache.md +13 -0
- package/docs/variables/mimeType.md +13 -0
- package/docs/variables/uuidNIL.md +13 -0
- package/package.json +26 -27
- package/dist/chunk-W2LO3HZT.mjs +0 -1
- package/docs/.nojekyll +0 -1
- package/docs/enums/AsyncFeatureBits.md +0 -41
- package/docs/enums/AsyncFeatures.md +0 -41
- package/docs/enums/ErrorCode.md +0 -239
- package/docs/enums/XXHashAlgorithm.md +0 -30
- package/docs/modules.md +0 -4062
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / parseObjectArguments
|
|
6
|
+
|
|
7
|
+
# Function: parseObjectArguments()
|
|
8
|
+
|
|
9
|
+
> **parseObjectArguments**(`argsStr`, `scope`?, `options`?): `Promise`\<`any`\>
|
|
10
|
+
|
|
11
|
+
Asynchronously parses a string of object arguments into an actual object.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
• **argsStr**: `string`
|
|
16
|
+
|
|
17
|
+
The string of arguments to be parsed.
|
|
18
|
+
|
|
19
|
+
• **scope?**: `Record`\<`string`, `any`\>
|
|
20
|
+
|
|
21
|
+
An optional scope object that provides values for variables during parsing.
|
|
22
|
+
|
|
23
|
+
• **options?**: [`ParseObjectArgumentOptions`](../interfaces/ParseObjectArgumentOptions.md)
|
|
24
|
+
|
|
25
|
+
An optional configuration object containing the delimiter and argument processor.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`any`\>
|
|
30
|
+
|
|
31
|
+
The parsed object or undefined.
|
|
32
|
+
|
|
33
|
+
This function first parses the argument string into an object string and then converts it
|
|
34
|
+
into a proper JavaScript/JSON object based on the parsing results and configuration options.
|
|
35
|
+
It handles the conversion of single objects, arrays, and key-value pairs. The default delimiter
|
|
36
|
+
between parameters is a comma (`,`), but this can be customized using the `options.delimiter`.
|
|
37
|
+
Parameter assignment always uses an equal sign (`=`) and cannot be modified.
|
|
38
|
+
|
|
39
|
+
The function returns:
|
|
40
|
+
- An object if the input string represents a set of key-value pairs.
|
|
41
|
+
- An array if the input string represents a sequence of elements, where each element can be
|
|
42
|
+
parsed as a number (indices are used as keys).
|
|
43
|
+
- A single value if the input string represents a single value or a single key-value pair.
|
|
44
|
+
- `undefined` if the input string is empty or cannot be parsed into a valid object.
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Example call with default delimiter
|
|
50
|
+
const result = await parseObjectArguments("name=John,age=30");
|
|
51
|
+
console.log(result); // Output: { name: 'John', age: '30' }
|
|
52
|
+
|
|
53
|
+
// Example call with custom delimiter
|
|
54
|
+
const resultCustomDelimiter = await parseObjectArguments("name=John|age=30", undefined, { delimiter: '|' });
|
|
55
|
+
console.log(resultCustomDelimiter); // Output: { name: 'John', age: '30' }
|
|
56
|
+
|
|
57
|
+
// Example with a single value
|
|
58
|
+
const singleValue = await parseObjectArguments("42");
|
|
59
|
+
console.log(singleValue); // Output: 42
|
|
60
|
+
|
|
61
|
+
// Example with an array
|
|
62
|
+
const arrayResult = await parseObjectArguments("1,2,3");
|
|
63
|
+
console.log(arrayResult); // Output: [1, 2, 3]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Defined in
|
|
67
|
+
|
|
68
|
+
[packages/ai-tool/src/utils/parse-command.ts:66](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/parse-command.ts#L66)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / parseObjectArgumentsAsArgInfos
|
|
6
|
+
|
|
7
|
+
# Function: parseObjectArgumentsAsArgInfos()
|
|
8
|
+
|
|
9
|
+
> **parseObjectArgumentsAsArgInfos**(`argsStr`, `scope`?, `options`?): `ArgInfo`[]
|
|
10
|
+
|
|
11
|
+
Parses an object arguments string into an array of ArgInfo.
|
|
12
|
+
|
|
13
|
+
This function processes a parameter string and parses it according to specific rules, allowing for custom delimiters.
|
|
14
|
+
It can handle quotes, escape characters, and expressions within brackets. The parsing is designed to interpret
|
|
15
|
+
object literal strings from dynamic languages, such as JSON objects or similar custom formats.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
• **argsStr**: `string`
|
|
20
|
+
|
|
21
|
+
The string containing the arguments to be parsed.
|
|
22
|
+
|
|
23
|
+
• **scope?**: `Record`\<`string`, `any`\>
|
|
24
|
+
|
|
25
|
+
An optional scope object used for further processing of the parsed arguments. Default is undefined.
|
|
26
|
+
|
|
27
|
+
• **options?**: [`ParseObjectArgumentOptions`](../interfaces/ParseObjectArgumentOptions.md)
|
|
28
|
+
|
|
29
|
+
Parsing options, including:
|
|
30
|
+
- delimiter: The character used to separate arguments. Default is ','.
|
|
31
|
+
- argProcessor: An optional instance of ArgProcessor used for further processing of the parsed arguments.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`ArgInfo`[]
|
|
36
|
+
|
|
37
|
+
An array of parsed argument information, where each item contains a boolean indicating whether the argument is named,
|
|
38
|
+
and the string representation of the argument.
|
|
39
|
+
|
|
40
|
+
## Defined in
|
|
41
|
+
|
|
42
|
+
[packages/ai-tool/src/utils/parse-command.ts:285](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/parse-command.ts#L285)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / parseYaml
|
|
6
|
+
|
|
7
|
+
# Function: parseYaml()
|
|
8
|
+
|
|
9
|
+
> **parseYaml**(`content`): `any`
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
• **content**: `string`
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`any`
|
|
18
|
+
|
|
19
|
+
## Defined in
|
|
20
|
+
|
|
21
|
+
[packages/ai-tool/src/utils/config.ts:25](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/config.ts#L25)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / quoteStr
|
|
6
|
+
|
|
7
|
+
# Function: quoteStr()
|
|
8
|
+
|
|
9
|
+
> **quoteStr**(`str`): `string`
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
• **str**: `string`
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
## Defined in
|
|
20
|
+
|
|
21
|
+
[packages/ai-tool/src/utils/parse-command.ts:200](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/parse-command.ts#L200)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / reControlCharsRegex
|
|
6
|
+
|
|
7
|
+
# Function: reControlCharsRegex()
|
|
8
|
+
|
|
9
|
+
> **reControlCharsRegex**(): `RegExp`
|
|
10
|
+
|
|
11
|
+
Returns a new regular expression instance for control characters in a filename with the 'g' flag.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`RegExp`
|
|
16
|
+
|
|
17
|
+
A compiled regular expression for control characters in a filename.
|
|
18
|
+
|
|
19
|
+
## Defined in
|
|
20
|
+
|
|
21
|
+
[packages/ai-tool/src/utils/filename.ts:50](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/filename.ts#L50)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / readFilenamesRecursiveSync
|
|
6
|
+
|
|
7
|
+
# Function: readFilenamesRecursiveSync()
|
|
8
|
+
|
|
9
|
+
> **readFilenamesRecursiveSync**(`dir`, `options`?): `string`[]
|
|
10
|
+
|
|
11
|
+
Recursively reads all filenames in the given directory or directories.
|
|
12
|
+
Optionally filters the results using a file matching callback.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
• **dir**: `string` \| `string`[]
|
|
17
|
+
|
|
18
|
+
A single directory path or an array of directory paths to start the search from.
|
|
19
|
+
|
|
20
|
+
• **options?**
|
|
21
|
+
|
|
22
|
+
• **options.isFileMatched?**
|
|
23
|
+
|
|
24
|
+
An optional callback that determines whether a file should be included in the result.
|
|
25
|
+
|
|
26
|
+
• **options.level?**: `number`
|
|
27
|
+
|
|
28
|
+
• **options.signal?**: `AbortSignal`
|
|
29
|
+
|
|
30
|
+
An optional signal to abort the operation.
|
|
31
|
+
|
|
32
|
+
## Returns
|
|
33
|
+
|
|
34
|
+
`string`[]
|
|
35
|
+
|
|
36
|
+
An array of file paths that match the criteria.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
const files = readFilenamesRecursiveSync('/path/to/directory', {isFileMatched: (filepath) => filepath.endsWith('.js')});
|
|
42
|
+
console.log(files); // Outputs an array of JavaScript file paths.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Defined in
|
|
46
|
+
|
|
47
|
+
[packages/ai-tool/src/utils/load-file-from-paths.ts:123](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/load-file-from-paths.ts#L123)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / readableFromAsyncIterable
|
|
6
|
+
|
|
7
|
+
# Function: readableFromAsyncIterable()
|
|
8
|
+
|
|
9
|
+
> **readableFromAsyncIterable**\<`T`\>(`iterable`): `ReadableStream`\<`T`\>
|
|
10
|
+
|
|
11
|
+
Implements ReadableStream.from(asyncIterable), which isn't documented in MDN and isn't implemented in node.
|
|
12
|
+
https://github.com/whatwg/streams/commit/8d7a0bf26eb2cc23e884ddbaac7c1da4b91cf2bc
|
|
13
|
+
|
|
14
|
+
## Type Parameters
|
|
15
|
+
|
|
16
|
+
• **T**
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
• **iterable**: `AsyncIterable`\<`T`, `any`, `any`\>
|
|
21
|
+
|
|
22
|
+
## Returns
|
|
23
|
+
|
|
24
|
+
`ReadableStream`\<`T`\>
|
|
25
|
+
|
|
26
|
+
## Defined in
|
|
27
|
+
|
|
28
|
+
[packages/ai-tool/src/utils/stream/ai-stream.ts:166](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/stream/ai-stream.ts#L166)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / registerCoreTools
|
|
6
|
+
|
|
7
|
+
# Function: registerCoreTools()
|
|
8
|
+
|
|
9
|
+
> **registerCoreTools**(): `void`
|
|
10
|
+
|
|
11
|
+
## Returns
|
|
12
|
+
|
|
13
|
+
`void`
|
|
14
|
+
|
|
15
|
+
## Defined in
|
|
16
|
+
|
|
17
|
+
[packages/ai-tool/src/funcs/index.ts:9](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/funcs/index.ts#L9)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / registerYamlTag
|
|
6
|
+
|
|
7
|
+
# Function: registerYamlTag()
|
|
8
|
+
|
|
9
|
+
> **registerYamlTag**(`tags`): `void`
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
• **tags**: `any`
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`void`
|
|
18
|
+
|
|
19
|
+
## Defined in
|
|
20
|
+
|
|
21
|
+
[packages/ai-tool/src/utils/config.ts:15](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/config.ts#L15)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / sanitizeFilename
|
|
6
|
+
|
|
7
|
+
# Function: sanitizeFilename()
|
|
8
|
+
|
|
9
|
+
> **sanitizeFilename**(`filename`, `options`): `string`
|
|
10
|
+
|
|
11
|
+
Sanitizes a given filename by replacing invalid characters with a specified replacement character or a default.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
• **filename**: `string`
|
|
16
|
+
|
|
17
|
+
The filename to sanitize, represented as a string.
|
|
18
|
+
|
|
19
|
+
• **options**: [`SanitizeFilenameOptions`](../interfaces/SanitizeFilenameOptions.md) = `{}`
|
|
20
|
+
|
|
21
|
+
An optional object containing configuration options:
|
|
22
|
+
- `replacement` {string} - The character to replace invalid characters with. Default is '!'. Cannot contain reserved filename characters.
|
|
23
|
+
- `maxLength` {number} - The maximum length of the sanitized filename. Default is `MAX_FILENAME_LENGTH`.
|
|
24
|
+
|
|
25
|
+
## Returns
|
|
26
|
+
|
|
27
|
+
`string`
|
|
28
|
+
|
|
29
|
+
The sanitized filename.
|
|
30
|
+
|
|
31
|
+
## Throws
|
|
32
|
+
|
|
33
|
+
- If the `replacement` contains reserved filename characters or control characters.
|
|
34
|
+
|
|
35
|
+
## Defined in
|
|
36
|
+
|
|
37
|
+
[packages/ai-tool/src/utils/filename.ts:97](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/filename.ts#L97)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / sanitizeFilepath
|
|
6
|
+
|
|
7
|
+
# Function: sanitizeFilepath()
|
|
8
|
+
|
|
9
|
+
> **sanitizeFilepath**(`filepath`, `options`): `string`
|
|
10
|
+
|
|
11
|
+
Sanitizes each part of a file path and reassembles it, ensuring the path is valid according to provided options.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
• **filepath**: `string`
|
|
16
|
+
|
|
17
|
+
The file path to sanitize, represented as a string.
|
|
18
|
+
|
|
19
|
+
• **options**: [`SanitizeFilenameOptions`](../interfaces/SanitizeFilenameOptions.md) = `{}`
|
|
20
|
+
|
|
21
|
+
Optional settings for sanitization, extending `SanitizeFilenameOptions`. Allows customization of replacement characters and maximum filename length.
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`string`
|
|
26
|
+
|
|
27
|
+
The sanitized file path as a string.
|
|
28
|
+
|
|
29
|
+
## Defined in
|
|
30
|
+
|
|
31
|
+
[packages/ai-tool/src/utils/filename.ts:149](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/filename.ts#L149)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / saveConfigFile
|
|
6
|
+
|
|
7
|
+
# Function: saveConfigFile()
|
|
8
|
+
|
|
9
|
+
> **saveConfigFile**(`filename`, `config`, `extLevel`): `string`
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
• **filename**: `string`
|
|
14
|
+
|
|
15
|
+
• **config**: `any`
|
|
16
|
+
|
|
17
|
+
• **extLevel**: `number` = `1`
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
## Defined in
|
|
24
|
+
|
|
25
|
+
[packages/ai-tool/src/utils/config.ts:85](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/config.ts#L85)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / scaleStrToParamsSize
|
|
6
|
+
|
|
7
|
+
# Function: scaleStrToParamsSize()
|
|
8
|
+
|
|
9
|
+
> **scaleStrToParamsSize**(`scale`): `number`
|
|
10
|
+
|
|
11
|
+
Converts a formatted parameters size string (with units T, B, M, or K) back to its byte value.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
• **scale**: `string`
|
|
16
|
+
|
|
17
|
+
The formatted parameter size string (e.g., "1.23B", "456M", "789K", or "123").
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`number`
|
|
22
|
+
|
|
23
|
+
The parameter size in bytes.
|
|
24
|
+
|
|
25
|
+
## Defined in
|
|
26
|
+
|
|
27
|
+
[packages/ai-tool/src/utils/convert-params-size.ts:44](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/convert-params-size.ts#L44)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / simplifyObjectArguments
|
|
6
|
+
|
|
7
|
+
# Function: simplifyObjectArguments()
|
|
8
|
+
|
|
9
|
+
> **simplifyObjectArguments**(`args`): `any`
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
• **args**: `any`
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`any`
|
|
18
|
+
|
|
19
|
+
## Defined in
|
|
20
|
+
|
|
21
|
+
[packages/ai-tool/src/utils/parse-command.ts:71](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/parse-command.ts#L71)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / sortedValues
|
|
6
|
+
|
|
7
|
+
# Function: sortedValues()
|
|
8
|
+
|
|
9
|
+
> **sortedValues**\<`T`\>(`values`): `T`[]
|
|
10
|
+
|
|
11
|
+
## Type Parameters
|
|
12
|
+
|
|
13
|
+
• **T**
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
• **values**: `Record`\<`string`, `T`\>
|
|
18
|
+
|
|
19
|
+
## Returns
|
|
20
|
+
|
|
21
|
+
`T`[]
|
|
22
|
+
|
|
23
|
+
## Defined in
|
|
24
|
+
|
|
25
|
+
[packages/ai-tool/src/utils/prompt/few-shot-prompt-template.ts:4](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/prompt/few-shot-prompt-template.ts#L4)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / splitSentence
|
|
6
|
+
|
|
7
|
+
# Function: splitSentence()
|
|
8
|
+
|
|
9
|
+
> **splitSentence**(`text`, `best`): `string`[]
|
|
10
|
+
|
|
11
|
+
Splits a text into sentences.
|
|
12
|
+
This function is used to split a text into separate sentences, based on punctuation marks such as '.', '?', or '!' and other rules.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
• **text**: `string`
|
|
17
|
+
|
|
18
|
+
The input string that needs to be split into sentences.
|
|
19
|
+
|
|
20
|
+
• **best**: `boolean` = `true`
|
|
21
|
+
|
|
22
|
+
A boolean flag indicating if the function should use the best possible sentence splitting method (default is true).
|
|
23
|
+
If set to false, it will not perform any additional processing and simply split on newline characters ('\n').
|
|
24
|
+
|
|
25
|
+
## Returns
|
|
26
|
+
|
|
27
|
+
`string`[]
|
|
28
|
+
|
|
29
|
+
An array of strings where each string represents a sentence in the input text.
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
const text = "Hello world! How are you today? I am fine.";
|
|
33
|
+
console.log(splitSentence(text)); // returns ['Hello world!', 'How are you today?', 'I am fine.']
|
|
34
|
+
|
|
35
|
+
## Defined in
|
|
36
|
+
|
|
37
|
+
[packages/ai-tool/src/utils/split-sentence.ts:29](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/split-sentence.ts#L29)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / stringifyYaml
|
|
6
|
+
|
|
7
|
+
# Function: stringifyYaml()
|
|
8
|
+
|
|
9
|
+
## stringifyYaml(value, options)
|
|
10
|
+
|
|
11
|
+
> **stringifyYaml**(`value`, `options`?): `string`
|
|
12
|
+
|
|
13
|
+
Stringify a value as a YAML document.
|
|
14
|
+
|
|
15
|
+
### Parameters
|
|
16
|
+
|
|
17
|
+
• **value**: `any`
|
|
18
|
+
|
|
19
|
+
• **options?**: `DocumentOptions` & `SchemaOptions` & `ParseOptions` & `CreateNodeOptions` & `ToStringOptions`
|
|
20
|
+
|
|
21
|
+
### Returns
|
|
22
|
+
|
|
23
|
+
`string`
|
|
24
|
+
|
|
25
|
+
Will always include `\n` as the last character, as is expected of YAML documents.
|
|
26
|
+
|
|
27
|
+
### Defined in
|
|
28
|
+
|
|
29
|
+
node\_modules/.pnpm/yaml@2.5.1/node\_modules/yaml/dist/public-api.d.ts:42
|
|
30
|
+
|
|
31
|
+
## stringifyYaml(value, replacer, options)
|
|
32
|
+
|
|
33
|
+
> **stringifyYaml**(`value`, `replacer`?, `options`?): `string`
|
|
34
|
+
|
|
35
|
+
### Parameters
|
|
36
|
+
|
|
37
|
+
• **value**: `any`
|
|
38
|
+
|
|
39
|
+
• **replacer?**: `null` \| `Replacer`
|
|
40
|
+
|
|
41
|
+
• **options?**: `string` \| `number` \| `DocumentOptions` & `SchemaOptions` & `ParseOptions` & `CreateNodeOptions` & `ToStringOptions`
|
|
42
|
+
|
|
43
|
+
### Returns
|
|
44
|
+
|
|
45
|
+
`string`
|
|
46
|
+
|
|
47
|
+
### Defined in
|
|
48
|
+
|
|
49
|
+
node\_modules/.pnpm/yaml@2.5.1/node\_modules/yaml/dist/public-api.d.ts:43
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / textToDate
|
|
6
|
+
|
|
7
|
+
# Function: textToDate()
|
|
8
|
+
|
|
9
|
+
> **textToDate**(`date`, `format`): `Date`
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
• **date**: `string`
|
|
14
|
+
|
|
15
|
+
• **format**: `string` = `FormatDateStr`
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
`Date`
|
|
20
|
+
|
|
21
|
+
## Defined in
|
|
22
|
+
|
|
23
|
+
[packages/ai-tool/src/utils/to-datetime.ts:25](https://github.com/isdk/ai-tool.js/blob/37ada542a786fbbc770f2d61beb564f6e603941d/src/utils/to-datetime.ts#L25)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / throwError
|
|
6
|
+
|
|
7
|
+
# Function: throwError()
|
|
8
|
+
|
|
9
|
+
> **throwError**(`message`, `name`?, `status`?): `void`
|
|
10
|
+
|
|
11
|
+
Throw an error
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
• **message**: `string`
|
|
16
|
+
|
|
17
|
+
Error message
|
|
18
|
+
|
|
19
|
+
• **name?**: `string` \| `Record`\<`string`, `any`\>
|
|
20
|
+
|
|
21
|
+
Error name, optional
|
|
22
|
+
|
|
23
|
+
• **status?**: `string` \| `number`
|
|
24
|
+
|
|
25
|
+
Error status code, default to 500
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`void`
|
|
30
|
+
|
|
31
|
+
## Throws
|
|
32
|
+
|
|
33
|
+
Throws a BaseError object
|
|
34
|
+
|
|
35
|
+
## Defined in
|
|
36
|
+
|
|
37
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:149
|