@axiom-lattice/core 2.1.76 → 2.1.78

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.ts CHANGED
@@ -8,7 +8,7 @@ import { BaseLanguageModelInput, LanguageModelLike, BaseLanguageModel } from '@l
8
8
  import { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
9
9
  import { ChatResult } from '@langchain/core/outputs';
10
10
  import * as _axiom_lattice_protocols from '@axiom-lattice/protocols';
11
- import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient } from '@axiom-lattice/protocols';
11
+ import { LLMConfig, SemanticMetricsServerConfig, MetricMeta, MetricQueryResult, DataSource, SemanticMetricsQueryRequest, SemanticMetricsQueryResponse, TableQueryRequest, TableQueryResponse, ExecuteSqlQueryRequest, ExecuteSqlQueryResponse, MetricsServerType, MetricsServerConfig, ToolConfig, ToolExecutor, AgentConfig, MiddlewareType, GraphBuildOptions, MessageChunk, MessageChunkType, QueueLatticeProtocol, QueueConfig, QueueClient, QueueResult, ScheduleLatticeProtocol, ScheduleConfig, ScheduleClient, ScheduleStorage, TaskHandler, ScheduleOnceOptions, ScheduleCronOptions, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, ThreadStore, AssistantStore, SkillStore, WorkspaceStore, ProjectStore, DatabaseConfigStore, MetricsServerConfigStore, McpServerConfigStore, UserStore, TenantStore, UserTenantLinkStore, WorkflowTrackingStore, EvalStore, ChannelInstallationStore, BindingRegistry, A2AApiKeyStore, Thread, CreateThreadRequest, Assistant, CreateAssistantRequest, Skill, CreateSkillRequest, SkillStoreContext, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, User, CreateUserRequest, UpdateUserRequest, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, Binding, CreateBindingInput, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient } from '@axiom-lattice/protocols';
12
12
  export { _axiom_lattice_protocols as Protocols };
13
13
  export { AgentConfig, AgentType, GraphBuildOptions, MemoryType } from '@axiom-lattice/protocols';
14
14
  import * as langchain from 'langchain';
@@ -2689,6 +2689,7 @@ type StoreTypeMap = {
2689
2689
  eval: EvalStore;
2690
2690
  channelInstallation: ChannelInstallationStore;
2691
2691
  channelBinding: BindingRegistry;
2692
+ a2aApiKey: A2AApiKeyStore;
2692
2693
  };
2693
2694
  /**
2694
2695
  * Store type keys
@@ -3233,40 +3234,161 @@ declare class InMemoryUserTenantLinkStore implements UserTenantLinkStore {
3233
3234
  }
3234
3235
 
3235
3236
  /**
3236
- * InMemoryChannelInstallationStore
3237
+ * In-memory implementation of {@link ChannelInstallationStore}.
3237
3238
  *
3238
- * In-memory implementation of ChannelInstallationStore
3239
- * Provides CRUD operations for channel installation data stored in memory
3239
+ * Stores per-tenant channel installation configurations (Lark app credentials,
3240
+ * Slack bot tokens, etc.). Each installation defines how a specific external
3241
+ * app instance connects to Axiom Lattice, including fallback agent and
3242
+ * `rejectWhenNoBinding` behavior.
3243
+ *
3244
+ * @example
3245
+ * ```ts
3246
+ * import { InMemoryChannelInstallationStore } from "@axiom-lattice/core";
3247
+ *
3248
+ * const store = new InMemoryChannelInstallationStore();
3249
+ * await store.createInstallation("tenant-a", "install-1", {
3250
+ * channel: "lark",
3251
+ * name: "Production Bot",
3252
+ * config: { appId: "cli_xxx", appSecret: "secret" },
3253
+ * fallbackAgentId: "agent-1",
3254
+ * rejectWhenNoBinding: false,
3255
+ * });
3256
+ * ```
3257
+ *
3258
+ * @see {@link ChannelInstallationStore} — Protocol interface
3259
+ * @see {@link InMemoryBindingStore} — Companion binding store
3240
3260
  */
3241
3261
 
3242
3262
  declare class InMemoryChannelInstallationStore implements ChannelInstallationStore {
3243
3263
  private installations;
3264
+ /**
3265
+ * Retrieves a channel installation by its unique ID.
3266
+ *
3267
+ * @param installationId - The installation identifier
3268
+ * @returns The {@link ChannelInstallation} or `null` if not found
3269
+ */
3244
3270
  getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
3271
+ /**
3272
+ * Lists all channel installations for a tenant, optionally filtered by channel type.
3273
+ *
3274
+ * @param tenantId - Tenant identifier
3275
+ * @param channel - Optional channel type filter (`"lark"`, `"email"`, `"slack"`)
3276
+ * @returns Array of matching {@link ChannelInstallation} objects
3277
+ */
3245
3278
  getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
3279
+ /**
3280
+ * Creates a new channel installation for a tenant.
3281
+ *
3282
+ * @param tenantId - Tenant identifier
3283
+ * @param installationId - Unique installation ID (caller-defined)
3284
+ * @param data - {@link CreateChannelInstallationRequest} containing channel type, name, config, and fallback settings
3285
+ * @returns The created {@link ChannelInstallation}
3286
+ */
3246
3287
  createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
3288
+ /**
3289
+ * Updates an existing channel installation. Config fields are shallow-merged.
3290
+ *
3291
+ * @param tenantId - Tenant identifier (used for isolation check)
3292
+ * @param installationId - Installation ID to update
3293
+ * @param updates - {@link UpdateChannelInstallationRequest} with fields to patch
3294
+ * @returns The updated {@link ChannelInstallation} or `null` if not found or tenant mismatch
3295
+ */
3247
3296
  updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
3297
+ /**
3298
+ * Deletes a channel installation.
3299
+ *
3300
+ * @param tenantId - Tenant identifier (used for isolation check)
3301
+ * @param installationId - Installation ID to delete
3302
+ * @returns `true` if deleted, `false` if not found or tenant mismatch
3303
+ */
3248
3304
  deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
3305
+ /**
3306
+ * Clears all in-memory installations. Primarily used in tests.
3307
+ */
3249
3308
  clear(): void;
3250
3309
  }
