@agentforge-io/core 2.0.11 → 2.0.14

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.
@@ -171,7 +171,9 @@ class AgentService {
171
171
  // resolved agent declares one (e.g. a public-chat agent reusing the
172
172
  // owner's Gmail authorization); otherwise they fall back to the
173
173
  // caller's userId, which is the historical personal-agent path.
174
- const extraTools = await this.resolveExtraTools(agent.connectorOwnerUserId ?? params.userId);
174
+ const resolvedExtras = await this.resolveExtraTools(agent.connectorOwnerUserId ?? params.userId);
175
+ const filter = params.overrides?.extraToolsFilter;
176
+ const extraTools = filter && resolvedExtras ? filter(resolvedExtras) : resolvedExtras;
175
177
  const response = await this.runner.run(agent, messages, {
176
178
  userId: params.userId,
177
179
  conversationId: params.conversationId,
@@ -235,7 +237,9 @@ class AgentService {
235
237
  // Same precedence as sendMessage — agent.connectorOwnerUserId takes
236
238
  // priority so a public-chat agent always uses the owner's connector
237
239
  // toolbelt regardless of which visitor session is streaming.
238
- const extraTools = await this.resolveExtraTools(agent.connectorOwnerUserId ?? params.userId);
240
+ const resolvedExtras = await this.resolveExtraTools(agent.connectorOwnerUserId ?? params.userId);
241
+ const filter = params.overrides?.extraToolsFilter;
242
+ const extraTools = filter && resolvedExtras ? filter(resolvedExtras) : resolvedExtras;
239
243
  for await (const chunk of this.runner.stream(agent, messages, {
240
244
  userId: params.userId,
241
245
  conversationId: params.conversationId,
@@ -45,6 +45,28 @@ export interface AgentOverrides {
45
45
  * routed through a per-call map (the registry doesn't see them).
46
46
  */
47
47
  extraTools?: AgentToolDefinition[];
48
+ /**
49
+ * Optional post-resolution filter applied to the tools that
50
+ * `AgentService` derives from the connector registry (the
51
+ * `resolveExtraTools(userId)` output). The caller receives the full
52
+ * list and returns the subset that should actually be exposed to the
53
+ * model for this turn.
54
+ *
55
+ * Use cases:
56
+ * - The prompt-designer assistant exposes ONLY read-only tools to
57
+ * itself even though the operator's tenant has write tools
58
+ * authorized (see PROMPT_DESIGNER_TOOL_USE_SDD §4.2).
59
+ * - A throttling layer dropping tools that have hit a rate limit.
60
+ *
61
+ * If omitted, the resolved list passes through unchanged — the
62
+ * historical behavior.
63
+ *
64
+ * Note: this filter runs AFTER `resolveExtraTools` and BEFORE the
65
+ * shallow merge with `overrides.extraTools`. Tools explicitly
66
+ * provided via `extraTools` are NOT filtered; the caller is
67
+ * responsible for vetting those.
68
+ */
69
+ extraToolsFilter?: (tools: AgentToolDefinition[]) => AgentToolDefinition[];
48
70
  }
49
71
  export interface AgentResponse {
50
72
  messageId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/core",
3
- "version": "2.0.11",
3
+ "version": "2.0.14",
4
4
  "description": "Framework-free AI runtime SDK. Owns: agent loop (Anthropic), conversations, tools, streaming, agent-job queue, SdkHooks. Identity, billing, infra (email/uploads/secrets) live in the host's modules — not here.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",