poe-code 3.0.102 → 3.0.104

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/index.js CHANGED
@@ -5210,33 +5210,251 @@ var init_prompts2 = __esm({
5210
5210
  }
5211
5211
  });
5212
5212
 
5213
- // src/cli/options.ts
5214
- function stripBracketedPaste(value) {
5215
- return value.replace(/\x1b\[200~/g, "").replace(/\x1b\[201~/g, "").replace(/undefinedndefined$/, "").replace(/undefined$/, "").replace(/ndefined$/, "");
5213
+ // packages/poe-oauth/src/check-auth.ts
5214
+ async function checkAuth(options) {
5215
+ try {
5216
+ const fetchImplementation = options.fetch ?? globalThis.fetch;
5217
+ const response = await fetchImplementation(
5218
+ createCurrentBalanceUrl(options.baseUrl ?? DEFAULT_BASE_URL),
5219
+ {
5220
+ method: "GET",
5221
+ headers: {
5222
+ Authorization: `Bearer ${options.apiKey}`
5223
+ }
5224
+ }
5225
+ );
5226
+ if (!response.ok) {
5227
+ return null;
5228
+ }
5229
+ const data = await response.json();
5230
+ if (typeof data.email !== "string" || data.email.length === 0) {
5231
+ return null;
5232
+ }
5233
+ return {
5234
+ email: data.email,
5235
+ balance: typeof data.current_point_balance === "number" ? data.current_point_balance : null
5236
+ };
5237
+ } catch {
5238
+ return null;
5239
+ }
5216
5240
  }
5217
- function isAlphanumericWithSeparators(value) {
5218
- for (let i = 0; i < value.length; i++) {
5219
- const code = value.charCodeAt(i);
5220
- const isDigit = code >= 48 && code <= 57;
5221
- const isUpper = code >= 65 && code <= 90;
5222
- const isLower = code >= 97 && code <= 122;
5223
- const isHyphen = code === 45;
5224
- const isUnderscore = code === 95;
5225
- if (!isDigit && !isUpper && !isLower && !isHyphen && !isUnderscore)
5226
- return false;
5241
+ function createCurrentBalanceUrl(baseUrl) {
5242
+ const normalizedBaseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
5243
+ return `${normalizedBaseUrl}/usage/current_balance`;
5244
+ }
5245
+ var DEFAULT_BASE_URL;
5246
+ var init_check_auth = __esm({
5247
+ "packages/poe-oauth/src/check-auth.ts"() {
5248
+ "use strict";
5249
+ DEFAULT_BASE_URL = "https://poe.com";
5250
+ }
5251
+ });
5252
+
5253
+ // packages/poe-oauth/src/oauth-client.ts
5254
+ import http from "node:http";
5255
+ import crypto from "node:crypto";
5256
+ function createOAuthClient(config2) {
5257
+ const fetchFn = config2.fetch ?? globalThis.fetch;
5258
+ return {
5259
+ authorize: () => startAuthorization(config2, fetchFn)
5260
+ };
5261
+ }
5262
+ function generateCodeVerifier() {
5263
+ return crypto.randomBytes(32).toString("base64url");
5264
+ }
5265
+ function generateCodeChallenge(verifier) {
5266
+ return crypto.createHash("sha256").update(verifier).digest("base64url");
5267
+ }
5268
+ async function startAuthorization(config2, fetchFn) {
5269
+ const authorizationEndpoint = config2.authorizationEndpoint ?? DEFAULT_AUTHORIZATION_ENDPOINT;
5270
+ const tokenEndpoint = config2.tokenEndpoint ?? DEFAULT_TOKEN_ENDPOINT;
5271
+ const codeVerifier = generateCodeVerifier();
5272
+ const codeChallenge = generateCodeChallenge(codeVerifier);
5273
+ const server = config2.createServer ? config2.createServer() : http.createServer();
5274
+ const port = await startServer(server);
5275
+ const redirectUri = `http://127.0.0.1:${port}/callback`;
5276
+ const authorizationUrl = buildAuthorizationUrl({
5277
+ endpoint: authorizationEndpoint,
5278
+ clientId: config2.clientId,
5279
+ redirectUri,
5280
+ codeChallenge
5281
+ });
5282
+ const waitForResult = async () => {
5283
+ try {
5284
+ const code = await waitForAuthorizationCode(server, config2, authorizationUrl);
5285
+ return await exchangeCodeForApiKey({
5286
+ tokenEndpoint,
5287
+ code,
5288
+ codeVerifier,
5289
+ clientId: config2.clientId,
5290
+ redirectUri,
5291
+ fetchFn
5292
+ });
5293
+ } finally {
5294
+ server.closeAllConnections?.();
5295
+ server.close();
5296
+ }
5297
+ };
5298
+ return { authorizationUrl, waitForResult };
5299
+ }
5300
+ function startServer(server) {
5301
+ return new Promise((resolve) => {
5302
+ server.listen(0, "127.0.0.1", () => {
5303
+ const address = server.address();
5304
+ resolve(address.port);
5305
+ });
5306
+ });
5307
+ }
5308
+ function buildAuthorizationUrl(params) {
5309
+ const url2 = new URL(params.endpoint);
5310
+ url2.searchParams.set("response_type", "code");
5311
+ url2.searchParams.set("client_id", params.clientId);
5312
+ url2.searchParams.set("scope", "apikey:create");
5313
+ url2.searchParams.set("code_challenge", params.codeChallenge);
5314
+ url2.searchParams.set("code_challenge_method", "S256");
5315
+ url2.searchParams.set("redirect_uri", params.redirectUri);
5316
+ return url2.toString();
5317
+ }
5318
+ function waitForAuthorizationCode(server, config2, authorizationUrl) {
5319
+ return new Promise((resolve, reject) => {
5320
+ let settled = false;
5321
+ const settle = (fn) => {
5322
+ if (!settled) {
5323
+ settled = true;
5324
+ fn();
5325
+ }
5326
+ };
5327
+ server.on("request", (req, res) => {
5328
+ const url2 = new URL(req.url, `http://127.0.0.1`);
5329
+ if (url2.pathname !== "/callback") {
5330
+ res.writeHead(404);
5331
+ res.end("Not found");
5332
+ return;
5333
+ }
5334
+ const error2 = url2.searchParams.get("error");
5335
+ if (error2) {
5336
+ const description = url2.searchParams.get("error_description") ?? error2;
5337
+ res.writeHead(400);
5338
+ res.end(`Authorization failed: ${description}`);
5339
+ settle(() => reject(new Error(`OAuth authorization failed: ${error2} \u2014 ${description}`)));
5340
+ return;
5341
+ }
5342
+ const code = url2.searchParams.get("code");
5343
+ if (!code) {
5344
+ res.writeHead(400);
5345
+ res.end("Missing authorization code");
5346
+ settle(() => reject(new Error("OAuth callback missing authorization code")));
5347
+ return;
5348
+ }
5349
+ res.writeHead(200, { "Content-Type": "text/html" });
5350
+ res.end(buildSuccessPage(config2.landingPage));
5351
+ settle(() => resolve(code));
5352
+ });
5353
+ if (config2.readLine) {
5354
+ config2.readLine().then((input) => {
5355
+ const code = extractCodeFromInput(input);
5356
+ if (code) {
5357
+ settle(() => resolve(code));
5358
+ }
5359
+ }).catch(() => {
5360
+ });
5361
+ }
5362
+ if (config2.openBrowser) {
5363
+ config2.openBrowser(authorizationUrl).catch(
5364
+ (err) => settle(() => reject(err))
5365
+ );
5366
+ }
5367
+ });
5368
+ }
5369
+ function extractCodeFromInput(input) {
5370
+ const trimmed = input.replace(/[\r\n]/g, "").trim();
5371
+ if (trimmed.length === 0) {
5372
+ return null;
5373
+ }
5374
+ try {
5375
+ const url2 = new URL(trimmed);
5376
+ return url2.searchParams.get("code");
5377
+ } catch {
5378
+ return trimmed;
5379
+ }
5380
+ }
5381
+ async function exchangeCodeForApiKey(params) {
5382
+ const body = new URLSearchParams({
5383
+ grant_type: "authorization_code",
5384
+ code: params.code,
5385
+ code_verifier: params.codeVerifier,
5386
+ client_id: params.clientId,
5387
+ redirect_uri: params.redirectUri
5388
+ });
5389
+ const response = await params.fetchFn(params.tokenEndpoint, {
5390
+ method: "POST",
5391
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
5392
+ body: body.toString()
5393
+ });
5394
+ if (!response.ok) {
5395
+ const text4 = await response.text();
5396
+ const description = parseErrorDescription(text4);
5397
+ throw new Error(description ?? `Token exchange failed (${response.status}): ${text4}`);
5398
+ }
5399
+ const data = await response.json();
5400
+ if (typeof data.api_key !== "string" || data.api_key.length === 0) {
5401
+ throw new Error("Token response missing api_key field");
5402
+ }
5403
+ return {
5404
+ apiKey: data.api_key,
5405
+ expiresIn: typeof data.api_key_expires_in === "number" ? data.api_key_expires_in : null
5406
+ };
5407
+ }
5408
+ function parseErrorDescription(text4) {
5409
+ try {
5410
+ const data = JSON.parse(text4);
5411
+ if (typeof data.error_description === "string") {
5412
+ return data.error_description;
5413
+ }
5414
+ if (typeof data.error === "string") {
5415
+ return data.error;
5416
+ }
5417
+ } catch {
5227
5418
  }
5228
- return value.length > 0;
5419
+ return null;
5229
5420
  }
5230
- function hasMinimumApiKeyLength(value) {
5231
- return value.length >= MIN_API_KEY_LENGTH;
5421
+ function escapeHtml(text4) {
5422
+ return text4.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
5232
5423
  }
5233
- function isValidApiKeyFormat(key) {
5234
- if (key.length === 0) return false;
5235
- if (key.startsWith("sk-poe-")) {
5236
- const hash2 = key.slice(7);
5237
- return hasMinimumApiKeyLength(hash2) && isAlphanumericWithSeparators(hash2);
5424
+ function buildSuccessPage(landingPage) {
5425
+ const title = landingPage?.title ?? "Connected to Poe";
5426
+ const body = landingPage?.body ?? "You can close this tab and return to your terminal.";
5427
+ return [
5428
+ "<!DOCTYPE html>",
5429
+ `<html><head><meta charset=utf-8><title>${escapeHtml(title)}</title></head>`,
5430
+ '<body style="font-family:system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0">',
5431
+ '<div style="text-align:center">',
5432
+ `<h1>${escapeHtml(title)}</h1>`,
5433
+ `<p style="color:#666">${escapeHtml(body)}</p>`,
5434
+ "</div></body></html>"
5435
+ ].join("");
5436
+ }
5437
+ var DEFAULT_AUTHORIZATION_ENDPOINT, DEFAULT_TOKEN_ENDPOINT;
5438
+ var init_oauth_client = __esm({
5439
+ "packages/poe-oauth/src/oauth-client.ts"() {
5440
+ "use strict";
5441
+ DEFAULT_AUTHORIZATION_ENDPOINT = "https://poe.com/oauth/authorize";
5442
+ DEFAULT_TOKEN_ENDPOINT = "https://api.poe.com/token";
5443
+ }
5444
+ });
5445
+
5446
+ // packages/poe-oauth/src/index.ts
5447
+ var init_src7 = __esm({
5448
+ "packages/poe-oauth/src/index.ts"() {
5449
+ "use strict";
5450
+ init_check_auth();
5451
+ init_oauth_client();
5238
5452
  }
5239
- return hasMinimumApiKeyLength(key) && isAlphanumericWithSeparators(key);
5453
+ });
5454
+
5455
+ // src/cli/options.ts
5456
+ function stripBracketedPaste(value) {
5457
+ return value.replace(/\x1b\[200~/g, "").replace(/\x1b\[201~/g, "").replace(/undefinedndefined$/, "").replace(/undefined$/, "").replace(/ndefined$/, "");
5240
5458
  }
5241
5459
  function createOptionResolvers(init) {
5242
5460
  const ensure = async (input) => {
@@ -5253,7 +5471,7 @@ function createOptionResolvers(init) {
5253
5471
  }
5254
5472
  return result;
5255
5473
  };
5256
- const normalizeApiKey2 = (value) => {
5474
+ const normalizeApiKey = (value) => {
5257
5475
  const sanitized = stripBracketedPaste(value);
5258
5476
  const trimmed = sanitized.trim();
5259
5477
  if (trimmed.length === 0) {
@@ -5261,20 +5479,15 @@ function createOptionResolvers(init) {
5261
5479
  }
5262
5480
  return trimmed;
5263
5481
  };
5264
- const confirmKeyFormat = async (apiKey, assumeYes) => {
5265
- if (isValidApiKeyFormat(apiKey)) return true;
5266
- if (assumeYes) return false;
5267
- return await init.confirm(
5268
- "Key doesn't match expected API key format. Use it anyway?"
5269
- );
5482
+ const validateApiKey = async (apiKey) => {
5483
+ return await init.checkAuth(apiKey);
5270
5484
  };
5271
5485
  const resolveApiKey2 = async (input) => {
5272
5486
  const assumeYes = input.assumeYes ?? false;
5273
5487
  const allowStored = input.allowStored ?? true;
5274
5488
  if (input.value != null) {
5275
- const apiKey = normalizeApiKey2(input.value);
5276
- const accepted = await confirmKeyFormat(apiKey, assumeYes);
5277
- if (!accepted) {
5489
+ const apiKey = normalizeApiKey(input.value);
5490
+ if (!await validateApiKey(apiKey)) {
5278
5491
  throw new Error("API key rejected.");
5279
5492
  }
5280
5493
  if (!input.dryRun) {
@@ -5288,9 +5501,8 @@ function createOptionResolvers(init) {
5288
5501
  "Use API key from POE_API_KEY environment variable?"
5289
5502
  );
5290
5503
  if (useEnv) {
5291
- const apiKey = normalizeApiKey2(envValue);
5292
- const accepted = await confirmKeyFormat(apiKey, assumeYes);
5293
- if (accepted) {
5504
+ const apiKey = normalizeApiKey(envValue);
5505
+ if (await validateApiKey(apiKey)) {
5294
5506
  if (!input.dryRun) {
5295
5507
  await init.apiKeyStore.write(apiKey);
5296
5508
  }
@@ -5304,12 +5516,12 @@ function createOptionResolvers(init) {
5304
5516
  if (allowStored) {
5305
5517
  const stored = await init.apiKeyStore.read();
5306
5518
  if (stored) {
5307
- return normalizeApiKey2(stored);
5519
+ return normalizeApiKey(stored);
5308
5520
  }
5309
5521
  }
5310
5522
  if (init.loginViaOAuth) {
5311
5523
  const apiKey = await init.loginViaOAuth();
5312
- const normalized = normalizeApiKey2(apiKey);
5524
+ const normalized = normalizeApiKey(apiKey);
5313
5525
  if (!input.dryRun) {
5314
5526
  await init.apiKeyStore.write(normalized);
5315
5527
  }
@@ -5324,15 +5536,14 @@ function createOptionResolvers(init) {
5324
5536
  }
5325
5537
  let apiKey;
5326
5538
  try {
5327
- apiKey = normalizeApiKey2(result);
5539
+ apiKey = normalizeApiKey(result);
5328
5540
  } catch (error2) {
5329
5541
  if (error2 instanceof Error && error2.message === "POE API key cannot be empty.") {
5330
5542
  continue;
5331
5543
  }
5332
5544
  throw error2;
5333
5545
  }
5334
- const accepted = await confirmKeyFormat(apiKey, assumeYes);
5335
- if (!accepted) {
5546
+ if (!await validateApiKey(apiKey)) {
5336
5547
  continue;
5337
5548
  }
5338
5549
  if (!input.dryRun) {
@@ -5395,19 +5606,12 @@ function createOptionResolvers(init) {
5395
5606
  resolveModel: resolveModel2,
5396
5607
  resolveReasoning,
5397
5608
  resolveConfigName,
5398
- resolveApiKey: resolveApiKey2,
5399
- normalizeApiKey: normalizeApiKey2
5609
+ resolveApiKey: resolveApiKey2
5400
5610
  };
5401
5611
  }
5402
- var API_KEY_REFERENCE_LENGTH, API_KEY_MIN_LENGTH_RATIO, MIN_API_KEY_LENGTH;
5403
5612
  var init_options = __esm({
5404
5613
  "src/cli/options.ts"() {
5405
5614
  "use strict";
5406
- API_KEY_REFERENCE_LENGTH = 43;
5407
- API_KEY_MIN_LENGTH_RATIO = 0.8;
5408
- MIN_API_KEY_LENGTH = Math.ceil(
5409
- API_KEY_REFERENCE_LENGTH * API_KEY_MIN_LENGTH_RATIO
5410
- );
5411
5615
  }
5412
5616
  });
5413
5617
 
@@ -6270,7 +6474,8 @@ function createSdkContainer(options) {
6270
6474
  read: readApiKey,
6271
6475
  write: writeApiKey
6272
6476
  },
6273
- confirm: async () => true
6477
+ confirm: async () => true,
6478
+ checkAuth: async (apiKey) => await checkAuth({ apiKey }) !== null
6274
6479
  });
6275
6480
  const registry2 = createServiceRegistry();
6276
6481
  const providers = getDefaultProviders().filter((adapter) => !adapter.disabled);
@@ -6327,6 +6532,7 @@ var init_container = __esm({
6327
6532
  init_service_registry();
6328
6533
  init_context();
6329
6534
  init_prompts2();
6535
+ init_src7();
6330
6536
  init_options();
6331
6537
  init_logger2();
6332
6538
  init_error_logger();
@@ -7671,7 +7877,7 @@ var init_run_report = __esm({
7671
7877
  });
7672
7878
 
7673
7879
  // packages/poe-acp-client/src/index.ts
7674
- var init_src7 = __esm({
7880
+ var init_src8 = __esm({
7675
7881
  "packages/poe-acp-client/src/index.ts"() {
7676
7882
  "use strict";
7677
7883
  init_acp_client();
@@ -9710,7 +9916,7 @@ var AgentHost;
9710
9916
  var init_agent_host = __esm({
9711
9917
  "packages/poe-agent/src/runtime/agent-host.ts"() {
9712
9918
  "use strict";
9713
- init_src7();
9919
+ init_src8();
9714
9920
  init_agent_session();
9715
9921
  init_acp_core();
9716
9922
  init_run_context();
@@ -10997,7 +11203,7 @@ var init_internal = __esm({
10997
11203
  });
10998
11204
 
10999
11205
  // packages/tiny-mcp-client/src/index.ts
11000
- var init_src8 = __esm({
11206
+ var init_src9 = __esm({
11001
11207
  "packages/tiny-mcp-client/src/index.ts"() {
11002
11208
  "use strict";
11003
11209
  init_internal();
@@ -11046,7 +11252,7 @@ var DEFAULT_MCP_CLIENT_INFO, PluginApiImpl;
11046
11252
  var init_plugin_api_impl = __esm({
11047
11253
  "packages/poe-agent/src/runtime/plugin-api-impl.ts"() {
11048
11254
  "use strict";
11049
- init_src8();
11255
+ init_src9();
11050
11256
  init_hooks();
11051
11257
  DEFAULT_MCP_CLIENT_INFO = {
11052
11258
  name: "poe-agent",
@@ -11613,7 +11819,7 @@ __export(src_exports, {
11613
11819
  agent: () => agent,
11614
11820
  createAgentSession: () => createAgentSession
11615
11821
  });
11616
- var init_src9 = __esm({
11822
+ var init_src10 = __esm({
11617
11823
  "packages/poe-agent/src/index.ts"() {
11618
11824
  "use strict";
11619
11825
  init_agent();
@@ -11951,7 +12157,7 @@ function createInMemoryAcpTransport2(options) {
11951
12157
  }
11952
12158
  if (method === "session/new") {
11953
12159
  const request = params;
11954
- const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (init_src9(), src_exports));
12160
+ const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (init_src10(), src_exports));
11955
12161
  const session = await createAgentSession2({
11956
12162
  model: options.model,
11957
12163
  cwd: request.cwd || options.cwd,
@@ -12101,7 +12307,7 @@ var init_poe_agent = __esm({
12101
12307
  "src/providers/poe-agent.ts"() {
12102
12308
  "use strict";
12103
12309
  init_constants();
12104
- init_src7();
12310
+ init_src8();
12105
12311
  init_create_provider();
12106
12312
  poeAgentService = createProvider({
12107
12313
  id: "poe-agent",
@@ -13100,7 +13306,7 @@ var init_pipeline = __esm({
13100
13306
  });
13101
13307
 
13102
13308
  // packages/pipeline/src/index.ts
13103
- var init_src10 = __esm({
13309
+ var init_src11 = __esm({
13104
13310
  "packages/pipeline/src/index.ts"() {
13105
13311
  "use strict";
13106
13312
  init_loader();
@@ -13132,18 +13338,62 @@ async function runPipeline2(options) {
13132
13338
  var init_pipeline2 = __esm({
13133
13339
  async "src/sdk/pipeline.ts"() {
13134
13340
  "use strict";
13135
- init_src10();
13341
+ init_src11();
13136
13342
  init_src5();
13137
13343
  await init_spawn3();
13138
13344
  }
13139
13345
  });
13140
13346
 
13347
+ // packages/ralph/src/frontmatter/frontmatter.ts
13348
+ import { stringify, parse as parse6 } from "yaml";
13349
+ function parseFrontmatter(content) {
13350
+ const defaults = { status: "pending", iteration: 0 };
13351
+ if (!content.startsWith(`${FENCE}
13352
+ `)) {
13353
+ return { data: defaults, body: content };
13354
+ }
13355
+ const closingIndex = content.indexOf(`
13356
+ ${FENCE}
13357
+ `, FENCE.length);
13358
+ if (closingIndex === -1) {
13359
+ return { data: defaults, body: content };
13360
+ }
13361
+ const yamlBlock = content.slice(FENCE.length + 1, closingIndex);
13362
+ const body = content.slice(closingIndex + FENCE.length + 2);
13363
+ const parsed = parse6(yamlBlock);
13364
+ return {
13365
+ data: {
13366
+ status: isValidStatus(parsed?.status) ? parsed.status : defaults.status,
13367
+ iteration: typeof parsed?.iteration === "number" ? parsed.iteration : defaults.iteration
13368
+ },
13369
+ body
13370
+ };
13371
+ }
13372
+ function writeFrontmatter(data, body) {
13373
+ const yaml = stringify(data).trimEnd();
13374
+ return `${FENCE}
13375
+ ${yaml}
13376
+ ${FENCE}
13377
+ ${body}`;
13378
+ }
13379
+ function isValidStatus(value) {
13380
+ return typeof value === "string" && ["pending", "in_progress", "completed", "overbake_abort", "cancelled"].includes(
13381
+ value
13382
+ );
13383
+ }
13384
+ var FENCE;
13385
+ var init_frontmatter = __esm({
13386
+ "packages/ralph/src/frontmatter/frontmatter.ts"() {
13387
+ "use strict";
13388
+ FENCE = "---";
13389
+ }
13390
+ });
13391
+
13141
13392
  // packages/ralph/src/discovery/discovery.ts
13142
13393
  import path17 from "node:path";
13143
13394
  import * as fsPromises6 from "node:fs/promises";
13144
13395
  function createDefaultFs4() {
13145
13396
  return {
13146
- readFile: fsPromises6.readFile,
13147
13397
  readdir: fsPromises6.readdir,
13148
13398
  stat: async (filePath) => {
13149
13399
  const stat8 = await fsPromises6.stat(filePath);
@@ -13266,10 +13516,31 @@ async function runRalph(options) {
13266
13516
  options.cwd,
13267
13517
  options.homeDir
13268
13518
  );
13269
- const prompt = await fs3.readFile(absoluteDocPath, "utf8");
13519
+ const rawContent = await fs3.readFile(absoluteDocPath, "utf8");
13520
+ const { body: prompt } = parseFrontmatter(rawContent);
13270
13521
  const detector = new OverbakingDetector(threshold);
13271
13522
  const startTime = Date.now();
13272
13523
  let iterationsCompleted = 0;
13524
+ await updateFrontmatter(fs3, absoluteDocPath, prompt, "in_progress", 0);
13525
+ async function finalize2(stopReason) {
13526
+ const status = stopReasonToStatus(stopReason);
13527
+ await updateFrontmatter(
13528
+ fs3,
13529
+ absoluteDocPath,
13530
+ prompt,
13531
+ status,
13532
+ iterationsCompleted
13533
+ );
13534
+ if (stopReason === "max_iterations" && iterationsCompleted > 0) {
13535
+ await archivePlan2(fs3, absoluteDocPath);
13536
+ }
13537
+ return {
13538
+ stopReason,
13539
+ docPath: options.docPath,
13540
+ iterationsCompleted,
13541
+ totalDurationMs: Date.now() - startTime
13542
+ };
13543
+ }
13273
13544
  try {
13274
13545
  for (let iteration = 1; iteration <= options.maxIterations; iteration += 1) {
13275
13546
  assertNotAborted5(options.signal);
@@ -13286,17 +13557,19 @@ async function runRalph(options) {
13286
13557
  });
13287
13558
  } catch (error2) {
13288
13559
  if (isAbortError2(error2)) {
13289
- return {
13290
- stopReason: "cancelled",
13291
- docPath: options.docPath,
13292
- iterationsCompleted,
13293
- totalDurationMs: Date.now() - startTime
13294
- };
13560
+ return finalize2("cancelled");
13295
13561
  }
13296
13562
  throw error2;
13297
13563
  }
13298
13564
  const success2 = result.exitCode === 0;
13299
13565
  iterationsCompleted += 1;
13566
+ await updateFrontmatter(
13567
+ fs3,
13568
+ absoluteDocPath,
13569
+ prompt,
13570
+ "in_progress",
13571
+ iterationsCompleted
13572
+ );
13300
13573
  options.onIterationComplete?.(
13301
13574
  iteration,
13302
13575
  Date.now() - iterationStart,
@@ -13315,35 +13588,21 @@ async function runRalph(options) {
13315
13588
  threshold
13316
13589
  }) : "abort";
13317
13590
  if (action === "abort") {
13318
- return {
13319
- stopReason: "overbake_abort",
13320
- docPath: options.docPath,
13321
- iterationsCompleted,
13322
- totalDurationMs: Date.now() - startTime
13323
- };
13591
+ return finalize2("overbake_abort");
13324
13592
  }
13325
13593
  }
13326
13594
  } catch (error2) {
13327
13595
  if (isAbortError2(error2)) {
13328
- return {
13329
- stopReason: "cancelled",
13330
- docPath: options.docPath,
13331
- iterationsCompleted,
13332
- totalDurationMs: Date.now() - startTime
13333
- };
13596
+ return finalize2("cancelled");
13334
13597
  }
13335
13598
  throw error2;
13336
13599
  }
13337
- return {
13338
- stopReason: "max_iterations",
13339
- docPath: options.docPath,
13340
- iterationsCompleted,
13341
- totalDurationMs: Date.now() - startTime
13342
- };
13600
+ return finalize2("max_iterations");
13343
13601
  }
13344
13602
  function createDefaultFs5() {
13345
13603
  return {
13346
13604
  readFile: fsPromises7.readFile,
13605
+ writeFile: (filePath, content) => fsPromises7.writeFile(filePath, content, "utf8"),
13347
13606
  readdir: fsPromises7.readdir,
13348
13607
  stat: async (filePath) => {
13349
13608
  const stat8 = await fsPromises7.stat(filePath);
@@ -13351,7 +13610,11 @@ function createDefaultFs5() {
13351
13610
  isFile: () => stat8.isFile(),
13352
13611
  mtimeMs: stat8.mtimeMs
13353
13612
  };
13354
- }
13613
+ },
13614
+ mkdir: async (filePath, options) => {
13615
+ await fsPromises7.mkdir(filePath, options);
13616
+ },
13617
+ rename: fsPromises7.rename
13355
13618
  };
13356
13619
  }
13357
13620
  function resolveAbsoluteDocPath(docPath, cwd, homeDir) {
@@ -13374,17 +13637,41 @@ function createAbortError4() {
13374
13637
  function isAbortError2(error2) {
13375
13638
  return error2 instanceof Error && error2.name === "AbortError";
13376
13639
  }
13640
+ async function updateFrontmatter(fs3, absoluteDocPath, body, status, iteration) {
13641
+ const content = writeFrontmatter({ status, iteration }, body);
13642
+ await fs3.writeFile(absoluteDocPath, content);
13643
+ }
13644
+ async function archivePlan2(fs3, absoluteDocPath) {
13645
+ const dir = path18.dirname(absoluteDocPath);
13646
+ const archiveDir = path18.join(dir, "archive");
13647
+ const archivePath = path18.join(archiveDir, path18.basename(absoluteDocPath));
13648
+ await fs3.mkdir(archiveDir, { recursive: true });
13649
+ await fs3.rename(absoluteDocPath, archivePath);
13650
+ }
13651
+ function stopReasonToStatus(stopReason) {
13652
+ switch (stopReason) {
13653
+ case "completed":
13654
+ case "max_iterations":
13655
+ return "completed";
13656
+ case "overbake_abort":
13657
+ return "overbake_abort";
13658
+ case "cancelled":
13659
+ return "cancelled";
13660
+ }
13661
+ }
13377
13662
  var init_ralph = __esm({
13378
13663
  "packages/ralph/src/run/ralph.ts"() {
13379
13664
  "use strict";
13380
13665
  init_detector();
13666
+ init_frontmatter();
13381
13667
  }
13382
13668
  });
13383
13669
 
13384
13670
  // packages/ralph/src/index.ts
13385
- var init_src11 = __esm({
13671
+ var init_src12 = __esm({
13386
13672
  "packages/ralph/src/index.ts"() {
13387
13673
  "use strict";
13674
+ init_frontmatter();
13388
13675
  init_discovery2();
13389
13676
  init_detector();
13390
13677
  init_ralph();
@@ -13411,7 +13698,7 @@ async function runRalph2(options) {
13411
13698
  var init_ralph2 = __esm({
13412
13699
  async "src/sdk/ralph.ts"() {
13413
13700
  "use strict";
13414
- init_src11();
13701
+ init_src12();
13415
13702
  init_src5();
13416
13703
  await init_spawn3();
13417
13704
  }
@@ -13576,218 +13863,6 @@ var init_client_instance = __esm({
13576
13863
  }
13577
13864
  });
13578
13865
 
13579
- // packages/poe-oauth/src/check-auth.ts
13580
- var init_check_auth = __esm({
13581
- "packages/poe-oauth/src/check-auth.ts"() {
13582
- "use strict";
13583
- }
13584
- });
13585
-
13586
- // packages/poe-oauth/src/api-key-validation.ts
13587
- var init_api_key_validation = __esm({
13588
- "packages/poe-oauth/src/api-key-validation.ts"() {
13589
- "use strict";
13590
- }
13591
- });
13592
-
13593
- // packages/poe-oauth/src/oauth-client.ts
13594
- import http from "node:http";
13595
- import crypto from "node:crypto";
13596
- function createOAuthClient(config2) {
13597
- const fetchFn = config2.fetch ?? globalThis.fetch;
13598
- return {
13599
- authorize: () => startAuthorization(config2, fetchFn)
13600
- };
13601
- }
13602
- function generateCodeVerifier() {
13603
- return crypto.randomBytes(32).toString("base64url");
13604
- }
13605
- function generateCodeChallenge(verifier) {
13606
- return crypto.createHash("sha256").update(verifier).digest("base64url");
13607
- }
13608
- async function startAuthorization(config2, fetchFn) {
13609
- const authorizationEndpoint = config2.authorizationEndpoint ?? DEFAULT_AUTHORIZATION_ENDPOINT;
13610
- const tokenEndpoint = config2.tokenEndpoint ?? DEFAULT_TOKEN_ENDPOINT;
13611
- const codeVerifier = generateCodeVerifier();
13612
- const codeChallenge = generateCodeChallenge(codeVerifier);
13613
- const server = config2.createServer ? config2.createServer() : http.createServer();
13614
- const port = await startServer(server);
13615
- const redirectUri = `http://127.0.0.1:${port}/callback`;
13616
- const authorizationUrl = buildAuthorizationUrl({
13617
- endpoint: authorizationEndpoint,
13618
- clientId: config2.clientId,
13619
- redirectUri,
13620
- codeChallenge
13621
- });
13622
- const waitForResult = async () => {
13623
- try {
13624
- const code = await waitForAuthorizationCode(server, config2, authorizationUrl);
13625
- return await exchangeCodeForApiKey({
13626
- tokenEndpoint,
13627
- code,
13628
- codeVerifier,
13629
- clientId: config2.clientId,
13630
- redirectUri,
13631
- fetchFn
13632
- });
13633
- } finally {
13634
- server.closeAllConnections?.();
13635
- server.close();
13636
- }
13637
- };
13638
- return { authorizationUrl, waitForResult };
13639
- }
13640
- function startServer(server) {
13641
- return new Promise((resolve) => {
13642
- server.listen(0, "127.0.0.1", () => {
13643
- const address = server.address();
13644
- resolve(address.port);
13645
- });
13646
- });
13647
- }
13648
- function buildAuthorizationUrl(params) {
13649
- const url2 = new URL(params.endpoint);
13650
- url2.searchParams.set("response_type", "code");
13651
- url2.searchParams.set("client_id", params.clientId);
13652
- url2.searchParams.set("scope", "apikey:create");
13653
- url2.searchParams.set("code_challenge", params.codeChallenge);
13654
- url2.searchParams.set("code_challenge_method", "S256");
13655
- url2.searchParams.set("redirect_uri", params.redirectUri);
13656
- return url2.toString();
13657
- }
13658
- function waitForAuthorizationCode(server, config2, authorizationUrl) {
13659
- return new Promise((resolve, reject) => {
13660
- let settled = false;
13661
- const settle = (fn) => {
13662
- if (!settled) {
13663
- settled = true;
13664
- fn();
13665
- }
13666
- };
13667
- server.on("request", (req, res) => {
13668
- const url2 = new URL(req.url, `http://127.0.0.1`);
13669
- if (url2.pathname !== "/callback") {
13670
- res.writeHead(404);
13671
- res.end("Not found");
13672
- return;
13673
- }
13674
- const error2 = url2.searchParams.get("error");
13675
- if (error2) {
13676
- const description = url2.searchParams.get("error_description") ?? error2;
13677
- res.writeHead(400);
13678
- res.end(`Authorization failed: ${description}`);
13679
- settle(() => reject(new Error(`OAuth authorization failed: ${error2} \u2014 ${description}`)));
13680
- return;
13681
- }
13682
- const code = url2.searchParams.get("code");
13683
- if (!code) {
13684
- res.writeHead(400);
13685
- res.end("Missing authorization code");
13686
- settle(() => reject(new Error("OAuth callback missing authorization code")));
13687
- return;
13688
- }
13689
- res.writeHead(200, { "Content-Type": "text/html" });
13690
- res.end(buildSuccessPage());
13691
- settle(() => resolve(code));
13692
- });
13693
- if (config2.readLine) {
13694
- config2.readLine().then((input) => {
13695
- const code = extractCodeFromInput(input);
13696
- if (code) {
13697
- settle(() => resolve(code));
13698
- }
13699
- }).catch(() => {
13700
- });
13701
- }
13702
- if (config2.openBrowser) {
13703
- config2.openBrowser(authorizationUrl).catch(
13704
- (err) => settle(() => reject(err))
13705
- );
13706
- }
13707
- });
13708
- }
13709
- function extractCodeFromInput(input) {
13710
- const trimmed = input.replace(/[\r\n]/g, "").trim();
13711
- if (trimmed.length === 0) {
13712
- return null;
13713
- }
13714
- try {
13715
- const url2 = new URL(trimmed);
13716
- return url2.searchParams.get("code");
13717
- } catch {
13718
- return trimmed;
13719
- }
13720
- }
13721
- async function exchangeCodeForApiKey(params) {
13722
- const body = new URLSearchParams({
13723
- grant_type: "authorization_code",
13724
- code: params.code,
13725
- code_verifier: params.codeVerifier,
13726
- client_id: params.clientId,
13727
- redirect_uri: params.redirectUri
13728
- });
13729
- const response = await params.fetchFn(params.tokenEndpoint, {
13730
- method: "POST",
13731
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
13732
- body: body.toString()
13733
- });
13734
- if (!response.ok) {
13735
- const text4 = await response.text();
13736
- const description = parseErrorDescription(text4);
13737
- throw new Error(description ?? `Token exchange failed (${response.status}): ${text4}`);
13738
- }
13739
- const data = await response.json();
13740
- if (typeof data.api_key !== "string" || data.api_key.length === 0) {
13741
- throw new Error("Token response missing api_key field");
13742
- }
13743
- return {
13744
- apiKey: data.api_key,
13745
- expiresIn: typeof data.api_key_expires_in === "number" ? data.api_key_expires_in : null
13746
- };
13747
- }
13748
- function parseErrorDescription(text4) {
13749
- try {
13750
- const data = JSON.parse(text4);
13751
- if (typeof data.error_description === "string") {
13752
- return data.error_description;
13753
- }
13754
- if (typeof data.error === "string") {
13755
- return data.error;
13756
- }
13757
- } catch {
13758
- }
13759
- return null;
13760
- }
13761
- function buildSuccessPage() {
13762
- return [
13763
- "<!DOCTYPE html>",
13764
- "<html><head><meta charset=utf-8><title>Connected to Poe</title></head>",
13765
- '<body style="font-family:system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0">',
13766
- '<div style="text-align:center">',
13767
- "<h1>Connected to Poe</h1>",
13768
- '<p style="color:#666">You can close this tab and return to your terminal.</p>',
13769
- "</div></body></html>"
13770
- ].join("");
13771
- }
13772
- var DEFAULT_AUTHORIZATION_ENDPOINT, DEFAULT_TOKEN_ENDPOINT;
13773
- var init_oauth_client = __esm({
13774
- "packages/poe-oauth/src/oauth-client.ts"() {
13775
- "use strict";
13776
- DEFAULT_AUTHORIZATION_ENDPOINT = "https://poe.com/oauth/authorize";
13777
- DEFAULT_TOKEN_ENDPOINT = "https://api.poe.com/token";
13778
- }
13779
- });
13780
-
13781
- // packages/poe-oauth/src/index.ts
13782
- var init_src12 = __esm({
13783
- "packages/poe-oauth/src/index.ts"() {
13784
- "use strict";
13785
- init_check_auth();
13786
- init_api_key_validation();
13787
- init_oauth_client();
13788
- }
13789
- });
13790
-
13791
13866
  // src/cli/oauth-login.ts
13792
13867
  import { exec as exec2 } from "node:child_process";
13793
13868
  import readline from "node:readline";
@@ -13830,7 +13905,7 @@ function openInBrowser(url2) {
13830
13905
  var init_oauth_login = __esm({
13831
13906
  "src/cli/oauth-login.ts"() {
13832
13907
  "use strict";
13833
- init_src12();
13908
+ init_src7();
13834
13909
  init_src4();
13835
13910
  }
13836
13911
  });
@@ -13900,6 +13975,7 @@ function createCliContainer(dependencies) {
13900
13975
  read: readApiKey,
13901
13976
  write: writeApiKey
13902
13977
  },
13978
+ checkAuth: async (apiKey) => await checkAuth({ apiKey }) !== null,
13903
13979
  confirm: async (message) => {
13904
13980
  const result = await confirm2({ message });
13905
13981
  if (isCancel2(result)) {
@@ -13948,6 +14024,7 @@ var init_container2 = __esm({
13948
14024
  init_service_registry();
13949
14025
  init_context();
13950
14026
  init_prompts2();
14027
+ init_src7();
13951
14028
  init_options();
13952
14029
  init_logger2();
13953
14030
  init_error_logger();
@@ -14329,7 +14406,7 @@ function registerAgentCommand(program, container) {
14329
14406
  }
14330
14407
  let session;
14331
14408
  try {
14332
- const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (init_src9(), src_exports));
14409
+ const { createAgentSession: createAgentSession2 } = await Promise.resolve().then(() => (init_src10(), src_exports));
14333
14410
  session = await createAgentSession2({
14334
14411
  model: options.model,
14335
14412
  apiKey: options.apiKey,
@@ -21680,7 +21757,7 @@ var init_errors4 = __esm({
21680
21757
  });
21681
21758
 
21682
21759
  // node_modules/zod/v4/core/parse.js
21683
- var _parse, parse6, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsync, safeParseAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync;
21760
+ var _parse, parse7, _parseAsync, parseAsync, _safeParse, safeParse, _safeParseAsync, safeParseAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync;
21684
21761
  var init_parse = __esm({
21685
21762
  "node_modules/zod/v4/core/parse.js"() {
21686
21763
  init_core();
@@ -21699,7 +21776,7 @@ var init_parse = __esm({
21699
21776
  }
21700
21777
  return result.value;
21701
21778
  };
21702
- parse6 = /* @__PURE__ */ _parse($ZodRealError);
21779
+ parse7 = /* @__PURE__ */ _parse($ZodRealError);
21703
21780
  _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
21704
21781
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
21705
21782
  let result = schema._zod.run({ value, issues: [] }, ctx);
@@ -24418,10 +24495,10 @@ var init_schemas = __esm({
24418
24495
  throw new Error("implement() must be called with a function");
24419
24496
  }
24420
24497
  return function(...args) {
24421
- const parsedArgs = inst._def.input ? parse6(inst._def.input, args) : args;
24498
+ const parsedArgs = inst._def.input ? parse7(inst._def.input, args) : args;
24422
24499
  const result = Reflect.apply(func, this, parsedArgs);
24423
24500
  if (inst._def.output) {
24424
- return parse6(inst._def.output, result);
24501
+ return parse7(inst._def.output, result);
24425
24502
  }
24426
24503
  return result;
24427
24504
  };
@@ -26977,12 +27054,12 @@ var init_errors5 = __esm({
26977
27054
  });
26978
27055
 
26979
27056
  // node_modules/zod/v4/classic/parse.js
26980
- var parse7, parseAsync2, safeParse2, safeParseAsync2, encode2, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2;
27057
+ var parse8, parseAsync2, safeParse2, safeParseAsync2, encode2, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2;
26981
27058
  var init_parse3 = __esm({
26982
27059
  "node_modules/zod/v4/classic/parse.js"() {
26983
27060
  init_core2();
26984
27061
  init_errors5();
26985
- parse7 = /* @__PURE__ */ _parse(ZodRealError);
27062
+ parse8 = /* @__PURE__ */ _parse(ZodRealError);
26986
27063
  parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
26987
27064
  safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
26988
27065
  safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
@@ -27658,7 +27735,7 @@ var init_schemas3 = __esm({
27658
27735
  reg.add(inst, meta3);
27659
27736
  return inst;
27660
27737
  });
27661
- inst.parse = (data, params) => parse7(inst, data, params, { callee: inst.parse });
27738
+ inst.parse = (data, params) => parse8(inst, data, params, { callee: inst.parse });
27662
27739
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
27663
27740
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
27664
27741
  inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
@@ -30509,10 +30586,10 @@ var require_code = __commonJS({
30509
30586
  function interpolate2(x) {
30510
30587
  return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify2(Array.isArray(x) ? x.join(",") : x);
30511
30588
  }
30512
- function stringify(x) {
30589
+ function stringify2(x) {
30513
30590
  return new _Code(safeStringify2(x));
30514
30591
  }
30515
- exports.stringify = stringify;
30592
+ exports.stringify = stringify2;
30516
30593
  function safeStringify2(x) {
30517
30594
  return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
30518
30595
  }
@@ -33927,24 +34004,24 @@ var require_fast_uri = __commonJS({
33927
34004
  function normalize(uri, options) {
33928
34005
  if (typeof uri === "string") {
33929
34006
  uri = /** @type {T} */
33930
- serialize3(parse8(uri, options), options);
34007
+ serialize3(parse9(uri, options), options);
33931
34008
  } else if (typeof uri === "object") {
33932
34009
  uri = /** @type {T} */
33933
- parse8(serialize3(uri, options), options);
34010
+ parse9(serialize3(uri, options), options);
33934
34011
  }
33935
34012
  return uri;
33936
34013
  }
33937
34014
  function resolve(baseURI, relativeURI, options) {
33938
34015
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
33939
- const resolved = resolveComponent(parse8(baseURI, schemelessOptions), parse8(relativeURI, schemelessOptions), schemelessOptions, true);
34016
+ const resolved = resolveComponent(parse9(baseURI, schemelessOptions), parse9(relativeURI, schemelessOptions), schemelessOptions, true);
33940
34017
  schemelessOptions.skipEscape = true;
33941
34018
  return serialize3(resolved, schemelessOptions);
33942
34019
  }
33943
34020
  function resolveComponent(base, relative, options, skipNormalization) {
33944
34021
  const target = {};
33945
34022
  if (!skipNormalization) {
33946
- base = parse8(serialize3(base, options), options);
33947
- relative = parse8(serialize3(relative, options), options);
34023
+ base = parse9(serialize3(base, options), options);
34024
+ relative = parse9(serialize3(relative, options), options);
33948
34025
  }
33949
34026
  options = options || {};
33950
34027
  if (!options.tolerant && relative.scheme) {
@@ -33996,13 +34073,13 @@ var require_fast_uri = __commonJS({
33996
34073
  function equal(uriA, uriB, options) {
33997
34074
  if (typeof uriA === "string") {
33998
34075
  uriA = unescape(uriA);
33999
- uriA = serialize3(normalizeComponentEncoding(parse8(uriA, options), true), { ...options, skipEscape: true });
34076
+ uriA = serialize3(normalizeComponentEncoding(parse9(uriA, options), true), { ...options, skipEscape: true });
34000
34077
  } else if (typeof uriA === "object") {
34001
34078
  uriA = serialize3(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
34002
34079
  }
34003
34080
  if (typeof uriB === "string") {
34004
34081
  uriB = unescape(uriB);
34005
- uriB = serialize3(normalizeComponentEncoding(parse8(uriB, options), true), { ...options, skipEscape: true });
34082
+ uriB = serialize3(normalizeComponentEncoding(parse9(uriB, options), true), { ...options, skipEscape: true });
34006
34083
  } else if (typeof uriB === "object") {
34007
34084
  uriB = serialize3(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
34008
34085
  }
@@ -34071,7 +34148,7 @@ var require_fast_uri = __commonJS({
34071
34148
  return uriTokens.join("");
34072
34149
  }
34073
34150
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
34074
- function parse8(uri, opts) {
34151
+ function parse9(uri, opts) {
34075
34152
  const options = Object.assign({}, opts);
34076
34153
  const parsed = {
34077
34154
  scheme: void 0,
@@ -34165,7 +34242,7 @@ var require_fast_uri = __commonJS({
34165
34242
  resolveComponent,
34166
34243
  equal,
34167
34244
  serialize: serialize3,
34168
- parse: parse8
34245
+ parse: parse9
34169
34246
  };
34170
34247
  module.exports = fastUri;
34171
34248
  module.exports.default = fastUri;
@@ -38046,7 +38123,7 @@ var init_configs3 = __esm({
38046
38123
  });
38047
38124
 
38048
38125
  // packages/agent-skill-config/src/templates.ts
38049
- import { readFile as readFile7 } from "node:fs/promises";
38126
+ import { readFile as readFile6 } from "node:fs/promises";
38050
38127
  async function getTemplates() {
38051
38128
  if (templatesCache) {
38052
38129
  return templatesCache;
@@ -38055,7 +38132,7 @@ async function getTemplates() {
38055
38132
  "./templates/poe-generate.md",
38056
38133
  import.meta.url
38057
38134
  );
38058
- const poeGenerateTemplate = await readFile7(poeGenerateTemplateUrl, "utf8");
38135
+ const poeGenerateTemplate = await readFile6(poeGenerateTemplateUrl, "utf8");
38059
38136
  templatesCache = {
38060
38137
  "poe-generate.md": poeGenerateTemplate
38061
38138
  };
@@ -39022,7 +39099,7 @@ var init_models = __esm({
39022
39099
 
39023
39100
  // src/cli/commands/pipeline.ts
39024
39101
  import path26 from "node:path";
39025
- import { readFile as readFile8, stat as stat7 } from "node:fs/promises";
39102
+ import { readFile as readFile7, stat as stat7 } from "node:fs/promises";
39026
39103
  import { fileURLToPath as fileURLToPath4 } from "node:url";
39027
39104
  function formatDuration(ms) {
39028
39105
  const totalSeconds = Math.round(ms / 1e3);
@@ -39076,8 +39153,8 @@ async function loadPipelineTemplates() {
39076
39153
  continue;
39077
39154
  }
39078
39155
  const [skillPlan, steps] = await Promise.all([
39079
- readFile8(path26.join(templateRoot, "SKILL_plan.md"), "utf8"),
39080
- readFile8(path26.join(templateRoot, "steps.yaml.hbs"), "utf8")
39156
+ readFile7(path26.join(templateRoot, "SKILL_plan.md"), "utf8"),
39157
+ readFile7(path26.join(templateRoot, "steps.yaml.hbs"), "utf8")
39081
39158
  ]);
39082
39159
  pipelineTemplatesCache = { skillPlan, steps };
39083
39160
  return pipelineTemplatesCache;
@@ -39408,7 +39485,7 @@ var init_pipeline4 = __esm({
39408
39485
  init_errors();
39409
39486
  init_shared();
39410
39487
  await init_pipeline2();
39411
- init_src10();
39488
+ init_src11();
39412
39489
  DEFAULT_PIPELINE_AGENT = "claude-code";
39413
39490
  DEFAULT_PIPELINE_SCOPE = "local";
39414
39491
  pipelineTemplatesCache = null;
@@ -39627,7 +39704,7 @@ var init_ralph3 = __esm({
39627
39704
  init_src4();
39628
39705
  init_src3();
39629
39706
  init_src5();
39630
- init_src11();
39707
+ init_src12();
39631
39708
  init_errors();
39632
39709
  init_shared();
39633
39710
  await init_ralph2();
@@ -39641,7 +39718,7 @@ var init_package = __esm({
39641
39718
  "package.json"() {
39642
39719
  package_default = {
39643
39720
  name: "poe-code",
39644
- version: "3.0.102",
39721
+ version: "3.0.104",
39645
39722
  description: "CLI tool to configure Poe API for developer workflows.",
39646
39723
  type: "module",
39647
39724
  main: "./dist/index.js",