scene-capability-engine 3.6.9 → 3.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/bin/scene-capability-engine.js +2 -0
- package/docs/agent-runtime/capability-iteration-ui.schema.json +226 -0
- package/docs/command-reference.md +41 -0
- package/docs/magicball-capability-iteration-api.md +154 -0
- package/docs/magicball-capability-iteration-ui.md +172 -0
- package/docs/ontology/capability-mapping.schema.json +54 -0
- package/lib/commands/capability.js +634 -0
- package/lib/commands/task.js +271 -0
- package/lib/task/task-quality-policy.js +109 -0
- package/lib/task/task-quality.js +378 -0
- package/package.json +1 -1
- package/template/.sce/config/task-quality-policy.json +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.6.11] - 2026-03-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Task quality governance commands:
|
|
14
|
+
- `sce task draft`
|
|
15
|
+
- `sce task consolidate`
|
|
16
|
+
- `sce task score`
|
|
17
|
+
- `sce task promote`
|
|
18
|
+
- Task quality policy support:
|
|
19
|
+
- `.sce/config/task-quality-policy.json`
|
|
20
|
+
- policy overrides via `--policy <path>`
|
|
21
|
+
- Task promotion now emits acceptance suggestions when acceptance criteria are missing.
|
|
22
|
+
|
|
23
|
+
## [3.6.10] - 2026-03-05
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- Capability iteration CLI for scene/spec/task history:
|
|
27
|
+
- `sce capability extract`
|
|
28
|
+
- `sce capability score`
|
|
29
|
+
- `sce capability map`
|
|
30
|
+
- `sce capability register`
|
|
31
|
+
- Extracted capability candidates now include task summaries and scene/spec provenance for UI governance workflows.
|
|
32
|
+
- Added schema references for capability iteration UI contract and ontology mapping.
|
|
33
|
+
- Magicball capability iteration docs:
|
|
34
|
+
- `docs/magicball-capability-iteration-ui.md`
|
|
35
|
+
- `docs/magicball-capability-iteration-api.md`
|
|
36
|
+
|
|
10
37
|
## [3.6.9] - 2026-03-05
|
|
11
38
|
|
|
12
39
|
### Added
|
package/README.md
CHANGED
package/README.zh.md
CHANGED
|
@@ -26,6 +26,7 @@ const { registerValueCommands } = require('../lib/commands/value');
|
|
|
26
26
|
const { registerTaskCommands } = require('../lib/commands/task');
|
|
27
27
|
const { registerAuthCommands } = require('../lib/commands/auth');
|
|
28
28
|
const { registerStateCommands } = require('../lib/commands/state');
|
|
29
|
+
const { registerCapabilityCommands } = require('../lib/commands/capability');
|
|
29
30
|
const VersionChecker = require('../lib/version/version-checker');
|
|
30
31
|
const {
|
|
31
32
|
findLegacyKiroDirectories,
|
|
@@ -976,6 +977,7 @@ registerValueCommands(program);
|
|
|
976
977
|
registerTaskCommands(program);
|
|
977
978
|
registerAuthCommands(program);
|
|
978
979
|
registerStateCommands(program);
|
|
980
|
+
registerCapabilityCommands(program);
|
|
979
981
|
|
|
980
982
|
// Template management commands
|
|
981
983
|
const templatesCommand = require('../lib/commands/templates');
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://scene-capability-engine.dev/contracts/capability-iteration-ui.schema.json",
|
|
4
|
+
"title": "Capability Iteration UI Contract",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"candidate",
|
|
8
|
+
"score",
|
|
9
|
+
"mapping",
|
|
10
|
+
"registry"
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"candidate": {
|
|
14
|
+
"$ref": "#/definitions/candidate"
|
|
15
|
+
},
|
|
16
|
+
"score": {
|
|
17
|
+
"$ref": "#/definitions/score"
|
|
18
|
+
},
|
|
19
|
+
"mapping": {
|
|
20
|
+
"$ref": "#/definitions/mapping"
|
|
21
|
+
},
|
|
22
|
+
"registry": {
|
|
23
|
+
"$ref": "#/definitions/registry"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"definitions": {
|
|
27
|
+
"candidate": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": [
|
|
30
|
+
"mode",
|
|
31
|
+
"scene_id",
|
|
32
|
+
"generated_at",
|
|
33
|
+
"source",
|
|
34
|
+
"specs",
|
|
35
|
+
"summary"
|
|
36
|
+
],
|
|
37
|
+
"properties": {
|
|
38
|
+
"mode": {
|
|
39
|
+
"const": "capability-extract"
|
|
40
|
+
},
|
|
41
|
+
"scene_id": { "type": "string" },
|
|
42
|
+
"generated_at": { "type": "string" },
|
|
43
|
+
"output_file": { "type": "string" },
|
|
44
|
+
"source": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"required": ["scene_index_source", "spec_count"],
|
|
47
|
+
"properties": {
|
|
48
|
+
"scene_index_source": { "type": "string" },
|
|
49
|
+
"spec_count": { "type": "integer", "minimum": 0 }
|
|
50
|
+
},
|
|
51
|
+
"additionalProperties": false
|
|
52
|
+
},
|
|
53
|
+
"specs": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"required": ["spec_id", "tasks_path", "task_summary"],
|
|
58
|
+
"properties": {
|
|
59
|
+
"spec_id": { "type": "string" },
|
|
60
|
+
"tasks_path": { "type": "string" },
|
|
61
|
+
"task_error": { "type": "string" },
|
|
62
|
+
"task_summary": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"required": [
|
|
65
|
+
"total",
|
|
66
|
+
"completed",
|
|
67
|
+
"in_progress",
|
|
68
|
+
"queued",
|
|
69
|
+
"not_started",
|
|
70
|
+
"unknown"
|
|
71
|
+
],
|
|
72
|
+
"properties": {
|
|
73
|
+
"total": { "type": "integer", "minimum": 0 },
|
|
74
|
+
"completed": { "type": "integer", "minimum": 0 },
|
|
75
|
+
"in_progress": { "type": "integer", "minimum": 0 },
|
|
76
|
+
"queued": { "type": "integer", "minimum": 0 },
|
|
77
|
+
"not_started": { "type": "integer", "minimum": 0 },
|
|
78
|
+
"unknown": { "type": "integer", "minimum": 0 }
|
|
79
|
+
},
|
|
80
|
+
"additionalProperties": false
|
|
81
|
+
},
|
|
82
|
+
"task_sample": {
|
|
83
|
+
"type": "array",
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"required": ["id", "title", "status"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"id": { "type": "string" },
|
|
89
|
+
"title": { "type": "string" },
|
|
90
|
+
"status": { "type": "string" }
|
|
91
|
+
},
|
|
92
|
+
"additionalProperties": false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"additionalProperties": false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"summary": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"required": ["spec_count", "task_total", "task_completed", "task_pending"],
|
|
102
|
+
"properties": {
|
|
103
|
+
"spec_count": { "type": "integer", "minimum": 0 },
|
|
104
|
+
"task_total": { "type": "integer", "minimum": 0 },
|
|
105
|
+
"task_completed": { "type": "integer", "minimum": 0 },
|
|
106
|
+
"task_pending": { "type": "integer", "minimum": 0 }
|
|
107
|
+
},
|
|
108
|
+
"additionalProperties": false
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"additionalProperties": false
|
|
112
|
+
},
|
|
113
|
+
"score": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"required": [
|
|
116
|
+
"mode",
|
|
117
|
+
"scene_id",
|
|
118
|
+
"generated_at",
|
|
119
|
+
"input",
|
|
120
|
+
"scores"
|
|
121
|
+
],
|
|
122
|
+
"properties": {
|
|
123
|
+
"mode": { "const": "capability-score" },
|
|
124
|
+
"scene_id": { "type": "string" },
|
|
125
|
+
"generated_at": { "type": "string" },
|
|
126
|
+
"input": { "type": "string" },
|
|
127
|
+
"output_file": { "type": "string" },
|
|
128
|
+
"scores": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"required": [
|
|
131
|
+
"completion_rate",
|
|
132
|
+
"reuse_score",
|
|
133
|
+
"stability_score",
|
|
134
|
+
"risk_score",
|
|
135
|
+
"value_score"
|
|
136
|
+
],
|
|
137
|
+
"properties": {
|
|
138
|
+
"completion_rate": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
139
|
+
"reuse_score": { "type": "integer", "minimum": 0, "maximum": 100 },
|
|
140
|
+
"stability_score": { "type": "integer", "minimum": 0, "maximum": 100 },
|
|
141
|
+
"risk_score": { "type": "integer", "minimum": 0, "maximum": 100 },
|
|
142
|
+
"value_score": { "type": "integer", "minimum": 0, "maximum": 100 }
|
|
143
|
+
},
|
|
144
|
+
"additionalProperties": false
|
|
145
|
+
},
|
|
146
|
+
"summary": { "type": ["object", "null"] }
|
|
147
|
+
},
|
|
148
|
+
"additionalProperties": false
|
|
149
|
+
},
|
|
150
|
+
"mapping": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"required": [
|
|
153
|
+
"mode",
|
|
154
|
+
"scene_id",
|
|
155
|
+
"generated_at",
|
|
156
|
+
"input",
|
|
157
|
+
"template"
|
|
158
|
+
],
|
|
159
|
+
"properties": {
|
|
160
|
+
"mode": { "const": "capability-map" },
|
|
161
|
+
"scene_id": { "type": "string" },
|
|
162
|
+
"generated_at": { "type": "string" },
|
|
163
|
+
"input": { "type": "string" },
|
|
164
|
+
"mapping": { "type": ["string", "null"] },
|
|
165
|
+
"output_file": { "type": "string" },
|
|
166
|
+
"template": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"required": [
|
|
169
|
+
"mode",
|
|
170
|
+
"template_id",
|
|
171
|
+
"name",
|
|
172
|
+
"description",
|
|
173
|
+
"category",
|
|
174
|
+
"template_type",
|
|
175
|
+
"scene_id",
|
|
176
|
+
"ontology_scope",
|
|
177
|
+
"created_at"
|
|
178
|
+
],
|
|
179
|
+
"properties": {
|
|
180
|
+
"mode": { "const": "capability-template" },
|
|
181
|
+
"template_id": { "type": "string" },
|
|
182
|
+
"name": { "type": "string" },
|
|
183
|
+
"description": { "type": "string" },
|
|
184
|
+
"category": { "type": "string" },
|
|
185
|
+
"template_type": { "const": "capability-template" },
|
|
186
|
+
"scene_id": { "type": "string" },
|
|
187
|
+
"tags": { "type": "array", "items": { "type": "string" } },
|
|
188
|
+
"ontology_scope": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"required": ["domains", "entities", "relations", "business_rules", "decisions"],
|
|
191
|
+
"properties": {
|
|
192
|
+
"domains": { "type": "array", "items": { "type": "string" } },
|
|
193
|
+
"entities": { "type": "array", "items": { "type": "string" } },
|
|
194
|
+
"relations": { "type": "array", "items": { "type": "string" } },
|
|
195
|
+
"business_rules": { "type": "array", "items": { "type": "string" } },
|
|
196
|
+
"decisions": { "type": "array", "items": { "type": "string" } }
|
|
197
|
+
},
|
|
198
|
+
"additionalProperties": false
|
|
199
|
+
},
|
|
200
|
+
"created_at": { "type": "string" },
|
|
201
|
+
"source_candidate": { "type": ["object", "null"] }
|
|
202
|
+
},
|
|
203
|
+
"additionalProperties": false
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"additionalProperties": false
|
|
207
|
+
},
|
|
208
|
+
"registry": {
|
|
209
|
+
"type": "object",
|
|
210
|
+
"required": [
|
|
211
|
+
"mode",
|
|
212
|
+
"template_id",
|
|
213
|
+
"output_dir",
|
|
214
|
+
"files"
|
|
215
|
+
],
|
|
216
|
+
"properties": {
|
|
217
|
+
"mode": { "const": "capability-register" },
|
|
218
|
+
"template_id": { "type": "string" },
|
|
219
|
+
"output_dir": { "type": "string" },
|
|
220
|
+
"files": { "type": "array", "items": { "type": "string" } }
|
|
221
|
+
},
|
|
222
|
+
"additionalProperties": false
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"additionalProperties": false
|
|
226
|
+
}
|
|
@@ -201,6 +201,26 @@ Task references and studio runtime events are persisted in SQLite state store:
|
|
|
201
201
|
- In-memory fallback is restricted to `NODE_ENV=test` or `SCE_STATE_ALLOW_MEMORY_FALLBACK=1`.
|
|
202
202
|
- If SQLite runtime support is unavailable outside fallback conditions, `task ref/show/rerun` and `studio events` persistence operations fail fast.
|
|
203
203
|
|
|
204
|
+
#### Task Quality Governance (draft -> score -> promote)
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Create draft from dialogue
|
|
208
|
+
sce task draft --scene scene.customer-order --input "Fix checkout timeout and add retry dashboard" --json
|
|
209
|
+
|
|
210
|
+
# Consolidate drafts for a scene
|
|
211
|
+
sce task consolidate --scene scene.customer-order --json
|
|
212
|
+
|
|
213
|
+
# Score draft quality
|
|
214
|
+
sce task score --draft <draft-id> --json
|
|
215
|
+
|
|
216
|
+
# Promote into tasks.md (quality gate enforced unless --force)
|
|
217
|
+
sce task promote --draft <draft-id> --spec 02-00-checkout-optimization --json
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Policy file:
|
|
221
|
+
- `.sce/config/task-quality-policy.json`
|
|
222
|
+
- Fields: `min_quality_score`, `require_acceptance_criteria`, `allow_needs_split`, `auto_suggest_acceptance`, `max_sub_goals`
|
|
223
|
+
|
|
204
224
|
### Context & Prompts
|
|
205
225
|
|
|
206
226
|
```bash
|
|
@@ -1847,6 +1867,27 @@ sce scene template-render --package <name> --values <json-or-path> --out <dir>
|
|
|
1847
1867
|
sce scene template-render --package scene-erp --values '{"entity_name":"Order"}' --out ./output --json
|
|
1848
1868
|
```
|
|
1849
1869
|
|
|
1870
|
+
### Capability Iteration (scene -> template -> ontology)
|
|
1871
|
+
|
|
1872
|
+
```bash
|
|
1873
|
+
# 1) Extract capability candidate from scene history
|
|
1874
|
+
sce capability extract --scene scene.customer-order --json
|
|
1875
|
+
|
|
1876
|
+
# 2) Score candidate value/reuse/risk
|
|
1877
|
+
sce capability score --input .sce/reports/capability-iteration/scene.customer-order.candidate.json --json
|
|
1878
|
+
|
|
1879
|
+
# 3) Attach ontology mapping
|
|
1880
|
+
sce capability map --input .sce/reports/capability-iteration/scene.customer-order.candidate.json \
|
|
1881
|
+
--mapping .sce/ontology/capability-mapping.json --json
|
|
1882
|
+
|
|
1883
|
+
# 4) Export registry-ready capability template package
|
|
1884
|
+
sce capability register --input .sce/reports/capability-iteration/scene.customer-order.template.json --json
|
|
1885
|
+
```
|
|
1886
|
+
|
|
1887
|
+
Schema references:
|
|
1888
|
+
- UI contract: `docs/agent-runtime/capability-iteration-ui.schema.json`
|
|
1889
|
+
- Ontology mapping: `docs/ontology/capability-mapping.schema.json`
|
|
1890
|
+
|
|
1850
1891
|
### Scene Package Batch Publish
|
|
1851
1892
|
|
|
1852
1893
|
```bash
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Magicball 能力迭代 API 封装建议(基于 SCE CLI)
|
|
2
|
+
|
|
3
|
+
> 目标:把 SCE CLI 统一封装成 Magicball 内部 API,方便前端用标准 JSON 调用。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. API 设计原则
|
|
8
|
+
|
|
9
|
+
- **一处封装**:统一执行 CLI,屏蔽差异
|
|
10
|
+
- **JSON 输出**:所有调用带 `--json`
|
|
11
|
+
- **可回放**:每一步的输出落盘并在 UI 可复用
|
|
12
|
+
- **错误可读**:将 stderr 错误结构化返回
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 2. 建议 API 列表
|
|
17
|
+
|
|
18
|
+
### 2.1 Extract
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
POST /api/capability/extract
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
请求:
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"scene_id": "scene.customer-order",
|
|
28
|
+
"specs": ["01-00-order", "01-01-inventory"],
|
|
29
|
+
"sample_limit": 5
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
执行 CLI:
|
|
34
|
+
```bash
|
|
35
|
+
sce capability extract --scene <scene_id> --specs <specs> --sample-limit <n> --json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
响应:
|
|
39
|
+
- 返回 `capability-extract` payload
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### 2.2 Score
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
POST /api/capability/score
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
请求:
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"candidate_file": ".sce/reports/capability-iteration/scene.customer-order.candidate.json"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
执行 CLI:
|
|
57
|
+
```bash
|
|
58
|
+
sce capability score --input <candidate_file> --json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
响应:
|
|
62
|
+
- 返回 `capability-score` payload
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### 2.3 Map
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
POST /api/capability/map
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
请求:
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"candidate_file": ".sce/reports/capability-iteration/scene.customer-order.candidate.json",
|
|
76
|
+
"ontology_file": ".sce/ontology/capability-mapping.json",
|
|
77
|
+
"template_id": "scene.customer-order",
|
|
78
|
+
"name": "Capability template: scene.customer-order",
|
|
79
|
+
"description": "Derived from scene.customer-order"
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
执行 CLI:
|
|
84
|
+
```bash
|
|
85
|
+
sce capability map --input <candidate_file> --mapping <ontology_file> \
|
|
86
|
+
--template-id <template_id> --name "<name>" --description "<desc>" --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
响应:
|
|
90
|
+
- 返回 `capability-map` payload
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 2.4 Register
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
POST /api/capability/register
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
请求:
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"template_file": ".sce/reports/capability-iteration/scene.customer-order.template.json",
|
|
104
|
+
"risk_level": "medium",
|
|
105
|
+
"difficulty": "intermediate"
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
执行 CLI:
|
|
110
|
+
```bash
|
|
111
|
+
sce capability register --input <template_file> --risk-level <level> --difficulty <level> --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
响应:
|
|
115
|
+
- 返回 `capability-register` payload
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 3. 通用返回结构(建议)
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"success": true,
|
|
124
|
+
"data": { ...sce_payload },
|
|
125
|
+
"stderr": null
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
失败:
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"success": false,
|
|
133
|
+
"data": null,
|
|
134
|
+
"stderr": "error message from sce"
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 4. 前端调用建议
|
|
141
|
+
|
|
142
|
+
- 每一步 UI 都展示对应 `data.output_file`(如有)
|
|
143
|
+
- 支持“重新执行”按钮(调用同一 API)
|
|
144
|
+
- 失败时提示 `stderr`,并保留上一步数据可继续
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 5. 推荐顺序
|
|
149
|
+
|
|
150
|
+
1. `/api/capability/extract`
|
|
151
|
+
2. `/api/capability/score`
|
|
152
|
+
3. `/api/capability/map`
|
|
153
|
+
4. `/api/capability/register`
|
|
154
|
+
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Magicball 能力迭代管理(SCE 对接说明)
|
|
2
|
+
|
|
3
|
+
> 适用于:Magicball AI 助手页面新增顶部图标入口,内部用页签切换。
|
|
4
|
+
> 目标:从历史 `scene/spec/task` 中提炼可复用能力模板,并完成本体映射,形成可发布的能力资产。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. 目标与范围
|
|
9
|
+
|
|
10
|
+
- 目标:从历史 `scene/spec/task` 中提炼能力模板,并完成 ontology 映射闭环。
|
|
11
|
+
- 范围:Magicball UI 新增「能力迭代」入口(顶部图标),内部用页签完成全流程。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 2. UI 草图(文字版)
|
|
16
|
+
|
|
17
|
+
### 2.1 能力迭代首页(Scene 盘点)
|
|
18
|
+
```
|
|
19
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
20
|
+
│ 能力迭代 │
|
|
21
|
+
│ [筛选:时间 | 完成率 | 风险] [搜索:scene id] │
|
|
22
|
+
├─────────────────────────────────────────────────────────────┤
|
|
23
|
+
│ Scene卡片:scene.customer-order │
|
|
24
|
+
│ - spec: 3 tasks: 42 completed: 36 pending: 6 │
|
|
25
|
+
│ - score: 未评估 │
|
|
26
|
+
│ [进入评估] │
|
|
27
|
+
├─────────────────────────────────────────────────────────────┤
|
|
28
|
+
│ Scene卡片:scene.inventory-reconcile │
|
|
29
|
+
│ - spec: 2 tasks: 18 completed: 18 pending: 0 │
|
|
30
|
+
│ [进入评估] │
|
|
31
|
+
└─────────────────────────────────────────────────────────────┘
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2.2 评估页(Spec/Task + 评分卡)
|
|
35
|
+
```
|
|
36
|
+
┌───────────────┬─────────────────────────────────────────────┐
|
|
37
|
+
│ Spec列表 │ 评分卡 │
|
|
38
|
+
│ - 01-00-demo │ value: 78 reuse: 66 stability: 85 risk: 20 │
|
|
39
|
+
│ - 01-01-check │ completion: 0.86 │
|
|
40
|
+
│ - 01-02-order │ │
|
|
41
|
+
├───────────────┼─────────────────────────────────────────────┤
|
|
42
|
+
│ Task摘要 │ [生成模板候选] │
|
|
43
|
+
│ total: 42 │ │
|
|
44
|
+
│ completed:36 │ │
|
|
45
|
+
│ pending: 6 │ │
|
|
46
|
+
└───────────────┴─────────────────────────────────────────────┘
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2.3 模板构建页(元信息 + 本体映射)
|
|
50
|
+
```
|
|
51
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
52
|
+
│ 模板信息 │
|
|
53
|
+
│ name: [Capability template: scene.customer-order] │
|
|
54
|
+
│ desc: [模板描述 ...] │
|
|
55
|
+
│ tags: [order, customer, inventory] │
|
|
56
|
+
├─────────────────────────────────────────────────────────────┤
|
|
57
|
+
│ 本体映射 │
|
|
58
|
+
│ domains: [commerce] │
|
|
59
|
+
│ entities: [Order, Customer] │
|
|
60
|
+
│ relations: [Order->Customer] │
|
|
61
|
+
│ business_rules: [OrderApproval] │
|
|
62
|
+
│ decisions: [RiskPolicy] │
|
|
63
|
+
├─────────────────────────────────────────────────────────────┤
|
|
64
|
+
│ [保存映射] [进入发布] │
|
|
65
|
+
└─────────────────────────────────────────────────────────────┘
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2.4 发布页(模板包生成)
|
|
69
|
+
```
|
|
70
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
71
|
+
│ 发布结果 │
|
|
72
|
+
│ template_id: scene.customer-order │
|
|
73
|
+
│ output_dir: .sce/templates/exports/capability-scene_customer… │
|
|
74
|
+
│ files: │
|
|
75
|
+
│ - capability-template.json │
|
|
76
|
+
│ - template-registry.json │
|
|
77
|
+
│ [复制路径] [推送模板库] │
|
|
78
|
+
└─────────────────────────────────────────────────────────────┘
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 3. 推荐 UI 架构(顶部图标 + 页签)
|
|
84
|
+
|
|
85
|
+
顶部图标入口:`能力迭代`
|
|
86
|
+
|
|
87
|
+
内部页签建议:
|
|
88
|
+
1. `Scene 盘点`
|
|
89
|
+
2. `评估`
|
|
90
|
+
3. `模板构建`
|
|
91
|
+
4. `发布`
|
|
92
|
+
|
|
93
|
+
状态机建议:
|
|
94
|
+
`extract -> score -> map -> register`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 4. SCE 接口参数(CLI 可封装)
|
|
99
|
+
|
|
100
|
+
### 4.1 提取候选能力
|
|
101
|
+
```bash
|
|
102
|
+
sce capability extract --scene <sceneId> --json
|
|
103
|
+
```
|
|
104
|
+
可选参数:
|
|
105
|
+
- `--specs <spec-id, spec-id>`
|
|
106
|
+
- `--out <path>`
|
|
107
|
+
- `--sample-limit <n>`
|
|
108
|
+
|
|
109
|
+
### 4.2 评分
|
|
110
|
+
```bash
|
|
111
|
+
sce capability score --input <candidate.json> --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 4.3 本体映射
|
|
115
|
+
```bash
|
|
116
|
+
sce capability map --input <candidate.json> --mapping <ontology.json> --json
|
|
117
|
+
```
|
|
118
|
+
可选参数:
|
|
119
|
+
- `--template-id <id>`
|
|
120
|
+
- `--name <name>`
|
|
121
|
+
- `--description <desc>`
|
|
122
|
+
- `--category <category>`
|
|
123
|
+
- `--tags <tag1,tag2>`
|
|
124
|
+
|
|
125
|
+
### 4.4 发布模板包
|
|
126
|
+
```bash
|
|
127
|
+
sce capability register --input <template.json> --json
|
|
128
|
+
```
|
|
129
|
+
可选参数:
|
|
130
|
+
- `--out <dir>`
|
|
131
|
+
- `--risk-level <low|medium|high|critical>`
|
|
132
|
+
- `--difficulty <beginner|intermediate|advanced>`
|
|
133
|
+
- `--tags <tag1,tag2>`
|
|
134
|
+
- `--applicable-scenarios <scene1,scene2>`
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 5. 数据契约(前端对接)
|
|
139
|
+
|
|
140
|
+
- UI 契约:`docs/agent-runtime/capability-iteration-ui.schema.json`
|
|
141
|
+
- 本体映射 schema:`docs/ontology/capability-mapping.schema.json`
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 6. 前端适配建议
|
|
146
|
+
|
|
147
|
+
### 6.1 状态管理
|
|
148
|
+
- 采用步骤式状态机:`extract -> score -> map -> register`
|
|
149
|
+
- 每一步输出的 JSON 都持久化,便于回放/复用
|
|
150
|
+
|
|
151
|
+
### 6.2 体验优化
|
|
152
|
+
- Scene 首页显示完成率、待处理数、评分卡入口
|
|
153
|
+
- 评分卡统一可视化(value/reuse/stability/risk)
|
|
154
|
+
- 本体映射表单应支持快速导入与默认推荐值
|
|
155
|
+
|
|
156
|
+
### 6.3 错误处理
|
|
157
|
+
- CLI 失败时直接展示错误原因
|
|
158
|
+
- `task_error` 存在时提示 spec 任务文件缺失或解析失败
|
|
159
|
+
- 保留上一步产物可继续重试
|
|
160
|
+
|
|
161
|
+
### 6.4 权限与治理
|
|
162
|
+
- 若涉及写入本体或发布模板,建议通过 SCE auth lease 授权
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 7. 推荐路由
|
|
167
|
+
|
|
168
|
+
- `/capability` Scene 首页
|
|
169
|
+
- `/capability/scene/:sceneId` 评估页
|
|
170
|
+
- `/capability/scene/:sceneId/template` 模板构建页
|
|
171
|
+
- `/capability/scene/:sceneId/release` 发布页
|
|
172
|
+
|