cowork-flow 0.0.47 → 0.0.49

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 (90) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +102 -23
  3. package/package.json +8 -3
  4. package/src/cli.js +6 -0
  5. package/src/commands/init.js +0 -83
  6. package/src/commands/source-refresh.js +40 -0
  7. package/src/commands/sync.js +6 -0
  8. package/src/commands/update.js +59 -6
  9. package/src/lib/copy-template.js +200 -50
  10. package/src/lib/host-assets.js +367 -64
  11. package/src/lib/plan-applier.js +47 -0
  12. package/template/.claude/hooks/inject-workflow-state.py +7 -0
  13. package/template/.codex/hooks/inject-workflow-state.py +7 -0
  14. package/template/.codex/hooks.json +1 -1
  15. package/template/.cowork-flow/.version +1 -1
  16. package/template/.cowork-flow/config.yaml +0 -11
  17. package/template/.cowork-flow/scripts/adapters/cli/init_developer.py +0 -1
  18. package/template/.cowork-flow/scripts/adapters/cli/subagent.py +7 -4
  19. package/template/.cowork-flow/scripts/adapters/cli/task.py +8 -484
  20. package/template/.cowork-flow/scripts/adapters/cli/task_archive_commands.py +15 -134
  21. package/template/.cowork-flow/scripts/adapters/cli/task_context_commands.py +7 -1
  22. package/template/.cowork-flow/scripts/adapters/cli/task_lifecycle_commands.py +388 -0
  23. package/template/.cowork-flow/scripts/adapters/cli/task_navigation.py +163 -2
  24. package/template/.cowork-flow/scripts/adapters/git/git_context.py +16 -193
  25. package/template/.cowork-flow/scripts/adapters/host/host_manifest.py +170 -84
  26. package/template/.cowork-flow/scripts/infra/config.py +0 -17
  27. package/template/.cowork-flow/scripts/infra/developer_profile.py +0 -95
  28. package/template/.cowork-flow/scripts/infra/paths.py +0 -79
  29. package/template/.cowork-flow/scripts/infra/skill_manifest.py +23 -3
  30. package/template/.cowork-flow/scripts/infra/storage/operation_log.py +40 -0
  31. package/template/.cowork-flow/scripts/infra/storage/state_store.py +356 -1
  32. package/template/.cowork-flow/scripts/kernel/workflow_route.py +15 -15
  33. package/template/.cowork-flow/scripts/run.py +0 -5
  34. package/template/.cowork-flow/scripts/services/context_discovery.py +156 -0
  35. package/template/.cowork-flow/scripts/services/context_jsonl.py +119 -0
  36. package/template/.cowork-flow/scripts/services/context_paths.py +186 -0
  37. package/template/.cowork-flow/scripts/services/lifecycle_checks.py +186 -69
  38. package/template/.cowork-flow/scripts/services/lifecycle_policy.py +128 -0
  39. package/template/.cowork-flow/scripts/services/plan_binding.py +146 -0
  40. package/template/.cowork-flow/scripts/services/readiness.py +3 -170
  41. package/template/.cowork-flow/scripts/services/task_archive.py +115 -24
  42. package/template/.cowork-flow/scripts/services/task_context.py +103 -365
  43. package/template/.cowork-flow/scripts/services/task_creation.py +40 -5
  44. package/template/.cowork-flow/scripts/services/task_lifecycle.py +155 -18
  45. package/template/.cowork-flow/scripts/services/task_routing.py +80 -67
  46. package/template/.cowork-flow/scripts/services/task_utils.py +0 -146
  47. package/template/.cowork-flow/scripts/services/workflow_runtime.py +1 -1
  48. package/template/.cowork-flow/spec/contracts/capabilities.md +23 -0
  49. package/template/.cowork-flow/spec/contracts/decision-anchor.md +2 -2
  50. package/template/.cowork-flow/spec/contracts/error-output-as-data.md +8 -0
  51. package/template/.cowork-flow/spec/contracts/index.md +1 -0
  52. package/template/.cowork-flow/spec/contracts/party-mode-v2-board.md +20 -0
  53. package/template/.cowork-flow/spec/contracts/plan-binding.md +50 -0
  54. package/template/.cowork-flow/spec/contracts/skill-owned-actions.md +31 -7
  55. package/template/.cowork-flow/spec/guides/index.md +3 -1
  56. package/template/.cowork-flow/spec/index.md +5 -4
  57. package/template/.cowork-flow/spec/references/definition-of-done.md +2 -3
  58. package/template/.cowork-flow/spec/references/orchestration-patterns.md +1 -1
  59. package/template/.cowork-flow/spec/runtime/contract-registry.json +14 -0
  60. package/template/.cowork-flow/spec/runtime/host-assets.json +73 -3
  61. package/template/.cowork-flow/spec/runtime/index.md +1 -1
  62. package/template/.cowork-flow/spec/schemas/host-assets.schema.json +150 -8
  63. package/template/.zcode/.zcode-plugin/plugin.json +1 -1
  64. package/template/skills/batch-execution/SKILL.md +37 -3
  65. package/template/skills/batch-execution/scripts/batch_action.py +4 -0
  66. package/template/skills/batch-execution/scripts/batch_execution.py +120 -499
  67. package/template/skills/batch-execution/scripts/batch_recovery.py +94 -0
  68. package/template/skills/batch-execution/scripts/batch_state_machine.py +201 -0
  69. package/template/skills/batch-execution/scripts/batch_verification.py +326 -0
  70. package/template/skills/brainstorming/SKILL.md +8 -7
  71. package/template/skills/cowork-flow/SKILL.md +3 -0
  72. package/template/skills/party-mode/scripts/party_action_contract.py +113 -0
  73. package/template/skills/party-mode/scripts/party_actions.py +95 -0
  74. package/template/skills/party-mode/scripts/party_board_store.py +148 -0
  75. package/template/skills/party-mode/scripts/party_mode_v2.py +345 -317
  76. package/template/skills/party-mode/scripts/party_reports.py +177 -0
  77. package/template/skills/party-mode/scripts/party_state_machine.py +189 -0
  78. package/template/skills/runtime-health/SKILL.md +14 -2
  79. package/template/skills/runtime-health/scripts/doctor.py +278 -41
  80. package/template/skills/task-planning/SKILL.md +105 -61
  81. package/template/skills/task-review/SKILL.md +4 -4
  82. package/template/skills/task-review/scripts/review_check.py +277 -20
  83. package/template/skills/test-first/SKILL.md +18 -3
  84. package/template/skills/test-first/manifest.json +8 -4
  85. package/template/.cowork-flow/changes/archive/.gitkeep +0 -1
  86. package/template/.cowork-flow/scripts/adapters/cli/add_session.py +0 -465
  87. package/template/.cowork-flow/scripts/adapters/cli/change.py +0 -412
  88. package/template/.cowork-flow/workspace/index.md +0 -102
  89. package/template/.zcode/scaffold/AGENTS.md +0 -145
  90. package/template/.zcode/scaffold/CLAUDE.md +0 -5
