@wave-ai-os/wave-cli 0.1.71 → 0.1.73

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/README.md CHANGED
@@ -74,6 +74,12 @@ The API base defaults to production: `https://api.ourwave.io`. Supply
74
74
  `--base-url`, stdin context, `WAVE_API_BASE_URL`/`WAVE_API_URL`, or config only
75
75
  when using a non-production environment.
76
76
 
77
+ `wave login` always opens the production browser login at
78
+ `https://app.ourwave.io/login` unless `--base-url` is supplied explicitly.
79
+ The CLI uses `https://api.ourwave.io` only to create and poll that login
80
+ session. Ambient endpoint configuration never redirects a bare login to a
81
+ local environment.
82
+
77
83
  Organization-scoped data commands use the organization certified by the
78
84
  authenticated CLI token. `--organization-id` is the only local override.
79
85
 
package/dist/index.cjs CHANGED
@@ -4199,18 +4199,8 @@ var SKILL_SELECTION = `{
4199
4199
  }
4200
4200
  createdAt
4201
4201
  updatedAt
4202
+ updateVersion
4202
4203
  }`;
4203
- function asRecord4(value) {
4204
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
4205
- }
4206
- function findSkillById(id) {
4207
- return (payload) => {
4208
- if (!Array.isArray(payload)) {
4209
- return null;
4210
- }
4211
- return payload.find((entry2) => String(asRecord4(entry2)?.id ?? "") === id) ?? null;
4212
- };
4213
- }
4214
4204
  function registerSkillCommands(program) {
4215
4205
  const skills = program.command("skills").description("Skill record operations");
4216
4206
  skills.command("list").description("List Skill records").option("--scope <scope>", "Filter skills by scope").option("--query <query>", "Filter skills by search query").option("--limit <limit>", "Limit skills returned").requiredOption("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
@@ -4238,7 +4228,7 @@ function registerSkillCommands(program) {
4238
4228
  isList: true
4239
4229
  });
4240
4230
  });
4241
- skills.command("show").description("Read one persisted Skill record by id").requiredOption("--id <id>", "Skill id").requiredOption("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
4231
+ skills.command("show").description("Read one persisted Skill record by id or slug").requiredOption("--id <idOrSlug>", "Skill id or slug").option("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
4242
4232
  const id = idSchema7.parse(opts.id);
4243
4233
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4244
4234
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -4246,16 +4236,17 @@ function registerSkillCommands(program) {
4246
4236
  command: "skills.show",
4247
4237
  operationName: "SkillsShow",
4248
4238
  runtimeOptions: context.runtimeOptions,
4249
- field: "skills",
4239
+ field: "skill",
4250
4240
  variables: {
4251
- organization_id: organizationId
4241
+ organization_id: organizationId,
4242
+ id
4252
4243
  },
4253
4244
  variableTypes: {
4254
- organization_id: "ID!"
4245
+ organization_id: "ID!",
4246
+ id: "ID!"
4255
4247
  },
4256
4248
  selectionSet: SKILL_SELECTION,
4257
- isShow: true,
4258
- transformData: findSkillById(id)
4249
+ isShow: true
4259
4250
  });
4260
4251
  });
4261
4252
  }
@@ -6483,7 +6474,7 @@ var import_zod16 = require("zod");
6483
6474
 
6484
6475
  // src/internalOptions.ts
6485
6476
  var INTERNAL_OPTIONS_KEY = "__waveInternalOptions";
