@getmagical/cli 0.8.0 → 0.9.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.
package/dist/index.js CHANGED
@@ -1897,13 +1897,13 @@ var require_ast = __commonJS({
1897
1897
  helperExpression: function helperExpression(node) {
1898
1898
  return node.type === "SubExpression" || (node.type === "MustacheStatement" || node.type === "BlockStatement") && !!(node.params && node.params.length || node.hash);
1899
1899
  },
1900
- scopedId: function scopedId(path20) {
1901
- return /^\.|this\b/.test(path20.original);
1900
+ scopedId: function scopedId(path21) {
1901
+ return /^\.|this\b/.test(path21.original);
1902
1902
  },
1903
1903
  // an ID is simple if it only has one part, and that part is not
1904
1904
  // `..` or `this`.
1905
- simpleId: function simpleId(path20) {
1906
- return path20.parts.length === 1 && !AST.helpers.scopedId(path20) && !path20.depth;
1905
+ simpleId: function simpleId(path21) {
1906
+ return path21.parts.length === 1 && !AST.helpers.scopedId(path21) && !path21.depth;
1907
1907
  }
1908
1908
  }
1909
1909
  };
@@ -2973,12 +2973,12 @@ var require_helpers2 = __commonJS({
2973
2973
  loc
2974
2974
  };
2975
2975
  }
2976
- function prepareMustache(path20, params, hash, open2, strip, locInfo) {
2976
+ function prepareMustache(path21, params, hash, open2, strip, locInfo) {
2977
2977
  var escapeFlag = open2.charAt(3) || open2.charAt(2), escaped = escapeFlag !== "{" && escapeFlag !== "&";
2978
2978
  var decorator = /\*/.test(open2);
2979
2979
  return {
2980
2980
  type: decorator ? "Decorator" : "MustacheStatement",
2981
- path: path20,
2981
+ path: path21,
2982
2982
  params,
2983
2983
  hash,
2984
2984
  escaped,
@@ -3296,9 +3296,9 @@ var require_compiler = __commonJS({
3296
3296
  },
3297
3297
  DecoratorBlock: function DecoratorBlock(decorator) {
3298
3298
  var program2 = decorator.program && this.compileProgram(decorator.program);
3299
- var params = this.setupFullMustacheParams(decorator, program2, void 0), path20 = decorator.path;
3299
+ var params = this.setupFullMustacheParams(decorator, program2, void 0), path21 = decorator.path;
3300
3300
  this.useDecorators = true;
3301
- this.opcode("registerDecorator", params.length, path20.original);
3301
+ this.opcode("registerDecorator", params.length, path21.original);
3302
3302
  },
3303
3303
  PartialStatement: function PartialStatement(partial) {
3304
3304
  this.usePartial = true;
@@ -3362,46 +3362,46 @@ var require_compiler = __commonJS({
3362
3362
  }
3363
3363
  },
3364
3364
  ambiguousSexpr: function ambiguousSexpr(sexpr, program2, inverse) {
3365
- var path20 = sexpr.path, name = path20.parts[0], isBlock = program2 != null || inverse != null;
3366
- this.opcode("getContext", path20.depth);
3365
+ var path21 = sexpr.path, name = path21.parts[0], isBlock = program2 != null || inverse != null;
3366
+ this.opcode("getContext", path21.depth);
3367
3367
  this.opcode("pushProgram", program2);
3368
3368
  this.opcode("pushProgram", inverse);
3369
- path20.strict = true;
3370
- this.accept(path20);
3369
+ path21.strict = true;
3370
+ this.accept(path21);
3371
3371
  this.opcode("invokeAmbiguous", name, isBlock);
3372
3372
  },
3373
3373
  simpleSexpr: function simpleSexpr(sexpr) {
3374
- var path20 = sexpr.path;
3375
- path20.strict = true;
3376
- this.accept(path20);
3374
+ var path21 = sexpr.path;
3375
+ path21.strict = true;
3376
+ this.accept(path21);
3377
3377
  this.opcode("resolvePossibleLambda");
3378
3378
  },
3379
3379
  helperSexpr: function helperSexpr(sexpr, program2, inverse) {
3380
- var params = this.setupFullMustacheParams(sexpr, program2, inverse), path20 = sexpr.path, name = path20.parts[0];
3380
+ var params = this.setupFullMustacheParams(sexpr, program2, inverse), path21 = sexpr.path, name = path21.parts[0];
3381
3381
  if (this.options.knownHelpers[name]) {
3382
3382
  this.opcode("invokeKnownHelper", params.length, name);
3383
3383
  } else if (this.options.knownHelpersOnly) {
3384
3384
  throw new _exception2["default"]("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
3385
3385
  } else {
3386
- path20.strict = true;
3387
- path20.falsy = true;
3388
- this.accept(path20);
3389
- this.opcode("invokeHelper", params.length, path20.original, _ast2["default"].helpers.simpleId(path20));
3386
+ path21.strict = true;
3387
+ path21.falsy = true;
3388
+ this.accept(path21);
3389
+ this.opcode("invokeHelper", params.length, path21.original, _ast2["default"].helpers.simpleId(path21));
3390
3390
  }
3391
3391
  },
3392
- PathExpression: function PathExpression(path20) {
3393
- this.addDepth(path20.depth);
3394
- this.opcode("getContext", path20.depth);
3395
- var name = path20.parts[0], scoped = _ast2["default"].helpers.scopedId(path20), blockParamId = !path20.depth && !scoped && this.blockParamIndex(name);
3392
+ PathExpression: function PathExpression(path21) {
3393
+ this.addDepth(path21.depth);
3394
+ this.opcode("getContext", path21.depth);
3395
+ var name = path21.parts[0], scoped = _ast2["default"].helpers.scopedId(path21), blockParamId = !path21.depth && !scoped && this.blockParamIndex(name);
3396
3396
  if (blockParamId) {
3397
- this.opcode("lookupBlockParam", blockParamId, path20.parts);
3397
+ this.opcode("lookupBlockParam", blockParamId, path21.parts);
3398
3398
  } else if (!name) {
3399
3399
  this.opcode("pushContext");
3400
- } else if (path20.data) {
3400
+ } else if (path21.data) {
3401
3401
  this.options.data = true;
3402
- this.opcode("lookupData", path20.depth, path20.parts, path20.strict);
3402
+ this.opcode("lookupData", path21.depth, path21.parts, path21.strict);
3403
3403
  } else {
3404
- this.opcode("lookupOnContext", path20.parts, path20.falsy, path20.strict, scoped);
3404
+ this.opcode("lookupOnContext", path21.parts, path21.falsy, path21.strict, scoped);
3405
3405
  }
3406
3406
  },
3407
3407
  StringLiteral: function StringLiteral(string) {
@@ -3751,16 +3751,16 @@ var require_util = __commonJS({
3751
3751
  }
3752
3752
  exports.urlGenerate = urlGenerate;
3753
3753
  function normalize(aPath) {
3754
- var path20 = aPath;
3754
+ var path21 = aPath;
3755
3755
  var url = urlParse(aPath);
3756
3756
  if (url) {
3757
3757
  if (!url.path) {
3758
3758
  return aPath;
3759
3759
  }
3760
- path20 = url.path;
3760
+ path21 = url.path;
3761
3761
  }
3762
- var isAbsolute = exports.isAbsolute(path20);
3763
- var parts = path20.split(/\/+/);
3762
+ var isAbsolute = exports.isAbsolute(path21);
3763
+ var parts = path21.split(/\/+/);
3764
3764
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
3765
3765
  part = parts[i];
3766
3766
  if (part === ".") {
@@ -3777,15 +3777,15 @@ var require_util = __commonJS({
3777
3777
  }
3778
3778
  }
3779
3779
  }
3780
- path20 = parts.join("/");
3781
- if (path20 === "") {
3782
- path20 = isAbsolute ? "/" : ".";
3780
+ path21 = parts.join("/");
3781
+ if (path21 === "") {
3782
+ path21 = isAbsolute ? "/" : ".";
3783
3783
  }
3784
3784
  if (url) {
3785
- url.path = path20;
3785
+ url.path = path21;
3786
3786
  return urlGenerate(url);
3787
3787
  }
3788
- return path20;
3788
+ return path21;
3789
3789
  }
3790
3790
  exports.normalize = normalize;
3791
3791
  function join(aRoot, aPath) {
@@ -6568,8 +6568,8 @@ var require_printer = __commonJS({
6568
6568
  return this.accept(sexpr.path) + " " + params + hash;
6569
6569
  };
6570
6570
  PrintVisitor.prototype.PathExpression = function(id) {
6571
- var path20 = id.parts.join("/");
6572
- return (id.data ? "@" : "") + "PATH:" + path20;
6571
+ var path21 = id.parts.join("/");
6572
+ return (id.data ? "@" : "") + "PATH:" + path21;
6573
6573
  };
6574
6574
  PrintVisitor.prototype.StringLiteral = function(string) {
6575
6575
  return '"' + string.value + '"';
@@ -7219,7 +7219,7 @@ function getErrorMessage(error) {
7219
7219
 
7220
7220
  // src/program.ts
7221
7221
  import { randomUUID as randomUUID7 } from "node:crypto";
7222
- import path19 from "node:path";
7222
+ import path20 from "node:path";
7223
7223
  import { setTimeout as sleep2 } from "node:timers/promises";
7224
7224
 
7225
7225
  // ../common/dist/src/stdlib/json.util.js
@@ -12394,8 +12394,8 @@ var RENDER_TEMPLATE_ERROR_REASON_CATALOG = defineErrorReasonCatalog()([
12394
12394
  ]);
12395
12395
  var storeReferencePathPattern = String.raw`store(?:\.[$A-Z_a-z][\w$]*)*`;
12396
12396
  var storeReferenceMarkdownLinkTemplateRegex = new RegExp(String.raw`(?<open>\{\{\{?)\s*\[(?<path>${storeReferencePathPattern})\]\(\s*<?https?:\/\/\k<path>>?\s*\)\s*(?<close>\}\}\}?)`, "gu");
12397
- function normalizeAutomationStoreTemplateLinkMatch([_match, open2, path20]) {
12398
- return open2 === "{{{" ? `{{{${path20}}}}` : `{{${path20}}}`;
12397
+ function normalizeAutomationStoreTemplateLinkMatch([_match, open2, path21]) {
12398
+ return open2 === "{{{" ? `{{{${path21}}}}` : `{{${path21}}}`;
12399
12399
  }
12400
12400
  function normalizeAutomationStoreTemplateLinks(template) {
12401
12401
  return template.replaceAll(storeReferenceMarkdownLinkTemplateRegex, (...args) => normalizeAutomationStoreTemplateLinkMatch(args));
@@ -12883,16 +12883,19 @@ var clickAndConfirmAgentcoreInputSchema = clickAndConfirmMarkerInputSchema.exten
12883
12883
  var clickAndConfirmComparisonSchema = clickAndConfirmAgentcoreInputSchema.extend({
12884
12884
  [COMMON_PARAMETERS_KEY]: DEFAULT_COMMON_PARAMETERS
12885
12885
  });
12886
+ var textEntryModeSchema = z10.enum(["direct", "keyboard"]).describe("Internal clickFill input strategy. Copy textEntryMode from the command instructions; use direct when unspecified. Never infer the mode from the field or text. Browser keyboard mode enters text character by character. Desktop retains its configured input method for either mode.");
12886
12887
  var clickFillMarkerInputSchema = z10.object({
12887
12888
  marker: markerSchema("The marker of the input field to fill."),
12888
- text: z10.string().describe("The text to fill the marker with")
12889
+ text: z10.string().describe("The text to fill the marker with"),
12890
+ textEntryMode: textEntryModeSchema.default("direct")
12889
12891
  });
12890
12892
  var clickFillCoordinateInputSchema = z10.object({
12891
12893
  coordinates: coordinateSchema({
12892
12894
  xDescription: "The x coordinate of the element to fill.",
12893
12895
  yDescription: "The y coordinate of the element to fill."
12894
12896
  }),
12895
- text: z10.string().describe("The text to fill the field with")
12897
+ text: z10.string().describe("The text to fill the field with"),
12898
+ textEntryMode: textEntryModeSchema.default("direct")
12896
12899
  });
12897
12900
  var clickFillComparisonSchema = z10.union([
12898
12901
  clickFillMarkerInputSchema.extend({
@@ -13881,18 +13884,18 @@ var specialCommands = {
13881
13884
  // ../common/dist/src/utils/automation-store-path.util.js
13882
13885
  var AUTOMATION_STORE_ROOT_PATH = "store";
13883
13886
  var relativeStorePathRegex = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*)*$/u;
13884
- function normalizeStoreMutationPath(path20) {
13885
- const trimmedPath = path20.trim();
13887
+ function normalizeStoreMutationPath(path21) {
13888
+ const trimmedPath = path21.trim();
13886
13889
  const rootPrefix = `${AUTOMATION_STORE_ROOT_PATH}.`;
13887
13890
  const relativePath = trimmedPath.startsWith(rootPrefix) ? trimmedPath.slice(rootPrefix.length) : trimmedPath;
13888
13891
  if (!relativeStorePathRegex.test(relativePath)) {
13889
13892
  return Err({
13890
13893
  type: "invalid-automation-store-path",
13891
- path: path20,
13894
+ path: path21,
13892
13895
  categories: ["customer_usage"],
13893
13896
  statusCode: 400,
13894
13897
  nonRetryable: true,
13895
- message: `Automation store path "${path20}" is invalid.`,
13898
+ message: `Automation store path "${path21}" is invalid.`,
13896
13899
  suggestedAction: "Use a dot path relative to the automation store, such as patient.name or provider.clinic."
13897
13900
  });
13898
13901
  }
@@ -13905,16 +13908,16 @@ function findAutomationStorePathOverlap(paths) {
13905
13908
  ...new Set(paths.map(getCanonicalAutomationStoreMutationPath))
13906
13909
  ].toSorted((left, right) => (left === AUTOMATION_STORE_ROOT_PATH ? 0 : left.split(".").length) - (right === AUTOMATION_STORE_ROOT_PATH ? 0 : right.split(".").length));
13907
13910
  for (const [index, ancestorPath] of canonicalPaths.entries()) {
13908
- const descendantPath = canonicalPaths.slice(index + 1).find((path20) => ancestorPath === AUTOMATION_STORE_ROOT_PATH || path20.startsWith(`${ancestorPath}.`));
13911
+ const descendantPath = canonicalPaths.slice(index + 1).find((path21) => ancestorPath === AUTOMATION_STORE_ROOT_PATH || path21.startsWith(`${ancestorPath}.`));
13909
13912
  if (descendantPath !== void 0) {
13910
13913
  return { ancestorPath, descendantPath };
13911
13914
  }
13912
13915
  }
13913
13916
  return void 0;
13914
13917
  }
13915
- function getCanonicalAutomationStoreMutationPath(path20) {
13916
- const normalizedPath = normalizeStoreMutationPath(path20);
13917
- return normalizedPath._tag === "Ok" ? normalizedPath.value : path20.trim();
13918
+ function getCanonicalAutomationStoreMutationPath(path21) {
13919
+ const normalizedPath = normalizeStoreMutationPath(path21);
13920
+ return normalizedPath._tag === "Ok" ? normalizedPath.value : path21.trim();
13918
13921
  }
13919
13922
 
13920
13923
  // ../common/dist/src/constants/tool-declarations.js
@@ -14093,9 +14096,9 @@ var baseToolDeclarations = {
14093
14096
  path: []
14094
14097
  });
14095
14098
  }
14096
- const canonicalUpdatePaths = updates.map(({ path: path20 }) => getCanonicalAutomationStoreMutationPath(path20));
14099
+ const canonicalUpdatePaths = updates.map(({ path: path21 }) => getCanonicalAutomationStoreMutationPath(path21));
14097
14100
  const canonicalClearPathSet = new Set(clears.map(getCanonicalAutomationStoreMutationPath));
14098
- const conflictedUpdatePath = canonicalUpdatePaths.find((path20) => canonicalClearPathSet.has(path20));
14101
+ const conflictedUpdatePath = canonicalUpdatePaths.find((path21) => canonicalClearPathSet.has(path21));
14099
14102
  if (conflictedUpdatePath !== void 0) {
14100
14103
  context.addIssue({
14101
14104
  code: "custom",
@@ -14628,9 +14631,9 @@ var magicalApiKeyPermissionPresets = [
14628
14631
  import { z as z25 } from "zod";
14629
14632
 
14630
14633
  // ../common/dist/src/utils/agent-knowledge-base-assets.util.js
14631
- function getIsKnowledgeBaseAssetPathAllowed(path20) {
14632
- const pathSegments = path20.split("/");
14633
- if (path20.length === 0 || pathSegments.some((segment) => segment.length === 0)) {
14634
+ function getIsKnowledgeBaseAssetPathAllowed(path21) {
14635
+ const pathSegments = path21.split("/");
14636
+ if (path21.length === 0 || pathSegments.some((segment) => segment.length === 0)) {
14634
14637
  return false;
14635
14638
  }
14636
14639
  const isTopLevelAssetPath = pathSegments[0] === "assets";
@@ -14685,29 +14688,29 @@ var ApiEmbeddedFileContentTypes = [
14685
14688
  ];
14686
14689
  var API_EMBEDDED_FILE_PATH_PATTERN = /^(?:\[\*\]|[A-Za-z_$][\w$-]*)(?:\[\*\]|\.[A-Za-z_$][\w$-]*)*$/u;
14687
14690
  var API_EMBEDDED_FILE_PATH_SEGMENT_PATTERN = /\[\*\]|[A-Za-z_$][\w$-]*/gu;
14688
- function parseApiEmbeddedFilePath(path20) {
14689
- if (!API_EMBEDDED_FILE_PATH_PATTERN.test(path20)) {
14691
+ function parseApiEmbeddedFilePath(path21) {
14692
+ if (!API_EMBEDDED_FILE_PATH_PATTERN.test(path21)) {
14690
14693
  return void 0;
14691
14694
  }
14692
- return [...path20.matchAll(API_EMBEDDED_FILE_PATH_SEGMENT_PATTERN)].map(([segment]) => segment === "[*]" ? { type: "arrayWildcard" } : { key: segment, type: "property" });
14695
+ return [...path21.matchAll(API_EMBEDDED_FILE_PATH_SEGMENT_PATTERN)].map(([segment]) => segment === "[*]" ? { type: "arrayWildcard" } : { key: segment, type: "property" });
14693
14696
  }
14694
14697
  var apiAgentEmbeddedFileSchema = z17.object({
14695
- path: z17.string().trim().min(1, "Embedded file path is required.").refine((path20) => parseApiEmbeddedFilePath(path20) !== void 0, {
14698
+ path: z17.string().trim().min(1, "Embedded file path is required.").refine((path21) => parseApiEmbeddedFilePath(path21) !== void 0, {
14696
14699
  message: "Embedded file path must use object properties and [*] array wildcards."
14697
14700
  }).describe("Path to a Base64 value relative to the projected API response. Supports object properties and [*] array wildcards."),
14698
14701
  contentType: z17.enum(ApiEmbeddedFileContentTypes).describe("File type of the decoded Base64 value. Use auto to detect PDF, PNG, or JPEG from each file\u2019s contents. Unrecognized files are skipped.")
14699
14702
  }).strict();
14700
14703
  var apiAgentEmbeddedFilesSchema = z17.array(apiAgentEmbeddedFileSchema).superRefine((embeddedFiles, context) => {
14701
14704
  const paths = /* @__PURE__ */ new Set();
14702
- for (const [index, { path: path20 }] of embeddedFiles.entries()) {
14703
- if (paths.has(path20)) {
14705
+ for (const [index, { path: path21 }] of embeddedFiles.entries()) {
14706
+ if (paths.has(path21)) {
14704
14707
  context.addIssue({
14705
14708
  code: z17.ZodIssueCode.custom,
14706
- message: `Embedded file path "${path20}" can only be configured once.`,
14709
+ message: `Embedded file path "${path21}" can only be configured once.`,
14707
14710
  path: [index, "path"]
14708
14711
  });
14709
14712
  }
14710
- paths.add(path20);
14713
+ paths.add(path21);
14711
14714
  }
14712
14715
  }).describe("Base64 values to decode, upload as permanent files, and replace with file references in the projected API response.");
14713
14716
 
@@ -14717,13 +14720,13 @@ var API_REQUEST_FILE_PATH_PATTERN = /^[A-Za-z_$][\w$-]*(?:\.[A-Za-z_$][\w$-]*)*$
14717
14720
  var API_REQUEST_BASE64_FILE_HELPER_PATTERN = /^\s*\{\{\s*base64File\s+(?<sourceInput>[^{}\s]+)\s*\}\}\s*$/u;
14718
14721
  var API_REQUEST_BASE64_FILE_HELPER_USAGE_PATTERN = /\{\{\s*base64File\b/u;
14719
14722
  var API_REQUEST_BASE64_FILE_HELPER_EXAMPLE = "{{base64File fileInput}}";
14720
- function parseApiRequestFilePath(path20) {
14721
- if (!API_REQUEST_FILE_PATH_PATTERN.test(path20)) {
14723
+ function parseApiRequestFilePath(path21) {
14724
+ if (!API_REQUEST_FILE_PATH_PATTERN.test(path21)) {
14722
14725
  return void 0;
14723
14726
  }
14724
- return path20.split(".");
14727
+ return path21.split(".");
14725
14728
  }
14726
- function inspectApiRequestBase64FileHelperValue({ path: path20, value }) {
14729
+ function inspectApiRequestBase64FileHelperValue({ path: path21, value }) {
14727
14730
  const match = API_REQUEST_BASE64_FILE_HELPER_PATTERN.exec(value);
14728
14731
  if (match === null) {
14729
14732
  return API_REQUEST_BASE64_FILE_HELPER_USAGE_PATTERN.test(value) ? {
@@ -14731,7 +14734,7 @@ function inspectApiRequestBase64FileHelperValue({ path: path20, value }) {
14731
14734
  issues: [
14732
14735
  {
14733
14736
  message: `Use ${API_REQUEST_BASE64_FILE_HELPER_EXAMPLE} as the entire JSON field value.`,
14734
- path: path20
14737
+ path: path21
14735
14738
  }
14736
14739
  ]
14737
14740
  } : { helpers: [], issues: [] };
@@ -14743,24 +14746,24 @@ function inspectApiRequestBase64FileHelperValue({ path: path20, value }) {
14743
14746
  issues: [
14744
14747
  {
14745
14748
  message: "Base64 file helper input must use an object property path.",
14746
- path: path20
14749
+ path: path21
14747
14750
  }
14748
14751
  ]
14749
14752
  };
14750
14753
  }
14751
14754
  return {
14752
- helpers: [{ destinationPath: path20, sourceInput }],
14755
+ helpers: [{ destinationPath: path21, sourceInput }],
14753
14756
  issues: []
14754
14757
  };
14755
14758
  }
14756
- function inspectApiRequestBase64FileHelpers(body, path20 = []) {
14759
+ function inspectApiRequestBase64FileHelpers(body, path21 = []) {
14757
14760
  if (typeof body === "string") {
14758
- return inspectApiRequestBase64FileHelperValue({ path: path20, value: body });
14761
+ return inspectApiRequestBase64FileHelperValue({ path: path21, value: body });
14759
14762
  }
14760
14763
  if (Array.isArray(body)) {
14761
14764
  return body.reduce((inspection, value, index) => {
14762
14765
  const nestedInspection = inspectApiRequestBase64FileHelpers(value, [
14763
- ...path20,
14766
+ ...path21,
14764
14767
  index
14765
14768
  ]);
14766
14769
  return {
@@ -14774,7 +14777,7 @@ function inspectApiRequestBase64FileHelpers(body, path20 = []) {
14774
14777
  }
14775
14778
  return Object.entries(body).reduce((inspection, [key, value]) => {
14776
14779
  const nestedInspection = inspectApiRequestBase64FileHelpers(value, [
14777
- ...path20,
14780
+ ...path21,
14778
14781
  key
14779
14782
  ]);
14780
14783
  return {
@@ -14818,10 +14821,10 @@ function validateApiRequestBase64FileHelpers({ body, bodyType, context, supports
14818
14821
  }
14819
14822
  }
14820
14823
  var apiAgentRequestFileEncodingSchema = z18.object({
14821
- sourceInput: z18.string().trim().min(1, "File input is required.").refine((path20) => parseApiRequestFilePath(path20) !== void 0, {
14824
+ sourceInput: z18.string().trim().min(1, "File input is required.").refine((path21) => parseApiRequestFilePath(path21) !== void 0, {
14822
14825
  message: "File input must use an object property path."
14823
14826
  }).describe("API Agent input containing the file reference to encode."),
14824
- destinationPath: z18.string().trim().min(1, "Request field is required.").refine((path20) => parseApiRequestFilePath(path20) !== void 0, {
14827
+ destinationPath: z18.string().trim().min(1, "Request field is required.").refine((path21) => parseApiRequestFilePath(path21) !== void 0, {
14825
14828
  message: "Request field must use an object property path."
14826
14829
  }).describe("JSON request body path where the encoded value is inserted."),
14827
14830
  encoding: z18.literal("base64").describe("Encoding applied to the source file before insertion.")
@@ -15179,30 +15182,30 @@ function hasControlCharacter(value) {
15179
15182
  }
15180
15183
  return false;
15181
15184
  }
15182
- function isNormalizedRepoPath(path20) {
15183
- if (path20 === "/") {
15185
+ function isNormalizedRepoPath(path21) {
15186
+ if (path21 === "/") {
15184
15187
  return true;
15185
15188
  }
15186
- if (path20.length === 0 || path20.startsWith("/") || path20.startsWith("\\") || path20.includes("\\") || hasControlCharacter(path20) || windowsAbsolutePathPattern.test(path20)) {
15189
+ if (path21.length === 0 || path21.startsWith("/") || path21.startsWith("\\") || path21.includes("\\") || hasControlCharacter(path21) || windowsAbsolutePathPattern.test(path21)) {
15187
15190
  return false;
15188
15191
  }
15189
- return path20.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== ".." && segment !== ".git");
15192
+ return path21.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== ".." && segment !== ".git");
15190
15193
  }
15191
- function normalizeRepoPath(path20) {
15192
- if (path20 === "/") {
15193
- return path20;
15194
+ function normalizeRepoPath(path21) {
15195
+ if (path21 === "/") {
15196
+ return path21;
15194
15197
  }
15195
- return path20.replaceAll(/\/+$/gu, "");
15198
+ return path21.replaceAll(/\/+$/gu, "");
15196
15199
  }
15197
15200
  var skillPathPattern = /^(?:skills\/.+|automations\/[^/]+\/skills\/.+|automations\/[^/]+\/agents\/[^/]+\/skills\/.+)$/u;
15198
15201
  var skillRootPathPattern = /^(?:skills\/[^/]+|automations\/[^/]+\/skills\/[^/]+|automations\/[^/]+\/agents\/[^/]+\/skills\/[^/]+)$/u;
15199
15202
  var repoPathSchema = z25.string().min(1).transform(normalizeRepoPath).refine(isNormalizedRepoPath, {
15200
15203
  message: "Path must be a normalized repository-relative path."
15201
15204
  });
15202
- var registeredSkillPathSchema = repoPathSchema.refine((path20) => skillPathPattern.test(path20), {
15205
+ var registeredSkillPathSchema = repoPathSchema.refine((path21) => skillPathPattern.test(path21), {
15203
15206
  message: "Skill paths must be under root, automation, or automation-agent skills."
15204
15207
  });
15205
- var registeredSkillRootPathSchema = registeredSkillPathSchema.refine((path20) => skillRootPathPattern.test(path20) && !path20.endsWith("/SKILL.md"), {
15208
+ var registeredSkillRootPathSchema = registeredSkillPathSchema.refine((path21) => skillRootPathPattern.test(path21) && !path21.endsWith("/SKILL.md"), {
15206
15209
  message: "Registered skill paths must identify a skill root directory."
15207
15210
  });
15208
15211
  var knowledgeBasePluginPermissionSchema = z25.object({
@@ -15838,13 +15841,13 @@ function getMentionedStandardCommand(instructions) {
15838
15841
  const normalizedInstructions = instructions.toLowerCase();
15839
15842
  return STANDARD_COMMAND_NAMES.find((commandName) => normalizedInstructions.includes(commandName.toLowerCase())) ?? null;
15840
15843
  }
15841
- function assertCustomInstructionsCommand({ commands, path: path20 }) {
15842
- const customCommands = commands.flatMap((command, commandIndex) => command["commandName"] === "custom" ? [{ command, path: `${path20}[${commandIndex.toString()}]` }] : []);
15844
+ function assertCustomInstructionsCommand({ commands, path: path21 }) {
15845
+ const customCommands = commands.flatMap((command, commandIndex) => command["commandName"] === "custom" ? [{ command, path: `${path21}[${commandIndex.toString()}]` }] : []);
15843
15846
  if (customCommands.length === 0) {
15844
15847
  return;
15845
15848
  }
15846
15849
  if (customCommands.length > MAX_CUSTOM_COMMAND_COUNT) {
15847
- throw createInvalidValueError(`${path20} contains ${customCommands.length.toString()} custom commands. Use at most ${MAX_CUSTOM_COMMAND_COUNT.toString()} short custom commands per agent. Split policy, decision, outreach, and multi-step work into catalog commands or child agents instead.`);
15850
+ throw createInvalidValueError(`${path21} contains ${customCommands.length.toString()} custom commands. Use at most ${MAX_CUSTOM_COMMAND_COUNT.toString()} short custom commands per agent. Split policy, decision, outreach, and multi-step work into catalog commands or child agents instead.`);
15848
15851
  }
15849
15852
  for (const customCommand of customCommands) {
15850
15853
  const instructions = getCustomInstructions(customCommand.command);
@@ -16073,8 +16076,8 @@ function createOperationSpec(spec) {
16073
16076
  }
16074
16077
 
16075
16078
  // ../mcp-registry/src/operation-specs.ts
16076
- var AUTOMATION_BRANCH_NAME_PATTERN = /^[\da-z]+(?:-[\da-z]+)*$/u;
16077
- var AUTOMATION_BRANCH_NAME_MESSAGE = 'Branch name must use lowercase letters or numbers separated by single dashes (for example, "release-2").';
16079
+ var AUTOMATION_BRANCH_NAME_PATTERN = /^[\da-z]+(?:[-/][\da-z]+)*$/u;
16080
+ var AUTOMATION_BRANCH_NAME_MESSAGE = 'Branch name must use lowercase letters or numbers separated by single dashes or slashes (for example, "otto/branch-fix").';
16078
16081
  function stringOption({
16079
16082
  clientOnly = false,
16080
16083
  description,
@@ -16226,7 +16229,7 @@ function isRecord3(value) {
16226
16229
  function validateCustomInstructionsCommands({
16227
16230
  commands,
16228
16231
  ctx,
16229
- path: path20
16232
+ path: path21
16230
16233
  }) {
16231
16234
  if (!Array.isArray(commands)) {
16232
16235
  return;
@@ -16234,14 +16237,14 @@ function validateCustomInstructionsCommands({
16234
16237
  const validationResult = fromThrowable(() => {
16235
16238
  assertCustomInstructionsCommand({
16236
16239
  commands: commands.map((command) => isRecord3(command) ? command : {}),
16237
- path: path20.join(".").replaceAll(/\.(?<index>\d+)/gu, "[$<index>]")
16240
+ path: path21.join(".").replaceAll(/\.(?<index>\d+)/gu, "[$<index>]")
16238
16241
  });
16239
16242
  }, "invalid-custom-instructions-command");
16240
16243
  if (isErr(validationResult)) {
16241
16244
  ctx.addIssue({
16242
16245
  code: "custom",
16243
16246
  message: `${getErrorMessage2(validationResult.error.cause)} Run mgcl catalog commands to find the standard command for this work.`,
16244
- path: path20
16247
+ path: path21
16245
16248
  });
16246
16249
  }
16247
16250
  }
@@ -16597,6 +16600,38 @@ var automationRunsCliOptions = [
16597
16600
  })
16598
16601
  ];
16599
16602
  var operationSpecs = [
16603
+ createOperationSpec({
16604
+ operationName: "Classify",
16605
+ apiKeyAccess: apiKeyAccessPolicies.baseline,
16606
+ kind: "query",
16607
+ inputSchema: z28.object({ input: jsonObjectSchema }),
16608
+ cli: {
16609
+ name: "classify",
16610
+ path: ["classify"],
16611
+ description: "Answer typed noul, choice, and score questions about supplied context.",
16612
+ resultKey: "classify",
16613
+ options: [
16614
+ stringOption({
16615
+ clientOnly: true,
16616
+ description: "TypeSafe-shaped request object as inline JSON.",
16617
+ flagName: "input-json",
16618
+ inputKey: "inputJson",
16619
+ valueHint: "JSON"
16620
+ }),
16621
+ stringOption({
16622
+ clientOnly: true,
16623
+ description: "Path to request JSON, or - to read stdin.",
16624
+ flagName: "input-file",
16625
+ inputKey: "inputFile"
16626
+ })
16627
+ ]
16628
+ },
16629
+ mcp: { exposed: false, fileName: "classify.graphql" },
16630
+ document: `# Answer typed questions about caller-supplied context
16631
+ query Classify($input: JSON!) {
16632
+ classify(input: $input)
16633
+ }`
16634
+ }),
16600
16635
  createOperationSpec({
16601
16636
  operationName: "KnowledgeFiles",
16602
16637
  apiKeyAccess: apiKeyAccessPolicies.knowledgeRead,
@@ -18100,7 +18135,7 @@ query ListAutomationBranches($automationId: ID!) {
18100
18135
  stringOption({
18101
18136
  inputKey: "name",
18102
18137
  flagName: "name",
18103
- description: 'Lowercase branch name with single dashes between words or numbers (for example, "release-2").',
18138
+ description: 'Lowercase branch name with single dashes or slashes between words or numbers (for example, "otto/branch-fix").',
18104
18139
  required: true
18105
18140
  }),
18106
18141
  stringOption({
@@ -19314,7 +19349,7 @@ mutation skills_apply_patch(
19314
19349
  cli: {
19315
19350
  name: "create-automation",
19316
19351
  path: ["automations", "create"],
19317
- description: "Create a draft automation.",
19352
+ description: "Create a draft automation. Inspect publishChecks and repair blocking failures before completing the task.",
19318
19353
  resultKey: "createAutomation",
19319
19354
  options: [
19320
19355
  jsonOption({
@@ -19327,10 +19362,12 @@ mutation skills_apply_patch(
19327
19362
  },
19328
19363
  mcp: { fileName: "createAutomation.graphql" },
19329
19364
  document: `# Mutation to create a draft automation with optional initial values
19365
+ # Draft saves are allowed. Inspect publishChecks, repair blocking failures, and save again before completing the task. Unknown means checks must be retried.
19330
19366
  # Returns flat fields only for MCP tool simplicity
19331
19367
  mutation CreateAutomation($input: CreateAutomationInput!) {
19332
19368
  createAutomation(input: $input) {
19333
19369
  id
19370
+ publishChecks
19334
19371
  name
19335
19372
  organizationId
19336
19373
  createdAt
@@ -19912,7 +19949,7 @@ mutation ValidateAutomationPatchReadiness(
19912
19949
  branchContext: "optional",
19913
19950
  name: "apply-automation-patch",
19914
19951
  path: ["workbench", "patch", "apply"],
19915
- description: "Apply semantic workbench patch operations through the versioned save path.",
19952
+ description: "Apply semantic workbench patch operations through the versioned save path. Inspect publishChecks and repair blocking failures before completing the task.",
19916
19953
  resultKey: "applyAutomationPatch",
19917
19954
  options: [
19918
19955
  stringOption({
@@ -19936,6 +19973,7 @@ mutation ValidateAutomationPatchReadiness(
19936
19973
  },
19937
19974
  mcp: { fileName: "applyAutomationPatch.graphql" },
19938
19975
  document: `# Apply semantic automation patch operations through the versioned save path.
19976
+ # Inspect publishChecks after saving. Repair blocking failures and save again before completing the task; retry unknown checks.
19939
19977
  mutation ApplyAutomationPatch(
19940
19978
  $draftAutomationId: ID!
19941
19979
  $branchId: ID
@@ -19952,6 +19990,7 @@ mutation ApplyAutomationPatch(
19952
19990
  branchId
19953
19991
  headVersionId
19954
19992
  applied
19993
+ publishChecks
19955
19994
  updateInput
19956
19995
  before {
19957
19996
  name
@@ -20037,7 +20076,7 @@ mutation ApplyAutomationPatch(
20037
20076
  branchContext: "optional",
20038
20077
  name: "update-automation-by-id",
20039
20078
  path: ["automations", "update"],
20040
- description: "Update an automation.",
20079
+ description: "Update an automation. Inspect publishChecks and repair blocking failures before completing the task. Changing agent types is not supported. Do not attempt type changes or replacement workarounds.",
20041
20080
  resultKey: "updateAutomation",
20042
20081
  options: [
20043
20082
  stringOption({
@@ -20060,13 +20099,14 @@ mutation ApplyAutomationPatch(
20060
20099
  # If this mutation returns a draft-automation-version-conflict, discard the generated update, refetch the automation and agents, inspect what changed, then regenerate the update on top of the latest version.
20061
20100
  # config.storeSchema remains additive. Use removeStoreSchemaPaths to delete named properties (and combine it with config.storeSchema for an atomic rename), or replaceStoreSchema for an exact replacement. replaceStoreSchema cannot be combined with either of those fields.
20062
20101
  # Destructive Store schema changes are rejected when the final agent set still references a removed property. Rewrite those agent references in the same update or leave the property in place.
20063
- # Returns only id and lastSavedAt for MCP tool simplicity
20102
+ # Draft saves are allowed. Inspect publishChecks, repair blocking failures, and save again before completing the task. Unknown means checks must be retried.
20064
20103
  mutation UpdateAutomationById($id: ID!, $branchId: ID, $input: UpdateAutomationInput!) {
20065
20104
  updateAutomation(id: $id, branchId: $branchId, input: $input) {
20066
20105
  id
20067
20106
  branchId
20068
20107
  headVersionId
20069
20108
  lastSavedAt
20109
+ publishChecks
20070
20110
  }
20071
20111
  }`
20072
20112
  }),
@@ -21427,18 +21467,18 @@ async function downloadAuthenticatedFileFromApi({
21427
21467
  organizationId,
21428
21468
  outputPath,
21429
21469
  overwrite = false,
21430
- path: path20,
21470
+ path: path21,
21431
21471
  resolveApiBaseUrl,
21432
21472
  timeoutMs
21433
21473
  }) {
21434
- if (!path20.startsWith("/") || path20.startsWith("//")) {
21474
+ if (!path21.startsWith("/") || path21.startsWith("//")) {
21435
21475
  throw new CliError(
21436
21476
  "Authenticated file download path must be relative to the configured Magical API."
21437
21477
  );
21438
21478
  }
21439
21479
  const normalizedApiBaseUrl = trimTrailingSlash(await resolveApiBaseUrl());
21440
21480
  const apiBaseResult = safeUrlConstructor(`${normalizedApiBaseUrl}/`);
21441
- const urlResult = safeUrlConstructor(`${normalizedApiBaseUrl}${path20}`);
21481
+ const urlResult = safeUrlConstructor(`${normalizedApiBaseUrl}${path21}`);
21442
21482
  if (isErr(apiBaseResult) || isErr(urlResult) || urlResult.value.origin !== apiBaseResult.value.origin || !urlResult.value.pathname.startsWith(apiBaseResult.value.pathname)) {
21443
21483
  throw new CliError(
21444
21484
  "Authenticated file download path must stay within the configured Magical API."
@@ -21535,16 +21575,16 @@ function buildPathwayRegressionAgentVersionPath({
21535
21575
  leafPath,
21536
21576
  runsPerPath
21537
21577
  }) {
21538
- const path20 = `/pathway-regression/automation-versions/${encodeURIComponent(
21578
+ const path21 = `/pathway-regression/automation-versions/${encodeURIComponent(
21539
21579
  automationVersionId
21540
21580
  )}/agent-versions/${encodeURIComponent(agentVersionId)}/${leafPath}`;
21541
21581
  if (runsPerPath === void 0) {
21542
- return path20;
21582
+ return path21;
21543
21583
  }
21544
21584
  const queryParams = new URLSearchParams({
21545
21585
  runsPerPath: String(runsPerPath)
21546
21586
  });
21547
- return `${path20}?${queryParams.toString()}`;
21587
+ return `${path21}?${queryParams.toString()}`;
21548
21588
  }
21549
21589
  function applyAuthenticationHeaders({
21550
21590
  accessToken,
@@ -21580,11 +21620,11 @@ function createFetchJson({
21580
21620
  accessToken,
21581
21621
  impersonatedOrganizationId,
21582
21622
  allowOttoAuthorization,
21583
- path: path20,
21623
+ path: path21,
21584
21624
  init,
21585
21625
  organizationId
21586
21626
  }) {
21587
- const url = `${trimTrailingSlash(await resolveApiBaseUrl())}${path20}`;
21627
+ const url = `${trimTrailingSlash(await resolveApiBaseUrl())}${path21}`;
21588
21628
  const usesWorkOSApiKey = isWorkOSApiKey(accessToken);
21589
21629
  const headers = new Headers(init?.headers);
21590
21630
  applyAuthenticationHeaders({
@@ -21784,7 +21824,7 @@ function createMagicalApiClient({
21784
21824
  organizationId,
21785
21825
  outputPath,
21786
21826
  overwrite = false,
21787
- path: path20,
21827
+ path: path21,
21788
21828
  timeoutMs
21789
21829
  }) {
21790
21830
  await downloadAuthenticatedFileFromApi({
@@ -21797,7 +21837,7 @@ function createMagicalApiClient({
21797
21837
  ...maxSizeBytes === void 0 ? {} : { maxSizeBytes },
21798
21838
  outputPath,
21799
21839
  overwrite,
21800
- path: path20,
21840
+ path: path21,
21801
21841
  resolveApiBaseUrl,
21802
21842
  ...timeoutMs === void 0 ? {} : { timeoutMs }
21803
21843
  });
@@ -27227,6 +27267,140 @@ async function pollCaptureRecording({
27227
27267
  });
27228
27268
  }
27229
27269
 
27270
+ // src/classify-command.ts
27271
+ import { readFile as readFile3 } from "node:fs/promises";
27272
+ import path8 from "node:path";
27273
+ import { z as z36 } from "zod";
27274
+ var classifyRequestSchema = z36.object({
27275
+ model: z36.string().refine((model) => model.trim().length > 0, "Model must not be empty.").optional(),
27276
+ questions: z36.record(z36.string(), z36.unknown()).refine(
27277
+ (questions) => Object.keys(questions).length > 0,
27278
+ "Questions must contain at least one named question."
27279
+ ),
27280
+ state: z36.unknown()
27281
+ }).passthrough().refine((input) => Object.hasOwn(input, "state"), {
27282
+ message: "Classify input must include state.",
27283
+ path: ["state"]
27284
+ });
27285
+ var CLASSIFY_OPERATION_NAME = "Classify";
27286
+ var CLASSIFY_HELP_TEXT = `
27287
+ Classify input:
27288
+ Pass exactly one of --input-json, --input-file <path>, or --input-file - for stdin.
27289
+ All named questions share the supplied state and are answered independently.
27290
+ The backend defaults to jev-latest; set model in the request to select an explicit supported model.
27291
+ Noul values are probabilities, choice answers retain option probabilities, and scores may be fractional.
27292
+ Supply text or JSON evidence only; URLs and named files are not fetched. Output is always the full JSON response.
27293
+
27294
+ Examples:
27295
+ mgcl classify --input-file request.json
27296
+ mgcl classify --input-json '{"state":"Refund requested","questions":{"refund":{"type":"noul","instructions":"Is a refund requested?"}}}'
27297
+ cat request.json | mgcl classify --input-file -`;
27298
+ async function readStdin() {
27299
+ process.stdin.setEncoding("utf8");
27300
+ let contents = "";
27301
+ for await (const chunk of process.stdin) {
27302
+ if (typeof chunk !== "string") {
27303
+ throw new CliError("Classify stdin must be UTF-8 text.");
27304
+ }
27305
+ contents += chunk;
27306
+ }
27307
+ return contents;
27308
+ }
27309
+ async function readInputFile({
27310
+ inputFile,
27311
+ runtime
27312
+ }) {
27313
+ if (inputFile === "-") {
27314
+ return await (runtime.readStdin ?? readStdin)().catch(
27315
+ (error) => {
27316
+ throw new CliError("Failed to read classify input from stdin.", {
27317
+ cause: error
27318
+ });
27319
+ }
27320
+ );
27321
+ }
27322
+ const inputPath = path8.resolve(
27323
+ runtime.workingDirectory ?? process.cwd(),
27324
+ inputFile
27325
+ );
27326
+ return await readFile3(inputPath, "utf8").catch((error) => {
27327
+ throw new CliError(`Failed to read classify input file "${inputPath}".`, {
27328
+ cause: error
27329
+ });
27330
+ });
27331
+ }
27332
+ async function resolveClassifyVariables({
27333
+ inputFile,
27334
+ inputJson,
27335
+ runtime = {}
27336
+ }) {
27337
+ const hasInputFile = inputFile !== void 0;
27338
+ const hasInputJson = inputJson !== void 0;
27339
+ if (Number(hasInputFile) + Number(hasInputJson) !== 1) {
27340
+ throw new CliError(
27341
+ "Pass exactly one of --input-json or --input-file for classify input."
27342
+ );
27343
+ }
27344
+ let input = inputJson;
27345
+ if (hasInputFile) {
27346
+ if (typeof inputFile !== "string" || inputFile.length === 0) {
27347
+ throw new CliError("--input-file must name a JSON file or - for stdin.");
27348
+ }
27349
+ const contents = await readInputFile({ inputFile, runtime });
27350
+ const parsedJson = safeJsonParseWithoutLogging(contents);
27351
+ if (isErr(parsedJson)) {
27352
+ const source = inputFile === "-" ? "stdin" : `file "${inputFile}"`;
27353
+ throw new CliError(`Classify input from ${source} must be valid JSON.`, {
27354
+ cause: parsedJson.error
27355
+ });
27356
+ }
27357
+ input = parsedJson.value;
27358
+ } else if (typeof inputJson === "string") {
27359
+ const parsedJson = safeJsonParseWithoutLogging(inputJson);
27360
+ if (isErr(parsedJson)) {
27361
+ throw new CliError(
27362
+ "Classify input from --input-json must be valid JSON.",
27363
+ {
27364
+ cause: parsedJson.error
27365
+ }
27366
+ );
27367
+ }
27368
+ input = parsedJson.value;
27369
+ }
27370
+ const parsedInput = classifyRequestSchema.safeParse(input);
27371
+ if (!parsedInput.success) {
27372
+ throw new CliError(
27373
+ parsedInput.error.issues[0]?.message ?? "Classify input must be a JSON object containing state and questions."
27374
+ );
27375
+ }
27376
+ return { input: parsedInput.data };
27377
+ }
27378
+ async function resolveClassifyOperationVariables({
27379
+ defaultVariables,
27380
+ operationName,
27381
+ options,
27382
+ runtime,
27383
+ workingDirectory
27384
+ }) {
27385
+ if (operationName !== CLASSIFY_OPERATION_NAME) {
27386
+ return defaultVariables;
27387
+ }
27388
+ return await resolveClassifyVariables({
27389
+ inputFile: options["inputFile"],
27390
+ inputJson: options["inputJson"],
27391
+ runtime: {
27392
+ ...runtime,
27393
+ workingDirectory: runtime?.workingDirectory ?? workingDirectory
27394
+ }
27395
+ });
27396
+ }
27397
+ function configureClassifyHelp(command, operationName) {
27398
+ if (operationName === CLASSIFY_OPERATION_NAME) {
27399
+ command.addHelpText("after", CLASSIFY_HELP_TEXT);
27400
+ command.setOptionValueWithSource("json", true, "default");
27401
+ }
27402
+ }
27403
+
27230
27404
  // src/cli-io.ts
27231
27405
  function createConsoleIo() {
27232
27406
  return {
@@ -27243,53 +27417,53 @@ function createConsoleIo() {
27243
27417
 
27244
27418
  // src/eval-commands.ts
27245
27419
  import { randomUUID as randomUUID4 } from "node:crypto";
27246
- import { access as access2, readFile as readFile3 } from "node:fs/promises";
27247
- import path8 from "node:path";
27420
+ import { access as access2, readFile as readFile4 } from "node:fs/promises";
27421
+ import path9 from "node:path";
27248
27422
  import { createInterface } from "node:readline/promises";
27249
- import { z as z36 } from "zod";
27423
+ import { z as z37 } from "zod";
27250
27424
  var MAX_AWAIT_REQUEST_MS = 6e4;
27251
27425
  var MIN_AWAIT_REQUEST_MS = 1e3;
27252
27426
  var EXPORT_POLL_INTERVAL_MS = 1e3;
27253
- var evalRunStatusSchema2 = z36.enum([
27427
+ var evalRunStatusSchema2 = z37.enum([
27254
27428
  "QUEUED",
27255
27429
  "RUNNING",
27256
27430
  "COMPLETE",
27257
27431
  "FAILED",
27258
27432
  "CANCELLED"
27259
27433
  ]);
27260
- var awaitResultSchema = z36.object({
27261
- elapsedMs: z36.number().nonnegative(),
27262
- evalRun: z36.object({
27263
- id: z36.string().min(1),
27434
+ var awaitResultSchema = z37.object({
27435
+ elapsedMs: z37.number().nonnegative(),
27436
+ evalRun: z37.object({
27437
+ id: z37.string().min(1),
27264
27438
  status: evalRunStatusSchema2
27265
27439
  }).passthrough(),
27266
- pollCount: z36.number().int().nonnegative(),
27267
- reachedTerminal: z36.boolean()
27440
+ pollCount: z37.number().int().nonnegative(),
27441
+ reachedTerminal: z37.boolean()
27268
27442
  }).passthrough();
27269
- var planResultSchema = z36.object({ trialCount: z36.number().int().nonnegative() }).passthrough();
27270
- var startResultSchema = z36.object({
27271
- evalRunId: z36.string().min(1),
27272
- idempotencyKey: z36.string().min(1),
27273
- workflowId: z36.string().min(1),
27274
- workflowRunId: z36.string().min(1)
27443
+ var planResultSchema = z37.object({ trialCount: z37.number().int().nonnegative() }).passthrough();
27444
+ var startResultSchema = z37.object({
27445
+ evalRunId: z37.string().min(1),
27446
+ idempotencyKey: z37.string().min(1),
27447
+ workflowId: z37.string().min(1),
27448
+ workflowRunId: z37.string().min(1)
27275
27449
  }).passthrough();
27276
- var exportResultSchema = z36.object({
27277
- downloadUrl: z36.string().min(1).nullable().optional(),
27278
- evalRunId: z36.string().min(1),
27279
- exportId: z36.string().min(1),
27280
- status: z36.enum(["QUEUED", "RUNNING", "COMPLETE", "FAILED"])
27450
+ var exportResultSchema = z37.object({
27451
+ downloadUrl: z37.string().min(1).nullable().optional(),
27452
+ evalRunId: z37.string().min(1),
27453
+ exportId: z37.string().min(1),
27454
+ status: z37.enum(["QUEUED", "RUNNING", "COMPLETE", "FAILED"])
27281
27455
  }).passthrough();
27282
- var inputOptionsSchema = z36.object({
27283
- inputFile: z36.string().min(1).optional(),
27284
- inputJson: z36.unknown().optional()
27456
+ var inputOptionsSchema = z37.object({
27457
+ inputFile: z37.string().min(1).optional(),
27458
+ inputJson: z37.unknown().optional()
27285
27459
  });
27286
27460
  var commonRunOptionsSchema = inputOptionsSchema.extend({
27287
- description: z36.string().min(1).optional(),
27288
- maxConcurrency: z36.number().int().positive().optional(),
27289
- name: z36.string().min(1).optional(),
27290
- repeatCount: z36.number().int().positive().optional(),
27291
- slug: z36.string().min(1),
27292
- tags: z36.array(z36.string().min(1)).optional()
27461
+ description: z37.string().min(1).optional(),
27462
+ maxConcurrency: z37.number().int().positive().optional(),
27463
+ name: z37.string().min(1).optional(),
27464
+ repeatCount: z37.number().int().positive().optional(),
27465
+ slug: z37.string().min(1),
27466
+ tags: z37.array(z37.string().min(1)).optional()
27293
27467
  });
27294
27468
  function parseApiResult(value, schema, label) {
27295
27469
  const parsedResult = schema.safeParse(value);
@@ -27302,8 +27476,8 @@ async function parseInputFile({
27302
27476
  inputFile,
27303
27477
  workingDirectory
27304
27478
  }) {
27305
- const inputPath = path8.resolve(workingDirectory, inputFile);
27306
- const contents = await readFile3(inputPath, "utf8").catch(
27479
+ const inputPath = path9.resolve(workingDirectory, inputFile);
27480
+ const contents = await readFile4(inputPath, "utf8").catch(
27307
27481
  (error) => {
27308
27482
  throw new CliError(`Failed to read eval input file "${inputPath}".`, {
27309
27483
  cause: error
@@ -27331,7 +27505,7 @@ async function resolveEvalInput({
27331
27505
  );
27332
27506
  }
27333
27507
  const input = inputFile === void 0 ? inputJson : await parseInputFile({ inputFile, workingDirectory });
27334
- const parsedInput = z36.record(z36.string(), z36.unknown()).safeParse(input);
27508
+ const parsedInput = z37.record(z37.string(), z37.unknown()).safeParse(input);
27335
27509
  if (!parsedInput.success) {
27336
27510
  throw new CliError("Eval input must be a JSON object.");
27337
27511
  }
@@ -27368,7 +27542,7 @@ function parseDurationMs(value) {
27368
27542
  );
27369
27543
  const amount = Number(match?.groups?.["amount"]);
27370
27544
  const multiplierByUnit = { h: 36e5, m: 6e4, ms: 1, s: 1e3 };
27371
- const parsedUnit = z36.enum(["h", "m", "ms", "s"]).safeParse(match?.groups?.["unit"]?.toLowerCase());
27545
+ const parsedUnit = z37.enum(["h", "m", "ms", "s"]).safeParse(match?.groups?.["unit"]?.toLowerCase());
27372
27546
  const durationMs = parsedUnit.success ? amount * multiplierByUnit[parsedUnit.data] : Number.NaN;
27373
27547
  if (!Number.isSafeInteger(durationMs) || durationMs < MIN_AWAIT_REQUEST_MS) {
27374
27548
  throw new CliError(
@@ -27577,10 +27751,10 @@ async function executeStartRegisteredEvalRun({
27577
27751
  workingDirectory
27578
27752
  }) {
27579
27753
  const parsedOptions = commonRunOptionsSchema.extend({
27580
- confirmTrials: z36.number().int().positive().optional(),
27581
- idempotencyKey: z36.string().trim().min(1).optional(),
27582
- json: z36.boolean().optional(),
27583
- wait: z36.boolean().optional()
27754
+ confirmTrials: z37.number().int().positive().optional(),
27755
+ idempotencyKey: z37.string().trim().min(1).optional(),
27756
+ json: z37.boolean().optional(),
27757
+ wait: z37.boolean().optional()
27584
27758
  }).parse(options);
27585
27759
  const input = await resolveEvalInputFromOptions({
27586
27760
  ...parsedOptions,
@@ -27640,7 +27814,7 @@ async function executeAwaitEvalRun({
27640
27814
  options,
27641
27815
  runtime
27642
27816
  }) {
27643
- const parsedOptions = z36.object({ id: z36.string().min(1), timeout: z36.string().optional() }).parse(options);
27817
+ const parsedOptions = z37.object({ id: z37.string().min(1), timeout: z37.string().optional() }).parse(options);
27644
27818
  return await awaitEvalRun({
27645
27819
  evalRunId: parsedOptions.id,
27646
27820
  executeOperation,
@@ -27659,13 +27833,13 @@ async function executeRequestEvalRunExport({
27659
27833
  runtime,
27660
27834
  workingDirectory
27661
27835
  }) {
27662
- const parsedOptions = z36.object({
27663
- force: z36.boolean().optional(),
27664
- id: z36.string().min(1),
27665
- output: z36.string().min(1),
27666
- wait: z36.boolean().optional()
27836
+ const parsedOptions = z37.object({
27837
+ force: z37.boolean().optional(),
27838
+ id: z37.string().min(1),
27839
+ output: z37.string().min(1),
27840
+ wait: z37.boolean().optional()
27667
27841
  }).parse(options);
27668
- const outputPath = path8.resolve(workingDirectory, parsedOptions.output);
27842
+ const outputPath = path9.resolve(workingDirectory, parsedOptions.output);
27669
27843
  const force = parsedOptions.force === true;
27670
27844
  const shouldWait = parsedOptions.wait === true;
27671
27845
  if (shouldWait) {
@@ -27731,28 +27905,28 @@ async function executeEvalCliOperation({
27731
27905
  // src/file-upload-commands.ts
27732
27906
  import { createReadStream as createReadStream2 } from "node:fs";
27733
27907
  import { stat as stat2 } from "node:fs/promises";
27734
- import path9 from "node:path";
27908
+ import path10 from "node:path";
27735
27909
  import mimeTypes from "mime-types";
27736
- import { z as z37 } from "zod";
27737
- var fileUploadIntentSchema = z37.object({
27738
- file: z37.object({
27739
- checksum: z37.object({
27740
- algorithm: z37.literal("CRC32"),
27741
- value: z37.string().min(1)
27910
+ import { z as z38 } from "zod";
27911
+ var fileUploadIntentSchema = z38.object({
27912
+ file: z38.object({
27913
+ checksum: z38.object({
27914
+ algorithm: z38.literal("CRC32"),
27915
+ value: z38.string().min(1)
27742
27916
  }),
27743
- key: z37.string().startsWith("s3://"),
27744
- mimeType: z37.string().min(1),
27745
- name: z37.string().min(1),
27746
- sizeBytes: z37.number().int().nonnegative()
27917
+ key: z38.string().startsWith("s3://"),
27918
+ mimeType: z38.string().min(1),
27919
+ name: z38.string().min(1),
27920
+ sizeBytes: z38.number().int().nonnegative()
27747
27921
  }),
27748
- upload: z37.object({
27749
- headers: z37.record(z37.string(), z37.string()),
27750
- method: z37.literal("PUT"),
27751
- url: z37.url()
27922
+ upload: z38.object({
27923
+ headers: z38.record(z38.string(), z38.string()),
27924
+ method: z38.literal("PUT"),
27925
+ url: z38.url()
27752
27926
  })
27753
27927
  });
27754
27928
  async function prepareFileUpload(inputPath, workingDirectory) {
27755
- const filePath = path9.resolve(workingDirectory, inputPath);
27929
+ const filePath = path10.resolve(workingDirectory, inputPath);
27756
27930
  const fileStats = await stat2(filePath).catch((error) => {
27757
27931
  throw new CliError(`Failed to inspect upload file "${filePath}".`, {
27758
27932
  cause: error
@@ -27791,7 +27965,7 @@ async function prepareFileUpload(inputPath, workingDirectory) {
27791
27965
  variables: {
27792
27966
  checksum: encodeS3Crc32Checksum(checksum),
27793
27967
  mimeType: mimeTypes.lookup(filePath) || "application/octet-stream",
27794
- name: path9.basename(filePath),
27968
+ name: path10.basename(filePath),
27795
27969
  sizeBytes: fileStats.size
27796
27970
  }
27797
27971
  };
@@ -27837,20 +28011,20 @@ async function handleFileUploadCliOperation(apiClient, intent, prepared) {
27837
28011
  }
27838
28012
 
27839
28013
  // src/iteration-media-commands.ts
27840
- import path12 from "node:path";
27841
- import { z as z40 } from "zod";
28014
+ import path13 from "node:path";
28015
+ import { z as z41 } from "zod";
27842
28016
 
27843
28017
  // src/file-commands.ts
27844
- import path10 from "node:path";
27845
- import { z as z38 } from "zod";
27846
- var fileAssetAccessSchema = z38.object({
27847
- status: z38.enum([
28018
+ import path11 from "node:path";
28019
+ import { z as z39 } from "zod";
28020
+ var fileAssetAccessSchema = z39.object({
28021
+ status: z39.enum([
27848
28022
  "AVAILABLE",
27849
28023
  "INVALID_KEY",
27850
28024
  "NOT_FOUND",
27851
28025
  "URL_UNAVAILABLE"
27852
28026
  ]),
27853
- url: z38.string().url().nullable()
28027
+ url: z39.string().url().nullable()
27854
28028
  }).superRefine((value, ctx) => {
27855
28029
  if (value.status === "AVAILABLE" && value.url === null) {
27856
28030
  ctx.addIssue({
@@ -27860,13 +28034,13 @@ var fileAssetAccessSchema = z38.object({
27860
28034
  });
27861
28035
  }
27862
28036
  });
27863
- var fileCommandOptionsSchema = z38.object({
27864
- download: z38.string().min(1).optional(),
27865
- force: z38.boolean().optional(),
27866
- key: z38.string().min(1)
28037
+ var fileCommandOptionsSchema = z39.object({
28038
+ download: z39.string().min(1).optional(),
28039
+ force: z39.boolean().optional(),
28040
+ key: z39.string().min(1)
27867
28041
  });
27868
28042
  function sanitizeDownloadFileName(fileName, fallback = "magical-file.bin") {
27869
- const sanitizedFileName = path10.basename(fileName).replaceAll(/[^\p{L}\p{N}._-]/gu, "_").slice(0, 160);
28043
+ const sanitizedFileName = path11.basename(fileName).replaceAll(/[^\p{L}\p{N}._-]/gu, "_").slice(0, 160);
27870
28044
  return sanitizedFileName && sanitizedFileName !== "." && sanitizedFileName !== ".." ? sanitizedFileName : fallback;
27871
28045
  }
27872
28046
  function getSafeFileName(fileKey) {
@@ -27888,7 +28062,7 @@ async function downloadFileToLocalPath({
27888
28062
  "File download is not configured for this CLI instance."
27889
28063
  );
27890
28064
  }
27891
- const outputPath = path10.resolve(
28065
+ const outputPath = path11.resolve(
27892
28066
  runtime.workingDirectory,
27893
28067
  destination ?? sanitizeDownloadFileName(fallbackFileName)
27894
28068
  );
@@ -27934,19 +28108,19 @@ async function handleFileCliOperation({
27934
28108
  }
27935
28109
 
27936
28110
  // src/repository-file-commands.ts
27937
- import path11 from "node:path";
27938
- import { z as z39 } from "zod";
28111
+ import path12 from "node:path";
28112
+ import { z as z40 } from "zod";
27939
28113
  var repositoryFileOperationNames = /* @__PURE__ */ new Set(["KnowledgeFile", "MemoryFile"]);
27940
- var repositoryFileOptionsSchema = z39.object({
27941
- download: z39.string().min(1),
27942
- force: z39.boolean().optional(),
27943
- key: z39.string().min(1)
28114
+ var repositoryFileOptionsSchema = z40.object({
28115
+ download: z40.string().min(1),
28116
+ force: z40.boolean().optional(),
28117
+ key: z40.string().min(1)
27944
28118
  });
27945
- var repositoryFileAccessSchema = z39.object({
27946
- commit: z39.string().regex(/^[\da-f]{40}$/u).nullable(),
27947
- path: z39.string().min(1).nullable(),
27948
- status: z39.enum(["AVAILABLE", "INVALID_KEY", "NOT_FOUND", "UNAVAILABLE"]),
27949
- url: z39.url().nullable()
28119
+ var repositoryFileAccessSchema = z40.object({
28120
+ commit: z40.string().regex(/^[\da-f]{40}$/u).nullable(),
28121
+ path: z40.string().min(1).nullable(),
28122
+ status: z40.enum(["AVAILABLE", "INVALID_KEY", "NOT_FOUND", "UNAVAILABLE"]),
28123
+ url: z40.url().nullable()
27950
28124
  }).superRefine((value, ctx) => {
27951
28125
  if (value.status === "AVAILABLE" && (value.url === null || value.path === null || value.commit === null)) {
27952
28126
  ctx.addIssue({
@@ -27983,7 +28157,7 @@ async function handleRepositoryFileCliOperation({
27983
28157
  }
27984
28158
  const outputPath = await downloadFileToLocalPath({
27985
28159
  destination: parsedOptions.download,
27986
- fallbackFileName: path11.basename(repositoryPath),
28160
+ fallbackFileName: path12.basename(repositoryPath),
27987
28161
  force: parsedOptions.force === true,
27988
28162
  runtime,
27989
28163
  url
@@ -27998,14 +28172,14 @@ async function handleRepositoryFileCliOperation({
27998
28172
  }
27999
28173
 
28000
28174
  // src/iteration-media-commands.ts
28001
- var iterationMediaOptionsSchema = z40.object({
28002
- download: z40.string().min(1),
28003
- force: z40.boolean().optional(),
28004
- iterationId: z40.uuid(),
28005
- mediaId: z40.uuid()
28175
+ var iterationMediaOptionsSchema = z41.object({
28176
+ download: z41.string().min(1),
28177
+ force: z41.boolean().optional(),
28178
+ iterationId: z41.uuid(),
28179
+ mediaId: z41.uuid()
28006
28180
  });
28007
- var iterationMediaAccessSchema = z40.object({
28008
- downloadPath: z40.string().min(1)
28181
+ var iterationMediaAccessSchema = z41.object({
28182
+ downloadPath: z41.string().min(1)
28009
28183
  });
28010
28184
  async function handleIterationMediaCliOperation({
28011
28185
  accessToken,
@@ -28036,7 +28210,7 @@ async function handleIterationMediaCliOperation({
28036
28210
  "Authenticated file download is not configured for this CLI instance."
28037
28211
  );
28038
28212
  }
28039
- const outputPath = path12.resolve(workingDirectory, parsedOptions.download);
28213
+ const outputPath = path13.resolve(workingDirectory, parsedOptions.download);
28040
28214
  const downloadResult = await fromThrowable(async () => {
28041
28215
  await downloadAuthenticatedFile({
28042
28216
  accessToken,
@@ -28150,16 +28324,16 @@ import { randomUUID as randomUUID5 } from "node:crypto";
28150
28324
  import { createReadStream as createReadStream3, createWriteStream as createWriteStream2 } from "node:fs";
28151
28325
  import { link as link3, mkdir as mkdir3, mkdtemp, rm as rm3 } from "node:fs/promises";
28152
28326
  import os2 from "node:os";
28153
- import path14 from "node:path";
28327
+ import path15 from "node:path";
28154
28328
  import { pipeline as pipeline2 } from "node:stream/promises";
28155
28329
  import { Command as Command3, InvalidArgumentError, Option as Option3 } from "commander";
28156
28330
 
28157
28331
  // src/network-recording-parser.ts
28158
28332
  import { spawn } from "node:child_process";
28159
28333
  import { existsSync } from "node:fs";
28160
- import path13 from "node:path";
28334
+ import path14 from "node:path";
28161
28335
  import { fileURLToPath as fileURLToPath2 } from "node:url";
28162
- import { z as z41 } from "zod";
28336
+ import { z as z42 } from "zod";
28163
28337
  var NETWORK_RECORDING_ARCHIVE_MAX_BYTES = 256 * 1024 * 1024;
28164
28338
  var NETWORK_RECORDING_MAX_FLOWS = 2e4;
28165
28339
  var NETWORK_RECORDING_MAX_ENCODED_BODY_BYTES = 32 * 1024 * 1024;
@@ -28171,57 +28345,57 @@ var DEFAULT_MAX_EXCHANGES = 100;
28171
28345
  var MAX_EXCHANGES = 1e3;
28172
28346
  var MAX_HELPER_OUTPUT_BYTES = 1024 * 1024;
28173
28347
  var PYTHON_ENVIRONMENT_VARIABLE = "MGCL_MITMPROXY_PYTHON";
28174
- var archiveIdentitySchema = z41.object({
28175
- sha256: z41.string().regex(/^[0-9a-f]{64}$/u),
28176
- sizeBytes: z41.number().int().nonnegative()
28177
- });
28178
- var bodyMetadataSchema = z41.object({
28179
- state: z41.enum(["PRESENT", "EMPTY", "MISSING"]),
28180
- encodedSizeBytes: z41.number().int().nonnegative().nullable()
28181
- });
28182
- var exchangeSchema = z41.object({
28183
- exchange: z41.string().regex(/^mitm-v1:[0-9a-f]{64}:[0-9]+$/u),
28184
- index: z41.number().int().nonnegative(),
28185
- method: z41.string().min(1),
28186
- origin: z41.string().min(1),
28187
- timestamp: z41.string().nullable(),
28188
- response: z41.object({
28189
- status: z41.number().int(),
28190
- contentType: z41.string().nullable(),
28348
+ var archiveIdentitySchema = z42.object({
28349
+ sha256: z42.string().regex(/^[0-9a-f]{64}$/u),
28350
+ sizeBytes: z42.number().int().nonnegative()
28351
+ });
28352
+ var bodyMetadataSchema = z42.object({
28353
+ state: z42.enum(["PRESENT", "EMPTY", "MISSING"]),
28354
+ encodedSizeBytes: z42.number().int().nonnegative().nullable()
28355
+ });
28356
+ var exchangeSchema = z42.object({
28357
+ exchange: z42.string().regex(/^mitm-v1:[0-9a-f]{64}:[0-9]+$/u),
28358
+ index: z42.number().int().nonnegative(),
28359
+ method: z42.string().min(1),
28360
+ origin: z42.string().min(1),
28361
+ timestamp: z42.string().nullable(),
28362
+ response: z42.object({
28363
+ status: z42.number().int(),
28364
+ contentType: z42.string().nullable(),
28191
28365
  body: bodyMetadataSchema
28192
28366
  }).nullable()
28193
28367
  });
28194
- var inspectionResultSchema = z41.object({
28368
+ var inspectionResultSchema = z42.object({
28195
28369
  archive: archiveIdentitySchema,
28196
- exchanges: z41.array(exchangeSchema),
28197
- scan: z41.object({
28198
- scannedFlowCount: z41.number().int().nonnegative(),
28199
- returnedExchangeCount: z41.number().int().nonnegative(),
28200
- complete: z41.boolean(),
28201
- resultLimit: z41.number().int().positive(),
28202
- flowLimit: z41.number().int().positive(),
28203
- truncationReason: z41.enum(["RESULT_LIMIT", "FLOW_LIMIT"]).nullable()
28370
+ exchanges: z42.array(exchangeSchema),
28371
+ scan: z42.object({
28372
+ scannedFlowCount: z42.number().int().nonnegative(),
28373
+ returnedExchangeCount: z42.number().int().nonnegative(),
28374
+ complete: z42.boolean(),
28375
+ resultLimit: z42.number().int().positive(),
28376
+ flowLimit: z42.number().int().positive(),
28377
+ truncationReason: z42.enum(["RESULT_LIMIT", "FLOW_LIMIT"]).nullable()
28204
28378
  })
28205
28379
  });
28206
- var extractionResultSchema = z41.object({
28380
+ var extractionResultSchema = z42.object({
28207
28381
  archive: archiveIdentitySchema,
28208
- exchange: z41.string().regex(/^mitm-v1:[0-9a-f]{64}:[0-9]+$/u),
28209
- index: z41.number().int().nonnegative(),
28210
- response: z41.object({
28211
- contentType: z41.string().nullable(),
28212
- sourceContentEncoding: z41.string().nullable(),
28213
- representation: z41.literal("decoded-entity-body"),
28214
- encodedSizeBytes: z41.number().int().nonnegative(),
28215
- sizeBytes: z41.number().int().nonnegative(),
28216
- sha256: z41.string().regex(/^[0-9a-f]{64}$/u)
28382
+ exchange: z42.string().regex(/^mitm-v1:[0-9a-f]{64}:[0-9]+$/u),
28383
+ index: z42.number().int().nonnegative(),
28384
+ response: z42.object({
28385
+ contentType: z42.string().nullable(),
28386
+ sourceContentEncoding: z42.string().nullable(),
28387
+ representation: z42.literal("decoded-entity-body"),
28388
+ encodedSizeBytes: z42.number().int().nonnegative(),
28389
+ sizeBytes: z42.number().int().nonnegative(),
28390
+ sha256: z42.string().regex(/^[0-9a-f]{64}$/u)
28217
28391
  }),
28218
- outputPath: z41.string().min(1)
28392
+ outputPath: z42.string().min(1)
28219
28393
  });
28220
- var helperResponseSchema = z41.union([
28221
- z41.object({ ok: z41.literal(true), result: z41.unknown() }),
28222
- z41.object({
28223
- ok: z41.literal(false),
28224
- error: z41.object({ code: z41.string().min(1), message: z41.string().min(1) })
28394
+ var helperResponseSchema = z42.union([
28395
+ z42.object({ ok: z42.literal(true), result: z42.unknown() }),
28396
+ z42.object({
28397
+ ok: z42.literal(false),
28398
+ error: z42.object({ code: z42.string().min(1), message: z42.string().min(1) })
28225
28399
  })
28226
28400
  ]);
28227
28401
  var NetworkRecordingParserError = class extends CliError {
@@ -28233,12 +28407,12 @@ var NetworkRecordingParserError = class extends CliError {
28233
28407
  }
28234
28408
  };
28235
28409
  function helperPath() {
28236
- const moduleDirectory = path13.dirname(fileURLToPath2(import.meta.url));
28237
- const bundledPath = path13.resolve(
28410
+ const moduleDirectory = path14.dirname(fileURLToPath2(import.meta.url));
28411
+ const bundledPath = path14.resolve(
28238
28412
  moduleDirectory,
28239
28413
  "network-recording-archive.py"
28240
28414
  );
28241
- return existsSync(bundledPath) ? bundledPath : path13.resolve(moduleDirectory, "../scripts/network-recording-archive.py");
28415
+ return existsSync(bundledPath) ? bundledPath : path14.resolve(moduleDirectory, "../scripts/network-recording-archive.py");
28242
28416
  }
28243
28417
  function pythonCandidates() {
28244
28418
  const configuredPython = getRuntimeEnvironment()[PYTHON_ENVIRONMENT_VARIABLE];
@@ -28552,11 +28726,11 @@ async function installPrivateOutput({
28552
28726
  destination,
28553
28727
  source
28554
28728
  }) {
28555
- const outputPath = path14.resolve(destination);
28556
- await mkdir3(path14.dirname(outputPath), { recursive: true });
28557
- const temporaryPath = path14.join(
28558
- path14.dirname(outputPath),
28559
- `.${path14.basename(outputPath)}.${randomUUID5()}.tmp`
28729
+ const outputPath = path15.resolve(destination);
28730
+ await mkdir3(path15.dirname(outputPath), { recursive: true });
28731
+ const temporaryPath = path15.join(
28732
+ path15.dirname(outputPath),
28733
+ `.${path15.basename(outputPath)}.${randomUUID5()}.tmp`
28560
28734
  );
28561
28735
  await pipeline2(
28562
28736
  createReadStream3(source),
@@ -28586,9 +28760,9 @@ async function withPrivateArchive({
28586
28760
  recording
28587
28761
  }) {
28588
28762
  const temporaryDirectory = await mkdtemp(
28589
- path14.join(os2.tmpdir(), "mgcl-network-recording-")
28763
+ path15.join(os2.tmpdir(), "mgcl-network-recording-")
28590
28764
  );
28591
- const archivePath = path14.join(temporaryDirectory, "recording.mitm");
28765
+ const archivePath = path15.join(temporaryDirectory, "recording.mitm");
28592
28766
  try {
28593
28767
  await downloadRecording({
28594
28768
  dependencies,
@@ -28636,7 +28810,7 @@ function addNetworkRecordingCommands({
28636
28810
  });
28637
28811
  const result = getSafeMetadata(recording.metadata);
28638
28812
  if (options.output) {
28639
- const outputPath = path14.resolve(
28813
+ const outputPath = path15.resolve(
28640
28814
  dependencies.workingDirectory ?? process.cwd(),
28641
28815
  options.output
28642
28816
  );
@@ -28717,11 +28891,11 @@ function addNetworkRecordingCommands({
28717
28891
  {
28718
28892
  archivePath,
28719
28893
  exchange: options.exchange,
28720
- outputPath: path14.join(temporaryDirectory, "response-body")
28894
+ outputPath: path15.join(temporaryDirectory, "response-body")
28721
28895
  }
28722
28896
  );
28723
28897
  const outputPath = await installPrivateOutput({
28724
- destination: path14.resolve(
28898
+ destination: path15.resolve(
28725
28899
  dependencies.workingDirectory ?? process.cwd(),
28726
28900
  options.output
28727
28901
  ),
@@ -29065,29 +29239,29 @@ ${formatExamples("Examples", [
29065
29239
 
29066
29240
  // src/run-evidence-commands.ts
29067
29241
  import { Option as Option5 } from "commander";
29068
- import { z as z42 } from "zod";
29242
+ import { z as z43 } from "zod";
29069
29243
  var ITERATION_PAGE_SIZE = 100;
29070
29244
  var MAX_SCANNED_ITERATIONS = 1e4;
29071
- var automationRunSchema = z42.object({
29072
- id: z42.string().min(1),
29073
- input: z42.unknown().nullable()
29245
+ var automationRunSchema = z43.object({
29246
+ id: z43.string().min(1),
29247
+ input: z43.unknown().nullable()
29074
29248
  }).passthrough();
29075
- var agentRunSchema = z42.object({
29076
- id: z42.string().min(1),
29077
- input: z42.unknown().nullable(),
29078
- parentAgentRunId: z42.string().nullable()
29249
+ var agentRunSchema = z43.object({
29250
+ id: z43.string().min(1),
29251
+ input: z43.unknown().nullable(),
29252
+ parentAgentRunId: z43.string().nullable()
29079
29253
  }).passthrough();
29080
- var memorySchema = z42.object({
29081
- id: z42.string().min(1),
29082
- sequence: z42.number().int(),
29083
- type: z42.string(),
29084
- value: z42.unknown()
29254
+ var memorySchema = z43.object({
29255
+ id: z43.string().min(1),
29256
+ sequence: z43.number().int(),
29257
+ type: z43.string(),
29258
+ value: z43.unknown()
29085
29259
  }).passthrough();
29086
- var iterationSchema = z42.object({
29087
- agentRunId: z42.string().min(1),
29088
- id: z42.string().min(1),
29089
- memories: z42.array(memorySchema),
29090
- sequence: z42.number().int()
29260
+ var iterationSchema = z43.object({
29261
+ agentRunId: z43.string().min(1),
29262
+ id: z43.string().min(1),
29263
+ memories: z43.array(memorySchema),
29264
+ sequence: z43.number().int()
29091
29265
  }).passthrough();
29092
29266
  var latestIterationSchema = iterationSchema.nullable();
29093
29267
  var GET_AUTOMATION_RUN_FILE_INPUT_DOCUMENT = `
@@ -29242,21 +29416,21 @@ function collectIterationOccurrences(iteration) {
29242
29416
  function formatRunFiles(result) {
29243
29417
  const parsed = parseOperationResult(
29244
29418
  result,
29245
- z42.object({
29246
- automationRunId: z42.string(),
29247
- files: z42.array(
29248
- z42.object({
29249
- agentRunId: z42.string().nullable(),
29250
- fieldPath: z42.string(),
29251
- iterationId: z42.string().nullable(),
29252
- key: z42.string(),
29253
- role: z42.string(),
29254
- source: z42.string(),
29255
- toolName: z42.string().nullable()
29419
+ z43.object({
29420
+ automationRunId: z43.string(),
29421
+ files: z43.array(
29422
+ z43.object({
29423
+ agentRunId: z43.string().nullable(),
29424
+ fieldPath: z43.string(),
29425
+ iterationId: z43.string().nullable(),
29426
+ key: z43.string(),
29427
+ role: z43.string(),
29428
+ source: z43.string(),
29429
+ toolName: z43.string().nullable()
29256
29430
  })
29257
29431
  ),
29258
- scannedIterationCount: z42.number(),
29259
- truncated: z42.boolean()
29432
+ scannedIterationCount: z43.number(),
29433
+ truncated: z43.boolean()
29260
29434
  }),
29261
29435
  "Run file inventory"
29262
29436
  );
@@ -29281,9 +29455,9 @@ function formatRunFiles(result) {
29281
29455
  function formatAgentRunOutput(result) {
29282
29456
  const parsed = parseOperationResult(
29283
29457
  result,
29284
- z42.object({
29285
- output: z42.unknown(),
29286
- status: z42.enum(["AVAILABLE", "NOT_FOUND"])
29458
+ z43.object({
29459
+ output: z43.unknown(),
29460
+ status: z43.enum(["AVAILABLE", "NOT_FOUND"])
29287
29461
  }),
29288
29462
  "Agent run output"
29289
29463
  );
@@ -29342,7 +29516,7 @@ async function handleAutomationRunFiles({
29342
29516
  );
29343
29517
  const agentRuns = parseOperationResult(
29344
29518
  agentRunsResult,
29345
- z42.array(agentRunSchema),
29519
+ z43.array(agentRunSchema),
29346
29520
  "Automation run agent runs"
29347
29521
  );
29348
29522
  const iterations = [];
@@ -29361,7 +29535,7 @@ async function handleAutomationRunFiles({
29361
29535
  });
29362
29536
  const parsedPage = parseOperationResult(
29363
29537
  pageResult,
29364
- z42.array(iterationSchema),
29538
+ z43.array(iterationSchema),
29365
29539
  "Automation run iterations"
29366
29540
  );
29367
29541
  iterations.push(...parsedPage);
@@ -29382,7 +29556,7 @@ async function handleAutomationRunFiles({
29382
29556
  });
29383
29557
  truncated = parseOperationResult(
29384
29558
  peekResult,
29385
- z42.array(iterationSchema),
29559
+ z43.array(iterationSchema),
29386
29560
  "Automation run iterations"
29387
29561
  ).length > 0;
29388
29562
  }
@@ -29515,7 +29689,7 @@ function addRunEvidenceCommands({
29515
29689
  // src/self-update.ts
29516
29690
  import { spawn as spawn3 } from "node:child_process";
29517
29691
  import fs2 from "node:fs";
29518
- import path15 from "node:path";
29692
+ import path16 from "node:path";
29519
29693
  import { fileURLToPath as fileURLToPath3 } from "node:url";
29520
29694
  var CLI_PACKAGE_NAME = "@getmagical/cli";
29521
29695
  var DEFAULT_CLI_DIST_TAG2 = "latest";
@@ -29526,9 +29700,9 @@ function resolveInstalledPackageRoot({
29526
29700
  packageName
29527
29701
  }) {
29528
29702
  const packagePathSegments = packageName.split("/");
29529
- let currentPath = path15.dirname(entryFilePath);
29703
+ let currentPath = path16.dirname(entryFilePath);
29530
29704
  for (; ; ) {
29531
- const currentPathSegments = currentPath.split(path15.sep).filter(Boolean);
29705
+ const currentPathSegments = currentPath.split(path16.sep).filter(Boolean);
29532
29706
  const currentPackageSegments = currentPathSegments.slice(
29533
29707
  -packagePathSegments.length
29534
29708
  );
@@ -29537,7 +29711,7 @@ function resolveInstalledPackageRoot({
29537
29711
  )) {
29538
29712
  return currentPath;
29539
29713
  }
29540
- const parentPath = path15.dirname(currentPath);
29714
+ const parentPath = path16.dirname(currentPath);
29541
29715
  if (parentPath === currentPath) {
29542
29716
  return null;
29543
29717
  }
@@ -29547,14 +29721,14 @@ function resolveInstalledPackageRoot({
29547
29721
  function resolveInstallPrefixFromPackageRoot(packageRootPath) {
29548
29722
  let currentPath = packageRootPath;
29549
29723
  for (; ; ) {
29550
- if (path15.basename(currentPath) === "node_modules") {
29551
- const nodeModulesParentPath = path15.dirname(currentPath);
29552
- if (path15.basename(nodeModulesParentPath) === "lib") {
29553
- return path15.dirname(nodeModulesParentPath);
29724
+ if (path16.basename(currentPath) === "node_modules") {
29725
+ const nodeModulesParentPath = path16.dirname(currentPath);
29726
+ if (path16.basename(nodeModulesParentPath) === "lib") {
29727
+ return path16.dirname(nodeModulesParentPath);
29554
29728
  }
29555
29729
  return nodeModulesParentPath;
29556
29730
  }
29557
- const parentPath = path15.dirname(currentPath);
29731
+ const parentPath = path16.dirname(currentPath);
29558
29732
  if (parentPath === currentPath) {
29559
29733
  return null;
29560
29734
  }
@@ -29571,13 +29745,13 @@ function resolveManagedNpmCommand(installPrefix) {
29571
29745
  if (process.platform === "win32") {
29572
29746
  return null;
29573
29747
  }
29574
- const managedNodeExecutable = path15.join(
29748
+ const managedNodeExecutable = path16.join(
29575
29749
  installPrefix,
29576
29750
  MANAGED_NODE_SUBPATH,
29577
29751
  "bin",
29578
29752
  "node"
29579
29753
  );
29580
- const managedNpmCli = path15.join(
29754
+ const managedNpmCli = path16.join(
29581
29755
  installPrefix,
29582
29756
  MANAGED_NODE_SUBPATH,
29583
29757
  "lib",
@@ -29676,15 +29850,15 @@ async function selfUpdateInstalledCli({
29676
29850
  }
29677
29851
 
29678
29852
  // src/settings.ts
29679
- import { mkdir as mkdir4, readFile as readFile4, rm as rm4, writeFile as writeFile2 } from "node:fs/promises";
29680
- import path16 from "node:path";
29681
- import { z as z43 } from "zod";
29682
- var cliSettingsSchema = z43.object({
29683
- env: z43.object({
29684
- baseUrl: z43.url().optional(),
29685
- domain: z43.url().optional(),
29686
- env: z43.enum(["us", "uk", "stg"]).optional(),
29687
- workosEnv: z43.string().min(1).optional()
29853
+ import { mkdir as mkdir4, readFile as readFile5, rm as rm4, writeFile as writeFile2 } from "node:fs/promises";
29854
+ import path17 from "node:path";
29855
+ import { z as z44 } from "zod";
29856
+ var cliSettingsSchema = z44.object({
29857
+ env: z44.object({
29858
+ baseUrl: z44.url().optional(),
29859
+ domain: z44.url().optional(),
29860
+ env: z44.enum(["us", "uk", "stg"]).optional(),
29861
+ workosEnv: z44.string().min(1).optional()
29688
29862
  }).default({})
29689
29863
  });
29690
29864
  function createEmptyCliSettings() {
@@ -29696,13 +29870,13 @@ function hasCliSettingsOverrides(settings) {
29696
29870
  return Object.values(settings.env).some((value) => value !== void 0);
29697
29871
  }
29698
29872
  function resolveSettingsFilePath(stateFilePath) {
29699
- return path16.join(path16.dirname(stateFilePath), CLI_SETTINGS_FILE_NAME);
29873
+ return path17.join(path17.dirname(stateFilePath), CLI_SETTINGS_FILE_NAME);
29700
29874
  }
29701
29875
  function createFileSettingsStore(stateFilePath) {
29702
29876
  const settingsFilePath = resolveSettingsFilePath(stateFilePath);
29703
29877
  return {
29704
29878
  async load() {
29705
- const fileContents = await readFile4(settingsFilePath, "utf8").catch(
29879
+ const fileContents = await readFile5(settingsFilePath, "utf8").catch(
29706
29880
  (error) => {
29707
29881
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
29708
29882
  return null;
@@ -29732,7 +29906,7 @@ function createFileSettingsStore(stateFilePath) {
29732
29906
  await rm4(settingsFilePath, { force: true });
29733
29907
  return;
29734
29908
  }
29735
- await mkdir4(path16.dirname(settingsFilePath), { recursive: true });
29909
+ await mkdir4(path17.dirname(settingsFilePath), { recursive: true });
29736
29910
  await writeFile2(
29737
29911
  settingsFilePath,
29738
29912
  `${JSON.stringify(settings, null, 2)}
@@ -29900,15 +30074,15 @@ import {
29900
30074
  lstat as lstat2,
29901
30075
  mkdir as mkdir5,
29902
30076
  mkdtemp as mkdtemp2,
29903
- readFile as readFile5,
30077
+ readFile as readFile6,
29904
30078
  readdir,
29905
30079
  rename as rename4,
29906
30080
  rm as rm5,
29907
30081
  writeFile as writeFile3
29908
30082
  } from "node:fs/promises";
29909
30083
  import os3 from "node:os";
29910
- import path17 from "node:path";
29911
- import { z as z44 } from "zod";
30084
+ import path18 from "node:path";
30085
+ import { z as z45 } from "zod";
29912
30086
  var SKILLS_ROOT_PATH = "skills";
29913
30087
  var METADATA_DIRECTORY_NAME = "skill-working-copies";
29914
30088
  var MAX_GIT_OUTPUT_BYTES = 10 * 1024 * 1024;
@@ -29917,40 +30091,40 @@ var FULL_COMMIT_SHA_PATTERN = /^[\dA-Fa-f]{40}$/u;
29917
30091
  var UTF8_ENCODER = new TextEncoder();
29918
30092
  var WINDOWS_RESERVED_PATH_CHARACTER_PATTERN = /[<>:"|?*]/u;
29919
30093
  var WINDOWS_RESERVED_PATH_NAME_PATTERN = /^(?:AUX|CON|NUL|PRN|COM[1-9]|LPT[1-9])(?:\..*)?$/iu;
29920
- var skillBundleSchema = z44.object({
29921
- files: z44.array(
29922
- z44.object({
29923
- content: z44.string(),
29924
- encoding: z44.literal("base64"),
29925
- path: z44.string().min(1),
29926
- size: z44.number().int().nonnegative()
30094
+ var skillBundleSchema = z45.object({
30095
+ files: z45.array(
30096
+ z45.object({
30097
+ content: z45.string(),
30098
+ encoding: z45.literal("base64"),
30099
+ path: z45.string().min(1),
30100
+ size: z45.number().int().nonnegative()
29927
30101
  })
29928
30102
  ),
29929
- path: z44.string().min(1),
29930
- ref: z44.string().regex(FULL_COMMIT_SHA_PATTERN)
30103
+ path: z45.string().min(1),
30104
+ ref: z45.string().regex(FULL_COMMIT_SHA_PATTERN)
29931
30105
  });
29932
- var skillsApplyPatchResultSchema = z44.object({
29933
- changedFiles: z44.array(
29934
- z44.object({ path: z44.string().min(1), status: z44.string().min(1) })
30106
+ var skillsApplyPatchResultSchema = z45.object({
30107
+ changedFiles: z45.array(
30108
+ z45.object({ path: z45.string().min(1), status: z45.string().min(1) })
29935
30109
  ),
29936
- commit: z44.string().regex(FULL_COMMIT_SHA_PATTERN),
29937
- ok: z44.boolean(),
29938
- ref: z44.string().min(1)
30110
+ commit: z45.string().regex(FULL_COMMIT_SHA_PATTERN),
30111
+ ok: z45.boolean(),
30112
+ ref: z45.string().min(1)
29939
30113
  }).refine((result) => result.ok, {
29940
30114
  message: "Skills patch result was not successful."
29941
30115
  });
29942
- var workingCopyMetadataSchema = z44.object({
29943
- version: z44.literal(1),
29944
- files: z44.array(
29945
- z44.object({
29946
- content: z44.string(),
29947
- path: z44.string().min(1)
30116
+ var workingCopyMetadataSchema = z45.object({
30117
+ version: z45.literal(1),
30118
+ files: z45.array(
30119
+ z45.object({
30120
+ content: z45.string(),
30121
+ path: z45.string().min(1)
29948
30122
  })
29949
30123
  ),
29950
- organizationId: z44.string().min(1),
29951
- requestedRef: z44.string().min(1).nullable(),
29952
- skillPath: z44.string().min(1),
29953
- workingCopyPath: z44.string().min(1)
30124
+ organizationId: z45.string().min(1),
30125
+ requestedRef: z45.string().min(1).nullable(),
30126
+ skillPath: z45.string().min(1),
30127
+ workingCopyPath: z45.string().min(1)
29954
30128
  });
29955
30129
  function hasControlCharacter2(value) {
29956
30130
  return UTF8_ENCODER.encode(value).some((byte) => byte <= 31 || byte === 127);
@@ -29978,12 +30152,12 @@ function normalizeRootSkillPath(skill) {
29978
30152
  return `${SKILLS_ROOT_PATH}/${skillName}`;
29979
30153
  }
29980
30154
  function resolveWorkingCopyPath(workingDirectory, skillPath) {
29981
- return path17.resolve(workingDirectory, ...skillPath.split("/"));
30155
+ return path18.resolve(workingDirectory, ...skillPath.split("/"));
29982
30156
  }
29983
30157
  function resolveMetadataPath(stateFilePath, workingCopyPath) {
29984
30158
  const key = createHash3("sha256").update(workingCopyPath).digest("hex");
29985
- return path17.join(
29986
- path17.dirname(stateFilePath),
30159
+ return path18.join(
30160
+ path18.dirname(stateFilePath),
29987
30161
  METADATA_DIRECTORY_NAME,
29988
30162
  `${key}.json`
29989
30163
  );
@@ -30011,7 +30185,7 @@ function metadataFilesToSnapshot(files) {
30011
30185
  );
30012
30186
  }
30013
30187
  async function loadMetadata(metadataPath) {
30014
- const fileContents = await readFile5(metadataPath, "utf8").catch(
30188
+ const fileContents = await readFile6(metadataPath, "utf8").catch(
30015
30189
  (error) => {
30016
30190
  if (isMissingFileError3(error)) {
30017
30191
  return null;
@@ -30035,7 +30209,7 @@ async function loadMetadata(metadataPath) {
30035
30209
  return parsed.data;
30036
30210
  }
30037
30211
  async function saveMetadata(metadataPath, metadata) {
30038
- await mkdir5(path17.dirname(metadataPath), { recursive: true });
30212
+ await mkdir5(path18.dirname(metadataPath), { recursive: true });
30039
30213
  const temporaryPath = `${metadataPath}.${randomUUID6()}.tmp`;
30040
30214
  await writeFile3(temporaryPath, `${JSON.stringify(metadata, null, 2)}
30041
30215
  `, {
@@ -30112,7 +30286,7 @@ async function readDirectorySnapshot({
30112
30286
  const nextSegments = [...segments, entry.name];
30113
30287
  const relativePath = nextSegments.join("/");
30114
30288
  assertSafeRelativeFilePath(relativePath);
30115
- const filePath = path17.join(currentDirectory, entry.name);
30289
+ const filePath = path18.join(currentDirectory, entry.name);
30116
30290
  if (entry.isDirectory()) {
30117
30291
  return await visit(filePath, nextSegments);
30118
30292
  }
@@ -30121,7 +30295,7 @@ async function readDirectorySnapshot({
30121
30295
  `Skill working copy contains unsupported entry "${filePath}". Only regular files and directories are allowed.`
30122
30296
  );
30123
30297
  }
30124
- return [[`${skillPath}/${relativePath}`, await readFile5(filePath)]];
30298
+ return [[`${skillPath}/${relativePath}`, await readFile6(filePath)]];
30125
30299
  })
30126
30300
  );
30127
30301
  return nestedEntries.flat();
@@ -30147,8 +30321,8 @@ async function writeSnapshotContents(rootPath, snapshot, prefix) {
30147
30321
  [...snapshot.entries()].map(async ([filePath, content]) => {
30148
30322
  const relativePath = prefix === null ? filePath : filePath.slice(`${prefix}/`.length);
30149
30323
  assertSafeRelativeFilePath(relativePath);
30150
- const targetPath = path17.join(rootPath, ...relativePath.split("/"));
30151
- await mkdir5(path17.dirname(targetPath), { recursive: true });
30324
+ const targetPath = path18.join(rootPath, ...relativePath.split("/"));
30325
+ await mkdir5(path18.dirname(targetPath), { recursive: true });
30152
30326
  await writeFile3(targetPath, content);
30153
30327
  })
30154
30328
  );
@@ -30158,11 +30332,11 @@ async function replaceWorkingCopy({
30158
30332
  skillPath,
30159
30333
  workingCopyPath
30160
30334
  }) {
30161
- const parentPath = path17.dirname(workingCopyPath);
30335
+ const parentPath = path18.dirname(workingCopyPath);
30162
30336
  await mkdir5(parentPath, { recursive: true });
30163
- const temporaryPath = path17.join(
30337
+ const temporaryPath = path18.join(
30164
30338
  parentPath,
30165
- `.mgcl-${path17.basename(workingCopyPath)}-${randomUUID6()}.tmp`
30339
+ `.mgcl-${path18.basename(workingCopyPath)}-${randomUUID6()}.tmp`
30166
30340
  );
30167
30341
  const backupPath = `${workingCopyPath}.${randomUUID6()}.bak`;
30168
30342
  await mkdir5(temporaryPath);
@@ -30233,7 +30407,7 @@ async function clearDirectoryExceptGit(directoryPath) {
30233
30407
  const entries = await readdir(directoryPath);
30234
30408
  await Promise.all(
30235
30409
  entries.filter((entry) => entry !== ".git").map(async (entry) => {
30236
- await rm5(path17.join(directoryPath, entry), {
30410
+ await rm5(path18.join(directoryPath, entry), {
30237
30411
  force: true,
30238
30412
  recursive: true
30239
30413
  });
@@ -30245,7 +30419,7 @@ async function createPatch(before, after) {
30245
30419
  return "";
30246
30420
  }
30247
30421
  const repositoryPath = await mkdtemp2(
30248
- path17.join(os3.tmpdir(), "mgcl-skills-diff-")
30422
+ path18.join(os3.tmpdir(), "mgcl-skills-diff-")
30249
30423
  );
30250
30424
  const patchResult = await fromThrowable(async () => {
30251
30425
  await runGit(["init", "--quiet"], repositoryPath);
@@ -30567,27 +30741,27 @@ async function pushSkillWorkingCopy({
30567
30741
  }
30568
30742
 
30569
30743
  // src/state.ts
30570
- import { mkdir as mkdir6, readFile as readFile6, rm as rm6, writeFile as writeFile4 } from "node:fs/promises";
30571
- import path18 from "node:path";
30572
- import { z as z45 } from "zod";
30573
- var cliAccountSchema = z45.object({
30574
- clientId: z45.string().min(1),
30575
- email: z45.string().nullable(),
30576
- userId: z45.string().min(1)
30744
+ import { mkdir as mkdir6, readFile as readFile7, rm as rm6, writeFile as writeFile4 } from "node:fs/promises";
30745
+ import path19 from "node:path";
30746
+ import { z as z46 } from "zod";
30747
+ var cliAccountSchema = z46.object({
30748
+ clientId: z46.string().min(1),
30749
+ email: z46.string().nullable(),
30750
+ userId: z46.string().min(1)
30577
30751
  });
30578
- var cliOrganizationSchema = z45.object({
30579
- id: z45.string().min(1),
30580
- name: z45.string().min(1),
30581
- primaryDomain: z45.string().nullable().default(null)
30752
+ var cliOrganizationSchema = z46.object({
30753
+ id: z46.string().min(1),
30754
+ name: z46.string().min(1),
30755
+ primaryDomain: z46.string().nullable().default(null)
30582
30756
  });
30583
- var cliStateSchema = z45.object({
30757
+ var cliStateSchema = z46.object({
30584
30758
  account: cliAccountSchema,
30585
30759
  deploymentTarget: resolvedDeploymentTargetSchema.optional(),
30586
- defaultOrgId: z45.string().nullable(),
30587
- lastUsedOrgId: z45.string().nullable(),
30588
- organizations: z45.array(cliOrganizationSchema)
30760
+ defaultOrgId: z46.string().nullable(),
30761
+ lastUsedOrgId: z46.string().nullable(),
30762
+ organizations: z46.array(cliOrganizationSchema)
30589
30763
  });
30590
- var refreshTokenFileSchema = z45.record(z45.string(), z45.string());
30764
+ var refreshTokenFileSchema = z46.record(z46.string(), z46.string());
30591
30765
  function createFileStateStore(stateFilePath) {
30592
30766
  return {
30593
30767
  async clear() {
@@ -30595,7 +30769,7 @@ function createFileStateStore(stateFilePath) {
30595
30769
  },
30596
30770
  async load() {
30597
30771
  try {
30598
- const fileContents = await readFile6(stateFilePath, "utf8");
30772
+ const fileContents = await readFile7(stateFilePath, "utf8");
30599
30773
  const parsed = cliStateSchema.safeParse(JSON.parse(fileContents));
30600
30774
  if (!parsed.success) {
30601
30775
  throw new CliError("Stored CLI state is invalid.");
@@ -30612,7 +30786,7 @@ function createFileStateStore(stateFilePath) {
30612
30786
  }
30613
30787
  },
30614
30788
  async save(state) {
30615
- await mkdir6(path18.dirname(stateFilePath), { recursive: true });
30789
+ await mkdir6(path19.dirname(stateFilePath), { recursive: true });
30616
30790
  await writeFile4(stateFilePath, `${JSON.stringify(state, null, 2)}
30617
30791
  `);
30618
30792
  }
@@ -30621,7 +30795,7 @@ function createFileStateStore(stateFilePath) {
30621
30795
  function createFileRefreshTokenStore(refreshTokenFilePath) {
30622
30796
  async function loadRefreshTokens() {
30623
30797
  try {
30624
- const fileContents = await readFile6(refreshTokenFilePath, "utf8");
30798
+ const fileContents = await readFile7(refreshTokenFilePath, "utf8");
30625
30799
  const parsed = refreshTokenFileSchema.safeParse(JSON.parse(fileContents));
30626
30800
  if (!parsed.success) {
30627
30801
  throw new CliError("Stored refresh tokens are invalid.");
@@ -30640,7 +30814,7 @@ function createFileRefreshTokenStore(refreshTokenFilePath) {
30640
30814
  }
30641
30815
  }
30642
30816
  async function saveRefreshTokens(refreshTokens) {
30643
- await mkdir6(path18.dirname(refreshTokenFilePath), { recursive: true });
30817
+ await mkdir6(path19.dirname(refreshTokenFilePath), { recursive: true });
30644
30818
  await writeFile4(
30645
30819
  refreshTokenFilePath,
30646
30820
  `${JSON.stringify(refreshTokens, null, 2)}
@@ -30678,37 +30852,37 @@ function buildRefreshTokenKey(account) {
30678
30852
  }
30679
30853
 
30680
30854
  // src/workos-auth.ts
30681
- import { z as z46 } from "zod";
30855
+ import { z as z47 } from "zod";
30682
30856
  var DEFAULT_DEVICE_POLL_INTERVAL_SECONDS = 5;
30683
30857
  function buildFormHeaders() {
30684
30858
  const headers = new Headers();
30685
30859
  headers.set("content-type", "application/x-www-form-urlencoded");
30686
30860
  return headers;
30687
30861
  }
30688
- var deviceAuthorizationSchema = z46.object({
30689
- device_code: z46.string().min(1),
30690
- expires_in: z46.number().int().positive().optional(),
30691
- interval: z46.number().int().positive().optional(),
30692
- user_code: z46.string().min(1),
30693
- verification_uri: z46.url(),
30694
- verification_uri_complete: z46.url().optional()
30695
- });
30696
- var tokenResponseSchema = z46.object({
30697
- access_token: z46.string().min(1),
30698
- expires_in: z46.number().int().positive().optional(),
30699
- refresh_token: z46.string().min(1),
30700
- token_type: z46.string().optional()
30701
- });
30702
- var tokenErrorSchema = z46.object({
30703
- error: z46.string().min(1),
30704
- error_description: z46.string().optional()
30705
- });
30706
- var accessTokenClaimsSchema = z46.object({
30707
- exp: z46.number().int().positive().optional(),
30708
- iss: z46.string().min(1).optional(),
30709
- org_id: z46.string().min(1).optional(),
30710
- sid: z46.string().min(1).optional(),
30711
- sub: z46.string().min(1)
30862
+ var deviceAuthorizationSchema = z47.object({
30863
+ device_code: z47.string().min(1),
30864
+ expires_in: z47.number().int().positive().optional(),
30865
+ interval: z47.number().int().positive().optional(),
30866
+ user_code: z47.string().min(1),
30867
+ verification_uri: z47.url(),
30868
+ verification_uri_complete: z47.url().optional()
30869
+ });
30870
+ var tokenResponseSchema = z47.object({
30871
+ access_token: z47.string().min(1),
30872
+ expires_in: z47.number().int().positive().optional(),
30873
+ refresh_token: z47.string().min(1),
30874
+ token_type: z47.string().optional()
30875
+ });
30876
+ var tokenErrorSchema = z47.object({
30877
+ error: z47.string().min(1),
30878
+ error_description: z47.string().optional()
30879
+ });
30880
+ var accessTokenClaimsSchema = z47.object({
30881
+ exp: z47.number().int().positive().optional(),
30882
+ iss: z47.string().min(1).optional(),
30883
+ org_id: z47.string().min(1).optional(),
30884
+ sid: z47.string().min(1).optional(),
30885
+ sub: z47.string().min(1)
30712
30886
  });
30713
30887
  function createWorkosAuthClient({
30714
30888
  fetchFn = fetch,
@@ -31018,13 +31192,17 @@ async function handleOperationCommand(dependencies, operationSpec, commandOption
31018
31192
  commandOptions,
31019
31193
  dependencies.workingDirectory ?? process.cwd()
31020
31194
  );
31021
- const variables = parseOperationVariables(
31022
- operationSpec,
31023
- getFileUploadOperationVariables(
31195
+ const operationVariables = await resolveClassifyOperationVariables({
31196
+ defaultVariables: getFileUploadOperationVariables(
31024
31197
  collectOperationVariableInput(operationSpec, commandOptions),
31025
31198
  preparedUpload
31026
- )
31027
- );
31199
+ ),
31200
+ operationName: operationSpec.operationName,
31201
+ options: commandOptions,
31202
+ runtime: dependencies.classifyCommandRuntime,
31203
+ workingDirectory: dependencies.workingDirectory ?? process.cwd()
31204
+ });
31205
+ const variables = parseOperationVariables(operationSpec, operationVariables);
31028
31206
  const apiKeyEnvironment = getApiKeyEnvironment(
31029
31207
  dependencies,
31030
31208
  commandOptions.apiKey
@@ -32004,6 +32182,9 @@ function addRegistryOperationCommand({
32004
32182
  }
32005
32183
  const command = parentCommand.command(leafCommandName);
32006
32184
  configureOperationalCommand(command, dependencies, operationSpec);
32185
+ if (parentCommand === program2) {
32186
+ return;
32187
+ }
32007
32188
  const legacyAliasCommand = program2.command(operationSpec.cli.name, {
32008
32189
  hidden: true
32009
32190
  });
@@ -32028,6 +32209,7 @@ ${formatExamples(
32028
32209
  createOperationHelpExamples(operationSpec)
32029
32210
  )}`
32030
32211
  );
32212
+ configureClassifyHelp(command, operationSpec.operationName);
32031
32213
  for (const optionSpec of operationSpec.cli.options) {
32032
32214
  command.addOption(
32033
32215
  createCliCommanderOption(
@@ -32053,12 +32235,12 @@ function createDefaultDependencies() {
32053
32235
  return resolveDeploymentTarget({ savedEnv: settings.env, selectors });
32054
32236
  };
32055
32237
  const resolveApiBaseUrl = () => deploymentTargetContext.get().apiUrl;
32056
- const accessTokenFilePath = runtimeConfig.accessTokenFilePath ?? path19.join(
32057
- path19.dirname(runtimeConfig.stateFilePath),
32238
+ const accessTokenFilePath = runtimeConfig.accessTokenFilePath ?? path20.join(
32239
+ path20.dirname(runtimeConfig.stateFilePath),
32058
32240
  CLI_ACCESS_TOKEN_FILE_NAME
32059
32241
  );
32060
- const refreshTokenFilePath = runtimeConfig.refreshTokenFilePath ?? path19.join(
32061
- path19.dirname(runtimeConfig.stateFilePath),
32242
+ const refreshTokenFilePath = runtimeConfig.refreshTokenFilePath ?? path20.join(
32243
+ path20.dirname(runtimeConfig.stateFilePath),
32062
32244
  CLI_REFRESH_TOKEN_FILE_NAME
32063
32245
  );
32064
32246
  const selfUpdateOptions = {
@@ -32076,8 +32258,8 @@ function createDefaultDependencies() {
32076
32258
  io: createConsoleIo(),
32077
32259
  openExternalUrl,
32078
32260
  orgPreferencesStore: createFileOrgPreferencesStore(
32079
- path19.join(
32080
- path19.dirname(runtimeConfig.stateFilePath),
32261
+ path20.join(
32262
+ path20.dirname(runtimeConfig.stateFilePath),
32081
32263
  "organization-preferences"
32082
32264
  )
32083
32265
  ),