@axiom-lattice/protocols 2.1.42 → 2.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -114,70 +114,6 @@ interface ModelLatticeProtocol extends BaseLatticeProtocol<LLMConfig, BaseChatMo
114
114
  bindTools: (tools: any[], options?: any) => any;
115
115
  }
116
116
 
117
- /**
118
- * Workflow DSL
119
- *
120
- * Concise workflow definition language. A step's `id` is its node id, state
121
- * output key, and template reference name. The engine auto-generates nodes,
122
- * edges, and state fields.
123
- *
124
- * Template syntax:
125
- * {{input}} — initial user input
126
- * {{id}} — output of step with given id
127
- * {{item}} — current element in map iterations
128
- */
129
- interface WorkflowDSL {
130
- name: string;
131
- steps: WorkflowStep[];
132
- }
133
- type WorkflowStep = AgentStep | ConditionStep | HumanStep | MapStep | ParallelStep | EndStep;
134
- /** invoke the workflow's built-in agent. type defaults to "agent". */
135
- interface AgentStep {
136
- id?: string;
137
- type?: "agent";
138
- name?: string;
139
- prompt: string;
140
- schema?: Record<string, unknown>;
141
- }
142
- /** branch on state field or expression. */
143
- interface ConditionStep {
144
- id?: string;
145
- type: "condition";
146
- if: string;
147
- then?: WorkflowStep[] | WorkflowStep;
148
- else?: WorkflowStep[] | WorkflowStep;
149
- branches?: Record<string, WorkflowStep[] | WorkflowStep>;
150
- }
151
- /** pause for human input. */
152
- interface HumanStep {
153
- id?: string;
154
- type: "human";
155
- prompt: string;
156
- title?: string;
157
- schema?: Record<string, unknown>;
158
- }
159
- /** iterate over an array, optionally reducing. */
160
- interface MapStep {
161
- id: string;
162
- type: "map";
163
- source: string;
164
- each: AgentStep;
165
- reduce?: AgentStep;
166
- batch?: number;
167
- concurrency?: number;
168
- }
169
- /** run steps in parallel, then rejoin. */
170
- interface ParallelStep {
171
- id?: string;
172
- type: "parallel";
173
- steps: WorkflowStep[];
174
- }
175
- /** terminal state. */
176
- interface EndStep {
177
- type: "end";
178
- status?: "success" | "failed";
179
- }
180
-
181
117
  /**
182
118
  * AgentLatticeProtocol
183
119
  *
@@ -194,7 +130,7 @@ declare enum AgentType {
194
130
  PROCESSING = "processing",
195
131
  /** Remote A2A agent — delegates to an external A2A-compatible server */
196
132
  A2A_REMOTE = "a2a_remote",
197
- /** Workflow agent — compiled from JSON DSL into a LangGraph StateGraph */
133
+ /** Workflow agent — compiled from YAML DSL into a LangGraph StateGraph */
198
134
  WORKFLOW = "workflow"
199
135
  }
200
136
  /**
@@ -272,7 +208,7 @@ interface MetricsMiddlewareConfig {
272
208
  interface SchedulerMiddlewareConfig {
273
209
  defaultMaxRetries?: number;
274
210
  }
275
- type MiddlewareType = "filesystem" | "code_eval" | "browser" | "sql" | "skill" | "http" | "custom" | "metrics" | "ask_user_to_clarify" | "widget" | "claw" | "date" | "scheduler" | "topology";
211
+ type MiddlewareType = "filesystem" | "code_eval" | "browser" | "sql" | "skill" | "http" | "custom" | "metrics" | "ask_user_to_clarify" | "widget" | "claw" | "date" | "scheduler" | "topology" | "task";
276
212
  interface AgentMiddlewareConfig {
277
213
  id: string;
278
214
  type: MiddlewareType;
@@ -401,7 +337,7 @@ interface A2ARemoteAgentConfig extends BaseAgentConfig {
401
337
  tools?: string[];
402
338
  }
403
339
  /**
404
- * WORKFLOW agent configuration — compiled from JSON DSL into a LangGraph StateGraph.
340
+ * WORKFLOW agent configuration — compiled from YAML workflow DSL into a LangGraph StateGraph.
405
341
  *
406
342
  * The workflow field contains the full DSL definition (nodes, edges, state).
407
343
  * The WorkflowAgentGraphBuilder compiles this into a multi-node LangGraph
@@ -409,9 +345,9 @@ interface A2ARemoteAgentConfig extends BaseAgentConfig {
409
345
  */
410
346
  interface WorkflowAgentConfig extends BaseAgentConfig {
411
347
  type: AgentType.WORKFLOW;
412
- /** The Workflow DSL definition */
413
- workflow: WorkflowDSL;
414
- /** Optional tool keys (not used by workflow graph directly, but included for type compatibility) */
348
+ /** The YAML workflow DSL definition string (needs+if format) */
349
+ workflowYaml: string;
350
+ /** Optional tool keys */
415
351
  tools?: string[];
416
352
  }
417
353
  /**
@@ -557,16 +493,16 @@ interface UIConfig {
557
493
  */
558
494
  interface UIComponent<T = any> {
559
495
  render: (props?: any) => T;
560
- addEventListener: (event: string, handler: Function) => void;
561
- removeEventListener: (event: string, handler: Function) => void;
496
+ addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;
497
+ removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;
562
498
  }
563
499
  /**
564
500
  * UI Lattice协议接口
565
501
  */
566
502
  interface UILatticeProtocol<T = any> extends BaseLatticeProtocol<UIConfig, UIComponent<T>> {
567
503
  render: (props?: any) => T;
568
- addEventListener: (event: string, handler: Function) => void;
569
- removeEventListener: (event: string, handler: Function) => void;
504
+ addEventListener: (event: string, handler: (...args: unknown[]) => void) => void;
505
+ removeEventListener: (event: string, handler: (...args: unknown[]) => void) => void;
570
506
  }
571
507
 
572
508
  /**
@@ -1281,6 +1217,11 @@ interface Assistant {
1281
1217
  * Assistant description
1282
1218
  */
1283
1219
  description?: string;
1220
+ /**
1221
+ * Owner user ID — when set, this assistant is a personal assistant
1222
+ * owned by the given user. NULL for shared/tenant agents.
1223
+ */
1224
+ ownerUserId?: string;
1284
1225
  /**
1285
1226
  * Graph definition for the assistant
1286
1227
  */
@@ -1306,6 +1247,10 @@ interface CreateAssistantRequest {
1306
1247
  * Assistant description
1307
1248
  */
1308
1249
  description?: string;
1250
+ /**
1251
+ * Owner user ID for personal assistants
1252
+ */
1253
+ ownerUserId?: string;
1309
1254
  /**
1310
1255
  * Graph definition for the assistant
1311
1256
  */
@@ -1359,6 +1304,13 @@ interface AssistantStore {
1359
1304
  * @returns true if assistant exists, false otherwise
1360
1305
  */
1361
1306
  hasAssistant(tenantId: string, id: string): Promise<boolean>;
1307
+ /**
1308
+ * Get personal assistant by owner user ID
1309
+ * @param tenantId Tenant identifier
1310
+ * @param userId Owner user identifier
1311
+ * @returns Assistant if found, null otherwise
1312
+ */
1313
+ getByOwner(tenantId: string, userId: string): Promise<Assistant | null>;
1362
1314
  }
1363
1315
 
1364
1316
  /**
@@ -2194,6 +2146,11 @@ interface UpdateChannelInstallationRequest {
2194
2146
  interface ChannelInstallationStore {
2195
2147
  getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
2196
2148
  getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
2149
+ /**
2150
+ * 返回所有租户下指定 channel 类型的安装(跨租户查询)。
2151
+ * 用于 connectAllChannels 等不需要按租户过滤的场景。
2152
+ */
2153
+ getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
2197
2154
  createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
2198
2155
  updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
2199
2156
  deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
@@ -2939,13 +2896,15 @@ interface WorkflowRun {
2939
2896
  updatedAt: Date;
2940
2897
  }
2941
2898
  type StepType = 'task_delegation' | 'tool_call' | 'human_in_loop' | 'topology_transition' | 'agent' | 'human_feedback' | 'map' | 'input' | 'terminal';
2942
- type StepStatus = 'running' | 'completed' | 'failed' | 'interrupted';
2899
+ type StepStatus = 'running' | 'completed' | 'failed' | 'interrupted' | 'skipped';
2943
2900
  interface RunStep {
2944
2901
  id: string;
2945
2902
  runId: string;
2946
2903
  tenantId: string;
2947
2904
  stepType: StepType;
2948
2905
  stepName: string;
2906
+ /** Sub-agent thread_id for agent/map steps. null for input/terminal. */
2907
+ threadId?: string | null;
2949
2908
  edgeFrom?: string;
2950
2909
  edgeTo?: string;
2951
2910
  edgePurpose?: string;
@@ -2978,6 +2937,7 @@ interface CreateRunStepRequest {
2978
2937
  tenantId: string;
2979
2938
  stepType: StepType;
2980
2939
  stepName: string;
2940
+ threadId?: string | null;
2981
2941
  edgeFrom?: string;
2982
2942
  edgeTo?: string;
2983
2943
  edgePurpose?: string;
@@ -3064,6 +3024,72 @@ interface BindingRegistry {
3064
3024
  }): Promise<Binding[]>;
3065
3025
  }
3066
3026
 
3027
+ /**
3028
+ * MenuProtocol
3029
+ *
3030
+ * Defines types and registry interface for per-tenant customizable menu items.
3031
+ * Menu items are merged with built-in defaults at the React SDK layer.
3032
+ */
3033
+ type MenuTarget = 'sidebar' | 'workspace';
3034
+ type MenuContentType = 'agent' | 'html' | 'custom';
3035
+ interface AgentMenuConfig {
3036
+ agentId: string;
3037
+ workspaceId?: string;
3038
+ projectId?: string;
3039
+ }
3040
+ interface HtmlMenuConfig {
3041
+ url: string;
3042
+ params?: Record<string, string>;
3043
+ title?: string;
3044
+ }
3045
+ interface CustomMenuConfig {
3046
+ componentKey: string;
3047
+ }
3048
+ type MenuContentConfig = AgentMenuConfig | HtmlMenuConfig | CustomMenuConfig;
3049
+ interface MenuItem {
3050
+ id: string;
3051
+ tenantId: string;
3052
+ menuTarget: MenuTarget;
3053
+ group?: string;
3054
+ name: string;
3055
+ icon?: string;
3056
+ sortOrder: number;
3057
+ contentType: MenuContentType;
3058
+ contentConfig: MenuContentConfig;
3059
+ enabled: boolean;
3060
+ createdAt: Date;
3061
+ updatedAt: Date;
3062
+ }
3063
+ interface CreateMenuItemInput {
3064
+ menuTarget: MenuTarget;
3065
+ group?: string;
3066
+ name: string;
3067
+ icon?: string;
3068
+ sortOrder?: number;
3069
+ contentType: MenuContentType;
3070
+ contentConfig: MenuContentConfig;
3071
+ }
3072
+ interface UpdateMenuItemInput {
3073
+ group?: string;
3074
+ name?: string;
3075
+ icon?: string;
3076
+ sortOrder?: number;
3077
+ contentConfig?: MenuContentConfig;
3078
+ enabled?: boolean;
3079
+ }
3080
+ interface MenuRegistry {
3081
+ list(params: {
3082
+ tenantId: string;
3083
+ menuTarget?: MenuTarget;
3084
+ }): Promise<MenuItem[]>;
3085
+ getById(id: string): Promise<MenuItem | null>;
3086
+ create(input: CreateMenuItemInput & {
3087
+ tenantId: string;
3088
+ }): Promise<MenuItem>;
3089
+ update(id: string, patch: UpdateMenuItemInput): Promise<MenuItem>;
3090
+ delete(id: string): Promise<void>;
3091
+ }
3092
+
3067
3093
  interface EvalProject {
3068
3094
  id: string;
3069
3095
  tenantId: string;
@@ -3225,6 +3251,265 @@ interface EvalStore {
3225
3251
  getProjectReport(tenantId: string, projectId: string): Promise<EvalProjectReport | null>;
3226
3252
  }
3227
3253
 
3254
+ /**
3255
+ * TaskStoreProtocol
3256
+ *
3257
+ * Task store protocol definitions for the Axiom Lattice framework.
3258
+ * Provides standardized interfaces for task management across all implementations.
3259
+ */
3260
+ /**
3261
+ * TaskItem — unified task model for users and agents.
3262
+ */
3263
+ interface TaskItem {
3264
+ /**
3265
+ * Task identifier
3266
+ */
3267
+ id: string;
3268
+ /**
3269
+ * Tenant identifier
3270
+ */
3271
+ tenantId: string;
3272
+ /**
3273
+ * Owner type — either a user or an agent
3274
+ */
3275
+ ownerType: 'user' | 'agent';
3276
+ /**
3277
+ * Owner identifier
3278
+ */
3279
+ ownerId: string;
3280
+ /**
3281
+ * Task title
3282
+ */
3283
+ title: string;
3284
+ /**
3285
+ * Task description
3286
+ */
3287
+ description?: string;
3288
+ /**
3289
+ * Task status
3290
+ */
3291
+ status: 'pending' | 'in_progress' | 'completed' | 'cancelled';
3292
+ /**
3293
+ * Task priority level
3294
+ */
3295
+ priority: 'low' | 'medium' | 'high';
3296
+ /**
3297
+ * Optional due date as ISO string
3298
+ */
3299
+ dueDate?: string;
3300
+ /**
3301
+ * Arbitrary metadata key-value pairs
3302
+ */
3303
+ metadata?: Record<string, unknown>;
3304
+ /**
3305
+ * Parent task ID for hierarchical tasks
3306
+ */
3307
+ parentId?: string;
3308
+ /**
3309
+ * Source system identifier for external task tracking
3310
+ */
3311
+ sourceId?: string;
3312
+ /**
3313
+ * Additional contextual data
3314
+ */
3315
+ context?: Record<string, unknown>;
3316
+ /**
3317
+ * Task creation timestamp
3318
+ */
3319
+ createdAt: Date;
3320
+ /**
3321
+ * Task last update timestamp
3322
+ */
3323
+ updatedAt: Date;
3324
+ }
3325
+ /**
3326
+ * Create task request type
3327
+ */
3328
+ interface CreateTaskRequest {
3329
+ /**
3330
+ * Task title
3331
+ */
3332
+ title: string;
3333
+ /**
3334
+ * Task description
3335
+ */
3336
+ description?: string;
3337
+ /**
3338
+ * Task status — defaults to 'pending' if not provided
3339
+ */
3340
+ status?: 'pending' | 'in_progress' | 'completed' | 'cancelled';
3341
+ /**
3342
+ * Task priority level — defaults to 'medium' if not provided
3343
+ */
3344
+ priority?: 'low' | 'medium' | 'high';
3345
+ /**
3346
+ * Optional due date as ISO string
3347
+ */
3348
+ dueDate?: string;
3349
+ /**
3350
+ * Arbitrary metadata key-value pairs
3351
+ */
3352
+ metadata?: Record<string, unknown>;
3353
+ /**
3354
+ * Parent task ID for hierarchical tasks
3355
+ */
3356
+ parentId?: string;
3357
+ /**
3358
+ * Source system identifier for external task tracking
3359
+ */
3360
+ sourceId?: string;
3361
+ /**
3362
+ * Additional contextual data
3363
+ */
3364
+ context?: Record<string, unknown>;
3365
+ /**
3366
+ * Owner type — defaults based on context if not provided
3367
+ */
3368
+ ownerType?: 'user' | 'agent';
3369
+ /**
3370
+ * Owner identifier — defaults based on context if not provided
3371
+ */
3372
+ ownerId?: string;
3373
+ }
3374
+ /**
3375
+ * Update task request type
3376
+ */
3377
+ interface UpdateTaskRequest {
3378
+ /**
3379
+ * Task title
3380
+ */
3381
+ title?: string;
3382
+ /**
3383
+ * Task description
3384
+ */
3385
+ description?: string;
3386
+ /**
3387
+ * Task status
3388
+ */
3389
+ status?: 'pending' | 'in_progress' | 'completed' | 'cancelled';
3390
+ /**
3391
+ * Task priority level
3392
+ */
3393
+ priority?: 'low' | 'medium' | 'high';
3394
+ /**
3395
+ * Optional due date as ISO string
3396
+ */
3397
+ dueDate?: string;
3398
+ /**
3399
+ * Arbitrary metadata key-value pairs
3400
+ */
3401
+ metadata?: Record<string, unknown>;
3402
+ /**
3403
+ * Parent task ID for hierarchical tasks
3404
+ */
3405
+ parentId?: string;
3406
+ /**
3407
+ * Source system identifier for external task tracking
3408
+ */
3409
+ sourceId?: string;
3410
+ /**
3411
+ * Additional contextual data
3412
+ */
3413
+ context?: Record<string, unknown>;
3414
+ /**
3415
+ * Owner type
3416
+ */
3417
+ ownerType?: 'user' | 'agent';
3418
+ /**
3419
+ * Owner identifier
3420
+ */
3421
+ ownerId?: string;
3422
+ }
3423
+ /**
3424
+ * Task list filter criteria
3425
+ */
3426
+ interface TaskListFilter {
3427
+ /**
3428
+ * Tenant identifier (required)
3429
+ */
3430
+ tenantId: string;
3431
+ /**
3432
+ * Filter by owner type
3433
+ */
3434
+ ownerType?: 'user' | 'agent';
3435
+ /**
3436
+ * Filter by owner ID
3437
+ */
3438
+ ownerId?: string;
3439
+ /**
3440
+ * Filter by task status
3441
+ */
3442
+ status?: string;
3443
+ /**
3444
+ * Filter by priority level
3445
+ */
3446
+ priority?: string;
3447
+ /**
3448
+ * Filter by parent task ID
3449
+ */
3450
+ parentId?: string;
3451
+ /**
3452
+ * Filter by source system ID
3453
+ */
3454
+ sourceId?: string;
3455
+ /**
3456
+ * Filter by metadata key-value pairs
3457
+ */
3458
+ metadata?: Record<string, unknown>;
3459
+ /**
3460
+ * Maximum number of results to return
3461
+ */
3462
+ limit?: number;
3463
+ /**
3464
+ * Number of results to skip for pagination
3465
+ */
3466
+ offset?: number;
3467
+ }
3468
+ /**
3469
+ * TaskStore interface
3470
+ * Provides CRUD operations for task data
3471
+ */
3472
+ interface TaskStore {
3473
+ /**
3474
+ * Create a new task
3475
+ * @param params Task creation data including tenant, ownerType ('user' | 'agent'), and owner info
3476
+ * @returns Created task
3477
+ */
3478
+ create(params: CreateTaskRequest & {
3479
+ tenantId: string;
3480
+ ownerType: string;
3481
+ ownerId: string;
3482
+ }): Promise<TaskItem>;
3483
+ /**
3484
+ * Get a task by ID
3485
+ * @param tenantId Tenant identifier
3486
+ * @param id Task identifier
3487
+ * @returns Task if found, null otherwise
3488
+ */
3489
+ getById(tenantId: string, id: string): Promise<TaskItem | null>;
3490
+ /**
3491
+ * List tasks matching the given filter
3492
+ * @param filter Filter criteria
3493
+ * @returns Array of matching tasks
3494
+ */
3495
+ list(filter: TaskListFilter): Promise<TaskItem[]>;
3496
+ /**
3497
+ * Update an existing task
3498
+ * @param tenantId Tenant identifier
3499
+ * @param id Task identifier
3500
+ * @param updates Partial task data to update
3501
+ * @returns Updated task if found, null otherwise
3502
+ */
3503
+ update(tenantId: string, id: string, updates: UpdateTaskRequest): Promise<TaskItem | null>;
3504
+ /**
3505
+ * Delete a task by ID
3506
+ * @param tenantId Tenant identifier
3507
+ * @param id Task identifier
3508
+ * @returns true if deleted, false otherwise
3509
+ */
3510
+ delete(tenantId: string, id: string): Promise<boolean>;
3511
+ }
3512
+
3228
3513
  /**
3229
3514
  * ChannelAdapterProtocol
3230
3515
  */
@@ -3283,6 +3568,20 @@ interface ChannelAdapter<TConfig = unknown> {
3283
3568
  readonly configSchema: z.ZodSchema<TConfig>;
3284
3569
  receive(rawPayload: unknown, installation: ChannelInstallation): Promise<InboundMessage | null>;
3285
3570
  sendReply(replyTarget: ReplyTarget, message: OutboundMessage, installation: ChannelInstallation): Promise<void>;
3571
+ /**
3572
+ * 可选:Channel 自定义 thread ID 生成策略。
3573
+ * 如果提供,MessageRouter 会优先使用此方法决定 thread ID,
3574
+ * 替代默认的 binding.threadMode(fixed / per_conversation)。
3575
+ *
3576
+ * 返回的 thread ID 会持久化到 binding 中,以便后续消息复用。
3577
+ */
3578
+ resolveThreadId?(message: InboundMessage, binding: unknown): Promise<string> | string;
3579
+ /**
3580
+ * 可选:建立持久连接并开始接收事件。
3581
+ * adapter 自己负责连接管理、事件处理、消息分发。
3582
+ * `deps` 由调用方传入,通常包含 MessageRouter。
3583
+ */
3584
+ connect?(installation: ChannelInstallation<TConfig>, deps?: unknown): Promise<void>;
3286
3585
  }
3287
3586
 
3288
3587
  /**
@@ -3480,11 +3779,71 @@ interface A2AApiKeyStore {
3480
3779
  loadIntoMap(): Promise<Map<string, A2AApiKeyEntry>>;
3481
3780
  }
3482
3781
 
3782
+ /**
3783
+ * YAML Workflow DSL — linear model with parallel blocks
3784
+ *
3785
+ * Steps execute top-to-bottom. `parallel:` blocks declare concurrency.
3786
+ * `if` on any step skips it. `map` iterates over arrays.
3787
+ * No `needs` — execution order = reading order.
3788
+ *
3789
+ * Template syntax:
3790
+ * {{input}} — initial user input
3791
+ * {{label}} — output of step with given label
3792
+ * {{label.field}} — nested field access on structured output
3793
+ * {{item}} — current element in map iterations
3794
+ */
3795
+ interface YamlWorkflow {
3796
+ /** Optional workflow name — defaults to "workflow" if omitted. */
3797
+ name?: string;
3798
+ steps: YamlTopLevelStep[];
3799
+ }
3800
+ type YamlTopLevelStep = YamlAgentStep | YamlParallelBlock | YamlMapStep;
3801
+ interface YamlAgentStep {
3802
+ /** Unique label serving as state key and template reference. */
3803
+ label: string;
3804
+ /** JS expression evaluated as boolean. Step skipped when falsy. */
3805
+ if?: string;
3806
+ /** Agent instruction with {{template}} references. */
3807
+ prompt: string;
3808
+ /** Shorthand output schema: { field: "string" | "number" | "boolean" } */
3809
+ output?: Record<string, unknown>;
3810
+ /** When true, inject ask_user_to_clarify middleware. */
3811
+ ask?: boolean;
3812
+ }
3813
+ interface YamlParallelBlock {
3814
+ parallel: YamlAgentStep[];
3815
+ /** JS expression evaluated as boolean. Entire block skipped when falsy. */
3816
+ if?: string;
3817
+ /** Shorthand output schema for aggregated results. */
3818
+ output?: Record<string, unknown>;
3819
+ }
3820
+ interface YamlMapStep {
3821
+ map: {
3822
+ /** Path to source array (e.g. "extract.items"). */
3823
+ source: string;
3824
+ /** Step label for referencing in templates (e.g. {{label}}). */
3825
+ label: string;
3826
+ /** JS expression evaluated as boolean. Entire map skipped when falsy. */
3827
+ if?: string;
3828
+ /** Agent applied to each element. Use {{item}} for current element. */
3829
+ each: {
3830
+ prompt: string;
3831
+ output?: Record<string, unknown>;
3832
+ };
3833
+ /** Shorthand output schema for the aggregated results. */
3834
+ output?: Record<string, unknown>;
3835
+ /** Items per batch (default 50). */
3836
+ batch?: number;
3837
+ /** Max parallel items (default 5). */
3838
+ concurrency?: number;
3839
+ };
3840
+ }
3841
+
3483
3842
  /**
3484
3843
  * Internal DSL — expanded intermediate representation.
3485
3844
  *
3486
- * Generated by the WorkflowDSL expander. Consumed by compileWorkflow.
3487
- * Not part of the public API — use WorkflowDSL (concise) instead.
3845
+ * Generated by parseYaml() from the YAML workflow DSL. Consumed by compileWorkflow.
3846
+ * Not part of the public API.
3488
3847
  */
3489
3848
  interface InternalDSL {
3490
3849
  version: "1.0";
@@ -3502,10 +3861,10 @@ interface InternalStateField {
3502
3861
  default?: unknown;
3503
3862
  reducer?: "replace" | "append" | "merge";
3504
3863
  }
3505
- type InternalNode = InternalAgentNode | InternalHumanFeedbackNode | InternalMapNode | InternalTerminalNode | InternalInputNode;
3864
+ type InternalNode = InternalAgentNode | InternalMapNode | InternalTerminalNode | InternalInputNode;
3506
3865
  interface InternalBaseNode {
3507
3866
  id: string;
3508
- type: "agent" | "human_feedback" | "map" | "terminal" | "input";
3867
+ type: "agent" | "map" | "terminal" | "input";
3509
3868
  name: string;
3510
3869
  description?: string;
3511
3870
  config?: InternalNodeConfig;
@@ -3515,17 +3874,19 @@ interface InternalBaseNode {
3515
3874
  interface InternalAgentNode extends InternalBaseNode {
3516
3875
  type: "agent";
3517
3876
  ref?: string;
3518
- }
3519
- interface InternalHumanFeedbackNode extends InternalBaseNode {
3520
- type: "human_feedback";
3521
- config: InternalNodeConfig & {
3522
- title?: string;
3523
- };
3877
+ /** When true, the agent loads ask_user_to_clarify middleware. */
3878
+ ask?: boolean;
3879
+ /** Runtime condition expression evaluated as JS. Step skipped when false. */
3880
+ condition?: string;
3881
+ /** Parallel group ID — children in the same group run concurrently. */
3882
+ parallelGroup?: string;
3524
3883
  }
3525
3884
  interface InternalMapNode extends InternalBaseNode {
3526
3885
  type: "map";
3527
3886
  source: string;
3528
3887
  itemKey?: string;
3888
+ /** Runtime condition expression evaluated as JS. Map skipped when false. */
3889
+ condition?: string;
3529
3890
  config?: InternalNodeConfig & {
3530
3891
  batchSize?: number;
3531
3892
  maxConcurrency?: number;
@@ -3562,15 +3923,6 @@ interface InternalOutput {
3562
3923
  interface InternalEdge {
3563
3924
  from: string;
3564
3925
  to?: string | string[];
3565
- type?: "normal" | "conditional";
3566
- name?: string;
3567
- rule?: InternalEdgeRule;
3568
- }
3569
- interface InternalEdgeRule {
3570
- type: "state_field" | "expression";
3571
- field?: string;
3572
- code?: string;
3573
- mapping: Record<string, string>;
3574
3926
  }
3575
3927
  interface InternalNodeConfig {
3576
3928
  timeout?: number;
@@ -3641,4 +3993,4 @@ type Timestamp = number;
3641
3993
  */
3642
3994
  type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
3643
3995
 
3644
- 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 AgentMiddlewareConfig, type AgentRunConfig, type AgentStep, 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 ConditionStep, type CreateA2AApiKeyInput, type CreateAssistantRequest, type CreateBindingInput, type CreateChannelInstallationRequest, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateSkillRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, type CreateWorkflowRunRequest, type CreateWorkspaceRequest, type DataSource, type DatabaseConfig, type DatabaseConfigEntry, type DatabaseConfigStore, type DatabaseType, type DeepAgentConfig, type DeveloperMessage, type DispatchResult, type EmbeddingsConfig, type EmbeddingsLatticeProtocol, type EndStep, type EvalCase, type EvalProject, type EvalProjectReport, type EvalRun, type EvalRunResult, type EvalStore, type EvalSuite, type ExecuteSqlQueryRequest, type ExecuteSqlQueryResponse, type FilterCondition, type GraphBuildOptions, type HumanStep, type ID, type InboundMessage, type InternalAgentNode, type InternalBaseNode, type InternalDSL, type InternalEdge, type InternalEdgeRule, type InternalHumanFeedbackNode, 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 MapStep, 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 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 ParallelStep, type PinoFileOptions, type ProcessingAgentConfig, type Project, type ProjectStore, type QueryParams, type QueryResultFormat, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type ReplyTarget, type Result, type RunStep, 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 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 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 UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateChannelInstallationRequest, type UpdateDatabaseConfigRequest, type UpdateMcpServerConfigRequest, type UpdateMetricsServerConfigRequest, type UpdateProjectRequest, type UpdateRunStepRequest, 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 VectorStoreLatticeProtocol, type WorkflowAgentConfig, type WorkflowDSL, type WorkflowRun, type WorkflowRunStatus, type WorkflowStep, type WorkflowTrackingStore, type Workspace, type WorkspaceStore, getSubAgentsFromConfig, getToolsFromConfig, hasTools, isA2ARemoteAgentConfig, isDeepAgentConfig, isProcessingAgentConfig, isTeamAgentConfig, isWorkflowAgentConfig };
3996
+ 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 CreateA2AApiKeyInput, type CreateAssistantRequest, type CreateBindingInput, type CreateChannelInstallationRequest, type CreateDatabaseConfigRequest, type CreateEvalCaseRequest, type CreateEvalProjectRequest, type CreateEvalRunRequest, type CreateEvalSuiteRequest, type CreateMcpServerConfigRequest, type CreateMenuItemInput, type CreateMetricsServerConfigRequest, type CreateProjectRequest, type CreateRunStepRequest, type CreateSkillRequest, type CreateTaskRequest, type CreateTenantRequest, type CreateThreadRequest, type CreateUserRequest, type CreateUserTenantLinkRequest, 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 ProcessingAgentConfig, type Project, type ProjectStore, type QueryParams, type QueryResultFormat, type QueueClient, type QueueConfig, type QueueLatticeProtocol, type QueueResult, QueueType, type ReactAgentConfig, type ReplyTarget, type Result, type RunStep, 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 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 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 UIComponent, UIComponentType, type UIConfig, type UILatticeProtocol, type UpdateChannelInstallationRequest, 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 VectorStoreLatticeProtocol, 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 };