poe-code 3.0.168 → 3.0.170

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.
@@ -5698,14 +5698,92 @@ var tomlFormat = {
5698
5698
  prune: prune2
5699
5699
  };
5700
5700
 
5701
+ // packages/config-mutations/src/formats/yaml.ts
5702
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
5703
+ function isConfigObject3(value) {
5704
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5705
+ }
5706
+ function parse4(content) {
5707
+ if (!content || content.trim() === "") {
5708
+ return {};
5709
+ }
5710
+ const parsed = parseYaml(content);
5711
+ if (parsed === null || parsed === void 0) {
5712
+ return {};
5713
+ }
5714
+ if (!isConfigObject3(parsed)) {
5715
+ throw new Error("Expected YAML object.");
5716
+ }
5717
+ return parsed;
5718
+ }
5719
+ function serialize3(obj) {
5720
+ const serialized = stringifyYaml(obj);
5721
+ return serialized.endsWith("\n") ? serialized : `${serialized}
5722
+ `;
5723
+ }
5724
+ function merge3(base, patch) {
5725
+ const result = { ...base };
5726
+ for (const [key, value] of Object.entries(patch)) {
5727
+ if (value === void 0) {
5728
+ continue;
5729
+ }
5730
+ const existing = result[key];
5731
+ if (isConfigObject3(existing) && isConfigObject3(value)) {
5732
+ result[key] = merge3(existing, value);
5733
+ continue;
5734
+ }
5735
+ result[key] = value;
5736
+ }
5737
+ return result;
5738
+ }
5739
+ function prune3(obj, shape) {
5740
+ let changed = false;
5741
+ const result = { ...obj };
5742
+ for (const [key, pattern] of Object.entries(shape)) {
5743
+ if (!(key in result)) {
5744
+ continue;
5745
+ }
5746
+ const current = result[key];
5747
+ if (isConfigObject3(pattern) && Object.keys(pattern).length === 0) {
5748
+ delete result[key];
5749
+ changed = true;
5750
+ continue;
5751
+ }
5752
+ if (isConfigObject3(pattern) && isConfigObject3(current)) {
5753
+ const { changed: childChanged, result: childResult } = prune3(current, pattern);
5754
+ if (childChanged) {
5755
+ changed = true;
5756
+ }
5757
+ if (Object.keys(childResult).length === 0) {
5758
+ delete result[key];
5759
+ } else {
5760
+ result[key] = childResult;
5761
+ }
5762
+ continue;
5763
+ }
5764
+ delete result[key];
5765
+ changed = true;
5766
+ }
5767
+ return { changed, result };
5768
+ }
5769
+ var yamlFormat = {
5770
+ parse: parse4,
5771
+ serialize: serialize3,
5772
+ merge: merge3,
5773
+ prune: prune3
5774
+ };
5775
+
5701
5776
  // packages/config-mutations/src/formats/index.ts
5702
5777
  var formatRegistry = {
5703
5778
  json: jsonFormat,
5704
- toml: tomlFormat
5779
+ toml: tomlFormat,
5780
+ yaml: yamlFormat
5705
5781
  };
5706
5782
  var extensionMap = {
5707
5783
  ".json": "json",
5708
- ".toml": "toml"
5784
+ ".toml": "toml",
5785
+ ".yaml": "yaml",
5786
+ ".yml": "yaml"
5709
5787
  };
5710
5788
  function getConfigFormat(pathOrFormat) {
5711
5789
  if (pathOrFormat in formatRegistry) {
@@ -5854,7 +5932,7 @@ function pruneKeysByPrefix(table, prefix) {
5854
5932
  }
5855
5933
  return result;
5856
5934
  }
5857
- function isConfigObject3(value) {
5935
+ function isConfigObject4(value) {
5858
5936
  return typeof value === "object" && value !== null && !Array.isArray(value);
5859
5937
  }
5860
5938
  function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
@@ -5863,7 +5941,7 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
5863
5941
  for (const [key, value] of Object.entries(patch)) {
5864
5942
  const current = result[key];
5865
5943
  const prefix = prefixMap[key];
5866
- if (isConfigObject3(current) && isConfigObject3(value)) {
5944
+ if (isConfigObject4(current) && isConfigObject4(value)) {
5867
5945
  if (prefix) {
5868
5946
  const pruned = pruneKeysByPrefix(current, prefix);
5869
5947
  result[key] = { ...pruned, ...value };
@@ -6483,6 +6561,7 @@ function createProvider(opts) {
6483
6561
  supportsMcpSpawn: opts.supportsMcpSpawn,
6484
6562
  configurePrompts: opts.configurePrompts,
6485
6563
  postConfigureMessages: opts.postConfigureMessages,
6564
+ extendConfigurePayload: opts.extendConfigurePayload,
6486
6565
  isolatedEnv: opts.isolatedEnv,
6487
6566
  async configure(context, runOptions) {
6488
6567
  await runMutations(opts.manifest.configure, {