3251
3310
 
3252
3311
  /**
3253
- * InMemoryBindingStore
3312
+ * In-memory implementation of {@link BindingRegistry}.
3254
3313
  *
3255
- * In-memory implementation of BindingRegistry
3256
- * Provides CRUD and resolve operations for sender-to-agent bindings
3314
+ * Stores sender-to-agent bindings that bridge external channel identities (Lark open_id,
3315
+ * Slack userId, email address, etc.) to Axiom Lattice agents and threads.
3316
+ *
3317
+ * During `MessageRouter.dispatch()`, the router calls {@link resolve} to determine
3318
+ * which agent should handle an inbound message. The binding also controls thread
3319
+ * lifecycle via {@link Binding.threadMode}:
3320
+ *
3321
+ * - `"fixed"` — All messages from this sender reuse the same `threadId`.
3322
+ * - `"per_conversation"` — Each conversation creates a new thread.
3323
+ *
3324
+ * @example
3325
+ * ```ts
3326
+ * import { InMemoryBindingStore, setBindingRegistry } from "@axiom-lattice/core";
3327
+ *
3328
+ * const store = new InMemoryBindingStore();
3329
+ * setBindingRegistry(store);
3330
+ *
3331
+ * const binding = await store.create({
3332
+ * channel: "slack",
3333
+ * channelInstallationId: "install-1",
3334
+ * tenantId: "tenant-a",
3335
+ * senderId: "U12345",
3336
+ * agentId: "agent-1",
3337
+ * threadMode: "fixed",
3338
+ * });
3339
+ * ```
3340
+ *
3341
+ * @see {@link BindingRegistry} — Protocol interface
3342
+ * @see {@link setBindingRegistry} — Global registration
3343
+ * @see {@link manageBindingSchema} — Agent tool for dynamic binding management
3257
3344
  */
3258
3345
 
