@doist/automations-mcp 1.10.1 → 1.12.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({
@@ -10178,7 +10204,8 @@ var FRONTEND_COHORT_EVENTS = [
10178
10204
  "template:used",
10179
10205
  "top-up:completed",
10180
10206
  "guided-creation:started",
10181
- "guided-creation:completed"
10207
+ "guided-creation:completed",
10208
+ "workspace:switched"
10182
10209
  ];
10183
10210
  var BACKEND_COHORT_EVENTS = [
10184
10211
  // API-process (publish lifecycle)
@@ -13992,7 +14019,7 @@ import { McpServer } from "@modelcontextprotocol/server";
13992
14019
  // package.json
13993
14020
  var package_default = {
13994
14021
  name: "@doist/automations-mcp",
13995
- version: "1.10.1",
14022
+ version: "1.12.0",
13996
14023
  description: "MCP server and importable AI tools for Todoist Automations",
13997
14024
  type: "module",
13998
14025
  main: "./dist/index.js",
@@ -14052,7 +14079,7 @@ var package_default = {
14052
14079
  "@types/node": "24.19.2",
14053
14080
  "conventional-changelog-conventionalcommits": "9.3.1",
14054
14081
  esbuild: "0.28.2",
14055
- "gpt-tokenizer": "4.0.3",
14082
+ "gpt-tokenizer": "4.0.4",
14056
14083
  "semantic-release": "25.0.9",
14057
14084
  tsx: "4.23.15",
14058
14085
  typescript: "6.0.3",
@@ -15177,6 +15204,10 @@ function describeTurnError(error, signal) {
15177
15204
  return error.message;
15178
15205
  }
15179
15206
  }
15207
+ const refusal = getChatBillingRefusal(error)?.message;
15208
+ if (refusal !== void 0) {
15209
+ return `the turn was refused. ${refusal.endsWith(".") ? refusal : `${refusal}.`} Retrying won't help until the user acts.`;
15210
+ }
15180
15211
  return `the turn failed. ${formatToolError(error)} The conversation is intact; continue-conversation resumes it.`;
15181
15212
  }
15182
15213
  function describeTurnResult(result) {
@@ -15577,7 +15608,7 @@ var parameters13 = {
15577
15608
  automationId: z77.string().describe("The id of the automation, as returned by find-automations."),
15578
15609
  workspaceId: workspaceIdParameter,
15579
15610
  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`."
15611
+ "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
15612
  ),
15582
15613
  since: isoDateTimeOrDateQueryParamSchema.optional().describe(
15583
15614
  "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 +16634,4 @@ export {
16603
16634
  DEFAULT_BASE_URL,
16604
16635
  getMcpServer
16605
16636
  };
16606
- //# sourceMappingURL=chunk-U7WP4F24.js.map
16637
+ //# sourceMappingURL=chunk-6UJYYF3M.js.map