@getmagical/cli 0.2.3 → 0.2.5

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
@@ -2056,13 +2056,13 @@ var require_ast = __commonJS({
2056
2056
  helperExpression: function helperExpression(node) {
2057
2057
  return node.type === "SubExpression" || (node.type === "MustacheStatement" || node.type === "BlockStatement") && !!(node.params && node.params.length || node.hash);
2058
2058
  },
2059
- scopedId: function scopedId(path7) {
2060
- return /^\.|this\b/.test(path7.original);
2059
+ scopedId: function scopedId(path8) {
2060
+ return /^\.|this\b/.test(path8.original);
2061
2061
  },
2062
2062
  // an ID is simple if it only has one part, and that part is not
2063
2063
  // `..` or `this`.
2064
- simpleId: function simpleId(path7) {
2065
- return path7.parts.length === 1 && !AST.helpers.scopedId(path7) && !path7.depth;
2064
+ simpleId: function simpleId(path8) {
2065
+ return path8.parts.length === 1 && !AST.helpers.scopedId(path8) && !path8.depth;
2066
2066
  }
2067
2067
  }
2068
2068
  };
@@ -3132,12 +3132,12 @@ var require_helpers2 = __commonJS({
3132
3132
  loc
3133
3133
  };
3134
3134
  }
3135
- function prepareMustache(path7, params, hash, open, strip, locInfo) {
3135
+ function prepareMustache(path8, params, hash, open, strip, locInfo) {
3136
3136
  var escapeFlag = open.charAt(3) || open.charAt(2), escaped = escapeFlag !== "{" && escapeFlag !== "&";
3137
3137
  var decorator = /\*/.test(open);
3138
3138
  return {
3139
3139
  type: decorator ? "Decorator" : "MustacheStatement",
3140
- path: path7,
3140
+ path: path8,
3141
3141
  params,
3142
3142
  hash,
3143
3143
  escaped,
@@ -3455,9 +3455,9 @@ var require_compiler = __commonJS({
3455
3455
  },
3456
3456
  DecoratorBlock: function DecoratorBlock(decorator) {
3457
3457
  var program2 = decorator.program && this.compileProgram(decorator.program);
3458
- var params = this.setupFullMustacheParams(decorator, program2, void 0), path7 = decorator.path;
3458
+ var params = this.setupFullMustacheParams(decorator, program2, void 0), path8 = decorator.path;
3459
3459
  this.useDecorators = true;
3460
- this.opcode("registerDecorator", params.length, path7.original);
3460
+ this.opcode("registerDecorator", params.length, path8.original);
3461
3461
  },
3462
3462
  PartialStatement: function PartialStatement(partial) {
3463
3463
  this.usePartial = true;
@@ -3521,46 +3521,46 @@ var require_compiler = __commonJS({
3521
3521
  }
3522
3522
  },
3523
3523
  ambiguousSexpr: function ambiguousSexpr(sexpr, program2, inverse) {
3524
- var path7 = sexpr.path, name = path7.parts[0], isBlock = program2 != null || inverse != null;
3525
- this.opcode("getContext", path7.depth);
3524
+ var path8 = sexpr.path, name = path8.parts[0], isBlock = program2 != null || inverse != null;
3525
+ this.opcode("getContext", path8.depth);
3526
3526
  this.opcode("pushProgram", program2);
3527
3527
  this.opcode("pushProgram", inverse);
3528
- path7.strict = true;
3529
- this.accept(path7);
3528
+ path8.strict = true;
3529
+ this.accept(path8);
3530
3530
  this.opcode("invokeAmbiguous", name, isBlock);
3531
3531
  },
3532
3532
  simpleSexpr: function simpleSexpr(sexpr) {
3533
- var path7 = sexpr.path;
3534
- path7.strict = true;
3535
- this.accept(path7);
3533
+ var path8 = sexpr.path;
3534
+ path8.strict = true;
3535
+ this.accept(path8);
3536
3536
  this.opcode("resolvePossibleLambda");
3537
3537
  },
3538
3538
  helperSexpr: function helperSexpr(sexpr, program2, inverse) {
3539
- var params = this.setupFullMustacheParams(sexpr, program2, inverse), path7 = sexpr.path, name = path7.parts[0];
3539
+ var params = this.setupFullMustacheParams(sexpr, program2, inverse), path8 = sexpr.path, name = path8.parts[0];
3540
3540
  if (this.options.knownHelpers[name]) {
3541
3541
  this.opcode("invokeKnownHelper", params.length, name);
3542
3542
  } else if (this.options.knownHelpersOnly) {
3543
3543
  throw new _exception2["default"]("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
3544
3544
  } else {
3545
- path7.strict = true;
3546
- path7.falsy = true;
3547
- this.accept(path7);
3548
- this.opcode("invokeHelper", params.length, path7.original, _ast2["default"].helpers.simpleId(path7));
3545
+ path8.strict = true;
3546
+ path8.falsy = true;
3547
+ this.accept(path8);
3548
+ this.opcode("invokeHelper", params.length, path8.original, _ast2["default"].helpers.simpleId(path8));
3549
3549
  }
3550
3550
  },
3551
- PathExpression: function PathExpression(path7) {
3552
- this.addDepth(path7.depth);
3553
- this.opcode("getContext", path7.depth);
3554
- var name = path7.parts[0], scoped = _ast2["default"].helpers.scopedId(path7), blockParamId = !path7.depth && !scoped && this.blockParamIndex(name);
3551
+ PathExpression: function PathExpression(path8) {
3552
+ this.addDepth(path8.depth);
3553
+ this.opcode("getContext", path8.depth);
3554
+ var name = path8.parts[0], scoped = _ast2["default"].helpers.scopedId(path8), blockParamId = !path8.depth && !scoped && this.blockParamIndex(name);
3555
3555
  if (blockParamId) {
3556
- this.opcode("lookupBlockParam", blockParamId, path7.parts);
3556
+ this.opcode("lookupBlockParam", blockParamId, path8.parts);
3557
3557
  } else if (!name) {
3558
3558
  this.opcode("pushContext");
3559
- } else if (path7.data) {
3559
+ } else if (path8.data) {
3560
3560
  this.options.data = true;
3561
- this.opcode("lookupData", path7.depth, path7.parts, path7.strict);
3561
+ this.opcode("lookupData", path8.depth, path8.parts, path8.strict);
3562
3562
  } else {
3563
- this.opcode("lookupOnContext", path7.parts, path7.falsy, path7.strict, scoped);
3563
+ this.opcode("lookupOnContext", path8.parts, path8.falsy, path8.strict, scoped);
3564
3564
  }
3565
3565
  },
3566
3566
  StringLiteral: function StringLiteral(string) {
@@ -3910,16 +3910,16 @@ var require_util2 = __commonJS({
3910
3910
  }
3911
3911
  exports.urlGenerate = urlGenerate;
3912
3912
  function normalize(aPath) {
3913
- var path7 = aPath;
3913
+ var path8 = aPath;
3914
3914
  var url = urlParse(aPath);
3915
3915
  if (url) {
3916
3916
  if (!url.path) {
3917
3917
  return aPath;
3918
3918
  }
3919
- path7 = url.path;
3919
+ path8 = url.path;
3920
3920
  }
3921
- var isAbsolute = exports.isAbsolute(path7);
3922
- var parts = path7.split(/\/+/);
3921
+ var isAbsolute = exports.isAbsolute(path8);
3922
+ var parts = path8.split(/\/+/);
3923
3923
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
3924
3924
  part = parts[i];
3925
3925
  if (part === ".") {
@@ -3936,15 +3936,15 @@ var require_util2 = __commonJS({
3936
3936
  }
3937
3937
  }
3938
3938
  }
3939
- path7 = parts.join("/");
3940
- if (path7 === "") {
3941
- path7 = isAbsolute ? "/" : ".";
3939
+ path8 = parts.join("/");
3940
+ if (path8 === "") {
3941
+ path8 = isAbsolute ? "/" : ".";
3942
3942
  }
3943
3943
  if (url) {
3944
- url.path = path7;
3944
+ url.path = path8;
3945
3945
  return urlGenerate(url);
3946
3946
  }
3947
- return path7;
3947
+ return path8;
3948
3948
  }
3949
3949
  exports.normalize = normalize;
3950
3950
  function join(aRoot, aPath) {
@@ -6727,8 +6727,8 @@ var require_printer = __commonJS({
6727
6727
  return this.accept(sexpr.path) + " " + params + hash;
6728
6728
  };
6729
6729
  PrintVisitor.prototype.PathExpression = function(id) {
6730
- var path7 = id.parts.join("/");
6731
- return (id.data ? "@" : "") + "PATH:" + path7;
6730
+ var path8 = id.parts.join("/");
6731
+ return (id.data ? "@" : "") + "PATH:" + path8;
6732
6732
  };
6733
6733
  PrintVisitor.prototype.StringLiteral = function(string) {
6734
6734
  return '"' + string.value + '"';
@@ -7079,8 +7079,8 @@ function getErrorMessage(error) {
7079
7079
  }
7080
7080
 
7081
7081
  // src/program.ts
7082
- import { readFile as readFile4 } from "node:fs/promises";
7083
- import path6 from "node:path";
7082
+ import { readFile as readFile5 } from "node:fs/promises";
7083
+ import path7 from "node:path";
7084
7084
 
7085
7085
  // ../common/dist/src/stdlib/json.util.js
7086
7086
  var import_ts_essentials = __toESM(require_dist(), 1);
@@ -7088,6 +7088,56 @@ var import_ts_essentials = __toESM(require_dist(), 1);
7088
7088
  // ../common/dist/src/stdlib/result.util.js
7089
7089
  import { z } from "zod";
7090
7090
 
7091
+ // ../common/dist/src/stdlib/error-temporal.js
7092
+ function isErrorLike(obj) {
7093
+ return typeof obj === "object" && obj !== null && "name" in obj && "message" in obj && typeof obj.name === "string" && typeof obj.message === "string";
7094
+ }
7095
+ function isTemporalApplicationFailure(error) {
7096
+ if (!isErrorLike(error)) {
7097
+ return false;
7098
+ }
7099
+ return error.name === "ApplicationFailure" || !!error.stack?.startsWith("ApplicationFailure");
7100
+ }
7101
+ function isTemporalActivityFailure(error) {
7102
+ if (!isErrorLike(error)) {
7103
+ return false;
7104
+ }
7105
+ return error.name === "ActivityFailure" || error.message === "Activity task failed";
7106
+ }
7107
+ function isTemporalChildWorkflowFailure(error) {
7108
+ if (!isErrorLike(error)) {
7109
+ return false;
7110
+ }
7111
+ return error.name === "ChildWorkflowFailure" || error.message === "Child Workflow execution failed";
7112
+ }
7113
+ function isTemporalFailure(error) {
7114
+ if (!isErrorLike(error)) {
7115
+ return false;
7116
+ }
7117
+ return isTemporalApplicationFailure(error) || isTemporalActivityFailure(error) || isTemporalChildWorkflowFailure(error);
7118
+ }
7119
+
7120
+ // ../common/dist/src/stdlib/error-serialization.js
7121
+ function getErrorMessage2(error, maxDepth = 10) {
7122
+ if (error instanceof Error || isErrorLike2(error)) {
7123
+ if (error.cause && maxDepth > 0) {
7124
+ if (isTemporalFailure(error)) {
7125
+ return getErrorMessage2(error.cause, maxDepth - 1);
7126
+ }
7127
+ return `${error.message}
7128
+ ${getErrorMessage2(error.cause, maxDepth - 1)}`;
7129
+ }
7130
+ return error.message;
7131
+ }
7132
+ if (typeof error === "string" || typeof error === "number" || typeof error === "boolean" || error === void 0) {
7133
+ return String(error);
7134
+ }
7135
+ return JSON.stringify(error);
7136
+ }
7137
+ function isErrorLike2(obj) {
7138
+ return typeof obj === "object" && obj !== null && "name" in obj && "message" in obj && typeof obj.name === "string" && typeof obj.message === "string";
7139
+ }
7140
+
7091
7141
  // ../common/dist/src/stdlib/error-user-facing.js
7092
7142
  var USER_FACING_STATUS_MESSAGES = /* @__PURE__ */ new Map([
7093
7143
  [400, "Bad Request"],
@@ -7691,6 +7741,13 @@ function safeJsonParse(json) {
7691
7741
  return Err({ type: "invalid-json", cause: error, json });
7692
7742
  }
7693
7743
  }
7744
+ function safeJsonParseWithoutLogging(json) {
7745
+ try {
7746
+ return Ok(JSON.parse(json));
7747
+ } catch (error) {
7748
+ return Err({ type: "invalid-json", cause: error });
7749
+ }
7750
+ }
7694
7751
 
7695
7752
  // ../common/dist/src/constants/tool-declarations.js
7696
7753
  import { z as z12 } from "zod";
@@ -11865,8 +11922,8 @@ var RENDER_TEMPLATE_ERROR_REASON_CATALOG = defineErrorReasonCatalog()([
11865
11922
  ]);
11866
11923
  var storeReferencePathPattern = String.raw`store(?:\.[$A-Z_a-z][\w$]*)*`;
11867
11924
  var storeReferenceMarkdownLinkTemplateRegex = new RegExp(String.raw`(?<open>\{\{\{?)\s*\[(?<path>${storeReferencePathPattern})\]\(\s*<?https?:\/\/\k<path>>?\s*\)\s*(?<close>\}\}\}?)`, "gu");
11868
- function normalizeAutomationStoreTemplateLinkMatch([_match, open, path7]) {
11869
- return open === "{{{" ? `{{{${path7}}}}` : `{{${path7}}}`;
11925
+ function normalizeAutomationStoreTemplateLinkMatch([_match, open, path8]) {
11926
+ return open === "{{{" ? `{{{${path8}}}}` : `{{${path8}}}`;
11870
11927
  }
11871
11928
  function normalizeAutomationStoreTemplateLinks(template) {
11872
11929
  return template.replaceAll(storeReferenceMarkdownLinkTemplateRegex, (...args) => normalizeAutomationStoreTemplateLinkMatch(args));
@@ -12206,6 +12263,16 @@ function replaceHandlebarsTemplates(value) {
12206
12263
  return value.replaceAll(HANDLEBARS_TEMPLATE_GLOBAL_REGEX, URL_TEMPLATE_PLACEHOLDER_VALUE);
12207
12264
  }
12208
12265
 
12266
+ // ../common/dist/src/stdlib/unsafe-object-key.util.js
12267
+ var UNSAFE_OBJECT_KEYS = /* @__PURE__ */ new Set([
12268
+ "__proto__",
12269
+ "constructor",
12270
+ "prototype"
12271
+ ]);
12272
+ function isUnsafeObjectKey(value) {
12273
+ return UNSAFE_OBJECT_KEYS.has(value);
12274
+ }
12275
+
12209
12276
  // ../common/dist/src/models/websocket/actions/scroll.js
12210
12277
  import { z as z9 } from "zod";
12211
12278
  var scrollDataSchema = z9.object({
@@ -12424,18 +12491,18 @@ var reportStopDataSchema = z11.object({
12424
12491
  // ../common/dist/src/utils/automation-store-path.util.js
12425
12492
  var AUTOMATION_STORE_ROOT_PATH = "store";
12426
12493
  var relativeStorePathRegex = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*)*$/u;
12427
- function normalizeStoreMutationPath(path7) {
12428
- const trimmedPath = path7.trim();
12494
+ function normalizeStoreMutationPath(path8) {
12495
+ const trimmedPath = path8.trim();
12429
12496
  const rootPrefix = `${AUTOMATION_STORE_ROOT_PATH}.`;
12430
12497
  const relativePath = trimmedPath.startsWith(rootPrefix) ? trimmedPath.slice(rootPrefix.length) : trimmedPath;
12431
12498
  if (!relativeStorePathRegex.test(relativePath)) {
12432
12499
  return Err({
12433
12500
  type: "invalid-automation-store-path",
12434
- path: path7,
12501
+ path: path8,
12435
12502
  categories: ["customer_usage"],
12436
12503
  statusCode: 400,
12437
12504
  nonRetryable: true,
12438
- message: `Automation store path "${path7}" is invalid.`,
12505
+ message: `Automation store path "${path8}" is invalid.`,
12439
12506
  suggestedAction: "Use a dot path relative to the automation store, such as patient.name or provider.clinic."
12440
12507
  });
12441
12508
  }
@@ -12448,16 +12515,16 @@ function findAutomationStorePathOverlap(paths) {
12448
12515
  ...new Set(paths.map(getCanonicalAutomationStoreMutationPath))
12449
12516
  ].toSorted((left, right) => (left === AUTOMATION_STORE_ROOT_PATH ? 0 : left.split(".").length) - (right === AUTOMATION_STORE_ROOT_PATH ? 0 : right.split(".").length));
12450
12517
  for (const [index, ancestorPath] of canonicalPaths.entries()) {
12451
- const descendantPath = canonicalPaths.slice(index + 1).find((path7) => ancestorPath === AUTOMATION_STORE_ROOT_PATH || path7.startsWith(`${ancestorPath}.`));
12518
+ const descendantPath = canonicalPaths.slice(index + 1).find((path8) => ancestorPath === AUTOMATION_STORE_ROOT_PATH || path8.startsWith(`${ancestorPath}.`));
12452
12519
  if (descendantPath !== void 0) {
12453
12520
  return { ancestorPath, descendantPath };
12454
12521
  }
12455
12522
  }
12456
12523
  return void 0;
12457
12524
  }
12458
- function getCanonicalAutomationStoreMutationPath(path7) {
12459
- const normalizedPath = normalizeStoreMutationPath(path7);
12460
- return normalizedPath._tag === "Ok" ? normalizedPath.value : path7.trim();
12525
+ function getCanonicalAutomationStoreMutationPath(path8) {
12526
+ const normalizedPath = normalizeStoreMutationPath(path8);
12527
+ return normalizedPath._tag === "Ok" ? normalizedPath.value : path8.trim();
12461
12528
  }
12462
12529
 
12463
12530
  // ../common/dist/src/constants/tool-declarations.js
@@ -12681,9 +12748,9 @@ var baseToolDeclarations = {
12681
12748
  path: []
12682
12749
  });
12683
12750
  }
12684
- const canonicalUpdatePaths = updates.map(({ path: path7 }) => getCanonicalAutomationStoreMutationPath(path7));
12751
+ const canonicalUpdatePaths = updates.map(({ path: path8 }) => getCanonicalAutomationStoreMutationPath(path8));
12685
12752
  const canonicalClearPathSet = new Set(clears.map(getCanonicalAutomationStoreMutationPath));
12686
- const conflictedUpdatePath = canonicalUpdatePaths.find((path7) => canonicalClearPathSet.has(path7));
12753
+ const conflictedUpdatePath = canonicalUpdatePaths.find((path8) => canonicalClearPathSet.has(path8));
12687
12754
  if (conflictedUpdatePath !== void 0) {
12688
12755
  context.addIssue({
12689
12756
  code: "custom",
@@ -13126,7 +13193,7 @@ var SOM_LEGEND_HTML_ATTRIBUTES = [
13126
13193
  ];
13127
13194
 
13128
13195
  // ../common/dist/src/zod-schemas/agent-config.schema.js
13129
- import { z as z19 } from "zod";
13196
+ import { z as z21 } from "zod";
13130
13197
 
13131
13198
  // ../common/dist/src/commands/commands-registry/special.commands.js
13132
13199
  import { z as z13 } from "zod";
@@ -13362,9 +13429,9 @@ var specialCommands = {
13362
13429
  };
13363
13430
 
13364
13431
  // ../common/dist/src/utils/agent-knowledge-base-assets.util.js
13365
- function getIsKnowledgeBaseAssetPathAllowed(path7) {
13366
- const pathSegments = path7.split("/");
13367
- if (path7.length === 0 || pathSegments.some((segment) => segment.length === 0)) {
13432
+ function getIsKnowledgeBaseAssetPathAllowed(path8) {
13433
+ const pathSegments = path8.split("/");
13434
+ if (path8.length === 0 || pathSegments.some((segment) => segment.length === 0)) {
13368
13435
  return false;
13369
13436
  }
13370
13437
  const isTopLevelAssetPath = pathSegments[0] === "assets";
@@ -13373,32 +13440,99 @@ function getIsKnowledgeBaseAssetPathAllowed(path7) {
13373
13440
  return isTopLevelAssetPath || isAutomationAssetPath || isAutomationAgentAssetPath;
13374
13441
  }
13375
13442
 
13376
- // ../common/dist/src/utils/automation-variable-path.util.js
13377
- var AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN = String.raw`[A-Za-z_][A-Za-z0-9_-]*`;
13378
- var AUTOMATION_VARIABLE_PATH_PATTERN = String.raw`${AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN}(?:\.${AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN})*`;
13379
- var DANGEROUS_AUTOMATION_VARIABLE_OBJECT_KEYS = /* @__PURE__ */ new Set([
13380
- "__proto__",
13381
- "constructor",
13382
- "prototype"
13383
- ]);
13384
- var AUTOMATION_VARIABLE_PATH_SEGMENT_REGEX = new RegExp(`^${AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN}$`, "u");
13385
- function isDangerousAutomationVariableObjectKey(value) {
13386
- return DANGEROUS_AUTOMATION_VARIABLE_OBJECT_KEYS.has(value);
13387
- }
13388
-
13389
13443
  // ../common/dist/src/utils/ponr-key-field-path.util.js
13390
13444
  var POINT_OF_NO_RETURN_KEY_FIELD_ROOTS = /* @__PURE__ */ new Set(["input", "store"]);
13391
13445
  function parsePointOfNoReturnKeyFieldPath(keyField) {
13392
13446
  const segments = keyField.split(".");
13393
13447
  const [root, ...pathSegments] = segments;
13394
- if (root === void 0 || !POINT_OF_NO_RETURN_KEY_FIELD_ROOTS.has(root) || pathSegments.length === 0 || pathSegments.some((segment) => segment.length === 0 || isDangerousAutomationVariableObjectKey(segment))) {
13448
+ if (root === void 0 || !POINT_OF_NO_RETURN_KEY_FIELD_ROOTS.has(root) || pathSegments.length === 0 || pathSegments.some((segment) => segment.length === 0 || isUnsafeObjectKey(segment))) {
13395
13449
  return void 0;
13396
13450
  }
13397
13451
  return segments;
13398
13452
  }
13399
13453
 
13400
- // ../common/dist/src/zod-schemas/api-request-body.schema.js
13454
+ // ../common/dist/src/zod-schemas/api-agent-file-output.schema.js
13401
13455
  import { z as z14 } from "zod";
13456
+
13457
+ // ../common/dist/src/utils/api-file-type-registry.util.js
13458
+ var ApiFileContentTypes = ["application/pdf", "image/png"];
13459
+ var PDF_CONTENT_TYPE = "application/pdf";
13460
+ var PNG_CONTENT_TYPE = "image/png";
13461
+ var API_FILE_TYPE_REGISTRY = {
13462
+ [PDF_CONTENT_TYPE]: {
13463
+ extension: "pdf",
13464
+ signature: [37, 80, 68, 70, 45]
13465
+ },
13466
+ [PNG_CONTENT_TYPE]: {
13467
+ extension: "png",
13468
+ signature: [137, 80, 78, 71, 13, 10, 26, 10]
13469
+ }
13470
+ };
13471
+
13472
+ // ../common/dist/src/zod-schemas/api-agent-file-output.schema.js
13473
+ var ApiAgentOutputModes = ["inline", "file"];
13474
+ var API_EMBEDDED_FILE_PATH_PATTERN = /^(?:\[\*\]|[A-Za-z_$][\w$-]*)(?:\[\*\]|\.[A-Za-z_$][\w$-]*)*$/u;
13475
+ var API_EMBEDDED_FILE_PATH_SEGMENT_PATTERN = /\[\*\]|[A-Za-z_$][\w$-]*/gu;
13476
+ function parseApiEmbeddedFilePath(path8) {
13477
+ if (!API_EMBEDDED_FILE_PATH_PATTERN.test(path8)) {
13478
+ return void 0;
13479
+ }
13480
+ return [...path8.matchAll(API_EMBEDDED_FILE_PATH_SEGMENT_PATTERN)].map(([segment]) => segment === "[*]" ? { type: "arrayWildcard" } : { key: segment, type: "property" });
13481
+ }
13482
+ var apiAgentEmbeddedFileSchema = z14.object({
13483
+ path: z14.string().trim().min(1, "Embedded file path is required.").refine((path8) => parseApiEmbeddedFilePath(path8) !== void 0, {
13484
+ message: "Embedded file path must use object properties and [*] array wildcards."
13485
+ }).describe("Path to a Base64 value relative to the projected API response. Supports object properties and [*] array wildcards."),
13486
+ contentType: z14.enum(ApiFileContentTypes).describe("File type of the decoded Base64 value.")
13487
+ }).strict();
13488
+ var apiAgentEmbeddedFilesSchema = z14.array(apiAgentEmbeddedFileSchema).superRefine((embeddedFiles, context) => {
13489
+ const paths = /* @__PURE__ */ new Set();
13490
+ for (const [index, { path: path8 }] of embeddedFiles.entries()) {
13491
+ if (paths.has(path8)) {
13492
+ context.addIssue({
13493
+ code: z14.ZodIssueCode.custom,
13494
+ message: `Embedded file path "${path8}" can only be configured once.`,
13495
+ path: [index, "path"]
13496
+ });
13497
+ }
13498
+ paths.add(path8);
13499
+ }
13500
+ }).describe("Base64 values to decode, upload as permanent files, and replace with file references in the projected API response.");
13501
+
13502
+ // ../common/dist/src/zod-schemas/api-agent-request-file-encoding.schema.js
13503
+ import { z as z15 } from "zod";
13504
+ var API_REQUEST_FILE_PATH_PATTERN = /^[A-Za-z_$][\w$-]*(?:\.[A-Za-z_$][\w$-]*)*$/u;
13505
+ function parseApiRequestFilePath(path8) {
13506
+ if (!API_REQUEST_FILE_PATH_PATTERN.test(path8)) {
13507
+ return void 0;
13508
+ }
13509
+ return path8.split(".");
13510
+ }
13511
+ var apiAgentRequestFileEncodingSchema = z15.object({
13512
+ sourceInput: z15.string().trim().min(1, "File input is required.").refine((path8) => parseApiRequestFilePath(path8) !== void 0, {
13513
+ message: "File input must use an object property path."
13514
+ }).describe("API Agent input containing the file reference to encode."),
13515
+ destinationPath: z15.string().trim().min(1, "Request field is required.").refine((path8) => parseApiRequestFilePath(path8) !== void 0, {
13516
+ message: "Request field must use an object property path."
13517
+ }).describe("JSON request body path where the encoded value is inserted."),
13518
+ encoding: z15.literal("base64").describe("Encoding applied to the source file before insertion.")
13519
+ }).strict();
13520
+ var apiAgentRequestFileEncodingsSchema = z15.array(apiAgentRequestFileEncodingSchema).superRefine((requestFileEncodings, context) => {
13521
+ const destinationPaths = /* @__PURE__ */ new Set();
13522
+ for (const [index, { destinationPath }] of requestFileEncodings.entries()) {
13523
+ if (destinationPaths.has(destinationPath)) {
13524
+ context.addIssue({
13525
+ code: z15.ZodIssueCode.custom,
13526
+ message: `Request field "${destinationPath}" can only be configured once.`,
13527
+ path: [index, "destinationPath"]
13528
+ });
13529
+ }
13530
+ destinationPaths.add(destinationPath);
13531
+ }
13532
+ }).describe("Files to read from API Agent inputs, encode, and insert into the JSON request body.");
13533
+
13534
+ // ../common/dist/src/zod-schemas/api-request-body.schema.js
13535
+ import { z as z16 } from "zod";
13402
13536
  var ApiRequestBodyTypes = [
13403
13537
  "json",
13404
13538
  "multipartFormData",
@@ -13407,20 +13541,20 @@ var ApiRequestBodyTypes = [
13407
13541
  var ApiMethodsWithBody = ["POST", "PUT", "PATCH", "DELETE"];
13408
13542
  var ApiMultipartFormDataFieldTypes = ["text", "file"];
13409
13543
  var MULTIPART_PART_CONTENT_TYPE_PATTERN = /^[A-Za-z0-9!#$&^_.+-]+\/[A-Za-z0-9!#$&^_.+-]+(?:\s*;\s*[A-Za-z0-9!#$&^_.+-]+=(?:"[^"]*"|[A-Za-z0-9!#$&^_.+-]+))*$/u;
13410
- var apiMultipartFormDataFieldSchema = z14.object({
13411
- key: z14.string().describe("Form field name."),
13412
- contentType: z14.string().trim().min(1).regex(MULTIPART_PART_CONTENT_TYPE_PATTERN, {
13544
+ var apiMultipartFormDataFieldSchema = z16.object({
13545
+ key: z16.string().describe("Form field name."),
13546
+ contentType: z16.string().trim().min(1).regex(MULTIPART_PART_CONTENT_TYPE_PATTERN, {
13413
13547
  message: "Content type must be a MIME type like application/json or text/plain; charset=utf-8."
13414
13548
  }).optional().describe("Optional MIME type for this multipart part. Use application/json for text parts that must be sent as JSON."),
13415
- type: z14.enum(ApiMultipartFormDataFieldTypes).optional().describe("Form field type. Defaults to text when omitted. Use file to upload a file asset selected from available inputs."),
13416
- value: z14.string().describe("Form field value.")
13549
+ type: z16.enum(ApiMultipartFormDataFieldTypes).optional().describe("Form field type. Defaults to text when omitted. Use file to upload a file asset selected from available inputs."),
13550
+ value: z16.string().describe("Form field value.")
13417
13551
  }).describe("A multipart form-data field. Defaults to a text field when type is omitted. Set contentType when the receiving API requires a MIME type for the individual part.");
13418
- var apiMultipartFormDataBodySchema = z14.array(apiMultipartFormDataFieldSchema).describe("Multipart form-data body represented as an array of typed form-data fields.");
13419
- var apiFormUrlEncodedFieldSchema = z14.object({
13420
- key: z14.string().describe("Form field name."),
13421
- value: z14.string().describe("Form field value.")
13552
+ var apiMultipartFormDataBodySchema = z16.array(apiMultipartFormDataFieldSchema).describe("Multipart form-data body represented as an array of typed form-data fields.");
13553
+ var apiFormUrlEncodedFieldSchema = z16.object({
13554
+ key: z16.string().describe("Form field name."),
13555
+ value: z16.string().describe("Form field value.")
13422
13556
  }).describe("A form URL-encoded field.");
13423
- var apiFormUrlEncodedBodySchema = z14.array(apiFormUrlEncodedFieldSchema).describe("Form URL-encoded body represented as an array of key/value fields.");
13557
+ var apiFormUrlEncodedBodySchema = z16.array(apiFormUrlEncodedFieldSchema).describe("Form URL-encoded body represented as an array of key/value fields.");
13424
13558
  function isValidApiMultipartFormDataBody({ bodyType, body }) {
13425
13559
  if (bodyType !== "multipartFormData" || body === void 0) {
13426
13560
  return true;
@@ -13435,11 +13569,11 @@ function isValidApiFormUrlEncodedBody({ bodyType, body }) {
13435
13569
  }
13436
13570
 
13437
13571
  // ../common/dist/src/zod-schemas/api-tool.schema.js
13438
- import { z as z16 } from "zod";
13572
+ import { z as z18 } from "zod";
13439
13573
 
13440
13574
  // ../common/dist/src/zod-schemas/output-store-binding.schema.js
13441
- import { z as z15 } from "zod";
13442
- var outputStorePathSchema = z15.string().regex(/^store\.[^\s.]+(?:\.[^\s.]+)*$/u, "Data Store destination must be a fully qualified path such as store.patient.name.");
13575
+ import { z as z17 } from "zod";
13576
+ var outputStorePathSchema = z17.string().regex(/^store\.[^\s.]+(?:\.[^\s.]+)*$/u, "Data Store destination must be a fully qualified path such as store.patient.name.");
13443
13577
 
13444
13578
  // ../common/dist/src/zod-schemas/api-tool.schema.js
13445
13579
  var methodsWithBody = new Set(ApiMethodsWithBody);
@@ -13456,11 +13590,11 @@ function getStaticHttpsBaseUrl(value) {
13456
13590
  const isStaticHttpsBaseUrl = url.protocol === "https:" && url.username === "" && url.password === "" && url.search === "" && url.hash === "";
13457
13591
  return isStaticHttpsBaseUrl ? url : void 0;
13458
13592
  }
13459
- var nangoBaseUrlOverrideSchema = z16.string().trim().superRefine((value, ctx) => {
13593
+ var nangoBaseUrlOverrideSchema = z18.string().trim().superRefine((value, ctx) => {
13460
13594
  const baseUrl = getStaticHttpsBaseUrl(value);
13461
13595
  if (baseUrl === void 0) {
13462
13596
  ctx.addIssue({
13463
- code: z16.ZodIssueCode.custom,
13597
+ code: z18.ZodIssueCode.custom,
13464
13598
  message: "Base URL override must be a static HTTPS URL without credentials, query parameters, fragments, or template placeholders"
13465
13599
  });
13466
13600
  }
@@ -13471,25 +13605,25 @@ var defaultApiResponseCacheConfig = {
13471
13605
  enabled: false,
13472
13606
  ttl: API_RESPONSE_CACHE_DEFAULT_TTL_SECONDS
13473
13607
  };
13474
- var apiResponseCacheConfigObjectSchema = z16.object({
13475
- enabled: z16.boolean().default(defaultApiResponseCacheConfig.enabled).describe("Whether API response caching is enabled for this request."),
13476
- ttl: z16.number().int().positive().default(defaultApiResponseCacheConfig.ttl).describe("Time-to-live for cached successful API responses, measured in seconds.")
13608
+ var apiResponseCacheConfigObjectSchema = z18.object({
13609
+ enabled: z18.boolean().default(defaultApiResponseCacheConfig.enabled).describe("Whether API response caching is enabled for this request."),
13610
+ ttl: z18.number().int().positive().default(defaultApiResponseCacheConfig.ttl).describe("Time-to-live for cached successful API responses, measured in seconds.")
13477
13611
  });
13478
13612
  var apiResponseCacheConfigSchema = apiResponseCacheConfigObjectSchema.optional().describe("Response cache configuration. Successful API responses can be reused across runs for identical rendered requests, with TTL measured in seconds.");
13479
13613
  var apiOutputStorePathSchema = outputStorePathSchema.describe("Fully qualified Data Store path that receives the selected value.");
13480
13614
  var apiOutputStoreBindingShape = {
13481
- jmesPath: z16.string().trim().min(1, "JMESPath is required. Use @ to select the entire response.").describe("JMESPath expression evaluated against the raw API response. Use @ to select the entire response."),
13615
+ jmesPath: z18.string().trim().min(1, "JMESPath is required. Use @ to select the entire response.").describe("JMESPath expression evaluated against the raw API response. Use @ to select the entire response."),
13482
13616
  storePath: apiOutputStorePathSchema,
13483
- arrayMode: z16.enum(["append", "appendList", "replace"]).optional().describe("Required for newly authored array destinations: append adds exactly one item, appendList adds multiple items, and replace sets the complete list. Omit for scalar and Object destinations; Object values replace the complete object. Legacy omitted array modes still append at runtime.")
13617
+ arrayMode: z18.enum(["append", "appendList", "replace"]).optional().describe("Required for newly authored array destinations: append adds exactly one item, appendList adds multiple items, and replace sets the complete list. Omit for scalar and Object destinations; Object values replace the complete object. Legacy omitted array modes still append at runtime.")
13484
13618
  };
13485
- var apiOutputStoreBindingObjectSchema = z16.object(apiOutputStoreBindingShape);
13486
- var apiOutputStoreBindingAuthoringSchema = z16.object(apiOutputStoreBindingShape).strict();
13487
- var legacyApiOutputStoreBindingObjectSchema = z16.object({
13488
- sourcePath: z16.literal("$"),
13619
+ var apiOutputStoreBindingObjectSchema = z18.object(apiOutputStoreBindingShape);
13620
+ var apiOutputStoreBindingAuthoringSchema = z18.object(apiOutputStoreBindingShape).strict();
13621
+ var legacyApiOutputStoreBindingObjectSchema = z18.object({
13622
+ sourcePath: z18.literal("$"),
13489
13623
  storePath: apiOutputStorePathSchema,
13490
- arrayMode: z16.enum(["append", "appendList", "replace"]).optional()
13624
+ arrayMode: z18.enum(["append", "appendList", "replace"]).optional()
13491
13625
  });
13492
- var apiOutputStoreBindingSchema = z16.union([
13626
+ var apiOutputStoreBindingSchema = z18.union([
13493
13627
  apiOutputStoreBindingObjectSchema,
13494
13628
  legacyApiOutputStoreBindingObjectSchema
13495
13629
  ]).transform((binding) => "jmesPath" in binding ? binding : {
@@ -13502,7 +13636,7 @@ function validateUniqueApiOutputStoreBindingPaths(bindings, ctx) {
13502
13636
  for (const [index, { storePath }] of bindings.entries()) {
13503
13637
  if (storePaths.has(storePath)) {
13504
13638
  ctx.addIssue({
13505
- code: z16.ZodIssueCode.custom,
13639
+ code: z18.ZodIssueCode.custom,
13506
13640
  path: [index, "storePath"],
13507
13641
  message: `Data Store destination "${storePath}" can only be written once by this node.`
13508
13642
  });
@@ -13510,32 +13644,44 @@ function validateUniqueApiOutputStoreBindingPaths(bindings, ctx) {
13510
13644
  storePaths.add(storePath);
13511
13645
  }
13512
13646
  }
13513
- var apiOutputStoreBindingsAuthoringSchema = z16.array(apiOutputStoreBindingAuthoringSchema).superRefine(validateUniqueApiOutputStoreBindingPaths).describe("Public authoring mappings from independently selected raw API response values to Data Store destinations.");
13514
- var apiOutputStoreBindingsSchema = z16.array(apiOutputStoreBindingSchema).superRefine(validateUniqueApiOutputStoreBindingPaths).describe("Optional mappings from independently selected raw API response values to Data Store destinations.");
13515
- var apiToolSchema = z16.object({
13516
- name: z16.string().describe("Unique name for the API tool."),
13517
- description: z16.string().describe("Description of what the API tool does. Shown to the agent to help it decide when to use this tool."),
13518
- inputSchema: z16.custom().optional().describe("JSON schema (in serialized Zod format) defining the input parameters for the API call."),
13519
- authInputs: z16.array(z16.object({
13520
- key: z16.string().describe("Parameter key where the auth value will be injected."),
13521
- value: z16.object({
13522
- authId: z16.string().describe("ID of the authentication credential to use."),
13523
- factor: z16.enum(IdentifierTypes).optional().describe("Type of authentication factor.")
13647
+ var apiOutputStoreBindingsAuthoringSchema = z18.array(apiOutputStoreBindingAuthoringSchema).superRefine(validateUniqueApiOutputStoreBindingPaths).describe("Public authoring mappings from independently selected raw API response values to Data Store destinations.");
13648
+ var apiOutputStoreBindingsSchema = z18.array(apiOutputStoreBindingSchema).superRefine(validateUniqueApiOutputStoreBindingPaths).describe("Optional mappings from independently selected raw API response values to Data Store destinations.");
13649
+ var apiToolSchema = z18.object({
13650
+ name: z18.string().describe("Unique name for the API tool."),
13651
+ description: z18.string().describe("Description of what the API tool does. Shown to the agent to help it decide when to use this tool."),
13652
+ inputSchema: z18.custom().optional().describe("JSON schema (in serialized Zod format) defining the input parameters for the API call."),
13653
+ authInputs: z18.array(z18.object({
13654
+ key: z18.string().describe("Parameter key where the auth value will be injected."),
13655
+ value: z18.object({
13656
+ authId: z18.string().describe("ID of the authentication credential to use."),
13657
+ factor: z18.enum(IdentifierTypes).optional().describe("Type of authentication factor.")
13524
13658
  })
13525
13659
  })).optional().describe("Authentication inputs to inject into the API call. Maps parameter keys to saved credentials."),
13526
- type: z16.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]).describe("HTTP method for the API call."),
13527
- url: z16.string().describe("URL template for the API endpoint. Can include placeholders like {paramName} for dynamic values."),
13660
+ type: z18.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]).describe("HTTP method for the API call."),
13661
+ url: z18.string().describe("URL template for the API endpoint. Can include placeholders like {paramName} for dynamic values."),
13528
13662
  baseUrlOverride: nangoBaseUrlOverrideSchema.optional().describe("Optional static base URL override for Nango-backed requests when the endpoint uses a base URL different from the provider default."),
13529
- headers: z16.record(z16.string(), z16.string()).optional().describe("HTTP headers to include in the request. Values can include placeholders."),
13530
- queryParams: z16.record(z16.string(), z16.string()).optional().describe("Query parameters to include in the URL. Values can include placeholders."),
13531
- body: z16.unknown().optional().describe("Request body template. Can include placeholders for dynamic values."),
13532
- bodyType: z16.enum(ApiRequestBodyTypes).optional().describe("Request body encoding mode. Defaults to JSON when omitted. Use multipartFormData for typed form-data fields and formUrlEncoded for application/x-www-form-urlencoded payloads."),
13533
- outputJmesPath: z16.string().optional().describe("JMESPath expression to extract specific data from the API response before returning it to the agent."),
13663
+ headers: z18.record(z18.string(), z18.string()).optional().describe("HTTP headers to include in the request. Values can include placeholders."),
13664
+ queryParams: z18.record(z18.string(), z18.string()).optional().describe("Query parameters to include in the URL. Values can include placeholders."),
13665
+ body: z18.unknown().optional().describe("Request body template. Can include placeholders for dynamic values."),
13666
+ bodyType: z18.enum(ApiRequestBodyTypes).optional().describe("Request body encoding mode. Defaults to JSON when omitted. Use multipartFormData for typed form-data fields and formUrlEncoded for application/x-www-form-urlencoded payloads."),
13667
+ requestFileEncodings: apiAgentRequestFileEncodingsSchema.optional(),
13668
+ outputJmesPath: z18.string().optional().describe("JMESPath expression to extract specific data from the API response before returning it to the agent."),
13669
+ outputMode: z18.enum(ApiAgentOutputModes).optional().describe("How to return the projected API response. File mode stores it as a permanent JSON file."),
13670
+ embeddedFiles: apiAgentEmbeddedFilesSchema.optional(),
13534
13671
  outputStoreBindings: apiOutputStoreBindingsSchema.optional(),
13535
13672
  cacheResponse: apiResponseCacheConfigSchema
13536
13673
  }).refine((data) => !(data.bodyType !== void 0 && !methodsWithBody.has(data.type)), {
13537
13674
  message: "Body type is not supported for this method",
13538
13675
  path: ["bodyType"]
13676
+ }).refine((data) => !data.requestFileEncodings?.length || methodsWithBody.has(data.type), {
13677
+ message: "Request file encoding is not supported for this method",
13678
+ path: ["requestFileEncodings"]
13679
+ }).refine((data) => !data.requestFileEncodings?.length || (data.bodyType ?? "json") === "json", {
13680
+ message: "Request file encoding is only supported for JSON bodies",
13681
+ path: ["requestFileEncodings"]
13682
+ }).refine((data) => !data.requestFileEncodings?.length || data.body !== null && typeof data.body === "object" && !Array.isArray(data.body), {
13683
+ message: "Request file encoding requires a JSON object body",
13684
+ path: ["body"]
13539
13685
  }).refine((data) => isValidApiMultipartFormDataBody({
13540
13686
  bodyType: data.bodyType,
13541
13687
  body: data.body
@@ -13551,48 +13697,48 @@ var apiToolSchema = z16.object({
13551
13697
  }).describe("Custom API tool definition. Allows agents to make HTTP requests to external APIs.");
13552
13698
 
13553
13699
  // ../common/dist/src/zod-schemas/run-limitation.schema.js
13554
- import { z as z17 } from "zod";
13700
+ import { z as z19 } from "zod";
13555
13701
  var MAX_BROWSER_SESSION_DURATION_SECONDS = 6 * 60 * 60;
13556
13702
  var BROWSER_TERMINATION_BUFFER_SECONDS = 60;
13557
13703
  var MAX_AUTOMATION_DURATION_SECONDS = MAX_BROWSER_SESSION_DURATION_SECONDS - BROWSER_TERMINATION_BUFFER_SECONDS;
13558
13704
  var MAX_AUTOMATION_TOOL_CALLS = 500;
13559
13705
  var MAX_AGENT_TOOL_CALLS = 50;
13560
- var maxDurationSecondsSchema = z17.number().min(1).max(MAX_AUTOMATION_DURATION_SECONDS).optional().default(MAX_AUTOMATION_DURATION_SECONDS).describe("Maximum execution duration in seconds. The run will be terminated if it exceeds this limit.");
13561
- var baseRunLimitationSchema = z17.object({
13706
+ var maxDurationSecondsSchema = z19.number().min(1).max(MAX_AUTOMATION_DURATION_SECONDS).optional().default(MAX_AUTOMATION_DURATION_SECONDS).describe("Maximum execution duration in seconds. The run will be terminated if it exceeds this limit.");
13707
+ var baseRunLimitationSchema = z19.object({
13562
13708
  maxDurationSeconds: maxDurationSecondsSchema,
13563
- maxToolCalls: z17.number().optional().describe("Maximum number of tool calls allowed. The run will pause with MAX_TOOL_CALLS_REACHED when exceeded."),
13564
- allowedUrlRegexes: z17.array(z17.string()).optional().describe("Array of regex patterns for URLs the agent is allowed to navigate to. If specified, navigation to non-matching URLs will be blocked.")
13709
+ maxToolCalls: z19.number().optional().describe("Maximum number of tool calls allowed. The run will pause with MAX_TOOL_CALLS_REACHED when exceeded."),
13710
+ allowedUrlRegexes: z19.array(z19.string()).optional().describe("Array of regex patterns for URLs the agent is allowed to navigate to. If specified, navigation to non-matching URLs will be blocked.")
13565
13711
  });
13566
13712
  var automationRunLimitationSchema = baseRunLimitationSchema.extend({
13567
- maxToolCalls: z17.number().optional().default(MAX_AUTOMATION_TOOL_CALLS).describe("Maximum number of tool calls allowed across all agents in the automation.")
13713
+ maxToolCalls: z19.number().optional().default(MAX_AUTOMATION_TOOL_CALLS).describe("Maximum number of tool calls allowed across all agents in the automation.")
13568
13714
  }).optional().default({
13569
13715
  maxDurationSeconds: MAX_AUTOMATION_DURATION_SECONDS,
13570
13716
  maxToolCalls: MAX_AUTOMATION_TOOL_CALLS
13571
13717
  }).describe("Resource limits for the automation run.");
13572
13718
  var agentRunLimitationSchema = baseRunLimitationSchema.extend({
13573
- maxToolCalls: z17.number().optional().default(MAX_AGENT_TOOL_CALLS).describe("Maximum number of tool calls allowed for this agent.")
13719
+ maxToolCalls: z19.number().optional().default(MAX_AGENT_TOOL_CALLS).describe("Maximum number of tool calls allowed for this agent.")
13574
13720
  }).optional().default({
13575
13721
  maxDurationSeconds: MAX_AUTOMATION_DURATION_SECONDS,
13576
13722
  maxToolCalls: MAX_AGENT_TOOL_CALLS
13577
13723
  }).describe("Resource limits for the agent run.");
13578
13724
 
13579
13725
  // ../common/dist/src/zod-schemas/voice-provider-options.schema.js
13580
- import { z as z18 } from "zod";
13581
- var voiceParticipantSchema = z18.object({
13582
- number: z18.string().min(1).optional().describe("Default phone number or endpoint to use for this call participant. Accepts a literal value or a Handlebars template with agent, shared, and context inputs."),
13583
- name: z18.string().min(1).optional().describe("Display name to associate with this call participant."),
13584
- countryCode: z18.enum(["US", "CA"]).optional().describe("Country context for local national phone numbers. US and CA numbers can be safely normalized to E.164 for providers that require it.")
13726
+ import { z as z20 } from "zod";
13727
+ var voiceParticipantSchema = z20.object({
13728
+ number: z20.string().min(1).optional().describe("Default phone number or endpoint to use for this call participant. Accepts a literal value or a Handlebars template with agent, shared, and context inputs."),
13729
+ name: z20.string().min(1).optional().describe("Display name to associate with this call participant."),
13730
+ countryCode: z20.enum(["US", "CA"]).optional().describe("Country context for local national phone numbers. US and CA numbers can be safely normalized to E.164 for providers that require it.")
13585
13731
  }).describe("Default voice call participant settings.");
13586
- var vapiVoiceProviderOptionsSchema = z18.object({
13587
- assistantId: z18.string().min(1).optional().describe("Existing Vapi assistant ID to start or hand off the call to."),
13588
- assistant: z18.record(z18.string(), z18.unknown()).optional().describe("Inline Vapi assistant definition used when an explicit assistantId is not provided."),
13589
- assistantOverrides: z18.record(z18.string(), z18.unknown()).optional().describe("Runtime assistant override payload forwarded to Vapi when starting or handing off a call."),
13732
+ var vapiVoiceProviderOptionsSchema = z20.object({
13733
+ assistantId: z20.string().min(1).optional().describe("Existing Vapi assistant ID to start or hand off the call to."),
13734
+ assistant: z20.record(z20.string(), z20.unknown()).optional().describe("Inline Vapi assistant definition used when an explicit assistantId is not provided."),
13735
+ assistantOverrides: z20.record(z20.string(), z20.unknown()).optional().describe("Runtime assistant override payload forwarded to Vapi when starting or handing off a call."),
13590
13736
  caller: voiceParticipantSchema.optional().describe("Default caller settings for outbound calls."),
13591
13737
  callee: voiceParticipantSchema.optional().describe("Default callee settings for outbound calls."),
13592
- phoneNumberId: z18.string().min(1).optional().describe("Vapi phone number ID used to originate outbound calls."),
13593
- enableDtmf: z18.boolean().optional().describe("Whether the call should support DTMF input.")
13738
+ phoneNumberId: z20.string().min(1).optional().describe("Vapi phone number ID used to originate outbound calls."),
13739
+ enableDtmf: z20.boolean().optional().describe("Whether the call should support DTMF input.")
13594
13740
  }).describe("Configuration options specific to the Vapi voice provider.");
13595
- var voiceProviderOptionsSchema = z18.object({
13741
+ var voiceProviderOptionsSchema = z20.object({
13596
13742
  vapi: vapiVoiceProviderOptionsSchema.optional().describe("Configuration options specific to the Vapi provider.")
13597
13743
  }).describe("Provider-specific voice configuration options. Only the options for the selected voiceProvider are used.");
13598
13744
 
@@ -13604,50 +13750,50 @@ var NangoSupportedMethods = [
13604
13750
  "PATCH",
13605
13751
  "DELETE"
13606
13752
  ];
13607
- var startingUrlSchema = z19.string().refine(isValidUrlOrHandlebarsTemplateString, {
13753
+ var startingUrlSchema = z21.string().refine(isValidUrlOrHandlebarsTemplateString, {
13608
13754
  message: "Starting URL must be a valid URL or Handlebars template"
13609
13755
  }).optional();
13610
- var browserSOMEnvironmentOptionsSchema = z19.object({
13611
- environment: z19.literal("browser").describe("Browser environment using Set of Marks (SOM) for element identification."),
13612
- maxMediaToIncludeInMemory: z19.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13756
+ var browserSOMEnvironmentOptionsSchema = z21.object({
13757
+ environment: z21.literal("browser").describe("Browser environment using Set of Marks (SOM) for element identification."),
13758
+ maxMediaToIncludeInMemory: z21.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13613
13759
  somFilter: somFilterConfigSchema.optional().describe("Default SOM overlay filter to apply for each browser iteration until the somFilter tool sets or clears a session filter."),
13614
- saveAuthCookiesAfterRun: z19.boolean().optional().describe("Whether to save authentication cookies after the run completes for reuse in future runs."),
13615
- suppressNativePrint: z19.boolean().optional().describe("Suppress native window.print dialogs for the whole browser session while still recording print calls."),
13760
+ saveAuthCookiesAfterRun: z21.boolean().optional().describe("Whether to save authentication cookies after the run completes for reuse in future runs."),
13761
+ suppressNativePrint: z21.boolean().optional().describe("Suppress native window.print dialogs for the whole browser session while still recording print calls."),
13616
13762
  startingUrl: startingUrlSchema.describe("Initial URL to navigate to when the agent starts. Accepts a valid URL or a Handlebars template with agent inputs. If not provided, uses the current URL of the browser; if this is the first agent, it will be a blank page."),
13617
- browserProvider: z19.nativeEnum(BrowserProviderNames).default(BrowserProviderNames.browserbase).describe("Browser provider to use if this agent is the first in a run to create a browser."),
13763
+ browserProvider: z21.nativeEnum(BrowserProviderNames).default(BrowserProviderNames.browserbase).describe("Browser provider to use if this agent is the first in a run to create a browser."),
13618
13764
  browserProviderOptions: browserProviderOptionsSchema.optional().describe("Provider-specific configuration options for the browser.")
13619
13765
  }).describe("Browser environment configuration using Set of Marks (SOM) for element identification. This is the recommended browser mode for most use cases.");
13620
- var browserCoordinatesEnvironmentOptionsSchema = z19.object({
13621
- environment: z19.literal("browserCoordinates").describe("Browser environment using coordinate-based interactions instead of SOM."),
13622
- maxMediaToIncludeInMemory: z19.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13623
- saveAuthCookiesAfterRun: z19.boolean().optional().describe("Whether to save authentication cookies after the run completes for reuse in future runs."),
13624
- suppressNativePrint: z19.boolean().optional().describe("Suppress native window.print dialogs for the whole browser session while still recording print calls."),
13766
+ var browserCoordinatesEnvironmentOptionsSchema = z21.object({
13767
+ environment: z21.literal("browserCoordinates").describe("Browser environment using coordinate-based interactions instead of SOM."),
13768
+ maxMediaToIncludeInMemory: z21.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13769
+ saveAuthCookiesAfterRun: z21.boolean().optional().describe("Whether to save authentication cookies after the run completes for reuse in future runs."),
13770
+ suppressNativePrint: z21.boolean().optional().describe("Suppress native window.print dialogs for the whole browser session while still recording print calls."),
13625
13771
  startingUrl: startingUrlSchema.describe("Initial URL to navigate to when the agent starts. Accepts a valid URL or a Handlebars template with agent inputs. If not provided, uses the current URL of the browser; if this is the first agent, it will be a blank page."),
13626
- browserProvider: z19.nativeEnum(BrowserProviderNames).default(BrowserProviderNames.browserbase).describe("Browser provider to use if this agent is the first in a run to create a browser."),
13772
+ browserProvider: z21.nativeEnum(BrowserProviderNames).default(BrowserProviderNames.browserbase).describe("Browser provider to use if this agent is the first in a run to create a browser."),
13627
13773
  browserProviderOptions: browserProviderOptionsSchema.optional().describe("Provider-specific configuration options for the browser.")
13628
13774
  }).describe("Browser environment configuration using coordinate-based interactions. Use for scenarios where SOM-based identification is insufficient.");
13629
- var guacamoleEnvironmentOptionsSchema = z19.object({
13630
- environment: z19.literal("desktop").describe("Desktop environment using Guacamole for remote desktop access."),
13631
- browserProvider: z19.nativeEnum(BrowserProviderNames).default(BrowserProviderNames.browserbase).describe("Browser provider to use to connect to Guacamole."),
13775
+ var guacamoleEnvironmentOptionsSchema = z21.object({
13776
+ environment: z21.literal("desktop").describe("Desktop environment using Guacamole for remote desktop access."),
13777
+ browserProvider: z21.nativeEnum(BrowserProviderNames).default(BrowserProviderNames.browserbase).describe("Browser provider to use to connect to Guacamole."),
13632
13778
  browserProviderOptions: browserProviderOptionsSchema.optional().describe("Provider-specific configuration options."),
13633
- maxMediaToIncludeInMemory: z19.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13779
+ maxMediaToIncludeInMemory: z21.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13634
13780
  startingUrl: startingUrlSchema.describe("Initial URL for the Guacamole connection. Accepts a valid URL or a Handlebars template with agent inputs."),
13635
- useCopyPasteForTyping: z19.boolean().default(false).optional().describe("Use copy-paste instead of keystroke simulation for text input. Can improve reliability in some desktop applications.")
13781
+ useCopyPasteForTyping: z21.boolean().default(false).optional().describe("Use copy-paste instead of keystroke simulation for text input. Can improve reliability in some desktop applications.")
13636
13782
  }).describe("Desktop environment configuration using Guacamole for remote desktop automation.");
13637
- var desktopAppEnvironmentOptionsSchema = z19.object({
13638
- environment: z19.literal("desktopApp").describe("Native application environment for mobile or desktop app automation."),
13639
- maxMediaToIncludeInMemory: z19.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13783
+ var desktopAppEnvironmentOptionsSchema = z21.object({
13784
+ environment: z21.literal("desktopApp").describe("Native application environment for mobile or desktop app automation."),
13785
+ maxMediaToIncludeInMemory: z21.number().min(1).optional().describe("Maximum number of screenshots/media items to keep in the agent memory context."),
13640
13786
  viewport: viewportSizeSchema.optional().describe(`Target viewport dimensions for screenshots and coordinate-based actions. Defaults to ${BROWSER_DEFAULT_VIEWPORT.width}x${BROWSER_DEFAULT_VIEWPORT.height} when omitted.`)
13641
13787
  }).describe("Native application environment configuration for automating mobile or desktop applications.");
13642
- var minimalEnvironmentOptionsSchema = z19.object({
13643
- environment: z19.literal("minimal").describe("Minimal environment without browser or desktop capabilities. Use for non-UI agents.")
13788
+ var minimalEnvironmentOptionsSchema = z21.object({
13789
+ environment: z21.literal("minimal").describe("Minimal environment without browser or desktop capabilities. Use for non-UI agents.")
13644
13790
  }).describe("Minimal environment configuration for agents that do not require browser or desktop access (e.g., API-only agents).");
13645
- var voiceEnvironmentOptionsSchema = z19.object({
13646
- environment: z19.literal("voice").describe("Hosted voice environment for live phone or audio conversations."),
13647
- voiceProvider: z19.nativeEnum(VoiceProviderNames).default(VoiceProviderNames.vapi).describe("Voice provider to use if this agent is the first in a run to create or attach to a live call."),
13791
+ var voiceEnvironmentOptionsSchema = z21.object({
13792
+ environment: z21.literal("voice").describe("Hosted voice environment for live phone or audio conversations."),
13793
+ voiceProvider: z21.nativeEnum(VoiceProviderNames).default(VoiceProviderNames.vapi).describe("Voice provider to use if this agent is the first in a run to create or attach to a live call."),
13648
13794
  voiceProviderOptions: voiceProviderOptionsSchema.optional().describe("Provider-specific configuration options for voice runtime.")
13649
13795
  }).describe("Voice environment configuration for hosted conversational runtimes such as Vapi.");
13650
- var environmentOptionsSchema = z19.discriminatedUnion("environment", [
13796
+ var environmentOptionsSchema = z21.discriminatedUnion("environment", [
13651
13797
  browserSOMEnvironmentOptionsSchema,
13652
13798
  browserCoordinatesEnvironmentOptionsSchema,
13653
13799
  guacamoleEnvironmentOptionsSchema,
@@ -13658,7 +13804,7 @@ var environmentOptionsSchema = z19.discriminatedUnion("environment", [
13658
13804
  var runSettingsBrowserSOMEnvironmentOptionsSchema = browserSOMEnvironmentOptionsSchema.omit({
13659
13805
  somFilter: true
13660
13806
  }).describe("Browser environment configuration using Set of Marks (SOM) for element identification. This is the recommended browser mode for most use cases.");
13661
- var runSettingsEnvironmentOptionsSchema = z19.discriminatedUnion("environment", [
13807
+ var runSettingsEnvironmentOptionsSchema = z21.discriminatedUnion("environment", [
13662
13808
  runSettingsBrowserSOMEnvironmentOptionsSchema,
13663
13809
  browserCoordinatesEnvironmentOptionsSchema,
13664
13810
  guacamoleEnvironmentOptionsSchema,
@@ -13674,14 +13820,14 @@ var environmentNames = [
13674
13820
  "voice",
13675
13821
  "minimal"
13676
13822
  ];
13677
- var environmentNamesSchema = z19.enum(environmentNames).describe("Available environment types: browser (SOM-based), browserCoordinates (coordinate-based), desktop (Guacamole), desktopApp, voice, or minimal.");
13823
+ var environmentNamesSchema = z21.enum(environmentNames).describe("Available environment types: browser (SOM-based), browserCoordinates (coordinate-based), desktop (Guacamole), desktopApp, voice, or minimal.");
13678
13824
  var DEFAULT_ENVIRONMENT_OPTION = environmentOptionsSchema.parse({
13679
13825
  environment: "browser"
13680
13826
  });
13681
- var passkeyLeaseScopeSchema = z19.enum(["session", "authStep"]).describe("Passkey lock lifetime. session holds the passkey lease for the browser session; authStep starts the lease before WebAuthn is armed for login and releases it after assertion so the passkey can be reused sooner.");
13682
- var resourcePoolReferenceSchema = z19.object({
13683
- id: z19.string().uuid().describe("Unique identifier of the resource pool."),
13684
- type: z19.enum([
13827
+ var passkeyLeaseScopeSchema = z21.enum(["session", "authStep"]).describe("Passkey lock lifetime. session holds the passkey lease for the browser session; authStep starts the lease before WebAuthn is armed for login and releases it after assertion so the passkey can be reused sooner.");
13828
+ var resourcePoolReferenceSchema = z21.object({
13829
+ id: z21.string().uuid().describe("Unique identifier of the resource pool."),
13830
+ type: z21.enum([
13685
13831
  "commandGenerated",
13686
13832
  "proxy",
13687
13833
  "apiAuthentication",
@@ -13691,21 +13837,21 @@ var resourcePoolReferenceSchema = z19.object({
13691
13837
  passkeyLeaseScope: passkeyLeaseScopeSchema.optional()
13692
13838
  });
13693
13839
  var MAX_RESOURCE_POOLS_PER_STARTING_AGENT = 8;
13694
- var resourcePoolsSchema = z19.array(resourcePoolReferenceSchema).max(MAX_RESOURCE_POOLS_PER_STARTING_AGENT, "Only eight resource pools per starting agent are currently supported").optional();
13695
- var agentRunSettingsSchema = z19.object({
13840
+ var resourcePoolsSchema = z21.array(resourcePoolReferenceSchema).max(MAX_RESOURCE_POOLS_PER_STARTING_AGENT, "Only eight resource pools per starting agent are currently supported").optional();
13841
+ var agentRunSettingsSchema = z21.object({
13696
13842
  environmentOptions: runSettingsEnvironmentOptionsSchema.optional().describe("Canonical run-level browser/session settings used when this agent is selected as the run settings source. Agent-owned fields such as startingUrl and maxMediaToIncludeInMemory are intentionally ignored at runtime even if present here."),
13697
13843
  resourcePools: resourcePoolsSchema.describe("Managed resource pools used when this agent is selected as the run settings source. These may be persisted on any agent even when that agent is not currently a top-level run settings source."),
13698
- skipBrowserDebuggerPauses: z19.boolean().optional().describe("Run-level browser session startup setting. When run settings mode is active, this value is snapshotted from runSettings and legacy agent-local values are ignored.")
13844
+ skipBrowserDebuggerPauses: z21.boolean().optional().describe("Run-level browser session startup setting. When run settings mode is active, this value is snapshotted from runSettings and legacy agent-local values are ignored.")
13699
13845
  });
13700
- var remoteFileConnectionSchema = z19.object({
13701
- description: z19.string().describe("Human-readable description of this remote file connection."),
13702
- host: z19.string().describe("Hostname or IP address of the remote server."),
13703
- port: z19.number().describe("Port number for the connection (e.g., 22 for SFTP)."),
13704
- protocol: z19.enum(["sftp"]).describe("Protocol to use for the connection. Currently only SFTP is supported."),
13705
- opItemId: z19.string().describe("1Password item ID containing the credentials."),
13706
- opVaultId: z19.string().describe("1Password vault ID containing the item.")
13846
+ var remoteFileConnectionSchema = z21.object({
13847
+ description: z21.string().describe("Human-readable description of this remote file connection."),
13848
+ host: z21.string().describe("Hostname or IP address of the remote server."),
13849
+ port: z21.number().describe("Port number for the connection (e.g., 22 for SFTP)."),
13850
+ protocol: z21.enum(["sftp"]).describe("Protocol to use for the connection. Currently only SFTP is supported."),
13851
+ opItemId: z21.string().describe("1Password item ID containing the credentials."),
13852
+ opVaultId: z21.string().describe("1Password vault ID containing the item.")
13707
13853
  }).describe("Remote file connection configuration for SFTP access. Credentials are stored securely in 1Password.");
13708
- var workflowIdReusePolicySchema = z19.enum(["ALLOW_DUPLICATE", "ALLOW_DUPLICATE_FAILED_ONLY"]).describe("Controls Temporal workflow ID reuse. ALLOW_DUPLICATE allows rerunning with the same ID. ALLOW_DUPLICATE_FAILED_ONLY only allows reuse if the previous run failed.");
13854
+ var workflowIdReusePolicySchema = z21.enum(["ALLOW_DUPLICATE", "ALLOW_DUPLICATE_FAILED_ONLY"]).describe("Controls Temporal workflow ID reuse. ALLOW_DUPLICATE allows rerunning with the same ID. ALLOW_DUPLICATE_FAILED_ONLY only allows reuse if the previous run failed.");
13709
13855
  var codeLanguages = ["typescript"];
13710
13856
  var windowsAbsolutePathPattern = /^[A-Za-z]:[\\/]/u;
13711
13857
  function hasControlCharacter(value) {
@@ -13717,113 +13863,113 @@ function hasControlCharacter(value) {
13717
13863
  }
13718
13864
  return false;
13719
13865
  }
13720
- function isNormalizedRepoPath(path7) {
13721
- if (path7 === "/") {
13866
+ function isNormalizedRepoPath(path8) {
13867
+ if (path8 === "/") {
13722
13868
  return true;
13723
13869
  }
13724
- if (path7.length === 0 || path7.startsWith("/") || path7.startsWith("\\") || path7.includes("\\") || hasControlCharacter(path7) || windowsAbsolutePathPattern.test(path7)) {
13870
+ if (path8.length === 0 || path8.startsWith("/") || path8.startsWith("\\") || path8.includes("\\") || hasControlCharacter(path8) || windowsAbsolutePathPattern.test(path8)) {
13725
13871
  return false;
13726
13872
  }
13727
- return path7.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== ".." && segment !== ".git");
13873
+ return path8.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== ".." && segment !== ".git");
13728
13874
  }
13729
- function normalizeRepoPath(path7) {
13730
- if (path7 === "/") {
13731
- return path7;
13875
+ function normalizeRepoPath(path8) {
13876
+ if (path8 === "/") {
13877
+ return path8;
13732
13878
  }
13733
- return path7.replaceAll(/\/+$/gu, "");
13879
+ return path8.replaceAll(/\/+$/gu, "");
13734
13880
  }
13735
13881
  var skillPathPattern = /^(?:skills\/.+|automations\/[^/]+\/skills\/.+|automations\/[^/]+\/agents\/[^/]+\/skills\/.+)$/u;
13736
- var repoPathSchema = z19.string().min(1).transform(normalizeRepoPath).refine(isNormalizedRepoPath, {
13882
+ var repoPathSchema = z21.string().min(1).transform(normalizeRepoPath).refine(isNormalizedRepoPath, {
13737
13883
  message: "Path must be a normalized repository-relative path."
13738
13884
  });
13739
- var knowledgeBasePluginPermissionSchema = z19.object({
13885
+ var knowledgeBasePluginPermissionSchema = z21.object({
13740
13886
  path: repoPathSchema.refine(getIsKnowledgeBaseAssetPathAllowed, {
13741
13887
  message: "Knowledge Base paths must be under org, automation, or automation-agent assets."
13742
13888
  }).describe("Repository path the knowledge base plugin can access."),
13743
- access: z19.enum(["read", "write"]).describe("Access level for the path. Write access also grants reads.")
13889
+ access: z21.enum(["read", "write"]).describe("Access level for the path. Write access also grants reads.")
13744
13890
  }).describe("Path-scoped permission for the knowledge base runtime plugin.");
13745
- var knowledgeBaseConfigSchema = z19.object({
13746
- enabled: z19.boolean().default(false).describe("Explicit rollout switch for the knowledge base runtime plugin."),
13747
- permissions: z19.array(knowledgeBasePluginPermissionSchema).min(1).describe("Repository paths the knowledge base plugin can access. Write grants read and write access.")
13891
+ var knowledgeBaseConfigSchema = z21.object({
13892
+ enabled: z21.boolean().default(false).describe("Explicit rollout switch for the knowledge base runtime plugin."),
13893
+ permissions: z21.array(knowledgeBasePluginPermissionSchema).min(1).describe("Repository paths the knowledge base plugin can access. Write grants read and write access.")
13748
13894
  }).describe("Configuration for the knowledge base runtime plugin.");
13749
- var memoryConfigSchema = z19.object({
13750
- enabled: z19.boolean().default(false).describe("Explicit rollout switch for the memory runtime plugin.")
13895
+ var memoryConfigSchema = z21.object({
13896
+ enabled: z21.boolean().default(false).describe("Explicit rollout switch for the memory runtime plugin.")
13751
13897
  }).strict().describe("Configuration for the memory runtime plugin.");
13752
- var skillsConfigSchema = z19.object({
13753
- enabled: z19.boolean().default(false).describe("Explicit rollout switch for the skills runtime plugin."),
13754
- registeredSkills: z19.array(repoPathSchema.refine((path7) => skillPathPattern.test(path7), {
13898
+ var skillsConfigSchema = z21.object({
13899
+ enabled: z21.boolean().default(false).describe("Explicit rollout switch for the skills runtime plugin."),
13900
+ registeredSkills: z21.array(repoPathSchema.refine((path8) => skillPathPattern.test(path8), {
13755
13901
  message: "Skill paths must be under root, automation, or automation-agent skills."
13756
13902
  })).default(() => []).describe("Repository skill root paths available to the skills plugin."),
13757
- canEdit: z19.boolean().default(false).describe("Allows the skills runtime plugin to edit repo skills under the root skills folder.")
13903
+ canEdit: z21.boolean().default(false).describe("Allows the skills runtime plugin to edit repo skills under the root skills folder.")
13758
13904
  }).describe("Configuration for the skills runtime plugin.");
13759
- var agentPluginsConfigSchema = z19.object({
13905
+ var agentPluginsConfigSchema = z21.object({
13760
13906
  knowledgeBase: knowledgeBaseConfigSchema.optional().describe("Enables the knowledge base runtime plugin."),
13761
13907
  memory: memoryConfigSchema.optional().describe("Enables the memory runtime plugin."),
13762
13908
  skills: skillsConfigSchema.optional().describe("Enables the skills runtime plugin.")
13763
13909
  }).optional().describe("Runtime plugins enabled for this agent. Plugin tools are not controlled by the built-in tools allow-list.");
13764
- var baseAgentConfigFieldsSchema = z19.object({
13765
- apiTools: z19.array(apiToolSchema).optional().describe("Custom API tools available to this agent. Each tool defines an HTTP endpoint the agent can call."),
13766
- remoteFileConnections: z19.array(remoteFileConnectionSchema).optional().describe("Remote file server connections for SFTP operations. Enables agents to read/write files on remote servers."),
13910
+ var baseAgentConfigFieldsSchema = z21.object({
13911
+ apiTools: z21.array(apiToolSchema).optional().describe("Custom API tools available to this agent. Each tool defines an HTTP endpoint the agent can call."),
13912
+ remoteFileConnections: z21.array(remoteFileConnectionSchema).optional().describe("Remote file server connections for SFTP operations. Enables agents to read/write files on remote servers."),
13767
13913
  resourcePools: resourcePoolsSchema.describe("Deprecated compatibility shadow of runSettings.resourcePools. Keep mirrored with runSettings.resourcePools during the migration. New runtime logic should prefer runSettings.resourcePools. Maximum 8 pools per starting agent."),
13768
- tools: z19.array(z19.enum(baseToolNames)).optional().default(() => []).describe("List of built-in tools enabled for this agent (e.g., click, clickFill, scroll, navigateTo). Note: reportStop is always included by default, callSpecializedAgent is included if the agent has child agents, and queueAgents is included if queueableAgentIds is configured. An empty array will still have these automatically included tools."),
13769
- knowledgeBase: z19.object({
13770
- namespace: z19.string().describe("Vector database namespace for knowledge retrieval."),
13771
- k: z19.number().describe("Number of results to retrieve from the knowledge base per query.")
13914
+ tools: z21.array(z21.enum(baseToolNames)).optional().default(() => []).describe("List of built-in tools enabled for this agent (e.g., click, clickFill, scroll, navigateTo). Note: reportStop is always included by default, callSpecializedAgent is included if the agent has child agents, and queueAgents is included if queueableAgentIds is configured. An empty array will still have these automatically included tools."),
13915
+ knowledgeBase: z21.object({
13916
+ namespace: z21.string().describe("Vector database namespace for knowledge retrieval."),
13917
+ k: z21.number().describe("Number of results to retrieve from the knowledge base per query.")
13772
13918
  }).optional().describe("Knowledge base configuration for RAG (Retrieval-Augmented Generation). Enables the agent to query a vector database."),
13773
13919
  plugins: agentPluginsConfigSchema,
13774
- maxSessionMessages: z19.number().optional().describe("Maximum number of messages to keep in the agent session memory. Older messages are pruned to stay within this limit."),
13920
+ maxSessionMessages: z21.number().optional().describe("Maximum number of messages to keep in the agent session memory. Older messages are pruned to stay within this limit."),
13775
13921
  environmentOptions: environmentOptionsSchema.optional().default(DEFAULT_ENVIRONMENT_OPTION).describe("Environment configuration for the agent. Default is browser with SOM."),
13776
13922
  runSettings: agentRunSettingsSchema.optional().describe("Run settings persisted on the agent and used when this agent is selected as the settings source for a run while the run-settings rollout is enabled. This is the canonical runtime source for resource pools during the migration. It intentionally mirrors a subset of agent config so settings survive topology changes and can be stored on any agent regardless of that agent's own execution environment. Writers may populate this before the rollout flag is enabled, but runtime snapshotting must keep using legacy fields while the flag is disabled."),
13777
- skipBrowserDebuggerPauses: z19.boolean().optional().describe("Legacy agent-local browser session startup setting. Used only when a run is in legacy config mode; canonical run settings mode reads runSettings.skipBrowserDebuggerPauses instead."),
13923
+ skipBrowserDebuggerPauses: z21.boolean().optional().describe("Legacy agent-local browser session startup setting. Used only when a run is in legacy config mode; canonical run settings mode reads runSettings.skipBrowserDebuggerPauses instead."),
13778
13924
  limitations: agentRunLimitationSchema.describe("Resource limits for this agent, including maximum duration and tool call limits."),
13779
- commonParametersSchema: z19.custom().optional().describe("Custom schema defining metadata the agent must provide with every tool call. By default, agents provide reasoning and step information. If specified, this schema replaces the default metadata schema entirely."),
13780
- idempotencySettings: z19.object({
13781
- include: z19.array(z19.string()).optional().describe("Input field names to include in the idempotency key. If specified, only these fields are used."),
13782
- exclude: z19.array(z19.string()).optional().describe("Input field names to exclude from the idempotency key. Ignored if include is specified."),
13925
+ commonParametersSchema: z21.custom().optional().describe("Custom schema defining metadata the agent must provide with every tool call. By default, agents provide reasoning and step information. If specified, this schema replaces the default metadata schema entirely."),
13926
+ idempotencySettings: z21.object({
13927
+ include: z21.array(z21.string()).optional().describe("Input field names to include in the idempotency key. If specified, only these fields are used."),
13928
+ exclude: z21.array(z21.string()).optional().describe("Input field names to exclude from the idempotency key. Ignored if include is specified."),
13783
13929
  workflowIdReusePolicy: workflowIdReusePolicySchema.optional().default("ALLOW_DUPLICATE").describe("Policy for reusing Temporal workflow IDs.")
13784
13930
  }).optional().describe("Idempotency settings for preventing duplicate runs. Controls which input fields contribute to the unique run identifier."),
13785
- taskQueue: z19.string().optional().describe("Temporal task queue name for this agent. If specified, queued child agents run on this queue instead of the parent queue."),
13786
- waitUponQueueing: z19.boolean().optional().default(false).describe("If true, wait for queued child agents to complete before proceeding."),
13787
- queueableAgentIds: z19.array(brandedStringValidator("agentId")).optional().default(() => []).describe("List of agent IDs that this agent can queue using the queueAgents tool. Enables the agent to run a new automation with a different agent as the starting point."),
13788
- callableAgentIds: z19.array(brandedStringValidator("agentId")).optional().describe("List of external root agent IDs that this agent can call using the callSpecializedAgent tool. Same-automation callable agents continue to be configured by graph connections."),
13789
- queuedAgentVariables: z19.record(brandedStringValidator("agentId"), z19.record(z19.string(), z19.unknown())).optional().describe("Static automation variable values to pass when this agent queues another automation by target agent ID."),
13790
- checkpoint: z19.object({
13791
- name: z19.string().describe("Name for the checkpoint, used for filtering and identification."),
13792
- screenshot: z19.boolean().optional().default(false).describe("Whether to capture a screenshot when creating the checkpoint.")
13931
+ taskQueue: z21.string().optional().describe("Temporal task queue name for this agent. If specified, queued child agents run on this queue instead of the parent queue."),
13932
+ waitUponQueueing: z21.boolean().optional().default(false).describe("If true, wait for queued child agents to complete before proceeding."),
13933
+ queueableAgentIds: z21.array(brandedStringValidator("agentId")).optional().default(() => []).describe("List of agent IDs that this agent can queue using the queueAgents tool. Enables the agent to run a new automation with a different agent as the starting point."),
13934
+ callableAgentIds: z21.array(brandedStringValidator("agentId")).optional().describe("List of external root agent IDs that this agent can call using the callSpecializedAgent tool. Same-automation callable agents continue to be configured by graph connections."),
13935
+ queuedAgentVariables: z21.record(brandedStringValidator("agentId"), z21.record(z21.string(), z21.unknown())).optional().describe("Static automation variable values to pass when this agent queues another automation by target agent ID."),
13936
+ checkpoint: z21.object({
13937
+ name: z21.string().describe("Name for the checkpoint, used for filtering and identification."),
13938
+ screenshot: z21.boolean().optional().default(false).describe("Whether to capture a screenshot when creating the checkpoint.")
13793
13939
  }).optional().describe("Checkpoint configuration. When set, agent iterations are recorded as checkpoints for auditing and debugging."),
13794
- systemPrompt: z19.string().optional().describe("Custom system prompt that replaces the default system prompt for this agent. Combined with automation-level and agent-level additionalSystemPrompt values."),
13795
- additionalSystemPrompt: z19.string().optional().describe("Additional instructions appended to the system prompt for this agent. Combined with automation-level additionalSystemPrompt."),
13940
+ systemPrompt: z21.string().optional().describe("Custom system prompt that replaces the default system prompt for this agent. Combined with automation-level and agent-level additionalSystemPrompt values."),
13941
+ additionalSystemPrompt: z21.string().optional().describe("Additional instructions appended to the system prompt for this agent. Combined with automation-level additionalSystemPrompt."),
13796
13942
  // Backlinking metadata for imported agents
13797
- importedFrom: z19.object({
13943
+ importedFrom: z21.object({
13798
13944
  automationId: brandedStringValidator("draftAutomationId").describe("ID of the source automation from which this agent was imported."),
13799
13945
  originalAgentId: brandedStringValidator("agentId").describe("Original agent ID in the source automation.")
13800
13946
  }).optional().describe("Metadata for agents imported from another automation. Used for traceability and updates."),
13801
- ignoreUnstableSessionState: z19.boolean().optional().describe("When true, skips screenshot consistency checks before tool execution. Overrides the automation-level ignoreUnstableSessionState setting."),
13802
- pointOfNoReturn: z19.object({
13803
- keyFields: z19.array(z19.string().trim().min(1).refine((keyField) => parsePointOfNoReturnKeyFieldPath(keyField) !== void 0, "PONR key fields must start with input. or store. and use safe path segments")).min(1).describe("Paths resolved against the current node input or automation store into the work-item business key. A path that cannot be resolved fails closed.")
13947
+ ignoreUnstableSessionState: z21.boolean().optional().describe("When true, skips screenshot consistency checks before tool execution. Overrides the automation-level ignoreUnstableSessionState setting."),
13948
+ pointOfNoReturn: z21.object({
13949
+ keyFields: z21.array(z21.string().trim().min(1).refine((keyField) => parsePointOfNoReturnKeyFieldPath(keyField) !== void 0, "PONR key fields must start with input. or store. and use safe path segments")).min(1).describe("Paths resolved against the current node input or automation store into the work-item business key. A path that cannot be resolved fails closed.")
13804
13950
  }).optional().describe("Marks this node as a point of no return. Once the work item identified by keyFields crosses this node, the node and everything downstream never auto-run again; recovery is override-only.")
13805
13951
  }).superRefine((config, ctx) => {
13806
13952
  if (config.resourcePools !== void 0 && config.runSettings?.resourcePools !== void 0 && !isDeepEqualAndSameType(config.resourcePools, config.runSettings.resourcePools)) {
13807
13953
  ctx.addIssue({
13808
- code: z19.ZodIssueCode.custom,
13954
+ code: z21.ZodIssueCode.custom,
13809
13955
  path: ["runSettings", "resourcePools"],
13810
13956
  message: "runSettings.resourcePools must match resourcePools when both are provided"
13811
13957
  });
13812
13958
  }
13813
13959
  });
13814
13960
  var agenticAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13815
- type: z19.literal("agentic").describe("Agentic agent type - autonomous AI agent with tool calling capabilities."),
13961
+ type: z21.literal("agentic").describe("Agentic agent type - autonomous AI agent with tool calling capabilities."),
13816
13962
  model: agentModelConfigSchema.describe("LLM model configuration for this agentic agent.")
13817
13963
  }).describe("Agentic agent configuration. Uses an LLM to autonomously decide which tools to call to accomplish tasks.");
13818
13964
  var codeAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13819
- type: z19.literal("code").describe("Code agent type - executes predefined code instead of LLM-driven decisions."),
13820
- language: z19.enum(codeLanguages).default("typescript").describe("Programming language for the agent code. Currently only TypeScript is supported.")
13965
+ type: z21.literal("code").describe("Code agent type - executes predefined code instead of LLM-driven decisions."),
13966
+ language: z21.enum(codeLanguages).default("typescript").describe("Programming language for the agent code. Currently only TypeScript is supported.")
13821
13967
  }).describe("Code agent configuration. Executes predefined TypeScript code instead of using LLM-driven decision making.");
13822
13968
  var outputStoreSourcePathRegex = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*)*$/u;
13823
- var outputStoreBindingSchema = z19.object({
13824
- sourcePath: z19.string().refine((sourcePath) => sourcePath === "$" || outputStoreSourcePathRegex.test(sourcePath), 'Output source path must be "$" or a dot path such as patient.name.').describe("Dot path of the node output value to write."),
13969
+ var outputStoreBindingSchema = z21.object({
13970
+ sourcePath: z21.string().refine((sourcePath) => sourcePath === "$" || outputStoreSourcePathRegex.test(sourcePath), 'Output source path must be "$" or a dot path such as patient.name.').describe("Dot path of the node output value to write."),
13825
13971
  storePath: outputStorePathSchema.describe("Fully qualified Data Store path that receives the output."),
13826
- arrayMode: z19.enum(["append", "appendList", "replace"]).optional().describe("Required for newly authored array destinations: append adds exactly one item, appendList adds multiple items, and replace sets the complete list. Omit for scalar and Object destinations; Object values replace the complete object. Legacy omitted array modes still append at runtime.")
13972
+ arrayMode: z21.enum(["append", "appendList", "replace"]).optional().describe("Required for newly authored array destinations: append adds exactly one item, appendList adds multiple items, and replace sets the complete list. Omit for scalar and Object destinations; Object values replace the complete object. Legacy omitted array modes still append at runtime.")
13827
13973
  }).describe("Maps one node output value to one Data Store destination.");
13828
13974
  function validateUniqueOutputStoreBindings(bindings, ctx) {
13829
13975
  const sourcePaths = /* @__PURE__ */ new Set();
@@ -13831,7 +13977,7 @@ function validateUniqueOutputStoreBindings(bindings, ctx) {
13831
13977
  for (const [index, { sourcePath, storePath }] of bindings.entries()) {
13832
13978
  if (sourcePaths.has(sourcePath)) {
13833
13979
  ctx.addIssue({
13834
- code: z19.ZodIssueCode.custom,
13980
+ code: z21.ZodIssueCode.custom,
13835
13981
  path: [index, "sourcePath"],
13836
13982
  message: `Output source path "${sourcePath}" can only have one Data Store destination.`
13837
13983
  });
@@ -13839,7 +13985,7 @@ function validateUniqueOutputStoreBindings(bindings, ctx) {
13839
13985
  sourcePaths.add(sourcePath);
13840
13986
  if (storePaths.has(storePath)) {
13841
13987
  ctx.addIssue({
13842
- code: z19.ZodIssueCode.custom,
13988
+ code: z21.ZodIssueCode.custom,
13843
13989
  path: [index, "storePath"],
13844
13990
  message: `Data Store destination "${storePath}" can only be written once by this node.`
13845
13991
  });
@@ -13847,12 +13993,12 @@ function validateUniqueOutputStoreBindings(bindings, ctx) {
13847
13993
  storePaths.add(storePath);
13848
13994
  }
13849
13995
  }
13850
- var extractOutputStoreBindingsSchema = z19.array(outputStoreBindingSchema).superRefine((bindings, ctx) => {
13996
+ var extractOutputStoreBindingsSchema = z21.array(outputStoreBindingSchema).superRefine((bindings, ctx) => {
13851
13997
  validateUniqueOutputStoreBindings(bindings, ctx);
13852
13998
  for (const [index, { sourcePath }] of bindings.entries()) {
13853
13999
  if (sourcePath === "$") {
13854
14000
  ctx.addIssue({
13855
- code: z19.ZodIssueCode.custom,
14001
+ code: z21.ZodIssueCode.custom,
13856
14002
  path: [index, "sourcePath"],
13857
14003
  message: "Extract output bindings must use a declared output path."
13858
14004
  });
@@ -13860,62 +14006,65 @@ var extractOutputStoreBindingsSchema = z19.array(outputStoreBindingSchema).super
13860
14006
  }
13861
14007
  }).describe("Optional mappings from declared Extract output fields to Data Store destinations.");
13862
14008
  var extractAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13863
- type: z19.literal("extract").describe("Extract agent type - specialized for structured data extraction."),
14009
+ type: z21.literal("extract").describe("Extract agent type - specialized for structured data extraction."),
13864
14010
  model: agentModelConfigSchema.describe("LLM model configuration for this extract agent."),
13865
14011
  outputStoreBindings: extractOutputStoreBindingsSchema.optional()
13866
14012
  }).describe("Extract agent configuration. Specialized for extracting structured data from files according to a defined output schema.");
13867
- var OutcomePayloadSchema = z19.object({
13868
- id: z19.string().min(1).describe("Unique identifier for the outcome."),
13869
- input: z19.record(z19.string(), z19.unknown()).describe("Input data for the outcome. Maps parameter keys to values."),
13870
- preview: z19.string().describe("Rendered text representation of the outcome.")
14013
+ var OutcomePayloadSchema = z21.object({
14014
+ id: z21.string().min(1).describe("Unique identifier for the outcome."),
14015
+ input: z21.record(z21.string(), z21.unknown()).describe("Input data for the outcome. Maps parameter keys to values."),
14016
+ preview: z21.string().describe("Rendered text representation of the outcome.")
13871
14017
  });
13872
14018
  var branchAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13873
- type: z19.literal("branch").describe("Decision agent type - makes decisions to route to different agents."),
14019
+ type: z21.literal("branch").describe("Decision agent type - makes decisions to route to different agents."),
13874
14020
  model: agentModelConfigSchema.describe("LLM model configuration for this decision agent."),
13875
- includeScreenshot: z19.boolean().optional().describe("Whether to include the previous agent's screen state in this decision agent's decision context."),
13876
- conditionsAndOutcomes: z19.object({
13877
- if: z19.array(z19.object({
13878
- caseName: z19.string().describe("Name of the condition case."),
13879
- condition: z19.string().min(1).describe("Condition to evaluate."),
13880
- outcome: z19.array(OutcomePayloadSchema).describe("Outcomes to return if the condition is met.")
14021
+ includeScreenshot: z21.boolean().optional().describe("Whether to include the previous agent's screen state in this decision agent's decision context."),
14022
+ conditionsAndOutcomes: z21.object({
14023
+ if: z21.array(z21.object({
14024
+ caseName: z21.string().describe("Name of the condition case."),
14025
+ condition: z21.string().min(1).describe("Condition to evaluate."),
14026
+ outcome: z21.array(OutcomePayloadSchema).describe("Outcomes to return if the condition is met.")
13881
14027
  })).min(1).describe("Conditions and outcomes for the decision agent."),
13882
- else: z19.array(OutcomePayloadSchema).min(1).describe("Outcomes to return if the condition is not met.")
14028
+ else: z21.array(OutcomePayloadSchema).min(1).describe("Outcomes to return if the condition is not met.")
13883
14029
  }).describe("Conditions and outcomes for the decision agent, including a fallback outcome.")
13884
14030
  }).describe("Decision agent configuration. Makes decisions about which agent to call next based on the current context.");
13885
14031
  var draftBranchAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13886
- type: z19.literal("branch").describe("Decision agent draft configuration. Allows incomplete conditions and outcomes while the agent is still being authored."),
14032
+ type: z21.literal("branch").describe("Decision agent draft configuration. Allows incomplete conditions and outcomes while the agent is still being authored."),
13887
14033
  model: agentModelConfigSchema.describe("LLM model configuration for this decision agent."),
13888
- includeScreenshot: z19.boolean().optional().describe("Whether to include the previous agent's screen state in this decision agent's decision context."),
13889
- conditionsAndOutcomes: z19.object({
13890
- if: z19.array(z19.object({
13891
- caseName: z19.string().describe("Name of the condition case."),
13892
- condition: z19.string().describe("Condition to evaluate. Draft saves may include an empty placeholder while the user is still editing."),
13893
- outcome: z19.array(OutcomePayloadSchema).describe("Outcomes to return if the condition is met.")
14034
+ includeScreenshot: z21.boolean().optional().describe("Whether to include the previous agent's screen state in this decision agent's decision context."),
14035
+ conditionsAndOutcomes: z21.object({
14036
+ if: z21.array(z21.object({
14037
+ caseName: z21.string().describe("Name of the condition case."),
14038
+ condition: z21.string().describe("Condition to evaluate. Draft saves may include an empty placeholder while the user is still editing."),
14039
+ outcome: z21.array(OutcomePayloadSchema).describe("Outcomes to return if the condition is met.")
13894
14040
  })).describe("Draft decision conditions and outcomes."),
13895
- else: z19.array(OutcomePayloadSchema).describe("Draft fallback outcomes for the decision agent. May be empty while the decision agent is still being configured.")
14041
+ else: z21.array(OutcomePayloadSchema).describe("Draft fallback outcomes for the decision agent. May be empty while the decision agent is still being configured.")
13896
14042
  }).describe("Draft conditions and outcomes for the decision agent, including an optional fallback outcome while editing.")
13897
14043
  }).describe("Decision agent draft configuration. More permissive than the authored decision schema so incomplete decision agents can be saved.");
13898
14044
  var METHODS_WITH_BODY = new Set(ApiMethodsWithBody);
13899
14045
  var apiAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13900
- type: z19.literal("api").describe("API agent type - makes HTTP requests to external APIs."),
13901
- method: z19.enum(NangoSupportedMethods).describe("HTTP method for the API request (GET, POST, PUT, PATCH, DELETE)."),
13902
- url: z19.string().describe("URL for the API endpoint. Can include placeholders like {paramName} for dynamic values from inputs."),
14046
+ type: z21.literal("api").describe("API agent type - makes HTTP requests to external APIs."),
14047
+ method: z21.enum(NangoSupportedMethods).describe("HTTP method for the API request (GET, POST, PUT, PATCH, DELETE)."),
14048
+ url: z21.string().describe("URL for the API endpoint. Can include placeholders like {paramName} for dynamic values from inputs."),
13903
14049
  baseUrlOverride: nangoBaseUrlOverrideSchema.optional().describe("Optional static base URL override for Nango-backed requests. Use when the request endpoint is hosted on a base URL different from the Nango provider default."),
13904
- headers: z19.array(z19.object({ key: z19.string(), value: z19.string() })).optional().describe("HTTP headers to include in the request. Values can include placeholders."),
13905
- queryParams: z19.array(z19.object({ key: z19.string(), value: z19.string() })).optional().describe("Query parameters to append to the URL. Values can include placeholders."),
13906
- body: z19.unknown().optional().describe("Request body for POST/PUT/PATCH requests. Can include placeholders for dynamic values."),
13907
- bodyType: z19.enum(ApiRequestBodyTypes).optional().describe("Request body encoding mode. Defaults to JSON when omitted. Use multipartFormData for typed form-data fields and formUrlEncoded for application/x-www-form-urlencoded payloads."),
13908
- outputJmesPath: z19.string().optional().describe("JMESPath expression to extract specific data from the API response before returning it."),
14050
+ headers: z21.array(z21.object({ key: z21.string(), value: z21.string() })).optional().describe("HTTP headers to include in the request. Values can include placeholders."),
14051
+ queryParams: z21.array(z21.object({ key: z21.string(), value: z21.string() })).optional().describe("Query parameters to append to the URL. Values can include placeholders."),
14052
+ body: z21.unknown().optional().describe("Request body for POST/PUT/PATCH requests. Can include placeholders for dynamic values."),
14053
+ bodyType: z21.enum(ApiRequestBodyTypes).optional().describe("Request body encoding mode. Defaults to JSON when omitted. Use multipartFormData for typed form-data fields and formUrlEncoded for application/x-www-form-urlencoded payloads."),
14054
+ requestFileEncodings: apiAgentRequestFileEncodingsSchema.optional(),
14055
+ outputJmesPath: z21.string().optional().describe("JMESPath expression to extract specific data from the API response before returning it."),
14056
+ outputMode: z21.enum(ApiAgentOutputModes).optional().describe("How to return the projected API response. File mode stores it as a permanent JSON file."),
14057
+ embeddedFiles: apiAgentEmbeddedFilesSchema.optional(),
13909
14058
  outputStoreBindings: apiOutputStoreBindingsSchema.optional(),
13910
14059
  cacheResponse: apiResponseCacheConfigSchema.describe("Response cache configuration for this API agent. TTL is measured in seconds."),
13911
- authentication: z19.discriminatedUnion("type", [
13912
- z19.object({
13913
- type: z19.literal("nangoConnection").describe("Authentication via Nango integration."),
13914
- providerConfigKey: z19.string().describe('The provider config key for the integration (e.g., "github", "slack").'),
14060
+ authentication: z21.discriminatedUnion("type", [
14061
+ z21.object({
14062
+ type: z21.literal("nangoConnection").describe("Authentication via Nango integration."),
14063
+ providerConfigKey: z21.string().describe('The provider config key for the integration (e.g., "github", "slack").'),
13915
14064
  poolId: brandedStringValidator("resourcePoolId").optional().describe("ID of the resource pool containing authentication credentials.")
13916
14065
  }),
13917
- z19.object({
13918
- type: z19.literal("customHost").describe("Authentication via 1Password credentials for custom host."),
14066
+ z21.object({
14067
+ type: z21.literal("customHost").describe("Authentication via 1Password credentials for custom host."),
13919
14068
  poolId: brandedStringValidator("resourcePoolId").optional().describe("ID of the resource pool containing 1Password authentication.")
13920
14069
  })
13921
14070
  ]).optional().describe("Authentication configuration for the API request. Uses credentials from a resource pool.")
@@ -13925,6 +14074,15 @@ var apiAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13925
14074
  }).refine((data) => !(data.bodyType !== void 0 && !METHODS_WITH_BODY.has(data.method)), {
13926
14075
  message: "Body type is not supported for this method",
13927
14076
  path: ["bodyType"]
14077
+ }).refine((data) => !data.requestFileEncodings?.length || METHODS_WITH_BODY.has(data.method), {
14078
+ message: "Request file encoding is not supported for this method",
14079
+ path: ["requestFileEncodings"]
14080
+ }).refine((data) => !data.requestFileEncodings?.length || (data.bodyType ?? "json") === "json", {
14081
+ message: "Request file encoding is only supported for JSON bodies",
14082
+ path: ["requestFileEncodings"]
14083
+ }).refine((data) => !data.requestFileEncodings?.length || data.body !== null && typeof data.body === "object" && !Array.isArray(data.body), {
14084
+ message: "Request file encoding requires a JSON object body",
14085
+ path: ["body"]
13928
14086
  }).refine((data) => isValidApiMultipartFormDataBody({
13929
14087
  bodyType: data.bodyType,
13930
14088
  body: data.body
@@ -13942,10 +14100,10 @@ var apiAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13942
14100
  path: ["baseUrlOverride"]
13943
14101
  }).describe("API agent configuration. Makes HTTP requests to external APIs without LLM decision making. Supports authentication via Nango connections.");
13944
14102
  var specializedAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
13945
- type: z19.literal("specialized").describe("Specialized agent type - runs a published specialized automation."),
13946
- specializedAutomationId: z19.string().min(1).describe("ID of the specialized automation to run.")
14103
+ type: z21.literal("specialized").describe("Specialized agent type - runs a published specialized automation."),
14104
+ specializedAutomationId: z21.string().min(1).describe("ID of the specialized automation to run.")
13947
14105
  }).describe("Specialized agent configuration. Runs a specialized automation shared by another organization and returns its output.");
13948
- var agentConfigSchemaUnion = z19.discriminatedUnion("type", [
14106
+ var agentConfigSchemaUnion = z21.discriminatedUnion("type", [
13949
14107
  agenticAgentConfigSchema,
13950
14108
  codeAgentConfigSchema,
13951
14109
  extractAgentConfigSchema,
@@ -13953,13 +14111,13 @@ var agentConfigSchemaUnion = z19.discriminatedUnion("type", [
13953
14111
  apiAgentConfigSchema,
13954
14112
  specializedAgentConfigSchema
13955
14113
  ]).describe("Agent configuration discriminated by type. Types: agentic (LLM-driven), code (predefined code), extract (data extraction), branch (routing decisions), api (HTTP requests), specialized (shared specialized automation).");
13956
- var agentConfigSchema = z19.preprocess((data) => {
14114
+ var agentConfigSchema = z21.preprocess((data) => {
13957
14115
  if (typeof data === "object" && data !== null && !("type" in data)) {
13958
14116
  return { ...data, type: "agentic" };
13959
14117
  }
13960
14118
  return data;
13961
14119
  }, agentConfigSchemaUnion).describe("Agent configuration. Defines the agent type, environment, available tools, model settings, and behavior options. If type is omitted, defaults to agentic.");
13962
- var draftAgentConfigSchemaUnion = z19.discriminatedUnion("type", [
14120
+ var draftAgentConfigSchemaUnion = z21.discriminatedUnion("type", [
13963
14121
  agenticAgentConfigSchema,
13964
14122
  codeAgentConfigSchema,
13965
14123
  extractAgentConfigSchema,
@@ -13967,7 +14125,7 @@ var draftAgentConfigSchemaUnion = z19.discriminatedUnion("type", [
13967
14125
  apiAgentConfigSchema,
13968
14126
  specializedAgentConfigSchema
13969
14127
  ]).describe("Draft agent configuration discriminated by type. Uses a more permissive decision schema so incomplete decision agents can be saved before publish-time validation.");
13970
- var draftAgentConfigSchema = z19.preprocess((data) => {
14128
+ var draftAgentConfigSchema = z21.preprocess((data) => {
13971
14129
  if (typeof data === "object" && data !== null && !("type" in data)) {
13972
14130
  return { ...data, type: "agentic" };
13973
14131
  }
@@ -13976,66 +14134,66 @@ var draftAgentConfigSchema = z19.preprocess((data) => {
13976
14134
  var DEFAULT_AGENT_CONFIG = agentConfigSchema.parse({});
13977
14135
 
13978
14136
  // ../common/dist/src/zod-schemas/automation-store-migration-analyzer.schema.js
13979
- import { z as z20 } from "zod";
13980
- var automationStoreMigrationMappingSchema = z20.object({
13981
- sourceAutomationId: z20.string().uuid(),
13982
- sourceAgentId: z20.string().uuid().optional(),
13983
- sourceKind: z20.enum(["input", "output", "sharedInput"]),
13984
- sourceKey: z20.string().min(1),
13985
- logicalValueId: z20.string().min(1).optional(),
13986
- outputBindingSourcePath: z20.string().min(1).optional(),
13987
- handling: z20.enum(["store", "keepLocal", "remove"]),
13988
- reason: z20.string().min(1),
13989
- targetStorePath: z20.string().min(1).optional(),
13990
- population: z20.enum([
14137
+ import { z as z23 } from "zod";
14138
+ var automationStoreMigrationMappingSchema = z23.object({
14139
+ sourceAutomationId: z23.string().uuid(),
14140
+ sourceAgentId: z23.string().uuid().optional(),
14141
+ sourceKind: z23.enum(["input", "output", "sharedInput"]),
14142
+ sourceKey: z23.string().min(1),
14143
+ logicalValueId: z23.string().min(1).optional(),
14144
+ outputBindingSourcePath: z23.string().min(1).optional(),
14145
+ handling: z23.enum(["store", "keepLocal", "remove"]),
14146
+ reason: z23.string().min(1),
14147
+ targetStorePath: z23.string().min(1).optional(),
14148
+ population: z23.enum([
13991
14149
  "default",
13992
14150
  "initialStore",
13993
14151
  "outputStoreBinding",
13994
14152
  "updateStoreValues"
13995
14153
  ]).optional(),
13996
- writerAgentId: z20.string().uuid().optional(),
13997
- isWorkItemIdentity: z20.boolean().optional(),
13998
- conversion: z20.string().min(1).optional()
14154
+ writerAgentId: z23.string().uuid().optional(),
14155
+ isWorkItemIdentity: z23.boolean().optional(),
14156
+ conversion: z23.string().min(1).optional()
13999
14157
  });
14000
- var automationStoreMigrationWritePolicySchema = z20.object({
14001
- automationId: z20.string().uuid(),
14002
- path: z20.string().min(1),
14003
- writerAgentIds: z20.array(z20.string().uuid()).min(1),
14004
- coordination: z20.enum([
14158
+ var automationStoreMigrationWritePolicySchema = z23.object({
14159
+ automationId: z23.string().uuid(),
14160
+ path: z23.string().min(1),
14161
+ writerAgentIds: z23.array(z23.string().uuid()).min(1),
14162
+ coordination: z23.enum([
14005
14163
  "singleWriter",
14006
14164
  "mutuallyExclusiveBranches",
14007
14165
  "orderedScalarOverwrite",
14008
14166
  "disjointArrayItems"
14009
14167
  ]),
14010
- arrayRetryStrategy: z20.enum(["notApplicable", "readBeforeAppend"]),
14011
- rationale: z20.string().min(1)
14168
+ arrayRetryStrategy: z23.enum(["notApplicable", "readBeforeAppend"]),
14169
+ rationale: z23.string().min(1)
14012
14170
  });
14013
- var automationStoreMigrationComparisonVersionSchema = z20.object({
14014
- automationId: z20.string().uuid(),
14015
- automationVersionId: z20.string().uuid(),
14016
- role: z20.enum(["beforeMigration", "afterMigration"]),
14017
- slotLifecycle: z20.enum(["existing", "introduced"]).default("existing"),
14018
- slot: z20.string().min(1)
14171
+ var automationStoreMigrationComparisonVersionSchema = z23.object({
14172
+ automationId: z23.string().uuid(),
14173
+ automationVersionId: z23.string().uuid(),
14174
+ role: z23.enum(["beforeMigration", "afterMigration"]),
14175
+ slotLifecycle: z23.enum(["existing", "introduced"]).default("existing"),
14176
+ slot: z23.string().min(1)
14019
14177
  });
14020
- var automationStoreMigrationComparisonSchema = z20.object({
14021
- versions: z20.array(automationStoreMigrationComparisonVersionSchema).min(1).max(40)
14178
+ var automationStoreMigrationComparisonSchema = z23.object({
14179
+ versions: z23.array(automationStoreMigrationComparisonVersionSchema).min(1).max(40)
14022
14180
  });
14023
- var automationStoreMigrationAnalyzerInputSchema = z20.object({
14024
- mode: z20.enum(["audit", "compare", "auditRuntimeEvidence"]).describe("audit reads current drafts; compare reads exact saved versions; auditRuntimeEvidence reads only caller-supplied existing runs and their exact saved versions."),
14025
- automationIds: z20.array(z20.string().uuid()).max(20).default([]).describe("Starting draft automation IDs for audit. The analyzer follows authored queue targets within a bounded organization-scoped traversal."),
14181
+ var automationStoreMigrationAnalyzerInputSchema = z23.object({
14182
+ mode: z23.enum(["audit", "compare", "auditRuntimeEvidence"]).describe("audit reads current drafts; compare reads exact saved versions; auditRuntimeEvidence reads only caller-supplied existing runs and their exact saved versions."),
14183
+ automationIds: z23.array(z23.string().uuid()).max(20).default([]).describe("Starting draft automation IDs for audit. The analyzer follows authored queue targets within a bounded organization-scoped traversal."),
14026
14184
  comparison: automationStoreMigrationComparisonSchema.nullable().default(null).describe("Exact before/after saved-version pairs for compare. Introduced slots require only an afterMigration version."),
14027
- mappings: z20.array(automationStoreMigrationMappingSchema).default([]),
14028
- storeWritePolicies: z20.array(automationStoreMigrationWritePolicySchema).max(100).default([]),
14029
- runIds: z20.array(z20.string().uuid()).max(20).default([]).describe("Existing run IDs to inspect only in auditRuntimeEvidence mode. The analyzer never creates or starts runs."),
14030
- workItem: z20.string().default("").describe("Optional name for the business work item being migrated.")
14185
+ mappings: z23.array(automationStoreMigrationMappingSchema).default([]),
14186
+ storeWritePolicies: z23.array(automationStoreMigrationWritePolicySchema).max(100).default([]),
14187
+ runIds: z23.array(z23.string().uuid()).max(20).default([]).describe("Existing run IDs to inspect only in auditRuntimeEvidence mode. The analyzer never creates or starts runs."),
14188
+ workItem: z23.string().default("").describe("Optional name for the business work item being migrated.")
14031
14189
  });
14032
14190
 
14033
14191
  // ../common/dist/src/zod-schemas/automation-run-config.schema.js
14034
- import { z as z21 } from "zod";
14035
- var automationRunResolvedRunSettingsSchema = z21.object({
14192
+ import { z as z24 } from "zod";
14193
+ var automationRunResolvedRunSettingsSchema = z24.object({
14036
14194
  environmentOptions: runSettingsEnvironmentOptionsSchema.describe("Canonical run-settings-owned environment settings snapshotted onto the automation run when it starts in runSettings mode. Agent-owned fields such as startingUrl and maxMediaToIncludeInMemory are intentionally ignored at runtime."),
14037
14195
  resourcePools: resourcePoolsSchema.describe("Canonical run-settings-owned resource pools snapshotted onto the automation run when it starts in runSettings mode. Slot assignment and queue status use this only when resolvedRunSettingsSource is runSettings."),
14038
- skipBrowserDebuggerPauses: z21.boolean().optional().describe("Canonical run-settings-owned browser session startup setting snapshotted onto the automation run when it starts in runSettings mode.")
14196
+ skipBrowserDebuggerPauses: z24.boolean().optional().describe("Canonical run-settings-owned browser session startup setting snapshotted onto the automation run when it starts in runSettings mode.")
14039
14197
  });
14040
14198
  var CONSISTENCY_CHECK_COUNT_MAX = 50;
14041
14199
  var NETWORK_TRAFFIC_CAPTURE_RECORD_MODES = [
@@ -14043,18 +14201,18 @@ var NETWORK_TRAFFIC_CAPTURE_RECORD_MODES = [
14043
14201
  "explicit"
14044
14202
  ];
14045
14203
  var DEFAULT_NETWORK_TRAFFIC_CAPTURE_RECORD_MODE = "implicit";
14046
- var networkTrafficCaptureSchema = z21.discriminatedUnion("mode", [
14047
- z21.object({
14048
- mode: z21.literal("record"),
14049
- recordMode: z21.enum(NETWORK_TRAFFIC_CAPTURE_RECORD_MODES).optional().default(DEFAULT_NETWORK_TRAFFIC_CAPTURE_RECORD_MODE).describe("Whether this recording was created implicitly by automation infrastructure or explicitly requested by the user. Explicit recordings are retained longer.")
14204
+ var networkTrafficCaptureSchema = z24.discriminatedUnion("mode", [
14205
+ z24.object({
14206
+ mode: z24.literal("record"),
14207
+ recordMode: z24.enum(NETWORK_TRAFFIC_CAPTURE_RECORD_MODES).optional().default(DEFAULT_NETWORK_TRAFFIC_CAPTURE_RECORD_MODE).describe("Whether this recording was created implicitly by automation infrastructure or explicitly requested by the user. Explicit recordings are retained longer.")
14050
14208
  }).describe("Record network traffic for this run. The recording ID is generated from the automation run ID."),
14051
- z21.object({
14052
- mode: z21.literal("replay"),
14053
- recordingId: z21.uuid().describe("Recording ID from a previous record run in the same organization.")
14209
+ z24.object({
14210
+ mode: z24.literal("replay"),
14211
+ recordingId: z24.uuid().describe("Recording ID from a previous record run in the same organization.")
14054
14212
  }).describe("Replay network traffic from a previous recording.")
14055
14213
  ]).describe("Optional network traffic capture mode for this run. Applies to browser provider traffic and supported agent tool HTTP traffic, including API tool calls and provider-authenticated helper requests.");
14056
- var automationRunSlaTypeSchema = z21.enum(["all"]);
14057
- var automationRunSlaTimestampSchema = z21.iso.datetime();
14214
+ var automationRunSlaTypeSchema = z24.enum(["all"]);
14215
+ var automationRunSlaTimestampSchema = z24.iso.datetime();
14058
14216
  function refineAutomationRunSlaTimestampOrder(sla, ctx) {
14059
14217
  const startedAtMs = Date.parse(sla.startedAt);
14060
14218
  const breachesAtMs = Date.parse(sla.breachesAt);
@@ -14084,31 +14242,31 @@ function refineAutomationRunSlaTimestampOrder(sla, ctx) {
14084
14242
  });
14085
14243
  }
14086
14244
  }
14087
- var automationRunSlaSchema = z21.object({
14245
+ var automationRunSlaSchema = z24.object({
14088
14246
  startedAt: automationRunSlaTimestampSchema.describe("ISO timestamp when SLA tracking started for this run."),
14089
14247
  highRiskAt: automationRunSlaTimestampSchema.optional().describe("Optional ISO timestamp when this run should be considered at high risk of breaching its SLA."),
14090
14248
  breachesAt: automationRunSlaTimestampSchema.describe("ISO timestamp when this run breaches its SLA."),
14091
14249
  type: automationRunSlaTypeSchema.optional().default("all").describe("SLA policy type that applies to this automation run.")
14092
14250
  }).superRefine(refineAutomationRunSlaTimestampOrder).describe("Optional service-level timing metadata for queueing and runtime consumers of this automation run.");
14093
- var automationRunConfigBaseSchema = z21.object({
14094
- approvalMode: z21.enum(["HUMAN_APPROVAL", "OFF"]).default("OFF"),
14095
- consistencyCheckCount: z21.number().int().nonnegative().max(CONSISTENCY_CHECK_COUNT_MAX).nullable().default(null),
14096
- settingsSourceAgentId: z21.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."),
14097
- startInTakeOverMode: z21.boolean().default(false).describe("When true, create and prepare the remote session, then pause until a human manually starts the agent."),
14098
- captureActions: z21.boolean().default(false).describe("When true, attach an action recording while a draft run is paused in takeover mode."),
14099
- runDraftQueuedAgents: z21.boolean().optional().describe("Draft-run-only option. When false, queue-agent actions in the draft run report success without starting downstream queued draft child runs. Omit or true preserves queueing."),
14100
- allowPointOfNoReturnOverride: z21.boolean().optional().describe("Internal rerun authorization. When true, the rerun and its queued descendants may proceed past a point-of-no-return crossing owned by an earlier run."),
14101
- pointOfNoReturnGateEnabled: z21.literal(true).optional().describe("Infrastructure-owned rollout marker. PONR is enforced only for run trees created after the gate rollout."),
14251
+ var automationRunConfigBaseSchema = z24.object({
14252
+ approvalMode: z24.enum(["HUMAN_APPROVAL", "OFF"]).default("OFF"),
14253
+ consistencyCheckCount: z24.number().int().nonnegative().max(CONSISTENCY_CHECK_COUNT_MAX).nullable().default(null),
14254
+ settingsSourceAgentId: z24.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."),
14255
+ startInTakeOverMode: z24.boolean().default(false).describe("When true, create and prepare the remote session, then pause until a human manually starts the agent."),
14256
+ captureActions: z24.boolean().default(false).describe("When true, attach an action recording while a draft run is paused in takeover mode."),
14257
+ runDraftQueuedAgents: z24.boolean().optional().describe("Draft-run-only option. When false, queue-agent actions in the draft run report success without starting downstream queued draft child runs. Omit or true preserves queueing."),
14258
+ allowPointOfNoReturnOverride: z24.boolean().optional().describe("Internal rerun authorization. When true, the rerun and its queued descendants may proceed past a point-of-no-return crossing owned by an earlier run."),
14259
+ pointOfNoReturnGateEnabled: z24.literal(true).optional().describe("Infrastructure-owned rollout marker. PONR is enforced only for run trees created after the gate rollout."),
14102
14260
  sla: automationRunSlaSchema.optional(),
14103
14261
  networkTrafficCapture: networkTrafficCaptureSchema.optional(),
14104
- networkTrafficCaptureExplicitlyDisabled: z21.literal(true).optional().describe("Infrastructure-owned marker indicating that network traffic capture was explicitly disabled for this run. When present, runtime policy resolution must not enable capture."),
14105
- implicitNetworkTrafficRecordingDecision: z21.object({
14106
- enabled: z21.boolean()
14262
+ networkTrafficCaptureExplicitlyDisabled: z24.literal(true).optional().describe("Infrastructure-owned marker indicating that network traffic capture was explicitly disabled for this run. When present, runtime policy resolution must not enable capture."),
14263
+ implicitNetworkTrafficRecordingDecision: z24.object({
14264
+ enabled: z24.boolean()
14107
14265
  }).optional().describe("Infrastructure-owned snapshot of the implicit network traffic recording flag decision. Runtime retries use this to avoid re-evaluating LaunchDarkly for the same run."),
14108
14266
  resolvedRunSettings: automationRunResolvedRunSettingsSchema.optional().describe("Canonical run settings snapshotted onto the automation run at creation time. Present only for runSettings mode; legacyConfig mode intentionally resolves runtime settings from each current agent config instead of storing a misleading snapshot."),
14109
14267
  queueResourcePools: resourcePoolsSchema.optional().describe("Canonical deduped resource-pool requirements snapshotted for queue and slot assignment. Present on new runs so assignment does not recompute requirements from mutable agent config."),
14110
14268
  credentialVariableResourcePools: resourcePoolsSchema.optional().describe("Additional resource pools selected through credential-valued automation variables. These are additive queue requirements and do not change whether the run uses runSettings or legacyConfig as its runtime settings source."),
14111
- resolvedRunSettingsSource: z21.enum(["runSettings", "legacyConfig"]).optional().describe("Runtime mode decided at run creation. runSettings means resolvedRunSettings is canonical for browser/session/resource-pool behaviour; legacyConfig means runtime consumers must use current agent legacy config fields.")
14269
+ resolvedRunSettingsSource: z24.enum(["runSettings", "legacyConfig"]).optional().describe("Runtime mode decided at run creation. runSettings means resolvedRunSettings is canonical for browser/session/resource-pool behaviour; legacyConfig means runtime consumers must use current agent legacy config fields.")
14112
14270
  });
14113
14271
  var automationRunConfigSchema = automationRunConfigBaseSchema.superRefine((config, ctx) => {
14114
14272
  if (config.networkTrafficCaptureExplicitlyDisabled === true && config.networkTrafficCapture !== void 0) {
@@ -14133,8 +14291,69 @@ var automationRunStartConfigSchema = automationRunConfigBaseSchema.omit({
14133
14291
  networkTrafficCapture: networkTrafficCaptureSchema.nullable().optional().describe("Network traffic capture preference for this run. Omit to apply the implicit recording policy, pass null to explicitly disable capture, or pass a record/replay config to explicitly enable capture.")
14134
14292
  });
14135
14293
 
14294
+ // ../common/dist/src/utils/custom-instructions-command.util.js
14295
+ var MAX_CUSTOM_COMMAND_COUNT = 1;
14296
+ var MAX_CUSTOM_INSTRUCTIONS_LENGTH = 280;
14297
+ var STANDARD_COMMAND_NAMES = [
14298
+ "callSpecializedAgent",
14299
+ "checkpoint",
14300
+ "click",
14301
+ "clickFill",
14302
+ "ifElse",
14303
+ "loop",
14304
+ "navigateTo",
14305
+ "pressKeys",
14306
+ "queueAgents",
14307
+ "reportStop",
14308
+ "somFilter"
14309
+ ];
14310
+ function createInvalidValueError(message) {
14311
+ const error = new Error(`INVALID_VALUE: ${message}`);
14312
+ error.name = "INVALID_VALUE";
14313
+ return error;
14314
+ }
14315
+ function isRecord2(value) {
14316
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14317
+ }
14318
+ function getCustomInstructions(command) {
14319
+ const commandArguments = command["arguments"];
14320
+ if (!isRecord2(commandArguments)) {
14321
+ return "";
14322
+ }
14323
+ const { instructions } = commandArguments;
14324
+ return typeof instructions === "string" ? instructions.trim() : "";
14325
+ }
14326
+ function getMentionedStandardCommand(instructions) {
14327
+ const normalizedInstructions = instructions.toLowerCase();
14328
+ return STANDARD_COMMAND_NAMES.find((commandName) => normalizedInstructions.includes(commandName.toLowerCase())) ?? null;
14329
+ }
14330
+ function assertCustomInstructionsCommand({ commands, path: path8 }) {
14331
+ const customCommands = commands.flatMap((command, commandIndex) => command["commandName"] === "custom" ? [{ command, path: `${path8}[${commandIndex.toString()}]` }] : []);
14332
+ if (customCommands.length === 0) {
14333
+ return;
14334
+ }
14335
+ if (customCommands.length > MAX_CUSTOM_COMMAND_COUNT) {
14336
+ throw createInvalidValueError(`${path8} contains ${customCommands.length.toString()} custom commands. Use at most one short custom command per agent. Split policy, decision, outreach, and multi-step work into catalog commands or child agents instead.`);
14337
+ }
14338
+ const [customCommand] = customCommands;
14339
+ if (!customCommand) {
14340
+ return;
14341
+ }
14342
+ const instructions = getCustomInstructions(customCommand.command);
14343
+ if (instructions.length === 0) {
14344
+ throw createInvalidValueError(`${customCommand.path}.arguments.instructions must be a non-empty string for custom commands.`);
14345
+ }
14346
+ if (instructions.length > MAX_CUSTOM_INSTRUCTIONS_LENGTH) {
14347
+ throw createInvalidValueError(`${customCommand.path}.arguments.instructions is ${instructions.length.toString()} characters. Custom commands must be short single-action instructions (max ${MAX_CUSTOM_INSTRUCTIONS_LENGTH.toString()} chars). Move policy/template/context text into description, inputSchema, or child agents, and express executable work with catalog commands.`);
14348
+ }
14349
+ const mentionedCommand = getMentionedStandardCommand(instructions);
14350
+ if (mentionedCommand !== null) {
14351
+ throw createInvalidValueError(`${customCommand.path}.arguments.instructions mentions "${mentionedCommand}". Use the "${mentionedCommand}" catalog command directly instead of wrapping it in custom prose.`);
14352
+ }
14353
+ }
14354
+
14136
14355
  // ../mcp-registry/src/operation-specs.ts
14137
- import { z as z23 } from "zod";
14356
+ import { z as z25 } from "zod";
14138
14357
 
14139
14358
  // ../mcp-registry/src/operation-spec.ts
14140
14359
  function stripLeadingGraphqlComments(document) {
@@ -14238,7 +14457,79 @@ function jsonOption({
14238
14457
  valueType: "json"
14239
14458
  };
14240
14459
  }
14241
- var jsonObjectSchema = z23.record(z23.string(), z23.unknown());
14460
+ var jsonObjectSchema = z25.record(z25.string(), z25.unknown());
14461
+ function isRecord3(value) {
14462
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14463
+ }
14464
+ function validateCustomInstructionsCommands({
14465
+ commands,
14466
+ ctx,
14467
+ path: path8
14468
+ }) {
14469
+ if (!Array.isArray(commands)) {
14470
+ return;
14471
+ }
14472
+ const validationResult = fromThrowable(() => {
14473
+ assertCustomInstructionsCommand({
14474
+ commands: commands.map((command) => isRecord3(command) ? command : {}),
14475
+ path: path8.join(".").replaceAll(/\.(?<index>\d+)/gu, "[$<index>]")
14476
+ });
14477
+ }, "invalid-custom-instructions-command");
14478
+ if (isErr(validationResult)) {
14479
+ ctx.addIssue({
14480
+ code: "custom",
14481
+ message: `${getErrorMessage2(validationResult.error.cause)} Run mgcl catalog commands to find the standard command for this work.`,
14482
+ path: path8
14483
+ });
14484
+ }
14485
+ }
14486
+ var automationPatchOperationsSchema = z25.array(z25.unknown()).min(1).superRefine((operations, ctx) => {
14487
+ for (const [operationIndex, operation] of operations.entries()) {
14488
+ if (!isRecord3(operation)) {
14489
+ continue;
14490
+ }
14491
+ const setCommands = operation["setAgentInstructionsCommands"];
14492
+ if (!isRecord3(setCommands)) {
14493
+ continue;
14494
+ }
14495
+ validateCustomInstructionsCommands({
14496
+ commands: setCommands["instructionsCommands"],
14497
+ ctx,
14498
+ path: [
14499
+ "operations",
14500
+ operationIndex,
14501
+ "setAgentInstructionsCommands",
14502
+ "instructionsCommands"
14503
+ ]
14504
+ });
14505
+ }
14506
+ });
14507
+ function automationInputSchema(agentKeys) {
14508
+ return jsonObjectSchema.superRefine((input, ctx) => {
14509
+ for (const agentKey of agentKeys) {
14510
+ const agents = input[agentKey];
14511
+ if (!Array.isArray(agents)) {
14512
+ continue;
14513
+ }
14514
+ for (const [agentIndex, agent] of agents.entries()) {
14515
+ if (!isRecord3(agent)) {
14516
+ continue;
14517
+ }
14518
+ validateCustomInstructionsCommands({
14519
+ commands: agent["instructionsCommands"],
14520
+ ctx,
14521
+ path: [agentKey, agentIndex, "instructionsCommands"]
14522
+ });
14523
+ }
14524
+ }
14525
+ });
14526
+ }
14527
+ var createAutomationInputSchema = automationInputSchema(["newAgents"]);
14528
+ var updateAutomationInputSchema = automationInputSchema([
14529
+ "newAgents",
14530
+ "updatedAgents"
14531
+ ]);
14532
+ var COMMAND_CATALOG_HELP = "When authoring raw instructionsCommands, run mgcl catalog commands and prefer a standard command.";
14242
14533
  var agentBrowserProviderOptionsSelection = ` browserbase {
14243
14534
  advancedStealth
14244
14535
  contextId
@@ -14331,11 +14622,51 @@ var agentLimitationsSelection = ` limitations {
14331
14622
  allowedUrlRegexes
14332
14623
  }`;
14333
14624
  var operationSpecs = [
14625
+ createOperationSpec({
14626
+ operationName: "GetCaptureContext",
14627
+ kind: "query",
14628
+ inputSchema: z25.object({
14629
+ automationId: z25.string().min(1).optional(),
14630
+ recordingId: z25.string().min(1).optional()
14631
+ }).refine(
14632
+ ({ automationId, recordingId }) => [automationId, recordingId].some((value) => value !== void 0),
14633
+ { message: "Provide --automation-id or --recording-id." }
14634
+ ),
14635
+ cli: {
14636
+ name: "get-capture-context",
14637
+ path: ["capture-context", "get"],
14638
+ description: "Fetch raw browser events and screenshots from a Capture Mode recording.",
14639
+ resultKey: "captureContext",
14640
+ options: [
14641
+ stringOption({
14642
+ inputKey: "automationId",
14643
+ flagName: "automation-id",
14644
+ description: "Automation ID whose newest usable Capture Mode recording to fetch."
14645
+ }),
14646
+ stringOption({
14647
+ inputKey: "recordingId",
14648
+ flagName: "recording-id",
14649
+ description: "Exact Capture Mode recording ID to fetch."
14650
+ })
14651
+ ]
14652
+ },
14653
+ mcp: { fileName: "captureContext.graphql" },
14654
+ document: `# Fetch raw Capture Mode context with inline screenshots
14655
+ query GetCaptureContext($automationId: ID, $recordingId: ID) {
14656
+ captureContext(
14657
+ automationId: $automationId
14658
+ recordingId: $recordingId
14659
+ ) {
14660
+ metadata
14661
+ rawEvents
14662
+ }
14663
+ }`
14664
+ }),
14334
14665
  createOperationSpec({
14335
14666
  operationName: "GetAgents",
14336
14667
  kind: "query",
14337
- inputSchema: z23.object({
14338
- ids: z23.array(z23.string().min(1)).min(1)
14668
+ inputSchema: z25.object({
14669
+ ids: z25.array(z25.string().min(1)).min(1)
14339
14670
  }),
14340
14671
  cli: {
14341
14672
  name: "get-agents",
@@ -14396,9 +14727,9 @@ ${agentLimitationsSelection}
14396
14727
  createOperationSpec({
14397
14728
  operationName: "GetAgentVersion",
14398
14729
  kind: "query",
14399
- inputSchema: z23.object({
14400
- agentId: z23.string().min(1),
14401
- versionId: z23.string().min(1)
14730
+ inputSchema: z25.object({
14731
+ agentId: z25.string().min(1),
14732
+ versionId: z25.string().min(1)
14402
14733
  }),
14403
14734
  cli: {
14404
14735
  name: "get-agent-version",
@@ -14461,8 +14792,8 @@ ${agentLimitationsSelection}
14461
14792
  createOperationSpec({
14462
14793
  operationName: "GetAgentVersions",
14463
14794
  kind: "query",
14464
- inputSchema: z23.object({
14465
- agentId: z23.string().min(1)
14795
+ inputSchema: z25.object({
14796
+ agentId: z25.string().min(1)
14466
14797
  }),
14467
14798
  cli: {
14468
14799
  name: "get-agent-versions",
@@ -14496,10 +14827,10 @@ query GetAgentVersions($agentId: ID!) {
14496
14827
  createOperationSpec({
14497
14828
  operationName: "DiffAgentVersion",
14498
14829
  kind: "query",
14499
- inputSchema: z23.object({
14500
- agentId: z23.string().min(1),
14501
- versionId: z23.string().min(1),
14502
- compareVersionId: z23.string().min(1).optional()
14830
+ inputSchema: z25.object({
14831
+ agentId: z25.string().min(1),
14832
+ versionId: z25.string().min(1),
14833
+ compareVersionId: z25.string().min(1).optional()
14503
14834
  }),
14504
14835
  cli: {
14505
14836
  name: "diff-agent-version",
@@ -14553,8 +14884,8 @@ query DiffAgentVersion(
14553
14884
  createOperationSpec({
14554
14885
  operationName: "GetAgentRun",
14555
14886
  kind: "query",
14556
- inputSchema: z23.object({
14557
- id: z23.string().min(1)
14887
+ inputSchema: z25.object({
14888
+ id: z25.string().min(1)
14558
14889
  }),
14559
14890
  cli: {
14560
14891
  name: "get-agent-run",
@@ -14590,8 +14921,8 @@ query GetAgentRun($id: ID!) {
14590
14921
  createOperationSpec({
14591
14922
  operationName: "GetAutomationAgents",
14592
14923
  kind: "query",
14593
- inputSchema: z23.object({
14594
- ids: z23.array(z23.string().min(1)).min(1)
14924
+ inputSchema: z25.object({
14925
+ ids: z25.array(z25.string().min(1)).min(1)
14595
14926
  }),
14596
14927
  cli: {
14597
14928
  name: "get-automation-agents",
@@ -14634,8 +14965,8 @@ query GetAutomationAgents($ids: [ID!]!) {
14634
14965
  createOperationSpec({
14635
14966
  operationName: "GetAutomationDiffFromPublished",
14636
14967
  kind: "query",
14637
- inputSchema: z23.object({
14638
- automationId: z23.string().min(1)
14968
+ inputSchema: z25.object({
14969
+ automationId: z25.string().min(1)
14639
14970
  }),
14640
14971
  cli: {
14641
14972
  name: "get-automation-diff-from-published",
@@ -14668,9 +14999,9 @@ query GetAutomationDiffFromPublished($automationId: ID!) {
14668
14999
  createOperationSpec({
14669
15000
  operationName: "GetAutomationDiffVersions",
14670
15001
  kind: "query",
14671
- inputSchema: z23.object({
14672
- baseVersionId: z23.string().min(1),
14673
- targetVersionId: z23.string().min(1)
15002
+ inputSchema: z25.object({
15003
+ baseVersionId: z25.string().min(1),
15004
+ targetVersionId: z25.string().min(1)
14674
15005
  }),
14675
15006
  cli: {
14676
15007
  name: "get-automation-diff-versions",
@@ -14711,10 +15042,10 @@ query GetAutomationDiffVersions($baseVersionId: ID!, $targetVersionId: ID!) {
14711
15042
  createOperationSpec({
14712
15043
  operationName: "GetAutomationVersionJson",
14713
15044
  kind: "query",
14714
- inputSchema: z23.object({
14715
- versionId: z23.string().min(1),
14716
- paths: z23.array(z23.string().min(1)).optional(),
14717
- format: z23.enum(["normalized", "full", "export"]).optional()
15045
+ inputSchema: z25.object({
15046
+ versionId: z25.string().min(1),
15047
+ paths: z25.array(z25.string().min(1)).optional(),
15048
+ format: z25.enum(["normalized", "full", "export"]).optional()
14718
15049
  }),
14719
15050
  cli: {
14720
15051
  name: "get-automation-version-json",
@@ -14749,8 +15080,8 @@ query GetAutomationVersionJson($versionId: ID!, $paths: [String!], $format: Stri
14749
15080
  createOperationSpec({
14750
15081
  operationName: "GetAutomationVersionJsonSkeleton",
14751
15082
  kind: "query",
14752
- inputSchema: z23.object({
14753
- versionId: z23.string().min(1)
15083
+ inputSchema: z25.object({
15084
+ versionId: z25.string().min(1)
14754
15085
  }),
14755
15086
  cli: {
14756
15087
  name: "get-automation-version-json-skeleton",
@@ -14775,8 +15106,8 @@ query GetAutomationVersionJsonSkeleton($versionId: ID!) {
14775
15106
  createOperationSpec({
14776
15107
  operationName: "GetAutomationRun",
14777
15108
  kind: "query",
14778
- inputSchema: z23.object({
14779
- id: z23.string().min(1)
15109
+ inputSchema: z25.object({
15110
+ id: z25.string().min(1)
14780
15111
  }),
14781
15112
  cli: {
14782
15113
  name: "get-automation-run",
@@ -14816,8 +15147,8 @@ query GetAutomationRun($id: ID!) {
14816
15147
  createOperationSpec({
14817
15148
  operationName: "GetAutomationRunAgentRuns",
14818
15149
  kind: "query",
14819
- inputSchema: z23.object({
14820
- automationRunId: z23.string().min(1)
15150
+ inputSchema: z25.object({
15151
+ automationRunId: z25.string().min(1)
14821
15152
  }),
14822
15153
  cli: {
14823
15154
  name: "get-automation-run-agent-runs",
@@ -14853,11 +15184,11 @@ query GetAutomationRunAgentRuns($automationRunId: ID!) {
14853
15184
  createOperationSpec({
14854
15185
  operationName: "GetAutomationRunIterations",
14855
15186
  kind: "query",
14856
- inputSchema: z23.object({
14857
- automationRunId: z23.string().min(1),
14858
- agentRunId: z23.string().min(1).optional(),
14859
- limit: z23.number().int().positive().optional(),
14860
- reverse: z23.boolean().optional()
15187
+ inputSchema: z25.object({
15188
+ automationRunId: z25.string().min(1),
15189
+ agentRunId: z25.string().min(1).optional(),
15190
+ limit: z25.number().int().positive().optional(),
15191
+ reverse: z25.boolean().optional()
14861
15192
  }),
14862
15193
  cli: {
14863
15194
  name: "get-automation-run-iterations",
@@ -14921,19 +15252,70 @@ query GetAutomationRunIterations(
14921
15252
  screenshotMimeType
14922
15253
  }
14923
15254
  }
15255
+ }`
15256
+ }),
15257
+ createOperationSpec({
15258
+ operationName: "InspectPausedAutomationStep",
15259
+ kind: "query",
15260
+ inputSchema: z25.object({
15261
+ runId: z25.string().min(1)
15262
+ }),
15263
+ cli: {
15264
+ name: "inspect-paused-automation-step",
15265
+ path: ["automation-runs", "inspect-paused-step"],
15266
+ description: "Inspect the latest persisted iteration for a paused manual-mode run.",
15267
+ resultKey: "automationRunIterations",
15268
+ options: [
15269
+ stringOption({
15270
+ inputKey: "runId",
15271
+ flagName: "run-id",
15272
+ description: "Automation run ID.",
15273
+ required: true
15274
+ })
15275
+ ]
15276
+ },
15277
+ mcp: { fileName: "inspectPausedAutomationStep.graphql" },
15278
+ document: `# Inspect the latest persisted iteration for a paused manual-mode run
15279
+ query InspectPausedAutomationStep($runId: ID!) {
15280
+ automationRunIterations(
15281
+ automationRunId: $runId
15282
+ limit: 1
15283
+ reverse: true
15284
+ ) {
15285
+ id
15286
+ sequence
15287
+ agentRunId
15288
+ metadata
15289
+ startedAt
15290
+ finishedAt
15291
+ totalDurationMs
15292
+ llmResponseDurationMs
15293
+ iterationContext
15294
+ verificationResults
15295
+ withMarksScreenshotUrl
15296
+ withMarksMimeType
15297
+ memories {
15298
+ id
15299
+ type
15300
+ value
15301
+ sequence
15302
+ screenshotUrl
15303
+ screenshotMimeType
15304
+ }
15305
+ }
14924
15306
  }`
14925
15307
  }),
14926
15308
  createOperationSpec({
14927
15309
  operationName: "GetAutomationRuns",
14928
15310
  kind: "query",
14929
- inputSchema: z23.object({
14930
- automationId: z23.string().min(1).optional(),
14931
- from: z23.string().min(1).optional(),
14932
- status: z23.array(z23.string().min(1)).optional(),
14933
- invocationType: z23.array(z23.string().min(1)).optional(),
14934
- limit: z23.number().int().positive().optional(),
14935
- page: z23.number().int().nonnegative().optional(),
14936
- to: z23.string().min(1).optional()
15311
+ inputSchema: z25.object({
15312
+ automationId: z25.string().min(1).optional(),
15313
+ from: z25.string().min(1).optional(),
15314
+ status: z25.array(z25.string().min(1)).optional(),
15315
+ invocationType: z25.array(z25.string().min(1)).optional(),
15316
+ limit: z25.number().int().positive().optional(),
15317
+ page: z25.number().int().nonnegative().optional(),
15318
+ to: z25.string().min(1).optional()
14937
15319
  }),
14938
15320
  cli: {
14939
15321
  name: "get-automation-runs",
@@ -15015,8 +15397,8 @@ query GetAutomationRuns(
15015
15397
  createOperationSpec({
15016
15398
  operationName: "ListAutomations",
15017
15399
  kind: "query",
15018
- inputSchema: z23.object({
15019
- limit: z23.number().positive().optional(),
15400
+ inputSchema: z25.object({
15401
+ limit: z25.number().positive().optional(),
15020
15402
  order: jsonObjectSchema.optional(),
15021
15403
  where: jsonObjectSchema.optional()
15022
15404
  }),
@@ -15067,8 +15449,8 @@ query ListAutomations(
15067
15449
  createOperationSpec({
15068
15450
  operationName: "GetAutomations",
15069
15451
  kind: "query",
15070
- inputSchema: z23.object({
15071
- ids: z23.array(z23.string().min(1)).min(1)
15452
+ inputSchema: z25.object({
15453
+ ids: z25.array(z25.string().min(1)).min(1)
15072
15454
  }),
15073
15455
  cli: {
15074
15456
  name: "get-automations",
@@ -15186,8 +15568,8 @@ query AnalyzeAutomationStoreMigration(
15186
15568
  createOperationSpec({
15187
15569
  operationName: "GetAvailableCommands",
15188
15570
  kind: "query",
15189
- inputSchema: z23.object({
15190
- env: z23.string().min(1)
15571
+ inputSchema: z25.object({
15572
+ env: z25.string().min(1)
15191
15573
  }),
15192
15574
  cli: {
15193
15575
  name: "get-available-commands",
@@ -15208,7 +15590,10 @@ query AnalyzeAutomationStoreMigration(
15208
15590
  query GetAvailableCommands($env: AvailableCommandsEnv!) {
15209
15591
  availableCommands(env: $env) {
15210
15592
  id
15593
+ category
15211
15594
  description
15595
+ template
15596
+ whenToUse
15212
15597
  requiredTool
15213
15598
  inputSchema
15214
15599
  }
@@ -15217,8 +15602,8 @@ query GetAvailableCommands($env: AvailableCommandsEnv!) {
15217
15602
  createOperationSpec({
15218
15603
  operationName: "GetAvailableModels",
15219
15604
  kind: "query",
15220
- inputSchema: z23.object({
15221
- agentId: z23.string().min(1)
15605
+ inputSchema: z25.object({
15606
+ agentId: z25.string().min(1)
15222
15607
  }),
15223
15608
  cli: {
15224
15609
  name: "get-available-models",
@@ -15262,9 +15647,9 @@ query GetAvailableModels($agentId: String!) {
15262
15647
  createOperationSpec({
15263
15648
  operationName: "GetAvailableTools",
15264
15649
  kind: "query",
15265
- inputSchema: z23.object({
15266
- env: z23.string().min(1),
15267
- automationId: z23.string().min(1).optional()
15650
+ inputSchema: z25.object({
15651
+ env: z25.string().min(1),
15652
+ automationId: z25.string().min(1).optional()
15268
15653
  }),
15269
15654
  cli: {
15270
15655
  name: "get-available-tools",
@@ -15298,8 +15683,8 @@ query GetAvailableTools($env: AvailableCommandsEnv!, $automationId: String) {
15298
15683
  createOperationSpec({
15299
15684
  operationName: "GetFeatureFlagsContext",
15300
15685
  kind: "query",
15301
- inputSchema: z23.object({
15302
- flagKeys: z23.array(z23.string().min(1)).min(1).max(100).optional()
15686
+ inputSchema: z25.object({
15687
+ flagKeys: z25.array(z25.string().min(1)).min(1).max(100).optional()
15303
15688
  }),
15304
15689
  cli: {
15305
15690
  name: "get-feature-flags-context",
@@ -15336,7 +15721,7 @@ query GetFeatureFlagsContext($flagKeys: [String!]) {
15336
15721
  createOperationSpec({
15337
15722
  operationName: "GetAutomationWorkbenchCredentials",
15338
15723
  kind: "query",
15339
- inputSchema: z23.object({}),
15724
+ inputSchema: z25.object({}),
15340
15725
  cli: {
15341
15726
  name: "get-automation-workbench-credentials",
15342
15727
  path: ["workbench", "credentials"],
@@ -15361,8 +15746,8 @@ query GetAutomationWorkbenchCredentials {
15361
15746
  createOperationSpec({
15362
15747
  operationName: "GetAutomationWorkbenchDiagnostics",
15363
15748
  kind: "query",
15364
- inputSchema: z23.object({
15365
- draftAutomationId: z23.string().min(1)
15749
+ inputSchema: z25.object({
15750
+ draftAutomationId: z25.string().min(1)
15366
15751
  }),
15367
15752
  cli: {
15368
15753
  name: "get-automation-workbench-diagnostics",
@@ -15427,11 +15812,11 @@ query GetAutomationWorkbenchDiagnostics($draftAutomationId: ID!) {
15427
15812
  createOperationSpec({
15428
15813
  operationName: "GetAutomationWorkbenchRunTrace",
15429
15814
  kind: "query",
15430
- inputSchema: z23.object({
15431
- automationRunId: z23.string().min(1),
15432
- agentRunId: z23.string().min(1).optional(),
15433
- limit: z23.number().int().positive().optional(),
15434
- reverse: z23.boolean().optional()
15815
+ inputSchema: z25.object({
15816
+ automationRunId: z25.string().min(1),
15817
+ agentRunId: z25.string().min(1).optional(),
15818
+ limit: z25.number().int().positive().optional(),
15819
+ reverse: z25.boolean().optional()
15435
15820
  }),
15436
15821
  cli: {
15437
15822
  name: "get-automation-workbench-run-trace",
@@ -15563,13 +15948,13 @@ query GetAutomationWorkbenchRunTrace(
15563
15948
  createOperationSpec({
15564
15949
  operationName: "GetAutomationWorkbenchAwaitRunCompletion",
15565
15950
  kind: "query",
15566
- inputSchema: z23.object({
15567
- automationRunId: z23.string().min(1),
15568
- timeoutMs: z23.number().int().min(1e3).max(6e4).optional(),
15569
- sinceSequence: z23.number().int().min(0).optional(),
15570
- agentRunId: z23.string().min(1).optional(),
15571
- limit: z23.number().int().positive().optional(),
15572
- reverse: z23.boolean().optional()
15951
+ inputSchema: z25.object({
15952
+ automationRunId: z25.string().min(1),
15953
+ timeoutMs: z25.number().int().min(1e3).max(6e4).optional(),
15954
+ sinceSequence: z25.number().int().min(0).optional(),
15955
+ agentRunId: z25.string().min(1).optional(),
15956
+ limit: z25.number().int().positive().optional(),
15957
+ reverse: z25.boolean().optional()
15573
15958
  }),
15574
15959
  cli: {
15575
15960
  name: "await-automation-workbench-run-completion",
@@ -15723,11 +16108,11 @@ query GetAutomationWorkbenchAwaitRunCompletion(
15723
16108
  createOperationSpec({
15724
16109
  operationName: "GetAutomationWorkbenchSchemaSuggestions",
15725
16110
  kind: "query",
15726
- inputSchema: z23.object({
15727
- automationRunId: z23.string().min(1),
15728
- draftAutomationId: z23.string().min(1).optional(),
15729
- minConfidence: z23.number().min(0).max(1).optional(),
15730
- includeSensitive: z23.boolean().optional()
16111
+ inputSchema: z25.object({
16112
+ automationRunId: z25.string().min(1),
16113
+ draftAutomationId: z25.string().min(1).optional(),
16114
+ minConfidence: z25.number().min(0).max(1).optional(),
16115
+ includeSensitive: z25.boolean().optional()
15731
16116
  }),
15732
16117
  cli: {
15733
16118
  name: "get-automation-workbench-schema-suggestions",
@@ -15793,97 +16178,336 @@ query GetAutomationWorkbenchSchemaSuggestions(
15793
16178
  }`
15794
16179
  }),
15795
16180
  createOperationSpec({
15796
- operationName: "CreateAutomation",
15797
- kind: "mutation",
15798
- inputSchema: z23.object({
15799
- input: jsonObjectSchema
16181
+ operationName: "skills_list",
16182
+ kind: "query",
16183
+ inputSchema: z25.object({
16184
+ ref: z25.string().min(1).optional()
15800
16185
  }),
15801
16186
  cli: {
15802
- name: "create-automation",
15803
- path: ["automations", "create"],
15804
- description: "Create a draft automation.",
15805
- resultKey: "createAutomation",
16187
+ name: "list-skills",
16188
+ path: ["skills", "list"],
16189
+ description: "List root-level Workplace skill bundles under skills/<skill-name>.",
16190
+ resultKey: "skillsList",
15806
16191
  options: [
15807
- jsonOption({
15808
- inputKey: "input",
15809
- flagName: "input-json",
15810
- description: "CreateAutomationInput payload.",
15811
- required: true
16192
+ stringOption({
16193
+ inputKey: "ref",
16194
+ flagName: "ref",
16195
+ description: "Branch, tag, or commit to list. Defaults to HEAD."
15812
16196
  })
15813
16197
  ]
15814
16198
  },
15815
- mcp: { fileName: "createAutomation.graphql" },
15816
- document: `# Mutation to create a draft automation with optional initial values
15817
- # Returns flat fields only for MCP tool simplicity
15818
- mutation CreateAutomation($input: CreateAutomationInput!) {
15819
- createAutomation(input: $input) {
15820
- id
15821
- name
15822
- organizationId
15823
- createdAt
15824
- updatedAt
15825
- environment
15826
- lastSavedAt
15827
- publishedVersionId
15828
- draftVersionId
16199
+ mcp: { fileName: "skillsList.graphql" },
16200
+ document: `# List root-level Workplace skill bundles. Nested automation and agent skill paths are outside the v1 API scope.
16201
+ query skills_list($ref: String) {
16202
+ skillsList(ref: $ref) {
16203
+ ref
16204
+ truncated
16205
+ skills {
16206
+ name
16207
+ path
16208
+ }
15829
16209
  }
15830
16210
  }`
15831
16211
  }),
15832
16212
  createOperationSpec({
15833
- operationName: "GetGraphqlSchema",
16213
+ operationName: "skills_read",
15834
16214
  kind: "query",
15835
- inputSchema: z23.object({}),
15836
- cli: {
15837
- name: "get-graphql-schema",
15838
- path: ["graphql", "schema"],
15839
- description: "Fetch GraphQL schema metadata.",
15840
- resultKey: "graphqlSchema",
15841
- options: []
15842
- },
15843
- mcp: { fileName: "graphqlSchema.graphql" },
15844
- document: `# Query to fetch full GraphQL schema metadata.
15845
- # Uses the first-class graphqlSchema query field to avoid __schema validation
15846
- # issues in MCP tool-load paths while still returning introspection JSON.
15847
- # Response can be large: call sparingly (typically once per task/session) and
15848
- # reuse cached results.
15849
- query GetGraphqlSchema {
15850
- graphqlSchema
15851
- }`
15852
- }),
15853
- createOperationSpec({
15854
- operationName: "PauseAutomationRun",
15855
- kind: "mutation",
15856
- inputSchema: z23.object({
15857
- automationRunId: z23.string().min(1)
16215
+ inputSchema: z25.object({
16216
+ skill: z25.string().min(1),
16217
+ ref: z25.string().min(1).optional()
15858
16218
  }),
15859
16219
  cli: {
15860
- name: "pause-automation-run",
15861
- path: ["automation-runs", "pause"],
15862
- description: "Pause an automation run.",
15863
- resultKey: "pauseAutomationRun",
16220
+ name: "read-skill",
16221
+ path: ["skills", "read"],
16222
+ description: "Read every file in one root-level Workplace skill bundle.",
16223
+ resultKey: "skillsRead",
15864
16224
  options: [
15865
16225
  stringOption({
15866
- inputKey: "automationRunId",
15867
- flagName: "automation-run-id",
15868
- description: "Automation run ID.",
16226
+ inputKey: "skill",
16227
+ flagName: "skill",
16228
+ description: "Skill directory name or skills/<skill-name> path.",
15869
16229
  required: true
16230
+ }),
16231
+ stringOption({
16232
+ inputKey: "ref",
16233
+ flagName: "ref",
16234
+ description: "Branch, tag, or commit to read. Defaults to HEAD."
15870
16235
  })
15871
16236
  ]
15872
16237
  },
15873
- mcp: { fileName: "pauseAutomationRun.graphql" },
15874
- document: `# Mutation to pause an automation run
15875
- mutation PauseAutomationRun($automationRunId: ID!) {
15876
- pauseAutomationRun(automationRunId: $automationRunId)
16238
+ mcp: { fileName: "skillsRead.graphql" },
16239
+ document: `# Read one complete root-level Workplace skill bundle at a single resolved commit.
16240
+ query skills_read($skill: String!, $ref: String) {
16241
+ skillsRead(skill: $skill, ref: $ref) {
16242
+ path
16243
+ ref
16244
+ files {
16245
+ path
16246
+ size
16247
+ encoding
16248
+ content
16249
+ }
16250
+ }
15877
16251
  }`
15878
16252
  }),
15879
16253
  createOperationSpec({
15880
- operationName: "RerunAutomation",
15881
- kind: "mutation",
15882
- inputSchema: z23.object({
15883
- automationRunId: z23.string().min(1),
15884
- additionalPrompt: z23.string().min(1).optional(),
15885
- idempotencyKey: z23.string().min(1),
15886
- allowPointOfNoReturnOverride: z23.boolean().optional()
16254
+ operationName: "skills_history",
16255
+ kind: "query",
16256
+ inputSchema: z25.object({
16257
+ skill: z25.string().min(1),
16258
+ ref: z25.string().min(1).optional(),
16259
+ limit: z25.number().int().min(1).max(100).optional()
16260
+ }),
16261
+ cli: {
16262
+ name: "get-skill-history",
16263
+ path: ["skills", "history"],
16264
+ description: "List newest-first commits that changed one root-level skill bundle.",
16265
+ resultKey: "skillsHistory",
16266
+ options: [
16267
+ stringOption({
16268
+ inputKey: "skill",
16269
+ flagName: "skill",
16270
+ description: "Skill directory name or skills/<skill-name> path.",
16271
+ required: true
16272
+ }),
16273
+ stringOption({
16274
+ inputKey: "ref",
16275
+ flagName: "ref",
16276
+ description: "Branch, tag, or commit to inspect. Defaults to HEAD."
16277
+ }),
16278
+ numberOption({
16279
+ inputKey: "limit",
16280
+ flagName: "limit",
16281
+ description: "Number of commits to return, from 1 to 100."
16282
+ })
16283
+ ]
16284
+ },
16285
+ mcp: { fileName: "skillsHistory.graphql" },
16286
+ document: `# List newest-first commits that changed one root-level Workplace skill bundle.
16287
+ query skills_history($skill: String!, $ref: String, $limit: Int) {
16288
+ skillsHistory(skill: $skill, ref: $ref, limit: $limit) {
16289
+ path
16290
+ ref
16291
+ truncated
16292
+ commits {
16293
+ commit
16294
+ message
16295
+ committedAt
16296
+ author {
16297
+ name
16298
+ email
16299
+ }
16300
+ }
16301
+ }
16302
+ }`
16303
+ }),
16304
+ createOperationSpec({
16305
+ operationName: "skills_apply_patch",
16306
+ kind: "mutation",
16307
+ inputSchema: z25.object({
16308
+ patch: z25.string().min(1),
16309
+ message: z25.string().min(1),
16310
+ idempotencyKey: z25.string().min(1).optional(),
16311
+ ref: z25.string().min(1).optional()
16312
+ }),
16313
+ cli: {
16314
+ name: "apply-skills-patch",
16315
+ path: ["skills", "apply-patch"],
16316
+ description: "Atomically apply one Git patch limited to root-level skills/** files.",
16317
+ resultKey: "skillsApplyPatch",
16318
+ options: [
16319
+ stringOption({
16320
+ inputKey: "patch",
16321
+ flagName: "patch",
16322
+ description: "Raw Git unified diff changing only skills/** files.",
16323
+ required: true
16324
+ }),
16325
+ stringOption({
16326
+ inputKey: "message",
16327
+ flagName: "message",
16328
+ description: "Commit message for the atomic skill update.",
16329
+ required: true
16330
+ }),
16331
+ stringOption({
16332
+ inputKey: "idempotencyKey",
16333
+ flagName: "idempotency-key",
16334
+ description: "Optional key used to safely retry the same patch."
16335
+ }),
16336
+ stringOption({
16337
+ inputKey: "ref",
16338
+ flagName: "ref",
16339
+ description: "Branch to update. Defaults to HEAD."
16340
+ })
16341
+ ]
16342
+ },
16343
+ mcp: { fileName: "skillsApplyPatch.graphql" },
16344
+ document: `# Atomically apply one Git patch limited to root-level skills/** files.
16345
+ mutation skills_apply_patch(
16346
+ $patch: String!
16347
+ $message: String!
16348
+ $idempotencyKey: String
16349
+ $ref: String
16350
+ ) {
16351
+ skillsApplyPatch(
16352
+ patch: $patch
16353
+ message: $message
16354
+ idempotencyKey: $idempotencyKey
16355
+ ref: $ref
16356
+ ) {
16357
+ ok
16358
+ commit
16359
+ ref
16360
+ changedFiles {
16361
+ path
16362
+ status
16363
+ }
16364
+ }
16365
+ }`
16366
+ }),
16367
+ createOperationSpec({
16368
+ operationName: "CreateAutomation",
16369
+ kind: "mutation",
16370
+ inputSchema: z25.object({
16371
+ input: createAutomationInputSchema
16372
+ }),
16373
+ cli: {
16374
+ name: "create-automation",
16375
+ path: ["automations", "create"],
16376
+ description: "Create a draft automation.",
16377
+ resultKey: "createAutomation",
16378
+ options: [
16379
+ jsonOption({
16380
+ inputKey: "input",
16381
+ flagName: "input-json",
16382
+ description: `CreateAutomationInput payload. ${COMMAND_CATALOG_HELP}`,
16383
+ required: true
16384
+ })
16385
+ ]
16386
+ },
16387
+ mcp: { fileName: "createAutomation.graphql" },
16388
+ document: `# Mutation to create a draft automation with optional initial values
16389
+ # Returns flat fields only for MCP tool simplicity
16390
+ mutation CreateAutomation($input: CreateAutomationInput!) {
16391
+ createAutomation(input: $input) {
16392
+ id
16393
+ name
16394
+ organizationId
16395
+ createdAt
16396
+ updatedAt
16397
+ environment
16398
+ lastSavedAt
16399
+ publishedVersionId
16400
+ draftVersionId
16401
+ }
16402
+ }`
16403
+ }),
16404
+ createOperationSpec({
16405
+ operationName: "GetGraphqlSchema",
16406
+ kind: "query",
16407
+ inputSchema: z25.object({}),
16408
+ cli: {
16409
+ name: "get-graphql-schema",
16410
+ path: ["graphql", "schema"],
16411
+ description: "Fetch GraphQL schema metadata.",
16412
+ resultKey: "graphqlSchema",
16413
+ options: []
16414
+ },
16415
+ mcp: { fileName: "graphqlSchema.graphql" },
16416
+ document: `# Query to fetch full GraphQL schema metadata.
16417
+ # Uses the first-class graphqlSchema query field to avoid __schema validation
16418
+ # issues in MCP tool-load paths while still returning introspection JSON.
16419
+ # Response can be large: call sparingly (typically once per task/session) and
16420
+ # reuse cached results.
16421
+ query GetGraphqlSchema {
16422
+ graphqlSchema
16423
+ }`
16424
+ }),
16425
+ createOperationSpec({
16426
+ operationName: "ApproveAutomationStep",
16427
+ kind: "mutation",
16428
+ inputSchema: z25.object({
16429
+ runId: z25.string().min(1)
16430
+ }),
16431
+ cli: {
16432
+ name: "approve-automation-step",
16433
+ path: ["automation-runs", "approve-step"],
16434
+ description: "Approve the proposed step for a paused manual-mode run.",
16435
+ resultKey: "approveAutomationStep",
16436
+ options: [
16437
+ stringOption({
16438
+ inputKey: "runId",
16439
+ flagName: "run-id",
16440
+ description: "Automation run ID.",
16441
+ required: true
16442
+ })
16443
+ ]
16444
+ },
16445
+ mcp: { fileName: "approveAutomationStep.graphql" },
16446
+ document: `# Approve the proposed step for a paused manual-mode run
16447
+ mutation ApproveAutomationStep($runId: ID!) {
16448
+ approveAutomationStep(automationRunId: $runId, retry: false)
16449
+ }`
16450
+ }),
16451
+ createOperationSpec({
16452
+ operationName: "RetryAutomationStep",
16453
+ kind: "mutation",
16454
+ inputSchema: z25.object({
16455
+ runId: z25.string().min(1)
16456
+ }),
16457
+ cli: {
16458
+ name: "retry-automation-step",
16459
+ path: ["automation-runs", "retry-step"],
16460
+ description: "Retry the proposed step after saving a material change to its agent.",
16461
+ resultKey: "approveAutomationStep",
16462
+ options: [
16463
+ stringOption({
16464
+ inputKey: "runId",
16465
+ flagName: "run-id",
16466
+ description: "Automation run ID.",
16467
+ required: true
16468
+ })
16469
+ ]
16470
+ },
16471
+ mcp: { fileName: "retryAutomationStep.graphql" },
16472
+ document: `# Retry the proposed step after saving a material change to its agent
16473
+ mutation RetryAutomationStep($runId: ID!) {
16474
+ approveAutomationStep(automationRunId: $runId, retry: true)
16475
+ }`
16476
+ }),
16477
+ createOperationSpec({
16478
+ operationName: "PauseAutomationRun",
16479
+ kind: "mutation",
16480
+ inputSchema: z25.object({
16481
+ automationRunId: z25.string().min(1)
16482
+ }),
16483
+ cli: {
16484
+ name: "pause-automation-run",
16485
+ path: ["automation-runs", "pause"],
16486
+ description: "Pause an automation run.",
16487
+ resultKey: "pauseAutomationRun",
16488
+ options: [
16489
+ stringOption({
16490
+ inputKey: "automationRunId",
16491
+ flagName: "automation-run-id",
16492
+ description: "Automation run ID.",
16493
+ required: true
16494
+ })
16495
+ ]
16496
+ },
16497
+ mcp: { fileName: "pauseAutomationRun.graphql" },
16498
+ document: `# Mutation to pause an automation run
16499
+ mutation PauseAutomationRun($automationRunId: ID!) {
16500
+ pauseAutomationRun(automationRunId: $automationRunId)
16501
+ }`
16502
+ }),
16503
+ createOperationSpec({
16504
+ operationName: "RerunAutomation",
16505
+ kind: "mutation",
16506
+ inputSchema: z25.object({
16507
+ automationRunId: z25.string().min(1),
16508
+ additionalPrompt: z25.string().min(1).optional(),
16509
+ idempotencyKey: z25.string().min(1),
16510
+ allowPointOfNoReturnOverride: z25.boolean().optional()
15887
16511
  }),
15888
16512
  cli: {
15889
16513
  name: "rerun-automation",
@@ -15938,9 +16562,9 @@ mutation RerunAutomation(
15938
16562
  createOperationSpec({
15939
16563
  operationName: "ResumeAutomationRun",
15940
16564
  kind: "mutation",
15941
- inputSchema: z23.object({
15942
- automationRunId: z23.string().min(1),
15943
- message: z23.string().min(1).optional()
16565
+ inputSchema: z25.object({
16566
+ automationRunId: z25.string().min(1),
16567
+ message: z25.string().min(1).optional()
15944
16568
  }),
15945
16569
  cli: {
15946
16570
  name: "resume-automation-run",
@@ -15970,15 +16594,15 @@ mutation ResumeAutomationRun($automationRunId: ID!, $message: String) {
15970
16594
  createOperationSpec({
15971
16595
  operationName: "RunDraftAutomation",
15972
16596
  kind: "mutation",
15973
- inputSchema: z23.object({
15974
- draftAutomationId: z23.string().min(1),
15975
- agentId: z23.string().min(1),
15976
- idempotencyKey: z23.string().min(1),
15977
- input: z23.unknown().optional(),
15978
- initialStore: z23.record(z23.string(), z23.unknown()).optional(),
16597
+ inputSchema: z25.object({
16598
+ draftAutomationId: z25.string().min(1),
16599
+ agentId: z25.string().min(1),
16600
+ idempotencyKey: z25.string().min(1),
16601
+ input: z25.unknown().optional(),
16602
+ initialStore: z25.record(z25.string(), z25.unknown()).optional(),
15979
16603
  config: automationRunStartConfigSchema.partial().passthrough().optional(),
15980
- additionalPrompt: z23.string().min(1).optional(),
15981
- consistencyCheckCount: z23.number().int().optional()
16604
+ additionalPrompt: z25.string().min(1).optional(),
16605
+ consistencyCheckCount: z25.number().int().optional()
15982
16606
  }),
15983
16607
  cli: {
15984
16608
  name: "run-draft-automation",
@@ -16063,8 +16687,8 @@ mutation RunDraftAutomation(
16063
16687
  createOperationSpec({
16064
16688
  operationName: "StopAutomationRun",
16065
16689
  kind: "mutation",
16066
- inputSchema: z23.object({
16067
- automationRunId: z23.string().min(1)
16690
+ inputSchema: z25.object({
16691
+ automationRunId: z25.string().min(1)
16068
16692
  }),
16069
16693
  cli: {
16070
16694
  name: "stop-automation-run",
@@ -16089,10 +16713,10 @@ mutation StopAutomationRun($automationRunId: ID!) {
16089
16713
  createOperationSpec({
16090
16714
  operationName: "PreviewAutomationPatch",
16091
16715
  kind: "mutation",
16092
- inputSchema: z23.object({
16093
- draftAutomationId: z23.string().min(1),
16094
- expectedLastSavedAt: z23.string().optional(),
16095
- operations: z23.array(z23.unknown()).min(1)
16716
+ inputSchema: z25.object({
16717
+ draftAutomationId: z25.string().min(1),
16718
+ expectedLastSavedAt: z25.string().optional(),
16719
+ operations: automationPatchOperationsSchema
16096
16720
  }),
16097
16721
  cli: {
16098
16722
  name: "preview-automation-patch",
@@ -16109,7 +16733,7 @@ mutation StopAutomationRun($automationRunId: ID!) {
16109
16733
  jsonOption({
16110
16734
  inputKey: "operations",
16111
16735
  flagName: "operations-json",
16112
- description: "Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape.",
16736
+ description: `Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape. ${COMMAND_CATALOG_HELP}`,
16113
16737
  required: true
16114
16738
  })
16115
16739
  ]
@@ -16201,9 +16825,9 @@ mutation PreviewAutomationPatch(
16201
16825
  createOperationSpec({
16202
16826
  operationName: "ApplyAutomationPatch",
16203
16827
  kind: "mutation",
16204
- inputSchema: z23.object({
16205
- draftAutomationId: z23.string().min(1),
16206
- operations: z23.array(z23.unknown()).min(1)
16828
+ inputSchema: z25.object({
16829
+ draftAutomationId: z25.string().min(1),
16830
+ operations: automationPatchOperationsSchema
16207
16831
  }),
16208
16832
  cli: {
16209
16833
  name: "apply-automation-patch",
@@ -16220,7 +16844,7 @@ mutation PreviewAutomationPatch(
16220
16844
  jsonOption({
16221
16845
  inputKey: "operations",
16222
16846
  flagName: "operations-json",
16223
- description: "Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape.",
16847
+ description: `Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape. ${COMMAND_CATALOG_HELP}`,
16224
16848
  required: true
16225
16849
  }),
16226
16850
  stringOption({
@@ -16319,9 +16943,9 @@ mutation ApplyAutomationPatch(
16319
16943
  createOperationSpec({
16320
16944
  operationName: "UpdateAutomationById",
16321
16945
  kind: "mutation",
16322
- inputSchema: z23.object({
16323
- id: z23.string().min(1),
16324
- input: jsonObjectSchema
16946
+ inputSchema: z25.object({
16947
+ id: z25.string().min(1),
16948
+ input: updateAutomationInputSchema
16325
16949
  }),
16326
16950
  cli: {
16327
16951
  name: "update-automation-by-id",
@@ -16338,7 +16962,7 @@ mutation ApplyAutomationPatch(
16338
16962
  jsonOption({
16339
16963
  inputKey: "input",
16340
16964
  flagName: "input-json",
16341
- description: "UpdateAutomationInput payload. Must include baseVersionId from a fresh read. Store schema writes are additive under config.storeSchema; use removeStoreSchemaPaths for explicit deletion or replaceStoreSchema for exact replacement.",
16965
+ description: `UpdateAutomationInput payload. Must include baseVersionId from a fresh read. Store schema writes are additive under config.storeSchema; use removeStoreSchemaPaths for explicit deletion or replaceStoreSchema for exact replacement. ${COMMAND_CATALOG_HELP}`,
16342
16966
  required: true
16343
16967
  })
16344
16968
  ]
@@ -16363,7 +16987,7 @@ mutation UpdateAutomationById($id: ID!, $input: UpdateAutomationInput!) {
16363
16987
  import { Command as Command2, InvalidArgumentError as InvalidArgumentError2, Option as Option2 } from "commander";
16364
16988
 
16365
16989
  // src/api.ts
16366
- import { z as z24 } from "zod";
16990
+ import { z as z26 } from "zod";
16367
16991
 
16368
16992
  // src/version.ts
16369
16993
  import fs from "node:fs";
@@ -16390,55 +17014,55 @@ var CLI_VERSION = cliPackageVersion;
16390
17014
  // src/api.ts
16391
17015
  var OTTO_AUTHORIZATION_HEADER_NAME = "X-Otto-Authorization";
16392
17016
  var OTTO_AUTHORIZATION_ISSUER = "magical:otto";
16393
- var workosOrganizationsResponseSchema = z24.object({
16394
- organizations: z24.array(
16395
- z24.object({
16396
- id: z24.string().min(1),
16397
- name: z24.string().min(1),
16398
- primaryDomain: z24.string().nullable().optional()
17017
+ var workosOrganizationsResponseSchema = z26.object({
17018
+ organizations: z26.array(
17019
+ z26.object({
17020
+ id: z26.string().min(1),
17021
+ name: z26.string().min(1),
17022
+ primaryDomain: z26.string().nullable().optional()
16399
17023
  })
16400
17024
  ),
16401
- success: z24.boolean()
17025
+ success: z26.boolean()
16402
17026
  });
16403
- var workosUserSchema = z24.object({
16404
- email: z24.string().nullable(),
16405
- id: z24.string().min(1)
17027
+ var workosUserSchema = z26.object({
17028
+ email: z26.string().nullable(),
17029
+ id: z26.string().min(1)
16406
17030
  });
16407
- var nangoIntegrationWireSchema = z24.object({
17031
+ var nangoIntegrationWireSchema = z26.object({
16408
17032
  // eslint-disable-next-line @typescript-eslint/naming-convention -- mirrors Nango REST payload
16409
- unique_key: z24.string().min(1)
17033
+ unique_key: z26.string().min(1)
16410
17034
  }).passthrough().transform((data) => ({
16411
17035
  ...data,
16412
17036
  uniqueKey: data.unique_key
16413
17037
  }));
16414
- var nangoIntegrationsResponseSchema = z24.array(nangoIntegrationWireSchema);
16415
- var organizationAuthenticationSchema = z24.object({
16416
- id: z24.string().min(1),
16417
- type: z24.string().min(1),
16418
- connectionId: z24.string().nullable().optional(),
16419
- providerConfigKey: z24.string().nullable().optional(),
16420
- description: z24.string().nullable().optional(),
16421
- hostname: z24.string().nullable().optional()
17038
+ var nangoIntegrationsResponseSchema = z26.array(nangoIntegrationWireSchema);
17039
+ var organizationAuthenticationSchema = z26.object({
17040
+ id: z26.string().min(1),
17041
+ type: z26.string().min(1),
17042
+ connectionId: z26.string().nullable().optional(),
17043
+ providerConfigKey: z26.string().nullable().optional(),
17044
+ description: z26.string().nullable().optional(),
17045
+ hostname: z26.string().nullable().optional()
16422
17046
  }).passthrough();
16423
- var organizationAuthenticationsResponseSchema = z24.object({
16424
- authentications: z24.array(organizationAuthenticationSchema),
16425
- success: z24.boolean()
17047
+ var organizationAuthenticationsResponseSchema = z26.object({
17048
+ authentications: z26.array(organizationAuthenticationSchema),
17049
+ success: z26.boolean()
16426
17050
  });
16427
- var graphQlResponseSchema = z24.object({
16428
- data: z24.record(z24.string(), z24.unknown()).optional(),
16429
- errors: z24.array(
16430
- z24.object({
16431
- message: z24.string().min(1)
17051
+ var graphQlResponseSchema = z26.object({
17052
+ data: z26.record(z26.string(), z26.unknown()).optional(),
17053
+ errors: z26.array(
17054
+ z26.object({
17055
+ message: z26.string().min(1)
16432
17056
  })
16433
17057
  ).optional()
16434
17058
  });
16435
- var apiErrorResponseSchema = z24.object({
16436
- errors: z24.array(
16437
- z24.object({
16438
- message: z24.string().min(1)
17059
+ var apiErrorResponseSchema = z26.object({
17060
+ errors: z26.array(
17061
+ z26.object({
17062
+ message: z26.string().min(1)
16439
17063
  })
16440
17064
  ).optional(),
16441
- message: z24.string().min(1).optional()
17065
+ message: z26.string().min(1).optional()
16442
17066
  });
16443
17067
  function getApiErrorDetail(responseBody) {
16444
17068
  const parsedResponse = apiErrorResponseSchema.safeParse(responseBody);
@@ -16456,7 +17080,7 @@ function getApiErrorDetail(responseBody) {
16456
17080
  function trimTrailingSlash(value) {
16457
17081
  return value.replace(/\/+$/u, "");
16458
17082
  }
16459
- function isRecord2(value) {
17083
+ function isRecord4(value) {
16460
17084
  return typeof value === "object" && value !== null && !Array.isArray(value);
16461
17085
  }
16462
17086
  function decodeJwtPayload(token) {
@@ -16470,7 +17094,7 @@ function decodeJwtPayload(token) {
16470
17094
  if (isErr(payloadResult)) {
16471
17095
  return null;
16472
17096
  }
16473
- return isRecord2(payloadResult.value) ? payloadResult.value : null;
17097
+ return isRecord4(payloadResult.value) ? payloadResult.value : null;
16474
17098
  }
16475
17099
  function isOttoAuthorizationToken(token) {
16476
17100
  return decodeJwtPayload(token)?.["iss"] === OTTO_AUTHORIZATION_ISSUER;
@@ -16509,11 +17133,11 @@ function createMagicalApiClient({
16509
17133
  accessToken,
16510
17134
  impersonatedOrganizationId,
16511
17135
  allowOttoAuthorization,
16512
- path: path7,
17136
+ path: path8,
16513
17137
  init,
16514
17138
  organizationId
16515
17139
  }) {
16516
- const url = `${trimTrailingSlash(await resolveApiBaseUrl())}${path7}`;
17140
+ const url = `${trimTrailingSlash(await resolveApiBaseUrl())}${path8}`;
16517
17141
  const headers = new Headers(init?.headers);
16518
17142
  applyAuthenticationHeaders({
16519
17143
  accessToken,
@@ -16682,6 +17306,29 @@ var CLI_ACCESS_TOKEN_FILE_NAME = "access-token.txt";
16682
17306
  var CLI_STATE_FILE_NAME = "state.json";
16683
17307
  var CLI_SETTINGS_FILE_NAME = "settings.json";
16684
17308
  var CLI_REFRESH_TOKEN_FILE_NAME = "refresh-tokens.json";
17309
+ function getIsolatedGitEnvironment() {
17310
+ const environment = {};
17311
+ environment["GIT_CONFIG_GLOBAL"] = os.devNull;
17312
+ environment["GIT_CONFIG_NOSYSTEM"] = "1";
17313
+ environment["GIT_TERMINAL_PROMPT"] = "0";
17314
+ for (const key of [
17315
+ "COMSPEC",
17316
+ "HOME",
17317
+ "PATH",
17318
+ "PATHEXT",
17319
+ "SYSTEMROOT",
17320
+ "TEMP",
17321
+ "TMP",
17322
+ "TMPDIR",
17323
+ "USERPROFILE"
17324
+ ]) {
17325
+ const value = process.env[key];
17326
+ if (value !== void 0) {
17327
+ environment[key] = value;
17328
+ }
17329
+ }
17330
+ return environment;
17331
+ }
16685
17332
  function resolvePlatformConfigDirectory() {
16686
17333
  const customConfigDirectory = process.env["MAGICAL_CLI_CONFIG_DIR"];
16687
17334
  if (customConfigDirectory) {
@@ -16727,10 +17374,10 @@ function requireWorkosClientId(config) {
16727
17374
  // src/settings.ts
16728
17375
  import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
16729
17376
  import path3 from "node:path";
16730
- import { z as z25 } from "zod";
16731
- var cliSettingsSchema = z25.object({
16732
- env: z25.object({
16733
- baseUrl: z25.url().optional()
17377
+ import { z as z27 } from "zod";
17378
+ var cliSettingsSchema = z27.object({
17379
+ env: z27.object({
17380
+ baseUrl: z27.url().optional()
16734
17381
  }).default({})
16735
17382
  });
16736
17383
  function createEmptyCliSettings() {
@@ -16873,7 +17520,8 @@ var rootOperationalGroupDescriptions = /* @__PURE__ */ new Map([
16873
17520
  ["automations", "Manage automations."],
16874
17521
  ["automation-runs", "Inspect and control automation runs."],
16875
17522
  ["catalog", "Inspect available commands, models, and tools."],
16876
- ["graphql", "Inspect GraphQL metadata."]
17523
+ ["graphql", "Inspect GraphQL metadata."],
17524
+ ["skills", "Inspect and update root-level Workplace skills."]
16877
17525
  ]);
16878
17526
  function configureCommandPresentation(command) {
16879
17527
  const originalCreateCommand = command.createCommand.bind(command);
@@ -17329,35 +17977,708 @@ ${formatExamples("Examples", [
17329
17977
  return settingsCommand;
17330
17978
  }
17331
17979
 
17332
- // src/state.ts
17333
- import { mkdir as mkdir2, readFile as readFile3, rm as rm3, writeFile as writeFile2 } from "node:fs/promises";
17980
+ // src/skills-working-copy.ts
17981
+ import { execFile } from "node:child_process";
17982
+ import { createHash, randomUUID } from "node:crypto";
17983
+ import {
17984
+ lstat,
17985
+ mkdir as mkdir2,
17986
+ mkdtemp,
17987
+ readFile as readFile3,
17988
+ readdir,
17989
+ rename,
17990
+ rm as rm3,
17991
+ writeFile as writeFile2
17992
+ } from "node:fs/promises";
17993
+ import os2 from "node:os";
17334
17994
  import path5 from "node:path";
17335
- import { z as z26 } from "zod";
17336
- var cliAccountSchema = z26.object({
17337
- clientId: z26.string().min(1),
17338
- email: z26.string().nullable(),
17339
- userId: z26.string().min(1)
17995
+ import { z as z28 } from "zod";
17996
+ var SKILLS_ROOT_PATH = "skills";
17997
+ var METADATA_DIRECTORY_NAME = "skill-working-copies";
17998
+ var MAX_GIT_OUTPUT_BYTES = 10 * 1024 * 1024;
17999
+ var GIT_TIMEOUT_MS = 3e4;
18000
+ var FULL_COMMIT_SHA_PATTERN = /^[\dA-Fa-f]{40}$/u;
18001
+ var UTF8_ENCODER = new TextEncoder();
18002
+ var WINDOWS_RESERVED_PATH_CHARACTER_PATTERN = /[<>:"|?*]/u;
18003
+ var WINDOWS_RESERVED_PATH_NAME_PATTERN = /^(?:AUX|CON|NUL|PRN|COM[1-9]|LPT[1-9])(?:\..*)?$/iu;
18004
+ var skillBundleSchema = z28.object({
18005
+ files: z28.array(
18006
+ z28.object({
18007
+ content: z28.string(),
18008
+ encoding: z28.literal("base64"),
18009
+ path: z28.string().min(1),
18010
+ size: z28.number().int().nonnegative()
18011
+ })
18012
+ ),
18013
+ path: z28.string().min(1),
18014
+ ref: z28.string().regex(FULL_COMMIT_SHA_PATTERN)
17340
18015
  });
17341
- var cliOrganizationSchema = z26.object({
17342
- id: z26.string().min(1),
17343
- name: z26.string().min(1),
17344
- primaryDomain: z26.string().nullable().default(null)
18016
+ var skillsApplyPatchResultSchema = z28.object({
18017
+ changedFiles: z28.array(
18018
+ z28.object({ path: z28.string().min(1), status: z28.string().min(1) })
18019
+ ),
18020
+ commit: z28.string().regex(FULL_COMMIT_SHA_PATTERN),
18021
+ ok: z28.boolean(),
18022
+ ref: z28.string().min(1)
18023
+ }).refine((result) => result.ok, {
18024
+ message: "Skills patch result was not successful."
17345
18025
  });
17346
- var cliStateSchema = z26.object({
18026
+ var workingCopyMetadataSchema = z28.object({
18027
+ version: z28.literal(1),
18028
+ files: z28.array(
18029
+ z28.object({
18030
+ content: z28.string(),
18031
+ path: z28.string().min(1)
18032
+ })
18033
+ ),
18034
+ organizationId: z28.string().min(1),
18035
+ requestedRef: z28.string().min(1).nullable(),
18036
+ skillPath: z28.string().min(1),
18037
+ workingCopyPath: z28.string().min(1)
18038
+ });
18039
+ function hasControlCharacter2(value) {
18040
+ return UTF8_ENCODER.encode(value).some((byte) => byte <= 31 || byte === 127);
18041
+ }
18042
+ function hasWindowsUnsafePathSyntax(value) {
18043
+ return WINDOWS_RESERVED_PATH_CHARACTER_PATTERN.test(value) || WINDOWS_RESERVED_PATH_NAME_PATTERN.test(value) || value.endsWith(".") || value.endsWith(" ");
18044
+ }
18045
+ function isSafeSkillName(value) {
18046
+ return value.length > 0 && !value.startsWith(".") && !value.includes("\\") && !hasControlCharacter2(value) && !hasWindowsUnsafePathSyntax(value) && value !== "..";
18047
+ }
18048
+ function normalizeRootSkillPath(skill) {
18049
+ const normalizedInput = skill.trim().replace(/\/+$/u, "");
18050
+ const segments = normalizedInput.split("/");
18051
+ let skillName = void 0;
18052
+ if (segments.length === 1) {
18053
+ [skillName] = segments;
18054
+ } else if (segments.length === 2 && segments[0] === SKILLS_ROOT_PATH) {
18055
+ [, skillName] = segments;
18056
+ }
18057
+ if (!skillName || !isSafeSkillName(skillName)) {
18058
+ throw new CliError(
18059
+ "Skill must be a root-level directory name or a skills/<skill-name> path."
18060
+ );
18061
+ }
18062
+ return `${SKILLS_ROOT_PATH}/${skillName}`;
18063
+ }
18064
+ function resolveWorkingCopyPath(workingDirectory, skillPath) {
18065
+ return path5.resolve(workingDirectory, ...skillPath.split("/"));
18066
+ }
18067
+ function resolveMetadataPath(stateFilePath, workingCopyPath) {
18068
+ const key = createHash("sha256").update(workingCopyPath).digest("hex");
18069
+ return path5.join(
18070
+ path5.dirname(stateFilePath),
18071
+ METADATA_DIRECTORY_NAME,
18072
+ `${key}.json`
18073
+ );
18074
+ }
18075
+ function isMissingFileError(error) {
18076
+ return error instanceof Error && "code" in error && error.code === "ENOENT";
18077
+ }
18078
+ async function pathExists(filePath) {
18079
+ return await lstat(filePath).then(() => true).catch((error) => {
18080
+ if (isMissingFileError(error)) {
18081
+ return false;
18082
+ }
18083
+ throw error;
18084
+ });
18085
+ }
18086
+ function snapshotToMetadataFiles(snapshot) {
18087
+ return [...snapshot.entries()].toSorted(([leftPath], [rightPath]) => leftPath.localeCompare(rightPath)).map(([filePath, content]) => ({
18088
+ content: content.toString("base64"),
18089
+ path: filePath
18090
+ }));
18091
+ }
18092
+ function metadataFilesToSnapshot(files) {
18093
+ return new Map(
18094
+ files.map((file) => [file.path, Buffer.from(file.content, "base64")])
18095
+ );
18096
+ }
18097
+ async function loadMetadata(metadataPath) {
18098
+ const fileContents = await readFile3(metadataPath, "utf8").catch(
18099
+ (error) => {
18100
+ if (isMissingFileError(error)) {
18101
+ return null;
18102
+ }
18103
+ throw new CliError("Failed to read Skills working-copy metadata.", {
18104
+ cause: error
18105
+ });
18106
+ }
18107
+ );
18108
+ if (fileContents === null) {
18109
+ return null;
18110
+ }
18111
+ const jsonResult = safeJsonParseWithoutLogging(fileContents);
18112
+ if (isErr(jsonResult)) {
18113
+ throw new CliError("Stored Skills working-copy metadata is invalid.");
18114
+ }
18115
+ const parsed = workingCopyMetadataSchema.safeParse(jsonResult.value);
18116
+ if (!parsed.success) {
18117
+ throw new CliError("Stored Skills working-copy metadata is invalid.");
18118
+ }
18119
+ return parsed.data;
18120
+ }
18121
+ async function saveMetadata(metadataPath, metadata) {
18122
+ await mkdir2(path5.dirname(metadataPath), { recursive: true });
18123
+ const temporaryPath = `${metadataPath}.${randomUUID()}.tmp`;
18124
+ await writeFile2(temporaryPath, `${JSON.stringify(metadata, null, 2)}
18125
+ `, {
18126
+ mode: 384
18127
+ });
18128
+ await rename(temporaryPath, metadataPath);
18129
+ }
18130
+ function assertSafeRelativeFilePath(relativePath) {
18131
+ const segments = relativePath.split("/");
18132
+ if (relativePath.length === 0 || relativePath.startsWith("/") || relativePath.includes("\\") || hasControlCharacter2(relativePath) || segments.some(
18133
+ (segment) => segment.length === 0 || segment === "." || segment === ".." || segment === ".git" || hasWindowsUnsafePathSyntax(segment)
18134
+ )) {
18135
+ throw new CliError(
18136
+ `Skill bundle returned unsafe file path "${relativePath}".`
18137
+ );
18138
+ }
18139
+ }
18140
+ function parseBundle(value, expectedSkillPath) {
18141
+ const parsed = skillBundleSchema.safeParse(value);
18142
+ if (!parsed.success) {
18143
+ throw new CliError("Skills API returned an invalid bundle.");
18144
+ }
18145
+ const bundle = parsed.data;
18146
+ if (bundle.path !== expectedSkillPath) {
18147
+ throw new CliError(
18148
+ `Skills API returned "${bundle.path}" while reading "${expectedSkillPath}".`
18149
+ );
18150
+ }
18151
+ const snapshot = /* @__PURE__ */ new Map();
18152
+ for (const file of bundle.files) {
18153
+ const prefix = `${bundle.path}/`;
18154
+ if (!file.path.startsWith(prefix)) {
18155
+ throw new CliError(
18156
+ `Skill bundle returned file outside "${bundle.path}": "${file.path}".`
18157
+ );
18158
+ }
18159
+ const relativePath = file.path.slice(prefix.length);
18160
+ assertSafeRelativeFilePath(relativePath);
18161
+ if (snapshot.has(file.path)) {
18162
+ throw new CliError(
18163
+ `Skill bundle returned duplicate file "${file.path}".`
18164
+ );
18165
+ }
18166
+ const content = Buffer.from(file.content, "base64");
18167
+ if (content.byteLength !== file.size) {
18168
+ throw new CliError(
18169
+ `Skill bundle returned an invalid size for "${file.path}".`
18170
+ );
18171
+ }
18172
+ snapshot.set(file.path, content);
18173
+ }
18174
+ if (snapshot.size === 0) {
18175
+ throw new CliError(`Skill bundle "${bundle.path}" contains no files.`);
18176
+ }
18177
+ return { bundle, snapshot };
18178
+ }
18179
+ async function readDirectorySnapshot({
18180
+ directoryPath,
18181
+ skillPath
18182
+ }) {
18183
+ if (!await pathExists(directoryPath)) {
18184
+ return /* @__PURE__ */ new Map();
18185
+ }
18186
+ const rootStats = await lstat(directoryPath);
18187
+ if (!rootStats.isDirectory()) {
18188
+ throw new CliError(
18189
+ `Skill working copy "${directoryPath}" is not a directory.`
18190
+ );
18191
+ }
18192
+ async function visit(currentDirectory, segments) {
18193
+ const entries = await readdir(currentDirectory, { withFileTypes: true });
18194
+ const nestedEntries = await Promise.all(
18195
+ entries.toSorted((left, right) => left.name.localeCompare(right.name)).map(async (entry) => {
18196
+ const nextSegments = [...segments, entry.name];
18197
+ const relativePath = nextSegments.join("/");
18198
+ assertSafeRelativeFilePath(relativePath);
18199
+ const filePath = path5.join(currentDirectory, entry.name);
18200
+ if (entry.isDirectory()) {
18201
+ return await visit(filePath, nextSegments);
18202
+ }
18203
+ if (!entry.isFile()) {
18204
+ throw new CliError(
18205
+ `Skill working copy contains unsupported entry "${filePath}". Only regular files and directories are allowed.`
18206
+ );
18207
+ }
18208
+ return [[`${skillPath}/${relativePath}`, await readFile3(filePath)]];
18209
+ })
18210
+ );
18211
+ return nestedEntries.flat();
18212
+ }
18213
+ return new Map(await visit(directoryPath, []));
18214
+ }
18215
+ function contentEquals(left, right) {
18216
+ if (left === void 0 || right === void 0) {
18217
+ return left === right;
18218
+ }
18219
+ return left.equals(right);
18220
+ }
18221
+ function snapshotsEqual(left, right) {
18222
+ if (left.size !== right.size) {
18223
+ return false;
18224
+ }
18225
+ return [...left.entries()].every(
18226
+ ([filePath, content]) => contentEquals(content, right.get(filePath))
18227
+ );
18228
+ }
18229
+ async function writeSnapshotContents(rootPath, snapshot, prefix) {
18230
+ await Promise.all(
18231
+ [...snapshot.entries()].map(async ([filePath, content]) => {
18232
+ const relativePath = prefix === null ? filePath : filePath.slice(`${prefix}/`.length);
18233
+ assertSafeRelativeFilePath(relativePath);
18234
+ const targetPath = path5.join(rootPath, ...relativePath.split("/"));
18235
+ await mkdir2(path5.dirname(targetPath), { recursive: true });
18236
+ await writeFile2(targetPath, content);
18237
+ })
18238
+ );
18239
+ }
18240
+ async function replaceWorkingCopy({
18241
+ snapshot,
18242
+ skillPath,
18243
+ workingCopyPath
18244
+ }) {
18245
+ const parentPath = path5.dirname(workingCopyPath);
18246
+ await mkdir2(parentPath, { recursive: true });
18247
+ const temporaryPath = path5.join(
18248
+ parentPath,
18249
+ `.mgcl-${path5.basename(workingCopyPath)}-${randomUUID()}.tmp`
18250
+ );
18251
+ const backupPath = `${workingCopyPath}.${randomUUID()}.bak`;
18252
+ await mkdir2(temporaryPath);
18253
+ const prepareResult = await fromThrowable(async () => {
18254
+ await writeSnapshotContents(temporaryPath, snapshot, skillPath);
18255
+ const hadExistingWorkingCopy = await pathExists(workingCopyPath);
18256
+ if (hadExistingWorkingCopy) {
18257
+ await rename(workingCopyPath, backupPath);
18258
+ }
18259
+ return hadExistingWorkingCopy;
18260
+ }, "skills-working-copy-replace-failed");
18261
+ if (isErr(prepareResult)) {
18262
+ await rm3(temporaryPath, { force: true, recursive: true });
18263
+ throw new CliError("Failed to replace the skill working copy.", {
18264
+ cause: prepareResult.error.cause
18265
+ });
18266
+ }
18267
+ const activationResult = await fromThrowable(async () => {
18268
+ await rename(temporaryPath, workingCopyPath);
18269
+ }, "skills-working-copy-activation-failed");
18270
+ if (isErr(activationResult)) {
18271
+ if (prepareResult.value) {
18272
+ await rename(backupPath, workingCopyPath);
18273
+ }
18274
+ await rm3(temporaryPath, { force: true, recursive: true });
18275
+ throw new CliError("Failed to activate the new skill working copy.", {
18276
+ cause: activationResult.error.cause
18277
+ });
18278
+ }
18279
+ if (prepareResult.value) {
18280
+ await rm3(backupPath, { force: true, recursive: true });
18281
+ }
18282
+ }
18283
+ async function runGit(arguments_, cwd, allowedExitCodes = [0]) {
18284
+ const result = await new Promise((resolve, reject) => {
18285
+ execFile(
18286
+ "git",
18287
+ arguments_,
18288
+ {
18289
+ cwd,
18290
+ encoding: "buffer",
18291
+ env: getIsolatedGitEnvironment(),
18292
+ maxBuffer: MAX_GIT_OUTPUT_BYTES,
18293
+ timeout: GIT_TIMEOUT_MS
18294
+ },
18295
+ (error, stdout, stderr) => {
18296
+ let exitCode = 0;
18297
+ if (error !== null) {
18298
+ exitCode = typeof error.code === "number" ? error.code : -1;
18299
+ }
18300
+ const commandResult = { exitCode, stderr, stdout };
18301
+ if (error && !allowedExitCodes.includes(exitCode)) {
18302
+ reject(
18303
+ new CliError(
18304
+ `Git command failed: ${stderr.toString("utf8").trim() || error.message}`,
18305
+ { cause: error }
18306
+ )
18307
+ );
18308
+ return;
18309
+ }
18310
+ resolve(commandResult);
18311
+ }
18312
+ );
18313
+ });
18314
+ return result;
18315
+ }
18316
+ async function clearDirectoryExceptGit(directoryPath) {
18317
+ const entries = await readdir(directoryPath);
18318
+ await Promise.all(
18319
+ entries.filter((entry) => entry !== ".git").map(async (entry) => {
18320
+ await rm3(path5.join(directoryPath, entry), {
18321
+ force: true,
18322
+ recursive: true
18323
+ });
18324
+ })
18325
+ );
18326
+ }
18327
+ async function createPatch(before, after) {
18328
+ if (snapshotsEqual(before, after)) {
18329
+ return "";
18330
+ }
18331
+ const repositoryPath = await mkdtemp(
18332
+ path5.join(os2.tmpdir(), "mgcl-skills-diff-")
18333
+ );
18334
+ const patchResult = await fromThrowable(async () => {
18335
+ await runGit(["init", "--quiet"], repositoryPath);
18336
+ await writeSnapshotContents(repositoryPath, before, null);
18337
+ await stageCompleteSnapshot(repositoryPath, before);
18338
+ await runGit(
18339
+ [
18340
+ "-c",
18341
+ "user.name=mgcl",
18342
+ "-c",
18343
+ "user.email=mgcl@getmagical.com",
18344
+ "-c",
18345
+ "commit.gpgsign=false",
18346
+ "commit",
18347
+ "--allow-empty",
18348
+ "--quiet",
18349
+ "-m",
18350
+ "Skills baseline"
18351
+ ],
18352
+ repositoryPath
18353
+ );
18354
+ await clearDirectoryExceptGit(repositoryPath);
18355
+ await writeSnapshotContents(repositoryPath, after, null);
18356
+ await stageCompleteSnapshot(repositoryPath, after);
18357
+ const result = await runGit(
18358
+ [
18359
+ "diff",
18360
+ "--cached",
18361
+ "--no-color",
18362
+ "--no-ext-diff",
18363
+ "--no-renames",
18364
+ "--full-index",
18365
+ "--src-prefix=a/",
18366
+ "--dst-prefix=b/",
18367
+ "HEAD",
18368
+ "--",
18369
+ "."
18370
+ ],
18371
+ repositoryPath
18372
+ );
18373
+ return result.stdout.toString("utf8");
18374
+ }, "skills-patch-generation-failed");
18375
+ await rm3(repositoryPath, { force: true, recursive: true });
18376
+ if (isErr(patchResult)) {
18377
+ throw patchResult.error.cause;
18378
+ }
18379
+ return patchResult.value;
18380
+ }
18381
+ async function stageCompleteSnapshot(repositoryPath, snapshot) {
18382
+ await runGit(["add", "--all", "--force", "--", "."], repositoryPath);
18383
+ const trackedFilesResult = await runGit(
18384
+ ["ls-files", "--cached", "-z"],
18385
+ repositoryPath
18386
+ );
18387
+ const trackedFiles = trackedFilesResult.stdout.toString("utf8").split("\0").filter((filePath) => filePath.length > 0).toSorted();
18388
+ const expectedFiles = [...snapshot.keys()].toSorted();
18389
+ if (trackedFiles.length !== expectedFiles.length || trackedFiles.some((filePath, index) => filePath !== expectedFiles[index])) {
18390
+ throw new CliError(
18391
+ "Failed to stage the complete skill snapshot for patch generation."
18392
+ );
18393
+ }
18394
+ }
18395
+ function createMetadata({
18396
+ organizationId,
18397
+ requestedRef,
18398
+ skillPath,
18399
+ snapshot,
18400
+ workingCopyPath
18401
+ }) {
18402
+ return {
18403
+ version: 1,
18404
+ files: snapshotToMetadataFiles(snapshot),
18405
+ organizationId,
18406
+ requestedRef,
18407
+ skillPath,
18408
+ workingCopyPath
18409
+ };
18410
+ }
18411
+ function assertMetadataMatchesContext({
18412
+ metadata,
18413
+ organizationId,
18414
+ skillPath,
18415
+ workingCopyPath
18416
+ }) {
18417
+ if (metadata.skillPath !== skillPath || metadata.workingCopyPath !== workingCopyPath) {
18418
+ throw new CliError(
18419
+ "Stored Skills working-copy metadata does not match this folder."
18420
+ );
18421
+ }
18422
+ if (metadata.organizationId !== organizationId) {
18423
+ throw new CliError(
18424
+ `This skill working copy belongs to organization "${metadata.organizationId}". Select that organization or pull with --force to replace it.`
18425
+ );
18426
+ }
18427
+ if (metadata.requestedRef !== null) {
18428
+ throw new CliError(
18429
+ "This skill working copy targets a non-default ref, which is no longer supported. Pull it again with --force to use the repository default branch."
18430
+ );
18431
+ }
18432
+ }
18433
+ async function requireWorkingCopy({
18434
+ organizationId,
18435
+ skill,
18436
+ stateFilePath,
18437
+ workingDirectory
18438
+ }) {
18439
+ const skillPath = normalizeRootSkillPath(skill);
18440
+ const workingCopyPath = resolveWorkingCopyPath(workingDirectory, skillPath);
18441
+ const metadataPath = resolveMetadataPath(stateFilePath, workingCopyPath);
18442
+ const metadata = await loadMetadata(metadataPath);
18443
+ if (!metadata) {
18444
+ throw new CliError(
18445
+ `No pulled working copy exists for "${skillPath}" in this folder. Run "mgcl skills pull ${skillPath}" first.`
18446
+ );
18447
+ }
18448
+ assertMetadataMatchesContext({
18449
+ metadata,
18450
+ organizationId,
18451
+ skillPath,
18452
+ workingCopyPath
18453
+ });
18454
+ return {
18455
+ base: metadataFilesToSnapshot(metadata.files),
18456
+ local: await readDirectorySnapshot({
18457
+ directoryPath: workingCopyPath,
18458
+ skillPath
18459
+ }),
18460
+ metadata,
18461
+ metadataPath,
18462
+ skillPath,
18463
+ workingCopyPath
18464
+ };
18465
+ }
18466
+ async function readRemoteBundle(api, skillPath, requestedRef) {
18467
+ return parseBundle(
18468
+ await api.read({
18469
+ skill: skillPath,
18470
+ ...requestedRef === null ? {} : { ref: requestedRef }
18471
+ }),
18472
+ skillPath
18473
+ );
18474
+ }
18475
+ function assertTextPatch(patchContents) {
18476
+ if (/^GIT binary patch$/mu.test(patchContents) || /^Binary files .* differ$/mu.test(patchContents)) {
18477
+ throw new CliError(
18478
+ "Binary skill changes cannot be pushed because repo-browser only accepts text patches."
18479
+ );
18480
+ }
18481
+ }
18482
+ function isPatchApplyConflict(error) {
18483
+ return error instanceof Error && (/Patch does not apply/iu.test(error.message) || /Branch was updated while applying patch/iu.test(error.message));
18484
+ }
18485
+ async function pullSkillWorkingCopy({
18486
+ context,
18487
+ force = false,
18488
+ skill
18489
+ }) {
18490
+ const skillPath = normalizeRootSkillPath(skill);
18491
+ const workingCopyPath = resolveWorkingCopyPath(
18492
+ context.workingDirectory,
18493
+ skillPath
18494
+ );
18495
+ const metadataPath = resolveMetadataPath(
18496
+ context.stateFilePath,
18497
+ workingCopyPath
18498
+ );
18499
+ if (!force) {
18500
+ const existingMetadata = await loadMetadata(metadataPath);
18501
+ const existingSnapshot = await readDirectorySnapshot({
18502
+ directoryPath: workingCopyPath,
18503
+ skillPath
18504
+ });
18505
+ if (!existingMetadata && existingSnapshot.size > 0) {
18506
+ throw new CliError(
18507
+ `Refusing to overwrite existing files at "${workingCopyPath}". Re-run with --force to replace them.`
18508
+ );
18509
+ }
18510
+ if (existingMetadata) {
18511
+ assertMetadataMatchesContext({
18512
+ metadata: existingMetadata,
18513
+ organizationId: context.organizationId,
18514
+ skillPath,
18515
+ workingCopyPath
18516
+ });
18517
+ const baseline = metadataFilesToSnapshot(existingMetadata.files);
18518
+ if (!snapshotsEqual(existingSnapshot, baseline)) {
18519
+ throw new CliError(
18520
+ `Refusing to overwrite local changes in "${workingCopyPath}". Run "mgcl skills diff ${skillPath}" or re-run pull with --force.`
18521
+ );
18522
+ }
18523
+ }
18524
+ }
18525
+ const { snapshot } = await readRemoteBundle(context.api, skillPath, null);
18526
+ await replaceWorkingCopy({ snapshot, skillPath, workingCopyPath });
18527
+ await saveMetadata(
18528
+ metadataPath,
18529
+ createMetadata({
18530
+ organizationId: context.organizationId,
18531
+ requestedRef: null,
18532
+ skillPath,
18533
+ snapshot,
18534
+ workingCopyPath
18535
+ })
18536
+ );
18537
+ return {
18538
+ fileCount: snapshot.size,
18539
+ path: workingCopyPath,
18540
+ skillPath
18541
+ };
18542
+ }
18543
+ async function diffSkillWorkingCopy({
18544
+ context,
18545
+ skill
18546
+ }) {
18547
+ const workingCopy = await requireWorkingCopy({
18548
+ organizationId: context.organizationId,
18549
+ skill,
18550
+ stateFilePath: context.stateFilePath,
18551
+ workingDirectory: context.workingDirectory
18552
+ });
18553
+ const patchContents = await createPatch(workingCopy.base, workingCopy.local);
18554
+ return {
18555
+ hasLocalChanges: !snapshotsEqual(workingCopy.base, workingCopy.local),
18556
+ patch: patchContents,
18557
+ skillPath: workingCopy.skillPath
18558
+ };
18559
+ }
18560
+ async function pushSkillWorkingCopy({
18561
+ context,
18562
+ message,
18563
+ skill
18564
+ }) {
18565
+ const workingCopy = await requireWorkingCopy({
18566
+ organizationId: context.organizationId,
18567
+ skill,
18568
+ stateFilePath: context.stateFilePath,
18569
+ workingDirectory: context.workingDirectory
18570
+ });
18571
+ const { base, local } = workingCopy;
18572
+ const patchContents = await createPatch(base, local);
18573
+ if (patchContents.length === 0) {
18574
+ return {
18575
+ path: workingCopy.workingCopyPath,
18576
+ pushed: false,
18577
+ skillPath: workingCopy.skillPath
18578
+ };
18579
+ }
18580
+ assertTextPatch(patchContents);
18581
+ const applyResult = await fromThrowable(
18582
+ async () => await context.api.applyPatch({
18583
+ idempotencyKey: `mgcl-skills-${randomUUID()}`,
18584
+ message: message ?? `Update ${workingCopy.skillPath} via mgcl`,
18585
+ patch: patchContents
18586
+ }),
18587
+ "skills-push-request-failed"
18588
+ );
18589
+ if (isErr(applyResult)) {
18590
+ const { cause } = applyResult.error;
18591
+ if (isPatchApplyConflict(cause)) {
18592
+ throw new CliError(
18593
+ `The skill changed remotely and your local patch no longer applies. Save your local edits elsewhere, run "mgcl skills pull ${workingCopy.skillPath} --force", reapply the changes, and push again.`,
18594
+ { cause }
18595
+ );
18596
+ }
18597
+ if (cause instanceof Error) {
18598
+ throw cause;
18599
+ }
18600
+ throw new CliError("Failed to push the skill working copy.", {
18601
+ cause
18602
+ });
18603
+ }
18604
+ const parsedResult = skillsApplyPatchResultSchema.safeParse(
18605
+ applyResult.value
18606
+ );
18607
+ if (!parsedResult.success) {
18608
+ throw new CliError("Skills API returned an invalid patch result.");
18609
+ }
18610
+ const pushResult = {
18611
+ ...parsedResult.data,
18612
+ path: workingCopy.workingCopyPath,
18613
+ pushed: true,
18614
+ skillPath: workingCopy.skillPath
18615
+ };
18616
+ const refreshResult = await fromThrowable(async () => {
18617
+ const authoritative = await readRemoteBundle(
18618
+ context.api,
18619
+ workingCopy.skillPath,
18620
+ parsedResult.data.commit
18621
+ );
18622
+ if (authoritative.bundle.ref !== parsedResult.data.commit) {
18623
+ throw new CliError(
18624
+ `Skills API returned commit "${authoritative.bundle.ref}" while reading pushed commit "${parsedResult.data.commit}".`
18625
+ );
18626
+ }
18627
+ await replaceWorkingCopy({
18628
+ snapshot: authoritative.snapshot,
18629
+ skillPath: workingCopy.skillPath,
18630
+ workingCopyPath: workingCopy.workingCopyPath
18631
+ });
18632
+ await saveMetadata(
18633
+ workingCopy.metadataPath,
18634
+ createMetadata({
18635
+ organizationId: context.organizationId,
18636
+ requestedRef: null,
18637
+ skillPath: workingCopy.skillPath,
18638
+ snapshot: authoritative.snapshot,
18639
+ workingCopyPath: workingCopy.workingCopyPath
18640
+ })
18641
+ );
18642
+ }, "skills-push-refresh-failed");
18643
+ if (isErr(refreshResult)) {
18644
+ return {
18645
+ ...pushResult,
18646
+ warning: `The push succeeded as commit ${parsedResult.data.commit}, but refreshing the local working copy from that commit failed, so this checkout may be out of sync. Run "mgcl skills pull ${workingCopy.skillPath} --force" to sync it with the server.`,
18647
+ workingCopyRefreshed: false
18648
+ };
18649
+ }
18650
+ return { ...pushResult, workingCopyRefreshed: true };
18651
+ }
18652
+
18653
+ // src/state.ts
18654
+ import { mkdir as mkdir3, readFile as readFile4, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
18655
+ import path6 from "node:path";
18656
+ import { z as z29 } from "zod";
18657
+ var cliAccountSchema = z29.object({
18658
+ clientId: z29.string().min(1),
18659
+ email: z29.string().nullable(),
18660
+ userId: z29.string().min(1)
18661
+ });
18662
+ var cliOrganizationSchema = z29.object({
18663
+ id: z29.string().min(1),
18664
+ name: z29.string().min(1),
18665
+ primaryDomain: z29.string().nullable().default(null)
18666
+ });
18667
+ var cliStateSchema = z29.object({
17347
18668
  account: cliAccountSchema,
17348
- defaultOrgId: z26.string().nullable(),
17349
- lastUsedOrgId: z26.string().nullable(),
17350
- organizations: z26.array(cliOrganizationSchema)
18669
+ defaultOrgId: z29.string().nullable(),
18670
+ lastUsedOrgId: z29.string().nullable(),
18671
+ organizations: z29.array(cliOrganizationSchema)
17351
18672
  });
17352
- var refreshTokenFileSchema = z26.record(z26.string(), z26.string());
18673
+ var refreshTokenFileSchema = z29.record(z29.string(), z29.string());
17353
18674
  function createFileStateStore(stateFilePath) {
17354
18675
  return {
17355
18676
  async clear() {
17356
- await rm3(stateFilePath, { force: true });
18677
+ await rm4(stateFilePath, { force: true });
17357
18678
  },
17358
18679
  async load() {
17359
18680
  try {
17360
- const fileContents = await readFile3(stateFilePath, "utf8");
18681
+ const fileContents = await readFile4(stateFilePath, "utf8");
17361
18682
  const parsed = cliStateSchema.safeParse(JSON.parse(fileContents));
17362
18683
  if (!parsed.success) {
17363
18684
  throw new CliError("Stored CLI state is invalid.");
@@ -17374,8 +18695,8 @@ function createFileStateStore(stateFilePath) {
17374
18695
  }
17375
18696
  },
17376
18697
  async save(state) {
17377
- await mkdir2(path5.dirname(stateFilePath), { recursive: true });
17378
- await writeFile2(stateFilePath, `${JSON.stringify(state, null, 2)}
18698
+ await mkdir3(path6.dirname(stateFilePath), { recursive: true });
18699
+ await writeFile3(stateFilePath, `${JSON.stringify(state, null, 2)}
17379
18700
  `);
17380
18701
  }
17381
18702
  };
@@ -17383,7 +18704,7 @@ function createFileStateStore(stateFilePath) {
17383
18704
  function createFileRefreshTokenStore(refreshTokenFilePath) {
17384
18705
  async function loadRefreshTokens() {
17385
18706
  try {
17386
- const fileContents = await readFile3(refreshTokenFilePath, "utf8");
18707
+ const fileContents = await readFile4(refreshTokenFilePath, "utf8");
17387
18708
  const parsed = refreshTokenFileSchema.safeParse(JSON.parse(fileContents));
17388
18709
  if (!parsed.success) {
17389
18710
  throw new CliError("Stored refresh tokens are invalid.");
@@ -17402,8 +18723,8 @@ function createFileRefreshTokenStore(refreshTokenFilePath) {
17402
18723
  }
17403
18724
  }
17404
18725
  async function saveRefreshTokens(refreshTokens) {
17405
- await mkdir2(path5.dirname(refreshTokenFilePath), { recursive: true });
17406
- await writeFile2(
18726
+ await mkdir3(path6.dirname(refreshTokenFilePath), { recursive: true });
18727
+ await writeFile3(
17407
18728
  refreshTokenFilePath,
17408
18729
  `${JSON.stringify(refreshTokens, null, 2)}
17409
18730
  `
@@ -17419,7 +18740,7 @@ function createFileRefreshTokenStore(refreshTokenFilePath) {
17419
18740
  )
17420
18741
  );
17421
18742
  if (Object.keys(nextRefreshTokens).length === 0) {
17422
- await rm3(refreshTokenFilePath, { force: true });
18743
+ await rm4(refreshTokenFilePath, { force: true });
17423
18744
  return;
17424
18745
  }
17425
18746
  await saveRefreshTokens(nextRefreshTokens);
@@ -17440,37 +18761,37 @@ function buildRefreshTokenKey(account) {
17440
18761
  }
17441
18762
 
17442
18763
  // src/workos-auth.ts
17443
- import { z as z27 } from "zod";
18764
+ import { z as z30 } from "zod";
17444
18765
  var DEFAULT_DEVICE_POLL_INTERVAL_SECONDS = 5;
17445
18766
  function buildFormHeaders() {
17446
18767
  const headers = new Headers();
17447
18768
  headers.set("content-type", "application/x-www-form-urlencoded");
17448
18769
  return headers;
17449
18770
  }
17450
- var deviceAuthorizationSchema = z27.object({
17451
- device_code: z27.string().min(1),
17452
- expires_in: z27.number().int().positive().optional(),
17453
- interval: z27.number().int().positive().optional(),
17454
- user_code: z27.string().min(1),
17455
- verification_uri: z27.url(),
17456
- verification_uri_complete: z27.url().optional()
18771
+ var deviceAuthorizationSchema = z30.object({
18772
+ device_code: z30.string().min(1),
18773
+ expires_in: z30.number().int().positive().optional(),
18774
+ interval: z30.number().int().positive().optional(),
18775
+ user_code: z30.string().min(1),
18776
+ verification_uri: z30.url(),
18777
+ verification_uri_complete: z30.url().optional()
17457
18778
  });
17458
- var tokenResponseSchema = z27.object({
17459
- access_token: z27.string().min(1),
17460
- expires_in: z27.number().int().positive().optional(),
17461
- refresh_token: z27.string().min(1),
17462
- token_type: z27.string().optional()
18779
+ var tokenResponseSchema = z30.object({
18780
+ access_token: z30.string().min(1),
18781
+ expires_in: z30.number().int().positive().optional(),
18782
+ refresh_token: z30.string().min(1),
18783
+ token_type: z30.string().optional()
17463
18784
  });
17464
- var tokenErrorSchema = z27.object({
17465
- error: z27.string().min(1),
17466
- error_description: z27.string().optional()
18785
+ var tokenErrorSchema = z30.object({
18786
+ error: z30.string().min(1),
18787
+ error_description: z30.string().optional()
17467
18788
  });
17468
- var accessTokenClaimsSchema = z27.object({
17469
- exp: z27.number().int().positive().optional(),
17470
- iss: z27.string().min(1).optional(),
17471
- org_id: z27.string().min(1).optional(),
17472
- sid: z27.string().min(1).optional(),
17473
- sub: z27.string().min(1)
18789
+ var accessTokenClaimsSchema = z30.object({
18790
+ exp: z30.number().int().positive().optional(),
18791
+ iss: z30.string().min(1).optional(),
18792
+ org_id: z30.string().min(1).optional(),
18793
+ sid: z30.string().min(1).optional(),
18794
+ sub: z30.string().min(1)
17474
18795
  });
17475
18796
  function createWorkosAuthClient({
17476
18797
  fetchFn = fetch,
@@ -17669,7 +18990,7 @@ function createCliCommanderOption(optionSpec, helpGroup) {
17669
18990
  }
17670
18991
  return nextOption;
17671
18992
  }
17672
- function isRecord3(value) {
18993
+ function isRecord5(value) {
17673
18994
  return typeof value === "object" && value !== null && !Array.isArray(value);
17674
18995
  }
17675
18996
  function resolveOrganizationBySelector({
@@ -17736,7 +19057,7 @@ function collectOperationVariables(operationSpec, options) {
17736
19057
  parsedVariables.error.issues[0]?.message ?? "Invalid command input."
17737
19058
  );
17738
19059
  }
17739
- if (!isRecord3(parsedVariables.data)) {
19060
+ if (!isRecord5(parsedVariables.data)) {
17740
19061
  throw new CliError("Invalid command input.");
17741
19062
  }
17742
19063
  return parsedVariables.data;
@@ -17832,6 +19153,169 @@ async function handleOperationCommand(dependencies, operationSpec, commandOption
17832
19153
  }
17833
19154
  dependencies.io.info(formatHumanReadableOutput(result));
17834
19155
  }
19156
+ function getSkillsOperation(operationName) {
19157
+ const operationSpec = operationSpecs.find(
19158
+ (candidate) => candidate.operationName === operationName
19159
+ );
19160
+ if (!operationSpec) {
19161
+ throw new CliError(
19162
+ `Skills operation "${operationName}" is not registered.`
19163
+ );
19164
+ }
19165
+ return operationSpec;
19166
+ }
19167
+ async function withSkillsWorkingCopyContext(dependencies, options) {
19168
+ const { accessToken, impersonatedOrganizationId, organization, state } = await withSelectedOrganizationAndAccessToken({ dependencies, options });
19169
+ const executeOperation = async (operationName, variables) => {
19170
+ const operationSpec = getSkillsOperation(operationName);
19171
+ return await dependencies.apiClient.executeGraphQl({
19172
+ accessToken,
19173
+ ...impersonatedOrganizationId ? { impersonatedOrganizationId } : {},
19174
+ organizationId: organization.id,
19175
+ query: operationSpec.document,
19176
+ resultKey: operationSpec.cli.resultKey,
19177
+ variables
19178
+ });
19179
+ };
19180
+ return {
19181
+ context: {
19182
+ api: {
19183
+ async applyPatch(input) {
19184
+ return await executeOperation("skills_apply_patch", input);
19185
+ },
19186
+ async read(input) {
19187
+ return await executeOperation("skills_read", input);
19188
+ }
19189
+ },
19190
+ organizationId: organization.id,
19191
+ stateFilePath: dependencies.runtimeConfig.stateFilePath,
19192
+ workingDirectory: dependencies.workingDirectory ?? process.cwd()
19193
+ },
19194
+ state
19195
+ };
19196
+ }
19197
+ async function handleSkillsPullCommand(dependencies, skill, options) {
19198
+ const { context, state } = await withSkillsWorkingCopyContext(
19199
+ dependencies,
19200
+ options
19201
+ );
19202
+ const result = await pullSkillWorkingCopy({
19203
+ context,
19204
+ skill,
19205
+ ...options.force ? { force: true } : {}
19206
+ });
19207
+ await saveLastUsedOrganization({
19208
+ dependencies,
19209
+ organizationId: context.organizationId,
19210
+ state
19211
+ });
19212
+ writeCommandOutput({ dependencies, json: options.json, result });
19213
+ }
19214
+ async function handleSkillsDiffCommand(dependencies, skill, options) {
19215
+ const { context, state } = await withSkillsWorkingCopyContext(
19216
+ dependencies,
19217
+ options
19218
+ );
19219
+ const result = await diffSkillWorkingCopy({ context, skill });
19220
+ await saveLastUsedOrganization({
19221
+ dependencies,
19222
+ organizationId: context.organizationId,
19223
+ state
19224
+ });
19225
+ if (options.json) {
19226
+ writeJsonOutput3(dependencies.io, result);
19227
+ return;
19228
+ }
19229
+ dependencies.io.info(
19230
+ result.patch.length === 0 ? "No changes." : result.patch
19231
+ );
19232
+ }
19233
+ async function handleSkillsPushCommand(dependencies, skill, options) {
19234
+ const { context, state } = await withSkillsWorkingCopyContext(
19235
+ dependencies,
19236
+ options
19237
+ );
19238
+ const result = await pushSkillWorkingCopy({
19239
+ context,
19240
+ skill,
19241
+ ...options.message ? { message: options.message } : {}
19242
+ });
19243
+ await saveLastUsedOrganization({
19244
+ dependencies,
19245
+ organizationId: context.organizationId,
19246
+ state
19247
+ });
19248
+ writeCommandOutput({ dependencies, json: options.json, result });
19249
+ }
19250
+ function addSkillsWorkingCopyCommands({
19251
+ dependencies,
19252
+ skillsCommand
19253
+ }) {
19254
+ skillsCommand.command("pull <skill>").description("Download a root-level skill into ./skills/<skill-name>.").addOption(
19255
+ new Option2(
19256
+ "--org <org>",
19257
+ "Organization ID or exact organization name to use."
19258
+ ).helpGroup("Shared options:")
19259
+ ).addOption(
19260
+ new Option2(
19261
+ "--force",
19262
+ "Replace existing files or local edits with the remote bundle."
19263
+ )
19264
+ ).addHelpText(
19265
+ "after",
19266
+ `
19267
+ ${formatExamples("Examples", [
19268
+ "mgcl skills pull review",
19269
+ "mgcl skills pull skills/review"
19270
+ ])}`
19271
+ ).action(async function(skill) {
19272
+ await handleSkillsPullCommand(
19273
+ dependencies,
19274
+ skill,
19275
+ this.optsWithGlobals()
19276
+ );
19277
+ });
19278
+ skillsCommand.command("diff <skill>").description("Preview local skill changes against the pulled bundle.").addOption(
19279
+ new Option2(
19280
+ "--org <org>",
19281
+ "Organization ID or exact organization name to use."
19282
+ ).helpGroup("Shared options:")
19283
+ ).addHelpText(
19284
+ "after",
19285
+ `
19286
+ ${formatExamples("Examples", [
19287
+ "mgcl skills diff review",
19288
+ "mgcl skills diff skills/review --json"
19289
+ ])}`
19290
+ ).action(async function(skill) {
19291
+ await handleSkillsDiffCommand(
19292
+ dependencies,
19293
+ skill,
19294
+ this.optsWithGlobals()
19295
+ );
19296
+ });
19297
+ skillsCommand.command("push <skill>").description("Atomically push local changes for one root-level skill.").addOption(
19298
+ new Option2(
19299
+ "--org <org>",
19300
+ "Organization ID or exact organization name to use."
19301
+ ).helpGroup("Shared options:")
19302
+ ).addOption(
19303
+ new Option2("--message <message>", "Commit message for the skill update.")
19304
+ ).addHelpText(
19305
+ "after",
19306
+ `
19307
+ ${formatExamples("Examples", [
19308
+ "mgcl skills push review",
19309
+ 'mgcl skills push skills/review --message "Improve review guidance"'
19310
+ ])}`
19311
+ ).action(async function(skill) {
19312
+ await handleSkillsPushCommand(
19313
+ dependencies,
19314
+ skill,
19315
+ this.optsWithGlobals()
19316
+ );
19317
+ });
19318
+ }
17835
19319
  async function withSelectedOrganizationAndAccessToken({
17836
19320
  dependencies,
17837
19321
  options
@@ -17936,7 +19420,7 @@ async function resolveDirectAccessTokenOrganizationId({
17936
19420
  if (!accessTokenFilePath) {
17937
19421
  return null;
17938
19422
  }
17939
- const accessToken = await readFile4(accessTokenFilePath, "utf8").then((value) => value.trim()).catch((error) => {
19423
+ const accessToken = await readFile5(accessTokenFilePath, "utf8").then((value) => value.trim()).catch((error) => {
17940
19424
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
17941
19425
  return null;
17942
19426
  }
@@ -18048,12 +19532,12 @@ function createConsoleIo() {
18048
19532
  function createDefaultDependencies() {
18049
19533
  const runtimeConfig = getRuntimeConfig();
18050
19534
  const settingsStore = createFileSettingsStore(runtimeConfig.stateFilePath);
18051
- const accessTokenFilePath = runtimeConfig.accessTokenFilePath ?? path6.join(
18052
- path6.dirname(runtimeConfig.stateFilePath),
19535
+ const accessTokenFilePath = runtimeConfig.accessTokenFilePath ?? path7.join(
19536
+ path7.dirname(runtimeConfig.stateFilePath),
18053
19537
  CLI_ACCESS_TOKEN_FILE_NAME
18054
19538
  );
18055
- const refreshTokenFilePath = runtimeConfig.refreshTokenFilePath ?? path6.join(
18056
- path6.dirname(runtimeConfig.stateFilePath),
19539
+ const refreshTokenFilePath = runtimeConfig.refreshTokenFilePath ?? path7.join(
19540
+ path7.dirname(runtimeConfig.stateFilePath),
18057
19541
  CLI_REFRESH_TOKEN_FILE_NAME
18058
19542
  );
18059
19543
  const selfUpdateOptions = {
@@ -18229,6 +19713,11 @@ ${formatExamples("Examples", ["mgcl update", "mgcl --update"])}`
18229
19713
  operationSpec
18230
19714
  });
18231
19715
  }
19716
+ const skillsCommand = operationalCommandGroups.get("skills");
19717
+ if (!skillsCommand) {
19718
+ throw new CliError("Skills operation group is not registered.");
19719
+ }
19720
+ addSkillsWorkingCopyCommands({ dependencies, skillsCommand });
18232
19721
  return program2;
18233
19722
  }
18234
19723