@isdk/ai-tool 0.1.5 → 0.2.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-PXQPLL62.mjs +1 -0
- package/dist/chunk-W2LO3HZT.mjs +1 -0
- package/dist/find-port-qS1CZ9c-.d.mts +3 -0
- package/dist/find-port-qS1CZ9c-.d.ts +3 -0
- package/dist/funcs.d.mts +2 -2
- package/dist/funcs.d.ts +2 -2
- package/dist/funcs.js +1 -1
- package/dist/funcs.mjs +1 -1
- package/dist/{index-DvpywQaE.d.mts → index-nP9lSU6E.d.mts} +3 -151
- package/dist/{index-DvpywQaE.d.ts → index-nP9lSU6E.d.ts} +3 -151
- package/dist/index.d.mts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test/util.d.mts +3 -3
- package/dist/test/util.d.ts +3 -3
- package/dist/test/util.js +1 -1
- package/dist/test/util.mjs +1 -1
- package/docs/classes/AbortError.md +15 -15
- package/docs/classes/AlreadyExistsError.md +15 -15
- package/docs/classes/BaseError.md +16 -16
- package/docs/classes/CancelableAbility.md +20 -20
- package/docs/classes/ClientTools.md +55 -55
- package/docs/classes/CommonError.md +24 -24
- package/docs/classes/EventClient.md +77 -77
- package/docs/classes/EventServer.md +78 -78
- package/docs/classes/EventToolFunc.md +46 -46
- package/docs/classes/FStringPromptTemplate.md +18 -18
- package/docs/classes/FewShotPromptTemplate.md +22 -22
- package/docs/classes/GolangPromptTemplate.md +18 -18
- 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 +18 -18
- package/docs/classes/IntSet.md +12 -12
- package/docs/classes/NotFoundError.md +15 -15
- package/docs/classes/NotImplementationError.md +15 -15
- package/docs/classes/PromptExampleSelector.md +8 -8
- package/docs/classes/PromptTemplate.md +17 -17
- package/docs/classes/ReadableStreamError.md +15 -15
- package/docs/classes/ResClientTools.md +61 -61
- package/docs/classes/ResServerTools.md +62 -62
- package/docs/classes/SSEChannel.md +15 -15
- package/docs/classes/Semaphore.md +14 -14
- package/docs/classes/ServerTools.md +51 -51
- package/docs/classes/TaskAbortController.md +7 -7
- package/docs/classes/ToolFunc.md +43 -43
- 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 +2 -2
- 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 +5 -5
- 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 +194 -152
- package/package.json +3 -1
- package/dist/chunk-RNB2V3XB.mjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter, Event } from 'events-ex';
|
|
2
2
|
import { AdvancePropertyManager } from 'property-manager';
|
|
3
3
|
import { ICacheOptions, Cache } from 'secondary-cache';
|
|
4
|
-
import
|
|
4
|
+
import * as _isdk_common_error from '@isdk/common-error';
|
|
5
5
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
6
6
|
|
|
7
7
|
declare const ToolAsyncMultiTaskBit = 0;
|
|
@@ -162,154 +162,6 @@ interface RemoteFuncItem extends BaseFuncItem {
|
|
|
162
162
|
fetchOptions?: any;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
type ErrorCodeType = number | string;
|
|
166
|
-
declare enum ErrorCode {
|
|
167
|
-
OK = 200,
|
|
168
|
-
Accepted = 202,
|
|
169
|
-
BadRequest = 400,
|
|
170
|
-
InvalidArgument = 400,
|
|
171
|
-
Unauthorized = 401,
|
|
172
|
-
PaymentRequired = 402,
|
|
173
|
-
Forbidden = 403,
|
|
174
|
-
NotFound = 404,
|
|
175
|
-
MethodNotAllowed = 405,
|
|
176
|
-
NotAcceptable = 406,
|
|
177
|
-
RequestTimeout = 408,
|
|
178
|
-
Conflict = 409,
|
|
179
|
-
Corruption = 409,
|
|
180
|
-
TooManyRequests = 429,
|
|
181
|
-
Aborted = 499,
|
|
182
|
-
InternalError = 500,
|
|
183
|
-
NotImplemented = 501,
|
|
184
|
-
NotSupported = 501,
|
|
185
|
-
BadGateway = 502,
|
|
186
|
-
ServiceUnavailable = 503,// task is processing and Retry-After
|
|
187
|
-
GatewayTimeout = 504
|
|
188
|
-
}
|
|
189
|
-
declare const InternalErrorCode = ErrorCode.InternalError;
|
|
190
|
-
declare const NotImplementedErrorCode = ErrorCode.NotImplemented;
|
|
191
|
-
declare const NotFoundErrorCode = ErrorCode.NotFound;
|
|
192
|
-
declare const AlreadyExistsErrorCode = ErrorCode.Conflict;
|
|
193
|
-
declare const AbortErrorCode = ErrorCode.Aborted;
|
|
194
|
-
/**
|
|
195
|
-
* BaseError class that extends the Error class.
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
* // Create a custom error
|
|
199
|
-
* class CustomError extends BaseError {
|
|
200
|
-
* static code = 'customError';
|
|
201
|
-
* constructor(message: string) {
|
|
202
|
-
* super(message);
|
|
203
|
-
* }
|
|
204
|
-
* }
|
|
205
|
-
*
|
|
206
|
-
* // Throw the custom error
|
|
207
|
-
* throw new CustomError('This is a custom error');
|
|
208
|
-
*
|
|
209
|
-
* @description
|
|
210
|
-
* This class is used to create custom errors that extend the built-in Error class. It provides a way to define custom error codes and additional data associated with the error.
|
|
211
|
-
*
|
|
212
|
-
* @property {ErrorCodeType} code - The error code associated with the error.
|
|
213
|
-
* @property {string} caller - The name of the function that threw the error.
|
|
214
|
-
* @property {ErrorCodeType} code - The error code associated with the error.
|
|
215
|
-
* @property {any} data - Additional data associated with the error.
|
|
216
|
-
*
|
|
217
|
-
* @method toJSON - Returns a JSON representation of the error.
|
|
218
|
-
* @method fromJSON - Creates a new BaseError instance from a JSON representation.
|
|
219
|
-
*/
|
|
220
|
-
declare class BaseError extends AbstractError {
|
|
221
|
-
/**
|
|
222
|
-
* The error code associated with the error.
|
|
223
|
-
*/
|
|
224
|
-
static code: ErrorCodeType;
|
|
225
|
-
caller: string;
|
|
226
|
-
code: ErrorCodeType;
|
|
227
|
-
data?: any;
|
|
228
|
-
static createErrorClass(aType: string, aErrorCode?: number | string | typeof AbstractError, ParentErrorClass?: typeof BaseError): typeof BaseError;
|
|
229
|
-
/**
|
|
230
|
-
* Constructs a new BaseError instance.
|
|
231
|
-
*
|
|
232
|
-
* @param {string} message - The error message.
|
|
233
|
-
* @param {ErrorCodeType} [code] - The error code.
|
|
234
|
-
* @param {string|object} [name] - The error name or additional properties.
|
|
235
|
-
*/
|
|
236
|
-
constructor(message: string, code?: ErrorCodeType, name?: string | object);
|
|
237
|
-
/**
|
|
238
|
-
* Returns a JSON representation of the error.
|
|
239
|
-
*
|
|
240
|
-
* @returns {object} A JSON representation of the error.
|
|
241
|
-
*/
|
|
242
|
-
toJSON(): any;
|
|
243
|
-
/**
|
|
244
|
-
* Creates a new BaseError instance from a JSON representation.
|
|
245
|
-
*
|
|
246
|
-
* @param {object} json - A JSON representation of the error.
|
|
247
|
-
* @returns {BaseError} A new BaseError instance.
|
|
248
|
-
*/
|
|
249
|
-
fromJSON(json: any): BaseError;
|
|
250
|
-
}
|
|
251
|
-
declare class CommonError extends BaseError {
|
|
252
|
-
constructor(message: string, name?: string | Record<string, any>, status?: ErrorCodeType);
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Represents an error when a function or method is not implemented.
|
|
256
|
-
* Inherits from BaseError.
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* throw new NotImplementationError()
|
|
260
|
-
*
|
|
261
|
-
* @extends CommonError
|
|
262
|
-
*/
|
|
263
|
-
declare class NotImplementationError extends CommonError {
|
|
264
|
-
constructor(msg?: string, name?: string | Record<string, any>);
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Represents an error when a requested resource is not found.
|
|
268
|
-
* Inherits from BaseError.
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* throw new NotFoundError('user', { id: 123 })
|
|
272
|
-
*
|
|
273
|
-
* @extends CommonError
|
|
274
|
-
*/
|
|
275
|
-
declare class NotFoundError extends CommonError {
|
|
276
|
-
static code: ErrorCode;
|
|
277
|
-
constructor(what: string | number, name?: string | Record<string, any>);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Represents an error when a requested resource already exists.
|
|
281
|
-
* Inherits from BaseError.
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* throw new AlreadyExistsError('user', { id: 123 })
|
|
285
|
-
*
|
|
286
|
-
* @extends CommonError
|
|
287
|
-
*/
|
|
288
|
-
declare class AlreadyExistsError extends CommonError {
|
|
289
|
-
static code: ErrorCode;
|
|
290
|
-
constructor(what: string | number, name?: string | Record<string, any>);
|
|
291
|
-
}
|
|
292
|
-
declare class AbortError extends CommonError {
|
|
293
|
-
static code: ErrorCode;
|
|
294
|
-
constructor(what?: string, name?: string | Record<string, any>);
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Create an error object
|
|
298
|
-
* @param message - Error message
|
|
299
|
-
* @param name - Error name, optional
|
|
300
|
-
* @param status - Error status code, default to 500
|
|
301
|
-
* @returns Error object
|
|
302
|
-
*/
|
|
303
|
-
declare function createError(message: string, name?: string | Record<string, any>, status?: ErrorCode | ErrorCodeType): CommonError;
|
|
304
|
-
/**
|
|
305
|
-
* Throw an error
|
|
306
|
-
* @param message - Error message
|
|
307
|
-
* @param name - Error name, optional
|
|
308
|
-
* @param status - Error status code, default to 500
|
|
309
|
-
* @throws {BaseError} Throws a BaseError object
|
|
310
|
-
*/
|
|
311
|
-
declare function throwError(message: string, name?: string | Record<string, any>, status?: ErrorCode | ErrorCodeType): void;
|
|
312
|
-
|
|
313
165
|
type Events = (string | RegExp)[];
|
|
314
166
|
type Client = {
|
|
315
167
|
req: IncomingMessage;
|
|
@@ -391,7 +243,7 @@ declare class ClientTools extends ToolFunc {
|
|
|
391
243
|
static fetch(name: string, objParam?: any): Promise<any>;
|
|
392
244
|
getUrlParams(objParam: any): string;
|
|
393
245
|
fetch(objParam?: any, act?: ActionName, subName?: any): Promise<Response>;
|
|
394
|
-
errorFrom(res: Response): Promise<CommonError>;
|
|
246
|
+
errorFrom(res: Response): Promise<_isdk_common_error.CommonError>;
|
|
395
247
|
func(objParam: any): Promise<any>;
|
|
396
248
|
}
|
|
397
249
|
declare const ClientToolFuncSchema: {
|
|
@@ -626,4 +478,4 @@ declare const eventServer: EventServer;
|
|
|
626
478
|
|
|
627
479
|
declare function registerCoreTools(): void;
|
|
628
480
|
|
|
629
|
-
export {
|
|
481
|
+
export { AsyncFeatures as A, type BaseFuncItem as B, type ClientFuncItem as C, event as D, EventToolFunc as E, type FuncParamType as F, createLRUCache as G, lrucache as H, type EventClientFuncParams as I, EventClient as J, eventClient as K, type EventServerFuncParams as L, EventServer as M, eventServer as N, type ResClientFuncParams as O, PASSING_SCORE as P, ResClientTools as Q, RemoteToolFuncSchema as R, SSEChannelAlreadyClosedErrCode as S, ToolFunc as T, type ResServerFuncParams as U, ResServerTools as V, _lrucache as _, type AIModelNameRules as a, ActionNames as b, type ActionName as c, type AIModelNameRuleFn as d, type AIModelNameRule as e, type RemoteFuncItem as f, SSEChannel as g, ToolAsyncMultiTaskBit as h, ToolAsyncCancelableBit as i, ToolAsyncPriorityBit as j, AsyncFeatureBits as k, type FuncParam as l, type FuncParams as m, type TFunc as n, type FuncItem as o, type BaseFunc as p, type Funcs as q, type ToolFuncPackage as r, ToolFuncSchema as s, ClientTools as t, ClientToolFuncSchema as u, type ServerFuncParams as v, type ServerFuncItem as w, ServerTools as x, ServerToolFuncSchema as y, registerCoreTools as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as custom_ability from 'custom-ability';
|
|
2
2
|
import { AbilityOptions } from 'custom-ability';
|
|
3
3
|
export { createAbilityInjector } from 'custom-ability';
|
|
4
|
-
import { A as AsyncFeatures,
|
|
5
|
-
export { e as AIModelNameRule, d as AIModelNameRuleFn,
|
|
4
|
+
import { A as AsyncFeatures, T as ToolFunc, a as AIModelNameRules } from './index-nP9lSU6E.mjs';
|
|
5
|
+
export { e as AIModelNameRule, d as AIModelNameRuleFn, c as ActionName, b as ActionNames, k as AsyncFeatureBits, p as BaseFunc, B as BaseFuncItem, C as ClientFuncItem, u as ClientToolFuncSchema, t as ClientTools, J as EventClient, I as EventClientFuncParams, M as EventServer, L as EventServerFuncParams, E as EventToolFunc, o as FuncItem, l as FuncParam, F as FuncParamType, m as FuncParams, q as Funcs, P as PASSING_SCORE, f as RemoteFuncItem, R as RemoteToolFuncSchema, O as ResClientFuncParams, Q as ResClientTools, U as ResServerFuncParams, V as ResServerTools, g as SSEChannel, S as SSEChannelAlreadyClosedErrCode, w as ServerFuncItem, v as ServerFuncParams, y as ServerToolFuncSchema, x as ServerTools, n as TFunc, i as ToolAsyncCancelableBit, h as ToolAsyncMultiTaskBit, j as ToolAsyncPriorityBit, r as ToolFuncPackage, s as ToolFuncSchema, _ as _lrucache, G as createLRUCache, D as event, K as eventClient, N as eventServer, H as lrucache, z as registerCoreTools } from './index-nP9lSU6E.mjs';
|
|
6
|
+
import { CommonError, BaseError } from '@isdk/common-error';
|
|
7
|
+
export { AbortError, AbortErrorCode, AlreadyExistsError, AlreadyExistsErrorCode, BaseError, CommonError, ErrorCode, InternalErrorCode, NotFoundError, NotFoundErrorCode, NotImplementationError, NotImplementedErrorCode, createError, throwError } from '@isdk/common-error';
|
|
6
8
|
import { BaseFactory } from 'custom-factory';
|
|
7
9
|
import { Event } from 'events-ex';
|
|
8
10
|
import * as _base32768 from 'base32768';
|
|
9
11
|
import _memoize, { Options } from 'memoizee';
|
|
12
|
+
export { f as findPort } from './find-port-qS1CZ9c-.mjs';
|
|
10
13
|
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';
|
|
11
14
|
export { canonicalize } from 'json-canonicalize';
|
|
12
15
|
export { stringify as stringifyYaml } from 'yaml';
|
|
@@ -15,7 +18,6 @@ export { Config as ConfigFile } from 'load-config-file';
|
|
|
15
18
|
export { formatISO, parse as parseDateFormat, parseISO, toDate } from 'date-fns';
|
|
16
19
|
import 'property-manager';
|
|
17
20
|
import 'secondary-cache';
|
|
18
|
-
import 'abstract-error';
|
|
19
21
|
import 'http';
|
|
20
22
|
|
|
21
23
|
declare const DefaultAsyncSemaphoreCapacity = 32;
|
|
@@ -1572,4 +1574,20 @@ declare function parseCommand(commandStr: string, scope?: Record<string, any>, o
|
|
|
1572
1574
|
|
|
1573
1575
|
declare function memoize<F extends (...args: any[]) => any>(fn: any, options?: Options<F>): F & _memoize.Memoized<F>;
|
|
1574
1576
|
|
|
1575
|
-
|
|
1577
|
+
/**
|
|
1578
|
+
* Retrieves the package directory from the current working directory.
|
|
1579
|
+
*
|
|
1580
|
+
* @param cwd - The current working directory.
|
|
1581
|
+
*
|
|
1582
|
+
* Notes:
|
|
1583
|
+
* - The project root directory must contain either the `src` (source files directory) or `dist` (compiled files directory) as a fallback.
|
|
1584
|
+
* - If `packageDirectorySync` fails to find the package directory, it falls back to checking for `src` or `dist` directories.
|
|
1585
|
+
* - If none of these directories are found, an error is thrown.
|
|
1586
|
+
* * @example
|
|
1587
|
+
* // Example usage
|
|
1588
|
+
* const packageDir = getPackageDir(__dirname);
|
|
1589
|
+
* console.log(packageDir); // Output: '/path/to/project'
|
|
1590
|
+
*/
|
|
1591
|
+
declare function getPackageDir(cwd: string): string;
|
|
1592
|
+
|
|
1593
|
+
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, CancelableAbility, type CancelableAbilityOptions, ChoiceArgProcessor, 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, getPackageDir, 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, simplifyObjectArguments, sortedValues, splitSentence, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as custom_ability from 'custom-ability';
|
|
2
2
|
import { AbilityOptions } from 'custom-ability';
|
|
3
3
|
export { createAbilityInjector } from 'custom-ability';
|
|
4
|
-
import { A as AsyncFeatures,
|
|
5
|
-
export { e as AIModelNameRule, d as AIModelNameRuleFn,
|
|
4
|
+
import { A as AsyncFeatures, T as ToolFunc, a as AIModelNameRules } from './index-nP9lSU6E.js';
|
|
5
|
+
export { e as AIModelNameRule, d as AIModelNameRuleFn, c as ActionName, b as ActionNames, k as AsyncFeatureBits, p as BaseFunc, B as BaseFuncItem, C as ClientFuncItem, u as ClientToolFuncSchema, t as ClientTools, J as EventClient, I as EventClientFuncParams, M as EventServer, L as EventServerFuncParams, E as EventToolFunc, o as FuncItem, l as FuncParam, F as FuncParamType, m as FuncParams, q as Funcs, P as PASSING_SCORE, f as RemoteFuncItem, R as RemoteToolFuncSchema, O as ResClientFuncParams, Q as ResClientTools, U as ResServerFuncParams, V as ResServerTools, g as SSEChannel, S as SSEChannelAlreadyClosedErrCode, w as ServerFuncItem, v as ServerFuncParams, y as ServerToolFuncSchema, x as ServerTools, n as TFunc, i as ToolAsyncCancelableBit, h as ToolAsyncMultiTaskBit, j as ToolAsyncPriorityBit, r as ToolFuncPackage, s as ToolFuncSchema, _ as _lrucache, G as createLRUCache, D as event, K as eventClient, N as eventServer, H as lrucache, z as registerCoreTools } from './index-nP9lSU6E.js';
|
|
6
|
+
import { CommonError, BaseError } from '@isdk/common-error';
|
|
7
|
+
export { AbortError, AbortErrorCode, AlreadyExistsError, AlreadyExistsErrorCode, BaseError, CommonError, ErrorCode, InternalErrorCode, NotFoundError, NotFoundErrorCode, NotImplementationError, NotImplementedErrorCode, createError, throwError } from '@isdk/common-error';
|
|
6
8
|
import { BaseFactory } from 'custom-factory';
|
|
7
9
|
import { Event } from 'events-ex';
|
|
8
10
|
import * as _base32768 from 'base32768';
|
|
9
11
|
import _memoize, { Options } from 'memoizee';
|
|
12
|
+
export { f as findPort } from './find-port-qS1CZ9c-.js';
|
|
10
13
|
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';
|
|
11
14
|
export { canonicalize } from 'json-canonicalize';
|
|
12
15
|
export { stringify as stringifyYaml } from 'yaml';
|
|
@@ -15,7 +18,6 @@ export { Config as ConfigFile } from 'load-config-file';
|
|
|
15
18
|
export { formatISO, parse as parseDateFormat, parseISO, toDate } from 'date-fns';
|
|
16
19
|
import 'property-manager';
|
|
17
20
|
import 'secondary-cache';
|
|
18
|
-
import 'abstract-error';
|
|
19
21
|
import 'http';
|
|
20
22
|
|
|
21
23
|
declare const DefaultAsyncSemaphoreCapacity = 32;
|
|
@@ -1572,4 +1574,20 @@ declare function parseCommand(commandStr: string, scope?: Record<string, any>, o
|
|
|
1572
1574
|
|
|
1573
1575
|
declare function memoize<F extends (...args: any[]) => any>(fn: any, options?: Options<F>): F & _memoize.Memoized<F>;
|
|
1574
1576
|
|
|
1575
|
-
|
|
1577
|
+
/**
|
|
1578
|
+
* Retrieves the package directory from the current working directory.
|
|
1579
|
+
*
|
|
1580
|
+
* @param cwd - The current working directory.
|
|
1581
|
+
*
|
|
1582
|
+
* Notes:
|
|
1583
|
+
* - The project root directory must contain either the `src` (source files directory) or `dist` (compiled files directory) as a fallback.
|
|
1584
|
+
* - If `packageDirectorySync` fails to find the package directory, it falls back to checking for `src` or `dist` directories.
|
|
1585
|
+
* - If none of these directories are found, an error is thrown.
|
|
1586
|
+
* * @example
|
|
1587
|
+
* // Example usage
|
|
1588
|
+
* const packageDir = getPackageDir(__dirname);
|
|
1589
|
+
* console.log(packageDir); // Output: '/path/to/project'
|
|
1590
|
+
*/
|
|
1591
|
+
declare function getPackageDir(cwd: string): string;
|
|
1592
|
+
|
|
1593
|
+
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, CancelableAbility, type CancelableAbilityOptions, ChoiceArgProcessor, 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, getPackageDir, 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, simplifyObjectArguments, sortedValues, splitSentence, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
|