scene-capability-engine 3.0.8 → 3.2.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/docs/331-poc-adaptation-roadmap.md +21 -2
  3. package/docs/331-poc-dual-track-integration-guide.md +10 -6
  4. package/docs/331-poc-weekly-delivery-checklist.md +5 -0
  5. package/docs/README.md +6 -0
  6. package/docs/command-reference.md +262 -4
  7. package/docs/handoff-profile-integration-guide.md +88 -0
  8. package/docs/interactive-customization/331-poc-sce-integration-checklist.md +148 -0
  9. package/docs/interactive-customization/README.md +362 -0
  10. package/docs/interactive-customization/adapter-extension-contract.md +55 -0
  11. package/docs/interactive-customization/adapter-extension-contract.sample.json +59 -0
  12. package/docs/interactive-customization/adapter-extension-contract.schema.json +192 -0
  13. package/docs/interactive-customization/approval-role-policy-baseline.json +36 -0
  14. package/docs/interactive-customization/change-intent.schema.json +72 -0
  15. package/docs/interactive-customization/change-plan.sample.json +41 -0
  16. package/docs/interactive-customization/change-plan.schema.json +125 -0
  17. package/docs/interactive-customization/cross-industry-replication-guide.md +49 -0
  18. package/docs/interactive-customization/dialogue-governance-policy-baseline.json +49 -0
  19. package/docs/interactive-customization/domain-pack-extension-flow.md +71 -0
  20. package/docs/interactive-customization/execution-record.schema.json +62 -0
  21. package/docs/interactive-customization/governance-alert-playbook.md +51 -0
  22. package/docs/interactive-customization/governance-report-template.md +46 -0
  23. package/docs/interactive-customization/governance-threshold-baseline.json +14 -0
  24. package/docs/interactive-customization/guardrail-policy-baseline.json +27 -0
  25. package/docs/interactive-customization/high-risk-action-catalog.json +22 -0
  26. package/docs/interactive-customization/moqui-adapter-interface.md +40 -0
  27. package/docs/interactive-customization/moqui-context-provider.sample.json +72 -0
  28. package/docs/interactive-customization/moqui-copilot-context-contract.json +50 -0
  29. package/docs/interactive-customization/moqui-copilot-integration-guide.md +100 -0
  30. package/docs/interactive-customization/moqui-interactive-template-playbook.md +94 -0
  31. package/docs/interactive-customization/non-technical-usability-report.md +57 -0
  32. package/docs/interactive-customization/page-context.sample.json +73 -0
  33. package/docs/interactive-customization/page-context.schema.json +150 -0
  34. package/docs/interactive-customization/phase-acceptance-evidence.md +110 -0
  35. package/docs/interactive-customization/runtime-mode-policy-baseline.json +99 -0
  36. package/docs/moqui-template-core-library-playbook.md +28 -0
  37. package/docs/release-checklist.md +29 -4
  38. package/docs/security-governance-default-baseline.md +54 -0
  39. package/docs/starter-kit/README.md +50 -0
  40. package/docs/starter-kit/handoff-manifest.starter.json +32 -0
  41. package/docs/starter-kit/handoff-profile-ci.sample.yml +53 -0
  42. package/docs/starter-kit/release.workflow.sample.yml +41 -0
  43. package/docs/zh/README.md +12 -0
  44. package/lib/auto/moqui-recovery-sequence.js +62 -0
  45. package/lib/commands/auto.js +245 -34
  46. package/lib/commands/scene.js +867 -0
  47. package/lib/data/moqui-capability-lexicon.json +14 -1
  48. package/lib/interactive-customization/change-plan-gate-core.js +201 -0
  49. package/lib/interactive-customization/index.js +9 -0
  50. package/lib/interactive-customization/moqui-interactive-adapter.js +732 -0
  51. package/package.json +27 -2
