@axiom-lattice/core 4.2.0 → 4.2.2

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,9 +8,9 @@ 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, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, AgentWebAppStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, AgentWebApp, CreateAgentWebAppInput, AgentWebAppStorePatch, AgentWebAppUpdateOptions, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, McpTool, ResourceResolver, ResourceAddress, ShareVisibility, CreateShareRequest, ChannelAdapter, InterruptPolicy, TaskBeliefState, PluginMeta, Plugin, PluginMetaOutput, 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, 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, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, AgentWebAppStore, CapabilityBundleStore, ProjectRoomStore, ProjectMembershipStore, ProjectBotMembershipStore, ProjectRoomMessageStore, 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, A2AApiKeyEntry, TaskMutationSnapshot, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, ProjectRoom, ProjectMembership, ProjectBotMembership, ProjectRoomMessage, ProjectHumanRole, ProjectMembershipMutationResult, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, PluginSkillDefinition, McpTool, ResourceResolver, ResourceAddress, ShareVisibility, CreateShareRequest, ChannelAdapter, InterruptPolicy, ProjectTaskLifecycleAction, TaskBeliefState, PluginMeta, Plugin, PluginMetaOutput, CapabilityPreview, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
12
12
  export { _axiom_lattice_protocols as Protocols };
13
- export { AgentConfig, AgentType, GraphBuildOptions, MemoryType } from '@axiom-lattice/protocols';
13
+ export { AgentConfig, AgentType, GraphBuildOptions, MemoryType, ProjectRoomTrustedRunContext, QueuedExecutionMode, TrustedRunContext, parseQueuedExecutionMode, parseTrustedRunContext } from '@axiom-lattice/protocols';
14
14
  import * as langchain from 'langchain';
15
15
  import { ReactAgent, AgentMiddleware } from 'langchain';
16
16
  import z, { z as z$1 } from 'zod';
@@ -1588,6 +1588,22 @@ interface SandboxInstance {
1588
1588
  getStatus(): Promise<"running" | "stopped" | "unknown">;
1589
1589
  readonly file: SandboxFileService;
1590
1590
  readonly shell: SandboxShellService;
1591
+ /**
1592
+ * Pack a directory into a provider-generated temporary ZIP file.
1593
+ *
1594
+ * Implementations may omit this capability. Local sandboxes accept only
1595
+ * paths rooted at `/project`; the returned path can be downloaded and then
1596
+ * deleted through the existing file service. Remote POSIX sandboxes run the
1597
+ * same safe shell-zip strategy through their shell service and therefore also
1598
+ * pack volume-backed folders visible inside the sandbox filesystem. The
1599
+ * returned `path` is always a sandbox-visible sibling (e.g.
1600
+ * `/project/data/reports.zip`).
1601
+ */
1602
+ packDirectory?(sourcePath: string): Promise<{
1603
+ path: string;
1604
+ filename: string;
1605
+ size?: number;
1606
+ }>;
1591
1607
  }
1592
1608
 
1593
1609
  type SandboxIsolationLevel = "global" | "agent" | "project";
@@ -2630,6 +2646,17 @@ declare enum QueueMode {
2630
2646
  FOLLOWUP = "followup",
2631
2647
  STEER = "steer"
2632
2648
  }
2649
+ /** Result returned after an Agent accepts a message for asynchronous execution. */
2650
+ interface AddMessageResult {
2651
+ queued: boolean;
2652
+ messageId: string;
2653
+ executed: boolean;
2654
+ }
2655
+ /** Options accepted only by the privileged trusted Agent dispatcher. */
2656
+ interface TrustedMessageOptions {
2657
+ trustedRunContext: TrustedRunContext;
2658
+ executionMode: QueuedExecutionMode;
2659
+ }
2633
2660
  interface ThreadQueueConfig {
2634
2661
  mode: QueueMode;
2635
2662
  maxSize: number;
@@ -2643,6 +2670,8 @@ interface PendingMessage {
2643
2670
  priority?: number;
2644
2671
  command?: CommandParams<unknown>;
2645
2672
  custom_run_config?: unknown;
2673
+ trusted_run_context?: TrustedRunContext;
2674
+ execution_mode?: QueuedExecutionMode;
2646
2675
  }
2647
2676
  interface PendingQueueMessageInput {
2648
2677
  message?: string;
@@ -2670,37 +2699,41 @@ interface AddMessageParams {
2670
2699
  threadId: string;
2671
2700
  tenantId: string;
2672
2701
  assistantId: string;
2673
- workspaceId?: string;
2674
- projectId?: string;
2702
+ workspaceId?: string | null;
2703
+ projectId?: string | null;
2675
2704
  content: PendingMessageContent;
2676
2705
  type?: "human" | "system";
2677
2706
  priority?: number;
2678
2707
  command?: CommandParams<unknown>;
2679
2708
  custom_run_config?: unknown;
2680
2709
  id?: string;
2710
+ trusted_run_context?: TrustedRunContext;
2711
+ execution_mode?: QueuedExecutionMode;
2681
2712
  }
2682
2713
  interface ThreadInfo {
2683
2714
  tenantId: string;
2684
2715
  assistantId: string;
2685
2716
  threadId: string;
2686
- workspaceId?: string;
2687
- projectId?: string;
2717
+ workspaceId?: string | null;
2718
+ projectId?: string | null;
2688
2719
  }
2720
+ type QueueScope = Pick<ThreadInfo, "tenantId" | "assistantId" | "workspaceId" | "projectId">;
2689
2721
  /**
2690
2722
  * Interface for message queue storage
2691
2723
  * Implemented by pg-stores or other storage backends
2692
2724
  */
2693
2725
  interface IMessageQueueStore {
2694
2726
  addMessage(params: AddMessageParams): Promise<PendingMessage>;
2727
+ addMessageIfCapacity(params: AddMessageParams, maxSize: number): Promise<boolean>;
2695
2728
  addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
2696
- getPendingMessages(threadId: string): Promise<PendingMessage[]>;
2697
- getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
2698
- getQueueSize(threadId: string): Promise<number>;
2729
+ getPendingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
2730
+ getProcessingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
2731
+ getQueueSize(threadId: string, scope?: QueueScope): Promise<number>;
2699
2732
  getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
2700
- removeMessage(messageId: string): Promise<boolean>;
2701
- clearMessages(threadId: string): Promise<void>;
2702
- markProcessing(messageId: string): Promise<void>;
2703
- resetProcessingToPending(threadId: string): Promise<number>;
2733
+ removeMessage(messageId: string, scope?: QueueScope): Promise<boolean>;
2734
+ clearMessages(threadId: string, scope?: QueueScope): Promise<void>;
2735
+ markProcessing(messageId: string, customRunConfig?: unknown, scope?: QueueScope): Promise<void>;
2736
+ resetProcessingToPending(threadId: string, scope?: QueueScope): Promise<number>;
2704
2737
  }
2705
2738
  /**
2706
2739
  * Agent executor function type
@@ -2718,13 +2751,28 @@ type LangGraphStateChecker = (tenantId: string, assistantId: string, threadId: s
2718
2751
  * Returns an async iterable for streaming responses
2719
2752
  */
2720
2753
  type AgentStreamExecutor = (tenantId: string, assistantId: string, threadId: string, input: any) => AsyncIterable<any>;
2754
+ /** A JSON-safe value accepted within a structured message content part. */
2755
+ type MessageContentValue = null | boolean | number | string | {
2756
+ [key: string]: MessageContentValue;
2757
+ } | MessageContentValue[];
2758
+ /** A provider-compatible structured message content part. */
2759
+ type MessageContentPart = {
2760
+ [key: string]: MessageContentValue;
2761
+ };
2762
+ /**
2763
+ * Queue-safe message content accepted by Agent inputs.
2764
+ *
2765
+ * Structured content remains JSON-serializable while supporting provider
2766
+ * content parts such as `{ type: "text", text: "hello" }`.
2767
+ */
2768
+ type MessageContent = string | [MessageContentPart, ...MessageContentPart[]];
2721
2769
  /**
2722
2770
  * Message-like structure for normalized message input
2723
2771
  * Supports both simple string content and structured message objects
2724
2772
  */
2725
2773
  interface MessageLike {
2726
2774
  role: "human" | "system" | "assistant" | "tool";
2727
- content: string;
2775
+ content: MessageContent;
2728
2776
  id?: string;
2729
2777
  metadata?: Record<string, unknown>;
2730
2778
  }
@@ -2764,6 +2812,11 @@ type StoreTypeMap = {
2764
2812
  connection: ConnectionStore;
2765
2813
  taskWorkItem: TaskWorkItemStore;
2766
2814
  agentWebApp: AgentWebAppStore;
2815
+ capabilityBundle: CapabilityBundleStore;
2816
+ projectRoom: ProjectRoomStore;
2817
+ projectMembership: ProjectMembershipStore;
2818
+ projectBotMembership: ProjectBotMembershipStore;
2819
+ projectRoomMessage: ProjectRoomMessageStore;
2767
2820
  };
2768
2821
  /**
2769
2822
  * Store type keys
@@ -3011,6 +3064,86 @@ declare class InMemoryAgentWebAppStore implements AgentWebAppStore {
3011
3064
  delete(tenantId: string, webAppId: string): Promise<boolean>;
3012
3065
  }
3013
3066
 
3067
+ /** Coordinates capability Bundle existence checks with Project updates in memory. */
3068
+ declare class InMemoryCapabilityBundleCoordinator {
3069
+ private readonly bundleKeys;
3070
+ private readonly revisions;
3071
+ private readonly tenantUpdates;
3072
+ /** Serializes Project and Bundle reference changes for one tenant. */
3073
+ runProjectUpdate<T>(tenantId: string, projectId: string, update: () => Promise<T> | T): Promise<T>;
3074
+ /** Records a tenant Bundle as present. */
3075
+ add(tenantId: string, bundleId: string, revision?: string): void;
3076
+ /** Removes a tenant Bundle. */
3077
+ remove(tenantId: string, bundleId: string): void;
3078
+ /** Checks all requested Bundle IDs without yielding to another operation. */
3079
+ hasAll(tenantId: string, bundleIds: string[]): boolean;
3080
+ hasAllAtRevisions(tenantId: string, bundleIds: string[], expected: Record<string, string>): boolean;
3081
+ setRevision(tenantId: string, bundleId: string, revision: string): void;
3082
+ private key;
3083
+ }
3084
+
3085
+ /**
3086
+ * InMemoryProjectStore
3087
+ *
3088
+ * In-memory implementation of ProjectStore
3089
+ * Provides CRUD operations for project data stored in memory
3090
+ */
3091
+
3092
+ declare class InMemoryProjectStore implements ProjectStore {
3093
+ readonly capabilityBundles: InMemoryCapabilityBundleCoordinator;
3094
+ private projects;
3095
+ constructor(capabilityBundles?: InMemoryCapabilityBundleCoordinator);
3096
+ private initDefaultData;
3097
+ private getKey;
3098
+ getProjectsByWorkspace(tenantId: string, workspaceId: string): Promise<Project[]>;
3099
+ getProjectById(tenantId: string, id: string): Promise<Project | null>;
3100
+ createProject(tenantId: string, workspaceId: string, id: string, data: CreateProjectRequest): Promise<Project>;
3101
+ /**
3102
+ * Update an existing project
3103
+ *
3104
+ * @remarks
3105
+ * - The `config` field uses **replace** semantics: if provided, it completely
3106
+ * overwrites the existing config. To preserve the current config, omit this field.
3107
+ */
3108
+ updateProject(tenantId: string, id: string, updates: UpdateProjectRequest): Promise<Project | null>;
3109
+ deleteProject(tenantId: string, id: string): Promise<boolean>;
3110
+ updateCapabilityBundleIds(tenantId: string, projectId: string, bundleIds: string[], expectedRevisions?: Record<string, string>): Promise<UpdateProjectCapabilityBundlesResult>;
3111
+ isCapabilityBundleReferenced(tenantId: string, bundleId: string): Promise<boolean>;
3112
+ /** Checks bundle references synchronously for in-process atomic coordination. */
3113
+ isCapabilityBundleReferencedSync(tenantId: string, bundleId: string): boolean;
3114
+ clear(): void;
3115
+ }
3116
+
3117
+ /**
3118
+ * Stores tenant-isolated capability bundles in process memory.
3119
+ *
3120
+ * Values are cloned on write and read so callers cannot mutate persisted
3121
+ * middleware configuration through retained nested references.
3122
+ *
3123
+ * @example
3124
+ * ```ts
3125
+ * const store = new InMemoryCapabilityBundleStore(projectStore);
3126
+ * const bundle = await store.create("tenant-1", input);
3127
+ * ```
3128
+ */
3129
+ declare class InMemoryCapabilityBundleStore implements CapabilityBundleStore {
3130
+ private readonly projectStore;
3131
+ private readonly coordinator;
3132
+ private readonly bundles;
3133
+ /** Creates an in-memory bundle store coordinated with its Project store. */
3134
+ constructor(projectStore: InMemoryProjectStore, coordinator?: InMemoryCapabilityBundleCoordinator);
3135
+ private key;
3136
+ private hasKey;
3137
+ listByTenant(tenantId: string): Promise<CapabilityBundle[]>;
3138
+ getById(tenantId: string, id: string): Promise<CapabilityBundle | null>;
3139
+ getManyByIds(tenantId: string, ids: string[]): Promise<CapabilityBundle[]>;
3140
+ create(tenantId: string, input: InternalCreateCapabilityBundleInput): Promise<CapabilityBundle>;
3141
+ update(tenantId: string, id: string, input: InternalUpdateCapabilityBundleInput): Promise<CapabilityBundle | {
3142
+ status: "conflict";
3143
+ } | null>;
3144
+ deleteIfUnreferenced(tenantId: string, id: string): Promise<CapabilityBundleDeleteResult>;
3145
+ }
3146
+
3014
3147
  /**
3015
3148
  * FileSystemSkillStore
3016
3149
  *
@@ -3427,10 +3560,10 @@ declare class InMemoryChannelInstallationStore implements ChannelInstallationSto
3427
3560
  *
3428
3561
  * @param tenantId - Tenant identifier
3429
3562
  * @param installationId - Unique installation ID (caller-defined)
3430
- * @param data - {@link CreateChannelInstallationRequest} containing channel type, name, config, and fallback settings
3563
+ * @param data - {@link CreateChannelInstallationInput} containing channel type, name, config, and fallback settings
3431
3564
  * @returns The created {@link ChannelInstallation}
3432
3565
  */
3433
- createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
3566
+ createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationInput): Promise<ChannelInstallation>;
3434
3567
  /**
3435
3568
  * Updates an existing channel installation. Config fields are shallow-merged.
3436
3569
  *
@@ -3491,6 +3624,14 @@ declare class InMemoryChannelInstallationStore implements ChannelInstallationSto
3491
3624
 
3492
3625
  declare class InMemoryBindingStore implements BindingRegistry {
3493
3626
  private bindings;
3627
+ private createTail;
3628
+ findById(tenantId: string, id: string): Promise<Binding | null>;
3629
+ findBySubject(params: {
3630
+ tenantId: string;
3631
+ channel: string;
3632
+ channelInstallationId: string;
3633
+ senderId: string;
3634
+ }): Promise<Binding | null>;
3494
3635
  /**
3495
3636
  * Resolves a binding for the given sender across a specific channel installation.
3496
3637
  *
@@ -3522,34 +3663,27 @@ declare class InMemoryBindingStore implements BindingRegistry {
3522
3663
  * @returns The updated {@link Binding}
3523
3664
  * @throws {Error} If the binding does not exist
3524
3665
  */
3525
- update(id: string, patch: Partial<Binding>): Promise<Binding>;
3666
+ update(tenantId: string, id: string, patch: BindingMutablePatch): Promise<Binding>;
3526
3667
  /**
3527
3668
  * Deletes a binding by ID.
3528
3669
  *
3529
3670
  * @param id - Binding ID
3530
3671
  */
3531
- delete(id: string): Promise<void>;
3672
+ delete(tenantId: string, id: string): Promise<void>;
3532
3673
  /**
3533
3674
  * Lists bindings filtered by tenant and optional channel/agent/installation.
3534
3675
  *
3535
3676
  * @param params - Filter and pagination parameters
3536
3677
  * @returns Array of matching {@link Binding} objects
3537
3678
  */
3538
- list(params: {
3539
- channel?: string;
3540
- agentId?: string;
3541
- tenantId: string;
3542
- channelInstallationId?: string;
3543
- limit?: number;
3544
- offset?: number;
3545
- }): Promise<Binding[]>;
3679
+ list(params: BindingListParams): Promise<Binding[]>;
3546
3680
  /**
3547
3681
  * Bulk-imports bindings.
3548
3682
  *
3549
3683
  * @param bindings - Array of {@link CreateBindingInput}
3550
3684
  * @returns Array of created {@link Binding} objects
3551
3685
  */
3552
- import(bindings: CreateBindingInput[]): Promise<Binding[]>;
3686
+ import(tenantId: string, bindings: CreateBindingInput[]): Promise<Binding[]>;
3553
3687
  /**
3554
3688
  * Exports all bindings for a tenant.
3555
3689
  *
@@ -3593,18 +3727,21 @@ declare class InMemoryA2AApiKeyStore implements A2AApiKeyStore {
3593
3727
  declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
3594
3728
  private messages;
3595
3729
  private messageIdCounter;
3730
+ private capacityTail;
3596
3731
  private generateId;
3597
3732
  private getMessagesForThread;
3733
+ private inScope;
3598
3734
  addMessage(params: AddMessageParams): Promise<PendingMessage>;
3735
+ addMessageIfCapacity(params: AddMessageParams, maxSize: number): Promise<boolean>;
3599
3736
  addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
3600
- getPendingMessages(threadId: string): Promise<PendingMessage[]>;
3601
- getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
3602
- getQueueSize(threadId: string): Promise<number>;
3737
+ getPendingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
3738
+ getProcessingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
3739
+ getQueueSize(threadId: string, scope?: QueueScope): Promise<number>;
3603
3740
  getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
3604
- removeMessage(messageId: string): Promise<boolean>;
3605
- clearMessages(threadId: string): Promise<void>;
3606
- markProcessing(messageId: string): Promise<void>;
3607
- resetProcessingToPending(threadId: string): Promise<number>;
3741
+ removeMessage(messageId: string, scope?: QueueScope): Promise<boolean>;
3742
+ clearMessages(threadId: string, scope?: QueueScope): Promise<void>;
3743
+ markProcessing(messageId: string, customRunConfig?: unknown, scope?: QueueScope): Promise<void>;
3744
+ resetProcessingToPending(threadId: string, scope?: QueueScope): Promise<number>;
3608
3745
  }
3609
3746
 
3610
3747
  /**
@@ -3622,6 +3759,16 @@ declare class InMemoryTaskStore implements TaskStore {
3622
3759
  private cloneTask;
3623
3760
  private nextUpdatedAt;
3624
3761
  private canAdvanceUpdatedAt;
3762
+ /**
3763
+ * Runs a synchronous operation only while the exact task mutation snapshot matches.
3764
+ *
3765
+ * @param tenantId Tenant identifier.
3766
+ * @param id Task identifier.
3767
+ * @param snapshot Exact task mutation snapshot.
3768
+ * @param operation Synchronous operation run without an await boundary.
3769
+ * @returns Operation result, or `null` when the snapshot differs.
3770
+ */
3771
+ runIfSnapshot<T>(tenantId: string, id: string, snapshot: TaskMutationSnapshot, operation: () => T): T | null;
3625
3772
  private recognizedUpdates;
3626
3773
  private applyUpdates;
3627
3774
  /**
@@ -3641,6 +3788,8 @@ declare class InMemoryTaskStore implements TaskStore {
3641
3788
  * List tasks matching filter criteria
3642
3789
  */
3643
3790
  list(filter: TaskListFilter): Promise<TaskItem[]>;
3791
+ /** Lists dependent tasks in an exact project scope. */
3792
+ listDependents(query: TaskDependentListQuery): Promise<TaskItem[]>;
3644
3793
  /**
3645
3794
  * Update an existing task
3646
3795
  */
@@ -3659,12 +3808,16 @@ declare class InMemoryTaskStore implements TaskStore {
3659
3808
  updateIfStatusNotIn(tenantId: string, id: string, updates: UpdateTaskRequest, blockedStatuses: TaskItem["status"][]): Promise<TaskItem | null>;
3660
3809
  /** Atomically update a task only when status and updatedAt match a read snapshot. */
3661
3810
  updateIfStatusAndUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string): Promise<TaskItem | null>;
3811
+ /** Atomically update only while status, timestamp, owner, and Project scope match. */
3812
+ updateIfSnapshot(tenantId: string, id: string, updates: UpdateTaskRequest, snapshot: TaskMutationSnapshot): Promise<TaskItem | null>;
3662
3813
  /** Atomically update a child only when both child and parent snapshots match. */
3663
3814
  updateIfStatusUpdatedAtAndParentUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string, parentId: string, expectedParentUpdatedAt: Date | string): Promise<TaskItem | null>;
