@axiom-lattice/core 6.2.0 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +781 -24
- package/dist/index.d.ts +781 -24
- package/dist/index.js +1154 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1119 -115
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -8,15 +8,15 @@ import { BaseLanguageModelInput, LanguageModelLike } from '@langchain/core/langu
|
|
|
8
8
|
import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
9
9
|
import { ChatResult } from '@langchain/core/outputs';
|
|
10
10
|
import * as _axiom_lattice_protocols from '@axiom-lattice/protocols';
|
|
11
|
-
import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, DeepAgentConfig, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TrustedRunContext, QueuedExecutionMode, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, ModelProviderStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, OpenAuditStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, AgentWebAppStore, CapabilityBundleStore, ProjectRoomStore, ProjectMembershipStore, ProjectBotMembershipStore, ProjectRoomMessageStore, ProjectRoomReadStateStore, UserPushSubscriptionStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, AgentWebApp, CreateAgentWebAppInput, AgentWebAppStorePatch, AgentWebAppUpdateOptions, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ModelProviderEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderStatus, ModelProviderModelEntry, ProviderModelInput, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationInput, UpdateChannelInstallationRequest, Binding, CreateBindingInput, BindingMutablePatch, BindingListParams, A2AApiKeyRecord, CreateA2AApiKeyInput, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditAppendInput, OpenAuditQuery, OpenAuditRecord, TaskMutationSnapshot, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, ProjectRoom, ProjectMembership, ProjectBotMembership, ProjectRoomMessage, ProjectHumanRole, ProjectMembershipMutationResult, ProjectRoomReadState, UserPushSubscription, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, PluginSkillDefinition, McpTool, McpUiResourcePayload, McpServerConfig, McpUiRef, ResourceResolver, ResourceAddress, ShareVisibility, OpenGrant, CreateShareRequest, ChannelAdapter, InterruptPolicy, ProjectTaskLifecycleAction, TaskBeliefState, PluginMeta, Plugin, PluginMetaOutput, SandboxPluginManifest, SandboxPluginToolDef, SandboxPluginDiagnostic, CapabilityPreview, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
|
|
11
|
+
import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, DeepAgentConfig, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TrustedRunContext, QueuedExecutionMode, ThreadStore, AssistantStore, SkillStore, CollectionStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, ModelProviderStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, MenuRegistry, A2AApiKeyStore, OpenAuditStore, TaskStore, SharedResourceStore, ConnectionStore, TaskWorkItemStore, AgentWebAppStore, CapabilityBundleStore, ProjectRoomStore, ProjectMembershipStore, ProjectBotMembershipStore, ProjectRoomMessageStore, ProjectRoomReadStateStore, UserPushSubscriptionStore, LeaseStore, OutboxStore, VectorStoreProvider, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, AgentWebApp, CreateAgentWebAppInput, AgentWebAppStorePatch, AgentWebAppUpdateOptions, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ModelProviderEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderStatus, ModelProviderModelEntry, ProviderModelInput, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationInput, UpdateChannelInstallationRequest, Binding, CreateBindingInput, BindingMutablePatch, BindingListParams, A2AApiKeyRecord, CreateA2AApiKeyInput, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditAppendInput, OpenAuditQuery, OpenAuditRecord, TaskMutationSnapshot, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, Collection, CreateCollectionRequest, UpdateCollectionRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, ProjectRoom, ProjectMembership, ProjectBotMembership, ProjectRoomMessage, ProjectHumanRole, ProjectMembershipMutationResult, ProjectRoomReadState, UserPushSubscription, LeaseRecord, OutboxEvent, STTModelLatticeProtocol, STTConfig, STTClient, TranscriptionResult, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, PluginSkillDefinition, McpTool, McpUiResourcePayload, McpServerConfig, McpUiRef, ResourceResolver, ResourceAddress, ShareVisibility, OpenGrant, CreateShareRequest, ChannelAdapter, InterruptPolicy, ProjectTaskLifecycleAction, TaskBeliefState, PluginMeta, Plugin, PluginMetaOutput, SandboxPluginManifest, SandboxPluginToolDef, SandboxPluginDiagnostic, CapabilityPreview, CreateCapabilityBundleInput, UpdateCapabilityBundleInput, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL, ConnectionEntry } from '@axiom-lattice/protocols';
|
|
12
12
|
export { _axiom_lattice_protocols as Protocols };
|
|
13
13
|
export { AgentConfig, AgentType, GraphBuildOptions, MemoryType, ProjectRoomTrustedRunContext, QueuedExecutionMode, TrustedRunContext, parseQueuedExecutionMode, parseTrustedRunContext } from '@axiom-lattice/protocols';
|
|
14
14
|
import * as langchain from 'langchain';
|
|
15
|
-
import { ReactAgent, AgentMiddleware } from 'langchain';
|
|
15
|
+
import { StructuredTool, ReactAgent, AgentMiddleware } from 'langchain';
|
|
16
16
|
import z, { z as z$1, ZodTypeAny } from 'zod';
|
|
17
17
|
import { BaseStore, BaseCheckpointSaver } from '@langchain/langgraph-checkpoint';
|
|
18
18
|
import * as _langchain_core_tools from '@langchain/core/tools';
|
|
19
|
-
import { StructuredTool, DynamicStructuredTool } from '@langchain/core/tools';
|
|
19
|
+
import { StructuredTool as StructuredTool$1, DynamicStructuredTool } from '@langchain/core/tools';
|
|
20
20
|
import * as _langchain_langgraph from '@langchain/langgraph';
|
|
21
21
|
import { CompiledStateGraph, CommandParams, AnnotationRoot } from '@langchain/langgraph';
|
|
22
22
|
import { ReplaySubject } from 'rxjs';
|
|
@@ -1721,11 +1721,21 @@ interface SandboxManagerProtocol {
|
|
|
1721
1721
|
getVolumeBackendForPath(config: RunSandboxConfig, filePath: string): Promise<BackendProtocol | null>;
|
|
1722
1722
|
}
|
|
1723
1723
|
|
|
1724
|
+
/**
|
|
1725
|
+
* Shell Execution Tool (shell_exec)
|
|
1726
|
+
*
|
|
1727
|
+
* Execute a shell command in the sandbox environment.
|
|
1728
|
+
*/
|
|
1729
|
+
|
|
1730
|
+
declare const createShellExecTool: ({ vmIsolation, }: {
|
|
1731
|
+
vmIsolation: SandboxIsolationLevel;
|
|
1732
|
+
}) => StructuredTool;
|
|
1733
|
+
|
|
1724
1734
|
type ToolDefinition = ToolConfig;
|
|
1725
1735
|
interface ToolLattice {
|
|
1726
1736
|
key: string;
|
|
1727
1737
|
config: ToolConfig;
|
|
1728
|
-
client: StructuredTool;
|
|
1738
|
+
client: StructuredTool$1;
|
|
1729
1739
|
}
|
|
1730
1740
|
/**
|
|
1731
1741
|
* ToolLatticeManager - 单例工具Lattice管理器
|
|
@@ -1788,7 +1798,7 @@ declare class ToolLatticeManager extends BaseLatticeManager<ToolLattice> {
|
|
|
1788
1798
|
* 获取工具客户端
|
|
1789
1799
|
* @param key Lattice键名
|
|
1790
1800
|
*/
|
|
1791
|
-
getToolClient(key: string): StructuredTool;
|
|
1801
|
+
getToolClient(key: string): StructuredTool$1;
|
|
1792
1802
|
/**
|
|
1793
1803
|
* 获取所有工具定义
|
|
1794
1804
|
*/
|
|
@@ -1798,7 +1808,7 @@ declare class ToolLatticeManager extends BaseLatticeManager<ToolLattice> {
|
|
|
1798
1808
|
* @param key Lattice键名
|
|
1799
1809
|
* @param tool 已有的StructuredTool实例
|
|
1800
1810
|
*/
|
|
1801
|
-
registerExistingTool(key: string, tool: StructuredTool): void;
|
|
1811
|
+
registerExistingTool(key: string, tool: StructuredTool$1): void;
|
|
1802
1812
|
/**
|
|
1803
1813
|
* Register an existing StructuredTool into a specific tenant's tool bucket.
|
|
1804
1814
|
*
|
|
@@ -1806,7 +1816,7 @@ declare class ToolLatticeManager extends BaseLatticeManager<ToolLattice> {
|
|
|
1806
1816
|
* @param key - tool lattice key (no tenant prefix)
|
|
1807
1817
|
* @param tool - the StructuredTool client
|
|
1808
1818
|
*/
|
|
1809
|
-
registerExistingToolWithTenant(tenantId: string, key: string, tool: StructuredTool): void;
|
|
1819
|
+
registerExistingToolWithTenant(tenantId: string, key: string, tool: StructuredTool$1): void;
|
|
1810
1820
|
/**
|
|
1811
1821
|
* Get a tool lattice from a specific tenant bucket.
|
|
1812
1822
|
*
|
|
@@ -1823,7 +1833,7 @@ declare class ToolLatticeManager extends BaseLatticeManager<ToolLattice> {
|
|
|
1823
1833
|
* @param key - tool lattice key
|
|
1824
1834
|
* @returns the StructuredTool client
|
|
1825
1835
|
*/
|
|
1826
|
-
getToolClientWithTenant(tenantId: string, key: string): StructuredTool;
|
|
1836
|
+
getToolClientWithTenant(tenantId: string, key: string): StructuredTool$1;
|
|
1827
1837
|
/**
|
|
1828
1838
|
* 验证工具输入参数
|
|
1829
1839
|
* @param key Lattice键名
|
|
@@ -1833,12 +1843,12 @@ declare class ToolLatticeManager extends BaseLatticeManager<ToolLattice> {
|
|
|
1833
1843
|
}
|
|
1834
1844
|
declare const toolLatticeManager: ToolLatticeManager;
|
|
1835
1845
|
declare const registerToolLattice: (key: string, config: ToolConfig, executor: ToolExecutor) => void;
|
|
1836
|
-
declare const registerExistingTool: (key: string, tool: StructuredTool) => void;
|
|
1837
|
-
declare const registerExistingToolWithTenant: (tenantId: string, key: string, tool: StructuredTool) => void;
|
|
1846
|
+
declare const registerExistingTool: (key: string, tool: StructuredTool$1) => void;
|
|
1847
|
+
declare const registerExistingToolWithTenant: (tenantId: string, key: string, tool: StructuredTool$1) => void;
|
|
1838
1848
|
declare const getToolLattice: (key: string) => ToolLattice | undefined;
|
|
1839
|
-
declare const getToolClientWithTenant: (tenantId: string, key: string) => StructuredTool<_langchain_core_tools.ToolSchemaBase, any, any, any>;
|
|
1849
|
+
declare const getToolClientWithTenant: (tenantId: string, key: string) => StructuredTool$1<_langchain_core_tools.ToolSchemaBase, any, any, any>;
|
|
1840
1850
|
declare const getToolDefinition: (key: string) => ToolConfig;
|
|
1841
|
-
declare const getToolClient: (key: string) => StructuredTool<_langchain_core_tools.ToolSchemaBase, any, any, any>;
|
|
1851
|
+
declare const getToolClient: (key: string) => StructuredTool$1<_langchain_core_tools.ToolSchemaBase, any, any, any>;
|
|
1842
1852
|
declare const getAllToolDefinitions: () => ToolConfig[];
|
|
1843
1853
|
declare const validateToolInput: (key: string, input: any) => boolean;
|
|
1844
1854
|
|
|
@@ -2712,6 +2722,22 @@ declare class MemoryScheduleStorage implements ScheduleStorage {
|
|
|
2712
2722
|
* Update task
|
|
2713
2723
|
*/
|
|
2714
2724
|
update(taskId: string, updates: Partial<ScheduledTaskDefinition>): Promise<void>;
|
|
2725
|
+
/**
|
|
2726
|
+
* Atomically claims one due fire by transitioning the task `pending -> running`.
|
|
2727
|
+
*
|
|
2728
|
+
* @param taskId Task to claim.
|
|
2729
|
+
* @returns True when this caller won the claim (task was `pending`); false if
|
|
2730
|
+
* another replica already claimed it or it is not pending.
|
|
2731
|
+
*/
|
|
2732
|
+
claimScheduledRun(taskId: string): Promise<boolean>;
|
|
2733
|
+
/**
|
|
2734
|
+
* Requeues `running` tasks whose `updatedAt` is older than `olderThanMs` back
|
|
2735
|
+
* to `pending` (recovery after a crash that left a claim unsettled).
|
|
2736
|
+
*
|
|
2737
|
+
* @param olderThanMs Age threshold in milliseconds.
|
|
2738
|
+
* @returns The number of tasks requeued.
|
|
2739
|
+
*/
|
|
2740
|
+
requeueStaleRunning(olderThanMs: number): Promise<number>;
|
|
2715
2741
|
/**
|
|
2716
2742
|
* Delete task
|
|
2717
2743
|
*/
|
|
@@ -2903,6 +2929,20 @@ interface ThreadInfo {
|
|
|
2903
2929
|
projectId?: string | null;
|
|
2904
2930
|
}
|
|
2905
2931
|
type QueueScope = Pick<ThreadInfo, "tenantId" | "assistantId" | "workspaceId" | "projectId">;
|
|
2932
|
+
/**
|
|
2933
|
+
* Options for an atomic pending→processing claim.
|
|
2934
|
+
*
|
|
2935
|
+
* @remarks `owner` identifies the claimant replica (see `getReplicaId`); a
|
|
2936
|
+
* claim is only reclaimable once its lease expires.
|
|
2937
|
+
*/
|
|
2938
|
+
interface ClaimMessagesOptions {
|
|
2939
|
+
/** Replica/owner id stamped on claimed rows. */
|
|
2940
|
+
owner: string;
|
|
2941
|
+
/** Lease time-to-live in milliseconds. */
|
|
2942
|
+
ttlMs: number;
|
|
2943
|
+
/** Maximum rows to claim; omitted means all currently-pending rows. */
|
|
2944
|
+
limit?: number;
|
|
2945
|
+
}
|
|
2906
2946
|
/**
|
|
2907
2947
|
* Interface for message queue storage
|
|
2908
2948
|
* Implemented by pg-stores or other storage backends
|
|
@@ -2912,6 +2952,24 @@ interface IMessageQueueStore {
|
|
|
2912
2952
|
addMessageIfCapacity(params: AddMessageParams, maxSize: number): Promise<boolean>;
|
|
2913
2953
|
addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
|
|
2914
2954
|
getPendingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
|
|
2955
|
+
/**
|
|
2956
|
+
* Atomically claims pending messages for `owner`, moving them to `processing`
|
|
2957
|
+
* with a lease. Concurrent callers receive disjoint sets.
|
|
2958
|
+
*
|
|
2959
|
+
* @param threadId Thread whose queue is claimed.
|
|
2960
|
+
* @param scope Optional exact scope filter.
|
|
2961
|
+
* @param options Owner id, lease TTL, and optional row limit.
|
|
2962
|
+
* @returns The messages this caller actually claimed (possibly empty).
|
|
2963
|
+
*/
|
|
2964
|
+
claimPendingMessages(threadId: string, scope: QueueScope | undefined, options: ClaimMessagesOptions): Promise<PendingMessage[]>;
|
|
2965
|
+
/**
|
|
2966
|
+
* Returns `processing` messages whose lease expired to `pending`.
|
|
2967
|
+
*
|
|
2968
|
+
* @param threadId Thread to reclaim.
|
|
2969
|
+
* @param scope Optional exact scope filter.
|
|
2970
|
+
* @returns The number of rows reset to `pending`.
|
|
2971
|
+
*/
|
|
2972
|
+
reclaimExpiredProcessing(threadId: string, scope?: QueueScope): Promise<number>;
|
|
2915
2973
|
getProcessingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
|
|
2916
2974
|
getQueueSize(threadId: string, scope?: QueueScope): Promise<number>;
|
|
2917
2975
|
getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
|
|
@@ -3006,6 +3064,8 @@ type StoreTypeMap = {
|
|
|
3006
3064
|
projectRoomMessage: ProjectRoomMessageStore;
|
|
3007
3065
|
projectRoomReadState: ProjectRoomReadStateStore;
|
|
3008
3066
|
userPushSubscription: UserPushSubscriptionStore;
|
|
3067
|
+
lease: LeaseStore;
|
|
3068
|
+
outbox: OutboxStore;
|
|
3009
3069
|
};
|
|
3010
3070
|
/**
|
|
3011
3071
|
* Store type keys
|
|
@@ -4019,9 +4079,11 @@ declare class InMemoryOpenAuditStore implements OpenAuditStore {
|
|
|
4019
4079
|
*/
|
|
4020
4080
|
|
|
4021
4081
|
declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
|
|
4082
|
+
private readonly now;
|
|
4022
4083
|
private messages;
|
|
4023
4084
|
private messageIdCounter;
|
|
4024
4085
|
private capacityTail;
|
|
4086
|
+
constructor(now?: () => number);
|
|
4025
4087
|
private generateId;
|
|
4026
4088
|
private getMessagesForThread;
|
|
4027
4089
|
private inScope;
|
|
@@ -4030,6 +4092,8 @@ declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
4030
4092
|
addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
|
|
4031
4093
|
getPendingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
|
|
4032
4094
|
getProcessingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
|
|
4095
|
+
claimPendingMessages(threadId: string, scope: QueueScope | undefined, options: ClaimMessagesOptions): Promise<PendingMessage[]>;
|
|
4096
|
+
reclaimExpiredProcessing(threadId: string, scope?: QueueScope): Promise<number>;
|
|
4033
4097
|
getQueueSize(threadId: string, scope?: QueueScope): Promise<number>;
|
|
4034
4098
|
getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
|
|
4035
4099
|
removeMessage(messageId: string, scope?: QueueScope): Promise<boolean>;
|
|
@@ -4639,6 +4703,79 @@ declare class InMemoryUserPushSubscriptionStore implements UserPushSubscriptionS
|
|
|
4639
4703
|
delete(tenantId: string, userId: string, endpoint: string): Promise<boolean>;
|
|
4640
4704
|
}
|
|
4641
4705
|
|
|
4706
|
+
/**
|
|
4707
|
+
* In-process {@link LeaseStore} used for single-process runs and tests.
|
|
4708
|
+
*
|
|
4709
|
+
* @remarks Real cross-replica exclusion requires the PostgreSQL implementation;
|
|
4710
|
+
* this store only serializes within one Node process.
|
|
4711
|
+
*/
|
|
4712
|
+
declare class InMemoryLeaseStore implements LeaseStore {
|
|
4713
|
+
private readonly leases;
|
|
4714
|
+
private readonly now;
|
|
4715
|
+
/**
|
|
4716
|
+
* @param now Injectable clock in epoch milliseconds (tests use a fake clock).
|
|
4717
|
+
*/
|
|
4718
|
+
constructor(now?: () => number);
|
|
4719
|
+
/** Atomically acquires a free/expired key (or the caller's own key). */
|
|
4720
|
+
tryAcquire(key: string, holder: string, ttlMs: number): Promise<boolean>;
|
|
4721
|
+
/** Extends a lease only while `holder` still owns it. */
|
|
4722
|
+
renew(key: string, holder: string, ttlMs: number): Promise<boolean>;
|
|
4723
|
+
/** Deletes a lease only when `holder` owns it. */
|
|
4724
|
+
release(key: string, holder: string): Promise<boolean>;
|
|
4725
|
+
/** Returns the live lease, pruning an expired one. */
|
|
4726
|
+
get(key: string): Promise<LeaseRecord | null>;
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
/**
|
|
4730
|
+
* In-process {@link OutboxStore} used for single-process runs and tests.
|
|
4731
|
+
*
|
|
4732
|
+
* @remarks Real cross-replica fan-out requires the PostgreSQL implementation;
|
|
4733
|
+
* this store only preserves a monotonic log within one Node process. Ids are
|
|
4734
|
+
* assigned from an in-memory counter and serialized as decimal strings to match
|
|
4735
|
+
* the transport-neutral contract.
|
|
4736
|
+
*/
|
|
4737
|
+
declare class InMemoryOutboxStore implements OutboxStore {
|
|
4738
|
+
private readonly events;
|
|
4739
|
+
private counter;
|
|
4740
|
+
private readonly now;
|
|
4741
|
+
/**
|
|
4742
|
+
* Creates an in-memory outbox store.
|
|
4743
|
+
*
|
|
4744
|
+
* @param now Optional clock override (defaults to the system clock); it stamps
|
|
4745
|
+
* `createdAt` and is used to evaluate age-based retention.
|
|
4746
|
+
*/
|
|
4747
|
+
constructor(now?: () => Date);
|
|
4748
|
+
/**
|
|
4749
|
+
* Appends one event, assigning the next monotonic id.
|
|
4750
|
+
* @param input Topic, JSON-safe payload, and authoring replica id.
|
|
4751
|
+
* @returns A defensive copy of the stored event.
|
|
4752
|
+
*/
|
|
4753
|
+
append(input: {
|
|
4754
|
+
topic: string;
|
|
4755
|
+
payload: unknown;
|
|
4756
|
+
originReplicaId: string;
|
|
4757
|
+
}): Promise<OutboxEvent>;
|
|
4758
|
+
/**
|
|
4759
|
+
* Lists events strictly newer than `cursor`, ascending, bounded by `limit`.
|
|
4760
|
+
* @param cursor Last-seen id, or `null` to read from the start.
|
|
4761
|
+
* @param limit Maximum number of events to return.
|
|
4762
|
+
* @returns Defensive copies of the matching events.
|
|
4763
|
+
*/
|
|
4764
|
+
listAfter(cursor: string | null, limit: number): Promise<OutboxEvent[]>;
|
|
4765
|
+
/**
|
|
4766
|
+
* Returns the newest event id.
|
|
4767
|
+
* @returns The last id, or `null` when the log is empty.
|
|
4768
|
+
*/
|
|
4769
|
+
latestId(): Promise<string | null>;
|
|
4770
|
+
/**
|
|
4771
|
+
* Deletes events older than `olderThanMs`, evaluated against this store's clock.
|
|
4772
|
+
*
|
|
4773
|
+
* @param olderThanMs Age threshold in milliseconds.
|
|
4774
|
+
* @returns The number of events removed.
|
|
4775
|
+
*/
|
|
4776
|
+
pruneOlderThan(olderThanMs: number): Promise<number>;
|
|
4777
|
+
}
|
|
4778
|
+
|
|
4642
4779
|
/**
|
|
4643
4780
|
* Embeddings Lattice Interface
|
|
4644
4781
|
* Defines the structure of an embeddings lattice entry
|
|
@@ -6580,6 +6717,13 @@ declare class DaytonaInstance implements SandboxInstance {
|
|
|
6580
6717
|
readonly shell: SandboxShellService;
|
|
6581
6718
|
}
|
|
6582
6719
|
|
|
6720
|
+
/**
|
|
6721
|
+
* Environment variables that must never reach sandbox-executed code.
|
|
6722
|
+
*
|
|
6723
|
+
* A denylist MVP for the local provider (which host-executes). A future
|
|
6724
|
+
* follow-up should flip this to a default-deny allowlist of benign vars.
|
|
6725
|
+
*/
|
|
6726
|
+
declare const PLATFORM_SECRET_ENV_VARS: readonly string[];
|
|
6583
6727
|
/**
|
|
6584
6728
|
* Sandbox instance backed by the host filesystem.
|
|
6585
6729
|
*
|
|
@@ -6786,6 +6930,81 @@ interface SharePayload {
|
|
|
6786
6930
|
*/
|
|
6787
6931
|
declare function createSharePayload(tenantId: string, workspaceId: string, projectId: string, userId: string, request: CreateShareRequest): SharePayload;
|
|
6788
6932
|
|
|
6933
|
+
/**
|
|
6934
|
+
* Sandbox open-credential seam.
|
|
6935
|
+
*
|
|
6936
|
+
* A process-global provider (registered by the gateway composition root) resolves
|
|
6937
|
+
* a short-lived Open bearer for a running sandbox so sandbox code can call the
|
|
6938
|
+
* Open MCP endpoint. Core never mints tokens — it only transports a provider's
|
|
6939
|
+
* result into single-process env.
|
|
6940
|
+
*/
|
|
6941
|
+
/** Identity of the sandbox whose code will consume the credential. */
|
|
6942
|
+
interface SandboxOpenCredentialContext {
|
|
6943
|
+
tenantId: string;
|
|
6944
|
+
workspaceId?: string;
|
|
6945
|
+
projectId?: string;
|
|
6946
|
+
/** Resolved sandbox name; determines the token's `self` binding. */
|
|
6947
|
+
sandboxName: string;
|
|
6948
|
+
/** Caller Assistant id (agent runs); absent for plugin-handler callers. */
|
|
6949
|
+
assistantId?: string;
|
|
6950
|
+
/** Caller thread id (agent runs). */
|
|
6951
|
+
threadId?: string;
|
|
6952
|
+
/** Current orchestration depth; nested mints pass depth+1. */
|
|
6953
|
+
depth?: number;
|
|
6954
|
+
}
|
|
6955
|
+
/** A resolved Open bearer plus the gateway base URL to call. */
|
|
6956
|
+
interface SandboxOpenCredential {
|
|
6957
|
+
gatewayUrl: string;
|
|
6958
|
+
token: string;
|
|
6959
|
+
}
|
|
6960
|
+
/** Resolves a credential for a sandbox, or `undefined` to inject nothing. */
|
|
6961
|
+
type SandboxOpenCredentialProvider = (context: SandboxOpenCredentialContext) => Promise<SandboxOpenCredential | undefined>;
|
|
6962
|
+
/** Env var name carrying the platform gateway URL into sandbox code. */
|
|
6963
|
+
declare const SANDBOX_OPEN_GATEWAY_URL_ENV = "API_GATEWAY_URL";
|
|
6964
|
+
/** Env var name carrying the short-lived Open bearer into sandbox code. */
|
|
6965
|
+
declare const SANDBOX_OPEN_TOKEN_ENV = "OPEN_API_TOKEN";
|
|
6966
|
+
/** Options for {@link registerSandboxOpenCredentialProvider}. */
|
|
6967
|
+
interface SandboxOpenCredentialProviderOptions {
|
|
6968
|
+
/** Invoked (best-effort) when the provider throws; use for structured warnings. */
|
|
6969
|
+
onError?: (error: unknown) => void;
|
|
6970
|
+
}
|
|
6971
|
+
/**
|
|
6972
|
+
* Register (or replace) the process-global sandbox open-credential provider.
|
|
6973
|
+
*
|
|
6974
|
+
* @param next - Provider implementation supplied by the composition root
|
|
6975
|
+
* @param options - Optional error hook for structured warnings
|
|
6976
|
+
* @returns An unregister function that clears the registration when it is still current
|
|
6977
|
+
*
|
|
6978
|
+
* @remarks
|
|
6979
|
+
* Singleton, last-write-wins. A stale unregister (from a superseded registration)
|
|
6980
|
+
* is a no-op, so hot-path re-registration cannot be disarmed by an old handle.
|
|
6981
|
+
*
|
|
6982
|
+
* @example
|
|
6983
|
+
* ```ts
|
|
6984
|
+
* const unregister = registerSandboxOpenCredentialProvider(
|
|
6985
|
+
* async (ctx) => ({ gatewayUrl: process.env.PUBLIC_GATEWAY_URL!, token: mint(ctx) }),
|
|
6986
|
+
* { onError: (err) => logger.warn({ err }, "sandbox credential failed") },
|
|
6987
|
+
* );
|
|
6988
|
+
* ```
|
|
6989
|
+
*/
|
|
6990
|
+
declare function registerSandboxOpenCredentialProvider(next: SandboxOpenCredentialProvider, options?: SandboxOpenCredentialProviderOptions): () => void;
|
|
6991
|
+
/**
|
|
6992
|
+
* Resolve the credential for a sandbox.
|
|
6993
|
+
*
|
|
6994
|
+
* @param context - Sandbox identity and resolved sandbox name
|
|
6995
|
+
* @returns The credential, or `undefined` when no provider is registered or it throws
|
|
6996
|
+
*/
|
|
6997
|
+
declare function getSandboxOpenCredential(context: SandboxOpenCredentialContext): Promise<SandboxOpenCredential | undefined>;
|
|
6998
|
+
/**
|
|
6999
|
+
* Build the shell `export … && export …` prefix for a credential.
|
|
7000
|
+
*
|
|
7001
|
+
* @param credential - Resolved gateway URL and bearer
|
|
7002
|
+
* @returns A single-quote-escaped `export` chain safe to prepend to a command
|
|
7003
|
+
*/
|
|
7004
|
+
declare function buildSandboxOpenEnv(credential: SandboxOpenCredential): string;
|
|
7005
|
+
/** @internal */
|
|
7006
|
+
declare function clearSandboxOpenCredentialProviderForTests(): void;
|
|
7007
|
+
|
|
6789
7008
|
/**
|
|
6790
7009
|
* Channel connection lifecycle.
|
|
6791
7010
|
*
|
|
@@ -7598,7 +7817,7 @@ interface TeammateSpec {
|
|
|
7598
7817
|
/** Model override (defaults to team-level model) */
|
|
7599
7818
|
model?: LanguageModelLike | string;
|
|
7600
7819
|
/** Tools this teammate has access to (in addition to team tools) */
|
|
7601
|
-
tools?: StructuredTool[];
|
|
7820
|
+
tools?: StructuredTool$1[];
|
|
7602
7821
|
/** Custom system prompt for this teammate */
|
|
7603
7822
|
systemPrompt?: string;
|
|
7604
7823
|
/** Additional middleware for this teammate */
|
|
@@ -7617,7 +7836,7 @@ interface TeamConfig {
|
|
|
7617
7836
|
/** Custom system prompt for the team lead */
|
|
7618
7837
|
systemPrompt?: string;
|
|
7619
7838
|
/** Tools available to the team lead */
|
|
7620
|
-
tools?: StructuredTool[];
|
|
7839
|
+
tools?: StructuredTool$1[];
|
|
7621
7840
|
/** Checkpointer for persisting agent state between runs */
|
|
7622
7841
|
checkpointer?: BaseCheckpointSaver | boolean;
|
|
7623
7842
|
/** Pluggable task list store (default: InMemoryTaskListStore) */
|
|
@@ -7817,7 +8036,7 @@ interface TeammateToolsOptions {
|
|
|
7817
8036
|
* - Task lifecycle: claim_task, complete_task, fail_task
|
|
7818
8037
|
* - Communication: send_message, read_messages
|
|
7819
8038
|
*/
|
|
7820
|
-
declare function createTeammateTools(options: TeammateToolsOptions): StructuredTool[];
|
|
8039
|
+
declare function createTeammateTools(options: TeammateToolsOptions): StructuredTool$1[];
|
|
7821
8040
|
|
|
7822
8041
|
/**
|
|
7823
8042
|
* Agent Graph Builder 接口
|
|
@@ -8682,6 +8901,9 @@ type TaskLifecycleListener = (event: TaskLifecycleNotification) => void | Promis
|
|
|
8682
8901
|
declare class TaskLifecycleNotifier {
|
|
8683
8902
|
private readonly listeners;
|
|
8684
8903
|
private readonly tails;
|
|
8904
|
+
private outbox;
|
|
8905
|
+
/** Installs (or clears) the durable outbox used to fan notifications to other replicas. */
|
|
8906
|
+
setOutbox(outbox: OutboxStore | undefined): void;
|
|
8685
8907
|
/**
|
|
8686
8908
|
* Registers an async lifecycle listener.
|
|
8687
8909
|
*
|
|
@@ -8697,6 +8919,8 @@ declare class TaskLifecycleNotifier {
|
|
|
8697
8919
|
* @throws Error when the event is malformed or one or more listeners reject.
|
|
8698
8920
|
*/
|
|
8699
8921
|
publish(event: TaskLifecycleNotification): Promise<void>;
|
|
8922
|
+
/** Delivers one outbox payload to local listeners without re-appending (poller path). */
|
|
8923
|
+
deliverFromOutbox(event: unknown): Promise<void>;
|
|
8700
8924
|
private deliver;
|
|
8701
8925
|
}
|
|
8702
8926
|
/** Process-global notifier used by every lifecycle service unless explicitly injected. */
|
|
@@ -8736,6 +8960,9 @@ declare class ProjectTaskAdmissionNotifier {
|
|
|
8736
8960
|
private readonly listeners;
|
|
8737
8961
|
private readonly tails;
|
|
8738
8962
|
private readonly listenerTimeoutMs;
|
|
8963
|
+
private outbox;
|
|
8964
|
+
/** Installs (or clears) the durable outbox used to fan notifications to other replicas. */
|
|
8965
|
+
setOutbox(outbox: OutboxStore | undefined): void;
|
|
8739
8966
|
/**
|
|
8740
8967
|
* Creates a bounded Project task admission notifier.
|
|
8741
8968
|
*
|
|
@@ -8756,12 +8983,68 @@ declare class ProjectTaskAdmissionNotifier {
|
|
|
8756
8983
|
* @returns A promise settled after every snapshotted listener settles.
|
|
8757
8984
|
*/
|
|
8758
8985
|
publish(event: ProjectTaskAdmissionNotification): Promise<void>;
|
|
8986
|
+
/** Delivers one outbox payload to local listeners without re-appending (poller path). */
|
|
8987
|
+
deliverFromOutbox(event: unknown): Promise<void>;
|
|
8759
8988
|
private deliver;
|
|
8760
8989
|
private deliverTo;
|
|
8761
8990
|
}
|
|
8762
8991
|
/** Process-global Project task admission notifier used by the managed dispatch path. */
|
|
8763
8992
|
declare const projectTaskAdmissionNotifier: ProjectTaskAdmissionNotifier;
|
|
8764
8993
|
|
|
8994
|
+
/** Dependencies for {@link OutboxPoller}. */
|
|
8995
|
+
interface OutboxPollerDeps {
|
|
8996
|
+
/** Durable outbox log. */
|
|
8997
|
+
store: OutboxStore;
|
|
8998
|
+
/** This replica's id; rows it authored are skipped (already delivered locally). */
|
|
8999
|
+
owner: string;
|
|
9000
|
+
/** Handlers per topic that deliver a foreign payload to local listeners. */
|
|
9001
|
+
handlers: Record<string, (payload: unknown) => Promise<void>>;
|
|
9002
|
+
/** Poll interval in ms (default 1000). */
|
|
9003
|
+
intervalMs?: number;
|
|
9004
|
+
/** Max rows per query (default 100). */
|
|
9005
|
+
batchSize?: number;
|
|
9006
|
+
/** Per-handler delivery timeout in ms (default 5000); a hung listener cannot stall the poller. */
|
|
9007
|
+
handlerTimeoutMs?: number;
|
|
9008
|
+
/** Optional structured logger for recoverable delivery/poll failures. */
|
|
9009
|
+
log?: {
|
|
9010
|
+
warn(message: string, context: Record<string, unknown>): void;
|
|
9011
|
+
};
|
|
9012
|
+
}
|
|
9013
|
+
/**
|
|
9014
|
+
* Polls a durable outbox and delivers FOREIGN events to local handlers.
|
|
9015
|
+
*
|
|
9016
|
+
* @remarks
|
|
9017
|
+
* - The cursor starts at the current `latestId()` (no history replay); events
|
|
9018
|
+
* missed during downtime are covered by existing startup repair.
|
|
9019
|
+
* - Rows authored by this replica (`originReplicaId === owner`) are skipped
|
|
9020
|
+
* because `publish` already delivered them locally.
|
|
9021
|
+
* - A handler failure is logged and skipped (the cursor still advances), so one
|
|
9022
|
+
* bad event cannot stall the log.
|
|
9023
|
+
*/
|
|
9024
|
+
declare class OutboxPoller {
|
|
9025
|
+
private readonly deps;
|
|
9026
|
+
private cursor;
|
|
9027
|
+
private timer;
|
|
9028
|
+
private polling;
|
|
9029
|
+
/**
|
|
9030
|
+
* Creates a poller bound to one durable outbox.
|
|
9031
|
+
*
|
|
9032
|
+
* @param deps Store, owner replica id, topic handlers, and optional tuning.
|
|
9033
|
+
*/
|
|
9034
|
+
constructor(deps: OutboxPollerDeps);
|
|
9035
|
+
/** Captures the starting cursor and begins polling. */
|
|
9036
|
+
start(): Promise<void>;
|
|
9037
|
+
/** Stops polling. */
|
|
9038
|
+
stop(): void;
|
|
9039
|
+
/** Runs one drain pass (exported for tests). */
|
|
9040
|
+
pollOnce(): Promise<void>;
|
|
9041
|
+
/**
|
|
9042
|
+
* Runs one handler bounded by `handlerTimeoutMs` so a hung listener cannot
|
|
9043
|
+
* stall cross-replica delivery for this replica.
|
|
9044
|
+
*/
|
|
9045
|
+
private deliverWithTimeout;
|
|
9046
|
+
}
|
|
9047
|
+
|
|
8765
9048
|
/** Exact Tenant and Project scope for collaboration mutations. */
|
|
8766
9049
|
interface ProjectMutationScope {
|
|
8767
9050
|
tenantId: string;
|
|
@@ -8774,6 +9057,14 @@ interface ProjectMutationScope {
|
|
|
8774
9057
|
* When an operation needs both a Project task machine mutex and this mutex, it
|
|
8775
9058
|
* must acquire the machine mutex first. Project-only membership, roster, human,
|
|
8776
9059
|
* and ordinary Task mutations acquire only this mutex.
|
|
9060
|
+
*
|
|
9061
|
+
* A coordination lease store may be installed process-wide
|
|
9062
|
+
* ({@link configureCoordinationLeaseStore}). When present, each critical section
|
|
9063
|
+
* additionally holds a bounded distributed lease (`project-mutation:<tenant>:<project>`)
|
|
9064
|
+
* so mutations on the same Tenant and Project serialize across replicas, not just
|
|
9065
|
+
* within this process. The local FIFO lock is always retained; the lease only adds
|
|
9066
|
+
* cross-replica exclusion. When no store is configured (single process, tests),
|
|
9067
|
+
* behavior is unchanged.
|
|
8777
9068
|
*/
|
|
8778
9069
|
declare class ProjectMutationMutex {
|
|
8779
9070
|
private readonly queues;
|
|
@@ -8804,6 +9095,23 @@ interface ResumeTaskResult {
|
|
|
8804
9095
|
status: ThreadStatus;
|
|
8805
9096
|
/** Whether processing rows are settled and pending queue work may continue. */
|
|
8806
9097
|
settled: boolean;
|
|
9098
|
+
/**
|
|
9099
|
+
* True only when the thread-run lease was held by another replica, so this
|
|
9100
|
+
* call did nothing and left the thread entirely to its owner.
|
|
9101
|
+
*
|
|
9102
|
+
* This disambiguates the two situations that report `settled: false`:
|
|
9103
|
+
* - **Lease contention** — a peer owns the run; recovery must be deferred and
|
|
9104
|
+
* the caller must not settle, arm watchdogs, or classify the thread.
|
|
9105
|
+
* - **Genuine interruption / busy** — this replica observed the thread and
|
|
9106
|
+
* reports an authoritative status (`INTERRUPTED`/`BUSY`) that the caller
|
|
9107
|
+
* must still act on.
|
|
9108
|
+
*
|
|
9109
|
+
* Callers that defer recovery on contention MUST branch on this flag, not on
|
|
9110
|
+
* `settled`, and callers that continue processing on `INTERRUPTED` must ignore
|
|
9111
|
+
* it. It is never set on the `INTERRUPTED`, `BUSY`, `IDLE`, or `ERROR`
|
|
9112
|
+
* returns from {@link Agent.resumeTask}.
|
|
9113
|
+
*/
|
|
9114
|
+
leaseContended?: boolean;
|
|
8807
9115
|
}
|
|
8808
9116
|
/**
|
|
8809
9117
|
* Snapshot of a thread's current state including queue and status.
|
|
@@ -9064,6 +9372,14 @@ declare class Agent {
|
|
|
9064
9372
|
private queueProcessorGeneration;
|
|
9065
9373
|
private queueWakeRequested;
|
|
9066
9374
|
private recoveryBlockedKey?;
|
|
9375
|
+
/**
|
|
9376
|
+
* Thread-run ownership lease held while this replica is actively processing
|
|
9377
|
+
* the thread. Acquired non-blockingly in {@link startQueueProcessor}; released
|
|
9378
|
+
* exactly once when the processor definitively stops.
|
|
9379
|
+
*/
|
|
9380
|
+
private threadRunLease;
|
|
9381
|
+
private threadRunLeaseRetryAttempt;
|
|
9382
|
+
private threadRunLeaseRetryTimer;
|
|
9067
9383
|
asyncTasks: AsyncTaskRecord[];
|
|
9068
9384
|
/**
|
|
9069
9385
|
* Constructs an Agent instance.
|
|
@@ -9155,6 +9471,20 @@ declare class Agent {
|
|
|
9155
9471
|
private queueScope;
|
|
9156
9472
|
private agentStreamExecutor;
|
|
9157
9473
|
private consumeAgentStream;
|
|
9474
|
+
/**
|
|
9475
|
+
* Waits until the thread's durable checkpoint reports the given interrupt id.
|
|
9476
|
+
*
|
|
9477
|
+
* Reads {@link getCurrentState} (the checkpoint, i.e. the single source of
|
|
9478
|
+
* truth), never an in-memory status, so a `true` result guarantees a resume
|
|
9479
|
+
* against this thread will find the interrupt. Bounded so a broken
|
|
9480
|
+
* checkpointer cannot strand the stream; on timeout the interrupt is emitted
|
|
9481
|
+
* anyway and a warning is logged.
|
|
9482
|
+
*
|
|
9483
|
+
* @param interruptId - Interrupt id from the streamed `__interrupt__` update.
|
|
9484
|
+
* @param signal - Run abort signal; polling stops when aborted.
|
|
9485
|
+
* @param timeoutMs - Maximum time to wait for durable confirmation.
|
|
9486
|
+
*/
|
|
9487
|
+
private awaitDurableInterrupt;
|
|
9158
9488
|
/**
|
|
9159
9489
|
* Resume LangGraph execution from the last checkpoint.
|
|
9160
9490
|
*
|
|
@@ -9165,6 +9495,19 @@ declare class Agent {
|
|
|
9165
9495
|
private resumeGraphFromCheckpoint;
|
|
9166
9496
|
private waitingForQueueEnd;
|
|
9167
9497
|
private getQueueStore;
|
|
9498
|
+
/**
|
|
9499
|
+
* Resolves the shared lease store used to serialize thread runs across
|
|
9500
|
+
* Gateway replicas. Returns `undefined` when no lease store is registered so
|
|
9501
|
+
* single-process deployments keep running unconditionally.
|
|
9502
|
+
*/
|
|
9503
|
+
private getLeaseStore;
|
|
9504
|
+
/**
|
|
9505
|
+
* Releases this replica's thread-run ownership lease, if held.
|
|
9506
|
+
*
|
|
9507
|
+
* @remarks Safe to call from any definitive-stop path; a second call is a
|
|
9508
|
+
* no-op. The handle's unique holder makes a stale release harmless.
|
|
9509
|
+
*/
|
|
9510
|
+
private releaseThreadRunLease;
|
|
9168
9511
|
private getDefaultQueueConfig;
|
|
9169
9512
|
/**
|
|
9170
9513
|
* Override the thread's queue processing mode.
|
|
@@ -9227,6 +9570,21 @@ declare class Agent {
|
|
|
9227
9570
|
private finishQueueProcessor;
|
|
9228
9571
|
private scheduleQueueProcessorRetry;
|
|
9229
9572
|
private cancelQueueProcessorRetry;
|
|
9573
|
+
/**
|
|
9574
|
+
* Bounded re-attempt after losing the thread-run lease to a peer. Covers the
|
|
9575
|
+
* narrow window where the peer releases the lease without having observed a
|
|
9576
|
+
* just-enqueued message. Bounded so a genuinely long-held thread does not make
|
|
9577
|
+
* this replica poll forever — the owning replica's loop drains new messages.
|
|
9578
|
+
*/
|
|
9579
|
+
private scheduleThreadRunLeaseRetry;
|
|
9580
|
+
/**
|
|
9581
|
+
* Clears any pending thread-run lease retry and resets its backoff budget.
|
|
9582
|
+
*
|
|
9583
|
+
* @remarks Called on lease acquisition and on every definitive processor
|
|
9584
|
+
* stop so the next enqueue starts from the base delay. Never called on
|
|
9585
|
+
* continue/re-arm paths, which must preserve the bounded budget.
|
|
9586
|
+
*/
|
|
9587
|
+
private cancelThreadRunLeaseRetry;
|
|
9230
9588
|
private runQueueProcessor;
|
|
9231
9589
|
/**
|
|
9232
9590
|
* Remove pending message
|
|
@@ -9287,6 +9645,8 @@ declare class Agent {
|
|
|
9287
9645
|
* queue work must not start; `IDLE` and `ERROR` mean those rows were settled.
|
|
9288
9646
|
*/
|
|
9289
9647
|
resumeTask(): Promise<ResumeTaskResult>;
|
|
9648
|
+
/** Recovery body of {@link resumeTask}, executed while thread ownership is settled. */
|
|
9649
|
+
private resumeTaskLocked;
|
|
9290
9650
|
/**
|
|
9291
9651
|
* Fully abort all activity on this thread.
|
|
9292
9652
|
*
|
|
@@ -10505,6 +10865,12 @@ interface ReconcileStaleTaskRunsInput {
|
|
|
10505
10865
|
lifecycle: Pick<TaskLifecycleService, "failTask">;
|
|
10506
10866
|
/** Registry override (tests); defaults to {@link taskRunRegistry}. */
|
|
10507
10867
|
registry?: TaskRunRegistry;
|
|
10868
|
+
/**
|
|
10869
|
+
* Optional cross-replica liveness probe. When provided and it resolves true,
|
|
10870
|
+
* the task is treated as live and NOT converged (a peer replica owns it). A
|
|
10871
|
+
* rejection is also treated as live, so a probe error never converges a task.
|
|
10872
|
+
*/
|
|
10873
|
+
isTaskLive?: (task: TaskItem) => Promise<boolean>;
|
|
10508
10874
|
}
|
|
10509
10875
|
/** Result of {@link reconcileStaleTaskRuns}. */
|
|
10510
10876
|
interface ReconcileStaleTaskRunsResult {
|
|
@@ -10520,12 +10886,15 @@ interface ReconcileStaleTaskRunsResult {
|
|
|
10520
10886
|
/**
|
|
10521
10887
|
* Converges `in_progress` tasks that no live run holds to `failed(no_executor)`.
|
|
10522
10888
|
*
|
|
10523
|
-
* @param input Candidate tasks, actor, lifecycle, and optional
|
|
10889
|
+
* @param input Candidate tasks, actor, lifecycle, optional registry, and optional
|
|
10890
|
+
* cross-replica liveness probe.
|
|
10524
10891
|
* @returns The ids that were converged.
|
|
10525
10892
|
* @remarks
|
|
10526
10893
|
* The caller owns scope enumeration (a store cannot list across tenants). A task
|
|
10527
|
-
* is converged only when it is `in_progress
|
|
10528
|
-
*
|
|
10894
|
+
* is converged only when it is `in_progress`, absent from the process-local
|
|
10895
|
+
* registry, and (when `isTaskLive` is supplied) not reported live by the host's
|
|
10896
|
+
* cross-replica probe. The probe lets a host consult a durable lease so a peer
|
|
10897
|
+
* replica's live run is never mistaken for an orphan. An orphaned run is a
|
|
10529
10898
|
* mechanical failure, not a human-in-the-loop interruption, so it converges to
|
|
10530
10899
|
* `failed`, never `interrupted`.
|
|
10531
10900
|
*
|
|
@@ -10533,6 +10902,7 @@ interface ReconcileStaleTaskRunsResult {
|
|
|
10533
10902
|
* ```ts
|
|
10534
10903
|
* const { converged } = await reconcileStaleTaskRuns({
|
|
10535
10904
|
* tasks: scopeTasks, actor: "system:reconcile", lifecycle,
|
|
10905
|
+
* isTaskLive: async (task) => (await leaseStore.get(`task-run:${task.id}`)) !== null,
|
|
10536
10906
|
* });
|
|
10537
10907
|
* ```
|
|
10538
10908
|
*/
|
|
@@ -10557,22 +10927,33 @@ interface ReconcileTenantTaskRunsInput {
|
|
|
10557
10927
|
* generic reconciler never competes with a domain reconciler.
|
|
10558
10928
|
*/
|
|
10559
10929
|
include?: (task: TaskItem) => boolean;
|
|
10930
|
+
/**
|
|
10931
|
+
* Optional cross-replica liveness probe forwarded to
|
|
10932
|
+
* {@link reconcileStaleTaskRuns}. When provided and it resolves true, the
|
|
10933
|
+
* task is treated as live and NOT converged (a peer replica owns it). A
|
|
10934
|
+
* rejection is also treated as live, so a probe error never converges a task.
|
|
10935
|
+
*/
|
|
10936
|
+
isTaskLive?: (task: TaskItem) => Promise<boolean>;
|
|
10560
10937
|
}
|
|
10561
10938
|
/**
|
|
10562
10939
|
* Reconciles a tenant's orphaned `in_progress` tasks, converged to `failed`.
|
|
10563
10940
|
*
|
|
10564
|
-
* @param input Tenant, actor, store, lifecycle, optional registry and
|
|
10941
|
+
* @param input Tenant, actor, store, lifecycle, optional registry, predicate, and
|
|
10942
|
+
* cross-replica liveness probe.
|
|
10565
10943
|
* @returns The ids that were converged.
|
|
10566
10944
|
* @remarks
|
|
10567
10945
|
* Enumerates `{ tenantId, status: "in_progress" }` and delegates to
|
|
10568
10946
|
* {@link reconcileStaleTaskRuns}. The caller owns the `include` predicate; a
|
|
10569
|
-
* host must exclude task families that have their own reconciliation.
|
|
10947
|
+
* host must exclude task families that have their own reconciliation. The
|
|
10948
|
+
* optional `isTaskLive` probe is forwarded unchanged so the host can consult a
|
|
10949
|
+
* cross-replica lease.
|
|
10570
10950
|
*
|
|
10571
10951
|
* @example
|
|
10572
10952
|
* ```ts
|
|
10573
10953
|
* await reconcileTenantTaskRuns({
|
|
10574
10954
|
* tenantId, actor: "system:reconcile", taskStore, lifecycle,
|
|
10575
10955
|
* include: (task) => !isProjectLifecycleTask(task),
|
|
10956
|
+
* isTaskLive: async (task) => (await leaseStore.get(`task-run:${task.id}`)) !== null,
|
|
10576
10957
|
* });
|
|
10577
10958
|
* ```
|
|
10578
10959
|
*/
|
|
@@ -10595,21 +10976,31 @@ interface ReconcileAllTenantTaskRunsInput {
|
|
|
10595
10976
|
registry?: TaskRunRegistry;
|
|
10596
10977
|
/** Host predicate selecting which candidates this reconciler owns. */
|
|
10597
10978
|
include?: (task: TaskItem) => boolean;
|
|
10979
|
+
/**
|
|
10980
|
+
* Optional cross-replica liveness probe forwarded per tenant to
|
|
10981
|
+
* {@link reconcileTenantTaskRuns}. When provided and it resolves true, the
|
|
10982
|
+
* task is treated as live and NOT converged (a peer replica owns it). A
|
|
10983
|
+
* rejection is also treated as live, so a probe error never converges a task.
|
|
10984
|
+
*/
|
|
10985
|
+
isTaskLive?: (task: TaskItem) => Promise<boolean>;
|
|
10598
10986
|
}
|
|
10599
10987
|
/**
|
|
10600
10988
|
* Reconciles orphaned `in_progress` tasks across all tenants, converged to `failed`.
|
|
10601
10989
|
*
|
|
10602
|
-
* @param input Actor, tenant store, task store, lifecycle, optional registry
|
|
10990
|
+
* @param input Actor, tenant store, task store, lifecycle, optional registry,
|
|
10991
|
+
* predicate, and cross-replica liveness probe.
|
|
10603
10992
|
* @returns The ids that were converged across every tenant.
|
|
10604
10993
|
* @remarks Enumerates tenants via `listTenants()` and delegates per tenant to
|
|
10605
|
-
* {@link reconcileTenantTaskRuns}.
|
|
10606
|
-
*
|
|
10994
|
+
* {@link reconcileTenantTaskRuns}. The optional `isTaskLive` probe is forwarded
|
|
10995
|
+
* to every tenant so the host can consult a cross-replica lease. Intended for a
|
|
10996
|
+
* host startup/interval job; callers own when it runs.
|
|
10607
10997
|
*
|
|
10608
10998
|
* @example
|
|
10609
10999
|
* ```ts
|
|
10610
11000
|
* await reconcileAllTenantTaskRuns({
|
|
10611
11001
|
* actor: "system:reconcile", tenantStore, taskStore, lifecycle,
|
|
10612
11002
|
* include: (task) => !isProjectLifecycleTask(task),
|
|
11003
|
+
* isTaskLive: async (task) => (await leaseStore.get(`task-run:${task.id}`)) !== null,
|
|
10613
11004
|
* });
|
|
10614
11005
|
* ```
|
|
10615
11006
|
*/
|
|
@@ -10717,6 +11108,286 @@ declare class ExecutionAuthorityRegistry {
|
|
|
10717
11108
|
/** Process-global execution authority registry used by the immediate executor. */
|
|
10718
11109
|
declare const executionAuthorityRegistry: ExecutionAuthorityRegistry;
|
|
10719
11110
|
|
|
11111
|
+
/**
|
|
11112
|
+
* Returns the stable identity of this Gateway process.
|
|
11113
|
+
*
|
|
11114
|
+
* Resolution order: `AXIOM_REPLICA_ID` (trimmed, when non-empty), else
|
|
11115
|
+
* `<hostname>:<pid>`. Cached for the process lifetime so leases, run ownership,
|
|
11116
|
+
* and logs attribute consistently.
|
|
11117
|
+
*
|
|
11118
|
+
* @returns The replica id used by distributed leases and run ownership.
|
|
11119
|
+
*
|
|
11120
|
+
* @example
|
|
11121
|
+
* ```ts
|
|
11122
|
+
* import { getReplicaId } from "@axiom-lattice/core";
|
|
11123
|
+
* const owner = getReplicaId();
|
|
11124
|
+
* ```
|
|
11125
|
+
*
|
|
11126
|
+
* @remarks Multi-replica deployments SHOULD set `AXIOM_REPLICA_ID` to a stable
|
|
11127
|
+
* unique value (e.g. the pod name) so a restarted replica is distinguishable
|
|
11128
|
+
* from a concurrently running one; otherwise a restart can appear to still own
|
|
11129
|
+
* a lease it held before its pid/hostname changed.
|
|
11130
|
+
*/
|
|
11131
|
+
declare function getReplicaId(): string;
|
|
11132
|
+
/**
|
|
11133
|
+
* Test seam: clears the cached id so a changed env takes effect.
|
|
11134
|
+
*
|
|
11135
|
+
* @remarks Not part of the public runtime contract; call only from tests.
|
|
11136
|
+
*/
|
|
11137
|
+
declare function resetReplicaIdForTests(): void;
|
|
11138
|
+
|
|
11139
|
+
/**
|
|
11140
|
+
* Installs the process-wide coordination lease store.
|
|
11141
|
+
*
|
|
11142
|
+
* @param store A shared (PostgreSQL) lease store, or `undefined` to clear it.
|
|
11143
|
+
* @remarks Called once at the composition root (gateway startup) after stores
|
|
11144
|
+
* are configured. When unset, coordination mutexes keep their process-local
|
|
11145
|
+
* behavior only (single-process / tests).
|
|
11146
|
+
*/
|
|
11147
|
+
declare function configureCoordinationLeaseStore(store: LeaseStore | undefined): void;
|
|
11148
|
+
/** Returns the configured coordination lease store, if any. */
|
|
11149
|
+
declare function getCoordinationLeaseStore(): LeaseStore | undefined;
|
|
11150
|
+
|
|
11151
|
+
/** Raised when a lease could not be acquired within the bounded wait. */
|
|
11152
|
+
declare class LeaseAcquisitionTimeoutError extends Error {
|
|
11153
|
+
readonly key: string;
|
|
11154
|
+
readonly holder: string;
|
|
11155
|
+
readonly timeoutMs: number;
|
|
11156
|
+
/** Stable machine-readable code. */
|
|
11157
|
+
readonly code: "LEASE_ACQUISITION_TIMEOUT";
|
|
11158
|
+
/**
|
|
11159
|
+
* @param key Lease key that could not be acquired.
|
|
11160
|
+
* @param holder Unique holder that attempted acquisition.
|
|
11161
|
+
* @param timeoutMs How long the caller waited before giving up.
|
|
11162
|
+
*/
|
|
11163
|
+
constructor(key: string, holder: string, timeoutMs: number);
|
|
11164
|
+
}
|
|
11165
|
+
/** Tuning for {@link withLease}. */
|
|
11166
|
+
interface WithLeaseOptions {
|
|
11167
|
+
/** Lease time-to-live; must exceed the longest expected critical section. */
|
|
11168
|
+
ttlMs?: number;
|
|
11169
|
+
/** Bounded wait for acquisition before throwing. */
|
|
11170
|
+
acquireTimeoutMs?: number;
|
|
11171
|
+
/** Delay between acquisition attempts. */
|
|
11172
|
+
retryDelayMs?: number;
|
|
11173
|
+
/** Heartbeat interval; defaults to `ttlMs / 3` (min 1s). */
|
|
11174
|
+
heartbeatMs?: number;
|
|
11175
|
+
}
|
|
11176
|
+
/**
|
|
11177
|
+
* Runs `fn` under a distributed lease, heartbeating for the duration.
|
|
11178
|
+
*
|
|
11179
|
+
* @param store Lease store (PostgreSQL in multi-replica deployments).
|
|
11180
|
+
* @param key Lease key, e.g. `project-mutation:<tenant>:<project>`.
|
|
11181
|
+
* @param ownerLabel Stable owner label (e.g. `getReplicaId()`); a unique suffix
|
|
11182
|
+
* is appended per invocation so concurrent sections on the same replica still
|
|
11183
|
+
* serialize.
|
|
11184
|
+
* @param fn Critical section to run while holding the lease.
|
|
11185
|
+
* @param options TTL, acquisition timeout, retry, and heartbeat tuning.
|
|
11186
|
+
* @returns Whatever `fn` returns.
|
|
11187
|
+
*
|
|
11188
|
+
* @remarks
|
|
11189
|
+
* - Acquires with a per-invocation unique holder (`<ownerLabel>#<uuid>`), so two
|
|
11190
|
+
* concurrent calls on the same key serialize regardless of backend — both
|
|
11191
|
+
* within one replica and across replicas.
|
|
11192
|
+
* - Retries with a fixed delay until `acquireTimeoutMs`, then throws
|
|
11193
|
+
* {@link LeaseAcquisitionTimeoutError}.
|
|
11194
|
+
* - A heartbeat renews the lease while `fn` runs; a lost lease is not force-killed
|
|
11195
|
+
* (the work should be CAS/idempotent), and the heartbeat stops on completion.
|
|
11196
|
+
* - The lease is released in `finally`, including when `fn` throws.
|
|
11197
|
+
*
|
|
11198
|
+
* @example
|
|
11199
|
+
* ```ts
|
|
11200
|
+
* await withLease(leaseStore, `task-run:${taskId}`, getReplicaId(), () => run());
|
|
11201
|
+
* ```
|
|
11202
|
+
*/
|
|
11203
|
+
declare function withLease<T>(store: LeaseStore, key: string, ownerLabel: string, fn: () => Promise<T>, options?: WithLeaseOptions): Promise<T>;
|
|
11204
|
+
|
|
11205
|
+
/** Builds the canonical thread-run lease key. */
|
|
11206
|
+
declare function threadRunLeaseKey(tenantId: string, assistantId: string, threadId: string): string;
|
|
11207
|
+
/** A held thread-run lease; call `release()` when the processor stops. */
|
|
11208
|
+
interface ThreadRunLeaseHandle {
|
|
11209
|
+
/** True once the lease was lost to another holder (a heartbeat renew failed). */
|
|
11210
|
+
readonly lost: boolean;
|
|
11211
|
+
/** Releases the lease (no-op if already lost/taken over). */
|
|
11212
|
+
release(): Promise<void>;
|
|
11213
|
+
}
|
|
11214
|
+
/** Input for {@link tryAcquireThreadRun}. */
|
|
11215
|
+
interface TryAcquireThreadRunInput {
|
|
11216
|
+
/** Shared lease store (PostgreSQL in multi-replica deployments). */
|
|
11217
|
+
store: LeaseStore;
|
|
11218
|
+
tenantId: string;
|
|
11219
|
+
assistantId: string;
|
|
11220
|
+
threadId: string;
|
|
11221
|
+
/** Owner label, e.g. `getReplicaId()`. */
|
|
11222
|
+
owner: string;
|
|
11223
|
+
/** Lease TTL in milliseconds; must exceed one processing cycle's gaps. */
|
|
11224
|
+
ttlMs: number;
|
|
11225
|
+
/** Heartbeat interval; defaults to `ttlMs / 3` (min 1s). */
|
|
11226
|
+
heartbeatMs?: number;
|
|
11227
|
+
/** Invoked once (best-effort) when the lease is lost to another holder. */
|
|
11228
|
+
onLost?: () => void;
|
|
11229
|
+
}
|
|
11230
|
+
/**
|
|
11231
|
+
* Non-blocking acquire of a thread's run ownership lease.
|
|
11232
|
+
*
|
|
11233
|
+
* @param input Store, thread identity, owner, and TTL.
|
|
11234
|
+
* @returns A handle to release the lease, or `null` when another replica holds it.
|
|
11235
|
+
*
|
|
11236
|
+
* @remarks
|
|
11237
|
+
* - The holder is unique per call (`<owner>#<uuid>`), so lease release can never
|
|
11238
|
+
* remove another holder's lease (a stale release is a no-op).
|
|
11239
|
+
* - A heartbeat renews while held; the caller MUST call `release()` when the
|
|
11240
|
+
* processor stops so another replica can take over without waiting for expiry.
|
|
11241
|
+
* Once released, an in-flight renew that resolves `false` cannot flip `lost`
|
|
11242
|
+
* or fire `onLost` (a clean release is not a loss).
|
|
11243
|
+
* - When a heartbeat renew returns `false`, ownership has moved to another
|
|
11244
|
+
* holder: `handle.lost` flips true and `onLost` fires exactly once so the
|
|
11245
|
+
* caller can self-abort. This is a bounded mitigation only — a holder that is
|
|
11246
|
+
* CPU-blocked and resumes before the next detection can still write; it does
|
|
11247
|
+
* not fence such a zombie.
|
|
11248
|
+
*
|
|
11249
|
+
* @example
|
|
11250
|
+
* ```ts
|
|
11251
|
+
* const lease = await tryAcquireThreadRun({ store, tenantId, assistantId, threadId, owner: getReplicaId(), ttlMs: 60_000 });
|
|
11252
|
+
* if (!lease) return; // another replica owns this thread
|
|
11253
|
+
* try { await process(); } finally { await lease.release(); }
|
|
11254
|
+
* ```
|
|
11255
|
+
*/
|
|
11256
|
+
declare function tryAcquireThreadRun(input: TryAcquireThreadRunInput): Promise<ThreadRunLeaseHandle | null>;
|
|
11257
|
+
/** Input for {@link getThreadRunOwner}. */
|
|
11258
|
+
interface GetThreadRunOwnerInput {
|
|
11259
|
+
tenantId: string;
|
|
11260
|
+
assistantId: string;
|
|
11261
|
+
threadId: string;
|
|
11262
|
+
/** Test seam; defaults to the registered `default`/`lease` store. */
|
|
11263
|
+
store?: LeaseStore;
|
|
11264
|
+
}
|
|
11265
|
+
/**
|
|
11266
|
+
* Reads the replica that currently owns a thread's run, or `null` when the
|
|
11267
|
+
* thread is free (idle, completed, or the lease expired).
|
|
11268
|
+
*
|
|
11269
|
+
* @remarks
|
|
11270
|
+
* - The holder is `<owner>#<uuid>`; the returned value is the replica part.
|
|
11271
|
+
* - Best-effort: a missing store or read failure returns `null` (callers must
|
|
11272
|
+
* treat `null` as "cannot prove another owner", never as an error).
|
|
11273
|
+
*/
|
|
11274
|
+
declare function getThreadRunOwner(input: GetThreadRunOwnerInput): Promise<string | null>;
|
|
11275
|
+
|
|
11276
|
+
/** Builds the canonical task-run lease key. */
|
|
11277
|
+
declare function taskRunLeaseKey(taskId: string): string;
|
|
11278
|
+
/** A held task-run lease; call `release()` when the processor stops. */
|
|
11279
|
+
interface TaskRunLeaseHandle {
|
|
11280
|
+
/** True once the lease was lost to another holder (a heartbeat renew failed). */
|
|
11281
|
+
readonly lost: boolean;
|
|
11282
|
+
/** Releases the lease (no-op if already lost/taken over). */
|
|
11283
|
+
release(): Promise<void>;
|
|
11284
|
+
}
|
|
11285
|
+
/** Input for {@link tryAcquireTaskRun}. */
|
|
11286
|
+
interface TryAcquireTaskRunInput {
|
|
11287
|
+
/** Shared lease store (PostgreSQL in multi-replica deployments). */
|
|
11288
|
+
store: LeaseStore;
|
|
11289
|
+
taskId: string;
|
|
11290
|
+
/** Owner label, e.g. `getReplicaId()`. */
|
|
11291
|
+
owner: string;
|
|
11292
|
+
/** Lease TTL in milliseconds; must exceed one processing cycle's gaps. */
|
|
11293
|
+
ttlMs: number;
|
|
11294
|
+
/** Heartbeat interval; defaults to `ttlMs / 3` (min 1s). */
|
|
11295
|
+
heartbeatMs?: number;
|
|
11296
|
+
/** Invoked once (best-effort) when the lease is lost to another holder. */
|
|
11297
|
+
onLost?: () => void;
|
|
11298
|
+
}
|
|
11299
|
+
/**
|
|
11300
|
+
* Non-blocking acquire of a task's run ownership lease.
|
|
11301
|
+
*
|
|
11302
|
+
* @param input Store, task identity, owner, and TTL.
|
|
11303
|
+
* @returns A handle to release the lease, or `null` when another replica holds it.
|
|
11304
|
+
*
|
|
11305
|
+
* @remarks
|
|
11306
|
+
* - The holder is unique per call (`<owner>#<uuid>`), so lease release can never
|
|
11307
|
+
* remove another holder's lease (a stale release is a no-op).
|
|
11308
|
+
* - A heartbeat renews while held; the caller MUST call `release()` when the
|
|
11309
|
+
* processor stops so another replica can take over without waiting for expiry.
|
|
11310
|
+
* Once released, an in-flight renew that resolves `false` cannot flip `lost`
|
|
11311
|
+
* or fire `onLost` (a clean release is not a loss).
|
|
11312
|
+
* - When a heartbeat renew returns `false`, ownership has moved to another
|
|
11313
|
+
* holder: `handle.lost` flips true and `onLost` fires exactly once so the
|
|
11314
|
+
* caller can self-abort. This is a bounded mitigation only — a holder that is
|
|
11315
|
+
* CPU-blocked and resumes before the next detection can still write; it does
|
|
11316
|
+
* not fence such a zombie.
|
|
11317
|
+
*
|
|
11318
|
+
* @example
|
|
11319
|
+
* ```ts
|
|
11320
|
+
* const lease = await tryAcquireTaskRun({ store, taskId, owner: getReplicaId(), ttlMs: 60_000 });
|
|
11321
|
+
* if (!lease) return; // another replica owns this task
|
|
11322
|
+
* try { await process(); } finally { await lease.release(); }
|
|
11323
|
+
* ```
|
|
11324
|
+
*/
|
|
11325
|
+
declare function tryAcquireTaskRun(input: TryAcquireTaskRunInput): Promise<TaskRunLeaseHandle | null>;
|
|
11326
|
+
|
|
11327
|
+
/** Options for {@link runAsLeader}. */
|
|
11328
|
+
interface RunAsLeaderOptions {
|
|
11329
|
+
/** Owner label; defaults to {@link getReplicaId}. */
|
|
11330
|
+
owner?: string;
|
|
11331
|
+
/** Lease TTL in milliseconds (default 60_000). */
|
|
11332
|
+
ttlMs?: number;
|
|
11333
|
+
/**
|
|
11334
|
+
* When true, the lease is NOT released after `fn` — it is held until it
|
|
11335
|
+
* expires, so a replica that boots later in the same window also skips.
|
|
11336
|
+
* When false (default) the lease is released immediately after `fn`.
|
|
11337
|
+
*/
|
|
11338
|
+
hold?: boolean;
|
|
11339
|
+
}
|
|
11340
|
+
/** Outcome of {@link runAsLeader}. */
|
|
11341
|
+
interface RunAsLeaderResult<T> {
|
|
11342
|
+
/** Whether this caller won leadership and ran `fn`. */
|
|
11343
|
+
ran: boolean;
|
|
11344
|
+
/** The value returned by `fn`, when it ran. */
|
|
11345
|
+
result?: T;
|
|
11346
|
+
}
|
|
11347
|
+
/**
|
|
11348
|
+
* Runs `fn` on exactly one caller (non-blocking leader election).
|
|
11349
|
+
*
|
|
11350
|
+
* @param store Shared lease store (PostgreSQL in multi-replica deployments).
|
|
11351
|
+
* @param name Logical job name; leased as `leader:<name>`.
|
|
11352
|
+
* @param fn The one-shot critical work.
|
|
11353
|
+
* @param options Owner, TTL, and whether to hold the lease until expiry.
|
|
11354
|
+
* @returns `{ ran: true, result }` for the winner, `{ ran: false }` for the rest.
|
|
11355
|
+
*
|
|
11356
|
+
* @remarks
|
|
11357
|
+
* - Non-blocking: losers return immediately (they must not wait for the leader).
|
|
11358
|
+
* - The lease is heartbeated while `fn` runs, so an unbounded leader job cannot
|
|
11359
|
+
* let the lease lapse and admit a late second leader.
|
|
11360
|
+
* - The lease is released in `finally` unless `hold` is set.
|
|
11361
|
+
* - With the default in-memory lease store a single process always wins, so
|
|
11362
|
+
* single-process behavior is unchanged.
|
|
11363
|
+
*
|
|
11364
|
+
* @example
|
|
11365
|
+
* ```ts
|
|
11366
|
+
* const { ran } = await runAsLeader(leaseStore, "startup-recovery", () => recoverAll());
|
|
11367
|
+
* ```
|
|
11368
|
+
*/
|
|
11369
|
+
declare function runAsLeader<T>(store: LeaseStore, name: string, fn: () => Promise<T>, options?: RunAsLeaderOptions): Promise<RunAsLeaderResult<T>>;
|
|
11370
|
+
|
|
11371
|
+
/** Outbox topic carrying cross-replica plugin-catalog invalidation. */
|
|
11372
|
+
declare const PLUGIN_CATALOG_CHANGED_TOPIC = "plugin-catalog-changed";
|
|
11373
|
+
/**
|
|
11374
|
+
* Installs the process-wide outbox used to broadcast plugin-catalog invalidation.
|
|
11375
|
+
*
|
|
11376
|
+
* @param next Shared outbox + this replica id, or `undefined` to clear.
|
|
11377
|
+
* @remarks Called once at the composition root (gateway startup).
|
|
11378
|
+
*/
|
|
11379
|
+
declare function configurePluginCatalogSync(next: {
|
|
11380
|
+
outbox: OutboxStore;
|
|
11381
|
+
owner: string;
|
|
11382
|
+
} | undefined): void;
|
|
11383
|
+
/**
|
|
11384
|
+
* Best-effort broadcast that a tenant's plugin catalog changed.
|
|
11385
|
+
*
|
|
11386
|
+
* @param tenantId Tenant whose catalog was reloaded.
|
|
11387
|
+
* @remarks Never throws: a miss is corrected by the 30s catalog TTL.
|
|
11388
|
+
*/
|
|
11389
|
+
declare function publishPluginCatalogChanged(tenantId: string): Promise<void>;
|
|
11390
|
+
|
|
10720
11391
|
declare const AGENT_TASK_EVENT = "agent:execute";
|
|
10721
11392
|
|
|
10722
11393
|
/**
|
|
@@ -11067,6 +11738,8 @@ interface SandboxRunConfig {
|
|
|
11067
11738
|
workspaceId?: string;
|
|
11068
11739
|
/** Project that scopes the run. */
|
|
11069
11740
|
projectId?: string;
|
|
11741
|
+
/** Current orchestration depth; nested mints pass depth+1. */
|
|
11742
|
+
depth?: number;
|
|
11070
11743
|
}
|
|
11071
11744
|
/**
|
|
11072
11745
|
* Resolves a `SandboxInstance` for the given run identity.
|
|
@@ -11527,6 +12200,90 @@ declare function resolveTenantPluginSkill(tenantId: string, owner: string, skill
|
|
|
11527
12200
|
*/
|
|
11528
12201
|
declare function resolveEnabledPluginSkill(owner: string | undefined, skillName: string, enabledDefinition: PluginSkillDefinition | undefined, tenantId: string | undefined): Promise<ResolvedPluginSkill | undefined>;
|
|
11529
12202
|
|
|
12203
|
+
/**
|
|
12204
|
+
* Versioned provisioning of the Open MCP client bundle into a sandbox volume.
|
|
12205
|
+
*
|
|
12206
|
+
* Writes the built zero-dependency client + CLI as **raw bundle files** under
|
|
12207
|
+
* `/root/.agents/sdk/open-mcp-client` (plus a version manifest at
|
|
12208
|
+
* `/root/.agents/sdk/.open-client-manifest.json`). Sandbox code can load the
|
|
12209
|
+
* entry point by absolute path, e.g.
|
|
12210
|
+
* `require("/root/.agents/sdk/open-mcp-client/index.js")`.
|
|
12211
|
+
*
|
|
12212
|
+
* @remarks
|
|
12213
|
+
* This helper only writes files. `NODE_PATH`/`PATH` resolution is **not**
|
|
12214
|
+
* configured here: a consumer (a prebuilt image, or the caller after
|
|
12215
|
+
* provisioning) must expose the directory on `NODE_PATH` (for bare module
|
|
12216
|
+
* resolution) or `PATH` (for the `cli.js` shim, which keeps its
|
|
12217
|
+
* `#!/usr/bin/env node` shebang). The bundle is not laid out as a scoped
|
|
12218
|
+
* `node_modules/@axiom-lattice/...` tree, so do NOT advertise
|
|
12219
|
+
* `require("@axiom-lattice/open-mcp-client")` or a bare `NODE_PATH` pointing at
|
|
12220
|
+
* `/root/.agents/sdk/node_modules` unless that layout is created too.
|
|
12221
|
+
*/
|
|
12222
|
+
/** Minimal sandbox file surface required for provisioning. */
|
|
12223
|
+
interface ProvisionFileSink {
|
|
12224
|
+
/**
|
|
12225
|
+
* Create a directory (recursively) inside the sandbox volume.
|
|
12226
|
+
*
|
|
12227
|
+
* @param path - Absolute sandbox path to create.
|
|
12228
|
+
* @returns A promise resolved after the directory exists.
|
|
12229
|
+
*/
|
|
12230
|
+
createDirectory(path: string): Promise<void>;
|
|
12231
|
+
/**
|
|
12232
|
+
* Write a UTF-8 text file inside the sandbox volume.
|
|
12233
|
+
*
|
|
12234
|
+
* @param path - Absolute sandbox path to write.
|
|
12235
|
+
* @param content - File contents.
|
|
12236
|
+
* @returns A promise resolved after the file is written.
|
|
12237
|
+
*/
|
|
12238
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
12239
|
+
}
|
|
12240
|
+
/** Bundle contents to provision. */
|
|
12241
|
+
interface SandboxOpenClientBundle {
|
|
12242
|
+
/** Built CommonJS entry point, loaded by absolute path in the sandbox. */
|
|
12243
|
+
indexJs: string;
|
|
12244
|
+
/** Executable CLI source, invoked as `node cli.js`. */
|
|
12245
|
+
cliJs: string;
|
|
12246
|
+
/** Package version recorded in the sandbox manifest. */
|
|
12247
|
+
version: string;
|
|
12248
|
+
}
|
|
12249
|
+
/**
|
|
12250
|
+
* Write the Open MCP client bundle into the sandbox at `/root/.agents/sdk`.
|
|
12251
|
+
*
|
|
12252
|
+
* Idempotent: rewrites the same paths.
|
|
12253
|
+
*
|
|
12254
|
+
* @param sandbox - Sandbox whose volume receives the bundle.
|
|
12255
|
+
* @param bundle - Client JS/CLI source and version.
|
|
12256
|
+
* @returns A promise resolved after the files and manifest are written.
|
|
12257
|
+
*
|
|
12258
|
+
* @example
|
|
12259
|
+
* ```ts
|
|
12260
|
+
* await provisionSandboxOpenClient(sandbox, {
|
|
12261
|
+
* indexJs: 'module.exports = { createClient };',
|
|
12262
|
+
* cliJs: '#!/usr/bin/env node\n// ...',
|
|
12263
|
+
* version: "0.1.0",
|
|
12264
|
+
* });
|
|
12265
|
+
* // sandbox code loads it by absolute path:
|
|
12266
|
+
* // const client = require("/root/.agents/sdk/open-mcp-client/index.js");
|
|
12267
|
+
* ```
|
|
12268
|
+
*
|
|
12269
|
+
* @remarks
|
|
12270
|
+
* The version manifest is written last, so its presence means the JS files were
|
|
12271
|
+
* written first. This only writes raw bundle files; consumers load `index.js` by
|
|
12272
|
+
* absolute path and must add the directory to `PATH` themselves to run `cli.js`.
|
|
12273
|
+
* No scoped `node_modules` tree is created.
|
|
12274
|
+
*/
|
|
12275
|
+
declare function provisionSandboxOpenClient(sandbox: {
|
|
12276
|
+
file: ProvisionFileSink;
|
|
12277
|
+
}, bundle: SandboxOpenClientBundle): Promise<void>;
|
|
12278
|
+
/**
|
|
12279
|
+
* Build a bundle from an installed package's built files.
|
|
12280
|
+
*
|
|
12281
|
+
* @param distDir - Directory containing `index.js` and `cli.js`.
|
|
12282
|
+
* @param version - Package version to record in the manifest.
|
|
12283
|
+
* @returns The bundle.
|
|
12284
|
+
*/
|
|
12285
|
+
declare function buildBundleFromDist(distDir: string, version: string): SandboxOpenClientBundle;
|
|
12286
|
+
|
|
11530
12287
|
/** Stable failure codes emitted when capability bundles cannot be composed. */
|
|
11531
12288
|
type CapabilityBundleMergeErrorCode = "CAPABILITY_BUNDLE_DUPLICATE_ID" | "CAPABILITY_BUNDLE_EMPTY_ALLOWED_TOOLS" | "CAPABILITY_BUNDLE_INVALID_CONFIG" | "CAPABILITY_BUNDLE_NULL_VALUE" | "CAPABILITY_BUNDLE_UNSAFE_KEY";
|
|
11532
12289
|
/** Describes invalid capability bundle input rejected by the pure merger. */
|
|
@@ -12672,4 +13429,4 @@ declare function parseDirectRoomType(projectId: string): "human" | "bot" | null;
|
|
|
12672
13429
|
*/
|
|
12673
13430
|
declare function isDirectRoom(projectId: string): boolean;
|
|
12674
13431
|
|
|
12675
|
-
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, type AssignTaskOwnerInput, BUILTIN_PLUGINS, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BeginRunFailure, type BeginRunInput, type BeginRunResult, type BeginRunSuccess, type BufferStats, CAPABILITY_TOOL_NAME_CONFLICT, type CacheEntry, type CalibrationProbe, CapabilityBundleMergeError, type CapabilityBundleMergeErrorCode, CapabilityBundleMerger, CapabilityBundleValidationError, type CapabilityBundleValidationErrorCode, type CapabilityGuardDenialCode, type CapabilityResourceSelector, type CapabilityToolMetadata, CapabilityToolNameConflictError, CapabilityToolRegistry, type CaseRunResult, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, CollectionLatticeManager, type ColumnInfo, type CompileSandboxPluginArgs, CompositeBackend, type ConflictItem, type ConnectAllChannelsOptions, ConnectionRegistry, ConsoleLoggerClient, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, DEFAULT_CALIBRATION_PROBES, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_DELAY_MS, DEFAULT_MAX_ATTEMPTS, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, DelegatedScopeNotQueueableError, type DeleteResult, DependencyResolver, type DispatchPreparation, DuplicateProjectRoomMessageIdempotencyKeyError, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsInfo, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type EvalRunService, type ExecutionAuthority, ExecutionAuthorityRegistry, type ExportBundle, type ExportContext, type ExportJob, type ExportableEntity, type ExportableEntityDefinition, ExportableEntityRegistry, type ExportableFile, type ExportableTypeInfo, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, HEALTH_CHECK_INTERVAL_MS, HEALTH_CHECK_TIMEOUT_MS, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, IdRemapper, type ImmediateDispatchPlan, type ImportApplyResolution, type ImportApplyResult, type ImportEntityResult, type ImportEntityStatus, type ImportPreviewResult, InMemoryA2AApiKeyStore, InMemoryAgentWebAppStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryCapabilityBundleStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryCollectionStore, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryModelProviderStore, InMemoryOpenAuditStore, InMemoryProjectBotMembershipStore, InMemoryProjectMembershipStore, InMemoryProjectRoomCoordinator, InMemoryProjectRoomMessageStore, InMemoryProjectRoomReadStateStore, InMemoryProjectRoomStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTaskWorkItemStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserPushSubscriptionStore, InMemoryUserStore, InMemoryUserTenantLinkStore, type InsertionItem, type JudgeVerdict, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LatticeAgentStepConfig, LatticeEval, type LatticeEvalBatchReport, type LatticeEvalCase, type LatticeEvalCaseType, type LatticeEvalCaseWithTemplate, type LatticeEvalConfig, type LatticeEvalLogEvent, type LatticeEvalLogLevel, LatticeEvalProject, type LatticeEvalProjectType, type LatticeEvalResult, type LatticeEvalRubric, LatticeEvalSuite, type LatticeEvalSuiteType, type LatticeEvalTemplate, type LifecycleResult, type LifecycleWarning, LocalSandboxInstance, LocalSandboxProvider, type LocalSandboxProviderConfig, type LoggerLattice, LoggerLatticeManager, type LoopBreakerConfig, MAX_BACKOFF_MS, MAX_LINE_LENGTH, MAX_PACK_ENTRIES, MAX_PACK_FILE_BYTES, MAX_PACK_TOTAL_BYTES, type MailboxMessage, type MailboxStore, ManagedTaskStartError, type ManagedTaskStartOptions, type ManifestValidationResult, type McpClientFactory, type McpClientLike, type McpClientSession, type McpConnectionOptions, McpLatticeManager, type McpRegisterOptions, type McpServerId, type McpServerRuntime, type McpServerState, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MergedPluginSkills, type MessageCompletedEvent, type MessageContent, type MessageContentPart, type MessageContentValue, type MessageFailedEvent, type MessageInterruptedEvent, type MessageLike, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type OutputType, PACK_DIRECTORY_TIMEOUT_SECONDS, type PackSourceInfo, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, type PluginConnectionScope, PluginRegistry, type PostProcessTaskMutationResponseInput, PostgresDatabase, type PreviewError, ProjectBotMembershipIdConflictError, ProjectMutationMutex, type ProjectMutationScope, ProjectRoomMessageIdConflictError, type ProjectTaskAdmissionListener, type ProjectTaskAdmissionNotification, ProjectTaskAdmissionNotifier, type ProjectTaskAdmissionNotifierOptions, type ProjectTaskAssignmentScope, ProjectTaskOwnerPolicy, type ProjectTaskOwnerPolicyCode, ProjectTaskOwnerPolicyError, type ProjectTaskReassignmentAuthorization, type ProjectTaskReassignmentAuthorizationInput, type ProjectTaskReassignmentAuthorizer, type ProjectTaskReassignmentThreadValidationInput, type ProjectTaskReassignmentThreadValidator, type ProjectTaskRosterScope, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, type QueueMessage, QueueMode, type QueuePendingEvent, type QueueScope, ROOM_COORDINATOR_KEY, type ReassignProjectTaskInput, type ReconcileAllTenantTaskRunsInput, type ReconcileStaleTaskRunsInput, type ReconcileStaleTaskRunsResult, type ReconcileTaskDescriptionInput, type ReconcileTenantTaskRunsInput, type RejectInterruptedTaskInput, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type RepeatedToolCallBreakerOptions, RepeatedToolCallError, type ReplyReadyEvent, type Resolution, type ResolutionAction, type ResolveAgentFn, type ResolvedConfig, type ResolvedPluginConnection, type ResolvedPluginSkill, type ResumeTaskResult, type RoomAgentMessageCallbackFailure, type RoomAgentMessageCommitted, type RoomAgentMessageInput, RoomAgentMessageService, type RoomAgentReplyInput, type RunSandboxConfig, type RuntimeModelConfig, type RuntimeSkillSelection, SAFE_PATH_COMPONENT, type STTModelInfo, STTModelLattice, type STTModelLatticeInterface, STTModelLatticeManager, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxGrepMatch, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, SandboxPluginExecutor, type SandboxPluginExecutorDeps, type SandboxPluginInvokeArgs, type SandboxPluginResult, type SandboxProvider, type SandboxProviderFactory, type SandboxProviderType, type SandboxResolver, type SandboxRunConfig, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SettleRunInput, type SettleRunOutcome, type SharePayload, SimpleMemoryVectorStore, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StartLifecycleResult, type StartTaskExecutionInput, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, type SubmitTaskReviewInput, TASK_RESPONSE_FINAL_WARNING_LIMIT, TASK_RESPONSE_PRIOR_WARNING_LIMIT, TASK_RESPONSE_SCALAR_MAX_BYTES, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskAgentInvocation, type TaskEvent, type TaskExecutionFailure, type TaskExecutionManaged, type TaskExecutionResult, type TaskExecutionServiceDeps, type TaskExecutionSuccess, type TaskLifecycleListener, type TaskLifecycleNotification, TaskLifecycleNotifier, TaskLifecycleService, type TaskLifecycleServiceDeps, type TaskListStore, type TaskResponseParseResult, type TaskRunBridge, type TaskRunBridgeDeps, TaskRunBridgeStoresRequiredError, TaskRunRegistry, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, TenantPluginCatalog, type TenantPluginCatalogDeps, type TenantPlugins, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadEndCode, ThreadEndError, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TransferOwnerInput, type TransferOwnerResult, type TrustedAgentMessageDispatcher, type TrustedMessageOptions, type UnknownToolHandlerConfig, UnsafeUpstreamUrlError, type UnsafeUrlReason, type ValidateManifestArgs, type VectorStoreLatticeInterface, VectorStoreLatticeManager, type VectorStoreProviderLattice, VectorStoreProviderManager, VolumeFilesystem, type VolumeFsClient, type WorkflowValidationError, type WriteResult, abortWorkflowRun, agentInstanceManager, agentLatticeManager, appendReconciliationWarning, appendUiFence, assertSafeUpstreamUrl, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildRemotePackDirectoryCommand, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, buildTableName, buildTaskMutationFallback, buildTaskNormalizationFallback, checkEmptyContent, clearEncryptionKeyCache, clearEvalRunService, collectionLatticeManager, compileInternal, compileSandboxPlugin, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, convertToConnection, createAgentNode, createAgentTeam, createCapabilityGuardMiddleware, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createProjectRoomMiddleware, createProjectTaskOwnerPolicy, createProjectTaskReassignmentAuthorizer, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createRepeatedToolCallBreakerMiddleware, createResourceAddress, createSandboxProvider, createSandboxResolver, createSchedulerMiddleware, createSharePayload, createTaskExecutionService, createTaskLifecycleService, createTaskMiddleware, createTaskRunBridge, createTeamMiddleware, createTeammateTools, createTrustedAgentMessageDispatcher, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, documentLearningPlugin, documentParserPlugin, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, ensurePluginSkillInSandbox, evaluateLatticeCaseWithLogs, eventBus, eventBus as eventBusDefault, executionAuthorityRegistry, extractAppsRef, extractFetcherError, extractLegacyRefs, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, generateDirectBotProjectId, generateDirectHumanProjectId, generateToken, getAgentClient, getAgentClientAsync, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getCollectionEntryCount, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getEvalRunService, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getOrCreateCollectionVectorStore, getPluginSkillManifestVersion, getQueueLattice, getRuntimeCapabilityConfig, getRuntimeSkillSelection, getSTTClient, getSTTClientWithTenant, getSTTModelLattice, getSandBoxManager, getSandboxPluginCatalog, getScheduleLattice, getStoreLattice, getToolClient, getToolClientWithTenant, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, getVectorStoreProvider, getWorkflowSignal, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, hasDelegatedWorkerToken, hasRuntimeCapabilityPolicy, invokeWithRetry, isBuiltInSkill, isDirectRoom, isMcpConnectionError, isPluginSkillAuthorizedInSandbox, isPluginSkillManagedInSandbox, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, jsonSchemaToZod, listCollectionEntries, listSandboxProviderTypes, loggerLatticeManager, mcpManager, mergeCapabilityBundles, mergePluginSkills, mergePluginSources, metricsServerManager, modelLatticeManager, nextBackoffDelay, normalizeSandboxName, ownTaskResponseField, parallelLimit, parseCronExpression, parseDirectRoomType, parseJudgeVerdict, parsePackSize, parseSkillFrontmatter, parseTaskResponse, parseYaml, performStringReplacement, postProcessTaskMutationResponse, prepareTaskDispatch, projectMutationMutex, projectRoomPlugin, projectTaskAdmissionNotifier, queueLatticeManager, readLoopBreakerConfig, reconcileAllTenantTaskRuns, reconcileStaleTaskRuns, reconcileTenantTaskRuns, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerExistingToolWithTenant, registerLoggerLattice, registerModelLattice, registerModelLatticeForTenant, registerQueueLattice, registerSTTModelLattice, registerSandboxProviderType, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, registerVectorStoreProvider, registerWorkflowRun, removeCollectionVectorStore, renderTemplate, resolveEnabledPluginSkill, resolveJudgeModelKey, resolvePath, resolvePluginConnections, resolveSandboxPluginConnections, resolveTenantPluginSkill, roomCoordinatorConfig, runRemotePackDirectory, safeTaskResponseId, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, serializePluginMeta, serializeTaskMutationSuccess, serializeTaskNormalizationFallback, serializeTaskReadResponse, setBindingRegistry, setEvalRunService, setMenuRegistry, setSandboxPluginCatalog, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, sttModelLatticeManager, taskLifecycleNotifier, taskRunRegistry, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, unregisterWorkflowRun, updateFileData, validateAgentInput, validateCapabilityBundleInput, validateDSL, validateEncryptionKey, validatePackSourcePath, validatePath, validateRelativePath, validateSandboxPluginManifest, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager, withTimeout, wrapMcpToolWithUi };
|
|
13432
|
+
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, type AssignTaskOwnerInput, BUILTIN_PLUGINS, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BeginRunFailure, type BeginRunInput, type BeginRunResult, type BeginRunSuccess, type BufferStats, CAPABILITY_TOOL_NAME_CONFLICT, type CacheEntry, type CalibrationProbe, CapabilityBundleMergeError, type CapabilityBundleMergeErrorCode, CapabilityBundleMerger, CapabilityBundleValidationError, type CapabilityBundleValidationErrorCode, type CapabilityGuardDenialCode, type CapabilityResourceSelector, type CapabilityToolMetadata, CapabilityToolNameConflictError, CapabilityToolRegistry, type CaseRunResult, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, type ClaimMessagesOptions, CollectionLatticeManager, type ColumnInfo, type CompileSandboxPluginArgs, CompositeBackend, type ConflictItem, type ConnectAllChannelsOptions, ConnectionRegistry, ConsoleLoggerClient, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, DEFAULT_CALIBRATION_PROBES, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_DELAY_MS, DEFAULT_MAX_ATTEMPTS, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, DelegatedScopeNotQueueableError, type DeleteResult, DependencyResolver, type DispatchPreparation, DuplicateProjectRoomMessageIdempotencyKeyError, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsInfo, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type EvalRunService, type ExecutionAuthority, ExecutionAuthorityRegistry, type ExportBundle, type ExportContext, type ExportJob, type ExportableEntity, type ExportableEntityDefinition, ExportableEntityRegistry, type ExportableFile, type ExportableTypeInfo, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GetThreadRunOwnerInput, type GrepMatch, HEALTH_CHECK_INTERVAL_MS, HEALTH_CHECK_TIMEOUT_MS, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, IdRemapper, type ImmediateDispatchPlan, type ImportApplyResolution, type ImportApplyResult, type ImportEntityResult, type ImportEntityStatus, type ImportPreviewResult, InMemoryA2AApiKeyStore, InMemoryAgentWebAppStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryCapabilityBundleStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryCollectionStore, InMemoryDatabaseConfigStore, InMemoryLeaseStore, InMemoryMailboxStore, InMemoryMenuStore, InMemoryModelProviderStore, InMemoryOpenAuditStore, InMemoryOutboxStore, InMemoryProjectBotMembershipStore, InMemoryProjectMembershipStore, InMemoryProjectRoomCoordinator, InMemoryProjectRoomMessageStore, InMemoryProjectRoomReadStateStore, InMemoryProjectRoomStore, InMemoryTaskListStore, InMemoryTaskStore, InMemoryTaskWorkItemStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserPushSubscriptionStore, InMemoryUserStore, InMemoryUserTenantLinkStore, type InsertionItem, type JudgeVerdict, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LatticeAgentStepConfig, LatticeEval, type LatticeEvalBatchReport, type LatticeEvalCase, type LatticeEvalCaseType, type LatticeEvalCaseWithTemplate, type LatticeEvalConfig, type LatticeEvalLogEvent, type LatticeEvalLogLevel, LatticeEvalProject, type LatticeEvalProjectType, type LatticeEvalResult, type LatticeEvalRubric, LatticeEvalSuite, type LatticeEvalSuiteType, type LatticeEvalTemplate, LeaseAcquisitionTimeoutError, type LifecycleResult, type LifecycleWarning, LocalSandboxInstance, LocalSandboxProvider, type LocalSandboxProviderConfig, type LoggerLattice, LoggerLatticeManager, type LoopBreakerConfig, MAX_BACKOFF_MS, MAX_LINE_LENGTH, MAX_PACK_ENTRIES, MAX_PACK_FILE_BYTES, MAX_PACK_TOTAL_BYTES, type MailboxMessage, type MailboxStore, ManagedTaskStartError, type ManagedTaskStartOptions, type ManifestValidationResult, type McpClientFactory, type McpClientLike, type McpClientSession, type McpConnectionOptions, McpLatticeManager, type McpRegisterOptions, type McpServerId, type McpServerRuntime, type McpServerState, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MergedPluginSkills, type MessageCompletedEvent, type MessageContent, type MessageContentPart, type MessageContentValue, type MessageFailedEvent, type MessageInterruptedEvent, type MessageLike, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, OutboxPoller, type OutboxPollerDeps, type OutputType, PACK_DIRECTORY_TIMEOUT_SECONDS, PLATFORM_SECRET_ENV_VARS, PLUGIN_CATALOG_CHANGED_TOPIC, type PackSourceInfo, type PendingMessage, PersonalAssistantConfig, PinoLoggerClient, type PluginConnectionScope, PluginRegistry, type PostProcessTaskMutationResponseInput, PostgresDatabase, type PreviewError, ProjectBotMembershipIdConflictError, ProjectMutationMutex, type ProjectMutationScope, ProjectRoomMessageIdConflictError, type ProjectTaskAdmissionListener, type ProjectTaskAdmissionNotification, ProjectTaskAdmissionNotifier, type ProjectTaskAdmissionNotifierOptions, type ProjectTaskAssignmentScope, ProjectTaskOwnerPolicy, type ProjectTaskOwnerPolicyCode, ProjectTaskOwnerPolicyError, type ProjectTaskReassignmentAuthorization, type ProjectTaskReassignmentAuthorizationInput, type ProjectTaskReassignmentAuthorizer, type ProjectTaskReassignmentThreadValidationInput, type ProjectTaskReassignmentThreadValidator, type ProjectTaskRosterScope, PrometheusClient, type ProvisionFileSink, type QueryResult, type QueueLattice, QueueLatticeManager, type QueueMessage, QueueMode, type QueuePendingEvent, type QueueScope, ROOM_COORDINATOR_KEY, type ReassignProjectTaskInput, type ReconcileAllTenantTaskRunsInput, type ReconcileStaleTaskRunsInput, type ReconcileStaleTaskRunsResult, type ReconcileTaskDescriptionInput, type ReconcileTenantTaskRunsInput, type RejectInterruptedTaskInput, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type RepeatedToolCallBreakerOptions, RepeatedToolCallError, type ReplyReadyEvent, type Resolution, type ResolutionAction, type ResolveAgentFn, type ResolvedConfig, type ResolvedPluginConnection, type ResolvedPluginSkill, type ResumeTaskResult, type RoomAgentMessageCallbackFailure, type RoomAgentMessageCommitted, type RoomAgentMessageInput, RoomAgentMessageService, type RoomAgentReplyInput, type RunAsLeaderOptions, type RunAsLeaderResult, type RunSandboxConfig, type RuntimeModelConfig, type RuntimeSkillSelection, SAFE_PATH_COMPONENT, SANDBOX_OPEN_GATEWAY_URL_ENV, SANDBOX_OPEN_TOKEN_ENV, type STTModelInfo, STTModelLattice, type STTModelLatticeInterface, STTModelLatticeManager, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxGrepMatch, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxOpenClientBundle, type SandboxOpenCredential, type SandboxOpenCredentialContext, type SandboxOpenCredentialProvider, type SandboxOpenCredentialProviderOptions, SandboxPluginExecutor, type SandboxPluginExecutorDeps, type SandboxPluginInvokeArgs, type SandboxPluginResult, type SandboxProvider, type SandboxProviderFactory, type SandboxProviderType, type SandboxResolver, type SandboxRunConfig, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SettleRunInput, type SettleRunOutcome, type SharePayload, SimpleMemoryVectorStore, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StartLifecycleResult, type StartTaskExecutionInput, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, type SubmitTaskReviewInput, TASK_RESPONSE_FINAL_WARNING_LIMIT, TASK_RESPONSE_PRIOR_WARNING_LIMIT, TASK_RESPONSE_SCALAR_MAX_BYTES, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskAgentInvocation, type TaskEvent, type TaskExecutionFailure, type TaskExecutionManaged, type TaskExecutionResult, type TaskExecutionServiceDeps, type TaskExecutionSuccess, type TaskLifecycleListener, type TaskLifecycleNotification, TaskLifecycleNotifier, TaskLifecycleService, type TaskLifecycleServiceDeps, type TaskListStore, type TaskResponseParseResult, type TaskRunBridge, type TaskRunBridgeDeps, TaskRunBridgeStoresRequiredError, type TaskRunLeaseHandle, TaskRunRegistry, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, TenantPluginCatalog, type TenantPluginCatalogDeps, type TenantPlugins, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadEndCode, ThreadEndError, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadRunLeaseHandle, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, TokenCache, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TransferOwnerInput, type TransferOwnerResult, type TrustedAgentMessageDispatcher, type TrustedMessageOptions, type TryAcquireTaskRunInput, type TryAcquireThreadRunInput, type UnknownToolHandlerConfig, UnsafeUpstreamUrlError, type UnsafeUrlReason, type ValidateManifestArgs, type VectorStoreLatticeInterface, VectorStoreLatticeManager, type VectorStoreProviderLattice, VectorStoreProviderManager, VolumeFilesystem, type VolumeFsClient, type WithLeaseOptions, type WorkflowValidationError, type WriteResult, abortWorkflowRun, agentInstanceManager, agentLatticeManager, appendReconciliationWarning, appendUiFence, assertSafeUpstreamUrl, buildBundleFromDist, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildRemotePackDirectoryCommand, buildSandboxMetadataEnv, buildSandboxOpenEnv, buildSkillFile, buildStateAnnotation, buildTableName, buildTaskMutationFallback, buildTaskNormalizationFallback, checkEmptyContent, clearEncryptionKeyCache, clearEvalRunService, clearSandboxOpenCredentialProviderForTests, collectionLatticeManager, compileInternal, compileSandboxPlugin, compileWorkflow, computeSandboxName, configureCoordinationLeaseStore, configurePluginCatalogSync, configureStores, connectAllChannels, convertToConnection, createAgentNode, createAgentTeam, createCapabilityGuardMiddleware, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createProjectRoomMiddleware, createProjectTaskOwnerPolicy, createProjectTaskReassignmentAuthorizer, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createRepeatedToolCallBreakerMiddleware, createResourceAddress, createSandboxProvider, createSandboxResolver, createSchedulerMiddleware, createSharePayload, createShellExecTool, createTaskExecutionService, createTaskLifecycleService, createTaskMiddleware, createTaskRunBridge, createTeamMiddleware, createTeammateTools, createTrustedAgentMessageDispatcher, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, documentLearningPlugin, documentParserPlugin, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, ensurePluginSkillInSandbox, evaluateLatticeCaseWithLogs, eventBus, eventBus as eventBusDefault, executionAuthorityRegistry, extractAppsRef, extractFetcherError, extractLegacyRefs, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, generateDirectBotProjectId, generateDirectHumanProjectId, generateToken, getAgentClient, getAgentClientAsync, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getCollectionEntryCount, getCoordinationLeaseStore, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getEvalRunService, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getOrCreateCollectionVectorStore, getPluginSkillManifestVersion, getQueueLattice, getReplicaId, getRuntimeCapabilityConfig, getRuntimeSkillSelection, getSTTClient, getSTTClientWithTenant, getSTTModelLattice, getSandBoxManager, getSandboxOpenCredential, getSandboxPluginCatalog, getScheduleLattice, getStoreLattice, getThreadRunOwner, getToolClient, getToolClientWithTenant, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, getVectorStoreProvider, getWorkflowSignal, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, hasDelegatedWorkerToken, hasRuntimeCapabilityPolicy, invokeWithRetry, isBuiltInSkill, isDirectRoom, isMcpConnectionError, isPluginSkillAuthorizedInSandbox, isPluginSkillManagedInSandbox, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, jsonSchemaToZod, listCollectionEntries, listSandboxProviderTypes, loggerLatticeManager, mcpManager, mergeCapabilityBundles, mergePluginSkills, mergePluginSources, metricsServerManager, modelLatticeManager, nextBackoffDelay, normalizeSandboxName, ownTaskResponseField, parallelLimit, parseCronExpression, parseDirectRoomType, parseJudgeVerdict, parsePackSize, parseSkillFrontmatter, parseTaskResponse, parseYaml, performStringReplacement, postProcessTaskMutationResponse, prepareTaskDispatch, projectMutationMutex, projectRoomPlugin, projectTaskAdmissionNotifier, provisionSandboxOpenClient, publishPluginCatalogChanged, queueLatticeManager, readLoopBreakerConfig, reconcileAllTenantTaskRuns, reconcileStaleTaskRuns, reconcileTenantTaskRuns, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerExistingToolWithTenant, registerLoggerLattice, registerModelLattice, registerModelLatticeForTenant, registerQueueLattice, registerSTTModelLattice, registerSandboxOpenCredentialProvider, registerSandboxProviderType, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, registerVectorStoreProvider, registerWorkflowRun, removeCollectionVectorStore, renderTemplate, resetReplicaIdForTests, resolveEnabledPluginSkill, resolveJudgeModelKey, resolvePath, resolvePluginConnections, resolveSandboxPluginConnections, resolveTenantPluginSkill, roomCoordinatorConfig, runAsLeader, runRemotePackDirectory, safeTaskResponseId, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, serializePluginMeta, serializeTaskMutationSuccess, serializeTaskNormalizationFallback, serializeTaskReadResponse, setBindingRegistry, setEvalRunService, setMenuRegistry, setSandboxPluginCatalog, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, sttModelLatticeManager, taskLifecycleNotifier, taskRunLeaseKey, taskRunRegistry, threadRunLeaseKey, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, tryAcquireTaskRun, tryAcquireThreadRun, unregisterTeammateAgent, unregisterWorkflowRun, updateFileData, validateAgentInput, validateCapabilityBundleInput, validateDSL, validateEncryptionKey, validatePackSourcePath, validatePath, validateRelativePath, validateSandboxPluginManifest, validateSkillName, validateToolInput, vectorStoreLatticeManager, vectorStoreProviderManager, withLease, withTimeout, wrapMcpToolWithUi };
|