@axiom-lattice/core 2.1.79 → 2.1.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ import { BaseLanguageModelInput, LanguageModelLike, 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, 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';
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, MenuRegistry, A2AApiKeyStore, TaskStore, 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, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, LoggerLatticeProtocol, LoggerConfig, LoggerClient, LoggerContext, SkillConfig, SkillClient, ChannelAdapter, InternalStateField, InternalInput, InternalNode, InternalAgentNode, InternalMapNode, InternalDSL } 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';
@@ -26,7 +26,7 @@ import { Connection, MultiServerMCPClient } from '@langchain/mcp-adapters';
26
26
  import { SandboxClient } from '@agent-infra/sandbox';
27
27
  import { Sandbox } from 'e2b';
28
28
  import { Sandbox as Sandbox$1 } from '@daytonaio/sdk';
29
- import { Runnable } from '@langchain/core/runnables';
29
+ import { Runnable, RunnableConfig } from '@langchain/core/runnables';
30
30
  import { InteropZodObject } from '@langchain/core/utils/types';
31
31
 
32
32
  /**
@@ -1711,6 +1711,7 @@ interface AgentBuildParams {
1711
1711
  }>;
1712
1712
  prompt: string;
1713
1713
  stateSchema?: z$1.ZodObject<any, any, any, any, any>;
1714
+ responseFormat?: any;
1714
1715
  tenantId?: string;
1715
1716
  }
1716
1717
 
@@ -2607,6 +2608,8 @@ interface AddMessageParams {
2607
2608
  threadId: string;
2608
2609
  tenantId: string;
2609
2610
  assistantId: string;
2611
+ workspaceId?: string;
2612
+ projectId?: string;
2610
2613
  content: PendingMessageContent;
2611
2614
  type?: "human" | "system";
2612
2615
  priority?: number;
@@ -2618,6 +2621,8 @@ interface ThreadInfo {
2618
2621
  tenantId: string;
2619
2622
  assistantId: string;
2620
2623
  threadId: string;
2624
+ workspaceId?: string;
2625
+ projectId?: string;
2621
2626
  }
2622
2627
  /**
2623
2628
  * Interface for message queue storage
@@ -2689,7 +2694,9 @@ type StoreTypeMap = {
2689
2694
  eval: EvalStore;
2690
2695
  channelInstallation: ChannelInstallationStore;
2691
2696
  channelBinding: BindingRegistry;
2697
+ menu: MenuRegistry;
2692
2698
  a2aApiKey: A2AApiKeyStore;
2699
+ task: TaskStore;
2693
2700
  };
2694
2701
  /**
2695
2702
  * Store type keys
@@ -2892,6 +2899,10 @@ declare class InMemoryAssistantStore implements AssistantStore {
2892
2899
  * Check if assistant exists
2893
2900
  */
2894
2901
  hasAssistant(tenantId: string, id: string): Promise<boolean>;
2902
+ /**
2903
+ * Get assistant by owner user ID
2904
+ */
2905
+ getByOwner(tenantId: string, userId: string): Promise<Assistant | null>;
2895
2906
  /**
2896
2907
  * Clear all assistants for a tenant (useful for testing)
2897
2908
  */
@@ -3276,6 +3287,7 @@ declare class InMemoryChannelInstallationStore implements ChannelInstallationSto
3276
3287
  * @returns Array of matching {@link ChannelInstallation} objects
3277
3288
  */
3278
3289
  getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
