@brawnen/agent-harness-protocol 0.1.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,245 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://harness.local/schemas/report.schema.json",
4
+ "title": "Harness Task Report",
5
+ "description": "任务完成后的结构化报告对象。",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "task_id",
11
+ "intent",
12
+ "conclusion",
13
+ "actual_scope",
14
+ "evidence_summary",
15
+ "remaining_risks",
16
+ "next_steps",
17
+ "completed_at"
18
+ ],
19
+ "properties": {
20
+ "schema_version": {
21
+ "type": "string",
22
+ "const": "0.3"
23
+ },
24
+ "task_id": {
25
+ "type": "string"
26
+ },
27
+ "intent": {
28
+ "type": "string"
29
+ },
30
+ "conclusion": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "description": "任务结论:根因判断(bug)、交付内容(feature)、调研结论(explore)"
34
+ },
35
+ "actual_scope": {
36
+ "type": "array",
37
+ "items": {
38
+ "type": "string"
39
+ },
40
+ "description": "实际改动或分析范围,与合同 scope 对比"
41
+ },
42
+ "scope_deviation": {
43
+ "type": ["string", "null"],
44
+ "description": "与原始 scope 的偏差说明,无偏差时为 null"
45
+ },
46
+ "evidence_summary": {
47
+ "type": "array",
48
+ "items": {
49
+ "type": "object",
50
+ "additionalProperties": false,
51
+ "required": [
52
+ "type",
53
+ "result"
54
+ ],
55
+ "properties": {
56
+ "type": {
57
+ "type": "string",
58
+ "enum": [
59
+ "command_result",
60
+ "test_result",
61
+ "diff_summary",
62
+ "artifact",
63
+ "reasoning_note",
64
+ "manual_confirmation"
65
+ ]
66
+ },
67
+ "result": {
68
+ "type": "string"
69
+ },
70
+ "passed": {
71
+ "type": "boolean"
72
+ }
73
+ }
74
+ }
75
+ },
76
+ "remaining_risks": {
77
+ "type": "array",
78
+ "items": {
79
+ "type": "string"
80
+ },
81
+ "description": "剩余风险,无则为空数组"
82
+ },
83
+ "overrides_used": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ },
88
+ "description": "本次任务中使用的 force_override 摘要"
89
+ },
90
+ "output_artifacts": {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "properties": {
94
+ "changelog": {
95
+ "$ref": "#/$defs/output_artifact"
96
+ },
97
+ "design_note": {
98
+ "$ref": "#/$defs/output_artifact"
99
+ },
100
+ "adr": {
101
+ "$ref": "#/$defs/output_artifact"
102
+ }
103
+ }
104
+ },
105
+ "delivery_readiness": {
106
+ "type": "object",
107
+ "additionalProperties": false,
108
+ "properties": {
109
+ "signals": {
110
+ "type": "object",
111
+ "additionalProperties": {
112
+ "$ref": "#/$defs/delivery_signal"
113
+ }
114
+ },
115
+ "commit": {
116
+ "$ref": "#/$defs/delivery_readiness"
117
+ },
118
+ "push": {
119
+ "$ref": "#/$defs/delivery_readiness"
120
+ }
121
+ }
122
+ },
123
+ "next_steps": {
124
+ "type": "array",
125
+ "items": {
126
+ "type": "string"
127
+ },
128
+ "description": "下一步建议"
129
+ },
130
+ "completed_at": {
131
+ "type": "string",
132
+ "format": "date-time"
133
+ }
134
+ },
135
+ "$defs": {
136
+ "output_artifact": {
137
+ "type": "object",
138
+ "additionalProperties": false,
139
+ "required": [
140
+ "name",
141
+ "required",
142
+ "satisfied",
143
+ "reason"
144
+ ],
145
+ "properties": {
146
+ "name": {
147
+ "type": "string"
148
+ },
149
+ "path": {
150
+ "type": [
151
+ "string",
152
+ "null"
153
+ ]
154
+ },
155
+ "required": {
156
+ "type": "boolean"
157
+ },
158
+ "satisfied": {
159
+ "type": "boolean"
160
+ },
161
+ "reason": {
162
+ "type": "string"
163
+ }
164
+ }
165
+ },
166
+ "delivery_readiness": {
167
+ "type": "object",
168
+ "additionalProperties": false,
169
+ "required": [
170
+ "configured",
171
+ "mode",
172
+ "via",
173
+ "ready",
174
+ "required_signals",
175
+ "satisfied_signals",
176
+ "missing_signals",
177
+ "reason"
178
+ ],
179
+ "properties": {
180
+ "configured": {
181
+ "type": "boolean"
182
+ },
183
+ "mode": {
184
+ "type": [
185
+ "string",
186
+ "null"
187
+ ]
188
+ },
189
+ "via": {
190
+ "type": [
191
+ "string",
192
+ "null"
193
+ ]
194
+ },
195
+ "ready": {
196
+ "type": [
197
+ "boolean",
198
+ "null"
199
+ ]
200
+ },
201
+ "required_signals": {
202
+ "type": "array",
203
+ "items": {
204
+ "type": "string"
205
+ }
206
+ },
207
+ "satisfied_signals": {
208
+ "type": "array",
209
+ "items": {
210
+ "type": "string"
211
+ }
212
+ },
213
+ "missing_signals": {
214
+ "type": "array",
215
+ "items": {
216
+ "type": "string"
217
+ }
218
+ },
219
+ "reason": {
220
+ "type": "string"
221
+ }
222
+ }
223
+ },
224
+ "delivery_signal": {
225
+ "type": "object",
226
+ "additionalProperties": false,
227
+ "required": [
228
+ "name",
229
+ "satisfied",
230
+ "reason"
231
+ ],
232
+ "properties": {
233
+ "name": {
234
+ "type": "string"
235
+ },
236
+ "satisfied": {
237
+ "type": "boolean"
238
+ },
239
+ "reason": {
240
+ "type": "string"
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://harness.local/schemas/state-index.schema.json",
4
+ "title": "Harness State Index",
5
+ "description": "harness/state/index.json 的结构定义,记录当前活跃和挂起的任务索引。",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "active_task_id",
11
+ "tasks"
12
+ ],
13
+ "properties": {
14
+ "schema_version": {
15
+ "type": "string",
16
+ "const": "0.3"
17
+ },
18
+ "active_task_id": {
19
+ "type": ["string", "null"],
20
+ "description": "当前活跃任务 ID,无活跃任务时为 null"
21
+ },
22
+ "tasks": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": [
28
+ "task_id",
29
+ "intent",
30
+ "goal_summary",
31
+ "current_state",
32
+ "updated_at"
33
+ ],
34
+ "properties": {
35
+ "task_id": {
36
+ "type": "string"
37
+ },
38
+ "intent": {
39
+ "type": "string"
40
+ },
41
+ "goal_summary": {
42
+ "type": "string",
43
+ "description": "任务目标的简短摘要,用于快速识别"
44
+ },
45
+ "current_state": {
46
+ "type": "string",
47
+ "enum": [
48
+ "draft",
49
+ "needs_clarification",
50
+ "planned",
51
+ "in_progress",
52
+ "blocked",
53
+ "verifying",
54
+ "done",
55
+ "failed",
56
+ "suspended"
57
+ ]
58
+ },
59
+ "updated_at": {
60
+ "type": "string",
61
+ "format": "date-time"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,141 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://harness.local/schemas/task-draft.schema.json",
4
+ "title": "Harness Task Draft",
5
+ "description": "Intake 阶段内部使用的任务草稿对象。",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "source_input",
11
+ "intent",
12
+ "goal",
13
+ "scope",
14
+ "acceptance",
15
+ "constraints",
16
+ "mode",
17
+ "assumptions",
18
+ "open_questions",
19
+ "risk_signals",
20
+ "context_refs",
21
+ "next_action"
22
+ ],
23
+ "properties": {
24
+ "schema_version": {
25
+ "type": "string",
26
+ "const": "0.3"
27
+ },
28
+ "source_input": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "intent": {
33
+ "type": "string",
34
+ "enum": [
35
+ "bug",
36
+ "feature",
37
+ "explore",
38
+ "refactor",
39
+ "prototype",
40
+ "unknown"
41
+ ]
42
+ },
43
+ "goal": {
44
+ "type": "string",
45
+ "minLength": 1
46
+ },
47
+ "scope": {
48
+ "type": "array",
49
+ "items": {
50
+ "type": "string",
51
+ "minLength": 1
52
+ },
53
+ "minItems": 1
54
+ },
55
+ "acceptance": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string",
59
+ "minLength": 1
60
+ },
61
+ "minItems": 1
62
+ },
63
+ "constraints": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "string",
67
+ "minLength": 1
68
+ }
69
+ },
70
+ "mode": {
71
+ "type": "string",
72
+ "enum": [
73
+ "delivery",
74
+ "explore",
75
+ "poc",
76
+ "unknown"
77
+ ]
78
+ },
79
+ "assumptions": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "string",
83
+ "minLength": 1
84
+ }
85
+ },
86
+ "open_questions": {
87
+ "type": "array",
88
+ "items": {
89
+ "type": "string",
90
+ "minLength": 1
91
+ }
92
+ },
93
+ "risk_signals": {
94
+ "type": "array",
95
+ "items": {
96
+ "type": "string",
97
+ "minLength": 1
98
+ }
99
+ },
100
+ "context_refs": {
101
+ "type": "array",
102
+ "items": {
103
+ "type": "string",
104
+ "minLength": 1
105
+ }
106
+ },
107
+ "next_action": {
108
+ "type": "string",
109
+ "enum": [
110
+ "clarify",
111
+ "plan",
112
+ "observe",
113
+ "fail"
114
+ ]
115
+ },
116
+ "derived": {
117
+ "type": "object",
118
+ "additionalProperties": false,
119
+ "properties": {
120
+ "risk_level": {
121
+ "type": "string",
122
+ "enum": [
123
+ "low",
124
+ "medium",
125
+ "high",
126
+ "unknown"
127
+ ]
128
+ },
129
+ "state": {
130
+ "type": "string",
131
+ "enum": [
132
+ "draft",
133
+ "needs_clarification",
134
+ "planned",
135
+ "failed"
136
+ ]
137
+ }
138
+ }
139
+ }
140
+ }
141
+ }
@@ -0,0 +1,200 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://harness.local/schemas/task-state.schema.json",
4
+ "title": "Harness Task State",
5
+ "description": "持久化到 harness/state/tasks/<task_id>.json 的任务状态对象。",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "task_id",
11
+ "current_phase",
12
+ "current_state",
13
+ "task_draft",
14
+ "evidence",
15
+ "open_questions",
16
+ "override_history",
17
+ "created_at",
18
+ "updated_at"
19
+ ],
20
+ "properties": {
21
+ "schema_version": {
22
+ "type": "string",
23
+ "const": "0.3"
24
+ },
25
+ "task_id": {
26
+ "type": "string",
27
+ "pattern": "^[a-z0-9\\-]+$",
28
+ "minLength": 1
29
+ },
30
+ "current_phase": {
31
+ "type": "string",
32
+ "enum": [
33
+ "intake",
34
+ "clarify",
35
+ "plan",
36
+ "execute",
37
+ "verify",
38
+ "report",
39
+ "close"
40
+ ]
41
+ },
42
+ "current_state": {
43
+ "type": "string",
44
+ "enum": [
45
+ "draft",
46
+ "needs_clarification",
47
+ "planned",
48
+ "in_progress",
49
+ "blocked",
50
+ "verifying",
51
+ "done",
52
+ "failed",
53
+ "suspended"
54
+ ]
55
+ },
56
+ "task_draft": {
57
+ "$ref": "./task-draft.schema.json"
58
+ },
59
+ "confirmed_contract": {
60
+ "description": "当合同闭合后填入,未闭合时为 null。",
61
+ "oneOf": [
62
+ {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "intent",
67
+ "goal",
68
+ "scope",
69
+ "acceptance"
70
+ ],
71
+ "properties": {
72
+ "intent": {
73
+ "type": "string"
74
+ },
75
+ "goal": {
76
+ "type": "string"
77
+ },
78
+ "scope": {
79
+ "type": "array",
80
+ "items": {
81
+ "type": "string"
82
+ }
83
+ },
84
+ "acceptance": {
85
+ "type": "array",
86
+ "items": {
87
+ "type": "string"
88
+ }
89
+ },
90
+ "title": {
91
+ "type": "string"
92
+ },
93
+ "constraints": {
94
+ "type": "array",
95
+ "items": {
96
+ "type": "string"
97
+ }
98
+ },
99
+ "verification": {
100
+ "type": "array",
101
+ "items": {
102
+ "type": "string"
103
+ }
104
+ },
105
+ "context_refs": {
106
+ "type": "array",
107
+ "items": {
108
+ "type": "string"
109
+ }
110
+ },
111
+ "id": {
112
+ "type": "string"
113
+ },
114
+ "mode": {
115
+ "type": "string"
116
+ },
117
+ "risk_level": {
118
+ "type": "string",
119
+ "enum": [
120
+ "low",
121
+ "medium",
122
+ "high"
123
+ ]
124
+ },
125
+ "evidence_required": {
126
+ "type": "array",
127
+ "items": {
128
+ "type": "string"
129
+ }
130
+ }
131
+ }
132
+ },
133
+ {
134
+ "type": "null"
135
+ }
136
+ ]
137
+ },
138
+ "evidence": {
139
+ "type": "array",
140
+ "items": {
141
+ "type": "object",
142
+ "additionalProperties": false,
143
+ "required": [
144
+ "type",
145
+ "content",
146
+ "timestamp"
147
+ ],
148
+ "properties": {
149
+ "type": {
150
+ "type": "string",
151
+ "enum": [
152
+ "command_result",
153
+ "test_result",
154
+ "diff_summary",
155
+ "artifact",
156
+ "reasoning_note",
157
+ "manual_confirmation",
158
+ "audit_log"
159
+ ]
160
+ },
161
+ "content": {
162
+ "type": "string"
163
+ },
164
+ "exit_code": {
165
+ "type": "integer",
166
+ "description": "仅 command_result / test_result 时使用"
167
+ },
168
+ "passed": {
169
+ "type": "boolean",
170
+ "description": "仅 test_result 时使用"
171
+ },
172
+ "timestamp": {
173
+ "type": "string",
174
+ "format": "date-time"
175
+ }
176
+ }
177
+ }
178
+ },
179
+ "open_questions": {
180
+ "type": "array",
181
+ "items": {
182
+ "type": "string"
183
+ }
184
+ },
185
+ "override_history": {
186
+ "type": "array",
187
+ "items": {
188
+ "$ref": "./audit-log.schema.json#/$defs/audit_entry"
189
+ }
190
+ },
191
+ "created_at": {
192
+ "type": "string",
193
+ "format": "date-time"
194
+ },
195
+ "updated_at": {
196
+ "type": "string",
197
+ "format": "date-time"
198
+ }
199
+ }
200
+ }
@@ -0,0 +1,58 @@
1
+ ---
2
+ template_id: bug
3
+ intent: bug
4
+ goal: "<必填:一句话描述要修复的问题>"
5
+ scope:
6
+ - "<必填:允许修改的模块、目录或文件>"
7
+ acceptance:
8
+ - "<必填:什么算修复完成>"
9
+ title: "<可选:任务标题>"
10
+ constraints:
11
+ - "<可选:不能做什么>"
12
+ verification:
13
+ - "<可选:验证命令或人工验证步骤>"
14
+ context_refs:
15
+ - "<可选:日志、报错、相关设计文档>"
16
+ mode: delivery
17
+ risk_level: "<派生:由 harness 和 project config 推导>"
18
+ evidence_required: []
19
+ ---
20
+
21
+ # Bug 任务模板
22
+
23
+ ## 现象
24
+
25
+ - 用户可见问题:
26
+ - 触发条件:
27
+ - 预期行为:
28
+
29
+ ## 已知事实
30
+
31
+ - 已确认边界:
32
+ - 已知不允许修改的部分:
33
+ - 相关上下文:
34
+
35
+ ## 根因假设
36
+
37
+ - 假设 1:
38
+ - 假设 2:
39
+ - 仍待确认的问题:
40
+
41
+ ## 执行计划
42
+
43
+ - 最小修复路径:
44
+ - 不做的改动:
45
+ - 回滚方式:
46
+
47
+ ## 验证记录
48
+
49
+ - 执行命令:
50
+ - 结果摘要:
51
+ - 缺失证据:
52
+
53
+ ## 输出结论
54
+
55
+ - 根因判断:
56
+ - 实际改动范围:
57
+ - 剩余风险:
58
+ - 下一步建议: