@xenosystem/agent-sdk 0.10.30 → 0.10.32

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 (75) hide show
  1. package/dist/artifacts/index.cjs +6 -6
  2. package/dist/artifacts/index.js +7 -7
  3. package/dist/artifacts/metafile-cjs.json +1 -1
  4. package/dist/artifacts/metafile-esm.json +1 -1
  5. package/dist/automation/index.cjs +1 -1
  6. package/dist/automation/index.d.cts +6 -2
  7. package/dist/automation/index.d.ts +6 -2
  8. package/dist/automation/index.js +1 -1
  9. package/dist/automation/metafile-cjs.json +1 -1
  10. package/dist/automation/metafile-esm.json +1 -1
  11. package/dist/control-plane/index.cjs +1 -1
  12. package/dist/control-plane/index.js +1 -1
  13. package/dist/coordination/index.cjs +2 -2
  14. package/dist/coordination/index.d.cts +9 -3
  15. package/dist/coordination/index.d.ts +9 -3
  16. package/dist/coordination/index.js +2 -2
  17. package/dist/coordination/metafile-cjs.json +1 -1
  18. package/dist/coordination/metafile-esm.json +1 -1
  19. package/dist/electron/index.cjs +222 -188
  20. package/dist/electron/index.d.cts +8 -2
  21. package/dist/electron/index.d.ts +8 -2
  22. package/dist/electron/index.js +222 -188
  23. package/dist/electron/metafile-cjs.json +1 -1
  24. package/dist/electron/metafile-esm.json +1 -1
  25. package/dist/hooks/index.cjs +4 -4
  26. package/dist/hooks/index.d.cts +18 -0
  27. package/dist/hooks/index.d.ts +18 -0
  28. package/dist/hooks/index.js +4 -4
  29. package/dist/hooks/metafile-cjs.json +1 -1
  30. package/dist/hooks/metafile-esm.json +1 -1
  31. package/dist/hosted/index.cjs +1 -1
  32. package/dist/hosted/index.d.cts +21 -3
  33. package/dist/hosted/index.d.ts +21 -3
  34. package/dist/hosted/index.js +1 -1
  35. package/dist/hosted/metafile-cjs.json +1 -1
  36. package/dist/hosted/metafile-esm.json +1 -1
  37. package/dist/index.cjs +432 -380
  38. package/dist/index.d.cts +283 -19
  39. package/dist/index.d.ts +283 -19
  40. package/dist/index.js +431 -379
  41. package/dist/intelligence/index.cjs +5 -5
  42. package/dist/intelligence/index.js +6 -6
  43. package/dist/intelligence/metafile-cjs.json +1 -1
  44. package/dist/intelligence/metafile-esm.json +1 -1
  45. package/dist/mcp/index.cjs +21 -21
  46. package/dist/mcp/index.d.cts +61 -6
  47. package/dist/mcp/index.d.ts +61 -6
  48. package/dist/mcp/index.js +21 -21
  49. package/dist/mcp/metafile-cjs.json +1 -1
  50. package/dist/mcp/metafile-esm.json +1 -1
  51. package/dist/metafile-cjs.json +1 -1
  52. package/dist/metafile-esm.json +1 -1
  53. package/dist/providers/metafile-cjs.json +1 -1
  54. package/dist/providers/metafile-esm.json +1 -1
  55. package/dist/recipes/metafile-cjs.json +1 -1
  56. package/dist/recipes/metafile-esm.json +1 -1
  57. package/dist/research/metafile-cjs.json +1 -1
  58. package/dist/research/metafile-esm.json +1 -1
  59. package/dist/session/index.cjs +24 -24
  60. package/dist/session/index.js +21 -21
  61. package/dist/session/metafile-cjs.json +1 -1
  62. package/dist/session/metafile-esm.json +1 -1
  63. package/dist/sharing/index.cjs +2 -2
  64. package/dist/sharing/index.js +3 -3
  65. package/dist/sharing/metafile-cjs.json +1 -1
  66. package/dist/sharing/metafile-esm.json +1 -1
  67. package/dist/skills/index.d.cts +5 -1
  68. package/dist/skills/index.d.ts +5 -1
  69. package/dist/utils/index.cjs +19 -18
  70. package/dist/utils/index.d.cts +5 -2
  71. package/dist/utils/index.d.ts +5 -2
  72. package/dist/utils/index.js +19 -18
  73. package/dist/utils/metafile-cjs.json +1 -1
  74. package/dist/utils/metafile-esm.json +1 -1
  75. package/package.json +2 -2
@@ -327,6 +327,7 @@ interface MCPElicitationRequest {
327
327
  message: string;
328
328
  requestedSchema?: Record<string, unknown>;
329
329
  params: Record<string, unknown>;
330
+ signal?: AbortSignal;
330
331
  }
331
332
  interface MCPElicitationResponse {
332
333
  action: MCPElicitationAction;
@@ -372,6 +373,7 @@ interface ConnectConfiguredMCPServersResult {
372
373
  name: string;
373
374
  error: string;
374
375
  }>;
376
+ disconnected?: string[];
375
377
  }
