@isdk/ai-tool 0.1.1 → 0.1.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-COXUI4Q3.mjs +1 -0
- package/dist/funcs.js +1 -1
- package/dist/funcs.mjs +1 -1
- package/dist/index.d.mts +29 -28
- package/dist/index.d.ts +29 -28
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test/util.mjs +1 -1
- package/docs/classes/AbortError.md +8 -8
- package/docs/classes/AlreadyExistsError.md +8 -8
- package/docs/classes/BaseError.md +8 -8
- package/docs/classes/CancelableAbility.md +20 -20
- package/docs/classes/ClientTools.md +74 -74
- package/docs/classes/CommonError.md +8 -8
- package/docs/classes/ConfigFile.md +19 -19
- package/docs/classes/EventClient.md +96 -96
- package/docs/classes/EventServer.md +97 -97
- package/docs/classes/EventToolFunc.md +65 -65
- package/docs/classes/FStringPromptTemplate.md +47 -47
- package/docs/classes/FewShotPromptTemplate.md +51 -51
- package/docs/classes/GolangPromptTemplate.md +47 -47
- package/docs/classes/HFEnvironment.md +9 -9
- package/docs/classes/HFInterpreter.md +19 -19
- package/docs/classes/HFTemplate.md +4 -4
- package/docs/classes/HfPromptTemplate.md +47 -47
- package/docs/classes/IntSet.md +12 -12
- package/docs/classes/NotFoundError.md +8 -8
- package/docs/classes/NotImplementationError.md +8 -8
- package/docs/classes/PromptExampleSelector.md +8 -8
- package/docs/classes/PromptTemplate.md +46 -46
- package/docs/classes/ReadableStreamError.md +8 -8
- package/docs/classes/ResClientTools.md +80 -80
- package/docs/classes/ResServerTools.md +81 -81
- package/docs/classes/SSEChannel.md +15 -15
- package/docs/classes/Semaphore.md +14 -14
- package/docs/classes/ServerTools.md +70 -70
- package/docs/classes/TaskAbortController.md +7 -7
- package/docs/classes/ToolFunc.md +62 -62
- package/docs/enums/AsyncFeatureBits.md +3 -3
- package/docs/enums/AsyncFeatures.md +3 -3
- package/docs/enums/ErrorCode.md +21 -21
- package/docs/enums/XXHashAlgorithm.md +2 -2
- package/docs/interfaces/AIChatAssistantMessageParam.md +6 -6
- package/docs/interfaces/AIChatContentPartImage.md +2 -2
- package/docs/interfaces/AIChatContentPartText.md +2 -2
- package/docs/interfaces/AIChatMessageParamBase.md +1 -1
- package/docs/interfaces/AIChatMessageToolCall.md +3 -3
- package/docs/interfaces/AIChatSystemMessageParam.md +3 -3
- package/docs/interfaces/AIChatToolMessageParam.md +4 -4
- package/docs/interfaces/AIChatUserMessageParam.md +7 -7
- package/docs/interfaces/AIChoiceConfig.md +7 -7
- package/docs/interfaces/AIResult.md +5 -5
- package/docs/interfaces/AIStreamParser.md +1 -1
- package/docs/interfaces/AIStreamParserOptions.md +1 -1
- package/docs/interfaces/BaseFunc.md +9 -9
- package/docs/interfaces/BaseFuncItem.md +8 -8
- package/docs/interfaces/CancelableAbilityOptions.md +8 -8
- package/docs/interfaces/ClientFuncItem.md +11 -11
- package/docs/interfaces/DotenvExpandOptions.md +3 -3
- package/docs/interfaces/DotenvExpandOutput.md +2 -2
- package/docs/interfaces/EventClientFuncParams.md +4 -4
- package/docs/interfaces/EventServerFuncParams.md +5 -5
- package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
- package/docs/interfaces/FuncItem.md +9 -9
- package/docs/interfaces/FuncParam.md +6 -6
- package/docs/interfaces/ParseObjectArgumentOptions.md +63 -0
- package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
- package/docs/interfaces/PromptTemplateOptions.md +6 -6
- package/docs/interfaces/RemoteFuncItem.md +11 -11
- package/docs/interfaces/ResClientFuncParams.md +2 -2
- package/docs/interfaces/ResServerFuncParams.md +5 -5
- package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
- package/docs/interfaces/ServerFuncItem.md +12 -12
- package/docs/interfaces/ServerFuncParams.md +2 -2
- package/docs/interfaces/StreamCallbacksAndOptions.md +4 -4
- package/docs/interfaces/TaskPromise.md +1 -1
- package/docs/interfaces/ToolFuncPackage.md +3 -3
- package/docs/modules.md +182 -181
- package/package.json +12 -10
- package/dist/chunk-4LD7IUUG.mjs +0 -1
- package/dist/chunk-U5DDQYSF.mjs +0 -1
- package/docs/interfaces/IOptions.md +0 -30
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export { e as AIModelNameRule, d as AIModelNameRuleFn, n as AbortError, j as Abo
|
|
|
6
6
|
import { BaseFactory } from 'custom-factory';
|
|
7
7
|
import { Event } from 'events-ex';
|
|
8
8
|
import * as _base32768 from 'base32768';
|
|
9
|
+
import _memoize, { Options } from 'memoizee';
|
|
9
10
|
export { NIL as uuidNIL, parse as uuidParse, stringify as uuidStringify, validate as uuidValidate, version as uuidVersion, v1 as uuidv1, v4 as uuidv4, v5 as uuidv5 } from 'uuid';
|
|
10
|
-
export
|
|
11
|
+
export { canonicalize } from 'json-canonicalize';
|
|
11
12
|
export { stringify as stringifyYaml } from 'yaml';
|
|
12
13
|
export { mimeType } from 'mime-type/with-db';
|
|
13
14
|
export { Config as ConfigFile } from 'load-config-file';
|
|
@@ -1315,16 +1316,21 @@ declare function loadTextFromPaths(filename: string, searchPaths?: string[], ext
|
|
|
1315
1316
|
* Optionally filters the results using a file matching callback.
|
|
1316
1317
|
*
|
|
1317
1318
|
* @param dir - A single directory path or an array of directory paths to start the search from.
|
|
1318
|
-
* @param isFileMatched - An optional callback that determines whether a file should be included in the result.
|
|
1319
|
+
* @param options.isFileMatched - An optional callback that determines whether a file should be included in the result.
|
|
1320
|
+
* @param options.signal - An optional signal to abort the operation.
|
|
1319
1321
|
* @returns An array of file paths that match the criteria.
|
|
1320
1322
|
*
|
|
1321
1323
|
* @example
|
|
1322
1324
|
* ```typescript
|
|
1323
|
-
* const files = readFilenamesRecursiveSync('/path/to/directory', (filepath) => filepath.endsWith('.js'));
|
|
1325
|
+
* const files = readFilenamesRecursiveSync('/path/to/directory', {isFileMatched: (filepath) => filepath.endsWith('.js')});
|
|
1324
1326
|
* console.log(files); // Outputs an array of JavaScript file paths.
|
|
1325
1327
|
* ```
|
|
1326
1328
|
*/
|
|
1327
|
-
declare function readFilenamesRecursiveSync(dir: string | string[],
|
|
1329
|
+
declare function readFilenamesRecursiveSync(dir: string | string[], options?: {
|
|
1330
|
+
isFileMatched?: (filepath: string) => boolean;
|
|
1331
|
+
signal?: AbortSignal;
|
|
1332
|
+
level?: number;
|
|
1333
|
+
}): string[];
|
|
1328
1334
|
/**
|
|
1329
1335
|
* Resolves the real file path, handling symbolic links.
|
|
1330
1336
|
*
|
|
@@ -1479,7 +1485,7 @@ declare class IntSet {
|
|
|
1479
1485
|
declare function countRegexMatches(content: string, regex: RegExp): number;
|
|
1480
1486
|
|
|
1481
1487
|
type ArgInfo = [boolean, string];
|
|
1482
|
-
type ArgProcessor = (arg: ArgInfo, ix: number, scope?: Record<string, any
|
|
1488
|
+
type ArgProcessor = (arg: ArgInfo, ix: number, scope?: Record<string, any>, options?: ParseObjectArgumentOptions) => string | void | Promise<string | void>;
|
|
1483
1489
|
interface AIChoiceConfig {
|
|
1484
1490
|
items?: string[];
|
|
1485
1491
|
maxPick?: number;
|
|
@@ -1489,6 +1495,13 @@ interface AIChoiceConfig {
|
|
|
1489
1495
|
type?: 'random' | 'ai';
|
|
1490
1496
|
end?: string;
|
|
1491
1497
|
}
|
|
1498
|
+
interface ParseObjectArgumentOptions {
|
|
1499
|
+
delimiter?: string;
|
|
1500
|
+
argProcessor?: ArgProcessor;
|
|
1501
|
+
returnArrayOnly?: boolean;
|
|
1502
|
+
templateFormat?: string;
|
|
1503
|
+
templateData?: Record<string, any>;
|
|
1504
|
+
}
|
|
1492
1505
|
/**
|
|
1493
1506
|
* Asynchronously parses a string of object arguments into an actual object.
|
|
1494
1507
|
* @param argsStr The string of arguments to be parsed.
|
|
@@ -1528,21 +1541,13 @@ interface AIChoiceConfig {
|
|
|
1528
1541
|
* console.log(arrayResult); // Output: [1, 2, 3]
|
|
1529
1542
|
* ```
|
|
1530
1543
|
*/
|
|
1531
|
-
declare function parseObjectArguments(argsStr: string, scope?: Record<string, any>, options?:
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
declare function parseObjectArgumentInfos(args: ArgInfo[], scope?: Record<string, any>, options?: {
|
|
1537
|
-
delimiter?: string;
|
|
1538
|
-
argProcessor?: ArgProcessor;
|
|
1539
|
-
returnArrayOnly?: boolean;
|
|
1540
|
-
}): Promise<any>;
|
|
1541
|
-
declare function ChoiceArgProcessor(argInfo: ArgInfo, _ix: number, scope?: Record<string, any>): string | undefined;
|
|
1542
|
-
declare function TemplateArgProcessor([isNamedArg, arg]: ArgInfo, ix: number, scope?: Record<string, any>): Promise<string | undefined>;
|
|
1543
|
-
declare function AIArgProcessor(argInfo: ArgInfo, ix: number, scope?: Record<string, any>): Promise<string | undefined>;
|
|
1544
|
+
declare function parseObjectArguments(argsStr: string, scope?: Record<string, any>, options?: ParseObjectArgumentOptions): Promise<any>;
|
|
1545
|
+
declare function parseObjectArgumentInfos(args: ArgInfo[], scope?: Record<string, any>, options?: ParseObjectArgumentOptions): Promise<any>;
|
|
1546
|
+
declare function ChoiceArgProcessor(argInfo: ArgInfo, _ix: number, scope?: Record<string, any>, options?: ParseObjectArgumentOptions): string | undefined;
|
|
1547
|
+
declare function TemplateArgProcessor([isNamedArg, arg]: ArgInfo, ix: number, scope?: Record<string, any>, options?: ParseObjectArgumentOptions): Promise<string | undefined>;
|
|
1548
|
+
declare function AIArgProcessor(argInfo: ArgInfo, ix: number, scope?: Record<string, any>, options?: ParseObjectArgumentOptions): Promise<string | undefined>;
|
|
1544
1549
|
declare function quoteStr(str: string): string;
|
|
1545
|
-
declare function parseObjectArgInfo(argInfo: ArgInfo, ix: number, scope?: Record<string, any>,
|
|
1550
|
+
declare function parseObjectArgInfo(argInfo: ArgInfo, ix: number, scope?: Record<string, any>, options?: ParseObjectArgumentOptions): Promise<string>;
|
|
1546
1551
|
/**
|
|
1547
1552
|
* Parses an object arguments string into an array of ArgInfo.
|
|
1548
1553
|
*
|
|
@@ -1558,16 +1563,12 @@ declare function parseObjectArgInfo(argInfo: ArgInfo, ix: number, scope?: Record
|
|
|
1558
1563
|
* @returns An array of parsed argument information, where each item contains a boolean indicating whether the argument is named,
|
|
1559
1564
|
* and the string representation of the argument.
|
|
1560
1565
|
*/
|
|
1561
|
-
declare function parseObjectArgumentsAsArgInfos(argsStr: string, scope?: Record<string, any>, options?:
|
|
1562
|
-
|
|
1563
|
-
argProcessor?: ArgProcessor;
|
|
1564
|
-
}): ArgInfo[];
|
|
1565
|
-
declare function parseCommand(commandStr: string, scope?: Record<string, any>, options?: {
|
|
1566
|
-
delimiter?: string;
|
|
1567
|
-
argProcessor?: ArgProcessor;
|
|
1568
|
-
}): Promise<{
|
|
1566
|
+
declare function parseObjectArgumentsAsArgInfos(argsStr: string, scope?: Record<string, any>, options?: ParseObjectArgumentOptions): ArgInfo[];
|
|
1567
|
+
declare function parseCommand(commandStr: string, scope?: Record<string, any>, options?: ParseObjectArgumentOptions): Promise<{
|
|
1569
1568
|
command: string;
|
|
1570
1569
|
args?: Record<string, any>;
|
|
1571
1570
|
}>;
|
|
1572
1571
|
|
|
1573
|
-
|
|
1572
|
+
declare function memoize<F extends (...args: any[]) => any>(fn: any, options?: Options<F>): F & _memoize.Memoized<F>;
|
|
1573
|
+
|
|
1574
|
+
export { AIArgProcessor, type AIChatAssistantMessageParam, type AIChatContentPart, type AIChatContentPartImage, type AIChatContentPartText, type AIChatMessageParam, type AIChatMessageParamBase, type AIChatMessageToolCall, type AIChatRole, AIChatRoles, type AIChatSystemMessageParam, type AIChatToolMessageParam, type AIChatUserMessageParam, type AIChoiceConfig, type AIMessageType, AIMessageTypes, AIModelNameRules, type AIResult, AIStream, type AIStreamParser, type AIStreamParserOptions, type AITextGenerationFinishReason, AITextGenerationFinishReasons, AsyncFeatures, type AsyncTaskId, BaseError, CancelableAbility, type CancelableAbilityOptions, ChoiceArgProcessor, CommonError, DefaultAsyncSemaphoreCapacity, type DotenvExpandOptions, type DotenvExpandOutput, type DotenvParseInput, type DotenvParseOutput, type DotenvPopulateInput, EventBusName, type EventErrorListenerFn, type EventListenerFn, EventName, FStringPromptTemplate, type FStringPromptTemplateNode, FewShotPromptTemplate, type FewShotPromptTemplateOptions, FilenameReservedRegex, GolangPromptTemplate, builtins as HFBuiltins, EnvironmentEx as HFEnvironment, Interpreter as HFInterpreter, Template as HFTemplate, HfPromptTemplate, IntSet, type JsonFilter, type ParseObjectArgumentOptions, PromptExampleSelector, type PromptExampleSelectorOptions, type PromptExamples, PromptTemplate, type PromptTemplateOptions, type PromptTemplateType, PromptTemplateTypes, type PromptType, PromptTypes, RStreamErrCode, RateLimit, ReadableStreamError, ResponseRStreamErrCode, type SanitizeFilenameOptions, Semaphore, type StreamCallbacksAndOptions, TaskAbortController, type TaskAbortControllers, type TaskPromise, TemplateArgProcessor, ToolFunc, WindowsReservedNameRegex, XXHashAlgorithm, backendEventable, base32768, countRegexMatches, createCallbacksTransformer, createEmptyReadableStream, createEndWithRepetitionDetector, createEventStreamTransformer, createHfValueFunc, dateToText, defaultTemplateFormat, expandEnv, expandObjEnv, extNameLevel, fileIsExists, filenameReservedRegex, filterValidFnScope, getAllEnumKeys, getConfigFileNames, getConfigs, getKeysPath, getMultiLevelExtname, getRealFilepath, getResponseErrorReadableStream, parse as hfParse, tokenize as hfTokenize, interpolateEnv, interpolateFString, interpolateGolangTemplate, isModelNameMatched, isValidFilename, isValidFilepath, isWebStream, jsonFilterToWhere, jsonToMarkdownStr, loadFileFromPaths, loadTextFromPaths, makeToolFuncCancelable, matchUrlProtocol, memoize, messagesToText, paramsSizeToScaleStr, parseCommand, parseFString, parseJsJson, parseObjectArgInfo, parseObjectArgumentInfos, parseObjectArguments, parseObjectArgumentsAsArgInfos, parseYaml, quoteStr, reControlCharsRegex, readFilenamesRecursiveSync, readableFromAsyncIterable, registerYamlTag, sanitizeFilename, sanitizeFilepath, saveConfigFile, scaleStrToParamsSize, sortedValues, splitSentence, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
|