@faapi/faapi 6.8.0 → 6.9.1
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/cli/index.js +384 -267
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +26 -12
- package/dist/index.js +353 -247
- package/dist/index.js.map +1 -1
- package/dist/{routeTypes-J5pPbjwR.d.ts → routeTypes-CuGMDCGB.d.ts} +20 -4
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +54 -16
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AppRegistries, R as RouteManifest, F as FaapiContext, C as CorsOptions, T as TaskClient, H as HelmetOptions, L as LoggerOptions, a as LogConfig, b as FaapiMiddleware, I as InjectorMap, c as TaskFailedHandler, d as TaskQueueDeps, e as TaskQueue, f as TaskDriver, g as TaskRegistry, h as TaskManifest, i as ToolMetadata, j as AgentCore, k as AgentMetadata, l as CreateLoggerOptions, m as Logger, W as WsRouteManifest } from './routeTypes-
|
|
2
|
-
export { n as AgentHandleFactory, o as AgentHandleStore, p as AgentPathMeta, q as AgentRegistry, r as AgentToolDescriptor, s as FaapiContextConfig, t as FaapiTaskMeta, u as FailOptions, v as Injector, w as LogEntry, x as LogLevel, y as LogSink, z as RouteInfo, B as RouteInputSchema, D as RouteOutputSchema, E as RouteParamSchema, S as SkillRegistry, G as SseEvent, J as SseWriter, K as TaskContext, M as TaskDriverJob, N as TaskDriverProcess, O as TaskDriverRecord, P as TaskFailedInfo, Q as TaskJob, U as TaskJobStatus, V as TaskMetadata, X as TaskModule, Y as TaskRegistriesSnapshot, Z as TaskRegistriesView, _ as ToolCore, $ as ToolPathMeta, a0 as ToolRegistry, a1 as cors, a2 as createAppRegistries, a3 as createTaskRegistriesView, a4 as createTaskRegistry, a5 as helmet, a6 as logger } from './routeTypes-
|
|
1
|
+
import { A as AppRegistries, R as RouteManifest, F as FaapiContext, C as CorsOptions, T as TaskClient, H as HelmetOptions, L as LoggerOptions, a as LogConfig, b as FaapiMiddleware, I as InjectorMap, c as TaskFailedHandler, d as TaskQueueDeps, e as TaskQueue, f as TaskDriver, g as TaskRegistry, h as TaskManifest, i as ToolMetadata, j as AgentCore, k as AgentMetadata, l as CreateLoggerOptions, m as Logger, W as WsRouteManifest } from './routeTypes-CuGMDCGB.js';
|
|
2
|
+
export { n as AgentHandleFactory, o as AgentHandleStore, p as AgentPathMeta, q as AgentRegistry, r as AgentToolDescriptor, s as FaapiContextConfig, t as FaapiTaskMeta, u as FailOptions, v as Injector, w as LogEntry, x as LogLevel, y as LogSink, z as RouteInfo, B as RouteInputSchema, D as RouteOutputSchema, E as RouteParamSchema, S as SkillRegistry, G as SseEvent, J as SseWriter, K as TaskContext, M as TaskDriverJob, N as TaskDriverProcess, O as TaskDriverRecord, P as TaskFailedInfo, Q as TaskJob, U as TaskJobStatus, V as TaskMetadata, X as TaskModule, Y as TaskRegistriesSnapshot, Z as TaskRegistriesView, _ as ToolCore, $ as ToolPathMeta, a0 as ToolRegistry, a1 as cors, a2 as createAppRegistries, a3 as createTaskRegistriesView, a4 as createTaskRegistry, a5 as helmet, a6 as logger } from './routeTypes-CuGMDCGB.js';
|
|
3
3
|
import * as node_http from 'node:http';
|
|
4
4
|
import { Server, IncomingMessage, ServerResponse } from 'node:http';
|
|
5
5
|
import { Socket } from 'node:net';
|
|
@@ -553,20 +553,26 @@ interface FaapiConfig {
|
|
|
553
553
|
/** 日志中间件配置 */
|
|
554
554
|
logger?: LoggerOptions | boolean;
|
|
555
555
|
/**
|
|
556
|
-
*
|
|
556
|
+
* 业务日志器全局配置(详见 logger/logger.md)
|
|
557
557
|
*
|
|
558
|
-
* - `false`:完全静默(含 error
|
|
558
|
+
* - `false`:完全静默(含 error,测试降噪;不影响请求日志,关闭用 `logger: false`)
|
|
559
559
|
* - `true` / 缺省:默认级别(显式 level > LOG_LEVEL env > 'info')+ console 文本输出
|
|
560
|
-
* - `LogConfig
|
|
560
|
+
* - `LogConfig`:精细配置——`sink` 自定义管道(接 pino/winston)或 `dir` egg 风格
|
|
561
|
+
* 文件输出(app.log 全量 + error.log 仅 error,splitByLevel 按级别四文件),
|
|
562
|
+
* 两者互斥;`dir` 模式请求日志自动并入(`accessLog` 缺省 true),未显式配置
|
|
563
|
+
* level 时不过滤(全量落盘)
|
|
561
564
|
*
|
|
562
|
-
* 生效范围:`ctx.log` / 参数注入 `log` / `createLogger` / `taskCtx.log
|
|
565
|
+
* 生效范围:`ctx.log` / 参数注入 `log` / `createLogger` / `taskCtx.log`,
|
|
566
|
+
* `dir`/`accessLog` 模式下含请求日志中间件。
|
|
563
567
|
* 日志全局配置是进程级资源,多 app 同进程时后启动覆盖先启动。
|
|
564
568
|
*
|
|
565
569
|
* ```ts
|
|
566
570
|
* export default {
|
|
567
571
|
* log: {
|
|
568
|
-
*
|
|
569
|
-
*
|
|
572
|
+
* // 方式一:egg 风格文件输出(请求日志自动并入)
|
|
573
|
+
* dir: 'logs',
|
|
574
|
+
* // 方式二:自定义管道接管
|
|
575
|
+
* // sink: (entry) => pinoLogger[entry.level]({ scope: entry.scope, ...entry.fields }, entry.message),
|
|
570
576
|
* },
|
|
571
577
|
* } satisfies FaapiConfig;
|
|
572
578
|
* ```
|
|
@@ -1490,14 +1496,22 @@ declare function loadEnv(rootDir: string): void;
|
|
|
1490
1496
|
* 设置全局日志配置(进程级,`createAppBase` 启动时以 `config.log` 调用)
|
|
1491
1497
|
*
|
|
1492
1498
|
* - `false`:完全静默(含 error,测试降噪场景)
|
|
1493
|
-
* - `true` / `{}`:默认级别(显式 level > LOG_LEVEL env >
|
|
1494
|
-
* - `{ level, sink }
|
|
1499
|
+
* - `true` / `{}`:默认级别(显式 level > LOG_LEVEL env > 模式默认)+ 默认 console sink
|
|
1500
|
+
* - `{ level, sink }`:自定义管道接管(与 dir 互斥,同时配置抛错)
|
|
1501
|
+
* - `{ dir, splitByLevel?, stdout?, accessLog? }`:egg 风格文件输出(fileSink.md)
|
|
1495
1502
|
* - `undefined`:重置为默认(编程式多 app 切换全局配置用)
|
|
1496
1503
|
*
|
|
1497
1504
|
* LOG_LEVEL env 仅在本函数读取——app 启动路径必经此处(env 非法在启动期报错);
|
|
1498
|
-
* 纯编程式不调本函数时 env
|
|
1505
|
+
* 纯编程式不调本函数时 env 不生效。
|
|
1499
1506
|
*/
|
|
1500
1507
|
declare function configureLogging(config?: LogConfig | boolean | undefined): void;
|
|
1508
|
+
/**
|
|
1509
|
+
* 刷盘文件日志缓冲(不结束流,flush 后可继续写)
|
|
1510
|
+
*
|
|
1511
|
+
* 优雅停机场景在 `lifecycle.onClose` 调用,确保缓冲中的条目落盘后再退出进程;
|
|
1512
|
+
* 测试场景断言文件内容前调用。无文件管道(未配置 `config.log.dir`)时为 no-op。
|
|
1513
|
+
*/
|
|
1514
|
+
declare function flushLogging(): Promise<void>;
|
|
1501
1515
|
/**
|
|
1502
1516
|
* 创建日志器
|
|
1503
1517
|
*
|
|
@@ -1706,4 +1720,4 @@ type ProdApp = AppBase;
|
|
|
1706
1720
|
*/
|
|
1707
1721
|
declare function createProdApp(options?: CreateAppOptions): Promise<ProdApp>;
|
|
1708
1722
|
|
|
1709
|
-
export { type AgentConfig, AgentCore, AgentMetadata, type AgentModule, type ProdApp as App, AppRegistries, CorsOptions, type CreateAppOptions, CreateLoggerOptions, type CronScheduler, type DevApp, type FaapiConfig, FaapiContext, FaapiError, FaapiMiddleware, type FaapiPlugin, type HandlerTypeInfo, HelmetOptions, type InjectOptions, type InjectResponse, InjectorMap, InternalError, type LifecycleContext, type LifecycleHooks, type LlmConfig, type LlmModelConfig, LogConfig, Logger, LoggerOptions, MethodNotAllowedError, ModuleLoadError, type PluginContext, type PluginDeclaration, type ProdApp, type PropertyType, type RequestHandler, type ResponseConfig, RouteManifest, RouteNotFoundError, type RouteSchemaSource, type RuntimeType, SchemaExtractionError, TASK_PATTERNS, type TaskBullMqOptions, TaskClient, type TaskConfig, TaskDriver, TaskFailedHandler, TaskManifest, type TaskPgBossOptions, TaskQueue, TaskRegistry, ToolMetadata, type ToolModule, type ToolSchemaModule, type TypeConstraint, type UpgradeHandler, ValidationError, type ValidationErrorCode, type ValidationIssue, type WsContext, type WsEventHandlers, type WsHandler, type WsSocket, clearAgentHandleFactory, collectRouteSchemaSources, configureLogging, createProdApp as createApp, createCronScheduler, createDevApp, createLogger, createProdApp, createProgram, createPrograms, createTaskQueue, extractTypeInfo, getAgent, getAgentEntry, getApp, getInputTypeForMethod, getSkill, getTool, getToolSchemaPath, hydrateSkillRegistry, invalidateProgramCache, listSkills, loadAgentModule, loadConfig, loadEnv, loadTaskDriver, loadToolModule, loadToolSchema, registerAgentHandleFactory, removeSkill, resolveAgentTools, resolveSubAgents, resolveTypeNode, scanTasks, upsertSkill };
|
|
1723
|
+
export { type AgentConfig, AgentCore, AgentMetadata, type AgentModule, type ProdApp as App, AppRegistries, CorsOptions, type CreateAppOptions, CreateLoggerOptions, type CronScheduler, type DevApp, type FaapiConfig, FaapiContext, FaapiError, FaapiMiddleware, type FaapiPlugin, type HandlerTypeInfo, HelmetOptions, type InjectOptions, type InjectResponse, InjectorMap, InternalError, type LifecycleContext, type LifecycleHooks, type LlmConfig, type LlmModelConfig, LogConfig, Logger, LoggerOptions, MethodNotAllowedError, ModuleLoadError, type PluginContext, type PluginDeclaration, type ProdApp, type PropertyType, type RequestHandler, type ResponseConfig, RouteManifest, RouteNotFoundError, type RouteSchemaSource, type RuntimeType, SchemaExtractionError, TASK_PATTERNS, type TaskBullMqOptions, TaskClient, type TaskConfig, TaskDriver, TaskFailedHandler, TaskManifest, type TaskPgBossOptions, TaskQueue, TaskRegistry, ToolMetadata, type ToolModule, type ToolSchemaModule, type TypeConstraint, type UpgradeHandler, ValidationError, type ValidationErrorCode, type ValidationIssue, type WsContext, type WsEventHandlers, type WsHandler, type WsSocket, clearAgentHandleFactory, collectRouteSchemaSources, configureLogging, createProdApp as createApp, createCronScheduler, createDevApp, createLogger, createProdApp, createProgram, createPrograms, createTaskQueue, extractTypeInfo, flushLogging, getAgent, getAgentEntry, getApp, getInputTypeForMethod, getSkill, getTool, getToolSchemaPath, hydrateSkillRegistry, invalidateProgramCache, listSkills, loadAgentModule, loadConfig, loadEnv, loadTaskDriver, loadToolModule, loadToolSchema, registerAgentHandleFactory, removeSkill, resolveAgentTools, resolveSubAgents, resolveTypeNode, scanTasks, upsertSkill };
|