@faapi/faapi 6.30.0 → 6.32.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 +109 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/{contextTypes-DhagvRH_.d.ts → contextTypes-WKsf3cCE.d.ts} +1149 -50
- package/dist/index.d.ts +32 -774
- package/dist/index.js +116 -10
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +22 -1
- package/dist/testing.js.map +1 -1
- package/dist/workerEntry.d.ts +17 -2
- package/dist/workerEntry.js +25 -0
- package/dist/workerEntry.js.map +1 -1
- package/package.json +1 -1
- package/dist/routeTypes-0rwuIws-.d.ts +0 -204
package/dist/testing.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { F as FaapiMiddleware, I as InjectorMap, R as RouteManifest, W as WsRouteManifest, C as CorsOptions, H as HelmetOptions } from './routeTypes-0rwuIws-.js';
|
|
1
|
+
import { g as FaapiContext, F as FaapiMiddleware, w as InjectorMap, R as RouteManifest, W as WsRouteManifest, r as CorsOptions, H as HelmetOptions } from './contextTypes-WKsf3cCE.js';
|
|
3
2
|
import { Server } from 'node:http';
|
|
4
3
|
import { WebSocket } from 'ws';
|
|
4
|
+
import 'node:net';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 测试专用:从选项对象创建 FaapiContext,免去手写 `new Request(url)` 的样板代码
|
package/dist/testing.js
CHANGED
|
@@ -947,6 +947,8 @@ var PARAM_TYPE_MAP = {
|
|
|
947
947
|
// 任务子系统:TaskClient(入队/查询)
|
|
948
948
|
log: "log",
|
|
949
949
|
// 请求级日志器(ctx.log 同一实例:scope http,自动带 requestId 等字段)
|
|
950
|
+
llm: "llm",
|
|
951
|
+
// 轻量 LLM 补全通道(@faapi/agent 插件注册到 registries.llm;未加载时 undefined)
|
|
950
952
|
// raw 系:恒原始输入(无 schema、无校验、管线永不转换),与 query/params/body
|
|
951
953
|
// 的「校验转换后」口径二分互补
|
|
952
954
|
rawQuery: "rawQuery",
|
|
@@ -1190,6 +1192,20 @@ function createAgentHandleStore() {
|
|
|
1190
1192
|
}
|
|
1191
1193
|
};
|
|
1192
1194
|
}
|
|
1195
|
+
function createLlmChannelStore() {
|
|
1196
|
+
let current = null;
|
|
1197
|
+
return {
|
|
1198
|
+
register(channel) {
|
|
1199
|
+
current = channel;
|
|
1200
|
+
},
|
|
1201
|
+
get() {
|
|
1202
|
+
return current ?? void 0;
|
|
1203
|
+
},
|
|
1204
|
+
clear() {
|
|
1205
|
+
current = null;
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1193
1209
|
function createTaskHandleStore() {
|
|
1194
1210
|
let currentFactory = null;
|
|
1195
1211
|
return {
|
|
@@ -1212,7 +1228,8 @@ function createAppRegistries() {
|
|
|
1212
1228
|
const task = createTaskRegistry();
|
|
1213
1229
|
const agentHandle = createAgentHandleStore();
|
|
1214
1230
|
const taskHandle = createTaskHandleStore();
|
|
1215
|
-
|
|
1231
|
+
const llm = createLlmChannelStore();
|
|
1232
|
+
return { tool, agent, skill, task, agentHandle, taskHandle, llm };
|
|
1216
1233
|
}
|
|
1217
1234
|
var defaultRegistries = createAppRegistries();
|
|
1218
1235
|
|
|
@@ -1276,6 +1293,10 @@ function getBuiltinInjectionValue(type, ctx, body) {
|
|
|
1276
1293
|
// 任务子系统:注入 TaskClient(入队/查询);未注册工厂(无 app 编排)时 undefined
|
|
1277
1294
|
case "tasks":
|
|
1278
1295
|
return ctx.registries ? ctx.registries.taskHandle.get(ctx) : void 0;
|
|
1296
|
+
// 轻量 LLM 补全通道:@faapi/agent 插件注册到 registries.llm;与请求上下文无关,
|
|
1297
|
+
// get 无参。插件未加载(或编程式直调 ctx 无 registries)时 undefined
|
|
1298
|
+
case "llm":
|
|
1299
|
+
return ctx.registries ? ctx.registries.llm.get() : void 0;
|
|
1279
1300
|
// 请求级日志器:与 ctx.log 同一实例(scope http,自动带 requestId/method/path 字段)
|
|
1280
1301
|
case "log":
|
|
1281
1302
|
return ctx.log;
|