@introspection-ai/recipes 0.52.1 → 0.54.0

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.
Files changed (161) hide show
  1. package/dist/cli/schema-args.d.ts +74 -0
  2. package/dist/cli/schema-args.d.ts.map +1 -0
  3. package/dist/cli/schema-args.js +546 -0
  4. package/dist/cli/schema-args.js.map +1 -0
  5. package/dist/connector-tools.d.ts +1 -1
  6. package/dist/connector-tools.d.ts.map +1 -1
  7. package/dist/connector-tools.js +1 -0
  8. package/dist/connector-tools.js.map +1 -1
  9. package/dist/documents/arguments.d.ts +218 -0
  10. package/dist/documents/arguments.d.ts.map +1 -0
  11. package/dist/documents/arguments.generated.d.ts +12 -0
  12. package/dist/documents/arguments.generated.d.ts.map +1 -0
  13. package/dist/documents/arguments.generated.js +341 -0
  14. package/dist/documents/arguments.generated.js.map +1 -0
  15. package/dist/documents/arguments.js +8 -0
  16. package/dist/documents/arguments.js.map +1 -0
  17. package/dist/documents/tools.d.ts.map +1 -1
  18. package/dist/documents/tools.js +11 -164
  19. package/dist/documents/tools.js.map +1 -1
  20. package/dist/introspection-open.d.ts +2 -2
  21. package/dist/introspection-open.d.ts.map +1 -1
  22. package/dist/introspection-open.js +27 -9
  23. package/dist/introspection-open.js.map +1 -1
  24. package/dist/issues/arguments.d.ts +87 -0
  25. package/dist/issues/arguments.d.ts.map +1 -0
  26. package/dist/issues/arguments.generated.d.ts +11 -0
  27. package/dist/issues/arguments.generated.d.ts.map +1 -0
  28. package/dist/issues/arguments.generated.js +116 -0
  29. package/dist/issues/arguments.generated.js.map +1 -0
  30. package/dist/issues/arguments.js +10 -0
  31. package/dist/issues/arguments.js.map +1 -0
  32. package/dist/issues/index.d.ts +1 -1
  33. package/dist/issues/index.d.ts.map +1 -1
  34. package/dist/issues/index.js +1 -1
  35. package/dist/issues/index.js.map +1 -1
  36. package/dist/issues/module.d.ts +3 -0
  37. package/dist/issues/module.d.ts.map +1 -1
  38. package/dist/issues/module.js +4 -0
  39. package/dist/issues/module.js.map +1 -1
  40. package/dist/issues/tool.d.ts +9 -23
  41. package/dist/issues/tool.d.ts.map +1 -1
  42. package/dist/issues/tool.js +37 -35
  43. package/dist/issues/tool.js.map +1 -1
  44. package/dist/mcp/cli/command-context.d.ts +13 -0
  45. package/dist/mcp/cli/command-context.d.ts.map +1 -1
  46. package/dist/mcp/cli/command-context.js +56 -16
  47. package/dist/mcp/cli/command-context.js.map +1 -1
  48. package/dist/mcp/cli/core.d.ts +1 -1
  49. package/dist/mcp/cli/core.d.ts.map +1 -1
  50. package/dist/mcp/cli/core.js +99 -107
  51. package/dist/mcp/cli/core.js.map +1 -1
  52. package/dist/mcp/cli/help.d.ts.map +1 -1
  53. package/dist/mcp/cli/help.js +3 -2
  54. package/dist/mcp/cli/help.js.map +1 -1
  55. package/dist/mcp/cli/policy.d.ts +1 -0
  56. package/dist/mcp/cli/policy.d.ts.map +1 -1
  57. package/dist/mcp/cli/policy.js +9 -7
  58. package/dist/mcp/cli/policy.js.map +1 -1
  59. package/dist/mcp/client-entry.js +1 -1
  60. package/dist/mcp/client-entry.js.map +1 -1
  61. package/dist/mcp/daemon/client.d.ts +10 -1
  62. package/dist/mcp/daemon/client.d.ts.map +1 -1
  63. package/dist/mcp/daemon/client.js +41 -17
  64. package/dist/mcp/daemon/client.js.map +1 -1
  65. package/dist/mcp/daemon/hosted.d.ts +22 -0
  66. package/dist/mcp/daemon/hosted.d.ts.map +1 -0
  67. package/dist/mcp/daemon/hosted.js +98 -0
  68. package/dist/mcp/daemon/hosted.js.map +1 -0
  69. package/dist/mcp/daemon/index.js +18 -423
  70. package/dist/mcp/daemon/index.js.map +1 -1
  71. package/dist/mcp/daemon/protocol.d.ts +4 -0
  72. package/dist/mcp/daemon/protocol.d.ts.map +1 -1
  73. package/dist/mcp/daemon/protocol.js +10 -0
  74. package/dist/mcp/daemon/protocol.js.map +1 -1
  75. package/dist/mcp/daemon/server.d.ts +41 -0
  76. package/dist/mcp/daemon/server.d.ts.map +1 -0
  77. package/dist/mcp/daemon/server.js +547 -0
  78. package/dist/mcp/daemon/server.js.map +1 -0
  79. package/dist/mcp/index.d.ts.map +1 -1
  80. package/dist/mcp/index.js +5 -3
  81. package/dist/mcp/index.js.map +1 -1
  82. package/dist/mcp/pi-runtime.d.ts +4 -2
  83. package/dist/mcp/pi-runtime.d.ts.map +1 -1
  84. package/dist/mcp/pi-runtime.js +12 -6
  85. package/dist/mcp/pi-runtime.js.map +1 -1
  86. package/dist/mcp/tools.d.ts.map +1 -1
  87. package/dist/mcp/tools.js +16 -5
  88. package/dist/mcp/tools.js.map +1 -1
  89. package/dist/mcp-chunks/chunk-53T5TVPR.js +546 -0
  90. package/dist/mcp-chunks/{chunk-QUDOU7MQ.js → chunk-757ZF552.js} +1 -1
  91. package/dist/mcp-chunks/{chunk-CGJ2XOSF.js → chunk-D6OGGMWS.js} +981 -528
  92. package/dist/mcp-chunks/{chunk-IMG2JMBS.js → chunk-MYAMG6VL.js} +1 -1
  93. package/dist/mcp-chunks/{chunk-LQKMNWDE.js → chunk-OIK5AH2S.js} +5 -5
  94. package/dist/mcp-chunks/{chunk-3UVHZECT.js → chunk-OWGTNJNR.js} +9 -7
  95. package/dist/mcp-chunks/chunk-TUPFPO4L.js +400 -0
  96. package/dist/mcp-chunks/{cli-BM23ZXPJ.js → cli-UQ5QXFXU.js} +31 -31
  97. package/dist/mcp-chunks/{client-RKTAKDAY.js → client-SBELHRAE.js} +3 -3
  98. package/dist/mcp-chunks/{daemon-command-VU6WTFCJ.js → daemon-command-MQS6AP2W.js} +5 -5
  99. package/dist/mcp-chunks/dist-SDPPH7XQ.js +65 -0
  100. package/dist/mcp-chunks/{generate-cli-runner-JAAPSWGX.js → generate-cli-runner-LQBBQ7F5.js} +3 -3
  101. package/dist/mcp-chunks/{generated-daemon-runtime-LX4L2X7Z.js → generated-daemon-runtime-TUCZ3JEP.js} +4 -4
  102. package/dist/mcp-chunks/{pi-mcp-runtime-GHDEPXUL.js → pi-mcp-runtime-OLO25D7A.js} +1 -29
  103. package/dist/mcp-chunks/{runtime-T63YI7TC.js → runtime-5SOGEUTQ.js} +2 -2
  104. package/dist/mcp-chunks/{serve-command-75P4VBJ6.js → serve-command-YKSIXG7K.js} +3 -3
  105. package/dist/mcp-chunks/server-SLD55EBC.js +41 -0
  106. package/dist/mcp-daemon.js +29 -432
  107. package/dist/mcp-run-worker.js +9 -8
  108. package/dist/open.d.ts +9 -2
  109. package/dist/open.d.ts.map +1 -1
  110. package/dist/open.js +31 -3
  111. package/dist/open.js.map +1 -1
  112. package/dist/pi-extension.d.ts.map +1 -1
  113. package/dist/pi-extension.js +1 -1
  114. package/dist/pi-extension.js.map +1 -1
  115. package/dist/recipe/companions.d.ts +6 -0
  116. package/dist/recipe/companions.d.ts.map +1 -1
  117. package/dist/recipe/companions.js +22 -4
  118. package/dist/recipe/companions.js.map +1 -1
  119. package/dist/recipe/manifest.generated.d.ts +1 -1
  120. package/dist/recipe/manifest.generated.js +1 -1
  121. package/dist/recipe/suggestions.d.ts +15 -7
  122. package/dist/recipe/suggestions.d.ts.map +1 -1
  123. package/dist/recipe/suggestions.js +33 -11
  124. package/dist/recipe/suggestions.js.map +1 -1
  125. package/dist/search/arguments.d.ts +35 -0
  126. package/dist/search/arguments.d.ts.map +1 -0
  127. package/dist/search/arguments.generated.d.ts +4 -0
  128. package/dist/search/arguments.generated.d.ts.map +1 -0
  129. package/dist/search/arguments.generated.js +37 -0
  130. package/dist/search/arguments.generated.js.map +1 -0
  131. package/dist/search/arguments.js +11 -0
  132. package/dist/search/arguments.js.map +1 -0
  133. package/dist/search/tool.d.ts +1 -1
  134. package/dist/search/tool.d.ts.map +1 -1
  135. package/dist/search/tool.js +16 -33
  136. package/dist/search/tool.js.map +1 -1
  137. package/dist/session.js +1 -1
  138. package/dist/session.js.map +1 -1
  139. package/dist/suggestion-picker.d.ts +2 -2
  140. package/dist/suggestion-picker.d.ts.map +1 -1
  141. package/dist/suggestion-picker.js +3 -3
  142. package/dist/suggestion-picker.js.map +1 -1
  143. package/dist/tools/cli.d.ts +2 -0
  144. package/dist/tools/cli.d.ts.map +1 -1
  145. package/dist/tools/cli.js +110 -38
  146. package/dist/tools/cli.js.map +1 -1
  147. package/dist/tools/shell.d.ts +7 -2
  148. package/dist/tools/shell.d.ts.map +1 -1
  149. package/dist/tools/shell.js +33 -11
  150. package/dist/tools/shell.js.map +1 -1
  151. package/docs/interactions.md +20 -15
  152. package/docs/issues/README.md +24 -17
  153. package/docs/mcp-configuration.md +11 -3
  154. package/docs/providers.md +38 -29
  155. package/docs/recipe-format.md +30 -13
  156. package/package.json +10 -11
  157. package/skills/issues/SKILL.md +108 -0
  158. package/dist/mcp-chunks/{auth-command-UYFOGGQR.js → auth-command-PZLSOYAT.js} +6 -6
  159. package/dist/mcp-chunks/{call-command-6U5BNDR7.js → call-command-VILJIFYG.js} +6 -6
  160. package/dist/mcp-chunks/{chunk-36D4FILJ.js → chunk-ORJND4AI.js} +3 -3
  161. package/dist/mcp-chunks/{resource-command-DUY4SVE5.js → resource-command-SRFQQROJ.js} +4 -4
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  createMcpRuntime,
4
4
  usesPiMcpClient