3290
+ getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
3279
3291
  /**
3280
3292
  * Creates a new channel installation for a tenant.
3281
3293
  *
@@ -3459,6 +3471,63 @@ declare class InMemoryThreadMessageQueueStore implements IMessageQueueStore {
3459
3471
  resetProcessingToPending(threadId: string): Promise<number>;
3460
3472
  }
3461
3473
 
3474
+ /**
3475
+ * InMemoryTaskStore
3476
+ *
3477
+ * In-memory implementation of TaskStore
3478
+ * Provides CRUD operations for task data stored in memory
3479
+ */
3480
+
3481
+ /**
3482
+ * In-memory implementation of TaskStore
3483
+ */
3484
+ declare class InMemoryTaskStore implements TaskStore {
3485
+ private tasks;
3486
+ /**
3487
+ * Create a new task
3488
+ */
3489
+ create(params: CreateTaskRequest & {
3490
+ tenantId: string;
3491
+ ownerType: string;
3492
+ ownerId: string;
3493
+ }): Promise<TaskItem>;
3494
+ /**
3495
+ * Get task by ID
3496
+ */
3497
+ getById(tenantId: string, id: string): Promise<TaskItem | null>;
3498
+ /**
3499
+ * List tasks matching filter criteria
3500
+ */
3501
+ list(filter: TaskListFilter): Promise<TaskItem[]>;
3502
+ /**
3503
+ * Update an existing task
3504
+ */
3505
+ update(tenantId: string, id: string, updates: UpdateTaskRequest): Promise<TaskItem | null>;
3506
+ /**
3507
+ * Delete a task by ID
3508
+ */
3509
+ delete(tenantId: string, id: string): Promise<boolean>;
3510
+ /**
3511
+ * Clear all tasks for a tenant (useful for testing)
3512
+ */
3513
+ clear(tenantId?: string): void;
3514
+ }
3515
+
3516
+ declare class InMemoryMenuStore implements MenuRegistry {
3517
+ private items;
3518
+ list(params: {
3519
+ tenantId: string;
3520
+ menuTarget?: string;
3521
+ }): Promise<MenuItem[]>;
3522
+ getById(id: string): Promise<MenuItem | null>;
3523
+ create(input: CreateMenuItemInput & {
3524
+ tenantId: string;
3525
+ }): Promise<MenuItem>;
3526
+ update(id: string, patch: UpdateMenuItemInput): Promise<MenuItem>;
3527
+ delete(id: string): Promise<void>;
3528
+ clear(): void;
3529
+ }
3530
+
3462
3531
  /**
3463
3532
  * Embeddings Lattice Interface
3464
3533
  * Defines the structure of an embeddings lattice entry
@@ -4419,6 +4488,23 @@ declare function buildSandboxMetadataEnv(config?: RunSandboxConfig): Record<stri
4419
4488
 
4420
4489
  declare function buildNamedVolumeName(prefix: "s" | "a" | "p", ...parts: Array<string | undefined>): string;
4421
4490
 
4491
+ /**
4492
+ * Channel connection lifecycle.
4493
+ *
4494
+ * When a gateway starts, it should call {@link connectAllChannels} to
4495
+ * establish persistent connections for every enabled channel installation
4496
+ * across ALL tenants.
4497
+ *
4498
+ * Adapters implement the optional {@link ChannelAdapter.connect} method
4499
+ * which handles connection setup, event ingestion, and message dispatch
4500
+ * internally.
4501
+ */
4502
+
4503
+ interface ConnectAllChannelsOptions {
4504
+ deps?: unknown;
4505
+ }
4506
+ declare function connectAllChannels(getAdapter: (channel: string) => ChannelAdapter | undefined, options?: ConnectAllChannelsOptions): Promise<void>;
4507
+
4422
4508
  /**
4423
4509
  * Sets the global {@link BindingRegistry} instance used by the channel message router.
4424
4510
  *
@@ -4457,6 +4543,9 @@ declare function setBindingRegistry(r: BindingRegistry): void;
4457
4543
  */
4458
4544
  declare function getBindingRegistry(): BindingRegistry;
4459
4545
 
