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.
Files changed (97) hide show
  1. package/dist/cli/commands/configure.d.ts +0 -7
  2. package/dist/cli/commands/configure.js +11 -14
  3. package/dist/cli/commands/configure.js.map +1 -1
  4. package/dist/cli/commands/provider.js +8 -1
  5. package/dist/cli/commands/provider.js.map +1 -1
  6. package/dist/index.js +263 -269
  7. package/dist/index.js.map +4 -4
  8. package/dist/providers/claude-code.js +6 -20
  9. package/dist/providers/claude-code.js.map +3 -3
  10. package/dist/providers/codex.js +6 -20
  11. package/dist/providers/codex.js.map +3 -3
  12. package/dist/providers/create-provider.js +0 -2
  13. package/dist/providers/create-provider.js.map +1 -1
  14. package/dist/providers/goose.js +14 -25
  15. package/dist/providers/goose.js.map +3 -3
  16. package/dist/providers/kimi.js +6 -20
  17. package/dist/providers/kimi.js.map +3 -3
  18. package/dist/providers/opencode.js +6 -20
  19. package/dist/providers/opencode.js.map +3 -3
  20. package/dist/providers/poe-agent.js +66 -84
  21. package/dist/providers/poe-agent.js.map +4 -4
  22. package/dist/utils/command-checks.d.ts +2 -1
  23. package/dist/utils/command-checks.js +3 -1
  24. package/dist/utils/command-checks.js.map +1 -1
  25. package/package.json +4 -1
  26. package/packages/memory/dist/cache.js +1 -1
  27. package/packages/memory/dist/explain.js +1 -1
  28. package/packages/memory/dist/index.js +18 -7
  29. package/packages/memory/dist/index.js.map +3 -3
  30. package/packages/memory/dist/query.js +1 -1
  31. package/packages/memory/dist/tokens.js +1 -1
  32. package/packages/superintendent/dist/cli.d.ts +2 -0
  33. package/packages/superintendent/dist/cli.js +41 -0
  34. package/packages/superintendent/dist/commands/builder-group.d.ts +52 -0
  35. package/packages/superintendent/dist/commands/builder-group.js +73 -0
  36. package/packages/superintendent/dist/commands/complete.d.ts +19 -0
  37. package/packages/superintendent/dist/commands/complete.js +54 -0
  38. package/packages/superintendent/dist/commands/index.d.ts +4 -0
  39. package/packages/superintendent/dist/commands/index.js +4 -0
  40. package/packages/superintendent/dist/commands/inspector-group.d.ts +115 -0
  41. package/packages/superintendent/dist/commands/inspector-group.js +133 -0
  42. package/packages/superintendent/dist/commands/install.d.ts +31 -0
  43. package/packages/superintendent/dist/commands/install.js +148 -0
  44. package/packages/superintendent/dist/commands/plan-path.d.ts +9 -0
  45. package/packages/superintendent/dist/commands/plan-path.js +40 -0
  46. package/packages/superintendent/dist/commands/poe-agent-runner.d.ts +5 -0
  47. package/packages/superintendent/dist/commands/poe-agent-runner.js +27 -0
  48. package/packages/superintendent/dist/commands/run.d.ts +86 -0
  49. package/packages/superintendent/dist/commands/run.js +945 -0
  50. package/packages/superintendent/dist/commands/superintendent-group.d.ts +325 -0
  51. package/packages/superintendent/dist/commands/superintendent-group.js +238 -0
  52. package/packages/superintendent/dist/config-scope.d.ts +8 -0
  53. package/packages/superintendent/dist/config-scope.js +9 -0
  54. package/packages/superintendent/dist/direct-execution.d.ts +1 -0
  55. package/packages/superintendent/dist/direct-execution.js +20 -0
  56. package/packages/superintendent/dist/document/parse.d.ts +59 -0
  57. package/packages/superintendent/dist/document/parse.js +409 -0
  58. package/packages/superintendent/dist/document/tasks.d.ts +12 -0
  59. package/packages/superintendent/dist/document/tasks.js +96 -0
  60. package/packages/superintendent/dist/document/write.d.ts +6 -0
  61. package/packages/superintendent/dist/document/write.js +156 -0
  62. package/packages/superintendent/dist/index.d.ts +12 -0
  63. package/packages/superintendent/dist/index.js +15 -0
  64. package/packages/superintendent/dist/mcp.d.ts +24 -0
  65. package/packages/superintendent/dist/mcp.js +202 -0
  66. package/packages/superintendent/dist/runtime/agentic-tools.d.ts +33 -0
  67. package/packages/superintendent/dist/runtime/agentic-tools.js +74 -0
  68. package/packages/superintendent/dist/runtime/loop.d.ts +88 -0
  69. package/packages/superintendent/dist/runtime/loop.js +446 -0
  70. package/packages/superintendent/dist/runtime/resolve-cwd.d.ts +2 -0
  71. package/packages/superintendent/dist/runtime/resolve-cwd.js +10 -0
  72. package/packages/superintendent/dist/runtime/run-builder.d.ts +13 -0
  73. package/packages/superintendent/dist/runtime/run-builder.js +102 -0
  74. package/packages/superintendent/dist/runtime/run-inspector.d.ts +16 -0
  75. package/packages/superintendent/dist/runtime/run-inspector.js +119 -0
  76. package/packages/superintendent/dist/runtime/run-owner-review.d.ts +18 -0
  77. package/packages/superintendent/dist/runtime/run-owner-review.js +208 -0
  78. package/packages/superintendent/dist/runtime/run-superintendent.d.ts +13 -0
  79. package/packages/superintendent/dist/runtime/run-superintendent.js +208 -0
  80. package/packages/superintendent/dist/runtime/system-prompt.d.ts +17 -0
  81. package/packages/superintendent/dist/runtime/system-prompt.js +54 -0
  82. package/packages/superintendent/dist/runtime/templates.d.ts +22 -0
  83. package/packages/superintendent/dist/runtime/templates.js +23 -0
  84. package/packages/superintendent/dist/runtime/types.d.ts +4 -0
  85. package/packages/superintendent/dist/runtime/types.js +1 -0
  86. package/packages/superintendent/dist/runtime/workflow-tool.d.ts +29 -0
  87. package/packages/superintendent/dist/runtime/workflow-tool.js +83 -0
  88. package/packages/superintendent/dist/state/machine.d.ts +14 -0
  89. package/packages/superintendent/dist/state/machine.js +53 -0
  90. package/packages/superintendent/dist/templates/SKILL_superintendent.md +193 -0
  91. package/packages/superintendent/dist/testing/index.d.ts +2 -0
  92. package/packages/superintendent/dist/testing/index.js +1 -0
  93. package/packages/superintendent/dist/testing/simulation.d.ts +57 -0
  94. package/packages/superintendent/dist/testing/simulation.js +346 -0
  95. package/dist/providers/tiny-http-mcp-server.d.ts +0 -22
  96. package/dist/providers/tiny-http-mcp-server.js +0 -1471
  97. package/dist/providers/tiny-http-mcp-server.js.map +0 -7
