@agent-phonon/protocol 0.3.0 → 0.6.0
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/schemas/capabilities.d.ts +9 -0
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +7 -0
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/discovery.d.ts +26 -0
- package/dist/schemas/discovery.d.ts.map +1 -1
- package/dist/schemas/methods.d.ts +676 -35
- package/dist/schemas/methods.d.ts.map +1 -1
- package/dist/schemas/methods.js +8 -1
- package/dist/schemas/methods.js.map +1 -1
- package/dist/schemas/stream.d.ts +192 -16
- package/dist/schemas/stream.d.ts.map +1 -1
- package/dist/schemas/stream.js +9 -0
- package/dist/schemas/stream.js.map +1 -1
- package/dist/schemas/workflow.d.ts +1555 -46
- package/dist/schemas/workflow.d.ts.map +1 -1
- package/dist/schemas/workflow.js +266 -17
- package/dist/schemas/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/schemas/capabilities.ts +7 -0
- package/src/schemas/methods.ts +8 -0
- package/src/schemas/stream.ts +9 -0
- package/src/schemas/workflow.ts +306 -18
|
@@ -2,11 +2,19 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const WorkflowId: z.ZodString;
|
|
3
3
|
export declare const WorkflowNodeId: z.ZodString;
|
|
4
4
|
export declare const WorkflowEdgeId: z.ZodString;
|
|
5
|
+
/**
|
|
6
|
+
* Role 字段说明(review v0.5):
|
|
7
|
+
* role 是这个 agent 在当前 workflow 中扮演的角色,由调用方自由定义。
|
|
8
|
+
* phonon 只做透传 + 在 stream.event / workflow.event 里回显,不解析其语义。
|
|
9
|
+
* 常见示例:"executor" / "worker" / "reviewer" / "coder" / "planner" / "chairman" / "participant"
|
|
10
|
+
* 上层服务可以把 role 映射到 category / system prompt / 模型选择,phonon 不感知。
|
|
11
|
+
*/
|
|
5
12
|
export declare const WorkflowRoleId: z.ZodString;
|
|
6
13
|
export declare const WorkflowNode: z.ZodObject<{
|
|
7
14
|
nodeId: z.ZodString;
|
|
8
15
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
9
16
|
model: z.ZodString;
|
|
17
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
10
18
|
role: z.ZodOptional<z.ZodString>;
|
|
11
19
|
input: z.ZodOptional<z.ZodString>;
|
|
12
20
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -14,14 +22,41 @@ export declare const WorkflowNode: z.ZodObject<{
|
|
|
14
22
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
15
23
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
24
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
|
+
/**
|
|
26
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
27
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
28
|
+
*/
|
|
29
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
30
|
+
/**
|
|
31
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
32
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
33
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
34
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
35
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
36
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
37
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
38
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
39
|
+
*/
|
|
40
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
41
|
+
/**
|
|
42
|
+
* Git branch。意义联动 worktreeId:
|
|
43
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
44
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
45
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
46
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
47
|
+
*/
|
|
48
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
17
49
|
}, "strip", z.ZodTypeAny, {
|
|
18
50
|
agent: string & z.BRAND<"AgentId">;
|
|
19
51
|
model: string;
|
|
20
52
|
nodeId: string;
|
|
21
53
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
22
54
|
role?: string | undefined;
|
|
55
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
56
|
+
worktreeId?: string | undefined;
|
|
23
57
|
agentConfig?: Record<string, unknown> | undefined;
|
|
24
58
|
input?: string | undefined;
|
|
59
|
+
branch?: string | undefined;
|
|
25
60
|
systemPrompt?: string | undefined;
|
|
26
61
|
dependsOn?: string[] | undefined;
|
|
27
62
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -31,8 +66,11 @@ export declare const WorkflowNode: z.ZodObject<{
|
|
|
31
66
|
nodeId: string;
|
|
32
67
|
sessionId?: string | undefined;
|
|
33
68
|
role?: string | undefined;
|
|
69
|
+
project?: string | undefined;
|
|
70
|
+
worktreeId?: string | undefined;
|
|
34
71
|
agentConfig?: Record<string, unknown> | undefined;
|
|
35
72
|
input?: string | undefined;
|
|
73
|
+
branch?: string | undefined;
|
|
36
74
|
systemPrompt?: string | undefined;
|
|
37
75
|
dependsOn?: string[] | undefined;
|
|
38
76
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -67,6 +105,7 @@ export declare const WorkflowDagPlan: z.ZodObject<{
|
|
|
67
105
|
nodeId: z.ZodString;
|
|
68
106
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
69
107
|
model: z.ZodString;
|
|
108
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
70
109
|
role: z.ZodOptional<z.ZodString>;
|
|
71
110
|
input: z.ZodOptional<z.ZodString>;
|
|
72
111
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -74,14 +113,41 @@ export declare const WorkflowDagPlan: z.ZodObject<{
|
|
|
74
113
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
75
114
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
76
115
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
116
|
+
/**
|
|
117
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
118
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
119
|
+
*/
|
|
120
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
121
|
+
/**
|
|
122
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
123
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
124
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
125
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
126
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
127
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
128
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
129
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
130
|
+
*/
|
|
131
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
/**
|
|
133
|
+
* Git branch。意义联动 worktreeId:
|
|
134
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
135
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
136
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
137
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
138
|
+
*/
|
|
139
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
77
140
|
}, "strip", z.ZodTypeAny, {
|
|
78
141
|
agent: string & z.BRAND<"AgentId">;
|
|
79
142
|
model: string;
|
|
80
143
|
nodeId: string;
|
|
81
144
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
82
145
|
role?: string | undefined;
|
|
146
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
147
|
+
worktreeId?: string | undefined;
|
|
83
148
|
agentConfig?: Record<string, unknown> | undefined;
|
|
84
149
|
input?: string | undefined;
|
|
150
|
+
branch?: string | undefined;
|
|
85
151
|
systemPrompt?: string | undefined;
|
|
86
152
|
dependsOn?: string[] | undefined;
|
|
87
153
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -91,8 +157,11 @@ export declare const WorkflowDagPlan: z.ZodObject<{
|
|
|
91
157
|
nodeId: string;
|
|
92
158
|
sessionId?: string | undefined;
|
|
93
159
|
role?: string | undefined;
|
|
160
|
+
project?: string | undefined;
|
|
161
|
+
worktreeId?: string | undefined;
|
|
94
162
|
agentConfig?: Record<string, unknown> | undefined;
|
|
95
163
|
input?: string | undefined;
|
|
164
|
+
branch?: string | undefined;
|
|
96
165
|
systemPrompt?: string | undefined;
|
|
97
166
|
dependsOn?: string[] | undefined;
|
|
98
167
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -128,8 +197,11 @@ export declare const WorkflowDagPlan: z.ZodObject<{
|
|
|
128
197
|
nodeId: string;
|
|
129
198
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
130
199
|
role?: string | undefined;
|
|
200
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
201
|
+
worktreeId?: string | undefined;
|
|
131
202
|
agentConfig?: Record<string, unknown> | undefined;
|
|
132
203
|
input?: string | undefined;
|
|
204
|
+
branch?: string | undefined;
|
|
133
205
|
systemPrompt?: string | undefined;
|
|
134
206
|
dependsOn?: string[] | undefined;
|
|
135
207
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -151,8 +223,11 @@ export declare const WorkflowDagPlan: z.ZodObject<{
|
|
|
151
223
|
nodeId: string;
|
|
152
224
|
sessionId?: string | undefined;
|
|
153
225
|
role?: string | undefined;
|
|
226
|
+
project?: string | undefined;
|
|
227
|
+
worktreeId?: string | undefined;
|
|
154
228
|
agentConfig?: Record<string, unknown> | undefined;
|
|
155
229
|
input?: string | undefined;
|
|
230
|
+
branch?: string | undefined;
|
|
156
231
|
systemPrompt?: string | undefined;
|
|
157
232
|
dependsOn?: string[] | undefined;
|
|
158
233
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -217,34 +292,102 @@ export declare const WorkflowCommunicationGraph: z.ZodObject<{
|
|
|
217
292
|
maxIterations?: number | undefined;
|
|
218
293
|
}>;
|
|
219
294
|
export type WorkflowCommunicationGraph = z.infer<typeof WorkflowCommunicationGraph>;
|
|
295
|
+
export declare const WorkflowExecutorNode: z.ZodObject<{
|
|
296
|
+
nodeId: z.ZodString;
|
|
297
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
298
|
+
model: z.ZodString;
|
|
299
|
+
input: z.ZodOptional<z.ZodString>;
|
|
300
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
301
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
302
|
+
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
303
|
+
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
304
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
305
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
306
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
307
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
308
|
+
} & {
|
|
309
|
+
role: z.ZodDefault<z.ZodLiteral<"executor">>;
|
|
310
|
+
}, "strip", z.ZodTypeAny, {
|
|
311
|
+
agent: string & z.BRAND<"AgentId">;
|
|
312
|
+
role: "executor";
|
|
313
|
+
model: string;
|
|
314
|
+
nodeId: string;
|
|
315
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
316
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
317
|
+
worktreeId?: string | undefined;
|
|
318
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
319
|
+
input?: string | undefined;
|
|
320
|
+
branch?: string | undefined;
|
|
321
|
+
systemPrompt?: string | undefined;
|
|
322
|
+
dependsOn?: string[] | undefined;
|
|
323
|
+
metadata?: Record<string, unknown> | undefined;
|
|
324
|
+
}, {
|
|
325
|
+
agent: string;
|
|
326
|
+
model: string;
|
|
327
|
+
nodeId: string;
|
|
328
|
+
sessionId?: string | undefined;
|
|
329
|
+
role?: "executor" | undefined;
|
|
330
|
+
project?: string | undefined;
|
|
331
|
+
worktreeId?: string | undefined;
|
|
332
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
333
|
+
input?: string | undefined;
|
|
334
|
+
branch?: string | undefined;
|
|
335
|
+
systemPrompt?: string | undefined;
|
|
336
|
+
dependsOn?: string[] | undefined;
|
|
337
|
+
metadata?: Record<string, unknown> | undefined;
|
|
338
|
+
}>;
|
|
339
|
+
export type WorkflowExecutorNode = z.infer<typeof WorkflowExecutorNode>;
|
|
220
340
|
export declare const WorkflowGraphPlan: z.ZodObject<{
|
|
221
341
|
mode: z.ZodLiteral<"graph">;
|
|
222
342
|
executor: z.ZodObject<{
|
|
223
343
|
nodeId: z.ZodString;
|
|
224
344
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
225
345
|
model: z.ZodString;
|
|
226
|
-
|
|
346
|
+
input: z.ZodOptional<z.ZodString>;
|
|
227
347
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
348
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
349
|
+
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
228
350
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
351
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
352
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
353
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
354
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
355
|
+
} & {
|
|
356
|
+
role: z.ZodDefault<z.ZodLiteral<"executor">>;
|
|
229
357
|
}, "strip", z.ZodTypeAny, {
|
|
230
358
|
agent: string & z.BRAND<"AgentId">;
|
|
231
359
|
role: "executor";
|
|
232
360
|
model: string;
|
|
233
361
|
nodeId: string;
|
|
362
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
363
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
364
|
+
worktreeId?: string | undefined;
|
|
234
365
|
agentConfig?: Record<string, unknown> | undefined;
|
|
366
|
+
input?: string | undefined;
|
|
367
|
+
branch?: string | undefined;
|
|
235
368
|
systemPrompt?: string | undefined;
|
|
369
|
+
dependsOn?: string[] | undefined;
|
|
370
|
+
metadata?: Record<string, unknown> | undefined;
|
|
236
371
|
}, {
|
|
237
372
|
agent: string;
|
|
238
373
|
model: string;
|
|
239
374
|
nodeId: string;
|
|
375
|
+
sessionId?: string | undefined;
|
|
240
376
|
role?: "executor" | undefined;
|
|
377
|
+
project?: string | undefined;
|
|
378
|
+
worktreeId?: string | undefined;
|
|
241
379
|
agentConfig?: Record<string, unknown> | undefined;
|
|
380
|
+
input?: string | undefined;
|
|
381
|
+
branch?: string | undefined;
|
|
242
382
|
systemPrompt?: string | undefined;
|
|
383
|
+
dependsOn?: string[] | undefined;
|
|
384
|
+
metadata?: Record<string, unknown> | undefined;
|
|
243
385
|
}>;
|
|
244
386
|
workers: z.ZodArray<z.ZodObject<{
|
|
245
387
|
nodeId: z.ZodString;
|
|
246
388
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
247
389
|
model: z.ZodString;
|
|
390
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
248
391
|
role: z.ZodOptional<z.ZodString>;
|
|
249
392
|
input: z.ZodOptional<z.ZodString>;
|
|
250
393
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -252,14 +395,41 @@ export declare const WorkflowGraphPlan: z.ZodObject<{
|
|
|
252
395
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
253
396
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
254
397
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
398
|
+
/**
|
|
399
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
400
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
401
|
+
*/
|
|
402
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
403
|
+
/**
|
|
404
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
405
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
406
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
407
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
408
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
409
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
410
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
411
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
412
|
+
*/
|
|
413
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
414
|
+
/**
|
|
415
|
+
* Git branch。意义联动 worktreeId:
|
|
416
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
417
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
418
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
419
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
420
|
+
*/
|
|
421
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
255
422
|
}, "strip", z.ZodTypeAny, {
|
|
256
423
|
agent: string & z.BRAND<"AgentId">;
|
|
257
424
|
model: string;
|
|
258
425
|
nodeId: string;
|
|
259
426
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
260
427
|
role?: string | undefined;
|
|
428
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
429
|
+
worktreeId?: string | undefined;
|
|
261
430
|
agentConfig?: Record<string, unknown> | undefined;
|
|
262
431
|
input?: string | undefined;
|
|
432
|
+
branch?: string | undefined;
|
|
263
433
|
systemPrompt?: string | undefined;
|
|
264
434
|
dependsOn?: string[] | undefined;
|
|
265
435
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -269,8 +439,11 @@ export declare const WorkflowGraphPlan: z.ZodObject<{
|
|
|
269
439
|
nodeId: string;
|
|
270
440
|
sessionId?: string | undefined;
|
|
271
441
|
role?: string | undefined;
|
|
442
|
+
project?: string | undefined;
|
|
443
|
+
worktreeId?: string | undefined;
|
|
272
444
|
agentConfig?: Record<string, unknown> | undefined;
|
|
273
445
|
input?: string | undefined;
|
|
446
|
+
branch?: string | undefined;
|
|
274
447
|
systemPrompt?: string | undefined;
|
|
275
448
|
dependsOn?: string[] | undefined;
|
|
276
449
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -324,23 +497,33 @@ export declare const WorkflowGraphPlan: z.ZodObject<{
|
|
|
324
497
|
maxIterations?: number | undefined;
|
|
325
498
|
}>;
|
|
326
499
|
}, "strip", z.ZodTypeAny, {
|
|
327
|
-
mode: "graph";
|
|
328
500
|
executor: {
|
|
329
501
|
agent: string & z.BRAND<"AgentId">;
|
|
330
502
|
role: "executor";
|
|
331
503
|
model: string;
|
|
332
504
|
nodeId: string;
|
|
505
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
506
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
507
|
+
worktreeId?: string | undefined;
|
|
333
508
|
agentConfig?: Record<string, unknown> | undefined;
|
|
509
|
+
input?: string | undefined;
|
|
510
|
+
branch?: string | undefined;
|
|
334
511
|
systemPrompt?: string | undefined;
|
|
512
|
+
dependsOn?: string[] | undefined;
|
|
513
|
+
metadata?: Record<string, unknown> | undefined;
|
|
335
514
|
};
|
|
515
|
+
mode: "graph";
|
|
336
516
|
workers: {
|
|
337
517
|
agent: string & z.BRAND<"AgentId">;
|
|
338
518
|
model: string;
|
|
339
519
|
nodeId: string;
|
|
340
520
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
341
521
|
role?: string | undefined;
|
|
522
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
523
|
+
worktreeId?: string | undefined;
|
|
342
524
|
agentConfig?: Record<string, unknown> | undefined;
|
|
343
525
|
input?: string | undefined;
|
|
526
|
+
branch?: string | undefined;
|
|
344
527
|
systemPrompt?: string | undefined;
|
|
345
528
|
dependsOn?: string[] | undefined;
|
|
346
529
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -358,23 +541,33 @@ export declare const WorkflowGraphPlan: z.ZodObject<{
|
|
|
358
541
|
maxIterations: number;
|
|
359
542
|
};
|
|
360
543
|
}, {
|
|
361
|
-
mode: "graph";
|
|
362
544
|
executor: {
|
|
363
545
|
agent: string;
|
|
364
546
|
model: string;
|
|
365
547
|
nodeId: string;
|
|
548
|
+
sessionId?: string | undefined;
|
|
366
549
|
role?: "executor" | undefined;
|
|
550
|
+
project?: string | undefined;
|
|
551
|
+
worktreeId?: string | undefined;
|
|
367
552
|
agentConfig?: Record<string, unknown> | undefined;
|
|
553
|
+
input?: string | undefined;
|
|
554
|
+
branch?: string | undefined;
|
|
368
555
|
systemPrompt?: string | undefined;
|
|
556
|
+
dependsOn?: string[] | undefined;
|
|
557
|
+
metadata?: Record<string, unknown> | undefined;
|
|
369
558
|
};
|
|
559
|
+
mode: "graph";
|
|
370
560
|
workers: {
|
|
371
561
|
agent: string;
|
|
372
562
|
model: string;
|
|
373
563
|
nodeId: string;
|
|
374
564
|
sessionId?: string | undefined;
|
|
375
565
|
role?: string | undefined;
|
|
566
|
+
project?: string | undefined;
|
|
567
|
+
worktreeId?: string | undefined;
|
|
376
568
|
agentConfig?: Record<string, unknown> | undefined;
|
|
377
569
|
input?: string | undefined;
|
|
570
|
+
branch?: string | undefined;
|
|
378
571
|
systemPrompt?: string | undefined;
|
|
379
572
|
dependsOn?: string[] | undefined;
|
|
380
573
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -393,12 +586,151 @@ export declare const WorkflowGraphPlan: z.ZodObject<{
|
|
|
393
586
|
};
|
|
394
587
|
}>;
|
|
395
588
|
export type WorkflowGraphPlan = z.infer<typeof WorkflowGraphPlan>;
|
|
589
|
+
export declare const WorkflowDiscussionPlan: z.ZodObject<{
|
|
590
|
+
mode: z.ZodLiteral<"discussion">;
|
|
591
|
+
/** 主题(initial input) — 所有 participant 第一轮收到这个。 */
|
|
592
|
+
topic: z.ZodString;
|
|
593
|
+
/** 参与者列表(无主从)。 */
|
|
594
|
+
participants: z.ZodArray<z.ZodObject<{
|
|
595
|
+
nodeId: z.ZodString;
|
|
596
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
597
|
+
model: z.ZodString;
|
|
598
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
599
|
+
role: z.ZodOptional<z.ZodString>;
|
|
600
|
+
input: z.ZodOptional<z.ZodString>;
|
|
601
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
602
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
603
|
+
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
604
|
+
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
605
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
606
|
+
/**
|
|
607
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
608
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
609
|
+
*/
|
|
610
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
611
|
+
/**
|
|
612
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
613
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
614
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
615
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
616
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
617
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
618
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
619
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
620
|
+
*/
|
|
621
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
622
|
+
/**
|
|
623
|
+
* Git branch。意义联动 worktreeId:
|
|
624
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
625
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
626
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
627
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
628
|
+
*/
|
|
629
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
630
|
+
}, "strip", z.ZodTypeAny, {
|
|
631
|
+
agent: string & z.BRAND<"AgentId">;
|
|
632
|
+
model: string;
|
|
633
|
+
nodeId: string;
|
|
634
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
635
|
+
role?: string | undefined;
|
|
636
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
637
|
+
worktreeId?: string | undefined;
|
|
638
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
639
|
+
input?: string | undefined;
|
|
640
|
+
branch?: string | undefined;
|
|
641
|
+
systemPrompt?: string | undefined;
|
|
642
|
+
dependsOn?: string[] | undefined;
|
|
643
|
+
metadata?: Record<string, unknown> | undefined;
|
|
644
|
+
}, {
|
|
645
|
+
agent: string;
|
|
646
|
+
model: string;
|
|
647
|
+
nodeId: string;
|
|
648
|
+
sessionId?: string | undefined;
|
|
649
|
+
role?: string | undefined;
|
|
650
|
+
project?: string | undefined;
|
|
651
|
+
worktreeId?: string | undefined;
|
|
652
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
653
|
+
input?: string | undefined;
|
|
654
|
+
branch?: string | undefined;
|
|
655
|
+
systemPrompt?: string | undefined;
|
|
656
|
+
dependsOn?: string[] | undefined;
|
|
657
|
+
metadata?: Record<string, unknown> | undefined;
|
|
658
|
+
}>, "many">;
|
|
659
|
+
/** Chairman 必须是 participants 之一的 nodeId,每轮所有 participant 发完它再 review + 决定续/停。 */
|
|
660
|
+
chairman: z.ZodString;
|
|
661
|
+
termination: z.ZodDefault<z.ZodObject<{
|
|
662
|
+
/** chairman 输出含该信号则终止。 */
|
|
663
|
+
chairmanSignal: z.ZodDefault<z.ZodString>;
|
|
664
|
+
/** 硬上限。 */
|
|
665
|
+
maxRounds: z.ZodDefault<z.ZodNumber>;
|
|
666
|
+
/** 自然达成共识的检测字符串(任一 participant 输出含此则终止,可选)。 */
|
|
667
|
+
consensusSignal: z.ZodOptional<z.ZodString>;
|
|
668
|
+
}, "strip", z.ZodTypeAny, {
|
|
669
|
+
chairmanSignal: string;
|
|
670
|
+
maxRounds: number;
|
|
671
|
+
consensusSignal?: string | undefined;
|
|
672
|
+
}, {
|
|
673
|
+
chairmanSignal?: string | undefined;
|
|
674
|
+
maxRounds?: number | undefined;
|
|
675
|
+
consensusSignal?: string | undefined;
|
|
676
|
+
}>>;
|
|
677
|
+
}, "strip", z.ZodTypeAny, {
|
|
678
|
+
mode: "discussion";
|
|
679
|
+
topic: string;
|
|
680
|
+
participants: {
|
|
681
|
+
agent: string & z.BRAND<"AgentId">;
|
|
682
|
+
model: string;
|
|
683
|
+
nodeId: string;
|
|
684
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
685
|
+
role?: string | undefined;
|
|
686
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
687
|
+
worktreeId?: string | undefined;
|
|
688
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
689
|
+
input?: string | undefined;
|
|
690
|
+
branch?: string | undefined;
|
|
691
|
+
systemPrompt?: string | undefined;
|
|
692
|
+
dependsOn?: string[] | undefined;
|
|
693
|
+
metadata?: Record<string, unknown> | undefined;
|
|
694
|
+
}[];
|
|
695
|
+
chairman: string;
|
|
696
|
+
termination: {
|
|
697
|
+
chairmanSignal: string;
|
|
698
|
+
maxRounds: number;
|
|
699
|
+
consensusSignal?: string | undefined;
|
|
700
|
+
};
|
|
701
|
+
}, {
|
|
702
|
+
mode: "discussion";
|
|
703
|
+
topic: string;
|
|
704
|
+
participants: {
|
|
705
|
+
agent: string;
|
|
706
|
+
model: string;
|
|
707
|
+
nodeId: string;
|
|
708
|
+
sessionId?: string | undefined;
|
|
709
|
+
role?: string | undefined;
|
|
710
|
+
project?: string | undefined;
|
|
711
|
+
worktreeId?: string | undefined;
|
|
712
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
713
|
+
input?: string | undefined;
|
|
714
|
+
branch?: string | undefined;
|
|
715
|
+
systemPrompt?: string | undefined;
|
|
716
|
+
dependsOn?: string[] | undefined;
|
|
717
|
+
metadata?: Record<string, unknown> | undefined;
|
|
718
|
+
}[];
|
|
719
|
+
chairman: string;
|
|
720
|
+
termination?: {
|
|
721
|
+
chairmanSignal?: string | undefined;
|
|
722
|
+
maxRounds?: number | undefined;
|
|
723
|
+
consensusSignal?: string | undefined;
|
|
724
|
+
} | undefined;
|
|
725
|
+
}>;
|
|
726
|
+
export type WorkflowDiscussionPlan = z.infer<typeof WorkflowDiscussionPlan>;
|
|
396
727
|
export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
|
|
397
728
|
mode: z.ZodLiteral<"dag">;
|
|
398
729
|
nodes: z.ZodArray<z.ZodObject<{
|
|
399
730
|
nodeId: z.ZodString;
|
|
400
731
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
401
732
|
model: z.ZodString;
|
|
733
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
402
734
|
role: z.ZodOptional<z.ZodString>;
|
|
403
735
|
input: z.ZodOptional<z.ZodString>;
|
|
404
736
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -406,14 +738,41 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
406
738
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
407
739
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
408
740
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
741
|
+
/**
|
|
742
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
743
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
744
|
+
*/
|
|
745
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
746
|
+
/**
|
|
747
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
748
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
749
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
750
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
751
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
752
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
753
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
754
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
755
|
+
*/
|
|
756
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
757
|
+
/**
|
|
758
|
+
* Git branch。意义联动 worktreeId:
|
|
759
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
760
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
761
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
762
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
763
|
+
*/
|
|
764
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
409
765
|
}, "strip", z.ZodTypeAny, {
|
|
410
766
|
agent: string & z.BRAND<"AgentId">;
|
|
411
767
|
model: string;
|
|
412
768
|
nodeId: string;
|
|
413
769
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
414
770
|
role?: string | undefined;
|
|
771
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
772
|
+
worktreeId?: string | undefined;
|
|
415
773
|
agentConfig?: Record<string, unknown> | undefined;
|
|
416
774
|
input?: string | undefined;
|
|
775
|
+
branch?: string | undefined;
|
|
417
776
|
systemPrompt?: string | undefined;
|
|
418
777
|
dependsOn?: string[] | undefined;
|
|
419
778
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -423,8 +782,11 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
423
782
|
nodeId: string;
|
|
424
783
|
sessionId?: string | undefined;
|
|
425
784
|
role?: string | undefined;
|
|
785
|
+
project?: string | undefined;
|
|
786
|
+
worktreeId?: string | undefined;
|
|
426
787
|
agentConfig?: Record<string, unknown> | undefined;
|
|
427
788
|
input?: string | undefined;
|
|
789
|
+
branch?: string | undefined;
|
|
428
790
|
systemPrompt?: string | undefined;
|
|
429
791
|
dependsOn?: string[] | undefined;
|
|
430
792
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -460,8 +822,11 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
460
822
|
nodeId: string;
|
|
461
823
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
462
824
|
role?: string | undefined;
|
|
825
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
826
|
+
worktreeId?: string | undefined;
|
|
463
827
|
agentConfig?: Record<string, unknown> | undefined;
|
|
464
828
|
input?: string | undefined;
|
|
829
|
+
branch?: string | undefined;
|
|
465
830
|
systemPrompt?: string | undefined;
|
|
466
831
|
dependsOn?: string[] | undefined;
|
|
467
832
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -483,8 +848,11 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
483
848
|
nodeId: string;
|
|
484
849
|
sessionId?: string | undefined;
|
|
485
850
|
role?: string | undefined;
|
|
851
|
+
project?: string | undefined;
|
|
852
|
+
worktreeId?: string | undefined;
|
|
486
853
|
agentConfig?: Record<string, unknown> | undefined;
|
|
487
854
|
input?: string | undefined;
|
|
855
|
+
branch?: string | undefined;
|
|
488
856
|
systemPrompt?: string | undefined;
|
|
489
857
|
dependsOn?: string[] | undefined;
|
|
490
858
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -504,28 +872,51 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
504
872
|
nodeId: z.ZodString;
|
|
505
873
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
506
874
|
model: z.ZodString;
|
|
507
|
-
|
|
875
|
+
input: z.ZodOptional<z.ZodString>;
|
|
508
876
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
877
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
878
|
+
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
509
879
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
880
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
881
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
882
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
883
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
884
|
+
} & {
|
|
885
|
+
role: z.ZodDefault<z.ZodLiteral<"executor">>;
|
|
510
886
|
}, "strip", z.ZodTypeAny, {
|
|
511
887
|
agent: string & z.BRAND<"AgentId">;
|
|
512
888
|
role: "executor";
|
|
513
889
|
model: string;
|
|
514
890
|
nodeId: string;
|
|
891
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
892
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
893
|
+
worktreeId?: string | undefined;
|
|
515
894
|
agentConfig?: Record<string, unknown> | undefined;
|
|
895
|
+
input?: string | undefined;
|
|
896
|
+
branch?: string | undefined;
|
|
516
897
|
systemPrompt?: string | undefined;
|
|
898
|
+
dependsOn?: string[] | undefined;
|
|
899
|
+
metadata?: Record<string, unknown> | undefined;
|
|
517
900
|
}, {
|
|
518
901
|
agent: string;
|
|
519
902
|
model: string;
|
|
520
903
|
nodeId: string;
|
|
904
|
+
sessionId?: string | undefined;
|
|
521
905
|
role?: "executor" | undefined;
|
|
906
|
+
project?: string | undefined;
|
|
907
|
+
worktreeId?: string | undefined;
|
|
522
908
|
agentConfig?: Record<string, unknown> | undefined;
|
|
909
|
+
input?: string | undefined;
|
|
910
|
+
branch?: string | undefined;
|
|
523
911
|
systemPrompt?: string | undefined;
|
|
912
|
+
dependsOn?: string[] | undefined;
|
|
913
|
+
metadata?: Record<string, unknown> | undefined;
|
|
524
914
|
}>;
|
|
525
915
|
workers: z.ZodArray<z.ZodObject<{
|
|
526
916
|
nodeId: z.ZodString;
|
|
527
917
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
528
918
|
model: z.ZodString;
|
|
919
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
529
920
|
role: z.ZodOptional<z.ZodString>;
|
|
530
921
|
input: z.ZodOptional<z.ZodString>;
|
|
531
922
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -533,14 +924,41 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
533
924
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
534
925
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
535
926
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
927
|
+
/**
|
|
928
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
929
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
930
|
+
*/
|
|
931
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
932
|
+
/**
|
|
933
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
934
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
935
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
936
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
937
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
938
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
939
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
940
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
941
|
+
*/
|
|
942
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
943
|
+
/**
|
|
944
|
+
* Git branch。意义联动 worktreeId:
|
|
945
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
946
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
947
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
948
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
949
|
+
*/
|
|
950
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
536
951
|
}, "strip", z.ZodTypeAny, {
|
|
537
952
|
agent: string & z.BRAND<"AgentId">;
|
|
538
953
|
model: string;
|
|
539
954
|
nodeId: string;
|
|
540
955
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
541
956
|
role?: string | undefined;
|
|
957
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
958
|
+
worktreeId?: string | undefined;
|
|
542
959
|
agentConfig?: Record<string, unknown> | undefined;
|
|
543
960
|
input?: string | undefined;
|
|
961
|
+
branch?: string | undefined;
|
|
544
962
|
systemPrompt?: string | undefined;
|
|
545
963
|
dependsOn?: string[] | undefined;
|
|
546
964
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -550,8 +968,11 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
550
968
|
nodeId: string;
|
|
551
969
|
sessionId?: string | undefined;
|
|
552
970
|
role?: string | undefined;
|
|
971
|
+
project?: string | undefined;
|
|
972
|
+
worktreeId?: string | undefined;
|
|
553
973
|
agentConfig?: Record<string, unknown> | undefined;
|
|
554
974
|
input?: string | undefined;
|
|
975
|
+
branch?: string | undefined;
|
|
555
976
|
systemPrompt?: string | undefined;
|
|
556
977
|
dependsOn?: string[] | undefined;
|
|
557
978
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -605,23 +1026,33 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
605
1026
|
maxIterations?: number | undefined;
|
|
606
1027
|
}>;
|
|
607
1028
|
}, "strip", z.ZodTypeAny, {
|
|
608
|
-
mode: "graph";
|
|
609
1029
|
executor: {
|
|
610
1030
|
agent: string & z.BRAND<"AgentId">;
|
|
611
1031
|
role: "executor";
|
|
612
1032
|
model: string;
|
|
613
1033
|
nodeId: string;
|
|
1034
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1035
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1036
|
+
worktreeId?: string | undefined;
|
|
614
1037
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1038
|
+
input?: string | undefined;
|
|
1039
|
+
branch?: string | undefined;
|
|
615
1040
|
systemPrompt?: string | undefined;
|
|
1041
|
+
dependsOn?: string[] | undefined;
|
|
1042
|
+
metadata?: Record<string, unknown> | undefined;
|
|
616
1043
|
};
|
|
1044
|
+
mode: "graph";
|
|
617
1045
|
workers: {
|
|
618
1046
|
agent: string & z.BRAND<"AgentId">;
|
|
619
1047
|
model: string;
|
|
620
1048
|
nodeId: string;
|
|
621
1049
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
622
1050
|
role?: string | undefined;
|
|
1051
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1052
|
+
worktreeId?: string | undefined;
|
|
623
1053
|
agentConfig?: Record<string, unknown> | undefined;
|
|
624
1054
|
input?: string | undefined;
|
|
1055
|
+
branch?: string | undefined;
|
|
625
1056
|
systemPrompt?: string | undefined;
|
|
626
1057
|
dependsOn?: string[] | undefined;
|
|
627
1058
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -639,23 +1070,33 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
639
1070
|
maxIterations: number;
|
|
640
1071
|
};
|
|
641
1072
|
}, {
|
|
642
|
-
mode: "graph";
|
|
643
1073
|
executor: {
|
|
644
1074
|
agent: string;
|
|
645
1075
|
model: string;
|
|
646
1076
|
nodeId: string;
|
|
1077
|
+
sessionId?: string | undefined;
|
|
647
1078
|
role?: "executor" | undefined;
|
|
1079
|
+
project?: string | undefined;
|
|
1080
|
+
worktreeId?: string | undefined;
|
|
648
1081
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1082
|
+
input?: string | undefined;
|
|
1083
|
+
branch?: string | undefined;
|
|
649
1084
|
systemPrompt?: string | undefined;
|
|
1085
|
+
dependsOn?: string[] | undefined;
|
|
1086
|
+
metadata?: Record<string, unknown> | undefined;
|
|
650
1087
|
};
|
|
1088
|
+
mode: "graph";
|
|
651
1089
|
workers: {
|
|
652
1090
|
agent: string;
|
|
653
1091
|
model: string;
|
|
654
1092
|
nodeId: string;
|
|
655
1093
|
sessionId?: string | undefined;
|
|
656
1094
|
role?: string | undefined;
|
|
1095
|
+
project?: string | undefined;
|
|
1096
|
+
worktreeId?: string | undefined;
|
|
657
1097
|
agentConfig?: Record<string, unknown> | undefined;
|
|
658
1098
|
input?: string | undefined;
|
|
1099
|
+
branch?: string | undefined;
|
|
659
1100
|
systemPrompt?: string | undefined;
|
|
660
1101
|
dependsOn?: string[] | undefined;
|
|
661
1102
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -672,21 +1113,221 @@ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<
|
|
|
672
1113
|
allowSelfLoop?: boolean | undefined;
|
|
673
1114
|
maxIterations?: number | undefined;
|
|
674
1115
|
};
|
|
1116
|
+
}>, z.ZodObject<{
|
|
1117
|
+
mode: z.ZodLiteral<"discussion">;
|
|
1118
|
+
/** 主题(initial input) — 所有 participant 第一轮收到这个。 */
|
|
1119
|
+
topic: z.ZodString;
|
|
1120
|
+
/** 参与者列表(无主从)。 */
|
|
1121
|
+
participants: z.ZodArray<z.ZodObject<{
|
|
1122
|
+
nodeId: z.ZodString;
|
|
1123
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
1124
|
+
model: z.ZodString;
|
|
1125
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
1126
|
+
role: z.ZodOptional<z.ZodString>;
|
|
1127
|
+
input: z.ZodOptional<z.ZodString>;
|
|
1128
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
1129
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1130
|
+
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
1131
|
+
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1132
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1133
|
+
/**
|
|
1134
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
1135
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
1136
|
+
*/
|
|
1137
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
1138
|
+
/**
|
|
1139
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
1140
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
1141
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
1142
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
1143
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
1144
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
1145
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
1146
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
1147
|
+
*/
|
|
1148
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
1149
|
+
/**
|
|
1150
|
+
* Git branch。意义联动 worktreeId:
|
|
1151
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
1152
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
1153
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
1154
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
1155
|
+
*/
|
|
1156
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
1157
|
+
}, "strip", z.ZodTypeAny, {
|
|
1158
|
+
agent: string & z.BRAND<"AgentId">;
|
|
1159
|
+
model: string;
|
|
1160
|
+
nodeId: string;
|
|
1161
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1162
|
+
role?: string | undefined;
|
|
1163
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1164
|
+
worktreeId?: string | undefined;
|
|
1165
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1166
|
+
input?: string | undefined;
|
|
1167
|
+
branch?: string | undefined;
|
|
1168
|
+
systemPrompt?: string | undefined;
|
|
1169
|
+
dependsOn?: string[] | undefined;
|
|
1170
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1171
|
+
}, {
|
|
1172
|
+
agent: string;
|
|
1173
|
+
model: string;
|
|
1174
|
+
nodeId: string;
|
|
1175
|
+
sessionId?: string | undefined;
|
|
1176
|
+
role?: string | undefined;
|
|
1177
|
+
project?: string | undefined;
|
|
1178
|
+
worktreeId?: string | undefined;
|
|
1179
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1180
|
+
input?: string | undefined;
|
|
1181
|
+
branch?: string | undefined;
|
|
1182
|
+
systemPrompt?: string | undefined;
|
|
1183
|
+
dependsOn?: string[] | undefined;
|
|
1184
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1185
|
+
}>, "many">;
|
|
1186
|
+
/** Chairman 必须是 participants 之一的 nodeId,每轮所有 participant 发完它再 review + 决定续/停。 */
|
|
1187
|
+
chairman: z.ZodString;
|
|
1188
|
+
termination: z.ZodDefault<z.ZodObject<{
|
|
1189
|
+
/** chairman 输出含该信号则终止。 */
|
|
1190
|
+
chairmanSignal: z.ZodDefault<z.ZodString>;
|
|
1191
|
+
/** 硬上限。 */
|
|
1192
|
+
maxRounds: z.ZodDefault<z.ZodNumber>;
|
|
1193
|
+
/** 自然达成共识的检测字符串(任一 participant 输出含此则终止,可选)。 */
|
|
1194
|
+
consensusSignal: z.ZodOptional<z.ZodString>;
|
|
1195
|
+
}, "strip", z.ZodTypeAny, {
|
|
1196
|
+
chairmanSignal: string;
|
|
1197
|
+
maxRounds: number;
|
|
1198
|
+
consensusSignal?: string | undefined;
|
|
1199
|
+
}, {
|
|
1200
|
+
chairmanSignal?: string | undefined;
|
|
1201
|
+
maxRounds?: number | undefined;
|
|
1202
|
+
consensusSignal?: string | undefined;
|
|
1203
|
+
}>>;
|
|
1204
|
+
}, "strip", z.ZodTypeAny, {
|
|
1205
|
+
mode: "discussion";
|
|
1206
|
+
topic: string;
|
|
1207
|
+
participants: {
|
|
1208
|
+
agent: string & z.BRAND<"AgentId">;
|
|
1209
|
+
model: string;
|
|
1210
|
+
nodeId: string;
|
|
1211
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1212
|
+
role?: string | undefined;
|
|
1213
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1214
|
+
worktreeId?: string | undefined;
|
|
1215
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1216
|
+
input?: string | undefined;
|
|
1217
|
+
branch?: string | undefined;
|
|
1218
|
+
systemPrompt?: string | undefined;
|
|
1219
|
+
dependsOn?: string[] | undefined;
|
|
1220
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1221
|
+
}[];
|
|
1222
|
+
chairman: string;
|
|
1223
|
+
termination: {
|
|
1224
|
+
chairmanSignal: string;
|
|
1225
|
+
maxRounds: number;
|
|
1226
|
+
consensusSignal?: string | undefined;
|
|
1227
|
+
};
|
|
1228
|
+
}, {
|
|
1229
|
+
mode: "discussion";
|
|
1230
|
+
topic: string;
|
|
1231
|
+
participants: {
|
|
1232
|
+
agent: string;
|
|
1233
|
+
model: string;
|
|
1234
|
+
nodeId: string;
|
|
1235
|
+
sessionId?: string | undefined;
|
|
1236
|
+
role?: string | undefined;
|
|
1237
|
+
project?: string | undefined;
|
|
1238
|
+
worktreeId?: string | undefined;
|
|
1239
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1240
|
+
input?: string | undefined;
|
|
1241
|
+
branch?: string | undefined;
|
|
1242
|
+
systemPrompt?: string | undefined;
|
|
1243
|
+
dependsOn?: string[] | undefined;
|
|
1244
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1245
|
+
}[];
|
|
1246
|
+
chairman: string;
|
|
1247
|
+
termination?: {
|
|
1248
|
+
chairmanSignal?: string | undefined;
|
|
1249
|
+
maxRounds?: number | undefined;
|
|
1250
|
+
consensusSignal?: string | undefined;
|
|
1251
|
+
} | undefined;
|
|
675
1252
|
}>]>;
|
|
676
1253
|
export type WorkflowPlan = z.infer<typeof WorkflowPlan>;
|
|
677
1254
|
export declare const WorkflowStatus: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
|
|
678
1255
|
export type WorkflowStatus = z.infer<typeof WorkflowStatus>;
|
|
679
1256
|
export declare const WorkflowNodeStatus: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
|
|
680
1257
|
export type WorkflowNodeStatus = z.infer<typeof WorkflowNodeStatus>;
|
|
1258
|
+
export declare const WorkflowPolicy: z.ZodObject<{
|
|
1259
|
+
timeoutSeconds: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1260
|
+
perNodeTimeoutSeconds: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1261
|
+
onNodeFailure: z.ZodOptional<z.ZodDefault<z.ZodEnum<["fail_workflow", "skip_dependents", "continue"]>>>;
|
|
1262
|
+
maxParallel: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1263
|
+
}, "strip", z.ZodTypeAny, {
|
|
1264
|
+
timeoutSeconds?: number | undefined;
|
|
1265
|
+
perNodeTimeoutSeconds?: number | undefined;
|
|
1266
|
+
onNodeFailure?: "continue" | "fail_workflow" | "skip_dependents" | undefined;
|
|
1267
|
+
maxParallel?: number | undefined;
|
|
1268
|
+
}, {
|
|
1269
|
+
timeoutSeconds?: number | undefined;
|
|
1270
|
+
perNodeTimeoutSeconds?: number | undefined;
|
|
1271
|
+
onNodeFailure?: "continue" | "fail_workflow" | "skip_dependents" | undefined;
|
|
1272
|
+
maxParallel?: number | undefined;
|
|
1273
|
+
}>;
|
|
1274
|
+
export type WorkflowPolicy = z.infer<typeof WorkflowPolicy>;
|
|
1275
|
+
export declare const WorkflowSharedContext: z.ZodObject<{
|
|
1276
|
+
/** 直接文本:phonon 原样追加到每个 node 的 systemPrompt。 */
|
|
1277
|
+
text: z.ZodOptional<z.ZodString>;
|
|
1278
|
+
/** workspace 相对路径列表(受 policy 沙箱);phonon 读取后拼成 markdown 段追加到 systemPrompt。 */
|
|
1279
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1280
|
+
/** 注入位置:prepend 在最前,append 在最后,默认 append。 */
|
|
1281
|
+
placement: z.ZodDefault<z.ZodEnum<["prepend", "append"]>>;
|
|
1282
|
+
}, "strip", z.ZodTypeAny, {
|
|
1283
|
+
placement: "prepend" | "append";
|
|
1284
|
+
text?: string | undefined;
|
|
1285
|
+
files?: string[] | undefined;
|
|
1286
|
+
}, {
|
|
1287
|
+
text?: string | undefined;
|
|
1288
|
+
files?: string[] | undefined;
|
|
1289
|
+
placement?: "prepend" | "append" | undefined;
|
|
1290
|
+
}>;
|
|
1291
|
+
export type WorkflowSharedContext = z.infer<typeof WorkflowSharedContext>;
|
|
1292
|
+
export declare const WorkflowResumeFrom: z.ZodObject<{
|
|
1293
|
+
/** 要恢复的 workflowId(必须先前 run 过,并有 checkpoint)。 */
|
|
1294
|
+
workflowId: z.ZodString;
|
|
1295
|
+
/**
|
|
1296
|
+
* 起点策略:
|
|
1297
|
+
* - "last_success_dependents" : 从最后成功节点的下游开始(DAG 默认)
|
|
1298
|
+
* - "failed_node" : 重跑失败的那个 node(其他成功 node 不重做)
|
|
1299
|
+
* - "node:<nodeId>" : 显式指定从某 node 开始
|
|
1300
|
+
*/
|
|
1301
|
+
strategy: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"last_success_dependents">, z.ZodLiteral<"failed_node">, z.ZodString]>>;
|
|
1302
|
+
/** 可选:重置某些 node 的状态(让它们重跑),覆盖默认策略。 */
|
|
1303
|
+
rerunNodes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1304
|
+
}, "strip", z.ZodTypeAny, {
|
|
1305
|
+
strategy: string;
|
|
1306
|
+
workflowId: string;
|
|
1307
|
+
rerunNodes?: string[] | undefined;
|
|
1308
|
+
}, {
|
|
1309
|
+
workflowId: string;
|
|
1310
|
+
strategy?: string | undefined;
|
|
1311
|
+
rerunNodes?: string[] | undefined;
|
|
1312
|
+
}>;
|
|
1313
|
+
export type WorkflowResumeFrom = z.infer<typeof WorkflowResumeFrom>;
|
|
681
1314
|
export declare const WorkflowRunParams: z.ZodObject<{
|
|
682
|
-
|
|
1315
|
+
/**
|
|
1316
|
+
* 默认 project。可以省略,但如果某个 node 也没传 project,phonon 会拒接。
|
|
1317
|
+
* v0.6 起改为可选,支持每个 node 跳不同 project 的跨项目编排场景。
|
|
1318
|
+
*/
|
|
1319
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
1320
|
+
/** 默认隔离 key;node 未传 worktreeId 时继承该值。含义及复用规则同 WorkflowNode.worktreeId。 */
|
|
683
1321
|
worktreeId: z.ZodOptional<z.ZodString>;
|
|
1322
|
+
/** 默认 branch;node 未传 branch 时继承。含义同 WorkflowNode.branch。 */
|
|
1323
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
684
1324
|
plan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
|
|
685
1325
|
mode: z.ZodLiteral<"dag">;
|
|
686
1326
|
nodes: z.ZodArray<z.ZodObject<{
|
|
687
1327
|
nodeId: z.ZodString;
|
|
688
1328
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
689
1329
|
model: z.ZodString;
|
|
1330
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
690
1331
|
role: z.ZodOptional<z.ZodString>;
|
|
691
1332
|
input: z.ZodOptional<z.ZodString>;
|
|
692
1333
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -694,14 +1335,41 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
694
1335
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
695
1336
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
696
1337
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1338
|
+
/**
|
|
1339
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
1340
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
1341
|
+
*/
|
|
1342
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
1343
|
+
/**
|
|
1344
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
1345
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
1346
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
1347
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
1348
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
1349
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
1350
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
1351
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
1352
|
+
*/
|
|
1353
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Git branch。意义联动 worktreeId:
|
|
1356
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
1357
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
1358
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
1359
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
1360
|
+
*/
|
|
1361
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
697
1362
|
}, "strip", z.ZodTypeAny, {
|
|
698
1363
|
agent: string & z.BRAND<"AgentId">;
|
|
699
1364
|
model: string;
|
|
700
1365
|
nodeId: string;
|
|
701
1366
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
702
1367
|
role?: string | undefined;
|
|
1368
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1369
|
+
worktreeId?: string | undefined;
|
|
703
1370
|
agentConfig?: Record<string, unknown> | undefined;
|
|
704
1371
|
input?: string | undefined;
|
|
1372
|
+
branch?: string | undefined;
|
|
705
1373
|
systemPrompt?: string | undefined;
|
|
706
1374
|
dependsOn?: string[] | undefined;
|
|
707
1375
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -711,8 +1379,11 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
711
1379
|
nodeId: string;
|
|
712
1380
|
sessionId?: string | undefined;
|
|
713
1381
|
role?: string | undefined;
|
|
1382
|
+
project?: string | undefined;
|
|
1383
|
+
worktreeId?: string | undefined;
|
|
714
1384
|
agentConfig?: Record<string, unknown> | undefined;
|
|
715
1385
|
input?: string | undefined;
|
|
1386
|
+
branch?: string | undefined;
|
|
716
1387
|
systemPrompt?: string | undefined;
|
|
717
1388
|
dependsOn?: string[] | undefined;
|
|
718
1389
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -748,8 +1419,11 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
748
1419
|
nodeId: string;
|
|
749
1420
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
750
1421
|
role?: string | undefined;
|
|
1422
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1423
|
+
worktreeId?: string | undefined;
|
|
751
1424
|
agentConfig?: Record<string, unknown> | undefined;
|
|
752
1425
|
input?: string | undefined;
|
|
1426
|
+
branch?: string | undefined;
|
|
753
1427
|
systemPrompt?: string | undefined;
|
|
754
1428
|
dependsOn?: string[] | undefined;
|
|
755
1429
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -771,8 +1445,11 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
771
1445
|
nodeId: string;
|
|
772
1446
|
sessionId?: string | undefined;
|
|
773
1447
|
role?: string | undefined;
|
|
1448
|
+
project?: string | undefined;
|
|
1449
|
+
worktreeId?: string | undefined;
|
|
774
1450
|
agentConfig?: Record<string, unknown> | undefined;
|
|
775
1451
|
input?: string | undefined;
|
|
1452
|
+
branch?: string | undefined;
|
|
776
1453
|
systemPrompt?: string | undefined;
|
|
777
1454
|
dependsOn?: string[] | undefined;
|
|
778
1455
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -792,28 +1469,51 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
792
1469
|
nodeId: z.ZodString;
|
|
793
1470
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
794
1471
|
model: z.ZodString;
|
|
795
|
-
|
|
1472
|
+
input: z.ZodOptional<z.ZodString>;
|
|
796
1473
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
1474
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1475
|
+
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
797
1476
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1477
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1478
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
1479
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
1480
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
1481
|
+
} & {
|
|
1482
|
+
role: z.ZodDefault<z.ZodLiteral<"executor">>;
|
|
798
1483
|
}, "strip", z.ZodTypeAny, {
|
|
799
1484
|
agent: string & z.BRAND<"AgentId">;
|
|
800
1485
|
role: "executor";
|
|
801
1486
|
model: string;
|
|
802
1487
|
nodeId: string;
|
|
1488
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1489
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1490
|
+
worktreeId?: string | undefined;
|
|
803
1491
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1492
|
+
input?: string | undefined;
|
|
1493
|
+
branch?: string | undefined;
|
|
804
1494
|
systemPrompt?: string | undefined;
|
|
1495
|
+
dependsOn?: string[] | undefined;
|
|
1496
|
+
metadata?: Record<string, unknown> | undefined;
|
|
805
1497
|
}, {
|
|
806
1498
|
agent: string;
|
|
807
1499
|
model: string;
|
|
808
1500
|
nodeId: string;
|
|
1501
|
+
sessionId?: string | undefined;
|
|
809
1502
|
role?: "executor" | undefined;
|
|
1503
|
+
project?: string | undefined;
|
|
1504
|
+
worktreeId?: string | undefined;
|
|
810
1505
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1506
|
+
input?: string | undefined;
|
|
1507
|
+
branch?: string | undefined;
|
|
811
1508
|
systemPrompt?: string | undefined;
|
|
1509
|
+
dependsOn?: string[] | undefined;
|
|
1510
|
+
metadata?: Record<string, unknown> | undefined;
|
|
812
1511
|
}>;
|
|
813
1512
|
workers: z.ZodArray<z.ZodObject<{
|
|
814
1513
|
nodeId: z.ZodString;
|
|
815
1514
|
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
816
1515
|
model: z.ZodString;
|
|
1516
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
817
1517
|
role: z.ZodOptional<z.ZodString>;
|
|
818
1518
|
input: z.ZodOptional<z.ZodString>;
|
|
819
1519
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -821,14 +1521,41 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
821
1521
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
822
1522
|
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
823
1523
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1524
|
+
/**
|
|
1525
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
1526
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
1527
|
+
*/
|
|
1528
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
1529
|
+
/**
|
|
1530
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
1531
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
1532
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
1533
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
1534
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
1535
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
1536
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
1537
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
1538
|
+
*/
|
|
1539
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
1540
|
+
/**
|
|
1541
|
+
* Git branch。意义联动 worktreeId:
|
|
1542
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
1543
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
1544
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
1545
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
1546
|
+
*/
|
|
1547
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
824
1548
|
}, "strip", z.ZodTypeAny, {
|
|
825
1549
|
agent: string & z.BRAND<"AgentId">;
|
|
826
1550
|
model: string;
|
|
827
1551
|
nodeId: string;
|
|
828
1552
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
829
1553
|
role?: string | undefined;
|
|
1554
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1555
|
+
worktreeId?: string | undefined;
|
|
830
1556
|
agentConfig?: Record<string, unknown> | undefined;
|
|
831
1557
|
input?: string | undefined;
|
|
1558
|
+
branch?: string | undefined;
|
|
832
1559
|
systemPrompt?: string | undefined;
|
|
833
1560
|
dependsOn?: string[] | undefined;
|
|
834
1561
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -838,8 +1565,11 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
838
1565
|
nodeId: string;
|
|
839
1566
|
sessionId?: string | undefined;
|
|
840
1567
|
role?: string | undefined;
|
|
1568
|
+
project?: string | undefined;
|
|
1569
|
+
worktreeId?: string | undefined;
|
|
841
1570
|
agentConfig?: Record<string, unknown> | undefined;
|
|
842
1571
|
input?: string | undefined;
|
|
1572
|
+
branch?: string | undefined;
|
|
843
1573
|
systemPrompt?: string | undefined;
|
|
844
1574
|
dependsOn?: string[] | undefined;
|
|
845
1575
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -893,23 +1623,33 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
893
1623
|
maxIterations?: number | undefined;
|
|
894
1624
|
}>;
|
|
895
1625
|
}, "strip", z.ZodTypeAny, {
|
|
896
|
-
mode: "graph";
|
|
897
1626
|
executor: {
|
|
898
1627
|
agent: string & z.BRAND<"AgentId">;
|
|
899
1628
|
role: "executor";
|
|
900
1629
|
model: string;
|
|
901
1630
|
nodeId: string;
|
|
1631
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1632
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1633
|
+
worktreeId?: string | undefined;
|
|
902
1634
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1635
|
+
input?: string | undefined;
|
|
1636
|
+
branch?: string | undefined;
|
|
903
1637
|
systemPrompt?: string | undefined;
|
|
1638
|
+
dependsOn?: string[] | undefined;
|
|
1639
|
+
metadata?: Record<string, unknown> | undefined;
|
|
904
1640
|
};
|
|
1641
|
+
mode: "graph";
|
|
905
1642
|
workers: {
|
|
906
1643
|
agent: string & z.BRAND<"AgentId">;
|
|
907
1644
|
model: string;
|
|
908
1645
|
nodeId: string;
|
|
909
1646
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
910
1647
|
role?: string | undefined;
|
|
1648
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1649
|
+
worktreeId?: string | undefined;
|
|
911
1650
|
agentConfig?: Record<string, unknown> | undefined;
|
|
912
1651
|
input?: string | undefined;
|
|
1652
|
+
branch?: string | undefined;
|
|
913
1653
|
systemPrompt?: string | undefined;
|
|
914
1654
|
dependsOn?: string[] | undefined;
|
|
915
1655
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -927,23 +1667,33 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
927
1667
|
maxIterations: number;
|
|
928
1668
|
};
|
|
929
1669
|
}, {
|
|
930
|
-
mode: "graph";
|
|
931
1670
|
executor: {
|
|
932
1671
|
agent: string;
|
|
933
1672
|
model: string;
|
|
934
1673
|
nodeId: string;
|
|
1674
|
+
sessionId?: string | undefined;
|
|
935
1675
|
role?: "executor" | undefined;
|
|
1676
|
+
project?: string | undefined;
|
|
1677
|
+
worktreeId?: string | undefined;
|
|
936
1678
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1679
|
+
input?: string | undefined;
|
|
1680
|
+
branch?: string | undefined;
|
|
937
1681
|
systemPrompt?: string | undefined;
|
|
1682
|
+
dependsOn?: string[] | undefined;
|
|
1683
|
+
metadata?: Record<string, unknown> | undefined;
|
|
938
1684
|
};
|
|
1685
|
+
mode: "graph";
|
|
939
1686
|
workers: {
|
|
940
1687
|
agent: string;
|
|
941
1688
|
model: string;
|
|
942
1689
|
nodeId: string;
|
|
943
1690
|
sessionId?: string | undefined;
|
|
944
1691
|
role?: string | undefined;
|
|
1692
|
+
project?: string | undefined;
|
|
1693
|
+
worktreeId?: string | undefined;
|
|
945
1694
|
agentConfig?: Record<string, unknown> | undefined;
|
|
946
1695
|
input?: string | undefined;
|
|
1696
|
+
branch?: string | undefined;
|
|
947
1697
|
systemPrompt?: string | undefined;
|
|
948
1698
|
dependsOn?: string[] | undefined;
|
|
949
1699
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -960,12 +1710,202 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
960
1710
|
allowSelfLoop?: boolean | undefined;
|
|
961
1711
|
maxIterations?: number | undefined;
|
|
962
1712
|
};
|
|
1713
|
+
}>, z.ZodObject<{
|
|
1714
|
+
mode: z.ZodLiteral<"discussion">;
|
|
1715
|
+
/** 主题(initial input) — 所有 participant 第一轮收到这个。 */
|
|
1716
|
+
topic: z.ZodString;
|
|
1717
|
+
/** 参与者列表(无主从)。 */
|
|
1718
|
+
participants: z.ZodArray<z.ZodObject<{
|
|
1719
|
+
nodeId: z.ZodString;
|
|
1720
|
+
agent: z.ZodBranded<z.ZodString, "AgentId">;
|
|
1721
|
+
model: z.ZodString;
|
|
1722
|
+
/** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
|
|
1723
|
+
role: z.ZodOptional<z.ZodString>;
|
|
1724
|
+
input: z.ZodOptional<z.ZodString>;
|
|
1725
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
1726
|
+
dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1727
|
+
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
1728
|
+
agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1729
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1730
|
+
/**
|
|
1731
|
+
* 此节点跑在哪个 project。不传默认继承 workflow 级 project。
|
|
1732
|
+
* project + workflow 级都没传,phonon 拒接。
|
|
1733
|
+
*/
|
|
1734
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
1735
|
+
/**
|
|
1736
|
+
* 隔离 key。调用方自定义的任意字符串。
|
|
1737
|
+
* - 不传 → 该节点跑在 project 主目录
|
|
1738
|
+
* - 传了 → phonon 按 (projectId, worktreeId) 复合键维护隔离 worktree:
|
|
1739
|
+
* • 同一 workflow 内首次看到 → 创建 worktree(branch 名 phonon 自动生成)
|
|
1740
|
+
* • 同一 workflow 内后续节点用同一 key → 复用同一 worktree
|
|
1741
|
+
* • 不跨 workflow 复用(下次 workflow.run 同名 key 是新 worktree)
|
|
1742
|
+
* - workflow 终态时 phonon 尝试自动清理:git status 干净则 worktree remove;dirty 则保留
|
|
1743
|
+
* 且发 workflow.status payload warn。创出的 branch 一律不删。
|
|
1744
|
+
*/
|
|
1745
|
+
worktreeId: z.ZodOptional<z.ZodString>;
|
|
1746
|
+
/**
|
|
1747
|
+
* Git branch。意义联动 worktreeId:
|
|
1748
|
+
* - 不传 worktreeId 传 branch → 在 project 主目录先 `git checkout <branch>` 再跑(对主目录有副作用,法定调用方负责)
|
|
1749
|
+
* - 传 worktreeId 首次传 branch → 作为新 worktree 的 base branch(从它检出)
|
|
1750
|
+
* - 传 worktreeId 未传 branch 首次 → 从 project 当前 branch 检出
|
|
1751
|
+
* - worktreeId 复用时 branch 被忽略(worktree 已存在)
|
|
1752
|
+
*/
|
|
1753
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
1754
|
+
}, "strip", z.ZodTypeAny, {
|
|
1755
|
+
agent: string & z.BRAND<"AgentId">;
|
|
1756
|
+
model: string;
|
|
1757
|
+
nodeId: string;
|
|
1758
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1759
|
+
role?: string | undefined;
|
|
1760
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1761
|
+
worktreeId?: string | undefined;
|
|
1762
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1763
|
+
input?: string | undefined;
|
|
1764
|
+
branch?: string | undefined;
|
|
1765
|
+
systemPrompt?: string | undefined;
|
|
1766
|
+
dependsOn?: string[] | undefined;
|
|
1767
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1768
|
+
}, {
|
|
1769
|
+
agent: string;
|
|
1770
|
+
model: string;
|
|
1771
|
+
nodeId: string;
|
|
1772
|
+
sessionId?: string | undefined;
|
|
1773
|
+
role?: string | undefined;
|
|
1774
|
+
project?: string | undefined;
|
|
1775
|
+
worktreeId?: string | undefined;
|
|
1776
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1777
|
+
input?: string | undefined;
|
|
1778
|
+
branch?: string | undefined;
|
|
1779
|
+
systemPrompt?: string | undefined;
|
|
1780
|
+
dependsOn?: string[] | undefined;
|
|
1781
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1782
|
+
}>, "many">;
|
|
1783
|
+
/** Chairman 必须是 participants 之一的 nodeId,每轮所有 participant 发完它再 review + 决定续/停。 */
|
|
1784
|
+
chairman: z.ZodString;
|
|
1785
|
+
termination: z.ZodDefault<z.ZodObject<{
|
|
1786
|
+
/** chairman 输出含该信号则终止。 */
|
|
1787
|
+
chairmanSignal: z.ZodDefault<z.ZodString>;
|
|
1788
|
+
/** 硬上限。 */
|
|
1789
|
+
maxRounds: z.ZodDefault<z.ZodNumber>;
|
|
1790
|
+
/** 自然达成共识的检测字符串(任一 participant 输出含此则终止,可选)。 */
|
|
1791
|
+
consensusSignal: z.ZodOptional<z.ZodString>;
|
|
1792
|
+
}, "strip", z.ZodTypeAny, {
|
|
1793
|
+
chairmanSignal: string;
|
|
1794
|
+
maxRounds: number;
|
|
1795
|
+
consensusSignal?: string | undefined;
|
|
1796
|
+
}, {
|
|
1797
|
+
chairmanSignal?: string | undefined;
|
|
1798
|
+
maxRounds?: number | undefined;
|
|
1799
|
+
consensusSignal?: string | undefined;
|
|
1800
|
+
}>>;
|
|
1801
|
+
}, "strip", z.ZodTypeAny, {
|
|
1802
|
+
mode: "discussion";
|
|
1803
|
+
topic: string;
|
|
1804
|
+
participants: {
|
|
1805
|
+
agent: string & z.BRAND<"AgentId">;
|
|
1806
|
+
model: string;
|
|
1807
|
+
nodeId: string;
|
|
1808
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1809
|
+
role?: string | undefined;
|
|
1810
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1811
|
+
worktreeId?: string | undefined;
|
|
1812
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1813
|
+
input?: string | undefined;
|
|
1814
|
+
branch?: string | undefined;
|
|
1815
|
+
systemPrompt?: string | undefined;
|
|
1816
|
+
dependsOn?: string[] | undefined;
|
|
1817
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1818
|
+
}[];
|
|
1819
|
+
chairman: string;
|
|
1820
|
+
termination: {
|
|
1821
|
+
chairmanSignal: string;
|
|
1822
|
+
maxRounds: number;
|
|
1823
|
+
consensusSignal?: string | undefined;
|
|
1824
|
+
};
|
|
1825
|
+
}, {
|
|
1826
|
+
mode: "discussion";
|
|
1827
|
+
topic: string;
|
|
1828
|
+
participants: {
|
|
1829
|
+
agent: string;
|
|
1830
|
+
model: string;
|
|
1831
|
+
nodeId: string;
|
|
1832
|
+
sessionId?: string | undefined;
|
|
1833
|
+
role?: string | undefined;
|
|
1834
|
+
project?: string | undefined;
|
|
1835
|
+
worktreeId?: string | undefined;
|
|
1836
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1837
|
+
input?: string | undefined;
|
|
1838
|
+
branch?: string | undefined;
|
|
1839
|
+
systemPrompt?: string | undefined;
|
|
1840
|
+
dependsOn?: string[] | undefined;
|
|
1841
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1842
|
+
}[];
|
|
1843
|
+
chairman: string;
|
|
1844
|
+
termination?: {
|
|
1845
|
+
chairmanSignal?: string | undefined;
|
|
1846
|
+
maxRounds?: number | undefined;
|
|
1847
|
+
consensusSignal?: string | undefined;
|
|
1848
|
+
} | undefined;
|
|
963
1849
|
}>]>;
|
|
964
1850
|
input: z.ZodOptional<z.ZodString>;
|
|
1851
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
1852
|
+
timeoutSeconds: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1853
|
+
perNodeTimeoutSeconds: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1854
|
+
onNodeFailure: z.ZodOptional<z.ZodDefault<z.ZodEnum<["fail_workflow", "skip_dependents", "continue"]>>>;
|
|
1855
|
+
maxParallel: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
1856
|
+
}, "strip", z.ZodTypeAny, {
|
|
1857
|
+
timeoutSeconds?: number | undefined;
|
|
1858
|
+
perNodeTimeoutSeconds?: number | undefined;
|
|
1859
|
+
onNodeFailure?: "continue" | "fail_workflow" | "skip_dependents" | undefined;
|
|
1860
|
+
maxParallel?: number | undefined;
|
|
1861
|
+
}, {
|
|
1862
|
+
timeoutSeconds?: number | undefined;
|
|
1863
|
+
perNodeTimeoutSeconds?: number | undefined;
|
|
1864
|
+
onNodeFailure?: "continue" | "fail_workflow" | "skip_dependents" | undefined;
|
|
1865
|
+
maxParallel?: number | undefined;
|
|
1866
|
+
}>>;
|
|
1867
|
+
/** 共享上下文(v0.5 新增)。 */
|
|
1868
|
+
sharedContext: z.ZodOptional<z.ZodObject<{
|
|
1869
|
+
/** 直接文本:phonon 原样追加到每个 node 的 systemPrompt。 */
|
|
1870
|
+
text: z.ZodOptional<z.ZodString>;
|
|
1871
|
+
/** workspace 相对路径列表(受 policy 沙箱);phonon 读取后拼成 markdown 段追加到 systemPrompt。 */
|
|
1872
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1873
|
+
/** 注入位置:prepend 在最前,append 在最后,默认 append。 */
|
|
1874
|
+
placement: z.ZodDefault<z.ZodEnum<["prepend", "append"]>>;
|
|
1875
|
+
}, "strip", z.ZodTypeAny, {
|
|
1876
|
+
placement: "prepend" | "append";
|
|
1877
|
+
text?: string | undefined;
|
|
1878
|
+
files?: string[] | undefined;
|
|
1879
|
+
}, {
|
|
1880
|
+
text?: string | undefined;
|
|
1881
|
+
files?: string[] | undefined;
|
|
1882
|
+
placement?: "prepend" | "append" | undefined;
|
|
1883
|
+
}>>;
|
|
1884
|
+
/** 断点续跑(v0.5 新增)。传入则跳过 plan 重新规划,从 checkpoint 恢复。 */
|
|
1885
|
+
resumeFrom: z.ZodOptional<z.ZodObject<{
|
|
1886
|
+
/** 要恢复的 workflowId(必须先前 run 过,并有 checkpoint)。 */
|
|
1887
|
+
workflowId: z.ZodString;
|
|
1888
|
+
/**
|
|
1889
|
+
* 起点策略:
|
|
1890
|
+
* - "last_success_dependents" : 从最后成功节点的下游开始(DAG 默认)
|
|
1891
|
+
* - "failed_node" : 重跑失败的那个 node(其他成功 node 不重做)
|
|
1892
|
+
* - "node:<nodeId>" : 显式指定从某 node 开始
|
|
1893
|
+
*/
|
|
1894
|
+
strategy: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"last_success_dependents">, z.ZodLiteral<"failed_node">, z.ZodString]>>;
|
|
1895
|
+
/** 可选:重置某些 node 的状态(让它们重跑),覆盖默认策略。 */
|
|
1896
|
+
rerunNodes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1897
|
+
}, "strip", z.ZodTypeAny, {
|
|
1898
|
+
strategy: string;
|
|
1899
|
+
workflowId: string;
|
|
1900
|
+
rerunNodes?: string[] | undefined;
|
|
1901
|
+
}, {
|
|
1902
|
+
workflowId: string;
|
|
1903
|
+
strategy?: string | undefined;
|
|
1904
|
+
rerunNodes?: string[] | undefined;
|
|
1905
|
+
}>>;
|
|
965
1906
|
clientRequestId: z.ZodOptional<z.ZodString>;
|
|
966
1907
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
967
1908
|
}, "strip", z.ZodTypeAny, {
|
|
968
|
-
project: string & z.BRAND<"ProjectId">;
|
|
969
1909
|
plan: {
|
|
970
1910
|
mode: "dag";
|
|
971
1911
|
nodes: {
|
|
@@ -974,8 +1914,11 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
974
1914
|
nodeId: string;
|
|
975
1915
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
976
1916
|
role?: string | undefined;
|
|
1917
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1918
|
+
worktreeId?: string | undefined;
|
|
977
1919
|
agentConfig?: Record<string, unknown> | undefined;
|
|
978
1920
|
input?: string | undefined;
|
|
1921
|
+
branch?: string | undefined;
|
|
979
1922
|
systemPrompt?: string | undefined;
|
|
980
1923
|
dependsOn?: string[] | undefined;
|
|
981
1924
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -990,23 +1933,33 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
990
1933
|
}[] | undefined;
|
|
991
1934
|
finalNodeId?: string | undefined;
|
|
992
1935
|
} | {
|
|
993
|
-
mode: "graph";
|
|
994
1936
|
executor: {
|
|
995
1937
|
agent: string & z.BRAND<"AgentId">;
|
|
996
1938
|
role: "executor";
|
|
997
1939
|
model: string;
|
|
998
1940
|
nodeId: string;
|
|
1941
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1942
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1943
|
+
worktreeId?: string | undefined;
|
|
999
1944
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1945
|
+
input?: string | undefined;
|
|
1946
|
+
branch?: string | undefined;
|
|
1000
1947
|
systemPrompt?: string | undefined;
|
|
1948
|
+
dependsOn?: string[] | undefined;
|
|
1949
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1001
1950
|
};
|
|
1951
|
+
mode: "graph";
|
|
1002
1952
|
workers: {
|
|
1003
1953
|
agent: string & z.BRAND<"AgentId">;
|
|
1004
1954
|
model: string;
|
|
1005
1955
|
nodeId: string;
|
|
1006
1956
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1007
1957
|
role?: string | undefined;
|
|
1958
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1959
|
+
worktreeId?: string | undefined;
|
|
1008
1960
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1009
1961
|
input?: string | undefined;
|
|
1962
|
+
branch?: string | undefined;
|
|
1010
1963
|
systemPrompt?: string | undefined;
|
|
1011
1964
|
dependsOn?: string[] | undefined;
|
|
1012
1965
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -1023,13 +1976,54 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
1023
1976
|
allowSelfLoop: boolean;
|
|
1024
1977
|
maxIterations: number;
|
|
1025
1978
|
};
|
|
1979
|
+
} | {
|
|
1980
|
+
mode: "discussion";
|
|
1981
|
+
topic: string;
|
|
1982
|
+
participants: {
|
|
1983
|
+
agent: string & z.BRAND<"AgentId">;
|
|
1984
|
+
model: string;
|
|
1985
|
+
nodeId: string;
|
|
1986
|
+
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1987
|
+
role?: string | undefined;
|
|
1988
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1989
|
+
worktreeId?: string | undefined;
|
|
1990
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
1991
|
+
input?: string | undefined;
|
|
1992
|
+
branch?: string | undefined;
|
|
1993
|
+
systemPrompt?: string | undefined;
|
|
1994
|
+
dependsOn?: string[] | undefined;
|
|
1995
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1996
|
+
}[];
|
|
1997
|
+
chairman: string;
|
|
1998
|
+
termination: {
|
|
1999
|
+
chairmanSignal: string;
|
|
2000
|
+
maxRounds: number;
|
|
2001
|
+
consensusSignal?: string | undefined;
|
|
2002
|
+
};
|
|
1026
2003
|
};
|
|
1027
2004
|
clientRequestId?: string | undefined;
|
|
2005
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1028
2006
|
worktreeId?: string | undefined;
|
|
1029
2007
|
input?: string | undefined;
|
|
2008
|
+
branch?: string | undefined;
|
|
2009
|
+
resumeFrom?: {
|
|
2010
|
+
strategy: string;
|
|
2011
|
+
workflowId: string;
|
|
2012
|
+
rerunNodes?: string[] | undefined;
|
|
2013
|
+
} | undefined;
|
|
1030
2014
|
metadata?: Record<string, unknown> | undefined;
|
|
2015
|
+
policy?: {
|
|
2016
|
+
timeoutSeconds?: number | undefined;
|
|
2017
|
+
perNodeTimeoutSeconds?: number | undefined;
|
|
2018
|
+
onNodeFailure?: "continue" | "fail_workflow" | "skip_dependents" | undefined;
|
|
2019
|
+
maxParallel?: number | undefined;
|
|
2020
|
+
} | undefined;
|
|
2021
|
+
sharedContext?: {
|
|
2022
|
+
placement: "prepend" | "append";
|
|
2023
|
+
text?: string | undefined;
|
|
2024
|
+
files?: string[] | undefined;
|
|
2025
|
+
} | undefined;
|
|
1031
2026
|
}, {
|
|
1032
|
-
project: string;
|
|
1033
2027
|
plan: {
|
|
1034
2028
|
mode: "dag";
|
|
1035
2029
|
nodes: {
|
|
@@ -1038,8 +2032,11 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
1038
2032
|
nodeId: string;
|
|
1039
2033
|
sessionId?: string | undefined;
|
|
1040
2034
|
role?: string | undefined;
|
|
2035
|
+
project?: string | undefined;
|
|
2036
|
+
worktreeId?: string | undefined;
|
|
1041
2037
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1042
2038
|
input?: string | undefined;
|
|
2039
|
+
branch?: string | undefined;
|
|
1043
2040
|
systemPrompt?: string | undefined;
|
|
1044
2041
|
dependsOn?: string[] | undefined;
|
|
1045
2042
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -1054,23 +2051,33 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
1054
2051
|
}[] | undefined;
|
|
1055
2052
|
finalNodeId?: string | undefined;
|
|
1056
2053
|
} | {
|
|
1057
|
-
mode: "graph";
|
|
1058
2054
|
executor: {
|
|
1059
2055
|
agent: string;
|
|
1060
2056
|
model: string;
|
|
1061
2057
|
nodeId: string;
|
|
2058
|
+
sessionId?: string | undefined;
|
|
1062
2059
|
role?: "executor" | undefined;
|
|
2060
|
+
project?: string | undefined;
|
|
2061
|
+
worktreeId?: string | undefined;
|
|
1063
2062
|
agentConfig?: Record<string, unknown> | undefined;
|
|
2063
|
+
input?: string | undefined;
|
|
2064
|
+
branch?: string | undefined;
|
|
1064
2065
|
systemPrompt?: string | undefined;
|
|
2066
|
+
dependsOn?: string[] | undefined;
|
|
2067
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1065
2068
|
};
|
|
2069
|
+
mode: "graph";
|
|
1066
2070
|
workers: {
|
|
1067
2071
|
agent: string;
|
|
1068
2072
|
model: string;
|
|
1069
2073
|
nodeId: string;
|
|
1070
2074
|
sessionId?: string | undefined;
|
|
1071
2075
|
role?: string | undefined;
|
|
2076
|
+
project?: string | undefined;
|
|
2077
|
+
worktreeId?: string | undefined;
|
|
1072
2078
|
agentConfig?: Record<string, unknown> | undefined;
|
|
1073
2079
|
input?: string | undefined;
|
|
2080
|
+
branch?: string | undefined;
|
|
1074
2081
|
systemPrompt?: string | undefined;
|
|
1075
2082
|
dependsOn?: string[] | undefined;
|
|
1076
2083
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -1087,35 +2094,102 @@ export declare const WorkflowRunParams: z.ZodObject<{
|
|
|
1087
2094
|
allowSelfLoop?: boolean | undefined;
|
|
1088
2095
|
maxIterations?: number | undefined;
|
|
1089
2096
|
};
|
|
2097
|
+
} | {
|
|
2098
|
+
mode: "discussion";
|
|
2099
|
+
topic: string;
|
|
2100
|
+
participants: {
|
|
2101
|
+
agent: string;
|
|
2102
|
+
model: string;
|
|
2103
|
+
nodeId: string;
|
|
2104
|
+
sessionId?: string | undefined;
|
|
2105
|
+
role?: string | undefined;
|
|
2106
|
+
project?: string | undefined;
|
|
2107
|
+
worktreeId?: string | undefined;
|
|
2108
|
+
agentConfig?: Record<string, unknown> | undefined;
|
|
2109
|
+
input?: string | undefined;
|
|
2110
|
+
branch?: string | undefined;
|
|
2111
|
+
systemPrompt?: string | undefined;
|
|
2112
|
+
dependsOn?: string[] | undefined;
|
|
2113
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2114
|
+
}[];
|
|
2115
|
+
chairman: string;
|
|
2116
|
+
termination?: {
|
|
2117
|
+
chairmanSignal?: string | undefined;
|
|
2118
|
+
maxRounds?: number | undefined;
|
|
2119
|
+
consensusSignal?: string | undefined;
|
|
2120
|
+
} | undefined;
|
|
1090
2121
|
};
|
|
1091
2122
|
clientRequestId?: string | undefined;
|
|
2123
|
+
project?: string | undefined;
|
|
1092
2124
|
worktreeId?: string | undefined;
|
|
1093
2125
|
input?: string | undefined;
|
|
2126
|
+
branch?: string | undefined;
|
|
2127
|
+
resumeFrom?: {
|
|
2128
|
+
workflowId: string;
|
|
2129
|
+
strategy?: string | undefined;
|
|
2130
|
+
rerunNodes?: string[] | undefined;
|
|
2131
|
+
} | undefined;
|
|
1094
2132
|
metadata?: Record<string, unknown> | undefined;
|
|
2133
|
+
policy?: {
|
|
2134
|
+
timeoutSeconds?: number | undefined;
|
|
2135
|
+
perNodeTimeoutSeconds?: number | undefined;
|
|
2136
|
+
onNodeFailure?: "continue" | "fail_workflow" | "skip_dependents" | undefined;
|
|
2137
|
+
maxParallel?: number | undefined;
|
|
2138
|
+
} | undefined;
|
|
2139
|
+
sharedContext?: {
|
|
2140
|
+
text?: string | undefined;
|
|
2141
|
+
files?: string[] | undefined;
|
|
2142
|
+
placement?: "prepend" | "append" | undefined;
|
|
2143
|
+
} | undefined;
|
|
1095
2144
|
}>;
|
|
1096
2145
|
export type WorkflowRunParams = z.infer<typeof WorkflowRunParams>;
|
|
1097
2146
|
export declare const WorkflowRunResult: z.ZodObject<{
|
|
1098
2147
|
workflowId: z.ZodString;
|
|
1099
2148
|
status: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
|
|
1100
2149
|
createdAt: z.ZodString;
|
|
2150
|
+
/** 是否走的 resume 路径。 */
|
|
2151
|
+
resumed: z.ZodDefault<z.ZodBoolean>;
|
|
1101
2152
|
}, "strip", z.ZodTypeAny, {
|
|
1102
2153
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1103
2154
|
createdAt: string;
|
|
1104
2155
|
workflowId: string;
|
|
2156
|
+
resumed: boolean;
|
|
1105
2157
|
}, {
|
|
1106
2158
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1107
2159
|
createdAt: string;
|
|
1108
2160
|
workflowId: string;
|
|
2161
|
+
resumed?: boolean | undefined;
|
|
1109
2162
|
}>;
|
|
1110
2163
|
export type WorkflowRunResult = z.infer<typeof WorkflowRunResult>;
|
|
1111
|
-
export declare const
|
|
1112
|
-
|
|
2164
|
+
export declare const WorkflowNodeResult: z.ZodObject<{
|
|
2165
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2166
|
+
status: z.ZodEnum<["completed", "interrupted", "aborted", "failed", "timeout"]>;
|
|
2167
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2168
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2169
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2170
|
+
}, "strip", z.ZodTypeAny, {
|
|
2171
|
+
inputTokens?: number | undefined;
|
|
2172
|
+
outputTokens?: number | undefined;
|
|
2173
|
+
}, {
|
|
2174
|
+
inputTokens?: number | undefined;
|
|
2175
|
+
outputTokens?: number | undefined;
|
|
2176
|
+
}>>;
|
|
1113
2177
|
}, "strip", z.ZodTypeAny, {
|
|
1114
|
-
|
|
2178
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2179
|
+
text?: string | undefined;
|
|
2180
|
+
usage?: {
|
|
2181
|
+
inputTokens?: number | undefined;
|
|
2182
|
+
outputTokens?: number | undefined;
|
|
2183
|
+
} | undefined;
|
|
1115
2184
|
}, {
|
|
1116
|
-
|
|
2185
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2186
|
+
text?: string | undefined;
|
|
2187
|
+
usage?: {
|
|
2188
|
+
inputTokens?: number | undefined;
|
|
2189
|
+
outputTokens?: number | undefined;
|
|
2190
|
+
} | undefined;
|
|
1117
2191
|
}>;
|
|
1118
|
-
export type
|
|
2192
|
+
export type WorkflowNodeResult = z.infer<typeof WorkflowNodeResult>;
|
|
1119
2193
|
export declare const WorkflowNodeRuntime: z.ZodObject<{
|
|
1120
2194
|
nodeId: z.ZodString;
|
|
1121
2195
|
status: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
|
|
@@ -1127,6 +2201,36 @@ export declare const WorkflowNodeRuntime: z.ZodObject<{
|
|
|
1127
2201
|
startedAt: z.ZodOptional<z.ZodString>;
|
|
1128
2202
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
1129
2203
|
error: z.ZodOptional<z.ZodString>;
|
|
2204
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
2205
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2206
|
+
status: z.ZodEnum<["completed", "interrupted", "aborted", "failed", "timeout"]>;
|
|
2207
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2208
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2209
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2210
|
+
}, "strip", z.ZodTypeAny, {
|
|
2211
|
+
inputTokens?: number | undefined;
|
|
2212
|
+
outputTokens?: number | undefined;
|
|
2213
|
+
}, {
|
|
2214
|
+
inputTokens?: number | undefined;
|
|
2215
|
+
outputTokens?: number | undefined;
|
|
2216
|
+
}>>;
|
|
2217
|
+
}, "strip", z.ZodTypeAny, {
|
|
2218
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2219
|
+
text?: string | undefined;
|
|
2220
|
+
usage?: {
|
|
2221
|
+
inputTokens?: number | undefined;
|
|
2222
|
+
outputTokens?: number | undefined;
|
|
2223
|
+
} | undefined;
|
|
2224
|
+
}, {
|
|
2225
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2226
|
+
text?: string | undefined;
|
|
2227
|
+
usage?: {
|
|
2228
|
+
inputTokens?: number | undefined;
|
|
2229
|
+
outputTokens?: number | undefined;
|
|
2230
|
+
} | undefined;
|
|
2231
|
+
}>>;
|
|
2232
|
+
/** 该节点完成的轮次计数(discussion 用;DAG/Graph 一次执行 = 1)。 */
|
|
2233
|
+
iterations: z.ZodOptional<z.ZodNumber>;
|
|
1130
2234
|
}, "strip", z.ZodTypeAny, {
|
|
1131
2235
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
1132
2236
|
agent: string & z.BRAND<"AgentId">;
|
|
@@ -1135,9 +2239,18 @@ export declare const WorkflowNodeRuntime: z.ZodObject<{
|
|
|
1135
2239
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1136
2240
|
role?: string | undefined;
|
|
1137
2241
|
turnId?: string | undefined;
|
|
2242
|
+
result?: {
|
|
2243
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2244
|
+
text?: string | undefined;
|
|
2245
|
+
usage?: {
|
|
2246
|
+
inputTokens?: number | undefined;
|
|
2247
|
+
outputTokens?: number | undefined;
|
|
2248
|
+
} | undefined;
|
|
2249
|
+
} | undefined;
|
|
1138
2250
|
error?: string | undefined;
|
|
1139
2251
|
startedAt?: string | undefined;
|
|
1140
2252
|
completedAt?: string | undefined;
|
|
2253
|
+
iterations?: number | undefined;
|
|
1141
2254
|
}, {
|
|
1142
2255
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
1143
2256
|
agent: string;
|
|
@@ -1146,16 +2259,34 @@ export declare const WorkflowNodeRuntime: z.ZodObject<{
|
|
|
1146
2259
|
sessionId?: string | undefined;
|
|
1147
2260
|
role?: string | undefined;
|
|
1148
2261
|
turnId?: string | undefined;
|
|
2262
|
+
result?: {
|
|
2263
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2264
|
+
text?: string | undefined;
|
|
2265
|
+
usage?: {
|
|
2266
|
+
inputTokens?: number | undefined;
|
|
2267
|
+
outputTokens?: number | undefined;
|
|
2268
|
+
} | undefined;
|
|
2269
|
+
} | undefined;
|
|
1149
2270
|
error?: string | undefined;
|
|
1150
2271
|
startedAt?: string | undefined;
|
|
1151
2272
|
completedAt?: string | undefined;
|
|
2273
|
+
iterations?: number | undefined;
|
|
1152
2274
|
}>;
|
|
1153
2275
|
export type WorkflowNodeRuntime = z.infer<typeof WorkflowNodeRuntime>;
|
|
2276
|
+
export declare const WorkflowStatusParams: z.ZodObject<{
|
|
2277
|
+
workflowId: z.ZodString;
|
|
2278
|
+
}, "strip", z.ZodTypeAny, {
|
|
2279
|
+
workflowId: string;
|
|
2280
|
+
}, {
|
|
2281
|
+
workflowId: string;
|
|
2282
|
+
}>;
|
|
2283
|
+
export type WorkflowStatusParams = z.infer<typeof WorkflowStatusParams>;
|
|
1154
2284
|
export declare const WorkflowStatusResult: z.ZodObject<{
|
|
1155
2285
|
workflowId: z.ZodString;
|
|
1156
2286
|
status: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
|
|
1157
|
-
project
|
|
1158
|
-
|
|
2287
|
+
/** workflow 默认 project;v0.6 起可选。 */
|
|
2288
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
2289
|
+
mode: z.ZodEnum<["dag", "graph", "discussion"]>;
|
|
1159
2290
|
nodes: z.ZodArray<z.ZodObject<{
|
|
1160
2291
|
nodeId: z.ZodString;
|
|
1161
2292
|
status: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
|
|
@@ -1167,6 +2298,36 @@ export declare const WorkflowStatusResult: z.ZodObject<{
|
|
|
1167
2298
|
startedAt: z.ZodOptional<z.ZodString>;
|
|
1168
2299
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
1169
2300
|
error: z.ZodOptional<z.ZodString>;
|
|
2301
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
2302
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2303
|
+
status: z.ZodEnum<["completed", "interrupted", "aborted", "failed", "timeout"]>;
|
|
2304
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2305
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2306
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2307
|
+
}, "strip", z.ZodTypeAny, {
|
|
2308
|
+
inputTokens?: number | undefined;
|
|
2309
|
+
outputTokens?: number | undefined;
|
|
2310
|
+
}, {
|
|
2311
|
+
inputTokens?: number | undefined;
|
|
2312
|
+
outputTokens?: number | undefined;
|
|
2313
|
+
}>>;
|
|
2314
|
+
}, "strip", z.ZodTypeAny, {
|
|
2315
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2316
|
+
text?: string | undefined;
|
|
2317
|
+
usage?: {
|
|
2318
|
+
inputTokens?: number | undefined;
|
|
2319
|
+
outputTokens?: number | undefined;
|
|
2320
|
+
} | undefined;
|
|
2321
|
+
}, {
|
|
2322
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2323
|
+
text?: string | undefined;
|
|
2324
|
+
usage?: {
|
|
2325
|
+
inputTokens?: number | undefined;
|
|
2326
|
+
outputTokens?: number | undefined;
|
|
2327
|
+
} | undefined;
|
|
2328
|
+
}>>;
|
|
2329
|
+
/** 该节点完成的轮次计数(discussion 用;DAG/Graph 一次执行 = 1)。 */
|
|
2330
|
+
iterations: z.ZodOptional<z.ZodNumber>;
|
|
1170
2331
|
}, "strip", z.ZodTypeAny, {
|
|
1171
2332
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
1172
2333
|
agent: string & z.BRAND<"AgentId">;
|
|
@@ -1175,9 +2336,18 @@ export declare const WorkflowStatusResult: z.ZodObject<{
|
|
|
1175
2336
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1176
2337
|
role?: string | undefined;
|
|
1177
2338
|
turnId?: string | undefined;
|
|
2339
|
+
result?: {
|
|
2340
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2341
|
+
text?: string | undefined;
|
|
2342
|
+
usage?: {
|
|
2343
|
+
inputTokens?: number | undefined;
|
|
2344
|
+
outputTokens?: number | undefined;
|
|
2345
|
+
} | undefined;
|
|
2346
|
+
} | undefined;
|
|
1178
2347
|
error?: string | undefined;
|
|
1179
2348
|
startedAt?: string | undefined;
|
|
1180
2349
|
completedAt?: string | undefined;
|
|
2350
|
+
iterations?: number | undefined;
|
|
1181
2351
|
}, {
|
|
1182
2352
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
1183
2353
|
agent: string;
|
|
@@ -1186,19 +2356,31 @@ export declare const WorkflowStatusResult: z.ZodObject<{
|
|
|
1186
2356
|
sessionId?: string | undefined;
|
|
1187
2357
|
role?: string | undefined;
|
|
1188
2358
|
turnId?: string | undefined;
|
|
2359
|
+
result?: {
|
|
2360
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2361
|
+
text?: string | undefined;
|
|
2362
|
+
usage?: {
|
|
2363
|
+
inputTokens?: number | undefined;
|
|
2364
|
+
outputTokens?: number | undefined;
|
|
2365
|
+
} | undefined;
|
|
2366
|
+
} | undefined;
|
|
1189
2367
|
error?: string | undefined;
|
|
1190
2368
|
startedAt?: string | undefined;
|
|
1191
2369
|
completedAt?: string | undefined;
|
|
2370
|
+
iterations?: number | undefined;
|
|
1192
2371
|
}>, "many">;
|
|
1193
2372
|
createdAt: z.ZodString;
|
|
1194
2373
|
updatedAt: z.ZodString;
|
|
1195
2374
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
1196
2375
|
error: z.ZodOptional<z.ZodString>;
|
|
2376
|
+
finalText: z.ZodOptional<z.ZodString>;
|
|
2377
|
+
/** 是否可 resume:phonon 持有该 workflow 的 checkpoint。 */
|
|
2378
|
+
resumable: z.ZodDefault<z.ZodBoolean>;
|
|
1197
2379
|
}, "strip", z.ZodTypeAny, {
|
|
1198
2380
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1199
|
-
project: string & z.BRAND<"ProjectId">;
|
|
1200
2381
|
createdAt: string;
|
|
1201
|
-
mode: "dag" | "graph";
|
|
2382
|
+
mode: "dag" | "graph" | "discussion";
|
|
2383
|
+
workflowId: string;
|
|
1202
2384
|
updatedAt: string;
|
|
1203
2385
|
nodes: {
|
|
1204
2386
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
@@ -1208,18 +2390,29 @@ export declare const WorkflowStatusResult: z.ZodObject<{
|
|
|
1208
2390
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1209
2391
|
role?: string | undefined;
|
|
1210
2392
|
turnId?: string | undefined;
|
|
2393
|
+
result?: {
|
|
2394
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2395
|
+
text?: string | undefined;
|
|
2396
|
+
usage?: {
|
|
2397
|
+
inputTokens?: number | undefined;
|
|
2398
|
+
outputTokens?: number | undefined;
|
|
2399
|
+
} | undefined;
|
|
2400
|
+
} | undefined;
|
|
1211
2401
|
error?: string | undefined;
|
|
1212
2402
|
startedAt?: string | undefined;
|
|
1213
2403
|
completedAt?: string | undefined;
|
|
2404
|
+
iterations?: number | undefined;
|
|
1214
2405
|
}[];
|
|
1215
|
-
|
|
2406
|
+
resumable: boolean;
|
|
2407
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1216
2408
|
error?: string | undefined;
|
|
1217
2409
|
completedAt?: string | undefined;
|
|
2410
|
+
finalText?: string | undefined;
|
|
1218
2411
|
}, {
|
|
1219
2412
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1220
|
-
project: string;
|
|
1221
2413
|
createdAt: string;
|
|
1222
|
-
mode: "dag" | "graph";
|
|
2414
|
+
mode: "dag" | "graph" | "discussion";
|
|
2415
|
+
workflowId: string;
|
|
1223
2416
|
updatedAt: string;
|
|
1224
2417
|
nodes: {
|
|
1225
2418
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
@@ -1229,13 +2422,24 @@ export declare const WorkflowStatusResult: z.ZodObject<{
|
|
|
1229
2422
|
sessionId?: string | undefined;
|
|
1230
2423
|
role?: string | undefined;
|
|
1231
2424
|
turnId?: string | undefined;
|
|
2425
|
+
result?: {
|
|
2426
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2427
|
+
text?: string | undefined;
|
|
2428
|
+
usage?: {
|
|
2429
|
+
inputTokens?: number | undefined;
|
|
2430
|
+
outputTokens?: number | undefined;
|
|
2431
|
+
} | undefined;
|
|
2432
|
+
} | undefined;
|
|
1232
2433
|
error?: string | undefined;
|
|
1233
2434
|
startedAt?: string | undefined;
|
|
1234
2435
|
completedAt?: string | undefined;
|
|
2436
|
+
iterations?: number | undefined;
|
|
1235
2437
|
}[];
|
|
1236
|
-
|
|
2438
|
+
project?: string | undefined;
|
|
1237
2439
|
error?: string | undefined;
|
|
1238
2440
|
completedAt?: string | undefined;
|
|
2441
|
+
finalText?: string | undefined;
|
|
2442
|
+
resumable?: boolean | undefined;
|
|
1239
2443
|
}>;
|
|
1240
2444
|
export type WorkflowStatusResult = z.infer<typeof WorkflowStatusResult>;
|
|
1241
2445
|
export declare const WorkflowCancelParams: z.ZodObject<{
|
|
@@ -1262,24 +2466,34 @@ export declare const WorkflowCancelResult: z.ZodObject<{
|
|
|
1262
2466
|
export type WorkflowCancelResult = z.infer<typeof WorkflowCancelResult>;
|
|
1263
2467
|
export declare const WorkflowListParams: z.ZodObject<{
|
|
1264
2468
|
status: z.ZodOptional<z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>>;
|
|
2469
|
+
projectId: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
2470
|
+
since: z.ZodOptional<z.ZodString>;
|
|
2471
|
+
until: z.ZodOptional<z.ZodString>;
|
|
1265
2472
|
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
1266
2473
|
cursor: z.ZodOptional<z.ZodString>;
|
|
1267
2474
|
}, "strip", z.ZodTypeAny, {
|
|
1268
2475
|
status?: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled" | undefined;
|
|
1269
2476
|
limit?: number | undefined;
|
|
1270
2477
|
cursor?: string | undefined;
|
|
2478
|
+
projectId?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
2479
|
+
since?: string | undefined;
|
|
2480
|
+
until?: string | undefined;
|
|
1271
2481
|
}, {
|
|
1272
2482
|
status?: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled" | undefined;
|
|
1273
2483
|
limit?: number | undefined;
|
|
1274
2484
|
cursor?: string | undefined;
|
|
2485
|
+
projectId?: string | undefined;
|
|
2486
|
+
since?: string | undefined;
|
|
2487
|
+
until?: string | undefined;
|
|
1275
2488
|
}>;
|
|
1276
2489
|
export type WorkflowListParams = z.infer<typeof WorkflowListParams>;
|
|
1277
2490
|
export declare const WorkflowListResult: z.ZodObject<{
|
|
1278
2491
|
workflows: z.ZodArray<z.ZodObject<{
|
|
1279
2492
|
workflowId: z.ZodString;
|
|
1280
2493
|
status: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
|
|
1281
|
-
project
|
|
1282
|
-
|
|
2494
|
+
/** workflow 默认 project;v0.6 起可选。 */
|
|
2495
|
+
project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
|
|
2496
|
+
mode: z.ZodEnum<["dag", "graph", "discussion"]>;
|
|
1283
2497
|
nodes: z.ZodArray<z.ZodObject<{
|
|
1284
2498
|
nodeId: z.ZodString;
|
|
1285
2499
|
status: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
|
|
@@ -1291,6 +2505,36 @@ export declare const WorkflowListResult: z.ZodObject<{
|
|
|
1291
2505
|
startedAt: z.ZodOptional<z.ZodString>;
|
|
1292
2506
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
1293
2507
|
error: z.ZodOptional<z.ZodString>;
|
|
2508
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
2509
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2510
|
+
status: z.ZodEnum<["completed", "interrupted", "aborted", "failed", "timeout"]>;
|
|
2511
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2512
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2513
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2514
|
+
}, "strip", z.ZodTypeAny, {
|
|
2515
|
+
inputTokens?: number | undefined;
|
|
2516
|
+
outputTokens?: number | undefined;
|
|
2517
|
+
}, {
|
|
2518
|
+
inputTokens?: number | undefined;
|
|
2519
|
+
outputTokens?: number | undefined;
|
|
2520
|
+
}>>;
|
|
2521
|
+
}, "strip", z.ZodTypeAny, {
|
|
2522
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2523
|
+
text?: string | undefined;
|
|
2524
|
+
usage?: {
|
|
2525
|
+
inputTokens?: number | undefined;
|
|
2526
|
+
outputTokens?: number | undefined;
|
|
2527
|
+
} | undefined;
|
|
2528
|
+
}, {
|
|
2529
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2530
|
+
text?: string | undefined;
|
|
2531
|
+
usage?: {
|
|
2532
|
+
inputTokens?: number | undefined;
|
|
2533
|
+
outputTokens?: number | undefined;
|
|
2534
|
+
} | undefined;
|
|
2535
|
+
}>>;
|
|
2536
|
+
/** 该节点完成的轮次计数(discussion 用;DAG/Graph 一次执行 = 1)。 */
|
|
2537
|
+
iterations: z.ZodOptional<z.ZodNumber>;
|
|
1294
2538
|
}, "strip", z.ZodTypeAny, {
|
|
1295
2539
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
1296
2540
|
agent: string & z.BRAND<"AgentId">;
|
|
@@ -1299,9 +2543,18 @@ export declare const WorkflowListResult: z.ZodObject<{
|
|
|
1299
2543
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1300
2544
|
role?: string | undefined;
|
|
1301
2545
|
turnId?: string | undefined;
|
|
2546
|
+
result?: {
|
|
2547
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2548
|
+
text?: string | undefined;
|
|
2549
|
+
usage?: {
|
|
2550
|
+
inputTokens?: number | undefined;
|
|
2551
|
+
outputTokens?: number | undefined;
|
|
2552
|
+
} | undefined;
|
|
2553
|
+
} | undefined;
|
|
1302
2554
|
error?: string | undefined;
|
|
1303
2555
|
startedAt?: string | undefined;
|
|
1304
2556
|
completedAt?: string | undefined;
|
|
2557
|
+
iterations?: number | undefined;
|
|
1305
2558
|
}, {
|
|
1306
2559
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
1307
2560
|
agent: string;
|
|
@@ -1310,19 +2563,31 @@ export declare const WorkflowListResult: z.ZodObject<{
|
|
|
1310
2563
|
sessionId?: string | undefined;
|
|
1311
2564
|
role?: string | undefined;
|
|
1312
2565
|
turnId?: string | undefined;
|
|
2566
|
+
result?: {
|
|
2567
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2568
|
+
text?: string | undefined;
|
|
2569
|
+
usage?: {
|
|
2570
|
+
inputTokens?: number | undefined;
|
|
2571
|
+
outputTokens?: number | undefined;
|
|
2572
|
+
} | undefined;
|
|
2573
|
+
} | undefined;
|
|
1313
2574
|
error?: string | undefined;
|
|
1314
2575
|
startedAt?: string | undefined;
|
|
1315
2576
|
completedAt?: string | undefined;
|
|
2577
|
+
iterations?: number | undefined;
|
|
1316
2578
|
}>, "many">;
|
|
1317
2579
|
createdAt: z.ZodString;
|
|
1318
2580
|
updatedAt: z.ZodString;
|
|
1319
2581
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
1320
2582
|
error: z.ZodOptional<z.ZodString>;
|
|
2583
|
+
finalText: z.ZodOptional<z.ZodString>;
|
|
2584
|
+
/** 是否可 resume:phonon 持有该 workflow 的 checkpoint。 */
|
|
2585
|
+
resumable: z.ZodDefault<z.ZodBoolean>;
|
|
1321
2586
|
}, "strip", z.ZodTypeAny, {
|
|
1322
2587
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1323
|
-
project: string & z.BRAND<"ProjectId">;
|
|
1324
2588
|
createdAt: string;
|
|
1325
|
-
mode: "dag" | "graph";
|
|
2589
|
+
mode: "dag" | "graph" | "discussion";
|
|
2590
|
+
workflowId: string;
|
|
1326
2591
|
updatedAt: string;
|
|
1327
2592
|
nodes: {
|
|
1328
2593
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
@@ -1332,18 +2597,29 @@ export declare const WorkflowListResult: z.ZodObject<{
|
|
|
1332
2597
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1333
2598
|
role?: string | undefined;
|
|
1334
2599
|
turnId?: string | undefined;
|
|
2600
|
+
result?: {
|
|
2601
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2602
|
+
text?: string | undefined;
|
|
2603
|
+
usage?: {
|
|
2604
|
+
inputTokens?: number | undefined;
|
|
2605
|
+
outputTokens?: number | undefined;
|
|
2606
|
+
} | undefined;
|
|
2607
|
+
} | undefined;
|
|
1335
2608
|
error?: string | undefined;
|
|
1336
2609
|
startedAt?: string | undefined;
|
|
1337
2610
|
completedAt?: string | undefined;
|
|
2611
|
+
iterations?: number | undefined;
|
|
1338
2612
|
}[];
|
|
1339
|
-
|
|
2613
|
+
resumable: boolean;
|
|
2614
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1340
2615
|
error?: string | undefined;
|
|
1341
2616
|
completedAt?: string | undefined;
|
|
2617
|
+
finalText?: string | undefined;
|
|
1342
2618
|
}, {
|
|
1343
2619
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1344
|
-
project: string;
|
|
1345
2620
|
createdAt: string;
|
|
1346
|
-
mode: "dag" | "graph";
|
|
2621
|
+
mode: "dag" | "graph" | "discussion";
|
|
2622
|
+
workflowId: string;
|
|
1347
2623
|
updatedAt: string;
|
|
1348
2624
|
nodes: {
|
|
1349
2625
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
@@ -1353,21 +2629,32 @@ export declare const WorkflowListResult: z.ZodObject<{
|
|
|
1353
2629
|
sessionId?: string | undefined;
|
|
1354
2630
|
role?: string | undefined;
|
|
1355
2631
|
turnId?: string | undefined;
|
|
2632
|
+
result?: {
|
|
2633
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2634
|
+
text?: string | undefined;
|
|
2635
|
+
usage?: {
|
|
2636
|
+
inputTokens?: number | undefined;
|
|
2637
|
+
outputTokens?: number | undefined;
|
|
2638
|
+
} | undefined;
|
|
2639
|
+
} | undefined;
|
|
1356
2640
|
error?: string | undefined;
|
|
1357
2641
|
startedAt?: string | undefined;
|
|
1358
2642
|
completedAt?: string | undefined;
|
|
2643
|
+
iterations?: number | undefined;
|
|
1359
2644
|
}[];
|
|
1360
|
-
|
|
2645
|
+
project?: string | undefined;
|
|
1361
2646
|
error?: string | undefined;
|
|
1362
2647
|
completedAt?: string | undefined;
|
|
2648
|
+
finalText?: string | undefined;
|
|
2649
|
+
resumable?: boolean | undefined;
|
|
1363
2650
|
}>, "many">;
|
|
1364
2651
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
1365
2652
|
}, "strip", z.ZodTypeAny, {
|
|
1366
2653
|
workflows: {
|
|
1367
2654
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1368
|
-
project: string & z.BRAND<"ProjectId">;
|
|
1369
2655
|
createdAt: string;
|
|
1370
|
-
mode: "dag" | "graph";
|
|
2656
|
+
mode: "dag" | "graph" | "discussion";
|
|
2657
|
+
workflowId: string;
|
|
1371
2658
|
updatedAt: string;
|
|
1372
2659
|
nodes: {
|
|
1373
2660
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
@@ -1377,21 +2664,32 @@ export declare const WorkflowListResult: z.ZodObject<{
|
|
|
1377
2664
|
sessionId?: (string & z.BRAND<"SessionId">) | undefined;
|
|
1378
2665
|
role?: string | undefined;
|
|
1379
2666
|
turnId?: string | undefined;
|
|
2667
|
+
result?: {
|
|
2668
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2669
|
+
text?: string | undefined;
|
|
2670
|
+
usage?: {
|
|
2671
|
+
inputTokens?: number | undefined;
|
|
2672
|
+
outputTokens?: number | undefined;
|
|
2673
|
+
} | undefined;
|
|
2674
|
+
} | undefined;
|
|
1380
2675
|
error?: string | undefined;
|
|
1381
2676
|
startedAt?: string | undefined;
|
|
1382
2677
|
completedAt?: string | undefined;
|
|
2678
|
+
iterations?: number | undefined;
|
|
1383
2679
|
}[];
|
|
1384
|
-
|
|
2680
|
+
resumable: boolean;
|
|
2681
|
+
project?: (string & z.BRAND<"ProjectId">) | undefined;
|
|
1385
2682
|
error?: string | undefined;
|
|
1386
2683
|
completedAt?: string | undefined;
|
|
2684
|
+
finalText?: string | undefined;
|
|
1387
2685
|
}[];
|
|
1388
2686
|
nextCursor?: string | undefined;
|
|
1389
2687
|
}, {
|
|
1390
2688
|
workflows: {
|
|
1391
2689
|
status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
|
|
1392
|
-
project: string;
|
|
1393
2690
|
createdAt: string;
|
|
1394
|
-
mode: "dag" | "graph";
|
|
2691
|
+
mode: "dag" | "graph" | "discussion";
|
|
2692
|
+
workflowId: string;
|
|
1395
2693
|
updatedAt: string;
|
|
1396
2694
|
nodes: {
|
|
1397
2695
|
status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
|
|
@@ -1401,13 +2699,24 @@ export declare const WorkflowListResult: z.ZodObject<{
|
|
|
1401
2699
|
sessionId?: string | undefined;
|
|
1402
2700
|
role?: string | undefined;
|
|
1403
2701
|
turnId?: string | undefined;
|
|
2702
|
+
result?: {
|
|
2703
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2704
|
+
text?: string | undefined;
|
|
2705
|
+
usage?: {
|
|
2706
|
+
inputTokens?: number | undefined;
|
|
2707
|
+
outputTokens?: number | undefined;
|
|
2708
|
+
} | undefined;
|
|
2709
|
+
} | undefined;
|
|
1404
2710
|
error?: string | undefined;
|
|
1405
2711
|
startedAt?: string | undefined;
|
|
1406
2712
|
completedAt?: string | undefined;
|
|
2713
|
+
iterations?: number | undefined;
|
|
1407
2714
|
}[];
|
|
1408
|
-
|
|
2715
|
+
project?: string | undefined;
|
|
1409
2716
|
error?: string | undefined;
|
|
1410
2717
|
completedAt?: string | undefined;
|
|
2718
|
+
finalText?: string | undefined;
|
|
2719
|
+
resumable?: boolean | undefined;
|
|
1411
2720
|
}[];
|
|
1412
2721
|
nextCursor?: string | undefined;
|
|
1413
2722
|
}>;
|
|
@@ -1415,7 +2724,7 @@ export type WorkflowListResult = z.infer<typeof WorkflowListResult>;
|
|
|
1415
2724
|
export declare const WorkflowEvent: z.ZodObject<{
|
|
1416
2725
|
workflowId: z.ZodString;
|
|
1417
2726
|
seq: z.ZodNumber;
|
|
1418
|
-
type: z.ZodEnum<["workflow.status", "node.status", "
|
|
2727
|
+
type: z.ZodEnum<["workflow.status", "node.status", "edge.route", "executor.decision", "round.started", "round.completed", "discussion.terminated"]>;
|
|
1419
2728
|
nodeId: z.ZodOptional<z.ZodString>;
|
|
1420
2729
|
sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
|
|
1421
2730
|
turnId: z.ZodOptional<z.ZodString>;
|
|
@@ -1423,10 +2732,39 @@ export declare const WorkflowEvent: z.ZodObject<{
|
|
|
1423
2732
|
model: z.ZodOptional<z.ZodString>;
|
|
1424
2733
|
role: z.ZodOptional<z.ZodString>;
|
|
1425
2734
|
status: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>, z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>]>>;
|
|
2735
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
2736
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2737
|
+
status: z.ZodEnum<["completed", "interrupted", "aborted", "failed", "timeout"]>;
|
|
2738
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2739
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2740
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2741
|
+
}, "strip", z.ZodTypeAny, {
|
|
2742
|
+
inputTokens?: number | undefined;
|
|
2743
|
+
outputTokens?: number | undefined;
|
|
2744
|
+
}, {
|
|
2745
|
+
inputTokens?: number | undefined;
|
|
2746
|
+
outputTokens?: number | undefined;
|
|
2747
|
+
}>>;
|
|
2748
|
+
}, "strip", z.ZodTypeAny, {
|
|
2749
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2750
|
+
text?: string | undefined;
|
|
2751
|
+
usage?: {
|
|
2752
|
+
inputTokens?: number | undefined;
|
|
2753
|
+
outputTokens?: number | undefined;
|
|
2754
|
+
} | undefined;
|
|
2755
|
+
}, {
|
|
2756
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2757
|
+
text?: string | undefined;
|
|
2758
|
+
usage?: {
|
|
2759
|
+
inputTokens?: number | undefined;
|
|
2760
|
+
outputTokens?: number | undefined;
|
|
2761
|
+
} | undefined;
|
|
2762
|
+
}>>;
|
|
2763
|
+
/** 自由载荷。常见字段:iteration, from, to, reason, terminationReason 等。 */
|
|
1426
2764
|
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1427
2765
|
timestamp: z.ZodString;
|
|
1428
2766
|
}, "strip", z.ZodTypeAny, {
|
|
1429
|
-
type: "workflow.status" | "node.status" | "
|
|
2767
|
+
type: "workflow.status" | "node.status" | "edge.route" | "executor.decision" | "round.started" | "round.completed" | "discussion.terminated";
|
|
1430
2768
|
seq: number;
|
|
1431
2769
|
workflowId: string;
|
|
1432
2770
|
timestamp: string;
|
|
@@ -1436,10 +2774,18 @@ export declare const WorkflowEvent: z.ZodObject<{
|
|
|
1436
2774
|
role?: string | undefined;
|
|
1437
2775
|
model?: string | undefined;
|
|
1438
2776
|
turnId?: string | undefined;
|
|
1439
|
-
|
|
2777
|
+
result?: {
|
|
2778
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2779
|
+
text?: string | undefined;
|
|
2780
|
+
usage?: {
|
|
2781
|
+
inputTokens?: number | undefined;
|
|
2782
|
+
outputTokens?: number | undefined;
|
|
2783
|
+
} | undefined;
|
|
2784
|
+
} | undefined;
|
|
1440
2785
|
nodeId?: string | undefined;
|
|
2786
|
+
payload?: Record<string, unknown> | undefined;
|
|
1441
2787
|
}, {
|
|
1442
|
-
type: "workflow.status" | "node.status" | "
|
|
2788
|
+
type: "workflow.status" | "node.status" | "edge.route" | "executor.decision" | "round.started" | "round.completed" | "discussion.terminated";
|
|
1443
2789
|
seq: number;
|
|
1444
2790
|
workflowId: string;
|
|
1445
2791
|
timestamp: string;
|
|
@@ -1449,8 +2795,171 @@ export declare const WorkflowEvent: z.ZodObject<{
|
|
|
1449
2795
|
role?: string | undefined;
|
|
1450
2796
|
model?: string | undefined;
|
|
1451
2797
|
turnId?: string | undefined;
|
|
1452
|
-
|
|
2798
|
+
result?: {
|
|
2799
|
+
status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
|
|
2800
|
+
text?: string | undefined;
|
|
2801
|
+
usage?: {
|
|
2802
|
+
inputTokens?: number | undefined;
|
|
2803
|
+
outputTokens?: number | undefined;
|
|
2804
|
+
} | undefined;
|
|
2805
|
+
} | undefined;
|
|
1453
2806
|
nodeId?: string | undefined;
|
|
2807
|
+
payload?: Record<string, unknown> | undefined;
|
|
1454
2808
|
}>;
|
|
1455
2809
|
export type WorkflowEvent = z.infer<typeof WorkflowEvent>;
|
|
2810
|
+
export declare const WorkflowAckParams: z.ZodObject<{
|
|
2811
|
+
workflowId: z.ZodString;
|
|
2812
|
+
lastSeq: z.ZodNumber;
|
|
2813
|
+
}, "strip", z.ZodTypeAny, {
|
|
2814
|
+
workflowId: string;
|
|
2815
|
+
lastSeq: number;
|
|
2816
|
+
}, {
|
|
2817
|
+
workflowId: string;
|
|
2818
|
+
lastSeq: number;
|
|
2819
|
+
}>;
|
|
2820
|
+
export type WorkflowAckParams = z.infer<typeof WorkflowAckParams>;
|
|
2821
|
+
/** route:派新任务给目标 worker(v0.4 既有语义)。 */
|
|
2822
|
+
export declare const WorkflowRouteDirective: z.ZodObject<{
|
|
2823
|
+
kind: z.ZodLiteral<"workflow.route">;
|
|
2824
|
+
to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
2825
|
+
message: z.ZodString;
|
|
2826
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2827
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2828
|
+
}, "strip", z.ZodTypeAny, {
|
|
2829
|
+
message: string;
|
|
2830
|
+
kind: "workflow.route";
|
|
2831
|
+
to: string | string[];
|
|
2832
|
+
reason?: string | undefined;
|
|
2833
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2834
|
+
}, {
|
|
2835
|
+
message: string;
|
|
2836
|
+
kind: "workflow.route";
|
|
2837
|
+
to: string | string[];
|
|
2838
|
+
reason?: string | undefined;
|
|
2839
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2840
|
+
}>;
|
|
2841
|
+
export type WorkflowRouteDirective = z.infer<typeof WorkflowRouteDirective>;
|
|
2842
|
+
/** feedback:让目标 worker 基于上次输出返工修订(显式语义,区分于新任务)。 */
|
|
2843
|
+
export declare const WorkflowFeedbackDirective: z.ZodObject<{
|
|
2844
|
+
kind: z.ZodLiteral<"workflow.feedback">;
|
|
2845
|
+
to: z.ZodString;
|
|
2846
|
+
message: z.ZodString;
|
|
2847
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2848
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2849
|
+
}, "strip", z.ZodTypeAny, {
|
|
2850
|
+
message: string;
|
|
2851
|
+
kind: "workflow.feedback";
|
|
2852
|
+
to: string;
|
|
2853
|
+
reason?: string | undefined;
|
|
2854
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2855
|
+
}, {
|
|
2856
|
+
message: string;
|
|
2857
|
+
kind: "workflow.feedback";
|
|
2858
|
+
to: string;
|
|
2859
|
+
reason?: string | undefined;
|
|
2860
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2861
|
+
}>;
|
|
2862
|
+
export type WorkflowFeedbackDirective = z.infer<typeof WorkflowFeedbackDirective>;
|
|
2863
|
+
/** reply:模拟键盘输入(应答目标 agent 卡住的交互提示,如 [Y/n])。 */
|
|
2864
|
+
export declare const WorkflowReplyDirective: z.ZodObject<{
|
|
2865
|
+
kind: z.ZodLiteral<"workflow.reply">;
|
|
2866
|
+
to: z.ZodString;
|
|
2867
|
+
/** 应答内容(通常 1-2 字符:"Y"/"n"/"y" 等)。 */
|
|
2868
|
+
keystroke: z.ZodString;
|
|
2869
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2870
|
+
}, "strip", z.ZodTypeAny, {
|
|
2871
|
+
kind: "workflow.reply";
|
|
2872
|
+
to: string;
|
|
2873
|
+
keystroke: string;
|
|
2874
|
+
reason?: string | undefined;
|
|
2875
|
+
}, {
|
|
2876
|
+
kind: "workflow.reply";
|
|
2877
|
+
to: string;
|
|
2878
|
+
keystroke: string;
|
|
2879
|
+
reason?: string | undefined;
|
|
2880
|
+
}>;
|
|
2881
|
+
export type WorkflowReplyDirective = z.infer<typeof WorkflowReplyDirective>;
|
|
2882
|
+
/** done:显式宣告 workflow 完成。 */
|
|
2883
|
+
export declare const WorkflowDoneDirective: z.ZodObject<{
|
|
2884
|
+
kind: z.ZodLiteral<"workflow.done">;
|
|
2885
|
+
/** 最终总结文本,作为 workflow.finalText。 */
|
|
2886
|
+
finalSummary: z.ZodOptional<z.ZodString>;
|
|
2887
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2888
|
+
}, "strip", z.ZodTypeAny, {
|
|
2889
|
+
kind: "workflow.done";
|
|
2890
|
+
reason?: string | undefined;
|
|
2891
|
+
finalSummary?: string | undefined;
|
|
2892
|
+
}, {
|
|
2893
|
+
kind: "workflow.done";
|
|
2894
|
+
reason?: string | undefined;
|
|
2895
|
+
finalSummary?: string | undefined;
|
|
2896
|
+
}>;
|
|
2897
|
+
export type WorkflowDoneDirective = z.infer<typeof WorkflowDoneDirective>;
|
|
2898
|
+
export declare const WorkflowRoutingDirective: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
2899
|
+
kind: z.ZodLiteral<"workflow.route">;
|
|
2900
|
+
to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
2901
|
+
message: z.ZodString;
|
|
2902
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2903
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2904
|
+
}, "strip", z.ZodTypeAny, {
|
|
2905
|
+
message: string;
|
|
2906
|
+
kind: "workflow.route";
|
|
2907
|
+
to: string | string[];
|
|
2908
|
+
reason?: string | undefined;
|
|
2909
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2910
|
+
}, {
|
|
2911
|
+
message: string;
|
|
2912
|
+
kind: "workflow.route";
|
|
2913
|
+
to: string | string[];
|
|
2914
|
+
reason?: string | undefined;
|
|
2915
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2916
|
+
}>, z.ZodObject<{
|
|
2917
|
+
kind: z.ZodLiteral<"workflow.feedback">;
|
|
2918
|
+
to: z.ZodString;
|
|
2919
|
+
message: z.ZodString;
|
|
2920
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2921
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2922
|
+
}, "strip", z.ZodTypeAny, {
|
|
2923
|
+
message: string;
|
|
2924
|
+
kind: "workflow.feedback";
|
|
2925
|
+
to: string;
|
|
2926
|
+
reason?: string | undefined;
|
|
2927
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2928
|
+
}, {
|
|
2929
|
+
message: string;
|
|
2930
|
+
kind: "workflow.feedback";
|
|
2931
|
+
to: string;
|
|
2932
|
+
reason?: string | undefined;
|
|
2933
|
+
metadata?: Record<string, unknown> | undefined;
|
|
2934
|
+
}>, z.ZodObject<{
|
|
2935
|
+
kind: z.ZodLiteral<"workflow.reply">;
|
|
2936
|
+
to: z.ZodString;
|
|
2937
|
+
/** 应答内容(通常 1-2 字符:"Y"/"n"/"y" 等)。 */
|
|
2938
|
+
keystroke: z.ZodString;
|
|
2939
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2940
|
+
}, "strip", z.ZodTypeAny, {
|
|
2941
|
+
kind: "workflow.reply";
|
|
2942
|
+
to: string;
|
|
2943
|
+
keystroke: string;
|
|
2944
|
+
reason?: string | undefined;
|
|
2945
|
+
}, {
|
|
2946
|
+
kind: "workflow.reply";
|
|
2947
|
+
to: string;
|
|
2948
|
+
keystroke: string;
|
|
2949
|
+
reason?: string | undefined;
|
|
2950
|
+
}>, z.ZodObject<{
|
|
2951
|
+
kind: z.ZodLiteral<"workflow.done">;
|
|
2952
|
+
/** 最终总结文本,作为 workflow.finalText。 */
|
|
2953
|
+
finalSummary: z.ZodOptional<z.ZodString>;
|
|
2954
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
2955
|
+
}, "strip", z.ZodTypeAny, {
|
|
2956
|
+
kind: "workflow.done";
|
|
2957
|
+
reason?: string | undefined;
|
|
2958
|
+
finalSummary?: string | undefined;
|
|
2959
|
+
}, {
|
|
2960
|
+
kind: "workflow.done";
|
|
2961
|
+
reason?: string | undefined;
|
|
2962
|
+
finalSummary?: string | undefined;
|
|
2963
|
+
}>]>;
|
|
2964
|
+
export type WorkflowRoutingDirective = z.infer<typeof WorkflowRoutingDirective>;
|
|
1456
2965
|
//# sourceMappingURL=workflow.d.ts.map
|