poe-code 3.0.361 → 3.0.362

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
@@ -26384,7 +26384,7 @@ async function runDocumentWorkflow(options) {
26384
26384
  return;
26385
26385
  }
26386
26386
  let shouldStop = false;
26387
- for (let iteration = 0; iteration < initialWorkflow.maxIterations; iteration += 1) {
26387
+ for (let iteration = 0; ; iteration += 1) {
26388
26388
  throwIfAborted(options.signal);
26389
26389
  currentWorkflow = iteration === 0 ? initialWorkflow : await readWorkflow2();
26390
26390
  if (iteration >= currentWorkflow.maxIterations) {
@@ -26419,6 +26419,9 @@ async function runDocumentWorkflow(options) {
26419
26419
  if (shouldStop) {
26420
26420
  break;
26421
26421
  }
26422
+ if (iteration + 1 >= currentWorkflow.maxIterations) {
26423
+ break;
26424
+ }
26422
26425
  }
26423
26426
  } catch (error3) {
26424
26427
  pendingError = error3;
@@ -70517,13 +70520,20 @@ function parseFrontmatterData(value) {
70517
70520
  throw new Error('Invalid Ralph frontmatter: "kind" must be "ralph".');
70518
70521
  }
70519
70522
  }
70520
- const statusValue = parsed ? getOwnEntry27(parsed, "status") : void 0;
70521
- const parsedStatus = isRecord26(statusValue) ? statusValue : void 0;
70522
- const state = parsePlanStatus(parsedStatus ? getOwnEntry27(parsedStatus, "state") : void 0) ?? parseLegacyStatus(statusValue) ?? defaults2.status.state;
70523
- const iteration = parseNonNegativeInteger2(parsedStatus ? getOwnEntry27(parsedStatus, "iteration") : void 0) ?? parseNonNegativeInteger2(parsed ? getOwnEntry27(parsed, "iteration") : void 0) ?? defaults2.status.iteration;
70524
- const agent3 = parseAgent2(parsed ? getOwnEntry27(parsed, "agent") : void 0);
70523
+ const { state, iteration } = parseStatusFields(parsed, defaults2.status);
70524
+ const agentValue = parsed ? getOwnEntry27(parsed, "agent") : void 0;
70525
+ const agent3 = parseAgent2(agentValue);
70526
+ if (parsed !== void 0 && hasOwnEntry3(parsed, "agent") && agent3 === void 0) {
70527
+ throw new Error(
70528
+ 'Invalid Ralph frontmatter: "agent" must be a non-empty string or non-empty string array.'
70529
+ );
70530
+ }
70525
70531
  const extendsValue = parseBoolean2(parsed ? getOwnEntry27(parsed, "extends") : void 0);
70526
- const iterations = parsePositiveInteger(parsed ? getOwnEntry27(parsed, "iterations") : void 0);
70532
+ const iterationsValue = parsed ? getOwnEntry27(parsed, "iterations") : void 0;
70533
+ const iterations = parsePositiveInteger(iterationsValue);
70534
+ if (parsed !== void 0 && hasOwnEntry3(parsed, "iterations") && iterations === void 0) {
70535
+ throw new Error('Invalid Ralph frontmatter: "iterations" must be a positive integer.');
70536
+ }
70527
70537
  const skills2 = parseSkills4(parsed ? getOwnEntry27(parsed, "skills") : void 0);
70528
70538
  const hooks = parseHooks4(parsed ? getOwnEntry27(parsed, "hooks") : void 0);
70529
70539
  return {
@@ -70538,6 +70548,50 @@ function parseFrontmatterData(value) {
70538
70548
  }
70539
70549
  };
70540
70550
  }
70551
+ function parseStatusFields(parsed, defaults2) {
70552
+ if (parsed === void 0) {
70553
+ return defaults2;
70554
+ }
70555
+ const statusValue = getOwnEntry27(parsed, "status");
70556
+ const legacyIterationValue = getOwnEntry27(parsed, "iteration");
70557
+ const hasStatus = hasOwnEntry3(parsed, "status");
70558
+ const hasLegacyIteration = hasOwnEntry3(parsed, "iteration");
70559
+ const parsedStatus = isRecord26(statusValue) ? statusValue : void 0;
70560
+ if (hasLegacyIteration && parseNonNegativeInteger2(legacyIterationValue) === void 0) {
70561
+ throw new Error('Invalid Ralph frontmatter: "iteration" must be a non-negative integer.');
70562
+ }
70563
+ if (parsedStatus !== void 0) {
70564
+ rejectUnknownKeys2(parsedStatus, ["state", "iteration"], "status");
70565
+ const statusStateValue = getOwnEntry27(parsedStatus, "state");
70566
+ const statusIterationValue = getOwnEntry27(parsedStatus, "iteration");
70567
+ const state = parsePlanStatus(statusStateValue);
70568
+ const iteration = parseNonNegativeInteger2(statusIterationValue);
70569
+ if (hasOwnEntry3(parsedStatus, "state") && state === void 0) {
70570
+ throw new Error(
70571
+ 'Invalid Ralph frontmatter: "status.state" must be "open", "in_progress", "completed", or "failed".'
70572
+ );
70573
+ }
70574
+ if (hasOwnEntry3(parsedStatus, "iteration") && iteration === void 0) {
70575
+ throw new Error(
70576
+ 'Invalid Ralph frontmatter: "status.iteration" must be a non-negative integer.'
70577
+ );
70578
+ }
70579
+ return {
70580
+ state: state ?? defaults2.state,
70581
+ iteration: iteration ?? parseNonNegativeInteger2(legacyIterationValue) ?? defaults2.iteration
70582
+ };
70583
+ }
70584
+ const legacyState = parseLegacyStatus(statusValue);
70585
+ if (hasStatus && legacyState === void 0) {
70586
+ throw new Error(
70587
+ 'Invalid Ralph frontmatter: "status" must be "open", "pending", "cancelled", "overbake_abort", "in_progress", or "completed".'
70588
+ );
70589
+ }
70590
+ return {
70591
+ state: legacyState ?? defaults2.state,
70592
+ iteration: parseNonNegativeInteger2(legacyIterationValue) ?? defaults2.iteration
70593
+ };
70594
+ }
70541
70595
  function parseAgent2(value) {
70542
70596
  if (typeof value === "string") {
70543
70597
  const trimmed = value.trim();
@@ -70547,7 +70601,7 @@ function parseAgent2(value) {
70547
70601
  return void 0;
70548
70602
  }
70549
70603
  if (value.length === 0) {
70550
- return [];
70604
+ return void 0;
70551
70605
  }
70552
70606
  const agents = [];
70553
70607
  for (const item of value) {
@@ -70641,8 +70695,11 @@ function parseBoolean2(value) {
70641
70695
  function isRecord26(value) {
70642
70696
  return typeof value === "object" && value !== null && !Array.isArray(value);
70643
70697
  }
70698
+ function hasOwnEntry3(record, key2) {
70699
+ return Object.prototype.hasOwnProperty.call(record, key2);
70700
+ }
70644
70701
  function getOwnEntry27(record, key2) {
70645
- return Object.prototype.hasOwnProperty.call(record, key2) ? record[key2] : void 0;
70702
+ return hasOwnEntry3(record, key2) ? record[key2] : void 0;
70646
70703
  }
70647
70704
  var ralphDocumentSchemaId, DEFAULT_STATUS;
70648
70705
  var init_frontmatter3 = __esm({
@@ -70848,7 +70905,7 @@ async function runRalph(options) {
70848
70905
  await updateFrontmatter2(fs29, absoluteDocPath, "open", iterationsCompleted);
70849
70906
  return;
70850
70907
  }
70851
- if (iterationNumber === config2.maxIterations) {
70908
+ if (iterationNumber === currentConfig.maxIterations) {
70852
70909
  await updateFrontmatter2(fs29, absoluteDocPath, "completed", iterationsCompleted);
70853
70910
  stopReason = "max_iterations";
70854
70911
  return;
@@ -74136,7 +74193,7 @@ function resolveConfiguredTaskListOptions(cfg) {
74136
74193
  const tasksRecord = tasks;
74137
74194
  const taskType = getOwnEntry31(tasksRecord, "type");
74138
74195
  const taskProject = getOwnEntry31(tasksRecord, "project");
74139
- if (!hasOwnEntry3(tasksRecord, "path") && !(taskType === "gh-issues" && taskProject === void 0)) {
74196
+ if (!hasOwnEntry4(tasksRecord, "path") && !(taskType === "gh-issues" && taskProject === void 0)) {
74140
74197
  return tasks;
74141
74198
  }
74142
74199
  return {
@@ -74148,11 +74205,11 @@ function resolveConfiguredTaskListOptions(cfg) {
74148
74205
  }
74149
74206
  };
74150
74207
  }
74151
- function hasOwnEntry3(record, key2) {
74208
+ function hasOwnEntry4(record, key2) {
74152
74209
  return Object.prototype.hasOwnProperty.call(record, key2);
74153
74210
  }
74154
74211
  function getOwnEntry31(record, key2) {
74155
- return hasOwnEntry3(record, key2) ? record[key2] : void 0;
74212
+ return hasOwnEntry4(record, key2) ? record[key2] : void 0;
74156
74213
  }
74157
74214
  function deriveStateEvents(stateOrder, terminalStateNames) {
74158
74215
  const terminalStates = new Set(terminalStateNames);
@@ -137933,7 +137990,7 @@ function readTaskListOptions(frontmatter, workflowPath) {
137933
137990
  );
137934
137991
  }
137935
137992
  const resolved = resolveStringValues2(tasks);
137936
- if (hasOwnEntry4(resolved, "path") && typeof resolved.path === "string") {
137993
+ if (hasOwnEntry5(resolved, "path") && typeof resolved.path === "string") {
137937
137994
  resolved.path = resolveWorkflowRelativePath(resolved.path, workflowPath);
137938
137995
  }
137939
137996
  return resolved;
@@ -138096,11 +138153,11 @@ function resolveWorkflowRelativePath(value, workflowPath) {
138096
138153
  function asRecord6(value) {
138097
138154
  return isPlainRecord6(value) ? value : void 0;
138098
138155
  }
138099
- function hasOwnEntry4(record, key2) {
138156
+ function hasOwnEntry5(record, key2) {
138100
138157
  return Object.prototype.hasOwnProperty.call(record, key2);
138101
138158
  }
138102
138159
  function getOwnEntry37(record, key2) {
138103
- return hasOwnEntry4(record, key2) ? record[key2] : void 0;
138160
+ return hasOwnEntry5(record, key2) ? record[key2] : void 0;
138104
138161
  }
138105
138162
  function isPlainRecord6(value) {
138106
138163
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -138957,7 +139014,7 @@ var init_package2 = __esm({
138957
139014
  "package.json"() {
138958
139015
  package_default2 = {
138959
139016
  name: "poe-code",
138960
- version: "3.0.361",
139017
+ version: "3.0.362",
138961
139018
  description: "CLI tool to configure Poe API for developer workflows.",
138962
139019
  type: "module",
138963
139020
  main: "./dist/index.js",