@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,605 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { readJson, writeFileIfMissing, writeJson } from "../fs-utils.js";
|
|
3
|
+
import { getRuntimeStatePath } from "../paths.js";
|
|
4
|
+
|
|
5
|
+
const managerModes = new Set(["helper-only", "helper+gated", "team"]);
|
|
6
|
+
const managerStates = new Set([
|
|
7
|
+
"planned",
|
|
8
|
+
"dispatching",
|
|
9
|
+
"running",
|
|
10
|
+
"waiting-review",
|
|
11
|
+
"completed",
|
|
12
|
+
"blocked",
|
|
13
|
+
"failed",
|
|
14
|
+
"cancelled",
|
|
15
|
+
]);
|
|
16
|
+
const managerNextActions = new Set([
|
|
17
|
+
"recommend",
|
|
18
|
+
"dispatch-helper",
|
|
19
|
+
"dispatch-gated",
|
|
20
|
+
"dispatch-team",
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
export function getManagerRunsPath() {
|
|
24
|
+
return getRuntimeStatePath("manager-runs.json");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createDefaultManagerRunRegistry() {
|
|
28
|
+
return {
|
|
29
|
+
schemaVersion: "0.1.0",
|
|
30
|
+
runs: [],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function normalizeHelperPlanEntry(entry) {
|
|
35
|
+
return {
|
|
36
|
+
id: entry?.id ?? `helper-${randomUUID()}`,
|
|
37
|
+
skill: entry?.skill ?? "$align",
|
|
38
|
+
objective: entry?.objective ?? "Provide bounded manager support",
|
|
39
|
+
dependencies: Array.isArray(entry?.dependencies) ? [...entry.dependencies] : [],
|
|
40
|
+
authorityMode: entry?.authorityMode ?? "manager-transient-helper",
|
|
41
|
+
status: entry?.status ?? "planned",
|
|
42
|
+
evidence: Array.isArray(entry?.evidence) ? [...entry.evidence] : [],
|
|
43
|
+
errorClass: entry?.errorClass ?? null,
|
|
44
|
+
errorMessage: entry?.errorMessage ?? null,
|
|
45
|
+
startedAt: entry?.startedAt ?? null,
|
|
46
|
+
completedAt: entry?.completedAt ?? null,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function normalizeGatedPlanEntry(entry) {
|
|
51
|
+
return {
|
|
52
|
+
skill: entry?.skill ?? "$arch",
|
|
53
|
+
objective: entry?.objective ?? "Advance the next gated lane",
|
|
54
|
+
owner: entry?.owner ?? entry?.skill ?? "$arch",
|
|
55
|
+
prerequisites: Array.isArray(entry?.prerequisites) ? [...entry.prerequisites] : [],
|
|
56
|
+
status: entry?.status ?? "planned",
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function normalizeTeamPlanEntry(entry) {
|
|
61
|
+
if (!entry) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
title: entry.title ?? "Meta-Architect durable team task",
|
|
67
|
+
objective: entry.objective ?? "Coordinate a durable delivery lane",
|
|
68
|
+
verificationOwner: entry.verificationOwner ?? "leader",
|
|
69
|
+
launchHints: Array.isArray(entry.launchHints) ? [...entry.launchHints] : [],
|
|
70
|
+
staffing: Array.isArray(entry.staffing) ? [...entry.staffing] : [],
|
|
71
|
+
createdTaskIds: Array.isArray(entry.createdTaskIds) ? [...entry.createdTaskIds] : [],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function normalizeDispatchPlan(plan = {}) {
|
|
76
|
+
return {
|
|
77
|
+
helpers: Array.isArray(plan.helpers) ? plan.helpers.map(normalizeHelperPlanEntry) : [],
|
|
78
|
+
gated: Array.isArray(plan.gated) ? plan.gated.map(normalizeGatedPlanEntry) : [],
|
|
79
|
+
team: normalizeTeamPlanEntry(plan.team),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function normalizePendingReview(pendingReview = {}) {
|
|
84
|
+
const value = pendingReview ?? {};
|
|
85
|
+
return {
|
|
86
|
+
proposalPath: value.proposalPath ?? null,
|
|
87
|
+
mailboxOwner: value.mailboxOwner ?? null,
|
|
88
|
+
resumeTrigger: value.resumeTrigger ?? null,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function normalizeRetry(retry = {}) {
|
|
93
|
+
const value = retry ?? {};
|
|
94
|
+
return {
|
|
95
|
+
count: Number.isInteger(value.count) ? value.count : 0,
|
|
96
|
+
lastReason: value.lastReason ?? null,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function validateManagerRun(run) {
|
|
101
|
+
if (!run || typeof run !== "object" || Array.isArray(run)) {
|
|
102
|
+
throw new Error("Manager run must be an object");
|
|
103
|
+
}
|
|
104
|
+
if (typeof run.id !== "string" || run.id.trim() === "") {
|
|
105
|
+
throw new Error("Manager run requires an id");
|
|
106
|
+
}
|
|
107
|
+
if (!(run.parentRunId === null || typeof run.parentRunId === "string")) {
|
|
108
|
+
throw new Error("Manager run parentRunId must be null or a string");
|
|
109
|
+
}
|
|
110
|
+
if (typeof run.triggeredBy !== "string" || run.triggeredBy.trim() === "") {
|
|
111
|
+
throw new Error("Manager run requires triggeredBy");
|
|
112
|
+
}
|
|
113
|
+
if (!managerModes.has(run.mode)) {
|
|
114
|
+
throw new Error(`Unsupported manager mode: ${run.mode}`);
|
|
115
|
+
}
|
|
116
|
+
if (!managerStates.has(run.state)) {
|
|
117
|
+
throw new Error(`Unsupported manager state: ${run.state}`);
|
|
118
|
+
}
|
|
119
|
+
if (!managerNextActions.has(run.nextAction)) {
|
|
120
|
+
throw new Error(`Unsupported manager next action: ${run.nextAction}`);
|
|
121
|
+
}
|
|
122
|
+
if (
|
|
123
|
+
!run.dispatchPlan ||
|
|
124
|
+
typeof run.dispatchPlan !== "object" ||
|
|
125
|
+
Array.isArray(run.dispatchPlan)
|
|
126
|
+
) {
|
|
127
|
+
throw new Error("Manager run dispatchPlan must be an object");
|
|
128
|
+
}
|
|
129
|
+
if (!Array.isArray(run.dispatchPlan.helpers) || !Array.isArray(run.dispatchPlan.gated)) {
|
|
130
|
+
throw new Error("Manager run dispatchPlan requires helpers and gated arrays");
|
|
131
|
+
}
|
|
132
|
+
if (
|
|
133
|
+
!run.pendingReview ||
|
|
134
|
+
typeof run.pendingReview !== "object" ||
|
|
135
|
+
Array.isArray(run.pendingReview)
|
|
136
|
+
) {
|
|
137
|
+
throw new Error("Manager run pendingReview must be an object");
|
|
138
|
+
}
|
|
139
|
+
if (!run.retry || typeof run.retry !== "object" || Array.isArray(run.retry)) {
|
|
140
|
+
throw new Error("Manager run retry must be an object");
|
|
141
|
+
}
|
|
142
|
+
if (!Array.isArray(run.helperRuns)) {
|
|
143
|
+
throw new Error("Manager run helperRuns must be an array");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return run;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function validateManagerRunRegistry(registry) {
|
|
150
|
+
if (!registry || typeof registry !== "object" || !Array.isArray(registry.runs)) {
|
|
151
|
+
throw new Error("Manager run registry must contain a runs array");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
for (const run of registry.runs) {
|
|
155
|
+
validateManagerRun(run);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return registry;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export async function seedMaestroManagerArtifacts() {
|
|
162
|
+
await writeFileIfMissing(
|
|
163
|
+
getManagerRunsPath(),
|
|
164
|
+
`${JSON.stringify(createDefaultManagerRunRegistry(), null, 2)}\n`,
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export async function loadManagerRunRegistry() {
|
|
169
|
+
return validateManagerRunRegistry(await readJson(getManagerRunsPath()));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export async function loadManagerRunRegistryOrDefault() {
|
|
173
|
+
try {
|
|
174
|
+
return await loadManagerRunRegistry();
|
|
175
|
+
} catch (error) {
|
|
176
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
177
|
+
return createDefaultManagerRunRegistry();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export async function saveManagerRunRegistry(registry) {
|
|
185
|
+
validateManagerRunRegistry(registry);
|
|
186
|
+
await writeJson(getManagerRunsPath(), registry);
|
|
187
|
+
return registry;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function getActiveManagerRun(registry) {
|
|
191
|
+
return (
|
|
192
|
+
[...(registry?.runs ?? [])]
|
|
193
|
+
.reverse()
|
|
194
|
+
.find((run) => !["completed", "blocked", "failed", "cancelled"].includes(run.state)) ?? null
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function createManagerRun({
|
|
199
|
+
triggeredBy = "$maestro",
|
|
200
|
+
parentRunId = null,
|
|
201
|
+
mode = "helper-only",
|
|
202
|
+
nextAction = "recommend",
|
|
203
|
+
dispatchPlan = {},
|
|
204
|
+
pendingReview = null,
|
|
205
|
+
retry = null,
|
|
206
|
+
} = {}) {
|
|
207
|
+
const now = new Date().toISOString();
|
|
208
|
+
const normalizedDispatchPlan = normalizeDispatchPlan(dispatchPlan);
|
|
209
|
+
|
|
210
|
+
return validateManagerRun({
|
|
211
|
+
id: `run-${randomUUID()}`,
|
|
212
|
+
parentRunId,
|
|
213
|
+
triggeredBy,
|
|
214
|
+
mode,
|
|
215
|
+
state: "planned",
|
|
216
|
+
nextAction,
|
|
217
|
+
dispatchPlan: normalizedDispatchPlan,
|
|
218
|
+
helperRuns: normalizedDispatchPlan.helpers.map((helper) => ({ ...helper })),
|
|
219
|
+
pendingReview: normalizePendingReview(pendingReview),
|
|
220
|
+
retry: normalizeRetry(retry),
|
|
221
|
+
startedAt: now,
|
|
222
|
+
updatedAt: now,
|
|
223
|
+
completedAt: null,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function createHelperPlan(skill, objective, extras = {}) {
|
|
228
|
+
return normalizeHelperPlanEntry({
|
|
229
|
+
skill,
|
|
230
|
+
objective,
|
|
231
|
+
...extras,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function createGatedPlan(skill, objective, extras = {}) {
|
|
236
|
+
return normalizeGatedPlanEntry({
|
|
237
|
+
skill,
|
|
238
|
+
objective,
|
|
239
|
+
owner: skill,
|
|
240
|
+
...extras,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function buildHelperFailureMatrix() {
|
|
245
|
+
return {
|
|
246
|
+
helper_failed_noncritical: {
|
|
247
|
+
outcome: "continue",
|
|
248
|
+
requiredTraceFields: [
|
|
249
|
+
"runId",
|
|
250
|
+
"helperId",
|
|
251
|
+
"skill",
|
|
252
|
+
"objective",
|
|
253
|
+
"errorClass",
|
|
254
|
+
"errorMessage",
|
|
255
|
+
"continuedHelpers",
|
|
256
|
+
],
|
|
257
|
+
resumeOwner: null,
|
|
258
|
+
siblingHelperPolicy: "continue-unaffected",
|
|
259
|
+
},
|
|
260
|
+
helper_failed_requires_human_or_leader: {
|
|
261
|
+
outcome: "waiting-review",
|
|
262
|
+
requiredTraceFields: [
|
|
263
|
+
"runId",
|
|
264
|
+
"helperId",
|
|
265
|
+
"skill",
|
|
266
|
+
"objective",
|
|
267
|
+
"proposalPath",
|
|
268
|
+
"mailboxOwner",
|
|
269
|
+
"resumeTrigger",
|
|
270
|
+
],
|
|
271
|
+
resumeOwner: "leader",
|
|
272
|
+
siblingHelperPolicy: "continue-started-unaffected-only",
|
|
273
|
+
},
|
|
274
|
+
helper_failed_blocks_gate_prerequisite: {
|
|
275
|
+
outcome: "blocked",
|
|
276
|
+
requiredTraceFields: [
|
|
277
|
+
"runId",
|
|
278
|
+
"helperId",
|
|
279
|
+
"skill",
|
|
280
|
+
"objective",
|
|
281
|
+
"blockedGate",
|
|
282
|
+
"blockingReason",
|
|
283
|
+
"requiredNextTrigger",
|
|
284
|
+
],
|
|
285
|
+
resumeOwner: "leader",
|
|
286
|
+
siblingHelperPolicy: "stop-dependent-helpers",
|
|
287
|
+
},
|
|
288
|
+
helper_failed_but_manager_can_fall_back_to_safe_summary: {
|
|
289
|
+
outcome: "degrade-to-recommendation",
|
|
290
|
+
requiredTraceFields: [
|
|
291
|
+
"runId",
|
|
292
|
+
"helperId",
|
|
293
|
+
"skill",
|
|
294
|
+
"objective",
|
|
295
|
+
"degradedReason",
|
|
296
|
+
"safeNextTrigger",
|
|
297
|
+
],
|
|
298
|
+
resumeOwner: "user",
|
|
299
|
+
siblingHelperPolicy: "stop-new-helper-launches",
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function chooseMaestroManagerAction({
|
|
305
|
+
releaseState,
|
|
306
|
+
runtimeSummary,
|
|
307
|
+
buildReadiness,
|
|
308
|
+
recommendation,
|
|
309
|
+
activeRun = null,
|
|
310
|
+
} = {}) {
|
|
311
|
+
if (activeRun?.state === "waiting-review") {
|
|
312
|
+
return {
|
|
313
|
+
mode: activeRun.mode,
|
|
314
|
+
nextAction: "recommend",
|
|
315
|
+
dispatchPlan: {
|
|
316
|
+
helpers: [],
|
|
317
|
+
gated: [],
|
|
318
|
+
team: null,
|
|
319
|
+
},
|
|
320
|
+
pendingReview: { ...activeRun.pendingReview },
|
|
321
|
+
reason:
|
|
322
|
+
"A previous manager run is waiting for review before new authoritative work can begin.",
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (releaseState.idea_status !== "CLEAR") {
|
|
327
|
+
return {
|
|
328
|
+
mode: "helper-only",
|
|
329
|
+
nextAction: "recommend",
|
|
330
|
+
dispatchPlan: {
|
|
331
|
+
helpers: [],
|
|
332
|
+
gated: [],
|
|
333
|
+
team: null,
|
|
334
|
+
},
|
|
335
|
+
reason: recommendation?.why ?? "The brief is still missing.",
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const helpers = [];
|
|
340
|
+
if (releaseState.architecture_status !== "APPROVED") {
|
|
341
|
+
helpers.push(
|
|
342
|
+
createHelperPlan(
|
|
343
|
+
"$align",
|
|
344
|
+
"Align the brief and manager-owned lane sequence before architecture work begins.",
|
|
345
|
+
),
|
|
346
|
+
);
|
|
347
|
+
return {
|
|
348
|
+
mode: "helper+gated",
|
|
349
|
+
nextAction: "dispatch-gated",
|
|
350
|
+
dispatchPlan: {
|
|
351
|
+
helpers,
|
|
352
|
+
gated: [
|
|
353
|
+
createGatedPlan(
|
|
354
|
+
"$arch",
|
|
355
|
+
"Shape the active brief into an approved architecture baseline.",
|
|
356
|
+
{
|
|
357
|
+
prerequisites: ["idea_status=CLEAR"],
|
|
358
|
+
},
|
|
359
|
+
),
|
|
360
|
+
],
|
|
361
|
+
team: null,
|
|
362
|
+
},
|
|
363
|
+
reason: recommendation?.why ?? "Advance the architecture gate under manager supervision.",
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
if (releaseState.evidence_status !== "VERIFIED") {
|
|
367
|
+
return {
|
|
368
|
+
mode: "helper+gated",
|
|
369
|
+
nextAction: "dispatch-gated",
|
|
370
|
+
dispatchPlan: {
|
|
371
|
+
helpers: [],
|
|
372
|
+
gated: [
|
|
373
|
+
createGatedPlan(
|
|
374
|
+
"$sage",
|
|
375
|
+
"Bind the architecture to approved evidence sources and capture live verification state.",
|
|
376
|
+
{ prerequisites: ["architecture_status=APPROVED"] },
|
|
377
|
+
),
|
|
378
|
+
],
|
|
379
|
+
team: null,
|
|
380
|
+
},
|
|
381
|
+
reason: recommendation?.why ?? "Advance the evidence gate under manager supervision.",
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
if (releaseState.logic_status !== "GREEN") {
|
|
385
|
+
if (releaseState.logic_status === "RED") {
|
|
386
|
+
return {
|
|
387
|
+
mode: "helper-only",
|
|
388
|
+
nextAction: "dispatch-helper",
|
|
389
|
+
dispatchPlan: {
|
|
390
|
+
helpers: [
|
|
391
|
+
createHelperPlan(
|
|
392
|
+
"$diagnose",
|
|
393
|
+
"Decompose the logic blocker into concrete causes and probes.",
|
|
394
|
+
),
|
|
395
|
+
createHelperPlan(
|
|
396
|
+
"$align",
|
|
397
|
+
"Clarify the exact next logic-lane input and rerun boundary.",
|
|
398
|
+
),
|
|
399
|
+
],
|
|
400
|
+
gated: [],
|
|
401
|
+
team: null,
|
|
402
|
+
},
|
|
403
|
+
reason:
|
|
404
|
+
recommendation?.why ??
|
|
405
|
+
"Logic is blocked, so helper diagnosis is safer than forcing the gate.",
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
return {
|
|
409
|
+
mode: "helper+gated",
|
|
410
|
+
nextAction: "dispatch-gated",
|
|
411
|
+
dispatchPlan: {
|
|
412
|
+
helpers: [],
|
|
413
|
+
gated: [
|
|
414
|
+
createGatedPlan(
|
|
415
|
+
"$flow",
|
|
416
|
+
"Validate runtime actors, state transitions, and current blockers.",
|
|
417
|
+
{ prerequisites: ["idea_status=CLEAR", "evidence_status=VERIFIED"] },
|
|
418
|
+
),
|
|
419
|
+
],
|
|
420
|
+
team: null,
|
|
421
|
+
},
|
|
422
|
+
reason: recommendation?.why ?? "Advance the logic gate under manager supervision.",
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
if (releaseState.security_status !== "GREEN") {
|
|
426
|
+
return {
|
|
427
|
+
mode: "helper+gated",
|
|
428
|
+
nextAction: "dispatch-gated",
|
|
429
|
+
dispatchPlan: {
|
|
430
|
+
helpers: [],
|
|
431
|
+
gated: [
|
|
432
|
+
createGatedPlan(
|
|
433
|
+
"$vet",
|
|
434
|
+
"Record the current security review status and trust-boundary evidence.",
|
|
435
|
+
{ prerequisites: ["logic_status=GREEN|RED"] },
|
|
436
|
+
),
|
|
437
|
+
],
|
|
438
|
+
team: null,
|
|
439
|
+
},
|
|
440
|
+
reason: recommendation?.why ?? "Advance the security gate under manager supervision.",
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
if (!["GREEN", "WAIVED"].includes(releaseState.experience_status)) {
|
|
444
|
+
return {
|
|
445
|
+
mode: "helper+gated",
|
|
446
|
+
nextAction: "dispatch-gated",
|
|
447
|
+
dispatchPlan: {
|
|
448
|
+
helpers: [],
|
|
449
|
+
gated: [
|
|
450
|
+
createGatedPlan(
|
|
451
|
+
"$vibe",
|
|
452
|
+
"Record the current DX/UX review status and remaining workflow friction.",
|
|
453
|
+
{ prerequisites: ["security_status=GREEN|PENDING|RED"] },
|
|
454
|
+
),
|
|
455
|
+
],
|
|
456
|
+
team: null,
|
|
457
|
+
},
|
|
458
|
+
reason: recommendation?.why ?? "Advance the experience gate under manager supervision.",
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (runtimeSummary.pendingMailboxCount > 0 || runtimeSummary.invalidArtifacts.length > 0) {
|
|
463
|
+
return {
|
|
464
|
+
mode: "helper-only",
|
|
465
|
+
nextAction: "dispatch-helper",
|
|
466
|
+
dispatchPlan: {
|
|
467
|
+
helpers: [
|
|
468
|
+
createHelperPlan(
|
|
469
|
+
"$diagnose",
|
|
470
|
+
"Summarize pending mailbox proposals and invalid runtime artifacts before durable progress continues.",
|
|
471
|
+
),
|
|
472
|
+
createHelperPlan(
|
|
473
|
+
"$align",
|
|
474
|
+
"Normalize the owner-facing next actions around the pending proposals and runtime blockers.",
|
|
475
|
+
),
|
|
476
|
+
],
|
|
477
|
+
gated: [],
|
|
478
|
+
team: null,
|
|
479
|
+
},
|
|
480
|
+
reason: recommendation?.why ?? "Runtime blockers still require helper-only diagnosis.",
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
if (releaseState.build_status === "LOCKED") {
|
|
485
|
+
const buildHelpers = [];
|
|
486
|
+
if (buildReadiness && buildReadiness.releaseBlockers.length === 0 && !buildReadiness.allowed) {
|
|
487
|
+
buildHelpers.push(
|
|
488
|
+
createHelperPlan(
|
|
489
|
+
"$diagnose",
|
|
490
|
+
"Capture the exact runtime blockers preventing build-readiness unlock.",
|
|
491
|
+
),
|
|
492
|
+
);
|
|
493
|
+
buildHelpers.push(
|
|
494
|
+
createHelperPlan(
|
|
495
|
+
"$align",
|
|
496
|
+
"Prepare a bounded repair summary for the next review or manager resume trigger.",
|
|
497
|
+
),
|
|
498
|
+
);
|
|
499
|
+
return {
|
|
500
|
+
mode: "helper-only",
|
|
501
|
+
nextAction: "dispatch-helper",
|
|
502
|
+
dispatchPlan: {
|
|
503
|
+
helpers: buildHelpers,
|
|
504
|
+
gated: [],
|
|
505
|
+
team: null,
|
|
506
|
+
},
|
|
507
|
+
reason: recommendation?.why ?? "Runtime blockers still prevent build unlock.",
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return {
|
|
512
|
+
mode: "helper+gated",
|
|
513
|
+
nextAction: "dispatch-gated",
|
|
514
|
+
dispatchPlan: {
|
|
515
|
+
helpers: [],
|
|
516
|
+
gated: [
|
|
517
|
+
createGatedPlan("$build", "Unlock bounded build planning and branch guidance.", {
|
|
518
|
+
prerequisites: ["experience_status=GREEN|WAIVED"],
|
|
519
|
+
}),
|
|
520
|
+
],
|
|
521
|
+
team: null,
|
|
522
|
+
},
|
|
523
|
+
reason: recommendation?.why ?? "The next bounded action belongs to the build lane.",
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (["READY", "RUNNING"].includes(releaseState.build_status)) {
|
|
528
|
+
return {
|
|
529
|
+
mode: "helper+gated",
|
|
530
|
+
nextAction: "dispatch-gated",
|
|
531
|
+
dispatchPlan: {
|
|
532
|
+
helpers: [],
|
|
533
|
+
gated: [
|
|
534
|
+
createGatedPlan(
|
|
535
|
+
"$build",
|
|
536
|
+
"Advance the bounded build execution substep and persist lane-owned build evidence.",
|
|
537
|
+
{ prerequisites: ["build_status=READY|RUNNING"] },
|
|
538
|
+
),
|
|
539
|
+
],
|
|
540
|
+
team: null,
|
|
541
|
+
},
|
|
542
|
+
reason: recommendation?.why ?? "The build lane still owns the next bounded execution step.",
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (releaseState.merge_status !== "MERGED_TO_DEVELOPMENT") {
|
|
547
|
+
return {
|
|
548
|
+
mode: "team",
|
|
549
|
+
nextAction: "dispatch-team",
|
|
550
|
+
dispatchPlan: {
|
|
551
|
+
helpers: [
|
|
552
|
+
createHelperPlan(
|
|
553
|
+
"$tdd",
|
|
554
|
+
"Prepare verification expectations for the implementation handoff.",
|
|
555
|
+
),
|
|
556
|
+
],
|
|
557
|
+
gated: [],
|
|
558
|
+
team: {
|
|
559
|
+
title: "Complete the current bounded implementation slice",
|
|
560
|
+
objective: "Finish the ready build slice and prepare a development merge.",
|
|
561
|
+
verificationOwner: "leader",
|
|
562
|
+
staffing: ["implementation", "verification"],
|
|
563
|
+
launchHints: [
|
|
564
|
+
"Keep release-plane ownership in the gated lanes.",
|
|
565
|
+
"Return to $maestro after the bounded slice is complete.",
|
|
566
|
+
],
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
reason: recommendation?.why ?? "The build slice now needs durable coordinated execution.",
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (releaseState.release_status !== "SHIPPED_TO_PROD") {
|
|
574
|
+
return {
|
|
575
|
+
mode: "team",
|
|
576
|
+
nextAction: "dispatch-team",
|
|
577
|
+
dispatchPlan: {
|
|
578
|
+
helpers: [],
|
|
579
|
+
gated: [],
|
|
580
|
+
team: {
|
|
581
|
+
title: "Prepare the release promotion handoff",
|
|
582
|
+
objective: "Coordinate verification and controlled promotion to prod.",
|
|
583
|
+
verificationOwner: "leader",
|
|
584
|
+
staffing: ["release", "verification"],
|
|
585
|
+
launchHints: [
|
|
586
|
+
"Confirm the origin branch is approved for release.",
|
|
587
|
+
"Do not claim release success without channel-specific evidence.",
|
|
588
|
+
],
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
reason: recommendation?.why ?? "The remaining work is coordinated release promotion.",
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return {
|
|
596
|
+
mode: "helper-only",
|
|
597
|
+
nextAction: "recommend",
|
|
598
|
+
dispatchPlan: {
|
|
599
|
+
helpers: [],
|
|
600
|
+
gated: [],
|
|
601
|
+
team: null,
|
|
602
|
+
},
|
|
603
|
+
reason: recommendation?.why ?? "No further manager action is required.",
|
|
604
|
+
};
|
|
605
|
+
}
|