@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.
Files changed (89) hide show
  1. package/dist/chunk-PXQPLL62.mjs +1 -0
  2. package/dist/chunk-W2LO3HZT.mjs +1 -0
  3. package/dist/find-port-qS1CZ9c-.d.mts +3 -0
  4. package/dist/find-port-qS1CZ9c-.d.ts +3 -0
  5. package/dist/funcs.d.mts +2 -2
  6. package/dist/funcs.d.ts +2 -2
  7. package/dist/funcs.js +1 -1
  8. package/dist/funcs.mjs +1 -1
  9. package/dist/{index-DvpywQaE.d.mts → index-nP9lSU6E.d.mts} +3 -151
  10. package/dist/{index-DvpywQaE.d.ts → index-nP9lSU6E.d.ts} +3 -151
  11. package/dist/index.d.mts +22 -4
  12. package/dist/index.d.ts +22 -4
  13. package/dist/index.js +1 -1
  14. package/dist/index.mjs +1 -1
  15. package/dist/test/util.d.mts +3 -3
  16. package/dist/test/util.d.ts +3 -3
  17. package/dist/test/util.js +1 -1
  18. package/dist/test/util.mjs +1 -1
  19. package/docs/classes/AbortError.md +15 -15
  20. package/docs/classes/AlreadyExistsError.md +15 -15
  21. package/docs/classes/BaseError.md +16 -16
  22. package/docs/classes/CancelableAbility.md +20 -20
  23. package/docs/classes/ClientTools.md +55 -55
  24. package/docs/classes/CommonError.md +24 -24
  25. package/docs/classes/EventClient.md +77 -77
  26. package/docs/classes/EventServer.md +78 -78
  27. package/docs/classes/EventToolFunc.md +46 -46
  28. package/docs/classes/FStringPromptTemplate.md +18 -18
  29. package/docs/classes/FewShotPromptTemplate.md +22 -22
  30. package/docs/classes/GolangPromptTemplate.md +18 -18
  31. package/docs/classes/HFEnvironment.md +9 -9
  32. package/docs/classes/HFInterpreter.md +19 -19
  33. package/docs/classes/HFTemplate.md +4 -4
  34. package/docs/classes/HfPromptTemplate.md +18 -18
  35. package/docs/classes/IntSet.md +12 -12
  36. package/docs/classes/NotFoundError.md +15 -15
  37. package/docs/classes/NotImplementationError.md +15 -15
  38. package/docs/classes/PromptExampleSelector.md +8 -8
  39. package/docs/classes/PromptTemplate.md +17 -17
  40. package/docs/classes/ReadableStreamError.md +15 -15
  41. package/docs/classes/ResClientTools.md +61 -61
  42. package/docs/classes/ResServerTools.md +62 -62
  43. package/docs/classes/SSEChannel.md +15 -15
  44. package/docs/classes/Semaphore.md +14 -14
  45. package/docs/classes/ServerTools.md +51 -51
  46. package/docs/classes/TaskAbortController.md +7 -7
  47. package/docs/classes/ToolFunc.md +43 -43
  48. package/docs/enums/AsyncFeatureBits.md +3 -3
  49. package/docs/enums/AsyncFeatures.md +3 -3
  50. package/docs/enums/ErrorCode.md +21 -21
  51. package/docs/enums/XXHashAlgorithm.md +2 -2
  52. package/docs/interfaces/AIChatAssistantMessageParam.md +6 -6
  53. package/docs/interfaces/AIChatContentPartImage.md +2 -2
  54. package/docs/interfaces/AIChatContentPartText.md +2 -2
  55. package/docs/interfaces/AIChatMessageParamBase.md +1 -1
  56. package/docs/interfaces/AIChatMessageToolCall.md +3 -3
  57. package/docs/interfaces/AIChatSystemMessageParam.md +3 -3
  58. package/docs/interfaces/AIChatToolMessageParam.md +4 -4
  59. package/docs/interfaces/AIChatUserMessageParam.md +7 -7
  60. package/docs/interfaces/AIChoiceConfig.md +7 -7
  61. package/docs/interfaces/AIResult.md +5 -5
  62. package/docs/interfaces/AIStreamParser.md +1 -1
  63. package/docs/interfaces/AIStreamParserOptions.md +1 -1
  64. package/docs/interfaces/BaseFunc.md +9 -9
  65. package/docs/interfaces/BaseFuncItem.md +8 -8
  66. package/docs/interfaces/CancelableAbilityOptions.md +2 -2
  67. package/docs/interfaces/ClientFuncItem.md +11 -11
  68. package/docs/interfaces/DotenvExpandOptions.md +3 -3
  69. package/docs/interfaces/DotenvExpandOutput.md +2 -2
  70. package/docs/interfaces/EventClientFuncParams.md +4 -4
  71. package/docs/interfaces/EventServerFuncParams.md +5 -5
  72. package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
  73. package/docs/interfaces/FuncItem.md +9 -9
  74. package/docs/interfaces/FuncParam.md +6 -6
  75. package/docs/interfaces/ParseObjectArgumentOptions.md +5 -5
  76. package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
  77. package/docs/interfaces/PromptTemplateOptions.md +6 -6
  78. package/docs/interfaces/RemoteFuncItem.md +11 -11
  79. package/docs/interfaces/ResClientFuncParams.md +2 -2
  80. package/docs/interfaces/ResServerFuncParams.md +5 -5
  81. package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
  82. package/docs/interfaces/ServerFuncItem.md +12 -12
  83. package/docs/interfaces/ServerFuncParams.md +2 -2
  84. package/docs/interfaces/StreamCallbacksAndOptions.md +4 -4
  85. package/docs/interfaces/TaskPromise.md +1 -1
  86. package/docs/interfaces/ToolFuncPackage.md +3 -3
  87. package/docs/modules.md +194 -152
  88. package/package.json +3 -1
  89. 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 { AbstractError } from 'abstract-error';
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 { lrucache as $, AsyncFeatures as A, BaseError as B, CommonError as C, type BaseFunc as D, type ErrorCodeType as E, type FuncParamType as F, type Funcs as G, type ToolFuncPackage as H, InternalErrorCode as I, ToolFuncSchema as J, type ClientFuncItem as K, ClientTools as L, ClientToolFuncSchema as M, NotImplementedErrorCode as N, type ServerFuncParams as O, PASSING_SCORE as P, type ServerFuncItem as Q, RemoteToolFuncSchema as R, SSEChannelAlreadyClosedErrCode as S, ToolFunc as T, ServerTools as U, ServerToolFuncSchema as V, registerCoreTools as W, EventToolFunc as X, event as Y, createLRUCache as Z, _lrucache as _, type AIModelNameRules as a, type EventClientFuncParams as a0, EventClient as a1, eventClient as a2, type EventServerFuncParams as a3, EventServer as a4, eventServer as a5, type ResClientFuncParams as a6, ResClientTools as a7, type ResServerFuncParams as a8, ResServerTools as a9, ActionNames as b, type ActionName as c, type AIModelNameRuleFn as d, type AIModelNameRule as e, type RemoteFuncItem as f, ErrorCode as g, NotFoundErrorCode as h, AlreadyExistsErrorCode as i, AbortErrorCode as j, NotImplementationError as k, NotFoundError as l, AlreadyExistsError as m, AbortError as n, createError as o, SSEChannel as p, ToolAsyncMultiTaskBit as q, ToolAsyncCancelableBit as r, ToolAsyncPriorityBit as s, throwError as t, AsyncFeatureBits as u, type FuncParam as v, type FuncParams as w, type TFunc as x, type BaseFuncItem as y, type FuncItem as z };
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, C as CommonError, T as ToolFunc, B as BaseError, a as AIModelNameRules } from './index-DvpywQaE.mjs';
5
- export { e as AIModelNameRule, d as AIModelNameRuleFn, n as AbortError, j as AbortErrorCode, c as ActionName, b as ActionNames, m as AlreadyExistsError, i as AlreadyExistsErrorCode, u as AsyncFeatureBits, D as BaseFunc, y as BaseFuncItem, K as ClientFuncItem, M as ClientToolFuncSchema, L as ClientTools, g as ErrorCode, E as ErrorCodeType, a1 as EventClient, a0 as EventClientFuncParams, a4 as EventServer, a3 as EventServerFuncParams, X as EventToolFunc, z as FuncItem, v as FuncParam, F as FuncParamType, w as FuncParams, G as Funcs, I as InternalErrorCode, l as NotFoundError, h as NotFoundErrorCode, k as NotImplementationError, N as NotImplementedErrorCode, P as PASSING_SCORE, f as RemoteFuncItem, R as RemoteToolFuncSchema, a6 as ResClientFuncParams, a7 as ResClientTools, a8 as ResServerFuncParams, a9 as ResServerTools, p as SSEChannel, S as SSEChannelAlreadyClosedErrCode, Q as ServerFuncItem, O as ServerFuncParams, V as ServerToolFuncSchema, U as ServerTools, x as TFunc, r as ToolAsyncCancelableBit, q as ToolAsyncMultiTaskBit, s as ToolAsyncPriorityBit, H as ToolFuncPackage, J as ToolFuncSchema, _ as _lrucache, o as createError, Z as createLRUCache, Y as event, a2 as eventClient, a5 as eventServer, $ as lrucache, W as registerCoreTools, t as throwError } from './index-DvpywQaE.mjs';
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
- 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, simplifyObjectArguments, sortedValues, splitSentence, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
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, C as CommonError, T as ToolFunc, B as BaseError, a as AIModelNameRules } from './index-DvpywQaE.js';
5
- export { e as AIModelNameRule, d as AIModelNameRuleFn, n as AbortError, j as AbortErrorCode, c as ActionName, b as ActionNames, m as AlreadyExistsError, i as AlreadyExistsErrorCode, u as AsyncFeatureBits, D as BaseFunc, y as BaseFuncItem, K as ClientFuncItem, M as ClientToolFuncSchema, L as ClientTools, g as ErrorCode, E as ErrorCodeType, a1 as EventClient, a0 as EventClientFuncParams, a4 as EventServer, a3 as EventServerFuncParams, X as EventToolFunc, z as FuncItem, v as FuncParam, F as FuncParamType, w as FuncParams, G as Funcs, I as InternalErrorCode, l as NotFoundError, h as NotFoundErrorCode, k as NotImplementationError, N as NotImplementedErrorCode, P as PASSING_SCORE, f as RemoteFuncItem, R as RemoteToolFuncSchema, a6 as ResClientFuncParams, a7 as ResClientTools, a8 as ResServerFuncParams, a9 as ResServerTools, p as SSEChannel, S as SSEChannelAlreadyClosedErrCode, Q as ServerFuncItem, O as ServerFuncParams, V as ServerToolFuncSchema, U as ServerTools, x as TFunc, r as ToolAsyncCancelableBit, q as ToolAsyncMultiTaskBit, s as ToolAsyncPriorityBit, H as ToolFuncPackage, J as ToolFuncSchema, _ as _lrucache, o as createError, Z as createLRUCache, Y as event, a2 as eventClient, a5 as eventServer, $ as lrucache, W as registerCoreTools, t as throwError } from './index-DvpywQaE.js';
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
- 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, simplifyObjectArguments, sortedValues, splitSentence, textToDate, toDateTime, trimStartOfStreamHelper, truncTo, uuid, wait, xxhash, xxhash32, xxhash64, xxhashAsStr };
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 };