3664
3815
  /**
3665
3816
  * Delete a task by ID
3666
3817
  */
3667
3818
  delete(tenantId: string, id: string): Promise<boolean>;
3819
+ /** Atomically delete only while status, timestamp, owner, and Project scope match. */
3820
+ deleteIfSnapshot(tenantId: string, id: string, snapshot: TaskMutationSnapshot): Promise<boolean>;
3668
3821
  /**
3669
3822
  * Clear all tasks for a tenant (useful for testing)
3670
3823
  */
@@ -3724,6 +3877,357 @@ declare class InMemoryMenuStore implements MenuRegistry {
3724
3877
  clear(): void;
3725
3878
  }
3726
3879
 
3880
+ /** Error raised when a room-scoped idempotency key already identifies another in-memory message. */
3881
+ declare class DuplicateProjectRoomMessageIdempotencyKeyError extends Error {
3882
+ /**
3883
+ * Creates a duplicate room message idempotency key error.
3884
+ *
3885
+ * @param tenantId - Tenant in which the key is already present.
3886
+ * @param roomId - Room in which the key is already present.
3887
+ * @param idempotencyKey - Conflicting room-scoped idempotency key.
3888
+ */
3889
+ constructor(tenantId: string, roomId: string, idempotencyKey: string);
3890
+ }
3891
+ interface InMemoryProjectRoomTransaction {
3892
+ getRoom(tenantId: string, projectId: string): ProjectRoom | undefined;
3893
+ setRoom(room: ProjectRoom): void;
3894
+ getMembership(tenantId: string, id: string): ProjectMembership | undefined;
3895
+ getMemberships(): ProjectMembership[];
3896
+ setMembership(membership: ProjectMembership): void;
3897
+ getBotMembership(tenantId: string, id: string): ProjectBotMembership | undefined;
3898
+ getBotMembershipByAssistant(tenantId: string, projectId: string, assistantId: string): ProjectBotMembership | undefined;
3899
+ getBotMemberships(): ProjectBotMembership[];
3900
+ setBotMembership(membership: ProjectBotMembership): void;
3901
+ getMessage(tenantId: string, id: string): ProjectRoomMessage | undefined;
3902
+ getMessageByIdempotency(tenantId: string, roomId: string, idempotencyKey: string): ProjectRoomMessage | undefined;
3903
+ getMessages(): ProjectRoomMessage[];
3904
+ setMessage(message: ProjectRoomMessage): void;
3905
+ nextTimestamp(previous?: Date): Date;
3906
+ }
3907
+ /**
3908
+ * Coordinates atomic access to in-memory project-room aggregate state.
3909
+ *
3910
+ * Stores sharing this coordinator serialize all reads and writes through a
3911
+ * callback-scoped transaction. Transaction access expires when the callback
3912
+ * settles, preventing callers from retaining unlocked state access. The same
3913
+ * transaction can be extended with bot and message operations as those stores
3914
+ * join the aggregate.
3915
+ *
3916
+ * @example
3917
+ * ```ts
3918
+ * const coordinator = new InMemoryProjectRoomCoordinator();
3919
+ * const rooms = new InMemoryProjectRoomStore(coordinator);
3920
+ * const memberships = new InMemoryProjectMembershipStore(coordinator);
3921
+ * ```
3922
+ */
3923
+ declare class InMemoryProjectRoomCoordinator {
3924
+ private readonly clock;
3925
+ private mutation;
3926
+ private readonly rooms;
3927
+ private readonly memberships;
3928
+ private readonly botMemberships;
3929
+ private readonly botMembershipIdsByAssistant;
3930
+ private readonly messages;
3931
+ private readonly messageIdsByIdempotency;
3932
+ /**
3933
+ * Creates a coordinator.
3934
+ *
3935
+ * @param clock - Clock used to timestamp aggregate entities. It must return a valid finite `Date`.
3936
+ */
3937
+ constructor(clock?: () => Date);
3938
+ /**
3939
+ * Runs one operation under the aggregate's exclusive mutation lock.
3940
+ *
3941
+ * @param operation - Work receiving transaction-scoped, clone-safe state access.
3942
+ * @returns The operation result after releasing the lock.
3943
+ * @remarks The transaction throws if used after the callback settles, including after rejection.
3944
+ */
3945
+ runExclusive<T>(operation: (transaction: InMemoryProjectRoomTransaction) => T | Promise<T>): Promise<T>;
3946
+ }
3947
+
3948
+ /**
3949
+ * Stores canonical, tenant-isolated project main rooms in process memory.
3950
+ *
3951
+ * @example
3952
+ * ```ts
3953
+ * const store = new InMemoryProjectRoomStore();
3954
+ * const room = await store.ensureMainRoom(input);
3955
+ * ```
3956
+ */
3957
+ declare class InMemoryProjectRoomStore implements ProjectRoomStore {
3958
+ private readonly coordinator;
3959
+ /**
3960
+ * Creates a room store backed by an aggregate coordinator.
3961
+ *
3962
+ * @param coordinator - Coordinator shared with related project-room stores.
3963
+ */
3964
+ constructor(coordinator?: InMemoryProjectRoomCoordinator);
3965
+ /**
3966
+ * Creates the main room when absent and returns the canonical room.
3967
+ *
3968
+ * @param input - Candidate identity and presentation for the project's main room.
3969
+ * @returns A defensive copy of the canonical main room.
3970
+ */
3971
+ ensureMainRoom(input: {
3972
+ id: string;
3973
+ tenantId: string;
3974
+ workspaceId: string;
3975
+ projectId: string;
3976
+ name: string;
3977
+ }): Promise<ProjectRoom>;
3978
+ /**
3979
+ * Finds a tenant-scoped project's canonical main room.
3980
+ *
3981
+ * @param tenantId - Tenant owning the project.
3982
+ * @param projectId - Project whose room is requested.
3983
+ * @returns A defensive room copy, or `null` when none exists.
3984
+ */
3985
+ getMainRoom(tenantId: string, projectId: string): Promise<ProjectRoom | null>;
3986
+ }
3987
+
3988
+ /**
3989
+ * Stores tenant-isolated human project memberships in process memory.
3990
+ *
3991
+ * Membership lists are deterministic: records are ordered by `joinedAt` ASC,
3992
+ * then by `id` ASC. Mutations share the project-room coordinator lock.
3993
+ *
3994
+ * @example
3995
+ * ```ts
3996
+ * const coordinator = new InMemoryProjectRoomCoordinator();
3997
+ * const store = new InMemoryProjectMembershipStore(coordinator);
3998
+ * await store.createInitialOwner(input);
3999
+ * ```
4000
+ */
4001
+ declare class InMemoryProjectMembershipStore implements ProjectMembershipStore {
4002
+ private readonly coordinator;
4003
+ /**
4004
+ * Creates a membership store backed by an aggregate coordinator.
4005
+ *
4006
+ * @param coordinator - Coordinator shared with related project-room stores.
4007
+ */
4008
+ constructor(coordinator?: InMemoryProjectRoomCoordinator);
4009
+ /**
4010
+ * Lists all retained memberships for one tenant-scoped project.
4011
+ *
4012
+ * @param tenantId - Tenant owning the project.
4013
+ * @param projectId - Project whose memberships are requested.
4014
+ * @returns Defensive copies ordered by `joinedAt` ASC, then `id` ASC.
4015
+ */
4016
+ list(tenantId: string, projectId: string): Promise<ProjectMembership[]>;
4017
+ /**
4018
+ * Finds one user's retained membership in a tenant-scoped project.
4019
+ *
4020
+ * @param tenantId - Tenant owning the project.
4021
+ * @param projectId - Project to search.
4022
+ * @param userId - User whose membership is requested.
4023
+ * @returns A defensive membership copy, or `null` when absent.
4024
+ */
4025
+ findByUser(tenantId: string, projectId: string, userId: string): Promise<ProjectMembership | null>;
4026
+ /**
4027
+ * Creates a membership while enforcing tenant/project/user and tenant/ID uniqueness.
4028
+ *
4029
+ * @param input - Membership fields excluding coordinator-generated timestamps.
4030
+ * @returns A defensive copy of the created membership.
4031
+ */
4032
+ create(input: Omit<ProjectMembership, "joinedAt" | "updatedAt">): Promise<ProjectMembership>;
4033
+ /**
4034
+ * Atomically creates the first active owner for an empty project.
4035
+ *
4036
+ * @param input - Initial owner identity without generated role, status, or timestamps.
4037
+ * @returns `created`, an idempotent `existing`, or `already_initialized`.
4038
+ */
4039
+ createInitialOwner(input: Omit<ProjectMembership, "role" | "status" | "joinedAt" | "updatedAt">): Promise<{
4040
+ kind: "created" | "existing";
4041
+ membership: ProjectMembership;
4042
+ } | {
4043
+ kind: "already_initialized";
4044
+ }>;
4045
+ /**
4046
+ * Updates a membership role using tenant-scoped optimistic concurrency.
4047
+ *
4048
+ * @param input - Tenant, membership ID, target role, and expected revision.
4049
+ * @returns The update outcome, including conflict and final-owner protection.
4050
+ */
4051
+ updateRole(input: {
4052
+ tenantId: string;
4053
+ id: string;
4054
+ role: ProjectHumanRole;
4055
+ expectedUpdatedAt: Date;
4056
+ }): Promise<ProjectMembershipMutationResult>;
4057
+ /**
4058
+ * Marks a membership removed using tenant-scoped optimistic concurrency.
4059
+ *
4060
+ * @param input - Tenant, membership ID, and expected revision.
4061
+ * @returns The removal outcome, including conflict and final-owner protection.
4062
+ */
4063
+ remove(input: {
4064
+ tenantId: string;
4065
+ id: string;
4066
+ expectedUpdatedAt: Date;
4067
+ }): Promise<ProjectMembershipMutationResult>;
4068
+ private hasOtherActiveOwner;
4069
+ }
4070
+
4071
+ /** Error raised when a new bot membership reuses an existing tenant-scoped ID. */
4072
+ declare class ProjectBotMembershipIdConflictError extends Error {
4073
+ /**
4074
+ * Creates a bot membership ID conflict error.
4075
+ *
4076
+ * @param tenantId - Tenant in which the ID is already present.
4077
+ * @param id - Conflicting membership ID.
4078
+ */
4079
+ constructor(tenantId: string, id: string);
4080
+ }
4081
+ /**
4082
+ * Stores tenant-isolated project bot memberships in process memory.
4083
+ *
4084
+ * Durable assistant identity, coordinator role, and room mention constraints
4085
+ * are checked atomically through the shared project-room coordinator.
4086
+ *
4087
+ * @example
4088
+ * ```ts
4089
+ * const coordinator = new InMemoryProjectRoomCoordinator();
4090
+ * const store = new InMemoryProjectBotMembershipStore(coordinator);
4091
+ * await store.save(input);
4092
+ * ```
4093
+ */
4094
+ declare class InMemoryProjectBotMembershipStore implements ProjectBotMembershipStore {
4095
+ private readonly coordinator;
4096
+ /**
4097
+ * Creates a bot membership store backed by an aggregate coordinator.
4098
+ *
4099
+ * @param coordinator - Coordinator shared with related project-room stores.
4100
+ */
4101
+ constructor(coordinator?: InMemoryProjectRoomCoordinator);
4102
+ /**
4103
+ * Lists retained bot memberships for a tenant-scoped project.
4104
+ *
4105
+ * @param tenantId - Tenant owning the project.
4106
+ * @param projectId - Project whose roster is requested.
4107
+ * @returns Defensive copies ordered by `joinedAt` ASC, then `id` ASC.
4108
+ */
4109
+ list(tenantId: string, projectId: string): Promise<ProjectBotMembership[]>;
4110
+ /**
4111
+ * Finds a bot membership by its tenant-scoped ID.
4112
+ *
4113
+ * @param tenantId - Tenant owning the membership.
4114
+ * @param id - Membership ID.
4115
+ * @returns A defensive membership copy, or `null` when absent.
4116
+ */
4117
+ findById(tenantId: string, id: string): Promise<ProjectBotMembership | null>;
4118
+ /**
4119
+ * Finds the durable membership for an assistant in a tenant-scoped project.
4120
+ *
4121
+ * @param tenantId - Tenant owning the project.
4122
+ * @param projectId - Project to search.
4123
+ * @param assistantId - Assistant identity to find.
4124
+ * @returns A defensive membership copy, or `null` when absent.
4125
+ */
4126
+ findByAssistant(tenantId: string, projectId: string, assistantId: string): Promise<ProjectBotMembership | null>;
4127
+ /**
4128
+ * Saves a new membership or reactivates the assistant's durable membership.
4129
+ *
4130
+ * @param input - Candidate membership without coordinator-generated timestamps.
4131
+ * @returns The saved membership or a coordinator/mention uniqueness conflict.
4132
+ */
4133
+ save(input: Omit<ProjectBotMembership, "joinedAt" | "updatedAt">): Promise<{
4134
+ kind: "created" | "updated" | "reactivated";
4135
+ membership: ProjectBotMembership;
4136
+ } | {
4137
+ kind: "coordinator_conflict" | "mention_conflict";
4138
+ }>;
4139
+ /**
4140
+ * Updates mutable bot membership fields using tenant-scoped optimistic concurrency.
4141
+ *
4142
+ * @param input - Tenant, membership ID, exact field patch, and expected revision.
4143
+ * @returns The updated membership or the applicable lookup, revision, or uniqueness conflict.
4144
+ */
4145
+ update(input: {
4146
+ tenantId: string;
4147
+ id: string;
4148
+ patch: Partial<Pick<ProjectBotMembership, "role" | "title" | "responsibility" | "mentionName" | "status">>;
4149
+ expectedUpdatedAt: Date;
4150
+ }): Promise<{
4151
+ kind: "updated";
4152
+ membership: ProjectBotMembership;
4153
+ } | {
4154
+ kind: "not_found" | "conflict" | "coordinator_conflict" | "mention_conflict";
4155
+ }>;
4156
+ private findConstraintConflict;
4157
+ }
4158
+
4159
+ /** Error raised when a room message reuses an existing tenant-scoped ID. */
4160
+ declare class ProjectRoomMessageIdConflictError extends Error {
4161
+ /**
4162
+ * Creates a room message ID conflict error.
4163
+ *
4164
+ * @param tenantId - Tenant in which the ID is already present.
4165
+ * @param id - Conflicting message ID.
4166
+ */
4167
+ constructor(tenantId: string, id: string);
4168
+ }
4169
+ /**
4170
+ * Stores tenant-isolated project room messages in process memory.
4171
+ *
4172
+ * Message creation and room-scoped idempotency are serialized by the shared
4173
+ * project-room coordinator. Lists use stable newest-first cursor ordering.
4174
+ *
4175
+ * @example
4176
+ * ```ts
4177
+ * const store = new InMemoryProjectRoomMessageStore();
4178
+ * const created = await store.create(input);
4179
+ * ```
4180
+ */
4181
+ declare class InMemoryProjectRoomMessageStore implements ProjectRoomMessageStore {
4182
+ private readonly coordinator;
4183
+ /**
4184
+ * Creates a message store backed by an aggregate coordinator.
4185
+ *
4186
+ * @param coordinator - Coordinator shared with related project-room stores.
4187
+ */
4188
+ constructor(coordinator?: InMemoryProjectRoomCoordinator);
4189
+ /**
4190
+ * Creates a project room message.
4191
+ *
4192
+ * @param input - Message fields excluding the coordinator-generated timestamp.
4193
+ * @returns A defensive copy of the created message.
4194
+ */
4195
+ create(input: Omit<ProjectRoomMessage, "createdAt">): Promise<ProjectRoomMessage>;
4196
+ /**
4197
+ * Creates or returns the canonical message for a tenant/room idempotency key.
4198
+ *
4199
+ * @param input - Message candidate and required room-scoped idempotency key.
4200
+ * @returns A defensive copy of the original or newly created message.
4201
+ */
4202
+ createIdempotent(input: Omit<ProjectRoomMessage, "createdAt"> & {
4203
+ idempotencyKey: string;
4204
+ }): Promise<ProjectRoomMessage>;
4205
+ /**
4206
+ * Lists room messages using stable newest-first pagination.
4207
+ *
4208
+ * @param input - Tenant/room scope, optional exclusive cursor, and requested limit.
4209
+ * @returns Defensive message copies ordered by `createdAt` DESC, then `id` DESC; limit is clamped to 1..100.
4210
+ */
4211
+ list(input: {
4212
+ tenantId: string;
4213
+ roomId: string;
4214
+ before?: {
4215
+ createdAt: Date;
4216
+ id: string;
4217
+ };
4218
+ limit: number;
4219
+ }): Promise<ProjectRoomMessage[]>;
4220
+ /**
4221
+ * Finds a message by its tenant-scoped ID.
4222
+ *
4223
+ * @param tenantId - Tenant owning the message.
4224
+ * @param id - Message ID.
4225
+ * @returns A defensive message copy, or `null` when absent.
4226
+ */
4227
+ findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
4228
+ private createInTransaction;
4229
+ }
4230
+
3727
4231
  /**
3728
4232
  * Embeddings Lattice Interface
3729
4233
  * Defines the structure of an embeddings lattice entry
@@ -4440,14 +4944,56 @@ declare function getBuiltInSkillNames(): string[];
4440
4944
  * Check if a skill name refers to a built-in skill.
4441
4945
  */
