@mickorz/opencode-agentic-workflow 0.4.0 → 0.5.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.
Files changed (127) hide show
  1. package/README.md +306 -5
  2. package/dist/cli/config.d.ts +121 -0
  3. package/dist/cli/config.js +331 -0
  4. package/dist/cli/config.js.map +1 -0
  5. package/dist/cli/doctor.d.ts +5 -0
  6. package/dist/cli/doctor.js +141 -0
  7. package/dist/cli/doctor.js.map +1 -0
  8. package/dist/cli/index.d.ts +18 -0
  9. package/dist/cli/index.js +120 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/cli/install.d.ts +19 -0
  12. package/dist/cli/install.js +135 -0
  13. package/dist/cli/install.js.map +1 -0
  14. package/dist/cli/uninstall.d.ts +16 -0
  15. package/dist/cli/uninstall.js +110 -0
  16. package/dist/cli/uninstall.js.map +1 -0
  17. package/dist/cli/update.d.ts +15 -0
  18. package/dist/cli/update.js +86 -0
  19. package/dist/cli/update.js.map +1 -0
  20. package/dist/core/index.d.ts +39 -0
  21. package/dist/core/index.js +38 -0
  22. package/dist/core/index.js.map +1 -0
  23. package/dist/observability/events.d.ts +43 -0
  24. package/dist/observability/events.js.map +1 -1
  25. package/dist/plugin/checkpoint-override.d.ts +7 -9
  26. package/dist/plugin/checkpoint-override.js +8 -14
  27. package/dist/plugin/checkpoint-override.js.map +1 -1
  28. package/dist/plugin/define-workflow.d.ts +33 -0
  29. package/dist/plugin/define-workflow.js +103 -0
  30. package/dist/plugin/define-workflow.js.map +1 -0
  31. package/dist/plugin/index.js +406 -26
  32. package/dist/plugin/index.js.map +1 -1
  33. package/dist/plugin/opencode-v2-executor.js +58 -46
  34. package/dist/plugin/opencode-v2-executor.js.map +1 -1
  35. package/dist/plugin/progress-board.d.ts +64 -0
  36. package/dist/plugin/progress-board.js +150 -0
  37. package/dist/plugin/progress-board.js.map +1 -0
  38. package/dist/plugin/progress-rpc.d.ts +390 -0
  39. package/dist/plugin/progress-rpc.js +318 -0
  40. package/dist/plugin/progress-rpc.js.map +1 -0
  41. package/dist/plugin/progress-view.d.ts +82 -0
  42. package/dist/plugin/progress-view.js +244 -0
  43. package/dist/plugin/progress-view.js.map +1 -0
  44. package/dist/plugin/run-sessions.d.ts +28 -0
  45. package/dist/plugin/run-sessions.js +46 -0
  46. package/dist/plugin/run-sessions.js.map +1 -0
  47. package/dist/plugin/tool-args.d.ts +15 -0
  48. package/dist/plugin/tool-args.js +28 -0
  49. package/dist/plugin/tool-args.js.map +1 -0
  50. package/dist/plugin/tui.d.ts +11 -4
  51. package/dist/plugin/tui.js +149 -5
  52. package/dist/plugin/tui.js.map +1 -1
  53. package/dist/plugin/workflow-control.d.ts +16 -0
  54. package/dist/plugin/workflow-control.js +85 -0
  55. package/dist/plugin/workflow-control.js.map +1 -0
  56. package/dist/plugin/workflow-schedule.d.ts +24 -0
  57. package/dist/plugin/workflow-schedule.js +97 -0
  58. package/dist/plugin/workflow-schedule.js.map +1 -0
  59. package/dist/quality/checkpoint.d.ts +5 -2
  60. package/dist/quality/checkpoint.js +11 -6
  61. package/dist/quality/checkpoint.js.map +1 -1
  62. package/dist/quality/verify.d.ts +21 -2
  63. package/dist/quality/verify.js +36 -14
  64. package/dist/quality/verify.js.map +1 -1
  65. package/dist/registry/definition.d.ts +12 -0
  66. package/dist/registry/definition.js.map +1 -1
  67. package/dist/registry/registry.d.ts +4 -0
  68. package/dist/registry/registry.js +20 -1
  69. package/dist/registry/registry.js.map +1 -1
  70. package/dist/registry/run-control.d.ts +27 -0
  71. package/dist/registry/run-control.js +51 -0
  72. package/dist/registry/run-control.js.map +1 -0
  73. package/dist/registry/runner.d.ts +29 -6
  74. package/dist/registry/runner.js +153 -35
  75. package/dist/registry/runner.js.map +1 -1
  76. package/dist/runtime/errors.d.ts +26 -0
  77. package/dist/runtime/errors.js +30 -0
  78. package/dist/runtime/errors.js.map +1 -1
  79. package/dist/runtime/executor.d.ts +22 -0
  80. package/dist/runtime/executor.js.map +1 -1
  81. package/dist/runtime/run-context.d.ts +44 -0
  82. package/dist/runtime/run-context.js +32 -0
  83. package/dist/runtime/run-context.js.map +1 -0
  84. package/dist/scheduler/cron.d.ts +29 -0
  85. package/dist/scheduler/cron.js +171 -0
  86. package/dist/scheduler/cron.js.map +1 -0
  87. package/dist/scheduler/service.d.ts +78 -0
  88. package/dist/scheduler/service.js +210 -0
  89. package/dist/scheduler/service.js.map +1 -0
  90. package/dist/scheduler/store.d.ts +26 -0
  91. package/dist/scheduler/store.js +94 -0
  92. package/dist/scheduler/store.js.map +1 -0
  93. package/dist/scheduler/types.d.ts +53 -0
  94. package/dist/scheduler/types.js +12 -0
  95. package/dist/scheduler/types.js.map +1 -0
  96. package/dist/state/journal.d.ts +23 -0
  97. package/dist/state/journal.js +2 -0
  98. package/dist/state/journal.js.map +1 -1
  99. package/dist/state/recorder.d.ts +67 -0
  100. package/dist/state/recorder.js +148 -2
  101. package/dist/state/recorder.js.map +1 -1
  102. package/dist/workflow/agent.d.ts +42 -1
  103. package/dist/workflow/agent.js +116 -6
  104. package/dist/workflow/agent.js.map +1 -1
  105. package/dist/workflow/judge-panel.d.ts +37 -0
  106. package/dist/workflow/judge-panel.js +66 -0
  107. package/dist/workflow/judge-panel.js.map +1 -0
  108. package/dist/workflow/pipeline.d.ts +21 -0
  109. package/dist/workflow/pipeline.js +71 -0
  110. package/dist/workflow/pipeline.js.map +1 -0
  111. package/dist/workflow/race.d.ts +16 -0
  112. package/dist/workflow/race.js +46 -0
  113. package/dist/workflow/race.js.map +1 -0
  114. package/dist/workflow/sequence.js +6 -0
  115. package/dist/workflow/sequence.js.map +1 -1
  116. package/dist/workflows/loader.d.ts +124 -0
  117. package/dist/workflows/loader.js +500 -0
  118. package/dist/workflows/loader.js.map +1 -0
  119. package/dist/workspace/ambient.d.ts +6 -4
  120. package/dist/workspace/ambient.js +10 -4
  121. package/dist/workspace/ambient.js.map +1 -1
  122. package/package.json +16 -6
  123. package/skills/workflow-authoring/SKILL.md +111 -0
  124. package/skills/workflow-optimize/SKILL.md +70 -0
  125. package/dist/workflows/index.d.ts +0 -19
  126. package/dist/workflows/index.js +0 -40
  127. package/dist/workflows/index.js.map +0 -1
