@doist/automations-cli 1.4.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-DYIIMUG3.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.4.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,13 +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
- 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`
23043
23135
  };
23044
- function root5(workspaceId) {
23136
+ function root6(workspaceId) {
23045
23137
  return `/workspaces/${encodeURIComponent(workspaceId)}/automations`;
23046
23138
  }
23047
23139
 
@@ -23065,6 +23157,33 @@ var WorkspaceAutomationsClient = class extends BaseClient {
23065
23157
  });
23066
23158
  return automationSchema.parse(data);
23067
23159
  }
23160
+ async update(workspaceId, id, body, options) {
23161
+ const data = await this.request({
23162
+ method: "PUT",
23163
+ path: workspaceAutomationsEndpoints.detail(IdSchema.parse(workspaceId), IdSchema.parse(id)),
23164
+ body,
23165
+ options
23166
+ });
23167
+ return automationSchema.parse(data);
23168
+ }
23169
+ async updateMetadata(workspaceId, id, body, options) {
23170
+ const data = await this.request({
23171
+ method: "PATCH",
23172
+ path: workspaceAutomationsEndpoints.metadata(IdSchema.parse(workspaceId), IdSchema.parse(id)),
23173
+ body,
23174
+ options
23175
+ });
23176
+ return automationSchema.parse(data);
23177
+ }
23178
+ async updateSchedule(workspaceId, id, body, options) {
23179
+ const data = await this.request({
23180
+ method: "PATCH",
23181
+ path: workspaceAutomationsEndpoints.schedule(IdSchema.parse(workspaceId), IdSchema.parse(id)),
23182
+ body,
23183
+ options
23184
+ });
23185
+ return automationSchema.parse(data);
23186
+ }
23068
23187
  /** Runs the automation now. The run executes as its creator, not as the caller. */
23069
23188
  async trigger(workspaceId, id, options) {
23070
23189
  await this.request({
@@ -23076,9 +23195,9 @@ var WorkspaceAutomationsClient = class extends BaseClient {
23076
23195
  };
23077
23196
 
23078
23197
  // ../../packages/sdk/dist/esm/clients/workspaces/endpoints.js
23079
- var root6 = "/workspaces";
23198
+ var root7 = "/workspaces";
23080
23199
  var workspacesEndpoints = {
23081
- list: root6
23200
+ list: root7
23082
23201
  };
23083
23202
 
23084
23203
  // ../../packages/sdk/dist/esm/clients/workspaces/workspaces-client.js
@@ -23100,12 +23219,12 @@ var WorkspacesClient = class extends BaseClient {
23100
23219
  };
23101
23220
 
23102
23221
  // ../../packages/sdk/dist/esm/clients/chat/endpoints.js
23103
- var root7 = "/chat/conversations";
23222
+ var root8 = "/chat/conversations";
23104
23223
  var chatEndpoints = {
23105
- conversations: root7,
23106
- conversation: (id) => `${root7}/${encodeURIComponent(id)}`,
23107
- messages: (id) => `${root7}/${encodeURIComponent(id)}/messages`,
23108
- 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`
23109
23228
  };
23110
23229
 
23111
23230
  // ../../packages/sdk/dist/esm/clients/chat/chat-client.js
@@ -23179,14 +23298,14 @@ var ChatClient = class extends BaseClient {
23179
23298
  };
23180
23299
 
23181
23300
  // ../../packages/sdk/dist/esm/clients/connections/endpoints.js
