scene-capability-engine 3.6.8 → 3.6.10

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 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.10] - 2026-03-05
11
+
12
+ ### Added
13
+ - Capability iteration CLI for scene/spec/task history:
14
+ - `sce capability extract`
15
+ - `sce capability score`
16
+ - `sce capability map`
17
+ - `sce capability register`
18
+ - Extracted capability candidates now include task summaries and scene/spec provenance for UI governance workflows.
19
+ - Added schema references for capability iteration UI contract and ontology mapping.
20
+ - Magicball capability iteration docs:
21
+ - `docs/magicball-capability-iteration-ui.md`
22
+ - `docs/magicball-capability-iteration-api.md`
23
+
24
+ ## [3.6.9] - 2026-03-05
25
+
26
+ ### Added
27
+ - Orchestration runtime now emits machine-readable `rate-limit:decision` telemetry events for retry/throttle/hold/recovery transitions.
28
+ - New anti-429 runtime config knobs in `.sce/config/orchestrator.json`:
29
+ - `rateLimitRetrySpreadMs`
30
+ - `rateLimitLaunchHoldPollMs`
31
+ - `rateLimitDecisionEventThrottleMs`
32
+
33
+ ### Changed
34
+ - Rate-limit retries now apply deterministic per-spec retry spread to reduce synchronized 429 bursts under high parallelism.
35
+ - Launch-hold polling interval is now configurable, so anti-429 pause loops can be tuned for responsiveness vs overhead.
36
+
10
37
  ## [3.6.8] - 2026-03-05
11
38
 
12
39
  ### Added
package/README.md CHANGED
@@ -121,6 +121,7 @@ SCE is tool-agnostic and works with Codex, Claude Code, Cursor, Windsurf, VS Cod
121
121
  - Session governance is scene-first: `1 scene = 1 primary session`.
122
122
  - Spec work is attached as child sessions and auto-archived.
123
123
  - Startup now auto-detects adopted projects and aligns takeover baseline defaults automatically.
124
+ - Multi-agent anti-429 runtime now supports deterministic retry spread and machine-readable `rate-limit:decision` telemetry (`rateLimitRetrySpreadMs`, `rateLimitLaunchHoldPollMs`, `rateLimitDecisionEventThrottleMs`).
124
125
  - Problem evaluation policy is enabled by default (`.sce/config/problem-eval-policy.json`) and evaluates every Studio stage.
125
126
  - Problem closure policy is enabled by default (`.sce/config/problem-closure-policy.json`) and blocks verify/release bypass when required domain/problem evidence is missing.
126
127
  - Error handling now follows a full incident loop by default: every record attempt is staged first and auto-closed on verified/promoted outcomes.
@@ -217,5 +218,5 @@ MIT. See [LICENSE](LICENSE).
217
218
 
218
219
  ---
219
220
 
220
- **Version**: 3.6.3
221
+ **Version**: 3.6.10
221
222
  **Last Updated**: 2026-03-05
package/README.zh.md CHANGED
@@ -121,6 +121,7 @@ SCE 对工具无锁定,可接入 Codex、Claude Code、Cursor、Windsurf、VS
121
121
  - 会话治理默认场景优先:`1 scene = 1 primary session`。
122
122
  - Spec 执行作为子会话自动归档,支持跨轮次追踪。
123
123
  - 启动时会自动识别已接管项目并对齐接管基线默认配置。
124
+ - 多 Agent 抗 429 运行时新增“确定性重试错峰 + 机器可读 `rate-limit:decision` 事件”,可通过 `rateLimitRetrySpreadMs`、`rateLimitLaunchHoldPollMs`、`rateLimitDecisionEventThrottleMs` 调优。
124
125
  - 问题评估策略默认启用(`.sce/config/problem-eval-policy.json`),Studio 各阶段都会执行评估。
125
126
  - 问题闭环策略默认启用(`.sce/config/problem-closure-policy.json`),缺失必要问题/领域证据时会在 verify/release 阶段阻断。
126
127
  - 错误处理默认进入完整 incident 闭环:每次记录先落到 staging 试错链路,verified/promoted 后自动收束归档。
@@ -217,5 +218,5 @@ MIT,见 [LICENSE](LICENSE)。
217
218
 
218
219
  ---
219
220
 
220
- **版本**:3.6.3
221
+ **版本**:3.6.10
221
222
  **最后更新**:2026-03-05
@@ -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
+ }
@@ -23,6 +23,9 @@ This document defines the default anti-429 presets used by SCE multi-agent orche
23
23
  | `rateLimitSignalThreshold` | 2 | 3 | 4 |