@@ -7,6 +7,7 @@
7
7
  "required": [
8
8
  "schemaVersion",
9
9
  "capabilityValues",
10
+ "capabilityMatrix",
10
11
  "platforms",
11
12
  "excludedPrefixes",
12
13
  "syncPolicy"
@@ -17,12 +18,33 @@
17
18
  },
18
19
  "capabilityValues": {
19
20
  "type": "array",
20
- "minItems": 1,
21
+ "minItems": 6,
22
+ "maxItems": 6,
21
23
  "uniqueItems": true,
22
- "items": {
23
- "type": "string",
24
- "minLength": 1
25
- }
24
+ "prefixItems": [
25
+ {
26
+ "const": "native"
27
+ },
28
+ {
29
+ "const": "shim"
30
+ },
31
+ {
32
+ "const": "plugin"
33
+ },
34
+ {
35
+ "const": "external"
36
+ },
37
+ {
38
+ "const": "experimental"
39
+ },
40
+ {
41
+ "const": "unsupported"
42
+ }
43
+ ],
44
+ "items": false
45
+ },
46
+ "capabilityMatrix": {
47
+ "$ref": "#/$defs/capabilityMatrix"
26
48
  },
27
49
  "platforms": {
28
50
  "type": "array",
@@ -41,7 +63,6 @@
41
63
  "$defs": {
42
64
  "stringList": {
43
65
  "type": "array",
44
- "uniqueItems": true,
45
66
  "items": {
46
67
  "type": "string",
47
68
  "minLength": 1
@@ -51,7 +72,120 @@
51
72
  "type": "object",
52
73
  "minProperties": 1,
53
74
  "additionalProperties": {
54
- "type": "string"
75
+ "$ref": "#/$defs/capabilityStatus"
76
+ }
77
+ },
78
+ "capabilityStatus": {
79
+ "type": "string",
80
+ "enum": [
81
+ "native",
82
+ "shim",
83
+ "plugin",
84
+ "external",
85
+ "experimental",
86
+ "unsupported"
87
+ ]
88
+ },
89
+ "hostNeutralCapabilityDeclaration": {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "required": [
93
+ "status"
94
+ ],
95
+ "properties": {
96
+ "status": {
97
+ "$ref": "#/$defs/capabilityStatus"
98
+ },
99
+ "fallback": {
100
+ "type": "string",
101
+ "minLength": 1
102
+ }
103
+ },
104
+ "allOf": [
105
+ {
106
+ "if": {
107
+ "properties": {
108
+ "status": {
109
+ "const": "unsupported"
110
+ }
111
+ },
112
+ "required": [
113
+ "status"
114
+ ]
115
+ },
116
+ "then": {
117
+ "required": [
118
+ "fallback"
119
+ ]
120
+ }
121
+ }
122
+ ]
123
+ },
124
+ "hostNeutralCapabilitySet": {
125
+ "type": "object",
126
+ "additionalProperties": false,
127
+ "required": [
128
+ "task_action",
129
+ "subagent_dispatch",
130
+ "file_write",
131
+ "party_board_action"
132
+ ],
133
+ "properties": {
134
+ "task_action": {
135
+ "$ref": "#/$defs/hostNeutralCapabilityDeclaration"
136
+ },
137
+ "subagent_dispatch": {
138
+ "$ref": "#/$defs/hostNeutralCapabilityDeclaration"
139
+ },
140
+ "file_write": {
141
+ "$ref": "#/$defs/hostNeutralCapabilityDeclaration"
142
+ },
143
+ "party_board_action": {
144
+ "$ref": "#/$defs/hostNeutralCapabilityDeclaration"
145
+ }
146
+ }
147
+ },
148
+ "capabilityMatrix": {
149
+ "type": "object",
150
+ "additionalProperties": false,
151
+ "required": [
152
+ "required",
153
+ "hosts"
154
+ ],
155
+ "properties": {
156
+ "required": {
157
+ "type": "array",
158
+ "minItems": 4,
159
+ "maxItems": 4,
160
+ "uniqueItems": true,
161
+ "prefixItems": [
162
+ {
163
+ "const": "task_action"
164
+ },
165
+ {
166
+ "const": "subagent_dispatch"
167
+ },
168
+ {
169
+ "const": "file_write"
170
+ },
171
+ {
172
+ "const": "party_board_action"
173
+ }
174
+ ],
175
+ "items": false
176
+ },
177
+ "hosts": {
178
+ "type": "object",
179
+ "additionalProperties": {
180
+ "$ref": "#/$defs/hostNeutralCapabilitySet"
181
+ },
182
+ "required": [
183
+ "codex",
184
+ "claude-code",
185
+ "opencode",
186
+ "zcode"
187
+ ]
188
+ }
55
189
  }
56
190
  },
57
191
  "commandTarget": {
@@ -105,7 +239,7 @@
105
239
  "minLength": 1
106
240
  },
107
241
  "aliases": {
108
- "$ref": "#/$defs/stringList"
242
+ "$ref": "#/$defs/aliasList"
109
243
  },
110
244
  "detectAny": {
111
245
  "$ref": "#/$defs/stringList"
@@ -168,6 +302,14 @@
168
302
  "$ref": "#/$defs/stringList"
169
303
  }
170
304
  }
305
+ },
306
+ "aliasList": {
307
+ "type": "array",
308
+ "uniqueItems": true,
309
+ "items": {
310
+ "type": "string",
311
+ "minLength": 1
312
+ }
171
313
  }
172
314
  }
