@agent-phonon/protocol 0.2.11 → 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.
@@ -0,0 +1,2965 @@
1
+ import { z } from "zod";
2
+ export declare const WorkflowId: z.ZodString;
3
+ export declare const WorkflowNodeId: z.ZodString;
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
+ */
12
+ export declare const WorkflowRoleId: z.ZodString;
13
+ export declare const WorkflowNode: z.ZodObject<{
14
+ nodeId: z.ZodString;
15
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
16
+ model: z.ZodString;
17
+ /** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
18
+ role: z.ZodOptional<z.ZodString>;
19
+ input: z.ZodOptional<z.ZodString>;
20
+ systemPrompt: z.ZodOptional<z.ZodString>;
21
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
22
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
23
+ agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ agent: string & z.BRAND<"AgentId">;
51
+ model: string;
52
+ nodeId: string;
53
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
54
+ role?: string | undefined;
55
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
56
+ worktreeId?: string | undefined;
57
+ agentConfig?: Record<string, unknown> | undefined;
58
+ input?: string | undefined;
59
+ branch?: string | undefined;
60
+ systemPrompt?: string | undefined;
61
+ dependsOn?: string[] | undefined;
62
+ metadata?: Record<string, unknown> | undefined;
63
+ }, {
64
+ agent: string;
65
+ model: string;
66
+ nodeId: string;
67
+ sessionId?: string | undefined;
68
+ role?: string | undefined;
69
+ project?: string | undefined;
70
+ worktreeId?: string | undefined;
71
+ agentConfig?: Record<string, unknown> | undefined;
72
+ input?: string | undefined;
73
+ branch?: string | undefined;
74
+ systemPrompt?: string | undefined;
75
+ dependsOn?: string[] | undefined;
76
+ metadata?: Record<string, unknown> | undefined;
77
+ }>;
78
+ export type WorkflowNode = z.infer<typeof WorkflowNode>;
79
+ export declare const WorkflowEdge: z.ZodObject<{
80
+ edgeId: z.ZodOptional<z.ZodString>;
81
+ from: z.ZodString;
82
+ to: z.ZodString;
83
+ label: z.ZodOptional<z.ZodString>;
84
+ condition: z.ZodOptional<z.ZodString>;
85
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
86
+ }, "strip", z.ZodTypeAny, {
87
+ from: string;
88
+ to: string;
89
+ label?: string | undefined;
90
+ metadata?: Record<string, unknown> | undefined;
91
+ edgeId?: string | undefined;
92
+ condition?: string | undefined;
93
+ }, {
94
+ from: string;
95
+ to: string;
96
+ label?: string | undefined;
97
+ metadata?: Record<string, unknown> | undefined;
98
+ edgeId?: string | undefined;
99
+ condition?: string | undefined;
100
+ }>;
101
+ export type WorkflowEdge = z.infer<typeof WorkflowEdge>;
102
+ export declare const WorkflowDagPlan: z.ZodObject<{
103
+ mode: z.ZodLiteral<"dag">;
104
+ nodes: z.ZodArray<z.ZodObject<{
105
+ nodeId: z.ZodString;
106
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
107
+ model: z.ZodString;
108
+ /** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
109
+ role: z.ZodOptional<z.ZodString>;
110
+ input: z.ZodOptional<z.ZodString>;
111
+ systemPrompt: z.ZodOptional<z.ZodString>;
112
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
113
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
114
+ agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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>;
140
+ }, "strip", z.ZodTypeAny, {
141
+ agent: string & z.BRAND<"AgentId">;
142
+ model: string;
143
+ nodeId: string;
144
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
145
+ role?: string | undefined;
146
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
147
+ worktreeId?: string | undefined;
148
+ agentConfig?: Record<string, unknown> | undefined;
149
+ input?: string | undefined;
150
+ branch?: string | undefined;
151
+ systemPrompt?: string | undefined;
152
+ dependsOn?: string[] | undefined;
153
+ metadata?: Record<string, unknown> | undefined;
154
+ }, {
155
+ agent: string;
156
+ model: string;
157
+ nodeId: string;
158
+ sessionId?: string | undefined;
159
+ role?: string | undefined;
160
+ project?: string | undefined;
161
+ worktreeId?: string | undefined;
162
+ agentConfig?: Record<string, unknown> | undefined;
163
+ input?: string | undefined;
164
+ branch?: string | undefined;
165
+ systemPrompt?: string | undefined;
166
+ dependsOn?: string[] | undefined;
167
+ metadata?: Record<string, unknown> | undefined;
168
+ }>, "many">;
169
+ edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
170
+ edgeId: z.ZodOptional<z.ZodString>;
171
+ from: z.ZodString;
172
+ to: z.ZodString;
173
+ label: z.ZodOptional<z.ZodString>;
174
+ condition: z.ZodOptional<z.ZodString>;
175
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ from: string;
178
+ to: string;
179
+ label?: string | undefined;
180
+ metadata?: Record<string, unknown> | undefined;
181
+ edgeId?: string | undefined;
182
+ condition?: string | undefined;
183
+ }, {
184
+ from: string;
185
+ to: string;
186
+ label?: string | undefined;
187
+ metadata?: Record<string, unknown> | undefined;
188
+ edgeId?: string | undefined;
189
+ condition?: string | undefined;
190
+ }>, "many">>;
191
+ finalNodeId: z.ZodOptional<z.ZodString>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ mode: "dag";
194
+ nodes: {
195
+ agent: string & z.BRAND<"AgentId">;
196
+ model: string;
197
+ nodeId: string;
198
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
199
+ role?: string | undefined;
200
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
201
+ worktreeId?: string | undefined;
202
+ agentConfig?: Record<string, unknown> | undefined;
203
+ input?: string | undefined;
204
+ branch?: string | undefined;
205
+ systemPrompt?: string | undefined;
206
+ dependsOn?: string[] | undefined;
207
+ metadata?: Record<string, unknown> | undefined;
208
+ }[];
209
+ edges?: {
210
+ from: string;
211
+ to: string;
212
+ label?: string | undefined;
213
+ metadata?: Record<string, unknown> | undefined;
214
+ edgeId?: string | undefined;
215
+ condition?: string | undefined;
216
+ }[] | undefined;
217
+ finalNodeId?: string | undefined;
218
+ }, {
219
+ mode: "dag";
220
+ nodes: {
221
+ agent: string;
222
+ model: string;
223
+ nodeId: string;
224
+ sessionId?: string | undefined;
225
+ role?: string | undefined;
226
+ project?: string | undefined;
227
+ worktreeId?: string | undefined;
228
+ agentConfig?: Record<string, unknown> | undefined;
229
+ input?: string | undefined;
230
+ branch?: string | undefined;
231
+ systemPrompt?: string | undefined;
232
+ dependsOn?: string[] | undefined;
233
+ metadata?: Record<string, unknown> | undefined;
234
+ }[];
235
+ edges?: {
236
+ from: string;
237
+ to: string;
238
+ label?: string | undefined;
239
+ metadata?: Record<string, unknown> | undefined;
240
+ edgeId?: string | undefined;
241
+ condition?: string | undefined;
242
+ }[] | undefined;
243
+ finalNodeId?: string | undefined;
244
+ }>;
245
+ export type WorkflowDagPlan = z.infer<typeof WorkflowDagPlan>;
246
+ export declare const WorkflowCommunicationGraph: z.ZodObject<{
247
+ edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
248
+ edgeId: z.ZodOptional<z.ZodString>;
249
+ from: z.ZodString;
250
+ to: z.ZodString;
251
+ label: z.ZodOptional<z.ZodString>;
252
+ condition: z.ZodOptional<z.ZodString>;
253
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ from: string;
256
+ to: string;
257
+ label?: string | undefined;
258
+ metadata?: Record<string, unknown> | undefined;
259
+ edgeId?: string | undefined;
260
+ condition?: string | undefined;
261
+ }, {
262
+ from: string;
263
+ to: string;
264
+ label?: string | undefined;
265
+ metadata?: Record<string, unknown> | undefined;
266
+ edgeId?: string | undefined;
267
+ condition?: string | undefined;
268
+ }>, "many">>;
269
+ allowSelfLoop: z.ZodDefault<z.ZodBoolean>;
270
+ maxIterations: z.ZodDefault<z.ZodNumber>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ edges: {
273
+ from: string;
274
+ to: string;
275
+ label?: string | undefined;
276
+ metadata?: Record<string, unknown> | undefined;
277
+ edgeId?: string | undefined;
278
+ condition?: string | undefined;
279
+ }[];
280
+ allowSelfLoop: boolean;
281
+ maxIterations: number;
282
+ }, {
283
+ edges?: {
284
+ from: string;
285
+ to: string;
286
+ label?: string | undefined;
287
+ metadata?: Record<string, unknown> | undefined;
288
+ edgeId?: string | undefined;
289
+ condition?: string | undefined;
290
+ }[] | undefined;
291
+ allowSelfLoop?: boolean | undefined;
292
+ maxIterations?: number | undefined;
293
+ }>;
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>;
340
+ export declare const WorkflowGraphPlan: z.ZodObject<{
341
+ mode: z.ZodLiteral<"graph">;
342
+ executor: z.ZodObject<{
343
+ nodeId: z.ZodString;
344
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
345
+ model: z.ZodString;
346
+ input: z.ZodOptional<z.ZodString>;
347
+ systemPrompt: z.ZodOptional<z.ZodString>;
348
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
349
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
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">>;
357
+ }, "strip", z.ZodTypeAny, {
358
+ agent: string & z.BRAND<"AgentId">;
359
+ role: "executor";
360
+ model: string;
361
+ nodeId: string;
362
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
363
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
364
+ worktreeId?: string | undefined;
365
+ agentConfig?: Record<string, unknown> | undefined;
366
+ input?: string | undefined;
367
+ branch?: string | undefined;
368
+ systemPrompt?: string | undefined;
369
+ dependsOn?: string[] | undefined;
370
+ metadata?: Record<string, unknown> | undefined;
371
+ }, {
372
+ agent: string;
373
+ model: string;
374
+ nodeId: string;
375
+ sessionId?: string | undefined;
376
+ role?: "executor" | undefined;
377
+ project?: string | undefined;
378
+ worktreeId?: string | undefined;
379
+ agentConfig?: Record<string, unknown> | undefined;
380
+ input?: string | undefined;
381
+ branch?: string | undefined;
382
+ systemPrompt?: string | undefined;
383
+ dependsOn?: string[] | undefined;
384
+ metadata?: Record<string, unknown> | undefined;
385
+ }>;
386
+ workers: z.ZodArray<z.ZodObject<{
387
+ nodeId: z.ZodString;
388
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
389
+ model: z.ZodString;
390
+ /** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
391
+ role: z.ZodOptional<z.ZodString>;
392
+ input: z.ZodOptional<z.ZodString>;
393
+ systemPrompt: z.ZodOptional<z.ZodString>;
394
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
395
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
396
+ agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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>;
422
+ }, "strip", z.ZodTypeAny, {
423
+ agent: string & z.BRAND<"AgentId">;
424
+ model: string;
425
+ nodeId: string;
426
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
427
+ role?: string | undefined;
428
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
429
+ worktreeId?: string | undefined;
430
+ agentConfig?: Record<string, unknown> | undefined;
431
+ input?: string | undefined;
432
+ branch?: string | undefined;
433
+ systemPrompt?: string | undefined;
434
+ dependsOn?: string[] | undefined;
435
+ metadata?: Record<string, unknown> | undefined;
436
+ }, {
437
+ agent: string;
438
+ model: string;
439
+ nodeId: string;
440
+ sessionId?: string | undefined;
441
+ role?: string | undefined;
442
+ project?: string | undefined;
443
+ worktreeId?: string | undefined;
444
+ agentConfig?: Record<string, unknown> | undefined;
445
+ input?: string | undefined;
446
+ branch?: string | undefined;
447
+ systemPrompt?: string | undefined;
448
+ dependsOn?: string[] | undefined;
449
+ metadata?: Record<string, unknown> | undefined;
450
+ }>, "many">;
451
+ communicationGraph: z.ZodObject<{
452
+ edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
453
+ edgeId: z.ZodOptional<z.ZodString>;
454
+ from: z.ZodString;
455
+ to: z.ZodString;
456
+ label: z.ZodOptional<z.ZodString>;
457
+ condition: z.ZodOptional<z.ZodString>;
458
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
459
+ }, "strip", z.ZodTypeAny, {
460
+ from: string;
461
+ to: string;
462
+ label?: string | undefined;
463
+ metadata?: Record<string, unknown> | undefined;
464
+ edgeId?: string | undefined;
465
+ condition?: string | undefined;
466
+ }, {
467
+ from: string;
468
+ to: string;
469
+ label?: string | undefined;
470
+ metadata?: Record<string, unknown> | undefined;
471
+ edgeId?: string | undefined;
472
+ condition?: string | undefined;
473
+ }>, "many">>;
474
+ allowSelfLoop: z.ZodDefault<z.ZodBoolean>;
475
+ maxIterations: z.ZodDefault<z.ZodNumber>;
476
+ }, "strip", z.ZodTypeAny, {
477
+ edges: {
478
+ from: string;
479
+ to: string;
480
+ label?: string | undefined;
481
+ metadata?: Record<string, unknown> | undefined;
482
+ edgeId?: string | undefined;
483
+ condition?: string | undefined;
484
+ }[];
485
+ allowSelfLoop: boolean;
486
+ maxIterations: number;
487
+ }, {
488
+ edges?: {
489
+ from: string;
490
+ to: string;
491
+ label?: string | undefined;
492
+ metadata?: Record<string, unknown> | undefined;
493
+ edgeId?: string | undefined;
494
+ condition?: string | undefined;
495
+ }[] | undefined;
496
+ allowSelfLoop?: boolean | undefined;
497
+ maxIterations?: number | undefined;
498
+ }>;
499
+ }, "strip", z.ZodTypeAny, {
500
+ executor: {
501
+ agent: string & z.BRAND<"AgentId">;
502
+ role: "executor";
503
+ model: string;
504
+ nodeId: string;
505
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
506
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
507
+ worktreeId?: string | undefined;
508
+ agentConfig?: Record<string, unknown> | undefined;
509
+ input?: string | undefined;
510
+ branch?: string | undefined;
511
+ systemPrompt?: string | undefined;
512
+ dependsOn?: string[] | undefined;
513
+ metadata?: Record<string, unknown> | undefined;
514
+ };
515
+ mode: "graph";
516
+ workers: {
517
+ agent: string & z.BRAND<"AgentId">;
518
+ model: string;
519
+ nodeId: string;
520
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
521
+ role?: string | undefined;
522
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
523
+ worktreeId?: string | undefined;
524
+ agentConfig?: Record<string, unknown> | undefined;
525
+ input?: string | undefined;
526
+ branch?: string | undefined;
527
+ systemPrompt?: string | undefined;
528
+ dependsOn?: string[] | undefined;
529
+ metadata?: Record<string, unknown> | undefined;
530
+ }[];
531
+ communicationGraph: {
532
+ edges: {
533
+ from: string;
534
+ to: string;
535
+ label?: string | undefined;
536
+ metadata?: Record<string, unknown> | undefined;
537
+ edgeId?: string | undefined;
538
+ condition?: string | undefined;
539
+ }[];
540
+ allowSelfLoop: boolean;
541
+ maxIterations: number;
542
+ };
543
+ }, {
544
+ executor: {
545
+ agent: string;
546
+ model: string;
547
+ nodeId: string;
548
+ sessionId?: string | undefined;
549
+ role?: "executor" | undefined;
550
+ project?: string | undefined;
551
+ worktreeId?: string | undefined;
552
+ agentConfig?: Record<string, unknown> | undefined;
553
+ input?: string | undefined;
554
+ branch?: string | undefined;
555
+ systemPrompt?: string | undefined;
556
+ dependsOn?: string[] | undefined;
557
+ metadata?: Record<string, unknown> | undefined;
558
+ };
559
+ mode: "graph";
560
+ workers: {
561
+ agent: string;
562
+ model: string;
563
+ nodeId: string;
564
+ sessionId?: string | undefined;
565
+ role?: string | undefined;
566
+ project?: string | undefined;
567
+ worktreeId?: string | undefined;
568
+ agentConfig?: Record<string, unknown> | undefined;
569
+ input?: string | undefined;
570
+ branch?: string | undefined;
571
+ systemPrompt?: string | undefined;
572
+ dependsOn?: string[] | undefined;
573
+ metadata?: Record<string, unknown> | undefined;
574
+ }[];
575
+ communicationGraph: {
576
+ edges?: {
577
+ from: string;
578
+ to: string;
579
+ label?: string | undefined;
580
+ metadata?: Record<string, unknown> | undefined;
581
+ edgeId?: string | undefined;
582
+ condition?: string | undefined;
583
+ }[] | undefined;
584
+ allowSelfLoop?: boolean | undefined;
585
+ maxIterations?: number | undefined;
586
+ };
587
+ }>;
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>;
727
+ export declare const WorkflowPlan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
728
+ mode: z.ZodLiteral<"dag">;
729
+ nodes: z.ZodArray<z.ZodObject<{
730
+ nodeId: z.ZodString;
731
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
732
+ model: z.ZodString;
733
+ /** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
734
+ role: z.ZodOptional<z.ZodString>;
735
+ input: z.ZodOptional<z.ZodString>;
736
+ systemPrompt: z.ZodOptional<z.ZodString>;
737
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
738
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
739
+ agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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>;
765
+ }, "strip", z.ZodTypeAny, {
766
+ agent: string & z.BRAND<"AgentId">;
767
+ model: string;
768
+ nodeId: string;
769
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
770
+ role?: string | undefined;
771
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
772
+ worktreeId?: string | undefined;
773
+ agentConfig?: Record<string, unknown> | undefined;
774
+ input?: string | undefined;
775
+ branch?: string | undefined;
776
+ systemPrompt?: string | undefined;
777
+ dependsOn?: string[] | undefined;
778
+ metadata?: Record<string, unknown> | undefined;
779
+ }, {
780
+ agent: string;
781
+ model: string;
782
+ nodeId: string;
783
+ sessionId?: string | undefined;
784
+ role?: string | undefined;
785
+ project?: string | undefined;
786
+ worktreeId?: string | undefined;
787
+ agentConfig?: Record<string, unknown> | undefined;
788
+ input?: string | undefined;
789
+ branch?: string | undefined;
790
+ systemPrompt?: string | undefined;
791
+ dependsOn?: string[] | undefined;
792
+ metadata?: Record<string, unknown> | undefined;
793
+ }>, "many">;
794
+ edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
795
+ edgeId: z.ZodOptional<z.ZodString>;
796
+ from: z.ZodString;
797
+ to: z.ZodString;
798
+ label: z.ZodOptional<z.ZodString>;
799
+ condition: z.ZodOptional<z.ZodString>;
800
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
801
+ }, "strip", z.ZodTypeAny, {
802
+ from: string;
803
+ to: string;
804
+ label?: string | undefined;
805
+ metadata?: Record<string, unknown> | undefined;
806
+ edgeId?: string | undefined;
807
+ condition?: string | undefined;
808
+ }, {
809
+ from: string;
810
+ to: string;
811
+ label?: string | undefined;
812
+ metadata?: Record<string, unknown> | undefined;
813
+ edgeId?: string | undefined;
814
+ condition?: string | undefined;
815
+ }>, "many">>;
816
+ finalNodeId: z.ZodOptional<z.ZodString>;
817
+ }, "strip", z.ZodTypeAny, {
818
+ mode: "dag";
819
+ nodes: {
820
+ agent: string & z.BRAND<"AgentId">;
821
+ model: string;
822
+ nodeId: string;
823
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
824
+ role?: string | undefined;
825
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
826
+ worktreeId?: string | undefined;
827
+ agentConfig?: Record<string, unknown> | undefined;
828
+ input?: string | undefined;
829
+ branch?: string | undefined;
830
+ systemPrompt?: string | undefined;
831
+ dependsOn?: string[] | undefined;
832
+ metadata?: Record<string, unknown> | undefined;
833
+ }[];
834
+ edges?: {
835
+ from: string;
836
+ to: string;
837
+ label?: string | undefined;
838
+ metadata?: Record<string, unknown> | undefined;
839
+ edgeId?: string | undefined;
840
+ condition?: string | undefined;
841
+ }[] | undefined;
842
+ finalNodeId?: string | undefined;
843
+ }, {
844
+ mode: "dag";
845
+ nodes: {
846
+ agent: string;
847
+ model: string;
848
+ nodeId: string;
849
+ sessionId?: string | undefined;
850
+ role?: string | undefined;
851
+ project?: string | undefined;
852
+ worktreeId?: string | undefined;
853
+ agentConfig?: Record<string, unknown> | undefined;
854
+ input?: string | undefined;
855
+ branch?: string | undefined;
856
+ systemPrompt?: string | undefined;
857
+ dependsOn?: string[] | undefined;
858
+ metadata?: Record<string, unknown> | undefined;
859
+ }[];
860
+ edges?: {
861
+ from: string;
862
+ to: string;
863
+ label?: string | undefined;
864
+ metadata?: Record<string, unknown> | undefined;
865
+ edgeId?: string | undefined;
866
+ condition?: string | undefined;
867
+ }[] | undefined;
868
+ finalNodeId?: string | undefined;
869
+ }>, z.ZodObject<{
870
+ mode: z.ZodLiteral<"graph">;
871
+ executor: z.ZodObject<{
872
+ nodeId: z.ZodString;
873
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
874
+ model: z.ZodString;
875
+ input: z.ZodOptional<z.ZodString>;
876
+ systemPrompt: z.ZodOptional<z.ZodString>;
877
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
878
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
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">>;
886
+ }, "strip", z.ZodTypeAny, {
887
+ agent: string & z.BRAND<"AgentId">;
888
+ role: "executor";
889
+ model: string;
890
+ nodeId: string;
891
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
892
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
893
+ worktreeId?: string | undefined;
894
+ agentConfig?: Record<string, unknown> | undefined;
895
+ input?: string | undefined;
896
+ branch?: string | undefined;
897
+ systemPrompt?: string | undefined;
898
+ dependsOn?: string[] | undefined;
899
+ metadata?: Record<string, unknown> | undefined;
900
+ }, {
901
+ agent: string;
902
+ model: string;
903
+ nodeId: string;
904
+ sessionId?: string | undefined;
905
+ role?: "executor" | undefined;
906
+ project?: string | undefined;
907
+ worktreeId?: string | undefined;
908
+ agentConfig?: Record<string, unknown> | undefined;
909
+ input?: string | undefined;
910
+ branch?: string | undefined;
911
+ systemPrompt?: string | undefined;
912
+ dependsOn?: string[] | undefined;
913
+ metadata?: Record<string, unknown> | undefined;
914
+ }>;
915
+ workers: z.ZodArray<z.ZodObject<{
916
+ nodeId: z.ZodString;
917
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
918
+ model: z.ZodString;
919
+ /** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
920
+ role: z.ZodOptional<z.ZodString>;
921
+ input: z.ZodOptional<z.ZodString>;
922
+ systemPrompt: z.ZodOptional<z.ZodString>;
923
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
924
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
925
+ agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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>;
951
+ }, "strip", z.ZodTypeAny, {
952
+ agent: string & z.BRAND<"AgentId">;
953
+ model: string;
954
+ nodeId: string;
955
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
956
+ role?: string | undefined;
957
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
958
+ worktreeId?: string | undefined;
959
+ agentConfig?: Record<string, unknown> | undefined;
960
+ input?: string | undefined;
961
+ branch?: string | undefined;
962
+ systemPrompt?: string | undefined;
963
+ dependsOn?: string[] | undefined;
964
+ metadata?: Record<string, unknown> | undefined;
965
+ }, {
966
+ agent: string;
967
+ model: string;
968
+ nodeId: string;
969
+ sessionId?: string | undefined;
970
+ role?: string | undefined;
971
+ project?: string | undefined;
972
+ worktreeId?: string | undefined;
973
+ agentConfig?: Record<string, unknown> | undefined;
974
+ input?: string | undefined;
975
+ branch?: string | undefined;
976
+ systemPrompt?: string | undefined;
977
+ dependsOn?: string[] | undefined;
978
+ metadata?: Record<string, unknown> | undefined;
979
+ }>, "many">;
980
+ communicationGraph: z.ZodObject<{
981
+ edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
982
+ edgeId: z.ZodOptional<z.ZodString>;
983
+ from: z.ZodString;
984
+ to: z.ZodString;
985
+ label: z.ZodOptional<z.ZodString>;
986
+ condition: z.ZodOptional<z.ZodString>;
987
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
988
+ }, "strip", z.ZodTypeAny, {
989
+ from: string;
990
+ to: string;
991
+ label?: string | undefined;
992
+ metadata?: Record<string, unknown> | undefined;
993
+ edgeId?: string | undefined;
994
+ condition?: string | undefined;
995
+ }, {
996
+ from: string;
997
+ to: string;
998
+ label?: string | undefined;
999
+ metadata?: Record<string, unknown> | undefined;
1000
+ edgeId?: string | undefined;
1001
+ condition?: string | undefined;
1002
+ }>, "many">>;
1003
+ allowSelfLoop: z.ZodDefault<z.ZodBoolean>;
1004
+ maxIterations: z.ZodDefault<z.ZodNumber>;
1005
+ }, "strip", z.ZodTypeAny, {
1006
+ edges: {
1007
+ from: string;
1008
+ to: string;
1009
+ label?: string | undefined;
1010
+ metadata?: Record<string, unknown> | undefined;
1011
+ edgeId?: string | undefined;
1012
+ condition?: string | undefined;
1013
+ }[];
1014
+ allowSelfLoop: boolean;
1015
+ maxIterations: number;
1016
+ }, {
1017
+ edges?: {
1018
+ from: string;
1019
+ to: string;
1020
+ label?: string | undefined;
1021
+ metadata?: Record<string, unknown> | undefined;
1022
+ edgeId?: string | undefined;
1023
+ condition?: string | undefined;
1024
+ }[] | undefined;
1025
+ allowSelfLoop?: boolean | undefined;
1026
+ maxIterations?: number | undefined;
1027
+ }>;
1028
+ }, "strip", z.ZodTypeAny, {
1029
+ executor: {
1030
+ agent: string & z.BRAND<"AgentId">;
1031
+ role: "executor";
1032
+ model: string;
1033
+ nodeId: string;
1034
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1035
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1036
+ worktreeId?: string | undefined;
1037
+ agentConfig?: Record<string, unknown> | undefined;
1038
+ input?: string | undefined;
1039
+ branch?: string | undefined;
1040
+ systemPrompt?: string | undefined;
1041
+ dependsOn?: string[] | undefined;
1042
+ metadata?: Record<string, unknown> | undefined;
1043
+ };
1044
+ mode: "graph";
1045
+ workers: {
1046
+ agent: string & z.BRAND<"AgentId">;
1047
+ model: string;
1048
+ nodeId: string;
1049
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1050
+ role?: string | undefined;
1051
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1052
+ worktreeId?: string | undefined;
1053
+ agentConfig?: Record<string, unknown> | undefined;
1054
+ input?: string | undefined;
1055
+ branch?: string | undefined;
1056
+ systemPrompt?: string | undefined;
1057
+ dependsOn?: string[] | undefined;
1058
+ metadata?: Record<string, unknown> | undefined;
1059
+ }[];
1060
+ communicationGraph: {
1061
+ edges: {
1062
+ from: string;
1063
+ to: string;
1064
+ label?: string | undefined;
1065
+ metadata?: Record<string, unknown> | undefined;
1066
+ edgeId?: string | undefined;
1067
+ condition?: string | undefined;
1068
+ }[];
1069
+ allowSelfLoop: boolean;
1070
+ maxIterations: number;
1071
+ };
1072
+ }, {
1073
+ executor: {
1074
+ agent: string;
1075
+ model: string;
1076
+ nodeId: string;
1077
+ sessionId?: string | undefined;
1078
+ role?: "executor" | undefined;
1079
+ project?: string | undefined;
1080
+ worktreeId?: string | undefined;
1081
+ agentConfig?: Record<string, unknown> | undefined;
1082
+ input?: string | undefined;
1083
+ branch?: string | undefined;
1084
+ systemPrompt?: string | undefined;
1085
+ dependsOn?: string[] | undefined;
1086
+ metadata?: Record<string, unknown> | undefined;
1087
+ };
1088
+ mode: "graph";
1089
+ workers: {
1090
+ agent: string;
1091
+ model: string;
1092
+ nodeId: string;
1093
+ sessionId?: string | undefined;
1094
+ role?: string | undefined;
1095
+ project?: string | undefined;
1096
+ worktreeId?: string | undefined;
1097
+ agentConfig?: Record<string, unknown> | undefined;
1098
+ input?: string | undefined;
1099
+ branch?: string | undefined;
1100
+ systemPrompt?: string | undefined;
1101
+ dependsOn?: string[] | undefined;
1102
+ metadata?: Record<string, unknown> | undefined;
1103
+ }[];
1104
+ communicationGraph: {
1105
+ edges?: {
1106
+ from: string;
1107
+ to: string;
1108
+ label?: string | undefined;
1109
+ metadata?: Record<string, unknown> | undefined;
1110
+ edgeId?: string | undefined;
1111
+ condition?: string | undefined;
1112
+ }[] | undefined;
1113
+ allowSelfLoop?: boolean | undefined;
1114
+ maxIterations?: number | undefined;
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;
1252
+ }>]>;
1253
+ export type WorkflowPlan = z.infer<typeof WorkflowPlan>;
1254
+ export declare const WorkflowStatus: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
1255
+ export type WorkflowStatus = z.infer<typeof WorkflowStatus>;
1256
+ export declare const WorkflowNodeStatus: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
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>;
1314
+ export declare const WorkflowRunParams: z.ZodObject<{
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。 */
1321
+ worktreeId: z.ZodOptional<z.ZodString>;
1322
+ /** 默认 branch;node 未传 branch 时继承。含义同 WorkflowNode.branch。 */
1323
+ branch: z.ZodOptional<z.ZodString>;
1324
+ plan: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
1325
+ mode: z.ZodLiteral<"dag">;
1326
+ nodes: z.ZodArray<z.ZodObject<{
1327
+ nodeId: z.ZodString;
1328
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
1329
+ model: z.ZodString;
1330
+ /** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
1331
+ role: z.ZodOptional<z.ZodString>;
1332
+ input: z.ZodOptional<z.ZodString>;
1333
+ systemPrompt: z.ZodOptional<z.ZodString>;
1334
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1335
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
1336
+ agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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>;
1362
+ }, "strip", z.ZodTypeAny, {
1363
+ agent: string & z.BRAND<"AgentId">;
1364
+ model: string;
1365
+ nodeId: string;
1366
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1367
+ role?: string | undefined;
1368
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1369
+ worktreeId?: string | undefined;
1370
+ agentConfig?: Record<string, unknown> | undefined;
1371
+ input?: string | undefined;
1372
+ branch?: string | undefined;
1373
+ systemPrompt?: string | undefined;
1374
+ dependsOn?: string[] | undefined;
1375
+ metadata?: Record<string, unknown> | undefined;
1376
+ }, {
1377
+ agent: string;
1378
+ model: string;
1379
+ nodeId: string;
1380
+ sessionId?: string | undefined;
1381
+ role?: string | undefined;
1382
+ project?: string | undefined;
1383
+ worktreeId?: string | undefined;
1384
+ agentConfig?: Record<string, unknown> | undefined;
1385
+ input?: string | undefined;
1386
+ branch?: string | undefined;
1387
+ systemPrompt?: string | undefined;
1388
+ dependsOn?: string[] | undefined;
1389
+ metadata?: Record<string, unknown> | undefined;
1390
+ }>, "many">;
1391
+ edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
1392
+ edgeId: z.ZodOptional<z.ZodString>;
1393
+ from: z.ZodString;
1394
+ to: z.ZodString;
1395
+ label: z.ZodOptional<z.ZodString>;
1396
+ condition: z.ZodOptional<z.ZodString>;
1397
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1398
+ }, "strip", z.ZodTypeAny, {
1399
+ from: string;
1400
+ to: string;
1401
+ label?: string | undefined;
1402
+ metadata?: Record<string, unknown> | undefined;
1403
+ edgeId?: string | undefined;
1404
+ condition?: string | undefined;
1405
+ }, {
1406
+ from: string;
1407
+ to: string;
1408
+ label?: string | undefined;
1409
+ metadata?: Record<string, unknown> | undefined;
1410
+ edgeId?: string | undefined;
1411
+ condition?: string | undefined;
1412
+ }>, "many">>;
1413
+ finalNodeId: z.ZodOptional<z.ZodString>;
1414
+ }, "strip", z.ZodTypeAny, {
1415
+ mode: "dag";
1416
+ nodes: {
1417
+ agent: string & z.BRAND<"AgentId">;
1418
+ model: string;
1419
+ nodeId: string;
1420
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1421
+ role?: string | undefined;
1422
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1423
+ worktreeId?: string | undefined;
1424
+ agentConfig?: Record<string, unknown> | undefined;
1425
+ input?: string | undefined;
1426
+ branch?: string | undefined;
1427
+ systemPrompt?: string | undefined;
1428
+ dependsOn?: string[] | undefined;
1429
+ metadata?: Record<string, unknown> | undefined;
1430
+ }[];
1431
+ edges?: {
1432
+ from: string;
1433
+ to: string;
1434
+ label?: string | undefined;
1435
+ metadata?: Record<string, unknown> | undefined;
1436
+ edgeId?: string | undefined;
1437
+ condition?: string | undefined;
1438
+ }[] | undefined;
1439
+ finalNodeId?: string | undefined;
1440
+ }, {
1441
+ mode: "dag";
1442
+ nodes: {
1443
+ agent: string;
1444
+ model: string;
1445
+ nodeId: string;
1446
+ sessionId?: string | undefined;
1447
+ role?: string | undefined;
1448
+ project?: string | undefined;
1449
+ worktreeId?: string | undefined;
1450
+ agentConfig?: Record<string, unknown> | undefined;
1451
+ input?: string | undefined;
1452
+ branch?: string | undefined;
1453
+ systemPrompt?: string | undefined;
1454
+ dependsOn?: string[] | undefined;
1455
+ metadata?: Record<string, unknown> | undefined;
1456
+ }[];
1457
+ edges?: {
1458
+ from: string;
1459
+ to: string;
1460
+ label?: string | undefined;
1461
+ metadata?: Record<string, unknown> | undefined;
1462
+ edgeId?: string | undefined;
1463
+ condition?: string | undefined;
1464
+ }[] | undefined;
1465
+ finalNodeId?: string | undefined;
1466
+ }>, z.ZodObject<{
1467
+ mode: z.ZodLiteral<"graph">;
1468
+ executor: z.ZodObject<{
1469
+ nodeId: z.ZodString;
1470
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
1471
+ model: z.ZodString;
1472
+ input: z.ZodOptional<z.ZodString>;
1473
+ systemPrompt: z.ZodOptional<z.ZodString>;
1474
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1475
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
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">>;
1483
+ }, "strip", z.ZodTypeAny, {
1484
+ agent: string & z.BRAND<"AgentId">;
1485
+ role: "executor";
1486
+ model: string;
1487
+ nodeId: string;
1488
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1489
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1490
+ worktreeId?: string | undefined;
1491
+ agentConfig?: Record<string, unknown> | undefined;
1492
+ input?: string | undefined;
1493
+ branch?: string | undefined;
1494
+ systemPrompt?: string | undefined;
1495
+ dependsOn?: string[] | undefined;
1496
+ metadata?: Record<string, unknown> | undefined;
1497
+ }, {
1498
+ agent: string;
1499
+ model: string;
1500
+ nodeId: string;
1501
+ sessionId?: string | undefined;
1502
+ role?: "executor" | undefined;
1503
+ project?: string | undefined;
1504
+ worktreeId?: string | undefined;
1505
+ agentConfig?: Record<string, unknown> | undefined;
1506
+ input?: string | undefined;
1507
+ branch?: string | undefined;
1508
+ systemPrompt?: string | undefined;
1509
+ dependsOn?: string[] | undefined;
1510
+ metadata?: Record<string, unknown> | undefined;
1511
+ }>;
1512
+ workers: z.ZodArray<z.ZodObject<{
1513
+ nodeId: z.ZodString;
1514
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
1515
+ model: z.ZodString;
1516
+ /** 该节点在 workflow 中扮演的角色(由调用方定义,phonon 仅回显)。 */
1517
+ role: z.ZodOptional<z.ZodString>;
1518
+ input: z.ZodOptional<z.ZodString>;
1519
+ systemPrompt: z.ZodOptional<z.ZodString>;
1520
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1521
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
1522
+ agentConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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>;
1548
+ }, "strip", z.ZodTypeAny, {
1549
+ agent: string & z.BRAND<"AgentId">;
1550
+ model: string;
1551
+ nodeId: string;
1552
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1553
+ role?: string | undefined;
1554
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1555
+ worktreeId?: string | undefined;
1556
+ agentConfig?: Record<string, unknown> | undefined;
1557
+ input?: string | undefined;
1558
+ branch?: string | undefined;
1559
+ systemPrompt?: string | undefined;
1560
+ dependsOn?: string[] | undefined;
1561
+ metadata?: Record<string, unknown> | undefined;
1562
+ }, {
1563
+ agent: string;
1564
+ model: string;
1565
+ nodeId: string;
1566
+ sessionId?: string | undefined;
1567
+ role?: string | undefined;
1568
+ project?: string | undefined;
1569
+ worktreeId?: string | undefined;
1570
+ agentConfig?: Record<string, unknown> | undefined;
1571
+ input?: string | undefined;
1572
+ branch?: string | undefined;
1573
+ systemPrompt?: string | undefined;
1574
+ dependsOn?: string[] | undefined;
1575
+ metadata?: Record<string, unknown> | undefined;
1576
+ }>, "many">;
1577
+ communicationGraph: z.ZodObject<{
1578
+ edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
1579
+ edgeId: z.ZodOptional<z.ZodString>;
1580
+ from: z.ZodString;
1581
+ to: z.ZodString;
1582
+ label: z.ZodOptional<z.ZodString>;
1583
+ condition: z.ZodOptional<z.ZodString>;
1584
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1585
+ }, "strip", z.ZodTypeAny, {
1586
+ from: string;
1587
+ to: string;
1588
+ label?: string | undefined;
1589
+ metadata?: Record<string, unknown> | undefined;
1590
+ edgeId?: string | undefined;
1591
+ condition?: string | undefined;
1592
+ }, {
1593
+ from: string;
1594
+ to: string;
1595
+ label?: string | undefined;
1596
+ metadata?: Record<string, unknown> | undefined;
1597
+ edgeId?: string | undefined;
1598
+ condition?: string | undefined;
1599
+ }>, "many">>;
1600
+ allowSelfLoop: z.ZodDefault<z.ZodBoolean>;
1601
+ maxIterations: z.ZodDefault<z.ZodNumber>;
1602
+ }, "strip", z.ZodTypeAny, {
1603
+ edges: {
1604
+ from: string;
1605
+ to: string;
1606
+ label?: string | undefined;
1607
+ metadata?: Record<string, unknown> | undefined;
1608
+ edgeId?: string | undefined;
1609
+ condition?: string | undefined;
1610
+ }[];
1611
+ allowSelfLoop: boolean;
1612
+ maxIterations: number;
1613
+ }, {
1614
+ edges?: {
1615
+ from: string;
1616
+ to: string;
1617
+ label?: string | undefined;
1618
+ metadata?: Record<string, unknown> | undefined;
1619
+ edgeId?: string | undefined;
1620
+ condition?: string | undefined;
1621
+ }[] | undefined;
1622
+ allowSelfLoop?: boolean | undefined;
1623
+ maxIterations?: number | undefined;
1624
+ }>;
1625
+ }, "strip", z.ZodTypeAny, {
1626
+ executor: {
1627
+ agent: string & z.BRAND<"AgentId">;
1628
+ role: "executor";
1629
+ model: string;
1630
+ nodeId: string;
1631
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1632
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1633
+ worktreeId?: string | undefined;
1634
+ agentConfig?: Record<string, unknown> | undefined;
1635
+ input?: string | undefined;
1636
+ branch?: string | undefined;
1637
+ systemPrompt?: string | undefined;
1638
+ dependsOn?: string[] | undefined;
1639
+ metadata?: Record<string, unknown> | undefined;
1640
+ };
1641
+ mode: "graph";
1642
+ workers: {
1643
+ agent: string & z.BRAND<"AgentId">;
1644
+ model: string;
1645
+ nodeId: string;
1646
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1647
+ role?: string | undefined;
1648
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1649
+ worktreeId?: string | undefined;
1650
+ agentConfig?: Record<string, unknown> | undefined;
1651
+ input?: string | undefined;
1652
+ branch?: string | undefined;
1653
+ systemPrompt?: string | undefined;
1654
+ dependsOn?: string[] | undefined;
1655
+ metadata?: Record<string, unknown> | undefined;
1656
+ }[];
1657
+ communicationGraph: {
1658
+ edges: {
1659
+ from: string;
1660
+ to: string;
1661
+ label?: string | undefined;
1662
+ metadata?: Record<string, unknown> | undefined;
1663
+ edgeId?: string | undefined;
1664
+ condition?: string | undefined;
1665
+ }[];
1666
+ allowSelfLoop: boolean;
1667
+ maxIterations: number;
1668
+ };
1669
+ }, {
1670
+ executor: {
1671
+ agent: string;
1672
+ model: string;
1673
+ nodeId: string;
1674
+ sessionId?: string | undefined;
1675
+ role?: "executor" | undefined;
1676
+ project?: string | undefined;
1677
+ worktreeId?: string | undefined;
1678
+ agentConfig?: Record<string, unknown> | undefined;
1679
+ input?: string | undefined;
1680
+ branch?: string | undefined;
1681
+ systemPrompt?: string | undefined;
1682
+ dependsOn?: string[] | undefined;
1683
+ metadata?: Record<string, unknown> | undefined;
1684
+ };
1685
+ mode: "graph";
1686
+ workers: {
1687
+ agent: string;
1688
+ model: string;
1689
+ nodeId: string;
1690
+ sessionId?: string | undefined;
1691
+ role?: string | undefined;
1692
+ project?: string | undefined;
1693
+ worktreeId?: string | undefined;
1694
+ agentConfig?: Record<string, unknown> | undefined;
1695
+ input?: string | undefined;
1696
+ branch?: string | undefined;
1697
+ systemPrompt?: string | undefined;
1698
+ dependsOn?: string[] | undefined;
1699
+ metadata?: Record<string, unknown> | undefined;
1700
+ }[];
1701
+ communicationGraph: {
1702
+ edges?: {
1703
+ from: string;
1704
+ to: string;
1705
+ label?: string | undefined;
1706
+ metadata?: Record<string, unknown> | undefined;
1707
+ edgeId?: string | undefined;
1708
+ condition?: string | undefined;
1709
+ }[] | undefined;
1710
+ allowSelfLoop?: boolean | undefined;
1711
+ maxIterations?: number | undefined;
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;
1849
+ }>]>;
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
+ }>>;
1906
+ clientRequestId: z.ZodOptional<z.ZodString>;
1907
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1908
+ }, "strip", z.ZodTypeAny, {
1909
+ plan: {
1910
+ mode: "dag";
1911
+ nodes: {
1912
+ agent: string & z.BRAND<"AgentId">;
1913
+ model: string;
1914
+ nodeId: string;
1915
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1916
+ role?: string | undefined;
1917
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1918
+ worktreeId?: string | undefined;
1919
+ agentConfig?: Record<string, unknown> | undefined;
1920
+ input?: string | undefined;
1921
+ branch?: string | undefined;
1922
+ systemPrompt?: string | undefined;
1923
+ dependsOn?: string[] | undefined;
1924
+ metadata?: Record<string, unknown> | undefined;
1925
+ }[];
1926
+ edges?: {
1927
+ from: string;
1928
+ to: string;
1929
+ label?: string | undefined;
1930
+ metadata?: Record<string, unknown> | undefined;
1931
+ edgeId?: string | undefined;
1932
+ condition?: string | undefined;
1933
+ }[] | undefined;
1934
+ finalNodeId?: string | undefined;
1935
+ } | {
1936
+ executor: {
1937
+ agent: string & z.BRAND<"AgentId">;
1938
+ role: "executor";
1939
+ model: string;
1940
+ nodeId: string;
1941
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1942
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1943
+ worktreeId?: string | undefined;
1944
+ agentConfig?: Record<string, unknown> | undefined;
1945
+ input?: string | undefined;
1946
+ branch?: string | undefined;
1947
+ systemPrompt?: string | undefined;
1948
+ dependsOn?: string[] | undefined;
1949
+ metadata?: Record<string, unknown> | undefined;
1950
+ };
1951
+ mode: "graph";
1952
+ workers: {
1953
+ agent: string & z.BRAND<"AgentId">;
1954
+ model: string;
1955
+ nodeId: string;
1956
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
1957
+ role?: string | undefined;
1958
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
1959
+ worktreeId?: string | undefined;
1960
+ agentConfig?: Record<string, unknown> | undefined;
1961
+ input?: string | undefined;
1962
+ branch?: string | undefined;
1963
+ systemPrompt?: string | undefined;
1964
+ dependsOn?: string[] | undefined;
1965
+ metadata?: Record<string, unknown> | undefined;
1966
+ }[];
1967
+ communicationGraph: {
1968
+ edges: {
1969
+ from: string;
1970
+ to: string;
1971
+ label?: string | undefined;
1972
+ metadata?: Record<string, unknown> | undefined;
1973
+ edgeId?: string | undefined;
1974
+ condition?: string | undefined;
1975
+ }[];
1976
+ allowSelfLoop: boolean;
1977
+ maxIterations: number;
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
+ };
2003
+ };
2004
+ clientRequestId?: string | undefined;
2005
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
2006
+ worktreeId?: string | undefined;
2007
+ input?: string | undefined;
2008
+ branch?: string | undefined;
2009
+ resumeFrom?: {
2010
+ strategy: string;
2011
+ workflowId: string;
2012
+ rerunNodes?: string[] | undefined;
2013
+ } | undefined;
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;
2026
+ }, {
2027
+ plan: {
2028
+ mode: "dag";
2029
+ nodes: {
2030
+ agent: string;
2031
+ model: string;
2032
+ nodeId: string;
2033
+ sessionId?: string | undefined;
2034
+ role?: string | undefined;
2035
+ project?: string | undefined;
2036
+ worktreeId?: string | undefined;
2037
+ agentConfig?: Record<string, unknown> | undefined;
2038
+ input?: string | undefined;
2039
+ branch?: string | undefined;
2040
+ systemPrompt?: string | undefined;
2041
+ dependsOn?: string[] | undefined;
2042
+ metadata?: Record<string, unknown> | undefined;
2043
+ }[];
2044
+ edges?: {
2045
+ from: string;
2046
+ to: string;
2047
+ label?: string | undefined;
2048
+ metadata?: Record<string, unknown> | undefined;
2049
+ edgeId?: string | undefined;
2050
+ condition?: string | undefined;
2051
+ }[] | undefined;
2052
+ finalNodeId?: string | undefined;
2053
+ } | {
2054
+ executor: {
2055
+ agent: string;
2056
+ model: string;
2057
+ nodeId: string;
2058
+ sessionId?: string | undefined;
2059
+ role?: "executor" | undefined;
2060
+ project?: string | undefined;
2061
+ worktreeId?: string | undefined;
2062
+ agentConfig?: Record<string, unknown> | undefined;
2063
+ input?: string | undefined;
2064
+ branch?: string | undefined;
2065
+ systemPrompt?: string | undefined;
2066
+ dependsOn?: string[] | undefined;
2067
+ metadata?: Record<string, unknown> | undefined;
2068
+ };
2069
+ mode: "graph";
2070
+ workers: {
2071
+ agent: string;
2072
+ model: string;
2073
+ nodeId: string;
2074
+ sessionId?: string | undefined;
2075
+ role?: string | undefined;
2076
+ project?: string | undefined;
2077
+ worktreeId?: string | undefined;
2078
+ agentConfig?: Record<string, unknown> | undefined;
2079
+ input?: string | undefined;
2080
+ branch?: string | undefined;
2081
+ systemPrompt?: string | undefined;
2082
+ dependsOn?: string[] | undefined;
2083
+ metadata?: Record<string, unknown> | undefined;
2084
+ }[];
2085
+ communicationGraph: {
2086
+ edges?: {
2087
+ from: string;
2088
+ to: string;
2089
+ label?: string | undefined;
2090
+ metadata?: Record<string, unknown> | undefined;
2091
+ edgeId?: string | undefined;
2092
+ condition?: string | undefined;
2093
+ }[] | undefined;
2094
+ allowSelfLoop?: boolean | undefined;
2095
+ maxIterations?: number | undefined;
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;
2121
+ };
2122
+ clientRequestId?: string | undefined;
2123
+ project?: string | undefined;
2124
+ worktreeId?: string | undefined;
2125
+ input?: string | undefined;
2126
+ branch?: string | undefined;
2127
+ resumeFrom?: {
2128
+ workflowId: string;
2129
+ strategy?: string | undefined;
2130
+ rerunNodes?: string[] | undefined;
2131
+ } | undefined;
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;
2144
+ }>;
2145
+ export type WorkflowRunParams = z.infer<typeof WorkflowRunParams>;
2146
+ export declare const WorkflowRunResult: z.ZodObject<{
2147
+ workflowId: z.ZodString;
2148
+ status: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
2149
+ createdAt: z.ZodString;
2150
+ /** 是否走的 resume 路径。 */
2151
+ resumed: z.ZodDefault<z.ZodBoolean>;
2152
+ }, "strip", z.ZodTypeAny, {
2153
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2154
+ createdAt: string;
2155
+ workflowId: string;
2156
+ resumed: boolean;
2157
+ }, {
2158
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2159
+ createdAt: string;
2160
+ workflowId: string;
2161
+ resumed?: boolean | undefined;
2162
+ }>;
2163
+ export type WorkflowRunResult = z.infer<typeof WorkflowRunResult>;
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
+ }>>;
2177
+ }, "strip", z.ZodTypeAny, {
2178
+ status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
2179
+ text?: string | undefined;
2180
+ usage?: {
2181
+ inputTokens?: number | undefined;
2182
+ outputTokens?: number | undefined;
2183
+ } | undefined;
2184
+ }, {
2185
+ status: "aborted" | "interrupted" | "completed" | "failed" | "timeout";
2186
+ text?: string | undefined;
2187
+ usage?: {
2188
+ inputTokens?: number | undefined;
2189
+ outputTokens?: number | undefined;
2190
+ } | undefined;
2191
+ }>;
2192
+ export type WorkflowNodeResult = z.infer<typeof WorkflowNodeResult>;
2193
+ export declare const WorkflowNodeRuntime: z.ZodObject<{
2194
+ nodeId: z.ZodString;
2195
+ status: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
2196
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
2197
+ model: z.ZodString;
2198
+ role: z.ZodOptional<z.ZodString>;
2199
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
2200
+ turnId: z.ZodOptional<z.ZodString>;
2201
+ startedAt: z.ZodOptional<z.ZodString>;
2202
+ completedAt: z.ZodOptional<z.ZodString>;
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>;
2234
+ }, "strip", z.ZodTypeAny, {
2235
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2236
+ agent: string & z.BRAND<"AgentId">;
2237
+ model: string;
2238
+ nodeId: string;
2239
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
2240
+ role?: string | undefined;
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;
2250
+ error?: string | undefined;
2251
+ startedAt?: string | undefined;
2252
+ completedAt?: string | undefined;
2253
+ iterations?: number | undefined;
2254
+ }, {
2255
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2256
+ agent: string;
2257
+ model: string;
2258
+ nodeId: string;
2259
+ sessionId?: string | undefined;
2260
+ role?: string | undefined;
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;
2270
+ error?: string | undefined;
2271
+ startedAt?: string | undefined;
2272
+ completedAt?: string | undefined;
2273
+ iterations?: number | undefined;
2274
+ }>;
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>;
2284
+ export declare const WorkflowStatusResult: z.ZodObject<{
2285
+ workflowId: z.ZodString;
2286
+ status: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
2287
+ /** workflow 默认 project;v0.6 起可选。 */
2288
+ project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
2289
+ mode: z.ZodEnum<["dag", "graph", "discussion"]>;
2290
+ nodes: z.ZodArray<z.ZodObject<{
2291
+ nodeId: z.ZodString;
2292
+ status: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
2293
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
2294
+ model: z.ZodString;
2295
+ role: z.ZodOptional<z.ZodString>;
2296
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
2297
+ turnId: z.ZodOptional<z.ZodString>;
2298
+ startedAt: z.ZodOptional<z.ZodString>;
2299
+ completedAt: z.ZodOptional<z.ZodString>;
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>;
2331
+ }, "strip", z.ZodTypeAny, {
2332
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2333
+ agent: string & z.BRAND<"AgentId">;
2334
+ model: string;
2335
+ nodeId: string;
2336
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
2337
+ role?: string | undefined;
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;
2347
+ error?: string | undefined;
2348
+ startedAt?: string | undefined;
2349
+ completedAt?: string | undefined;
2350
+ iterations?: number | undefined;
2351
+ }, {
2352
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2353
+ agent: string;
2354
+ model: string;
2355
+ nodeId: string;
2356
+ sessionId?: string | undefined;
2357
+ role?: string | undefined;
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;
2367
+ error?: string | undefined;
2368
+ startedAt?: string | undefined;
2369
+ completedAt?: string | undefined;
2370
+ iterations?: number | undefined;
2371
+ }>, "many">;
2372
+ createdAt: z.ZodString;
2373
+ updatedAt: z.ZodString;
2374
+ completedAt: z.ZodOptional<z.ZodString>;
2375
+ error: z.ZodOptional<z.ZodString>;
2376
+ finalText: z.ZodOptional<z.ZodString>;
2377
+ /** 是否可 resume:phonon 持有该 workflow 的 checkpoint。 */
2378
+ resumable: z.ZodDefault<z.ZodBoolean>;
2379
+ }, "strip", z.ZodTypeAny, {
2380
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2381
+ createdAt: string;
2382
+ mode: "dag" | "graph" | "discussion";
2383
+ workflowId: string;
2384
+ updatedAt: string;
2385
+ nodes: {
2386
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2387
+ agent: string & z.BRAND<"AgentId">;
2388
+ model: string;
2389
+ nodeId: string;
2390
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
2391
+ role?: string | undefined;
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;
2401
+ error?: string | undefined;
2402
+ startedAt?: string | undefined;
2403
+ completedAt?: string | undefined;
2404
+ iterations?: number | undefined;
2405
+ }[];
2406
+ resumable: boolean;
2407
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
2408
+ error?: string | undefined;
2409
+ completedAt?: string | undefined;
2410
+ finalText?: string | undefined;
2411
+ }, {
2412
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2413
+ createdAt: string;
2414
+ mode: "dag" | "graph" | "discussion";
2415
+ workflowId: string;
2416
+ updatedAt: string;
2417
+ nodes: {
2418
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2419
+ agent: string;
2420
+ model: string;
2421
+ nodeId: string;
2422
+ sessionId?: string | undefined;
2423
+ role?: string | undefined;
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;
2433
+ error?: string | undefined;
2434
+ startedAt?: string | undefined;
2435
+ completedAt?: string | undefined;
2436
+ iterations?: number | undefined;
2437
+ }[];
2438
+ project?: string | undefined;
2439
+ error?: string | undefined;
2440
+ completedAt?: string | undefined;
2441
+ finalText?: string | undefined;
2442
+ resumable?: boolean | undefined;
2443
+ }>;
2444
+ export type WorkflowStatusResult = z.infer<typeof WorkflowStatusResult>;
2445
+ export declare const WorkflowCancelParams: z.ZodObject<{
2446
+ workflowId: z.ZodString;
2447
+ reason: z.ZodOptional<z.ZodString>;
2448
+ }, "strip", z.ZodTypeAny, {
2449
+ workflowId: string;
2450
+ reason?: string | undefined;
2451
+ }, {
2452
+ workflowId: string;
2453
+ reason?: string | undefined;
2454
+ }>;
2455
+ export type WorkflowCancelParams = z.infer<typeof WorkflowCancelParams>;
2456
+ export declare const WorkflowCancelResult: z.ZodObject<{
2457
+ workflowId: z.ZodString;
2458
+ status: z.ZodLiteral<"cancelled">;
2459
+ }, "strip", z.ZodTypeAny, {
2460
+ status: "cancelled";
2461
+ workflowId: string;
2462
+ }, {
2463
+ status: "cancelled";
2464
+ workflowId: string;
2465
+ }>;
2466
+ export type WorkflowCancelResult = z.infer<typeof WorkflowCancelResult>;
2467
+ export declare const WorkflowListParams: z.ZodObject<{
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>;
2472
+ limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
2473
+ cursor: z.ZodOptional<z.ZodString>;
2474
+ }, "strip", z.ZodTypeAny, {
2475
+ status?: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled" | undefined;
2476
+ limit?: number | undefined;
2477
+ cursor?: string | undefined;
2478
+ projectId?: (string & z.BRAND<"ProjectId">) | undefined;
2479
+ since?: string | undefined;
2480
+ until?: string | undefined;
2481
+ }, {
2482
+ status?: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled" | undefined;
2483
+ limit?: number | undefined;
2484
+ cursor?: string | undefined;
2485
+ projectId?: string | undefined;
2486
+ since?: string | undefined;
2487
+ until?: string | undefined;
2488
+ }>;
2489
+ export type WorkflowListParams = z.infer<typeof WorkflowListParams>;
2490
+ export declare const WorkflowListResult: z.ZodObject<{
2491
+ workflows: z.ZodArray<z.ZodObject<{
2492
+ workflowId: z.ZodString;
2493
+ status: z.ZodEnum<["queued", "running", "completed", "failed", "cancelled", "timeout"]>;
2494
+ /** workflow 默认 project;v0.6 起可选。 */
2495
+ project: z.ZodOptional<z.ZodBranded<z.ZodString, "ProjectId">>;
2496
+ mode: z.ZodEnum<["dag", "graph", "discussion"]>;
2497
+ nodes: z.ZodArray<z.ZodObject<{
2498
+ nodeId: z.ZodString;
2499
+ status: z.ZodEnum<["pending", "ready", "running", "completed", "failed", "skipped", "cancelled"]>;
2500
+ agent: z.ZodBranded<z.ZodString, "AgentId">;
2501
+ model: z.ZodString;
2502
+ role: z.ZodOptional<z.ZodString>;
2503
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
2504
+ turnId: z.ZodOptional<z.ZodString>;
2505
+ startedAt: z.ZodOptional<z.ZodString>;
2506
+ completedAt: z.ZodOptional<z.ZodString>;
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>;
2538
+ }, "strip", z.ZodTypeAny, {
2539
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2540
+ agent: string & z.BRAND<"AgentId">;
2541
+ model: string;
2542
+ nodeId: string;
2543
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
2544
+ role?: string | undefined;
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;
2554
+ error?: string | undefined;
2555
+ startedAt?: string | undefined;
2556
+ completedAt?: string | undefined;
2557
+ iterations?: number | undefined;
2558
+ }, {
2559
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2560
+ agent: string;
2561
+ model: string;
2562
+ nodeId: string;
2563
+ sessionId?: string | undefined;
2564
+ role?: string | undefined;
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;
2574
+ error?: string | undefined;
2575
+ startedAt?: string | undefined;
2576
+ completedAt?: string | undefined;
2577
+ iterations?: number | undefined;
2578
+ }>, "many">;
2579
+ createdAt: z.ZodString;
2580
+ updatedAt: z.ZodString;
2581
+ completedAt: z.ZodOptional<z.ZodString>;
2582
+ error: z.ZodOptional<z.ZodString>;
2583
+ finalText: z.ZodOptional<z.ZodString>;
2584
+ /** 是否可 resume:phonon 持有该 workflow 的 checkpoint。 */
2585
+ resumable: z.ZodDefault<z.ZodBoolean>;
2586
+ }, "strip", z.ZodTypeAny, {
2587
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2588
+ createdAt: string;
2589
+ mode: "dag" | "graph" | "discussion";
2590
+ workflowId: string;
2591
+ updatedAt: string;
2592
+ nodes: {
2593
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2594
+ agent: string & z.BRAND<"AgentId">;
2595
+ model: string;
2596
+ nodeId: string;
2597
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
2598
+ role?: string | undefined;
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;
2608
+ error?: string | undefined;
2609
+ startedAt?: string | undefined;
2610
+ completedAt?: string | undefined;
2611
+ iterations?: number | undefined;
2612
+ }[];
2613
+ resumable: boolean;
2614
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
2615
+ error?: string | undefined;
2616
+ completedAt?: string | undefined;
2617
+ finalText?: string | undefined;
2618
+ }, {
2619
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2620
+ createdAt: string;
2621
+ mode: "dag" | "graph" | "discussion";
2622
+ workflowId: string;
2623
+ updatedAt: string;
2624
+ nodes: {
2625
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2626
+ agent: string;
2627
+ model: string;
2628
+ nodeId: string;
2629
+ sessionId?: string | undefined;
2630
+ role?: string | undefined;
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;
2640
+ error?: string | undefined;
2641
+ startedAt?: string | undefined;
2642
+ completedAt?: string | undefined;
2643
+ iterations?: number | undefined;
2644
+ }[];
2645
+ project?: string | undefined;
2646
+ error?: string | undefined;
2647
+ completedAt?: string | undefined;
2648
+ finalText?: string | undefined;
2649
+ resumable?: boolean | undefined;
2650
+ }>, "many">;
2651
+ nextCursor: z.ZodOptional<z.ZodString>;
2652
+ }, "strip", z.ZodTypeAny, {
2653
+ workflows: {
2654
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2655
+ createdAt: string;
2656
+ mode: "dag" | "graph" | "discussion";
2657
+ workflowId: string;
2658
+ updatedAt: string;
2659
+ nodes: {
2660
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2661
+ agent: string & z.BRAND<"AgentId">;
2662
+ model: string;
2663
+ nodeId: string;
2664
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
2665
+ role?: string | undefined;
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;
2675
+ error?: string | undefined;
2676
+ startedAt?: string | undefined;
2677
+ completedAt?: string | undefined;
2678
+ iterations?: number | undefined;
2679
+ }[];
2680
+ resumable: boolean;
2681
+ project?: (string & z.BRAND<"ProjectId">) | undefined;
2682
+ error?: string | undefined;
2683
+ completedAt?: string | undefined;
2684
+ finalText?: string | undefined;
2685
+ }[];
2686
+ nextCursor?: string | undefined;
2687
+ }, {
2688
+ workflows: {
2689
+ status: "running" | "queued" | "completed" | "failed" | "timeout" | "cancelled";
2690
+ createdAt: string;
2691
+ mode: "dag" | "graph" | "discussion";
2692
+ workflowId: string;
2693
+ updatedAt: string;
2694
+ nodes: {
2695
+ status: "running" | "completed" | "failed" | "pending" | "cancelled" | "ready" | "skipped";
2696
+ agent: string;
2697
+ model: string;
2698
+ nodeId: string;
2699
+ sessionId?: string | undefined;
2700
+ role?: string | undefined;
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;
2710
+ error?: string | undefined;
2711
+ startedAt?: string | undefined;
2712
+ completedAt?: string | undefined;
2713
+ iterations?: number | undefined;
2714
+ }[];
2715
+ project?: string | undefined;
2716
+ error?: string | undefined;
2717
+ completedAt?: string | undefined;
2718
+ finalText?: string | undefined;
2719
+ resumable?: boolean | undefined;
2720
+ }[];
2721
+ nextCursor?: string | undefined;
2722
+ }>;
2723
+ export type WorkflowListResult = z.infer<typeof WorkflowListResult>;
2724
+ export declare const WorkflowEvent: z.ZodObject<{
2725
+ workflowId: z.ZodString;
2726
+ seq: z.ZodNumber;
2727
+ type: z.ZodEnum<["workflow.status", "node.status", "edge.route", "executor.decision", "round.started", "round.completed", "discussion.terminated"]>;
2728
+ nodeId: z.ZodOptional<z.ZodString>;
2729
+ sessionId: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
2730
+ turnId: z.ZodOptional<z.ZodString>;
2731
+ agent: z.ZodOptional<z.ZodBranded<z.ZodString, "AgentId">>;
2732
+ model: z.ZodOptional<z.ZodString>;
2733
+ role: z.ZodOptional<z.ZodString>;
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 等。 */
2764
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2765
+ timestamp: z.ZodString;
2766
+ }, "strip", z.ZodTypeAny, {
2767
+ type: "workflow.status" | "node.status" | "edge.route" | "executor.decision" | "round.started" | "round.completed" | "discussion.terminated";
2768
+ seq: number;
2769
+ workflowId: string;
2770
+ timestamp: string;
2771
+ status?: "running" | "queued" | "completed" | "failed" | "timeout" | "pending" | "cancelled" | "ready" | "skipped" | undefined;
2772
+ sessionId?: (string & z.BRAND<"SessionId">) | undefined;
2773
+ agent?: (string & z.BRAND<"AgentId">) | undefined;
2774
+ role?: string | undefined;
2775
+ model?: string | undefined;
2776
+ turnId?: string | undefined;
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;
2785
+ nodeId?: string | undefined;
2786
+ payload?: Record<string, unknown> | undefined;
2787
+ }, {
2788
+ type: "workflow.status" | "node.status" | "edge.route" | "executor.decision" | "round.started" | "round.completed" | "discussion.terminated";
2789
+ seq: number;
2790
+ workflowId: string;
2791
+ timestamp: string;
2792
+ status?: "running" | "queued" | "completed" | "failed" | "timeout" | "pending" | "cancelled" | "ready" | "skipped" | undefined;
2793
+ sessionId?: string | undefined;
2794
+ agent?: string | undefined;
2795
+ role?: string | undefined;
2796
+ model?: string | undefined;
2797
+ turnId?: string | undefined;
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;
2806
+ nodeId?: string | undefined;
2807
+ payload?: Record<string, unknown> | undefined;
2808
+ }>;
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>;
2965
+ //# sourceMappingURL=workflow.d.ts.map