6486
- function asRecord5(value) {
6477
+ function asRecord4(value) {
6487
6478
  if (!value || typeof value !== "object" || Array.isArray(value)) {
6488
6479
  return null;
6489
6480
  }
@@ -6497,7 +6488,7 @@ function setInternalCliOptions(program, options) {
6497
6488
  function getInternalCliOptions(command) {
6498
6489
  let current = command;
6499
6490
  while (current) {
6500
- const record = asRecord5(current[INTERNAL_OPTIONS_KEY]);
6491
+ const record = asRecord4(current[INTERNAL_OPTIONS_KEY]);
6501
6492
  if (record) {
6502
6493
  return {
6503
6494
  enableRetryOnEmptyPhrase: record.enableRetryOnEmptyPhrase === true
@@ -10169,12 +10160,15 @@ function positiveInt2(raw, fallback) {
10169
10160
  function requestTimeoutMs(totalTimeoutMs) {
10170
10161
  return Math.max(1e3, Math.min(totalTimeoutMs, 1e4));
10171
10162
  }
10172
- function asRecord6(value) {
10163
+ function asRecord5(value) {
10173
10164
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
10174
10165
  }
10175
10166
  function asString(value) {
10176
10167
  return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
10177
10168
  }
10169
+ function resolveLoginApiBaseUrl(globals) {
10170
+ return asString(globals.baseUrl) ?? DEFAULT_PRODUCTION_API_BASE_URL;
10171
+ }
10178
10172
  function localUiBaseUrlFor(baseUrl) {
10179
10173
  const parsed = new URL(baseUrl);
10180
10174
  if ((parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") && parsed.port === "3009") {
@@ -10216,9 +10210,9 @@ function cliTokenFromPoll(payload) {
10216
10210
  return asString(payload.cliToken) ?? asString(payload.cli_token) ?? asString(payload.token);
10217
10211
  }
10218
10212
  function unwrapMutationResult(value) {
10219
- const record = asRecord6(value);
10213
+ const record = asRecord5(value);
10220
10214
  if (!record) return null;
10221
- const data = asRecord6(record.data);
10215
+ const data = asRecord5(record.data);
10222
10216
  if (data && (Object.prototype.hasOwnProperty.call(record, "ok") || Object.prototype.hasOwnProperty.call(record, "errors") || Object.prototype.hasOwnProperty.call(record, "errorCode") || Object.prototype.hasOwnProperty.call(record, "error_code"))) {
10223
10217
  return data;
10224
10218
  }
@@ -10237,9 +10231,10 @@ async function authStatusRequest(params) {
10237
10231
  }
10238
10232
  async function runTokenLogin(cmd, opts) {
10239
10233
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10240
- const baseUrl = context.runtimeOptions.baseUrl;
10241
10234
  const globals = cmd.optsWithGlobals();
10242
- const token = typeof opts.token === "string" && opts.token.trim() !== "" ? opts.token.trim() : typeof globals.token === "string" && globals.token.trim() !== "" ? globals.token.trim() : context.runtimeOptions.token;
10235
+ const explicitBaseUrl = asString(globals.baseUrl);
10236
+ const baseUrl = resolveLoginApiBaseUrl(globals);
10237
+ const token = typeof opts.token === "string" && opts.token.trim() !== "" ? opts.token.trim() : typeof globals.token === "string" && globals.token.trim() !== "" ? globals.token.trim() : explicitBaseUrl ? context.runtimeOptions.token : void 0;
10243
10238
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, 1e4);
10244
10239
  if (!baseUrl) {
10245
10240
  return printEnvelopeAndExit({
@@ -10282,7 +10277,7 @@ async function runTokenLogin(cmd, opts) {
10282
10277
  exitCode: mapStatusToExitCode(status.error.status)
10283
10278
  });
10284
10279
  }
10285
- const statusData = asRecord6(status.result.data.cliAuthStatus) ?? {};
10280
+ const statusData = asRecord5(status.result.data.cliAuthStatus) ?? {};
10286
10281
  const storage = await writeStoredToken(token, baseUrl);
10287
10282
  const configPath2 = opts.saveBaseUrl ? await persistBaseUrl(baseUrl) : void 0;
10288
10283
  return printEnvelopeAndExit({
@@ -10304,7 +10299,7 @@ async function runTokenLogin(cmd, opts) {
10304
10299
  }
10305
10300
  async function runBrowserLogin(cmd, opts) {
10306
10301
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10307
- const baseUrl = context.runtimeOptions.baseUrl;
10302
+ const baseUrl = resolveLoginApiBaseUrl(cmd.optsWithGlobals());
10308
10303
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, DEFAULT_LOGIN_TIMEOUT_MS);
10309
10304
  const pollIntervalMs = positiveInt2(opts.pollIntervalMs, DEFAULT_POLL_INTERVAL_MS);
10310
10305
  if (!baseUrl) {
@@ -10499,7 +10494,7 @@ async function runLogout(cmd) {
10499
10494
  });
10500
10495
  if (result.ok) {
10501
10496
  requestId = result.result.requestId;
10502
- const payload = asRecord6(result.result.data.revokeCliToken) ?? {};
10497
+ const payload = asRecord5(result.result.data.revokeCliToken) ?? {};
10503
10498
  revokedRemote = payload.ok !== false;
10504
10499
  } else {
10505
10500
  requestId = result.requestId;
@@ -10562,7 +10557,7 @@ async function runAuthStatus(cmd) {
10562
10557
  exitCode: mapStatusToExitCode(result.error.status)
10563
10558
  });
10564
10559
  }
10565
- const status = asRecord6(result.result.data.cliAuthStatus) ?? {};
10560
+ const status = asRecord5(result.result.data.cliAuthStatus) ?? {};
10566
10561
  const baseAuthStatus = status.baseAuthStatus;
10567
10562
  return printEnvelopeAndExit({
10568
10563
  envelope: envelope({
@@ -12213,11 +12208,11 @@ function sanitizePlannerJson(value) {
12213
12208
  }
12214
12209
  return output;
12215
12210
  }
12216
- function asRecord7(value) {
12211
+ function asRecord6(value) {
12217
12212
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
12218
12213
  }
12219
12214
  function readPlannerStateKey(value, keys) {
12220
- const record = asRecord7(value);
12215
+ const record = asRecord6(value);
12221
12216
  if (!record) {
12222
12217
  return null;
12223
12218
  }
@@ -14786,6 +14781,7 @@ var agentToolAccessSchema = import_zod19.z.array(
14786
14781
  scope_value: nonEmptyStringSchema
14787
14782
  }).strict()
14788
14783
  ).min(1);
14784
+ var agentToolAccessUpdateSchema = agentToolAccessSchema.min(0);
14789
14785
  var agentPluginConnectionsSchema = import_zod19.z.array(
14790
14786
  import_zod19.z.object({
14791
14787
  external_tool_connection_id: nonEmptyStringSchema,
@@ -14797,6 +14793,30 @@ var agentPluginConnectionsSchema = import_zod19.z.array(
14797
14793
  enabled: import_zod19.z.boolean().optional()
14798
14794
  }).strict()
14799
14795
  ).min(1);
14796
+ var agentPluginConnectionUpdateSchema = import_zod19.z.array(
14797
+ import_zod19.z.union([
14798
+ import_zod19.z.object({
14799
+ id: nonEmptyStringSchema,
14800
+ _destroy: import_zod19.z.literal(true)
14801
+ }).strict(),
14802
+ import_zod19.z.object({
14803
+ id: nonEmptyStringSchema.optional(),
14804
+ external_tool_connection_id: nonEmptyStringSchema.optional(),
14805
+ tool_key: nonEmptyStringSchema.optional(),
14806
+ scope_value: nonEmptyStringSchema.optional(),
14807
+ allowed_tools: import_zod19.z.array(nonEmptyStringSchema).optional(),
14808
+ allowed_scopes: import_zod19.z.array(nonEmptyStringSchema).optional(),
14809
+ requires_confirmation: import_zod19.z.boolean().optional(),
14810
+ enabled: import_zod19.z.boolean().optional()
14811
+ }).strict().superRefine((value, context) => {
14812
+ if (value.id || value.external_tool_connection_id && value.tool_key) return;
14813
+ context.addIssue({
14814
+ code: import_zod19.z.ZodIssueCode.custom,
14815
+ message: "Plugin updates require an id, or both external_tool_connection_id and tool_key for a new grant."
14816
+ });
14817
+ })
14818
+ ])
14819
+ );
14800
14820
  var agentTriggerSchema = import_zod19.z.object({
14801
14821
  trigger_type: import_zod19.z.literal("cron"),
14802
14822
  cron_expression: nonEmptyStringSchema,
@@ -14806,6 +14826,14 @@ var agentTriggerSchema = import_zod19.z.object({
14806
14826
  max_runs: import_zod19.z.number().int().positive().nullable().optional(),
14807
14827
  enabled: import_zod19.z.boolean().optional()
14808
14828
  }).strict();
14829
+ var agentTriggerUpdateSchema = import_zod19.z.union([
14830
+ agentTriggerSchema.extend({ id: nonEmptyStringSchema.optional() }).strict(),
14831
+ import_zod19.z.object({
14832
+ id: nonEmptyStringSchema,
14833
+ _destroy: import_zod19.z.literal(true)
14834
+ }).strict()
14835
+ ]);
14836
+ var automationConfigSchema = import_zod19.z.record(import_zod19.z.string(), import_zod19.z.unknown());
14809
14837
  var AGENT_SELECTION = `{
14810
14838
  id
14811
14839
  type
@@ -14856,6 +14884,7 @@ var AGENT_SELECTION = `{
14856
14884
  memberId
14857
14885
  createdAt
14858
14886
  updatedAt
14887
+ updateVersion
14859
14888
  }`;
14860
14889
  var AGENT_PLUGIN_CATALOG_SELECTION = `{
14861
14890
  externalToolConnectionId
@@ -14883,8 +14912,9 @@ var AUTOMATION_SELECTION = `{
14883
14912
  memberId
14884
14913
  createdAt
14885
14914
  updatedAt
14915
+ updateVersion
14886
14916
  }`;
14887
- function asRecord8(value) {
14917
+ function asRecord7(value) {
14888
14918
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
14889
14919
  }
14890
14920
  function asRequiredString(value) {
@@ -14933,12 +14963,12 @@ function parseJsonOption(value, optionName, schema) {
14933
14963
  return schema.parse(parseJson(String(value), optionName));
14934
14964
  }
14935
14965
  function normalizePersistedCreatePayload(payload) {
14936
- const mutation = asRecord8(payload);
14937
- const mutationData = asRecord8(mutation?.data);
14938
- const persisted = asRecord8(mutationData?.data) ?? mutationData;
14939
- const attributes = asRecord8(persisted?.attributes);
14940
- const meta = asRecord8(mutationData?.meta);
14941
- const idempotency = asRecord8(meta?.atlas_idempotency);
14966
+ const mutation = asRecord7(payload);
14967
+ const mutationData = asRecord7(mutation?.data);
14968
+ const persisted = asRecord7(mutationData?.data) ?? mutationData;
14969
+ const attributes = asRecord7(persisted?.attributes);
14970
+ const meta = asRecord7(mutationData?.meta);
14971
+ const idempotency = asRecord7(meta?.atlas_idempotency);
14942
14972
  const id = asRequiredString(persisted?.id);
14943
14973
  const slug = asRequiredString(persisted?.slug) ?? asRequiredString(attributes?.slug);
14944
14974
  const replay = idempotency?.replay;
@@ -14967,6 +14997,36 @@ function normalizePersistedCreatePayload(payload) {
14967
14997
  }
14968
14998
  };
14969
14999
  }
15000
+ function normalizePersistedUpdatePayload(payload) {
15001
+ const mutation = asRecord7(payload);
15002
+ const mutationData = asRecord7(mutation?.data);
15003
+ const persisted = asRecord7(mutationData?.data) ?? mutationData;
15004
+ const attributes = asRecord7(persisted?.attributes);
15005
+ const id = asRequiredString(persisted?.id);
15006
+ const slug = asRequiredString(persisted?.slug) ?? asRequiredString(attributes?.slug);
15007
+ const updateVersion = asRequiredString(persisted?.updateVersion) ?? asRequiredString(attributes?.updateVersion) ?? asRequiredString(attributes?.update_version);
15008
+ if (!mutation || !mutationData || !persisted || !id || !slug || !updateVersion) {
15009
+ throw new CliError({
15010
+ message: "Update response did not include persisted id, slug, and updateVersion.",
15011
+ kind: "malformed_response",
15012
+ status: 502,
15013
+ exitCode: EXIT_CODES.networkOrUpstream
15014
+ });
15015
+ }
15016
+ return {
15017
+ ok: mutation.ok,
15018
+ status: mutation.status,
15019
+ errorCode: mutation.errorCode ?? null,
15020
+ errors: mutation.errors ?? null,
15021
+ persisted: { id, slug, update_version: updateVersion }
15022
+ };
15023
+ }
15024
+ function parseAutomationConfig(value) {
15025
+ return automationConfigSchema.parse(parseJson(String(value), "--ai-task-config"));
15026
+ }
15027
+ function parseExpectedUpdateVersion(value) {
15028
+ return nonEmptyStringSchema.parse(String(value));
15029
+ }
14970
15030
  function registerAtlasAuthoringCommands(program) {
14971
15031
  const agents = program.command("agents").description("Bounded Agent authoring operations");
14972
15032
  agents.command("create").description("Create an Agent through the API-owned createAgent contract").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--name <name>").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--status <status>").option("--visibility <visibility>").option("--model <model>").option("--run-when-mentioned <boolean>", "true or false").option("--web-access-enabled <boolean>", "true or false").option("--web-fetch-enabled <boolean>", "true or false").option("--search-past-conversations-enabled <boolean>", "true or false").option("--app-rules-creation-enabled <boolean>", "true or false").option("--tool-discovery-enabled <boolean>", "true or false").option("--self-updates-enabled <boolean>", "true or false").option("--trusted-urls <urls>", "Comma-separated trusted URLs").option("--tool-access <json>", "JSON array of canonical native Agent tool scopes").option(
@@ -15046,7 +15106,7 @@ function registerAtlasAuthoringCommands(program) {
15046
15106
  transformMutationPayload: normalizePersistedCreatePayload
15047
15107
  });
15048
15108
  });
15049
- agents.command("show").description("Read one persisted Agent by id").requiredOption("--id <id>", "Agent id").action(async (opts, cmd) => {
15109
+ agents.command("show").description("Read one persisted Agent by id or slug").requiredOption("--id <idOrSlug>", "Agent id or slug").action(async (opts, cmd) => {
15050
15110
  const id = idSchema14.parse(opts.id);
15051
15111
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15052
15112
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15061,6 +15121,104 @@ function registerAtlasAuthoringCommands(program) {
15061
15121
  isShow: true
15062
15122
  });
15063
15123
  });
15124
+ agents.command("update").description("Update one persisted Agent through the API-owned updateAgent contract").requiredOption("--id <idOrSlug>", "Agent id or slug").requiredOption(
15125
+ "--expected-update-version <version>",
15126
+ "Exact opaque updateVersion value from agents show; rejects stale writes"
15127
+ ).option("--name <name>").option("--description <description>").option("--notes <notes>").option("--status <status>").option("--visibility <visibility>").option("--model <model>").option("--run-when-mentioned <boolean>", "true or false").option("--web-access-enabled <boolean>", "true or false").option("--web-fetch-enabled <boolean>", "true or false").option("--search-past-conversations-enabled <boolean>", "true or false").option("--app-rules-creation-enabled <boolean>", "true or false").option("--tool-discovery-enabled <boolean>", "true or false").option("--self-updates-enabled <boolean>", "true or false").option("--trusted-urls <urls>", "Comma-separated trusted URLs").option("--clear-trusted-urls", "Clear all trusted URLs").option("--tool-access <json>", "JSON array of the complete canonical native Agent tool scopes").option(
15128
+ "--plugin-connections <json>",
15129
+ "JSON array of Agent connector grant patches; removals require id and _destroy:true"
15130
+ ).option(
15131
+ "--trigger <json>",
15132
+ "Canonical Agent trigger patch; use the trigger id from agents show to replace or remove it"
15133
+ ).action(async (opts, cmd) => {
15134
+ if (opts.clearTrustedUrls && opts.trustedUrls !== void 0) {
15135
+ throw new CliError({
15136
+ message: "Use either --trusted-urls or --clear-trusted-urls, not both.",
15137
+ kind: "invalid_args",
15138
+ status: 400,
15139
+ exitCode: EXIT_CODES.invalidArgs
15140
+ });
15141
+ }
15142
+ const runWhenMentioned = parseBooleanOption(opts.runWhenMentioned, "--run-when-mentioned");
15143
+ const webAccessEnabled = parseBooleanOption(opts.webAccessEnabled, "--web-access-enabled");
15144
+ const webFetchEnabled = parseBooleanOption(opts.webFetchEnabled, "--web-fetch-enabled");
15145
+ const searchPastConversationsEnabled = parseBooleanOption(
15146
+ opts.searchPastConversationsEnabled,
15147
+ "--search-past-conversations-enabled"
15148
+ );
15149
+ const appRulesCreationEnabled = parseBooleanOption(
15150
+ opts.appRulesCreationEnabled,
15151
+ "--app-rules-creation-enabled"
15152
+ );
15153
+ const toolDiscoveryEnabled = parseBooleanOption(
15154
+ opts.toolDiscoveryEnabled,
15155
+ "--tool-discovery-enabled"
15156
+ );
15157
+ const selfUpdatesEnabled = parseBooleanOption(opts.selfUpdatesEnabled, "--self-updates-enabled");
15158
+ const trustedUrls = parseCommaSeparatedStrings(opts.trustedUrls);
15159
+ const toolAccess = parseJsonOption(
15160
+ opts.toolAccess,
15161
+ "--tool-access",
15162
+ agentToolAccessUpdateSchema
15163
+ );
15164
+ const pluginConnections = parseJsonOption(
15165
+ opts.pluginConnections,
15166
+ "--plugin-connections",
15167
+ agentPluginConnectionUpdateSchema
15168
+ );
15169
+ const trigger = parseJsonOption(opts.trigger, "--trigger", agentTriggerUpdateSchema);
15170
+ const patch = {
15171
+ ...opts.name !== void 0 ? { name: String(opts.name) } : {},
15172
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15173
+ ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15174
+ ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15175
+ ...opts.visibility !== void 0 ? { visibility: String(opts.visibility) } : {},
15176
+ ...opts.model !== void 0 ? { model: String(opts.model) } : {},
15177
+ ...runWhenMentioned !== void 0 ? { run_when_mentioned: runWhenMentioned } : {},
15178
+ ...webAccessEnabled !== void 0 ? { web_access_enabled: webAccessEnabled } : {},
15179
+ ...webFetchEnabled !== void 0 ? { web_fetch_enabled: webFetchEnabled } : {},
15180
+ ...searchPastConversationsEnabled !== void 0 ? { search_past_conversations_enabled: searchPastConversationsEnabled } : {},
15181
+ ...appRulesCreationEnabled !== void 0 ? { app_rules_creation_enabled: appRulesCreationEnabled } : {},
15182
+ ...toolDiscoveryEnabled !== void 0 ? { tool_discovery_enabled: toolDiscoveryEnabled } : {},
15183
+ ...selfUpdatesEnabled !== void 0 ? { self_updates_enabled: selfUpdatesEnabled } : {},
15184
+ ...trustedUrls !== void 0 ? { trusted_urls: trustedUrls } : {},
15185
+ ...opts.clearTrustedUrls ? { trusted_urls: [] } : {},
15186
+ ...toolAccess !== void 0 ? { tool_access: toolAccess } : {},
15187
+ ...pluginConnections !== void 0 ? { agent_tool_connections_attributes: pluginConnections } : {},
15188
+ ...trigger !== void 0 ? { trigger_attributes: trigger } : {}
15189
+ };
15190
+ if (Object.keys(patch).length === 0) {
15191
+ throw new CliError({
15192
+ message: "agents update requires at least one mutable Agent field.",
15193
+ kind: "invalid_args",
15194
+ status: 400,
15195
+ exitCode: EXIT_CODES.invalidArgs
15196
+ });
15197
+ }
15198
+ const id = idSchema14.parse(opts.id);
15199
+ const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
15200
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15201
+ const organizationId = resolveOrganizationId(context.organizationId);
15202
+ await runGraphqlMutationCommand({
15203
+ command: "agents.update",
15204
+ operationName: "AgentsUpdate",
15205
+ runtimeOptions: context.runtimeOptions,
15206
+ field: "update_agent",
15207
+ variableTypes: {
15208
+ organization_id: "ID!",
15209
+ agent_id: "ID!",
15210
+ params: "UpdateAgentParamsInput!",
15211
+ expected_update_version: "String!"
15212
+ },
15213
+ variables: {
15214
+ organization_id: organizationId,
15215
+ agent_id: id,
15216
+ params: { agent: patch },
15217
+ expected_update_version: expectedUpdateVersion
15218
+ },
15219
+ transformMutationPayload: normalizePersistedUpdatePayload
15220
+ });
15221
+ });
15064
15222
  agents.command("plugin-catalog").description("Read connected Agent plugin capabilities for one supported service").requiredOption(
15065
15223
  "--service <service>",
15066
15224
  "Supported service: gmail, calendar, slack, or stripe"
@@ -15079,7 +15237,7 @@ function registerAtlasAuthoringCommands(program) {
15079
15237
  });
15080
15238
  });
15081
15239
  const automations = program.command("automations").description("Bounded Automation authoring operations");
15082
- automations.command("create").description("Create an Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15240
+ automations.command("create").description("Create a Backlog Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15083
15241
  const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
15084
15242
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15085
15243
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15102,7 +15260,6 @@ function registerAtlasAuthoringCommands(program) {
15102
15260
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15103
15261
  ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
15104
15262
  ...opts.agentId !== void 0 ? { agentId: idSchema14.parse(opts.agentId) } : {},
15105
- ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15106
15263
  ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15107
15264
  ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {}
15108
15265
  },
@@ -15111,7 +15268,7 @@ function registerAtlasAuthoringCommands(program) {
15111
15268
  transformMutationPayload: normalizePersistedCreatePayload
15112
15269
  });
15113
15270
  });
15114
- automations.command("show").description("Read one persisted Automation by id").requiredOption("--id <id>", "Automation id").action(async (opts, cmd) => {
15271
+ automations.command("show").description("Read one persisted Automation by id or slug").requiredOption("--id <idOrSlug>", "Automation id or slug").action(async (opts, cmd) => {
15115
15272
  const id = idSchema14.parse(opts.id);
15116
15273
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15117
15274
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15126,6 +15283,65 @@ function registerAtlasAuthoringCommands(program) {
15126
15283
  isShow: true
15127
15284
  });
15128
15285
  });
15286
+ automations.command("update").description("Update one task-backed Automation without changing its system-managed status").requiredOption("--id <idOrSlug>", "Automation id or slug").requiredOption(
15287
+ "--expected-update-version <version>",
15288
+ "Exact opaque updateVersion value from automations show; rejects stale writes"
15289
+ ).option("--summary <summary>").option("--description <description>").option("--notes <notes>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").option("--ai-task-config <json>", "Complete replacement ai_task_config JSON object").option(
15290
+ "--agent-id <agentId>",
15291
+ "Executor Agent id; requires --ai-task-config and is stored in that config"
15292
+ ).action(async (opts, cmd) => {
15293
+ if (opts.agentId !== void 0 && opts.aiTaskConfig === void 0) {
15294
+ throw new CliError({
15295
+ message: "automations update requires --ai-task-config whenever --agent-id is supplied.",
15296
+ kind: "invalid_args",
15297
+ status: 400,
15298
+ exitCode: EXIT_CODES.invalidArgs
15299
+ });
15300
+ }
15301
+ const aiTaskConfig = opts.aiTaskConfig === void 0 ? void 0 : {
15302
+ ...parseAutomationConfig(opts.aiTaskConfig),
15303
+ ...opts.agentId !== void 0 ? { agent_id: idSchema14.parse(opts.agentId) } : {}
15304
+ };
15305
+ const patch = {
15306
+ ...opts.summary !== void 0 ? { summary: String(opts.summary) } : {},
15307
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15308
+ ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15309
+ ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15310
+ ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {},
15311
+ ...aiTaskConfig !== void 0 ? { ai_task_config: aiTaskConfig } : {}
15312
+ };
15313
+ if (Object.keys(patch).length === 0) {
15314
+ throw new CliError({
15315
+ message: "automations update requires at least one mutable Automation field.",
15316
+ kind: "invalid_args",
15317
+ status: 400,
15318
+ exitCode: EXIT_CODES.invalidArgs
15319
+ });
15320
+ }
15321
+ const id = idSchema14.parse(opts.id);
15322
+ const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
15323
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15324
+ const organizationId = resolveOrganizationId(context.organizationId);
15325
+ await runGraphqlMutationCommand({
15326
+ command: "automations.update",
15327
+ operationName: "AutomationsUpdate",
15328
+ runtimeOptions: context.runtimeOptions,
15329
+ field: "update_task",
15330
+ variableTypes: {
15331
+ organization_id: "ID!",
15332
+ task_id: "ID!",
15333
+ params: "UpdateTaskParamsInput!",
15334
+ expected_update_version: "String!"
15335
+ },
15336
+ variables: {
15337
+ organization_id: organizationId,
15338
+ task_id: id,
15339
+ params: { task: patch },
15340
+ expected_update_version: expectedUpdateVersion
15341
+ },
15342
+ transformMutationPayload: normalizePersistedUpdatePayload
15343
+ });
15344
+ });
15129
15345
  const skills = program.commands.find((command) => command.name() === "skills");
15130
15346
  if (!skills) {
15131
15347
  throw new Error("Skills command must be registered before Atlas authoring commands.");
@@ -15157,6 +15373,47 @@ function registerAtlasAuthoringCommands(program) {
15157
15373
  transformMutationPayload: normalizePersistedCreatePayload
15158
15374
  });
15159
15375
  });
15376
+ skills.command("update").description("Update one persisted Skill through the API-owned updateSkill contract").requiredOption("--id <idOrSlug>", "Skill id or slug").requiredOption(
15377
+ "--expected-update-version <version>",
15378
+ "Exact opaque updateVersion value from skills show; rejects stale writes"
15379
+ ).option("--name <name>").option("--emoji <emoji>").option("--description <description>").action(async (opts, cmd) => {
15380
+ const patch = {
15381
+ ...opts.name !== void 0 ? { name: String(opts.name) } : {},
15382
+ ...opts.emoji !== void 0 ? { emoji: String(opts.emoji) } : {},
15383
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {}
15384
+ };
15385
+ if (Object.keys(patch).length === 0) {
15386
+ throw new CliError({
15387
+ message: "skills update requires at least one mutable Skill field.",
15388
+ kind: "invalid_args",
15389
+ status: 400,
15390
+ exitCode: EXIT_CODES.invalidArgs
15391
+ });
15392
+ }
15393
+ const id = idSchema14.parse(opts.id);
15394
+ const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
15395
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15396
+ const organizationId = resolveOrganizationId(context.organizationId);
15397
+ await runGraphqlMutationCommand({
15398
+ command: "skills.update",
15399
+ operationName: "SkillsUpdate",
15400
+ runtimeOptions: context.runtimeOptions,
15401
+ field: "update_skill",
15402
+ variableTypes: {
15403
+ organization_id: "ID!",
15404
+ id: "ID!",
15405
+ input: "UpdateSkillInput!",
15406
+ expected_update_version: "String!"
15407
+ },
15408
+ variables: {
15409
+ organization_id: organizationId,
15410
+ id,
15411
+ input: patch,
15412
+ expected_update_version: expectedUpdateVersion
15413
+ },
15414
+ transformMutationPayload: normalizePersistedUpdatePayload
15415
+ });
15416
+ });
15160
15417
  }
15161
15418
 
15162
15419
  // src/commands/discovery.ts
@@ -15167,7 +15424,7 @@ var import_node_path4 = require("path");
15167
15424
  var import_node_crypto3 = require("crypto");
15168
15425
 
15169
15426
  // src/version.ts
15170
- var CLI_VERSION = "0.1.71";
15427
+ var CLI_VERSION = "0.1.73";
15171
15428
 
15172
15429
  // src/operationMetadata.ts
15173
15430
  var DISCOVERY_OPERATION_IDS = [
@@ -15480,7 +15737,9 @@ var WRITE_OPERATION_IDS = [
15480
15737
  "accountability.create",
15481
15738
  "accountability.update",
15482
15739
  "agents.create",
15740
+ "agents.update",
15483
15741
  "automations.create",
15742
+ "automations.update",
15484
15743
  "contacts.create",
15485
15744
  "contacts.update",
15486
15745
  "content.create-contact",
@@ -15586,6 +15845,7 @@ var WRITE_OPERATION_IDS = [
15586
15845
  "scorecards.create",
15587
15846
  "scorecards.update",
15588
15847
  "skills.create",
15848
+ "skills.update",
15589
15849
  "smart-kpi-views.create",
15590
15850
  "stand-ups.create",
15591
15851
  "stand-ups.update",
@@ -15937,12 +16197,13 @@ var NAMESPACE_DOCS = {
15937
16197
  skills: {
15938
16198
  name: "skills",
15939
16199
  tier: "primary",
15940
- description: "Skill record readback and bounded create operations.",
16200
+ description: "Skill record readback and bounded create/update operations.",
15941
16201
  examples: [
15942
16202
  "wave skills list --json",
15943
16203
  "wave skills list --scope ADMIN_GLOBAL --json",
15944
16204
  "wave skills show --id 123 --json",
15945
- 'wave skills create --name "Weekly planning" --scope MEMBER_PERSONAL --idempotency-key skill-create-001'
16205
+ 'wave skills create --name "Weekly planning" --scope MEMBER_PERSONAL --idempotency-key skill-create-001',
16206
+ 'wave skills update --id SKL-01 --expected-update-version 2026-07-17T12:00:00.123456Z --description "Review my projects."'
15946
16207
  ],
15947
16208
  schema: {
15948
16209
  output: "json-envelope-default",
@@ -15950,20 +16211,22 @@ var NAMESPACE_DOCS = {
15950
16211
  safety: [
15951
16212
  "Uses API-owned Skill GraphQL read fields only.",
15952
16213
  "Create calls only createSkill with an explicit idempotency key.",
16214
+ "Update calls only updateSkill with an exact opaque updateVersion token and does not change scope or ownership.",
15953
16215
  "Skill create supports the API-defined ADMIN_GLOBAL and MEMBER_PERSONAL scopes.",
15954
16216
  "Does not update, destroy, archive, approve, or apply Skill records."
15955
16217
  ],
15956
- commands: ["list", "show", "create"]
16218
+ commands: ["list", "show", "create", "update"]
15957
16219
  }
15958
16220
  },
15959
16221
  agents: {
15960
16222
  name: "agents",
15961
16223
  tier: "primary",
15962
- description: "Bounded Agent create and persisted readback operations.",
16224
+ description: "Bounded Agent create, readback, and stale-write-protected update operations.",
15963
16225
  examples: [
15964
16226
  'wave agents create --name "Planning helper" --idempotency-key agent-create-001',
15965
16227
  `wave agents create --name "Project summary" --notes "Summarize my projects." --tool-access '[{"tool_key":"projects","scope_value":"all"}]' --trigger '{"trigger_type":"cron","cron_expression":"0 14 * * 2","timezone":"America/Phoenix","enabled":true}' --idempotency-key agent-create-002`,
15966
- "wave agents show --id 123"
16228
+ "wave agents show --id AGT-01",
16229
+ 'wave agents update --id AGT-01 --expected-update-version 2026-07-17T12:00:00.123456Z --notes "Summarize my projects."'
15967
16230
  ],
15968
16231
  schema: {
15969
16232
  output: "json-envelope-default",
@@ -15971,32 +16234,36 @@ var NAMESPACE_DOCS = {
15971
16234
  safety: [
15972
16235
  "Create calls only createAgent with an explicit idempotency key.",
15973
16236
  "Create preserves API-owned defaults by sending only supplied typed Agent fields.",
16237
+ "Update calls only updateAgent with an exact opaque updateVersion token and cannot change ownership.",
15974
16238
  "Native tools, plugin connector grants, and the cron trigger use strict canonical JSON shapes.",
15975
16239
  "Outlook Calendar and Outlook Mail are not supported Agent plugin families in this release.",
15976
16240
  "Show uses the API-owned agent query by id; no slug fallback is implemented."
15977
16241
  ],
15978
- commands: ["create", "show"]
16242
+ commands: ["create", "show", "update"]
15979
16243
  }
15980
16244
  },
15981
16245
  automations: {
15982
16246
  name: "automations",
15983
16247
  tier: "primary",
15984
- description: "Bounded Automation create and persisted readback operations.",
16248
+ description: "Bounded task-backed Automation create, readback, and stale-write-protected update operations.",
15985
16249
  examples: [
15986
16250
  `wave automations create --summary "Weekly review" --agent-id 123 --ai-task-config '{"cycle":"repeat","repeatSchedule":{"interval":1,"frequency":"week","weekdays":[1,3],"at":"2:30 PM","starting":"2026-07-20T00:00:00.000Z","ending":"never","endingRuns":1,"endingDate":null,"timezone":"America/Phoenix"}}' --idempotency-key automation-create-001`,
15987
- "wave automations show --id 123"
16251
+ "wave automations show --id ATK-01",
16252
+ 'wave automations update --id ATK-01 --expected-update-version 2026-07-17T12:00:00.123456Z --summary "Weekly project review"'
15988
16253
  ],
15989
16254
  schema: {
15990
16255
  output: "json-envelope-default",
15991
16256
  mutates: true,
15992
16257
  safety: [
15993
16258
  "Create calls only createAutomation with an explicit idempotency key.",
16259
+ "Create always leaves status to the API, which starts Automations in Backlog.",
15994
16260
  "Only the API-defined ai_task_config field accepts validated JSON.",
15995
16261
  "Optional executor Agent linkage is sent only through the API-defined top-level agentId input.",
16262
+ "Update calls only updateTask with an exact opaque updateVersion token; it cannot change status, task type, ownership, or project linkage.",
15996
16263
  "Does not create a project Task, run an Automation, or invoke AI OS actions.",
15997
16264
  "Show uses the API-owned automation query by id; no slug fallback is implemented."
15998
16265
  ],
15999
- commands: ["create", "show"]
16266
+ commands: ["create", "show", "update"]
16000
16267
  }
16001
16268
  },
16002
16269
  broadcast: {
package/dist/index.js CHANGED
@@ -4198,18 +4198,8 @@ var SKILL_SELECTION = `{
4198
4198
  }
4199
4199
  createdAt
4200
4200
  updatedAt
4201
+ updateVersion
4201
4202
  }`;
4202
- function asRecord4(value) {
4203
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
4204
- }
4205
- function findSkillById(id) {
4206
- return (payload) => {
4207
- if (!Array.isArray(payload)) {
4208
- return null;
4209
- }
4210
- return payload.find((entry2) => String(asRecord4(entry2)?.id ?? "") === id) ?? null;
4211
- };
4212
- }
4213
4203
  function registerSkillCommands(program) {
4214
4204
  const skills = program.command("skills").description("Skill record operations");
4215
4205
  skills.command("list").description("List Skill records").option("--scope <scope>", "Filter skills by scope").option("--query <query>", "Filter skills by search query").option("--limit <limit>", "Limit skills returned").requiredOption("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
@@ -4237,7 +4227,7 @@ function registerSkillCommands(program) {
4237
4227
  isList: true
4238
4228
  });
4239
4229
  });
4240
- skills.command("show").description("Read one persisted Skill record by id").requiredOption("--id <id>", "Skill id").requiredOption("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
4230
+ skills.command("show").description("Read one persisted Skill record by id or slug").requiredOption("--id <idOrSlug>", "Skill id or slug").option("--json", "Emit the stable JSON envelope").action(async (opts, cmd) => {
4241
4231
  const id = idSchema7.parse(opts.id);
4242
4232
  const context = await resolveCommandContext(cmd.optsWithGlobals());
4243
4233
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -4245,16 +4235,17 @@ function registerSkillCommands(program) {
4245
4235
  command: "skills.show",
4246
4236
  operationName: "SkillsShow",
4247
4237
  runtimeOptions: context.runtimeOptions,
4248
- field: "skills",
4238
+ field: "skill",
4249
4239
  variables: {
4250
- organization_id: organizationId
4240
+ organization_id: organizationId,
4241
+ id
4251
4242
  },
4252
4243
  variableTypes: {
4253
- organization_id: "ID!"
4244
+ organization_id: "ID!",
4245
+ id: "ID!"
4254
4246
  },
4255
4247
  selectionSet: SKILL_SELECTION,
4256
- isShow: true,
4257
- transformData: findSkillById(id)
4248
+ isShow: true
4258
4249
  });
4259
4250
  });
4260
4251
  }
@@ -6482,7 +6473,7 @@ import { z as z16 } from "zod";
6482
6473
 
6483
6474
  // src/internalOptions.ts
6484
6475
  var INTERNAL_OPTIONS_KEY = "__waveInternalOptions";
6485
- function asRecord5(value) {
6476
+ function asRecord4(value) {
6486
6477
  if (!value || typeof value !== "object" || Array.isArray(value)) {
6487
6478
  return null;
6488
6479
  }
@@ -6496,7 +6487,7 @@ function setInternalCliOptions(program, options) {
6496
6487
  function getInternalCliOptions(command) {
6497
6488
  let current = command;
6498
6489
  while (current) {
6499
- const record = asRecord5(current[INTERNAL_OPTIONS_KEY]);
6490
+ const record = asRecord4(current[INTERNAL_OPTIONS_KEY]);
6500
6491
  if (record) {
6501
6492
  return {
6502
6493
  enableRetryOnEmptyPhrase: record.enableRetryOnEmptyPhrase === true
@@ -10168,12 +10159,15 @@ function positiveInt2(raw, fallback) {
10168
10159
  function requestTimeoutMs(totalTimeoutMs) {
10169
10160
  return Math.max(1e3, Math.min(totalTimeoutMs, 1e4));
10170
10161
  }
10171
- function asRecord6(value) {
10162
+ function asRecord5(value) {
10172
10163
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
10173
10164
  }
10174
10165
  function asString(value) {
10175
10166
  return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
10176
10167
  }
10168
+ function resolveLoginApiBaseUrl(globals) {
10169
+ return asString(globals.baseUrl) ?? DEFAULT_PRODUCTION_API_BASE_URL;
10170
+ }
10177
10171
  function localUiBaseUrlFor(baseUrl) {
10178
10172
  const parsed = new URL(baseUrl);
10179
10173
  if ((parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") && parsed.port === "3009") {
@@ -10215,9 +10209,9 @@ function cliTokenFromPoll(payload) {
10215
10209
  return asString(payload.cliToken) ?? asString(payload.cli_token) ?? asString(payload.token);
10216
10210
  }
10217
10211
  function unwrapMutationResult(value) {
10218
- const record = asRecord6(value);
10212
+ const record = asRecord5(value);
10219
10213
  if (!record) return null;
10220
- const data = asRecord6(record.data);
10214
+ const data = asRecord5(record.data);
10221
10215
  if (data && (Object.prototype.hasOwnProperty.call(record, "ok") || Object.prototype.hasOwnProperty.call(record, "errors") || Object.prototype.hasOwnProperty.call(record, "errorCode") || Object.prototype.hasOwnProperty.call(record, "error_code"))) {
10222
10216
  return data;
10223
10217
  }
@@ -10236,9 +10230,10 @@ async function authStatusRequest(params) {
10236
10230
  }
10237
10231
  async function runTokenLogin(cmd, opts) {
10238
10232
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10239
- const baseUrl = context.runtimeOptions.baseUrl;
10240
10233
  const globals = cmd.optsWithGlobals();
10241
- const token = typeof opts.token === "string" && opts.token.trim() !== "" ? opts.token.trim() : typeof globals.token === "string" && globals.token.trim() !== "" ? globals.token.trim() : context.runtimeOptions.token;
10234
+ const explicitBaseUrl = asString(globals.baseUrl);
10235
+ const baseUrl = resolveLoginApiBaseUrl(globals);
10236
+ const token = typeof opts.token === "string" && opts.token.trim() !== "" ? opts.token.trim() : typeof globals.token === "string" && globals.token.trim() !== "" ? globals.token.trim() : explicitBaseUrl ? context.runtimeOptions.token : void 0;
10242
10237
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, 1e4);
10243
10238
  if (!baseUrl) {
10244
10239
  return printEnvelopeAndExit({
@@ -10281,7 +10276,7 @@ async function runTokenLogin(cmd, opts) {
10281
10276
  exitCode: mapStatusToExitCode(status.error.status)
10282
10277
  });
10283
10278
  }
10284
- const statusData = asRecord6(status.result.data.cliAuthStatus) ?? {};
10279
+ const statusData = asRecord5(status.result.data.cliAuthStatus) ?? {};
10285
10280
  const storage = await writeStoredToken(token, baseUrl);
10286
10281
  const configPath2 = opts.saveBaseUrl ? await persistBaseUrl(baseUrl) : void 0;
10287
10282
  return printEnvelopeAndExit({
@@ -10303,7 +10298,7 @@ async function runTokenLogin(cmd, opts) {
10303
10298
  }
10304
10299
  async function runBrowserLogin(cmd, opts) {
10305
10300
  const context = await resolveUnscopedCommandContext(cmd.optsWithGlobals());
10306
- const baseUrl = context.runtimeOptions.baseUrl;
10301
+ const baseUrl = resolveLoginApiBaseUrl(cmd.optsWithGlobals());
10307
10302
  const timeoutMs = positiveInt2(opts.timeoutMs ?? context.runtimeOptions.timeoutMs, DEFAULT_LOGIN_TIMEOUT_MS);
10308
10303
  const pollIntervalMs = positiveInt2(opts.pollIntervalMs, DEFAULT_POLL_INTERVAL_MS);
10309
10304
  if (!baseUrl) {
@@ -10498,7 +10493,7 @@ async function runLogout(cmd) {
10498
10493
  });
10499
10494
  if (result.ok) {
10500
10495
  requestId = result.result.requestId;
10501
- const payload = asRecord6(result.result.data.revokeCliToken) ?? {};
10496
+ const payload = asRecord5(result.result.data.revokeCliToken) ?? {};
10502
10497
  revokedRemote = payload.ok !== false;
10503
10498
  } else {
10504
10499
  requestId = result.requestId;
@@ -10561,7 +10556,7 @@ async function runAuthStatus(cmd) {
10561
10556
  exitCode: mapStatusToExitCode(result.error.status)
10562
10557
  });
10563
10558
  }
10564
- const status = asRecord6(result.result.data.cliAuthStatus) ?? {};
10559
+ const status = asRecord5(result.result.data.cliAuthStatus) ?? {};
10565
10560
  const baseAuthStatus = status.baseAuthStatus;
10566
10561
  return printEnvelopeAndExit({
10567
10562
  envelope: envelope({
@@ -12212,11 +12207,11 @@ function sanitizePlannerJson(value) {
12212
12207
  }
12213
12208
  return output;
12214
12209
  }
12215
- function asRecord7(value) {
12210
+ function asRecord6(value) {
12216
12211
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
12217
12212
  }
12218
12213
  function readPlannerStateKey(value, keys) {
12219
- const record = asRecord7(value);
12214
+ const record = asRecord6(value);
12220
12215
  if (!record) {
12221
12216
  return null;
12222
12217
  }
@@ -14785,6 +14780,7 @@ var agentToolAccessSchema = z19.array(
14785
14780
  scope_value: nonEmptyStringSchema
14786
14781
  }).strict()
14787
14782
  ).min(1);
14783
+ var agentToolAccessUpdateSchema = agentToolAccessSchema.min(0);
14788
14784
  var agentPluginConnectionsSchema = z19.array(
14789
14785
  z19.object({
14790
14786
  external_tool_connection_id: nonEmptyStringSchema,
@@ -14796,6 +14792,30 @@ var agentPluginConnectionsSchema = z19.array(
14796
14792
  enabled: z19.boolean().optional()
14797
14793
  }).strict()
14798
14794
  ).min(1);
14795
+ var agentPluginConnectionUpdateSchema = z19.array(
14796
+ z19.union([
14797
+ z19.object({
14798
+ id: nonEmptyStringSchema,
14799
+ _destroy: z19.literal(true)
14800
+ }).strict(),
14801
+ z19.object({
14802
+ id: nonEmptyStringSchema.optional(),
14803
+ external_tool_connection_id: nonEmptyStringSchema.optional(),
14804
+ tool_key: nonEmptyStringSchema.optional(),
14805
+ scope_value: nonEmptyStringSchema.optional(),
14806
+ allowed_tools: z19.array(nonEmptyStringSchema).optional(),
14807
+ allowed_scopes: z19.array(nonEmptyStringSchema).optional(),
14808
+ requires_confirmation: z19.boolean().optional(),
14809
+ enabled: z19.boolean().optional()
14810
+ }).strict().superRefine((value, context) => {
14811
+ if (value.id || value.external_tool_connection_id && value.tool_key) return;
14812
+ context.addIssue({
14813
+ code: z19.ZodIssueCode.custom,
14814
+ message: "Plugin updates require an id, or both external_tool_connection_id and tool_key for a new grant."
14815
+ });
14816
+ })
14817
+ ])
14818
+ );
14799
14819
  var agentTriggerSchema = z19.object({
14800
14820
  trigger_type: z19.literal("cron"),
14801
14821
  cron_expression: nonEmptyStringSchema,
@@ -14805,6 +14825,14 @@ var agentTriggerSchema = z19.object({
14805
14825
  max_runs: z19.number().int().positive().nullable().optional(),
14806
14826
  enabled: z19.boolean().optional()
14807
14827
  }).strict();
14828
+ var agentTriggerUpdateSchema = z19.union([
14829
+ agentTriggerSchema.extend({ id: nonEmptyStringSchema.optional() }).strict(),
14830
+ z19.object({
14831
+ id: nonEmptyStringSchema,
14832
+ _destroy: z19.literal(true)
14833
+ }).strict()
14834
+ ]);
14835
+ var automationConfigSchema = z19.record(z19.string(), z19.unknown());
14808
14836
  var AGENT_SELECTION = `{
14809
14837
  id
14810
14838
  type
@@ -14855,6 +14883,7 @@ var AGENT_SELECTION = `{
14855
14883
  memberId
14856
14884
  createdAt
14857
14885
  updatedAt
14886
+ updateVersion
14858
14887
  }`;
14859
14888
  var AGENT_PLUGIN_CATALOG_SELECTION = `{
14860
14889
  externalToolConnectionId
@@ -14882,8 +14911,9 @@ var AUTOMATION_SELECTION = `{
14882
14911
  memberId
14883
14912
  createdAt
14884
14913
  updatedAt
14914
+ updateVersion
14885
14915
  }`;
14886
- function asRecord8(value) {
14916
+ function asRecord7(value) {
14887
14917
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
14888
14918
  }
14889
14919
  function asRequiredString(value) {
@@ -14932,12 +14962,12 @@ function parseJsonOption(value, optionName, schema) {
14932
14962
  return schema.parse(parseJson(String(value), optionName));
14933
14963
  }
14934
14964
  function normalizePersistedCreatePayload(payload) {
14935
- const mutation = asRecord8(payload);
14936
- const mutationData = asRecord8(mutation?.data);
14937
- const persisted = asRecord8(mutationData?.data) ?? mutationData;
14938
- const attributes = asRecord8(persisted?.attributes);
14939
- const meta = asRecord8(mutationData?.meta);
14940
- const idempotency = asRecord8(meta?.atlas_idempotency);
14965
+ const mutation = asRecord7(payload);
14966
+ const mutationData = asRecord7(mutation?.data);
14967
+ const persisted = asRecord7(mutationData?.data) ?? mutationData;
14968
+ const attributes = asRecord7(persisted?.attributes);
14969
+ const meta = asRecord7(mutationData?.meta);
14970
+ const idempotency = asRecord7(meta?.atlas_idempotency);
14941
14971
  const id = asRequiredString(persisted?.id);
14942
14972
  const slug = asRequiredString(persisted?.slug) ?? asRequiredString(attributes?.slug);
14943
14973
  const replay = idempotency?.replay;
@@ -14966,6 +14996,36 @@ function normalizePersistedCreatePayload(payload) {
14966
14996
  }
14967
14997
  };
14968
14998
  }
14999
+ function normalizePersistedUpdatePayload(payload) {
15000
+ const mutation = asRecord7(payload);
15001
+ const mutationData = asRecord7(mutation?.data);
15002
+ const persisted = asRecord7(mutationData?.data) ?? mutationData;
15003
+ const attributes = asRecord7(persisted?.attributes);
15004
+ const id = asRequiredString(persisted?.id);
15005
+ const slug = asRequiredString(persisted?.slug) ?? asRequiredString(attributes?.slug);
15006
+ const updateVersion = asRequiredString(persisted?.updateVersion) ?? asRequiredString(attributes?.updateVersion) ?? asRequiredString(attributes?.update_version);
15007
+ if (!mutation || !mutationData || !persisted || !id || !slug || !updateVersion) {
15008
+ throw new CliError({
15009
+ message: "Update response did not include persisted id, slug, and updateVersion.",
15010
+ kind: "malformed_response",
15011
+ status: 502,
15012
+ exitCode: EXIT_CODES.networkOrUpstream
15013
+ });
15014
+ }
15015
+ return {
15016
+ ok: mutation.ok,
15017
+ status: mutation.status,
15018
+ errorCode: mutation.errorCode ?? null,
15019
+ errors: mutation.errors ?? null,
15020
+ persisted: { id, slug, update_version: updateVersion }
15021
+ };
15022
+ }
15023
+ function parseAutomationConfig(value) {
15024
+ return automationConfigSchema.parse(parseJson(String(value), "--ai-task-config"));
15025
+ }
15026
+ function parseExpectedUpdateVersion(value) {
15027
+ return nonEmptyStringSchema.parse(String(value));
15028
+ }
14969
15029
  function registerAtlasAuthoringCommands(program) {
14970
15030
  const agents = program.command("agents").description("Bounded Agent authoring operations");
14971
15031
  agents.command("create").description("Create an Agent through the API-owned createAgent contract").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--name <name>").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--status <status>").option("--visibility <visibility>").option("--model <model>").option("--run-when-mentioned <boolean>", "true or false").option("--web-access-enabled <boolean>", "true or false").option("--web-fetch-enabled <boolean>", "true or false").option("--search-past-conversations-enabled <boolean>", "true or false").option("--app-rules-creation-enabled <boolean>", "true or false").option("--tool-discovery-enabled <boolean>", "true or false").option("--self-updates-enabled <boolean>", "true or false").option("--trusted-urls <urls>", "Comma-separated trusted URLs").option("--tool-access <json>", "JSON array of canonical native Agent tool scopes").option(
@@ -15045,7 +15105,7 @@ function registerAtlasAuthoringCommands(program) {
15045
15105
  transformMutationPayload: normalizePersistedCreatePayload
15046
15106
  });
15047
15107
  });
15048
- agents.command("show").description("Read one persisted Agent by id").requiredOption("--id <id>", "Agent id").action(async (opts, cmd) => {
15108
+ agents.command("show").description("Read one persisted Agent by id or slug").requiredOption("--id <idOrSlug>", "Agent id or slug").action(async (opts, cmd) => {
15049
15109
  const id = idSchema14.parse(opts.id);
15050
15110
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15051
15111
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15060,6 +15120,104 @@ function registerAtlasAuthoringCommands(program) {
15060
15120
  isShow: true
15061
15121
  });
15062
15122
  });
15123
+ agents.command("update").description("Update one persisted Agent through the API-owned updateAgent contract").requiredOption("--id <idOrSlug>", "Agent id or slug").requiredOption(
15124
+ "--expected-update-version <version>",
15125
+ "Exact opaque updateVersion value from agents show; rejects stale writes"
15126
+ ).option("--name <name>").option("--description <description>").option("--notes <notes>").option("--status <status>").option("--visibility <visibility>").option("--model <model>").option("--run-when-mentioned <boolean>", "true or false").option("--web-access-enabled <boolean>", "true or false").option("--web-fetch-enabled <boolean>", "true or false").option("--search-past-conversations-enabled <boolean>", "true or false").option("--app-rules-creation-enabled <boolean>", "true or false").option("--tool-discovery-enabled <boolean>", "true or false").option("--self-updates-enabled <boolean>", "true or false").option("--trusted-urls <urls>", "Comma-separated trusted URLs").option("--clear-trusted-urls", "Clear all trusted URLs").option("--tool-access <json>", "JSON array of the complete canonical native Agent tool scopes").option(
15127
+ "--plugin-connections <json>",
15128
+ "JSON array of Agent connector grant patches; removals require id and _destroy:true"
15129
+ ).option(
15130
+ "--trigger <json>",
15131
+ "Canonical Agent trigger patch; use the trigger id from agents show to replace or remove it"
15132
+ ).action(async (opts, cmd) => {
15133
+ if (opts.clearTrustedUrls && opts.trustedUrls !== void 0) {
15134
+ throw new CliError({
15135
+ message: "Use either --trusted-urls or --clear-trusted-urls, not both.",
15136
+ kind: "invalid_args",
15137
+ status: 400,
15138
+ exitCode: EXIT_CODES.invalidArgs
15139
+ });
15140
+ }
15141
+ const runWhenMentioned = parseBooleanOption(opts.runWhenMentioned, "--run-when-mentioned");
15142
+ const webAccessEnabled = parseBooleanOption(opts.webAccessEnabled, "--web-access-enabled");
15143
+ const webFetchEnabled = parseBooleanOption(opts.webFetchEnabled, "--web-fetch-enabled");
15144
+ const searchPastConversationsEnabled = parseBooleanOption(
15145
+ opts.searchPastConversationsEnabled,
15146
+ "--search-past-conversations-enabled"
15147
+ );
15148
+ const appRulesCreationEnabled = parseBooleanOption(
15149
+ opts.appRulesCreationEnabled,
15150
+ "--app-rules-creation-enabled"
15151
+ );
15152
+ const toolDiscoveryEnabled = parseBooleanOption(
15153
+ opts.toolDiscoveryEnabled,
15154
+ "--tool-discovery-enabled"
15155
+ );
15156
+ const selfUpdatesEnabled = parseBooleanOption(opts.selfUpdatesEnabled, "--self-updates-enabled");
15157
+ const trustedUrls = parseCommaSeparatedStrings(opts.trustedUrls);
15158
+ const toolAccess = parseJsonOption(
15159
+ opts.toolAccess,
15160
+ "--tool-access",
15161
+ agentToolAccessUpdateSchema
15162
+ );
15163
+ const pluginConnections = parseJsonOption(
15164
+ opts.pluginConnections,
15165
+ "--plugin-connections",
15166
+ agentPluginConnectionUpdateSchema
15167
+ );
15168
+ const trigger = parseJsonOption(opts.trigger, "--trigger", agentTriggerUpdateSchema);
15169
+ const patch = {
15170
+ ...opts.name !== void 0 ? { name: String(opts.name) } : {},
15171
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15172
+ ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15173
+ ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15174
+ ...opts.visibility !== void 0 ? { visibility: String(opts.visibility) } : {},
15175
+ ...opts.model !== void 0 ? { model: String(opts.model) } : {},
15176
+ ...runWhenMentioned !== void 0 ? { run_when_mentioned: runWhenMentioned } : {},
15177
+ ...webAccessEnabled !== void 0 ? { web_access_enabled: webAccessEnabled } : {},
15178
+ ...webFetchEnabled !== void 0 ? { web_fetch_enabled: webFetchEnabled } : {},
15179
+ ...searchPastConversationsEnabled !== void 0 ? { search_past_conversations_enabled: searchPastConversationsEnabled } : {},
15180
+ ...appRulesCreationEnabled !== void 0 ? { app_rules_creation_enabled: appRulesCreationEnabled } : {},
15181
+ ...toolDiscoveryEnabled !== void 0 ? { tool_discovery_enabled: toolDiscoveryEnabled } : {},
15182
+ ...selfUpdatesEnabled !== void 0 ? { self_updates_enabled: selfUpdatesEnabled } : {},
15183
+ ...trustedUrls !== void 0 ? { trusted_urls: trustedUrls } : {},
15184
+ ...opts.clearTrustedUrls ? { trusted_urls: [] } : {},
15185
+ ...toolAccess !== void 0 ? { tool_access: toolAccess } : {},
15186
+ ...pluginConnections !== void 0 ? { agent_tool_connections_attributes: pluginConnections } : {},
15187
+ ...trigger !== void 0 ? { trigger_attributes: trigger } : {}
15188
+ };
15189
+ if (Object.keys(patch).length === 0) {
15190
+ throw new CliError({
15191
+ message: "agents update requires at least one mutable Agent field.",
15192
+ kind: "invalid_args",
15193
+ status: 400,
15194
+ exitCode: EXIT_CODES.invalidArgs
15195
+ });
15196
+ }
15197
+ const id = idSchema14.parse(opts.id);
15198
+ const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
15199
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15200
+ const organizationId = resolveOrganizationId(context.organizationId);
15201
+ await runGraphqlMutationCommand({
15202
+ command: "agents.update",
15203
+ operationName: "AgentsUpdate",
15204
+ runtimeOptions: context.runtimeOptions,
15205
+ field: "update_agent",
15206
+ variableTypes: {
15207
+ organization_id: "ID!",
15208
+ agent_id: "ID!",
15209
+ params: "UpdateAgentParamsInput!",
15210
+ expected_update_version: "String!"
15211
+ },
15212
+ variables: {
15213
+ organization_id: organizationId,
15214
+ agent_id: id,
15215
+ params: { agent: patch },
15216
+ expected_update_version: expectedUpdateVersion
15217
+ },
15218
+ transformMutationPayload: normalizePersistedUpdatePayload
15219
+ });
15220
+ });
15063
15221
  agents.command("plugin-catalog").description("Read connected Agent plugin capabilities for one supported service").requiredOption(
15064
15222
  "--service <service>",
15065
15223
  "Supported service: gmail, calendar, slack, or stripe"
@@ -15078,7 +15236,7 @@ function registerAtlasAuthoringCommands(program) {
15078
15236
  });
15079
15237
  });
15080
15238
  const automations = program.command("automations").description("Bounded Automation authoring operations");
15081
- automations.command("create").description("Create an Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--status <status>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15239
+ automations.command("create").description("Create a Backlog Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").option("--agent-id <agentId>", "Optional executor Agent id for a repeat Automation").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
15082
15240
  const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
15083
15241
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15084
15242
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15101,7 +15259,6 @@ function registerAtlasAuthoringCommands(program) {
15101
15259
  ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15102
15260
  ...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
15103
15261
  ...opts.agentId !== void 0 ? { agentId: idSchema14.parse(opts.agentId) } : {},
15104
- ...opts.status !== void 0 ? { status: String(opts.status) } : {},
15105
15262
  ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15106
15263
  ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {}
15107
15264
  },
@@ -15110,7 +15267,7 @@ function registerAtlasAuthoringCommands(program) {
15110
15267
  transformMutationPayload: normalizePersistedCreatePayload
15111
15268
  });
15112
15269
  });
15113
- automations.command("show").description("Read one persisted Automation by id").requiredOption("--id <id>", "Automation id").action(async (opts, cmd) => {
15270
+ automations.command("show").description("Read one persisted Automation by id or slug").requiredOption("--id <idOrSlug>", "Automation id or slug").action(async (opts, cmd) => {
15114
15271
  const id = idSchema14.parse(opts.id);
15115
15272
  const context = await resolveCommandContext(cmd.optsWithGlobals());
15116
15273
  const organizationId = resolveOrganizationId(context.organizationId);
@@ -15125,6 +15282,65 @@ function registerAtlasAuthoringCommands(program) {
15125
15282
  isShow: true
15126
15283
  });
15127
15284
  });
15285
+ automations.command("update").description("Update one task-backed Automation without changing its system-managed status").requiredOption("--id <idOrSlug>", "Automation id or slug").requiredOption(
15286
+ "--expected-update-version <version>",
15287
+ "Exact opaque updateVersion value from automations show; rejects stale writes"
15288
+ ).option("--summary <summary>").option("--description <description>").option("--notes <notes>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").option("--ai-task-config <json>", "Complete replacement ai_task_config JSON object").option(
15289
+ "--agent-id <agentId>",
15290
+ "Executor Agent id; requires --ai-task-config and is stored in that config"
15291
+ ).action(async (opts, cmd) => {
15292
+ if (opts.agentId !== void 0 && opts.aiTaskConfig === void 0) {
15293
+ throw new CliError({
15294
+ message: "automations update requires --ai-task-config whenever --agent-id is supplied.",
15295
+ kind: "invalid_args",
15296
+ status: 400,
15297
+ exitCode: EXIT_CODES.invalidArgs
15298
+ });
15299
+ }
15300
+ const aiTaskConfig = opts.aiTaskConfig === void 0 ? void 0 : {
15301
+ ...parseAutomationConfig(opts.aiTaskConfig),
15302
+ ...opts.agentId !== void 0 ? { agent_id: idSchema14.parse(opts.agentId) } : {}
15303
+ };
15304
+ const patch = {
15305
+ ...opts.summary !== void 0 ? { summary: String(opts.summary) } : {},
15306
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {},
15307
+ ...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
15308
+ ...opts.priority !== void 0 ? { priority: String(opts.priority) } : {},
15309
+ ...opts.dueDate !== void 0 ? { due_date: isoDateSchema.parse(opts.dueDate) } : {},
15310
+ ...aiTaskConfig !== void 0 ? { ai_task_config: aiTaskConfig } : {}
15311
+ };
15312
+ if (Object.keys(patch).length === 0) {
15313
+ throw new CliError({
15314
+ message: "automations update requires at least one mutable Automation field.",
15315
+ kind: "invalid_args",
15316
+ status: 400,
15317
+ exitCode: EXIT_CODES.invalidArgs
15318
+ });
15319
+ }
15320
+ const id = idSchema14.parse(opts.id);
15321
+ const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
15322
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15323
+ const organizationId = resolveOrganizationId(context.organizationId);
15324
+ await runGraphqlMutationCommand({
15325
+ command: "automations.update",
15326
+ operationName: "AutomationsUpdate",
15327
+ runtimeOptions: context.runtimeOptions,
15328
+ field: "update_task",
15329
+ variableTypes: {
15330
+ organization_id: "ID!",
15331
+ task_id: "ID!",
15332
+ params: "UpdateTaskParamsInput!",
15333
+ expected_update_version: "String!"
15334
+ },
15335
+ variables: {
15336
+ organization_id: organizationId,
15337
+ task_id: id,
15338
+ params: { task: patch },
15339
+ expected_update_version: expectedUpdateVersion
15340
+ },
15341
+ transformMutationPayload: normalizePersistedUpdatePayload
15342
+ });
15343
+ });
15128
15344
  const skills = program.commands.find((command) => command.name() === "skills");
15129
15345
  if (!skills) {
15130
15346
  throw new Error("Skills command must be registered before Atlas authoring commands.");
@@ -15156,6 +15372,47 @@ function registerAtlasAuthoringCommands(program) {
15156
15372
  transformMutationPayload: normalizePersistedCreatePayload
15157
15373
  });
15158
15374
  });
15375
+ skills.command("update").description("Update one persisted Skill through the API-owned updateSkill contract").requiredOption("--id <idOrSlug>", "Skill id or slug").requiredOption(
15376
+ "--expected-update-version <version>",
15377
+ "Exact opaque updateVersion value from skills show; rejects stale writes"
15378
+ ).option("--name <name>").option("--emoji <emoji>").option("--description <description>").action(async (opts, cmd) => {
15379
+ const patch = {
15380
+ ...opts.name !== void 0 ? { name: String(opts.name) } : {},
15381
+ ...opts.emoji !== void 0 ? { emoji: String(opts.emoji) } : {},
15382
+ ...opts.description !== void 0 ? { description: String(opts.description) } : {}
15383
+ };
15384
+ if (Object.keys(patch).length === 0) {
15385
+ throw new CliError({
15386
+ message: "skills update requires at least one mutable Skill field.",
15387
+ kind: "invalid_args",
15388
+ status: 400,
15389
+ exitCode: EXIT_CODES.invalidArgs
15390
+ });
15391
+ }
15392
+ const id = idSchema14.parse(opts.id);
15393
+ const expectedUpdateVersion = parseExpectedUpdateVersion(opts.expectedUpdateVersion);
15394
+ const context = await resolveCommandContext(cmd.optsWithGlobals());
15395
+ const organizationId = resolveOrganizationId(context.organizationId);
15396
+ await runGraphqlMutationCommand({
15397
+ command: "skills.update",
15398
+ operationName: "SkillsUpdate",
15399
+ runtimeOptions: context.runtimeOptions,
15400
+ field: "update_skill",
15401
+ variableTypes: {
15402
+ organization_id: "ID!",
15403
+ id: "ID!",
15404
+ input: "UpdateSkillInput!",
15405
+ expected_update_version: "String!"
15406
+ },
15407
+ variables: {
15408
+ organization_id: organizationId,
15409
+ id,
15410
+ input: patch,
15411
+ expected_update_version: expectedUpdateVersion
15412
+ },
15413
+ transformMutationPayload: normalizePersistedUpdatePayload
15414
+ });
15415
+ });
15159
15416
  }
15160
15417
 
15161
15418
  // src/commands/discovery.ts
@@ -15166,7 +15423,7 @@ import { join as join3 } from "path";
15166
15423
  import { createHash } from "crypto";
15167
15424
 
15168
15425
  // src/version.ts
15169
- var CLI_VERSION = "0.1.71";
15426
+ var CLI_VERSION = "0.1.73";
15170
15427
 
15171
15428
  // src/operationMetadata.ts
15172
15429
  var DISCOVERY_OPERATION_IDS = [
@@ -15479,7 +15736,9 @@ var WRITE_OPERATION_IDS = [
15479
15736
  "accountability.create",
15480
15737
  "accountability.update",
15481
15738
  "agents.create",
15739
+ "agents.update",
15482
15740
  "automations.create",
15741
+ "automations.update",
15483
15742
  "contacts.create",
15484
15743
  "contacts.update",
15485
15744
  "content.create-contact",
@@ -15585,6 +15844,7 @@ var WRITE_OPERATION_IDS = [
15585
15844
  "scorecards.create",
15586
15845
  "scorecards.update",
15587
15846
  "skills.create",
15847
+ "skills.update",
15588
15848
  "smart-kpi-views.create",
15589
15849
  "stand-ups.create",
15590
15850
  "stand-ups.update",
@@ -15936,12 +16196,13 @@ var NAMESPACE_DOCS = {
15936
16196
  skills: {
15937
16197
  name: "skills",
15938
16198
  tier: "primary",
15939
- description: "Skill record readback and bounded create operations.",
16199
+ description: "Skill record readback and bounded create/update operations.",
15940
16200
  examples: [
15941
16201
  "wave skills list --json",
15942
16202
  "wave skills list --scope ADMIN_GLOBAL --json",
15943
16203
  "wave skills show --id 123 --json",
15944
- 'wave skills create --name "Weekly planning" --scope MEMBER_PERSONAL --idempotency-key skill-create-001'
16204
+ 'wave skills create --name "Weekly planning" --scope MEMBER_PERSONAL --idempotency-key skill-create-001',
16205
+ 'wave skills update --id SKL-01 --expected-update-version 2026-07-17T12:00:00.123456Z --description "Review my projects."'
15945
16206
  ],
15946
16207
  schema: {
15947
16208
  output: "json-envelope-default",
@@ -15949,20 +16210,22 @@ var NAMESPACE_DOCS = {
15949
16210
  safety: [
15950
16211
  "Uses API-owned Skill GraphQL read fields only.",
15951
16212
  "Create calls only createSkill with an explicit idempotency key.",
16213
+ "Update calls only updateSkill with an exact opaque updateVersion token and does not change scope or ownership.",
15952
16214
  "Skill create supports the API-defined ADMIN_GLOBAL and MEMBER_PERSONAL scopes.",
15953
16215
  "Does not update, destroy, archive, approve, or apply Skill records."
15954
16216
  ],
15955
- commands: ["list", "show", "create"]
16217
+ commands: ["list", "show", "create", "update"]
15956
16218
  }
15957
16219
  },
15958
16220
  agents: {
15959
16221
  name: "agents",
15960
16222
  tier: "primary",
15961
- description: "Bounded Agent create and persisted readback operations.",
16223
+ description: "Bounded Agent create, readback, and stale-write-protected update operations.",
15962
16224
  examples: [
15963
16225
  'wave agents create --name "Planning helper" --idempotency-key agent-create-001',
15964
16226
  `wave agents create --name "Project summary" --notes "Summarize my projects." --tool-access '[{"tool_key":"projects","scope_value":"all"}]' --trigger '{"trigger_type":"cron","cron_expression":"0 14 * * 2","timezone":"America/Phoenix","enabled":true}' --idempotency-key agent-create-002`,
15965
- "wave agents show --id 123"
16227
+ "wave agents show --id AGT-01",
16228
+ 'wave agents update --id AGT-01 --expected-update-version 2026-07-17T12:00:00.123456Z --notes "Summarize my projects."'
15966
16229
  ],
15967
16230
  schema: {
15968
16231
  output: "json-envelope-default",
@@ -15970,32 +16233,36 @@ var NAMESPACE_DOCS = {
15970
16233
  safety: [
15971
16234
  "Create calls only createAgent with an explicit idempotency key.",
15972
16235
  "Create preserves API-owned defaults by sending only supplied typed Agent fields.",
16236
+ "Update calls only updateAgent with an exact opaque updateVersion token and cannot change ownership.",
15973
16237
  "Native tools, plugin connector grants, and the cron trigger use strict canonical JSON shapes.",
15974
16238
  "Outlook Calendar and Outlook Mail are not supported Agent plugin families in this release.",
15975
16239
  "Show uses the API-owned agent query by id; no slug fallback is implemented."
15976
16240
  ],
15977
- commands: ["create", "show"]
16241
+ commands: ["create", "show", "update"]
15978
16242
  }
15979
16243
  },
15980
16244
  automations: {
15981
16245
  name: "automations",
15982
16246
  tier: "primary",
15983
- description: "Bounded Automation create and persisted readback operations.",
16247
+ description: "Bounded task-backed Automation create, readback, and stale-write-protected update operations.",
15984
16248
  examples: [
15985
16249
  `wave automations create --summary "Weekly review" --agent-id 123 --ai-task-config '{"cycle":"repeat","repeatSchedule":{"interval":1,"frequency":"week","weekdays":[1,3],"at":"2:30 PM","starting":"2026-07-20T00:00:00.000Z","ending":"never","endingRuns":1,"endingDate":null,"timezone":"America/Phoenix"}}' --idempotency-key automation-create-001`,
15986
- "wave automations show --id 123"
16250
+ "wave automations show --id ATK-01",
16251
+ 'wave automations update --id ATK-01 --expected-update-version 2026-07-17T12:00:00.123456Z --summary "Weekly project review"'
15987
16252
  ],
15988
16253
  schema: {
15989
16254
  output: "json-envelope-default",
15990
16255
  mutates: true,
15991
16256
  safety: [
15992
16257
  "Create calls only createAutomation with an explicit idempotency key.",
16258
+ "Create always leaves status to the API, which starts Automations in Backlog.",
15993
16259
  "Only the API-defined ai_task_config field accepts validated JSON.",
15994
16260
  "Optional executor Agent linkage is sent only through the API-defined top-level agentId input.",
16261
+ "Update calls only updateTask with an exact opaque updateVersion token; it cannot change status, task type, ownership, or project linkage.",
15995
16262
  "Does not create a project Task, run an Automation, or invoke AI OS actions.",
15996
16263
  "Show uses the API-owned automation query by id; no slug fallback is implemented."
15997
16264
  ],
15998
- commands: ["create", "show"]
16265
+ commands: ["create", "show", "update"]
15999
16266
  }
16000
16267
  },
16001
16268
  broadcast: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wave-ai-os/wave-cli",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wave": "dist/index.js"