4546
+ declare function setMenuRegistry(r: MenuRegistry): void;
4547
+ declare function getMenuRegistry(): MenuRegistry;
4548
+
4460
4549
  /**
4461
4550
  * Agent Team - Store Protocols
4462
4551
  *
@@ -5910,8 +5999,8 @@ declare class Agent {
5910
5999
  assistant_id: string;
5911
6000
  thread_id: string;
5912
6001
  tenant_id: string;
5913
- workspace_id: string | undefined;
5914
- project_id: string | undefined;
6002
+ workspace_id: string;
6003
+ project_id: string;
5915
6004
  custom_run_config: any;
5916
6005
  queueMode: ThreadQueueConfig;
5917
6006
  private isWaitingForQueueEnd;
@@ -5957,9 +6046,39 @@ declare class Agent {
5957
6046
  invoke(queueMessage: QueueMessage, signal?: AbortSignal): Promise<{
5958
6047
  messages: any;
5959
6048
  }>;
6049
+ /**
6050
+ * Like {@link invoke} but returns the full LangGraph state (all annotations)
6051
+ * instead of only messages. Messages are serialized to dicts; other state
6052
+ * fields are returned as-is.
6053
+ *
6054
+ * @remarks
6055
+ * Only call this when you need the full state. Existing callers (gateway,
6056
+ * workflows) should keep using {@link invoke} which returns only messages
6057
+ * to avoid exposing internal annotation data.
6058
+ */
6059
+ invokeWithState(queueMessage: QueueMessage, signal?: AbortSignal): Promise<{
6060
+ messages: {
6061
+ role: string;
6062
+ content: string;
6063
+ name: string | undefined;
6064
+ tool_call_id: string | undefined;
6065
+ additional_kwargs?: Record<string, any>;
6066
+ response_metadata?: Record<string, any>;
6067
+ id?: string;
6068
+ }[];
6069
+ }>;
5960
6070
  private agentExecutor;
5961
6071
  getPendingMessages(): Promise<PendingMessage[]>;
5962
6072
  private agentStreamExecutor;
6073
+ private consumeAgentStream;
6074
+ /**
6075
+ * Resume LangGraph execution from the last checkpoint.
6076
+ *
6077
+ * Streams with `null` input — this tells LangGraph to continue from
6078
+ * wherever it left off using the checkpointed state for this thread.
6079
+ * All output chunks are buffered via {@link addChunk}.
6080
+ */
6081
+ private resumeGraphFromCheckpoint;
5963
6082
  private waitingForQueueEnd;
5964
6083
  private getQueueStore;
5965
6084
  private getDefaultQueueConfig;