173
315
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-flow",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "description": "AI 协作工作流引擎:任务生命周期、子代理调度、门禁与状态注入。将 cowork-flow 的完整工作流带入 ZCode。",
5
5
  "author": {
6
6
  "name": "fisklikewater"
@@ -9,7 +9,9 @@ description: Use when the user approves a full plan and asks for continuous exec
9
9
 
10
10
  Batch Scheduler is a persistent state machine. Do **not** simulate or check completion inside the CLI.
11
11
 
12
- - Task ordering comes **only** from the topological order of leaf tasks in the change/task graph.
12
+ - Batch is not the default path for ordinary task work.
13
+ - Use normal step-by-task progression unless the user explicitly approves automatic continuous execution.
14
+ - Task ordering comes **only** from the topological order of leaf tasks in the task tree.
13
15
  - `implement.jsonl` and `check.jsonl` serve **only** as current-task context and review evidence; they must **not** be used as the Batch task list.
14
16
  - Only one host-neutral `next_action` is published at a time.
15
17
  - After the host executes a real action, results must be written back; the state machine validates repository state before advancing.
@@ -33,6 +35,21 @@ Startup command:
33
35
 
34
36
  The command routes through `task next`, runs the runtime-gated Batch action, and returns the full Batch state, where `next_action` is the **only** allowed next step.
35
37
 
38
+ ## Read-Only Inspection
39
+
40
+ Hosts may inspect an existing Batch operation without advancing, resuming, or
41
+ saving the state:
42
+
43
+ ```bash
44
+ batch-action inspect <operation_id>
45
+ ```
46
+
47
+ The inspect report is derived from the persisted Batch state and includes
48
+ `operationId`, `state`, `rootTask`, `currentPhase`, `currentTask`,
49
+ `completedTasks`, `pausedReason`, `failedAction`, `nextAction`, and `recovery`.
50
+ Use it for monitoring, recovery UI, or handoff facts. It must not replace
51
+ `record-result` after a host action. Do not use inspect as completion evidence.
52
+
36
53
  ## Host Action Loop
37
54
 
38
55
  Each cycle processes in this order:
@@ -139,7 +156,7 @@ The host must verify the task directory has been moved to the archive location.
139
156
  }
