@axiom-lattice/core 4.2.17 → 4.4.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.
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ import { BaseLanguageModelInput, LanguageModelLike } from '@langchain/core/langu
8
8
  import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
9
9
  import { ChatResult } from '@langchain/core/outputs';
10
10
  import * as _axiom_lattice_protocols from '@axiom-lattice/protocols';
11
- import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, DeepAgentConfig, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TrustedRunContext, QueuedExecutionMode, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, OpenAuditStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, AgentWebAppStore, CapabilityBundleStore, ProjectRoomStore, ProjectMembershipStore, ProjectBotMembershipStore, ProjectRoomMessageStore, ProjectRoomReadStateStore, UserPushSubscriptionStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, AgentWebApp, CreateAgentWebAppInput, AgentWebAppStorePatch, AgentWebAppUpdateOptions, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationInput, UpdateChannelInstallationRequest, Binding, CreateBindingInput, BindingMutablePatch, BindingListParams, A2AApiKeyRecord, CreateA2AApiKeyInput, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditAppendInput, OpenAuditQuery, OpenAuditRecord, TaskMutationSnapshot, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, ProjectRoom, ProjectMembership, ProjectBotMembership, ProjectRoomMessage, ProjectHumanRole, ProjectMembershipMutationResult, ProjectRoomReadState, UserPushSubscription, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, PluginSkillDefinition, McpTool, ResourceResolver, ResourceAddress, ShareVisibility, OpenGrant, CreateShareRequest, ChannelAdapter, InterruptPolicy, ProjectTaskLifecycleAction, TaskBeliefState, PluginMeta, Plugin, PluginMetaOutput, SandboxPluginManifest, SandboxPluginToolDef, SandboxPluginDiagnostic, CapabilityPreview, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
11
+ import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, DeepAgentConfig, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TrustedRunContext, QueuedExecutionMode, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, OpenAuditStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, AgentWebAppStore, CapabilityBundleStore, ProjectRoomStore, ProjectMembershipStore, ProjectBotMembershipStore, ProjectRoomMessageStore, ProjectRoomReadStateStore, UserPushSubscriptionStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, AgentWebApp, CreateAgentWebAppInput, AgentWebAppStorePatch, AgentWebAppUpdateOptions, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationInput, UpdateChannelInstallationRequest, Binding, CreateBindingInput, BindingMutablePatch, BindingListParams, A2AApiKeyRecord, CreateA2AApiKeyInput, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditAppendInput, OpenAuditQuery, OpenAuditRecord, TaskMutationSnapshot, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, ProjectRoom, ProjectMembership, ProjectBotMembership, ProjectRoomMessage, ProjectHumanRole, ProjectMembershipMutationResult, ProjectRoomReadState, UserPushSubscription, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, PluginSkillDefinition, McpTool, McpUiResourcePayload, McpServerConfig, McpUiRef, ResourceResolver, ResourceAddress, ShareVisibility, OpenGrant, CreateShareRequest, ChannelAdapter, InterruptPolicy, ProjectTaskLifecycleAction, TaskBeliefState, PluginMeta, Plugin, PluginMetaOutput, SandboxPluginManifest, SandboxPluginToolDef, SandboxPluginDiagnostic, CapabilityPreview, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
12
12
  export { _axiom_lattice_protocols as Protocols };
13
13
  export { AgentConfig, AgentType, GraphBuildOptions, MemoryType, ProjectRoomTrustedRunContext, QueuedExecutionMode, TrustedRunContext, parseQueuedExecutionMode, parseTrustedRunContext } from '@axiom-lattice/protocols';
14
14
  import * as langchain from 'langchain';
@@ -23,7 +23,7 @@ import { ReplaySubject } from 'rxjs';
23
23
  import { Embeddings } from '@langchain/core/embeddings';
24
24
  import { VectorStore } from '@langchain/core/vectorstores';
25
25
  import { DocumentInterface } from '@langchain/core/documents';
26
- import { Connection, MultiServerMCPClient } from '@langchain/mcp-adapters';
26
+ import { Connection } from '@langchain/mcp-adapters';
27
27
  import { SandboxClient } from '@agent-infra/sandbox';
28
28
  import { Sandbox } from 'e2b';
29
29
  import { Sandbox as Sandbox$1 } from '@daytonaio/sdk';
