poe-code 3.0.225 → 3.0.226
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/agent.d.ts +352 -0
- package/dist/agent.js +16713 -0
- package/dist/agent.js.map +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +236 -215
- package/dist/index.js.map +4 -4
- package/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -659,12 +659,12 @@ var init_registry = __esm({
|
|
|
659
659
|
poeAgentAgent
|
|
660
660
|
];
|
|
661
661
|
lookup = /* @__PURE__ */ new Map();
|
|
662
|
-
for (const
|
|
663
|
-
const values = [
|
|
662
|
+
for (const agent3 of allAgents) {
|
|
663
|
+
const values = [agent3.id, agent3.name, ...agent3.aliases ?? []];
|
|
664
664
|
for (const value of values) {
|
|
665
665
|
const normalized = value.toLowerCase();
|
|
666
666
|
if (!lookup.has(normalized)) {
|
|
667
|
-
lookup.set(normalized,
|
|
667
|
+
lookup.set(normalized, agent3.id);
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
670
|
}
|
|
@@ -677,10 +677,10 @@ function parseAgentSpecifier(input) {
|
|
|
677
677
|
if (colonIndex === -1) {
|
|
678
678
|
return { agent: input.trim() };
|
|
679
679
|
}
|
|
680
|
-
const
|
|
680
|
+
const agent3 = input.slice(0, colonIndex).trim();
|
|
681
681
|
const model = input.slice(colonIndex + 1).trim();
|
|
682
682
|
return {
|
|
683
|
-
agent:
|
|
683
|
+
agent: agent3,
|
|
684
684
|
...model.length > 0 ? { model } : {}
|
|
685
685
|
};
|
|
686
686
|
}
|
|
@@ -692,9 +692,9 @@ function formatAgentSpecifier(specifier) {
|
|
|
692
692
|
}
|
|
693
693
|
function normalizeAgentId(input) {
|
|
694
694
|
const specifier = parseAgentSpecifier(input.trim());
|
|
695
|
-
const
|
|
695
|
+
const agent3 = resolveAgentId(specifier.agent) ?? specifier.agent;
|
|
696
696
|
return formatAgentSpecifier({
|
|
697
|
-
agent:
|
|
697
|
+
agent: agent3,
|
|
698
698
|
model: specifier.model
|
|
699
699
|
});
|
|
700
700
|
}
|
|
@@ -13635,11 +13635,11 @@ var init_api_key = __esm({
|
|
|
13635
13635
|
});
|
|
13636
13636
|
|
|
13637
13637
|
// packages/providers/src/compatibility.ts
|
|
13638
|
-
function resolveApiShape(provider2,
|
|
13639
|
-
if (!provider2.apiShapes || !
|
|
13638
|
+
function resolveApiShape(provider2, agent3) {
|
|
13639
|
+
if (!provider2.apiShapes || !agent3.apiShapes) {
|
|
13640
13640
|
return void 0;
|
|
13641
13641
|
}
|
|
13642
|
-
for (const shapeId of
|
|
13642
|
+
for (const shapeId of agent3.apiShapes) {
|
|
13643
13643
|
if (provider2.apiShapes.some((shape) => shape.id === shapeId)) {
|
|
13644
13644
|
return shapeId;
|
|
13645
13645
|
}
|
|
@@ -13690,9 +13690,9 @@ var init_registry2 = __esm({
|
|
|
13690
13690
|
get(id) {
|
|
13691
13691
|
return this.byId.get(id);
|
|
13692
13692
|
}
|
|
13693
|
-
forAgent(
|
|
13693
|
+
forAgent(agent3) {
|
|
13694
13694
|
return this.providers.filter((provider2) => {
|
|
13695
|
-
return resolveApiShape(provider2,
|
|
13695
|
+
return resolveApiShape(provider2, agent3) !== void 0;
|
|
13696
13696
|
});
|
|
13697
13697
|
}
|
|
13698
13698
|
async isLoggedIn(id) {
|
|
@@ -13983,8 +13983,8 @@ async function migrateConfiguredServicesIfNeeded(options, filePath) {
|
|
|
13983
13983
|
}
|
|
13984
13984
|
function deriveApiShape(input) {
|
|
13985
13985
|
const provider2 = input.registry.get(input.provider);
|
|
13986
|
-
const
|
|
13987
|
-
const apiShape = provider2 &&
|
|
13986
|
+
const agent3 = resolveConfiguredAgent(input.service);
|
|
13987
|
+
const apiShape = provider2 && agent3 ? resolveApiShape(provider2, agent3) : void 0;
|
|
13988
13988
|
if (!apiShape) {
|
|
13989
13989
|
input.warn(
|
|
13990
13990
|
`Unable to derive apiShape for configured service "${input.service}" with provider "${input.provider}".`
|
|
@@ -14103,7 +14103,7 @@ var init_configured_services = __esm({
|
|
|
14103
14103
|
init_src5();
|
|
14104
14104
|
init_src6();
|
|
14105
14105
|
init_store2();
|
|
14106
|
-
agentsById = new Map(allAgents.map((
|
|
14106
|
+
agentsById = new Map(allAgents.map((agent3) => [agent3.id, agent3]));
|
|
14107
14107
|
defaultProviderRegistry = new ProviderRegistry([
|
|
14108
14108
|
poeProvider,
|
|
14109
14109
|
anthropicProvider,
|
|
@@ -19423,11 +19423,11 @@ var init_participant = __esm({
|
|
|
19423
19423
|
});
|
|
19424
19424
|
|
|
19425
19425
|
// packages/agent-harness-tools/src/select-agent.ts
|
|
19426
|
-
function resolveSelectedAgent(
|
|
19427
|
-
const specifier = parseAgentSpecifier(
|
|
19426
|
+
function resolveSelectedAgent(agent3) {
|
|
19427
|
+
const specifier = parseAgentSpecifier(agent3);
|
|
19428
19428
|
const resolvedAgentId = resolveAgentId(specifier.agent);
|
|
19429
|
-
if (!resolvedAgentId || !loopAgents.some((
|
|
19430
|
-
throw new Error(`Unsupported agent "${
|
|
19429
|
+
if (!resolvedAgentId || !loopAgents.some((agent4) => agent4.id === resolvedAgentId)) {
|
|
19430
|
+
throw new Error(`Unsupported agent "${agent3}". Supported agents: ${supportedAgents}`);
|
|
19431
19431
|
}
|
|
19432
19432
|
return {
|
|
19433
19433
|
agent: specifier.model ? `${resolvedAgentId}:${specifier.model}` : resolvedAgentId
|
|
@@ -19451,10 +19451,10 @@ async function resolveLoopAgent(input) {
|
|
|
19451
19451
|
}
|
|
19452
19452
|
const selectedAgent = await input.select({
|
|
19453
19453
|
message: input.message,
|
|
19454
|
-
options: loopAgents.map((
|
|
19455
|
-
value:
|
|
19456
|
-
label:
|
|
19457
|
-
hint:
|
|
19454
|
+
options: loopAgents.map((agent3) => ({
|
|
19455
|
+
value: agent3.id,
|
|
19456
|
+
label: agent3.label,
|
|
19457
|
+
hint: agent3.summary
|
|
19458
19458
|
}))
|
|
19459
19459
|
});
|
|
19460
19460
|
if (input.isCancel(selectedAgent)) {
|
|
@@ -19468,9 +19468,9 @@ var init_select_agent = __esm({
|
|
|
19468
19468
|
"use strict";
|
|
19469
19469
|
init_src2();
|
|
19470
19470
|
loopAgents = allAgents.filter(
|
|
19471
|
-
(
|
|
19471
|
+
(agent3) => agent3.binaryName !== void 0 || agent3.id === "poe-agent"
|
|
19472
19472
|
);
|
|
19473
|
-
supportedAgents = loopAgents.map((
|
|
19473
|
+
supportedAgents = loopAgents.map((agent3) => agent3.id).join(", ");
|
|
19474
19474
|
}
|
|
19475
19475
|
});
|
|
19476
19476
|
|
|
@@ -20274,8 +20274,8 @@ async function configureE2bSpawnAgentIfAvailable(opts) {
|
|
|
20274
20274
|
return;
|
|
20275
20275
|
}
|
|
20276
20276
|
const agentId = resolveAgentId(opts.openSpec.jobLabel.tool);
|
|
20277
|
-
const
|
|
20278
|
-
const binaryName =
|
|
20277
|
+
const agent3 = allAgents.find((candidate) => candidate.id === agentId);
|
|
20278
|
+
const binaryName = agent3?.binaryName;
|
|
20279
20279
|
if (!agentId || !binaryName) {
|
|
20280
20280
|
return;
|
|
20281
20281
|
}
|
|
@@ -22230,7 +22230,7 @@ function resolveConfig(agentId) {
|
|
|
22230
22230
|
if (!resolvedAgentId) {
|
|
22231
22231
|
throw new Error(`Unknown agent "${agentId}".`);
|
|
22232
22232
|
}
|
|
22233
|
-
const agentDefinition = allAgents.find((
|
|
22233
|
+
const agentDefinition = allAgents.find((agent3) => agent3.id === resolvedAgentId);
|
|
22234
22234
|
if (!agentDefinition) {
|
|
22235
22235
|
throw new Error(`Unknown agent "${agentId}".`);
|
|
22236
22236
|
}
|
|
@@ -27453,9 +27453,9 @@ function formatTimestamp(date) {
|
|
|
27453
27453
|
const milliseconds = pad2(date.getUTCMilliseconds(), 3);
|
|
27454
27454
|
return { day, time, milliseconds };
|
|
27455
27455
|
}
|
|
27456
|
-
function normalizeAgent(
|
|
27456
|
+
function normalizeAgent(agent3) {
|
|
27457
27457
|
let normalized = "";
|
|
27458
|
-
for (const char of
|
|
27458
|
+
for (const char of agent3) {
|
|
27459
27459
|
const code = char.charCodeAt(0);
|
|
27460
27460
|
const isLower = code >= 97 && code <= 122;
|
|
27461
27461
|
const isUpper = code >= 65 && code <= 90;
|
|
@@ -38860,9 +38860,9 @@ async function withInjectedAgentRunner(options, operation) {
|
|
|
38860
38860
|
if (!options.runAgent) {
|
|
38861
38861
|
return operation();
|
|
38862
38862
|
}
|
|
38863
|
-
return withAutonomousAgentRunner(async (
|
|
38863
|
+
return withAutonomousAgentRunner(async (agent3, input) => {
|
|
38864
38864
|
const result = await options.runAgent?.({
|
|
38865
|
-
agent:
|
|
38865
|
+
agent: agent3,
|
|
38866
38866
|
prompt: input.prompt,
|
|
38867
38867
|
cwd: input.cwd ?? process.cwd(),
|
|
38868
38868
|
...input.mode ? { mode: input.mode } : {},
|
|
@@ -38871,11 +38871,11 @@ async function withInjectedAgentRunner(options, operation) {
|
|
|
38871
38871
|
...options.signal ? { signal: options.signal } : {}
|
|
38872
38872
|
});
|
|
38873
38873
|
if (!result) {
|
|
38874
|
-
throw new Error(`Agent \`${
|
|
38874
|
+
throw new Error(`Agent \`${agent3}\` returned no result.`);
|
|
38875
38875
|
}
|
|
38876
38876
|
if (result.exitCode !== 0) {
|
|
38877
38877
|
throw new Error(
|
|
38878
|
-
result.stderr || result.stdout || `Agent \`${
|
|
38878
|
+
result.stderr || result.stdout || `Agent \`${agent3}\` failed with exit code ${result.exitCode}`
|
|
38879
38879
|
);
|
|
38880
38880
|
}
|
|
38881
38881
|
return result;
|
|
@@ -41294,7 +41294,7 @@ function makeExperimentIterationState(client, experimentName) {
|
|
|
41294
41294
|
const rows = /* @__PURE__ */ new Map();
|
|
41295
41295
|
let latestBaseline;
|
|
41296
41296
|
return {
|
|
41297
|
-
async start(index,
|
|
41297
|
+
async start(index, agent3) {
|
|
41298
41298
|
try {
|
|
41299
41299
|
const experiment = asSpanParent(await client.getExperiment(experimentName));
|
|
41300
41300
|
rows.set(index, {
|
|
@@ -41302,7 +41302,7 @@ function makeExperimentIterationState(client, experimentName) {
|
|
|
41302
41302
|
name: `iteration:${index}`,
|
|
41303
41303
|
type: "task"
|
|
41304
41304
|
}),
|
|
41305
|
-
agent:
|
|
41305
|
+
agent: agent3,
|
|
41306
41306
|
iteration: index,
|
|
41307
41307
|
baseline: latestBaseline,
|
|
41308
41308
|
metrics: {}
|
|
@@ -41559,8 +41559,8 @@ var init_row_builder = __esm({
|
|
|
41559
41559
|
function createExperimentCallbacks(client, experimentName) {
|
|
41560
41560
|
const state = makeExperimentIterationState(client, experimentName);
|
|
41561
41561
|
return {
|
|
41562
|
-
onExperimentStart(index,
|
|
41563
|
-
void state.start(index,
|
|
41562
|
+
onExperimentStart(index, agent3) {
|
|
41563
|
+
void state.start(index, agent3);
|
|
41564
41564
|
},
|
|
41565
41565
|
onBaselineCollected(baseline) {
|
|
41566
41566
|
state.baseline(baseline);
|
|
@@ -42408,7 +42408,7 @@ function normalizeAgentSelection(value) {
|
|
|
42408
42408
|
function createAgentRunner(options) {
|
|
42409
42409
|
return async (input) => {
|
|
42410
42410
|
const activeStage = options.activeStage();
|
|
42411
|
-
const
|
|
42411
|
+
const agent3 = activeStage === "builder" ? options.selectedBuilderAgent : input.agent;
|
|
42412
42412
|
const executeAgent = options.executeAgent ?? ((nextAgent, nextInput) => executeSpawnAgent(nextAgent, nextInput, options.integrations));
|
|
42413
42413
|
const stageLabel = formatStageLabel(activeStage);
|
|
42414
42414
|
const emitLine = (kind, line) => {
|
|
@@ -42431,7 +42431,7 @@ function createAgentRunner(options) {
|
|
|
42431
42431
|
const onStdout = (chunk) => stdoutBuffer.push(chunk);
|
|
42432
42432
|
const onStderr = (chunk) => stderrBuffer.push(chunk);
|
|
42433
42433
|
try {
|
|
42434
|
-
const result = await executeAgent(
|
|
42434
|
+
const result = await executeAgent(agent3, {
|
|
42435
42435
|
...input,
|
|
42436
42436
|
...options.runtime,
|
|
42437
42437
|
onStdout,
|
|
@@ -42480,18 +42480,18 @@ function formatStageLabel(stage) {
|
|
|
42480
42480
|
}
|
|
42481
42481
|
return `inspector:${stage.inspector}`;
|
|
42482
42482
|
}
|
|
42483
|
-
async function executeSpawnAgent(
|
|
42484
|
-
if (parseAgentSpecifier(
|
|
42485
|
-
return executePoeAgent(
|
|
42483
|
+
async function executeSpawnAgent(agent3, input, integrations) {
|
|
42484
|
+
if (parseAgentSpecifier(agent3).agent === "poe-agent") {
|
|
42485
|
+
return executePoeAgent(agent3, input);
|
|
42486
42486
|
}
|
|
42487
|
-
if ((input.onStdout || input.onStderr) && supportsStreaming(
|
|
42488
|
-
return executeSpawnAgentStreaming(
|
|
42487
|
+
if ((input.onStdout || input.onStderr) && supportsStreaming(agent3)) {
|
|
42488
|
+
return executeSpawnAgentStreaming(agent3, input, integrations);
|
|
42489
42489
|
}
|
|
42490
42490
|
const tee = input.onStdout || input.onStderr ? {
|
|
42491
42491
|
...input.onStdout ? { stdout: { write: input.onStdout } } : {},
|
|
42492
42492
|
...input.onStderr ? { stderr: { write: input.onStderr } } : {}
|
|
42493
42493
|
} : void 0;
|
|
42494
|
-
const result = await spawn5(
|
|
42494
|
+
const result = await spawn5(agent3, {
|
|
42495
42495
|
prompt: input.prompt,
|
|
42496
42496
|
cwd: input.cwd,
|
|
42497
42497
|
useStdin: true,
|
|
@@ -42515,17 +42515,17 @@ async function executeSpawnAgent(agent2, input, integrations) {
|
|
|
42515
42515
|
...result.usage ? { usage: result.usage } : {}
|
|
42516
42516
|
};
|
|
42517
42517
|
}
|
|
42518
|
-
function supportsStreaming(
|
|
42519
|
-
const config = getSpawnConfig(
|
|
42518
|
+
function supportsStreaming(agent3) {
|
|
42519
|
+
const config = getSpawnConfig(agent3);
|
|
42520
42520
|
return config?.kind === "cli";
|
|
42521
42521
|
}
|
|
42522
|
-
async function executeSpawnAgentStreaming(
|
|
42522
|
+
async function executeSpawnAgentStreaming(agent3, input, integrations) {
|
|
42523
42523
|
const writer = (line) => {
|
|
42524
42524
|
input.onStdout?.(`${line}
|
|
42525
42525
|
`);
|
|
42526
42526
|
};
|
|
42527
42527
|
const { events: rawEvents, done } = spawnStreaming({
|
|
42528
|
-
agentId:
|
|
42528
|
+
agentId: agent3,
|
|
42529
42529
|
prompt: input.prompt,
|
|
42530
42530
|
cwd: input.cwd,
|
|
42531
42531
|
useStdin: true,
|
|
@@ -42542,7 +42542,7 @@ async function executeSpawnAgentStreaming(agent2, input, integrations) {
|
|
|
42542
42542
|
});
|
|
42543
42543
|
const middlewareContext = {
|
|
42544
42544
|
sessionId: "unknown",
|
|
42545
|
-
agent:
|
|
42545
|
+
agent: agent3,
|
|
42546
42546
|
events: [],
|
|
42547
42547
|
usage: { inputTokens: 0, outputTokens: 0 },
|
|
42548
42548
|
eventStream: rawEvents,
|
|
@@ -43414,9 +43414,9 @@ async function resolveActiveProviderForService(container, serviceName) {
|
|
|
43414
43414
|
filePath: container.env.configPath,
|
|
43415
43415
|
projectFilePath: container.env.projectConfigPath
|
|
43416
43416
|
});
|
|
43417
|
-
const
|
|
43417
|
+
const agent3 = resolveAgentDefinition(serviceName) ?? { id: serviceName };
|
|
43418
43418
|
const configuredProviderId = configuredServices[serviceName]?.provider;
|
|
43419
|
-
const provider2 = configuredProviderId ? container.providerRegistry.get(configuredProviderId) : await resolveSingleProviderCandidate(container,
|
|
43419
|
+
const provider2 = configuredProviderId ? container.providerRegistry.get(configuredProviderId) : await resolveSingleProviderCandidate(container, agent3);
|
|
43420
43420
|
if (!provider2 || provider2.auth.kind !== "api-key") {
|
|
43421
43421
|
return void 0;
|
|
43422
43422
|
}
|
|
@@ -43431,12 +43431,12 @@ async function resolveActiveProviderForService(container, serviceName) {
|
|
|
43431
43431
|
return buildActiveProvider({
|
|
43432
43432
|
container,
|
|
43433
43433
|
provider: provider2,
|
|
43434
|
-
agent:
|
|
43434
|
+
agent: agent3,
|
|
43435
43435
|
credential
|
|
43436
43436
|
});
|
|
43437
43437
|
}
|
|
43438
|
-
async function resolveSingleProviderCandidate(container,
|
|
43439
|
-
const candidates = container.providerRegistry.forAgent(
|
|
43438
|
+
async function resolveSingleProviderCandidate(container, agent3) {
|
|
43439
|
+
const candidates = container.providerRegistry.forAgent(agent3);
|
|
43440
43440
|
if (candidates.length === 1) {
|
|
43441
43441
|
return candidates[0];
|
|
43442
43442
|
}
|
|
@@ -43461,8 +43461,8 @@ async function resolveStoredShapeBaseUrl(container, providerId, apiShape) {
|
|
|
43461
43461
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
43462
43462
|
}
|
|
43463
43463
|
function resolveAgentDefinition(serviceName) {
|
|
43464
|
-
const { agent:
|
|
43465
|
-
const resolvedId = resolveAgentId(
|
|
43464
|
+
const { agent: agent3 } = parseAgentSpecifier(serviceName);
|
|
43465
|
+
const resolvedId = resolveAgentId(agent3) ?? agent3;
|
|
43466
43466
|
return allAgents.find((candidate) => candidate.id === resolvedId);
|
|
43467
43467
|
}
|
|
43468
43468
|
function resolveCommandFlags(program) {
|
|
@@ -43569,7 +43569,7 @@ function buildResumeCommand(canonicalService, threadId, cwd) {
|
|
|
43569
43569
|
return void 0;
|
|
43570
43570
|
}
|
|
43571
43571
|
const resolvedId = resolveAgentId(canonicalService) ?? canonicalService;
|
|
43572
|
-
const agentDefinition = allAgents.find((
|
|
43572
|
+
const agentDefinition = allAgents.find((agent3) => agent3.id === resolvedId);
|
|
43573
43573
|
const binaryName = agentDefinition?.binaryName;
|
|
43574
43574
|
if (!binaryName) {
|
|
43575
43575
|
return void 0;
|
|
@@ -43618,8 +43618,8 @@ async function resolveDefaultAgent(container) {
|
|
|
43618
43618
|
}
|
|
43619
43619
|
const specifier = parseAgentSpecifier(trimmed);
|
|
43620
43620
|
const resolvedAgent = resolveAgentId(specifier.agent);
|
|
43621
|
-
if (!resolvedAgent || !allAgents.some((
|
|
43622
|
-
const supportedAgents4 = allAgents.map((
|
|
43621
|
+
if (!resolvedAgent || !allAgents.some((agent3) => agent3.id === resolvedAgent)) {
|
|
43622
|
+
const supportedAgents4 = allAgents.map((agent3) => agent3.id).join(", ");
|
|
43623
43623
|
throw new ValidationError(
|
|
43624
43624
|
`Invalid value for core.defaultAgent: "${value}". Supported agents: ${supportedAgents4}`
|
|
43625
43625
|
);
|
|
@@ -44132,8 +44132,8 @@ async function resolveConfiguredModel(container, service, model) {
|
|
|
44132
44132
|
if (model != null) {
|
|
44133
44133
|
return model;
|
|
44134
44134
|
}
|
|
44135
|
-
const { agent:
|
|
44136
|
-
const agentId = container.registry.get(service)?.name ?? resolveAgentId(
|
|
44135
|
+
const { agent: agent3 } = parseAgentSpecifier(service);
|
|
44136
|
+
const agentId = container.registry.get(service)?.name ?? resolveAgentId(agent3) ?? agent3;
|
|
44137
44137
|
const configuredModel = await resolveModel(
|
|
44138
44138
|
{
|
|
44139
44139
|
fs: container.fs,
|
|
@@ -44347,8 +44347,8 @@ function createServiceRegistry() {
|
|
|
44347
44347
|
if (direct) {
|
|
44348
44348
|
return direct;
|
|
44349
44349
|
}
|
|
44350
|
-
const { agent:
|
|
44351
|
-
const resolvedAgent = resolveAgentId(
|
|
44350
|
+
const { agent: agent3 } = parseAgentSpecifier(name);
|
|
44351
|
+
const resolvedAgent = resolveAgentId(agent3);
|
|
44352
44352
|
if (!resolvedAgent) {
|
|
44353
44353
|
return void 0;
|
|
44354
44354
|
}
|
|
@@ -45454,7 +45454,7 @@ async function createConfigurePayload(init) {
|
|
|
45454
45454
|
throw new Error(`Unknown provider "${providerId}".`);
|
|
45455
45455
|
}
|
|
45456
45456
|
const explicitShapeBaseUrls = parseProviderShapeBaseUrls(provider2, options.shapeBaseUrl ?? []);
|
|
45457
|
-
const
|
|
45457
|
+
const agent3 = resolveAgentDefinition(adapter.name) ?? { id: adapter.name };
|
|
45458
45458
|
const apiKey = providerId === POE_PROVIDER_ID ? await container.options.resolveApiKey({
|
|
45459
45459
|
value: options.apiKey,
|
|
45460
45460
|
envValue: provider2.auth.kind === "api-key" ? container.env.getVariable(provider2.auth.envVar) : void 0,
|
|
@@ -45471,7 +45471,7 @@ async function createConfigurePayload(init) {
|
|
|
45471
45471
|
activeProvider = await buildActiveProvider({
|
|
45472
45472
|
container,
|
|
45473
45473
|
provider: provider2,
|
|
45474
|
-
agent:
|
|
45474
|
+
agent: agent3,
|
|
45475
45475
|
credential: apiKey,
|
|
45476
45476
|
explicitBaseUrl,
|
|
45477
45477
|
explicitShapeBaseUrls
|
|
@@ -45765,11 +45765,11 @@ async function resolveIsolatedServiceProvider(container, serviceName) {
|
|
|
45765
45765
|
if (metadata?.provider) {
|
|
45766
45766
|
return metadata.provider;
|
|
45767
45767
|
}
|
|
45768
|
-
const
|
|
45769
|
-
if (!
|
|
45768
|
+
const agent3 = resolveAgentDefinition(serviceName);
|
|
45769
|
+
if (!agent3) {
|
|
45770
45770
|
return void 0;
|
|
45771
45771
|
}
|
|
45772
|
-
const providers = container.providerRegistry.forAgent(
|
|
45772
|
+
const providers = container.providerRegistry.forAgent(agent3);
|
|
45773
45773
|
const loggedIn = [];
|
|
45774
45774
|
for (const provider2 of providers) {
|
|
45775
45775
|
if (await isProviderAvailable(container, provider2.id)) {
|
|
@@ -46696,14 +46696,14 @@ function mergeStepDefinition(base, override, context) {
|
|
|
46696
46696
|
if (typeof prompt !== "string" || prompt.length === 0) {
|
|
46697
46697
|
throw new Error(`Missing prompt for ${context}.`);
|
|
46698
46698
|
}
|
|
46699
|
-
const
|
|
46699
|
+
const agent3 = override.agent ?? base?.agent;
|
|
46700
46700
|
const model = override.model ?? base?.model;
|
|
46701
46701
|
const skills2 = override.skills ?? base?.skills;
|
|
46702
46702
|
const hooks = override.hooks ?? base?.hooks;
|
|
46703
46703
|
return {
|
|
46704
46704
|
mode: override.mode ?? base?.mode ?? "yolo",
|
|
46705
46705
|
prompt,
|
|
46706
|
-
...
|
|
46706
|
+
...agent3 ? { agent: agent3 } : {},
|
|
46707
46707
|
...model ? { model } : {},
|
|
46708
46708
|
...skills2 ? { skills: skills2 } : {},
|
|
46709
46709
|
...hooks ? { hooks } : {}
|
|
@@ -47994,13 +47994,13 @@ async function runPipeline(options) {
|
|
|
47994
47994
|
const mode = resolveMode3(selection.stepName, stepsConfig.steps);
|
|
47995
47995
|
const taskStartTime = Date.now();
|
|
47996
47996
|
const stepDef = selection.stepName ? stepsConfig.steps[selection.stepName] : void 0;
|
|
47997
|
-
const
|
|
47997
|
+
const agent3 = stepDef?.agent ?? options.agent;
|
|
47998
47998
|
const model = stepDef?.model ?? options.model;
|
|
47999
47999
|
let result;
|
|
48000
48000
|
try {
|
|
48001
48001
|
const role = selection.stepName ? `${selection.task.id}-${selection.stepName}` : selection.task.id;
|
|
48002
48002
|
result = await runAgent2({
|
|
48003
|
-
agent:
|
|
48003
|
+
agent: agent3,
|
|
48004
48004
|
prompt,
|
|
48005
48005
|
mode,
|
|
48006
48006
|
cwd: options.cwd,
|
|
@@ -48143,13 +48143,13 @@ function parseExperimentFrontmatter(content) {
|
|
|
48143
48143
|
}
|
|
48144
48144
|
function parseExperimentFrontmatterData(value) {
|
|
48145
48145
|
const parsed = isRecord21(value) ? value : void 0;
|
|
48146
|
-
const
|
|
48146
|
+
const agent3 = parseAgent(parsed?.agent);
|
|
48147
48147
|
const extendsValue = parseBoolean(parsed?.extends);
|
|
48148
48148
|
const metric = parseMetric(parsed?.metric);
|
|
48149
48149
|
const max_experiments = parseNonNegativeInteger(parsed?.max_experiments);
|
|
48150
48150
|
const metric_timeout = parseNonNegativeInteger(parsed?.metric_timeout);
|
|
48151
48151
|
return {
|
|
48152
|
-
...
|
|
48152
|
+
...agent3 !== void 0 ? { agent: agent3 } : {},
|
|
48153
48153
|
...extendsValue !== void 0 ? { extends: extendsValue } : {},
|
|
48154
48154
|
...metric !== void 0 ? { metric } : {},
|
|
48155
48155
|
baseline: parseBaseline(parsed?.baseline),
|
|
@@ -48657,11 +48657,11 @@ function normalizeMetrics(metric) {
|
|
|
48657
48657
|
}
|
|
48658
48658
|
return Array.isArray(metric) ? metric : [metric];
|
|
48659
48659
|
}
|
|
48660
|
-
function normalizeAgents(
|
|
48661
|
-
if (!
|
|
48660
|
+
function normalizeAgents(agent3) {
|
|
48661
|
+
if (!agent3) {
|
|
48662
48662
|
throw new Error("Experiment doc is missing agent frontmatter.");
|
|
48663
48663
|
}
|
|
48664
|
-
const raw = typeof
|
|
48664
|
+
const raw = typeof agent3 === "string" ? [agent3] : agent3;
|
|
48665
48665
|
if (raw.length === 0) {
|
|
48666
48666
|
throw new Error("agent must contain at least one entry.");
|
|
48667
48667
|
}
|
|
@@ -49033,13 +49033,13 @@ function parseFrontmatterData(value) {
|
|
|
49033
49033
|
const parsedStatus = isRecord23(parsed?.status) ? parsed.status : void 0;
|
|
49034
49034
|
const state = parsePlanStatus(parsedStatus?.state) ?? parseLegacyStatus(parsed?.status) ?? defaults.status.state;
|
|
49035
49035
|
const iteration = parseNonNegativeInteger2(parsedStatus?.iteration) ?? parseNonNegativeInteger2(parsed?.iteration) ?? defaults.status.iteration;
|
|
49036
|
-
const
|
|
49036
|
+
const agent3 = parseAgent2(parsed?.agent);
|
|
49037
49037
|
const extendsValue = parseBoolean2(parsed?.extends);
|
|
49038
49038
|
const iterations = parsePositiveInteger(parsed?.iterations);
|
|
49039
49039
|
const skills2 = parseSkills4(parsed?.skills);
|
|
49040
49040
|
const hooks = parseHooks4(parsed?.hooks);
|
|
49041
49041
|
return {
|
|
49042
|
-
...
|
|
49042
|
+
...agent3 !== void 0 ? { agent: agent3 } : {},
|
|
49043
49043
|
...extendsValue !== void 0 ? { extends: extendsValue } : {},
|
|
49044
49044
|
...iterations !== void 0 ? { iterations } : {},
|
|
49045
49045
|
...skills2 !== void 0 ? { skills: skills2 } : {},
|
|
@@ -49432,7 +49432,7 @@ async function resolveDocumentConfig(options, fs25, absoluteDocPath) {
|
|
|
49432
49432
|
return resolveDocumentConfigFromContent(options, fs25, absoluteDocPath, rawContent);
|
|
49433
49433
|
}
|
|
49434
49434
|
function createWorkflowFrontmatter(agents, maxIterations2, prompt, skills2, hooks) {
|
|
49435
|
-
const workflowAgents = agents.map((
|
|
49435
|
+
const workflowAgents = agents.map((agent3) => formatAgentSpecifier(agent3));
|
|
49436
49436
|
return {
|
|
49437
49437
|
participants: {
|
|
49438
49438
|
default: {
|
|
@@ -49482,11 +49482,11 @@ function createDefaultFs10() {
|
|
|
49482
49482
|
};
|
|
49483
49483
|
return fs25;
|
|
49484
49484
|
}
|
|
49485
|
-
function normalizeAgents2(
|
|
49486
|
-
if (
|
|
49485
|
+
function normalizeAgents2(agent3) {
|
|
49486
|
+
if (agent3 === void 0) {
|
|
49487
49487
|
throw new Error("Ralph doc is missing agent frontmatter.");
|
|
49488
49488
|
}
|
|
49489
|
-
const raw = typeof
|
|
49489
|
+
const raw = typeof agent3 === "string" ? [agent3] : agent3;
|
|
49490
49490
|
if (raw.length === 0) {
|
|
49491
49491
|
throw new Error("agent must contain at least one entry.");
|
|
49492
49492
|
}
|
|
@@ -54549,11 +54549,11 @@ function registerPlanCommand(program, container) {
|
|
|
54549
54549
|
const flags = resolveCommandFlags(program);
|
|
54550
54550
|
const kind = resolveKind(opts.kind);
|
|
54551
54551
|
const question = questionArg?.trim() ?? "";
|
|
54552
|
-
const
|
|
54552
|
+
const agent3 = resolvePlanSessionAgent(opts.agent);
|
|
54553
54553
|
if (question.length > 0) {
|
|
54554
54554
|
await runPlanSession({
|
|
54555
54555
|
container,
|
|
54556
|
-
agent:
|
|
54556
|
+
agent: agent3,
|
|
54557
54557
|
question
|
|
54558
54558
|
});
|
|
54559
54559
|
return;
|
|
@@ -54568,7 +54568,7 @@ function registerPlanCommand(program, container) {
|
|
|
54568
54568
|
createPlanBrowserOptions(container, {
|
|
54569
54569
|
kind,
|
|
54570
54570
|
assumeYes: false,
|
|
54571
|
-
onCreatePlan: () => runPlanSessionWithPrompt(container,
|
|
54571
|
+
onCreatePlan: () => runPlanSessionWithPrompt(container, agent3, false)
|
|
54572
54572
|
})
|
|
54573
54573
|
);
|
|
54574
54574
|
});
|
|
@@ -54709,13 +54709,13 @@ function registerPlanCommand(program, container) {
|
|
|
54709
54709
|
}
|
|
54710
54710
|
const resources = createExecutionResources(container, flags, "plan:install");
|
|
54711
54711
|
try {
|
|
54712
|
-
const
|
|
54713
|
-
if (
|
|
54712
|
+
const agent3 = await resolvePlanAgent(container, options.agent, flags.assumeYes);
|
|
54713
|
+
if (agent3 === null) {
|
|
54714
54714
|
return;
|
|
54715
54715
|
}
|
|
54716
|
-
const support = resolveAgentSupport(
|
|
54716
|
+
const support = resolveAgentSupport(agent3);
|
|
54717
54717
|
if (support.status !== "supported" || !support.id) {
|
|
54718
|
-
throw new ValidationError(`Unsupported agent: ${
|
|
54718
|
+
throw new ValidationError(`Unsupported agent: ${agent3}`);
|
|
54719
54719
|
}
|
|
54720
54720
|
const scope = await resolvePlanScope(options, flags.assumeYes);
|
|
54721
54721
|
if (scope === null) {
|
|
@@ -54777,14 +54777,14 @@ function resolvePlanSessionAgent(value) {
|
|
|
54777
54777
|
const trimmed = value?.trim() ?? "";
|
|
54778
54778
|
return trimmed.length > 0 ? trimmed : DEFAULT_PLAN_AGENT;
|
|
54779
54779
|
}
|
|
54780
|
-
async function runPlanSessionWithPrompt(container,
|
|
54780
|
+
async function runPlanSessionWithPrompt(container, agent3, assumeYes) {
|
|
54781
54781
|
const question = await resolvePlanQuestion(void 0, assumeYes);
|
|
54782
54782
|
if (question === null) {
|
|
54783
54783
|
return;
|
|
54784
54784
|
}
|
|
54785
54785
|
await runPlanSession({
|
|
54786
54786
|
container,
|
|
54787
|
-
agent:
|
|
54787
|
+
agent: agent3,
|
|
54788
54788
|
question
|
|
54789
54789
|
});
|
|
54790
54790
|
}
|
|
@@ -55474,7 +55474,7 @@ function resolveConfig2(raw, cwd) {
|
|
|
55474
55474
|
const { states, stateOrder } = parseStates(rawConfig.states);
|
|
55475
55475
|
const polling = scoped.polling;
|
|
55476
55476
|
const workspace = scoped.workspace;
|
|
55477
|
-
const
|
|
55477
|
+
const agent3 = scoped.agent;
|
|
55478
55478
|
return {
|
|
55479
55479
|
tasks: resolveTasks(rawConfig.tasks, cwd),
|
|
55480
55480
|
states,
|
|
@@ -55491,11 +55491,11 @@ function resolveConfig2(raw, cwd) {
|
|
|
55491
55491
|
)
|
|
55492
55492
|
},
|
|
55493
55493
|
agent: {
|
|
55494
|
-
service: readString8(
|
|
55495
|
-
list: readString8(resolveStringValue(
|
|
55496
|
-
maxConcurrentAgents: readNumber3(
|
|
55497
|
-
maxTurns: readNumber3(
|
|
55498
|
-
maxRetryBackoffMs: readNumber3(
|
|
55494
|
+
service: readString8(agent3.service) ?? "codex",
|
|
55495
|
+
list: readString8(resolveStringValue(agent3.list)),
|
|
55496
|
+
maxConcurrentAgents: readNumber3(agent3.max_concurrent_agents, 1),
|
|
55497
|
+
maxTurns: readNumber3(agent3.max_turns, 20),
|
|
55498
|
+
maxRetryBackoffMs: readNumber3(agent3.max_retry_backoff_ms, 3e5)
|
|
55499
55499
|
}
|
|
55500
55500
|
};
|
|
55501
55501
|
}
|
|
@@ -59288,14 +59288,14 @@ function readPrompt(value, fileName) {
|
|
|
59288
59288
|
function readAutomationFields(frontmatter, fileName) {
|
|
59289
59289
|
const label = readOptionalString3(frontmatter.label, "label", fileName);
|
|
59290
59290
|
const source = readOptionalString3(frontmatter.source, "source", fileName);
|
|
59291
|
-
const
|
|
59291
|
+
const agent3 = readOptionalString3(frontmatter.agent, "agent", fileName);
|
|
59292
59292
|
const mcp = readOptionalMcp(frontmatter.mcp, fileName);
|
|
59293
59293
|
const allow = readOptionalStringArray2(frontmatter.allow, "allow", fileName);
|
|
59294
59294
|
const prefix = readOptionalPrefix(frontmatter.prefix, fileName);
|
|
59295
59295
|
return {
|
|
59296
59296
|
...label === void 0 ? {} : { label },
|
|
59297
59297
|
...source === void 0 ? {} : { source },
|
|
59298
|
-
...
|
|
59298
|
+
...agent3 === void 0 ? {} : { agent: agent3 },
|
|
59299
59299
|
...mcp === void 0 ? {} : { mcp },
|
|
59300
59300
|
...allow === void 0 ? {} : { allow },
|
|
59301
59301
|
...prefix === void 0 ? {} : { prefix }
|
|
@@ -59850,10 +59850,10 @@ async function runPoeCodeCommand(args, cwd, runner) {
|
|
|
59850
59850
|
}
|
|
59851
59851
|
}
|
|
59852
59852
|
async function setupWorkflowAgent(automation, cwd, runner = runCommand) {
|
|
59853
|
-
const
|
|
59854
|
-
await runPoeCodeCommand(["install",
|
|
59855
|
-
await runPoeCodeCommand(["configure",
|
|
59856
|
-
return
|
|
59853
|
+
const agent3 = resolveWorkflowAgent(automation);
|
|
59854
|
+
await runPoeCodeCommand(["install", agent3, "--yes"], cwd, runner);
|
|
59855
|
+
await runPoeCodeCommand(["configure", agent3, "--yes"], cwd, runner);
|
|
59856
|
+
return agent3;
|
|
59857
59857
|
}
|
|
59858
59858
|
var init_setup_agent = __esm({
|
|
59859
59859
|
"packages/github-workflows/src/setup-agent.ts"() {
|
|
@@ -60498,7 +60498,7 @@ var init_commands2 = __esm({
|
|
|
60498
60498
|
await discoverAutomations(await resolveBuiltInPromptsDir(), ...projectPromptDirs(cwd))
|
|
60499
60499
|
);
|
|
60500
60500
|
const automation = await loadNamedAutomation(name, cwd);
|
|
60501
|
-
const
|
|
60501
|
+
const agent3 = automation.agent ?? params.agent ?? "codex";
|
|
60502
60502
|
const variables = await loadVariables(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd));
|
|
60503
60503
|
const sharedTemplateContext = { ...variables, ...buildTemplateContext5(env) };
|
|
60504
60504
|
if (automation.source === void 0) {
|
|
@@ -60506,7 +60506,7 @@ var init_commands2 = __esm({
|
|
|
60506
60506
|
const items2 = [
|
|
60507
60507
|
{
|
|
60508
60508
|
prompt,
|
|
60509
|
-
result: await spawn5(
|
|
60509
|
+
result: await spawn5(agent3, {
|
|
60510
60510
|
prompt,
|
|
60511
60511
|
cwd,
|
|
60512
60512
|
...params.model === void 0 ? {} : { model: params.model },
|
|
@@ -60518,7 +60518,7 @@ var init_commands2 = __esm({
|
|
|
60518
60518
|
requireSuccessfulRuns(automation.name, items2);
|
|
60519
60519
|
return {
|
|
60520
60520
|
automation: automation.name,
|
|
60521
|
-
agent:
|
|
60521
|
+
agent: agent3,
|
|
60522
60522
|
items: items2
|
|
60523
60523
|
};
|
|
60524
60524
|
}
|
|
@@ -60537,7 +60537,7 @@ var init_commands2 = __esm({
|
|
|
60537
60537
|
const prompt = renderPrompt(automation.prompt, buildPerItemTemplateContext(item, sharedTemplateContext));
|
|
60538
60538
|
results.push({
|
|
60539
60539
|
prompt,
|
|
60540
|
-
result: await spawn5(
|
|
60540
|
+
result: await spawn5(agent3, {
|
|
60541
60541
|
prompt,
|
|
60542
60542
|
cwd,
|
|
60543
60543
|
...params.model === void 0 ? {} : { model: params.model },
|
|
@@ -60549,7 +60549,7 @@ var init_commands2 = __esm({
|
|
|
60549
60549
|
requireSuccessfulRuns(automation.name, results);
|
|
60550
60550
|
return {
|
|
60551
60551
|
automation: automation.name,
|
|
60552
|
-
agent:
|
|
60552
|
+
agent: agent3,
|
|
60553
60553
|
items: results
|
|
60554
60554
|
};
|
|
60555
60555
|
},
|
|
@@ -60736,8 +60736,8 @@ var init_commands2 = __esm({
|
|
|
60736
60736
|
runPreflightChecks({ env, nodeVersion: process.version });
|
|
60737
60737
|
const cwd = resolveCwd();
|
|
60738
60738
|
const automation = await loadNamedAutomation(params.name, cwd);
|
|
60739
|
-
const
|
|
60740
|
-
return { agent:
|
|
60739
|
+
const agent3 = await setupWorkflowAgent(automation, cwd);
|
|
60740
|
+
return { agent: agent3, automation: automation.name };
|
|
60741
60741
|
},
|
|
60742
60742
|
render: {
|
|
60743
60743
|
rich: (result, { logger: logger2 }) => {
|
|
@@ -63189,8 +63189,8 @@ function createDeferred() {
|
|
|
63189
63189
|
});
|
|
63190
63190
|
return { promise, resolve: resolve3, reject };
|
|
63191
63191
|
}
|
|
63192
|
-
function resolveJudgeMode(
|
|
63193
|
-
const config = getSpawnConfig(
|
|
63192
|
+
function resolveJudgeMode(agent3) {
|
|
63193
|
+
const config = getSpawnConfig(agent3);
|
|
63194
63194
|
if (config?.kind === "cli" && Object.hasOwn(config.modes, "read")) {
|
|
63195
63195
|
return "read";
|
|
63196
63196
|
}
|
|
@@ -64282,11 +64282,11 @@ async function runNestedAgent(input, onEvent) {
|
|
|
64282
64282
|
..."logPath" in input && input.logPath ? { logPath: input.logPath } : {}
|
|
64283
64283
|
};
|
|
64284
64284
|
const result = await spawnAutonomous(
|
|
64285
|
-
(
|
|
64286
|
-
const handle = spawnStreaming({ ...spawnOptions, agentId:
|
|
64285
|
+
(agent3, spawnOptions) => {
|
|
64286
|
+
const handle = spawnStreaming({ ...spawnOptions, agentId: agent3 });
|
|
64287
64287
|
const attemptContext = {
|
|
64288
64288
|
sessionId: "unknown",
|
|
64289
|
-
agent:
|
|
64289
|
+
agent: agent3,
|
|
64290
64290
|
events: [],
|
|
64291
64291
|
usage: { inputTokens: 0, outputTokens: 0 },
|
|
64292
64292
|
eventStream: observeEvents(handle.events, onEvent),
|
|
@@ -64527,14 +64527,14 @@ async function* runMatrix(opts) {
|
|
|
64527
64527
|
await mkdir24(matrixDir, { recursive: true });
|
|
64528
64528
|
for (const evalId of evalIds) {
|
|
64529
64529
|
const evalDef = await loadEval(source, evalId);
|
|
64530
|
-
for (const
|
|
64530
|
+
for (const agent3 of opts.agents) {
|
|
64531
64531
|
for (const model of opts.models) {
|
|
64532
64532
|
const cellRuns = [];
|
|
64533
64533
|
for (let repeatIndex = 0; repeatIndex < repeats; repeatIndex += 1) {
|
|
64534
64534
|
const runOpts = {
|
|
64535
64535
|
sourceDir: opts.sourceDir,
|
|
64536
64536
|
evalId,
|
|
64537
|
-
agent:
|
|
64537
|
+
agent: agent3,
|
|
64538
64538
|
model,
|
|
64539
64539
|
outDir: matrixDir,
|
|
64540
64540
|
cloneCacheDir: opts.cloneCacheDir,
|
|
@@ -64551,7 +64551,7 @@ async function* runMatrix(opts) {
|
|
|
64551
64551
|
yield result;
|
|
64552
64552
|
}
|
|
64553
64553
|
const aggregate = aggregateRuns(cellRuns);
|
|
64554
|
-
await writeAggregate(matrixDir, evalId,
|
|
64554
|
+
await writeAggregate(matrixDir, evalId, agent3, model, aggregate);
|
|
64555
64555
|
}
|
|
64556
64556
|
}
|
|
64557
64557
|
}
|
|
@@ -64626,9 +64626,9 @@ function createErrorResult(opts, context) {
|
|
|
64626
64626
|
error: context.error
|
|
64627
64627
|
};
|
|
64628
64628
|
}
|
|
64629
|
-
async function writeAggregate(matrixDir, evalId,
|
|
64629
|
+
async function writeAggregate(matrixDir, evalId, agent3, model, aggregate) {
|
|
64630
64630
|
await writeFile21(
|
|
64631
|
-
path107.join(matrixDir, `aggregate-${evalId}-${
|
|
64631
|
+
path107.join(matrixDir, `aggregate-${evalId}-${agent3}-${safePathSegment(model)}.json`),
|
|
64632
64632
|
`${JSON.stringify(aggregate, null, 2)}
|
|
64633
64633
|
`,
|
|
64634
64634
|
"utf8"
|
|
@@ -67348,7 +67348,7 @@ function getErrorMessage6(error3) {
|
|
|
67348
67348
|
}
|
|
67349
67349
|
function formatJsonParseUserErrorMessage(label, filePath, source, error3, options) {
|
|
67350
67350
|
const location = getJsonParseErrorLocation(error3, source);
|
|
67351
|
-
const message2 = getErrorMessage6(error3);
|
|
67351
|
+
const message2 = location === null ? getErrorMessage6(error3) : removeNativeJsonParseLocation(getErrorMessage6(error3), location);
|
|
67352
67352
|
const positionText = location === null ? "" : ` at line ${location.line} column ${location.column}`;
|
|
67353
67353
|
const formattedPath = options.quotePath ? `"${filePath}"` : filePath;
|
|
67354
67354
|
const snippet2 = location === null ? "" : `
|
|
@@ -67360,6 +67360,10 @@ ${renderSourceSnippet({
|
|
|
67360
67360
|
})}`;
|
|
67361
67361
|
return `${label} ${formattedPath} is not valid JSON: ${message2}${positionText}.${snippet2}`;
|
|
67362
67362
|
}
|
|
67363
|
+
function removeNativeJsonParseLocation(message2, location) {
|
|
67364
|
+
const nativeSuffix = ` (line ${location.line} column ${location.column})`;
|
|
67365
|
+
return message2.endsWith(nativeSuffix) ? message2.slice(0, -nativeSuffix.length) : message2;
|
|
67366
|
+
}
|
|
67363
67367
|
function getJsonParseErrorLocation(error3, source) {
|
|
67364
67368
|
const causeLocation = getJsonParseCauseLocation(error3);
|
|
67365
67369
|
if (causeLocation !== null) {
|
|
@@ -70946,20 +70950,20 @@ function isNotFoundError6(error3) {
|
|
|
70946
70950
|
error3 && typeof error3 === "object" && error3.code === "ENOENT"
|
|
70947
70951
|
);
|
|
70948
70952
|
}
|
|
70949
|
-
async function resolveProvider3(
|
|
70953
|
+
async function resolveProvider3(agent3, options, container, flags) {
|
|
70950
70954
|
const explicit = options.provider ?? container.env.getVariable("POE_CODE_PROVIDER") ?? void 0;
|
|
70951
|
-
const candidates = container.providerRegistry.forAgent(
|
|
70955
|
+
const candidates = container.providerRegistry.forAgent(agent3);
|
|
70952
70956
|
if (explicit) {
|
|
70953
70957
|
const provider2 = container.providerRegistry.get(explicit);
|
|
70954
70958
|
if (!provider2) {
|
|
70955
70959
|
throw new Error(`Unknown provider "${explicit}".`);
|
|
70956
70960
|
}
|
|
70957
|
-
if (!resolveApiShape(provider2,
|
|
70958
|
-
throw new Error(formatIncompatibleProviderError(
|
|
70961
|
+
if (!resolveApiShape(provider2, agent3)) {
|
|
70962
|
+
throw new Error(formatIncompatibleProviderError(agent3, provider2));
|
|
70959
70963
|
}
|
|
70960
70964
|
}
|
|
70961
70965
|
if (candidates.length === 0) {
|
|
70962
|
-
throw new Error(`No providers support agent "${
|
|
70966
|
+
throw new Error(`No providers support agent "${agent3.id}".`);
|
|
70963
70967
|
}
|
|
70964
70968
|
if (flags.dryRun) {
|
|
70965
70969
|
return explicit ?? candidates[0].id;
|
|
@@ -70983,23 +70987,23 @@ async function resolveProvider3(agent2, options, container, flags) {
|
|
|
70983
70987
|
}
|
|
70984
70988
|
if (loggedIn.length > 1) {
|
|
70985
70989
|
if (flags.assumeYes) {
|
|
70986
|
-
throw new Error(formatAmbiguousProvidersError(
|
|
70990
|
+
throw new Error(formatAmbiguousProvidersError(agent3.id, loggedIn));
|
|
70987
70991
|
}
|
|
70988
|
-
return await promptForProviderChoice(
|
|
70992
|
+
return await promptForProviderChoice(agent3.id, loggedIn, container);
|
|
70989
70993
|
}
|
|
70990
70994
|
if (flags.assumeYes) {
|
|
70991
70995
|
throw new Error(
|
|
70992
|
-
`No logged-in providers support agent "${
|
|
70996
|
+
`No logged-in providers support agent "${agent3.id}". Use --provider and --api-key to authenticate non-interactively.`
|
|
70993
70997
|
);
|
|
70994
70998
|
}
|
|
70995
|
-
const chosen = candidates.length === 1 ? candidates[0].id : await promptForProviderChoice(
|
|
70999
|
+
const chosen = candidates.length === 1 ? candidates[0].id : await promptForProviderChoice(agent3.id, candidates, container);
|
|
70996
71000
|
await triggerProviderLogin(container, chosen, options.apiKey, flags);
|
|
70997
71001
|
return chosen;
|
|
70998
71002
|
}
|
|
70999
|
-
function formatIncompatibleProviderError(
|
|
71003
|
+
function formatIncompatibleProviderError(agent3, provider2) {
|
|
71000
71004
|
return [
|
|
71001
|
-
`Provider "${provider2.id}" cannot configure ${
|
|
71002
|
-
`${
|
|
71005
|
+
`Provider "${provider2.id}" cannot configure ${agent3.id}.`,
|
|
71006
|
+
`${agent3.id} requires one of: ${formatApiShapeLabels(agent3.apiShapes ?? [])}.`,
|
|
71003
71007
|
`${provider2.id} provides: ${formatApiShapeLabels(provider2.apiShapes?.map((shape) => shape.id) ?? [])}.`
|
|
71004
71008
|
].join("\n");
|
|
71005
71009
|
}
|
|
@@ -74226,13 +74230,13 @@ ${formatMcpToolsDocs()}`).action(async (options) => {
|
|
|
74226
74230
|
await container.options.resolveApiKey({ dryRun: flags.dryRun });
|
|
74227
74231
|
resources.logger.success("Logged in.");
|
|
74228
74232
|
}
|
|
74229
|
-
let
|
|
74230
|
-
if (!
|
|
74233
|
+
let agent3 = agentArg;
|
|
74234
|
+
if (!agent3) {
|
|
74231
74235
|
const fromConfig = await resolveDefaultAgent(container);
|
|
74232
74236
|
if (fromConfig !== null) {
|
|
74233
|
-
|
|
74237
|
+
agent3 = parseAgentSpecifier(fromConfig).agent;
|
|
74234
74238
|
} else if (options.yes) {
|
|
74235
|
-
|
|
74239
|
+
agent3 = DEFAULT_MCP_AGENT;
|
|
74236
74240
|
} else {
|
|
74237
74241
|
const selected = await select2({
|
|
74238
74242
|
message: "Select agent to configure:",
|
|
@@ -74242,20 +74246,20 @@ ${formatMcpToolsDocs()}`).action(async (options) => {
|
|
|
74242
74246
|
cancel("Operation cancelled");
|
|
74243
74247
|
return;
|
|
74244
74248
|
}
|
|
74245
|
-
|
|
74249
|
+
agent3 = selected;
|
|
74246
74250
|
}
|
|
74247
74251
|
}
|
|
74248
|
-
resources.logger.intro(`mcp configure ${
|
|
74249
|
-
const support = resolveAgentSupport3(
|
|
74252
|
+
resources.logger.intro(`mcp configure ${agent3}`);
|
|
74253
|
+
const support = resolveAgentSupport3(agent3);
|
|
74250
74254
|
if (support.status === "unknown") {
|
|
74251
|
-
resources.logger.error(`Unknown agent: ${
|
|
74255
|
+
resources.logger.error(`Unknown agent: ${agent3}`);
|
|
74252
74256
|
return;
|
|
74253
74257
|
}
|
|
74254
74258
|
if (support.status === "unsupported") {
|
|
74255
74259
|
resources.logger.error(`MCP not supported for ${support.id}.`);
|
|
74256
74260
|
return;
|
|
74257
74261
|
}
|
|
74258
|
-
const resolvedAgent = support.id ??
|
|
74262
|
+
const resolvedAgent = support.id ?? agent3;
|
|
74259
74263
|
await configure2(resolvedAgent, createMcpServerEntry(support.config?.mcpOutputFormat), {
|
|
74260
74264
|
fs: container.fs,
|
|
74261
74265
|
homeDir: container.env.homeDir,
|
|
@@ -74280,20 +74284,20 @@ ${formatMcpToolsDocs()}`).action(async (options) => {
|
|
|
74280
74284
|
});
|
|
74281
74285
|
resources.context.finalize();
|
|
74282
74286
|
});
|
|
74283
|
-
mcp.command("unconfigure").description("Remove poe-code from MCP client.").argument("<agent>", `Agent to unconfigure (${supportedAgents3.join(" | ")})`).action(async (
|
|
74287
|
+
mcp.command("unconfigure").description("Remove poe-code from MCP client.").argument("<agent>", `Agent to unconfigure (${supportedAgents3.join(" | ")})`).action(async (agent3) => {
|
|
74284
74288
|
const flags = resolveCommandFlags(program);
|
|
74285
74289
|
const resources = createExecutionResources(container, flags, "mcp");
|
|
74286
|
-
resources.logger.intro(`mcp unconfigure ${
|
|
74287
|
-
const support = resolveAgentSupport3(
|
|
74290
|
+
resources.logger.intro(`mcp unconfigure ${agent3}`);
|
|
74291
|
+
const support = resolveAgentSupport3(agent3);
|
|
74288
74292
|
if (support.status === "unknown") {
|
|
74289
|
-
resources.logger.error(`Unknown agent: ${
|
|
74293
|
+
resources.logger.error(`Unknown agent: ${agent3}`);
|
|
74290
74294
|
return;
|
|
74291
74295
|
}
|
|
74292
74296
|
if (support.status === "unsupported") {
|
|
74293
74297
|
resources.logger.error(`MCP not supported for ${support.id}.`);
|
|
74294
74298
|
return;
|
|
74295
74299
|
}
|
|
74296
|
-
const resolvedAgent = support.id ??
|
|
74300
|
+
const resolvedAgent = support.id ?? agent3;
|
|
74297
74301
|
await unconfigure2(resolvedAgent, "poe-code", {
|
|
74298
74302
|
fs: container.fs,
|
|
74299
74303
|
homeDir: container.env.homeDir,
|
|
@@ -74373,13 +74377,13 @@ function registerSkillCommand(program, container) {
|
|
|
74373
74377
|
resources.logger.error("Use either --local or --global, not both.");
|
|
74374
74378
|
return;
|
|
74375
74379
|
}
|
|
74376
|
-
let
|
|
74377
|
-
if (!
|
|
74380
|
+
let agent3 = agentArg;
|
|
74381
|
+
if (!agent3) {
|
|
74378
74382
|
const fromConfig = await resolveDefaultAgent(container);
|
|
74379
74383
|
if (fromConfig !== null) {
|
|
74380
|
-
|
|
74384
|
+
agent3 = parseAgentSpecifier(fromConfig).agent;
|
|
74381
74385
|
} else if (flags.assumeYes) {
|
|
74382
|
-
|
|
74386
|
+
agent3 = DEFAULT_SKILL_AGENT;
|
|
74383
74387
|
} else {
|
|
74384
74388
|
const selected = await select2({
|
|
74385
74389
|
message: "Select agent to configure:",
|
|
@@ -74389,19 +74393,19 @@ function registerSkillCommand(program, container) {
|
|
|
74389
74393
|
cancel("Operation cancelled");
|
|
74390
74394
|
return;
|
|
74391
74395
|
}
|
|
74392
|
-
|
|
74396
|
+
agent3 = selected;
|
|
74393
74397
|
}
|
|
74394
74398
|
}
|
|
74395
|
-
const support = resolveAgentSupport(
|
|
74399
|
+
const support = resolveAgentSupport(agent3);
|
|
74396
74400
|
if (support.status === "unknown") {
|
|
74397
|
-
resources.logger.error(`Unknown agent: ${
|
|
74401
|
+
resources.logger.error(`Unknown agent: ${agent3}`);
|
|
74398
74402
|
return;
|
|
74399
74403
|
}
|
|
74400
74404
|
if (support.status === "unsupported") {
|
|
74401
74405
|
resources.logger.error(`Skills not supported for ${support.id}.`);
|
|
74402
74406
|
return;
|
|
74403
74407
|
}
|
|
74404
|
-
const resolvedAgent = support.id ??
|
|
74408
|
+
const resolvedAgent = support.id ?? agent3;
|
|
74405
74409
|
const config = support.config;
|
|
74406
74410
|
let scope;
|
|
74407
74411
|
if (options.local) {
|
|
@@ -74458,11 +74462,11 @@ function registerSkillCommand(program, container) {
|
|
|
74458
74462
|
resources.logger.error("Use either --local or --global, not both.");
|
|
74459
74463
|
return;
|
|
74460
74464
|
}
|
|
74461
|
-
let
|
|
74462
|
-
if (!
|
|
74465
|
+
let agent3 = agentArg;
|
|
74466
|
+
if (!agent3) {
|
|
74463
74467
|
const fromConfig = await resolveDefaultAgent(container);
|
|
74464
74468
|
if (fromConfig !== null) {
|
|
74465
|
-
|
|
74469
|
+
agent3 = parseAgentSpecifier(fromConfig).agent;
|
|
74466
74470
|
} else {
|
|
74467
74471
|
const selected = await select2({
|
|
74468
74472
|
message: "Select agent to unconfigure:",
|
|
@@ -74472,19 +74476,19 @@ function registerSkillCommand(program, container) {
|
|
|
74472
74476
|
cancel("Operation cancelled");
|
|
74473
74477
|
return;
|
|
74474
74478
|
}
|
|
74475
|
-
|
|
74479
|
+
agent3 = selected;
|
|
74476
74480
|
}
|
|
74477
74481
|
}
|
|
74478
|
-
const support = resolveAgentSupport(
|
|
74482
|
+
const support = resolveAgentSupport(agent3);
|
|
74479
74483
|
if (support.status === "unknown") {
|
|
74480
|
-
resources.logger.error(`Unknown agent: ${
|
|
74484
|
+
resources.logger.error(`Unknown agent: ${agent3}`);
|
|
74481
74485
|
return;
|
|
74482
74486
|
}
|
|
74483
74487
|
if (support.status === "unsupported") {
|
|
74484
74488
|
resources.logger.error(`Skills not supported for ${support.id}.`);
|
|
74485
74489
|
return;
|
|
74486
74490
|
}
|
|
74487
|
-
const resolvedAgent = support.id ??
|
|
74491
|
+
const resolvedAgent = support.id ?? agent3;
|
|
74488
74492
|
const config = support.config;
|
|
74489
74493
|
let scope;
|
|
74490
74494
|
if (options.local) {
|
|
@@ -75897,7 +75901,7 @@ function registerPipelineCommand(program, container) {
|
|
|
75897
75901
|
cancel("Pipeline run cancelled.");
|
|
75898
75902
|
return;
|
|
75899
75903
|
}
|
|
75900
|
-
const
|
|
75904
|
+
const agent3 = resolvePipelineAgent(selectedAgent.agent);
|
|
75901
75905
|
const commandConfig = await resolvePipelineCommandConfig(container);
|
|
75902
75906
|
integrations = await loadIntegrations(commandConfig.configDoc);
|
|
75903
75907
|
const maxRuns = resolveMaxRuns(options.maxRuns);
|
|
@@ -75935,7 +75939,7 @@ function registerPipelineCommand(program, container) {
|
|
|
75935
75939
|
resources.logger.info(`Plan ${index + 1}/${totalPlans}: ${planPath}`);
|
|
75936
75940
|
}
|
|
75937
75941
|
const runOptions = {
|
|
75938
|
-
agent:
|
|
75942
|
+
agent: agent3,
|
|
75939
75943
|
cwd: container.env.cwd,
|
|
75940
75944
|
homeDir: container.env.homeDir,
|
|
75941
75945
|
planDirectory: commandConfig.planDirectory,
|
|
@@ -75950,7 +75954,7 @@ function registerPipelineCommand(program, container) {
|
|
|
75950
75954
|
}
|
|
75951
75955
|
const useDashboard = shouldUseInteractiveDashboard(options.tui ?? commandConfig.tui);
|
|
75952
75956
|
const result = useDashboard ? await runPipelineWithDashboard({
|
|
75953
|
-
agent:
|
|
75957
|
+
agent: agent3,
|
|
75954
75958
|
...options.model ? { model: options.model } : {},
|
|
75955
75959
|
planPath,
|
|
75956
75960
|
planIndex: index,
|
|
@@ -75973,7 +75977,7 @@ function registerPipelineCommand(program, container) {
|
|
|
75973
75977
|
resources.logger.resolved(
|
|
75974
75978
|
"Config",
|
|
75975
75979
|
formatPipelineConfigSummary({
|
|
75976
|
-
agent:
|
|
75980
|
+
agent: agent3,
|
|
75977
75981
|
model: options.model,
|
|
75978
75982
|
planPath: summary2.planPath,
|
|
75979
75983
|
planIndex: index,
|
|
@@ -76055,7 +76059,7 @@ function registerPipelineCommand(program, container) {
|
|
|
76055
76059
|
cancel("Pipeline init cancelled.");
|
|
76056
76060
|
return;
|
|
76057
76061
|
}
|
|
76058
|
-
const
|
|
76062
|
+
const agent3 = resolvePipelineAgent(selectedAgent.agent);
|
|
76059
76063
|
if (options.source && sourcePaths && sourcePaths.length > 0) {
|
|
76060
76064
|
throw new ValidationError("Use either --source or --sources, not both.");
|
|
76061
76065
|
}
|
|
@@ -76096,7 +76100,7 @@ function registerPipelineCommand(program, container) {
|
|
|
76096
76100
|
}
|
|
76097
76101
|
}
|
|
76098
76102
|
const result = await runPipelineInit({
|
|
76099
|
-
agent:
|
|
76103
|
+
agent: agent3,
|
|
76100
76104
|
cwd: container.env.cwd,
|
|
76101
76105
|
homeDir: container.env.homeDir,
|
|
76102
76106
|
...options.model ? { model: options.model } : {},
|
|
@@ -76251,10 +76255,10 @@ function registerPipelineCommand(program, container) {
|
|
|
76251
76255
|
cancel("Pipeline install cancelled.");
|
|
76252
76256
|
return;
|
|
76253
76257
|
}
|
|
76254
|
-
const
|
|
76255
|
-
const support = resolveAgentSupport(parseAgentSpecifier(
|
|
76258
|
+
const agent3 = resolvePipelineAgent(selectedAgent.agent);
|
|
76259
|
+
const support = resolveAgentSupport(parseAgentSpecifier(agent3).agent);
|
|
76256
76260
|
if (support.status !== "supported" || !support.id) {
|
|
76257
|
-
throw new ValidationError(`Unsupported agent: ${
|
|
76261
|
+
throw new ValidationError(`Unsupported agent: ${agent3}`);
|
|
76258
76262
|
}
|
|
76259
76263
|
let scope;
|
|
76260
76264
|
if (options.local) {
|
|
@@ -76383,8 +76387,8 @@ var init_pipeline5 = __esm({
|
|
|
76383
76387
|
|
|
76384
76388
|
// src/cli/commands/ralph.ts
|
|
76385
76389
|
import path120 from "node:path";
|
|
76386
|
-
function formatRalphAgentSummary(
|
|
76387
|
-
return Array.isArray(
|
|
76390
|
+
function formatRalphAgentSummary(agent3) {
|
|
76391
|
+
return Array.isArray(agent3) ? agent3.join(", ") : agent3;
|
|
76388
76392
|
}
|
|
76389
76393
|
function formatRalphConfigSummary(options) {
|
|
76390
76394
|
return [
|
|
@@ -76786,19 +76790,19 @@ function formatCurrentConfig(frontmatter) {
|
|
|
76786
76790
|
}
|
|
76787
76791
|
return items.length > 0 ? `Current: ${items.join(", ")}` : null;
|
|
76788
76792
|
}
|
|
76789
|
-
function expandAgentList(
|
|
76790
|
-
if (
|
|
76793
|
+
function expandAgentList(agent3, iterations) {
|
|
76794
|
+
if (agent3 === void 0) {
|
|
76791
76795
|
return [];
|
|
76792
76796
|
}
|
|
76793
|
-
if (typeof
|
|
76797
|
+
if (typeof agent3 === "string") {
|
|
76794
76798
|
const count2 = normalizeConfiguredIterations(iterations) ?? 1;
|
|
76795
|
-
return Array.from({ length: count2 }, () =>
|
|
76799
|
+
return Array.from({ length: count2 }, () => agent3);
|
|
76796
76800
|
}
|
|
76797
|
-
if (
|
|
76801
|
+
if (agent3.length === 0) {
|
|
76798
76802
|
return [];
|
|
76799
76803
|
}
|
|
76800
|
-
const count = normalizeConfiguredIterations(iterations) ??
|
|
76801
|
-
return Array.from({ length: count }, (_, index) =>
|
|
76804
|
+
const count = normalizeConfiguredIterations(iterations) ?? agent3.length;
|
|
76805
|
+
return Array.from({ length: count }, (_, index) => agent3[index % agent3.length]);
|
|
76802
76806
|
}
|
|
76803
76807
|
function registerRalphCommand(program, container) {
|
|
76804
76808
|
const ralph = program.command("ralph").description("Run a simple iterative markdown loop.").addHelpCommand(false);
|
|
@@ -76823,12 +76827,12 @@ function registerRalphCommand(program, container) {
|
|
|
76823
76827
|
if (!options.agent && !options.iterations && !flags.assumeYes && currentConfig) {
|
|
76824
76828
|
resources.logger.info(currentConfig);
|
|
76825
76829
|
}
|
|
76826
|
-
const
|
|
76830
|
+
const agent3 = await resolveInitAgent({
|
|
76827
76831
|
container,
|
|
76828
76832
|
program,
|
|
76829
76833
|
providedAgent: options.agent
|
|
76830
76834
|
});
|
|
76831
|
-
if (!
|
|
76835
|
+
if (!agent3) {
|
|
76832
76836
|
return;
|
|
76833
76837
|
}
|
|
76834
76838
|
const iterations = await resolveInitIterations({
|
|
@@ -76840,7 +76844,7 @@ function registerRalphCommand(program, container) {
|
|
|
76840
76844
|
}
|
|
76841
76845
|
const updated = writeFrontmatter(
|
|
76842
76846
|
{
|
|
76843
|
-
agent:
|
|
76847
|
+
agent: agent3,
|
|
76844
76848
|
iterations,
|
|
76845
76849
|
status: {
|
|
76846
76850
|
state: doc.data.status.state,
|
|
@@ -76853,7 +76857,7 @@ function registerRalphCommand(program, container) {
|
|
|
76853
76857
|
resources.logger.resolved(
|
|
76854
76858
|
"Initialized Ralph config",
|
|
76855
76859
|
`Doc: ${docPath}
|
|
76856
|
-
Agent: ${
|
|
76860
|
+
Agent: ${agent3}
|
|
76857
76861
|
Iterations: ${iterations}`
|
|
76858
76862
|
);
|
|
76859
76863
|
resources.logger.success("Ralph config saved.");
|
|
@@ -76880,13 +76884,13 @@ function registerRalphCommand(program, container) {
|
|
|
76880
76884
|
return;
|
|
76881
76885
|
}
|
|
76882
76886
|
const doc = await readRalphDoc(container, docPath);
|
|
76883
|
-
const
|
|
76887
|
+
const agent3 = await resolveRunAgent({
|
|
76884
76888
|
container,
|
|
76885
76889
|
program,
|
|
76886
76890
|
providedAgent: options.agent,
|
|
76887
76891
|
frontmatterAgent: doc.data.agent
|
|
76888
76892
|
});
|
|
76889
|
-
if (!
|
|
76893
|
+
if (!agent3) {
|
|
76890
76894
|
return;
|
|
76891
76895
|
}
|
|
76892
76896
|
const maxIterations2 = await resolveRunIterations({
|
|
@@ -76899,7 +76903,7 @@ function registerRalphCommand(program, container) {
|
|
|
76899
76903
|
}
|
|
76900
76904
|
const runCwd = options.cwd ? path120.resolve(container.env.cwd, options.cwd) : container.env.cwd;
|
|
76901
76905
|
const runOptions = {
|
|
76902
|
-
agent:
|
|
76906
|
+
agent: agent3,
|
|
76903
76907
|
cwd: runCwd,
|
|
76904
76908
|
homeDir: container.env.homeDir,
|
|
76905
76909
|
docPath,
|
|
@@ -76909,7 +76913,7 @@ function registerRalphCommand(program, container) {
|
|
|
76909
76913
|
};
|
|
76910
76914
|
const useDashboard = shouldUseInteractiveDashboard(options.tui ?? commandConfig.tui);
|
|
76911
76915
|
const result = useDashboard ? await runRalphWithDashboard({
|
|
76912
|
-
agent:
|
|
76916
|
+
agent: agent3,
|
|
76913
76917
|
docPath,
|
|
76914
76918
|
cwd: runCwd,
|
|
76915
76919
|
maxIterations: maxIterations2,
|
|
@@ -77066,8 +77070,8 @@ function validateExperimentDoc(frontmatter) {
|
|
|
77066
77070
|
}
|
|
77067
77071
|
return errors2;
|
|
77068
77072
|
}
|
|
77069
|
-
function formatExperimentAgentSummary(
|
|
77070
|
-
return Array.isArray(
|
|
77073
|
+
function formatExperimentAgentSummary(agent3) {
|
|
77074
|
+
return Array.isArray(agent3) ? agent3.join(", ") : agent3;
|
|
77071
77075
|
}
|
|
77072
77076
|
function formatMaxExperimentsLabel(maxExperiments) {
|
|
77073
77077
|
return maxExperiments === void 0 ? "unlimited" : String(maxExperiments);
|
|
@@ -77366,7 +77370,7 @@ async function resolveRunAgent2(options) {
|
|
|
77366
77370
|
return resolveExperimentAgent(void 0);
|
|
77367
77371
|
}
|
|
77368
77372
|
if (providedAgents.length > 1) {
|
|
77369
|
-
return providedAgents.map((
|
|
77373
|
+
return providedAgents.map((agent3) => resolveExperimentAgent(agent3));
|
|
77370
77374
|
}
|
|
77371
77375
|
}
|
|
77372
77376
|
if (Array.isArray(options.frontmatterAgent)) {
|
|
@@ -77434,18 +77438,18 @@ function registerExperimentCommand(program, container) {
|
|
|
77434
77438
|
return;
|
|
77435
77439
|
}
|
|
77436
77440
|
const doc = await readExperimentDoc(container, docPath);
|
|
77437
|
-
const
|
|
77441
|
+
const agent3 = await resolveRunAgent2({
|
|
77438
77442
|
container,
|
|
77439
77443
|
program,
|
|
77440
77444
|
providedAgent: options.agent,
|
|
77441
77445
|
frontmatterAgent: doc.frontmatter.agent
|
|
77442
77446
|
});
|
|
77443
|
-
if (!
|
|
77447
|
+
if (!agent3) {
|
|
77444
77448
|
return;
|
|
77445
77449
|
}
|
|
77446
77450
|
const maxExperiments = parseNonNegativeInt2(options.maxExperiments, "max-experiments");
|
|
77447
77451
|
const runOptions = {
|
|
77448
|
-
agent:
|
|
77452
|
+
agent: agent3,
|
|
77449
77453
|
cwd: container.env.cwd,
|
|
77450
77454
|
homeDir: container.env.homeDir,
|
|
77451
77455
|
docPath,
|
|
@@ -77484,7 +77488,7 @@ function registerExperimentCommand(program, container) {
|
|
|
77484
77488
|
}
|
|
77485
77489
|
const useDashboard = shouldUseInteractiveDashboard(options.tui ?? commandConfig.tui);
|
|
77486
77490
|
const result = useDashboard ? await runExperimentWithDashboard({
|
|
77487
|
-
agent:
|
|
77491
|
+
agent: agent3,
|
|
77488
77492
|
docPath,
|
|
77489
77493
|
maxExperiments,
|
|
77490
77494
|
runOptions,
|
|
@@ -77682,13 +77686,13 @@ function registerExperimentCommand(program, container) {
|
|
|
77682
77686
|
throw new ValidationError("Use either --local or --global, not both.");
|
|
77683
77687
|
}
|
|
77684
77688
|
try {
|
|
77685
|
-
let
|
|
77686
|
-
if (!
|
|
77689
|
+
let agent3 = options.agent;
|
|
77690
|
+
if (!agent3) {
|
|
77687
77691
|
const fromConfig = await resolveDefaultAgent(container);
|
|
77688
77692
|
if (fromConfig !== null) {
|
|
77689
|
-
|
|
77693
|
+
agent3 = parseAgentSpecifier(fromConfig).agent;
|
|
77690
77694
|
} else if (flags.assumeYes) {
|
|
77691
|
-
|
|
77695
|
+
agent3 = DEFAULT_EXPERIMENT_AGENT;
|
|
77692
77696
|
} else {
|
|
77693
77697
|
const selected = await select2({
|
|
77694
77698
|
message: "Select agent to install the Experiment skill for:",
|
|
@@ -77701,12 +77705,12 @@ function registerExperimentCommand(program, container) {
|
|
|
77701
77705
|
cancel("Experiment install cancelled.");
|
|
77702
77706
|
return;
|
|
77703
77707
|
}
|
|
77704
|
-
|
|
77708
|
+
agent3 = selected;
|
|
77705
77709
|
}
|
|
77706
77710
|
}
|
|
77707
|
-
const support = resolveAgentSupport(
|
|
77711
|
+
const support = resolveAgentSupport(agent3);
|
|
77708
77712
|
if (support.status !== "supported" || !support.id) {
|
|
77709
|
-
throw new ValidationError(`Unsupported agent: ${
|
|
77713
|
+
throw new ValidationError(`Unsupported agent: ${agent3}`);
|
|
77710
77714
|
}
|
|
77711
77715
|
let scope;
|
|
77712
77716
|
if (options.local) {
|
|
@@ -80063,13 +80067,13 @@ function openMemory(opts) {
|
|
|
80063
80067
|
auditClaims: async ({ repoRoot, ...options }) => await auditClaims(root, repoRoot, options)
|
|
80064
80068
|
};
|
|
80065
80069
|
}
|
|
80066
|
-
function withDefaultAgent(options,
|
|
80067
|
-
if (options.agent !== void 0 ||
|
|
80070
|
+
function withDefaultAgent(options, agent3) {
|
|
80071
|
+
if (options.agent !== void 0 || agent3 === void 0) {
|
|
80068
80072
|
return options;
|
|
80069
80073
|
}
|
|
80070
80074
|
return {
|
|
80071
80075
|
...options,
|
|
80072
|
-
agent:
|
|
80076
|
+
agent: agent3
|
|
80073
80077
|
};
|
|
80074
80078
|
}
|
|
80075
80079
|
var init_handle = __esm({
|
|
@@ -80482,7 +80486,7 @@ function formatProviderEnv(provider2) {
|
|
|
80482
80486
|
}
|
|
80483
80487
|
function listShapeCompatibleAgents(providerApiShapes) {
|
|
80484
80488
|
const shapeIds = new Set(providerApiShapes);
|
|
80485
|
-
return allAgents.filter((
|
|
80489
|
+
return allAgents.filter((agent3) => agent3.apiShapes?.some((shapeId) => shapeIds.has(shapeId))).map((agent3) => agent3.id).sort();
|
|
80486
80490
|
}
|
|
80487
80491
|
async function executeProviderLogout(program, container, id) {
|
|
80488
80492
|
const flags = resolveCommandFlags(program);
|
|
@@ -107476,11 +107480,11 @@ function createSpawnFailureMessage(result) {
|
|
|
107476
107480
|
return stderr.length > 0 ? `Agent spawn failed with exit code ${result.exitCode}: ${stderr}` : summary.length > 0 ? `Agent spawn failed with exit code ${result.exitCode}: ${summary}` : `Agent spawn failed with exit code ${result.exitCode}.`;
|
|
107477
107481
|
}
|
|
107478
107482
|
function readRequiredAgent(value) {
|
|
107479
|
-
const
|
|
107480
|
-
if (
|
|
107483
|
+
const agent3 = readOptionalString5(value, "Agent definition agent")?.trim();
|
|
107484
|
+
if (agent3 === void 0 || agent3.length === 0) {
|
|
107481
107485
|
throw new Error("Agent definition must define a non-empty agent.");
|
|
107482
107486
|
}
|
|
107483
|
-
return
|
|
107487
|
+
return agent3;
|
|
107484
107488
|
}
|
|
107485
107489
|
function readRequiredPrompt(value) {
|
|
107486
107490
|
const prompt = readOptionalString5(value, "Agent spawn options prompt");
|
|
@@ -109364,7 +109368,7 @@ function createHarnessModules(container, frontmatter, meta) {
|
|
|
109364
109368
|
version: meta.version,
|
|
109365
109369
|
filepath: meta.filename
|
|
109366
109370
|
};
|
|
109367
|
-
const
|
|
109371
|
+
const agent3 = makeAgentModule(async (input) => {
|
|
109368
109372
|
const { result } = spawn9(input.agent, {
|
|
109369
109373
|
prompt: input.prompt,
|
|
109370
109374
|
cwd: input.cwd ?? meta.dirname,
|
|
@@ -109397,7 +109401,7 @@ function createHarnessModules(container, frontmatter, meta) {
|
|
|
109397
109401
|
return result.stdout;
|
|
109398
109402
|
});
|
|
109399
109403
|
return {
|
|
109400
|
-
agent: toModuleExports(
|
|
109404
|
+
agent: toModuleExports(agent3),
|
|
109401
109405
|
fail: toModuleExports(/* @__PURE__ */ new Map([["default", fail2]])),
|
|
109402
109406
|
git: toModuleExports(git2),
|
|
109403
109407
|
harness: toModuleExports(harness),
|
|
@@ -110082,7 +110086,7 @@ var init_package2 = __esm({
|
|
|
110082
110086
|
"package.json"() {
|
|
110083
110087
|
package_default2 = {
|
|
110084
110088
|
name: "poe-code",
|
|
110085
|
-
version: "3.0.
|
|
110089
|
+
version: "3.0.226",
|
|
110086
110090
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
110087
110091
|
type: "module",
|
|
110088
110092
|
main: "./dist/index.js",
|
|
@@ -110095,6 +110099,10 @@ var init_package2 = __esm({
|
|
|
110095
110099
|
"./memory": {
|
|
110096
110100
|
types: "./packages/memory/dist/index.d.ts",
|
|
110097
110101
|
import: "./packages/memory/dist/index.js"
|
|
110102
|
+
},
|
|
110103
|
+
"./agent": {
|
|
110104
|
+
types: "./dist/agent.d.ts",
|
|
110105
|
+
import: "./dist/agent.js"
|
|
110098
110106
|
}
|
|
110099
110107
|
},
|
|
110100
110108
|
workspaces: [
|
|
@@ -111252,6 +111260,15 @@ function normalizeBaseUrl(value) {
|
|
|
111252
111260
|
|
|
111253
111261
|
// src/index.ts
|
|
111254
111262
|
init_credentials();
|
|
111263
|
+
|
|
111264
|
+
// src/agent.ts
|
|
111265
|
+
init_src18();
|
|
111266
|
+
var agent2 = agent;
|
|
111267
|
+
var openaiChatCompletionsPlugin2 = openaiChatCompletionsPlugin;
|
|
111268
|
+
var openaiResponsesPlugin2 = openaiResponsesPlugin;
|
|
111269
|
+
var systemPromptPlugin2 = poe_agent_plugin_system_prompt_default;
|
|
111270
|
+
|
|
111271
|
+
// src/index.ts
|
|
111255
111272
|
init_src14();
|
|
111256
111273
|
|
|
111257
111274
|
// src/plan/document-schema.ts
|
|
@@ -111498,6 +111515,7 @@ if (isCliInvocation2(process.argv, import.meta.url)) {
|
|
|
111498
111515
|
}
|
|
111499
111516
|
export {
|
|
111500
111517
|
SpawnParallelError,
|
|
111518
|
+
agent2 as agent,
|
|
111501
111519
|
bridgeHooks,
|
|
111502
111520
|
cleanupBridgedHooks,
|
|
111503
111521
|
createLogWriter,
|
|
@@ -111517,6 +111535,8 @@ export {
|
|
|
111517
111535
|
isCliInvocation2 as isCliInvocation,
|
|
111518
111536
|
listLaunches,
|
|
111519
111537
|
main,
|
|
111538
|
+
openaiChatCompletionsPlugin2 as openaiChatCompletionsPlugin,
|
|
111539
|
+
openaiResponsesPlugin2 as openaiResponsesPlugin,
|
|
111520
111540
|
planDocumentSchema,
|
|
111521
111541
|
planDocumentSchemaId,
|
|
111522
111542
|
poeAgentMain,
|
|
@@ -111537,6 +111557,7 @@ export {
|
|
|
111537
111557
|
startLaunch,
|
|
111538
111558
|
stopLaunch,
|
|
111539
111559
|
supportedHookAgents,
|
|
111560
|
+
systemPromptPlugin2 as systemPromptPlugin,
|
|
111540
111561
|
waitForReady
|
|
111541
111562
|
};
|
|
111542
111563
|
/*! Bundled license information:
|