@faapi/faapi 6.31.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 +33 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/{contextTypes-BKQsSVMv.d.ts → contextTypes-WKsf3cCE.d.ts} +1140 -50
- package/dist/index.d.ts +5 -760
- package/dist/index.js +33 -1
- 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-Cc0P3CcU.d.ts +0 -204
package/dist/cli/index.js
CHANGED
|
@@ -2550,6 +2550,8 @@ var init_resolveInjection = __esm({
|
|
|
2550
2550
|
// 任务子系统:TaskClient(入队/查询)
|
|
2551
2551
|
log: "log",
|
|
2552
2552
|
// 请求级日志器(ctx.log 同一实例:scope http,自动带 requestId 等字段)
|
|
2553
|
+
llm: "llm",
|
|
2554
|
+
// 轻量 LLM 补全通道(@faapi/agent 插件注册到 registries.llm;未加载时 undefined)
|
|
2553
2555
|
// raw 系:恒原始输入(无 schema、无校验、管线永不转换),与 query/params/body
|
|
2554
2556
|
// 的「校验转换后」口径二分互补
|
|
2555
2557
|
rawQuery: "rawQuery",
|
|
@@ -7798,6 +7800,20 @@ function createAgentHandleStore() {
|
|
|
7798
7800
|
}
|
|
7799
7801
|
};
|
|
7800
7802
|
}
|
|
7803
|
+
function createLlmChannelStore() {
|
|
7804
|
+
let current = null;
|
|
7805
|
+
return {
|
|
7806
|
+
register(channel) {
|
|
7807
|
+
current = channel;
|
|
7808
|
+
},
|
|
7809
|
+
get() {
|
|
7810
|
+
return current ?? void 0;
|
|
7811
|
+
},
|
|
7812
|
+
clear() {
|
|
7813
|
+
current = null;
|
|
7814
|
+
}
|
|
7815
|
+
};
|
|
7816
|
+
}
|
|
7801
7817
|
function createTaskHandleStore() {
|
|
7802
7818
|
let currentFactory = null;
|
|
7803
7819
|
return {
|
|
@@ -7854,7 +7870,8 @@ function createAppRegistries() {
|
|
|
7854
7870
|
const task = createTaskRegistry();
|
|
7855
7871
|
const agentHandle = createAgentHandleStore();
|
|
7856
7872
|
const taskHandle = createTaskHandleStore();
|
|
7857
|
-
|
|
7873
|
+
const llm = createLlmChannelStore();
|
|
7874
|
+
return { tool, agent, skill, task, agentHandle, taskHandle, llm };
|
|
7858
7875
|
}
|
|
7859
7876
|
var defaultRegistries;
|
|
7860
7877
|
var init_registries = __esm({
|
|
@@ -7938,6 +7955,10 @@ function getBuiltinInjectionValue(type, ctx, body) {
|
|
|
7938
7955
|
// 任务子系统:注入 TaskClient(入队/查询);未注册工厂(无 app 编排)时 undefined
|
|
7939
7956
|
case "tasks":
|
|
7940
7957
|
return ctx.registries ? ctx.registries.taskHandle.get(ctx) : void 0;
|
|
7958
|
+
// 轻量 LLM 补全通道:@faapi/agent 插件注册到 registries.llm;与请求上下文无关,
|
|
7959
|
+
// get 无参。插件未加载(或编程式直调 ctx 无 registries)时 undefined
|
|
7960
|
+
case "llm":
|
|
7961
|
+
return ctx.registries ? ctx.registries.llm.get() : void 0;
|
|
7941
7962
|
// 请求级日志器:与 ctx.log 同一实例(scope http,自动带 requestId/method/path 字段)
|
|
7942
7963
|
case "log":
|
|
7943
7964
|
return ctx.log;
|
|
@@ -9571,6 +9592,7 @@ async function runTaskInWorker(options) {
|
|
|
9571
9592
|
job: taskCtx.job
|
|
9572
9593
|
},
|
|
9573
9594
|
registries: options.registries,
|
|
9595
|
+
llms: options.llms,
|
|
9574
9596
|
log: options.log
|
|
9575
9597
|
});
|
|
9576
9598
|
} catch (err) {
|
|
@@ -9699,6 +9721,9 @@ function createTaskQueue(deps) {
|
|
|
9699
9721
|
job: { id: job.id, name: job.name, attempt: job.attempt }
|
|
9700
9722
|
},
|
|
9701
9723
|
registries: snapshotRegistries(),
|
|
9724
|
+
// agent.llms 纯数据快照随 workerData 下发,worker 内动态加载 @faapi/agent
|
|
9725
|
+
// 重建轻量补全通道(taskCtx.llm)——llms 未配置时不传
|
|
9726
|
+
llms: deps.llms,
|
|
9702
9727
|
// 日志配置随 workerData 下发(纯数据),worker 内联重建 taskCtx.log,
|
|
9703
9728
|
// 条目回传宿主走统一管道(scope/fields 与进程内路径一致)
|
|
9704
9729
|
log: {
|
|
@@ -9728,6 +9753,8 @@ function createTaskQueue(deps) {
|
|
|
9728
9753
|
config: deps.config,
|
|
9729
9754
|
job: { id: job.id, name: job.name, attempt: job.attempt },
|
|
9730
9755
|
registries: registriesView,
|
|
9756
|
+
// 轻量补全通道惰性读取(插件晚于队列构造注册,执行时刻取值才可见)
|
|
9757
|
+
llm: deps.llm?.get(),
|
|
9731
9758
|
log: createLogger(`task:${job.name}`, {
|
|
9732
9759
|
fields: { jobId: job.id, task: job.name, attempt: job.attempt }
|
|
9733
9760
|
}),
|
|
@@ -10404,6 +10431,10 @@ async function createAppBase(options) {
|
|
|
10404
10431
|
config,
|
|
10405
10432
|
resourcesDir,
|
|
10406
10433
|
registries: createTaskRegistriesView(registries),
|
|
10434
|
+
// 轻量补全通道:进程内路径经 store 惰性读取(插件注册后的活引用);
|
|
10435
|
+
// 隔离路径传 agent.llms 纯数据快照(worker 内重建)
|
|
10436
|
+
llm: registries.llm,
|
|
10437
|
+
llms: config?.agent?.llms,
|
|
10407
10438
|
driver: taskDriver,
|
|
10408
10439
|
onFailed: config?.task?.onFailed
|
|
10409
10440
|
});
|
|
@@ -10541,6 +10572,7 @@ async function createAppBase(options) {
|
|
|
10541
10572
|
registries.task.clear();
|
|
10542
10573
|
registries.agentHandle.clear();
|
|
10543
10574
|
registries.taskHandle.clear();
|
|
10575
|
+
registries.llm.clear();
|
|
10544
10576
|
setActiveResourcesDir(null);
|
|
10545
10577
|
if (!server.listening) {
|
|
10546
10578
|
app.server = null;
|