@getmagical/cli 0.8.0 → 0.9.1

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({
@@ -13229,7 +13232,7 @@ var magicalBaseModels = [
13229
13232
  ];
13230
13233
  var DEFAULT_MODEL = "gemini-2.5-flash";
13231
13234
  var modelOptionsSchema = z11.object({
13232
- reasoningEffort: z11.enum(["low", "medium", "high"]).optional().describe("Reasoning effort level for models that support it (e.g., o1, o3). Higher effort may produce better results but takes longer."),
13235
+ reasoningEffort: z11.enum(["low", "medium", "high", "xhigh"]).optional().describe("Reasoning effort level for models that support it. Higher effort may produce better results but takes longer. The xhigh level is available on supported OpenAI models."),
13233
13236
  temperature: z11.number().min(0).max(2).optional().describe("Controls randomness in model output. 0 is deterministic, higher values (up to 2) increase creativity and randomness."),
13234
13237
  timeoutMs: z11.number().int().min(1).optional().describe("Maximum time to wait for an LLM provider request before failing through the normal result path.")
13235
13238
  });
@@ -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({
@@ -15578,6 +15581,7 @@ var automationRunSlaSchema = z27.object({
15578
15581
  type: automationRunSlaTypeSchema.optional().default("all").describe("SLA policy type that applies to this automation run.")
15579
15582
  }).superRefine(refineAutomationRunSlaTimestampOrder).describe("Optional service-level timing metadata for queueing and runtime consumers of this automation run.");
15580
15583
  var automationRunConfigBaseSchema = z27.object({
15584
+ branchId: z27.uuid().nullable().default(null).describe("Infrastructure-owned originating draft branch ID. Null and omitted legacy values identify main. Branch identity remains fixed for the lifetime of the run."),
15581
15585
  approvalMode: z27.enum(["HUMAN_APPROVAL", "OFF"]).default("OFF"),
15582
15586
  consistencyCheckCount: z27.number().int().nonnegative().max(CONSISTENCY_CHECK_COUNT_MAX).nullable().default(null),
15583
15587
  settingsSourceAgentId: z27.uuid().nullable().optional().describe("Optional provenance/debug field recording which top-level agent supplied canonical run settings when the run started. Runtime consumers must not use this as a live pointer once resolvedRunSettingsSource has been decided."),
@@ -15610,6 +15614,7 @@ var automationRunConfigSchema = automationRunConfigBaseSchema.superRefine((confi
15610
15614
  var automationRunStartConfigSchema = automationRunConfigBaseSchema.omit({
15611
15615
  allowPointOfNoReturnOverride: true,
15612
15616
  automationVersionPinned: true,
15617
+ branchId: true,
15613
15618
  credentialVariableResourcePools: true,
15614
15619
  implicitNetworkTrafficRecordingDecision: true,
15615
15620
  networkTrafficCapture: true,
@@ -15838,13 +15843,13 @@ function getMentionedStandardCommand(instructions) {
15838
15843
  const normalizedInstructions = instructions.toLowerCase();
15839
15844
  return STANDARD_COMMAND_NAMES.find((commandName) => normalizedInstructions.includes(commandName.toLowerCase())) ?? null;
15840
15845
  }
15841
- function assertCustomInstructionsCommand({ commands, path: path20 }) {
15842
- const customCommands = commands.flatMap((command, commandIndex) => command["commandName"] === "custom" ? [{ command, path: `${path20}[${commandIndex.toString()}]` }] : []);
15846
+ function assertCustomInstructionsCommand({ commands, path: path21 }) {
15847
+ const customCommands = commands.flatMap((command, commandIndex) => command["commandName"] === "custom" ? [{ command, path: `${path21}[${commandIndex.toString()}]` }] : []);
15843
15848
  if (customCommands.length === 0) {
15844
15849
  return;
15845
15850
  }
15846
15851
  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.`);
15852
+ 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
15853
  }
15849
15854
  for (const customCommand of customCommands) {
15850
15855
  const instructions = getCustomInstructions(customCommand.command);
@@ -16073,8 +16078,8 @@ function createOperationSpec(spec) {
16073
16078
  }
16074
16079
 
16075
16080
  // ../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").';
16081
+ var AUTOMATION_BRANCH_NAME_PATTERN = /^[\da-z]+(?:[-/][\da-z]+)*$/u;
16082
+ 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
16083
  function stringOption({
16079
16084
  clientOnly = false,
16080
16085
  description,
@@ -16226,7 +16231,7 @@ function isRecord3(value) {
16226
16231
  function validateCustomInstructionsCommands({
16227
16232
  commands,
16228
16233
  ctx,
16229
- path: path20
16234
+ path: path21
16230
16235
  }) {
16231
16236
  if (!Array.isArray(commands)) {
16232
16237
  return;
@@ -16234,14 +16239,14 @@ function validateCustomInstructionsCommands({
16234
16239
  const validationResult = fromThrowable(() => {
16235
16240
  assertCustomInstructionsCommand({
16236
16241
  commands: commands.map((command) => isRecord3(command) ? command : {}),
16237
- path: path20.join(".").replaceAll(/\.(?<index>\d+)/gu, "[$<index>]")
16242
+ path: path21.join(".").replaceAll(/\.(?<index>\d+)/gu, "[$<index>]")
16238
16243
  });
16239
16244
  }, "invalid-custom-instructions-command");
16240
16245
  if (isErr(validationResult)) {
16241
16246
  ctx.addIssue({
16242
16247
  code: "custom",
16243
16248
  message: `${getErrorMessage2(validationResult.error.cause)} Run mgcl catalog commands to find the standard command for this work.`,
16244
- path: path20
16249
+ path: path21
16245
16250
  });
16246
16251
  }
16247
16252
  }
@@ -16597,6 +16602,38 @@ var automationRunsCliOptions = [
16597
16602
  })
16598
16603
  ];
16599
16604
  var operationSpecs = [
16605
+ createOperationSpec({
16606
+ operationName: "Classify",
16607
+ apiKeyAccess: apiKeyAccessPolicies.baseline,
16608
+ kind: "query",
16609
+ inputSchema: z28.object({ input: jsonObjectSchema }),
16610
+ cli: {
16611
+ name: "classify",
16612
+ path: ["classify"],
16613
+ description: "Answer typed noul, choice, and score questions about supplied context.",
16614
+ resultKey: "classify",
16615
+ options: [
16616
+ stringOption({
16617
+ clientOnly: true,
16618
+ description: "TypeSafe-shaped request object as inline JSON.",
16619
+ flagName: "input-json",
16620
+ inputKey: "inputJson",
16621
+ valueHint: "JSON"
16622
+ }),
16623
+ stringOption({
16624
+ clientOnly: true,
16625
+ description: "Path to request JSON, or - to read stdin.",
16626
+ flagName: "input-file",
16627
+ inputKey: "inputFile"
16628
+ })
16629
+ ]
16630
+ },
16631
+ mcp: { exposed: false, fileName: "classify.graphql" },
16632
+ document: `# Answer typed questions about caller-supplied context
16633
+ query Classify($input: JSON!) {
16634
+ classify(input: $input)
16635
+ }`
16636
+ }),
16600
16637
  createOperationSpec({
16601
16638
  operationName: "KnowledgeFiles",
16602
16639
  apiKeyAccess: apiKeyAccessPolicies.knowledgeRead,
@@ -18100,7 +18137,7 @@ query ListAutomationBranches($automationId: ID!) {
18100
18137
  stringOption({
18101
18138
  inputKey: "name",
18102
18139
  flagName: "name",
18103
- description: 'Lowercase branch name with single dashes between words or numbers (for example, "release-2").',
18140
+ description: 'Lowercase branch name with single dashes or slashes between words or numbers (for example, "otto/branch-fix").',
18104
18141
  required: true
18105
18142
  }),
18106
18143
  stringOption({
@@ -19314,7 +19351,7 @@ mutation skills_apply_patch(
19314
19351
  cli: {
19315
19352
  name: "create-automation",
19316
19353
  path: ["automations", "create"],
19317
- description: "Create a draft automation.",
19354
+ description: "Create a draft automation. Inspect publishChecks and repair blocking failures before completing the task.",
19318
19355
  resultKey: "createAutomation",
19319
19356
  options: [
19320
19357
  jsonOption({
@@ -19327,10 +19364,12 @@ mutation skills_apply_patch(
19327
19364
  },
19328
19365
  mcp: { fileName: "createAutomation.graphql" },
19329
19366
  document: `# Mutation to create a draft automation with optional initial values
19367
+ # Draft saves are allowed. Inspect publishChecks, repair blocking failures, and save again before completing the task. Unknown means checks must be retried.
19330
19368
  # Returns flat fields only for MCP tool simplicity
19331
19369
  mutation CreateAutomation($input: CreateAutomationInput!) {
19332
19370
  createAutomation(input: $input) {
19333
19371
  id
19372
+ publishChecks
19334
19373
  name
19335
19374
  organizationId
19336
19375
  createdAt
@@ -19912,7 +19951,7 @@ mutation ValidateAutomationPatchReadiness(
19912
19951
  branchContext: "optional",
19913
19952
  name: "apply-automation-patch",
19914
19953
  path: ["workbench", "patch", "apply"],
19915
- description: "Apply semantic workbench patch operations through the versioned save path.",
19954
+ description: "Apply semantic workbench patch operations through the versioned save path. Inspect publishChecks and repair blocking failures before completing the task.",
19916
19955
  resultKey: "applyAutomationPatch",
19917
19956
  options: [
19918
19957
  stringOption({
@@ -19936,6 +19975,7 @@ mutation ValidateAutomationPatchReadiness(
19936
19975
  },
19937
19976
  mcp: { fileName: "applyAutomationPatch.graphql" },
19938
19977
  document: `# Apply semantic automation patch operations through the versioned save path.
19978
+ # Inspect publishChecks after saving. Repair blocking failures and save again before completing the task; retry unknown checks.
19939
19979
  mutation ApplyAutomationPatch(
19940
19980
  $draftAutomationId: ID!
19941
19981
  $branchId: ID
@@ -19952,6 +19992,7 @@ mutation ApplyAutomationPatch(
19952
19992
  branchId
19953
19993
  headVersionId
19954
19994
  applied
19995
+ publishChecks
19955
19996
  updateInput
19956
19997
  before {
19957
19998
  name
@@ -20037,7 +20078,7 @@ mutation ApplyAutomationPatch(
20037
20078
  branchContext: "optional",
20038
20079
  name: "update-automation-by-id",
20039
20080
  path: ["automations", "update"],
20040
- description: "Update an automation.",
20081
+ description: "Update an automation. Inspect publishChecks and repair blocking failures before completing the task. Changing an existing agent's type in place is not supported. To change its type, create a replacement agent, update references to the replacement, and remove the original agent.",
20041
20082
  resultKey: "updateAutomation",
20042
20083
  options: [
20043
20084
  stringOption({
@@ -20060,13 +20101,14 @@ mutation ApplyAutomationPatch(
20060
20101
  # 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
20102
  # 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
20103
  # 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
20104
+ # Draft saves are allowed. Inspect publishChecks, repair blocking failures, and save again before completing the task. Unknown means checks must be retried.
20064
20105
  mutation UpdateAutomationById($id: ID!, $branchId: ID, $input: UpdateAutomationInput!) {
20065
20106
  updateAutomation(id: $id, branchId: $branchId, input: $input) {
20066
20107
  id
20067
20108
  branchId
20068
20109
  headVersionId
20069
20110
  lastSavedAt
20111
+ publishChecks
20070
20112
  }
20071
20113
  }`
20072
20114
  }),
@@ -20854,15 +20896,15 @@ var agentRunPathwaySignatureResponseSchema = z29.union([
20854
20896
  var pathwayRegressionRunStatusSchema = z29.enum([
20855
20897
  "queued",
20856
20898
  "running",
20857
- "passed",
20858
- "failed",
20899
+ "matched",
20900
+ "deviated",
20859
20901
  "inconclusive",
20860
20902
  "errored"
20861
20903
  ]);
20862
20904
  var pathwayRegressionReplayIterationStatusSchema = z29.enum([
20863
20905
  "running",
20864
- "passed",
20865
- "failed",
20906
+ "matched",
20907
+ "deviated",
20866
20908
  "inconclusive",
20867
20909
  "errored"
20868
20910
  ]);
@@ -20900,8 +20942,8 @@ var pathwayRegressionAgentVersionRunPathStatusSchema = z29.enum([
20900
20942
  var pathwayRegressionAgentVersionRunStatusSchema = z29.enum([
20901
20943
  "queued",
20902
20944
  "running",
20903
- "passed",
20904
- "failed",
20945
+ "matched",
20946
+ "deviated",
20905
20947
  "inconclusive",
20906
20948
  "errored",
20907
20949
  "not_started"
@@ -20985,10 +21027,10 @@ var pathwayRegressionAgentVersionRunResponseSchema = z29.union([
20985
21027
  pathwayRegressionAgentVersionRegressionRunResponseSchema
20986
21028
  ]);
20987
21029
  var pathwayRegressionCheckSummarySchema = z29.object({
21030
+ deviated: z29.number(),
20988
21031
  errored: z29.number(),
20989
- failed: z29.number(),
20990
21032
  inconclusive: z29.number(),
20991
- passed: z29.number(),
21033
+ matched: z29.number(),
20992
21034
  plannedTotal: z29.number(),
20993
21035
  total: z29.number()
20994
21036
  });
@@ -21014,7 +21056,7 @@ var pathwayRegressionReplayCheckResultSchema = z29.object({
21014
21056
  llmRequestId: z29.string().min(1).nullable(),
21015
21057
  modelId: z29.string().min(1).nullable(),
21016
21058
  outputResult: z29.unknown().nullable(),
21017
- status: z29.enum(["passed", "failed", "errored"]),
21059
+ status: z29.enum(["matched", "deviated", "errored"]),
21018
21060
  strictExactMatch: z29.boolean().nullable()
21019
21061
  });
21020
21062
  var pathwayRegressionReplayIterationCheckResultsResponseSchema = z29.object({
@@ -21062,16 +21104,16 @@ var regressionTestPathwayStatusSchema = z29.enum([
21062
21104
  "no_matching_runs",
21063
21105
  "queued",
21064
21106
  "running",
21065
- "passed",
21066
- "failed",
21107
+ "matched",
21108
+ "deviated",
21067
21109
  "inconclusive",
21068
21110
  "errored"
21069
21111
  ]);
21070
21112
  var regressionTestStatusSchema = z29.enum([
21071
21113
  "queued",
21072
21114
  "running",
21073
- "passed",
21074
- "failed",
21115
+ "matched",
21116
+ "deviated",
21075
21117
  "inconclusive",
21076
21118
  "errored"
21077
21119
  ]);
@@ -21090,9 +21132,9 @@ var regressionTestKickoffResponseSchema = z29.object({
21090
21132
  status: regressionTestStatusSchema
21091
21133
  });
21092
21134
  var regressionTestIterationCountsSchema = z29.object({
21135
+ deviated: z29.number(),
21093
21136
  errored: z29.number(),
21094
- failed: z29.number(),
21095
- passed: z29.number(),
21137
+ matched: z29.number(),
21096
21138
  total: z29.number()
21097
21139
  });
21098
21140
  var regressionTestBaselineRunSummarySchema = z29.object({
@@ -21121,23 +21163,23 @@ var regressionTestBaselineStepSchema = z29.object({
21121
21163
  id: z29.string().min(1),
21122
21164
  iterationIndex: z29.number()
21123
21165
  });
21124
- var regressionTestFailedToolCallSchema = z29.object({
21166
+ var regressionTestDeviatedToolCallSchema = z29.object({
21125
21167
  count: z29.number(),
21126
21168
  observedToolCall: z29.unknown()
21127
21169
  });
21128
- var regressionTestFailedIterationSchema = z29.object({
21170
+ var regressionTestDeviatedIterationSchema = z29.object({
21129
21171
  baselineIterationId: z29.string().min(1),
21130
- failedToolCalls: z29.array(regressionTestFailedToolCallSchema)
21172
+ deviatedToolCalls: z29.array(regressionTestDeviatedToolCallSchema)
21131
21173
  });
21132
21174
  var regressionTestReplayCountsSchema = z29.object({
21175
+ deviated: z29.number(),
21133
21176
  errored: z29.number(),
21134
- failed: z29.number(),
21135
- passed: z29.number()
21177
+ matched: z29.number()
21136
21178
  });
21137
21179
  var regressionTestBaselineRunSchema = z29.object({
21138
21180
  baselineAgentRunId: z29.string().min(1),
21139
21181
  baselineIterations: z29.array(regressionTestBaselineStepSchema),
21140
- failedIterations: z29.array(regressionTestFailedIterationSchema),
21182
+ deviatedIterations: z29.array(regressionTestDeviatedIterationSchema),
21141
21183
  replayCounts: regressionTestReplayCountsSchema
21142
21184
  });
21143
21185
  var regressionTestPathwayDetailSchema = z29.object({
@@ -21427,18 +21469,18 @@ async function downloadAuthenticatedFileFromApi({
21427
21469
  organizationId,
21428
21470
  outputPath,
21429
21471
  overwrite = false,
21430
- path: path20,
21472
+ path: path21,
21431
21473
  resolveApiBaseUrl,
21432
21474
  timeoutMs
21433
21475
  }) {
21434
- if (!path20.startsWith("/") || path20.startsWith("//")) {
21476
+ if (!path21.startsWith("/") || path21.startsWith("//")) {
21435
21477
  throw new CliError(
21436
21478
  "Authenticated file download path must be relative to the configured Magical API."
21437
21479
  );
21438
21480
  }
21439
21481
  const normalizedApiBaseUrl = trimTrailingSlash(await resolveApiBaseUrl());
21440
21482
  const apiBaseResult = safeUrlConstructor(`${normalizedApiBaseUrl}/`);
21441
- const urlResult = safeUrlConstructor(`${normalizedApiBaseUrl}${path20}`);
21483
+ const urlResult = safeUrlConstructor(`${normalizedApiBaseUrl}${path21}`);
21442
21484
  if (isErr(apiBaseResult) || isErr(urlResult) || urlResult.value.origin !== apiBaseResult.value.origin || !urlResult.value.pathname.startsWith(apiBaseResult.value.pathname)) {
21443
21485
  throw new CliError(
21444
21486
  "Authenticated file download path must stay within the configured Magical API."
@@ -21535,16 +21577,16 @@ function buildPathwayRegressionAgentVersionPath({
21535
21577
  leafPath,
21536
21578
  runsPerPath
21537
21579
  }) {
21538
- const path20 = `/pathway-regression/automation-versions/${encodeURIComponent(
21580
+ const path21 = `/pathway-regression/automation-versions/${encodeURIComponent(
21539
21581
  automationVersionId
21540
21582
  )}/agent-versions/${encodeURIComponent(agentVersionId)}/${leafPath}`;
21541
21583
  if (runsPerPath === void 0) {
21542
- return path20;
21584
+ return path21;
21543
21585
  }
21544
21586
  const queryParams = new URLSearchParams({
21545
21587
  runsPerPath: String(runsPerPath)
21546
21588
  });
21547
- return `${path20}?${queryParams.toString()}`;
21589
+ return `${path21}?${queryParams.toString()}`;
21548
21590
  }
21549
21591
  function applyAuthenticationHeaders({
21550
21592
  accessToken,
@@ -21580,11 +21622,11 @@ function createFetchJson({
21580
21622
  accessToken,
21581
21623
  impersonatedOrganizationId,
21582
21624
  allowOttoAuthorization,
21583
- path: path20,
21625
+ path: path21,
21584
21626
  init,
21585
21627
  organizationId
21586
21628
  }) {
21587
- const url = `${trimTrailingSlash(await resolveApiBaseUrl())}${path20}`;
21629
+ const url = `${trimTrailingSlash(await resolveApiBaseUrl())}${path21}`;
21588
21630
  const usesWorkOSApiKey = isWorkOSApiKey(accessToken);
21589
21631
  const headers = new Headers(init?.headers);
21590
21632
  applyAuthenticationHeaders({
@@ -21784,7 +21826,7 @@ function createMagicalApiClient({
21784
21826
  organizationId,
21785
21827
  outputPath,
21786
21828
  overwrite = false,
21787
- path: path20,
21829
+ path: path21,
21788
21830
  timeoutMs
21789
21831
  }) {
21790
21832
  await downloadAuthenticatedFileFromApi({
@@ -21797,7 +21839,7 @@ function createMagicalApiClient({
21797
21839
  ...maxSizeBytes === void 0 ? {} : { maxSizeBytes },
21798
21840
  outputPath,
21799
21841
  overwrite,
21800
- path: path20,
21842
+ path: path21,
21801
21843
  resolveApiBaseUrl,
21802
21844
  ...timeoutMs === void 0 ? {} : { timeoutMs }
21803
21845
  });
@@ -27227,6 +27269,140 @@ async function pollCaptureRecording({
27227
27269
  });
27228
27270
  }
27229
27271
 
27272
+ // src/classify-command.ts
27273
+ import { readFile as readFile3 } from "node:fs/promises";
27274
+ import path8 from "node:path";
27275
+ import { z as z36 } from "zod";
27276
+ var classifyRequestSchema = z36.object({
27277
+ model: z36.string().refine((model) => model.trim().length > 0, "Model must not be empty.").optional(),
27278
+ questions: z36.record(z36.string(), z36.unknown()).refine(
27279
+ (questions) => Object.keys(questions).length > 0,
27280
+ "Questions must contain at least one named question."
27281
+ ),
27282
+ state: z36.unknown()
27283
+ }).passthrough().refine((input) => Object.hasOwn(input, "state"), {
27284
+ message: "Classify input must include state.",
27285
+ path: ["state"]
27286
+ });
27287
+ var CLASSIFY_OPERATION_NAME = "Classify";
27288
+ var CLASSIFY_HELP_TEXT = `
27289
+ Classify input:
27290
+ Pass exactly one of --input-json, --input-file <path>, or --input-file - for stdin.
27291
+ All named questions share the supplied state and are answered independently.
27292
+ The backend defaults to jev-latest; set model in the request to select an explicit supported model.
27293
+ Noul values are probabilities, choice answers retain option probabilities, and scores may be fractional.
27294
+ Supply text or JSON evidence only; URLs and named files are not fetched. Output is always the full JSON response.
27295
+
27296
+ Examples:
27297
+ mgcl classify --input-file request.json
27298
+ mgcl classify --input-json '{"state":"Refund requested","questions":{"refund":{"type":"noul","instructions":"Is a refund requested?"}}}'
27299
+ cat request.json | mgcl classify --input-file -`;
27300
+ async function readStdin() {
27301
+ process.stdin.setEncoding("utf8");
27302
+ let contents = "";
27303
+ for await (const chunk of process.stdin) {
27304
+ if (typeof chunk !== "string") {
27305
+ throw new CliError("Classify stdin must be UTF-8 text.");
27306
+ }
27307
+ contents += chunk;
27308
+ }
27309
+ return contents;
27310
+ }
27311
+ async function readInputFile({
27312
+ inputFile,
27313
+ runtime
27314
+ }) {
27315
+ if (inputFile === "-") {
27316
+ return await (runtime.readStdin ?? readStdin)().catch(
27317
+ (error) => {
27318
+ throw new CliError("Failed to read classify input from stdin.", {
27319
+ cause: error
27320
+ });
27321
+ }
27322
+ );
27323
+ }
27324
+ const inputPath = path8.resolve(
27325
+ runtime.workingDirectory ?? process.cwd(),
27326
+ inputFile
27327
+ );
27328
+ return await readFile3(inputPath, "utf8").catch((error) => {
27329
+ throw new CliError(`Failed to read classify input file "${inputPath}".`, {
27330
+ cause: error
27331
+ });
27332
+ });
27333
+ }
27334
+ async function resolveClassifyVariables({
27335
+ inputFile,
27336
+ inputJson,
27337
+ runtime = {}
27338
+ }) {
27339
+ const hasInputFile = inputFile !== void 0;
27340
+ const hasInputJson = inputJson !== void 0;
27341
+ if (Number(hasInputFile) + Number(hasInputJson) !== 1) {
27342
+ throw new CliError(
27343
+ "Pass exactly one of --input-json or --input-file for classify input."
27344
+ );
27345
+ }
27346
+ let input = inputJson;
27347
+ if (hasInputFile) {
27348
+ if (typeof inputFile !== "string" || inputFile.length === 0) {
27349
+ throw new CliError("--input-file must name a JSON file or - for stdin.");
27350
+ }
27351
+ const contents = await readInputFile({ inputFile, runtime });
27352
+ const parsedJson = safeJsonParseWithoutLogging(contents);
27353
+ if (isErr(parsedJson)) {
27354
+ const source = inputFile === "-" ? "stdin" : `file "${inputFile}"`;
27355
+ throw new CliError(`Classify input from ${source} must be valid JSON.`, {
27356
+ cause: parsedJson.error
27357
+ });
27358
+ }
27359
+ input = parsedJson.value;
27360
+ } else if (typeof inputJson === "string") {
27361
+ const parsedJson = safeJsonParseWithoutLogging(inputJson);
27362
+ if (isErr(parsedJson)) {
27363
+ throw new CliError(
27364
+ "Classify input from --input-json must be valid JSON.",
27365
+ {
27366
+ cause: parsedJson.error
27367
+ }
27368
+ );
27369
+ }
27370
+ input = parsedJson.value;
27371
+ }
27372
+ const parsedInput = classifyRequestSchema.safeParse(input);
27373
+ if (!parsedInput.success) {
27374
+ throw new CliError(
27375
+ parsedInput.error.issues[0]?.message ?? "Classify input must be a JSON object containing state and questions."
27376
+ );
27377
+ }
27378
+ return { input: parsedInput.data };
27379
+ }
27380
+ async function resolveClassifyOperationVariables({
27381
+ defaultVariables,
27382
+ operationName,
27383
+ options,
27384
+ runtime,
27385
+ workingDirectory
27386
+ }) {
27387
+ if (operationName !== CLASSIFY_OPERATION_NAME) {
27388
+ return defaultVariables;
27389
+ }
27390
+ return await resolveClassifyVariables({
27391
+ inputFile: options["inputFile"],
27392
+ inputJson: options["inputJson"],
27393
+ runtime: {
27394
+ ...runtime,
27395
+ workingDirectory: runtime?.workingDirectory ?? workingDirectory
27396
+ }
27397
+ });
27398
+ }
27399
+ function configureClassifyHelp(command, operationName) {
27400
+ if (operationName === CLASSIFY_OPERATION_NAME) {
27401
+ command.addHelpText("after", CLASSIFY_HELP_TEXT);
27402
+ command.setOptionValueWithSource("json", true, "default");
27403
+ }
27404
+ }
27405
+
27230
27406
  // src/cli-io.ts
27231
27407
  function createConsoleIo() {
27232
27408
  return {
@@ -27243,53 +27419,53 @@ function createConsoleIo() {
27243
27419
 
27244
27420
  // src/eval-commands.ts
27245
27421
  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";
27422
+ import { access as access2, readFile as readFile4 } from "node:fs/promises";
27423
+ import path9 from "node:path";
27248
27424
  import { createInterface } from "node:readline/promises";
27249
- import { z as z36 } from "zod";
27425
+ import { z as z37 } from "zod";
27250
27426
  var MAX_AWAIT_REQUEST_MS = 6e4;
27251
27427
  var MIN_AWAIT_REQUEST_MS = 1e3;
27252
27428
  var EXPORT_POLL_INTERVAL_MS = 1e3;
27253
- var evalRunStatusSchema2 = z36.enum([
27429
+ var evalRunStatusSchema2 = z37.enum([
27254
27430
  "QUEUED",
27255
27431
  "RUNNING",
27256
27432
  "COMPLETE",
27257
27433
  "FAILED",
27258
27434
  "CANCELLED"
27259
27435
  ]);
27260
- var awaitResultSchema = z36.object({
27261
- elapsedMs: z36.number().nonnegative(),
27262
- evalRun: z36.object({
27263
- id: z36.string().min(1),
27436
+ var awaitResultSchema = z37.object({
27437
+ elapsedMs: z37.number().nonnegative(),
27438
+ evalRun: z37.object({
27439
+ id: z37.string().min(1),
27264
27440
  status: evalRunStatusSchema2
27265
27441
  }).passthrough(),
27266
- pollCount: z36.number().int().nonnegative(),
27267
- reachedTerminal: z36.boolean()
27442
+ pollCount: z37.number().int().nonnegative(),
27443
+ reachedTerminal: z37.boolean()
27268
27444
  }).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)
27445
+ var planResultSchema = z37.object({ trialCount: z37.number().int().nonnegative() }).passthrough();
27446
+ var startResultSchema = z37.object({
27447
+ evalRunId: z37.string().min(1),
27448
+ idempotencyKey: z37.string().min(1),
27449
+ workflowId: z37.string().min(1),
27450
+ workflowRunId: z37.string().min(1)
27275
27451
  }).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"])
27452
+ var exportResultSchema = z37.object({
27453
+ downloadUrl: z37.string().min(1).nullable().optional(),
27454
+ evalRunId: z37.string().min(1),
27455
+ exportId: z37.string().min(1),
27456
+ status: z37.enum(["QUEUED", "RUNNING", "COMPLETE", "FAILED"])
27281
27457
  }).passthrough();
27282
- var inputOptionsSchema = z36.object({
27283
- inputFile: z36.string().min(1).optional(),
27284
- inputJson: z36.unknown().optional()
27458
+ var inputOptionsSchema = z37.object({
27459
+ inputFile: z37.string().min(1).optional(),
27460
+ inputJson: z37.unknown().optional()
27285
27461
  });
27286
27462
  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()
27463
+ description: z37.string().min(1).optional(),
27464
+ maxConcurrency: z37.number().int().positive().optional(),
27465
+ name: z37.string().min(1).optional(),
27466
+ repeatCount: z37.number().int().positive().optional(),
27467
+ slug: z37.string().min(1),
27468
+ tags: z37.array(z37.string().min(1)).optional()
27293
27469
  });
27294
27470
  function parseApiResult(value, schema, label) {
27295
27471
  const parsedResult = schema.safeParse(value);
@@ -27302,8 +27478,8 @@ async function parseInputFile({
27302
27478
  inputFile,
27303
27479
  workingDirectory
27304
27480
  }) {
27305
- const inputPath = path8.resolve(workingDirectory, inputFile);
27306
- const contents = await readFile3(inputPath, "utf8").catch(
27481
+ const inputPath = path9.resolve(workingDirectory, inputFile);
27482
+ const contents = await readFile4(inputPath, "utf8").catch(
27307
27483
  (error) => {
27308
27484
  throw new CliError(`Failed to read eval input file "${inputPath}".`, {
27309
27485
  cause: error
@@ -27331,7 +27507,7 @@ async function resolveEvalInput({
27331
27507
  );
27332
27508
  }
27333
27509
  const input = inputFile === void 0 ? inputJson : await parseInputFile({ inputFile, workingDirectory });
27334
- const parsedInput = z36.record(z36.string(), z36.unknown()).safeParse(input);
27510
+ const parsedInput = z37.record(z37.string(), z37.unknown()).safeParse(input);
27335
27511
  if (!parsedInput.success) {
27336
27512
  throw new CliError("Eval input must be a JSON object.");
27337
27513
  }
@@ -27368,7 +27544,7 @@ function parseDurationMs(value) {
27368
27544
  );
27369
27545
  const amount = Number(match?.groups?.["amount"]);
27370
27546
  const multiplierByUnit = { h: 36e5, m: 6e4, ms: 1, s: 1e3 };
27371
- const parsedUnit = z36.enum(["h", "m", "ms", "s"]).safeParse(match?.groups?.["unit"]?.toLowerCase());
27547
+ const parsedUnit = z37.enum(["h", "m", "ms", "s"]).safeParse(match?.groups?.["unit"]?.toLowerCase());
27372
27548
  const durationMs = parsedUnit.success ? amount * multiplierByUnit[parsedUnit.data] : Number.NaN;
27373
27549
  if (!Number.isSafeInteger(durationMs) || durationMs < MIN_AWAIT_REQUEST_MS) {
27374
27550
  throw new CliError(
@@ -27577,10 +27753,10 @@ async function executeStartRegisteredEvalRun({
27577
27753
  workingDirectory
27578
27754
  }) {
27579
27755
  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()
27756
+ confirmTrials: z37.number().int().positive().optional(),
27757
+ idempotencyKey: z37.string().trim().min(1).optional(),
27758
+ json: z37.boolean().optional(),
27759
+ wait: z37.boolean().optional()
27584
27760
  }).parse(options);
27585
27761
  const input = await resolveEvalInputFromOptions({
27586
27762
  ...parsedOptions,
@@ -27640,7 +27816,7 @@ async function executeAwaitEvalRun({
27640
27816
  options,
27641
27817
  runtime
27642
27818
  }) {
27643
- const parsedOptions = z36.object({ id: z36.string().min(1), timeout: z36.string().optional() }).parse(options);
27819
+ const parsedOptions = z37.object({ id: z37.string().min(1), timeout: z37.string().optional() }).parse(options);
27644
27820
  return await awaitEvalRun({
27645
27821
  evalRunId: parsedOptions.id,
27646
27822
  executeOperation,
@@ -27659,13 +27835,13 @@ async function executeRequestEvalRunExport({
27659
27835
  runtime,
27660
27836
  workingDirectory
27661
27837
  }) {
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()
27838
+ const parsedOptions = z37.object({
27839
+ force: z37.boolean().optional(),
27840
+ id: z37.string().min(1),
27841
+ output: z37.string().min(1),
27842
+ wait: z37.boolean().optional()
27667
27843
  }).parse(options);
27668
- const outputPath = path8.resolve(workingDirectory, parsedOptions.output);
27844
+ const outputPath = path9.resolve(workingDirectory, parsedOptions.output);
27669
27845
  const force = parsedOptions.force === true;
27670
27846
  const shouldWait = parsedOptions.wait === true;
27671
27847
  if (shouldWait) {
@@ -27731,28 +27907,28 @@ async function executeEvalCliOperation({
27731
27907
  // src/file-upload-commands.ts
27732
27908
  import { createReadStream as createReadStream2 } from "node:fs";
27733
27909
  import { stat as stat2 } from "node:fs/promises";
27734
- import path9 from "node:path";
27910
+ import path10 from "node:path";
27735
27911
  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)
27912
+ import { z as z38 } from "zod";
27913
+ var fileUploadIntentSchema = z38.object({
27914
+ file: z38.object({
27915
+ checksum: z38.object({
27916
+ algorithm: z38.literal("CRC32"),
27917
+ value: z38.string().min(1)
27742
27918
  }),
27743
- key: z37.string().startsWith("s3://"),
27744
- mimeType: z37.string().min(1),
27745
- name: z37.string().min(1),
27746
- sizeBytes: z37.number().int().nonnegative()
27919
+ key: z38.string().startsWith("s3://"),
27920
+ mimeType: z38.string().min(1),
27921
+ name: z38.string().min(1),
27922
+ sizeBytes: z38.number().int().nonnegative()
27747
27923
  }),
27748
- upload: z37.object({
27749
- headers: z37.record(z37.string(), z37.string()),
27750
- method: z37.literal("PUT"),
27751
- url: z37.url()
27924
+ upload: z38.object({
27925
+ headers: z38.record(z38.string(), z38.string()),
27926
+ method: z38.literal("PUT"),
27927
+ url: z38.url()
27752
27928
  })
27753
27929
  });
27754
27930
  async function prepareFileUpload(inputPath, workingDirectory) {
27755
- const filePath = path9.resolve(workingDirectory, inputPath);
27931
+ const filePath = path10.resolve(workingDirectory, inputPath);
27756
27932
  const fileStats = await stat2(filePath).catch((error) => {
27757
27933
  throw new CliError(`Failed to inspect upload file "${filePath}".`, {
27758
27934
  cause: error
@@ -27791,7 +27967,7 @@ async function prepareFileUpload(inputPath, workingDirectory) {
27791
27967
  variables: {
27792
27968
  checksum: encodeS3Crc32Checksum(checksum),
27793
27969
  mimeType: mimeTypes.lookup(filePath) || "application/octet-stream",
27794
- name: path9.basename(filePath),
27970
+ name: path10.basename(filePath),
27795
27971
  sizeBytes: fileStats.size
27796
27972
  }
27797
27973
  };
@@ -27837,20 +28013,20 @@ async function handleFileUploadCliOperation(apiClient, intent, prepared) {
27837
28013
  }
27838
28014
 
27839
28015
  // src/iteration-media-commands.ts
27840
- import path12 from "node:path";
27841
- import { z as z40 } from "zod";
28016
+ import path13 from "node:path";
28017
+ import { z as z41 } from "zod";
27842
28018
 
27843
28019
  // 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([
28020
+ import path11 from "node:path";
28021
+ import { z as z39 } from "zod";
28022
+ var fileAssetAccessSchema = z39.object({
28023
+ status: z39.enum([
27848
28024
  "AVAILABLE",
27849
28025
  "INVALID_KEY",
27850
28026
  "NOT_FOUND",
27851
28027
  "URL_UNAVAILABLE"
27852
28028
  ]),
27853
- url: z38.string().url().nullable()
28029
+ url: z39.string().url().nullable()
27854
28030
  }).superRefine((value, ctx) => {
27855
28031
  if (value.status === "AVAILABLE" && value.url === null) {
27856
28032
  ctx.addIssue({
@@ -27860,13 +28036,13 @@ var fileAssetAccessSchema = z38.object({
27860
28036
  });
27861
28037
  }
27862
28038
  });
27863
- var fileCommandOptionsSchema = z38.object({
27864
- download: z38.string().min(1).optional(),
27865
- force: z38.boolean().optional(),
27866
- key: z38.string().min(1)
28039
+ var fileCommandOptionsSchema = z39.object({
28040
+ download: z39.string().min(1).optional(),
28041
+ force: z39.boolean().optional(),
28042
+ key: z39.string().min(1)
27867
28043
  });
27868
28044
  function sanitizeDownloadFileName(fileName, fallback = "magical-file.bin") {
27869
- const sanitizedFileName = path10.basename(fileName).replaceAll(/[^\p{L}\p{N}._-]/gu, "_").slice(0, 160);
28045
+ const sanitizedFileName = path11.basename(fileName).replaceAll(/[^\p{L}\p{N}._-]/gu, "_").slice(0, 160);
27870
28046
  return sanitizedFileName && sanitizedFileName !== "." && sanitizedFileName !== ".." ? sanitizedFileName : fallback;
27871
28047
  }
27872
28048
  function getSafeFileName(fileKey) {
@@ -27888,7 +28064,7 @@ async function downloadFileToLocalPath({
27888
28064
  "File download is not configured for this CLI instance."
27889
28065
  );
27890
28066
  }
27891
- const outputPath = path10.resolve(
28067
+ const outputPath = path11.resolve(
27892
28068
  runtime.workingDirectory,
27893
28069
  destination ?? sanitizeDownloadFileName(fallbackFileName)
27894
28070
  );
@@ -27934,19 +28110,19 @@ async function handleFileCliOperation({
27934
28110
  }
27935
28111
 
27936
28112
  // src/repository-file-commands.ts
27937
- import path11 from "node:path";
27938
- import { z as z39 } from "zod";
28113
+ import path12 from "node:path";
28114
+ import { z as z40 } from "zod";
27939
28115
  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)
28116
+ var repositoryFileOptionsSchema = z40.object({
28117
+ download: z40.string().min(1),
28118
+ force: z40.boolean().optional(),
28119
+ key: z40.string().min(1)
27944
28120
  });
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()
28121
+ var repositoryFileAccessSchema = z40.object({
28122
+ commit: z40.string().regex(/^[\da-f]{40}$/u).nullable(),
28123
+ path: z40.string().min(1).nullable(),
28124
+ status: z40.enum(["AVAILABLE", "INVALID_KEY", "NOT_FOUND", "UNAVAILABLE"]),
28125
+ url: z40.url().nullable()
27950
28126
  }).superRefine((value, ctx) => {
27951
28127
  if (value.status === "AVAILABLE" && (value.url === null || value.path === null || value.commit === null)) {
27952
28128
  ctx.addIssue({
@@ -27983,7 +28159,7 @@ async function handleRepositoryFileCliOperation({
27983
28159
  }
27984
28160
  const outputPath = await downloadFileToLocalPath({
27985
28161
  destination: parsedOptions.download,
27986
- fallbackFileName: path11.basename(repositoryPath),
28162
+ fallbackFileName: path12.basename(repositoryPath),
27987
28163
  force: parsedOptions.force === true,
27988
28164
  runtime,
27989
28165
  url
@@ -27998,14 +28174,14 @@ async function handleRepositoryFileCliOperation({
27998
28174
  }
27999
28175
 
28000
28176
  // 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()
28177
+ var iterationMediaOptionsSchema = z41.object({
28178
+ download: z41.string().min(1),
28179
+ force: z41.boolean().optional(),
28180
+ iterationId: z41.uuid(),
28181
+ mediaId: z41.uuid()
28006
28182
  });
28007
- var iterationMediaAccessSchema = z40.object({
28008
- downloadPath: z40.string().min(1)
28183
+ var iterationMediaAccessSchema = z41.object({
28184
+ downloadPath: z41.string().min(1)
28009
28185
  });
28010
28186
  async function handleIterationMediaCliOperation({
28011
28187
  accessToken,
@@ -28036,7 +28212,7 @@ async function handleIterationMediaCliOperation({
28036
28212
  "Authenticated file download is not configured for this CLI instance."
28037
28213
  );
28038
28214
  }
28039
- const outputPath = path12.resolve(workingDirectory, parsedOptions.download);
28215
+ const outputPath = path13.resolve(workingDirectory, parsedOptions.download);
28040
28216
  const downloadResult = await fromThrowable(async () => {
28041
28217
  await downloadAuthenticatedFile({
28042
28218
  accessToken,
@@ -28150,16 +28326,16 @@ import { randomUUID as randomUUID5 } from "node:crypto";
28150
28326
  import { createReadStream as createReadStream3, createWriteStream as createWriteStream2 } from "node:fs";
28151
28327
  import { link as link3, mkdir as mkdir3, mkdtemp, rm as rm3 } from "node:fs/promises";
28152
28328
  import os2 from "node:os";
28153
- import path14 from "node:path";
28329
+ import path15 from "node:path";
28154
28330
  import { pipeline as pipeline2 } from "node:stream/promises";
28155
28331
  import { Command as Command3, InvalidArgumentError, Option as Option3 } from "commander";
28156
28332
 
28157
28333
  // src/network-recording-parser.ts
28158
28334
  import { spawn } from "node:child_process";
28159
28335
  import { existsSync } from "node:fs";
28160
- import path13 from "node:path";
28336
+ import path14 from "node:path";
28161
28337
  import { fileURLToPath as fileURLToPath2 } from "node:url";
28162
- import { z as z41 } from "zod";
28338
+ import { z as z42 } from "zod";
28163
28339
  var NETWORK_RECORDING_ARCHIVE_MAX_BYTES = 256 * 1024 * 1024;
28164
28340
  var NETWORK_RECORDING_MAX_FLOWS = 2e4;
28165
28341
  var NETWORK_RECORDING_MAX_ENCODED_BODY_BYTES = 32 * 1024 * 1024;
@@ -28171,57 +28347,57 @@ var DEFAULT_MAX_EXCHANGES = 100;
28171
28347
  var MAX_EXCHANGES = 1e3;
28172
28348
  var MAX_HELPER_OUTPUT_BYTES = 1024 * 1024;
28173
28349
  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(),
28350
+ var archiveIdentitySchema = z42.object({
28351
+ sha256: z42.string().regex(/^[0-9a-f]{64}$/u),
28352
+ sizeBytes: z42.number().int().nonnegative()
28353
+ });
28354
+ var bodyMetadataSchema = z42.object({
28355
+ state: z42.enum(["PRESENT", "EMPTY", "MISSING"]),
28356
+ encodedSizeBytes: z42.number().int().nonnegative().nullable()
28357
+ });
28358
+ var exchangeSchema = z42.object({
28359
+ exchange: z42.string().regex(/^mitm-v1:[0-9a-f]{64}:[0-9]+$/u),
28360
+ index: z42.number().int().nonnegative(),
28361
+ method: z42.string().min(1),
28362
+ origin: z42.string().min(1),
28363
+ timestamp: z42.string().nullable(),
28364
+ response: z42.object({
28365
+ status: z42.number().int(),
28366
+ contentType: z42.string().nullable(),
28191
28367
  body: bodyMetadataSchema
28192
28368
  }).nullable()
28193
28369
  });
28194
- var inspectionResultSchema = z41.object({
28370
+ var inspectionResultSchema = z42.object({
28195
28371
  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()
28372
+ exchanges: z42.array(exchangeSchema),
28373
+ scan: z42.object({
28374
+ scannedFlowCount: z42.number().int().nonnegative(),
28375
+ returnedExchangeCount: z42.number().int().nonnegative(),
28376
+ complete: z42.boolean(),
28377
+ resultLimit: z42.number().int().positive(),
28378
+ flowLimit: z42.number().int().positive(),
28379
+ truncationReason: z42.enum(["RESULT_LIMIT", "FLOW_LIMIT"]).nullable()
28204
28380
  })
28205
28381
  });
28206
- var extractionResultSchema = z41.object({
28382
+ var extractionResultSchema = z42.object({
28207
28383
  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)
28384
+ exchange: z42.string().regex(/^mitm-v1:[0-9a-f]{64}:[0-9]+$/u),
28385
+ index: z42.number().int().nonnegative(),
28386
+ response: z42.object({
28387
+ contentType: z42.string().nullable(),
28388
+ sourceContentEncoding: z42.string().nullable(),
28389
+ representation: z42.literal("decoded-entity-body"),
28390
+ encodedSizeBytes: z42.number().int().nonnegative(),
28391
+ sizeBytes: z42.number().int().nonnegative(),
28392
+ sha256: z42.string().regex(/^[0-9a-f]{64}$/u)
28217
28393
  }),
28218
- outputPath: z41.string().min(1)
28394
+ outputPath: z42.string().min(1)
28219
28395
  });
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) })
28396
+ var helperResponseSchema = z42.union([
28397
+ z42.object({ ok: z42.literal(true), result: z42.unknown() }),
28398
+ z42.object({
28399
+ ok: z42.literal(false),
28400
+ error: z42.object({ code: z42.string().min(1), message: z42.string().min(1) })
28225
28401
  })
28226
28402
  ]);
28227
28403
  var NetworkRecordingParserError = class extends CliError {
@@ -28233,12 +28409,12 @@ var NetworkRecordingParserError = class extends CliError {
28233
28409
  }
28234
28410
  };
28235
28411
  function helperPath() {
28236
- const moduleDirectory = path13.dirname(fileURLToPath2(import.meta.url));
28237
- const bundledPath = path13.resolve(
28412
+ const moduleDirectory = path14.dirname(fileURLToPath2(import.meta.url));
28413
+ const bundledPath = path14.resolve(
28238
28414
  moduleDirectory,
28239
28415
  "network-recording-archive.py"
28240
28416
  );
28241
- return existsSync(bundledPath) ? bundledPath : path13.resolve(moduleDirectory, "../scripts/network-recording-archive.py");
28417
+ return existsSync(bundledPath) ? bundledPath : path14.resolve(moduleDirectory, "../scripts/network-recording-archive.py");
28242
28418
  }
28243
28419
  function pythonCandidates() {
28244
28420
  const configuredPython = getRuntimeEnvironment()[PYTHON_ENVIRONMENT_VARIABLE];
@@ -28552,11 +28728,11 @@ async function installPrivateOutput({
28552
28728
  destination,
28553
28729
  source
28554
28730
  }) {
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`
28731
+ const outputPath = path15.resolve(destination);
28732
+ await mkdir3(path15.dirname(outputPath), { recursive: true });
28733
+ const temporaryPath = path15.join(
28734
+ path15.dirname(outputPath),
28735
+ `.${path15.basename(outputPath)}.${randomUUID5()}.tmp`
28560
28736
  );
28561
28737
  await pipeline2(
28562
28738
  createReadStream3(source),
@@ -28586,9 +28762,9 @@ async function withPrivateArchive({
28586
28762
  recording
28587
28763
  }) {
28588
28764
  const temporaryDirectory = await mkdtemp(
28589
- path14.join(os2.tmpdir(), "mgcl-network-recording-")
28765
+ path15.join(os2.tmpdir(), "mgcl-network-recording-")
28590
28766
  );
28591
- const archivePath = path14.join(temporaryDirectory, "recording.mitm");
28767
+ const archivePath = path15.join(temporaryDirectory, "recording.mitm");
28592
28768
  try {
28593
28769
  await downloadRecording({
28594
28770
  dependencies,
@@ -28636,7 +28812,7 @@ function addNetworkRecordingCommands({
28636
28812
  });
28637
28813
  const result = getSafeMetadata(recording.metadata);
28638
28814
  if (options.output) {
28639
- const outputPath = path14.resolve(
28815
+ const outputPath = path15.resolve(
28640
28816
  dependencies.workingDirectory ?? process.cwd(),
28641
28817
  options.output
28642
28818
  );
@@ -28717,11 +28893,11 @@ function addNetworkRecordingCommands({
28717
28893
  {
28718
28894
  archivePath,
28719
28895
  exchange: options.exchange,
28720
- outputPath: path14.join(temporaryDirectory, "response-body")
28896
+ outputPath: path15.join(temporaryDirectory, "response-body")
28721
28897
  }
28722
28898
  );
28723
28899
  const outputPath = await installPrivateOutput({
28724
- destination: path14.resolve(
28900
+ destination: path15.resolve(
28725
28901
  dependencies.workingDirectory ?? process.cwd(),
28726
28902
  options.output
28727
28903
  ),
@@ -28803,8 +28979,8 @@ var SESSION_ONLY_API_KEY_MANAGEMENT_COMMANDS = /* @__PURE__ */ new Set([
28803
28979
  import { setTimeout as sleep } from "node:timers/promises";
28804
28980
  import { Command as Command4, Option as Option4 } from "commander";
28805
28981
  var REGRESSION_TEST_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
28806
- "passed",
28807
- "failed",
28982
+ "matched",
28983
+ "deviated",
28808
28984
  "inconclusive",
28809
28985
  "errored"
28810
28986
  ]);
@@ -28850,11 +29026,11 @@ function summarizeRegressionTestPathway(result) {
28850
29026
  baselineAgentRunId: run.baselineAgentRunId,
28851
29027
  replayCounts: run.replayCounts,
28852
29028
  baselineIterationCount: run.baselineIterations.length,
28853
- failedIterations: run.failedIterations.map((fi) => ({
28854
- baselineIterationId: fi.baselineIterationId,
28855
- failedToolCalls: fi.failedToolCalls.map((ftc) => ({
28856
- observedToolCall: ftc.observedToolCall,
28857
- count: ftc.count
29029
+ deviatedIterations: run.deviatedIterations.map((iteration) => ({
29030
+ baselineIterationId: iteration.baselineIterationId,
29031
+ deviatedToolCalls: iteration.deviatedToolCalls.map((toolCall) => ({
29032
+ observedToolCall: toolCall.observedToolCall,
29033
+ count: toolCall.count
28858
29034
  }))
28859
29035
  }))
28860
29036
  }))
@@ -29065,29 +29241,29 @@ ${formatExamples("Examples", [
29065
29241
 
29066
29242
  // src/run-evidence-commands.ts
29067
29243
  import { Option as Option5 } from "commander";
29068
- import { z as z42 } from "zod";
29244
+ import { z as z43 } from "zod";
29069
29245
  var ITERATION_PAGE_SIZE = 100;
29070
29246
  var MAX_SCANNED_ITERATIONS = 1e4;
29071
- var automationRunSchema = z42.object({
29072
- id: z42.string().min(1),
29073
- input: z42.unknown().nullable()
29247
+ var automationRunSchema = z43.object({
29248
+ id: z43.string().min(1),
29249
+ input: z43.unknown().nullable()
29074
29250
  }).passthrough();
29075
- var agentRunSchema = z42.object({
29076
- id: z42.string().min(1),
29077
- input: z42.unknown().nullable(),
29078
- parentAgentRunId: z42.string().nullable()
29251
+ var agentRunSchema = z43.object({
29252
+ id: z43.string().min(1),
29253
+ input: z43.unknown().nullable(),
29254
+ parentAgentRunId: z43.string().nullable()
29079
29255
  }).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()
29256
+ var memorySchema = z43.object({
29257
+ id: z43.string().min(1),
29258
+ sequence: z43.number().int(),
29259
+ type: z43.string(),
29260
+ value: z43.unknown()
29085
29261
  }).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()
29262
+ var iterationSchema = z43.object({
29263
+ agentRunId: z43.string().min(1),
29264
+ id: z43.string().min(1),
29265
+ memories: z43.array(memorySchema),
29266
+ sequence: z43.number().int()
29091
29267
  }).passthrough();
29092
29268
  var latestIterationSchema = iterationSchema.nullable();
29093
29269
  var GET_AUTOMATION_RUN_FILE_INPUT_DOCUMENT = `
@@ -29242,21 +29418,21 @@ function collectIterationOccurrences(iteration) {
29242
29418
  function formatRunFiles(result) {
29243
29419
  const parsed = parseOperationResult(
29244
29420
  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()
29421
+ z43.object({
29422
+ automationRunId: z43.string(),
29423
+ files: z43.array(
29424
+ z43.object({
29425
+ agentRunId: z43.string().nullable(),
29426
+ fieldPath: z43.string(),
29427
+ iterationId: z43.string().nullable(),
29428
+ key: z43.string(),
29429
+ role: z43.string(),
29430
+ source: z43.string(),
29431
+ toolName: z43.string().nullable()
29256
29432
  })
29257
29433
  ),
29258
- scannedIterationCount: z42.number(),
29259
- truncated: z42.boolean()
29434
+ scannedIterationCount: z43.number(),
29435
+ truncated: z43.boolean()
29260
29436
  }),
29261
29437
  "Run file inventory"
29262
29438
  );
@@ -29281,9 +29457,9 @@ function formatRunFiles(result) {
29281
29457
  function formatAgentRunOutput(result) {
29282
29458
  const parsed = parseOperationResult(
29283
29459
  result,
29284
- z42.object({
29285
- output: z42.unknown(),
29286
- status: z42.enum(["AVAILABLE", "NOT_FOUND"])
29460
+ z43.object({
29461
+ output: z43.unknown(),
29462
+ status: z43.enum(["AVAILABLE", "NOT_FOUND"])
29287
29463
  }),
29288
29464
  "Agent run output"
29289
29465
  );
@@ -29342,7 +29518,7 @@ async function handleAutomationRunFiles({
29342
29518
  );
29343
29519
  const agentRuns = parseOperationResult(
29344
29520
  agentRunsResult,
29345
- z42.array(agentRunSchema),
29521
+ z43.array(agentRunSchema),
29346
29522
  "Automation run agent runs"
29347
29523
  );
29348
29524
  const iterations = [];
@@ -29361,7 +29537,7 @@ async function handleAutomationRunFiles({
29361
29537
  });
29362
29538
  const parsedPage = parseOperationResult(
29363
29539
  pageResult,
29364
- z42.array(iterationSchema),
29540
+ z43.array(iterationSchema),
29365
29541
  "Automation run iterations"
29366
29542
  );
29367
29543
  iterations.push(...parsedPage);
@@ -29382,7 +29558,7 @@ async function handleAutomationRunFiles({
29382
29558
  });
29383
29559
  truncated = parseOperationResult(
29384
29560
  peekResult,
29385
- z42.array(iterationSchema),
29561
+ z43.array(iterationSchema),
29386
29562
  "Automation run iterations"
29387
29563
  ).length > 0;
29388
29564
  }
@@ -29515,7 +29691,7 @@ function addRunEvidenceCommands({
29515
29691
  // src/self-update.ts
29516
29692
  import { spawn as spawn3 } from "node:child_process";
29517
29693
  import fs2 from "node:fs";
29518
- import path15 from "node:path";
29694
+ import path16 from "node:path";
29519
29695
  import { fileURLToPath as fileURLToPath3 } from "node:url";
29520
29696
  var CLI_PACKAGE_NAME = "@getmagical/cli";
29521
29697
  var DEFAULT_CLI_DIST_TAG2 = "latest";
@@ -29526,9 +29702,9 @@ function resolveInstalledPackageRoot({
29526
29702
  packageName
29527
29703
  }) {
29528
29704
  const packagePathSegments = packageName.split("/");
29529
- let currentPath = path15.dirname(entryFilePath);
29705
+ let currentPath = path16.dirname(entryFilePath);
29530
29706
  for (; ; ) {
29531
- const currentPathSegments = currentPath.split(path15.sep).filter(Boolean);
29707
+ const currentPathSegments = currentPath.split(path16.sep).filter(Boolean);
29532
29708
  const currentPackageSegments = currentPathSegments.slice(
29533
29709
  -packagePathSegments.length
29534
29710
  );
@@ -29537,7 +29713,7 @@ function resolveInstalledPackageRoot({
29537
29713
  )) {
29538
29714
  return currentPath;
29539
29715
  }
29540
- const parentPath = path15.dirname(currentPath);
29716
+ const parentPath = path16.dirname(currentPath);
29541
29717
  if (parentPath === currentPath) {
29542
29718
  return null;
29543
29719
  }
@@ -29547,14 +29723,14 @@ function resolveInstalledPackageRoot({
29547
29723
  function resolveInstallPrefixFromPackageRoot(packageRootPath) {
29548
29724
  let currentPath = packageRootPath;
29549
29725
  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);
29726
+ if (path16.basename(currentPath) === "node_modules") {
29727
+ const nodeModulesParentPath = path16.dirname(currentPath);
29728
+ if (path16.basename(nodeModulesParentPath) === "lib") {
29729
+ return path16.dirname(nodeModulesParentPath);
29554
29730
  }
29555
29731
  return nodeModulesParentPath;
29556
29732
  }
29557
- const parentPath = path15.dirname(currentPath);
29733
+ const parentPath = path16.dirname(currentPath);
29558
29734
  if (parentPath === currentPath) {
29559
29735
  return null;
29560
29736
  }
@@ -29571,13 +29747,13 @@ function resolveManagedNpmCommand(installPrefix) {
29571
29747
  if (process.platform === "win32") {
29572
29748
  return null;
29573
29749
  }
29574
- const managedNodeExecutable = path15.join(
29750
+ const managedNodeExecutable = path16.join(
29575
29751
  installPrefix,
29576
29752
  MANAGED_NODE_SUBPATH,
29577
29753
  "bin",
29578
29754
  "node"
29579
29755
  );
29580
- const managedNpmCli = path15.join(
29756
+ const managedNpmCli = path16.join(
29581
29757
  installPrefix,
29582
29758
  MANAGED_NODE_SUBPATH,
29583
29759
  "lib",
@@ -29676,15 +29852,15 @@ async function selfUpdateInstalledCli({
29676
29852
  }
29677
29853
 
29678
29854
  // 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()
29855
+ import { mkdir as mkdir4, readFile as readFile5, rm as rm4, writeFile as writeFile2 } from "node:fs/promises";
29856
+ import path17 from "node:path";
29857
+ import { z as z44 } from "zod";
29858
+ var cliSettingsSchema = z44.object({
29859
+ env: z44.object({
29860
+ baseUrl: z44.url().optional(),
29861
+ domain: z44.url().optional(),
29862
+ env: z44.enum(["us", "uk", "stg"]).optional(),
29863
+ workosEnv: z44.string().min(1).optional()
29688
29864
  }).default({})
29689
29865
  });
29690
29866
  function createEmptyCliSettings() {
@@ -29696,13 +29872,13 @@ function hasCliSettingsOverrides(settings) {
29696
29872
  return Object.values(settings.env).some((value) => value !== void 0);
29697
29873
  }
29698
29874
  function resolveSettingsFilePath(stateFilePath) {
29699
- return path16.join(path16.dirname(stateFilePath), CLI_SETTINGS_FILE_NAME);
29875
+ return path17.join(path17.dirname(stateFilePath), CLI_SETTINGS_FILE_NAME);
29700
29876
  }
29701
29877
  function createFileSettingsStore(stateFilePath) {
29702
29878
  const settingsFilePath = resolveSettingsFilePath(stateFilePath);
29703
29879
  return {
29704
29880
  async load() {
29705
- const fileContents = await readFile4(settingsFilePath, "utf8").catch(
29881
+ const fileContents = await readFile5(settingsFilePath, "utf8").catch(
29706
29882
  (error) => {
29707
29883
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
29708
29884
  return null;
@@ -29732,7 +29908,7 @@ function createFileSettingsStore(stateFilePath) {
29732
29908
  await rm4(settingsFilePath, { force: true });
29733
29909
  return;
29734
29910
  }
29735
- await mkdir4(path16.dirname(settingsFilePath), { recursive: true });
29911
+ await mkdir4(path17.dirname(settingsFilePath), { recursive: true });
29736
29912
  await writeFile2(
29737
29913
  settingsFilePath,
29738
29914
  `${JSON.stringify(settings, null, 2)}
@@ -29900,15 +30076,15 @@ import {
29900
30076
  lstat as lstat2,
29901
30077
  mkdir as mkdir5,
29902
30078
  mkdtemp as mkdtemp2,
29903
- readFile as readFile5,
30079
+ readFile as readFile6,
29904
30080
  readdir,
29905
30081
  rename as rename4,
29906
30082
  rm as rm5,
29907
30083
  writeFile as writeFile3
29908
30084
  } from "node:fs/promises";
29909
30085
  import os3 from "node:os";
29910
- import path17 from "node:path";
29911
- import { z as z44 } from "zod";
30086
+ import path18 from "node:path";
30087
+ import { z as z45 } from "zod";
29912
30088
  var SKILLS_ROOT_PATH = "skills";
29913
30089
  var METADATA_DIRECTORY_NAME = "skill-working-copies";
29914
30090
  var MAX_GIT_OUTPUT_BYTES = 10 * 1024 * 1024;
@@ -29917,40 +30093,40 @@ var FULL_COMMIT_SHA_PATTERN = /^[\dA-Fa-f]{40}$/u;
29917
30093
  var UTF8_ENCODER = new TextEncoder();
29918
30094
  var WINDOWS_RESERVED_PATH_CHARACTER_PATTERN = /[<>:"|?*]/u;
29919
30095
  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()
30096
+ var skillBundleSchema = z45.object({
30097
+ files: z45.array(
30098
+ z45.object({
30099
+ content: z45.string(),
30100
+ encoding: z45.literal("base64"),
30101
+ path: z45.string().min(1),
30102
+ size: z45.number().int().nonnegative()
29927
30103
  })
29928
30104
  ),
29929
- path: z44.string().min(1),
29930
- ref: z44.string().regex(FULL_COMMIT_SHA_PATTERN)
30105
+ path: z45.string().min(1),
30106
+ ref: z45.string().regex(FULL_COMMIT_SHA_PATTERN)
29931
30107
  });
29932
- var skillsApplyPatchResultSchema = z44.object({
29933
- changedFiles: z44.array(
29934
- z44.object({ path: z44.string().min(1), status: z44.string().min(1) })
30108
+ var skillsApplyPatchResultSchema = z45.object({
30109
+ changedFiles: z45.array(
30110
+ z45.object({ path: z45.string().min(1), status: z45.string().min(1) })
29935
30111
  ),
29936
- commit: z44.string().regex(FULL_COMMIT_SHA_PATTERN),
29937
- ok: z44.boolean(),
29938
- ref: z44.string().min(1)
30112
+ commit: z45.string().regex(FULL_COMMIT_SHA_PATTERN),
30113
+ ok: z45.boolean(),
30114
+ ref: z45.string().min(1)
29939
30115
  }).refine((result) => result.ok, {
29940
30116
  message: "Skills patch result was not successful."
29941
30117
  });
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)
30118
+ var workingCopyMetadataSchema = z45.object({
30119
+ version: z45.literal(1),
30120
+ files: z45.array(
30121
+ z45.object({
30122
+ content: z45.string(),
30123
+ path: z45.string().min(1)
29948
30124
  })
29949
30125
  ),
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)
30126
+ organizationId: z45.string().min(1),
30127
+ requestedRef: z45.string().min(1).nullable(),
30128
+ skillPath: z45.string().min(1),
30129
+ workingCopyPath: z45.string().min(1)
29954
30130
  });
29955
30131
  function hasControlCharacter2(value) {
29956
30132
  return UTF8_ENCODER.encode(value).some((byte) => byte <= 31 || byte === 127);
@@ -29978,12 +30154,12 @@ function normalizeRootSkillPath(skill) {
29978
30154
  return `${SKILLS_ROOT_PATH}/${skillName}`;
29979
30155
  }
29980
30156
  function resolveWorkingCopyPath(workingDirectory, skillPath) {
29981
- return path17.resolve(workingDirectory, ...skillPath.split("/"));
30157
+ return path18.resolve(workingDirectory, ...skillPath.split("/"));
29982
30158
  }
29983
30159
  function resolveMetadataPath(stateFilePath, workingCopyPath) {
29984
30160
  const key = createHash3("sha256").update(workingCopyPath).digest("hex");
29985
- return path17.join(
29986
- path17.dirname(stateFilePath),
30161
+ return path18.join(
30162
+ path18.dirname(stateFilePath),
29987
30163
  METADATA_DIRECTORY_NAME,
29988
30164
  `${key}.json`
29989
30165
  );
@@ -30011,7 +30187,7 @@ function metadataFilesToSnapshot(files) {
30011
30187
  );
30012
30188
  }
30013
30189
  async function loadMetadata(metadataPath) {
30014
- const fileContents = await readFile5(metadataPath, "utf8").catch(
30190
+ const fileContents = await readFile6(metadataPath, "utf8").catch(
30015
30191
  (error) => {
30016
30192
  if (isMissingFileError3(error)) {
30017
30193
  return null;
@@ -30035,7 +30211,7 @@ async function loadMetadata(metadataPath) {
30035
30211
  return parsed.data;
30036
30212
  }
30037
30213
  async function saveMetadata(metadataPath, metadata) {
30038
- await mkdir5(path17.dirname(metadataPath), { recursive: true });
30214
+ await mkdir5(path18.dirname(metadataPath), { recursive: true });
30039
30215
  const temporaryPath = `${metadataPath}.${randomUUID6()}.tmp`;
30040
30216
  await writeFile3(temporaryPath, `${JSON.stringify(metadata, null, 2)}
30041
30217
  `, {
@@ -30112,7 +30288,7 @@ async function readDirectorySnapshot({
30112
30288
  const nextSegments = [...segments, entry.name];
30113
30289
  const relativePath = nextSegments.join("/");
30114
30290
  assertSafeRelativeFilePath(relativePath);
30115
- const filePath = path17.join(currentDirectory, entry.name);
30291
+ const filePath = path18.join(currentDirectory, entry.name);
30116
30292
  if (entry.isDirectory()) {
30117
30293
  return await visit(filePath, nextSegments);
30118
30294
  }
@@ -30121,7 +30297,7 @@ async function readDirectorySnapshot({
30121
30297
  `Skill working copy contains unsupported entry "${filePath}". Only regular files and directories are allowed.`
30122
30298
  );
30123
30299
  }
30124
- return [[`${skillPath}/${relativePath}`, await readFile5(filePath)]];
30300
+ return [[`${skillPath}/${relativePath}`, await readFile6(filePath)]];
30125
30301
  })
30126
30302
  );
30127
30303
  return nestedEntries.flat();
@@ -30147,8 +30323,8 @@ async function writeSnapshotContents(rootPath, snapshot, prefix) {
30147
30323
  [...snapshot.entries()].map(async ([filePath, content]) => {
30148
30324
  const relativePath = prefix === null ? filePath : filePath.slice(`${prefix}/`.length);
30149
30325
  assertSafeRelativeFilePath(relativePath);
30150
- const targetPath = path17.join(rootPath, ...relativePath.split("/"));
30151
- await mkdir5(path17.dirname(targetPath), { recursive: true });
30326
+ const targetPath = path18.join(rootPath, ...relativePath.split("/"));
30327
+ await mkdir5(path18.dirname(targetPath), { recursive: true });
30152
30328
  await writeFile3(targetPath, content);
30153
30329
  })
30154
30330
  );
@@ -30158,11 +30334,11 @@ async function replaceWorkingCopy({
30158
30334
  skillPath,
30159
30335
  workingCopyPath
30160
30336
  }) {
30161
- const parentPath = path17.dirname(workingCopyPath);
30337
+ const parentPath = path18.dirname(workingCopyPath);
30162
30338
  await mkdir5(parentPath, { recursive: true });
30163
- const temporaryPath = path17.join(
30339
+ const temporaryPath = path18.join(
30164
30340
  parentPath,
30165
- `.mgcl-${path17.basename(workingCopyPath)}-${randomUUID6()}.tmp`
30341
+ `.mgcl-${path18.basename(workingCopyPath)}-${randomUUID6()}.tmp`
30166
30342
  );
30167
30343
  const backupPath = `${workingCopyPath}.${randomUUID6()}.bak`;
30168
30344
  await mkdir5(temporaryPath);
@@ -30233,7 +30409,7 @@ async function clearDirectoryExceptGit(directoryPath) {
30233
30409
  const entries = await readdir(directoryPath);
30234
30410
  await Promise.all(
30235
30411
  entries.filter((entry) => entry !== ".git").map(async (entry) => {
30236
- await rm5(path17.join(directoryPath, entry), {
30412
+ await rm5(path18.join(directoryPath, entry), {
30237
30413
  force: true,
30238
30414
  recursive: true
30239
30415
  });
@@ -30245,7 +30421,7 @@ async function createPatch(before, after) {
30245
30421
  return "";
30246
30422
  }
30247
30423
  const repositoryPath = await mkdtemp2(
30248
- path17.join(os3.tmpdir(), "mgcl-skills-diff-")
30424
+ path18.join(os3.tmpdir(), "mgcl-skills-diff-")
30249
30425
  );
30250
30426
  const patchResult = await fromThrowable(async () => {
30251
30427
  await runGit(["init", "--quiet"], repositoryPath);
@@ -30567,27 +30743,27 @@ async function pushSkillWorkingCopy({
30567
30743
  }
30568
30744
 
30569
30745
  // 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)
30746
+ import { mkdir as mkdir6, readFile as readFile7, rm as rm6, writeFile as writeFile4 } from "node:fs/promises";
30747
+ import path19 from "node:path";
30748
+ import { z as z46 } from "zod";
30749
+ var cliAccountSchema = z46.object({
30750
+ clientId: z46.string().min(1),
30751
+ email: z46.string().nullable(),
30752
+ userId: z46.string().min(1)
30577
30753
  });
30578
- var cliOrganizationSchema = z45.object({
30579
- id: z45.string().min(1),
30580
- name: z45.string().min(1),
30581
- primaryDomain: z45.string().nullable().default(null)
30754
+ var cliOrganizationSchema = z46.object({
30755
+ id: z46.string().min(1),
30756
+ name: z46.string().min(1),
30757
+ primaryDomain: z46.string().nullable().default(null)
30582
30758
  });
30583
- var cliStateSchema = z45.object({
30759
+ var cliStateSchema = z46.object({
30584
30760
  account: cliAccountSchema,
30585
30761
  deploymentTarget: resolvedDeploymentTargetSchema.optional(),
30586
- defaultOrgId: z45.string().nullable(),
30587
- lastUsedOrgId: z45.string().nullable(),
30588
- organizations: z45.array(cliOrganizationSchema)
30762
+ defaultOrgId: z46.string().nullable(),
30763
+ lastUsedOrgId: z46.string().nullable(),
30764
+ organizations: z46.array(cliOrganizationSchema)
30589
30765
  });
30590
- var refreshTokenFileSchema = z45.record(z45.string(), z45.string());
30766
+ var refreshTokenFileSchema = z46.record(z46.string(), z46.string());
30591
30767
  function createFileStateStore(stateFilePath) {
30592
30768
  return {
30593
30769
  async clear() {
@@ -30595,7 +30771,7 @@ function createFileStateStore(stateFilePath) {
30595
30771
  },
30596
30772
  async load() {
30597
30773
  try {
30598
- const fileContents = await readFile6(stateFilePath, "utf8");
30774
+ const fileContents = await readFile7(stateFilePath, "utf8");
30599
30775
  const parsed = cliStateSchema.safeParse(JSON.parse(fileContents));
30600
30776
  if (!parsed.success) {
30601
30777
  throw new CliError("Stored CLI state is invalid.");
@@ -30612,7 +30788,7 @@ function createFileStateStore(stateFilePath) {
30612
30788
  }
30613
30789
  },
30614
30790
  async save(state) {
30615
- await mkdir6(path18.dirname(stateFilePath), { recursive: true });
30791
+ await mkdir6(path19.dirname(stateFilePath), { recursive: true });
30616
30792
  await writeFile4(stateFilePath, `${JSON.stringify(state, null, 2)}
30617
30793
  `);
30618
30794
  }
@@ -30621,7 +30797,7 @@ function createFileStateStore(stateFilePath) {
30621
30797
  function createFileRefreshTokenStore(refreshTokenFilePath) {
30622
30798
  async function loadRefreshTokens() {
30623
30799
  try {
30624
- const fileContents = await readFile6(refreshTokenFilePath, "utf8");
30800
+ const fileContents = await readFile7(refreshTokenFilePath, "utf8");
30625
30801
  const parsed = refreshTokenFileSchema.safeParse(JSON.parse(fileContents));
30626
30802
  if (!parsed.success) {
30627
30803
  throw new CliError("Stored refresh tokens are invalid.");
@@ -30640,7 +30816,7 @@ function createFileRefreshTokenStore(refreshTokenFilePath) {
30640
30816
  }
30641
30817
  }
30642
30818
  async function saveRefreshTokens(refreshTokens) {
30643
- await mkdir6(path18.dirname(refreshTokenFilePath), { recursive: true });
30819
+ await mkdir6(path19.dirname(refreshTokenFilePath), { recursive: true });
30644
30820
  await writeFile4(
30645
30821
  refreshTokenFilePath,
30646
30822
  `${JSON.stringify(refreshTokens, null, 2)}
@@ -30678,37 +30854,37 @@ function buildRefreshTokenKey(account) {
30678
30854
  }
30679
30855
 
30680
30856
  // src/workos-auth.ts
30681
- import { z as z46 } from "zod";
30857
+ import { z as z47 } from "zod";
30682
30858
  var DEFAULT_DEVICE_POLL_INTERVAL_SECONDS = 5;
30683
30859
  function buildFormHeaders() {
30684
30860
  const headers = new Headers();
30685
30861
  headers.set("content-type", "application/x-www-form-urlencoded");
30686
30862
  return headers;
30687
30863
  }
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)
30864
+ var deviceAuthorizationSchema = z47.object({
30865
+ device_code: z47.string().min(1),
30866
+ expires_in: z47.number().int().positive().optional(),
30867
+ interval: z47.number().int().positive().optional(),
30868
+ user_code: z47.string().min(1),
30869
+ verification_uri: z47.url(),
30870
+ verification_uri_complete: z47.url().optional()
30871
+ });
30872
+ var tokenResponseSchema = z47.object({
30873
+ access_token: z47.string().min(1),
30874
+ expires_in: z47.number().int().positive().optional(),
30875
+ refresh_token: z47.string().min(1),
30876
+ token_type: z47.string().optional()
30877
+ });
30878
+ var tokenErrorSchema = z47.object({
30879
+ error: z47.string().min(1),
30880
+ error_description: z47.string().optional()
30881
+ });
30882
+ var accessTokenClaimsSchema = z47.object({
30883
+ exp: z47.number().int().positive().optional(),
30884
+ iss: z47.string().min(1).optional(),
30885
+ org_id: z47.string().min(1).optional(),
30886
+ sid: z47.string().min(1).optional(),
30887
+ sub: z47.string().min(1)
30712
30888
  });
30713
30889
  function createWorkosAuthClient({
30714
30890
  fetchFn = fetch,
@@ -31018,13 +31194,17 @@ async function handleOperationCommand(dependencies, operationSpec, commandOption
31018
31194
  commandOptions,
31019
31195
  dependencies.workingDirectory ?? process.cwd()
31020
31196
  );
31021
- const variables = parseOperationVariables(
31022
- operationSpec,
31023
- getFileUploadOperationVariables(
31197
+ const operationVariables = await resolveClassifyOperationVariables({
31198
+ defaultVariables: getFileUploadOperationVariables(
31024
31199
  collectOperationVariableInput(operationSpec, commandOptions),
31025
31200
  preparedUpload
31026
- )
31027
- );
31201
+ ),
31202
+ operationName: operationSpec.operationName,
31203
+ options: commandOptions,
31204
+ runtime: dependencies.classifyCommandRuntime,
31205
+ workingDirectory: dependencies.workingDirectory ?? process.cwd()
31206
+ });
31207
+ const variables = parseOperationVariables(operationSpec, operationVariables);
31028
31208
  const apiKeyEnvironment = getApiKeyEnvironment(
31029
31209
  dependencies,
31030
31210
  commandOptions.apiKey
@@ -31534,7 +31714,7 @@ function summarizePathwayRegressionResult(result) {
31534
31714
  baselineAutomationRunId: replay.baselineAutomationRunId,
31535
31715
  status: replay.status,
31536
31716
  checks: replay.checks,
31537
- nonPassingIterations: replay.iterations.filter((iteration) => iteration.status !== "passed").map((iteration) => ({
31717
+ nonMatchingIterations: replay.iterations.filter((iteration) => iteration.status !== "matched").map((iteration) => ({
31538
31718
  regressionReplayIterationId: iteration.id,
31539
31719
  sequence: iteration.sequence,
31540
31720
  status: iteration.status,
@@ -32004,6 +32184,9 @@ function addRegistryOperationCommand({
32004
32184
  }
32005
32185
  const command = parentCommand.command(leafCommandName);
32006
32186
  configureOperationalCommand(command, dependencies, operationSpec);
32187
+ if (parentCommand === program2) {
32188
+ return;
32189
+ }
32007
32190
  const legacyAliasCommand = program2.command(operationSpec.cli.name, {
32008
32191
  hidden: true
32009
32192
  });
@@ -32028,6 +32211,7 @@ ${formatExamples(
32028
32211
  createOperationHelpExamples(operationSpec)
32029
32212
  )}`
32030
32213
  );
32214
+ configureClassifyHelp(command, operationSpec.operationName);
32031
32215
  for (const optionSpec of operationSpec.cli.options) {
32032
32216
  command.addOption(
32033
32217
  createCliCommanderOption(
@@ -32053,12 +32237,12 @@ function createDefaultDependencies() {
32053
32237
  return resolveDeploymentTarget({ savedEnv: settings.env, selectors });
32054
32238
  };
32055
32239
  const resolveApiBaseUrl = () => deploymentTargetContext.get().apiUrl;
32056
- const accessTokenFilePath = runtimeConfig.accessTokenFilePath ?? path19.join(
32057
- path19.dirname(runtimeConfig.stateFilePath),
32240
+ const accessTokenFilePath = runtimeConfig.accessTokenFilePath ?? path20.join(
32241
+ path20.dirname(runtimeConfig.stateFilePath),
32058
32242
  CLI_ACCESS_TOKEN_FILE_NAME
32059
32243
  );
32060
- const refreshTokenFilePath = runtimeConfig.refreshTokenFilePath ?? path19.join(
32061
- path19.dirname(runtimeConfig.stateFilePath),
32244
+ const refreshTokenFilePath = runtimeConfig.refreshTokenFilePath ?? path20.join(
32245
+ path20.dirname(runtimeConfig.stateFilePath),
32062
32246
  CLI_REFRESH_TOKEN_FILE_NAME
32063
32247
  );
32064
32248
  const selfUpdateOptions = {
@@ -32076,8 +32260,8 @@ function createDefaultDependencies() {
32076
32260
  io: createConsoleIo(),
32077
32261
  openExternalUrl,
32078
32262
  orgPreferencesStore: createFileOrgPreferencesStore(
32079
- path19.join(
32080
- path19.dirname(runtimeConfig.stateFilePath),
32263
+ path20.join(
32264
+ path20.dirname(runtimeConfig.stateFilePath),
32081
32265
  "organization-preferences"
32082
32266
  )
32083
32267
  ),