@noorm/marie-cli 0.1.18 → 0.1.25
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/README.md +7 -15
- package/SENTINEL.md +4 -7
- package/dist/cli-new/components/App.js +16 -63
- package/dist/cli-new/components/App.js.map +1 -1
- package/dist/cli-new/components/ApprovalDialog.js +2 -1
- package/dist/cli-new/components/ApprovalDialog.js.map +1 -1
- package/dist/cli-new/components/Banner.js +4 -3
- package/dist/cli-new/components/Banner.js.map +1 -1
- package/dist/cli-new/components/ChatArea.js +6 -7
- package/dist/cli-new/components/ChatArea.js.map +1 -1
- package/dist/cli-new/components/Header.js +13 -7
- package/dist/cli-new/components/Header.js.map +1 -1
- package/dist/cli-new/components/InputArea.js +73 -12
- package/dist/cli-new/components/InputArea.js.map +1 -1
- package/dist/cli-new/components/MessageBubble.js +26 -18
- package/dist/cli-new/components/MessageBubble.js.map +1 -1
- package/dist/cli-new/components/SessionSwitcher.js +4 -7
- package/dist/cli-new/components/SessionSwitcher.js.map +1 -1
- package/dist/cli-new/components/SetupWizard.js +80 -257
- package/dist/cli-new/components/SetupWizard.js.map +1 -1
- package/dist/cli-new/components/ToolCallDisplay.js +20 -5
- package/dist/cli-new/components/ToolCallDisplay.js.map +1 -1
- package/dist/cli-new/components/WizardSteps.js +22 -0
- package/dist/cli-new/components/WizardSteps.js.map +1 -0
- package/dist/cli-new/constants/SetupConstants.js +42 -0
- package/dist/cli-new/constants/SetupConstants.js.map +1 -0
- package/dist/cli-new/hooks/useGit.js +19 -62
- package/dist/cli-new/hooks/useGit.js.map +1 -1
- package/dist/cli-new/hooks/useMarie.js +26 -18
- package/dist/cli-new/hooks/useMarie.js.map +1 -1
- package/dist/cli-new/hooks/useSessions.js +1 -1
- package/dist/cli-new/hooks/useSessions.js.map +1 -1
- package/dist/cli-new/hooks/useSetupWizard.js +88 -0
- package/dist/cli-new/hooks/useSetupWizard.js.map +1 -0
- package/dist/cli-new/hooks/useUpdateCheck.js +4 -3
- package/dist/cli-new/hooks/useUpdateCheck.js.map +1 -1
- package/dist/cli-new/index.js +2 -4
- package/dist/cli-new/index.js.map +1 -1
- package/dist/cli-new/services/CommandService.js +104 -0
- package/dist/cli-new/services/CommandService.js.map +1 -0
- package/dist/cli-new/services/GitService.js +91 -0
- package/dist/cli-new/services/GitService.js.map +1 -0
- package/dist/cli-new/services/MarieService.js +77 -0
- package/dist/cli-new/services/MarieService.js.map +1 -0
- package/dist/cli-new/services/auth-server.js +128 -0
- package/dist/cli-new/services/auth-server.js.map +1 -0
- package/dist/cli-new/utils/version.js +24 -0
- package/dist/cli-new/utils/version.js.map +1 -0
- package/dist/monolith/adapters/CliMarieAdapter.js +12 -11
- package/dist/monolith/adapters/CliMarieAdapter.js.map +1 -1
- package/dist/monolith/cli/CliFileSystemPort.js +17 -3
- package/dist/monolith/cli/CliFileSystemPort.js.map +1 -1
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js +39 -31
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -1
- package/dist/monolith/cli/index.js +5 -20
- package/dist/monolith/cli/index.js.map +1 -1
- package/dist/monolith/cli/services/JoyAutomationServiceCLI.js +15 -62
- package/dist/monolith/cli/services/JoyAutomationServiceCLI.js.map +1 -1
- package/dist/monolith/cli/storage.js +142 -72
- package/dist/monolith/cli/storage.js.map +1 -1
- package/dist/monolith/domain/joy/RitualService.js +44 -46
- package/dist/monolith/domain/joy/RitualService.js.map +1 -1
- package/dist/monolith/domain/marie/MarieCortex.js +148 -0
- package/dist/monolith/domain/marie/MarieCortex.js.map +1 -0
- package/dist/monolith/domain/marie/PersonalityRenderer.js +97 -0
- package/dist/monolith/domain/marie/PersonalityRenderer.js.map +1 -0
- package/dist/monolith/infrastructure/Configuration.js +68 -0
- package/dist/monolith/infrastructure/Configuration.js.map +1 -0
- package/dist/monolith/infrastructure/CoreInfrastructure.js +204 -0
- package/dist/monolith/infrastructure/CoreInfrastructure.js.map +1 -0
- package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js +3 -3
- package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js.map +1 -1
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js +6 -27
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -1
- package/dist/monolith/infrastructure/ai/context/ContextManager.js +142 -131
- package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js +115 -1077
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js +1 -37
- package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js +6 -1
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +172 -221
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js +292 -141
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js +331 -614
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieVitality.js +238 -0
- package/dist/monolith/infrastructure/ai/core/MarieVitality.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/SessionLogService.js +9 -2
- package/dist/monolith/infrastructure/ai/core/SessionLogService.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/AIProvider.js +402 -1
- package/dist/monolith/infrastructure/ai/providers/AIProvider.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/DreamBeesProvider.js +114 -0
- package/dist/monolith/infrastructure/ai/providers/DreamBeesProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js +426 -392
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js +235 -241
- package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js.map +1 -1
- package/dist/monolith/infrastructure/ai/workerAi.js +185 -0
- package/dist/monolith/infrastructure/ai/workerAi.js.map +1 -0
- package/dist/monolith/infrastructure/config/ConfigService.js +216 -503
- package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -1
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js +4 -165
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js.map +1 -1
- package/dist/monolith/infrastructure/joy/JoyTools.js +14 -47
- package/dist/monolith/infrastructure/joy/JoyTools.js.map +1 -1
- package/dist/monolith/infrastructure/persistence/MarieMindAutonomics.js +4 -0
- package/dist/monolith/infrastructure/persistence/MarieMindAutonomics.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/MarieMindEngine.js +11 -0
- package/dist/monolith/infrastructure/persistence/MarieMindEngine.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js +123 -106
- package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js.map +1 -1
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js +508 -63
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js.map +1 -1
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js +68 -39
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js.map +1 -1
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js +80 -67
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js.map +1 -1
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js +122 -75
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js.map +1 -1
- package/dist/monolith/infrastructure/services/MarieMemoryStore.js +133 -134
- package/dist/monolith/infrastructure/services/MarieMemoryStore.js.map +1 -1
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js +6 -30
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js.map +1 -1
- package/dist/monolith/infrastructure/tools/PureStreamParser.js +68 -80
- package/dist/monolith/infrastructure/tools/PureStreamParser.js.map +1 -1
- package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js +12 -11
- package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js.map +1 -1
- package/dist/monolith/infrastructure/tools/SovereignTools.js +326 -0
- package/dist/monolith/infrastructure/tools/SovereignTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/ToolRegistry.js +45 -26
- package/dist/monolith/infrastructure/tools/ToolRegistry.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js +39 -153
- package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js +31 -46
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js +41 -13
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js +10 -14
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js +39 -70
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js +30 -181
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js +12 -9
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js.map +1 -1
- package/dist/monolith/plumbing/Plumbing.js +238 -0
- package/dist/monolith/plumbing/Plumbing.js.map +1 -0
- package/dist/monolith/plumbing/PlumbingAnalysis.js +109 -0
- package/dist/monolith/plumbing/PlumbingAnalysis.js.map +1 -0
- package/dist/monolith/plumbing/PlumbingSystem.js +169 -0
- package/dist/monolith/plumbing/PlumbingSystem.js.map +1 -0
- package/dist/monolith/plumbing/analysis/ComplexityService.js +30 -34
- package/dist/monolith/plumbing/analysis/ComplexityService.js.map +1 -1
- package/dist/monolith/plumbing/analysis/DependencyService.js +55 -44
- package/dist/monolith/plumbing/analysis/DependencyService.js.map +1 -1
- package/dist/monolith/plumbing/analysis/DiscoveryService.js +40 -42
- package/dist/monolith/plumbing/analysis/DiscoveryService.js.map +1 -1
- package/dist/monolith/plumbing/analysis/JoyMapService.js +52 -56
- package/dist/monolith/plumbing/analysis/JoyMapService.js.map +1 -1
- package/dist/monolith/plumbing/analysis/LintService.js +118 -118
- package/dist/monolith/plumbing/analysis/LintService.js.map +1 -1
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js +278 -268
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js.map +1 -1
- package/dist/monolith/plumbing/analysis/QualityGuardrailService.js +116 -114
- package/dist/monolith/plumbing/analysis/QualityGuardrailService.js.map +1 -1
- package/dist/monolith/plumbing/analysis/SurgicalMender.js +57 -59
- package/dist/monolith/plumbing/analysis/SurgicalMender.js.map +1 -1
- package/dist/monolith/plumbing/analysis/TestService.js +89 -89
- package/dist/monolith/plumbing/analysis/TestService.js.map +1 -1
- package/dist/monolith/plumbing/filesystem/FileService.js +123 -195
- package/dist/monolith/plumbing/filesystem/FileService.js.map +1 -1
- package/dist/monolith/plumbing/filesystem/PathResolver.js +7 -8
- package/dist/monolith/plumbing/filesystem/PathResolver.js.map +1 -1
- package/dist/monolith/plumbing/git/GitService.js +4 -4
- package/dist/monolith/plumbing/git/GitService.js.map +1 -1
- package/dist/monolith/plumbing/lsp/SymbolService.js +5 -34
- package/dist/monolith/plumbing/lsp/SymbolService.js.map +1 -1
- package/dist/monolith/plumbing/terminal/ProcessRegistry.js +20 -22
- package/dist/monolith/plumbing/terminal/ProcessRegistry.js.map +1 -1
- package/dist/monolith/plumbing/terminal/TerminalService.js +127 -141
- package/dist/monolith/plumbing/terminal/TerminalService.js.map +1 -1
- package/dist/monolith/plumbing/utils/EnvironmentUtils.js +3 -23
- package/dist/monolith/plumbing/utils/EnvironmentUtils.js.map +1 -1
- package/dist/monolith/plumbing/utils/JsonUtils.js +252 -311
- package/dist/monolith/plumbing/utils/JsonUtils.js.map +1 -1
- package/dist/monolith/plumbing/utils/PlumbingCore.js +549 -0
- package/dist/monolith/plumbing/utils/PlumbingCore.js.map +1 -0
- package/dist/monolith/plumbing/utils/PrefixTree.js +61 -114
- package/dist/monolith/plumbing/utils/PrefixTree.js.map +1 -1
- package/dist/monolith/plumbing/utils/StreamTagDetector.js +89 -127
- package/dist/monolith/plumbing/utils/StreamTagDetector.js.map +1 -1
- package/dist/monolith/plumbing/utils/StringUtils.js +87 -89
- package/dist/monolith/plumbing/utils/StringUtils.js.map +1 -1
- package/dist/monolith/runtime/MarieRuntime.js +76 -499
- package/dist/monolith/runtime/MarieRuntime.js.map +1 -1
- package/dist/monolith/runtime/RuntimeAdapterBase.js +1 -1
- package/dist/monolith/runtime/RuntimeAdapterBase.js.map +1 -1
- package/dist/monolith/runtime/providerFactory.js +1 -7
- package/dist/monolith/runtime/providerFactory.js.map +1 -1
- package/dist/monolith/services/HealthService.js +29 -32
- package/dist/monolith/services/HealthService.js.map +1 -1
- package/dist/monolith/services/JoyAutomationService.js +58 -95
- package/dist/monolith/services/JoyAutomationService.js.map +1 -1
- package/dist/monolith/services/MarieAutomationService.js +59 -0
- package/dist/monolith/services/MarieAutomationService.js.map +1 -0
- package/dist/monolith/services/MarieGhostService.js +46 -173
- package/dist/monolith/services/MarieGhostService.js.map +1 -1
- package/dist/monolith/services/MarieServices.js +102 -0
- package/dist/monolith/services/MarieServices.js.map +1 -0
- package/dist/monolith/services/MarieTypes.js +2 -0
- package/dist/monolith/services/MarieTypes.js.map +1 -0
- package/dist/monolith/services/UpdateService.js +47 -49
- package/dist/monolith/services/UpdateService.js.map +1 -1
- package/dist/prompts.js +11 -5
- package/dist/prompts.js.map +1 -1
- package/dist/test_prefix_tree.js +9 -9
- package/dist/test_prefix_tree.js.map +1 -1
- package/package.json +18 -89
- package/run_test.js +5 -0
- package/.marie_visual_verify_1771225696548/progress_bar_check.txt +0 -1
- package/dist/extension.cjs +0 -1155
- package/dist/extension.js +0 -474
- package/dist/extension.js.map +0 -1
- package/dist/monolith/adapters/VscodeMarieAdapter.js +0 -81
- package/dist/monolith/adapters/VscodeMarieAdapter.js.map +0 -1
- package/dist/monolith/infrastructure/ai/core/GhostPort.js +0 -2
- package/dist/monolith/infrastructure/ai/core/GhostPort.js.map +0 -1
- package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js +0 -33
- package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js.map +0 -1
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js +0 -154
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +0 -1
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +0 -214
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js.map +0 -1
- package/dist/monolith/plumbing/ui/DecorationService.js +0 -54
- package/dist/monolith/plumbing/ui/DecorationService.js.map +0 -1
- package/dist/monolith/services/JoyLogService.js +0 -48
- package/dist/monolith/services/JoyLogService.js.map +0 -1
- package/dist/monolith/services/JoyService.js +0 -209
- package/dist/monolith/services/JoyService.js.map +0 -1
- package/dist/monolith/services/MarieSCMProvider.js +0 -41
- package/dist/monolith/services/MarieSCMProvider.js.map +0 -1
- package/dist/webview-ui/main.css +0 -1
- package/dist/webview-ui/main.js +0 -108
- package/lint_output.txt +0 -705
- package/lint_output_v2.txt +0 -711
- package/test-mind-p6.sqlite +0 -0
- package/test-mind-p6.sqlite-shm +0 -0
- package/test-mind-p6.sqlite-wal +0 -0
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { Anthropic } from "@anthropic-ai/sdk";
|
|
2
|
-
import { ConfigService } from "../../config/ConfigService.js";
|
|
3
|
-
import { JsonUtils } from "../../../plumbing/utils/JsonUtils.js";
|
|
4
|
-
export class AnthropicProvider {
|
|
5
|
-
client;
|
|
6
|
-
constructor(apiKey) {
|
|
7
|
-
this.client = new Anthropic({ apiKey });
|
|
8
|
-
}
|
|
9
|
-
async createMessage(params) {
|
|
10
|
-
const response = await this.client.messages.create({
|
|
11
|
-
model: params.model,
|
|
12
|
-
max_tokens: params.max_tokens || 1024,
|
|
13
|
-
system: params.system,
|
|
14
|
-
messages: params.messages,
|
|
15
|
-
tools: params.tools,
|
|
16
|
-
});
|
|
17
|
-
if (!response.content || response.content.length === 0) {
|
|
18
|
-
throw new Error("Anthropic API returned an empty content array.");
|
|
19
|
-
}
|
|
20
|
-
const toolUses = response.content
|
|
21
|
-
.filter((c) => c.type === "tool_use")
|
|
22
|
-
.map((c) => ({
|
|
23
|
-
id: c.id,
|
|
24
|
-
name: c.name,
|
|
25
|
-
input: c.input,
|
|
26
|
-
}));
|
|
27
|
-
return {
|
|
28
|
-
role: "assistant",
|
|
29
|
-
content: response.content,
|
|
30
|
-
tool_uses: toolUses.length > 0 ? toolUses : undefined,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
async createMessageStream(params, onUpdate, signal) {
|
|
34
|
-
const startTime = Date.now();
|
|
35
|
-
onUpdate({ type: "run_started", timestamp: startTime });
|
|
36
|
-
onUpdate({
|
|
37
|
-
type: "stage_change",
|
|
38
|
-
stage: "thinking",
|
|
39
|
-
label: "Processing request...",
|
|
40
|
-
});
|
|
41
|
-
const stream = await this.client.messages.create({
|
|
42
|
-
model: params.model,
|
|
43
|
-
max_tokens: params.max_tokens || 1024,
|
|
44
|
-
system: params.system,
|
|
45
|
-
messages: params.messages,
|
|
46
|
-
tools: params.tools,
|
|
47
|
-
stream: true,
|
|
48
|
-
}, { signal });
|
|
49
|
-
// Use array buffers to avoid string concatenation overhead
|
|
50
|
-
const contentBuffer = [];
|
|
51
|
-
const toolCalls = {};
|
|
52
|
-
let hasStartedContent = false;
|
|
53
|
-
for await (const chunk of stream) {
|
|
54
|
-
if (chunk.type === "content_block_delta" &&
|
|
55
|
-
chunk.delta.type === "text_delta") {
|
|
56
|
-
if (!hasStartedContent) {
|
|
57
|
-
hasStartedContent = true;
|
|
58
|
-
onUpdate({
|
|
59
|
-
type: "stage_change",
|
|
60
|
-
stage: "responding",
|
|
61
|
-
label: "Generating response...",
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
const text = chunk.delta.text;
|
|
65
|
-
contentBuffer.push(text);
|
|
66
|
-
onUpdate({ type: "content_delta", text });
|
|
67
|
-
}
|
|
68
|
-
else if (chunk.type === "content_block_start" &&
|
|
69
|
-
chunk.content_block.type === "tool_use") {
|
|
70
|
-
onUpdate({
|
|
71
|
-
type: "stage_change",
|
|
72
|
-
stage: "calling_tool",
|
|
73
|
-
label: "Using tool...",
|
|
74
|
-
});
|
|
75
|
-
toolCalls[chunk.index] = {
|
|
76
|
-
id: chunk.content_block.id,
|
|
77
|
-
name: chunk.content_block.name,
|
|
78
|
-
inputParts: [],
|
|
79
|
-
};
|
|
80
|
-
onUpdate({
|
|
81
|
-
type: "tool_call_delta",
|
|
82
|
-
index: chunk.index,
|
|
83
|
-
id: chunk.content_block.id,
|
|
84
|
-
name: chunk.content_block.name,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
else if (chunk.type === "content_block_delta" &&
|
|
88
|
-
chunk.delta.type === "input_json_delta") {
|
|
89
|
-
const toolCall = toolCalls[chunk.index];
|
|
90
|
-
if (toolCall) {
|
|
91
|
-
toolCall.inputParts.push(chunk.delta.partial_json);
|
|
92
|
-
onUpdate({
|
|
93
|
-
type: "tool_call_delta",
|
|
94
|
-
index: chunk.index,
|
|
95
|
-
argumentsDelta: chunk.delta.partial_json,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else if (chunk.type === "message_delta" && chunk.usage) {
|
|
100
|
-
onUpdate({
|
|
101
|
-
type: "usage",
|
|
102
|
-
usage: {
|
|
103
|
-
inputTokens: chunk.usage.input_tokens ?? undefined,
|
|
104
|
-
outputTokens: chunk.usage.output_tokens ?? undefined,
|
|
105
|
-
totalTokens: (chunk.usage.input_tokens ?? 0) +
|
|
106
|
-
(chunk.usage.output_tokens ?? 0),
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const endTime = Date.now();
|
|
112
|
-
onUpdate({
|
|
113
|
-
type: "run_completed",
|
|
114
|
-
timestamp: endTime,
|
|
115
|
-
durationMs: endTime - startTime,
|
|
116
|
-
});
|
|
117
|
-
// Join array buffers into final strings
|
|
118
|
-
const fullContent = contentBuffer.join("");
|
|
119
|
-
const finalToolUses = Object.values(toolCalls).map((tc) => ({
|
|
120
|
-
id: tc.id,
|
|
121
|
-
name: tc.name,
|
|
122
|
-
input: JsonUtils.safeParseJson(tc.inputParts.join("")),
|
|
123
|
-
}));
|
|
124
|
-
return {
|
|
125
|
-
role: "assistant",
|
|
126
|
-
content: fullContent,
|
|
127
|
-
tool_uses: finalToolUses.length > 0 ? finalToolUses : undefined,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Efficiently estimates tokens via character count.
|
|
132
|
-
* Uses ConfigService.getTokensPerChar() (default 0.25 tokens/char).
|
|
133
|
-
*/
|
|
134
|
-
estimateTokens(text) {
|
|
135
|
-
const tokensPerChar = ConfigService.getTokensPerChar();
|
|
136
|
-
return Math.ceil(text.length * tokensPerChar);
|
|
137
|
-
}
|
|
138
|
-
async listModels() {
|
|
139
|
-
return [
|
|
140
|
-
{ id: "claude-3-5-sonnet-20241022", name: "Claude 3.5 Sonnet (Latest)" },
|
|
141
|
-
{ id: "claude-3-5-haiku-20241022", name: "Claude 3.5 Haiku" },
|
|
142
|
-
{ id: "claude-3-opus-20240229", name: "Claude 3 Opus" },
|
|
143
|
-
{ id: "claude-3-sonnet-20240229", name: "Claude 3 Sonnet" },
|
|
144
|
-
{ id: "claude-3-haiku-20240307", name: "Claude 3 Haiku" },
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
async createEmbedding(_text) {
|
|
148
|
-
// Anthropic does not currently provide an embeddings API.
|
|
149
|
-
// Users requiring semantic sovereignty should use OpenRouter or a dedicated embedding provider.
|
|
150
|
-
// Returning a zeroed vector as a passive fallback.
|
|
151
|
-
return new Array(1536).fill(0);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=AnthropicProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnthropicProvider.js","sourceRoot":"","sources":["../../../../../src/monolith/infrastructure/ai/providers/AnthropicProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAO9C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAY;IAE1B,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAuB;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YACjD,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,IAAI;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,QAAQ,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k";
|
|
2
|
-
import { ConfigService } from "../../config/ConfigService.js";
|
|
3
|
-
import { JsonUtils } from "../../../plumbing/utils/JsonUtils.js";
|
|
4
|
-
import { getErrorMessage } from "../../../plumbing/utils/ErrorUtils.js";
|
|
5
|
-
export class CerebrasProvider {
|
|
6
|
-
client;
|
|
7
|
-
constructor(apiKey) {
|
|
8
|
-
this.client = new Cerebras({ apiKey });
|
|
9
|
-
}
|
|
10
|
-
async createMessage(params) {
|
|
11
|
-
try {
|
|
12
|
-
const response = await this.client.chat.completions.create({
|
|
13
|
-
model: params.model,
|
|
14
|
-
messages: this.convertMessages(params.messages),
|
|
15
|
-
tools: this.convertTools(params.tools),
|
|
16
|
-
max_tokens: params.max_tokens || 1024,
|
|
17
|
-
});
|
|
18
|
-
const completion = response;
|
|
19
|
-
const choice = completion.choices[0].message;
|
|
20
|
-
if (choice.tool_calls && choice.tool_calls.length > 0) {
|
|
21
|
-
return {
|
|
22
|
-
role: "assistant",
|
|
23
|
-
content: choice.content || "",
|
|
24
|
-
tool_uses: choice.tool_calls.map((tc) => ({
|
|
25
|
-
id: tc.id,
|
|
26
|
-
name: tc.function.name,
|
|
27
|
-
input: JsonUtils.safeParseJson(tc.function.arguments),
|
|
28
|
-
})),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
role: "assistant",
|
|
33
|
-
content: choice.content || "",
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
throw new Error(`Cerebras API Error: ${getErrorMessage(error)}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async createMessageStream(params, onUpdate, signal) {
|
|
41
|
-
const startTime = Date.now();
|
|
42
|
-
onUpdate({ type: "run_started", timestamp: startTime });
|
|
43
|
-
onUpdate({
|
|
44
|
-
type: "stage_change",
|
|
45
|
-
stage: "thinking",
|
|
46
|
-
label: "Processing request...",
|
|
47
|
-
});
|
|
48
|
-
try {
|
|
49
|
-
// Cerebras SDK does not natively support AbortSignal in the create method yet,
|
|
50
|
-
// but we can handle the stream consumption loop and break if aborted.
|
|
51
|
-
const stream = await this.client.chat.completions.create({
|
|
52
|
-
model: params.model,
|
|
53
|
-
messages: this.convertMessages(params.messages),
|
|
54
|
-
tools: this.convertTools(params.tools),
|
|
55
|
-
max_tokens: params.max_tokens || 1024,
|
|
56
|
-
stream: true,
|
|
57
|
-
}, { abortSignal: signal });
|
|
58
|
-
// Use array buffers to avoid string concatenation overhead
|
|
59
|
-
const contentBuffer = [];
|
|
60
|
-
const toolCalls = {};
|
|
61
|
-
let hasStartedContent = false;
|
|
62
|
-
for await (const chunk of stream) {
|
|
63
|
-
if (signal?.aborted) {
|
|
64
|
-
throw new Error("Cerebras request aborted by user.");
|
|
65
|
-
}
|
|
66
|
-
const chunkData = chunk;
|
|
67
|
-
const delta = chunkData.choices[0]?.delta;
|
|
68
|
-
if (!delta)
|
|
69
|
-
continue;
|
|
70
|
-
if (delta.content) {
|
|
71
|
-
if (!hasStartedContent) {
|
|
72
|
-
hasStartedContent = true;
|
|
73
|
-
onUpdate({
|
|
74
|
-
type: "stage_change",
|
|
75
|
-
stage: "responding",
|
|
76
|
-
label: "Generating response...",
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
contentBuffer.push(delta.content);
|
|
80
|
-
onUpdate({ type: "content_delta", text: delta.content });
|
|
81
|
-
}
|
|
82
|
-
if (delta.tool_calls) {
|
|
83
|
-
onUpdate({
|
|
84
|
-
type: "stage_change",
|
|
85
|
-
stage: "calling_tool",
|
|
86
|
-
label: "Using tool...",
|
|
87
|
-
});
|
|
88
|
-
for (const tc of delta.tool_calls) {
|
|
89
|
-
const index = tc.index;
|
|
90
|
-
if (tc.id) {
|
|
91
|
-
toolCalls[index] = {
|
|
92
|
-
id: tc.id,
|
|
93
|
-
name: tc.function?.name || "",
|
|
94
|
-
inputParts: [],
|
|
95
|
-
};
|
|
96
|
-
onUpdate({
|
|
97
|
-
type: "tool_call_delta",
|
|
98
|
-
index: index,
|
|
99
|
-
id: tc.id,
|
|
100
|
-
name: tc.function?.name,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
if (tc.function?.arguments) {
|
|
104
|
-
if (toolCalls[index]) {
|
|
105
|
-
toolCalls[index].inputParts.push(tc.function.arguments);
|
|
106
|
-
}
|
|
107
|
-
onUpdate({
|
|
108
|
-
type: "tool_call_delta",
|
|
109
|
-
index: index,
|
|
110
|
-
argumentsDelta: tc.function.arguments,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (chunk.usage) {
|
|
116
|
-
const usage = chunk.usage;
|
|
117
|
-
onUpdate({
|
|
118
|
-
type: "usage",
|
|
119
|
-
usage: {
|
|
120
|
-
inputTokens: usage.prompt_tokens,
|
|
121
|
-
outputTokens: usage.completion_tokens,
|
|
122
|
-
totalTokens: usage.total_tokens,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const endTime = Date.now();
|
|
128
|
-
onUpdate({
|
|
129
|
-
type: "run_completed",
|
|
130
|
-
timestamp: endTime,
|
|
131
|
-
durationMs: endTime - startTime,
|
|
132
|
-
});
|
|
133
|
-
// Join array buffers into final strings
|
|
134
|
-
const fullContent = contentBuffer.join("");
|
|
135
|
-
const finalToolUses = Object.values(toolCalls).map((tc) => ({
|
|
136
|
-
id: tc.id,
|
|
137
|
-
name: tc.name,
|
|
138
|
-
input: JsonUtils.safeParseJson(tc.inputParts.join("")),
|
|
139
|
-
}));
|
|
140
|
-
const blocks = [];
|
|
141
|
-
if (fullContent)
|
|
142
|
-
blocks.push({ type: "text", text: fullContent });
|
|
143
|
-
return {
|
|
144
|
-
role: "assistant",
|
|
145
|
-
content: blocks.length > 0 ? blocks : fullContent,
|
|
146
|
-
tool_uses: finalToolUses.length > 0 ? finalToolUses : undefined,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
throw new Error(`Cerebras Stream Error: ${getErrorMessage(error)}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
estimateTokens(text) {
|
|
154
|
-
return Math.ceil(text.length * ConfigService.getTokensPerChar());
|
|
155
|
-
}
|
|
156
|
-
async listModels() {
|
|
157
|
-
// Hardcoded list for now as Cerebras is compatible with Llama models
|
|
158
|
-
return [
|
|
159
|
-
{ id: "llama3.1-8b", name: "Llama 3.1 8B" },
|
|
160
|
-
{ id: "llama3.1-70b", name: "Llama 3.1 70B" },
|
|
161
|
-
];
|
|
162
|
-
}
|
|
163
|
-
async createEmbedding(_text) {
|
|
164
|
-
// Cerebras recently added embedding support (e.g., bge-large-en-v1.5).
|
|
165
|
-
// For simplicity and alignment with local testing, we use a zeroed vector fallback
|
|
166
|
-
// unless a dedicated embedding integration is requested.
|
|
167
|
-
return new Array(1024).fill(0); // BGE Large usually has 1024 dims
|
|
168
|
-
}
|
|
169
|
-
convertMessages(messages) {
|
|
170
|
-
// Convert Anthropic-style messages to OpenAI/Cerebras format
|
|
171
|
-
return messages.map((msg) => {
|
|
172
|
-
if (Array.isArray(msg.content)) {
|
|
173
|
-
// Handle tools/text blocks
|
|
174
|
-
const content = msg.content.map((block) => {
|
|
175
|
-
if (block.type === "text")
|
|
176
|
-
return { type: "text", text: block.text };
|
|
177
|
-
// ... other block conversions if necessary, Cerebras expects standard OpenAI format usually
|
|
178
|
-
return block;
|
|
179
|
-
});
|
|
180
|
-
// Simplification: join text parts if valid
|
|
181
|
-
const textParts = msg.content
|
|
182
|
-
.filter((c) => c.type === "text")
|
|
183
|
-
.map((c) => c.text)
|
|
184
|
-
.join("");
|
|
185
|
-
// Check for tool result
|
|
186
|
-
const toolResult = msg.content.find((c) => c.type === "tool_result");
|
|
187
|
-
if (toolResult) {
|
|
188
|
-
return {
|
|
189
|
-
role: "tool",
|
|
190
|
-
tool_call_id: toolResult.tool_use_id,
|
|
191
|
-
content: typeof toolResult.content === "string"
|
|
192
|
-
? toolResult.content
|
|
193
|
-
: JSON.stringify(toolResult.content),
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
return { role: msg.role, content: textParts };
|
|
197
|
-
}
|
|
198
|
-
return { role: msg.role, content: msg.content };
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
convertTools(tools) {
|
|
202
|
-
if (!tools)
|
|
203
|
-
return undefined;
|
|
204
|
-
return tools.map((tool) => ({
|
|
205
|
-
type: "function",
|
|
206
|
-
function: {
|
|
207
|
-
name: tool.name,
|
|
208
|
-
description: tool.description,
|
|
209
|
-
parameters: tool.input_schema,
|
|
210
|
-
},
|
|
211
|
-
}));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
//# sourceMappingURL=CerebrasProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CerebrasProvider.js","sourceRoot":"","sources":["../../../../../src/monolith/infrastructure/ai/providers/CerebrasProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAOxD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAW;IAEzB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAuB;QACzC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;gBACzD,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC/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as vscode from "vscode";
|
|
2
|
-
// Decoration for Creates (Blue/Cyan with Sparkle)
|
|
3
|
-
const createDecorationType = vscode.window.createTextEditorDecorationType({
|
|
4
|
-
backgroundColor: "rgba(0, 255, 255, 0.1)", // Light Cyan background
|
|
5
|
-
isWholeLine: false,
|
|
6
|
-
overviewRulerColor: "rgba(0, 255, 255, 0.8)",
|
|
7
|
-
overviewRulerLane: vscode.OverviewRulerLane.Right,
|
|
8
|
-
after: {
|
|
9
|
-
contentText: " ✨ Marie Created",
|
|
10
|
-
color: "rgba(0, 255, 255, 0.7)",
|
|
11
|
-
margin: "0 0 0 20px",
|
|
12
|
-
fontWeight: "bold",
|
|
13
|
-
},
|
|
14
|
-
gutterIconPath: vscode.Uri.parse("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDBmZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTggMEw5LjUgNi41TDE2IDhMOS41IDkuNUw4IDE2TDYuNSA5LjVMMCA4TDYuNSA2LjVMOCAwWiIgZmlsbD0idXJsKCNncmFkKSIvPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0iZ3JhZCIgeDE9IjAiIHkxPSIwIiB4Mj0iMTYiIHkyPSIxNiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZmZiIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2ZmYjdjNSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjwvc3ZnPg=="), // Refined Sparkle with Sakura Gradient
|
|
15
|
-
gutterIconSize: "contain",
|
|
16
|
-
});
|
|
17
|
-
// Decoration for Modifications (Green with Pencil)
|
|
18
|
-
const modifyDecorationType = vscode.window.createTextEditorDecorationType({
|
|
19
|
-
backgroundColor: "rgba(100, 255, 100, 0.1)", // Light Green background
|
|
20
|
-
isWholeLine: false,
|
|
21
|
-
overviewRulerColor: "rgba(100, 255, 100, 0.8)",
|
|
22
|
-
overviewRulerLane: vscode.OverviewRulerLane.Right,
|
|
23
|
-
after: {
|
|
24
|
-
contentText: " ✏️ Marie Modified",
|
|
25
|
-
color: "rgba(100, 255, 100, 0.7)",
|
|
26
|
-
margin: "0 0 0 20px",
|
|
27
|
-
fontWeight: "bold",
|
|
28
|
-
},
|
|
29
|
-
gutterIconPath: vscode.Uri.parse("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNDJkZjc4IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTMgMTNWNU0zIDExTDExIDNNMTEgNWwtMi0yTDMgMTFsMiAyIi8+PC9zdmc+"), // Refined Git-themed Pencil
|
|
30
|
-
gutterIconSize: "contain",
|
|
31
|
-
});
|
|
32
|
-
export const DecorationService = {
|
|
33
|
-
/**
|
|
34
|
-
* Highlights a range with the "Created by Marie" decoration.
|
|
35
|
-
*/
|
|
36
|
-
decorateCreation(editor, range) {
|
|
37
|
-
editor.setDecorations(createDecorationType, [range]);
|
|
38
|
-
// Remove decoration after a short delay
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
editor.setDecorations(createDecorationType, []);
|
|
41
|
-
}, 2000);
|
|
42
|
-
},
|
|
43
|
-
/**
|
|
44
|
-
* Highlights a range with the "Modified by Marie" decoration.
|
|
45
|
-
*/
|
|
46
|
-
decorateModification(editor, range) {
|
|
47
|
-
editor.setDecorations(modifyDecorationType, [range]);
|
|
48
|
-
// Remove decoration after a short delay
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
editor.setDecorations(modifyDecorationType, []);
|
|
51
|
-
}, 2000);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=DecorationService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DecorationService.js","sourceRoot":"","sources":["../../../../src/monolith/plumbing/ui/DecorationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,kDAAkD;AAClD,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC;IACxE,eAAe,EAAE,wBAAwB,EAAE,wBAAwB;IACnE,WAAW,EAAE,KAAK;IAClB,kBAAkB,EAAE,wBAAwB;IAC5C,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,CAAC,KAAK;IACjD,KAAK,EAAE;QACL,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,wBAAwB;QAC/B,MAAM,EAAE,YAAY;QACpB,UAAU,EAAE,MAAM;KACnB;IACD,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAC9B,wmBAAwmB,CACzmB,EAAE,uCAAuC;IAC1C,cAAc,EAAE,SAAS;CAC1B,CAAC,CAAC;AAEH,mDAAmD;AACnD,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC;IACxE,eAAe,EAAE,0BAA0B,EAAE,yBAAyB;IACtE,WAAW,EAAE,KAAK;IAClB,kBAAkB,EAAE,0BAA0B;IAC9C,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,CAAC,KAAK;IACjD,KAAK,EAAE;QACL,WAAW,EAAE,oBAAoB;QACjC,KAAK,EAAE,0BAA0B;QACjC,MAAM,EAAE,YAAY;QACpB,UAAU,EAAE,MAAM;KACnB;IACD,cAAc,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAC9B,gTAAgT,CACjT,EAAE,4BAA4B;IAC/B,cAAc,EAAE,SAAS;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;OAEG;IACH,gBAAgB,CAAC,MAAyB,EAAE,KAAmB;QAC7D,MAAM,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAErD,wCAAwC;QACxC,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,CAAC,cAAc,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,MAAyB,EAAE,KAAmB;QACjE,MAAM,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAErD,wCAAwC;QACxC,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,CAAC,cAAc,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC;CACF,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as vscode from "vscode";
|
|
2
|
-
export class JoyLogService {
|
|
3
|
-
context;
|
|
4
|
-
static STORAGE_KEY = "marie.joyLog";
|
|
5
|
-
_log = [];
|
|
6
|
-
_onAchievementAdded = new vscode.EventEmitter();
|
|
7
|
-
onAchievementAdded = this._onAchievementAdded.event;
|
|
8
|
-
constructor(context) {
|
|
9
|
-
this.context = context;
|
|
10
|
-
this._loadLog();
|
|
11
|
-
}
|
|
12
|
-
_loadLog() {
|
|
13
|
-
const saved = this.context.globalState.get(JoyLogService.STORAGE_KEY);
|
|
14
|
-
this._log = saved || [];
|
|
15
|
-
}
|
|
16
|
-
async addAchievement(description, points = 10) {
|
|
17
|
-
const achievement = {
|
|
18
|
-
id: Math.random().toString(36).substring(7),
|
|
19
|
-
description,
|
|
20
|
-
timestamp: Date.now(),
|
|
21
|
-
points,
|
|
22
|
-
};
|
|
23
|
-
this._log.unshift(achievement);
|
|
24
|
-
// Keep last 100 achievements
|
|
25
|
-
if (this._log.length > 100) {
|
|
26
|
-
this._log = this._log.slice(0, 100);
|
|
27
|
-
}
|
|
28
|
-
await this.context.globalState.update(JoyLogService.STORAGE_KEY, this._log);
|
|
29
|
-
this._onAchievementAdded.fire(achievement);
|
|
30
|
-
return achievement;
|
|
31
|
-
}
|
|
32
|
-
getLog() {
|
|
33
|
-
return this._log;
|
|
34
|
-
}
|
|
35
|
-
getStats() {
|
|
36
|
-
const totalPoints = this._log.reduce((acc, curr) => acc + curr.points, 0);
|
|
37
|
-
return {
|
|
38
|
-
totalPoints,
|
|
39
|
-
count: this._log.length,
|
|
40
|
-
recent: this._log.slice(0, 5),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
async clearLog() {
|
|
44
|
-
this._log = [];
|
|
45
|
-
await this.context.globalState.update(JoyLogService.STORAGE_KEY, []);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=JoyLogService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JoyLogService.js","sourceRoot":"","sources":["../../../src/monolith/services/JoyLogService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AASjC,MAAM,OAAO,aAAa;IAQK;IAPrB,MAAM,CAAU,WAAW,GAAG,cAAc,CAAC;IAC7C,IAAI,GAAsB,EAAE,CAAC;IAEpB,mBAAmB,GAClC,IAAI,MAAM,CAAC,YAAY,EAAmB,CAAC;IAC7B,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC;IAEpE,YAA6B,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAEO,QAAQ;QACd,MAAM,KAAK,G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