4442
4946
  declare function isBuiltInSkill(name: string): boolean;
4947
+
4948
+ declare const SAFE_PATH_COMPONENT: RegExp;
4949
+ /**
4950
+ * Ensure a versioned plugin skill bundle is available in a runtime sandbox.
4951
+ *
4952
+ * @param sandbox - Runtime sandbox receiving the bundle files.
4953
+ * @param pluginType - Plugin that owns the skill.
4954
+ * @param skillName - Skill name used for its sandbox directory.
4955
+ * @param definition - Versioned markdown and text-resource bundle.
4956
+ * @param lockKey - Stable skills-volume identity, normally the tenant ID. Calls
4957
+ * sharing a skills volume must use the same value; different tenants must use
4958
+ * different values.
4959
+ * @returns A promise that resolves after the bundle and manifest are written.
4960
+ *
4961
+ * @example
4962
+ * ```ts
4963
+ * await ensurePluginSkillInSandbox(
4964
+ * sandbox,
4965
+ * "acme",
4966
+ * "acme-guide",
4967
+ * {
4968
+ * version: "1.2.0",
4969
+ * content: "---\nname: acme-guide\ndescription: Acme usage\n---\n",
4970
+ * resources: {
4971
+ * "templates/request.json": { content: '{"method":"POST"}' },
4972
+ * },
4973
+ * },
4974
+ * "agent-runtime"
4975
+ * );
4976
+ * ```
4977
+ */
4978
+ declare function ensurePluginSkillInSandbox(sandbox: SandboxInstance, pluginType: string, skillName: string, definition: PluginSkillDefinition, lockKey: string): Promise<void>;
4443
4979
  /**
4444
- * Register a skill as a built-in skill at runtime.
4445
- * Used by PluginRegistry to expose plugin procedural skills
4446
- * through the same unified API as static built-in skills.
4980
+ * Check whether a sandbox skill directory is owned by the plugin synchronizer.
4447
4981
  *
4448
- * Duplicate registrations are ignored (first wins).
4982
+ * @param sandbox - Runtime sandbox containing the skill manifest.
4983
+ * @param skillName - Skill directory name to inspect.
4984
+ * @returns True when the manifest identifies the skill as plugin-managed.
4985
+ */
4986
+ declare function isPluginSkillManagedInSandbox(sandbox: SandboxInstance, skillName: string): Promise<boolean>;
4987
+ /** Check whether a manifest-owned skill has the expected live plugin owner. */
4988
+ declare function isPluginSkillAuthorizedInSandbox(sandbox: SandboxInstance, skillName: string, pluginType: string): Promise<boolean>;
4989
+ /** Return the synchronized manifest version for a skill, if plugin-managed. */
4990
+ declare function getPluginSkillManifestVersion(sandbox: SandboxInstance, skillName: string): Promise<string | undefined>;
4991
+ /**
4992
+ * Keep every path component safe for the shell-interpolated Daytona mkdir
4993
+ * command: ASCII letters, digits, dot, underscore, and hyphen only; no empty,
4994
+ * dot, or parent components, separators, whitespace, or shell metacharacters.
4449
4995
  */
4450
- declare function registerBuiltinSkill(name: string, content: string): void;
4996
+ declare function validateRelativePath(value: string, kind: string): void;
4451
4997
 
4452
4998
  /**
4453
4999
  * CollectionLatticeManager
@@ -4488,7 +5034,7 @@ declare function buildTableName(tenantId: string, name: string): string;
4488
5034
  /**
4489
5035
  * Get or create a tenant-isolated VectorStore for a collection.
4490
5036
  */
4491
- declare function getOrCreateCollectionVectorStore(name: string, embeddingKey: string, tenantId: string, providerKey?: string): Promise<any>;
5037
+ declare function getOrCreateCollectionVectorStore(name: string, embeddingKey: string, tenantId: string, providerKey?: string): Promise<VectorStore>;
4492
5038
  /**
4493
5039
  * Get entry count for a collection.
4494
5040
  * Tries vector store's native method first, falls back to provider.
@@ -5058,6 +5604,24 @@ declare class MicrosandboxRemoteInstance implements SandboxInstance {
5058
5604
  stop(): Promise<void>;
5059
5605
  kill(): Promise<void>;
5060
5606
  getStatus(): Promise<"running" | "stopped" | "unknown">;
5607
+ /**
5608
+ * Pack a sandbox folder into a sibling ZIP through the microsandbox shell.
5609
+ *
5610
+ * The command runs inside the POSIX container, so mounted volume-backed
5611
+ * folders are packed from their on-disk location just like any other sandbox
5612
+ * folder. Paths use the external virtual convention (`/project/...`) and the
5613
+ * command is cwd-independent because the microsandbox shell service does not
5614
+ * honor `exec_dir`. The returned archive path can be downloaded and deleted
5615
+ * through the existing file service.
5616
+ *
5617
+ * @param sourcePath - Sandbox-visible absolute source folder path rooted at `/project`
5618
+ * @returns The sibling archive path, download filename, and exact byte size
5619
+ */
5620
+ packDirectory(sourcePath: string): Promise<{
5621
+ path: string;
5622
+ filename: string;
5623
+ size?: number;
5624
+ }>;
5061
5625
  readonly file: SandboxFileService;
5062
5626
  readonly shell: SandboxShellService;
5063
5627
  }
@@ -5074,10 +5638,129 @@ declare class RemoteSandboxInstance implements SandboxInstance {
5074
5638
  stop(): Promise<void>;
5075
5639
  kill(): Promise<void>;
5076
5640
  getStatus(): Promise<"running" | "stopped" | "unknown">;
5641
+ /**
5642
+ * Pack a sandbox folder into a sibling ZIP through the remote shell service.
5643
+ *
5644
+ * The command runs inside the remote POSIX sandbox, so mounted volume-backed
5645
+ * folders are packed from their on-disk location just like any other sandbox
5646
+ * folder. The returned archive path is the sandbox-visible sibling (e.g.
5647
+ * `/project/data/reports.zip`) and can be downloaded and deleted through the
5648
+ * existing file service.
5649
+ *
5650
+ * @param sourcePath - Sandbox-visible absolute source folder path rooted at `/project`
5651
+ * @returns The sibling archive path, download filename, and exact byte size
5652
+ */
5653
+ packDirectory(sourcePath: string): Promise<{
5654
+ path: string;
5655
+ filename: string;
5656
+ size?: number;
5657
+ }>;
5077
5658
  readonly file: SandboxFileService;
5078
5659
  readonly shell: SandboxShellService;
5079
5660
  }
5080
5661
 
