@duvoai/cli 1.3.0 → 1.4.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.
package/dist/bin/duvo.js CHANGED
@@ -99,6 +99,7 @@ import { z as z61 } from "zod";
99
99
  import { z as z62 } from "zod";
100
100
  import { z as z63 } from "zod";
101
101
  import { z as z64 } from "zod";
102
+ import { z as z65 } from "zod";
102
103
 
103
104
  // ../node_modules/.pnpm/jsonrepair@3.13.2/node_modules/jsonrepair/lib/esm/utils/JSONRepairError.js
104
105
  var JSONRepairError = class extends Error {
@@ -1659,7 +1660,8 @@ var evalSummarySchema = z8.object({
1659
1660
  });
1660
1661
  var evalFlagCountSchema = z8.object({
1661
1662
  flag: z8.string(),
1662
- count: z8.int()
1663
+ count: z8.int(),
1664
+ label: z8.string().nullable().optional()
1663
1665
  });
1664
1666
  var evalScoresResponseSchema = z8.object({
1665
1667
  total_evaluated: z8.int(),
@@ -1674,7 +1676,9 @@ var evalCountsByAgentResponseSchema = z8.object({
1674
1676
  by_agent: z8.record(z8.string(), evalCountsSchema)
1675
1677
  });
1676
1678
  var summarizeEvalScoresBodySchema = z8.object({
1677
- since: z8.iso.datetime()
1679
+ since: z8.iso.datetime(),
1680
+ /** `"custom"` restricts to live-build runs + `custom__*` flags only. */
1681
+ scope: z8.enum(["all", "custom"]).optional()
1678
1682
  });
1679
1683
  var summarizeEvalScoresResponseSchema = z8.object({
1680
1684
  data: z8.object({
@@ -1714,6 +1718,7 @@ var AGENT_RUN_SOURCES = [
1714
1718
  "handover",
1715
1719
  "postpone",
1716
1720
  "delegate",
1721
+ "reprocess",
1717
1722
  "trigger"
1718
1723
  ];
1719
1724
  var agentRunSourceSchema = z9.enum(AGENT_RUN_SOURCES);
@@ -1746,6 +1751,7 @@ var SOURCE_TO_INITIATOR = {
1746
1751
  handover: "handover",
1747
1752
  postpone: "case-queue",
1748
1753
  delegate: "case-queue",
1754
+ reprocess: "case-queue",
1749
1755
  trigger: "trigger"
1750
1756
  };
1751
1757
  function mapSourceToInitiator(source) {
@@ -2044,24 +2050,6 @@ var BUILD_STATUS = {
2044
2050
  LIVE: "live",
2045
2051
  HISTORIC: "historic"
2046
2052
  };
2047
- var CASE_QUEUE_ITEM_STATUS = {
2048
- PENDING: "pending",
2049
- CLAIMED: "claimed",
2050
- COMPLETED: "completed",
2051
- FAILED: "failed"
2052
- };
2053
- var RETRYABLE_CASE_STATUSES = [
2054
- CASE_QUEUE_ITEM_STATUS.COMPLETED,
2055
- CASE_QUEUE_ITEM_STATUS.FAILED,
2056
- CASE_QUEUE_ITEM_STATUS.CLAIMED
2057
- ];
2058
- function isRetryableCaseStatus(status) {
2059
- return RETRYABLE_CASE_STATUSES.includes(
2060
- status
2061
- );
2062
- }
2063
- __name(isRetryableCaseStatus, "isRetryableCaseStatus");
2064
- __name2(isRetryableCaseStatus, "isRetryableCaseStatus");
2065
2053
  var ALL_EVALUATION_RUBRIC_SEVERITIES = [
2066
2054
  "critical",
2067
2055
  "medium",
@@ -2339,6 +2327,7 @@ var ALL_EVALUATION_RUBRIC_KEYS = Object.keys(
2339
2327
  var PLATFORM_DEFAULT_EVAL_RUBRIC_KEYS = ALL_EVALUATION_RUBRIC_KEYS.filter(
2340
2328
  (k) => EVALUATION_RUBRIC_CATALOG[k].is_default
2341
2329
  );
2330
+ var EVALUATION_FINAL_COMMENT_KEY = "final_comment";
2342
2331
  var EVALUATION_SEVERITY_KEY_SUFFIX = "_severity";
2343
2332
  var EVALUATION_REASON_KEY_SUFFIX = "_reason";
2344
2333
  function getRubricSeverityKey(key) {
@@ -2361,6 +2350,23 @@ function isEvaluationRubricKey(value) {
2361
2350
  }
2362
2351
  __name(isEvaluationRubricKey, "isEvaluationRubricKey");
2363
2352
  __name2(isEvaluationRubricKey, "isEvaluationRubricKey");
2353
+ var CUSTOM_RUBRIC_KEY_PREFIX = "custom__";
2354
+ function isCustomRubricKey(key) {
2355
+ return key.startsWith(CUSTOM_RUBRIC_KEY_PREFIX);
2356
+ }
2357
+ __name(isCustomRubricKey, "isCustomRubricKey");
2358
+ __name2(isCustomRubricKey, "isCustomRubricKey");
2359
+ function isFailingFlag(key, value) {
2360
+ if (key === EVALUATION_FINAL_COMMENT_KEY) {
2361
+ return false;
2362
+ }
2363
+ if (typeof value !== "boolean") {
2364
+ return false;
2365
+ }
2366
+ return isCustomRubricKey(key) ? !value : value;
2367
+ }
2368
+ __name(isFailingFlag, "isFailingFlag");
2369
+ __name2(isFailingFlag, "isFailingFlag");
2364
2370
  var EVALUATION_RUBRIC_KEYS_BY_CAUSE = (() => {
2365
2371
  const mutable = {
2366
2372
  sop_gap: [],
@@ -2664,12 +2670,17 @@ var clarityProcessVersionSchema = z12.union([
2664
2670
  z12.literal(1),
2665
2671
  z12.literal(2)
2666
2672
  ]);
2673
+ var CLARITY_PROCESS_VISIBILITIES = ["team", "restricted"];
2674
+ var clarityProcessVisibilitySchema = z12.enum(
2675
+ CLARITY_PROCESS_VISIBILITIES
2676
+ );
2667
2677
  var clarityProcessSchema = z12.object({
2668
2678
  id: z12.guid(),
2669
2679
  teamId: z12.guid(),
2670
2680
  userId: z12.guid(),
2671
2681
  name: z12.string(),
2672
2682
  status: clarityProcessStatusSchema,
2683
+ visibility: clarityProcessVisibilitySchema,
2673
2684
  /** 1 = legacy, 2 = v2. */
2674
2685
  version: z12.number().int(),
2675
2686
  analysis: clarityAnalysisResponseSchema.nullable(),
@@ -2684,6 +2695,7 @@ var clarityProcessListItemSchema = z12.object({
2684
2695
  teamName: z12.string().optional(),
2685
2696
  name: z12.string(),
2686
2697
  status: clarityProcessStatusSchema,
2698
+ visibility: clarityProcessVisibilitySchema,
2687
2699
  version: z12.number().int(),
2688
2700
  captureCount: z12.number(),
2689
2701
  captureCounts: z12.object({
@@ -2757,7 +2769,8 @@ var createClarityProcessResponseSchema = z12.object({
2757
2769
  });
2758
2770
  var updateClarityProcessSchema = z12.object({
2759
2771
  name: z12.string().min(1).max(255).optional(),
2760
- customPrompt: z12.string().max(5e3).nullable().optional()
2772
+ customPrompt: z12.string().max(5e3).nullable().optional(),
2773
+ visibility: clarityProcessVisibilitySchema.optional()
2761
2774
  });
2762
2775
  var INTERVIEW_LANGUAGES = [
2763
2776
  "en",
@@ -3510,6 +3523,9 @@ var clarityV2ProcessReadModelSchema = z15.object({
3510
3523
  user_id: z15.guid().describe("Creator user id"),
3511
3524
  name: z15.string().describe("Process name"),
3512
3525
  status: clarityProcessStatusSchema.describe("Lifecycle status"),
3526
+ visibility: clarityProcessVisibilitySchema.describe(
3527
+ "Process visibility. 'team' is workspace-visible to full members; 'restricted' is visible to the creator, org admins, workspace managers/admins, and accepted grant holders."
3528
+ ),
3513
3529
  version: z15.number().int().describe("Schema version (always 2 here)"),
3514
3530
  generation_error: z15.string().nullable().describe("Error message from the most recent failed generation, if any"),
3515
3531
  generation_progress: generationProgressSchema.nullable().describe(
@@ -3660,6 +3676,31 @@ function getClarityProcessRoomName(processId) {
3660
3676
  }
3661
3677
  __name(getClarityProcessRoomName, "getClarityProcessRoomName");
3662
3678
  __name2(getClarityProcessRoomName, "getClarityProcessRoomName");
3679
+ var clarityExportStatusSchema = z17.enum([
3680
+ "queued",
3681
+ "running",
3682
+ "succeeded",
3683
+ "failed"
3684
+ ]);
3685
+ var clarityExportResultSchema = z17.object({
3686
+ diagramId: z17.string().optional(),
3687
+ diagramName: z17.string().optional(),
3688
+ folderId: z17.string().optional()
3689
+ });
3690
+ var clarityExportBaseSchema = z17.object({
3691
+ processId: z17.guid(),
3692
+ exportRunId: z17.guid()
3693
+ });
3694
+ var clarityExportProgressEventDataSchema = clarityExportBaseSchema.extend({
3695
+ status: clarityExportStatusSchema,
3696
+ label: z17.string().optional()
3697
+ });
3698
+ var clarityExportCompletedEventDataSchema = clarityExportBaseSchema.extend({
3699
+ result: clarityExportResultSchema
3700
+ });
3701
+ var clarityExportFailedEventDataSchema = clarityExportBaseSchema.extend({
3702
+ error: z17.string()
3703
+ });
3663
3704
  var clarityProcessChatConversationStatusSchema = z18.enum([
3664
3705
  "open",
3665
3706
  "running",
@@ -4041,6 +4082,138 @@ function makeSentryReporter(sentry) {
4041
4082
  }
4042
4083
  __name(makeSentryReporter, "makeSentryReporter");
4043
4084
  __name2(makeSentryReporter, "makeSentryReporter");
4085
+ var MAX_BLOCKED_DOMAINS = 1e3;
4086
+ var MAX_GUARDRAILS_TEXT_LENGTH = 2e4;
4087
+ var DOMAIN_LABEL = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
4088
+ function stripToHost(value) {
4089
+ if (/^[a-z][a-z0-9+.-]*:\/\//.test(value)) {
4090
+ try {
4091
+ return new URL(value).hostname;
4092
+ } catch {
4093
+ return value;
4094
+ }
4095
+ }
4096
+ const pathStart = ["/", "?", "#"].reduce((idx, ch) => {
4097
+ const at = value.indexOf(ch);
4098
+ return at !== -1 && (idx === -1 || at < idx) ? at : idx;
4099
+ }, -1);
4100
+ const withoutPath = pathStart === -1 ? value : value.slice(0, pathStart);
4101
+ const portStart = withoutPath.indexOf(":");
4102
+ return portStart === -1 ? withoutPath : withoutPath.slice(0, portStart);
4103
+ }
4104
+ __name(stripToHost, "stripToHost");
4105
+ __name2(stripToHost, "stripToHost");
4106
+ function normalizeBlockedDomain(input) {
4107
+ const trimmed = input.trim().toLowerCase();
4108
+ if (trimmed.length === 0) {
4109
+ return { ok: false, reason: "Empty line" };
4110
+ }
4111
+ const host = stripToHost(trimmed);
4112
+ if (host.includes("*")) {
4113
+ return {
4114
+ ok: false,
4115
+ reason: "Wildcards are not needed \u2014 entering `acme.com` blocks acme.com and all subdomains"
4116
+ };
4117
+ }
4118
+ const normalized = host.replace(/\.$/, "");
4119
+ const wwwStripped = normalized.startsWith("www.") ? normalized.slice(4) : normalized;
4120
+ const candidate = wwwStripped.includes(".") ? wwwStripped : normalized;
4121
+ if (!candidate.includes(".")) {
4122
+ return {
4123
+ ok: false,
4124
+ reason: "Not a valid domain \u2014 must contain at least one dot"
4125
+ };
4126
+ }
4127
+ const labels = candidate.split(".");
4128
+ for (const label of labels) {
4129
+ if (!DOMAIN_LABEL.test(label)) {
4130
+ return {
4131
+ ok: false,
4132
+ reason: `"${label}" is not a valid domain label`
4133
+ };
4134
+ }
4135
+ }
4136
+ return { ok: true, value: candidate };
4137
+ }
4138
+ __name(normalizeBlockedDomain, "normalizeBlockedDomain");
4139
+ __name2(normalizeBlockedDomain, "normalizeBlockedDomain");
4140
+ function parseBlockedDomainsList(text3) {
4141
+ const seen = /* @__PURE__ */ new Set();
4142
+ const domains = [];
4143
+ const errors = [];
4144
+ const lines = text3.split(/\r?\n/);
4145
+ for (let i = 0; i < lines.length; i += 1) {
4146
+ const raw = lines[i];
4147
+ if (raw.trim().length === 0) {
4148
+ continue;
4149
+ }
4150
+ const result = normalizeBlockedDomain(raw);
4151
+ if (!result.ok) {
4152
+ errors.push({ line: i + 1, input: raw, reason: result.reason });
4153
+ continue;
4154
+ }
4155
+ if (seen.has(result.value)) {
4156
+ continue;
4157
+ }
4158
+ seen.add(result.value);
4159
+ domains.push(result.value);
4160
+ }
4161
+ return { domains, errors };
4162
+ }
4163
+ __name(parseBlockedDomainsList, "parseBlockedDomainsList");
4164
+ __name2(parseBlockedDomainsList, "parseBlockedDomainsList");
4165
+ function domainToCdpBlockPatterns(domain) {
4166
+ return [
4167
+ `*://${domain}/*`,
4168
+ `*://${domain}:*/*`,
4169
+ `*://${domain}./*`,
4170
+ `*://${domain}.:*/*`,
4171
+ `*://*.${domain}/*`,
4172
+ `*://*.${domain}:*/*`,
4173
+ `*://*.${domain}./*`,
4174
+ `*://*.${domain}.:*/*`
4175
+ ];
4176
+ }
4177
+ __name(domainToCdpBlockPatterns, "domainToCdpBlockPatterns");
4178
+ __name2(domainToCdpBlockPatterns, "domainToCdpBlockPatterns");
4179
+ function blockedDomainsToCdpPatterns(domains) {
4180
+ return domains.flatMap(domainToCdpBlockPatterns);
4181
+ }
4182
+ __name(blockedDomainsToCdpPatterns, "blockedDomainsToCdpPatterns");
4183
+ __name2(blockedDomainsToCdpPatterns, "blockedDomainsToCdpPatterns");
4184
+ function isUrlBlocked(url, blockedDomains) {
4185
+ if (blockedDomains.length === 0) {
4186
+ return { blocked: false };
4187
+ }
4188
+ let host;
4189
+ try {
4190
+ host = new URL(url).hostname.toLowerCase().replace(/\.$/, "");
4191
+ } catch {
4192
+ return { blocked: false };
4193
+ }
4194
+ for (const domain of blockedDomains) {
4195
+ if (host === domain || host.endsWith(`.${domain}`)) {
4196
+ return { blocked: true, matchedDomain: domain, host };
4197
+ }
4198
+ }
4199
+ return { blocked: false };
4200
+ }
4201
+ __name(isUrlBlocked, "isUrlBlocked");
4202
+ __name2(isUrlBlocked, "isUrlBlocked");
4203
+ function blockedDomainAgentErrorMessage(args) {
4204
+ const { host, matchedDomain } = args;
4205
+ const domainLine = host === matchedDomain ? `"${host}" is on this team's browser blocklist` : `"${host}" matches the blocklist entry "${matchedDomain}" (subdomain match)`;
4206
+ return [
4207
+ `A team admin has restricted access to this domain: ${domainLine}, so it cannot be accessed.`,
4208
+ "",
4209
+ "What to do:",
4210
+ "- Check that you're using the correct URLs in your SOP \u2014 you may be pointing at the wrong site or have a typo in the domain.",
4211
+ `- If you genuinely need this domain, contact your team admin to update Team Settings \u2192 Guardrails (currently blocks "${matchedDomain}").`,
4212
+ "- Do NOT attempt to bypass this restriction by reformatting the URL, using a proxy, or other workarounds \u2014 the request will continue to fail."
4213
+ ].join("\n");
4214
+ }
4215
+ __name(blockedDomainAgentErrorMessage, "blockedDomainAgentErrorMessage");
4216
+ __name2(blockedDomainAgentErrorMessage, "blockedDomainAgentErrorMessage");
4044
4217
  var ORG_ROLE = {
4045
4218
  EXECUTIVE: "organization:executive",
4046
4219
  OWNER: "organization:owner",
@@ -5873,6 +6046,7 @@ var caseQueueItemEventSchema = z43.object({
5873
6046
  agent_run_id: z43.guid().nullable(),
5874
6047
  human_request_id: z43.guid().nullable(),
5875
6048
  type: z43.string(),
6049
+ reason: z43.string().nullable(),
5876
6050
  created_at: z43.string(),
5877
6051
  agent_id: z43.guid().nullable(),
5878
6052
  agent_name: z43.string().nullable(),
@@ -6006,13 +6180,22 @@ var caseBulkDeleteResponseSchema = z43.object({
6006
6180
  deletedCount: z43.number(),
6007
6181
  interruptedRunIds: z43.array(z43.guid())
6008
6182
  });
6009
- var caseBulkRetryResponseSchema = z43.object({
6010
- retriedCount: z43.number(),
6011
- skippedCount: z43.number()
6012
- });
6013
- var caseBulkDelegateResponseSchema = z43.object({
6014
- delegatedCount: z43.number(),
6015
- skippedCount: z43.number()
6183
+ var caseBulkReprocessResponseSchema = z43.object({
6184
+ reprocessedCount: z43.number(),
6185
+ skippedCount: z43.number(),
6186
+ // Deprecated aliases of `reprocessedCount`, both equal to it. Returned so
6187
+ // clients 308-redirected here from the deprecated `bulk-delegate` /
6188
+ // `bulk-retry` endpoints still find their original field. Optional +
6189
+ // `deprecated` so consumers don't couple to them; removed with those aliases
6190
+ // at the 2026-06-10 sunset.
6191
+ delegatedCount: z43.number().meta({
6192
+ deprecated: true,
6193
+ description: "Deprecated alias of reprocessedCount, kept for clients redirected from bulk-delegate. Removed on 2026-06-10."
6194
+ }).optional(),
6195
+ retriedCount: z43.number().meta({
6196
+ deprecated: true,
6197
+ description: "Deprecated alias of reprocessedCount, kept for clients redirected from bulk-retry. Removed on 2026-06-10."
6198
+ }).optional()
6016
6199
  });
6017
6200
  var caseBulkStatusUpdateResponseSchema = z43.object({
6018
6201
  updatedCount: z43.number(),
@@ -6401,9 +6584,6 @@ var acceptJoinLinkResponseSchema = z45.object({
6401
6584
  var createClarityProcessInviteLinkRequestSchema = z46.object({
6402
6585
  frontendUrl: z46.url()
6403
6586
  });
6404
- var getClarityProcessInviteLinkQuerySchema = z46.object({
6405
- frontendUrl: z46.url()
6406
- });
6407
6587
  var clarityProcessInviteLinkSchema = teamInviteLinkSchema;
6408
6588
  var getClarityProcessInviteLinkResponseSchema = z46.object({
6409
6589
  hasLink: z46.boolean(),
@@ -7358,7 +7538,14 @@ var RunConfigSchema = AgentConfigSchema.extend({
7358
7538
  conversationHistory: z57.array(ThreadContextMessageSchema).optional(),
7359
7539
  chatFiles: z57.array(ChatFileReferenceSchema).optional(),
7360
7540
  /** IANA timezone (e.g. `"Europe/Prague"`). Consumers should fall back to UTC when absent. */
7361
- timezone: z57.string().optional()
7541
+ timezone: z57.string().optional(),
7542
+ /**
7543
+ * ISO 8601 timestamp captured when the run was created. Frozen at
7544
+ * run-creation time and never recomputed, so resumes reuse the same value —
7545
+ * the runtime injects it into the cached system prompt and a changing value
7546
+ * would bust the prompt cache.
7547
+ */
7548
+ sessionStartedAt: z57.string().optional()
7362
7549
  });
7363
7550
  var StoredRunConfigV0Schema = z57.object({
7364
7551
  version: z57.literal("v0")
@@ -7633,73 +7820,101 @@ var teamInsightsUsersResponseSchema = z61.object({
7633
7820
  data: z61.array(teamInsightsUserWithAgentsAndRunsSchema),
7634
7821
  total: z61.number()
7635
7822
  });
7636
- var userDismissalListResponseSchema = z62.object({
7637
- data: z62.array(z62.string())
7823
+ var guardrailsAuthorSchema = z62.object({
7824
+ id: z62.guid(),
7825
+ name: z62.string().nullable(),
7826
+ email: z62.email()
7827
+ });
7828
+ var guardrailsRevisionSchema = z62.object({
7829
+ id: z62.guid(),
7830
+ teamId: z62.guid(),
7831
+ guardrailsText: z62.string().nullable(),
7832
+ blockedDomains: z62.array(z62.string()),
7833
+ createdAt: z62.string(),
7834
+ createdBy: guardrailsAuthorSchema
7835
+ });
7836
+ var getTeamGuardrailsResponseSchema = z62.object({
7837
+ current: guardrailsRevisionSchema.nullable()
7838
+ });
7839
+ var listTeamGuardrailsRevisionsQuerySchema = z62.object({
7840
+ limit: z62.coerce.number().int().min(1).max(100).default(20),
7841
+ offset: z62.coerce.number().int().min(0).default(0)
7842
+ });
7843
+ var listTeamGuardrailsRevisionsResponseSchema = z62.object({
7844
+ revisions: z62.array(guardrailsRevisionSchema),
7845
+ total: z62.number().int().nonnegative()
7846
+ });
7847
+ var createTeamGuardrailsRevisionRequestSchema = z62.object({
7848
+ guardrailsText: z62.string().max(MAX_GUARDRAILS_TEXT_LENGTH).nullable().transform((value) => value && value.trim().length > 0 ? value : null),
7849
+ blockedDomains: z62.array(z62.string()).max(MAX_BLOCKED_DOMAINS)
7850
+ });
7851
+ var userDismissalListResponseSchema = z63.object({
7852
+ data: z63.array(z63.string())
7638
7853
  });
7639
- var userDismissalMutationSchema = z62.object({
7640
- elementKey: z62.string()
7854
+ var userDismissalMutationSchema = z63.object({
7855
+ elementKey: z63.string()
7641
7856
  });
7642
7857
  var PASSWORD_MIN = 1;
7643
7858
  var PASSWORD_MAX = 1024;
7644
7859
  var NAME_MAX = 200;
7645
7860
  var URL_MAX = 500;
7646
7861
  var USERNAME_MAX = 200;
7647
- var vpnProxyConfigSummarySchema = z63.object({
7648
- id: z63.guid(),
7649
- name: z63.string(),
7650
- server: z63.string(),
7651
- username: z63.string(),
7652
- enabled: z63.boolean(),
7653
- passwordSet: z63.boolean(),
7654
- organizationCount: z63.number().int().nonnegative(),
7655
- createdAt: z63.string(),
7656
- updatedAt: z63.string()
7657
- });
7658
- var vpnProxyConfigListResponseSchema = z63.object({
7659
- configs: z63.array(vpnProxyConfigSummarySchema)
7660
- });
7661
- var vpnProxyConfigCreateRequestSchema = z63.object({
7662
- name: z63.string().trim().min(1).max(NAME_MAX),
7663
- server: z63.string().trim().min(1).max(URL_MAX).url(),
7664
- username: z63.string().trim().min(1).max(USERNAME_MAX),
7665
- password: z63.string().min(PASSWORD_MIN).max(PASSWORD_MAX),
7666
- enabled: z63.boolean().prefault(true)
7667
- });
7668
- var vpnProxyConfigCreateResponseSchema = z63.object({
7862
+ var vpnProxyConfigSummarySchema = z64.object({
7863
+ id: z64.guid(),
7864
+ name: z64.string(),
7865
+ server: z64.string(),
7866
+ username: z64.string(),
7867
+ enabled: z64.boolean(),
7868
+ passwordSet: z64.boolean(),
7869
+ organizationCount: z64.number().int().nonnegative(),
7870
+ createdAt: z64.string(),
7871
+ updatedAt: z64.string()
7872
+ });
7873
+ var vpnProxyConfigListResponseSchema = z64.object({
7874
+ configs: z64.array(vpnProxyConfigSummarySchema)
7875
+ });
7876
+ var vpnProxyConfigCreateRequestSchema = z64.object({
7877
+ name: z64.string().trim().min(1).max(NAME_MAX),
7878
+ server: z64.string().trim().min(1).max(URL_MAX).url(),
7879
+ username: z64.string().trim().min(1).max(USERNAME_MAX),
7880
+ password: z64.string().min(PASSWORD_MIN).max(PASSWORD_MAX),
7881
+ enabled: z64.boolean().prefault(true)
7882
+ });
7883
+ var vpnProxyConfigCreateResponseSchema = z64.object({
7669
7884
  config: vpnProxyConfigSummarySchema
7670
7885
  });
7671
- var vpnProxyConfigUpdateRequestSchema = z63.object({
7672
- name: z63.string().trim().min(1).max(NAME_MAX).optional(),
7673
- server: z63.string().trim().min(1).max(URL_MAX).url().optional(),
7674
- username: z63.string().trim().min(1).max(USERNAME_MAX).optional(),
7675
- password: z63.string().min(PASSWORD_MIN).max(PASSWORD_MAX).optional(),
7676
- enabled: z63.boolean().optional()
7886
+ var vpnProxyConfigUpdateRequestSchema = z64.object({
7887
+ name: z64.string().trim().min(1).max(NAME_MAX).optional(),
7888
+ server: z64.string().trim().min(1).max(URL_MAX).url().optional(),
7889
+ username: z64.string().trim().min(1).max(USERNAME_MAX).optional(),
7890
+ password: z64.string().min(PASSWORD_MIN).max(PASSWORD_MAX).optional(),
7891
+ enabled: z64.boolean().optional()
7677
7892
  });
7678
- var vpnProxyConfigUpdateResponseSchema = z63.object({
7893
+ var vpnProxyConfigUpdateResponseSchema = z64.object({
7679
7894
  config: vpnProxyConfigSummarySchema
7680
7895
  });
7681
- var vpnProxyConfigDeleteResponseSchema = z63.object({
7682
- success: z63.literal(true)
7896
+ var vpnProxyConfigDeleteResponseSchema = z64.object({
7897
+ success: z64.literal(true)
7683
7898
  });
7684
- var vpnProxyConfigOrganizationSchema = z63.object({
7685
- id: z63.guid(),
7686
- organizationId: z63.guid(),
7687
- organizationName: z63.string(),
7688
- attachedAt: z63.string()
7899
+ var vpnProxyConfigOrganizationSchema = z64.object({
7900
+ id: z64.guid(),
7901
+ organizationId: z64.guid(),
7902
+ organizationName: z64.string(),
7903
+ attachedAt: z64.string()
7689
7904
  });
7690
- var vpnProxyConfigOrganizationListResponseSchema = z63.object({
7691
- organizations: z63.array(vpnProxyConfigOrganizationSchema)
7905
+ var vpnProxyConfigOrganizationListResponseSchema = z64.object({
7906
+ organizations: z64.array(vpnProxyConfigOrganizationSchema)
7692
7907
  });
7693
- var vpnProxyConfigAttachOrganizationRequestSchema = z63.object({
7694
- organizationId: z63.guid()
7908
+ var vpnProxyConfigAttachOrganizationRequestSchema = z64.object({
7909
+ organizationId: z64.guid()
7695
7910
  });
7696
- var vpnProxyConfigAttachOrganizationResponseSchema = z63.object({
7911
+ var vpnProxyConfigAttachOrganizationResponseSchema = z64.object({
7697
7912
  attachment: vpnProxyConfigOrganizationSchema
7698
7913
  });
7699
- var vpnProxyConfigDetachOrganizationResponseSchema = z63.object({
7700
- success: z63.literal(true)
7914
+ var vpnProxyConfigDetachOrganizationResponseSchema = z64.object({
7915
+ success: z64.literal(true)
7701
7916
  });
7702
- var vpnProxyConfigForOrganizationResponseSchema = z63.object({
7917
+ var vpnProxyConfigForOrganizationResponseSchema = z64.object({
7703
7918
  config: vpnProxyConfigSummarySchema.nullable()
7704
7919
  });
7705
7920
  function canonicalizeSopInput(config) {
@@ -7720,7 +7935,7 @@ function canonicalizeSopInput(config) {
7720
7935
  }
7721
7936
  __name(canonicalizeSopInput, "canonicalizeSopInput");
7722
7937
  __name2(canonicalizeSopInput, "canonicalizeSopInput");
7723
- var caseFilterStatusSchema = z64.enum([
7938
+ var caseFilterStatusSchema = z65.enum([
7724
7939
  "pending",
7725
7940
  "claimed",
7726
7941
  "completed",
@@ -7728,19 +7943,19 @@ var caseFilterStatusSchema = z64.enum([
7728
7943
  "needs_input",
7729
7944
  "postponed"
7730
7945
  ]);
7731
- var casesFiltersSchema = z64.object({
7732
- status: z64.array(caseFilterStatusSchema).optional(),
7733
- created_at_from: z64.string().optional(),
7734
- updated_at_from: z64.string().optional(),
7735
- labels: z64.record(z64.string(), z64.array(z64.string())).optional()
7946
+ var casesFiltersSchema = z65.object({
7947
+ status: z65.array(caseFilterStatusSchema).optional(),
7948
+ created_at_from: z65.string().optional(),
7949
+ updated_at_from: z65.string().optional(),
7950
+ labels: z65.record(z65.string(), z65.array(z65.string())).optional()
7736
7951
  });
7737
- var casesListRequestBodySchema = z64.object({
7952
+ var casesListRequestBodySchema = z65.object({
7738
7953
  filters: casesFiltersSchema.default({}),
7739
- limit: z64.int().min(1).max(100).default(25),
7740
- offset: z64.int().min(0).default(0),
7741
- sort_by: z64.enum(["created_at", "updated_at", "postponed_to"]).default("created_at"),
7742
- sort_order: z64.enum(["asc", "desc"]).default("desc"),
7743
- search: z64.string().optional()
7954
+ limit: z65.int().min(1).max(100).default(25),
7955
+ offset: z65.int().min(0).default(0),
7956
+ sort_by: z65.enum(["created_at", "updated_at", "postponed_to"]).default("created_at"),
7957
+ sort_order: z65.enum(["asc", "desc"]).default("desc"),
7958
+ search: z65.string().optional()
7744
7959
  });
7745
7960
  function toBase64(input) {
7746
7961
  if (typeof btoa === "function") {
@@ -7835,7 +8050,7 @@ function setFilterValuesByCategoryKey(filters, categoryKey, values) {
7835
8050
  const { status: _, ...rest } = filters;
7836
8051
  return rest;
7837
8052
  }
7838
- const parsed = z64.array(caseFilterStatusSchema).safeParse(values);
8053
+ const parsed = z65.array(caseFilterStatusSchema).safeParse(values);
7839
8054
  if (!parsed.success) {
7840
8055
  return filters;
7841
8056
  }
@@ -8975,11 +9190,11 @@ function emptyConfig() {
8975
9190
  __name(emptyConfig, "emptyConfig");
8976
9191
 
8977
9192
  // src/config/env.ts
8978
- import { z as z65 } from "zod";
8979
- var optionalEnvString = z65.string().optional().transform(
9193
+ import { z as z66 } from "zod";
9194
+ var optionalEnvString = z66.string().optional().transform(
8980
9195
  (value) => value === void 0 || value === "" ? void 0 : value
8981
9196
  );
8982
- var CliEnvSchema = z65.object({
9197
+ var CliEnvSchema = z66.object({
8983
9198
  DUVO_PROFILE: optionalEnvString,
8984
9199
  DUVO_API_KEY: optionalEnvString,
8985
9200
  DUVO_API_BASE_URL: optionalEnvString,
@@ -9475,9 +9690,9 @@ async function requireAuthenticatedConfig(command) {
9475
9690
  __name(requireAuthenticatedConfig, "requireAuthenticatedConfig");
9476
9691
 
9477
9692
  // src/commands/shared/team-context.ts
9478
- import { z as z66 } from "zod";
9479
- var teamSchema = z66.object({ id: z66.string() });
9480
- var listMyTeamsResponseSchema = z66.object({ teams: z66.array(teamSchema) });
9693
+ import { z as z67 } from "zod";
9694
+ var teamSchema = z67.object({ id: z67.string() });
9695
+ var listMyTeamsResponseSchema = z67.object({ teams: z67.array(teamSchema) });
9481
9696
  async function resolveRequiredTeamId(config, options = {}) {
9482
9697
  if (options.override) {
9483
9698
  return options.override;
@@ -10268,56 +10483,56 @@ import { readFile as readFile2 } from "node:fs/promises";
10268
10483
  import { confirm as confirm2, isCancel as isCancel2, text } from "@clack/prompts";
10269
10484
 
10270
10485
  // src/api/agent-schemas.ts
10271
- import { z as z68 } from "zod";
10486
+ import { z as z69 } from "zod";
10272
10487
 
10273
10488
  // src/api/json-value.ts
10274
- import { z as z67 } from "zod";
10275
- var jsonValueSchema = z67.lazy(
10276
- () => z67.union([
10277
- z67.string(),
10278
- z67.number(),
10279
- z67.boolean(),
10280
- z67.null(),
10281
- z67.array(jsonValueSchema),
10282
- z67.record(z67.string(), jsonValueSchema)
10489
+ import { z as z68 } from "zod";
10490
+ var jsonValueSchema = z68.lazy(
10491
+ () => z68.union([
10492
+ z68.string(),
10493
+ z68.number(),
10494
+ z68.boolean(),
10495
+ z68.null(),
10496
+ z68.array(jsonValueSchema),
10497
+ z68.record(z68.string(), jsonValueSchema)
10283
10498
  ])
10284
10499
  );
10285
10500
 
10286
10501
  // src/api/agent-schemas.ts
10287
- var publicAgentSchema = z68.object({
10288
- id: z68.string(),
10289
- name: z68.string(),
10290
- slack_enabled: z68.boolean().nullish(),
10291
- microsoft_teams_enabled: z68.boolean().nullish(),
10292
- agentic_memory_enabled: z68.boolean().nullish(),
10293
- thread_id: z68.string().nullish(),
10294
- created_at: z68.string().nullish(),
10295
- updated_at: z68.string().nullish(),
10296
- latest_build: z68.object({ config: jsonValueSchema.nullish() }).nullish()
10297
- });
10298
- var publicBuildSchema = z68.object({
10299
- id: z68.string(),
10300
- agent_id: z68.string(),
10301
- name: z68.string(),
10302
- revision_number: z68.number().nullish(),
10303
- created_at: z68.string().nullish(),
10304
- updated_at: z68.string().nullish()
10305
- });
10306
- var listAgentsResponseSchema = z68.object({
10307
- agents: z68.array(publicAgentSchema),
10308
- total: z68.number().nullish(),
10309
- limit: z68.number().nullish(),
10310
- offset: z68.number().nullish()
10311
- });
10312
- var getAgentResponseSchema = z68.object({
10502
+ var publicAgentSchema = z69.object({
10503
+ id: z69.string(),
10504
+ name: z69.string(),
10505
+ slack_enabled: z69.boolean().nullish(),
10506
+ microsoft_teams_enabled: z69.boolean().nullish(),
10507
+ agentic_memory_enabled: z69.boolean().nullish(),
10508
+ thread_id: z69.string().nullish(),
10509
+ created_at: z69.string().nullish(),
10510
+ updated_at: z69.string().nullish(),
10511
+ latest_build: z69.object({ config: jsonValueSchema.nullish() }).nullish()
10512
+ });
10513
+ var publicBuildSchema = z69.object({
10514
+ id: z69.string(),
10515
+ agent_id: z69.string(),
10516
+ name: z69.string(),
10517
+ revision_number: z69.number().nullish(),
10518
+ created_at: z69.string().nullish(),
10519
+ updated_at: z69.string().nullish()
10520
+ });
10521
+ var listAgentsResponseSchema = z69.object({
10522
+ agents: z69.array(publicAgentSchema),
10523
+ total: z69.number().nullish(),
10524
+ limit: z69.number().nullish(),
10525
+ offset: z69.number().nullish()
10526
+ });
10527
+ var getAgentResponseSchema = z69.object({
10313
10528
  agent: publicAgentSchema
10314
10529
  });
10315
- var createAgentResponseSchema = z68.object({
10530
+ var createAgentResponseSchema = z69.object({
10316
10531
  agent: publicAgentSchema,
10317
10532
  build: publicBuildSchema.optional()
10318
10533
  });
10319
- var deleteAgentResponseSchema = z68.object({
10320
- success: z68.literal(true)
10534
+ var deleteAgentResponseSchema = z69.object({
10535
+ success: z69.literal(true)
10321
10536
  });
10322
10537
  var buildConfigSchema = StoredAgentConfigSchemaV2;
10323
10538
  var DEFAULT_NEW_AGENT_NAME = DEFAULT_AGENT_NAME;
@@ -10626,29 +10841,29 @@ function registerAgentsDelete(agents) {
10626
10841
  __name(registerAgentsDelete, "registerAgentsDelete");
10627
10842
 
10628
10843
  // src/api/build-schemas.ts
10629
- import { z as z69 } from "zod";
10630
- var publicBuildSchema2 = z69.object({
10631
- id: z69.string(),
10632
- agent_id: z69.string(),
10633
- name: z69.string(),
10634
- status: z69.string().nullish(),
10844
+ import { z as z70 } from "zod";
10845
+ var publicBuildSchema2 = z70.object({
10846
+ id: z70.string(),
10847
+ agent_id: z70.string(),
10848
+ name: z70.string(),
10849
+ status: z70.string().nullish(),
10635
10850
  config: jsonValueSchema.nullish(),
10636
- revision_number: z69.number().nullish(),
10637
- created_at: z69.string().nullish(),
10638
- updated_at: z69.string().nullish()
10851
+ revision_number: z70.number().nullish(),
10852
+ created_at: z70.string().nullish(),
10853
+ updated_at: z70.string().nullish()
10639
10854
  });
10640
- var listBuildsResponseSchema2 = z69.object({
10641
- builds: z69.array(publicBuildSchema2),
10642
- total: z69.number().nullish(),
10643
- limit: z69.number().nullish(),
10644
- offset: z69.number().nullish()
10855
+ var listBuildsResponseSchema2 = z70.object({
10856
+ builds: z70.array(publicBuildSchema2),
10857
+ total: z70.number().nullish(),
10858
+ limit: z70.number().nullish(),
10859
+ offset: z70.number().nullish()
10645
10860
  });
10646
- var getBuildResponseSchema = z69.object({
10861
+ var getBuildResponseSchema = z70.object({
10647
10862
  build: publicBuildSchema2
10648
10863
  });
10649
- var createBuildResponseSchema = z69.object({
10864
+ var createBuildResponseSchema = z70.object({
10650
10865
  build: publicBuildSchema2,
10651
- agent: z69.object({ id: z69.string() })
10866
+ agent: z70.object({ id: z70.string() })
10652
10867
  });
10653
10868
 
10654
10869
  // src/commands/agents/get.ts
@@ -10898,30 +11113,30 @@ function registerAgentsModels(agents) {
10898
11113
  __name(registerAgentsModels, "registerAgentsModels");
10899
11114
 
10900
11115
  // src/api/schedule-schemas.ts
10901
- import { z as z70 } from "zod";
10902
- var publicScheduleSchema = z70.object({
10903
- id: z70.string(),
10904
- build_id: z70.string(),
10905
- agent_id: z70.string(),
10906
- user_id: z70.string(),
10907
- enabled: z70.boolean(),
10908
- frequency: z70.string(),
10909
- time: z70.string().nullish(),
10910
- timezone: z70.string(),
10911
- day: z70.string().nullish(),
10912
- day_of_month: z70.number().nullish(),
10913
- cron: z70.string().nullish(),
10914
- source: z70.string().nullish(),
10915
- task: z70.string().nullish(),
10916
- recurring: z70.boolean().nullish(),
10917
- created_at: z70.string(),
10918
- updated_at: z70.string()
10919
- });
10920
- var listSchedulesResponseSchema = z70.object({
10921
- schedules: z70.array(publicScheduleSchema)
10922
- });
10923
- var deleteScheduleResponseSchema = z70.object({
10924
- success: z70.literal(true)
11116
+ import { z as z71 } from "zod";
11117
+ var publicScheduleSchema = z71.object({
11118
+ id: z71.string(),
11119
+ build_id: z71.string(),
11120
+ agent_id: z71.string(),
11121
+ user_id: z71.string(),
11122
+ enabled: z71.boolean(),
11123
+ frequency: z71.string(),
11124
+ time: z71.string().nullish(),
11125
+ timezone: z71.string(),
11126
+ day: z71.string().nullish(),
11127
+ day_of_month: z71.number().nullish(),
11128
+ cron: z71.string().nullish(),
11129
+ source: z71.string().nullish(),
11130
+ task: z71.string().nullish(),
11131
+ recurring: z71.boolean().nullish(),
11132
+ created_at: z71.string(),
11133
+ updated_at: z71.string()
11134
+ });
11135
+ var listSchedulesResponseSchema = z71.object({
11136
+ schedules: z71.array(publicScheduleSchema)
11137
+ });
11138
+ var deleteScheduleResponseSchema = z71.object({
11139
+ success: z71.literal(true)
10925
11140
  });
10926
11141
 
10927
11142
  // src/commands/agents/schedules/render-schedule.ts
@@ -11369,33 +11584,33 @@ function registerAgentsSetModel(agents) {
11369
11584
  __name(registerAgentsSetModel, "registerAgentsSetModel");
11370
11585
 
11371
11586
  // src/api/trigger-schemas.ts
11372
- import { z as z71 } from "zod";
11373
- var triggerSchema = z71.object({
11374
- id: z71.string(),
11375
- agent_id: z71.string(),
11376
- user_id: z71.string(),
11377
- integration_slug: z71.string(),
11378
- trigger_type: z71.string(),
11379
- filter_config: z71.record(z71.string(), z71.unknown()),
11380
- integration_instance_id: z71.string(),
11381
- enabled: z71.boolean(),
11382
- created_at: z71.string(),
11383
- updated_at: z71.string()
11587
+ import { z as z72 } from "zod";
11588
+ var triggerSchema = z72.object({
11589
+ id: z72.string(),
11590
+ agent_id: z72.string(),
11591
+ user_id: z72.string(),
11592
+ integration_slug: z72.string(),
11593
+ trigger_type: z72.string(),
11594
+ filter_config: z72.record(z72.string(), z72.unknown()),
11595
+ integration_instance_id: z72.string(),
11596
+ enabled: z72.boolean(),
11597
+ created_at: z72.string(),
11598
+ updated_at: z72.string()
11384
11599
  });
11385
- var listTriggersResponseSchema = z71.object({
11386
- triggers: z71.array(triggerSchema)
11600
+ var listTriggersResponseSchema = z72.object({
11601
+ triggers: z72.array(triggerSchema)
11387
11602
  });
11388
- var triggerTypeSchema = z71.object({
11389
- integration_slug: z71.string(),
11390
- integration_name: z71.string(),
11391
- icon_url: z71.string(),
11392
- trigger_type: z71.string(),
11393
- label: z71.string(),
11394
- description: z71.string(),
11395
- filter_schema: z71.record(z71.string(), z71.unknown())
11603
+ var triggerTypeSchema = z72.object({
11604
+ integration_slug: z72.string(),
11605
+ integration_name: z72.string(),
11606
+ icon_url: z72.string(),
11607
+ trigger_type: z72.string(),
11608
+ label: z72.string(),
11609
+ description: z72.string(),
11610
+ filter_schema: z72.record(z72.string(), z72.unknown())
11396
11611
  });
11397
- var listTriggerTypesResponseSchema = z71.object({
11398
- trigger_types: z71.array(triggerTypeSchema)
11612
+ var listTriggerTypesResponseSchema = z72.object({
11613
+ trigger_types: z72.array(triggerTypeSchema)
11399
11614
  });
11400
11615
 
11401
11616
  // src/commands/agents/triggers/list.ts
@@ -12017,55 +12232,55 @@ function fieldsToSearchParams(fields) {
12017
12232
  __name(fieldsToSearchParams, "fieldsToSearchParams");
12018
12233
 
12019
12234
  // src/api/integration-schemas.ts
12020
- import { z as z72 } from "zod";
12021
- var integrationSchema = z72.object({
12022
- id: z72.string(),
12023
- name: z72.string(),
12024
- type: z72.string(),
12025
- provider: z72.string(),
12026
- user_id: z72.string().nullable(),
12027
- team_id: z72.string(),
12028
- server_url: z72.string().optional(),
12029
- transport_type: z72.string().optional(),
12030
- auth_method: z72.string().nullish(),
12031
- composio_mcp_id: z72.string().nullish(),
12032
- custom_integration_id: z72.string().nullish(),
12033
- icon_url: z72.string().nullish(),
12034
- oauth_provider: z72.string().nullish(),
12035
- oauth_provider_key: z72.string().nullish(),
12036
- oauth_scopes: z72.array(z72.string()).nullish(),
12037
- integration_id: z72.string().nullish(),
12038
- created_at: z72.string(),
12039
- updated_at: z72.string()
12040
- });
12041
- var integrationsListResponseSchema2 = z72.object({
12042
- integrations: z72.array(integrationSchema)
12235
+ import { z as z73 } from "zod";
12236
+ var integrationSchema = z73.object({
12237
+ id: z73.string(),
12238
+ name: z73.string(),
12239
+ type: z73.string(),
12240
+ provider: z73.string(),
12241
+ user_id: z73.string().nullable(),
12242
+ team_id: z73.string(),
12243
+ server_url: z73.string().optional(),
12244
+ transport_type: z73.string().optional(),
12245
+ auth_method: z73.string().nullish(),
12246
+ composio_mcp_id: z73.string().nullish(),
12247
+ custom_integration_id: z73.string().nullish(),
12248
+ icon_url: z73.string().nullish(),
12249
+ oauth_provider: z73.string().nullish(),
12250
+ oauth_provider_key: z73.string().nullish(),
12251
+ oauth_scopes: z73.array(z73.string()).nullish(),
12252
+ integration_id: z73.string().nullish(),
12253
+ created_at: z73.string(),
12254
+ updated_at: z73.string()
12255
+ });
12256
+ var integrationsListResponseSchema2 = z73.object({
12257
+ integrations: z73.array(integrationSchema)
12043
12258
  });
12044
12259
  var connectionResponseSchema = integrationSchema;
12045
- var buildIntegrationConfigSchema2 = z72.object({
12046
- id: z72.string(),
12047
- integration_id: z72.string().nullable(),
12048
- custom_integration_id: z72.string().nullable(),
12049
- integration_type: z72.string(),
12050
- integration_name: z72.string(),
12051
- created_at: z72.string()
12260
+ var buildIntegrationConfigSchema2 = z73.object({
12261
+ id: z73.string(),
12262
+ integration_id: z73.string().nullable(),
12263
+ custom_integration_id: z73.string().nullable(),
12264
+ integration_type: z73.string(),
12265
+ integration_name: z73.string(),
12266
+ created_at: z73.string()
12052
12267
  });
12053
- var listBuildIntegrationsResponseSchema2 = z72.object({
12054
- integrations: z72.array(buildIntegrationConfigSchema2)
12268
+ var listBuildIntegrationsResponseSchema2 = z73.object({
12269
+ integrations: z73.array(buildIntegrationConfigSchema2)
12055
12270
  });
12056
- var attachBuildIntegrationsResponseSchema = z72.object({
12057
- success: z72.boolean(),
12058
- count: z72.number()
12271
+ var attachBuildIntegrationsResponseSchema = z73.object({
12272
+ success: z73.boolean(),
12273
+ count: z73.number()
12059
12274
  });
12060
- var buildIntegrationConnectionSchema = z72.object({
12061
- connection_id: z72.string(),
12062
- created_at: z72.string()
12275
+ var buildIntegrationConnectionSchema = z73.object({
12276
+ connection_id: z73.string(),
12277
+ created_at: z73.string()
12063
12278
  });
12064
- var listBuildIntegrationConnectionsResponseSchema = z72.object({
12065
- connections: z72.array(buildIntegrationConnectionSchema)
12279
+ var listBuildIntegrationConnectionsResponseSchema = z73.object({
12280
+ connections: z73.array(buildIntegrationConnectionSchema)
12066
12281
  });
12067
- var successResponseSchema = z72.object({
12068
- success: z72.boolean()
12282
+ var successResponseSchema = z73.object({
12283
+ success: z73.boolean()
12069
12284
  });
12070
12285
 
12071
12286
  // src/commands/build-integrations/attach.ts
@@ -12108,15 +12323,15 @@ function registerBuildIntegrationsAttach(buildIntegrations) {
12108
12323
  __name(registerBuildIntegrationsAttach, "registerBuildIntegrationsAttach");
12109
12324
 
12110
12325
  // src/commands/build-integrations/case-queue-setup.ts
12111
- import { z as z73 } from "zod";
12112
- var slotSchema = z73.object({
12113
- config_id: z73.string(),
12114
- integration_type: z73.string(),
12115
- linked_queue_count: z73.number()
12326
+ import { z as z74 } from "zod";
12327
+ var slotSchema = z74.object({
12328
+ config_id: z74.string(),
12329
+ integration_type: z74.string(),
12330
+ linked_queue_count: z74.number()
12116
12331
  });
12117
- var responseSchema2 = z73.object({
12118
- configs: z73.array(slotSchema),
12119
- has_available_queues: z73.boolean()
12332
+ var responseSchema2 = z74.object({
12333
+ configs: z74.array(slotSchema),
12334
+ has_available_queues: z74.boolean()
12120
12335
  });
12121
12336
  var TABLE_COLUMNS10 = [
12122
12337
  { header: "SLOT ID", cell: /* @__PURE__ */ __name((row) => row.config_id, "cell") },
@@ -12611,9 +12826,9 @@ function registerBuildsList(builds) {
12611
12826
  __name(registerBuildsList, "registerBuildsList");
12612
12827
 
12613
12828
  // src/commands/builds/promote.ts
12614
- import { z as z74 } from "zod";
12615
- var promoteResponseSchema = z74.object({
12616
- success: z74.boolean()
12829
+ import { z as z75 } from "zod";
12830
+ var promoteResponseSchema = z75.object({
12831
+ success: z75.boolean()
12617
12832
  });
12618
12833
  function registerBuildsPromote(builds) {
12619
12834
  builds.command("promote <id>").description(
@@ -12739,50 +12954,6 @@ function parseCaseIds(raw) {
12739
12954
  }
12740
12955
  __name(parseCaseIds, "parseCaseIds");
12741
12956
 
12742
- // src/commands/cases/bulk-delegate.ts
12743
- function registerCasesBulkDelegate(cases) {
12744
- cases.command("bulk-delegate").description(
12745
- "Delegate multiple cases to a chosen agent (1-100). Interrupts any active runs."
12746
- ).requiredOption("--queue <id>", "ID of the queue the cases belong to").requiredOption(
12747
- "--agent <id>",
12748
- "agent ID to delegate to (must be a queue consumer; list via `duvo queues agents <queue-id>`)"
12749
- ).requiredOption("--ids <list>", "comma-separated case IDs (1-100)").option("-y, --yes", "skip confirmation prompt").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function bulkDelegateAction(options) {
12750
- const caseIds = parseCaseIds(options.ids);
12751
- const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
12752
- await confirmDestructive({
12753
- message: `Delegate ${caseIds.length} case(s) in queue "${options.queue}" to agent "${options.agent}"?`,
12754
- skip: Boolean(options.yes)
12755
- });
12756
- const raw = await httpRequest({
12757
- method: "POST",
12758
- path: `/v2/queues/${encodeURIComponent(options.queue)}/cases/bulk-delegate`,
12759
- apiKey,
12760
- apiBaseUrl,
12761
- body: { case_ids: caseIds, agent_id: options.agent }
12762
- });
12763
- if (options.json) {
12764
- printJson(raw);
12765
- return;
12766
- }
12767
- const parsed = caseBulkDelegateResponseSchema.safeParse(raw);
12768
- if (!parsed.success) {
12769
- throw new CliError(
12770
- `Unexpected response from the API: ${parsed.error.message}`
12771
- );
12772
- }
12773
- const result = parsed.data;
12774
- console.log(green("Bulk delegate complete."));
12775
- console.log();
12776
- console.log(
12777
- renderKeyValue([
12778
- { label: "Delegated", value: String(result.delegatedCount) },
12779
- { label: "Skipped", value: String(result.skippedCount) }
12780
- ])
12781
- );
12782
- }, "bulkDelegateAction"));
12783
- }
12784
- __name(registerCasesBulkDelegate, "registerCasesBulkDelegate");
12785
-
12786
12957
  // src/commands/cases/bulk-delete.ts
12787
12958
  function registerCasesBulkDelete(cases) {
12788
12959
  cases.command("bulk-delete").description(
@@ -12882,46 +13053,49 @@ async function fetchCaseTitles(ids, apiKey, apiBaseUrl) {
12882
13053
  }
12883
13054
  __name(fetchCaseTitles, "fetchCaseTitles");
12884
13055
 
12885
- // src/commands/cases/bulk-retry.ts
12886
- function registerCasesBulkRetry(cases) {
12887
- cases.command("bulk-retry").description(
12888
- "Retry multiple cases by resetting them to pending (1-100). Interrupts any active runs."
12889
- ).requiredOption("--queue <id>", "ID of the queue the cases belong to").requiredOption("--ids <list>", "comma-separated case IDs (1-100)").option("-y, --yes", "skip confirmation prompt").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function bulkRetryAction(options) {
13056
+ // src/commands/cases/bulk-reprocess.ts
13057
+ function registerCasesBulkReprocess(cases) {
13058
+ cases.command("bulk-reprocess").description(
13059
+ "Re-process multiple cases on a chosen agent (1-100). Interrupts any active runs."
13060
+ ).requiredOption("--queue <id>", "ID of the queue the cases belong to").requiredOption(
13061
+ "--agent <id>",
13062
+ "agent ID to re-process on (must be a queue consumer; list via `duvo queues agents <queue-id>`)"
13063
+ ).requiredOption("--ids <list>", "comma-separated case IDs (1-100)").option("-y, --yes", "skip confirmation prompt").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function bulkReprocessAction(options) {
12890
13064
  const caseIds = parseCaseIds(options.ids);
12891
13065
  const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
12892
13066
  await confirmDestructive({
12893
- message: `Retry ${caseIds.length} case(s) in queue "${options.queue}"?`,
13067
+ message: `Re-process ${caseIds.length} case(s) in queue "${options.queue}" on agent "${options.agent}"?`,
12894
13068
  skip: Boolean(options.yes)
12895
13069
  });
12896
13070
  const raw = await httpRequest({
12897
13071
  method: "POST",
12898
- path: `/v2/queues/${encodeURIComponent(options.queue)}/cases/bulk-retry`,
13072
+ path: `/v2/queues/${encodeURIComponent(options.queue)}/cases/bulk-reprocess`,
12899
13073
  apiKey,
12900
13074
  apiBaseUrl,
12901
- body: { case_ids: caseIds }
13075
+ body: { case_ids: caseIds, agent_id: options.agent }
12902
13076
  });
12903
13077
  if (options.json) {
12904
13078
  printJson(raw);
12905
13079
  return;
12906
13080
  }
12907
- const parsed = caseBulkRetryResponseSchema.safeParse(raw);
13081
+ const parsed = caseBulkReprocessResponseSchema.safeParse(raw);
12908
13082
  if (!parsed.success) {
12909
13083
  throw new CliError(
12910
13084
  `Unexpected response from the API: ${parsed.error.message}`
12911
13085
  );
12912
13086
  }
12913
13087
  const result = parsed.data;
12914
- console.log(green("Bulk retry complete."));
13088
+ console.log(green("Bulk reprocess complete."));
12915
13089
  console.log();
12916
13090
  console.log(
12917
13091
  renderKeyValue([
12918
- { label: "Retried", value: String(result.retriedCount) },
13092
+ { label: "Re-processed", value: String(result.reprocessedCount) },
12919
13093
  { label: "Skipped", value: String(result.skippedCount) }
12920
13094
  ])
12921
13095
  );
12922
- }, "bulkRetryAction"));
13096
+ }, "bulkReprocessAction"));
12923
13097
  }
12924
- __name(registerCasesBulkRetry, "registerCasesBulkRetry");
13098
+ __name(registerCasesBulkReprocess, "registerCasesBulkReprocess");
12925
13099
 
12926
13100
  // src/commands/cases/bulk-update-status.ts
12927
13101
  var CASE_TERMINAL_STATUSES = ["completed", "failed"];
@@ -13665,7 +13839,7 @@ function parseSortOrder(raw) {
13665
13839
  __name(parseSortOrder, "parseSortOrder");
13666
13840
 
13667
13841
  // src/commands/cases/runs.ts
13668
- import { z as z75 } from "zod";
13842
+ import { z as z76 } from "zod";
13669
13843
  var MIN_LIMIT4 = 1;
13670
13844
  var MAX_LIMIT4 = 10;
13671
13845
  var DEFAULT_LIMIT4 = 3;
@@ -13683,17 +13857,17 @@ var RUNS_TABLE_COLUMNS = [
13683
13857
  cell: /* @__PURE__ */ __name((row) => row.has_pending_human_request ? row.pending_human_request_title ?? "(unknown)" : "", "cell")
13684
13858
  }
13685
13859
  ];
13686
- var recentMessageSchema = z75.object({
13687
- id: z75.string(),
13688
- type: z75.string(),
13689
- role: z75.string(),
13690
- timestamp: z75.string(),
13691
- text_content: z75.string().nullish(),
13692
- tool_call: z75.object({ id: z75.string(), name: z75.string() }).passthrough().nullish(),
13693
- tool_result: z75.object({ tool_call_id: z75.string() }).passthrough().nullish()
13694
- });
13695
- var recentMessagesResponseSchema = z75.object({
13696
- messages: z75.array(recentMessageSchema)
13860
+ var recentMessageSchema = z76.object({
13861
+ id: z76.string(),
13862
+ type: z76.string(),
13863
+ role: z76.string(),
13864
+ timestamp: z76.string(),
13865
+ text_content: z76.string().nullish(),
13866
+ tool_call: z76.object({ id: z76.string(), name: z76.string() }).passthrough().nullish(),
13867
+ tool_result: z76.object({ tool_call_id: z76.string() }).passthrough().nullish()
13868
+ });
13869
+ var recentMessagesResponseSchema = z76.object({
13870
+ messages: z76.array(recentMessageSchema)
13697
13871
  });
13698
13872
  var TEXT_PREVIEW_WIDTH = 60;
13699
13873
  var MESSAGES_TABLE_COLUMNS = [
@@ -13814,56 +13988,544 @@ function registerCases(program) {
13814
13988
  registerCasesDelete(cases);
13815
13989
  registerCasesClear(cases);
13816
13990
  registerCasesBulkDelete(cases);
13817
- registerCasesBulkRetry(cases);
13991
+ registerCasesBulkReprocess(cases);
13818
13992
  registerCasesBulkUpdateStatus(cases);
13819
- registerCasesBulkDelegate(cases);
13820
13993
  registerCasesRuns(cases);
13821
13994
  registerCasesLabels(cases);
13822
13995
  }
13823
13996
  __name(registerCases, "registerCases");
13824
13997
 
13825
13998
  // src/commands/clarity/index.ts
13826
- import { z as z79 } from "zod";
13999
+ import { z as z84 } from "zod";
13827
14000
 
13828
- // src/commands/clarity/render.ts
13829
- var DEFAULT_HUMAN_SUMMARY_LIMIT = 1200;
13830
- var PROCESS_TABLE_COLUMNS = [
13831
- { header: "ID", cell: /* @__PURE__ */ __name((row) => row.id, "cell") },
13832
- { header: "VERSION", cell: /* @__PURE__ */ __name((row) => String(row.version), "cell") },
13833
- { header: "STATUS", cell: /* @__PURE__ */ __name((row) => row.status, "cell") },
14001
+ // src/api/clarity-schemas.ts
14002
+ import { z as z77 } from "zod";
14003
+ var clarityListProcessSchema = z77.object({
14004
+ id: z77.guid(),
14005
+ name: z77.string(),
14006
+ status: clarityProcessStatusSchema,
14007
+ visibility: clarityProcessVisibilitySchema,
14008
+ version: z77.number().int(),
14009
+ capture_count: z77.number().int(),
14010
+ capture_counts: z77.object({
14011
+ video: z77.number().int(),
14012
+ interview: z77.number().int(),
14013
+ document: z77.number().int()
14014
+ }).optional(),
14015
+ pending_invitation_count: z77.number().int(),
14016
+ contributors: z77.array(
14017
+ z77.object({
14018
+ user_id: z77.string(),
14019
+ user_name: z77.string()
14020
+ })
14021
+ ),
14022
+ created_at: z77.string(),
14023
+ created_by_name: z77.string().nullable()
14024
+ });
14025
+ var listClarityProcessesResponseSchema = z77.object({
14026
+ processes: z77.array(clarityListProcessSchema),
14027
+ total: z77.number().int(),
14028
+ limit: z77.number().int(),
14029
+ offset: z77.number().int()
14030
+ });
14031
+ var createClarityInviteLinkResponseSchema = z77.object({
14032
+ invite_link: z77.object({
14033
+ id: z77.guid(),
14034
+ url: z77.url(),
14035
+ created_at: z77.string(),
14036
+ created_by: z77.object({
14037
+ id: z77.guid(),
14038
+ email: z77.email().nullable()
14039
+ })
14040
+ })
14041
+ });
14042
+ var createArtifactImportUploadUrlResponseSchema = z77.object({
14043
+ signed_url: z77.url(),
14044
+ capture_id: z77.guid(),
14045
+ expires_at: z77.iso.datetime()
14046
+ });
14047
+ var completeArtifactImportResponseSchema = z77.object({
14048
+ capture: clarityCaptureSchema.extend({
14049
+ createdAt: z77.iso.datetime(),
14050
+ updatedAt: z77.iso.datetime()
14051
+ })
14052
+ });
14053
+ var legacyClarityProcessResponseSchema = legacyClarityProcessDetailSchema;
14054
+
14055
+ // src/commands/clarity/artifact-chat.ts
14056
+ var SNAPSHOT_KIND_CHOICES = claritySnapshotKindSchema.options;
14057
+ var CONVERSATION_COLUMNS = [
13834
14058
  {
13835
- header: "CAPTURES",
13836
- cell: /* @__PURE__ */ __name((row) => String(row.capture_count), "cell")
14059
+ header: "ID",
14060
+ cell: /* @__PURE__ */ __name((row) => row.id, "cell")
13837
14061
  },
13838
14062
  {
13839
- header: "NAME",
13840
- cell: /* @__PURE__ */ __name((row) => row.name, "cell"),
14063
+ header: "SNAPSHOT",
14064
+ cell: /* @__PURE__ */ __name((row) => row.snapshot_kind, "cell")
14065
+ },
14066
+ {
14067
+ header: "STATUS",
14068
+ cell: /* @__PURE__ */ __name((row) => row.status, "cell")
14069
+ },
14070
+ {
14071
+ header: "TITLE",
14072
+ cell: /* @__PURE__ */ __name((row) => row.title ?? "", "cell"),
13841
14073
  maxWidth: 48
14074
+ },
14075
+ {
14076
+ header: "UPDATED",
14077
+ cell: /* @__PURE__ */ __name((row) => row.updated_at, "cell")
13842
14078
  }
13843
14079
  ];
13844
- var CAPTURE_TABLE_COLUMNS = [
13845
- { header: "ID", cell: /* @__PURE__ */ __name((row) => row.id, "cell") },
13846
- { header: "TYPE", cell: /* @__PURE__ */ __name((row) => row.type, "cell") },
13847
- { header: "STATUS", cell: /* @__PURE__ */ __name((row) => row.status, "cell") },
14080
+ var MESSAGE_COLUMNS = [
13848
14081
  {
13849
- header: "USABLE",
13850
- cell: /* @__PURE__ */ __name((row) => describeCaptureUsability(row).usable ? "yes" : "no", "cell")
14082
+ header: "ID",
14083
+ cell: /* @__PURE__ */ __name((row) => row.id, "cell")
14084
+ },
14085
+ {
14086
+ header: "ROLE",
14087
+ cell: /* @__PURE__ */ __name((row) => row.role, "cell")
14088
+ },
14089
+ {
14090
+ header: "KIND",
14091
+ cell: /* @__PURE__ */ __name((row) => row.kind, "cell")
13851
14092
  },
13852
- { header: "USER", cell: /* @__PURE__ */ __name((row) => row.userName ?? row.userId, "cell") },
13853
14093
  {
13854
14094
  header: "CREATED",
13855
- cell: /* @__PURE__ */ __name((row) => formatIso(row.createdAt), "cell")
14095
+ cell: /* @__PURE__ */ __name((row) => row.created_at, "cell")
14096
+ },
14097
+ {
14098
+ header: "BODY",
14099
+ cell: /* @__PURE__ */ __name((row) => describeMessageBody(row.body), "cell"),
14100
+ maxWidth: 64
13856
14101
  }
13857
14102
  ];
13858
- function renderProcessTable(rows) {
13859
- return renderTable(PROCESS_TABLE_COLUMNS, rows);
13860
- }
13861
- __name(renderProcessTable, "renderProcessTable");
13862
- function renderCapturesTable(rows) {
13863
- return renderTable(CAPTURE_TABLE_COLUMNS, rows);
13864
- }
13865
- __name(renderCapturesTable, "renderCapturesTable");
13866
- function renderVersionReport(process2) {
14103
+ function registerClarityArtifactChatConversations(clarity) {
14104
+ clarity.command("artifact-chat-conversations <process-id>").description("List artifact-chat conversations for a v2 process").requiredOption(
14105
+ "--snapshot-kind <current_process|transformation_proposal>",
14106
+ "artifact kind to list conversations for",
14107
+ parseSnapshotKind
14108
+ ).option("--json", "output JSON").action(/* @__PURE__ */ __name(async function action(processId, options) {
14109
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14110
+ const searchParams = new URLSearchParams();
14111
+ searchParams.append("snapshot_kind", options.snapshotKind);
14112
+ const raw = await httpRequest({
14113
+ method: "GET",
14114
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/artifact-chat/conversations`,
14115
+ apiKey,
14116
+ apiBaseUrl,
14117
+ searchParams
14118
+ });
14119
+ const parsed = listArtifactChatConversationsResponseSchema.safeParse(raw);
14120
+ if (!parsed.success) {
14121
+ throw new CliError(
14122
+ `Unexpected response from the API: ${parsed.error.message}`
14123
+ );
14124
+ }
14125
+ const response = parsed.data;
14126
+ if (options.json) {
14127
+ printJson(response);
14128
+ return;
14129
+ }
14130
+ if (response.conversations.length === 0) {
14131
+ console.log("No artifact-chat conversations found.");
14132
+ return;
14133
+ }
14134
+ console.log(renderTable(CONVERSATION_COLUMNS, response.conversations));
14135
+ }, "action"));
14136
+ }
14137
+ __name(registerClarityArtifactChatConversations, "registerClarityArtifactChatConversations");
14138
+ function registerClarityArtifactChatMessages(clarity) {
14139
+ clarity.command("artifact-chat-messages <process-id> <conversation-id>").description("Read messages for one artifact-chat conversation").option("--json", "output JSON").action(/* @__PURE__ */ __name(async function action(processId, conversationId, options) {
14140
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14141
+ const raw = await httpRequest({
14142
+ method: "GET",
14143
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/artifact-chat/conversations/${encodeURIComponent(conversationId)}/messages`,
14144
+ apiKey,
14145
+ apiBaseUrl
14146
+ });
14147
+ const parsed = getArtifactChatMessagesResponseSchema.safeParse(raw);
14148
+ if (!parsed.success) {
14149
+ throw new CliError(
14150
+ `Unexpected response from the API: ${parsed.error.message}`
14151
+ );
14152
+ }
14153
+ const response = parsed.data;
14154
+ if (options.json) {
14155
+ printJson(response);
14156
+ return;
14157
+ }
14158
+ const conversation = renderKeyValue([
14159
+ { label: "Conversation", value: response.conversation.id },
14160
+ { label: "Snapshot", value: response.conversation.snapshot_kind },
14161
+ { label: "Status", value: response.conversation.status },
14162
+ { label: "Title", value: response.conversation.title ?? "" }
14163
+ ]);
14164
+ if (response.messages.length === 0) {
14165
+ console.log(`${conversation}
14166
+
14167
+ No artifact-chat messages found.`);
14168
+ return;
14169
+ }
14170
+ console.log(
14171
+ `${conversation}
14172
+
14173
+ ${renderTable(MESSAGE_COLUMNS, response.messages)}`
14174
+ );
14175
+ }, "action"));
14176
+ }
14177
+ __name(registerClarityArtifactChatMessages, "registerClarityArtifactChatMessages");
14178
+ function parseSnapshotKind(value) {
14179
+ const parsed = claritySnapshotKindSchema.safeParse(value);
14180
+ if (!parsed.success) {
14181
+ throw new CliError(
14182
+ `--snapshot-kind must be one of: ${SNAPSHOT_KIND_CHOICES.join(", ")}`
14183
+ );
14184
+ }
14185
+ return parsed.data;
14186
+ }
14187
+ __name(parseSnapshotKind, "parseSnapshotKind");
14188
+ function describeMessageBody(body) {
14189
+ switch (body.kind) {
14190
+ case "text":
14191
+ case "error":
14192
+ case "info":
14193
+ return body.text;
14194
+ case "patch":
14195
+ return `${body.status}: ${body.summary}`;
14196
+ case "hitl_question":
14197
+ return `${body.questions.length} question(s)`;
14198
+ case "hitl_answer":
14199
+ return `${Object.keys(body.answers).length} answer(s)`;
14200
+ }
14201
+ }
14202
+ __name(describeMessageBody, "describeMessageBody");
14203
+
14204
+ // src/commands/clarity/artifact-import.ts
14205
+ import { readFile as readFile5 } from "node:fs/promises";
14206
+ import { basename, extname } from "node:path";
14207
+ var ARTIFACT_CONTENT_TYPES = [
14208
+ "image/svg+xml",
14209
+ "application/xml",
14210
+ "text/xml",
14211
+ "image/png",
14212
+ "image/jpeg"
14213
+ ];
14214
+ var ARTIFACT_UPLOAD_TIMEOUT_MS = 3e5;
14215
+ function registerClarityImportArtifact(clarity) {
14216
+ clarity.command("import-artifact <process-id> <file>").description(
14217
+ "Import a local Miro SVG, XML, PNG, or JPEG export into a Clarity process"
14218
+ ).option("--content-type <type>", "artifact content type").option(
14219
+ "--extra-capture-request-id <id>",
14220
+ "bind the import to an extra-capture request"
14221
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, filePath, options) {
14222
+ const fileName = basename(filePath);
14223
+ const contentType = resolveArtifactContentType(
14224
+ fileName,
14225
+ options.contentType
14226
+ );
14227
+ const config = await requireAuthenticatedConfig(this);
14228
+ const bytes = await readLocalArtifact(filePath);
14229
+ const upload = await createUploadUrl(config, processId, {
14230
+ fileName,
14231
+ contentType,
14232
+ extraCaptureRequestId: options.extraCaptureRequestId
14233
+ });
14234
+ await uploadToSignedUrl(upload.signed_url, bytes, contentType);
14235
+ const complete = await completeArtifactImport(
14236
+ config,
14237
+ processId,
14238
+ upload.capture_id,
14239
+ { fileName, contentType }
14240
+ );
14241
+ if (options.json) {
14242
+ printJson({ upload, complete });
14243
+ return;
14244
+ }
14245
+ renderCompletedImport(complete);
14246
+ }, "action"));
14247
+ }
14248
+ __name(registerClarityImportArtifact, "registerClarityImportArtifact");
14249
+ async function createUploadUrl(config, processId, input) {
14250
+ const body = {
14251
+ file_name: input.fileName,
14252
+ content_type: input.contentType
14253
+ };
14254
+ if (input.extraCaptureRequestId !== void 0) {
14255
+ body.extra_capture_request_id = input.extraCaptureRequestId;
14256
+ }
14257
+ const raw = await httpRequest({
14258
+ method: "POST",
14259
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/artifact-imports/create-upload-url`,
14260
+ apiKey: config.apiKey,
14261
+ apiBaseUrl: config.apiBaseUrl,
14262
+ body
14263
+ });
14264
+ const parsed = createArtifactImportUploadUrlResponseSchema.safeParse(raw);
14265
+ if (!parsed.success) {
14266
+ throw new CliError(
14267
+ `Unexpected response from the API: ${parsed.error.message}`
14268
+ );
14269
+ }
14270
+ return parsed.data;
14271
+ }
14272
+ __name(createUploadUrl, "createUploadUrl");
14273
+ async function completeArtifactImport(config, processId, captureId, input) {
14274
+ const raw = await httpRequest({
14275
+ method: "POST",
14276
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/artifact-imports/${encodeURIComponent(captureId)}/complete`,
14277
+ apiKey: config.apiKey,
14278
+ apiBaseUrl: config.apiBaseUrl,
14279
+ body: {
14280
+ file_name: input.fileName,
14281
+ content_type: input.contentType
14282
+ }
14283
+ });
14284
+ const parsed = completeArtifactImportResponseSchema.safeParse(raw);
14285
+ if (!parsed.success) {
14286
+ throw new CliError(
14287
+ `Unexpected response from the API: ${parsed.error.message}`
14288
+ );
14289
+ }
14290
+ return parsed.data;
14291
+ }
14292
+ __name(completeArtifactImport, "completeArtifactImport");
14293
+ async function readLocalArtifact(filePath) {
14294
+ try {
14295
+ return await readFile5(filePath);
14296
+ } catch (error) {
14297
+ const message = error instanceof Error ? error.message : String(error);
14298
+ throw new CliError(`Cannot read "${filePath}": ${message}`);
14299
+ }
14300
+ }
14301
+ __name(readLocalArtifact, "readLocalArtifact");
14302
+ async function uploadToSignedUrl(signedUrl, bytes, contentType) {
14303
+ let response;
14304
+ try {
14305
+ response = await fetch(signedUrl, {
14306
+ method: "PUT",
14307
+ headers: { "Content-Type": contentType },
14308
+ body: new Uint8Array(bytes),
14309
+ signal: AbortSignal.timeout(ARTIFACT_UPLOAD_TIMEOUT_MS)
14310
+ });
14311
+ } catch (error) {
14312
+ const message = error instanceof Error ? error.message : String(error);
14313
+ throw new CliError(`Artifact upload failed: ${message}`);
14314
+ }
14315
+ if (!response.ok) {
14316
+ const text3 = await response.text().catch(() => "");
14317
+ throw new CliError(
14318
+ `Artifact upload failed with HTTP ${response.status}${text3 ? `: ${text3}` : ""}`
14319
+ );
14320
+ }
14321
+ }
14322
+ __name(uploadToSignedUrl, "uploadToSignedUrl");
14323
+ function resolveArtifactContentType(fileName, contentType) {
14324
+ if (contentType !== void 0) {
14325
+ return parseArtifactContentType(contentType);
14326
+ }
14327
+ const extension = extname(fileName).toLowerCase();
14328
+ if (extension === ".svg") {
14329
+ return "image/svg+xml";
14330
+ }
14331
+ if (extension === ".xml") {
14332
+ return "application/xml";
14333
+ }
14334
+ if (extension === ".png") {
14335
+ return "image/png";
14336
+ }
14337
+ if (extension === ".jpg" || extension === ".jpeg") {
14338
+ return "image/jpeg";
14339
+ }
14340
+ throw new CliError(
14341
+ "Cannot infer content type. Supported extensions: .svg, .xml, .png, .jpg, .jpeg."
14342
+ );
14343
+ }
14344
+ __name(resolveArtifactContentType, "resolveArtifactContentType");
14345
+ function parseArtifactContentType(contentType) {
14346
+ if (ARTIFACT_CONTENT_TYPES.includes(contentType)) {
14347
+ return contentType;
14348
+ }
14349
+ throw new CliError(
14350
+ `Invalid content type "${contentType}". Expected one of: ${ARTIFACT_CONTENT_TYPES.join(", ")}.`
14351
+ );
14352
+ }
14353
+ __name(parseArtifactContentType, "parseArtifactContentType");
14354
+ function renderCompletedImport(response) {
14355
+ console.log(
14356
+ renderKeyValue([
14357
+ { label: "Capture ID", value: response.capture.id },
14358
+ { label: "Status", value: response.capture.status },
14359
+ { label: "Type", value: response.capture.type },
14360
+ { label: "Created", value: response.capture.createdAt },
14361
+ { label: "Updated", value: response.capture.updatedAt }
14362
+ ])
14363
+ );
14364
+ }
14365
+ __name(renderCompletedImport, "renderCompletedImport");
14366
+
14367
+ // src/commands/clarity/assign-extra-capture-request.ts
14368
+ import { z as z78 } from "zod";
14369
+ var responseSchema3 = z78.object({
14370
+ request: clarityProposalExtraCaptureRequestSchema
14371
+ });
14372
+ function renderRequest(request) {
14373
+ console.log(
14374
+ renderKeyValue([
14375
+ { label: "ID", value: request.id },
14376
+ { label: "Step ID", value: request.step_id },
14377
+ { label: "Status", value: request.status },
14378
+ { label: "Priority", value: request.priority },
14379
+ { label: "Assigned to", value: request.requested_user_id ?? "" },
14380
+ { label: "Gap", value: request.gap },
14381
+ { label: "Updated", value: request.updated_at }
14382
+ ])
14383
+ );
14384
+ }
14385
+ __name(renderRequest, "renderRequest");
14386
+ function registerClarityAssignExtraCaptureRequest(clarity) {
14387
+ clarity.command(
14388
+ "assign-extra-capture-request <process-id> <proposal-id> <request-id>"
14389
+ ).description(
14390
+ "Assign (or unassign) a team member to an extra-capture request"
14391
+ ).option("--user-id <id>", "team member to assign (omit to unassign)").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, proposalId, requestId, options) {
14392
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14393
+ const raw = await httpRequest({
14394
+ method: "PATCH",
14395
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/transformation-proposals/${encodeURIComponent(proposalId)}/extra-capture-requests/${encodeURIComponent(requestId)}/assign`,
14396
+ apiKey,
14397
+ apiBaseUrl,
14398
+ body: { user_id: options.userId ?? null }
14399
+ });
14400
+ if (options.json) {
14401
+ printJson(raw);
14402
+ return;
14403
+ }
14404
+ const parsed = responseSchema3.safeParse(raw);
14405
+ if (!parsed.success) {
14406
+ throw new CliError(
14407
+ `Unexpected response from the API: ${parsed.error.message}`
14408
+ );
14409
+ }
14410
+ renderRequest(parsed.data.request);
14411
+ }, "action"));
14412
+ }
14413
+ __name(registerClarityAssignExtraCaptureRequest, "registerClarityAssignExtraCaptureRequest");
14414
+
14415
+ // src/commands/clarity/build-automation.ts
14416
+ import { z as z79 } from "zod";
14417
+ var responseSchema4 = z79.object({
14418
+ automation_run: z79.object({
14419
+ id: z79.string(),
14420
+ status: z79.string()
14421
+ })
14422
+ });
14423
+ function registerClarityBuildAutomation(clarity) {
14424
+ clarity.command("build-automation <process-id>").description(
14425
+ "Hand the latest transformation proposal off to the workflow-builder pipeline (async)"
14426
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, options) {
14427
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14428
+ const raw = await httpRequest({
14429
+ method: "POST",
14430
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/automation`,
14431
+ apiKey,
14432
+ apiBaseUrl
14433
+ });
14434
+ if (options.json) {
14435
+ printJson(raw);
14436
+ return;
14437
+ }
14438
+ const parsed = responseSchema4.safeParse(raw);
14439
+ if (!parsed.success) {
14440
+ throw new CliError(
14441
+ `Unexpected response from the API: ${parsed.error.message}`
14442
+ );
14443
+ }
14444
+ const { automation_run: run } = parsed.data;
14445
+ console.log(
14446
+ renderKeyValue([
14447
+ { label: "Run ID", value: run.id },
14448
+ { label: "Status", value: run.status }
14449
+ ])
14450
+ );
14451
+ }, "action"));
14452
+ }
14453
+ __name(registerClarityBuildAutomation, "registerClarityBuildAutomation");
14454
+
14455
+ // src/commands/clarity/create-invite-link.ts
14456
+ function registerClarityCreateInviteLink(clarity) {
14457
+ clarity.command("create-invite-link <process-id>").description(
14458
+ "Create or regenerate a Clarity interview invite link for a process"
14459
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, options) {
14460
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14461
+ const raw = await httpRequest({
14462
+ method: "POST",
14463
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/invite-link`,
14464
+ apiKey,
14465
+ apiBaseUrl
14466
+ });
14467
+ const parsed = createClarityInviteLinkResponseSchema.safeParse(raw);
14468
+ if (!parsed.success) {
14469
+ throw new CliError(
14470
+ `Unexpected response from the API: ${parsed.error.message}`
14471
+ );
14472
+ }
14473
+ if (options.json) {
14474
+ printJson(raw);
14475
+ return;
14476
+ }
14477
+ const { invite_link: inviteLink } = parsed.data;
14478
+ console.log(
14479
+ renderKeyValue([
14480
+ { label: "ID", value: inviteLink.id },
14481
+ { label: "URL", value: inviteLink.url },
14482
+ { label: "Created", value: inviteLink.created_at },
14483
+ { label: "Created by", value: inviteLink.created_by.email ?? "" }
14484
+ ])
14485
+ );
14486
+ }, "action"));
14487
+ }
14488
+ __name(registerClarityCreateInviteLink, "registerClarityCreateInviteLink");
14489
+
14490
+ // src/commands/clarity/render.ts
14491
+ var DEFAULT_HUMAN_SUMMARY_LIMIT = 1200;
14492
+ var PROCESS_TABLE_COLUMNS = [
14493
+ { header: "ID", cell: /* @__PURE__ */ __name((row) => row.id, "cell") },
14494
+ { header: "VERSION", cell: /* @__PURE__ */ __name((row) => String(row.version), "cell") },
14495
+ { header: "STATUS", cell: /* @__PURE__ */ __name((row) => row.status, "cell") },
14496
+ {
14497
+ header: "CAPTURES",
14498
+ cell: /* @__PURE__ */ __name((row) => String(row.capture_count), "cell")
14499
+ },
14500
+ {
14501
+ header: "NAME",
14502
+ cell: /* @__PURE__ */ __name((row) => row.name, "cell"),
14503
+ maxWidth: 48
14504
+ }
14505
+ ];
14506
+ var CAPTURE_TABLE_COLUMNS = [
14507
+ { header: "ID", cell: /* @__PURE__ */ __name((row) => row.id, "cell") },
14508
+ { header: "TYPE", cell: /* @__PURE__ */ __name((row) => row.type, "cell") },
14509
+ { header: "STATUS", cell: /* @__PURE__ */ __name((row) => row.status, "cell") },
14510
+ {
14511
+ header: "USABLE",
14512
+ cell: /* @__PURE__ */ __name((row) => describeCaptureUsability(row).usable ? "yes" : "no", "cell")
14513
+ },
14514
+ { header: "USER", cell: /* @__PURE__ */ __name((row) => row.userName ?? row.userId, "cell") },
14515
+ {
14516
+ header: "CREATED",
14517
+ cell: /* @__PURE__ */ __name((row) => formatIso(row.createdAt), "cell")
14518
+ }
14519
+ ];
14520
+ function renderProcessTable(rows) {
14521
+ return renderTable(PROCESS_TABLE_COLUMNS, rows);
14522
+ }
14523
+ __name(renderProcessTable, "renderProcessTable");
14524
+ function renderCapturesTable(rows) {
14525
+ return renderTable(CAPTURE_TABLE_COLUMNS, rows);
14526
+ }
14527
+ __name(renderCapturesTable, "renderCapturesTable");
14528
+ function renderVersionReport(process2) {
13867
14529
  const current = process2.current_process_versions;
13868
14530
  const proposals = process2.transformation_proposal_versions;
13869
14531
  const defaultCurrent = selectDefaultVersion(current);
@@ -14816,25 +15478,15 @@ function formatOptionalBoolean(value) {
14816
15478
  }
14817
15479
  __name(formatOptionalBoolean, "formatOptionalBoolean");
14818
15480
 
14819
- // src/commands/clarity/get-current-process.ts
14820
- import { z as z76 } from "zod";
14821
- var snapshotSchema = z76.object({
14822
- snapshot: z76.object({
14823
- id: z76.string(),
14824
- status: z76.string(),
14825
- creator_type: z76.string(),
14826
- user_id: z76.string().nullable(),
14827
- sandbox_id: z76.string().nullable(),
14828
- created_at: z76.string(),
14829
- updated_at: z76.string()
14830
- })
14831
- });
14832
- function registerClarityGetCurrentProcess(clarity) {
14833
- clarity.command("get-current-process <process-id> <snapshot-id>").description("Get a specific current-process snapshot by ID").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, snapshotId, options) {
15481
+ // src/commands/clarity/generate-current-process.ts
15482
+ function registerClarityGenerateCurrentProcess(clarity) {
15483
+ clarity.command("generate-current-process <process-id>").description(
15484
+ "Trigger current-process generation for a Clarity v2 process (async)"
15485
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, options) {
14834
15486
  const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14835
15487
  const raw = await httpRequest({
14836
- method: "GET",
14837
- path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/current-process/${encodeURIComponent(snapshotId)}`,
15488
+ method: "POST",
15489
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/current-process`,
14838
15490
  apiKey,
14839
15491
  apiBaseUrl
14840
15492
  });
@@ -14842,13 +15494,259 @@ function registerClarityGetCurrentProcess(clarity) {
14842
15494
  printJson(raw);
14843
15495
  return;
14844
15496
  }
14845
- const parsed = snapshotSchema.safeParse(raw);
14846
- if (!parsed.success) {
15497
+ console.log("Generation started.");
15498
+ }, "action"));
15499
+ }
15500
+ __name(registerClarityGenerateCurrentProcess, "registerClarityGenerateCurrentProcess");
15501
+
15502
+ // src/commands/clarity/generate-transformation-proposal.ts
15503
+ function registerClarityGenerateTransformationProposal(clarity) {
15504
+ clarity.command("generate-transformation-proposal <process-id>").description(
15505
+ "Trigger transformation-proposal generation for a Clarity v2 process (async)"
15506
+ ).option(
15507
+ "--current-process-id <id>",
15508
+ "current-process snapshot to anchor generation to"
15509
+ ).option(
15510
+ "--regenerate-from <id>",
15511
+ "previous transformation proposal to regenerate from"
15512
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, options) {
15513
+ if (options.currentProcessId !== void 0 && options.regenerateFrom !== void 0) {
14847
15514
  throw new CliError(
14848
- `Unexpected response from the API: ${parsed.error.message}`
15515
+ "Pass either --current-process-id or --regenerate-from, not both."
14849
15516
  );
14850
15517
  }
14851
- const { snapshot } = parsed.data;
15518
+ const body = buildGenerateTransformationProposalBody(options);
15519
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
15520
+ const raw = await httpRequest({
15521
+ method: "POST",
15522
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/transformation-proposal`,
15523
+ apiKey,
15524
+ apiBaseUrl,
15525
+ body
15526
+ });
15527
+ if (options.json) {
15528
+ printJson(raw);
15529
+ return;
15530
+ }
15531
+ console.log("Generation started.");
15532
+ }, "action"));
15533
+ }
15534
+ __name(registerClarityGenerateTransformationProposal, "registerClarityGenerateTransformationProposal");
15535
+ function buildGenerateTransformationProposalBody(options) {
15536
+ if (options.regenerateFrom !== void 0) {
15537
+ return { regenerate_from: options.regenerateFrom };
15538
+ }
15539
+ if (options.currentProcessId !== void 0) {
15540
+ return { current_process_id: options.currentProcessId };
15541
+ }
15542
+ return void 0;
15543
+ }
15544
+ __name(buildGenerateTransformationProposalBody, "buildGenerateTransformationProposalBody");
15545
+
15546
+ // src/commands/clarity/get-current-process.ts
15547
+ import { z as z80 } from "zod";
15548
+
15549
+ // src/commands/clarity/read-api.ts
15550
+ var AUTH_ERROR_MARKER = "Unauthorized.";
15551
+ var NOT_FOUND_ERROR_PREFIX = "Not found:";
15552
+ var FETCH_FAILED_MARKER = "fetch failed";
15553
+ async function listClarityProcesses(config, teamId, params) {
15554
+ const searchParams = new URLSearchParams();
15555
+ searchParams.append("limit", String(params.limit));
15556
+ searchParams.append("offset", String(params.offset));
15557
+ if (params.search !== void 0) {
15558
+ searchParams.append("search", params.search);
15559
+ }
15560
+ if (params.status !== void 0) {
15561
+ searchParams.append("status", params.status);
15562
+ }
15563
+ if (params.version !== void 0) {
15564
+ searchParams.append("version", String(params.version));
15565
+ }
15566
+ const raw = await getClarityJson(config, {
15567
+ method: "GET",
15568
+ path: buildTeamPath(teamId, "/clarity-v2/processes"),
15569
+ searchParams,
15570
+ resource: "Clarity process list"
15571
+ });
15572
+ return parseResponse(listClarityProcessesResponseSchema, raw);
15573
+ }
15574
+ __name(listClarityProcesses, "listClarityProcesses");
15575
+ async function getClarityV2Process(config, processId) {
15576
+ const raw = await getClarityJson(config, {
15577
+ method: "GET",
15578
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}`,
15579
+ resource: "Clarity v2 process"
15580
+ });
15581
+ return parseResponse(clarityV2ProcessReadModelSchema, raw);
15582
+ }
15583
+ __name(getClarityV2Process, "getClarityV2Process");
15584
+ async function getLegacyClarityProcess(config, processId) {
15585
+ const raw = await getClarityJson(config, {
15586
+ method: "GET",
15587
+ path: `/v2/clarity/processes/${encodeURIComponent(processId)}`,
15588
+ resource: "legacy Clarity process"
15589
+ });
15590
+ return parseResponse(legacyClarityProcessResponseSchema, raw);
15591
+ }
15592
+ __name(getLegacyClarityProcess, "getLegacyClarityProcess");
15593
+ async function getCurrentProcessSnapshot(config, processId, snapshotId) {
15594
+ const raw = await getClarityJson(config, {
15595
+ method: "GET",
15596
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(
15597
+ processId
15598
+ )}/current-process/${encodeURIComponent(snapshotId)}`,
15599
+ resource: "Clarity current-process snapshot"
15600
+ });
15601
+ return parseResponse(
15602
+ clarityV2CurrentProcessSnapshotDetailResponseSchema,
15603
+ raw
15604
+ );
15605
+ }
15606
+ __name(getCurrentProcessSnapshot, "getCurrentProcessSnapshot");
15607
+ async function getTransformationProposalSnapshot(config, processId, snapshotId) {
15608
+ const raw = await getClarityJson(config, {
15609
+ method: "GET",
15610
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(
15611
+ processId
15612
+ )}/transformation-proposal/${encodeURIComponent(snapshotId)}`,
15613
+ resource: "Clarity transformation-proposal snapshot"
15614
+ });
15615
+ return parseResponse(
15616
+ clarityV2TransformationProposalSnapshotDetailResponseSchema,
15617
+ raw
15618
+ );
15619
+ }
15620
+ __name(getTransformationProposalSnapshot, "getTransformationProposalSnapshot");
15621
+ async function listExtraCaptureRequests(config, processId, proposalId, params = {}) {
15622
+ const searchParams = new URLSearchParams();
15623
+ searchParams.append("limit", String(params.limit ?? 100));
15624
+ searchParams.append("offset", String(params.offset ?? 0));
15625
+ const raw = await getClarityJson(config, {
15626
+ method: "GET",
15627
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(
15628
+ processId
15629
+ )}/transformation-proposals/${encodeURIComponent(
15630
+ proposalId
15631
+ )}/extra-capture-requests`,
15632
+ searchParams,
15633
+ resource: "Clarity extra-capture requests"
15634
+ });
15635
+ return parseResponse(
15636
+ clarityProposalExtraCaptureRequestListResponseSchema,
15637
+ raw
15638
+ );
15639
+ }
15640
+ __name(listExtraCaptureRequests, "listExtraCaptureRequests");
15641
+ function isLegacyV2ReadError(error) {
15642
+ return error instanceof CliHttpError && error.status === 403 && (error.apiErrorCode === "PROCESS_NOT_ON_V2" || error.apiErrorMessage === "Process is not on v2");
15643
+ }
15644
+ __name(isLegacyV2ReadError, "isLegacyV2ReadError");
15645
+ async function requireV2Process(config, processId) {
15646
+ try {
15647
+ return await getClarityV2Process(config, processId);
15648
+ } catch (error) {
15649
+ if (isLegacyV2ReadError(error)) {
15650
+ throw new CliError(
15651
+ "This command requires Clarity v2. Use `duvo clarity overview <process-id>` to read legacy v1 context."
15652
+ );
15653
+ }
15654
+ throw error;
15655
+ }
15656
+ }
15657
+ __name(requireV2Process, "requireV2Process");
15658
+ async function getClarityJson(config, options) {
15659
+ try {
15660
+ return await httpRequest({
15661
+ method: options.method,
15662
+ path: options.path,
15663
+ apiKey: config.apiKey,
15664
+ apiBaseUrl: config.apiBaseUrl,
15665
+ searchParams: options.searchParams
15666
+ });
15667
+ } catch (error) {
15668
+ throw toClarityCliError(error, {
15669
+ apiBaseUrl: config.apiBaseUrl,
15670
+ resource: options.resource
15671
+ });
15672
+ }
15673
+ }
15674
+ __name(getClarityJson, "getClarityJson");
15675
+ function toClarityCliError(error, context) {
15676
+ if (isLegacyV2ReadError(error)) {
15677
+ return error;
15678
+ }
15679
+ if (error instanceof CliHttpError && error.status === 403) {
15680
+ return new CliError(
15681
+ `${context.resource} is not accessible with the active profile. Check the process ID and active profile with \`duvo whoami\` or reauthenticate with \`duvo login\`.`,
15682
+ EXIT_CODE.FORBIDDEN
15683
+ );
15684
+ }
15685
+ if (error instanceof CliError) {
15686
+ if (error.message.includes(AUTH_ERROR_MARKER)) {
15687
+ return new CliError(
15688
+ "Authentication failed. Run `duvo login` to reauthenticate, or update your API key with `duvo login --api-key <key>`.",
15689
+ EXIT_CODE.AUTH
15690
+ );
15691
+ }
15692
+ if (error.message.startsWith(NOT_FOUND_ERROR_PREFIX)) {
15693
+ return new CliError(
15694
+ `${context.resource} was not found for the active profile. Check the process/snapshot ID and active profile; cross-team resources are not revealed.`,
15695
+ EXIT_CODE.NOT_FOUND
15696
+ );
15697
+ }
15698
+ return error;
15699
+ }
15700
+ if (error instanceof TypeError && error.message.includes(FETCH_FAILED_MARKER)) {
15701
+ return new CliError(
15702
+ `Could not reach the Duvo API at ${context.apiBaseUrl}. Check the API base URL and network connection.`
15703
+ );
15704
+ }
15705
+ return error;
15706
+ }
15707
+ __name(toClarityCliError, "toClarityCliError");
15708
+ function parseResponse(schema, raw) {
15709
+ const parsed = schema.safeParse(raw);
15710
+ if (!parsed.success) {
15711
+ throw new CliError(
15712
+ `Unexpected response from the API: ${parsed.error.message}`
15713
+ );
15714
+ }
15715
+ return parsed.data;
15716
+ }
15717
+ __name(parseResponse, "parseResponse");
15718
+
15719
+ // src/commands/clarity/get-current-process.ts
15720
+ var snapshotSchema = z80.object({
15721
+ snapshot: z80.object({
15722
+ id: z80.string(),
15723
+ status: z80.string(),
15724
+ creator_type: z80.string(),
15725
+ user_id: z80.string().nullable(),
15726
+ sandbox_id: z80.string().nullable(),
15727
+ created_at: z80.string(),
15728
+ updated_at: z80.string()
15729
+ })
15730
+ });
15731
+ function registerClarityGetCurrentProcess(clarity) {
15732
+ clarity.command("get-current-process <process-id> <snapshot-id>").description("Get a specific current-process snapshot by ID").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, snapshotId, options) {
15733
+ const config = await requireAuthenticatedConfig(this);
15734
+ const raw = await getClarityJson(config, {
15735
+ method: "GET",
15736
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/current-process/${encodeURIComponent(snapshotId)}`,
15737
+ resource: "Clarity current-process snapshot"
15738
+ });
15739
+ if (options.json) {
15740
+ printJson(raw);
15741
+ return;
15742
+ }
15743
+ const parsed = snapshotSchema.safeParse(raw);
15744
+ if (!parsed.success) {
15745
+ throw new CliError(
15746
+ `Unexpected response from the API: ${parsed.error.message}`
15747
+ );
15748
+ }
15749
+ const { snapshot } = parsed.data;
14852
15750
  console.log(
14853
15751
  renderKeyValue([
14854
15752
  { label: "ID", value: snapshot.id },
@@ -14865,26 +15763,25 @@ function registerClarityGetCurrentProcess(clarity) {
14865
15763
  __name(registerClarityGetCurrentProcess, "registerClarityGetCurrentProcess");
14866
15764
 
14867
15765
  // src/commands/clarity/get-transformation-proposal.ts
14868
- import { z as z77 } from "zod";
14869
- var snapshotSchema2 = z77.object({
14870
- snapshot: z77.object({
14871
- id: z77.string(),
14872
- status: z77.string(),
14873
- creator_type: z77.string(),
14874
- user_id: z77.string().nullable(),
14875
- sandbox_id: z77.string().nullable(),
14876
- created_at: z77.string(),
14877
- updated_at: z77.string()
15766
+ import { z as z81 } from "zod";
15767
+ var snapshotSchema2 = z81.object({
15768
+ snapshot: z81.object({
15769
+ id: z81.string(),
15770
+ status: z81.string(),
15771
+ creator_type: z81.string(),
15772
+ user_id: z81.string().nullable(),
15773
+ sandbox_id: z81.string().nullable(),
15774
+ created_at: z81.string(),
15775
+ updated_at: z81.string()
14878
15776
  })
14879
15777
  });
14880
15778
  function registerClarityGetTransformationProposal(clarity) {
14881
15779
  clarity.command("get-transformation-proposal <process-id> <proposal-id>").description("Get a specific transformation-proposal snapshot by ID").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, proposalId, options) {
14882
- const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14883
- const raw = await httpRequest({
15780
+ const config = await requireAuthenticatedConfig(this);
15781
+ const raw = await getClarityJson(config, {
14884
15782
  method: "GET",
14885
15783
  path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/transformation-proposal/${encodeURIComponent(proposalId)}`,
14886
- apiKey,
14887
- apiBaseUrl
15784
+ resource: "Clarity transformation-proposal snapshot"
14888
15785
  });
14889
15786
  if (options.json) {
14890
15787
  printJson(raw);
@@ -14915,24 +15812,13 @@ __name(registerClarityGetTransformationProposal, "registerClarityGetTransformati
14915
15812
  // src/commands/clarity/get.ts
14916
15813
  function registerClarityGet(clarity) {
14917
15814
  clarity.command("get <process-id>").description("Get a Clarity process read model by ID").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function getAction(processId, options) {
14918
- const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
14919
- const raw = await httpRequest({
14920
- method: "GET",
14921
- path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}`,
14922
- apiKey,
14923
- apiBaseUrl
14924
- });
15815
+ const config = await requireAuthenticatedConfig(this);
15816
+ const result = await requireV2Process(config, processId);
14925
15817
  if (options.json) {
14926
- printJson(raw);
15818
+ printJson(result);
14927
15819
  return;
14928
15820
  }
14929
- const parsed = clarityV2ProcessReadModelSchema.safeParse(raw);
14930
- if (!parsed.success) {
14931
- throw new CliError(
14932
- `Unexpected response from the API: ${parsed.error.message}`
14933
- );
14934
- }
14935
- const { process: process2 } = parsed.data;
15821
+ const { process: process2 } = result;
14936
15822
  console.log(
14937
15823
  renderKeyValue([
14938
15824
  { label: "ID", value: process2.id },
@@ -14954,7 +15840,7 @@ function registerClarityGet(clarity) {
14954
15840
  const {
14955
15841
  current_process_versions: cpVersions,
14956
15842
  transformation_proposal_versions: tpVersions
14957
- } = parsed.data;
15843
+ } = result;
14958
15844
  if (cpVersions.length > 0) {
14959
15845
  console.log(`
14960
15846
  Current process versions (${cpVersions.length}):`);
@@ -15014,15 +15900,14 @@ function registerClarityListExtraCaptureRequests(clarity) {
15014
15900
  max: MAX_LIMIT5
15015
15901
  });
15016
15902
  const offset = parseOffset(options.offset);
15017
- const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
15903
+ const config = await requireAuthenticatedConfig(this);
15018
15904
  const searchParams = new URLSearchParams();
15019
15905
  searchParams.append("limit", String(limit));
15020
15906
  searchParams.append("offset", String(offset));
15021
- const raw = await httpRequest({
15907
+ const raw = await getClarityJson(config, {
15022
15908
  method: "GET",
15023
15909
  path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/transformation-proposals/${encodeURIComponent(proposalId)}/extra-capture-requests`,
15024
- apiKey,
15025
- apiBaseUrl,
15910
+ resource: "Clarity extra-capture requests",
15026
15911
  searchParams
15027
15912
  });
15028
15913
  if (options.json) {
@@ -15048,193 +15933,180 @@ function registerClarityListExtraCaptureRequests(clarity) {
15048
15933
  }
15049
15934
  __name(registerClarityListExtraCaptureRequests, "registerClarityListExtraCaptureRequests");
15050
15935
 
15051
- // src/api/clarity-schemas.ts
15052
- import { z as z78 } from "zod";
15053
- var clarityListProcessSchema = z78.object({
15054
- id: z78.guid(),
15055
- name: z78.string(),
15056
- status: clarityProcessStatusSchema,
15057
- version: z78.number().int(),
15058
- capture_count: z78.number().int(),
15059
- capture_counts: z78.object({
15060
- video: z78.number().int(),
15061
- interview: z78.number().int(),
15062
- document: z78.number().int()
15063
- }).optional(),
15064
- pending_invitation_count: z78.number().int(),
15065
- contributors: z78.array(
15066
- z78.object({
15067
- user_id: z78.string(),
15068
- user_name: z78.string()
15069
- })
15070
- ),
15071
- created_at: z78.string(),
15072
- created_by_name: z78.string().nullable()
15073
- });
15074
- var listClarityProcessesResponseSchema = z78.object({
15075
- processes: z78.array(clarityListProcessSchema),
15076
- total: z78.number().int(),
15077
- limit: z78.number().int(),
15078
- offset: z78.number().int()
15079
- });
15080
- var legacyClarityProcessResponseSchema = legacyClarityProcessDetailSchema;
15081
-
15082
- // src/commands/clarity/read-api.ts
15083
- var AUTH_ERROR_MARKER = "Unauthorized.";
15084
- var NOT_FOUND_ERROR_PREFIX = "Not found:";
15085
- var FETCH_FAILED_MARKER = "fetch failed";
15086
- async function listClarityProcesses(config, teamId, params) {
15087
- const searchParams = new URLSearchParams();
15088
- searchParams.append("limit", String(params.limit));
15089
- searchParams.append("offset", String(params.offset));
15090
- if (params.search !== void 0) {
15091
- searchParams.append("search", params.search);
15092
- }
15093
- if (params.status !== void 0) {
15094
- searchParams.append("status", params.status);
15095
- }
15096
- if (params.version !== void 0) {
15097
- searchParams.append("version", String(params.version));
15098
- }
15099
- const raw = await getClarityJson(config, {
15100
- method: "GET",
15101
- path: buildTeamPath(teamId, "/clarity-v2/processes"),
15102
- searchParams,
15103
- resource: "Clarity process list"
15104
- });
15105
- return parseResponse(listClarityProcessesResponseSchema, raw);
15106
- }
15107
- __name(listClarityProcesses, "listClarityProcesses");
15108
- async function getClarityV2Process(config, processId) {
15109
- const raw = await getClarityJson(config, {
15110
- method: "GET",
15111
- path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}`,
15112
- resource: "Clarity v2 process"
15113
- });
15114
- return parseResponse(clarityV2ProcessReadModelSchema, raw);
15115
- }
15116
- __name(getClarityV2Process, "getClarityV2Process");
15117
- async function getLegacyClarityProcess(config, processId) {
15118
- const raw = await getClarityJson(config, {
15119
- method: "GET",
15120
- path: `/v2/clarity/processes/${encodeURIComponent(processId)}`,
15121
- resource: "legacy Clarity process"
15122
- });
15123
- return parseResponse(legacyClarityProcessResponseSchema, raw);
15124
- }
15125
- __name(getLegacyClarityProcess, "getLegacyClarityProcess");
15126
- async function getCurrentProcessSnapshot(config, processId, snapshotId) {
15127
- const raw = await getClarityJson(config, {
15128
- method: "GET",
15129
- path: `/v2/clarity-v2/processes/${encodeURIComponent(
15130
- processId
15131
- )}/current-process/${encodeURIComponent(snapshotId)}`,
15132
- resource: "Clarity current-process snapshot"
15133
- });
15134
- return parseResponse(
15135
- clarityV2CurrentProcessSnapshotDetailResponseSchema,
15136
- raw
15137
- );
15138
- }
15139
- __name(getCurrentProcessSnapshot, "getCurrentProcessSnapshot");
15140
- async function getTransformationProposalSnapshot(config, processId, snapshotId) {
15141
- const raw = await getClarityJson(config, {
15142
- method: "GET",
15143
- path: `/v2/clarity-v2/processes/${encodeURIComponent(
15144
- processId
15145
- )}/transformation-proposal/${encodeURIComponent(snapshotId)}`,
15146
- resource: "Clarity transformation-proposal snapshot"
15147
- });
15148
- return parseResponse(
15149
- clarityV2TransformationProposalSnapshotDetailResponseSchema,
15150
- raw
15151
- );
15152
- }
15153
- __name(getTransformationProposalSnapshot, "getTransformationProposalSnapshot");
15154
- async function listExtraCaptureRequests(config, processId, proposalId, params = {}) {
15155
- const searchParams = new URLSearchParams();
15156
- searchParams.append("limit", String(params.limit ?? 100));
15157
- searchParams.append("offset", String(params.offset ?? 0));
15158
- const raw = await getClarityJson(config, {
15159
- method: "GET",
15160
- path: `/v2/clarity-v2/processes/${encodeURIComponent(
15161
- processId
15162
- )}/transformation-proposals/${encodeURIComponent(
15163
- proposalId
15164
- )}/extra-capture-requests`,
15165
- searchParams,
15166
- resource: "Clarity extra-capture requests"
15167
- });
15168
- return parseResponse(
15169
- clarityProposalExtraCaptureRequestListResponseSchema,
15170
- raw
15171
- );
15172
- }
15173
- __name(listExtraCaptureRequests, "listExtraCaptureRequests");
15174
- function isLegacyV2ReadError(error) {
15175
- return error instanceof CliHttpError && error.status === 403 && (error.apiErrorCode === "PROCESS_NOT_ON_V2" || error.apiErrorMessage === "Process is not on v2");
15176
- }
15177
- __name(isLegacyV2ReadError, "isLegacyV2ReadError");
15178
- async function getClarityJson(config, options) {
15179
- try {
15180
- return await httpRequest({
15181
- method: options.method,
15182
- path: options.path,
15183
- apiKey: config.apiKey,
15184
- apiBaseUrl: config.apiBaseUrl,
15185
- searchParams: options.searchParams
15186
- });
15187
- } catch (error) {
15188
- throw toClarityCliError(error, {
15189
- apiBaseUrl: config.apiBaseUrl,
15190
- resource: options.resource
15936
+ // src/commands/clarity/postprocess.ts
15937
+ var SNAPSHOT_TYPES = ["current_process", "transformation_proposal"];
15938
+ function registerClarityPostprocess(clarity) {
15939
+ clarity.command("postprocess <process-id> <snapshot-type> <snapshot-id>").description(
15940
+ `Re-run postprocessing agents on an existing snapshot. snapshot-type must be one of: ${SNAPSHOT_TYPES.join(", ")}`
15941
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, snapshotType, snapshotId, options) {
15942
+ if (!SNAPSHOT_TYPES.includes(snapshotType)) {
15943
+ throw new CliError(
15944
+ `snapshot-type must be one of: ${SNAPSHOT_TYPES.join(", ")}`
15945
+ );
15946
+ }
15947
+ const type = snapshotType;
15948
+ const body = type === "current_process" ? { type, current_process_id: snapshotId } : { type, transformation_proposal_id: snapshotId };
15949
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
15950
+ const raw = await httpRequest({
15951
+ method: "POST",
15952
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/postprocess`,
15953
+ apiKey,
15954
+ apiBaseUrl,
15955
+ body
15191
15956
  });
15192
- }
15957
+ if (options.json) {
15958
+ printJson(raw);
15959
+ return;
15960
+ }
15961
+ console.log("Postprocessing started.");
15962
+ }, "action"));
15193
15963
  }
15194
- __name(getClarityJson, "getClarityJson");
15195
- function toClarityCliError(error, context) {
15196
- if (isLegacyV2ReadError(error)) {
15197
- return error;
15198
- }
15199
- if (error instanceof CliHttpError && error.status === 403) {
15200
- return new CliError(
15201
- `${context.resource} is not accessible with the active profile. Check the process ID and active profile with \`duvo whoami\` or reauthenticate with \`duvo login\`.`,
15202
- EXIT_CODE.FORBIDDEN
15203
- );
15204
- }
15205
- if (error instanceof CliError) {
15206
- if (error.message.includes(AUTH_ERROR_MARKER)) {
15207
- return new CliError(
15208
- "Authentication failed. Run `duvo login` to reauthenticate, or update your API key with `duvo login --api-key <key>`.",
15209
- EXIT_CODE.AUTH
15964
+ __name(registerClarityPostprocess, "registerClarityPostprocess");
15965
+
15966
+ // src/commands/clarity/promote-current-process.ts
15967
+ import { z as z82 } from "zod";
15968
+ var snapshotSchema3 = z82.object({
15969
+ snapshot: z82.object({
15970
+ id: z82.string(),
15971
+ status: z82.string(),
15972
+ creator_type: z82.string(),
15973
+ created_at: z82.string(),
15974
+ updated_at: z82.string()
15975
+ })
15976
+ });
15977
+ function registerClarityPromoteCurrentProcess(clarity) {
15978
+ clarity.command("promote-current-process <process-id> <snapshot-id>").description("Promote a current-process snapshot to live").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, snapshotId, options) {
15979
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
15980
+ const raw = await httpRequest({
15981
+ method: "POST",
15982
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/current-process/${encodeURIComponent(snapshotId)}/promote`,
15983
+ apiKey,
15984
+ apiBaseUrl
15985
+ });
15986
+ if (options.json) {
15987
+ printJson(raw);
15988
+ return;
15989
+ }
15990
+ const parsed = snapshotSchema3.safeParse(raw);
15991
+ if (!parsed.success) {
15992
+ throw new CliError(
15993
+ `Unexpected response from the API: ${parsed.error.message}`
15210
15994
  );
15211
15995
  }
15212
- if (error.message.startsWith(NOT_FOUND_ERROR_PREFIX)) {
15213
- return new CliError(
15214
- `${context.resource} was not found for the active profile. Check the process/snapshot ID and active profile; cross-team resources are not revealed.`,
15215
- EXIT_CODE.NOT_FOUND
15996
+ const { snapshot } = parsed.data;
15997
+ console.log(
15998
+ renderKeyValue([
15999
+ { label: "ID", value: snapshot.id },
16000
+ { label: "Status", value: snapshot.status },
16001
+ { label: "Creator type", value: snapshot.creator_type },
16002
+ { label: "Created", value: snapshot.created_at },
16003
+ { label: "Updated", value: snapshot.updated_at }
16004
+ ])
16005
+ );
16006
+ }, "action"));
16007
+ }
16008
+ __name(registerClarityPromoteCurrentProcess, "registerClarityPromoteCurrentProcess");
16009
+
16010
+ // src/commands/clarity/promote-transformation-proposal.ts
16011
+ import { z as z83 } from "zod";
16012
+ var snapshotSchema4 = z83.object({
16013
+ snapshot: z83.object({
16014
+ id: z83.string(),
16015
+ status: z83.string(),
16016
+ creator_type: z83.string(),
16017
+ created_at: z83.string(),
16018
+ updated_at: z83.string()
16019
+ })
16020
+ });
16021
+ function registerClarityPromoteTransformationProposal(clarity) {
16022
+ clarity.command("promote-transformation-proposal <process-id> <proposal-id>").description("Promote a transformation-proposal snapshot to live").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, proposalId, options) {
16023
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
16024
+ const raw = await httpRequest({
16025
+ method: "POST",
16026
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/transformation-proposal/${encodeURIComponent(proposalId)}/promote`,
16027
+ apiKey,
16028
+ apiBaseUrl
16029
+ });
16030
+ if (options.json) {
16031
+ printJson(raw);
16032
+ return;
16033
+ }
16034
+ const parsed = snapshotSchema4.safeParse(raw);
16035
+ if (!parsed.success) {
16036
+ throw new CliError(
16037
+ `Unexpected response from the API: ${parsed.error.message}`
15216
16038
  );
15217
16039
  }
15218
- return error;
15219
- }
15220
- if (error instanceof TypeError && error.message.includes(FETCH_FAILED_MARKER)) {
15221
- return new CliError(
15222
- `Could not reach the Duvo API at ${context.apiBaseUrl}. Check the API base URL and network connection.`
16040
+ const { snapshot } = parsed.data;
16041
+ console.log(
16042
+ renderKeyValue([
16043
+ { label: "ID", value: snapshot.id },
16044
+ { label: "Status", value: snapshot.status },
16045
+ { label: "Creator type", value: snapshot.creator_type },
16046
+ { label: "Created", value: snapshot.created_at },
16047
+ { label: "Updated", value: snapshot.updated_at }
16048
+ ])
15223
16049
  );
15224
- }
15225
- return error;
16050
+ }, "action"));
15226
16051
  }
15227
- __name(toClarityCliError, "toClarityCliError");
15228
- function parseResponse(schema, raw) {
15229
- const parsed = schema.safeParse(raw);
15230
- if (!parsed.success) {
15231
- throw new CliError(
15232
- `Unexpected response from the API: ${parsed.error.message}`
15233
- );
15234
- }
15235
- return parsed.data;
16052
+ __name(registerClarityPromoteTransformationProposal, "registerClarityPromoteTransformationProposal");
16053
+
16054
+ // src/commands/clarity/revert-current-process.ts
16055
+ function registerClarityRevertCurrentProcess(clarity) {
16056
+ clarity.command("revert-current-process <process-id> <snapshot-id>").description("Delete (revert) a current-process snapshot").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, snapshotId, options) {
16057
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
16058
+ const raw = await httpRequest({
16059
+ method: "DELETE",
16060
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/current-process/${encodeURIComponent(snapshotId)}`,
16061
+ apiKey,
16062
+ apiBaseUrl
16063
+ });
16064
+ if (options.json) {
16065
+ printJson(raw);
16066
+ return;
16067
+ }
16068
+ console.log("Snapshot reverted.");
16069
+ }, "action"));
15236
16070
  }
15237
- __name(parseResponse, "parseResponse");
16071
+ __name(registerClarityRevertCurrentProcess, "registerClarityRevertCurrentProcess");
16072
+
16073
+ // src/commands/clarity/revert-transformation-proposal.ts
16074
+ function registerClarityRevertTransformationProposal(clarity) {
16075
+ clarity.command("revert-transformation-proposal <process-id> <proposal-id>").description("Delete (revert) a transformation-proposal snapshot").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, proposalId, options) {
16076
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
16077
+ const raw = await httpRequest({
16078
+ method: "DELETE",
16079
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/transformation-proposal/${encodeURIComponent(proposalId)}`,
16080
+ apiKey,
16081
+ apiBaseUrl
16082
+ });
16083
+ if (options.json) {
16084
+ printJson(raw);
16085
+ return;
16086
+ }
16087
+ console.log("Snapshot reverted.");
16088
+ }, "action"));
16089
+ }
16090
+ __name(registerClarityRevertTransformationProposal, "registerClarityRevertTransformationProposal");
16091
+
16092
+ // src/commands/clarity/stop-transformation-proposal.ts
16093
+ function registerClarityStopTransformationProposal(clarity) {
16094
+ clarity.command("stop-transformation-proposal <process-id>").description("Stop an in-flight transformation-proposal generation").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function action(processId, options) {
16095
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
16096
+ const raw = await httpRequest({
16097
+ method: "POST",
16098
+ path: `/v2/clarity-v2/processes/${encodeURIComponent(processId)}/transformation-proposal/stop`,
16099
+ apiKey,
16100
+ apiBaseUrl
16101
+ });
16102
+ if (options.json) {
16103
+ printJson(raw);
16104
+ return;
16105
+ }
16106
+ console.log("Generation stopped.");
16107
+ }, "action"));
16108
+ }
16109
+ __name(registerClarityStopTransformationProposal, "registerClarityStopTransformationProposal");
15238
16110
 
15239
16111
  // src/commands/clarity/index.ts
15240
16112
  var DEFAULT_LIMIT6 = 50;
@@ -15342,8 +16214,200 @@ var CLARITY_READ_TOOLS = [
15342
16214
  }
15343
16215
  ],
15344
16216
  description: "Read active extra-capture requests for a v2 transformation proposal."
16217
+ },
16218
+ {
16219
+ name: "listClarityArtifactChatConversations",
16220
+ scope: "v2",
16221
+ read_only: true,
16222
+ commands: ["duvo clarity artifact-chat-conversations"],
16223
+ endpoints: [
16224
+ {
16225
+ method: "GET",
16226
+ path: "/v2/clarity-v2/processes/:processId/artifact-chat/conversations"
16227
+ }
16228
+ ],
16229
+ description: "List recent artifact-chat conversations for a v2 process and snapshot kind."
16230
+ },
16231
+ {
16232
+ name: "getClarityArtifactChatMessages",
16233
+ scope: "v2",
16234
+ read_only: true,
16235
+ commands: ["duvo clarity artifact-chat-messages"],
16236
+ endpoints: [
16237
+ {
16238
+ method: "GET",
16239
+ path: "/v2/clarity-v2/processes/:processId/artifact-chat/conversations/:conversationId/messages"
16240
+ }
16241
+ ],
16242
+ description: "Read messages for one artifact-chat conversation in a v2 process."
16243
+ }
16244
+ ];
16245
+ var CLARITY_WRITE_TOOLS = [
16246
+ {
16247
+ name: "generateClarityCurrentProcess",
16248
+ scope: "v2",
16249
+ read_only: false,
16250
+ commands: ["duvo clarity generate-current-process"],
16251
+ endpoints: [
16252
+ {
16253
+ method: "POST",
16254
+ path: "/v2/clarity-v2/processes/:processId/current-process"
16255
+ }
16256
+ ],
16257
+ description: "Start asynchronous current-process generation."
16258
+ },
16259
+ {
16260
+ name: "generateClarityTransformationProposal",
16261
+ scope: "v2",
16262
+ read_only: false,
16263
+ commands: ["duvo clarity generate-transformation-proposal"],
16264
+ endpoints: [
16265
+ {
16266
+ method: "POST",
16267
+ path: "/v2/clarity-v2/processes/:processId/transformation-proposal"
16268
+ }
16269
+ ],
16270
+ description: "Start asynchronous transformation-proposal generation or regeneration."
16271
+ },
16272
+ {
16273
+ name: "promoteClarityCurrentProcess",
16274
+ scope: "v2",
16275
+ read_only: false,
16276
+ commands: ["duvo clarity promote-current-process"],
16277
+ endpoints: [
16278
+ {
16279
+ method: "POST",
16280
+ path: "/v2/clarity-v2/processes/:processId/current-process/:snapshotId/promote"
16281
+ }
16282
+ ],
16283
+ description: "Promote a current-process snapshot to live."
16284
+ },
16285
+ {
16286
+ name: "promoteClarityTransformationProposal",
16287
+ scope: "v2",
16288
+ read_only: false,
16289
+ commands: ["duvo clarity promote-transformation-proposal"],
16290
+ endpoints: [
16291
+ {
16292
+ method: "POST",
16293
+ path: "/v2/clarity-v2/processes/:processId/transformation-proposal/:proposalId/promote"
16294
+ }
16295
+ ],
16296
+ description: "Promote a transformation-proposal snapshot to live."
16297
+ },
16298
+ {
16299
+ name: "revertClarityCurrentProcess",
16300
+ scope: "v2",
16301
+ read_only: false,
16302
+ commands: ["duvo clarity revert-current-process"],
16303
+ endpoints: [
16304
+ {
16305
+ method: "DELETE",
16306
+ path: "/v2/clarity-v2/processes/:processId/current-process/:snapshotId"
16307
+ }
16308
+ ],
16309
+ description: "Delete a current-process snapshot."
16310
+ },
16311
+ {
16312
+ name: "revertClarityTransformationProposal",
16313
+ scope: "v2",
16314
+ read_only: false,
16315
+ commands: ["duvo clarity revert-transformation-proposal"],
16316
+ endpoints: [
16317
+ {
16318
+ method: "DELETE",
16319
+ path: "/v2/clarity-v2/processes/:processId/transformation-proposal/:proposalId"
16320
+ }
16321
+ ],
16322
+ description: "Delete a transformation-proposal snapshot."
16323
+ },
16324
+ {
16325
+ name: "assignClarityExtraCaptureRequest",
16326
+ scope: "v2",
16327
+ read_only: false,
16328
+ commands: ["duvo clarity assign-extra-capture-request"],
16329
+ endpoints: [
16330
+ {
16331
+ method: "PATCH",
16332
+ path: "/v2/clarity-v2/processes/:processId/transformation-proposals/:proposalId/extra-capture-requests/:requestId/assign"
16333
+ }
16334
+ ],
16335
+ description: "Assign or unassign an extra-capture request."
16336
+ },
16337
+ {
16338
+ name: "postprocessClaritySnapshot",
16339
+ scope: "v2",
16340
+ read_only: false,
16341
+ commands: ["duvo clarity postprocess"],
16342
+ endpoints: [
16343
+ {
16344
+ method: "POST",
16345
+ path: "/v2/clarity-v2/processes/:processId/postprocess"
16346
+ }
16347
+ ],
16348
+ description: "Re-run postprocessing for an existing snapshot."
16349
+ },
16350
+ {
16351
+ name: "buildClarityAutomation",
16352
+ scope: "v2",
16353
+ read_only: false,
16354
+ commands: ["duvo clarity build-automation"],
16355
+ endpoints: [
16356
+ {
16357
+ method: "POST",
16358
+ path: "/v2/clarity-v2/processes/:processId/automation"
16359
+ }
16360
+ ],
16361
+ description: "Start workflow-builder automation generation from the latest proposal."
16362
+ },
16363
+ {
16364
+ name: "stopClarityTransformationProposal",
16365
+ scope: "v2",
16366
+ read_only: false,
16367
+ commands: ["duvo clarity stop-transformation-proposal"],
16368
+ endpoints: [
16369
+ {
16370
+ method: "POST",
16371
+ path: "/v2/clarity-v2/processes/:processId/transformation-proposal/stop"
16372
+ }
16373
+ ],
16374
+ description: "Stop an in-flight transformation-proposal generation."
16375
+ },
16376
+ {
16377
+ name: "createClarityInviteLink",
16378
+ scope: "v2",
16379
+ read_only: false,
16380
+ commands: ["duvo clarity create-invite-link"],
16381
+ endpoints: [
16382
+ {
16383
+ method: "POST",
16384
+ path: "/v2/clarity-v2/processes/:processId/invite-link"
16385
+ }
16386
+ ],
16387
+ description: "Create or regenerate a public Clarity interview invite link."
16388
+ },
16389
+ {
16390
+ name: "importClarityArtifact",
16391
+ scope: "v2",
16392
+ read_only: false,
16393
+ commands: ["duvo clarity import-artifact"],
16394
+ endpoints: [
16395
+ {
16396
+ method: "POST",
16397
+ path: "/v2/clarity-v2/processes/:processId/artifact-imports/create-upload-url"
16398
+ },
16399
+ {
16400
+ method: "POST",
16401
+ path: "/v2/clarity-v2/processes/:processId/artifact-imports/:captureId/complete"
16402
+ }
16403
+ ],
16404
+ description: "Upload and complete a local Miro SVG, XML, PNG, or JPEG export."
15345
16405
  }
15346
16406
  ];
16407
+ var CLARITY_TOOLS = [
16408
+ ...CLARITY_READ_TOOLS,
16409
+ ...CLARITY_WRITE_TOOLS
16410
+ ];
15347
16411
  var CLARITY_TOOL_COLUMNS = [
15348
16412
  { header: "TOOL", cell: /* @__PURE__ */ __name((row) => row.name, "cell") },
15349
16413
  { header: "SCOPE", cell: /* @__PURE__ */ __name((row) => row.scope, "cell") },
@@ -15354,7 +16418,7 @@ var CLARITY_TOOL_COLUMNS = [
15354
16418
  },
15355
16419
  {
15356
16420
  header: "ENDPOINTS",
15357
- cell: /* @__PURE__ */ __name((row) => row.endpoints.map((endpoint) => endpoint.path).join(", "), "cell"),
16421
+ cell: /* @__PURE__ */ __name((row) => row.endpoints.map((endpoint) => `${endpoint.method} ${endpoint.path}`).join(", "), "cell"),
15358
16422
  maxWidth: 62
15359
16423
  }
15360
16424
  ];
@@ -15381,6 +16445,20 @@ function registerClarity(program) {
15381
16445
  registerClarityGetCurrentProcess(clarity);
15382
16446
  registerClarityGetTransformationProposal(clarity);
15383
16447
  registerClarityListExtraCaptureRequests(clarity);
16448
+ registerClarityArtifactChatConversations(clarity);
16449
+ registerClarityArtifactChatMessages(clarity);
16450
+ registerClarityGenerateCurrentProcess(clarity);
16451
+ registerClarityGenerateTransformationProposal(clarity);
16452
+ registerClarityPromoteCurrentProcess(clarity);
16453
+ registerClarityPromoteTransformationProposal(clarity);
16454
+ registerClarityRevertCurrentProcess(clarity);
16455
+ registerClarityRevertTransformationProposal(clarity);
16456
+ registerClarityAssignExtraCaptureRequest(clarity);
16457
+ registerClarityPostprocess(clarity);
16458
+ registerClarityBuildAutomation(clarity);
16459
+ registerClarityStopTransformationProposal(clarity);
16460
+ registerClarityCreateInviteLink(clarity);
16461
+ registerClarityImportArtifact(clarity);
15384
16462
  }
15385
16463
  __name(registerClarity, "registerClarity");
15386
16464
  function registerList(clarity) {
@@ -15739,7 +16817,7 @@ function registerExport(clarity) {
15739
16817
  __name(registerExport, "registerExport");
15740
16818
  function registerDoctor(clarity) {
15741
16819
  clarity.command("doctor [process-id]").description(
15742
- "Check auth, API reachability, read-only tools, and optionally one process context"
16820
+ "Check auth, API reachability, Clarity tools, and optionally one process context"
15743
16821
  ).option("--json", "output JSON").action(/* @__PURE__ */ __name(async function doctorAction(processId, options) {
15744
16822
  const environment = await buildEnvironmentDoctorChecks(this);
15745
16823
  const processChecks = processId === void 0 ? [] : await buildProcessDoctorChecks(environment.config, processId);
@@ -15757,15 +16835,15 @@ function registerDoctor(clarity) {
15757
16835
  }
15758
16836
  __name(registerDoctor, "registerDoctor");
15759
16837
  function registerTools(clarity) {
15760
- clarity.command("tools").description("List read-only Clarity tools used by the CLI").option("--json", "output JSON").action((options) => {
16838
+ clarity.command("tools").description("List Clarity tools used by the CLI").option("--json", "output JSON").action((options) => {
15761
16839
  if (options.json) {
15762
- printJson({ tools: CLARITY_READ_TOOLS });
16840
+ printJson({ tools: CLARITY_TOOLS });
15763
16841
  return;
15764
16842
  }
15765
- console.log(renderTable(CLARITY_TOOL_COLUMNS, CLARITY_READ_TOOLS));
16843
+ console.log(renderTable(CLARITY_TOOL_COLUMNS, CLARITY_TOOLS));
15766
16844
  console.log("");
15767
16845
  console.log(
15768
- "All listed Clarity tools are read-only GET calls. Generation, promotion, revert, assignment, postprocess, and automation-build commands are not exposed."
16846
+ "Clarity tools include read-only GET calls and explicit write commands for generation, promotion, revert, assignment, postprocess, automation, artifact import, and invite links."
15769
16847
  );
15770
16848
  });
15771
16849
  }
@@ -15887,17 +16965,6 @@ async function loadV2Overview(config, processId, options) {
15887
16965
  };
15888
16966
  }
15889
16967
  __name(loadV2Overview, "loadV2Overview");
15890
- async function requireV2Process(config, processId) {
15891
- try {
15892
- return await getClarityV2Process(config, processId);
15893
- } catch (error) {
15894
- if (isLegacyV2ReadError(error)) {
15895
- throw new CliError(CLARITY_V2_REQUIRED_MESSAGE);
15896
- }
15897
- throw error;
15898
- }
15899
- }
15900
- __name(requireV2Process, "requireV2Process");
15901
16968
  function buildWarnings(context) {
15902
16969
  const warnings = [];
15903
16970
  const processId = context.process.process.id;
@@ -15976,14 +17043,14 @@ __name(buildProposalAnchorCheck, "buildProposalAnchorCheck");
15976
17043
  async function buildEnvironmentDoctorChecks(command) {
15977
17044
  const checks = [
15978
17045
  {
15979
- name: "read_only_surface",
17046
+ name: "command_surface",
15980
17047
  ok: true,
15981
- detail: "The Clarity CLI registers read commands only; generation, promotion, revert, assignment, postprocess, and automation build routes are not exposed."
17048
+ detail: "The Clarity CLI registers read commands and explicit write commands for public Clarity v2 routes."
15982
17049
  },
15983
17050
  {
15984
- name: "read_tools_available",
17051
+ name: "tools_available",
15985
17052
  ok: true,
15986
- detail: `${CLARITY_READ_TOOLS.length} read-only Clarity tools available.`,
17053
+ detail: `${CLARITY_TOOLS.length} Clarity tools available.`,
15987
17054
  next_command: "duvo clarity tools"
15988
17055
  }
15989
17056
  ];
@@ -16086,8 +17153,8 @@ async function buildTeamContextCheck(config) {
16086
17153
  }
16087
17154
  }
16088
17155
  __name(buildTeamContextCheck, "buildTeamContextCheck");
16089
- var listMyTeamsResponseSchema2 = z79.object({
16090
- teams: z79.array(z79.object({ id: z79.string() }))
17156
+ var listMyTeamsResponseSchema2 = z84.object({
17157
+ teams: z84.array(z84.object({ id: z84.string() }))
16091
17158
  });
16092
17159
  async function buildClarityApiReachableCheck(command, config) {
16093
17160
  let teamId;
@@ -16835,16 +17902,16 @@ function registerConnectionsList(connections) {
16835
17902
  __name(registerConnectionsList, "registerConnectionsList");
16836
17903
 
16837
17904
  // src/commands/connections/probe.ts
16838
- import { z as z80 } from "zod";
16839
- var toolSchema = z80.object({
16840
- name: z80.string(),
16841
- description: z80.string().optional(),
16842
- input_schema: z80.record(z80.string(), z80.unknown()).optional()
17905
+ import { z as z85 } from "zod";
17906
+ var toolSchema = z85.object({
17907
+ name: z85.string(),
17908
+ description: z85.string().optional(),
17909
+ input_schema: z85.record(z85.string(), z85.unknown()).optional()
16843
17910
  });
16844
- var probeResponseSchema = z80.object({
16845
- success: z80.boolean(),
16846
- tools: z80.array(toolSchema).optional(),
16847
- error: z80.string().optional()
17911
+ var probeResponseSchema = z85.object({
17912
+ success: z85.boolean(),
17913
+ tools: z85.array(toolSchema).optional(),
17914
+ error: z85.string().optional()
16848
17915
  });
16849
17916
  var DESCRIPTION_MAX_WIDTH = 80;
16850
17917
  var TABLE_COLUMNS21 = [
@@ -17063,48 +18130,48 @@ function registerConnections(program) {
17063
18130
  __name(registerConnections, "registerConnections");
17064
18131
 
17065
18132
  // src/api/credential-schemas.ts
17066
- import { z as z81 } from "zod";
17067
- var dateLike = z81.string();
17068
- var secretSchema = z81.object({
17069
- id: z81.string(),
17070
- team_id: z81.string(),
17071
- user_id: z81.string().nullable(),
17072
- name: z81.string(),
17073
- service_slug: z81.string().nullable(),
17074
- env_var_keys: z81.array(z81.string()),
17075
- created_by: z81.string(),
18133
+ import { z as z86 } from "zod";
18134
+ var dateLike = z86.string();
18135
+ var secretSchema = z86.object({
18136
+ id: z86.string(),
18137
+ team_id: z86.string(),
18138
+ user_id: z86.string().nullable(),
18139
+ name: z86.string(),
18140
+ service_slug: z86.string().nullable(),
18141
+ env_var_keys: z86.array(z86.string()),
18142
+ created_by: z86.string(),
17076
18143
  created_at: dateLike,
17077
18144
  updated_at: dateLike
17078
18145
  });
17079
- var secretsListResponseSchema = z81.array(secretSchema);
18146
+ var secretsListResponseSchema = z86.array(secretSchema);
17080
18147
  var secretResponseSchema = secretSchema;
17081
- var browserLoginSchema = z81.object({
17082
- id: z81.string(),
17083
- user_id: z81.string().nullable(),
17084
- team_id: z81.string(),
17085
- domain: z81.string(),
17086
- username: z81.string().nullable(),
18148
+ var browserLoginSchema = z86.object({
18149
+ id: z86.string(),
18150
+ user_id: z86.string().nullable(),
18151
+ team_id: z86.string(),
18152
+ domain: z86.string(),
18153
+ username: z86.string().nullable(),
17087
18154
  password: encryptedDataSchema.nullable(),
17088
18155
  otp_secret: encryptedDataSchema.nullable(),
17089
18156
  created_at: dateLike,
17090
18157
  updated_at: dateLike
17091
18158
  });
17092
- var browserLoginsListResponseSchema = z81.array(credentialPreviewSchema);
17093
- var revisionLoginSummarySchema = z81.object({
17094
- id: z81.string(),
17095
- user_id: z81.string().nullable(),
17096
- team_id: z81.string().nullable(),
17097
- domain: z81.string(),
17098
- username: z81.string().nullable(),
18159
+ var browserLoginsListResponseSchema = z86.array(credentialPreviewSchema);
18160
+ var revisionLoginSummarySchema = z86.object({
18161
+ id: z86.string(),
18162
+ user_id: z86.string().nullable(),
18163
+ team_id: z86.string().nullable(),
18164
+ domain: z86.string(),
18165
+ username: z86.string().nullable(),
17099
18166
  created_at: dateLike,
17100
18167
  updated_at: dateLike
17101
18168
  });
17102
- var revisionLoginsListResponseSchema = z81.array(
18169
+ var revisionLoginsListResponseSchema = z86.array(
17103
18170
  revisionLoginSummarySchema
17104
18171
  );
17105
- var revisionSecretsListResponseSchema = z81.array(secretSchema);
17106
- var successResponseSchema2 = z81.object({
17107
- success: z81.boolean()
18172
+ var revisionSecretsListResponseSchema = z86.array(secretSchema);
18173
+ var successResponseSchema2 = z86.object({
18174
+ success: z86.boolean()
17108
18175
  });
17109
18176
  var attachSuccessResponseSchema = successResponseSchema2;
17110
18177
  var deleteSecretResponseSchema = successResponseSchema2;
@@ -20472,94 +21539,176 @@ function registerRevisionSecrets(program) {
20472
21539
  __name(registerRevisionSecrets, "registerRevisionSecrets");
20473
21540
 
20474
21541
  // src/api/run-schemas.ts
20475
- import { z as z82 } from "zod";
20476
- var publicRunSchema = z82.object({
20477
- id: z82.string(),
20478
- agent_id: z82.string(),
20479
- build_id: z82.string(),
20480
- status: z82.string(),
20481
- source: z82.string().nullish(),
20482
- sandbox_id: z82.string().nullish(),
20483
- started_at: z82.string().nullish(),
20484
- completed_at: z82.string().nullish(),
20485
- created_at: z82.string(),
20486
- updated_at: z82.string().nullish(),
20487
- human_in_the_loop_enabled: z82.boolean().nullish()
20488
- });
20489
- var startRunResponseSchema = z82.object({
21542
+ import { z as z87 } from "zod";
21543
+ var publicRunSchema = z87.object({
21544
+ id: z87.string(),
21545
+ agent_id: z87.string(),
21546
+ build_id: z87.string(),
21547
+ status: z87.string(),
21548
+ source: z87.string().nullish(),
21549
+ sandbox_id: z87.string().nullish(),
21550
+ started_at: z87.string().nullish(),
21551
+ completed_at: z87.string().nullish(),
21552
+ created_at: z87.string(),
21553
+ updated_at: z87.string().nullish(),
21554
+ human_in_the_loop_enabled: z87.boolean().nullish()
21555
+ });
21556
+ var startRunResponseSchema = z87.object({
20490
21557
  run: publicRunSchema
20491
21558
  });
20492
- var questionOptionSchema = z82.object({
20493
- label: z82.string(),
20494
- description: z82.string().nullish()
20495
- });
20496
- var questionSchema = z82.object({
20497
- question: z82.string(),
20498
- header: z82.string().nullish(),
20499
- options: z82.array(questionOptionSchema).nullish(),
20500
- multi_select: z82.boolean().nullish()
20501
- });
20502
- var pendingHumanRequestSchema = z82.object({
20503
- id: z82.string(),
20504
- title: z82.string(),
20505
- description: z82.string().nullish(),
20506
- created_at: z82.string(),
20507
- type: z82.string(),
20508
- questions: z82.array(questionSchema).nullish()
20509
- });
20510
- var getRunResponseSchema = z82.object({
21559
+ var questionOptionSchema = z87.object({
21560
+ label: z87.string(),
21561
+ description: z87.string().nullish()
21562
+ });
21563
+ var questionSchema = z87.object({
21564
+ question: z87.string(),
21565
+ header: z87.string().nullish(),
21566
+ options: z87.array(questionOptionSchema).nullish(),
21567
+ multi_select: z87.boolean().nullish()
21568
+ });
21569
+ var pendingHumanRequestSchema = z87.object({
21570
+ id: z87.string(),
21571
+ title: z87.string(),
21572
+ description: z87.string().nullish(),
21573
+ created_at: z87.string(),
21574
+ type: z87.string(),
21575
+ questions: z87.array(questionSchema).nullish()
21576
+ });
21577
+ var getRunResponseSchema = z87.object({
20511
21578
  run: publicRunSchema.nullable(),
20512
21579
  pending_human_request: pendingHumanRequestSchema.nullish()
20513
21580
  });
20514
- var stopRunResponseSchema = z82.object({
20515
- success: z82.boolean(),
20516
- message: z82.string().nullish()
20517
- });
20518
- var runMessageSchema = z82.object({
20519
- id: z82.string(),
20520
- type: z82.string(),
20521
- role: z82.string(),
20522
- timestamp: z82.string(),
20523
- text_content: z82.string().nullish(),
20524
- tool_call: z82.object({
20525
- id: z82.string(),
20526
- name: z82.string(),
20527
- arguments: z82.record(z82.string(), z82.unknown()).nullish()
21581
+ var stopRunResponseSchema = z87.object({
21582
+ success: z87.boolean(),
21583
+ message: z87.string().nullish()
21584
+ });
21585
+ var runMessageSchema = z87.object({
21586
+ id: z87.string(),
21587
+ type: z87.string(),
21588
+ role: z87.string(),
21589
+ timestamp: z87.string(),
21590
+ text_content: z87.string().nullish(),
21591
+ tool_call: z87.object({
21592
+ id: z87.string(),
21593
+ name: z87.string(),
21594
+ arguments: z87.record(z87.string(), z87.unknown()).nullish()
20528
21595
  }).nullish(),
20529
- tool_result: z82.object({
20530
- tool_call_id: z82.string(),
20531
- result: z82.unknown().nullish(),
20532
- error: z82.string().nullish()
21596
+ tool_result: z87.object({
21597
+ tool_call_id: z87.string(),
21598
+ result: z87.unknown().nullish(),
21599
+ error: z87.string().nullish()
20533
21600
  }).nullish()
20534
21601
  });
20535
- var listRunMessagesResponseSchema = z82.object({
20536
- messages: z82.array(runMessageSchema),
20537
- total: z82.number().nullish(),
20538
- limit: z82.number().nullish(),
20539
- offset: z82.number().nullish()
21602
+ var listRunMessagesResponseSchema = z87.object({
21603
+ messages: z87.array(runMessageSchema),
21604
+ total: z87.number().nullish(),
21605
+ limit: z87.number().nullish(),
21606
+ offset: z87.number().nullish()
20540
21607
  });
20541
- var postedMessageSchema = z82.object({
20542
- id: z82.string(),
20543
- type: z82.string(),
20544
- role: z82.string(),
20545
- timestamp: z82.string(),
20546
- text_content: z82.string()
21608
+ var postedMessageSchema = z87.object({
21609
+ id: z87.string(),
21610
+ type: z87.string(),
21611
+ role: z87.string(),
21612
+ timestamp: z87.string(),
21613
+ text_content: z87.string()
20547
21614
  });
20548
- var postRunMessageResponseSchema = z82.object({
21615
+ var postRunMessageResponseSchema = z87.object({
20549
21616
  message: postedMessageSchema
20550
21617
  });
20551
- var respondHumanRequestResponseSchema = z82.object({
20552
- human_request: z82.object({
20553
- id: z82.string(),
20554
- run_id: z82.string(),
20555
- title: z82.string(),
20556
- description: z82.string().nullish(),
20557
- response: z82.string().nullish(),
20558
- responded_at: z82.string().nullish(),
20559
- created_at: z82.string()
21618
+ var respondHumanRequestResponseSchema = z87.object({
21619
+ human_request: z87.object({
21620
+ id: z87.string(),
21621
+ run_id: z87.string(),
21622
+ title: z87.string(),
21623
+ description: z87.string().nullish(),
21624
+ response: z87.string().nullish(),
21625
+ responded_at: z87.string().nullish(),
21626
+ created_at: z87.string()
20560
21627
  })
20561
21628
  });
20562
21629
 
21630
+ // src/commands/runs/evaluation.ts
21631
+ async function resolveAgentId(runId, apiKey, apiBaseUrl) {
21632
+ const raw = await httpRequest({
21633
+ method: "GET",
21634
+ path: `/v2/runs/${encodeURIComponent(runId)}`,
21635
+ apiKey,
21636
+ apiBaseUrl
21637
+ });
21638
+ const parsed = getRunResponseSchema.safeParse(raw);
21639
+ if (!parsed.success) {
21640
+ throw new CliError(
21641
+ `Unexpected response from the API: ${parsed.error.message}`
21642
+ );
21643
+ }
21644
+ const { run } = parsed.data;
21645
+ if (!run) {
21646
+ throw new CliError(`Run "${runId}" not found.`);
21647
+ }
21648
+ return run.agent_id;
21649
+ }
21650
+ __name(resolveAgentId, "resolveAgentId");
21651
+ function registerRunsEvaluation(runs) {
21652
+ runs.command("evaluation <run-id>").alias("eval").description("Get the latest evaluation for an agent run").option(
21653
+ "--agent <agent-id>",
21654
+ "agent ID for the run (resolved from the run automatically when omitted)"
21655
+ ).option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function evaluationAction(runId, options) {
21656
+ const { apiKey, apiBaseUrl } = await requireAuthenticatedConfig(this);
21657
+ const agentId = options.agent ?? await resolveAgentId(runId, apiKey, apiBaseUrl);
21658
+ const raw = await httpRequest({
21659
+ method: "GET",
21660
+ path: `/v2/agent/${encodeURIComponent(agentId)}/runs/${encodeURIComponent(runId)}/evaluation`,
21661
+ apiKey,
21662
+ apiBaseUrl
21663
+ });
21664
+ if (options.json) {
21665
+ printJson(raw);
21666
+ return;
21667
+ }
21668
+ const parsed = runEvaluationResponseSchema.safeParse(raw);
21669
+ if (!parsed.success) {
21670
+ throw new CliError(
21671
+ `Unexpected response from the API: ${parsed.error.message}`
21672
+ );
21673
+ }
21674
+ const evaluation = parsed.data.data;
21675
+ if (!evaluation) {
21676
+ console.log(`No evaluation available for run "${runId}".`);
21677
+ return;
21678
+ }
21679
+ console.log(
21680
+ renderKeyValue([
21681
+ { label: "ID", value: evaluation.id },
21682
+ { label: "Run", value: evaluation.run_id },
21683
+ { label: "Source", value: evaluation.source ?? "" },
21684
+ { label: "Created", value: evaluation.created_at }
21685
+ ])
21686
+ );
21687
+ const flags = Object.entries(evaluation.output.data).filter(
21688
+ ([key]) => key !== "final_comment"
21689
+ );
21690
+ if (flags.length > 0) {
21691
+ console.log("");
21692
+ console.log("Rubric:");
21693
+ console.log(
21694
+ renderKeyValue(
21695
+ flags.map(([key, value]) => ({
21696
+ label: key,
21697
+ value: value === null ? "" : String(value)
21698
+ }))
21699
+ )
21700
+ );
21701
+ }
21702
+ const finalComment = evaluation.output.data.final_comment;
21703
+ if (typeof finalComment === "string" && finalComment.length > 0) {
21704
+ console.log("");
21705
+ console.log("Final comment:");
21706
+ console.log(finalComment);
21707
+ }
21708
+ }, "evaluationAction"));
21709
+ }
21710
+ __name(registerRunsEvaluation, "registerRunsEvaluation");
21711
+
20563
21712
  // src/commands/runs/get.ts
20564
21713
  function registerRunsGet(runs) {
20565
21714
  runs.command("get <id>").description("Get an agent run by ID").option("--json", "output raw JSON from the API").action(/* @__PURE__ */ __name(async function getAction(id, options) {
@@ -21160,6 +22309,7 @@ function registerRuns(program) {
21160
22309
  registerRunsStart(runs);
21161
22310
  registerRunsList(runs);
21162
22311
  registerRunsGet(runs);
22312
+ registerRunsEvaluation(runs);
21163
22313
  registerRunsMessages(runs);
21164
22314
  registerRunsSendMessage(runs);
21165
22315
  registerRunsRespond(runs);
@@ -21168,28 +22318,28 @@ function registerRuns(program) {
21168
22318
  __name(registerRuns, "registerRuns");
21169
22319
 
21170
22320
  // src/api/sandbox-schemas.ts
21171
- import { z as z83 } from "zod";
21172
- var createSandboxResponseSchema = z83.object({
21173
- sandbox_id: z83.string(),
21174
- expires_at: z83.string()
22321
+ import { z as z88 } from "zod";
22322
+ var createSandboxResponseSchema = z88.object({
22323
+ sandbox_id: z88.string(),
22324
+ expires_at: z88.string()
21175
22325
  });
21176
- var createSandboxUploadUrlResponseSchema = z83.object({
21177
- upload_url: z83.string(),
21178
- path: z83.string(),
21179
- expires_in_seconds: z83.number()
22326
+ var createSandboxUploadUrlResponseSchema = z88.object({
22327
+ upload_url: z88.string(),
22328
+ path: z88.string(),
22329
+ expires_in_seconds: z88.number()
21180
22330
  });
21181
- var sandboxFileSchema = z83.object({
21182
- name: z83.string(),
21183
- path: z83.string(),
21184
- type: z83.enum(["file", "dir"]),
21185
- size_bytes: z83.number()
22331
+ var sandboxFileSchema = z88.object({
22332
+ name: z88.string(),
22333
+ path: z88.string(),
22334
+ type: z88.enum(["file", "dir"]),
22335
+ size_bytes: z88.number()
21186
22336
  });
21187
- var listSandboxFilesResponseSchema = z83.object({
21188
- files: z83.array(sandboxFileSchema)
22337
+ var listSandboxFilesResponseSchema = z88.object({
22338
+ files: z88.array(sandboxFileSchema)
21189
22339
  });
21190
- var uploadSandboxFileResponseSchema = z83.object({
21191
- path: z83.string(),
21192
- size_bytes: z83.number()
22340
+ var uploadSandboxFileResponseSchema = z88.object({
22341
+ path: z88.string(),
22342
+ size_bytes: z88.number()
21193
22343
  });
21194
22344
  var DEFAULT_SANDBOX_FILES_PATH = "/workspace";
21195
22345
 
@@ -21317,8 +22467,8 @@ function registerSandboxesPrepareUploadUrl(sandboxes) {
21317
22467
  __name(registerSandboxesPrepareUploadUrl, "registerSandboxesPrepareUploadUrl");
21318
22468
 
21319
22469
  // src/commands/sandboxes/upload.ts
21320
- import { readFile as readFile5, stat } from "node:fs/promises";
21321
- import { basename } from "node:path";
22470
+ import { readFile as readFile6, stat } from "node:fs/promises";
22471
+ import { basename as basename2 } from "node:path";
21322
22472
  var MAX_DIRECT_UPLOAD_BYTES = 10 * 1024 * 1024;
21323
22473
  function registerSandboxesUpload(sandboxes) {
21324
22474
  sandboxes.command("upload <sandbox_id> <file>").description(
@@ -21344,11 +22494,11 @@ function registerSandboxesUpload(sandboxes) {
21344
22494
  `File "${file}" is ${stats.size} bytes, larger than the ${MAX_DIRECT_UPLOAD_BYTES}-byte direct-upload limit. Use \`duvo sandboxes prepare-upload-url\` for larger files.`
21345
22495
  );
21346
22496
  }
21347
- const content = await readFile5(file).catch((error) => {
22497
+ const content = await readFile6(file).catch((error) => {
21348
22498
  const message = error instanceof Error ? error.message : String(error);
21349
22499
  throw new CliError(`Could not read file "${file}": ${message}`);
21350
22500
  });
21351
- const filename = basename(file);
22501
+ const filename = basename2(file);
21352
22502
  const formData = new FormData();
21353
22503
  formData.append("file", new Blob([new Uint8Array(content)]), filename);
21354
22504
  if (trimmedPath !== void 0) {
@@ -21800,13 +22950,13 @@ __name(registerSkillsAssignments, "registerSkillsAssignments");
21800
22950
 
21801
22951
  // src/commands/skills/create.ts
21802
22952
  import { readFileSync as readFileSync4 } from "node:fs";
21803
- import { z as z84 } from "zod";
21804
- var createSkillResponseSchema = z84.object({
21805
- skill: z84.object({
21806
- id: z84.string(),
21807
- name: z84.string(),
21808
- description: z84.string(),
21809
- team_id: z84.string()
22953
+ import { z as z89 } from "zod";
22954
+ var createSkillResponseSchema = z89.object({
22955
+ skill: z89.object({
22956
+ id: z89.string(),
22957
+ name: z89.string(),
22958
+ description: z89.string(),
22959
+ team_id: z89.string()
21810
22960
  })
21811
22961
  });
21812
22962
  function registerSkillsCreate(skills) {
@@ -22170,13 +23320,13 @@ function readExistingContent(source) {
22170
23320
  __name(readExistingContent, "readExistingContent");
22171
23321
 
22172
23322
  // src/commands/skills/install.ts
22173
- import { z as z85 } from "zod";
22174
- var installSkillResponseSchema = z85.object({
22175
- skill: z85.object({
22176
- id: z85.string(),
22177
- name: z85.string(),
22178
- description: z85.string(),
22179
- team_id: z85.string()
23323
+ import { z as z90 } from "zod";
23324
+ var installSkillResponseSchema = z90.object({
23325
+ skill: z90.object({
23326
+ id: z90.string(),
23327
+ name: z90.string(),
23328
+ description: z90.string(),
23329
+ team_id: z90.string()
22180
23330
  })
22181
23331
  });
22182
23332
  function registerSkillsInstall(skills) {
@@ -22364,15 +23514,15 @@ function registerSkillsSystem(skills) {
22364
23514
  __name(registerSkillsSystem, "registerSkillsSystem");
22365
23515
 
22366
23516
  // src/commands/skills/upload.ts
22367
- import { readFile as readFile6, stat as stat2 } from "node:fs/promises";
22368
- import { basename as basename2 } from "node:path";
22369
- import { z as z86 } from "zod";
22370
- var uploadSkillResponseSchema = z86.object({
22371
- skill: z86.object({
22372
- id: z86.string(),
22373
- name: z86.string(),
22374
- description: z86.string(),
22375
- team_id: z86.string()
23517
+ import { readFile as readFile7, stat as stat2 } from "node:fs/promises";
23518
+ import { basename as basename3 } from "node:path";
23519
+ import { z as z91 } from "zod";
23520
+ var uploadSkillResponseSchema = z91.object({
23521
+ skill: z91.object({
23522
+ id: z91.string(),
23523
+ name: z91.string(),
23524
+ description: z91.string(),
23525
+ team_id: z91.string()
22376
23526
  })
22377
23527
  });
22378
23528
  function registerSkillsUpload(skills) {
@@ -22386,11 +23536,11 @@ function registerSkillsUpload(skills) {
22386
23536
  if (!fileStats.isFile()) {
22387
23537
  throw new CliError(`Could not read file "${file}": not a regular file`);
22388
23538
  }
22389
- const content = await readFile6(file).catch((error) => {
23539
+ const content = await readFile7(file).catch((error) => {
22390
23540
  const message = error instanceof Error ? error.message : String(error);
22391
23541
  throw new CliError(`Could not read file "${file}": ${message}`);
22392
23542
  });
22393
- const filename = basename2(file);
23543
+ const filename = basename3(file);
22394
23544
  const formData = new FormData();
22395
23545
  formData.append("file", new Blob([new Uint8Array(content)]), filename);
22396
23546
  const config = await requireAuthenticatedConfig(this);
@@ -22587,11 +23737,11 @@ function registerTeamMembers(team) {
22587
23737
  __name(registerTeamMembers, "registerTeamMembers");
22588
23738
 
22589
23739
  // src/commands/team/use.ts
22590
- import { z as z87 } from "zod";
23740
+ import { z as z92 } from "zod";
22591
23741
  var TEAM_ID_SHAPE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
22592
- var teamIdSchema = z87.string().regex(TEAM_ID_SHAPE);
22593
- var listMyTeamsResponseSchema3 = z87.object({
22594
- teams: z87.array(z87.object({ id: z87.string() }))
23742
+ var teamIdSchema = z92.string().regex(TEAM_ID_SHAPE);
23743
+ var listMyTeamsResponseSchema3 = z92.object({
23744
+ teams: z92.array(z92.object({ id: z92.string() }))
22595
23745
  });
22596
23746
  function registerTeamUse(team) {
22597
23747
  team.command("use <team-id>").description(
@@ -22673,14 +23823,14 @@ function registerTeam(program) {
22673
23823
  __name(registerTeam, "registerTeam");
22674
23824
 
22675
23825
  // src/commands/teams/list.ts
22676
- import { z as z88 } from "zod";
22677
- var teamApiSchema2 = z88.object({
22678
- id: z88.string(),
22679
- name: z88.string(),
22680
- organization_id: z88.string().nullable()
23826
+ import { z as z93 } from "zod";
23827
+ var teamApiSchema2 = z93.object({
23828
+ id: z93.string(),
23829
+ name: z93.string(),
23830
+ organization_id: z93.string().nullable()
22681
23831
  });
22682
- var listMyTeamsResponseSchema4 = z88.object({
22683
- teams: z88.array(teamApiSchema2)
23832
+ var listMyTeamsResponseSchema4 = z93.object({
23833
+ teams: z93.array(teamApiSchema2)
22684
23834
  });
22685
23835
  function registerTeamsList(program) {
22686
23836
  const teams = program.command("teams").description("Inspect the teams your credentials can act on");
@@ -22776,7 +23926,7 @@ __name(resolveActiveTeamId, "resolveActiveTeamId");
22776
23926
  var version = resolveVersion();
22777
23927
  function resolveVersion() {
22778
23928
  if (true) {
22779
- return "1.3.0";
23929
+ return "1.4.0";
22780
23930
  }
22781
23931
  const packageJsonPath = join2(
22782
23932
  dirname2(fileURLToPath(import.meta.url)),
@@ -22845,7 +23995,7 @@ function checkForUpdate() {
22845
23995
  __name(checkForUpdate, "checkForUpdate");
22846
23996
  function loadPackageMeta() {
22847
23997
  if (true) {
22848
- return { name: "@duvoai/cli", version: "1.3.0" };
23998
+ return { name: "@duvoai/cli", version: "1.4.0" };
22849
23999
  }
22850
24000
  const require2 = createRequire(import.meta.url);
22851
24001
  const raw = require2("../package.json");