@axiom-lattice/protocols 2.1.54 → 3.0.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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +23 -0
- package/dist/index.d.mts +91 -3
- package/dist/index.d.ts +91 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/A2AProtocol.ts +6 -0
- package/src/AgentLatticeProtocol.ts +45 -2
- package/src/ConversationStoreProtocol.ts +36 -0
- package/src/LocalA2ATemplateConfig.ts +19 -0
- package/src/index.ts +2 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/protocols@
|
|
2
|
+
> @axiom-lattice/protocols@3.0.1 build /home/runner/work/agentic/agentic/packages/protocols
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m4.78 KB[39m
|
|
12
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m43.41 KB[39m
|
|
13
|
-
[32mESM[39m ⚡️ Build success in 264ms
|
|
14
11
|
[32mCJS[39m [1mdist/index.js [22m[32m6.69 KB[39m
|
|
15
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
16
|
-
[32mCJS[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m47.01 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 244ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m4.78 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m44.53 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 249ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 12041ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m138.95 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m138.95 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @axiom-lattice/protocols
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c6b8984: add document agent
|
|
8
|
+
|
|
9
|
+
## 3.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 3a124ab: **BREAKING**: Remove `LocalA2ATemplateStore` from store lattice, replacing it with static template config.
|
|
14
|
+
|
|
15
|
+
- Deleted `LocalA2ATemplateStoreProtocol` and all implementations (InMemory, PostgreSQL, SQLite)
|
|
16
|
+
- Removed `localA2ATemplate` entry from `StoreTypeMap` and store lattice default registrations
|
|
17
|
+
- Removed obsolete PostgreSQL Local A2A template migration source; existing database tables are not dropped
|
|
18
|
+
- Removed `LocalA2ATemplateEntry`, `CreateLocalA2ATemplateRequest`, `UpdateLocalA2ATemplateRequest` types
|
|
19
|
+
- `client.assistants.localA2A.templates` now only supports `.list()` (returns `LocalA2ATemplateDefinition[]`)
|
|
20
|
+
- Templates are now defined in `packages/gateway/src/config/local-a2a-templates.ts`
|
|
21
|
+
- Gateway resolves the managed CLI through the installed `@axiom-lattice/cli-a2a/cli-path` export and declares the CLI package as a runtime dependency
|
|
22
|
+
- Templates no longer contain port or agentCardUrl; those are user-supplied at creation time
|
|
23
|
+
- `CreateAssistantModal` appends the Agent Card URL port to template commands as `--port <port>` when the template does not already declare a port
|
|
24
|
+
- CLI session files are isolated by provider and server port when no explicit store path is configured
|
|
25
|
+
|
|
3
26
|
## 2.1.54
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -323,8 +323,19 @@ interface TeamAgentConfig extends BaseAgentConfig {
|
|
|
323
323
|
* Type guard to check if config is TeamAgentConfig
|
|
324
324
|
*/
|
|
325
325
|
declare function isTeamAgentConfig(config: AgentConfig): config is TeamAgentConfig;
|
|
326
|
+
interface LocalRuntimeConfig {
|
|
327
|
+
label?: string;
|
|
328
|
+
agentCardUrl: string;
|
|
329
|
+
healthUrl?: string;
|
|
330
|
+
command: {
|
|
331
|
+
executable: string;
|
|
332
|
+
args: string[];
|
|
333
|
+
cwd?: string;
|
|
334
|
+
env?: Record<string, string>;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
326
337
|
/**
|
|
327
|
-
* A2A_REMOTE agent configuration —
|
|
338
|
+
* A2A_REMOTE agent configuration — wraps a remote A2A-compatible agent endpoint.
|
|
328
339
|
*
|
|
329
340
|
* This agent type wraps a remote A2A endpoint so orchestrators can treat
|
|
330
341
|
* external agents the same as local LangGraph agents.
|
|
@@ -337,17 +348,39 @@ interface A2ARemoteAgentConfig extends BaseAgentConfig {
|
|
|
337
348
|
*/
|
|
338
349
|
agentCardUrl: string;
|
|
339
350
|
/**
|
|
340
|
-
* Optional API key sent as Bearer token
|
|
351
|
+
* Optional API key sent as a Bearer token.
|
|
341
352
|
*/
|
|
342
353
|
apiKey?: string;
|
|
343
354
|
/**
|
|
344
355
|
* HTTP timeout in milliseconds (default: 300_000 = 5 min).
|
|
345
356
|
*/
|
|
346
357
|
timeout?: number;
|
|
358
|
+
projectId?: string;
|
|
347
359
|
/**
|
|
348
360
|
* Optional tool keys (not used by the builder, but included for type compatibility).
|
|
349
361
|
*/
|
|
350
362
|
tools?: string[];
|
|
363
|
+
/**
|
|
364
|
+
* Optional local runtime snapshot for Local Managed A2A assistants.
|
|
365
|
+
* When present, the gateway manages a local process for this assistant.
|
|
366
|
+
* Copied from a template or custom form at creation time.
|
|
367
|
+
*/
|
|
368
|
+
localRuntime?: LocalRuntimeConfig;
|
|
369
|
+
}
|
|
370
|
+
type LocalA2AProviderId = string;
|
|
371
|
+
type LocalA2AProviderStatus = "missing" | "disabled" | "starting" | "running" | "stopped" | "failed";
|
|
372
|
+
interface LocalA2AProviderState {
|
|
373
|
+
runtimeId: string;
|
|
374
|
+
label: string;
|
|
375
|
+
status: LocalA2AProviderStatus;
|
|
376
|
+
enabled: boolean;
|
|
377
|
+
assistantId?: string;
|
|
378
|
+
agentCardUrl?: string;
|
|
379
|
+
healthUrl?: string;
|
|
380
|
+
pid?: number;
|
|
381
|
+
message?: string;
|
|
382
|
+
lastStartedAt?: string;
|
|
383
|
+
lastStoppedAt?: string;
|
|
351
384
|
}
|
|
352
385
|
/**
|
|
353
386
|
* WORKFLOW agent configuration — compiled from YAML workflow DSL into a LangGraph StateGraph.
|
|
@@ -3933,6 +3966,24 @@ interface TaskWorkItemStore {
|
|
|
3933
3966
|
list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
|
|
3934
3967
|
}
|
|
3935
3968
|
|
|
3969
|
+
/**
|
|
3970
|
+
* LocalA2ATemplateConfig
|
|
3971
|
+
*
|
|
3972
|
+
* Read-only template definitions for Local Managed A2A providers.
|
|
3973
|
+
* Templates define command defaults (executable, args, cwd, env)
|
|
3974
|
+
* without port or agentCardUrl — those are user-supplied at creation time.
|
|
3975
|
+
*
|
|
3976
|
+
* Templates are defined in `packages/gateway/src/config/local-a2a-templates.ts`
|
|
3977
|
+
* and served via `GET /api/local-a2a/templates`.
|
|
3978
|
+
*/
|
|
3979
|
+
|
|
3980
|
+
interface LocalA2ATemplateDefinition {
|
|
3981
|
+
key: string;
|
|
3982
|
+
name: string;
|
|
3983
|
+
description?: string;
|
|
3984
|
+
command: LocalRuntimeConfig["command"];
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3936
3987
|
/**
|
|
3937
3988
|
* ChannelAdapterProtocol
|
|
3938
3989
|
*/
|
|
@@ -4068,6 +4119,9 @@ type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;
|
|
|
4068
4119
|
interface A2AMessage {
|
|
4069
4120
|
role: "user" | "agent";
|
|
4070
4121
|
parts: A2APart[];
|
|
4122
|
+
messageId?: string;
|
|
4123
|
+
contextId?: string;
|
|
4124
|
+
referenceTaskIds?: string[];
|
|
4071
4125
|
metadata?: Record<string, unknown>;
|
|
4072
4126
|
}
|
|
4073
4127
|
type A2ATaskState = "working" | "input-required" | "completed" | "failed" | "canceled" | "rejected";
|
|
@@ -4085,6 +4139,7 @@ interface A2AArtifact {
|
|
|
4085
4139
|
interface A2ATask {
|
|
4086
4140
|
id: string;
|
|
4087
4141
|
sessionId?: string;
|
|
4142
|
+
contextId?: string;
|
|
4088
4143
|
status: A2ATaskStatus;
|
|
4089
4144
|
artifacts: A2AArtifact[];
|
|
4090
4145
|
history?: A2AMessage[];
|
|
@@ -4105,6 +4160,7 @@ interface A2APushNotification {
|
|
|
4105
4160
|
interface A2ATaskUpdatePayload {
|
|
4106
4161
|
id: string;
|
|
4107
4162
|
sessionId?: string;
|
|
4163
|
+
contextId?: string;
|
|
4108
4164
|
status: A2ATaskStatus;
|
|
4109
4165
|
final?: boolean;
|
|
4110
4166
|
metadata?: Record<string, unknown>;
|
|
@@ -4112,6 +4168,7 @@ interface A2ATaskUpdatePayload {
|
|
|
4112
4168
|
interface A2ATaskArtifactUpdatePayload {
|
|
4113
4169
|
id: string;
|
|
4114
4170
|
sessionId?: string;
|
|
4171
|
+
contextId?: string;
|
|
4115
4172
|
artifact: A2AArtifact;
|
|
4116
4173
|
final?: boolean;
|
|
4117
4174
|
metadata?: Record<string, unknown>;
|
|
@@ -4208,6 +4265,37 @@ interface A2AApiKeyStore {
|
|
|
4208
4265
|
loadIntoMap(): Promise<Map<string, A2AApiKeyEntry>>;
|
|
4209
4266
|
}
|
|
4210
4267
|
|
|
4268
|
+
/**
|
|
4269
|
+
* ConversationStoreProtocol
|
|
4270
|
+
*
|
|
4271
|
+
* Application-layer conversation persistence. Maintains mappings from
|
|
4272
|
+
* application `conversationId`/`threadId` to A2A task IDs, allowing
|
|
4273
|
+
* consumers to reference previous tasks without relying on A2A protocol
|
|
4274
|
+
* state for chat memory. A2A handles task routing; conversation memory
|
|
4275
|
+
* lives here.
|
|
4276
|
+
*/
|
|
4277
|
+
interface ConversationRecord {
|
|
4278
|
+
conversationId: string;
|
|
4279
|
+
tenantId?: string;
|
|
4280
|
+
taskIds: string[];
|
|
4281
|
+
contextId?: string;
|
|
4282
|
+
metadata?: Record<string, unknown>;
|
|
4283
|
+
createdAt: string;
|
|
4284
|
+
updatedAt: string;
|
|
4285
|
+
}
|
|
4286
|
+
interface CreateConversationInput {
|
|
4287
|
+
conversationId: string;
|
|
4288
|
+
tenantId?: string;
|
|
4289
|
+
contextId?: string;
|
|
4290
|
+
metadata?: Record<string, unknown>;
|
|
4291
|
+
}
|
|
4292
|
+
interface IConversationStore {
|
|
4293
|
+
getConversation(conversationId: string): Promise<ConversationRecord | null>;
|
|
4294
|
+
createConversation(input: CreateConversationInput): Promise<ConversationRecord>;
|
|
4295
|
+
addTaskToConversation(conversationId: string, taskId: string): Promise<ConversationRecord>;
|
|
4296
|
+
deleteConversation(conversationId: string): Promise<void>;
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4211
4299
|
/**
|
|
4212
4300
|
* YAML Workflow DSL — linear model with parallel blocks
|
|
4213
4301
|
*
|
|
@@ -4678,4 +4766,4 @@ type Timestamp = number;
|
|
|
4678
4766
|
*/
|
|
4679
4767
|
type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
|
|
4680
4768
|
|
|
4681
|
-
export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AArtifact, type A2AAuthContext, type A2ACapabilities, type A2AConfig, type A2ADataPart, type A2AFilePart, type A2AMessage, type A2APart, type A2AProvider, type A2APushNotification, type A2ARemoteAgentConfig, type A2ASSEEvent, type A2ASkill, type A2ATask, type A2ATaskArtifactUpdatePayload, type A2ATaskSendRequest, type A2ATaskState, type A2ATaskStatus, type A2ATaskUpdatePayload, type A2ATextPart, A2A_DEFAULT_CAPABILITIES, A2A_DEFAULT_INPUT_MODES, A2A_DEFAULT_OUTPUT_MODES, type AgentCard, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, type Callback, type ChannelAdapter, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type CreateA2AApiKeyInput, type CreateAssistantRequest, type CreateBindingInput, type CreateChannelInstallationRequest, type CreateCollectionRequest, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DeveloperMessage, type DispatchResult, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InterruptMessage, type LLMConfig, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelLatticeProtocol, type OutboundMessage, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginToolMeta, type ProcessingAgentConfig, type Project, type ProjectStore, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunStep, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskHandler, type TaskItem, type TaskListFilter, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type TeamAgentConfig, type TeamTeammateConfig, type Tenant, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, type WechatChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isProcessingAgentConfig, isTeamAgentConfig, isWorkflowAgentConfig };
|
|
4769
|
+
export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AArtifact, type A2AAuthContext, type A2ACapabilities, type A2AConfig, type A2ADataPart, type A2AFilePart, type A2AMessage, type A2APart, type A2AProvider, type A2APushNotification, type A2ARemoteAgentConfig, type A2ASSEEvent, type A2ASkill, type A2ATask, type A2ATaskArtifactUpdatePayload, type A2ATaskSendRequest, type A2ATaskState, type A2ATaskStatus, type A2ATaskUpdatePayload, type A2ATextPart, A2A_DEFAULT_CAPABILITIES, A2A_DEFAULT_INPUT_MODES, A2A_DEFAULT_OUTPUT_MODES, type AgentCard, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, type Callback, type ChannelAdapter, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type ConversationRecord, type CreateA2AApiKeyInput, type CreateAssistantRequest, type CreateBindingInput, type CreateChannelInstallationRequest, type CreateCollectionRequest, type CreateConversationInput, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DeveloperMessage, type DispatchResult, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type IConversationStore, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InterruptMessage, type LLMConfig, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LocalA2AProviderId, type LocalA2AProviderState, type LocalA2AProviderStatus, type LocalA2ATemplateDefinition, type LocalRuntimeConfig, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelLatticeProtocol, type OutboundMessage, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginToolMeta, type ProcessingAgentConfig, type Project, type ProjectStore, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunStep, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskHandler, type TaskItem, type TaskListFilter, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type TeamAgentConfig, type TeamTeammateConfig, type Tenant, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, type WechatChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isProcessingAgentConfig, isTeamAgentConfig, isWorkflowAgentConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -323,8 +323,19 @@ interface TeamAgentConfig extends BaseAgentConfig {
|
|
|
323
323
|
* Type guard to check if config is TeamAgentConfig
|
|
324
324
|
*/
|
|
325
325
|
declare function isTeamAgentConfig(config: AgentConfig): config is TeamAgentConfig;
|
|
326
|
+
interface LocalRuntimeConfig {
|
|
327
|
+
label?: string;
|
|
328
|
+
agentCardUrl: string;
|
|
329
|
+
healthUrl?: string;
|
|
330
|
+
command: {
|
|
331
|
+
executable: string;
|
|
332
|
+
args: string[];
|
|
333
|
+
cwd?: string;
|
|
334
|
+
env?: Record<string, string>;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
326
337
|
/**
|
|
327
|
-
* A2A_REMOTE agent configuration —
|
|
338
|
+
* A2A_REMOTE agent configuration — wraps a remote A2A-compatible agent endpoint.
|
|
328
339
|
*
|
|
329
340
|
* This agent type wraps a remote A2A endpoint so orchestrators can treat
|
|
330
341
|
* external agents the same as local LangGraph agents.
|
|
@@ -337,17 +348,39 @@ interface A2ARemoteAgentConfig extends BaseAgentConfig {
|
|
|
337
348
|
*/
|
|
338
349
|
agentCardUrl: string;
|
|
339
350
|
/**
|
|
340
|
-
* Optional API key sent as Bearer token
|
|
351
|
+
* Optional API key sent as a Bearer token.
|
|
341
352
|
*/
|
|
342
353
|
apiKey?: string;
|
|
343
354
|
/**
|
|
344
355
|
* HTTP timeout in milliseconds (default: 300_000 = 5 min).
|
|
345
356
|
*/
|
|
346
357
|
timeout?: number;
|
|
358
|
+
projectId?: string;
|
|
347
359
|
/**
|
|
348
360
|
* Optional tool keys (not used by the builder, but included for type compatibility).
|
|
349
361
|
*/
|
|
350
362
|
tools?: string[];
|
|
363
|
+
/**
|
|
364
|
+
* Optional local runtime snapshot for Local Managed A2A assistants.
|
|
365
|
+
* When present, the gateway manages a local process for this assistant.
|
|
366
|
+
* Copied from a template or custom form at creation time.
|
|
367
|
+
*/
|
|
368
|
+
localRuntime?: LocalRuntimeConfig;
|
|
369
|
+
}
|
|
370
|
+
type LocalA2AProviderId = string;
|
|
371
|
+
type LocalA2AProviderStatus = "missing" | "disabled" | "starting" | "running" | "stopped" | "failed";
|
|
372
|
+
interface LocalA2AProviderState {
|
|
373
|
+
runtimeId: string;
|
|
374
|
+
label: string;
|
|
375
|
+
status: LocalA2AProviderStatus;
|
|
376
|
+
enabled: boolean;
|
|
377
|
+
assistantId?: string;
|
|
378
|
+
agentCardUrl?: string;
|
|
379
|
+
healthUrl?: string;
|
|
380
|
+
pid?: number;
|
|
381
|
+
message?: string;
|
|
382
|
+
lastStartedAt?: string;
|
|
383
|
+
lastStoppedAt?: string;
|
|
351
384
|
}
|
|
352
385
|
/**
|
|
353
386
|
* WORKFLOW agent configuration — compiled from YAML workflow DSL into a LangGraph StateGraph.
|
|
@@ -3933,6 +3966,24 @@ interface TaskWorkItemStore {
|
|
|
3933
3966
|
list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
|
|
3934
3967
|
}
|
|
3935
3968
|
|
|
3969
|
+
/**
|
|
3970
|
+
* LocalA2ATemplateConfig
|
|
3971
|
+
*
|
|
3972
|
+
* Read-only template definitions for Local Managed A2A providers.
|
|
3973
|
+
* Templates define command defaults (executable, args, cwd, env)
|
|
3974
|
+
* without port or agentCardUrl — those are user-supplied at creation time.
|
|
3975
|
+
*
|
|
3976
|
+
* Templates are defined in `packages/gateway/src/config/local-a2a-templates.ts`
|
|
3977
|
+
* and served via `GET /api/local-a2a/templates`.
|
|
3978
|
+
*/
|
|
3979
|
+
|
|
3980
|
+
interface LocalA2ATemplateDefinition {
|
|
3981
|
+
key: string;
|
|
3982
|
+
name: string;
|
|
3983
|
+
description?: string;
|
|
3984
|
+
command: LocalRuntimeConfig["command"];
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3936
3987
|
/**
|
|
3937
3988
|
* ChannelAdapterProtocol
|
|
3938
3989
|
*/
|
|
@@ -4068,6 +4119,9 @@ type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;
|
|
|
4068
4119
|
interface A2AMessage {
|
|
4069
4120
|
role: "user" | "agent";
|
|
4070
4121
|
parts: A2APart[];
|
|
4122
|
+
messageId?: string;
|
|
4123
|
+
contextId?: string;
|
|
4124
|
+
referenceTaskIds?: string[];
|
|
4071
4125
|
metadata?: Record<string, unknown>;
|
|
4072
4126
|
}
|
|
4073
4127
|
type A2ATaskState = "working" | "input-required" | "completed" | "failed" | "canceled" | "rejected";
|
|
@@ -4085,6 +4139,7 @@ interface A2AArtifact {
|
|
|
4085
4139
|
interface A2ATask {
|
|
4086
4140
|
id: string;
|
|
4087
4141
|
sessionId?: string;
|
|
4142
|
+
contextId?: string;
|
|
4088
4143
|
status: A2ATaskStatus;
|
|
4089
4144
|
artifacts: A2AArtifact[];
|
|
4090
4145
|
history?: A2AMessage[];
|
|
@@ -4105,6 +4160,7 @@ interface A2APushNotification {
|
|
|
4105
4160
|
interface A2ATaskUpdatePayload {
|
|
4106
4161
|
id: string;
|
|
4107
4162
|
sessionId?: string;
|
|
4163
|
+
contextId?: string;
|
|
4108
4164
|
status: A2ATaskStatus;
|
|
4109
4165
|
final?: boolean;
|
|
4110
4166
|
metadata?: Record<string, unknown>;
|
|
@@ -4112,6 +4168,7 @@ interface A2ATaskUpdatePayload {
|
|
|
4112
4168
|
interface A2ATaskArtifactUpdatePayload {
|
|
4113
4169
|
id: string;
|
|
4114
4170
|
sessionId?: string;
|
|
4171
|
+
contextId?: string;
|
|
4115
4172
|
artifact: A2AArtifact;
|
|
4116
4173
|
final?: boolean;
|
|
4117
4174
|
metadata?: Record<string, unknown>;
|
|
@@ -4208,6 +4265,37 @@ interface A2AApiKeyStore {
|
|
|
4208
4265
|
loadIntoMap(): Promise<Map<string, A2AApiKeyEntry>>;
|
|
4209
4266
|
}
|
|
4210
4267
|
|
|
4268
|
+
/**
|
|
4269
|
+
* ConversationStoreProtocol
|
|
4270
|
+
*
|
|
4271
|
+
* Application-layer conversation persistence. Maintains mappings from
|
|
4272
|
+
* application `conversationId`/`threadId` to A2A task IDs, allowing
|
|
4273
|
+
* consumers to reference previous tasks without relying on A2A protocol
|
|
4274
|
+
* state for chat memory. A2A handles task routing; conversation memory
|
|
4275
|
+
* lives here.
|
|
4276
|
+
*/
|
|
4277
|
+
interface ConversationRecord {
|
|
4278
|
+
conversationId: string;
|
|
4279
|
+
tenantId?: string;
|
|
4280
|
+
taskIds: string[];
|
|
4281
|
+
contextId?: string;
|
|
4282
|
+
metadata?: Record<string, unknown>;
|
|
4283
|
+
createdAt: string;
|
|
4284
|
+
updatedAt: string;
|
|
4285
|
+
}
|
|
4286
|
+
interface CreateConversationInput {
|
|
4287
|
+
conversationId: string;
|
|
4288
|
+
tenantId?: string;
|
|
4289
|
+
contextId?: string;
|
|
4290
|
+
metadata?: Record<string, unknown>;
|
|
4291
|
+
}
|
|
4292
|
+
interface IConversationStore {
|
|
4293
|
+
getConversation(conversationId: string): Promise<ConversationRecord | null>;
|
|
4294
|
+
createConversation(input: CreateConversationInput): Promise<ConversationRecord>;
|
|
4295
|
+
addTaskToConversation(conversationId: string, taskId: string): Promise<ConversationRecord>;
|
|
4296
|
+
deleteConversation(conversationId: string): Promise<void>;
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4211
4299
|
/**
|
|
4212
4300
|
* YAML Workflow DSL — linear model with parallel blocks
|
|
4213
4301
|
*
|
|
@@ -4678,4 +4766,4 @@ type Timestamp = number;
|
|
|
4678
4766
|
*/
|
|
4679
4767
|
type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
|
|
4680
4768
|
|
|
4681
|
-
export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AArtifact, type A2AAuthContext, type A2ACapabilities, type A2AConfig, type A2ADataPart, type A2AFilePart, type A2AMessage, type A2APart, type A2AProvider, type A2APushNotification, type A2ARemoteAgentConfig, type A2ASSEEvent, type A2ASkill, type A2ATask, type A2ATaskArtifactUpdatePayload, type A2ATaskSendRequest, type A2ATaskState, type A2ATaskStatus, type A2ATaskUpdatePayload, type A2ATextPart, A2A_DEFAULT_CAPABILITIES, A2A_DEFAULT_INPUT_MODES, A2A_DEFAULT_OUTPUT_MODES, type AgentCard, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, type Callback, type ChannelAdapter, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type CreateA2AApiKeyInput, type CreateAssistantRequest, type CreateBindingInput, type CreateChannelInstallationRequest, type CreateCollectionRequest, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DeveloperMessage, type DispatchResult, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InterruptMessage, type LLMConfig, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelLatticeProtocol, type OutboundMessage, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginToolMeta, type ProcessingAgentConfig, type Project, type ProjectStore, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunStep, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskHandler, type TaskItem, type TaskListFilter, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type TeamAgentConfig, type TeamTeammateConfig, type Tenant, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, type WechatChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isProcessingAgentConfig, isTeamAgentConfig, isWorkflowAgentConfig };
|
|
4769
|
+
export { type A2AApiKeyEntry, type A2AApiKeyRecord, type A2AApiKeyStore, type A2AArtifact, type A2AAuthContext, type A2ACapabilities, type A2AConfig, type A2ADataPart, type A2AFilePart, type A2AMessage, type A2APart, type A2AProvider, type A2APushNotification, type A2ARemoteAgentConfig, type A2ASSEEvent, type A2ASkill, type A2ATask, type A2ATaskArtifactUpdatePayload, type A2ATaskSendRequest, type A2ATaskState, type A2ATaskStatus, type A2ATaskUpdatePayload, type A2ATextPart, A2A_DEFAULT_CAPABILITIES, A2A_DEFAULT_INPUT_MODES, A2A_DEFAULT_OUTPUT_MODES, type AgentCard, type AgentClient, type AgentConfig, type AgentConfigWithTools, type AgentLatticeProtocol, type AgentMenuConfig, type AgentMiddlewareConfig, type AgentRunConfig, AgentType, type Assistant, type AssistantMessage, type AssistantStore, type Attachment, type AvailableModule, type BaseLatticeProtocol, type BaseMessage, type Binding, type BindingRegistry, type BootstrapFilesConfig, type BrowserMiddlewareConfig, type Callback, type ChannelAdapter, type ChannelInstallation, type ChannelInstallationStore, type ChannelInstallationType, type ClawMiddlewareConfig, type CodeEvalMiddlewareConfig, type Collection, type CollectionField, type CollectionFieldType, type CollectionMiddlewareConfig, type CollectionSchema, type CollectionStore, type ConnectionEntry, type ConnectionStore, type ConversationRecord, type CreateA2AApiKeyInput, type CreateAssistantRequest, type CreateBindingInput, type CreateChannelInstallationRequest, type CreateCollectionRequest, type CreateConversationInput, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateShareRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkItemRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type CustomMenuConfig, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DeveloperMessage, type DispatchResult, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type FilterCondition, type GraphBuildOptions, type HtmlMenuConfig, type IConversationStore, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalDSL, type InternalEdge, type InternalInput, type InternalInputNode, type InternalMapNode, type InternalNode, type InternalNodeConfig, type InternalOutput, type InternalState, type InternalStateField, type InternalTerminalNode, type InterruptMessage, type LLMConfig, type LarkChannelInstallationConfig, type LatticeError, type LatticeEventBus, type LatticeMessage, type LocalA2AProviderId, type LocalA2AProviderState, type LocalA2AProviderStatus, type LocalA2ATemplateDefinition, type LocalRuntimeConfig, type LoggerClient, type LoggerConfig, type LoggerContext, type LoggerLatticeProtocol, LoggerType, type McpClient, type McpClientOptions, type McpConnectionStatus, type McpLatticeMessage, type McpLatticeProtocol, McpMessageType, type McpServerConfig, type McpServerConfigEntry, type McpServerConfigStore, type McpStats, type McpTool, type McpToolResult, type McpTransportType, type MemoryClient, type MemoryConfig, type MemoryLatticeProtocol, MemoryType, type MenuContentConfig, type MenuContentType, type MenuItem, type MenuRegistry, type MenuTarget, type Message, type MessageChunk, type MessageChunkType, MessageChunkTypes, type MessageContext, type MessageMiddleware, type MetricColumn, type MetricDataPoint, type MetricMeta, type MetricQueryResult, type MetricsMiddlewareConfig, type MetricsServerConfig, type MetricsServerConfigEntry, type MetricsServerConfigStore, type MetricsServerType, type MiddlewareType, type ModelLatticeProtocol, type OutboundMessage, type PaginatedResult, type PaginationParams, type PinoFileOptions, type Plugin, type PluginConnection, type PluginConnectionFieldSchema, type PluginConnectionTestResult, type PluginContext, type PluginDiscoveredResource, type PluginMeta, type PluginMetaOutput, type PluginMiddlewareFactory, type PluginToolMeta, type ProcessingAgentConfig, type Project, type ProjectStore, type QueryParams, type QueryResultFormat, type QueryWorkflowRunsOptions, type QueryWorkflowRunsResult, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type ReplyTarget, type ResourceAddress, type ResourceResolver, type Result, type RunStep, type STTClient, type STTConfig, type STTModelLatticeProtocol, type SandboxMiddlewareConfig, type ScheduleClient, type ScheduleConfig, type ScheduleCronOptions, ScheduleExecutionType, type ScheduleLatticeProtocol, type ScheduleOnceOptions, type ScheduleStorage, ScheduleType, type ScheduledTaskDefinition, ScheduledTaskStatus, type SchedulerMiddlewareConfig, type SemanticMetricsFilter, type SemanticMetricsQueryRequest, type SemanticMetricsQueryResponse, type SemanticMetricsServerConfig, type ShareRecord, type ShareResult, type ShareVisibility, type SharedResourceStore, type Skill, type SkillClient, type SkillClientType, type SkillConfig, type SkillLatticeProtocol, type SkillStore, type SkillStoreContext, type SqlMiddlewareConfig, type StepStatus, type StepType, type StorageType, type SystemMessage, type TableQueryRequest, type TableQueryResponse, type TaskHandler, type TaskItem, type TaskListFilter, type TaskStore, type TaskWorkItem, type TaskWorkItemListFilter, type TaskWorkItemStore, type TeamAgentConfig, type TeamTeammateConfig, type Tenant, type TenantStatus, type TenantStore, type TestMcpServerToolsResponse, type Thread, type ThreadStore, type Timestamp, type ToolCall, type ToolConfig, type ToolExecutor, type ToolLatticeProtocol, type ToolMessage, type TopologyEdge, type TranscriptionResult, type UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateChannelInstallationRequest, type UpdateCollectionRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMenuItemInput, type UpdateMetricsServerConfigRequest, type UpdateProjectRequest, type UpdateRunStepRequest, type UpdateTaskRequest, type UpdateTenantRequest, type UpdateUserRequest, type UpdateUserTenantLinkRequest, type UpdateWorkflowRunRequest, type UpdateWorkspaceRequest, type User, type UserMessage, type UserStatus, type UserStore, type UserTenantLink, type UserTenantLinkStore, type UserTenantRole, type VectorStoreConfig, type VectorStoreCreateParams, type VectorStoreLatticeProtocol, type VectorStoreProvider, type WechatChannelInstallationConfig, type WorkflowAgentConfig, type WorkflowRun, type WorkflowRunStatus, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, type YamlAgentStep, type YamlMapStep, type YamlParallelBlock, type YamlTopLevelStep, type YamlWorkflow, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isProcessingAgentConfig, isTeamAgentConfig, isWorkflowAgentConfig };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/AgentLatticeProtocol.ts","../src/MemoryLatticeProtocol.ts","../src/UILatticeProtocol.ts","../src/QueueLatticeProtocol.ts","../src/ScheduleLatticeProtocol.ts","../src/LoggerLatticeProtocol.ts","../src/MessageProtocol.ts","../src/McpLatticeProtocol.ts","../src/A2AProtocol.ts"],"sourcesContent":["/**\n * Protocols\n *\n * 导出所有Lattice协议接口,为整个系统提供统一的接口规范\n */\n\nexport * from \"./BaseLatticeProtocol\";\nexport * from \"./ToolLatticeProtocol\";\nexport * from \"./ModelLatticeProtocol\";\nexport * from \"./AgentLatticeProtocol\";\nexport * from \"./MemoryLatticeProtocol\";\nexport * from \"./UILatticeProtocol\";\nexport * from \"./QueueLatticeProtocol\";\nexport * from \"./ScheduleLatticeProtocol\";\nexport * from \"./EmbeddingsLatticeProtocol\";\nexport * from \"./STTModelLatticeProtocol\";\nexport * from \"./VectorStoreLatticeProtocol\";\nexport * from \"./LoggerLatticeProtocol\";\nexport * from \"./MessageProtocol\";\nexport * from \"./ThreadStoreProtocol\";\nexport * from \"./AssistantStoreProtocol\";\nexport * from \"./SkillLatticeProtocol\";\nexport * from \"./SkillStoreProtocol\";\nexport * from \"./McpLatticeProtocol\";\nexport * from \"./WorkspaceStoreProtocol\";\nexport * from \"./TenantStoreProtocol\";\nexport * from \"./DatabaseConfigStoreProtocol\";\nexport * from \"./ConnectionStoreProtocol\";\nexport * from \"./ChannelInstallationStoreProtocol\";\nexport * from \"./MetricsServerConfigStoreProtocol\";\nexport * from \"./McpServerConfigStoreProtocol\";\nexport * from \"./UserStoreProtocol\";\nexport * from \"./UserTenantLinkProtocol\";\nexport * from \"./WorkflowTrackingStoreProtocol\";\nexport * from \"./BindingProtocol\";\nexport * from \"./CollectionStoreProtocol\";\nexport * from \"./VectorStoreProviderProtocol\";\nexport * from \"./MenuProtocol\";\nexport * from \"./EvalStoreProtocol\";\nexport * from \"./TaskStoreProtocol\";\nexport * from \"./TaskWorkItemProtocol\";\n\nexport * from \"./ChannelAdapterProtocol\";\nexport * from \"./A2AProtocol\";\nexport * from \"./A2AApiKeyStoreProtocol\";\n\n// Workflow DSL (concise, public API)\nexport * from \"./WorkflowDSL\";\n\n// Internal DSL (expanded IR, internal use)\nexport * from \"./InternalDSL\";\n\nexport * from \"./SandboxResourceProtocol\";\n\n// Plugin system\nexport type {\n Plugin,\n PluginMeta,\n PluginMetaOutput,\n PluginConnection,\n PluginConnectionFieldSchema,\n PluginConnectionTestResult,\n PluginDiscoveredResource,\n PluginContext,\n PluginToolMeta,\n PluginMiddlewareFactory,\n} from \"./PluginProtocol\";\n\n// 导出通用类型\nexport * from \"./types\";\n","/**\n * AgentLatticeProtocol\n *\n * 智能体Lattice的协议,定义了智能体的行为和组合方式\n */\n\nimport { CompiledStateGraph } from \"@langchain/langgraph\";\nimport { ZodObject } from \"zod\";\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 智能体类型枚举\n */\nexport enum AgentType {\n REACT = \"react\",\n DEEP_AGENT = \"deep_agent\",\n TEAM = \"team\",\n PROCESSING = \"processing\",\n /** Remote A2A agent — delegates to an external A2A-compatible server */\n A2A_REMOTE = \"a2a_remote\",\n /** Workflow agent — compiled from YAML DSL into a LangGraph StateGraph */\n WORKFLOW = \"workflow\",\n}\n\n/**\n * Runtime configuration that will be injected into LangGraphRunnableConfig.configurable\n * Tools can access these values via config.configurable.runConfig\n */\nexport interface AgentRunConfig {\n /** Database key for SQL tools (registered via sqlDatabaseManager) */\n databaseKey?: string;\n /** Any additional runtime configuration */\n [key: string]: any;\n}\n\n/**\n * Base agent configuration shared by all agent types\n */\ninterface BaseAgentConfig {\n key: string; // Unique key\n name: string; // Name\n description: string; // Description\n prompt: string; // Prompt\n /**\n * Key of the parent agent to inherit configuration from.\n * When set, unspecified fields are inherited from the parent agent's config.\n * Child's explicitly set fields override the parent's.\n */\n extendsAgent?: string;\n schema?: ZodObject<any, any, any, any, any>; // Input validation schema\n modelKey?: string; // Model key to use\n /**\n * Runtime configuration to inject into tool execution context\n * Will be available in tools via config.configurable.runConfig\n */\n runConfig?: AgentRunConfig;\n skillCategories?: string[];\n middleware?: AgentMiddlewareConfig[];\n /**\n * Structured output response format for the agent.\n * Supports Zod schema (z.object({...})), JSON Schema object ({ type: \"object\", properties: {...} }),\n * providerStrategy(), toolStrategy(), and other formats accepted by the underlying model.\n *\n * @example\n * ```ts\n * // Zod schema\n * responseFormat: z.object({ name: z.string(), age: z.number() })\n *\n * // JSON Schema\n * responseFormat: { type: \"object\", properties: { name: { type: \"string\" } }, required: [\"name\"] }\n * ```\n */\n responseFormat?: any;\n}\n\nexport type AvailableModule = \"filesystem\" | \"code_eval\" | \"browser\";\n\nexport interface SandboxMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n modules: AvailableModule[];\n}\n\nexport interface CodeEvalMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n timeout: number;\n memoryLimit: number;\n}\n\nexport interface BrowserMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n headless: boolean;\n}\n\nexport interface SqlMiddlewareConfig {\n databaseKeys?: string[];\n}\n\nexport interface MetricsMiddlewareConfig {\n /** List of configured metrics server keys */\n serverKeys: string[];\n /** Optional descriptions for each server */\n serverDescriptions?: Record<string, string>;\n}\n\nexport interface SchedulerMiddlewareConfig {\n defaultMaxRetries?: number;\n}\n\nexport interface CollectionMiddlewareConfig {\n /** List of configured collection keys */\n collectionKeys: string[];\n /**\n * When true, all collections for the tenant are available.\n * When false or undefined, only collections in collectionKeys are used.\n */\n connectAll?: boolean;\n}\n\nexport type MiddlewareType = \"filesystem\" | \"code_eval\" | \"browser\" | \"sql\" | \"skill\" | \"http\" | \"custom\" | \"metrics\" | \"ask_user_to_clarify\" | \"widget\" | \"claw\" | \"date\" | \"scheduler\" | \"topology\" | \"task\" | \"collection\" | string;\n\nexport interface AgentMiddlewareConfig {\n id: string;\n type: MiddlewareType;\n name: string;\n description: string;\n enabled: boolean;\n /** 可选:限制该中间件暴露的工具列表。不配置则默认暴露所有工具 */\n allowedTools?: string[];\n config: SandboxMiddlewareConfig | CodeEvalMiddlewareConfig | BrowserMiddlewareConfig | SqlMiddlewareConfig | MetricsMiddlewareConfig | ClawMiddlewareConfig | CollectionMiddlewareConfig | SchedulerMiddlewareConfig | Record<string, any>;\n}\n\n/**\n * Bootstrap file configuration\n * Defines default content for project bootstrap files\n */\nexport interface BootstrapFilesConfig {\n /** Default content for AGENTS.md - operating instructions */\n agents?: string;\n /** Default content for SOUL.md - personality and tone */\n soul?: string;\n /** Default content for IDENTITY.md - agent identity */\n identity?: string;\n /** Default content for USER.md - user preferences */\n user?: string;\n /** Default content for TOOLS.md - tool documentation */\n tools?: string;\n /** Default content for BOOTSTRAP.md - first-run tasks */\n bootstrap?: string;\n}\n\n/**\n * Claw Middleware 配置\n * 用于配置 bootstrap 文件管理行为\n */\nexport interface ClawMiddlewareConfig {\n /** 是否启用 bootstrap 文件注入(默认:true) */\n injectBootstrapFiles?: boolean;\n /** 自定义 bootstrap 文件内容 */\n bootstrapFiles?: BootstrapFilesConfig;\n}\n\n\n/**\n * REACT agent configuration\n */\nexport interface ReactAgentConfig extends BaseAgentConfig {\n type: AgentType.REACT;\n tools?: string[]; // Tool list\n}\n\n/**\n * DEEP_AGENT configuration - only this type supports subAgents\n */\nexport interface DeepAgentConfig extends BaseAgentConfig {\n type: AgentType.DEEP_AGENT;\n tools?: string[]; // Tool list\n subAgents?: string[]; // Sub-agent list (unique to DEEP_AGENT)\n internalSubAgents?: AgentConfig[]; // Internal sub-agent list (unique to DEEP_AGENT)\n}\n\n/**\n * PROCESSING agent configuration — workflow orchestration with topology enforcement.\n * Replaces todoListMiddleware with topologyMiddleware.\n */\nexport interface ProcessingAgentConfig extends BaseAgentConfig {\n type: AgentType.PROCESSING;\n tools?: string[];\n subAgents?: string[];\n internalSubAgents?: AgentConfig[];\n}\n\n/**\n * Team teammate configuration -- describes an available teammate.\n */\nexport interface TeamTeammateConfig {\n /** Unique name for this teammate (used as agent ID) */\n name: string;\n /** Role category (e.g. \"research\", \"writing\", \"review\") */\n role: string;\n /** Human-readable description of what this teammate does */\n description: string;\n /** Tool keys this teammate has access to */\n tools?: string[];\n /** Custom system prompt for this teammate */\n prompt?: string;\n /** Model key override for this teammate */\n modelKey?: string;\n}\n\n/**\n * TEAM agent configuration -- a team lead that dynamically creates teammates.\n * Teammates are created on-the-fly from create_team tool input (name, role, description).\n */\nexport interface TeamAgentConfig extends BaseAgentConfig {\n type: AgentType.TEAM;\n /** Tool keys available to the team lead */\n tools?: string[];\n /** Maximum number of teammates running concurrently */\n maxConcurrency?: number;\n /**\n * Schedule lattice key for polling task list / mailbox.\n * When set, teammates use ScheduleLattice for periodic polling instead of event-driven wait.\n */\n scheduleLatticeKey?: string;\n /** Poll interval in ms when using schedule lattice (default: 5000) */\n pollIntervalMs?: number;\n}\n\n/**\n * Type guard to check if config is TeamAgentConfig\n */\nexport function isTeamAgentConfig(\n config: AgentConfig\n): config is TeamAgentConfig {\n return config.type === AgentType.TEAM;\n}\n\n// ─── A2A_REMOTE Agent ──────────────────────────────────────────────────────\n\n/**\n * A2A_REMOTE agent configuration — delegates to an external A2A server.\n *\n * This agent type wraps a remote A2A endpoint so orchestrators can treat\n * external agents the same as local LangGraph agents.\n */\nexport interface A2ARemoteAgentConfig extends BaseAgentConfig {\n type: AgentType.A2A_REMOTE;\n /**\n * URL of the remote agent's agent card (e.g. http://host:3000/.well-known/agent-card.json).\n * The builder fetches this card to discover the JSON-RPC endpoint.\n */\n agentCardUrl: string;\n /**\n * Optional API key sent as Bearer token or X-API-Key header.\n */\n apiKey?: string;\n /**\n * HTTP timeout in milliseconds (default: 300_000 = 5 min).\n */\n timeout?: number;\n /**\n * Optional tool keys (not used by the builder, but included for type compatibility).\n */\n tools?: string[];\n}\n\n/**\n * WORKFLOW agent configuration — compiled from YAML workflow DSL into a LangGraph StateGraph.\n *\n * The workflow field contains the full DSL definition (nodes, edges, state).\n * The WorkflowAgentGraphBuilder compiles this into a multi-node LangGraph\n * where each node invokes a registered sub-agent by ref.\n */\nexport interface WorkflowAgentConfig extends BaseAgentConfig {\n type: AgentType.WORKFLOW;\n /** The YAML workflow DSL definition string (needs+if format) */\n workflowYaml: string;\n /** Optional tool keys */\n tools?: string[];\n}\n\n/**\n * Type guard to check if config is A2ARemoteAgentConfig\n */\nexport function isA2ARemoteAgentConfig(\n config: AgentConfig\n): config is A2ARemoteAgentConfig {\n return config.type === AgentType.A2A_REMOTE;\n}\n\n/**\n * Type guard to check if config is WorkflowAgentConfig\n */\nexport function isWorkflowAgentConfig(\n config: AgentConfig\n): config is WorkflowAgentConfig {\n return config.type === AgentType.WORKFLOW;\n}\n\n/**\n * Agent configuration union type\n * Different agent types have different configuration options\n */\nexport type AgentConfig =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Agent configuration with tools property\n */\nexport type AgentConfigWithTools =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Type guard to check if config has tools property\n */\nexport function hasTools(config: AgentConfig): config is AgentConfigWithTools {\n return true;\n}\n\n/**\n * Type guard to check if config is DeepAgentConfig (has subAgents)\n */\nexport function isDeepAgentConfig(\n config: AgentConfig\n): config is DeepAgentConfig {\n return config.type === AgentType.DEEP_AGENT;\n}\n\n/**\n * Type guard to check if config is ProcessingAgentConfig (has subAgents + topology)\n */\nexport function isProcessingAgentConfig(\n config: AgentConfig\n): config is ProcessingAgentConfig {\n return config.type === AgentType.PROCESSING;\n}\n\n/**\n * Get tools from config safely\n */\nexport function getToolsFromConfig(config: AgentConfig): string[] {\n if (hasTools(config)) {\n return config.tools || [];\n }\n return [];\n}\n\n/**\n * Get subAgents from config safely (DeepAgentConfig and ProcessingAgentConfig have subAgents)\n */\nexport function getSubAgentsFromConfig(config: AgentConfig): string[] {\n if (isDeepAgentConfig(config) || isProcessingAgentConfig(config)) {\n return config.subAgents || [];\n }\n return [];\n}\n\n/**\n * 智能体客户端类型\n */\nexport type AgentClient = CompiledStateGraph<any, any, any, any, any>;\n\n/**\n * Graph构建选项\n */\nexport interface GraphBuildOptions {\n overrideTools?: string[];\n overrideModel?: string;\n metadata?: Record<string, any>;\n}\n\n/**\n * 智能体Lattice协议接口\n */\nexport interface AgentLatticeProtocol\n extends BaseLatticeProtocol<AgentConfig, AgentClient> {\n // 智能体执行函数\n invoke: (input: any, options?: any) => Promise<any>;\n\n // 构建智能体图\n buildGraph: (options?: GraphBuildOptions) => Promise<AgentClient>;\n}\n","/**\n * MemoryLatticeProtocol\n *\n * 记忆Lattice的协议,用于管理智能体的上下文和记忆\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 记忆类型枚举\n */\nexport enum MemoryType {\n SHORT_TERM = \"short_term\",\n LONG_TERM = \"long_term\",\n EPISODIC = \"episodic\",\n SEMANTIC = \"semantic\",\n WORKING = \"working\",\n}\n\n/**\n * 记忆配置接口\n */\nexport interface MemoryConfig {\n name: string; // 名称\n description: string; // 描述\n type: MemoryType; // 记忆类型\n ttl?: number; // 生存时间\n capacity?: number; // 容量限制\n}\n\n/**\n * 记忆客户端接口\n */\nexport interface MemoryClient {\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n\n/**\n * 记忆Lattice协议接口\n */\nexport interface MemoryLatticeProtocol\n extends BaseLatticeProtocol<MemoryConfig, MemoryClient> {\n // 记忆操作方法\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n","/**\n * UILatticeProtocol\n *\n * UI Lattice的协议,用于定义用户界面组件\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * UI组件类型枚举\n */\nexport enum UIComponentType {\n CONTAINER = \"container\",\n INPUT = \"input\",\n BUTTON = \"button\",\n LIST = \"list\",\n TABLE = \"table\",\n CHART = \"chart\",\n FORM = \"form\",\n CARD = \"card\",\n MODAL = \"modal\",\n CUSTOM = \"custom\",\n}\n\n/**\n * UI配置接口\n */\nexport interface UIConfig {\n name: string; // 组件名称\n description: string; // 组件描述\n type: UIComponentType; // 组件类型\n props?: Record<string, any>; // 组件属性\n children?: string[]; // 子组件列表\n}\n\n/**\n * UI组件接口\n * 使用泛型以适应不同的UI框架(React, Vue等)\n */\nexport interface UIComponent<T = any> {\n render: (props?: any) => T;\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n\n/**\n * UI Lattice协议接口\n */\nexport interface UILatticeProtocol<T = any>\n extends BaseLatticeProtocol<UIConfig, UIComponent<T>> {\n // UI渲染方法\n render: (props?: any) => T;\n\n // 事件处理\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n","/**\n * QueueLatticeProtocol\n *\n * Queue Lattice protocol for task queue management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Queue service type enumeration\n */\nexport enum QueueType {\n MEMORY = \"memory\",\n REDIS = \"redis\",\n}\n\n/**\n * Queue configuration interface\n */\nexport interface QueueConfig {\n name: string; // Queue name\n description: string; // Queue description\n type: QueueType; // Queue service type\n queueName?: string; // Specific queue name (e.g., \"tasks\")\n options?: Record<string, any>; // Additional options (e.g., Redis connection options)\n}\n\n/**\n * Queue operation result interface\n */\nexport interface QueueResult<T = any> {\n data: T | null;\n error: any | null;\n}\n\n/**\n * Queue client interface\n */\nexport interface QueueClient {\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n/**\n * Queue Lattice protocol interface\n */\nexport interface QueueLatticeProtocol\n extends BaseLatticeProtocol<QueueConfig, QueueClient> {\n // Queue operations\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n\n\n","/**\n * ScheduleLatticeProtocol\n *\n * Schedule Lattice protocol for delayed and recurring task execution management\n * Supports persistence and recovery after service restart\n * Supports both one-time delayed tasks and cron-style recurring tasks\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Schedule service type enumeration\n */\nexport enum ScheduleType {\n MEMORY = \"memory\",\n POSTGRES = \"postgres\",\n REDIS = \"redis\",\n}\n\n/**\n * Schedule execution type - one-time or recurring\n */\nexport enum ScheduleExecutionType {\n ONCE = \"once\", // Execute once at specified time\n CRON = \"cron\", // Recurring based on cron expression\n}\n\n/**\n * Task status enumeration\n */\nexport enum ScheduledTaskStatus {\n PENDING = \"pending\", // Waiting to be executed\n RUNNING = \"running\", // Currently executing\n COMPLETED = \"completed\", // Successfully completed (for ONCE type)\n FAILED = \"failed\", // Execution failed\n CANCELLED = \"cancelled\", // Manually cancelled\n PAUSED = \"paused\", // Paused (for CRON type)\n}\n\n/**\n * Schedule configuration interface\n */\nexport interface ScheduleConfig {\n name: string;\n description: string;\n type: ScheduleType;\n storage?: ScheduleStorage; // Optional storage for persistence\n options?: Record<string, any>;\n}\n\n/**\n * Scheduled task definition - fully serializable\n * Supports both one-time and cron-style recurring tasks\n */\nexport interface ScheduledTaskDefinition {\n taskId: string;\n taskType: string; // Maps to a registered handler\n payload: Record<string, any>; // JSON-serializable data passed to handler\n\n // Context fields for querying\n tenantId: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n\n // Execution configuration\n executionType: ScheduleExecutionType;\n\n // For ONCE type - execute at specific time or after delay\n executeAt?: number; // Timestamp when to execute\n delayMs?: number; // Original delay in milliseconds (for reference)\n\n // For CRON type - recurring schedule\n cronExpression?: string; // Cron format: \"0 9 * * *\" (min hour day month weekday)\n timezone?: string; // Timezone: \"Asia/Shanghai\", defaults to system timezone\n nextRunAt?: number; // Next calculated execution time\n lastRunAt?: number; // Last execution time\n\n // Execution tracking\n status: ScheduledTaskStatus;\n runCount: number; // How many times executed\n maxRuns?: number; // Max executions (null/undefined = infinite for cron, 1 for once)\n\n // Error handling\n retryCount: number; // Current retry count\n maxRetries: number; // Maximum retry attempts\n lastError?: string; // Last error message if failed\n\n // Timestamps\n createdAt: number;\n updatedAt: number;\n expiresAt?: number; // When to stop (for cron, optional)\n\n metadata?: Record<string, any>; // Additional metadata\n}\n\n/**\n * Task handler function type\n */\nexport type TaskHandler = (\n payload: Record<string, any>,\n taskInfo: ScheduledTaskDefinition\n) => void | Promise<void>;\n\n/**\n * Options for scheduling a one-time task\n */\nexport interface ScheduleOnceOptions {\n executeAt?: number; // Absolute timestamp to execute\n delayMs?: number; // OR relative delay from now\n maxRetries?: number; // Max retry attempts (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Options for scheduling a cron task\n */\nexport interface ScheduleCronOptions {\n cronExpression: string; // Cron expression: \"0 9 * * *\"\n timezone?: string; // Timezone: \"Asia/Shanghai\"\n maxRuns?: number; // Max executions (undefined = infinite)\n expiresAt?: number; // Stop after this timestamp\n maxRetries?: number; // Max retry attempts per run (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Schedule storage interface for persistence\n */\nexport interface ScheduleStorage {\n /**\n * Save a new task\n */\n save(task: ScheduledTaskDefinition): Promise<void>;\n\n /**\n * Get task by ID\n */\n get(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Update task\n */\n update(\n taskId: string,\n updates: Partial<ScheduledTaskDefinition>\n ): Promise<void>;\n\n /**\n * Delete task\n */\n delete(taskId: string): Promise<void>;\n\n /**\n * Get all pending/active tasks (for recovery)\n * Returns tasks with status: PENDING or PAUSED\n */\n getActiveTasks(): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by type\n */\n getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by status\n */\n getTasksByStatus(\n status: ScheduledTaskStatus\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by execution type\n */\n getTasksByExecutionType(\n executionType: ScheduleExecutionType\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by assistant ID\n */\n getTasksByAssistantId(\n assistantId: string\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by thread ID\n */\n getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get all tasks (with optional filters)\n */\n getAllTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n limit?: number;\n offset?: number;\n }): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Count tasks (with optional filters)\n */\n countTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n }): Promise<number>;\n\n /**\n * Delete completed/cancelled tasks older than specified time\n * Useful for cleanup\n */\n deleteOldTasks(olderThanMs: number): Promise<number>;\n}\n\n/**\n * Schedule client interface\n */\nexport interface ScheduleClient {\n // ===== Handler Registration =====\n\n /**\n * Register a handler for a task type\n * Must be called before scheduling tasks of this type\n */\n registerHandler(taskType: string, handler: TaskHandler): void;\n\n /**\n * Unregister a handler\n */\n unregisterHandler(taskType: string): boolean;\n\n /**\n * Check if a handler is registered\n */\n hasHandler(taskType: string): boolean;\n\n /**\n * Get all registered handler types\n */\n getHandlerTypes(): string[];\n\n // ===== One-time Task Scheduling =====\n\n /**\n * Schedule a one-time task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Execution options (executeAt or delayMs required)\n */\n scheduleOnce(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ): Promise<boolean>;\n\n // ===== Cron Task Scheduling =====\n\n /**\n * Schedule a recurring cron task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Cron options (cronExpression required)\n */\n scheduleCron(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ): Promise<boolean>;\n\n // ===== Task Management =====\n\n /**\n * Cancel a scheduled task\n */\n cancel(taskId: string): Promise<boolean>;\n\n /**\n * Pause a cron task (only for CRON type)\n */\n pause(taskId: string): Promise<boolean>;\n\n /**\n * Resume a paused cron task (only for CRON type)\n */\n resume(taskId: string): Promise<boolean>;\n\n /**\n * Check if a task exists\n */\n has(taskId: string): Promise<boolean>;\n\n /**\n * Get task information\n */\n getTask(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Get remaining time until next execution\n * Returns -1 if task not found or already executed\n */\n getRemainingTime(taskId: string): Promise<number>;\n\n /**\n * Get count of active tasks (pending + paused)\n */\n getActiveTaskCount(): Promise<number>;\n\n /**\n * Get all active task IDs\n */\n getActiveTaskIds(): Promise<string[]>;\n\n /**\n * Cancel all active tasks\n */\n cancelAll(): Promise<void>;\n\n // ===== Recovery =====\n\n /**\n * Restore active tasks from storage (call on service startup)\n * Re-schedules all pending tasks with their remaining time\n * Re-schedules all cron tasks for their next run\n * @returns Number of tasks restored\n */\n restore(): Promise<number>;\n\n // ===== Storage =====\n\n /**\n * Set the storage backend\n */\n setStorage(storage: ScheduleStorage): void;\n\n /**\n * Get current storage backend\n */\n getStorage(): ScheduleStorage | null;\n}\n\n/**\n * Schedule Lattice protocol interface\n */\nexport interface ScheduleLatticeProtocol\n extends BaseLatticeProtocol<ScheduleConfig, ScheduleClient> {\n // Handler registration\n registerHandler: (taskType: string, handler: TaskHandler) => void;\n unregisterHandler: (taskType: string) => boolean;\n hasHandler: (taskType: string) => boolean;\n getHandlerTypes: () => string[];\n\n // One-time task scheduling\n scheduleOnce: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ) => Promise<boolean>;\n\n // Cron task scheduling\n scheduleCron: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ) => Promise<boolean>;\n\n // Task management\n cancel: (taskId: string) => Promise<boolean>;\n pause: (taskId: string) => Promise<boolean>;\n resume: (taskId: string) => Promise<boolean>;\n has: (taskId: string) => Promise<boolean>;\n getTask: (taskId: string) => Promise<ScheduledTaskDefinition | null>;\n getRemainingTime: (taskId: string) => Promise<number>;\n getActiveTaskCount: () => Promise<number>;\n getActiveTaskIds: () => Promise<string[]>;\n cancelAll: () => Promise<void>;\n\n // Recovery\n restore: () => Promise<number>;\n}\n","/**\n * LoggerLatticeProtocol\n *\n * Logger Lattice protocol for logging management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Logger service type enumeration\n */\nexport enum LoggerType {\n PINO = \"pino\",\n CONSOLE = \"console\",\n CUSTOM = \"custom\",\n}\n\n/**\n * Logger context interface\n */\nexport interface LoggerContext {\n \"x-user-id\"?: string;\n \"x-tenant-id\"?: string;\n \"x-request-id\"?: string;\n \"x-task-id\"?: string;\n \"x-thread-id\"?: string;\n [key: string]: any;\n}\n\n/**\n * Pino logger file transport options\n */\nexport interface PinoFileOptions {\n file?: string; // Log file path (e.g., \"./logs/app.log\" or \"./logs/app\")\n frequency?: \"daily\" | \"hourly\" | \"minutely\" | string; // Log rotation frequency\n mkdir?: boolean; // Create directory if not exists\n size?: string; // Max file size (e.g., \"10M\", \"100K\")\n maxFiles?: number; // Maximum number of log files to keep\n}\n\n/**\n * Logger configuration interface\n */\nexport interface LoggerConfig {\n name: string; // Logger name\n description?: string; // Logger description\n type: LoggerType; // Logger service type\n serviceName?: string; // Service name (e.g., \"lattice-gateway\")\n loggerName?: string; // Logger instance name (e.g., \"fastify-server\")\n context?: LoggerContext; // Initial context\n // File logging options (for PINO type)\n file?: string | PinoFileOptions; // Log file path or detailed file options\n // Additional options (e.g., pino config, custom logger settings)\n options?: Record<string, any>;\n}\n\n/**\n * Logger client interface\n */\nexport interface LoggerClient {\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n\n/**\n * Logger Lattice protocol interface\n */\nexport interface LoggerLatticeProtocol\n extends BaseLatticeProtocol<LoggerConfig, LoggerClient> {\n // Logger operations\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n","/**\n * MessageProtocol\n *\n */\n\n\n\n/**\n * Base message interface\n */\nexport interface BaseMessage {\n id: string; // Unique identifier for the message\n role: string; // Role of the sender (user, assistant, system, tool, developer)\n content?: string; // Optional text content of the message\n name?: string; // Optional name of the sender\n}\n\n/**\n * User message interface\n */\nexport interface UserMessage extends BaseMessage {\n role: \"human\";\n content: string; // Text input from the user\n files?: Array<{ name: string; id: string }>; // Optional files attached to the message\n}\n\n/**\n * Tool call interface\n */\nexport interface ToolCall {\n id: string; // Unique identifier for this tool call\n name: string; // Name of the tool/function to call\n args: Record<string, any>; // Arguments as an object\n type: \"tool_call\"; // Type of tool call\n response?: string; // Optional response from the tool execution\n}\n\n/**\n * Assistant message interface\n */\nexport interface AssistantMessage extends BaseMessage {\n role: \"ai\";\n content?: string; // Text response from the assistant (optional if using tool calls)\n tool_calls?: ToolCall[]; // Optional tool calls made by the assistant\n}\n\nexport interface InterruptMessage extends BaseMessage {\n type: \"interrupt\";\n value: any;\n}\n\n/**\n * System message interface\n */\nexport interface SystemMessage extends BaseMessage {\n role: \"system\";\n content: string; // Instructions or context for the assistant\n}\n\n/**\n * Tool message interface\n */\nexport interface ToolMessage extends BaseMessage {\n role: \"tool\";\n content: string; // Result from the tool execution\n tool_call_id: string; // ID of the tool call this message responds to\n}\n\n/**\n * Developer message interface\n */\nexport interface DeveloperMessage extends BaseMessage {\n role: \"developer\";\n content: string; // Content for development or debugging\n}\n\n/**\n * Message chunk type constants\n */\nexport const MessageChunkTypes = {\n HUMAN: 'human',\n AI: 'ai',\n TOOL: 'tool',\n INTERRUPT: 'interrupt',\n MESSAGE_COMPLETED: 'message_completed',\n MESSAGE_FAILED: 'message_failed',\n THREAD_IDLE: 'thread_idle',\n} as const;\n\nexport type MessageChunkType = typeof MessageChunkTypes[keyof typeof MessageChunkTypes];\n\nexport interface MessageChunk {\n type: MessageChunkType;\n data: {\n id: string;\n content?: string;\n tool_call_chunks?: Array<{\n name?: string;\n args?: string;\n id?: string;\n index: number;\n }>;\n tool_calls?: Array<{\n name: string;\n args: Record<string, any>;\n id: string;\n type: string;\n response?: string;\n }>;\n additional_kwargs?: {\n tool_calls?: Array<{\n function?: { name?: string; arguments?: any };\n id?: string;\n }>;\n };\n tool_call_id?: string;\n };\n}\n\n/**\n * Message type union\n */\nexport type Message =\n | UserMessage\n | AssistantMessage\n | SystemMessage\n | ToolMessage\n | DeveloperMessage;\n","/**\n * McpLatticeProtocol\n *\n * Model Context Protocol (MCP) lattice protocol for integrating MCP servers\n * with the Lattice framework. Provides standardized interfaces for MCP\n * client connections, tool discovery, and remote execution.\n */\n\nimport { BaseLatticeProtocol, LatticeMessage } from \"./BaseLatticeProtocol\";\n\n/**\n * MCP transport type\n */\nexport type McpTransportType = \"stdio\" | \"streamable_http\" | \"sse\";\n\n/**\n * MCP server configuration\n */\nexport interface McpServerConfig {\n /** Server name */\n name: string;\n /** Server version */\n version: string;\n /** Transport type */\n transport: McpTransportType;\n /** Command for stdio transport (e.g., \"npx\", \"python\") */\n command?: string;\n /** Arguments for stdio transport */\n args?: string[];\n /** URL for HTTP/SSE transport */\n url?: string;\n /** Environment variables */\n env?: Record<string, string>;\n /** Connection timeout in milliseconds */\n timeout?: number;\n /** Retry attempts on connection failure */\n retryAttempts?: number;\n}\n\n/**\n * MCP tool definition\n */\nexport interface McpTool {\n /** Tool name */\n name: string;\n /** Tool description */\n description: string;\n /** Input schema */\n inputSchema: {\n type: \"object\";\n properties: Record<string, any>;\n required?: string[];\n };\n /** Tool metadata */\n metadata?: Record<string, any>;\n}\n\n/**\n * MCP tool call result\n */\nexport interface McpToolResult {\n /** Whether the call was successful */\n success: boolean;\n /** Result content */\n content: Array<{\n type: \"text\" | \"image\" | \"audio\" | \"resource\";\n data: any;\n mimeType?: string;\n }>;\n /** Error message if failed */\n error?: string;\n /** Execution metadata */\n metadata?: {\n duration: number;\n tokens?: number;\n model?: string;\n };\n}\n\n/**\n * MCP client interface\n */\nexport interface McpClient {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Check if connected\n */\n isConnected(): boolean;\n \n /**\n * List available tools\n */\n listTools(): Promise<McpTool[]>;\n \n /**\n * Call a tool\n */\n callTool(name: string, arguments_: Record<string, any>): Promise<McpToolResult>;\n \n /**\n * Subscribe to server notifications\n */\n subscribe(topic: string, handler: (data: any) => void): void;\n \n /**\n * Unsubscribe from server notifications\n */\n unsubscribe(topic: string): void;\n \n /**\n * Get client statistics\n */\n getStats(): McpStats;\n \n /**\n * Get connection status\n */\n getStatus(): McpConnectionStatus;\n}\n\n/**\n * MCP client options\n */\nexport interface McpClientOptions {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n /** Auto-connect on initialization */\n autoConnect?: boolean;\n /** Error handler */\n onError?: (error: Error) => void;\n /** Connection status handler */\n onStatusChange?: (status: McpConnectionStatus) => void;\n}\n\n/**\n * MCP Lattice protocol interface\n */\nexport interface McpLatticeProtocol\n extends BaseLatticeProtocol<McpServerConfig, McpClient> {\n /**\n * Server configuration\n */\n config: McpServerConfig;\n \n /**\n * MCP client instance\n */\n client: McpClient;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Get available tools\n */\n getTools(): Promise<McpTool[]>;\n \n /**\n * Execute a tool\n */\n executeTool(\n name: string,\n arguments_: Record<string, any>\n ): Promise<McpToolResult>;\n \n /**\n * Execute with automatic retries\n */\n executeToolWithRetry(\n name: string,\n arguments_: Record<string, any>,\n maxRetries?: number\n ): Promise<McpToolResult>;\n \n /**\n * Get protocol version\n */\n getProtocolVersion(): string;\n \n /**\n * Health check\n */\n healthCheck(): Promise<boolean>;\n}\n\n/**\n * MCP message types\n */\nexport enum McpMessageType {\n CONNECT = \"mcp:connect\",\n DISCONNECT = \"mcp:disconnect\",\n LIST_TOOLS = \"mcp:list_tools\",\n CALL_TOOL = \"mcp:call_tool\",\n TOOL_RESULT = \"mcp:tool_result\",\n NOTIFICATION = \"mcp:notification\",\n ERROR = \"mcp:error\",\n HEALTH_CHECK = \"mcp:health_check\",\n}\n\n/**\n * MCP Lattice message\n */\nexport interface McpLatticeMessage extends LatticeMessage {\n type: McpMessageType;\n payload: {\n toolName?: string;\n arguments?: Record<string, any>;\n result?: McpToolResult;\n tools?: McpTool[];\n error?: string;\n };\n}\n\n/**\n * MCP connection status\n */\nexport type McpConnectionStatus =\n | \"disconnected\"\n | \"connecting\"\n | \"connected\"\n | \"reconnecting\"\n | \"error\";\n\n/**\n * MCP statistics\n */\nexport interface McpStats {\n totalCalls: number;\n successfulCalls: number;\n failedCalls: number;\n averageLatency: number;\n lastCallTimestamp: number;\n}\n","/**\n * A2AProtocol - Google Agent-to-Agent Protocol type definitions\n *\n * Based on the A2A open protocol spec for AI agent interoperability.\n * @see https://github.com/google/A2A\n */\n\n// ─── Agent Card ───────────────────────────────────────────────────────────\n\nexport interface A2ASkill {\n id: string;\n name: string;\n description: string;\n tags: string[];\n examples: string[];\n}\n\nexport interface A2ACapabilities {\n streaming: boolean;\n pushNotifications: boolean;\n stateTransitionHistory: boolean;\n}\n\nexport interface A2AProvider {\n organization: string;\n url?: string;\n}\n\nexport interface AgentCard {\n name: string;\n description: string;\n url: string;\n provider: A2AProvider;\n version: string;\n documentationUrl?: string;\n capabilities: A2ACapabilities;\n defaultInputModes: string[];\n defaultOutputModes: string[];\n skills: A2ASkill[];\n}\n\n// ─── Artifact / Part ──────────────────────────────────────────────────────\n\nexport interface A2ATextPart {\n type: \"text\";\n text: string;\n}\n\nexport interface A2AFilePart {\n type: \"file\";\n file: {\n name: string;\n mimeType: string;\n bytes?: string;\n uri?: string;\n };\n}\n\nexport interface A2ADataPart {\n type: \"data\";\n data: Record<string, unknown>;\n}\n\nexport type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;\n\n// ─── Message ──────────────────────────────────────────────────────────────\n\nexport interface A2AMessage {\n role: \"user\" | \"agent\";\n parts: A2APart[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Task ─────────────────────────────────────────────────────────────────\n\nexport type A2ATaskState =\n | \"working\"\n | \"input-required\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"rejected\";\n\nexport interface A2ATaskStatus {\n state: A2ATaskState;\n message?: A2AMessage;\n timestamp: string;\n}\n\nexport interface A2AArtifact {\n name?: string;\n description?: string;\n parts: A2APart[];\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATask {\n id: string;\n sessionId?: string;\n status: A2ATaskStatus;\n artifacts: A2AArtifact[];\n history?: A2AMessage[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Request / Response ───────────────────────────────────────────────────\n\nexport interface A2ATaskSendRequest {\n id?: string;\n sessionId?: string;\n message: A2AMessage;\n pushNotification?: A2APushNotification;\n historyLength?: number;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2APushNotification {\n url: string;\n token?: string;\n}\n\nexport interface A2ATaskUpdatePayload {\n id: string;\n sessionId?: string;\n status: A2ATaskStatus;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATaskArtifactUpdatePayload {\n id: string;\n sessionId?: string;\n artifact: A2AArtifact;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\n// ─── SSE Events ───────────────────────────────────────────────────────────\n\nexport type A2ASSEEvent =\n | { event: \"task\"; data: A2ATaskUpdatePayload }\n | { event: \"status-update\"; data: A2ATaskUpdatePayload }\n | { event: \"artifact-update\"; data: A2ATaskArtifactUpdatePayload }\n | { event: \"error\"; data: { code: string; message: string } };\n\n// ─── Config ───────────────────────────────────────────────────────────────\n\nexport interface A2AConfig {\n agentName: string;\n agentDescription: string;\n agentUrl: string;\n organization: string;\n version?: string;\n capabilities?: Partial<A2ACapabilities>;\n defaultInputModes?: string[];\n defaultOutputModes?: string[];\n skills?: A2ASkill[];\n apiKeyMap: Map<string, A2AApiKeyEntry>;\n}\n\nexport interface A2AApiKeyEntry {\n key: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n}\n\nexport const A2A_DEFAULT_CAPABILITIES: A2ACapabilities = {\n streaming: true,\n pushNotifications: false,\n stateTransitionHistory: false,\n};\n\nexport const A2A_DEFAULT_INPUT_MODES = [\"text\", \"text/plain\"];\nexport const A2A_DEFAULT_OUTPUT_MODES = [\"text\", \"text/plain\", \"text/markdown\"];\n\nexport interface A2AAuthContext {\n authenticated: boolean;\n apiKey?: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n source?: \"bearer\" | \"x-api-key\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,cAAW;AARD,SAAAA;AAAA,GAAA;AA0NL,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AAiDO,SAAS,uBACd,QACgC;AAChC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,sBACd,QAC+B;AAC/B,SAAO,OAAO,SAAS;AACzB;AA4BO,SAAS,SAAS,QAAqD;AAC5E,SAAO;AACT;AAKO,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,wBACd,QACiC;AACjC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,mBAAmB,QAA+B;AAChE,MAAI,SAAS,MAAM,GAAG;AACpB,WAAO,OAAO,SAAS,CAAC;AAAA,EAC1B;AACA,SAAO,CAAC;AACV;AAKO,SAAS,uBAAuB,QAA+B;AACpE,MAAI,kBAAkB,MAAM,KAAK,wBAAwB,MAAM,GAAG;AAChE,WAAO,OAAO,aAAa,CAAC;AAAA,EAC9B;AACA,SAAO,CAAC;AACV;;;AClWO,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,eAAY;AACZ,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;;;ACAL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,eAAY;AACZ,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AAVC,SAAAA;AAAA,GAAA;;;ACAL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,WAAQ;AAFE,SAAAA;AAAA,GAAA;;;ACEL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,WAAQ;AAHE,SAAAA;AAAA,GAAA;AASL,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAQL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AANC,SAAAA;AAAA,GAAA;;;ACnBL,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACoEL,IAAM,oBAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,aAAa;AACf;;;ACgIO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,iBAAc;AACd,EAAAA,gBAAA,kBAAe;AACf,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,kBAAe;AARL,SAAAA;AAAA,GAAA;;;AChDL,IAAM,2BAA4C;AAAA,EACvD,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,wBAAwB;AAC1B;AAEO,IAAM,0BAA0B,CAAC,QAAQ,YAAY;AACrD,IAAM,2BAA2B,CAAC,QAAQ,cAAc,eAAe;","names":["AgentType","MemoryType","UIComponentType","QueueType","ScheduleType","ScheduleExecutionType","ScheduledTaskStatus","LoggerType","McpMessageType"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/AgentLatticeProtocol.ts","../src/MemoryLatticeProtocol.ts","../src/UILatticeProtocol.ts","../src/QueueLatticeProtocol.ts","../src/ScheduleLatticeProtocol.ts","../src/LoggerLatticeProtocol.ts","../src/MessageProtocol.ts","../src/McpLatticeProtocol.ts","../src/A2AProtocol.ts"],"sourcesContent":["/**\n * Protocols\n *\n * 导出所有Lattice协议接口,为整个系统提供统一的接口规范\n */\n\nexport * from \"./BaseLatticeProtocol\";\nexport * from \"./ToolLatticeProtocol\";\nexport * from \"./ModelLatticeProtocol\";\nexport * from \"./AgentLatticeProtocol\";\nexport * from \"./MemoryLatticeProtocol\";\nexport * from \"./UILatticeProtocol\";\nexport * from \"./QueueLatticeProtocol\";\nexport * from \"./ScheduleLatticeProtocol\";\nexport * from \"./EmbeddingsLatticeProtocol\";\nexport * from \"./STTModelLatticeProtocol\";\nexport * from \"./VectorStoreLatticeProtocol\";\nexport * from \"./LoggerLatticeProtocol\";\nexport * from \"./MessageProtocol\";\nexport * from \"./ThreadStoreProtocol\";\nexport * from \"./AssistantStoreProtocol\";\nexport * from \"./SkillLatticeProtocol\";\nexport * from \"./SkillStoreProtocol\";\nexport * from \"./McpLatticeProtocol\";\nexport * from \"./WorkspaceStoreProtocol\";\nexport * from \"./TenantStoreProtocol\";\nexport * from \"./DatabaseConfigStoreProtocol\";\nexport * from \"./ConnectionStoreProtocol\";\nexport * from \"./ChannelInstallationStoreProtocol\";\nexport * from \"./MetricsServerConfigStoreProtocol\";\nexport * from \"./McpServerConfigStoreProtocol\";\nexport * from \"./UserStoreProtocol\";\nexport * from \"./UserTenantLinkProtocol\";\nexport * from \"./WorkflowTrackingStoreProtocol\";\nexport * from \"./BindingProtocol\";\nexport * from \"./CollectionStoreProtocol\";\nexport * from \"./VectorStoreProviderProtocol\";\nexport * from \"./MenuProtocol\";\nexport * from \"./EvalStoreProtocol\";\nexport * from \"./TaskStoreProtocol\";\nexport * from \"./TaskWorkItemProtocol\";\n\nexport * from \"./LocalA2ATemplateConfig\";\nexport * from \"./ChannelAdapterProtocol\";\nexport * from \"./A2AProtocol\";\nexport * from \"./A2AApiKeyStoreProtocol\";\nexport * from \"./ConversationStoreProtocol\";\n\n// Workflow DSL (concise, public API)\nexport * from \"./WorkflowDSL\";\n\n// Internal DSL (expanded IR, internal use)\nexport * from \"./InternalDSL\";\n\nexport * from \"./SandboxResourceProtocol\";\n\n// Plugin system\nexport type {\n Plugin,\n PluginMeta,\n PluginMetaOutput,\n PluginConnection,\n PluginConnectionFieldSchema,\n PluginConnectionTestResult,\n PluginDiscoveredResource,\n PluginContext,\n PluginToolMeta,\n PluginMiddlewareFactory,\n} from \"./PluginProtocol\";\n\n// 导出通用类型\nexport * from \"./types\";\n","/**\n * AgentLatticeProtocol\n *\n * 智能体Lattice的协议,定义了智能体的行为和组合方式\n */\n\nimport { CompiledStateGraph } from \"@langchain/langgraph\";\nimport { ZodObject } from \"zod\";\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 智能体类型枚举\n */\nexport enum AgentType {\n REACT = \"react\",\n DEEP_AGENT = \"deep_agent\",\n TEAM = \"team\",\n PROCESSING = \"processing\",\n /** Remote A2A agent — delegates to an external A2A-compatible server */\n A2A_REMOTE = \"a2a_remote\",\n /** Workflow agent — compiled from YAML DSL into a LangGraph StateGraph */\n WORKFLOW = \"workflow\",\n}\n\n/**\n * Runtime configuration that will be injected into LangGraphRunnableConfig.configurable\n * Tools can access these values via config.configurable.runConfig\n */\nexport interface AgentRunConfig {\n /** Database key for SQL tools (registered via sqlDatabaseManager) */\n databaseKey?: string;\n /** Any additional runtime configuration */\n [key: string]: any;\n}\n\n/**\n * Base agent configuration shared by all agent types\n */\ninterface BaseAgentConfig {\n key: string; // Unique key\n name: string; // Name\n description: string; // Description\n prompt: string; // Prompt\n /**\n * Key of the parent agent to inherit configuration from.\n * When set, unspecified fields are inherited from the parent agent's config.\n * Child's explicitly set fields override the parent's.\n */\n extendsAgent?: string;\n schema?: ZodObject<any, any, any, any, any>; // Input validation schema\n modelKey?: string; // Model key to use\n /**\n * Runtime configuration to inject into tool execution context\n * Will be available in tools via config.configurable.runConfig\n */\n runConfig?: AgentRunConfig;\n skillCategories?: string[];\n middleware?: AgentMiddlewareConfig[];\n /**\n * Structured output response format for the agent.\n * Supports Zod schema (z.object({...})), JSON Schema object ({ type: \"object\", properties: {...} }),\n * providerStrategy(), toolStrategy(), and other formats accepted by the underlying model.\n *\n * @example\n * ```ts\n * // Zod schema\n * responseFormat: z.object({ name: z.string(), age: z.number() })\n *\n * // JSON Schema\n * responseFormat: { type: \"object\", properties: { name: { type: \"string\" } }, required: [\"name\"] }\n * ```\n */\n responseFormat?: any;\n}\n\nexport type AvailableModule = \"filesystem\" | \"code_eval\" | \"browser\";\n\nexport interface SandboxMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n modules: AvailableModule[];\n}\n\nexport interface CodeEvalMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n timeout: number;\n memoryLimit: number;\n}\n\nexport interface BrowserMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n headless: boolean;\n}\n\nexport interface SqlMiddlewareConfig {\n databaseKeys?: string[];\n}\n\nexport interface MetricsMiddlewareConfig {\n /** List of configured metrics server keys */\n serverKeys: string[];\n /** Optional descriptions for each server */\n serverDescriptions?: Record<string, string>;\n}\n\nexport interface SchedulerMiddlewareConfig {\n defaultMaxRetries?: number;\n}\n\nexport interface CollectionMiddlewareConfig {\n /** List of configured collection keys */\n collectionKeys: string[];\n /**\n * When true, all collections for the tenant are available.\n * When false or undefined, only collections in collectionKeys are used.\n */\n connectAll?: boolean;\n}\n\nexport type MiddlewareType = \"filesystem\" | \"code_eval\" | \"browser\" | \"sql\" | \"skill\" | \"http\" | \"custom\" | \"metrics\" | \"ask_user_to_clarify\" | \"widget\" | \"claw\" | \"date\" | \"scheduler\" | \"topology\" | \"task\" | \"collection\" | string;\n\nexport interface AgentMiddlewareConfig {\n id: string;\n type: MiddlewareType;\n name: string;\n description: string;\n enabled: boolean;\n /** 可选:限制该中间件暴露的工具列表。不配置则默认暴露所有工具 */\n allowedTools?: string[];\n config: SandboxMiddlewareConfig | CodeEvalMiddlewareConfig | BrowserMiddlewareConfig | SqlMiddlewareConfig | MetricsMiddlewareConfig | ClawMiddlewareConfig | CollectionMiddlewareConfig | SchedulerMiddlewareConfig | Record<string, any>;\n}\n\n/**\n * Bootstrap file configuration\n * Defines default content for project bootstrap files\n */\nexport interface BootstrapFilesConfig {\n /** Default content for AGENTS.md - operating instructions */\n agents?: string;\n /** Default content for SOUL.md - personality and tone */\n soul?: string;\n /** Default content for IDENTITY.md - agent identity */\n identity?: string;\n /** Default content for USER.md - user preferences */\n user?: string;\n /** Default content for TOOLS.md - tool documentation */\n tools?: string;\n /** Default content for BOOTSTRAP.md - first-run tasks */\n bootstrap?: string;\n}\n\n/**\n * Claw Middleware 配置\n * 用于配置 bootstrap 文件管理行为\n */\nexport interface ClawMiddlewareConfig {\n /** 是否启用 bootstrap 文件注入(默认:true) */\n injectBootstrapFiles?: boolean;\n /** 自定义 bootstrap 文件内容 */\n bootstrapFiles?: BootstrapFilesConfig;\n}\n\n\n/**\n * REACT agent configuration\n */\nexport interface ReactAgentConfig extends BaseAgentConfig {\n type: AgentType.REACT;\n tools?: string[]; // Tool list\n}\n\n/**\n * DEEP_AGENT configuration - only this type supports subAgents\n */\nexport interface DeepAgentConfig extends BaseAgentConfig {\n type: AgentType.DEEP_AGENT;\n tools?: string[]; // Tool list\n subAgents?: string[]; // Sub-agent list (unique to DEEP_AGENT)\n internalSubAgents?: AgentConfig[]; // Internal sub-agent list (unique to DEEP_AGENT)\n}\n\n/**\n * PROCESSING agent configuration — workflow orchestration with topology enforcement.\n * Replaces todoListMiddleware with topologyMiddleware.\n */\nexport interface ProcessingAgentConfig extends BaseAgentConfig {\n type: AgentType.PROCESSING;\n tools?: string[];\n subAgents?: string[];\n internalSubAgents?: AgentConfig[];\n}\n\n/**\n * Team teammate configuration -- describes an available teammate.\n */\nexport interface TeamTeammateConfig {\n /** Unique name for this teammate (used as agent ID) */\n name: string;\n /** Role category (e.g. \"research\", \"writing\", \"review\") */\n role: string;\n /** Human-readable description of what this teammate does */\n description: string;\n /** Tool keys this teammate has access to */\n tools?: string[];\n /** Custom system prompt for this teammate */\n prompt?: string;\n /** Model key override for this teammate */\n modelKey?: string;\n}\n\n/**\n * TEAM agent configuration -- a team lead that dynamically creates teammates.\n * Teammates are created on-the-fly from create_team tool input (name, role, description).\n */\nexport interface TeamAgentConfig extends BaseAgentConfig {\n type: AgentType.TEAM;\n /** Tool keys available to the team lead */\n tools?: string[];\n /** Maximum number of teammates running concurrently */\n maxConcurrency?: number;\n /**\n * Schedule lattice key for polling task list / mailbox.\n * When set, teammates use ScheduleLattice for periodic polling instead of event-driven wait.\n */\n scheduleLatticeKey?: string;\n /** Poll interval in ms when using schedule lattice (default: 5000) */\n pollIntervalMs?: number;\n}\n\n/**\n * Type guard to check if config is TeamAgentConfig\n */\nexport function isTeamAgentConfig(\n config: AgentConfig\n): config is TeamAgentConfig {\n return config.type === AgentType.TEAM;\n}\n\n// ─── A2A_REMOTE Agent ──────────────────────────────────────────────────────\n\nexport interface LocalRuntimeConfig {\n label?: string;\n agentCardUrl: string;\n healthUrl?: string;\n command: {\n executable: string;\n args: string[];\n cwd?: string;\n env?: Record<string, string>;\n };\n}\n\n/**\n * A2A_REMOTE agent configuration — wraps a remote A2A-compatible agent endpoint.\n *\n * This agent type wraps a remote A2A endpoint so orchestrators can treat\n * external agents the same as local LangGraph agents.\n */\nexport interface A2ARemoteAgentConfig extends BaseAgentConfig {\n type: AgentType.A2A_REMOTE;\n /**\n * URL of the remote agent's agent card (e.g. http://host:3000/.well-known/agent-card.json).\n * The builder fetches this card to discover the JSON-RPC endpoint.\n */\n agentCardUrl: string;\n /**\n * Optional API key sent as a Bearer token.\n */\n apiKey?: string;\n /**\n * HTTP timeout in milliseconds (default: 300_000 = 5 min).\n */\n timeout?: number;\n projectId?: string;\n /**\n * Optional tool keys (not used by the builder, but included for type compatibility).\n */\n tools?: string[];\n /**\n * Optional local runtime snapshot for Local Managed A2A assistants.\n * When present, the gateway manages a local process for this assistant.\n * Copied from a template or custom form at creation time.\n */\n localRuntime?: LocalRuntimeConfig;\n}\n\nexport type LocalA2AProviderId = string;\n\nexport type LocalA2AProviderStatus =\n | \"missing\"\n | \"disabled\"\n | \"starting\"\n | \"running\"\n | \"stopped\"\n | \"failed\";\n\nexport interface LocalA2AProviderState {\n runtimeId: string;\n label: string;\n status: LocalA2AProviderStatus;\n enabled: boolean;\n assistantId?: string;\n agentCardUrl?: string;\n healthUrl?: string;\n pid?: number;\n message?: string;\n lastStartedAt?: string;\n lastStoppedAt?: string;\n}\n\n/**\n * WORKFLOW agent configuration — compiled from YAML workflow DSL into a LangGraph StateGraph.\n *\n * The workflow field contains the full DSL definition (nodes, edges, state).\n * The WorkflowAgentGraphBuilder compiles this into a multi-node LangGraph\n * where each node invokes a registered sub-agent by ref.\n */\nexport interface WorkflowAgentConfig extends BaseAgentConfig {\n type: AgentType.WORKFLOW;\n /** The YAML workflow DSL definition string (needs+if format) */\n workflowYaml: string;\n /** Optional tool keys */\n tools?: string[];\n}\n\n/**\n * Type guard to check if config is A2ARemoteAgentConfig\n */\nexport function isA2ARemoteAgentConfig(\n config: AgentConfig\n): config is A2ARemoteAgentConfig {\n return config.type === AgentType.A2A_REMOTE;\n}\n\n/**\n * Type guard to check if config is WorkflowAgentConfig\n */\nexport function isWorkflowAgentConfig(\n config: AgentConfig\n): config is WorkflowAgentConfig {\n return config.type === AgentType.WORKFLOW;\n}\n\n/**\n * Agent configuration union type\n * Different agent types have different configuration options\n */\nexport type AgentConfig =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Agent configuration with tools property\n */\nexport type AgentConfigWithTools =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Type guard to check if config has tools property\n */\nexport function hasTools(config: AgentConfig): config is AgentConfigWithTools {\n return true;\n}\n\n/**\n * Type guard to check if config is DeepAgentConfig (has subAgents)\n */\nexport function isDeepAgentConfig(\n config: AgentConfig\n): config is DeepAgentConfig {\n return config.type === AgentType.DEEP_AGENT;\n}\n\n/**\n * Type guard to check if config is ProcessingAgentConfig (has subAgents + topology)\n */\nexport function isProcessingAgentConfig(\n config: AgentConfig\n): config is ProcessingAgentConfig {\n return config.type === AgentType.PROCESSING;\n}\n\n/**\n * Get tools from config safely\n */\nexport function getToolsFromConfig(config: AgentConfig): string[] {\n if (hasTools(config)) {\n return config.tools || [];\n }\n return [];\n}\n\n/**\n * Get subAgents from config safely (DeepAgentConfig and ProcessingAgentConfig have subAgents)\n */\nexport function getSubAgentsFromConfig(config: AgentConfig): string[] {\n if (isDeepAgentConfig(config) || isProcessingAgentConfig(config)) {\n return config.subAgents || [];\n }\n return [];\n}\n\n/**\n * 智能体客户端类型\n */\nexport type AgentClient = CompiledStateGraph<any, any, any, any, any>;\n\n/**\n * Graph构建选项\n */\nexport interface GraphBuildOptions {\n overrideTools?: string[];\n overrideModel?: string;\n metadata?: Record<string, any>;\n}\n\n/**\n * 智能体Lattice协议接口\n */\nexport interface AgentLatticeProtocol\n extends BaseLatticeProtocol<AgentConfig, AgentClient> {\n // 智能体执行函数\n invoke: (input: any, options?: any) => Promise<any>;\n\n // 构建智能体图\n buildGraph: (options?: GraphBuildOptions) => Promise<AgentClient>;\n}\n","/**\n * MemoryLatticeProtocol\n *\n * 记忆Lattice的协议,用于管理智能体的上下文和记忆\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 记忆类型枚举\n */\nexport enum MemoryType {\n SHORT_TERM = \"short_term\",\n LONG_TERM = \"long_term\",\n EPISODIC = \"episodic\",\n SEMANTIC = \"semantic\",\n WORKING = \"working\",\n}\n\n/**\n * 记忆配置接口\n */\nexport interface MemoryConfig {\n name: string; // 名称\n description: string; // 描述\n type: MemoryType; // 记忆类型\n ttl?: number; // 生存时间\n capacity?: number; // 容量限制\n}\n\n/**\n * 记忆客户端接口\n */\nexport interface MemoryClient {\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n\n/**\n * 记忆Lattice协议接口\n */\nexport interface MemoryLatticeProtocol\n extends BaseLatticeProtocol<MemoryConfig, MemoryClient> {\n // 记忆操作方法\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n","/**\n * UILatticeProtocol\n *\n * UI Lattice的协议,用于定义用户界面组件\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * UI组件类型枚举\n */\nexport enum UIComponentType {\n CONTAINER = \"container\",\n INPUT = \"input\",\n BUTTON = \"button\",\n LIST = \"list\",\n TABLE = \"table\",\n CHART = \"chart\",\n FORM = \"form\",\n CARD = \"card\",\n MODAL = \"modal\",\n CUSTOM = \"custom\",\n}\n\n/**\n * UI配置接口\n */\nexport interface UIConfig {\n name: string; // 组件名称\n description: string; // 组件描述\n type: UIComponentType; // 组件类型\n props?: Record<string, any>; // 组件属性\n children?: string[]; // 子组件列表\n}\n\n/**\n * UI组件接口\n * 使用泛型以适应不同的UI框架(React, Vue等)\n */\nexport interface UIComponent<T = any> {\n render: (props?: any) => T;\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n\n/**\n * UI Lattice协议接口\n */\nexport interface UILatticeProtocol<T = any>\n extends BaseLatticeProtocol<UIConfig, UIComponent<T>> {\n // UI渲染方法\n render: (props?: any) => T;\n\n // 事件处理\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n","/**\n * QueueLatticeProtocol\n *\n * Queue Lattice protocol for task queue management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Queue service type enumeration\n */\nexport enum QueueType {\n MEMORY = \"memory\",\n REDIS = \"redis\",\n}\n\n/**\n * Queue configuration interface\n */\nexport interface QueueConfig {\n name: string; // Queue name\n description: string; // Queue description\n type: QueueType; // Queue service type\n queueName?: string; // Specific queue name (e.g., \"tasks\")\n options?: Record<string, any>; // Additional options (e.g., Redis connection options)\n}\n\n/**\n * Queue operation result interface\n */\nexport interface QueueResult<T = any> {\n data: T | null;\n error: any | null;\n}\n\n/**\n * Queue client interface\n */\nexport interface QueueClient {\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n/**\n * Queue Lattice protocol interface\n */\nexport interface QueueLatticeProtocol\n extends BaseLatticeProtocol<QueueConfig, QueueClient> {\n // Queue operations\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n\n\n","/**\n * ScheduleLatticeProtocol\n *\n * Schedule Lattice protocol for delayed and recurring task execution management\n * Supports persistence and recovery after service restart\n * Supports both one-time delayed tasks and cron-style recurring tasks\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Schedule service type enumeration\n */\nexport enum ScheduleType {\n MEMORY = \"memory\",\n POSTGRES = \"postgres\",\n REDIS = \"redis\",\n}\n\n/**\n * Schedule execution type - one-time or recurring\n */\nexport enum ScheduleExecutionType {\n ONCE = \"once\", // Execute once at specified time\n CRON = \"cron\", // Recurring based on cron expression\n}\n\n/**\n * Task status enumeration\n */\nexport enum ScheduledTaskStatus {\n PENDING = \"pending\", // Waiting to be executed\n RUNNING = \"running\", // Currently executing\n COMPLETED = \"completed\", // Successfully completed (for ONCE type)\n FAILED = \"failed\", // Execution failed\n CANCELLED = \"cancelled\", // Manually cancelled\n PAUSED = \"paused\", // Paused (for CRON type)\n}\n\n/**\n * Schedule configuration interface\n */\nexport interface ScheduleConfig {\n name: string;\n description: string;\n type: ScheduleType;\n storage?: ScheduleStorage; // Optional storage for persistence\n options?: Record<string, any>;\n}\n\n/**\n * Scheduled task definition - fully serializable\n * Supports both one-time and cron-style recurring tasks\n */\nexport interface ScheduledTaskDefinition {\n taskId: string;\n taskType: string; // Maps to a registered handler\n payload: Record<string, any>; // JSON-serializable data passed to handler\n\n // Context fields for querying\n tenantId: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n\n // Execution configuration\n executionType: ScheduleExecutionType;\n\n // For ONCE type - execute at specific time or after delay\n executeAt?: number; // Timestamp when to execute\n delayMs?: number; // Original delay in milliseconds (for reference)\n\n // For CRON type - recurring schedule\n cronExpression?: string; // Cron format: \"0 9 * * *\" (min hour day month weekday)\n timezone?: string; // Timezone: \"Asia/Shanghai\", defaults to system timezone\n nextRunAt?: number; // Next calculated execution time\n lastRunAt?: number; // Last execution time\n\n // Execution tracking\n status: ScheduledTaskStatus;\n runCount: number; // How many times executed\n maxRuns?: number; // Max executions (null/undefined = infinite for cron, 1 for once)\n\n // Error handling\n retryCount: number; // Current retry count\n maxRetries: number; // Maximum retry attempts\n lastError?: string; // Last error message if failed\n\n // Timestamps\n createdAt: number;\n updatedAt: number;\n expiresAt?: number; // When to stop (for cron, optional)\n\n metadata?: Record<string, any>; // Additional metadata\n}\n\n/**\n * Task handler function type\n */\nexport type TaskHandler = (\n payload: Record<string, any>,\n taskInfo: ScheduledTaskDefinition\n) => void | Promise<void>;\n\n/**\n * Options for scheduling a one-time task\n */\nexport interface ScheduleOnceOptions {\n executeAt?: number; // Absolute timestamp to execute\n delayMs?: number; // OR relative delay from now\n maxRetries?: number; // Max retry attempts (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Options for scheduling a cron task\n */\nexport interface ScheduleCronOptions {\n cronExpression: string; // Cron expression: \"0 9 * * *\"\n timezone?: string; // Timezone: \"Asia/Shanghai\"\n maxRuns?: number; // Max executions (undefined = infinite)\n expiresAt?: number; // Stop after this timestamp\n maxRetries?: number; // Max retry attempts per run (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Schedule storage interface for persistence\n */\nexport interface ScheduleStorage {\n /**\n * Save a new task\n */\n save(task: ScheduledTaskDefinition): Promise<void>;\n\n /**\n * Get task by ID\n */\n get(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Update task\n */\n update(\n taskId: string,\n updates: Partial<ScheduledTaskDefinition>\n ): Promise<void>;\n\n /**\n * Delete task\n */\n delete(taskId: string): Promise<void>;\n\n /**\n * Get all pending/active tasks (for recovery)\n * Returns tasks with status: PENDING or PAUSED\n */\n getActiveTasks(): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by type\n */\n getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by status\n */\n getTasksByStatus(\n status: ScheduledTaskStatus\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by execution type\n */\n getTasksByExecutionType(\n executionType: ScheduleExecutionType\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by assistant ID\n */\n getTasksByAssistantId(\n assistantId: string\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by thread ID\n */\n getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get all tasks (with optional filters)\n */\n getAllTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n limit?: number;\n offset?: number;\n }): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Count tasks (with optional filters)\n */\n countTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n }): Promise<number>;\n\n /**\n * Delete completed/cancelled tasks older than specified time\n * Useful for cleanup\n */\n deleteOldTasks(olderThanMs: number): Promise<number>;\n}\n\n/**\n * Schedule client interface\n */\nexport interface ScheduleClient {\n // ===== Handler Registration =====\n\n /**\n * Register a handler for a task type\n * Must be called before scheduling tasks of this type\n */\n registerHandler(taskType: string, handler: TaskHandler): void;\n\n /**\n * Unregister a handler\n */\n unregisterHandler(taskType: string): boolean;\n\n /**\n * Check if a handler is registered\n */\n hasHandler(taskType: string): boolean;\n\n /**\n * Get all registered handler types\n */\n getHandlerTypes(): string[];\n\n // ===== One-time Task Scheduling =====\n\n /**\n * Schedule a one-time task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Execution options (executeAt or delayMs required)\n */\n scheduleOnce(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ): Promise<boolean>;\n\n // ===== Cron Task Scheduling =====\n\n /**\n * Schedule a recurring cron task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Cron options (cronExpression required)\n */\n scheduleCron(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ): Promise<boolean>;\n\n // ===== Task Management =====\n\n /**\n * Cancel a scheduled task\n */\n cancel(taskId: string): Promise<boolean>;\n\n /**\n * Pause a cron task (only for CRON type)\n */\n pause(taskId: string): Promise<boolean>;\n\n /**\n * Resume a paused cron task (only for CRON type)\n */\n resume(taskId: string): Promise<boolean>;\n\n /**\n * Check if a task exists\n */\n has(taskId: string): Promise<boolean>;\n\n /**\n * Get task information\n */\n getTask(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Get remaining time until next execution\n * Returns -1 if task not found or already executed\n */\n getRemainingTime(taskId: string): Promise<number>;\n\n /**\n * Get count of active tasks (pending + paused)\n */\n getActiveTaskCount(): Promise<number>;\n\n /**\n * Get all active task IDs\n */\n getActiveTaskIds(): Promise<string[]>;\n\n /**\n * Cancel all active tasks\n */\n cancelAll(): Promise<void>;\n\n // ===== Recovery =====\n\n /**\n * Restore active tasks from storage (call on service startup)\n * Re-schedules all pending tasks with their remaining time\n * Re-schedules all cron tasks for their next run\n * @returns Number of tasks restored\n */\n restore(): Promise<number>;\n\n // ===== Storage =====\n\n /**\n * Set the storage backend\n */\n setStorage(storage: ScheduleStorage): void;\n\n /**\n * Get current storage backend\n */\n getStorage(): ScheduleStorage | null;\n}\n\n/**\n * Schedule Lattice protocol interface\n */\nexport interface ScheduleLatticeProtocol\n extends BaseLatticeProtocol<ScheduleConfig, ScheduleClient> {\n // Handler registration\n registerHandler: (taskType: string, handler: TaskHandler) => void;\n unregisterHandler: (taskType: string) => boolean;\n hasHandler: (taskType: string) => boolean;\n getHandlerTypes: () => string[];\n\n // One-time task scheduling\n scheduleOnce: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ) => Promise<boolean>;\n\n // Cron task scheduling\n scheduleCron: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ) => Promise<boolean>;\n\n // Task management\n cancel: (taskId: string) => Promise<boolean>;\n pause: (taskId: string) => Promise<boolean>;\n resume: (taskId: string) => Promise<boolean>;\n has: (taskId: string) => Promise<boolean>;\n getTask: (taskId: string) => Promise<ScheduledTaskDefinition | null>;\n getRemainingTime: (taskId: string) => Promise<number>;\n getActiveTaskCount: () => Promise<number>;\n getActiveTaskIds: () => Promise<string[]>;\n cancelAll: () => Promise<void>;\n\n // Recovery\n restore: () => Promise<number>;\n}\n","/**\n * LoggerLatticeProtocol\n *\n * Logger Lattice protocol for logging management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Logger service type enumeration\n */\nexport enum LoggerType {\n PINO = \"pino\",\n CONSOLE = \"console\",\n CUSTOM = \"custom\",\n}\n\n/**\n * Logger context interface\n */\nexport interface LoggerContext {\n \"x-user-id\"?: string;\n \"x-tenant-id\"?: string;\n \"x-request-id\"?: string;\n \"x-task-id\"?: string;\n \"x-thread-id\"?: string;\n [key: string]: any;\n}\n\n/**\n * Pino logger file transport options\n */\nexport interface PinoFileOptions {\n file?: string; // Log file path (e.g., \"./logs/app.log\" or \"./logs/app\")\n frequency?: \"daily\" | \"hourly\" | \"minutely\" | string; // Log rotation frequency\n mkdir?: boolean; // Create directory if not exists\n size?: string; // Max file size (e.g., \"10M\", \"100K\")\n maxFiles?: number; // Maximum number of log files to keep\n}\n\n/**\n * Logger configuration interface\n */\nexport interface LoggerConfig {\n name: string; // Logger name\n description?: string; // Logger description\n type: LoggerType; // Logger service type\n serviceName?: string; // Service name (e.g., \"lattice-gateway\")\n loggerName?: string; // Logger instance name (e.g., \"fastify-server\")\n context?: LoggerContext; // Initial context\n // File logging options (for PINO type)\n file?: string | PinoFileOptions; // Log file path or detailed file options\n // Additional options (e.g., pino config, custom logger settings)\n options?: Record<string, any>;\n}\n\n/**\n * Logger client interface\n */\nexport interface LoggerClient {\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n\n/**\n * Logger Lattice protocol interface\n */\nexport interface LoggerLatticeProtocol\n extends BaseLatticeProtocol<LoggerConfig, LoggerClient> {\n // Logger operations\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n","/**\n * MessageProtocol\n *\n */\n\n\n\n/**\n * Base message interface\n */\nexport interface BaseMessage {\n id: string; // Unique identifier for the message\n role: string; // Role of the sender (user, assistant, system, tool, developer)\n content?: string; // Optional text content of the message\n name?: string; // Optional name of the sender\n}\n\n/**\n * User message interface\n */\nexport interface UserMessage extends BaseMessage {\n role: \"human\";\n content: string; // Text input from the user\n files?: Array<{ name: string; id: string }>; // Optional files attached to the message\n}\n\n/**\n * Tool call interface\n */\nexport interface ToolCall {\n id: string; // Unique identifier for this tool call\n name: string; // Name of the tool/function to call\n args: Record<string, any>; // Arguments as an object\n type: \"tool_call\"; // Type of tool call\n response?: string; // Optional response from the tool execution\n}\n\n/**\n * Assistant message interface\n */\nexport interface AssistantMessage extends BaseMessage {\n role: \"ai\";\n content?: string; // Text response from the assistant (optional if using tool calls)\n tool_calls?: ToolCall[]; // Optional tool calls made by the assistant\n}\n\nexport interface InterruptMessage extends BaseMessage {\n type: \"interrupt\";\n value: any;\n}\n\n/**\n * System message interface\n */\nexport interface SystemMessage extends BaseMessage {\n role: \"system\";\n content: string; // Instructions or context for the assistant\n}\n\n/**\n * Tool message interface\n */\nexport interface ToolMessage extends BaseMessage {\n role: \"tool\";\n content: string; // Result from the tool execution\n tool_call_id: string; // ID of the tool call this message responds to\n}\n\n/**\n * Developer message interface\n */\nexport interface DeveloperMessage extends BaseMessage {\n role: \"developer\";\n content: string; // Content for development or debugging\n}\n\n/**\n * Message chunk type constants\n */\nexport const MessageChunkTypes = {\n HUMAN: 'human',\n AI: 'ai',\n TOOL: 'tool',\n INTERRUPT: 'interrupt',\n MESSAGE_COMPLETED: 'message_completed',\n MESSAGE_FAILED: 'message_failed',\n THREAD_IDLE: 'thread_idle',\n} as const;\n\nexport type MessageChunkType = typeof MessageChunkTypes[keyof typeof MessageChunkTypes];\n\nexport interface MessageChunk {\n type: MessageChunkType;\n data: {\n id: string;\n content?: string;\n tool_call_chunks?: Array<{\n name?: string;\n args?: string;\n id?: string;\n index: number;\n }>;\n tool_calls?: Array<{\n name: string;\n args: Record<string, any>;\n id: string;\n type: string;\n response?: string;\n }>;\n additional_kwargs?: {\n tool_calls?: Array<{\n function?: { name?: string; arguments?: any };\n id?: string;\n }>;\n };\n tool_call_id?: string;\n };\n}\n\n/**\n * Message type union\n */\nexport type Message =\n | UserMessage\n | AssistantMessage\n | SystemMessage\n | ToolMessage\n | DeveloperMessage;\n","/**\n * McpLatticeProtocol\n *\n * Model Context Protocol (MCP) lattice protocol for integrating MCP servers\n * with the Lattice framework. Provides standardized interfaces for MCP\n * client connections, tool discovery, and remote execution.\n */\n\nimport { BaseLatticeProtocol, LatticeMessage } from \"./BaseLatticeProtocol\";\n\n/**\n * MCP transport type\n */\nexport type McpTransportType = \"stdio\" | \"streamable_http\" | \"sse\";\n\n/**\n * MCP server configuration\n */\nexport interface McpServerConfig {\n /** Server name */\n name: string;\n /** Server version */\n version: string;\n /** Transport type */\n transport: McpTransportType;\n /** Command for stdio transport (e.g., \"npx\", \"python\") */\n command?: string;\n /** Arguments for stdio transport */\n args?: string[];\n /** URL for HTTP/SSE transport */\n url?: string;\n /** Environment variables */\n env?: Record<string, string>;\n /** Connection timeout in milliseconds */\n timeout?: number;\n /** Retry attempts on connection failure */\n retryAttempts?: number;\n}\n\n/**\n * MCP tool definition\n */\nexport interface McpTool {\n /** Tool name */\n name: string;\n /** Tool description */\n description: string;\n /** Input schema */\n inputSchema: {\n type: \"object\";\n properties: Record<string, any>;\n required?: string[];\n };\n /** Tool metadata */\n metadata?: Record<string, any>;\n}\n\n/**\n * MCP tool call result\n */\nexport interface McpToolResult {\n /** Whether the call was successful */\n success: boolean;\n /** Result content */\n content: Array<{\n type: \"text\" | \"image\" | \"audio\" | \"resource\";\n data: any;\n mimeType?: string;\n }>;\n /** Error message if failed */\n error?: string;\n /** Execution metadata */\n metadata?: {\n duration: number;\n tokens?: number;\n model?: string;\n };\n}\n\n/**\n * MCP client interface\n */\nexport interface McpClient {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Check if connected\n */\n isConnected(): boolean;\n \n /**\n * List available tools\n */\n listTools(): Promise<McpTool[]>;\n \n /**\n * Call a tool\n */\n callTool(name: string, arguments_: Record<string, any>): Promise<McpToolResult>;\n \n /**\n * Subscribe to server notifications\n */\n subscribe(topic: string, handler: (data: any) => void): void;\n \n /**\n * Unsubscribe from server notifications\n */\n unsubscribe(topic: string): void;\n \n /**\n * Get client statistics\n */\n getStats(): McpStats;\n \n /**\n * Get connection status\n */\n getStatus(): McpConnectionStatus;\n}\n\n/**\n * MCP client options\n */\nexport interface McpClientOptions {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n /** Auto-connect on initialization */\n autoConnect?: boolean;\n /** Error handler */\n onError?: (error: Error) => void;\n /** Connection status handler */\n onStatusChange?: (status: McpConnectionStatus) => void;\n}\n\n/**\n * MCP Lattice protocol interface\n */\nexport interface McpLatticeProtocol\n extends BaseLatticeProtocol<McpServerConfig, McpClient> {\n /**\n * Server configuration\n */\n config: McpServerConfig;\n \n /**\n * MCP client instance\n */\n client: McpClient;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Get available tools\n */\n getTools(): Promise<McpTool[]>;\n \n /**\n * Execute a tool\n */\n executeTool(\n name: string,\n arguments_: Record<string, any>\n ): Promise<McpToolResult>;\n \n /**\n * Execute with automatic retries\n */\n executeToolWithRetry(\n name: string,\n arguments_: Record<string, any>,\n maxRetries?: number\n ): Promise<McpToolResult>;\n \n /**\n * Get protocol version\n */\n getProtocolVersion(): string;\n \n /**\n * Health check\n */\n healthCheck(): Promise<boolean>;\n}\n\n/**\n * MCP message types\n */\nexport enum McpMessageType {\n CONNECT = \"mcp:connect\",\n DISCONNECT = \"mcp:disconnect\",\n LIST_TOOLS = \"mcp:list_tools\",\n CALL_TOOL = \"mcp:call_tool\",\n TOOL_RESULT = \"mcp:tool_result\",\n NOTIFICATION = \"mcp:notification\",\n ERROR = \"mcp:error\",\n HEALTH_CHECK = \"mcp:health_check\",\n}\n\n/**\n * MCP Lattice message\n */\nexport interface McpLatticeMessage extends LatticeMessage {\n type: McpMessageType;\n payload: {\n toolName?: string;\n arguments?: Record<string, any>;\n result?: McpToolResult;\n tools?: McpTool[];\n error?: string;\n };\n}\n\n/**\n * MCP connection status\n */\nexport type McpConnectionStatus =\n | \"disconnected\"\n | \"connecting\"\n | \"connected\"\n | \"reconnecting\"\n | \"error\";\n\n/**\n * MCP statistics\n */\nexport interface McpStats {\n totalCalls: number;\n successfulCalls: number;\n failedCalls: number;\n averageLatency: number;\n lastCallTimestamp: number;\n}\n","/**\n * A2AProtocol - Google Agent-to-Agent Protocol type definitions\n *\n * Based on the A2A open protocol spec for AI agent interoperability.\n * @see https://github.com/google/A2A\n */\n\n// ─── Agent Card ───────────────────────────────────────────────────────────\n\nexport interface A2ASkill {\n id: string;\n name: string;\n description: string;\n tags: string[];\n examples: string[];\n}\n\nexport interface A2ACapabilities {\n streaming: boolean;\n pushNotifications: boolean;\n stateTransitionHistory: boolean;\n}\n\nexport interface A2AProvider {\n organization: string;\n url?: string;\n}\n\nexport interface AgentCard {\n name: string;\n description: string;\n url: string;\n provider: A2AProvider;\n version: string;\n documentationUrl?: string;\n capabilities: A2ACapabilities;\n defaultInputModes: string[];\n defaultOutputModes: string[];\n skills: A2ASkill[];\n}\n\n// ─── Artifact / Part ──────────────────────────────────────────────────────\n\nexport interface A2ATextPart {\n type: \"text\";\n text: string;\n}\n\nexport interface A2AFilePart {\n type: \"file\";\n file: {\n name: string;\n mimeType: string;\n bytes?: string;\n uri?: string;\n };\n}\n\nexport interface A2ADataPart {\n type: \"data\";\n data: Record<string, unknown>;\n}\n\nexport type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;\n\n// ─── Message ──────────────────────────────────────────────────────────────\n\nexport interface A2AMessage {\n role: \"user\" | \"agent\";\n parts: A2APart[];\n messageId?: string;\n contextId?: string;\n referenceTaskIds?: string[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Task ─────────────────────────────────────────────────────────────────\n\nexport type A2ATaskState =\n | \"working\"\n | \"input-required\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"rejected\";\n\nexport interface A2ATaskStatus {\n state: A2ATaskState;\n message?: A2AMessage;\n timestamp: string;\n}\n\nexport interface A2AArtifact {\n name?: string;\n description?: string;\n parts: A2APart[];\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATask {\n id: string;\n sessionId?: string;\n contextId?: string;\n status: A2ATaskStatus;\n artifacts: A2AArtifact[];\n history?: A2AMessage[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Request / Response ───────────────────────────────────────────────────\n\nexport interface A2ATaskSendRequest {\n id?: string;\n sessionId?: string;\n message: A2AMessage;\n pushNotification?: A2APushNotification;\n historyLength?: number;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2APushNotification {\n url: string;\n token?: string;\n}\n\nexport interface A2ATaskUpdatePayload {\n id: string;\n sessionId?: string;\n contextId?: string;\n status: A2ATaskStatus;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATaskArtifactUpdatePayload {\n id: string;\n sessionId?: string;\n contextId?: string;\n artifact: A2AArtifact;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\n// ─── SSE Events ───────────────────────────────────────────────────────────\n\nexport type A2ASSEEvent =\n | { event: \"task\"; data: A2ATaskUpdatePayload }\n | { event: \"status-update\"; data: A2ATaskUpdatePayload }\n | { event: \"artifact-update\"; data: A2ATaskArtifactUpdatePayload }\n | { event: \"error\"; data: { code: string; message: string } };\n\n// ─── Config ───────────────────────────────────────────────────────────────\n\nexport interface A2AConfig {\n agentName: string;\n agentDescription: string;\n agentUrl: string;\n organization: string;\n version?: string;\n capabilities?: Partial<A2ACapabilities>;\n defaultInputModes?: string[];\n defaultOutputModes?: string[];\n skills?: A2ASkill[];\n apiKeyMap: Map<string, A2AApiKeyEntry>;\n}\n\nexport interface A2AApiKeyEntry {\n key: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n}\n\nexport const A2A_DEFAULT_CAPABILITIES: A2ACapabilities = {\n streaming: true,\n pushNotifications: false,\n stateTransitionHistory: false,\n};\n\nexport const A2A_DEFAULT_INPUT_MODES = [\"text\", \"text/plain\"];\nexport const A2A_DEFAULT_OUTPUT_MODES = [\"text\", \"text/plain\", \"text/markdown\"];\n\nexport interface A2AAuthContext {\n authenticated: boolean;\n apiKey?: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n source?: \"bearer\" | \"x-api-key\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,cAAW;AARD,SAAAA;AAAA,GAAA;AA0NL,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AA4FO,SAAS,uBACd,QACgC;AAChC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,sBACd,QAC+B;AAC/B,SAAO,OAAO,SAAS;AACzB;AA4BO,SAAS,SAAS,QAAqD;AAC5E,SAAO;AACT;AAKO,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,wBACd,QACiC;AACjC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,mBAAmB,QAA+B;AAChE,MAAI,SAAS,MAAM,GAAG;AACpB,WAAO,OAAO,SAAS,CAAC;AAAA,EAC1B;AACA,SAAO,CAAC;AACV;AAKO,SAAS,uBAAuB,QAA+B;AACpE,MAAI,kBAAkB,MAAM,KAAK,wBAAwB,MAAM,GAAG;AAChE,WAAO,OAAO,aAAa,CAAC;AAAA,EAC9B;AACA,SAAO,CAAC;AACV;;;AC7YO,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,eAAY;AACZ,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;;;ACAL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,eAAY;AACZ,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AAVC,SAAAA;AAAA,GAAA;;;ACAL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,WAAQ;AAFE,SAAAA;AAAA,GAAA;;;ACEL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,WAAQ;AAHE,SAAAA;AAAA,GAAA;AASL,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAQL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AANC,SAAAA;AAAA,GAAA;;;ACnBL,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACoEL,IAAM,oBAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,aAAa;AACf;;;ACgIO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,iBAAc;AACd,EAAAA,gBAAA,kBAAe;AACf,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,kBAAe;AARL,SAAAA;AAAA,GAAA;;;AC1CL,IAAM,2BAA4C;AAAA,EACvD,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,wBAAwB;AAC1B;AAEO,IAAM,0BAA0B,CAAC,QAAQ,YAAY;AACrD,IAAM,2BAA2B,CAAC,QAAQ,cAAc,eAAe;","names":["AgentType","MemoryType","UIComponentType","QueueType","ScheduleType","ScheduleExecutionType","ScheduledTaskStatus","LoggerType","McpMessageType"]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AgentLatticeProtocol.ts","../src/MemoryLatticeProtocol.ts","../src/UILatticeProtocol.ts","../src/QueueLatticeProtocol.ts","../src/ScheduleLatticeProtocol.ts","../src/LoggerLatticeProtocol.ts","../src/MessageProtocol.ts","../src/McpLatticeProtocol.ts","../src/A2AProtocol.ts"],"sourcesContent":["/**\n * AgentLatticeProtocol\n *\n * 智能体Lattice的协议,定义了智能体的行为和组合方式\n */\n\nimport { CompiledStateGraph } from \"@langchain/langgraph\";\nimport { ZodObject } from \"zod\";\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 智能体类型枚举\n */\nexport enum AgentType {\n REACT = \"react\",\n DEEP_AGENT = \"deep_agent\",\n TEAM = \"team\",\n PROCESSING = \"processing\",\n /** Remote A2A agent — delegates to an external A2A-compatible server */\n A2A_REMOTE = \"a2a_remote\",\n /** Workflow agent — compiled from YAML DSL into a LangGraph StateGraph */\n WORKFLOW = \"workflow\",\n}\n\n/**\n * Runtime configuration that will be injected into LangGraphRunnableConfig.configurable\n * Tools can access these values via config.configurable.runConfig\n */\nexport interface AgentRunConfig {\n /** Database key for SQL tools (registered via sqlDatabaseManager) */\n databaseKey?: string;\n /** Any additional runtime configuration */\n [key: string]: any;\n}\n\n/**\n * Base agent configuration shared by all agent types\n */\ninterface BaseAgentConfig {\n key: string; // Unique key\n name: string; // Name\n description: string; // Description\n prompt: string; // Prompt\n /**\n * Key of the parent agent to inherit configuration from.\n * When set, unspecified fields are inherited from the parent agent's config.\n * Child's explicitly set fields override the parent's.\n */\n extendsAgent?: string;\n schema?: ZodObject<any, any, any, any, any>; // Input validation schema\n modelKey?: string; // Model key to use\n /**\n * Runtime configuration to inject into tool execution context\n * Will be available in tools via config.configurable.runConfig\n */\n runConfig?: AgentRunConfig;\n skillCategories?: string[];\n middleware?: AgentMiddlewareConfig[];\n /**\n * Structured output response format for the agent.\n * Supports Zod schema (z.object({...})), JSON Schema object ({ type: \"object\", properties: {...} }),\n * providerStrategy(), toolStrategy(), and other formats accepted by the underlying model.\n *\n * @example\n * ```ts\n * // Zod schema\n * responseFormat: z.object({ name: z.string(), age: z.number() })\n *\n * // JSON Schema\n * responseFormat: { type: \"object\", properties: { name: { type: \"string\" } }, required: [\"name\"] }\n * ```\n */\n responseFormat?: any;\n}\n\nexport type AvailableModule = \"filesystem\" | \"code_eval\" | \"browser\";\n\nexport interface SandboxMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n modules: AvailableModule[];\n}\n\nexport interface CodeEvalMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n timeout: number;\n memoryLimit: number;\n}\n\nexport interface BrowserMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n headless: boolean;\n}\n\nexport interface SqlMiddlewareConfig {\n databaseKeys?: string[];\n}\n\nexport interface MetricsMiddlewareConfig {\n /** List of configured metrics server keys */\n serverKeys: string[];\n /** Optional descriptions for each server */\n serverDescriptions?: Record<string, string>;\n}\n\nexport interface SchedulerMiddlewareConfig {\n defaultMaxRetries?: number;\n}\n\nexport interface CollectionMiddlewareConfig {\n /** List of configured collection keys */\n collectionKeys: string[];\n /**\n * When true, all collections for the tenant are available.\n * When false or undefined, only collections in collectionKeys are used.\n */\n connectAll?: boolean;\n}\n\nexport type MiddlewareType = \"filesystem\" | \"code_eval\" | \"browser\" | \"sql\" | \"skill\" | \"http\" | \"custom\" | \"metrics\" | \"ask_user_to_clarify\" | \"widget\" | \"claw\" | \"date\" | \"scheduler\" | \"topology\" | \"task\" | \"collection\" | string;\n\nexport interface AgentMiddlewareConfig {\n id: string;\n type: MiddlewareType;\n name: string;\n description: string;\n enabled: boolean;\n /** 可选:限制该中间件暴露的工具列表。不配置则默认暴露所有工具 */\n allowedTools?: string[];\n config: SandboxMiddlewareConfig | CodeEvalMiddlewareConfig | BrowserMiddlewareConfig | SqlMiddlewareConfig | MetricsMiddlewareConfig | ClawMiddlewareConfig | CollectionMiddlewareConfig | SchedulerMiddlewareConfig | Record<string, any>;\n}\n\n/**\n * Bootstrap file configuration\n * Defines default content for project bootstrap files\n */\nexport interface BootstrapFilesConfig {\n /** Default content for AGENTS.md - operating instructions */\n agents?: string;\n /** Default content for SOUL.md - personality and tone */\n soul?: string;\n /** Default content for IDENTITY.md - agent identity */\n identity?: string;\n /** Default content for USER.md - user preferences */\n user?: string;\n /** Default content for TOOLS.md - tool documentation */\n tools?: string;\n /** Default content for BOOTSTRAP.md - first-run tasks */\n bootstrap?: string;\n}\n\n/**\n * Claw Middleware 配置\n * 用于配置 bootstrap 文件管理行为\n */\nexport interface ClawMiddlewareConfig {\n /** 是否启用 bootstrap 文件注入(默认:true) */\n injectBootstrapFiles?: boolean;\n /** 自定义 bootstrap 文件内容 */\n bootstrapFiles?: BootstrapFilesConfig;\n}\n\n\n/**\n * REACT agent configuration\n */\nexport interface ReactAgentConfig extends BaseAgentConfig {\n type: AgentType.REACT;\n tools?: string[]; // Tool list\n}\n\n/**\n * DEEP_AGENT configuration - only this type supports subAgents\n */\nexport interface DeepAgentConfig extends BaseAgentConfig {\n type: AgentType.DEEP_AGENT;\n tools?: string[]; // Tool list\n subAgents?: string[]; // Sub-agent list (unique to DEEP_AGENT)\n internalSubAgents?: AgentConfig[]; // Internal sub-agent list (unique to DEEP_AGENT)\n}\n\n/**\n * PROCESSING agent configuration — workflow orchestration with topology enforcement.\n * Replaces todoListMiddleware with topologyMiddleware.\n */\nexport interface ProcessingAgentConfig extends BaseAgentConfig {\n type: AgentType.PROCESSING;\n tools?: string[];\n subAgents?: string[];\n internalSubAgents?: AgentConfig[];\n}\n\n/**\n * Team teammate configuration -- describes an available teammate.\n */\nexport interface TeamTeammateConfig {\n /** Unique name for this teammate (used as agent ID) */\n name: string;\n /** Role category (e.g. \"research\", \"writing\", \"review\") */\n role: string;\n /** Human-readable description of what this teammate does */\n description: string;\n /** Tool keys this teammate has access to */\n tools?: string[];\n /** Custom system prompt for this teammate */\n prompt?: string;\n /** Model key override for this teammate */\n modelKey?: string;\n}\n\n/**\n * TEAM agent configuration -- a team lead that dynamically creates teammates.\n * Teammates are created on-the-fly from create_team tool input (name, role, description).\n */\nexport interface TeamAgentConfig extends BaseAgentConfig {\n type: AgentType.TEAM;\n /** Tool keys available to the team lead */\n tools?: string[];\n /** Maximum number of teammates running concurrently */\n maxConcurrency?: number;\n /**\n * Schedule lattice key for polling task list / mailbox.\n * When set, teammates use ScheduleLattice for periodic polling instead of event-driven wait.\n */\n scheduleLatticeKey?: string;\n /** Poll interval in ms when using schedule lattice (default: 5000) */\n pollIntervalMs?: number;\n}\n\n/**\n * Type guard to check if config is TeamAgentConfig\n */\nexport function isTeamAgentConfig(\n config: AgentConfig\n): config is TeamAgentConfig {\n return config.type === AgentType.TEAM;\n}\n\n// ─── A2A_REMOTE Agent ──────────────────────────────────────────────────────\n\n/**\n * A2A_REMOTE agent configuration — delegates to an external A2A server.\n *\n * This agent type wraps a remote A2A endpoint so orchestrators can treat\n * external agents the same as local LangGraph agents.\n */\nexport interface A2ARemoteAgentConfig extends BaseAgentConfig {\n type: AgentType.A2A_REMOTE;\n /**\n * URL of the remote agent's agent card (e.g. http://host:3000/.well-known/agent-card.json).\n * The builder fetches this card to discover the JSON-RPC endpoint.\n */\n agentCardUrl: string;\n /**\n * Optional API key sent as Bearer token or X-API-Key header.\n */\n apiKey?: string;\n /**\n * HTTP timeout in milliseconds (default: 300_000 = 5 min).\n */\n timeout?: number;\n /**\n * Optional tool keys (not used by the builder, but included for type compatibility).\n */\n tools?: string[];\n}\n\n/**\n * WORKFLOW agent configuration — compiled from YAML workflow DSL into a LangGraph StateGraph.\n *\n * The workflow field contains the full DSL definition (nodes, edges, state).\n * The WorkflowAgentGraphBuilder compiles this into a multi-node LangGraph\n * where each node invokes a registered sub-agent by ref.\n */\nexport interface WorkflowAgentConfig extends BaseAgentConfig {\n type: AgentType.WORKFLOW;\n /** The YAML workflow DSL definition string (needs+if format) */\n workflowYaml: string;\n /** Optional tool keys */\n tools?: string[];\n}\n\n/**\n * Type guard to check if config is A2ARemoteAgentConfig\n */\nexport function isA2ARemoteAgentConfig(\n config: AgentConfig\n): config is A2ARemoteAgentConfig {\n return config.type === AgentType.A2A_REMOTE;\n}\n\n/**\n * Type guard to check if config is WorkflowAgentConfig\n */\nexport function isWorkflowAgentConfig(\n config: AgentConfig\n): config is WorkflowAgentConfig {\n return config.type === AgentType.WORKFLOW;\n}\n\n/**\n * Agent configuration union type\n * Different agent types have different configuration options\n */\nexport type AgentConfig =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Agent configuration with tools property\n */\nexport type AgentConfigWithTools =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Type guard to check if config has tools property\n */\nexport function hasTools(config: AgentConfig): config is AgentConfigWithTools {\n return true;\n}\n\n/**\n * Type guard to check if config is DeepAgentConfig (has subAgents)\n */\nexport function isDeepAgentConfig(\n config: AgentConfig\n): config is DeepAgentConfig {\n return config.type === AgentType.DEEP_AGENT;\n}\n\n/**\n * Type guard to check if config is ProcessingAgentConfig (has subAgents + topology)\n */\nexport function isProcessingAgentConfig(\n config: AgentConfig\n): config is ProcessingAgentConfig {\n return config.type === AgentType.PROCESSING;\n}\n\n/**\n * Get tools from config safely\n */\nexport function getToolsFromConfig(config: AgentConfig): string[] {\n if (hasTools(config)) {\n return config.tools || [];\n }\n return [];\n}\n\n/**\n * Get subAgents from config safely (DeepAgentConfig and ProcessingAgentConfig have subAgents)\n */\nexport function getSubAgentsFromConfig(config: AgentConfig): string[] {\n if (isDeepAgentConfig(config) || isProcessingAgentConfig(config)) {\n return config.subAgents || [];\n }\n return [];\n}\n\n/**\n * 智能体客户端类型\n */\nexport type AgentClient = CompiledStateGraph<any, any, any, any, any>;\n\n/**\n * Graph构建选项\n */\nexport interface GraphBuildOptions {\n overrideTools?: string[];\n overrideModel?: string;\n metadata?: Record<string, any>;\n}\n\n/**\n * 智能体Lattice协议接口\n */\nexport interface AgentLatticeProtocol\n extends BaseLatticeProtocol<AgentConfig, AgentClient> {\n // 智能体执行函数\n invoke: (input: any, options?: any) => Promise<any>;\n\n // 构建智能体图\n buildGraph: (options?: GraphBuildOptions) => Promise<AgentClient>;\n}\n","/**\n * MemoryLatticeProtocol\n *\n * 记忆Lattice的协议,用于管理智能体的上下文和记忆\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 记忆类型枚举\n */\nexport enum MemoryType {\n SHORT_TERM = \"short_term\",\n LONG_TERM = \"long_term\",\n EPISODIC = \"episodic\",\n SEMANTIC = \"semantic\",\n WORKING = \"working\",\n}\n\n/**\n * 记忆配置接口\n */\nexport interface MemoryConfig {\n name: string; // 名称\n description: string; // 描述\n type: MemoryType; // 记忆类型\n ttl?: number; // 生存时间\n capacity?: number; // 容量限制\n}\n\n/**\n * 记忆客户端接口\n */\nexport interface MemoryClient {\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n\n/**\n * 记忆Lattice协议接口\n */\nexport interface MemoryLatticeProtocol\n extends BaseLatticeProtocol<MemoryConfig, MemoryClient> {\n // 记忆操作方法\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n","/**\n * UILatticeProtocol\n *\n * UI Lattice的协议,用于定义用户界面组件\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * UI组件类型枚举\n */\nexport enum UIComponentType {\n CONTAINER = \"container\",\n INPUT = \"input\",\n BUTTON = \"button\",\n LIST = \"list\",\n TABLE = \"table\",\n CHART = \"chart\",\n FORM = \"form\",\n CARD = \"card\",\n MODAL = \"modal\",\n CUSTOM = \"custom\",\n}\n\n/**\n * UI配置接口\n */\nexport interface UIConfig {\n name: string; // 组件名称\n description: string; // 组件描述\n type: UIComponentType; // 组件类型\n props?: Record<string, any>; // 组件属性\n children?: string[]; // 子组件列表\n}\n\n/**\n * UI组件接口\n * 使用泛型以适应不同的UI框架(React, Vue等)\n */\nexport interface UIComponent<T = any> {\n render: (props?: any) => T;\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n\n/**\n * UI Lattice协议接口\n */\nexport interface UILatticeProtocol<T = any>\n extends BaseLatticeProtocol<UIConfig, UIComponent<T>> {\n // UI渲染方法\n render: (props?: any) => T;\n\n // 事件处理\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n","/**\n * QueueLatticeProtocol\n *\n * Queue Lattice protocol for task queue management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Queue service type enumeration\n */\nexport enum QueueType {\n MEMORY = \"memory\",\n REDIS = \"redis\",\n}\n\n/**\n * Queue configuration interface\n */\nexport interface QueueConfig {\n name: string; // Queue name\n description: string; // Queue description\n type: QueueType; // Queue service type\n queueName?: string; // Specific queue name (e.g., \"tasks\")\n options?: Record<string, any>; // Additional options (e.g., Redis connection options)\n}\n\n/**\n * Queue operation result interface\n */\nexport interface QueueResult<T = any> {\n data: T | null;\n error: any | null;\n}\n\n/**\n * Queue client interface\n */\nexport interface QueueClient {\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n/**\n * Queue Lattice protocol interface\n */\nexport interface QueueLatticeProtocol\n extends BaseLatticeProtocol<QueueConfig, QueueClient> {\n // Queue operations\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n\n\n","/**\n * ScheduleLatticeProtocol\n *\n * Schedule Lattice protocol for delayed and recurring task execution management\n * Supports persistence and recovery after service restart\n * Supports both one-time delayed tasks and cron-style recurring tasks\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Schedule service type enumeration\n */\nexport enum ScheduleType {\n MEMORY = \"memory\",\n POSTGRES = \"postgres\",\n REDIS = \"redis\",\n}\n\n/**\n * Schedule execution type - one-time or recurring\n */\nexport enum ScheduleExecutionType {\n ONCE = \"once\", // Execute once at specified time\n CRON = \"cron\", // Recurring based on cron expression\n}\n\n/**\n * Task status enumeration\n */\nexport enum ScheduledTaskStatus {\n PENDING = \"pending\", // Waiting to be executed\n RUNNING = \"running\", // Currently executing\n COMPLETED = \"completed\", // Successfully completed (for ONCE type)\n FAILED = \"failed\", // Execution failed\n CANCELLED = \"cancelled\", // Manually cancelled\n PAUSED = \"paused\", // Paused (for CRON type)\n}\n\n/**\n * Schedule configuration interface\n */\nexport interface ScheduleConfig {\n name: string;\n description: string;\n type: ScheduleType;\n storage?: ScheduleStorage; // Optional storage for persistence\n options?: Record<string, any>;\n}\n\n/**\n * Scheduled task definition - fully serializable\n * Supports both one-time and cron-style recurring tasks\n */\nexport interface ScheduledTaskDefinition {\n taskId: string;\n taskType: string; // Maps to a registered handler\n payload: Record<string, any>; // JSON-serializable data passed to handler\n\n // Context fields for querying\n tenantId: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n\n // Execution configuration\n executionType: ScheduleExecutionType;\n\n // For ONCE type - execute at specific time or after delay\n executeAt?: number; // Timestamp when to execute\n delayMs?: number; // Original delay in milliseconds (for reference)\n\n // For CRON type - recurring schedule\n cronExpression?: string; // Cron format: \"0 9 * * *\" (min hour day month weekday)\n timezone?: string; // Timezone: \"Asia/Shanghai\", defaults to system timezone\n nextRunAt?: number; // Next calculated execution time\n lastRunAt?: number; // Last execution time\n\n // Execution tracking\n status: ScheduledTaskStatus;\n runCount: number; // How many times executed\n maxRuns?: number; // Max executions (null/undefined = infinite for cron, 1 for once)\n\n // Error handling\n retryCount: number; // Current retry count\n maxRetries: number; // Maximum retry attempts\n lastError?: string; // Last error message if failed\n\n // Timestamps\n createdAt: number;\n updatedAt: number;\n expiresAt?: number; // When to stop (for cron, optional)\n\n metadata?: Record<string, any>; // Additional metadata\n}\n\n/**\n * Task handler function type\n */\nexport type TaskHandler = (\n payload: Record<string, any>,\n taskInfo: ScheduledTaskDefinition\n) => void | Promise<void>;\n\n/**\n * Options for scheduling a one-time task\n */\nexport interface ScheduleOnceOptions {\n executeAt?: number; // Absolute timestamp to execute\n delayMs?: number; // OR relative delay from now\n maxRetries?: number; // Max retry attempts (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Options for scheduling a cron task\n */\nexport interface ScheduleCronOptions {\n cronExpression: string; // Cron expression: \"0 9 * * *\"\n timezone?: string; // Timezone: \"Asia/Shanghai\"\n maxRuns?: number; // Max executions (undefined = infinite)\n expiresAt?: number; // Stop after this timestamp\n maxRetries?: number; // Max retry attempts per run (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Schedule storage interface for persistence\n */\nexport interface ScheduleStorage {\n /**\n * Save a new task\n */\n save(task: ScheduledTaskDefinition): Promise<void>;\n\n /**\n * Get task by ID\n */\n get(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Update task\n */\n update(\n taskId: string,\n updates: Partial<ScheduledTaskDefinition>\n ): Promise<void>;\n\n /**\n * Delete task\n */\n delete(taskId: string): Promise<void>;\n\n /**\n * Get all pending/active tasks (for recovery)\n * Returns tasks with status: PENDING or PAUSED\n */\n getActiveTasks(): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by type\n */\n getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by status\n */\n getTasksByStatus(\n status: ScheduledTaskStatus\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by execution type\n */\n getTasksByExecutionType(\n executionType: ScheduleExecutionType\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by assistant ID\n */\n getTasksByAssistantId(\n assistantId: string\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by thread ID\n */\n getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get all tasks (with optional filters)\n */\n getAllTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n limit?: number;\n offset?: number;\n }): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Count tasks (with optional filters)\n */\n countTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n }): Promise<number>;\n\n /**\n * Delete completed/cancelled tasks older than specified time\n * Useful for cleanup\n */\n deleteOldTasks(olderThanMs: number): Promise<number>;\n}\n\n/**\n * Schedule client interface\n */\nexport interface ScheduleClient {\n // ===== Handler Registration =====\n\n /**\n * Register a handler for a task type\n * Must be called before scheduling tasks of this type\n */\n registerHandler(taskType: string, handler: TaskHandler): void;\n\n /**\n * Unregister a handler\n */\n unregisterHandler(taskType: string): boolean;\n\n /**\n * Check if a handler is registered\n */\n hasHandler(taskType: string): boolean;\n\n /**\n * Get all registered handler types\n */\n getHandlerTypes(): string[];\n\n // ===== One-time Task Scheduling =====\n\n /**\n * Schedule a one-time task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Execution options (executeAt or delayMs required)\n */\n scheduleOnce(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ): Promise<boolean>;\n\n // ===== Cron Task Scheduling =====\n\n /**\n * Schedule a recurring cron task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Cron options (cronExpression required)\n */\n scheduleCron(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ): Promise<boolean>;\n\n // ===== Task Management =====\n\n /**\n * Cancel a scheduled task\n */\n cancel(taskId: string): Promise<boolean>;\n\n /**\n * Pause a cron task (only for CRON type)\n */\n pause(taskId: string): Promise<boolean>;\n\n /**\n * Resume a paused cron task (only for CRON type)\n */\n resume(taskId: string): Promise<boolean>;\n\n /**\n * Check if a task exists\n */\n has(taskId: string): Promise<boolean>;\n\n /**\n * Get task information\n */\n getTask(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Get remaining time until next execution\n * Returns -1 if task not found or already executed\n */\n getRemainingTime(taskId: string): Promise<number>;\n\n /**\n * Get count of active tasks (pending + paused)\n */\n getActiveTaskCount(): Promise<number>;\n\n /**\n * Get all active task IDs\n */\n getActiveTaskIds(): Promise<string[]>;\n\n /**\n * Cancel all active tasks\n */\n cancelAll(): Promise<void>;\n\n // ===== Recovery =====\n\n /**\n * Restore active tasks from storage (call on service startup)\n * Re-schedules all pending tasks with their remaining time\n * Re-schedules all cron tasks for their next run\n * @returns Number of tasks restored\n */\n restore(): Promise<number>;\n\n // ===== Storage =====\n\n /**\n * Set the storage backend\n */\n setStorage(storage: ScheduleStorage): void;\n\n /**\n * Get current storage backend\n */\n getStorage(): ScheduleStorage | null;\n}\n\n/**\n * Schedule Lattice protocol interface\n */\nexport interface ScheduleLatticeProtocol\n extends BaseLatticeProtocol<ScheduleConfig, ScheduleClient> {\n // Handler registration\n registerHandler: (taskType: string, handler: TaskHandler) => void;\n unregisterHandler: (taskType: string) => boolean;\n hasHandler: (taskType: string) => boolean;\n getHandlerTypes: () => string[];\n\n // One-time task scheduling\n scheduleOnce: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ) => Promise<boolean>;\n\n // Cron task scheduling\n scheduleCron: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ) => Promise<boolean>;\n\n // Task management\n cancel: (taskId: string) => Promise<boolean>;\n pause: (taskId: string) => Promise<boolean>;\n resume: (taskId: string) => Promise<boolean>;\n has: (taskId: string) => Promise<boolean>;\n getTask: (taskId: string) => Promise<ScheduledTaskDefinition | null>;\n getRemainingTime: (taskId: string) => Promise<number>;\n getActiveTaskCount: () => Promise<number>;\n getActiveTaskIds: () => Promise<string[]>;\n cancelAll: () => Promise<void>;\n\n // Recovery\n restore: () => Promise<number>;\n}\n","/**\n * LoggerLatticeProtocol\n *\n * Logger Lattice protocol for logging management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Logger service type enumeration\n */\nexport enum LoggerType {\n PINO = \"pino\",\n CONSOLE = \"console\",\n CUSTOM = \"custom\",\n}\n\n/**\n * Logger context interface\n */\nexport interface LoggerContext {\n \"x-user-id\"?: string;\n \"x-tenant-id\"?: string;\n \"x-request-id\"?: string;\n \"x-task-id\"?: string;\n \"x-thread-id\"?: string;\n [key: string]: any;\n}\n\n/**\n * Pino logger file transport options\n */\nexport interface PinoFileOptions {\n file?: string; // Log file path (e.g., \"./logs/app.log\" or \"./logs/app\")\n frequency?: \"daily\" | \"hourly\" | \"minutely\" | string; // Log rotation frequency\n mkdir?: boolean; // Create directory if not exists\n size?: string; // Max file size (e.g., \"10M\", \"100K\")\n maxFiles?: number; // Maximum number of log files to keep\n}\n\n/**\n * Logger configuration interface\n */\nexport interface LoggerConfig {\n name: string; // Logger name\n description?: string; // Logger description\n type: LoggerType; // Logger service type\n serviceName?: string; // Service name (e.g., \"lattice-gateway\")\n loggerName?: string; // Logger instance name (e.g., \"fastify-server\")\n context?: LoggerContext; // Initial context\n // File logging options (for PINO type)\n file?: string | PinoFileOptions; // Log file path or detailed file options\n // Additional options (e.g., pino config, custom logger settings)\n options?: Record<string, any>;\n}\n\n/**\n * Logger client interface\n */\nexport interface LoggerClient {\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n\n/**\n * Logger Lattice protocol interface\n */\nexport interface LoggerLatticeProtocol\n extends BaseLatticeProtocol<LoggerConfig, LoggerClient> {\n // Logger operations\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n","/**\n * MessageProtocol\n *\n */\n\n\n\n/**\n * Base message interface\n */\nexport interface BaseMessage {\n id: string; // Unique identifier for the message\n role: string; // Role of the sender (user, assistant, system, tool, developer)\n content?: string; // Optional text content of the message\n name?: string; // Optional name of the sender\n}\n\n/**\n * User message interface\n */\nexport interface UserMessage extends BaseMessage {\n role: \"human\";\n content: string; // Text input from the user\n files?: Array<{ name: string; id: string }>; // Optional files attached to the message\n}\n\n/**\n * Tool call interface\n */\nexport interface ToolCall {\n id: string; // Unique identifier for this tool call\n name: string; // Name of the tool/function to call\n args: Record<string, any>; // Arguments as an object\n type: \"tool_call\"; // Type of tool call\n response?: string; // Optional response from the tool execution\n}\n\n/**\n * Assistant message interface\n */\nexport interface AssistantMessage extends BaseMessage {\n role: \"ai\";\n content?: string; // Text response from the assistant (optional if using tool calls)\n tool_calls?: ToolCall[]; // Optional tool calls made by the assistant\n}\n\nexport interface InterruptMessage extends BaseMessage {\n type: \"interrupt\";\n value: any;\n}\n\n/**\n * System message interface\n */\nexport interface SystemMessage extends BaseMessage {\n role: \"system\";\n content: string; // Instructions or context for the assistant\n}\n\n/**\n * Tool message interface\n */\nexport interface ToolMessage extends BaseMessage {\n role: \"tool\";\n content: string; // Result from the tool execution\n tool_call_id: string; // ID of the tool call this message responds to\n}\n\n/**\n * Developer message interface\n */\nexport interface DeveloperMessage extends BaseMessage {\n role: \"developer\";\n content: string; // Content for development or debugging\n}\n\n/**\n * Message chunk type constants\n */\nexport const MessageChunkTypes = {\n HUMAN: 'human',\n AI: 'ai',\n TOOL: 'tool',\n INTERRUPT: 'interrupt',\n MESSAGE_COMPLETED: 'message_completed',\n MESSAGE_FAILED: 'message_failed',\n THREAD_IDLE: 'thread_idle',\n} as const;\n\nexport type MessageChunkType = typeof MessageChunkTypes[keyof typeof MessageChunkTypes];\n\nexport interface MessageChunk {\n type: MessageChunkType;\n data: {\n id: string;\n content?: string;\n tool_call_chunks?: Array<{\n name?: string;\n args?: string;\n id?: string;\n index: number;\n }>;\n tool_calls?: Array<{\n name: string;\n args: Record<string, any>;\n id: string;\n type: string;\n response?: string;\n }>;\n additional_kwargs?: {\n tool_calls?: Array<{\n function?: { name?: string; arguments?: any };\n id?: string;\n }>;\n };\n tool_call_id?: string;\n };\n}\n\n/**\n * Message type union\n */\nexport type Message =\n | UserMessage\n | AssistantMessage\n | SystemMessage\n | ToolMessage\n | DeveloperMessage;\n","/**\n * McpLatticeProtocol\n *\n * Model Context Protocol (MCP) lattice protocol for integrating MCP servers\n * with the Lattice framework. Provides standardized interfaces for MCP\n * client connections, tool discovery, and remote execution.\n */\n\nimport { BaseLatticeProtocol, LatticeMessage } from \"./BaseLatticeProtocol\";\n\n/**\n * MCP transport type\n */\nexport type McpTransportType = \"stdio\" | \"streamable_http\" | \"sse\";\n\n/**\n * MCP server configuration\n */\nexport interface McpServerConfig {\n /** Server name */\n name: string;\n /** Server version */\n version: string;\n /** Transport type */\n transport: McpTransportType;\n /** Command for stdio transport (e.g., \"npx\", \"python\") */\n command?: string;\n /** Arguments for stdio transport */\n args?: string[];\n /** URL for HTTP/SSE transport */\n url?: string;\n /** Environment variables */\n env?: Record<string, string>;\n /** Connection timeout in milliseconds */\n timeout?: number;\n /** Retry attempts on connection failure */\n retryAttempts?: number;\n}\n\n/**\n * MCP tool definition\n */\nexport interface McpTool {\n /** Tool name */\n name: string;\n /** Tool description */\n description: string;\n /** Input schema */\n inputSchema: {\n type: \"object\";\n properties: Record<string, any>;\n required?: string[];\n };\n /** Tool metadata */\n metadata?: Record<string, any>;\n}\n\n/**\n * MCP tool call result\n */\nexport interface McpToolResult {\n /** Whether the call was successful */\n success: boolean;\n /** Result content */\n content: Array<{\n type: \"text\" | \"image\" | \"audio\" | \"resource\";\n data: any;\n mimeType?: string;\n }>;\n /** Error message if failed */\n error?: string;\n /** Execution metadata */\n metadata?: {\n duration: number;\n tokens?: number;\n model?: string;\n };\n}\n\n/**\n * MCP client interface\n */\nexport interface McpClient {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Check if connected\n */\n isConnected(): boolean;\n \n /**\n * List available tools\n */\n listTools(): Promise<McpTool[]>;\n \n /**\n * Call a tool\n */\n callTool(name: string, arguments_: Record<string, any>): Promise<McpToolResult>;\n \n /**\n * Subscribe to server notifications\n */\n subscribe(topic: string, handler: (data: any) => void): void;\n \n /**\n * Unsubscribe from server notifications\n */\n unsubscribe(topic: string): void;\n \n /**\n * Get client statistics\n */\n getStats(): McpStats;\n \n /**\n * Get connection status\n */\n getStatus(): McpConnectionStatus;\n}\n\n/**\n * MCP client options\n */\nexport interface McpClientOptions {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n /** Auto-connect on initialization */\n autoConnect?: boolean;\n /** Error handler */\n onError?: (error: Error) => void;\n /** Connection status handler */\n onStatusChange?: (status: McpConnectionStatus) => void;\n}\n\n/**\n * MCP Lattice protocol interface\n */\nexport interface McpLatticeProtocol\n extends BaseLatticeProtocol<McpServerConfig, McpClient> {\n /**\n * Server configuration\n */\n config: McpServerConfig;\n \n /**\n * MCP client instance\n */\n client: McpClient;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Get available tools\n */\n getTools(): Promise<McpTool[]>;\n \n /**\n * Execute a tool\n */\n executeTool(\n name: string,\n arguments_: Record<string, any>\n ): Promise<McpToolResult>;\n \n /**\n * Execute with automatic retries\n */\n executeToolWithRetry(\n name: string,\n arguments_: Record<string, any>,\n maxRetries?: number\n ): Promise<McpToolResult>;\n \n /**\n * Get protocol version\n */\n getProtocolVersion(): string;\n \n /**\n * Health check\n */\n healthCheck(): Promise<boolean>;\n}\n\n/**\n * MCP message types\n */\nexport enum McpMessageType {\n CONNECT = \"mcp:connect\",\n DISCONNECT = \"mcp:disconnect\",\n LIST_TOOLS = \"mcp:list_tools\",\n CALL_TOOL = \"mcp:call_tool\",\n TOOL_RESULT = \"mcp:tool_result\",\n NOTIFICATION = \"mcp:notification\",\n ERROR = \"mcp:error\",\n HEALTH_CHECK = \"mcp:health_check\",\n}\n\n/**\n * MCP Lattice message\n */\nexport interface McpLatticeMessage extends LatticeMessage {\n type: McpMessageType;\n payload: {\n toolName?: string;\n arguments?: Record<string, any>;\n result?: McpToolResult;\n tools?: McpTool[];\n error?: string;\n };\n}\n\n/**\n * MCP connection status\n */\nexport type McpConnectionStatus =\n | \"disconnected\"\n | \"connecting\"\n | \"connected\"\n | \"reconnecting\"\n | \"error\";\n\n/**\n * MCP statistics\n */\nexport interface McpStats {\n totalCalls: number;\n successfulCalls: number;\n failedCalls: number;\n averageLatency: number;\n lastCallTimestamp: number;\n}\n","/**\n * A2AProtocol - Google Agent-to-Agent Protocol type definitions\n *\n * Based on the A2A open protocol spec for AI agent interoperability.\n * @see https://github.com/google/A2A\n */\n\n// ─── Agent Card ───────────────────────────────────────────────────────────\n\nexport interface A2ASkill {\n id: string;\n name: string;\n description: string;\n tags: string[];\n examples: string[];\n}\n\nexport interface A2ACapabilities {\n streaming: boolean;\n pushNotifications: boolean;\n stateTransitionHistory: boolean;\n}\n\nexport interface A2AProvider {\n organization: string;\n url?: string;\n}\n\nexport interface AgentCard {\n name: string;\n description: string;\n url: string;\n provider: A2AProvider;\n version: string;\n documentationUrl?: string;\n capabilities: A2ACapabilities;\n defaultInputModes: string[];\n defaultOutputModes: string[];\n skills: A2ASkill[];\n}\n\n// ─── Artifact / Part ──────────────────────────────────────────────────────\n\nexport interface A2ATextPart {\n type: \"text\";\n text: string;\n}\n\nexport interface A2AFilePart {\n type: \"file\";\n file: {\n name: string;\n mimeType: string;\n bytes?: string;\n uri?: string;\n };\n}\n\nexport interface A2ADataPart {\n type: \"data\";\n data: Record<string, unknown>;\n}\n\nexport type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;\n\n// ─── Message ──────────────────────────────────────────────────────────────\n\nexport interface A2AMessage {\n role: \"user\" | \"agent\";\n parts: A2APart[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Task ─────────────────────────────────────────────────────────────────\n\nexport type A2ATaskState =\n | \"working\"\n | \"input-required\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"rejected\";\n\nexport interface A2ATaskStatus {\n state: A2ATaskState;\n message?: A2AMessage;\n timestamp: string;\n}\n\nexport interface A2AArtifact {\n name?: string;\n description?: string;\n parts: A2APart[];\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATask {\n id: string;\n sessionId?: string;\n status: A2ATaskStatus;\n artifacts: A2AArtifact[];\n history?: A2AMessage[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Request / Response ───────────────────────────────────────────────────\n\nexport interface A2ATaskSendRequest {\n id?: string;\n sessionId?: string;\n message: A2AMessage;\n pushNotification?: A2APushNotification;\n historyLength?: number;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2APushNotification {\n url: string;\n token?: string;\n}\n\nexport interface A2ATaskUpdatePayload {\n id: string;\n sessionId?: string;\n status: A2ATaskStatus;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATaskArtifactUpdatePayload {\n id: string;\n sessionId?: string;\n artifact: A2AArtifact;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\n// ─── SSE Events ───────────────────────────────────────────────────────────\n\nexport type A2ASSEEvent =\n | { event: \"task\"; data: A2ATaskUpdatePayload }\n | { event: \"status-update\"; data: A2ATaskUpdatePayload }\n | { event: \"artifact-update\"; data: A2ATaskArtifactUpdatePayload }\n | { event: \"error\"; data: { code: string; message: string } };\n\n// ─── Config ───────────────────────────────────────────────────────────────\n\nexport interface A2AConfig {\n agentName: string;\n agentDescription: string;\n agentUrl: string;\n organization: string;\n version?: string;\n capabilities?: Partial<A2ACapabilities>;\n defaultInputModes?: string[];\n defaultOutputModes?: string[];\n skills?: A2ASkill[];\n apiKeyMap: Map<string, A2AApiKeyEntry>;\n}\n\nexport interface A2AApiKeyEntry {\n key: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n}\n\nexport const A2A_DEFAULT_CAPABILITIES: A2ACapabilities = {\n streaming: true,\n pushNotifications: false,\n stateTransitionHistory: false,\n};\n\nexport const A2A_DEFAULT_INPUT_MODES = [\"text\", \"text/plain\"];\nexport const A2A_DEFAULT_OUTPUT_MODES = [\"text\", \"text/plain\", \"text/markdown\"];\n\nexport interface A2AAuthContext {\n authenticated: boolean;\n apiKey?: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n source?: \"bearer\" | \"x-api-key\";\n}\n"],"mappings":";AAaO,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,cAAW;AARD,SAAAA;AAAA,GAAA;AA0NL,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AAiDO,SAAS,uBACd,QACgC;AAChC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,sBACd,QAC+B;AAC/B,SAAO,OAAO,SAAS;AACzB;AA4BO,SAAS,SAAS,QAAqD;AAC5E,SAAO;AACT;AAKO,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,wBACd,QACiC;AACjC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,mBAAmB,QAA+B;AAChE,MAAI,SAAS,MAAM,GAAG;AACpB,WAAO,OAAO,SAAS,CAAC;AAAA,EAC1B;AACA,SAAO,CAAC;AACV;AAKO,SAAS,uBAAuB,QAA+B;AACpE,MAAI,kBAAkB,MAAM,KAAK,wBAAwB,MAAM,GAAG;AAChE,WAAO,OAAO,aAAa,CAAC;AAAA,EAC9B;AACA,SAAO,CAAC;AACV;;;AClWO,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,eAAY;AACZ,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;;;ACAL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,eAAY;AACZ,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AAVC,SAAAA;AAAA,GAAA;;;ACAL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,WAAQ;AAFE,SAAAA;AAAA,GAAA;;;ACEL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,WAAQ;AAHE,SAAAA;AAAA,GAAA;AASL,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAQL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AANC,SAAAA;AAAA,GAAA;;;ACnBL,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACoEL,IAAM,oBAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,aAAa;AACf;;;ACgIO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,iBAAc;AACd,EAAAA,gBAAA,kBAAe;AACf,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,kBAAe;AARL,SAAAA;AAAA,GAAA;;;AChDL,IAAM,2BAA4C;AAAA,EACvD,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,wBAAwB;AAC1B;AAEO,IAAM,0BAA0B,CAAC,QAAQ,YAAY;AACrD,IAAM,2BAA2B,CAAC,QAAQ,cAAc,eAAe;","names":["AgentType","MemoryType","UIComponentType","QueueType","ScheduleType","ScheduleExecutionType","ScheduledTaskStatus","LoggerType","McpMessageType"]}
|
|
1
|
+
{"version":3,"sources":["../src/AgentLatticeProtocol.ts","../src/MemoryLatticeProtocol.ts","../src/UILatticeProtocol.ts","../src/QueueLatticeProtocol.ts","../src/ScheduleLatticeProtocol.ts","../src/LoggerLatticeProtocol.ts","../src/MessageProtocol.ts","../src/McpLatticeProtocol.ts","../src/A2AProtocol.ts"],"sourcesContent":["/**\n * AgentLatticeProtocol\n *\n * 智能体Lattice的协议,定义了智能体的行为和组合方式\n */\n\nimport { CompiledStateGraph } from \"@langchain/langgraph\";\nimport { ZodObject } from \"zod\";\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 智能体类型枚举\n */\nexport enum AgentType {\n REACT = \"react\",\n DEEP_AGENT = \"deep_agent\",\n TEAM = \"team\",\n PROCESSING = \"processing\",\n /** Remote A2A agent — delegates to an external A2A-compatible server */\n A2A_REMOTE = \"a2a_remote\",\n /** Workflow agent — compiled from YAML DSL into a LangGraph StateGraph */\n WORKFLOW = \"workflow\",\n}\n\n/**\n * Runtime configuration that will be injected into LangGraphRunnableConfig.configurable\n * Tools can access these values via config.configurable.runConfig\n */\nexport interface AgentRunConfig {\n /** Database key for SQL tools (registered via sqlDatabaseManager) */\n databaseKey?: string;\n /** Any additional runtime configuration */\n [key: string]: any;\n}\n\n/**\n * Base agent configuration shared by all agent types\n */\ninterface BaseAgentConfig {\n key: string; // Unique key\n name: string; // Name\n description: string; // Description\n prompt: string; // Prompt\n /**\n * Key of the parent agent to inherit configuration from.\n * When set, unspecified fields are inherited from the parent agent's config.\n * Child's explicitly set fields override the parent's.\n */\n extendsAgent?: string;\n schema?: ZodObject<any, any, any, any, any>; // Input validation schema\n modelKey?: string; // Model key to use\n /**\n * Runtime configuration to inject into tool execution context\n * Will be available in tools via config.configurable.runConfig\n */\n runConfig?: AgentRunConfig;\n skillCategories?: string[];\n middleware?: AgentMiddlewareConfig[];\n /**\n * Structured output response format for the agent.\n * Supports Zod schema (z.object({...})), JSON Schema object ({ type: \"object\", properties: {...} }),\n * providerStrategy(), toolStrategy(), and other formats accepted by the underlying model.\n *\n * @example\n * ```ts\n * // Zod schema\n * responseFormat: z.object({ name: z.string(), age: z.number() })\n *\n * // JSON Schema\n * responseFormat: { type: \"object\", properties: { name: { type: \"string\" } }, required: [\"name\"] }\n * ```\n */\n responseFormat?: any;\n}\n\nexport type AvailableModule = \"filesystem\" | \"code_eval\" | \"browser\";\n\nexport interface SandboxMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n modules: AvailableModule[];\n}\n\nexport interface CodeEvalMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n timeout: number;\n memoryLimit: number;\n}\n\nexport interface BrowserMiddlewareConfig {\n vmIsolation: \"agent\" | \"project\" | \"global\";\n headless: boolean;\n}\n\nexport interface SqlMiddlewareConfig {\n databaseKeys?: string[];\n}\n\nexport interface MetricsMiddlewareConfig {\n /** List of configured metrics server keys */\n serverKeys: string[];\n /** Optional descriptions for each server */\n serverDescriptions?: Record<string, string>;\n}\n\nexport interface SchedulerMiddlewareConfig {\n defaultMaxRetries?: number;\n}\n\nexport interface CollectionMiddlewareConfig {\n /** List of configured collection keys */\n collectionKeys: string[];\n /**\n * When true, all collections for the tenant are available.\n * When false or undefined, only collections in collectionKeys are used.\n */\n connectAll?: boolean;\n}\n\nexport type MiddlewareType = \"filesystem\" | \"code_eval\" | \"browser\" | \"sql\" | \"skill\" | \"http\" | \"custom\" | \"metrics\" | \"ask_user_to_clarify\" | \"widget\" | \"claw\" | \"date\" | \"scheduler\" | \"topology\" | \"task\" | \"collection\" | string;\n\nexport interface AgentMiddlewareConfig {\n id: string;\n type: MiddlewareType;\n name: string;\n description: string;\n enabled: boolean;\n /** 可选:限制该中间件暴露的工具列表。不配置则默认暴露所有工具 */\n allowedTools?: string[];\n config: SandboxMiddlewareConfig | CodeEvalMiddlewareConfig | BrowserMiddlewareConfig | SqlMiddlewareConfig | MetricsMiddlewareConfig | ClawMiddlewareConfig | CollectionMiddlewareConfig | SchedulerMiddlewareConfig | Record<string, any>;\n}\n\n/**\n * Bootstrap file configuration\n * Defines default content for project bootstrap files\n */\nexport interface BootstrapFilesConfig {\n /** Default content for AGENTS.md - operating instructions */\n agents?: string;\n /** Default content for SOUL.md - personality and tone */\n soul?: string;\n /** Default content for IDENTITY.md - agent identity */\n identity?: string;\n /** Default content for USER.md - user preferences */\n user?: string;\n /** Default content for TOOLS.md - tool documentation */\n tools?: string;\n /** Default content for BOOTSTRAP.md - first-run tasks */\n bootstrap?: string;\n}\n\n/**\n * Claw Middleware 配置\n * 用于配置 bootstrap 文件管理行为\n */\nexport interface ClawMiddlewareConfig {\n /** 是否启用 bootstrap 文件注入(默认:true) */\n injectBootstrapFiles?: boolean;\n /** 自定义 bootstrap 文件内容 */\n bootstrapFiles?: BootstrapFilesConfig;\n}\n\n\n/**\n * REACT agent configuration\n */\nexport interface ReactAgentConfig extends BaseAgentConfig {\n type: AgentType.REACT;\n tools?: string[]; // Tool list\n}\n\n/**\n * DEEP_AGENT configuration - only this type supports subAgents\n */\nexport interface DeepAgentConfig extends BaseAgentConfig {\n type: AgentType.DEEP_AGENT;\n tools?: string[]; // Tool list\n subAgents?: string[]; // Sub-agent list (unique to DEEP_AGENT)\n internalSubAgents?: AgentConfig[]; // Internal sub-agent list (unique to DEEP_AGENT)\n}\n\n/**\n * PROCESSING agent configuration — workflow orchestration with topology enforcement.\n * Replaces todoListMiddleware with topologyMiddleware.\n */\nexport interface ProcessingAgentConfig extends BaseAgentConfig {\n type: AgentType.PROCESSING;\n tools?: string[];\n subAgents?: string[];\n internalSubAgents?: AgentConfig[];\n}\n\n/**\n * Team teammate configuration -- describes an available teammate.\n */\nexport interface TeamTeammateConfig {\n /** Unique name for this teammate (used as agent ID) */\n name: string;\n /** Role category (e.g. \"research\", \"writing\", \"review\") */\n role: string;\n /** Human-readable description of what this teammate does */\n description: string;\n /** Tool keys this teammate has access to */\n tools?: string[];\n /** Custom system prompt for this teammate */\n prompt?: string;\n /** Model key override for this teammate */\n modelKey?: string;\n}\n\n/**\n * TEAM agent configuration -- a team lead that dynamically creates teammates.\n * Teammates are created on-the-fly from create_team tool input (name, role, description).\n */\nexport interface TeamAgentConfig extends BaseAgentConfig {\n type: AgentType.TEAM;\n /** Tool keys available to the team lead */\n tools?: string[];\n /** Maximum number of teammates running concurrently */\n maxConcurrency?: number;\n /**\n * Schedule lattice key for polling task list / mailbox.\n * When set, teammates use ScheduleLattice for periodic polling instead of event-driven wait.\n */\n scheduleLatticeKey?: string;\n /** Poll interval in ms when using schedule lattice (default: 5000) */\n pollIntervalMs?: number;\n}\n\n/**\n * Type guard to check if config is TeamAgentConfig\n */\nexport function isTeamAgentConfig(\n config: AgentConfig\n): config is TeamAgentConfig {\n return config.type === AgentType.TEAM;\n}\n\n// ─── A2A_REMOTE Agent ──────────────────────────────────────────────────────\n\nexport interface LocalRuntimeConfig {\n label?: string;\n agentCardUrl: string;\n healthUrl?: string;\n command: {\n executable: string;\n args: string[];\n cwd?: string;\n env?: Record<string, string>;\n };\n}\n\n/**\n * A2A_REMOTE agent configuration — wraps a remote A2A-compatible agent endpoint.\n *\n * This agent type wraps a remote A2A endpoint so orchestrators can treat\n * external agents the same as local LangGraph agents.\n */\nexport interface A2ARemoteAgentConfig extends BaseAgentConfig {\n type: AgentType.A2A_REMOTE;\n /**\n * URL of the remote agent's agent card (e.g. http://host:3000/.well-known/agent-card.json).\n * The builder fetches this card to discover the JSON-RPC endpoint.\n */\n agentCardUrl: string;\n /**\n * Optional API key sent as a Bearer token.\n */\n apiKey?: string;\n /**\n * HTTP timeout in milliseconds (default: 300_000 = 5 min).\n */\n timeout?: number;\n projectId?: string;\n /**\n * Optional tool keys (not used by the builder, but included for type compatibility).\n */\n tools?: string[];\n /**\n * Optional local runtime snapshot for Local Managed A2A assistants.\n * When present, the gateway manages a local process for this assistant.\n * Copied from a template or custom form at creation time.\n */\n localRuntime?: LocalRuntimeConfig;\n}\n\nexport type LocalA2AProviderId = string;\n\nexport type LocalA2AProviderStatus =\n | \"missing\"\n | \"disabled\"\n | \"starting\"\n | \"running\"\n | \"stopped\"\n | \"failed\";\n\nexport interface LocalA2AProviderState {\n runtimeId: string;\n label: string;\n status: LocalA2AProviderStatus;\n enabled: boolean;\n assistantId?: string;\n agentCardUrl?: string;\n healthUrl?: string;\n pid?: number;\n message?: string;\n lastStartedAt?: string;\n lastStoppedAt?: string;\n}\n\n/**\n * WORKFLOW agent configuration — compiled from YAML workflow DSL into a LangGraph StateGraph.\n *\n * The workflow field contains the full DSL definition (nodes, edges, state).\n * The WorkflowAgentGraphBuilder compiles this into a multi-node LangGraph\n * where each node invokes a registered sub-agent by ref.\n */\nexport interface WorkflowAgentConfig extends BaseAgentConfig {\n type: AgentType.WORKFLOW;\n /** The YAML workflow DSL definition string (needs+if format) */\n workflowYaml: string;\n /** Optional tool keys */\n tools?: string[];\n}\n\n/**\n * Type guard to check if config is A2ARemoteAgentConfig\n */\nexport function isA2ARemoteAgentConfig(\n config: AgentConfig\n): config is A2ARemoteAgentConfig {\n return config.type === AgentType.A2A_REMOTE;\n}\n\n/**\n * Type guard to check if config is WorkflowAgentConfig\n */\nexport function isWorkflowAgentConfig(\n config: AgentConfig\n): config is WorkflowAgentConfig {\n return config.type === AgentType.WORKFLOW;\n}\n\n/**\n * Agent configuration union type\n * Different agent types have different configuration options\n */\nexport type AgentConfig =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Agent configuration with tools property\n */\nexport type AgentConfigWithTools =\n | ReactAgentConfig\n | DeepAgentConfig\n | TeamAgentConfig\n | ProcessingAgentConfig\n | A2ARemoteAgentConfig\n | WorkflowAgentConfig\n\n/**\n * Type guard to check if config has tools property\n */\nexport function hasTools(config: AgentConfig): config is AgentConfigWithTools {\n return true;\n}\n\n/**\n * Type guard to check if config is DeepAgentConfig (has subAgents)\n */\nexport function isDeepAgentConfig(\n config: AgentConfig\n): config is DeepAgentConfig {\n return config.type === AgentType.DEEP_AGENT;\n}\n\n/**\n * Type guard to check if config is ProcessingAgentConfig (has subAgents + topology)\n */\nexport function isProcessingAgentConfig(\n config: AgentConfig\n): config is ProcessingAgentConfig {\n return config.type === AgentType.PROCESSING;\n}\n\n/**\n * Get tools from config safely\n */\nexport function getToolsFromConfig(config: AgentConfig): string[] {\n if (hasTools(config)) {\n return config.tools || [];\n }\n return [];\n}\n\n/**\n * Get subAgents from config safely (DeepAgentConfig and ProcessingAgentConfig have subAgents)\n */\nexport function getSubAgentsFromConfig(config: AgentConfig): string[] {\n if (isDeepAgentConfig(config) || isProcessingAgentConfig(config)) {\n return config.subAgents || [];\n }\n return [];\n}\n\n/**\n * 智能体客户端类型\n */\nexport type AgentClient = CompiledStateGraph<any, any, any, any, any>;\n\n/**\n * Graph构建选项\n */\nexport interface GraphBuildOptions {\n overrideTools?: string[];\n overrideModel?: string;\n metadata?: Record<string, any>;\n}\n\n/**\n * 智能体Lattice协议接口\n */\nexport interface AgentLatticeProtocol\n extends BaseLatticeProtocol<AgentConfig, AgentClient> {\n // 智能体执行函数\n invoke: (input: any, options?: any) => Promise<any>;\n\n // 构建智能体图\n buildGraph: (options?: GraphBuildOptions) => Promise<AgentClient>;\n}\n","/**\n * MemoryLatticeProtocol\n *\n * 记忆Lattice的协议,用于管理智能体的上下文和记忆\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * 记忆类型枚举\n */\nexport enum MemoryType {\n SHORT_TERM = \"short_term\",\n LONG_TERM = \"long_term\",\n EPISODIC = \"episodic\",\n SEMANTIC = \"semantic\",\n WORKING = \"working\",\n}\n\n/**\n * 记忆配置接口\n */\nexport interface MemoryConfig {\n name: string; // 名称\n description: string; // 描述\n type: MemoryType; // 记忆类型\n ttl?: number; // 生存时间\n capacity?: number; // 容量限制\n}\n\n/**\n * 记忆客户端接口\n */\nexport interface MemoryClient {\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n\n/**\n * 记忆Lattice协议接口\n */\nexport interface MemoryLatticeProtocol\n extends BaseLatticeProtocol<MemoryConfig, MemoryClient> {\n // 记忆操作方法\n add: (key: string, value: any) => Promise<void>;\n get: (key: string) => Promise<any>;\n update: (key: string, value: any) => Promise<void>;\n delete: (key: string) => Promise<void>;\n search: (query: string, options?: any) => Promise<any[]>;\n clear: () => Promise<void>;\n}\n","/**\n * UILatticeProtocol\n *\n * UI Lattice的协议,用于定义用户界面组件\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * UI组件类型枚举\n */\nexport enum UIComponentType {\n CONTAINER = \"container\",\n INPUT = \"input\",\n BUTTON = \"button\",\n LIST = \"list\",\n TABLE = \"table\",\n CHART = \"chart\",\n FORM = \"form\",\n CARD = \"card\",\n MODAL = \"modal\",\n CUSTOM = \"custom\",\n}\n\n/**\n * UI配置接口\n */\nexport interface UIConfig {\n name: string; // 组件名称\n description: string; // 组件描述\n type: UIComponentType; // 组件类型\n props?: Record<string, any>; // 组件属性\n children?: string[]; // 子组件列表\n}\n\n/**\n * UI组件接口\n * 使用泛型以适应不同的UI框架(React, Vue等)\n */\nexport interface UIComponent<T = any> {\n render: (props?: any) => T;\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n\n/**\n * UI Lattice协议接口\n */\nexport interface UILatticeProtocol<T = any>\n extends BaseLatticeProtocol<UIConfig, UIComponent<T>> {\n // UI渲染方法\n render: (props?: any) => T;\n\n // 事件处理\n addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;\n}\n","/**\n * QueueLatticeProtocol\n *\n * Queue Lattice protocol for task queue management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Queue service type enumeration\n */\nexport enum QueueType {\n MEMORY = \"memory\",\n REDIS = \"redis\",\n}\n\n/**\n * Queue configuration interface\n */\nexport interface QueueConfig {\n name: string; // Queue name\n description: string; // Queue description\n type: QueueType; // Queue service type\n queueName?: string; // Specific queue name (e.g., \"tasks\")\n options?: Record<string, any>; // Additional options (e.g., Redis connection options)\n}\n\n/**\n * Queue operation result interface\n */\nexport interface QueueResult<T = any> {\n data: T | null;\n error: any | null;\n}\n\n/**\n * Queue client interface\n */\nexport interface QueueClient {\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n/**\n * Queue Lattice protocol interface\n */\nexport interface QueueLatticeProtocol\n extends BaseLatticeProtocol<QueueConfig, QueueClient> {\n // Queue operations\n push: (item: any) => Promise<QueueResult<number>>;\n pop: () => Promise<QueueResult<any>>;\n createQueue?: () => Promise<{ success: boolean; queue_name?: string; error?: any }>;\n}\n\n\n\n","/**\n * ScheduleLatticeProtocol\n *\n * Schedule Lattice protocol for delayed and recurring task execution management\n * Supports persistence and recovery after service restart\n * Supports both one-time delayed tasks and cron-style recurring tasks\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Schedule service type enumeration\n */\nexport enum ScheduleType {\n MEMORY = \"memory\",\n POSTGRES = \"postgres\",\n REDIS = \"redis\",\n}\n\n/**\n * Schedule execution type - one-time or recurring\n */\nexport enum ScheduleExecutionType {\n ONCE = \"once\", // Execute once at specified time\n CRON = \"cron\", // Recurring based on cron expression\n}\n\n/**\n * Task status enumeration\n */\nexport enum ScheduledTaskStatus {\n PENDING = \"pending\", // Waiting to be executed\n RUNNING = \"running\", // Currently executing\n COMPLETED = \"completed\", // Successfully completed (for ONCE type)\n FAILED = \"failed\", // Execution failed\n CANCELLED = \"cancelled\", // Manually cancelled\n PAUSED = \"paused\", // Paused (for CRON type)\n}\n\n/**\n * Schedule configuration interface\n */\nexport interface ScheduleConfig {\n name: string;\n description: string;\n type: ScheduleType;\n storage?: ScheduleStorage; // Optional storage for persistence\n options?: Record<string, any>;\n}\n\n/**\n * Scheduled task definition - fully serializable\n * Supports both one-time and cron-style recurring tasks\n */\nexport interface ScheduledTaskDefinition {\n taskId: string;\n taskType: string; // Maps to a registered handler\n payload: Record<string, any>; // JSON-serializable data passed to handler\n\n // Context fields for querying\n tenantId: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n\n // Execution configuration\n executionType: ScheduleExecutionType;\n\n // For ONCE type - execute at specific time or after delay\n executeAt?: number; // Timestamp when to execute\n delayMs?: number; // Original delay in milliseconds (for reference)\n\n // For CRON type - recurring schedule\n cronExpression?: string; // Cron format: \"0 9 * * *\" (min hour day month weekday)\n timezone?: string; // Timezone: \"Asia/Shanghai\", defaults to system timezone\n nextRunAt?: number; // Next calculated execution time\n lastRunAt?: number; // Last execution time\n\n // Execution tracking\n status: ScheduledTaskStatus;\n runCount: number; // How many times executed\n maxRuns?: number; // Max executions (null/undefined = infinite for cron, 1 for once)\n\n // Error handling\n retryCount: number; // Current retry count\n maxRetries: number; // Maximum retry attempts\n lastError?: string; // Last error message if failed\n\n // Timestamps\n createdAt: number;\n updatedAt: number;\n expiresAt?: number; // When to stop (for cron, optional)\n\n metadata?: Record<string, any>; // Additional metadata\n}\n\n/**\n * Task handler function type\n */\nexport type TaskHandler = (\n payload: Record<string, any>,\n taskInfo: ScheduledTaskDefinition\n) => void | Promise<void>;\n\n/**\n * Options for scheduling a one-time task\n */\nexport interface ScheduleOnceOptions {\n executeAt?: number; // Absolute timestamp to execute\n delayMs?: number; // OR relative delay from now\n maxRetries?: number; // Max retry attempts (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Options for scheduling a cron task\n */\nexport interface ScheduleCronOptions {\n cronExpression: string; // Cron expression: \"0 9 * * *\"\n timezone?: string; // Timezone: \"Asia/Shanghai\"\n maxRuns?: number; // Max executions (undefined = infinite)\n expiresAt?: number; // Stop after this timestamp\n maxRetries?: number; // Max retry attempts per run (default: 0)\n tenantId?: string; // Tenant isolation\n assistantId?: string; // Which assistant created/owns this task\n threadId?: string; // Which thread this task belongs to\n metadata?: Record<string, any>;\n}\n\n/**\n * Schedule storage interface for persistence\n */\nexport interface ScheduleStorage {\n /**\n * Save a new task\n */\n save(task: ScheduledTaskDefinition): Promise<void>;\n\n /**\n * Get task by ID\n */\n get(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Update task\n */\n update(\n taskId: string,\n updates: Partial<ScheduledTaskDefinition>\n ): Promise<void>;\n\n /**\n * Delete task\n */\n delete(taskId: string): Promise<void>;\n\n /**\n * Get all pending/active tasks (for recovery)\n * Returns tasks with status: PENDING or PAUSED\n */\n getActiveTasks(): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by type\n */\n getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by status\n */\n getTasksByStatus(\n status: ScheduledTaskStatus\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by execution type\n */\n getTasksByExecutionType(\n executionType: ScheduleExecutionType\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by assistant ID\n */\n getTasksByAssistantId(\n assistantId: string\n ): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get tasks by thread ID\n */\n getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Get all tasks (with optional filters)\n */\n getAllTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n limit?: number;\n offset?: number;\n }): Promise<ScheduledTaskDefinition[]>;\n\n /**\n * Count tasks (with optional filters)\n */\n countTasks(filters?: {\n tenantId?: string;\n status?: ScheduledTaskStatus;\n executionType?: ScheduleExecutionType;\n taskType?: string;\n assistantId?: string;\n threadId?: string;\n }): Promise<number>;\n\n /**\n * Delete completed/cancelled tasks older than specified time\n * Useful for cleanup\n */\n deleteOldTasks(olderThanMs: number): Promise<number>;\n}\n\n/**\n * Schedule client interface\n */\nexport interface ScheduleClient {\n // ===== Handler Registration =====\n\n /**\n * Register a handler for a task type\n * Must be called before scheduling tasks of this type\n */\n registerHandler(taskType: string, handler: TaskHandler): void;\n\n /**\n * Unregister a handler\n */\n unregisterHandler(taskType: string): boolean;\n\n /**\n * Check if a handler is registered\n */\n hasHandler(taskType: string): boolean;\n\n /**\n * Get all registered handler types\n */\n getHandlerTypes(): string[];\n\n // ===== One-time Task Scheduling =====\n\n /**\n * Schedule a one-time task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Execution options (executeAt or delayMs required)\n */\n scheduleOnce(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ): Promise<boolean>;\n\n // ===== Cron Task Scheduling =====\n\n /**\n * Schedule a recurring cron task\n * @param taskId - Unique identifier for the task\n * @param taskType - Type of task (must have a registered handler)\n * @param payload - Data to pass to the handler (must be JSON-serializable)\n * @param options - Cron options (cronExpression required)\n */\n scheduleCron(\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ): Promise<boolean>;\n\n // ===== Task Management =====\n\n /**\n * Cancel a scheduled task\n */\n cancel(taskId: string): Promise<boolean>;\n\n /**\n * Pause a cron task (only for CRON type)\n */\n pause(taskId: string): Promise<boolean>;\n\n /**\n * Resume a paused cron task (only for CRON type)\n */\n resume(taskId: string): Promise<boolean>;\n\n /**\n * Check if a task exists\n */\n has(taskId: string): Promise<boolean>;\n\n /**\n * Get task information\n */\n getTask(taskId: string): Promise<ScheduledTaskDefinition | null>;\n\n /**\n * Get remaining time until next execution\n * Returns -1 if task not found or already executed\n */\n getRemainingTime(taskId: string): Promise<number>;\n\n /**\n * Get count of active tasks (pending + paused)\n */\n getActiveTaskCount(): Promise<number>;\n\n /**\n * Get all active task IDs\n */\n getActiveTaskIds(): Promise<string[]>;\n\n /**\n * Cancel all active tasks\n */\n cancelAll(): Promise<void>;\n\n // ===== Recovery =====\n\n /**\n * Restore active tasks from storage (call on service startup)\n * Re-schedules all pending tasks with their remaining time\n * Re-schedules all cron tasks for their next run\n * @returns Number of tasks restored\n */\n restore(): Promise<number>;\n\n // ===== Storage =====\n\n /**\n * Set the storage backend\n */\n setStorage(storage: ScheduleStorage): void;\n\n /**\n * Get current storage backend\n */\n getStorage(): ScheduleStorage | null;\n}\n\n/**\n * Schedule Lattice protocol interface\n */\nexport interface ScheduleLatticeProtocol\n extends BaseLatticeProtocol<ScheduleConfig, ScheduleClient> {\n // Handler registration\n registerHandler: (taskType: string, handler: TaskHandler) => void;\n unregisterHandler: (taskType: string) => boolean;\n hasHandler: (taskType: string) => boolean;\n getHandlerTypes: () => string[];\n\n // One-time task scheduling\n scheduleOnce: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleOnceOptions\n ) => Promise<boolean>;\n\n // Cron task scheduling\n scheduleCron: (\n taskId: string,\n taskType: string,\n payload: Record<string, any>,\n options: ScheduleCronOptions\n ) => Promise<boolean>;\n\n // Task management\n cancel: (taskId: string) => Promise<boolean>;\n pause: (taskId: string) => Promise<boolean>;\n resume: (taskId: string) => Promise<boolean>;\n has: (taskId: string) => Promise<boolean>;\n getTask: (taskId: string) => Promise<ScheduledTaskDefinition | null>;\n getRemainingTime: (taskId: string) => Promise<number>;\n getActiveTaskCount: () => Promise<number>;\n getActiveTaskIds: () => Promise<string[]>;\n cancelAll: () => Promise<void>;\n\n // Recovery\n restore: () => Promise<number>;\n}\n","/**\n * LoggerLatticeProtocol\n *\n * Logger Lattice protocol for logging management\n */\n\nimport { BaseLatticeProtocol } from \"./BaseLatticeProtocol\";\n\n/**\n * Logger service type enumeration\n */\nexport enum LoggerType {\n PINO = \"pino\",\n CONSOLE = \"console\",\n CUSTOM = \"custom\",\n}\n\n/**\n * Logger context interface\n */\nexport interface LoggerContext {\n \"x-user-id\"?: string;\n \"x-tenant-id\"?: string;\n \"x-request-id\"?: string;\n \"x-task-id\"?: string;\n \"x-thread-id\"?: string;\n [key: string]: any;\n}\n\n/**\n * Pino logger file transport options\n */\nexport interface PinoFileOptions {\n file?: string; // Log file path (e.g., \"./logs/app.log\" or \"./logs/app\")\n frequency?: \"daily\" | \"hourly\" | \"minutely\" | string; // Log rotation frequency\n mkdir?: boolean; // Create directory if not exists\n size?: string; // Max file size (e.g., \"10M\", \"100K\")\n maxFiles?: number; // Maximum number of log files to keep\n}\n\n/**\n * Logger configuration interface\n */\nexport interface LoggerConfig {\n name: string; // Logger name\n description?: string; // Logger description\n type: LoggerType; // Logger service type\n serviceName?: string; // Service name (e.g., \"lattice-gateway\")\n loggerName?: string; // Logger instance name (e.g., \"fastify-server\")\n context?: LoggerContext; // Initial context\n // File logging options (for PINO type)\n file?: string | PinoFileOptions; // Log file path or detailed file options\n // Additional options (e.g., pino config, custom logger settings)\n options?: Record<string, any>;\n}\n\n/**\n * Logger client interface\n */\nexport interface LoggerClient {\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n\n/**\n * Logger Lattice protocol interface\n */\nexport interface LoggerLatticeProtocol\n extends BaseLatticeProtocol<LoggerConfig, LoggerClient> {\n // Logger operations\n info: (msg: string, obj?: object) => void;\n error: (msg: string, obj?: object | Error) => void;\n warn: (msg: string, obj?: object) => void;\n debug: (msg: string, obj?: object) => void;\n updateContext?: (context: Partial<LoggerContext>) => void;\n child?: (options: Partial<LoggerConfig>) => LoggerClient;\n}\n","/**\n * MessageProtocol\n *\n */\n\n\n\n/**\n * Base message interface\n */\nexport interface BaseMessage {\n id: string; // Unique identifier for the message\n role: string; // Role of the sender (user, assistant, system, tool, developer)\n content?: string; // Optional text content of the message\n name?: string; // Optional name of the sender\n}\n\n/**\n * User message interface\n */\nexport interface UserMessage extends BaseMessage {\n role: \"human\";\n content: string; // Text input from the user\n files?: Array<{ name: string; id: string }>; // Optional files attached to the message\n}\n\n/**\n * Tool call interface\n */\nexport interface ToolCall {\n id: string; // Unique identifier for this tool call\n name: string; // Name of the tool/function to call\n args: Record<string, any>; // Arguments as an object\n type: \"tool_call\"; // Type of tool call\n response?: string; // Optional response from the tool execution\n}\n\n/**\n * Assistant message interface\n */\nexport interface AssistantMessage extends BaseMessage {\n role: \"ai\";\n content?: string; // Text response from the assistant (optional if using tool calls)\n tool_calls?: ToolCall[]; // Optional tool calls made by the assistant\n}\n\nexport interface InterruptMessage extends BaseMessage {\n type: \"interrupt\";\n value: any;\n}\n\n/**\n * System message interface\n */\nexport interface SystemMessage extends BaseMessage {\n role: \"system\";\n content: string; // Instructions or context for the assistant\n}\n\n/**\n * Tool message interface\n */\nexport interface ToolMessage extends BaseMessage {\n role: \"tool\";\n content: string; // Result from the tool execution\n tool_call_id: string; // ID of the tool call this message responds to\n}\n\n/**\n * Developer message interface\n */\nexport interface DeveloperMessage extends BaseMessage {\n role: \"developer\";\n content: string; // Content for development or debugging\n}\n\n/**\n * Message chunk type constants\n */\nexport const MessageChunkTypes = {\n HUMAN: 'human',\n AI: 'ai',\n TOOL: 'tool',\n INTERRUPT: 'interrupt',\n MESSAGE_COMPLETED: 'message_completed',\n MESSAGE_FAILED: 'message_failed',\n THREAD_IDLE: 'thread_idle',\n} as const;\n\nexport type MessageChunkType = typeof MessageChunkTypes[keyof typeof MessageChunkTypes];\n\nexport interface MessageChunk {\n type: MessageChunkType;\n data: {\n id: string;\n content?: string;\n tool_call_chunks?: Array<{\n name?: string;\n args?: string;\n id?: string;\n index: number;\n }>;\n tool_calls?: Array<{\n name: string;\n args: Record<string, any>;\n id: string;\n type: string;\n response?: string;\n }>;\n additional_kwargs?: {\n tool_calls?: Array<{\n function?: { name?: string; arguments?: any };\n id?: string;\n }>;\n };\n tool_call_id?: string;\n };\n}\n\n/**\n * Message type union\n */\nexport type Message =\n | UserMessage\n | AssistantMessage\n | SystemMessage\n | ToolMessage\n | DeveloperMessage;\n","/**\n * McpLatticeProtocol\n *\n * Model Context Protocol (MCP) lattice protocol for integrating MCP servers\n * with the Lattice framework. Provides standardized interfaces for MCP\n * client connections, tool discovery, and remote execution.\n */\n\nimport { BaseLatticeProtocol, LatticeMessage } from \"./BaseLatticeProtocol\";\n\n/**\n * MCP transport type\n */\nexport type McpTransportType = \"stdio\" | \"streamable_http\" | \"sse\";\n\n/**\n * MCP server configuration\n */\nexport interface McpServerConfig {\n /** Server name */\n name: string;\n /** Server version */\n version: string;\n /** Transport type */\n transport: McpTransportType;\n /** Command for stdio transport (e.g., \"npx\", \"python\") */\n command?: string;\n /** Arguments for stdio transport */\n args?: string[];\n /** URL for HTTP/SSE transport */\n url?: string;\n /** Environment variables */\n env?: Record<string, string>;\n /** Connection timeout in milliseconds */\n timeout?: number;\n /** Retry attempts on connection failure */\n retryAttempts?: number;\n}\n\n/**\n * MCP tool definition\n */\nexport interface McpTool {\n /** Tool name */\n name: string;\n /** Tool description */\n description: string;\n /** Input schema */\n inputSchema: {\n type: \"object\";\n properties: Record<string, any>;\n required?: string[];\n };\n /** Tool metadata */\n metadata?: Record<string, any>;\n}\n\n/**\n * MCP tool call result\n */\nexport interface McpToolResult {\n /** Whether the call was successful */\n success: boolean;\n /** Result content */\n content: Array<{\n type: \"text\" | \"image\" | \"audio\" | \"resource\";\n data: any;\n mimeType?: string;\n }>;\n /** Error message if failed */\n error?: string;\n /** Execution metadata */\n metadata?: {\n duration: number;\n tokens?: number;\n model?: string;\n };\n}\n\n/**\n * MCP client interface\n */\nexport interface McpClient {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Check if connected\n */\n isConnected(): boolean;\n \n /**\n * List available tools\n */\n listTools(): Promise<McpTool[]>;\n \n /**\n * Call a tool\n */\n callTool(name: string, arguments_: Record<string, any>): Promise<McpToolResult>;\n \n /**\n * Subscribe to server notifications\n */\n subscribe(topic: string, handler: (data: any) => void): void;\n \n /**\n * Unsubscribe from server notifications\n */\n unsubscribe(topic: string): void;\n \n /**\n * Get client statistics\n */\n getStats(): McpStats;\n \n /**\n * Get connection status\n */\n getStatus(): McpConnectionStatus;\n}\n\n/**\n * MCP client options\n */\nexport interface McpClientOptions {\n /** Client name */\n name: string;\n /** Client version */\n version: string;\n /** Server configuration */\n serverConfig: McpServerConfig;\n /** Auto-connect on initialization */\n autoConnect?: boolean;\n /** Error handler */\n onError?: (error: Error) => void;\n /** Connection status handler */\n onStatusChange?: (status: McpConnectionStatus) => void;\n}\n\n/**\n * MCP Lattice protocol interface\n */\nexport interface McpLatticeProtocol\n extends BaseLatticeProtocol<McpServerConfig, McpClient> {\n /**\n * Server configuration\n */\n config: McpServerConfig;\n \n /**\n * MCP client instance\n */\n client: McpClient;\n \n /**\n * Connect to MCP server\n */\n connect(): Promise<void>;\n \n /**\n * Disconnect from MCP server\n */\n disconnect(): Promise<void>;\n \n /**\n * Get available tools\n */\n getTools(): Promise<McpTool[]>;\n \n /**\n * Execute a tool\n */\n executeTool(\n name: string,\n arguments_: Record<string, any>\n ): Promise<McpToolResult>;\n \n /**\n * Execute with automatic retries\n */\n executeToolWithRetry(\n name: string,\n arguments_: Record<string, any>,\n maxRetries?: number\n ): Promise<McpToolResult>;\n \n /**\n * Get protocol version\n */\n getProtocolVersion(): string;\n \n /**\n * Health check\n */\n healthCheck(): Promise<boolean>;\n}\n\n/**\n * MCP message types\n */\nexport enum McpMessageType {\n CONNECT = \"mcp:connect\",\n DISCONNECT = \"mcp:disconnect\",\n LIST_TOOLS = \"mcp:list_tools\",\n CALL_TOOL = \"mcp:call_tool\",\n TOOL_RESULT = \"mcp:tool_result\",\n NOTIFICATION = \"mcp:notification\",\n ERROR = \"mcp:error\",\n HEALTH_CHECK = \"mcp:health_check\",\n}\n\n/**\n * MCP Lattice message\n */\nexport interface McpLatticeMessage extends LatticeMessage {\n type: McpMessageType;\n payload: {\n toolName?: string;\n arguments?: Record<string, any>;\n result?: McpToolResult;\n tools?: McpTool[];\n error?: string;\n };\n}\n\n/**\n * MCP connection status\n */\nexport type McpConnectionStatus =\n | \"disconnected\"\n | \"connecting\"\n | \"connected\"\n | \"reconnecting\"\n | \"error\";\n\n/**\n * MCP statistics\n */\nexport interface McpStats {\n totalCalls: number;\n successfulCalls: number;\n failedCalls: number;\n averageLatency: number;\n lastCallTimestamp: number;\n}\n","/**\n * A2AProtocol - Google Agent-to-Agent Protocol type definitions\n *\n * Based on the A2A open protocol spec for AI agent interoperability.\n * @see https://github.com/google/A2A\n */\n\n// ─── Agent Card ───────────────────────────────────────────────────────────\n\nexport interface A2ASkill {\n id: string;\n name: string;\n description: string;\n tags: string[];\n examples: string[];\n}\n\nexport interface A2ACapabilities {\n streaming: boolean;\n pushNotifications: boolean;\n stateTransitionHistory: boolean;\n}\n\nexport interface A2AProvider {\n organization: string;\n url?: string;\n}\n\nexport interface AgentCard {\n name: string;\n description: string;\n url: string;\n provider: A2AProvider;\n version: string;\n documentationUrl?: string;\n capabilities: A2ACapabilities;\n defaultInputModes: string[];\n defaultOutputModes: string[];\n skills: A2ASkill[];\n}\n\n// ─── Artifact / Part ──────────────────────────────────────────────────────\n\nexport interface A2ATextPart {\n type: \"text\";\n text: string;\n}\n\nexport interface A2AFilePart {\n type: \"file\";\n file: {\n name: string;\n mimeType: string;\n bytes?: string;\n uri?: string;\n };\n}\n\nexport interface A2ADataPart {\n type: \"data\";\n data: Record<string, unknown>;\n}\n\nexport type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;\n\n// ─── Message ──────────────────────────────────────────────────────────────\n\nexport interface A2AMessage {\n role: \"user\" | \"agent\";\n parts: A2APart[];\n messageId?: string;\n contextId?: string;\n referenceTaskIds?: string[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Task ─────────────────────────────────────────────────────────────────\n\nexport type A2ATaskState =\n | \"working\"\n | \"input-required\"\n | \"completed\"\n | \"failed\"\n | \"canceled\"\n | \"rejected\";\n\nexport interface A2ATaskStatus {\n state: A2ATaskState;\n message?: A2AMessage;\n timestamp: string;\n}\n\nexport interface A2AArtifact {\n name?: string;\n description?: string;\n parts: A2APart[];\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATask {\n id: string;\n sessionId?: string;\n contextId?: string;\n status: A2ATaskStatus;\n artifacts: A2AArtifact[];\n history?: A2AMessage[];\n metadata?: Record<string, unknown>;\n}\n\n// ─── Request / Response ───────────────────────────────────────────────────\n\nexport interface A2ATaskSendRequest {\n id?: string;\n sessionId?: string;\n message: A2AMessage;\n pushNotification?: A2APushNotification;\n historyLength?: number;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2APushNotification {\n url: string;\n token?: string;\n}\n\nexport interface A2ATaskUpdatePayload {\n id: string;\n sessionId?: string;\n contextId?: string;\n status: A2ATaskStatus;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\nexport interface A2ATaskArtifactUpdatePayload {\n id: string;\n sessionId?: string;\n contextId?: string;\n artifact: A2AArtifact;\n final?: boolean;\n metadata?: Record<string, unknown>;\n}\n\n// ─── SSE Events ───────────────────────────────────────────────────────────\n\nexport type A2ASSEEvent =\n | { event: \"task\"; data: A2ATaskUpdatePayload }\n | { event: \"status-update\"; data: A2ATaskUpdatePayload }\n | { event: \"artifact-update\"; data: A2ATaskArtifactUpdatePayload }\n | { event: \"error\"; data: { code: string; message: string } };\n\n// ─── Config ───────────────────────────────────────────────────────────────\n\nexport interface A2AConfig {\n agentName: string;\n agentDescription: string;\n agentUrl: string;\n organization: string;\n version?: string;\n capabilities?: Partial<A2ACapabilities>;\n defaultInputModes?: string[];\n defaultOutputModes?: string[];\n skills?: A2ASkill[];\n apiKeyMap: Map<string, A2AApiKeyEntry>;\n}\n\nexport interface A2AApiKeyEntry {\n key: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n}\n\nexport const A2A_DEFAULT_CAPABILITIES: A2ACapabilities = {\n streaming: true,\n pushNotifications: false,\n stateTransitionHistory: false,\n};\n\nexport const A2A_DEFAULT_INPUT_MODES = [\"text\", \"text/plain\"];\nexport const A2A_DEFAULT_OUTPUT_MODES = [\"text\", \"text/plain\", \"text/markdown\"];\n\nexport interface A2AAuthContext {\n authenticated: boolean;\n apiKey?: string;\n tenantId?: string;\n projectId?: string;\n workspaceId?: string;\n source?: \"bearer\" | \"x-api-key\";\n}\n"],"mappings":";AAaO,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,WAAQ;AACR,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,gBAAa;AAEb,EAAAA,WAAA,cAAW;AARD,SAAAA;AAAA,GAAA;AA0NL,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AA4FO,SAAS,uBACd,QACgC;AAChC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,sBACd,QAC+B;AAC/B,SAAO,OAAO,SAAS;AACzB;AA4BO,SAAS,SAAS,QAAqD;AAC5E,SAAO;AACT;AAKO,SAAS,kBACd,QAC2B;AAC3B,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,wBACd,QACiC;AACjC,SAAO,OAAO,SAAS;AACzB;AAKO,SAAS,mBAAmB,QAA+B;AAChE,MAAI,SAAS,MAAM,GAAG;AACpB,WAAO,OAAO,SAAS,CAAC;AAAA,EAC1B;AACA,SAAO,CAAC;AACV;AAKO,SAAS,uBAAuB,QAA+B;AACpE,MAAI,kBAAkB,MAAM,KAAK,wBAAwB,MAAM,GAAG;AAChE,WAAO,OAAO,aAAa,CAAC;AAAA,EAC9B;AACA,SAAO,CAAC;AACV;;;AC7YO,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,eAAY;AACZ,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;;;ACAL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,eAAY;AACZ,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,UAAO;AACP,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,YAAS;AAVC,SAAAA;AAAA,GAAA;;;ACAL,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,WAAQ;AAFE,SAAAA;AAAA,GAAA;;;ACEL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,WAAQ;AAHE,SAAAA;AAAA,GAAA;AASL,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAQL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,YAAS;AANC,SAAAA;AAAA,GAAA;;;ACnBL,IAAK,aAAL,kBAAKC,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACoEL,IAAM,oBAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,aAAa;AACf;;;ACgIO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,iBAAc;AACd,EAAAA,gBAAA,kBAAe;AACf,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,kBAAe;AARL,SAAAA;AAAA,GAAA;;;AC1CL,IAAM,2BAA4C;AAAA,EACvD,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,wBAAwB;AAC1B;AAEO,IAAM,0BAA0B,CAAC,QAAQ,YAAY;AACrD,IAAM,2BAA2B,CAAC,QAAQ,cAAc,eAAe;","names":["AgentType","MemoryType","UIComponentType","QueueType","ScheduleType","ScheduleExecutionType","ScheduledTaskStatus","LoggerType","McpMessageType"]}
|
package/package.json
CHANGED
package/src/A2AProtocol.ts
CHANGED
|
@@ -68,6 +68,9 @@ export type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;
|
|
|
68
68
|
export interface A2AMessage {
|
|
69
69
|
role: "user" | "agent";
|
|
70
70
|
parts: A2APart[];
|
|
71
|
+
messageId?: string;
|
|
72
|
+
contextId?: string;
|
|
73
|
+
referenceTaskIds?: string[];
|
|
71
74
|
metadata?: Record<string, unknown>;
|
|
72
75
|
}
|
|
73
76
|
|
|
@@ -97,6 +100,7 @@ export interface A2AArtifact {
|
|
|
97
100
|
export interface A2ATask {
|
|
98
101
|
id: string;
|
|
99
102
|
sessionId?: string;
|
|
103
|
+
contextId?: string;
|
|
100
104
|
status: A2ATaskStatus;
|
|
101
105
|
artifacts: A2AArtifact[];
|
|
102
106
|
history?: A2AMessage[];
|
|
@@ -122,6 +126,7 @@ export interface A2APushNotification {
|
|
|
122
126
|
export interface A2ATaskUpdatePayload {
|
|
123
127
|
id: string;
|
|
124
128
|
sessionId?: string;
|
|
129
|
+
contextId?: string;
|
|
125
130
|
status: A2ATaskStatus;
|
|
126
131
|
final?: boolean;
|
|
127
132
|
metadata?: Record<string, unknown>;
|
|
@@ -130,6 +135,7 @@ export interface A2ATaskUpdatePayload {
|
|
|
130
135
|
export interface A2ATaskArtifactUpdatePayload {
|
|
131
136
|
id: string;
|
|
132
137
|
sessionId?: string;
|
|
138
|
+
contextId?: string;
|
|
133
139
|
artifact: A2AArtifact;
|
|
134
140
|
final?: boolean;
|
|
135
141
|
metadata?: Record<string, unknown>;
|
|
@@ -237,8 +237,20 @@ export function isTeamAgentConfig(
|
|
|
237
237
|
|
|
238
238
|
// ─── A2A_REMOTE Agent ──────────────────────────────────────────────────────
|
|
239
239
|
|
|
240
|
+
export interface LocalRuntimeConfig {
|
|
241
|
+
label?: string;
|
|
242
|
+
agentCardUrl: string;
|
|
243
|
+
healthUrl?: string;
|
|
244
|
+
command: {
|
|
245
|
+
executable: string;
|
|
246
|
+
args: string[];
|
|
247
|
+
cwd?: string;
|
|
248
|
+
env?: Record<string, string>;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
240
252
|
/**
|
|
241
|
-
* A2A_REMOTE agent configuration —
|
|
253
|
+
* A2A_REMOTE agent configuration — wraps a remote A2A-compatible agent endpoint.
|
|
242
254
|
*
|
|
243
255
|
* This agent type wraps a remote A2A endpoint so orchestrators can treat
|
|
244
256
|
* external agents the same as local LangGraph agents.
|
|
@@ -251,17 +263,48 @@ export interface A2ARemoteAgentConfig extends BaseAgentConfig {
|
|
|
251
263
|
*/
|
|
252
264
|
agentCardUrl: string;
|
|
253
265
|
/**
|
|
254
|
-
* Optional API key sent as Bearer token
|
|
266
|
+
* Optional API key sent as a Bearer token.
|
|
255
267
|
*/
|
|
256
268
|
apiKey?: string;
|
|
257
269
|
/**
|
|
258
270
|
* HTTP timeout in milliseconds (default: 300_000 = 5 min).
|
|
259
271
|
*/
|
|
260
272
|
timeout?: number;
|
|
273
|
+
projectId?: string;
|
|
261
274
|
/**
|
|
262
275
|
* Optional tool keys (not used by the builder, but included for type compatibility).
|
|
263
276
|
*/
|
|
264
277
|
tools?: string[];
|
|
278
|
+
/**
|
|
279
|
+
* Optional local runtime snapshot for Local Managed A2A assistants.
|
|
280
|
+
* When present, the gateway manages a local process for this assistant.
|
|
281
|
+
* Copied from a template or custom form at creation time.
|
|
282
|
+
*/
|
|
283
|
+
localRuntime?: LocalRuntimeConfig;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export type LocalA2AProviderId = string;
|
|
287
|
+
|
|
288
|
+
export type LocalA2AProviderStatus =
|
|
289
|
+
| "missing"
|
|
290
|
+
| "disabled"
|
|
291
|
+
| "starting"
|
|
292
|
+
| "running"
|
|
293
|
+
| "stopped"
|
|
294
|
+
| "failed";
|
|
295
|
+
|
|
296
|
+
export interface LocalA2AProviderState {
|
|
297
|
+
runtimeId: string;
|
|
298
|
+
label: string;
|
|
299
|
+
status: LocalA2AProviderStatus;
|
|
300
|
+
enabled: boolean;
|
|
301
|
+
assistantId?: string;
|
|
302
|
+
agentCardUrl?: string;
|
|
303
|
+
healthUrl?: string;
|
|
304
|
+
pid?: number;
|
|
305
|
+
message?: string;
|
|
306
|
+
lastStartedAt?: string;
|
|
307
|
+
lastStoppedAt?: string;
|
|
265
308
|
}
|
|
266
309
|
|
|
267
310
|
/**
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConversationStoreProtocol
|
|
3
|
+
*
|
|
4
|
+
* Application-layer conversation persistence. Maintains mappings from
|
|
5
|
+
* application `conversationId`/`threadId` to A2A task IDs, allowing
|
|
6
|
+
* consumers to reference previous tasks without relying on A2A protocol
|
|
7
|
+
* state for chat memory. A2A handles task routing; conversation memory
|
|
8
|
+
* lives here.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface ConversationRecord {
|
|
12
|
+
conversationId: string;
|
|
13
|
+
tenantId?: string;
|
|
14
|
+
taskIds: string[];
|
|
15
|
+
contextId?: string;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CreateConversationInput {
|
|
22
|
+
conversationId: string;
|
|
23
|
+
tenantId?: string;
|
|
24
|
+
contextId?: string;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface IConversationStore {
|
|
29
|
+
getConversation(conversationId: string): Promise<ConversationRecord | null>;
|
|
30
|
+
|
|
31
|
+
createConversation(input: CreateConversationInput): Promise<ConversationRecord>;
|
|
32
|
+
|
|
33
|
+
addTaskToConversation(conversationId: string, taskId: string): Promise<ConversationRecord>;
|
|
34
|
+
|
|
35
|
+
deleteConversation(conversationId: string): Promise<void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalA2ATemplateConfig
|
|
3
|
+
*
|
|
4
|
+
* Read-only template definitions for Local Managed A2A providers.
|
|
5
|
+
* Templates define command defaults (executable, args, cwd, env)
|
|
6
|
+
* without port or agentCardUrl — those are user-supplied at creation time.
|
|
7
|
+
*
|
|
8
|
+
* Templates are defined in `packages/gateway/src/config/local-a2a-templates.ts`
|
|
9
|
+
* and served via `GET /api/local-a2a/templates`.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { LocalRuntimeConfig } from "./AgentLatticeProtocol";
|
|
13
|
+
|
|
14
|
+
export interface LocalA2ATemplateDefinition {
|
|
15
|
+
key: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
command: LocalRuntimeConfig["command"];
|
|
19
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -40,9 +40,11 @@ export * from "./EvalStoreProtocol";
|
|
|
40
40
|
export * from "./TaskStoreProtocol";
|
|
41
41
|
export * from "./TaskWorkItemProtocol";
|
|
42
42
|
|
|
43
|
+
export * from "./LocalA2ATemplateConfig";
|
|
43
44
|
export * from "./ChannelAdapterProtocol";
|
|
44
45
|
export * from "./A2AProtocol";
|
|
45
46
|
export * from "./A2AApiKeyStoreProtocol";
|
|
47
|
+
export * from "./ConversationStoreProtocol";
|
|
46
48
|
|
|
47
49
|
// Workflow DSL (concise, public API)
|
|
48
50
|
export * from "./WorkflowDSL";
|