@@ -0,0 +1,15 @@
1
+ // Document
2
+ export { parseSuperintendentDoc, superintendentBaseDocumentSchema, superintendentBaseDocumentSchemaId, superintendentDocumentSchema, superintendentDocumentSchemaId } from "./document/parse.js";
3
+ export { updateStatus, transitionState, incrementRound } from "./document/write.js";
4
+ export { parseTaskBoard, hasTaskBoard } from "./document/tasks.js";
5
+ // Runtime
6
+ export { runLoop } from "./runtime/loop.js";
7
+ export { runBuilder } from "./runtime/run-builder.js";
8
+ export { runInspector, runAllInspectors } from "./runtime/run-inspector.js";
9
+ export { resolveTemplate } from "./runtime/templates.js";
10
+ // State
11
+ export { createLoopState, applyTransition, isComplete } from "./state/machine.js";
12
+ // Commands (for composition)
13
+ export { superintendentGroup } from "./commands/index.js";
14
+ // Config
15
+ export { superintendentConfigScope } from "./config-scope.js";
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { type Server } from "tiny-stdio-mcp-server";
3
+ import { superintendentMcpGroup } from "./commands/index.js";
4
+ import { parseSuperintendentDoc, type StatusBlock } from "./document/parse.js";
5
+ import { runBuilder } from "./runtime/run-builder.js";
6
+ import { runInspector } from "./runtime/run-inspector.js";
7
+ export type SuperintendentToolsPayload = {
8
+ docPath: string;
9
+ state: StatusBlock["state"];
10
+ inspectorNames: string[];
11
+ };
12
+ export type McpRunners = {
13
+ superintendentMcpGroup?: typeof superintendentMcpGroup;
14
+ runBuilder?: typeof runBuilder;
15
+ runInspector?: typeof runInspector;
16
+ parseSuperintendentDoc?: typeof parseSuperintendentDoc;
17
+ };
18
+ export type MainOptions = {
19
+ runners?: McpRunners;
20
+ };
21
+ export declare function createSuperintendentMcpServer(runners?: McpRunners): Omit<Server, "connect"> & {
22
+ connect(transport: import("tiny-stdio-mcp-server").SDKTransport): Promise<void>;
23
+ };
24
+ export declare function main(argv?: string[], options?: MainOptions): Promise<void>;
@@ -0,0 +1,202 @@
1
+ #!/usr/bin/env node
2
+ import * as fsPromises from "node:fs/promises";
3
+ import { createMCPServer } from "toolcraft/mcp";
4
+ import { createServer } from "tiny-stdio-mcp-server";
5
+ import { isDirectExecution } from "./direct-execution.js";
6
+ import { superintendentMcpGroup } from "./commands/index.js";
7
+ import { parseSuperintendentDoc } from "./document/parse.js";
8
+ import { runBuilder } from "./runtime/run-builder.js";
9
+ import { runInspector } from "./runtime/run-inspector.js";
10
+ import { createWorkflowTool, parseWorkflowCall } from "./runtime/workflow-tool.js";
11
+ import { createBuilderTool, createInspectorTool, parseBuilderRunInput, parseInspectorRunInput } from "./runtime/agentic-tools.js";
12
+ const MCP_NAME = "superintendent";
13
+ const MCP_VERSION = "0.0.1";
14
+ const SUPERINTENDENT_TOOLS_SUBCOMMAND = "superintendent-tools";
15
+ const SUPERINTENDENT_TOOLS_SERVER_NAME = "superintendent-agentic-tools";
16
+ const WORKFLOW_TRANSITION_SUBCOMMAND = "workflow-transition";
17
+ const WORKFLOW_TRANSITION_SERVER_NAME = "superintendent-workflow-transition";
18
+ function resolveMcpRunners(overrides) {
19
+ return {
20
+ superintendentMcpGroup: overrides?.superintendentMcpGroup ?? superintendentMcpGroup,
21
+ runBuilder: overrides?.runBuilder ?? runBuilder,
22
+ runInspector: overrides?.runInspector ?? runInspector,
23
+ parseSuperintendentDoc: overrides?.parseSuperintendentDoc ?? parseSuperintendentDoc
24
+ };
25
+ }
26
+ export function createSuperintendentMcpServer(runners) {
27
+ const resolved = resolveMcpRunners(runners);
28
+ return createMCPServer([resolved.superintendentMcpGroup], {
29
+ name: MCP_NAME,
30
+ version: MCP_VERSION
31
+ });
32
+ }
33
+ export async function main(argv = process.argv, options = {}) {
34
+ const runners = resolveMcpRunners(options.runners);
35
+ const originalArgv = process.argv;
36
+ process.argv = argv;
37
+ try {
38
+ if (argv[2] === SUPERINTENDENT_TOOLS_SUBCOMMAND) {
39
+ await runSuperintendentToolsServer(argv[3], runners);
40
+ return;
41
+ }
42
+ if (argv[2] === WORKFLOW_TRANSITION_SUBCOMMAND) {
43
+ await runWorkflowTransitionServer(argv[3]);
44
+ return;
45
+ }
46
+ await createSuperintendentMcpServer(options.runners).listen();
47
+ }
48
+ finally {
49
+ process.argv = originalArgv;
50
+ }
51
+ }
52
+ async function runSuperintendentToolsServer(encodedPayload, runners) {
53
+ const payload = decodeSuperintendentToolsPayload(encodedPayload);
54
+ const server = createServer({
55
+ name: SUPERINTENDENT_TOOLS_SERVER_NAME,
56
+ version: MCP_VERSION
57
+ });
58
+ registerWorkflowTool(server, payload.state);
59
+ registerBuilderTool(server, payload.docPath, runners);
60
+ registerInspectorTool(server, payload.docPath, payload.inspectorNames, runners);
61
+ await server.listen();
62
+ }
63
+ function registerWorkflowTool(server, state) {
64
+ const tool = createWorkflowTool("superintendent", state);
65
+ registerWorkflowToolDefinition(server, tool);
66
+ }
67
+ async function runWorkflowTransitionServer(encodedTool) {
68
+ const tool = decodeWorkflowTool(encodedTool);
69
+ const server = createServer({
70
+ name: WORKFLOW_TRANSITION_SERVER_NAME,
71
+ version: MCP_VERSION
72
+ });
73
+ registerWorkflowToolDefinition(server, tool);
74
+ await server.listen();
75
+ }
76
+ function registerWorkflowToolDefinition(server, tool) {
77
+ server.tool(tool.name, tool.description, tool.inputSchema, async (input) => {
78
+ const transition = parseWorkflowCall(input);
79
+ assertAllowedAction(tool, transition.action);
80
+ return `Recorded workflow transition: ${transition.action}`;
81
+ });
82
+ }
83
+ function registerBuilderTool(server, docPath, runners) {
84
+ const tool = createBuilderTool();
85
+ server.tool(tool.name, tool.description, tool.inputSchema, async (input) => {
86
+ const { prompt } = parseBuilderRunInput(input);
87
+ const freshDoc = await readSuperintendentDoc(docPath, runners);
88
+ const result = await runners.runBuilder(freshDoc, {}, {
89
+ promptOverride: prompt,
90
+ defaultCwd: process.cwd()
91
+ });
92
+ return JSON.stringify(result);
93
+ });
94
+ }
95
+ function registerInspectorTool(server, docPath, inspectorNames, runners) {
96
+ const tool = createInspectorTool(inspectorNames);
97
+ server.tool(tool.name, tool.description, tool.inputSchema, async (input) => {
98
+ const parsed = parseInspectorRunInput(input, inspectorNames);
99
+ const freshDoc = await readSuperintendentDoc(docPath, runners);
100
+ const config = freshDoc.frontmatter.inspectors?.[parsed.name];
101
+ if (!config) {
102
+ throw new Error(`Inspector "${parsed.name}" is not configured in ${docPath}`);
103
+ }
104
+ const result = await runners.runInspector(parsed.name, config, freshDoc, {}, {
105
+ defaultCwd: process.cwd(),
106
+ ...(parsed.prompt ? { promptOverride: parsed.prompt } : {})
107
+ });
108
+ return JSON.stringify(result);
109
+ });
110
+ }
111
+ async function readSuperintendentDoc(docPath, runners) {
112
+ const content = await fsPromises.readFile(docPath, "utf8");
113
+ return runners.parseSuperintendentDoc(docPath, content);
114
+ }
115
+ function decodeSuperintendentToolsPayload(encodedPayload) {
116
+ if (typeof encodedPayload !== "string" || encodedPayload.trim().length === 0) {
117
+ throw invalidSuperintendentToolsPayloadError();
118
+ }
119
+ try {
120
+ const decoded = Buffer.from(encodedPayload, "base64").toString("utf8");
121
+ const parsed = JSON.parse(decoded);
122
+ if (!isSuperintendentToolsPayload(parsed)) {
123
+ throw invalidSuperintendentToolsPayloadError();
124
+ }
125
+ return parsed;
126
+ }
127
+ catch (error) {
128
+ if (error instanceof Error &&
129
+ error.message === invalidSuperintendentToolsPayloadError().message) {
130
+ throw error;
131
+ }
132
+ throw invalidSuperintendentToolsPayloadError();
133
+ }
134
+ }
135
+ function assertAllowedAction(tool, action) {
136
+ const allowedActions = tool.inputSchema.properties.action.enum ?? [];
137
+ if (!allowedActions.includes(action)) {
138
+ throw new Error(`workflow_transition action "${action}" is not allowed for this role/state`);
139
+ }
140
+ }
141
+ function invalidSuperintendentToolsPayloadError() {
142
+ return new Error("Invalid superintendent-tools payload");
143
+ }
144
+ function decodeWorkflowTool(encodedTool) {
145
+ if (typeof encodedTool !== "string" || encodedTool.trim().length === 0) {
146
+ throw invalidWorkflowTransitionPayloadError();
147
+ }
148
+ try {
149
+ const decoded = Buffer.from(encodedTool, "base64").toString("utf8");
150
+ const parsed = JSON.parse(decoded);
151
+ if (!isWorkflowToolDefinition(parsed)) {
152
+ throw invalidWorkflowTransitionPayloadError();
153
+ }
154
+ return parsed;
155
+ }
156
+ catch (error) {
157
+ if (error instanceof Error &&
158
+ error.message === invalidWorkflowTransitionPayloadError().message) {
159
+ throw error;
160
+ }
161
+ throw invalidWorkflowTransitionPayloadError();
162
+ }
163
+ }
164
+ function invalidWorkflowTransitionPayloadError() {
165
+ return new Error("Invalid workflow-transition payload");
166
+ }
167
+ function isWorkflowToolDefinition(value) {
168
+ if (!isRecord(value)) {
169
+ return false;
170
+ }
171
+ if (value.name !== "workflow_transition" || typeof value.description !== "string") {
172
+ return false;
173
+ }
174
+ const inputSchema = value.inputSchema;
175
+ if (!isRecord(inputSchema) || inputSchema.type !== "object") {
176
+ return false;
177
+ }
178
+ const properties = inputSchema.properties;
179
+ if (!isRecord(properties) || !isRecord(properties.action)) {
180
+ return false;
181
+ }
182
+ return properties.action.type === "string";
183
+ }
184
+ function isSuperintendentToolsPayload(value) {
185
+ if (!isRecord(value)) {
186
+ return false;
187
+ }
188
+ return (typeof value.docPath === "string" &&
189
+ value.docPath.length > 0 &&
190
+ isStatusState(value.state) &&
191
+ Array.isArray(value.inspectorNames) &&
192
+ value.inspectorNames.every((name) => typeof name === "string"));
193
+ }
194
+ function isStatusState(value) {
195
+ return value === "in_progress" || value === "review" || value === "completed";
196
+ }
197
+ function isRecord(value) {
198
+ return typeof value === "object" && value !== null && !Array.isArray(value);
199
+ }
200
+ if (await isDirectExecution(import.meta.url, process.argv)) {
201
+ await main();
202
+ }
@@ -0,0 +1,33 @@
1
+ type StringProperty = {
2
+ type: "string";
3
+ description: string;
4
+ enum?: string[];
5
+ };
6
+ type ObjectSchema = {
7
+ type: "object";
8
+ additionalProperties: false;
9
+ properties: Record<string, StringProperty>;
10
+ required: string[];
11
+ };
12
+ export type BuilderToolDefinition = {
13
+ name: "builder_run";
14
+ description: string;
15
+ inputSchema: ObjectSchema;
16
+ };
17
+ export type InspectorToolDefinition = {
18
+ name: "inspector_run";
19
+ description: string;
20
+ inputSchema: ObjectSchema;
21
+ };
22
+ export type BuilderRunInput = {
23
+ prompt: string;
24
+ };
25
+ export type InspectorRunInput = {
26
+ name: string;
27
+ prompt?: string;
28
+ };
29
+ export declare function createBuilderTool(): BuilderToolDefinition;
30
+ export declare function createInspectorTool(inspectorNames: string[]): InspectorToolDefinition;
31
+ export declare function parseBuilderRunInput(input: unknown): BuilderRunInput;
32
+ export declare function parseInspectorRunInput(input: unknown, inspectorNames: string[]): InspectorRunInput;
33
+ export {};
@@ -0,0 +1,74 @@
1
+ export function createBuilderTool() {
2
+ return {
3
+ name: "builder_run",
4
+ description: "Run the builder agent with a prompt you compose. Returns the builder's summary and the path to its session log. Use this to make targeted changes mid-round without waiting for the next auto-run.",
5
+ inputSchema: {
6
+ type: "object",
7
+ additionalProperties: false,
8
+ properties: {
9
+ prompt: {
10
+ type: "string",
11
+ description: "Full prompt for the builder. Replaces the frontmatter `builder.prompt` template for this call only."
12
+ }
13
+ },
14
+ required: ["prompt"]
15
+ }
16
+ };
17
+ }
18
+ export function createInspectorTool(inspectorNames) {
19
+ const namesAvailable = inspectorNames.length > 0;
20
+ return {
21
+ name: "inspector_run",
22
+ description: namesAvailable
23
+ ? `Re-run a specific inspector. Returns the inspector's summary. Available inspectors: ${inspectorNames.join(", ")}.`
24
+ : "Re-run a specific inspector. No inspectors are configured for this document.",
25
+ inputSchema: {
26
+ type: "object",
27
+ additionalProperties: false,
28
+ properties: {
29
+ name: {
30
+ type: "string",
31
+ description: "Name of the inspector to run, as defined under `inspectors:` in the frontmatter.",
32
+ ...(namesAvailable ? { enum: inspectorNames } : {})
33
+ },
34
+ prompt: {
35
+ type: "string",
36
+ description: "Optional prompt that replaces the inspector's frontmatter `prompt` template for this call only. Omit to use the configured prompt."
37
+ }
38
+ },
39
+ required: ["name"]
40
+ }
41
+ };
42
+ }
43
+ export function parseBuilderRunInput(input) {
44
+ if (!isRecord(input)) {
45
+ throw new Error("builder_run requires an object input with a `prompt` field");
46
+ }
47
+ const prompt = input.prompt;
48
+ if (typeof prompt !== "string" || prompt.trim().length === 0) {
49
+ throw new Error("builder_run `prompt` must be a non-empty string");
50
+ }
51
+ return { prompt };
52
+ }
53
+ export function parseInspectorRunInput(input, inspectorNames) {
54
+ if (!isRecord(input)) {
55
+ throw new Error("inspector_run requires an object input with a `name` field");
56
+ }
57
+ const name = input.name;
58
+ if (typeof name !== "string" || name.trim().length === 0) {
59
+ throw new Error("inspector_run `name` must be a non-empty string");
60
+ }
61
+ if (inspectorNames.length > 0 && !inspectorNames.includes(name)) {
62
+ throw new Error(`inspector_run name "${name}" is not configured. Available inspectors: ${inspectorNames.join(", ")}`);
63
+ }
64
+ if (input.prompt === undefined) {
65
+ return { name };
66
+ }
67
+ if (typeof input.prompt !== "string" || input.prompt.trim().length === 0) {
68
+ throw new Error("inspector_run `prompt` must be a non-empty string when provided");
69
+ }
70
+ return { name, prompt: input.prompt };
71
+ }
72
+ function isRecord(value) {
73
+ return typeof value === "object" && value !== null && !Array.isArray(value);
74
+ }
@@ -0,0 +1,88 @@
1
+ import { type McpSpawnConfig } from "@poe-code/agent-spawn";
2
+ import { type LoopState } from "../state/machine.js";
3
+ import { runBuilder, type BuilderResult } from "./run-builder.js";
4
+ import { runInspector, type InspectorResult } from "./run-inspector.js";
5
+ import { runOwnerReview, type OwnerResult } from "./run-owner-review.js";
6
+ import { runSuperintendent, type SuperintendentResult } from "./run-superintendent.js";
7
+ export type SuperintendentStopReason = "completed" | "max_rounds" | "paused" | "stopped" | "aborted";
8
+ export type SuperintendentRunResult = LoopState & {
9
+ stopReason: SuperintendentStopReason;
10
+ };
11
+ export interface SuperintendentFileStat {
12
+ isFile(): boolean;
13
+ isDirectory(): boolean;
14
+ mtimeMs: number;
15
+ }
16
+ export interface SuperintendentFileSystem {
17
+ readFile(path: string, encoding: BufferEncoding): Promise<string>;
18
+ writeFile(path: string, data: string, options?: {
19
+ encoding?: BufferEncoding;
20
+ }): Promise<void>;
21
+ readdir(path: string): Promise<string[]>;
22
+ stat(path: string): Promise<SuperintendentFileStat>;
23
+ mkdir(path: string, options?: {
24
+ recursive?: boolean;
25
+ }): Promise<void>;
26
+ rmdir(path: string): Promise<void>;
27
+ rename(oldPath: string, newPath: string): Promise<void>;
28
+ }
29
+ export interface AgentRunInput {
30
+ agent: string;
31
+ prompt: string;
32
+ cwd: string;
33
+ mode?: string;
34
+ mcpServers?: McpSpawnConfig;
35
+ signal?: AbortSignal;
36
+ logPath?: string;
37
+ onStdout?: (chunk: string) => void;
38
+ onStderr?: (chunk: string) => void;
39
+ }
40
+ export interface AgentRunResult {
41
+ stdout: string;
42
+ stderr: string;
43
+ exitCode: number;
44
+ summary?: string;
45
+ log?: string;
46
+ logFile?: string;
47
+ output?: string;
48
+ text?: string;
49
+ transition?: unknown;
50
+ toolCalls?: unknown;
51
+ sessionResult?: unknown;
52
+ }
53
+ export type LoopCallbacks = {
54
+ onBuilderStart?: () => void;
55
+ onBuilderComplete?: (result: BuilderResult) => void;
56
+ onBuilderFailed?: (error: Error) => void;
57
+ onInspectorStart?: (name: string) => void;
58
+ onInspectorComplete?: (result: InspectorResult) => void;
59
+ onInspectorFailed?: (name: string, error: Error) => void;
60
+ onSuperintendentStart?: () => void;
61
+ onSuperintendentComplete?: (result: SuperintendentResult) => void;
62
+ onOwnerStart?: () => void;
63
+ onOwnerComplete?: (result: OwnerResult) => void;
64
+ onRoundComplete?: (round: number) => void;
65
+ onLoopComplete?: (state: SuperintendentRunResult) => void;
66
+ onStateChange?: (state: LoopState) => void;
67
+ shouldPause?: () => boolean;
68
+ shouldStop?: () => boolean;
69
+ };
70
+ export type LoopRunners = {
71
+ builder?: typeof runBuilder;
72
+ inspector?: typeof runInspector;
73
+ superintendent?: typeof runSuperintendent;
74
+ ownerReview?: typeof runOwnerReview;
75
+ };
76
+ export type RunLoopOptions = {
77
+ docPath: string;
78
+ cwd: string;
79
+ homeDir: string;
80
+ fs?: SuperintendentFileSystem;
81
+ callbacks?: LoopCallbacks;
82
+ runAgent?: (input: AgentRunInput) => Promise<AgentRunResult>;
83
+ runners?: LoopRunners;
84
+ signal?: AbortSignal;
85
+ logDir?: string;
86
+ };
87
+ export declare function runLoop(docPath: string, callbacks?: LoopCallbacks): Promise<SuperintendentRunResult>;
88
+ export declare function runLoop(options: RunLoopOptions): Promise<SuperintendentRunResult>;