@getmagical/cli 0.2.2 → 0.2.4

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
@@ -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"],
@@ -7245,9 +7295,12 @@ function resolveApiDetails({ appError, statusCode }) {
7245
7295
  if (!shouldExposeMessage({ appError, statusCode })) {
7246
7296
  return void 0;
7247
7297
  }
7298
+ const rawDetails = toUserFacingDetailsValue(appError.details, 4);
7299
+ const serializedDetails = rawDetails && typeof rawDetails === "object" && !Array.isArray(rawDetails) && Object.keys(rawDetails).length > 0 ? rawDetails : void 0;
7248
7300
  const zodIssues = getZodIssuesFromCause(appError.cause);
7249
7301
  if (zodIssues && zodIssues.length > 0) {
7250
7302
  return {
7303
+ ...serializedDetails,
7251
7304
  validationErrors: zodIssues.map((issue) => ({
7252
7305
  path: Array.isArray(issue.path) ? issue.path.map(String).join(".") : "",
7253
7306
  message: typeof issue.message === "string" ? issue.message : "Invalid value",
@@ -7255,11 +7308,7 @@ function resolveApiDetails({ appError, statusCode }) {
7255
7308
  }))
7256
7309
  };
7257
7310
  }
7258
- const rawDetails = toUserFacingDetailsValue(appError.details, 4);
7259
- if (rawDetails && typeof rawDetails === "object" && !Array.isArray(rawDetails) && Object.keys(rawDetails).length > 0) {
7260
- return rawDetails;
7261
- }
7262
- return void 0;
7311
+ return serializedDetails;
7263
7312
  }
7264
7313
  function getGraphQLErrorCodeFromAppErrorCode(code) {
7265
7314
  if (code === 400) {
@@ -12207,6 +12256,16 @@ function replaceHandlebarsTemplates(value) {
12207
12256
  return value.replaceAll(HANDLEBARS_TEMPLATE_GLOBAL_REGEX, URL_TEMPLATE_PLACEHOLDER_VALUE);
12208
12257
  }
12209
12258
 
12259
+ // ../common/dist/src/stdlib/unsafe-object-key.util.js
12260
+ var UNSAFE_OBJECT_KEYS = /* @__PURE__ */ new Set([
12261
+ "__proto__",
12262
+ "constructor",
12263
+ "prototype"
12264
+ ]);
12265
+ function isUnsafeObjectKey(value) {
12266
+ return UNSAFE_OBJECT_KEYS.has(value);
12267
+ }
12268
+
12210
12269
  // ../common/dist/src/models/websocket/actions/scroll.js
12211
12270
  import { z as z9 } from "zod";
12212
12271
  var scrollDataSchema = z9.object({
@@ -12663,15 +12722,15 @@ var baseToolDeclarations = {
12663
12722
  },
12664
12723
  updateStoreValues: {
12665
12724
  id: "updateStoreValues",
12666
- description: "Update values in the automation store. Set scalar leaf paths, append one item or a list of items to array paths, replace complete arrays, and clear scalar or array paths in a single mutation.",
12725
+ description: "Update values in the automation store. Set complete scalar or Object values, append one item or a list of items to array paths, replace complete arrays, and clear supported scalar, Object, or array paths in a single mutation.",
12667
12726
  parameters: z12.object({
12668
12727
  [COMMON_PARAMETERS_KEY]: DEFAULT_COMMON_PARAMETERS,
12669
12728
  updates: z12.array(z12.object({
12670
- path: z12.string().min(1).describe("Scalar leaf path to set or array path to append to or replace, such as patient.name or documents."),
12671
- arrayMode: z12.enum(["append", "appendList", "replace"]).optional().describe("Array mutation behavior. Omit or use append to add one item, use appendList to add every item in the supplied list, or use replace to set the complete array. Do not use this for scalar paths."),
12672
- value: z12.json().describe("Concrete JSON value for this update. Scalar paths receive this value. Array append updates receive one item, appendList updates receive a list of items, and replacements receive the complete list.")
12729
+ path: z12.string().min(1).describe("Scalar or Object path to set, or array path to append to or replace, such as patient.name, patient, or documents. The root Store path is not supported."),
12730
+ arrayMode: z12.enum(["append", "appendList", "replace"]).optional().describe("Array mutation behavior. Omit or use append to add one item, use appendList to add every item in the supplied list, or use replace to set the complete array. Do not use this for scalar or Object paths."),
12731
+ value: z12.json().describe("Concrete JSON value for this update. Scalar and Object paths receive the complete value. Array append updates receive one item, appendList updates receive a list of items, and replacements receive the complete list.")
12673
12732
  })).optional().describe("Store values to update. Omit or pass an empty array when only clearing values."),
12674
- clears: z12.array(z12.string().min(1)).optional().describe("Scalar leaf or array store paths to clear. Clearing an array writes an empty list. Omit or pass an empty array when only updating values.")
12733
+ clears: z12.array(z12.string().min(1)).optional().describe("Optional scalar or Object paths, or array Store paths, to clear. Clearing an array writes an empty list. Omit or pass an empty array when only updating values.")
12675
12734
  }).superRefine((value, context) => {
12676
12735
  const updates = value.updates ?? [];
12677
12736
  const clears = value.clears ?? [];
@@ -13374,25 +13433,12 @@ function getIsKnowledgeBaseAssetPathAllowed(path7) {
13374
13433
  return isTopLevelAssetPath || isAutomationAssetPath || isAutomationAgentAssetPath;
13375
13434
  }
13376
13435
 
13377
- // ../common/dist/src/utils/automation-variable-path.util.js
13378
- var AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN = String.raw`[A-Za-z_][A-Za-z0-9_-]*`;
13379
- var AUTOMATION_VARIABLE_PATH_PATTERN = String.raw`${AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN}(?:\.${AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN})*`;
13380
- var DANGEROUS_AUTOMATION_VARIABLE_OBJECT_KEYS = /* @__PURE__ */ new Set([
13381
- "__proto__",
13382
- "constructor",
13383
- "prototype"
13384
- ]);
13385
- var AUTOMATION_VARIABLE_PATH_SEGMENT_REGEX = new RegExp(`^${AUTOMATION_VARIABLE_PATH_SEGMENT_PATTERN}$`, "u");
13386
- function isDangerousAutomationVariableObjectKey(value) {
13387
- return DANGEROUS_AUTOMATION_VARIABLE_OBJECT_KEYS.has(value);
13388
- }
13389
-
13390
13436
  // ../common/dist/src/utils/ponr-key-field-path.util.js
13391
13437
  var POINT_OF_NO_RETURN_KEY_FIELD_ROOTS = /* @__PURE__ */ new Set(["input", "store"]);
13392
13438
  function parsePointOfNoReturnKeyFieldPath(keyField) {
13393
13439
  const segments = keyField.split(".");
13394
13440
  const [root, ...pathSegments] = segments;
13395
- if (root === void 0 || !POINT_OF_NO_RETURN_KEY_FIELD_ROOTS.has(root) || pathSegments.length === 0 || pathSegments.some((segment) => segment.length === 0 || isDangerousAutomationVariableObjectKey(segment))) {
13441
+ if (root === void 0 || !POINT_OF_NO_RETURN_KEY_FIELD_ROOTS.has(root) || pathSegments.length === 0 || pathSegments.some((segment) => segment.length === 0 || isUnsafeObjectKey(segment))) {
13396
13442
  return void 0;
13397
13443
  }
13398
13444
  return segments;
@@ -13440,7 +13486,7 @@ import { z as z16 } from "zod";
13440
13486
 
13441
13487
  // ../common/dist/src/zod-schemas/output-store-binding.schema.js
13442
13488
  import { z as z15 } from "zod";
13443
- var outputStorePathSchema = z15.string().regex(/^store\.[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*)*$/u, "Data Store destination must be a fully qualified path such as store.patient.name.");
13489
+ var outputStorePathSchema = z15.string().regex(/^store\.[^\s.]+(?:\.[^\s.]+)*$/u, "Data Store destination must be a fully qualified path such as store.patient.name.");
13444
13490
 
13445
13491
  // ../common/dist/src/zod-schemas/api-tool.schema.js
13446
13492
  var methodsWithBody = new Set(ApiMethodsWithBody);
@@ -13481,7 +13527,7 @@ var apiOutputStorePathSchema = outputStorePathSchema.describe("Fully qualified D
13481
13527
  var apiOutputStoreBindingShape = {
13482
13528
  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."),
13483
13529
  storePath: apiOutputStorePathSchema,
13484
- 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 destinations. Legacy omitted array modes still append at runtime.")
13530
+ 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.")
13485
13531
  };
13486
13532
  var apiOutputStoreBindingObjectSchema = z16.object(apiOutputStoreBindingShape);
13487
13533
  var apiOutputStoreBindingAuthoringSchema = z16.object(apiOutputStoreBindingShape).strict();
@@ -13824,7 +13870,7 @@ var outputStoreSourcePathRegex = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*)*$/u;
13824
13870
  var outputStoreBindingSchema = z19.object({
13825
13871
  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."),
13826
13872
  storePath: outputStorePathSchema.describe("Fully qualified Data Store path that receives the output."),
13827
- 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 destinations. Legacy omitted array modes still append at runtime.")
13873
+ 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.")
13828
13874
  }).describe("Maps one node output value to one Data Store destination.");
13829
13875
  function validateUniqueOutputStoreBindings(bindings, ctx) {
13830
13876
  const sourcePaths = /* @__PURE__ */ new Set();
@@ -13976,12 +14022,67 @@ var draftAgentConfigSchema = z19.preprocess((data) => {
13976
14022
  }, draftAgentConfigSchemaUnion).describe("Draft agent configuration. Matches authored validation for most agent types, but allows incomplete decision agents during draft saves.");
13977
14023
  var DEFAULT_AGENT_CONFIG = agentConfigSchema.parse({});
13978
14024
 
13979
- // ../common/dist/src/zod-schemas/automation-run-config.schema.js
14025
+ // ../common/dist/src/zod-schemas/automation-store-migration-analyzer.schema.js
13980
14026
  import { z as z20 } from "zod";
13981
- var automationRunResolvedRunSettingsSchema = z20.object({
14027
+ var automationStoreMigrationMappingSchema = z20.object({
14028
+ sourceAutomationId: z20.string().uuid(),
14029
+ sourceAgentId: z20.string().uuid().optional(),
14030
+ sourceKind: z20.enum(["input", "output", "sharedInput"]),
14031
+ sourceKey: z20.string().min(1),
14032
+ logicalValueId: z20.string().min(1).optional(),
14033
+ outputBindingSourcePath: z20.string().min(1).optional(),
14034
+ handling: z20.enum(["store", "keepLocal", "remove"]),
14035
+ reason: z20.string().min(1),
14036
+ targetStorePath: z20.string().min(1).optional(),
14037
+ population: z20.enum([
14038
+ "default",
14039
+ "initialStore",
14040
+ "outputStoreBinding",
14041
+ "updateStoreValues"
14042
+ ]).optional(),
14043
+ writerAgentId: z20.string().uuid().optional(),
14044
+ isWorkItemIdentity: z20.boolean().optional(),
14045
+ conversion: z20.string().min(1).optional()
14046
+ });
14047
+ var automationStoreMigrationWritePolicySchema = z20.object({
14048
+ automationId: z20.string().uuid(),
14049
+ path: z20.string().min(1),
14050
+ writerAgentIds: z20.array(z20.string().uuid()).min(1),
14051
+ coordination: z20.enum([
14052
+ "singleWriter",
14053
+ "mutuallyExclusiveBranches",
14054
+ "orderedScalarOverwrite",
14055
+ "disjointArrayItems"
14056
+ ]),
14057
+ arrayRetryStrategy: z20.enum(["notApplicable", "readBeforeAppend"]),
14058
+ rationale: z20.string().min(1)
14059
+ });
14060
+ var automationStoreMigrationComparisonVersionSchema = z20.object({
14061
+ automationId: z20.string().uuid(),
14062
+ automationVersionId: z20.string().uuid(),
14063
+ role: z20.enum(["beforeMigration", "afterMigration"]),
14064
+ slotLifecycle: z20.enum(["existing", "introduced"]).default("existing"),
14065
+ slot: z20.string().min(1)
14066
+ });
14067
+ var automationStoreMigrationComparisonSchema = z20.object({
14068
+ versions: z20.array(automationStoreMigrationComparisonVersionSchema).min(1).max(40)
14069
+ });
14070
+ var automationStoreMigrationAnalyzerInputSchema = z20.object({
14071
+ 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."),
14072
+ 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."),
14073
+ comparison: automationStoreMigrationComparisonSchema.nullable().default(null).describe("Exact before/after saved-version pairs for compare. Introduced slots require only an afterMigration version."),
14074
+ mappings: z20.array(automationStoreMigrationMappingSchema).default([]),
14075
+ storeWritePolicies: z20.array(automationStoreMigrationWritePolicySchema).max(100).default([]),
14076
+ 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."),
14077
+ workItem: z20.string().default("").describe("Optional name for the business work item being migrated.")
14078
+ });
14079
+
14080
+ // ../common/dist/src/zod-schemas/automation-run-config.schema.js
14081
+ import { z as z21 } from "zod";
14082
+ var automationRunResolvedRunSettingsSchema = z21.object({
13982
14083
  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."),
13983
14084
  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."),
13984
- skipBrowserDebuggerPauses: z20.boolean().optional().describe("Canonical run-settings-owned browser session startup setting snapshotted onto the automation run when it starts in runSettings mode.")
14085
+ skipBrowserDebuggerPauses: z21.boolean().optional().describe("Canonical run-settings-owned browser session startup setting snapshotted onto the automation run when it starts in runSettings mode.")
13985
14086
  });
13986
14087
  var CONSISTENCY_CHECK_COUNT_MAX = 50;
13987
14088
  var NETWORK_TRAFFIC_CAPTURE_RECORD_MODES = [
@@ -13989,18 +14090,18 @@ var NETWORK_TRAFFIC_CAPTURE_RECORD_MODES = [
13989
14090
  "explicit"
13990
14091
  ];
13991
14092
  var DEFAULT_NETWORK_TRAFFIC_CAPTURE_RECORD_MODE = "implicit";
13992
- var networkTrafficCaptureSchema = z20.discriminatedUnion("mode", [
13993
- z20.object({
13994
- mode: z20.literal("record"),
13995
- recordMode: z20.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.")
14093
+ var networkTrafficCaptureSchema = z21.discriminatedUnion("mode", [
14094
+ z21.object({
14095
+ mode: z21.literal("record"),
14096
+ 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.")
13996
14097
  }).describe("Record network traffic for this run. The recording ID is generated from the automation run ID."),
13997
- z20.object({
13998
- mode: z20.literal("replay"),
13999
- recordingId: z20.uuid().describe("Recording ID from a previous record run in the same organization.")
14098
+ z21.object({
14099
+ mode: z21.literal("replay"),
14100
+ recordingId: z21.uuid().describe("Recording ID from a previous record run in the same organization.")
14000
14101
  }).describe("Replay network traffic from a previous recording.")
14001
14102
  ]).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.");
14002
- var automationRunSlaTypeSchema = z20.enum(["all"]);
14003
- var automationRunSlaTimestampSchema = z20.iso.datetime();
14103
+ var automationRunSlaTypeSchema = z21.enum(["all"]);
14104
+ var automationRunSlaTimestampSchema = z21.iso.datetime();
14004
14105
  function refineAutomationRunSlaTimestampOrder(sla, ctx) {
14005
14106
  const startedAtMs = Date.parse(sla.startedAt);
14006
14107
  const breachesAtMs = Date.parse(sla.breachesAt);
@@ -14030,31 +14131,31 @@ function refineAutomationRunSlaTimestampOrder(sla, ctx) {
14030
14131
  });
14031
14132
  }
14032
14133
  }
14033
- var automationRunSlaSchema = z20.object({
14134
+ var automationRunSlaSchema = z21.object({
14034
14135
  startedAt: automationRunSlaTimestampSchema.describe("ISO timestamp when SLA tracking started for this run."),
14035
14136
  highRiskAt: automationRunSlaTimestampSchema.optional().describe("Optional ISO timestamp when this run should be considered at high risk of breaching its SLA."),
14036
14137
  breachesAt: automationRunSlaTimestampSchema.describe("ISO timestamp when this run breaches its SLA."),
14037
14138
  type: automationRunSlaTypeSchema.optional().default("all").describe("SLA policy type that applies to this automation run.")
14038
14139
  }).superRefine(refineAutomationRunSlaTimestampOrder).describe("Optional service-level timing metadata for queueing and runtime consumers of this automation run.");
14039
- var automationRunConfigBaseSchema = z20.object({
14040
- approvalMode: z20.enum(["HUMAN_APPROVAL", "OFF"]).default("OFF"),
14041
- consistencyCheckCount: z20.number().int().nonnegative().max(CONSISTENCY_CHECK_COUNT_MAX).nullable().default(null),
14042
- settingsSourceAgentId: z20.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."),
14043
- startInTakeOverMode: z20.boolean().default(false).describe("When true, create and prepare the remote session, then pause until a human manually starts the agent."),
14044
- captureActions: z20.boolean().default(false).describe("When true, attach an action recording while a draft run is paused in takeover mode."),
14045
- runDraftQueuedAgents: z20.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."),
14046
- allowPointOfNoReturnOverride: z20.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."),
14047
- pointOfNoReturnGateEnabled: z20.literal(true).optional().describe("Infrastructure-owned rollout marker. PONR is enforced only for run trees created after the gate rollout."),
14140
+ var automationRunConfigBaseSchema = z21.object({
14141
+ approvalMode: z21.enum(["HUMAN_APPROVAL", "OFF"]).default("OFF"),
14142
+ consistencyCheckCount: z21.number().int().nonnegative().max(CONSISTENCY_CHECK_COUNT_MAX).nullable().default(null),
14143
+ 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."),
14144
+ startInTakeOverMode: z21.boolean().default(false).describe("When true, create and prepare the remote session, then pause until a human manually starts the agent."),
14145
+ captureActions: z21.boolean().default(false).describe("When true, attach an action recording while a draft run is paused in takeover mode."),
14146
+ 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."),
14147
+ 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."),
14148
+ pointOfNoReturnGateEnabled: z21.literal(true).optional().describe("Infrastructure-owned rollout marker. PONR is enforced only for run trees created after the gate rollout."),
14048
14149
  sla: automationRunSlaSchema.optional(),
14049
14150
  networkTrafficCapture: networkTrafficCaptureSchema.optional(),
14050
- networkTrafficCaptureExplicitlyDisabled: z20.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."),
14051
- implicitNetworkTrafficRecordingDecision: z20.object({
14052
- enabled: z20.boolean()
14151
+ 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."),
14152
+ implicitNetworkTrafficRecordingDecision: z21.object({
14153
+ enabled: z21.boolean()
14053
14154
  }).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."),
14054
14155
  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."),
14055
14156
  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."),
14056
14157
  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."),
14057
- resolvedRunSettingsSource: z20.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.")
14158
+ 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.")
14058
14159
  });
14059
14160
  var automationRunConfigSchema = automationRunConfigBaseSchema.superRefine((config, ctx) => {
14060
14161
  if (config.networkTrafficCaptureExplicitlyDisabled === true && config.networkTrafficCapture !== void 0) {
@@ -14079,8 +14180,69 @@ var automationRunStartConfigSchema = automationRunConfigBaseSchema.omit({
14079
14180
  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.")
14080
14181
  });
14081
14182
 
14183
+ // ../common/dist/src/utils/custom-instructions-command.util.js
14184
+ var MAX_CUSTOM_COMMAND_COUNT = 1;
14185
+ var MAX_CUSTOM_INSTRUCTIONS_LENGTH = 280;
14186
+ var STANDARD_COMMAND_NAMES = [
14187
+ "callSpecializedAgent",
14188
+ "checkpoint",
14189
+ "click",
14190
+ "clickFill",
14191
+ "ifElse",
14192
+ "loop",
14193
+ "navigateTo",
14194
+ "pressKeys",
14195
+ "queueAgents",
14196
+ "reportStop",
14197
+ "somFilter"
14198
+ ];
14199
+ function createInvalidValueError(message) {
14200
+ const error = new Error(`INVALID_VALUE: ${message}`);
14201
+ error.name = "INVALID_VALUE";
14202
+ return error;
14203
+ }
14204
+ function isRecord2(value) {
14205
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14206
+ }
14207
+ function getCustomInstructions(command) {
14208
+ const commandArguments = command["arguments"];
14209
+ if (!isRecord2(commandArguments)) {
14210
+ return "";
14211
+ }
14212
+ const { instructions } = commandArguments;
14213
+ return typeof instructions === "string" ? instructions.trim() : "";
14214
+ }
14215
+ function getMentionedStandardCommand(instructions) {
14216
+ const normalizedInstructions = instructions.toLowerCase();
14217
+ return STANDARD_COMMAND_NAMES.find((commandName) => normalizedInstructions.includes(commandName.toLowerCase())) ?? null;
14218
+ }
14219
+ function assertCustomInstructionsCommand({ commands, path: path7 }) {
14220
+ const customCommands = commands.flatMap((command, commandIndex) => command["commandName"] === "custom" ? [{ command, path: `${path7}[${commandIndex.toString()}]` }] : []);
14221
+ if (customCommands.length === 0) {
14222
+ return;
14223
+ }
14224
+ if (customCommands.length > MAX_CUSTOM_COMMAND_COUNT) {
14225
+ throw createInvalidValueError(`${path7} 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.`);
14226
+ }
14227
+ const [customCommand] = customCommands;
14228
+ if (!customCommand) {
14229
+ return;
14230
+ }
14231
+ const instructions = getCustomInstructions(customCommand.command);
14232
+ if (instructions.length === 0) {
14233
+ throw createInvalidValueError(`${customCommand.path}.arguments.instructions must be a non-empty string for custom commands.`);
14234
+ }
14235
+ if (instructions.length > MAX_CUSTOM_INSTRUCTIONS_LENGTH) {
14236
+ 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.`);
14237
+ }
14238
+ const mentionedCommand = getMentionedStandardCommand(instructions);
14239
+ if (mentionedCommand !== null) {
14240
+ throw createInvalidValueError(`${customCommand.path}.arguments.instructions mentions "${mentionedCommand}". Use the "${mentionedCommand}" catalog command directly instead of wrapping it in custom prose.`);
14241
+ }
14242
+ }
14243
+
14082
14244
  // ../mcp-registry/src/operation-specs.ts
14083
- import { z as z21 } from "zod";
14245
+ import { z as z23 } from "zod";
14084
14246
 
14085
14247
  // ../mcp-registry/src/operation-spec.ts
14086
14248
  function stripLeadingGraphqlComments(document) {
@@ -14184,7 +14346,79 @@ function jsonOption({
14184
14346
  valueType: "json"
14185
14347
  };
14186
14348
  }
14187
- var jsonObjectSchema = z21.record(z21.string(), z21.unknown());
14349
+ var jsonObjectSchema = z23.record(z23.string(), z23.unknown());
14350
+ function isRecord3(value) {
14351
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14352
+ }
14353
+ function validateCustomInstructionsCommands({
14354
+ commands,
14355
+ ctx,
14356
+ path: path7
14357
+ }) {
14358
+ if (!Array.isArray(commands)) {
14359
+ return;
14360
+ }
14361
+ const validationResult = fromThrowable(() => {
14362
+ assertCustomInstructionsCommand({
14363
+ commands: commands.map((command) => isRecord3(command) ? command : {}),
14364
+ path: path7.join(".").replaceAll(/\.(?<index>\d+)/gu, "[$<index>]")
14365
+ });
14366
+ }, "invalid-custom-instructions-command");
14367
+ if (isErr(validationResult)) {
14368
+ ctx.addIssue({
14369
+ code: "custom",
14370
+ message: `${getErrorMessage2(validationResult.error.cause)} Run mgcl catalog commands to find the standard command for this work.`,
14371
+ path: path7
14372
+ });
14373
+ }
14374
+ }
14375
+ var automationPatchOperationsSchema = z23.array(z23.unknown()).min(1).superRefine((operations, ctx) => {
14376
+ for (const [operationIndex, operation] of operations.entries()) {
14377
+ if (!isRecord3(operation)) {
14378
+ continue;
14379
+ }
14380
+ const setCommands = operation["setAgentInstructionsCommands"];
14381
+ if (!isRecord3(setCommands)) {
14382
+ continue;
14383
+ }
14384
+ validateCustomInstructionsCommands({
14385
+ commands: setCommands["instructionsCommands"],
14386
+ ctx,
14387
+ path: [
14388
+ "operations",
14389
+ operationIndex,
14390
+ "setAgentInstructionsCommands",
14391
+ "instructionsCommands"
14392
+ ]
14393
+ });
14394
+ }
14395
+ });
14396
+ function automationInputSchema(agentKeys) {
14397
+ return jsonObjectSchema.superRefine((input, ctx) => {
14398
+ for (const agentKey of agentKeys) {
14399
+ const agents = input[agentKey];
14400
+ if (!Array.isArray(agents)) {
14401
+ continue;
14402
+ }
14403
+ for (const [agentIndex, agent] of agents.entries()) {
14404
+ if (!isRecord3(agent)) {
14405
+ continue;
14406
+ }
14407
+ validateCustomInstructionsCommands({
14408
+ commands: agent["instructionsCommands"],
14409
+ ctx,
14410
+ path: [agentKey, agentIndex, "instructionsCommands"]
14411
+ });
14412
+ }
14413
+ }
14414
+ });
14415
+ }
14416
+ var createAutomationInputSchema = automationInputSchema(["newAgents"]);
14417
+ var updateAutomationInputSchema = automationInputSchema([
14418
+ "newAgents",
14419
+ "updatedAgents"
14420
+ ]);
14421
+ var COMMAND_CATALOG_HELP = "When authoring raw instructionsCommands, run mgcl catalog commands and prefer a standard command.";
14188
14422
  var agentBrowserProviderOptionsSelection = ` browserbase {
14189
14423
  advancedStealth
14190
14424
  contextId
@@ -14277,11 +14511,51 @@ var agentLimitationsSelection = ` limitations {
14277
14511
  allowedUrlRegexes
14278
14512
  }`;
14279
14513
  var operationSpecs = [
14514
+ createOperationSpec({
14515
+ operationName: "GetCaptureContext",
14516
+ kind: "query",
14517
+ inputSchema: z23.object({
14518
+ automationId: z23.string().min(1).optional(),
14519
+ recordingId: z23.string().min(1).optional()
14520
+ }).refine(
14521
+ ({ automationId, recordingId }) => [automationId, recordingId].some((value) => value !== void 0),
14522
+ { message: "Provide --automation-id or --recording-id." }
14523
+ ),
14524
+ cli: {
14525
+ name: "get-capture-context",
14526
+ path: ["capture-context", "get"],
14527
+ description: "Fetch raw browser events and screenshots from a Capture Mode recording.",
14528
+ resultKey: "captureContext",
14529
+ options: [
14530
+ stringOption({
14531
+ inputKey: "automationId",
14532
+ flagName: "automation-id",
14533
+ description: "Automation ID whose newest usable Capture Mode recording to fetch."
14534
+ }),
14535
+ stringOption({
14536
+ inputKey: "recordingId",
14537
+ flagName: "recording-id",
14538
+ description: "Exact Capture Mode recording ID to fetch."
14539
+ })
14540
+ ]
14541
+ },
14542
+ mcp: { fileName: "captureContext.graphql" },
14543
+ document: `# Fetch raw Capture Mode context with inline screenshots
14544
+ query GetCaptureContext($automationId: ID, $recordingId: ID) {
14545
+ captureContext(
14546
+ automationId: $automationId
14547
+ recordingId: $recordingId
14548
+ ) {
14549
+ metadata
14550
+ rawEvents
14551
+ }
14552
+ }`
14553
+ }),
14280
14554
  createOperationSpec({
14281
14555
  operationName: "GetAgents",
14282
14556
  kind: "query",
14283
- inputSchema: z21.object({
14284
- ids: z21.array(z21.string().min(1)).min(1)
14557
+ inputSchema: z23.object({
14558
+ ids: z23.array(z23.string().min(1)).min(1)
14285
14559
  }),
14286
14560
  cli: {
14287
14561
  name: "get-agents",
@@ -14342,9 +14616,9 @@ ${agentLimitationsSelection}
14342
14616
  createOperationSpec({
14343
14617
  operationName: "GetAgentVersion",
14344
14618
  kind: "query",
14345
- inputSchema: z21.object({
14346
- agentId: z21.string().min(1),
14347
- versionId: z21.string().min(1)
14619
+ inputSchema: z23.object({
14620
+ agentId: z23.string().min(1),
14621
+ versionId: z23.string().min(1)
14348
14622
  }),
14349
14623
  cli: {
14350
14624
  name: "get-agent-version",
@@ -14407,8 +14681,8 @@ ${agentLimitationsSelection}
14407
14681
  createOperationSpec({
14408
14682
  operationName: "GetAgentVersions",
14409
14683
  kind: "query",
14410
- inputSchema: z21.object({
14411
- agentId: z21.string().min(1)
14684
+ inputSchema: z23.object({
14685
+ agentId: z23.string().min(1)
14412
14686
  }),
14413
14687
  cli: {
14414
14688
  name: "get-agent-versions",
@@ -14442,10 +14716,10 @@ query GetAgentVersions($agentId: ID!) {
14442
14716
  createOperationSpec({
14443
14717
  operationName: "DiffAgentVersion",
14444
14718
  kind: "query",
14445
- inputSchema: z21.object({
14446
- agentId: z21.string().min(1),
14447
- versionId: z21.string().min(1),
14448
- compareVersionId: z21.string().min(1).optional()
14719
+ inputSchema: z23.object({
14720
+ agentId: z23.string().min(1),
14721
+ versionId: z23.string().min(1),
14722
+ compareVersionId: z23.string().min(1).optional()
14449
14723
  }),
14450
14724
  cli: {
14451
14725
  name: "diff-agent-version",
@@ -14499,8 +14773,8 @@ query DiffAgentVersion(
14499
14773
  createOperationSpec({
14500
14774
  operationName: "GetAgentRun",
14501
14775
  kind: "query",
14502
- inputSchema: z21.object({
14503
- id: z21.string().min(1)
14776
+ inputSchema: z23.object({
14777
+ id: z23.string().min(1)
14504
14778
  }),
14505
14779
  cli: {
14506
14780
  name: "get-agent-run",
@@ -14536,8 +14810,8 @@ query GetAgentRun($id: ID!) {
14536
14810
  createOperationSpec({
14537
14811
  operationName: "GetAutomationAgents",
14538
14812
  kind: "query",
14539
- inputSchema: z21.object({
14540
- ids: z21.array(z21.string().min(1)).min(1)
14813
+ inputSchema: z23.object({
14814
+ ids: z23.array(z23.string().min(1)).min(1)
14541
14815
  }),
14542
14816
  cli: {
14543
14817
  name: "get-automation-agents",
@@ -14580,8 +14854,8 @@ query GetAutomationAgents($ids: [ID!]!) {
14580
14854
  createOperationSpec({
14581
14855
  operationName: "GetAutomationDiffFromPublished",
14582
14856
  kind: "query",
14583
- inputSchema: z21.object({
14584
- automationId: z21.string().min(1)
14857
+ inputSchema: z23.object({
14858
+ automationId: z23.string().min(1)
14585
14859
  }),
14586
14860
  cli: {
14587
14861
  name: "get-automation-diff-from-published",
@@ -14614,9 +14888,9 @@ query GetAutomationDiffFromPublished($automationId: ID!) {
14614
14888
  createOperationSpec({
14615
14889
  operationName: "GetAutomationDiffVersions",
14616
14890
  kind: "query",
14617
- inputSchema: z21.object({
14618
- baseVersionId: z21.string().min(1),
14619
- targetVersionId: z21.string().min(1)
14891
+ inputSchema: z23.object({
14892
+ baseVersionId: z23.string().min(1),
14893
+ targetVersionId: z23.string().min(1)
14620
14894
  }),
14621
14895
  cli: {
14622
14896
  name: "get-automation-diff-versions",
@@ -14657,10 +14931,10 @@ query GetAutomationDiffVersions($baseVersionId: ID!, $targetVersionId: ID!) {
14657
14931
  createOperationSpec({
14658
14932
  operationName: "GetAutomationVersionJson",
14659
14933
  kind: "query",
14660
- inputSchema: z21.object({
14661
- versionId: z21.string().min(1),
14662
- paths: z21.array(z21.string().min(1)).optional(),
14663
- format: z21.enum(["normalized", "full", "export"]).optional()
14934
+ inputSchema: z23.object({
14935
+ versionId: z23.string().min(1),
14936
+ paths: z23.array(z23.string().min(1)).optional(),
14937
+ format: z23.enum(["normalized", "full", "export"]).optional()
14664
14938
  }),
14665
14939
  cli: {
14666
14940
  name: "get-automation-version-json",
@@ -14695,8 +14969,8 @@ query GetAutomationVersionJson($versionId: ID!, $paths: [String!], $format: Stri
14695
14969
  createOperationSpec({
14696
14970
  operationName: "GetAutomationVersionJsonSkeleton",
14697
14971
  kind: "query",
14698
- inputSchema: z21.object({
14699
- versionId: z21.string().min(1)
14972
+ inputSchema: z23.object({
14973
+ versionId: z23.string().min(1)
14700
14974
  }),
14701
14975
  cli: {
14702
14976
  name: "get-automation-version-json-skeleton",
@@ -14721,8 +14995,8 @@ query GetAutomationVersionJsonSkeleton($versionId: ID!) {
14721
14995
  createOperationSpec({
14722
14996
  operationName: "GetAutomationRun",
14723
14997
  kind: "query",
14724
- inputSchema: z21.object({
14725
- id: z21.string().min(1)
14998
+ inputSchema: z23.object({
14999
+ id: z23.string().min(1)
14726
15000
  }),
14727
15001
  cli: {
14728
15002
  name: "get-automation-run",
@@ -14762,8 +15036,8 @@ query GetAutomationRun($id: ID!) {
14762
15036
  createOperationSpec({
14763
15037
  operationName: "GetAutomationRunAgentRuns",
14764
15038
  kind: "query",
14765
- inputSchema: z21.object({
14766
- automationRunId: z21.string().min(1)
15039
+ inputSchema: z23.object({
15040
+ automationRunId: z23.string().min(1)
14767
15041
  }),
14768
15042
  cli: {
14769
15043
  name: "get-automation-run-agent-runs",
@@ -14799,11 +15073,11 @@ query GetAutomationRunAgentRuns($automationRunId: ID!) {
14799
15073
  createOperationSpec({
14800
15074
  operationName: "GetAutomationRunIterations",
14801
15075
  kind: "query",
14802
- inputSchema: z21.object({
14803
- automationRunId: z21.string().min(1),
14804
- agentRunId: z21.string().min(1).optional(),
14805
- limit: z21.number().int().positive().optional(),
14806
- reverse: z21.boolean().optional()
15076
+ inputSchema: z23.object({
15077
+ automationRunId: z23.string().min(1),
15078
+ agentRunId: z23.string().min(1).optional(),
15079
+ limit: z23.number().int().positive().optional(),
15080
+ reverse: z23.boolean().optional()
14807
15081
  }),
14808
15082
  cli: {
14809
15083
  name: "get-automation-run-iterations",
@@ -14867,19 +15141,70 @@ query GetAutomationRunIterations(
14867
15141
  screenshotMimeType
14868
15142
  }
14869
15143
  }
15144
+ }`
15145
+ }),
15146
+ createOperationSpec({
15147
+ operationName: "InspectPausedAutomationStep",
15148
+ kind: "query",
15149
+ inputSchema: z23.object({
15150
+ runId: z23.string().min(1)
15151
+ }),
15152
+ cli: {
15153
+ name: "inspect-paused-automation-step",
15154
+ path: ["automation-runs", "inspect-paused-step"],
15155
+ description: "Inspect the latest persisted iteration for a paused manual-mode run.",
15156
+ resultKey: "automationRunIterations",
15157
+ options: [
15158
+ stringOption({
15159
+ inputKey: "runId",
15160
+ flagName: "run-id",
15161
+ description: "Automation run ID.",
15162
+ required: true
15163
+ })
15164
+ ]
15165
+ },
15166
+ mcp: { fileName: "inspectPausedAutomationStep.graphql" },
15167
+ document: `# Inspect the latest persisted iteration for a paused manual-mode run
15168
+ query InspectPausedAutomationStep($runId: ID!) {
15169
+ automationRunIterations(
15170
+ automationRunId: $runId
15171
+ limit: 1
15172
+ reverse: true
15173
+ ) {
15174
+ id
15175
+ sequence
15176
+ agentRunId
15177
+ metadata
15178
+ startedAt
15179
+ finishedAt
15180
+ totalDurationMs
15181
+ llmResponseDurationMs
15182
+ iterationContext
15183
+ verificationResults
15184
+ withMarksScreenshotUrl
15185
+ withMarksMimeType
15186
+ memories {
15187
+ id
15188
+ type
15189
+ value
15190
+ sequence
15191
+ screenshotUrl
15192
+ screenshotMimeType
15193
+ }
15194
+ }
14870
15195
  }`
14871
15196
  }),
14872
15197
  createOperationSpec({
14873
15198
  operationName: "GetAutomationRuns",
14874
15199
  kind: "query",
14875
- inputSchema: z21.object({
14876
- automationId: z21.string().min(1).optional(),
14877
- from: z21.string().min(1).optional(),
14878
- status: z21.array(z21.string().min(1)).optional(),
14879
- invocationType: z21.array(z21.string().min(1)).optional(),
14880
- limit: z21.number().int().positive().optional(),
14881
- page: z21.number().int().nonnegative().optional(),
14882
- to: z21.string().min(1).optional()
15200
+ inputSchema: z23.object({
15201
+ automationId: z23.string().min(1).optional(),
15202
+ from: z23.string().min(1).optional(),
15203
+ status: z23.array(z23.string().min(1)).optional(),
15204
+ invocationType: z23.array(z23.string().min(1)).optional(),
15205
+ limit: z23.number().int().positive().optional(),
15206
+ page: z23.number().int().nonnegative().optional(),
15207
+ to: z23.string().min(1).optional()
14883
15208
  }),
14884
15209
  cli: {
14885
15210
  name: "get-automation-runs",
@@ -14961,8 +15286,8 @@ query GetAutomationRuns(
14961
15286
  createOperationSpec({
14962
15287
  operationName: "ListAutomations",
14963
15288
  kind: "query",
14964
- inputSchema: z21.object({
14965
- limit: z21.number().positive().optional(),
15289
+ inputSchema: z23.object({
15290
+ limit: z23.number().positive().optional(),
14966
15291
  order: jsonObjectSchema.optional(),
14967
15292
  where: jsonObjectSchema.optional()
14968
15293
  }),
@@ -15013,8 +15338,8 @@ query ListAutomations(
15013
15338
  createOperationSpec({
15014
15339
  operationName: "GetAutomations",
15015
15340
  kind: "query",
15016
- inputSchema: z21.object({
15017
- ids: z21.array(z21.string().min(1)).min(1)
15341
+ inputSchema: z23.object({
15342
+ ids: z23.array(z23.string().min(1)).min(1)
15018
15343
  }),
15019
15344
  cli: {
15020
15345
  name: "get-automations",
@@ -15057,13 +15382,83 @@ query GetAutomations($ids: [ID!]!) {
15057
15382
  }
15058
15383
  }
15059
15384
  }
15385
+ }`
15386
+ }),
15387
+ createOperationSpec({
15388
+ operationName: "AnalyzeAutomationStoreMigration",
15389
+ kind: "query",
15390
+ inputSchema: automationStoreMigrationAnalyzerInputSchema,
15391
+ cli: {
15392
+ name: "analyze-automation-store-migration",
15393
+ path: ["automations", "store-migration", "analyze"],
15394
+ description: "Run read-only deterministic Store migration analysis over drafts, saved versions, or existing runs.",
15395
+ resultKey: "automationStoreMigrationAnalysis",
15396
+ options: [
15397
+ stringOption({
15398
+ inputKey: "mode",
15399
+ flagName: "mode",
15400
+ description: "Analysis mode: audit, compare, or auditRuntimeEvidence.",
15401
+ required: true
15402
+ }),
15403
+ stringArrayOption({
15404
+ inputKey: "automationIds",
15405
+ flagName: "automation-ids",
15406
+ description: "Starting draft automation IDs for audit mode."
15407
+ }),
15408
+ jsonOption({
15409
+ inputKey: "comparison",
15410
+ flagName: "comparison-json",
15411
+ description: "Exact saved-version declaration for compare mode."
15412
+ }),
15413
+ jsonOption({
15414
+ inputKey: "mappings",
15415
+ flagName: "mappings-json",
15416
+ description: "Legacy-value migration mapping declarations."
15417
+ }),
15418
+ jsonOption({
15419
+ inputKey: "storeWritePolicies",
15420
+ flagName: "store-write-policies-json",
15421
+ description: "Store writer coordination policy declarations."
15422
+ }),
15423
+ stringArrayOption({
15424
+ inputKey: "runIds",
15425
+ flagName: "run-ids",
15426
+ description: "Existing run IDs for auditRuntimeEvidence mode; no runs are created."
15427
+ }),
15428
+ stringOption({
15429
+ inputKey: "workItem",
15430
+ flagName: "work-item",
15431
+ description: "Optional business work-item label."
15432
+ })
15433
+ ]
15434
+ },
15435
+ mcp: { fileName: "analyzeAutomationStoreMigration.graphql" },
15436
+ document: `# Read-only deterministic analysis for Automation Store migrations.
15437
+ query AnalyzeAutomationStoreMigration(
15438
+ $mode: String!
15439
+ $automationIds: [ID!]!
15440
+ $comparison: JSON
15441
+ $mappings: JSON!
15442
+ $storeWritePolicies: JSON!
15443
+ $runIds: [ID!]!
15444
+ $workItem: String!
15445
+ ) {
15446
+ automationStoreMigrationAnalysis(
15447
+ mode: $mode
15448
+ automationIds: $automationIds
15449
+ comparison: $comparison
15450
+ mappings: $mappings
15451
+ storeWritePolicies: $storeWritePolicies
15452
+ runIds: $runIds
15453
+ workItem: $workItem
15454
+ )
15060
15455
  }`
15061
15456
  }),
15062
15457
  createOperationSpec({
15063
15458
  operationName: "GetAvailableCommands",
15064
15459
  kind: "query",
15065
- inputSchema: z21.object({
15066
- env: z21.string().min(1)
15460
+ inputSchema: z23.object({
15461
+ env: z23.string().min(1)
15067
15462
  }),
15068
15463
  cli: {
15069
15464
  name: "get-available-commands",
@@ -15084,7 +15479,10 @@ query GetAutomations($ids: [ID!]!) {
15084
15479
  query GetAvailableCommands($env: AvailableCommandsEnv!) {
15085
15480
  availableCommands(env: $env) {
15086
15481
  id
15482
+ category
15087
15483
  description
15484
+ template
15485
+ whenToUse
15088
15486
  requiredTool
15089
15487
  inputSchema
15090
15488
  }
@@ -15093,8 +15491,8 @@ query GetAvailableCommands($env: AvailableCommandsEnv!) {
15093
15491
  createOperationSpec({
15094
15492
  operationName: "GetAvailableModels",
15095
15493
  kind: "query",
15096
- inputSchema: z21.object({
15097
- agentId: z21.string().min(1)
15494
+ inputSchema: z23.object({
15495
+ agentId: z23.string().min(1)
15098
15496
  }),
15099
15497
  cli: {
15100
15498
  name: "get-available-models",
@@ -15138,9 +15536,9 @@ query GetAvailableModels($agentId: String!) {
15138
15536
  createOperationSpec({
15139
15537
  operationName: "GetAvailableTools",
15140
15538
  kind: "query",
15141
- inputSchema: z21.object({
15142
- env: z21.string().min(1),
15143
- automationId: z21.string().min(1).optional()
15539
+ inputSchema: z23.object({
15540
+ env: z23.string().min(1),
15541
+ automationId: z23.string().min(1).optional()
15144
15542
  }),
15145
15543
  cli: {
15146
15544
  name: "get-available-tools",
@@ -15174,8 +15572,8 @@ query GetAvailableTools($env: AvailableCommandsEnv!, $automationId: String) {
15174
15572
  createOperationSpec({
15175
15573
  operationName: "GetFeatureFlagsContext",
15176
15574
  kind: "query",
15177
- inputSchema: z21.object({
15178
- flagKeys: z21.array(z21.string().min(1)).min(1).max(100).optional()
15575
+ inputSchema: z23.object({
15576
+ flagKeys: z23.array(z23.string().min(1)).min(1).max(100).optional()
15179
15577
  }),
15180
15578
  cli: {
15181
15579
  name: "get-feature-flags-context",
@@ -15212,7 +15610,7 @@ query GetFeatureFlagsContext($flagKeys: [String!]) {
15212
15610
  createOperationSpec({
15213
15611
  operationName: "GetAutomationWorkbenchCredentials",
15214
15612
  kind: "query",
15215
- inputSchema: z21.object({}),
15613
+ inputSchema: z23.object({}),
15216
15614
  cli: {
15217
15615
  name: "get-automation-workbench-credentials",
15218
15616
  path: ["workbench", "credentials"],
@@ -15237,8 +15635,8 @@ query GetAutomationWorkbenchCredentials {
15237
15635
  createOperationSpec({
15238
15636
  operationName: "GetAutomationWorkbenchDiagnostics",
15239
15637
  kind: "query",
15240
- inputSchema: z21.object({
15241
- draftAutomationId: z21.string().min(1)
15638
+ inputSchema: z23.object({
15639
+ draftAutomationId: z23.string().min(1)
15242
15640
  }),
15243
15641
  cli: {
15244
15642
  name: "get-automation-workbench-diagnostics",
@@ -15303,11 +15701,11 @@ query GetAutomationWorkbenchDiagnostics($draftAutomationId: ID!) {
15303
15701
  createOperationSpec({
15304
15702
  operationName: "GetAutomationWorkbenchRunTrace",
15305
15703
  kind: "query",
15306
- inputSchema: z21.object({
15307
- automationRunId: z21.string().min(1),
15308
- agentRunId: z21.string().min(1).optional(),
15309
- limit: z21.number().int().positive().optional(),
15310
- reverse: z21.boolean().optional()
15704
+ inputSchema: z23.object({
15705
+ automationRunId: z23.string().min(1),
15706
+ agentRunId: z23.string().min(1).optional(),
15707
+ limit: z23.number().int().positive().optional(),
15708
+ reverse: z23.boolean().optional()
15311
15709
  }),
15312
15710
  cli: {
15313
15711
  name: "get-automation-workbench-run-trace",
@@ -15439,13 +15837,13 @@ query GetAutomationWorkbenchRunTrace(
15439
15837
  createOperationSpec({
15440
15838
  operationName: "GetAutomationWorkbenchAwaitRunCompletion",
15441
15839
  kind: "query",
15442
- inputSchema: z21.object({
15443
- automationRunId: z21.string().min(1),
15444
- timeoutMs: z21.number().int().min(1e3).max(6e4).optional(),
15445
- sinceSequence: z21.number().int().min(0).optional(),
15446
- agentRunId: z21.string().min(1).optional(),
15447
- limit: z21.number().int().positive().optional(),
15448
- reverse: z21.boolean().optional()
15840
+ inputSchema: z23.object({
15841
+ automationRunId: z23.string().min(1),
15842
+ timeoutMs: z23.number().int().min(1e3).max(6e4).optional(),
15843
+ sinceSequence: z23.number().int().min(0).optional(),
15844
+ agentRunId: z23.string().min(1).optional(),
15845
+ limit: z23.number().int().positive().optional(),
15846
+ reverse: z23.boolean().optional()
15449
15847
  }),
15450
15848
  cli: {
15451
15849
  name: "await-automation-workbench-run-completion",
@@ -15599,11 +15997,11 @@ query GetAutomationWorkbenchAwaitRunCompletion(
15599
15997
  createOperationSpec({
15600
15998
  operationName: "GetAutomationWorkbenchSchemaSuggestions",
15601
15999
  kind: "query",
15602
- inputSchema: z21.object({
15603
- automationRunId: z21.string().min(1),
15604
- draftAutomationId: z21.string().min(1).optional(),
15605
- minConfidence: z21.number().min(0).max(1).optional(),
15606
- includeSensitive: z21.boolean().optional()
16000
+ inputSchema: z23.object({
16001
+ automationRunId: z23.string().min(1),
16002
+ draftAutomationId: z23.string().min(1).optional(),
16003
+ minConfidence: z23.number().min(0).max(1).optional(),
16004
+ includeSensitive: z23.boolean().optional()
15607
16005
  }),
15608
16006
  cli: {
15609
16007
  name: "get-automation-workbench-schema-suggestions",
@@ -15671,8 +16069,8 @@ query GetAutomationWorkbenchSchemaSuggestions(
15671
16069
  createOperationSpec({
15672
16070
  operationName: "CreateAutomation",
15673
16071
  kind: "mutation",
15674
- inputSchema: z21.object({
15675
- input: jsonObjectSchema
16072
+ inputSchema: z23.object({
16073
+ input: createAutomationInputSchema
15676
16074
  }),
15677
16075
  cli: {
15678
16076
  name: "create-automation",
@@ -15683,7 +16081,7 @@ query GetAutomationWorkbenchSchemaSuggestions(
15683
16081
  jsonOption({
15684
16082
  inputKey: "input",
15685
16083
  flagName: "input-json",
15686
- description: "CreateAutomationInput payload.",
16084
+ description: `CreateAutomationInput payload. ${COMMAND_CATALOG_HELP}`,
15687
16085
  required: true
15688
16086
  })
15689
16087
  ]
@@ -15708,7 +16106,7 @@ mutation CreateAutomation($input: CreateAutomationInput!) {
15708
16106
  createOperationSpec({
15709
16107
  operationName: "GetGraphqlSchema",
15710
16108
  kind: "query",
15711
- inputSchema: z21.object({}),
16109
+ inputSchema: z23.object({}),
15712
16110
  cli: {
15713
16111
  name: "get-graphql-schema",
15714
16112
  path: ["graphql", "schema"],
@@ -15724,13 +16122,65 @@ mutation CreateAutomation($input: CreateAutomationInput!) {
15724
16122
  # reuse cached results.
15725
16123
  query GetGraphqlSchema {
15726
16124
  graphqlSchema
16125
+ }`
16126
+ }),
16127
+ createOperationSpec({
16128
+ operationName: "ApproveAutomationStep",
16129
+ kind: "mutation",
16130
+ inputSchema: z23.object({
16131
+ runId: z23.string().min(1)
16132
+ }),
16133
+ cli: {
16134
+ name: "approve-automation-step",
16135
+ path: ["automation-runs", "approve-step"],
16136
+ description: "Approve the proposed step for a paused manual-mode run.",
16137
+ resultKey: "approveAutomationStep",
16138
+ options: [
16139
+ stringOption({
16140
+ inputKey: "runId",
16141
+ flagName: "run-id",
16142
+ description: "Automation run ID.",
16143
+ required: true
16144
+ })
16145
+ ]
16146
+ },
16147
+ mcp: { fileName: "approveAutomationStep.graphql" },
16148
+ document: `# Approve the proposed step for a paused manual-mode run
16149
+ mutation ApproveAutomationStep($runId: ID!) {
16150
+ approveAutomationStep(automationRunId: $runId, retry: false)
16151
+ }`
16152
+ }),
16153
+ createOperationSpec({
16154
+ operationName: "RetryAutomationStep",
16155
+ kind: "mutation",
16156
+ inputSchema: z23.object({
16157
+ runId: z23.string().min(1)
16158
+ }),
16159
+ cli: {
16160
+ name: "retry-automation-step",
16161
+ path: ["automation-runs", "retry-step"],
16162
+ description: "Retry the proposed step after saving a material change to its agent.",
16163
+ resultKey: "approveAutomationStep",
16164
+ options: [
16165
+ stringOption({
16166
+ inputKey: "runId",
16167
+ flagName: "run-id",
16168
+ description: "Automation run ID.",
16169
+ required: true
16170
+ })
16171
+ ]
16172
+ },
16173
+ mcp: { fileName: "retryAutomationStep.graphql" },
16174
+ document: `# Retry the proposed step after saving a material change to its agent
16175
+ mutation RetryAutomationStep($runId: ID!) {
16176
+ approveAutomationStep(automationRunId: $runId, retry: true)
15727
16177
  }`
15728
16178
  }),
15729
16179
  createOperationSpec({
15730
16180
  operationName: "PauseAutomationRun",
15731
16181
  kind: "mutation",
15732
- inputSchema: z21.object({
15733
- automationRunId: z21.string().min(1)
16182
+ inputSchema: z23.object({
16183
+ automationRunId: z23.string().min(1)
15734
16184
  }),
15735
16185
  cli: {
15736
16186
  name: "pause-automation-run",
@@ -15755,11 +16205,11 @@ mutation PauseAutomationRun($automationRunId: ID!) {
15755
16205
  createOperationSpec({
15756
16206
  operationName: "RerunAutomation",
15757
16207
  kind: "mutation",
15758
- inputSchema: z21.object({
15759
- automationRunId: z21.string().min(1),
15760
- additionalPrompt: z21.string().min(1).optional(),
15761
- idempotencyKey: z21.string().min(1),
15762
- allowPointOfNoReturnOverride: z21.boolean().optional()
16208
+ inputSchema: z23.object({
16209
+ automationRunId: z23.string().min(1),
16210
+ additionalPrompt: z23.string().min(1).optional(),
16211
+ idempotencyKey: z23.string().min(1),
16212
+ allowPointOfNoReturnOverride: z23.boolean().optional()
15763
16213
  }),
15764
16214
  cli: {
15765
16215
  name: "rerun-automation",
@@ -15814,9 +16264,9 @@ mutation RerunAutomation(
15814
16264
  createOperationSpec({
15815
16265
  operationName: "ResumeAutomationRun",
15816
16266
  kind: "mutation",
15817
- inputSchema: z21.object({
15818
- automationRunId: z21.string().min(1),
15819
- message: z21.string().min(1).optional()
16267
+ inputSchema: z23.object({
16268
+ automationRunId: z23.string().min(1),
16269
+ message: z23.string().min(1).optional()
15820
16270
  }),
15821
16271
  cli: {
15822
16272
  name: "resume-automation-run",
@@ -15846,15 +16296,15 @@ mutation ResumeAutomationRun($automationRunId: ID!, $message: String) {
15846
16296
  createOperationSpec({
15847
16297
  operationName: "RunDraftAutomation",
15848
16298
  kind: "mutation",
15849
- inputSchema: z21.object({
15850
- draftAutomationId: z21.string().min(1),
15851
- agentId: z21.string().min(1),
15852
- idempotencyKey: z21.string().min(1),
15853
- input: z21.unknown().optional(),
15854
- initialStore: z21.record(z21.string(), z21.unknown()).optional(),
16299
+ inputSchema: z23.object({
16300
+ draftAutomationId: z23.string().min(1),
16301
+ agentId: z23.string().min(1),
16302
+ idempotencyKey: z23.string().min(1),
16303
+ input: z23.unknown().optional(),
16304
+ initialStore: z23.record(z23.string(), z23.unknown()).optional(),
15855
16305
  config: automationRunStartConfigSchema.partial().passthrough().optional(),
15856
- additionalPrompt: z21.string().min(1).optional(),
15857
- consistencyCheckCount: z21.number().int().optional()
16306
+ additionalPrompt: z23.string().min(1).optional(),
16307
+ consistencyCheckCount: z23.number().int().optional()
15858
16308
  }),
15859
16309
  cli: {
15860
16310
  name: "run-draft-automation",
@@ -15939,8 +16389,8 @@ mutation RunDraftAutomation(
15939
16389
  createOperationSpec({
15940
16390
  operationName: "StopAutomationRun",
15941
16391
  kind: "mutation",
15942
- inputSchema: z21.object({
15943
- automationRunId: z21.string().min(1)
16392
+ inputSchema: z23.object({
16393
+ automationRunId: z23.string().min(1)
15944
16394
  }),
15945
16395
  cli: {
15946
16396
  name: "stop-automation-run",
@@ -15965,10 +16415,10 @@ mutation StopAutomationRun($automationRunId: ID!) {
15965
16415
  createOperationSpec({
15966
16416
  operationName: "PreviewAutomationPatch",
15967
16417
  kind: "mutation",
15968
- inputSchema: z21.object({
15969
- draftAutomationId: z21.string().min(1),
15970
- expectedLastSavedAt: z21.string().optional(),
15971
- operations: z21.array(z21.unknown()).min(1)
16418
+ inputSchema: z23.object({
16419
+ draftAutomationId: z23.string().min(1),
16420
+ expectedLastSavedAt: z23.string().optional(),
16421
+ operations: automationPatchOperationsSchema
15972
16422
  }),
15973
16423
  cli: {
15974
16424
  name: "preview-automation-patch",
@@ -15985,7 +16435,7 @@ mutation StopAutomationRun($automationRunId: ID!) {
15985
16435
  jsonOption({
15986
16436
  inputKey: "operations",
15987
16437
  flagName: "operations-json",
15988
- description: "Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape.",
16438
+ description: `Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape. ${COMMAND_CATALOG_HELP}`,
15989
16439
  required: true
15990
16440
  })
15991
16441
  ]
@@ -16077,9 +16527,9 @@ mutation PreviewAutomationPatch(
16077
16527
  createOperationSpec({
16078
16528
  operationName: "ApplyAutomationPatch",
16079
16529
  kind: "mutation",
16080
- inputSchema: z21.object({
16081
- draftAutomationId: z21.string().min(1),
16082
- operations: z21.array(z21.unknown()).min(1)
16530
+ inputSchema: z23.object({
16531
+ draftAutomationId: z23.string().min(1),
16532
+ operations: automationPatchOperationsSchema
16083
16533
  }),
16084
16534
  cli: {
16085
16535
  name: "apply-automation-patch",
@@ -16096,7 +16546,7 @@ mutation PreviewAutomationPatch(
16096
16546
  jsonOption({
16097
16547
  inputKey: "operations",
16098
16548
  flagName: "operations-json",
16099
- description: "Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape.",
16549
+ description: `Automation patch operations array using AutomationWorkbenchPatchOperationInput oneOf shape. ${COMMAND_CATALOG_HELP}`,
16100
16550
  required: true
16101
16551
  }),
16102
16552
  stringOption({
@@ -16195,9 +16645,9 @@ mutation ApplyAutomationPatch(
16195
16645
  createOperationSpec({
16196
16646
  operationName: "UpdateAutomationById",
16197
16647
  kind: "mutation",
16198
- inputSchema: z21.object({
16199
- id: z21.string().min(1),
16200
- input: jsonObjectSchema
16648
+ inputSchema: z23.object({
16649
+ id: z23.string().min(1),
16650
+ input: updateAutomationInputSchema
16201
16651
  }),
16202
16652
  cli: {
16203
16653
  name: "update-automation-by-id",
@@ -16214,7 +16664,7 @@ mutation ApplyAutomationPatch(
16214
16664
  jsonOption({
16215
16665
  inputKey: "input",
16216
16666
  flagName: "input-json",
16217
- 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.",
16667
+ 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}`,
16218
16668
  required: true
16219
16669
  })
16220
16670
  ]
@@ -16239,7 +16689,7 @@ mutation UpdateAutomationById($id: ID!, $input: UpdateAutomationInput!) {
16239
16689
  import { Command as Command2, InvalidArgumentError as InvalidArgumentError2, Option as Option2 } from "commander";
16240
16690
 
16241
16691
  // src/api.ts
16242
- import { z as z23 } from "zod";
16692
+ import { z as z24 } from "zod";
16243
16693
 
16244
16694
  // src/version.ts
16245
16695
  import fs from "node:fs";
@@ -16266,55 +16716,55 @@ var CLI_VERSION = cliPackageVersion;
16266
16716
  // src/api.ts
16267
16717
  var OTTO_AUTHORIZATION_HEADER_NAME = "X-Otto-Authorization";
16268
16718
  var OTTO_AUTHORIZATION_ISSUER = "magical:otto";
16269
- var workosOrganizationsResponseSchema = z23.object({
16270
- organizations: z23.array(
16271
- z23.object({
16272
- id: z23.string().min(1),
16273
- name: z23.string().min(1),
16274
- primaryDomain: z23.string().nullable().optional()
16719
+ var workosOrganizationsResponseSchema = z24.object({
16720
+ organizations: z24.array(
16721
+ z24.object({
16722
+ id: z24.string().min(1),
16723
+ name: z24.string().min(1),
16724
+ primaryDomain: z24.string().nullable().optional()
16275
16725
  })
16276
16726
  ),
16277
- success: z23.boolean()
16727
+ success: z24.boolean()
16278
16728
  });
16279
- var workosUserSchema = z23.object({
16280
- email: z23.string().nullable(),
16281
- id: z23.string().min(1)
16729
+ var workosUserSchema = z24.object({
16730
+ email: z24.string().nullable(),
16731
+ id: z24.string().min(1)
16282
16732
  });
16283
- var nangoIntegrationWireSchema = z23.object({
16733
+ var nangoIntegrationWireSchema = z24.object({
16284
16734
  // eslint-disable-next-line @typescript-eslint/naming-convention -- mirrors Nango REST payload
16285
- unique_key: z23.string().min(1)
16735
+ unique_key: z24.string().min(1)
16286
16736
  }).passthrough().transform((data) => ({
16287
16737
  ...data,
16288
16738
  uniqueKey: data.unique_key
16289
16739
  }));
16290
- var nangoIntegrationsResponseSchema = z23.array(nangoIntegrationWireSchema);
16291
- var organizationAuthenticationSchema = z23.object({
16292
- id: z23.string().min(1),
16293
- type: z23.string().min(1),
16294
- connectionId: z23.string().nullable().optional(),
16295
- providerConfigKey: z23.string().nullable().optional(),
16296
- description: z23.string().nullable().optional(),
16297
- hostname: z23.string().nullable().optional()
16740
+ var nangoIntegrationsResponseSchema = z24.array(nangoIntegrationWireSchema);
16741
+ var organizationAuthenticationSchema = z24.object({
16742
+ id: z24.string().min(1),
16743
+ type: z24.string().min(1),
16744
+ connectionId: z24.string().nullable().optional(),
16745
+ providerConfigKey: z24.string().nullable().optional(),
16746
+ description: z24.string().nullable().optional(),
16747
+ hostname: z24.string().nullable().optional()
16298
16748
  }).passthrough();
16299
- var organizationAuthenticationsResponseSchema = z23.object({
16300
- authentications: z23.array(organizationAuthenticationSchema),
16301
- success: z23.boolean()
16749
+ var organizationAuthenticationsResponseSchema = z24.object({
16750
+ authentications: z24.array(organizationAuthenticationSchema),
16751
+ success: z24.boolean()
16302
16752
  });
16303
- var graphQlResponseSchema = z23.object({
16304
- data: z23.record(z23.string(), z23.unknown()).optional(),
16305
- errors: z23.array(
16306
- z23.object({
16307
- message: z23.string().min(1)
16753
+ var graphQlResponseSchema = z24.object({
16754
+ data: z24.record(z24.string(), z24.unknown()).optional(),
16755
+ errors: z24.array(
16756
+ z24.object({
16757
+ message: z24.string().min(1)
16308
16758
  })
16309
16759
  ).optional()
16310
16760
  });
16311
- var apiErrorResponseSchema = z23.object({
16312
- errors: z23.array(
16313
- z23.object({
16314
- message: z23.string().min(1)
16761
+ var apiErrorResponseSchema = z24.object({
16762
+ errors: z24.array(
16763
+ z24.object({
16764
+ message: z24.string().min(1)
16315
16765
  })
16316
16766
  ).optional(),
16317
- message: z23.string().min(1).optional()
16767
+ message: z24.string().min(1).optional()
16318
16768
  });
16319
16769
  function getApiErrorDetail(responseBody) {
16320
16770
  const parsedResponse = apiErrorResponseSchema.safeParse(responseBody);
@@ -16332,7 +16782,7 @@ function getApiErrorDetail(responseBody) {
16332
16782
  function trimTrailingSlash(value) {
16333
16783
  return value.replace(/\/+$/u, "");
16334
16784
  }
16335
- function isRecord2(value) {
16785
+ function isRecord4(value) {
16336
16786
  return typeof value === "object" && value !== null && !Array.isArray(value);
16337
16787
  }
16338
16788
  function decodeJwtPayload(token) {
@@ -16346,7 +16796,7 @@ function decodeJwtPayload(token) {
16346
16796
  if (isErr(payloadResult)) {
16347
16797
  return null;
16348
16798
  }
16349
- return isRecord2(payloadResult.value) ? payloadResult.value : null;
16799
+ return isRecord4(payloadResult.value) ? payloadResult.value : null;
16350
16800
  }
16351
16801
  function isOttoAuthorizationToken(token) {
16352
16802
  return decodeJwtPayload(token)?.["iss"] === OTTO_AUTHORIZATION_ISSUER;
@@ -16603,10 +17053,10 @@ function requireWorkosClientId(config) {
16603
17053
  // src/settings.ts
16604
17054
  import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
16605
17055
  import path3 from "node:path";
16606
- import { z as z24 } from "zod";
16607
- var cliSettingsSchema = z24.object({
16608
- env: z24.object({
16609
- baseUrl: z24.url().optional()
17056
+ import { z as z25 } from "zod";
17057
+ var cliSettingsSchema = z25.object({
17058
+ env: z25.object({
17059
+ baseUrl: z25.url().optional()
16610
17060
  }).default({})
16611
17061
  });
16612
17062
  function createEmptyCliSettings() {
@@ -17208,24 +17658,24 @@ ${formatExamples("Examples", [
17208
17658
  // src/state.ts
17209
17659
  import { mkdir as mkdir2, readFile as readFile3, rm as rm3, writeFile as writeFile2 } from "node:fs/promises";
17210
17660
  import path5 from "node:path";
17211
- import { z as z25 } from "zod";
17212
- var cliAccountSchema = z25.object({
17213
- clientId: z25.string().min(1),
17214
- email: z25.string().nullable(),
17215
- userId: z25.string().min(1)
17661
+ import { z as z26 } from "zod";
17662
+ var cliAccountSchema = z26.object({
17663
+ clientId: z26.string().min(1),
17664
+ email: z26.string().nullable(),
17665
+ userId: z26.string().min(1)
17216
17666
  });
17217
- var cliOrganizationSchema = z25.object({
17218
- id: z25.string().min(1),
17219
- name: z25.string().min(1),
17220
- primaryDomain: z25.string().nullable().default(null)
17667
+ var cliOrganizationSchema = z26.object({
17668
+ id: z26.string().min(1),
17669
+ name: z26.string().min(1),
17670
+ primaryDomain: z26.string().nullable().default(null)
17221
17671
  });
17222
- var cliStateSchema = z25.object({
17672
+ var cliStateSchema = z26.object({
17223
17673
  account: cliAccountSchema,
17224
- defaultOrgId: z25.string().nullable(),
17225
- lastUsedOrgId: z25.string().nullable(),
17226
- organizations: z25.array(cliOrganizationSchema)
17674
+ defaultOrgId: z26.string().nullable(),
17675
+ lastUsedOrgId: z26.string().nullable(),
17676
+ organizations: z26.array(cliOrganizationSchema)
17227
17677
  });
17228
- var refreshTokenFileSchema = z25.record(z25.string(), z25.string());
17678
+ var refreshTokenFileSchema = z26.record(z26.string(), z26.string());
17229
17679
  function createFileStateStore(stateFilePath) {
17230
17680
  return {
17231
17681
  async clear() {
@@ -17316,37 +17766,37 @@ function buildRefreshTokenKey(account) {
17316
17766
  }
17317
17767
 
17318
17768
  // src/workos-auth.ts
17319
- import { z as z26 } from "zod";
17769
+ import { z as z27 } from "zod";
17320
17770
  var DEFAULT_DEVICE_POLL_INTERVAL_SECONDS = 5;
17321
17771
  function buildFormHeaders() {
17322
17772
  const headers = new Headers();
17323
17773
  headers.set("content-type", "application/x-www-form-urlencoded");
17324
17774
  return headers;
17325
17775
  }
17326
- var deviceAuthorizationSchema = z26.object({
17327
- device_code: z26.string().min(1),
17328
- expires_in: z26.number().int().positive().optional(),
17329
- interval: z26.number().int().positive().optional(),
17330
- user_code: z26.string().min(1),
17331
- verification_uri: z26.url(),
17332
- verification_uri_complete: z26.url().optional()
17776
+ var deviceAuthorizationSchema = z27.object({
17777
+ device_code: z27.string().min(1),
17778
+ expires_in: z27.number().int().positive().optional(),
17779
+ interval: z27.number().int().positive().optional(),
17780
+ user_code: z27.string().min(1),
17781
+ verification_uri: z27.url(),
17782
+ verification_uri_complete: z27.url().optional()
17333
17783
  });
17334
- var tokenResponseSchema = z26.object({
17335
- access_token: z26.string().min(1),
17336
- expires_in: z26.number().int().positive().optional(),
17337
- refresh_token: z26.string().min(1),
17338
- token_type: z26.string().optional()
17784
+ var tokenResponseSchema = z27.object({
17785
+ access_token: z27.string().min(1),
17786
+ expires_in: z27.number().int().positive().optional(),
17787
+ refresh_token: z27.string().min(1),
17788
+ token_type: z27.string().optional()
17339
17789
  });
17340
- var tokenErrorSchema = z26.object({
17341
- error: z26.string().min(1),
17342
- error_description: z26.string().optional()
17790
+ var tokenErrorSchema = z27.object({
17791
+ error: z27.string().min(1),
17792
+ error_description: z27.string().optional()
17343
17793
  });
17344
- var accessTokenClaimsSchema = z26.object({
17345
- exp: z26.number().int().positive().optional(),
17346
- iss: z26.string().min(1).optional(),
17347
- org_id: z26.string().min(1).optional(),
17348
- sid: z26.string().min(1).optional(),
17349
- sub: z26.string().min(1)
17794
+ var accessTokenClaimsSchema = z27.object({
17795
+ exp: z27.number().int().positive().optional(),
17796
+ iss: z27.string().min(1).optional(),
17797
+ org_id: z27.string().min(1).optional(),
17798
+ sid: z27.string().min(1).optional(),
17799
+ sub: z27.string().min(1)
17350
17800
  });
17351
17801
  function createWorkosAuthClient({
17352
17802
  fetchFn = fetch,
@@ -17545,7 +17995,7 @@ function createCliCommanderOption(optionSpec, helpGroup) {
17545
17995
  }
17546
17996
  return nextOption;
17547
17997
  }
17548
- function isRecord3(value) {
17998
+ function isRecord5(value) {
17549
17999
  return typeof value === "object" && value !== null && !Array.isArray(value);
17550
18000
  }
17551
18001
  function resolveOrganizationBySelector({
@@ -17612,7 +18062,7 @@ function collectOperationVariables(operationSpec, options) {
17612
18062
  parsedVariables.error.issues[0]?.message ?? "Invalid command input."
17613
18063
  );
17614
18064
  }
17615
- if (!isRecord3(parsedVariables.data)) {
18065
+ if (!isRecord5(parsedVariables.data)) {
17616
18066
  throw new CliError("Invalid command input.");
17617
18067
  }
17618
18068
  return parsedVariables.data;