@agentgrader/agent-openrouter 2.0.3 → 3.0.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -144,7 +144,30 @@ var AiSdkAgentAdapter = class {
144
144
  console.error(`Failed to connect to MCP server "${serverName}": ${err.message}`);
145
145
  }
146
146
  }
147
- const tools = { ...localTools, ...mcpTools };
147
+ const allTools = { ...localTools, ...mcpTools };
148
+ let tools = allTools;
149
+ if (config.tools?.length) {
150
+ const allowlist = new Set(config.tools);
151
+ const localToolNames = Object.keys(localTools);
152
+ const availableNames = new Set(Object.keys(allTools));
153
+ for (const name of allowlist) {
154
+ if (!availableNames.has(name)) {
155
+ console.warn(
156
+ `Tool "${name}" listed in config.tools was not found among local tools (${localToolNames.join(", ")}) or connected MCP server tools - ignoring.`
157
+ );
158
+ }
159
+ }
160
+ if (!allowlist.has("submit")) {
161
+ console.warn(
162
+ "tools allowlist did not include 'submit' - adding it automatically, as it is required to end a run."
163
+ );
164
+ }
165
+ const effectiveAllowlist = /* @__PURE__ */ new Set([...allowlist, "submit"]);
166
+ tools = Object.fromEntries(
167
+ Object.entries(allTools).filter(([key]) => effectiveAllowlist.has(key))
168
+ );
169
+ console.log(`Tool allowlist active: ${Object.keys(tools).join(", ")}`);
170
+ }
148
171
  const getPricing = (model2) => {
149
172
  const name = model2.toLowerCase();
150
173
  if (name.includes("claude-3-5-sonnet")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentgrader/agent-openrouter",
3
- "version": "2.0.3",
3
+ "version": "3.0.0",
4
4
  "description": "OpenRouter/AI SDK ReAct agent adapter for the Agentgrader framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "build:watch": "tsup src/index.ts --format esm --dts --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@agentgrader/core": "^1.1.2",
24
+ "@agentgrader/core": "^1.2.0",
25
25
  "@ai-sdk/anthropic": "^1.2.12",
26
26
  "@ai-sdk/openai": "^1.1.0",
27
27
  "ai": "^4.1.0",
@@ -31,6 +31,6 @@
31
31
  "tsup": "^8.5.1"
32
32
  },
33
33
  "peerDependencies": {
34
- "@agentgrader/core": "^1.1.2"
34
+ "@agentgrader/core": "^1.2.0"
35
35
  }
36
36
  }