@doist/automations-mcp 1.10.1 → 1.11.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.
@@ -7018,6 +7018,9 @@ var USAGE_BILLING_DENIAL_CODES = [
7018
7018
  ];
7019
7019
  var USAGE_BILLING_TEMPORARILY_UNAVAILABLE_CODE = "usage_billing_temporarily_unavailable";
7020
7020
  var USAGE_BILLING_UNAVAILABLE_CODE = "usage_billing_unavailable";
7021
+ function isUsageBillingDenialCode(code) {
7022
+ return typeof code === "string" && USAGE_BILLING_DENIAL_CODES.includes(code);
7023
+ }
7021
7024
 
7022
7025
  // ../../packages/core/dist/esm/constants/webhook-event-subscription.constants.js
7023
7026
  var WEBHOOK_EVENT_TYPES = [
@@ -9828,6 +9831,29 @@ var chatStreamRequestErrorResponseSchema = z17.object({
9828
9831
  /** Present only when the server establishes whether work started. */
9829
9832
  execution_started: z17.boolean().optional()
9830
9833
  });
9834
+ function getChatBillingRefusal(error) {
9835
+ if (!(error instanceof Error) || !error.message.trim().startsWith("{"))
9836
+ return null;
9837
+ let body;
9838
+ try {
9839
+ body = JSON.parse(error.message);
9840
+ } catch {
9841
+ return null;
9842
+ }
9843
+ const parsed = chatStreamRequestErrorResponseSchema.safeParse(body);
9844
+ if (!parsed.success)
9845
+ return null;
9846
+ if (isUsageBillingDenialCode(parsed.data.code)) {
9847
+ return { message: parsed.data.message, code: parsed.data.code };
9848
+ }
9849
+ if (parsed.data.statusCode === 402 && isBodyWithoutCodeOrReason(body)) {
9850
+ return { message: parsed.data.message, code: void 0 };
9851
+ }
9852
+ return null;
9853
+ }
9854
+ function isBodyWithoutCodeOrReason(body) {
9855
+ return typeof body === "object" && body !== null && !("code" in body) && !("reason" in body);
9856
+ }
9831
9857
  var CHAT_CONVERSATION_STATUSES = ["active", "archived", "all"];
9832
9858
  var chatConversationStatusSchema = z17.enum(CHAT_CONVERSATION_STATUSES);
9833
9859
  var getChatConversationsQuerySchema = z17.object({
@@ -13992,7 +14018,7 @@ import { McpServer } from "@modelcontextprotocol/server";
13992
14018
  // package.json
13993
14019
  var package_default = {
13994
14020
  name: "@doist/automations-mcp",
13995
- version: "1.10.1",
14021
+ version: "1.11.0",
13996
14022
  description: "MCP server and importable AI tools for Todoist Automations",
13997
14023
  type: "module",
13998
14024
  main: "./dist/index.js",
@@ -15177,6 +15203,10 @@ function describeTurnError(error, signal) {
15177
15203
  return error.message;
15178
15204
  }
15179
15205
  }
15206
+ const refusal = getChatBillingRefusal(error)?.message;
15207
+ if (refusal !== void 0) {
15208
+ return `the turn was refused. ${refusal.endsWith(".") ? refusal : `${refusal}.`} Retrying won't help until the user acts.`;
15209
+ }
15180
15210
  return `the turn failed. ${formatToolError(error)} The conversation is intact; continue-conversation resumes it.`;
15181
15211
  }
15182
15212
  function describeTurnResult(result) {
@@ -15577,7 +15607,7 @@ var parameters13 = {
15577
15607
  automationId: z77.string().describe("The id of the automation, as returned by find-automations."),
15578
15608
  workspaceId: workspaceIdParameter,
15579
15609
  status: z77.enum(AUTOMATION_RUN_STATUSES).optional().describe(
15580
- "Only runs with this outcome. A run refused for an empty balance is `skipped`, not `failed`."
15610
+ "Only runs with this outcome. A run refused for billing reasons will be marked as `skipped`, not `failed`. See details in the response's `failureCategory`."
15581
15611
  ),
15582
15612
  since: isoDateTimeOrDateQueryParamSchema.optional().describe(
15583
15613
  "Only runs started at or after this ISO 8601 timestamp or YYYY-MM-DD date. A date means the start of that UTC day."
@@ -16603,4 +16633,4 @@ export {
16603
16633
  DEFAULT_BASE_URL,
16604
16634
  getMcpServer
16605
16635
  };
16606
- //# sourceMappingURL=chunk-U7WP4F24.js.map
16636
+ //# sourceMappingURL=chunk-66AC5E4I.js.map