@emiliosp/pi-maestro 0.6.3 → 0.7.1
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 +17 -5
- package/agents/builder.md +6 -7
- package/agents/verifier.md +3 -3
- package/changelog.md +85 -0
- package/docs/glossary.md +69 -0
- package/docs/subagent-integration.md +1 -1
- package/docs/workflow.md +55 -23
- package/extensions/maestro-subagent.ts +0 -2
- package/extensions/maestro.ts +5 -5
- package/mission.md +7 -0
- package/package.json +7 -4
- package/roadmap.md +85 -0
- package/src/MaestroPaths.ts +0 -32
- package/src/artifacts/builder-handoff/assertBuilderHandoff.ts +29 -0
- package/src/artifacts/builder-handoff/schema.ts +87 -23
- package/src/maestro/instructions/getMaestroInstructions.ts +7 -7
- package/src/specs/create.ts +0 -4
- package/src/tools/child/record-builder-handoff.ts +14 -16
- package/src/tools/main/resolve-escalations.ts +72 -0
- package/src/tools/main/run-builder.ts +14 -10
- package/src/workflow/builder/completeBuilderPass.ts +20 -32
- package/src/workflow/escalation/resolveEscalations.ts +100 -0
- package/tech-stack.md +14 -0
- package/src/artifacts/escalation/assertEscalation.ts +0 -66
- package/src/artifacts/escalation/createEscalation.ts +0 -52
- package/src/artifacts/escalation/getNextEscalationId.ts +0 -23
- package/src/artifacts/escalation/readEscalation.ts +0 -40
- package/src/artifacts/escalation/readEscalationHistory.ts +0 -44
- package/src/artifacts/escalation/resolveEscalation.ts +0 -43
- package/src/artifacts/escalation/schema.ts +0 -73
- package/src/tools/child/open-escalation.ts +0 -71
- package/src/tools/main/resolve-escalation.ts +0 -65
- package/src/workflow/escalation/openBuilderEscalation.ts +0 -82
- package/src/workflow/escalation/resolveBuilderEscalation.ts +0 -118
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Objective: Resolve the current builder escalation and save the decision.
|
|
3
|
-
* Used: When the owner keeps the approved contract and makes a decision.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { readEscalationHistory } from '#artifacts/escalation/readEscalationHistory.ts';
|
|
7
|
-
import { resolveEscalation } from '#artifacts/escalation/resolveEscalation.ts';
|
|
8
|
-
import type {
|
|
9
|
-
Escalation,
|
|
10
|
-
EscalationResolution,
|
|
11
|
-
} from '#artifacts/escalation/schema.ts';
|
|
12
|
-
import type { MaestroPaths } from '#MaestroPaths.ts';
|
|
13
|
-
import { readWorkflowState } from '#workflow/state/readWorkflowState.ts';
|
|
14
|
-
import {
|
|
15
|
-
WORKFLOW_EVENTS,
|
|
16
|
-
WORKFLOW_PHASES,
|
|
17
|
-
type WorkflowState,
|
|
18
|
-
} from '#workflow/state/schema.ts';
|
|
19
|
-
import { writeWorkflowState } from '#workflow/state/writeWorkflowState.ts';
|
|
20
|
-
import { transitionWorkflow } from '#workflow/transitions.ts';
|
|
21
|
-
|
|
22
|
-
export type ResolvedBuilderEscalation = {
|
|
23
|
-
escalation: Escalation;
|
|
24
|
-
state: WorkflowState;
|
|
25
|
-
projectRoot: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type AssertCurrentEscalationInput<CurrentEscalation = Escalation | undefined> =
|
|
29
|
-
{
|
|
30
|
-
currentEscalation: CurrentEscalation;
|
|
31
|
-
escalationId: string;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function assertCurrentEscalation(
|
|
35
|
-
input: AssertCurrentEscalationInput,
|
|
36
|
-
): asserts input is AssertCurrentEscalationInput<Escalation> {
|
|
37
|
-
const { currentEscalation, escalationId } = input;
|
|
38
|
-
|
|
39
|
-
if (currentEscalation === undefined) {
|
|
40
|
-
throw new Error('There is no escalation to solve.');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (currentEscalation.id !== escalationId) {
|
|
44
|
-
throw new Error(
|
|
45
|
-
`Only the current escalation can be resolved: expected "${currentEscalation.id}", found "${escalationId}".`,
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (currentEscalation.resolution !== null) {
|
|
50
|
-
throw new Error(`Escalation "${escalationId}" is already resolved.`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type ResolveBuilderEscalationInput = {
|
|
55
|
-
paths: MaestroPaths;
|
|
56
|
-
specId: string;
|
|
57
|
-
escalationId: string;
|
|
58
|
-
resolution: EscalationResolution;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const resolveBuilderEscalation = async ({
|
|
62
|
-
paths,
|
|
63
|
-
specId,
|
|
64
|
-
escalationId,
|
|
65
|
-
resolution,
|
|
66
|
-
}: ResolveBuilderEscalationInput): Promise<ResolvedBuilderEscalation> => {
|
|
67
|
-
const workflowPath = paths.getWorkflowPath(specId);
|
|
68
|
-
const escalationsPath = paths.getEscalationsPath(specId);
|
|
69
|
-
const currentState = await readWorkflowState(workflowPath);
|
|
70
|
-
|
|
71
|
-
if (currentState.specId !== specId) {
|
|
72
|
-
throw new Error(
|
|
73
|
-
`Workflow spec ID mismatch: expected "${specId}", found "${currentState.specId}".`,
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (currentState.phase !== WORKFLOW_PHASES.ESCALATION_DECISION) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Escalation resolution requires escalation-decision state, found "${currentState.phase}".`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const history = await readEscalationHistory({
|
|
84
|
-
directory: escalationsPath,
|
|
85
|
-
specId,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const escalationInput = { currentEscalation: history.at(-1), escalationId };
|
|
89
|
-
assertCurrentEscalation(escalationInput);
|
|
90
|
-
const { currentEscalation } = escalationInput;
|
|
91
|
-
|
|
92
|
-
const nextState = transitionWorkflow({
|
|
93
|
-
state: currentState,
|
|
94
|
-
event: WORKFLOW_EVENTS.RESOLVE_ESCALATION,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const escalationPath = paths.getEscalationPath({
|
|
98
|
-
specId,
|
|
99
|
-
escalationNumber: Number(currentEscalation.id.slice(1)),
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const resolvedEscalation = await resolveEscalation({
|
|
103
|
-
path: escalationPath,
|
|
104
|
-
specId,
|
|
105
|
-
resolution,
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
await writeWorkflowState({
|
|
109
|
-
path: workflowPath,
|
|
110
|
-
state: nextState,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
return {
|
|
114
|
-
escalation: resolvedEscalation,
|
|
115
|
-
state: nextState,
|
|
116
|
-
projectRoot: paths.getProjectRoot(),
|
|
117
|
-
};
|
|
118
|
-
};
|