5
- } from "./chunk-3UVHZECT.js";
5
+ } from "./chunk-OWGTNJNR.js";
6
6
  import {
7
7
  createCallResult,
8
8
  describeConnectionIssue
@@ -21,14 +21,14 @@ var require_identity = __commonJS({
21
21
  var DOC = /* @__PURE__ */ Symbol.for("yaml.document");
22
22
  var MAP = /* @__PURE__ */ Symbol.for("yaml.map");
23
23
  var PAIR = /* @__PURE__ */ Symbol.for("yaml.pair");
24
- var SCALAR = /* @__PURE__ */ Symbol.for("yaml.scalar");
24
+ var SCALAR2 = /* @__PURE__ */ Symbol.for("yaml.scalar");
25
25
  var SEQ = /* @__PURE__ */ Symbol.for("yaml.seq");
26
26
  var NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type");
27
27
  var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
28
28
  var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
29
29
  var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
30
30
  var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
31
- var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
31
+ var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR2;
32
32
  var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
33
33
  function isCollection(node) {
34
34
  if (node && typeof node === "object")
@@ -44,7 +44,7 @@ var require_identity = __commonJS({
44
44
  switch (node[NODE_TYPE]) {
45
45
  case ALIAS:
46
46
  case MAP:
47
- case SCALAR:
47
+ case SCALAR2:
48
48
  case SEQ:
49
49
  return true;
50
50
  }
@@ -56,7 +56,7 @@ var require_identity = __commonJS({
56
56
  exports.MAP = MAP;
57
57
  exports.NODE_TYPE = NODE_TYPE;
58
58
  exports.PAIR = PAIR;
59
- exports.SCALAR = SCALAR;
59
+ exports.SCALAR = SCALAR2;
60
60
  exports.SEQ = SEQ;
61
61
  exports.hasAnchor = hasAnchor;
62
62
  exports.isAlias = isAlias;
@@ -1400,7 +1400,7 @@ var require_stringify = __commonJS({
1400
1400
  var identity = require_identity();
1401
1401
  var stringifyComment = require_stringifyComment();
1402
1402
  var stringifyString = require_stringifyString();
1403
- function createStringifyContext(doc, options) {
1403
+ function createStringifyContext(doc, options2) {
1404
1404
  const opt = Object.assign({
1405
1405
  blockQuote: true,
1406
1406
  commentString: stringifyComment.stringifyComment,
@@ -1420,7 +1420,7 @@ var require_stringify = __commonJS({
1420
1420
  trailingComma: false,
1421
1421
  trueStr: "true",
1422
1422
  verifyAliasOrder: true
1423
- }, doc.schema.toStringOptions, options);
1423
+ }, doc.schema.toStringOptions, options2);
1424
1424
  let inFlow;
1425
1425
  switch (opt.collectionStyle) {
1426
1426
  case "block":
@@ -1842,10 +1842,10 @@ var require_stringifyCollection = __commonJS({
1842
1842
  var identity = require_identity();
1843
1843
  var stringify = require_stringify();
1844
1844
  var stringifyComment = require_stringifyComment();
1845
- function stringifyCollection(collection, ctx, options) {
1845
+ function stringifyCollection(collection, ctx, options2) {
1846
1846
  const flow = ctx.inFlow ?? collection.flow;
1847
1847
  const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
1848
- return stringify2(collection, ctx, options);
1848
+ return stringify2(collection, ctx, options2);
1849
1849
  }
1850
1850
  function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
1851
1851
  const { indent, options: { commentString } } = ctx;
@@ -3300,10 +3300,10 @@ var require_stringifyDocument = __commonJS({
3300
3300
  var identity = require_identity();
3301
3301
  var stringify = require_stringify();
3302
3302
  var stringifyComment = require_stringifyComment();
3303
- function stringifyDocument(doc, options) {
3303
+ function stringifyDocument(doc, options2) {
3304
3304
  const lines = [];
3305
- let hasDirectives = options.directives === true;
3306
- if (options.directives !== false && doc.directives) {
3305
+ let hasDirectives = options2.directives === true;
3306
+ if (options2.directives !== false && doc.directives) {
3307
3307
  const dir = doc.directives.toString(doc);
3308
3308
  if (dir) {
3309
3309
  lines.push(dir);
@@ -3313,7 +3313,7 @@ var require_stringifyDocument = __commonJS({
3313
3313
  }
3314
3314
  if (hasDirectives)
3315
3315
  lines.push("---");
3316
- const ctx = stringify.createStringifyContext(doc, options);
3316
+ const ctx = stringify.createStringifyContext(doc, options2);
3317
3317
  const { commentString } = ctx.options;
3318
3318
  if (doc.commentBefore) {
3319
3319
  if (lines.length !== 1)
@@ -3389,7 +3389,7 @@ var require_Document = __commonJS({
3389
3389
  var createNode = require_createNode();
3390
3390
  var directives = require_directives();
3391
3391
  var Document = class _Document {
3392
- constructor(value, replacer, options) {
3392
+ constructor(value, replacer, options2) {
3393
3393
  this.commentBefore = null;
3394
3394
  this.comment = null;
3395
3395
  this.errors = [];
@@ -3398,8 +3398,8 @@ var require_Document = __commonJS({
3398
3398
  let _replacer = null;
3399
3399
  if (typeof replacer === "function" || Array.isArray(replacer)) {
3400
3400
  _replacer = replacer;
3401
- } else if (options === void 0 && replacer) {
3402
- options = replacer;
3401
+ } else if (options2 === void 0 && replacer) {
3402
+ options2 = replacer;
3403
3403
  replacer = void 0;
3404
3404
  }
3405
3405
  const opt = Object.assign({
@@ -3411,17 +3411,17 @@ var require_Document = __commonJS({
3411
3411
  stringKeys: false,
3412
3412
  uniqueKeys: true,
3413
3413
  version: "1.2"
3414
- }, options);
3414
+ }, options2);
3415
3415
  this.options = opt;
3416
3416
  let { version } = opt;
3417
- if (options?._directives) {
3418
- this.directives = options._directives.atDocument();
3417
+ if (options2?._directives) {
3418
+ this.directives = options2._directives.atDocument();
3419
3419
  if (this.directives.yaml.explicit)
3420
3420
  version = this.directives.yaml.version;
3421
3421
  } else
3422
3422
  this.directives = new directives.Directives({ version });
3423
- this.setSchema(version, options);
3424
- this.contents = value === void 0 ? null : this.createNode(value, _replacer, options);
3423
+ this.setSchema(version, options2);
3424
+ this.contents = value === void 0 ? null : this.createNode(value, _replacer, options2);
3425
3425
  }
3426
3426
  /**
3427
3427
  * Create a deep copy of this Document and its contents.
@@ -3472,7 +3472,7 @@ var require_Document = __commonJS({
3472
3472
  }
3473
3473
  return new Alias.Alias(node.anchor);
3474
3474
  }
3475
- createNode(value, replacer, options) {
3475
+ createNode(value, replacer, options2) {
3476
3476
  let _replacer = void 0;
3477
3477
  if (typeof replacer === "function") {
3478
3478
  value = replacer.call({ "": value }, "", value);
@@ -3483,11 +3483,11 @@ var require_Document = __commonJS({
3483
3483
  if (asStr.length > 0)
3484
3484
  replacer = replacer.concat(asStr);
3485
3485
  _replacer = replacer;
3486
- } else if (options === void 0 && replacer) {
3487
- options = replacer;
3486
+ } else if (options2 === void 0 && replacer) {
3487
+ options2 = replacer;
3488
3488
  replacer = void 0;
3489
3489
  }
3490
- const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};
3490
+ const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options2 ?? {};
3491
3491
  const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(
3492
3492
  this,
3493
3493
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
@@ -3512,9 +3512,9 @@ var require_Document = __commonJS({
3512
3512
  * Convert a key and a value into a `Pair` using the current schema,
3513
3513
  * recursively wrapping all values as `Scalar` or `Collection` nodes.
3514
3514
  */
3515
- createPair(key, value, options = {}) {
3516
- const k = this.createNode(key, null, options);
3517
- const v = this.createNode(value, null, options);
3515
+ createPair(key, value, options2 = {}) {
3516
+ const k = this.createNode(key, null, options2);
3517
+ const v = this.createNode(value, null, options2);
3518
3518
  return new Pair.Pair(k, v);
3519
3519
  }
3520
3520
  /**
@@ -3600,7 +3600,7 @@ var require_Document = __commonJS({
3600
3600
  *
3601
3601
  * Overrides all previously set schema options.
3602
3602
  */
3603
- setSchema(version, options = {}) {
3603
+ setSchema(version, options2 = {}) {
3604
3604
  if (typeof version === "number")
3605
3605
  version = String(version);
3606
3606
  let opt;
@@ -3630,10 +3630,10 @@ var require_Document = __commonJS({
3630
3630
  throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
3631
3631
  }
3632
3632
  }
3633
- if (options.schema instanceof Object)
3634
- this.schema = options.schema;
3633
+ if (options2.schema instanceof Object)
3634
+ this.schema = options2.schema;
3635
3635
  else if (opt)
3636
- this.schema = new Schema.Schema(Object.assign(opt, options));
3636
+ this.schema = new Schema.Schema(Object.assign(opt, options2));
3637
3637
  else
3638
3638
  throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
3639
3639
  }
@@ -3663,14 +3663,14 @@ var require_Document = __commonJS({
3663
3663
  return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });
3664
3664
  }
3665
3665
  /** A YAML representation of the document. */
3666
- toString(options = {}) {
3666
+ toString(options2 = {}) {
3667
3667
  if (this.errors.length > 0)
3668
3668
  throw new Error("Document with errors cannot be stringified");
3669
- if ("indent" in options && (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {
3670
- const s = JSON.stringify(options.indent);
3669
+ if ("indent" in options2 && (!Number.isInteger(options2.indent) || Number(options2.indent) <= 0)) {
3670
+ const s = JSON.stringify(options2.indent);
3671
3671
  throw new Error(`"indent" option must be a positive integer, not ${s}`);
3672
3672
  }
3673
- return stringifyDocument.stringifyDocument(this, options);
3673
+ return stringifyDocument.stringifyDocument(this, options2);
3674
3674
  }
3675
3675
  };
3676
3676
  function assertCollection(contents) {
@@ -4831,7 +4831,7 @@ var require_compose_scalar = __commonJS({
4831
4831
  var resolveBlockScalar = require_resolve_block_scalar();
4832
4832
  var resolveFlowScalar = require_resolve_flow_scalar();
4833
4833
  function composeScalar(ctx, token, tagToken, onError) {
4834
- const { value, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
4834
+ const { value, type, comment, range: range3 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
4835
4835
  const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
4836
4836
  let tag;
4837
4837
  if (ctx.options.stringKeys && ctx.atKey) {
@@ -4851,7 +4851,7 @@ var require_compose_scalar = __commonJS({
4851
4851
  onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
4852
4852
  scalar = new Scalar.Scalar(value);
4853
4853
  }
4854
- scalar.range = range2;
4854
+ scalar.range = range3;
4855
4855
  scalar.source = value;
4856
4856
  if (type)
4857
4857
  scalar.type = type;
@@ -5021,14 +5021,14 @@ var require_compose_node = __commonJS({
5021
5021
  }
5022
5022
  return node;
5023
5023
  }
5024
- function composeAlias({ options }, { offset, source, end }, onError) {
5024
+ function composeAlias({ options: options2 }, { offset, source, end }, onError) {
5025
5025
  const alias = new Alias.Alias(source.substring(1));
5026
5026
  if (alias.source === "")
5027
5027
  onError(offset, "BAD_ALIAS", "Alias cannot be an empty string");
5028
5028
  if (alias.source.endsWith(":"))
5029
5029
  onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
5030
5030
  const valueEnd = offset + source.length;
5031
- const re2 = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);
5031
+ const re2 = resolveEnd.resolveEnd(end, valueEnd, options2.strict, onError);
5032
5032
  alias.range = [offset, valueEnd, re2.offset];
5033
5033
  if (re2.comment)
5034
5034
  alias.comment = re2.comment;
@@ -5047,8 +5047,8 @@ var require_compose_doc = __commonJS({
5047
5047
  var composeNode = require_compose_node();
5048
5048
  var resolveEnd = require_resolve_end();
5049
5049
  var resolveProps = require_resolve_props();
5050
- function composeDoc(options, directives, { offset, start, value, end }, onError) {
5051
- const opts = Object.assign({ _directives: directives }, options);
5050
+ function composeDoc(options2, directives, { offset, start, value, end }, onError) {
5051
+ const opts = Object.assign({ _directives: directives }, options2);
5052
5052
  const doc = new Document.Document(void 0, opts);
5053
5053
  const ctx = {
5054
5054
  atKey: false,
@@ -5127,7 +5127,7 @@ var require_composer = __commonJS({
5127
5127
  return { comment, afterEmptyLine };
5128
5128
  }
5129
5129
  var Composer = class {
5130
- constructor(options = {}) {
5130
+ constructor(options2 = {}) {
5131
5131
  this.doc = null;
5132
5132
  this.atDirectives = false;
5133
5133
  this.prelude = [];
@@ -5140,8 +5140,8 @@ var require_composer = __commonJS({
5140
5140
  else
5141
5141
  this.errors.push(new errors.YAMLParseError(pos, code, message));
5142
5142
  };
5143
- this.directives = new directives.Directives({ version: options.version || "1.2" });
5144
- this.options = options;
5143
+ this.directives = new directives.Directives({ version: options2.version || "1.2" });
5144
+ this.options = options2;
5145
5145
  }
5146
5146
  decorate(doc, afterDoc) {
5147
5147
  const { comment, afterEmptyLine } = parsePrelude(this.prelude);
@@ -5608,7 +5608,7 @@ var require_cst = __commonJS({
5608
5608
  var BOM = "\uFEFF";
5609
5609
  var DOCUMENT = "";
5610
5610
  var FLOW_END = "";
5611
- var SCALAR = "";
5611
+ var SCALAR2 = "";
5612
5612
  var isCollection = (token) => !!token && "items" in token;
5613
5613
  var isScalar = (token) => !!token && (token.type === "scalar" || token.type === "single-quoted-scalar" || token.type === "double-quoted-scalar" || token.type === "block-scalar");
5614
5614
  function prettyToken(token) {
@@ -5619,7 +5619,7 @@ var require_cst = __commonJS({
5619
5619
  return "<DOC>";
5620
5620
  case FLOW_END:
5621
5621
  return "<FLOW_END>";
5622
- case SCALAR:
5622
+ case SCALAR2:
5623
5623
  return "<SCALAR>";
5624
5624
  default:
5625
5625
  return JSON.stringify(token);
@@ -5633,7 +5633,7 @@ var require_cst = __commonJS({
5633
5633
  return "doc-mode";
5634
5634
  case FLOW_END:
5635
5635
  return "flow-error-end";
5636
- case SCALAR:
5636
+ case SCALAR2:
5637
5637
  return "scalar";
5638
5638
  case "---":
5639
5639
  return "doc-start";
@@ -5692,7 +5692,7 @@ var require_cst = __commonJS({
5692
5692
  exports.BOM = BOM;
5693
5693
  exports.DOCUMENT = DOCUMENT;
5694
5694
  exports.FLOW_END = FLOW_END;
5695
- exports.SCALAR = SCALAR;
5695
+ exports.SCALAR = SCALAR2;
5696
5696
  exports.isCollection = isCollection;
5697
5697
  exports.isScalar = isScalar;
5698
5698
  exports.prettyToken = prettyToken;
@@ -7205,15 +7205,15 @@ var require_public_api = __commonJS({
7205
7205
  var identity = require_identity();
7206
7206
  var lineCounter = require_line_counter();
7207
7207
  var parser = require_parser();
7208
- function parseOptions(options) {
7209
- const prettyErrors = options.prettyErrors !== false;
7210
- const lineCounter$1 = options.lineCounter || prettyErrors && new lineCounter.LineCounter() || null;
7208
+ function parseOptions(options2) {
7209
+ const prettyErrors = options2.prettyErrors !== false;
7210
+ const lineCounter$1 = options2.lineCounter || prettyErrors && new lineCounter.LineCounter() || null;
7211
7211
  return { lineCounter: lineCounter$1, prettyErrors };
7212
7212
  }
7213
- function parseAllDocuments(source, options = {}) {
7214
- const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
7213
+ function parseAllDocuments(source, options2 = {}) {
7214
+ const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options2);
7215
7215
  const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
7216
- const composer$1 = new composer.Composer(options);
7216
+ const composer$1 = new composer.Composer(options2);
7217
7217
  const docs = Array.from(composer$1.compose(parser$1.parse(source)));
7218
7218
  if (prettyErrors && lineCounter2)
7219
7219
  for (const doc of docs) {
@@ -7224,10 +7224,10 @@ var require_public_api = __commonJS({
7224
7224
  return docs;
7225
7225
  return Object.assign([], { empty: true }, composer$1.streamInfo());
7226
7226
  }
7227
- function parseDocument(source, options = {}) {
7228
- const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
7227
+ function parseDocument(source, options2 = {}) {
7228
+ const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options2);
7229
7229
  const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
7230
- const composer$1 = new composer.Composer(options);
7230
+ const composer$1 = new composer.Composer(options2);
7231
7231
  let doc = null;
7232
7232
  for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
7233
7233
  if (!doc)
@@ -7243,14 +7243,14 @@ var require_public_api = __commonJS({
7243
7243
  }
7244
7244
  return doc;
7245
7245
  }
7246
- function parse2(src, reviver, options) {
7246
+ function parse2(src, reviver, options2) {
7247
7247
  let _reviver = void 0;
7248
7248
  if (typeof reviver === "function") {
7249
7249
  _reviver = reviver;
7250
- } else if (options === void 0 && reviver && typeof reviver === "object") {
7251
- options = reviver;
7250
+ } else if (options2 === void 0 && reviver && typeof reviver === "object") {
7251
+ options2 = reviver;
7252
7252
  }
7253
- const doc = parseDocument(src, options);
7253
+ const doc = parseDocument(src, options2);
7254
7254
  if (!doc)
7255
7255
  return null;
7256
7256
  doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
@@ -7260,29 +7260,29 @@ var require_public_api = __commonJS({
7260
7260
  else
7261
7261
  doc.errors = [];
7262
7262
  }
7263
- return doc.toJS(Object.assign({ reviver: _reviver }, options));
7263
+ return doc.toJS(Object.assign({ reviver: _reviver }, options2));
7264
7264
  }
7265
- function stringify(value, replacer, options) {
7265
+ function stringify(value, replacer, options2) {
7266
7266
  let _replacer = null;
7267
7267
  if (typeof replacer === "function" || Array.isArray(replacer)) {
7268
7268
  _replacer = replacer;
7269
- } else if (options === void 0 && replacer) {
7270
- options = replacer;
7269
+ } else if (options2 === void 0 && replacer) {
7270
+ options2 = replacer;
7271
7271
  }
7272
- if (typeof options === "string")
7273
- options = options.length;
7274
- if (typeof options === "number") {
7275
- const indent = Math.round(options);
7276
- options = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent };
7272
+ if (typeof options2 === "string")
7273
+ options2 = options2.length;
7274
+ if (typeof options2 === "number") {
7275
+ const indent = Math.round(options2);
7276
+ options2 = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent };
7277
7277
  }
7278
7278
  if (value === void 0) {
7279
- const { keepUndefined } = options ?? replacer ?? {};
7279
+ const { keepUndefined } = options2 ?? replacer ?? {};
7280
7280
  if (!keepUndefined)
7281
7281
  return void 0;
7282
7282
  }
7283
7283
  if (identity.isDocument(value) && !_replacer)
7284
- return value.toString(options);
7285
- return new Document.Document(value, _replacer, options).toString(options);
7284
+ return value.toString(options2);
7285
+ return new Document.Document(value, _replacer, options2).toString(options2);
7286
7286
  }
7287
7287
  exports.parse = parse2;
7288
7288
  exports.parseAllDocuments = parseAllDocuments;
@@ -7479,14 +7479,14 @@ var require_parse_options = __commonJS({
7479
7479
  "use strict";
7480
7480
  var looseOption = Object.freeze({ loose: true });
7481
7481
  var emptyOpts = Object.freeze({});
7482
- var parseOptions = (options) => {
7483
- if (!options) {
7482
+ var parseOptions = (options2) => {
7483
+ if (!options2) {
7484
7484
  return emptyOpts;
7485
7485
  }
7486
- if (typeof options !== "object") {
7486
+ if (typeof options2 !== "object") {
7487
7487
  return looseOption;
7488
7488
  }
7489
- return options;
7489
+ return options2;
7490
7490
  };
7491
7491
  module.exports = parseOptions;
7492
7492
  }
@@ -7539,10 +7539,10 @@ var require_semver = __commonJS({
7539
7539
  return true;
7540
7540
  };
7541
7541
  var SemVer = class _SemVer {
7542
- constructor(version, options) {
7543
- options = parseOptions(options);
7542
+ constructor(version, options2) {
7543
+ options2 = parseOptions(options2);
7544
7544
  if (version instanceof _SemVer) {
7545
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
7545
+ if (version.loose === !!options2.loose && version.includePrerelease === !!options2.includePrerelease) {
7546
7546
  return version;
7547
7547
  } else {
7548
7548
  version = version.version;
@@ -7555,11 +7555,11 @@ var require_semver = __commonJS({
7555
7555
  `version is longer than ${MAX_LENGTH} characters`
7556
7556
  );
7557
7557
  }
7558
- debug("SemVer", version, options);
7559
- this.options = options;
7560
- this.loose = !!options.loose;
7561
- this.includePrerelease = !!options.includePrerelease;
7562
- const m = version.trim().match(options.loose ? re2[t.LOOSE] : re2[t.FULL]);
7558
+ debug("SemVer", version, options2);
7559
+ this.options = options2;
7560
+ this.loose = !!options2.loose;
7561
+ this.includePrerelease = !!options2.includePrerelease;
7562
+ const m = version.trim().match(options2.loose ? re2[t.LOOSE] : re2[t.FULL]);
7563
7563
  if (!m) {
7564
7564
  throw new TypeError(`Invalid Version: ${version}`);
7565
7565
  }
@@ -7814,12 +7814,12 @@ var require_parse = __commonJS({
7814
7814
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js"(exports, module) {
7815
7815
  "use strict";
7816
7816
  var SemVer = require_semver();
7817
- var parse2 = (version, options, throwErrors = false) => {
7817
+ var parse2 = (version, options2, throwErrors = false) => {
7818
7818
  if (version instanceof SemVer) {
7819
7819
  return version;
7820
7820
  }
7821
7821
  try {
7822
- return new SemVer(version, options);
7822
+ return new SemVer(version, options2);
7823
7823
  } catch (er) {
7824
7824
  if (!throwErrors) {
7825
7825
  return null;
@@ -7836,8 +7836,8 @@ var require_valid = __commonJS({
7836
7836
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js"(exports, module) {
7837
7837
  "use strict";
7838
7838
  var parse2 = require_parse();
7839
- var valid = (version, options) => {
7840
- const v = parse2(version, options);
7839
+ var valid = (version, options2) => {
7840
+ const v = parse2(version, options2);
7841
7841
  return v ? v.version : null;
7842
7842
  };
7843
7843
  module.exports = valid;
@@ -7849,8 +7849,8 @@ var require_clean = __commonJS({
7849
7849
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js"(exports, module) {
7850
7850
  "use strict";
7851
7851
  var parse2 = require_parse();
7852
- var clean = (version, options) => {
7853
- const s = parse2(version.trim().replace(/^[=v]+/, ""), options);
7852
+ var clean = (version, options2) => {
7853
+ const s = parse2(version.trim().replace(/^[=v]+/, ""), options2);
7854
7854
  return s ? s.version : null;
7855
7855
  };
7856
7856
  module.exports = clean;
@@ -7862,16 +7862,16 @@ var require_inc = __commonJS({
7862
7862
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js"(exports, module) {
7863
7863
  "use strict";
7864
7864
  var SemVer = require_semver();
7865
- var inc = (version, release, options, identifier, identifierBase) => {
7866
- if (typeof options === "string") {
7865
+ var inc = (version, release, options2, identifier, identifierBase) => {
7866
+ if (typeof options2 === "string") {
7867
7867
  identifierBase = identifier;
7868
- identifier = options;
7869
- options = void 0;
7868
+ identifier = options2;
7869
+ options2 = void 0;
7870
7870
  }
7871
7871
  try {
7872
7872
  return new SemVer(
7873
7873
  version instanceof SemVer ? version.version : version,
7874
- options
7874
+ options2
7875
7875
  ).inc(release, identifier, identifierBase).version;
7876
7876
  } catch (er) {
7877
7877
  return null;
@@ -7960,8 +7960,8 @@ var require_prerelease = __commonJS({
7960
7960
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js"(exports, module) {
7961
7961
  "use strict";
7962
7962
  var parse2 = require_parse();
7963
- var prerelease = (version, options) => {
7964
- const parsed = parse2(version, options);
7963
+ var prerelease = (version, options2) => {
7964
+ const parsed = parse2(version, options2);
7965
7965
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
7966
7966
  };
7967
7967
  module.exports = prerelease;
@@ -8149,7 +8149,7 @@ var require_coerce = __commonJS({
8149
8149
  var SemVer = require_semver();
8150
8150
  var parse2 = require_parse();
8151
8151
  var { safeRe: re2, t } = require_re();
8152
- var coerce = (version, options) => {
8152
+ var coerce = (version, options2) => {
8153
8153
  if (version instanceof SemVer) {
8154
8154
  return version;
8155
8155
  }
@@ -8159,12 +8159,12 @@ var require_coerce = __commonJS({
8159
8159
  if (typeof version !== "string") {
8160
8160
  return null;
8161
8161
  }
8162
- options = options || {};
8162
+ options2 = options2 || {};
8163
8163
  let match2 = null;
8164
- if (!options.rtl) {
8165
- match2 = version.match(options.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
8164
+ if (!options2.rtl) {
8165
+ match2 = version.match(options2.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
8166
8166
  } else {
8167
- const coerceRtlRegex = options.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL];
8167
+ const coerceRtlRegex = options2.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL];
8168
8168
  let next;
8169
8169
  while ((next = coerceRtlRegex.exec(version)) && (!match2 || match2.index + match2[0].length !== version.length)) {
8170
8170
  if (!match2 || next.index + next[0].length !== match2.index + match2[0].length) {
@@ -8180,9 +8180,9 @@ var require_coerce = __commonJS({
8180
8180
  const major2 = match2[2];
8181
8181
  const minor = match2[3] || "0";
8182
8182
  const patch = match2[4] || "0";
8183
- const prerelease = options.includePrerelease && match2[5] ? `-${match2[5]}` : "";
8184
- const build = options.includePrerelease && match2[6] ? `+${match2[6]}` : "";
8185
- return parse2(`${major2}.${minor}.${patch}${prerelease}${build}`, options);
8183
+ const prerelease = options2.includePrerelease && match2[5] ? `-${match2[5]}` : "";
8184
+ const build = options2.includePrerelease && match2[6] ? `+${match2[6]}` : "";
8185
+ return parse2(`${major2}.${minor}.${patch}${prerelease}${build}`, options2);
8186
8186
  };
8187
8187
  module.exports = coerce;
8188
8188
  }
@@ -8195,16 +8195,16 @@ var require_truncate = __commonJS({
8195
8195
  var parse2 = require_parse();
8196
8196
  var constants = require_constants();
8197
8197
  var SemVer = require_semver();
8198
- var truncate = (version, truncation, options) => {
8198
+ var truncate = (version, truncation, options2) => {
8199
8199
  if (!constants.RELEASE_TYPES.includes(truncation)) {
8200
8200
  return null;
8201
8201
  }
8202
- const clonedVersion = cloneInputVersion(version, options);
8202
+ const clonedVersion = cloneInputVersion(version, options2);
8203
8203
  return clonedVersion && doTruncation(clonedVersion, truncation);
8204
8204
  };
8205
- var cloneInputVersion = (version, options) => {
8205
+ var cloneInputVersion = (version, options2) => {
8206
8206
  const versionStringToParse = version instanceof SemVer ? version.version : version;
8207
- return parse2(versionStringToParse, options);
8207
+ return parse2(versionStringToParse, options2);
8208
8208
  };
8209
8209
  var doTruncation = (version, truncation) => {
8210
8210
  if (isPrerelease(truncation)) {
@@ -8273,25 +8273,25 @@ var require_range = __commonJS({
8273
8273
  "use strict";
8274
8274
  var SPACE_CHARACTERS = /\s+/g;
8275
8275
  var Range = class _Range {
8276
- constructor(range2, options) {
8277
- options = parseOptions(options);
8278
- if (range2 instanceof _Range) {
8279
- if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
8280
- return range2;
8276
+ constructor(range3, options2) {
8277
+ options2 = parseOptions(options2);
8278
+ if (range3 instanceof _Range) {
8279
+ if (range3.loose === !!options2.loose && range3.includePrerelease === !!options2.includePrerelease) {
8280
+ return range3;
8281
8281
  } else {
8282
- return new _Range(range2.raw, options);
8282
+ return new _Range(range3.raw, options2);
8283
8283
  }
8284
8284
  }
8285
- if (range2 instanceof Comparator) {
8286
- this.raw = range2.value;
8287
- this.set = [[range2]];
8285
+ if (range3 instanceof Comparator) {
8286
+ this.raw = range3.value;
8287
+ this.set = [[range3]];
8288
8288
  this.formatted = void 0;
8289
8289
  return this;
8290
8290
  }
8291
- this.options = options;
8292
- this.loose = !!options.loose;
8293
- this.includePrerelease = !!options.includePrerelease;
8294
- this.raw = range2.trim().replace(SPACE_CHARACTERS, " ");
8291
+ this.options = options2;
8292
+ this.loose = !!options2.loose;
8293
+ this.includePrerelease = !!options2.includePrerelease;
8294
+ this.raw = range3.trim().replace(SPACE_CHARACTERS, " ");
8295
8295
  this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
8296
8296
  if (!this.set.length) {
8297
8297
  throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
@@ -8336,25 +8336,25 @@ var require_range = __commonJS({
8336
8336
  toString() {
8337
8337
  return this.range;
8338
8338
  }
8339
- parseRange(range2) {
8340
- range2 = range2.replace(BUILDSTRIPRE, "");
8339
+ parseRange(range3) {
8340
+ range3 = range3.replace(BUILDSTRIPRE, "");
8341
8341
  const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
8342
- const memoKey = memoOpts + ":" + range2;
8342
+ const memoKey = memoOpts + ":" + range3;
8343
8343
  const cached = cache.get(memoKey);
8344
8344
  if (cached) {
8345
8345
  return cached;
8346
8346
  }
8347
8347
  const loose = this.options.loose;
8348
8348
  const hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
8349
- range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
8350
- debug("hyphen replace", range2);
8351
- range2 = range2.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
8352
- debug("comparator trim", range2);
8353
- range2 = range2.replace(re2[t.TILDETRIM], tildeTrimReplace);
8354
- debug("tilde trim", range2);
8355
- range2 = range2.replace(re2[t.CARETTRIM], caretTrimReplace);
8356
- debug("caret trim", range2);
8357
- let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
8349
+ range3 = range3.replace(hr, hyphenReplace(this.options.includePrerelease));
8350
+ debug("hyphen replace", range3);
8351
+ range3 = range3.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
8352
+ debug("comparator trim", range3);
8353
+ range3 = range3.replace(re2[t.TILDETRIM], tildeTrimReplace);
8354
+ debug("tilde trim", range3);
8355
+ range3 = range3.replace(re2[t.CARETTRIM], caretTrimReplace);
8356
+ debug("caret trim", range3);
8357
+ let rangeList = range3.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
8358
8358
  if (loose) {
8359
8359
  rangeList = rangeList.filter((comp) => {
8360
8360
  debug("loose invalid filter", comp, this.options);
@@ -8377,15 +8377,15 @@ var require_range = __commonJS({
8377
8377
  cache.set(memoKey, result);
8378
8378
  return result;
8379
8379
  }
8380
- intersects(range2, options) {
8381
- if (!(range2 instanceof _Range)) {
8380
+ intersects(range3, options2) {
8381
+ if (!(range3 instanceof _Range)) {
8382
8382
  throw new TypeError("a Range is required");
8383
8383
  }
8384
8384
  return this.set.some((thisComparators) => {
8385
- return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
8386
- return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
8385
+ return isSatisfiable(thisComparators, options2) && range3.set.some((rangeComparators) => {
8386
+ return isSatisfiable(rangeComparators, options2) && thisComparators.every((thisComparator) => {
8387
8387
  return rangeComparators.every((rangeComparator) => {
8388
- return thisComparator.intersects(rangeComparator, options);
8388
+ return thisComparator.intersects(rangeComparator, options2);
8389
8389
  });
8390
8390
  });
8391
8391
  });
@@ -8430,39 +8430,39 @@ var require_range = __commonJS({
8430
8430
  var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
8431
8431
  var isNullSet = (c) => c.value === "<0.0.0-0";
8432
8432
  var isAny = (c) => c.value === "";
8433
- var isSatisfiable = (comparators, options) => {
8433
+ var isSatisfiable = (comparators, options2) => {
8434
8434
  let result = true;
8435
8435
  const remainingComparators = comparators.slice();
8436
8436
  let testComparator = remainingComparators.pop();
8437
8437
  while (result && remainingComparators.length) {
8438
8438
  result = remainingComparators.every((otherComparator) => {
8439
- return testComparator.intersects(otherComparator, options);
8439
+ return testComparator.intersects(otherComparator, options2);
8440
8440
  });
8441
8441
  testComparator = remainingComparators.pop();
8442
8442
  }
8443
8443
  return result;
8444
8444
  };
8445
- var parseComparator = (comp, options) => {
8445
+ var parseComparator = (comp, options2) => {
8446
8446
  comp = comp.replace(re2[t.BUILD], "");
8447
- debug("comp", comp, options);
8448
- comp = replaceCarets(comp, options);
8447
+ debug("comp", comp, options2);
8448
+ comp = replaceCarets(comp, options2);
8449
8449
  debug("caret", comp);
8450
- comp = replaceTildes(comp, options);
8450
+ comp = replaceTildes(comp, options2);
8451
8451
  debug("tildes", comp);
8452
- comp = replaceXRanges(comp, options);
8452
+ comp = replaceXRanges(comp, options2);
8453
8453
  debug("xrange", comp);
8454
- comp = replaceStars(comp, options);
8454
+ comp = replaceStars(comp, options2);
8455
8455
  debug("stars", comp);
8456
8456
  return comp;
8457
8457
  };
8458
8458
  var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
8459
8459
  var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
8460
- var replaceTildes = (comp, options) => {
8461
- return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
8460
+ var replaceTildes = (comp, options2) => {
8461
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options2)).join(" ");
8462
8462
  };
8463
- var replaceTilde = (comp, options) => {
8464
- const r = options.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
8465
- const z = options.includePrerelease ? "-0" : "";
8463
+ var replaceTilde = (comp, options2) => {
8464
+ const r = options2.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
8465
+ const z = options2.includePrerelease ? "-0" : "";
8466
8466
  return comp.replace(r, (_, M, m, p, pr) => {
8467
8467
  debug("tilde", comp, _, M, m, p, pr);
8468
8468
  let ret;
@@ -8482,13 +8482,13 @@ var require_range = __commonJS({
8482
8482
  return ret;
8483
8483
  });
8484
8484
  };
8485
- var replaceCarets = (comp, options) => {
8486
- return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
8485
+ var replaceCarets = (comp, options2) => {
8486
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options2)).join(" ");
8487
8487
  };
8488
- var replaceCaret = (comp, options) => {
8489
- debug("caret", comp, options);
8490
- const r = options.loose ? re2[t.CARETLOOSE] : re2[t.CARET];
8491
- const z = options.includePrerelease ? "-0" : "";
8488
+ var replaceCaret = (comp, options2) => {
8489
+ debug("caret", comp, options2);
8490
+ const r = options2.loose ? re2[t.CARETLOOSE] : re2[t.CARET];
8491
+ const z = options2.includePrerelease ? "-0" : "";
8492
8492
  return comp.replace(r, (_, M, m, p, pr) => {
8493
8493
  debug("caret", comp, _, M, m, p, pr);
8494
8494
  let ret;
@@ -8529,13 +8529,13 @@ var require_range = __commonJS({
8529
8529
  return ret;
8530
8530
  });
8531
8531
  };
8532
- var replaceXRanges = (comp, options) => {
8533
- debug("replaceXRanges", comp, options);
8534
- return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
8532
+ var replaceXRanges = (comp, options2) => {
8533
+ debug("replaceXRanges", comp, options2);
8534
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options2)).join(" ");
8535
8535
  };
8536
- var replaceXRange = (comp, options) => {
8536
+ var replaceXRange = (comp, options2) => {
8537
8537
  comp = comp.trim();
8538
- const r = options.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
8538
+ const r = options2.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
8539
8539
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
8540
8540
  debug("xRange", comp, ret, gtlt, M, m, p, pr);
8541
8541
  if (invalidXRangeOrder(M, m, p)) {
@@ -8548,7 +8548,7 @@ var require_range = __commonJS({
8548
8548
  if (gtlt === "=" && anyX) {
8549
8549
  gtlt = "";
8550
8550
  }
8551
- pr = options.includePrerelease ? "-0" : "";
8551
+ pr = options2.includePrerelease ? "-0" : "";
8552
8552
  if (xM) {
8553
8553
  if (gtlt === ">" || gtlt === "<") {
8554
8554
  ret = "<0.0.0-0";
@@ -8591,13 +8591,13 @@ var require_range = __commonJS({
8591
8591
  return ret;
8592
8592
  });
8593
8593
  };
8594
- var replaceStars = (comp, options) => {
8595
- debug("replaceStars", comp, options);
8594
+ var replaceStars = (comp, options2) => {
8595
+ debug("replaceStars", comp, options2);
8596
8596
  return comp.trim().replace(re2[t.STAR], "");
8597
8597
  };
8598
- var replaceGTE0 = (comp, options) => {
8599
- debug("replaceGTE0", comp, options);
8600
- return comp.trim().replace(re2[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
8598
+ var replaceGTE0 = (comp, options2) => {
8599
+ debug("replaceGTE0", comp, options2);
8600
+ return comp.trim().replace(re2[options2.includePrerelease ? t.GTE0PRE : t.GTE0], "");
8601
8601
  };
8602
8602
  var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
8603
8603
  if (isX(fM)) {
@@ -8626,13 +8626,13 @@ var require_range = __commonJS({
8626
8626
  }
8627
8627
  return `${from} ${to}`.trim();
8628
8628
  };
8629
- var testSet = (set, version, options) => {
8629
+ var testSet = (set, version, options2) => {
8630
8630
  for (let i = 0; i < set.length; i++) {
8631
8631
  if (!set[i].test(version)) {
8632
8632
  return false;
8633
8633
  }
8634
8634
  }
8635
- if (version.prerelease.length && !options.includePrerelease) {
8635
+ if (version.prerelease.length && !options2.includePrerelease) {
8636
8636
  for (let i = 0; i < set.length; i++) {
8637
8637
  debug(set[i].semver);
8638
8638
  if (set[i].semver === Comparator.ANY) {
@@ -8661,19 +8661,19 @@ var require_comparator = __commonJS({
8661
8661
  static get ANY() {
8662
8662
  return ANY;
8663
8663
  }
8664
- constructor(comp, options) {
8665
- options = parseOptions(options);
8664
+ constructor(comp, options2) {
8665
+ options2 = parseOptions(options2);
8666
8666
  if (comp instanceof _Comparator) {
8667
- if (comp.loose === !!options.loose) {
8667
+ if (comp.loose === !!options2.loose) {
8668
8668
  return comp;
8669
8669
  } else {
8670
8670
  comp = comp.value;
8671
8671
  }
8672
8672
  }
8673
8673
  comp = comp.trim().split(/\s+/).join(" ");
8674
- debug("comparator", comp, options);
8675
- this.options = options;
8676
- this.loose = !!options.loose;
8674
+ debug("comparator", comp, options2);
8675
+ this.options = options2;
8676
+ this.loose = !!options2.loose;
8677
8677
  this.parse(comp);
8678
8678
  if (this.semver === ANY) {
8679
8679
  this.value = "";
@@ -8715,7 +8715,7 @@ var require_comparator = __commonJS({
8715
8715
  }
8716
8716
  return cmp(version, this.operator, this.semver, this.options);
8717
8717
  }
8718
- intersects(comp, options) {
8718
+ intersects(comp, options2) {
8719
8719
  if (!(comp instanceof _Comparator)) {
8720
8720
  throw new TypeError("a Comparator is required");
8721
8721
  }
@@ -8723,18 +8723,18 @@ var require_comparator = __commonJS({
8723
8723
  if (this.value === "") {
8724
8724
  return true;
8725
8725
  }
8726
- return new Range(comp.value, options).test(this.value);
8726
+ return new Range(comp.value, options2).test(this.value);
8727
8727
  } else if (comp.operator === "") {
8728
8728
  if (comp.value === "") {
8729
8729
  return true;
8730
8730
  }
8731
- return new Range(this.value, options).test(comp.semver);
8731
+ return new Range(this.value, options2).test(comp.semver);
8732
8732
  }
8733
- options = parseOptions(options);
8734
- if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
8733
+ options2 = parseOptions(options2);
8734
+ if (options2.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
8735
8735
  return false;
8736
8736
  }
8737
- if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
8737
+ if (!options2.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
8738
8738
  return false;
8739
8739
  }
8740
8740
  if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
@@ -8746,10 +8746,10 @@ var require_comparator = __commonJS({
8746
8746
  if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
8747
8747
  return true;
8748
8748
  }
8749
- if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
8749
+ if (cmp(this.semver, "<", comp.semver, options2) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
8750
8750
  return true;
8751
8751
  }
8752
- if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
8752
+ if (cmp(this.semver, ">", comp.semver, options2) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
8753
8753
  return true;
8754
8754
  }
8755
8755
  return false;
@@ -8770,13 +8770,13 @@ var require_satisfies = __commonJS({
8770
8770
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js"(exports, module) {
8771
8771
  "use strict";
8772
8772
  var Range = require_range();
8773
- var satisfies = (version, range2, options) => {
8773
+ var satisfies = (version, range3, options2) => {
8774
8774
  try {
8775
- range2 = new Range(range2, options);
8775
+ range3 = new Range(range3, options2);
8776
8776
  } catch (er) {
8777
8777
  return false;
8778
8778
  }
8779
- return range2.test(version);
8779
+ return range3.test(version);
8780
8780
  };
8781
8781
  module.exports = satisfies;
8782
8782
  }
@@ -8787,7 +8787,7 @@ var require_to_comparators = __commonJS({
8787
8787
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js"(exports, module) {
8788
8788
  "use strict";
8789
8789
  var Range = require_range();
8790
- var toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
8790
+ var toComparators = (range3, options2) => new Range(range3, options2).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
8791
8791
  module.exports = toComparators;
8792
8792
  }
8793
8793
  });
@@ -8798,12 +8798,12 @@ var require_max_satisfying = __commonJS({
8798
8798
  "use strict";
8799
8799
  var SemVer = require_semver();
8800
8800
  var Range = require_range();
8801
- var maxSatisfying = (versions, range2, options) => {
8801
+ var maxSatisfying = (versions, range3, options2) => {
8802
8802
  let max = null;
8803
8803
  let maxSV = null;
8804
8804
  let rangeObj = null;
8805
8805
  try {
8806
- rangeObj = new Range(range2, options);
8806
+ rangeObj = new Range(range3, options2);
8807
8807
  } catch (er) {
8808
8808
  return null;
8809
8809
  }
@@ -8811,7 +8811,7 @@ var require_max_satisfying = __commonJS({
8811
8811
  if (rangeObj.test(v)) {
8812
8812
  if (!max || maxSV.compare(v) === -1) {
8813
8813
  max = v;
8814
- maxSV = new SemVer(max, options);
8814
+ maxSV = new SemVer(max, options2);
8815
8815
  }
8816
8816
  }
8817
8817
  });
@@ -8827,12 +8827,12 @@ var require_min_satisfying = __commonJS({
8827
8827
  "use strict";
8828
8828
  var SemVer = require_semver();
8829
8829
  var Range = require_range();
8830
- var minSatisfying = (versions, range2, options) => {
8830
+ var minSatisfying = (versions, range3, options2) => {
8831
8831
  let min = null;
8832
8832
  let minSV = null;
8833
8833
  let rangeObj = null;
8834
8834
  try {
8835
- rangeObj = new Range(range2, options);
8835
+ rangeObj = new Range(range3, options2);
8836
8836
  } catch (er) {
8837
8837
  return null;
8838
8838
  }
@@ -8840,7 +8840,7 @@ var require_min_satisfying = __commonJS({
8840
8840
  if (rangeObj.test(v)) {
8841
8841
  if (!min || minSV.compare(v) === 1) {
8842
8842
  min = v;
8843
- minSV = new SemVer(min, options);
8843
+ minSV = new SemVer(min, options2);
8844
8844
  }
8845
8845
  }
8846
8846
  });
@@ -8857,19 +8857,19 @@ var require_min_version = __commonJS({
8857
8857
  var SemVer = require_semver();
8858
8858
  var Range = require_range();
8859
8859
  var gt = require_gt();
8860
- var minVersion = (range2, loose) => {
8861
- range2 = new Range(range2, loose);
8860
+ var minVersion = (range3, loose) => {
8861
+ range3 = new Range(range3, loose);
8862
8862
  let minver = new SemVer("0.0.0");
8863
- if (range2.test(minver)) {
8863
+ if (range3.test(minver)) {
8864
8864
  return minver;
8865
8865
  }
8866
8866
  minver = new SemVer("0.0.0-0");
8867
- if (range2.test(minver)) {
8867
+ if (range3.test(minver)) {
8868
8868
  return minver;
8869
8869
  }
8870
8870
  minver = null;
8871
- for (let i = 0; i < range2.set.length; ++i) {
8872
- const comparators = range2.set[i];
8871
+ for (let i = 0; i < range3.set.length; ++i) {
8872
+ const comparators = range3.set[i];
8873
8873
  let setMin = null;
8874
8874
  comparators.forEach((comparator) => {
8875
8875
  const compver = new SemVer(comparator.semver.version);
@@ -8900,7 +8900,7 @@ var require_min_version = __commonJS({
8900
8900
  minver = setMin;
8901
8901
  }
8902
8902
  }
8903
- if (minver && range2.test(minver)) {
8903
+ if (minver && range3.test(minver)) {
8904
8904
  return minver;
8905
8905
  }
8906
8906
  return null;
@@ -8914,9 +8914,9 @@ var require_valid2 = __commonJS({
8914
8914
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js"(exports, module) {
8915
8915
  "use strict";
8916
8916
  var Range = require_range();
8917
- var validRange = (range2, options) => {
8917
+ var validRange = (range3, options2) => {
8918
8918
  try {
8919
- return new Range(range2, options).range || "*";
8919
+ return new Range(range3, options2).range || "*";
8920
8920
  } catch (er) {
8921
8921
  return null;
8922
8922
  }
@@ -8938,9 +8938,9 @@ var require_outside = __commonJS({
8938
8938
  var lt = require_lt();
8939
8939
  var lte2 = require_lte();
8940
8940
  var gte2 = require_gte();
8941
- var outside = (version, range2, hilo, options) => {
8942
- version = new SemVer(version, options);
8943
- range2 = new Range(range2, options);
8941
+ var outside = (version, range3, hilo, options2) => {
8942
+ version = new SemVer(version, options2);
8943
+ range3 = new Range(range3, options2);
8944
8944
  let gtfn, ltefn, ltfn, comp, ecomp;
8945
8945
  switch (hilo) {
8946
8946
  case ">":
@@ -8960,11 +8960,11 @@ var require_outside = __commonJS({
8960
8960
  default:
8961
8961
  throw new TypeError('Must provide a hilo val of "<" or ">"');
8962
8962
  }
8963
- if (satisfies(version, range2, options)) {
8963
+ if (satisfies(version, range3, options2)) {
8964
8964
  return false;
8965
8965
  }
8966
- for (let i = 0; i < range2.set.length; ++i) {
8967
- const comparators = range2.set[i];
8966
+ for (let i = 0; i < range3.set.length; ++i) {
8967
+ const comparators = range3.set[i];
8968
8968
  let high = null;
8969
8969
  let low = null;
8970
8970
  comparators.forEach((comparator) => {
@@ -8973,9 +8973,9 @@ var require_outside = __commonJS({
8973
8973
  }
8974
8974
  high = high || comparator;
8975
8975
  low = low || comparator;
8976
- if (gtfn(comparator.semver, high.semver, options)) {
8976
+ if (gtfn(comparator.semver, high.semver, options2)) {
8977
8977
  high = comparator;
8978
- } else if (ltfn(comparator.semver, low.semver, options)) {
8978
+ } else if (ltfn(comparator.semver, low.semver, options2)) {
8979
8979
  low = comparator;
8980
8980
  }
8981
8981
  });
@@ -8999,7 +8999,7 @@ var require_gtr = __commonJS({
8999
8999
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js"(exports, module) {
9000
9000
  "use strict";
9001
9001
  var outside = require_outside();
9002
- var gtr = (version, range2, options) => outside(version, range2, ">", options);
9002
+ var gtr = (version, range3, options2) => outside(version, range3, ">", options2);
9003
9003
  module.exports = gtr;
9004
9004
  }
9005
9005
  });
@@ -9009,7 +9009,7 @@ var require_ltr = __commonJS({
9009
9009
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js"(exports, module) {
9010
9010
  "use strict";
9011
9011
  var outside = require_outside();
9012
- var ltr = (version, range2, options) => outside(version, range2, "<", options);
9012
+ var ltr = (version, range3, options2) => outside(version, range3, "<", options2);
9013
9013
  module.exports = ltr;
9014
9014
  }
9015
9015
  });
@@ -9019,10 +9019,10 @@ var require_intersects = __commonJS({
9019
9019
  "node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js"(exports, module) {
9020
9020
  "use strict";
9021
9021
  var Range = require_range();
9022
- var intersects = (r1, r2, options) => {
9023
- r1 = new Range(r1, options);
9024
- r2 = new Range(r2, options);
9025
- return r1.intersects(r2, options);
9022
+ var intersects = (r1, r2, options2) => {
9023
+ r1 = new Range(r1, options2);
9024
+ r2 = new Range(r2, options2);
9025
+ return r1.intersects(r2, options2);
9026
9026
  };
9027
9027
  module.exports = intersects;
9028
9028
  }
@@ -9034,13 +9034,13 @@ var require_simplify = __commonJS({
9034
9034
  "use strict";
9035
9035
  var satisfies = require_satisfies();
9036
9036
  var compare = require_compare();
9037
- module.exports = (versions, range2, options) => {
9037
+ module.exports = (versions, range3, options2) => {
9038
9038
  const set = [];
9039
9039
  let first = null;
9040
9040
  let prev = null;
9041
- const v = versions.sort((a, b) => compare(a, b, options));
9041
+ const v = versions.sort((a, b) => compare(a, b, options2));
9042
9042
  for (const version of v) {
9043
- const included = satisfies(version, range2, options);
9043
+ const included = satisfies(version, range3, options2);
9044
9044
  if (included) {
9045
9045
  prev = version;
9046
9046
  if (!first) {
@@ -9072,8 +9072,8 @@ var require_simplify = __commonJS({
9072
9072
  }
9073
9073
  }
9074
9074
  const simplified = ranges.join(" || ");
9075
- const original = typeof range2.raw === "string" ? range2.raw : String(range2);
9076
- return simplified.length < original.length ? simplified : range2;
9075
+ const original = typeof range3.raw === "string" ? range3.raw : String(range3);
9076
+ return simplified.length < original.length ? simplified : range3;
9077
9077
  };
9078
9078
  }
9079
9079
  });
@@ -9087,16 +9087,16 @@ var require_subset = __commonJS({
9087
9087
  var { ANY } = Comparator;
9088
9088
  var satisfies = require_satisfies();
9089
9089
  var compare = require_compare();
9090
- var subset = (sub, dom, options = {}) => {
9090
+ var subset = (sub, dom, options2 = {}) => {
9091
9091
  if (sub === dom) {
9092
9092
  return true;
9093
9093
  }
9094
- sub = new Range(sub, options);
9095
- dom = new Range(dom, options);
9094
+ sub = new Range(sub, options2);
9095
+ dom = new Range(dom, options2);
9096
9096
  let sawNonNull = false;
9097
9097
  OUTER: for (const simpleSub of sub.set) {
9098
9098
  for (const simpleDom of dom.set) {
9099
- const isSub = simpleSubset(simpleSub, simpleDom, options);
9099
+ const isSub = simpleSubset(simpleSub, simpleDom, options2);
9100
9100
  sawNonNull = sawNonNull || isSub !== null;
9101
9101
  if (isSub) {
9102
9102
  continue OUTER;
@@ -9110,21 +9110,21 @@ var require_subset = __commonJS({
9110
9110
  };
9111
9111
  var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
9112
9112
  var minimumVersion = [new Comparator(">=0.0.0")];
9113
- var simpleSubset = (sub, dom, options) => {
9113
+ var simpleSubset = (sub, dom, options2) => {
9114
9114
  if (sub === dom) {
9115
9115
  return true;
9116
9116
  }
9117
9117
  if (sub.length === 1 && sub[0].semver === ANY) {
9118
9118
  if (dom.length === 1 && dom[0].semver === ANY) {
9119
9119
  return true;
9120
- } else if (options.includePrerelease) {
9120
+ } else if (options2.includePrerelease) {
9121
9121
  sub = minimumVersionWithPreRelease;
9122
9122
  } else {
9123
9123
  sub = minimumVersion;
9124
9124
  }
9125
9125
  }
9126
9126
  if (dom.length === 1 && dom[0].semver === ANY) {
9127
- if (options.includePrerelease) {
9127
+ if (options2.includePrerelease) {
9128
9128
  return true;
9129
9129
  } else {
9130
9130
  dom = minimumVersion;
@@ -9134,9 +9134,9 @@ var require_subset = __commonJS({
9134
9134
  let gt, lt;
9135
9135
  for (const c of sub) {
9136
9136
  if (c.operator === ">" || c.operator === ">=") {
9137
- gt = higherGT(gt, c, options);
9137
+ gt = higherGT(gt, c, options2);
9138
9138
  } else if (c.operator === "<" || c.operator === "<=") {
9139
- lt = lowerLT(lt, c, options);
9139
+ lt = lowerLT(lt, c, options2);
9140
9140
  } else {
9141
9141
  eqSet.add(c.semver);
9142
9142
  }
@@ -9146,7 +9146,7 @@ var require_subset = __commonJS({
9146
9146
  }
9147
9147
  let gtltComp;
9148
9148
  if (gt && lt) {
9149
- gtltComp = compare(gt.semver, lt.semver, options);
9149
+ gtltComp = compare(gt.semver, lt.semver, options2);
9150
9150
  if (gtltComp > 0) {
9151
9151
  return null;
9152
9152
  } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
@@ -9154,14 +9154,14 @@ var require_subset = __commonJS({
9154
9154
  }
9155
9155
  }
9156
9156
  for (const eq of eqSet) {
9157
- if (gt && !satisfies(eq, String(gt), options)) {
9157
+ if (gt && !satisfies(eq, String(gt), options2)) {
9158
9158
  return null;
9159
9159
  }
9160
- if (lt && !satisfies(eq, String(lt), options)) {
9160
+ if (lt && !satisfies(eq, String(lt), options2)) {
9161
9161
  return null;
9162
9162
  }
9163
9163
  for (const c of dom) {
9164
- if (!satisfies(eq, String(c), options)) {
9164
+ if (!satisfies(eq, String(c), options2)) {
9165
9165
  return false;
9166
9166
  }
9167
9167
  }
@@ -9169,8 +9169,8 @@ var require_subset = __commonJS({
9169
9169
  }
9170
9170
  let higher, lower;
9171
9171
  let hasDomLT, hasDomGT;
9172
- let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
9173
- let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
9172
+ let needDomLTPre = lt && !options2.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
9173
+ let needDomGTPre = gt && !options2.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
9174
9174
  if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
9175
9175
  needDomLTPre = false;
9176
9176
  }
@@ -9184,7 +9184,7 @@ var require_subset = __commonJS({
9184
9184
  }
9185
9185
  }
9186
9186
  if (c.operator === ">" || c.operator === ">=") {
9187
- higher = higherGT(gt, c, options);
9187
+ higher = higherGT(gt, c, options2);
9188
9188
  if (higher === c && higher !== gt) {
9189
9189
  return false;
9190
9190
  }
@@ -9199,7 +9199,7 @@ var require_subset = __commonJS({
9199
9199
  }
9200
9200
  }
9201
9201
  if (c.operator === "<" || c.operator === "<=") {
9202
- lower = lowerLT(lt, c, options);
9202
+ lower = lowerLT(lt, c, options2);
9203
9203
  if (lower === c && lower !== lt) {
9204
9204
  return false;
9205
9205
  }
@@ -9222,18 +9222,18 @@ var require_subset = __commonJS({
9222
9222
  }
9223
9223
  return true;
9224
9224
  };
9225
- var higherGT = (a, b, options) => {
9225
+ var higherGT = (a, b, options2) => {
9226
9226
  if (!a) {
9227
9227
  return b;
9228
9228
  }
9229
- const comp = compare(a.semver, b.semver, options);
9229
+ const comp = compare(a.semver, b.semver, options2);
9230
9230
  return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
9231
9231
  };
9232
- var lowerLT = (a, b, options) => {
9232
+ var lowerLT = (a, b, options2) => {
9233
9233
  if (!a) {
9234
9234
  return b;
9235
9235
  }
9236
- const comp = compare(a.semver, b.semver, options);
9236
+ const comp = compare(a.semver, b.semver, options2);
9237
9237
  return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
9238
9238
  };
9239
9239
  module.exports = subset;
@@ -9523,8 +9523,8 @@ var DiagAPI = class DiagAPI2 {
9523
9523
  self2.disable = () => {
9524
9524
  unregisterGlobal(API_NAME, self2);
9525
9525
  };
9526
- self2.createComponentLogger = (options) => {
9527
- return new DiagComponentLogger(options);
9526
+ self2.createComponentLogger = (options2) => {
9527
+ return new DiagComponentLogger(options2);
9528
9528
  };
9529
9529
  self2.verbose = _logProxy("verbose");
9530
9530
  self2.debug = _logProxy("debug");
@@ -9875,8 +9875,8 @@ function getSpanContext(context2) {
9875
9875
  // node_modules/.pnpm/@opentelemetry+api@1.10.0/node_modules/@opentelemetry/api/dist/trace/NoopTracer.mjs
9876
9876
  var contextApi = ContextAPI.getInstance();
9877
9877
  var NoopTracer = class {
9878
- startSpan(name, options, context2 = contextApi.active()) {
9879
- if (Boolean(options === null || options === void 0 ? void 0 : options.root)) return new NonRecordingSpan();
9878
+ startSpan(name, options2, context2 = contextApi.active()) {
9879
+ if (Boolean(options2 === null || options2 === void 0 ? void 0 : options2.root)) return new NonRecordingSpan();
9880
9880
  const parentFromContext = context2 && getSpanContext(context2);
9881
9881
  if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) return new NonRecordingSpan(parentFromContext);
9882
9882
  else return new NonRecordingSpan();
@@ -9909,14 +9909,14 @@ function isSpanContext(spanContext) {
9909
9909
  // node_modules/.pnpm/@opentelemetry+api@1.10.0/node_modules/@opentelemetry/api/dist/trace/ProxyTracer.mjs
9910
9910
  var NOOP_TRACER = new NoopTracer();
9911
9911
  var ProxyTracer = class {
9912
- constructor(provider, name, version, options) {
9912
+ constructor(provider, name, version, options2) {
9913
9913
  this._provider = provider;
9914
9914
  this.name = name;
9915
9915
  this.version = version;
9916
- this.options = options;
9916
+ this.options = options2;
9917
9917
  }
9918
- startSpan(name, options, context2) {
9919
- return this._getTracer().startSpan(name, options, context2);
9918
+ startSpan(name, options2, context2) {
9919
+ return this._getTracer().startSpan(name, options2, context2);
9920
9920
  }
9921
9921
  startActiveSpan(_name, _options, _context, _fn) {
9922
9922
  const tracer = this._getTracer();
@@ -10027,9 +10027,9 @@ var ProxyTracerProvider = class {
10027
10027
  /**
10028
10028
  * Get a {@link ProxyTracer}
10029
10029
  */
10030
- getTracer(name, version, options) {
10030
+ getTracer(name, version, options2) {
10031
10031
  var _this$getDelegateTrac;
10032
- return (_this$getDelegateTrac = this.getDelegateTracer(name, version, options)) !== null && _this$getDelegateTrac !== void 0 ? _this$getDelegateTrac : new ProxyTracer(this, name, version, options);
10032
+ return (_this$getDelegateTrac = this.getDelegateTracer(name, version, options2)) !== null && _this$getDelegateTrac !== void 0 ? _this$getDelegateTrac : new ProxyTracer(this, name, version, options2);
10033
10033
  }
10034
10034
  getDelegate() {
10035
10035
  var _this$_delegate;
@@ -10041,9 +10041,9 @@ var ProxyTracerProvider = class {
10041
10041
  setDelegate(delegate) {
10042
10042
  this._delegate = delegate;
10043
10043
  }
10044
- getDelegateTracer(name, version, options) {
10044
+ getDelegateTracer(name, version, options2) {
10045
10045
  var _this$_delegate2;
10046
- return (_this$_delegate2 = this._delegate) === null || _this$_delegate2 === void 0 ? void 0 : _this$_delegate2.getTracer(name, version, options);
10046
+ return (_this$_delegate2 = this._delegate) === null || _this$_delegate2 === void 0 ? void 0 : _this$_delegate2.getTracer(name, version, options2);
10047
10047
  }
10048
10048
  };
10049
10049
 
@@ -10105,32 +10105,66 @@ var storage = new AsyncLocalStorage();
10105
10105
  function currentMcpCommandContext() {
10106
10106
  return storage.getStore();
10107
10107
  }
10108
+ var envStorage = new AsyncLocalStorage();
10109
+ function mcpCommandEnv() {
10110
+ return envStorage.getStore() ?? process.env;
10111
+ }
10112
+ function runWithMcpCommandEnv(env, task) {
10113
+ return envStorage.run(env, task);
10114
+ }
10108
10115
  function runWithMcpCommandContext(context2, task) {
10109
10116
  return storage.run(context2, task);
10110
10117
  }
10118
+ var ioRoutingHolders = 0;
10119
+ var restoreIoRouting;
10111
10120
  function installMcpCommandIoRouting() {
10112
- const stdoutWrite = process.stdout.write.bind(process.stdout);
10113
- const stderrWrite = process.stderr.write.bind(process.stderr);
10114
- process.stdout.write = ((chunk, ...args) => {
10115
- const target = currentMcpCommandContext()?.stdout;
10116
- return target ? target.write(chunk) : stdoutWrite(chunk, ...args);
10117
- });
10118
- process.stderr.write = ((chunk, ...args) => {
10119
- const target = currentMcpCommandContext()?.stderr;
10120
- return target ? target.write(chunk) : stderrWrite(chunk, ...args);
10121
- });
10121
+ if (ioRoutingHolders === 0) {
10122
+ const stdoutWrite = process.stdout.write;
10123
+ const stderrWrite = process.stderr.write;
10124
+ const boundStdout = stdoutWrite.bind(process.stdout);
10125
+ const boundStderr = stderrWrite.bind(process.stderr);
10126
+ const routedStdout = ((chunk, ...args) => {
10127
+ const target = currentMcpCommandContext()?.stdout;
10128
+ return target ? target.write(chunk) : boundStdout(chunk, ...args);
10129
+ });
10130
+ const routedStderr = ((chunk, ...args) => {
10131
+ const target = currentMcpCommandContext()?.stderr;
10132
+ return target ? target.write(chunk) : boundStderr(chunk, ...args);
10133
+ });
10134
+ process.stdout.write = routedStdout;
10135
+ process.stderr.write = routedStderr;
10136
+ restoreIoRouting = () => {
10137
+ if (process.stdout.write === routedStdout)
10138
+ process.stdout.write = stdoutWrite;
10139
+ if (process.stderr.write === routedStderr)
10140
+ process.stderr.write = stderrWrite;
10141
+ };
10142
+ }
10143
+ ioRoutingHolders += 1;
10144
+ let released = false;
10122
10145
  return () => {
10123
- process.stdout.write = stdoutWrite;
10124
- process.stderr.write = stderrWrite;
10146
+ if (released) return;
10147
+ released = true;
10148
+ ioRoutingHolders -= 1;
10149
+ if (ioRoutingHolders === 0) {
10150
+ restoreIoRouting?.();
10151
+ restoreIoRouting = void 0;
10152
+ }
10125
10153
  };
10126
10154
  }
10127
10155
 
10128
10156
  // src/mcp/daemon/protocol.ts
10157
+ import { basename, join } from "node:path";
10129
10158
  var MCP_DAEMON_SOCKET_ENV = "PI_RECIPES_MCP_DAEMON_SOCKET";
10130
10159
  var MCP_DAEMON_TOKEN_ENV = "PI_RECIPES_MCP_DAEMON_TOKEN";
10131
10160
  var MCP_DAEMON_FINGERPRINT_ENV = "PI_RECIPES_MCP_DAEMON_FINGERPRINT";
10132
10161
  var MCP_DAEMON_PARENT_PID_ENV = "PI_RECIPES_MCP_DAEMON_PARENT_PID";
10162
+ var MCP_SESSION_ROOT_ENV = "PI_RECIPES_MCP_SESSION_ROOT";
10133
10163
  var MCP_DAEMON_MAX_FRAME_BYTES = 10 * 1024 * 1024;
10164
+ var SOCKET_DIRECTORY = /^recipes-mcp-[0-9a-f]{20}$/;
10165
+ function isMcpDaemonSocketDirectory(directory) {
10166
+ return SOCKET_DIRECTORY.test(basename(directory));
10167
+ }
10134
10168
  function serializeMcpDaemonEnvelope(envelope, maxBytes = MCP_DAEMON_MAX_FRAME_BYTES) {
10135
10169
  let estimatedBytes = 0;
10136
10170
  const seen = /* @__PURE__ */ new WeakSet();
@@ -10188,12 +10222,430 @@ import {
10188
10222
  stat,
10189
10223
  writeFile
10190
10224
  } from "node:fs/promises";
10191
- import { dirname as dirname2, join as join2 } from "node:path";
10225
+ import { dirname as dirname3, join as join4, resolve as resolve2 } from "node:path";
10192
10226
  import { setTimeout as delay2 } from "node:timers/promises";
10193
10227
  import { stdin as input, stderr, stdout } from "node:process";
10194
- import { inspect, parseArgs } from "node:util";
10228
+ import { inspect, parseArgs as parseArgs2 } from "node:util";
10195
10229
  import { isMainThread, Worker } from "node:worker_threads";
10196
10230
 
10231
+ // src/cli/schema-args.ts
10232
+ import { readFileSync } from "node:fs";
10233
+ import { parseArgs } from "node:util";
10234
+ var SchemaArgsError = class extends Error {
10235
+ constructor(usage, message) {
10236
+ super(message);
10237
+ this.usage = usage;
10238
+ }
10239
+ usage;
10240
+ };
10241
+ var RESERVED = /* @__PURE__ */ new Set(["help", "json"]);
10242
+ var SCALAR = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean"]);
10243
+ function record(value) {
10244
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
10245
+ }
10246
+ function usageOf(command) {
10247
+ return command.path.join(" ");
10248
+ }
10249
+ function enumOf(property) {
10250
+ if (Array.isArray(property.enum)) return property.enum;
10251
+ if ("const" in property) return [property.const];
10252
+ const variants = property.anyOf ?? property.oneOf;
10253
+ if (!Array.isArray(variants)) return void 0;
10254
+ const consts = variants.map(record).filter((variant) => variant.type !== "null");
10255
+ return consts.length > 0 && consts.every((variant) => "const" in variant) ? consts.map((variant) => variant.const) : void 0;
10256
+ }
10257
+ function scalarOf(property) {
10258
+ const { type } = property;
10259
+ const types2 = (Array.isArray(type) ? type : [type]).filter(
10260
+ (entry) => entry !== void 0 && entry !== "null"
10261
+ );
10262
+ if (types2.length === 1 && SCALAR.has(String(types2[0])))
10263
+ return String(types2[0]);
10264
+ const variants = property.anyOf ?? property.oneOf;
10265
+ if (types2.length === 0 && Array.isArray(variants)) {
10266
+ const typed = variants.map(record).filter((variant) => variant.type !== "null" && !("const" in variant));
10267
+ if (typed.length === 1) {
10268
+ const type2 = scalarOf(typed[0]);
10269
+ if (type2) return type2;
10270
+ }
10271
+ }
10272
+ const values = enumOf(property);
10273
+ if (types2.length === 0 && values?.length) {
10274
+ const kinds = new Set(values.map((value) => typeof value));
10275
+ if (kinds.size === 1) {
10276
+ const [kind] = kinds;
10277
+ if (kind === "number")
10278
+ return values.every(Number.isInteger) ? "integer" : "number";
10279
+ if (kind === "string" || kind === "boolean") return kind;
10280
+ }
10281
+ }
10282
+ return void 0;
10283
+ }
10284
+ function allowsType(property, wanted) {
10285
+ const type = property.type;
10286
+ if (type === wanted || Array.isArray(type) && type.includes(wanted))
10287
+ return true;
10288
+ return ["anyOf", "oneOf", "allOf"].some((key) => {
10289
+ const branches = property[key];
10290
+ return Array.isArray(branches) && branches.some((branch) => allowsType(record(branch), wanted));
10291
+ });
10292
+ }
10293
+ function untyped(property) {
10294
+ return property.type === void 0 && enumOf(property) === void 0 && !["$ref", "anyOf", "oneOf", "allOf", "properties", "items"].some(
10295
+ (key) => key in property
10296
+ );
10297
+ }
10298
+ function shapeOf(property) {
10299
+ const type = scalarOf(property);
10300
+ if (type || untyped(property)) return { kind: "scalar", type };
10301
+ if (property.type === "array") {
10302
+ const items = record(property.items);
10303
+ const itemType = scalarOf(items);
10304
+ if (itemType && itemType !== "boolean" || items && untyped(items))
10305
+ return { kind: "array", items, type: itemType };
10306
+ }
10307
+ return { kind: "json" };
10308
+ }
10309
+ function kebab(name) {
10310
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
10311
+ }
10312
+ var isBoolean = (shape) => shape.kind === "scalar" && shape.type === "boolean";
10313
+ function fields(command) {
10314
+ const required = new Set(
10315
+ Array.isArray(command.schema.required) ? command.schema.required.map(String) : []
10316
+ );
10317
+ const all = Object.entries(record(command.schema.properties)).map(
10318
+ ([name, value]) => {
10319
+ const property = record(value);
10320
+ const shape = RESERVED.has(name) ? { kind: "json" } : shapeOf(property);
10321
+ return { name, property, shape, required: required.has(name) };
10322
+ }
10323
+ );
10324
+ const spellings = (name, shape) => {
10325
+ const forms = [name, kebab(name)];
10326
+ return isBoolean(shape) ? [...forms, ...forms.map((form) => `no-${form}`)] : forms;
10327
+ };
10328
+ const counts = /* @__PURE__ */ new Map();
10329
+ for (const field of all)
10330
+ for (const form of new Set(spellings(field.name, field.shape)))
10331
+ counts.set(form, (counts.get(form) ?? 0) + 1);
10332
+ const reserved = new Set(command.reserved ?? []);
10333
+ return all.map((field) => {
10334
+ let flag = spellings(field.name, field.shape).every(
10335
+ (form) => counts.get(form) === 1
10336
+ ) ? kebab(field.name) : field.name;
10337
+ if (isBoolean(field.shape) && flag.startsWith("no-")) flag = field.name;
10338
+ const forms = isBoolean(field.shape) ? [flag, field.name, `no-${flag}`, `no-${field.name}`] : [flag, field.name];
10339
+ return {
10340
+ ...field,
10341
+ flag,
10342
+ reserved: forms.some((form) => reserved.has(form)) || isBoolean(field.shape) && flag.startsWith("no-")
10343
+ };
10344
+ });
10345
+ }
10346
+ var flagged = (field) => field.shape.kind !== "json" && !field.reserved;
10347
+ function options(command) {
10348
+ const config = {
10349
+ help: { type: "boolean", short: "h" },
10350
+ json: { type: "string" }
10351
+ };
10352
+ for (const field of fields(command).filter(flagged))
10353
+ config[field.flag] = isBoolean(field.shape) ? { type: "boolean" } : { type: "string", multiple: field.shape.kind === "array" };
10354
+ return config;
10355
+ }
10356
+ function canonical(command, argv) {
10357
+ const aliases = /* @__PURE__ */ new Map();
10358
+ const takesValue = /* @__PURE__ */ new Set(["json"]);
10359
+ for (const field of fields(command).filter(flagged)) {
10360
+ if (!isBoolean(field.shape)) {
10361
+ takesValue.add(field.flag);
10362
+ takesValue.add(field.name);
10363
+ }
10364
+ if (field.flag !== field.name) {
10365
+ aliases.set(field.name, field.flag);
10366
+ if (isBoolean(field.shape))
10367
+ aliases.set(`no-${field.name}`, `no-${field.flag}`);
10368
+ }
10369
+ }
10370
+ const out = [];
10371
+ for (let index = 0; index < argv.length; index += 1) {
10372
+ const word = argv[index];
10373
+ if (word === "--") {
10374
+ out.push(...argv.slice(index));
10375
+ break;
10376
+ }
10377
+ if (!word.startsWith("--")) {
10378
+ out.push(word);
10379
+ continue;
10380
+ }
10381
+ const equals = word.indexOf("=");
10382
+ const name = word.slice(2, equals === -1 ? void 0 : equals);
10383
+ const flag = aliases.get(name);
10384
+ out.push(
10385
+ flag === void 0 ? word : `--${flag}${equals === -1 ? "" : word.slice(equals)}`
10386
+ );
10387
+ if (equals === -1 && takesValue.has(name) && index + 1 < argv.length)
10388
+ out.push(argv[++index]);
10389
+ }
10390
+ return out;
10391
+ }
10392
+ function decode(type, text) {
10393
+ if (type === "string") return text;
10394
+ if (type === "number" || type === "integer") {
10395
+ const value = Number(text);
10396
+ return text.trim() && Number.isFinite(value) ? value : text;
10397
+ }
10398
+ try {
10399
+ const value = JSON.parse(text);
10400
+ return typeof value === "string" ? text : value;
10401
+ } catch {
10402
+ return text;
10403
+ }
10404
+ }
10405
+ function valueOf(field, raw) {
10406
+ const { shape } = field;
10407
+ if (typeof raw === "boolean") return raw;
10408
+ if (shape.kind !== "array") {
10409
+ const text = String(Array.isArray(raw) ? raw.at(-1) : raw);
10410
+ if (text === "null" && allowsType(field.property, "null")) return null;
10411
+ return decode(shape.kind === "scalar" ? shape.type : void 0, text);
10412
+ }
10413
+ const texts = (Array.isArray(raw) ? raw : [raw]).map(String);
10414
+ if (texts.length === 1 && texts[0].trimStart().startsWith("[")) {
10415
+ try {
10416
+ const whole = JSON.parse(texts[0]);
10417
+ if (Array.isArray(whole)) return whole;
10418
+ } catch {
10419
+ }
10420
+ }
10421
+ return texts.map((text) => decode(shape.type, text));
10422
+ }
10423
+ var ASSIGNMENT = /^([A-Za-z_][A-Za-z0-9_.-]*)=([\s\S]*)$/;
10424
+ function withNamed(command, argv, reserved) {
10425
+ const properties = { ...record(command.schema.properties) };
10426
+ for (const word of argv) {
10427
+ const name = /^--([^=]+)/.exec(word)?.[1] ?? ASSIGNMENT.exec(word)?.[1];
10428
+ if (name && !reserved.has(name) && !(name in properties))
10429
+ properties[name] = {};
10430
+ }
10431
+ return { ...command, schema: { ...command.schema, properties } };
10432
+ }
10433
+ function assignedText(usage, name, text) {
10434
+ if (text.startsWith('"'))
10435
+ try {
10436
+ const unquoted = JSON.parse(text);
10437
+ if (typeof unquoted === "string") return { text: unquoted, exact: true };
10438
+ } catch {
10439
+ }
10440
+ if (text.startsWith("@@")) return { text: text.slice(1), exact: false };
10441
+ if (!text.startsWith("@")) return { text, exact: false };
10442
+ const path2 = text.slice(1);
10443
+ const fail = (message) => new SchemaArgsError(usage, `${usage}: ${message}`);
10444
+ if (!path2)
10445
+ throw fail(`${name}=@ needs a path; use @@ for a literal leading @`);
10446
+ let contents;
10447
+ try {
10448
+ contents = readFileSync(path2);
10449
+ } catch (error) {
10450
+ throw fail(
10451
+ `cannot read ${path2} for ${name}: ${error instanceof Error ? error.message : String(error)}`
10452
+ );
10453
+ }
10454
+ try {
10455
+ return {
10456
+ text: new TextDecoder("utf-8", { fatal: true }).decode(contents),
10457
+ exact: true
10458
+ };
10459
+ } catch {
10460
+ throw fail(`${path2} for ${name} is not UTF-8 text`);
10461
+ }
10462
+ }
10463
+ function parseSchemaArgs(command, argv, stdin, { assignments = false, unknown = false } = {}) {
10464
+ if (unknown) command = withNamed(command, argv, RESERVED);
10465
+ const usage = usageOf(command);
10466
+ const fail = (message) => new SchemaArgsError(usage, `${usage}: ${message}`);
10467
+ let values;
10468
+ let positionals;
10469
+ try {
10470
+ ({ values, positionals } = parseArgs({
10471
+ args: canonical(command, argv),
10472
+ options: options(command),
10473
+ strict: true,
10474
+ allowPositionals: assignments,
10475
+ allowNegative: true
10476
+ }));
10477
+ } catch (error) {
10478
+ throw fail(
10479
+ (error instanceof Error ? error.message : String(error)).split("\n")[0]
10480
+ );
10481
+ }
10482
+ if (values.help === true) return { help: true, args: {} };
10483
+ let args = {};
10484
+ if (typeof values.json === "string") {
10485
+ const text = values.json === "-" ? stdin?.() ?? "" : values.json;
10486
+ let body = {};
10487
+ if (text.trim())
10488
+ try {
10489
+ body = JSON.parse(text);
10490
+ } catch {
10491
+ throw fail("--json is not valid JSON");
10492
+ }
10493
+ if (!body || typeof body !== "object" || Array.isArray(body))
10494
+ throw fail("--json must be an object");
10495
+ args = { ...body };
10496
+ }
10497
+ const all = fields(command);
10498
+ for (const field of all.filter(flagged)) {
10499
+ const raw = values[field.flag];
10500
+ if (raw !== void 0) args[field.name] = valueOf(field, raw);
10501
+ }
10502
+ const assigned = /* @__PURE__ */ new Set();
10503
+ for (const word of positionals) {
10504
+ const match2 = ASSIGNMENT.exec(word);
10505
+ if (!match2) throw fail(`'${word}' is not name=value or a --flag`);
10506
+ const [, name, raw] = match2;
10507
+ const field = all.find((entry) => entry.name === name);
10508
+ if (assigned.has(name) || field && values[field.flag] !== void 0)
10509
+ throw fail(
10510
+ `argument '${name}' was passed more than once; pass each argument exactly once`
10511
+ );
10512
+ assigned.add(name);
10513
+ if (!field) throw fail(`unknown argument '${name}'`);
10514
+ const { text, exact } = assignedText(usage, name, raw);
10515
+ if (exact) args[name] = text;
10516
+ else if (field.shape.kind !== "json") args[name] = valueOf(field, text);
10517
+ else
10518
+ try {
10519
+ const value = JSON.parse(text);
10520
+ args[name] = typeof value !== "object" && allowsType(field.property, "string") ? text : value;
10521
+ } catch {
10522
+ args[name] = text;
10523
+ }
10524
+ }
10525
+ return { help: false, args };
10526
+ }
10527
+ function placeholder(field) {
10528
+ const { shape, property } = field;
10529
+ if (shape.kind === "json") return "";
10530
+ if (shape.kind === "scalar" && shape.type === "boolean") return "";
10531
+ const values = enumOf(shape.kind === "array" ? shape.items : property);
10532
+ const name = values && values.length <= 6 ? values.map(String).join("|") : shape.type ?? "value";
10533
+ return ` <${name}>${shape.kind === "array" ? "..." : ""}`;
10534
+ }
10535
+ function range(property) {
10536
+ const { minimum, maximum } = property;
10537
+ if (typeof minimum === "number" && typeof maximum === "number")
10538
+ return `From ${minimum} to ${maximum}.`;
10539
+ if (typeof minimum === "number") return `At least ${minimum}.`;
10540
+ if (typeof maximum === "number") return `At most ${maximum}.`;
10541
+ return void 0;
10542
+ }
10543
+ function note(field) {
10544
+ const { property, shape } = field;
10545
+ const parts = [];
10546
+ if (field.required) parts.push("Required.");
10547
+ const description = String(property.description ?? property.title ?? "").split("\n")[0].trim();
10548
+ if (description)
10549
+ parts.push(/[.!?]$/.test(description) ? description : `${description}.`);
10550
+ const values = enumOf(shape.kind === "array" ? shape.items : property);
10551
+ if (shape.kind !== "json" && values && values.length > 6)
10552
+ parts.push(`One of: ${values.map(String).join(", ")}.`);
10553
+ const bounds = range(property);
10554
+ if (bounds) parts.push(bounds);
10555
+ if ("default" in property)
10556
+ parts.push(`Default: ${JSON.stringify(property.default)}.`);
10557
+ if (flagged(field) && shape.kind === "array")
10558
+ parts.push("Repeat it for each value, or pass a JSON array.");
10559
+ if (flagged(field) && isBoolean(shape))
10560
+ parts.push(`--no-${field.flag} for false.`);
10561
+ return parts.join(" ");
10562
+ }
10563
+ function columns(rows) {
10564
+ const width = Math.min(
10565
+ 30,
10566
+ Math.max(0, ...rows.map(([left]) => left.length)) + 2
10567
+ );
10568
+ return rows.map(
10569
+ ([left, right]) => !right ? ` ${left}` : left.length + 2 > width ? ` ${left}
10570
+ ${" ".repeat(width)}${right}` : ` ${left.padEnd(width)}${right}`
10571
+ );
10572
+ }
10573
+ function schemaHelp(command, schemaPointer) {
10574
+ const usage = usageOf(command);
10575
+ const all = fields(command);
10576
+ const flags = all.filter(flagged);
10577
+ const jsonOnly = all.filter((field) => !flagged(field));
10578
+ const call = [
10579
+ usage,
10580
+ ...flags.filter((field) => field.required).map((field) => `--${field.flag}${placeholder(field)}`)
10581
+ ];
10582
+ if (flags.some((field) => !field.required))
10583
+ call.push("[--<argument> <value> ...]");
10584
+ const lines = [
10585
+ `Usage: ${call.join(" ")}`,
10586
+ ` ${usage} --json '{...}' (--json - reads the object from stdin)`
10587
+ ];
10588
+ const description = command.description.trim().split("\n")[0];
10589
+ if (description) lines.push("", description);
10590
+ if (flags.length)
10591
+ lines.push(
10592
+ "",
10593
+ "Arguments:",
10594
+ ...columns(
10595
+ flags.map((field) => [
10596
+ `--${field.flag}${placeholder(field)}`,
10597
+ note(field)
10598
+ ])
10599
+ )
10600
+ );
10601
+ if (jsonOnly.length)
10602
+ lines.push(
10603
+ "",
10604
+ "Only through --json:",
10605
+ ...columns(jsonOnly.map((field) => [field.name, note(field)]))
10606
+ );
10607
+ lines.push(
10608
+ "",
10609
+ ...columns([
10610
+ [
10611
+ "--json <object|->",
10612
+ `Every argument as one JSON object (\`${schemaPointer}\` prints its schema); flags given beside it override its keys.`
10613
+ ],
10614
+ ["--help", "This help."]
10615
+ ])
10616
+ );
10617
+ return lines.join("\n");
10618
+ }
10619
+ function takeOptions(argv, names) {
10620
+ const options2 = {};
10621
+ const rest = [];
10622
+ for (let index = 0; index < argv.length; index += 1) {
10623
+ const word = argv[index];
10624
+ if (word === "--") {
10625
+ rest.push(...argv.slice(index));
10626
+ break;
10627
+ }
10628
+ const [flag, inline] = word.startsWith("--") ? [
10629
+ word.slice(2).split("=")[0],
10630
+ word.includes("=") ? word.slice(word.indexOf("=") + 1) : void 0
10631
+ ] : [void 0, void 0];
10632
+ const type = flag === void 0 ? void 0 : names[flag];
10633
+ if (!type) {
10634
+ rest.push(word);
10635
+ continue;
10636
+ }
10637
+ if (type === "boolean") options2[flag] = true;
10638
+ else {
10639
+ const value = inline ?? argv[index + 1];
10640
+ if (value === void 0 || inline === void 0 && value.startsWith("--"))
10641
+ throw new Error(`Flag '--${flag}' requires a value.`);
10642
+ if (inline === void 0) index += 1;
10643
+ options2[flag] = value;
10644
+ }
10645
+ }
10646
+ return { options: options2, rest };
10647
+ }
10648
+
10197
10649
  // src/mcp/cli/handshake-retry.ts
10198
10650
  import { setTimeout as delay } from "node:timers/promises";
10199
10651
  var HANDSHAKE_RETRY_DELAYS_MS = [500, 1500];
@@ -10209,10 +10661,10 @@ function refusedHandshake(error) {
10209
10661
  }
10210
10662
  return false;
10211
10663
  }
10212
- async function callToolWithHandshakeRetry(runtime, server, tool, options, deadlineMs = Number.POSITIVE_INFINITY) {
10664
+ async function callToolWithHandshakeRetry(runtime, server, tool, options2, deadlineMs = Number.POSITIVE_INFINITY) {
10213
10665
  for (let attempt = 0; ; attempt += 1) {
10214
10666
  try {
10215
- return await runtime.callTool(server, tool, options());
10667
+ return await runtime.callTool(server, tool, options2());
10216
10668
  } catch (error) {
10217
10669
  const wait = HANDSHAKE_RETRY_DELAYS_MS[attempt];
10218
10670
  if (wait === void 0 || !refusedHandshake(error) || Date.now() + wait >= deadlineMs) {
@@ -10227,7 +10679,7 @@ async function callToolWithHandshakeRetry(runtime, server, tool, options, deadli
10227
10679
  var MAX_EXAMPLE_ARRAY_ITEMS = 3;
10228
10680
  var SAFE_CLI_KEY = /^[A-Za-z_][A-Za-z0-9_.-]*$/;
10229
10681
  var SAFE_SHELL_TOKEN = /^[A-Za-z0-9_./:@+-]+$/;
10230
- function record(value) {
10682
+ function record2(value) {
10231
10683
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
10232
10684
  }
10233
10685
  function number(value) {
@@ -10237,18 +10689,18 @@ function quoted(value) {
10237
10689
  return JSON.stringify(value);
10238
10690
  }
10239
10691
  function renderSchema(value) {
10240
- const schema = record(value);
10692
+ const schema = record2(value);
10241
10693
  if (!schema || !Array.isArray(schema.allOf)) return schema;
10242
10694
  const branches = schema.allOf.map(renderSchema).filter((branch) => Boolean(branch));
10243
- const baseProperties = record(schema.properties) ?? {};
10695
+ const baseProperties = record2(schema.properties) ?? {};
10244
10696
  const objectLike = branches.every(
10245
- (branch) => branch.type === "object" || Boolean(record(branch.properties))
10697
+ (branch) => branch.type === "object" || Boolean(record2(branch.properties))
10246
10698
  );
10247
10699
  if (!objectLike) return { ...schema, allOf: branches };
10248
10700
  const properties = Object.assign(
10249
10701
  {},
10250
10702
  baseProperties,
10251
- ...branches.map((branch) => record(branch.properties) ?? {})
10703
+ ...branches.map((branch) => record2(branch.properties) ?? {})
10252
10704
  );
10253
10705
  const required = new Set(
10254
10706
  Array.isArray(schema.required) ? schema.required.filter(
@@ -10301,18 +10753,18 @@ function compactSchemaType(value) {
10301
10753
  if (schema.type === "array") {
10302
10754
  return `${compactSchemaType(schema.items)}[]${constraintSuffix(schema)}`;
10303
10755
  }
10304
- if (schema.type === "object" || record(schema.properties)) {
10305
- const properties = record(schema.properties);
10756
+ if (schema.type === "object" || record2(schema.properties)) {
10757
+ const properties = record2(schema.properties);
10306
10758
  if (!properties || Object.keys(properties).length === 0) return "object";
10307
10759
  const required = new Set(
10308
10760
  Array.isArray(schema.required) ? schema.required.filter(
10309
10761
  (entry) => typeof entry === "string"
10310
10762
  ) : []
10311
10763
  );
10312
- const fields = Object.entries(properties).map(
10764
+ const fields2 = Object.entries(properties).map(
10313
10765
  ([name, descriptor]) => `${name}${required.has(name) ? "" : "?"}: ${compactSchemaType(descriptor)}`
10314
10766
  );
10315
- return `{${fields.join(", ")}}`;
10767
+ return `{${fields2.join(", ")}}`;
10316
10768
  }
10317
10769
  const type = schema.type === "number" ? "number" : schema.type;
10318
10770
  return `${typeof type === "string" ? type : "unknown"}${constraintSuffix(schema)}`;
@@ -10325,7 +10777,7 @@ function descriptionText(value, verbose) {
10325
10777
  }
10326
10778
  function hasLongDescription(value) {
10327
10779
  if (Array.isArray(value)) return value.some(hasLongDescription);
10328
- const object = record(value);
10780
+ const object = record2(value);
10329
10781
  if (!object) return false;
10330
10782
  if (typeof object.description === "string" && object.description.trim().replace(/\s+/g, " ").length > 160) {
10331
10783
  return true;
@@ -10334,10 +10786,10 @@ function hasLongDescription(value) {
10334
10786
  ([key, nested]) => key !== "description" && hasLongDescription(nested)
10335
10787
  );
10336
10788
  }
10337
- function schemaLines(value, indent, options = {}) {
10789
+ function schemaLines(value, indent, options2 = {}) {
10338
10790
  const schema = renderSchema(value);
10339
10791
  if (!schema) return [`${indent}unknown`];
10340
- const properties = record(schema.properties);
10792
+ const properties = record2(schema.properties);
10341
10793
  if (!properties) return [`${indent}${compactSchemaType(schema)}`];
10342
10794
  const required = new Set(
10343
10795
  Array.isArray(schema.required) ? schema.required.filter(
@@ -10346,17 +10798,17 @@ function schemaLines(value, indent, options = {}) {
10346
10798
  );
10347
10799
  const lines = [];
10348
10800
  for (const [name, descriptorValue] of Object.entries(properties)) {
10349
- const descriptor = record(descriptorValue) ?? {};
10801
+ const descriptor = record2(descriptorValue) ?? {};
10350
10802
  const optional = required.has(name) ? "" : "?";
10351
10803
  const compactDescription = descriptionText(
10352
10804
  descriptor.description,
10353
- options.verboseDescriptions === true
10805
+ options2.verboseDescriptions === true
10354
10806
  );
10355
10807
  const description = compactDescription ? ` \u2014 ${compactDescription}` : "";
10356
- const nested = record(descriptor.properties);
10808
+ const nested = record2(descriptor.properties);
10357
10809
  if (nested) {
10358
10810
  lines.push(`${indent}${name}${optional}: {`);
10359
- lines.push(...schemaLines(descriptor, `${indent} `, options));
10811
+ lines.push(...schemaLines(descriptor, `${indent} `, options2));
10360
10812
  lines.push(`${indent}}${description}`);
10361
10813
  } else {
10362
10814
  lines.push(
@@ -10367,7 +10819,7 @@ function schemaLines(value, indent, options = {}) {
10367
10819
  return lines.length > 0 ? lines : [`${indent}{}`];
10368
10820
  }
10369
10821
  function schemaObject(value) {
10370
- return record(value);
10822
+ return record2(value);
10371
10823
  }
10372
10824
  function shellQuote(value) {
10373
10825
  return `'${value.replace(/'/g, `'"'"'`)}'`;
@@ -10399,8 +10851,8 @@ function exampleValue(value, name) {
10399
10851
  () => exampleValue(schema.items, "value")
10400
10852
  );
10401
10853
  }
10402
- if (schema.type === "object" || record(schema.properties)) {
10403
- const properties = record(schema.properties) ?? {};
10854
+ if (schema.type === "object" || record2(schema.properties)) {
10855
+ const properties = record2(schema.properties) ?? {};
10404
10856
  const required = Array.isArray(schema.required) ? schema.required.filter(
10405
10857
  (entry) => typeof entry === "string"
10406
10858
  ) : [];
@@ -10416,7 +10868,7 @@ function callValue(value, name) {
10416
10868
  }
10417
10869
  function callExample(server, tool) {
10418
10870
  const schema = renderSchema(tool.inputSchema);
10419
- const properties = record(schema?.properties) ?? {};
10871
+ const properties = record2(schema?.properties) ?? {};
10420
10872
  const required = Array.isArray(schema?.required) ? schema.required.filter(
10421
10873
  (entry) => typeof entry === "string"
10422
10874
  ) : [];
@@ -10433,7 +10885,7 @@ function callExample(server, tool) {
10433
10885
  return `mcp call ${toolSelector(server, tool.name)} --json ${shellQuote(json)}`;
10434
10886
  }
10435
10887
  const args = required.map((name) => {
10436
- const descriptor = record(properties[name]) ?? {};
10888
+ const descriptor = record2(properties[name]) ?? {};
10437
10889
  return `${name}=${callValue(descriptor, name)}`;
10438
10890
  });
10439
10891
  return `mcp call ${toolSelector(server, tool.name)}${args.length > 0 ? ` ${args.join(" ")}` : ""}`;
@@ -10441,7 +10893,7 @@ function callExample(server, tool) {
10441
10893
  function structuredBranch(value, kind) {
10442
10894
  const schema = renderSchema(value);
10443
10895
  if (!schema) return void 0;
10444
- if (kind === "array" && schema.type === "array" || kind === "object" && (schema.type === "object" || record(schema.properties))) {
10896
+ if (kind === "array" && schema.type === "array" || kind === "object" && (schema.type === "object" || record2(schema.properties))) {
10445
10897
  return schema;
10446
10898
  }
10447
10899
  const union = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : [];
@@ -10449,7 +10901,7 @@ function structuredBranch(value, kind) {
10449
10901
  }
10450
10902
  function structuredCallExample(server, tool) {
10451
10903
  const schema = renderSchema(tool.inputSchema);
10452
- const properties = record(schema?.properties) ?? {};
10904
+ const properties = record2(schema?.properties) ?? {};
10453
10905
  const required = new Set(
10454
10906
  Array.isArray(schema?.required) ? schema.required.filter(
10455
10907
  (entry) => typeof entry === "string"
@@ -10471,23 +10923,23 @@ function structuredCallExample(server, tool) {
10471
10923
  }
10472
10924
  return void 0;
10473
10925
  }
10474
- function renderToolContract(server, tool, options = {}) {
10926
+ function renderToolContract(server, tool, options2 = {}) {
10475
10927
  const lines = [`${server}.${tool.name}`];
10476
10928
  const description = descriptionText(
10477
10929
  tool.description,
10478
- options.verboseDescriptions === true
10930
+ options2.verboseDescriptions === true
10479
10931
  );
10480
10932
  if (description) {
10481
10933
  lines.push(description);
10482
10934
  }
10483
- if (!options.verboseDescriptions && (descriptionText(tool.description, true).length > 160 || hasLongDescription(tool.inputSchema) || hasLongDescription(tool.outputSchema))) {
10935
+ if (!options2.verboseDescriptions && (descriptionText(tool.description, true).length > 160 || hasLongDescription(tool.inputSchema) || hasLongDescription(tool.outputSchema))) {
10484
10936
  lines.push("Descriptions shortened; use --verbose for full text.");
10485
10937
  }
10486
- lines.push("", "input", ...schemaLines(tool.inputSchema, " ", options));
10938
+ lines.push("", "input", ...schemaLines(tool.inputSchema, " ", options2));
10487
10939
  lines.push(
10488
10940
  "",
10489
10941
  "output",
10490
- ...schemaObject(tool.outputSchema) ? schemaLines(tool.outputSchema, " ", options) : [" unspecified"]
10942
+ ...schemaObject(tool.outputSchema) ? schemaLines(tool.outputSchema, " ", options2) : [" unspecified"]
10491
10943
  );
10492
10944
  lines.push("", "call", ` ${callExample(server, tool)}`);
10493
10945
  const structured = structuredCallExample(server, tool);
@@ -10495,9 +10947,9 @@ function renderToolContract(server, tool, options = {}) {
10495
10947
  return `${lines.join("\n")}
10496
10948
  `;
10497
10949
  }
10498
- function renderToolSignature(server, tool, options = {}) {
10950
+ function renderToolSignature(server, tool, options2 = {}) {
10499
10951
  const schema = renderSchema(tool.inputSchema);
10500
- const properties = record(schema?.properties) ?? {};
10952
+ const properties = record2(schema?.properties) ?? {};
10501
10953
  const required = new Set(
10502
10954
  Array.isArray(schema?.required) ? schema.required.filter(
10503
10955
  (entry) => typeof entry === "string"
@@ -10507,13 +10959,13 @@ function renderToolSignature(server, tool, options = {}) {
10507
10959
  const included = new Set(
10508
10960
  entries.filter(([name]) => required.has(name)).map(([name]) => name)
10509
10961
  );
10510
- if (!options.allParameters) {
10962
+ if (!options2.allParameters) {
10511
10963
  for (const [name] of entries) {
10512
10964
  if (included.size >= 5) break;
10513
10965
  included.add(name);
10514
10966
  }
10515
10967
  }
10516
- const visible = options.allParameters ? entries : entries.filter(([name]) => included.has(name));
10968
+ const visible = options2.allParameters ? entries : entries.filter(([name]) => included.has(name));
10517
10969
  const parameters = visible.map(([name, descriptor]) => {
10518
10970
  const optional = required.has(name) ? "" : "?";
10519
10971
  return `${name}${optional}: ${compactSchemaType(descriptor)}`;
@@ -10586,8 +11038,9 @@ function mcpCallHelpText() {
10586
11038
  "",
10587
11039
  "Calls exact tools materialized in this recipe session.",
10588
11040
  "",
10589
- "Arguments:",
10590
- " key=value Named arguments with schema-aware coercion.",
11041
+ "Arguments, read from the tool's input schema (`mcp call <server>.<tool> --help` lists them):",
11042
+ " --<argument> <value> One argument as a flag.",
11043
+ " key=value The same, as a word.",
10591
11044
  " key=@path Read an exact UTF-8 string; use @@ for a literal @.",
10592
11045
  " --json <json|-> Supply a structured JSON object directly or from stdin.",
10593
11046
  ` Array example: mcp call server.tool --json '{"tags":["a","b"]}'.`,
@@ -10646,13 +11099,13 @@ function mcpRunHelpText() {
10646
11099
  }
10647
11100
 
10648
11101
  // src/mcp/index.ts
10649
- import { delimiter, dirname, join, resolve } from "node:path";
11102
+ import { delimiter, dirname as dirname2, join as join3, resolve } from "node:path";
10650
11103
 
10651
11104
  // node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
10652
11105
  var balanced = (a, b, str) => {
10653
11106
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
10654
11107
  const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
10655
- const r = ma !== null && mb != null && range(ma, mb, str);
11108
+ const r = ma !== null && mb != null && range2(ma, mb, str);
10656
11109
  return r && {
10657
11110
  start: r[0],
10658
11111
  end: r[1],
@@ -10665,7 +11118,7 @@ var maybeMatch = (reg, str) => {
10665
11118
  const m = str.match(reg);
10666
11119
  return m ? m[0] : null;
10667
11120
  };
10668
- var range = (a, b, str) => {
11121
+ var range2 = (a, b, str) => {
10669
11122
  let begs, beg, left, right = void 0, result;
10670
11123
  let ai = str.indexOf(a);
10671
11124
  let bi = str.indexOf(b, ai + 1);
@@ -10759,11 +11212,11 @@ function parseCommaParts(str) {
10759
11212
  str = post;
10760
11213
  }
10761
11214
  }
10762
- function expand(str, options = {}) {
11215
+ function expand(str, options2 = {}) {
10763
11216
  if (!str) {
10764
11217
  return [];
10765
11218
  }
10766
- const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } = options;
11219
+ const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } = options2;
10767
11220
  if (str.slice(0, 2) === "{}") {
10768
11221
  str = "\\{\\}" + str.slice(2);
10769
11222
  }
@@ -11149,13 +11602,13 @@ var AST = class {
11149
11602
  parts: this.#parts
11150
11603
  };
11151
11604
  }
11152
- constructor(type, parent, options = {}) {
11605
+ constructor(type, parent, options2 = {}) {
11153
11606
  this.type = type;
11154
11607
  if (type)
11155
11608
  this.#hasMagic = true;
11156
11609
  this.#parent = parent;
11157
11610
  this.#root = this.#parent ? this.#parent.#root : this;
11158
- this.#options = this.#root === this ? options : this.#root.#options;
11611
+ this.#options = this.#root === this ? options2 : this.#root.#options;
11159
11612
  this.#negs = this.#root === this ? [] : this.#root.#negs;
11160
11613
  if (type === "!" && !this.#root.#filledNegs)
11161
11614
  this.#negs.push(this);
@@ -11435,9 +11888,9 @@ var AST = class {
11435
11888
  this.#toString = void 0;
11436
11889
  this.#emptyExt = false;
11437
11890
  }
11438
- static fromGlob(pattern, options = {}) {
11439
- const ast = new _a(null, void 0, options);
11440
- _a.#parseAST(pattern, ast, 0, options, 0);
11891
+ static fromGlob(pattern, options2 = {}) {
11892
+ const ast = new _a(null, void 0, options2);
11893
+ _a.#parseAST(pattern, ast, 0, options2, 0);
11441
11894
  return ast;
11442
11895
  }
11443
11896
  // returns the regular expression if there's magic, or the unescaped
@@ -11710,12 +12163,12 @@ var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) =
11710
12163
  };
11711
12164
 
11712
12165
  // node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js
11713
- var minimatch = (p, pattern, options = {}) => {
12166
+ var minimatch = (p, pattern, options2 = {}) => {
11714
12167
  assertValidPattern(pattern);
11715
- if (!options.nocomment && pattern.charAt(0) === "#") {
12168
+ if (!options2.nocomment && pattern.charAt(0) === "#") {
11716
12169
  return false;
11717
12170
  }
11718
- return new Minimatch(pattern, options).match(p);
12171
+ return new Minimatch(pattern, options2).match(p);
11719
12172
  };
11720
12173
  var starDotExtRE = /^\*+([^+@!?*[(]*)$/;
11721
12174
  var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
@@ -11780,7 +12233,7 @@ var qmark2 = "[^/]";
11780
12233
  var star2 = qmark2 + "*?";
11781
12234
  var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
11782
12235
  var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
11783
- var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
12236
+ var filter = (pattern, options2 = {}) => (p) => minimatch(p, pattern, options2);
11784
12237
  minimatch.filter = filter;
11785
12238
  var ext = (a, b = {}) => Object.assign({}, a, b);
11786
12239
  var defaults = (def) => {
@@ -11788,50 +12241,50 @@ var defaults = (def) => {
11788
12241
  return minimatch;
11789
12242
  }
11790
12243
  const orig = minimatch;
11791
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
12244
+ const m = (p, pattern, options2 = {}) => orig(p, pattern, ext(def, options2));
11792
12245
  return Object.assign(m, {
11793
12246
  Minimatch: class Minimatch extends orig.Minimatch {
11794
- constructor(pattern, options = {}) {
11795
- super(pattern, ext(def, options));
12247
+ constructor(pattern, options2 = {}) {
12248
+ super(pattern, ext(def, options2));
11796
12249
  }
11797
- static defaults(options) {
11798
- return orig.defaults(ext(def, options)).Minimatch;
12250
+ static defaults(options2) {
12251
+ return orig.defaults(ext(def, options2)).Minimatch;
11799
12252
  }
11800
12253
  },
11801
12254
  AST: class AST extends orig.AST {
11802
12255
  /* c8 ignore start */
11803
- constructor(type, parent, options = {}) {
11804
- super(type, parent, ext(def, options));
12256
+ constructor(type, parent, options2 = {}) {
12257
+ super(type, parent, ext(def, options2));
11805
12258
  }
11806
12259
  /* c8 ignore stop */
11807
- static fromGlob(pattern, options = {}) {
11808
- return orig.AST.fromGlob(pattern, ext(def, options));
12260
+ static fromGlob(pattern, options2 = {}) {
12261
+ return orig.AST.fromGlob(pattern, ext(def, options2));
11809
12262
  }
11810
12263
  },
11811
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
11812
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
11813
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
11814
- defaults: (options) => orig.defaults(ext(def, options)),
11815
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
11816
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
11817
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
12264
+ unescape: (s, options2 = {}) => orig.unescape(s, ext(def, options2)),
12265
+ escape: (s, options2 = {}) => orig.escape(s, ext(def, options2)),
12266
+ filter: (pattern, options2 = {}) => orig.filter(pattern, ext(def, options2)),
12267
+ defaults: (options2) => orig.defaults(ext(def, options2)),
12268
+ makeRe: (pattern, options2 = {}) => orig.makeRe(pattern, ext(def, options2)),
12269
+ braceExpand: (pattern, options2 = {}) => orig.braceExpand(pattern, ext(def, options2)),
12270
+ match: (list, pattern, options2 = {}) => orig.match(list, pattern, ext(def, options2)),
11818
12271
  sep: orig.sep,
11819
12272
  GLOBSTAR
11820
12273
  });
11821
12274
  };
11822
12275
  minimatch.defaults = defaults;
11823
- var braceExpand = (pattern, options = {}) => {
12276
+ var braceExpand = (pattern, options2 = {}) => {
11824
12277
  assertValidPattern(pattern);
11825
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
12278
+ if (options2.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
11826
12279
  return [pattern];
11827
12280
  }
11828
- return expand(pattern, { max: options.braceExpandMax });
12281
+ return expand(pattern, { max: options2.braceExpandMax });
11829
12282
  };
11830
12283
  minimatch.braceExpand = braceExpand;
11831
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
12284
+ var makeRe = (pattern, options2 = {}) => new Minimatch(pattern, options2).makeRe();
11832
12285
  minimatch.makeRe = makeRe;
11833
- var match = (list, pattern, options = {}) => {
11834
- const mm = new Minimatch(pattern, options);
12286
+ var match = (list, pattern, options2 = {}) => {
12287
+ const mm = new Minimatch(pattern, options2);
11835
12288
  list = list.filter((f) => mm.match(f));
11836
12289
  if (mm.options.nonull && !list.length) {
11837
12290
  list.push(pattern);
@@ -11860,28 +12313,28 @@ var Minimatch = class {
11860
12313
  windowsNoMagicRoot;
11861
12314
  maxGlobstarRecursion;
11862
12315
  regexp;
11863
- constructor(pattern, options = {}) {
12316
+ constructor(pattern, options2 = {}) {
11864
12317
  assertValidPattern(pattern);
11865
- options = options || {};
11866
- this.options = options;
11867
- this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
12318
+ options2 = options2 || {};
12319
+ this.options = options2;
12320
+ this.maxGlobstarRecursion = options2.maxGlobstarRecursion ?? 200;
11868
12321
  this.pattern = pattern;
11869
- this.platform = options.platform || defaultPlatform;
12322
+ this.platform = options2.platform || defaultPlatform;
11870
12323
  this.isWindows = this.platform === "win32";
11871
12324
  const awe = "allowWindowsEscape";
11872
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
12325
+ this.windowsPathsNoEscape = !!options2.windowsPathsNoEscape || options2[awe] === false;
11873
12326
  if (this.windowsPathsNoEscape) {
11874
12327
  this.pattern = this.pattern.replace(/\\/g, "/");
11875
12328
  }
11876
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
12329
+ this.preserveMultipleSlashes = !!options2.preserveMultipleSlashes;
11877
12330
  this.regexp = null;
11878
12331
  this.negate = false;
11879
- this.nonegate = !!options.nonegate;
12332
+ this.nonegate = !!options2.nonegate;
11880
12333
  this.comment = false;
11881
12334
  this.empty = false;
11882
- this.partial = !!options.partial;
12335
+ this.partial = !!options2.partial;
11883
12336
  this.nocase = !!this.options.nocase;
11884
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
12337
+ this.windowsNoMagicRoot = options2.windowsNoMagicRoot !== void 0 ? options2.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
11885
12338
  this.globSet = [];
11886
12339
  this.globParts = [];
11887
12340
  this.set = [];
@@ -11903,8 +12356,8 @@ var Minimatch = class {
11903
12356
  }
11904
12357
  make() {
11905
12358
  const pattern = this.pattern;
11906
- const options = this.options;
11907
- if (!options.nocomment && pattern.charAt(0) === "#") {
12359
+ const options2 = this.options;
12360
+ if (!options2.nocomment && pattern.charAt(0) === "#") {
11908
12361
  this.comment = true;
11909
12362
  return;
11910
12363
  }
@@ -11914,7 +12367,7 @@ var Minimatch = class {
11914
12367
  }
11915
12368
  this.parseNegate();
11916
12369
  this.globSet = [...new Set(this.braceExpand())];
11917
- if (options.debug) {
12370
+ if (options2.debug) {
11918
12371
  this.debug = (...args) => console.error(...args);
11919
12372
  }
11920
12373
  this.debug(this.pattern, this.globSet);
@@ -12371,7 +12824,7 @@ var Minimatch = class {
12371
12824
  }
12372
12825
  parse(pattern) {
12373
12826
  assertValidPattern(pattern);
12374
- const options = this.options;
12827
+ const options2 = this.options;
12375
12828
  if (pattern === "**")
12376
12829
  return GLOBSTAR;
12377
12830
  if (pattern === "")
@@ -12379,13 +12832,13 @@ var Minimatch = class {
12379
12832
  let m;
12380
12833
  let fastTest = null;
12381
12834
  if (m = pattern.match(starRE)) {
12382
- fastTest = options.dot ? starTestDot : starTest;
12835
+ fastTest = options2.dot ? starTestDot : starTest;
12383
12836
  } else if (m = pattern.match(starDotExtRE)) {
12384
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
12837
+ fastTest = (options2.nocase ? options2.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options2.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
12385
12838
  } else if (m = pattern.match(qmarksRE)) {
12386
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
12839
+ fastTest = (options2.nocase ? options2.dot ? qmarksTestNocaseDot : qmarksTestNocase : options2.dot ? qmarksTestDot : qmarksTest)(m);
12387
12840
  } else if (m = pattern.match(starDotStarRE)) {
12388
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
12841
+ fastTest = options2.dot ? starDotStarTestDot : starDotStarTest;
12389
12842
  } else if (m = pattern.match(dotStarRE)) {
12390
12843
  fastTest = dotStarTest;
12391
12844
  }
@@ -12403,9 +12856,9 @@ var Minimatch = class {
12403
12856
  this.regexp = false;
12404
12857
  return this.regexp;
12405
12858
  }
12406
- const options = this.options;
12407
- const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
12408
- const flags = new Set(options.nocase ? ["i"] : []);
12859
+ const options2 = this.options;
12860
+ const twoStar = options2.noglobstar ? star2 : options2.dot ? twoStarDot : twoStarNoDot;
12861
+ const flags = new Set(options2.nocase ? ["i"] : []);
12409
12862
  let re2 = set.map((pattern) => {
12410
12863
  const pp = pattern.map((p) => {
12411
12864
  if (p instanceof RegExp) {
@@ -12477,7 +12930,7 @@ var Minimatch = class {
12477
12930
  if (f === "/" && partial) {
12478
12931
  return true;
12479
12932
  }
12480
- const options = this.options;
12933
+ const options2 = this.options;
12481
12934
  if (this.isWindows) {
12482
12935
  f = f.split("\\").join("/");
12483
12936
  }
@@ -12493,18 +12946,18 @@ var Minimatch = class {
12493
12946
  }
12494
12947
  for (const pattern of set) {
12495
12948
  let file = ff;
12496
- if (options.matchBase && pattern.length === 1) {
12949
+ if (options2.matchBase && pattern.length === 1) {
12497
12950
  file = [filename];
12498
12951
  }
12499
12952
  const hit = this.matchOne(file, pattern, partial);
12500
12953
  if (hit) {
12501
- if (options.flipNegate) {
12954
+ if (options2.flipNegate) {
12502
12955
  return true;
12503
12956
  }
12504
12957
  return !this.negate;
12505
12958
  }
12506
12959
  }
12507
- if (options.flipNegate) {
12960
+ if (options2.flipNegate) {
12508
12961
  return false;
12509
12962
  }
12510
12963
  return this.negate;
@@ -12523,6 +12976,7 @@ var import_yaml = __toESM(require_dist(), 1);
12523
12976
 
12524
12977
  // src/recipe/companions.ts
12525
12978
  var import_semver2 = __toESM(require_semver2(), 1);
12979
+ import { dirname, join as join2 } from "node:path";
12526
12980
  import { fileURLToPath } from "node:url";
12527
12981
 
12528
12982
  // src/recipe/extensions.ts
@@ -12530,9 +12984,7 @@ import { createRequire, findPackageJSON } from "node:module";
12530
12984
  var require2 = createRequire(import.meta.url);
12531
12985
 
12532
12986
  // src/recipe/companions.ts
12533
- var recipesManifestPath = fileURLToPath(
12534
- new URL("../../package.json", import.meta.url)
12535
- );
12987
+ var recipesModuleDir = dirname(fileURLToPath(import.meta.url));
12536
12988
 
12537
12989
  // src/recipe/package.ts
12538
12990
  var RESOURCE_KEYS = [
@@ -12574,10 +13026,10 @@ var MCP_SESSION_ENV = `${RECIPE_ENV_PREFIX}MCP_SESSION`;
12574
13026
  var MCP_LOCAL_CONFIG_ENV = `${RECIPE_ENV_PREFIX}MCP_LOCAL_CONFIG`;
12575
13027
  var MCP_BIN_DIR_ENV = `${RECIPE_ENV_PREFIX}MCP_BIN_DIR`;
12576
13028
  function defaultMcpSessionPath(cwd) {
12577
- return join(cwd, ".pi", "mcp-session.json");
13029
+ return join3(cwd, ".pi", "mcp-session.json");
12578
13030
  }
12579
13031
  function defaultMcporterConfigPath(cwd) {
12580
- return join(cwd, ".pi", "mcporter.json");
13032
+ return join3(cwd, ".pi", "mcporter.json");
12581
13033
  }
12582
13034
  function mcpSessionAllowsTool(server, toolName) {
12583
13035
  return mcpSelectionAllowsTool(server.package_tools, toolName) && server.agent_tools.some(
@@ -12638,7 +13090,10 @@ var FORBIDDEN_DELEGATED_FLAGS = /* @__PURE__ */ new Set([
12638
13090
  "--no-oauth",
12639
13091
  "--oauth-timeout",
12640
13092
  "--raw-strings",
12641
- "--no-coerce"
13093
+ "--no-coerce",
13094
+ "--save-images",
13095
+ "--params",
13096
+ "--mcp"
12642
13097
  ]);
12643
13098
  var LIST_OUTPUT_MODES = /* @__PURE__ */ new Map([
12644
13099
  ["--schema", "schema"],
@@ -12667,14 +13122,14 @@ function withNoOAuth(args) {
12667
13122
  }
12668
13123
  function forbiddenFlag(args) {
12669
13124
  const literalSeparator = args.indexOf("--");
12670
- const options = literalSeparator === -1 ? args : args.slice(0, literalSeparator);
12671
- return options.map(flagName).find((flag) => FORBIDDEN_DELEGATED_FLAGS.has(flag));
13125
+ const options2 = literalSeparator === -1 ? args : args.slice(0, literalSeparator);
13126
+ return options2.map(flagName).find((flag) => FORBIDDEN_DELEGATED_FLAGS.has(flag));
12672
13127
  }
12673
13128
  function listOutputModeError(args) {
12674
13129
  const literalSeparator = args.indexOf("--");
12675
- const options = literalSeparator === -1 ? args : args.slice(0, literalSeparator);
13130
+ const options2 = literalSeparator === -1 ? args : args.slice(0, literalSeparator);
12676
13131
  const modes = new Set(
12677
- options.map((arg) => LIST_OUTPUT_MODES.get(flagName(arg))).filter((mode) => Boolean(mode))
13132
+ options2.map((arg) => LIST_OUTPUT_MODES.get(flagName(arg))).filter((mode) => Boolean(mode))
12678
13133
  );
12679
13134
  return modes.size > 1 ? "mcp list accepts only one output mode: --schema, --all-parameters, or --status." : void 0;
12680
13135
  }
@@ -12755,19 +13210,17 @@ function validateList(args, policy) {
12755
13210
  }
12756
13211
  };
12757
13212
  }
12758
- var CALL_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set(["--json", "--output", "--timeout"]);
12759
13213
  function callSyntaxError(args) {
12760
13214
  for (let index = 0; index < args.length; index += 1) {
12761
13215
  const arg = args[index];
12762
13216
  if (arg === "--") {
12763
13217
  return "mcp call positional arguments are unavailable; use key=value or --json instead.";
12764
13218
  }
13219
+ if (arg === "-h") continue;
12765
13220
  if (arg.startsWith("--")) {
12766
- const flag = flagName(arg);
12767
- if (!CALL_FLAGS_WITH_VALUE.has(flag)) {
12768
- return `mcp call option '${flag}' is unavailable; use key=value or --json for tool arguments.`;
12769
- }
12770
- if (!arg.includes("=")) index += 1;
13221
+ const next = args[index + 1];
13222
+ if (!arg.includes("=") && next !== void 0 && !next.startsWith("--"))
13223
+ index += 1;
12771
13224
  continue;
12772
13225
  }
12773
13226
  if (/^[A-Za-z_][A-Za-z0-9_.-]*=/.test(arg)) continue;
@@ -12848,7 +13301,7 @@ function loadMcporterCli() {
12848
13301
  if (mcporterCliPromise) return mcporterCliPromise;
12849
13302
  const previousDisableAutorun = process.env.MCPORTER_DISABLE_AUTORUN;
12850
13303
  process.env.MCPORTER_DISABLE_AUTORUN = "1";
12851
- mcporterCliPromise = import("./cli-BM23ZXPJ.js").finally(() => {
13304
+ mcporterCliPromise = import("./cli-UQ5QXFXU.js").finally(() => {
12852
13305
  if (previousDisableAutorun === void 0) {
12853
13306
  delete process.env.MCPORTER_DISABLE_AUTORUN;
12854
13307
  } else {
@@ -12859,7 +13312,13 @@ function loadMcporterCli() {
12859
13312
  }
12860
13313
  async function acquireRuntime() {
12861
13314
  const shared = currentMcpCommandContext()?.runtime;
12862
- return shared ? { runtime: shared, owned: false } : { runtime: await createMcpRuntime(), owned: true };
13315
+ return shared ? { runtime: shared, owned: false } : {
13316
+ runtime: await createMcpRuntime(
13317
+ mcpCommandEnv().MCPORTER_CONFIG,
13318
+ mcpCommandEnv()
13319
+ ),
13320
+ owned: true
13321
+ };
12863
13322
  }
12864
13323
  async function closeOwnedRuntime(runtime, owned) {
12865
13324
  if (owned) await runtime.close();
@@ -12882,16 +13341,16 @@ var McpRemoteToolResultError = class extends Error {
12882
13341
  details;
12883
13342
  };
12884
13343
  var McpRunToolError = class extends Error {
12885
- constructor(server, tool, message, options) {
12886
- super(message, options);
13344
+ constructor(server, tool, message, options2) {
13345
+ super(message, options2);
12887
13346
  this.server = server;
12888
13347
  this.tool = tool;
12889
13348
  this.name = "McpRunToolError";
12890
- this.details = options?.details;
12891
- this.code = options?.details?.code;
12892
- this.retryable = options?.details?.retryable;
12893
- this.action = options?.details?.action;
12894
- this.outcome = options?.details?.outcome;
13349
+ this.details = options2?.details;
13350
+ this.code = options2?.details?.code;
13351
+ this.retryable = options2?.details?.retryable;
13352
+ this.action = options2?.details?.action;
13353
+ this.outcome = options2?.details?.outcome;
12895
13354
  }
12896
13355
  server;
12897
13356
  tool;
@@ -12908,13 +13367,13 @@ function isHelpArg(value) {
12908
13367
  function readStdin() {
12909
13368
  const source = currentMcpCommandContext()?.stdin ?? input;
12910
13369
  source.setEncoding("utf8");
12911
- return new Promise((resolve2, reject) => {
13370
+ return new Promise((resolve3, reject) => {
12912
13371
  let data = "";
12913
13372
  source.on("data", (chunk) => {
12914
13373
  data += chunk;
12915
13374
  });
12916
13375
  source.on("error", reject);
12917
- source.on("end", () => resolve2(data));
13376
+ source.on("end", () => resolve3(data));
12918
13377
  });
12919
13378
  }
12920
13379
  function checkedCallResult(callResult) {
@@ -12983,7 +13442,7 @@ var ToolCallQueue = class {
12983
13442
  return Promise.resolve(this.releaseHandle());
12984
13443
  }
12985
13444
  return new Promise(
12986
- (resolve2, reject) => this.waiting.push({ resolve: resolve2, reject })
13445
+ (resolve3, reject) => this.waiting.push({ resolve: resolve3, reject })
12987
13446
  );
12988
13447
  }
12989
13448
  cancel(error) {
@@ -13123,17 +13582,17 @@ async function readSession() {
13123
13582
  }
13124
13583
  function sessionPolicyPath() {
13125
13584
  const workspacePath = defaultMcpSessionPath(sessionRoot());
13126
- return existsSync(workspacePath) ? workspacePath : process.env[MCP_SESSION_ENV2] || workspacePath;
13585
+ return existsSync(workspacePath) ? workspacePath : mcpCommandEnv()[MCP_SESSION_ENV2] || workspacePath;
13127
13586
  }
13128
13587
  function sessionMcporterConfigPath() {
13129
13588
  const workspacePath = defaultMcporterConfigPath(sessionRoot());
13130
- return existsSync(workspacePath) ? workspacePath : process.env.MCPORTER_CONFIG || workspacePath;
13589
+ return existsSync(workspacePath) ? workspacePath : mcpCommandEnv().MCPORTER_CONFIG || workspacePath;
13131
13590
  }
13132
13591
  function sessionRoot() {
13133
- return process.env.PI_RECIPES_MCP_SESSION_ROOT || process.cwd();
13592
+ return mcpCommandEnv().PI_RECIPES_MCP_SESSION_ROOT || process.cwd();
13134
13593
  }
13135
13594
  function pinSessionMcporterConfig() {
13136
- process.env.MCPORTER_CONFIG = sessionMcporterConfigPath();
13595
+ mcpCommandEnv().MCPORTER_CONFIG = sessionMcporterConfigPath();
13137
13596
  }
13138
13597
  async function sessionCliPolicy() {
13139
13598
  return createMcpCliSessionPolicy(await readSession());
@@ -13149,7 +13608,7 @@ function catalogFingerprint(server) {
13149
13608
  ).digest("hex").slice(0, 20);
13150
13609
  }
13151
13610
  function catalogCachePath(server) {
13152
- return join2(
13611
+ return join4(
13153
13612
  sessionRoot(),
13154
13613
  ".pi",
13155
13614
  "mcp-catalogs",
@@ -13168,7 +13627,7 @@ async function readCachedCatalog(server) {
13168
13627
  }
13169
13628
  }
13170
13629
  async function writeCachedCatalog(server, tools) {
13171
- const directory = join2(sessionRoot(), ".pi", "mcp-catalogs");
13630
+ const directory = join4(sessionRoot(), ".pi", "mcp-catalogs");
13172
13631
  await mkdir(directory, { recursive: true });
13173
13632
  const path2 = catalogCachePath(server);
13174
13633
  const temporary = `${path2}.${process.pid}.${randomUUID()}.tmp`;
@@ -13235,7 +13694,7 @@ async function discoverServerCatalog(runtime, server, timeoutMs) {
13235
13694
  const cached = await readCachedCatalog(server);
13236
13695
  if (cached) return cached;
13237
13696
  const lock = `${catalogCachePath(server)}.lock`;
13238
- await mkdir(dirname2(lock), { recursive: true });
13697
+ await mkdir(dirname3(lock), { recursive: true });
13239
13698
  let ownsLock = false;
13240
13699
  const deadline = Date.now() + timeoutMs;
13241
13700
  while (!ownsLock && Date.now() < deadline) {
@@ -13321,7 +13780,7 @@ function parseSearchArgs(args) {
13321
13780
  }
13322
13781
  let parsed;
13323
13782
  try {
13324
- parsed = parseArgs({
13783
+ parsed = parseArgs2({
13325
13784
  args,
13326
13785
  options: SEARCH_OPTIONS,
13327
13786
  allowPositionals: true
@@ -13467,9 +13926,9 @@ function toolCount(count) {
13467
13926
  return `${count} tool${count === 1 ? "" : "s"}`;
13468
13927
  }
13469
13928
  function parseListTimeoutMs(args) {
13470
- const configured = process.env.MCPORTER_LIST_TIMEOUT;
13929
+ const configured = mcpCommandEnv().MCPORTER_LIST_TIMEOUT;
13471
13930
  let raw = configured && /^[1-9]\d*$/.test(configured) ? configured : String(DEFAULT_LIST_TIMEOUT_MS);
13472
- const { values } = parseArgs({
13931
+ const { values } = parseArgs2({
13473
13932
  args: [...args.slice(1)],
13474
13933
  options: { timeout: { type: "string" } },
13475
13934
  strict: false,
@@ -13488,7 +13947,7 @@ function parseListTimeoutMs(args) {
13488
13947
  return Number.isSafeInteger(timeout) ? timeout : "mcp list: --timeout must be a positive integer (milliseconds).";
13489
13948
  }
13490
13949
  function withListTimeout(promise, timeoutMs) {
13491
- return new Promise((resolve2, reject) => {
13950
+ return new Promise((resolve3, reject) => {
13492
13951
  const timer = setTimeout(
13493
13952
  () => reject(new Error(`timed out after ${timeoutMs}ms`)),
13494
13953
  timeoutMs
@@ -13496,7 +13955,7 @@ function withListTimeout(promise, timeoutMs) {
13496
13955
  promise.then(
13497
13956
  (value) => {
13498
13957
  clearTimeout(timer);
13499
- resolve2(value);
13958
+ resolve3(value);
13500
13959
  },
13501
13960
  (error) => {
13502
13961
  clearTimeout(timer);
@@ -13536,10 +13995,10 @@ function isValidListOption(arg) {
13536
13995
  function compactListArgumentError(args) {
13537
13996
  const rest = args.slice(1);
13538
13997
  const target = rest[0] !== void 0 && !rest[0].startsWith("-");
13539
- const options = target ? rest.slice(1) : rest;
13998
+ const options2 = target ? rest.slice(1) : rest;
13540
13999
  try {
13541
- const { positionals } = parseArgs({
13542
- args: [...options],
14000
+ const { positionals } = parseArgs2({
14001
+ args: [...options2],
13543
14002
  options: LIST_OPTIONS,
13544
14003
  allowPositionals: true
13545
14004
  });
@@ -13548,7 +14007,7 @@ function compactListArgumentError(args) {
13548
14007
  }
13549
14008
  return void 0;
13550
14009
  } catch {
13551
- const offending = options.find(
14010
+ const offending = options2.find(
13552
14011
  (arg) => arg.startsWith("-") && !isValidListOption(arg)
13553
14012
  );
13554
14013
  return offending ? `Unknown mcp list option '${offending}'.` : void 0;
@@ -13880,20 +14339,20 @@ async function createTools(opts) {
13880
14339
  release?.();
13881
14340
  }
13882
14341
  })();
13883
- const record2 = {
14342
+ const record3 = {
13884
14343
  ref: `${server}.${property}`,
13885
14344
  observed: false,
13886
14345
  outcome: "pending",
13887
14346
  promise: rawCall
13888
14347
  };
13889
- calls.push(record2);
14348
+ calls.push(record3);
13890
14349
  rawCall.then(
13891
14350
  () => {
13892
- record2.outcome = "succeeded";
14351
+ record3.outcome = "succeeded";
13893
14352
  },
13894
14353
  (error) => {
13895
- record2.outcome = "failed";
13896
- record2.error = error instanceof Error ? error.message : String(error);
14354
+ record3.outcome = "failed";
14355
+ record3.error = error instanceof Error ? error.message : String(error);
13897
14356
  }
13898
14357
  );
13899
14358
  return new Proxy(rawCall, {
@@ -13902,7 +14361,7 @@ async function createTools(opts) {
13902
14361
  return () => `[pending tool call ${server}.${property} \u2014 did you forget await?]`;
13903
14362
  }
13904
14363
  if (key === "then" || key === "catch" || key === "finally") {
13905
- record2.observed = true;
14364
+ record3.observed = true;
13906
14365
  }
13907
14366
  const value = Reflect.get(target, key, target);
13908
14367
  return typeof value === "function" ? value.bind(target) : value;
@@ -13995,22 +14454,22 @@ function positiveInteger(value, label, fallback) {
13995
14454
  }
13996
14455
  async function runMcpJavaScript(code, opts = {}) {
13997
14456
  const timeoutMs = positiveInteger(
13998
- opts.timeoutMs ?? process.env.PI_RECIPES_MCP_RUN_TIMEOUT_MS,
14457
+ opts.timeoutMs ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_TIMEOUT_MS,
13999
14458
  "PI_RECIPES_MCP_RUN_TIMEOUT_MS",
14000
14459
  DEFAULT_RUN_TIMEOUT_MS
14001
14460
  );
14002
14461
  const callTimeoutMs = positiveInteger(
14003
- opts.callTimeoutMs ?? process.env.PI_RECIPES_MCP_RUN_CALL_TIMEOUT_MS,
14462
+ opts.callTimeoutMs ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_CALL_TIMEOUT_MS,
14004
14463
  "PI_RECIPES_MCP_RUN_CALL_TIMEOUT_MS",
14005
14464
  Math.min(DEFAULT_TOOL_CALL_TIMEOUT_MS, timeoutMs)
14006
14465
  );
14007
14466
  const maxCalls = positiveInteger(
14008
- opts.maxCalls ?? process.env.PI_RECIPES_MCP_RUN_MAX_CALLS,
14467
+ opts.maxCalls ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_MAX_CALLS,
14009
14468
  "PI_RECIPES_MCP_RUN_MAX_CALLS",
14010
14469
  DEFAULT_MAX_RUN_TOOL_CALLS
14011
14470
  );
14012
14471
  const maxConcurrentCalls = positiveInteger(
14013
- opts.maxConcurrentCalls ?? process.env.PI_RECIPES_MCP_RUN_MAX_CONCURRENCY,
14472
+ opts.maxConcurrentCalls ?? mcpCommandEnv().PI_RECIPES_MCP_RUN_MAX_CONCURRENCY,
14014
14473
  "PI_RECIPES_MCP_RUN_MAX_CONCURRENCY",
14015
14474
  DEFAULT_MAX_CONCURRENT_TOOL_CALLS
14016
14475
  );
@@ -14064,8 +14523,8 @@ async function runMcpJavaScript(code, opts = {}) {
14064
14523
  try {
14065
14524
  await Promise.race([
14066
14525
  Promise.allSettled(unsafeAtExit.map((call) => call.promise)),
14067
- new Promise((resolve2) => {
14068
- settleTimer = setTimeout(resolve2, remainingSettleMs);
14526
+ new Promise((resolve3) => {
14527
+ settleTimer = setTimeout(resolve3, remainingSettleMs);
14069
14528
  })
14070
14529
  ]);
14071
14530
  } finally {
@@ -14149,7 +14608,10 @@ async function runCode(args) {
14149
14608
  stderr.write("mcp run accepts at most one file path.\n");
14150
14609
  return 2;
14151
14610
  }
14152
- const code = file ? await readFile(file, "utf8") : await readStdin();
14611
+ const code = file ? await readFile(
14612
+ resolve2(mcpCommandEnv()[MCP_SESSION_ROOT_ENV] || process.cwd(), file),
14613
+ "utf8"
14614
+ ) : await readStdin();
14153
14615
  if (!code.trim()) {
14154
14616
  stderr.write(
14155
14617
  "mcp run: empty script. Pass a file path or pipe JavaScript on stdin (see `mcp run --help`).\n"
@@ -14159,7 +14621,7 @@ async function runCode(args) {
14159
14621
  let timeoutMs;
14160
14622
  try {
14161
14623
  timeoutMs = positiveInteger(
14162
- process.env.PI_RECIPES_MCP_RUN_TIMEOUT_MS,
14624
+ mcpCommandEnv().PI_RECIPES_MCP_RUN_TIMEOUT_MS,
14163
14625
  "PI_RECIPES_MCP_RUN_TIMEOUT_MS",
14164
14626
  DEFAULT_RUN_TIMEOUT_MS
14165
14627
  );
@@ -14243,21 +14705,6 @@ function createDelegatedErrorFilter(write) {
14243
14705
  }
14244
14706
  };
14245
14707
  }
14246
- function duplicateCallArgumentKeys(args) {
14247
- const seen = /* @__PURE__ */ new Set();
14248
- const duplicates = /* @__PURE__ */ new Set();
14249
- for (const token of args.slice(1)) {
14250
- const rawKey = token.match(/^([A-Za-z_][A-Za-z0-9_.-]*)=/)?.[1];
14251
- if (!rawKey) continue;
14252
- const key = rawKey.replace(
14253
- /-([a-zA-Z0-9])/g,
14254
- (_match, char) => char.toUpperCase()
14255
- );
14256
- if (seen.has(key)) duplicates.add(key);
14257
- seen.add(key);
14258
- }
14259
- return [...duplicates];
14260
- }
14261
14708
  function callJsonArgumentError(args) {
14262
14709
  for (let index = 1; index < args.length; index += 1) {
14263
14710
  const arg = args[index];
@@ -14291,7 +14738,22 @@ async function callWithMcporter(args) {
14291
14738
  let owned = false;
14292
14739
  try {
14293
14740
  ({ runtime, owned } = await acquireRuntime());
14294
- if (usesPiMcpClient()) return await callWithSharedRuntime(runtime, args);
14741
+ if (usesPiMcpClient(mcpCommandEnv()) || args.includes("--help") || args.includes("-h"))
14742
+ return await callWithSharedRuntime(runtime, args);
14743
+ const words2 = takeOptions(args.slice(1), CALL_OPTIONS).rest;
14744
+ try {
14745
+ parseSchemaArgs(
14746
+ { path: ["mcp", "call", args[0]], description: "", schema: {} },
14747
+ words2,
14748
+ () => "{}",
14749
+ { assignments: true, unknown: true }
14750
+ );
14751
+ } catch (error) {
14752
+ if (!(error instanceof SchemaArgsError)) throw error;
14753
+ stderr.write(`${error.message}
14754
+ `);
14755
+ return 2;
14756
+ }
14295
14757
  const { handleCall } = await loadMcporterCli();
14296
14758
  await handleCall(runtime, args);
14297
14759
  return process.exitCode ?? 0;
@@ -14315,43 +14777,61 @@ async function callWithSharedRuntime(runtime, args) {
14315
14777
  }
14316
14778
  const server = selector.slice(0, separator);
14317
14779
  const tool = selector.slice(separator + 1);
14318
- const normalizedArgs = [...args];
14319
- for (let index = 1; index < normalizedArgs.length; index += 1) {
14320
- let token = normalizedArgs[index];
14321
- const equals = token.indexOf("=");
14322
- if (equals > 0 && !token.startsWith("--")) {
14323
- const rawValue = token.slice(equals + 1);
14324
- try {
14325
- const decoded = JSON.parse(rawValue);
14326
- if (typeof decoded === "string") {
14327
- token = `${token.slice(0, equals + 1)}${decoded}`;
14328
- normalizedArgs[index] = token;
14329
- }
14330
- } catch {
14331
- }
14332
- }
14333
- for (const flag of ["--json", "--timeout", "--output"]) {
14334
- if (token.startsWith(`${flag}=`)) {
14335
- normalizedArgs.splice(index, 1, flag, token.slice(flag.length + 1));
14336
- break;
14337
- }
14338
- }
14339
- if (normalizedArgs[index] === "--json" && normalizedArgs[index + 1] === "-") {
14340
- normalizedArgs[index + 1] = await readStdin();
14341
- }
14342
- }
14343
14780
  try {
14344
- const { parseCallArguments, resolveCallTimeout } = await loadMcporterCli();
14345
- const parsed = parseCallArguments(normalizedArgs);
14346
- const timeoutMs = resolveCallTimeout(parsed.timeoutMs);
14347
- const values = await restoreSchemaStringArguments(
14348
- runtime,
14349
- server,
14350
- tool,
14351
- parsed.args,
14352
- parsed.schemaStringCoercionCandidates,
14353
- timeoutMs
14781
+ const {
14782
+ options: { timeout, output = "auto" },
14783
+ rest
14784
+ } = takeOptions(args.slice(1), CALL_OPTIONS);
14785
+ if (timeout !== void 0 && !/^[1-9]\d*$/.test(String(timeout)))
14786
+ throw new Error("--timeout must be a positive integer (milliseconds).");
14787
+ if (!OUTPUT_FORMATS.includes(output))
14788
+ throw new Error(
14789
+ `--output format must be one of: ${OUTPUT_FORMATS.join(", ")}.`
14790
+ );
14791
+ const { resolveCallTimeout } = await loadMcporterCli();
14792
+ const timeoutMs = resolveCallTimeout(
14793
+ timeout === void 0 ? void 0 : Number(timeout)
14354
14794
  );
14795
+ const entry = await loadCallCatalogEntry(runtime, server, tool, timeoutMs);
14796
+ const schema = entry?.input_schema;
14797
+ const command = {
14798
+ path: ["mcp", "call", `${server}.${tool}`],
14799
+ description: entry?.description ?? "",
14800
+ schema: schema ?? {},
14801
+ // Flags the session refuses, and the call's own, are not the tool's.
14802
+ reserved: [
14803
+ ...[...FORBIDDEN_DELEGATED_FLAGS].map((flag) => flag.slice(2)),
14804
+ ...Object.keys(CALL_OPTIONS)
14805
+ ]
14806
+ };
14807
+ let stdinText;
14808
+ const parse2 = () => parseSchemaArgs(
14809
+ command,
14810
+ rest,
14811
+ () => {
14812
+ if (stdinText === void 0) throw NEEDS_STDIN;
14813
+ return stdinText;
14814
+ },
14815
+ // With no catalog entry the server judges every argument.
14816
+ { assignments: true, unknown: !schema }
14817
+ );
14818
+ let parsed;
14819
+ try {
14820
+ parsed = parse2();
14821
+ } catch (error) {
14822
+ if (error !== NEEDS_STDIN) throw error;
14823
+ stdinText = await readStdin();
14824
+ parsed = parse2();
14825
+ }
14826
+ if (parsed.help) {
14827
+ stdout.write(
14828
+ `${schemaHelp(command, `mcp list ${server}.${tool} --schema`)}
14829
+ `
14830
+ );
14831
+ return 0;
14832
+ }
14833
+ const options2 = { output };
14834
+ const values = parsed.args;
14355
14835
  const signal = currentMcpCommandContext()?.signal;
14356
14836
  const call = callToolWithHandshakeRetry(runtime, server, tool, () => ({
14357
14837
  args: values,
@@ -14371,9 +14851,9 @@ async function callWithSharedRuntime(runtime, args) {
14371
14851
  if (cancelled) signal.removeEventListener("abort", cancelled);
14372
14852
  }) : await call;
14373
14853
  const result = createCallResult(raw);
14374
- const rendered = selectCallOutput(result, raw, parsed.output);
14375
- const serialized = serializeCallOutput(rendered, parsed.output);
14376
- const configuredLimit = process.env.PI_RECIPES_MCP_MAX_OUTPUT_BYTES;
14854
+ const rendered = selectCallOutput(result, raw, options2.output);
14855
+ const serialized = serializeCallOutput(rendered, options2.output);
14856
+ const configuredLimit = mcpCommandEnv().PI_RECIPES_MCP_MAX_OUTPUT_BYTES;
14377
14857
  if (configuredLimit !== void 0) {
14378
14858
  const limit = Number(configuredLimit);
14379
14859
  if (!Number.isSafeInteger(limit) || limit <= 0) {
@@ -14395,11 +14875,26 @@ async function callWithSharedRuntime(runtime, args) {
14395
14875
  `);
14396
14876
  return asRecord(raw).isError === true ? 1 : 0;
14397
14877
  } catch (error) {
14878
+ if (error instanceof SchemaArgsError) {
14879
+ stderr.write(
14880
+ `${error.message}
14881
+ Run \`${error.usage} --help\` for its arguments.
14882
+ `
14883
+ );
14884
+ return 2;
14885
+ }
14398
14886
  stderr.write(`${describeSharedCallError(error, server, tool)}
14399
14887
  `);
14400
14888
  return 1;
14401
14889
  }
14402
14890
  }
14891
+ var OUTPUT_FORMATS = ["auto", "text", "markdown", "json", "raw"];
14892
+ var NEEDS_STDIN = /* @__PURE__ */ Symbol("needs stdin");
14893
+ var CALL_OPTIONS = {
14894
+ timeout: "string",
14895
+ output: "string",
14896
+ "no-oauth": "boolean"
14897
+ };
14403
14898
  function selectCallOutput(result, raw, format) {
14404
14899
  const preferred = {
14405
14900
  auto: ["json", "markdown", "text", "raw"],
@@ -14471,17 +14966,7 @@ function describeSharedCallError(error, server, tool) {
14471
14966
  }
14472
14967
  return issue.rawMessage || (error instanceof Error ? error.message : String(error));
14473
14968
  }
14474
- function schemaAllowsString(value) {
14475
- const schema = asRecord(value);
14476
- if (!schema) return false;
14477
- if (schema.type === "string") return true;
14478
- if (Array.isArray(schema.type) && schema.type.includes("string")) return true;
14479
- return ["anyOf", "oneOf", "allOf"].some((key) => {
14480
- const branches = schema[key];
14481
- return Array.isArray(branches) && branches.some(schemaAllowsString);
14482
- });
14483
- }
14484
- async function loadCallInputSchema(runtime, server, tool, timeoutMs) {
14969
+ async function loadCallCatalogEntry(runtime, server, tool, timeoutMs) {
14485
14970
  let cache = callCatalogCache.get(runtime);
14486
14971
  if (!cache) {
14487
14972
  cache = /* @__PURE__ */ new Map();
@@ -14508,27 +14993,7 @@ async function loadCallInputSchema(runtime, server, tool, timeoutMs) {
14508
14993
  const catalog = await withListTimeout(pending, timeoutMs).catch(
14509
14994
  () => void 0
14510
14995
  );
14511
- return catalog?.find((entry) => entry.name === tool)?.input_schema;
14512
- }
14513
- async function restoreSchemaStringArguments(runtime, server, tool, values, candidates, timeoutMs) {
14514
- if (!candidates || Object.keys(candidates).length === 0) return values;
14515
- const inputSchema = await loadCallInputSchema(
14516
- runtime,
14517
- server,
14518
- tool,
14519
- timeoutMs
14520
- );
14521
- const properties = asRecord(inputSchema?.properties);
14522
- if (!properties) return values;
14523
- let corrected;
14524
- for (const [key, rawValue] of Object.entries(candidates)) {
14525
- if (typeof values[key] !== "number" || !schemaAllowsString(properties[key])) {
14526
- continue;
14527
- }
14528
- corrected ??= { ...values };
14529
- corrected[key] = rawValue;
14530
- }
14531
- return corrected ?? values;
14996
+ return catalog?.find((entry) => entry.name === tool);
14532
14997
  }
14533
14998
  async function main(args = process.argv.slice(2)) {
14534
14999
  if (args.length === 0 || args[0] === "--help" || args[0] === "-h" || args[0] === "help" && args.length === 1) {
@@ -14546,7 +15011,7 @@ async function main(args = process.argv.slice(2)) {
14546
15011
  `);
14547
15012
  return 0;
14548
15013
  }
14549
- if (args[0] === "call" && args.slice(1).some(isHelpArg)) {
15014
+ if (args[0] === "call" && args.slice(1).some(isHelpArg) && (args[1] === void 0 || args[1].startsWith("-") || isHelpArg(args[1]))) {
14550
15015
  stdout.write(`${mcpCallHelpText()}
14551
15016
  `);
14552
15017
  return 0;
@@ -14592,20 +15057,6 @@ async function main(args = process.argv.slice(2)) {
14592
15057
  stderr.write("mcp: invalid session command policy result.\n");
14593
15058
  return 1;
14594
15059
  }
14595
- if (args[0] === "call") {
14596
- const duplicates = duplicateCallArgumentKeys(
14597
- validated.command.args.slice(1)
14598
- );
14599
- if (duplicates.length > 0) {
14600
- stderr.write(
14601
- `mcp call: argument${duplicates.length === 1 ? "" : "s"} ${duplicates.map((key) => `'${key}'`).join(
14602
- ", "
14603
- )} ${duplicates.length === 1 ? "was" : "were"} passed more than once. Pass each argument exactly once.
14604
- `
14605
- );
14606
- return 2;
14607
- }
14608
- }
14609
15060
  const delegatedArgs = validated.command.args;
14610
15061
  if (delegatedArgs[0] === "list") return compactList(delegatedArgs);
14611
15062
  if (delegatedArgs[0] === "call") {
@@ -14630,12 +15081,14 @@ async function executeMcpCommand(opts) {
14630
15081
 
14631
15082
  export {
14632
15083
  context,
15084
+ runWithMcpCommandEnv,
14633
15085
  installMcpCommandIoRouting,
14634
15086
  MCP_DAEMON_SOCKET_ENV,
14635
15087
  MCP_DAEMON_TOKEN_ENV,
14636
15088
  MCP_DAEMON_FINGERPRINT_ENV,
14637
15089
  MCP_DAEMON_PARENT_PID_ENV,
14638
15090
  MCP_DAEMON_MAX_FRAME_BYTES,
15091
+ isMcpDaemonSocketDirectory,
14639
15092
  serializeMcpDaemonEnvelope,
14640
15093
  mcpDaemonRequestContext,
14641
15094
  discoverMcpCatalogs,