@noorm/marie-cli 0.1.16 → 0.1.18
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/dist/cli-new/components/AgenticSpinner.js +28 -0
- package/dist/cli-new/components/AgenticSpinner.js.map +1 -0
- package/dist/cli-new/components/App.js +3 -1
- package/dist/cli-new/components/App.js.map +1 -1
- package/dist/cli-new/components/ApprovalDialog.js +1 -1
- package/dist/cli-new/components/ApprovalDialog.js.map +1 -1
- package/dist/cli-new/components/Banner.js +16 -6
- package/dist/cli-new/components/Banner.js.map +1 -1
- package/dist/cli-new/components/Header.js +2 -2
- package/dist/cli-new/components/Header.js.map +1 -1
- package/dist/cli-new/components/InputArea.js +29 -23
- package/dist/cli-new/components/InputArea.js.map +1 -1
- package/dist/cli-new/components/MessageBubble.js +5 -4
- package/dist/cli-new/components/MessageBubble.js.map +1 -1
- package/dist/cli-new/components/SessionSwitcher.js +3 -3
- package/dist/cli-new/components/SessionSwitcher.js.map +1 -1
- package/dist/cli-new/components/SetupWizard.js +11 -11
- package/dist/cli-new/components/SetupWizard.js.map +1 -1
- package/dist/cli-new/components/ToolCallDisplay.js +1 -1
- package/dist/cli-new/components/ToolCallDisplay.js.map +1 -1
- package/dist/cli-new/hooks/useUpdateCheck.js +17 -0
- package/dist/cli-new/hooks/useUpdateCheck.js.map +1 -0
- package/dist/cli-new/styles/theme.js +17 -17
- package/dist/cli-new/styles/theme.js.map +1 -1
- package/dist/extension.cjs +868 -340
- package/dist/extension.js +15 -0
- package/dist/extension.js.map +1 -1
- package/dist/monolith/adapters/CliMarieAdapter.js +7 -7
- package/dist/monolith/adapters/CliMarieAdapter.js.map +1 -1
- package/dist/monolith/adapters/VscodeMarieAdapter.js +9 -9
- package/dist/monolith/adapters/VscodeMarieAdapter.js.map +1 -1
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js +5 -2
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -1
- package/dist/monolith/cli/index.js +6 -0
- package/dist/monolith/cli/index.js.map +1 -1
- package/dist/monolith/cli/storage.js +79 -60
- package/dist/monolith/cli/storage.js.map +1 -1
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js +52 -37
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -1
- package/dist/monolith/infrastructure/ai/context/ContextManager.js +35 -2
- package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js +513 -3
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js +25 -5
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +29 -0
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js +41 -7
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js +97 -8
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieSemaphore.js +47 -4
- package/dist/monolith/infrastructure/ai/core/MarieSemaphore.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieSession.js +95 -15
- package/dist/monolith/infrastructure/ai/core/MarieSession.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js +21 -0
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js +12 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js +155 -14
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js +23 -12
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js +6 -0
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +6 -0
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js +22 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js.map +1 -1
- package/dist/monolith/infrastructure/config/ConfigService.js +145 -1
- package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -1
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js +169 -0
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js.map +1 -0
- package/dist/monolith/infrastructure/joy/JoyTools.js +15 -2
- package/dist/monolith/infrastructure/joy/JoyTools.js.map +1 -1
- package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js +118 -0
- package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js +78 -0
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js +150 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js +81 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js +324 -0
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js +29 -1577
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js +346 -0
- package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js +289 -0
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js +43 -0
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js +41 -0
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js +185 -0
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js +348 -0
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js +297 -0
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js.map +1 -0
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js +22 -3
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js.map +1 -1
- package/dist/monolith/plumbing/terminal/TerminalService.js +5 -0
- package/dist/monolith/plumbing/terminal/TerminalService.js.map +1 -1
- package/dist/monolith/plumbing/utils/EnvironmentUtils.js +1 -1
- package/dist/monolith/plumbing/utils/EnvironmentUtils.js.map +1 -1
- package/dist/monolith/plumbing/utils/MutexUtils.js.map +1 -1
- package/dist/monolith/runtime/MarieRuntime.js +86 -4
- package/dist/monolith/runtime/MarieRuntime.js.map +1 -1
- package/dist/monolith/runtime/RuntimeAdapterBase.js.map +1 -1
- package/dist/monolith/services/JoyService.js +1 -1
- package/dist/monolith/services/JoyService.js.map +1 -1
- package/dist/monolith/services/MarieGhostService.js +12 -0
- package/dist/monolith/services/MarieGhostService.js.map +1 -1
- package/dist/monolith/services/UpdateService.js +61 -0
- package/dist/monolith/services/UpdateService.js.map +1 -0
- package/dist/prompts.js +5 -0
- package/dist/prompts.js.map +1 -1
- package/dist/webview-ui/main.js +23 -23
- package/package.json +2 -1
- package/test-mind-p6.sqlite +0 -0
- package/test-mind-p6.sqlite-shm +0 -0
- package/test-mind-p6.sqlite-wal +0 -0
- package/dist/monolith/domain/joy/JoyTools.js +0 -535
- package/dist/monolith/domain/joy/JoyTools.js.map +0 -1
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js +0 -207
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js.map +0 -1
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js +0 -2
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js.map +0 -1
- package/dist/test_agent_stream_control_plane.js +0 -170
- package/dist/test_agent_stream_control_plane.js.map +0 -1
- package/dist/test_strategy_integration.js +0 -114
- package/dist/test_strategy_integration.js.map +0 -1
- package/dist/test_streaming_fragility.js +0 -191
- package/dist/test_streaming_fragility.js.map +0 -1
- package/dist/webview-ui/App.js +0 -16
- package/dist/webview-ui/App.js.map +0 -1
- package/dist/webview-ui/Providers.js +0 -6
- package/dist/webview-ui/Providers.js.map +0 -1
- package/dist/webview-ui/components/ApprovalPanel.js +0 -8
- package/dist/webview-ui/components/ApprovalPanel.js.map +0 -1
- package/dist/webview-ui/components/ChatPanel.js +0 -19
- package/dist/webview-ui/components/ChatPanel.js.map +0 -1
- package/dist/webview-ui/components/Composer.js +0 -19
- package/dist/webview-ui/components/Composer.js.map +0 -1
- package/dist/webview-ui/components/HeaderBar.js +0 -5
- package/dist/webview-ui/components/HeaderBar.js.map +0 -1
- package/dist/webview-ui/components/SessionList.js +0 -14
- package/dist/webview-ui/components/SessionList.js.map +0 -1
- package/dist/webview-ui/context/WebviewStateContext.js +0 -146
- package/dist/webview-ui/context/WebviewStateContext.js.map +0 -1
- package/dist/webview-ui/main.js.map +0 -1
- package/dist/webview-ui/types.js +0 -2
- package/dist/webview-ui/types.js.map +0 -1
- package/dist/webview-ui/vscode.js +0 -4
- package/dist/webview-ui/vscode.js.map +0 -1
- package/marie-coder-0.1.16.vsix +0 -0
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { MARIE_YOLO_SYSTEM_PROMPT } from "../../../../prompts.js";
|
|
2
|
-
import { ConfigService } from "../../config/ConfigService.js";
|
|
3
|
-
import { MarieResponse } from "../core/MarieResponse.js";
|
|
4
|
-
export class MarieYOLO {
|
|
5
|
-
provider;
|
|
6
|
-
// ASCENSION PROTOCOL: Spirit pressure persistence across turns
|
|
7
|
-
lastConfidence = 1.2;
|
|
8
|
-
consecutiveSuccesses = 0;
|
|
9
|
-
constructor(provider) {
|
|
10
|
-
this.provider = provider;
|
|
11
|
-
}
|
|
12
|
-
async evaluate(messages, memory, options) {
|
|
13
|
-
try {
|
|
14
|
-
const profile = options?.profile ?? ConfigService.getYoloProfile();
|
|
15
|
-
const aggression = options?.aggression ?? ConfigService.getYoloAggression();
|
|
16
|
-
const maxRequiredActions = options?.maxRequiredActions ?? ConfigService.getYoloMaxRequiredActions();
|
|
17
|
-
// CONSOLIDATED REASONING: YOLO now acts as Auditor, Strategist, and ISO9001
|
|
18
|
-
const hotspots = Object.entries(memory.errorHotspots)
|
|
19
|
-
.filter(([_, c]) => c >= 2)
|
|
20
|
-
.map(([f, c]) => `${f}(${c}x)`)
|
|
21
|
-
.join(', ') || 'None';
|
|
22
|
-
const contextPrompt = `
|
|
23
|
-
[ASCENSION CONTEXT]
|
|
24
|
-
Memory Snapshot:
|
|
25
|
-
- Spirit Pressure (Flow): ${memory.flowState}/100
|
|
26
|
-
- Victory Streak: ${memory.successStreak}
|
|
27
|
-
- Karma Drain (Errors): ${memory.totalErrorCount}
|
|
28
|
-
- Curse Hotspots: ${hotspots}
|
|
29
|
-
- Recent Echoes: ${memory.recentFiles.slice(-5).join(', ')}
|
|
30
|
-
- Protocol: ${profile}
|
|
31
|
-
- Intensity: ${aggression}
|
|
32
|
-
|
|
33
|
-
[SOVEREIGN DUTIES]
|
|
34
|
-
Your decree integrates Strategic Trajectory, Quality Audit, and Stability Guardianship.
|
|
35
|
-
|
|
36
|
-
Return guidance in the exact structure below:
|
|
37
|
-
Strategy: EXECUTE|DEBUG|RESEARCH|HYPE|PANIC
|
|
38
|
-
Urgency: LOW|MEDIUM|HIGH
|
|
39
|
-
Confidence: 0.5-3.0
|
|
40
|
-
Structural Uncertainty: YES|NO
|
|
41
|
-
Continue Directive: YES|NO
|
|
42
|
-
Required Actions: action1 | action2
|
|
43
|
-
Blocked By: blocker1 | blocker2
|
|
44
|
-
Stop Condition: landed|structural_uncertainty
|
|
45
|
-
Reason: <one concise line integrating Auditor/ISO findings>
|
|
46
|
-
|
|
47
|
-
Required Actions must be <= ${maxRequiredActions}.`;
|
|
48
|
-
const providerResponse = await this.provider.createMessage({
|
|
49
|
-
model: ConfigService.getModel(),
|
|
50
|
-
system: MARIE_YOLO_SYSTEM_PROMPT,
|
|
51
|
-
messages: [
|
|
52
|
-
...messages.map(m => ({ role: m.role, content: m.content })),
|
|
53
|
-
{ role: 'user', content: contextPrompt }
|
|
54
|
-
],
|
|
55
|
-
max_tokens: 900,
|
|
56
|
-
});
|
|
57
|
-
const raw = MarieResponse.wrap(providerResponse.content).getText().substring(0, 1200);
|
|
58
|
-
return this.parseDecision(raw, messages, profile, aggression, maxRequiredActions, memory.successStreak);
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
console.error("MarieYOLO evaluation error", error);
|
|
62
|
-
return {
|
|
63
|
-
strategy: 'EXECUTE',
|
|
64
|
-
urgency: 'MEDIUM',
|
|
65
|
-
confidence: Math.max(1.2, this.lastConfidence * 0.8),
|
|
66
|
-
isContinueDirective: this.hasContinueDirective(messages),
|
|
67
|
-
structuralUncertainty: false,
|
|
68
|
-
reason: 'Fallback: Hero maintains course via instinct.',
|
|
69
|
-
requiredActions: [],
|
|
70
|
-
blockedBy: [],
|
|
71
|
-
stopCondition: 'landed',
|
|
72
|
-
profile: ConfigService.getYoloProfile(),
|
|
73
|
-
raw: 'Fallback decision (spirit pressure rift)'
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
parseDecision(raw, messages, profile, aggression, maxRequiredActions, successStreak) {
|
|
78
|
-
const normalized = raw.replace(/\r/g, '');
|
|
79
|
-
const strategyMatch = normalized.match(/Strategy\s*:\s*(EXECUTE|DEBUG|RESEARCH|HYPE|PANIC)/i);
|
|
80
|
-
const urgencyMatch = normalized.match(/Urgency\s*:\s*(LOW|MEDIUM|HIGH)/i);
|
|
81
|
-
const confidenceMatch = normalized.match(/Confidence\s*:\s*([0-9]+(?:\.[0-9]+)?)/i);
|
|
82
|
-
const uncertaintyMatch = normalized.match(/Structural\s*Uncertainty\s*:\s*(YES|NO|TRUE|FALSE)/i);
|
|
83
|
-
const continueMatch = normalized.match(/Continue\s*Directive\s*:\s*(YES|NO|TRUE|FALSE)/i);
|
|
84
|
-
const requiredActionsMatch = normalized.match(/Required\s*Actions\s*:\s*(.+)/i);
|
|
85
|
-
const blockedByMatch = normalized.match(/Blocked\s*By\s*:\s*(.+)/i);
|
|
86
|
-
const stopConditionMatch = normalized.match(/Stop\s*Condition\s*:\s*(landed|structural_uncertainty)/i);
|
|
87
|
-
const reasonMatch = normalized.match(/Reason\s*:\s*(.+)/i);
|
|
88
|
-
const inferredStrategy = this.inferStrategy(normalized);
|
|
89
|
-
const strategy = strategyMatch?.[1]?.toUpperCase() || inferredStrategy;
|
|
90
|
-
const urgency = urgencyMatch?.[1]?.toUpperCase() || this.inferUrgency(normalized);
|
|
91
|
-
let confidence = this.clampConfidence(Number(confidenceMatch?.[1] ?? this.inferConfidence(urgency, strategy)));
|
|
92
|
-
const structuralUncertainty = this.parseBoolean(uncertaintyMatch?.[1]) || this.inferUncertainty(normalized);
|
|
93
|
-
const isContinueDirective = this.parseBoolean(continueMatch?.[1]) || this.hasContinueDirective(messages) || /continue\s+immediately/i.test(normalized);
|
|
94
|
-
const requiredActions = this.parseDelimitedList(requiredActionsMatch?.[1]).slice(0, maxRequiredActions);
|
|
95
|
-
const blockedBy = this.parseDelimitedList(blockedByMatch?.[1]).slice(0, 4);
|
|
96
|
-
const stopCondition = stopConditionMatch?.[1]?.toLowerCase()
|
|
97
|
-
|| (structuralUncertainty ? 'structural_uncertainty' : 'landed');
|
|
98
|
-
confidence = this.applyProfileTuning(confidence, profile, aggression, structuralUncertainty, successStreak);
|
|
99
|
-
// ASCENSION PROTOCOL: Stronger continue directive boost
|
|
100
|
-
if (isContinueDirective && (strategy === 'EXECUTE' || strategy === 'HYPE')) {
|
|
101
|
-
confidence = Math.min(3.0, confidence + 0.3);
|
|
102
|
-
}
|
|
103
|
-
// Update persistence for next turn
|
|
104
|
-
this.lastConfidence = confidence;
|
|
105
|
-
if (strategy === 'EXECUTE' || strategy === 'HYPE') {
|
|
106
|
-
this.consecutiveSuccesses++;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
this.consecutiveSuccesses = 0;
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
strategy,
|
|
113
|
-
urgency,
|
|
114
|
-
confidence,
|
|
115
|
-
structuralUncertainty,
|
|
116
|
-
isContinueDirective,
|
|
117
|
-
reason: (reasonMatch?.[1] || this.defaultReason(strategy, urgency)).trim().substring(0, 220),
|
|
118
|
-
requiredActions,
|
|
119
|
-
blockedBy,
|
|
120
|
-
stopCondition,
|
|
121
|
-
profile,
|
|
122
|
-
raw: normalized.substring(0, 1200)
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
inferStrategy(text) {
|
|
126
|
-
if (/uncertainty|unknown|unclear|ambiguous\s+structure|dependency\s+risk/i.test(text))
|
|
127
|
-
return 'DEBUG';
|
|
128
|
-
if (/research|investigate|inspect/i.test(text))
|
|
129
|
-
return 'RESEARCH';
|
|
130
|
-
if (/ship|launch|demo day|hype|singularity/i.test(text))
|
|
131
|
-
return 'HYPE';
|
|
132
|
-
if (/panic|halt|assess\s+failure/i.test(text))
|
|
133
|
-
return 'PANIC';
|
|
134
|
-
return 'EXECUTE';
|
|
135
|
-
}
|
|
136
|
-
inferUrgency(text) {
|
|
137
|
-
if (/immediately|now|urgent|critical momentum|no hesitation/i.test(text))
|
|
138
|
-
return 'HIGH';
|
|
139
|
-
if (/careful|cautious|stability/i.test(text))
|
|
140
|
-
return 'LOW';
|
|
141
|
-
return 'MEDIUM';
|
|
142
|
-
}
|
|
143
|
-
inferConfidence(urgency, strategy) {
|
|
144
|
-
if (strategy === 'HYPE')
|
|
145
|
-
return 2.0;
|
|
146
|
-
if (strategy === 'PANIC')
|
|
147
|
-
return 0.5;
|
|
148
|
-
if (urgency === 'HIGH')
|
|
149
|
-
return 1.9;
|
|
150
|
-
if (urgency === 'LOW')
|
|
151
|
-
return 1.0;
|
|
152
|
-
return 1.5;
|
|
153
|
-
}
|
|
154
|
-
inferUncertainty(text) {
|
|
155
|
-
return /structural\s+uncertainty|critical unknown|not enough context|missing wiring/i.test(text);
|
|
156
|
-
}
|
|
157
|
-
defaultReason(strategy, urgency) {
|
|
158
|
-
return `Founder signal: ${strategy} with ${urgency.toLowerCase()} urgency.`;
|
|
159
|
-
}
|
|
160
|
-
parseBoolean(value) {
|
|
161
|
-
if (!value)
|
|
162
|
-
return false;
|
|
163
|
-
return ['YES', 'TRUE'].includes(value.toUpperCase());
|
|
164
|
-
}
|
|
165
|
-
// BALANCED SUPREMACY: Higher max confidence (3.0 vs 2.5)
|
|
166
|
-
clampConfidence(value) {
|
|
167
|
-
if (!Number.isFinite(value))
|
|
168
|
-
return 1.2;
|
|
169
|
-
return Math.min(3.0, Math.max(0.5, value));
|
|
170
|
-
}
|
|
171
|
-
applyProfileTuning(baseConfidence, profile, aggression, structuralUncertainty, successStreak) {
|
|
172
|
-
let profileMultiplier = 1.0;
|
|
173
|
-
// BALANCED SUPREMACY: Boosted profile multipliers
|
|
174
|
-
if (profile === 'demo_day')
|
|
175
|
-
profileMultiplier = 1.2;
|
|
176
|
-
if (profile === 'recovery')
|
|
177
|
-
profileMultiplier = 0.9;
|
|
178
|
-
// ASCENSION PROTOCOL: Success streak amplification (+0.05 per streak, max +0.5)
|
|
179
|
-
const streakBonus = Math.min(0.5, (successStreak || 0) * 0.05);
|
|
180
|
-
let tuned = baseConfidence * profileMultiplier * aggression * (1 + streakBonus);
|
|
181
|
-
// ASCENSION PROTOCOL: Gentler structural uncertainty penalty
|
|
182
|
-
if (structuralUncertainty)
|
|
183
|
-
tuned *= 0.85;
|
|
184
|
-
// ASCENSION PROTOCOL: Conviction persistence (15% carryover from last turn)
|
|
185
|
-
const persistenceBonus = this.lastConfidence * 0.15;
|
|
186
|
-
tuned += persistenceBonus;
|
|
187
|
-
return this.clampConfidence(tuned);
|
|
188
|
-
}
|
|
189
|
-
parseDelimitedList(raw) {
|
|
190
|
-
if (!raw)
|
|
191
|
-
return [];
|
|
192
|
-
if (/^none$/i.test(raw.trim()))
|
|
193
|
-
return [];
|
|
194
|
-
return raw
|
|
195
|
-
.split(/[|,;]/)
|
|
196
|
-
.map(s => s.trim())
|
|
197
|
-
.filter(Boolean)
|
|
198
|
-
.slice(0, 6);
|
|
199
|
-
}
|
|
200
|
-
hasContinueDirective(messages) {
|
|
201
|
-
const lastUser = [...messages].reverse().find(m => m?.role === 'user' && typeof m?.content === 'string');
|
|
202
|
-
if (!lastUser)
|
|
203
|
-
return false;
|
|
204
|
-
return /\bcontinue\b/i.test(lastUser.content);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
//# sourceMappingURL=MarieYOLO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarieYOLO.js","sourceRoot":"","sources":["../../../../../src/monolith/infrastructure/ai/agents/MarieYOLO.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,MAAM,OAAO,SAAS;IAKE;IAJpB,+DAA+D;IACvD,cAAc,GAAW,GAAG,CAAC;IAC7B,oBAAoB,GAAW,CAAC,CAAC;IAEzC,YAAoB,QA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CAAC;QAE1B,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAEO,kBAAkB,CAAC,GAAY;QACnC,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,CAAC;QACpB,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAAE,OAAO,EAAE,CAAC;QAC1C,OAAO,GAAG;aACL,KAAK,CAAC,OAAO,CAAC;aACd,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAClB,MAAM,CAAC,OAAO,CAAC;aACf,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrB,CAAC;IAEO,oBAAoB,CAAC,QAAe;QACxC,MAAM,QAAQ,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC;QACzG,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5B,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarieYOLOTypes.js","sourceRoot":"","sources":["../../../../../src/monolith/infrastructure/ai/core/MarieYOLOTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { AgentIntentScheduler } from "./monolith/infrastructure/ai/core/AgentIntentScheduler.js";
|
|
2
|
-
import { AgentMergeArbiter } from "./monolith/infrastructure/ai/core/AgentMergeArbiter.js";
|
|
3
|
-
import { AgentStreamPolicyEngine } from "./monolith/infrastructure/ai/core/AgentStreamPolicyEngine.js";
|
|
4
|
-
import { AgentStreamManager } from "./monolith/infrastructure/ai/core/AgentStreamManager.js";
|
|
5
|
-
import { ConfigService } from "./monolith/infrastructure/config/ConfigService.js";
|
|
6
|
-
function assert(condition, message) {
|
|
7
|
-
if (!condition)
|
|
8
|
-
throw new Error(message);
|
|
9
|
-
}
|
|
10
|
-
class FakePolicy extends AgentStreamPolicyEngine {
|
|
11
|
-
enabled;
|
|
12
|
-
constructor(enabled) {
|
|
13
|
-
super();
|
|
14
|
-
this.enabled = enabled;
|
|
15
|
-
}
|
|
16
|
-
isEnabled() {
|
|
17
|
-
return this.enabled;
|
|
18
|
-
}
|
|
19
|
-
evaluateIntent() {
|
|
20
|
-
return { score: 2.0, accepted: true, reason: 'synthetic accept' };
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function createContext() {
|
|
24
|
-
return {
|
|
25
|
-
runId: 'run_test',
|
|
26
|
-
flowState: 70,
|
|
27
|
-
errorCount: 0,
|
|
28
|
-
hotspotCount: 0,
|
|
29
|
-
objectiveCount: 1,
|
|
30
|
-
pressure: 'LOW',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function createIntent(agentId = 'QASRE') {
|
|
34
|
-
return {
|
|
35
|
-
intent: 'QUALITY_REGRESSION_SCAN',
|
|
36
|
-
candidateAgents: [agentId],
|
|
37
|
-
urgency: 1,
|
|
38
|
-
risk: 1,
|
|
39
|
-
expectedValue: 1,
|
|
40
|
-
tokenCostEstimate: 250,
|
|
41
|
-
contentionFactor: 1,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function testSchedulerDeterminismAndAcceptanceSemantics() {
|
|
45
|
-
const shadowScheduler = new AgentIntentScheduler(new FakePolicy(false));
|
|
46
|
-
const liveScheduler = new AgentIntentScheduler(new FakePolicy(true));
|
|
47
|
-
const context = createContext();
|
|
48
|
-
const shadowPlan = shadowScheduler.plan(context, [createIntent()])[0];
|
|
49
|
-
assert(shadowPlan.mode === 'SHADOW', 'Expected SHADOW mode when policy disabled');
|
|
50
|
-
assert(shadowPlan.policyAccepted === true, 'Expected policyAccepted=true in shadow mode for accepted policy decision');
|
|
51
|
-
assert(shadowPlan.executionAccepted === false, 'Expected executionAccepted=false in shadow mode');
|
|
52
|
-
assert((shadowPlan.executionReason || '').includes('SHADOW mode'), 'Expected explicit SHADOW suppression reason');
|
|
53
|
-
assert(shadowPlan.accepted === false, 'Expected accepted alias to track execution acceptance');
|
|
54
|
-
assert(shadowPlan.streamIdentity.streamId.endsWith('_1'), 'Expected deterministic sequence suffix _1');
|
|
55
|
-
const nextShadowPlan = shadowScheduler.plan(context, [createIntent()])[0];
|
|
56
|
-
assert(nextShadowPlan.streamIdentity.streamId.endsWith('_2'), 'Expected deterministic sequence increment to _2');
|
|
57
|
-
const livePlan = liveScheduler.plan(context, [createIntent()])[0];
|
|
58
|
-
assert(livePlan.mode === 'LIVE', 'Expected LIVE mode when policy enabled');
|
|
59
|
-
assert(livePlan.policyAccepted === true, 'Expected policyAccepted=true in live mode');
|
|
60
|
-
assert(livePlan.executionAccepted === true, 'Expected executionAccepted=true in live mode');
|
|
61
|
-
assert(livePlan.accepted === true, 'Expected accepted alias=true in live mode');
|
|
62
|
-
assert(livePlan.executionReason === 'Execution admitted', 'Expected admitted execution reason in live mode');
|
|
63
|
-
const highPressurePlan = liveScheduler.plan({ ...context, pressure: 'HIGH' }, [{ ...createIntent('ISO9001'), intent: 'READINESS_GATE' }])[0];
|
|
64
|
-
assert(highPressurePlan.executionAccepted === false, 'Expected readiness intent execution suppression under HIGH pressure');
|
|
65
|
-
assert((highPressurePlan.executionReason || '').includes('HIGH pressure'), 'Expected HIGH pressure suppression reason');
|
|
66
|
-
const equalScorePlans = liveScheduler.plan(context, [createIntent('QASRE'), createIntent('ISO9001')]);
|
|
67
|
-
assert(equalScorePlans[0].sequence < equalScorePlans[1].sequence, 'Expected stable tie-break by sequence for equal scores');
|
|
68
|
-
}
|
|
69
|
-
function testManagerConcurrencyAndReasonPropagation() {
|
|
70
|
-
const manager = new AgentStreamManager();
|
|
71
|
-
const originalMaxConcurrent = ConfigService.getAgentStreamMaxConcurrent;
|
|
72
|
-
ConfigService.getAgentStreamMaxConcurrent = () => 1;
|
|
73
|
-
try {
|
|
74
|
-
const mkPlan = (streamId) => ({
|
|
75
|
-
streamIdentity: { streamId, origin: 'agent', agentId: 'QASRE', parentRunId: 'run_test', intent: 'QUALITY_REGRESSION_SCAN' },
|
|
76
|
-
intent: 'QUALITY_REGRESSION_SCAN',
|
|
77
|
-
agentId: 'QASRE',
|
|
78
|
-
sequence: 1,
|
|
79
|
-
score: 2,
|
|
80
|
-
policyAccepted: true,
|
|
81
|
-
executionAccepted: true,
|
|
82
|
-
accepted: true,
|
|
83
|
-
reason: 'test',
|
|
84
|
-
tokenBudget: 300,
|
|
85
|
-
timeoutMs: 5000,
|
|
86
|
-
mode: 'LIVE',
|
|
87
|
-
});
|
|
88
|
-
const first = manager.spawn(mkPlan('stream_1'));
|
|
89
|
-
const second = manager.spawn(mkPlan('stream_2'));
|
|
90
|
-
assert(Boolean(first), 'Expected first stream to spawn');
|
|
91
|
-
assert(second === null, 'Expected second stream to be rejected by manager concurrency guard');
|
|
92
|
-
manager.cancel('stream_1', 'pressure_shed');
|
|
93
|
-
const terminal = manager.consumeTerminalState('stream_1');
|
|
94
|
-
assert(terminal?.status === 'cancelled', 'Expected cancelled terminal status');
|
|
95
|
-
assert(terminal?.reason === 'pressure_shed', 'Expected propagated pressure_shed reason');
|
|
96
|
-
const quality = manager.spawn(mkPlan('stream_quality'));
|
|
97
|
-
const readiness = manager.spawn({ ...mkPlan('stream_readiness'), intent: 'READINESS_GATE', streamIdentity: { streamId: 'stream_readiness', origin: 'agent', agentId: 'ISO9001' } });
|
|
98
|
-
assert(Boolean(quality), 'Expected quality stream to spawn');
|
|
99
|
-
assert(readiness === null, 'Expected readiness stream blocked by max concurrency cap in this test setup');
|
|
100
|
-
manager.complete('stream_quality');
|
|
101
|
-
manager.consumeTerminalState('stream_quality');
|
|
102
|
-
const readiness2 = manager.spawn({ ...mkPlan('stream_readiness2'), intent: 'READINESS_GATE', streamIdentity: { streamId: 'stream_readiness2', origin: 'agent', agentId: 'ISO9001' } });
|
|
103
|
-
assert(Boolean(readiness2), 'Expected readiness stream to spawn after slot clears');
|
|
104
|
-
const shed = manager.shedNonCriticalStreams();
|
|
105
|
-
assert(shed.includes('stream_readiness2'), 'Expected non-critical stream to be shed under pressure policy');
|
|
106
|
-
const shedTerminal = manager.consumeTerminalState('stream_readiness2');
|
|
107
|
-
assert(shedTerminal?.reason === 'pressure_shed', 'Expected shed stream to carry pressure_shed reason');
|
|
108
|
-
for (let i = 0; i < 270; i++) {
|
|
109
|
-
const id = `stream_gc_${i}`;
|
|
110
|
-
const stream = manager.spawn(mkPlan(id));
|
|
111
|
-
if (!stream)
|
|
112
|
-
continue;
|
|
113
|
-
manager.complete(id);
|
|
114
|
-
}
|
|
115
|
-
const oldestTerminal = manager.consumeTerminalState('stream_gc_0');
|
|
116
|
-
assert(!oldestTerminal, 'Expected oldest terminal states to be evicted by bounded terminal-state cache');
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
ConfigService.getAgentStreamMaxConcurrent = originalMaxConcurrent;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function testArbiterConflictAndBlockingDominance() {
|
|
123
|
-
const arbiter = new AgentMergeArbiter();
|
|
124
|
-
arbiter.stage({
|
|
125
|
-
streamIdentity: { streamId: 's1', origin: 'agent', agentId: 'QASRE' },
|
|
126
|
-
intent: 'QUALITY_REGRESSION_SCAN',
|
|
127
|
-
decision: 'QASRE_CRITICAL',
|
|
128
|
-
confidence: 1.8,
|
|
129
|
-
evidenceRefs: ['stream:s1'],
|
|
130
|
-
recommendedActions: [],
|
|
131
|
-
blockingConditions: ['critical_quality_risk'],
|
|
132
|
-
summary: 'Critical risk',
|
|
133
|
-
createdAt: 1,
|
|
134
|
-
});
|
|
135
|
-
arbiter.stage({
|
|
136
|
-
streamIdentity: { streamId: 's2', origin: 'agent', agentId: 'ISO9001' },
|
|
137
|
-
intent: 'READINESS_GATE',
|
|
138
|
-
decision: 'READY',
|
|
139
|
-
confidence: 1.5,
|
|
140
|
-
evidenceRefs: ['stream:s2'],
|
|
141
|
-
recommendedActions: [],
|
|
142
|
-
blockingConditions: [],
|
|
143
|
-
summary: 'Ready to ship',
|
|
144
|
-
createdAt: 2,
|
|
145
|
-
});
|
|
146
|
-
arbiter.stage({
|
|
147
|
-
streamIdentity: { streamId: 's3', origin: 'agent', agentId: 'QASRE' },
|
|
148
|
-
intent: 'QUALITY_REGRESSION_SCAN',
|
|
149
|
-
decision: 'QASRE_DEBUG',
|
|
150
|
-
confidence: 1.4,
|
|
151
|
-
evidenceRefs: ['stream:s3'],
|
|
152
|
-
recommendedActions: [],
|
|
153
|
-
blockingConditions: [],
|
|
154
|
-
summary: 'Duplicate same agent+intent',
|
|
155
|
-
createdAt: 3,
|
|
156
|
-
});
|
|
157
|
-
const decision = arbiter.evaluate();
|
|
158
|
-
assert(decision.accepted.length === 1, 'Expected only blocking envelope to remain accepted');
|
|
159
|
-
assert(decision.accepted[0].streamIdentity.streamId === 's1', 'Expected blocking envelope to dominate');
|
|
160
|
-
assert(decision.rejected.length === 2, 'Expected two rejections from dominance + collision');
|
|
161
|
-
}
|
|
162
|
-
function run() {
|
|
163
|
-
console.log('🧪 Agent stream control-plane tests starting...');
|
|
164
|
-
testSchedulerDeterminismAndAcceptanceSemantics();
|
|
165
|
-
testManagerConcurrencyAndReasonPropagation();
|
|
166
|
-
testArbiterConflictAndBlockingDominance();
|
|
167
|
-
console.log('✅ Agent stream control-plane tests passed');
|
|
168
|
-
}
|
|
169
|
-
run();
|
|
170
|
-
//# sourceMappingURL=test_agent_stream_control_plane.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_agent_stream_control_plane.js","sourceRoot":"","sources":["../src/test_agent_stream_control_plane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAC;AACjG,OAAO,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AC,WAAW,CAAC;QAC3B,kBAAkB,EAAE,EAAE;QACtB,kBAAkB,EAAE,EAAE;QACtB,OAAO,EAAE,6BAA6B;QACtC,SAAS,EAAE,CAAC;KACf,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IACpC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,oDAAoD,CAAC,CAAC;IAC7F,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,KAAK,IAAI,EAAE,wCAAwC,CAAC,CAAC;IACxG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,oDAAoD,CAAC,CAAC;AACjG,CAAC;AAED,SAAS,GAAG;IACR,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAC/D,8CAA8C,EAAE,CAAC;IACjD,0CAA0C,EAAE,CAAC;IAC7C,uCAAuC,EAAE,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;AAC7D,CAAC;AAED,GAAG,EAAE,CAAC"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { MarieEngine } from "./monolith/infrastructure/ai/core/MarieEngine.js";
|
|
2
|
-
import { ToolRegistry } from "./monolith/infrastructure/tools/ToolRegistry.js";
|
|
3
|
-
import { MarieProgressTracker } from "./monolith/infrastructure/ai/core/MarieProgressTracker.js";
|
|
4
|
-
// --- MOCKS ---
|
|
5
|
-
class MockAIProvider {
|
|
6
|
-
async createMessage() {
|
|
7
|
-
return { role: "assistant", content: "Thought" };
|
|
8
|
-
}
|
|
9
|
-
callCount = 0;
|
|
10
|
-
async createMessageStream(params, onUpdate) {
|
|
11
|
-
this.callCount++;
|
|
12
|
-
if (this.callCount > 1) {
|
|
13
|
-
onUpdate({ type: "content_delta", text: "Done. " });
|
|
14
|
-
return { role: "assistant", content: "Done." };
|
|
15
|
-
}
|
|
16
|
-
onUpdate({ type: "content_delta", text: "I will create a file. " });
|
|
17
|
-
onUpdate({
|
|
18
|
-
type: "tool_call_delta",
|
|
19
|
-
index: 0,
|
|
20
|
-
id: "call_123",
|
|
21
|
-
name: "write_to_file"
|
|
22
|
-
});
|
|
23
|
-
onUpdate({
|
|
24
|
-
type: "tool_call_delta",
|
|
25
|
-
index: 0,
|
|
26
|
-
id: "call_123",
|
|
27
|
-
argumentsDelta: '{"path": "test.txt", "content": "hello"}'
|
|
28
|
-
});
|
|
29
|
-
onUpdate({ type: "usage", usage: { totalTokens: 100 } });
|
|
30
|
-
return {
|
|
31
|
-
role: "assistant",
|
|
32
|
-
content: "I will create a file.",
|
|
33
|
-
tool_uses: [{ id: "call_123", name: "write_to_file", input: { path: "test.txt", content: "hello" } }]
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
estimateTokens() { return 0; }
|
|
37
|
-
async listModels() { return []; }
|
|
38
|
-
}
|
|
39
|
-
class MockFileSystemPort {
|
|
40
|
-
async readFile() { return ""; }
|
|
41
|
-
async writeFile(p, c) {
|
|
42
|
-
console.log(`[MockFS] Writing to ${p}: ${c}`);
|
|
43
|
-
}
|
|
44
|
-
async deleteFile() { }
|
|
45
|
-
async backupFile() { }
|
|
46
|
-
async restoreFile() { }
|
|
47
|
-
async rollbackAll() { }
|
|
48
|
-
clearBackups() { }
|
|
49
|
-
}
|
|
50
|
-
// --- TEST RUNNER ---
|
|
51
|
-
async function runStrategyTest() {
|
|
52
|
-
console.log("🚀 Starting Strategy Integration Test...");
|
|
53
|
-
const toolRegistry = new ToolRegistry();
|
|
54
|
-
toolRegistry.register({
|
|
55
|
-
name: "write_to_file",
|
|
56
|
-
description: "Write content",
|
|
57
|
-
input_schema: { type: "object", properties: { path: { type: "string" }, content: { type: "string" } } },
|
|
58
|
-
execute: async (args) => {
|
|
59
|
-
console.log("[Tool] write_to_file executed");
|
|
60
|
-
return "Success";
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
const run = {
|
|
64
|
-
runId: "test_run",
|
|
65
|
-
startedAt: Date.now(),
|
|
66
|
-
steps: 0,
|
|
67
|
-
tools: 0,
|
|
68
|
-
objectives: [
|
|
69
|
-
{ id: 'understand_request', label: 'Understand', status: 'in_progress' },
|
|
70
|
-
{ id: 'execute_plan', label: 'Execute', status: 'pending' },
|
|
71
|
-
{ id: 'deliver_result', label: 'Deliver', status: 'pending' }
|
|
72
|
-
],
|
|
73
|
-
activeObjectiveId: 'understand_request',
|
|
74
|
-
achieved: []
|
|
75
|
-
};
|
|
76
|
-
const events = [];
|
|
77
|
-
const tracker = new MarieProgressTracker({
|
|
78
|
-
onEvent: (e) => {
|
|
79
|
-
events.push(e);
|
|
80
|
-
console.log(`[Event Capture] Captured event: ${e.type}`);
|
|
81
|
-
if (e.type === 'progress_update') {
|
|
82
|
-
console.log(`[Tracker] Progress: ${e.activeObjectiveId} -> ${e.context}`);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
onStream: (c) => console.log(`[Stream] ${c}`)
|
|
86
|
-
}, run);
|
|
87
|
-
const provider = new MockAIProvider();
|
|
88
|
-
const fs = new MockFileSystemPort();
|
|
89
|
-
// We mock VscodeFileSystemPort by name to test environment detection in MarieEngine
|
|
90
|
-
Object.defineProperty(fs.constructor, 'name', { value: 'CliFileSystemPort' });
|
|
91
|
-
const engine = new MarieEngine(provider, toolRegistry, async () => true, // Auto-approve
|
|
92
|
-
undefined, fs);
|
|
93
|
-
console.log("\n--- Executing chatLoop ---");
|
|
94
|
-
await engine.chatLoop([{ role: "user", content: "create a file" }], tracker, async () => { });
|
|
95
|
-
// Wait for throttle timers in dispatcher
|
|
96
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
97
|
-
console.log("\n--- Verification ---");
|
|
98
|
-
console.log("Event types seen:", events.map(e => e.type).join(', '));
|
|
99
|
-
// 1. Verify environment detection
|
|
100
|
-
const state = engine.state;
|
|
101
|
-
console.log(`Test: Environment detected as CLI - ${state.environment === 'cli' ? 'PASS' : 'FAIL'}`);
|
|
102
|
-
// 2. Verify objective transition
|
|
103
|
-
const finalObjective = run.activeObjectiveId;
|
|
104
|
-
console.log(`Test: Objective transitioned to execute_plan - ${finalObjective === 'execute_plan' ? 'PASS' : 'FAIL'}`);
|
|
105
|
-
// 3. Verify event routing (content_delta should be in events)
|
|
106
|
-
const hasContentDelta = events.some(e => e.type === 'content_delta');
|
|
107
|
-
console.log(`Test: MarieEventDispatcher routed content_delta - ${hasContentDelta ? 'PASS' : 'FAIL'}`);
|
|
108
|
-
// 4. Verify tool delta routing
|
|
109
|
-
const hasToolDelta = events.some(e => e.type === 'tool_delta');
|
|
110
|
-
console.log(`Test: MarieEventDispatcher routed tool_delta - ${hasToolDelta ? 'PASS' : 'FAIL'}`);
|
|
111
|
-
console.log("\nStrategy Integration Test Completed!");
|
|
112
|
-
}
|
|
113
|
-
runStrategyTest().catch(console.error);
|
|
114
|
-
//# sourceMappingURL=test_strategy_integration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_strategy_integration.js","sourceRoot":"","sources":["../src/test_strategy_integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAC;AAIjG,gBAAgB;AAEhB,MAAM,cAAc;IAChB,KAAK,CAAC,aAAa;QACf,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACrD,CAAC;IACO,SAAS,GAAG,CAAC,CAAC;IACtB,KAAK,CAAC,mBAAmB,CAAC,MAAW,EAAE,QAAoC;QACvE,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;YACrB,QAAQ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