poe-code 3.0.45 → 3.0.47
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/test.d.ts +0 -2
- package/dist/cli/commands/test.js +26 -104
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/index.js +34 -133
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
|
@@ -3,6 +3,4 @@ import type { CliContainer } from "../container.js";
|
|
|
3
3
|
export declare function registerTestCommand(program: Command, container: CliContainer): Command;
|
|
4
4
|
export declare function executeTest(program: Command, container: CliContainer, service: string, options?: {
|
|
5
5
|
isolated?: boolean;
|
|
6
|
-
stdin?: boolean;
|
|
7
|
-
model?: string;
|
|
8
6
|
}): Promise<void>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { buildProviderContext, createExecutionResources, resolveCommandFlags, resolveServiceAdapter, formatServiceList } from "./shared.js";
|
|
2
2
|
import { resolveServiceArgument } from "./configure.js";
|
|
3
3
|
import { resolveIsolatedEnvDetails } from "../isolated-env.js";
|
|
4
|
-
import { formatCommandRunnerResult, stdoutMatchesExpected } from "../../utils/command-checks.js";
|
|
5
|
-
import { spawnStreaming, getSpawnConfig } from "@poe-code/agent-spawn";
|
|
6
4
|
import { withSpinner } from "@poe-code/design-system";
|
|
7
5
|
export function registerTestCommand(program, container) {
|
|
8
6
|
const serviceNames = container.registry
|
|
@@ -13,17 +11,13 @@ export function registerTestCommand(program, container) {
|
|
|
13
11
|
return program
|
|
14
12
|
.command("test")
|
|
15
13
|
.description("Run agent health checks.")
|
|
16
|
-
.option("--stdin", "Verify stdin prompt support via spawn")
|
|
17
|
-
.option("--model <model>", "Model identifier override (requires --stdin)")
|
|
18
14
|
.argument("[agent]", serviceDescription)
|
|
19
15
|
.option("--isolated", "Run the health check using isolated configuration.")
|
|
20
16
|
.action(async function (service) {
|
|
21
17
|
const resolved = await resolveServiceArgument(program, container, service, { action: "test" });
|
|
22
18
|
const opts = this.opts();
|
|
23
19
|
await executeTest(this, container, resolved, {
|
|
24
|
-
isolated: Boolean(opts.isolated)
|
|
25
|
-
stdin: Boolean(opts.stdin),
|
|
26
|
-
model: opts.model
|
|
20
|
+
isolated: Boolean(opts.isolated)
|
|
27
21
|
});
|
|
28
22
|
});
|
|
29
23
|
}
|
|
@@ -34,9 +28,6 @@ export async function executeTest(program, container, service, options = {}) {
|
|
|
34
28
|
const resources = createExecutionResources(container, flags, `test:${canonicalService}`);
|
|
35
29
|
resources.logger.intro(`test ${canonicalService}`);
|
|
36
30
|
const providerContext = buildProviderContext(container, adapter, resources);
|
|
37
|
-
if (options.model && !options.stdin) {
|
|
38
|
-
throw new Error("The --model option requires --stdin.");
|
|
39
|
-
}
|
|
40
31
|
const isolatedDetails = options.isolated && adapter.isolatedEnv
|
|
41
32
|
? await resolveIsolatedEnvDetails(container.env, adapter.isolatedEnv, adapter.name, container.fs)
|
|
42
33
|
: null;
|
|
@@ -49,102 +40,33 @@ export async function executeTest(program, container, service, options = {}) {
|
|
|
49
40
|
flags
|
|
50
41
|
});
|
|
51
42
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
prompt,
|
|
73
|
-
useStdin: true,
|
|
74
|
-
model: options.model
|
|
75
|
-
});
|
|
76
|
-
let output = "";
|
|
77
|
-
for await (const event of streaming.events) {
|
|
78
|
-
if (event.event === "agent_message") {
|
|
79
|
-
output += event.text;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const spawnResult = await streaming.done;
|
|
83
|
-
return {
|
|
84
|
-
stdout: output,
|
|
85
|
-
stderr: spawnResult.stderr,
|
|
86
|
-
exitCode: spawnResult.exitCode
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
return container.registry.invoke(canonicalService, "spawn", async (entry) => {
|
|
90
|
-
if (!entry.spawn) {
|
|
91
|
-
throw new Error(`Agent "${canonicalService}" does not support spawn.`);
|
|
43
|
+
await withSpinner({
|
|
44
|
+
message: `Testing ${adapter.label}...`,
|
|
45
|
+
fn: () => container.registry.invoke(canonicalService, "test", async (entry) => {
|
|
46
|
+
if (!entry.test) {
|
|
47
|
+
throw new Error(`Agent "${canonicalService}" does not support test.`);
|
|
48
|
+
}
|
|
49
|
+
const activeContext = isolatedDetails
|
|
50
|
+
? {
|
|
51
|
+
...providerContext,
|
|
52
|
+
runCheck: async (check) => {
|
|
53
|
+
await check.run({
|
|
54
|
+
isDryRun: providerContext.logger.context.dryRun,
|
|
55
|
+
runCommand: (command, args) => resources.context.runCommand("poe-code", [
|
|
56
|
+
"wrap",
|
|
57
|
+
canonicalService,
|
|
58
|
+
"--",
|
|
59
|
+
...args
|
|
60
|
+
]),
|
|
61
|
+
logDryRun: (message) => providerContext.logger.dryRun(message)
|
|
62
|
+
});
|
|
92
63
|
}
|
|
93
|
-
const output = await entry.spawn(providerContext, {
|
|
94
|
-
prompt,
|
|
95
|
-
useStdin: true,
|
|
96
|
-
model: options.model
|
|
97
|
-
});
|
|
98
|
-
return output;
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
stopMessage: () => `${adapter.label} stdin test`
|
|
102
|
-
});
|
|
103
|
-
if (!result) {
|
|
104
|
-
throw new Error(`Stdin spawn test for ${adapter.label} did not return command output.`);
|
|
105
|
-
}
|
|
106
|
-
if (result.exitCode !== 0) {
|
|
107
|
-
throw new Error([
|
|
108
|
-
`Stdin spawn test for ${adapter.label} failed with exit code ${result.exitCode}.`,
|
|
109
|
-
formatCommandRunnerResult(result)
|
|
110
|
-
].join("\n"));
|
|
111
|
-
}
|
|
112
|
-
if (!stdoutMatchesExpected(result.stdout, expectedOutput)) {
|
|
113
|
-
throw new Error([
|
|
114
|
-
`Stdin spawn test for ${adapter.label} failed: expected "${expectedOutput}" but received "${result.stdout.trim()}".`,
|
|
115
|
-
formatCommandRunnerResult(result)
|
|
116
|
-
].join("\n"));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
await withSpinner({
|
|
121
|
-
message: `Testing ${adapter.label}...`,
|
|
122
|
-
fn: () => container.registry.invoke(canonicalService, "test", async (entry) => {
|
|
123
|
-
if (!entry.test) {
|
|
124
|
-
throw new Error(`Agent "${canonicalService}" does not support test.`);
|
|
125
64
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
isDryRun: providerContext.logger.context.dryRun,
|
|
132
|
-
runCommand: (command, args) => resources.context.runCommand("poe-code", [
|
|
133
|
-
"wrap",
|
|
134
|
-
canonicalService,
|
|
135
|
-
"--",
|
|
136
|
-
...args
|
|
137
|
-
]),
|
|
138
|
-
logDryRun: (message) => providerContext.logger.dryRun(message)
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
: providerContext;
|
|
143
|
-
await entry.test(activeContext);
|
|
144
|
-
}),
|
|
145
|
-
stopMessage: () => `${adapter.label} health check`
|
|
146
|
-
});
|
|
147
|
-
}
|
|
65
|
+
: providerContext;
|
|
66
|
+
await entry.test(activeContext);
|
|
67
|
+
}),
|
|
68
|
+
stopMessage: () => `${adapter.label} health check`
|
|
69
|
+
});
|
|
148
70
|
const dryMessage = canonicalService === "claude-code"
|
|
149
71
|
? `${adapter.label} test (dry run)`
|
|
150
72
|
: `Dry run: would test ${adapter.label}.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,aAAa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,CAAC,CAAC;IAEH,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16232,6 +16232,8 @@ var openCodeSpawnConfig = {
|
|
|
16232
16232
|
adapter: "opencode",
|
|
16233
16233
|
promptFlag: "run",
|
|
16234
16234
|
modelFlag: "--model",
|
|
16235
|
+
// TODO: remove once opencode accepts dotted model IDs (e.g. claude-opus-4.6)
|
|
16236
|
+
modelTransform: (model) => model === "claude-opus-4.6" ? "claude-opus-4-6" : model,
|
|
16235
16237
|
defaultArgs: ["--format", "json"],
|
|
16236
16238
|
modes: {
|
|
16237
16239
|
yolo: [],
|
|
@@ -16339,7 +16341,9 @@ function buildCliArgs(config2, options, stdinMode) {
|
|
|
16339
16341
|
...stdinMode.extraArgs
|
|
16340
16342
|
] : [config2.promptFlag, options.prompt];
|
|
16341
16343
|
if (options.model && config2.modelFlag) {
|
|
16342
|
-
|
|
16344
|
+
let model = stripModelNamespace2(options.model);
|
|
16345
|
+
if (config2.modelTransform) model = config2.modelTransform(model);
|
|
16346
|
+
args.push(config2.modelFlag, model);
|
|
16343
16347
|
}
|
|
16344
16348
|
args.push(...config2.defaultArgs);
|
|
16345
16349
|
args.push(...config2.modes[options.mode ?? "yolo"]);
|
|
@@ -16432,7 +16436,9 @@ async function spawnInteractive(agentId, options) {
|
|
|
16432
16436
|
}
|
|
16433
16437
|
}
|
|
16434
16438
|
if (options.model && spawnConfig.modelFlag) {
|
|
16435
|
-
|
|
16439
|
+
let model = stripModelNamespace2(options.model);
|
|
16440
|
+
if (spawnConfig.modelTransform) model = spawnConfig.modelTransform(model);
|
|
16441
|
+
args.push(spawnConfig.modelFlag, model);
|
|
16436
16442
|
}
|
|
16437
16443
|
args.push(...interactive.defaultArgs);
|
|
16438
16444
|
const mode = options.mode ?? "yolo";
|
|
@@ -17071,28 +17077,6 @@ ${stdout}
|
|
|
17071
17077
|
stderr:
|
|
17072
17078
|
${stderr}`;
|
|
17073
17079
|
}
|
|
17074
|
-
function stdoutMatchesExpected(stdout, expected) {
|
|
17075
|
-
const trimmed = stdout.trim();
|
|
17076
|
-
if (trimmed === expected) {
|
|
17077
|
-
return true;
|
|
17078
|
-
}
|
|
17079
|
-
const lines = stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
17080
|
-
if (lines.some((line) => line === expected)) {
|
|
17081
|
-
return true;
|
|
17082
|
-
}
|
|
17083
|
-
for (const line of lines) {
|
|
17084
|
-
if (line[0] !== "{") continue;
|
|
17085
|
-
try {
|
|
17086
|
-
const parsed = JSON.parse(line);
|
|
17087
|
-
if (parsed.type === "result" && parsed.result === expected) {
|
|
17088
|
-
return true;
|
|
17089
|
-
}
|
|
17090
|
-
} catch {
|
|
17091
|
-
continue;
|
|
17092
|
-
}
|
|
17093
|
-
}
|
|
17094
|
-
return false;
|
|
17095
|
-
}
|
|
17096
17080
|
function createSpawnHealthCheck(agentId, options) {
|
|
17097
17081
|
const prompt = `Output exactly: ${options.expectedOutput}`;
|
|
17098
17082
|
const { binaryName, args } = buildSpawnArgs(agentId, {
|
|
@@ -19220,7 +19204,7 @@ init_isolated_env();
|
|
|
19220
19204
|
function registerTestCommand(program, container) {
|
|
19221
19205
|
const serviceNames = container.registry.list().filter((service) => typeof service.test === "function").map((service) => service.name);
|
|
19222
19206
|
const serviceDescription = `Agent to test${formatServiceList(serviceNames)}`;
|
|
19223
|
-
return program.command("test").description("Run agent health checks.").
|
|
19207
|
+
return program.command("test").description("Run agent health checks.").argument(
|
|
19224
19208
|
"[agent]",
|
|
19225
19209
|
serviceDescription
|
|
19226
19210
|
).option("--isolated", "Run the health check using isolated configuration.").action(async function(service) {
|
|
@@ -19232,9 +19216,7 @@ function registerTestCommand(program, container) {
|
|
|
19232
19216
|
);
|
|
19233
19217
|
const opts = this.opts();
|
|
19234
19218
|
await executeTest(this, container, resolved, {
|
|
19235
|
-
isolated: Boolean(opts.isolated)
|
|
19236
|
-
stdin: Boolean(opts.stdin),
|
|
19237
|
-
model: opts.model
|
|
19219
|
+
isolated: Boolean(opts.isolated)
|
|
19238
19220
|
});
|
|
19239
19221
|
});
|
|
19240
19222
|
}
|
|
@@ -19253,9 +19235,6 @@ async function executeTest(program, container, service, options = {}) {
|
|
|
19253
19235
|
adapter,
|
|
19254
19236
|
resources
|
|
19255
19237
|
);
|
|
19256
|
-
if (options.model && !options.stdin) {
|
|
19257
|
-
throw new Error("The --model option requires --stdin.");
|
|
19258
|
-
}
|
|
19259
19238
|
const isolatedDetails = options.isolated && adapter.isolatedEnv ? await resolveIsolatedEnvDetails(
|
|
19260
19239
|
container.env,
|
|
19261
19240
|
adapter.isolatedEnv,
|
|
@@ -19271,109 +19250,31 @@ async function executeTest(program, container, service, options = {}) {
|
|
|
19271
19250
|
flags
|
|
19272
19251
|
});
|
|
19273
19252
|
}
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
|
|
19290
|
-
|
|
19291
|
-
|
|
19292
|
-
const streaming = spawnStreaming({
|
|
19293
|
-
agentId: canonicalService,
|
|
19294
|
-
prompt,
|
|
19295
|
-
useStdin: true,
|
|
19296
|
-
model: options.model
|
|
19253
|
+
await withSpinner({
|
|
19254
|
+
message: `Testing ${adapter.label}...`,
|
|
19255
|
+
fn: () => container.registry.invoke(canonicalService, "test", async (entry) => {
|
|
19256
|
+
if (!entry.test) {
|
|
19257
|
+
throw new Error(`Agent "${canonicalService}" does not support test.`);
|
|
19258
|
+
}
|
|
19259
|
+
const activeContext = isolatedDetails ? {
|
|
19260
|
+
...providerContext,
|
|
19261
|
+
runCheck: async (check2) => {
|
|
19262
|
+
await check2.run({
|
|
19263
|
+
isDryRun: providerContext.logger.context.dryRun,
|
|
19264
|
+
runCommand: (command, args) => resources.context.runCommand("poe-code", [
|
|
19265
|
+
"wrap",
|
|
19266
|
+
canonicalService,
|
|
19267
|
+
"--",
|
|
19268
|
+
...args
|
|
19269
|
+
]),
|
|
19270
|
+
logDryRun: (message) => providerContext.logger.dryRun(message)
|
|
19297
19271
|
});
|
|
19298
|
-
let output = "";
|
|
19299
|
-
for await (const event of streaming.events) {
|
|
19300
|
-
if (event.event === "agent_message") {
|
|
19301
|
-
output += event.text;
|
|
19302
|
-
}
|
|
19303
|
-
}
|
|
19304
|
-
const spawnResult = await streaming.done;
|
|
19305
|
-
return {
|
|
19306
|
-
stdout: output,
|
|
19307
|
-
stderr: spawnResult.stderr,
|
|
19308
|
-
exitCode: spawnResult.exitCode
|
|
19309
|
-
};
|
|
19310
19272
|
}
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
throw new Error(`Agent "${canonicalService}" does not support spawn.`);
|
|
19317
|
-
}
|
|
19318
|
-
const output = await entry.spawn(providerContext, {
|
|
19319
|
-
prompt,
|
|
19320
|
-
useStdin: true,
|
|
19321
|
-
model: options.model
|
|
19322
|
-
});
|
|
19323
|
-
return output;
|
|
19324
|
-
}
|
|
19325
|
-
);
|
|
19326
|
-
},
|
|
19327
|
-
stopMessage: () => `${adapter.label} stdin test`
|
|
19328
|
-
});
|
|
19329
|
-
if (!result) {
|
|
19330
|
-
throw new Error(
|
|
19331
|
-
`Stdin spawn test for ${adapter.label} did not return command output.`
|
|
19332
|
-
);
|
|
19333
|
-
}
|
|
19334
|
-
if (result.exitCode !== 0) {
|
|
19335
|
-
throw new Error(
|
|
19336
|
-
[
|
|
19337
|
-
`Stdin spawn test for ${adapter.label} failed with exit code ${result.exitCode}.`,
|
|
19338
|
-
formatCommandRunnerResult(result)
|
|
19339
|
-
].join("\n")
|
|
19340
|
-
);
|
|
19341
|
-
}
|
|
19342
|
-
if (!stdoutMatchesExpected(result.stdout, expectedOutput)) {
|
|
19343
|
-
throw new Error(
|
|
19344
|
-
[
|
|
19345
|
-
`Stdin spawn test for ${adapter.label} failed: expected "${expectedOutput}" but received "${result.stdout.trim()}".`,
|
|
19346
|
-
formatCommandRunnerResult(result)
|
|
19347
|
-
].join("\n")
|
|
19348
|
-
);
|
|
19349
|
-
}
|
|
19350
|
-
} else {
|
|
19351
|
-
await withSpinner({
|
|
19352
|
-
message: `Testing ${adapter.label}...`,
|
|
19353
|
-
fn: () => container.registry.invoke(canonicalService, "test", async (entry) => {
|
|
19354
|
-
if (!entry.test) {
|
|
19355
|
-
throw new Error(`Agent "${canonicalService}" does not support test.`);
|
|
19356
|
-
}
|
|
19357
|
-
const activeContext = isolatedDetails ? {
|
|
19358
|
-
...providerContext,
|
|
19359
|
-
runCheck: async (check2) => {
|
|
19360
|
-
await check2.run({
|
|
19361
|
-
isDryRun: providerContext.logger.context.dryRun,
|
|
19362
|
-
runCommand: (command, args) => resources.context.runCommand("poe-code", [
|
|
19363
|
-
"wrap",
|
|
19364
|
-
canonicalService,
|
|
19365
|
-
"--",
|
|
19366
|
-
...args
|
|
19367
|
-
]),
|
|
19368
|
-
logDryRun: (message) => providerContext.logger.dryRun(message)
|
|
19369
|
-
});
|
|
19370
|
-
}
|
|
19371
|
-
} : providerContext;
|
|
19372
|
-
await entry.test(activeContext);
|
|
19373
|
-
}),
|
|
19374
|
-
stopMessage: () => `${adapter.label} health check`
|
|
19375
|
-
});
|
|
19376
|
-
}
|
|
19273
|
+
} : providerContext;
|
|
19274
|
+
await entry.test(activeContext);
|
|
19275
|
+
}),
|
|
19276
|
+
stopMessage: () => `${adapter.label} health check`
|
|
19277
|
+
});
|
|
19377
19278
|
const dryMessage = canonicalService === "claude-code" ? `${adapter.label} test (dry run)` : `Dry run: would test ${adapter.label}.`;
|
|
19378
19279
|
resources.context.complete({
|
|
19379
19280
|
success: `Tested ${adapter.label}.`,
|
|
@@ -36380,7 +36281,7 @@ function registerModelsCommand(program, container) {
|
|
|
36380
36281
|
// package.json
|
|
36381
36282
|
var package_default = {
|
|
36382
36283
|
name: "poe-code",
|
|
36383
|
-
version: "3.0.
|
|
36284
|
+
version: "3.0.47",
|
|
36384
36285
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
36385
36286
|
type: "module",
|
|
36386
36287
|
workspaces: [
|