@gridlock/orchestrator 0.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/LICENSE +21 -0
- package/dist/AgentRoute.d.ts +44 -0
- package/dist/AgentRoute.d.ts.map +1 -0
- package/dist/AgentRoute.js +54 -0
- package/dist/AgentRoute.js.map +1 -0
- package/dist/CommandRegistry.d.ts +68 -0
- package/dist/CommandRegistry.d.ts.map +1 -0
- package/dist/CommandRegistry.js +87 -0
- package/dist/CommandRegistry.js.map +1 -0
- package/dist/ContextFactory.d.ts +62 -0
- package/dist/ContextFactory.d.ts.map +1 -0
- package/dist/ContextFactory.js +59 -0
- package/dist/ContextFactory.js.map +1 -0
- package/dist/DialogueGate.d.ts +117 -0
- package/dist/DialogueGate.d.ts.map +1 -0
- package/dist/DialogueGate.js +101 -0
- package/dist/DialogueGate.js.map +1 -0
- package/dist/DisclosureEngine.d.ts +160 -0
- package/dist/DisclosureEngine.d.ts.map +1 -0
- package/dist/DisclosureEngine.js +241 -0
- package/dist/DisclosureEngine.js.map +1 -0
- package/dist/EvidenceGraph.d.ts +71 -0
- package/dist/EvidenceGraph.d.ts.map +1 -0
- package/dist/EvidenceGraph.js +177 -0
- package/dist/EvidenceGraph.js.map +1 -0
- package/dist/InteractionEvaluator.d.ts +50 -0
- package/dist/InteractionEvaluator.d.ts.map +1 -0
- package/dist/InteractionEvaluator.js +205 -0
- package/dist/InteractionEvaluator.js.map +1 -0
- package/dist/KnowledgeBoundary.d.ts +74 -0
- package/dist/KnowledgeBoundary.d.ts.map +1 -0
- package/dist/KnowledgeBoundary.js +76 -0
- package/dist/KnowledgeBoundary.js.map +1 -0
- package/dist/evaluation/EscalationClock.d.ts +65 -0
- package/dist/evaluation/EscalationClock.d.ts.map +1 -0
- package/dist/evaluation/EscalationClock.js +106 -0
- package/dist/evaluation/EscalationClock.js.map +1 -0
- package/dist/evaluation/PerformanceEvaluator.d.ts +54 -0
- package/dist/evaluation/PerformanceEvaluator.d.ts.map +1 -0
- package/dist/evaluation/PerformanceEvaluator.js +161 -0
- package/dist/evaluation/PerformanceEvaluator.js.map +1 -0
- package/dist/evaluation/WorldState.d.ts +30 -0
- package/dist/evaluation/WorldState.d.ts.map +1 -0
- package/dist/evaluation/WorldState.js +43 -0
- package/dist/evaluation/WorldState.js.map +1 -0
- package/dist/evaluation/index.d.ts +8 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/evaluation/index.js +4 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/evaluation/types.d.ts +26 -0
- package/dist/evaluation/types.d.ts.map +1 -0
- package/dist/evaluation/types.js +9 -0
- package/dist/evaluation/types.js.map +1 -0
- package/dist/handlers/AssistantCommandRegistry.d.ts +55 -0
- package/dist/handlers/AssistantCommandRegistry.d.ts.map +1 -0
- package/dist/handlers/AssistantCommandRegistry.js +59 -0
- package/dist/handlers/AssistantCommandRegistry.js.map +1 -0
- package/dist/handlers/EvidenceIngestion.d.ts +64 -0
- package/dist/handlers/EvidenceIngestion.d.ts.map +1 -0
- package/dist/handlers/EvidenceIngestion.js +114 -0
- package/dist/handlers/EvidenceIngestion.js.map +1 -0
- package/dist/handlers/GameLifecycle.d.ts +71 -0
- package/dist/handlers/GameLifecycle.d.ts.map +1 -0
- package/dist/handlers/GameLifecycle.js +100 -0
- package/dist/handlers/GameLifecycle.js.map +1 -0
- package/dist/handlers/GraphPopulation.d.ts +24 -0
- package/dist/handlers/GraphPopulation.d.ts.map +1 -0
- package/dist/handlers/GraphPopulation.js +21 -0
- package/dist/handlers/GraphPopulation.js.map +1 -0
- package/dist/handlers/ResolutionGate.d.ts +60 -0
- package/dist/handlers/ResolutionGate.d.ts.map +1 -0
- package/dist/handlers/ResolutionGate.js +49 -0
- package/dist/handlers/ResolutionGate.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/investigation/Analyst.d.ts +80 -0
- package/dist/investigation/Analyst.d.ts.map +1 -0
- package/dist/investigation/Analyst.js +514 -0
- package/dist/investigation/Analyst.js.map +1 -0
- package/dist/investigation/AnalystWorkspace.d.ts +182 -0
- package/dist/investigation/AnalystWorkspace.d.ts.map +1 -0
- package/dist/investigation/AnalystWorkspace.js +405 -0
- package/dist/investigation/AnalystWorkspace.js.map +1 -0
- package/dist/investigation/CaseFile.d.ts +92 -0
- package/dist/investigation/CaseFile.d.ts.map +1 -0
- package/dist/investigation/CaseFile.js +117 -0
- package/dist/investigation/CaseFile.js.map +1 -0
- package/dist/investigation/DiscoveryLayer.d.ts +133 -0
- package/dist/investigation/DiscoveryLayer.d.ts.map +1 -0
- package/dist/investigation/DiscoveryLayer.js +176 -0
- package/dist/investigation/DiscoveryLayer.js.map +1 -0
- package/dist/investigation/FactLedger.d.ts +91 -0
- package/dist/investigation/FactLedger.d.ts.map +1 -0
- package/dist/investigation/FactLedger.js +185 -0
- package/dist/investigation/FactLedger.js.map +1 -0
- package/dist/investigation/InvestigationTimeline.d.ts +98 -0
- package/dist/investigation/InvestigationTimeline.d.ts.map +1 -0
- package/dist/investigation/InvestigationTimeline.js +178 -0
- package/dist/investigation/InvestigationTimeline.js.map +1 -0
- package/dist/investigation/ProfileEngine.d.ts +84 -0
- package/dist/investigation/ProfileEngine.d.ts.map +1 -0
- package/dist/investigation/ProfileEngine.js +170 -0
- package/dist/investigation/ProfileEngine.js.map +1 -0
- package/dist/investigation/WorkspaceProjections.d.ts +94 -0
- package/dist/investigation/WorkspaceProjections.d.ts.map +1 -0
- package/dist/investigation/WorkspaceProjections.js +92 -0
- package/dist/investigation/WorkspaceProjections.js.map +1 -0
- package/dist/investigation/index.d.ts +18 -0
- package/dist/investigation/index.d.ts.map +1 -0
- package/dist/investigation/index.js +10 -0
- package/dist/investigation/index.js.map +1 -0
- package/dist/investigation/types.d.ts +206 -0
- package/dist/investigation/types.d.ts.map +1 -0
- package/dist/investigation/types.js +20 -0
- package/dist/investigation/types.js.map +1 -0
- package/dist/types.d.ts +283 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +70 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation Layer — Performance Evaluator
|
|
3
|
+
*
|
|
4
|
+
* Generic post-game scoring engine. Engine-level primitive.
|
|
5
|
+
*
|
|
6
|
+
* Core-Configure pattern:
|
|
7
|
+
* - Engine provides: configurable phase scorers, weighted scoring, grade derivation
|
|
8
|
+
* - Product provides: phase definitions, scoring functions, weights, note language
|
|
9
|
+
*
|
|
10
|
+
* Deterministic: same actions → same score.
|
|
11
|
+
* Does not modify state, produce findings, or interact with the AI Assistant.
|
|
12
|
+
*/
|
|
13
|
+
import type { PerformanceReport, PerformanceGrade, PhaseScore } from './types.js';
|
|
14
|
+
/** A single scoring phase with its weight and scorer function. */
|
|
15
|
+
export interface PhaseScorerDefinition {
|
|
16
|
+
/** Phase name (used as key in report). */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Weight for overall score calculation (all weights should sum to 1.0). */
|
|
19
|
+
weight: number;
|
|
20
|
+
/** Scoring function — receives the game view and outcome, returns a PhaseScore. */
|
|
21
|
+
scorer: (view: EvaluationGameView, outcome: 'correct' | 'incorrect' | 'incomplete') => PhaseScore;
|
|
22
|
+
}
|
|
23
|
+
/** Full evaluation configuration. */
|
|
24
|
+
export interface EvaluationConfig {
|
|
25
|
+
phases: PhaseScorerDefinition[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Minimal read-only interface the evaluator needs from GameState.
|
|
29
|
+
*/
|
|
30
|
+
export interface EvaluationGameView {
|
|
31
|
+
caseId: string;
|
|
32
|
+
examinedArtifactCount: number;
|
|
33
|
+
unlockedArtifactCount: number;
|
|
34
|
+
talkedCharacterCount: number;
|
|
35
|
+
unlockedCharacterCount: number;
|
|
36
|
+
findingsCount: number;
|
|
37
|
+
totalValidators: number;
|
|
38
|
+
contradictionGroupCount: number;
|
|
39
|
+
factLedgerSize: number;
|
|
40
|
+
accusedCorrectly: boolean;
|
|
41
|
+
accusedWithEvidence: boolean;
|
|
42
|
+
accusationMade: boolean;
|
|
43
|
+
clockCurrent?: number;
|
|
44
|
+
clockMax?: number;
|
|
45
|
+
}
|
|
46
|
+
/** TIC's default evaluation config — Intelligence Cycle phases. */
|
|
47
|
+
export declare const TIC_EVALUATION_CONFIG: EvaluationConfig;
|
|
48
|
+
/**
|
|
49
|
+
* Generate a performance report from game state after case conclusion.
|
|
50
|
+
* Accepts optional config; defaults to TIC's Intelligence Cycle phases.
|
|
51
|
+
*/
|
|
52
|
+
export declare function generatePerformanceReport(view: EvaluationGameView, outcome: 'correct' | 'incorrect' | 'incomplete', config?: EvaluationConfig): PerformanceReport;
|
|
53
|
+
export declare function deriveGrade(score: number): PerformanceGrade;
|
|
54
|
+
//# sourceMappingURL=PerformanceEvaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PerformanceEvaluator.d.ts","sourceRoot":"","sources":["../../src/evaluation/PerformanceEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAMlF,kEAAkE;AAClE,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,MAAM,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,KAAK,UAAU,CAAC;CACnG;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IAEf,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sBAAsB,EAAE,MAAM,CAAC;IAE/B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IAEvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC;IAExB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,EAAE,gBAOnC,CAAC;AAMF;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,EAC/C,MAAM,GAAE,gBAAwC,GAC/C,iBAAiB,CAmBnB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAI3D"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation Layer — Performance Evaluator
|
|
3
|
+
*
|
|
4
|
+
* Generic post-game scoring engine. Engine-level primitive.
|
|
5
|
+
*
|
|
6
|
+
* Core-Configure pattern:
|
|
7
|
+
* - Engine provides: configurable phase scorers, weighted scoring, grade derivation
|
|
8
|
+
* - Product provides: phase definitions, scoring functions, weights, note language
|
|
9
|
+
*
|
|
10
|
+
* Deterministic: same actions → same score.
|
|
11
|
+
* Does not modify state, produce findings, or interact with the AI Assistant.
|
|
12
|
+
*/
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// TIC default configuration
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
/** TIC's default evaluation config — Intelligence Cycle phases. */
|
|
17
|
+
export const TIC_EVALUATION_CONFIG = {
|
|
18
|
+
phases: [
|
|
19
|
+
{ name: 'direction', weight: 0.15, scorer: scoreDirection },
|
|
20
|
+
{ name: 'collection', weight: 0.30, scorer: scoreCollection },
|
|
21
|
+
{ name: 'analysis', weight: 0.30, scorer: scoreAnalysis },
|
|
22
|
+
{ name: 'dissemination', weight: 0.25, scorer: scoreDissemination },
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Public API
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
/**
|
|
29
|
+
* Generate a performance report from game state after case conclusion.
|
|
30
|
+
* Accepts optional config; defaults to TIC's Intelligence Cycle phases.
|
|
31
|
+
*/
|
|
32
|
+
export function generatePerformanceReport(view, outcome, config = TIC_EVALUATION_CONFIG) {
|
|
33
|
+
const phases = {};
|
|
34
|
+
for (const def of config.phases) {
|
|
35
|
+
phases[def.name] = def.scorer(view, outcome);
|
|
36
|
+
}
|
|
37
|
+
const overallScore = Math.round(config.phases.reduce((sum, def) => sum + phases[def.name].score * def.weight, 0));
|
|
38
|
+
return {
|
|
39
|
+
caseId: view.caseId,
|
|
40
|
+
outcome,
|
|
41
|
+
overallScore,
|
|
42
|
+
overallGrade: deriveGrade(overallScore),
|
|
43
|
+
phases,
|
|
44
|
+
timestamp: new Date().toISOString(),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function deriveGrade(score) {
|
|
48
|
+
if (score >= 70)
|
|
49
|
+
return 'stable';
|
|
50
|
+
if (score >= 40)
|
|
51
|
+
return 'unstable';
|
|
52
|
+
return 'critical';
|
|
53
|
+
}
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Phase scoring functions
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
function scoreDirection(view) {
|
|
58
|
+
const notes = [];
|
|
59
|
+
let score = 50; // baseline — briefing was shown
|
|
60
|
+
// Did the player engage with the case at all?
|
|
61
|
+
if (view.talkedCharacterCount > 0) {
|
|
62
|
+
score += 25;
|
|
63
|
+
notes.push('Contacts engaged');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
notes.push('No contacts interviewed');
|
|
67
|
+
}
|
|
68
|
+
if (view.examinedArtifactCount > 0) {
|
|
69
|
+
score += 25;
|
|
70
|
+
notes.push('Evidence examined');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
notes.push('No evidence examined');
|
|
74
|
+
}
|
|
75
|
+
// Time efficiency bonus/penalty
|
|
76
|
+
if (view.clockCurrent != null && view.clockMax != null && view.clockMax > 0) {
|
|
77
|
+
const timeRatio = view.clockCurrent / view.clockMax;
|
|
78
|
+
if (timeRatio <= 0.7) {
|
|
79
|
+
score += 10;
|
|
80
|
+
notes.push('Completed within operational timeframe');
|
|
81
|
+
}
|
|
82
|
+
else if (timeRatio > 1.0) {
|
|
83
|
+
score -= 15;
|
|
84
|
+
notes.push('Operation exceeded time allocation');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return { score: Math.max(0, Math.min(100, score)), notes };
|
|
88
|
+
}
|
|
89
|
+
function scoreCollection(view) {
|
|
90
|
+
const notes = [];
|
|
91
|
+
// Artifact coverage
|
|
92
|
+
const artifactRatio = view.unlockedArtifactCount > 0
|
|
93
|
+
? view.examinedArtifactCount / view.unlockedArtifactCount
|
|
94
|
+
: 0;
|
|
95
|
+
// Character coverage
|
|
96
|
+
const characterRatio = view.unlockedCharacterCount > 0
|
|
97
|
+
? view.talkedCharacterCount / view.unlockedCharacterCount
|
|
98
|
+
: 0;
|
|
99
|
+
const score = Math.round(((artifactRatio + characterRatio) / 2) * 100);
|
|
100
|
+
if (artifactRatio >= 1.0) {
|
|
101
|
+
notes.push('All available evidence examined');
|
|
102
|
+
}
|
|
103
|
+
else if (artifactRatio >= 0.5) {
|
|
104
|
+
notes.push(`${view.examinedArtifactCount}/${view.unlockedArtifactCount} artifacts examined`);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
notes.push('Significant evidence gaps — many artifacts unexamined');
|
|
108
|
+
}
|
|
109
|
+
if (characterRatio >= 1.0) {
|
|
110
|
+
notes.push('All available contacts interviewed');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
notes.push(`${view.talkedCharacterCount}/${view.unlockedCharacterCount} contacts interviewed`);
|
|
114
|
+
}
|
|
115
|
+
return { score, notes };
|
|
116
|
+
}
|
|
117
|
+
function scoreAnalysis(view) {
|
|
118
|
+
const notes = [];
|
|
119
|
+
// Validator coverage
|
|
120
|
+
const validatorRatio = view.totalValidators > 0
|
|
121
|
+
? view.findingsCount / view.totalValidators
|
|
122
|
+
: 0;
|
|
123
|
+
let score = Math.round(validatorRatio * 70); // up to 70 from findings
|
|
124
|
+
// Bonus for contradiction grouping depth
|
|
125
|
+
if (view.contradictionGroupCount > 0) {
|
|
126
|
+
score += 15;
|
|
127
|
+
notes.push(`${view.contradictionGroupCount} contradiction cluster(s) identified`);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
notes.push('No contradictions identified');
|
|
131
|
+
}
|
|
132
|
+
// Bonus for fact ledger depth
|
|
133
|
+
if (view.factLedgerSize >= 3) {
|
|
134
|
+
score += 15;
|
|
135
|
+
notes.push('Comprehensive fact collection');
|
|
136
|
+
}
|
|
137
|
+
else if (view.factLedgerSize > 0) {
|
|
138
|
+
score += 5;
|
|
139
|
+
notes.push('Limited fact collection');
|
|
140
|
+
}
|
|
141
|
+
return { score: Math.min(100, score), notes };
|
|
142
|
+
}
|
|
143
|
+
function scoreDissemination(view, outcome) {
|
|
144
|
+
const notes = [];
|
|
145
|
+
if (outcome === 'correct') {
|
|
146
|
+
if (view.accusedWithEvidence) {
|
|
147
|
+
notes.push('Correct accusation supported by evidence');
|
|
148
|
+
return { score: 100, notes };
|
|
149
|
+
}
|
|
150
|
+
notes.push('Correct suspect identified but evidence insufficient');
|
|
151
|
+
return { score: 60, notes };
|
|
152
|
+
}
|
|
153
|
+
if (outcome === 'incorrect') {
|
|
154
|
+
notes.push('Incorrect accusation — wrong suspect identified');
|
|
155
|
+
return { score: 10, notes };
|
|
156
|
+
}
|
|
157
|
+
// incomplete
|
|
158
|
+
notes.push('Investigation abandoned without conclusion');
|
|
159
|
+
return { score: 0, notes };
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=PerformanceEvaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PerformanceEvaluator.js","sourceRoot":"","sources":["../../src/evaluation/PerformanceEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA+CH,8EAA8E;AAC9E,4BAA4B;AAC5B,8EAA8E;AAE9E,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE;QAC3D,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE;QAC7D,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE;QACzD,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE;KACpE;CACF,CAAC;AAEF,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,IAAwB,EACxB,OAA+C,EAC/C,SAA2B,qBAAqB;IAEhD,MAAM,MAAM,GAA+B,EAAE,CAAC;IAE9C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,MA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es to the next case's starting conditions.
|
|
6
|
+
*
|
|
7
|
+
* Uses existing mechanics only:
|
|
8
|
+
* - unlock_threshold adjustments
|
|
9
|
+
* - initial access reduction
|
|
10
|
+
* - misleading clue bias
|
|
11
|
+
*
|
|
12
|
+
* Does not introduce new subsystems, randomness, or dynamic narrative.
|
|
13
|
+
*/
|
|
14
|
+
import type { PerformanceGrade } from './types.js';
|
|
15
|
+
export interface WorldStateModifiers {
|
|
16
|
+
/** Grade that produced these modifiers. */
|
|
17
|
+
sourceGrade: PerformanceGrade;
|
|
18
|
+
/** Added to all unlock_threshold values. Clamped to [0, 10]. */
|
|
19
|
+
unlockThresholdDelta: number;
|
|
20
|
+
/** If true, reduce initial access by removing one starting entity. */
|
|
21
|
+
reduceInitialAccess: boolean;
|
|
22
|
+
/** If true, misleading clues should be prioritized in unlock order. */
|
|
23
|
+
increaseMisleadingClues: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Compute world-state modifiers from a performance grade.
|
|
27
|
+
* Deterministic: same grade always produces same modifiers.
|
|
28
|
+
*/
|
|
29
|
+
export declare function computeModifiers(grade: PerformanceGrade): WorldStateModifiers;
|
|
30
|
+
//# sourceMappingURL=WorldState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorldState.d.ts","sourceRoot":"","sources":["../../src/evaluation/WorldState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,WAAW,EAAE,gBAAgB,CAAC;IAE9B,gEAAgE;IAChE,oBAAoB,EAAE,MAAM,CAAC;IAE7B,sEAAsE;IACtE,mBAAmB,EAAE,OAAO,CAAC;IAE7B,uEAAuE;IACvE,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,mBAAmB,CAwB7E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation Layer — World-State Modifiers
|
|
3
|
+
*
|
|
4
|
+
* Translates post-case performance grades into simple, deterministic
|
|
5
|
+
* changes to the next case's starting conditions.
|
|
6
|
+
*
|
|
7
|
+
* Uses existing mechanics only:
|
|
8
|
+
* - unlock_threshold adjustments
|
|
9
|
+
* - initial access reduction
|
|
10
|
+
* - misleading clue bias
|
|
11
|
+
*
|
|
12
|
+
* Does not introduce new subsystems, randomness, or dynamic narrative.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Compute world-state modifiers from a performance grade.
|
|
16
|
+
* Deterministic: same grade always produces same modifiers.
|
|
17
|
+
*/
|
|
18
|
+
export function computeModifiers(grade) {
|
|
19
|
+
switch (grade) {
|
|
20
|
+
case 'stable':
|
|
21
|
+
return {
|
|
22
|
+
sourceGrade: 'stable',
|
|
23
|
+
unlockThresholdDelta: 0,
|
|
24
|
+
reduceInitialAccess: false,
|
|
25
|
+
increaseMisleadingClues: false,
|
|
26
|
+
};
|
|
27
|
+
case 'unstable':
|
|
28
|
+
return {
|
|
29
|
+
sourceGrade: 'unstable',
|
|
30
|
+
unlockThresholdDelta: 1,
|
|
31
|
+
reduceInitialAccess: false,
|
|
32
|
+
increaseMisleadingClues: true,
|
|
33
|
+
};
|
|
34
|
+
case 'critical':
|
|
35
|
+
return {
|
|
36
|
+
sourceGrade: 'critical',
|
|
37
|
+
unlockThresholdDelta: 2,
|
|
38
|
+
reduceInitialAccess: true,
|
|
39
|
+
increaseMisleadingClues: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=WorldState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorldState.js","sourceRoot":"","sources":["../../src/evaluation/WorldState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkBH;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAuB;IACtD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,QAAQ;YACX,OAAO;gBACL,WAAW,EAAE,QAAQ;gBACrB,oBAAoB,EAAE,CAAC;gBACvB,mBAAmB,EAAE,KAAK;gBAC1B,uBAAuB,EAAE,KAAK;aAC/B,CAAC;QACJ,KAAK,UAAU;YACb,OAAO;gBACL,WAAW,EAAE,UAAU;gBACvB,oBAAoB,EAAE,CAAC;gBACvB,mBAAmB,EAAE,KAAK;gBAC1B,uBAAuB,EAAE,IAAI;aAC9B,CAAC;QACJ,KAAK,UAAU;YACb,OAAO;gBACL,WAAW,EAAE,UAAU;gBACvB,oBAAoB,EAAE,CAAC;gBACvB,mBAAmB,EAAE,IAAI;gBACzB,uBAAuB,EAAE,IAAI;aAC9B,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { generatePerformanceReport, deriveGrade, TIC_EVALUATION_CONFIG } from './PerformanceEvaluator.js';
|
|
2
|
+
export type { EvaluationGameView, EvaluationConfig, PhaseScorerDefinition } from './PerformanceEvaluator.js';
|
|
3
|
+
export type { PerformanceReport, PerformanceGrade, PhaseScore } from './types.js';
|
|
4
|
+
export { computeModifiers } from './WorldState.js';
|
|
5
|
+
export type { WorldStateModifiers } from './WorldState.js';
|
|
6
|
+
export { createClock, getActionCost, advanceClock, getClockStatusLabel, isOverrun, TIC_CLOCK_CONFIG } from './EscalationClock.js';
|
|
7
|
+
export type { GameClock, EscalationPhase, ClockConfig, PhaseDefinition } from './EscalationClock.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evaluation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC1G,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC7G,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClI,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { generatePerformanceReport, deriveGrade, TIC_EVALUATION_CONFIG } from './PerformanceEvaluator.js';
|
|
2
|
+
export { computeModifiers } from './WorldState.js';
|
|
3
|
+
export { createClock, getActionCost, advanceClock, getClockStatusLabel, isOverrun, TIC_CLOCK_CONFIG } from './EscalationClock.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/evaluation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation Layer — Types
|
|
3
|
+
*
|
|
4
|
+
* Post-case performance evaluation. Sits above the orchestrator,
|
|
5
|
+
* consumes GameState read-only. Does not modify state, produce
|
|
6
|
+
* findings, or interact with SAGE directly.
|
|
7
|
+
*/
|
|
8
|
+
export interface PhaseScore {
|
|
9
|
+
score: number;
|
|
10
|
+
notes: string[];
|
|
11
|
+
}
|
|
12
|
+
export type PerformanceGrade = 'stable' | 'unstable' | 'critical';
|
|
13
|
+
export interface PerformanceReport {
|
|
14
|
+
caseId: string;
|
|
15
|
+
outcome: 'correct' | 'incorrect' | 'incomplete';
|
|
16
|
+
overallScore: number;
|
|
17
|
+
overallGrade: PerformanceGrade;
|
|
18
|
+
/**
|
|
19
|
+
* Phase scores keyed by phase name.
|
|
20
|
+
* TIC uses Intelligence Cycle phases: direction, collection, analysis, dissemination.
|
|
21
|
+
* Other products can define different scoring dimensions.
|
|
22
|
+
*/
|
|
23
|
+
phases: Record<string, PhaseScore>;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/evaluation/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAElE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,gBAAgB,CAAC;IAC/B;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation Layer — Types
|
|
3
|
+
*
|
|
4
|
+
* Post-case performance evaluation. Sits above the orchestrator,
|
|
5
|
+
* consumes GameState read-only. Does not modify state, produce
|
|
6
|
+
* findings, or interact with SAGE directly.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/evaluation/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AssistantCommandRegistry — generic AI Assistant command plugin system (#711).
|
|
3
|
+
*
|
|
4
|
+
* Engine-level: provides extensible command routing for any AI assistant.
|
|
5
|
+
* Products register domain-specific commands and aliases at startup.
|
|
6
|
+
*
|
|
7
|
+
* TIC's SAGE is a configured instance that registers investigative commands
|
|
8
|
+
* (suspect, prepare, contradictions, etc.) on top of the engine's generic
|
|
9
|
+
* analytical commands (status, evidence, analyze, etc.).
|
|
10
|
+
*/
|
|
11
|
+
/** Command tier: engine-provided or product-registered. */
|
|
12
|
+
export type CommandTier = 'core' | 'product';
|
|
13
|
+
/** A registered command definition. */
|
|
14
|
+
export interface AssistantCommand<TCtx = unknown> {
|
|
15
|
+
/** The canonical command name. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Engine-core or product-specific. */
|
|
18
|
+
tier: CommandTier;
|
|
19
|
+
/** Short description for help listings. */
|
|
20
|
+
description: string;
|
|
21
|
+
/** The handler function. Receives context + remaining args, returns output string. */
|
|
22
|
+
handler: (ctx: TCtx, args: string[]) => string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extensible command registry for AI assistant primitives.
|
|
26
|
+
*
|
|
27
|
+
* Usage:
|
|
28
|
+
* const registry = new AssistantCommandRegistry<SageContext>();
|
|
29
|
+
* registry.register({ name: 'status', tier: 'core', description: '...', handler: statusHandler });
|
|
30
|
+
* registry.alias('info', 'status'); // TIC alias
|
|
31
|
+
* const output = registry.handle(ctx, ['status']);
|
|
32
|
+
*/
|
|
33
|
+
export declare class AssistantCommandRegistry<TCtx = unknown> {
|
|
34
|
+
private readonly commands;
|
|
35
|
+
private readonly aliases;
|
|
36
|
+
/** Register a command. Overwrites if name already exists. */
|
|
37
|
+
register(command: AssistantCommand<TCtx>): void;
|
|
38
|
+
/** Create an alias that maps to an existing command. */
|
|
39
|
+
alias(aliasName: string, targetName: string): void;
|
|
40
|
+
/** Resolve a name (following aliases) to a command. Case-insensitive. */
|
|
41
|
+
resolve(name: string): AssistantCommand<TCtx> | undefined;
|
|
42
|
+
/** Check whether a command or alias is registered. Case-insensitive. */
|
|
43
|
+
has(name: string): boolean;
|
|
44
|
+
/** Route a command invocation through the registry. Returns undefined if not found. */
|
|
45
|
+
handle(ctx: TCtx, args: string[]): string | undefined;
|
|
46
|
+
/** List all registered command names (not aliases). */
|
|
47
|
+
commandNames(): string[];
|
|
48
|
+
/** List all aliases as [alias, target] pairs. */
|
|
49
|
+
aliasList(): Array<[string, string]>;
|
|
50
|
+
/** List commands filtered by tier. */
|
|
51
|
+
commandsByTier(tier: CommandTier): AssistantCommand<TCtx>[];
|
|
52
|
+
/** Number of registered commands (not counting aliases). */
|
|
53
|
+
get size(): number;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=AssistantCommandRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssistantCommandRegistry.d.ts","sourceRoot":"","sources":["../../src/handlers/AssistantCommandRegistry.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,2DAA2D;AAC3D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,uCAAuC;AACvC,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,OAAO;IAC9C,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,sFAAsF;IACtF,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;CAChD;AAED;;;;;;;;GAQG;AACH,qBAAa,wBAAwB,CAAC,IAAI,GAAG,OAAO;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6C;IACtE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IAErD,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;IAI/C,wDAAwD;IACxD,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAIlD,yEAAyE;IACzE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,SAAS;IAMzD,wEAAwE;IACxE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,uFAAuF;IACvF,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS;IAOrD,uDAAuD;IACvD,YAAY,IAAI,MAAM,EAAE;IAIxB,iDAAiD;IACjD,SAAS,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIpC,sCAAsC;IACtC,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,EAAE;IAI3D,4DAA4D;IAC5D,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @engine — Generic AI assistant command plugin system. Products register domain-specific
|
|
2
|
+
// commands and aliases. No TIC vocabulary — fully reusable.
|
|
3
|
+
/**
|
|
4
|
+
* Extensible command registry for AI assistant primitives.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* const registry = new AssistantCommandRegistry<SageContext>();
|
|
8
|
+
* registry.register({ name: 'status', tier: 'core', description: '...', handler: statusHandler });
|
|
9
|
+
* registry.alias('info', 'status'); // TIC alias
|
|
10
|
+
* const output = registry.handle(ctx, ['status']);
|
|
11
|
+
*/
|
|
12
|
+
export class AssistantCommandRegistry {
|
|
13
|
+
commands = new Map();
|
|
14
|
+
aliases = new Map();
|
|
15
|
+
/** Register a command. Overwrites if name already exists. */
|
|
16
|
+
register(command) {
|
|
17
|
+
this.commands.set(command.name, command);
|
|
18
|
+
}
|
|
19
|
+
/** Create an alias that maps to an existing command. */
|
|
20
|
+
alias(aliasName, targetName) {
|
|
21
|
+
this.aliases.set(aliasName, targetName);
|
|
22
|
+
}
|
|
23
|
+
/** Resolve a name (following aliases) to a command. Case-insensitive. */
|
|
24
|
+
resolve(name) {
|
|
25
|
+
const lower = name.toLowerCase();
|
|
26
|
+
const canonical = this.aliases.get(lower) ?? lower;
|
|
27
|
+
return this.commands.get(canonical);
|
|
28
|
+
}
|
|
29
|
+
/** Check whether a command or alias is registered. Case-insensitive. */
|
|
30
|
+
has(name) {
|
|
31
|
+
return this.resolve(name) !== undefined;
|
|
32
|
+
}
|
|
33
|
+
/** Route a command invocation through the registry. Returns undefined if not found. */
|
|
34
|
+
handle(ctx, args) {
|
|
35
|
+
if (args.length === 0)
|
|
36
|
+
return undefined;
|
|
37
|
+
const command = this.resolve(args[0]);
|
|
38
|
+
if (!command)
|
|
39
|
+
return undefined;
|
|
40
|
+
return command.handler(ctx, args.slice(1));
|
|
41
|
+
}
|
|
42
|
+
/** List all registered command names (not aliases). */
|
|
43
|
+
commandNames() {
|
|
44
|
+
return Array.from(this.commands.keys());
|
|
45
|
+
}
|
|
46
|
+
/** List all aliases as [alias, target] pairs. */
|
|
47
|
+
aliasList() {
|
|
48
|
+
return Array.from(this.aliases.entries());
|
|
49
|
+
}
|
|
50
|
+
/** List commands filtered by tier. */
|
|
51
|
+
commandsByTier(tier) {
|
|
52
|
+
return Array.from(this.commands.values()).filter(c => c.tier === tier);
|
|
53
|
+
}
|
|
54
|
+
/** Number of registered commands (not counting aliases). */
|
|
55
|
+
get size() {
|
|
56
|
+
return this.commands.size;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=AssistantCommandRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssistantCommandRegistry.js","sourceRoot":"","sources":["../../src/handlers/AssistantCommandRegistry.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,4DAA4D;AA4B5D;;;;;;;;GAQG;AACH,MAAM,OAAO,wBAAwB;IAClB,QAAQ,GAAG,IAAI,GAAG,EAAkC,CAAC;IACrD,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAErD,6DAA6D;IAC7D,QAAQ,CAAC,OAA+B;QACtC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,wDAAwD;IACxD,KAAK,CAAC,SAAiB,EAAE,UAAkB;QACzC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;IAED,yEAAyE;IACzE,OAAO,CAAC,IAAY;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;QACnD,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,wEAAwE;IACxE,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;IAC1C,CAAC;IAED,uFAAuF;IACvF,MAAM,CAAC,GAAS,EAAE,IAAc;QAC9B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,uDAAuD;IACvD,YAAY;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,iDAAiD;IACjD,SAAS;QACP,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,sCAAsC;IACtC,cAAc,CAAC,IAAiB;QAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACzE,CAAC;IAED,4DAA4D;IAC5D,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence Ingestion — engine-generic finding ingestion and source type registry.
|
|
3
|
+
*
|
|
4
|
+
* The SourceTypeRegistry is extensible: products register additional source
|
|
5
|
+
* types with default status/confidence mappings at startup. The
|
|
6
|
+
* `ingestFinding` function operates purely on FactLedger + Finding —
|
|
7
|
+
* it does not navigate the scenario shape, so it is engine-generic.
|
|
8
|
+
*
|
|
9
|
+
* Scenario-shape-dependent ingestion functions (e.g. TIC's
|
|
10
|
+
* `ingestArtifactFacts`, `ingestDialogueFacts`) stay in the product
|
|
11
|
+
* layer because they traverse product-specific content pack fields.
|
|
12
|
+
*
|
|
13
|
+
* MS-28 #887 — Phase 1.2 — Orchestrator migration step 5.8.
|
|
14
|
+
*/
|
|
15
|
+
import type { Finding } from '@gridlock/validators';
|
|
16
|
+
import type { FactSourceType, FactStatus, FactConfidence } from '../investigation/index.js';
|
|
17
|
+
import type { FactLedger } from '../investigation/FactLedger.js';
|
|
18
|
+
/** Default status and confidence for a registered source type. */
|
|
19
|
+
export interface SourceTypeDefaults {
|
|
20
|
+
/** Default status for records from this source type. */
|
|
21
|
+
status: FactStatus;
|
|
22
|
+
/** Default confidence for records from this source type. */
|
|
23
|
+
confidence: FactConfidence;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Source Type Registry — extensible registration of fact source types.
|
|
27
|
+
*
|
|
28
|
+
* Engine ships with well-known source types (artifact, dialogue, validator).
|
|
29
|
+
* Product layers register additional source types with their default
|
|
30
|
+
* status/confidence mappings.
|
|
31
|
+
*/
|
|
32
|
+
export declare class SourceTypeRegistry {
|
|
33
|
+
private types;
|
|
34
|
+
constructor();
|
|
35
|
+
/** Register a source type with its default status and confidence. */
|
|
36
|
+
register(sourceType: FactSourceType, defaults: SourceTypeDefaults): void;
|
|
37
|
+
/** Get defaults for a registered source type, or undefined if not registered. */
|
|
38
|
+
getDefaults(sourceType: FactSourceType): SourceTypeDefaults | undefined;
|
|
39
|
+
/** Check whether a source type is registered. */
|
|
40
|
+
isRegistered(sourceType: FactSourceType): boolean;
|
|
41
|
+
/** Get all registered source type names. */
|
|
42
|
+
getRegisteredTypes(): FactSourceType[];
|
|
43
|
+
}
|
|
44
|
+
/** Shared singleton registry — product layers can register types at startup. */
|
|
45
|
+
export declare const sourceTypeRegistry: SourceTypeRegistry;
|
|
46
|
+
/** Discovery context passed from entity interaction handlers. */
|
|
47
|
+
export interface IngestionContext {
|
|
48
|
+
command: string;
|
|
49
|
+
turnNumber: number;
|
|
50
|
+
phase: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Ingest a validator finding into the Fact Ledger.
|
|
54
|
+
*
|
|
55
|
+
* Creates a FactRecord for the finding itself and marks
|
|
56
|
+
* related existing records as 'contradicted' when the finding
|
|
57
|
+
* is a contradiction. Also performs corroboration: support findings
|
|
58
|
+
* upgrade related claims from low to medium confidence.
|
|
59
|
+
*
|
|
60
|
+
* This function operates purely on FactLedger + Finding — it does
|
|
61
|
+
* not navigate the scenario shape, making it engine-generic.
|
|
62
|
+
*/
|
|
63
|
+
export declare function ingestFinding(factLedger: FactLedger, finding: Finding, ctx?: IngestionContext): void;
|
|
64
|
+
//# sourceMappingURL=EvidenceIngestion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EvidenceIngestion.d.ts","sourceRoot":"","sources":["../../src/handlers/EvidenceIngestion.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,sBAAsB,CAAC;AAE/D,OAAO,KAAK,EAAc,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAExG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAMjE,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,MAAM,EAAE,UAAU,CAAC;IACnB,4DAA4D;IAC5D,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,KAAK,CAAiD;;IAY9D,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAIxE,iFAAiF;IACjF,WAAW,CAAC,UAAU,EAAE,cAAc,GAAG,kBAAkB,GAAG,SAAS;IAIvE,iDAAiD;IACjD,YAAY,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO;IAIjD,4CAA4C;IAC5C,kBAAkB,IAAI,cAAc,EAAE;CAGvC;AAED,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,oBAA2B,CAAC;AAM3D,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,gBAAgB,GAAG,IAAI,CA0DpG"}
|