5662
+ /**
5663
+ * Shared packing policy for `SandboxInstance.packDirectory`.
5664
+ *
5665
+ * Local and remote sandbox instances agree on the same source-path contract
5666
+ * (must be rooted at `/project`, no traversal, no backslashes) and the same
5667
+ * entry/size limits. Remote instances additionally run the whole safe shell
5668
+ * strategy (in-shell preflight, exclusive sibling lock, randomized temporary
5669
+ * directory, trap cleanup, atomic no-clobber finalize) through their existing
5670
+ * shell service, because Node cannot open a sandbox file handle remotely.
5671
+ */
5672
+ declare const MAX_PACK_ENTRIES = 10000;
5673
+ declare const MAX_PACK_FILE_BYTES: number;
5674
+ declare const MAX_PACK_TOTAL_BYTES: number;
5675
+ /** Maximum wall-clock time for one remote/local folder pack shell invocation. */
5676
+ declare const PACK_DIRECTORY_TIMEOUT_SECONDS: number;
5677
+ /** Result of validating a pack source path. */
5678
+ interface PackSourceInfo {
5679
+ /** Basename of the source folder, e.g. `reports`. */
5680
+ rootName: string;
5681
+ /** Download archive name, e.g. `reports.zip`. */
5682
+ filename: string;
5683
+ /** Sandbox-visible sibling archive path, e.g. `/project/data/reports.zip`. */
5684
+ archivePath: string;
5685
+ }
5686
+ /**
5687
+ * Validate a sandbox folder path that may be packed.
5688
+ *
5689
+ * Accepts only absolute paths rooted at `/project` (the project root) with no
5690
+ * empty/`.`/`..` components and no backslashes. Rejects anything else with a
5691
+ * descriptive error before any shell command is sent.
5692
+ *
5693
+ * @param sourcePath - Sandbox-visible absolute source folder path
5694
+ * @returns Derived source basename, archive filename, and sibling archive path
5695
+ * @example
5696
+ * ```ts
5697
+ * const { rootName, filename, archivePath } = validatePackSourcePath("/project/data/reports");
5698
+ * // rootName: "reports", filename: "reports.zip", archivePath: "/project/data/reports.zip"
5699
+ * ```
5700
+ */
5701
+ declare function validatePackSourcePath(sourcePath: string): PackSourceInfo;
5702
+ /**
5703
+ * Build the complete `/bin/sh` command that packs one sandbox folder.
5704
+ *
5705
+ * The command is cwd-independent: it `cd`s to `parentDir` and packs
5706
+ * `./<sourceName>` into a randomized sibling temporary directory, so it works
5707
+ * both through `shell.execCommand({ exec_dir })` and through shells that ignore
5708
+ * `exec_dir` entirely. It performs a metadata-only preflight (no file content
5709
+ * reads) that rejects symlinks, FIFO/socket/device entries, entry-count
5710
+ * overflow, and per-file/total size overflow before invoking `zip`. The final
5711
+ * archive is committed with an atomic hard-link `ln` so an existing sibling
5712
+ * (file, directory, or symlink) is never overwritten, and an exclusive `mkdir`
5713
+ * lock plus an `EXIT` trap remove only artifacts owned by this invocation. The
5714
+ * last stdout line reports the exact archive size as `PACK_SIZE=<bytes>`.
5715
+ *
5716
+ * The command targets `/bin/sh` with the common Linux find extensions used by
5717
+ * GNU and busybox (`-print0`, the `c` byte suffix for `-size`); it is not
5718
+ * guaranteed to run on other POSIX-only `sh` implementations. The sandbox
5719
+ * image must provide `zip` (Info-ZIP) on `PATH`.
5720
+ *
5721
+ * @param parentDir - Absolute physical path of the source folder's parent
5722
+ * @param sourceName - Source folder basename
5723
+ * @param archiveName - Archive filename (`<sourceName>.zip`)
5724
+ * @returns A `/bin/sh`-compatible command string
5725
+ * @example
5726
+ * ```ts
5727
+ * buildRemotePackDirectoryCommand("/workspace/project/data", "reports", "reports.zip");
5728
+ * ```
5729
+ */
5730
+ declare function buildRemotePackDirectoryCommand(parentDir: string, sourceName: string, archiveName: string): string;
5731
+ /**
5732
+ * Extract the exact packed archive byte size from a remote pack command output.
5733
+ *
5734
+ * @param output - Combined shell stdout/stderr
5735
+ * @returns The archive size in bytes, or `undefined` when the command did not
5736
+ * report one (for example when preflight or `zip` failed)
5737
+ */
5738
+ declare function parsePackSize(output: string): number | undefined;
5739
+ /**
5740
+ * Run a remote `packDirectory` through a shell service.
5741
+ *
5742
+ * Validates the source path, executes the shared safe shell-zip command from
5743
+ * `physicalParentDir`, and returns the sandbox-visible sibling archive path,
5744
+ * download filename, and exact byte size parsed from the shell output. Errors
5745
+ * (invalid source, preflight failure, `zip` failure, missing size) throw with a
5746
+ * descriptive message.
5747
+ *
5748
+ * @param shell - Sandbox shell service that executes the command remotely
5749
+ * @param sourcePath - Sandbox-visible absolute source folder path
5750
+ * @param physicalParentDir - Physical absolute parent directory of the source on
5751
+ * the remote host (already resolved for the instance's path convention)
5752
+ * @returns The packed archive location and metadata
5753
+ * @example
5754
+ * ```ts
5755
+ * const packed = await runRemotePackDirectory(instance.shell, "/project/data/reports", "/workspace/project/data");
5756
+ * ```
5757
+ */
5758
+ declare function runRemotePackDirectory(shell: SandboxShellService, sourcePath: string, physicalParentDir: string): Promise<{
5759
+ path: string;
5760
+ filename: string;
5761
+ size: number;
5762
+ }>;
5763
+
5081
5764
  declare class E2BInstance implements SandboxInstance {
5082
5765
  private native;
5083
5766
  readonly name: string;
@@ -5123,6 +5806,11 @@ declare class LocalSandboxInstance implements SandboxInstance {
5123
5806
  stop(): Promise<void>;
5124
5807
  kill(): Promise<void>;
5125
5808
  getStatus(): Promise<"running" | "stopped" | "unknown">;
5809
+ packDirectory(sourcePath: string): Promise<{
5810
+ path: string;
5811
+ filename: string;
5812
+ size?: number;
5813
+ }>;
5126
5814
  readonly file: SandboxFileService;
5127
5815
  readonly shell: SandboxShellService;
5128
5816
  private walkDir;
@@ -7024,13 +7712,294 @@ declare class AgentManager {
7024
7712
  }, return_agent_state?: boolean): Promise<unknown>;
7025
7713
  }
7026
7714
 
