fourmis-agents-sdk 0.2.3 → 0.2.4

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.
@@ -2058,8 +2058,6 @@ var ALL_TOOLS = {
2058
2058
  function buildToolRegistry(toolNames, allowedTools, disallowedTools) {
2059
2059
  const registry = new ToolRegistry;
2060
2060
  for (const name of toolNames) {
2061
- if (allowedTools && !allowedTools.includes(name))
2062
- continue;
2063
2061
  if (disallowedTools?.includes(name))
2064
2062
  continue;
2065
2063
  const tool = ALL_TOOLS[name];
@@ -2058,8 +2058,6 @@ var ALL_TOOLS = {
2058
2058
  function buildToolRegistry(toolNames, allowedTools, disallowedTools) {
2059
2059
  const registry = new ToolRegistry;
2060
2060
  for (const name of toolNames) {
2061
- if (allowedTools && !allowedTools.includes(name))
2062
- continue;
2063
2061
  if (disallowedTools?.includes(name))
2064
2062
  continue;
2065
2063
  const tool = ALL_TOOLS[name];
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AAoBzE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,GAAG,KAAK,CAqJR"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AAoBzE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,GAAG,KAAK,CA8JR"}
package/dist/api.js CHANGED
@@ -2058,8 +2058,6 @@ var ALL_TOOLS = {
2058
2058
  function buildToolRegistry(toolNames, allowedTools, disallowedTools) {
2059
2059
  const registry = new ToolRegistry;
2060
2060
  for (const name of toolNames) {
2061
- if (allowedTools && !allowedTools.includes(name))
2062
- continue;
2063
2061
  if (disallowedTools?.includes(name))
2064
2062
  continue;
2065
2063
  const tool = ALL_TOOLS[name];
@@ -2542,11 +2540,16 @@ class McpClientManager {
2542
2540
  await client.connect(clientTransport);
2543
2541
  } else if (config.type === "sse") {
2544
2542
  const { SSEClientTransport } = await import("@modelcontextprotocol/sdk/client/sse.js");
2545
- const transport = new SSEClientTransport(new URL(config.url));
2543
+ const opts = config.headers ? {
2544
+ eventSourceInit: { headers: config.headers },
2545
+ requestInit: { headers: config.headers }
2546
+ } : undefined;
2547
+ const transport = new SSEClientTransport(new URL(config.url), opts);
2546
2548
  await client.connect(transport);
2547
2549
  } else if (config.type === "http") {
2548
2550
  const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
2549
- const transport = new StreamableHTTPClientTransport(new URL(config.url));
2551
+ const requestInit = config.headers ? { headers: config.headers } : undefined;
2552
+ const transport = new StreamableHTTPClientTransport(new URL(config.url), { requestInit });
2550
2553
  await client.connect(transport);
2551
2554
  } else {
2552
2555
  const { StdioClientTransport } = await import("@modelcontextprotocol/sdk/client/stdio.js");
@@ -3044,7 +3047,7 @@ function query(params) {
3044
3047
  });
3045
3048
  const model = options.model ?? DEFAULT_MODEL;
3046
3049
  const toolNames = resolveToolNames(options.tools);
3047
- const registry = buildToolRegistry(toolNames, options.allowedTools, options.disallowedTools);
3050
+ const registry = buildToolRegistry(toolNames, undefined, options.disallowedTools);
3048
3051
  const systemPrompt = options.systemPrompt ?? buildSystemPrompt({
3049
3052
  tools: registry.list(),
3050
3053
  cwd: options.cwd,
@@ -3072,6 +3075,14 @@ function query(params) {
3072
3075
  mergedPermissions.deny = mergedDeny;
3073
3076
  }
3074
3077
  }
3078
+ if (options.allowedTools && options.allowedTools.length > 0) {
3079
+ if (!mergedPermissions)
3080
+ mergedPermissions = {};
3081
+ mergedPermissions.allow = [
3082
+ ...mergedPermissions.allow ?? [],
3083
+ ...options.allowedTools
3084
+ ];
3085
+ }
3075
3086
  const permissions = new PermissionManager(options.permissionMode ?? "default", options.canUseTool, mergedPermissions, settingsManager);
3076
3087
  const cwd = options.cwd ?? process.cwd();
3077
3088
  let sessionId = options.sessionId ?? uuid();
package/dist/index.js CHANGED
@@ -2058,8 +2058,6 @@ var ALL_TOOLS = {
2058
2058
  function buildToolRegistry(toolNames, allowedTools, disallowedTools) {
2059
2059
  const registry = new ToolRegistry;
2060
2060
  for (const name of toolNames) {
2061
- if (allowedTools && !allowedTools.includes(name))
2062
- continue;
2063
2061
  if (disallowedTools?.includes(name))
2064
2062
  continue;
2065
2063
  const tool = ALL_TOOLS[name];
@@ -2542,11 +2540,16 @@ class McpClientManager {
2542
2540
  await client.connect(clientTransport);
2543
2541
  } else if (config.type === "sse") {
2544
2542
  const { SSEClientTransport } = await import("@modelcontextprotocol/sdk/client/sse.js");
2545
- const transport = new SSEClientTransport(new URL(config.url));
2543
+ const opts = config.headers ? {
2544
+ eventSourceInit: { headers: config.headers },
2545
+ requestInit: { headers: config.headers }
2546
+ } : undefined;
2547
+ const transport = new SSEClientTransport(new URL(config.url), opts);
2546
2548
  await client.connect(transport);
2547
2549
  } else if (config.type === "http") {
2548
2550
  const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
2549
- const transport = new StreamableHTTPClientTransport(new URL(config.url));
2551
+ const requestInit = config.headers ? { headers: config.headers } : undefined;
2552
+ const transport = new StreamableHTTPClientTransport(new URL(config.url), { requestInit });
2550
2553
  await client.connect(transport);
2551
2554
  } else {
2552
2555
  const { StdioClientTransport } = await import("@modelcontextprotocol/sdk/client/stdio.js");
@@ -3044,7 +3047,7 @@ function query(params) {
3044
3047
  });
3045
3048
  const model = options.model ?? DEFAULT_MODEL;
3046
3049
  const toolNames = resolveToolNames(options.tools);
3047
- const registry = buildToolRegistry(toolNames, options.allowedTools, options.disallowedTools);
3050
+ const registry = buildToolRegistry(toolNames, undefined, options.disallowedTools);
3048
3051
  const systemPrompt = options.systemPrompt ?? buildSystemPrompt({
3049
3052
  tools: registry.list(),
3050
3053
  cwd: options.cwd,
@@ -3072,6 +3075,14 @@ function query(params) {
3072
3075
  mergedPermissions.deny = mergedDeny;
3073
3076
  }
3074
3077
  }
3078
+ if (options.allowedTools && options.allowedTools.length > 0) {
3079
+ if (!mergedPermissions)
3080
+ mergedPermissions = {};
3081
+ mergedPermissions.allow = [
3082
+ ...mergedPermissions.allow ?? [],
3083
+ ...options.allowedTools
3084
+ ];
3085
+ }
3075
3086
  const permissions = new PermissionManager(options.permissionMode ?? "default", options.canUseTool, mergedPermissions, settingsManager);
3076
3087
  const cwd = options.cwd ?? process.cwd();
3077
3088
  let sessionId = options.sessionId ?? uuid();
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAEf,eAAe,EAChB,MAAM,YAAY,CAAC;AASpB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,OAAO,CAAsC;gBAEzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAI9C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAKnB,UAAU;IAsDxB;;OAEG;IACH,QAAQ,IAAI,kBAAkB,EAAE;IAsB1B,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG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AAC;CAYhC"}
@@ -35,11 +35,16 @@ class McpClientManager {
35
35
  await client.connect(clientTransport);
36
36
  } else if (config.type === "sse") {
37
37
  const { SSEClientTransport } = await import("@modelcontextprotocol/sdk/client/sse.js");
38
- const transport = new SSEClientTransport(new URL(config.url));
38
+ const opts = config.headers ? {
39
+ eventSourceInit: { headers: config.headers },
40
+ requestInit: { headers: config.headers }
41
+ } : undefined;
42
+ const transport = new SSEClientTransport(new URL(config.url), opts);
39
43
  await client.connect(transport);
40
44
  } else if (config.type === "http") {
41
45
  const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
42
- const transport = new StreamableHTTPClientTransport(new URL(config.url));
46
+ const requestInit = config.headers ? { headers: config.headers } : undefined;
47
+ const transport = new StreamableHTTPClientTransport(new URL(config.url), { requestInit });
43
48
  await client.connect(transport);
44
49
  } else {
45
50
  const { StdioClientTransport } = await import("@modelcontextprotocol/sdk/client/stdio.js");
package/dist/mcp/index.js CHANGED
@@ -35,11 +35,16 @@ class McpClientManager {
35
35
  await client.connect(clientTransport);
36
36
  } else if (config.type === "sse") {
37
37
  const { SSEClientTransport } = await import("@modelcontextprotocol/sdk/client/sse.js");
38
- const transport = new SSEClientTransport(new URL(config.url));
38
+ const opts = config.headers ? {
39
+ eventSourceInit: { headers: config.headers },
40
+ requestInit: { headers: config.headers }
41
+ } : undefined;
42
+ const transport = new SSEClientTransport(new URL(config.url), opts);
39
43
  await client.connect(transport);
40
44
  } else if (config.type === "http") {
41
45
  const { StreamableHTTPClientTransport } = await import("@modelcontextprotocol/sdk/client/streamableHttp.js");
42
- const transport = new StreamableHTTPClientTransport(new URL(config.url));
46
+ const requestInit = config.headers ? { headers: config.headers } : undefined;
47
+ const transport = new StreamableHTTPClientTransport(new URL(config.url), { requestInit });
43
48
  await client.connect(transport);
44
49
  } else {
45
50
  const { StdioClientTransport } = await import("@modelcontextprotocol/sdk/client/stdio.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAkB7C;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,CAAC,EAAE,MAAM,EAAE,EACvB,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,YAAY,CAed"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAkB7C;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,CAAC,EAAE,MAAM,EAAE,EACvB,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,YAAY,CAad"}
@@ -570,8 +570,6 @@ var ALL_TOOLS = {
570
570
  function buildToolRegistry(toolNames, allowedTools, disallowedTools) {
571
571
  const registry = new ToolRegistry;
572
572
  for (const name of toolNames) {
573
- if (allowedTools && !allowedTools.includes(name))
574
- continue;
575
573
  if (disallowedTools?.includes(name))
576
574
  continue;
577
575
  const tool = ALL_TOOLS[name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fourmis-agents-sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Multi-provider AI agent SDK with direct API access and in-process tool execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",