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.
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/docs/agent-runtime/magicball-contract-index.md +25 -0
- package/docs/agent-runtime/magicball-status.schema.json +33 -0
- package/docs/agent-runtime/magicball-task-feedback.schema.json +79 -0
- package/docs/agent-runtime/magicball-timeline-view.schema.json +51 -0
- package/docs/command-reference.md +5 -0
- package/docs/magicball-capability-iteration-ui.md +2 -0
- package/docs/magicball-capability-library.md +2 -0
- package/docs/magicball-task-feedback-timeline-guide.md +14 -0
- package/lib/auto/session-metrics.js +53 -0
- package/lib/capability/catalog-service.js +248 -0
- package/lib/capability/inventory-service.js +100 -0
- package/lib/commands/auto.js +1 -1
- package/lib/commands/capability.js +81 -466
- package/lib/commands/scene.js +1 -1
- package/lib/commands/studio.js +147 -582
- package/lib/commands/timeline.js +6 -82
- package/lib/magicball/capability-inventory-view-model.js +213 -0
- package/lib/magicball/status-language.js +29 -0
- package/lib/magicball/task-feedback-model.js +113 -0
- package/lib/magicball/timeline-view-model.js +95 -0
- package/lib/scene/doctor-feedback.js +3541 -0
- package/lib/studio/task-envelope.js +269 -0
- package/lib/studio/task-intent.js +149 -0
- package/package.json +1 -1
|
@@ -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
|
+
};
|
package/lib/commands/auto.js
CHANGED