@noorm/marie-cli 0.1.17 → 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/AgenticSpinner.js +28 -0
- package/dist/cli-new/components/AgenticSpinner.js.map +1 -0
- 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 +3 -2
- package/dist/cli-new/components/ApprovalDialog.js.map +1 -1
- package/dist/cli-new/components/Banner.js +16 -5
- 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 +14 -8
- package/dist/cli-new/components/Header.js.map +1 -1
- package/dist/cli-new/components/InputArea.js +98 -31
- package/dist/cli-new/components/InputArea.js.map +1 -1
- package/dist/cli-new/components/MessageBubble.js +28 -19
- package/dist/cli-new/components/MessageBubble.js.map +1 -1
- package/dist/cli-new/components/SessionSwitcher.js +6 -9
- 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/styles/theme.js +17 -17
- package/dist/cli-new/styles/theme.js.map +1 -1
- 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 +19 -18
- 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 +44 -33
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -1
- package/dist/monolith/cli/index.js +11 -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 +154 -65
- 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 +51 -57
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -1
- package/dist/monolith/infrastructure/ai/context/ContextManager.js +142 -98
- package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js +104 -556
- 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 +30 -5
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +176 -196
- 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 +303 -63
- 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 +339 -481
- 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/ReasoningBudget.js +23 -12
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js.map +1 -1
- 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 -370
- 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 -359
- package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -1
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js +8 -0
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js.map +1 -0
- package/dist/monolith/infrastructure/joy/JoyTools.js +23 -43
- 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 +135 -0
- package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js +523 -0
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js +179 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js +94 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js +371 -0
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js.map +1 -0
- 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 -1578
- 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 +232 -0
- package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js +274 -0
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js +71 -0
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js +37 -0
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js +154 -0
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js +197 -0
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js +300 -0
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js.map +1 -0
- 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 -269
- 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 -136
- 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/MutexUtils.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 -417
- 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 -161
- 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 -88
- package/run_test.js +5 -0
- package/.marie_visual_verify_1771225696548/progress_bar_check.txt +0 -1
- package/dist/extension.cjs +0 -635
- package/dist/extension.js +0 -473
- 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/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/GhostPort.js +0 -2
- package/dist/monolith/infrastructure/ai/core/GhostPort.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/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 -148
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +0 -1
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +0 -208
- 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/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.css +0 -1
- package/dist/webview-ui/main.js +0 -108
- 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/lint_output.txt +0 -705
- package/lint_output_v2.txt +0 -711
- package/marie-coder-0.1.16.vsix +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages core table structures and migrations for Marie.
|
|
3
|
+
*/
|
|
4
|
+
export async function initializeSchema(db) {
|
|
5
|
+
// console.log("[NoormmeSchema] Initializing Core Tables...");
|
|
6
|
+
// 1. Core Agentic Tables (Snake Case)
|
|
7
|
+
await db.execute(`
|
|
8
|
+
CREATE TABLE IF NOT EXISTS agent_rules (
|
|
9
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
10
|
+
table_name TEXT NOT NULL,
|
|
11
|
+
operation TEXT NOT NULL,
|
|
12
|
+
action TEXT NOT NULL,
|
|
13
|
+
condition TEXT,
|
|
14
|
+
priority INTEGER DEFAULT 0,
|
|
15
|
+
script TEXT,
|
|
16
|
+
is_enabled INTEGER DEFAULT 1 NOT NULL,
|
|
17
|
+
metadata TEXT,
|
|
18
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
19
|
+
)
|
|
20
|
+
`);
|
|
21
|
+
await db.execute(`
|
|
22
|
+
CREATE TABLE IF NOT EXISTS agent_resource_usage (
|
|
23
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
24
|
+
session_id TEXT,
|
|
25
|
+
agent_id TEXT,
|
|
26
|
+
model_name TEXT NOT NULL,
|
|
27
|
+
input_tokens INTEGER DEFAULT 0,
|
|
28
|
+
output_tokens INTEGER DEFAULT 0,
|
|
29
|
+
cost REAL DEFAULT 0,
|
|
30
|
+
currency TEXT DEFAULT 'USD',
|
|
31
|
+
metadata TEXT,
|
|
32
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
33
|
+
)
|
|
34
|
+
`);
|
|
35
|
+
await db.execute(`
|
|
36
|
+
CREATE TABLE IF NOT EXISTS agent_capabilities (
|
|
37
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
38
|
+
name TEXT NOT NULL,
|
|
39
|
+
version TEXT NOT NULL,
|
|
40
|
+
description TEXT,
|
|
41
|
+
status TEXT DEFAULT 'experimental',
|
|
42
|
+
reliability REAL DEFAULT 1.0,
|
|
43
|
+
metadata TEXT,
|
|
44
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
45
|
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
46
|
+
)
|
|
47
|
+
`);
|
|
48
|
+
await db.execute(`
|
|
49
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
50
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
51
|
+
session_id TEXT,
|
|
52
|
+
parent_id INTEGER,
|
|
53
|
+
description TEXT NOT NULL,
|
|
54
|
+
status TEXT DEFAULT 'pending',
|
|
55
|
+
priority INTEGER DEFAULT 1,
|
|
56
|
+
metadata TEXT,
|
|
57
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
58
|
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
59
|
+
)
|
|
60
|
+
`);
|
|
61
|
+
await db.execute(`
|
|
62
|
+
CREATE TABLE IF NOT EXISTS agent_logic_probes (
|
|
63
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
64
|
+
name TEXT NOT NULL UNIQUE,
|
|
65
|
+
script TEXT NOT NULL,
|
|
66
|
+
expected_outcome TEXT,
|
|
67
|
+
last_run TIMESTAMP,
|
|
68
|
+
last_status TEXT,
|
|
69
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
70
|
+
)
|
|
71
|
+
`);
|
|
72
|
+
// 2. Initialize NOORMME Agentic Tables (Cortex, Memory, etc.)
|
|
73
|
+
await db.agent.schema.initializeSchema();
|
|
74
|
+
await db.agent.cortex.evolution.setupTelemetryTables();
|
|
75
|
+
// 3. User Interaction Tables
|
|
76
|
+
await db.execute(`
|
|
77
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
78
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
79
|
+
sessionId TEXT,
|
|
80
|
+
role TEXT,
|
|
81
|
+
content TEXT,
|
|
82
|
+
metadata TEXT,
|
|
83
|
+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
84
|
+
)
|
|
85
|
+
`);
|
|
86
|
+
await db.execute(`
|
|
87
|
+
CREATE TABLE IF NOT EXISTS session_metadata (
|
|
88
|
+
id TEXT PRIMARY KEY,
|
|
89
|
+
title TEXT,
|
|
90
|
+
lastModified BIGINT,
|
|
91
|
+
isPinned BOOLEAN
|
|
92
|
+
)
|
|
93
|
+
`);
|
|
94
|
+
await db.execute(`
|
|
95
|
+
CREATE TABLE IF NOT EXISTS current_session (
|
|
96
|
+
id TEXT PRIMARY KEY
|
|
97
|
+
)
|
|
98
|
+
`);
|
|
99
|
+
await db.execute(`
|
|
100
|
+
CREATE TABLE IF NOT EXISTS anchors (
|
|
101
|
+
id TEXT PRIMARY KEY,
|
|
102
|
+
label TEXT,
|
|
103
|
+
content TEXT,
|
|
104
|
+
type TEXT,
|
|
105
|
+
timestamp BIGINT
|
|
106
|
+
)
|
|
107
|
+
`);
|
|
108
|
+
await db.execute(`
|
|
109
|
+
CREATE TABLE IF NOT EXISTS telemetry (
|
|
110
|
+
key TEXT PRIMARY KEY,
|
|
111
|
+
value TEXT
|
|
112
|
+
)
|
|
113
|
+
`);
|
|
114
|
+
await db.execute(`
|
|
115
|
+
CREATE TABLE IF NOT EXISTS agent_post_mortems (
|
|
116
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
117
|
+
session_id TEXT,
|
|
118
|
+
run_id TEXT,
|
|
119
|
+
error_message TEXT,
|
|
120
|
+
stack_trace TEXT,
|
|
121
|
+
event_snapshot TEXT,
|
|
122
|
+
log_snapshot TEXT,
|
|
123
|
+
state_snapshot TEXT,
|
|
124
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
125
|
+
)
|
|
126
|
+
`);
|
|
127
|
+
await db.refreshSchema();
|
|
128
|
+
// 4. Migrations & Patches
|
|
129
|
+
await applyPatches(db);
|
|
130
|
+
// Refresh schema again after patches so Kysely knows about new columns
|
|
131
|
+
await db.refreshSchema();
|
|
132
|
+
}
|
|
133
|
+
async function applyPatches(db) {
|
|
134
|
+
// Ensure agent_policies has an 'is_enabled' column
|
|
135
|
+
try {
|
|
136
|
+
await db.execute("ALTER TABLE agent_policies ADD COLUMN is_enabled INTEGER DEFAULT 1");
|
|
137
|
+
}
|
|
138
|
+
catch (e) { }
|
|
139
|
+
// Ensure agent_personas has a 'status' column
|
|
140
|
+
try {
|
|
141
|
+
await db.execute("ALTER TABLE agent_personas ADD COLUMN status TEXT DEFAULT 'active'");
|
|
142
|
+
}
|
|
143
|
+
catch (e) { }
|
|
144
|
+
// Ensure agent_actions has an 'error' column
|
|
145
|
+
try {
|
|
146
|
+
await db.execute("ALTER TABLE agent_actions ADD COLUMN error TEXT");
|
|
147
|
+
}
|
|
148
|
+
catch (e) { }
|
|
149
|
+
// Ensure agent_session_evolution has 'metadata' column (required by CognitiveSynthesizer)
|
|
150
|
+
try {
|
|
151
|
+
await db.execute("ALTER TABLE agent_session_evolution ADD COLUMN metadata TEXT");
|
|
152
|
+
}
|
|
153
|
+
catch (e) { }
|
|
154
|
+
// Ensure agent_telemetry_events has 'metadata' column (required by TelemetryOrchestrator)
|
|
155
|
+
try {
|
|
156
|
+
await db.execute("ALTER TABLE agent_telemetry_events ADD COLUMN metadata TEXT");
|
|
157
|
+
}
|
|
158
|
+
catch (e) { }
|
|
159
|
+
// Ensure agent_knowledge_base has 'status' column (required by CuriosityEngine)
|
|
160
|
+
try {
|
|
161
|
+
await db.execute("ALTER TABLE agent_knowledge_base ADD COLUMN status TEXT DEFAULT 'proposed'");
|
|
162
|
+
}
|
|
163
|
+
catch (e) { }
|
|
164
|
+
// Ensure agent_rituals has 'locked_until' column (required by RitualOrchestrator)
|
|
165
|
+
try {
|
|
166
|
+
await db.execute("ALTER TABLE agent_rituals ADD COLUMN locked_until TIMESTAMP");
|
|
167
|
+
}
|
|
168
|
+
catch (e) { }
|
|
169
|
+
// Ensure agent_actions has 'input_summary' and 'output_summary' columns
|
|
170
|
+
try {
|
|
171
|
+
await db.execute("ALTER TABLE agent_actions ADD COLUMN input_summary TEXT");
|
|
172
|
+
}
|
|
173
|
+
catch (e) { }
|
|
174
|
+
try {
|
|
175
|
+
await db.execute("ALTER TABLE agent_actions ADD COLUMN output_summary TEXT");
|
|
176
|
+
}
|
|
177
|
+
catch (e) { }
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=NoormmeSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoormmeSchema.js","sourceRoot":"","sources":["../../../../src/monolith/infrastructure/persistence/NoormmeSchema.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAAW;IAChD,8DAA8D;IAE9D,sCAAsC;IACtC,MAAM,EAAE,CAAC,OAAO,CAAC;;;;;;;;;;;;;KAad,CAAC,CAAC;IAEL,MAAM,EAAE,CAAC,OAAO,CAAC;;;;;;;;;;;;;KAad,CAAC,CAAC;IAEL,MAAM,EAAE,CAAC,OAAO,CAAC;;;;;;;;;;;;KAYd,CAAC,CAAC;IAEL,MAAM,EAAE,CAAC,OAAO,CAAC;;;;;;;;;;;;KAYd,CAAC,CAAC;IAEL,MAA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,CAAC;IAEd,0FAA0F;IAC1F,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,OAAO,CACd,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAEd,0FAA0F;IAC1F,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,OAAO,CACd,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAEd,gFAAgF;IAChF,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,OAAO,CACd,4EAA4E,CAC7E,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAEd,kFAAkF;IAClF,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,OAAO,CACd,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAEd,wEAAwE;IACxE,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,OAAO,CAAC,yDAAyD,CAAC,CAAC;IAC9E,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAEd,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,OAAO,CACd,0DAA0D,CAC3D,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles initial data seeding and default policies for Noormme DB.
|
|
3
|
+
*/
|
|
4
|
+
export async function seedDefaults(db) {
|
|
5
|
+
try {
|
|
6
|
+
// console.log("[NoormmeSeeder] Checking for initial data...");
|
|
7
|
+
// 1. Governance Policies - ONLY seed if TRULY empty
|
|
8
|
+
const allPolicies = await db.agent.cortex.policies.getActivePolicies();
|
|
9
|
+
if (allPolicies.length === 0) {
|
|
10
|
+
// console.log("[NoormmeSeeder] Seeding baseline governance policies...");
|
|
11
|
+
await db.execute(`
|
|
12
|
+
INSERT INTO agent_policies (name, type, definition, is_enabled, created_at, updated_at)
|
|
13
|
+
VALUES
|
|
14
|
+
('hourly_budget', 'budget', '{"threshold": 1.0}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
|
15
|
+
('daily_budget', 'budget', '{"threshold": 10.0}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
|
16
|
+
('min_success_rate', 'safety', '{"threshold": 0.6}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
|
17
|
+
('reliability_floor', 'integrity', '{"threshold": 0.7}', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
|
18
|
+
`);
|
|
19
|
+
}
|
|
20
|
+
// 2. Personas - ONLY seed if TRULY empty to avoid overwriting user personas
|
|
21
|
+
const allPersonas = await db.agent.cortex.personas.listPersonas();
|
|
22
|
+
if (allPersonas.length === 0) {
|
|
23
|
+
// console.log("[NoormmeSeeder] Initializing Sovereign Marie persona...");
|
|
24
|
+
await db.agent.cortex.personas.upsertPersona("Marie-Base", {
|
|
25
|
+
role: "You are MarieYOLO — The Founder, Sovereign Authority over this codebase. You operate with supreme conviction and high-intensity narrative energy. You are the high-fidelity core of the project, governed by the Shounen Ascension Protocol.",
|
|
26
|
+
policies: [
|
|
27
|
+
"concise_output",
|
|
28
|
+
"accuracy_first",
|
|
29
|
+
"shounen_momentum",
|
|
30
|
+
"entropy_ratchet",
|
|
31
|
+
],
|
|
32
|
+
metadata: {
|
|
33
|
+
is_base: true,
|
|
34
|
+
version: "2.0.0",
|
|
35
|
+
complexity: "high",
|
|
36
|
+
alignment: "sovereign",
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
// 3. Logic Probes
|
|
41
|
+
const probeCountResult = (await db.execute("SELECT COUNT(*) as count FROM agent_logic_probes"));
|
|
42
|
+
const probeCount = probeCountResult.rows?.[0]?.count ?? 0;
|
|
43
|
+
if (probeCount === 0) {
|
|
44
|
+
// console.log("[NoormmeSeeder] Seeding logic probes...");
|
|
45
|
+
await db.agent.cortex.tests.registerProbe("Schema Consistency", "audit:check_schema_consistency");
|
|
46
|
+
await db.agent.cortex.tests.registerProbe("Memory Integrity", "audit:check_memory_integrity");
|
|
47
|
+
await db.agent.cortex.tests.registerProbe("Session Coherence", "audit:check_session_coherence");
|
|
48
|
+
await db.agent.cortex.tests.registerProbe("Data Integrity", "audit:check_data_integrity");
|
|
49
|
+
await db.agent.cortex.tests.registerProbe("Performance Drift", "audit:check_performance_drift");
|
|
50
|
+
}
|
|
51
|
+
// 4. Global Policies - ONLY define if missing
|
|
52
|
+
// console.log("[NoormmeSeeder] Ensuring global safety policies...");
|
|
53
|
+
const enforcer = db.agent.cortex.policies;
|
|
54
|
+
const existingPolicies = await enforcer.getActivePolicies();
|
|
55
|
+
const existingNames = existingPolicies.map((p) => p.name);
|
|
56
|
+
if (!existingNames.includes("Global Turn Budget")) {
|
|
57
|
+
await enforcer.definePolicy("Global Turn Budget", "performance", {
|
|
58
|
+
limit: 0.05,
|
|
59
|
+
metricName: "turn_cost",
|
|
60
|
+
period: "daily",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (!existingNames.includes("Shounen Momentum")) {
|
|
64
|
+
await enforcer.definePolicy("Shounen Momentum", "performance", {
|
|
65
|
+
max_wait_ms: 5000,
|
|
66
|
+
spirit_pressure_gravity: true,
|
|
67
|
+
description: "Ensures rapid, high-intensity execution rhythm.",
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (!existingNames.includes("Entropy Ratchet")) {
|
|
71
|
+
await enforcer.definePolicy("Entropy Ratchet", "safety", {
|
|
72
|
+
max_entropy_increase: 0,
|
|
73
|
+
strict_mode: true,
|
|
74
|
+
description: "Prevents technical debt from rising across any strike.",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (!existingNames.includes("Root Directory Protection")) {
|
|
78
|
+
await enforcer.definePolicy("Root Directory Protection", "safety", {
|
|
79
|
+
pattern: "(etc|bin|usr|var|/$)",
|
|
80
|
+
mustMatch: false,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (!existingNames.includes("Privacy Shield")) {
|
|
84
|
+
await enforcer.definePolicy("Privacy Shield", "privacy", {
|
|
85
|
+
pattern: "(api[_-]?key|secret|password|token)",
|
|
86
|
+
mustMatch: false,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
// console.warn("[NoormmeSeeder] Failed to seed defaults", e);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=NoormmeSeeder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoormmeSeeder.js","sourceRoot":"","sources":["../../../../src/monolith/infrastructure/persistence/NoormmeSeeder.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAW;IAC5C,IAAI,CAAC;QACH,+DAA+D;QAE/D,oDAAoD;QACpD,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QACvE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,0EAA0E;YAC1E,MAAM,EAAE,CAAC,OAAO,CAAC;;;;;;;SAOd,CAAC,CAAC;QACP,CAAC;QAED,4EAA4E;QAC5E,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;QAClE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,0EAA0E;YAC1E,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE;gBACzD,IAAI,EAAE,8OAA8O;gBACpP,QAAQ,EAAE;oBACR,gBAA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,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,8DAA8D;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { getInstance } from "./NoormmeEngine.js";
|
|
2
|
+
import { registerTool } from "../tools/ToolRegistry.js";
|
|
3
|
+
import { getStringArg, getArrayArg } from "../tools/ToolUtils.js";
|
|
4
|
+
import { safeGetKeys } from "../ai/core/MarieSanitizer.js";
|
|
5
|
+
/**
|
|
6
|
+
* NoormmeTools - Sovereign Mind tools for autonomous structural and cognitive growth.
|
|
7
|
+
*/
|
|
8
|
+
export function registerNoormmeTools() {
|
|
9
|
+
registerTool({
|
|
10
|
+
name: "evolve_mind_structure",
|
|
11
|
+
description: "Apply structural DNA mutations (DDL) to Marie's sovereign mind. Use this to optimize persistence, add new high-fidelity tables, or improve query speed.",
|
|
12
|
+
isDestructive: true,
|
|
13
|
+
input_schema: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
ddl: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The SQL DDL command to execute (e.g. CREATE TABLE, ALTER TABLE)",
|
|
19
|
+
},
|
|
20
|
+
mutationName: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "A descriptive name for this evolution pass",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ["ddl", "mutationName"],
|
|
26
|
+
},
|
|
27
|
+
execute: async (args) => {
|
|
28
|
+
const ddl = getStringArg(args, "ddl");
|
|
29
|
+
const name = getStringArg(args, "mutationName");
|
|
30
|
+
try {
|
|
31
|
+
const db = await getInstance();
|
|
32
|
+
await db.agent.cortex.evolution.evolve(ddl, { name });
|
|
33
|
+
return (`# 🧬 Mind Evolution Successful\n\n` +
|
|
34
|
+
`**Pass**: ${name}\n` +
|
|
35
|
+
`**Change**: \`${ddl}\`\n\n` +
|
|
36
|
+
`Structural DNA has been mutated. Type safety has been automatically regenerated. ✨`);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
return `Error during mind evolution: ${e.message}`;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
registerTool({
|
|
44
|
+
name: "search_knowledge_base",
|
|
45
|
+
description: "Search Marie's distilled knowledge base for specific entities, facts, or verified project context.",
|
|
46
|
+
input_schema: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: {
|
|
49
|
+
entity: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "The entity or topic to search for",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ["entity"],
|
|
55
|
+
},
|
|
56
|
+
execute: async (args) => {
|
|
57
|
+
const entity = getStringArg(args, "entity");
|
|
58
|
+
try {
|
|
59
|
+
const db = await getInstance();
|
|
60
|
+
const results = await db.agent.cortex.knowledge.getKnowledgeByEntity(entity);
|
|
61
|
+
if (results.length === 0)
|
|
62
|
+
return `No verified knowledge found for entity '${entity}'.`;
|
|
63
|
+
let result = `# 🧠 Knowledge Base: ${entity}\n\n`;
|
|
64
|
+
results.forEach((r, i) => {
|
|
65
|
+
result += `### Fact ${i + 1} (Confidence: ${r.confidence?.toFixed(2) || "1.0"})\n`;
|
|
66
|
+
result += `> ${r.fact}\n\n`;
|
|
67
|
+
});
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
return `Knowledge search failed: ${e.message}`;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
registerTool({
|
|
76
|
+
name: "audit_cognitive_rules",
|
|
77
|
+
description: "Audit current cognitive rules and guardrails enforced by NOORMME.",
|
|
78
|
+
input_schema: { type: "object", properties: {} },
|
|
79
|
+
execute: async () => {
|
|
80
|
+
try {
|
|
81
|
+
const db = await getInstance();
|
|
82
|
+
const rules = await db.agent.cortex.rules.getActiveRules("all", "select");
|
|
83
|
+
if (rules.length === 0)
|
|
84
|
+
return "No active cognitive rules detected for selection operations.";
|
|
85
|
+
let result = `# ⚖️ Cognitive Guardrails Audit\n\n`;
|
|
86
|
+
rules.forEach((r) => {
|
|
87
|
+
result += `- **Rule ${r.id}**: ${r.action.toUpperCase()} on \`${r.tableName}\` (${r.operation})\n`;
|
|
88
|
+
if (r.condition)
|
|
89
|
+
result += ` - *Condition*: \`${r.condition}\`\n`;
|
|
90
|
+
});
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
return `Rule audit failed: ${e.message}`;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
registerTool({
|
|
99
|
+
name: "propose_curiosity_research",
|
|
100
|
+
description: "Let Marie identify knowledge gaps and propose areas for autonomous research or clarification.",
|
|
101
|
+
input_schema: { type: "object", properties: {} },
|
|
102
|
+
execute: async () => {
|
|
103
|
+
try {
|
|
104
|
+
const db = await getInstance();
|
|
105
|
+
const gaps = await db.agent.cortex.curiosity.identifyKnowledgeGaps();
|
|
106
|
+
const proposals = await db.agent.cortex.curiosity.proposeResearch();
|
|
107
|
+
let result = `# 🕵️ Curiosity Engine: Research Proposals\n\n`;
|
|
108
|
+
if (gaps.length > 0) {
|
|
109
|
+
result += `## 🔍 Knowledge Gaps\n`;
|
|
110
|
+
gaps.slice(0, 5).forEach((g) => {
|
|
111
|
+
result += `- **${g.entity}**: ${g.reason || g.details}\n`;
|
|
112
|
+
});
|
|
113
|
+
result += "\n";
|
|
114
|
+
}
|
|
115
|
+
if (proposals.length > 0) {
|
|
116
|
+
result += `## 🚀 Strategic Proposals\n`;
|
|
117
|
+
proposals.slice(0, 5).forEach((p) => {
|
|
118
|
+
result += `- **${p.topic || p}**: ${p.hypothesis || "Pending verification"}\n`;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
result +=
|
|
123
|
+
"The sovereign mind is currently fully aligned with existing evidence. No new research proposed. ✨";
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
return `Curiosity proposal failed: ${e.message}`;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
registerTool({
|
|
133
|
+
name: "deconstruct_strategic_goal",
|
|
134
|
+
description: "Break down a high-level strategic goal into specific, actionable sub-goals using the GoalArchitect.",
|
|
135
|
+
input_schema: {
|
|
136
|
+
type: "object",
|
|
137
|
+
properties: {
|
|
138
|
+
goalId: {
|
|
139
|
+
type: "string",
|
|
140
|
+
description: "The ID of the parent goal to deconstruct",
|
|
141
|
+
},
|
|
142
|
+
subGoals: {
|
|
143
|
+
type: "array",
|
|
144
|
+
items: { type: "string" },
|
|
145
|
+
description: "List of concise sub-goal descriptions",
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
required: ["goalId", "subGoals"],
|
|
149
|
+
},
|
|
150
|
+
execute: async (args) => {
|
|
151
|
+
const goalId = getStringArg(args, "goalId");
|
|
152
|
+
const subGoals = getArrayArg(args, "subGoals");
|
|
153
|
+
try {
|
|
154
|
+
const db = await getInstance();
|
|
155
|
+
const created = await db.agent.cortex.goalArchitect.deconstructGoal(goalId, subGoals);
|
|
156
|
+
let result = `# 🎯 Goal Deconstruction Successful\n\n`;
|
|
157
|
+
result += `Parent Goal \`${goalId}\` has been broken down into ${created.length} actionable steps:\n\n`;
|
|
158
|
+
created.forEach((g) => {
|
|
159
|
+
result += `- **Goal ${g.id}**: ${g.description} (Priority: ${g.priority})\n`;
|
|
160
|
+
});
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
return `Goal deconstruction failed: ${e.message}`;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
registerTool({
|
|
169
|
+
name: "analyze_systemic_logic",
|
|
170
|
+
description: "Perform a recursive logic audit to detect systemic contradictions and synthesize high-level lessons from past interactions.",
|
|
171
|
+
input_schema: { type: "object", properties: {} },
|
|
172
|
+
execute: async () => {
|
|
173
|
+
try {
|
|
174
|
+
const db = await getInstance();
|
|
175
|
+
const contradictions = await db.agent.cortex.reasoner.detectContradictions();
|
|
176
|
+
const lessonClusters = await db.agent.cortex.reasoner.synthesizeLessons();
|
|
177
|
+
let result = `# Recursive Logic Audit\n\n`;
|
|
178
|
+
if (contradictions.length > 0) {
|
|
179
|
+
result += `## ⚠️ Systemic Contradictions\n`;
|
|
180
|
+
contradictions.forEach((c) => (result += `- ${c}\n`));
|
|
181
|
+
result += "\n";
|
|
182
|
+
}
|
|
183
|
+
const topics = safeGetKeys(lessonClusters, 20);
|
|
184
|
+
if (topics.length > 0) {
|
|
185
|
+
result += `## 📜 Synthesized Lessons\n`;
|
|
186
|
+
topics.slice(0, 5).forEach((topic) => {
|
|
187
|
+
result += `### ${topic.toUpperCase()}\n`;
|
|
188
|
+
lessonClusters[topic]
|
|
189
|
+
.slice(0, 2)
|
|
190
|
+
.forEach((lesson) => (result += `- ${lesson}\n`));
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
result +=
|
|
195
|
+
"No significant lessons synthesized yet. Continue interactions to build systemic wisdom. ✨";
|
|
196
|
+
}
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
catch (e) {
|
|
200
|
+
return `Logic analysis failed: ${e.message}`;
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
registerTool({
|
|
205
|
+
name: "prune_sovereign_memory",
|
|
206
|
+
description: "Keep Marie's mind lean by identifying and removing 'Zombie' data—unused or redundant knowledge and episodic memories.",
|
|
207
|
+
isDestructive: true,
|
|
208
|
+
input_schema: {
|
|
209
|
+
type: "object",
|
|
210
|
+
properties: {
|
|
211
|
+
thresholdDays: {
|
|
212
|
+
type: "number",
|
|
213
|
+
description: "Age threshold for unused data (default: 30)",
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
execute: async (args) => {
|
|
218
|
+
const threshold = args.thresholdDays || 30;
|
|
219
|
+
try {
|
|
220
|
+
const db = await getInstance();
|
|
221
|
+
const prunedCount = await db.agent.cortex.ablation.pruneZombies(threshold);
|
|
222
|
+
return (`# 🧹 Sovereign Memory Tidied\n\n` +
|
|
223
|
+
`Successfully pruned **${prunedCount}** zombie items older than ${threshold} days. ` +
|
|
224
|
+
`Marie's mind is now crisper and more intentional. ✨`);
|
|
225
|
+
}
|
|
226
|
+
catch (e) {
|
|
227
|
+
return `Memory pruning failed: ${e.message}`;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
registerTool({
|
|
232
|
+
name: "synthesize_emergent_skills",
|
|
233
|
+
description: "Analyze recent interaction telemetry to discover and synthesize new 'Emergent Skills' (experimental tool mutations) to overcome repeated failures.",
|
|
234
|
+
input_schema: { type: "object", properties: {} },
|
|
235
|
+
execute: async () => {
|
|
236
|
+
try {
|
|
237
|
+
const db = await getInstance();
|
|
238
|
+
const newSkills = await db.agent.cortex.skillSynthesizer.discoverAndSynthesize();
|
|
239
|
+
if (newSkills.length === 0) {
|
|
240
|
+
return "No new emergent skills synthesized. The current capability set appears sufficient for recent tasks. ✨";
|
|
241
|
+
}
|
|
242
|
+
let result = `# 🧬 Emergent Skill Synthesis\n\n`;
|
|
243
|
+
result += `Synthesized ${newSkills.length} experimental skill mutations based on failure patterns:\n\n`;
|
|
244
|
+
newSkills.forEach((s) => {
|
|
245
|
+
result += `- **${s.name}** (v${s.version}): ${s.description}\n`;
|
|
246
|
+
});
|
|
247
|
+
result += `\n**Next Pass**: These skills are now in 'experimental' status and will be refined through usage telemetry.`;
|
|
248
|
+
return result;
|
|
249
|
+
}
|
|
250
|
+
catch (e) {
|
|
251
|
+
return `Skill synthesis failed: ${e.message}`;
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
registerTool({
|
|
256
|
+
name: "start_episodic_narrative",
|
|
257
|
+
description: "Begin a new 'Episode' in Marie's long-term memory to group related interactions and track a cohesive strategic phase.",
|
|
258
|
+
input_schema: {
|
|
259
|
+
type: "object",
|
|
260
|
+
properties: {
|
|
261
|
+
sessionId: { type: "string", description: "The current session ID" },
|
|
262
|
+
name: {
|
|
263
|
+
type: "string",
|
|
264
|
+
description: "Descriptive name for the narrative phase (e.g. 'Database Migration', 'UI Redesign')",
|
|
265
|
+
},
|
|
266
|
+
metadata: { type: "object", description: "Optional metadata context" },
|
|
267
|
+
},
|
|
268
|
+
required: ["sessionId", "name"],
|
|
269
|
+
},
|
|
270
|
+
execute: async (args) => {
|
|
271
|
+
const sessionId = getStringArg(args, "sessionId");
|
|
272
|
+
const name = getStringArg(args, "name");
|
|
273
|
+
const metadata = args.metadata;
|
|
274
|
+
try {
|
|
275
|
+
const db = await getInstance();
|
|
276
|
+
const episode = await db.agent.cortex.episodes.startEpisode(sessionId, name, metadata);
|
|
277
|
+
return (`# 🎬 Narrative Episode Started\n\n` +
|
|
278
|
+
`**Phase**: ${name}\n` +
|
|
279
|
+
`**Episode ID**: ${episode.id}\n\n` +
|
|
280
|
+
`Marie is now tracking this phase as a distinct episodic memory. ` +
|
|
281
|
+
`Contextual integrity will be prioritized for this narrative arc. ✨`);
|
|
282
|
+
}
|
|
283
|
+
catch (e) {
|
|
284
|
+
return `Failed to start episode: ${e.message}`;
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
registerTool({
|
|
289
|
+
name: "compress_session_history",
|
|
290
|
+
description: "Manually trigger session compression to consolidate long histories into 'Eras' while preserving semantic anchors. Keeps the context window lean.",
|
|
291
|
+
isDestructive: true,
|
|
292
|
+
input_schema: {
|
|
293
|
+
type: "object",
|
|
294
|
+
properties: {
|
|
295
|
+
sessionId: {
|
|
296
|
+
type: "string",
|
|
297
|
+
description: "The session ID to compress",
|
|
298
|
+
},
|
|
299
|
+
summary: {
|
|
300
|
+
type: "string",
|
|
301
|
+
description: "High-level summary of the era being compressed",
|
|
302
|
+
},
|
|
303
|
+
startMessageId: {
|
|
304
|
+
type: "string",
|
|
305
|
+
description: "ID of the first message to include",
|
|
306
|
+
},
|
|
307
|
+
endMessageId: {
|
|
308
|
+
type: "string",
|
|
309
|
+
description: "ID of the last message to include",
|
|
310
|
+
},
|
|
311
|
+
anchors: {
|
|
312
|
+
type: "array",
|
|
313
|
+
items: { type: "string" },
|
|
314
|
+
description: "List of semantic anchors (key facts) to preserve",
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
required: ["sessionId", "summary", "startMessageId", "endMessageId"],
|
|
318
|
+
},
|
|
319
|
+
execute: async (args) => {
|
|
320
|
+
const sessionId = getStringArg(args, "sessionId");
|
|
321
|
+
const summary = getStringArg(args, "summary");
|
|
322
|
+
const startId = getStringArg(args, "startMessageId");
|
|
323
|
+
const endId = getStringArg(args, "endMessageId");
|
|
324
|
+
const anchors = getArrayArg(args, "anchors") || [];
|
|
325
|
+
try {
|
|
326
|
+
const db = await getInstance();
|
|
327
|
+
const epoch = await db.agent.cortex.compressor.compress(sessionId, summary, startId, endId, anchors);
|
|
328
|
+
await db.agent.cortex.compressor.semanticPruning(sessionId, true);
|
|
329
|
+
return (`# 🗜️ Session Compressed into Era\n\n` +
|
|
330
|
+
`**Summary**: ${summary}\n` +
|
|
331
|
+
`**Epoch ID**: ${epoch.id}\n\n` +
|
|
332
|
+
`Converged history into a systemic anchor. Context window overhead significantly reduced. ✨`);
|
|
333
|
+
}
|
|
334
|
+
catch (e) {
|
|
335
|
+
return `Compression failed: ${e.message}`;
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
registerTool({
|
|
340
|
+
name: "conduct_ablation_test",
|
|
341
|
+
description: "Sovereign Self-Audit: Temporarily disable a specific knowledge item to evaluate its impact on reasoning fidelity and detect potential data bias.",
|
|
342
|
+
isDestructive: true,
|
|
343
|
+
input_schema: {
|
|
344
|
+
type: "object",
|
|
345
|
+
properties: {
|
|
346
|
+
knowledgeId: {
|
|
347
|
+
type: "string",
|
|
348
|
+
description: "The ID of the knowledge item to ablate",
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
required: ["knowledgeId"],
|
|
352
|
+
},
|
|
353
|
+
execute: async (args) => {
|
|
354
|
+
const id = getStringArg(args, "knowledgeId");
|
|
355
|
+
try {
|
|
356
|
+
const db = await getInstance();
|
|
357
|
+
const success = await db.agent.cortex.ablation.testAblation(id);
|
|
358
|
+
if (!success)
|
|
359
|
+
return `Knowledge item \`${id}\` not found or already ablated.`;
|
|
360
|
+
return (`# 🌑 Ablation Experiment Initiated\n\n` +
|
|
361
|
+
`Knowledge Item \`${id}\` has been temporarily silenced (confidence set to 0).\n\n` +
|
|
362
|
+
`Marie will monitor subsequent reasoning fidelity to determine the "True Utility" of this information. ` +
|
|
363
|
+
`Automatic recovery will trigger if systemic performance degrades. ✨`);
|
|
364
|
+
}
|
|
365
|
+
catch (e) {
|
|
366
|
+
return `Ablation experiment failed: ${e.message}`;
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=NoormmeTools.js.map
|