376
378
  interface MCPServerPromptRegistration {
377
379
  name: string;
@@ -403,6 +405,29 @@ interface MCPServerModeOptions {
403
405
  toolMetadata?: Record<string, MCPAppExtensionMetadata>;
404
406
  appCapabilities?: MCPAppCapabilities | false;
405
407
  }
408
+ declare const MCP_MAX_CATALOG_ENTRIES = 4096;
409
+ type MCPConnectionErrorCode = "MCP_CONNECTION_CLOSED" | "MCP_TRANSPORT_FAILED" | "MCP_SERVER_NOT_READY" | "MCP_SERVER_NOT_FOUND";
410
+ declare class MCPConnectionError extends Error {
411
+ readonly code: MCPConnectionErrorCode;
412
+ readonly serverName: string;
413
+ readonly details: {
414
+ method?: string;
415
+ status?: MCPServerState["status"];
416
+ cause?: unknown;
417
+ };
418
+ constructor(message: string, code: MCPConnectionErrorCode, serverName: string, details?: {
419
+ method?: string;
420
+ status?: MCPServerState["status"];
421
+ cause?: unknown;
422
+ });
423
+ }
424
+ type MCPCatalogErrorCode = "MCP_CATALOG_MALFORMED" | "MCP_CATALOG_TOO_LARGE";
425
+ declare class MCPCatalogError extends Error {
426
+ readonly code: MCPCatalogErrorCode;
427
+ readonly serverName: string;
428
+ readonly method: string;
429
+ constructor(message: string, code: MCPCatalogErrorCode, serverName: string, method: string);
430
+ }
406
431
  type MCPServerChangeReason = "connected" | "disconnected" | "tools_changed" | "prompts_changed" | "resources_changed" | "resource_updated" | "error";
407
432
  interface MCPServerChangeEvent {
408
433
  serverName: string;
@@ -428,6 +453,8 @@ declare class MCPManager {
428
453
  addServer(config: MCPServerConfig): Promise<void>;
429
454
  connectConfiguredServers(options: ConnectConfiguredMCPServersOptions): Promise<ConnectConfiguredMCPServersResult>;
430
455
  removeServer(name: string): void;
456
+ private dropEntry;
457
+ private rejectPendingFor;
431
458
  listTools(serverName?: string): MCPTool[];
432
459
  listAllTools(serverName?: string): MCPTool[];
433
460
  listAppTools(serverName?: string): MCPTool[];
@@ -446,6 +473,11 @@ declare class MCPManager {
446
473
  static loadConfiguredServers(cwd?: string): MCPConfiguredServer[];
447
474
  private createTransport;
448
475
  private discoverServerState;
476
+ private rediscover;
477
+ private resubscribe;
478
+ private runRefresh;
479
+ private fetchCatalog;
480
+ private isCurrentRefresh;
449
481
  private refreshTools;
450
482
  private refreshPrompts;
451
483
  private refreshResources;
@@ -453,12 +485,15 @@ declare class MCPManager {
453
485
  private getReadyServer;
454
486
  private sendRequest;
455
487
  private sendNotification;
488
+ private answer;
456
489
  private sendResponse;
457
490
  private sendError;
458
491
  private handleMessage;
459
492
  private handleRequest;
460
493
  private handleElicitationCreate;
461
494
  private handleNotification;
495
+ private failRefresh;
496
+ private settleCatalogFault;
462
497
  private resolveApprovalDecision;
463
498
  private emitServerStateChanged;
464
499
  }
@@ -619,6 +654,10 @@ interface ToolExecutionContext {
619
654
  operationId?: string;
620
655
  reportProgress?: (event: ToolProgressUpdate) => void;
621
656
  authorization?: ToolAuthorizationReceipt;
657
+ ownerSessionId?: string;
658
+ }
659
+ interface ToolPolicyProjectionContext {
660
+ ownerSessionId?: string;
622
661
  }
623
662
  type ToolExecutor = (input: Record<string, unknown>, context?: ToolExecutionContext) => Promise<ToolResult>;
624
663
  interface ToolPolicyProjection {
@@ -632,7 +671,7 @@ interface RegisteredTool {
632
671
  definition: ToolDefinition;
633
672
  execute: ToolExecutor;
634
673
  readOnly?: boolean;
635
- projectPolicyInput?: (input: Record<string, unknown>) => ToolPolicyProjection | {
674
+ projectPolicyInput?: (input: Record<string, unknown>, context?: ToolPolicyProjectionContext) => ToolPolicyProjection | {
636
675
  error: ToolResult;
637
676
  };
638
677
  }
@@ -673,7 +712,7 @@ declare class ToolRegistry {
673
712
  execute(name: string, input: Record<string, unknown>, context?: ToolExecutionContext): Promise<ToolResult>;
674
713
  listNames(): string[];
675
714
  has(name: string): boolean;
676
- projectPolicyInput(name: string, input: Record<string, unknown>): ToolPolicyProjection | {
715
+ projectPolicyInput(name: string, input: Record<string, unknown>, context?: ToolPolicyProjectionContext): ToolPolicyProjection | {
677
716
  error: ToolResult;
678
717
  };
679
718
  get size(): number;
@@ -747,6 +786,9 @@ declare class StdioTransport implements MCPTransportConnection {
747
786
  private onError;
748
787
  private onClose;
749
788
  private closed;
789
+ private exited;
790
+ private inputBroken;
791
+ private killTimer;
750
792
  constructor(process: ChildProcess, options?: {
751
793
  maxMessageChars?: number;
752
794
  });
@@ -757,6 +799,7 @@ declare class StdioTransport implements MCPTransportConnection {
757
799
  send(message: JsonRpcMessage): void;
758
800
  close(): void;
759
801
  get isAlive(): boolean;
802
+ private get hasExited();
760
803
  private setupListeners;
761
804
  private receive;
762
805
  private refuseOversized;
@@ -853,11 +896,16 @@ declare class StreamableHTTPTransport implements MCPTransportConnection {
853
896
  private receiveLoopActive;
854
897
  private reinitializePromise?;
855
898
  private challengeHeaders?;
899
+ private onSessionRenewed;
900
+ private onSessionLost;
856
901
  private readonly seenEventIds;
857
902
  constructor(url: string, options?: StreamableHTTPTransportOptions);
858
903
  setMessageHandler(handler: MessageHandler): void;
859
904
  setErrorHandler(handler: ErrorHandler): void;
860
905
  setCloseHandler(handler: CloseHandler): void;
906
+ setSessionRenewedHandler(handler: () => void): void;
907
+ setSessionLostHandler(handler: () => void): void;
908
+ private markSessionExpired;
861
909
  send(message: JsonRpcMessage): Promise<void>;
862
910
  close(): void;
863
911
  get isAlive(): boolean;
@@ -1015,6 +1063,12 @@ declare class MCPOAuthClient {
1015
1063
  type PersistentMcpScope = Exclude<MCPServerScope, "session">;
1016
1064
  declare function loadMcpConfigFile(configPath: string, scope?: PersistentMcpScope): MCPConfigFile;
1017
1065
  declare function saveMcpConfigFile(configPath: string, config: MCPConfigFile, scope?: PersistentMcpScope): void;
1066
+ interface MCPConfigSource {
1067
+ scope: Exclude<MCPServerScope, "session">;
1068
+ path: string;
1069
+ state: "absent" | "readable" | "unreadable";
1070
+ }
1071
+ declare function inspectMcpConfigSources(cwd?: string): MCPConfigSource[];
1018
1072
  declare function loadConfiguredMcpServers(cwd?: string): MCPConfiguredServer[];
1019
1073
  declare function upsertMcpServerConfig(scope: PersistentMcpScope, cwd: string | undefined, config: MCPServerConfig): string;
1020
1074
  declare function removeMcpServerConfig(scope: PersistentMcpScope, cwd: string | undefined, name: string): string;
@@ -1038,8 +1092,9 @@ declare function getMcpToolName(serverName: string, toolName: string): string;
1038
1092
  declare function getMcpPromptToolName(serverName: string, promptName: string): string;
1039
1093
  declare function getMcpResourceToolName(serverName: string, resource: MCPResource): string;
1040
1094
  declare function mcpInputSchemaToToolSchema(inputSchema: Record<string, unknown> | undefined): ToolDefinition["input_schema"];
1041
- declare function createMcpRegisteredTool(manager: MCPManager, tool: MCPTool): RegisteredTool;
1042
- declare function createMcpPromptRegisteredTool(manager: MCPManager, prompt: MCPPrompt): RegisteredTool;
1043
- declare function createMcpResourceRegisteredTool(manager: MCPManager, resource: MCPResource): RegisteredTool;
1095
+ declare function getMcpDefinitionFingerprint(kind: MCPRegistryEntryKind, entry: MCPTool | MCPPrompt | MCPResource): string;
1096
+ declare function createMcpRegisteredTool(manager: MCPManager, tool: MCPTool, registryName?: string): RegisteredTool;
1097
+ declare function createMcpPromptRegisteredTool(manager: MCPManager, prompt: MCPPrompt, registryName?: string): RegisteredTool;
1098
+ declare function createMcpResourceRegisteredTool(manager: MCPManager, resource: MCPResource, registryName?: string): RegisteredTool;
1044
1099
  declare function syncMcpToolsToRegistry(manager: MCPManager, registry: ToolRegistry, previouslyRegistered?: string[], filter?: MCPRegistryFilter): string[];
1045
- export { type ConnectConfiguredMCPServersOptions, type ConnectConfiguredMCPServersResult, type ExchangeMCPOAuthCodeOptions, type JsonRpcErrorResponse, type JsonRpcMessage, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccessResponse, type MCPAppCapabilities, type MCPAppContentSecurityPolicy, type MCPAppExtensionMetadata, type MCPAppMetadata, type MCPAppPermissions, type MCPAppResourceDescriptor, type MCPAppValidationResult, type MCPAppVisibility, type MCPApprovalDecision, type MCPBearerTokenRefreshHandler, type MCPBearerTokenResolver, type MCPConfigFile, type MCPConfiguredServer, type MCPElicitationAction, type MCPElicitationHandler, type MCPElicitationRequest, type MCPElicitationResponse, type MCPHttpAuthChallenge, MCPHttpTransportError, type MCPHttpUrlPhase, type MCPInitializeParams, type MCPInitializeResult, MCPManager, type MCPManagerOptions, MCPMessageTooLargeError, type MCPOAuthAuthorizationServerMetadata, type MCPOAuthAuthorizationSession, MCPOAuthClient, type MCPOAuthClientOptions, type MCPOAuthClientRegistration, type MCPOAuthClientRegistrationSource, type MCPOAuthConfig, type MCPOAuthDiscoveryResult, type MCPOAuthProtectedResourceMetadata, type MCPOAuthTokenSet, type MCPOAuthTokenStore, type MCPOAuthUrlPhase, type MCPPrompt, type MCPPromptGetParams, type MCPPromptGetResult, type MCPPromptsListResult, type MCPRegistryAccessPolicy, type MCPRegistryEntryDescriptor, type MCPRegistryEntryKind, type MCPRegistryFilter, type MCPResource, type MCPResourceReadParams, type MCPResourceReadResult, type MCPResourceSubscribeParams, type MCPResourceTemplate, type MCPResourceTemplatesListResult, type MCPResourceUnsubscribeParams, type MCPResourcesListResult, MCPServer, type MCPServerConfig, type MCPServerModeOptions, type MCPServerPromptRegistration, type MCPServerResourceRegistration, type MCPServerScope, type MCPServerState, type MCPTool, type MCPToolCallParams, type MCPToolCallResult, type MCPToolsListResult, type MCPTransport, type MCPTransportConnection, MCP_APPS_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_SCHEME, MCP_PROTOCOL_VERSION, MCP_STDIO_MAX_MESSAGE_CHARS, MCP_SUPPORTED_PROTOCOL_VERSIONS, type PrepareMCPOAuthAuthorizationOptions, SSETransport, StdioTransport, StreamableHTTPTransport, type StreamableHTTPTransportOptions, type StreamableHTTPTransportSnapshot, approveMcpServer, assertSupportedMcpProtocolVersion, assertValidMcpAppResource, canonicalizeMcpResourceUri, clearMcpServerApproval, createMcpAppCapabilities, createMcpAppExtensionCapabilities, createMcpPkcePair, createMcpPromptRegisteredTool, createMcpRegisteredTool, createMcpResourceRegisteredTool, denyMcpServer, getMcpAppMetadata, getMcpAppResourceUri, getMcpApprovalDecision, getMcpAuthorizationServerMetadataUrls, getMcpPromptToolName, getMcpProtectedResourceMetadataUrls, getMcpResourceToolName, getMcpToolName, isMcpAppResourceUri, isMcpOAuthTokenExpired, isMcpToolVisibleToApp, isMcpToolVisibleToModel, isSupportedMcpProtocolVersion, loadConfiguredMcpServers, loadMcpConfigFile, matchesMcpRegistryEntryPolicy, mcpInputSchemaToToolSchema, normalizeMcpAppVisibility, parseMcpWwwAuthenticate, removeMcpServerConfig, resetMcpServerApprovals, saveMcpConfigFile, syncMcpToolsToRegistry, upsertMcpServerConfig, validateMcpAppResource };
1100
+ export { type ConnectConfiguredMCPServersOptions, type ConnectConfiguredMCPServersResult, type ExchangeMCPOAuthCodeOptions, type JsonRpcErrorResponse, type JsonRpcMessage, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccessResponse, type MCPAppCapabilities, type MCPAppContentSecurityPolicy, type MCPAppExtensionMetadata, type MCPAppMetadata, type MCPAppPermissions, type MCPAppResourceDescriptor, type MCPAppValidationResult, type MCPAppVisibility, type MCPApprovalDecision, type MCPBearerTokenRefreshHandler, type MCPBearerTokenResolver, MCPCatalogError, type MCPCatalogErrorCode, type MCPConfigFile, type MCPConfigSource, type MCPConfiguredServer, MCPConnectionError, type MCPConnectionErrorCode, type MCPElicitationAction, type MCPElicitationHandler, type MCPElicitationRequest, type MCPElicitationResponse, type MCPHttpAuthChallenge, MCPHttpTransportError, type MCPHttpUrlPhase, type MCPInitializeParams, type MCPInitializeResult, MCPManager, type MCPManagerOptions, MCPMessageTooLargeError, type MCPOAuthAuthorizationServerMetadata, type MCPOAuthAuthorizationSession, MCPOAuthClient, type MCPOAuthClientOptions, type MCPOAuthClientRegistration, type MCPOAuthClientRegistrationSource, type MCPOAuthConfig, type MCPOAuthDiscoveryResult, type MCPOAuthProtectedResourceMetadata, type MCPOAuthTokenSet, type MCPOAuthTokenStore, type MCPOAuthUrlPhase, type MCPPrompt, type MCPPromptGetParams, type MCPPromptGetResult, type MCPPromptsListResult, type MCPRegistryAccessPolicy, type MCPRegistryEntryDescriptor, type MCPRegistryEntryKind, type MCPRegistryFilter, type MCPResource, type MCPResourceReadParams, type MCPResourceReadResult, type MCPResourceSubscribeParams, type MCPResourceTemplate, type MCPResourceTemplatesListResult, type MCPResourceUnsubscribeParams, type MCPResourcesListResult, MCPServer, type MCPServerConfig, type MCPServerModeOptions, type MCPServerPromptRegistration, type MCPServerResourceRegistration, type MCPServerScope, type MCPServerState, type MCPTool, type MCPToolCallParams, type MCPToolCallResult, type MCPToolsListResult, type MCPTransport, type MCPTransportConnection, MCP_APPS_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_SCHEME, MCP_MAX_CATALOG_ENTRIES, MCP_PROTOCOL_VERSION, MCP_STDIO_MAX_MESSAGE_CHARS, MCP_SUPPORTED_PROTOCOL_VERSIONS, type PrepareMCPOAuthAuthorizationOptions, SSETransport, StdioTransport, StreamableHTTPTransport, type StreamableHTTPTransportOptions, type StreamableHTTPTransportSnapshot, approveMcpServer, assertSupportedMcpProtocolVersion, assertValidMcpAppResource, canonicalizeMcpResourceUri, clearMcpServerApproval, createMcpAppCapabilities, createMcpAppExtensionCapabilities, createMcpPkcePair, createMcpPromptRegisteredTool, createMcpRegisteredTool, createMcpResourceRegisteredTool, denyMcpServer, getMcpAppMetadata, getMcpAppResourceUri, getMcpApprovalDecision, getMcpAuthorizationServerMetadataUrls, getMcpDefinitionFingerprint, getMcpPromptToolName, getMcpProtectedResourceMetadataUrls, getMcpResourceToolName, getMcpToolName, inspectMcpConfigSources, isMcpAppResourceUri, isMcpOAuthTokenExpired, isMcpToolVisibleToApp, isMcpToolVisibleToModel, isSupportedMcpProtocolVersion, loadConfiguredMcpServers, loadMcpConfigFile, matchesMcpRegistryEntryPolicy, mcpInputSchemaToToolSchema, normalizeMcpAppVisibility, parseMcpWwwAuthenticate, removeMcpServerConfig, resetMcpServerApprovals, saveMcpConfigFile, syncMcpToolsToRegistry, upsertMcpServerConfig, validateMcpAppResource };
@@ -327,6 +327,7 @@ interface MCPElicitationRequest {
327
327
  message: string;
328
328
  requestedSchema?: Record<string, unknown>;
329
329
  params: Record<string, unknown>;
330
+ signal?: AbortSignal;
330
331
  }
331
332
  interface MCPElicitationResponse {
332
333
  action: MCPElicitationAction;
@@ -372,6 +373,7 @@ interface ConnectConfiguredMCPServersResult {
372
373
  name: string;
373
374
  error: string;
374
375
  }>;
376
+ disconnected?: string[];
375
377
  }
376
378
  interface MCPServerPromptRegistration {
377
379
  name: string;
@@ -403,6 +405,29 @@ interface MCPServerModeOptions {
403
405
  toolMetadata?: Record<string, MCPAppExtensionMetadata>;
404
406
  appCapabilities?: MCPAppCapabilities | false;
405
407
  }
408
+ declare const MCP_MAX_CATALOG_ENTRIES = 4096;
409
+ type MCPConnectionErrorCode = "MCP_CONNECTION_CLOSED" | "MCP_TRANSPORT_FAILED" | "MCP_SERVER_NOT_READY" | "MCP_SERVER_NOT_FOUND";
410
+ declare class MCPConnectionError extends Error {
411
+ readonly code: MCPConnectionErrorCode;
412
+ readonly serverName: string;
413
+ readonly details: {
414
+ method?: string;
415
+ status?: MCPServerState["status"];
416
+ cause?: unknown;
417
+ };
418
+ constructor(message: string, code: MCPConnectionErrorCode, serverName: string, details?: {
419
+ method?: string;
420
+ status?: MCPServerState["status"];
421
+ cause?: unknown;
422
+ });
423
+ }
424
+ type MCPCatalogErrorCode = "MCP_CATALOG_MALFORMED" | "MCP_CATALOG_TOO_LARGE";
425
+ declare class MCPCatalogError extends Error {
426
+ readonly code: MCPCatalogErrorCode;
427
+ readonly serverName: string;
428
+ readonly method: string;
429
+ constructor(message: string, code: MCPCatalogErrorCode, serverName: string, method: string);
430
+ }
406
431
  type MCPServerChangeReason = "connected" | "disconnected" | "tools_changed" | "prompts_changed" | "resources_changed" | "resource_updated" | "error";
407
432
  interface MCPServerChangeEvent {
408
433
  serverName: string;
@@ -428,6 +453,8 @@ declare class MCPManager {
428
453
  addServer(config: MCPServerConfig): Promise<void>;
429
454
  connectConfiguredServers(options: ConnectConfiguredMCPServersOptions): Promise<ConnectConfiguredMCPServersResult>;
430
455
  removeServer(name: string): void;
456
+ private dropEntry;
457
+ private rejectPendingFor;
431
458
  listTools(serverName?: string): MCPTool[];
432
459
  listAllTools(serverName?: string): MCPTool[];
433
460
  listAppTools(serverName?: string): MCPTool[];
@@ -446,6 +473,11 @@ declare class MCPManager {
446
473
  static loadConfiguredServers(cwd?: string): MCPConfiguredServer[];
447
474
  private createTransport;
448
475
  private discoverServerState;
476
+ private rediscover;
477
+ private resubscribe;
478
+ private runRefresh;
479
+ private fetchCatalog;
480
+ private isCurrentRefresh;
449
481
  private refreshTools;
450
482
  private refreshPrompts;
451
483
  private refreshResources;
@@ -453,12 +485,15 @@ declare class MCPManager {
453
485
  private getReadyServer;
454
486
  private sendRequest;
455
487
  private sendNotification;
488
+ private answer;
456
489
  private sendResponse;
457
490
  private sendError;
458
491
  private handleMessage;
459
492
  private handleRequest;
460
493
  private handleElicitationCreate;
461
494
  private handleNotification;
495
+ private failRefresh;
496
+ private settleCatalogFault;
462
497
  private resolveApprovalDecision;
463
498
  private emitServerStateChanged;
464
499
  }
@@ -619,6 +654,10 @@ interface ToolExecutionContext {
619
654
  operationId?: string;
620
655
  reportProgress?: (event: ToolProgressUpdate) => void;
621
656
  authorization?: ToolAuthorizationReceipt;
657
+ ownerSessionId?: string;
658
+ }
659
+ interface ToolPolicyProjectionContext {
660
+ ownerSessionId?: string;
622
661
  }
623
662
  type ToolExecutor = (input: Record<string, unknown>, context?: ToolExecutionContext) => Promise<ToolResult>;
624
663
  interface ToolPolicyProjection {
@@ -632,7 +671,7 @@ interface RegisteredTool {
632
671
  definition: ToolDefinition;
633
672
  execute: ToolExecutor;
634
673
  readOnly?: boolean;
635
- projectPolicyInput?: (input: Record<string, unknown>) => ToolPolicyProjection | {
674
+ projectPolicyInput?: (input: Record<string, unknown>, context?: ToolPolicyProjectionContext) => ToolPolicyProjection | {
636
675
  error: ToolResult;
637
676
  };
638
677
  }
@@ -673,7 +712,7 @@ declare class ToolRegistry {
673
712
  execute(name: string, input: Record<string, unknown>, context?: ToolExecutionContext): Promise<ToolResult>;
674
713
  listNames(): string[];
675
714
  has(name: string): boolean;
676
- projectPolicyInput(name: string, input: Record<string, unknown>): ToolPolicyProjection | {
715
+ projectPolicyInput(name: string, input: Record<string, unknown>, context?: ToolPolicyProjectionContext): ToolPolicyProjection | {
677
716
  error: ToolResult;
678
717
  };
679
718
  get size(): number;
@@ -747,6 +786,9 @@ declare class StdioTransport implements MCPTransportConnection {
747
786
  private onError;
748
787
  private onClose;
749
788
  private closed;
789
+ private exited;
790
+ private inputBroken;
791
+ private killTimer;
750
792
  constructor(process: ChildProcess, options?: {
751
793
  maxMessageChars?: number;
752
794
  });
@@ -757,6 +799,7 @@ declare class StdioTransport implements MCPTransportConnection {
757
799
  send(message: JsonRpcMessage): void;
758
800
  close(): void;
759
801
  get isAlive(): boolean;
802
+ private get hasExited();
760
803
  private setupListeners;
761
804
  private receive;
762
805
  private refuseOversized;
@@ -853,11 +896,16 @@ declare class StreamableHTTPTransport implements MCPTransportConnection {
853
896
  private receiveLoopActive;
854
897
  private reinitializePromise?;
855
898
  private challengeHeaders?;
899
+ private onSessionRenewed;
900
+ private onSessionLost;
856
901
  private readonly seenEventIds;
857
902
  constructor(url: string, options?: StreamableHTTPTransportOptions);
858
903
  setMessageHandler(handler: MessageHandler): void;
859
904
  setErrorHandler(handler: ErrorHandler): void;
860
905
  setCloseHandler(handler: CloseHandler): void;
906
+ setSessionRenewedHandler(handler: () => void): void;
907
+ setSessionLostHandler(handler: () => void): void;
908
+ private markSessionExpired;
861
909
  send(message: JsonRpcMessage): Promise<void>;
862
910
  close(): void;
863
911
  get isAlive(): boolean;
@@ -1015,6 +1063,12 @@ declare class MCPOAuthClient {
1015
1063
  type PersistentMcpScope = Exclude<MCPServerScope, "session">;
1016
1064
  declare function loadMcpConfigFile(configPath: string, scope?: PersistentMcpScope): MCPConfigFile;
1017
1065
  declare function saveMcpConfigFile(configPath: string, config: MCPConfigFile, scope?: PersistentMcpScope): void;
1066
+ interface MCPConfigSource {
1067
+ scope: Exclude<MCPServerScope, "session">;
1068
+ path: string;
1069
+ state: "absent" | "readable" | "unreadable";
1070
+ }
1071
+ declare function inspectMcpConfigSources(cwd?: string): MCPConfigSource[];
1018
1072
  declare function loadConfiguredMcpServers(cwd?: string): MCPConfiguredServer[];
1019
1073
  declare function upsertMcpServerConfig(scope: PersistentMcpScope, cwd: string | undefined, config: MCPServerConfig): string;
1020
1074
  declare function removeMcpServerConfig(scope: PersistentMcpScope, cwd: string | undefined, name: string): string;
@@ -1038,8 +1092,9 @@ declare function getMcpToolName(serverName: string, toolName: string): string;
1038
1092
  declare function getMcpPromptToolName(serverName: string, promptName: string): string;
1039
1093
  declare function getMcpResourceToolName(serverName: string, resource: MCPResource): string;
1040
1094
  declare function mcpInputSchemaToToolSchema(inputSchema: Record<string, unknown> | undefined): ToolDefinition["input_schema"];
1041
- declare function createMcpRegisteredTool(manager: MCPManager, tool: MCPTool): RegisteredTool;
1042
- declare function createMcpPromptRegisteredTool(manager: MCPManager, prompt: MCPPrompt): RegisteredTool;
1043
- declare function createMcpResourceRegisteredTool(manager: MCPManager, resource: MCPResource): RegisteredTool;
1095
+ declare function getMcpDefinitionFingerprint(kind: MCPRegistryEntryKind, entry: MCPTool | MCPPrompt | MCPResource): string;
1096
+ declare function createMcpRegisteredTool(manager: MCPManager, tool: MCPTool, registryName?: string): RegisteredTool;
1097
+ declare function createMcpPromptRegisteredTool(manager: MCPManager, prompt: MCPPrompt, registryName?: string): RegisteredTool;
1098
+ declare function createMcpResourceRegisteredTool(manager: MCPManager, resource: MCPResource, registryName?: string): RegisteredTool;
1044
1099
  declare function syncMcpToolsToRegistry(manager: MCPManager, registry: ToolRegistry, previouslyRegistered?: string[], filter?: MCPRegistryFilter): string[];
1045
- export { type ConnectConfiguredMCPServersOptions, type ConnectConfiguredMCPServersResult, type ExchangeMCPOAuthCodeOptions, type JsonRpcErrorResponse, type JsonRpcMessage, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccessResponse, type MCPAppCapabilities, type MCPAppContentSecurityPolicy, type MCPAppExtensionMetadata, type MCPAppMetadata, type MCPAppPermissions, type MCPAppResourceDescriptor, type MCPAppValidationResult, type MCPAppVisibility, type MCPApprovalDecision, type MCPBearerTokenRefreshHandler, type MCPBearerTokenResolver, type MCPConfigFile, type MCPConfiguredServer, type MCPElicitationAction, type MCPElicitationHandler, type MCPElicitationRequest, type MCPElicitationResponse, type MCPHttpAuthChallenge, MCPHttpTransportError, type MCPHttpUrlPhase, type MCPInitializeParams, type MCPInitializeResult, MCPManager, type MCPManagerOptions, MCPMessageTooLargeError, type MCPOAuthAuthorizationServerMetadata, type MCPOAuthAuthorizationSession, MCPOAuthClient, type MCPOAuthClientOptions, type MCPOAuthClientRegistration, type MCPOAuthClientRegistrationSource, type MCPOAuthConfig, type MCPOAuthDiscoveryResult, type MCPOAuthProtectedResourceMetadata, type MCPOAuthTokenSet, type MCPOAuthTokenStore, type MCPOAuthUrlPhase, type MCPPrompt, type MCPPromptGetParams, type MCPPromptGetResult, type MCPPromptsListResult, type MCPRegistryAccessPolicy, type MCPRegistryEntryDescriptor, type MCPRegistryEntryKind, type MCPRegistryFilter, type MCPResource, type MCPResourceReadParams, type MCPResourceReadResult, type MCPResourceSubscribeParams, type MCPResourceTemplate, type MCPResourceTemplatesListResult, type MCPResourceUnsubscribeParams, type MCPResourcesListResult, MCPServer, type MCPServerConfig, type MCPServerModeOptions, type MCPServerPromptRegistration, type MCPServerResourceRegistration, type MCPServerScope, type MCPServerState, type MCPTool, type MCPToolCallParams, type MCPToolCallResult, type MCPToolsListResult, type MCPTransport, type MCPTransportConnection, MCP_APPS_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_SCHEME, MCP_PROTOCOL_VERSION, MCP_STDIO_MAX_MESSAGE_CHARS, MCP_SUPPORTED_PROTOCOL_VERSIONS, type PrepareMCPOAuthAuthorizationOptions, SSETransport, StdioTransport, StreamableHTTPTransport, type StreamableHTTPTransportOptions, type StreamableHTTPTransportSnapshot, approveMcpServer, assertSupportedMcpProtocolVersion, assertValidMcpAppResource, canonicalizeMcpResourceUri, clearMcpServerApproval, createMcpAppCapabilities, createMcpAppExtensionCapabilities, createMcpPkcePair, createMcpPromptRegisteredTool, createMcpRegisteredTool, createMcpResourceRegisteredTool, denyMcpServer, getMcpAppMetadata, getMcpAppResourceUri, getMcpApprovalDecision, getMcpAuthorizationServerMetadataUrls, getMcpPromptToolName, getMcpProtectedResourceMetadataUrls, getMcpResourceToolName, getMcpToolName, isMcpAppResourceUri, isMcpOAuthTokenExpired, isMcpToolVisibleToApp, isMcpToolVisibleToModel, isSupportedMcpProtocolVersion, loadConfiguredMcpServers, loadMcpConfigFile, matchesMcpRegistryEntryPolicy, mcpInputSchemaToToolSchema, normalizeMcpAppVisibility, parseMcpWwwAuthenticate, removeMcpServerConfig, resetMcpServerApprovals, saveMcpConfigFile, syncMcpToolsToRegistry, upsertMcpServerConfig, validateMcpAppResource };
1100
+ export { type ConnectConfiguredMCPServersOptions, type ConnectConfiguredMCPServersResult, type ExchangeMCPOAuthCodeOptions, type JsonRpcErrorResponse, type JsonRpcMessage, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccessResponse, type MCPAppCapabilities, type MCPAppContentSecurityPolicy, type MCPAppExtensionMetadata, type MCPAppMetadata, type MCPAppPermissions, type MCPAppResourceDescriptor, type MCPAppValidationResult, type MCPAppVisibility, type MCPApprovalDecision, type MCPBearerTokenRefreshHandler, type MCPBearerTokenResolver, MCPCatalogError, type MCPCatalogErrorCode, type MCPConfigFile, type MCPConfigSource, type MCPConfiguredServer, MCPConnectionError, type MCPConnectionErrorCode, type MCPElicitationAction, type MCPElicitationHandler, type MCPElicitationRequest, type MCPElicitationResponse, type MCPHttpAuthChallenge, MCPHttpTransportError, type MCPHttpUrlPhase, type MCPInitializeParams, type MCPInitializeResult, MCPManager, type MCPManagerOptions, MCPMessageTooLargeError, type MCPOAuthAuthorizationServerMetadata, type MCPOAuthAuthorizationSession, MCPOAuthClient, type MCPOAuthClientOptions, type MCPOAuthClientRegistration, type MCPOAuthClientRegistrationSource, type MCPOAuthConfig, type MCPOAuthDiscoveryResult, type MCPOAuthProtectedResourceMetadata, type MCPOAuthTokenSet, type MCPOAuthTokenStore, type MCPOAuthUrlPhase, type MCPPrompt, type MCPPromptGetParams, type MCPPromptGetResult, type MCPPromptsListResult, type MCPRegistryAccessPolicy, type MCPRegistryEntryDescriptor, type MCPRegistryEntryKind, type MCPRegistryFilter, type MCPResource, type MCPResourceReadParams, type MCPResourceReadResult, type MCPResourceSubscribeParams, type MCPResourceTemplate, type MCPResourceTemplatesListResult, type MCPResourceUnsubscribeParams, type MCPResourcesListResult, MCPServer, type MCPServerConfig, type MCPServerModeOptions, type MCPServerPromptRegistration, type MCPServerResourceRegistration, type MCPServerScope, type MCPServerState, type MCPTool, type MCPToolCallParams, type MCPToolCallResult, type MCPToolsListResult, type MCPTransport, type MCPTransportConnection, MCP_APPS_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_SCHEME, MCP_MAX_CATALOG_ENTRIES, MCP_PROTOCOL_VERSION, MCP_STDIO_MAX_MESSAGE_CHARS, MCP_SUPPORTED_PROTOCOL_VERSIONS, type PrepareMCPOAuthAuthorizationOptions, SSETransport, StdioTransport, StreamableHTTPTransport, type StreamableHTTPTransportOptions, type StreamableHTTPTransportSnapshot, approveMcpServer, assertSupportedMcpProtocolVersion, assertValidMcpAppResource, canonicalizeMcpResourceUri, clearMcpServerApproval, createMcpAppCapabilities, createMcpAppExtensionCapabilities, createMcpPkcePair, createMcpPromptRegisteredTool, createMcpRegisteredTool, createMcpResourceRegisteredTool, denyMcpServer, getMcpAppMetadata, getMcpAppResourceUri, getMcpApprovalDecision, getMcpAuthorizationServerMetadataUrls, getMcpDefinitionFingerprint, getMcpPromptToolName, getMcpProtectedResourceMetadataUrls, getMcpResourceToolName, getMcpToolName, inspectMcpConfigSources, isMcpAppResourceUri, isMcpOAuthTokenExpired, isMcpToolVisibleToApp, isMcpToolVisibleToModel, isSupportedMcpProtocolVersion, loadConfiguredMcpServers, loadMcpConfigFile, matchesMcpRegistryEntryPolicy, mcpInputSchemaToToolSchema, normalizeMcpAppVisibility, parseMcpWwwAuthenticate, removeMcpServerConfig, resetMcpServerApprovals, saveMcpConfigFile, syncMcpToolsToRegistry, upsertMcpServerConfig, validateMcpAppResource };