@@ -6065,9 +6184,14 @@ declare class Agent {
6065
6184
  /**
6066
6185
  * Resume processing after a server restart.
6067
6186
  *
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).
6187
+ * If the graph was mid-execution (BUSY) it resumes from the LangGraph
6188
+ * checkpoint without re-injecting the message the message has already
6189
+ * been consumed and is in the graph state. Processing messages are removed
6190
+ * rather than replayed.
6191
+ *
6192
+ * Skips threads that are in `INTERRUPTED` state (the interruption was
6193
+ * intentional). IDLE threads simply clean up and restart the queue
6194
+ * processor for any remaining pending messages.
6071
6195
  *
6072
6196
  * Called during gateway startup to recover threads that were mid-execution
6073
6197
  * when the server went down.
@@ -6425,4 +6549,178 @@ interface UnknownToolHandlerConfig {
6425
6549
  */
6426
6550
  declare function createUnknownToolHandlerMiddleware(config?: UnknownToolHandlerConfig): AgentMiddleware;
6427
6551
 
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 };
6552
+ declare function createTaskMiddleware(): AgentMiddleware;
6553
+
6554
+ type ResolveAgentFn = (ref?: string, responseFormat?: Record<string, unknown>, stepType?: string) => Promise<AgentClient>;
6555
+ /**
6556
+ * Build a LangGraph Annotation.Root from DSL state.fields.
6557
+ * Always adds an implicit `phase` field for progress tracking.
6558
+ */
6559
+ declare function buildStateAnnotation(fields?: Record<string, InternalStateField>): AnnotationRoot<any>;
6560
+ /**
6561
+ * Resolve a dot/bracket path against a state object.
6562
+ * Strips leading "state." prefix automatically.
6563
+ *
6564
+ * @example
6565
+ * resolvePath({ a: { b: [{ c: 1 }] } }, "state.a.b[0].c") // → 1
6566
+ */
6567
+ declare function resolvePath(obj: Record<string, unknown>, path: string): unknown;
6568
+ /**
6569
+ * Render a template string replacing `${state.path}`, `${item.path}`, and
6570
+ * custom item-key shortcuts like `${<key>.path}` (when `<key>` matches a
6571
+ * top-level property of the item context).
6572
+ *
6573
+ * @param template Template string with ${...} placeholders
6574
+ * @param state Current workflow state
6575
+ * @param item Optional item context (for map nodes). Keys in this object
6576
+ * become valid template prefixes (e.g. itemKey="row" → ${row.name}).
6577
+ */
6578
+ declare function renderTemplate(template: string, state: Record<string, unknown>, item?: Record<string, unknown>): string;
6579
+ /**
6580
+ * Build input for LangGraph agent invocation from DSL input specification.
6581
+ * Returns a partial state with messages, suitable for graph.invoke().
6582
+ *
6583
+ * When outputSchema is provided, it is converted into a readable JSON example
6584
+ * and appended to the prompt so the LLM knows exactly what shape to output.
6585
+ */
6586
+ declare function buildInput(input: InternalInput | undefined, state: Record<string, unknown>, item?: Record<string, unknown>, outputSchema?: Record<string, unknown>): {
6587
+ messages: BaseMessage[];
6588
+ };
6589
+ /**
6590
+ * Extract structured output from a sub-agent invocation result.
6591
+ *
6592
+ * Priority order:
6593
+ * 1. result.structuredResponse — langchain's tool strategy stores parsed output here
6594
+ * 2. result.messages — scan backwards for last AIMessage content (native JSON schema /
6595
+ * legacy text-based structured output)
6596
+ * 3. result itself (minus messages)
6597
+ */
6598
+ declare function extractOutput(result: Record<string, unknown>): unknown;
6599
+ /**
6600
+ * Process items in parallel with a concurrency limit (simple semaphore).
6601
+ */
6602
+ declare function parallelLimit<T, R>(items: T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
6603
+ /**
6604
+ * Invoke a function with retry logic and optional timeout.
6605
+ */
6606
+ declare function invokeWithRetry<T>(fn: () => Promise<T>, maxRetries: number, retryOn?: string[], timeoutMs?: number): Promise<T>;
6607
+ /**
6608
+ * Create a handler for an `agent` node.
6609
+ *
6610
+ * Resolves the agent by ref, builds input, invokes with retry,
6611
+ * extracts output, and returns a state update.
6612
+ */
6613
+ declare function createAgentNode(node: InternalAgentNode, resolveAgent: ResolveAgentFn, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>>;
6614
+ /**
6615
+ * Create a handler for a `map` node.
6616
+ *
6617
+ * Reads the source array from state, batches items, processes each
6618
+ * item through the inner agent in parallel (with concurrency control),
6619
+ * and optionally calls a reduce agent to aggregate results.
6620
+ */
6621
+ declare function createMapNode(node: InternalMapNode, resolveAgent: ResolveAgentFn, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>>;
6622
+ /**
6623
+ * Dispatch to the correct handler factory based on node type.
6624
+ */
6625
+ declare function createNodeHandler(node: InternalNode, resolveAgent: ResolveAgentFn, trackingStore?: WorkflowTrackingStore): (state: Record<string, unknown>, config?: RunnableConfig) => Promise<Partial<Record<string, unknown>>>;
6626
+
6627
+ /**
6628
+ * Workflow DSL → LangGraph StateGraph compiler
6629
+ *
6630
+ * Takes a YAML workflow string, parses it via parseYaml(),
6631
+ * and compiles the resulting InternalDSL into a runnable LangGraph StateGraph.
6632
+ */
6633
+
6634
+ /**
6635
+ * Compile a YAML workflow string into a LangGraph StateGraph.
6636
+ */
6637
+ declare function compileWorkflow(yamlStr: string, resolveAgent: ResolveAgentFn, checkpointer: BaseCheckpointSaver, trackingStore?: WorkflowTrackingStore): CompiledStateGraph<any, any, any, any, any>;
6638
+ /**
6639
+ * Compile an InternalDSL directly into a LangGraph StateGraph.
6640
+ * Used internally by compileWorkflow and for lower-level access.
6641
+ */
6642
+ declare function compileInternal(ir: InternalDSL, resolveAgent: ResolveAgentFn, checkpointer: BaseCheckpointSaver, trackingStore?: WorkflowTrackingStore): CompiledStateGraph<any, any, any, any, any>;
6643
+ interface WorkflowValidationError {
6644
+ type: "error" | "warning";
6645
+ message: string;
6646
+ }
6647
+ /** Validate an expanded InternalDSL for structural correctness. */
6648
+ declare function validateDSL(dsl: InternalDSL): WorkflowValidationError[];
6649
+
6650
+ /**
6651
+ * Convert condition expression's leading identifier to bracket notation
6652
+ * so hyphenated step ids don't break JS parsing.
6653
+ * "classify-doc.intent" → "state[\"classify-doc\"].intent"
6654
+ */
6655
+ declare function toSafeStateExpr(expr: string): string;
6656
+ declare function parseYaml(yamlStr: string): InternalDSL;
6657
+
6658
+ /**
6659
+ * Convert shorthand schema notation to standard JSON Schema.
6660
+ *
6661
+ * Shorthand forms:
6662
+ * field: string → { type: "string" }
6663
+ * field: number → { type: "number" }
6664
+ * field: boolean → { type: "boolean" }
6665
+ * field: string[] → { type: "array", items: { type: "string" } }
6666
+ * field: number[] → { type: "array", items: { type: "number" } }
6667
+ * field: boolean[] → { type: "array", items: { type: "boolean" } }
6668
+ * field: [{a: string, b: number}] → { type: "array", items: { type: "object", ... } }
6669
+ * field: {a: string} → { type: "object", properties: {a: {type: "string"}}, required: ["a"] }
6670
+ *
6671
+ * @param fields Shorthand schema definition
6672
+ * @returns Standard JSON Schema or undefined if fields is empty/null
6673
+ */
6674
+ declare function toJsonSchema(fields: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
6675
+
6676
+ /**
6677
+ * Global singleton for personal assistant default configuration.
6678
+ *
6679
+ * Holds the base AgentConfig used when users create a personal assistant.
6680
+ * Projects can extend it via `extend()` to add/remove middleware and tools.
6681
+ *
6682
+ * @example
6683
+ * ```ts
6684
+ * import { PersonalAssistantConfig } from "@axiom-lattice/core";
6685
+ *
6686
+ * PersonalAssistantConfig.extend((config) => {
6687
+ * config.middleware.push({ id: "sql", type: "sql", ... });
6688
+ * config.tools.push("my_custom_tool");
6689
+ * config.middleware = config.middleware.filter(m => m.type !== "browser");
6690
+ * });
6691
+ * ```
6692
+ */
6693
+ declare class PersonalAssistantConfig {
6694
+ private static _config;
6695
+ /**
6696
+ * Get a deep clone of the current default config.
6697
+ * Caller must set `key` before registering as an agent.
6698
+ */
6699
+ static get(): AgentConfig;
6700
+ /**
6701
+ * Mutate the default config in-place.
6702
+ * Call once at app startup to customize middleware and tools.
6703
+ *
6704
+ * @param fn - Receives the live config object for direct mutation
6705
+ */
6706
+ static extend(fn: (config: Omit<AgentConfig, "key">) => void): void;
6707
+ /**
6708
+ * Reset config to built-in defaults (useful in tests).
6709
+ */
6710
+ static reset(): void;
6711
+ /**
6712
+ * Inject name and personality into a config by directly building
6713
+ * the claw middleware's bootstrap file contents.
6714
+ *
6715
+ * IDENTITY.md gets the actual name and personality description.
6716
+ * USER.md gets the user's name pre-filled.
6717
+ * SOUL.md is kept as-is (shared across all personal assistants).
6718
+ *
6719
+ * @param config - The agent config (must be a mutable copy from get())
6720
+ * @param name - Assistant display name (also used as the user's name in USER.md)
6721
+ * @param personality - Personality description for IDENTITY.md
6722
+ */
6723
+ static render(config: AgentConfig, name: string, personality: string): void;
6724
+ }
6725
+
6726
+ 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, type ConnectAllChannelsOptions, 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, InMemoryMenuStore, InMemoryTaskListStore, InMemoryTaskStore, 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, PersonalAssistantConfig, PinoLoggerClient, PostgresDatabase, PrometheusClient, type QueryResult, type QueueLattice, QueueLatticeManager, QueueMode, type QueuePendingEvent, RemoteSandboxInstance, RemoteSandboxProvider, type RemoteSandboxProviderConfig, type ResolveAgentFn, 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 WorkflowValidationError, type WriteResult, agentInstanceManager, agentLatticeManager, buildGrepResultsDict, buildInput, buildNamedVolumeName, buildSandboxMetadataEnv, buildSkillFile, buildStateAnnotation, checkEmptyContent, clearEncryptionKeyCache, compileInternal, compileWorkflow, computeSandboxName, configureStores, connectAllChannels, createAgentNode, createAgentTeam, createExecuteSqlQueryTool, createFileData, createInfoSqlTool, createListMetricsDataSourcesTool, createListMetricsServersTool, createListTablesSqlTool, createMapNode, createModelSelectorMiddleware, createNodeHandler, createProcessingAgent, createQueryCheckerSqlTool, createQueryMetricDefinitionTool, createQueryMetricsListTool, createQuerySemanticMetricDataTool, createQuerySqlTool, createQueryTableDefinitionTool, createQueryTablesListTool, createSandboxProvider, createSchedulerMiddleware, createTaskMiddleware, createTeamMiddleware, createTeammateTools, createUnknownToolHandlerMiddleware, createWidgetMiddleware, decrypt, describeCronExpression, embeddingsLatticeManager, encrypt, ensureBuiltinAgentsForTenant, eventBus, eventBus as eventBusDefault, extractFetcherError, extractOutput, fileDataToString, formatContentWithLineNumbers, formatGrepMatches, formatGrepResults, formatReadResponse, getAgentClient, getAgentConfig, getAllAgentConfigs, getAllBuiltInSkillMetas, getAllToolDefinitions, getBindingRegistry, getBuiltInSkillContent, getBuiltInSkillMeta, getBuiltInSkillNames, getCheckpointSaver, getChunkBuffer, getEmbeddingsClient, getEmbeddingsLattice, getEncryptionKey, getLoggerLattice, getMenuRegistry, getModelLattice, getNextCronTime, getQueueLattice, getSandBoxManager, getScheduleLattice, getStoreLattice, getToolClient, getToolDefinition, getToolLattice, getVectorStoreClient, getVectorStoreLattice, globSearchFiles, grepMatchesFromFiles, grepSearchFiles, hasChunkBuffer, invokeWithRetry, isBuiltInSkill, isUsingDefaultKey, isValidCronExpression, isValidSandboxName, isValidSkillName, loggerLatticeManager, mcpManager, metricsServerManager, modelLatticeManager, normalizeSandboxName, parallelLimit, parseCronExpression, parseSkillFrontmatter, parseYaml, performStringReplacement, queueLatticeManager, registerAgentLattice, registerAgentLatticeWithTenant, registerAgentLattices, registerCheckpointSaver, registerChunkBuffer, registerEmbeddingsLattice, registerExistingTool, registerLoggerLattice, registerModelLattice, registerQueueLattice, registerScheduleLattice, registerStoreLattice, registerTeammateAgent, registerToolLattice, registerVectorStoreLattice, renderTemplate, resolvePath, sandboxLatticeManager, sanitizeToolCallId, scheduleLatticeManager, setBindingRegistry, setMenuRegistry, skillLatticeManager, sqlDatabaseManager, storeLatticeManager, toJsonSchema, toSafeStateExpr, toolLatticeManager, truncateIfTooLong, unregisterTeammateAgent, updateFileData, validateAgentInput, validateDSL, validateEncryptionKey, validatePath, validateSkillName, validateToolInput, vectorStoreLatticeManager };