@jstn-sdk/ma 0.1.11 → 0.1.13
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/.codex/agents/Architect.toml +0 -2
- package/.codex/agents/Auditor.toml +0 -2
- package/.codex/agents/Builder.toml +0 -2
- package/.codex/agents/Flow.toml +0 -2
- package/.codex/agents/Sage.toml +0 -2
- package/.codex/agents/Vibe.toml +0 -2
- package/.codex/hooks.json +14 -13
- package/.codex/prompts/enforcement.md +4 -0
- package/.codex/prompts/skill-contract.md +4 -0
- package/COVERAGE.md +211 -0
- package/DEMO.md +265 -0
- package/README.md +287 -37
- package/bin/ma.js +232 -71
- package/data/clone-data.ledger.json +41 -0
- package/data/clone-data.proof.json +50 -0
- package/data/clone-data.rvf +37 -0
- package/docs/README.md +7 -1
- package/docs/getting-started.md +108 -37
- package/docs/installed-sdk.md +23 -0
- package/docs/mcp-setup.md +65 -1
- package/docs/onboarding.md +18 -2
- package/docs/prompt-guidance-contract.md +17 -0
- package/docs/prompt-guidance-fragments/active-autonomy-core.md +7 -0
- package/docs/qa/release-issue-gates-0.1.13.json +644 -0
- package/docs/qa/release-readiness-0.1.13.md +116 -0
- package/docs/qa/release-readiness-0.1.5.md +1 -1
- package/docs/reference/native-engineering-patterns.md +35 -0
- package/docs/reference/native-security-playbooks.md +27 -0
- package/docs/reference/native-source-selection.md +27 -0
- package/docs/reference/native-style-and-deslop.md +20 -0
- package/docs/release-spec.md +37 -10
- package/docs/skills-publishing.md +25 -1
- package/docs/skills.md +37 -12
- package/index.js +222 -2
- package/mcp/collections.json +23 -6
- package/mcp/local/code-intel.js +113 -0
- package/mcp/local/memory.js +46 -0
- package/mcp/local/playbooks.js +168 -0
- package/mcp/local/state.js +71 -0
- package/mcp/local/team-run.js +113 -0
- package/mcp/local/trace.js +60 -0
- package/mcp/local-capabilities.json +56 -0
- package/mcp/native-playbooks.json +117 -0
- package/mcp/servers.json +34 -0
- package/package.json +8 -2
- package/plugins/meta-architect/.app.json +1 -1
- package/plugins/meta-architect/.codex-plugin/plugin.json +4 -4
- package/plugins/meta-architect/.mcp.json +1 -1
- package/plugins/meta-architect/README.md +34 -1
- package/plugins/meta-architect/obsidian/main.js +401 -0
- package/plugins/meta-architect/obsidian/manifest.json +9 -0
- package/plugins/meta-architect/obsidian/styles.css +7 -0
- package/plugins/meta-architect/skills/align/SKILL.md +24 -0
- package/plugins/meta-architect/skills/align/agents/openai.yaml +4 -0
- package/plugins/meta-architect/skills/align/references/shared-language.md +24 -0
- package/plugins/meta-architect/skills/arch/SKILL.md +2 -0
- package/plugins/meta-architect/skills/build/SKILL.md +3 -0
- package/plugins/meta-architect/skills/cleanup/SKILL.md +23 -0
- package/plugins/meta-architect/skills/cleanup/agents/openai.yaml +4 -0
- package/plugins/meta-architect/skills/cleanup/references/style-and-deslop.md +18 -0
- package/plugins/meta-architect/skills/diagnose/SKILL.md +24 -0
- package/plugins/meta-architect/skills/diagnose/agents/openai.yaml +4 -0
- package/plugins/meta-architect/skills/flow/SKILL.md +2 -0
- package/plugins/meta-architect/skills/maestro/SKILL.md +36 -3
- package/plugins/meta-architect/skills/maestro/agents/openai.yaml +2 -2
- package/plugins/meta-architect/skills/maestro/references/native-ingest-map.md +44 -0
- package/plugins/meta-architect/skills/sage/SKILL.md +5 -1
- package/plugins/meta-architect/skills/sage/references/source-selection.md +36 -0
- package/plugins/meta-architect/skills/tdd/SKILL.md +24 -0
- package/plugins/meta-architect/skills/tdd/agents/openai.yaml +4 -0
- package/plugins/meta-architect/skills/vet/SKILL.md +5 -1
- package/plugins/meta-architect/skills/vet/references/security-playbooks.md +30 -0
- package/plugins/meta-architect/skills/vibe/SKILL.md +2 -0
- package/scripts/active-autonomy-hook.mjs +96 -0
- package/scripts/build-linux-packages.mjs +328 -0
- package/scripts/doctor.js +36 -4
- package/scripts/install.sh +28 -0
- package/scripts/linux-package-lib.mjs +40 -0
- package/scripts/linux-package-smoke.mjs +103 -0
- package/scripts/ralph/prompt.md +35 -0
- package/scripts/release-sync.js +13 -6
- package/scripts/release-verify.js +166 -1
- package/skills/align/SKILL.md +24 -0
- package/skills/align/agents/openai.yaml +4 -0
- package/skills/align/references/shared-language.md +24 -0
- package/skills/arch/SKILL.md +2 -0
- package/skills/build/SKILL.md +3 -0
- package/skills/cleanup/SKILL.md +23 -0
- package/skills/cleanup/agents/openai.yaml +4 -0
- package/skills/cleanup/references/style-and-deslop.md +18 -0
- package/skills/diagnose/SKILL.md +24 -0
- package/skills/diagnose/agents/openai.yaml +4 -0
- package/skills/flow/SKILL.md +2 -0
- package/skills/index.json +21 -6
- package/skills/maestro/SKILL.md +36 -3
- package/skills/maestro/agents/openai.yaml +2 -2
- package/skills/maestro/references/native-ingest-map.md +44 -0
- package/skills/sage/SKILL.md +5 -1
- package/skills/sage/references/source-selection.md +36 -0
- package/skills/tdd/SKILL.md +24 -0
- package/skills/tdd/agents/openai.yaml +4 -0
- package/skills/vet/SKILL.md +5 -1
- package/skills/vet/references/security-playbooks.md +30 -0
- package/skills/vibe/SKILL.md +2 -0
- package/src/bootstrap.js +141 -24
- package/src/build-gate.js +2 -2
- package/src/decision-log.js +12 -9
- package/src/launcher.js +4 -0
- package/src/mcp-config.js +130 -8
- package/src/mcp-live-client.js +289 -3
- package/src/paths.js +37 -1
- package/src/policy.js +1 -1
- package/src/release-issue-gates.js +190 -0
- package/src/release-state.js +30 -1
- package/src/runtime/active-autonomy-core.js +208 -0
- package/src/runtime/alignment-sentinel.js +165 -0
- package/src/runtime/architect-review.js +88 -0
- package/src/runtime/build-readiness.js +62 -0
- package/src/runtime/code-graph-rehearse.js +113 -0
- package/src/runtime/context-economy-core.js +276 -0
- package/src/runtime/continuity-notes.js +79 -0
- package/src/runtime/core-source-ingest.js +379 -0
- package/src/runtime/detached-provider.js +74 -0
- package/src/runtime/environment-awareness-core.js +460 -0
- package/src/runtime/exposure-catalog.js +276 -0
- package/src/runtime/guidance-stack.js +42 -0
- package/src/runtime/helper-orchestration-core.js +307 -0
- package/src/runtime/learning-loop-core.js +238 -0
- package/src/runtime/maestro-events.js +18 -0
- package/src/runtime/maestro-manager.js +605 -0
- package/src/runtime/maestro-state.js +125 -0
- package/src/runtime/mcp-policy.js +192 -0
- package/src/runtime/obsidian-integration-core.js +851 -0
- package/src/runtime/obsidian-plugin-bridge.js +739 -0
- package/src/runtime/orchestrator.js +158 -0
- package/src/runtime/prompt-strategy-core.js +230 -0
- package/src/runtime/quorum-review.js +90 -0
- package/src/runtime/ralph-execution-core.js +217 -0
- package/src/runtime/redaction-gateway.js +174 -0
- package/src/runtime/runtime-state.js +1223 -0
- package/src/runtime/semantic-recording-core.js +147 -0
- package/src/runtime/signal-hooks.js +67 -0
- package/src/runtime/skills-registry-export.js +670 -0
- package/src/runtime/startup-path.js +14 -0
- package/src/runtime/universal-plugin-broker-core.js +575 -0
- package/src/runtime/workspace-intelligence-runtime.js +674 -0
- package/src/runtime/workspace-virtualizer.js +102 -0
- package/src/runtime/workspaces.js +25 -0
- package/src/runtime-artifacts.js +407 -84
- package/src/skill-installer.js +53 -5
- package/src/skills.js +1454 -78
- package/src/state-sync.js +51 -8
- package/docs/qa/release-readiness-0.1.11.md +0 -79
- package/plugins/meta-architect/skills/meta-architect/SKILL.md +0 -32
- package/plugins/meta-architect/skills/meta-architect/agents/openai.yaml +0 -4
- package/skills/meta-architect/SKILL.md +0 -32
- package/skills/meta-architect/agents/openai.yaml +0 -4
- /package/plugins/meta-architect/skills/{meta-architect → maestro}/references/core-release-rules.md +0 -0
- /package/skills/{meta-architect → maestro}/references/core-release-rules.md +0 -0
|
@@ -0,0 +1,1223 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { readJson, writeJson } from "../fs-utils.js";
|
|
5
|
+
import { getRepoRoot, getRuntimeReadPath } from "../paths.js";
|
|
6
|
+
import { summarizeReleaseIssueGateStatus } from "../release-issue-gates.js";
|
|
7
|
+
import { createDefaultReleaseState, validateReleaseState } from "../release-state.js";
|
|
8
|
+
import {
|
|
9
|
+
createDefaultActiveAutonomyCore,
|
|
10
|
+
getActiveAutonomyCorePath,
|
|
11
|
+
seedActiveAutonomyCoreArtifacts,
|
|
12
|
+
validateActiveAutonomyCore,
|
|
13
|
+
} from "./active-autonomy-core.js";
|
|
14
|
+
import { seedAlignmentSentinelArtifacts } from "./alignment-sentinel.js";
|
|
15
|
+
import { seedArchitectReviewArtifacts } from "./architect-review.js";
|
|
16
|
+
import {
|
|
17
|
+
createDefaultCodeGraphRehearse,
|
|
18
|
+
getCodeGraphRehearsePath,
|
|
19
|
+
seedCodeGraphRehearseArtifacts,
|
|
20
|
+
validateCodeGraphRehearse,
|
|
21
|
+
} from "./code-graph-rehearse.js";
|
|
22
|
+
import {
|
|
23
|
+
createDefaultContextEconomyCore,
|
|
24
|
+
getContextEconomyCorePath,
|
|
25
|
+
seedContextEconomyCoreArtifacts,
|
|
26
|
+
validateContextEconomyCore,
|
|
27
|
+
} from "./context-economy-core.js";
|
|
28
|
+
import {
|
|
29
|
+
getContinuityIndexPath,
|
|
30
|
+
getContinuityNotesPath,
|
|
31
|
+
seedContinuityArtifacts,
|
|
32
|
+
} from "./continuity-notes.js";
|
|
33
|
+
import {
|
|
34
|
+
createDefaultCoreSourceIngest,
|
|
35
|
+
getCoreSourceIngestPath,
|
|
36
|
+
seedCoreSourceIngestArtifacts,
|
|
37
|
+
validateCoreSourceIngest,
|
|
38
|
+
} from "./core-source-ingest.js";
|
|
39
|
+
import {
|
|
40
|
+
createDefaultEnvironmentAwarenessCore,
|
|
41
|
+
getEnvironmentAwarenessCorePath,
|
|
42
|
+
seedEnvironmentAwarenessCoreArtifacts,
|
|
43
|
+
validateEnvironmentAwarenessCore,
|
|
44
|
+
} from "./environment-awareness-core.js";
|
|
45
|
+
import {
|
|
46
|
+
getGuidanceIncludeGraphPath,
|
|
47
|
+
getMergedGuidancePath,
|
|
48
|
+
seedGuidanceStackArtifacts,
|
|
49
|
+
} from "./guidance-stack.js";
|
|
50
|
+
import {
|
|
51
|
+
createDefaultHelperOrchestrationCore,
|
|
52
|
+
getHelperOrchestrationCorePath,
|
|
53
|
+
seedHelperOrchestrationCoreArtifacts,
|
|
54
|
+
validateHelperOrchestrationCore,
|
|
55
|
+
} from "./helper-orchestration-core.js";
|
|
56
|
+
import {
|
|
57
|
+
createDefaultLearningLoopCore,
|
|
58
|
+
getLearningLoopCorePath,
|
|
59
|
+
seedLearningLoopCoreArtifacts,
|
|
60
|
+
validateLearningLoopCore,
|
|
61
|
+
} from "./learning-loop-core.js";
|
|
62
|
+
import { getManagerRunsPath, seedMaestroManagerArtifacts } from "./maestro-manager.js";
|
|
63
|
+
import {
|
|
64
|
+
createDefaultMaestroState,
|
|
65
|
+
getMaestroStatePath,
|
|
66
|
+
seedMaestroStateArtifacts,
|
|
67
|
+
} from "./maestro-state.js";
|
|
68
|
+
import {
|
|
69
|
+
createDefaultObsidianBridge,
|
|
70
|
+
createDefaultObsidianVaultIndex,
|
|
71
|
+
createDefaultObsidianVaultOperations,
|
|
72
|
+
getObsidianBridgePath,
|
|
73
|
+
getObsidianVaultIndexPath,
|
|
74
|
+
getObsidianVaultOperationsPath,
|
|
75
|
+
seedObsidianBridgeArtifacts,
|
|
76
|
+
validateObsidianBridge,
|
|
77
|
+
validateObsidianVaultIndex,
|
|
78
|
+
validateObsidianVaultOperations,
|
|
79
|
+
} from "./obsidian-integration-core.js";
|
|
80
|
+
import {
|
|
81
|
+
getTaskLockRoot,
|
|
82
|
+
getTaskMailboxRoot,
|
|
83
|
+
getTaskRegistryPath,
|
|
84
|
+
seedOrchestratorArtifacts,
|
|
85
|
+
} from "./orchestrator.js";
|
|
86
|
+
import {
|
|
87
|
+
createDefaultPromptStrategyCore,
|
|
88
|
+
getPromptStrategyCorePath,
|
|
89
|
+
seedPromptStrategyCoreArtifacts,
|
|
90
|
+
validatePromptStrategyCore,
|
|
91
|
+
} from "./prompt-strategy-core.js";
|
|
92
|
+
import {
|
|
93
|
+
createDefaultSemanticRecordingCore,
|
|
94
|
+
getSemanticRecordingCorePath,
|
|
95
|
+
seedSemanticRecordingCoreArtifacts,
|
|
96
|
+
validateSemanticRecordingCore,
|
|
97
|
+
} from "./semantic-recording-core.js";
|
|
98
|
+
import {
|
|
99
|
+
getRuntimeHooksAuditPath,
|
|
100
|
+
getRuntimeHooksConfigPath,
|
|
101
|
+
seedSignalHookArtifacts,
|
|
102
|
+
} from "./signal-hooks.js";
|
|
103
|
+
import {
|
|
104
|
+
createDefaultSkillsRegistryExport,
|
|
105
|
+
getSkillsRegistryExportPath,
|
|
106
|
+
seedSkillsRegistryExportArtifacts,
|
|
107
|
+
validateSkillsRegistryExport,
|
|
108
|
+
} from "./skills-registry-export.js";
|
|
109
|
+
import {
|
|
110
|
+
createDefaultUniversalPluginBrokerCore,
|
|
111
|
+
getUniversalPluginBrokerCorePath,
|
|
112
|
+
seedUniversalPluginBrokerCoreArtifacts,
|
|
113
|
+
validateUniversalPluginBrokerCore,
|
|
114
|
+
} from "./universal-plugin-broker-core.js";
|
|
115
|
+
import {
|
|
116
|
+
createDefaultCapabilityComposition,
|
|
117
|
+
createDefaultSemanticReceiptIndex,
|
|
118
|
+
createDefaultWorkspaceContextPack,
|
|
119
|
+
createDefaultWorkspaceEffectiveness,
|
|
120
|
+
getCapabilityCompositionPath,
|
|
121
|
+
getSemanticReceiptIndexPath,
|
|
122
|
+
getWorkspaceContextPackPath,
|
|
123
|
+
getWorkspaceEffectivenessPath,
|
|
124
|
+
seedWorkspaceIntelligenceArtifacts,
|
|
125
|
+
validateCapabilityComposition,
|
|
126
|
+
validateSemanticReceiptIndex,
|
|
127
|
+
validateWorkspaceContextPack,
|
|
128
|
+
validateWorkspaceEffectiveness,
|
|
129
|
+
} from "./workspace-intelligence-runtime.js";
|
|
130
|
+
import {
|
|
131
|
+
createDefaultWorkspaceVirtualizer,
|
|
132
|
+
getWorkspaceVirtualizerPath,
|
|
133
|
+
seedWorkspaceVirtualizerArtifacts,
|
|
134
|
+
validateWorkspaceVirtualizer,
|
|
135
|
+
} from "./workspace-virtualizer.js";
|
|
136
|
+
import { getWorkspacesIndexPath, seedWorkspaceArtifacts } from "./workspaces.js";
|
|
137
|
+
|
|
138
|
+
const runtimeSubsystemSeeders = [
|
|
139
|
+
seedGuidanceStackArtifacts,
|
|
140
|
+
seedContinuityArtifacts,
|
|
141
|
+
seedSignalHookArtifacts,
|
|
142
|
+
seedOrchestratorArtifacts,
|
|
143
|
+
seedWorkspaceArtifacts,
|
|
144
|
+
seedMaestroManagerArtifacts,
|
|
145
|
+
seedMaestroStateArtifacts,
|
|
146
|
+
seedArchitectReviewArtifacts,
|
|
147
|
+
seedAlignmentSentinelArtifacts,
|
|
148
|
+
seedSemanticRecordingCoreArtifacts,
|
|
149
|
+
seedHelperOrchestrationCoreArtifacts,
|
|
150
|
+
seedLearningLoopCoreArtifacts,
|
|
151
|
+
seedWorkspaceIntelligenceArtifacts,
|
|
152
|
+
seedPromptStrategyCoreArtifacts,
|
|
153
|
+
seedActiveAutonomyCoreArtifacts,
|
|
154
|
+
seedContextEconomyCoreArtifacts,
|
|
155
|
+
seedEnvironmentAwarenessCoreArtifacts,
|
|
156
|
+
seedCoreSourceIngestArtifacts,
|
|
157
|
+
seedUniversalPluginBrokerCoreArtifacts,
|
|
158
|
+
seedObsidianBridgeArtifacts,
|
|
159
|
+
seedWorkspaceVirtualizerArtifacts,
|
|
160
|
+
seedCodeGraphRehearseArtifacts,
|
|
161
|
+
seedSkillsRegistryExportArtifacts,
|
|
162
|
+
];
|
|
163
|
+
const defaultMergedGuidance = {
|
|
164
|
+
schemaVersion: "0.1.0",
|
|
165
|
+
sources: [],
|
|
166
|
+
content: "",
|
|
167
|
+
};
|
|
168
|
+
const defaultGuidanceGraph = {
|
|
169
|
+
schemaVersion: "0.1.0",
|
|
170
|
+
roots: [],
|
|
171
|
+
edges: [],
|
|
172
|
+
};
|
|
173
|
+
const defaultContinuityIndex = {
|
|
174
|
+
schemaVersion: "0.1.0",
|
|
175
|
+
sessionCount: 0,
|
|
176
|
+
lastUpdatedAt: null,
|
|
177
|
+
};
|
|
178
|
+
const defaultHookConfig = {
|
|
179
|
+
schemaVersion: "0.1.0",
|
|
180
|
+
compatibilityNamespace: ["prebuild", "prerelease"],
|
|
181
|
+
runtimeNamespace: [
|
|
182
|
+
"prompt_submit",
|
|
183
|
+
"pre_action",
|
|
184
|
+
"post_action",
|
|
185
|
+
"failure",
|
|
186
|
+
"session_start",
|
|
187
|
+
"cwd_changed",
|
|
188
|
+
"file_changed",
|
|
189
|
+
"workspace_created",
|
|
190
|
+
],
|
|
191
|
+
hooks: [],
|
|
192
|
+
activeAutonomy: {
|
|
193
|
+
enabled: true,
|
|
194
|
+
stopPolicy: "block_passive_permission_handoff_when_auto_continue_applies",
|
|
195
|
+
defaultResponse:
|
|
196
|
+
"AUTO-CONTINUE: continue the current safe branch, execute the next reversible step, then verify before reporting.",
|
|
197
|
+
stallPatterns: [
|
|
198
|
+
"should i proceed",
|
|
199
|
+
"would you like me to continue",
|
|
200
|
+
"if you want, i can",
|
|
201
|
+
"if you'd like, i can",
|
|
202
|
+
"tell me if you want me to",
|
|
203
|
+
"i can continue if you want",
|
|
204
|
+
"let me know if you want me to continue",
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
const defaultTaskRegistry = {
|
|
209
|
+
schemaVersion: "0.1.0",
|
|
210
|
+
leader: "leader",
|
|
211
|
+
workers: [],
|
|
212
|
+
tasks: [],
|
|
213
|
+
};
|
|
214
|
+
const defaultWorkspaceIndex = {
|
|
215
|
+
schemaVersion: "0.1.0",
|
|
216
|
+
items: [],
|
|
217
|
+
};
|
|
218
|
+
const defaultDecisions = {
|
|
219
|
+
schemaVersion: "0.1.0",
|
|
220
|
+
decisions: [],
|
|
221
|
+
};
|
|
222
|
+
const defaultAudits = {
|
|
223
|
+
schemaVersion: "0.1.0",
|
|
224
|
+
items: [],
|
|
225
|
+
};
|
|
226
|
+
const defaultCves = {
|
|
227
|
+
schemaVersion: "0.1.0",
|
|
228
|
+
items: [],
|
|
229
|
+
};
|
|
230
|
+
const defaultReleaseIssueGates = {
|
|
231
|
+
schemaVersion: "1.0.0",
|
|
232
|
+
releaseVersion: "0.0.0",
|
|
233
|
+
releaseTag: "v0.0.0",
|
|
234
|
+
passContract: {
|
|
235
|
+
allIssuesMustPassProduction: true,
|
|
236
|
+
allIssuesMustHaveLabels: true,
|
|
237
|
+
},
|
|
238
|
+
issues: [],
|
|
239
|
+
};
|
|
240
|
+
const defaultManagerRuns = {
|
|
241
|
+
schemaVersion: "0.1.0",
|
|
242
|
+
runs: [],
|
|
243
|
+
};
|
|
244
|
+
const defaultMaestroState = createDefaultMaestroState();
|
|
245
|
+
const defaultActiveAutonomyCore = createDefaultActiveAutonomyCore();
|
|
246
|
+
const defaultSemanticRecordingCore = createDefaultSemanticRecordingCore();
|
|
247
|
+
const defaultHelperOrchestrationCore = createDefaultHelperOrchestrationCore();
|
|
248
|
+
const defaultLearningLoopCore = createDefaultLearningLoopCore();
|
|
249
|
+
const defaultPromptStrategyCore = createDefaultPromptStrategyCore();
|
|
250
|
+
const defaultContextEconomyCore = createDefaultContextEconomyCore();
|
|
251
|
+
const defaultEnvironmentAwarenessCore = createDefaultEnvironmentAwarenessCore();
|
|
252
|
+
const defaultCoreSourceIngest = createDefaultCoreSourceIngest();
|
|
253
|
+
const defaultUniversalPluginBrokerCore = createDefaultUniversalPluginBrokerCore();
|
|
254
|
+
const defaultObsidianBridge = createDefaultObsidianBridge();
|
|
255
|
+
const defaultObsidianVaultIndex = createDefaultObsidianVaultIndex();
|
|
256
|
+
const defaultObsidianVaultOperations = createDefaultObsidianVaultOperations();
|
|
257
|
+
const defaultWorkspaceVirtualizer = createDefaultWorkspaceVirtualizer();
|
|
258
|
+
const defaultCodeGraphRehearse = createDefaultCodeGraphRehearse();
|
|
259
|
+
const defaultSkillsRegistryExport = createDefaultSkillsRegistryExport();
|
|
260
|
+
const defaultCapabilityComposition = createDefaultCapabilityComposition();
|
|
261
|
+
const defaultWorkspaceContextPack = createDefaultWorkspaceContextPack();
|
|
262
|
+
const defaultWorkspaceEffectiveness = createDefaultWorkspaceEffectiveness();
|
|
263
|
+
const defaultSemanticReceiptIndex = createDefaultSemanticReceiptIndex();
|
|
264
|
+
const terminalManagerStates = new Set(["completed", "blocked", "failed", "cancelled"]);
|
|
265
|
+
const repairableRuntimeArtifacts = new Set([
|
|
266
|
+
"guidance.merged",
|
|
267
|
+
"guidance.includeGraph",
|
|
268
|
+
"context.activeAutonomyCore",
|
|
269
|
+
"context.recordingCore",
|
|
270
|
+
"context.helperOrchestrationCore",
|
|
271
|
+
"context.learningLoopCore",
|
|
272
|
+
"context.promptStrategyCore",
|
|
273
|
+
"context.contextEconomyCore",
|
|
274
|
+
"context.environmentAwarenessCore",
|
|
275
|
+
"context.coreSourceIngest",
|
|
276
|
+
"context.universalPluginBrokerCore",
|
|
277
|
+
"context.obsidianBridge",
|
|
278
|
+
"context.obsidianVaultOperations",
|
|
279
|
+
"context.workspaceVirtualizer",
|
|
280
|
+
"context.codeGraphRehearse",
|
|
281
|
+
"context.skillsRegistryExport",
|
|
282
|
+
"context.capabilityComposition",
|
|
283
|
+
"context.workspaceContextPack",
|
|
284
|
+
"context.workspaceEffectiveness",
|
|
285
|
+
"evidence.semanticReceipts",
|
|
286
|
+
"memory.index",
|
|
287
|
+
"hooks.config",
|
|
288
|
+
"tasks.registry",
|
|
289
|
+
"workspaces.index",
|
|
290
|
+
"runtime.managerRuns",
|
|
291
|
+
"runtime.maestroState",
|
|
292
|
+
]);
|
|
293
|
+
|
|
294
|
+
function coerceValidated(value, fallback, label, predicate, invalidArtifacts) {
|
|
295
|
+
if (predicate(value)) {
|
|
296
|
+
return value;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
invalidArtifacts.push(label);
|
|
300
|
+
return fallback;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export async function ensureRuntimeSubsystems() {
|
|
304
|
+
for (const seedRuntimeSubsystem of runtimeSubsystemSeeders) {
|
|
305
|
+
await seedRuntimeSubsystem();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function getMailboxProposalPath(kind) {
|
|
310
|
+
return path.join(getTaskMailboxRoot(), `${Date.now()}-${kind}-${randomUUID()}.json`);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export function isLeaderActor(actor = "leader") {
|
|
314
|
+
return actor === "leader";
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export async function loadLeaderAuthority() {
|
|
318
|
+
try {
|
|
319
|
+
const registry = await readJson(getTaskRegistryPath());
|
|
320
|
+
const isValidRegistry =
|
|
321
|
+
registry &&
|
|
322
|
+
typeof registry === "object" &&
|
|
323
|
+
typeof registry.leader === "string" &&
|
|
324
|
+
Array.isArray(registry.workers) &&
|
|
325
|
+
Array.isArray(registry.tasks);
|
|
326
|
+
|
|
327
|
+
if (!isValidRegistry) {
|
|
328
|
+
return { state: "invalid", leaderActor: null };
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return { state: "ok", leaderActor: registry.leader };
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
334
|
+
return { state: "missing", leaderActor: "leader" };
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return { state: "invalid", leaderActor: null };
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export async function assertLeaderAuthority(actor) {
|
|
342
|
+
const authority = await loadLeaderAuthority();
|
|
343
|
+
if (authority.state === "invalid") {
|
|
344
|
+
throw new Error("Invalid runtime authority: tasks.registry");
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const leaderActor = authority.leaderActor ?? "leader";
|
|
348
|
+
const effectiveActor = actor ?? leaderActor;
|
|
349
|
+
if (effectiveActor !== leaderActor) {
|
|
350
|
+
throw new Error("Leader authority required");
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return authority;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export async function queueMailboxProposal({ actor, kind, payload }) {
|
|
357
|
+
const proposal = {
|
|
358
|
+
schemaVersion: "0.1.0",
|
|
359
|
+
actor,
|
|
360
|
+
kind,
|
|
361
|
+
payload,
|
|
362
|
+
proposedAt: new Date().toISOString(),
|
|
363
|
+
};
|
|
364
|
+
const target = getMailboxProposalPath(kind);
|
|
365
|
+
await writeJson(target, proposal);
|
|
366
|
+
return target;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export async function guardLeaderMutation({ actor, kind, payload }) {
|
|
370
|
+
const authority = await loadLeaderAuthority();
|
|
371
|
+
if (authority.state === "invalid") {
|
|
372
|
+
throw new Error("Invalid runtime authority: tasks.registry");
|
|
373
|
+
}
|
|
374
|
+
const leaderActor = authority.leaderActor ?? "leader";
|
|
375
|
+
const effectiveActor = actor ?? leaderActor;
|
|
376
|
+
if (effectiveActor === leaderActor) {
|
|
377
|
+
return { allowed: true, proposalPath: null };
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const proposalPath = await queueMailboxProposal({ actor: effectiveActor, kind, payload });
|
|
381
|
+
return { allowed: false, proposalPath };
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export async function loadRuntimeSnapshot() {
|
|
385
|
+
const missingArtifacts = [];
|
|
386
|
+
const invalidArtifacts = [];
|
|
387
|
+
const readJsonWithStatus = async (filePath, fallback, label) => {
|
|
388
|
+
try {
|
|
389
|
+
return await readJson(filePath);
|
|
390
|
+
} catch (error) {
|
|
391
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
392
|
+
missingArtifacts.push(label);
|
|
393
|
+
} else {
|
|
394
|
+
invalidArtifacts.push(label);
|
|
395
|
+
}
|
|
396
|
+
return fallback;
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
const readTextWithStatus = async (filePath, fallback, label) => {
|
|
400
|
+
try {
|
|
401
|
+
return await fs.readFile(filePath, "utf8");
|
|
402
|
+
} catch (error) {
|
|
403
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
404
|
+
missingArtifacts.push(label);
|
|
405
|
+
} else {
|
|
406
|
+
invalidArtifacts.push(label);
|
|
407
|
+
}
|
|
408
|
+
return fallback;
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
const mailboxEntries = await fs.readdir(getTaskMailboxRoot()).catch(() => {
|
|
412
|
+
missingArtifacts.push("tasks.mailbox");
|
|
413
|
+
return [];
|
|
414
|
+
});
|
|
415
|
+
await fs.access(getRuntimeHooksAuditPath()).catch(() => {
|
|
416
|
+
missingArtifacts.push("hooks.audit");
|
|
417
|
+
});
|
|
418
|
+
await fs.access(getTaskLockRoot()).catch(() => {
|
|
419
|
+
missingArtifacts.push("tasks.locks");
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
const [
|
|
423
|
+
mergedGuidance,
|
|
424
|
+
guidanceGraph,
|
|
425
|
+
continuityIndex,
|
|
426
|
+
continuityNotes,
|
|
427
|
+
hookConfig,
|
|
428
|
+
taskRegistry,
|
|
429
|
+
workspaceIndex,
|
|
430
|
+
release,
|
|
431
|
+
decisions,
|
|
432
|
+
audits,
|
|
433
|
+
cves,
|
|
434
|
+
releaseIssueGates,
|
|
435
|
+
managerRuns,
|
|
436
|
+
maestroState,
|
|
437
|
+
activeAutonomyCore,
|
|
438
|
+
semanticRecordingCore,
|
|
439
|
+
helperOrchestrationCore,
|
|
440
|
+
learningLoopCore,
|
|
441
|
+
promptStrategyCore,
|
|
442
|
+
contextEconomyCore,
|
|
443
|
+
environmentAwarenessCore,
|
|
444
|
+
coreSourceIngest,
|
|
445
|
+
universalPluginBrokerCore,
|
|
446
|
+
obsidianBridge,
|
|
447
|
+
obsidianVaultIndex,
|
|
448
|
+
obsidianVaultOperations,
|
|
449
|
+
workspaceVirtualizer,
|
|
450
|
+
codeGraphRehearse,
|
|
451
|
+
skillsRegistryExport,
|
|
452
|
+
capabilityComposition,
|
|
453
|
+
workspaceContextPack,
|
|
454
|
+
workspaceEffectiveness,
|
|
455
|
+
semanticReceiptIndex,
|
|
456
|
+
] = await Promise.all([
|
|
457
|
+
readJsonWithStatus(getMergedGuidancePath(), defaultMergedGuidance, "guidance.merged"),
|
|
458
|
+
readJsonWithStatus(
|
|
459
|
+
getGuidanceIncludeGraphPath(),
|
|
460
|
+
defaultGuidanceGraph,
|
|
461
|
+
"guidance.includeGraph",
|
|
462
|
+
),
|
|
463
|
+
readJsonWithStatus(getContinuityIndexPath(), defaultContinuityIndex, "memory.index"),
|
|
464
|
+
readTextWithStatus(getContinuityNotesPath(), "", "memory.notes"),
|
|
465
|
+
readJsonWithStatus(getRuntimeHooksConfigPath(), defaultHookConfig, "hooks.config"),
|
|
466
|
+
readJsonWithStatus(getTaskRegistryPath(), defaultTaskRegistry, "tasks.registry"),
|
|
467
|
+
readJsonWithStatus(getWorkspacesIndexPath(), defaultWorkspaceIndex, "workspaces.index"),
|
|
468
|
+
(async () => {
|
|
469
|
+
try {
|
|
470
|
+
return validateReleaseState(
|
|
471
|
+
JSON.parse(await fs.readFile(getRuntimeReadPath("release.json"), "utf8")),
|
|
472
|
+
);
|
|
473
|
+
} catch (error) {
|
|
474
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
475
|
+
missingArtifacts.push("runtime.release");
|
|
476
|
+
} else {
|
|
477
|
+
invalidArtifacts.push("runtime.release");
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
return createDefaultReleaseState();
|
|
481
|
+
}
|
|
482
|
+
})(),
|
|
483
|
+
readJsonWithStatus(getRuntimeReadPath("decisions.json"), defaultDecisions, "runtime.decisions"),
|
|
484
|
+
readJsonWithStatus(
|
|
485
|
+
getRuntimeReadPath("evidence", "audits.json"),
|
|
486
|
+
defaultAudits,
|
|
487
|
+
"runtime.audits",
|
|
488
|
+
),
|
|
489
|
+
readJsonWithStatus(getRuntimeReadPath("evidence", "cves.json"), defaultCves, "runtime.cves"),
|
|
490
|
+
readJsonWithStatus(
|
|
491
|
+
path.join(getRepoRoot(), "docs", "qa", "release-issue-gates-0.1.13.json"),
|
|
492
|
+
defaultReleaseIssueGates,
|
|
493
|
+
"release.issueGates",
|
|
494
|
+
),
|
|
495
|
+
readJsonWithStatus(getManagerRunsPath(), defaultManagerRuns, "runtime.managerRuns"),
|
|
496
|
+
readJsonWithStatus(getMaestroStatePath(), defaultMaestroState, "runtime.maestroState"),
|
|
497
|
+
readJsonWithStatus(
|
|
498
|
+
getActiveAutonomyCorePath(),
|
|
499
|
+
defaultActiveAutonomyCore,
|
|
500
|
+
"context.activeAutonomyCore",
|
|
501
|
+
),
|
|
502
|
+
readJsonWithStatus(
|
|
503
|
+
getSemanticRecordingCorePath(),
|
|
504
|
+
defaultSemanticRecordingCore,
|
|
505
|
+
"context.recordingCore",
|
|
506
|
+
),
|
|
507
|
+
readJsonWithStatus(
|
|
508
|
+
getHelperOrchestrationCorePath(),
|
|
509
|
+
defaultHelperOrchestrationCore,
|
|
510
|
+
"context.helperOrchestrationCore",
|
|
511
|
+
),
|
|
512
|
+
readJsonWithStatus(
|
|
513
|
+
getLearningLoopCorePath(),
|
|
514
|
+
defaultLearningLoopCore,
|
|
515
|
+
"context.learningLoopCore",
|
|
516
|
+
),
|
|
517
|
+
readJsonWithStatus(
|
|
518
|
+
getPromptStrategyCorePath(),
|
|
519
|
+
defaultPromptStrategyCore,
|
|
520
|
+
"context.promptStrategyCore",
|
|
521
|
+
),
|
|
522
|
+
readJsonWithStatus(
|
|
523
|
+
getContextEconomyCorePath(),
|
|
524
|
+
defaultContextEconomyCore,
|
|
525
|
+
"context.contextEconomyCore",
|
|
526
|
+
),
|
|
527
|
+
readJsonWithStatus(
|
|
528
|
+
getEnvironmentAwarenessCorePath(),
|
|
529
|
+
defaultEnvironmentAwarenessCore,
|
|
530
|
+
"context.environmentAwarenessCore",
|
|
531
|
+
),
|
|
532
|
+
readJsonWithStatus(
|
|
533
|
+
getCoreSourceIngestPath(),
|
|
534
|
+
defaultCoreSourceIngest,
|
|
535
|
+
"context.coreSourceIngest",
|
|
536
|
+
),
|
|
537
|
+
readJsonWithStatus(
|
|
538
|
+
getUniversalPluginBrokerCorePath(),
|
|
539
|
+
defaultUniversalPluginBrokerCore,
|
|
540
|
+
"context.universalPluginBrokerCore",
|
|
541
|
+
),
|
|
542
|
+
readJsonWithStatus(getObsidianBridgePath(), defaultObsidianBridge, "context.obsidianBridge"),
|
|
543
|
+
readJsonWithStatus(
|
|
544
|
+
getObsidianVaultIndexPath(),
|
|
545
|
+
defaultObsidianVaultIndex,
|
|
546
|
+
"context.obsidianVaultIndex",
|
|
547
|
+
),
|
|
548
|
+
readJsonWithStatus(
|
|
549
|
+
getObsidianVaultOperationsPath(),
|
|
550
|
+
defaultObsidianVaultOperations,
|
|
551
|
+
"context.obsidianVaultOperations",
|
|
552
|
+
),
|
|
553
|
+
readJsonWithStatus(
|
|
554
|
+
getWorkspaceVirtualizerPath(),
|
|
555
|
+
defaultWorkspaceVirtualizer,
|
|
556
|
+
"context.workspaceVirtualizer",
|
|
557
|
+
),
|
|
558
|
+
readJsonWithStatus(
|
|
559
|
+
getCodeGraphRehearsePath(),
|
|
560
|
+
defaultCodeGraphRehearse,
|
|
561
|
+
"context.codeGraphRehearse",
|
|
562
|
+
),
|
|
563
|
+
readJsonWithStatus(
|
|
564
|
+
getSkillsRegistryExportPath(),
|
|
565
|
+
defaultSkillsRegistryExport,
|
|
566
|
+
"context.skillsRegistryExport",
|
|
567
|
+
),
|
|
568
|
+
readJsonWithStatus(
|
|
569
|
+
getCapabilityCompositionPath(),
|
|
570
|
+
defaultCapabilityComposition,
|
|
571
|
+
"context.capabilityComposition",
|
|
572
|
+
),
|
|
573
|
+
readJsonWithStatus(
|
|
574
|
+
getWorkspaceContextPackPath(),
|
|
575
|
+
defaultWorkspaceContextPack,
|
|
576
|
+
"context.workspaceContextPack",
|
|
577
|
+
),
|
|
578
|
+
readJsonWithStatus(
|
|
579
|
+
getWorkspaceEffectivenessPath(),
|
|
580
|
+
defaultWorkspaceEffectiveness,
|
|
581
|
+
"context.workspaceEffectiveness",
|
|
582
|
+
),
|
|
583
|
+
readJsonWithStatus(
|
|
584
|
+
getSemanticReceiptIndexPath(),
|
|
585
|
+
defaultSemanticReceiptIndex,
|
|
586
|
+
"evidence.semanticReceipts",
|
|
587
|
+
),
|
|
588
|
+
]);
|
|
589
|
+
const validatedMergedGuidance = coerceValidated(
|
|
590
|
+
mergedGuidance,
|
|
591
|
+
defaultMergedGuidance,
|
|
592
|
+
"guidance.merged",
|
|
593
|
+
(value) =>
|
|
594
|
+
value &&
|
|
595
|
+
typeof value === "object" &&
|
|
596
|
+
Array.isArray(value.sources) &&
|
|
597
|
+
typeof value.content === "string",
|
|
598
|
+
invalidArtifacts,
|
|
599
|
+
);
|
|
600
|
+
const validatedGuidanceGraph = coerceValidated(
|
|
601
|
+
guidanceGraph,
|
|
602
|
+
defaultGuidanceGraph,
|
|
603
|
+
"guidance.includeGraph",
|
|
604
|
+
(value) =>
|
|
605
|
+
value &&
|
|
606
|
+
typeof value === "object" &&
|
|
607
|
+
Array.isArray(value.roots) &&
|
|
608
|
+
Array.isArray(value.edges),
|
|
609
|
+
invalidArtifacts,
|
|
610
|
+
);
|
|
611
|
+
const validatedContinuityIndex = coerceValidated(
|
|
612
|
+
continuityIndex,
|
|
613
|
+
defaultContinuityIndex,
|
|
614
|
+
"memory.index",
|
|
615
|
+
(value) =>
|
|
616
|
+
value &&
|
|
617
|
+
typeof value === "object" &&
|
|
618
|
+
typeof value.sessionCount === "number" &&
|
|
619
|
+
"lastUpdatedAt" in value,
|
|
620
|
+
invalidArtifacts,
|
|
621
|
+
);
|
|
622
|
+
const validatedHookConfig = coerceValidated(
|
|
623
|
+
hookConfig,
|
|
624
|
+
defaultHookConfig,
|
|
625
|
+
"hooks.config",
|
|
626
|
+
(value) =>
|
|
627
|
+
value &&
|
|
628
|
+
typeof value === "object" &&
|
|
629
|
+
Array.isArray(value.compatibilityNamespace) &&
|
|
630
|
+
Array.isArray(value.runtimeNamespace) &&
|
|
631
|
+
Array.isArray(value.hooks) &&
|
|
632
|
+
value.activeAutonomy &&
|
|
633
|
+
typeof value.activeAutonomy === "object" &&
|
|
634
|
+
value.activeAutonomy.enabled === true &&
|
|
635
|
+
Array.isArray(value.activeAutonomy.stallPatterns),
|
|
636
|
+
invalidArtifacts,
|
|
637
|
+
);
|
|
638
|
+
const validatedTaskRegistry = coerceValidated(
|
|
639
|
+
taskRegistry,
|
|
640
|
+
defaultTaskRegistry,
|
|
641
|
+
"tasks.registry",
|
|
642
|
+
(value) =>
|
|
643
|
+
value &&
|
|
644
|
+
typeof value === "object" &&
|
|
645
|
+
typeof value.leader === "string" &&
|
|
646
|
+
Array.isArray(value.workers) &&
|
|
647
|
+
Array.isArray(value.tasks),
|
|
648
|
+
invalidArtifacts,
|
|
649
|
+
);
|
|
650
|
+
const validatedWorkspaceIndex = coerceValidated(
|
|
651
|
+
workspaceIndex,
|
|
652
|
+
defaultWorkspaceIndex,
|
|
653
|
+
"workspaces.index",
|
|
654
|
+
(value) => value && typeof value === "object" && Array.isArray(value.items),
|
|
655
|
+
invalidArtifacts,
|
|
656
|
+
);
|
|
657
|
+
const validatedDecisions = coerceValidated(
|
|
658
|
+
decisions,
|
|
659
|
+
defaultDecisions,
|
|
660
|
+
"runtime.decisions",
|
|
661
|
+
(value) => value && typeof value === "object" && Array.isArray(value.decisions),
|
|
662
|
+
invalidArtifacts,
|
|
663
|
+
);
|
|
664
|
+
const validatedAudits = coerceValidated(
|
|
665
|
+
audits,
|
|
666
|
+
defaultAudits,
|
|
667
|
+
"runtime.audits",
|
|
668
|
+
(value) => value && typeof value === "object" && Array.isArray(value.items),
|
|
669
|
+
invalidArtifacts,
|
|
670
|
+
);
|
|
671
|
+
const validatedCves = coerceValidated(
|
|
672
|
+
cves,
|
|
673
|
+
defaultCves,
|
|
674
|
+
"runtime.cves",
|
|
675
|
+
(value) => value && typeof value === "object" && Array.isArray(value.items),
|
|
676
|
+
invalidArtifacts,
|
|
677
|
+
);
|
|
678
|
+
const releaseIssueGateStatus = summarizeReleaseIssueGateStatus(releaseIssueGates, {
|
|
679
|
+
version: releaseIssueGates.releaseVersion,
|
|
680
|
+
});
|
|
681
|
+
const validatedManagerRuns = coerceValidated(
|
|
682
|
+
managerRuns,
|
|
683
|
+
defaultManagerRuns,
|
|
684
|
+
"runtime.managerRuns",
|
|
685
|
+
(value) => value && typeof value === "object" && Array.isArray(value.runs),
|
|
686
|
+
invalidArtifacts,
|
|
687
|
+
);
|
|
688
|
+
const validatedMaestroState = coerceValidated(
|
|
689
|
+
maestroState,
|
|
690
|
+
defaultMaestroState,
|
|
691
|
+
"runtime.maestroState",
|
|
692
|
+
(value) =>
|
|
693
|
+
value &&
|
|
694
|
+
typeof value === "object" &&
|
|
695
|
+
typeof value.global_status === "string" &&
|
|
696
|
+
value.runtime_tracks &&
|
|
697
|
+
typeof value.runtime_tracks === "object" &&
|
|
698
|
+
value.downstream_lock_table &&
|
|
699
|
+
typeof value.downstream_lock_table === "object",
|
|
700
|
+
invalidArtifacts,
|
|
701
|
+
);
|
|
702
|
+
const validatedActiveAutonomyCore = coerceValidated(
|
|
703
|
+
activeAutonomyCore,
|
|
704
|
+
defaultActiveAutonomyCore,
|
|
705
|
+
"context.activeAutonomyCore",
|
|
706
|
+
(value) => {
|
|
707
|
+
try {
|
|
708
|
+
validateActiveAutonomyCore(value);
|
|
709
|
+
return true;
|
|
710
|
+
} catch {
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
invalidArtifacts,
|
|
715
|
+
);
|
|
716
|
+
const validatedSemanticRecordingCore = coerceValidated(
|
|
717
|
+
semanticRecordingCore,
|
|
718
|
+
defaultSemanticRecordingCore,
|
|
719
|
+
"context.recordingCore",
|
|
720
|
+
(value) => {
|
|
721
|
+
try {
|
|
722
|
+
validateSemanticRecordingCore(value);
|
|
723
|
+
return true;
|
|
724
|
+
} catch {
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
invalidArtifacts,
|
|
729
|
+
);
|
|
730
|
+
const validatedHelperOrchestrationCore = coerceValidated(
|
|
731
|
+
helperOrchestrationCore,
|
|
732
|
+
defaultHelperOrchestrationCore,
|
|
733
|
+
"context.helperOrchestrationCore",
|
|
734
|
+
(value) => {
|
|
735
|
+
try {
|
|
736
|
+
validateHelperOrchestrationCore(value);
|
|
737
|
+
return true;
|
|
738
|
+
} catch {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
invalidArtifacts,
|
|
743
|
+
);
|
|
744
|
+
const validatedLearningLoopCore = coerceValidated(
|
|
745
|
+
learningLoopCore,
|
|
746
|
+
defaultLearningLoopCore,
|
|
747
|
+
"context.learningLoopCore",
|
|
748
|
+
(value) => {
|
|
749
|
+
try {
|
|
750
|
+
validateLearningLoopCore(value);
|
|
751
|
+
return true;
|
|
752
|
+
} catch {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
},
|
|
756
|
+
invalidArtifacts,
|
|
757
|
+
);
|
|
758
|
+
const validatedPromptStrategyCore = coerceValidated(
|
|
759
|
+
promptStrategyCore,
|
|
760
|
+
defaultPromptStrategyCore,
|
|
761
|
+
"context.promptStrategyCore",
|
|
762
|
+
(value) => {
|
|
763
|
+
try {
|
|
764
|
+
validatePromptStrategyCore(value);
|
|
765
|
+
return true;
|
|
766
|
+
} catch {
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
invalidArtifacts,
|
|
771
|
+
);
|
|
772
|
+
const validatedContextEconomyCore = coerceValidated(
|
|
773
|
+
contextEconomyCore,
|
|
774
|
+
defaultContextEconomyCore,
|
|
775
|
+
"context.contextEconomyCore",
|
|
776
|
+
(value) => {
|
|
777
|
+
try {
|
|
778
|
+
validateContextEconomyCore(value);
|
|
779
|
+
return true;
|
|
780
|
+
} catch {
|
|
781
|
+
return false;
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
invalidArtifacts,
|
|
785
|
+
);
|
|
786
|
+
const validatedEnvironmentAwarenessCore = coerceValidated(
|
|
787
|
+
environmentAwarenessCore,
|
|
788
|
+
defaultEnvironmentAwarenessCore,
|
|
789
|
+
"context.environmentAwarenessCore",
|
|
790
|
+
(value) => {
|
|
791
|
+
try {
|
|
792
|
+
validateEnvironmentAwarenessCore(value);
|
|
793
|
+
return true;
|
|
794
|
+
} catch {
|
|
795
|
+
return false;
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
invalidArtifacts,
|
|
799
|
+
);
|
|
800
|
+
const validatedCoreSourceIngest = coerceValidated(
|
|
801
|
+
coreSourceIngest,
|
|
802
|
+
defaultCoreSourceIngest,
|
|
803
|
+
"context.coreSourceIngest",
|
|
804
|
+
(value) => {
|
|
805
|
+
try {
|
|
806
|
+
validateCoreSourceIngest(value);
|
|
807
|
+
return true;
|
|
808
|
+
} catch {
|
|
809
|
+
return false;
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
invalidArtifacts,
|
|
813
|
+
);
|
|
814
|
+
const validatedUniversalPluginBrokerCore = coerceValidated(
|
|
815
|
+
universalPluginBrokerCore,
|
|
816
|
+
defaultUniversalPluginBrokerCore,
|
|
817
|
+
"context.universalPluginBrokerCore",
|
|
818
|
+
(value) => {
|
|
819
|
+
try {
|
|
820
|
+
validateUniversalPluginBrokerCore(value);
|
|
821
|
+
return true;
|
|
822
|
+
} catch {
|
|
823
|
+
return false;
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
invalidArtifacts,
|
|
827
|
+
);
|
|
828
|
+
const validatedObsidianBridge = coerceValidated(
|
|
829
|
+
obsidianBridge,
|
|
830
|
+
defaultObsidianBridge,
|
|
831
|
+
"context.obsidianBridge",
|
|
832
|
+
(value) => {
|
|
833
|
+
try {
|
|
834
|
+
validateObsidianBridge(value);
|
|
835
|
+
return true;
|
|
836
|
+
} catch {
|
|
837
|
+
return false;
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
invalidArtifacts,
|
|
841
|
+
);
|
|
842
|
+
const validatedObsidianVaultIndex = coerceValidated(
|
|
843
|
+
obsidianVaultIndex,
|
|
844
|
+
defaultObsidianVaultIndex,
|
|
845
|
+
"context.obsidianVaultIndex",
|
|
846
|
+
(value) => {
|
|
847
|
+
try {
|
|
848
|
+
validateObsidianVaultIndex(value);
|
|
849
|
+
return true;
|
|
850
|
+
} catch {
|
|
851
|
+
return false;
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
invalidArtifacts,
|
|
855
|
+
);
|
|
856
|
+
const validatedObsidianVaultOperations = coerceValidated(
|
|
857
|
+
obsidianVaultOperations,
|
|
858
|
+
defaultObsidianVaultOperations,
|
|
859
|
+
"context.obsidianVaultOperations",
|
|
860
|
+
(value) => {
|
|
861
|
+
try {
|
|
862
|
+
validateObsidianVaultOperations(value);
|
|
863
|
+
return true;
|
|
864
|
+
} catch {
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
invalidArtifacts,
|
|
869
|
+
);
|
|
870
|
+
const validatedWorkspaceVirtualizer = coerceValidated(
|
|
871
|
+
workspaceVirtualizer,
|
|
872
|
+
defaultWorkspaceVirtualizer,
|
|
873
|
+
"context.workspaceVirtualizer",
|
|
874
|
+
(value) => {
|
|
875
|
+
try {
|
|
876
|
+
validateWorkspaceVirtualizer(value);
|
|
877
|
+
return true;
|
|
878
|
+
} catch {
|
|
879
|
+
return false;
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
invalidArtifacts,
|
|
883
|
+
);
|
|
884
|
+
const validatedCodeGraphRehearse = coerceValidated(
|
|
885
|
+
codeGraphRehearse,
|
|
886
|
+
defaultCodeGraphRehearse,
|
|
887
|
+
"context.codeGraphRehearse",
|
|
888
|
+
(value) => {
|
|
889
|
+
try {
|
|
890
|
+
validateCodeGraphRehearse(value);
|
|
891
|
+
return true;
|
|
892
|
+
} catch {
|
|
893
|
+
return false;
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
invalidArtifacts,
|
|
897
|
+
);
|
|
898
|
+
const validatedSkillsRegistryExport = coerceValidated(
|
|
899
|
+
skillsRegistryExport,
|
|
900
|
+
defaultSkillsRegistryExport,
|
|
901
|
+
"context.skillsRegistryExport",
|
|
902
|
+
(value) => {
|
|
903
|
+
try {
|
|
904
|
+
validateSkillsRegistryExport(value);
|
|
905
|
+
return true;
|
|
906
|
+
} catch {
|
|
907
|
+
return false;
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
invalidArtifacts,
|
|
911
|
+
);
|
|
912
|
+
const validatedCapabilityComposition = coerceValidated(
|
|
913
|
+
capabilityComposition,
|
|
914
|
+
defaultCapabilityComposition,
|
|
915
|
+
"context.capabilityComposition",
|
|
916
|
+
(value) => {
|
|
917
|
+
try {
|
|
918
|
+
validateCapabilityComposition(value);
|
|
919
|
+
return true;
|
|
920
|
+
} catch {
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
invalidArtifacts,
|
|
925
|
+
);
|
|
926
|
+
const validatedWorkspaceContextPack = coerceValidated(
|
|
927
|
+
workspaceContextPack,
|
|
928
|
+
defaultWorkspaceContextPack,
|
|
929
|
+
"context.workspaceContextPack",
|
|
930
|
+
(value) => {
|
|
931
|
+
try {
|
|
932
|
+
validateWorkspaceContextPack(value);
|
|
933
|
+
return true;
|
|
934
|
+
} catch {
|
|
935
|
+
return false;
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
invalidArtifacts,
|
|
939
|
+
);
|
|
940
|
+
const validatedWorkspaceEffectiveness = coerceValidated(
|
|
941
|
+
workspaceEffectiveness,
|
|
942
|
+
defaultWorkspaceEffectiveness,
|
|
943
|
+
"context.workspaceEffectiveness",
|
|
944
|
+
(value) => {
|
|
945
|
+
try {
|
|
946
|
+
validateWorkspaceEffectiveness(value);
|
|
947
|
+
return true;
|
|
948
|
+
} catch {
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
invalidArtifacts,
|
|
953
|
+
);
|
|
954
|
+
const validatedSemanticReceiptIndex = coerceValidated(
|
|
955
|
+
semanticReceiptIndex,
|
|
956
|
+
defaultSemanticReceiptIndex,
|
|
957
|
+
"evidence.semanticReceipts",
|
|
958
|
+
(value) => {
|
|
959
|
+
try {
|
|
960
|
+
validateSemanticReceiptIndex(value);
|
|
961
|
+
return true;
|
|
962
|
+
} catch {
|
|
963
|
+
return false;
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
invalidArtifacts,
|
|
967
|
+
);
|
|
968
|
+
|
|
969
|
+
return {
|
|
970
|
+
mergedGuidance: validatedMergedGuidance,
|
|
971
|
+
guidanceGraph: validatedGuidanceGraph,
|
|
972
|
+
continuityIndex: validatedContinuityIndex,
|
|
973
|
+
continuityNotes,
|
|
974
|
+
hookConfig: validatedHookConfig,
|
|
975
|
+
taskRegistry: validatedTaskRegistry,
|
|
976
|
+
mailboxEntries,
|
|
977
|
+
workspaceIndex: validatedWorkspaceIndex,
|
|
978
|
+
release,
|
|
979
|
+
decisions: validatedDecisions,
|
|
980
|
+
audits: validatedAudits,
|
|
981
|
+
cves: validatedCves,
|
|
982
|
+
releaseIssueGateStatus,
|
|
983
|
+
managerRuns: validatedManagerRuns,
|
|
984
|
+
maestroState: validatedMaestroState,
|
|
985
|
+
activeAutonomyCore: validatedActiveAutonomyCore,
|
|
986
|
+
semanticRecordingCore: validatedSemanticRecordingCore,
|
|
987
|
+
helperOrchestrationCore: validatedHelperOrchestrationCore,
|
|
988
|
+
learningLoopCore: validatedLearningLoopCore,
|
|
989
|
+
promptStrategyCore: validatedPromptStrategyCore,
|
|
990
|
+
contextEconomyCore: validatedContextEconomyCore,
|
|
991
|
+
environmentAwarenessCore: validatedEnvironmentAwarenessCore,
|
|
992
|
+
coreSourceIngest: validatedCoreSourceIngest,
|
|
993
|
+
universalPluginBrokerCore: validatedUniversalPluginBrokerCore,
|
|
994
|
+
obsidianBridge: validatedObsidianBridge,
|
|
995
|
+
obsidianVaultIndex: validatedObsidianVaultIndex,
|
|
996
|
+
obsidianVaultOperations: validatedObsidianVaultOperations,
|
|
997
|
+
workspaceVirtualizer: validatedWorkspaceVirtualizer,
|
|
998
|
+
codeGraphRehearse: validatedCodeGraphRehearse,
|
|
999
|
+
skillsRegistryExport: validatedSkillsRegistryExport,
|
|
1000
|
+
capabilityComposition: validatedCapabilityComposition,
|
|
1001
|
+
workspaceContextPack: validatedWorkspaceContextPack,
|
|
1002
|
+
workspaceEffectiveness: validatedWorkspaceEffectiveness,
|
|
1003
|
+
semanticReceiptIndex: validatedSemanticReceiptIndex,
|
|
1004
|
+
missingArtifacts,
|
|
1005
|
+
invalidArtifacts,
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
export function createRuntimeSummary(snapshot) {
|
|
1010
|
+
const trimmedNotes = snapshot.continuityNotes.trim();
|
|
1011
|
+
const criticalPackageExposureCount = snapshot.audits.items.filter(
|
|
1012
|
+
(item) =>
|
|
1013
|
+
item?.record_type === "finding:package_exposure" &&
|
|
1014
|
+
`${item.severity}`.toLowerCase() === "critical",
|
|
1015
|
+
).length;
|
|
1016
|
+
const mcpPolicyViolationCount = snapshot.audits.items.filter(
|
|
1017
|
+
(item) =>
|
|
1018
|
+
item?.record_type === "policy:mcp_validation" &&
|
|
1019
|
+
["critical", "high"].includes(`${item.severity}`.toLowerCase()),
|
|
1020
|
+
).length;
|
|
1021
|
+
return {
|
|
1022
|
+
guidanceSourceCount: snapshot.mergedGuidance.sources.length,
|
|
1023
|
+
guidanceIncludeRoots: snapshot.guidanceGraph.roots.length,
|
|
1024
|
+
continuitySessionCount: snapshot.continuityIndex.sessionCount,
|
|
1025
|
+
continuityHasNotes:
|
|
1026
|
+
trimmedNotes.length > 0 &&
|
|
1027
|
+
trimmedNotes !== "# Continuity Notes\n\nNo continuity notes captured yet.",
|
|
1028
|
+
compatibilityHookCount: snapshot.hookConfig.compatibilityNamespace.length,
|
|
1029
|
+
runtimeHookCount: snapshot.hookConfig.runtimeNamespace.length,
|
|
1030
|
+
configuredRuntimeHookCount: snapshot.hookConfig.hooks.length,
|
|
1031
|
+
workerCount: snapshot.taskRegistry.workers.length,
|
|
1032
|
+
taskCount: snapshot.taskRegistry.tasks.length,
|
|
1033
|
+
pendingMailboxCount: snapshot.mailboxEntries.length,
|
|
1034
|
+
workspaceCount: snapshot.workspaceIndex.items.length,
|
|
1035
|
+
decisionCount: snapshot.decisions.decisions.length,
|
|
1036
|
+
mcpPolicyViolationCount,
|
|
1037
|
+
managerRunCount: snapshot.managerRuns.runs.length,
|
|
1038
|
+
activeManagerRunCount: snapshot.managerRuns.runs.filter(
|
|
1039
|
+
(run) => !terminalManagerStates.has(run.state),
|
|
1040
|
+
).length,
|
|
1041
|
+
waitingReviewManagerRunCount: snapshot.managerRuns.runs.filter(
|
|
1042
|
+
(run) => run.state === "waiting-review",
|
|
1043
|
+
).length,
|
|
1044
|
+
maestroGlobalStatus: snapshot.maestroState.global_status,
|
|
1045
|
+
maestroTrackCount: Object.keys(snapshot.maestroState.runtime_tracks).length,
|
|
1046
|
+
semanticRecordingLayerCount: snapshot.semanticRecordingCore.layers.length,
|
|
1047
|
+
semanticDefaultCoreCount: Object.keys(snapshot.semanticRecordingCore.default_core_capabilities)
|
|
1048
|
+
.length,
|
|
1049
|
+
helperCoreContractCount: snapshot.helperOrchestrationCore.helper_contracts.length,
|
|
1050
|
+
helperCoreNonGating: snapshot.helperOrchestrationCore.composition_rules.non_gating === true,
|
|
1051
|
+
helperCoreReleaseMutationAllowed:
|
|
1052
|
+
snapshot.helperOrchestrationCore.composition_rules.release_state_mutation_allowed === true,
|
|
1053
|
+
learningLoopDomainCount: snapshot.learningLoopCore.domains.length,
|
|
1054
|
+
learningLoopRecordCount: snapshot.learningLoopCore.records.length,
|
|
1055
|
+
activeAutonomyAskOnlyCount: snapshot.activeAutonomyCore.decision_rule.ask_only_when.length,
|
|
1056
|
+
activeAutonomyStallPatternCount:
|
|
1057
|
+
snapshot.activeAutonomyCore.runtime_enforcement.stall_patterns.length,
|
|
1058
|
+
activeAutonomyHookEnabled: snapshot.hookConfig.activeAutonomy.enabled,
|
|
1059
|
+
promptStrategyTechniqueFamilyCount: snapshot.promptStrategyCore.technique_families.length,
|
|
1060
|
+
promptStrategyLaneCount: Object.keys(snapshot.promptStrategyCore.lane_policy).length,
|
|
1061
|
+
contextEconomyAppliesToCount: snapshot.contextEconomyCore.applies_to.length,
|
|
1062
|
+
contextEconomyPreserveExactCount: snapshot.contextEconomyCore.preserve_exact.length,
|
|
1063
|
+
contextEconomySafetyValveCount: snapshot.contextEconomyCore.safety_valves.length,
|
|
1064
|
+
environmentCapabilityCount: snapshot.environmentAwarenessCore.capabilities.length,
|
|
1065
|
+
environmentCapabilityTypes: [
|
|
1066
|
+
...new Set(
|
|
1067
|
+
snapshot.environmentAwarenessCore.capabilities.map(
|
|
1068
|
+
(capability) => capability.capability_type,
|
|
1069
|
+
),
|
|
1070
|
+
),
|
|
1071
|
+
].sort(),
|
|
1072
|
+
environmentRecordsAs: snapshot.environmentAwarenessCore.discovery_policy.records_as,
|
|
1073
|
+
environmentNeverRecordsAs: snapshot.environmentAwarenessCore.discovery_policy.never_records_as,
|
|
1074
|
+
coreSourceIngestStatus: snapshot.coreSourceIngest.status ?? "NOT_INGESTED",
|
|
1075
|
+
coreSourceIngestCount: snapshot.coreSourceIngest.sources.filter((source) =>
|
|
1076
|
+
["INGESTED", "LOCAL_CORE"].includes(source.status),
|
|
1077
|
+
).length,
|
|
1078
|
+
coreSourceRuntimeFetchRequired: snapshot.coreSourceIngest.runtime_fetch_required,
|
|
1079
|
+
universalPluginBrokerSupportedAgentCount:
|
|
1080
|
+
snapshot.universalPluginBrokerCore.supported_agents.length,
|
|
1081
|
+
universalPluginBrokerMcpInjectorHosts:
|
|
1082
|
+
snapshot.universalPluginBrokerCore.mcp_injector_hosts.length,
|
|
1083
|
+
universalPluginBrokerRecordsAs: snapshot.universalPluginBrokerCore.mutation_policy.records_as,
|
|
1084
|
+
universalPluginBrokerNeverRecordsAs:
|
|
1085
|
+
snapshot.universalPluginBrokerCore.mutation_policy.never_records_as,
|
|
1086
|
+
obsidianBridgeRecordsAs: snapshot.obsidianBridge.semantic_boundary.records_as,
|
|
1087
|
+
obsidianBridgeNeverRecordsAs: snapshot.obsidianBridge.semantic_boundary.never_records_as,
|
|
1088
|
+
obsidianBridgeQueuedRequestCount: snapshot.obsidianBridge.default_request_queue.length,
|
|
1089
|
+
obsidianBridgeNoteSelectionCount: snapshot.obsidianBridge.note_selection_metadata.length,
|
|
1090
|
+
obsidianBridgeTagGraphClaimCount: snapshot.obsidianBridge.tag_graph_claims.length,
|
|
1091
|
+
obsidianVaultIndexed: snapshot.obsidianVaultIndex.note_count > 0,
|
|
1092
|
+
obsidianVaultPath: snapshot.obsidianVaultIndex.vault_path,
|
|
1093
|
+
obsidianVaultNoteCount: snapshot.obsidianVaultIndex.note_count,
|
|
1094
|
+
obsidianVaultTagCount: snapshot.obsidianVaultIndex.tags.length,
|
|
1095
|
+
obsidianVaultUnresolvedLinkCount: snapshot.obsidianVaultIndex.unresolved_links.length,
|
|
1096
|
+
obsidianVaultOperationCount: snapshot.obsidianVaultOperations.operations.length,
|
|
1097
|
+
workspaceVirtualizerRecordsAs: snapshot.workspaceVirtualizer.evidence_boundary.records_as,
|
|
1098
|
+
workspaceVirtualizerNeverRecordsAs:
|
|
1099
|
+
snapshot.workspaceVirtualizer.evidence_boundary.never_records_as,
|
|
1100
|
+
workspaceVirtualizerSourceMutationAllowed:
|
|
1101
|
+
snapshot.workspaceVirtualizer.mutation_policy.may_mutate_source,
|
|
1102
|
+
codeGraphRehearseRecordsAs: snapshot.codeGraphRehearse.evidence_boundary.records_as,
|
|
1103
|
+
codeGraphRehearseSourceMutationAllowed:
|
|
1104
|
+
snapshot.codeGraphRehearse.mutation_policy.may_mutate_source,
|
|
1105
|
+
codeGraphRehearseMaxSteps: snapshot.codeGraphRehearse.max_steps,
|
|
1106
|
+
skillsRegistryCanonicalDir: snapshot.skillsRegistryExport.canonical_dir,
|
|
1107
|
+
skillsRegistryReleaseMutationAllowed:
|
|
1108
|
+
snapshot.skillsRegistryExport.authority_boundary.exported_payloads_may_mutate_release_state,
|
|
1109
|
+
skillsRegistryUniversalTargetCount: snapshot.skillsRegistryExport.universal_targets.length,
|
|
1110
|
+
skillsRegistryNonUniversalTargetCount:
|
|
1111
|
+
snapshot.skillsRegistryExport.non_universal_targets.length,
|
|
1112
|
+
capabilityCompositionCount: snapshot.capabilityComposition.capability_matrix.length,
|
|
1113
|
+
workspaceContextChannelCount: Object.keys(snapshot.workspaceContextPack.semantic_channels)
|
|
1114
|
+
.length,
|
|
1115
|
+
workspaceEffectivenessReady: snapshot.workspaceEffectiveness.ready,
|
|
1116
|
+
workspaceEffectivenessCheckCount: snapshot.workspaceEffectiveness.checks.length,
|
|
1117
|
+
semanticReceiptCount: snapshot.semanticReceiptIndex.receipts.length,
|
|
1118
|
+
obsidianSemanticRole:
|
|
1119
|
+
snapshot.semanticRecordingCore.default_core_capabilities.obsidian_integration_core
|
|
1120
|
+
.semantic_role,
|
|
1121
|
+
obsidianRecordsAs:
|
|
1122
|
+
snapshot.semanticRecordingCore.default_core_capabilities.obsidian_integration_core.records_as,
|
|
1123
|
+
buildStatus: snapshot.release.build_status,
|
|
1124
|
+
auditCount: snapshot.audits.items.length,
|
|
1125
|
+
cveCount: snapshot.cves.items.length,
|
|
1126
|
+
releaseIssueGateTotal: snapshot.releaseIssueGateStatus.total,
|
|
1127
|
+
releaseIssueGatePassed: snapshot.releaseIssueGateStatus.passed,
|
|
1128
|
+
releaseIssueGateBlockerCount: snapshot.releaseIssueGateStatus.blockers.length,
|
|
1129
|
+
criticalPackageExposureCount,
|
|
1130
|
+
missingArtifacts: snapshot.missingArtifacts,
|
|
1131
|
+
invalidArtifacts: snapshot.invalidArtifacts,
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
export async function repairRuntimeScratchpadArtifacts(artifactLabels = []) {
|
|
1136
|
+
const labels = [...new Set(artifactLabels)].filter((label) =>
|
|
1137
|
+
repairableRuntimeArtifacts.has(label),
|
|
1138
|
+
);
|
|
1139
|
+
|
|
1140
|
+
for (const label of labels) {
|
|
1141
|
+
switch (label) {
|
|
1142
|
+
case "guidance.merged":
|
|
1143
|
+
await writeJson(getMergedGuidancePath(), defaultMergedGuidance);
|
|
1144
|
+
break;
|
|
1145
|
+
case "guidance.includeGraph":
|
|
1146
|
+
await writeJson(getGuidanceIncludeGraphPath(), defaultGuidanceGraph);
|
|
1147
|
+
break;
|
|
1148
|
+
case "context.activeAutonomyCore":
|
|
1149
|
+
await writeJson(getActiveAutonomyCorePath(), defaultActiveAutonomyCore);
|
|
1150
|
+
break;
|
|
1151
|
+
case "context.recordingCore":
|
|
1152
|
+
await writeJson(getSemanticRecordingCorePath(), defaultSemanticRecordingCore);
|
|
1153
|
+
break;
|
|
1154
|
+
case "context.helperOrchestrationCore":
|
|
1155
|
+
await writeJson(getHelperOrchestrationCorePath(), defaultHelperOrchestrationCore);
|
|
1156
|
+
break;
|
|
1157
|
+
case "context.learningLoopCore":
|
|
1158
|
+
await writeJson(getLearningLoopCorePath(), defaultLearningLoopCore);
|
|
1159
|
+
break;
|
|
1160
|
+
case "context.promptStrategyCore":
|
|
1161
|
+
await writeJson(getPromptStrategyCorePath(), defaultPromptStrategyCore);
|
|
1162
|
+
break;
|
|
1163
|
+
case "context.contextEconomyCore":
|
|
1164
|
+
await writeJson(getContextEconomyCorePath(), defaultContextEconomyCore);
|
|
1165
|
+
break;
|
|
1166
|
+
case "context.environmentAwarenessCore":
|
|
1167
|
+
await writeJson(getEnvironmentAwarenessCorePath(), defaultEnvironmentAwarenessCore);
|
|
1168
|
+
break;
|
|
1169
|
+
case "context.coreSourceIngest":
|
|
1170
|
+
await writeJson(getCoreSourceIngestPath(), defaultCoreSourceIngest);
|
|
1171
|
+
break;
|
|
1172
|
+
case "context.universalPluginBrokerCore":
|
|
1173
|
+
await writeJson(getUniversalPluginBrokerCorePath(), defaultUniversalPluginBrokerCore);
|
|
1174
|
+
break;
|
|
1175
|
+
case "context.obsidianVaultOperations":
|
|
1176
|
+
await writeJson(getObsidianVaultOperationsPath(), defaultObsidianVaultOperations);
|
|
1177
|
+
break;
|
|
1178
|
+
case "context.workspaceVirtualizer":
|
|
1179
|
+
await writeJson(getWorkspaceVirtualizerPath(), defaultWorkspaceVirtualizer);
|
|
1180
|
+
break;
|
|
1181
|
+
case "context.codeGraphRehearse":
|
|
1182
|
+
await writeJson(getCodeGraphRehearsePath(), defaultCodeGraphRehearse);
|
|
1183
|
+
break;
|
|
1184
|
+
case "context.skillsRegistryExport":
|
|
1185
|
+
await writeJson(getSkillsRegistryExportPath(), defaultSkillsRegistryExport);
|
|
1186
|
+
break;
|
|
1187
|
+
case "context.capabilityComposition":
|
|
1188
|
+
await writeJson(getCapabilityCompositionPath(), defaultCapabilityComposition);
|
|
1189
|
+
break;
|
|
1190
|
+
case "context.workspaceContextPack":
|
|
1191
|
+
await writeJson(getWorkspaceContextPackPath(), defaultWorkspaceContextPack);
|
|
1192
|
+
break;
|
|
1193
|
+
case "context.workspaceEffectiveness":
|
|
1194
|
+
await writeJson(getWorkspaceEffectivenessPath(), defaultWorkspaceEffectiveness);
|
|
1195
|
+
break;
|
|
1196
|
+
case "evidence.semanticReceipts":
|
|
1197
|
+
await writeJson(getSemanticReceiptIndexPath(), defaultSemanticReceiptIndex);
|
|
1198
|
+
break;
|
|
1199
|
+
case "memory.index":
|
|
1200
|
+
await writeJson(getContinuityIndexPath(), defaultContinuityIndex);
|
|
1201
|
+
break;
|
|
1202
|
+
case "hooks.config":
|
|
1203
|
+
await writeJson(getRuntimeHooksConfigPath(), defaultHookConfig);
|
|
1204
|
+
break;
|
|
1205
|
+
case "tasks.registry":
|
|
1206
|
+
await writeJson(getTaskRegistryPath(), defaultTaskRegistry);
|
|
1207
|
+
break;
|
|
1208
|
+
case "workspaces.index":
|
|
1209
|
+
await writeJson(getWorkspacesIndexPath(), defaultWorkspaceIndex);
|
|
1210
|
+
break;
|
|
1211
|
+
case "runtime.managerRuns":
|
|
1212
|
+
await writeJson(getManagerRunsPath(), defaultManagerRuns);
|
|
1213
|
+
break;
|
|
1214
|
+
case "runtime.maestroState":
|
|
1215
|
+
await writeJson(getMaestroStatePath(), defaultMaestroState);
|
|
1216
|
+
break;
|
|
1217
|
+
default:
|
|
1218
|
+
break;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
return labels;
|
|
1223
|
+
}
|