@@ -0,0 +1,59 @@
1
+ {
2
+ "adapter_id": "moqui-interactive-adapter",
3
+ "adapter_version": "1.0.0",
4
+ "runtime": "moqui",
5
+ "capability_declaration": {
6
+ "supported_change_types": [
7
+ "analysis_only",
8
+ "update_rule_threshold",
9
+ "ui_form_field_adjust",
10
+ "workflow_approval_chain_change",
11
+ "inventory_adjustment_bulk",
12
+ "payment_rule_change"
13
+ ],
14
+ "requires": [
15
+ "profile:moqui",
16
+ "policy:interactive-guardrail"
17
+ ],
18
+ "notes": "High-risk destructive actions remain blocked unless explicitly approved."
19
+ },
20
+ "risk_declaration": {
21
+ "default_execution_mode": "suggestion",
22
+ "auto_apply_risk_levels": [
23
+ "low"
24
+ ],
25
+ "blocked_action_types": [
26
+ "credential_export",
27
+ "permission_grant_super_admin",
28
+ "bulk_delete_without_filter"
29
+ ]
30
+ },
31
+ "interfaces": {
32
+ "capabilities": {
33
+ "implemented": true,
34
+ "entrypoint": "capabilities()"
35
+ },
36
+ "plan": {
37
+ "implemented": true,
38
+ "entrypoint": "plan(changeIntent, context)"
39
+ },
40
+ "validate": {
41
+ "implemented": true,
42
+ "entrypoint": "validate(changePlan)"
43
+ },
44
+ "apply": {
45
+ "implemented": true,
46
+ "entrypoint": "apply(changePlan)"
47
+ },
48
+ "rollback": {
49
+ "implemented": true,
50
+ "entrypoint": "rollback(executionId)"
51
+ }
52
+ },
53
+ "compliance": {
54
+ "guardrail_compatible": true,
55
+ "approval_workflow_compatible": true,
56
+ "rollback_supported": true,
57
+ "audit_record_schema": "docs/interactive-customization/execution-record.schema.json"
58
+ }
59
+ }
@@ -0,0 +1,192 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scene-capability-engine.dev/schemas/interactive/adapter-extension-contract.schema.json",
4
+ "title": "Interactive Adapter Extension Contract",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": [
8
+ "adapter_id",
9
+ "adapter_version",
10
+ "runtime",
11
+ "capability_declaration",
12
+ "risk_declaration",
13
+ "interfaces",
14
+ "compliance"
15
+ ],
16
+ "properties": {
17
+ "adapter_id": {
18
+ "type": "string",
19
+ "minLength": 1
20
+ },
21
+ "adapter_version": {
22
+ "type": "string",
23
+ "minLength": 1
24
+ },
25
+ "runtime": {
26
+ "type": "string",
27
+ "minLength": 1
28
+ },
29
+ "capability_declaration": {
30
+ "type": "object",
31
+ "required": [
32
+ "supported_change_types"
33
+ ],
34
+ "properties": {
35
+ "supported_change_types": {
36
+ "type": "array",
37
+ "minItems": 1,
38
+ "items": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ }
42
+ },
43
+ "requires": {
44
+ "type": "array",
45
+ "items": {
46
+ "type": "string"
47
+ }
48
+ },
49
+ "notes": {
50
+ "type": "string"
51
+ }
52
+ }
53
+ },
54
+ "risk_declaration": {
55
+ "type": "object",
56
+ "required": [
57
+ "default_execution_mode",
58
+ "auto_apply_risk_levels"
59
+ ],
60
+ "properties": {
61
+ "default_execution_mode": {
62
+ "type": "string",
63
+ "enum": [
64
+ "suggestion",
65
+ "apply"
66
+ ]
67
+ },
68
+ "auto_apply_risk_levels": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string",
72
+ "enum": [
73
+ "low",
74
+ "medium",
75
+ "high"
76
+ ]
77
+ }
78
+ },
79
+ "blocked_action_types": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "string"
83
+ }
84
+ }
85
+ }
86
+ },
87
+ "interfaces": {
88
+ "type": "object",
89
+ "required": [
90
+ "capabilities",
91
+ "plan",
92
+ "validate",
93
+ "apply",
94
+ "rollback"
95
+ ],
96
+ "properties": {
97
+ "capabilities": {
98
+ "type": "object",
99
+ "required": [
100
+ "implemented"
101
+ ],
102
+ "properties": {
103
+ "implemented": {
104
+ "type": "boolean"
105
+ },
106
+ "entrypoint": {
107
+ "type": "string"
108
+ }
109
+ }
110
+ },
111
+ "plan": {
112
+ "type": "object",
113
+ "required": [
114
+ "implemented"
115
+ ],
116
+ "properties": {
117
+ "implemented": {
118
+ "type": "boolean"
119
+ },
120
+ "entrypoint": {
121
+ "type": "string"
122
+ }
123
+ }
124
+ },
125
+ "validate": {
126
+ "type": "object",
127
+ "required": [
128
+ "implemented"
129
+ ],
130
+ "properties": {
131
+ "implemented": {
132
+ "type": "boolean"
133
+ },
134
+ "entrypoint": {
135
+ "type": "string"
136
+ }
137
+ }
138
+ },
139
+ "apply": {
140
+ "type": "object",
141
+ "required": [
142
+ "implemented"
143
+ ],
144
+ "properties": {
145
+ "implemented": {
146
+ "type": "boolean"
147
+ },
148
+ "entrypoint": {
149
+ "type": "string"
150
+ }
151
+ }
152
+ },
153
+ "rollback": {
154
+ "type": "object",
155
+ "required": [
156
+ "implemented"
157
+ ],
158
+ "properties": {
159
+ "implemented": {
160
+ "type": "boolean"
161
+ },
162
+ "entrypoint": {
163
+ "type": "string"
164
+ }
165
+ }
166
+ }
167
+ }
168
+ },
169
+ "compliance": {
170
+ "type": "object",
171
+ "required": [
172
+ "guardrail_compatible",
173
+ "approval_workflow_compatible",
174
+ "rollback_supported"
175
+ ],
176
+ "properties": {
177
+ "guardrail_compatible": {
178
+ "type": "boolean"
179
+ },
180
+ "approval_workflow_compatible": {
181
+ "type": "boolean"
182
+ },
183
+ "rollback_supported": {
184
+ "type": "boolean"
185
+ },
186
+ "audit_record_schema": {
187
+ "type": "string"
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "profile": "interactive-approval-role-baseline",
4
+ "role_requirements": {
5
+ "submit": [
6
+ "product-owner",
7
+ "ops-engineer",
8
+ "workflow-operator"
9
+ ],
10
+ "approve": [
11
+ "security-admin",
12
+ "product-owner",
13
+ "workflow-operator"
14
+ ],
15
+ "reject": [
16
+ "security-admin",
17
+ "product-owner",
18
+ "workflow-operator"
19
+ ],
20
+ "execute": [
21
+ "release-operator",
22
+ "ops-engineer",
23
+ "workflow-operator"
24
+ ],
25
+ "verify": [
26
+ "qa-owner",
27
+ "release-operator",
28
+ "workflow-operator"
29
+ ],
30
+ "archive": [
31
+ "product-owner",
32
+ "release-operator",
33
+ "workflow-operator"
34
+ ]
35
+ }
36
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scene-capability-engine.dev/schemas/interactive/change-intent.schema.json",
4
+ "title": "Interactive Change Intent",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": [
8
+ "intent_id",
9
+ "user_id",
10
+ "context_ref",
11
+ "business_goal",
12
+ "created_at"
13
+ ],
14
+ "properties": {
15
+ "intent_id": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "user_id": {
20
+ "type": "string",
21
+ "minLength": 1
22
+ },
23
+ "context_ref": {
24
+ "type": "object",
25
+ "required": [
26
+ "product",
27
+ "module"
28
+ ],
29
+ "properties": {
30
+ "product": {
31
+ "type": "string",
32
+ "minLength": 1
33
+ },
34
+ "module": {
35
+ "type": "string",
36
+ "minLength": 1
37
+ },
38
+ "page": {
39
+ "type": "string"
40
+ },
41
+ "entity": {
42
+ "type": "string"
43
+ },
44
+ "scene_id": {
45
+ "type": "string"
46
+ }
47
+ }
48
+ },
49
+ "business_goal": {
50
+ "type": "string",
51
+ "minLength": 1
52
+ },
53
+ "constraints": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "string"
57
+ }
58
+ },
59
+ "priority": {
60
+ "type": "string",
61
+ "enum": [
62
+ "low",
63
+ "medium",
64
+ "high"
65
+ ]
66
+ },
67
+ "created_at": {
68
+ "type": "string",
69
+ "format": "date-time"
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "plan_id": "plan-demo-001",
3
+ "intent_id": "intent-demo-001",
4
+ "risk_level": "low",
5
+ "execution_mode": "suggestion",
6
+ "scope": {
7
+ "product": "moqui-experiment",
8
+ "module": "order",
9
+ "scene_id": "sce.scene--erp-order-fulfillment-workflow--0.1.0"
10
+ },
11
+ "actions": [
12
+ {
13
+ "action_id": "act-001",
14
+ "type": "update_rule_threshold",
15
+ "touches_sensitive_data": false,
16
+ "requires_privilege_escalation": false,
17
+ "irreversible": false
18
+ }
19
+ ],
20
+ "impact_assessment": {
21
+ "business": "improve order auto-release precision",
22
+ "technical": "rule parameter update only"
23
+ },
24
+ "verification_checks": [
25
+ "order fulfillment regression smoke",
26
+ "rule threshold snapshot compare"
27
+ ],
28
+ "rollback_plan": {
29
+ "type": "parameter-revert",
30
+ "reference": "baseline-rule-set-2026-02-19"
31
+ },
32
+ "approval": {
33
+ "status": "not-required",
34
+ "dual_approved": false
35
+ },
36
+ "security": {
37
+ "masking_applied": false,
38
+ "plaintext_secrets_in_payload": false
39
+ },
40
+ "created_at": "2026-02-19T00:00:00.000Z"
41
+ }
@@ -0,0 +1,125 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://scene-capability-engine.dev/schemas/interactive/change-plan.schema.json",
4
+ "title": "Interactive Change Plan",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": [
8
+ "plan_id",
9
+ "intent_id",
10
+ "risk_level",
11
+ "actions",
12
+ "created_at"
13
+ ],
14
+ "properties": {
15
+ "plan_id": {
16
+ "type": "string",
17
+ "minLength": 1
18
+ },
19
+ "intent_id": {
20
+ "type": "string",
21
+ "minLength": 1
22
+ },
23
+ "risk_level": {
24
+ "type": "string",
25
+ "enum": [
26
+ "low",
27
+ "medium",
28
+ "high"
29
+ ]
30
+ },
31
+ "execution_mode": {
32
+ "type": "string",
33
+ "enum": [
34
+ "suggestion",
35
+ "apply"
36
+ ]
37
+ },
38
+ "scope": {
39
+ "type": "object"
40
+ },
41
+ "actions": {
42
+ "type": "array",
43
+ "minItems": 1,
44
+ "items": {
45
+ "type": "object",
46
+ "required": [
47
+ "action_id",
48
+ "type"
49
+ ],
50
+ "properties": {
51
+ "action_id": {
52
+ "type": "string",
53
+ "minLength": 1
54
+ },
55
+ "type": {
56
+ "type": "string",
57
+ "minLength": 1
58
+ },
59
+ "touches_sensitive_data": {
60
+ "type": "boolean"
61
+ },
62
+ "requires_privilege_escalation": {
63
+ "type": "boolean"
64
+ },
65
+ "irreversible": {
66
+ "type": "boolean"
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "impact_assessment": {
72
+ "type": "object"
73
+ },
74
+ "verification_checks": {
75
+ "type": "array",
76
+ "items": {
77
+ "type": "string"
78
+ }
79
+ },
80
+ "rollback_plan": {
81
+ "type": "object"
82
+ },
83
+ "security": {
84
+ "type": "object",
85
+ "properties": {
86
+ "masking_applied": {
87
+ "type": "boolean"
88
+ },
89
+ "plaintext_secrets_in_payload": {
90
+ "type": "boolean"
91
+ },
92
+ "backup_reference": {
93
+ "type": "string"
94
+ }
95
+ }
96
+ },
97
+ "approval": {
98
+ "type": "object",
99
+ "properties": {
100
+ "status": {
101
+ "type": "string",
102
+ "enum": [
103
+ "approved",
104
+ "pending",
105
+ "rejected",
106
+ "not-required"
107
+ ]
108
+ },
109
+ "approvers": {
110
+ "type": "array",
111
+ "items": {
112
+ "type": "string"
113
+ }
114
+ },
115
+ "dual_approved": {
116
+ "type": "boolean"
117
+ }
118
+ }
119
+ },
120
+ "created_at": {
121
+ "type": "string",
122
+ "format": "date-time"
123
+ }
124
+ }
125
+ }
@@ -0,0 +1,49 @@
1
+ # Cross-Industry Replication Guide
2
+
3
+ This guide defines what can be reused directly and what must be domain-specialized when replicating the interactive customization model beyond Moqui.
4
+
5
+ ## Reusable Core (Do Not Fork)
6
+
7
+ 1. Interaction contracts
8
+ - `Change_Intent`, `Change_Plan`, `ExecutionRecord` schemas.
9
+
10
+ 2. Safety flow
11
+ - Guardrail gate (`allow/review-required/deny`).
12
+ - Approval workflow state machine.
13
+ - Execution and rollback audit model.
14
+
15
+ 3. Adapter contract
16
+ - `capabilities/plan/validate/apply/rollback` interface.
17
+ - Extension contract schema and compliance requirements.
18
+
19
+ 4. Governance observability
20
+ - KPI report + threshold alerting + remediation workflow.
21
+
22
+ ## Domain-Specific Layer (Extend by Domain_Pack)
23
+
24
+ 1. Ontology
25
+ - Domain entities and relations.
26
+ - Domain business rules and decision logic.
27
+
28
+ 2. Capability lexicon
29
+ - Canonical capability set and aliases for the domain.
30
+
31
+ 3. Template package portfolio
32
+ - Scene-package templates for top workflows and critical operations.
33
+
34
+ 4. Risk policy tuning
35
+ - Domain-specific blocked action types and thresholds.
36
+
37
+ ## Replication Sequence
38
+
39
+ 1. Choose one domain with clear high-value workflows.
40
+ 2. Build Domain_Pack ontology + template baseline.
41
+ 3. Implement one runtime adapter using extension contract.
42
+ 4. Start in suggestion-only mode, then enable low-risk one-click.
43
+ 5. Collect KPI and feedback for two cycles before expanding scope.
44
+
45
+ ## Boundary Rule
46
+
47
+ - Core safety/governance flow must remain unchanged.
48
+ - New domains only extend templates, ontology, and adapter implementations.
49
+ - Emergency bypass switches are not part of normal rollout policy.
@@ -0,0 +1,49 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "mode": "business-safe-assistant",
4
+ "length_policy": {
5
+ "min_chars": 12,
6
+ "max_chars": 1200,
7
+ "min_significant_tokens": 4
8
+ },
9
+ "deny_patterns": [
10
+ {
11
+ "id": "credential-exfiltration",
12
+ "pattern": "\\b(export|dump|reveal|show)\\b[^.\\n]{0,80}\\b(password|secret|token|credential)\\b",
13
+ "reason": "request attempts to expose credentials or secrets"
14
+ },
15
+ {
16
+ "id": "approval-bypass",
17
+ "pattern": "\\b(skip|bypass|disable)\\b[^.\\n]{0,80}\\b(approval|review|audit|permission)\\b",
18
+ "reason": "request attempts to bypass approval or governance flow"
19
+ },
20
+ {
21
+ "id": "destructive-without-guardrail",
22
+ "pattern": "\\b(delete|truncate|drop)\\b[^.\\n]{0,80}\\b(without backup|without approval|directly)\\b",
23
+ "reason": "destructive action request lacks required safety guardrails"
24
+ }
25
+ ],
26
+ "clarify_patterns": [
27
+ {
28
+ "id": "ambiguous-improve",
29
+ "pattern": "\\b(improve|optimize|fix)\\b",
30
+ "reason": "goal is improvement-oriented but missing measurable target"
31
+ },
32
+ {
33
+ "id": "vague-scope",
34
+ "pattern": "\\b(system|workflow|process)\\b[^.\\n]{0,50}\\b(all|overall|everything)\\b",
35
+ "reason": "goal scope is too broad and needs narrowing"
36
+ }
37
+ ],
38
+ "response_rules": [
39
+ "Use concise business language and avoid deep technical jargon.",
40
+ "Always restate objective, scope, and expected impact before recommendations.",
41
+ "When risk or permission is involved, explicitly list required approvals and authorization.",
42
+ "If requirement is ambiguous, ask at most two focused clarification questions.",
43
+ "Never propose credential export, approval bypass, or secret leakage."
44
+ ],
45
+ "clarification_templates": [
46
+ "What business metric should improve first (speed, accuracy, cost, compliance)?",
47
+ "Which module/page should be changed first, and what must remain unchanged?"
48
+ ]
49
+ }
@@ -0,0 +1,71 @@
1
+ # Domain_Pack Extension Flow
2
+
3
+ This document defines how to extend the interactive customization platform from Moqui to other industries without changing core security workflow.
4
+
5
+ ## Goal
6
+
7
+ - Reuse the same guardrail/approval/audit backbone.
8
+ - Add industry-specific knowledge through Domain_Pack assets only.
9
+ - Avoid runtime-specific forks in core policy flow.
10
+
11
+ ## Domain_Pack Asset Set
12
+
13
+ Each new domain should provide:
14
+
15
+ 1. Scene template package(s)
16
+ - `scene-package.json`
17
+ - `scene.template.yaml`
18
+ - `template.manifest.json`
19
+
20
+ 2. Ontology model
21
+ - domain entities
22
+ - relations
23
+ - business rules
24
+ - decision logic
25
+
26
+ 3. Adapter extension contract
27
+ - validated against:
28
+ - `docs/interactive-customization/adapter-extension-contract.schema.json`
29
+
30
+ 4. Governance profile
31
+ - risk baseline
32
+ - approval baseline
33
+ - blocked action baseline
34
+
35
+ ## Onboarding Steps
36
+
37
+ 1. Domain discovery
38
+ - Identify top business scenes and critical entities.
39
+
40
+ 2. Capability mapping
41
+ - Map domain capabilities to canonical capability names.
42
+ - Extend lexicon aliases if required.
43
+
44
+ 3. Template authoring
45
+ - Build scene-package templates with ontology + governance completeness.
46
+
47
+ 4. Adapter onboarding
48
+ - Implement adapter contract (`capabilities/plan/validate/apply/rollback`).
49
+
50
+ 5. Gate alignment
51
+ - Run interactive plan gate and ontology quality gate.
52
+
53
+ 6. Pilot rollout
54
+ - Start with suggestion mode and low-risk one-click apply only.
55
+
56
+ 7. Release and observability
57
+ - Track adoption/success/rollback/intercept metrics.
58
+
59
+ ## Non-Negotiable Constraints
60
+
61
+ - Core gate decisions remain `allow | review-required | deny`.
62
+ - High-risk actions cannot bypass approval.
63
+ - Execution and rollback records must be append-only auditable.
64
+ - Domain_Pack extension must not require bypass flags by default.
65
+
66
+ ## Recommended Evidence Output
67
+
68
+ - Domain capability matrix report.
69
+ - Ontology baseline report.
70
+ - Interactive execution ledger sample.
71
+ - Rollback trace sample.