23182
- var root8 = "/connections";
23301
+ var root9 = "/connections";
23183
23302
  var connectionsEndpoints = {
23184
- list: root8,
23185
- detail: (id) => `${root8}/${encodeURIComponent(id)}`,
23186
- token: (id) => `${root8}/${encodeURIComponent(id)}/token`,
23187
- dependentAutomations: (connectorId) => `${root8}/${encodeURIComponent(connectorId)}/automations`,
23188
- create: (connectorId, capability) => `${root8}/${encodeURIComponent(connectorId)}/${encodeURIComponent(capability)}`,
23189
- 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`
23190
23309
  };
23191
23310
 
23192
23311
  // ../../packages/sdk/dist/esm/clients/connections/connections-client.js
@@ -23327,12 +23446,12 @@ function createClientContext(authToken, options = {}, apiOrigin = "automations")
23327
23446
  }
23328
23447
 
23329
23448
  // ../../packages/sdk/dist/esm/clients/notifications/endpoints.js
23330
- var root9 = "/notifications";
23449
+ var root10 = "/notifications";
23331
23450
  var notificationsEndpoints = {
23332
- list: root9,
23333
- pendingPromptAutomations: `${root9}/pending-prompt-automations`,
23334
- detail: (id) => `${root9}/${encodeURIComponent(id)}`,
23335
- 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`
23336
23455
  };
23337
23456
  var pushRoot = "/push-subscriptions";
