@doist/automations-cli 1.5.0 → 1.6.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-CTJBRO6N.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.6.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);
@@ -19646,8 +19677,7 @@ var adminReliabilityFailureCategorySchema = external_exports.object({
19646
19677
  category: external_exports.enum(FAILURE_CATEGORIES).nullable(),
19647
19678
  failures: external_exports.number(),
19648
19679
  shareOfFailedRuns: external_exports.number(),
19649
- shareOfTerminalRuns: external_exports.number(),
19650
- includedInReliabilityRate: external_exports.boolean()
19680
+ shareOfTerminalRuns: external_exports.number()
19651
19681
  });
19652
19682
  var adminReliabilityDailyRowSchema = external_exports.object({
19653
19683
  date: external_exports.iso.date(),
@@ -19805,6 +19835,22 @@ function parseIfCondition(condition) {
19805
19835
  return { reference, operator, literal: literal2 };
19806
19836
  }
19807
19837
 
19838
+ // ../../packages/core/dist/esm/utils/run-outcome.js
19839
+ function getRunOutcomeReason(run) {
19840
+ if (run.status === "failed")
19841
+ return run.failureReason ?? null;
19842
+ if (run.status === "skipped")
19843
+ return run.skipReason ?? null;
19844
+ return null;
19845
+ }
19846
+ function getRunOutcomeCategory(run) {
19847
+ if (run.status === "failed")
19848
+ return run.failureCategory ?? null;
19849
+ if (run.status === "skipped")
19850
+ return run.skipCategory ?? null;
19851
+ return null;
19852
+ }
19853
+
19808
19854
  // ../../packages/core/dist/esm/schemas/manifest.helpers.js
19809
19855
  function getManifestTriggers(manifest) {
19810
19856
  return manifest.triggers ?? [];
@@ -20301,8 +20347,8 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
20301
20347
  if (parts.length === 0) {
20302
20348
  return null;
20303
20349
  }
20304
- const [root13, ...rest] = parts;
20305
- if (root13 === "trigger") {
20350
+ const [root14, ...rest] = parts;
20351
+ if (root14 === "trigger") {
20306
20352
  if (rest.length === 0) {
20307
20353
  return `Step "${stepId}" ${sourceType} references "{{trigger}}" without a property. Use {{trigger.<property>}} syntax (e.g., {{trigger.payload}}, {{trigger.metadata}}).`;
20308
20354
  }
@@ -20325,7 +20371,7 @@ function validateTemplateVariable({ variable, context, stepId, currentStepGuard,
20325
20371
  }
20326
20372
  return null;
20327
20373
  }
20328
- if (root13 === "steps") {
20374
+ if (root14 === "steps") {
20329
20375
  const referencedStepId = rest[0];
20330
20376
  if (!referencedStepId) {
20331
20377
  return `Step "${stepId}" ${sourceType} references "steps" but is missing the step identifier in template variable "{{${variable}}}". Use {{steps.<stepId>}} syntax.`;
@@ -20864,6 +20910,12 @@ var runStatusSchema = external_exports.discriminatedUnion("status", [
20864
20910
  external_exports.object({
20865
20911
  status: external_exports.literal("cancelled"),
20866
20912
  lastRun: external_exports.iso.datetime()
20913
+ }),
20914
+ external_exports.object({
20915
+ status: external_exports.literal("skipped"),
20916
+ lastRun: external_exports.iso.datetime(),
20917
+ skipReason: external_exports.string().optional(),
20918
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).optional()
20867
20919
  })
20868
20920
  ]);
20869
20921
  var automationSchema = external_exports.object({
@@ -21564,7 +21616,8 @@ var BACKEND_COHORT_EVENTS = [
21564
21616
  "automation:updated",
21565
21617
  // Temporal worker (run lifecycle)
21566
21618
  "automation:ran",
21567
- "automation:run:failed"
21619
+ "automation:run:failed",
21620
+ "automation:run:skipped"
21568
21621
  ];
21569
21622
  var COHORT_EVENTS = [...FRONTEND_COHORT_EVENTS, ...BACKEND_COHORT_EVENTS];
21570
21623
  var cohortEventSchema = external_exports.enum(COHORT_EVENTS);
@@ -22187,6 +22240,11 @@ var AutomationRunFinishedDataSchema = external_exports.discriminatedUnion("statu
22187
22240
  ...automationRunFinishedBaseShape,
22188
22241
  status: external_exports.literal("failed"),
22189
22242
  failureReason: external_exports.string().min(1)
22243
+ }),
22244
+ external_exports.object({
22245
+ ...automationRunFinishedBaseShape,
22246
+ status: external_exports.literal("skipped"),
22247
+ skipReason: external_exports.string().min(1)
22190
22248
  })
22191
22249
  ]);
22192
22250
  var AutomationRunFinishedEventSchema = external_exports.object({
@@ -22838,10 +22896,6 @@ var automationRunsEndpoints = {
22838
22896
  };
22839
22897
 
22840
22898
  // ../../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
22899
  function isRequestOptions(value) {
22846
22900
  return Boolean(value && ("signal" in value || "headers" in value));
22847
22901
  }
@@ -23035,15 +23089,51 @@ var AutomationsClient = class extends BaseClient {
23035
23089
  }
23036
23090
  };
23037
23091
 
23092
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-runs/endpoints.js
23093
+ var workspaceAutomationRunsEndpoints = {
23094
+ list: (workspaceId, automationId) => `${root5(workspaceId, automationId)}/runs`,
23095
+ detail: (workspaceId, automationId, runId) => `${root5(workspaceId, automationId)}/runs/${encodeURIComponent(runId)}`
23096
+ };
23097
+ function root5(workspaceId, automationId) {
23098
+ return `/workspaces/${encodeURIComponent(workspaceId)}/automations/${encodeURIComponent(automationId)}`;
23099
+ }
23100
+
23101
+ // ../../packages/sdk/dist/esm/clients/workspace-automation-runs/workspace-automation-runs-client.js
23102
+ var WorkspaceAutomationRunsClient = class extends BaseClient {
23103
+ async list(workspaceId, automationId, args = {}, options) {
23104
+ const { cursor, limit } = CursorPaginationSchema.parse(args);
23105
+ const { status, since, until } = ListAutomationRunsQuerySchema.parse(args);
23106
+ const data = await this.request({
23107
+ method: "GET",
23108
+ path: workspaceAutomationRunsEndpoints.list(IdSchema.parse(workspaceId), IdSchema.parse(automationId)),
23109
+ query: { cursor, limit, status, since, until },
23110
+ options
23111
+ });
23112
+ return automationRunListResponseSchema.parse(data);
23113
+ }
23114
+ async get(workspaceId, automationId, runId, args = {}, options) {
23115
+ const data = await this.request({
23116
+ method: "GET",
23117
+ path: workspaceAutomationRunsEndpoints.detail(IdSchema.parse(workspaceId), IdSchema.parse(automationId), IdSchema.parse(runId)),
23118
+ query: {
23119
+ includeGeneratedCode: args.includeGeneratedCode ? true : void 0,
23120
+ includeToolCallPreviews: args.includeToolCallPreviews ? true : void 0
23121
+ },
23122
+ options
23123
+ });
23124
+ return AutomationRunDetailDtoSchema.parse(data);
23125
+ }
23126
+ };
23127
+
23038
23128
  // ../../packages/sdk/dist/esm/clients/workspace-automations/endpoints.js
23039
23129
  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`
23130
+ list: (workspaceId) => `${root6(workspaceId)}`,
23131
+ detail: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}`,
23132
+ metadata: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/metadata`,
23133
+ schedule: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/schedule`,
23134
+ trigger: (workspaceId, id) => `${root6(workspaceId)}/${encodeURIComponent(id)}/trigger`
23045
23135
  };
23046
- function root5(workspaceId) {
23136
+ function root6(workspaceId) {
23047
23137
  return `/workspaces/${encodeURIComponent(workspaceId)}/automations`;
23048
23138
  }
23049
23139
 
@@ -23105,9 +23195,9 @@ var WorkspaceAutomationsClient = class extends BaseClient {
23105
23195
  };
23106
23196
 
23107
23197
  // ../../packages/sdk/dist/esm/clients/workspaces/endpoints.js
23108
- var root6 = "/workspaces";
23198
+ var root7 = "/workspaces";
23109
23199
  var workspacesEndpoints = {
23110
- list: root6
23200
+ list: root7
23111
23201
  };
23112
23202
 
23113
23203
  // ../../packages/sdk/dist/esm/clients/workspaces/workspaces-client.js
@@ -23129,12 +23219,12 @@ var WorkspacesClient = class extends BaseClient {
23129
23219
  };
23130
23220
 
23131
23221
  // ../../packages/sdk/dist/esm/clients/chat/endpoints.js
23132
- var root7 = "/chat/conversations";
23222
+ var root8 = "/chat/conversations";
23133
23223
  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`
23224
+ conversations: root8,
23225
+ conversation: (id) => `${root8}/${encodeURIComponent(id)}`,
23226
+ messages: (id) => `${root8}/${encodeURIComponent(id)}/messages`,
23227
+ usagePreview: (id) => `${root8}/${encodeURIComponent(id)}/usage-preview`
23138
23228
  };
23139
23229
 
23140
23230
  // ../../packages/sdk/dist/esm/clients/chat/chat-client.js
@@ -23208,14 +23298,14 @@ var ChatClient = class extends BaseClient {
23208
23298
  };
23209
23299
 
23210
23300
  // ../../packages/sdk/dist/esm/clients/connections/endpoints.js
23211
- var root8 = "/connections";
23301
+ var root9 = "/connections";
23212
23302
  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`
23303
+ list: root9,
23304
+ detail: (id) => `${root9}/${encodeURIComponent(id)}`,
23305
+ token: (id) => `${root9}/${encodeURIComponent(id)}/token`,
23306
+ dependentAutomations: (connectorId) => `${root9}/${encodeURIComponent(connectorId)}/automations`,
23307
+ create: (connectorId, capability) => `${root9}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}`,
23308
+ checkManifest: `${root9}/check-manifest`
23219
23309
  };
23220
23310
 
23221
23311
  // ../../packages/sdk/dist/esm/clients/connections/connections-client.js
@@ -23356,12 +23446,12 @@ function createClientContext(authToken, options = {}, apiOrigin = "automations")
23356
23446
  }
23357
23447
 
23358
23448
  // ../../packages/sdk/dist/esm/clients/notifications/endpoints.js
23359
- var root9 = "/notifications";
23449
+ var root10 = "/notifications";
23360
23450
  var notificationsEndpoints = {
23361
- list: root9,
23362
- pendingPromptAutomations: `${root9}/pending-prompt-automations`,
23363
- detail: (id) => `${root9}/${encodeURIComponent(id)}`,
23364
- respond: (id) => `${root9}/${encodeURIComponent(id)}/respond`
23451
+ list: root10,
23452
+ pendingPromptAutomations: `${root10}/pending-prompt-automations`,
23453
+ detail: (id) => `${root10}/${encodeURIComponent(id)}`,
23454
+ respond: (id) => `${root10}/${encodeURIComponent(id)}/respond`
23365
23455
  };
23366
23456
  var pushRoot = "/push-subscriptions";
23367
23457
  var pushSubscriptionsEndpoints = {
@@ -23485,10 +23575,10 @@ var NotificationsClient = class extends BaseClient {
23485
23575
  };
23486
23576
 
23487
23577
  // ../../packages/sdk/dist/esm/clients/user-settings/endpoints.js
23488
- var root10 = "/settings";
23578
+ var root11 = "/settings";
23489
23579
  var userSettingsEndpoints = {
23490
- onboarding: `${root10}/onboarding`,
23491
- preferences: `${root10}/preferences`
23580
+ onboarding: `${root11}/onboarding`,
23581
+ preferences: `${root11}/preferences`
23492
23582
  };
23493
23583
 
23494
23584
  // ../../packages/sdk/dist/esm/clients/user-settings/user-settings-client.js
@@ -23640,11 +23730,11 @@ var UsageBillingClient = class extends BaseClient {
23640
23730
  };
23641
23731
 
23642
23732
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/endpoints.js
23643
- var root11 = "/webhook-event-subscriptions";
23733
+ var root12 = "/webhook-event-subscriptions";
23644
23734
  var webhookEventSubscriptionsEndpoints = {
23645
- list: root11,
23646
- detail: (id) => `${root11}/${encodeURIComponent(id)}`,
23647
- deliveries: (id) => `${root11}/${encodeURIComponent(id)}/deliveries`
23735
+ list: root12,
23736
+ detail: (id) => `${root12}/${encodeURIComponent(id)}`,
23737
+ deliveries: (id) => `${root12}/${encodeURIComponent(id)}/deliveries`
23648
23738
  };
23649
23739
 
23650
23740
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/webhook-event-subscriptions-client.js
@@ -23717,12 +23807,12 @@ var WebhookEventSubscriptionsClient = class extends BaseClient {
23717
23807
  };
23718
23808
 
23719
23809
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/endpoints.js
23720
- function root12(automationId) {
23810
+ function root13(automationId) {
23721
23811
  return `/automations/${encodeURIComponent(automationId)}/subscriptions`;
23722
23812
  }
23723
23813
  var webhookSubscriptionsEndpoints = {
23724
- list: (automationId) => root12(automationId),
23725
- detail: (automationId, subscriptionId) => `${root12(automationId)}/${encodeURIComponent(subscriptionId)}`
23814
+ list: (automationId) => root13(automationId),
23815
+ detail: (automationId, subscriptionId) => `${root13(automationId)}/${encodeURIComponent(subscriptionId)}`
23726
23816
  };
23727
23817
 
23728
23818
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/webhook-subscriptions-client.js
@@ -23776,12 +23866,14 @@ var AutomationsApi = class {
23776
23866
  webhookEventSubscriptions;
23777
23867
  workspaces;
23778
23868
  workspaceAutomations;
23869
+ workspaceAutomationRuns;
23779
23870
  constructor(authToken, options = {}) {
23780
23871
  const context = createClientContext(authToken, options);
23781
23872
  const todoistContext = createClientContext(authToken, options, "todoist");
23782
23873
  this.automations = new AutomationsClient(context);
23783
23874
  this.workspaces = new WorkspacesClient(context);
23784
23875
  this.workspaceAutomations = new WorkspaceAutomationsClient(context);
23876
+ this.workspaceAutomationRuns = new WorkspaceAutomationRunsClient(context);
23785
23877
  this.automationRuns = new AutomationRunsClient(context);
23786
23878
  this.connectors = new ConnectorsClient(context);
23787
23879
  this.connections = new ConnectionsClient(context);
@@ -25258,6 +25350,7 @@ function formatAutomationList(page) {
25258
25350
  }
25259
25351
  function formatAutomation(automation) {
25260
25352
  const failureReason = automation.status.status === "failed" ? automation.status.failureReason : void 0;
25353
+ const skipReason = automation.status.status === "skipped" ? automation.status.skipReason : void 0;
25261
25354
  return [
25262
25355
  `Automation: ${getResourceName(automation.manifest)}`,
25263
25356
  `ID: ${automation.id}`,
@@ -25268,6 +25361,7 @@ function formatAutomation(automation) {
25268
25361
  `Updated: ${automation.updatedAt}`,
25269
25362
  `Draft: ${automation.draftId ?? "none"}`,
25270
25363
  ...failureReason ? [`Failure: ${failureReason}`] : [],
25364
+ ...skipReason ? [`Skipped: ${skipReason}`] : [],
25271
25365
  "",
25272
25366
  "Manifest:",
25273
25367
  formatValue(automation.manifest)
@@ -25351,7 +25445,8 @@ function formatRunList(page) {
25351
25445
  [
25352
25446
  `Runs (${page.data.length})`,
25353
25447
  ...page.data.map((run) => {
25354
- const failure = run.failureReason ? ` ${run.failureReason}` : "";
25448
+ const reason = getRunOutcomeReason(run);
25449
+ const failure = reason ? ` ${reason}` : "";
25355
25450
  return `${run.id} ${run.status} ${run.createdAt}${failure}`;
25356
25451
  })
25357
25452
  ],
@@ -25365,8 +25460,8 @@ function formatRun(run) {
25365
25460
  `Status: ${run.status}`,
25366
25461
  `Created: ${run.createdAt}`,
25367
25462
  `Updated: ${run.updatedAt}`,
25368
- `Failure category: ${run.failureCategory ?? "none"}`,
25369
- `Failure reason: ${run.failureReason ?? "none"}`,
25463
+ `Failure category: ${getRunOutcomeCategory(run) ?? "none"}`,
25464
+ `Failure reason: ${getRunOutcomeReason(run) ?? "none"}`,
25370
25465
  `Result: ${run.result?.text ?? "none"}`,
25371
25466
  `Steps: ${run.steps.length}`
25372
25467
  ];
@@ -25396,8 +25491,8 @@ function summarizeRun(run) {
25396
25491
  status: run.status,
25397
25492
  createdAt: run.createdAt,
25398
25493
  updatedAt: run.updatedAt,
25399
- failureCategory: run.failureCategory,
25400
- failureReason: run.failureReason,
25494
+ failureCategory: getRunOutcomeCategory(run),
25495
+ failureReason: getRunOutcomeReason(run),
25401
25496
  result: run.result,
25402
25497
  temporalUrl: run.temporalUrl,
25403
25498
  steps: run.steps.map((step) => ({
@@ -27518,8 +27613,10 @@ function registerDraftCommand(program) {
27518
27613
  import { Option as Option4 } from "commander";
27519
27614
  function registerRunCommand(program) {
27520
27615
  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")
27616
+ addWorkspaceScopeOptions(
27617
+ addCursorPaginationOptions(
27618
+ run.command("list").description("List runs for an automation").argument("<automation-id>", "Automation ID")
27619
+ )
27523
27620
  ).addOption(
27524
27621
  new Option4("--status <status>", "Only show runs with this status").choices([
27525
27622
  ...AUTOMATION_RUN_STATUSES
@@ -27538,37 +27635,66 @@ function registerRunCommand(program) {
27538
27635
  };
27539
27636
  await runApiCommand(
27540
27637
  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(
27638
+ async ({ api, signal }) => {
27639
+ const workspaceId = await resolveWorkspaceScope(options);
27640
+ return collectCursorPages(
27549
27641
  options,
27550
- (args) => api.automationRuns.list(
27642
+ (args) => workspaceId === null ? api.automationRuns.list(
27643
+ automationId,
27644
+ { ...args, ...filters },
27645
+ { signal }
27646
+ ) : api.workspaceAutomationRuns.list(
27647
+ workspaceId,
27551
27648
  automationId,
27552
27649
  { ...args, ...filters },
27553
27650
  { signal }
27554
27651
  )
27555
- )
27652
+ );
27653
+ },
27654
+ { human: formatRunList },
27655
+ {
27656
+ spinner: "Loading runs...",
27657
+ streamNdjson: async function* ({ api, signal }) {
27658
+ const workspaceId = await resolveWorkspaceScope(options);
27659
+ yield* streamCursorNdjsonItems(
27660
+ options,
27661
+ (args) => workspaceId === null ? api.automationRuns.list(
27662
+ automationId,
27663
+ { ...args, ...filters },
27664
+ { signal }
27665
+ ) : api.workspaceAutomationRuns.list(
27666
+ workspaceId,
27667
+ automationId,
27668
+ { ...args, ...filters },
27669
+ { signal }
27670
+ )
27671
+ );
27672
+ }
27556
27673
  }
27557
27674
  );
27558
27675
  });
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(
27676
+ addWorkspaceScopeOptions(
27677
+ 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")
27678
+ ).action(
27560
27679
  async (automationId, runId, options, command) => {
27680
+ const detail = {
27681
+ includeGeneratedCode: Boolean(options.full),
27682
+ includeToolCallPreviews: true
27683
+ };
27561
27684
  await runApiCommand(
27562
27685
  command,
27563
- ({ api, signal }) => api.automationRuns.get(
27564
- automationId,
27565
- runId,
27566
- {
27567
- includeGeneratedCode: Boolean(options.full),
27568
- includeToolCallPreviews: true
27569
- },
27570
- { signal }
27571
- ),
27686
+ async ({ api, signal }) => {
27687
+ const workspaceId = await resolveWorkspaceScope(options);
27688
+ return workspaceId === null ? api.automationRuns.get(automationId, runId, detail, { signal }) : api.workspaceAutomationRuns.get(
27689
+ workspaceId,
27690
+ automationId,
27691
+ runId,
27692
+ detail,
27693
+ {
27694
+ signal
27695
+ }
27696
+ );
27697
+ },
27572
27698
  { human: formatRun, json: options.full ? void 0 : summarizeRun },
27573
27699
  { spinner: "Loading run..." }
27574
27700
  );
@@ -27783,7 +27909,7 @@ function formatCurrentWorkspace(result) {
27783
27909
  return `Workspace ${result.workspace.name} (${result.workspaceId})${lockedNote(result.workspace)}`;
27784
27910
  }
27785
27911
  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.`;
27912
+ 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
27913
  }
27788
27914
 
27789
27915
  // src/commands/workspace/index.ts