@faapi/faapi 6.27.0 → 6.29.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.
@@ -1,4 +1,4 @@
1
- import { F as FaapiContext } from './contextTypes-CBE86AO2.js';
1
+ import { F as FaapiContext } from './contextTypes-DhagvRH_.js';
2
2
 
3
3
  /**
4
4
  * faapi 中间件(洋葱模型)
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FaapiContext } from './contextTypes-CBE86AO2.js';
2
- import { F as FaapiMiddleware, I as InjectorMap, R as RouteManifest, W as WsRouteManifest, C as CorsOptions, H as HelmetOptions } from './routeTypes-DVSnH0jk.js';
1
+ import { F as FaapiContext } from './contextTypes-DhagvRH_.js';
2
+ import { F as FaapiMiddleware, I as InjectorMap, R as RouteManifest, W as WsRouteManifest, C as CorsOptions, H as HelmetOptions } from './routeTypes-0rwuIws-.js';
3
3
  import { Server } from 'node:http';
4
4
  import { WebSocket } from 'ws';
5
5
 
package/dist/testing.js CHANGED
@@ -1055,6 +1055,19 @@ function createTaskRegistry() {
1055
1055
  };
1056
1056
  }
1057
1057
 
1058
+ // src/injection/subAgentToolName.ts
1059
+ var LLM_TOOL_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
1060
+ var SUB_AGENT_TOOL_PREFIX = "agent-";
1061
+ function subAgentToolName(agentName) {
1062
+ const toolName = SUB_AGENT_TOOL_PREFIX + agentName;
1063
+ if (!LLM_TOOL_NAME_PATTERN.test(toolName)) {
1064
+ throw new Error(
1065
+ `Sub-agent tool name "${toolName}" (from agent name "${agentName}") violates the LLM tool name pattern ${LLM_TOOL_NAME_PATTERN} \u2014 rename the agent (allowed: a-z A-Z 0-9 '-' '_'; file-based agent directory segments allow a-z A-Z 0-9 '-' only, '_' is the nesting separator)`
1066
+ );
1067
+ }
1068
+ return toolName;
1069
+ }
1070
+
1058
1071
  // src/injection/registries.ts
1059
1072
  function createToolRegistry() {
1060
1073
  let registry = /* @__PURE__ */ new Map();
@@ -1102,7 +1115,7 @@ function createAgentRegistry(tool) {
1102
1115
  if (!agent) return void 0;
1103
1116
  return {
1104
1117
  kind: "agent",
1105
- name: `agent.${agent.name}`,
1118
+ name: subAgentToolName(agent.name),
1106
1119
  agentName: agent.name,
1107
1120
  description: agent.description,
1108
1121
  metadata: agent