23338
23457
  var pushSubscriptionsEndpoints = {
@@ -23456,10 +23575,10 @@ var NotificationsClient = class extends BaseClient {
23456
23575
  };
23457
23576
 
23458
23577
  // ../../packages/sdk/dist/esm/clients/user-settings/endpoints.js
23459
- var root10 = "/settings";
23578
+ var root11 = "/settings";
23460
23579
  var userSettingsEndpoints = {
23461
- onboarding: `${root10}/onboarding`,
23462
- preferences: `${root10}/preferences`
23580
+ onboarding: `${root11}/onboarding`,
23581
+ preferences: `${root11}/preferences`
23463
23582
  };
23464
23583
 
23465
23584
  // ../../packages/sdk/dist/esm/clients/user-settings/user-settings-client.js
@@ -23611,11 +23730,11 @@ var UsageBillingClient = class extends BaseClient {
23611
23730
  };
23612
23731
 
23613
23732
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/endpoints.js
23614
- var root11 = "/webhook-event-subscriptions";
23733
+ var root12 = "/webhook-event-subscriptions";
23615
23734
  var webhookEventSubscriptionsEndpoints = {
23616
- list: root11,
23617
- detail: (id) => `${root11}/${encodeURIComponent(id)}`,
23618
- deliveries: (id) => `${root11}/${encodeURIComponent(id)}/deliveries`
23735
+ list: root12,
23736
+ detail: (id) => `${root12}/${encodeURIComponent(id)}`,
23737
+ deliveries: (id) => `${root12}/${encodeURIComponent(id)}/deliveries`
23619
23738
  };
23620
23739
 
23621
23740
  // ../../packages/sdk/dist/esm/clients/webhook-event-subscriptions/webhook-event-subscriptions-client.js
@@ -23688,12 +23807,12 @@ var WebhookEventSubscriptionsClient = class extends BaseClient {
23688
23807
  };
23689
23808
 
23690
23809
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/endpoints.js
23691
- function root12(automationId) {
23810
+ function root13(automationId) {
23692
23811
  return `/automations/${encodeURIComponent(automationId)}/subscriptions`;
23693
23812
  }
23694
23813
  var webhookSubscriptionsEndpoints = {
23695
- list: (automationId) => root12(automationId),
23696
- detail: (automationId, subscriptionId) => `${root12(automationId)}/${encodeURIComponent(subscriptionId)}`
23814
+ list: (automationId) => root13(automationId),
23815
+ detail: (automationId, subscriptionId) => `${root13(automationId)}/${encodeURIComponent(subscriptionId)}`
23697
23816
  };
23698
23817
 
23699
23818
  // ../../packages/sdk/dist/esm/clients/webhook-subscriptions/webhook-subscriptions-client.js
@@ -23747,12 +23866,14 @@ var AutomationsApi = class {
23747
23866
  webhookEventSubscriptions;
23748
23867
  workspaces;
23749
23868
  workspaceAutomations;
23869
+ workspaceAutomationRuns;
23750
23870
  constructor(authToken, options = {}) {
23751
23871
  const context = createClientContext(authToken, options);
23752
23872
  const todoistContext = createClientContext(authToken, options, "todoist");
23753
23873
  this.automations = new AutomationsClient(context);
23754
23874
  this.workspaces = new WorkspacesClient(context);
23755
23875
  this.workspaceAutomations = new WorkspaceAutomationsClient(context);
23876
+ this.workspaceAutomationRuns = new WorkspaceAutomationRunsClient(context);
23756
23877
  this.automationRuns = new AutomationRunsClient(context);
23757
23878
  this.connectors = new ConnectorsClient(context);
23758
23879
  this.connections = new ConnectionsClient(context);
@@ -25229,6 +25350,7 @@ function formatAutomationList(page) {
25229
25350
  }
25230
25351
  function formatAutomation(automation) {
25231
25352
  const failureReason = automation.status.status === "failed" ? automation.status.failureReason : void 0;
25353
+ const skipReason = automation.status.status === "skipped" ? automation.status.skipReason : void 0;
25232
25354
  return [
25233
25355
  `Automation: ${getResourceName(automation.manifest)}`,
25234
25356
  `ID: ${automation.id}`,
@@ -25239,6 +25361,7 @@ function formatAutomation(automation) {
25239
25361
  `Updated: ${automation.updatedAt}`,
25240
25362
  `Draft: ${automation.draftId ?? "none"}`,
25241
25363
  ...failureReason ? [`Failure: ${failureReason}`] : [],
25364
+ ...skipReason ? [`Skipped: ${skipReason}`] : [],
25242
25365
  "",
25243
25366
  "Manifest:",
25244
25367
  formatValue(automation.manifest)
@@ -25322,7 +25445,8 @@ function formatRunList(page) {
25322
25445
  [
25323
25446
  `Runs (${page.data.length})`,
25324
25447
  ...page.data.map((run) => {
25325
- const failure = run.failureReason ? ` ${run.failureReason}` : "";
25448
+ const reason = getRunOutcomeReason(run);
25449
+ const failure = reason ? ` ${reason}` : "";
25326
25450
  return `${run.id} ${run.status} ${run.createdAt}${failure}`;
25327
25451
  })
25328
25452
  ],
@@ -25336,8 +25460,8 @@ function formatRun(run) {
25336
25460
  `Status: ${run.status}`,
25337
25461
  `Created: ${run.createdAt}`,
25338
25462
  `Updated: ${run.updatedAt}`,
25339
- `Failure category: ${run.failureCategory ?? "none"}`,
25340
- `Failure reason: ${run.failureReason ?? "none"}`,
25463
+ `Failure category: ${getRunOutcomeCategory(run) ?? "none"}`,
25464
+ `Failure reason: ${getRunOutcomeReason(run) ?? "none"}`,
25341
25465
  `Result: ${run.result?.text ?? "none"}`,
25342
25466
  `Steps: ${run.steps.length}`
25343
25467
  ];
@@ -25367,8 +25491,8 @@ function summarizeRun(run) {
25367
25491
  status: run.status,
25368
25492
  createdAt: run.createdAt,
25369
25493
  updatedAt: run.updatedAt,
25370
- failureCategory: run.failureCategory,
25371
- failureReason: run.failureReason,
25494
+ failureCategory: getRunOutcomeCategory(run),
25495
+ failureReason: getRunOutcomeReason(run),
25372
25496
  result: run.result,
25373
25497
  temporalUrl: run.temporalUrl,
25374
25498
  steps: run.steps.map((step) => ({
@@ -25502,51 +25626,81 @@ function registerAutomationCommand(program) {
25502
25626
  { spinner: "Triggering automation..." }
25503
25627
  );
25504
25628
  });
25505
- automation.command("update").description("Replace an automation name and description").argument("<automation-id>", "Automation ID").option("--name <name>", "New automation name (required)").option("--description <description>", "New automation description (required)").action(async (automationId, options, command) => {
25629
+ addWorkspaceScopeOptions(
25630
+ automation.command("update").description("Replace an automation name and description").argument("<automation-id>", "Automation ID").option("--name <name>", "New automation name (required)").option("--description <description>", "New automation description (required)")
25631
+ ).action(
25632
+ async (automationId, options, command) => {
25633
+ await runApiCommand(
25634
+ command,
25635
+ async ({ api, signal }) => {
25636
+ if (options.name === void 0 || options.description === void 0) {
25637
+ throw new Error("Provide both --name and --description.");
25638
+ }
25639
+ const workspaceId = await resolveWorkspaceScope(options);
25640
+ const metadata = { name: options.name, description: options.description };
25641
+ return {
25642
+ action: "updated",
25643
+ automation: workspaceId === null ? await api.automations.updateMetadata(automationId, metadata, {
25644
+ signal
25645
+ }) : await api.workspaceAutomations.updateMetadata(
25646
+ workspaceId,
25647
+ automationId,
25648
+ metadata,
25649
+ { signal }
25650
+ )
25651
+ };
25652
+ },
25653
+ { human: formatAutomationChange, json: summarizeAutomationChange },
25654
+ { spinner: "Updating automation..." }
25655
+ );
25656
+ }
25657
+ );
25658
+ addWorkspaceScopeOptions(
25659
+ automation.command("schedule").description("Replace an automation schedule").argument("<automation-id>", "Automation ID").option("--cron <expression>", "Five-part cron expression; requires --timezone").option("--interval <interval>", "Interval such as 45m or 1d").option("--timezone <timezone>", "IANA timezone required with --cron")
25660
+ ).action(
25661
+ async (automationId, options, command) => {
25662
+ await runApiCommand(
25663
+ command,
25664
+ async ({ api, signal }) => {
25665
+ const schedule = { value: resolveScheduleValue(options) };
25666
+ const workspaceId = await resolveWorkspaceScope(options);
25667
+ return {
25668
+ action: "scheduled",
25669
+ automation: workspaceId === null ? await api.automations.updateSchedule(automationId, schedule, {
25670
+ signal
25671
+ }) : await api.workspaceAutomations.updateSchedule(
25672
+ workspaceId,
25673
+ automationId,
25674
+ schedule,
25675
+ { signal }
25676
+ )
25677
+ };
25678
+ },
25679
+ { human: formatAutomationChange, json: summarizeAutomationChange },
25680
+ { spinner: "Rescheduling automation..." }
25681
+ );
25682
+ }
25683
+ );
25684
+ }
25685
+ function registerEnabledStateCommand(parent, name, enabled) {
25686
+ addWorkspaceScopeOptions(
25687
+ parent.command(name).description(`${enabled ? "Enable" : "Disable"} an automation`).argument("<automation-id>", "Automation ID")
25688
+ ).action(async (automationId, options, command) => {
25506
25689
  await runApiCommand(
25507
25690
  command,
25508
25691
  async ({ api, signal }) => {
25509
- if (options.name === void 0 || options.description === void 0) {
25510
- throw new Error("Provide both --name and --description.");
25511
- }
25692
+ const workspaceId = await resolveWorkspaceScope(options);
25512
25693
  return {
25513
- action: "updated",
25514
- automation: await api.automations.updateMetadata(
25694
+ action: name === "enable" ? "enabled" : "disabled",
25695
+ automation: workspaceId === null ? await api.automations.update(automationId, { enabled }, { signal }) : await api.workspaceAutomations.update(
25696
+ workspaceId,
25515
25697
  automationId,
25516
- { name: options.name, description: options.description },
25698
+ { enabled },
25517
25699
  { signal }
25518
25700
  )
25519
25701
  };
25520
25702
  },
25521
25703
  { human: formatAutomationChange, json: summarizeAutomationChange },
25522
- { spinner: "Updating automation..." }
25523
- );
25524
- });
25525
- automation.command("schedule").description("Replace an automation schedule").argument("<automation-id>", "Automation ID").option("--cron <expression>", "Five-part cron expression; requires --timezone").option("--interval <interval>", "Interval such as 45m or 1d").option("--timezone <timezone>", "IANA timezone required with --cron").action(async (automationId, options, command) => {
25526
- await runApiCommand(
25527
- command,
25528
- async ({ api, signal }) => ({
25529
- action: "scheduled",
25530
- automation: await api.automations.updateSchedule(
25531
- automationId,
25532
- { value: resolveScheduleValue(options) },
25533
- { signal }
25534
- )
25535
- }),
25536
- { human: formatAutomationChange, json: summarizeAutomationChange },
25537
- { spinner: "Rescheduling automation..." }
25538
- );
25539
- });
25540
- }
25541
- function registerEnabledStateCommand(parent, name, enabled) {
25542
- parent.command(name).description(`${enabled ? "Enable" : "Disable"} an automation`).argument("<automation-id>", "Automation ID").action(async (automationId, _options, command) => {
25543
- await runApiCommand(
25544
- command,
25545
- async ({ api, signal }) => ({
25546
- action: name === "enable" ? "enabled" : "disabled",
25547
- automation: await api.automations.update(automationId, { enabled }, { signal })
25548
- }),
25549
- { human: formatAutomationChange, json: summarizeAutomationChange },
25550
25704
  { spinner: `${enabled ? "Enabling" : "Disabling"} automation...` }
25551
25705
  );
25552
25706
  });
@@ -27459,8 +27613,10 @@ function registerDraftCommand(program) {
27459
27613
  import { Option as Option4 } from "commander";
27460
27614
  function registerRunCommand(program) {
27461
27615
  const run = program.command("run").description("Inspect automation runs");
27462
- addCursorPaginationOptions(
27463
- 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
+ )
27464
27620
  ).addOption(
27465
27621
  new Option4("--status <status>", "Only show runs with this status").choices([
27466
27622
  ...AUTOMATION_RUN_STATUSES
@@ -27479,37 +27635,66 @@ function registerRunCommand(program) {
27479
27635
  };
27480
27636
  await runApiCommand(
27481
27637
  command,
27482
- ({ api, signal }) => collectCursorPages(
27483
- options,
27484
- (args) => api.automationRuns.list(automationId, { ...args, ...filters }, { signal })
27485
- ),
27486
- { human: formatRunList },
27487
- {
27488
- spinner: "Loading runs...",
27489
- streamNdjson: ({ api, signal }) => streamCursorNdjsonItems(
27638
+ async ({ api, signal }) => {
27639
+ const workspaceId = await resolveWorkspaceScope(options);
27640
+ return collectCursorPages(
27490
27641
  options,
27491
- (args) => api.automationRuns.list(
27642
+ (args) => workspaceId === null ? api.automationRuns.list(
27643
+ automationId,
27644
+ { ...args, ...filters },
27645
+ { signal }
27646
+ ) : api.workspaceAutomationRuns.list(
27647
+ workspaceId,
27492
27648
  automationId,
27493
27649
  { ...args, ...filters },
27494
27650
  { signal }
27495
27651
  )
27496
- )
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
+ }
27497
27673
  }
27498
27674
  );
27499
27675
  });
27500
- 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(
27501
27679
  async (automationId, runId, options, command) => {
27680
+ const detail = {
27681
+ includeGeneratedCode: Boolean(options.full),
27682
+ includeToolCallPreviews: true
27683
+ };
27502
27684
  await runApiCommand(
27503
27685
  command,
27504
- ({ api, signal }) => api.automationRuns.get(
27505
- automationId,
27506
- runId,
27507
- {
27508
- includeGeneratedCode: Boolean(options.full),
27509
- includeToolCallPreviews: true
27510
- },
27511
- { signal }
27512
- ),
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
+ },
27513
27698
  { human: formatRun, json: options.full ? void 0 : summarizeRun },
27514
27699
  { spinner: "Loading run..." }
27515
27700
  );
@@ -27724,7 +27909,7 @@ function formatCurrentWorkspace(result) {
27724
27909
  return `Workspace ${result.workspace.name} (${result.workspaceId})${lockedNote(result.workspace)}`;
27725
27910
  }
27726
27911
  function formatWorkspaceSelection(result) {
27727
- return result.action === "cleared" ? "Cleared. Commands now act on your personal space." : `Pinned ${result.name ?? result.workspaceId}. \`automation list\`, \`view\` and \`trigger\` now act on this workspace; everything else stays 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.`;
27728
27913
  }
27729
27914
 
27730
27915
  // src/commands/workspace/index.ts