@duvoai/cli 1.115.0 → 1.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +203 -202
  2. package/dist/bin/duvo.js +642 -51
  3. package/package.json +1 -1
package/dist/bin/duvo.js CHANGED
@@ -11672,7 +11672,14 @@ var scheduleApiSchema = z44.object({
11672
11672
  id: z44.string(),
11673
11673
  build_id: z44.string(),
11674
11674
  agent_id: z44.string(),
11675
- user_id: z44.string(),
11675
+ /** The user the schedule runs as. Null on a shared schedule, which belongs to its Team automation and runs as the team. */
11676
+ user_id: z44.string().nullable(),
11677
+ /**
11678
+ * The user who set the schedule up. Null when nobody recorded it, or the
11679
+ * profile was deleted. Optional so a response from an older server still
11680
+ * parses.
11681
+ */
11682
+ created_by: z44.string().nullable().optional(),
11676
11683
  enabled: z44.boolean(),
11677
11684
  frequency: scheduleFrequencySchema,
11678
11685
  time: z44.string().nullable(),
@@ -13578,7 +13585,7 @@ var caseQueueItemSchema = z55.object({
13578
13585
  "The automation revision that produced the case. It never changes. Null when no Run created the case (added through the API or an import, or created before automation revisions), and on a team without automation revisions."
13579
13586
  ),
13580
13587
  automation_revision_id: z55.guid().nullable().optional().describe(
13581
- "The automation revision that handles the case. It is set when a Run creates the case, set again to the revision that runs the case when a Run claims it, and otherwise changes only when an activation moves waiting cases. For a case that no Run created, null until a Run claims it or an activation moves it. Null on a team without automation revisions."
13588
+ "The automation revision the case is pinned to, whose routing handles it. A case a draft Run creates is pinned to that draft and keeps the pin after the draft goes live. Any other case is null, and follows the automation's live revision, unless its team pins cases to live revisions: then it is pinned to the revision of the Run that creates or first claims it. Moving a case to the live revision (Run on live revision, or an activation that moves waiting cases) pins it to that revision on such a team and clears the pin otherwise. Null on a team without automation revisions."
13582
13589
  ),
13583
13590
  automation_revision: caseRevisionPinSchema.nullable().optional().describe(
13584
13591
  "The handling revision, resolved. Null when the case has no handling revision."
@@ -13863,7 +13870,9 @@ var caseBulkStatusUpdateResponseSchema = z55.object({
13863
13870
  });
13864
13871
  var caseRunOnLiveRevisionResponseSchema = z55.object({
13865
13872
  success: z55.literal(true),
13866
- automation_revision_id: z55.guid().describe("The live revision the case is now pinned to.")
13873
+ automation_revision_id: z55.guid().describe(
13874
+ "The live revision the case now runs on. The case is pinned to it only on a team that pins cases to live revisions; otherwise it is left unpinned and follows the automation's live wiring."
13875
+ )
13867
13876
  });
13868
13877
  var caseBulkPriorityUpdateResponseSchema = z55.object({
13869
13878
  updatedCount: z55.number(),
@@ -14203,6 +14212,10 @@ var setProcessAttributeValueBodyApiSchema = z56.discriminatedUnion(
14203
14212
  })
14204
14213
  ]
14205
14214
  );
14215
+ var AUTOMATION_RUN_SCOPES = ["personal", "team"];
14216
+ var createRunScopeRequestApiSchema = z57.enum(AUTOMATION_RUN_SCOPES).default("personal").describe(
14217
+ "Who the new automation's runs execute as: `personal` (the default) runs as each member with their own Connections; `team` runs as the team with shared Connections, Secrets and Logins only, and can't be changed back. `team` needs Lead Builder or above, the Team automations feature, a team on the Automations workspace and not on automation revisions, and Connection sharing on; read `GET /v2/teams/{teamId}/automations/run-scope-options` to see whether it is available and why not. Refused with 409 and the blocker's `code` when it isn't, or 403 `permission_required` for a caller below Lead Builder."
14218
+ );
14206
14219
  var automationSetupProgressApiSchema = z57.object({
14207
14220
  has_captures: z57.boolean(),
14208
14221
  has_process_map: z57.boolean(),
@@ -14239,14 +14252,17 @@ var automationSummaryApiSchema = z57.object({
14239
14252
  setup_progress: automationSetupProgressApiSchema.nullable().default(null).describe(
14240
14253
  "The setup facts behind the tile's Setup badge \u2014 captures uploaded, the team's own process map generated, a proposal written \u2014 or null while the automation is not being set up (and whenever it has no module process for the facts to hang off)."
14241
14254
  ),
14242
- run_scope: z57.enum(["personal", "team"]).optional().describe(
14243
- "Who the automation's runs execute as: its members, each with their own Connections (`personal`), or the team, with shared Connections only (`team`). An automation becomes `team` once, through convert-to-team, and never goes back. Optional because a backend that predates Team automations does not send it; a client treats absence as `personal` and offers no conversion."
14255
+ run_scope: z57.enum(AUTOMATION_RUN_SCOPES).optional().describe(
14256
+ "Who the automation's runs execute as: its members, each with their own Connections (`personal`), or the team, with shared Connections only (`team`). An automation is created as either, and a `personal` one can later be converted to `team`; a `team` one never goes back. Optional because a backend that predates Team automations does not send it; a client reads absence as `personal`."
14244
14257
  ),
14245
14258
  converted_to_team_at: z57.string().nullable().optional().describe(
14246
- "When the automation was converted to run as the team, or null while it runs as its members."
14259
+ "When the automation was converted to run as the team, or null while it runs as its members or when it was created to run as the team."
14247
14260
  ),
14248
14261
  converted_by: z57.guid().nullable().optional().describe(
14249
- "The member who converted the automation to run as the team, or null while it runs as its members or when that member is gone."
14262
+ "The member who converted the automation to run as the team, or null while it runs as its members, when it was created to run as the team, or when that member is gone."
14263
+ ),
14264
+ converted_by_name: z57.string().nullable().optional().describe(
14265
+ "The display name of the member who converted the automation to run as the team, or null while it runs as its members, when that member is gone, or when they set no name. Never their email. Optional because an older backend does not send it."
14250
14266
  ),
14251
14267
  viewer_can_edit: z57.boolean().optional().describe(
14252
14268
  "Whether the caller may change this automation. An automation takes its agents' ownership rule: a Builder may edit one whose every agent they created, and Lead Builder or above may edit any. Sent by the list and detail endpoints; absent from create and update responses, where the client falls back to the caller's role."
@@ -14439,6 +14455,11 @@ var duplicateAutomationResponseApiSchema = z57.object({
14439
14455
  "The new automation: a copy of the source's live agents, builds, queues and the routing between them."
14440
14456
  )
14441
14457
  });
14458
+ var duplicateAutomationBodyApiSchema = z57.object({
14459
+ run_scope: z57.enum(AUTOMATION_RUN_SCOPES).default("personal").describe(
14460
+ "Who the copy's runs execute as, whatever the original runs as: `personal` (the default) runs as each member with their own Connections; `team` runs as the team with shared Connections, Secrets and Logins only, and can't be changed back. `team` has the same requirements as creating an automation with `run_scope: team`: read `GET /v2/teams/{teamId}/automations/run-scope-options` to see whether it is available and why not. Refused with 409 and the blocker's `code` when it isn't, or 403 `permission_required` for a caller below Lead Builder."
14461
+ )
14462
+ }).default({ run_scope: "personal" });
14442
14463
  var TEAM_CONVERSION_BLOCKER_CODES = [
14443
14464
  "automations_workspace_required",
14444
14465
  "module_demo",
@@ -14459,6 +14480,37 @@ var teamConversionBlockerApiSchema = z57.object({
14459
14480
  queue_automation_id: z57.string().nullable(),
14460
14481
  queue_automation_name: z57.string().nullable()
14461
14482
  });
14483
+ var TEAM_CREATION_BLOCKER_CODES = [
14484
+ "automations_workspace_required",
14485
+ "team_automations_flag_off",
14486
+ "automation_revisions",
14487
+ "connection_sharing_off",
14488
+ "permission_required"
14489
+ ];
14490
+ var runScopeOptionsResponseApiSchema = z57.object({
14491
+ team: z57.object({
14492
+ available: z57.boolean().describe(
14493
+ "Whether the caller may create an automation that runs as the team (`run_scope: team`) in this team now."
14494
+ ),
14495
+ blocker: z57.object({
14496
+ code: z57.enum(TEAM_CREATION_BLOCKER_CODES),
14497
+ message: z57.string().describe("A sentence to show the user, saying what to do.")
14498
+ }).nullable().describe(
14499
+ "Why it isn't available, most fundamental first, or null when it is."
14500
+ )
14501
+ }).describe(
14502
+ "The `team` run scope. `personal` is always available to anyone who may create an automation."
14503
+ )
14504
+ });
14505
+ var runScopeOptionsClientResponseSchema = z57.object({
14506
+ team: z57.object({
14507
+ available: z57.boolean(),
14508
+ blocker: z57.object({
14509
+ code: z57.string(),
14510
+ message: z57.string()
14511
+ }).nullable()
14512
+ })
14513
+ });
14462
14514
  var teamConversionPreviewApiSchema = z57.object({
14463
14515
  personal_rows: z57.array(
14464
14516
  z57.object({
@@ -14509,6 +14561,36 @@ var automationTeamConversionResponseApiSchema = z57.object({
14509
14561
  blocker: teamConversionBlockerApiSchema.nullable(),
14510
14562
  preview: teamConversionPreviewApiSchema.nullable()
14511
14563
  });
14564
+ var teamConversionPublicPreviewApiSchema = z57.object({
14565
+ personal_row_totals: teamConversionPreviewApiSchema.shape.personal_row_totals.describe(
14566
+ "Members whose personal triggers and schedules on this automation conversion turns off, and how many of each."
14567
+ ),
14568
+ slots_without_team_connection: z57.number().int().describe(
14569
+ "Connection slots across the automation's Agents with no team Connection; a Team run can't use them until one is shared."
14570
+ ),
14571
+ secrets_without_team_access: z57.number().int().describe("Secrets the Agents use that a Team run can't read."),
14572
+ logins_without_team_access: z57.number().int().describe("Logins the Agents use that a Team run can't read."),
14573
+ own_aop_exceptions: z57.array(
14574
+ z57.object({
14575
+ id: z57.string(),
14576
+ agent_id: z57.string(),
14577
+ agent_name: z57.string(),
14578
+ label: z57.string(),
14579
+ enabled: z57.boolean()
14580
+ })
14581
+ ).describe(
14582
+ "The caller's own AOP exceptions on the automation. Pass their ids to convertAutomationToTeam to copy them as team exceptions."
14583
+ ),
14584
+ no_responsible_people: z57.boolean().describe(
14585
+ "No Responsible people are named, so requests would go to the team's Owners and Administrators."
14586
+ ),
14587
+ pending_cases: z57.number().int().describe("Pending cases a Team run would pick up.")
14588
+ });
14589
+ var automationTeamConversionPublicResponseApiSchema = z57.object({
14590
+ convertible: z57.boolean(),
14591
+ blocker: teamConversionBlockerApiSchema.nullable(),
14592
+ preview: teamConversionPublicPreviewApiSchema.nullable()
14593
+ });
14512
14594
  var automationTeamConversionClientResponseSchema = automationTeamConversionResponseApiSchema.extend({
14513
14595
  blocker: teamConversionBlockerApiSchema.extend({ code: z57.string() }).nullable(),
14514
14596
  preview: teamConversionPreviewApiSchema.extend({
@@ -16435,7 +16517,10 @@ var setUpModuleResponseApiSchema = z69.object({
16435
16517
  link: z69.string().nullable().describe(
16436
16518
  "Root-relative web-app path to the Automation's setup screen, or null when this viewer has no such tab."
16437
16519
  ),
16438
- url: z69.string().nullable().describe("The full web-app URL of `link`.")
16520
+ url: z69.string().nullable().describe("The full web-app URL of `link`."),
16521
+ run_scope: z69.enum(["personal", "team"]).optional().describe(
16522
+ "Who the new Automation's runs execute as: each member (`personal`) or the team (`team`), as the request asked. Optional because a backend that predates run scopes does not send it; read absence as `personal`."
16523
+ )
16439
16524
  });
16440
16525
  var generateAutomationProposalRequestApiSchema = z69.object({
16441
16526
  current_process_snapshot_id: z69.guid().optional().describe(
@@ -17183,6 +17268,41 @@ var casesListRequestBodySchema = z79.object({
17183
17268
  include_blockers: z79.boolean().optional().describe(CASE_INCLUDE_BLOCKERS_DESCRIPTION),
17184
17269
  fields: z79.array(z79.enum(CASE_LIST_SELECTABLE_FIELDS)).min(1).optional().describe(CASE_LIST_FIELDS_DESCRIPTION)
17185
17270
  });
17271
+ var RUN_CASE_LIST_SELECTABLE_FIELDS = [
17272
+ "id",
17273
+ "queue_id",
17274
+ "title",
17275
+ "data",
17276
+ "json_data",
17277
+ "json_schema_id",
17278
+ "status",
17279
+ "display_status",
17280
+ "priority",
17281
+ "labels",
17282
+ "claimed_at",
17283
+ "claimed_by_run_id",
17284
+ "completed_at",
17285
+ "postponed_to",
17286
+ "created_at",
17287
+ "updated_at"
17288
+ ];
17289
+ var MAX_RUN_LABEL_FILTER_KEYS = 20;
17290
+ var MAX_RUN_LABEL_FILTER_VALUES = 100;
17291
+ var runCasesFiltersSchema = casesFiltersSchema.omit({ awaiting_my_approval: true }).extend({
17292
+ // Bounded here, not on the shared filters: each label key adds a
17293
+ // correlated subquery and each value an expression, and this route is
17294
+ // reachable with any run's key.
17295
+ labels: z79.record(z79.string(), z79.array(z79.string()).max(MAX_RUN_LABEL_FILTER_VALUES)).refine(
17296
+ (labels) => Object.keys(labels).length <= MAX_RUN_LABEL_FILTER_KEYS,
17297
+ `labels may name at most ${MAX_RUN_LABEL_FILTER_KEYS} label keys`
17298
+ ).optional()
17299
+ }).strict();
17300
+ var runCasesSearchRequestBodySchema = casesListRequestBodySchema.omit({ include_blockers: true }).extend({
17301
+ filters: runCasesFiltersSchema.default({}),
17302
+ fields: z79.array(z79.enum(RUN_CASE_LIST_SELECTABLE_FIELDS)).min(1).optional().describe(
17303
+ "Return only these keys on each case. `id` is always returned. Leaving out `data` and `json_data` skips reading the payload. Omit to return every key."
17304
+ )
17305
+ }).strict();
17186
17306
  function toBase64(input) {
17187
17307
  if (typeof btoa === "function") {
17188
17308
  return btoa(unescape(encodeURIComponent(input)));
@@ -22293,7 +22413,8 @@ var publicScheduleSchema = z87.object({
22293
22413
  id: z87.string(),
22294
22414
  build_id: z87.string(),
22295
22415
  agent_id: z87.string(),
22296
- user_id: z87.string(),
22416
+ /** The user the schedule runs as; null on a shared schedule, which runs as the team. */
22417
+ user_id: z87.string().nullable(),
22297
22418
  enabled: z87.boolean(),
22298
22419
  frequency: z87.string(),
22299
22420
  time: z87.string().nullish(),
@@ -22307,9 +22428,9 @@ var publicScheduleSchema = z87.object({
22307
22428
  created_at: z87.string(),
22308
22429
  updated_at: z87.string(),
22309
22430
  /**
22310
- * Who created the schedule. Returned only by the elevated all-users read
22311
- * (`GET /agents/{agent_id}/schedules/all`); absent on the caller's-own
22312
- * listing, where every row belongs to the caller anyway.
22431
+ * The member the schedule runs as, null on a shared schedule. Returned only
22432
+ * by the elevated all-users read (`GET /agents/{agent_id}/schedules/all`);
22433
+ * absent on the caller's-own listing, where every row is the caller's.
22313
22434
  */
22314
22435
  user_name: z87.string().nullish(),
22315
22436
  user_email: z87.string().nullish()
@@ -22509,8 +22630,8 @@ __name(registerAgentsSchedulesDelete, "registerAgentsSchedulesDelete");
22509
22630
 
22510
22631
  // src/commands/agents/schedules/list.ts
22511
22632
  var TASK_PREVIEW_WIDTH = 40;
22512
- var CREATED_BY_WIDTH = 28;
22513
- var CREATED_BY_HEADER = "CREATED BY";
22633
+ var OWNER_WIDTH = 28;
22634
+ var OWNER_HEADER = "OWNER";
22514
22635
  var TABLE_COLUMNS7 = [
22515
22636
  { header: "ID", cell: /* @__PURE__ */ __name((row) => row.id, "cell") },
22516
22637
  {
@@ -22530,13 +22651,13 @@ var TABLE_COLUMNS7 = [
22530
22651
  maxWidth: TASK_PREVIEW_WIDTH
22531
22652
  },
22532
22653
  {
22533
- header: CREATED_BY_HEADER,
22534
- cell: /* @__PURE__ */ __name((row) => row.user_name ?? row.user_email ?? row.user_id, "cell"),
22535
- maxWidth: CREATED_BY_WIDTH
22654
+ header: OWNER_HEADER,
22655
+ cell: /* @__PURE__ */ __name((row) => row.user_id === null ? "shared" : row.user_name ?? row.user_email ?? row.user_id, "cell"),
22656
+ maxWidth: OWNER_WIDTH
22536
22657
  }
22537
22658
  ];
22538
22659
  function columnsFor(allUsers) {
22539
- return allUsers ? TABLE_COLUMNS7 : TABLE_COLUMNS7.filter((column) => column.header !== CREATED_BY_HEADER);
22660
+ return allUsers ? TABLE_COLUMNS7 : TABLE_COLUMNS7.filter((column) => column.header !== OWNER_HEADER);
22540
22661
  }
22541
22662
  __name(columnsFor, "columnsFor");
22542
22663
  function whenCell(row) {
@@ -22557,7 +22678,7 @@ function registerAgentsSchedulesList(schedules) {
22557
22678
  "List schedules for an agent \u2014 your own by default, or every member's with --all-users (use to find the schedule ID for update / delete)"
22558
22679
  ).option(
22559
22680
  "--all-users",
22560
- "list every team member's schedules on the agent, with who created each one (requires an elevated team role)"
22681
+ "list every team member's schedules on the agent, with the member each one runs as (requires an elevated team role)"
22561
22682
  ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function listAction(agentId, options) {
22562
22683
  const id = trimRequired(agentId, "<agent-id>");
22563
22684
  const allUsers = options.allUsers === true;
@@ -25313,9 +25434,34 @@ function registerAutomationsConvertToTeam(automations) {
25313
25434
  "--copy-exception <exception-id>",
25314
25435
  "copy one of your own AOP exceptions into team exceptions (repeatable)",
25315
25436
  collect6
25437
+ ).option(
25438
+ "--dry-run",
25439
+ "show whether it can be converted and what conversion would turn off, without converting"
25316
25440
  ).option("-y, --yes", "skip confirmation prompt").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function convertToTeamAction(id, options) {
25317
25441
  const automationId = trimRequired(id, "<id>");
25318
25442
  const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
25443
+ if (options.dryRun) {
25444
+ const preview = await httpRequest({
25445
+ method: "GET",
25446
+ path: apiPath("/v2/automations/:automation_id/team-conversion", {
25447
+ automation_id: automationId
25448
+ }),
25449
+ apiKey,
25450
+ apiBaseUrl
25451
+ });
25452
+ if (options.json) {
25453
+ printJson(preview);
25454
+ return;
25455
+ }
25456
+ const parsedPreview = automationTeamConversionPublicResponseApiSchema.safeParse(preview);
25457
+ if (!parsedPreview.success) {
25458
+ throw new CliError(
25459
+ `Unexpected response from the API: ${parsedPreview.error.message}`
25460
+ );
25461
+ }
25462
+ printConversionPreview(automationId, parsedPreview.data);
25463
+ return;
25464
+ }
25319
25465
  await confirmDestructive({
25320
25466
  message: `Convert automation "${automationId}" to run as your team? Members' personal triggers and schedules on it will be turned off. This can't be undone.`,
25321
25467
  skip: Boolean(options.yes)
@@ -25370,12 +25516,125 @@ function registerAutomationsConvertToTeam(automations) {
25370
25516
  }, "convertToTeamAction"));
25371
25517
  }
25372
25518
  __name(registerAutomationsConvertToTeam, "registerAutomationsConvertToTeam");
25519
+ function printConversionPreview(automationId, { convertible, blocker, preview }) {
25520
+ if (!convertible || preview === null) {
25521
+ console.log(
25522
+ renderKeyValue([
25523
+ { label: "ID", value: automationId },
25524
+ { label: "Can convert", value: "No" },
25525
+ { label: "Why not", value: blocker?.message ?? "-" },
25526
+ { label: "Code", value: blocker?.code ?? "-" }
25527
+ ])
25528
+ );
25529
+ return;
25530
+ }
25531
+ console.log(
25532
+ renderKeyValue([
25533
+ { label: "ID", value: automationId },
25534
+ { label: "Can convert", value: "Yes" },
25535
+ {
25536
+ label: "Personal triggers turned off",
25537
+ value: String(preview.personal_row_totals.triggers)
25538
+ },
25539
+ {
25540
+ label: "Personal schedules turned off",
25541
+ value: String(preview.personal_row_totals.schedules)
25542
+ },
25543
+ {
25544
+ label: "Members with setup turned off",
25545
+ value: String(preview.personal_row_totals.members)
25546
+ },
25547
+ {
25548
+ label: "Connection slots without a team Connection",
25549
+ value: String(preview.slots_without_team_connection)
25550
+ },
25551
+ {
25552
+ label: "Secrets a Team run can't use",
25553
+ value: String(preview.secrets_without_team_access)
25554
+ },
25555
+ {
25556
+ label: "Logins a Team run can't use",
25557
+ value: String(preview.logins_without_team_access)
25558
+ },
25559
+ { label: "Pending cases", value: String(preview.pending_cases) }
25560
+ ])
25561
+ );
25562
+ if (preview.own_aop_exceptions.length > 0) {
25563
+ console.log();
25564
+ console.log("Your AOP exceptions you can copy with --copy-exception:");
25565
+ for (const exception of preview.own_aop_exceptions) {
25566
+ console.log(
25567
+ ` ${exception.id} ${exception.agent_name}: ${exception.label}`
25568
+ );
25569
+ }
25570
+ }
25571
+ console.log();
25572
+ console.log(
25573
+ `Nothing was changed. Run duvo automations convert-to-team ${automationId} to convert.`
25574
+ );
25575
+ }
25576
+ __name(printConversionPreview, "printConversionPreview");
25577
+
25578
+ // src/commands/shared/run-scope.ts
25579
+ import { InvalidArgumentError } from "commander";
25580
+ var RUN_SCOPE_OPTION_DESCRIPTION = "who the automation's runs execute as: personal (each member, the default) or team (shared Connections only; needs a higher role, can't be changed back)";
25581
+ function parseRunScope(value) {
25582
+ const scope = value.trim().toLowerCase();
25583
+ const match = AUTOMATION_RUN_SCOPES.find((candidate) => candidate === scope);
25584
+ if (match === void 0) {
25585
+ throw new InvalidArgumentError(
25586
+ `Use one of: ${AUTOMATION_RUN_SCOPES.join(", ")}`
25587
+ );
25588
+ }
25589
+ return match;
25590
+ }
25591
+ __name(parseRunScope, "parseRunScope");
25592
+ function runScopeLabel(scope) {
25593
+ return scope === "team" ? "Your team" : "Each member";
25594
+ }
25595
+ __name(runScopeLabel, "runScopeLabel");
25596
+ var UNSUPPORTED_MESSAGE = "This Duvo server doesn't support creating an automation that runs as the team, so nothing was created. Leave out --run-scope to create one that runs as each member.";
25597
+ async function assertTeamRunScopeAvailable(params) {
25598
+ let raw;
25599
+ try {
25600
+ raw = await httpRequest({
25601
+ method: "GET",
25602
+ path: buildTeamPath(params.teamId, "/automations/run-scope-options"),
25603
+ apiKey: params.apiKey,
25604
+ apiBaseUrl: params.apiBaseUrl
25605
+ });
25606
+ } catch (error) {
25607
+ if (error instanceof CliError && error.exitCode === EXIT_CODE.NOT_FOUND) {
25608
+ throw new CliError(UNSUPPORTED_MESSAGE);
25609
+ }
25610
+ throw error;
25611
+ }
25612
+ const parsed = runScopeOptionsResponseApiSchema.safeParse(raw);
25613
+ if (!parsed.success) {
25614
+ throw new CliError(UNSUPPORTED_MESSAGE);
25615
+ }
25616
+ const { blocker } = parsed.data.team;
25617
+ if (!parsed.data.team.available) {
25618
+ throw new CliError(
25619
+ `Can't create an automation that runs as your team: ${blocker?.message ?? "it isn't available"}${blocker ? ` (${blocker.code})` : ""}. Nothing was created.`
25620
+ );
25621
+ }
25622
+ }
25623
+ __name(assertTeamRunScopeAvailable, "assertTeamRunScopeAvailable");
25624
+ function assertRunScopeHonoured(requested, returned, accepted) {
25625
+ if (requested === "team" && returned !== "team") {
25626
+ throw new CliError(
25627
+ `The server didn't confirm --run-scope team, so the automation will run as each member. It may predate run scopes.${accepted ? ` It accepted ${accepted}.` : ""}`
25628
+ );
25629
+ }
25630
+ }
25631
+ __name(assertRunScopeHonoured, "assertRunScopeHonoured");
25373
25632
 
25374
25633
  // src/commands/automations/create.ts
25375
25634
  function registerAutomationsCreate(automations) {
25376
25635
  automations.command("create").description(
25377
25636
  "Create a new automation. Its first agent is created alongside it."
25378
- ).requiredOption("--name <name>", "automation name").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function createAction(options) {
25637
+ ).requiredOption("--name <name>", "automation name").option("--run-scope <scope>", RUN_SCOPE_OPTION_DESCRIPTION, parseRunScope).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function createAction(options) {
25379
25638
  const name = options.name?.trim();
25380
25639
  if (name === void 0 || name.length === 0) {
25381
25640
  throw new CliError("--name must not be empty");
@@ -25385,12 +25644,20 @@ function registerAutomationsCreate(automations) {
25385
25644
  const teamId = await resolveRequiredTeamId(config, {
25386
25645
  override: getTeamFlag(this)
25387
25646
  });
25647
+ if (options.runScope === "team") {
25648
+ await assertTeamRunScopeAvailable({ apiKey, apiBaseUrl, teamId });
25649
+ }
25388
25650
  const raw = await httpRequest({
25389
25651
  method: "POST",
25390
25652
  path: buildTeamPath(teamId, "/automations"),
25391
25653
  apiKey,
25392
25654
  apiBaseUrl,
25393
- body: { name }
25655
+ body: {
25656
+ name,
25657
+ ...options.runScope !== void 0 && {
25658
+ run_scope: options.runScope
25659
+ }
25660
+ }
25394
25661
  });
25395
25662
  if (options.json) {
25396
25663
  printJson(raw);
@@ -25409,6 +25676,7 @@ function registerAutomationsCreate(automations) {
25409
25676
  renderKeyValue([
25410
25677
  { label: "ID", value: automation.id },
25411
25678
  { label: "Name", value: automation.name },
25679
+ { label: "Runs as", value: runScopeLabel(automation.run_scope) },
25412
25680
  { label: "First agent", value: firstAgentId },
25413
25681
  { label: "Created", value: automation.created_at }
25414
25682
  ])
@@ -25631,10 +25899,20 @@ function registerAutomationsDelete(automations) {
25631
25899
  }
25632
25900
  __name(registerAutomationsDelete, "registerAutomationsDelete");
25633
25901
 
25902
+ // src/commands/automations/run-scope-label.ts
25903
+ function runScopeLabel2(runScope) {
25904
+ return runScope === "team" ? "Team" : "Each member";
25905
+ }
25906
+ __name(runScopeLabel2, "runScopeLabel");
25907
+
25634
25908
  // src/commands/automations/duplicate.ts
25635
25909
  function registerAutomationsDuplicate(automations) {
25636
25910
  automations.command("duplicate <id>").alias("clone").description(
25637
- 'Duplicate an automation into a new "Copy of <name>" automation: its live agents, queues and routing. Your own triggers and schedules are copied switched off; cases and run history are not copied.'
25911
+ `Duplicate an automation into a new "Copy of <name>" automation: its live agents, queues and routing. Cases and run history are not copied. A copy that runs as each member keeps every pin and takes your own triggers and schedules, switched off; one that runs as your team keeps only the team's shared pins and its team AOP exceptions.`
25912
+ ).option(
25913
+ "--run-scope <scope>",
25914
+ "who the copy's runs execute as, whatever the original runs as: personal (each member, the default) or team (shared Connections only; needs a higher role in the automation's team, can't be changed back)",
25915
+ parseRunScope
25638
25916
  ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function duplicateAction(id, options) {
25639
25917
  const automationId = trimRequired(id, "<id>");
25640
25918
  const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
@@ -25644,13 +25922,26 @@ function registerAutomationsDuplicate(automations) {
25644
25922
  automation_id: automationId
25645
25923
  }),
25646
25924
  apiKey,
25647
- apiBaseUrl
25925
+ apiBaseUrl,
25926
+ ...options.runScope !== void 0 && {
25927
+ body: { run_scope: options.runScope }
25928
+ }
25648
25929
  });
25930
+ const parsed = duplicateAutomationResponseApiSchema.safeParse(raw);
25649
25931
  if (options.json) {
25650
25932
  printJson(raw);
25933
+ }
25934
+ if (options.runScope === "team") {
25935
+ const copyId = parsed.data?.automation.id;
25936
+ assertRunScopeHonoured(
25937
+ options.runScope,
25938
+ parsed.data?.automation.run_scope,
25939
+ copyId ? `copy ${copyId}` : void 0
25940
+ );
25941
+ }
25942
+ if (options.json) {
25651
25943
  return;
25652
25944
  }
25653
- const parsed = duplicateAutomationResponseApiSchema.safeParse(raw);
25654
25945
  if (!parsed.success) {
25655
25946
  throw new CliError(
25656
25947
  `Unexpected response from the API: ${parsed.error.message}`
@@ -25663,6 +25954,7 @@ function registerAutomationsDuplicate(automations) {
25663
25954
  renderKeyValue([
25664
25955
  { label: "ID", value: automation.id },
25665
25956
  { label: "Name", value: automation.name },
25957
+ { label: "Runs as", value: runScopeLabel2(automation.run_scope) },
25666
25958
  { label: "Agents", value: String(automation.agent_count) },
25667
25959
  { label: "Queues", value: String(automation.queue_count) }
25668
25960
  ])
@@ -25978,6 +26270,13 @@ function registerAutomationsGet(automations) {
25978
26270
  renderKeyValue([
25979
26271
  { label: "ID", value: automation.id },
25980
26272
  { label: "Name", value: automation.name },
26273
+ { label: "Runs as", value: runScopeLabel2(automation.run_scope) },
26274
+ ...automation.run_scope === "team" && automation.converted_to_team_at ? [
26275
+ {
26276
+ label: "Switched to team",
26277
+ value: automation.converted_by_name ? `${automation.converted_to_team_at} by ${automation.converted_by_name}` : automation.converted_to_team_at
26278
+ }
26279
+ ] : [],
25981
26280
  { label: "Agents", value: String(automation.agent_count) },
25982
26281
  { label: "Queues", value: String(automation.queue_count) },
25983
26282
  {
@@ -26063,6 +26362,10 @@ var TABLE_COLUMNS12 = [
26063
26362
  cell: /* @__PURE__ */ __name((row) => row.name, "cell"),
26064
26363
  maxWidth: 40
26065
26364
  },
26365
+ {
26366
+ header: "RUNS AS",
26367
+ cell: /* @__PURE__ */ __name((row) => runScopeLabel2(row.run_scope), "cell")
26368
+ },
26066
26369
  {
26067
26370
  header: "AGENTS",
26068
26371
  cell: /* @__PURE__ */ __name((row) => String(row.agent_count), "cell")
@@ -26503,6 +26806,50 @@ function registerAutomationsRoles(automations) {
26503
26806
  }
26504
26807
  __name(registerAutomationsRoles, "registerAutomationsRoles");
26505
26808
 
26809
+ // src/commands/automations/run-scope-options.ts
26810
+ function registerAutomationsRunScopeOptions(automations) {
26811
+ automations.command("run-scope-options").description(
26812
+ "Show whether you can create an automation that runs as your team (--run-scope team), and why not."
26813
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function runScopeOptionsAction(options) {
26814
+ const config = await requireAuthenticatedConfig(this);
26815
+ const { apiKey, apiBaseUrl } = config;
26816
+ const teamId = await resolveRequiredTeamId(config, {
26817
+ override: getTeamFlag(this)
26818
+ });
26819
+ const raw = await httpRequest({
26820
+ method: "GET",
26821
+ path: buildTeamPath(teamId, "/automations/run-scope-options"),
26822
+ apiKey,
26823
+ apiBaseUrl
26824
+ });
26825
+ if (options.json) {
26826
+ printJson(raw);
26827
+ return;
26828
+ }
26829
+ const parsed = runScopeOptionsResponseApiSchema.safeParse(raw);
26830
+ if (!parsed.success) {
26831
+ throw new CliError(
26832
+ `Unexpected response from the API: ${parsed.error.message}`
26833
+ );
26834
+ }
26835
+ const { team } = parsed.data;
26836
+ console.log(
26837
+ renderKeyValue([
26838
+ { label: "Each member", value: "Available" },
26839
+ {
26840
+ label: "Your team",
26841
+ value: team.available ? "Available" : "Not available"
26842
+ },
26843
+ ...team.blocker ? [
26844
+ { label: "Why not", value: team.blocker.message },
26845
+ { label: "Code", value: team.blocker.code }
26846
+ ] : []
26847
+ ])
26848
+ );
26849
+ }, "runScopeOptionsAction"));
26850
+ }
26851
+ __name(registerAutomationsRunScopeOptions, "registerAutomationsRunScopeOptions");
26852
+
26506
26853
  // src/commands/automations/set-config-field.ts
26507
26854
  function describeAnswer(value) {
26508
26855
  return value === null || value === void 0 ? "no answer" : JSON.stringify(value);
@@ -26661,7 +27008,7 @@ function registerAutomationsSetUpModule(automations) {
26661
27008
  ).option(
26662
27009
  "--convert-demo",
26663
27010
  "if the team has a demo of this module open, turn it into the automation and delete its sample data (no undo)"
26664
- ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function setUpModuleAction(slug, options) {
27011
+ ).option("--run-scope <scope>", RUN_SCOPE_OPTION_DESCRIPTION, parseRunScope).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function setUpModuleAction(slug, options) {
26665
27012
  if (!isModuleTemplateSlug(slug)) {
26666
27013
  throw new CliError(
26667
27014
  `Unknown module "${slug}". Use one of: ${MODULE_TEMPLATE_SLUG_VALUES.join(", ")}`
@@ -26672,6 +27019,9 @@ function registerAutomationsSetUpModule(automations) {
26672
27019
  const teamId = await resolveRequiredTeamId(config, {
26673
27020
  override: getTeamFlag(this)
26674
27021
  });
27022
+ if (options.runScope === "team") {
27023
+ await assertTeamRunScopeAvailable({ apiKey, apiBaseUrl, teamId });
27024
+ }
26675
27025
  let raw;
26676
27026
  try {
26677
27027
  raw = await httpRequest({
@@ -26682,7 +27032,12 @@ function registerAutomationsSetUpModule(automations) {
26682
27032
  }),
26683
27033
  apiKey,
26684
27034
  apiBaseUrl,
26685
- body: { convert_existing_demo: options.convertDemo === true }
27035
+ body: {
27036
+ convert_existing_demo: options.convertDemo === true,
27037
+ ...options.runScope !== void 0 && {
27038
+ run_scope: options.runScope
27039
+ }
27040
+ }
26686
27041
  });
26687
27042
  } catch (error) {
26688
27043
  if (error instanceof CliHttpError && error.status === 409 && // Not the rarer 409 for a demo that changed mid-setup.
@@ -26703,13 +27058,19 @@ function registerAutomationsSetUpModule(automations) {
26703
27058
  `Unexpected response from the API: ${parsed.error.message}`
26704
27059
  );
26705
27060
  }
26706
- const { automation_id: automationId, name, url } = parsed.data;
27061
+ const {
27062
+ automation_id: automationId,
27063
+ name,
27064
+ url,
27065
+ run_scope: runScope
27066
+ } = parsed.data;
26707
27067
  console.log(green("Module set up!"));
26708
27068
  console.log();
26709
27069
  console.log(
26710
27070
  renderKeyValue([
26711
27071
  { label: "ID", value: automationId },
26712
27072
  { label: "Name", value: name ?? "-" },
27073
+ { label: "Runs as", value: runScopeLabel(runScope) },
26713
27074
  { label: "Setup", value: url ?? "-" }
26714
27075
  ])
26715
27076
  );
@@ -26778,6 +27139,7 @@ function registerAutomations2(program) {
26778
27139
  registerAutomationsList(automations);
26779
27140
  registerAutomationsGet(automations);
26780
27141
  registerAutomationsCreate(automations);
27142
+ registerAutomationsRunScopeOptions(automations);
26781
27143
  registerAutomationsSetUpModule(automations);
26782
27144
  registerAutomationsGenerateProcessMap(automations);
26783
27145
  registerAutomationsGenerateProposal(automations);
@@ -31137,7 +31499,9 @@ import { z as z99 } from "zod";
31137
31499
  var responseSchema5 = z99.object({
31138
31500
  automation_run: z99.object({
31139
31501
  id: z99.string(),
31140
- status: z99.string()
31502
+ status: z99.string(),
31503
+ // Absent from a backend that predates run scopes.
31504
+ run_scope: z99.enum(["personal", "team"]).optional()
31141
31505
  })
31142
31506
  });
31143
31507
  function registerClarityBuildAutomation(clarity) {
@@ -31146,7 +31510,7 @@ function registerClarityBuildAutomation(clarity) {
31146
31510
  ).option(
31147
31511
  "--proposal-id <id>",
31148
31512
  "automation proposal snapshot to build from (defaults to the live proposal)"
31149
- ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, options) {
31513
+ ).option("--run-scope <scope>", RUN_SCOPE_OPTION_DESCRIPTION, parseRunScope).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, options) {
31150
31514
  const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
31151
31515
  const raw = await httpRequest({
31152
31516
  method: "POST",
@@ -31155,13 +31519,28 @@ function registerClarityBuildAutomation(clarity) {
31155
31519
  }),
31156
31520
  apiKey,
31157
31521
  apiBaseUrl,
31158
- body: options.proposalId ? { transformation_proposal_id: options.proposalId } : void 0
31522
+ body: options.proposalId || options.runScope ? {
31523
+ ...options.proposalId && {
31524
+ transformation_proposal_id: options.proposalId
31525
+ },
31526
+ ...options.runScope && { run_scope: options.runScope }
31527
+ } : void 0
31159
31528
  });
31529
+ const parsed = responseSchema5.safeParse(raw);
31160
31530
  if (options.json) {
31161
31531
  printJson(raw);
31532
+ }
31533
+ if (options.runScope === "team") {
31534
+ const acceptedRunId = parsed.data?.automation_run.id;
31535
+ assertRunScopeHonoured(
31536
+ options.runScope,
31537
+ parsed.data?.automation_run.run_scope,
31538
+ acceptedRunId ? `build run ${acceptedRunId}` : void 0
31539
+ );
31540
+ }
31541
+ if (options.json) {
31162
31542
  return;
31163
31543
  }
31164
- const parsed = responseSchema5.safeParse(raw);
31165
31544
  if (!parsed.success) {
31166
31545
  throw new CliError(
31167
31546
  `Unexpected response from the API: ${parsed.error.message}`
@@ -31171,7 +31550,8 @@ function registerClarityBuildAutomation(clarity) {
31171
31550
  console.log(
31172
31551
  renderKeyValue([
31173
31552
  { label: "Run ID", value: run.id },
31174
- { label: "Status", value: run.status }
31553
+ { label: "Status", value: run.status },
31554
+ { label: "Runs as", value: runScopeLabel(run.run_scope) }
31175
31555
  ])
31176
31556
  );
31177
31557
  }, "action"));
@@ -53033,6 +53413,39 @@ function formatTraceparent(traceId, parentSpanId) {
53033
53413
  }
53034
53414
  __name(formatTraceparent, "formatTraceparent");
53035
53415
  __name3(formatTraceparent, "formatTraceparent");
53416
+ var PREVIEW_PROJECT_NUMBER = "286048984292";
53417
+ var CLOUD_RUN_PREVIEW_HOST = /^([a-z0-9-]+)-taskcrew-fe-(\d+)\.europe-west1\.run\.app$/;
53418
+ var MAPPED_PREVIEW_HOST = /^monorepo-([a-z0-9-]+)\.taskcrew-staging\.ai$/;
53419
+ function previewAdminUrl(hostname) {
53420
+ const host = hostname.toLowerCase();
53421
+ const cloudRun = CLOUD_RUN_PREVIEW_HOST.exec(host);
53422
+ if (cloudRun) {
53423
+ const [, slug, projectNumber] = cloudRun;
53424
+ return `https://${slug}-admin-${projectNumber}.europe-west1.run.app`;
53425
+ }
53426
+ const mapped = MAPPED_PREVIEW_HOST.exec(host);
53427
+ return mapped ? `https://${mapped[1]}-admin-${PREVIEW_PROJECT_NUMBER}.europe-west1.run.app` : null;
53428
+ }
53429
+ __name(previewAdminUrl, "previewAdminUrl");
53430
+ __name3(previewAdminUrl, "previewAdminUrl");
53431
+ function adminUrl(environment, hostname) {
53432
+ const preview = previewAdminUrl(hostname);
53433
+ if (preview) {
53434
+ return preview;
53435
+ }
53436
+ if (hostname.toLowerCase() === "app.stg.duvo.ai") {
53437
+ return "https://admin.stg.duvo.ai";
53438
+ }
53439
+ if (hostname.toLowerCase() === "app.duvo.ai" || environment === "production") {
53440
+ return "https://admin.duvo.ai";
53441
+ }
53442
+ if (["localhost", "127.0.0.1"].includes(hostname.toLowerCase())) {
53443
+ return "http://localhost:3100";
53444
+ }
53445
+ return "https://admin.stg.duvo.ai";
53446
+ }
53447
+ __name(adminUrl, "adminUrl");
53448
+ __name3(adminUrl, "adminUrl");
53036
53449
  var AUDIT_CHANGE_CLASS = {
53037
53450
  team_member: "access_control",
53038
53451
  custom_role: "access_control",
@@ -53847,6 +54260,7 @@ var PERMISSION = {
53847
54260
  AUTOMATION_DETAILS_EDIT: "automation.details.edit",
53848
54261
  AUTOMATION_POLICY_MANAGE: "automation.policy.manage",
53849
54262
  AUTOMATION_CONVERT_TO_TEAM: "automation.convert_to_team",
54263
+ AUTOMATION_CREATE_TEAM: "automation.create_team",
53850
54264
  AUTOMATION_ATTRIBUTE_MANAGE: "automation.attribute.manage",
53851
54265
  ROUTINE_VIEW: "routine.view",
53852
54266
  ROUTINE_DECIDE: "routine.decide",
@@ -54656,6 +55070,13 @@ var TEAM_PERMISSION_META = {
54656
55070
  implies: [P4.AUTOMATION_VIEW],
54657
55071
  validScopes: SCOPES3
54658
55072
  },
55073
+ [P4.AUTOMATION_CREATE_TEAM]: {
55074
+ domain: D3.AUTOMATIONS,
55075
+ label: "Create automations that run as the team",
55076
+ help: "Create a new automation whose runs execute as the team, with shared Connections, Secrets and Logins only, instead of as each member.",
55077
+ implies: [P4.AUTOMATION_MANAGE],
55078
+ validScopes: SCOPES3
55079
+ },
54659
55080
  [P4.AUTOMATION_ATTRIBUTE_MANAGE]: {
54660
55081
  domain: D3.AUTOMATIONS,
54661
55082
  label: "Manage process attributes",
@@ -55138,6 +55559,7 @@ var LEAD_BUILDER_TIER = [
55138
55559
  P5.AGENT_MEMORY_MANAGE_OTHERS,
55139
55560
  P5.AGENT_PROMOTE_OTHERS,
55140
55561
  P5.APIKEY_MANAGE_OTHERS,
55562
+ P5.AUTOMATION_CREATE_TEAM,
55141
55563
  P5.AUTOMATION_MANAGE_OTHERS,
55142
55564
  P5.LOGIN_MANAGE,
55143
55565
  P5.PROCESS_COMPLETE,
@@ -56677,6 +57099,20 @@ var FEATURE_FLAG_CATALOGUE = {
56677
57099
  stage: "public_beta",
56678
57100
  description: "Enables the Suggestions tab in the assignment builder \u2014 a per-Assignment inbox of typed, evidence-backed improvement proposals (connection-correctness analysis this cycle) that users apply into the draft build or dismiss."
56679
57101
  },
57102
+ DPU_BURN_METERING: {
57103
+ key: "dpu_burn_metering",
57104
+ defaultValue: false,
57105
+ stage: "dev",
57106
+ stageEnrollmentExclusion: "Metering requires an explicit rollout.",
57107
+ description: "With the Automations flag on, meter Automation Runs that start while this flag is enabled. Enable after the serving backend and its rollback target both support metering."
57108
+ },
57109
+ DPU_BURN_RATE: {
57110
+ key: "dpu_burn_rate",
57111
+ defaultValue: false,
57112
+ stage: "dev",
57113
+ stageEnrollmentExclusion: "Customer DPU visibility requires an explicit rollout.",
57114
+ description: "Show customers their DPU usage on the Automations workspace when the Automations flag is on. Configure metering separately."
57115
+ },
56680
57116
  AUTOMATIONS: {
56681
57117
  key: "automations",
56682
57118
  defaultValue: false,
@@ -56715,6 +57151,12 @@ var FEATURE_FLAG_CATALOGUE = {
56715
57151
  implies: ["automations"],
56716
57152
  description: "Makes the Automations migration convert straight to revision semantics instead of the lite workspace. When off (the default), POST /automations/migrate writes automation containers only and stamps team.automations_migrated_at; when on, it also snapshots each automation's current live builds and queue routing as revision 1 and stamps team.automation_revisions_migrated_at. Trigger configs and recurring builder schedules are always folded into that snapshot as versioned declarations, so a team on versions never keeps them as live, unversioned legacy rows; one-time schedules, ones an agent set itself, timings versions cannot express and trigger types whose dispatch does not read the revision stay legacy rows. Turning versions off ('Turn off revisions') unfolds them again. This replaces AUTOMATION_VERSIONED_TRIGGERS_SCHEDULES (`automation_versioned_triggers_schedules`), which is no longer declared. It implied AUTOMATION_VERSIONING, so a subject that had only it on is given `automation_versioning` by hand in the admin before this release ships. Its own rows are left in the database and resolve nowhere in this code, so the admin lists it under db-only flags, where it should be cleared from. Only applies to a team that is still standalone \u2014 it is not the lite-to-versioned cutover, which resolves its groups from existing automation membership rather than by closure discovery. Resolved for the caller, user-level overrides included, as the button resolves it, and only consulted for a team that also has AUTOMATIONS on."
56717
57153
  },
57154
+ AUTOMATION_LIVE_CASE_PINS: {
57155
+ key: "automation_live_case_pins",
57156
+ defaultValue: false,
57157
+ stage: "dev",
57158
+ description: "Pins a versioned automation's cases to the live or historic revision they were created under, so each keeps following that revision's wiring after a newer revision goes live. When off (the default), only a case created by a draft run is pinned: it follows that exact revision for life, through activation and after it becomes historic. A run counts as a draft run while it belongs to an automation run that started on a draft (revision_status draft), carries its revision and either does not work a case that follows the live wiring or is the first run of a root automation run (a builder test started on a chosen case), so a test's cases created after its draft is activated are pinned too. Every other case on the team (one a live or historic run created, an imported or manual one) stays unpinned and follows the automation's live wiring, as on an automation without versions. The decision is made when a case is written and never revisited. With the flag off, a claim leaves an unpinned case unpinned, and its run takes the live revision rather than a parent run's pin; 'Run on live revision' and an activation that moves waiting cases unpin them instead of pinning them to the new live revision, except a case already pinned to the revision being activated, which keeps its pin. Switching the flag changes only cases written afterwards. Resolved at team scope with no user, because case dispatch has none. Has no effect on lite automations, which have no revisions to pin to."
57159
+ },
56718
57160
  AUTOMATION_CONVERSION_MEASUREMENT: {
56719
57161
  key: "automation_conversion_measurement",
56720
57162
  defaultValue: false,
@@ -57012,12 +57454,6 @@ var FEATURE_FLAG_CATALOGUE = {
57012
57454
  stage: "temporary",
57013
57455
  description: "Enables proactive OAuth access-token refresh for a team's Connections. When on, the minutely dispatcher refreshes tokens near expiry and cc-server replaces baked OAuth headers during long Runs. Cloud Tasks recheck the flag before each provider exchange, so turning it off also stops queued work. Off by default for staged team and organization rollout."
57014
57456
  },
57015
- CONNECTION_KEEP_ALIVE: {
57016
- key: "connection_keep_alive",
57017
- defaultValue: false,
57018
- stage: "temporary",
57019
- description: "Enables the daily Connection keep-alive cron for a team \u2014 a forced OAuth token exchange for that team's eligible Connections not exchanged for in 20h, which keeps refresh tokens from lapsing through inactivity and surfaces dead grants within a day. Resolved with FULL precedence (user, then team, then organization, then global), so an org-wide or global override DOES enroll teams: setting one enrolls every team that owns an eligible Connection, and is not a no-op. Enrolment is bounded to those owning teams rather than the whole database, and an explicit false at a narrower tier still wins. With nothing enabled the cron touches nothing while last_token_exchange_at fills in from run-triggered exchanges. The Cloud Scheduler job is a separate fleet-wide switch; this flag is what allows a staged rollout and per-team exclusion."
57020
- },
57021
57457
  NEW_AGENT_DEFAULT_KIMI_DUVO: {
57022
57458
  key: "new_agent_default_kimi_duvo",
57023
57459
  defaultValue: false,
@@ -64680,6 +65116,8 @@ var claritySizingSchema = z392.object({
64680
65116
  });
64681
65117
  var MONTHS_PER_YEAR = 12;
64682
65118
  var USD_PER_DPU = 1e3;
65119
+ var DPU_RUN_COST_MARKUP_PERCENT = 20;
65120
+ var DPU_RUN_COST_MULTIPLIER = 1 + DPU_RUN_COST_MARKUP_PERCENT / 100;
64683
65121
  function dpusPerMonth(timeSaved, formula) {
64684
65122
  if (timeSaved.timeSavedHoursPerMonth === null) {
64685
65123
  return null;
@@ -70057,7 +70495,7 @@ var INTEGRATION_DESCRIPTORS = [
70057
70495
  type: "case-queue-producer",
70058
70496
  name: "Queue (Producer)",
70059
70497
  icon_url: "/integration-icons/case-queue.svg",
70060
- description: "Add items to queues for processing by other agents or workflows. Provides tools: add_cases, get_case_schema, declare_case_schema, update_case_schema, list_cases, list_labels.",
70498
+ description: "Add items to queues for processing by other agents or workflows. Provides tools: add_cases, get_case_schema, declare_case_schema, update_case_schema, read_case_file, list_cases, list_labels, list_aggregations, evaluate_aggregation, get_aggregation_result, create_aggregation, refresh_aggregation, delete_aggregation.",
70061
70499
  category: "duvo-platform",
70062
70500
  oauth_provider_id: null
70063
70501
  },
@@ -70066,7 +70504,7 @@ var INTEGRATION_DESCRIPTORS = [
70066
70504
  type: "case-queue-consumer",
70067
70505
  name: "Queue (Consumer)",
70068
70506
  icon_url: "/integration-icons/case-queue.svg",
70069
- description: "Process items from queues and trigger automated workflows. Provides tools: claim_case, get_case_schema, complete_case, fail_case, postpone_case, update_case, list_cases, list_labels.",
70507
+ description: "Process items from queues and trigger automated workflows. Provides tools: claim_case, get_case_schema, complete_case, fail_case, postpone_case, update_case, set_case_fields, attach_case_file, read_case_file, list_cases, list_labels, list_aggregations, evaluate_aggregation, get_aggregation_result.",
70070
70508
  category: "duvo-platform",
70071
70509
  oauth_provider_id: null
70072
70510
  },
@@ -77253,7 +77691,10 @@ var adminModelUsageReasoningSeriesSchema = z932.object({
77253
77691
  var adminModelUsageResponseSchema = z932.object({
77254
77692
  /** When the counts were read, as an ISO 8601 timestamp. */
77255
77693
  asOf: z932.string(),
77256
- /** UTC days as `YYYY-MM-DD`, oldest first; the last is today. */
77694
+ /**
77695
+ * UTC days as `YYYY-MM-DD`, oldest first; the last is today. The last 24
77696
+ * hours span two of them, each counted only in part.
77697
+ */
77257
77698
  dates: z932.array(z932.string()),
77258
77699
  /** The organization the Runs belong to. */
77259
77700
  organization: z932.object({
@@ -77266,6 +77707,29 @@ var adminModelUsageResponseSchema = z932.object({
77266
77707
  /** One series per reasoning effort with at least one Run in the range. */
77267
77708
  reasoningEfforts: z932.array(adminModelUsageReasoningSeriesSchema)
77268
77709
  });
77710
+ var adminModelUsageAgentCostSchema = z932.object({
77711
+ agentId: z932.string(),
77712
+ name: z932.string(),
77713
+ /** The revision to open for the agent; null when it has none left. */
77714
+ buildId: z932.string().nullable(),
77715
+ /** Runs created in the range. */
77716
+ runs: countSchema2,
77717
+ /** Those of them with a recorded cost; older Runs have none. */
77718
+ costedRuns: countSchema2,
77719
+ /**
77720
+ * What those Runs spent on inference, in US dollars: every LLM call made
77721
+ * for them, whichever component made it.
77722
+ */
77723
+ inferenceCostUsd: z932.number().nonnegative()
77724
+ });
77725
+ var adminModelUsageAgentCostsResponseSchema = z932.object({
77726
+ /** Most expensive first, at most `ADMIN_MODEL_USAGE_AGENT_COST_LIMIT`. */
77727
+ agents: z932.array(adminModelUsageAgentCostSchema),
77728
+ /** Existing agents with a Run in the range, including any past the limit. */
77729
+ totalAgents: countSchema2,
77730
+ /** The inference cost of all of them, in US dollars. */
77731
+ totalInferenceCostUsd: z932.number().nonnegative()
77732
+ });
77269
77733
  var ADMIN_NOTIFICATION_LIST_DEFAULT_LIMIT = 50;
77270
77734
  var ADMIN_NOTIFICATION_LIST_MAX_LIMIT = 200;
77271
77735
  var ADMIN_NOTIFICATION_NO_TEAM = "none";
@@ -79041,7 +79505,14 @@ var scheduleApiSchema2 = z1102.object({
79041
79505
  id: z1102.string(),
79042
79506
  build_id: z1102.string(),
79043
79507
  agent_id: z1102.string(),
79044
- user_id: z1102.string(),
79508
+ /** The user the schedule runs as. Null on a shared schedule, which belongs to its Team automation and runs as the team. */
79509
+ user_id: z1102.string().nullable(),
79510
+ /**
79511
+ * The user who set the schedule up. Null when nobody recorded it, or the
79512
+ * profile was deleted. Optional so a response from an older server still
79513
+ * parses.
79514
+ */
79515
+ created_by: z1102.string().nullable().optional(),
79045
79516
  enabled: z1102.boolean(),
79046
79517
  frequency: scheduleFrequencySchema2,
79047
79518
  time: z1102.string().nullable(),
@@ -79547,7 +80018,14 @@ var clarityConversionContextInputSchema = z1152.discriminatedUnion(
79547
80018
  * Set by Module Setup's Approve and build: the module's own Automation,
79548
80019
  * which the build updates instead of creating a second one.
79549
80020
  */
79550
- targetAutomationId: z1152.guid().optional()
80021
+ targetAutomationId: z1152.guid().optional(),
80022
+ /**
80023
+ * Who the new Automation's runs execute as, picked beside Build
80024
+ * automation. The build's prepare step reads it for this attempt when
80025
+ * the model passes none. Never with `targetAutomationId`: a build into
80026
+ * an existing Automation keeps that Automation's scope.
80027
+ */
80028
+ runScope: runScopeSchema2.optional()
79551
80029
  })
79552
80030
  ]
79553
80031
  );
@@ -81299,7 +81777,7 @@ var caseQueueItemSchema2 = z1282.object({
81299
81777
  "The automation revision that produced the case. It never changes. Null when no Run created the case (added through the API or an import, or created before automation revisions), and on a team without automation revisions."
81300
81778
  ),
81301
81779
  automation_revision_id: z1282.guid().nullable().optional().describe(
81302
- "The automation revision that handles the case. It is set when a Run creates the case, set again to the revision that runs the case when a Run claims it, and otherwise changes only when an activation moves waiting cases. For a case that no Run created, null until a Run claims it or an activation moves it. Null on a team without automation revisions."
81780
+ "The automation revision the case is pinned to, whose routing handles it. A case a draft Run creates is pinned to that draft and keeps the pin after the draft goes live. Any other case is null, and follows the automation's live revision, unless its team pins cases to live revisions: then it is pinned to the revision of the Run that creates or first claims it. Moving a case to the live revision (Run on live revision, or an activation that moves waiting cases) pins it to that revision on such a team and clears the pin otherwise. Null on a team without automation revisions."
81303
81781
  ),
81304
81782
  automation_revision: caseRevisionPinSchema2.nullable().optional().describe(
81305
81783
  "The handling revision, resolved. Null when the case has no handling revision."
@@ -81584,7 +82062,9 @@ var caseBulkStatusUpdateResponseSchema2 = z1282.object({
81584
82062
  });
81585
82063
  var caseRunOnLiveRevisionResponseSchema2 = z1282.object({
81586
82064
  success: z1282.literal(true),
81587
- automation_revision_id: z1282.guid().describe("The live revision the case is now pinned to.")
82065
+ automation_revision_id: z1282.guid().describe(
82066
+ "The live revision the case now runs on. The case is pinned to it only on a team that pins cases to live revisions; otherwise it is left unpinned and follows the automation's live wiring."
82067
+ )
81588
82068
  });
81589
82069
  var caseBulkPriorityUpdateResponseSchema2 = z1282.object({
81590
82070
  updatedCount: z1282.number(),
@@ -81924,6 +82404,10 @@ var setProcessAttributeValueBodyApiSchema2 = z1292.discriminatedUnion(
81924
82404
  })
81925
82405
  ]
81926
82406
  );
82407
+ var AUTOMATION_RUN_SCOPES2 = ["personal", "team"];
82408
+ var createRunScopeRequestApiSchema2 = z1302.enum(AUTOMATION_RUN_SCOPES2).default("personal").describe(
82409
+ "Who the new automation's runs execute as: `personal` (the default) runs as each member with their own Connections; `team` runs as the team with shared Connections, Secrets and Logins only, and can't be changed back. `team` needs Lead Builder or above, the Team automations feature, a team on the Automations workspace and not on automation revisions, and Connection sharing on; read `GET /v2/teams/{teamId}/automations/run-scope-options` to see whether it is available and why not. Refused with 409 and the blocker's `code` when it isn't, or 403 `permission_required` for a caller below Lead Builder."
82410
+ );
81927
82411
  var automationSetupProgressApiSchema2 = z1302.object({
81928
82412
  has_captures: z1302.boolean(),
81929
82413
  has_process_map: z1302.boolean(),
@@ -81960,14 +82444,17 @@ var automationSummaryApiSchema2 = z1302.object({
81960
82444
  setup_progress: automationSetupProgressApiSchema2.nullable().default(null).describe(
81961
82445
  "The setup facts behind the tile's Setup badge \u2014 captures uploaded, the team's own process map generated, a proposal written \u2014 or null while the automation is not being set up (and whenever it has no module process for the facts to hang off)."
81962
82446
  ),
81963
- run_scope: z1302.enum(["personal", "team"]).optional().describe(
81964
- "Who the automation's runs execute as: its members, each with their own Connections (`personal`), or the team, with shared Connections only (`team`). An automation becomes `team` once, through convert-to-team, and never goes back. Optional because a backend that predates Team automations does not send it; a client treats absence as `personal` and offers no conversion."
82447
+ run_scope: z1302.enum(AUTOMATION_RUN_SCOPES2).optional().describe(
82448
+ "Who the automation's runs execute as: its members, each with their own Connections (`personal`), or the team, with shared Connections only (`team`). An automation is created as either, and a `personal` one can later be converted to `team`; a `team` one never goes back. Optional because a backend that predates Team automations does not send it; a client reads absence as `personal`."
81965
82449
  ),
81966
82450
  converted_to_team_at: z1302.string().nullable().optional().describe(
81967
- "When the automation was converted to run as the team, or null while it runs as its members."
82451
+ "When the automation was converted to run as the team, or null while it runs as its members or when it was created to run as the team."
81968
82452
  ),
81969
82453
  converted_by: z1302.guid().nullable().optional().describe(
81970
- "The member who converted the automation to run as the team, or null while it runs as its members or when that member is gone."
82454
+ "The member who converted the automation to run as the team, or null while it runs as its members, when it was created to run as the team, or when that member is gone."
82455
+ ),
82456
+ converted_by_name: z1302.string().nullable().optional().describe(
82457
+ "The display name of the member who converted the automation to run as the team, or null while it runs as its members, when that member is gone, or when they set no name. Never their email. Optional because an older backend does not send it."
81971
82458
  ),
81972
82459
  viewer_can_edit: z1302.boolean().optional().describe(
81973
82460
  "Whether the caller may change this automation. An automation takes its agents' ownership rule: a Builder may edit one whose every agent they created, and Lead Builder or above may edit any. Sent by the list and detail endpoints; absent from create and update responses, where the client falls back to the caller's role."
@@ -82160,6 +82647,11 @@ var duplicateAutomationResponseApiSchema2 = z1302.object({
82160
82647
  "The new automation: a copy of the source's live agents, builds, queues and the routing between them."
82161
82648
  )
82162
82649
  });
82650
+ var duplicateAutomationBodyApiSchema2 = z1302.object({
82651
+ run_scope: z1302.enum(AUTOMATION_RUN_SCOPES2).default("personal").describe(
82652
+ "Who the copy's runs execute as, whatever the original runs as: `personal` (the default) runs as each member with their own Connections; `team` runs as the team with shared Connections, Secrets and Logins only, and can't be changed back. `team` has the same requirements as creating an automation with `run_scope: team`: read `GET /v2/teams/{teamId}/automations/run-scope-options` to see whether it is available and why not. Refused with 409 and the blocker's `code` when it isn't, or 403 `permission_required` for a caller below Lead Builder."
82653
+ )
82654
+ }).default({ run_scope: "personal" });
82163
82655
  var TEAM_CONVERSION_BLOCKER_CODES2 = [
82164
82656
  "automations_workspace_required",
82165
82657
  "module_demo",
@@ -82180,6 +82672,37 @@ var teamConversionBlockerApiSchema2 = z1302.object({
82180
82672
  queue_automation_id: z1302.string().nullable(),
82181
82673
  queue_automation_name: z1302.string().nullable()
82182
82674
  });
82675
+ var TEAM_CREATION_BLOCKER_CODES2 = [
82676
+ "automations_workspace_required",
82677
+ "team_automations_flag_off",
82678
+ "automation_revisions",
82679
+ "connection_sharing_off",
82680
+ "permission_required"
82681
+ ];
82682
+ var runScopeOptionsResponseApiSchema2 = z1302.object({
82683
+ team: z1302.object({
82684
+ available: z1302.boolean().describe(
82685
+ "Whether the caller may create an automation that runs as the team (`run_scope: team`) in this team now."
82686
+ ),
82687
+ blocker: z1302.object({
82688
+ code: z1302.enum(TEAM_CREATION_BLOCKER_CODES2),
82689
+ message: z1302.string().describe("A sentence to show the user, saying what to do.")
82690
+ }).nullable().describe(
82691
+ "Why it isn't available, most fundamental first, or null when it is."
82692
+ )
82693
+ }).describe(
82694
+ "The `team` run scope. `personal` is always available to anyone who may create an automation."
82695
+ )
82696
+ });
82697
+ var runScopeOptionsClientResponseSchema2 = z1302.object({
82698
+ team: z1302.object({
82699
+ available: z1302.boolean(),
82700
+ blocker: z1302.object({
82701
+ code: z1302.string(),
82702
+ message: z1302.string()
82703
+ }).nullable()
82704
+ })
82705
+ });
82183
82706
  var teamConversionPreviewApiSchema2 = z1302.object({
82184
82707
  personal_rows: z1302.array(
82185
82708
  z1302.object({
@@ -82230,6 +82753,36 @@ var automationTeamConversionResponseApiSchema2 = z1302.object({
82230
82753
  blocker: teamConversionBlockerApiSchema2.nullable(),
82231
82754
  preview: teamConversionPreviewApiSchema2.nullable()
82232
82755
  });
82756
+ var teamConversionPublicPreviewApiSchema2 = z1302.object({
82757
+ personal_row_totals: teamConversionPreviewApiSchema2.shape.personal_row_totals.describe(
82758
+ "Members whose personal triggers and schedules on this automation conversion turns off, and how many of each."
82759
+ ),
82760
+ slots_without_team_connection: z1302.number().int().describe(
82761
+ "Connection slots across the automation's Agents with no team Connection; a Team run can't use them until one is shared."
82762
+ ),
82763
+ secrets_without_team_access: z1302.number().int().describe("Secrets the Agents use that a Team run can't read."),
82764
+ logins_without_team_access: z1302.number().int().describe("Logins the Agents use that a Team run can't read."),
82765
+ own_aop_exceptions: z1302.array(
82766
+ z1302.object({
82767
+ id: z1302.string(),
82768
+ agent_id: z1302.string(),
82769
+ agent_name: z1302.string(),
82770
+ label: z1302.string(),
82771
+ enabled: z1302.boolean()
82772
+ })
82773
+ ).describe(
82774
+ "The caller's own AOP exceptions on the automation. Pass their ids to convertAutomationToTeam to copy them as team exceptions."
82775
+ ),
82776
+ no_responsible_people: z1302.boolean().describe(
82777
+ "No Responsible people are named, so requests would go to the team's Owners and Administrators."
82778
+ ),
82779
+ pending_cases: z1302.number().int().describe("Pending cases a Team run would pick up.")
82780
+ });
82781
+ var automationTeamConversionPublicResponseApiSchema2 = z1302.object({
82782
+ convertible: z1302.boolean(),
82783
+ blocker: teamConversionBlockerApiSchema2.nullable(),
82784
+ preview: teamConversionPublicPreviewApiSchema2.nullable()
82785
+ });
82233
82786
  var automationTeamConversionClientResponseSchema2 = automationTeamConversionResponseApiSchema2.extend({
82234
82787
  blocker: teamConversionBlockerApiSchema2.extend({ code: z1302.string() }).nullable(),
82235
82788
  preview: teamConversionPreviewApiSchema2.extend({
@@ -83042,7 +83595,10 @@ var setUpModuleResponseApiSchema2 = z1322.object({
83042
83595
  link: z1322.string().nullable().describe(
83043
83596
  "Root-relative web-app path to the Automation's setup screen, or null when this viewer has no such tab."
83044
83597
  ),
83045
- url: z1322.string().nullable().describe("The full web-app URL of `link`.")
83598
+ url: z1322.string().nullable().describe("The full web-app URL of `link`."),
83599
+ run_scope: z1322.enum(["personal", "team"]).optional().describe(
83600
+ "Who the new Automation's runs execute as: each member (`personal`) or the team (`team`), as the request asked. Optional because a backend that predates run scopes does not send it; read absence as `personal`."
83601
+ )
83046
83602
  });
83047
83603
  var generateAutomationProposalRequestApiSchema2 = z1322.object({
83048
83604
  current_process_snapshot_id: z1322.guid().optional().describe(
@@ -87422,6 +87978,41 @@ var casesListRequestBodySchema2 = z173.object({
87422
87978
  include_blockers: z173.boolean().optional().describe(CASE_INCLUDE_BLOCKERS_DESCRIPTION2),
87423
87979
  fields: z173.array(z173.enum(CASE_LIST_SELECTABLE_FIELDS2)).min(1).optional().describe(CASE_LIST_FIELDS_DESCRIPTION2)
87424
87980
  });
87981
+ var RUN_CASE_LIST_SELECTABLE_FIELDS2 = [
87982
+ "id",
87983
+ "queue_id",
87984
+ "title",
87985
+ "data",
87986
+ "json_data",
87987
+ "json_schema_id",
87988
+ "status",
87989
+ "display_status",
87990
+ "priority",
87991
+ "labels",
87992
+ "claimed_at",
87993
+ "claimed_by_run_id",
87994
+ "completed_at",
87995
+ "postponed_to",
87996
+ "created_at",
87997
+ "updated_at"
87998
+ ];
87999
+ var MAX_RUN_LABEL_FILTER_KEYS2 = 20;
88000
+ var MAX_RUN_LABEL_FILTER_VALUES2 = 100;
88001
+ var runCasesFiltersSchema2 = casesFiltersSchema2.omit({ awaiting_my_approval: true }).extend({
88002
+ // Bounded here, not on the shared filters: each label key adds a
88003
+ // correlated subquery and each value an expression, and this route is
88004
+ // reachable with any run's key.
88005
+ labels: z173.record(z173.string(), z173.array(z173.string()).max(MAX_RUN_LABEL_FILTER_VALUES2)).refine(
88006
+ (labels) => Object.keys(labels).length <= MAX_RUN_LABEL_FILTER_KEYS2,
88007
+ `labels may name at most ${MAX_RUN_LABEL_FILTER_KEYS2} label keys`
88008
+ ).optional()
88009
+ }).strict();
88010
+ var runCasesSearchRequestBodySchema2 = casesListRequestBodySchema2.omit({ include_blockers: true }).extend({
88011
+ filters: runCasesFiltersSchema2.default({}),
88012
+ fields: z173.array(z173.enum(RUN_CASE_LIST_SELECTABLE_FIELDS2)).min(1).optional().describe(
88013
+ "Return only these keys on each case. `id` is always returned. Leaving out `data` and `json_data` skips reading the payload. Omit to return every key."
88014
+ )
88015
+ }).strict();
87425
88016
  function toBase642(input) {
87426
88017
  if (typeof btoa === "function") {
87427
88018
  return btoa(unescape(encodeURIComponent(input)));
@@ -90798,7 +91389,7 @@ __name(isStandaloneBinary, "isStandaloneBinary");
90798
91389
  import { createRequire } from "node:module";
90799
91390
  function getPackageMeta() {
90800
91391
  if (true) {
90801
- return { name: "@duvoai/cli", version: "1.115.0" };
91392
+ return { name: "@duvoai/cli", version: "1.118.0" };
90802
91393
  }
90803
91394
  const require2 = createRequire(import.meta.url);
90804
91395
  const raw = require2("../../package.json");