@doist/automations-cli 1.5.0 → 1.7.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/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  collectSkillStatus,
6
6
  getInstaller,
7
7
  updateAllInstalledSkills
8
- } from "./chunk-U6DJ74AX.js";
8
+ } from "./chunk-WRQM4IKT.js";
9
9
 
10
10
  // src/index.ts
11
11
  import { Command } from "commander";
@@ -15,7 +15,7 @@ import { fileURLToPath } from "node:url";
15
15
  // package.json
16
16
  var package_default = {
17
17
  name: "@doist/automations-cli",
18
- version: "1.5.0",
18
+ version: "1.7.0",
19
19
  description: "Command-line client for Todoist Automations",
20
20
  type: "module",
21
21
  bin: {
@@ -189,7 +189,8 @@ var AUTOMATION_RUN_STATUSES = [
189
189
  "running",
190
190
  "completed",
191
191
  "failed",
192
- "cancelled"
192
+ "cancelled",
193
+ "skipped"
193
194
  ];
194
195
 
195
196
  // ../../packages/core/dist/esm/constants/webhook-event-subscription.constants.js
@@ -15431,8 +15432,8 @@ function encodeJSONPointerSegment(segment) {
15431
15432
  return segment.replace(/~/g, "~0").replace(/\//g, "~1");
15432
15433
  }
15433
15434
  function extractDefs(ctx, schema) {
15434
- const root13 = ctx.seen.get(schema);
15435
- if (!root13)
15435
+ const root14 = ctx.seen.get(schema);
15436
+ if (!root14)
15436
15437
  throw new Error("Unprocessed schema. This is a bug in Zod.");
15437
15438
  if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)
15438
15439
  return;
@@ -15461,7 +15462,7 @@ function extractDefs(ctx, schema) {
15461
15462
  }
15462
15463
  const uriPrefix = `#`;
15463
15464
  const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
15464
- if (entry[1] === root13 && !entry[1].schema.id) {
15465
+ if (entry[1] === root14 && !entry[1].schema.id) {
15465
15466
  return { ref: uriPrefix };
15466
15467
  }
15467
15468
  const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
@@ -15633,8 +15634,8 @@ function foldIntersection(json2) {
15633
15634
  assignProps(json2, folded);
15634
15635
  }
15635
15636
  function finalize(ctx, schema) {
15636
- const root13 = ctx.seen.get(schema);
15637
- if (!root13)
15637
+ const root14 = ctx.seen.get(schema);
15638
+ if (!root14)
15638
15639
  throw new Error("Unprocessed schema. This is a bug in Zod.");
15639
15640
  const flattenRef = (zodSchema) => {
15640
15641
  const seen = ctx.seen.get(zodSchema);
@@ -15745,7 +15746,7 @@ function finalize(ctx, schema) {
15745
15746
  throw new Error("Schema is missing an `id` property");
15746
15747
  result.$id = ctx.external.uri(id);
15747
15748
  }
15748
- assignProps(result, root13.defId ? root13.schema : root13.def ?? root13.schema);
15749
+ assignProps(result, root14.defId ? root14.schema : root14.def ?? root14.schema);
15749
15750
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
15750
15751
  if (rootMetaId !== void 0 && result.id === rootMetaId)
15751
15752
  delete result.id;
@@ -19129,10 +19130,10 @@ var FAILURE_CATEGORIES = [
19129
19130
  "automation_not_found",
19130
19131
  "timeout",
19131
19132
  "runtime_error",
19132
- "insufficient_credit",
19133
19133
  "billing_unavailable",
19134
19134
  "unknown"
19135
19135
  ];
19136
+ var SKIP_CATEGORIES = ["insufficient_credit"];
19136
19137
 
19137
19138
  // ../../packages/core/dist/esm/schemas/query-param.schema.js
19138
19139
  var isoDateTimeOrDateQueryParamSchema = external_exports.union([
@@ -19180,16 +19181,35 @@ var AutomationRunResultSchema = external_exports.object({
19180
19181
  var RolloutCompatibleAutomationRunResultSchema = AutomationRunResultSchema.nullish().transform((result) => {
19181
19182
  return result ?? null;
19182
19183
  });
19183
- var AutomationRunDtoSchema = external_exports.object({
19184
+ var automationRunDtoBaseShape = {
19184
19185
  id: external_exports.string(),
19185
19186
  automationId: external_exports.string(),
19186
- status: external_exports.enum(AUTOMATION_RUN_STATUSES),
19187
19187
  createdAt: external_exports.string(),
19188
19188
  updatedAt: external_exports.string(),
19189
- failureReason: external_exports.string().nullish(),
19190
- failureCategory: external_exports.enum(FAILURE_CATEGORIES).nullish(),
19191
19189
  result: RolloutCompatibleAutomationRunResultSchema,
19192
19190
  temporalUrl: external_exports.string().nullish()
19191
+ };
19192
+ var AutomationRunDtoSchema = external_exports.discriminatedUnion("status", [
19193
+ external_exports.object({ ...automationRunDtoBaseShape, status: external_exports.literal("pending") }),
19194
+ external_exports.object({ ...automationRunDtoBaseShape, status: external_exports.literal("running") }),
19195
+ external_exports.object({ ...automationRunDtoBaseShape, status: external_exports.literal("completed") }),
19196
+ external_exports.object({ ...automationRunDtoBaseShape, status: external_exports.literal("cancelled") }),
19197
+ external_exports.object({
19198
+ ...automationRunDtoBaseShape,
19199
+ status: external_exports.literal("failed"),
19200
+ failureReason: external_exports.string().nullish(),
19201
+ failureCategory: external_exports.enum(FAILURE_CATEGORIES).nullish().catch(null)
19202
+ }),
19203
+ external_exports.object({
19204
+ ...automationRunDtoBaseShape,
19205
+ status: external_exports.literal("skipped"),
19206
+ skipReason: external_exports.string().nullish(),
19207
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish()
19208
+ })
19209
+ ]);
19210
+ var automationRunListResponseSchema = external_exports.object({
19211
+ data: external_exports.array(AutomationRunDtoSchema),
19212
+ nextCursor: external_exports.string().nullable()
19193
19213
  });
19194
19214
  var MAX_TOOL_CALL_ARGUMENT_KEYS = 32;
19195
19215
  var MAX_TOOL_CALL_ARGUMENT_KEY_LENGTH = 64;
@@ -19266,18 +19286,29 @@ var AutomationRunStepDtoOutputSchema = external_exports.object({
19266
19286
  debugReason: AutomationRunDebugReasonSchema.optional()
19267
19287
  });
19268
19288
  var AutomationRunStepDtoSchema = AutomationRunStepDtoOutputSchema;
19269
- var AutomationRunDetailDtoSchema = external_exports.object({
19270
- id: external_exports.string(),
19271
- automationId: external_exports.string(),
19272
- status: external_exports.enum([...AUTOMATION_RUN_STATUSES, "data-expired"]),
19273
- createdAt: external_exports.string(),
19274
- updatedAt: external_exports.string(),
19275
- failureReason: external_exports.string().nullish(),
19276
- failureCategory: external_exports.enum(FAILURE_CATEGORIES).nullish(),
19277
- result: RolloutCompatibleAutomationRunResultSchema,
19278
- temporalUrl: external_exports.string().nullish(),
19289
+ var automationRunDetailDtoBaseShape = {
19290
+ ...automationRunDtoBaseShape,
19279
19291
  steps: external_exports.array(AutomationRunStepDtoSchema)
19280
- });
19292
+ };
19293
+ var AutomationRunDetailDtoSchema = external_exports.discriminatedUnion("status", [
19294
+ external_exports.object({ ...automationRunDetailDtoBaseShape, status: external_exports.literal("pending") }),
19295
+ external_exports.object({ ...automationRunDetailDtoBaseShape, status: external_exports.literal("running") }),
19296
+ external_exports.object({ ...automationRunDetailDtoBaseShape, status: external_exports.literal("completed") }),
19297
+ external_exports.object({ ...automationRunDetailDtoBaseShape, status: external_exports.literal("cancelled") }),
19298
+ external_exports.object({ ...automationRunDetailDtoBaseShape, status: external_exports.literal("data-expired") }),
19299
+ external_exports.object({
19300
+ ...automationRunDetailDtoBaseShape,
19301
+ status: external_exports.literal("failed"),
19302
+ failureReason: external_exports.string().nullish(),
19303
+ failureCategory: external_exports.enum(FAILURE_CATEGORIES).nullish().catch(null)
19304
+ }),
19305
+ external_exports.object({
19306
+ ...automationRunDetailDtoBaseShape,
19307
+ status: external_exports.literal("skipped"),
19308
+ skipReason: external_exports.string().nullish(),
19309
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish()
19310
+ })
19311
+ ]);
19281
19312
  function summarizeToolCallArgumentKeys(args) {
19282
19313
  const keys = Object.keys(args ?? {}).sort();
19283
19314
  const kept = keys.slice(0, MAX_TOOL_CALL_ARGUMENT_KEYS).map((key) => key.length > MAX_TOOL_CALL_ARGUMENT_KEY_LENGTH ? `${key.slice(0, MAX_TOOL_CALL_ARGUMENT_KEY_LENGTH)}\u2026` : key);
@@ -19637,26 +19668,24 @@ var adminReliabilityTotalsSchema = external_exports.object({
19637
19668
  terminalLiveRuns: external_exports.number(),
19638
19669
  completedLiveRuns: external_exports.number(),
19639
19670
  failedLiveRuns: external_exports.number(),
19640
- insufficientCreditFailures: external_exports.number(),
19641
- reliabilityFailures: external_exports.number(),
19642
- failureRate: external_exports.number(),
19643
- reliabilityFailureRate: external_exports.number()
19671
+ skippedLiveRuns: external_exports.number(),
19672
+ insufficientCreditSkippedRuns: external_exports.number(),
19673
+ failureRate: external_exports.number()
19644
19674
  });
19645
19675
  var adminReliabilityFailureCategorySchema = external_exports.object({
19646
19676
  category: external_exports.enum(FAILURE_CATEGORIES).nullable(),
19647
19677
  failures: external_exports.number(),
19648
19678
  shareOfFailedRuns: external_exports.number(),
19649
- shareOfTerminalRuns: external_exports.number(),
19650
- includedInReliabilityRate: external_exports.boolean()
19679
+ shareOfTerminalRuns: external_exports.number()
19651
19680
  });
19652
19681
  var adminReliabilityDailyRowSchema = external_exports.object({
19653
19682
  date: external_exports.iso.date(),
19654
19683
  terminalLiveRuns: external_exports.number(),
19655
19684
  completedLiveRuns: external_exports.number(),
19656
19685
  failedLiveRuns: external_exports.number(),
19657
- insufficientCreditFailures: external_exports.number(),
19658
- reliabilityFailures: external_exports.number(),
19659
- reliabilityFailureRate: external_exports.number()
19686
+ skippedLiveRuns: external_exports.number(),
19687
+ insufficientCreditSkippedRuns: external_exports.number(),
19688
+ failureRate: external_exports.number()
19660
19689
  });
19661
19690
  var adminReliabilityResponseSchema = external_exports.object({
19662
19691
  since: external_exports.iso.datetime({ offset: true }),
@@ -19805,6 +19834,22 @@ function parseIfCondition(condition) {
19805
19834
  return { reference, operator, literal: literal2 };
19806
19835
  }
19807
19836
 
19837
+ // ../../packages/core/dist/esm/utils/run-outcome.js
19838
+ function getRunOutcomeReason(run) {
19839
+ if (run.status === "failed")
19840
+ return run.failureReason ?? null;
19841
+ if (run.status === "skipped")
19842
+ return run.skipReason ?? null;
19843
+ return null;
19844
+ }
19845
+ function getRunOutcomeCategory(run) {
19846
+ if (run.status === "failed")
19847
+ return run.failureCategory ?? null;
19848
+ if (run.status === "skipped")
19849
+ return run.skipCategory ?? null;
19850
+ return null;
19851
+ }
19852
+
19808
19853
  // ../../packages/core/dist/esm/schemas/manifest.helpers.js
19809
19854
  function getManifestTriggers(manifest) {
19810
19855
  return manifest.triggers ?? [];
@@ -20301,8 +20346,8 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
20301
20346
  if (parts.length === 0) {
20302
20347
  return null;
20303
20348
  }
20304
- const [root13, ...rest] = parts;
20305
- if (root13 === "trigger") {
20349
+ const [root14, ...rest] = parts;
20350
+ if (root14 === "trigger") {
20306
20351
  if (rest.length === 0) {
20307
20352
  return `Step "${stepId}" ${sourceType} references "{{trigger}}" without a property. Use {{trigger.<property>}} syntax (e.g., {{trigger.payload}}, {{trigger.metadata}}).`;
20308
20353
  }
@@ -20325,7 +20370,7 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
20325
20370
  }
20326
20371
  return null;
20327
20372
  }
20328
- if (root13 === "steps") {
20373
+ if (root14 === "steps") {
20329
20374
  const referencedStepId = rest[0];
20330
20375
  if (!referencedStepId) {
20331
20376
  return `Step "${stepId}" ${sourceType} references "steps" but is missing the step identifier in template variable "{{${variable}}}". Use {{steps.<stepId>}} syntax.`;
@@ -20864,6 +20909,12 @@ var runStatusSchema = external_exports.discriminatedUnion("status", [
20864
20909
  external_exports.object({
20865
20910
  status: external_exports.literal("cancelled"),
20866
20911
  lastRun: external_exports.iso.datetime()
20912
+ }),
20913
+ external_exports.object({
20914
+ status: external_exports.literal("skipped"),
20915
+ lastRun: external_exports.iso.datetime(),
20916
+ skipReason: external_exports.string().optional(),
20917
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).optional()
20867
20918
  })
20868
20919
  ]);
20869
20920
  var automationSchema = external_exports.object({
@@ -21564,7 +21615,8 @@ var BACKEND_COHORT_EVENTS = [
21564
21615
  "automation:updated",
21565
21616
  // Temporal worker (run lifecycle)
21566
21617
  "automation:ran",
21567
- "automation:run:failed"
21618
+ "automation:run:failed",
21619
+ "automation:run:skipped"
21568
21620
  ];
21569
21621
  var COHORT_EVENTS = [...FRONTEND_COHORT_EVENTS, ...BACKEND_COHORT_EVENTS];
21570
21622
  var cohortEventSchema = external_exports.enum(COHORT_EVENTS);
@@ -22187,6 +22239,11 @@ var AutomationRunFinishedDataSchema = external_exports.discriminatedUnion("statu
22187
22239
  ...automationRunFinishedBaseShape,
22188
22240
  status: external_exports.literal("failed"),
22189
22241
  failureReason: external_exports.string().min(1)
22242
+ }),
22243
+ external_exports.object({
22244
+ ...automationRunFinishedBaseShape,
22245
+ status: external_exports.literal("skipped"),
22246
+ skipReason: external_exports.string().min(1)
22190
22247
  })
22191
22248
  ]);
22192
22249
  var AutomationRunFinishedEventSchema = external_exports.object({
@@ -22838,10 +22895,6 @@ var automationRunsEndpoints = {
22838
22895
  };
22839
22896
 
22840
22897
  // ../../packages/sdk/dist/esm/clients/automation-runs/automation-runs-client.js
22841
- var automationRunListResponseSchema = external_exports.object({
22842
- data: external_exports.array(AutomationRunDtoSchema),
22843
- nextCursor: external_exports.string().nullable()
22844
- });
22845
22898
  function isRequestOptions(value) {
22846
22899
  return Boolean(value && ("signal" in value || "headers" in value));
22847
22900
  }
@@ -23035,15 +23088,51 @@ var AutomationsClient = class extends BaseClient {
23035
23088
  }
23036
23089
  };
23037
23090
 
23091
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-runs/endpoints.js
23092
+ var workspaceAutomationRunsEndpoints = {
23093
+ list: (workspaceId, automationId) => `${root5(workspaceId, automationId)}/runs`,
23094
+ detail: (workspaceId, automationId, runId) => `${root5(workspaceId, automationId)}/runs/${encodeURIComponent(runId)}`
23095
+ };
23096
+ function root5(workspaceId, automationId) {
23097
+ return `/workspaces/${encodeURIComponent(workspaceId)}/automations/${encodeURIComponent(automationId)}`;
23098
+ }
23099
+
23100
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-runs/workspace-automation-runs-client.js
23101
+ var WorkspaceAutomationRunsClient = class extends BaseClient {
23102
+ async list(workspaceId, automationId, args = {}, options) {
23103
+ const { cursor, limit } = CursorPaginationSchema.parse(args);
23104
+ const { status, since, until } = ListAutomationRunsQuerySchema.parse(args);
23105
+ const data = await this.request({
23106
+ method: "GET",
23107
+ path: workspaceAutomationRunsEndpoints.list(IdSchema.parse(workspaceId), IdSchema.parse(automationId)),
23108
+ query: { cursor, limit, status, since, until },
23109
+ options
23110
+ });
23111
+ return automationRunListResponseSchema.parse(data);
23112
+ }
23113
+ async get(workspaceId, automationId, runId, args = {}, options) {
23114
+ const data = await this.request({
23115
+ method: "GET",
23116
+ path: workspaceAutomationRunsEndpoints.detail(IdSchema.parse(workspaceId), IdSchema.parse(automationId), IdSchema.parse(runId)),
23117
+ query: {
23118
+ includeGeneratedCode: args.includeGeneratedCode ? true : void 0,
23119
+ includeToolCallPreviews: args.includeToolCallPreviews ? true : void 0
23120
+ },
23121
+ options
23122
+ });
23123
+ return AutomationRunDetailDtoSchema.parse(data);
23124
+ }
23125
+ };
23126
+
23038
23127
  // ../../packages/sdk/dist/esm/clients/workspace-automations/endpoints.js
23039
23128
  var workspaceAutomationsEndpoints = {
23040
- list: (workspaceId) => `${root5(workspaceId)}`,
23041
- detail: (workspaceId, id) => `${root5(workspaceId)}/${encodeURIComponent(id)}`,
23042
- metadata: (workspaceId, id) => `${root5(workspaceId)}/${encodeURIComponent(id)}/metadata`,
23043
- schedule: (workspaceId, id) => `${root5(workspaceId)}/${encodeURIComponent(id)}/schedule`,
23044
- trigger: (workspaceId, id) => `${root5(workspaceId)}/${encodeURIComponent(id)}/trigger`
23129
+ list: (workspaceId) => `${root6(workspaceId)}`,
23130
+ detail: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}`,
23131
+ metadata: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/metadata`,
23132
+ schedule: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/schedule`,
23133
+ trigger: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/trigger`
23045
23134
  };
23046
- function root5(workspaceId) {
23135
+ function root6(workspaceId) {
23047
23136
  return `/workspaces/${encodeURIComponent(workspaceId)}/automations`;
23048
23137
  }
23049
23138
 
@@ -23105,9 +23194,9 @@ var WorkspaceAutomationsClient = class extends BaseClient {
23105
23194
  };
23106
23195
 
23107
23196
  // ../../packages/sdk/dist/esm/clients/workspaces/endpoints.js
23108
- var root6 = "/workspaces";
23197
+ var root7 = "/workspaces";
23109
23198
  var workspacesEndpoints = {
23110
- list: root6
23199
+ list: root7
23111
23200
  };
23112
23201
 
23113
23202
  // ../../packages/sdk/dist/esm/clients/workspaces/workspaces-client.js
@@ -23129,12 +23218,12 @@ var WorkspacesClient = class extends BaseClient {
23129
23218
  };
23130
23219
 
23131
23220
  // ../../packages/sdk/dist/esm/clients/chat/endpoints.js
23132
- var root7 = "/chat/conversations";
23221
+ var root8 = "/chat/conversations";
23133
23222
  var chatEndpoints = {
23134
- conversations: root7,
23135
- conversation: (id) => `${root7}/${encodeURIComponent(id)}`,
23136
- messages: (id) => `${root7}/${encodeURIComponent(id)}/messages`,
23137
- usagePreview: (id) => `${root7}/${encodeURIComponent(id)}/usage-preview`
23223
+ conversations: root8,
23224
+ conversation: (id) => `${root8}/${encodeURIComponent(id)}`,
23225
+ messages: (id) => `${root8}/${encodeURIComponent(id)}/messages`,
23226
+ usagePreview: (id) => `${root8}/${encodeURIComponent(id)}/usage-preview`
23138
23227
  };
23139
23228
 
23140
23229
  // ../../packages/sdk/dist/esm/clients/chat/chat-client.js
@@ -23208,14 +23297,14 @@ var ChatClient = class extends BaseClient {
23208
23297
  };
23209
23298
 
23210
23299
  // ../../packages/sdk/dist/esm/clients/connections/endpoints.js
23211
- var root8 = "/connections";
23300
+ var root9 = "/connections";
23212
23301
  var connectionsEndpoints = {
23213
- list: root8,
23214
- detail: (id) => `${root8}/${encodeURIComponent(id)}`,
23215
- token: (id) => `${root8}/${encodeURIComponent(id)}/token`,
23216
- dependentAutomations: (connectorId) => `${root8}/${encodeURIComponent(connectorId)}/automations`,
23217
- create: (connectorId, capability) => `${root8}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}`,
23218
- checkManifest: `${root8}/check-manifest`
23302
+ list: root9,
23303
+ detail: (id) => `${root9}/${encodeURIComponent(id)}`,
23304
+ token: (id) => `${root9}/${encodeURIComponent(id)}/token`,
23305
+ dependentAutomations: (connectorId) => `${root9}/${encodeURIComponent(connectorId)}/automations`,
23306
+ create: (connectorId, capability) => `${root9}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}`,
23307
+ checkManifest: `${root9}/check-manifest`
23219
23308
  };
23220
23309
 
23221
23310
  // ../../packages/sdk/dist/esm/clients/connections/connections-client.js
@@ -23356,12 +23445,12 @@ function createClientContext(authToken, options = {}, apiOrigin = "automations")
23356
23445
  }
23357
23446
 
23358
23447
  // ../../packages/sdk/dist/esm/clients/notifications/endpoints.js
23359
- var root9 = "/notifications";
23448
+ var root10 = "/notifications";
23360
23449
  var notificationsEndpoints = {
23361
- list: root9,
23362
- pendingPromptAutomations: `${root9}/pending-prompt-automations`,
23363
- detail: (id) => `${root9}/${encodeURIComponent(id)}`,
23364
- respond: (id) => `${root9}/${encodeURIComponent(id)}/respond`
23450
+ list: root10,
23451
+ pendingPromptAutomations: `${root10}/pending-prompt-automations`,
23452
+ detail: (id) => `${root10}/${encodeURIComponent(id)}`,
23453
+ respond: (id) => `${root10}/${encodeURIComponent(id)}/respond`
23365
23454
  };
23366
23455
  var pushRoot = "/push-subscriptions";
23367
23456
  var pushSubscriptionsEndpoints = {
@@ -23485,10 +23574,10 @@ var NotificationsClient = class extends BaseClient {
23485
23574
  };
23486
23575
 
23487
23576
  // ../../packages/sdk/dist/esm/clients/user-settings/endpoints.js
23488
- var root10 = "/settings";
23577
+ var root11 = "/settings";
23489
23578
  var userSettingsEndpoints = {
23490
- onboarding: `${root10}/onboarding`,
23491
- preferences: `${root10}/preferences`
23579
+ onboarding: `${root11}/onboarding`,
23580
+ preferences: `${root11}/preferences`
23492
23581
  };
23493
23582
 
23494
23583
  // ../../packages/sdk/dist/esm/clients/user-settings/user-settings-client.js
@@ -23640,11 +23729,11 @@ var UsageBillingClient = class extends BaseClient {
23640
23729
  };
23641
23730
 
23642
23731
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/endpoints.js
23643
- var root11 = "/webhook-event-subscriptions";
23732
+ var root12 = "/webhook-event-subscriptions";
23644
23733
  var webhookEventSubscriptionsEndpoints = {
23645
- list: root11,
23646
- detail: (id) => `${root11}/${encodeURIComponent(id)}`,
23647
- deliveries: (id) => `${root11}/${encodeURIComponent(id)}/deliveries`
23734
+ list: root12,
23735
+ detail: (id) => `${root12}/${encodeURIComponent(id)}`,
23736
+ deliveries: (id) => `${root12}/${encodeURIComponent(id)}/deliveries`
23648
23737
  };
23649
23738
 
23650
23739
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/webhook-event-subscriptions-client.js
@@ -23717,12 +23806,12 @@ var WebhookEventSubscriptionsClient = class extends BaseClient {
23717
23806
  };
23718
23807
 
23719
23808
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/endpoints.js
23720
- function root12(automationId) {
23809
+ function root13(automationId) {
23721
23810
  return `/automations/${encodeURIComponent(automationId)}/subscriptions`;
23722
23811
  }
23723
23812
  var webhookSubscriptionsEndpoints = {
23724
- list: (automationId) => root12(automationId),
23725
- detail: (automationId, subscriptionId) => `${root12(automationId)}/${encodeURIComponent(subscriptionId)}`
23813
+ list: (automationId) => root13(automationId),
23814
+ detail: (automationId, subscriptionId) => `${root13(automationId)}/${encodeURIComponent(subscriptionId)}`
23726
23815
  };
23727
23816
 
23728
23817
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/webhook-subscriptions-client.js
@@ -23776,12 +23865,14 @@ var AutomationsApi = class {
23776
23865
  webhookEventSubscriptions;
23777
23866
  workspaces;
23778
23867
  workspaceAutomations;
23868
+ workspaceAutomationRuns;
23779
23869
  constructor(authToken, options = {}) {
23780
23870
  const context = createClientContext(authToken, options);
23781
23871
  const todoistContext = createClientContext(authToken, options, "todoist");
23782
23872
  this.automations = new AutomationsClient(context);
23783
23873
  this.workspaces = new WorkspacesClient(context);
23784
23874
  this.workspaceAutomations = new WorkspaceAutomationsClient(context);
23875
+ this.workspaceAutomationRuns = new WorkspaceAutomationRunsClient(context);
23785
23876
  this.automationRuns = new AutomationRunsClient(context);
23786
23877
  this.connectors = new ConnectorsClient(context);
23787
23878
  this.connections = new ConnectionsClient(context);
@@ -25053,7 +25144,9 @@ function registerAuthCommand(program) {
25053
25144
  attachAutomationsLoginCommand(auth);
25054
25145
  attachAutomationsLogoutCommand(auth, store2);
25055
25146
  attachAutomationsStatusCommand(auth, store2);
25056
- attachTokenViewCommand(auth, {
25147
+ const tokenCmd = auth.command("token").description("Manage the stored access token");
25148
+ attachTokenViewCommand(tokenCmd, {
25149
+ name: "view",
25057
25150
  store: store2,
25058
25151
  description: "Print the stored access token for use in scripts"
25059
25152
  });
@@ -25258,6 +25351,7 @@ function formatAutomationList(page) {
25258
25351
  }
25259
25352
  function formatAutomation(automation) {
25260
25353
  const failureReason = automation.status.status === "failed" ? automation.status.failureReason : void 0;
25354
+ const skipReason = automation.status.status === "skipped" ? automation.status.skipReason : void 0;
25261
25355
  return [
25262
25356
  `Automation: ${getResourceName(automation.manifest)}`,
25263
25357
  `ID: ${automation.id}`,
@@ -25268,6 +25362,7 @@ function formatAutomation(automation) {
25268
25362
  `Updated: ${automation.updatedAt}`,
25269
25363
  `Draft: ${automation.draftId ?? "none"}`,
25270
25364
  ...failureReason ? [`Failure: ${failureReason}`] : [],
25365
+ ...skipReason ? [`Skipped: ${skipReason}`] : [],
25271
25366
  "",
25272
25367
  "Manifest:",
25273
25368
  formatValue(automation.manifest)
@@ -25351,7 +25446,8 @@ function formatRunList(page) {
25351
25446
  [
25352
25447
  `Runs (${page.data.length})`,
25353
25448
  ...page.data.map((run) => {
25354
- const failure = run.failureReason ? ` ${run.failureReason}` : "";
25449
+ const reason = getRunOutcomeReason(run);
25450
+ const failure = reason ? ` ${reason}` : "";
25355
25451
  return `${run.id} ${run.status} ${run.createdAt}${failure}`;
25356
25452
  })
25357
25453
  ],
@@ -25365,8 +25461,8 @@ function formatRun(run) {
25365
25461
  `Status: ${run.status}`,
25366
25462
  `Created: ${run.createdAt}`,
25367
25463
  `Updated: ${run.updatedAt}`,
25368
- `Failure category: ${run.failureCategory ?? "none"}`,
25369
- `Failure reason: ${run.failureReason ?? "none"}`,
25464
+ `Failure category: ${getRunOutcomeCategory(run) ?? "none"}`,
25465
+ `Failure reason: ${getRunOutcomeReason(run) ?? "none"}`,
25370
25466
  `Result: ${run.result?.text ?? "none"}`,
25371
25467
  `Steps: ${run.steps.length}`
25372
25468
  ];
@@ -25396,8 +25492,8 @@ function summarizeRun(run) {
25396
25492
  status: run.status,
25397
25493
  createdAt: run.createdAt,
25398
25494
  updatedAt: run.updatedAt,
25399
- failureCategory: run.failureCategory,
25400
- failureReason: run.failureReason,
25495
+ failureCategory: getRunOutcomeCategory(run),
25496
+ failureReason: getRunOutcomeReason(run),
25401
25497
  result: run.result,
25402
25498
  temporalUrl: run.temporalUrl,
25403
25499
  steps: run.steps.map((step) => ({
@@ -27518,8 +27614,10 @@ function registerDraftCommand(program) {
27518
27614
  import { Option as Option4 } from "commander";
27519
27615
  function registerRunCommand(program) {
27520
27616
  const run = program.command("run").description("Inspect automation runs");
27521
- addCursorPaginationOptions(
27522
- run.command("list").description("List runs for an automation").argument("<automation-id>", "Automation ID")
27617
+ addWorkspaceScopeOptions(
27618
+ addCursorPaginationOptions(
27619
+ run.command("list").description("List runs for an automation").argument("<automation-id>", "Automation ID")
27620
+ )
27523
27621
  ).addOption(
27524
27622
  new Option4("--status <status>", "Only show runs with this status").choices([
27525
27623
  ...AUTOMATION_RUN_STATUSES
@@ -27538,37 +27636,66 @@ function registerRunCommand(program) {
27538
27636
  };
27539
27637
  await runApiCommand(
27540
27638
  command,
27541
- ({ api, signal }) => collectCursorPages(
27542
- options,
27543
- (args) => api.automationRuns.list(automationId, { ...args, ...filters }, { signal })
27544
- ),
27545
- { human: formatRunList },
27546
- {
27547
- spinner: "Loading runs...",
27548
- streamNdjson: ({ api, signal }) => streamCursorNdjsonItems(
27639
+ async ({ api, signal }) => {
27640
+ const workspaceId = await resolveWorkspaceScope(options);
27641
+ return collectCursorPages(
27549
27642
  options,
27550
- (args) => api.automationRuns.list(
27643
+ (args) => workspaceId === null ? api.automationRuns.list(
27644
+ automationId,
27645
+ { ...args, ...filters },
27646
+ { signal }
27647
+ ) : api.workspaceAutomationRuns.list(
27648
+ workspaceId,
27551
27649
  automationId,
27552
27650
  { ...args, ...filters },
27553
27651
  { signal }
27554
27652
  )
27555
- )
27653
+ );
27654
+ },
27655
+ { human: formatRunList },
27656
+ {
27657
+ spinner: "Loading runs...",
27658
+ streamNdjson: async function* ({ api, signal }) {
27659
+ const workspaceId = await resolveWorkspaceScope(options);
27660
+ yield* streamCursorNdjsonItems(
27661
+ options,
27662
+ (args) => workspaceId === null ? api.automationRuns.list(
27663
+ automationId,
27664
+ { ...args, ...filters },
27665
+ { signal }
27666
+ ) : api.workspaceAutomationRuns.list(
27667
+ workspaceId,
27668
+ automationId,
27669
+ { ...args, ...filters },
27670
+ { signal }
27671
+ )
27672
+ );
27673
+ }
27556
27674
  }
27557
27675
  );
27558
27676
  });
27559
- run.command("view").description("Show a run with step and failure details").argument("<automation-id>", "Automation ID").argument("<run-id>", "Run ID").option("--full", "Include raw step results and generated code in machine output").action(
27677
+ addWorkspaceScopeOptions(
27678
+ run.command("view").description("Show a run with step and failure details").argument("<automation-id>", "Automation ID").argument("<run-id>", "Run ID").option("--full", "Include raw step results and generated code in machine output")
27679
+ ).action(
27560
27680
  async (automationId, runId, options, command) => {
27681
+ const detail = {
27682
+ includeGeneratedCode: Boolean(options.full),
27683
+ includeToolCallPreviews: true
27684
+ };
27561
27685
  await runApiCommand(
27562
27686
  command,
27563
- ({ api, signal }) => api.automationRuns.get(
27564
- automationId,
27565
- runId,
27566
- {
27567
- includeGeneratedCode: Boolean(options.full),
27568
- includeToolCallPreviews: true
27569
- },
27570
- { signal }
27571
- ),
27687
+ async ({ api, signal }) => {
27688
+ const workspaceId = await resolveWorkspaceScope(options);
27689
+ return workspaceId === null ? api.automationRuns.get(automationId, runId, detail, { signal }) : api.workspaceAutomationRuns.get(
27690
+ workspaceId,
27691
+ automationId,
27692
+ runId,
27693
+ detail,
27694
+ {
27695
+ signal
27696
+ }
27697
+ );
27698
+ },
27572
27699
  { human: formatRun, json: options.full ? void 0 : summarizeRun },
27573
27700
  { spinner: "Loading run..." }
27574
27701
  );
@@ -27783,7 +27910,7 @@ function formatCurrentWorkspace(result) {
27783
27910
  return `Workspace ${result.workspace.name} (${result.workspaceId})${lockedNote(result.workspace)}`;
27784
27911
  }
27785
27912
  function formatWorkspaceSelection(result) {
27786
- return result.action === "cleared" ? "Cleared. Commands now act on your personal space." : `Pinned ${result.name ?? result.workspaceId}. \`automation\` commands now act on this workspace; drafts, chat and connections stay personal. Use --personal for a one-off.`;
27913
+ return result.action === "cleared" ? "Cleared. Commands now act on your personal space." : `Pinned ${result.name ?? result.workspaceId}. \`automation\` and \`run\` commands now act on this workspace; drafts, chat and connections stay personal. Use --personal for a one-off.`;
27787
27914
  }
27788
27915
 
27789
27916
  // src/commands/workspace/index.ts