poe-code 3.0.201 → 3.0.203
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/experiment.js +11 -4
- package/dist/cli/commands/experiment.js.map +1 -1
- package/dist/cli/commands/ralph.js +12 -5
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/runtime-options.d.ts +10 -0
- package/dist/cli/commands/runtime-options.js +23 -0
- package/dist/cli/commands/runtime-options.js.map +1 -0
- package/dist/cli/commands/spawn.js +9 -3
- package/dist/cli/commands/spawn.js.map +1 -1
- package/dist/index.js +22975 -20513
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code.js +2741 -1706
- package/dist/providers/claude-code.js.map +4 -4
- package/dist/providers/codex.js +2770 -1735
- package/dist/providers/codex.js.map +4 -4
- package/dist/providers/goose.js +2640 -1605
- package/dist/providers/goose.js.map +4 -4
- package/dist/providers/kimi.js +2740 -1705
- package/dist/providers/kimi.js.map +4 -4
- package/dist/providers/opencode.js +2741 -1706
- package/dist/providers/opencode.js.map +4 -4
- package/dist/providers/poe-agent.js +19779 -17296
- package/dist/providers/poe-agent.js.map +4 -4
- package/dist/providers/spawn-options.d.ts +6 -0
- package/dist/sdk/experiment.js +5 -0
- package/dist/sdk/experiment.js.map +1 -1
- package/dist/sdk/ralph.js +5 -0
- package/dist/sdk/ralph.js.map +1 -1
- package/dist/sdk/spawn.js +17 -1
- package/dist/sdk/spawn.js.map +1 -1
- package/dist/sdk/types.d.ts +11 -0
- package/package.json +1 -1
- package/packages/memory/dist/index.js +2642 -444
- package/packages/memory/dist/index.js.map +4 -4
- package/packages/superintendent/dist/commands/run.d.ts +35 -0
- package/packages/superintendent/dist/commands/run.js +49 -1
- package/packages/superintendent/dist/commands/superintendent-group.d.ts +30 -0
- package/packages/superintendent/dist/runtime/agent-runner.d.ts +30 -0
- package/packages/superintendent/dist/runtime/agent-runner.js +119 -0
- package/packages/superintendent/dist/runtime/loop.d.ts +6 -1
- package/packages/superintendent/dist/runtime/loop.js +3 -11
- package/packages/superintendent/dist/runtime/run-builder.d.ts +1 -0
- package/packages/superintendent/dist/runtime/run-builder.js +3 -25
- package/packages/superintendent/dist/runtime/run-inspector.d.ts +1 -0
- package/packages/superintendent/dist/runtime/run-inspector.js +3 -25
- package/packages/superintendent/dist/runtime/run-owner-review.d.ts +1 -0
- package/packages/superintendent/dist/runtime/run-owner-review.js +3 -25
- package/packages/superintendent/dist/runtime/run-superintendent.d.ts +1 -0
- package/packages/superintendent/dist/runtime/run-superintendent.js +3 -25
|
@@ -9,6 +9,11 @@ export type RunCommandOptions = {
|
|
|
9
9
|
homeDir: string;
|
|
10
10
|
docPath?: string;
|
|
11
11
|
builderAgent?: string;
|
|
12
|
+
runtime?: "host" | "docker" | "e2b";
|
|
13
|
+
runtimeImage?: string;
|
|
14
|
+
runtimeTemplate?: string;
|
|
15
|
+
detach?: boolean;
|
|
16
|
+
mountPoeCode?: boolean;
|
|
12
17
|
configuredDefaultAgent?: string | null;
|
|
13
18
|
planDirectory?: string;
|
|
14
19
|
assumeYes?: boolean;
|
|
@@ -46,11 +51,21 @@ export declare const runCommand: import("toolcraft").Command<{
|
|
|
46
51
|
}, import("toolcraft-schema").ObjectSchema<{
|
|
47
52
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
48
53
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
54
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
55
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
56
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
57
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
58
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
49
59
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
50
60
|
}>, undefined, SuperintendentRunCommandResult> & {
|
|
51
61
|
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
|
|
52
62
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
53
63
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
64
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
65
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
66
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
67
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
68
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
54
69
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
55
70
|
}>, SuperintendentRunCommandResult, ("cli" | "sdk")[], undefined>;
|
|
56
71
|
};
|
|
@@ -62,11 +77,21 @@ export declare function createRunMcpCommand(runners?: RunMcpCommandRunners): imp
|
|
|
62
77
|
}, import("toolcraft-schema").ObjectSchema<{
|
|
63
78
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
64
79
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
80
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
81
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
82
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
83
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
84
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
65
85
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
66
86
|
}>, undefined, SuperintendentRunCommandResult> & {
|
|
67
87
|
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
|
|
68
88
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
69
89
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
90
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
91
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
92
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
93
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
94
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
70
95
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
71
96
|
}>, SuperintendentRunCommandResult, "mcp"[], undefined>;
|
|
72
97
|
};
|
|
@@ -75,11 +100,21 @@ export declare const runMcpCommand: import("toolcraft").Command<{
|
|
|
75
100
|
}, import("toolcraft-schema").ObjectSchema<{
|
|
76
101
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
77
102
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
103
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
104
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
105
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
106
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
107
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
78
108
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
79
109
|
}>, undefined, SuperintendentRunCommandResult> & {
|
|
80
110
|
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
|
|
81
111
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
82
112
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
113
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
114
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
115
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
116
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
117
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
83
118
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
84
119
|
}>, SuperintendentRunCommandResult, "mcp"[], undefined>;
|
|
85
120
|
};
|
|
@@ -25,6 +25,15 @@ const runParams = S.Object({
|
|
|
25
25
|
agent: S.Optional(S.String({
|
|
26
26
|
description: "Override the builder agent for this run. Precedence: --agent > plan frontmatter builder.agent."
|
|
27
27
|
})),
|
|
28
|
+
runtime: S.Optional(S.Enum(["host", "docker", "e2b"], {
|
|
29
|
+
description: "Override runtime backend: host, docker, or e2b"
|
|
30
|
+
})),
|
|
31
|
+
runtimeImage: S.Optional(S.String({ description: "Override Docker runtime image" })),
|
|
32
|
+
runtimeTemplate: S.Optional(S.String({ description: "Override E2B runtime template id" })),
|
|
33
|
+
detach: S.Optional(S.Boolean({ description: "Run as a detached runtime job" })),
|
|
34
|
+
mountPoeCode: S.Optional(S.Boolean({
|
|
35
|
+
description: "Mount the local poe-code checkout into the runtime"
|
|
36
|
+
})),
|
|
28
37
|
tui: S.Optional(S.Boolean({ description: "Show a live dashboard while Superintendent is running" }))
|
|
29
38
|
});
|
|
30
39
|
export const runCommand = defineCommand({
|
|
@@ -43,6 +52,11 @@ export const runCommand = defineCommand({
|
|
|
43
52
|
homeDir,
|
|
44
53
|
docPath: params.doc,
|
|
45
54
|
...(params.agent ? { builderAgent: params.agent } : {}),
|
|
55
|
+
...(params.runtime ? { runtime: params.runtime } : {}),
|
|
56
|
+
...(params.runtimeImage ? { runtimeImage: params.runtimeImage } : {}),
|
|
57
|
+
...(params.runtimeTemplate ? { runtimeTemplate: params.runtimeTemplate } : {}),
|
|
58
|
+
...(params.detach ? { detach: params.detach } : {}),
|
|
59
|
+
...(params.mountPoeCode ? { mountPoeCode: params.mountPoeCode } : {}),
|
|
46
60
|
configuredDefaultAgent: commandConfig.configuredDefaultAgent,
|
|
47
61
|
assumeYes: process.argv.includes("--yes"),
|
|
48
62
|
interactive: Boolean(process.stdin.isTTY),
|
|
@@ -95,6 +109,11 @@ export function createRunMcpCommand(runners) {
|
|
|
95
109
|
homeDir,
|
|
96
110
|
docPath: params.doc,
|
|
97
111
|
...(params.agent ? { builderAgent: params.agent } : {}),
|
|
112
|
+
...(params.runtime ? { runtime: params.runtime } : {}),
|
|
113
|
+
...(params.runtimeImage ? { runtimeImage: params.runtimeImage } : {}),
|
|
114
|
+
...(params.runtimeTemplate ? { runtimeTemplate: params.runtimeTemplate } : {}),
|
|
115
|
+
...(params.detach ? { detach: params.detach } : {}),
|
|
116
|
+
...(params.mountPoeCode ? { mountPoeCode: params.mountPoeCode } : {}),
|
|
98
117
|
configuredDefaultAgent: commandConfig.configuredDefaultAgent,
|
|
99
118
|
assumeYes: true,
|
|
100
119
|
interactive: false,
|
|
@@ -261,6 +280,13 @@ export async function runSuperintendentCommand(options) {
|
|
|
261
280
|
session: undefined,
|
|
262
281
|
executeAgent: options.executeAgent,
|
|
263
282
|
selectedBuilderAgent,
|
|
283
|
+
runtime: {
|
|
284
|
+
runtime: options.runtime,
|
|
285
|
+
runtimeImage: options.runtimeImage,
|
|
286
|
+
runtimeTemplate: options.runtimeTemplate,
|
|
287
|
+
detach: options.detach,
|
|
288
|
+
mountPoeCode: options.mountPoeCode
|
|
289
|
+
},
|
|
264
290
|
activeStage: () => activeStage,
|
|
265
291
|
now,
|
|
266
292
|
stderr
|
|
@@ -506,6 +532,13 @@ export async function runSuperintendentCommand(options) {
|
|
|
506
532
|
session,
|
|
507
533
|
executeAgent: options.executeAgent,
|
|
508
534
|
selectedBuilderAgent,
|
|
535
|
+
runtime: {
|
|
536
|
+
runtime: options.runtime,
|
|
537
|
+
runtimeImage: options.runtimeImage,
|
|
538
|
+
runtimeTemplate: options.runtimeTemplate,
|
|
539
|
+
detach: options.detach,
|
|
540
|
+
mountPoeCode: options.mountPoeCode
|
|
541
|
+
},
|
|
509
542
|
activeStage: () => session.activeStage,
|
|
510
543
|
now,
|
|
511
544
|
stderr
|
|
@@ -672,7 +705,12 @@ function createAgentRunner(options) {
|
|
|
672
705
|
const onStdout = (chunk) => stdoutBuffer.push(chunk);
|
|
673
706
|
const onStderr = (chunk) => stderrBuffer.push(chunk);
|
|
674
707
|
try {
|
|
675
|
-
const result = await executeAgent(agent, {
|
|
708
|
+
const result = await executeAgent(agent, {
|
|
709
|
+
...input,
|
|
710
|
+
...options.runtime,
|
|
711
|
+
onStdout,
|
|
712
|
+
onStderr
|
|
713
|
+
});
|
|
676
714
|
if (options.session && result.usage) {
|
|
677
715
|
options.session.tokensIn += result.usage.inputTokens;
|
|
678
716
|
options.session.tokensOut += result.usage.outputTokens;
|
|
@@ -738,6 +776,11 @@ async function executeSpawnAgent(agent, input) {
|
|
|
738
776
|
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
739
777
|
...(input.signal ? { signal: input.signal } : {}),
|
|
740
778
|
...(input.logPath ? { logPath: input.logPath } : {}),
|
|
779
|
+
...(input.runtime ? { runtime: input.runtime } : {}),
|
|
780
|
+
...(input.runtimeImage ? { runtimeImage: input.runtimeImage } : {}),
|
|
781
|
+
...(input.runtimeTemplate ? { runtimeTemplate: input.runtimeTemplate } : {}),
|
|
782
|
+
...(input.detach ? { detach: input.detach } : {}),
|
|
783
|
+
...(input.mountPoeCode ? { mountPoeCode: input.mountPoeCode } : {}),
|
|
741
784
|
...(tee ? { tee } : {})
|
|
742
785
|
});
|
|
743
786
|
return {
|
|
@@ -764,6 +807,11 @@ async function executeSpawnAgentStreaming(agent, input) {
|
|
|
764
807
|
...(input.mode ? { mode: input.mode } : {}),
|
|
765
808
|
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
766
809
|
...(input.signal ? { signal: input.signal } : {}),
|
|
810
|
+
...(input.runtime ? { runtime: input.runtime } : {}),
|
|
811
|
+
...(input.runtimeImage ? { runtimeImage: input.runtimeImage } : {}),
|
|
812
|
+
...(input.runtimeTemplate ? { runtimeTemplate: input.runtimeTemplate } : {}),
|
|
813
|
+
...(input.detach ? { detach: input.detach } : {}),
|
|
814
|
+
...(input.mountPoeCode ? { mountPoeCode: input.mountPoeCode } : {}),
|
|
767
815
|
...(input.onStderr ? { tee: { stderr: { write: input.onStderr } } } : {})
|
|
768
816
|
});
|
|
769
817
|
const middlewareContext = {
|
|
@@ -122,11 +122,21 @@ export declare const superintendentGroup: import("toolcraft").Group<{
|
|
|
122
122
|
}, import("toolcraft-schema").ObjectSchema<{
|
|
123
123
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
124
124
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
125
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
126
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
127
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
128
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
129
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
125
130
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
126
131
|
}>, undefined, import("./run.js").SuperintendentRunCommandResult> & {
|
|
127
132
|
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
|
|
128
133
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
129
134
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
135
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
136
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
137
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
138
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
139
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
130
140
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
131
141
|
}>, import("./run.js").SuperintendentRunCommandResult, ("cli" | "sdk")[], undefined>;
|
|
132
142
|
}) | (import("toolcraft").Command<{
|
|
@@ -214,11 +224,21 @@ export declare function createSuperintendentMcpGroup(runners?: SuperintendentMcp
|
|
|
214
224
|
}, import("toolcraft-schema").ObjectSchema<{
|
|
215
225
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
216
226
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
227
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
228
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
229
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
230
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
231
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
217
232
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
218
233
|
}>, undefined, import("./run.js").SuperintendentRunCommandResult> & {
|
|
219
234
|
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
|
|
220
235
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
221
236
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
237
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
238
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
239
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
240
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
241
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
222
242
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
223
243
|
}>, import("./run.js").SuperintendentRunCommandResult, "mcp"[], undefined>;
|
|
224
244
|
}) | (import("toolcraft").Command<{
|
|
@@ -305,11 +325,21 @@ export declare const superintendentMcpGroup: import("toolcraft").Group<{
|
|
|
305
325
|
}, import("toolcraft-schema").ObjectSchema<{
|
|
306
326
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
307
327
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
328
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
329
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
330
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
331
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
332
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
308
333
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
309
334
|
}>, undefined, import("./run.js").SuperintendentRunCommandResult> & {
|
|
310
335
|
readonly __agentKitCommandTypeInfo: import("toolcraft").CommandTypeInfo<"run", import("toolcraft-schema").ObjectSchema<{
|
|
311
336
|
readonly doc: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
312
337
|
readonly agent: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
338
|
+
readonly runtime: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").EnumSchema<readonly ["host", "docker", "e2b"]>>;
|
|
339
|
+
readonly runtimeImage: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
340
|
+
readonly runtimeTemplate: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").StringSchema>;
|
|
341
|
+
readonly detach: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
342
|
+
readonly mountPoeCode: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
313
343
|
readonly tui: import("toolcraft-schema").OptionalSchema<import("toolcraft-schema").BooleanSchema>;
|
|
314
344
|
}>, import("./run.js").SuperintendentRunCommandResult, "mcp"[], undefined>;
|
|
315
345
|
}) | (import("toolcraft").Command<{
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "@poe-code/agent-spawn/register-factories";
|
|
2
|
+
import { type RuntimeOverrideOptions } from "@poe-code/agent-harness-tools";
|
|
3
|
+
import { type McpSpawnConfig, type SpawnMode } from "@poe-code/agent-spawn";
|
|
4
|
+
export type { McpSpawnConfig, SpawnMode };
|
|
5
|
+
export type AutonomousInput = {
|
|
6
|
+
agent: string;
|
|
7
|
+
mode?: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
mcpServers?: McpSpawnConfig;
|
|
11
|
+
logPath?: string;
|
|
12
|
+
runtime?: RuntimeOverrideOptions["runtime"];
|
|
13
|
+
runtimeImage?: string;
|
|
14
|
+
runtimeTemplate?: string;
|
|
15
|
+
detach?: boolean;
|
|
16
|
+
mountPoeCode?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type AutonomousOutput = string | {
|
|
19
|
+
summary?: unknown;
|
|
20
|
+
log?: unknown;
|
|
21
|
+
output?: unknown;
|
|
22
|
+
stdout?: unknown;
|
|
23
|
+
text?: unknown;
|
|
24
|
+
toolCalls?: unknown;
|
|
25
|
+
sessionResult?: unknown;
|
|
26
|
+
logFile?: unknown;
|
|
27
|
+
};
|
|
28
|
+
type AutonomousRunner = (agent: string, options: Omit<AutonomousInput, "agent">) => Promise<AutonomousOutput>;
|
|
29
|
+
export declare function withAutonomousAgentRunner<T>(runner: AutonomousRunner, operation: () => Promise<T>): Promise<T>;
|
|
30
|
+
export declare function runAutonomousAgent(input: AutonomousInput): Promise<AutonomousOutput>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import "@poe-code/agent-spawn/register-factories";
|
|
2
|
+
import { mkdirSync, openSync, writeSync, closeSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { resolvePoeCommandExecution, runPoeCommand } from "@poe-code/agent-harness-tools";
|
|
5
|
+
import { buildSpawnArgs } from "@poe-code/agent-spawn";
|
|
6
|
+
let injectedRunner;
|
|
7
|
+
export async function withAutonomousAgentRunner(runner, operation) {
|
|
8
|
+
const previous = injectedRunner;
|
|
9
|
+
injectedRunner = runner;
|
|
10
|
+
try {
|
|
11
|
+
return await operation();
|
|
12
|
+
}
|
|
13
|
+
finally {
|
|
14
|
+
injectedRunner = previous;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function runAutonomousAgent(input) {
|
|
18
|
+
if (injectedRunner) {
|
|
19
|
+
return injectedRunner(input.agent, {
|
|
20
|
+
cwd: input.cwd,
|
|
21
|
+
prompt: input.prompt,
|
|
22
|
+
mode: input.mode,
|
|
23
|
+
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
24
|
+
...(input.logPath ? { logPath: input.logPath } : {}),
|
|
25
|
+
...(input.runtime ? { runtime: input.runtime } : {}),
|
|
26
|
+
...(input.runtimeImage ? { runtimeImage: input.runtimeImage } : {}),
|
|
27
|
+
...(input.runtimeTemplate ? { runtimeTemplate: input.runtimeTemplate } : {}),
|
|
28
|
+
...(input.detach ? { detach: input.detach } : {}),
|
|
29
|
+
...(input.mountPoeCode ? { mountPoeCode: input.mountPoeCode } : {})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const spawnArgs = buildSpawnArgs(input.agent, {
|
|
33
|
+
prompt: input.prompt,
|
|
34
|
+
mode: input.mode,
|
|
35
|
+
...(input.mcpServers ? { mcpServers: input.mcpServers } : {})
|
|
36
|
+
});
|
|
37
|
+
const processEnv = spawnArgs.env ? { ...process.env, ...spawnArgs.env } : undefined;
|
|
38
|
+
const argv = [spawnArgs.binaryName, ...spawnArgs.args];
|
|
39
|
+
const logFd = input.logPath ? openSpawnLog(input.logPath) : undefined;
|
|
40
|
+
const execution = resolvePoeCommandExecution({
|
|
41
|
+
cwd: input.cwd ?? process.cwd(),
|
|
42
|
+
env: (processEnv ?? process.env),
|
|
43
|
+
argv,
|
|
44
|
+
tool: input.agent,
|
|
45
|
+
runtime: {
|
|
46
|
+
runtime: input.runtime,
|
|
47
|
+
runtimeImage: input.runtimeImage,
|
|
48
|
+
runtimeTemplate: input.runtimeTemplate,
|
|
49
|
+
detach: input.detach,
|
|
50
|
+
mountPoeCode: input.mountPoeCode
|
|
51
|
+
},
|
|
52
|
+
openSpec: {
|
|
53
|
+
execution: {
|
|
54
|
+
wrapForLogTee: false,
|
|
55
|
+
stdin: "inherit",
|
|
56
|
+
stdout: "pipe",
|
|
57
|
+
stderr: "pipe",
|
|
58
|
+
env: processEnv,
|
|
59
|
+
captureOutput: true,
|
|
60
|
+
onStdout(chunk) {
|
|
61
|
+
appendSpawnLog(logFd, chunk);
|
|
62
|
+
},
|
|
63
|
+
onStderr(chunk) {
|
|
64
|
+
appendSpawnLog(logFd, chunk);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
try {
|
|
70
|
+
const result = await runPoeCommand({
|
|
71
|
+
factory: execution.factory,
|
|
72
|
+
openSpec: execution.openSpec,
|
|
73
|
+
detach: execution.detach,
|
|
74
|
+
state: execution.state
|
|
75
|
+
});
|
|
76
|
+
if (result.kind === "detached") {
|
|
77
|
+
return {
|
|
78
|
+
stdout: "",
|
|
79
|
+
...(input.logPath ? { logFile: input.logPath } : {})
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
stdout: result.stdout ?? "",
|
|
84
|
+
...(input.logPath ? { logFile: input.logPath } : {})
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
closeSpawnLog(logFd);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function openSpawnLog(filePath) {
|
|
92
|
+
try {
|
|
93
|
+
mkdirSync(path.dirname(filePath), { recursive: true });
|
|
94
|
+
return openSync(filePath, "a");
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function appendSpawnLog(fd, chunk) {
|
|
101
|
+
if (fd === undefined)
|
|
102
|
+
return;
|
|
103
|
+
try {
|
|
104
|
+
writeSync(fd, chunk);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// logging is best-effort
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function closeSpawnLog(fd) {
|
|
111
|
+
if (fd === undefined)
|
|
112
|
+
return;
|
|
113
|
+
try {
|
|
114
|
+
closeSync(fd);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// logging is best-effort
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type McpSpawnConfig } from "@poe-code/agent-spawn";
|
|
2
1
|
import { type LoopState } from "../state/machine.js";
|
|
2
|
+
import { type McpSpawnConfig } from "./agent-runner.js";
|
|
3
3
|
import { runBuilder, type BuilderResult } from "./run-builder.js";
|
|
4
4
|
import { runInspector, type InspectorResult } from "./run-inspector.js";
|
|
5
5
|
import { runOwnerReview, type OwnerResult } from "./run-owner-review.js";
|
|
@@ -32,6 +32,11 @@ export interface AgentRunInput {
|
|
|
32
32
|
cwd: string;
|
|
33
33
|
mode?: string;
|
|
34
34
|
mcpServers?: McpSpawnConfig;
|
|
35
|
+
runtime?: "host" | "docker" | "e2b";
|
|
36
|
+
runtimeImage?: string;
|
|
37
|
+
runtimeTemplate?: string;
|
|
38
|
+
detach?: boolean;
|
|
39
|
+
mountPoeCode?: boolean;
|
|
35
40
|
signal?: AbortSignal;
|
|
36
41
|
logPath?: string;
|
|
37
42
|
onStdout?: (chunk: string) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import * as fsPromises from "node:fs/promises";
|
|
3
3
|
import { lockWorkflow, makeRunLogFileName, resolveWorkflowPath } from "@poe-code/agent-harness-tools";
|
|
4
|
-
import { spawn } from "@poe-code/agent-spawn";
|
|
5
4
|
import { parseSuperintendentDoc } from "../document/parse.js";
|
|
6
5
|
import { parseTaskBoard } from "../document/tasks.js";
|
|
7
6
|
import { updateStatus } from "../document/write.js";
|
|
8
7
|
import { createLoopState } from "../state/machine.js";
|
|
8
|
+
import { withAutonomousAgentRunner } from "./agent-runner.js";
|
|
9
9
|
import { runBuilder } from "./run-builder.js";
|
|
10
10
|
import { runInspector } from "./run-inspector.js";
|
|
11
11
|
import { runOwnerReview } from "./run-owner-review.js";
|
|
@@ -417,9 +417,7 @@ async function withInjectedAgentRunner(options, operation) {
|
|
|
417
417
|
if (!options.runAgent) {
|
|
418
418
|
return operation();
|
|
419
419
|
}
|
|
420
|
-
|
|
421
|
-
const originalAutonomous = spawnApi.autonomous;
|
|
422
|
-
spawnApi.autonomous = async (agent, input) => {
|
|
420
|
+
return withAutonomousAgentRunner(async (agent, input) => {
|
|
423
421
|
const result = await options.runAgent?.({
|
|
424
422
|
agent,
|
|
425
423
|
prompt: input.prompt,
|
|
@@ -436,11 +434,5 @@ async function withInjectedAgentRunner(options, operation) {
|
|
|
436
434
|
throw new Error(result.stderr || result.stdout || `Agent \`${agent}\` failed with exit code ${result.exitCode}`);
|
|
437
435
|
}
|
|
438
436
|
return result;
|
|
439
|
-
};
|
|
440
|
-
try {
|
|
441
|
-
return await operation();
|
|
442
|
-
}
|
|
443
|
-
finally {
|
|
444
|
-
spawnApi.autonomous = originalAutonomous;
|
|
445
|
-
}
|
|
437
|
+
}, operation);
|
|
446
438
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@poe-code/agent-spawn/register-factories";
|
|
2
|
+
import { runAutonomousAgent } from "./agent-runner.js";
|
|
2
3
|
import { resolveRoleCwd } from "./resolve-cwd.js";
|
|
3
4
|
import { resolveTemplate } from "./templates.js";
|
|
4
5
|
export async function runBuilder(doc, context, options) {
|
|
5
6
|
const prompt = options.promptOverride ??
|
|
6
7
|
resolveTemplate(doc.frontmatter.builder.prompt, buildTemplateContext(doc, context));
|
|
7
|
-
const result = await
|
|
8
|
+
const result = await runAutonomousAgent({
|
|
8
9
|
agent: doc.frontmatter.builder.agent,
|
|
9
10
|
mode: doc.frontmatter.builder.mode,
|
|
10
11
|
prompt,
|
|
@@ -46,29 +47,6 @@ function buildTemplateContext(doc, context) {
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
async function runAutonomous(input) {
|
|
50
|
-
const spawnApi = spawn;
|
|
51
|
-
if (typeof spawnApi.autonomous === "function") {
|
|
52
|
-
return spawnApi.autonomous(input.agent, {
|
|
53
|
-
cwd: input.cwd,
|
|
54
|
-
prompt: input.prompt,
|
|
55
|
-
mode: input.mode,
|
|
56
|
-
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
57
|
-
...(input.logPath ? { logPath: input.logPath } : {})
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
const result = await spawn(input.agent, {
|
|
61
|
-
cwd: input.cwd,
|
|
62
|
-
prompt: input.prompt,
|
|
63
|
-
mode: input.mode,
|
|
64
|
-
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
65
|
-
...(input.logPath ? { logPath: input.logPath } : {})
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
stdout: result.stdout,
|
|
69
|
-
...(result.logFile ? { logFile: result.logFile } : {})
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
50
|
function extractLog(result) {
|
|
73
51
|
if (typeof result === "string") {
|
|
74
52
|
return result;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@poe-code/agent-spawn/register-factories";
|
|
2
|
+
import { runAutonomousAgent } from "./agent-runner.js";
|
|
2
3
|
import { resolveRoleCwd } from "./resolve-cwd.js";
|
|
3
4
|
import { buildInspectorSystemPrompt, prependSystemPrompt } from "./system-prompt.js";
|
|
4
5
|
import { resolveTemplate } from "./templates.js";
|
|
@@ -17,7 +18,7 @@ export async function runInspector(name, config, doc, context, options) {
|
|
|
17
18
|
: {})
|
|
18
19
|
});
|
|
19
20
|
const prompt = prependSystemPrompt(systemPrompt, userPrompt);
|
|
20
|
-
const output = await
|
|
21
|
+
const output = await runAutonomousAgent({
|
|
21
22
|
agent: config.agent,
|
|
22
23
|
mode: config.mode,
|
|
23
24
|
prompt,
|
|
@@ -76,29 +77,6 @@ function buildTemplateContext(doc, context) {
|
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
|
-
async function runAutonomous(input) {
|
|
80
|
-
const spawnApi = spawn;
|
|
81
|
-
if (typeof spawnApi.autonomous === "function") {
|
|
82
|
-
return spawnApi.autonomous(input.agent, {
|
|
83
|
-
cwd: input.cwd,
|
|
84
|
-
prompt: input.prompt,
|
|
85
|
-
mode: input.mode,
|
|
86
|
-
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
87
|
-
...(input.logPath ? { logPath: input.logPath } : {})
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const result = await spawn(input.agent, {
|
|
91
|
-
cwd: input.cwd,
|
|
92
|
-
prompt: input.prompt,
|
|
93
|
-
mode: input.mode,
|
|
94
|
-
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
95
|
-
...(input.logPath ? { logPath: input.logPath } : {})
|
|
96
|
-
});
|
|
97
|
-
return {
|
|
98
|
-
stdout: result.stdout,
|
|
99
|
-
...(result.logFile ? { logFile: result.logFile } : {})
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
80
|
function extractLogPath(result) {
|
|
103
81
|
if (typeof result === "string")
|
|
104
82
|
return undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@poe-code/agent-spawn/register-factories";
|
|
2
|
+
import { runAutonomousAgent } from "./agent-runner.js";
|
|
2
3
|
import { resolveRoleCwd } from "./resolve-cwd.js";
|
|
3
4
|
import { buildOwnerSystemPrompt, prependSystemPrompt } from "./system-prompt.js";
|
|
4
5
|
import { resolveTemplate } from "./templates.js";
|
|
@@ -10,7 +11,7 @@ const WORKFLOW_SERVER_TIMEOUT_SECONDS = 7200;
|
|
|
10
11
|
export async function runOwnerReview(doc, context, options) {
|
|
11
12
|
const userPrompt = resolveTemplate(doc.frontmatter.owner.prompt, buildTemplateContext(doc, context));
|
|
12
13
|
const prompt = prependSystemPrompt(buildOwnerSystemPrompt(), userPrompt);
|
|
13
|
-
const result = await
|
|
14
|
+
const result = await runAutonomousAgent({
|
|
14
15
|
agent: doc.frontmatter.owner.agent,
|
|
15
16
|
mode: doc.frontmatter.owner.mode,
|
|
16
17
|
prompt,
|
|
@@ -55,29 +56,6 @@ function toSpawnMcpServer(config) {
|
|
|
55
56
|
...(config.timeout !== undefined ? { timeout: config.timeout } : {})
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
|
-
async function runAutonomous(input) {
|
|
59
|
-
const spawnApi = spawn;
|
|
60
|
-
if (typeof spawnApi.autonomous === "function") {
|
|
61
|
-
return spawnApi.autonomous(input.agent, {
|
|
62
|
-
cwd: input.cwd,
|
|
63
|
-
prompt: input.prompt,
|
|
64
|
-
mode: input.mode,
|
|
65
|
-
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
66
|
-
...(input.logPath ? { logPath: input.logPath } : {})
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
const result = await spawn(input.agent, {
|
|
70
|
-
cwd: input.cwd,
|
|
71
|
-
prompt: input.prompt,
|
|
72
|
-
mode: input.mode,
|
|
73
|
-
...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
|
|
74
|
-
...(input.logPath ? { logPath: input.logPath } : {})
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
stdout: result.stdout,
|
|
78
|
-
...(result.logFile ? { logFile: result.logFile } : {})
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
59
|
function extractLogPath(result) {
|
|
82
60
|
if (typeof result === "string")
|
|
83
61
|
return undefined;
|