poe-code 3.0.342 → 3.0.343

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
@@ -73219,10 +73219,14 @@ function validateStateDefinitions(value) {
73219
73219
  throw new Error("Workflow config requires at least one state.");
73220
73220
  }
73221
73221
  for (const [name, definition] of entries) {
73222
+ const stateName = String(name);
73223
+ if (stateName.trim().length === 0) {
73224
+ throw new Error("State names must not be empty.");
73225
+ }
73222
73226
  if (!isRecord28(definition)) {
73223
- throw new Error(`State "${String(name)}" must be an object.`);
73227
+ throw new Error(`State "${stateName}" must be an object.`);
73224
73228
  }
73225
- validateStateDefinition(String(name), definition);
73229
+ validateStateDefinition(stateName, definition);
73226
73230
  }
73227
73231
  }
73228
73232
  async function validateDispatch(cfg, taskList) {
@@ -73294,6 +73298,9 @@ function validateStateDefinition(name, definition) {
73294
73298
  if (prompt !== void 0 && typeof prompt !== "string") {
73295
73299
  throw new Error(`State "${name}" prompt must be a string.`);
73296
73300
  }
73301
+ if (typeof prompt === "string" && prompt.trim().length === 0) {
73302
+ throw new Error(`State "${name}" prompt must not be empty.`);
73303
+ }
73297
73304
  if (terminal !== void 0 && typeof terminal !== "boolean") {
73298
73305
  throw new Error(`State "${name}" terminal must be a boolean.`);
73299
73306
  }
@@ -73410,13 +73417,13 @@ function resolveConfig2(raw, cwd) {
73410
73417
  },
73411
73418
  workspace: {
73412
73419
  root: resolvePathValue(
73413
- readString8(getOwnEntry30(workspace, "root")) ?? path96.join(os13.tmpdir(), "poe-code-maestro"),
73420
+ readString8(getOwnEntry30(workspace, "root"), "workspace.root") ?? path96.join(os13.tmpdir(), "poe-code-maestro"),
73414
73421
  cwd
73415
73422
  )
73416
73423
  },
73417
73424
  agent: {
73418
- service: readString8(getOwnEntry30(agent3, "service")) ?? "codex",
73419
- list: readString8(resolveStringValue(getOwnEntry30(agent3, "list"))),
73425
+ service: readString8(getOwnEntry30(agent3, "service"), "agent.service") ?? "codex",
73426
+ list: readString8(resolveStringValue(getOwnEntry30(agent3, "list")), "agent.list"),
73420
73427
  maxConcurrentAgents: readPositiveInteger(
73421
73428
  getOwnEntry30(agent3, "max_concurrent_agents"),
73422
73429
  1,
@@ -73532,25 +73539,34 @@ function expandHome5(value) {
73532
73539
  }
73533
73540
  return value;
73534
73541
  }
73535
- function readString8(value) {
73536
- if (typeof value !== "string") {
73542
+ function readString8(value, field) {
73543
+ if (value === void 0) {
73537
73544
  return void 0;
73538
73545
  }
73546
+ if (typeof value !== "string") {
73547
+ throw new Error(`Expected "${field}" to be a string.`);
73548
+ }
73539
73549
  const trimmed = value.trim();
73540
73550
  return trimmed.length > 0 ? value : void 0;
73541
73551
  }
73542
- function readNumber3(value, fallback) {
73543
- return typeof value === "number" && Number.isFinite(value) ? value : fallback;
73552
+ function readNumber3(value, fallback, field) {
73553
+ if (value === void 0) {
73554
+ return fallback;
73555
+ }
73556
+ if (typeof value !== "number" || !Number.isFinite(value)) {
73557
+ throw new Error(`Expected "${field}" to be a number.`);
73558
+ }
73559
+ return value;
73544
73560
  }
73545
73561
  function readPositiveInteger(value, fallback, field) {
73546
- const numberValue2 = readNumber3(value, fallback);
73562
+ const numberValue2 = readNumber3(value, fallback, field);
73547
73563
  if (!Number.isInteger(numberValue2) || numberValue2 <= 0) {
73548
73564
  throw new Error(`Expected "${field}" to be a positive integer.`);
73549
73565
  }
73550
73566
  return numberValue2;
73551
73567
  }
73552
73568
  function readNonNegativeInteger(value, fallback, field) {
73553
- const numberValue2 = readNumber3(value, fallback);
73569
+ const numberValue2 = readNumber3(value, fallback, field);
73554
73570
  if (!Number.isInteger(numberValue2) || numberValue2 < 0) {
73555
73571
  throw new Error(`Expected "${field}" to be a non-negative integer.`);
73556
73572
  }
@@ -74542,7 +74558,22 @@ function resolveWorkflowPath2(name, cwd) {
74542
74558
  return path99.resolve(cwd, filename);
74543
74559
  }
74544
74560
  function isValidWorkflowName(name) {
74545
- return name.length > 0 && !name.includes("/") && !name.includes("\\");
74561
+ if (name.length === 0 || name.trim() !== name || name === "." || name === "..") {
74562
+ return false;
74563
+ }
74564
+ for (const character of name) {
74565
+ if (!isWorkflowNameCharacter(character)) {
74566
+ return false;
74567
+ }
74568
+ }
74569
+ return true;
74570
+ }
74571
+ function isWorkflowNameCharacter(character) {
74572
+ const code = character.charCodeAt(0);
74573
+ const isUppercase = code >= 65 && code <= 90;
74574
+ const isLowercase = code >= 97 && code <= 122;
74575
+ const isDigit5 = code >= 48 && code <= 57;
74576
+ return isUppercase || isLowercase || isDigit5 || character === "_" || character === "-";
74546
74577
  }
74547
74578
  var init_workflow_path = __esm({
74548
74579
  "packages/maestro/src/workflow-path.ts"() {
@@ -138336,7 +138367,7 @@ var init_package2 = __esm({
138336
138367
  "package.json"() {
138337
138368
  package_default2 = {
138338
138369
  name: "poe-code",
138339
- version: "3.0.342",
138370
+ version: "3.0.343",
138340
138371
  description: "CLI tool to configure Poe API for developer workflows.",
138341
138372
  type: "module",
138342
138373
  main: "./dist/index.js",