7027
- /** Execution state of a thread. */
7028
- declare enum ThreadStatus {
7715
+ /** Exact tenant, workspace, Project, and Room coordinates for roster authorization. */
7716
+ interface ProjectTaskRosterScope {
7717
+ tenantId: string;
7718
+ workspaceId: string;
7719
+ projectId: string;
7720
+ roomId: string;
7721
+ }
7722
+ /** Exact caller and target roster identities required for a Project task assignment. */
7723
+ interface ProjectTaskAssignmentScope extends ProjectTaskRosterScope {
7724
+ callerMembershipId: string;
7725
+ callerAssistantId: string;
7726
+ targetMembershipId: string;
7727
+ targetAssistantId: string;
7728
+ }
7729
+ /** Stable authorization denial codes emitted by the Project task owner policy. */
7730
+ type ProjectTaskOwnerPolicyCode = "PROJECT_TASK_CALLER_INACTIVE" | "PROJECT_TASK_OWNER_INACTIVE";
7731
+ /** Stable authorization failure that does not expose membership-store details. */
7732
+ declare class ProjectTaskOwnerPolicyError extends Error {
7733
+ readonly code: ProjectTaskOwnerPolicyCode;
7734
+ /**
7735
+ * Creates a stable Project task roster authorization failure.
7736
+ *
7737
+ * @param code Machine-readable caller or owner denial code.
7738
+ * @param message Generic denial description safe to expose to callers.
7739
+ */
7740
+ constructor(code: ProjectTaskOwnerPolicyCode, message: string);
7741
+ }
7742
+ /**
7743
+ * Requires Project task callers and owners to be active members of one exact durable roster.
7744
+ *
7745
+ * Store values are treated as untrusted boundary data and snapshotted without invoking
7746
+ * accessors before identity or scope checks are performed.
7747
+ *
7748
+ * @example
7749
+ * ```ts
7750
+ * const policy = createProjectTaskOwnerPolicy();
7751
+ * const { caller, target } = await policy.requireAssignment(scope);
7752
+ * ```
7753
+ */
7754
+ declare class ProjectTaskOwnerPolicy {
7755
+ private readonly memberships;
7756
+ /**
7757
+ * Creates a policy backed by the Project bot membership protocol.
7758
+ *
7759
+ * @param memberships Minimal durable roster lookup methods used by the policy.
7760
+ */
7761
+ constructor(memberships: Pick<ProjectBotMembershipStore, "findById" | "findByAssistant">);
7762
+ /**
7763
+ * Requires the current caller to be active under its exact membership, Assistant, and scope.
7764
+ *
7765
+ * @param input Exact roster scope plus caller identity.
7766
+ * @returns A descriptor-safe snapshot of the active caller membership.
7767
+ */
7768
+ requireCaller(input: ProjectTaskRosterScope & {
7769
+ callerMembershipId: string;
7770
+ callerAssistantId: string;
7771
+ }): Promise<ProjectBotMembership>;
7772
+ /**
7773
+ * Requires the target owner to be active under its exact membership, Assistant, and scope.
7774
+ *
7775
+ * @param input Exact roster scope plus target identity.
7776
+ * @returns A descriptor-safe snapshot of the active target membership.
7777
+ */
7778
+ requireOwner(input: ProjectTaskRosterScope & {
7779
+ targetMembershipId: string;
7780
+ targetAssistantId: string;
7781
+ }): Promise<ProjectBotMembership>;
7782
+ /**
7783
+ * Requires both sides of an assignment, validating the caller before accessing the target.
7784
+ *
7785
+ * @param input Exact roster scope and both membership/Assistant identities.
7786
+ * @returns Descriptor-safe active caller and target membership snapshots.
7787
+ */
7788
+ requireAssignment(input: ProjectTaskAssignmentScope): Promise<{
7789
+ caller: ProjectBotMembership;
7790
+ target: ProjectBotMembership;
7791
+ }>;
7792
+ }
7793
+ /**
7794
+ * Creates the default Project task owner policy from Store Lattice.
7795
+ *
7796
+ * @returns A policy using only the `default:projectBotMembership` store.
7797
+ * @remarks Register the default Project bot membership store before calling this factory.
7798
+ */
7799
+ declare function createProjectTaskOwnerPolicy(): ProjectTaskOwnerPolicy;
7800
+
7801
+ declare const reassignmentAuthorizationBrand: unique symbol;
7802
+ /** Opaque host-issued proof that a Project task reassignment boundary was validated. */
7803
+ interface ProjectTaskReassignmentAuthorization {
7804
+ readonly [reassignmentAuthorizationBrand]: true;
7805
+ }
7806
+ /** Exact assignment and Task Thread coordinates validated by a trusted host. */
7807
+ interface ProjectTaskReassignmentAuthorizationInput {
7808
+ tenantId: string;
7809
+ workspaceId: string;
7810
+ projectId: string;
7811
+ roomId: string;
7812
+ taskId: string;
7813
+ callerMembershipId: string;
7814
+ callerAssistantId: string;
7815
+ targetMembershipId: string;
7816
+ targetAssistantId: string;
7817
+ expectedThreadId?: string;
7818
+ newThreadId: string;
7819
+ }
7820
+ /** Input supplied to the host's durable Task Thread validator. */
7821
+ interface ProjectTaskReassignmentThreadValidationInput extends ProjectTaskReassignmentAuthorizationInput {
7822
+ caller: ProjectBotMembership;
7823
+ target: ProjectBotMembership;
7824
+ }
7825
+ /** Host-owned validation function for reassignment Thread identity and scope. */
7826
+ type ProjectTaskReassignmentThreadValidator = (input: ProjectTaskReassignmentThreadValidationInput) => Promise<void>;
7827
+ /** Trusted host API that issues opaque reassignment authorization tokens. */
7828
+ interface ProjectTaskReassignmentAuthorizer {
7829
+ /** Validates current roster and Thread truth, then issues a process-local opaque token. */
7830
+ authorize(input: ProjectTaskReassignmentAuthorizationInput): Promise<ProjectTaskReassignmentAuthorization>;
7831
+ }
7832
+ /**
7833
+ * Creates a trusted host reassignment authorizer.
7834
+ *
7835
+ * @param policy Exact active-roster policy used caller-first.
7836
+ * @param threadValidator Host validator for the proposed Task Thread metadata.
7837
+ * @returns An authorizer that emits process-local opaque tokens after both validations succeed.
7838
+ * @remarks Tokens are process-local capabilities. Distributed deployments must authorize and execute
7839
+ * under their machine/project mutex and accept the residual membership race across processes.
7840
+ */
7841
+ declare function createProjectTaskReassignmentAuthorizer(policy: ProjectTaskOwnerPolicy, threadValidator: ProjectTaskReassignmentThreadValidator): ProjectTaskReassignmentAuthorizer;
7842
+
7843
+ /**
7844
+ * Immutable data identifying one committed canonical Project task lifecycle transition.
7845
+ *
7846
+ * @remarks `eventKey` identifies the persisted WorkItem and `updatedAt` identifies the winning task snapshot.
7847
+ */
7848
+ interface TaskLifecycleNotification {
7849
+ tenantId: string;
7850
+ workspaceId: string;
7851
+ projectId: string;
7852
+ taskId: string;
7853
+ threadId?: string;
7854
+ status: TaskItem["status"];
7855
+ action: ProjectTaskLifecycleAction;
7856
+ eventKey: string;
7857
+ updatedAt: string;
7858
+ }
7859
+ /**
7860
+ * Async observer invoked for a canonical Project task lifecycle transition.
7861
+ *
7862
+ * @param event Isolated own-data snapshot for one committed transition.
7863
+ * @returns A promise settled when listener processing is complete.
7864
+ */
7865
+ type TaskLifecycleListener = (event: TaskLifecycleNotification) => void | Promise<void>;
7866
+ /**
7867
+ * Publishes descriptor-safe lifecycle snapshots to an isolated listener snapshot.
7868
+ *
7869
+ * @example
7870
+ * ```ts
7871
+ * const unsubscribe = taskLifecycleNotifier.subscribe(async (event) => project(event));
7872
+ * unsubscribe();
7873
+ * ```
7874
+ *
7875
+ * @remarks Listener failures are collected so every listener receives the event. A rejected
7876
+ * publish reports failure to the lifecycle caller but cannot undo the committed transition.
7877
+ * Delivery is strict FIFO per tenant/task. Subscribers must bound their own work because publish
7878
+ * intentionally awaits every listener settlement before the next event for that task can start.
7879
+ */
7880
+ declare class TaskLifecycleNotifier {
7881
+ private readonly listeners;
7882
+ private readonly tails;
7883
+ /**
7884
+ * Registers an async lifecycle listener.
7885
+ *
7886
+ * @param listener Observer to invoke for later publications.
7887
+ * @returns An idempotent unsubscribe callback.
7888
+ */
7889
+ subscribe(listener: TaskLifecycleListener): () => void;
7890
+ /**
7891
+ * Awaits all listeners with independent copies of one validated event snapshot.
7892
+ *
7893
+ * @param event Canonical transition identity to publish.
7894
+ * @returns A promise that resolves after every listener succeeds.
7895
+ * @throws Error when the event is malformed or one or more listeners reject.
7896
+ */
7897
+ publish(event: TaskLifecycleNotification): Promise<void>;
7898
+ private deliver;
7899
+ }
7900
+ /** Process-global notifier used by every lifecycle service unless explicitly injected. */
7901
+ declare const taskLifecycleNotifier: TaskLifecycleNotifier;
7902
+
7903
+ /** Exact canonical identity of one newly committed pending Agent Project task. */
7904
+ interface ProjectTaskAdmissionNotification {
7905
+ tenantId: string;
7906
+ workspaceId: string;
7907
+ projectId: string;
7908
+ taskId: string;
7909
+ ownerId: string;
7910
+ updatedAt: string;
7911
+ }
7912
+ /**
7913
+ * Observer invoked with an isolated canonical Project task admission snapshot.
7914
+ *
7915
+ * @param event Exact newly persisted Agent Project task identity.
7916
+ * @returns Nothing or a promise that settles when listener admission is accepted.
7917
+ */
7918
+ type ProjectTaskAdmissionListener = (event: ProjectTaskAdmissionNotification, signal: AbortSignal) => void | Promise<void>;
7919
+ /** Delivery bounds for process-local Project task admission hints. */
7920
+ interface ProjectTaskAdmissionNotifierOptions {
7921
+ listenerTimeoutMs?: number;
7922
+ }
7923
+ /**
7924
+ * Publishes process-local hints that newly persisted Agent Project tasks need reconciliation.
7925
+ *
7926
+ * @remarks Delivery is FIFO per Tenant/Task and awaits every listener settlement. Callers that
7927
+ * persist tasks must invoke `publish` fire-and-forget and contain rejection because this hint is
7928
+ * not durable lifecycle authority.
7929
+ */
7930
+ declare class ProjectTaskAdmissionNotifier {
7931
+ private readonly listeners;
7932
+ private readonly tails;
7933
+ private readonly listenerTimeoutMs;
7934
+ /**
7935
+ * Creates a bounded Project task admission notifier.
7936
+ *
7937
+ * @param options Optional positive listener timeout; defaults to five seconds.
7938
+ */
7939
+ constructor(options?: ProjectTaskAdmissionNotifierOptions);
7940
+ /**
7941
+ * Registers a Project task admission listener.
7942
+ *
7943
+ * @param listener Observer to invoke for later publications.
7944
+ * @returns An idempotent unsubscribe callback.
7945
+ */
7946
+ subscribe(listener: ProjectTaskAdmissionListener): () => void;
7947
+ /**
7948
+ * Publishes one validated Project task admission snapshot.
7949
+ *
7950
+ * @param event Canonical committed task identity to publish.
7951
+ * @returns A promise settled after every snapshotted listener settles.
7952
+ */
7953
+ publish(event: ProjectTaskAdmissionNotification): Promise<void>;
7954
+ private deliver;
7955
+ private deliverTo;
7956
+ }
7957
+ /** Process-global Project task admission notifier used by governed creation paths. */
7958
+ declare const projectTaskAdmissionNotifier: ProjectTaskAdmissionNotifier;
7959
+
7960
+ /** Exact Tenant and Project scope for collaboration mutations. */
7961
+ interface ProjectMutationScope {
7962
+ tenantId: string;
7963
+ projectId: string;
7964
+ }
7965
+ /**
7966
+ * Process-local FIFO mutex shared by every Core and Gateway Project mutation path.
7967
+ *
7968
+ * @remarks
7969
+ * When an operation needs both a Project task machine mutex and this mutex, it
7970
+ * must acquire the machine mutex first. Project-only membership, roster, human,
7971
+ * and ordinary Task mutations acquire only this mutex.
7972
+ */
7973
+ declare class ProjectMutationMutex {
7974
+ private readonly queues;
7975
+ private readonly active;
7976
+ /** Runs one mutation after all earlier mutations for the same Tenant and Project. */
7977
+ runExclusive<T>(scope: ProjectMutationScope, operation: () => Promise<T>, signal?: AbortSignal): Promise<T>;
7978
+ /** Returns the number of operations queued behind the current holder. */
7979
+ pending(scope: ProjectMutationScope): number;
7980
+ private acquire;
7981
+ private release;
7982
+ }
7983
+ /** Process-global Project mutation mutex shared by Core tools and Gateway services. */
7984
+ declare const projectMutationMutex: ProjectMutationMutex;
7985
+
7986
+ /** Package-private capability used by trusted host dispatch infrastructure. */
7987
+ declare const TRUSTED_AGENT_DISPATCH: unique symbol;
7988
+
7989
+ /** Execution state of a thread. */
7990
+ declare enum ThreadStatus {
7029
7991
  IDLE = "idle",
7030
7992
  BUSY = "busy",
7031
7993
  INTERRUPTED = "interrupted",
7032
7994
  ERROR = "error"
7033
7995
  }
7996
+ /** Result of attempting to recover a persisted checkpoint. */
7997
+ interface ResumeTaskResult {
7998
+ /** Graph status observed after the recovery attempt. */
7999
+ status: ThreadStatus;
8000
+ /** Whether processing rows are settled and pending queue work may continue. */
8001
+ settled: boolean;
8002
+ }
7034
8003
  /**
7035
8004
  * Snapshot of a thread's current state including queue and status.
7036
8005
  *
@@ -7079,8 +8048,8 @@ interface QueueMessage {
7079
8048
  modified_at: string;
7080
8049
  }>;
7081
8050
  };
7082
- command?: CommandParams<any>;
7083
- custom_run_config?: any;
8051
+ command?: CommandParams<unknown>;
8052
+ custom_run_config?: unknown;
7084
8053
  }
7085
8054
  /** Emitted when a thread transitions between {@link ThreadStatus} values. */
7086
8055
  interface ThreadStatusChangedEvent {
@@ -7144,6 +8113,43 @@ interface MessageFailedEvent {
7144
8113
  error: string;
7145
8114
  timestamp: Date;
7146
8115
  }
8116
+ /**
8117
+ * Emitted when a message was interrupted mid-execution (e.g. graph interrupt
8118
+ * waiting for human input or tool approval).
8119
+ *
8120
+ * The `state` snapshot captures the LangGraph state at the point of interruption.
8121
+ */
8122
+ interface MessageInterruptedEvent {
8123
+ type: 'message:interrupted';
8124
+ messageId: string;
8125
+ timestamp: Date;
8126
+ duration?: number;
8127
+ state?: any;
8128
+ }
8129
+ /**
8130
+ * Emitted once after an Agent execution reaches normal idle completion with a fresh text reply.
8131
+ *
8132
+ * `inputMessageId` is the primary delivery correlation ID. `consumedInputMessageIds` lists every
8133
+ * queue input settled by the execution, including all inputs in a COLLECT batch. The stable
8134
+ * `outputMessageId` is always `reply:${inputMessageId}`; provider/model IDs are diagnostic only.
8135
+ *
8136
+ * @remarks
8137
+ * Phase 2 replaces the earlier provider-ID delivery contract. Consumers must deduplicate delivery
8138
+ * with `outputMessageId`, clean correlation state with `consumedInputMessageIds`, and must not infer
8139
+ * reply text from `state`. This is an accepted pre-release breaking contract change.
8140
+ *
8141
+ * @since Phase 2 pre-release
8142
+ */
8143
+ interface ReplyReadyEvent {
8144
+ type: 'reply:ready';
8145
+ timestamp: Date;
8146
+ inputMessageId: string;
8147
+ consumedInputMessageIds: string[];
8148
+ outputMessageId: string;
8149
+ providerOutputMessageId?: string;
8150
+ outputText: string;
8151
+ state: unknown;
8152
+ }
7147
8153
  /** Emitted when the thread has drained its queue and returned to idle. */
7148
8154
  interface ThreadIdleEvent {
7149
8155
  type: 'thread:idle';
@@ -7167,6 +8173,11 @@ interface QueuePendingEvent {
7167
8173
  isHighPriority: boolean;
7168
8174
  }
7169
8175
 
8176
+ /** Raised when immediate delegated worker authority is passed to a persistent queue. */
8177
+ declare class DelegatedScopeNotQueueableError extends Error {
8178
+ readonly code: "DELEGATED_SCOPE_NOT_QUEUEABLE";
8179
+ constructor();
8180
+ }
7170
8181
  /**
7171
8182
  * Parameters that uniquely identify an agent thread instance.
7172
8183
  *
@@ -7177,8 +8188,8 @@ interface AgentThreadInterface {
7177
8188
  assistant_id: string;
7178
8189
  thread_id: string;
7179
8190
  tenant_id: string;
7180
- workspace_id?: string;
7181
- project_id?: string;
8191
+ workspace_id?: string | null;
8192
+ project_id?: string | null;
7182
8193
  custom_run_config?: any;
7183
8194
  }
7184
8195
  /**
@@ -7233,14 +8244,21 @@ declare class Agent {
7233
8244
  private stateChecker;
7234
8245
  private chunkBuffer;
7235
8246
  private abortController;
8247
+ private queueProcessorPromise?;
7236
8248
  assistant_id: string;
7237
8249
  thread_id: string;
7238
8250
  tenant_id: string;
7239
8251
  workspace_id: string;
7240
8252
  project_id: string;
8253
+ private queue_workspace_id;
8254
+ private queue_project_id;
7241
8255
  custom_run_config: any;
7242
8256
  queueMode: ThreadQueueConfig;
7243
- private isWaitingForQueueEnd;
8257
+ private queueProcessorRetryTimer?;
8258
+ private queueProcessorRetryAttempt;
8259
+ private queueProcessorGeneration;
8260
+ private queueWakeRequested;
8261
+ private recoveryBlockedKey?;
7244
8262
  asyncTasks: AsyncTaskRecord[];
7245
8263
  /**
7246
8264
  * Constructs an Agent instance.
@@ -7251,7 +8269,25 @@ declare class Agent {
7251
8269
  * @param params - {@link AgentThreadInterface}
7252
8270
  */
7253
8271
  constructor({ assistant_id, thread_id, tenant_id, workspace_id, project_id, custom_run_config, }: AgentThreadInterface);
8272
+ /**
8273
+ * Accepts host-authenticated queue metadata through the package-private symbol capability.
8274
+ *
8275
+ * @param queueMessage - Public message payload to sanitize and enqueue.
8276
+ * @param options - Trusted context and execution mode supplied by privileged host code.
8277
+ * @returns The asynchronous queue acceptance result.
8278
+ */
8279
+ [TRUSTED_AGENT_DISPATCH](queueMessage: QueueMessage, options: TrustedMessageOptions): Promise<AddMessageResult>;
8280
+ private rejectDelegatedQueueAuthority;
8281
+ private validateTrustedRunContext;
8282
+ private processingExecutionContext;
8283
+ private pendingExecutionContext;
8284
+ private processingRowKey;
8285
+ private blockRecovery;
8286
+ private clearRecoveryBlock;
8287
+ private rethrowClaimedExecutionError;
8288
+ private executionRunConfig;
7254
8289
  private getHumanPendingContent;
8290
+ private queuedInputMessages;
7255
8291
  /**
7256
8292
  * Initialize with message queue store
7257
8293
  */
@@ -7276,13 +8312,16 @@ declare class Agent {
7276
8312
  chunkStream(message_id: string, stopTypes?: MessageChunkType[]): {
7277
8313
  [Symbol.asyncIterator]: () => AsyncGenerator<MessageChunk, void, unknown>;
7278
8314
  };
7279
- getLatticeClientAndRuntimeConfig(custom_run_config?: any): Promise<{
8315
+ private buildExecutionRunConfig;
8316
+ getLatticeClientAndRuntimeConfig(custom_run_config?: unknown, expectedRevision?: string): Promise<{
7280
8317
  runnable_agent: AgentClient;
7281
- runConfig: any;
8318
+ runConfig: Record<string, unknown>;
7282
8319
  }>;
8320
+ private getLatticeClient;
7283
8321
  invoke(queueMessage: QueueMessage, signal?: AbortSignal): Promise<{
7284
8322
  messages: any;
7285
8323
  }>;
8324
+ private validateMessageInput;
7286
8325
  /**
7287
8326
  * Like {@link invoke} but returns the full LangGraph state (all annotations)
7288
8327
  * instead of only messages. Messages are serialized to dicts; other state
@@ -7305,7 +8344,10 @@ declare class Agent {
7305
8344
  }[];
7306
8345
  }>;
7307
8346
  private agentExecutor;
8347
+ private interruptedCommandExecutionContext;
8348
+ private interruptedCommandCapabilityRevision;
7308
8349
  getPendingMessages(): Promise<PendingMessage[]>;
8350
+ private queueScope;
7309
8351
  private agentStreamExecutor;
7310
8352
  private consumeAgentStream;
7311
8353
  /**
@@ -7349,9 +8391,8 @@ declare class Agent {
7349
8391
  * **Format**: Supports both `input.message` (legacy string) and `input.messages[]`
7350
8392
  * (array of `{ role, content }` objects). The array form takes precedence.
7351
8393
  *
7352
- * The `custom_run_config` field is round-tripped through the queue and emitted
7353
- * back in {@link ReplyReadyEvent}, enabling callers to attach routing metadata
7354
- * (e.g. `_replyTarget` for channel reply).
8394
+ * Safe caller `custom_run_config` fields are round-tripped through queue execution only.
8395
+ * They are not exposed by {@link ReplyReadyEvent}; reserved host metadata keys are stripped.
7355
8396
  *
7356
8397
  * @param queueMessage - The message to enqueue
7357
8398
  * @param mode - Optional queue mode override (defaults to thread's current mode)
@@ -7361,15 +8402,12 @@ declare class Agent {
7361
8402
  * ```ts
7362
8403
  * await agent.addMessage({
7363
8404
  * input: { message: "Hello" },
7364
- * custom_run_config: { _replyTarget: { adapterChannel: "lark", rawTarget: { chatId: "xxx" } } },
8405
+ * custom_run_config: { requestId: "request-1" },
7365
8406
  * });
7366
8407
  * ```
7367
8408
  */
7368
- addMessage(queueMessage: QueueMessage, mode?: QueueMode): Promise<{
7369
- queued: boolean;
7370
- messageId: string;
7371
- executed: boolean;
7372
- }>;
8409
+ addMessage(queueMessage: QueueMessage, mode?: QueueMode): Promise<AddMessageResult>;
8410
+ private enqueueMessage;
7373
8411
  /**
7374
8412
  * Start the queue processor if it is not already running.
7375
8413
  *
@@ -7380,6 +8418,11 @@ declare class Agent {
7380
8418
  * loop with a fresh {@link AbortController}.
7381
8419
  */
7382
8420
  startQueueProcessorIfNeeded(): Promise<void>;
8421
+ private startQueueProcessor;
8422
+ private finishQueueProcessor;
8423
+ private scheduleQueueProcessorRetry;
8424
+ private cancelQueueProcessorRetry;
8425
+ private runQueueProcessor;
7383
8426
  /**
7384
8427
  * Remove pending message
7385
8428
  */
@@ -7415,9 +8458,10 @@ declare class Agent {
7415
8458
  * Checks LangGraph's `state.tasks` for interrupts and `state.next` for
7416
8459
  * pending steps.
7417
8460
  *
8461
+ * @param state - Optional authoritative snapshot to classify without rereading the graph.
7418
8462
  * @returns {@link ThreadStatus} — `IDLE`, `BUSY`, or `INTERRUPTED`
7419
8463
  */
7420
- getRunStatus(): Promise<ThreadStatus>;
8464
+ getRunStatus(state?: unknown): Promise<ThreadStatus>;
7421
8465
  /**
7422
8466
  * Resume processing after a server restart.
7423
8467
  *
@@ -7427,13 +8471,17 @@ declare class Agent {
7427
8471
  * rather than replayed.
7428
8472
  *
7429
8473
  * Skips threads that are in `INTERRUPTED` state (the interruption was
7430
- * intentional). IDLE threads simply clean up and restart the queue
7431
- * processor for any remaining pending messages.
8474
+ * intentional). IDLE and ERROR threads settle their durable processing rows
8475
+ * before starting the queue processor for any remaining pending messages.
7432
8476
  *
7433
8477
  * Called during gateway startup to recover threads that were mid-execution
7434
8478
  * when the server went down.
8479
+ *
8480
+ * @returns The authoritative graph status after recovery. `BUSY` and
8481
+ * `INTERRUPTED` mean the processing rows remain authoritative and pending
8482
+ * queue work must not start; `IDLE` and `ERROR` mean those rows were settled.
7435
8483
  */
7436
- resumeTask(): Promise<void>;
8484
+ resumeTask(): Promise<ResumeTaskResult>;
7437
8485
  /**
7438
8486
  * Fully abort all activity on this thread.
7439
8487
  *
@@ -7506,6 +8554,118 @@ declare class Agent {
7506
8554
  updateAsyncTaskStatus(taskId: string, status: AsyncTaskRecord['status']): void;
7507
8555
  }
7508
8556
 
8557
+ /**
8558
+ * Privileged in-process boundary for dispatching messages with host-authenticated metadata.
8559
+ *
8560
+ * @remarks
8561
+ * In-process host imports are trusted deployment code. This boundary prevents remote,
8562
+ * model, and tool callers from acquiring trusted metadata authority; it does not defend
8563
+ * against hostile JavaScript installed in the host process.
8564
+ */
8565
+ interface TrustedAgentMessageDispatcher {
8566
+ /**
8567
+ * Dispatches a queue message with validated host metadata.
8568
+ *
8569
+ * @param scope - Agent thread scope resolved by the host.
8570
+ * @param message - Public queue message payload.
8571
+ * @param options - Trusted metadata and execution behavior.
8572
+ * @returns The Agent queue acceptance result.
8573
+ */
8574
+ dispatch(scope: AgentThreadInterface, message: QueueMessage, options: TrustedMessageOptions): Promise<AddMessageResult>;
8575
+ }
8576
+ /**
8577
+ * Creates the privileged dispatcher used by host-owned orchestration services.
8578
+ *
8579
+ * @param resolve - Resolves the Agent instance for an authoritative thread scope.
8580
+ * @returns A dispatcher that invokes Agent's package-private symbol capability.
8581
+ */
8582
+ declare function createTrustedAgentMessageDispatcher(resolve: (scope: AgentThreadInterface) => Agent): TrustedAgentMessageDispatcher;
8583
+
8584
+ /** Fully scoped input for a trusted Agent-authored project room message. */
8585
+ interface RoomAgentMessageInput {
8586
+ tenantId: string;
8587
+ workspaceId: string;
8588
+ projectId: string;
8589
+ roomId: string;
8590
+ membershipId: string;
8591
+ assistantId: string;
8592
+ text: string;
8593
+ sourceRoomMessageId: string;
8594
+ sourceId: string;
8595
+ idempotencyKey: string;
8596
+ }
8597
+ /** Minimal correlated reply input whose scope is derived from validated durable rows. */
8598
+ interface RoomAgentReplyInput {
8599
+ tenantId: string;
8600
+ membershipId: string;
8601
+ text: string;
8602
+ sourceRoomMessageId: string;
8603
+ inputMessageId: string;
8604
+ sourceId: string;
8605
+ idempotencyKey: string;
8606
+ }
8607
+ /**
8608
+ * Observes a canonical Agent-authored room message after durable persistence.
8609
+ *
8610
+ * @param message Detached clone of the canonical persisted message.
8611
+ * @returns Nothing, or a promise whose rejection is contained by the writer.
8612
+ */
8613
+ type RoomAgentMessageCommitted = (message: ProjectRoomMessage) => void | Promise<void>;
8614
+ /**
8615
+ * Reports a contained post-commit observer failure without exposing message content.
8616
+ *
8617
+ * @param event Safe canonical message ID and fixed failure code.
8618
+ * @returns Nothing; reporter exceptions are also contained by the writer.
8619
+ */
8620
+ type RoomAgentMessageCallbackFailure = (event: {
8621
+ messageId: string;
8622
+ code: "ROOM_MESSAGE_COMMIT_CALLBACK_FAILED";
8623
+ }) => void;
8624
+ /**
8625
+ * Persists Agent-authored room messages across strict, untrusted store boundaries.
8626
+ *
8627
+ * Inputs are synchronously snapshotted without invoking accessors. Source messages,
8628
+ * memberships, and canonical create results must be exact plain data records.
8629
+ *
8630
+ * @example
8631
+ * ```ts
8632
+ * const writer = new RoomAgentMessageService({ memberships, messages });
8633
+ * await writer.post(input);
8634
+ * ```
8635
+ */
8636
+ declare class RoomAgentMessageService {
8637
+ private readonly deps;
8638
+ /**
8639
+ * Creates a room writer over the durable membership and message stores.
8640
+ *
8641
+ * @param deps Store methods, optional deterministic ID factory, and detached post-commit hooks.
8642
+ */
8643
+ constructor(deps: {
8644
+ memberships: Pick<ProjectBotMembershipStore, "findById">;
8645
+ messages: Pick<ProjectRoomMessageStore, "findById" | "createIdempotent">;
8646
+ idFactory?: () => string;
8647
+ onMessageCommitted?: RoomAgentMessageCommitted;
8648
+ onCallbackFailure?: RoomAgentMessageCallbackFailure;
8649
+ });
8650
+ /**
8651
+ * Persists a fully scoped Agent response after validating its human source and active membership.
8652
+ *
8653
+ * @param input Exact trusted scope and response payload.
8654
+ * @returns A deep clone of the canonical idempotent room message.
8655
+ */
8656
+ post(input: RoomAgentMessageInput): Promise<ProjectRoomMessage>;
8657
+ /**
8658
+ * Persists a channel reply while deriving all scope from validated durable records.
8659
+ *
8660
+ * @param input Exact correlation IDs, tenant, target membership, and response text.
8661
+ * @returns A deep clone of the canonical idempotent room message.
8662
+ */
8663
+ postReply(input: RoomAgentReplyInput): Promise<ProjectRoomMessage>;
8664
+ private persistDerived;
8665
+ private persist;
8666
+ private notifyCommitted;
8667
+ }
8668
+
7509
8669
  /**
7510
8670
  * Agent Instance Manager
7511
8671
  *
@@ -7561,8 +8721,8 @@ declare const agentInstanceManager: AgentInstanceManager;
7561
8721
  * A single structured belief report attached to a task completion.
7562
8722
  *
7563
8723
  * Mirrors the `manage_task.beliefImpact` tool field: the reporting task claims
7564
- * that, after execution, the named Belief Key is true with `after` percent
7565
- * probability, supported by `basis` evidence.
8724
+ * that, after execution, the named Belief Key has `after` percent evidence
8725
+ * support, accompanied by a qualitative status and evidence in `basis`.
7566
8726
  */
7567
8727
  interface BeliefImpactInput {
7568
8728
  key: string;
@@ -7582,6 +8742,7 @@ interface LifecycleWarning {
7582
8742
  type LifecycleResult = {
7583
8743
  success: true;
7584
8744
  task: TaskItem;
8745
+ mutated: boolean;
7585
8746
  evidenceId?: string;
7586
8747
  eventKey?: string;
7587
8748
  warnings?: LifecycleWarning[];
@@ -7594,11 +8755,33 @@ type LifecycleResult = {
7594
8755
  eventKey?: string;
7595
8756
  warnings?: LifecycleWarning[];
7596
8757
  };
8758
+ /**
8759
+ * Exact winner metadata returned only by {@link TaskLifecycleService.startTask}.
8760
+ *
8761
+ * @remarks `transitioned` is true only for the invocation that won the pending snapshot CAS.
8762
+ */
8763
+ type StartLifecycleResult = {
8764
+ success: true;
8765
+ task: TaskItem;
8766
+ mutated: boolean;
8767
+ transitioned: boolean;
8768
+ eventKey?: string;
8769
+ warnings?: LifecycleWarning[];
8770
+ } | {
8771
+ success: false;
8772
+ transitioned: false;
8773
+ code: string;
8774
+ error: string;
8775
+ hint?: string;
8776
+ eventKey?: string;
8777
+ warnings?: LifecycleWarning[];
8778
+ };
7597
8779
  /** Stores and clock used by {@link TaskLifecycleService}. */
7598
8780
  interface TaskLifecycleServiceDeps {
7599
8781
  taskStore: TaskStore;
7600
8782
  workItemStore: TaskWorkItemStore;
7601
8783
  now?: () => Date;
8784
+ notifier?: TaskLifecycleNotifier;
7602
8785
  }
7603
8786
  /** Input shared by direct completion and completion repair. */
7604
8787
  interface AgentTaskCompletionInput {
@@ -7680,6 +8863,22 @@ interface InterruptTaskInput {
7680
8863
  summary: string;
7681
8864
  actor: string;
7682
8865
  threadId?: string;
8866
+ /** Required exact task IDs when the interruption waits on external dependencies. */
8867
+ dependencyTaskIds?: string[];
8868
+ }
8869
+ /** Parsed, canonical external-dependency interruption persisted by the lifecycle service. */
8870
+ interface ExternalDependencyInterruption {
8871
+ type: "external_dependency";
8872
+ summary: string;
8873
+ requestedAt: string;
8874
+ dependencyTaskIds: string[];
8875
+ }
8876
+ /** Exact roster, task, and Thread coordinates for a governed Project task reassignment. */
8877
+ interface ReassignProjectTaskInput {
8878
+ tenantId: string;
8879
+ taskId: string;
8880
+ authorization: ProjectTaskReassignmentAuthorization;
8881
+ actor: string;
7683
8882
  }
7684
8883
  /** Canonical identity and Belief State snapshot bound to completion evidence. */
7685
8884
  interface BeliefOwnerSnapshot {
@@ -7702,6 +8901,23 @@ interface BeliefOwnerSnapshot {
7702
8901
  };
7703
8902
  parentUpdatedAt?: string;
7704
8903
  }
8904
+ /**
8905
+ * Returns whether a task belongs to the trusted, nondefault Project lifecycle.
8906
+ *
8907
+ * @param task Task snapshot whose durable scope and trusted origin are inspected.
8908
+ * @returns True only for nondefault Project Room or Project Task origins.
8909
+ */
8910
+ declare function isProjectLifecycleTask(task: TaskItem): task is TaskItem & {
8911
+ workspaceId: string;
8912
+ projectId: string;
8913
+ };
8914
+ /**
8915
+ * Parses a descriptor-safe canonical external-dependency interruption.
8916
+ *
8917
+ * @param value Untrusted persisted interruption value.
8918
+ * @returns A cloned interruption with trimmed unique IDs, or undefined when malformed.
8919
+ */
8920
+ declare function parseExternalDependency(value: unknown): ExternalDependencyInterruption | undefined;
7705
8921
  /**
7706
8922
  * Owns atomic agent-task completion, review, repair, and belief reconciliation.
7707
8923
  *
@@ -7717,6 +8933,7 @@ interface BeliefOwnerSnapshot {
7717
8933
  declare class TaskLifecycleService {
7718
8934
  private readonly deps;
7719
8935
  private readonly now;
8936
+ private readonly notifier;
7720
8937
  /**
7721
8938
  * Creates a lifecycle service with injected stores and an optional test clock.
7722
8939
  *
@@ -7746,11 +8963,13 @@ declare class TaskLifecycleService {
7746
8963
  /** Atomically fails an active agent task and records an idempotent status event. */
7747
8964
  failTask(input: FailTaskInput): Promise<LifecycleResult>;
7748
8965
  /** Atomically starts a pending agent task and records an idempotent status event. */
7749
- startTask(input: StartTaskInput): Promise<LifecycleResult>;
8966
+ startTask(input: StartTaskInput): Promise<StartLifecycleResult>;
7750
8967
  /** Atomically retries a failed agent task and records an idempotent status event. */
7751
8968
  retryTask(input: StartTaskInput): Promise<LifecycleResult>;
7752
8969
  /** Atomically cancels a nonterminal agent task and records an idempotent status event. */
7753
8970
  cancelTask(input: CancelTaskInput): Promise<LifecycleResult>;
8971
+ /** Atomically transfers a stopped Project task to another active roster owner and Task Thread. */
8972
+ reassignProjectTask(input: ReassignProjectTaskInput): Promise<LifecycleResult>;
7754
8973
  /** Atomically records a governed blocking interruption for an in-progress agent task. */
7755
8974
  interruptTask(input: InterruptTaskInput): Promise<LifecycleResult>;
7756
8975
  /**
@@ -7826,6 +9045,10 @@ declare class TaskLifecycleService {
7826
9045
  private transitionAgentTask;
7827
9046
  private statusEventKey;
7828
9047
  private writeStatusEvent;
9048
+ private notifyWinningTransition;
9049
+ private validateExternalDependencies;
9050
+ private externalDependencyReadiness;
9051
+ private finishExternalDependencyInterruption;
7829
9052
  private clearAuditMarker;
7830
9053
  private writeReviewActivity;
7831
9054
  private createEvent;
@@ -7840,6 +9063,85 @@ declare class TaskLifecycleService {
7840
9063
  */
7841
9064
  declare function createTaskLifecycleService(deps?: TaskLifecycleServiceDeps): TaskLifecycleService;
7842
9065
 
9066
+ /** Describes one isolated Agent invocation for persistent task execution. */
9067
+ interface TaskAgentInvocation {
9068
+ tenantId: string;
9069
+ workspaceId?: string;
9070
+ projectId?: string;
9071
+ taskId: string;
9072
+ agentId: string;
9073
+ threadId: string;
9074
+ message: string;
9075
+ /** Internal authority passed only to the delegated worker runtime. */
9076
+ delegatedTaskId: string;
9077
+ taskExecutionRole: "worker";
9078
+ }
9079
+ /** Injected persistence and Agent runtime dependencies for task execution. */
9080
+ interface TaskExecutionServiceDeps {
9081
+ taskStore: TaskStore;
9082
+ workItemStore: TaskWorkItemStore;
9083
+ invokeAgent: (input: TaskAgentInvocation) => Promise<unknown>;
9084
+ resolveAgent: (tenantId: string, agentId: string) => Promise<boolean>;
9085
+ createThreadId?: () => string;
9086
+ }
9087
+ /** Identifies a persistent task, target Agent, caller, and runtime scope. */
9088
+ interface StartTaskExecutionInput {
9089
+ tenantId: string;
9090
+ workspaceId?: string;
9091
+ projectId?: string;
9092
+ taskId: string;
9093
+ agentId: string;
9094
+ actor: string;
9095
+ callerThreadId?: string;
9096
+ }
9097
+ /** Successful isolated execution observation recorded for later reconciliation. */
9098
+ interface TaskExecutionSuccess {
9099
+ success: true;
9100
+ taskId: string;
9101
+ agentId: string;
9102
+ threadId: string;
9103
+ observation: unknown;
9104
+ executionResultId: string;
9105
+ warnings?: LifecycleWarning[];
9106
+ }
9107
+ /** Typed validation, lifecycle, or Agent invocation failure. */
9108
+ interface TaskExecutionFailure {
9109
+ success: false;
9110
+ code: string;
9111
+ error: string;
9112
+ taskId?: string;
9113
+ agentId?: string;
9114
+ threadId?: string;
9115
+ executionResultId?: string;
9116
+ blockedBy?: string[];
9117
+ invocationError?: string;
9118
+ warnings?: LifecycleWarning[];
9119
+ }
9120
+ /** Result returned by a persistent task execution attempt. */
9121
+ type TaskExecutionResult = TaskExecutionSuccess | TaskExecutionFailure;
9122
+ /**
9123
+ * Creates a synchronous persistent-task execution service from injected stores and Agent adapters.
9124
+ *
9125
+ * @param deps Task stores, target resolution, isolated invocation, and optional thread ID generation.
9126
+ * @returns A service whose `start` method validates, starts, dispatches, and records an observation.
9127
+ *
9128
+ * @example
9129
+ * ```ts
9130
+ * const service = createTaskExecutionService({ taskStore, workItemStore, resolveAgent, invokeAgent });
9131
+ * const result = await service.start({ tenantId, taskId, agentId, actor });
9132
+ * ```
9133
+ *
9134
+ * @remarks A returned observation is execution evidence only. This service never completes or fails the TaskItem.
9135
+ */
9136
+ declare function createTaskExecutionService(deps: TaskExecutionServiceDeps): {
9137
+ start: (input: StartTaskExecutionInput) => Promise<TaskExecutionResult>;
9138
+ };
9139
+
9140
+ /** Internal authority for immediate delegated worker execution. */
9141
+ declare const DELEGATED_WORKER_SCOPE_TOKEN: unique symbol;
9142
+ /** Reports whether a run configuration contains the private delegated token key. */
9143
+ declare function hasDelegatedWorkerToken(runConfig: Record<string, unknown> & Partial<Record<typeof DELEGATED_WORKER_SCOPE_TOKEN, unknown>>): boolean;
9144
+
7843
9145
  declare const AGENT_TASK_EVENT = "agent:execute";
7844
9146
 
7845
9147
  /**
@@ -7980,6 +9282,27 @@ declare class CustomMiddlewareRegistry {
7980
9282
  static list(): string[];
7981
9283
  }
7982
9284
 
9285
+ /**
9286
+ * Catalog metadata for a single registered plugin skill.
9287
+ * Used to expose plugin skills through the read-only system skill catalog.
9288
+ */
9289
+ interface PluginSkillCatalogItem {
9290
+ /** Skill id (plugin skill key). */
9291
+ id: string;
9292
+ /** Skill name parsed from SKILL.md frontmatter. */
9293
+ name: string;
9294
+ /** Skill description parsed from SKILL.md frontmatter. */
9295
+ description: string;
9296
+ /** Plugin skill bundle version. */
9297
+ version: string;
9298
+ /** Owning plugin type. */
9299
+ pluginType: string;
9300
+ /** Safe relative paths of bundled resources with their MIME types. */
9301
+ resourcePaths: Array<{
9302
+ path: string;
9303
+ mimeType?: string;
9304
+ }>;
9305
+ }
7983
9306
  /**
7984
9307
  * Plugin registry.
7985
9308
  *
@@ -7994,12 +9317,37 @@ declare class PluginRegistry {
7994
9317
  static unregister(key: string): boolean;
7995
9318
  /** Get plugin instance */
7996
9319
  static get(key: string): Plugin | undefined;
9320
+ /** Get a plugin skill definition and its owning plugin type. */
9321
+ static getSkill(name: string): {
9322
+ pluginType: string;
9323
+ definition: PluginSkillDefinition;
9324
+ } | undefined;
9325
+ /** Find the registered owner of the exact enabled skill definition. */
9326
+ static getSkillOwner(name: string, definition: PluginSkillDefinition): {
9327
+ pluginType: string;
9328
+ definition: PluginSkillDefinition;
9329
+ } | undefined;
9330
+ /** Find a skill using the explicitly enabled plugin owner. */
9331
+ static getSkillForPlugin(pluginType: string, name: string): {
9332
+ pluginType: string;
9333
+ definition: PluginSkillDefinition;
9334
+ } | undefined;
7997
9335
  /** Check if registered */
7998
9336
  static has(key: string): boolean;
7999
9337
  /** List all registered plugin keys */
8000
9338
  static list(): string[];
8001
9339
  /** Serialize all registered plugins to API-ready meta list */
8002
9340
  static listMeta(): PluginMetaOutput[];
9341
+ /**
9342
+ * Catalog metadata for all registered plugin skills, regardless of whether
9343
+ * the owning plugin is enabled for a given agent.
9344
+ *
9345
+ * Pure/synchronous — no sandbox, no tenant context. Name/description are
9346
+ * parsed from each SKILL.md definition's frontmatter.
9347
+ *
9348
+ * @returns Catalog entries keyed by plugin skill id.
9349
+ */
9350
+ static listSkills(): PluginSkillCatalogItem[];
8003
9351
  }
8004
9352
 
8005
9353
  /**
@@ -8014,10 +9362,76 @@ declare function serializePluginMeta(plugin: Plugin): PluginMetaOutput;
8014
9362
 
8015
9363
  declare const BUILTIN_PLUGINS: Plugin[];
8016
9364
 
9365
+ /** Stable failure codes emitted when capability bundles cannot be composed. */
9366
+ type CapabilityBundleMergeErrorCode = "CAPABILITY_BUNDLE_DUPLICATE_ID" | "CAPABILITY_BUNDLE_EMPTY_ALLOWED_TOOLS" | "CAPABILITY_BUNDLE_INVALID_CONFIG" | "CAPABILITY_BUNDLE_NULL_VALUE" | "CAPABILITY_BUNDLE_UNSAFE_KEY";
9367
+ /** Describes invalid capability bundle input rejected by the pure merger. */
9368
+ declare class CapabilityBundleMergeError extends Error {
9369
+ /** Stable machine-readable reason for the failure. */
9370
+ readonly code: CapabilityBundleMergeErrorCode;
9371
+ /** Bundle containing the invalid value, when known. */
9372
+ readonly bundleId?: string;
9373
+ /** Capability containing the invalid value, when known. */
9374
+ readonly capabilityType?: string;
9375
+ /** JSON Pointer path to the invalid capability field, when known. */
9376
+ readonly fieldPath?: string;
9377
+ /**
9378
+ * Creates a capability bundle composition error.
9379
+ *
9380
+ * @param code - Stable machine-readable failure code.
9381
+ * @param message - Human-readable failure description.
9382
+ * @param context - Structured location of the invalid input.
9383
+ */
9384
+ constructor(code: CapabilityBundleMergeErrorCode, message: string, context?: {
9385
+ bundleId?: string;
9386
+ capabilityType?: string;
9387
+ fieldPath?: string;
9388
+ });
9389
+ }
9390
+ /**
9391
+ * Composes ordered capability bundles into a detached runtime preview.
9392
+ *
9393
+ * Capability identity and display fields come from the first occurrence of a
9394
+ * type. Runtime fields are merged in bundle order with provenance and distinct
9395
+ * ordinary replacements recorded in the preview.
9396
+ *
9397
+ * @param bundles - Capability bundles in composition precedence order.
9398
+ * @returns A deterministic, detached capability preview.
9399
+ * @throws {CapabilityBundleMergeError} When bundle IDs repeat or consumed input contains null, empty tool selections, or unsafe keys.
9400
+ * @example
9401
+ * ```ts
9402
+ * const preview = mergeCapabilityBundles([baseBundle, projectBundle]);
9403
+ * ```
9404
+ * @remarks
9405
+ * Bundle order defines precedence: later explicit ordinary values replace earlier values.
9406
+ * Capability output order follows each type's first appearance.
9407
+ */
9408
+ declare function mergeCapabilityBundles(bundles: readonly CapabilityBundle[]): CapabilityPreview;
9409
+ /**
9410
+ * Stateless facade for composing capability bundles in dependency-injected services.
9411
+ *
9412
+ * @example
9413
+ * ```ts
9414
+ * const merger = new CapabilityBundleMerger();
9415
+ * const preview = merger.merge([baseBundle, projectBundle]);
9416
+ * ```
9417
+ * @remarks
9418
+ * Pass bundles in ascending precedence order. The facade retains no state between calls.
9419
+ */
9420
+ declare class CapabilityBundleMerger {
9421
+ /**
9422
+ * Composes ordered capability bundles.
9423
+ *
9424
+ * @param bundles - Capability bundles in composition precedence order.
9425
+ * @returns A deterministic, detached capability preview.
9426
+ * @remarks Later bundles take precedence while capability type order remains first-seen.
9427
+ */
9428
+ merge(bundles: readonly CapabilityBundle[]): CapabilityPreview;
9429
+ }
9430
+
8017
9431
  /**
8018
9432
  * Capability Learning Plugin
8019
9433
  *
8020
- * Provides a document-learner agent and learn-capability procedural skill.
9434
+ * Provides a document-learner agent and source-to-capability learning workflow.
8021
9435
  * The agent guides users through turning source material (documents, API
8022
9436
  * specs, conversations, spreadsheets) into structured skill systems with
8023
9437
  * evaluations — following a supervised learning paradigm.
@@ -8034,8 +9448,70 @@ declare const documentLearningPlugin: Plugin;
8034
9448
  * when connectAll is enabled.
8035
9449
  */
8036
9450
 
9451
+ /** Built-in Document Parser plugin definition. */
8037
9452
  declare const documentParserPlugin: Plugin;
8038
9453
 
9454
+ /**
9455
+ * Semantic Metrics Middleware & Plugin (connection-backed, /api/v1).
9456
+ *
9457
+ * Exposes datasource exploration, meta publishing, and runtime query tools.
9458
+ * Credentials are resolved via the framework-injected `_resolvedConnections`.
9459
+ */
9460
+
9461
+ /**
9462
+ * Create the Semantic Metrics middleware exposing three action-dispatch tools.
9463
+ *
9464
+ * @param config - Plugin config; reads `config._resolvedConnections` (framework-injected).
9465
+ * @returns Middleware with the datasource/meta/runtime tool set.
9466
+ */
9467
+ declare function createSemanticMetricsMiddleware(config: Record<string, unknown>): AgentMiddleware;
9468
+ /** Built-in Semantic Metrics plugin definition. */
9469
+ declare const semanticMetricsPlugin: Plugin;
9470
+
9471
+ /**
9472
+ * Creates the always-available, fail-closed Project Room tool middleware.
9473
+ *
9474
+ * The tools derive all identity from host-injected trusted run context. They do
9475
+ * not accept tenant, room, membership, Agent, or Thread identifiers from callers.
9476
+ *
9477
+ * @returns Middleware exposing trusted room posting and roster listing tools.
9478
+ */
9479
+ declare function createProjectRoomMiddleware(): AgentMiddleware;
9480
+ /** Built-in Project Room plugin metadata and middleware factory. */
9481
+ declare const projectRoomPlugin: Plugin;
9482
+
9483
+ /** Stable reasons for rejecting capability bundle input. */
9484
+ type CapabilityBundleValidationErrorCode = "CAPABILITY_BUNDLE_EMPTY_FIELD" | "CAPABILITY_BUNDLE_INELIGIBLE_CAPABILITY" | "CAPABILITY_BUNDLE_INVALID_CAPABILITY" | "CAPABILITY_BUNDLE_DUPLICATE_CAPABILITY" | "CAPABILITY_BUNDLE_EMPTY_ALLOWED_TOOLS" | "CAPABILITY_BUNDLE_UNKNOWN_TOOL" | "CAPABILITY_BUNDLE_TOOLS_UNAVAILABLE" | "CAPABILITY_BUNDLE_NULL_VALUE" | "CAPABILITY_BUNDLE_UNSAFE_KEY" | "CAPABILITY_BUNDLE_NESTED_REFERENCE" | "CAPABILITY_BUNDLE_INVALID_CONFIG" | "CAPABILITY_BUNDLE_CYCLIC_CONFIG" | "CAPABILITY_BUNDLE_CONFIG_TOO_DEEP" | "CAPABILITY_BUNDLE_CONFIG_TOO_LARGE" | "CAPABILITY_BUNDLE_NON_JSON_VALUE" | "CAPABILITY_BUNDLE_CREDENTIALS_FORBIDDEN";
9485
+ /** Describes invalid capability bundle input with a stable code and location. */
9486
+ declare class CapabilityBundleValidationError extends Error {
9487
+ /** Stable machine-readable reason. */
9488
+ readonly code: CapabilityBundleValidationErrorCode;
9489
+ /** Capability type containing the invalid value, when known. */
9490
+ readonly capabilityType?: string;
9491
+ /** JSON Pointer to the invalid value. */
9492
+ readonly fieldPath?: string;
9493
+ /** Creates a structured capability bundle validation error. */
9494
+ constructor(code: CapabilityBundleValidationErrorCode, message: string, context?: {
9495
+ capabilityType?: string;
9496
+ fieldPath?: string;
9497
+ });
9498
+ }
9499
+ /**
9500
+ * Validates create or partial-update capability bundle input without mutating it.
9501
+ *
9502
+ * @param input - Bundle fields supplied by a create or update request.
9503
+ * @param options - Set `partial` for update semantics; omitted fields are allowed.
9504
+ * @returns Nothing when valid; throws {@link CapabilityBundleValidationError} otherwise.
9505
+ * @example
9506
+ * ```ts
9507
+ * validateCapabilityBundleInput({ name: "Data", capabilities: [] });
9508
+ * validateCapabilityBundleInput({ name: "Renamed" }, { partial: true });
9509
+ * ```
9510
+ */
9511
+ declare function validateCapabilityBundleInput(input: unknown, options?: {
9512
+ partial?: boolean;
9513
+ }): asserts input is CreateCapabilityBundleInput | UpdateCapabilityBundleInput;
9514
+
8039
9515
  /**
8040
9516
  * Create middleware that provides widget rendering capabilities.
8041
9517
  *
@@ -8125,6 +9601,145 @@ interface UnknownToolHandlerConfig {
8125
9601
  */
8126
9602
  declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerConfig): AgentMiddleware;
8127
9603
 
9604
+ /** Describes how a tool argument selects a capability-scoped resource. */
9605
+ interface CapabilityResourceSelector {
9606
+ /** Tool argument containing the selected resource key. */
9607
+ argumentField: string;
9608
+ /** Capability runtime config field containing allowed resource keys. */
9609
+ configField: string;
9610
+ /** Capability runtime config flag that grants access to all resources. */
9611
+ allowAllField?: "connectAll" | "readAll";
9612
+ /** Whether allow-all mode permits omission for a discovery-style tool. */
9613
+ allowMissingWhenAll?: boolean;
9614
+ }
9615
+ /** Metadata linking one emitted tool to its capability policy. */
9616
+ interface CapabilityToolMetadata {
9617
+ /** Middleware type used as the capability runtime policy key. */
9618
+ capabilityType: string;
9619
+ /** Optional resource selector enforced when the tool call supplies it. */
9620
+ resourceSelector?: CapabilityResourceSelector;
9621
+ }
9622
+ /** Stable failure code for ambiguous emitted tool-to-capability mappings. */
9623
+ declare const CAPABILITY_TOOL_NAME_CONFLICT: "CAPABILITY_TOOL_NAME_CONFLICT";
9624
+ /** Error raised when one emitted tool name is mapped to incompatible policies. */
9625
+ declare class CapabilityToolNameConflictError extends Error {
9626
+ readonly toolName: string;
9627
+ readonly existingCapabilityType: string;
9628
+ readonly conflictingCapabilityType: string;
9629
+ /** Stable machine-readable error code. */
9630
+ readonly code: "CAPABILITY_TOOL_NAME_CONFLICT";
9631
+ /** Creates an emitted tool-name conflict error. */
9632
+ constructor(toolName: string, existingCapabilityType: string, conflictingCapabilityType: string);
9633
+ }
9634
+ /**
9635
+ * Registers tool-to-capability metadata for one middleware construction.
9636
+ *
9637
+ * @remarks Create one registry per middleware chain. Stored and returned metadata
9638
+ * is frozen so callers cannot mutate policy mappings across requests.
9639
+ *
9640
+ * @example Standard plugins do not need a resource selector mapping; the
9641
+ * generic guard uses `connectionKey` with `meta.type` as the connection type.
9642
+ * Legacy built-ins retain explicit selectors through the compatibility map.
9643
+ * ```ts
9644
+ * const registry = new CapabilityToolRegistry();
9645
+ * registry.registerMiddleware("crm", crmMiddleware);
9646
+ * ```
9647
+ */
9648
+ declare class CapabilityToolRegistry {
9649
+ private readonly metadataByTool;
9650
+ private readonly standardConnectionTools;
9651
+ /**
9652
+ * Registers one tool mapping.
9653
+ *
9654
+ * @param name - Actual emitted tool name.
9655
+ * @param metadata - Capability and optional resource-selector metadata.
9656
+ * @returns Nothing.
9657
+ */
9658
+ private registerInternal;
9659
+ /**
9660
+ * Registers one tool mapping.
9661
+ *
9662
+ * @param name - Actual emitted tool name.
9663
+ * @param metadata - Capability and optional legacy resource-selector metadata.
9664
+ * @param tool - Optional emitted tool whose schema may declare `connectionKey`.
9665
+ * @returns Nothing.
9666
+ * @remarks Standard connection authorization is captured only for tools whose
9667
+ * schema declares `connectionKey`; legacy selectors remain explicit metadata.
9668
+ */
9669
+ register(name: string, metadata: CapabilityToolMetadata, tool?: unknown): void;
9670
+ /**
9671
+ * Registers all tools actually exposed by a middleware instance.
9672
+ *
9673
+ * @param capabilityType - Runtime middleware policy key.
9674
+ * @param middleware - Constructed middleware after tool filtering.
9675
+ * @param resourceSelectors - Optional resource mappings keyed by emitted tool name.
9676
+ * @returns Nothing.
9677
+ */
9678
+ registerMiddleware(capabilityType: string, middleware: AgentMiddleware, resourceSelectors?: Readonly<Record<string, CapabilityResourceSelector>>): void;
9679
+ /**
9680
+ * Gets immutable metadata for a registered tool.
9681
+ *
9682
+ * @param name - Tool name requested by the model.
9683
+ * @returns Frozen metadata, or `undefined` when the tool is not mapped.
9684
+ */
9685
+ get(name: string): CapabilityToolMetadata | undefined;
9686
+ /**
9687
+ * Reports whether standard connection authorization was captured at registration time.
9688
+ *
9689
+ * @param name - Tool name.
9690
+ * @returns Whether the tool belongs to an eligible standard connection plugin.
9691
+ */
9692
+ isStandardConnectionTool(name: string): boolean;
9693
+ }
9694
+
9695
+ /**
9696
+ * Returns one capability's runtime configuration for the current invocation.
9697
+ *
9698
+ * @param executionConfig - LangChain execution configuration or another unknown input.
9699
+ * @param capabilityType - Middleware type used as the runtime capability key.
9700
+ * @returns The capability config record, or `undefined` when the runtime shape is absent or invalid.
9701
+ */
9702
+ declare function getRuntimeCapabilityConfig(executionConfig: unknown, capabilityType: string): Record<string, unknown> | undefined;
9703
+ /**
9704
+ * Reports whether a capability policy exists in the current runtime snapshot.
9705
+ *
9706
+ * @param executionConfig - LangChain execution configuration or another unknown input.
9707
+ * @param capabilityType - Middleware type used as the runtime capability key.
9708
+ * @returns Whether the runtime contains a policy record for the capability.
9709
+ */
9710
+ declare function hasRuntimeCapabilityPolicy(executionConfig: unknown, capabilityType: string): boolean;
9711
+ /** Runtime skill selector extracted from a capability snapshot. */
9712
+ interface RuntimeSkillSelection {
9713
+ /** Whether the invocation contains an explicit skill capability policy. */
9714
+ hasPolicy: boolean;
9715
+ /** Whether the resolved skill capability is enabled. */
9716
+ enabled: boolean;
9717
+ /** Explicitly selected skill names, including an empty deny-all list. */
9718
+ skills?: string[];
9719
+ /** Whether the runtime policy requests all skills within the static ceiling. */
9720
+ readAll: boolean;
9721
+ }
9722
+ /**
9723
+ * Returns the runtime skill selection for one invocation.
9724
+ *
9725
+ * @param executionConfig - LangChain execution configuration or another unknown input.
9726
+ * @returns A detached selector that preserves absent policy versus explicit empty selection.
9727
+ */
9728
+ declare function getRuntimeSkillSelection(executionConfig: unknown): RuntimeSkillSelection;
9729
+
9730
+ /** Stable machine-readable capability guard denial codes. */
9731
+ type CapabilityGuardDenialCode = "CAPABILITY_DISABLED" | "CAPABILITY_DENIED" | "RESOURCE_NOT_ALLOWED";
9732
+ /**
9733
+ * Creates a tool-call guard backed by server-derived capability runtime policy.
9734
+ *
9735
+ * @param registry - Per-middleware-chain mappings for actual emitted tools.
9736
+ * @returns A middleware with only a `wrapToolCall` hook.
9737
+ * @remarks Unmapped tools and missing policies pass through. This middleware does
9738
+ * not replace unknown-tool handling and deliberately does not implement
9739
+ * `wrapModelCall`.
9740
+ */
9741
+ declare function createCapabilityGuardMiddleware(registry: CapabilityToolRegistry): AgentMiddleware;
9742
+
8128
9743
  interface SchedulerMiddlewareOptions {
8129
9744
  defaultMaxRetries?: number;
8130
9745
  }
@@ -8136,6 +9751,119 @@ interface TaskMiddlewareConfig {
8136
9751
  }
8137
9752
  declare function createTaskMiddleware(options?: TaskMiddlewareConfig): AgentMiddleware;
8138
9753
 
9754
+ /** Maximum UTF-8 bytes retained for each scalar string in a task response fallback. */
9755
+ declare const TASK_RESPONSE_SCALAR_MAX_BYTES = 4096;
9756
+ /** Maximum existing warnings copied into a task mutation serialization fallback. */
9757
+ declare const TASK_RESPONSE_PRIOR_WARNING_LIMIT = 100;
9758
+ /** Maximum warnings after mandatory serialization and reconciliation warnings are appended. */
9759
+ declare const TASK_RESPONSE_FINAL_WARNING_LIMIT = 102;
9760
+ type SafeRecord = Record<string, unknown>;
9761
+ /** Result of parsing and bounded normalization for one task response. */
9762
+ type TaskResponseParseResult = {
9763
+ kind: "parse_failure";
9764
+ } | {
9765
+ kind: "parsed_non_object";
9766
+ } | {
9767
+ kind: "parsed_object";
9768
+ success: boolean | undefined;
9769
+ normalization: "succeeded";
9770
+ normalized: SafeRecord;
9771
+ } | {
9772
+ kind: "parsed_object";
9773
+ success: boolean | undefined;
9774
+ normalization: "failed";
9775
+ };
9776
+ /**
9777
+ * Builds a detached, prototype-safe fallback for a successful task mutation.
9778
+ *
9779
+ * @param taskId Persisted task identity to preserve.
9780
+ * @param mutationCommitted Whether the primary mutation actually committed.
9781
+ * @param metadata Lifecycle and warning metadata to copy as bounded scalars.
9782
+ * @returns A null-prototype partial-success record safe for captured JSON serialization.
9783
+ */
9784
+ declare function buildTaskMutationFallback(taskId: string, mutationCommitted: boolean, metadata?: SafeRecord): SafeRecord;
9785
+ /**
9786
+ * Serializes a successful task mutation, falling back without revisiting a hostile task.
9787
+ *
9788
+ * @param taskId Persisted task identity.
9789
+ * @param task Task snapshot included in the normal response.
9790
+ * @param mutationCommitted Whether the primary mutation committed.
9791
+ * @param metadata Lifecycle metadata included in the normal response and detached fallback.
9792
+ * @returns A JSON response preserving normal shape or a scalar-only partial success.
9793
+ */
9794
+ declare function serializeTaskMutationSuccess(taskId: string, task: unknown, mutationCommitted: boolean, metadata?: SafeRecord): string;
9795
+ /**
9796
+ * Serializes a read-only task-bearing response with a stable typed failure fallback.
9797
+ *
9798
+ * @param value Complete get/list response value.
9799
+ * @returns Normal JSON or `TASK_RESPONSE_SERIALIZATION_FAILED` without unsafe task IDs.
9800
+ */
9801
+ declare function serializeTaskReadResponse(value: unknown): string;
9802
+ /**
9803
+ * Parses and normalizes a task response through captured JSON and bounded JSON-safe conversion.
9804
+ *
9805
+ * @param response JSON task response.
9806
+ * @returns A discriminated parse result with top-level success and optional normalized record.
9807
+ */
9808
+ declare function parseTaskResponse(response: string): TaskResponseParseResult;
9809
+ /**
9810
+ * Builds a small factual response when successful response normalization fails.
9811
+ *
9812
+ * @param taskId Task associated with the response.
9813
+ * @param mutationCommitted Actual primary mutation fact.
9814
+ * @returns A null-prototype partial success with a protected normalization warning.
9815
+ */
9816
+ declare function buildTaskNormalizationFallback(taskId: string, mutationCommitted: boolean): SafeRecord;
9817
+ /**
9818
+ * Serializes the small factual response used after successful normalization failure.
9819
+ *
9820
+ * @param taskId Task associated with the response.
9821
+ * @param mutationCommitted Actual primary mutation fact.
9822
+ * @returns Captured-stringify JSON partial success.
9823
+ */
9824
+ declare function serializeTaskNormalizationFallback(taskId: string, mutationCommitted: boolean): string;
9825
+ /**
9826
+ * Reads an own task-response field without trusting inherited properties or accessors.
9827
+ *
9828
+ * @param response Normalized task response record.
9829
+ * @param field Field to read.
9830
+ * @returns The own field value, or undefined when absent/inaccessible.
9831
+ */
9832
+ declare function ownTaskResponseField(response: SafeRecord, field: string): unknown;
9833
+ /**
9834
+ * Extracts a bounded own string ID from a task without propagating hostile access errors.
9835
+ *
9836
+ * @param task Task-like runtime value.
9837
+ * @returns Bounded task ID, or undefined when it cannot be read safely.
9838
+ */
9839
+ declare function safeTaskResponseId(task: unknown): string | undefined;
9840
+ /**
9841
+ * Appends a bounded reconciliation warning to normalized response data.
9842
+ *
9843
+ * @param response Existing JSON response.
9844
+ * @param taskId Task whose reconciliation failed.
9845
+ * @param error Reconciliation error to summarize safely.
9846
+ * @param mutationCommitted Actual primary mutation fact for emergency fallback construction.
9847
+ * @returns Captured-stringify JSON with a protected warning array and bounded cardinality.
9848
+ */
9849
+ declare function appendReconciliationWarning(parsedResponse: TaskResponseParseResult, taskId: string, error: unknown, mutationCommitted: boolean): string;
9850
+ /** Input for factual task mutation response post-processing. */
9851
+ interface PostProcessTaskMutationResponseInput {
9852
+ response: string;
9853
+ taskId: string;
9854
+ executionResultId?: string;
9855
+ mutationCommitted: boolean;
9856
+ validationError?: unknown;
9857
+ reconcile: (normalizedResponse: SafeRecord) => Promise<void>;
9858
+ }
9859
+ /**
9860
+ * Applies one-pass parsing, factual fallback, validation warnings, and exact reconciliation.
9861
+ *
9862
+ * @param input Response plus internally known mutation and reconciliation facts.
9863
+ * @returns Original or bounded JSON response after reconciliation post-processing.
9864
+ */
9865
+ declare function postProcessTaskMutationResponse(input: PostProcessTaskMutationResponseInput): Promise<string>;
9866
+
8139
9867
  type ResolveAgentFn = (ref?: string, responseFormat?: Record<string, unknown>, stepType?: string) => Promise<AgentClient>;
8140
9868
  /**
8141
9869
  * Build a LangGraph Annotation.Root from DSL state.fields.
@@ -8627,4 +10355,70 @@ declare class IdRemapper {
8627
10355
  remapSkillIds(graphDefinition: Record<string, unknown>, skillRemap: Record<string, string>): Record<string, unknown>;
8628
10356
  }
8629
10357
 
8630
- export { AGENT_TASK_EVENT, type AddMessageParams, 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, type CacheEntry, type CalibrationProbe, type CaseRunResult, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, CollectionLatticeManager, type ColumnInfo, 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, type DeleteResult, DependencyResolver, 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 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, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryCollectionStore, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, 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, type MailboxMessage, type MailboxStore, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MessageCompletedEvent, type MessageFailedEvent, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type OutputType, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, PluginRegistry, PostgresDatabase, type PreviewError, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, type ReconcileTaskDescriptionInput, type RejectInterruptedTaskInput, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type Resolution, type ResolutionAction, type ResolveAgentFn, type ResolvedConfig, type RunSandboxConfig, type RuntimeModelConfig, type STTModelInfo, STTModelLattice, type STTModelLatticeInterface, STTModelLatticeManager, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxProviderFactory, type SandboxProviderType, 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 StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, type SubmitTaskReviewInput, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskEvent, TaskLifecycleService, type TaskLifecycleServiceDeps, type TaskListStore, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type UnknownToolHandlerConfig, type VectorStoreLatticeInterface, VectorStoreLatticeManager, type VectorStoreProviderLattice, VectorStoreProviderManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, abortWorkflowRun, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, buildTableName, checkEmptyContent, clearEncryptionKeyCache, clearEvalRunService, collectionLatticeManager, compileInternal, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, createAgentNode, createAgentTeam, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createResourceAddress, createSandboxProvider, createSchedulerMiddleware, createSharePayload, createTaskLifecycleService, createTaskMiddleware, createTeamMiddleware, createTeammateTools, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, documentLearningPlugin, documentParserPlugin, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, evaluateLatticeCaseWithLogs, eventBus, eventBus as eventBusDefault, extractFetcherError, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, generateToken, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getCollectionEntryCount, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getEvalRunService, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getOrCreateCollectionVectorStore, getQueueLattice, getSTTClient, getSTTClientWithTenant, getSTTModelLattice, getSandBoxManager, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, getVectorStoreProvider, getWorkflowSignal, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, invokeWithRetry, isBuiltInSkill, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, listCollectionEntries, listSandboxProviderTypes, loggerLatticeManager, mcpManager, metricsServerManager, modelLatticeManager, normalizeSandboxName, parallelLimit, parseCronExpression, parseJudgeVerdict, parseSkillFrontmatter, parseYaml, performStringReplacement, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerBuiltinSkill, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerSTTModelLattice, registerSandboxProviderType, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, registerVectorStoreProvider, registerWorkflowRun, removeCollectionVectorStore, renderTemplate, resolveJudgeModelKey, resolvePath, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, serializePluginMeta, setBindingRegistry, setEvalRunService, setMenuRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, sttModelLatticeManager, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, unregisterWorkflowRun, updateFileData, validateAgentInput, validateDSL, validateEncryptionKey, validatePath, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager };
10358
+ /**
10359
+ * Generates a deterministic project ID for a direct human room.
10360
+ *
10361
+ * The ID is deterministic because the same pair of users always produces the same ID,
10362
+ * which enables idempotent room creation.
10363
+ *
10364
+ * @param tenantId - The tenant ID
10365
+ * @param workspaceId - The workspace ID
10366
+ * @param userId1 - First user's ID
10367
+ * @param userId2 - Second user's ID
10368
+ * @returns A deterministic project ID with prefix "direct_human_"
10369
+ *
10370
+ * @example
10371
+ * ```ts
10372
+ * const id = generateDirectHumanProjectId("tenant-1", "workspace-1", "user-a", "user-b");
10373
+ * // Always returns the same ID regardless of argument order
10374
+ * ```
10375
+ */
10376
+ declare function generateDirectHumanProjectId(tenantId: string, workspaceId: string, userId1: string, userId2: string): string;
10377
+ /**
10378
+ * Generates a deterministic project ID for a direct bot room.
10379
+ *
10380
+ * The ID is deterministic because the same user + bot pair always produces the same ID,
10381
+ * which enables idempotent room creation.
10382
+ *
10383
+ * @param tenantId - The tenant ID
10384
+ * @param workspaceId - The workspace ID
10385
+ * @param userId - The user's ID
10386
+ * @param assistantId - The bot/assistant's ID
10387
+ * @returns A deterministic project ID with prefix "direct_bot_"
10388
+ *
10389
+ * @example
10390
+ * ```ts
10391
+ * const id = generateDirectBotProjectId("tenant-1", "workspace-1", "user-1", "assistant-1");
10392
+ * ```
10393
+ */
10394
+ declare function generateDirectBotProjectId(tenantId: string, workspaceId: string, userId: string, assistantId: string): string;
10395
+ /**
10396
+ * Parses a direct room project ID to extract its type.
10397
+ *
10398
+ * @param projectId - The project ID to parse
10399
+ * @returns The type of direct room, or null if not a direct room
10400
+ *
10401
+ * @example
10402
+ * ```ts
10403
+ * parseDirectRoomType("direct_human_abc123"); // "human"
10404
+ * parseDirectRoomType("direct_bot_xyz789"); // "bot"
10405
+ * parseDirectRoomType("normal-project-id"); // null
10406
+ * ```
10407
+ */
10408
+ declare function parseDirectRoomType(projectId: string): "human" | "bot" | null;
10409
+ /**
10410
+ * Checks if a project ID represents a direct room.
10411
+ *
10412
+ * @param projectId - The project ID to check
10413
+ * @returns True if this is a direct room project ID
10414
+ *
10415
+ * @example
10416
+ * ```ts
10417
+ * isDirectRoom("direct_human_abc123"); // true
10418
+ * isDirectRoom("direct_bot_xyz789"); // true
10419
+ * isDirectRoom("normal-project-id"); // false
10420
+ * ```
10421
+ */
10422
+ declare function isDirectRoom(projectId: string): boolean;
10423
+
10424
+ 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, 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, InMemoryProjectBotMembershipStore, InMemoryProjectMembershipStore, InMemoryProjectRoomCoordinator, InMemoryProjectRoomMessageStore, InMemoryProjectRoomStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, 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 McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, 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, type ReassignProjectTaskInput, type ReconcileTaskDescriptionInput, type RejectInterruptedTaskInput, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type ReplyReadyEvent, type Resolution, type ResolutionAction, type ResolveAgentFn, type ResolvedConfig, 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 SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxProviderFactory, type SandboxProviderType, 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, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TrustedAgentMessageDispatcher, type TrustedMessageOptions, type UnknownToolHandlerConfig, 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, 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, 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, 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, listCollectionEntries, listSandboxProviderTypes, loggerLatticeManager, mcpManager, mergeCapabilityBundles, 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, resolveJudgeModelKey, resolvePath, runRemotePackDirectory, safeTaskResponseId, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, semanticMetricsPlugin, serializePluginMeta, serializeTaskMutationSuccess, serializeTaskNormalizationFallback, serializeTaskReadResponse, setBindingRegistry, setEvalRunService, setMenuRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, sttModelLatticeManager, taskLifecycleNotifier, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, unregisterWorkflowRun, updateFileData, validateAgentInput, validateCapabilityBundleInput, validateDSL, validateEncryptionKey, validatePackSourcePath, validatePath, validateRelativePath, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager };