@axiom-lattice/protocols 2.1.42 → 2.1.44
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/.eslintrc.json +22 -0
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +458 -96
- package/dist/index.d.ts +458 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/AgentLatticeProtocol.ts +8 -9
- package/src/AssistantStoreProtocol.ts +19 -0
- package/src/ChannelAdapterProtocol.ts +26 -0
- package/src/ChannelInstallationStoreProtocol.ts +14 -1
- package/src/InternalDSL.ts +11 -21
- package/src/MenuProtocol.ts +70 -0
- package/src/MessageProtocol.ts +1 -1
- package/src/SkillStoreProtocol.ts +1 -1
- package/src/TaskStoreProtocol.ts +306 -0
- package/src/UILatticeProtocol.ts +4 -4
- package/src/WorkflowDSL.ts +53 -328
- package/src/WorkflowTrackingStoreProtocol.ts +4 -1
- package/src/index.ts +2 -0
package/dist/index.d.ts
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
|
|
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
|
|
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
|
|
413
|
-
|
|
414
|
-
/** Optional tool keys
|
|
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:
|
|
561
|
-
removeEventListener: (event: string, handler:
|
|
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:
|
|
569
|
-
removeEventListener: (event: string, handler:
|
|
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
|
/**
|
|
@@ -2156,7 +2108,7 @@ interface DatabaseConfigStore {
|
|
|
2156
2108
|
hasConfig(tenantId: string, id: string): Promise<boolean>;
|
|
2157
2109
|
}
|
|
2158
2110
|
|
|
2159
|
-
type ChannelInstallationType = "lark" | "email" | "slack";
|
|
2111
|
+
type ChannelInstallationType = "lark" | "email" | "slack" | "wechat";
|
|
2160
2112
|
interface LarkChannelInstallationConfig {
|
|
2161
2113
|
appId: string;
|
|
2162
2114
|
appSecret: string;
|
|
@@ -2164,6 +2116,10 @@ interface LarkChannelInstallationConfig {
|
|
|
2164
2116
|
encryptKey?: string;
|
|
2165
2117
|
assistantId?: string;
|
|
2166
2118
|
}
|
|
2119
|
+
interface WechatChannelInstallationConfig {
|
|
2120
|
+
botToken: string;
|
|
2121
|
+
uin?: string;
|
|
2122
|
+
}
|
|
2167
2123
|
interface ChannelInstallation<TConfig = unknown> {
|
|
2168
2124
|
id: string;
|
|
2169
2125
|
tenantId: string;
|
|
@@ -2194,6 +2150,11 @@ interface UpdateChannelInstallationRequest {
|
|
|
2194
2150
|
interface ChannelInstallationStore {
|
|
2195
2151
|
getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
|
|
2196
2152
|
getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
2153
|
+
/**
|
|
2154
|
+
* 返回所有租户下指定 channel 类型的安装(跨租户查询)。
|
|
2155
|
+
* 用于 connectAllChannels 等不需要按租户过滤的场景。
|
|
2156
|
+
*/
|
|
2157
|
+
getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
2197
2158
|
createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
|
|
2198
2159
|
updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
|
|
2199
2160
|
deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
|
|
@@ -2939,13 +2900,15 @@ interface WorkflowRun {
|
|
|
2939
2900
|
updatedAt: Date;
|
|
2940
2901
|
}
|
|
2941
2902
|
type StepType = 'task_delegation' | 'tool_call' | 'human_in_loop' | 'topology_transition' | 'agent' | 'human_feedback' | 'map' | 'input' | 'terminal';
|
|
2942
|
-
type StepStatus = 'running' | 'completed' | 'failed' | 'interrupted';
|
|
2903
|
+
type StepStatus = 'running' | 'completed' | 'failed' | 'interrupted' | 'skipped';
|
|
2943
2904
|
interface RunStep {
|
|
2944
2905
|
id: string;
|
|
2945
2906
|
runId: string;
|
|
2946
2907
|
tenantId: string;
|
|
2947
2908
|
stepType: StepType;
|
|
2948
2909
|
stepName: string;
|
|
2910
|
+
/** Sub-agent thread_id for agent/map steps. null for input/terminal. */
|
|
2911
|
+
threadId?: string | null;
|
|
2949
2912
|
edgeFrom?: string;
|
|
2950
2913
|
edgeTo?: string;
|
|
2951
2914
|
edgePurpose?: string;
|
|
@@ -2978,6 +2941,7 @@ interface CreateRunStepRequest {
|
|
|
2978
2941
|
tenantId: string;
|
|
2979
2942
|
stepType: StepType;
|
|
2980
2943
|
stepName: string;
|
|
2944
|
+
threadId?: string | null;
|
|
2981
2945
|
edgeFrom?: string;
|
|
2982
2946
|
edgeTo?: string;
|
|
2983
2947
|
edgePurpose?: string;
|
|
@@ -3064,6 +3028,72 @@ interface BindingRegistry {
|
|
|
3064
3028
|
}): Promise<Binding[]>;
|
|
3065
3029
|
}
|
|
3066
3030
|
|
|
3031
|
+
/**
|
|
3032
|
+
* MenuProtocol
|
|
3033
|
+
*
|
|
3034
|
+
* Defines types and registry interface for per-tenant customizable menu items.
|
|
3035
|
+
* Menu items are merged with built-in defaults at the React SDK layer.
|
|
3036
|
+
*/
|
|
3037
|
+
type MenuTarget = 'sidebar' | 'workspace';
|
|
3038
|
+
type MenuContentType = 'agent' | 'html' | 'custom';
|
|
3039
|
+
interface AgentMenuConfig {
|
|
3040
|
+
agentId: string;
|
|
3041
|
+
workspaceId?: string;
|
|
3042
|
+
projectId?: string;
|
|
3043
|
+
}
|
|
3044
|
+
interface HtmlMenuConfig {
|
|
3045
|
+
url: string;
|
|
3046
|
+
params?: Record<string, string>;
|
|
3047
|
+
title?: string;
|
|
3048
|
+
}
|
|
3049
|
+
interface CustomMenuConfig {
|
|
3050
|
+
componentKey: string;
|
|
3051
|
+
}
|
|
3052
|
+
type MenuContentConfig = AgentMenuConfig | HtmlMenuConfig | CustomMenuConfig;
|
|
3053
|
+
interface MenuItem {
|
|
3054
|
+
id: string;
|
|
3055
|
+
tenantId: string;
|
|
3056
|
+
menuTarget: MenuTarget;
|
|
3057
|
+
group?: string;
|
|
3058
|
+
name: string;
|
|
3059
|
+
icon?: string;
|
|
3060
|
+
sortOrder: number;
|
|
3061
|
+
contentType: MenuContentType;
|
|
3062
|
+
contentConfig: MenuContentConfig;
|
|
3063
|
+
enabled: boolean;
|
|
3064
|
+
createdAt: Date;
|
|
3065
|
+
updatedAt: Date;
|
|
3066
|
+
}
|
|
3067
|
+
interface CreateMenuItemInput {
|
|
3068
|
+
menuTarget: MenuTarget;
|
|
3069
|
+
group?: string;
|
|
3070
|
+
name: string;
|
|
3071
|
+
icon?: string;
|
|
3072
|
+
sortOrder?: number;
|
|
3073
|
+
contentType: MenuContentType;
|
|
3074
|
+
contentConfig: MenuContentConfig;
|
|
3075
|
+
}
|
|
3076
|
+
interface UpdateMenuItemInput {
|
|
3077
|
+
group?: string;
|
|
3078
|
+
name?: string;
|
|
3079
|
+
icon?: string;
|
|
3080
|
+
sortOrder?: number;
|
|
3081
|
+
contentConfig?: MenuContentConfig;
|
|
3082
|
+
enabled?: boolean;
|
|
3083
|
+
}
|
|
3084
|
+
interface MenuRegistry {
|
|
3085
|
+
list(params: {
|
|
3086
|
+
tenantId: string;
|
|
3087
|
+
menuTarget?: MenuTarget;
|
|
3088
|
+
}): Promise<MenuItem[]>;
|
|
3089
|
+
getById(id: string): Promise<MenuItem | null>;
|
|
3090
|
+
create(input: CreateMenuItemInput & {
|
|
3091
|
+
tenantId: string;
|
|
3092
|
+
}): Promise<MenuItem>;
|
|
3093
|
+
update(id: string, patch: UpdateMenuItemInput): Promise<MenuItem>;
|
|
3094
|
+
delete(id: string): Promise<void>;
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3067
3097
|
interface EvalProject {
|
|
3068
3098
|
id: string;
|
|
3069
3099
|
tenantId: string;
|
|
@@ -3225,6 +3255,265 @@ interface EvalStore {
|
|
|
3225
3255
|
getProjectReport(tenantId: string, projectId: string): Promise<EvalProjectReport | null>;
|
|
3226
3256
|
}
|
|
3227
3257
|
|
|
3258
|
+
/**
|
|
3259
|
+
* TaskStoreProtocol
|
|
3260
|
+
*
|
|
3261
|
+
* Task store protocol definitions for the Axiom Lattice framework.
|
|
3262
|
+
* Provides standardized interfaces for task management across all implementations.
|
|
3263
|
+
*/
|
|
3264
|
+
/**
|
|
3265
|
+
* TaskItem — unified task model for users and agents.
|
|
3266
|
+
*/
|
|
3267
|
+
interface TaskItem {
|
|
3268
|
+
/**
|
|
3269
|
+
* Task identifier
|
|
3270
|
+
*/
|
|
3271
|
+
id: string;
|
|
3272
|
+
/**
|
|
3273
|
+
* Tenant identifier
|
|
3274
|
+
*/
|
|
3275
|
+
tenantId: string;
|
|
3276
|
+
/**
|
|
3277
|
+
* Owner type — either a user or an agent
|
|
3278
|
+
*/
|
|
3279
|
+
ownerType: 'user' | 'agent';
|
|
3280
|
+
/**
|
|
3281
|
+
* Owner identifier
|
|
3282
|
+
*/
|
|
3283
|
+
ownerId: string;
|
|
3284
|
+
/**
|
|
3285
|
+
* Task title
|
|
3286
|
+
*/
|
|
3287
|
+
title: string;
|
|
3288
|
+
/**
|
|
3289
|
+
* Task description
|
|
3290
|
+
*/
|
|
3291
|
+
description?: string;
|
|
3292
|
+
/**
|
|
3293
|
+
* Task status
|
|
3294
|
+
*/
|
|
3295
|
+
status: 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
3296
|
+
/**
|
|
3297
|
+
* Task priority level
|
|
3298
|
+
*/
|
|
3299
|
+
priority: 'low' | 'medium' | 'high';
|
|
3300
|
+
/**
|
|
3301
|
+
* Optional due date as ISO string
|
|
3302
|
+
*/
|
|
3303
|
+
dueDate?: string;
|
|
3304
|
+
/**
|
|
3305
|
+
* Arbitrary metadata key-value pairs
|
|
3306
|
+
*/
|
|
3307
|
+
metadata?: Record<string, unknown>;
|
|
3308
|
+
/**
|
|
3309
|
+
* Parent task ID for hierarchical tasks
|
|
3310
|
+
*/
|
|
3311
|
+
parentId?: string;
|
|
3312
|
+
/**
|
|
3313
|
+
* Source system identifier for external task tracking
|
|
3314
|
+
*/
|
|
3315
|
+
sourceId?: string;
|
|
3316
|
+
/**
|
|
3317
|
+
* Additional contextual data
|
|
3318
|
+
*/
|
|
3319
|
+
context?: Record<string, unknown>;
|
|
3320
|
+
/**
|
|
3321
|
+
* Task creation timestamp
|
|
3322
|
+
*/
|
|
3323
|
+
createdAt: Date;
|
|
3324
|
+
/**
|
|
3325
|
+
* Task last update timestamp
|
|
3326
|
+
*/
|
|
3327
|
+
updatedAt: Date;
|
|
3328
|
+
}
|
|
3329
|
+
/**
|
|
3330
|
+
* Create task request type
|
|
3331
|
+
*/
|
|
3332
|
+
interface CreateTaskRequest {
|
|
3333
|
+
/**
|
|
3334
|
+
* Task title
|
|
3335
|
+
*/
|
|
3336
|
+
title: string;
|
|
3337
|
+
/**
|
|
3338
|
+
* Task description
|
|
3339
|
+
*/
|
|
3340
|
+
description?: string;
|
|
3341
|
+
/**
|
|
3342
|
+
* Task status — defaults to 'pending' if not provided
|
|
3343
|
+
*/
|
|
3344
|
+
status?: 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
3345
|
+
/**
|
|
3346
|
+
* Task priority level — defaults to 'medium' if not provided
|
|
3347
|
+
*/
|
|
3348
|
+
priority?: 'low' | 'medium' | 'high';
|
|
3349
|
+
/**
|
|
3350
|
+
* Optional due date as ISO string
|
|
3351
|
+
*/
|
|
3352
|
+
dueDate?: string;
|
|
3353
|
+
/**
|
|
3354
|
+
* Arbitrary metadata key-value pairs
|
|
3355
|
+
*/
|
|
3356
|
+
metadata?: Record<string, unknown>;
|
|
3357
|
+
/**
|
|
3358
|
+
* Parent task ID for hierarchical tasks
|
|
3359
|
+
*/
|
|
3360
|
+
parentId?: string;
|
|
3361
|
+
/**
|
|
3362
|
+
* Source system identifier for external task tracking
|
|
3363
|
+
*/
|
|
3364
|
+
sourceId?: string;
|
|
3365
|
+
/**
|
|
3366
|
+
* Additional contextual data
|
|
3367
|
+
*/
|
|
3368
|
+
context?: Record<string, unknown>;
|
|
3369
|
+
/**
|
|
3370
|
+
* Owner type — defaults based on context if not provided
|
|
3371
|
+
*/
|
|
3372
|
+
ownerType?: 'user' | 'agent';
|
|
3373
|
+
/**
|
|
3374
|
+
* Owner identifier — defaults based on context if not provided
|
|
3375
|
+
*/
|
|
3376
|
+
ownerId?: string;
|
|
3377
|
+
}
|
|
3378
|
+
/**
|
|
3379
|
+
* Update task request type
|
|
3380
|
+
*/
|
|
3381
|
+
interface UpdateTaskRequest {
|
|
3382
|
+
/**
|
|
3383
|
+
* Task title
|
|
3384
|
+
*/
|
|
3385
|
+
title?: string;
|
|
3386
|
+
/**
|
|
3387
|
+
* Task description
|
|
3388
|
+
*/
|
|
3389
|
+
description?: string;
|
|
3390
|
+
/**
|
|
3391
|
+
* Task status
|
|
3392
|
+
*/
|
|
3393
|
+
status?: 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
3394
|
+
/**
|
|
3395
|
+
* Task priority level
|
|
3396
|
+
*/
|
|
3397
|
+
priority?: 'low' | 'medium' | 'high';
|
|
3398
|
+
/**
|
|
3399
|
+
* Optional due date as ISO string
|
|
3400
|
+
*/
|
|
3401
|
+
dueDate?: string;
|
|
3402
|
+
/**
|
|
3403
|
+
* Arbitrary metadata key-value pairs
|
|
3404
|
+
*/
|
|
3405
|
+
metadata?: Record<string, unknown>;
|
|
3406
|
+
/**
|
|
3407
|
+
* Parent task ID for hierarchical tasks
|
|
3408
|
+
*/
|
|
3409
|
+
parentId?: string;
|
|
3410
|
+
/**
|
|
3411
|
+
* Source system identifier for external task tracking
|
|
3412
|
+
*/
|
|
3413
|
+
sourceId?: string;
|
|
3414
|
+
/**
|
|
3415
|
+
* Additional contextual data
|
|
3416
|
+
*/
|
|
3417
|
+
context?: Record<string, unknown>;
|
|
3418
|
+
/**
|
|
3419
|
+
* Owner type
|
|
3420
|
+
*/
|
|
3421
|
+
ownerType?: 'user' | 'agent';
|
|
3422
|
+
/**
|
|
3423
|
+
* Owner identifier
|
|
3424
|
+
*/
|
|
3425
|
+
ownerId?: string;
|
|
3426
|
+
}
|
|
3427
|
+
/**
|
|
3428
|
+
* Task list filter criteria
|
|
3429
|
+
*/
|
|
3430
|
+
interface TaskListFilter {
|
|
3431
|
+
/**
|
|
3432
|
+
* Tenant identifier (required)
|
|
3433
|
+
*/
|
|
3434
|
+
tenantId: string;
|
|
3435
|
+
/**
|
|
3436
|
+
* Filter by owner type
|
|
3437
|
+
*/
|
|
3438
|
+
ownerType?: 'user' | 'agent';
|
|
3439
|
+
/**
|
|
3440
|
+
* Filter by owner ID
|
|
3441
|
+
*/
|
|
3442
|
+
ownerId?: string;
|
|
3443
|
+
/**
|
|
3444
|
+
* Filter by task status
|
|
3445
|
+
*/
|
|
3446
|
+
status?: string;
|
|
3447
|
+
/**
|
|
3448
|
+
* Filter by priority level
|
|
3449
|
+
*/
|
|
3450
|
+
priority?: string;
|
|
3451
|
+
/**
|
|
3452
|
+
* Filter by parent task ID
|
|
3453
|
+
*/
|
|
3454
|
+
parentId?: string;
|
|
3455
|
+
/**
|
|
3456
|
+
* Filter by source system ID
|
|
3457
|
+
*/
|
|
3458
|
+
sourceId?: string;
|
|
3459
|
+
/**
|
|
3460
|
+
* Filter by metadata key-value pairs
|
|
3461
|
+
*/
|
|
3462
|
+
metadata?: Record<string, unknown>;
|
|
3463
|
+
/**
|
|
3464
|
+
* Maximum number of results to return
|
|
3465
|
+
*/
|
|
3466
|
+
limit?: number;
|
|
3467
|
+
/**
|
|
3468
|
+
* Number of results to skip for pagination
|
|
3469
|
+
*/
|
|
3470
|
+
offset?: number;
|
|
3471
|
+
}
|
|
3472
|
+
/**
|
|
3473
|
+
* TaskStore interface
|
|
3474
|
+
* Provides CRUD operations for task data
|
|
3475
|
+
*/
|
|
3476
|
+
interface TaskStore {
|
|
3477
|
+
/**
|
|
3478
|
+
* Create a new task
|
|
3479
|
+
* @param params Task creation data including tenant, ownerType ('user' | 'agent'), and owner info
|
|
3480
|
+
* @returns Created task
|
|
3481
|
+
*/
|
|
3482
|
+
create(params: CreateTaskRequest & {
|
|
3483
|
+
tenantId: string;
|
|
3484
|
+
ownerType: string;
|
|
3485
|
+
ownerId: string;
|
|
3486
|
+
}): Promise<TaskItem>;
|
|
3487
|
+
/**
|
|
3488
|
+
* Get a task by ID
|
|
3489
|
+
* @param tenantId Tenant identifier
|
|
3490
|
+
* @param id Task identifier
|
|
3491
|
+
* @returns Task if found, null otherwise
|
|
3492
|
+
*/
|
|
3493
|
+
getById(tenantId: string, id: string): Promise<TaskItem | null>;
|
|
3494
|
+
/**
|
|
3495
|
+
* List tasks matching the given filter
|
|
3496
|
+
* @param filter Filter criteria
|
|
3497
|
+
* @returns Array of matching tasks
|
|
3498
|
+
*/
|
|
3499
|
+
list(filter: TaskListFilter): Promise<TaskItem[]>;
|
|
3500
|
+
/**
|
|
3501
|
+
* Update an existing task
|
|
3502
|
+
* @param tenantId Tenant identifier
|
|
3503
|
+
* @param id Task identifier
|
|
3504
|
+
* @param updates Partial task data to update
|
|
3505
|
+
* @returns Updated task if found, null otherwise
|
|
3506
|
+
*/
|
|
3507
|
+
update(tenantId: string, id: string, updates: UpdateTaskRequest): Promise<TaskItem | null>;
|
|
3508
|
+
/**
|
|
3509
|
+
* Delete a task by ID
|
|
3510
|
+
* @param tenantId Tenant identifier
|
|
3511
|
+
* @param id Task identifier
|
|
3512
|
+
* @returns true if deleted, false otherwise
|
|
3513
|
+
*/
|
|
3514
|
+
delete(tenantId: string, id: string): Promise<boolean>;
|
|
3515
|
+
}
|
|
3516
|
+
|
|
3228
3517
|
/**
|
|
3229
3518
|
* ChannelAdapterProtocol
|
|
3230
3519
|
*/
|
|
@@ -3283,6 +3572,26 @@ interface ChannelAdapter<TConfig = unknown> {
|
|
|
3283
3572
|
readonly configSchema: z.ZodSchema<TConfig>;
|
|
3284
3573
|
receive(rawPayload: unknown, installation: ChannelInstallation): Promise<InboundMessage | null>;
|
|
3285
3574
|
sendReply(replyTarget: ReplyTarget, message: OutboundMessage, installation: ChannelInstallation): Promise<void>;
|
|
3575
|
+
/**
|
|
3576
|
+
* 可选:Channel 自定义 thread ID 生成策略。
|
|
3577
|
+
* 如果提供,MessageRouter 会优先使用此方法决定 thread ID,
|
|
3578
|
+
* 替代默认的 binding.threadMode(fixed / per_conversation)。
|
|
3579
|
+
*
|
|
3580
|
+
* 返回的 thread ID 会持久化到 binding 中,以便后续消息复用。
|
|
3581
|
+
*/
|
|
3582
|
+
resolveThreadId?(message: InboundMessage, binding: unknown): Promise<string> | string;
|
|
3583
|
+
/**
|
|
3584
|
+
* 可选:建立持久连接并开始接收事件。
|
|
3585
|
+
* adapter 自己负责连接管理、事件处理、消息分发。
|
|
3586
|
+
* `deps` 由调用方传入,通常包含 MessageRouter。
|
|
3587
|
+
*/
|
|
3588
|
+
connect?(installation: ChannelInstallation<TConfig>, deps?: unknown): Promise<void>;
|
|
3589
|
+
/**
|
|
3590
|
+
* 可选:断开持久连接并停止接收事件。
|
|
3591
|
+
* 当 channel installation 被禁用或删除时调用。
|
|
3592
|
+
* `installationId` 用于标识要断开的具体安装实例。
|
|
3593
|
+
*/
|
|
3594
|
+
disconnect?(installationId: string): Promise<void>;
|
|
3286
3595
|
}
|
|
3287
3596
|
|
|
3288
3597
|
/**
|
|
@@ -3480,11 +3789,71 @@ interface A2AApiKeyStore {
|
|
|
3480
3789
|
loadIntoMap(): Promise<Map<string, A2AApiKeyEntry>>;
|
|
3481
3790
|
}
|
|
3482
3791
|
|
|
3792
|
+
/**
|
|
3793
|
+
* YAML Workflow DSL — linear model with parallel blocks
|
|
3794
|
+
*
|
|
3795
|
+
* Steps execute top-to-bottom. `parallel:` blocks declare concurrency.
|
|
3796
|
+
* `if` on any step skips it. `map` iterates over arrays.
|
|
3797
|
+
* No `needs` — execution order = reading order.
|
|
3798
|
+
*
|
|
3799
|
+
* Template syntax:
|
|
3800
|
+
* {{input}} — initial user input
|
|
3801
|
+
* {{label}} — output of step with given label
|
|
3802
|
+
* {{label.field}} — nested field access on structured output
|
|
3803
|
+
* {{item}} — current element in map iterations
|
|
3804
|
+
*/
|
|
3805
|
+
interface YamlWorkflow {
|
|
3806
|
+
/** Optional workflow name — defaults to "workflow" if omitted. */
|
|
3807
|
+
name?: string;
|
|
3808
|
+
steps: YamlTopLevelStep[];
|
|
3809
|
+
}
|
|
3810
|
+
type YamlTopLevelStep = YamlAgentStep | YamlParallelBlock | YamlMapStep;
|
|
3811
|
+
interface YamlAgentStep {
|
|
3812
|
+
/** Unique label serving as state key and template reference. */
|
|
3813
|
+
label: string;
|
|
3814
|
+
/** JS expression evaluated as boolean. Step skipped when falsy. */
|
|
3815
|
+
if?: string;
|
|
3816
|
+
/** Agent instruction with {{template}} references. */
|
|
3817
|
+
prompt: string;
|
|
3818
|
+
/** Shorthand output schema: { field: "string" | "number" | "boolean" } */
|
|
3819
|
+
output?: Record<string, unknown>;
|
|
3820
|
+
/** When true, inject ask_user_to_clarify middleware. */
|
|
3821
|
+
ask?: boolean;
|
|
3822
|
+
}
|
|
3823
|
+
interface YamlParallelBlock {
|
|
3824
|
+
parallel: YamlAgentStep[];
|
|
3825
|
+
/** JS expression evaluated as boolean. Entire block skipped when falsy. */
|
|
3826
|
+
if?: string;
|
|
3827
|
+
/** Shorthand output schema for aggregated results. */
|
|
3828
|
+
output?: Record<string, unknown>;
|
|
3829
|
+
}
|
|
3830
|
+
interface YamlMapStep {
|
|
3831
|
+
map: {
|
|
3832
|
+
/** Path to source array (e.g. "extract.items"). */
|
|
3833
|
+
source: string;
|
|
3834
|
+
/** Step label for referencing in templates (e.g. {{label}}). */
|
|
3835
|
+
label: string;
|
|
3836
|
+
/** JS expression evaluated as boolean. Entire map skipped when falsy. */
|
|
3837
|
+
if?: string;
|
|
3838
|
+
/** Agent applied to each element. Use {{item}} for current element. */
|
|
3839
|
+
each: {
|
|
3840
|
+
prompt: string;
|
|
3841
|
+
output?: Record<string, unknown>;
|
|
3842
|
+
};
|
|
3843
|
+
/** Shorthand output schema for the aggregated results. */
|
|
3844
|
+
output?: Record<string, unknown>;
|
|
3845
|
+
/** Items per batch (default 50). */
|
|
3846
|
+
batch?: number;
|
|
3847
|
+
/** Max parallel items (default 5). */
|
|
3848
|
+
concurrency?: number;
|
|
3849
|
+
};
|
|
3850
|
+
}
|
|
3851
|
+
|
|
3483
3852
|
/**
|
|
3484
3853
|
* Internal DSL — expanded intermediate representation.
|
|
3485
3854
|
*
|
|
3486
|
-
* Generated by the
|
|
3487
|
-
* Not part of the public API
|
|
3855
|
+
* Generated by parseYaml() from the YAML workflow DSL. Consumed by compileWorkflow.
|
|
3856
|
+
* Not part of the public API.
|
|
3488
3857
|
*/
|
|
3489
3858
|
interface InternalDSL {
|
|
3490
3859
|
version: "1.0";
|
|
@@ -3502,10 +3871,10 @@ interface InternalStateField {
|
|
|
3502
3871
|
default?: unknown;
|
|
3503
3872
|
reducer?: "replace" | "append" | "merge";
|
|
3504
3873
|
}
|
|
3505
|
-
type InternalNode = InternalAgentNode |
|
|
3874
|
+
type InternalNode = InternalAgentNode | InternalMapNode | InternalTerminalNode | InternalInputNode;
|
|
3506
3875
|
interface InternalBaseNode {
|
|
3507
3876
|
id: string;
|
|
3508
|
-
type: "agent" | "
|
|
3877
|
+
type: "agent" | "map" | "terminal" | "input";
|
|
3509
3878
|
name: string;
|
|
3510
3879
|
description?: string;
|
|
3511
3880
|
config?: InternalNodeConfig;
|
|
@@ -3515,17 +3884,19 @@ interface InternalBaseNode {
|
|
|
3515
3884
|
interface InternalAgentNode extends InternalBaseNode {
|
|
3516
3885
|
type: "agent";
|
|
3517
3886
|
ref?: string;
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3887
|
+
/** When true, the agent loads ask_user_to_clarify middleware. */
|
|
3888
|
+
ask?: boolean;
|
|
3889
|
+
/** Runtime condition expression evaluated as JS. Step skipped when false. */
|
|
3890
|
+
condition?: string;
|
|
3891
|
+
/** Parallel group ID — children in the same group run concurrently. */
|
|
3892
|
+
parallelGroup?: string;
|
|
3524
3893
|
}
|
|
3525
3894
|
interface InternalMapNode extends InternalBaseNode {
|
|
3526
3895
|
type: "map";
|
|
3527
3896
|
source: string;
|
|
3528
3897
|
itemKey?: string;
|
|
3898
|
+
/** Runtime condition expression evaluated as JS. Map skipped when false. */
|
|
3899
|
+
condition?: string;
|
|
3529
3900
|
config?: InternalNodeConfig & {
|
|
3530
3901
|
batchSize?: number;
|
|
3531
3902
|
maxConcurrency?: number;
|
|
@@ -3562,15 +3933,6 @@ interface InternalOutput {
|
|
|
3562
3933
|
interface InternalEdge {
|
|
3563
3934
|
from: string;
|
|
3564
3935
|
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
3936
|
}
|
|
3575
3937
|
interface InternalNodeConfig {
|
|
3576
3938
|
timeout?: number;
|
|
@@ -3641,4 +4003,4 @@ type Timestamp = number;
|
|
|
3641
4003
|
*/
|
|
3642
4004
|
type Callback<T = any, R = void> = (data: T) => R | Promise<R>;
|
|
3643
4005
|
|
|
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
|
|
4006
|
+
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 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 };
|