poe-code 3.0.196 → 3.0.198
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/dist/cli/commands/configure.d.ts +0 -7
- package/dist/cli/commands/configure.js +11 -14
- package/dist/cli/commands/configure.js.map +1 -1
- package/dist/cli/commands/provider.js +8 -1
- package/dist/cli/commands/provider.js.map +1 -1
- package/dist/index.js +263 -269
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code.js +6 -20
- package/dist/providers/claude-code.js.map +3 -3
- package/dist/providers/codex.js +6 -20
- package/dist/providers/codex.js.map +3 -3
- package/dist/providers/create-provider.js +0 -2
- package/dist/providers/create-provider.js.map +1 -1
- package/dist/providers/goose.js +14 -25
- package/dist/providers/goose.js.map +3 -3
- package/dist/providers/kimi.js +6 -20
- package/dist/providers/kimi.js.map +3 -3
- package/dist/providers/opencode.js +6 -20
- package/dist/providers/opencode.js.map +3 -3
- package/dist/providers/poe-agent.js +66 -84
- package/dist/providers/poe-agent.js.map +4 -4
- package/dist/utils/command-checks.d.ts +2 -1
- package/dist/utils/command-checks.js +3 -1
- package/dist/utils/command-checks.js.map +1 -1
- package/package.json +4 -1
- package/packages/memory/dist/cache.js +1 -1
- package/packages/memory/dist/explain.js +1 -1
- package/packages/memory/dist/index.js +18 -7
- package/packages/memory/dist/index.js.map +3 -3
- package/packages/memory/dist/query.js +1 -1
- package/packages/memory/dist/tokens.js +1 -1
- package/packages/superintendent/dist/cli.d.ts +2 -0
- package/packages/superintendent/dist/cli.js +41 -0
- package/packages/superintendent/dist/commands/builder-group.d.ts +52 -0
- package/packages/superintendent/dist/commands/builder-group.js +73 -0
- package/packages/superintendent/dist/commands/complete.d.ts +19 -0
- package/packages/superintendent/dist/commands/complete.js +54 -0
- package/packages/superintendent/dist/commands/index.d.ts +4 -0
- package/packages/superintendent/dist/commands/index.js +4 -0
- package/packages/superintendent/dist/commands/inspector-group.d.ts +115 -0
- package/packages/superintendent/dist/commands/inspector-group.js +133 -0
- package/packages/superintendent/dist/commands/install.d.ts +31 -0
- package/packages/superintendent/dist/commands/install.js +148 -0
- package/packages/superintendent/dist/commands/plan-path.d.ts +9 -0
- package/packages/superintendent/dist/commands/plan-path.js +40 -0
- package/packages/superintendent/dist/commands/poe-agent-runner.d.ts +5 -0
- package/packages/superintendent/dist/commands/poe-agent-runner.js +27 -0
- package/packages/superintendent/dist/commands/run.d.ts +86 -0
- package/packages/superintendent/dist/commands/run.js +945 -0
- package/packages/superintendent/dist/commands/superintendent-group.d.ts +325 -0
- package/packages/superintendent/dist/commands/superintendent-group.js +238 -0
- package/packages/superintendent/dist/config-scope.d.ts +8 -0
- package/packages/superintendent/dist/config-scope.js +9 -0
- package/packages/superintendent/dist/direct-execution.d.ts +1 -0
- package/packages/superintendent/dist/direct-execution.js +20 -0
- package/packages/superintendent/dist/document/parse.d.ts +59 -0
- package/packages/superintendent/dist/document/parse.js +409 -0
- package/packages/superintendent/dist/document/tasks.d.ts +12 -0
- package/packages/superintendent/dist/document/tasks.js +96 -0
- package/packages/superintendent/dist/document/write.d.ts +6 -0
- package/packages/superintendent/dist/document/write.js +156 -0
- package/packages/superintendent/dist/index.d.ts +12 -0
- package/packages/superintendent/dist/index.js +15 -0
- package/packages/superintendent/dist/mcp.d.ts +24 -0
- package/packages/superintendent/dist/mcp.js +202 -0
- package/packages/superintendent/dist/runtime/agentic-tools.d.ts +33 -0
- package/packages/superintendent/dist/runtime/agentic-tools.js +74 -0
- package/packages/superintendent/dist/runtime/loop.d.ts +88 -0
- package/packages/superintendent/dist/runtime/loop.js +446 -0
- package/packages/superintendent/dist/runtime/resolve-cwd.d.ts +2 -0
- package/packages/superintendent/dist/runtime/resolve-cwd.js +10 -0
- package/packages/superintendent/dist/runtime/run-builder.d.ts +13 -0
- package/packages/superintendent/dist/runtime/run-builder.js +102 -0
- package/packages/superintendent/dist/runtime/run-inspector.d.ts +16 -0
- package/packages/superintendent/dist/runtime/run-inspector.js +119 -0
- package/packages/superintendent/dist/runtime/run-owner-review.d.ts +18 -0
- package/packages/superintendent/dist/runtime/run-owner-review.js +208 -0
- package/packages/superintendent/dist/runtime/run-superintendent.d.ts +13 -0
- package/packages/superintendent/dist/runtime/run-superintendent.js +208 -0
- package/packages/superintendent/dist/runtime/system-prompt.d.ts +17 -0
- package/packages/superintendent/dist/runtime/system-prompt.js +54 -0
- package/packages/superintendent/dist/runtime/templates.d.ts +22 -0
- package/packages/superintendent/dist/runtime/templates.js +23 -0
- package/packages/superintendent/dist/runtime/types.d.ts +4 -0
- package/packages/superintendent/dist/runtime/types.js +1 -0
- package/packages/superintendent/dist/runtime/workflow-tool.d.ts +29 -0
- package/packages/superintendent/dist/runtime/workflow-tool.js +83 -0
- package/packages/superintendent/dist/state/machine.d.ts +14 -0
- package/packages/superintendent/dist/state/machine.js +53 -0
- package/packages/superintendent/dist/templates/SKILL_superintendent.md +193 -0
- package/packages/superintendent/dist/testing/index.d.ts +2 -0
- package/packages/superintendent/dist/testing/index.js +1 -0
- package/packages/superintendent/dist/testing/simulation.d.ts +57 -0
- package/packages/superintendent/dist/testing/simulation.js +346 -0
- package/dist/providers/tiny-http-mcp-server.d.ts +0 -22
- package/dist/providers/tiny-http-mcp-server.js +0 -1471
- package/dist/providers/tiny-http-mcp-server.js.map +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StatusBlock } from "../document/parse.js";
|
|
2
|
+
export type WorkflowTransition = {
|
|
3
|
+
action: "request_review";
|
|
4
|
+
summary: string;
|
|
5
|
+
} | {
|
|
6
|
+
action: "approve_completion";
|
|
7
|
+
} | {
|
|
8
|
+
action: "request_changes";
|
|
9
|
+
feedback: string;
|
|
10
|
+
};
|
|
11
|
+
type McpToolProperty = {
|
|
12
|
+
type: "string";
|
|
13
|
+
description: string;
|
|
14
|
+
enum?: Array<WorkflowTransition["action"]>;
|
|
15
|
+
};
|
|
16
|
+
type McpToolInputSchema = {
|
|
17
|
+
type: "object";
|
|
18
|
+
additionalProperties: false;
|
|
19
|
+
properties: Record<string, McpToolProperty>;
|
|
20
|
+
required: string[];
|
|
21
|
+
};
|
|
22
|
+
export type McpToolDefinition = {
|
|
23
|
+
name: "workflow_transition";
|
|
24
|
+
description: string;
|
|
25
|
+
inputSchema: McpToolInputSchema;
|
|
26
|
+
};
|
|
27
|
+
export declare function createWorkflowTool(role: "superintendent" | "owner", state: StatusBlock["state"]): McpToolDefinition;
|
|
28
|
+
export declare function parseWorkflowCall(input: unknown): WorkflowTransition;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export function createWorkflowTool(role, state) {
|
|
2
|
+
const actions = getAllowedActions(role, state);
|
|
3
|
+
return {
|
|
4
|
+
name: "workflow_transition",
|
|
5
|
+
description: actions.length === 0
|
|
6
|
+
? "Transition the workflow state. No transitions are available in the current role/state."
|
|
7
|
+
: `Transition the workflow state. Valid actions: ${actions.join(", ")}.`,
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object",
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
properties: createProperties(actions),
|
|
12
|
+
required: createRequiredFields(actions)
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function parseWorkflowCall(input) {
|
|
17
|
+
if (!isRecord(input)) {
|
|
18
|
+
throw invalidActionError();
|
|
19
|
+
}
|
|
20
|
+
const { action } = input;
|
|
21
|
+
if (action !== "request_review" && action !== "approve_completion" && action !== "request_changes") {
|
|
22
|
+
throw invalidActionError();
|
|
23
|
+
}
|
|
24
|
+
if (action === "request_review") {
|
|
25
|
+
return {
|
|
26
|
+
action,
|
|
27
|
+
summary: getNonEmptyString(input.summary, 'workflow_transition summary must be a non-empty string for "request_review"')
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (action === "request_changes") {
|
|
31
|
+
return {
|
|
32
|
+
action,
|
|
33
|
+
feedback: getNonEmptyString(input.feedback, 'workflow_transition feedback must be a non-empty string for "request_changes"')
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return { action };
|
|
37
|
+
}
|
|
38
|
+
function createProperties(actions) {
|
|
39
|
+
const properties = {
|
|
40
|
+
action: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "Workflow transition action to apply.",
|
|
43
|
+
enum: actions
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (actions.includes("request_review")) {
|
|
47
|
+
properties.summary = {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Summarize why the work is ready for owner review."
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (actions.includes("request_changes")) {
|
|
53
|
+
properties.feedback = {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Required when action is request_changes. Explain what needs to change."
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return properties;
|
|
59
|
+
}
|
|
60
|
+
function createRequiredFields(actions) {
|
|
61
|
+
return actions.length === 1 && actions[0] === "request_review" ? ["action", "summary"] : ["action"];
|
|
62
|
+
}
|
|
63
|
+
function getAllowedActions(role, state) {
|
|
64
|
+
if (role === "superintendent" && (state === "in_progress" || state === "review")) {
|
|
65
|
+
return ["request_review"];
|
|
66
|
+
}
|
|
67
|
+
if (role === "owner" && state === "review") {
|
|
68
|
+
return ["approve_completion", "request_changes"];
|
|
69
|
+
}
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
function getNonEmptyString(value, errorMessage) {
|
|
73
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
74
|
+
throw new Error(errorMessage);
|
|
75
|
+
}
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
function invalidActionError() {
|
|
79
|
+
return new Error('workflow_transition action must be one of "request_review", "approve_completion", or "request_changes"');
|
|
80
|
+
}
|
|
81
|
+
function isRecord(value) {
|
|
82
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
83
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SuperintendentDoc } from "../document/parse.js";
|
|
2
|
+
import type { WorkflowTransition } from "../runtime/workflow-tool.js";
|
|
3
|
+
export type LoopState = {
|
|
4
|
+
state: "in_progress" | "review" | "completed";
|
|
5
|
+
round: number;
|
|
6
|
+
reviewTurn: number;
|
|
7
|
+
maxRounds: number;
|
|
8
|
+
maxReviewTurns: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function createLoopState(doc: SuperintendentDoc): LoopState;
|
|
11
|
+
export declare function applyTransition(state: LoopState, transition: WorkflowTransition): LoopState;
|
|
12
|
+
export declare function startNewRound(state: LoopState): LoopState;
|
|
13
|
+
export declare function isComplete(state: LoopState): boolean;
|
|
14
|
+
export declare function shouldRunBuilder(state: LoopState): boolean;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const DEFAULT_MAX_ROUNDS = 100;
|
|
2
|
+
const MAX_REVIEW_TURNS = 5;
|
|
3
|
+
export function createLoopState(doc) {
|
|
4
|
+
return {
|
|
5
|
+
state: doc.frontmatter.status.state,
|
|
6
|
+
round: doc.frontmatter.status.round,
|
|
7
|
+
reviewTurn: doc.frontmatter.status.review_turn,
|
|
8
|
+
maxRounds: doc.frontmatter.max_rounds ?? DEFAULT_MAX_ROUNDS,
|
|
9
|
+
maxReviewTurns: MAX_REVIEW_TURNS
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function applyTransition(state, transition) {
|
|
13
|
+
switch (transition.action) {
|
|
14
|
+
case "request_review":
|
|
15
|
+
return {
|
|
16
|
+
...state,
|
|
17
|
+
state: "review",
|
|
18
|
+
reviewTurn: 0
|
|
19
|
+
};
|
|
20
|
+
case "approve_completion":
|
|
21
|
+
return {
|
|
22
|
+
...state,
|
|
23
|
+
state: "completed"
|
|
24
|
+
};
|
|
25
|
+
case "request_changes":
|
|
26
|
+
if (state.reviewTurn < state.maxReviewTurns) {
|
|
27
|
+
return {
|
|
28
|
+
...state,
|
|
29
|
+
state: "review",
|
|
30
|
+
reviewTurn: state.reviewTurn + 1
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
...state,
|
|
35
|
+
state: "in_progress",
|
|
36
|
+
reviewTurn: 0
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function startNewRound(state) {
|
|
41
|
+
return {
|
|
42
|
+
...state,
|
|
43
|
+
state: "in_progress",
|
|
44
|
+
round: state.round + 1,
|
|
45
|
+
reviewTurn: 0
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function isComplete(state) {
|
|
49
|
+
return state.state === "completed" || state.round > state.maxRounds;
|
|
50
|
+
}
|
|
51
|
+
export function shouldRunBuilder(state) {
|
|
52
|
+
return state.state === "in_progress";
|
|
53
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: poe-code-superintendent-plan
|
|
3
|
+
description: 'Create a superintendent markdown document for the autonomous build-inspect-review loop. Triggers on: create superintendent, superintendent plan, superintendent doc, autonomous loop.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## If The Request Is Empty
|
|
7
|
+
|
|
8
|
+
Ask the user for a one-sentence description of what they want to build autonomously.
|
|
9
|
+
|
|
10
|
+
## Goal
|
|
11
|
+
|
|
12
|
+
There is exactly **one plan document per feature**, at `<plan-directory>/<name>.md` (see Plan Directory section below). The superintendent frontmatter and Task Board live in that same file alongside the feature plan body.
|
|
13
|
+
|
|
14
|
+
Use canonical frontmatter metadata at the top of the document:
|
|
15
|
+
|
|
16
|
+
If a plan file already exists (e.g. drafted by `/poe-code-plan`), augment it in place by adding the YAML frontmatter at the top and a `## Task Board` section at the bottom. Do not create a second file.
|
|
17
|
+
|
|
18
|
+
## Before Writing: Study Existing Plans
|
|
19
|
+
|
|
20
|
+
Before drafting a new plan, find existing superintendent plans in this repo and use them as a reference for inspector choices, prompt phrasing, Task Board granularity, and MCP wiring.
|
|
21
|
+
|
|
22
|
+
1. Run `grep -rl "^kind: superintendent" <plan-directory>/` to list existing plans (use the resolved plan directory).
|
|
23
|
+
2. Read the most recent 1–2 (prefer ones whose scope resembles the current task).
|
|
24
|
+
3. Reuse inspector names, role phrasing, and structural conventions from those plans unless the new task clearly warrants deviation. Do not copy body content — only patterns.
|
|
25
|
+
|
|
26
|
+
If no existing plans are found, fall back to the template below.
|
|
27
|
+
|
|
28
|
+
## Document Shape
|
|
29
|
+
|
|
30
|
+
1. **YAML frontmatter** — wires the runtime (agents, prompts, MCP servers).
|
|
31
|
+
2. **Markdown body** — the feature plan plus a `## Task Board` with checkbox tasks.
|
|
32
|
+
|
|
33
|
+
## Frontmatter Format
|
|
34
|
+
|
|
35
|
+
Role prompts are one line. Do not repeat anything that lives in `CLAUDE.md` (TDD, SOLID, project conventions). The plan file is the source of truth — agents read it.
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
---
|
|
39
|
+
$schema: https://poe-platform.github.io/poe-code/schemas/plans/superintendent.schema.json
|
|
40
|
+
kind: superintendent
|
|
41
|
+
version: 1
|
|
42
|
+
|
|
43
|
+
builder:
|
|
44
|
+
prompt: |
|
|
45
|
+
Build the highest-priority open task from {{plan.path}}.
|
|
46
|
+
|
|
47
|
+
inspectors:
|
|
48
|
+
code-quality:
|
|
49
|
+
prompt: |
|
|
50
|
+
Make sure this code follows convention and good architecture.
|
|
51
|
+
|
|
52
|
+
superintendent:
|
|
53
|
+
prompt: |
|
|
54
|
+
Review the builder and inspector output, update the Task Board in {{plan.path}},
|
|
55
|
+
and request owner review when the board is complete.
|
|
56
|
+
|
|
57
|
+
Builder summary:
|
|
58
|
+
{{builder.summary}}
|
|
59
|
+
|
|
60
|
+
Inspector summaries:
|
|
61
|
+
|
|
62
|
+
## Code quality
|
|
63
|
+
{{inspectors.code-quality}}
|
|
64
|
+
|
|
65
|
+
owner:
|
|
66
|
+
agent: claude-code
|
|
67
|
+
prompt: |
|
|
68
|
+
Decide whether the work is done. Approve or send back with feedback.
|
|
69
|
+
|
|
70
|
+
Superintendent summary:
|
|
71
|
+
{{superintendent.summary}}
|
|
72
|
+
|
|
73
|
+
max_rounds: 50
|
|
74
|
+
|
|
75
|
+
status:
|
|
76
|
+
state: in_progress
|
|
77
|
+
round: 0
|
|
78
|
+
review_turn: 0
|
|
79
|
+
---
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Task Board
|
|
83
|
+
|
|
84
|
+
The markdown body must contain a `## Task Board` section with checkbox tasks:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
## Task Board
|
|
88
|
+
|
|
89
|
+
- [ ] First task to accomplish
|
|
90
|
+
- [ ] Second task to accomplish
|
|
91
|
+
- [ ] Third task to accomplish
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Priority is top-to-bottom: the first unchecked item is the highest priority. Use `- [ ]` for open tasks and `- [x]` for completed tasks.
|
|
95
|
+
|
|
96
|
+
## Available Prompt Variables
|
|
97
|
+
|
|
98
|
+
Use Mustache syntax in agent prompts:
|
|
99
|
+
|
|
100
|
+
| Variable | Description |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `{{plan.path}}` | Path to the plan document |
|
|
103
|
+
| `{{builder.summary}}` | Short builder outcome |
|
|
104
|
+
| `{{builder.log}}` | Builder execution log (text) |
|
|
105
|
+
| `{{builder.log_path}}` | Path to the builder's spawn log file (for `npm run replay`) |
|
|
106
|
+
| `{{inspectors.<name>}}` | Summary from a named inspector |
|
|
107
|
+
| `{{superintendent.summary}}` | Superintendent's completion or review summary |
|
|
108
|
+
| `{{owner.feedback}}` | Owner's decline feedback |
|
|
109
|
+
|
|
110
|
+
## Agent Roles
|
|
111
|
+
|
|
112
|
+
| Role | Purpose |
|
|
113
|
+
|---|---|
|
|
114
|
+
| `builder` | Does the actual work on the highest-priority task |
|
|
115
|
+
| `inspectors` | One-off evaluators that review the builder's work |
|
|
116
|
+
| `superintendent` | Reviews all outputs, updates the Task Board, requests owner review when done |
|
|
117
|
+
| `owner` | Decides whether to approve completion or send work back |
|
|
118
|
+
|
|
119
|
+
## Optional: MCP Servers
|
|
120
|
+
|
|
121
|
+
Declare MCP servers globally (all roles get them) or inline on a single role.
|
|
122
|
+
|
|
123
|
+
Global (every role can use it):
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
mcp:
|
|
127
|
+
my-server:
|
|
128
|
+
command: npx
|
|
129
|
+
args: [my-server]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Per-role (only that role gets it):
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
inspectors:
|
|
136
|
+
testing:
|
|
137
|
+
agent: claude-code
|
|
138
|
+
mcp:
|
|
139
|
+
terminal-pilot:
|
|
140
|
+
command: npx
|
|
141
|
+
args: [terminal-pilot-mcp]
|
|
142
|
+
prompt: |
|
|
143
|
+
Test it.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Optional: Agent Specifiers
|
|
147
|
+
|
|
148
|
+
Pin a specific model:
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
builder:
|
|
152
|
+
agent: claude-code:anthropic/claude-opus-4.6
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Optional: Working Directory
|
|
156
|
+
|
|
157
|
+
Any role may set `cwd` to override the default (the directory containing the plan doc). Absolute paths are used as-is; relative paths resolve against the plan doc's directory.
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
builder:
|
|
161
|
+
agent: claude-code
|
|
162
|
+
cwd: ../../packages/agent-harness-tools
|
|
163
|
+
prompt: |
|
|
164
|
+
Build the next task.
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Auto-Run vs On-Demand Inspectors
|
|
168
|
+
|
|
169
|
+
An inspector auto-runs each round only if its summary is referenced in the superintendent prompt via `{{inspectors.<name>}}` (transitively — if an auto-run inspector's own prompt references another inspector, that one also auto-runs). Inspectors configured but not referenced remain available: the superintendent can invoke them mid-round via the `inspector_run` MCP tool.
|
|
170
|
+
|
|
171
|
+
## Rules
|
|
172
|
+
|
|
173
|
+
- One plan document per feature: `<plan-directory>/<name>.md`. Do not create a second file in `.poe-code/superintendent/`.
|
|
174
|
+
- Superintendent docs must start with `$schema`, `kind: superintendent`, and `version: 1`.
|
|
175
|
+
- Role prompts are one line where possible. Do not restate CLAUDE.md.
|
|
176
|
+
- Do not link the plan path inside every prompt — `{{plan.path}}` is in the template context.
|
|
177
|
+
- `builder`, `superintendent`, and `owner` roles are required. `inspectors` is optional.
|
|
178
|
+
- `max_rounds` defaults to 100 if omitted.
|
|
179
|
+
- `status` must start with `state: in_progress`, `round: 0`, `review_turn: 0`.
|
|
180
|
+
|
|
181
|
+
## After Writing
|
|
182
|
+
|
|
183
|
+
Run `poe-code superintendent validate <path>` to check the document is valid.
|
|
184
|
+
|
|
185
|
+
## Output
|
|
186
|
+
|
|
187
|
+
```text
|
|
188
|
+
Created (or augmented):
|
|
189
|
+
<plan-directory>/<name>.md
|
|
190
|
+
|
|
191
|
+
Run with:
|
|
192
|
+
poe-code superintendent run <plan-directory>/<name>.md
|
|
193
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createSuperintendentSimulation, successTurn, failTurn, builderTurn, inspectorTurn, superintendentTurn, ownerApproveTurn, ownerRejectTurn } from "./simulation.js";
|
|
2
|
+
export type { TurnSpec, TurnContext, SimulationOptions, SimulationResult, SimulationRun } from "./simulation.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSuperintendentSimulation, successTurn, failTurn, builderTurn, inspectorTurn, superintendentTurn, ownerApproveTurn, ownerRejectTurn } from "./simulation.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type SuperintendentDoc } from "../document/parse.js";
|
|
2
|
+
import { runLoop, type AgentRunInput, type SuperintendentFileSystem } from "../runtime/loop.js";
|
|
3
|
+
import type { WorkflowTransition } from "../runtime/workflow-tool.js";
|
|
4
|
+
type SimulationFs = SuperintendentFileSystem;
|
|
5
|
+
type SuperintendentRunResult = Awaited<ReturnType<typeof runLoop>>;
|
|
6
|
+
type TurnOutput = {
|
|
7
|
+
stdout: string;
|
|
8
|
+
stderr?: string;
|
|
9
|
+
exitCode?: number;
|
|
10
|
+
summary?: string;
|
|
11
|
+
log?: string;
|
|
12
|
+
output?: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
transition?: unknown;
|
|
15
|
+
toolCalls?: unknown;
|
|
16
|
+
sessionResult?: unknown;
|
|
17
|
+
};
|
|
18
|
+
export type TurnContext = {
|
|
19
|
+
fs: SimulationFs;
|
|
20
|
+
readFile: (filePath: string) => Promise<string>;
|
|
21
|
+
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
22
|
+
readDoc: () => Promise<SuperintendentDoc>;
|
|
23
|
+
};
|
|
24
|
+
export type TurnSpec = {
|
|
25
|
+
assertPrompt?: (prompt: string, ctx: TurnContext) => void | Promise<void>;
|
|
26
|
+
fileChanges?: Record<string, string>;
|
|
27
|
+
output: TurnOutput;
|
|
28
|
+
};
|
|
29
|
+
export type SimulationOptions = {
|
|
30
|
+
docContent: string;
|
|
31
|
+
docPath?: string;
|
|
32
|
+
turns: TurnSpec[];
|
|
33
|
+
files?: Record<string, string>;
|
|
34
|
+
maxRounds?: number;
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
};
|
|
37
|
+
export type SimulationRun = AgentRunInput;
|
|
38
|
+
export type SimulationResult = {
|
|
39
|
+
result: SuperintendentRunResult;
|
|
40
|
+
prompts: string[];
|
|
41
|
+
runs: SimulationRun[];
|
|
42
|
+
fs: SimulationFs;
|
|
43
|
+
readFile: (filePath: string) => Promise<string>;
|
|
44
|
+
readDoc: () => Promise<SuperintendentDoc>;
|
|
45
|
+
};
|
|
46
|
+
export type SimulationFailureContext = Omit<SimulationResult, "result">;
|
|
47
|
+
export declare function successTurn(assertPrompt?: TurnSpec["assertPrompt"], fileChanges?: Record<string, string>): TurnSpec;
|
|
48
|
+
export declare function failTurn(stderr: string, assertPrompt?: TurnSpec["assertPrompt"], fileChanges?: Record<string, string>): TurnSpec;
|
|
49
|
+
export declare function builderTurn(fileChanges?: Record<string, string>, assertPrompt?: TurnSpec["assertPrompt"]): TurnSpec;
|
|
50
|
+
export declare function inspectorTurn(summary: string, assertPrompt?: TurnSpec["assertPrompt"]): TurnSpec;
|
|
51
|
+
export declare function superintendentTurn(transition?: WorkflowTransition, fileChanges?: Record<string, string>, assertPrompt?: TurnSpec["assertPrompt"]): TurnSpec;
|
|
52
|
+
export declare function ownerApproveTurn(assertPrompt?: TurnSpec["assertPrompt"]): TurnSpec;
|
|
53
|
+
export declare function ownerRejectTurn(feedback: string, assertPrompt?: TurnSpec["assertPrompt"]): TurnSpec;
|
|
54
|
+
export declare function createSuperintendentSimulation(options: SimulationOptions): {
|
|
55
|
+
run: () => Promise<SimulationResult>;
|
|
56
|
+
};
|
|
57
|
+
export {};
|