@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,118 +1,135 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MarieVitality } from "../ai/core/MarieVitality.js";
|
|
2
|
+
import { MarieProgressTracker } from "../ai/core/MarieProgressTracker.js";
|
|
3
|
+
/** Race a promise against a timeout. Returns the result or undefined if timed out. */
|
|
4
|
+
function withTimeout(promise, ms, label) {
|
|
5
|
+
let timer;
|
|
6
|
+
return Promise.race([
|
|
7
|
+
promise.then((result) => {
|
|
8
|
+
clearTimeout(timer);
|
|
9
|
+
return result;
|
|
10
|
+
}),
|
|
11
|
+
new Promise((resolve) => {
|
|
12
|
+
timer = setTimeout(() => {
|
|
13
|
+
// Reduced log noise for timeouts
|
|
14
|
+
resolve(undefined);
|
|
15
|
+
}, ms);
|
|
16
|
+
if (timer && typeof timer === "object" && "unref" in timer)
|
|
17
|
+
timer.unref();
|
|
18
|
+
}),
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
const AUTONOMIC_TIMEOUT_MS = 10_000; // 10s cap for each heavy operation
|
|
2
22
|
/**
|
|
3
|
-
*
|
|
23
|
+
* Handles background cognitive pulses, health probes, and DNA tuning.
|
|
4
24
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// Wait for existing pulse or acquire
|
|
14
|
-
await MarieLockManager.global.acquireLock(lockId, true);
|
|
15
|
-
MarieLockManager.global.registerExecution(lockId, true, pulsePromise);
|
|
16
|
-
console.log("[NoormmeAutonomics] Starting Sovereign Autonomic Pulses...");
|
|
17
|
-
// 1. Agentic DNA Tuning
|
|
18
|
-
await this.tuneDNA(db);
|
|
19
|
-
// 2. Ritual Orchestration
|
|
20
|
-
await this.orchestrateRituals(db);
|
|
21
|
-
// 3. Health Probes
|
|
22
|
-
await this.runHealthProbes(db);
|
|
23
|
-
// 4. Governance Audit
|
|
24
|
-
await this.runGovernanceAudit(db);
|
|
25
|
-
}
|
|
26
|
-
finally {
|
|
27
|
-
if (resolvePulse)
|
|
28
|
-
resolvePulse();
|
|
25
|
+
export async function runPulses(db) {
|
|
26
|
+
const lockId = "autonomic_pulse_lock";
|
|
27
|
+
// PHASE: Throttling (Run once every 24 hours)
|
|
28
|
+
try {
|
|
29
|
+
const lastRunResult = (await db.execute("SELECT value FROM telemetry WHERE key = 'last_autonomic_run'"));
|
|
30
|
+
const lastRun = lastRunResult.rows?.[0]?.value;
|
|
31
|
+
if (lastRun && Date.now() - Number(lastRun) < 24 * 60 * 60 * 1000) {
|
|
32
|
+
return; // Skip if run recently
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
catch (e) { }
|
|
36
|
+
let resolvePulse;
|
|
37
|
+
const pulsePromise = new Promise((r) => (resolvePulse = r));
|
|
38
|
+
try {
|
|
39
|
+
const tracker = new MarieProgressTracker(undefined, {
|
|
40
|
+
runId: "autonomic",
|
|
41
|
+
startedAt: Date.now(),
|
|
42
|
+
steps: 0,
|
|
43
|
+
tools: 0,
|
|
44
|
+
objectives: [],
|
|
45
|
+
achieved: [],
|
|
46
|
+
});
|
|
47
|
+
const vitality = new MarieVitality(tracker);
|
|
48
|
+
await vitality.acquireLock(lockId, true);
|
|
49
|
+
vitality.registerExecution(lockId, true, pulsePromise);
|
|
50
|
+
// console.log("[NoormmeAutonomics] Maintenance in progress...");
|
|
51
|
+
const start = Date.now();
|
|
52
|
+
await tuneDNA(db);
|
|
53
|
+
await orchestrateRituals(db);
|
|
54
|
+
await runHealthProbes(db);
|
|
55
|
+
await runGovernanceAudit(db);
|
|
56
|
+
// Record last run
|
|
57
|
+
await db.execute("INSERT OR REPLACE INTO telemetry (key, value) VALUES ('last_autonomic_run', ?)", [Date.now().toString()]);
|
|
58
|
+
// console.log(`[NoormmeAutonomics] Maintenance complete (took ${Date.now() - start}ms).`);
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
// console.warn("[NoormmeAutonomics] Maintenance cycle encountered issues", e);
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
if (resolvePulse)
|
|
65
|
+
resolvePulse();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function tuneDNA(db) {
|
|
69
|
+
try {
|
|
70
|
+
const sessionCountResult = (await db.execute("SELECT COUNT(*) as count FROM sessions"));
|
|
71
|
+
const sessionCount = sessionCountResult.rows?.[0]?.count ?? 0;
|
|
72
|
+
const dynamicAggressiveness = Math.min(0.9, 0.6 + sessionCount / 1000);
|
|
73
|
+
db.config.agentic.evolution.mutationAggressiveness =
|
|
74
|
+
dynamicAggressiveness;
|
|
75
|
+
}
|
|
76
|
+
catch (e) { }
|
|
77
|
+
}
|
|
78
|
+
async function orchestrateRituals(db) {
|
|
79
|
+
try {
|
|
80
|
+
await withTimeout(db.agent.cortex.rituals.runPendingRituals(), AUTONOMIC_TIMEOUT_MS, "runPendingRituals");
|
|
81
|
+
const result = (await db.execute("SELECT id FROM agent_rituals LIMIT 1"));
|
|
82
|
+
const rows = result.rows || [];
|
|
83
|
+
if (rows.length === 0) {
|
|
84
|
+
await db.agent.cortex.rituals.scheduleRitual("Daily Mind Compression", "compression", "daily");
|
|
85
|
+
await db.agent.cortex.rituals.scheduleRitual("Structural Optimization", "optimization", "weekly");
|
|
86
|
+
await db.agent.cortex.rituals.scheduleRitual("Knowledge Pruning", "pruning", "daily");
|
|
87
|
+
await db.agent.cortex.rituals.scheduleRitual("Sovereign Evolution", "evolution", "weekly");
|
|
41
88
|
}
|
|
89
|
+
await compressMind(db);
|
|
90
|
+
await pruneKnowledge(db);
|
|
91
|
+
// Skip heavy self-iteration during startup pulse
|
|
92
|
+
}
|
|
93
|
+
catch (e) { }
|
|
94
|
+
}
|
|
95
|
+
async function runHealthProbes(db) {
|
|
96
|
+
try {
|
|
97
|
+
await withTimeout(db.agent.cortex.tests.runAllProbes(), AUTONOMIC_TIMEOUT_MS, "runAllProbes");
|
|
42
98
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const recentSession = await db.execute(`
|
|
99
|
+
catch (e) { }
|
|
100
|
+
}
|
|
101
|
+
async function runGovernanceAudit(db) {
|
|
102
|
+
try {
|
|
103
|
+
await withTimeout(db.agent.cortex.policies.evaluateContext({}), AUTONOMIC_TIMEOUT_MS, "evaluateAllPolicies");
|
|
104
|
+
}
|
|
105
|
+
catch (e) { }
|
|
106
|
+
}
|
|
107
|
+
async function compressMind(db) {
|
|
108
|
+
try {
|
|
109
|
+
// console.log("[NoormmeAutonomics] Running memory consolidation...");
|
|
110
|
+
await withTimeout(db.execute(`
|
|
111
|
+
DELETE FROM sessions
|
|
112
|
+
WHERE id NOT IN (
|
|
58
113
|
SELECT id FROM sessions
|
|
59
|
-
|
|
60
|
-
LIMIT
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
console.warn("[NoormmeAutonomics] Ritual orchestration failed", e);
|
|
71
|
-
}
|
|
114
|
+
ORDER BY timestamp DESC
|
|
115
|
+
LIMIT 1000
|
|
116
|
+
)
|
|
117
|
+
AND NOT EXISTS (
|
|
118
|
+
SELECT 1 FROM session_metadata
|
|
119
|
+
WHERE session_metadata.id = sessions.sessionId
|
|
120
|
+
AND session_metadata.isPinned = 1
|
|
121
|
+
)`), 5000, "cleanupSessions");
|
|
72
122
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
console.log("[NoormmeAutonomics] Running autonomic health probes...");
|
|
76
|
-
await db.agent.cortex.tests.registerProbe("Core Integrity", "audit:check_schema_consistency");
|
|
77
|
-
await db.agent.cortex.tests.registerProbe("Memory Coherence", "audit:check_memory_integrity");
|
|
78
|
-
await db.agent.cortex.tests.registerProbe("Data Sanity", "audit:check_data_integrity");
|
|
79
|
-
void db.agent.cortex.tests.runAllProbes().then(results => {
|
|
80
|
-
const failures = results.filter(r => !r.success);
|
|
81
|
-
if (failures.length > 0) {
|
|
82
|
-
console.warn(`[NoormmeAutonomics] 💀 HEALTH BREACH: ${failures.map(f => f.name).join(", ")}`);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
console.log("[NoormmeAutonomics] Health: ALL GREEN");
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
console.warn("[NoormmeAutonomics] Health probes failed", e);
|
|
91
|
-
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
// console.warn("[NoormmeAutonomics] Failed to prune unpinned histories.", e);
|
|
92
125
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
const repairs = await db.agent.cortex.governor.suggestRepairs();
|
|
101
|
-
for (const repair of repairs) {
|
|
102
|
-
if (repair.includes("index") || repair.includes("INDEX")) {
|
|
103
|
-
try {
|
|
104
|
-
await db.execute(repair);
|
|
105
|
-
console.log(`[NoormmeAutonomics] Applied Repair: ${repair}`);
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
console.warn(`[NoormmeAutonomics] Repair failed: ${repair}`, e);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
console.warn("[NoormmeAutonomics] Governance audit failed", e);
|
|
115
|
-
}
|
|
126
|
+
}
|
|
127
|
+
async function pruneKnowledge(db) {
|
|
128
|
+
try {
|
|
129
|
+
// console.log("[NoormmeAutonomics] Pruning obsolete knowledge points...");
|
|
130
|
+
// Decay high-volatility, low-reliance anchors
|
|
131
|
+
await withTimeout(db.execute("DELETE FROM anchors WHERE timestamp < ? AND type = 'ephemeral'", [Date.now() - 7 * 24 * 60 * 60 * 1000]), 5000, "pruneEphemeralKnowledge");
|
|
116
132
|
}
|
|
133
|
+
catch (e) { }
|
|
117
134
|
}
|
|
118
135
|
//# sourceMappingURL=NoormmeAutonomics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoormmeAutonomics.js","sourceRoot":"","sources":["../../../../src/monolith/infrastructure/persistence/NoormmeAutonomics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"NoormmeAutonomics.js","sourceRoot":"","sources":["../../../../src/monolith/infrastructure/persistence/NoormmeAutonomics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,sFAAsF;AACtF,SAAS,WAAW,CAClB,OAAmB,EACnB,EAAU,EACV,KAAa;IAEb,IAAI,KAAoC,CAAC;IACzC,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACtB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;QACF,IAAI,OAAO,CAAY,CAAC,OAAO,EAAE,EAAE;YACjC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBACtB,iCAAiC;gBACjC,OAAO,CAAC,SAAS,CAAC,CAAC;YACrB,CAAC,EAAE,EAAE,CAAC,CAAC;YACP,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK;gBACvD,KAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,MAAM,oBAAoB,GAAG,MAAM,CAAC,CAAC,mCAAmC;AAExE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAAW;IACzC,MAAM,MAAM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