scene-capability-engine 3.6.28 → 3.6.32

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,100 @@
1
+ function normalizeText(value) {
2
+ if (typeof value !== 'string') {
3
+ return '';
4
+ }
5
+ return value.trim();
6
+ }
7
+
8
+ function normalizeBoolean(value, fallback = false) {
9
+ if (typeof value === 'boolean') {
10
+ return value;
11
+ }
12
+ const normalized = normalizeText(String(value || '')).toLowerCase();
13
+ if (!normalized) {
14
+ return fallback;
15
+ }
16
+ if (['1', 'true', 'yes', 'y', 'on'].includes(normalized)) {
17
+ return true;
18
+ }
19
+ if (['0', 'false', 'no', 'n', 'off'].includes(normalized)) {
20
+ return false;
21
+ }
22
+ return fallback;
23
+ }
24
+
25
+ function toPositiveInteger(value, fallback) {
26
+ const parsed = Number.parseInt(String(value), 10);
27
+ if (!Number.isFinite(parsed) || parsed <= 0) {
28
+ return fallback;
29
+ }
30
+ return parsed;
31
+ }
32
+
33
+ async function runCapabilityInventoryService(options = {}, dependencies = {}) {
34
+ const sceneIds = Array.isArray(dependencies.sceneIds) ? dependencies.sceneIds : [];
35
+ const limit = toPositiveInteger(options.limit, sceneIds.length || 20);
36
+ const scenes = [];
37
+
38
+ for (const sceneId of sceneIds.slice(0, limit)) {
39
+ const candidate = await dependencies.buildCandidatePayload(sceneId, {
40
+ specs: options.specs,
41
+ sample_limit: options.sample_limit
42
+ }, dependencies.runtime || {});
43
+ const score = dependencies.buildScoreFromCandidate(candidate);
44
+ const releaseReadiness = dependencies.buildCapabilityReleaseReadiness({
45
+ scene_id: sceneId,
46
+ ontology_scope: candidate.ontology_scope,
47
+ ontology_core: candidate.ontology_core
48
+ });
49
+ const sceneEntry = {
50
+ scene_id: sceneId,
51
+ summary: candidate.summary,
52
+ source: candidate.source,
53
+ ontology_scope: candidate.ontology_scope,
54
+ ontology_core: candidate.ontology_core,
55
+ ontology_core_ui: dependencies.buildOntologyCoreUiState(candidate.ontology_core),
56
+ release_readiness: releaseReadiness,
57
+ release_readiness_ui: dependencies.buildCapabilityReleaseReadinessUi(releaseReadiness),
58
+ score_preview: score
59
+ };
60
+ scenes.push({
61
+ ...sceneEntry,
62
+ ...dependencies.buildCapabilityInventorySceneAdvice(sceneEntry)
63
+ });
64
+ }
65
+
66
+ const filteredScenes = dependencies.sortCapabilityInventoryEntries(
67
+ dependencies.filterCapabilityInventoryEntries(scenes, options)
68
+ );
69
+ const summaryStats = dependencies.buildCapabilityInventorySummaryStats(filteredScenes);
70
+ const releaseReadyFilterRaw = normalizeText(options.releaseReady || options.release_ready).toLowerCase();
71
+
72
+ return {
73
+ mode: 'capability-inventory',
74
+ generated_at: new Date().toISOString(),
75
+ query: {
76
+ protocol_version: '1.0',
77
+ scene_id: normalizeText(options.scene || options.sceneId || options.scene_id) || null,
78
+ limit,
79
+ sample_limit: toPositiveInteger(options.sample_limit, 5),
80
+ filters: {
81
+ release_ready: releaseReadyFilterRaw ? ['1', 'true', 'yes', 'ready'].includes(releaseReadyFilterRaw) : null,
82
+ missing_triad: normalizeText(options.missingTriad || options.missing_triad) || null
83
+ }
84
+ },
85
+ scene_total: scenes.length,
86
+ scene_count: filteredScenes.length,
87
+ summary_stats: summaryStats,
88
+ summary_recommendations: dependencies.buildCapabilityInventorySummaryRecommendations(filteredScenes),
89
+ quick_filters: dependencies.buildCapabilityInventoryQuickFilters(summaryStats),
90
+ sort: {
91
+ strategy: 'publish_ready -> missing_triad_priority -> value_score_desc -> scene_id',
92
+ triad_priority: ['decision_strategy', 'business_rules', 'entity_relation']
93
+ },
94
+ scenes: filteredScenes
95
+ };
96
+ }
97
+
98
+ module.exports = {
99
+ runCapabilityInventoryService
100
+ };
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * Autonomous Control CLI Commands
3
3
  */
4
4