agent-afk 5.181.0 → 5.181.1

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.
@@ -2,6 +2,7 @@ import { type CallToolResult, type Tool as McpTool } from '@modelcontextprotocol
2
2
  import { UnauthorizedError } from '@modelcontextprotocol/sdk/client/auth.js';
3
3
  import type { ToolResult } from '../tools/types.js';
4
4
  import type { McpServerConfig } from './types.js';
5
+ import type { McpServerLayer } from './env-containment.js';
5
6
  export interface McpClientConnectResult {
6
7
  tools: McpTool[];
7
8
  serverInfo: {
@@ -12,12 +13,14 @@ export interface McpClientConnectResult {
12
13
  export declare class McpClient {
13
14
  private readonly serverName;
14
15
  private readonly config;
16
+ private readonly layer;
17
+ private readonly trustedAllowSecretEnv;
15
18
  private client;
16
19
  private connected;
17
20
  private pendingAuthTransport;
18
21
  onTransportError?: (err: Error) => void;
19
22
  onToolListChanged?: () => void;
20
- constructor(serverName: string, config: McpServerConfig);
23
+ constructor(serverName: string, config: McpServerConfig, layer?: McpServerLayer, trustedAllowSecretEnv?: readonly string[]);
21
24
  connect(): Promise<McpClientConnectResult>;
22
25
  listTools(): Promise<McpTool[]>;
23
26
  refreshTools(): Promise<McpTool[]>;
@@ -1,4 +1,5 @@
1
1
  import type { McpServerConfig } from './types.js';
2
+ import type { McpServerLayer } from './env-containment.js';
2
3
  export interface McpConfigFile {
3
4
  mcpServers?: Record<string, McpServerConfig>;
4
5
  }
@@ -6,6 +7,8 @@ export interface LoadedMcpConfig {
6
7
  mcpServers: Record<string, McpServerConfig>;
7
8
  sources: string[];
8
9
  warnings: string[];
10
+ serverLayers: Record<string, McpServerLayer>;
11
+ userAllowSecretEnv: Record<string, string[]>;
9
12
  }
10
13
  export declare function getMcpConfigPath(): string;
11
14
  export declare function getProjectMcpConfigPath(cwd?: string): string | null;
@@ -0,0 +1,9 @@
1
+ export type McpServerLayer = 'project' | 'user-global' | 'plugin' | 'cli';
2
+ export declare function isSecretPattern(varName: string): boolean;
3
+ export declare function isDangerousInherited(varName: string): boolean;
4
+ export interface SecretCheckResult {
5
+ allowed: boolean;
6
+ warning?: string;
7
+ }
8
+ export declare function checkSecretExpansion(varName: string, layer: McpServerLayer, serverName: string, allowSecretEnv?: readonly string[]): SecretCheckResult;
9
+ export declare function scrubDangerousEnv(base: Record<string, string>): string[];
@@ -1,6 +1,20 @@
1
+ import { type McpServerLayer } from './env-containment.js';
1
2
  export interface EnvExpansionResult<T> {
2
3
  value: T;
3
4
  missing: string[];
5
+ blocked: string[];
4
6
  }
5
- export declare function expandEnvString(input: string, source?: NodeJS.ProcessEnv): EnvExpansionResult<string>;
6
- export declare function expandEnvRecord(input: Record<string, string> | undefined, source?: NodeJS.ProcessEnv): EnvExpansionResult<Record<string, string>>;
7
+ export declare function expandEnvString(input: string, source?: NodeJS.ProcessEnv): Omit<EnvExpansionResult<string>, 'blocked'>;
8
+ export declare function expandEnvRecord(input: Record<string, string> | undefined, source?: NodeJS.ProcessEnv): Omit<EnvExpansionResult<Record<string, string>>, 'blocked'>;
9
+ export interface EnvExpansionContext {
10
+ layer: McpServerLayer;
11
+ serverName: string;
12
+ allowSecretEnv?: readonly string[];
13
+ }
14
+ export declare function expandEnvStringForLayer(input: string, ctx: EnvExpansionContext, source?: NodeJS.ProcessEnv, warn?: (msg: string) => void): EnvExpansionResult<string>;
15
+ export declare function expandEnvRecordForLayer(input: Record<string, string> | undefined, ctx: EnvExpansionContext, source?: NodeJS.ProcessEnv, warn?: (msg: string) => void): EnvExpansionResult<Record<string, string>>;
16
+ export declare function expandHeadersForLayer(headers: Record<string, string> | undefined, ctx: EnvExpansionContext, source?: NodeJS.ProcessEnv, warn?: (msg: string) => void): {
17
+ headers: Record<string, string>;
18
+ missing: string[];
19
+ blocked: string[];
20
+ };
@@ -1,9 +1,12 @@
1
1
  import type { AnthropicToolDef, ToolHandler } from '../tools/types.js';
2
2
  import type { McpClientState, McpServerConfig } from './types.js';
3
3
  import type { TraceSink } from '../trace/index.js';
4
+ import type { McpServerLayer } from './env-containment.js';
4
5
  export interface McpManagerInitOptions {
5
6
  warnings?: string[];
6
7
  traceWriter?: TraceSink;
8
+ serverLayers?: Record<string, McpServerLayer>;
9
+ userAllowSecretEnv?: Record<string, string[]>;
7
10
  }
8
11
  export declare class McpManager {
9
12
  private readonly records;
@@ -1,6 +1,7 @@
1
1
  import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
2
2
  import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
3
3
  import type { McpServerConfig } from './types.js';
4
+ import { type McpServerLayer } from './env-containment.js';
4
5
  export declare function expandHeaders(headers: Record<string, string> | undefined, source?: NodeJS.ProcessEnv): {
5
6
  headers: Record<string, string>;
6
7
  missing: string[];
@@ -9,4 +10,4 @@ export interface CreateTransportResult {
9
10
  transport: Transport;
10
11
  isSSE: boolean;
11
12
  }
12
- export declare function createTransport(serverName: string, config: McpServerConfig, oauthProvider?: OAuthClientProvider): CreateTransportResult;
13
+ export declare function createTransport(serverName: string, config: McpServerConfig, oauthProvider?: OAuthClientProvider, layer?: McpServerLayer, trustedAllowSecretEnv?: readonly string[]): CreateTransportResult;
@@ -10,6 +10,7 @@ export interface McpServerConfig {
10
10
  disabled?: boolean;
11
11
  alwaysLoad?: boolean;
12
12
  timeout?: number;
13
+ allowSecretEnv?: string[];
13
14
  }
14
15
  export type McpClientStatus = 'connecting' | 'connected' | 'error' | 'disabled' | 'oauth_pending';
15
16
  export interface McpClientState {