poe-code 3.0.218 → 3.0.219

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.
@@ -18768,6 +18768,12 @@ var init_text = __esm({
18768
18768
  if (format === "markdown") return `*${content}*`;
18769
18769
  return getTheme().muted(content);
18770
18770
  },
18771
+ error(content) {
18772
+ const format = resolveOutputFormat();
18773
+ if (format === "json") return content;
18774
+ if (format === "markdown") return `**${content}**`;
18775
+ return getTheme().error(content);
18776
+ },
18771
18777
  badge(content) {
18772
18778
  const format = resolveOutputFormat();
18773
18779
  if (format === "json") return content;
@@ -28864,9 +28870,15 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
28864
28870
 
28865
28871
  // packages/toolcraft/src/user-error.ts
28866
28872
  var UserError = class extends Error {
28873
+ constructor(message2, options) {
28874
+ super(message2, options);
28875
+ this.name = "UserError";
28876
+ }
28877
+ };
28878
+ var ToolcraftBugError = class extends Error {
28867
28879
  constructor(message2) {
28868
28880
  super(message2);
28869
- this.name = "UserError";
28881
+ this.name = "ToolcraftBugError";
28870
28882
  }
28871
28883
  };
28872
28884
 
@@ -28927,22 +28939,33 @@ function Record(value) {
28927
28939
  function isOptionalSchema(schema) {
28928
28940
  return schema.kind === "optional";
28929
28941
  }
28942
+ function getRequiredKeys(schema) {
28943
+ return Object.keys(schema.shape).filter((key2) => !isOptionalSchema(schema.shape[key2])).sort();
28944
+ }
28930
28945
  function getRequiredKeyFingerprint(schema) {
28931
- const requiredKeys = Object.keys(schema.shape).filter((key2) => !isOptionalSchema(schema.shape[key2])).sort();
28932
- return JSON.stringify(requiredKeys);
28946
+ return getRequiredKeys(schema).join("+");
28947
+ }
28948
+ function assertUniqueRequiredKeyFingerprints(branches) {
28949
+ const fingerprints = /* @__PURE__ */ new Map();
28950
+ branches.forEach((branch, index) => {
28951
+ const fingerprint = getRequiredKeyFingerprint(branch);
28952
+ const indices = fingerprints.get(fingerprint) ?? [];
28953
+ indices.push(index);
28954
+ fingerprints.set(fingerprint, indices);
28955
+ });
28956
+ for (const [fingerprint, indices] of fingerprints) {
28957
+ if (indices.length > 1) {
28958
+ throw new Error(
28959
+ `Union branches [${indices.join(", ")}] share required-key fingerprint "${fingerprint}". Each branch must require a distinct set of keys.`
28960
+ );
28961
+ }
28962
+ }
28933
28963
  }
28934
28964
  function assertValidBranches2(branches) {
28935
28965
  if (branches.length === 0) {
28936
28966
  throw new Error("Union schema requires at least one branch");
28937
28967
  }
28938
- const fingerprints = /* @__PURE__ */ new Set();
28939
- for (const branch of branches) {
28940
- const fingerprint = getRequiredKeyFingerprint(branch);
28941
- if (fingerprints.has(fingerprint)) {
28942
- throw new Error("Union schema branches must have unique required-key fingerprints");
28943
- }
28944
- fingerprints.add(fingerprint);
28945
- }
28968
+ assertUniqueRequiredKeyFingerprints(branches);
28946
28969
  }
28947
28970
  function Union(branches) {
28948
28971
  assertValidBranches2(branches);
@@ -29086,7 +29109,9 @@ function validateRenameMap(rename3) {
29086
29109
  const seenTargets = /* @__PURE__ */ new Map();
29087
29110
  for (const [upstreamName, targetPath] of Object.entries(rename3)) {
29088
29111
  if (targetPath.length === 0) {
29089
- throw new UserError(`Invalid rename target for upstream tool "${upstreamName}": path cannot be empty.`);
29112
+ throw new UserError(
29113
+ `Invalid rename target for upstream tool "${upstreamName}": path cannot be empty.`
29114
+ );
29090
29115
  }
29091
29116
  if (targetPath.split(".").some((segment) => segment.length === 0)) {
29092
29117
  throw new UserError(
@@ -29296,16 +29321,20 @@ function mergeInheritedMetadata(group, inherited) {
29296
29321
  function materializeGroup(group, inherited) {
29297
29322
  const internal = getInternalGroupConfig(group);
29298
29323
  const mergedInherited = mergeInheritedMetadata(internal, inherited);
29299
- const materializedChildren = internal.children.map((child) => materializeNode(child, mergedInherited));
29324
+ const materializedChildren = internal.children.map(
29325
+ (child) => materializeNode(child, mergedInherited)
29326
+ );
29300
29327
  let defaultChild;
29301
29328
  if (internal.default !== void 0) {
29302
29329
  const defaultIndex = internal.children.indexOf(internal.default);
29303
29330
  if (defaultIndex === -1) {
29304
- throw new UserError(`Default command "${internal.default.name}" must be listed in children.`);
29331
+ throw new ToolcraftBugError(
29332
+ `Default command "${internal.default.name}" must be listed in children.`
29333
+ );
29305
29334
  }
29306
29335
  const resolvedDefault = materializedChildren[defaultIndex];
29307
29336
  if (resolvedDefault?.kind !== "command") {
29308
- throw new UserError(`Default child "${internal.default.name}" must be a command.`);
29337
+ throw new ToolcraftBugError(`Default child "${internal.default.name}" must be a command.`);
29309
29338
  }
29310
29339
  defaultChild = resolvedDefault;
29311
29340
  }
@@ -29344,12 +29373,15 @@ function materializeNode(node, inherited) {
29344
29373
  }
29345
29374
  function defineCommand(config) {
29346
29375
  validateHumanInLoopOnDefine(config);
29347
- return materializeCommand(createBaseCommand(config), {
29348
- scope: void 0,
29349
- humanInLoop: void 0,
29350
- secrets: {},
29351
- requires: void 0
29352
- });
29376
+ return materializeCommand(
29377
+ createBaseCommand(config),
29378
+ {
29379
+ scope: void 0,
29380
+ humanInLoop: void 0,
29381
+ secrets: {},
29382
+ requires: void 0
29383
+ }
29384
+ );
29353
29385
  }
29354
29386
  function defineGroup(config) {
29355
29387
  validateRenameMap(config.rename);