@@ -0,0 +1,390 @@
1
+ /**
2
+ * Workflow Progress RPC 契约(P2-8,server 与 TUI 双形态共享)
3
+ *
4
+ * 流向:
5
+ * server RunJournal 状态转换 -> emitEvent("run.progress") -> ProgressBoard
6
+ * --events.emit--> rpc.agentic-workflow-progress.progress { run 快照 }
7
+ * TUI 面板:
8
+ * <--call-- rpc "snapshot" -> { runs: [...] }(面板打开时初始同步)
9
+ * --事件--> 实时更新(全量快照,无需增量对账)
10
+ *
11
+ * 快照小而可序列化(不含步骤 output——详情看 journal 文件)。
12
+ */
13
+ import type { RunProgressSnapshot } from "../observability/events.js";
14
+ import type { RunDetail } from "../state/recorder.js";
15
+ /** 会话回放条目(session 方法输出;文本预览化,面板/工具侧消费) */
16
+ export interface SessionReplayMessage {
17
+ /** 宿主消息类型(user / assistant …) */
18
+ type: string;
19
+ /** 文本内容(多 text part 合并,预览截断) */
20
+ text: string;
21
+ }
22
+ export interface SessionReplay {
23
+ /** 会话 ID(回放来源;null = 找不到会话) */
24
+ sessionID: string;
25
+ /** 所属步骤名(journal 定位用) */
26
+ step?: string;
27
+ /** 对话消息(时间顺序;条数与单条长度均截断) */
28
+ messages: SessionReplayMessage[];
29
+ }
30
+ export declare const ProgressRpc: {
31
+ readonly id: "agentic-workflow-progress";
32
+ readonly methods: {
33
+ /** TUI -> server:拉取当前 board(面板打开时初始同步) */
34
+ readonly snapshot: {
35
+ readonly input: {
36
+ readonly type: "object";
37
+ readonly properties: {};
38
+ readonly additionalProperties: false;
39
+ };
40
+ readonly output: {
41
+ readonly type: "object";
42
+ readonly properties: {
43
+ readonly runs: {
44
+ readonly type: "array";
45
+ readonly items: {
46
+ readonly type: "object";
47
+ readonly properties: {
48
+ readonly runId: {
49
+ readonly type: "string";
50
+ };
51
+ readonly workflow: {
52
+ readonly type: "object";
53
+ readonly properties: {
54
+ readonly id: {
55
+ readonly type: "string";
56
+ };
57
+ readonly version: {
58
+ readonly type: "string";
59
+ };
60
+ };
61
+ readonly required: readonly ["id", "version"];
62
+ readonly additionalProperties: false;
63
+ };
64
+ readonly status: {
65
+ readonly type: "string";
66
+ };
67
+ readonly startedAt: {
68
+ readonly type: "number";
69
+ };
70
+ readonly completedAt: {
71
+ readonly type: "number";
72
+ };
73
+ readonly failure: {
74
+ readonly type: "string";
75
+ };
76
+ readonly parentRunId: {
77
+ readonly type: "string";
78
+ };
79
+ readonly depth: {
80
+ readonly type: "number";
81
+ };
82
+ readonly steps: {
83
+ readonly type: "array";
84
+ readonly items: {
85
+ readonly type: "object";
86
+ readonly properties: {
87
+ readonly index: {
88
+ readonly type: "number";
89
+ };
90
+ readonly name: {
91
+ readonly type: "string";
92
+ };
93
+ readonly status: {
94
+ readonly type: "string";
95
+ };
96
+ readonly startedAt: {
97
+ readonly type: "number";
98
+ };
99
+ readonly completedAt: {
100
+ readonly type: "number";
101
+ };
102
+ };
103
+ readonly required: readonly ["index", "status"];
104
+ };
105
+ };
106
+ };
107
+ readonly required: readonly ["runId", "workflow", "status", "startedAt", "steps"];
108
+ };
109
+ };
110
+ };
111
+ readonly required: readonly ["runs"];
112
+ readonly additionalProperties: false;
113
+ };
114
+ };
115
+ /** TUI -> server:单个 run 的节点详情(journal 单读,载荷为预览) */
116
+ readonly detail: {
117
+ readonly input: {
118
+ readonly type: "object";
119
+ readonly properties: {
120
+ readonly runId: {
121
+ readonly type: "string";
122
+ };
123
+ };
124
+ readonly required: readonly ["runId"];
125
+ readonly additionalProperties: false;
126
+ };
127
+ readonly output: {
128
+ readonly type: "object";
129
+ readonly properties: {
130
+ readonly run: {
131
+ readonly oneOf: readonly [{
132
+ readonly type: "object";
133
+ readonly properties: {
134
+ readonly runId: {
135
+ readonly type: "string";
136
+ };
137
+ readonly workflow: {
138
+ readonly type: "object";
139
+ readonly properties: {
140
+ readonly id: {
141
+ readonly type: "string";
142
+ };
143
+ readonly version: {
144
+ readonly type: "string";
145
+ };
146
+ };
147
+ readonly required: readonly ["id", "version"];
148
+ readonly additionalProperties: false;
149
+ };
150
+ readonly status: {
151
+ readonly type: "string";
152
+ };
153
+ readonly startedAt: {
154
+ readonly type: "number";
155
+ };
156
+ readonly completedAt: {
157
+ readonly type: "number";
158
+ };
159
+ readonly failure: {
160
+ readonly type: "string";
161
+ };
162
+ readonly parentRunId: {
163
+ readonly type: "string";
164
+ };
165
+ readonly depth: {
166
+ readonly type: "number";
167
+ };
168
+ readonly args: {
169
+ readonly type: "string";
170
+ };
171
+ readonly steps: {
172
+ readonly type: "array";
173
+ readonly items: {
174
+ readonly type: "object";
175
+ readonly properties: {
176
+ readonly index: {
177
+ readonly type: "number";
178
+ };
179
+ readonly name: {
180
+ readonly type: "string";
181
+ };
182
+ readonly status: {
183
+ readonly type: "string";
184
+ };
185
+ readonly startedAt: {
186
+ readonly type: "number";
187
+ };
188
+ readonly completedAt: {
189
+ readonly type: "number";
190
+ };
191
+ readonly input: {
192
+ readonly type: "string";
193
+ };
194
+ readonly output: {
195
+ readonly type: "string";
196
+ };
197
+ readonly error: {
198
+ readonly type: "string";
199
+ };
200
+ readonly usage: {
201
+ readonly type: "object";
202
+ readonly properties: {
203
+ readonly input: {
204
+ readonly type: "number";
205
+ };
206
+ readonly output: {
207
+ readonly type: "number";
208
+ };
209
+ readonly reasoning: {
210
+ readonly type: "number";
211
+ };
212
+ };
213
+ readonly required: readonly ["input", "output", "reasoning"];
214
+ readonly additionalProperties: false;
215
+ };
216
+ readonly model: {
217
+ readonly type: "string";
218
+ };
219
+ readonly sessionIDs: {
220
+ readonly type: "array";
221
+ readonly items: {
222
+ readonly type: "string";
223
+ };
224
+ };
225
+ };
226
+ readonly required: readonly ["index", "status"];
227
+ };
228
+ };
229
+ };
230
+ readonly required: readonly ["runId", "workflow", "status", "startedAt", "steps"];
231
+ }, {
232
+ readonly type: "null";
233
+ }];
234
+ };
235
+ };
236
+ readonly required: readonly ["run"];
237
+ readonly additionalProperties: false;
238
+ };
239
+ };
240
+ /**
241
+ * TUI -> server:Open Session 回放——按 runId + 步骤名取该步骤子会话的
242
+ * 完整对话(文本预览)。index 选多会话步骤(pipeline)的第几个,缺省最后。
243
+ */
244
+ readonly session: {
245
+ readonly input: {
246
+ readonly type: "object";
247
+ readonly properties: {
248
+ readonly runId: {
249
+ readonly type: "string";
250
+ };
251
+ readonly step: {
252
+ readonly type: "string";
253
+ };
254
+ readonly index: {
255
+ readonly type: "number";
256
+ };
257
+ };
258
+ readonly required: readonly ["runId", "step"];
259
+ readonly additionalProperties: false;
260
+ };
261
+ readonly output: {
262
+ readonly type: "object";
263
+ readonly properties: {
264
+ readonly session: {
265
+ readonly oneOf: readonly [{
266
+ readonly type: "object";
267
+ readonly properties: {
268
+ readonly sessionID: {
269
+ readonly type: "string";
270
+ };
271
+ readonly step: {
272
+ readonly type: "string";
273
+ };
274
+ readonly messages: {
275
+ readonly type: "array";
276
+ readonly items: {
277
+ readonly type: "object";
278
+ readonly properties: {
279
+ readonly type: {
280
+ readonly type: "string";
281
+ };
282
+ readonly text: {
283
+ readonly type: "string";
284
+ };
285
+ };
286
+ readonly required: readonly ["type", "text"];
287
+ readonly additionalProperties: false;
288
+ };
289
+ };
290
+ };
291
+ readonly required: readonly ["sessionID", "messages"];
292
+ readonly additionalProperties: false;
293
+ }, {
294
+ readonly type: "null";
295
+ }];
296
+ };
297
+ };
298
+ readonly required: readonly ["session"];
299
+ readonly additionalProperties: false;
300
+ };
301
+ };
302
+ };
303
+ readonly events: {
304
+ /** server -> TUI:run 全量快照 */
305
+ progress: {
306
+ schema: {
307
+ readonly type: "object";
308
+ readonly properties: {
309
+ readonly runId: {
310
+ readonly type: "string";
311
+ };
312
+ readonly workflow: {
313
+ readonly type: "object";
314
+ readonly properties: {
315
+ readonly id: {
316
+ readonly type: "string";
317
+ };
318
+ readonly version: {
319
+ readonly type: "string";
320
+ };
321
+ };
322
+ readonly required: readonly ["id", "version"];
323
+ readonly additionalProperties: false;
324
+ };
325
+ readonly status: {
326
+ readonly type: "string";
327
+ };
328
+ readonly startedAt: {
329
+ readonly type: "number";
330
+ };
331
+ readonly completedAt: {
332
+ readonly type: "number";
333
+ };
334
+ readonly failure: {
335
+ readonly type: "string";
336
+ };
337
+ readonly parentRunId: {
338
+ readonly type: "string";
339
+ };
340
+ readonly depth: {
341
+ readonly type: "number";
342
+ };
343
+ readonly steps: {
344
+ readonly type: "array";
345
+ readonly items: {
346
+ readonly type: "object";
347
+ readonly properties: {
348
+ readonly index: {
349
+ readonly type: "number";
350
+ };
351
+ readonly name: {
352
+ readonly type: "string";
353
+ };
354
+ readonly status: {
355
+ readonly type: "string";
356
+ };
357
+ readonly startedAt: {
358
+ readonly type: "number";
359
+ };
360
+ readonly completedAt: {
361
+ readonly type: "number";
362
+ };
363
+ };
364
+ readonly required: readonly ["index", "status"];
365
+ };
366
+ };
367
+ };
368
+ readonly required: readonly ["runId", "workflow", "status", "startedAt", "steps"];
369
+ };
370
+ };
371
+ };
372
+ };
373
+ /** TUI 订阅用事件名(字面量类型;与 ProgressRpc.id 的一致性由单测保证) */
374
+ export declare const PROGRESS_EVENT: "rpc.agentic-workflow-progress.progress";
375
+ /** 收窄事件/方法载荷为快照(事件 data 为 unknown 形状);不合法返回 undefined */
376
+ export declare function parseRunSnapshot(data: unknown): RunProgressSnapshot | undefined;
377
+ /** 收窄 snapshot 方法输出为快照数组;不合法整体丢弃(面板回退到空态) */
378
+ export declare function parseRunSnapshotList(data: unknown): RunProgressSnapshot[];
379
+ /** 收窄 detail 方法入参为 runId;不合法(缺/非串)返回 undefined */
380
+ export declare function parseRunDetailRequest(data: unknown): string | undefined;
381
+ /** 收窄 detail 方法输出为详情;null(run 不存在/无 journal)或不合法返回 undefined */
382
+ export declare function parseRunDetail(data: unknown): RunDetail | undefined;
383
+ /** 收窄 session 方法入参;不合法返回 undefined */
384
+ export declare function parseSessionReplayRequest(data: unknown): {
385
+ runId: string;
386
+ step: string;
387
+ index?: number;
388
+ } | undefined;
389
+ /** 收窄 session 方法输出;不合法返回 undefined */
390
+ export declare function parseSessionReplay(data: unknown): SessionReplay | undefined;