@faapi/faapi 6.22.0 → 6.23.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/cli/index.js +369 -256
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +31 -2
- package/dist/index.js +149 -111
- package/dist/index.js.map +1 -1
- package/dist/{routeTypes-CXWkRx4W.d.ts → routeTypes-CJV5M90s.d.ts} +8 -0
- package/dist/testing.d.ts +3 -1
- package/dist/testing.js +80 -47
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FaapiMiddleware, A as AppRegistries, R as RouteManifest, a as FaapiContext, C as CorsOptions, T as TaskClient, H as HelmetOptions, L as LogConfig, I as InjectorMap, b as TaskFailedHandler, W as WsRouteManifest, c as TaskQueueDeps, d as TaskQueue, e as TaskDriver, f as TaskRegistry, g as TaskManifest, h as ToolMetadata, i as AgentCore, j as AgentMetadata, k as CreateLoggerOptions, l as Logger } from './routeTypes-
|
|
2
|
-
export { m as AgentHandleFactory, n as AgentHandleStore, o as AgentPathMeta, p as AgentRegistry, q as AgentToolDescriptor, r as FaapiContextConfig, s as FaapiTaskMeta, t as FailOptions, u as Injector, v as LogEntry, w as LogLevel, x as LogSink, y as RouteInfo, z as RouteInputSchema, B as RouteOutputSchema, D as RouteParamSchema, S as SkillRegistry, E as SseEvent, G as SseOptions, 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 } from './routeTypes-
|
|
1
|
+
import { F as FaapiMiddleware, A as AppRegistries, R as RouteManifest, a as FaapiContext, C as CorsOptions, T as TaskClient, H as HelmetOptions, L as LogConfig, I as InjectorMap, b as TaskFailedHandler, W as WsRouteManifest, c as TaskQueueDeps, d as TaskQueue, e as TaskDriver, f as TaskRegistry, g as TaskManifest, h as ToolMetadata, i as AgentCore, j as AgentMetadata, k as CreateLoggerOptions, l as Logger } from './routeTypes-CJV5M90s.js';
|
|
2
|
+
export { m as AgentHandleFactory, n as AgentHandleStore, o as AgentPathMeta, p as AgentRegistry, q as AgentToolDescriptor, r as FaapiContextConfig, s as FaapiTaskMeta, t as FailOptions, u as Injector, v as LogEntry, w as LogLevel, x as LogSink, y as RouteInfo, z as RouteInputSchema, B as RouteOutputSchema, D as RouteParamSchema, S as SkillRegistry, E as SseEvent, G as SseOptions, 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 } from './routeTypes-CJV5M90s.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';
|
|
@@ -251,6 +251,13 @@ interface TaskConfig {
|
|
|
251
251
|
interface LifecycleContext {
|
|
252
252
|
/** 项目根目录 */
|
|
253
253
|
rootDir: string;
|
|
254
|
+
/**
|
|
255
|
+
* 运行时资源根目录绝对路径(<rootDir>/<dist>/resources)
|
|
256
|
+
*
|
|
257
|
+
* `src/resources/` 经 dev/build 复制进产物后的位置,onReady 中预加载
|
|
258
|
+
* prompt 模板等静态文件时定位用(`path.join(resourcesDir, 'prompts/foo.md')`)。
|
|
259
|
+
*/
|
|
260
|
+
resourcesDir: string;
|
|
254
261
|
/** 当前路由清单 */
|
|
255
262
|
routes: RouteManifest;
|
|
256
263
|
/** 服务器实例(onBoot 钩子触发时已创建但未监听,`listening === false`) */
|
|
@@ -843,6 +850,13 @@ interface WsContext {
|
|
|
843
850
|
headers: Headers;
|
|
844
851
|
/** 业务配置(来自 faapi.config.ts) */
|
|
845
852
|
config: Record<string, unknown>;
|
|
853
|
+
/**
|
|
854
|
+
* 运行时资源根目录绝对路径(<rootDir>/<dist>/resources)
|
|
855
|
+
*
|
|
856
|
+
* 与 HTTP FaapiContext 同源(握手 ctx 是 FaapiContext 的结构子集),handler
|
|
857
|
+
* 的 WS 回调里读静态文件用。testing 直调未传时为 undefined。
|
|
858
|
+
*/
|
|
859
|
+
resourcesDir?: string;
|
|
846
860
|
/** 中间件塞入的用户信息(鉴权等) */
|
|
847
861
|
user?: unknown;
|
|
848
862
|
/** 允许通过 declare module 扩展 */
|
|
@@ -1681,6 +1695,21 @@ interface AppBase {
|
|
|
1681
1695
|
wsRoutes: WsRouteManifest;
|
|
1682
1696
|
/** 项目根目录 */
|
|
1683
1697
|
rootDir: string;
|
|
1698
|
+
/**
|
|
1699
|
+
* 产物输出目录(相对 rootDir,如 '.faapi' 或 'dist')
|
|
1700
|
+
*
|
|
1701
|
+
* 与 createAppBase 内部解析一致:`options.dist ?? FAAPI_DIST ?? 'dist'`。
|
|
1702
|
+
* 业务方定位任意产物文件时与 rootDir 配合使用。
|
|
1703
|
+
*/
|
|
1704
|
+
dist: string;
|
|
1705
|
+
/**
|
|
1706
|
+
* 运行时资源根目录绝对路径(<rootDir>/<dist>/resources)
|
|
1707
|
+
*
|
|
1708
|
+
* `src/resources/` 经 dev/build 复制进产物后的位置,业务方
|
|
1709
|
+
* `path.join(app.resourcesDir, 'prompts/foo.md')` 后自行读取。
|
|
1710
|
+
* 源码无 `src/resources/` 目录时路径仍指向约定位置(读文件由业务方容错)。
|
|
1711
|
+
*/
|
|
1712
|
+
resourcesDir: string;
|
|
1684
1713
|
/** 任务队列客户端(入队/查询;app 实例级,close 时随队列停机) */
|
|
1685
1714
|
tasks: TaskClient;
|
|
1686
1715
|
/** 启动 HTTP server,打印路由表,执行 onReady 钩子 */
|