scene-capability-engine 3.0.7 → 3.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.
- package/CHANGELOG.md +56 -0
- package/docs/331-poc-adaptation-roadmap.md +21 -2
- package/docs/331-poc-dual-track-integration-guide.md +10 -6
- package/docs/331-poc-weekly-delivery-checklist.md +15 -0
- package/docs/README.md +6 -0
- package/docs/command-reference.md +279 -5
- package/docs/handoff-profile-integration-guide.md +88 -0
- package/docs/interactive-customization/331-poc-sce-integration-checklist.md +148 -0
- package/docs/interactive-customization/README.md +354 -0
- package/docs/interactive-customization/adapter-extension-contract.md +55 -0
- package/docs/interactive-customization/adapter-extension-contract.sample.json +59 -0
- package/docs/interactive-customization/adapter-extension-contract.schema.json +192 -0
- package/docs/interactive-customization/change-intent.schema.json +72 -0
- package/docs/interactive-customization/change-plan.sample.json +41 -0
- package/docs/interactive-customization/change-plan.schema.json +125 -0
- package/docs/interactive-customization/cross-industry-replication-guide.md +49 -0
- package/docs/interactive-customization/dialogue-governance-policy-baseline.json +49 -0
- package/docs/interactive-customization/domain-pack-extension-flow.md +71 -0
- package/docs/interactive-customization/execution-record.schema.json +62 -0
- package/docs/interactive-customization/governance-alert-playbook.md +51 -0
- package/docs/interactive-customization/governance-report-template.md +46 -0
- package/docs/interactive-customization/governance-threshold-baseline.json +14 -0
- package/docs/interactive-customization/guardrail-policy-baseline.json +27 -0
- package/docs/interactive-customization/high-risk-action-catalog.json +22 -0
- package/docs/interactive-customization/moqui-adapter-interface.md +40 -0
- package/docs/interactive-customization/moqui-context-provider.sample.json +72 -0
- package/docs/interactive-customization/moqui-copilot-context-contract.json +50 -0
- package/docs/interactive-customization/moqui-copilot-integration-guide.md +100 -0
- package/docs/interactive-customization/moqui-interactive-template-playbook.md +94 -0
- package/docs/interactive-customization/non-technical-usability-report.md +57 -0
- package/docs/interactive-customization/page-context.sample.json +73 -0
- package/docs/interactive-customization/page-context.schema.json +150 -0
- package/docs/interactive-customization/phase-acceptance-evidence.md +110 -0
- package/docs/interactive-customization/runtime-mode-policy-baseline.json +99 -0
- package/docs/moqui-template-core-library-playbook.md +71 -0
- package/docs/release-checklist.md +29 -4
- package/docs/security-governance-default-baseline.md +53 -0
- package/docs/starter-kit/README.md +50 -0
- package/docs/starter-kit/handoff-manifest.starter.json +32 -0
- package/docs/starter-kit/handoff-profile-ci.sample.yml +53 -0
- package/docs/starter-kit/release.workflow.sample.yml +41 -0
- package/docs/zh/README.md +12 -0
- package/lib/auto/moqui-recovery-sequence.js +62 -0
- package/lib/commands/auto.js +325 -42
- package/lib/commands/scene.js +837 -0
- package/lib/data/moqui-capability-lexicon.json +14 -1
- package/lib/interactive-customization/change-plan-gate-core.js +201 -0
- package/lib/interactive-customization/index.js +9 -0
- package/lib/interactive-customization/moqui-interactive-adapter.js +732 -0
- package/lib/orchestrator/orchestration-engine.js +64 -6
- package/package.json +28 -2
|
@@ -107,6 +107,8 @@ class OrchestrationEngine extends EventEmitter {
|
|
|
107
107
|
this._launchBudgetLastHoldSignalAt = 0;
|
|
108
108
|
/** @type {number} last launch-budget hold duration emitted to telemetry (ms) */
|
|
109
109
|
this._launchBudgetLastHoldMs = 0;
|
|
110
|
+
/** @type {Set<{timer: NodeJS.Timeout|null, resolve: (() => void)|null}>} cancellable sleep waiters */
|
|
111
|
+
this._pendingSleeps = new Set();
|
|
110
112
|
/** @type {number} fallback wait timeout to avoid indefinite hangs when lifecycle events are missing */
|
|
111
113
|
this._agentWaitTimeoutMs = (DEFAULT_AGENT_WAIT_TIMEOUT_SECONDS * 1000) + AGENT_WAIT_TIMEOUT_GRACE_MS;
|
|
112
114
|
/** @type {() => number} */
|
|
@@ -230,6 +232,7 @@ class OrchestrationEngine extends EventEmitter {
|
|
|
230
232
|
*/
|
|
231
233
|
async stop() {
|
|
232
234
|
this._stopped = true;
|
|
235
|
+
this._cancelPendingSleeps();
|
|
233
236
|
|
|
234
237
|
if (this._state !== 'running') {
|
|
235
238
|
return;
|
|
@@ -520,10 +523,7 @@ class OrchestrationEngine extends EventEmitter {
|
|
|
520
523
|
this._statusMonitor.updateSpecStatus(specName, 'pending', null, resolvedError);
|
|
521
524
|
|
|
522
525
|
const retryDelayMs = isRateLimitError
|
|
523
|
-
?
|
|
524
|
-
this._calculateRateLimitBackoffMs(retryCount),
|
|
525
|
-
this._extractRateLimitRetryAfterMs(resolvedError)
|
|
526
|
-
)
|
|
526
|
+
? this._resolveRateLimitRetryDelayMs(resolvedError, retryCount)
|
|
527
527
|
: 0;
|
|
528
528
|
if (retryDelayMs > 0) {
|
|
529
529
|
this._onRateLimitSignal(retryDelayMs);
|
|
@@ -1156,16 +1156,73 @@ class OrchestrationEngine extends EventEmitter {
|
|
|
1156
1156
|
return Math.max(1, Math.round(cappedBaseDelay * jitterFactor));
|
|
1157
1157
|
}
|
|
1158
1158
|
|
|
1159
|
+
/**
|
|
1160
|
+
* Resolve final retry delay for rate-limit failures.
|
|
1161
|
+
* Uses larger of computed backoff and retry-after hint, then clamps to configured max.
|
|
1162
|
+
*
|
|
1163
|
+
* @param {string} error
|
|
1164
|
+
* @param {number} retryCount
|
|
1165
|
+
* @returns {number}
|
|
1166
|
+
* @private
|
|
1167
|
+
*/
|
|
1168
|
+
_resolveRateLimitRetryDelayMs(error, retryCount) {
|
|
1169
|
+
const computedBackoffMs = this._calculateRateLimitBackoffMs(retryCount);
|
|
1170
|
+
const hintedRetryAfterMs = this._extractRateLimitRetryAfterMs(error);
|
|
1171
|
+
const candidateDelayMs = Math.max(computedBackoffMs, hintedRetryAfterMs);
|
|
1172
|
+
const maxDelayMs = this._toPositiveInteger(
|
|
1173
|
+
this._rateLimitBackoffMaxMs,
|
|
1174
|
+
DEFAULT_RATE_LIMIT_BACKOFF_MAX_MS
|
|
1175
|
+
);
|
|
1176
|
+
return Math.max(1, Math.min(candidateDelayMs, maxDelayMs));
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1159
1179
|
/**
|
|
1160
1180
|
* @param {number} ms
|
|
1161
1181
|
* @returns {Promise<void>}
|
|
1162
1182
|
* @private
|
|
1163
1183
|
*/
|
|
1164
1184
|
_sleep(ms) {
|
|
1165
|
-
if (!ms || ms <= 0) {
|
|
1185
|
+
if (!ms || ms <= 0 || this._stopped) {
|
|
1166
1186
|
return Promise.resolve();
|
|
1167
1187
|
}
|
|
1168
|
-
return new Promise((resolve) =>
|
|
1188
|
+
return new Promise((resolve) => {
|
|
1189
|
+
let settled = false;
|
|
1190
|
+
const entry = { timer: null, resolve: null };
|
|
1191
|
+
entry.resolve = () => {
|
|
1192
|
+
if (settled) {
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
settled = true;
|
|
1196
|
+
if (entry.timer) {
|
|
1197
|
+
clearTimeout(entry.timer);
|
|
1198
|
+
}
|
|
1199
|
+
this._pendingSleeps.delete(entry);
|
|
1200
|
+
resolve();
|
|
1201
|
+
};
|
|
1202
|
+
entry.timer = setTimeout(() => {
|
|
1203
|
+
if (entry.resolve) {
|
|
1204
|
+
entry.resolve();
|
|
1205
|
+
}
|
|
1206
|
+
}, ms);
|
|
1207
|
+
this._pendingSleeps.add(entry);
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Cancel all pending sleeps so stop() does not block behind long retry waits.
|
|
1213
|
+
*
|
|
1214
|
+
* @private
|
|
1215
|
+
*/
|
|
1216
|
+
_cancelPendingSleeps() {
|
|
1217
|
+
if (!this._pendingSleeps || this._pendingSleeps.size === 0) {
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
for (const entry of Array.from(this._pendingSleeps)) {
|
|
1221
|
+
if (entry && typeof entry.resolve === 'function') {
|
|
1222
|
+
entry.resolve();
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
this._pendingSleeps.clear();
|
|
1169
1226
|
}
|
|
1170
1227
|
|
|
1171
1228
|
/**
|
|
@@ -1300,6 +1357,7 @@ class OrchestrationEngine extends EventEmitter {
|
|
|
1300
1357
|
* @private
|
|
1301
1358
|
*/
|
|
1302
1359
|
_reset() {
|
|
1360
|
+
this._cancelPendingSleeps();
|
|
1303
1361
|
this._runningAgents.clear();
|
|
1304
1362
|
this._retryCounts.clear();
|
|
1305
1363
|
this._failedSpecs.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scene-capability-engine",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "SCE (Scene Capability Engine) - A CLI tool and npm package for spec-driven development with AI coding assistants.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
"test:integration": "npx jest tests/integration",
|
|
32
32
|
"test:properties": "npx jest tests/properties",
|
|
33
33
|
"test:handles": "npx jest --config=jest.config.js --runInBand --detectOpenHandles",
|
|
34
|
+
"test:interactive-loop-smoke": "node scripts/interactive-loop-smoke.js --json",
|
|
35
|
+
"test:interactive-flow-smoke": "node scripts/interactive-flow-smoke.js --json",
|
|
34
36
|
"test:skip-audit": "node scripts/check-skip-allowlist.js",
|
|
35
37
|
"test:brand-consistency": "node scripts/check-branding-consistency.js",
|
|
36
38
|
"test:watch": "npx jest --watch",
|
|
@@ -38,9 +40,33 @@
|
|
|
38
40
|
"report:moqui-metadata": "node scripts/moqui-metadata-extract.js --json",
|
|
39
41
|
"report:moqui-rebuild": "node scripts/moqui-standard-rebuild.js --json",
|
|
40
42
|
"gate:moqui-rebuild": "node scripts/moqui-rebuild-gate.js",
|
|
43
|
+
"gate:matrix-regression": "node scripts/matrix-regression-gate.js --json",
|
|
41
44
|
"report:moqui-baseline": "node scripts/moqui-template-baseline-report.js --json",
|
|
45
|
+
"report:moqui-summary": "node scripts/moqui-release-summary.js --json",
|
|
46
|
+
"report:matrix-remediation-queue": "node scripts/moqui-matrix-remediation-queue.js --json",
|
|
47
|
+
"run:matrix-remediation-phased": "node scripts/moqui-matrix-remediation-phased-runner.js",
|
|
48
|
+
"run:matrix-remediation-from-baseline": "node scripts/moqui-matrix-remediation-phased-runner.js --baseline .kiro/reports/release-evidence/moqui-template-baseline.json",
|
|
49
|
+
"run:matrix-remediation-clusters": "node bin/sce.js auto close-loop-batch .kiro/auto/matrix-remediation.capability-clusters.json --format json --batch-parallel 1 --batch-agent-budget 2 --batch-retry-until-complete --json",
|
|
50
|
+
"run:matrix-remediation-clusters-phased": "node scripts/moqui-matrix-remediation-phased-runner.js --cluster-goals .kiro/auto/matrix-remediation.capability-clusters.json",
|
|
51
|
+
"gate:interactive-plan": "node scripts/interactive-change-plan-gate.js --plan docs/interactive-customization/change-plan.sample.json --json",
|
|
52
|
+
"report:interactive-context-bridge": "node scripts/interactive-context-bridge.js --input docs/interactive-customization/moqui-context-provider.sample.json --json",
|
|
53
|
+
"report:interactive-dialogue-governance": "node scripts/interactive-dialogue-governance.js --goal \"Improve order entry speed without changing payment policy\" --context docs/interactive-customization/page-context.sample.json --json",
|
|
54
|
+
"report:interactive-intent": "node scripts/interactive-intent-build.js --context docs/interactive-customization/page-context.sample.json --goal \"Must improve order approval speed without changing payment authorization policy\" --user-id demo-user --json",
|
|
55
|
+
"report:interactive-plan": "node scripts/interactive-plan-build.js --intent .kiro/reports/interactive-change-intent.json --context docs/interactive-customization/page-context.sample.json --json",
|
|
56
|
+
"report:interactive-runtime-policy": "node scripts/interactive-runtime-policy-evaluate.js --plan docs/interactive-customization/change-plan.sample.json --json",
|
|
57
|
+
"report:interactive-work-order": "node scripts/interactive-work-order-build.js --plan docs/interactive-customization/change-plan.sample.json --json",
|
|
58
|
+
"report:interactive-approval-status": "node scripts/interactive-approval-workflow.js --action status --json",
|
|
59
|
+
"report:interactive-adapter-capabilities": "node scripts/interactive-moqui-adapter.js --action capabilities --json",
|
|
60
|
+
"run:interactive-loop": "node scripts/interactive-customization-loop.js",
|
|
61
|
+
"run:interactive-flow": "node scripts/interactive-flow.js",
|
|
62
|
+
"log:interactive-feedback": "node scripts/interactive-feedback-log.js",
|
|
63
|
+
"report:interactive-governance": "node scripts/interactive-governance-report.js --period weekly --json",
|
|
64
|
+
"report:release-ops-weekly": "node scripts/release-ops-weekly-summary.js --json",
|
|
65
|
+
"gate:release-ops-weekly": "node scripts/release-weekly-ops-gate.js",
|
|
66
|
+
"gate:release-asset-integrity": "node scripts/release-asset-integrity-check.js",
|
|
67
|
+
"report:release-risk-remediation": "node scripts/release-risk-remediation-bundle.js --json",
|
|
42
68
|
"report:moqui-core-regression": "node scripts/moqui-core-regression-suite.js --json",
|
|
43
|
-
"prepublishOnly": "npm run test:full && npm run test:skip-audit && npm run test:brand-consistency",
|
|
69
|
+
"prepublishOnly": "npm run test:full && npm run test:skip-audit && npm run test:brand-consistency && npm run report:interactive-governance -- --fail-on-alert",
|
|
44
70
|
"publish:manual": "npm publish --access public",
|
|
45
71
|
"install-global": "npm install -g .",
|
|
46
72
|
"uninstall-global": "npm uninstall -g scene-capability-engine"
|