3259
3346
  declare class InMemoryBindingStore implements BindingRegistry {
3260
3347
  private bindings;
3348
+ /**
3349
+ * Resolves a binding for the given sender across a specific channel installation.
3350
+ *
3351
+ * Called by `MessageRouter.dispatch()` during inbound message processing.
3352
+ * Matches on `channel + senderId + channelInstallationId + tenantId` and
3353
+ * requires `enabled === true`.
3354
+ *
3355
+ * @param params - Resolution parameters
3356
+ * @returns The matching {@link Binding} or `null` if none found.
3357
+ */
3261
3358
  resolve(params: {
3262
3359
  channel: string;
3263
3360
  senderId: string;
3264
3361
  channelInstallationId: string;
3265
3362
  tenantId: string;
3266
3363
  }): Promise<Binding | null>;
3364
+ /**
3365
+ * Creates a new sender-to-agent binding.
3366
+ *
3367
+ * @param input - {@link CreateBindingInput} defining channel, sender, target agent, and thread mode.
3368
+ * @returns The newly created {@link Binding}.
3369
+ */
3267
3370
  create(input: CreateBindingInput): Promise<Binding>;
3371
+ /**
3372
+ * Updates an existing binding (e.g. changing the target agent or thread mode).
3373
+ *
3374
+ * @param id - Binding ID
3375
+ * @param patch - Partial {@link Binding} fields to update
3376
+ * @returns The updated {@link Binding}
3377
+ * @throws {Error} If the binding does not exist
3378
+ */
3268
3379
  update(id: string, patch: Partial<Binding>): Promise<Binding>;
3380
+ /**
3381
+ * Deletes a binding by ID.
3382
+ *
3383
+ * @param id - Binding ID
3384
+ */
3269
3385
  delete(id: string): Promise<void>;
3386
+ /**
3387
+ * Lists bindings filtered by tenant and optional channel/agent/installation.
3388
+ *
3389
+ * @param params - Filter and pagination parameters
3390
+ * @returns Array of matching {@link Binding} objects
3391
+ */
3270
3392
  list(params: {
3271
3393
  channel?: string;
3272
3394
  agentId?: string;
@@ -3275,13 +3397,44 @@ declare class InMemoryBindingStore implements BindingRegistry {
3275
3397
  limit?: number;
3276
3398
  offset?: number;
3277
3399
  }): Promise<Binding[]>;
3400
+ /**
3401
+ * Bulk-imports bindings.
3402
+ *
3403
+ * @param bindings - Array of {@link CreateBindingInput}
3404
+ * @returns Array of created {@link Binding} objects
3405
+ */
3278
3406
  import(bindings: CreateBindingInput[]): Promise<Binding[]>;
3407
+ /**
3408
+ * Exports all bindings for a tenant.
3409
+ *
3410
+ * @param params - Filter by tenantId
3411
+ * @returns Array of {@link Binding} objects
3412
+ */
3279
3413
  export(params: {
3280
3414
  tenantId: string;
3281
3415
  }): Promise<Binding[]>;
3416
+ /**
3417
+ * Clears all in-memory bindings. Primarily used in tests.
3418
+ */
3282
3419
  clear(): void;
3283
3420
  }
3284
3421
 
3422
+ declare class InMemoryA2AApiKeyStore implements A2AApiKeyStore {
3423
+ private keys;
3424
+ findByKey(key: string): Promise<A2AApiKeyRecord | null>;
3425
+ list(params: {
3426
+ tenantId?: string;
3427
+ limit?: number;
3428
+ offset?: number;
3429
+ }): Promise<A2AApiKeyRecord[]>;
3430
+ create(input: CreateA2AApiKeyInput): Promise<A2AApiKeyRecord>;
3431
+ disable(id: string): Promise<A2AApiKeyRecord>;
3432
+ enable(id: string): Promise<A2AApiKeyRecord>;
3433
+ rotate(id: string): Promise<A2AApiKeyRecord>;
3434
+ delete(id: string): Promise<void>;
3435
+ loadIntoMap(): Promise<Map<string, A2AApiKeyEntry>>;
3436
+ }
3437
+
3285
3438
  /**
3286
3439
  * In-Memory Thread Message Queue Store
3287
3440
  *
@@ -4266,7 +4419,42 @@ declare function buildSandboxMetadataEnv(config?: RunSandboxConfig): Record<stri
4266
4419
 
4267
4420
  declare function buildNamedVolumeName(prefix: "s" | "a" | "p", ...parts: Array<string | undefined>): string;
4268
4421
 
4422
+ /**
4423
+ * Sets the global {@link BindingRegistry} instance used by the channel message router.
4424
+ *
4425
+ * The registry resolves which agent/thread should handle an inbound message from an
4426
+ * external channel (Lark, Slack, Email, etc.). It is queried during
4427
+ * `MessageRouter.dispatch()` to map a sender ID to a binding.
4428
+ *
4429
+ * @example
4430
+ * ```ts
4431
+ * import { configureStores, setBindingRegistry, getStoreLattice } from "@axiom-lattice/core";
4432
+ * import { PostgreSQLBindingStore } from "@axiom-lattice/pg-stores";
4433
+ *
4434
+ * await configureStores({
4435
+ * channelBinding: new PostgreSQLBindingStore({ pool }),
4436
+ * });
4437
+ *
4438
+ * const bindingStore = getStoreLattice("default", "channelBinding").store as BindingRegistry;
4439
+ * setBindingRegistry(bindingStore);
4440
+ * ```
4441
+ *
4442
+ * @param r - A {@link BindingRegistry} implementation (e.g. `InMemoryBindingStore` or `PostgreSQLBindingStore`)
4443
+ * @see {@link getBindingRegistry}
4444
+ * @see {@link InMemoryBindingStore}
4445
+ */
4269
4446
  declare function setBindingRegistry(r: BindingRegistry): void;
4447
+ /**
4448
+ * Returns the globally registered {@link BindingRegistry}.
4449
+ *
4450
+ * Must be called **after** {@link setBindingRegistry}. The registry is used by
4451
+ * `MessageRouter.dispatch()` in `packages/gateway` to look up the agent binding
4452
+ * for an incoming channel message.
4453
+ *
4454
+ * @returns The active {@link BindingRegistry} instance.
4455
+ * @throws {Error} If the registry has not been initialized.
4456
+ * @see {@link setBindingRegistry}
4457
+ */
4270
4458
  declare function getBindingRegistry(): BindingRegistry;
4271
4459
 
4272
4460
  /**
@@ -5515,12 +5703,18 @@ declare class AgentManager {
5515
5703
  }, return_agent_state?: boolean): Promise<unknown>;
5516
5704
  }
5517
5705
 
5706
+ /** Execution state of a thread. */
5518
5707
  declare enum ThreadStatus {
5519
5708
  IDLE = "idle",
5520
5709
  BUSY = "busy",
5521
5710
  INTERRUPTED = "interrupted",
5522
5711
  ERROR = "error"
5523
5712
  }
5713
+ /**
5714
+ * Snapshot of a thread's current state including queue and status.
5715
+ *
5716
+ * Used for recovery, monitoring, and external queries about thread health.
5717
+ */
5524
5718
  interface ThreadState {
5525
5719
  threadId: string;
5526
5720
  assistantId: string;
@@ -5534,6 +5728,25 @@ interface ThreadState {
5534
5728
  pendingMessages: PendingMessage[];
5535
5729
  pendingCount: number;
5536
5730
  }
5731
+ /**
5732
+ * Message payload passed to {@link Agent.addMessage}.
5733
+ *
5734
+ * Supports both a legacy single-message format (`input.message`) and a
5735
+ * multi-message format (`input.messages[]` for mixed human/system messages).
5736
+ *
5737
+ * @example
5738
+ * ```ts
5739
+ * // Legacy single message
5740
+ * await agent.addMessage({ input: { message: "Hello" } });
5741
+ *
5742
+ * // Multi-message format
5743
+ * await agent.addMessage({
5744
+ * input: {
5745
+ * messages: [{ role: "human", content: "Hello" }, { role: "system", content: "Context" }]
5746
+ * }
5747
+ * });
5748
+ * ```
5749
+ */
5537
5750
  interface QueueMessage {
5538
5751
  input: {
5539
5752
  message?: string;
@@ -5543,6 +5756,7 @@ interface QueueMessage {
5543
5756
  command?: CommandParams<any>;
5544
5757
  custom_run_config?: any;
5545
5758
  }
5759
+ /** Emitted when a thread transitions between {@link ThreadStatus} values. */
5546
5760
  interface ThreadStatusChangedEvent {
5547
5761
  type: "thread:status:changed";
5548
5762
  tenantId: string;
@@ -5557,7 +5771,26 @@ interface ThreadStatusChangedEvent {
5557
5771
  pendingCount?: number;
5558
5772
  };
5559
5773
  }
5560
- type AgentLifecycleEventName = 'message:started' | 'message:completed' | 'message:interrupted' | 'message:failed' | 'thread:busy' | 'thread:idle' | 'queue:pending';
5774
+ /**
5775
+ * Union of all lifecycle event names emitted by {@link Agent}.
5776
+ *
5777
+ * Used with {@link Agent.subscribe} / {@link Agent.subscribeOnce} to listen
5778
+ * for agent state changes. Events are automatically namespaced as
5779
+ * `{eventName}:{tenantId}:{threadId}`.
5780
+ *
5781
+ * | Event | Fires when |
5782
+ * |-------|-----------|
5783
+ * | `message:started` | An individual message begins processing |
5784
+ * | `message:completed` | An individual message finishes processing |
5785
+ * | `message:interrupted` | A message was interrupted (e.g. human approval) |
5786
+ * | `message:failed` | A message execution threw an error |
5787
+ * | `thread:busy` | The thread starts processing its queue |
5788
+ * | `thread:idle` | The thread has no more pending messages |
5789
+ * | `queue:pending` | A new message was added to the queue |
5790
+ * | `reply:ready` | Agent execution finished, AI response is available |
5791
+ */
5792
+ type AgentLifecycleEventName = 'message:started' | 'message:completed' | 'message:interrupted' | 'message:failed' | 'thread:busy' | 'thread:idle' | 'queue:pending' | 'reply:ready';
5793
+ /** Emitted when the agent starts processing a queued message. */
5561
5794
  interface MessageStartedEvent {
5562
5795
  type: 'message:started';
5563
5796
  messageId: string;
@@ -5565,6 +5798,12 @@ interface MessageStartedEvent {
5565
5798
  timestamp: Date;
5566
5799
  queueMode?: QueueMode;
5567
5800
  }
5801
+ /**
5802
+ * Emitted when the agent finishes processing a queued message.
5803
+ *
5804
+ * The {@link state} field contains a LangGraph {@link StateSnapshot} which
5805
+ * includes the full conversation history in `state.values.messages`.
5806
+ */
5568
5807
  interface MessageCompletedEvent {
5569
5808
  type: 'message:completed';
5570
5809
  messageId: string;
@@ -5572,23 +5811,27 @@ interface MessageCompletedEvent {
5572
5811
  duration?: number;
5573
5812
  state?: any;
5574
5813
  }
5814
+ /** Emitted when message processing throws an unrecoverable error. */
5575
5815
  interface MessageFailedEvent {
5576
5816
  type: 'message:failed';
5577
5817
  messageId: string;
5578
5818
  error: string;
5579
5819
  timestamp: Date;
5580
5820
  }
5821
+ /** Emitted when the thread has drained its queue and returned to idle. */
5581
5822
  interface ThreadIdleEvent {
5582
5823
  type: 'thread:idle';
5583
5824
  timestamp: Date;
5584
5825
  pendingCount: number;
5585
5826
  state?: any;
5586
5827
  }
5828
+ /** Emitted when a thread transitions from idle to busy (queue processing started). */
5587
5829
  interface ThreadBusyEvent {
5588
5830
  type: 'thread:busy';
5589
5831
  timestamp: Date;
5590
5832
  messageId?: string;
5591
5833
  }
5834
+ /** Emitted when a message is enqueued but not yet processing. */
5592
5835
  interface QueuePendingEvent {
5593
5836
  type: 'queue:pending';
5594
5837
  messageId: string;
@@ -5598,6 +5841,12 @@ interface QueuePendingEvent {
5598
5841
  isHighPriority: boolean;
5599
5842
  }
5600
5843
 
5844
+ /**
5845
+ * Parameters that uniquely identify an agent thread instance.
5846
+ *
5847
+ * Used by {@link AgentInstanceManager.getAgent} to create or retrieve
5848
+ * the {@link Agent} instance for a given tenant/assistant/thread combination.
5849
+ */
5601
5850
  interface AgentThreadInterface {
5602
5851
  assistant_id: string;
5603
5852
  thread_id: string;
@@ -5606,6 +5855,9 @@ interface AgentThreadInterface {
5606
5855
  project_id?: string;
5607
5856
  custom_run_config?: any;
5608
5857
  }
5858
+ /**
5859
+ * Record of an async task tracked by the agent (e.g. sub-agent executions).
5860
+ */
5609
5861
  interface AsyncTaskRecord {
5610
5862
  taskId: string;
5611
5863
  assistantId: string;
@@ -5614,6 +5866,42 @@ interface AsyncTaskRecord {
5614
5866
  createdAt: number;
5615
5867
  completedAt?: number;
5616
5868
  }
5869
+ /**
5870
+ * Per-tenant agent thread instance with message queue, streaming, and lifecycle events.
5871
+ *
5872
+ * Each `Agent` instance is tied to a specific `(tenant_id, assistant_id, thread_id)`
5873
+ * tuple. It wraps a LangGraph runnable and manages:
5874
+ *
5875
+ * - **Message queue** — Messages are enqueued via {@link addMessage} and processed
5876
+ * sequentially according to the thread's {@link QueueMode} (COLLECT, FOLLOWUP, STEER).
5877
+ * - **Streaming** — Output chunks are buffered via {@link ChunkBuffer} and consumed
5878
+ * through {@link chunkStream}.
5879
+ * - **Lifecycle events** — Emits namespaced events (`message:completed`, `reply:ready`,
5880
+ * `thread:idle`, etc.) via a global {@link EventBus}.
5881
+ * - **Abort / Resume** — Supports graceful interruption and recovery after restart.
5882
+ *
5883
+ * Instances are created and managed by {@link AgentInstanceManager}. Do not
5884
+ * construct directly — use `agentInstanceManager.getAgent(params)`.
5885
+ *
5886
+ * @example
5887
+ * ```ts
5888
+ * const agent = agentInstanceManager.getAgent({
5889
+ * assistant_id: "agent-1",
5890
+ * thread_id: "thread-abc",
5891
+ * tenant_id: "tenant-x",
5892
+ * });
5893
+ *
5894
+ * // Subscribe to completion
5895
+ * agent.subscribeOnce("message:completed", (evt) => {
5896
+ * console.log("Agent finished:", evt.state);
5897
+ * });
5898
+ *
5899
+ * // Enqueue a message
5900
+ * const result = await agent.addMessage({
5901
+ * input: { message: "Hello!" },
5902
+ * });
5903
+ * ```
5904
+ */
5617
5905
  declare class Agent {
5618
5906
  private queueStore;
5619
5907
  private stateChecker;
@@ -5628,13 +5916,37 @@ declare class Agent {
5628
5916
  queueMode: ThreadQueueConfig;
5629
5917
  private isWaitingForQueueEnd;
5630
5918
  asyncTasks: AsyncTaskRecord[];
5919
+ /**
5920
+ * Constructs an Agent instance.
5921
+ *
5922
+ * Prefer {@link AgentInstanceManager.getAgent} over direct construction — it
5923
+ * ensures a single instance per thread.
5924
+ *
5925
+ * @param params - {@link AgentThreadInterface}
5926
+ */
5631
5927
  constructor({ assistant_id, thread_id, tenant_id, workspace_id, project_id, custom_run_config, }: AgentThreadInterface);
5632
5928
  private getHumanPendingContent;
5633
5929
  /**
5634
5930
  * Initialize with message queue store
5635
5931
  */
5636
5932
  setQueueStore(store: IMessageQueueStore): void;
5933
+ /**
5934
+ * Push a chunk into the streaming buffer for this thread.
5935
+ *
5936
+ * Consumers read chunks via {@link chunkStream}.
5937
+ *
5938
+ * @param content - The message chunk to buffer
5939
+ */
5637
5940
  addChunk(content: MessageChunk): Promise<void>;
5941
+ /**
5942
+ * Returns an async iterator over new chunks since the given message ID.
5943
+ *
5944
+ * Used by SSE endpoints to stream agent output to clients in real time.
5945
+ *
5946
+ * @param message_id - The client message ID to start streaming from
5947
+ * @param stopTypes - Optional chunk types that terminate the stream
5948
+ * @returns An async iterable yielding {@link MessageChunk} objects
5949
+ */
5638
5950
  chunkStream(message_id: string, stopTypes?: MessageChunkType[]): {
5639
5951
  [Symbol.asyncIterator]: () => AsyncGenerator<MessageChunk, void, unknown>;
5640
5952
  };
@@ -5652,22 +5964,50 @@ declare class Agent {
5652
5964
  private getQueueStore;
5653
5965
  private getDefaultQueueConfig;
5654
5966
  /**
5655
- * Set queue configuration for thread
5967
+ * Override the thread's queue processing mode.
5968
+ *
5969
+ * @param config - Partial {@link ThreadQueueConfig} (e.g. `{ mode: QueueMode.FOLLOWUP }`)
5656
5970
  */
5657
5971
  setQueueConfig(config: Partial<ThreadQueueConfig>): Promise<void>;
5658
5972
  /**
5659
- * Stop queue processor
5973
+ * Abort any ongoing queue processing without clearing the queue.
5974
+ *
5975
+ * Used internally by STEER mode to interrupt the current execution so the
5976
+ * steer message can be processed next. For a full abort that also clears
5977
+ * pending messages, use {@link abort}.
5978
+ *
5979
+ * @see {@link abort}
5660
5980
  */
5661
5981
  stopQueueProcessor(): void;
5662
5982
  /**
5663
- * Add message to queue
5664
- * All messages go to queue, processor auto-starts if not running
5665
- * STEER/Command messages are inserted at head of queue for immediate processing
5983
+ * Enqueue a message for this thread.
5666
5984
  *
5667
- * Supports both legacy single message format and new messages[] format:
5668
- * - Legacy: input.message (single human message)
5669
- * - New: input.messages[] (array of mixed human/system messages)
5670
- * - When input.messages is provided, it takes precedence over input.message
5985
+ * Messages are always queued; the queue processor starts automatically if idle.
5986
+ * Returns immediately with the message ID execution is asynchronous.
5987
+ *
5988
+ * **Queue modes** (via the optional `mode` param):
5989
+ * - `COLLECT` (default) — Batch multiple pending messages into one agent call.
5990
+ * - `FOLLOWUP` — Process messages one at a time in order.
5991
+ * - `STEER` — High-priority, inserted at queue head, interrupts current processing.
5992
+ *
5993
+ * **Format**: Supports both `input.message` (legacy string) and `input.messages[]`
5994
+ * (array of `{ role, content }` objects). The array form takes precedence.
5995
+ *
5996
+ * The `custom_run_config` field is round-tripped through the queue and emitted
5997
+ * back in {@link ReplyReadyEvent}, enabling callers to attach routing metadata
5998
+ * (e.g. `_replyTarget` for channel reply).
5999
+ *
6000
+ * @param queueMessage - The message to enqueue
6001
+ * @param mode - Optional queue mode override (defaults to thread's current mode)
6002
+ * @returns `{ queued: true, executed: false, messageId }` — execution happens asynchronously
6003
+ *
6004
+ * @example
6005
+ * ```ts
6006
+ * await agent.addMessage({
6007
+ * input: { message: "Hello" },
6008
+ * custom_run_config: { _replyTarget: { adapterChannel: "lark", rawTarget: { chatId: "xxx" } } },
6009
+ * });
6010
+ * ```
5671
6011
  */
5672
6012
  addMessage(queueMessage: QueueMessage, mode?: QueueMode): Promise<{
5673
6013
  queued: boolean;
@@ -5675,8 +6015,13 @@ declare class Agent {
5675
6015
  executed: boolean;
5676
6016
  }>;
5677
6017
  /**
5678
- * Start queue processor if not already running
5679
- * Public method to allow external triggering (e.g., from recovery)
6018
+ * Start the queue processor if it is not already running.
6019
+ *
6020
+ * Called automatically by {@link addMessage} and {@link resumeTask}.
6021
+ * Safe to call externally — it is a no-op if processing is already active.
6022
+ *
6023
+ * Emits `thread:busy` before starting, and starts the {@link waitingForQueueEnd}
6024
+ * loop with a fresh {@link AbortController}.
5680
6025
  */
5681
6026
  startQueueProcessorIfNeeded(): Promise<void>;
5682
6027
  /**
@@ -5687,24 +6032,56 @@ declare class Agent {
5687
6032
  * Add reminder message for interrupted tasks
5688
6033
  */
5689
6034
  private addReminderMessage;
6035
+ /**
6036
+ * Returns a LangGraph StateSnapshot for this thread.
6037
+ *
6038
+ * Includes `state.values.messages` (full conversation history) and
6039
+ * `state.tasks` / `state.next` (execution progress).
6040
+ */
5690
6041
  getCurrentState(): Promise<_langchain_langgraph.StateSnapshot>;
6042
+ /**
6043
+ * Returns the conversation history as normalized message objects.
6044
+ *
6045
+ * Filters to `human`, `ai`, and `tool` message types. Each entry has
6046
+ * `{ id, role, content }` plus any LangChain kwargs.
6047
+ *
6048
+ * @returns Array of message objects with `id`, `role`, and `content`
6049
+ */
5691
6050
  getCurrentMessages(): Promise<{
5692
6051
  id: string | undefined;
5693
6052
  role: _langchain_core_messages.MessageType;
5694
6053
  content: string | (langchain.ContentBlock | langchain.ContentBlock.Text)[];
5695
6054
  }[]>;
5696
6055
  get_draw_graph(): Promise<string>;
6056
+ /**
6057
+ * Determine the current thread execution status.
6058
+ *
6059
+ * Checks LangGraph's `state.tasks` for interrupts and `state.next` for
6060
+ * pending steps.
6061
+ *
6062
+ * @returns {@link ThreadStatus} — `IDLE`, `BUSY`, or `INTERRUPTED`
6063
+ */
5697
6064
  getRunStatus(): Promise<ThreadStatus>;
5698
6065
  /**
5699
- * Resume task processing after server restart
5700
- * Resets any stuck processing messages to pending and starts queue processing
5701
- * Note: Does not rely on LangGraph state as it may be stale after crash/restart
6066
+ * Resume processing after a server restart.
6067
+ *
6068
+ * Resets any stuck "processing" messages back to "pending" and restarts the
6069
+ * queue processor. Skips threads that are in `INTERRUPTED` state (the
6070
+ * interruption was intentional).
6071
+ *
6072
+ * Called during gateway startup to recover threads that were mid-execution
6073
+ * when the server went down.
5702
6074
  */
5703
6075
  resumeTask(): Promise<void>;
5704
6076
  /**
5705
- * Abort the current agent execution
5706
- * This will cancel any ongoing invoke or stream operations
5707
- * and clear all queued messages (pending + processing)
6077
+ * Fully abort all activity on this thread.
6078
+ *
6079
+ * Aborts any in-flight agent execution (via {@link AbortController}) and
6080
+ * clears all pending and processing messages from the queue. Also marks
6081
+ * the chunk buffer thread as aborted so streaming consumers can detect it.
6082
+ *
6083
+ * Unlike {@link stopQueueProcessor}, this is a destructive abort — the
6084
+ * queue is drained.
5708
6085
  */
5709
6086
  abort(): Promise<void>;
5710
6087
  /**
@@ -5712,25 +6089,59 @@ declare class Agent {
5712
6089
  */
5713
6090
  isAborted(): boolean;
5714
6091
  /**
5715
- * Subscribe to lifecycle events for this agent/thread
5716
- * Events are automatically namespaced by tenantId and threadId
6092
+ * Subscribe to a lifecycle event for this specific thread.
6093
+ *
6094
+ * Event names are namespaced as `{eventName}:{tenantId}:{threadId}` so
6095
+ * listeners only receive events for this agent instance.
6096
+ *
6097
+ * @param eventName - One of {@link AgentLifecycleEventName}
6098
+ * @param callback - Handler receiving the event data payload
6099
+ *
6100
+ * @example
6101
+ * ```ts
6102
+ * agent.subscribe("message:completed", (evt) => {
6103
+ * console.log("AI response:", evt.state?.values?.messages);
6104
+ * });
6105
+ * ```
5717
6106
  */
5718
6107
  subscribe(eventName: AgentLifecycleEventName, callback: (data: any) => void): void;
5719
6108
  /**
5720
- * Unsubscribe from lifecycle events
6109
+ * Remove a previously registered event listener.
6110
+ *
6111
+ * @param eventName - The event that was subscribed to
6112
+ * @param callback - The same function reference used in {@link subscribe}
5721
6113
  */
5722
6114
  unsubscribe(eventName: AgentLifecycleEventName, callback: (data: any) => void): void;
5723
6115
  /**
5724
- * Subscribe to lifecycle events once (auto-unsubscribe after first event)
6116
+ * Subscribe to a lifecycle event once the listener is removed after the
6117
+ * first invocation.
6118
+ *
6119
+ * Ideal for one-shot async patterns (e.g. waiting for `reply:ready` before
6120
+ * sending a channel reply).
6121
+ *
6122
+ * @param eventName - One of {@link AgentLifecycleEventName}
6123
+ * @param callback - Handler receiving the event data payload
5725
6124
  */
5726
6125
  subscribeOnce(eventName: AgentLifecycleEventName, callback: (data: any) => void): void;
5727
6126
  /**
5728
6127
  * Publish lifecycle event (internal use)
5729
6128
  */
5730
6129
  private publish;
6130
+ /**
6131
+ * Track a sub-agent async task spawned by this agent.
6132
+ *
6133
+ * Tasks are monitored by the agent task consumer in `packages/gateway`
6134
+ * and their status can be polled via {@link getAsyncTasks}.
6135
+ */
5731
6136
  addAsyncTask(task: AsyncTaskRecord): void;
5732
6137
  getAsyncTasks(): AsyncTaskRecord[];
5733
6138
  getAsyncTask(taskId: string): AsyncTaskRecord | undefined;
6139
+ /**
6140
+ * Update the status of a tracked async task.
6141
+ *
6142
+ * Terminal states (`completed`, `failed`, `cancelled`) automatically
6143
+ * set `completedAt` to the current timestamp.
6144
+ */
5734
6145
  updateAsyncTaskStatus(taskId: string, status: AsyncTaskRecord['status']): void;
5735
6146
  }
5736
6147
 
@@ -5830,6 +6241,104 @@ declare function validateEncryptionKey(): void;
5830
6241
  */
5831
6242
  declare function clearEncryptionKeyCache(): void;
5832
6243
 
6244
+ /**
6245
+ * Factory function type for creating custom middleware instances.
6246
+ *
6247
+ * Receives the raw `config` object from the database (excluding the `key` field)
6248
+ * and returns a LangChain `AgentMiddleware` instance, either synchronously or asynchronously.
6249
+ *
6250
+ * @example
6251
+ * ```ts
6252
+ * const factory: CustomMiddlewareFactory = (config) =>
6253
+ * createMiddleware({
6254
+ * name: "MyMiddleware",
6255
+ * wrapModelCall: async (request, handler) => {
6256
+ * console.log(`[${config.logLevel}] Model call`);
6257
+ * return handler(request);
6258
+ * },
6259
+ * });
6260
+ * ```
6261
+ */
6262
+ type CustomMiddlewareFactory = (config: Record<string, any>) => Promise<AgentMiddleware> | AgentMiddleware;
6263
+ /**
6264
+ * Global registry for external applications to register custom middleware factories.
6265
+ *
6266
+ * Applications write their own middleware (auth, audit, custom tools, etc.) without
6267
+ * modifying core source code. Once registered, middleware can be enabled per-agent via
6268
+ * the database config using `type: "custom"` in the agent's `graphDefinition.middleware` array.
6269
+ *
6270
+ * @example Register and use
6271
+ * ```ts
6272
+ * // 1. App startup — register a factory
6273
+ * CustomMiddlewareRegistry.register("audit-logger", (config) =>
6274
+ * createMiddleware({
6275
+ * name: "AuditLogger",
6276
+ * wrapModelCall: async (r, h) => { console.log("audit:", config.level); return h(r); },
6277
+ * }),
6278
+ * );
6279
+ *
6280
+ * // 2. Database config for an agent
6281
+ * // {
6282
+ * // "id": "mw-001",
6283
+ * // "type": "custom",
6284
+ * // "enabled": true,
6285
+ * // "config": { "key": "audit-logger", "level": "debug" }
6286
+ * // }
6287
+ * ```
6288
+ *
6289
+ * @remarks
6290
+ * - Register factories **before** building agents (typically at app startup).
6291
+ * - Duplicate keys overwrite previous registrations.
6292
+ * - Unregistered keys are skipped with a console warning at agent build time.
6293
+ */
6294
+ declare class CustomMiddlewareRegistry {
6295
+ private static factories;
6296
+ /**
6297
+ * Register a custom middleware factory under the given key.
6298
+ *
6299
+ * The key is referenced by `config.key` in the database middleware configuration.
6300
+ * When an agent is built, the framework looks up this key and calls the factory
6301
+ * with the remaining config fields.
6302
+ *
6303
+ * @param key - Unique identifier, referenced in database config as `config.key`
6304
+ * @param factory - Function that receives config (minus `key`) and returns an AgentMiddleware
6305
+ *
6306
+ * @example
6307
+ * ```ts
6308
+ * CustomMiddlewareRegistry.register("my-logger", (config) =>
6309
+ * createMiddleware({ name: "Logger", beforeAgent: async () => { ... } }),
6310
+ * );
6311
+ * ```
6312
+ */
6313
+ static register(key: string, factory: CustomMiddlewareFactory): void;
6314
+ /**
6315
+ * Remove a previously registered factory.
6316
+ *
6317
+ * @param key - The factory key to unregister
6318
+ * @returns `true` if a factory was removed, `false` if the key was not found
6319
+ */
6320
+ static unregister(key: string): boolean;
6321
+ /**
6322
+ * Look up a factory by key.
6323
+ *
6324
+ * @param key - The factory key
6325
+ * @returns The factory function, or `undefined` if not registered
6326
+ */
6327
+ static get(key: string): CustomMiddlewareFactory | undefined;
6328
+ /**
6329
+ * Check whether a factory is registered under the given key.
6330
+ *
6331
+ * @param key - The factory key to check
6332
+ */
6333
+ static has(key: string): boolean;
6334
+ /**
6335
+ * Get all currently registered factory keys.
6336
+ *
6337
+ * @returns Array of registered key strings
6338
+ */
6339
+ static list(): string[];
6340
+ }
6341
+
5833
6342
  /**
5834
6343
  * Create middleware that provides widget rendering capabilities.
5835
6344
  *
@@ -5916,4 +6425,4 @@ interface UnknownToolHandlerConfig {
5916
6425
  */
5917
6426
  declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerConfig): AgentMiddleware;
5918
6427
 
5919
- export { AGENT_TASK_EVENT, type AddMessageParams, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentThreadInterface, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BufferStats, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, type ColumnInfo, CompositeBackend, ConsoleLoggerClient, type CreateProcessingAgentParams, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, InMemoryAssistantStore, InMemoryBindingStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryTaskListStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserStore, InMemoryUserTenantLinkStore, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LoggerLattice, LoggerLatticeManager, MAX_LINE_LENGTH, type MailboxMessage, type MailboxStore, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MessageCompletedEvent, type MessageFailedEvent, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type PendingMessage, PinoLoggerClient, PostgresDatabase, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type RunSandboxConfig, type RuntimeModelConfig, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskEvent, type TaskListStore, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TopologyEdge, type UnknownToolHandlerConfig, type VectorStoreLatticeInterface, VectorStoreLatticeManager, VolumeFilesystem, type VolumeFsClient, type WriteResult, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, checkEmptyContent, clearEncryptionKeyCache, computeSandboxName, configureStores, createAgentTeam, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createModelSelectorMiddleware, createProcessingAgent, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createSandboxProvider, createSchedulerMiddleware, createTeamMiddleware, createTeammateTools, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, eventBus, eventBus as eventBusDefault, extractFetcherError, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getLoggerLattice, getModelLattice, getNextCronTime, getQueueLattice, getSandBoxManager, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, isBuiltInSkill, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, loggerLatticeManager, mcpManager, metricsServerManager, modelLatticeManager, normalizeSandboxName, parseCronExpression, parseSkillFrontmatter, performStringReplacement, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, setBindingRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, updateFileData, validateAgentInput, validateEncryptionKey, validatePath, validateSkillName, validateToolInput, vectorStoreLatticeManager };
6428
+ export { AGENT_TASK_EVENT, type AddMessageParams, Agent, type AgentClient, type AgentExecutor, AgentInstanceManager, type AgentLattice, AgentLatticeManager, type AgentLifecycleEventName, AgentManager, type AgentStreamExecutor, type AgentThreadInterface, BUILTIN_SKILLS, type BackendFactory, type BackendProtocol, type BufferStats, type Chunk, ChunkBuffer, ChunkBufferLatticeManager, type ColumnInfo, CompositeBackend, ConsoleLoggerClient, type CreateProcessingAgentParams, type CreateSandboxProviderConfig, type CronFields, CustomMetricsClient, type CustomMiddlewareFactory, CustomMiddlewareRegistry, type DatabaseConfig, type DatabaseType, DaytonaInstance, DaytonaProvider, type DaytonaProviderConfig, DefaultScheduleClient, E2BInstance, E2BProvider, type E2BProviderConfig, EMPTY_CONTENT_WARNING, type EditResult, type EmbeddingsLatticeInterface, EmbeddingsLatticeManager, type EnsureMicrosandboxInput, type FileData, type FileInfo, FileSystemSkillStore, type FileSystemSkillStoreOptions, FilesystemBackend, type FsEntry, type GrepMatch, type IMessageQueueStore, type IMetricsServerClient, type ISqlDatabase, InMemoryA2AApiKeyStore, InMemoryAssistantStore, InMemoryBindingStore, InMemoryChannelInstallationStore, InMemoryChunkBuffer, InMemoryDatabaseConfigStore, InMemoryMailboxStore, InMemoryTaskListStore, InMemoryTenantStore, InMemoryThreadMessageQueueStore, InMemoryThreadStore, InMemoryUserStore, InMemoryUserTenantLinkStore, LINE_NUMBER_WIDTH, type LangGraphStateChecker, type LoggerLattice, LoggerLatticeManager, MAX_LINE_LENGTH, type MailboxMessage, type MailboxStore, type McpLatticeInterface, McpLatticeManager, type McpServerInfo, MemoryBackend, MemoryLatticeManager, MemoryQueueClient, MemoryScheduleStorage, type MessageCompletedEvent, type MessageFailedEvent, type MessageStartedEvent, MessageType, MetricsServerManager, MicrosandboxRemoteInstance, MicrosandboxRemoteProvider, type MicrosandboxRemoteProviderClient, type MicrosandboxRemoteProviderConfig, MicrosandboxServiceClient, type MicrosandboxServiceClientConfig, type MicrosandboxShellExecInput, type ModelConfig, type ModelLatticeInterface, ModelLatticeManager, MysqlDatabase, type PendingMessage, PinoLoggerClient, PostgresDatabase, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type RunSandboxConfig, type RuntimeModelConfig, type SandboxFileInfo, type SandboxFileService, SandboxFilesystem, type SandboxInstance, type SandboxIsolationLevel, SandboxLatticeManager, type SandboxManagerProtocol, type SandboxProvider, type SandboxShellService, SandboxSkillStore, type SandboxSkillStoreOptions, type SandboxVolumeDefinition, type ScheduleLattice, ScheduleLatticeManager, type SchedulerMiddlewareOptions, SemanticMetricsClient, type SkillLattice, SkillLatticeManager, type SkillMeta, type SkillResource, SqlDatabaseManager, type StateAndStore, StateBackend, StoreBackend, type StoreLattice, StoreLatticeManager, type StoreType, type StoreTypeMap, TOOL_RESULT_TOKEN_LIMIT, TRUNCATION_GUIDANCE, type TableInfo, type TableSchema, type TaskEvent, type TaskListStore, type TaskSpec, TaskStatus, type TaskUpdatable, TeamAgentGraphBuilder, type TeamConfig, type TeamMiddlewareOptions, type TeamTask, type TeammateSpec, type TeammateToolsOptions, type ThreadBuffer, type ThreadBufferConfig, type ThreadBusyEvent, type ThreadIdleEvent, type ThreadInfo, type ThreadQueueConfig, type ThreadState, ThreadStatus, type ThreadStatusChangedEvent, type ToolDefinition, type ToolLattice, ToolLatticeManager, type TopologyEdge, type UnknownToolHandlerConfig, type VectorStoreLatticeInterface, VectorStoreLatticeManager, VolumeFilesystem, type VolumeFsClient, type WriteResult, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, checkEmptyContent, clearEncryptionKeyCache, computeSandboxName, configureStores, createAgentTeam, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createModelSelectorMiddleware, createProcessingAgent, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createSandboxProvider, createSchedulerMiddleware, createTeamMiddleware, createTeammateTools, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, eventBus, eventBus as eventBusDefault, extractFetcherError, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getLoggerLattice, getModelLattice, getNextCronTime, getQueueLattice, getSandBoxManager, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, isBuiltInSkill, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, loggerLatticeManager, mcpManager, metricsServerManager, modelLatticeManager, normalizeSandboxName, parseCronExpression, parseSkillFrontmatter, performStringReplacement, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, setBindingRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, updateFileData, validateAgentInput, validateEncryptionKey, validatePath, validateSkillName, validateToolInput, vectorStoreLatticeManager };