24
24
  | `rateLimitSignalExtraHoldMs` | 5000 | 3000 | 2000 |
25
25
  | `rateLimitDynamicBudgetFloor` | 1 | 1 | 2 |
26
+ | `rateLimitRetrySpreadMs` | 1200 | 600 | 250 |
27
+ | `rateLimitLaunchHoldPollMs` | 1000 | 1000 | 1000 |
28
+ | `rateLimitDecisionEventThrottleMs` | 1000 | 1000 | 1000 |
26
29
 
27
30
  ## Usage
28
31
 
@@ -64,3 +67,4 @@ Release readiness criteria:
64
67
  1. No failing test in orchestrator/rate-limit scope.
65
68
  2. `orchestrate profile show --json` returns expected profile and effective values.
66
69
  3. Multi-agent run no longer stalls under sustained `429`; launch budget and hold telemetry progress over time.
70
+ 4. `rate-limit:decision` events are emitted as machine-readable telemetry for retry/throttle/recovery transitions.
@@ -1796,6 +1796,9 @@ Recommended `.sce/config/orchestrator.json`:
1796
1796
  "rateLimitSignalThreshold": 3,
1797
1797
  "rateLimitSignalExtraHoldMs": 3000,
1798
1798
  "rateLimitDynamicBudgetFloor": 1,
1799
+ "rateLimitRetrySpreadMs": 600,
1800
+ "rateLimitLaunchHoldPollMs": 1000,
1801
+ "rateLimitDecisionEventThrottleMs": 1000,
1799
1802
  "apiKeyEnvVar": "CODEX_API_KEY",
1800
1803
  "codexArgs": ["--skip-git-repo-check"],
1801
1804
  "codexCommand": "npx @openai/codex"
@@ -1809,9 +1812,14 @@ Recommended `.sce/config/orchestrator.json`:
1809
1812
  - `rateLimitSignalThreshold`: signals required inside window before escalation
1810
1813
  - `rateLimitSignalExtraHoldMs`: extra launch hold per escalation unit
1811
1814
  - `rateLimitDynamicBudgetFloor`: lowest dynamic launch budget allowed during sustained pressure
1815
+ - `rateLimitRetrySpreadMs`: deterministic retry spread (per spec/retry round) to reduce synchronized retry bursts
1816
+ - `rateLimitLaunchHoldPollMs`: polling interval while launch hold is active (lower values react faster, higher values reduce loop overhead)
1817
+ - `rateLimitDecisionEventThrottleMs`: de-dup interval for repeated `rate-limit:decision` telemetry events
1812
1818
 
1813
1819
  `orchestrate stop` interrupts pending retry waits immediately so long backoff windows do not look like deadlocks.
1814
1820
 
1821
+ Runtime emits machine-readable `rate-limit:decision` events for retry/throttle/hold/recovery transitions, so UI or controller layers can surface anti-429 actions directly.
1822
+
1815
1823
  Codex sub-agent permission defaults:
1816
1824
  - `--sandbox danger-full-access` is always injected by orchestrator runtime.
1817
1825
  - `--ask-for-approval never` is injected by default when `codexArgs` does not explicitly set approval mode.
@@ -1839,6 +1847,27 @@ sce scene template-render --package <name> --values <json-or-path> --out <dir>
1839
1847
  sce scene template-render --package scene-erp --values '{"entity_name":"Order"}' --out ./output --json
1840
1848
  ```
1841
1849
 
1850
+ ### Capability Iteration (scene -> template -> ontology)
1851
+
1852
+ ```bash
1853
+ # 1) Extract capability candidate from scene history
1854
+ sce capability extract --scene scene.customer-order --json
1855
+
1856
+ # 2) Score candidate value/reuse/risk
1857
+ sce capability score --input .sce/reports/capability-iteration/scene.customer-order.candidate.json --json
1858
+
1859
+ # 3) Attach ontology mapping
1860
+ sce capability map --input .sce/reports/capability-iteration/scene.customer-order.candidate.json \
1861
+ --mapping .sce/ontology/capability-mapping.json --json
1862
+
1863
+ # 4) Export registry-ready capability template package
1864
+ sce capability register --input .sce/reports/capability-iteration/scene.customer-order.template.json --json
1865
+ ```
1866
+
1867
+ Schema references:
1868
+ - UI contract: `docs/agent-runtime/capability-iteration-ui.schema.json`
1869
+ - Ontology mapping: `docs/ontology/capability-mapping.schema.json`
1870
+
1842
1871
  ### Scene Package Batch Publish
1843
1872
 
1844
1873
  ```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
+