140
157
  ```
141
158
 
142
- The state machine verifies the destination directory exists on disk. If the archive fails (task directory not found, move conflict, or linked-change validation failure), write back a failure result and the batch pauses. On resume, only `archive_task` is retried — `complete_task` is not re-executed.
159
+ The state machine verifies the destination directory exists on disk. If the archive fails (task directory not found or move conflict), write back a failure result and the batch pauses. On resume, only `archive_task` is retried — `complete_task` is not re-executed.
143
160
 
144
161
  ### `commit_task`
145
162
 
@@ -171,7 +188,24 @@ When the host is unavailable or any action fails, write back a non-success resul
171
188
 
172
189
  The state becomes `paused`. The failed task and all subsequent tasks are **not** marked completed.
173
190
 
174
- After fixing the cause, rerun the Batch action through `task next` for the parent task:
191
+ Inspect the paused operation first:
192
+
193
+ ```bash
194
+ batch-action inspect <operation_id>
195
+ ```
196
+
197
+ Use the report's `failedAction`, `pausedReason`, and `recovery` facts to decide
198
+ what the host must repair. Repair or rerun the failed Host action outside the Batch state file.
199
+ Do **not** manually edit the Batch state file.
200
+
201
+ Resume only after the failed action can succeed:
202
+
203
+ ```bash
204
+ batch-action resume <operation_id>
205
+ ```
206
+
207
+ Alternatively, rerun the approved Batch action through `task next` for the
208
+ parent task:
175
209
 
176
210
  ```bash
177
211
  ./.cowork-flow/run task next <parent-task> --run --intent batch --auto --approved
@@ -18,6 +18,8 @@ def _parser() -> argparse.ArgumentParser:
18
18
  start.add_argument("root_task")
19
19
  resume = subparsers.add_parser("resume")
20
20
  resume.add_argument("operation_id")
21
+ inspect = subparsers.add_parser("inspect")
22
+ inspect.add_argument("operation_id")
21
23
  record = subparsers.add_parser("record-result")
22
24
  record.add_argument("operation_id")
23
25
  record.add_argument("file", type=Path)
@@ -32,6 +34,8 @@ def main(argv: list[str] | None = None) -> int:
32
34
  state = service.start(args.root_task)
33
35
  elif args.action == "resume":
34
36
  state = service.resume(args.operation_id)
37
+ elif args.action == "inspect":
38
+ state = service.inspect(args.operation_id)
35
39
  else:
36
40
  payload = json.loads(args.file.read_text(encoding="utf-8"))
37
41
  if not isinstance(payload, dict):