@@ -1739,6 +1739,31 @@ declare class ToolLatticeManager extends BaseLatticeManager<ToolLattice> {
1739
1739
  * @param tool 已有的StructuredTool实例
1740
1740
  */
1741
1741
  registerExistingTool(key: string, tool: StructuredTool): void;
1742
+ /**
1743
+ * Register an existing StructuredTool into a specific tenant's tool bucket.
1744
+ *
1745
+ * @param tenantId - tenant that owns the tool
1746
+ * @param key - tool lattice key (no tenant prefix)
1747
+ * @param tool - the StructuredTool client
1748
+ */
1749
+ registerExistingToolWithTenant(tenantId: string, key: string, tool: StructuredTool): void;
1750
+ /**
1751
+ * Get a tool lattice from a specific tenant bucket.
1752
+ *
1753
+ * @param tenantId - tenant bucket
1754
+ * @param key - tool lattice key
1755
+ * @returns the tool lattice or undefined
1756
+ */
1757
+ getToolLatticeWithTenant(tenantId: string, key: string): ToolLattice | undefined;
1758
+ /**
1759
+ * Get a tool client for a tenant, falling back to the "default" bucket for
1760
+ * built-in tools. Throws if the tool exists in neither bucket.
1761
+ *
1762
+ * @param tenantId - requesting tenant
1763
+ * @param key - tool lattice key
1764
+ * @returns the StructuredTool client
1765
+ */
1766
+ getToolClientWithTenant(tenantId: string, key: string): StructuredTool;
1742
1767
  /**
1743
1768
  * 验证工具输入参数
1744
1769
  * @param key Lattice键名
@@ -1749,7 +1774,9 @@ declare class ToolLatticeManager extends BaseLatticeManager<ToolLattice> {
1749
1774
  declare const toolLatticeManager: ToolLatticeManager;
1750
1775
  declare const registerToolLattice: (key: string, config: ToolConfig, executor: ToolExecutor) => void;
1751
1776
  declare const registerExistingTool: (key: string, tool: StructuredTool) => void;
1777
+ declare const registerExistingToolWithTenant: (tenantId: string, key: string, tool: StructuredTool) => void;
1752
1778
  declare const getToolLattice: (key: string) => ToolLattice | undefined;
1779
+ declare const getToolClientWithTenant: (tenantId: string, key: string) => StructuredTool<_langchain_core_tools.ToolSchemaBase, any, any, any>;
1753
1780
  declare const getToolDefinition: (key: string) => ToolConfig;
1754
1781
  declare const getToolClient: (key: string) => StructuredTool<_langchain_core_tools.ToolSchemaBase, any, any, any>;
1755
1782
  declare const getAllToolDefinitions: () => ToolConfig[];
@@ -3927,6 +3954,42 @@ declare class InMemoryTaskStore implements TaskStore {
3927
3954
  clear(tenantId?: string): void;
3928
3955
  }
3929
3956
 
3957
+ /**
3958
+ * In-memory implementation of TaskWorkItemStore.
3959
+ * Stores work items per tenant in a Map<tenantId, Map<taskId, TaskWorkItem[]>>.
3960
+ */
3961
+ declare class InMemoryTaskWorkItemStore implements TaskWorkItemStore {
3962
+ private readonly tasks?;
3963
+ private store;
3964
+ private events;
3965
+ /** Creates a store optionally coordinated with an in-memory task store. */
3966
+ constructor(tasks?: InMemoryTaskStore | undefined);
3967
+ /**
3968
+ * Create a new work item
3969
+ */
3970
+ create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
3971
+ /** Atomically append only while the shared task snapshot matches. */
3972
+ createIfTaskSnapshot(params: CreateWorkItemRequest, snapshot: TaskMutationSnapshot): Promise<TaskWorkItem | null>;
3973
+ private append;
3974
+ /** Find an event by its tenant- and task-scoped key. */
3975
+ findByEventKey(tenantId: string, taskId: string, eventKey: string): Promise<TaskWorkItem | null>;
3976
+ /** Atomically return an existing event or create it once. */
3977
+ createIfAbsentByEventKey(params: CreateWorkItemIfAbsentRequest): Promise<TaskWorkItem>;
3978
+ /**
3979
+ * List work items matching filter criteria
3980
+ */
3981
+ list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
3982
+ /** List a bounded newest-first view of unreconciled execution results. */
3983
+ listPendingExecutionResults(params: {
3984
+ tenantId: string;
3985
+ taskId: string;
3986
+ limit: number;
3987
+ }): Promise<TaskWorkItem[]>;
3988
+ /** Lists canonical project lifecycle events with an exclusive cursor. */
3989
+ listProjectLifecycleEvents(query: ProjectLifecycleEventQuery): Promise<TaskWorkItem[]>;
3990
+ private eventMapKey;
3991
+ }
3992
+
3930
3993
  /**
3931
3994
  * InMemoryCollectionStore
3932
3995
  *
@@ -5273,92 +5336,448 @@ declare class SimpleMemoryVectorStore extends VectorStore {
5273
5336
  }
5274
5337
 
5275
5338
  /**
5276
- * McpLatticeManager
5277
- *
5278
- * MCP Lattice Manager - Manages MCP client connections.
5279
- * Each MCP server gets its own independent MultiServerMCPClient instance,
5280
- * so adding/removing servers never affects other servers' connections or tools.
5281
- * Follows the singleton pattern for global access.
5339
+ * MCP runtime types for tenant-scoped connection management.
5282
5340
  */
5283
5341
 
5284
- interface McpServerInfo {
5285
- name: string;
5286
- connection: Connection;
5342
+ /** Exact tenant + server identity used as the runtime map key. */
5343
+ interface McpServerId {
5344
+ tenantId: string;
5345
+ serverKey: string;
5287
5346
  }
5288
- interface McpLatticeInterface {
5289
- client: MultiServerMCPClient;
5290
- servers: Map<string, McpServerInfo>;
5347
+ /** Per-server connection policy. */
5348
+ interface McpConnectionOptions {
5349
+ /** Single connect/handshake timeout in ms. */
5350
+ timeoutMs?: number;
5351
+ /** Max reconnect attempts before giving up. */
5352
+ maxAttempts?: number;
5353
+ /** Base delay for exponential backoff in ms. */
5354
+ delayMs?: number;
5355
+ }
5356
+ /** Options accepted by `McpLatticeManager.registerServer`. */
5357
+ interface McpRegisterOptions extends McpConnectionOptions {
5358
+ /** Tool-name allowlist to persist on the runtime for reconnect re-registration. `undefined` = all, `[]` = none. */
5359
+ selectedTools?: string[];
5360
+ }
5361
+ /** Runtime lifecycle state of one MCP server. */
5362
+ type McpServerState = "idle" | "connecting" | "connected" | "reconnecting" | "failed";
5363
+ /** Minimal MCP client session surface used for health checks, tool listing and UI resource access. */
5364
+ interface McpClientSession {
5365
+ listTools(): Promise<{
5366
+ tools: Array<{
5367
+ name: string;
5368
+ description?: string;
5369
+ inputSchema?: unknown;
5370
+ _meta?: Record<string, unknown>;
5371
+ }>;
5372
+ }>;
5373
+ readResource?(params: {
5374
+ uri: string;
5375
+ }): Promise<{
5376
+ contents: Array<{
5377
+ uri: string;
5378
+ mimeType?: string;
5379
+ text?: string;
5380
+ blob?: string;
5381
+ _meta?: Record<string, unknown>;
5382
+ }>;
5383
+ }>;
5384
+ callTool?(params: {
5385
+ name: string;
5386
+ arguments?: Record<string, unknown>;
5387
+ }): Promise<unknown>;
5388
+ }
5389
+ /** Structural surface of MultiServerMCPClient used by the manager (injectable for tests). */
5390
+ interface McpClientLike {
5391
+ initializeConnections(): Promise<unknown>;
5392
+ getClient(serverName: string): Promise<McpClientSession | undefined>;
5393
+ getTools(serverName: string): Promise<DynamicStructuredTool[]>;
5394
+ close(): Promise<void>;
5395
+ }
5396
+ /** Factory seam so tests can inject a fake MCP client. */
5397
+ type McpClientFactory = (config: {
5398
+ mcpServers: Record<string, Connection>;
5399
+ }) => McpClientLike;
5400
+ /** Internal per-(tenant, server) runtime record. */
5401
+ interface McpServerRuntime {
5402
+ id: McpServerId;
5403
+ connection: Connection;
5404
+ options: Required<McpConnectionOptions>;
5405
+ state: McpServerState;
5406
+ client?: McpClientLike;
5407
+ toolKeys: string[];
5408
+ selectedTools?: string[];
5409
+ attempt: number;
5410
+ timer?: ReturnType<typeof setTimeout>;
5411
+ /** In-flight connect promise, used to single-flight concurrent connects. */
5412
+ connectPromise?: Promise<void>;
5291
5413
  }
5292
- declare class McpLatticeManager extends BaseLatticeManager<McpLatticeInterface> {
5414
+
5415
+ /**
5416
+ * McpLatticeManager
5417
+ *
5418
+ * Tenant-scoped MCP connection manager with transparent self-healing.
5419
+ * Each (tenantId, serverKey) pair owns an independent client, tool set and
5420
+ * reconnect state, so a failure in one never affects the others.
5421
+ */
5422
+
5423
+ /**
5424
+ * Manages tenant-scoped MCP connections with isolated failures and background
5425
+ * self-healing.
5426
+ *
5427
+ * @example
5428
+ * ```ts
5429
+ * mcpManager.registerServer("tenant-1", "github", connection);
5430
+ * await mcpManager.connectAll();
5431
+ * await mcpManager.registerToolsToToolLattice("tenant-1", "github", ["list_issues"]);
5432
+ * ```
5433
+ *
5434
+ * @remarks
5435
+ * - One MCP client per `(tenantId, serverKey)`; a failure in one server is
5436
+ * isolated from the others.
5437
+ * - Connect attempts are bounded by `timeoutMs`; failed servers retry with
5438
+ * exponential backoff up to `maxAttempts`.
5439
+ * - A periodic watchdog health-checks connected sessions and reconnects them.
5440
+ * - Concurrent connects for the same server are single-flighted; removing or
5441
+ * re-registering a server aborts any in-flight connect so it cannot
5442
+ * resurrect the runtime or republish its tools.
5443
+ */
5444
+ declare class McpLatticeManager extends BaseLatticeManager<McpClientLike> {
5293
5445
  private static _instance;
5294
- /** One MultiServerMCPClient per server, keyed by server name */
5295
- private clients;
5296
- /** Server connection configs, keyed by server name */
5297
- private servers;
5298
- /** Track registered tool keys per server for cleanup */
5299
- private registeredToolKeys;
5446
+ private runtimes;
5447
+ private clientFactory;
5448
+ private watchdog?;
5449
+ private healthCheckInFlight;
5300
5450
  static getInstance(): McpLatticeManager;
5301
5451
  protected getLatticeType(): string;
5302
- registerServers(servers: McpServerInfo[]): void;
5303
- addServer(name: string, connection: Connection): void;
5452
+ /** Test seam: override the MCP client factory. */
5453
+ configure(options?: {
5454
+ clientFactory?: McpClientFactory;
5455
+ }): void;
5456
+ private compositeKey;
5457
+ private getRuntime;
5304
5458
  /**
5305
- * Remove a server. Closes its client and unregisters its tools.
5459
+ * Whether a runtime is still the live entry for its `(tenantId, serverKey)`.
5460
+ * In-flight continuations use this to avoid publishing onto an orphaned
5461
+ * runtime that was removed or overwritten.
5306
5462
  */
5307
- removeServer(name: string): Promise<boolean>;
5463
+ private isActive;
5308
5464
  /**
5309
- * Connect all registered servers that are not yet connected.
5310
- * Each server gets its own MultiServerMCPClient instance.
5311
- * Existing connections are not affected.
5465
+ * Build the tool lattice key for an MCP tool.
5466
+ *
5467
+ * @param serverKey - MCP server business key
5468
+ * @param toolName - MCP tool name
5469
+ * @returns the tenant-agnostic tool key `mcp:{server}:{tool}`
5312
5470
  */
5313
- connect(): Promise<void>;
5471
+ static buildToolKey(serverKey: string, toolName: string): string;
5314
5472
  /**
5315
- * Reconnect a single server: close old client, create new one, re-register tools.
5473
+ * Register (or replace) an MCP server connection for a tenant.
5474
+ *
5475
+ * @param tenantId Tenant that owns the connection.
5476
+ * @param serverKey Stable server identifier within the tenant.
5477
+ * @param connection Adapter connection config.
5478
+ * @param options Optional connect timeout / retry policy overrides.
5479
+ * @remarks Re-registering an existing `(tenantId, serverKey)` clears its
5480
+ * pending reconnect timer, unregisters its tools, closes the old client
5481
+ * (fire-and-forget) and aborts any in-flight connect.
5316
5482
  */
5317
- reconnectServer(name: string): Promise<void>;
5318
- disconnect(): Promise<void>;
5319
- isConnected(): boolean;
5320
- isServerConnected(name: string): boolean;
5483
+ registerServer(tenantId: string, serverKey: string, connection: Connection, options?: McpRegisterOptions): void;
5321
5484
  /**
5322
- * Get tools from a specific server using raw MCP protocol.
5323
- * Returns native JSON schema tools — suitable for API responses.
5485
+ * Whether a server is currently registered for a tenant.
5486
+ *
5487
+ * @param tenantId Tenant that owns the connection.
5488
+ * @param serverKey Server identifier within the tenant.
5489
+ * @returns `true` if a runtime entry exists.
5324
5490
  */
5325
- getServerTools(serverName: string): Promise<McpTool[]>;
5491
+ hasServer(tenantId: string, serverKey: string): boolean;
5326
5492
  /**
5327
- * Get all tools from all servers as McpTool[] (API format).
5493
+ * Whether a server's client is connected.
5494
+ *
5495
+ * @param tenantId Tenant that owns the connection.
5496
+ * @param serverKey Server identifier within the tenant.
5497
+ * @returns `true` only when the runtime state is `connected`.
5328
5498
  */
5329
- getAllTools(): Promise<McpTool[]>;
5499
+ isServerConnected(tenantId: string, serverKey: string): boolean;
5500
+ private ensureWatchdog;
5501
+ private connectRuntime;
5330
5502
  /**
5331
- * Get raw LangChain DynamicStructuredTool objects for ToolLattice registration.
5332
- * Optionally filtered by server name.
5503
+ * Connect a single registered server, throwing on failure.
5504
+ *
5505
+ * @param tenantId Tenant that owns the connection.
5506
+ * @param serverKey Server identifier within the tenant.
5507
+ * @throws If the server is not registered or the connect attempt fails.
5508
+ * @remarks On failure the server is scheduled for background reconnect.
5333
5509
  */
5334
- getRawTools(serverName?: string): Promise<DynamicStructuredTool[]>;
5335
- getServerNames(): string[];
5336
- hasServer(name: string): boolean;
5510
+ connectServer(tenantId: string, serverKey: string): Promise<void>;
5337
5511
  /**
5338
- * Build the tool lattice key for an MCP tool.
5512
+ * Connect every registered server, isolating per-server failures.
5513
+ *
5514
+ * @remarks Failures are caught and scheduled for background reconnect, so
5515
+ * this method never rejects because one server is unreachable.
5516
+ */
5517
+ connectAll(): Promise<void>;
5518
+ /**
5519
+ * Reuse a healthy connection, otherwise (re)connect the server.
5520
+ *
5521
+ * @param tenantId Tenant that owns the connection.
5522
+ * @param serverKey Server identifier within the tenant.
5523
+ * @throws If the server is not registered or the connect attempt fails.
5524
+ * @remarks Concurrent calls are single-flighted onto one connect attempt.
5525
+ * On failure the server is scheduled for background reconnect.
5526
+ */
5527
+ ensureConnected(tenantId: string, serverKey: string): Promise<void>;
5528
+ private scheduleReconnect;
5529
+ private reconnectRuntime;
5530
+ /**
5531
+ * Force a reconnect of a registered server, re-registering its tools.
5532
+ *
5533
+ * @param tenantId Tenant that owns the connection.
5534
+ * @param serverKey Server identifier within the tenant.
5535
+ * @throws If the server is not registered or the reconnect attempt fails.
5536
+ */
5537
+ reconnectServer(tenantId: string, serverKey: string): Promise<void>;
5538
+ private checkHealth;
5539
+ /**
5540
+ * Remove a registered server, closing its client and unregistering its tools.
5541
+ *
5542
+ * @param tenantId Tenant that owns the connection.
5543
+ * @param serverKey Server identifier within the tenant.
5544
+ * @returns `true` if a server was removed.
5545
+ * @remarks The runtime is removed from the map before the client is closed
5546
+ * so any in-flight connect aborts instead of resurrecting it.
5547
+ */
5548
+ removeServer(tenantId: string, serverKey: string): Promise<boolean>;
5549
+ /**
5550
+ * List a connected server's tools in API format.
5551
+ *
5552
+ * @param tenantId Tenant that owns the connection.
5553
+ * @param serverKey Server identifier within the tenant.
5554
+ * @returns Native JSON-schema tool descriptors.
5555
+ * @throws If the server is not connected.
5556
+ */
5557
+ getServerTools(tenantId: string, serverKey: string): Promise<McpTool[]>;
5558
+ /**
5559
+ * Get a connected server's raw LangChain tools.
5560
+ *
5561
+ * @param tenantId Tenant that owns the connection.
5562
+ * @param serverKey Server identifier within the tenant.
5563
+ * @returns Raw `DynamicStructuredTool` instances.
5564
+ * @throws If the server is not connected.
5565
+ */
5566
+ getRawTools(tenantId: string, serverKey: string): Promise<DynamicStructuredTool[]>;
5567
+ /**
5568
+ * List a connected server's tools including raw `_meta` (for UI association).
5569
+ *
5570
+ * @param tenantId Tenant that owns the connection.
5571
+ * @param serverKey Server identifier within the tenant.
5572
+ * @returns Tool descriptors with optional `_meta`.
5573
+ * @throws If the server is not connected.
5574
+ */
5575
+ getAvailableTools(tenantId: string, serverKey: string): Promise<Array<{
5576
+ name: string;
5577
+ description: string;
5578
+ inputSchema: unknown;
5579
+ meta?: Record<string, unknown>;
5580
+ }>>;
5581
+ /**
5582
+ * Read a `ui://` resource and surface its content-item `_meta.ui` CSP/permissions.
5583
+ *
5584
+ * @param tenantId Tenant that owns the connection.
5585
+ * @param serverKey Server identifier within the tenant.
5586
+ * @param uri The `ui://` resource URI.
5587
+ * @returns Normalized UI resource payload.
5588
+ * @throws If the server is not connected or has no resources support.
5589
+ */
5590
+ readUiResource(tenantId: string, serverKey: string, uri: string): Promise<McpUiResourcePayload>;
5591
+ /**
5592
+ * Proxy a `tools/call` to a connected server (used by the gateway UI RPC route).
5593
+ *
5594
+ * @param tenantId Tenant that owns the connection.
5595
+ * @param serverKey Server identifier within the tenant.
5596
+ * @param name Tool name.
5597
+ * @param args Tool arguments.
5598
+ * @returns Raw CallToolResult.
5599
+ * @throws If the server is not connected.
5339
5600
  */
5340
- static buildToolKey(serverName: string, toolName: string): string;
5601
+ callServerTool(tenantId: string, serverKey: string, name: string, args: Record<string, unknown>): Promise<unknown>;
5341
5602
  /**
5342
- * Unregister all tools for a specific server from ToolLattice.
5603
+ * Read a non-UI resource from a connected server.
5604
+ *
5605
+ * @param tenantId Tenant that owns the connection.
5606
+ * @param serverKey Server identifier within the tenant.
5607
+ * @param uri Resource URI.
5608
+ * @returns Raw ReadResourceResult.
5609
+ * @throws If the server is not connected or has no resources support.
5343
5610
  */
5344
- unregisterServerTools(serverName: string): void;
5611
+ readServerResource(tenantId: string, serverKey: string, uri: string): Promise<unknown>;
5345
5612
  /**
5346
- * Register MCP tools from a specific server to Tool Lattice.
5347
- * Tools are registered with key pattern: mcp:{serverName}:{toolName}
5348
- * Only registers tools whose names are in selectedTools (if provided).
5613
+ * Unregister a server's tools from the tool lattice.
5614
+ *
5615
+ * @param tenantId Tenant that owns the connection.
5616
+ * @param serverKey Server identifier within the tenant.
5349
5617
  */
5350
- registerToolsToToolLattice(serverName: string, selectedTools?: string[]): Promise<void>;
5618
+ unregisterServerTools(tenantId: string, serverKey: string): void;
5351
5619
  /**
5352
- * Test a single MCP server connection using a standalone client.
5353
- * Does not affect the global mcpManager state.
5620
+ * Register a connected server's tools into the tool lattice.
5621
+ *
5622
+ * @param tenantId Tenant that owns the connection.
5623
+ * @param serverKey Server identifier within the tenant.
5624
+ * @param selectedTools Tool names to expose. `undefined` registers all tools;
5625
+ * an empty array registers none. Once provided, the selection is remembered
5626
+ * and reused on reconnect.
5627
+ * @throws If the server is not registered or not connected.
5628
+ * @remarks No-op if the runtime was removed/replaced while fetching tools.
5354
5629
  */
5355
- static testConnection(serverName: string, connection: Connection): Promise<{
5630
+ registerToolsToToolLattice(tenantId: string, serverKey: string, selectedTools?: string[]): Promise<void>;
5631
+ /**
5632
+ * Test a single MCP server using a standalone client.
5633
+ * Never touches manager state and always closes the client.
5634
+ */
5635
+ static testConnection(serverName: string, connection: Connection, factory?: McpClientFactory): Promise<{
5356
5636
  tools: McpTool[];
5357
5637
  latency: number;
5358
5638
  }>;
5639
+ /**
5640
+ * Stop the watchdog and close/clear every runtime.
5641
+ *
5642
+ * @remarks Intended for shutdown and test teardown: it also aborts any
5643
+ * in-flight connect because every runtime is cleared from the map.
5644
+ */
5645
+ dispose(): Promise<void>;
5359
5646
  }
5360
5647
  declare const mcpManager: McpLatticeManager;
5361
5648
 
5649
+ /**
5650
+ * Pure reconnect/backoff policy helpers for the MCP manager.
5651
+ */
5652
+ /** Default timeout (ms) for a single MCP connect/handshake attempt. */
5653
+ declare const DEFAULT_CONNECT_TIMEOUT_MS = 15000;
5654
+ /** Default number of reconnect attempts before a server is marked failed. */
5655
+ declare const DEFAULT_MAX_ATTEMPTS = 3;
5656
+ /** Default base delay (ms) for exponential reconnect backoff. */
5657
+ declare const DEFAULT_DELAY_MS = 1000;
5658
+ /** Upper bound (ms) for a single reconnect backoff delay. */
5659
+ declare const MAX_BACKOFF_MS = 30000;
5660
+ /** Interval (ms) between MCP session health checks. */
5661
+ declare const HEALTH_CHECK_INTERVAL_MS = 30000;
5662
+ /** Timeout (ms) for a single MCP session health check. */
5663
+ declare const HEALTH_CHECK_TIMEOUT_MS = 5000;
5664
+ /**
5665
+ * Exponential backoff delay: `base * 2^(attempt-1)`, capped at `max`.
5666
+ * `attempt <= 0` returns `base`.
5667
+ *
5668
+ * @param attempt Zero-based reconnect attempt index.
5669
+ * @param base Base delay in ms.
5670
+ * @param max Maximum delay in ms.
5671
+ * @returns Delay in ms for the given attempt.
5672
+ */
5673
+ declare function nextBackoffDelay(attempt: number, base?: number, max?: number): number;
5674
+ /**
5675
+ * Race an operation against a timeout. On timeout it rejects first, then runs
5676
+ * `onTimeout` (best-effort cleanup, e.g. close a leaking client) without
5677
+ * blocking the rejection and swallowing any cleanup error.
5678
+ *
5679
+ * @param operation The operation to race.
5680
+ * @param ms Timeout in ms.
5681
+ * @param onTimeout Fire-and-forget cleanup invoked once the timeout wins.
5682
+ * @returns The operation's result if it settles before the timeout.
5683
+ * @throws Error with `timed out` when `ms` elapses first, otherwise the
5684
+ * operation's own rejection.
5685
+ */
5686
+ declare function withTimeout<T>(operation: Promise<T>, ms: number, onTimeout: () => Promise<void>): Promise<T>;
5687
+
5688
+ /**
5689
+ * Convert a persisted McpServerConfig into a @langchain/mcp-adapters Connection,
5690
+ * enabling transport-level auto-recovery (stdio restart / http+sse reconnect).
5691
+ */
5692
+
5693
+ /**
5694
+ * Map an MCP server config to an adapter connection.
5695
+ *
5696
+ * @param config - persisted MCP server configuration
5697
+ * @returns adapter Connection with auto-recovery enabled
5698
+ */
5699
+ declare function convertToConnection(config: McpServerConfig): Connection;
5700
+
5701
+ /**
5702
+ * Extract an MCP Apps UI ref from a tool's raw `_meta`.
5703
+ *
5704
+ * Supports both the current nested `_meta.ui.resourceUri` shape and the
5705
+ * deprecated flat `_meta["ui/resourceUri"]` key. Only `ui://` URIs qualify.
5706
+ *
5707
+ * @param meta Tool `_meta` object (may be undefined).
5708
+ * @param serverKey Owning MCP server key.
5709
+ * @returns Normalized {@link McpUiRef} or `null` when no UI resource is declared.
5710
+ */
5711
+ declare function extractAppsRef(meta: unknown, serverKey: string): McpUiRef | null;
5712
+ /**
5713
+ * Extract legacy MCP-UI refs from a tool result's content blocks.
5714
+ *
5715
+ * Finds `resource` content blocks whose `resource.uri` is a `ui://` URI and
5716
+ * normalizes them into {@link McpUiRef} entries.
5717
+ *
5718
+ * @param content Tool result content (array of blocks, or any other shape).
5719
+ * @param serverKey Owning MCP server key.
5720
+ * @returns Matching refs; empty when none are found.
5721
+ */
5722
+ declare function extractLegacyRefs(content: unknown, serverKey: string): McpUiRef[];
5723
+ /**
5724
+ * Append the `mcp_app` content fence to a tool result, preserving its shape.
5725
+ *
5726
+ * `@langchain/mcp-adapters` commonly returns an array of content blocks
5727
+ * (text/image/audio/file). Joining only `.text` would silently drop every
5728
+ * non-text block, so instead of normalizing to a string this function appends
5729
+ * the fence as an extra text block:
5730
+ *
5731
+ * - `string` → `"<content>\n\n<fence>"` (still a string).
5732
+ * - `array` → `[...content, { type: "text", text: fence }]` (new array).
5733
+ * - single **pure text block** (`type === "text"` or `type` undefined, with no
5734
+ * `data`/`resource`) → `"<text>\n\n<fence>"` (a string, so the fence is
5735
+ * directly discoverable by string consumers).
5736
+ * - single non-text block object (e.g. an image with a text caption) →
5737
+ * `[content, { type: "text", text: fence }]` so `data`/`resource` and every
5738
+ * other field survive instead of being dropped or stringified.
5739
+ * - anything else → stringified content with the fence appended (fallback).
5740
+ *
5741
+ * @param content Existing content (string, content block, block array, or other value).
5742
+ * @param ref UI ref to encode into the fence.
5743
+ * @returns The fence appended in a shape that preserves every original block.
5744
+ */
5745
+ declare function appendUiFence(content: unknown, ref: McpUiRef): string | unknown[];
5746
+ /**
5747
+ * Wrap an MCP tool so its result carries an `mcp_app` fence for the given ref.
5748
+ *
5749
+ * The wrapped tool keeps the raw tool's `responseFormat` so `.invoke()` receives
5750
+ * a shape it expects: for `"content_and_artifact"` the wrapper always returns a
5751
+ * two-tuple (`[fencedContent, artifact]`), preserving the original artifact when
5752
+ * present; for any other format it returns the fenced content directly.
5753
+ *
5754
+ * The original content shape is preserved — a string or a single pure text
5755
+ * block stays a string, a block array gains an extra text block for the fence,
5756
+ * and a single non-text block (including one with a text caption) is wrapped in
5757
+ * an array (see {@link appendUiFence}) so non-text blocks are never dropped.
5758
+ *
5759
+ * The fence carries only the UI ref identity (server key, resource URI,
5760
+ * display mode, title). MCP rich results (`structuredContent`, `_meta`,
5761
+ * non-text blocks) stay on the raw tool result / `artifact`, which the client
5762
+ * merger normalizes into `ToolCall.ui` — the fence must not duplicate them.
5763
+ *
5764
+ * @param raw The original LangChain tool.
5765
+ * @param ref UI ref known at registration time.
5766
+ * @returns A new {@link DynamicStructuredTool} preserving the raw tool's name,
5767
+ * description, schema, `responseFormat`, `defaultConfig`, `metadata`, and
5768
+ * `returnDirect`.
5769
+ *
5770
+ * @example
5771
+ * ```ts
5772
+ * const ref = { kind: "mcp", serverKey: "weather", resourceUri: "ui://weather/app", displayMode: "inline" };
5773
+ * const fenced = wrapMcpToolWithUi(rawMcpTool, ref);
5774
+ * // fenced.invoke({ city: "Paris" }) resolves to content ending in a ```mcp_app fence
5775
+ * ```
5776
+ *
5777
+ * @remarks Only use this when a ref exists; otherwise register `raw` unchanged.
5778
+ */
5779
+ declare function wrapMcpToolWithUi(raw: DynamicStructuredTool, ref: McpUiRef): DynamicStructuredTool;
5780
+
5362
5781
  interface FsEntry {
5363
5782
  path: string;
5364
5783
  kind: string;
@@ -8108,11 +8527,14 @@ interface ProjectTaskAdmissionNotifierOptions {
8108
8527
  listenerTimeoutMs?: number;
8109
8528
  }
8110
8529
  /**
8111
- * Publishes process-local hints that newly persisted Agent Project tasks need reconciliation.
8530
+ * Publishes process-local hints that a TaskItem was explicitly dispatched to the Project queue
8531
+ * runtime.
8112
8532
  *
8113
- * @remarks Delivery is FIFO per Tenant/Task and awaits every listener settlement. Callers that
8114
- * persist tasks must invoke `publish` fire-and-forget and contain rejection because this hint is
8115
- * not durable lifecycle authority.
8533
+ * @remarks The only publisher is the `task` tool's managed-authority path (`onManagedStart`).
8534
+ * Creation and status writes never publish: a created task is a record until `task` runs it.
8535
+ * Delivery is FIFO per Tenant/Task and awaits every listener settlement. Callers that dispatch
8536
+ * must invoke `publish` fire-and-forget and contain rejection because this hint is not durable
8537
+ * lifecycle authority.
8116
8538
  */
8117
8539
  declare class ProjectTaskAdmissionNotifier {
8118
8540
  private readonly listeners;
@@ -8141,7 +8563,7 @@ declare class ProjectTaskAdmissionNotifier {
8141
8563
  private deliver;
8142
8564
  private deliverTo;
8143
8565
  }
8144
- /** Process-global Project task admission notifier used by governed creation paths. */
8566
+ /** Process-global Project task admission notifier used by the managed dispatch path. */
8145
8567
  declare const projectTaskAdmissionNotifier: ProjectTaskAdmissionNotifier;
8146
8568
 
8147
8569
  /** Exact Tenant and Project scope for collaboration mutations. */
@@ -8930,6 +9352,15 @@ interface BeliefImpactInput {
8930
9352
  key: string;
8931
9353
  after: number;
8932
9354
  basis: string;
9355
+ /**
9356
+ * Declares that `key` is intentionally a NEW belief the reporting task
9357
+ * discovered, rather than a reference to an existing owner-table key.
9358
+ *
9359
+ * When absent, the key MUST already exist in the belief owner's table;
9360
+ * a missing key without this flag is rejected (`INVALID_BELIEF_KEY`) so a
9361
+ * typo or hallucinated key can never silently pollute the shared model.
9362
+ */
9363
+ isNew?: boolean;
8933
9364
  }
8934
9365
 
8935
9366
  /** A recoverable work-item failure that occurred after a task transition committed. */
@@ -8953,6 +9384,7 @@ type LifecycleResult = {
8953
9384
  code: string;
8954
9385
  error: string;
8955
9386
  hint?: string;
9387
+ retryable?: boolean;
8956
9388
  evidenceId?: string;
8957
9389
  eventKey?: string;
8958
9390
  warnings?: LifecycleWarning[];
@@ -8975,6 +9407,7 @@ type StartLifecycleResult = {
8975
9407
  code: string;
8976
9408
  error: string;
8977
9409
  hint?: string;
9410
+ retryable?: boolean;
8978
9411
  eventKey?: string;
8979
9412
  warnings?: LifecycleWarning[];
8980
9413
  };
@@ -8994,6 +9427,11 @@ interface AgentTaskCompletionInput {
8994
9427
  actor: string;
8995
9428
  threadId?: string;
8996
9429
  sourceId?: string;
9430
+ /**
9431
+ * Completes despite a persisted `requireReview` because no HITL channel can
9432
+ * ever review it. The caller records the waiver (audit) separately.
9433
+ */
9434
+ waiveReview?: boolean;
8997
9435
  }
8998
9436
  /** Input for submitting agent completion evidence to HITL review. */
8999
9437
  interface SubmitTaskReviewInput extends AgentTaskCompletionInput {
@@ -9101,18 +9539,7 @@ interface BeliefOwnerSnapshot {
9101
9539
  workspaceId?: string;
9102
9540
  projectId?: string;
9103
9541
  };
9104
- parentUpdatedAt?: string;
9105
9542
  }
9106
- /**
9107
- * Returns whether a task belongs to the trusted, nondefault Project lifecycle.
9108
- *
9109
- * @param task Task snapshot whose durable scope and trusted origin are inspected.
9110
- * @returns True only for nondefault Project Room or Project Task origins.
9111
- */
9112
- declare function isProjectLifecycleTask(task: TaskItem): task is TaskItem & {
9113
- workspaceId: string;
9114
- projectId: string;
9115
- };
9116
9543
  /**
9117
9544
  * Parses a descriptor-safe canonical external-dependency interruption.
9118
9545
  *
@@ -9162,6 +9589,17 @@ declare class TaskLifecycleService {
9162
9589
  * @remarks Review interruptions must be approved or rejected through their evidence-bound methods.
9163
9590
  */
9164
9591
  resumeInterruption(input: ResumeInterruptionInput): Promise<LifecycleResult>;
9592
+ /**
9593
+ * Reopens a review interruption without an approval.
9594
+ *
9595
+ * @param input Task, actor, and optional thread.
9596
+ * @returns Structured resume result with an audited `review_waived` transition.
9597
+ * @remarks Explicit escape for the "review channel does not exist" case: unlike
9598
+ * `resumeInterruption`, this intentionally allows a `review_required`
9599
+ * interruption so the requester can complete with a waiver. A real HITL
9600
+ * channel keeps using `approveInterrupted`/`rejectInterrupted`.
9601
+ */
9602
+ withdrawReview(input: ResumeInterruptionInput): Promise<LifecycleResult>;
9165
9603
  /** Atomically fails an active agent task and records an idempotent status event. */
9166
9604
  failTask(input: FailTaskInput): Promise<LifecycleResult>;
9167
9605
  /** Atomically starts a pending agent task and records an idempotent status event. */
@@ -9247,11 +9685,32 @@ declare class TaskLifecycleService {
9247
9685
  private transitionAgentTask;
9248
9686
  private statusEventKey;
9249
9687
  private writeStatusEvent;
9688
+ /**
9689
+ * Publishes one committed transition for any scope-bearing task.
9690
+ *
9691
+ * @remarks `action` keeps the `ProjectTaskLifecycleAction` type for wire
9692
+ * compatibility even though publication is now generic (ADR-118 Plan A).
9693
+ * Presence-based gating means tasks with a real workspace/project publish even
9694
+ * when they are not project-sourced, including the literal `"default"` scope.
9695
+ * The gateway subscriber filters by its own project predicate; this bounded
9696
+ * window lasts until the host filter lands (ADR-118 Plan A, Task 3).
9697
+ */
9250
9698
  private notifyWinningTransition;
9251
9699
  private validateExternalDependencies;
9252
9700
  private externalDependencyReadiness;
9253
9701
  private finishExternalDependencyInterruption;
9254
9702
  private clearAuditMarker;
9703
+ /**
9704
+ * Restores a context marker removed by {@link clearAuditMarker}.
9705
+ *
9706
+ * @param task Task whose marker was cleared.
9707
+ * @param key Context key to restore.
9708
+ * @param value Marker payload to write back.
9709
+ * @returns The updated task, or the input task when the CAS loses or throws.
9710
+ * @remarks Used when publishing the completion notification fails after the
9711
+ * marker was cleared, so the transition keeps a repair marker for a later pass.
9712
+ */
9713
+ private restoreContextKey;
9255
9714
  private writeReviewActivity;
9256
9715
  private createEvent;
9257
9716
  private success;
@@ -9265,6 +9724,15 @@ declare class TaskLifecycleService {
9265
9724
  */
9266
9725
  declare function createTaskLifecycleService(deps?: TaskLifecycleServiceDeps): TaskLifecycleService;
9267
9726
 
9727
+ /**
9728
+ * Shared persistent-task execution types.
9729
+ *
9730
+ * @remarks ADR-118 follow-up: the dispatch planner and the run-only executor both
9731
+ * depend on these contracts. Keeping them in a neutral module lets the planner
9732
+ * consume them without importing the executor, which in turn imports the planner
9733
+ * value (avoiding a type-level cycle between the two).
9734
+ */
9735
+
9268
9736
  /** Describes one isolated Agent invocation for persistent task execution. */
9269
9737
  interface TaskAgentInvocation {
9270
9738
  tenantId: string;
@@ -9284,6 +9752,12 @@ interface TaskExecutionServiceDeps {
9284
9752
  workItemStore: TaskWorkItemStore;
9285
9753
  invokeAgent: (input: TaskAgentInvocation) => Promise<unknown>;
9286
9754
  resolveAgent: (tenantId: string, agentId: string) => Promise<boolean>;
9755
+ /**
9756
+ * Optional thread-id generator; defaults to `randomUUID`.
9757
+ *
9758
+ * @remarks The generated id is the isolated run thread and is persisted as the
9759
+ * task's `context.thread_id`.
9760
+ */
9287
9761
  createThreadId?: () => string;
9288
9762
  }
9289
9763
  /** Identifies a persistent task, target Agent, caller, and runtime scope. */
@@ -9294,7 +9768,17 @@ interface StartTaskExecutionInput {
9294
9768
  taskId: string;
9295
9769
  agentId: string;
9296
9770
  actor: string;
9771
+ /**
9772
+ * Thread the dispatch was requested from (caller provenance).
9773
+ *
9774
+ * @remarks Not the run link: the immediate executor generates its own
9775
+ * isolated run thread and persists that as the task's `context.thread_id`.
9776
+ */
9297
9777
  callerThreadId?: string;
9778
+ /** Trusted Project caller membership forwarded to a managed authority, when known. */
9779
+ callerMembershipId?: string;
9780
+ /** Trusted Project caller Assistant forwarded to a managed authority, when known. */
9781
+ callerAssistantId?: string;
9298
9782
  }
9299
9783
  /** Successful isolated execution observation recorded for later reconciliation. */
9300
9784
  interface TaskExecutionSuccess {
@@ -9306,6 +9790,20 @@ interface TaskExecutionSuccess {
9306
9790
  executionResultId: string;
9307
9791
  warnings?: LifecycleWarning[];
9308
9792
  }
9793
+ /**
9794
+ * Result of routing execution to a registered authority.
9795
+ *
9796
+ * @remarks The authority (e.g. the durable Project queue) runs the task
9797
+ * asynchronously; the caller observes the task itself rather than an inline
9798
+ * observation.
9799
+ */
9800
+ interface TaskExecutionManaged {
9801
+ success: true;
9802
+ managed: true;
9803
+ taskId: string;
9804
+ agentId: string;
9805
+ authorityId: string;
9806
+ }
9309
9807
  /** Typed validation, lifecycle, or Agent invocation failure. */
9310
9808
  interface TaskExecutionFailure {
9311
9809
  success: false;
@@ -9317,15 +9815,20 @@ interface TaskExecutionFailure {
9317
9815
  executionResultId?: string;
9318
9816
  blockedBy?: string[];
9319
9817
  invocationError?: string;
9818
+ /** Actionable remediation for the failure, when one is known. */
9819
+ hint?: string;
9820
+ /** Whether the caller may safely retry the same dispatch. */
9821
+ retryable?: boolean;
9320
9822
  warnings?: LifecycleWarning[];
9321
9823
  }
9322
- /** Result returned by a persistent task execution attempt. */
9323
- type TaskExecutionResult = TaskExecutionSuccess | TaskExecutionFailure;
9824
+ /** Result returned by a persistent task execution attempt or authority route. */
9825
+ type TaskExecutionResult = TaskExecutionSuccess | TaskExecutionManaged | TaskExecutionFailure;
9826
+
9324
9827
  /**
9325
9828
  * Creates a synchronous persistent-task execution service from injected stores and Agent adapters.
9326
9829
  *
9327
9830
  * @param deps Task stores, target resolution, isolated invocation, and optional thread ID generation.
9328
- * @returns A service whose `start` method validates, starts, dispatches, and records an observation.
9831
+ * @returns A service whose `start` method plans, runs, and records a persistent task dispatch.
9329
9832
  *
9330
9833
  * @example
9331
9834
  * ```ts
@@ -9339,11 +9842,586 @@ declare function createTaskExecutionService(deps: TaskExecutionServiceDeps): {
9339
9842
  start: (input: StartTaskExecutionInput) => Promise<TaskExecutionResult>;
9340
9843
  };
9341
9844
 
9845
+ /**
9846
+ * Dispatch planner for immediate persistent task execution (ADR-118 §边界修正 1).
9847
+ *
9848
+ * @remarks This module owns the L1/L3 half of dispatch: record read, scope
9849
+ * verification, record preconditions, target capability, registered authority
9850
+ * routing, target existence, and dependency/parent resolution. It performs no
9851
+ * direct task-store write (but may trigger a registered authority's managed-start
9852
+ * side effect) and never invokes an Agent. {@link prepareTaskDispatch} returns either
9853
+ * a routed managed result, a typed failure, or an {@link ImmediateDispatchPlan}
9854
+ * consumed by the run-only executor.
9855
+ */
9856
+
9857
+ /** Everything the run half needs to invoke the target and record the result. */
9858
+ interface ImmediateDispatchPlan {
9859
+ /** Tenant owning the task and the run. */
9860
+ tenantId: string;
9861
+ /** Persisted task snapshot that passed every precondition. */
9862
+ task: TaskItem;
9863
+ /** Resolved target Agent to execute the task. */
9864
+ agentId: string;
9865
+ /** Actor recorded on lifecycle and work-item writes. */
9866
+ actor: string;
9867
+ /** Caller thread provenance; not the run link (the executor links its own run thread). */
9868
+ callerThreadId?: string;
9869
+ /** In-scope parent task, when the task has one; otherwise `null`. */
9870
+ parent: TaskItem | null;
9871
+ /** In-scope, completed dependencies whose results seed the worker message. */
9872
+ completedDependencies: TaskItem[];
9873
+ }
9874
+ /**
9875
+ * Outcome of planning a dispatch, before any run-side mutation or invocation.
9876
+ *
9877
+ * @remarks A discriminated union: `managed` means a registered authority owns
9878
+ * execution, `failure` carries a typed precondition/policy rejection, and
9879
+ * `ready` carries the {@link ImmediateDispatchPlan} for immediate execution.
9880
+ */
9881
+ type DispatchPreparation = {
9882
+ kind: "managed";
9883
+ result: TaskExecutionManaged;
9884
+ } | {
9885
+ kind: "failure";
9886
+ failure: TaskExecutionFailure;
9887
+ } | {
9888
+ kind: "ready";
9889
+ plan: ImmediateDispatchPlan;
9890
+ };
9891
+ /**
9892
+ * Plans a persistent task dispatch without mutating state or invoking an Agent.
9893
+ *
9894
+ * @param deps Task store and target existence probe.
9895
+ * @param input Tenant, target Agent, actor, caller, and runtime scope.
9896
+ * @returns A managed route, a typed failure, or a ready immediate dispatch plan.
9897
+ *
9898
+ * @remarks Steps run in a fixed order so the first applicable outcome wins:
9899
+ * read/scope → status preconditions → authority routing → target existence →
9900
+ * dependency validation → parent load. Only the immediate path reaches the
9901
+ * target-existence and dependency/parent steps; a managed authority returns
9902
+ * before them. This function performs no direct task-store write (a managed
9903
+ * authority's managed-start side effect may still run).
9904
+ *
9905
+ * @example
9906
+ * ```ts
9907
+ * const prepared = await prepareTaskDispatch(deps, { tenantId, taskId, agentId, actor });
9908
+ * if (prepared.kind === "ready") await run(prepared.plan);
9909
+ * ```
9910
+ */
9911
+ declare function prepareTaskDispatch(deps: Pick<TaskExecutionServiceDeps, "taskStore" | "resolveAgent">, input: StartTaskExecutionInput): Promise<DispatchPreparation>;
9912
+
9913
+ /**
9914
+ * TaskRunBridge — the single owner of "execution writes to the task record".
9915
+ *
9916
+ * @remarks ADR-118: the execution layer (L2) must not write task state inline. This bridge
9917
+ * owns dispatch (`pending → in_progress`, `beginRun`, shared by the immediate executor and
9918
+ * the managed project dispatch) and abnormal outcome convergence (`settleRun`, used by the
9919
+ * managed observer). Normal completion stays with the worker's own `manage_task` writes
9920
+ * (single-writer convention; not a lease).
9921
+ */
9922
+
9923
+ /**
9924
+ * Raised when an ownership transfer is requested without an injected task store.
9925
+ *
9926
+ * @remarks The immediate executor always supplies the store; the managed Project
9927
+ * dispatch builds the bridge with only `lifecycle` and never calls
9928
+ * {@link TaskRunBridge.transferOwner}.
9929
+ */
9930
+ declare class TaskRunBridgeStoresRequiredError extends Error {
9931
+ /** Stable machine-readable failure code. */
9932
+ readonly code: "TASK_RUN_BRIDGE_STORES_REQUIRED";
9933
+ constructor();
9934
+ }
9935
+ /**
9936
+ * Describes one dispatch attempt for a persisted task run.
9937
+ *
9938
+ * @remarks `threadId` is optional so callers that dispatch before a thread
9939
+ * exists can omit it; the lifecycle and work-item writes record it when present.
9940
+ */
9941
+ interface BeginRunInput {
9942
+ /** Tenant identifier owning the task. */
9943
+ tenantId: string;
9944
+ /** Persisted task snapshot captured before dispatch. */
9945
+ task: TaskItem;
9946
+ /** Actor recorded on the lifecycle transition and status work item. */
9947
+ actor: string;
9948
+ /**
9949
+ * Isolated run thread recorded on the dispatch and linked into the task.
9950
+ *
9951
+ * @remarks For agent tasks `lifecycle.startTask` persists it as
9952
+ * `context.thread_id`, so the TaskItem points at the clean run thread.
9953
+ * Optional so callers that dispatch before a thread exists can omit it.
9954
+ */
9955
+ threadId?: string;
9956
+ }
9957
+ /**
9958
+ * Result of a dispatch that mutated (or confirmed) the run's starting state.
9959
+ *
9960
+ * @remarks `mutated` and `transitioned` are propagated verbatim from the
9961
+ * lifecycle winner; a `false` value is a successful no-op, not a failure.
9962
+ */
9963
+ interface BeginRunSuccess {
9964
+ success: true;
9965
+ /** Latest task snapshot after dispatch. */
9966
+ task: TaskItem;
9967
+ /** Recoverable work-item warnings emitted while starting the run. */
9968
+ warnings: LifecycleWarning[];
9969
+ /** Whether any persisted task field changed. */
9970
+ mutated: boolean;
9971
+ /** Whether this dispatch won the pending-to-in-progress transition. */
9972
+ transitioned: boolean;
9973
+ }
9974
+ /** Typed dispatch failure returned unchanged from the lifecycle or task store. */
9975
+ interface BeginRunFailure {
9976
+ success: false;
9977
+ /** Stable machine-readable failure code. */
9978
+ code: string;
9979
+ /** Human-readable failure message. */
9980
+ error: string;
9981
+ /** Optional remediation hint from the lifecycle. */
9982
+ hint?: string;
9983
+ /** Whether the caller may safely retry the dispatch. */
9984
+ retryable?: boolean;
9985
+ /** Recoverable work-item warnings emitted before the failure. */
9986
+ warnings?: LifecycleWarning[];
9987
+ }
9988
+ /** Discriminated result of {@link TaskRunBridge.beginRun}. */
9989
+ type BeginRunResult = BeginRunSuccess | BeginRunFailure;
9990
+ /**
9991
+ * Terminal-ish outcome a finished run converged to.
9992
+ *
9993
+ * @remarks `failed` with `lifecycleHandled: true` means the lifecycle already
9994
+ * converged the task and the bridge must not write again (pure no-op).
9995
+ */
9996
+ type SettleRunOutcome =
9997
+ /**
9998
+ * The agent run ended without the task's own lifecycle transition.
9999
+ *
10000
+ * @remarks This is intentionally NOT a success path: it maps to
10001
+ * `failTask("Agent execution ended without a task lifecycle transition")`
10002
+ * so a run that stopped without converging the task is recorded as a
10003
+ * failure rather than silently left active.
10004
+ */
10005
+ {
10006
+ kind: "completed";
10007
+ }
10008
+ /** Cancels the run; `summary` overrides the default cancellation summary. */
10009
+ | {
10010
+ kind: "cancelled";
10011
+ summary?: string;
10012
+ }
10013
+ /** Interrupts the run; `summary` overrides the default interruption summary. */
10014
+ | {
10015
+ kind: "interrupted";
10016
+ summary?: string;
10017
+ } | {
10018
+ kind: "failed";
10019
+ lifecycleHandled: boolean;
10020
+ error: string;
10021
+ };
10022
+ /**
10023
+ * Describes one ordinary task ownership transfer performed before dispatch.
10024
+ *
10025
+ * @remarks Transfers are last-write-wins (ADR-116): content writes do not use
10026
+ * CAS. The task must already be captured in scope before calling.
10027
+ */
10028
+ interface TransferOwnerInput {
10029
+ /** Tenant identifier owning the task. */
10030
+ tenantId: string;
10031
+ /** Persisted task snapshot captured before dispatch. */
10032
+ task: TaskItem;
10033
+ /** Agent that will own and execute the dispatched task. */
10034
+ agentId: string;
10035
+ }
10036
+ /**
10037
+ * Result of {@link TaskRunBridge.transferOwner}.
10038
+ *
10039
+ * @remarks On success, `task` is the transferred snapshot when the write
10040
+ * succeeded, or the original snapshot when the task was already owned by the
10041
+ * target or the store update returned `null`. A store write rejection is
10042
+ * returned as a typed failure so callers keep their no-throw contract.
10043
+ */
10044
+ type TransferOwnerResult = {
10045
+ success: true;
10046
+ /** Latest task snapshot after the attempted transfer. */
10047
+ task: TaskItem;
10048
+ } | {
10049
+ success: false;
10050
+ /** Stable machine-readable failure code. */
10051
+ code: string;
10052
+ /** Human-readable failure message. */
10053
+ error: string;
10054
+ };
10055
+ /** Describes one outcome convergence write for a finished run. */
10056
+ interface SettleRunInput {
10057
+ /** Tenant identifier owning the task. */
10058
+ tenantId: string;
10059
+ /** Persisted task snapshot captured before convergence. */
10060
+ task: TaskItem;
10061
+ /** Actor recorded on the lifecycle transition. */
10062
+ actor: string;
10063
+ /**
10064
+ * Optional owning thread identifier recorded on the lifecycle transition.
10065
+ *
10066
+ * @remarks Callers that converge a task without an exact thread (for example
10067
+ * the A2A adapter observing an external state) may omit it.
10068
+ */
10069
+ threadId?: string;
10070
+ /** Run outcome to converge onto the task record. */
10071
+ outcome: SettleRunOutcome;
10072
+ }
10073
+ /** Persistence and lifecycle dependencies used by {@link createTaskRunBridge}. */
10074
+ interface TaskRunBridgeDeps {
10075
+ /** Task lifecycle operations the bridge is allowed to invoke. */
10076
+ lifecycle: Pick<TaskLifecycleService, "startTask" | "resumeInterruption" | "retryTask" | "failTask" | "cancelTask" | "interruptTask">;
10077
+ /**
10078
+ * Optional task store used by ownership transfer (any owner type) and the
10079
+ * non-agent (user-owned) dispatch branch. Callers that never transfer or
10080
+ * dispatch user-owned tasks (such as the Project task observer) may omit it.
10081
+ */
10082
+ taskStore?: Pick<TaskStore, "updateIfStatusAndUpdatedAt" | "update">;
10083
+ /**
10084
+ * Optional work-item store used only by the non-agent (user-owned) dispatch
10085
+ * branch. Agent-only callers may omit it.
10086
+ */
10087
+ workItemStore?: Pick<TaskWorkItemStore, "create">;
10088
+ }
10089
+ /**
10090
+ * The single owner of "execution writes to the task record".
10091
+ *
10092
+ * @remarks
10093
+ * - `beginRun` owns the `pending -> in_progress` dispatch write.
10094
+ * - `settleRun` owns outcome convergence for a finished run.
10095
+ * - Callers are responsible for running lifecycle result checks (e.g. logging,
10096
+ * notification) on the value returned by `settleRun`.
10097
+ */
10098
+ interface TaskRunBridge {
10099
+ /**
10100
+ * Transfers ordinary (non-governed) task ownership to the dispatch target.
10101
+ *
10102
+ * @param input Tenant, captured task snapshot, and target Agent identifier.
10103
+ * @returns A success carrying the transferred snapshot when the write
10104
+ * succeeds (or the original snapshot when the task is already owned by the
10105
+ * target agent, or the store update returns `null`), or a typed
10106
+ * `TASK_STORE_WRITE_FAILED` failure when the store write rejects.
10107
+ *
10108
+ * @remarks
10109
+ * - Ownership is compared on **both** fields: a `user` task whose `ownerId`
10110
+ * equals `agentId` still transfers to `ownerType: "agent"`.
10111
+ * - Writes last-write-wins (ADR-116); when `update` returns `null` the
10112
+ * dispatch proceeds with the original snapshot and {@link beginRun} decides.
10113
+ * - A store write rejection is returned as a failure, never thrown, so
10114
+ * callers keep their no-throw contract.
10115
+ * - Throws {@link TaskRunBridgeStoresRequiredError} when no task store was
10116
+ * injected.
10117
+ */
10118
+ transferOwner(input: TransferOwnerInput): Promise<TransferOwnerResult>;
10119
+ /**
10120
+ * Dispatches a run, moving a pending task to `in_progress`.
10121
+ *
10122
+ * @param input Tenant, captured task snapshot, actor, and optional thread ID.
10123
+ * @returns A success carrying the winning snapshot and transition metadata, or
10124
+ * an unchanged lifecycle/store failure.
10125
+ */
10126
+ beginRun(input: BeginRunInput): Promise<BeginRunResult>;
10127
+ /**
10128
+ * Converges a finished run's outcome onto the task record.
10129
+ *
10130
+ * @param input Tenant, captured task snapshot, actor, optional thread ID, and outcome.
10131
+ * @returns The lifecycle result for the convergence transition, or a
10132
+ * successful no-op when the run already handled its own lifecycle.
10133
+ *
10134
+ * @remarks The bridge returns only the lifecycle result. The caller still
10135
+ * owns the run `cause` it used for `outcome-${cause}` labels/telemetry; the
10136
+ * bridge does not echo or reinterpret it. This method performs the lifecycle
10137
+ * write **unconditionally**: it does no re-read/terminal/ownership precondition
10138
+ * check, so callers must keep their own guards (e.g. the observer's
10139
+ * aborted/re-read/owner+thread/terminal guard block) before calling it.
10140
+ */
10141
+ settleRun(input: SettleRunInput): Promise<LifecycleResult>;
10142
+ }
10143
+ /**
10144
+ * Creates the task/run bridge that centralizes execution writes to the task record.
10145
+ *
10146
+ * The bridge owns three writes: ownership transfer (`transferOwner`), dispatch
10147
+ * (`beginRun`), and outcome convergence (`settleRun`). All are
10148
+ * behavior-preserving extracts of the immediate executor and the Project task
10149
+ * observer so those callers stop writing the task record directly.
10150
+ *
10151
+ * @param deps Lifecycle operations plus the optional task/work-item stores used
10152
+ * by ownership transfer and the non-agent dispatch branch.
10153
+ * @returns A {@link TaskRunBridge} with `transferOwner`, `beginRun`, and
10154
+ * `settleRun`.
10155
+ *
10156
+ * @example
10157
+ * ```ts
10158
+ * const bridge = createTaskRunBridge({
10159
+ * lifecycle: createTaskLifecycleService({ taskStore, workItemStore }),
10160
+ * taskStore,
10161
+ * workItemStore,
10162
+ * });
10163
+ *
10164
+ * const transfer = await bridge.transferOwner({ tenantId, task, agentId });
10165
+ * if (!transfer.success) return transfer;
10166
+ * const started = await bridge.beginRun({ tenantId, task: transfer.task, actor, threadId });
10167
+ * ```
10168
+ *
10169
+ * @remarks
10170
+ * `transferOwner` and the non-agent (user-owned) dispatch branch require
10171
+ * `taskStore` (and `workItemStore` for the latter); callers that only dispatch
10172
+ * agent tasks (such as the Project task observer) may omit them. `settleRun`
10173
+ * only requires `lifecycle`.
10174
+ */
10175
+ declare function createTaskRunBridge(deps: TaskRunBridgeDeps): TaskRunBridge;
10176
+
10177
+ /**
10178
+ * Process-local record of tasks currently held by a live run.
10179
+ *
10180
+ * @remarks
10181
+ * A task is registered when a run starts holding it (dispatch claim or the run
10182
+ * entry `beforeAgent`) and unregistered when that run ends (`afterAgent`). The
10183
+ * registry answers "is this `in_progress` task actually being executed right
10184
+ * now?" for the reconcile fallback. It is intentionally in-process: a restart
10185
+ * empties it, which is exactly what makes every orphaned `in_progress` task
10186
+ * recoverable after a crash.
10187
+ *
10188
+ * @example
10189
+ * ```ts
10190
+ * import { taskRunRegistry } from "./TaskRunRegistry";
10191
+ * taskRunRegistry.register(taskId);
10192
+ * taskRunRegistry.isLive(taskId); // true
10193
+ * taskRunRegistry.unregister(taskId);
10194
+ * ```
10195
+ */
10196
+ declare class TaskRunRegistry {
10197
+ private readonly live;
10198
+ /** Marks a task as currently held by a live run. */
10199
+ register(taskId: string): void;
10200
+ /** Removes a task once its run has ended. */
10201
+ unregister(taskId: string): void;
10202
+ /** Reports whether a task is currently held by a live run. */
10203
+ isLive(taskId: string): boolean;
10204
+ /** Returns a snapshot of the live task ids (diagnostics/tests). */
10205
+ snapshot(): string[];
10206
+ /** Clears all live entries (tests / process teardown). */
10207
+ clear(): void;
10208
+ }
10209
+ /** Shared process-local registry used by the task engine and the reconcile fallback. */
10210
+ declare const taskRunRegistry: TaskRunRegistry;
10211
+ /** Input for {@link reconcileStaleTaskRuns}. */
10212
+ interface ReconcileStaleTaskRunsInput {
10213
+ /** Candidate tasks within the caller's scope (the host owns enumeration). */
10214
+ tasks: TaskItem[];
10215
+ /** Actor recorded on the convergence transition. */
10216
+ actor: string;
10217
+ /** Lifecycle used to converge an orphaned task. */
10218
+ lifecycle: Pick<TaskLifecycleService, "interruptTask">;
10219
+ /** Registry override (tests); defaults to {@link taskRunRegistry}. */
10220
+ registry?: TaskRunRegistry;
10221
+ }
10222
+ /** Result of {@link reconcileStaleTaskRuns}. */
10223
+ interface ReconcileStaleTaskRunsResult {
10224
+ /** Task ids that were converged to `interrupted`. */
10225
+ converged: string[];
10226
+ }
10227
+ /**
10228
+ * Converges `in_progress` tasks that no live run holds to `interrupted`.
10229
+ *
10230
+ * @param input Candidate tasks, actor, lifecycle, and optional registry.
10231
+ * @returns The ids that were converged.
10232
+ * @remarks
10233
+ * The caller owns scope enumeration (a store cannot list across tenants). A task
10234
+ * is converged only when it is `in_progress` and absent from the registry, so a
10235
+ * task a live run genuinely holds is never touched.
10236
+ *
10237
+ * @example
10238
+ * ```ts
10239
+ * const { converged } = await reconcileStaleTaskRuns({
10240
+ * tasks: scopeTasks, actor: "system:reconcile", lifecycle,
10241
+ * });
10242
+ * ```
10243
+ */
10244
+ declare function reconcileStaleTaskRuns(input: ReconcileStaleTaskRunsInput): Promise<ReconcileStaleTaskRunsResult>;
10245
+ /** Input for {@link reconcileTenantTaskRuns}. */
10246
+ interface ReconcileTenantTaskRunsInput {
10247
+ /** Tenant whose `in_progress` tasks are enumerated. */
10248
+ tenantId: string;
10249
+ /** Actor recorded on the convergence transition. */
10250
+ actor: string;
10251
+ /** Store used to enumerate the tenant's `in_progress` tasks. */
10252
+ taskStore: Pick<TaskStore, "list">;
10253
+ /** Lifecycle used to converge an orphaned task. */
10254
+ lifecycle: Pick<TaskLifecycleService, "interruptTask">;
10255
+ /** Registry override (tests); defaults to {@link taskRunRegistry}. */
10256
+ registry?: TaskRunRegistry;
10257
+ /**
10258
+ * Optional host predicate selecting which candidates this reconciler owns.
10259
+ *
10260
+ * @remarks Host-owned task families (for example governed Project tasks, which
10261
+ * have their own observer) pass a predicate that excludes them, so this
10262
+ * generic reconciler never competes with a domain reconciler.
10263
+ */
10264
+ include?: (task: TaskItem) => boolean;
10265
+ }
10266
+ /**
10267
+ * Reconciles a tenant's orphaned `in_progress` tasks.
10268
+ *
10269
+ * @param input Tenant, actor, store, lifecycle, optional registry and predicate.
10270
+ * @returns The ids that were converged.
10271
+ * @remarks
10272
+ * Enumerates `{ tenantId, status: "in_progress" }` and delegates to
10273
+ * {@link reconcileStaleTaskRuns}. The caller owns the `include` predicate; a
10274
+ * host must exclude task families that have their own reconciliation.
10275
+ *
10276
+ * @example
10277
+ * ```ts
10278
+ * await reconcileTenantTaskRuns({
10279
+ * tenantId, actor: "system:reconcile", taskStore, lifecycle,
10280
+ * include: (task) => !isProjectLifecycleTask(task),
10281
+ * });
10282
+ * ```
10283
+ */
10284
+ declare function reconcileTenantTaskRuns(input: ReconcileTenantTaskRunsInput): Promise<ReconcileStaleTaskRunsResult>;
10285
+ /** Input for {@link reconcileAllTenantTaskRuns}. */
10286
+ interface ReconcileAllTenantTaskRunsInput {
10287
+ /** Actor recorded on the convergence transition. */
10288
+ actor: string;
10289
+ /** Store used to enumerate tenants. */
10290
+ tenantStore: {
10291
+ listTenants(): Promise<Array<{
10292
+ id: string;
10293
+ }>>;
10294
+ };
10295
+ /** Store used to enumerate each tenant's `in_progress` tasks. */
10296
+ taskStore: Pick<TaskStore, "list">;
10297
+ /** Lifecycle used to converge an orphaned task. */
10298
+ lifecycle: Pick<TaskLifecycleService, "interruptTask">;
10299
+ /** Registry override (tests); defaults to {@link taskRunRegistry}. */
10300
+ registry?: TaskRunRegistry;
10301
+ /** Host predicate selecting which candidates this reconciler owns. */
10302
+ include?: (task: TaskItem) => boolean;
10303
+ }
10304
+ /**
10305
+ * Reconciles orphaned `in_progress` tasks across all tenants.
10306
+ *
10307
+ * @param input Actor, tenant store, task store, lifecycle, optional registry and predicate.
10308
+ * @returns The ids that were converged across every tenant.
10309
+ * @remarks Enumerates tenants via `listTenants()` and delegates per tenant to
10310
+ * {@link reconcileTenantTaskRuns}. Intended for a host startup/interval job;
10311
+ * callers own when it runs.
10312
+ *
10313
+ * @example
10314
+ * ```ts
10315
+ * await reconcileAllTenantTaskRuns({
10316
+ * actor: "system:reconcile", tenantStore, taskStore, lifecycle,
10317
+ * include: (task) => !isProjectLifecycleTask(task),
10318
+ * });
10319
+ * ```
10320
+ */
10321
+ declare function reconcileAllTenantTaskRuns(input: ReconcileAllTenantTaskRunsInput): Promise<ReconcileStaleTaskRunsResult>;
10322
+
9342
10323
  /** Internal authority for immediate delegated worker execution. */
9343
10324
  declare const DELEGATED_WORKER_SCOPE_TOKEN: unique symbol;
9344
10325
  /** Reports whether a run configuration contains the private delegated token key. */
9345
10326
  declare function hasDelegatedWorkerToken(runConfig: Record<string, unknown> & Partial<Record<typeof DELEGATED_WORKER_SCOPE_TOKEN, unknown>>): boolean;
9346
10327
 
10328
+ /**
10329
+ * Requested dispatch target and trusted caller identity forwarded to a managed authority.
10330
+ *
10331
+ * @remarks Core forwards the requested `agentId` and the trusted Project caller
10332
+ * it parsed from the run context. The authority owns every roster, ownership
10333
+ * transfer, and authorization decision; Core never interprets them.
10334
+ */
10335
+ interface ManagedTaskStartOptions {
10336
+ /** Requested dispatch target Agent, when the caller named one. */
10337
+ agentId?: string;
10338
+ /** Trusted Project caller membership identifier, when the run context carried one. */
10339
+ callerMembershipId?: string;
10340
+ /** Trusted Project caller Assistant identifier, when the run context carried one. */
10341
+ callerAssistantId?: string;
10342
+ }
10343
+ /**
10344
+ * Typed failure a managed authority throws to surface a stable dispatch outcome.
10345
+ *
10346
+ * @remarks Only this error type is surfaced verbatim by the immediate primitive
10347
+ * (code, message, `hint`, `retryable`). Any other thrown error is reported as
10348
+ * `TASK_EXECUTION_ENQUEUE_FAILED` so unrelated driver or store codes never leak
10349
+ * into the dispatch result.
10350
+ *
10351
+ * @example
10352
+ * ```ts
10353
+ * throw new ManagedTaskStartError("PROJECT_TASK_OWNER_INACTIVE", "Owner is not active", {
10354
+ * hint: "Dispatch to an active bot in this Project's roster.",
10355
+ * });
10356
+ * ```
10357
+ */
10358
+ declare class ManagedTaskStartError extends Error {
10359
+ /** Stable machine-readable failure code surfaced to the dispatch caller. */
10360
+ readonly code: string;
10361
+ /** Actionable remediation shown alongside the failure, when known. */
10362
+ readonly hint?: string;
10363
+ /** Whether the caller may safely retry the same dispatch, when known. */
10364
+ readonly retryable?: boolean;
10365
+ /**
10366
+ * Creates a managed dispatch failure.
10367
+ *
10368
+ * @param code Stable machine-readable failure code.
10369
+ * @param message Human-readable failure description.
10370
+ * @param options Optional remediation hint and retryability flag.
10371
+ */
10372
+ constructor(code: string, message: string, options?: {
10373
+ hint?: string;
10374
+ retryable?: boolean;
10375
+ });
10376
+ }
10377
+ /**
10378
+ * A registered owner of task execution.
10379
+ *
10380
+ * A matching authority means "this task is executed by the authority, not by
10381
+ * the immediate primitive". The registration is a composition concern: the
10382
+ * business scenario (Project Room/Task, Learning, ...) supplies the predicate
10383
+ * and messaging; the execution primitive only queries the registry.
10384
+ */
10385
+ interface ExecutionAuthority {
10386
+ /** Stable identifier of the authority (e.g. `project-lifecycle`). */
10387
+ id: string;
10388
+ /** Predicate deciding whether this authority owns the given task. */
10389
+ matches(task: TaskItem): boolean;
10390
+ /** Failure code returned by the immediate primitive when it is bypassed. */
10391
+ code?: string;
10392
+ /** Human-readable message returned alongside the code. */
10393
+ message?: string;
10394
+ /**
10395
+ * Optional hook invoked by the immediate primitive when this authority owns
10396
+ * the task. When present, `start` routes the request to the authority and
10397
+ * returns a managed (asynchronous) result instead of refusing.
10398
+ *
10399
+ * @param task Persisted task snapshot captured before routing.
10400
+ * @param options Requested target and trusted caller identity, when known.
10401
+ */
10402
+ onManagedStart?(task: TaskItem, options?: ManagedTaskStartOptions): Promise<void> | void;
10403
+ }
10404
+ /**
10405
+ * Process-global registry mapping tasks to the authority that owns their execution.
10406
+ *
10407
+ * @remarks
10408
+ * - Registration is idempotent by `id` (re-registering replaces the entry).
10409
+ * - `resolve` is order-insensitive: the first matching authority wins.
10410
+ * - A throwing predicate is treated as a non-match so a broken scenario can
10411
+ * never brick the immediate execution primitive.
10412
+ */
10413
+ declare class ExecutionAuthorityRegistry {
10414
+ private readonly authorities;
10415
+ /** Registers (or replaces) an authority. @returns An unregister function. */
10416
+ register(authority: ExecutionAuthority): () => void;
10417
+ /** Resolves the authority that owns the task's execution, if any. */
10418
+ resolve(task: TaskItem): ExecutionAuthority | undefined;
10419
+ /** Removes every registration. Intended for isolated tests. */
10420
+ clear(): void;
10421
+ }
10422
+ /** Process-global execution authority registry used by the immediate executor. */
10423
+ declare const executionAuthorityRegistry: ExecutionAuthorityRegistry;
10424
+
9347
10425
  declare const AGENT_TASK_EVENT = "agent:execute";
9348
10426
 
9349
10427
  /**
@@ -9803,12 +10881,15 @@ declare function compileSandboxPlugin(args: CompileSandboxPluginArgs): Plugin;
9803
10881
  * @property hash - Content hash of the validated manifests and their relative file paths; empty when the sandbox was unavailable.
9804
10882
  * @property plugins - Compiled plugins ready to register for the tenant.
9805
10883
  * @property diagnostics - Structured load/validation diagnostics for the snapshot.
10884
+ * @property manifests - Normalized manifests keyed by plugin type; the validated
10885
+ * source of truth for handler paths and tool caps (not the raw `plugin.json`).
9806
10886
  */
9807
10887
  interface TenantPlugins {
9808
10888
  tenantId: string;
9809
10889
  hash: string;
9810
10890
  plugins: Plugin[];
9811
10891
  diagnostics: SandboxPluginDiagnostic[];
10892
+ manifests: Record<string, SandboxPluginManifest>;
9812
10893
  }
9813
10894
  /**
9814
10895
  * Dependencies for {@link TenantPluginCatalog}.
@@ -9876,6 +10957,20 @@ declare class TenantPluginCatalog {
9876
10957
  * @returns The cached snapshot, or `undefined` when the tenant has not loaded
9877
10958
  */
9878
10959
  getCached(tenantId: string): TenantPlugins | undefined;
10960
+ /**
10961
+ * Return the validated manifest for a tenant plugin type.
10962
+ *
10963
+ * The returned manifest is the normalized output of
10964
+ * {@link validateSandboxPluginManifest}, **not** the raw `plugin.json` bytes.
10965
+ * Callers that execute tools must read handler paths and resource caps from
10966
+ * here so a cache/TOCTOU skew or a hand-edited file cannot bypass validation.
10967
+ *
10968
+ * @param tenantId - Tenant that owns the plugin
10969
+ * @param type - Plugin type (directory name)
10970
+ * @returns The normalized manifest, or `undefined` when the plugin is absent
10971
+ * or failed validation
10972
+ */
10973
+ getValidatedManifest(tenantId: string, type: string): Promise<SandboxPluginManifest | undefined>;
9879
10974
  /**
9880
10975
  * Drop the cached snapshot for a tenant.
9881
10976
  *
@@ -10191,13 +11286,16 @@ declare const documentParserPlugin: Plugin;
10191
11286
  * Semantic Metrics Middleware & Plugin (connection-backed, /api/v1).
10192
11287
  *
10193
11288
  * Exposes datasource exploration, meta publishing, and runtime query tools.
10194
- * Credentials are resolved via the framework-injected `_resolvedConnections`.
11289
+ * Credentials are resolved by the plugin's own tools at invocation time from
11290
+ * the tenant-scoped Connection Store (see `resolveMetricsClientFromSelector`).
10195
11291
  */
10196
11292
 
10197
11293
  /**
10198
11294
  * Create the Semantic Metrics middleware exposing three action-dispatch tools.
10199
11295
  *
10200
- * @param config - Plugin config; reads `config._resolvedConnections` (framework-injected).
11296
+ * @param config - Plugin config; reads `connections`/`connectAll` (resolved per
11297
+ * invocation from the tenant-scoped Connection Store). Resource scope is owned
11298
+ * by the connection's own `selectedEntities`.
10201
11299
  * @returns Middleware with the datasource/meta/runtime tool set.
10202
11300
  */
10203
11301
  declare function createSemanticMetricsMiddleware(config: Record<string, unknown>): AgentMiddleware;
@@ -10337,6 +11435,76 @@ interface UnknownToolHandlerConfig {
10337
11435
  */
10338
11436
  declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerConfig): AgentMiddleware;
10339
11437
 
11438
+ /**
11439
+ * Repeated Tool Call Breaker Middleware
11440
+ *
11441
+ * Model-agnostic loop guard. Counts consecutive identical tool-call signatures
11442
+ * in graph state (`afterModel`), blocks the call with a corrective reminder at
11443
+ * the warn threshold (`wrapToolCall`), and throws a `RepeatedToolCallError` to
11444
+ * hard-stop the run at the stop threshold.
11445
+ *
11446
+ * This protects runs from models that re-issue the exact same call (same tool,
11447
+ * same arguments) without incorporating the previous result — e.g. a deepseek
11448
+ * agent issuing the identical `read_eval get_run_results` call dozens of times.
11449
+ *
11450
+ * @example
11451
+ * ```ts
11452
+ * middlewares.push(createRepeatedToolCallBreakerMiddleware({ warnThreshold: 3, stopThreshold: 5 }));
11453
+ * ```
11454
+ *
11455
+ * @remarks
11456
+ * Thresholds are supplied at construction time; callers typically read them from
11457
+ * env via `readLoopBreakerConfig`. A threshold of `0` disables the guard.
11458
+ */
11459
+
11460
+ /** Raised when a run keeps issuing the identical tool call past the stop threshold. */
11461
+ declare class RepeatedToolCallError extends Error {
11462
+ readonly toolName: string | undefined;
11463
+ readonly count: number;
11464
+ readonly stopThreshold: number;
11465
+ readonly argsPreview: string;
11466
+ constructor(toolName: string | undefined, count: number, stopThreshold: number, argsPreview: string);
11467
+ }
11468
+ /** Thresholds for the loop guards. A value of `0` disables that guard. */
11469
+ interface LoopBreakerConfig {
11470
+ /** Call count at which repeated identical calls are blocked with a reminder. */
11471
+ repeatWarn: number;
11472
+ /** Call count at which a `RepeatedToolCallError` is thrown. */
11473
+ repeatStop: number;
11474
+ /** Per-run tool-call budget for the global limit middleware. */
11475
+ runLimit: number;
11476
+ /** Per-run cap for the `skill` tool, to stop skill-load enumeration (0 disables). */
11477
+ skillRunLimit: number;
11478
+ }
11479
+ /** Read loop-breaker thresholds from env. 0 disables a guard. Invalid values fall back to defaults. */
11480
+ declare function readLoopBreakerConfig(env?: NodeJS.ProcessEnv): LoopBreakerConfig;
11481
+ /** Construction options for {@link createRepeatedToolCallBreakerMiddleware}. */
11482
+ interface RepeatedToolCallBreakerOptions {
11483
+ /**
11484
+ * Call count at which the repeated call is blocked with a reminder (default 3).
11485
+ * A positive value is floored to `2` so the first call of every signature always
11486
+ * executes (`warnThreshold: 1` cannot brick all tool use). A value `<= 0` disables
11487
+ * the blocking tier while counting and the stop throw stay active.
11488
+ */
11489
+ warnThreshold?: number;
11490
+ /**
11491
+ * Call count at which a `RepeatedToolCallError` is thrown (default 5).
11492
+ * Construction coerces this to at least 1; a value `<= 0` disables the whole guard at install time.
11493
+ */
11494
+ stopThreshold?: number;
11495
+ }
11496
+ /**
11497
+ * Warn-and-block, then hard-stop, when the model keeps issuing the identical tool call.
11498
+ *
11499
+ * @param options - Threshold configuration; see {@link RepeatedToolCallBreakerOptions}.
11500
+ * A positive `warnThreshold` has an effective minimum of `2`, so the first call of
11501
+ * every signature always executes; `warnThreshold <= 0` disables the block tier
11502
+ * (counting and the hard stop still apply); `stopThreshold <= 0` is treated as
11503
+ * disabled at install time (callers gate on it).
11504
+ * @returns A LangChain `AgentMiddleware` that can be pushed onto the middleware chain.
11505
+ */
11506
+ declare function createRepeatedToolCallBreakerMiddleware(options?: RepeatedToolCallBreakerOptions): AgentMiddleware;
11507
+
10340
11508
  /** Describes how a tool argument selects a capability-scoped resource. */
10341
11509
  interface CapabilityResourceSelector {
10342
11510
  /** Tool argument containing the selected resource key. */
@@ -10794,6 +11962,39 @@ declare class ConnectionRegistry {
10794
11962
  private static ensureStore;
10795
11963
  }
10796
11964
 
11965
+ /** A plugin connection resolved to its stored key and config. */
11966
+ interface ResolvedPluginConnection {
11967
+ /** Connection key (unique within `(tenantId, type)`). */
11968
+ key: string;
11969
+ /** Stored connection config (credentials, resource selection, …). */
11970
+ config: Record<string, unknown>;
11971
+ }
11972
+ /** Run-scoped identity needed to resolve a plugin's connections. */
11973
+ interface PluginConnectionScope {
11974
+ /** Authoritative tenant; resolution is skipped when absent. */
11975
+ tenantId?: string;
11976
+ }
11977
+ /**
11978
+ * Resolve the connections selected by a plugin's `connections` / `connectAll`
11979
+ * config against the tenant-scoped Connection Store.
11980
+ *
11981
+ * @param type - Plugin type (`Plugin.meta.type` = `ConnectionEntry.type`).
11982
+ * @param config - Plugin middleware config carrying `connections` and/or `connectAll`.
11983
+ * @param scope - Run-scoped identity; only `tenantId` is used.
11984
+ * @returns The matching `{ key, config }` entries in registry order; empty when
11985
+ * no tenant, no selection, or nothing matches (foreign tenant/type filtered out).
11986
+ * @remarks
11987
+ * - `connectAll: true` lists every connection of the type for the tenant.
11988
+ * - Explicit `connections` are looked up individually; missing keys are dropped.
11989
+ * - Callers are trusted in-process plugin code; the resolver does not verify that
11990
+ * `type` is the caller's own plugin type. Plugins must pass their own
11991
+ * `meta.type` — treating this as a tenant-wide credential read is out of contract.
11992
+ */
11993
+ declare function resolvePluginConnections(type: string, config: {
11994
+ connections?: unknown;
11995
+ connectAll?: unknown;
11996
+ }, scope: PluginConnectionScope): Promise<ResolvedPluginConnection[]>;
11997
+
10797
11998
  /**
10798
11999
  * Export/Import shared type definitions.
10799
12000
  *
@@ -11157,4 +12358,4 @@ declare function parseDirectRoomType(projectId: string): "human" | "bot" | null;
11157
12358
  */
11158
12359
  declare function isDirectRoom(projectId: string): boolean;
11159
12360
 
11160
- export { AGENT_TASK_EVENT, type AddMessageParams, type AddMessageResult, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentTaskCompletionInput, type AgentThreadInterface, type ApproveInterruptedTaskInput, BUILTIN_PLUGINS, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BufferStats, CAPABILITY_TOOL_NAME_CONFLICT, type CacheEntry, type CalibrationProbe, CapabilityBundleMergeError, type CapabilityBundleMergeErrorCode, CapabilityBundleMerger, CapabilityBundleValidationError, type CapabilityBundleValidationErrorCode, type CapabilityGuardDenialCode, type CapabilityResourceSelector, type CapabilityToolMetadata, CapabilityToolNameConflictError, CapabilityToolRegistry, type CaseRunResult, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, CollectionLatticeManager, type ColumnInfo, type CompileSandboxPluginArgs, CompositeBackend, type ConflictItem, type ConnectAllChannelsOptions, ConnectionRegistry, ConsoleLoggerClient, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, DEFAULT_CALIBRATION_PROBES, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, DelegatedScopeNotQueueableError, type DeleteResult, DependencyResolver, DuplicateProjectRoomMessageIdempotencyKeyError, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsInfo, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type EvalRunService, type ExportBundle, type ExportContext, type ExportJob, type ExportableEntity, type ExportableEntityDefinition, ExportableEntityRegistry, type ExportableFile, type ExportableTypeInfo, type ExternalDependencyInterruption, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, IdRemapper, type ImportApplyResolution, type ImportApplyResult, type ImportEntityResult, type ImportEntityStatus, type ImportPreviewResult, InMemoryA2AApiKeyStore, InMemoryAgentWebAppStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryCapabilityBundleStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryCollectionStore, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryOpenAuditStore, InMemoryProjectBotMembershipStore, InMemoryProjectMembershipStore, InMemoryProjectRoomCoordinator, InMemoryProjectRoomMessageStore, InMemoryProjectRoomReadStateStore, InMemoryProjectRoomStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserPushSubscriptionStore, InMemoryUserStore, InMemoryUserTenantLinkStore, type InsertionItem, type JudgeVerdict, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LatticeAgentStepConfig, LatticeEval, type LatticeEvalBatchReport, type LatticeEvalCase, type LatticeEvalCaseType, type LatticeEvalCaseWithTemplate, type LatticeEvalConfig, type LatticeEvalLogEvent, type LatticeEvalLogLevel, LatticeEvalProject, type LatticeEvalProjectType, type LatticeEvalResult, type LatticeEvalRubric, LatticeEvalSuite, type LatticeEvalSuiteType, type LatticeEvalTemplate, type LifecycleResult, type LifecycleWarning, LocalSandboxInstance, LocalSandboxProvider, type LocalSandboxProviderConfig, type LoggerLattice, LoggerLatticeManager, MAX_LINE_LENGTH, MAX_PACK_ENTRIES, MAX_PACK_FILE_BYTES, MAX_PACK_TOTAL_BYTES, type MailboxMessage, type MailboxStore, type ManifestValidationResult, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MergedPluginSkills, type MessageCompletedEvent, type MessageContent, type MessageContentPart, type MessageContentValue, type MessageFailedEvent, type MessageInterruptedEvent, type MessageLike, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type OutputType, PACK_DIRECTORY_TIMEOUT_SECONDS, type PackSourceInfo, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, PluginRegistry, type PostProcessTaskMutationResponseInput, PostgresDatabase, type PreviewError, ProjectBotMembershipIdConflictError, ProjectMutationMutex, type ProjectMutationScope, ProjectRoomMessageIdConflictError, type ProjectTaskAdmissionListener, type ProjectTaskAdmissionNotification, ProjectTaskAdmissionNotifier, type ProjectTaskAdmissionNotifierOptions, type ProjectTaskAssignmentScope, ProjectTaskOwnerPolicy, type ProjectTaskOwnerPolicyCode, ProjectTaskOwnerPolicyError, type ProjectTaskReassignmentAuthorization, type ProjectTaskReassignmentAuthorizationInput, type ProjectTaskReassignmentAuthorizer, type ProjectTaskReassignmentThreadValidationInput, type ProjectTaskReassignmentThreadValidator, type ProjectTaskRosterScope, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, type QueueMessage, QueueMode, type QueuePendingEvent, type QueueScope, ROOM_COORDINATOR_KEY, type ReassignProjectTaskInput, type ReconcileTaskDescriptionInput, type RejectInterruptedTaskInput, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type ReplyReadyEvent, type Resolution, type ResolutionAction, type ResolveAgentFn, type ResolvedConfig, type ResolvedPluginSkill, type ResumeTaskResult, type RoomAgentMessageCallbackFailure, type RoomAgentMessageCommitted, type RoomAgentMessageInput, RoomAgentMessageService, type RoomAgentReplyInput, type RunSandboxConfig, type RuntimeModelConfig, type RuntimeSkillSelection, SAFE_PATH_COMPONENT, type STTModelInfo, STTModelLattice, type STTModelLatticeInterface, STTModelLatticeManager, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxGrepMatch, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, SandboxPluginExecutor, type SandboxPluginExecutorDeps, type SandboxPluginInvokeArgs, type SandboxPluginResult, type SandboxProvider, type SandboxProviderFactory, type SandboxProviderType, type SandboxResolver, type SandboxRunConfig, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SharePayload, SimpleMemoryVectorStore, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StartLifecycleResult, type StartTaskExecutionInput, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, type SubmitTaskReviewInput, TASK_RESPONSE_FINAL_WARNING_LIMIT, TASK_RESPONSE_PRIOR_WARNING_LIMIT, TASK_RESPONSE_SCALAR_MAX_BYTES, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskAgentInvocation, type TaskEvent, type TaskExecutionFailure, type TaskExecutionResult, type TaskExecutionServiceDeps, type TaskExecutionSuccess, type TaskLifecycleListener, type TaskLifecycleNotification, TaskLifecycleNotifier, TaskLifecycleService, type TaskLifecycleServiceDeps, type TaskListStore, type TaskResponseParseResult, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, TenantPluginCatalog, type TenantPluginCatalogDeps, type TenantPlugins, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadEndCode, ThreadEndError, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TrustedAgentMessageDispatcher, type TrustedMessageOptions, type UnknownToolHandlerConfig, type ValidateManifestArgs, type VectorStoreLatticeInterface, VectorStoreLatticeManager, type VectorStoreProviderLattice, VectorStoreProviderManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, abortWorkflowRun, agentInstanceManager, agentLatticeManager, appendReconciliationWarning, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildRemotePackDirectoryCommand, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, buildTableName, buildTaskMutationFallback, buildTaskNormalizationFallback, checkEmptyContent, clearEncryptionKeyCache, clearEvalRunService, collectionLatticeManager, compileInternal, compileSandboxPlugin, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, createAgentNode, createAgentTeam, createCapabilityGuardMiddleware, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createProjectRoomMiddleware, createProjectTaskOwnerPolicy, createProjectTaskReassignmentAuthorizer, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createResourceAddress, createSandboxProvider, createSandboxResolver, createSchedulerMiddleware, createSemanticMetricsMiddleware, createSharePayload, createTaskExecutionService, createTaskLifecycleService, createTaskMiddleware, createTeamMiddleware, createTeammateTools, createTrustedAgentMessageDispatcher, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, documentLearningPlugin, documentParserPlugin, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, ensurePluginSkillInSandbox, evaluateLatticeCaseWithLogs, eventBus, eventBus as eventBusDefault, extractFetcherError, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, generateDirectBotProjectId, generateDirectHumanProjectId, generateToken, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getCollectionEntryCount, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getEvalRunService, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getOrCreateCollectionVectorStore, getPluginSkillManifestVersion, getQueueLattice, getRuntimeCapabilityConfig, getRuntimeSkillSelection, getSTTClient, getSTTClientWithTenant, getSTTModelLattice, getSandBoxManager, getSandboxPluginCatalog, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, getVectorStoreProvider, getWorkflowSignal, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, hasDelegatedWorkerToken, hasRuntimeCapabilityPolicy, invokeWithRetry, isBuiltInSkill, isDirectRoom, isPluginSkillAuthorizedInSandbox, isPluginSkillManagedInSandbox, isProjectLifecycleTask, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, jsonSchemaToZod, listCollectionEntries, listSandboxProviderTypes, loggerLatticeManager, mcpManager, mergeCapabilityBundles, mergePluginSkills, mergePluginSources, metricsServerManager, modelLatticeManager, normalizeSandboxName, ownTaskResponseField, parallelLimit, parseCronExpression, parseDirectRoomType, parseExternalDependency, parseJudgeVerdict, parsePackSize, parseSkillFrontmatter, parseTaskResponse, parseYaml, performStringReplacement, postProcessTaskMutationResponse, projectMutationMutex, projectRoomPlugin, projectTaskAdmissionNotifier, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerSTTModelLattice, registerSandboxProviderType, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, registerVectorStoreProvider, registerWorkflowRun, removeCollectionVectorStore, renderTemplate, resolveEnabledPluginSkill, resolveJudgeModelKey, resolvePath, resolveSandboxPluginConnections, resolveTenantPluginSkill, roomCoordinatorConfig, runRemotePackDirectory, safeTaskResponseId, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, semanticMetricsPlugin, serializePluginMeta, serializeTaskMutationSuccess, serializeTaskNormalizationFallback, serializeTaskReadResponse, setBindingRegistry, setEvalRunService, setMenuRegistry, setSandboxPluginCatalog, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, sttModelLatticeManager, taskLifecycleNotifier, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, unregisterWorkflowRun, updateFileData, validateAgentInput, validateCapabilityBundleInput, validateDSL, validateEncryptionKey, validatePackSourcePath, validatePath, validateRelativePath, validateSandboxPluginManifest, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager };
12361
+ export { AGENT_TASK_EVENT, type AddMessageParams, type AddMessageResult, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentTaskCompletionInput, type AgentThreadInterface, type ApproveInterruptedTaskInput, BUILTIN_PLUGINS, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BeginRunFailure, type BeginRunInput, type BeginRunResult, type BeginRunSuccess, type BufferStats, CAPABILITY_TOOL_NAME_CONFLICT, type CacheEntry, type CalibrationProbe, CapabilityBundleMergeError, type CapabilityBundleMergeErrorCode, CapabilityBundleMerger, CapabilityBundleValidationError, type CapabilityBundleValidationErrorCode, type CapabilityGuardDenialCode, type CapabilityResourceSelector, type CapabilityToolMetadata, CapabilityToolNameConflictError, CapabilityToolRegistry, type CaseRunResult, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, CollectionLatticeManager, type ColumnInfo, type CompileSandboxPluginArgs, CompositeBackend, type ConflictItem, type ConnectAllChannelsOptions, ConnectionRegistry, ConsoleLoggerClient, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, DEFAULT_CALIBRATION_PROBES, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_DELAY_MS, DEFAULT_MAX_ATTEMPTS, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, DelegatedScopeNotQueueableError, type DeleteResult, DependencyResolver, type DispatchPreparation, DuplicateProjectRoomMessageIdempotencyKeyError, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsInfo, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type EvalRunService, type ExecutionAuthority, ExecutionAuthorityRegistry, type ExportBundle, type ExportContext, type ExportJob, type ExportableEntity, type ExportableEntityDefinition, ExportableEntityRegistry, type ExportableFile, type ExportableTypeInfo, type ExternalDependencyInterruption, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, HEALTH_CHECK_INTERVAL_MS, HEALTH_CHECK_TIMEOUT_MS, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, IdRemapper, type ImmediateDispatchPlan, type ImportApplyResolution, type ImportApplyResult, type ImportEntityResult, type ImportEntityStatus, type ImportPreviewResult, InMemoryA2AApiKeyStore, InMemoryAgentWebAppStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryCapabilityBundleStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryCollectionStore, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryOpenAuditStore, InMemoryProjectBotMembershipStore, InMemoryProjectMembershipStore, InMemoryProjectRoomCoordinator, InMemoryProjectRoomMessageStore, InMemoryProjectRoomReadStateStore, InMemoryProjectRoomStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTaskWorkItemStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserPushSubscriptionStore, InMemoryUserStore, InMemoryUserTenantLinkStore, type InsertionItem, type JudgeVerdict, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LatticeAgentStepConfig, LatticeEval, type LatticeEvalBatchReport, type LatticeEvalCase, type LatticeEvalCaseType, type LatticeEvalCaseWithTemplate, type LatticeEvalConfig, type LatticeEvalLogEvent, type LatticeEvalLogLevel, LatticeEvalProject, type LatticeEvalProjectType, type LatticeEvalResult, type LatticeEvalRubric, LatticeEvalSuite, type LatticeEvalSuiteType, type LatticeEvalTemplate, type LifecycleResult, type LifecycleWarning, LocalSandboxInstance, LocalSandboxProvider, type LocalSandboxProviderConfig, type LoggerLattice, LoggerLatticeManager, type LoopBreakerConfig, MAX_BACKOFF_MS, MAX_LINE_LENGTH, MAX_PACK_ENTRIES, MAX_PACK_FILE_BYTES, MAX_PACK_TOTAL_BYTES, type MailboxMessage, type MailboxStore, ManagedTaskStartError, type ManagedTaskStartOptions, type ManifestValidationResult, type McpClientFactory, type McpClientLike, type McpClientSession, type McpConnectionOptions, McpLatticeManager, type McpRegisterOptions, type McpServerId, type McpServerRuntime, type McpServerState, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MergedPluginSkills, type MessageCompletedEvent, type MessageContent, type MessageContentPart, type MessageContentValue, type MessageFailedEvent, type MessageInterruptedEvent, type MessageLike, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type OutputType, PACK_DIRECTORY_TIMEOUT_SECONDS, type PackSourceInfo, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, type PluginConnectionScope, PluginRegistry, type PostProcessTaskMutationResponseInput, PostgresDatabase, type PreviewError, ProjectBotMembershipIdConflictError, ProjectMutationMutex, type ProjectMutationScope, ProjectRoomMessageIdConflictError, type ProjectTaskAdmissionListener, type ProjectTaskAdmissionNotification, ProjectTaskAdmissionNotifier, type ProjectTaskAdmissionNotifierOptions, type ProjectTaskAssignmentScope, ProjectTaskOwnerPolicy, type ProjectTaskOwnerPolicyCode, ProjectTaskOwnerPolicyError, type ProjectTaskReassignmentAuthorization, type ProjectTaskReassignmentAuthorizationInput, type ProjectTaskReassignmentAuthorizer, type ProjectTaskReassignmentThreadValidationInput, type ProjectTaskReassignmentThreadValidator, type ProjectTaskRosterScope, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, type QueueMessage, QueueMode, type QueuePendingEvent, type QueueScope, ROOM_COORDINATOR_KEY, type ReassignProjectTaskInput, type ReconcileAllTenantTaskRunsInput, type ReconcileStaleTaskRunsInput, type ReconcileStaleTaskRunsResult, type ReconcileTaskDescriptionInput, type ReconcileTenantTaskRunsInput, type RejectInterruptedTaskInput, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type RepeatedToolCallBreakerOptions, RepeatedToolCallError, type ReplyReadyEvent, type Resolution, type ResolutionAction, type ResolveAgentFn, type ResolvedConfig, type ResolvedPluginConnection, type ResolvedPluginSkill, type ResumeTaskResult, type RoomAgentMessageCallbackFailure, type RoomAgentMessageCommitted, type RoomAgentMessageInput, RoomAgentMessageService, type RoomAgentReplyInput, type RunSandboxConfig, type RuntimeModelConfig, type RuntimeSkillSelection, SAFE_PATH_COMPONENT, type STTModelInfo, STTModelLattice, type STTModelLatticeInterface, STTModelLatticeManager, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxGrepMatch, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, SandboxPluginExecutor, type SandboxPluginExecutorDeps, type SandboxPluginInvokeArgs, type SandboxPluginResult, type SandboxProvider, type SandboxProviderFactory, type SandboxProviderType, type SandboxResolver, type SandboxRunConfig, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SettleRunInput, type SettleRunOutcome, type SharePayload, SimpleMemoryVectorStore, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StartLifecycleResult, type StartTaskExecutionInput, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, type SubmitTaskReviewInput, TASK_RESPONSE_FINAL_WARNING_LIMIT, TASK_RESPONSE_PRIOR_WARNING_LIMIT, TASK_RESPONSE_SCALAR_MAX_BYTES, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskAgentInvocation, type TaskEvent, type TaskExecutionFailure, type TaskExecutionManaged, type TaskExecutionResult, type TaskExecutionServiceDeps, type TaskExecutionSuccess, type TaskLifecycleListener, type TaskLifecycleNotification, TaskLifecycleNotifier, TaskLifecycleService, type TaskLifecycleServiceDeps, type TaskListStore, type TaskResponseParseResult, type TaskRunBridge, type TaskRunBridgeDeps, TaskRunBridgeStoresRequiredError, TaskRunRegistry, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, TenantPluginCatalog, type TenantPluginCatalogDeps, type TenantPlugins, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadEndCode, ThreadEndError, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TransferOwnerInput, type TransferOwnerResult, type TrustedAgentMessageDispatcher, type TrustedMessageOptions, type UnknownToolHandlerConfig, type ValidateManifestArgs, type VectorStoreLatticeInterface, VectorStoreLatticeManager, type VectorStoreProviderLattice, VectorStoreProviderManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, abortWorkflowRun, agentInstanceManager, agentLatticeManager, appendReconciliationWarning, appendUiFence, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildRemotePackDirectoryCommand, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, buildTableName, buildTaskMutationFallback, buildTaskNormalizationFallback, checkEmptyContent, clearEncryptionKeyCache, clearEvalRunService, collectionLatticeManager, compileInternal, compileSandboxPlugin, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, convertToConnection, createAgentNode, createAgentTeam, createCapabilityGuardMiddleware, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createProjectRoomMiddleware, createProjectTaskOwnerPolicy, createProjectTaskReassignmentAuthorizer, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createRepeatedToolCallBreakerMiddleware, createResourceAddress, createSandboxProvider, createSandboxResolver, createSchedulerMiddleware, createSemanticMetricsMiddleware, createSharePayload, createTaskExecutionService, createTaskLifecycleService, createTaskMiddleware, createTaskRunBridge, createTeamMiddleware, createTeammateTools, createTrustedAgentMessageDispatcher, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, documentLearningPlugin, documentParserPlugin, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, ensurePluginSkillInSandbox, evaluateLatticeCaseWithLogs, eventBus, eventBus as eventBusDefault, executionAuthorityRegistry, extractAppsRef, extractFetcherError, extractLegacyRefs, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, generateDirectBotProjectId, generateDirectHumanProjectId, generateToken, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getCollectionEntryCount, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getEvalRunService, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getOrCreateCollectionVectorStore, getPluginSkillManifestVersion, getQueueLattice, getRuntimeCapabilityConfig, getRuntimeSkillSelection, getSTTClient, getSTTClientWithTenant, getSTTModelLattice, getSandBoxManager, getSandboxPluginCatalog, getScheduleLattice, getStoreLattice, getToolClient, getToolClientWithTenant, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, getVectorStoreProvider, getWorkflowSignal, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, hasDelegatedWorkerToken, hasRuntimeCapabilityPolicy, invokeWithRetry, isBuiltInSkill, isDirectRoom, isPluginSkillAuthorizedInSandbox, isPluginSkillManagedInSandbox, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, jsonSchemaToZod, listCollectionEntries, listSandboxProviderTypes, loggerLatticeManager, mcpManager, mergeCapabilityBundles, mergePluginSkills, mergePluginSources, metricsServerManager, modelLatticeManager, nextBackoffDelay, normalizeSandboxName, ownTaskResponseField, parallelLimit, parseCronExpression, parseDirectRoomType, parseExternalDependency, parseJudgeVerdict, parsePackSize, parseSkillFrontmatter, parseTaskResponse, parseYaml, performStringReplacement, postProcessTaskMutationResponse, prepareTaskDispatch, projectMutationMutex, projectRoomPlugin, projectTaskAdmissionNotifier, queueLatticeManager, readLoopBreakerConfig, reconcileAllTenantTaskRuns, reconcileStaleTaskRuns, reconcileTenantTaskRuns, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerExistingToolWithTenant, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerSTTModelLattice, registerSandboxProviderType, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, registerVectorStoreProvider, registerWorkflowRun, removeCollectionVectorStore, renderTemplate, resolveEnabledPluginSkill, resolveJudgeModelKey, resolvePath, resolvePluginConnections, resolveSandboxPluginConnections, resolveTenantPluginSkill, roomCoordinatorConfig, runRemotePackDirectory, safeTaskResponseId, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, semanticMetricsPlugin, serializePluginMeta, serializeTaskMutationSuccess, serializeTaskNormalizationFallback, serializeTaskReadResponse, setBindingRegistry, setEvalRunService, setMenuRegistry, setSandboxPluginCatalog, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, sttModelLatticeManager, taskLifecycleNotifier, taskRunRegistry, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, unregisterWorkflowRun, updateFileData, validateAgentInput, validateCapabilityBundleInput, validateDSL, validateEncryptionKey, validatePackSourcePath, validatePath, validateRelativePath, validateSandboxPluginManifest, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager, withTimeout, wrapMcpToolWithUi };